summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-08-03 09:57:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-08-03 15:04:53 +0200
commita61b4c214b8acfcdddd2f5203184468e329bdb92 (patch)
tree6fec90f7a394852d719dbc8ac1bf22728e6af129 /filter
parentea59fc4831b9d2430de51faa8c3e0a24e6d90cd1 (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>
Diffstat (limited to 'filter')
-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 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 )