[Libreoffice-commits] core.git: include/xmloff svx/source xmloff/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Sun Jan 14 13:45:33 UTC 2018


 include/xmloff/ImageStyle.hxx            |   19 ++++------------
 svx/source/xml/xmlxtimp.cxx              |    1 
 xmloff/source/core/xmlexp.cxx            |    2 -
 xmloff/source/style/FillStyleContext.cxx |    1 
 xmloff/source/style/ImageStyle.cxx       |   36 ++++++-------------------------
 5 files changed, 12 insertions(+), 47 deletions(-)

New commits:
commit 640a7c791b4665c16be7ad8f5f7dda30dcc88eda
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon Jan 8 12:52:04 2018 +0900

    xmloff: XmlImageStyle class is pointless as the methods are static
    
    When used, we instantiate the XmlImageStyle class but all its
    methods are static, so instantioation is completely pointless.
    So change XmlImageStyle to a namespace and static method to
    functions.
    
    Change-Id: I6385bd7eeb08c627cb8e48b79a6820372cf94a65
    Reviewed-on: https://gerrit.libreoffice.org/47851
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/include/xmloff/ImageStyle.hxx b/include/xmloff/ImageStyle.hxx
index 2fd3f0167583..80f873d386fc 100644
--- a/include/xmloff/ImageStyle.hxx
+++ b/include/xmloff/ImageStyle.hxx
@@ -31,23 +31,14 @@ class SvXMLUnitConverter;
 class SvXMLExport;
 class SvXMLImport;
 
-class XMLOFF_DLLPUBLIC XMLImageStyle
+namespace XMLImageStyle
 {
-public:
-    XMLImageStyle();
-    ~XMLImageStyle();
 
-    static void exportXML( const OUString& rStrName, const css::uno::Any& rValue, SvXMLExport& rExport );
-    static void importXML( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList, css::uno::Any& rValue, OUString& rStrName, SvXMLImport& rImport );
+XMLOFF_DLLPUBLIC void exportXML(OUString const & rStrName, css::uno::Any const & rValue, SvXMLExport& rExport);
+XMLOFF_DLLPUBLIC bool importXML(css::uno::Reference<css::xml::sax::XAttributeList> const & xAttrList,
+                                css::uno::Any& rValue, OUString& rStrName, SvXMLImport& rImport);
 
-private:
-
-    SAL_DLLPRIVATE static void ImpExportXML( const OUString& rStrName, const css::uno::Any& rValue,
-                           SvXMLExport& rExport );
-    SAL_DLLPRIVATE static bool ImpImportXML( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
-                           css::uno::Any& rValue, OUString& rStrName,
-                           SvXMLImport& rImport );
-};
+}
 
 #endif // INCLUDED_XMLOFF_IMAGESTYLE_HXX
 
diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx
index 207912fca311..14b4156dd14b 100644
--- a/svx/source/xml/xmlxtimp.cxx
+++ b/svx/source/xml/xmlxtimp.cxx
@@ -275,7 +275,6 @@ void SvxXMLTableImportContext::importBitmap( const uno::Reference< XAttributeLis
 {
     try
     {
-        XMLImageStyle aImageStyle;
         XMLImageStyle::importXML( xAttrList, rAny, rName, GetImport() );
     }
     catch (const Exception&)
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 2a0ecb11f25a..796390f2b1e1 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1609,8 +1609,6 @@ void SvXMLExport::ExportStyles_( bool )
             uno::Reference< container::XNameAccess > xBitmap( xFact->createInstance("com.sun.star.drawing.BitmapTable"), uno::UNO_QUERY );
             if( xBitmap.is() )
             {
-                XMLImageStyle aImageStyle;
-
                 if( xBitmap->hasElements() )
                 {
                     uno::Sequence< OUString > aNamesSeq ( xBitmap->getElementNames() );
diff --git a/xmloff/source/style/FillStyleContext.cxx b/xmloff/source/style/FillStyleContext.cxx
index 15bf47a5d6b8..89c73965749f 100644
--- a/xmloff/source/style/FillStyleContext.cxx
+++ b/xmloff/source/style/FillStyleContext.cxx
@@ -125,7 +125,6 @@ XMLBitmapStyleContext::XMLBitmapStyleContext( SvXMLImport& rImport, sal_uInt16 n
 :   SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
 {
     // start import
-    XMLImageStyle aBitmapStyle;
     XMLImageStyle::importXML( xAttrList, maAny, maStrName, rImport );
 }
 
diff --git a/xmloff/source/style/ImageStyle.cxx b/xmloff/source/style/ImageStyle.cxx
index 2a648f3084d9..d4be8a0a2a1f 100644
--- a/xmloff/source/style/ImageStyle.cxx
+++ b/xmloff/source/style/ImageStyle.cxx
@@ -22,7 +22,7 @@
 #include <xmloff/attrlist.hxx>
 #include <xmloff/nmspmap.hxx>
 #include <xmloff/xmluconv.hxx>
-#include<xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlnmspe.hxx>
 #include <xmloff/xmltoken.hxx>
 #include <xmloff/xmlexp.hxx>
 #include <xmloff/xmlimp.hxx>
@@ -30,9 +30,8 @@
 #include <rtl/ustring.hxx>
 #include <xmloff/xmltkmap.hxx>
 
-using namespace ::com::sun::star;
-
-using namespace ::xmloff::token;
+using namespace css;
+using namespace xmloff::token;
 
 enum SvXMLTokenMapAttrs
 {
@@ -44,21 +43,7 @@ enum SvXMLTokenMapAttrs
     XML_TOK_IMAGE_ACTUATE
 };
 
-
-XMLImageStyle::XMLImageStyle()
-{
-}
-
-XMLImageStyle::~XMLImageStyle()
-{
-}
-
-void XMLImageStyle::exportXML( const OUString& rStrName, const css::uno::Any& rValue, SvXMLExport& rExport )
-{
-    ImpExportXML( rStrName, rValue, rExport );
-}
-
-void XMLImageStyle::ImpExportXML( const OUString& rStrName, const uno::Any& rValue, SvXMLExport& rExport )
+void XMLImageStyle::exportXML(OUString const & rStrName, uno::Any const & rValue, SvXMLExport& rExport)
 {
     OUString sImageURL;
 
@@ -97,16 +82,10 @@ void XMLImageStyle::ImpExportXML( const OUString& rStrName, const uno::Any& rVal
     }
 }
 
-void XMLImageStyle::importXML( const uno::Reference< xml::sax::XAttributeList >& xAttrList, uno::Any& rValue, OUString& rStrName, SvXMLImport& rImport )
+bool XMLImageStyle::importXML(uno::Reference<xml::sax::XAttributeList> const & xAttrList,
+                              uno::Any& rValue, OUString& rStrName, SvXMLImport& rImport)
 {
-    ImpImportXML( xAttrList, rValue, rStrName, rImport );
-}
-
-bool XMLImageStyle::ImpImportXML( const uno::Reference< xml::sax::XAttributeList >& xAttrList,
-                                      uno::Any& rValue, OUString& rStrName,
-                                      SvXMLImport& rImport )
-{
-    static const SvXMLTokenMapEntry aHatchAttrTokenMap[] =
+     static const SvXMLTokenMapEntry aHatchAttrTokenMap[] =
     {
         { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_IMAGE_NAME },
         { XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, XML_TOK_IMAGE_DISPLAY_NAME },
@@ -175,7 +154,6 @@ bool XMLImageStyle::ImpImportXML( const uno::Reference< xml::sax::XAttributeList
     }
 
     bool bRet = bHasName && bHasHRef;
-
     return bRet;
 }
 


More information about the Libreoffice-commits mailing list