diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-03 09:57:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-08-03 15:04:53 +0200 |
commit | a61b4c214b8acfcdddd2f5203184468e329bdb92 (patch) | |
tree | 6fec90f7a394852d719dbc8ac1bf22728e6af129 | |
parent | ea59fc4831b9d2430de51faa8c3e0a24e6d90cd1 (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/58551
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 66 | ||||
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 27 | ||||
-rw-r--r-- | include/filter/msfilter/msdffimp.hxx | 32 | ||||
-rw-r--r-- | include/filter/msfilter/svdfppt.hxx | 14 | ||||
-rw-r--r-- | sc/source/filter/excel/xiescher.cxx | 33 | ||||
-rw-r--r-- | sc/source/filter/inc/xiescher.hxx | 4 | ||||
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 16 | ||||
-rw-r--r-- | sd/source/filter/ppt/pptin.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8graf2.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 2 |
11 files changed, 115 insertions, 87 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index fc59e6356a09..c232ee0649c1 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -243,9 +243,9 @@ void DffPropertyReader::SetDefaultPropSet( SvStream& rStCtrl, sal_uInt32 nOffsDg } #ifdef DBG_CUSTOMSHAPE -void DffPropertyReader::ReadPropSet( SvStream& rIn, void* pClientData, sal_uInt32 nShapeId ) const +void DffPropertyReader::ReadPropSet( SvStream& rIn, SvxMSDffClientData* pClientData, sal_uInt32 nShapeId ) const #else -void DffPropertyReader::ReadPropSet( SvStream& rIn, void* pClientData ) const +void DffPropertyReader::ReadPropSet( SvStream& rIn, SvxMSDffClientData* pClientData ) const #endif { sal_uLong nFilePos = rIn.Tell(); @@ -3183,7 +3183,7 @@ void SvxMSDffManager::SetModel(SdrModel* pModel, long nApplicationScale) } } -bool SvxMSDffManager::SeekToShape( SvStream& rSt, void* /* pClientData */, sal_uInt32 nId ) const +bool SvxMSDffManager::SeekToShape( SvStream& rSt, SvxMSDffClientData* /* pClientData */, sal_uInt32 nId ) const { bool bRet = false; if ( !maFidcls.empty() ) @@ -4022,7 +4022,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons } // PptSlidePersistEntry& rPersistEntry, SdPage* pPage -SdrObject* SvxMSDffManager::ImportObj( SvStream& rSt, void* pClientData, +SdrObject* SvxMSDffManager::ImportObj( SvStream& rSt, SvxMSDffClientData& rClientData, tools::Rectangle& rClientRect, const tools::Rectangle& rGlobalChildRect, int nCalledByGroup, sal_Int32* pShapeId ) { SdrObject* pRet = nullptr; @@ -4030,17 +4030,17 @@ SdrObject* SvxMSDffManager::ImportObj( SvStream& rSt, void* pClientData, bool bOk = ReadDffRecordHeader(rSt, aObjHd); if (bOk && aObjHd.nRecType == DFF_msofbtSpgrContainer) { - pRet = ImportGroup( aObjHd, rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup, pShapeId ); + pRet = ImportGroup( aObjHd, rSt, rClientData, rClientRect, rGlobalChildRect, nCalledByGroup, pShapeId ); } else if (bOk && aObjHd.nRecType == DFF_msofbtSpContainer) { - pRet = ImportShape( aObjHd, rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup, pShapeId ); + pRet = ImportShape( aObjHd, rSt, rClientData, rClientRect, rGlobalChildRect, nCalledByGroup, pShapeId ); } aObjHd.SeekToBegOfRecord( rSt ); // restore FilePos return pRet; } -SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& rSt, void* pClientData, +SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& rSt, SvxMSDffClientData& rClientData, tools::Rectangle& rClientRect, const tools::Rectangle& rGlobalChildRect, int nCalledByGroup, sal_Int32* pShapeId ) { @@ -4059,7 +4059,7 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r mnFix16Angle = 0; if (!aRecHd.SeekToBegOfRecord(rSt)) return pRet; - pRet = ImportObj( rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup + 1, pShapeId ); + pRet = ImportObj( rSt, rClientData, rClientRect, rGlobalChildRect, nCalledByGroup + 1, pShapeId ); if ( pRet ) { sal_Int32 nGroupRotateAngle = 0; @@ -4104,7 +4104,7 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r if (!aRecHd2.SeekToBegOfRecord(rSt)) return pRet; sal_Int32 nShapeId; - SdrObject* pTmp = ImportGroup( aRecHd2, rSt, pClientData, aGroupClientAnchor, aGroupChildAnchor, nCalledByGroup + 1, &nShapeId ); + SdrObject* pTmp = ImportGroup( aRecHd2, rSt, rClientData, aGroupClientAnchor, aGroupChildAnchor, nCalledByGroup + 1, &nShapeId ); if (pTmp) { SdrObjGroup* pGroup = dynamic_cast<SdrObjGroup*>(pRet); @@ -4115,7 +4115,7 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r insertShapeId(nShapeId, pTmp); } else - FreeObj(pClientData, pTmp); + FreeObj(rClientData, pTmp); } } else if ( aRecHd2.nRecType == DFF_msofbtSpContainer ) @@ -4123,7 +4123,7 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r if (!aRecHd2.SeekToBegOfRecord(rSt)) return pRet; sal_Int32 nShapeId; - SdrObject* pTmp = ImportShape( aRecHd2, rSt, pClientData, aClientRect, aGlobalChildRect, nCalledByGroup + 1, &nShapeId ); + SdrObject* pTmp = ImportShape( aRecHd2, rSt, rClientData, aClientRect, aGlobalChildRect, nCalledByGroup + 1, &nShapeId ); if (pTmp) { SdrObjGroup* pGroup = dynamic_cast<SdrObjGroup*>(pRet); @@ -4134,7 +4134,7 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r insertShapeId(nShapeId, pTmp); } else - FreeObj(pClientData, pTmp); + FreeObj(rClientData, pTmp); } } if (!aRecHd2.SeekToEndOfRecord(rSt)) @@ -4169,7 +4169,7 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r return pRet; } -SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& rSt, void* pClientData, +SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& rSt, SvxMSDffClientData& rClientData, tools::Rectangle& rClientRect, const tools::Rectangle& rGlobalChildRect, int nCalledByGroup, sal_Int32* pShapeId ) { @@ -4232,9 +4232,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r if (!maShapeRecords.Current()->SeekToBegOfRecord(rSt)) return pRet; #ifdef DBG_AUTOSHAPE - ReadPropSet( rSt, pClientData, (sal_uInt32)aObjData.eShapeType ); + ReadPropSet( rSt, &rClientData, (sal_uInt32)aObjData.eShapeType ); #else - ReadPropSet( rSt, pClientData ); + ReadPropSet( rSt, &rClientData ); #endif } else @@ -4277,7 +4277,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r aObjData.bClientAnchor = maShapeRecords.SeekToContent( rSt, DFF_msofbtClientAnchor, SEEK_FROM_CURRENT_AND_RESTART ); if ( aObjData.bClientAnchor ) - ProcessClientAnchor2( rSt, *maShapeRecords.Current(), pClientData, aObjData ); + ProcessClientAnchor2( rSt, *maShapeRecords.Current(), rClientData, aObjData ); if ( aObjData.bChildAnchor ) aObjData.aBoundRect = aObjData.aChildAnchor; @@ -4857,7 +4857,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r } pRet = - ProcessObj( rSt, aObjData, pClientData, aTextRect, pRet); + ProcessObj( rSt, aObjData, rClientData, aTextRect, pRet); if ( pRet ) { @@ -5046,40 +5046,44 @@ void SvxMSDffImportData::insert(SvxMSDffImportRec* pImpRec) m_Records.insert(std::unique_ptr<SvxMSDffImportRec>(pImpRec)); } -void SvxMSDffManager::NotifyFreeObj(void* pData, SdrObject* pObj) +void SvxMSDffImportData::NotifyFreeObj(SdrObject* pObj) +{ + if (SvxMSDffImportRec* pRecord = find(pObj)) + { + unmap(pObj); + pRecord->pObj = nullptr; + } +} + +void SvxMSDffManager::NotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj) { if (SdrObjGroup* pGroup = dynamic_cast<SdrObjGroup*>(pObj)) { SdrObjList* pSubList = pGroup->GetSubList(); size_t nObjCount = pSubList->GetObjCount(); for (size_t i = 0; i < nObjCount; ++i) - NotifyFreeObj(pData, pSubList->GetObj(i)); + NotifyFreeObj(rData, pSubList->GetObj(i)); } - SvxMSDffImportData& rImportData = *static_cast<SvxMSDffImportData*>(pData); - if (SvxMSDffImportRec* pRecord = rImportData.find(pObj)) - { - rImportData.unmap(pObj); - pRecord->pObj = nullptr; - } + rData.NotifyFreeObj(pObj); } -void SvxMSDffManager::FreeObj(void* pData, SdrObject* pObj) +void SvxMSDffManager::FreeObj(SvxMSDffClientData& rData, SdrObject* pObj) { - NotifyFreeObj(pData, pObj); + NotifyFreeObj(rData, pObj); SdrObject::Free(pObj); } SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, DffObjData& rObjData, - void* pData, + SvxMSDffClientData& rData, tools::Rectangle& rTextRect, SdrObject* pObj ) { if( !rTextRect.IsEmpty() ) { - SvxMSDffImportData& rImportData = *static_cast<SvxMSDffImportData*>(pData); + SvxMSDffImportData& rImportData = static_cast<SvxMSDffImportData&>(rData); SvxMSDffImportRec* pImpRec = new SvxMSDffImportRec; bool bDeleteImpRec = true; SvxMSDffImportRec* pTextImpRec = pImpRec; @@ -6317,7 +6321,7 @@ bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape, if (!bSeeked || rStCtrl.GetError()) rStCtrl.ResetError(); else - rpShape = ImportObj( rStCtrl, &rData, rData.aParentRect, rData.aParentRect, /*nCalledByGroup*/0, /*pShapeId*/nullptr ); + rpShape = ImportObj( rStCtrl, rData, rData.aParentRect, rData.aParentRect, /*nCalledByGroup*/0, /*pShapeId*/nullptr ); // restore old FilePos of the stream(s) rStCtrl.Seek( nOldPosCtrl ); @@ -6630,7 +6634,7 @@ void SvxMSDffManager::ProcessClientData(SvStream& rStData, sal_uInt32 nDatLen, } -void SvxMSDffManager::ProcessClientAnchor2( SvStream& /* rSt */, DffRecordHeader& /* rHd */ , void* /* pData */, DffObjData& /* rObj */ ) +void SvxMSDffManager::ProcessClientAnchor2( SvStream& /* rSt */, DffRecordHeader& /* rHd */ , SvxMSDffClientData& /* rData */, DffObjData& /* rObj */ ) { // will be overridden by SJ in Draw } diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 9d8902ccc3d4..8f209d73ea99 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -558,7 +558,7 @@ bool SdrEscherImport::GetColorFromPalette(sal_uInt16 /*nNum*/, Color& /*rColor*/ return false; } -bool SdrEscherImport::SeekToShape( SvStream& /*rSt*/, void* /*pClientData*/, sal_uInt32 /*nId*/) const +bool SdrEscherImport::SeekToShape( SvStream& /*rSt*/, SvxMSDffClientData* /*pClientData*/, sal_uInt32 /*nId*/) const { return false; } @@ -576,7 +576,7 @@ SdrObject* SdrEscherImport::ReadObjText( PPTTextObj* /*pTextObj*/, SdrObject* pO return pObj; } -void SdrEscherImport::ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, void* /*pData*/, DffObjData& rObj ) +void SdrEscherImport::ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, SvxMSDffClientData& /*rData*/, DffObjData& rObj ) { sal_Int32 l, t, r, b; if ( rHd.nRecLen == 16 ) @@ -711,10 +711,8 @@ sal_uLong DffPropSet::SanitizeEndPos(SvStream &rIn, sal_uLong nEndRecPos) return nEndRecPos; } -void SdrEscherImport::NotifyFreeObj(void* pData, SdrObject* pObj) +void ProcessData::NotifyFreeObj(SdrObject* pObj) { - ProcessData& rData = *static_cast<ProcessData*>(pData); - PptSlidePersistEntry& rPersistEntry = rData.rPersistEntry; if (rPersistEntry.xSolverContainer) { for (auto & pPtr : rPersistEntry.xSolverContainer->aCList) @@ -729,13 +727,18 @@ void SdrEscherImport::NotifyFreeObj(void* pData, SdrObject* pObj) } } +void SdrEscherImport::NotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj) +{ + rData.NotifyFreeObj(pObj); +} + /* ProcessObject is called from ImplSdPPTImport::ProcessObj to handle all application specific things, such as the import of text, animation effects, header footer and placeholder. The parameter pOriginalObj is the object as it was imported by our general escher import, it must either be deleted or it can be returned to be inserted into the sdr page. */ -SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, void* pData, tools::Rectangle& rTextRect, SdrObject* pOriginalObj ) +SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, SvxMSDffClientData& rClientData, tools::Rectangle& rTextRect, SdrObject* pOriginalObj ) { if ( dynamic_cast<const SdrObjCustomShape* >(pOriginalObj) != nullptr ) pOriginalObj->SetMergedItem( SdrTextFixedCellHeightItem( true ) ); @@ -743,7 +746,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi // we are initializing our return value with the object that was imported by our escher import SdrObject* pRet = pOriginalObj; - ProcessData& rData = *static_cast<ProcessData*>(pData); + ProcessData& rData = static_cast<ProcessData&>(rClientData); PptSlidePersistEntry& rPersistEntry = rData.rPersistEntry; if ( ! (rObjData.nSpFlags & ShapeFlag::Group) ) // sj: #114758# ... @@ -1218,7 +1221,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi { maShapeRecords.Current()->SeekToBegOfRecord( rSt ); DffPropertyReader aSecPropSet( *this ); - aSecPropSet.ReadPropSet( rSt, pData ); + aSecPropSet.ReadPropSet( rSt, &rClientData ); sal_Int32 nTableProperties = aSecPropSet.GetPropertyValue( DFF_Prop_tableProperties, 0 ); if ( nTableProperties & 3 ) { @@ -2595,7 +2598,7 @@ bool SdrPowerPointImport::GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) return true; } -bool SdrPowerPointImport::SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const +bool SdrPowerPointImport::SeekToShape( SvStream& rSt, SvxMSDffClientData* pClientData, sal_uInt32 nId ) const { bool bRet = SvxMSDffManager::SeekToShape( rSt, pClientData, nId ); if (!bRet && pClientData) @@ -2832,7 +2835,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* // do not follow master colorscheme? sal_uInt32 nPos = rStCtrl.Tell(); rStCtrl.Seek( pE->nBackgroundOffset ); - rSlidePersist.pBObj = ImportObj( rStCtrl, static_cast<void*>(&aProcessData), aPageSize, aPageSize, /*nCalledByGroup*/0, /*pShapeId*/nullptr ); + rSlidePersist.pBObj = ImportObj( rStCtrl, aProcessData, aPageSize, aPageSize, /*nCalledByGroup*/0, /*pShapeId*/nullptr ); rStCtrl.Seek( nPos ); } } @@ -2848,7 +2851,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* if ( ShapeFlag(nSpFlags) & ShapeFlag::Background ) { aEscherObjListHd.SeekToBegOfRecord( rStCtrl ); - rSlidePersist.pBObj = ImportObj( rStCtrl, static_cast<void*>(&aProcessData), aPageSize, aPageSize, /*nCalledByGroup*/0, /*pShapeId*/nullptr ); + rSlidePersist.pBObj = ImportObj( rStCtrl, aProcessData, aPageSize, aPageSize, /*nCalledByGroup*/0, /*pShapeId*/nullptr ); } } } @@ -2889,7 +2892,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* aShapeHd.SeekToBegOfRecord( rStCtrl ); sal_Int32 nShapeId; aProcessData.pTableRowProperties.reset(); - SdrObject* pObj = ImportObj( rStCtrl, static_cast<void*>(&aProcessData), aEmpty, aEmpty, 0, &nShapeId ); + SdrObject* pObj = ImportObj( rStCtrl, aProcessData, aEmpty, aEmpty, 0, &nShapeId ); if ( pObj ) { if ( aProcessData.pTableRowProperties ) diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx index 79ff6759a168..4eadb1c779b0 100644 --- a/include/filter/msfilter/msdffimp.hxx +++ b/include/filter/msfilter/msdffimp.hxx @@ -73,6 +73,13 @@ namespace com { namespace sun { namespace star { namespace embed { class XStorage; } } } } +class MSFILTER_DLLPUBLIC SvxMSDffClientData +{ +public: + virtual void NotifyFreeObj(SdrObject* pObj) = 0; + virtual ~SvxMSDffClientData() {} +}; + class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet { const SvxMSDffManager& rManager; @@ -99,9 +106,9 @@ public: static sal_Int32 Fix16ToAngle( sal_Int32 nAngle ); #ifdef DBG_CUSTOMSHAPE - void ReadPropSet( SvStream& rIn, void* pClientData, sal_uInt32 nShapeType = 0 ) const; + void ReadPropSet( SvStream& rIn, SvxMSDffClientData* pClientData, sal_uInt32 nShapeType = 0 ) const; #else - void ReadPropSet( SvStream& rIn, void* pClientData ) const; + void ReadPropSet( SvStream& rIn, SvxMSDffClientData* pClientData ) const; #endif void SetDefaultPropSet( SvStream& rIn, sal_uInt32 nOffDgg ) const; @@ -265,7 +272,7 @@ private: /** block of parameters for import/export for a single call of ImportObjAtCurrentStreamPos() */ -class MSFILTER_DLLPUBLIC SvxMSDffImportData +class MSFILTER_DLLPUBLIC SvxMSDffImportData : public SvxMSDffClientData { private: /** list of all SvxMSDffImportRec instances of/for a group */ @@ -280,7 +287,7 @@ public: explicit SvxMSDffImportData(const tools::Rectangle& rParentRect); SvxMSDffImportData& operator=( SvxMSDffImportData const & ) = delete; // MSVC2015 workaround SvxMSDffImportData( SvxMSDffImportData const & ) = delete; // MSVC2015 workaround - ~SvxMSDffImportData(); + virtual ~SvxMSDffImportData() override; bool empty() const { return m_Records.empty(); } void insert(SvxMSDffImportRec* pImpRec); void unmap(const SdrObject* pObj) { m_ObjToRecMap.erase(pObj); } @@ -289,6 +296,7 @@ public: SvxMSDffImportRec* find(const SdrObject* pObj); MSDffImportRecords::const_iterator begin() const { return m_Records.begin(); } MSDffImportRecords::const_iterator end() const { return m_Records.end(); } + virtual void NotifyFreeObj(SdrObject* pObj) override; }; struct DffObjData @@ -499,18 +507,18 @@ protected: sal_uInt32& rBuffLen ); virtual void ProcessClientAnchor2( SvStream& rStData, DffRecordHeader& rHd, - void* pData, DffObjData& ); + SvxMSDffClientData& rData, DffObjData& ); static void ProcessClientData( SvStream& rStData, sal_uInt32 nDatLen, std::unique_ptr<char[]>& rpBuff, sal_uInt32& rBuffLen ); virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, - void* pData, + SvxMSDffClientData& rClientData, tools::Rectangle& rTextRect, SdrObject* pObj); - virtual void NotifyFreeObj(void* pData, SdrObject* pObj); - void FreeObj(void* pData, SdrObject* pObj); + virtual void NotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj); + void FreeObj(SvxMSDffClientData& rData, SdrObject* pObj); /** Object finalization, used by the Excel filter to correctly @@ -552,7 +560,7 @@ public: Color MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nContextProperty = DFF_Prop_lineColor ) const; virtual bool SeekToShape( SvStream& rSt, - void* pClientData, + SvxMSDffClientData* pClientData, sal_uInt32 nId ) const; static bool SeekToRec( SvStream& rSt, sal_uInt16 nRecId, @@ -661,21 +669,21 @@ public: bool GetShape(sal_uLong nId, SdrObject*& rpData, SvxMSDffImportData& rData); SdrObject* ImportObj( SvStream& rSt, - void* pData, + SvxMSDffClientData& rData, tools::Rectangle& rClientRect, const tools::Rectangle& rGlobalChildRect, int nCalledByGroup, sal_Int32* pShapeId); SdrObject* ImportGroup( const DffRecordHeader& rHd, SvStream& rSt, - void* pData, + SvxMSDffClientData& rData, tools::Rectangle& rClientRect, const tools::Rectangle& rGlobalChildRect, int nCalledByGroup, sal_Int32* pShapeId ); SdrObject* ImportShape( const DffRecordHeader& rHd, SvStream& rSt, - void* pData, + SvxMSDffClientData& rData, tools::Rectangle& rClientRect, const tools::Rectangle& rGlobalChildRect, int nCalledByGroup, diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index 5600200334d9..dd220f9bcc3e 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -479,13 +479,13 @@ public: SdrEscherImport( PowerPointImportParam&, const OUString& rBaseURL ); virtual ~SdrEscherImport() override; virtual bool GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) const override; - virtual bool SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const override; + virtual bool SeekToShape( SvStream& rSt, SvxMSDffClientData* pClientData, sal_uInt32 nId ) const override; PptFontEntityAtom* GetFontEnityAtom( sal_uInt32 nNum ) const; void RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraph ); virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPageCapsule pPage ) const; - virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, tools::Rectangle& rTextRect, SdrObject* pObj ) override; - virtual void NotifyFreeObj(void* pData, SdrObject* pObj) override; - virtual void ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, void* pData, DffObjData& rObj ) override; + virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, SvxMSDffClientData& rClientData, tools::Rectangle& rTextRect, SdrObject* pObj ) override; + virtual void NotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj) override; + virtual void ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, SvxMSDffClientData& rData, DffObjData& rObj ) override; void ImportHeaderFooterContainer( DffRecordHeader const & rHeader, HeaderFooterEntry& rEntry ); }; @@ -531,7 +531,7 @@ struct MSFILTER_DLLPUBLIC HeaderFooterEntry explicit HeaderFooterEntry( const PptSlidePersistEntry* pMaster = nullptr ); }; -struct ProcessData +struct MSFILTER_DLLPUBLIC ProcessData : public SvxMSDffClientData { PptSlidePersistEntry& rPersistEntry; SdPageCapsule pPage; @@ -541,6 +541,8 @@ struct ProcessData ProcessData( PptSlidePersistEntry& rP, SdPageCapsule pP ) : rPersistEntry ( rP ), pPage ( pP ) {}; + + virtual void NotifyFreeObj(SdrObject* pObj) override; }; @@ -638,7 +640,7 @@ public: void ImportPage( SdrPage* pPage, const PptSlidePersistEntry* pMasterPersist ); virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const override; - virtual bool SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const override; + virtual bool SeekToShape( SvStream& rSt, SvxMSDffClientData* pClientData, sal_uInt32 nId ) const override; virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const override; SdrObject* CreateTable( SdrObject* pGroupObject, diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 911f4197b780..6a914786565e 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -3496,7 +3496,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(); @@ -3519,8 +3519,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(); @@ -3541,10 +3552,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() ) ) @@ -3786,16 +3797,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 ); } diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx index 626d94c15bdd..015b7c745242 100644 --- a/sc/source/filter/inc/xiescher.hxx +++ b/sc/source/filter/inc/xiescher.hxx @@ -954,13 +954,13 @@ private: virtual void ProcessClientAnchor2( SvStream& rDffStrm, DffRecordHeader& rHeader, - void* pClientData, + SvxMSDffClientData& rClientData, DffObjData& rObjData ) override; /** Processes an DFF object, reads properties from DFF stream. */ virtual SdrObject* ProcessObj( SvStream& rDffStrm, DffObjData& rDffObjData, - void* pClientData, + SvxMSDffClientData& rClientData, tools::Rectangle& rTextRect, SdrObject* pOldSdrObj ) override; diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 17de2095157f..9ffb861d59f7 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -809,7 +809,7 @@ bool ImplSdPPTImport::Import() ::tools::Rectangle aEmpty; if (!aHd2.SeekToBegOfRecord(rStCtrl)) break; - SdrObject* pImpObj = ImportObj( rStCtrl, static_cast<void*>(&aProcessData), aEmpty, aEmpty, /*nCalledByGroup*/0, /*pShapeId*/ nullptr ); + SdrObject* pImpObj = ImportObj( rStCtrl, aProcessData, aEmpty, aEmpty, /*nCalledByGroup*/0, /*pShapeId*/ nullptr ); if ( pImpObj ) { pImpObj->SetLayer( mnBackgroundObjectsLayerID ); @@ -1441,7 +1441,7 @@ void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage* pPage, const PptSlide bVisible = false; rStCtrl.Seek( nPosition ); ProcessData aProcessData( rSlidePersist, SdPageCapsule(pPage) ); - SdrObject* pObj = ImportObj( rStCtrl, static_cast<void*>(&aProcessData), aEmpty, aEmpty, /*nCalledByGroup*/0, /*pShapeId*/nullptr ); + SdrObject* pObj = ImportObj( rStCtrl, aProcessData, aEmpty, aEmpty, /*nCalledByGroup*/0, /*pShapeId*/nullptr ); if ( pObj ) pPage->NbcInsertObject( pObj, 0 ); } @@ -2579,9 +2579,9 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj return pRet; } -SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, void* pData, ::tools::Rectangle& rTextRect, SdrObject* pRet ) +SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, SvxMSDffClientData& rData, ::tools::Rectangle& rTextRect, SdrObject* pRet ) { - SdrObject* pObj = SdrPowerPointImport::ProcessObj( rSt, rObjData, pData, rTextRect, pRet ); + SdrObject* pObj = SdrPowerPointImport::ProcessObj( rSt, rObjData, rData, rTextRect, pRet ); // read animation effect of object if ( pObj ) @@ -2589,9 +2589,9 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi // further setup placeholder objects if (dynamic_cast<const SdrPageObj*>(pObj)) { - const ProcessData* pProcessData=static_cast<const ProcessData*>(pData); - if( pProcessData->pPage.page ) - static_cast<SdPage *>(pProcessData->pPage.page)->InsertPresObj( + const ProcessData& rProcessData=static_cast<const ProcessData&>(rData); + if(rProcessData.pPage.page) + static_cast<SdPage *>(rProcessData.pPage.page)->InsertPresObj( pObj, PRESOBJ_PAGE ); } @@ -2726,7 +2726,7 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi if ( bInhabitanceChecked || bAnimationInfoFound ) break; bInhabitanceChecked = true; - if ( ! ( IsProperty( DFF_Prop_hspMaster ) && SeekToShape( rSt, pData, GetPropertyValue( DFF_Prop_hspMaster, 0 ) ) ) ) + if ( ! ( IsProperty( DFF_Prop_hspMaster ) && SeekToShape( rSt, &rData, GetPropertyValue( DFF_Prop_hspMaster, 0 ) ) ) ) break; ReadDffRecordHeader( rSt, aMasterShapeHd ); if ( !SeekToRec( rSt, DFF_msofbtClientData, aMasterShapeHd.GetRecEndFilePos(), &aMasterShapeHd ) ) diff --git a/sd/source/filter/ppt/pptin.hxx b/sd/source/filter/ppt/pptin.hxx index b620836b8791..e63bd323e9af 100644 --- a/sd/source/filter/ppt/pptin.hxx +++ b/sd/source/filter/ppt/pptin.hxx @@ -61,7 +61,7 @@ class ImplSdPPTImport : public SdrPowerPointImport void FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiveInfoAtom const * pIAtom, const OUString& aMacroName ); - virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, ::tools::Rectangle& rTextRect, SdrObject* pObj ) override; + virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, SvxMSDffClientData& rClientData, ::tools::Rectangle& rTextRect, SdrObject* pObj ) override; virtual SdrObject* ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pText, SdPageCapsule pPage, SfxStyleSheet*, SfxStyleSheet** ) const override; diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index b606112d0595..2680a957a71a 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -561,7 +561,7 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj const * pTextObj, tools::Rectangle aClientRect( 0,0, aPD.nWidth, aPD.nHeight); SvxMSDffImportData aData( aClientRect ); - pObject = m_xMSDffManager->ImportObj(*m_pDataStream, &aData, aClientRect, tools::Rectangle(), /*nCalledByGroup*/0, /*pShapeId*/nullptr ); + pObject = m_xMSDffManager->ImportObj(*m_pDataStream, aData, aClientRect, tools::Rectangle(), /*nCalledByGroup*/0, /*pShapeId*/nullptr ); if (pObject) { // for the frame diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index f643f07bda01..648752df60fc 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -558,14 +558,14 @@ void SwWW8ImplReader::SetToggleBiDiAttrFlags(sal_uInt16 nFlags) SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, DffObjData& rObjData, - void* pData, + SvxMSDffClientData& rData, tools::Rectangle& rTextRect, SdrObject* pObj ) { if( !rTextRect.IsEmpty() ) { - SvxMSDffImportData& rImportData = *static_cast<SvxMSDffImportData*>(pData); + SvxMSDffImportData& rImportData = static_cast<SvxMSDffImportData&>(rData); SvxMSDffImportRec* pImpRec = new SvxMSDffImportRec; // fill Import Record with data diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index ee5ed06d308d..2e1baeac0778 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -771,7 +771,7 @@ public: void DisableFallbackStream(); void EnableFallbackStream(); protected: - virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rObjData, void* pData, tools::Rectangle& rTextRect, SdrObject* pObj ) override; + virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rObjData, SvxMSDffClientData& rData, tools::Rectangle& rTextRect, SdrObject* pObj ) override; }; class wwSection |