[Libreoffice-commits] core.git: xmlhelp/source xmloff/inc xmloff/source

Noel Grandin noel at peralex.com
Fri Jun 24 06:46:30 UTC 2016


 xmlhelp/source/cxxhelp/provider/resultsetbase.cxx          |    3 -
 xmlhelp/source/cxxhelp/provider/resultsetbase.hxx          |    1 
 xmloff/inc/XMLImageMapExport.hxx                           |    2 
 xmloff/inc/XMLPercentOrMeasurePropertyHandler.hxx          |    2 
 xmloff/inc/txtvfldi.hxx                                    |    3 -
 xmloff/source/chart/ColorPropertySet.cxx                   |    3 -
 xmloff/source/chart/ColorPropertySet.hxx                   |    1 
 xmloff/source/draw/XMLImageMapExport.cxx                   |   13 ++---
 xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx |   24 +---------
 xmloff/source/text/XMLPropertyBackpatcher.cxx              |   31 +------------
 xmloff/source/text/XMLPropertyBackpatcher.hxx              |    8 ---
 xmloff/source/text/txtvfldi.cxx                            |    9 +--
 xmloff/source/transform/FormPropOOoTContext.cxx            |   19 -------
 13 files changed, 21 insertions(+), 98 deletions(-)

New commits:
commit 6a5e30d52c345cbeb89eab0722fe866db0d62fc6
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Jun 23 11:06:14 2016 +0200

    loplugin:singlevalfields in xmlhelp,xmloff
    
    Change-Id: Ia40d1c9a153b5237c46d5a2b807dceff30775f4a
    Reviewed-on: https://gerrit.libreoffice.org/26589
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
index 8046a77..9858740 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
@@ -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" )
     {
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx
index 56a591b..4d6d36e 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx
@@ -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;
diff --git a/xmloff/inc/XMLImageMapExport.hxx b/xmloff/inc/XMLImageMapExport.hxx
index ada29c3..db7ab92 100644
--- a/xmloff/inc/XMLImageMapExport.hxx
+++ b/xmloff/inc/XMLImageMapExport.hxx
@@ -49,8 +49,6 @@ class XMLImageMapExport
 
     SvXMLExport& mrExport;
 
-    bool mbWhiteSpace;  /// use whitespace between image map elements?
-
 public:
     XMLImageMapExport(SvXMLExport& rExport);
 
diff --git a/xmloff/inc/XMLPercentOrMeasurePropertyHandler.hxx b/xmloff/inc/XMLPercentOrMeasurePropertyHandler.hxx
index 152d866..9aeaea3 100644
--- a/xmloff/inc/XMLPercentOrMeasurePropertyHandler.hxx
+++ b/xmloff/inc/XMLPercentOrMeasurePropertyHandler.hxx
@@ -27,8 +27,6 @@
 */
 class XMLPercentOrMeasurePropertyHandler : public XMLPropertyHandler
 {
-private:
-    bool mbPercent;
 public:
     XMLPercentOrMeasurePropertyHandler();
     virtual ~XMLPercentOrMeasurePropertyHandler ();
diff --git a/xmloff/inc/txtvfldi.hxx b/xmloff/inc/txtvfldi.hxx
index a92f6bc..168d937 100644
--- a/xmloff/inc/txtvfldi.hxx
+++ b/xmloff/inc/txtvfldi.hxx
@@ -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
diff --git a/xmloff/source/chart/ColorPropertySet.cxx b/xmloff/source/chart/ColorPropertySet.cxx
index a14eeec..cba1746 100644
--- a/xmloff/source/chart/ColorPropertySet.cxx
+++ b/xmloff/source/chart/ColorPropertySet.cxx
@@ -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;
 }
diff --git a/xmloff/source/chart/ColorPropertySet.hxx b/xmloff/source/chart/ColorPropertySet.hxx
index 15c65a6..0523d2d 100644
--- a/xmloff/source/chart/ColorPropertySet.hxx
+++ b/xmloff/source/chart/ColorPropertySet.hxx
@@ -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;
 };
 
diff --git a/xmloff/source/draw/XMLImageMapExport.cxx b/xmloff/source/draw/XMLImageMapExport.cxx
index 9ac61aa..34c3515 100644
--- a/xmloff/source/draw/XMLImageMapExport.cxx
+++ b/xmloff/source/draw/XMLImageMapExport.cxx
@@ -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
 }
diff --git a/xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx b/xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx
index 86ac8e2..a232d4a 100644
--- a/xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx
+++ b/xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx
@@ -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;
diff --git a/xmloff/source/text/XMLPropertyBackpatcher.cxx b/xmloff/source/text/XMLPropertyBackpatcher.cxx
index 5f18c6d..fbc86fd 100644
--- a/xmloff/source/text/XMLPropertyBackpatcher.cxx
+++ b/xmloff/source/text/XMLPropertyBackpatcher.cxx
@@ -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
diff --git a/xmloff/source/text/XMLPropertyBackpatcher.hxx b/xmloff/source/text/XMLPropertyBackpatcher.hxx
index aaa641de..74e2c9b 100644
--- a/xmloff/source/text/XMLPropertyBackpatcher.hxx
+++ b/xmloff/source/text/XMLPropertyBackpatcher.hxx
@@ -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();
 
 };
 
diff --git a/xmloff/source/text/txtvfldi.cxx b/xmloff/source/text/txtvfldi.cxx
index 5aadbb5..fe6c5d8 100644
--- a/xmloff/source/text/txtvfldi.cxx
+++ b/xmloff/source/text/txtvfldi.cxx
@@ -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
diff --git a/xmloff/source/transform/FormPropOOoTContext.cxx b/xmloff/source/transform/FormPropOOoTContext.cxx
index d2d8932..612ac20 100644
--- a/xmloff/source/transform/FormPropOOoTContext.cxx
+++ b/xmloff/source/transform/FormPropOOoTContext.cxx
@@ -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(


More information about the Libreoffice-commits mailing list