summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@novell.com>2010-11-05 18:44:20 +0200
committerTor Lillqvist <tml@hemulen.(none)>2010-11-13 12:24:12 +0200
commit4673af783ad547490c280865eaa9079407870977 (patch)
treea5d844548535ac0d5c867f89ade468556f98f622
parentd93aa2c22b94204a9254fb6dae1f431e53cb1128 (diff)
Apply oox-drawingml-fix-shapes-map-crash.diff
-rw-r--r--oox/inc/oox/export/shapes.hxx32
-rw-r--r--oox/source/export/shapes.cxx16
2 files changed, 29 insertions, 19 deletions
diff --git a/oox/inc/oox/export/shapes.hxx b/oox/inc/oox/export/shapes.hxx
index 6d12eb5b2..dfa5f590d 100644
--- a/oox/inc/oox/export/shapes.hxx
+++ b/oox/inc/oox/export/shapes.hxx
@@ -50,16 +50,7 @@ namespace oox { namespace drawingml {
class OOX_DLLPUBLIC ShapeExport : public DrawingML {
-protected:
- sal_Int32 mnShapeIdMax, mnPictureIdMax;
-
private:
- sal_Int32 mnXmlNamespace;
- Fraction maFraction;
- MapMode maMapModeSrc, maMapModeDest;
-
- ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const;
-
struct ShapeCheck
{
bool operator()( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s1, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s2 ) const
@@ -75,11 +66,25 @@ private:
size_t operator()( const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > ) const;
};
+public:
typedef std::hash_map< const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>, sal_Int32, ShapeHash, ShapeCheck> ShapeHashMap;
- static ShapeHashMap saShapeMap;
+
+protected:
+ sal_Int32 mnShapeIdMax, mnPictureIdMax;
+
+private:
+ sal_Int32 mnXmlNamespace;
+ Fraction maFraction;
+ MapMode maMapModeSrc, maMapModeDest;
+
+ ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const;
+
+ ShapeHashMap maShapeMap;
+ ShapeHashMap* mpShapeMap;
public:
- ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
+
+ ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ShapeHashMap* pShapeMap = NULL, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
virtual ~ShapeExport() {}
sal_Int32 GetXmlNamespace() const;
@@ -158,8 +163,9 @@ public:
WriteUnknownShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
- static sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ::oox::core::XmlFilterBase* pFB );
- static sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
+ sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ::oox::core::XmlFilterBase* pFB );
+ sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
+ static sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ShapeHashMap* pShapeMap );
};
}}
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 5296d15a5..c86297e8b 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -365,7 +365,7 @@ namespace oox { namespace drawingml {
if ( GETA(propName) ) \
mAny >>= variable;
-ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, XmlFilterBase* pFB, DocumentType eDocumentType )
+ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, ShapeHashMap* pShapeMap, XmlFilterBase* pFB, DocumentType eDocumentType )
: DrawingML( pFS, pFB, eDocumentType )
, mnShapeIdMax( 1 )
, mnPictureIdMax( 1 )
@@ -373,6 +373,7 @@ ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, XmlFilterBas
, maFraction( 1, 576 )
, maMapModeSrc( MAP_100TH_MM )
, maMapModeDest( MAP_INCH, Point(), maFraction, maFraction )
+ , mpShapeMap( pShapeMap ? pShapeMap : &maShapeMap )
{
}
@@ -980,26 +981,29 @@ sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape, XmlFilt
sal_Int32 nID = pFB->GetUniqueId();
- saShapeMap[ rXShape ] = nID;
+ (*mpShapeMap)[ rXShape ] = nID;
return nID;
}
sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape )
{
+ return GetShapeID( rXShape, mpShapeMap );
+}
+
+sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape, ShapeHashMap* pShapeMap )
+{
if( !rXShape.is() )
return -1;
- ShapeHashMap::const_iterator aIter = saShapeMap.find( rXShape );
+ ShapeHashMap::const_iterator aIter = pShapeMap->find( rXShape );
- if( aIter == saShapeMap.end() )
+ if( aIter == pShapeMap->end() )
return -1;
return aIter->second;
}
-ShapeExport::ShapeHashMap ShapeExport::saShapeMap;
-
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */