summaryrefslogtreecommitdiff
path: root/sw/source/uibase/docvw/AnnotationWin2.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-06-13 10:11:08 +0200
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-06-13 17:11:45 +0200
commit8d18b5af883bb6b56e758801ee730a08bb88a8f5 (patch)
treeea230e36ac2af38ae0a75660e1bec4bd86197e58 /sw/source/uibase/docvw/AnnotationWin2.cxx
parent0ea5dde060df7ef638fbd1f2efe6aa221033e69c (diff)
speed up rendering annotatins, cache meta height
shaves 2% off scrolling profile on a large word doc Change-Id: I283e3f99c1c385f3d20ea573d15ca59b4629c14d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152978 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw/source/uibase/docvw/AnnotationWin2.cxx')
-rw-r--r--sw/source/uibase/docvw/AnnotationWin2.cxx23
1 files changed, 17 insertions, 6 deletions
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 06efbfdb581f..2c4bc7ce3d5e 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1262,14 +1262,25 @@ int SwAnnotationWin::GetPrefScrollbarWidth() const
sal_Int32 SwAnnotationWin::GetMetaHeight() const
{
- const int fields = GetNumFields();
+ if (!moMetaHeight)
+ {
+ const int fields = GetNumFields();
- sal_Int32 nRequiredHeight = 0;
- weld::Label* aLabels[3] = { mxMetadataAuthor.get(), mxMetadataDate.get(), mxMetadataResolved.get() };
- for (int i = 0; i < fields; ++i)
- nRequiredHeight += aLabels[i]->get_preferred_size().Height();
+ sal_Int32 nRequiredHeight = 0;
+ weld::Label* aLabels[3] = { mxMetadataAuthor.get(), mxMetadataDate.get(), mxMetadataResolved.get() };
+ for (int i = 0; i < fields; ++i)
+ nRequiredHeight += aLabels[i]->get_preferred_size().Height();
+ moMetaHeight = nRequiredHeight;
+ }
+ return *moMetaHeight;
+}
- return nRequiredHeight;
+void SwAnnotationWin::DataChanged(const DataChangedEvent& rDCEvt)
+{
+ if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
+ {
+ moMetaHeight.reset();
+ }
}
sal_Int32 SwAnnotationWin::GetNumFields() const