diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-26 18:59:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-29 08:30:00 +0200 |
commit | 24503d5ddfc0a83ac88aa23d03b69ed47f989e8e (patch) | |
tree | 39683a5df5964b1f6b03e16f574e7ca4e34440ee | |
parent | c4d8b4ecd82fde107d12f6b606bcbd023cfdd7cb (diff) |
tdf#63640 FILEOPEN/FILESAVE: particular .odt loads/saves very slow, part1
Make CntUnencodedStringItem sortable, implementing operator<.
This takes the load time from 4s to 3.3s
Change-Id: I532cdf65149a733d41d2caf367675800d2ba4d41
Reviewed-on: https://gerrit.libreoffice.org/71460
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svl/custritm.hxx | 2 | ||||
-rw-r--r-- | include/svx/xbtmpit.hxx | 2 | ||||
-rw-r--r-- | include/svx/xcolit.hxx | 2 | ||||
-rw-r--r-- | include/svx/xflgrit.hxx | 2 | ||||
-rw-r--r-- | include/svx/xflhtit.hxx | 2 | ||||
-rw-r--r-- | include/svx/xlndsit.hxx | 2 | ||||
-rw-r--r-- | include/svx/xlnedit.hxx | 2 | ||||
-rw-r--r-- | include/svx/xlnstit.hxx | 2 | ||||
-rw-r--r-- | svl/source/items/custritm.cxx | 11 |
9 files changed, 25 insertions, 2 deletions
diff --git a/include/svl/custritm.hxx b/include/svl/custritm.hxx index 65facd5cd54e..3899df7b2fbc 100644 --- a/include/svl/custritm.hxx +++ b/include/svl/custritm.hxx @@ -38,6 +38,8 @@ public: {} virtual bool operator ==(const SfxPoolItem & rItem) const override; + virtual bool operator <(const SfxPoolItem & rItem) const override; + virtual bool IsSortable() const override { return true; } virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, diff --git a/include/svx/xbtmpit.hxx b/include/svx/xbtmpit.hxx index bce24f860a4b..dedff05369ec 100644 --- a/include/svx/xbtmpit.hxx +++ b/include/svx/xbtmpit.hxx @@ -42,6 +42,8 @@ public: XFillBitmapItem( const XFillBitmapItem& 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/xcolit.hxx b/include/svx/xcolit.hxx index df3723542516..63d5e475ec31 100644 --- a/include/svx/xcolit.hxx +++ b/include/svx/xcolit.hxx @@ -47,6 +47,8 @@ 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 159c6862dc79..8e931cb40ef0 100644 --- a/include/svx/xflgrit.hxx +++ b/include/svx/xflgrit.hxx @@ -42,6 +42,8 @@ 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 a81e7232abfa..1f85088ad7cb 100644 --- a/include/svx/xflhtit.hxx +++ b/include/svx/xflhtit.hxx @@ -41,6 +41,8 @@ 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 a19e50608d15..8afc71545301 100644 --- a/include/svx/xlndsit.hxx +++ b/include/svx/xlndsit.hxx @@ -42,6 +42,8 @@ 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 b24d4825946f..2896138a7e87 100644 --- a/include/svx/xlnedit.hxx +++ b/include/svx/xlnedit.hxx @@ -41,6 +41,8 @@ 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 3e9c402e8bb9..c37cfc3bdd6d 100644 --- a/include/svx/xlnstit.hxx +++ b/include/svx/xlnstit.hxx @@ -41,6 +41,8 @@ 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; diff --git a/svl/source/items/custritm.cxx b/svl/source/items/custritm.cxx index b1324567ecbf..4cba9175d001 100644 --- a/svl/source/items/custritm.cxx +++ b/svl/source/items/custritm.cxx @@ -28,13 +28,20 @@ // virtual bool CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const { - DBG_ASSERT(dynamic_cast<const CntUnencodedStringItem*>( &rItem ) != nullptr, - "CntUnencodedStringItem::operator ==(): Bad type"); + assert(dynamic_cast<const CntUnencodedStringItem*>( &rItem )); return m_aValue == static_cast< const CntUnencodedStringItem * >(&rItem)-> m_aValue; } +bool CntUnencodedStringItem::operator<(const SfxPoolItem & rItem) const +{ + assert(dynamic_cast<const CntUnencodedStringItem*>( &rItem )); + return m_aValue + < static_cast< const CntUnencodedStringItem * >(&rItem)-> + m_aValue; +} + // virtual bool CntUnencodedStringItem::GetPresentation(SfxItemPresentation, MapUnit, MapUnit, OUString & rText, |