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:
{}
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,
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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,
......
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