summaryrefslogtreecommitdiff
path: root/filter/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-08-03 09:57:24 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-08-07 17:39:57 +0200
commit1a6a05adf8b0f2620c0798e8c6811b08c80d0dea (patch)
treec53bb559010bf40bdb666814cfe9b49193e52eb9 /filter/source
parent679ab387954b2c8c00a8e9c9b6ad67a65fa432cd (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 'filter/source')
-rw-r--r--filter/source/msfilter/msdffimp.cxx66
-rw-r--r--filter/source/msfilter/svdfppt.cxx27
2 files changed, 50 insertions, 43 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 923013f96d82..96db3884ddbf 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -242,9 +242,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();
@@ -3182,7 +3182,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() )
@@ -4021,7 +4021,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;
@@ -4029,17 +4029,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 )
{
@@ -4058,7 +4058,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;
@@ -4103,7 +4103,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);
@@ -4114,7 +4114,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 )
@@ -4122,7 +4122,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);
@@ -4133,7 +4133,7 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
insertShapeId(nShapeId, pTmp);
}
else
- FreeObj(pClientData, pTmp);
+ FreeObj(rClientData, pTmp);
}
}
if (!aRecHd2.SeekToEndOfRecord(rSt))
@@ -4168,7 +4168,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 )
{
@@ -4231,9 +4231,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
@@ -4276,7 +4276,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;
@@ -4856,7 +4856,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
}
pRet =
- ProcessObj( rSt, aObjData, pClientData, aTextRect, pRet);
+ ProcessObj( rSt, aObjData, rClientData, aTextRect, pRet);
if ( pRet )
{
@@ -5045,40 +5045,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;
@@ -6316,7 +6320,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 );
@@ -6631,7 +6635,7 @@ bool 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 3aaf6c44dcba..c9818b257c3b 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -557,7 +557,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;
}
@@ -575,7 +575,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 )
@@ -710,10 +710,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)
@@ -728,13 +726,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 ) );
@@ -742,7 +745,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# ...
@@ -1217,7 +1220,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 )
{
@@ -2594,7 +2597,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)
@@ -2831,7 +2834,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 );
}
}
@@ -2847,7 +2850,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 );
}
}
}
@@ -2888,7 +2891,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 )