diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-13 14:19:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-14 09:12:25 +0200 |
commit | d70f53a8269be31f0412926afa5ba826faed6633 (patch) | |
tree | cb0d391364033ba090e76c837eb5450d4dba48a7 /include | |
parent | 76505bbd862b17b9b02a2d6e68bac308890dec70 (diff) |
tdf#100894 freeze when editing calc file with bazillions of cond formatting
This does not fix the root cause of this problem, which is simply that
the document has a bazillion style sheets. Either the program which
exported this document is broken, or our importer is not correctly de-
duplicating the imported stylesheets.
Anyhow, I made performance improvements until I realised that it was
simply going to be impossible to display that many stylesheets in our
UI.
But still, this bug was useful in flushing out some performance issues.
The improvements, in order of decreasing importance are:
(*) Use SfxStyleSheetIterator in SvxStyleToolBoxControl::FillStyleBox to
avoid an O(n^2) situation where the pool repeatedly marks all the
stylesheets as not-used, and then walks the document finding out if a
stylesheet is used. Which is a waste of time because we're searching the
documents pool, so of course they are all used.
(*) Add a virtual method to avoid dynamic_cast
(*) return raw pointers instead of returning rtl::Reference by value to
avoid unnecessary reference counting.
SfxStyleSheetIterator
Change-Id: I15ff9c1846d3ed3e6f5655fa44c762f7619d547a
Reviewed-on: https://gerrit.libreoffice.org/55751
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/svl/IndexedStyleSheets.hxx | 4 | ||||
-rw-r--r-- | include/svl/style.hxx | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/include/svl/IndexedStyleSheets.hxx b/include/svl/IndexedStyleSheets.hxx index 58b3c26a6d63..eba5cded45bb 100644 --- a/include/svl/IndexedStyleSheets.hxx +++ b/include/svl/IndexedStyleSheets.hxx @@ -109,7 +109,7 @@ public: * @internal * Method is not const because the returned style sheet is not const */ - rtl::Reference< SfxStyleSheetBase > + SfxStyleSheetBase* GetStyleSheetByPosition(unsigned pos); /** Find the position of a provided style. @@ -155,7 +155,7 @@ public: Reindex(); /** Warning: counting for n starts at 0, i.e., the 0th style sheet is the first that is found. */ - rtl::Reference<SfxStyleSheetBase> + SfxStyleSheetBase* GetNthStyleSheetThatMatchesPredicate(unsigned n, StyleSheetPredicate& predicate, unsigned startAt = 0); diff --git a/include/svl/style.hxx b/include/svl/style.hxx index 955cd99a34ef..6f328a2b7143 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -176,6 +176,9 @@ public: /// If the style has parents, it is _not_ required that the returned item /// set has parents (i.e. use it for display purposes only). virtual std::unique_ptr<SfxItemSet> GetItemSetForPreview(); + + /// Fix for expensive dynamic_cast + virtual bool isScStyleSheet() const { return false; } }; /* Class to iterate and search on a SfxStyleSheetBasePool */ @@ -243,8 +246,7 @@ protected: */ const svl::IndexedStyleSheets& GetIndexedStyleSheets() const; - rtl::Reference<SfxStyleSheetBase> - GetStyleSheetByPositionInIndex(unsigned pos); + SfxStyleSheetBase* GetStyleSheetByPositionInIndex(unsigned pos); public: SfxStyleSheetBasePool( SfxItemPool& ); |