summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-05-04 14:38:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-05-07 10:54:20 +0200
commitf1ed27eed68228edbab5eb63951a602263e4c3a7 (patch)
tree3e85226dbd00ed61b7c38a080fff8ef063e75140 /include
parentf0c3fc59e1eefbec202e0a10553dd6581fc2cae5 (diff)
tdf#63640 FILEOPEN/FILESAVE: particular .odt loads/saves very slow, part2
Use the existing sorting functionality in SfxItemPool and extend it to search for NameOrIndex item in SvxUnoNameItemTable This is a little tricky in that we are defining only a partial ordering over the CntUnencodedStringItem (and their subclasses) items. Partial because I can only use the part of the item that is not randomly mutated by various code, which is why the other fields in the subclasses are mostly out of bounds. I had to exclude FillBitmapItem because it triggers a unit test failure and I cannot figure out why that specific item does not play nice with this optimisation. After this optimisation, the load time goes from 3.6s to 2s on my machine. Change-Id: I52d58c68db2536b69a7b0a9611a2b4c703bc4928 Reviewed-on: https://gerrit.libreoffice.org/71461 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/svl/custritm.hxx4
-rw-r--r--include/svl/itempool.hxx6
-rw-r--r--include/svx/xbtmpit.hxx2
-rw-r--r--include/svx/xcolit.hxx2
-rw-r--r--include/svx/xflgrit.hxx2
-rw-r--r--include/svx/xflhtit.hxx2
-rw-r--r--include/svx/xlndsit.hxx2
-rw-r--r--include/svx/xlnedit.hxx2
-rw-r--r--include/svx/xlnstit.hxx2
9 files changed, 9 insertions, 15 deletions
diff --git a/include/svl/custritm.hxx b/include/svl/custritm.hxx
index 3899df7b2fbc..5677c990569e 100644
--- a/include/svl/custritm.hxx
+++ b/include/svl/custritm.hxx
@@ -23,6 +23,7 @@
#include <svl/svldllapi.h>
#include <tools/debug.hxx>
#include <svl/poolitem.hxx>
+#include <cassert>
class SVL_DLLPUBLIC CntUnencodedStringItem: public SfxPoolItem
{
@@ -60,8 +61,7 @@ public:
inline void CntUnencodedStringItem::SetValue(const OUString & rTheValue)
{
- DBG_ASSERT(GetRefCount() == 0,
- "CntUnencodedStringItem::SetValue(): Pooled item");
+ assert(GetRefCount() == 0 && "cannot modify name of pooled item");
m_aValue = rTheValue;
}
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
index 7f74cb85c11d..3a2ff084d723 100644
--- a/include/svl/itempool.hxx
+++ b/include/svl/itempool.hxx
@@ -171,6 +171,12 @@ public:
sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const;
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const;
+ /*
+ This is only valid for SfxPoolItem that override IsSortable and operator<.
+ Returns a range of items defined by using operator<.
+ @param rNeedle must be the same type or a supertype of the pool items for nWhich.
+ */
+ std::vector<const SfxPoolItem*> FindItemSurrogate(sal_uInt16 nWhich, SfxPoolItem const & rNeedle) const;
sal_uInt16 GetFirstWhich() const;
sal_uInt16 GetLastWhich() const;
diff --git a/include/svx/xbtmpit.hxx b/include/svx/xbtmpit.hxx
index dedff05369ec..8987aaf107a4 100644
--- a/include/svx/xbtmpit.hxx
+++ b/include/svx/xbtmpit.hxx
@@ -42,7 +42,7 @@ public:
XFillBitmapItem( const XFillBitmapItem& rItem );
virtual bool operator==( const SfxPoolItem& rItem ) const override;
- // NameOrIndex is sortable, but we are not
+ // no idea why, but this item does not play nice with the sorting optimisation, get failures in sd_import_tests
virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
diff --git a/include/svx/xcolit.hxx b/include/svx/xcolit.hxx
index 63d5e475ec31..df3723542516 100644
--- a/include/svx/xcolit.hxx
+++ b/include/svx/xcolit.hxx
@@ -47,8 +47,6 @@ public:
XColorItem(const XColorItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
- // NameOrIndex is sortable, but we are not
- virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
const Color& GetColorValue() const;
diff --git a/include/svx/xflgrit.hxx b/include/svx/xflgrit.hxx
index 8e931cb40ef0..159c6862dc79 100644
--- a/include/svx/xflgrit.hxx
+++ b/include/svx/xflgrit.hxx
@@ -42,8 +42,6 @@ public:
XFillGradientItem(const XFillGradientItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
- // NameOrIndex is sortable, but we are not
- virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
diff --git a/include/svx/xflhtit.hxx b/include/svx/xflhtit.hxx
index 1f85088ad7cb..a81e7232abfa 100644
--- a/include/svx/xflhtit.hxx
+++ b/include/svx/xflhtit.hxx
@@ -41,8 +41,6 @@ public:
XFillHatchItem(const XFillHatchItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
- // NameOrIndex is sortable, but we are not
- virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
diff --git a/include/svx/xlndsit.hxx b/include/svx/xlndsit.hxx
index 8afc71545301..a19e50608d15 100644
--- a/include/svx/xlndsit.hxx
+++ b/include/svx/xlndsit.hxx
@@ -42,8 +42,6 @@ public:
XLineDashItem(const XLineDashItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
- // NameOrIndex is sortable, but we are not
- virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
diff --git a/include/svx/xlnedit.hxx b/include/svx/xlnedit.hxx
index 2896138a7e87..b24d4825946f 100644
--- a/include/svx/xlnedit.hxx
+++ b/include/svx/xlnedit.hxx
@@ -41,8 +41,6 @@ public:
XLineEndItem(const XLineEndItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
- // NameOrIndex is sortable, but we are not
- virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
diff --git a/include/svx/xlnstit.hxx b/include/svx/xlnstit.hxx
index c37cfc3bdd6d..3e9c402e8bb9 100644
--- a/include/svx/xlnstit.hxx
+++ b/include/svx/xlnstit.hxx
@@ -41,8 +41,6 @@ public:
XLineStartItem(const XLineStartItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override;
- // NameOrIndex is sortable, but we are not
- virtual bool IsSortable() const override { return false; }
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;