Kaydet (Commit) d0712d61 authored tarafından Katarina Machalkova's avatar Katarina Machalkova

Merged oox-drawingml-fix-shapes-map-crash.diff from ooo-build

üst 3378115e
......@@ -49,16 +49,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
......@@ -74,11 +65,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;
......@@ -157,8 +162,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 );
};
}}
......
......@@ -359,7 +359,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 )
......@@ -367,6 +367,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 )
{
}
......@@ -987,26 +988,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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment