summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-04-06 07:08:30 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2021-04-19 08:37:31 +0200
commit9f06c54ca1819b6d4df48f33772cfa5ceb90dccd (patch)
treec568d358f3304a0d1c9830feb1d9aec11f20970c
parent075ae953e3e673dedcb74d693e516a07b0bebca2 (diff)
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 <jenkinscollaboraoffice@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114154 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r--desktop/source/lib/init.cxx2
-rw-r--r--include/vcl/WeldedTabbedNotebookbar.hxx4
-rw-r--r--sc/UIConfig_scalc.mk1
-rw-r--r--sc/uiconfig/scalc/ui/notebookbar_online.ui93
-rw-r--r--sd/UIConfig_sdraw.mk1
-rw-r--r--sd/UIConfig_simpress.mk1
-rw-r--r--sd/uiconfig/sdraw/ui/notebookbar_online.ui69
-rw-r--r--sd/uiconfig/simpress/ui/notebookbar_online.ui69
-rw-r--r--sfx2/source/notebookbar/SfxNotebookBar.cxx11
-rw-r--r--sw/UIConfig_swriter.mk2
-rw-r--r--sw/uiconfig/swriter/ui/notebookbar_online.ui95
-rw-r--r--vcl/source/control/WeldedTabbedNotebookbar.cxx2
-rw-r--r--vcl/source/control/notebookbar.cxx6
13 files changed, 343 insertions, 13 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index cd4b3da2d729..4b78a68d86d1 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -6098,7 +6098,7 @@ static void activateNotebookbar(std::u16string_view 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 59190425ecfe..073902f2d166 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(const VclPtr<vcl::Window>& pContainerWindow,
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 5d1121242788..3d11cfdbf18c 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..fe58b62ac0e0
--- /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.20"/>
+ <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_start">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 d757577a97cc..136f84fcd315 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_compact \
sd/uiconfig/sdraw/ui/notebookbar_single \
sd/uiconfig/sdraw/ui/notebookbar_groupedbar_compact \
+ 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 78339ddae976..cf618594f8ac 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -144,6 +144,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/pagesfieldbox \
sd/uiconfig/simpress/ui/photoalbum \
diff --git a/sd/uiconfig/sdraw/ui/notebookbar_online.ui b/sd/uiconfig/sdraw/ui/notebookbar_online.ui
new file mode 100644
index 000000000000..6847a80db253
--- /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.20"/>
+ <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_start">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..6847a80db253
--- /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.20"/>
+ <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_start">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 b5606721a2ff..fb90113f9f05 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -266,6 +266,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() );
@@ -331,6 +334,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();
@@ -409,8 +414,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 167fa92548e8..b0b94c9979ff 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -235,7 +235,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/pagecolumncontrol \
+ sw/uiconfig/swriter/ui/notebookbar_online \
sw/uiconfig/swriter/ui/pagemargincontrol \
sw/uiconfig/swriter/ui/pageorientationcontrol \
sw/uiconfig/swriter/ui/pagesizecontrol \
diff --git a/sw/uiconfig/swriter/ui/notebookbar_online.ui b/sw/uiconfig/swriter/ui/notebookbar_online.ui
new file mode 100644
index 000000000000..50f557bd2655
--- /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.20"/>
+ <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_start">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 eb40389733f7..1a3311de9f5b 100644
--- a/vcl/source/control/WeldedTabbedNotebookbar.cxx
+++ b/vcl/source/control/WeldedTabbedNotebookbar.cxx
@@ -18,8 +18,6 @@ WeldedTabbedNotebookbar::WeldedTabbedNotebookbar(
pContainerWindow, AllSettings::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 f7b58dfc3416..d27214bc9015 100644
--- a/vcl/source/control/notebookbar.cxx
+++ b/vcl/source/control/notebookbar.cxx
@@ -72,11 +72,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;