sfx2/source/appl/appserv.cxx                   |   21 ++++++++++++---
 sw/qa/extras/tiledrendering/tiledrendering.cxx |    6 ----
 vcl/jsdialog/enabled.cxx                       |   34 ++++++++++++++-----------
 vcl/source/window/builder.cxx                  |    8 ++---
 4 files changed, 42 insertions(+), 27 deletions(-)

New commits:
commit fe7a34d8a6acaeaaf8d5243fd9ddb169a7b69367
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Tue Mar 4 17:50:50 2025 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri May 2 15:34:28 2025 +0200

    jsdialogs: check if ignored .ui first
    
    avoid all the checks if we know we want to ignore that .ui file
    
    Change-Id: I5f7603a5f0d7902b4cfe76c9f87ece24e24e497e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182823
    Tested-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184902
    Tested-by: Jenkins

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 8004271aefd7..4b3d991c037e 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -33,6 +33,7 @@ enum JSDialogEnabledType
 
 constexpr auto IgnoredList
     = frozen::make_unordered_map<std::u16string_view, JSDialogEnabledType>({
+        { u"modules/swriter/ui/annotation.ui", JSDialogEnabledType::Ignore },
         { u"sfx/ui/deck.ui", JSDialogEnabledType::Ignore },
         { u"sfx/ui/tabbar.ui", JSDialogEnabledType::Ignore },
         { u"sfx/ui/tabbarcontents.ui", JSDialogEnabledType::Ignore },
@@ -485,6 +486,24 @@ inline bool isInMap(const auto& rList, std::u16string_view 
rUIFile, JSDialogEnab
 
     return false;
 }
+
+inline bool isEnabledAtRunTime(std::u16string_view rUIFile)
+{
+    const char* pEnabledDialog = getenv("SAL_JSDIALOG_ENABLE");
+    if (pEnabledDialog)
+    {
+        OUString sAllEnabledDialogs(pEnabledDialog, strlen(pEnabledDialog), 
RTL_TEXTENCODING_UTF8);
+        std::vector<OUString> aEnabledDialogsVector
+            = comphelper::string::split(sAllEnabledDialogs, ':');
+        for (const auto& rDialog : aEnabledDialogsVector)
+        {
+            if (rUIFile == rDialog)
+                return true;
+        }
+    }
+
+    return false;
+}
 } // end of namespace
 
 namespace jsdialog
@@ -528,20 +547,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
     if (isInMap(OtherDialogList, rUIFile, JSDialogEnabledType::Dialog))
         return true;
 
-    const char* pEnabledDialog = getenv("SAL_JSDIALOG_ENABLE");
-    if (pEnabledDialog)
-    {
-        OUString sAllEnabledDialogs(pEnabledDialog, strlen(pEnabledDialog), 
RTL_TEXTENCODING_UTF8);
-        std::vector<OUString> aEnabledDialogsVector
-            = comphelper::string::split(sAllEnabledDialogs, ':');
-        for (const auto& rDialog : aEnabledDialogsVector)
-        {
-            if (rUIFile == rDialog)
-                return true;
-        }
-    }
-
-    return false;
+    return isEnabledAtRunTime(rUIFile);
 }
 
 bool isBuilderEnabledForPopup(std::u16string_view rUIFile)
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 9103933538b7..21734bd4d248 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -187,7 +187,7 @@ namespace
 
 std::unique_ptr<weld::Builder> Application::CreateBuilder(weld::Widget* 
pParent, const OUString &rUIFile, bool bMobile, sal_uInt64 nLOKWindowId)
 {
-    if (comphelper::LibreOfficeKit::isActive())
+    if (comphelper::LibreOfficeKit::isActive() && 
!jsdialog::isIgnored(rUIFile))
     {
         if (jsdialog::isBuilderEnabledForSidebar(rUIFile))
             return JSInstanceBuilder::CreateSidebarBuilder(pParent, 
AllSettings::GetUIRootDir(), rUIFile, nLOKWindowId);
@@ -197,7 +197,7 @@ std::unique_ptr<weld::Builder> 
Application::CreateBuilder(weld::Widget* pParent,
             return JSInstanceBuilder::CreateMenuBuilder(pParent, 
AllSettings::GetUIRootDir(), rUIFile);
         else if (jsdialog::isBuilderEnabled(rUIFile, bMobile))
             return JSInstanceBuilder::CreateDialogBuilder(pParent, 
AllSettings::GetUIRootDir(), rUIFile);
-        else if (!jsdialog::isIgnored(rUIFile))
+        else
             SAL_WARN("vcl", "UI file not enabled for JSDialogs: " << rUIFile);
     }
 
@@ -206,7 +206,7 @@ std::unique_ptr<weld::Builder> 
Application::CreateBuilder(weld::Widget* pParent,
 
 std::unique_ptr<weld::Builder> Application::CreateInterimBuilder(vcl::Window* 
pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 
nLOKWindowId)
 {
-    if (comphelper::LibreOfficeKit::isActive())
+    if (comphelper::LibreOfficeKit::isActive() && 
!jsdialog::isIgnored(rUIFile))
     {
         // Notebookbar sub controls
         if (jsdialog::isInterimBuilderEnabledForNotebookbar(rUIFile))
@@ -217,7 +217,7 @@ std::unique_ptr<weld::Builder> 
Application::CreateInterimBuilder(vcl::Window* pP
         else if (jsdialog::isBuilderEnabledForAddressInput(rUIFile))
             return JSInstanceBuilder::CreateAddressInputBuilder(
                 pParent, AllSettings::GetUIRootDir(), rUIFile, nLOKWindowId);
-        else if (!jsdialog::isIgnored(rUIFile))
+        else
             SAL_WARN("vcl", "UI file not enabled for JSDialogs: " << rUIFile);
     }
 
commit 3d888185cf49c13ee7eee62abb56157281965963
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Feb 14 17:08:37 2025 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri May 2 15:34:20 2025 +0200

    lok: switch dark mode faster
    
    We don't need to load the color scheme every time
    we switch the dark mode on/off. Let's load it once
    then reuse.
    
    - preloading
    - reuse instance
    
    Change-Id: I72478327124dad7142af826232f483e4033764e2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181812
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182515
    Tested-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184901
    Tested-by: Jenkins

diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 2e21e6c496bb..a814265bae5c 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -361,6 +361,17 @@ weld::Window* SfxRequest::GetFrameWeld() const
 
 void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 {
+    const bool bIsLOK = comphelper::LibreOfficeKit::isActive();
+    static svtools::EditableColorConfig aEditableConfig;
+    static bool aColorConfigInitialized = false;
+    if (!aColorConfigInitialized && bIsLOK)
+    {
+        // preload color schemes
+        aEditableConfig.LoadScheme("Light");
+        aEditableConfig.LoadScheme("Dark");
+        aColorConfigInitialized = true;
+    }
+
     bool bDone = false;
     switch ( rReq.GetSlot() )
     {
@@ -719,16 +730,18 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
                 }
                 MiscSettings::SetAppColorMode(eUseMode);
             }
-            svtools::EditableColorConfig aEditableConfig;
+
             // kit explicitly ignores changes to the global color scheme, 
except for the current ViewShell,
             // so an attempted change to the same global color scheme when the 
now current ViewShell ignored
             // the last change requires re-sending the change. In which case 
individual shells will have to
             // decide if this color-scheme change is a change from their 
perspective to avoid unnecessary
             // invalidations.
-            if (!pNewThemeArg || comphelper::LibreOfficeKit::isActive()
-                || aEditableConfig.GetCurrentSchemeName() != sSchemeName)
+            if (!pNewThemeArg || bIsLOK || 
aEditableConfig.GetCurrentSchemeName() != sSchemeName)
             {
-                aEditableConfig.LoadScheme(sSchemeName);
+                if (bIsLOK)
+                    aEditableConfig.SetCurrentSchemeName(sSchemeName);
+                else
+                    aEditableConfig.LoadScheme(sSchemeName);
             }
 
             Invalidate(FN_CHANGE_THEME);
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 2ba5e6890b77..080ae12f1ed8 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1300,11 +1300,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
     {
         SwView* pView = getSwDocShell()->GetView();
         uno::Reference<frame::XFrame> xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
-        uno::Sequence<beans::PropertyValue> aPropertyValues = 
comphelper::InitPropertySequence(
-            {
-                { "NewTheme", uno::Any(u"Dark"_ustr) },
-            }
-        );
+        uno::Sequence<beans::PropertyValue> aPropertyValues = 
comphelper::InitPropertySequence({});
         comphelper::dispatchCommand(u".uno:ChangeTheme"_ustr, xFrame, 
aPropertyValues);
     }
     CPPUNIT_ASSERT_EQUAL("S;Dark"_ostr, pXTextDocument->getViewRenderState());

Reply via email to