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

Kohei Yoshida kohei.yoshida at gmail.com
Fri Aug 16 18:28:16 PDT 2013


 include/xmloff/xmlexppr.hxx          |   14 +--
 xmloff/source/chart/PropertyMaps.cxx |    6 -
 xmloff/source/draw/sdpropls.cxx      |    2 
 xmloff/source/style/impastp1.cxx     |   31 +-----
 xmloff/source/style/impastp3.cxx     |   36 +++----
 xmloff/source/style/impastp4.cxx     |  152 +++++++++++++--------------------
 xmloff/source/style/impastpl.hxx     |   82 ++++++++---------
 xmloff/source/style/xmlaustp.cxx     |    2 
 xmloff/source/style/xmlexppr.cxx     |  161 ++++++++++++++++-------------------
 9 files changed, 210 insertions(+), 276 deletions(-)

New commits:
commit defbcb229a08f0a147cfdc2c8476684694ad184f
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 16 20:21:19 2013 -0400

    Using ptr_vector for this simplifes it a bit...
    
    Change-Id: Id772a260475de7e9c8599616eff189851af6b356

diff --git a/xmloff/source/style/impastp3.cxx b/xmloff/source/style/impastp3.cxx
index c99fd9e..e9baa3c 100644
--- a/xmloff/source/style/impastp3.cxx
+++ b/xmloff/source/style/impastp3.cxx
@@ -22,14 +22,8 @@
 
 using namespace std;
 
-// Class SvXMLAutoStylePoolParent_Impl
-// dtor class SvXMLAutoStylePoolParent_Impl
-
 SvXMLAutoStylePoolParentP_Impl::~SvXMLAutoStylePoolParentP_Impl()
 {
-    for( size_t i = maPropertiesList.size(); i > 0;  )
-        delete maPropertiesList[ --i ];
-    maPropertiesList.clear();
 }
 
 // Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) to list
@@ -39,13 +33,11 @@ sal_Bool SvXMLAutoStylePoolParentP_Impl::Add( XMLFamilyData_Impl& rFamilyData, c
 {
     sal_Bool bAdded = sal_False;
     SvXMLAutoStylePoolPropertiesP_Impl *pProperties = 0;
-    size_t i = 0;
     sal_Int32 nProperties = rProperties.size();
-    size_t nCount = maPropertiesList.size();
-
-    for( i = 0; i < nCount; i++ )
+    size_t i = 0;
+    for (size_t n = maPropertiesList.size(); i < n; ++i)
     {
-        SvXMLAutoStylePoolPropertiesP_Impl *pIS = maPropertiesList[ i ];
+        SvXMLAutoStylePoolPropertiesP_Impl* pIS = &maPropertiesList[i];
         if( nProperties > (sal_Int32)pIS->GetProperties().size() )
         {
             continue;
@@ -64,7 +56,7 @@ sal_Bool SvXMLAutoStylePoolParentP_Impl::Add( XMLFamilyData_Impl& rFamilyData, c
     if( !pProperties )
     {
         pProperties = new SvXMLAutoStylePoolPropertiesP_Impl( rFamilyData, rProperties );
-        SvXMLAutoStylePoolPropertiesPList_Impl::iterator it = maPropertiesList.begin();
+        PropertiesListType::iterator it = maPropertiesList.begin();
         ::std::advance( it, i );
         maPropertiesList.insert( it, pProperties );
         bAdded = sal_True;
@@ -84,13 +76,11 @@ sal_Bool SvXMLAutoStylePoolParentP_Impl::Add( XMLFamilyData_Impl& rFamilyData, c
 sal_Bool SvXMLAutoStylePoolParentP_Impl::AddNamed( XMLFamilyData_Impl& rFamilyData, const vector< XMLPropertyState >& rProperties, const OUString& rName )
 {
     sal_Bool bAdded = sal_False;
-    size_t i = 0;
     sal_Int32 nProperties = rProperties.size();
-    size_t nCount = maPropertiesList.size();
-
-    for( i = 0; i < nCount; i++ )
+    size_t i = 0;
+    for (size_t n = maPropertiesList.size(); i < n; ++i)
     {
-        SvXMLAutoStylePoolPropertiesP_Impl *pIS = maPropertiesList[ i ];
+        SvXMLAutoStylePoolPropertiesP_Impl* pIS = &maPropertiesList[i];
         if( nProperties > (sal_Int32)pIS->GetProperties().size() )
         {
             continue;
@@ -107,7 +97,7 @@ sal_Bool SvXMLAutoStylePoolParentP_Impl::AddNamed( XMLFamilyData_Impl& rFamilyDa
                 new SvXMLAutoStylePoolPropertiesP_Impl( rFamilyData, rProperties );
         // ignore the generated name
         pProperties->SetName( rName );
-        SvXMLAutoStylePoolPropertiesPList_Impl::iterator it = maPropertiesList.begin();
+        PropertiesListType::iterator it = maPropertiesList.begin();
         ::std::advance( it, i );
         maPropertiesList.insert( it, pProperties );
         bAdded = sal_True;
@@ -124,10 +114,9 @@ OUString SvXMLAutoStylePoolParentP_Impl::Find( const XMLFamilyData_Impl& rFamily
 {
     OUString sName;
     vector< XMLPropertyState>::size_type nItems = rProperties.size();
-    size_t nCount = maPropertiesList.size();
-    for( size_t i = 0; i < nCount; i++ )
+    for (size_t i = 0, n = maPropertiesList.size(); i < n; ++i)
     {
-        SvXMLAutoStylePoolPropertiesP_Impl *pIS = maPropertiesList[ i ];
+        const SvXMLAutoStylePoolPropertiesP_Impl* pIS = &maPropertiesList[i];
         if( nItems > pIS->GetProperties().size() )
         {
             continue;
diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx
index 5f5dffa..3c4aeb1 100644
--- a/xmloff/source/style/impastp4.cxx
+++ b/xmloff/source/style/impastp4.cxx
@@ -292,7 +292,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
         for( size_t j = 0; j < nProperties; j++ )
         {
             const SvXMLAutoStylePoolPropertiesP_Impl* pProperties =
-                rParent.GetPropertiesList()[ j ];
+                &rParent.GetPropertiesList()[j];
             sal_uLong nPos = pProperties->GetPos();
             DBG_ASSERT( nPos < nCount,
                     "SvXMLAutoStylePool_Impl::exportXML: wrong position" );
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
index b004115..d3b6cf6 100644
--- a/xmloff/source/style/impastpl.hxx
+++ b/xmloff/source/style/impastpl.hxx
@@ -33,6 +33,7 @@
 
 #include <boost/noncopyable.hpp>
 #include <boost/ptr_container/ptr_set.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
 
 class SvXMLAutoStylePoolP;
 class SvXMLAutoStylePoolParentP_Impl;
@@ -94,14 +95,15 @@ public:
     void SetName( const OUString& rNew ) { msName = rNew; }
 };
 
-typedef SvXMLAutoStylePoolPropertiesP_Impl* SvXMLAutoStylePoolPropertiesPPtr;
-typedef ::std::vector< SvXMLAutoStylePoolPropertiesPPtr > SvXMLAutoStylePoolPropertiesPList_Impl;
-
 // Parents of AutoStylePool's
 class SvXMLAutoStylePoolParentP_Impl
 {
-    OUString                         msParent;
-    SvXMLAutoStylePoolPropertiesPList_Impl  maPropertiesList;
+public:
+    typedef boost::ptr_vector<SvXMLAutoStylePoolPropertiesP_Impl> PropertiesListType;
+
+private:
+    OUString msParent;
+    PropertiesListType maPropertiesList;
 
 public:
 
@@ -120,7 +122,7 @@ public:
 
     const OUString& GetParent() const { return msParent; }
 
-    const SvXMLAutoStylePoolPropertiesPList_Impl& GetPropertiesList() const
+    const PropertiesListType& GetPropertiesList() const
     {
         return maPropertiesList;
     }
commit 1b183738aecc32219920a698196c72afebcdd8c0
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 16 16:13:59 2013 -0400

    Use ptr_set for auto style parent list. That seems like a natural fit.
    
    Change-Id: I9fc094ec4aa7e4a6d4e637c5940c361639d44c65

diff --git a/xmloff/source/style/impastp1.cxx b/xmloff/source/style/impastp1.cxx
index 2e6f2ce..4d813ae 100644
--- a/xmloff/source/style/impastp1.cxx
+++ b/xmloff/source/style/impastp1.cxx
@@ -28,25 +28,27 @@ XMLFamilyData_Impl::XMLFamilyData_Impl(
         const OUString& rStrName,
         const UniReference < SvXMLExportPropertyMapper > &rMapper,
         const OUString& rStrPrefix,
-        sal_Bool bAsFam ) :
+        bool bAsFamily ) :
     mnFamily( nFamily ), maStrFamilyName( rStrName), mxMapper( rMapper ),
-    mnCount( 0 ), mnName( 0 ), maStrPrefix( rStrPrefix ), bAsFamily( bAsFam )
+    mnCount( 0 ), mnName( 0 ), maStrPrefix( rStrPrefix ), mbAsFamily( bAsFamily )
 
 {
-    mpParentList = new SvXMLAutoStylePoolParentsP_Impl;
     mpNameList   = new SvXMLAutoStylePoolNamesP_Impl;
 }
 
+XMLFamilyData_Impl::XMLFamilyData_Impl( sal_Int32 nFamily ) :
+    mnFamily( nFamily ), mpNameList( NULL ), mnCount( 0 ), mnName( 0 ),
+    mbAsFamily( false )
+{}
+
 XMLFamilyData_Impl::~XMLFamilyData_Impl()
 {
-    delete mpParentList;
     delete mpNameList;
 }
 
 void XMLFamilyData_Impl::ClearEntries()
 {
-    delete mpParentList;
-    mpParentList = new SvXMLAutoStylePoolParentsP_Impl;
+    maParents.clear();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/impastp3.cxx b/xmloff/source/style/impastp3.cxx
index 91fff88..c99fd9e 100644
--- a/xmloff/source/style/impastp3.cxx
+++ b/xmloff/source/style/impastp3.cxx
@@ -146,4 +146,9 @@ OUString SvXMLAutoStylePoolParentP_Impl::Find( const XMLFamilyData_Impl& rFamily
     return sName;
 }
 
+bool SvXMLAutoStylePoolParentP_Impl::operator< (const SvXMLAutoStylePoolParentP_Impl& rOther) const
+{
+    return msParent < rOther.msParent;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx
index c8f3798..5f5dffa 100644
--- a/xmloff/source/style/impastp4.cxx
+++ b/xmloff/source/style/impastp4.cxx
@@ -149,80 +149,70 @@ void SvXMLAutoStylePoolP_Impl::GetRegisteredNames(
 // if not added, yet.
 
 bool SvXMLAutoStylePoolP_Impl::Add(
-    OUString& rName, sal_Int32 nFamily, const OUString& rParent,
+    OUString& rName, sal_Int32 nFamily, const OUString& rParentName,
     const ::std::vector< XMLPropertyState >& rProperties, bool bDontSeek )
 {
-    bool bRet = false;
-
     XMLFamilyData_Impl aTemporary( nFamily );
     FamilyListType::iterator aFind = maFamilyList.find(aTemporary);
     DBG_ASSERT(aFind != maFamilyList.end(), "SvXMLAutoStylePool_Impl::Add: unknown family");
 
-    if (aFind != maFamilyList.end())
-    {
-        XMLFamilyData_Impl &rFamily = *aFind;
+    if (aFind == maFamilyList.end())
+        return false;
 
-        SvXMLAutoStylePoolParentP_Impl aTmp( rParent );
-        SvXMLAutoStylePoolParentP_Impl *pParent = 0;
+    XMLFamilyData_Impl &rFamily = *aFind;
 
-        SvXMLAutoStylePoolParentsP_Impl *pParents = rFamily.mpParentList;
-        SvXMLAutoStylePoolParentsP_Impl::const_iterator const it2 =
-            pParents->find(&aTmp);
-        if (it2 != pParents->end())
-        {
-            pParent = *it2;
-        }
-        else
-        {
-            pParent = new SvXMLAutoStylePoolParentP_Impl( rParent );
-            pParents->insert( pParent );
-        }
+    SvXMLAutoStylePoolParentP_Impl aTmp(rParentName);
+    XMLFamilyData_Impl::ParentsType::iterator it2 = rFamily.maParents.find(aTmp);
+    if (it2 == rFamily.maParents.end())
+    {
+        std::pair<XMLFamilyData_Impl::ParentsType::iterator,bool> r =
+            rFamily.maParents.insert(new SvXMLAutoStylePoolParentP_Impl(rParentName));
+        it2 = r.first;
+    }
 
-        if( pParent->Add( rFamily, rProperties, rName, bDontSeek ) )
-        {
-            rFamily.mnCount++;
-            bRet = true;
-        }
+    SvXMLAutoStylePoolParentP_Impl& rParent = *it2;
+
+    bool bRet = false;
+    if (rParent.Add(rFamily, rProperties, rName, bDontSeek))
+    {
+        rFamily.mnCount++;
+        bRet = true;
     }
 
     return bRet;
 }
 
-sal_Bool SvXMLAutoStylePoolP_Impl::AddNamed(const OUString& rName, sal_Int32 nFamily,
-                const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties )
+bool SvXMLAutoStylePoolP_Impl::AddNamed(
+    const OUString& rName, sal_Int32 nFamily, const OUString& rParentName,
+    const ::std::vector< XMLPropertyState >& rProperties )
 {
     // get family and parent the same way as in Add()
-    sal_Bool bRet(sal_False);
 
     XMLFamilyData_Impl aTemporary( nFamily );
     FamilyListType::iterator aFind = maFamilyList.find(aTemporary);
     DBG_ASSERT(aFind != maFamilyList.end(), "SvXMLAutoStylePool_Impl::Add: unknown family");
 
-    if (aFind != maFamilyList.end())
-    {
-        XMLFamilyData_Impl &rFamily = *aFind;
+    if (aFind == maFamilyList.end())
+        return false;
 
-        SvXMLAutoStylePoolParentP_Impl aTmp( rParent );
-        SvXMLAutoStylePoolParentP_Impl *pParent = 0;
+    XMLFamilyData_Impl &rFamily = *aFind;
 
-        SvXMLAutoStylePoolParentsP_Impl *pParents = rFamily.mpParentList;
-        SvXMLAutoStylePoolParentsP_Impl::const_iterator const it2 =
-            pParents->find(&aTmp);
-        if (it2 != pParents->end())
-        {
-            pParent = *it2;
-        }
-        else
-        {
-            pParent = new SvXMLAutoStylePoolParentP_Impl( rParent );
-            pParents->insert( pParent );
-        }
+    SvXMLAutoStylePoolParentP_Impl aTmp(rParentName);
+    XMLFamilyData_Impl::ParentsType::iterator it2 = rFamily.maParents.find(aTmp);
+    if (it2 == rFamily.maParents.end())
+    {
+        std::pair<XMLFamilyData_Impl::ParentsType::iterator,bool> r =
+            rFamily.maParents.insert(new SvXMLAutoStylePoolParentP_Impl(rParentName));
+        it2 = r.first;
+    }
 
-        if( pParent->AddNamed( rFamily, rProperties, rName ) )
-        {
-            rFamily.mnCount++;
-            bRet = sal_True;
-        }
+    SvXMLAutoStylePoolParentP_Impl& rParent = *it2;
+
+    bool bRet = false;
+    if (rParent.AddNamed(rFamily, rProperties, rName))
+    {
+        rFamily.mnCount++;
+        bRet = true;
     }
 
     return bRet;
@@ -245,15 +235,11 @@ OUString SvXMLAutoStylePoolP_Impl::Find( sal_Int32 nFamily,
     if (iter != maFamilyList.end())
     {
         XMLFamilyData_Impl const& rFamily = *iter;
-        const SvXMLAutoStylePoolParentsP_Impl* pParents =
-            rFamily.mpParentList;
-
         SvXMLAutoStylePoolParentP_Impl aTmp( rParent );
-        SvXMLAutoStylePoolParentsP_Impl::const_iterator const it2 =
-            pParents->find(&aTmp);
-        if (it2 != pParents->end())
+        XMLFamilyData_Impl::ParentsType::const_iterator it2 = rFamily.maParents.find(aTmp);
+        if (it2 != rFamily.maParents.end())
         {
-            sName = (*it2)->Find( rFamily, rProperties );
+            sName = it2->Find(rFamily, rProperties);
         }
     }
 
@@ -288,9 +274,6 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
     // create, initialize and fill helper-structure (SvXMLAutoStylePoolProperties_Impl)
     // which contains a parent-name and a SvXMLAutoStylePoolProperties_Impl
     //
-    const SvXMLAutoStylePoolParentsP_Impl *pParents =
-        rFamily.mpParentList;
-
     SvXMLAutoStylePoolPExport_Impl* aExpStyles =
         new SvXMLAutoStylePoolPExport_Impl[nCount];
 
@@ -301,14 +284,15 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
         aExpStyles[i].mpProperties = 0;
     }
 
-    for (size_t k = 0; k < pParents->size(); k++)
+    XMLFamilyData_Impl::ParentsType::const_iterator it = rFamily.maParents.begin(), itEnd = rFamily.maParents.end();
+    for (; it != itEnd; ++it)
     {
-        const SvXMLAutoStylePoolParentP_Impl *const pParent = (*pParents)[k];
-        size_t nProperties = pParent->GetPropertiesList().size();
+        const SvXMLAutoStylePoolParentP_Impl& rParent = *it;
+        size_t nProperties = rParent.GetPropertiesList().size();
         for( size_t j = 0; j < nProperties; j++ )
         {
             const SvXMLAutoStylePoolPropertiesP_Impl* pProperties =
-                pParent->GetPropertiesList()[ j ];
+                rParent.GetPropertiesList()[ j ];
             sal_uLong nPos = pProperties->GetPos();
             DBG_ASSERT( nPos < nCount,
                     "SvXMLAutoStylePool_Impl::exportXML: wrong position" );
@@ -317,7 +301,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
                 DBG_ASSERT( !aExpStyles[nPos].mpProperties,
                     "SvXMLAutoStylePool_Impl::exportXML: double position" );
                 aExpStyles[nPos].mpProperties = pProperties;
-                aExpStyles[nPos].mpParent = &pParent->GetParent();
+                aExpStyles[nPos].mpParent = &rParent.GetParent();
             }
         }
     }
@@ -338,7 +322,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
                 XML_NAMESPACE_STYLE, XML_NAME,
                 aExpStyles[i].mpProperties->GetName() );
 
-            if( rFamily.bAsFamily )
+            if( rFamily.mbAsFamily )
             {
                 GetExport().AddAttribute(
                     XML_NAMESPACE_STYLE, XML_FAMILY, aStrFamilyName );
@@ -353,7 +337,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
             }
 
             OUString sName;
-            if( rFamily.bAsFamily )
+            if( rFamily.mbAsFamily )
                 sName = GetXMLToken(XML_STYLE);
             else
                 sName = rFamily.maStrFamilyName;
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
index 84bfdfb..b004115 100644
--- a/xmloff/source/style/impastpl.hxx
+++ b/xmloff/source/style/impastpl.hxx
@@ -28,12 +28,14 @@
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/xml/sax/XAttributeList.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <o3tl/sorted_vector.hxx>
 #include <xmloff/maptype.hxx>
 #include <xmloff/xmlexppr.hxx>
 
+#include <boost/noncopyable.hpp>
+#include <boost/ptr_container/ptr_set.hpp>
+
 class SvXMLAutoStylePoolP;
-class SvXMLAutoStylePoolParentsP_Impl;
+class SvXMLAutoStylePoolParentP_Impl;
 typedef std::set<OUString> SvXMLAutoStylePoolNamesP_Impl;
 class SvXMLExportPropertyMapper;
 class SvXMLExport;
@@ -42,31 +44,26 @@ class SvXMLExport;
 
 // Implementationclass for stylefamily-information
 
-class XMLFamilyData_Impl
+struct XMLFamilyData_Impl : boost::noncopyable
 {
-public:
-    sal_uInt32                          mnFamily;
+    typedef boost::ptr_set<SvXMLAutoStylePoolParentP_Impl> ParentsType;
+
+    sal_uInt32                   mnFamily;
     OUString                     maStrFamilyName;
     UniReference < SvXMLExportPropertyMapper >  mxMapper;
 
-    SvXMLAutoStylePoolParentsP_Impl*    mpParentList;
+    ParentsType maParents;
     SvXMLAutoStylePoolNamesP_Impl*      mpNameList;
     sal_uInt32                          mnCount;
     sal_uInt32                          mnName;
     OUString                     maStrPrefix;
-    sal_Bool                            bAsFamily;
+    bool                         mbAsFamily;
 
-public:
     XMLFamilyData_Impl( sal_Int32 nFamily, const OUString& rStrName,
-            const UniReference < SvXMLExportPropertyMapper > &  rMapper,
-            const OUString& rStrPrefix, sal_Bool bAsFamily = sal_True );
+            const UniReference<SvXMLExportPropertyMapper>& rMapper,
+            const OUString& rStrPrefix, bool bAsFamily = true );
 
-    XMLFamilyData_Impl( sal_Int32 nFamily ) :
-        mnFamily( nFamily ), mpParentList( NULL ),
-        mpNameList( NULL ), mnCount( 0 ), mnName( 0 ),
-        bAsFamily( false )
-
-    {}
+    XMLFamilyData_Impl( sal_Int32 nFamily );
     ~XMLFamilyData_Impl();
 
     friend bool operator<(const XMLFamilyData_Impl& r1, const XMLFamilyData_Impl& r2);
@@ -127,6 +124,8 @@ public:
     {
         return maPropertiesList;
     }
+
+    bool operator< (const SvXMLAutoStylePoolParentP_Impl& rOther) const;
 };
 
 struct SvXMLAutoStylePoolParentPCmp_Impl
@@ -136,11 +135,6 @@ struct SvXMLAutoStylePoolParentPCmp_Impl
         return lhs->GetParent().compareTo( rhs->GetParent() ) < 0;
     }
 };
-class SvXMLAutoStylePoolParentsP_Impl : public o3tl::sorted_vector<SvXMLAutoStylePoolParentP_Impl*, SvXMLAutoStylePoolParentPCmp_Impl>
-{
-public:
-    ~SvXMLAutoStylePoolParentsP_Impl() { DeleteAndDestroyAll(); }
-};
 
 // Implementationclass of SvXMLAutoStylePool
 
@@ -171,13 +165,14 @@ public:
 
     bool Add(
         OUString& rName, sal_Int32 nFamily,
-        const OUString& rParent,
+        const OUString& rParentName,
         const ::std::vector< XMLPropertyState >& rProperties,
         bool bDontSeek = false );
 
-    sal_Bool AddNamed( const OUString& rName, sal_Int32 nFamily,
-                const OUString& rParent,
-                const ::std::vector< XMLPropertyState >& rProperties );
+    bool AddNamed(
+        const OUString& rName, sal_Int32 nFamily,
+        const OUString& rParentName,
+        const ::std::vector< XMLPropertyState >& rProperties );
 
     OUString Find( sal_Int32 nFamily, const OUString& rParent,
                           const ::std::vector< XMLPropertyState >& rProperties ) const;
commit e4f55865078e887a34d7b127b75d01ae374968de
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 16 14:52:26 2013 -0400

    This cache data member is never used. Remove it.
    
    Change-Id: I03d55ce8cfe175a75ed22639a06ac22c8783ccd7

diff --git a/xmloff/source/style/impastp1.cxx b/xmloff/source/style/impastp1.cxx
index 49e8e01..2e6f2ce 100644
--- a/xmloff/source/style/impastp1.cxx
+++ b/xmloff/source/style/impastp1.cxx
@@ -28,9 +28,9 @@ XMLFamilyData_Impl::XMLFamilyData_Impl(
         const OUString& rStrName,
         const UniReference < SvXMLExportPropertyMapper > &rMapper,
         const OUString& rStrPrefix,
-        sal_Bool bAsFam )
-    : pCache( 0 ), mnFamily( nFamily ), maStrFamilyName( rStrName), mxMapper( rMapper ),
-      mnCount( 0 ), mnName( 0 ), maStrPrefix( rStrPrefix ), bAsFamily( bAsFam )
+        sal_Bool bAsFam ) :
+    mnFamily( nFamily ), maStrFamilyName( rStrName), mxMapper( rMapper ),
+    mnCount( 0 ), mnName( 0 ), maStrPrefix( rStrPrefix ), bAsFamily( bAsFam )
 
 {
     mpParentList = new SvXMLAutoStylePoolParentsP_Impl;
@@ -41,27 +41,12 @@ XMLFamilyData_Impl::~XMLFamilyData_Impl()
 {
     delete mpParentList;
     delete mpNameList;
-    DBG_ASSERT( !pCache || !pCache->size(), "auto style pool cache is not empty!" );
-    if( pCache )
-    {
-        for ( size_t i = 0, n = pCache->size(); i < n; ++i )
-            delete (*pCache)[ i ];
-        pCache->clear();
-        delete pCache;
-    }
 }
 
 void XMLFamilyData_Impl::ClearEntries()
 {
     delete mpParentList;
     mpParentList = new SvXMLAutoStylePoolParentsP_Impl;
-    DBG_ASSERT( !pCache || !pCache->size(), "auto style pool cache is not empty!" );
-    if( pCache )
-    {
-        for ( size_t i = 0, n = pCache->size(); i < n; ++i )
-            delete (*pCache)[ i ];
-        pCache->clear();
-    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx
index 0edfb0a..c8f3798 100644
--- a/xmloff/source/style/impastp4.cxx
+++ b/xmloff/source/style/impastp4.cxx
@@ -148,13 +148,11 @@ void SvXMLAutoStylePoolP_Impl::GetRegisteredNames(
 // Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) to list
 // if not added, yet.
 
-sal_Bool SvXMLAutoStylePoolP_Impl::Add(OUString& rName, sal_Int32 nFamily,
-                const OUString& rParent,
-                const ::std::vector< XMLPropertyState >& rProperties,
-                sal_Bool bCache,
-                bool bDontSeek )
+bool SvXMLAutoStylePoolP_Impl::Add(
+    OUString& rName, sal_Int32 nFamily, const OUString& rParent,
+    const ::std::vector< XMLPropertyState >& rProperties, bool bDontSeek )
 {
-    sal_Bool bRet(sal_False);
+    bool bRet = false;
 
     XMLFamilyData_Impl aTemporary( nFamily );
     FamilyListType::iterator aFind = maFamilyList.find(aTemporary);
@@ -183,15 +181,7 @@ sal_Bool SvXMLAutoStylePoolP_Impl::Add(OUString& rName, sal_Int32 nFamily,
         if( pParent->Add( rFamily, rProperties, rName, bDontSeek ) )
         {
             rFamily.mnCount++;
-            bRet = sal_True;
-        }
-
-        if( bCache )
-        {
-            if( !rFamily.pCache )
-                rFamily.pCache = new SvXMLAutoStylePoolCache_Impl();
-            if( rFamily.pCache->size() < MAX_CACHE_SIZE )
-                rFamily.pCache->push_back( new OUString( rName ) );
+            bRet = true;
         }
     }
 
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
index 140cc43..84bfdfb 100644
--- a/xmloff/source/style/impastpl.hxx
+++ b/xmloff/source/style/impastpl.hxx
@@ -42,13 +42,9 @@ class SvXMLExport;
 
 // Implementationclass for stylefamily-information
 
-typedef OUString* OUStringPtr;
-typedef ::std::vector< OUStringPtr > SvXMLAutoStylePoolCache_Impl;
-
 class XMLFamilyData_Impl
 {
 public:
-    SvXMLAutoStylePoolCache_Impl        *pCache;
     sal_uInt32                          mnFamily;
     OUString                     maStrFamilyName;
     UniReference < SvXMLExportPropertyMapper >  mxMapper;
@@ -66,7 +62,6 @@ public:
             const OUString& rStrPrefix, sal_Bool bAsFamily = sal_True );
 
     XMLFamilyData_Impl( sal_Int32 nFamily ) :
-        pCache( 0 ),
         mnFamily( nFamily ), mpParentList( NULL ),
         mpNameList( NULL ), mnCount( 0 ), mnName( 0 ),
         bAsFamily( false )
@@ -174,11 +169,12 @@ public:
         com::sun::star::uno::Sequence<sal_Int32>& aFamilies,
         com::sun::star::uno::Sequence<OUString>& aNames );
 
-    sal_Bool Add( OUString& rName, sal_Int32 nFamily,
-                const OUString& rParent,
-                const ::std::vector< XMLPropertyState >& rProperties,
-                sal_Bool bCache = sal_False,
-                bool bDontSeek = false );
+    bool Add(
+        OUString& rName, sal_Int32 nFamily,
+        const OUString& rParent,
+        const ::std::vector< XMLPropertyState >& rProperties,
+        bool bDontSeek = false );
+
     sal_Bool AddNamed( const OUString& rName, sal_Int32 nFamily,
                 const OUString& rParent,
                 const ::std::vector< XMLPropertyState >& rProperties );
diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx
index ef4718b..1baaff8 100644
--- a/xmloff/source/style/xmlaustp.cxx
+++ b/xmloff/source/style/xmlaustp.cxx
@@ -346,7 +346,7 @@ OUString SvXMLAutoStylePoolP::Add( sal_Int32 nFamily,
                                   const vector< XMLPropertyState >& rProperties, bool bDontSeek )
 {
     OUString sName;
-    pImpl->Add(sName, nFamily, rParent, rProperties, sal_False, bDontSeek );
+    pImpl->Add(sName, nFamily, rParent, rProperties, bDontSeek);
     return sName;
 }
 
commit ef60854f7d28a325ddb2f938c2d9fe15e48777b4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 16 14:33:23 2013 -0400

    Tuck this typedef inside class scope where it's used.
    
    Change-Id: I2b3a0479f9aeecd601b3fea4a262f614ec437945

diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx
index c211945..0edfb0a 100644
--- a/xmloff/source/style/impastp4.cxx
+++ b/xmloff/source/style/impastp4.cxx
@@ -68,7 +68,7 @@ void SvXMLAutoStylePoolP_Impl::AddFamily(
 
 #if OSL_DEBUG_LEVEL > 0
     XMLFamilyData_Impl aTemporary( nFamily );
-    XMLFamilyDataList_Impl::iterator aFind = maFamilyList.find(aTemporary);
+    FamilyListType::iterator aFind = maFamilyList.find(aTemporary);
     if( aFind != maFamilyList.end() )
     {
         // FIXME: do we really intend to replace the previous nFamily
@@ -91,7 +91,7 @@ void SvXMLAutoStylePoolP_Impl::SetFamilyPropSetMapper(
 {
 
     XMLFamilyData_Impl aTemporary( nFamily );
-    XMLFamilyDataList_Impl::iterator aFind = maFamilyList.find(aTemporary);
+    FamilyListType::iterator aFind = maFamilyList.find(aTemporary);
     if (aFind != maFamilyList.end())
         aFind->mxMapper = rMapper;
 }
@@ -100,7 +100,7 @@ void SvXMLAutoStylePoolP_Impl::SetFamilyPropSetMapper(
 void SvXMLAutoStylePoolP_Impl::RegisterName( sal_Int32 nFamily, const OUString& rName )
 {
     XMLFamilyData_Impl aTmp( nFamily );
-    XMLFamilyDataList_Impl::iterator aFind = maFamilyList.find(aTmp);
+    FamilyListType::iterator aFind = maFamilyList.find(aTmp);
     DBG_ASSERT( aFind != maFamilyList.end(),
                 "SvXMLAutoStylePool_Impl::RegisterName: unknown family" );
     if (aFind != maFamilyList.end())
@@ -120,7 +120,7 @@ void SvXMLAutoStylePoolP_Impl::GetRegisteredNames(
     vector<OUString> aNames;
 
     // iterate over families
-    for(XMLFamilyDataList_Impl::iterator aJ = maFamilyList.begin(); aJ != maFamilyList.end(); ++aJ)
+    for (FamilyListType::iterator aJ = maFamilyList.begin(); aJ != maFamilyList.end(); ++aJ)
     {
         XMLFamilyData_Impl &rFamily = *aJ;
 
@@ -157,7 +157,7 @@ sal_Bool SvXMLAutoStylePoolP_Impl::Add(OUString& rName, sal_Int32 nFamily,
     sal_Bool bRet(sal_False);
 
     XMLFamilyData_Impl aTemporary( nFamily );
-    XMLFamilyDataList_Impl::iterator aFind = maFamilyList.find(aTemporary);
+    FamilyListType::iterator aFind = maFamilyList.find(aTemporary);
     DBG_ASSERT(aFind != maFamilyList.end(), "SvXMLAutoStylePool_Impl::Add: unknown family");
 
     if (aFind != maFamilyList.end())
@@ -205,7 +205,7 @@ sal_Bool SvXMLAutoStylePoolP_Impl::AddNamed(const OUString& rName, sal_Int32 nFa
     sal_Bool bRet(sal_False);
 
     XMLFamilyData_Impl aTemporary( nFamily );
-    XMLFamilyDataList_Impl::iterator aFind = maFamilyList.find(aTemporary);
+    FamilyListType::iterator aFind = maFamilyList.find(aTemporary);
     DBG_ASSERT(aFind != maFamilyList.end(), "SvXMLAutoStylePool_Impl::Add: unknown family");
 
     if (aFind != maFamilyList.end())
@@ -249,10 +249,8 @@ OUString SvXMLAutoStylePoolP_Impl::Find( sal_Int32 nFamily,
     OUString sName;
 
     XMLFamilyData_Impl aTemporary( nFamily );
-    XMLFamilyDataList_Impl::const_iterator const iter =
-        maFamilyList.find(aTemporary);
-    OSL_ENSURE(iter != maFamilyList.end(),
-            "SvXMLAutoStylePool_Impl::Find: unknown family");
+    FamilyListType::const_iterator const iter = maFamilyList.find(aTemporary);
+    OSL_ENSURE(iter != maFamilyList.end(), "SvXMLAutoStylePool_Impl::Find: unknown family");
 
     if (iter != maFamilyList.end())
     {
@@ -285,7 +283,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
 {
     // Get list of parents for current family (nFamily)
     XMLFamilyData_Impl aTmp( nFamily );
-    XMLFamilyDataList_Impl::const_iterator aFind = maFamilyList.find(aTmp);
+    FamilyListType::const_iterator aFind = maFamilyList.find(aTmp);
     DBG_ASSERT( aFind != maFamilyList.end(),
                 "SvXMLAutoStylePool_Impl::exportXML: unknown family" );
     if (aFind == maFamilyList.end())
@@ -424,7 +422,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
 
 void SvXMLAutoStylePoolP_Impl::ClearEntries()
 {
-    for(XMLFamilyDataList_Impl::iterator aI = maFamilyList.begin(); aI != maFamilyList.end(); ++aI)
+    for (FamilyListType::iterator aI = maFamilyList.begin(); aI != maFamilyList.end(); ++aI)
         aI->ClearEntries();
 }
 
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
index 1d8969f..140cc43 100644
--- a/xmloff/source/style/impastpl.hxx
+++ b/xmloff/source/style/impastpl.hxx
@@ -79,9 +79,6 @@ public:
     void ClearEntries();
 };
 
-// A set that finds and sorts based only on mnFamily
-typedef boost::ptr_set<XMLFamilyData_Impl> XMLFamilyDataList_Impl;
-
 // Properties of a pool
 
 class SvXMLAutoStylePoolPropertiesP_Impl
@@ -154,9 +151,11 @@ public:
 
 class SvXMLAutoStylePoolP_Impl
 {
-    SvXMLExport& rExport;
+    // A set that finds and sorts based only on mnFamily
+    typedef boost::ptr_set<XMLFamilyData_Impl> FamilyListType;
 
-    XMLFamilyDataList_Impl      maFamilyList;
+    SvXMLExport& rExport;
+    FamilyListType maFamilyList;
 
 public:
 
commit 7c02faf535a768252fc3559324ac68bc6525763a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 16 11:12:04 2013 -0400

    Properly hide implementation details.
    
    If we are to hide, let's hide all.
    
    Change-Id: Ic68926ee099ac80d2d477d68e3769a7203dfea6c

diff --git a/include/xmloff/xmlexppr.hxx b/include/xmloff/xmlexppr.hxx
index 7e7bb76..b63b69c 100644
--- a/include/xmloff/xmlexppr.hxx
+++ b/include/xmloff/xmlexppr.hxx
@@ -41,14 +41,10 @@ class SvXMLExport;
 
 class XMLOFF_DLLPUBLIC SvXMLExportPropertyMapper : public UniRefBase
 {
-    UniReference< SvXMLExportPropertyMapper> mxNextMapper;
-
-    FilterPropertiesInfos_Impl *pCache;
+    struct Impl;
+    Impl* mpImpl;
 
 protected:
-    UniReference< XMLPropertySetMapper > maPropMapper;
-
-    OUString maStyleName;
 
     /** Filter all properties we don't want to export:
         Take all properties of the XPropertySet which are also found in the
@@ -177,10 +173,10 @@ public:
             const ::std::vector< XMLPropertyState > *pProperties = 0,
             sal_uInt32 nIdx = 0 ) const;
 
-    inline const UniReference< XMLPropertySetMapper >&
-        getPropertySetMapper() const { return maPropMapper; }
+    const UniReference<XMLPropertySetMapper>& getPropertySetMapper() const;
 
-    void SetStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; }
+    void SetStyleName( const OUString& rStyleName );
+    const OUString& GetStyleName() const;
 };
 
 #endif  //  _XMLOFF_XMLEXPPR_HXX
diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx
index ce07cbd..6970d59 100644
--- a/xmloff/source/chart/PropertyMaps.cxx
+++ b/xmloff/source/chart/PropertyMaps.cxx
@@ -361,14 +361,14 @@ void XMLChartExportPropertyMapper::handleSpecialItem(
 {
     sal_Bool bHandled = sal_False;
 
-    sal_Int32 nContextId = maPropMapper->GetEntryContextId( rProperty.mnIndex );
+    sal_Int32 nContextId = getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex );
 
     if( nContextId )
     {
         bHandled = sal_True;
 
-        OUString sAttrName = maPropMapper->GetEntryXMLName( rProperty.mnIndex );
-        sal_uInt16 nNameSpace = maPropMapper->GetEntryNameSpace( rProperty.mnIndex );
+        OUString sAttrName = getPropertySetMapper()->GetEntryXMLName( rProperty.mnIndex );
+        sal_uInt16 nNameSpace = getPropertySetMapper()->GetEntryNameSpace( rProperty.mnIndex );
         OUStringBuffer sValueBuffer;
         OUString sValue;
 
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index bb709c7..2c5e2fd 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -1545,7 +1545,7 @@ void XMLShapeExportPropertyMapper::handleElementItem(
                 {
                     uno::Reference< container::XIndexReplace > xNumRule( rProperty.maValue, uno::UNO_QUERY );
                     if( xNumRule.is() )
-                        const_cast<XMLShapeExportPropertyMapper*>(this)->maNumRuleExp.exportNumberingRule( maStyleName, sal_False, xNumRule );
+                        const_cast<XMLShapeExportPropertyMapper*>(this)->maNumRuleExp.exportNumberingRule(GetStyleName(), false, xNumRule);
                 }
             }
             break;
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index 0637cd2..4d27c69 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -204,32 +204,23 @@ public:
     sal_uInt32 GetPropertyCount() const { return nCount; }
 };
 
-typedef boost::unordered_map
-<
-    PropertySetInfoKey,
-    FilterPropertiesInfo_Impl *,
-    PropertySetInfoHash,
-    PropertySetInfoHash
->
-FilterOropertiesHashMap_Impl;
-
-class FilterPropertiesInfos_Impl : public FilterOropertiesHashMap_Impl
+struct SvXMLExportPropertyMapper::Impl
 {
-public:
-    ~FilterPropertiesInfos_Impl ();
-};
+    typedef boost::unordered_map<PropertySetInfoKey, FilterPropertiesInfo_Impl*, PropertySetInfoHash, PropertySetInfoHash> CacheType;
+    CacheType maCache;
 
-FilterPropertiesInfos_Impl::~FilterPropertiesInfos_Impl ()
-{
-    FilterOropertiesHashMap_Impl::iterator aIter = begin();
-    FilterOropertiesHashMap_Impl::iterator aEnd = end();
-    while( aIter != aEnd )
+    UniReference<SvXMLExportPropertyMapper> mxNextMapper;
+    UniReference<XMLPropertySetMapper> mxPropMapper;
+
+    OUString maStyleName;
+
+    ~Impl()
     {
-        delete (*aIter).second;
-        (*aIter).second = 0;
-        ++aIter;
+        CacheType::iterator it = maCache.begin(), itEnd = maCache.end();
+        for (; it != itEnd; ++it)
+            delete it->second;
     }
-}
+};
 
 FilterPropertiesInfo_Impl::FilterPropertiesInfo_Impl() :
     nCount(0),
@@ -544,44 +535,43 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray(
 
 SvXMLExportPropertyMapper::SvXMLExportPropertyMapper(
         const UniReference< XMLPropertySetMapper >& rMapper ) :
-    pCache( 0 ),
-    maPropMapper( rMapper )
+    mpImpl(new Impl)
 {
+    mpImpl->mxPropMapper = rMapper;
 }
 
 SvXMLExportPropertyMapper::~SvXMLExportPropertyMapper()
 {
-    delete pCache;
-    mxNextMapper = 0;
+    delete mpImpl;
 }
 
 void SvXMLExportPropertyMapper::ChainExportMapper(
         const UniReference< SvXMLExportPropertyMapper>& rMapper )
 {
     // add map entries from rMapper to current map
-    maPropMapper->AddMapperEntry( rMapper->getPropertySetMapper() );
+    mpImpl->mxPropMapper->AddMapperEntry( rMapper->getPropertySetMapper() );
     // rMapper uses the same map as 'this'
-    rMapper->maPropMapper = maPropMapper;
+    rMapper->mpImpl->mxPropMapper = mpImpl->mxPropMapper;
 
     // set rMapper as last mapper in current chain
-    UniReference< SvXMLExportPropertyMapper > xNext = mxNextMapper;
+    UniReference< SvXMLExportPropertyMapper > xNext = mpImpl->mxNextMapper;
     if( xNext.is())
     {
-        while( xNext->mxNextMapper.is())
-            xNext = xNext->mxNextMapper;
-        xNext->mxNextMapper = rMapper;
+        while (xNext->mpImpl->mxNextMapper.is())
+            xNext = xNext->mpImpl->mxNextMapper;
+        xNext->mpImpl->mxNextMapper = rMapper;
     }
     else
-        mxNextMapper = rMapper;
+        mpImpl->mxNextMapper = rMapper;
 
     // if rMapper was already chained, correct
     // map pointer of successors
     xNext = rMapper;
 
-    while( xNext->mxNextMapper.is())
+    while (xNext->mpImpl->mxNextMapper.is())
     {
-        xNext = xNext->mxNextMapper;
-        xNext->maPropMapper = maPropMapper;
+        xNext = xNext->mpImpl->mxNextMapper;
+        xNext->mpImpl->mxPropMapper = mpImpl->mxPropMapper;
     }
 }
 
@@ -596,7 +586,7 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
     if( !xInfo.is() )
         return aPropStateArray;
 
-    sal_Int32 nProps = maPropMapper->GetEntryCount();
+    sal_Int32 nProps = mpImpl->mxPropMapper->GetEntryCount();
 
     FilterPropertiesInfo_Impl *pFilterInfo = 0;
 
@@ -607,16 +597,12 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
         aImplId = xTypeProv->getImplementationId();
         if( aImplId.getLength() == 16 )
         {
-            if( pCache )
-            {
-                // The key must not be created outside this block, because it
-                // keeps a reference to the property set info.
-                PropertySetInfoKey aKey( xInfo, aImplId );
-                FilterPropertiesInfos_Impl::iterator aIter =
-                    pCache->find( aKey );
-                if( aIter != pCache->end() )
-                    pFilterInfo = (*aIter).second;
-            }
+            // The key must not be created outside this block, because it
+            // keeps a reference to the property set info.
+            PropertySetInfoKey aKey( xInfo, aImplId );
+            Impl::CacheType::iterator aIter = mpImpl->maCache.find(aKey);
+            if (aIter != mpImpl->maCache.end())
+                pFilterInfo = (*aIter).second;
         }
     }
 
@@ -628,15 +614,15 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
         {
             // Are we allowed to ask for the property? (MID_FLAG_NO_PROP..)
             // Does the PropertySet contain name of mpEntries-array ?
-            const OUString& rAPIName = maPropMapper->GetEntryAPIName( i );
-            const sal_Int32 nFlags = maPropMapper->GetEntryFlags( i );
+            const OUString& rAPIName = mpImpl->mxPropMapper->GetEntryAPIName( i );
+            const sal_Int32 nFlags = mpImpl->mxPropMapper->GetEntryFlags( i );
             if( (0 == (nFlags & MID_FLAG_NO_PROPERTY_EXPORT)) &&
                 ( (0 != (nFlags & MID_FLAG_MUST_EXIST)) ||
                   xInfo->hasPropertyByName( rAPIName ) ) )
             {
                 const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
                 const SvtSaveOptions::ODFDefaultVersion nEarliestODFVersionForExport(
-                        maPropMapper->GetEarliestODFVersionForExport( i ) );
+                        mpImpl->mxPropMapper->GetEarliestODFVersionForExport(i));
                 if( nCurrentVersion >= nEarliestODFVersionForExport
                         || nCurrentVersion == SvtSaveOptions::ODFVER_UNKNOWN
                         || nEarliestODFVersionForExport == SvtSaveOptions::ODFVER_UNKNOWN )
@@ -655,19 +641,16 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
             xInfo = xWeakInfo;
             if( xInfo.is() )
             {
-                if( !pCache )
-                    ((SvXMLExportPropertyMapper *)this)->pCache =
-                        new FilterPropertiesInfos_Impl;
                 PropertySetInfoKey aKey( xInfo, aImplId );
-                (*pCache)[aKey] = pFilterInfo;
+                mpImpl->maCache.insert(Impl::CacheType::value_type(aKey, pFilterInfo));
             }
             else
-                bDelInfo = sal_True;
+                bDelInfo = true;
         }
         else
         {
             OSL_FAIL("here is no TypeProvider or the ImplId is wrong");
-            bDelInfo = sal_True;
+            bDelInfo = true;
         }
     }
 
@@ -675,9 +658,8 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
     {
         try
         {
-            pFilterInfo->FillPropertyStateArray(aPropStateArray,
-                                                xPropSet, maPropMapper,
-                                                bDefault);
+            pFilterInfo->FillPropertyStateArray(
+                aPropStateArray, xPropSet, mpImpl->mxPropMapper, bDefault);
         }
         catch( UnknownPropertyException& )
         {
@@ -703,8 +685,8 @@ void SvXMLExportPropertyMapper::ContextFilter(
         Reference< XPropertySet > rPropSet ) const
 {
     // Derived class could implement this.
-    if( mxNextMapper.is() )
-        mxNextMapper->ContextFilter( rProperties, rPropSet );
+    if (mpImpl->mxNextMapper.is())
+        mpImpl->mxNextMapper->ContextFilter(rProperties, rPropSet);
 }
 
 // Compares two Sequences of XMLPropertyState:
@@ -732,13 +714,13 @@ sal_Bool SvXMLExportPropertyMapper::Equals(
                 if( rProp1.mnIndex != -1 )
                 {
                     // Now compare values
-                    if( ( maPropMapper->GetEntryType( rProp1.mnIndex ) &
+                    if ( (mpImpl->mxPropMapper->GetEntryType( rProp1.mnIndex ) &
                           XML_TYPE_BUILDIN_CMP ) != 0 )
                         // simple type ( binary compare )
                         bRet = ( rProp1.maValue == rProp2.maValue );
                     else
                         // complex type ( ask for compare-function )
-                        bRet = maPropMapper->GetPropertyHandler(
+                        bRet = mpImpl->mxPropMapper->GetPropertyHandler(
                                     rProp1.mnIndex )->equals( rProp1.maValue,
                                                               rProp2.maValue );
                 }
@@ -832,10 +814,10 @@ void SvXMLExportPropertyMapper::handleSpecialItem(
         const ::std::vector< XMLPropertyState > *pProperties,
         sal_uInt32 nIdx ) const
 {
-    OSL_ENSURE( mxNextMapper.is(), "special item not handled in xml export" );
-    if( mxNextMapper.is() )
-        mxNextMapper->handleSpecialItem( rAttrList, rProperty, rUnitConverter,
-                                        rNamespaceMap, pProperties, nIdx );
+    OSL_ENSURE(mpImpl->mxNextMapper.is(), "special item not handled in xml export");
+    if (mpImpl->mxNextMapper.is())
+        mpImpl->mxNextMapper->handleSpecialItem(
+            rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx);
 }
 
 /** this method is called for every item that has the
@@ -847,10 +829,9 @@ void SvXMLExportPropertyMapper::handleElementItem(
         const ::std::vector< XMLPropertyState > *pProperties,
         sal_uInt32 nIdx ) const
 {
-    OSL_ENSURE( mxNextMapper.is(), "element item not handled in xml export" );
-    if( mxNextMapper.is() )
-        mxNextMapper->handleElementItem( rExport, rProperty, nFlags,
-                                         pProperties, nIdx );
+    OSL_ENSURE(mpImpl->mxNextMapper.is(), "element item not handled in xml export");
+    if (mpImpl->mxNextMapper.is())
+        mpImpl->mxNextMapper->handleElementItem(rExport, rProperty, nFlags, pProperties, nIdx);
 }
 
 // protected methods
@@ -872,7 +853,7 @@ void SvXMLExportPropertyMapper::_exportXML(
     if( -1 == nPropMapStartIdx )
         nPropMapStartIdx = 0;
     if( -1 == nPropMapEndIdx )
-        nPropMapEndIdx = maPropMapper->GetEntryCount();
+        nPropMapEndIdx = mpImpl->mxPropMapper->GetEntryCount();
 
     while( nIndex < nCount )
     {
@@ -880,7 +861,7 @@ void SvXMLExportPropertyMapper::_exportXML(
         if( nPropMapIdx >= nPropMapStartIdx &&
             nPropMapIdx < nPropMapEndIdx  )// valid entry?
         {
-            sal_uInt32 nEFlags = maPropMapper->GetEntryFlags( nPropMapIdx );
+            sal_uInt32 nEFlags = mpImpl->mxPropMapper->GetEntryFlags(nPropMapIdx);
             sal_uInt16 nEPType = GET_PROP_TYPE(nEFlags);
             OSL_ENSURE( nEPType >= (XML_TYPE_PROP_START>>XML_TYPE_PROP_SHIFT),
                         "no prop type sepcified" );
@@ -918,8 +899,7 @@ void SvXMLExportPropertyMapper::_exportXML(
         const ::std::vector< XMLPropertyState > *pProperties,
         sal_uInt32 nIdx ) const
 {
-    if ( ( maPropMapper->GetEntryFlags( rProperty.mnIndex ) &
-                MID_FLAG_SPECIAL_ITEM_EXPORT ) != 0 )
+    if ((mpImpl->mxPropMapper->GetEntryFlags(rProperty.mnIndex) & MID_FLAG_SPECIAL_ITEM_EXPORT) != 0)
     {
         uno::Reference< container::XNameContainer > xAttrContainer;
         if( (rProperty.maValue >>= xAttrContainer) && xAttrContainer.is() )
@@ -1028,23 +1008,21 @@ void SvXMLExportPropertyMapper::_exportXML(
                                rNamespaceMap, pProperties, nIdx );
         }
     }
-    else if ( ( maPropMapper->GetEntryFlags( rProperty.mnIndex ) &
-                    MID_FLAG_ELEMENT_ITEM_EXPORT ) == 0 )
+    else if ((mpImpl->mxPropMapper->GetEntryFlags(rProperty.mnIndex) & MID_FLAG_ELEMENT_ITEM_EXPORT ) == 0)
     {
         OUString aValue;
-        const OUString sName( rNamespaceMap.GetQNameByKey(
-                    maPropMapper->GetEntryNameSpace( rProperty.mnIndex ),
-                    maPropMapper->GetEntryXMLName( rProperty.mnIndex ) ) );
+        const OUString sName = rNamespaceMap.GetQNameByKey(
+            mpImpl->mxPropMapper->GetEntryNameSpace(rProperty.mnIndex),
+            mpImpl->mxPropMapper->GetEntryXMLName(rProperty.mnIndex));
 
         sal_Bool bRemove = sal_False;
-        if( ( maPropMapper->GetEntryFlags( rProperty.mnIndex ) &
-                    MID_FLAG_MERGE_ATTRIBUTE ) != 0 )
+        if ((mpImpl->mxPropMapper->GetEntryFlags( rProperty.mnIndex ) & MID_FLAG_MERGE_ATTRIBUTE) != 0)
         {
             aValue = rAttrList.getValueByName( sName );
             bRemove = sal_True;
         }
 
-        if( maPropMapper->exportXML( aValue, rProperty, rUnitConverter ) )
+        if (mpImpl->mxPropMapper->exportXML(aValue, rProperty, rUnitConverter))
         {
             if( bRemove )
                 rAttrList.RemoveAttribute( sName );
@@ -1066,7 +1044,7 @@ void SvXMLExportPropertyMapper::exportElementItems(
     {
         const sal_uInt16 nElement = rIndexArray[nIndex];
 
-        OSL_ENSURE( 0 != ( maPropMapper->GetEntryFlags(
+        OSL_ENSURE( 0 != (mpImpl->mxPropMapper->GetEntryFlags(
                 rProperties[nElement].mnIndex ) & MID_FLAG_ELEMENT_ITEM_EXPORT),
                 "wrong mid flag!" );
 
@@ -1080,4 +1058,19 @@ void SvXMLExportPropertyMapper::exportElementItems(
         rExport.IgnorableWhitespace();
 }
 
+const UniReference<XMLPropertySetMapper>& SvXMLExportPropertyMapper::getPropertySetMapper() const
+{
+    return mpImpl->mxPropMapper;
+}
+
+void SvXMLExportPropertyMapper::SetStyleName( const OUString& rStyleName )
+{
+    mpImpl->maStyleName = rStyleName;
+}
+
+const OUString& SvXMLExportPropertyMapper::GetStyleName() const
+{
+    return mpImpl->maStyleName;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list