From 9887cd14e2777eed019aacfd0ac75554686c6b79 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 19 Apr 2018 14:43:40 +0100 Subject: use a map to avoid looping on every obj delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I47ff4f0f959b7d09fc91593b7dacb3d1a2b50472 Reviewed-on: https://gerrit.libreoffice.org/53164 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- include/filter/msfilter/msdffimp.hxx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'include/filter/msfilter/msdffimp.hxx') diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx index 022994a51873..5c0742a39f0a 100644 --- a/include/filter/msfilter/msdffimp.hxx +++ b/include/filter/msfilter/msdffimp.hxx @@ -262,16 +262,18 @@ private: SvxMSDffImportRec &operator=(const SvxMSDffImportRec&) = delete; }; -/** list of all SvxMSDffImportRec instances of/for a group */ -typedef std::set, - comphelper::UniquePtrValueLess> MSDffImportRecords; - /** block of parameters for import/export for a single call of ImportObjAtCurrentStreamPos() */ -struct MSFILTER_DLLPUBLIC SvxMSDffImportData +class MSFILTER_DLLPUBLIC SvxMSDffImportData { +private: + /** list of all SvxMSDffImportRec instances of/for a group */ + typedef std::set, + comphelper::UniquePtrValueLess> MSDffImportRecords; MSDffImportRecords m_Records; ///< Shape pointer, Shape ids and private data - tools::Rectangle aParentRect;///< Rectangle of the surrounding groups, + std::map m_ObjToRecMap; +public: + tools::Rectangle aParentRect;///< Rectangle of the surrounding groups, ///< which might have been provided externally explicit SvxMSDffImportData(const tools::Rectangle& rParentRect); @@ -279,6 +281,9 @@ struct MSFILTER_DLLPUBLIC SvxMSDffImportData SvxMSDffImportData( SvxMSDffImportData const & ) = delete; // MSVC2015 workaround ~SvxMSDffImportData(); bool empty() const { return m_Records.empty(); } + void insert(SvxMSDffImportRec* pImpRec); + void unmap(const SdrObject* pObj) { m_ObjToRecMap.erase(pObj); } + SvxMSDffImportRec* front() { return m_Records.begin()->get(); } size_t size() const { return m_Records.size(); } SvxMSDffImportRec* find(const SdrObject* pObj); MSDffImportRecords::const_iterator begin() const { return m_Records.begin(); } -- cgit