toolkit/source/controls/unocontrol.cxx |   37 ++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 18 deletions(-)

New commits:
commit 96a403b9b12fbea4cd1d72c55597dd64023de465
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu May 4 10:24:53 2023 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu May 4 16:43:34 2023 +0200

    Resolves: tdf#155029 set StandardStyles before updateFromModel
    
    otherwise it overrides custom settings set by the model properties
    
    Change-Id: If5898aba3f2701b6d6bdaed99f9cb01174e53613
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151356
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/toolkit/source/controls/unocontrol.cxx 
b/toolkit/source/controls/unocontrol.cxx
index 217d8f94185d..5401cf86d7b7 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -1299,6 +1299,25 @@ void UnoControl::createPeer( const Reference< XToolkit 
>& rxToolkit, const Refer
 
     aGuard.clear();
 
+    // tdf#150886 if false use the same settings for widgets regardless of 
theme
+    // for consistency of document across platforms and in pdf/print output
+    // note: tdf#155029 do this before updateFromModel
+    if (xInfo->hasPropertyByName("StandardTheme"))
+    {
+        aVal = xPSet->getPropertyValue("StandardTheme");
+        bool bUseStandardTheme = false;
+        aVal >>= bUseStandardTheme;
+        if (bUseStandardTheme)
+        {
+            VclPtr<vcl::Window> pVclPeer = VCLUnoHelper::GetWindow(getPeer());
+            AllSettings aAllSettings = pVclPeer->GetSettings();
+            StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+            aStyleSettings.SetStandardStyles();
+            aAllSettings.SetStyleSettings(aStyleSettings);
+            pVclPeer->SetSettings(aAllSettings);
+        }
+    }
+
     // the updateFromModel is done without a locked mutex, too.
     // The reason is that the only thing this method does  is firing property 
changes, and this in general has
     // to be done without locked mutexes (as every notification to external 
listeners).
@@ -1318,24 +1337,6 @@ void UnoControl::createPeer( const Reference< XToolkit 
>& rxToolkit, const Refer
 
     xView->setGraphics( xGraphics );
 
-    // tdf#150886 if false use the same settings for widgets regardless of 
theme
-    // for consistency of document across platforms and in pdf/print output
-    if (xInfo->hasPropertyByName("StandardTheme"))
-    {
-        aVal = xPSet->getPropertyValue("StandardTheme");
-        bool bUseStandardTheme = false;
-        aVal >>= bUseStandardTheme;
-        if (bUseStandardTheme)
-        {
-            VclPtr<vcl::Window> pVclPeer = VCLUnoHelper::GetWindow(getPeer());
-            AllSettings aAllSettings = pVclPeer->GetSettings();
-            StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
-            aStyleSettings.SetStandardStyles();
-            aAllSettings.SetStyleSettings(aStyleSettings);
-            pVclPeer->SetSettings(aAllSettings);
-        }
-    }
-
     peerCreated();
 
     mbCreatingPeer = false;

Reply via email to