desktop/source/lib/init.cxx |   27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

New commits:
commit fa1f583f60d4eb12a3bc364be97b00f034833201
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Aug 17 15:57:28 2023 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Aug 28 21:43:31 2023 +0200

    logs full of "OConfigurationNode::hasByName: object is invalid"
    
    warn:legacy.osl:3509:3314:unotools/source/config/confignode.cxx:408: 
OConfigurationNode::hasByName: object is invalid!
    warn:legacy.osl:3509:3314:unotools/source/config/confignode.cxx:409: 
OConfigurationNode::hasByName: object is invalid!
    warn:legacy.osl:3509:3314:comphelper/source/misc/types.cxx:90: 
comphelper::getBOOL : invalid argument !
    
    in cool, open a document, switch from light to dark with sidebar open,
    click on a paragraph and then on another with different properties, e.g.
    normal vs heading and each change of a sidebar context triggers the
    warning over and over again.
    
    The config has no mention of notebookbar_online.ui but we set
    notebookbar_online.ui as the default to use for a notebookbar
    so replace mentions in the config of notebookbar.ui with
    notebookbar_online.ui for consistency when we do that and we
    can drop the constant log spam.
    
    Change-Id: I41860f5422d4426d8e3786b38c967e52bc803ae3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155806
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d55dd04d49e5..b04934207d83 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -87,6 +87,7 @@
 #include <comphelper/propertyvalue.hxx>
 #include <comphelper/scopeguard.hxx>
 #include <comphelper/threadpool.hxx>
+#include <comphelper/types.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 
@@ -209,6 +210,7 @@
 #include "lokclipboard.hxx"
 #include <officecfg/Office/Common.hxx>
 #include <officecfg/Office/Impress.hxx>
+#include <officecfg/Office/UI/ToolbarMode.hxx>
 #include <unotools/optionsdlg.hxx>
 #include <svl/ctloptions.hxx>
 #include <svtools/accessibilityoptions.hxx>
@@ -7355,7 +7357,23 @@ static void activateNotebookbar(std::u16string_view rApp)
 
     if (aAppNode.isValid())
     {
-        aAppNode.setNodeValue("Active", 
Any(OUString("notebookbar_online.ui")));
+        OUString sNoteBookbarName("notebookbar_online.ui");
+        aAppNode.setNodeValue("Active", Any(sNoteBookbarName));
+
+        const utl::OConfigurationNode aImplsNode = aAppNode.openNode("Modes");
+        const Sequence<OUString> aModeNodeNames( aImplsNode.getNodeNames() );
+
+        for (const auto& rModeNodeName : aModeNodeNames)
+        {
+            const utl::OConfigurationNode 
aImplNode(aImplsNode.openNode(rModeNodeName));
+            if (!aImplNode.isValid())
+                continue;
+
+            OUString aCommandArg = 
comphelper::getString(aImplNode.getNodeValue("CommandArg"));
+            if (aCommandArg == "notebookbar.ui")
+                aImplNode.setNodeValue("CommandArg", Any(sNoteBookbarName));
+        }
+
         aAppNode.commit();
     }
 }
@@ -7812,6 +7830,13 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 
     if (bNotebookbar)
     {
+        std::shared_ptr<comphelper::ConfigurationChanges> 
batch(comphelper::ConfigurationChanges::create());
+        
officecfg::Office::UI::ToolbarMode::ActiveWriter::set("notebookbar_online.ui", 
batch);
+        
officecfg::Office::UI::ToolbarMode::ActiveCalc::set("notebookbar_online.ui", 
batch);
+        
officecfg::Office::UI::ToolbarMode::ActiveImpress::set("notebookbar_online.ui", 
batch);
+        
officecfg::Office::UI::ToolbarMode::ActiveDraw::set("notebookbar_online.ui", 
batch);
+        batch->commit();
+
         activateNotebookbar(u"Writer");
         activateNotebookbar(u"Calc");
         activateNotebookbar(u"Impress");

Reply via email to