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@collabora.com>
This commit is contained in:
Caolán McNamara
2020-06-23 12:50:00 +02:00
parent 9d5e36c216
commit 5bbd8aecad
5 changed files with 44 additions and 23 deletions
+2 -4
View File
@@ -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;
+21
View File
@@ -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: */
@@ -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: */
+7 -5
View File
@@ -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)
{
+1 -1
View File
@@ -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>