summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-01-07 16:29:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-08 07:12:37 +0100
commitb2d742faa062d3656f751b32acfe089ffa2dca3f (patch)
treec5d5a9c67f2af78fcf4c24f861dddbd7629962c7 /svx
parent151c56ed547490a99d912524c0e56b5d6d4a1939 (diff)
reduce cost of Sdr properties for text-derived objects
when they have no text in them Change-Id: I70c18898abf21141f3b30b7dee9c931c9b27cffb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128124 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/sdr/properties/textproperties.hxx2
-rw-r--r--svx/source/sdr/properties/textproperties.cxx10
2 files changed, 10 insertions, 2 deletions
diff --git a/svx/inc/sdr/properties/textproperties.hxx b/svx/inc/sdr/properties/textproperties.hxx
index 4a6d59f61972..719cf838ed89 100644
--- a/svx/inc/sdr/properties/textproperties.hxx
+++ b/svx/inc/sdr/properties/textproperties.hxx
@@ -41,7 +41,7 @@ namespace sdr::properties
// react on ItemSet changes
virtual void ItemSetChanged(const SfxItemSet*) override;
- virtual bool WantItemSetInItemSetChanged() const override final { return true; }
+ virtual bool WantItemSetInItemSetChanged() const override final;
/// Get the TextProvider related to our SdrObject
virtual const svx::ITextProvider& getTextProvider() const;
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index d361080e2062..c21111892923 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -81,6 +81,14 @@ namespace sdr::properties
return std::unique_ptr<BaseProperties>(new TextProperties(*this, rObj));
}
+ bool TextProperties::WantItemSetInItemSetChanged() const
+ {
+ // The itemset construction is fairly expensive, and we only need it
+ // if this text (or sub-type of text, eg. rectangle) actually has text.
+ const svx::ITextProvider& rTextProvider(getTextProvider());
+ return rTextProvider.getTextCount() != 0;
+ }
+
void TextProperties::ItemSetChanged(const SfxItemSet* pSet)
{
SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
@@ -145,7 +153,7 @@ namespace sdr::properties
}
// Extra-Repaint for radical layout changes (#43139#)
- if(SfxItemState::SET == pSet->GetItemState(SDRATTR_TEXT_CONTOURFRAME))
+ if(pSet && SfxItemState::SET == pSet->GetItemState(SDRATTR_TEXT_CONTOURFRAME))
{
// Here only repaint wanted
rObj.ActionChanged();