sw/source/uibase/config/usrpref.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 939fe1f284e4e2122d7a407665128efb3e73b54b
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Nov 26 14:33:00 2024 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Dec 11 09:32:29 2024 +0100

    Allow toggling grid options on/off via config to update writer
    
    SwGridConfig ConfigItem didn't listen to the config changes.
    
    Note that after this, while toggling e.g. VisibleGrid on/off in expert
    settings doesn't initially appear to do a whole pile, it does affect
    newly created documents, while before this change it does not.
    
    Existing documents don't update to use that config. Toggling this
    on/off via the explicit Show Grid ends up in
    
    SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView)
    
    with something of a bodge to determine the current SwView in order
    to affect the document the setting dialog is launched from, which
    is why it changes the current document, and new documents, but not
    any other open documents.
    
    Change-Id: Ic57e89e3aa9765ad3c4374ddf02ed718382cf518
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177371
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/uibase/config/usrpref.cxx 
b/sw/source/uibase/config/usrpref.cxx
index c1a8f52915a9..556bb7612315 100644
--- a/sw/source/uibase/config/usrpref.cxx
+++ b/sw/source/uibase/config/usrpref.cxx
@@ -68,7 +68,6 @@ SwMasterUsrPref::SwMasterUsrPref(bool bWeb) :
     m_eHScrollMetric = m_eVScrollMetric = m_eUserMetric;
 
     m_aLayoutConfig.Load();
-    m_aGridConfig.Load();
     m_aCursorConfig.Load();
     if(m_pWebColorConfig)
         m_pWebColorConfig->Load();
@@ -422,10 +421,11 @@ Sequence<OUString> SwGridConfig::GetPropertyNames()
 }
 
 SwGridConfig::SwGridConfig(bool bIsWeb, SwMasterUsrPref& rPar) :
-    ConfigItem(bIsWeb ? OUString("Office.WriterWeb/Grid") :  
OUString("Office.Writer/Grid"),
-        ConfigItemMode::ReleaseTree),
+    ConfigItem(bIsWeb ? OUString("Office.WriterWeb/Grid") :  
OUString("Office.Writer/Grid")),
     m_rParent(rPar)
 {
+    Load();
+    EnableNotification(GetPropertyNames());
 }
 
 SwGridConfig::~SwGridConfig()
@@ -488,7 +488,10 @@ void SwGridConfig::Load()
     m_rParent.SetSnapSize(aSnap);
 }
 
-void SwGridConfig::Notify( const css::uno::Sequence< OUString >& ) {}
+void SwGridConfig::Notify( const css::uno::Sequence< OUString >& )
+{
+    Load();
+}
 
 Sequence<OUString> SwCursorConfig::GetPropertyNames()
 {

Reply via email to