[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/inc vcl/jsdialog vcl/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 27 07:43:42 UTC 2021
include/vcl/svapp.hxx | 2 -
sfx2/source/sidebar/DeckLayouter.cxx | 6 ++++
sfx2/source/sidebar/Panel.cxx | 3 +-
sfx2/source/sidebar/PanelLayout.cxx | 3 +-
vcl/inc/jsdialog/enabled.hxx | 1
vcl/inc/jsdialog/jsdialogbuilder.hxx | 6 ++++
vcl/jsdialog/enabled.cxx | 44 ++++++++++++++++++++++++++++++++
vcl/jsdialog/jsdialogbuilder.cxx | 47 +++++++++++++++++++++++++++++++++++
vcl/source/window/builder.cxx | 16 +++++------
9 files changed, 117 insertions(+), 11 deletions(-)
New commits:
commit 457649d02f23446ed2d28433a5aedecf6a49aed7
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed May 12 09:18:25 2021 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jul 27 09:43:08 2021 +0200
jsdialog: sidebar: send sidebar Panels
Change-Id: Ia5a936c44e5d83fd4626098bcc027b0382523231
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116098
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119511
Tested-by: Jenkins
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index ab2af42dc41c..d6a6bfbc5065 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -1317,7 +1317,7 @@ public:
// For vclbootstrapprotector:
static void setDeInitHook(Link<LinkParamNone*,void> const & hook);
- static weld::Builder* CreateBuilder(weld::Widget* pParent, const OUString &rUIFile, bool bMobile = false);
+ static weld::Builder* CreateBuilder(weld::Widget* pParent, const OUString &rUIFile, bool bMobile = false, sal_uInt64 nLOKWindowId = 0);
// For the duration of vcl parent windows
static weld::Builder* CreateInterimBuilder(vcl::Window* pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId = 0);
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index c60549e5d65e..54f100cd71a8 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -25,6 +25,7 @@
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/SidebarDockingWindow.hxx>
#include <sfx2/sidebar/SidebarController.hxx>
+#include <sfx2/viewsh.hxx>
#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
@@ -35,6 +36,8 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/ui/XSidebarPanel.hpp>
+#include <vcl/jsdialog/executor.hxx>
+
using namespace css;
using namespace css::uno;
@@ -303,6 +306,9 @@ sal_Int32 PlacePanels (
}
}
+ if (comphelper::LibreOfficeKit::isActive())
+ jsdialog::SendFullUpdate(reinterpret_cast<sal_uInt64>(SfxViewShell::Current()), "Panel");
+
return nY;
}
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index 61b9370f8e26..789f6000a82b 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -24,6 +24,7 @@
#include <sfx2/sidebar/ResourceManager.hxx>
#include <sfx2/sidebar/SidebarController.hxx>
#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/viewsh.hxx>
#include <tools/json_writer.hxx>
@@ -50,7 +51,7 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor,
Deck* pDeck,
const std::function<Context()>& rContextAccess,
const css::uno::Reference<css::frame::XFrame>& rxFrame)
- : mxBuilder(Application::CreateBuilder(pParentWindow, "sfx/ui/panel.ui"))
+ : mxBuilder(Application::CreateBuilder(pParentWindow, "sfx/ui/panel.ui", false, reinterpret_cast<sal_uInt64>(SfxViewShell::Current())))
, msPanelId(rPanelDescriptor.msId)
, msTitle(rPanelDescriptor.msTitle)
, mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional)
diff --git a/sfx2/source/sidebar/PanelLayout.cxx b/sfx2/source/sidebar/PanelLayout.cxx
index 271f4d8a6c36..fb7e5a48c2a2 100644
--- a/sfx2/source/sidebar/PanelLayout.cxx
+++ b/sfx2/source/sidebar/PanelLayout.cxx
@@ -12,12 +12,13 @@
#include <sfx2/sidebar/PanelLayout.hxx>
#include <sfx2/sidebar/TabBar.hxx>
#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/viewsh.hxx>
#include <vcl/event.hxx>
using namespace sfx2::sidebar;
PanelLayout::PanelLayout(weld::Widget* pParent, const OString& rID, const OUString& rUIXMLDescription)
- : m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription))
+ : m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription, false, reinterpret_cast<sal_uInt64>(SfxViewShell::Current())))
, m_xContainer(m_xBuilder->weld_container(rID))
, m_pPanel(nullptr)
{
diff --git a/vcl/inc/jsdialog/enabled.hxx b/vcl/inc/jsdialog/enabled.hxx
index 86bba683b7e2..50586cf3bb13 100644
--- a/vcl/inc/jsdialog/enabled.hxx
+++ b/vcl/inc/jsdialog/enabled.hxx
@@ -14,6 +14,7 @@
namespace jsdialog
{
bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile);
+bool isBuilderEnabledForSidebar(std::u16string_view rUIFile);
bool isInterimBuilderEnabledForNotebookbar(std::u16string_view rUIFile);
}
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 450a11529507..254db3d1eeae 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -208,6 +208,9 @@ class JSInstanceBuilder final : public SalInstanceBuilder, public JSDialogSender
/// used for dialogs
JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile);
+ /// used for sidebar panels
+ JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile,
+ sal_uInt64 nLOKWindowId);
/// used for notebookbar, optional nWindowId is used if getting parent id failed
JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile,
const css::uno::Reference<css::frame::XFrame>& rFrame,
@@ -225,6 +228,9 @@ public:
static JSInstanceBuilder* CreateAutofilterWindowBuilder(vcl::Window* pParent,
const OUString& rUIRoot,
const OUString& rUIFile);
+ static JSInstanceBuilder* CreateSidebarBuilder(weld::Widget* pParent, const OUString& rUIRoot,
+ const OUString& rUIFile,
+ sal_uInt64 nLOKWindowId = 0);
virtual ~JSInstanceBuilder() override;
virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OString& id) override;
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 928b205d4020..7160b8bcc38d 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -58,6 +58,50 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile)
return false;
}
+bool isBuilderEnabledForSidebar(std::u16string_view rUIFile)
+{
+ if (rUIFile == u"sfx/ui/panel.ui" || rUIFile == u"svx/ui/sidebartextpanel.ui"
+ || rUIFile == u"svx/ui/sidebarstylespanel.ui" || rUIFile == u"svx/ui/sidebarparagraph.ui"
+ || rUIFile == u"svx/ui/sidebarlists.ui" || rUIFile == u"svx/ui/sidebararea.ui"
+ || rUIFile == u"svx/ui/sidebarfontwork.ui" || rUIFile == u"svx/ui/sidebarshadow.ui"
+ || rUIFile == u"svx/ui/sidebareffect.ui" || rUIFile == u"svx/ui/sidebargraphic.ui"
+ || rUIFile == u"svx/ui/sidebarline.ui" || rUIFile == u"svx/ui/sidebarpossize.ui"
+ || rUIFile == u"svx/ui/defaultshapespanel.ui" || rUIFile == u"svx/ui/mediaplayback.ui"
+ || rUIFile == u"svx/ui/sidebargallery.ui" || rUIFile == u"sfx/ui/templatepanel.ui"
+ || rUIFile == u"svx/ui/sidebarempty.ui"
+ || rUIFile == u"modules/schart/ui/sidebarelements.ui"
+ || rUIFile == u"modules/schart/ui/sidebartype.ui"
+ || rUIFile == u"modules/schart/ui/sidebarseries.ui"
+ || rUIFile == u"modules/schart/ui/sidebaraxis.ui"
+ || rUIFile == u"modules/schart/ui/sidebarerrorbar.ui"
+ || rUIFile == u"modules/simpress/ui/customanimationspanel.ui"
+ || rUIFile == u"modules/simpress/ui/layoutpanel.ui"
+ || rUIFile == u"modules/simpress/ui/masterpagepanel.ui"
+ || rUIFile == u"modules/simpress/ui/slidetransitionspanel.ui"
+ || rUIFile == u"modules/simpress/ui/tabledesignpanel.ui"
+ || rUIFile == u"modules/simpress/ui/navigatorpanel.ui"
+ || rUIFile == u"modules/simpress/ui/sidebarslidebackground.ui"
+ || rUIFile == u"modules/scalc/ui/sidebaralignment.ui"
+ || rUIFile == u"modules/scalc/ui/sidebarcellappearance.ui"
+ || rUIFile == u"modules/scalc/ui/sidebarnumberformat.ui"
+ || rUIFile == u"modules/scalc/ui/navigatorpanel.ui"
+ || rUIFile == u"modules/scalc/ui/functionpanel.ui"
+ || rUIFile == u"modules/swriter/ui/pagestylespanel.ui"
+ || rUIFile == u"modules/swriter/ui/pageformatpanel.ui"
+ || rUIFile == u"modules/swriter/ui/pageheaderpanel.ui"
+ || rUIFile == u"modules/swriter/ui/pagefooterpanel.ui"
+ || rUIFile == u"modules/swriter/ui/sidebarwrap.ui"
+ || rUIFile == u"modules/swriter/ui/navigatorpanel.ui"
+ || rUIFile == u"modules/swriter/ui/managechangessidebar.ui"
+ || rUIFile == u"svx/ui/inspectortextpanel.ui"
+ || rUIFile == u"modules/swriter/ui/sidebarstylepresets.ui"
+ || rUIFile == u"modules/swriter/ui/sidebartheme.ui"
+ || rUIFile == u"modules/swriter/ui/sidebartableedit.ui")
+ return true;
+
+ return false;
+}
+
bool isInterimBuilderEnabledForNotebookbar(std::u16string_view rUIFile)
{
if (rUIFile == u"svx/ui/stylespreview.ui" || rUIFile == u"modules/scalc/ui/numberbox.ui")
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 5a57e63dfbce..c8aa2d1d6d6c 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -164,6 +164,9 @@ JSDialogNotifyIdle::generateWidgetUpdate(VclPtr<vcl::Window> pWindow) const
{
std::unique_ptr<tools::JsonWriter> aJsonWriter(new tools::JsonWriter());
+ if (!pWindow || !m_aNotifierWindow)
+ return aJsonWriter;
+
aJsonWriter->put("jsontype", m_sTypeOfJSON);
aJsonWriter->put("action", "update");
aJsonWriter->put("id", m_aNotifierWindow->GetLOKWindowId());
@@ -391,6 +394,7 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR
, m_bIsNotebookbar(false)
{
vcl::Window* pRoot = m_xBuilder->get_widget_root();
+
if (pRoot && pRoot->GetParent())
{
m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier();
@@ -402,6 +406,41 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR
initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
}
+// used for sidebar panels
+JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot,
+ const OUString& rUIFile, sal_uInt64 nLOKWindowId)
+ : SalInstanceBuilder(extract_sal_widget(pParent), rUIRoot, rUIFile)
+ , m_nWindowId(nLOKWindowId)
+ , m_aParentDialog(nullptr)
+ , m_aContentWindow(nullptr)
+ , m_sTypeOfJSON("sidebar")
+ , m_bHasTopLevelDialog(false)
+ , m_bIsNotebookbar(false)
+{
+ vcl::Window* pRoot = m_xBuilder->get_widget_root();
+
+ m_aParentDialog = pRoot->GetParentWithLOKNotifier();
+
+ if (rUIFile == "sfx/ui/panel.ui")
+ {
+ // builder for Panel, get SidebarDockingWindow as m_aContentWindow
+ m_aContentWindow = pRoot;
+ for (int i = 0; i < 7 && m_aContentWindow; i++)
+ m_aContentWindow = m_aContentWindow->GetParent();
+ }
+ else
+ {
+ // builder for PanelLayout, get SidebarDockingWindow as m_aContentWindow
+ m_aContentWindow = pRoot;
+ for (int i = 0; i < 9 && m_aContentWindow; i++)
+ m_aContentWindow = m_aContentWindow->GetParent();
+ }
+
+ InsertWindowToMap(m_nWindowId);
+
+ initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
+}
+
// used for notebookbar
JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot,
const OUString& rUIFile,
@@ -477,6 +516,14 @@ JSInstanceBuilder* JSInstanceBuilder::CreateAutofilterWindowBuilder(vcl::Window*
return new JSInstanceBuilder(pParent, rUIRoot, rUIFile);
}
+JSInstanceBuilder* JSInstanceBuilder::CreateSidebarBuilder(weld::Widget* pParent,
+ const OUString& rUIRoot,
+ const OUString& rUIFile,
+ sal_uInt64 nLOKWindowId)
+{
+ return new JSInstanceBuilder(pParent, rUIRoot, rUIFile, nLOKWindowId);
+}
+
JSInstanceBuilder::~JSInstanceBuilder()
{
if (m_nWindowId && (m_bHasTopLevelDialog || m_bIsNotebookbar))
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index d4ec1925d110..5b20c550eab9 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -178,17 +178,17 @@ namespace
}
-weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString &rUIFile, bool bMobile)
+weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString &rUIFile, bool bMobile, sal_uInt64 nLOKWindowId)
{
- bool bUseJSBuilder = false;
-
if (comphelper::LibreOfficeKit::isActive())
- bUseJSBuilder = jsdialog::isBuilderEnabled(rUIFile, bMobile);
+ {
+ if (jsdialog::isBuilderEnabledForSidebar(rUIFile))
+ return JSInstanceBuilder::CreateSidebarBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile, nLOKWindowId);
+ if (jsdialog::isBuilderEnabled(rUIFile, bMobile))
+ return JSInstanceBuilder::CreateDialogBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile);
+ }
- if (bUseJSBuilder)
- return JSInstanceBuilder::CreateDialogBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile);
- else
- return ImplGetSVData()->mpDefInst->CreateBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile);
+ return ImplGetSVData()->mpDefInst->CreateBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile);
}
weld::Builder* Application::CreateInterimBuilder(vcl::Window* pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId)
More information about the Libreoffice-commits
mailing list