diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-05-12 09:18:25 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-07-27 09:43:08 +0200 |
commit | 457649d02f23446ed2d28433a5aedecf6a49aed7 (patch) | |
tree | ecd027e9b395de18aabaa7a8ceafc2938c117d41 /vcl | |
parent | b17180a84cb4561b8a7bbf9e2281c91fffd56f87 (diff) |
jsdialog: sidebar: send sidebar Panels
Change-Id: Ia5a936c44e5d83fd4626098bcc027b0382523231
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116098
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119511
Tested-by: Jenkins
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/jsdialog/enabled.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 6 | ||||
-rw-r--r-- | vcl/jsdialog/enabled.cxx | 44 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 47 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 16 |
5 files changed, 106 insertions, 8 deletions
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) |