Kaydet (Commit) 6a5e30d5 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

loplugin:singlevalfields in xmlhelp,xmloff

Change-Id: Ia40d1c9a153b5237c46d5a2b807dceff30775f4a
Reviewed-on: https://gerrit.libreoffice.org/26589Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 24ca187b
......@@ -38,7 +38,6 @@ ResultSetBase::ResultSetBase( const uno::Reference< uno::XComponentContext >& r
m_xProvider( xProvider ),
m_nRow( -1 ),
m_nWasNull( true ),
m_bRowCountFinal( true ),
m_sProperty( seq ),
m_pDisposeEventListeners( nullptr ),
m_pRowCountListeners( nullptr ),
......@@ -498,7 +497,7 @@ uno::Any SAL_CALL ResultSetBase::getPropertyValue(
{
if( PropertyName == "IsRowCountFinal" )
{
return uno::Any(m_bRowCountFinal);
return uno::Any(true);
}
else if ( PropertyName == "RowCount" )
{
......
......@@ -487,7 +487,6 @@ namespace chelp {
css::uno::Reference< css::ucb::XContentProvider > m_xProvider;
sal_Int32 m_nRow;
bool m_nWasNull;
bool m_bRowCountFinal;
typedef std::vector< css::uno::Reference< css::ucb::XContentIdentifier > > IdentSet;
typedef std::vector< css::uno::Reference< css::sdbc::XRow > > ItemSet;
......
......@@ -49,8 +49,6 @@ class XMLImageMapExport
SvXMLExport& mrExport;
bool mbWhiteSpace; /// use whitespace between image map elements?
public:
XMLImageMapExport(SvXMLExport& rExport);
......
......@@ -27,8 +27,6 @@
*/
class XMLPercentOrMeasurePropertyHandler : public XMLPropertyHandler
{
private:
bool mbPercent;
public:
XMLPercentOrMeasurePropertyHandler();
virtual ~XMLPercentOrMeasurePropertyHandler ();
......
......@@ -61,9 +61,6 @@ class XMLValueImportHelper
const bool bSetStyle; /// should PrepareField set NumberFormat?
const bool bSetFormula; /// should PrepareField set Formula?
const bool bStringDefault; /// default: string-value = content
const bool bFormulaDefault; /// default: formula = content
public:
XMLValueImportHelper(
SvXMLImport& rImprt, /// XML Import
......
......@@ -88,7 +88,6 @@ ColorPropertySet::ColorPropertySet( sal_Int32 nColor ) :
// note: length of FillColor and LineColor is 9
m_aColorPropName( "FillColor", 9, RTL_TEXTENCODING_ASCII_US ),
m_nColor( nColor ),
m_bIsFillColor( true ),
m_nDefaultColor( 0x0099ccff ) // blue 8
{}
......@@ -101,7 +100,7 @@ Reference< XPropertySetInfo > SAL_CALL ColorPropertySet::getPropertySetInfo()
throw (uno::RuntimeException, std::exception)
{
if( ! m_xInfo.is())
m_xInfo.set( new lcl_ColorPropertySetInfo( m_bIsFillColor ));
m_xInfo.set( new lcl_ColorPropertySetInfo( true/*bIsFillColor*/ ));
return m_xInfo;
}
......
......@@ -102,7 +102,6 @@ private:
css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;
OUString m_aColorPropName;
sal_Int32 m_nColor;
bool m_bIsFillColor;
sal_Int32 m_nDefaultColor;
};
......
......@@ -66,8 +66,7 @@ XMLImageMapExport::XMLImageMapExport(SvXMLExport& rExp) :
msTarget("Target"),
msURL("URL"),
msTitle("Title"),
mrExport(rExp),
mbWhiteSpace(true)
mrExport(rExp)
{
}
......@@ -100,7 +99,7 @@ void XMLImageMapExport::Export(
// image map container element
SvXMLElementExport aImageMapElement(
mrExport, XML_NAMESPACE_DRAW, XML_IMAGE_MAP,
mbWhiteSpace, mbWhiteSpace);
true/*bWhiteSpace*/, true/*bWhiteSpace*/);
// iterate over image map elements and call ExportMapEntry(...)
// for each
......@@ -226,14 +225,14 @@ void XMLImageMapExport::ExportMapEntry(
DBG_ASSERT(XML_TOKEN_INVALID != eType,
"No name?! How did this happen?");
SvXMLElementExport aAreaElement(mrExport, XML_NAMESPACE_DRAW, eType,
mbWhiteSpace, mbWhiteSpace);
true/*bWhiteSpace*/, true/*bWhiteSpace*/);
// title property (as <svg:title> element)
OUString sTitle;
rPropertySet->getPropertyValue(msTitle) >>= sTitle;
if(!sTitle.isEmpty())
{
SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, mbWhiteSpace, false);
SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, true/*bWhiteSpace*/, false);
mrExport.Characters(sTitle);
}
......@@ -242,13 +241,13 @@ void XMLImageMapExport::ExportMapEntry(
rPropertySet->getPropertyValue(msDescription) >>= sDescription;
if (!sDescription.isEmpty())
{
SvXMLElementExport aDesc(mrExport, XML_NAMESPACE_SVG, XML_DESC, mbWhiteSpace, false);
SvXMLElementExport aDesc(mrExport, XML_NAMESPACE_SVG, XML_DESC, true/*bWhiteSpace*/, false);
mrExport.Characters(sDescription);
}
// export events attached to this
Reference<XEventsSupplier> xSupplier(rPropertySet, UNO_QUERY);
mrExport.GetEventExport().Export(xSupplier, mbWhiteSpace);
mrExport.GetEventExport().Export(xSupplier);
}
// else: no service info -> can't determine type -> ignore entry
}
......
......@@ -33,7 +33,6 @@ using namespace ::com::sun::star::uno;
XMLPercentOrMeasurePropertyHandler::XMLPercentOrMeasurePropertyHandler()
: mbPercent( false )
{
}
......@@ -46,21 +45,13 @@ bool XMLPercentOrMeasurePropertyHandler::importXML(
Any& rValue,
const SvXMLUnitConverter& rUnitConverter ) const
{
if( (rStrImpValue.indexOf( '%' ) != -1) != mbPercent )
if( (rStrImpValue.indexOf( '%' ) != -1))
return false;
sal_Int32 nValue;
if( mbPercent )
{
if (!::sax::Converter::convertPercent( nValue, rStrImpValue ))
return false;
}
else
{
if (!rUnitConverter.convertMeasureToCore( nValue, rStrImpValue ))
return false;
}
if (!rUnitConverter.convertMeasureToCore( nValue, rStrImpValue ))
return false;
rValue <<= nValue;
return true;
......@@ -77,14 +68,7 @@ bool XMLPercentOrMeasurePropertyHandler::exportXML(
if( !(rValue >>= nValue ) )
return false;
if( mbPercent )
{
::sax::Converter::convertPercent( aOut, nValue );
}
else
{
rUnitConverter.convertMeasureToXML( aOut, nValue );
}
rUnitConverter.convertMeasureToXML( aOut, nValue );
rStrExpValue = aOut.makeStringAndClear();
return true;
......
......@@ -34,8 +34,6 @@ template<class A>
XMLPropertyBackpatcher<A>::XMLPropertyBackpatcher(
const OUString& sPropName)
: sPropertyName(sPropName)
, bDefaultHandling(false)
, bPreserveProperty(false)
, sPreservePropertyName()
{
}
......@@ -70,28 +68,11 @@ void XMLPropertyBackpatcher<A>::ResolveId(
// (and preserve Property, if appropriate)
Any aAny;
aAny <<= aValue;
if (bPreserveProperty)
for(BackpatchListType::iterator aIter = pList->begin();
aIter != pList->end();
++aIter)
{
// preserve version
for(BackpatchListType::iterator aIter = pList->begin();
aIter != pList->end();
++aIter)
{
Reference<XPropertySet> xProp = (*aIter);
Any aPres = xProp->getPropertyValue(sPreservePropertyName);
xProp->setPropertyValue(sPropertyName, aAny);
xProp->setPropertyValue(sPreservePropertyName, aPres);
}
}
else
{
// without preserve
for(BackpatchListType::iterator aIter = pList->begin();
aIter != pList->end();
++aIter)
{
(*aIter)->setPropertyValue(sPropertyName, aAny);
}
(*aIter)->setPropertyValue(sPropertyName, aAny);
}
// c) delete list
......@@ -137,10 +118,6 @@ void XMLPropertyBackpatcher<A>::SetProperty(
template<class A>
void XMLPropertyBackpatcher<A>::SetDefault()
{
if (bDefaultHandling)
{
// not implemented yet
}
}
// force instantiation of templates
......
......@@ -61,12 +61,6 @@ class XMLPropertyBackpatcher
/// name of property that gets set or backpatched
OUString sPropertyName;
/// should a default value be set for unresolved properties
bool bDefaultHandling;
/// should the sPreservePropertyName be preserved
bool bPreserveProperty;
/// name of the property to preserve
OUString sPreservePropertyName;
......@@ -113,7 +107,7 @@ public:
/// set default (if bDefaultHandling) for unresolved names
/// called by destructor
void SetDefault();
static void SetDefault();
};
......
......@@ -1165,10 +1165,7 @@ XMLValueImportHelper::XMLValueImportHelper(
bSetType(bType),
bSetValue(bValue),
bSetStyle(bStyle),
bSetFormula(bFormula),
bStringDefault(true),
bFormulaDefault(true)
bSetFormula(bFormula)
{
}
......@@ -1316,7 +1313,7 @@ void XMLValueImportHelper::PrepareField(
if (bSetFormula)
{
aAny <<= (!bFormulaOK && bFormulaDefault) ? sDefault : sFormula;
aAny <<= !bFormulaOK ? sDefault : sFormula;
xPropertySet->setPropertyValue(sPropertyContent, aAny);
}
......@@ -1338,7 +1335,7 @@ void XMLValueImportHelper::PrepareField(
{
if (bStringType)
{
aAny <<= (!bStringValueOK && bStringDefault) ? sDefault : sValue;
aAny <<= !bStringValueOK ? sDefault : sValue;
xPropertySet->setPropertyValue(sPropertyContent, aAny);
}
else
......
......@@ -36,7 +36,6 @@ class XMLFormPropValueTContext_Impl : public XMLTransformerContext
{
OUString m_aAttrQName;
OUString m_aCharacters;
bool m_bPersistent;
bool m_bIsVoid;
public:
......@@ -65,7 +64,6 @@ XMLFormPropValueTContext_Impl::XMLFormPropValueTContext_Impl(
XMLTransformerBase& rTransformer,
const OUString& rQName ) :
XMLTransformerContext( rTransformer, rQName ),
m_bPersistent( true ),
m_bIsVoid( false )
{
}
......@@ -77,7 +75,6 @@ XMLFormPropValueTContext_Impl::XMLFormPropValueTContext_Impl(
XMLTransformerContext( rTransformer, rQName ),
m_aAttrQName( rTransformer.GetNamespaceMap().GetQNameByKey(
XML_NAMESPACE_OFFICE, GetXMLToken(eAttrToken) ) ),
m_bPersistent( true ),
m_bIsVoid( false )
{
}
......@@ -106,20 +103,6 @@ void XMLFormPropValueTContext_Impl::StartElement(
void XMLFormPropValueTContext_Impl::EndElement()
{
if( !m_bPersistent )
{
XMLMutableAttributeList *pMutableAttrList =
new XMLMutableAttributeList;
Reference< XAttributeList > xAttrList( pMutableAttrList );
pMutableAttrList->AddAttribute( m_aAttrQName,
m_aCharacters );
OUString aElemQName( GetTransformer().GetNamespaceMap().GetQNameByKey(
XML_NAMESPACE_FORM, GetXMLToken(XML_LIST_VALUE) ) );
GetTransformer().GetDocHandler()->startElement( aElemQName,
xAttrList );
GetTransformer().GetDocHandler()->endElement( aElemQName );
}
}
void XMLFormPropValueTContext_Impl::Characters( const OUString& rChars )
......@@ -129,7 +112,7 @@ void XMLFormPropValueTContext_Impl::Characters( const OUString& rChars )
bool XMLFormPropValueTContext_Impl::IsPersistent() const
{
return m_bPersistent;
return true;
}
XMLFormPropOOoTransformerContext::XMLFormPropOOoTransformerContext(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment