Kaydet (Commit) 24503d5d authored tarafından Noel Grandin's avatar Noel Grandin

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: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst c4d8b4ec
...@@ -38,6 +38,8 @@ public: ...@@ -38,6 +38,8 @@ public:
{} {}
virtual bool operator ==(const SfxPoolItem & rItem) const override; 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, virtual bool GetPresentation(SfxItemPresentation,
MapUnit, MapUnit, MapUnit, MapUnit,
......
...@@ -42,6 +42,8 @@ public: ...@@ -42,6 +42,8 @@ public:
XFillBitmapItem( const XFillBitmapItem& rItem ); XFillBitmapItem( const XFillBitmapItem& rItem );
virtual bool operator==( const SfxPoolItem& rItem ) const override; 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 SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
......
...@@ -47,6 +47,8 @@ public: ...@@ -47,6 +47,8 @@ public:
XColorItem(const XColorItem& rItem); XColorItem(const XColorItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override; 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 SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
const Color& GetColorValue() const; const Color& GetColorValue() const;
......
...@@ -42,6 +42,8 @@ public: ...@@ -42,6 +42,8 @@ public:
XFillGradientItem(const XFillGradientItem& rItem); XFillGradientItem(const XFillGradientItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override; 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 SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
......
...@@ -41,6 +41,8 @@ public: ...@@ -41,6 +41,8 @@ public:
XFillHatchItem(const XFillHatchItem& rItem); XFillHatchItem(const XFillHatchItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override; 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 SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
......
...@@ -42,6 +42,8 @@ public: ...@@ -42,6 +42,8 @@ public:
XLineDashItem(const XLineDashItem& rItem); XLineDashItem(const XLineDashItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override; 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 SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
......
...@@ -41,6 +41,8 @@ public: ...@@ -41,6 +41,8 @@ public:
XLineEndItem(const XLineEndItem& rItem); XLineEndItem(const XLineEndItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override; 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 SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
......
...@@ -41,6 +41,8 @@ public: ...@@ -41,6 +41,8 @@ public:
XLineStartItem(const XLineStartItem& rItem); XLineStartItem(const XLineStartItem& rItem);
virtual bool operator==(const SfxPoolItem& rItem) const override; 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 SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
......
...@@ -28,13 +28,20 @@ ...@@ -28,13 +28,20 @@
// virtual // virtual
bool CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const bool CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const
{ {
DBG_ASSERT(dynamic_cast<const CntUnencodedStringItem*>( &rItem ) != nullptr, assert(dynamic_cast<const CntUnencodedStringItem*>( &rItem ));
"CntUnencodedStringItem::operator ==(): Bad type");
return m_aValue return m_aValue
== static_cast< const CntUnencodedStringItem * >(&rItem)-> == static_cast< const CntUnencodedStringItem * >(&rItem)->
m_aValue; 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 // virtual
bool CntUnencodedStringItem::GetPresentation(SfxItemPresentation, MapUnit, bool CntUnencodedStringItem::GetPresentation(SfxItemPresentation, MapUnit,
MapUnit, OUString & rText, MapUnit, OUString & rText,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment