summaryrefslogtreecommitdiff
path: root/svx/source/inc
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-03-02 12:18:21 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2021-03-06 16:09:28 +0100
commit01d99c0005f67d6ecb139bae7463dc25d45884ef (patch)
treeb22a5ffc7530b17ba9f06228803ed9fdce18bf38 /svx/source/inc
parent15aed21fbf44d44656b8e6aff5affa04d12a6fed (diff)
Styles preview: use listener to trigger update
Do not render all styles on every selection change. Use listener to detect styles modification. Change-Id: I6d41acd7acad160d1477281d2b3d473233def4d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111833 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112013 Tested-by: Jenkins
Diffstat (limited to 'svx/source/inc')
-rw-r--r--svx/source/inc/StylesPreviewWindow.hxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/svx/source/inc/StylesPreviewWindow.hxx b/svx/source/inc/StylesPreviewWindow.hxx
index 7c2c572708ef..533ff40601b4 100644
--- a/svx/source/inc/StylesPreviewWindow.hxx
+++ b/svx/source/inc/StylesPreviewWindow.hxx
@@ -28,6 +28,7 @@
class StylesPreviewWindow_Base;
+/// Listener for style selection
class StyleStatusListener : public SfxStatusListener
{
StylesPreviewWindow_Base* m_pPreviewControl;
@@ -40,6 +41,19 @@ public:
void StateChanged(SfxItemState eState, const SfxPoolItem* pState) override;
};
+/// Listener for styles creation or modification
+class StylePoolChangeListener : public SfxListener
+{
+ StylesPreviewWindow_Base* m_pPreviewControl;
+ SfxStyleSheetBasePool* m_pStyleSheetPool;
+
+public:
+ StylePoolChangeListener(StylesPreviewWindow_Base* pPreviewControl);
+ ~StylePoolChangeListener();
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+};
+
class StyleItemController
{
static constexpr unsigned LEFT_MARGIN = 8;
@@ -70,6 +84,7 @@ protected:
std::unique_ptr<weld::IconView> m_xStylesView;
rtl::Reference<StyleStatusListener> m_xStatusListener;
+ std::unique_ptr<StylePoolChangeListener> m_pStylePoolChangeListener;
std::vector<std::pair<OUString, OUString>> m_aDefaultStyles;
std::vector<std::pair<OUString, OUString>> m_aAllStyles;
@@ -87,10 +102,10 @@ public:
~StylesPreviewWindow_Base();
void Select(const OUString& rStyleName);
+ void UpdateStylesList();
private:
void Update();
- void UpdateStylesList();
bool Command(const CommandEvent& rEvent);
};