diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-09-06 12:55:26 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2024-09-13 11:20:41 +0200 |
commit | e4251f16e8659b02d36a9b44215970e77a67ead5 (patch) | |
tree | 53301c69e18d6d16fcd50aa9b26b3c7c8726e643 /include | |
parent | 44fea573fec5a415d0488b760c133afe3aabb562 (diff) |
reduce time spent in RecalcPageNums when importing PDF
when we have lots of pages, we trigger a O(n^2) loop.
Do two things to reduce this
(a) be smarter about recalculating page numbers, so we only recalculate
the set of page numbers that need recalculating
(b) duplicate the last page repeatedly, instead of the first page, so we
don't recalculate all the page numbers for each page we duplicate
Change-Id: I40aca812b47a9551039c5855b1c8d26f5f171f41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172950
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/svx/svdmodel.hxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 68565e264bc3..f037baf6fcc4 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -199,12 +199,12 @@ protected: std::deque<std::unique_ptr<SfxUndoAction>> m_aRedoStack; std::unique_ptr<SdrUndoGroup> m_pCurrentUndoGroup; // For multi-level sal_uInt16 m_nUndoLevel; // undo nesting + sal_uInt16 m_nPageNumsDirtyFrom = SAL_MAX_UINT16; + sal_uInt16 m_nMasterPageNumsDirtyFrom = SAL_MAX_UINT16; bool m_bIsWriter:1; // to clean up pMyPool from 303a bool m_bThemedControls:1; // If false UnoControls should not use theme colors bool mbUndoEnabled:1; // If false no undo is recorded or we are during the execution of an undo action bool mbChanged:1; - bool m_bPagNumsDirty:1; - bool m_bMPgNumsDirty:1; bool m_bTransportContainer:1; // doc is temporary object container, no display (e.g. clipboard) bool m_bReadOnly:1; bool m_bTransparentTextFrames:1; @@ -397,8 +397,8 @@ public: static OUString GetPercentString(const Fraction& rVal); // RecalcPageNums is ordinarily only called by the Page. - bool IsPagNumsDirty() const { return m_bPagNumsDirty; }; - bool IsMPgNumsDirty() const { return m_bMPgNumsDirty; }; + bool IsPagNumsDirty() const { return m_nPageNumsDirtyFrom != SAL_MAX_UINT16; } + bool IsMPgNumsDirty() const { return m_nMasterPageNumsDirtyFrom != SAL_MAX_UINT16; } void RecalcPageNums(bool bMaster); // After the Insert the Page belongs to the SdrModel. virtual void InsertPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF); |