[Libreoffice-commits] core.git: filter/source include/filter sw/source
Caolán McNamara
caolanm at redhat.com
Fri Apr 20 07:51:33 UTC 2018
filter/source/msfilter/msdffimp.cxx | 37 ++++++++++++++++++++++++++++++++++-
filter/source/msfilter/svdfppt.cxx | 3 --
include/filter/msfilter/msdffimp.hxx | 11 +++++++---
include/filter/msfilter/svdfppt.hxx | 3 +-
sw/source/filter/ww8/ww8graf.cxx | 11 ----------
5 files changed, 48 insertions(+), 17 deletions(-)
New commits:
commit 9f0fdb491cb128d3a5afb9c1f5907dfc31f6b197
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Apr 17 09:26:55 2018 +0100
forcepoint#38 notify that obj in group was deleted
Change-Id: I4599a8e93eccb28c8a406418fd5c7c670b59c871
Reviewed-on: https://gerrit.libreoffice.org/53162
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 4eaf3205e437..6e1726c9785c 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5028,8 +5028,34 @@ void SvxMSDffManager::GetGroupAnchors( const DffRecordHeader& rHd, SvStream& rSt
}
}
-void SvxMSDffManager::FreeObj(void* /*pData*/, SdrObject* pObj)
+SvxMSDffImportRec* SvxMSDffImportData::find(const SdrObject* pObj)
{
+ for (const auto& it : *this)
+ {
+ if (it->pObj == pObj)
+ return it.get();
+ }
+ return nullptr;
+}
+
+void SvxMSDffManager::NotifyFreeObj(void* pData, 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));
+ }
+
+ SvxMSDffImportData& rImportData = *static_cast<SvxMSDffImportData*>(pData);
+ if (SvxMSDffImportRec* pRecord = rImportData.find(pObj))
+ pRecord->pObj = nullptr;
+}
+
+void SvxMSDffManager::FreeObj(void* pData, SdrObject* pObj)
+{
+ NotifyFreeObj(pData, pObj);
SdrObject::Free(pObj);
}
@@ -7471,4 +7497,13 @@ SdrObject* SvxMSDffManager::getShapeForId( sal_Int32 nShapeId )
return aIter != maShapeIdContainer.end() ? (*aIter).second : nullptr;
}
+SvxMSDffImportData::SvxMSDffImportData(const tools::Rectangle& rParentRect)
+ : aParentRect(rParentRect)
+{
+}
+
+SvxMSDffImportData::~SvxMSDffImportData()
+{
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 5758ca606a1b..c9e26c9e64c6 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -710,7 +710,7 @@ sal_uLong DffPropSet::SanitizeEndPos(SvStream &rIn, sal_uLong nEndRecPos)
return nEndRecPos;
}
-void SdrEscherImport::FreeObj(void* pData, SdrObject* pObj)
+void SdrEscherImport::NotifyFreeObj(void* pData, SdrObject* pObj)
{
ProcessData& rData = *static_cast<ProcessData*>(pData);
PptSlidePersistEntry& rPersistEntry = rData.rPersistEntry;
@@ -726,7 +726,6 @@ void SdrEscherImport::FreeObj(void* pData, SdrObject* pObj)
pPtr->pCObj = nullptr;
}
}
- SvxMSDffManager::FreeObj(pData, pObj);
}
/* ProcessObject is called from ImplSdPPTImport::ProcessObj to handle all application specific things,
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index fedce1b33112..022994a51873 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -268,15 +268,19 @@ typedef std::set<std::unique_ptr<SvxMSDffImportRec>,
/** block of parameters for import/export for a single call of
ImportObjAtCurrentStreamPos() */
-struct SvxMSDffImportData
+struct MSFILTER_DLLPUBLIC SvxMSDffImportData
{
MSDffImportRecords m_Records; ///< Shape pointer, Shape ids and private data
tools::Rectangle aParentRect;///< Rectangle of the surrounding groups,
///< which might have been provided externally
- explicit SvxMSDffImportData( const tools::Rectangle& rParentRect ) : aParentRect( rParentRect ) {}
+ explicit SvxMSDffImportData(const tools::Rectangle& rParentRect);
+ SvxMSDffImportData& operator=( SvxMSDffImportData const & ) = delete; // MSVC2015 workaround
+ SvxMSDffImportData( SvxMSDffImportData const & ) = delete; // MSVC2015 workaround
+ ~SvxMSDffImportData();
bool empty() const { return m_Records.empty(); }
size_t size() const { return m_Records.size(); }
+ SvxMSDffImportRec* find(const SdrObject* pObj);
MSDffImportRecords::const_iterator begin() const { return m_Records.begin(); }
MSDffImportRecords::const_iterator end() const { return m_Records.end(); }
};
@@ -499,7 +503,8 @@ protected:
void* pData,
tools::Rectangle& rTextRect,
SdrObject* pObj);
- virtual void FreeObj(void* pData, SdrObject* pObj);
+ virtual void NotifyFreeObj(void* pData, SdrObject* pObj);
+ void FreeObj(void* pData, SdrObject* pObj);
/** Object finalization, used by the Excel filter to correctly
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index 0c25f15ad63e..1103bc56d3b5 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -483,7 +483,8 @@ public:
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 FreeObj(void* pData, SdrObject* pObj) override;
+ virtual void NotifyFreeObj(void* pData, SdrObject* pObj) override;
+ void FreeObj(void* pData, SdrObject* pObj);
virtual void ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, void* pData, DffObjData& rObj ) override;
void ImportHeaderFooterContainer( DffRecordHeader const & rHeader, HeaderFooterEntry& rEntry );
};
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index bf921f3c9c44..a57ccc46b3ac 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2616,20 +2616,11 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp )
if (aData.size() != 1)
bReplaceable = false;
- SvxMSDffImportRec* pRecord = nullptr;
/*
Get the record for top level object, so we can get the word anchoring
and wrapping information for it.
*/
- for (auto const & it : aData)
- {
- if (it->pObj == pObject)
- {
- pRecord = it.get();
- break;
- }
- }
-
+ SvxMSDffImportRec* pRecord = aData.find(pObject);
OSL_ENSURE(pRecord, "how did that happen?");
if (!pRecord)
{
More information about the Libreoffice-commits
mailing list