diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-03 09:57:24 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-08-07 17:39:57 +0200 |
commit | 1a6a05adf8b0f2620c0798e8c6811b08c80d0dea (patch) | |
tree | c53bb559010bf40bdb666814cfe9b49193e52eb9 /sc/source/filter/excel | |
parent | 679ab387954b2c8c00a8e9c9b6ad67a65fa432cd (diff) |
forcepoint#70 give all escher client data objects a common parent class
and make NotifyFreeObj a virtual method of SvxMSDffClientData, finding
the sc case where the client data was neither SvxMSDffImportData nor
ProcessData.
make the sc case a XclImpDrawObjClientData whose NotifyFreeObj is a noop
Change-Id: I07422e7a3415114674bb1e3c1ef120299adf2dc8
Reviewed-on: https://gerrit.libreoffice.org/58552
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sc/source/filter/excel')
-rw-r--r-- | sc/source/filter/excel/xiescher.cxx | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index b530e8705f7c..47a2a598104e 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -3497,7 +3497,7 @@ bool XclImpDffConverter::SupportsOleObjects() const // virtual functions ---------------------------------------------------------- void XclImpDffConverter::ProcessClientAnchor2( SvStream& rDffStrm, - DffRecordHeader& rHeader, void* /*pClientData*/, DffObjData& rObjData ) + DffRecordHeader& rHeader, SvxMSDffClientData& /*rClientData*/, DffObjData& rObjData ) { // find the OBJ record data related to the processed shape XclImpDffConvData& rConvData = GetConvData(); @@ -3520,8 +3520,19 @@ void XclImpDffConverter::ProcessClientAnchor2( SvStream& rDffStrm, } } +struct XclImpDrawObjClientData : public SvxMSDffClientData +{ + const XclImpDrawObjBase* m_pTopLevelObj; + + XclImpDrawObjClientData() + : m_pTopLevelObj(nullptr) + { + } + virtual void NotifyFreeObj(SdrObject*) override {} +}; + SdrObject* XclImpDffConverter::ProcessObj( SvStream& rDffStrm, DffObjData& rDffObjData, - void* pClientData, tools::Rectangle& /*rTextRect*/, SdrObject* pOldSdrObj ) + SvxMSDffClientData& rClientData, tools::Rectangle& /*rTextRect*/, SdrObject* pOldSdrObj ) { XclImpDffConvData& rConvData = GetConvData(); @@ -3542,10 +3553,10 @@ SdrObject* XclImpDffConverter::ProcessObj( SvStream& rDffStrm, DffObjData& rDffO /* Pass pointer to top-level object back to caller. If the processed object is embedded in a group, the pointer is already set to the top-level parent object. */ - XclImpDrawObjBase** ppTopLevelObj = static_cast< XclImpDrawObjBase** >( pClientData ); - bool bIsTopLevel = !ppTopLevelObj || !*ppTopLevelObj; - if( ppTopLevelObj && bIsTopLevel ) - *ppTopLevelObj = xDrawObj.get(); + XclImpDrawObjClientData& rDrawObjClientData = static_cast<XclImpDrawObjClientData&>(rClientData); + const bool bIsTopLevel = !rDrawObjClientData.m_pTopLevelObj; + if (bIsTopLevel ) + rDrawObjClientData.m_pTopLevelObj = xDrawObj.get(); // connectors don't have to be area objects if( dynamic_cast< SdrEdgeObj* >( xSdrObj.get() ) ) @@ -3787,16 +3798,16 @@ bool XclImpDffConverter::ProcessShContainer( SvStream& rDffStrm, const DffRecord { rShHeader.SeekToBegOfRecord( rDffStrm ); tools::Rectangle aDummy; - const XclImpDrawObjBase* pDrawObj = nullptr; + XclImpDrawObjClientData aDrawObjClientData; /* The call to ImportObj() creates and returns a new SdrObject for the processed shape. We take ownership of the returned object here. If the shape is a group object, all embedded objects are created recursively, and the returned group object contains them all. ImportObj() calls the virtual functions ProcessClientAnchor2() and ProcessObj() and writes - the pointer to the related draw object data (OBJ record) into pDrawObj. */ - SdrObjectPtr xSdrObj( ImportObj( rDffStrm, &pDrawObj, aDummy, aDummy, /*nCalledByGroup*/0, /*pShapeId*/nullptr ) ); - if( pDrawObj && xSdrObj ) - InsertSdrObject( GetConvData().mrSdrPage, *pDrawObj, xSdrObj.release() ); + the pointer to the related draw object data (OBJ record) into aDrawObjClientData. */ + SdrObjectPtr xSdrObj( ImportObj( rDffStrm, aDrawObjClientData, aDummy, aDummy, /*nCalledByGroup*/0, /*pShapeId*/nullptr ) ); + if (aDrawObjClientData.m_pTopLevelObj && xSdrObj ) + InsertSdrObject( GetConvData().mrSdrPage, *aDrawObjClientData.m_pTopLevelObj, xSdrObj.release() ); return rShHeader.SeekToEndOfRecord( rDffStrm ); } |