include/oox/core/relations.hxx             |   18 +++++++++++++++++-
 oox/source/core/relations.cxx              |   15 ++++++++-------
 oox/source/core/relationshandler.cxx       |    2 +-
 sc/source/filter/oox/worksheetfragment.cxx |    6 +++---
 4 files changed, 29 insertions(+), 12 deletions(-)

New commits:
commit c51f77b1c02d03a4932d1b20ba6440465d265d48
Author: Takeshi Abe <t...@fixedpoint.jp>
Date:   Fri Oct 10 14:08:49 2014 +0900

    fdo#75757: remove inheritance to std::map
    
    from oox::core::Relations.
    
    Change-Id: If2e0109a2ad6598436177b7638cb6d568fb2d3d6
    Reviewed-on: https://gerrit.libreoffice.org/11899
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/oox/core/relations.hxx b/include/oox/core/relations.hxx
index 38a99c8..e33cb93 100644
--- a/include/oox/core/relations.hxx
+++ b/include/oox/core/relations.hxx
@@ -68,11 +68,26 @@ struct Relation
 class Relations;
 typedef ::boost::shared_ptr< Relations > RelationsRef;
 
-class OOX_DLLPUBLIC Relations : public ::std::map< OUString, Relation >
+class OOX_DLLPUBLIC Relations
 {
 public:
     explicit            Relations( const OUString& rFragmentPath );
 
+    size_t size() const { return maMap.size(); }
+    size_t count( const OUString& rId ) const { return maMap.count( rId ); }
+    ::std::map< OUString, Relation >::const_iterator begin() const
+    {
+        return maMap.begin();
+    }
+    ::std::map< OUString, Relation >::const_iterator end() const
+    {
+        return maMap.end();
+    }
+    void insert( const ::std::map< OUString, Relation >::value_type& rVal )
+    {
+        maMap.insert( rVal );
+    }
+
     /** Returns the path of the fragment this relations collection is related 
to. */
     const OUString& getFragmentPath() const { return maFragmentPath; }
 
@@ -99,6 +114,7 @@ public:
     OUString     getFragmentPathFromFirstTypeFromOfficeDoc( const OUString& 
rType ) const;
 
 private:
+    ::std::map< OUString, Relation > maMap;
     OUString     maFragmentPath;
 };
 
diff --git a/oox/source/core/relations.cxx b/oox/source/core/relations.cxx
index 4122678..5c75b33 100644
--- a/oox/source/core/relations.cxx
+++ b/oox/source/core/relations.cxx
@@ -52,20 +52,21 @@ OUString createOfficeDocRelationTypeStrict(const OUString& 
rType)
 
 }
 
-Relations::Relations( const OUString& rFragmentPath ) :
-    maFragmentPath( rFragmentPath )
+Relations::Relations( const OUString& rFragmentPath )
+    : maMap()
+    , maFragmentPath( rFragmentPath )
 {
 }
 
 const Relation* Relations::getRelationFromRelId( const OUString& rId ) const
 {
-    const_iterator aIt = find( rId );
-    return (aIt == end()) ? 0 : &aIt->second;
+    ::std::map< OUString, Relation >::const_iterator aIt = maMap.find( rId );
+    return (aIt == maMap.end()) ? 0 : &aIt->second;
 }
 
 const Relation* Relations::getRelationFromFirstType( const OUString& rType ) 
const
 {
-    for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+    for( ::std::map< OUString, Relation >::const_iterator aIt = maMap.begin(), 
aEnd = maMap.end(); aIt != aEnd; ++aIt )
         if( aIt->second.maType.equalsIgnoreAsciiCase( rType ) )
             return &aIt->second;
     return 0;
@@ -74,10 +75,10 @@ const Relation* Relations::getRelationFromFirstType( const 
OUString& rType ) con
 RelationsRef Relations::getRelationsFromTypeFromOfficeDoc( const OUString& 
rType ) const
 {
     RelationsRef xRelations( new Relations( maFragmentPath ) );
-    for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+    for( ::std::map< OUString, Relation >::const_iterator aIt = maMap.begin(), 
aEnd = maMap.end(); aIt != aEnd; ++aIt )
         if( aIt->second.maType.equalsIgnoreAsciiCase( 
createOfficeDocRelationTypeTransitional(rType) ) ||
                 aIt->second.maType.equalsIgnoreAsciiCase( 
createOfficeDocRelationTypeStrict(rType) ))
-            (*xRelations)[ aIt->first ] = aIt->second;
+            xRelations->maMap[ aIt->first ] = aIt->second;
     return xRelations;
 }
 
diff --git a/oox/source/core/relationshandler.cxx 
b/oox/source/core/relationshandler.cxx
index 20adc05..4802b8f 100644
--- a/oox/source/core/relationshandler.cxx
+++ b/oox/source/core/relationshandler.cxx
@@ -76,7 +76,7 @@ Reference< XFastContextHandler > 
RelationsFragment::createFastChildContext(
 
                 OSL_ENSURE( mxRelations->count( aRelation.maId ) == 0,
                     "RelationsFragment::createFastChildContext - relation 
identifier exists already" );
-                mxRelations->insert( Relations::value_type( aRelation.maId, 
aRelation ) );
+                mxRelations->insert( ::std::map< OUString, Relation 
>::value_type( aRelation.maId, aRelation ) );
             }
         }
         break;
diff --git a/sc/source/filter/oox/worksheetfragment.cxx 
b/sc/source/filter/oox/worksheetfragment.cxx
index f93d56ee..9f2ff39 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -194,7 +194,7 @@ WorksheetFragment::WorksheetFragment( const 
WorksheetHelper& rHelper, const OUSt
 {
     // import data tables related to this worksheet
     RelationsRef xTableRels = 
getRelations().getRelationsFromTypeFromOfficeDoc( "table" );
-    for( Relations::const_iterator aIt = xTableRels->begin(), aEnd = 
xTableRels->end(); aIt != aEnd; ++aIt )
+    for( ::std::map< OUString, Relation >::const_iterator aIt = 
xTableRels->begin(), aEnd = xTableRels->end(); aIt != aEnd; ++aIt )
         importOoxFragment( new TableFragment( *this, 
getFragmentPathFromRelation( aIt->second ) ) );
 
     // import comments related to this worksheet
@@ -472,12 +472,12 @@ void WorksheetFragment::initializeImport()
 
     // import query table fragments related to this worksheet
     RelationsRef xQueryRels = 
getRelations().getRelationsFromTypeFromOfficeDoc( "queryTable" );
-    for( Relations::const_iterator aIt = xQueryRels->begin(), aEnd = 
xQueryRels->end(); aIt != aEnd; ++aIt )
+    for( ::std::map< OUString, Relation >::const_iterator aIt = 
xQueryRels->begin(), aEnd = xQueryRels->end(); aIt != aEnd; ++aIt )
         importOoxFragment( new QueryTableFragment( *this, 
getFragmentPathFromRelation( aIt->second ) ) );
 
     // import pivot table fragments related to this worksheet
     RelationsRef xPivotRels = 
getRelations().getRelationsFromTypeFromOfficeDoc( "pivotTable" );
-    for( Relations::const_iterator aIt = xPivotRels->begin(), aEnd = 
xPivotRels->end(); aIt != aEnd; ++aIt )
+    for( ::std::map< OUString, Relation >::const_iterator aIt = 
xPivotRels->begin(), aEnd = xPivotRels->end(); aIt != aEnd; ++aIt )
         importOoxFragment( new PivotTableFragment( *this, 
getFragmentPathFromRelation( aIt->second ) ) );
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to