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