summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-05-12 08:53:16 +0200
committerAndras Timar <andras.timar@collabora.com>2021-07-04 17:30:10 +0200
commit5c53392470c6817473724b02d50a89c10169f100 (patch)
treef0eb3b575e5925b1337633df0edfc9f9cf2adf97
parent0c89088b3974ae5c2e0853a2d9971f2fc00d1d5c (diff)
jsdialog: move list of enabled dialogs to separate file
Change-Id: I98c92b336fbf76f3dc94265a408c9b3b46fcea08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115453 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--vcl/Library_vcl.mk1
-rw-r--r--vcl/inc/jsdialog/enabled.hxx20
-rw-r--r--vcl/jsdialog/enabled.cxx72
-rw-r--r--vcl/source/window/builder.cxx53
4 files changed, 97 insertions, 49 deletions
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 15a083df19a6..082cc64dcef4 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -473,6 +473,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/backendtest/outputdevice/polyline \
vcl/backendtest/outputdevice/polyline_b2d \
vcl/backendtest/outputdevice/rectangle \
+ vcl/jsdialog/enabled \
vcl/jsdialog/jsdialogbuilder \
vcl/jsdialog/executor \
))
diff --git a/vcl/inc/jsdialog/enabled.hxx b/vcl/inc/jsdialog/enabled.hxx
new file mode 100644
index 000000000000..34116b41c009
--- /dev/null
+++ b/vcl/inc/jsdialog/enabled.hxx
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+
+namespace jsdialog
+{
+bool isBuilderEnabled(const OUString& rUIFile, bool bMobile);
+bool isInterimBuilderEnabledForNotebookbar(const OUString& rUIFile);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
new file mode 100644
index 000000000000..a82f75ea6e30
--- /dev/null
+++ b/vcl/jsdialog/enabled.cxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <jsdialog/enabled.hxx>
+
+namespace jsdialog
+{
+bool isBuilderEnabled(const OUString& rUIFile, bool bMobile)
+{
+ if (bMobile)
+ {
+ if (rUIFile == "modules/swriter/ui/wordcount-mobile.ui"
+ || rUIFile == "svx/ui/findreplacedialog-mobile.ui"
+ || rUIFile == "modules/swriter/ui/watermarkdialog.ui"
+ || rUIFile == "modules/scalc/ui/validationdialog.ui"
+ || rUIFile == "modules/scalc/ui/validationcriteriapage.ui"
+ || rUIFile == "modules/scalc/ui/validationhelptabpage-mobile.ui"
+ || rUIFile == "modules/scalc/ui/erroralerttabpage-mobile.ui"
+ || rUIFile == "modules/scalc/ui/validationdialog.ui")
+ {
+ return true;
+ }
+ }
+
+ if (rUIFile == "modules/scalc/ui/pivottablelayoutdialog.ui"
+ || rUIFile == "modules/scalc/ui/selectsource.ui"
+ || rUIFile == "modules/scalc/ui/managenamesdialog.ui"
+ || rUIFile == "modules/scalc/ui/definename.ui"
+ || rUIFile == "modules/scalc/ui/correlationdialog.ui"
+ || rUIFile == "modules/scalc/ui/samplingdialog.ui"
+ || rUIFile == "modules/scalc/ui/descriptivestatisticsdialog.ui"
+ || rUIFile == "modules/scalc/ui/analysisofvariancedialog.ui"
+ || rUIFile == "modules/scalc/ui/covariancedialog.ui"
+ || rUIFile == "modules/scalc/ui/exponentialsmoothingdialog.ui"
+ || rUIFile == "modules/scalc/ui/movingaveragedialog.ui"
+ || rUIFile == "modules/scalc/ui/regressiondialog.ui"
+ || rUIFile == "modules/scalc/ui/ttestdialog.ui"
+ || rUIFile == "modules/scalc/ui/ttestdialog.ui"
+ || rUIFile == "modules/scalc/ui/ztestdialog.ui"
+ || rUIFile == "modules/scalc/ui/chisquaretestdialog.ui"
+ || rUIFile == "modules/scalc/ui/fourieranalysisdialog.ui"
+ || rUIFile == "modules/scalc/ui/datafielddialog.ui"
+ || rUIFile == "modules/scalc/ui/pivotfielddialog.ui"
+ || rUIFile == "modules/scalc/ui/datafieldoptionsdialog.ui"
+ || rUIFile == "svx/ui/fontworkgallerydialog.ui"
+ || rUIFile == "cui/ui/macroselectordialog.ui" || rUIFile == "uui/ui/macrowarnmedium.ui"
+ || rUIFile == "modules/scalc/ui/textimportcsv.ui")
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool isInterimBuilderEnabledForNotebookbar(const OUString& rUIFile)
+{
+ if (rUIFile == "svx/ui/stylespreview.ui" || rUIFile == "modules/scalc/ui/numberbox.ui")
+ {
+ return true;
+ }
+
+ return false;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 901725d94859..8bd423b77cbc 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -15,6 +15,7 @@
#include <comphelper/lok.hxx>
#include <i18nutil/unicode.hxx>
+#include <jsdialog/enabled.hxx>
#include <officecfg/Office/Common.hxx>
#include <osl/module.hxx>
#include <sal/log.hxx>
@@ -154,50 +155,7 @@ weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString
bool bUseJSBuilder = false;
if (comphelper::LibreOfficeKit::isActive())
- {
- if (bMobile)
- {
- if (rUIFile == "modules/swriter/ui/wordcount-mobile.ui" ||
- rUIFile == "svx/ui/findreplacedialog-mobile.ui" ||
- rUIFile == "modules/swriter/ui/watermarkdialog.ui" ||
- rUIFile == "modules/scalc/ui/validationdialog.ui" ||
- rUIFile == "modules/scalc/ui/validationcriteriapage.ui" ||
- rUIFile == "modules/scalc/ui/validationhelptabpage-mobile.ui" ||
- rUIFile == "modules/scalc/ui/erroralerttabpage-mobile.ui" ||
- rUIFile == "modules/scalc/ui/validationdialog.ui")
- {
- bUseJSBuilder = true;
- }
- }
-
- if (rUIFile == "modules/scalc/ui/pivottablelayoutdialog.ui"
- || rUIFile == "modules/scalc/ui/selectsource.ui"
- || rUIFile == "modules/scalc/ui/managenamesdialog.ui"
- || rUIFile == "modules/scalc/ui/definename.ui"
- || rUIFile == "modules/scalc/ui/correlationdialog.ui"
- || rUIFile == "modules/scalc/ui/samplingdialog.ui"
- || rUIFile == "modules/scalc/ui/descriptivestatisticsdialog.ui"
- || rUIFile == "modules/scalc/ui/analysisofvariancedialog.ui"
- || rUIFile == "modules/scalc/ui/covariancedialog.ui"
- || rUIFile == "modules/scalc/ui/exponentialsmoothingdialog.ui"
- || rUIFile == "modules/scalc/ui/movingaveragedialog.ui"
- || rUIFile == "modules/scalc/ui/regressiondialog.ui"
- || rUIFile == "modules/scalc/ui/ttestdialog.ui"
- || rUIFile == "modules/scalc/ui/ttestdialog.ui"
- || rUIFile == "modules/scalc/ui/ztestdialog.ui"
- || rUIFile == "modules/scalc/ui/chisquaretestdialog.ui"
- || rUIFile == "modules/scalc/ui/fourieranalysisdialog.ui"
- || rUIFile == "modules/scalc/ui/datafielddialog.ui"
- || rUIFile == "modules/scalc/ui/pivotfielddialog.ui"
- || rUIFile == "modules/scalc/ui/datafieldoptionsdialog.ui"
- || rUIFile == "svx/ui/fontworkgallerydialog.ui"
- || rUIFile == "cui/ui/macroselectordialog.ui"
- || rUIFile == "uui/ui/macrowarnmedium.ui"
- || rUIFile == "modules/scalc/ui/textimportcsv.ui")
- {
- bUseJSBuilder = true;
- }
- }
+ bUseJSBuilder = jsdialog::isBuilderEnabled(rUIFile, bMobile);
if (bUseJSBuilder)
return JSInstanceBuilder::CreateDialogBuilder(pParent, VclBuilderContainer::getUIRootDir(), rUIFile);
@@ -208,14 +166,11 @@ weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString
weld::Builder* Application::CreateInterimBuilder(vcl::Window* pParent, const OUString &rUIFile, sal_uInt64 nLOKWindowId)
{
// Notebookbar sub controls
- if (comphelper::LibreOfficeKit::isActive()
- && (rUIFile == "svx/ui/stylespreview.ui"
- || rUIFile == "modules/scalc/ui/numberbox.ui"))
+ if (comphelper::LibreOfficeKit::isActive() && jsdialog::isInterimBuilderEnabledForNotebookbar(rUIFile))
{
return JSInstanceBuilder::CreateNotebookbarBuilder(pParent, VclBuilderContainer::getUIRootDir(), rUIFile, css::uno::Reference<css::frame::XFrame>(), nLOKWindowId);
}
- else if (comphelper::LibreOfficeKit::isActive()
- && (rUIFile == "modules/scalc/ui/filterdropdown.ui"))
+ else if (comphelper::LibreOfficeKit::isActive() && (rUIFile == "modules/scalc/ui/filterdropdown.ui"))
{
return JSInstanceBuilder::CreateAutofilterWindowBuilder(pParent, VclBuilderContainer::getUIRootDir(), rUIFile);
}