[Libreoffice-commits] core.git: desktop/source include/vcl vcl/inc vcl/jsdialog vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 23 10:50:38 UTC 2020


 desktop/source/lib/init.cxx          |    6 ++----
 include/vcl/jsdialog/builder.hxx     |   21 +++++++++++++++++++++
 vcl/inc/jsdialog/jsdialogbuilder.hxx |   26 +++++++++++++-------------
 vcl/jsdialog/jsdialogbuilder.cxx     |   12 +++++++-----
 vcl/source/window/builder.cxx        |    2 +-
 5 files changed, 44 insertions(+), 23 deletions(-)

New commits:
commit 5bbd8aecad3d2cc97c075490ef27aecc9180ef99
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Jun 20 16:01:07 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jun 23 12:50:00 2020 +0200

    most of jsdialogbuilder is not used outside vcl
    
    so split it into the bit that is needed and just include that.
    
    add missing license headers
    
    Change-Id: I875f91176e6881e830fee6a58368d0b28ce9a0f7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96774
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 717e9d6a9d49..4623812f1853 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -148,9 +148,7 @@
 #include <vcl/abstdlg.hxx>
 #include <tools/diagnose_ex.h>
 #include <vcl/uitest/uiobject.hxx>
-#define VCL_INTERNALS 1
-#include <vcl/jsdialog/jsdialogbuilder.hxx>
-#undef VCL_INTERNALS
+#include <vcl/jsdialog/builder.hxx>
 
 // Needed for getUndoManager()
 #include <com/sun/star/document/XUndoManager.hpp>
@@ -3617,7 +3615,7 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin
         try
         {
             OString sControlId = OUStringToOString(aMap["id"], RTL_TEXTENCODING_ASCII_US);
-            weld::Widget* pWidget = JSInstanceBuilder::FindWeldWidgetsMap(nWindowId, sControlId);
+            weld::Widget* pWidget = jsdialog::FindWeldWidgetsMap(nWindowId, sControlId);
 
             bIsWeldedDialog = pWidget != nullptr;
             bool bContinueWithLOKWindow = false;
diff --git a/include/vcl/jsdialog/builder.hxx b/include/vcl/jsdialog/builder.hxx
new file mode 100644
index 000000000000..ac4c8925cb87
--- /dev/null
+++ b/include/vcl/jsdialog/builder.hxx
@@ -0,0 +1,21 @@
+/* -*- 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 <vcl/dllapi.h>
+#include <vcl/IDialogRenderable.hxx>
+#include <vcl/weld.hxx>
+
+namespace jsdialog
+{
+VCL_DLLPUBLIC weld::Widget* FindWeldWidgetsMap(vcl::LOKWindowId nWindowId, const OString& rWidget);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
similarity index 89%
rename from include/vcl/jsdialog/jsdialogbuilder.hxx
rename to vcl/inc/jsdialog/jsdialogbuilder.hxx
index 62f6d11a2d7a..5c7f5879af27 100644
--- a/include/vcl/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -7,9 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_VCL_INC_JSDIALOG_JSDIALOG_HXX
-#define INCLUDED_VCL_INC_JSDIALOG_JSDIALOG_HXX
+#pragma once
 
+#include <vcl/jsdialog/builder.hxx>
 #include <vcl/weld.hxx>
 #include <comphelper/string.hxx>
 #include <vcl/sysdata.hxx>
@@ -46,13 +46,16 @@ public:
     void notifyDialogState();
 };
 
-class VCL_DLLPUBLIC JSInstanceBuilder : public SalInstanceBuilder
+class JSInstanceBuilder : public SalInstanceBuilder
 {
     vcl::LOKWindowId m_nWindowId;
     /// used in case of tab pages where dialog is not a direct top level
     VclPtr<vcl::Window> m_aParentDialog;
     bool m_bHasTopLevelDialog;
 
+    friend VCL_DLLPUBLIC weld::Widget* jsdialog::FindWeldWidgetsMap(vcl::LOKWindowId nWindowId,
+                                                                    const OString& rWidget);
+
     static std::map<vcl::LOKWindowId, WidgetMap>& GetLOKWeldWidgetsMap();
     static void InsertWindowToMap(int nWindowId);
     void RememberWidget(const OString& id, weld::Widget* pWidget);
@@ -81,11 +84,10 @@ public:
                                                     VclMessageType eMessageType,
                                                     VclButtonsType eButtonType,
                                                     const OUString& rPrimaryMessage);
-    static weld::Widget* FindWeldWidgetsMap(vcl::LOKWindowId nWindowId, const OString& rWidget);
 };
 
 template <class BaseInstanceClass, class VclClass>
-class VCL_DLLPUBLIC JSWidget : public BaseInstanceClass, public JSDialogSender
+class JSWidget : public BaseInstanceClass, public JSDialogSender
 {
 public:
     JSWidget(VclPtr<vcl::Window> aOwnedToplevel, VclClass* pObject, SalInstanceBuilder* pBuilder,
@@ -114,7 +116,7 @@ public:
     }
 };
 
-class VCL_DLLPUBLIC JSLabel : public JSWidget<SalInstanceLabel, FixedText>
+class JSLabel : public JSWidget<SalInstanceLabel, FixedText>
 {
 public:
     JSLabel(VclPtr<vcl::Window> aOwnedToplevel, FixedText* pLabel, SalInstanceBuilder* pBuilder,
@@ -122,14 +124,14 @@ public:
     virtual void set_label(const OUString& rText) override;
 };
 
-class VCL_DLLPUBLIC JSButton : public JSWidget<SalInstanceButton, ::Button>
+class JSButton : public JSWidget<SalInstanceButton, ::Button>
 {
 public:
     JSButton(VclPtr<vcl::Window> aOwnedToplevel, ::Button* pButton, SalInstanceBuilder* pBuilder,
              bool bTakeOwnership);
 };
 
-class VCL_DLLPUBLIC JSEntry : public JSWidget<SalInstanceEntry, ::Edit>
+class JSEntry : public JSWidget<SalInstanceEntry, ::Edit>
 {
 public:
     JSEntry(VclPtr<vcl::Window> aOwnedToplevel, ::Edit* pEntry, SalInstanceBuilder* pBuilder,
@@ -137,7 +139,7 @@ public:
     virtual void set_text(const OUString& rText) override;
 };
 
-class VCL_DLLPUBLIC JSListBox : public JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>
+class JSListBox : public JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>
 {
 public:
     JSListBox(VclPtr<vcl::Window> aOwnedToplevel, ::ListBox* pListBox, SalInstanceBuilder* pBuilder,
@@ -148,7 +150,7 @@ public:
     virtual void set_active(int pos) override;
 };
 
-class VCL_DLLPUBLIC JSComboBox : public JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>
+class JSComboBox : public JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>
 {
 public:
     JSComboBox(VclPtr<vcl::Window> aOwnedToplevel, ::ComboBox* pComboBox,
@@ -160,7 +162,7 @@ public:
     virtual void set_active(int pos) override;
 };
 
-class VCL_DLLPUBLIC JSNotebook : public JSWidget<SalInstanceNotebook, ::TabControl>
+class JSNotebook : public JSWidget<SalInstanceNotebook, ::TabControl>
 {
 public:
     JSNotebook(VclPtr<vcl::Window> aOwnedToplevel, ::TabControl* pControl,
@@ -203,6 +205,4 @@ public:
     virtual void set_active(bool active) override;
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index d7f35b7d6039..fa7f25d33c00 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -7,7 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <vcl/jsdialog/jsdialogbuilder.hxx>
+#include <jsdialog/jsdialogbuilder.hxx>
 #include <sal/log.hxx>
 #include <boost/property_tree/json_parser.hpp>
 #include <comphelper/lok.hxx>
@@ -88,12 +88,13 @@ std::map<vcl::LOKWindowId, WidgetMap>& JSInstanceBuilder::GetLOKWeldWidgetsMap()
     return s_aLOKWeldBuildersMap;
 }
 
-weld::Widget* JSInstanceBuilder::FindWeldWidgetsMap(vcl::LOKWindowId nWindowId,
-                                                    const OString& rWidget)
+namespace jsdialog
 {
-    const auto it = GetLOKWeldWidgetsMap().find(nWindowId);
+weld::Widget* FindWeldWidgetsMap(vcl::LOKWindowId nWindowId, const OString& rWidget)
+{
+    const auto it = JSInstanceBuilder::GetLOKWeldWidgetsMap().find(nWindowId);
 
-    if (it != GetLOKWeldWidgetsMap().end())
+    if (it != JSInstanceBuilder::GetLOKWeldWidgetsMap().end())
     {
         auto widgetIt = it->second.find(rWidget);
         if (widgetIt != it->second.end())
@@ -102,6 +103,7 @@ weld::Widget* JSInstanceBuilder::FindWeldWidgetsMap(vcl::LOKWindowId nWindowId,
 
     return nullptr;
 }
+}
 
 void JSInstanceBuilder::InsertWindowToMap(int nWindowId)
 {
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index cbb41e48056b..328c8ca024f0 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -68,7 +68,7 @@
 #include <tools/diagnose_ex.h>
 #include <wizdlg.hxx>
 #include <tools/svlibrary.h>
-#include <vcl/jsdialog/jsdialogbuilder.hxx>
+#include <jsdialog/jsdialogbuilder.hxx>
 
 #if defined(DISABLE_DYNLOADING) || defined(LINUX)
 #include <dlfcn.h>


More information about the Libreoffice-commits mailing list