desktop/source/lib/init.cxx                    |    2 
 include/vcl/WeldedTabbedNotebookbar.hxx        |    4 -
 sc/UIConfig_scalc.mk                           |    1 
 sc/uiconfig/scalc/ui/notebookbar_online.ui     |   93 ++++++++++++++++++++++++
 sd/UIConfig_sdraw.mk                           |    1 
 sd/UIConfig_simpress.mk                        |    1 
 sd/uiconfig/sdraw/ui/notebookbar_online.ui     |   69 ++++++++++++++++++
 sd/uiconfig/simpress/ui/notebookbar_online.ui  |   69 ++++++++++++++++++
 sfx2/source/notebookbar/SfxNotebookBar.cxx     |   11 ++
 sw/UIConfig_swriter.mk                         |    1 
 sw/uiconfig/swriter/ui/notebookbar_online.ui   |   95 +++++++++++++++++++++++++
 vcl/source/control/WeldedTabbedNotebookbar.cxx |    2 
 vcl/source/control/notebookbar.cxx             |    6 -
 13 files changed, 343 insertions(+), 12 deletions(-)

New commits:
commit f3f4ca409ec619e205ce9af5a4938d6bafac0ca5
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Tue Apr 6 07:08:30 2021 +0200
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Wed Apr 14 10:57:24 2021 +0200

    notebookbar: minify for online
    
    Notebookbar load takes some time. We don't use most of
    the items in online so minify .ui file to contain
    only needed widgets.
    
    Change-Id: I4796caae14bb63e3e04d318093209adfb87a77df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113623
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 5ac2212f211b..dca49bd79014 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -6106,7 +6106,7 @@ static void activateNotebookbar(const OUString& rApp)
 
     if (aAppNode.isValid())
     {
-        aAppNode.setNodeValue("Active", makeAny(OUString("notebookbar.ui")));
+        aAppNode.setNodeValue("Active", 
makeAny(OUString("notebookbar_online.ui")));
         aAppNode.commit();
     }
 }
diff --git a/include/vcl/WeldedTabbedNotebookbar.hxx 
b/include/vcl/WeldedTabbedNotebookbar.hxx
index 82996868cd2b..1a4f9eede4ec 100644
--- a/include/vcl/WeldedTabbedNotebookbar.hxx
+++ b/include/vcl/WeldedTabbedNotebookbar.hxx
@@ -15,14 +15,14 @@
 #include <vcl/weld.hxx>
 #include <com/sun/star/frame/XFrame.hpp>
 
-/** Tabbed implementation of NotebookBar for Writer
+/**
+ * Welded wrapper for NotebookBar used for online
 */
 class VCL_DLLPUBLIC WeldedTabbedNotebookbar
 {
     std::unique_ptr<weld::Builder> m_xBuilder;
 
     std::unique_ptr<weld::Container> m_xContainer;
-    std::unique_ptr<weld::Notebook> m_xNotebook;
 
 public:
     WeldedTabbedNotebookbar(VclPtr<vcl::Window>& pContainerWindow, const 
OUString& rUIFilePath,
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 7a568e1f48a8..338d4dd2ff4d 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -159,6 +159,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
        sc/uiconfig/scalc/ui/notebookbar_groups \
        sc/uiconfig/scalc/ui/notebookbar_groupedbar_full \
        sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact \
+       sc/uiconfig/scalc/ui/notebookbar_online \
        sc/uiconfig/scalc/ui/numberbox \
        sc/uiconfig/scalc/ui/managenamesdialog \
        sc/uiconfig/scalc/ui/mergecellsdialog \
diff --git a/sc/uiconfig/scalc/ui/notebookbar_online.ui 
b/sc/uiconfig/scalc/ui/notebookbar_online.ui
new file mode 100644
index 000000000000..85260fe7213d
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/notebookbar_online.ui
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.18"/>
+  <requires lib="LibreOffice" version="1.0"/>
+  <!-- interface-local-resource-path ../../../icon-themes/colibre/cmd/ -->
+  <object class="GtkGrid" id="NotebookBar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="font">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GtkToolButton" id="Home-CharFontName">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="action_name">.uno:CharFontName</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="fontheight">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="margin_left">5</property>
+            <child>
+              <object class="GtkToolButton" id="Home-FontHeight">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="action_name">.uno:FontHeight</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="SectionBottom127">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="toolbar_style">icons</property>
+            <property name="show_arrow">False</property>
+            <child>
+              <object class="GtkToolButton" id="Home-NumberFormatType">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="action_name">.uno:NumberFormatType</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/sd/UIConfig_sdraw.mk b/sd/UIConfig_sdraw.mk
index 247767eb6f26..3e3a181f94f5 100644
--- a/sd/UIConfig_sdraw.mk
+++ b/sd/UIConfig_sdraw.mk
@@ -117,6 +117,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/sdraw,\
        sd/uiconfig/sdraw/ui/notebookbar_single \
        sd/uiconfig/sdraw/ui/notebookbar_groupedbar_compact \
        sd/uiconfig/sdraw/ui/notebookbar_groupedbar_full \
+       sd/uiconfig/sdraw/ui/notebookbar_online \
        sd/uiconfig/sdraw/ui/paranumberingtab \
        sd/uiconfig/sdraw/ui/queryunlinkimagedialog \
        sd/uiconfig/sdraw/ui/vectorize \
diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index b5e62f9b67d8..01bfab017db2 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -136,6 +136,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\
        sd/uiconfig/simpress/ui/notebookbar_groups \
        sd/uiconfig/simpress/ui/notebookbar_groupedbar_full \
        sd/uiconfig/simpress/ui/notebookbar_groupedbar_compact \
+       sd/uiconfig/simpress/ui/notebookbar_online \
        sd/uiconfig/simpress/ui/optimpressgeneralpage \
        sd/uiconfig/simpress/ui/photoalbum \
        sd/uiconfig/simpress/ui/presentationdialog \
diff --git a/sd/uiconfig/sdraw/ui/notebookbar_online.ui 
b/sd/uiconfig/sdraw/ui/notebookbar_online.ui
new file mode 100644
index 000000000000..1151d7b502d0
--- /dev/null
+++ b/sd/uiconfig/sdraw/ui/notebookbar_online.ui
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.18"/>
+  <requires lib="LibreOffice" version="1.0"/>
+  <!-- interface-local-resource-path ../../../icon-themes/colibre/cmd/ -->
+  <object class="GtkGrid" id="NotebookBar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="font">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GtkToolButton" id="Home-CharFontName">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="action_name">.uno:CharFontName</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="fontheight">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="margin_left">5</property>
+            <child>
+              <object class="GtkToolButton" id="Home-FontHeight">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="action_name">.uno:FontHeight</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/sd/uiconfig/simpress/ui/notebookbar_online.ui 
b/sd/uiconfig/simpress/ui/notebookbar_online.ui
new file mode 100644
index 000000000000..1151d7b502d0
--- /dev/null
+++ b/sd/uiconfig/simpress/ui/notebookbar_online.ui
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.18"/>
+  <requires lib="LibreOffice" version="1.0"/>
+  <!-- interface-local-resource-path ../../../icon-themes/colibre/cmd/ -->
+  <object class="GtkGrid" id="NotebookBar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="font">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GtkToolButton" id="Home-CharFontName">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="action_name">.uno:CharFontName</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="fontheight">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="margin_left">5</property>
+            <child>
+              <object class="GtkToolButton" id="Home-FontHeight">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="action_name">.uno:FontHeight</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx 
b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 36346b22c21b..0fdb739cd3f0 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -295,6 +295,9 @@ bool SfxNotebookBar::IsActive()
 
     OUString aActive = comphelper::getString( aAppNode.getNodeValue( "Active" 
) );
 
+    if (comphelper::LibreOfficeKit::isActive() && aActive == 
"notebookbar_online.ui")
+        return true;
+
     const utl::OConfigurationNode aModesNode = aAppNode.openNode("Modes");
     const Sequence<OUString> aModeNodeNames( aModesNode.getNodeNames() );
 
@@ -360,6 +363,8 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
         OUString aModuleName = xModuleManager->identify( xFrame );
         vcl::EnumContext::Application eApp = 
vcl::EnumContext::GetApplicationEnum( aModuleName );
         OUString sFile = lcl_getNotebookbarFileName( eApp );
+        if (comphelper::LibreOfficeKit::isActive())
+            sFile = "notebookbar_online.ui";
         OUString sNewFile = rUIFile + sFile;
         OUString sCurrentFile;
         VclPtr<NotebookBar> pNotebookBar = pSysWindow->GetNotebookBar();
@@ -438,8 +443,10 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
     }
     else if (auto pNotebookBar = pSysWindow->GetNotebookBar())
     {
-        pNotebookBar->Hide();
-        pNotebookBar->GetParent()->Resize();
+        vcl::Window* pParent = pNotebookBar->GetParent();
+        RemoveListeners(pSysWindow);
+        pSysWindow->CloseNotebookBar();
+        pParent->Resize();
         SfxNotebookBar::ShowMenubar(true);
     }
 
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index ca9821c4c3f5..ba985f6a2e95 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -222,6 +222,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
        sw/uiconfig/swriter/ui/notebookbar_groups \
        sw/uiconfig/swriter/ui/notebookbar_groupedbar_full \
        sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact \
+       sw/uiconfig/swriter/ui/notebookbar_online \
        sw/uiconfig/swriter/ui/pagebreakmenu \
        sw/uiconfig/swriter/ui/pagecolumncontrol \
        sw/uiconfig/swriter/ui/pagemargincontrol \
diff --git a/sw/uiconfig/swriter/ui/notebookbar_online.ui 
b/sw/uiconfig/swriter/ui/notebookbar_online.ui
new file mode 100644
index 000000000000..3626086288dc
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/notebookbar_online.ui
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.18"/>
+  <requires lib="LibreOffice" version="1.0"/>
+  <!-- interface-local-resource-path ../../../icon-themes/colibre/cmd/ -->
+  <object class="GtkGrid" id="NotebookBar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="font">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GtkToolButton" id="Home-CharFontName">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="action_name">.uno:CharFontName</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="fontheight">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="margin_left">5</property>
+            <child>
+              <object class="GtkToolButton" id="Home-FontHeight">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="action_name">.uno:FontHeight</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="sfxlo-NotebookbarToolBox" id="SectionBottom127">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="toolbar_style">icons</property>
+            <property name="show_arrow">False</property>
+            <child>
+              <object class="GtkToolButton" id="Home-StylesPreview">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <property name="hexpand">True</property>
+                <property name="action_name">.uno:StylesPreview</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/vcl/source/control/WeldedTabbedNotebookbar.cxx 
b/vcl/source/control/WeldedTabbedNotebookbar.cxx
index ad9947241e32..9f3f0db181f5 100644
--- a/vcl/source/control/WeldedTabbedNotebookbar.cxx
+++ b/vcl/source/control/WeldedTabbedNotebookbar.cxx
@@ -18,8 +18,6 @@ WeldedTabbedNotebookbar::WeldedTabbedNotebookbar(
           pContainerWindow, VclBuilderContainer::getUIRootDir(), rUIFilePath, 
rFrame, nWindowId))
 {
     m_xContainer = m_xBuilder->weld_container("NotebookBar");
-    m_xNotebook = m_xBuilder->weld_notebook("ContextContainer");
-    m_xNotebook->set_current_page("HomeLabel");
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/notebookbar.cxx 
b/vcl/source/control/notebookbar.cxx
index 451c2c9a59f8..ea8a938977c0 100644
--- a/vcl/source/control/notebookbar.cxx
+++ b/vcl/source/control/notebookbar.cxx
@@ -68,11 +68,7 @@ NotebookBar::NotebookBar(Window* pParent, const OString& 
rID, const OUString& rU
     if ( doesCustomizedUIExist )
         sUIDir = getCustomizedUIRootDir();
 
-    bool bIsWelded = comphelper::LibreOfficeKit::isActive()
-                    && (rUIXMLDescription == 
"modules/swriter/ui/notebookbar.ui"
-                    || rUIXMLDescription == "modules/scalc/ui/notebookbar.ui"
-                    || rUIXMLDescription == 
"modules/simpress/ui/notebookbar.ui"
-                    || rUIXMLDescription == "modules/sdraw/ui/notebookbar.ui");
+    bool bIsWelded = comphelper::LibreOfficeKit::isActive();
     if (bIsWelded)
     {
         m_bIsWelded = true;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to