summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/oox/core/relations.hxx18
-rw-r--r--oox/source/core/relations.cxx15
-rw-r--r--oox/source/core/relationshandler.cxx2
-rw-r--r--sc/source/filter/oox/worksheetfragment.cxx6
4 files changed, 29 insertions, 12 deletions
diff --git a/include/oox/core/relations.hxx b/include/oox/core/relations.hxx
index 38a99c81f9e3..e33cb9378e44 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 4122678e5e01..5c75b3394cfe 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 20adc05cfb64..4802b8f83e05 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 f93d56ee629b..9f2ff39c9920 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 ) ) );
}