From c051ddbb5cd0a71061e1f12abfa9935713f98ea4 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 1 Nov 2010 16:18:51 +0200 Subject: [PATCH] From hg changeset c94984deded153e8720faf14d1fc5c3a5b866381 in ooxml11 ooxml11: intermediate commit, builds --- oox/inc/oox/export/drawingml.hxx | 7 +++---- oox/inc/oox/export/shapes.hxx | 10 +++++++--- oox/source/export/shapes.cxx | 20 ++++++++++++++------ 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx index 3fdf70fb9592..92603afc633e 100644 --- a/oox/inc/oox/export/drawingml.hxx +++ b/oox/inc/oox/export/drawingml.hxx @@ -45,9 +45,6 @@ public: enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX }; private: - ::sax_fastparser::FSHelperPtr mpFS; - ::oox::core::XmlFilterBase* mpFB; - static int mnImageCounter; /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC). @@ -55,6 +52,8 @@ private: protected: ::com::sun::star::uno::Any mAny; + ::sax_fastparser::FSHelperPtr mpFS; + ::oox::core::XmlFilterBase* mpFB; bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String aName ); bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, @@ -65,7 +64,7 @@ protected: rtl::OUString WriteImage( const rtl::OUString& rURL ); public: - DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : mpFS( pFS ), mpFB( pFB ), meDocumentType( eDocumentType ) {} + DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : meDocumentType( eDocumentType ), mpFS( pFS ), mpFB( pFB ) {} void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; } ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; } ::oox::core::XmlFilterBase* GetFB() { return mpFB; } diff --git a/oox/inc/oox/export/shapes.hxx b/oox/inc/oox/export/shapes.hxx index f2ea765383e0..a3dd71b9ca84 100644 --- a/oox/inc/oox/export/shapes.hxx +++ b/oox/inc/oox/export/shapes.hxx @@ -49,9 +49,12 @@ namespace drawing { namespace oox { namespace drawingml { class OOX_DLLPUBLIC ShapeExport : public DrawingML { + +protected: + sal_Int32 mnShapeIdMax, mnPictureIdMax; + private: sal_Int32 mnXmlNamespace; - sal_Int32 mnShapeIdMax, mnPictureIdMax; Fraction maFraction; MapMode maMapModeSrc, maMapModeDest; @@ -73,7 +76,7 @@ private: }; typedef std::hash_map< const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>, sal_Int32, ShapeHash, ShapeCheck> ShapeHashMap; - ShapeHashMap maShapeMap; + static ShapeHashMap saShapeMap; public: ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ); @@ -155,7 +158,8 @@ 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 ); - sal_Int32 GetShapeID( 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 ); }; }} diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 626f8b7363c5..4a466c3b8420 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -93,6 +93,7 @@ using ::com::sun::star::text::XText; using ::com::sun::star::text::XTextContent; using ::com::sun::star::text::XTextField; using ::com::sun::star::text::XTextRange; +using ::oox::core::XmlFilterBase; using ::com::sun::star::chart2::XChartDocument; using ::com::sun::star::frame::XModel; using ::oox::core::XmlFilterBase; @@ -364,11 +365,11 @@ namespace oox { namespace drawingml { if ( GETA(propName) ) \ mAny >>= variable; -ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType ) +ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, XmlFilterBase* pFB, DocumentType eDocumentType ) : DrawingML( pFS, pFB, eDocumentType ) - , mnXmlNamespace( nXmlNamespace ) , mnShapeIdMax( 1 ) , mnPictureIdMax( 1 ) + , mnXmlNamespace( nXmlNamespace ) , maFraction( 1, 576 ) , maMapModeSrc( MAP_100TH_MM ) , maMapModeDest( MAP_INCH, Point(), maFraction, maFraction ) @@ -969,23 +970,30 @@ size_t ShapeExport::ShapeHash::operator()( const ::com::sun::star::uno::Referenc sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape ) { - sal_Int32 nID = GetFB()->GetUniqueId(); + return GetNewShapeID( rXShape, GetFB() ); +} - maShapeMap[ rXShape ] = nID; +sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape, XmlFilterBase* pFB ) +{ + sal_Int32 nID = pFB->GetUniqueId(); + + saShapeMap[ rXShape ] = nID; return nID; } sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape ) { - ShapeHashMap::const_iterator aIter = maShapeMap.find( rXShape ); + ShapeHashMap::const_iterator aIter = saShapeMap.find( rXShape ); - if( aIter == maShapeMap.end() ) + if( aIter == saShapeMap.end() ) return -1; return aIter->second; } +ShapeExport::ShapeHashMap ShapeExport::saShapeMap; + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */