diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-19 14:43:40 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-20 12:20:01 +0200 |
commit | 9887cd14e2777eed019aacfd0ac75554686c6b79 (patch) | |
tree | f1979a832227ea5030836814bf4eb9b414032f8c /include/filter/msfilter/msdffimp.hxx | |
parent | f5a9fb18b2b523e517ab425948c4488fe19e39a8 (diff) |
use a map to avoid looping on every obj delete
Change-Id: I47ff4f0f959b7d09fc91593b7dacb3d1a2b50472
Reviewed-on: https://gerrit.libreoffice.org/53164
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/filter/msfilter/msdffimp.hxx')
-rw-r--r-- | include/filter/msfilter/msdffimp.hxx | 17 |
1 files changed, 11 insertions, 6 deletions
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<std::unique_ptr<SvxMSDffImportRec>, - comphelper::UniquePtrValueLess<SvxMSDffImportRec>> 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<std::unique_ptr<SvxMSDffImportRec>, + comphelper::UniquePtrValueLess<SvxMSDffImportRec>> MSDffImportRecords; MSDffImportRecords m_Records; ///< Shape pointer, Shape ids and private data - tools::Rectangle aParentRect;///< Rectangle of the surrounding groups, + std::map<const SdrObject*, SvxMSDffImportRec*> 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(); } |