include/svtools/ctrlbox.hxx         |    1 +
 svtools/source/control/ctrlbox.cxx  |    7 +++++++
 svtools/source/control/valueset.cxx |    8 ++++----
 3 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 266f0d6e94bd83a5017c82c2d18f419377a46b62
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Mar 16 11:34:38 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Mar 16 14:37:57 2023 +0000

    update line controls dropdown valueset if style changed
    
    e.g. in page style dialog, footnote page, line menubutton, if theme
    changes from light<->dark while the line dropdown remains open.
    
    Use the application settings, and not the current rendercontext settings
    to get the up to date settings and not the settings at the time the
    virtual device rendered to was created.
    
    Change-Id: I674c94603f15c9035bbd07b4bd7247dcebc3124b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148982
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svtools/source/control/valueset.cxx 
b/svtools/source/control/valueset.cxx
index 84bb1248e6e5..bafed3e98d56 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -683,7 +683,7 @@ void ValueSet::ImplDraw(vcl::RenderContext& rRenderContext)
     {
         if (!(GetStyle() & WB_FLATVALUESET))
         {
-            const StyleSettings& rStyleSettings = 
rRenderContext.GetSettings().GetStyleSettings();
+            const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
             Size aWinSize(GetOutputSizePixel());
             Point aPos1(NAME_LINE_OFF_X, mnTextOffset + NAME_LINE_OFF_Y);
             Point aPos2(aWinSize.Width() - (NAME_LINE_OFF_X * 2), mnTextOffset 
+ NAME_LINE_OFF_Y);
@@ -995,9 +995,9 @@ void ValueSet::Format(vcl::RenderContext const & 
rRenderContext)
     }
 
     // Init VirDev
-    maVirDev->SetSettings(rRenderContext.GetSettings());
     
maVirDev->SetBackground(Application::GetSettings().GetStyleSettings().GetFaceColor());
     maVirDev->SetOutputSizePixel(aWinSize);
+    maVirDev->Erase();
 
     // nothing is changed in case of too small items
     if ((mnItemWidth <= 0) ||
@@ -1230,7 +1230,7 @@ void ValueSet::ImplDrawSelect(vcl::RenderContext& 
rRenderContext,
     tools::Rectangle aRect(rRect);
 
     // draw selection
-    const StyleSettings& rStyleSettings = 
rRenderContext.GetSettings().GetStyleSettings();
+    const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
     rRenderContext.SetFillColor();
 
     Color aDoubleColor;
@@ -1393,7 +1393,7 @@ void ValueSet::ImplFormatItem(vcl::RenderContext const & 
rRenderContext, ValueSe
     if ((aRect.GetHeight() <= 0) || (aRect.GetWidth() <= 0))
         return;
 
-    const StyleSettings& rStyleSettings = 
rRenderContext.GetSettings().GetStyleSettings();
+    const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
 
     if (pItem == mpNoneItem.get())
     {
commit bda036f0fe34cb8f20e1d4441f1514bae68df69f
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Mar 16 09:55:47 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Mar 16 14:37:47 2023 +0000

    update line controls preview if style changed
    
    e.g. in page style dialog, footnote page, line menubutton,
    if theme changes from light<->dark while the dialog remains open
    
    Change-Id: If8ca8b2cf9c4e4d620ce0ea1c92c50accbc8ebcb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148981
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index 61dcba9c191c..57b9094284ee 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -254,6 +254,7 @@ private:
     DECL_DLLPRIVATE_LINK(FocusHdl, weld::Widget&, void);
     DECL_DLLPRIVATE_LINK(ToggleHdl, weld::Toggleable&, void);
     DECL_DLLPRIVATE_LINK(NoneHdl, weld::Button&, void);
+    DECL_DLLPRIVATE_LINK(StyleUpdatedHdl, weld::Widget&, void);
 
     void            UpdateEntries();
 
diff --git a/svtools/source/control/ctrlbox.cxx 
b/svtools/source/control/ctrlbox.cxx
index 5aec7838c015..a17172d5ca44 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1420,6 +1420,7 @@ 
SvtLineListBox::SvtLineListBox(std::unique_ptr<weld::MenuButton> pControl)
     m_xTopLevel->connect_focus_in(LINK(this, SvtLineListBox, FocusHdl));
     m_xControl->set_popover(m_xTopLevel.get());
     m_xControl->connect_toggled(LINK(this, SvtLineListBox, ToggleHdl));
+    m_xControl->connect_style_updated(LINK(this, SvtLineListBox, 
StyleUpdatedHdl));
 
     // lock size to these maxes height/width so it doesn't jump around in size
     m_xControl->set_label(GetLineStyleName(SvxBorderLineStyle::NONE));
@@ -1451,6 +1452,12 @@ IMPL_LINK(SvtLineListBox, ToggleHdl, weld::Toggleable&, 
rButton, void)
         FocusHdl(*m_xTopLevel);
 }
 
+IMPL_LINK_NOARG(SvtLineListBox, StyleUpdatedHdl, weld::Widget&, void)
+{
+    UpdateEntries();
+    UpdatePreview();
+}
+
 IMPL_LINK_NOARG(SvtLineListBox, NoneHdl, weld::Button&, void)
 {
     SelectEntry(SvxBorderLineStyle::NONE);

Reply via email to