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

New commits:
commit 0e14dbc9ecdf6abae3ae3089e3b4e22f27dd4cb1
Author:     Caolán McNamara <[email protected]>
AuthorDate: Thu May 4 10:24:53 2023 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri May 5 10:48:33 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/+/151370
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/toolkit/source/controls/unocontrol.cxx 
b/toolkit/source/controls/unocontrol.cxx
index a3d0a251c382..dc60204ccc47 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -1298,6 +1298,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).
@@ -1317,24 +1336,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