2020-05-21 09:24:31 +02:00
|
|
|
/* -*- 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/.
|
|
|
|
*/
|
|
|
|
|
2020-06-20 16:01:07 +01:00
|
|
|
#include <jsdialog/jsdialogbuilder.hxx>
|
2020-02-18 15:41:56 +01:00
|
|
|
#include <sal/log.hxx>
|
|
|
|
#include <comphelper/lok.hxx>
|
Missing include
Building on Windows with PCH disabled:
[CXX] vcl/jsdialog/jsdialogbuilder.cxx
C:\lo\src\core\include\rtl/ref.hxx(113): error C2027: use of undefined type 'TabPage'
C:\lo\src\core\include\vcl/tabctrl.hxx(33): note: see declaration of 'TabPage'
C:\lo\src\core\include\rtl/ref.hxx(111): note: while compiling class template member function 'rtl::Reference<reference_type>::~Reference(void)'
with
[
reference_type=TabPage
]
C:/lo/src/core/vcl/jsdialog/jsdialogbuilder.cxx(207): note: see reference to function template instantiation 'rtl::Reference<reference_type>::~Reference(void)'
being compiled
with
[
reference_type=TabPage
]
C:\lo\src\core\include\vcl/vclptr.hxx(64): note: see reference to class template instantiation 'rtl::Reference<reference_type>' being compiled
with
[
reference_type=TabPage
]
C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\Include\utility(289): note: see reference to class template instantiation 'VclPtr<TabPage>' being co
mpiled
C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\Include\utility(290): note: see reference to class template instantiation 'std::pair<VclPtr<TabPage>
,VclPtr<VclGrid>>' being compiled
C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\Include\xtree(330): note: see reference to class template instantiation 'std::pair<const rtl::OStrin
g,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>' being compiled
C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\Include\xtree(752): note: see reference to class template instantiation 'std::_Tree_node<std::pair<c
onst rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>,std::_Default_allocator_traits<_Alloc>::void_pointer>' being compiled
with
[
_Alloc=std::allocator<std::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>>
]
C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\Include\xtree(1189): note: see reference to function template instantiation 'void std::_Tree_val<std
::_Tree_simple_types<std::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>>>::_Erase_head<std::allocator<std::_Tree_node<std::pair<const rtl:
:OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>,std::_Default_allocator_traits<_Alloc>::void_pointer>>>(_Alnode &) noexcept' being compiled
with
[
_Alloc=std::allocator<std::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>>,
_Alnode=std::allocator<std::_Tree_node<std::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>,std::_Default_allocator_traits<std::allocator<st
d::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>>>::void_pointer>>
]
C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\Include\xtree(1189): note: see reference to function template instantiation 'void std::_Tree_val<std
::_Tree_simple_types<std::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>>>::_Erase_head<std::allocator<std::_Tree_node<std::pair<const rtl:
:OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>,std::_Default_allocator_traits<_Alloc>::void_pointer>>>(_Alnode &) noexcept' being compiled
with
[
_Alloc=std::allocator<std::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>>,
_Alnode=std::allocator<std::_Tree_node<std::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>,std::_Default_allocator_traits<std::allocator<st
d::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>>>::void_pointer>>
]
C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\Include\xtree(1187): note: while compiling class template member function 'std::_Tree<std::_Tmap_tra
its<_Kty,_Ty,_Pr,_Alloc,false>>::~_Tree(void) noexcept'
with
[
_Kty=rtl::OString,
_Ty=std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>,
_Pr=std::less<rtl::OString>,
_Alloc=std::allocator<std::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>>
]
C:\lo\src\core\vcl\inc\jsdialog/jsdialogbuilder.hxx(131): note: see reference to function template instantiation 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_All
oc,false>>::~_Tree(void) noexcept' being compiled
with
[
_Kty=rtl::OString,
_Ty=std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>,
_Pr=std::less<rtl::OString>,
_Alloc=std::allocator<std::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>>
]
C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\Include\map(75): note: see reference to class template instantiation 'std::_Tree<std::_Tmap_traits<_
Kty,_Ty,_Pr,_Alloc,false>>' being compiled
with
[
_Kty=rtl::OString,
_Ty=std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>,
_Pr=std::less<rtl::OString>,
_Alloc=std::allocator<std::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>>
]
C:\lo\src\core\vcl\inc\salvtables.hxx(1032): note: see reference to class template instantiation 'std::map<rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid
>>,std::less<rtl::OString>,std::allocator<std::pair<const rtl::OString,std::pair<VclPtr<TabPage>,VclPtr<VclGrid>>>>>' being compiled
make[1]: *** [C:/lo/src/core/solenv/gbuild/LinkTarget.mk:303: C:/lo/src/build/workdir/CxxObject/vcl/jsdialog/jsdialogbuilder.o] Error 2
Change-Id: Id67ce45b1652a2915508963adb65e1e1f5c51dcd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94464
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-05-20 23:41:38 +02:00
|
|
|
#include <vcl/tabpage.hxx>
|
2020-07-12 17:22:54 +01:00
|
|
|
#include <vcl/toolkit/button.hxx>
|
2020-02-18 15:41:56 +01:00
|
|
|
#include <vcl/toolkit/dialog.hxx>
|
|
|
|
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
|
2020-03-05 12:24:27 +01:00
|
|
|
#include <vcl/toolkit/combobox.hxx>
|
2020-03-17 14:50:39 +01:00
|
|
|
#include <messagedialog.hxx>
|
2020-06-22 16:45:03 +02:00
|
|
|
#include <tools/json_writer.hxx>
|
|
|
|
#include <o3tl/deleter.hxx>
|
|
|
|
#include <memory>
|
2020-06-16 14:07:32 +02:00
|
|
|
#include <vcl/toolbox.hxx>
|
2020-08-18 15:55:27 +01:00
|
|
|
#include <vcl/toolkit/vclmedit.hxx>
|
2020-07-01 21:24:37 +02:00
|
|
|
#include <boost/property_tree/json_parser.hpp>
|
2020-10-30 10:51:08 +01:00
|
|
|
#include <vcl/toolkit/treelistentry.hxx>
|
|
|
|
#include <vcl/jsdialog/executor.hxx>
|
2020-11-18 10:12:38 +01:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2021-01-13 13:16:30 +01:00
|
|
|
#include <utility>
|
2020-02-18 15:41:56 +01:00
|
|
|
|
2021-02-08 16:58:44 +01:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
void response_help(vcl::Window* pWindow)
|
|
|
|
{
|
|
|
|
::Dialog* pDialog = dynamic_cast<::Dialog*>(pWindow);
|
|
|
|
if (!pDialog)
|
|
|
|
return;
|
|
|
|
|
|
|
|
vcl::Window* pButtonWindow = pDialog->get_widget_for_response(RET_HELP);
|
|
|
|
::Button* pButton = dynamic_cast<::Button*>(pButtonWindow);
|
|
|
|
if (!pButton)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pButton->Click();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-21 15:45:19 +02:00
|
|
|
JSDialogNotifyIdle::JSDialogNotifyIdle(VclPtr<vcl::Window> aNotifierWindow,
|
|
|
|
VclPtr<vcl::Window> aContentWindow, std::string sTypeOfJSON)
|
2020-03-31 15:42:28 +02:00
|
|
|
: Idle("JSDialog notify")
|
2020-10-21 15:45:19 +02:00
|
|
|
, m_aNotifierWindow(aNotifierWindow)
|
|
|
|
, m_aContentWindow(aContentWindow)
|
|
|
|
, m_sTypeOfJSON(sTypeOfJSON)
|
2020-07-07 13:15:31 +02:00
|
|
|
, m_bForce(false)
|
2020-02-24 18:35:18 +01:00
|
|
|
{
|
2020-03-31 15:42:28 +02:00
|
|
|
SetPriority(TaskPriority::POST_PAINT);
|
|
|
|
}
|
|
|
|
|
2021-01-13 13:16:30 +01:00
|
|
|
void JSDialogNotifyIdle::forceUpdate() { m_bForce = true; }
|
2020-07-07 13:15:31 +02:00
|
|
|
|
2020-12-09 12:00:59 +01:00
|
|
|
void JSDialogNotifyIdle::send(tools::JsonWriter& aJsonWriter)
|
2020-03-31 15:42:28 +02:00
|
|
|
{
|
2020-10-30 10:51:08 +01:00
|
|
|
if (!m_aNotifierWindow)
|
2020-12-09 12:00:59 +01:00
|
|
|
{
|
|
|
|
free(aJsonWriter.extractData());
|
2020-10-30 10:51:08 +01:00
|
|
|
return;
|
2020-12-09 12:00:59 +01:00
|
|
|
}
|
2020-10-30 10:51:08 +01:00
|
|
|
|
|
|
|
const vcl::ILibreOfficeKitNotifier* pNotifier = m_aNotifierWindow->GetLOKNotifier();
|
|
|
|
if (pNotifier)
|
2020-03-31 15:42:28 +02:00
|
|
|
{
|
2020-12-09 12:00:59 +01:00
|
|
|
if (m_bForce || !aJsonWriter.isDataEquals(m_LastNotificationMessage))
|
2020-12-03 11:16:08 +01:00
|
|
|
{
|
|
|
|
m_bForce = false;
|
2020-12-09 12:00:59 +01:00
|
|
|
m_LastNotificationMessage = aJsonWriter.extractAsStdString();
|
2020-12-03 11:16:08 +01:00
|
|
|
pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG,
|
|
|
|
m_LastNotificationMessage.c_str());
|
|
|
|
}
|
2020-12-09 12:00:59 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
free(aJsonWriter.extractData());
|
|
|
|
}
|
2020-12-03 11:16:08 +01:00
|
|
|
}
|
2021-03-08 07:43:55 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
free(aJsonWriter.extractData());
|
|
|
|
}
|
2020-12-03 11:16:08 +01:00
|
|
|
}
|
|
|
|
|
2021-03-01 19:27:04 +01:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
OUString extractActionType(const ActionDataMap& rData)
|
|
|
|
{
|
|
|
|
auto it = rData.find(ACTION_TYPE);
|
|
|
|
if (it != rData.end())
|
|
|
|
return it->second;
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void JSDialogNotifyIdle::sendMessage(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow,
|
|
|
|
std::unique_ptr<ActionDataMap> pData)
|
2021-01-13 13:16:30 +01:00
|
|
|
{
|
2021-08-03 11:36:01 +02:00
|
|
|
std::scoped_lock aGuard(m_aQueueMutex);
|
2021-06-24 14:31:45 +02:00
|
|
|
|
2021-01-20 17:48:18 +01:00
|
|
|
// we want only the latest update of same type
|
|
|
|
// TODO: also if we met full update - previous updates are not valid
|
|
|
|
auto it = m_aMessageQueue.begin();
|
|
|
|
|
|
|
|
while (it != m_aMessageQueue.end())
|
|
|
|
{
|
2021-03-01 19:27:04 +01:00
|
|
|
if (it->m_eType == eType && it->m_pWindow == pWindow)
|
|
|
|
{
|
|
|
|
if (it->m_pData && pData
|
|
|
|
&& extractActionType(*it->m_pData) != extractActionType(*pData))
|
|
|
|
{
|
|
|
|
it++;
|
|
|
|
continue;
|
|
|
|
}
|
2021-01-20 17:48:18 +01:00
|
|
|
it = m_aMessageQueue.erase(it);
|
2021-03-01 19:27:04 +01:00
|
|
|
}
|
2021-01-20 17:48:18 +01:00
|
|
|
else
|
|
|
|
it++;
|
|
|
|
}
|
|
|
|
|
2021-03-01 19:27:04 +01:00
|
|
|
JSDialogMessageInfo aMessage(eType, pWindow, std::move(pData));
|
|
|
|
m_aMessageQueue.push_back(aMessage);
|
2021-01-13 13:16:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<tools::JsonWriter> JSDialogNotifyIdle::generateFullUpdate() const
|
2020-12-03 11:16:08 +01:00
|
|
|
{
|
|
|
|
std::unique_ptr<tools::JsonWriter> aJsonWriter(new tools::JsonWriter());
|
|
|
|
|
|
|
|
if (!m_aContentWindow || !m_aNotifierWindow)
|
|
|
|
return aJsonWriter;
|
2020-02-24 18:35:18 +01:00
|
|
|
|
2020-12-03 11:16:08 +01:00
|
|
|
m_aContentWindow->DumpAsPropertyTree(*aJsonWriter);
|
|
|
|
aJsonWriter->put("id", m_aNotifierWindow->GetLOKWindowId());
|
|
|
|
aJsonWriter->put("jsontype", m_sTypeOfJSON);
|
|
|
|
|
|
|
|
if (m_sTypeOfJSON == "autofilter")
|
|
|
|
{
|
|
|
|
vcl::Window* pWindow = m_aContentWindow.get();
|
2021-02-08 12:37:38 +01:00
|
|
|
DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pWindow);
|
|
|
|
while (pWindow && !pDockingWindow)
|
2020-03-31 15:42:28 +02:00
|
|
|
{
|
2020-12-03 11:16:08 +01:00
|
|
|
pWindow = pWindow->GetParent();
|
2021-02-08 12:37:38 +01:00
|
|
|
pDockingWindow = dynamic_cast<DockingWindow*>(pWindow);
|
2020-03-31 15:42:28 +02:00
|
|
|
}
|
2020-10-30 10:51:08 +01:00
|
|
|
|
2021-02-08 12:37:38 +01:00
|
|
|
if (pDockingWindow)
|
2020-10-30 10:51:08 +01:00
|
|
|
{
|
2021-02-08 12:37:38 +01:00
|
|
|
Point aPos = pDockingWindow->GetFloatingPos();
|
2020-12-03 11:16:08 +01:00
|
|
|
aJsonWriter->put("posx", aPos.getX());
|
|
|
|
aJsonWriter->put("posy", aPos.getY());
|
2021-02-08 12:37:38 +01:00
|
|
|
if (!pDockingWindow->IsVisible())
|
|
|
|
aJsonWriter->put("visible", "false");
|
2020-10-30 10:51:08 +01:00
|
|
|
}
|
2020-02-24 18:35:18 +01:00
|
|
|
}
|
2020-12-03 11:16:08 +01:00
|
|
|
|
|
|
|
return aJsonWriter;
|
|
|
|
}
|
|
|
|
|
2021-01-13 13:16:30 +01:00
|
|
|
std::unique_ptr<tools::JsonWriter>
|
|
|
|
JSDialogNotifyIdle::generateWidgetUpdate(VclPtr<vcl::Window> pWindow) const
|
2020-12-17 11:34:46 -04:00
|
|
|
{
|
2021-01-13 13:16:30 +01:00
|
|
|
std::unique_ptr<tools::JsonWriter> aJsonWriter(new tools::JsonWriter());
|
2020-12-17 11:34:46 -04:00
|
|
|
|
2021-05-12 09:18:25 +02:00
|
|
|
if (!pWindow || !m_aNotifierWindow)
|
|
|
|
return aJsonWriter;
|
|
|
|
|
2021-01-13 13:16:30 +01:00
|
|
|
aJsonWriter->put("jsontype", m_sTypeOfJSON);
|
|
|
|
aJsonWriter->put("action", "update");
|
|
|
|
aJsonWriter->put("id", m_aNotifierWindow->GetLOKWindowId());
|
2020-12-17 11:34:46 -04:00
|
|
|
{
|
2021-01-13 13:16:30 +01:00
|
|
|
auto aEntries = aJsonWriter->startNode("control");
|
|
|
|
pWindow->DumpAsPropertyTree(*aJsonWriter);
|
2020-12-17 11:34:46 -04:00
|
|
|
}
|
2020-12-29 09:36:50 +01:00
|
|
|
|
2021-01-13 13:16:30 +01:00
|
|
|
return aJsonWriter;
|
2020-12-17 11:34:46 -04:00
|
|
|
}
|
|
|
|
|
2020-12-03 11:16:08 +01:00
|
|
|
std::unique_ptr<tools::JsonWriter> JSDialogNotifyIdle::generateCloseMessage() const
|
|
|
|
{
|
|
|
|
std::unique_ptr<tools::JsonWriter> aJsonWriter(new tools::JsonWriter());
|
|
|
|
if (m_aNotifierWindow)
|
|
|
|
aJsonWriter->put("id", m_aNotifierWindow->GetLOKWindowId());
|
|
|
|
aJsonWriter->put("jsontype", m_sTypeOfJSON);
|
|
|
|
aJsonWriter->put("action", "close");
|
|
|
|
|
|
|
|
return aJsonWriter;
|
2020-02-24 18:35:18 +01:00
|
|
|
}
|
|
|
|
|
2021-03-01 19:27:04 +01:00
|
|
|
std::unique_ptr<tools::JsonWriter>
|
|
|
|
JSDialogNotifyIdle::generateActionMessage(VclPtr<vcl::Window> pWindow,
|
|
|
|
std::unique_ptr<ActionDataMap> pData) const
|
|
|
|
{
|
|
|
|
std::unique_ptr<tools::JsonWriter> aJsonWriter(new tools::JsonWriter());
|
|
|
|
|
|
|
|
aJsonWriter->put("jsontype", m_sTypeOfJSON);
|
|
|
|
aJsonWriter->put("action", "action");
|
|
|
|
aJsonWriter->put("id", m_aNotifierWindow->GetLOKWindowId());
|
|
|
|
|
|
|
|
{
|
|
|
|
auto aDataNode = aJsonWriter->startNode("data");
|
|
|
|
aJsonWriter->put("control_id", pWindow->get_id());
|
|
|
|
|
|
|
|
for (auto it = pData->begin(); it != pData->end(); it++)
|
|
|
|
aJsonWriter->put(it->first.c_str(), it->second);
|
|
|
|
}
|
|
|
|
|
|
|
|
return aJsonWriter;
|
|
|
|
}
|
|
|
|
|
2021-06-24 14:31:45 +02:00
|
|
|
std::unique_ptr<tools::JsonWriter>
|
|
|
|
JSDialogNotifyIdle::generatePopupMessage(VclPtr<vcl::Window> pWindow, OUString sParentId,
|
|
|
|
OUString sCloseId) const
|
|
|
|
{
|
|
|
|
std::unique_ptr<tools::JsonWriter> aJsonWriter(new tools::JsonWriter());
|
|
|
|
|
|
|
|
if (!pWindow || !m_aNotifierWindow)
|
|
|
|
return aJsonWriter;
|
|
|
|
|
2021-06-28 15:38:32 +02:00
|
|
|
if (!pWindow->GetParentWithLOKNotifier())
|
|
|
|
return aJsonWriter;
|
|
|
|
|
2021-06-29 12:34:18 +02:00
|
|
|
{
|
|
|
|
auto aChildren = aJsonWriter->startArray("children");
|
|
|
|
{
|
|
|
|
auto aStruct = aJsonWriter->startStruct();
|
|
|
|
pWindow->DumpAsPropertyTree(*aJsonWriter);
|
|
|
|
}
|
|
|
|
}
|
2021-06-24 14:31:45 +02:00
|
|
|
|
|
|
|
aJsonWriter->put("jsontype", "dialog");
|
|
|
|
aJsonWriter->put("type", "modalpopup");
|
|
|
|
aJsonWriter->put("cancellable", true);
|
|
|
|
aJsonWriter->put("popupParent", sParentId);
|
|
|
|
aJsonWriter->put("clickToClose", sCloseId);
|
2021-06-28 15:38:32 +02:00
|
|
|
aJsonWriter->put("id", pWindow->GetParentWithLOKNotifier()->GetLOKWindowId());
|
2021-06-24 14:31:45 +02:00
|
|
|
|
|
|
|
return aJsonWriter;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<tools::JsonWriter>
|
|
|
|
JSDialogNotifyIdle::generateClosePopupMessage(OUString sWindowId) const
|
|
|
|
{
|
|
|
|
std::unique_ptr<tools::JsonWriter> aJsonWriter(new tools::JsonWriter());
|
|
|
|
|
|
|
|
if (!m_aNotifierWindow)
|
|
|
|
return aJsonWriter;
|
|
|
|
|
|
|
|
aJsonWriter->put("jsontype", "dialog");
|
2021-07-07 12:19:12 +02:00
|
|
|
aJsonWriter->put("type", "modalpopup");
|
2021-06-24 14:31:45 +02:00
|
|
|
aJsonWriter->put("action", "close");
|
|
|
|
aJsonWriter->put("id", sWindowId);
|
|
|
|
|
|
|
|
return aJsonWriter;
|
|
|
|
}
|
|
|
|
|
2021-01-13 13:16:30 +01:00
|
|
|
void JSDialogNotifyIdle::Invoke()
|
|
|
|
{
|
2021-08-02 09:17:32 +02:00
|
|
|
std::deque<JSDialogMessageInfo> aMessageQueue;
|
|
|
|
{
|
2021-08-03 11:36:01 +02:00
|
|
|
std::scoped_lock aGuard(m_aQueueMutex);
|
2021-06-24 14:31:45 +02:00
|
|
|
|
2021-08-02 09:17:32 +02:00
|
|
|
std::swap(aMessageQueue, m_aMessageQueue);
|
|
|
|
}
|
2021-06-24 14:31:45 +02:00
|
|
|
|
|
|
|
for (auto& rMessage : aMessageQueue)
|
2021-01-13 13:16:30 +01:00
|
|
|
{
|
2021-03-01 19:27:04 +01:00
|
|
|
jsdialog::MessageType eType = rMessage.m_eType;
|
2021-01-13 13:16:30 +01:00
|
|
|
|
|
|
|
switch (eType)
|
|
|
|
{
|
|
|
|
case jsdialog::MessageType::FullUpdate:
|
|
|
|
send(*generateFullUpdate());
|
|
|
|
break;
|
2020-12-03 11:16:08 +01:00
|
|
|
|
2021-01-13 13:16:30 +01:00
|
|
|
case jsdialog::MessageType::WidgetUpdate:
|
2021-03-01 19:27:04 +01:00
|
|
|
send(*generateWidgetUpdate(rMessage.m_pWindow));
|
2021-01-13 13:16:30 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case jsdialog::MessageType::Close:
|
|
|
|
send(*generateCloseMessage());
|
|
|
|
break;
|
2021-03-01 19:27:04 +01:00
|
|
|
|
|
|
|
case jsdialog::MessageType::Action:
|
|
|
|
send(*generateActionMessage(rMessage.m_pWindow, std::move(rMessage.m_pData)));
|
|
|
|
break;
|
2021-06-24 14:31:45 +02:00
|
|
|
|
|
|
|
case jsdialog::MessageType::Popup:
|
2021-07-05 12:21:16 +02:00
|
|
|
send(*generatePopupMessage(rMessage.m_pWindow, (*rMessage.m_pData)[PARENT_ID],
|
|
|
|
(*rMessage.m_pData)[CLOSE_ID]));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case jsdialog::MessageType::PopupClose:
|
|
|
|
send(*generateClosePopupMessage((*rMessage.m_pData)[WINDOW_ID]));
|
2021-06-24 14:31:45 +02:00
|
|
|
break;
|
2021-01-13 13:16:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-12-03 11:16:08 +01:00
|
|
|
|
2021-02-26 09:00:33 +01:00
|
|
|
void JSDialogNotifyIdle::clearQueue() { m_aMessageQueue.clear(); }
|
|
|
|
|
2021-07-03 14:22:05 +01:00
|
|
|
JSDialogSender::~JSDialogSender() COVERITY_NOEXCEPT_FALSE
|
2021-02-26 09:00:33 +01:00
|
|
|
{
|
|
|
|
sendClose();
|
2021-06-25 10:22:15 +02:00
|
|
|
|
|
|
|
if (mpIdleNotify)
|
|
|
|
mpIdleNotify->Stop();
|
2021-02-26 09:00:33 +01:00
|
|
|
}
|
2021-02-08 12:37:38 +01:00
|
|
|
|
2021-01-19 12:09:45 +01:00
|
|
|
void JSDialogSender::sendFullUpdate(bool bForce)
|
2020-07-07 13:15:31 +02:00
|
|
|
{
|
2021-06-25 10:22:15 +02:00
|
|
|
if (!mpIdleNotify)
|
|
|
|
return;
|
|
|
|
|
2020-07-07 13:15:31 +02:00
|
|
|
if (bForce)
|
2021-01-13 13:16:30 +01:00
|
|
|
mpIdleNotify->forceUpdate();
|
|
|
|
|
|
|
|
mpIdleNotify->sendMessage(jsdialog::MessageType::FullUpdate, nullptr);
|
2020-07-07 13:15:31 +02:00
|
|
|
mpIdleNotify->Start();
|
|
|
|
}
|
2020-03-31 15:42:28 +02:00
|
|
|
|
2021-01-13 13:16:30 +01:00
|
|
|
void JSDialogSender::sendClose()
|
|
|
|
{
|
2021-11-24 13:11:18 +01:00
|
|
|
if (!mpIdleNotify || !m_bCanClose)
|
2021-06-25 10:22:15 +02:00
|
|
|
return;
|
|
|
|
|
2021-02-26 09:00:33 +01:00
|
|
|
mpIdleNotify->clearQueue();
|
2021-01-13 13:16:30 +01:00
|
|
|
mpIdleNotify->sendMessage(jsdialog::MessageType::Close, nullptr);
|
2021-01-19 15:55:29 +01:00
|
|
|
flush();
|
2021-01-13 13:16:30 +01:00
|
|
|
}
|
2020-12-03 11:16:08 +01:00
|
|
|
|
2021-01-15 11:38:50 +01:00
|
|
|
void JSDialogSender::sendUpdate(VclPtr<vcl::Window> pWindow, bool bForce)
|
2020-12-17 11:34:46 -04:00
|
|
|
{
|
2021-06-25 10:22:15 +02:00
|
|
|
if (!mpIdleNotify)
|
|
|
|
return;
|
|
|
|
|
2021-01-15 11:38:50 +01:00
|
|
|
if (bForce)
|
|
|
|
mpIdleNotify->forceUpdate();
|
|
|
|
|
2021-01-13 13:16:30 +01:00
|
|
|
mpIdleNotify->sendMessage(jsdialog::MessageType::WidgetUpdate, pWindow);
|
|
|
|
mpIdleNotify->Start();
|
2020-12-17 11:34:46 -04:00
|
|
|
}
|
|
|
|
|
2021-03-01 19:27:04 +01:00
|
|
|
void JSDialogSender::sendAction(VclPtr<vcl::Window> pWindow, std::unique_ptr<ActionDataMap> pData)
|
|
|
|
{
|
2021-06-25 10:22:15 +02:00
|
|
|
if (!mpIdleNotify)
|
|
|
|
return;
|
|
|
|
|
2021-03-01 19:27:04 +01:00
|
|
|
mpIdleNotify->sendMessage(jsdialog::MessageType::Action, pWindow, std::move(pData));
|
|
|
|
mpIdleNotify->Start();
|
|
|
|
}
|
|
|
|
|
2021-06-24 14:31:45 +02:00
|
|
|
void JSDialogSender::sendPopup(VclPtr<vcl::Window> pWindow, OUString sParentId, OUString sCloseId)
|
|
|
|
{
|
2021-06-25 10:22:15 +02:00
|
|
|
if (!mpIdleNotify)
|
|
|
|
return;
|
|
|
|
|
2021-06-24 14:31:45 +02:00
|
|
|
std::unique_ptr<ActionDataMap> pData = std::make_unique<ActionDataMap>();
|
|
|
|
(*pData)[PARENT_ID] = sParentId;
|
|
|
|
(*pData)[CLOSE_ID] = sCloseId;
|
|
|
|
mpIdleNotify->sendMessage(jsdialog::MessageType::Popup, pWindow, std::move(pData));
|
|
|
|
mpIdleNotify->Start();
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSDialogSender::sendClosePopup(vcl::LOKWindowId nWindowId)
|
|
|
|
{
|
2021-06-25 10:22:15 +02:00
|
|
|
if (!mpIdleNotify)
|
|
|
|
return;
|
|
|
|
|
2021-06-24 14:31:45 +02:00
|
|
|
std::unique_ptr<ActionDataMap> pData = std::make_unique<ActionDataMap>();
|
|
|
|
(*pData)[WINDOW_ID] = OUString::number(nWindowId);
|
2021-07-05 12:21:16 +02:00
|
|
|
mpIdleNotify->sendMessage(jsdialog::MessageType::PopupClose, nullptr, std::move(pData));
|
2021-11-22 10:50:03 +01:00
|
|
|
flush();
|
2021-06-24 14:31:45 +02:00
|
|
|
}
|
|
|
|
|
2020-06-27 16:14:11 +01:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
vcl::Window* extract_sal_widget(weld::Widget* pParent)
|
|
|
|
{
|
|
|
|
SalInstanceWidget* pInstanceWidget = dynamic_cast<SalInstanceWidget*>(pParent);
|
|
|
|
return pInstanceWidget ? pInstanceWidget->getWidget() : nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-18 10:12:38 +01:00
|
|
|
// Drag and drop
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
class JSDropTargetDropContext
|
|
|
|
: public cppu::WeakImplHelper<css::datatransfer::dnd::XDropTargetDropContext>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
JSDropTargetDropContext() {}
|
|
|
|
|
|
|
|
// XDropTargetDropContext
|
|
|
|
virtual void SAL_CALL acceptDrop(sal_Int8 /*dragOperation*/) override {}
|
|
|
|
|
|
|
|
virtual void SAL_CALL rejectDrop() override {}
|
|
|
|
|
|
|
|
virtual void SAL_CALL dropComplete(sal_Bool /*bSuccess*/) override {}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
static JSTreeView* g_DragSource;
|
|
|
|
|
2021-12-23 22:10:42 +02:00
|
|
|
JSDropTarget::JSDropTarget() {}
|
2020-11-18 10:12:38 +01:00
|
|
|
|
|
|
|
void JSDropTarget::initialize(const css::uno::Sequence<css::uno::Any>& /*rArgs*/) {}
|
|
|
|
|
|
|
|
void JSDropTarget::addDropTargetListener(
|
|
|
|
const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>& xListener)
|
|
|
|
{
|
2021-12-23 22:10:42 +02:00
|
|
|
std::unique_lock aGuard(m_aMutex);
|
2020-11-18 10:12:38 +01:00
|
|
|
|
|
|
|
m_aListeners.push_back(xListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSDropTarget::removeDropTargetListener(
|
|
|
|
const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>& xListener)
|
|
|
|
{
|
2021-12-23 22:10:42 +02:00
|
|
|
std::unique_lock aGuard(m_aMutex);
|
2020-11-18 10:12:38 +01:00
|
|
|
|
|
|
|
m_aListeners.erase(std::remove(m_aListeners.begin(), m_aListeners.end(), xListener),
|
|
|
|
m_aListeners.end());
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool JSDropTarget::isActive() { return false; }
|
|
|
|
|
|
|
|
void JSDropTarget::setActive(sal_Bool /*active*/) {}
|
|
|
|
|
|
|
|
sal_Int8 JSDropTarget::getDefaultActions() { return 0; }
|
|
|
|
|
|
|
|
void JSDropTarget::setDefaultActions(sal_Int8 /*actions*/) {}
|
|
|
|
|
|
|
|
OUString JSDropTarget::getImplementationName()
|
|
|
|
{
|
|
|
|
return "com.sun.star.datatransfer.dnd.JSDropTarget";
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool JSDropTarget::supportsService(OUString const& ServiceName)
|
|
|
|
{
|
|
|
|
return cppu::supportsService(this, ServiceName);
|
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Sequence<OUString> JSDropTarget::getSupportedServiceNames()
|
|
|
|
{
|
|
|
|
css::uno::Sequence<OUString> aRet{ "com.sun.star.datatransfer.dnd.JSDropTarget" };
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSDropTarget::fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde)
|
|
|
|
{
|
2021-12-23 22:10:42 +02:00
|
|
|
std::unique_lock aGuard(m_aMutex);
|
2020-11-18 10:12:38 +01:00
|
|
|
std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> aListeners(
|
|
|
|
m_aListeners);
|
2021-12-23 22:10:42 +02:00
|
|
|
aGuard.unlock();
|
2020-11-18 10:12:38 +01:00
|
|
|
|
|
|
|
for (auto const& listener : aListeners)
|
|
|
|
{
|
|
|
|
listener->drop(dtde);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSDropTarget::fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde)
|
|
|
|
{
|
2021-12-23 22:10:42 +02:00
|
|
|
std::unique_lock aGuard(m_aMutex);
|
2020-11-18 10:12:38 +01:00
|
|
|
std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> aListeners(
|
|
|
|
m_aListeners);
|
2021-12-23 22:10:42 +02:00
|
|
|
aGuard.unlock();
|
2020-11-18 10:12:38 +01:00
|
|
|
|
|
|
|
for (auto const& listener : aListeners)
|
|
|
|
{
|
|
|
|
listener->dragEnter(dtde);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-15 09:13:35 +01:00
|
|
|
std::string JSInstanceBuilder::getMapIdFromWindowId() const
|
|
|
|
{
|
|
|
|
if (m_sTypeOfJSON == "sidebar" || m_sTypeOfJSON == "notebookbar")
|
|
|
|
return std::to_string(m_nWindowId) + m_sTypeOfJSON;
|
|
|
|
else
|
|
|
|
return std::to_string(m_nWindowId);
|
|
|
|
}
|
|
|
|
|
2020-11-18 10:12:38 +01:00
|
|
|
// used for dialogs
|
2020-02-18 15:41:56 +01:00
|
|
|
JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot,
|
2021-06-15 13:10:00 +02:00
|
|
|
const OUString& rUIFile, bool bPopup)
|
2020-06-27 16:14:11 +01:00
|
|
|
: SalInstanceBuilder(extract_sal_widget(pParent), rUIRoot, rUIFile)
|
2020-03-05 12:18:38 +01:00
|
|
|
, m_nWindowId(0)
|
2020-03-09 14:11:06 +01:00
|
|
|
, m_aParentDialog(nullptr)
|
2020-10-21 15:45:19 +02:00
|
|
|
, m_aContentWindow(nullptr)
|
|
|
|
, m_sTypeOfJSON("dialog")
|
2020-03-09 14:11:06 +01:00
|
|
|
, m_bHasTopLevelDialog(false)
|
2020-06-25 11:24:15 +02:00
|
|
|
, m_bIsNotebookbar(false)
|
2021-06-15 13:10:00 +02:00
|
|
|
, m_aWindowToRelease(nullptr)
|
2020-02-18 15:41:56 +01:00
|
|
|
{
|
2021-06-15 13:10:00 +02:00
|
|
|
// when it is a popup we initialize sender in weld_popover
|
|
|
|
if (bPopup)
|
|
|
|
return;
|
|
|
|
|
2020-03-09 14:11:06 +01:00
|
|
|
vcl::Window* pRoot = m_xBuilder->get_widget_root();
|
2021-05-12 09:18:25 +02:00
|
|
|
|
2020-03-09 14:11:06 +01:00
|
|
|
if (pRoot && pRoot->GetParent())
|
|
|
|
{
|
|
|
|
m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier();
|
2020-06-15 19:03:09 +02:00
|
|
|
if (m_aParentDialog)
|
|
|
|
m_nWindowId = m_aParentDialog->GetLOKWindowId();
|
2021-11-15 09:13:35 +01:00
|
|
|
InsertWindowToMap(getMapIdFromWindowId());
|
2020-06-15 19:03:09 +02:00
|
|
|
}
|
2021-01-12 14:30:05 +01:00
|
|
|
|
|
|
|
initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
|
2020-06-15 19:03:09 +02:00
|
|
|
}
|
|
|
|
|
2021-05-12 09:18:25 +02:00
|
|
|
// 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)
|
2021-06-15 13:10:00 +02:00
|
|
|
, m_aWindowToRelease(nullptr)
|
2021-05-12 09:18:25 +02:00
|
|
|
{
|
|
|
|
vcl::Window* pRoot = m_xBuilder->get_widget_root();
|
|
|
|
|
2021-06-11 10:29:54 +02:00
|
|
|
m_aParentDialog = pRoot->GetParentWithLOKNotifier();
|
|
|
|
|
2021-05-12 09:18:25 +02:00
|
|
|
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
|
|
|
|
{
|
2021-11-24 13:11:18 +01:00
|
|
|
// embedded fragments cannot send close message for whole sidebar
|
|
|
|
if (rUIFile == "modules/simpress/ui/customanimationfragment.ui")
|
|
|
|
m_bCanClose = false;
|
|
|
|
|
2021-05-12 09:18:25 +02:00
|
|
|
// 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();
|
|
|
|
}
|
|
|
|
|
2021-11-15 09:13:35 +01:00
|
|
|
InsertWindowToMap(getMapIdFromWindowId());
|
2021-05-12 09:18:25 +02:00
|
|
|
|
|
|
|
initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
|
|
|
|
}
|
|
|
|
|
2020-10-21 15:45:19 +02:00
|
|
|
// used for notebookbar
|
2020-06-15 19:03:09 +02:00
|
|
|
JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot,
|
|
|
|
const OUString& rUIFile,
|
2020-06-23 12:49:17 +02:00
|
|
|
const css::uno::Reference<css::frame::XFrame>& rFrame,
|
|
|
|
sal_uInt64 nWindowId)
|
2020-06-15 19:03:09 +02:00
|
|
|
: SalInstanceBuilder(pParent, rUIRoot, rUIFile, rFrame)
|
|
|
|
, m_nWindowId(0)
|
|
|
|
, m_aParentDialog(nullptr)
|
2020-10-21 15:45:19 +02:00
|
|
|
, m_aContentWindow(nullptr)
|
|
|
|
, m_sTypeOfJSON("notebookbar")
|
2020-06-15 19:03:09 +02:00
|
|
|
, m_bHasTopLevelDialog(false)
|
2020-06-25 11:24:15 +02:00
|
|
|
, m_bIsNotebookbar(false)
|
2021-06-15 13:10:00 +02:00
|
|
|
, m_aWindowToRelease(nullptr)
|
2020-06-15 19:03:09 +02:00
|
|
|
{
|
|
|
|
vcl::Window* pRoot = m_xBuilder->get_widget_root();
|
|
|
|
if (pRoot && pRoot->GetParent())
|
|
|
|
{
|
|
|
|
m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier();
|
|
|
|
if (m_aParentDialog)
|
|
|
|
m_nWindowId = m_aParentDialog->GetLOKWindowId();
|
2020-06-23 12:49:17 +02:00
|
|
|
if (!m_nWindowId && nWindowId)
|
2020-06-25 11:24:15 +02:00
|
|
|
{
|
2020-06-23 12:49:17 +02:00
|
|
|
m_nWindowId = nWindowId;
|
2020-06-25 11:24:15 +02:00
|
|
|
m_bIsNotebookbar = true;
|
|
|
|
}
|
2021-11-15 09:13:35 +01:00
|
|
|
InsertWindowToMap(getMapIdFromWindowId());
|
2020-03-09 14:11:06 +01:00
|
|
|
}
|
2021-01-12 14:30:05 +01:00
|
|
|
|
|
|
|
initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
|
2020-02-18 15:41:56 +01:00
|
|
|
}
|
|
|
|
|
2020-10-21 15:45:19 +02:00
|
|
|
// used for autofilter dropdown
|
|
|
|
JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot,
|
|
|
|
const OUString& rUIFile)
|
|
|
|
: SalInstanceBuilder(pParent, rUIRoot, rUIFile)
|
|
|
|
, m_nWindowId(0)
|
|
|
|
, m_aParentDialog(nullptr)
|
|
|
|
, m_aContentWindow(nullptr)
|
|
|
|
, m_sTypeOfJSON("autofilter")
|
|
|
|
, m_bHasTopLevelDialog(false)
|
|
|
|
, m_bIsNotebookbar(false)
|
2021-06-15 13:10:00 +02:00
|
|
|
, m_aWindowToRelease(nullptr)
|
2020-10-21 15:45:19 +02:00
|
|
|
{
|
|
|
|
vcl::Window* pRoot = m_xBuilder->get_widget_root();
|
|
|
|
m_aContentWindow = pParent;
|
|
|
|
if (pRoot && pRoot->GetParent())
|
|
|
|
{
|
|
|
|
m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier();
|
|
|
|
if (m_aParentDialog)
|
|
|
|
m_nWindowId = m_aParentDialog->GetLOKWindowId();
|
2021-11-15 09:13:35 +01:00
|
|
|
InsertWindowToMap(getMapIdFromWindowId());
|
2020-10-21 15:45:19 +02:00
|
|
|
}
|
2021-01-12 14:30:05 +01:00
|
|
|
|
|
|
|
initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
|
2021-09-23 16:33:27 +02:00
|
|
|
sendFullUpdate();
|
2020-10-21 15:45:19 +02:00
|
|
|
}
|
|
|
|
|
2021-10-22 10:36:14 +02:00
|
|
|
std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateDialogBuilder(weld::Widget* pParent,
|
|
|
|
const OUString& rUIRoot,
|
|
|
|
const OUString& rUIFile)
|
2020-10-21 15:45:19 +02:00
|
|
|
{
|
2021-10-22 10:36:14 +02:00
|
|
|
return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile);
|
2020-10-21 15:45:19 +02:00
|
|
|
}
|
|
|
|
|
2021-10-22 10:36:14 +02:00
|
|
|
std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateNotebookbarBuilder(
|
2020-10-21 15:45:19 +02:00
|
|
|
vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile,
|
|
|
|
const css::uno::Reference<css::frame::XFrame>& rFrame, sal_uInt64 nWindowId)
|
|
|
|
{
|
2021-10-22 10:36:14 +02:00
|
|
|
return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile, rFrame, nWindowId);
|
2020-10-21 15:45:19 +02:00
|
|
|
}
|
|
|
|
|
2021-10-22 10:36:14 +02:00
|
|
|
std::unique_ptr<JSInstanceBuilder>
|
|
|
|
JSInstanceBuilder::CreateAutofilterWindowBuilder(vcl::Window* pParent, const OUString& rUIRoot,
|
|
|
|
const OUString& rUIFile)
|
2020-10-21 15:45:19 +02:00
|
|
|
{
|
2021-10-22 10:36:14 +02:00
|
|
|
return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile);
|
2020-10-21 15:45:19 +02:00
|
|
|
}
|
|
|
|
|
2021-10-22 10:36:14 +02:00
|
|
|
std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateSidebarBuilder(weld::Widget* pParent,
|
|
|
|
const OUString& rUIRoot,
|
|
|
|
const OUString& rUIFile,
|
|
|
|
sal_uInt64 nLOKWindowId)
|
2021-05-12 09:18:25 +02:00
|
|
|
{
|
2021-10-22 10:36:14 +02:00
|
|
|
return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile, nLOKWindowId);
|
2021-05-12 09:18:25 +02:00
|
|
|
}
|
|
|
|
|
2021-10-22 10:36:14 +02:00
|
|
|
std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreatePopupBuilder(weld::Widget* pParent,
|
|
|
|
const OUString& rUIRoot,
|
|
|
|
const OUString& rUIFile)
|
2021-06-15 13:10:00 +02:00
|
|
|
{
|
2021-10-22 10:36:14 +02:00
|
|
|
return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile, true);
|
2021-06-15 13:10:00 +02:00
|
|
|
}
|
|
|
|
|
2020-06-25 11:24:15 +02:00
|
|
|
JSInstanceBuilder::~JSInstanceBuilder()
|
|
|
|
{
|
2021-06-15 13:10:00 +02:00
|
|
|
if (m_aWindowToRelease)
|
|
|
|
{
|
|
|
|
m_aWindowToRelease->ReleaseLOKNotifier();
|
|
|
|
m_aWindowToRelease.clear();
|
|
|
|
}
|
|
|
|
|
2020-06-25 11:24:15 +02:00
|
|
|
if (m_nWindowId && (m_bHasTopLevelDialog || m_bIsNotebookbar))
|
2020-11-03 13:27:47 +01:00
|
|
|
{
|
2021-11-15 09:13:35 +01:00
|
|
|
GetLOKWeldWidgetsMap().erase(getMapIdFromWindowId());
|
2020-11-03 13:27:47 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-15 09:13:35 +01:00
|
|
|
auto it = GetLOKWeldWidgetsMap().find(getMapIdFromWindowId());
|
2020-11-03 13:27:47 +01:00
|
|
|
if (it != GetLOKWeldWidgetsMap().end())
|
|
|
|
{
|
|
|
|
std::for_each(m_aRememberedWidgets.begin(), m_aRememberedWidgets.end(),
|
|
|
|
[it](std::string& sId) { it->second.erase(sId.c_str()); });
|
|
|
|
}
|
|
|
|
}
|
2020-06-25 11:24:15 +02:00
|
|
|
}
|
2020-03-05 12:18:38 +01:00
|
|
|
|
2021-11-15 09:13:35 +01:00
|
|
|
std::map<std::string, WidgetMap>& JSInstanceBuilder::GetLOKWeldWidgetsMap()
|
2020-03-05 12:18:38 +01:00
|
|
|
{
|
2020-03-06 11:11:57 +01:00
|
|
|
// Map to remember the LOKWindowId <-> weld widgets binding.
|
2021-11-15 09:13:35 +01:00
|
|
|
static std::map<std::string, WidgetMap> s_aLOKWeldBuildersMap;
|
2020-03-05 12:18:38 +01:00
|
|
|
|
|
|
|
return s_aLOKWeldBuildersMap;
|
|
|
|
}
|
|
|
|
|
2021-11-15 09:13:35 +01:00
|
|
|
weld::Widget* JSInstanceBuilder::FindWeldWidgetsMap(const std::string& nWindowId,
|
|
|
|
const OString& rWidget)
|
2020-03-05 12:18:38 +01:00
|
|
|
{
|
2020-07-02 11:01:54 +02:00
|
|
|
const auto it = GetLOKWeldWidgetsMap().find(nWindowId);
|
2020-03-09 14:11:06 +01:00
|
|
|
|
2020-07-02 11:01:54 +02:00
|
|
|
if (it != GetLOKWeldWidgetsMap().end())
|
2020-03-06 11:11:57 +01:00
|
|
|
{
|
|
|
|
auto widgetIt = it->second.find(rWidget);
|
|
|
|
if (widgetIt != it->second.end())
|
|
|
|
return widgetIt->second;
|
|
|
|
}
|
2020-03-05 12:18:38 +01:00
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2021-11-15 09:13:35 +01:00
|
|
|
void JSInstanceBuilder::InsertWindowToMap(const std::string& nWindowId)
|
2020-03-09 14:11:06 +01:00
|
|
|
{
|
|
|
|
WidgetMap map;
|
|
|
|
auto it = GetLOKWeldWidgetsMap().find(nWindowId);
|
|
|
|
if (it == GetLOKWeldWidgetsMap().end())
|
2021-11-15 09:13:35 +01:00
|
|
|
GetLOKWeldWidgetsMap().insert(std::map<std::string, WidgetMap>::value_type(nWindowId, map));
|
2020-03-09 14:11:06 +01:00
|
|
|
}
|
|
|
|
|
2020-03-06 11:11:57 +01:00
|
|
|
void JSInstanceBuilder::RememberWidget(const OString& id, weld::Widget* pWidget)
|
|
|
|
{
|
2021-11-23 09:55:00 +01:00
|
|
|
RememberWidget(getMapIdFromWindowId(), id, pWidget);
|
|
|
|
m_aRememberedWidgets.push_back(id.getStr());
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSInstanceBuilder::RememberWidget(const std::string& nWindowId, const OString& id,
|
|
|
|
weld::Widget* pWidget)
|
|
|
|
{
|
|
|
|
auto it = GetLOKWeldWidgetsMap().find(nWindowId);
|
2020-03-06 11:11:57 +01:00
|
|
|
if (it != GetLOKWeldWidgetsMap().end())
|
|
|
|
{
|
2020-06-25 11:24:15 +02:00
|
|
|
it->second.erase(id);
|
2020-03-06 11:11:57 +01:00
|
|
|
it->second.insert(WidgetMap::value_type(id, pWidget));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-15 09:13:35 +01:00
|
|
|
void JSInstanceBuilder::AddChildWidget(const std::string& nWindowId, const OString& id,
|
2021-03-02 19:09:21 -04:00
|
|
|
weld::Widget* pWidget)
|
|
|
|
{
|
|
|
|
auto it = GetLOKWeldWidgetsMap().find(nWindowId);
|
|
|
|
if (it != GetLOKWeldWidgetsMap().end())
|
|
|
|
{
|
|
|
|
it->second.erase(id);
|
|
|
|
it->second.insert(WidgetMap::value_type(id, pWidget));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-15 09:13:35 +01:00
|
|
|
void JSInstanceBuilder::RemoveWindowWidget(const std::string& nWindowId)
|
2021-03-02 19:09:21 -04:00
|
|
|
{
|
|
|
|
auto it = JSInstanceBuilder::GetLOKWeldWidgetsMap().find(nWindowId);
|
|
|
|
if (it != JSInstanceBuilder::GetLOKWeldWidgetsMap().end())
|
|
|
|
{
|
|
|
|
JSInstanceBuilder::GetLOKWeldWidgetsMap().erase(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-05 14:20:11 +02:00
|
|
|
const std::string& JSInstanceBuilder::GetTypeOfJSON() const { return m_sTypeOfJSON; }
|
2021-01-12 14:30:05 +01:00
|
|
|
|
2020-10-21 15:45:19 +02:00
|
|
|
VclPtr<vcl::Window>& JSInstanceBuilder::GetContentWindow()
|
|
|
|
{
|
|
|
|
if (m_aContentWindow)
|
|
|
|
return m_aContentWindow;
|
|
|
|
else
|
|
|
|
return m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
VclPtr<vcl::Window>& JSInstanceBuilder::GetNotifierWindow()
|
|
|
|
{
|
|
|
|
return m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog;
|
|
|
|
}
|
|
|
|
|
2020-10-06 09:45:54 +01:00
|
|
|
std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& id)
|
2020-02-18 15:41:56 +01:00
|
|
|
{
|
2020-12-04 17:00:51 -04:00
|
|
|
std::unique_ptr<weld::Dialog> pRet;
|
2020-02-18 15:41:56 +01:00
|
|
|
::Dialog* pDialog = m_xBuilder->get<::Dialog>(id);
|
2020-03-05 12:18:38 +01:00
|
|
|
|
2020-10-06 09:45:54 +01:00
|
|
|
if (pDialog)
|
2020-02-18 15:41:56 +01:00
|
|
|
{
|
2020-12-04 17:00:51 -04:00
|
|
|
m_nWindowId = pDialog->GetLOKWindowId();
|
|
|
|
pDialog->SetLOKTunnelingState(false);
|
|
|
|
|
2021-11-15 09:13:35 +01:00
|
|
|
InsertWindowToMap(getMapIdFromWindowId());
|
2020-12-04 17:00:51 -04:00
|
|
|
|
2020-02-18 15:41:56 +01:00
|
|
|
assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
|
|
|
|
m_aOwnedToplevel.set(pDialog);
|
|
|
|
m_xBuilder->drop_ownership(pDialog);
|
2020-03-09 14:11:06 +01:00
|
|
|
m_bHasTopLevelDialog = true;
|
2020-02-18 15:41:56 +01:00
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
pRet.reset(new JSDialog(this, pDialog, this, false));
|
2020-12-02 15:06:35 +01:00
|
|
|
|
2020-12-04 17:00:51 -04:00
|
|
|
RememberWidget("__DIALOG__", pRet.get());
|
2020-12-02 15:06:35 +01:00
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
|
2021-01-19 14:08:35 +01:00
|
|
|
sendFullUpdate();
|
2020-02-18 15:41:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
2020-12-25 13:23:40 -04:00
|
|
|
std::unique_ptr<weld::MessageDialog> JSInstanceBuilder::weld_message_dialog(const OString& id)
|
|
|
|
{
|
|
|
|
std::unique_ptr<weld::MessageDialog> pRet;
|
|
|
|
::MessageDialog* pMessageDialog = m_xBuilder->get<::MessageDialog>(id);
|
|
|
|
|
|
|
|
if (pMessageDialog)
|
|
|
|
{
|
|
|
|
m_nWindowId = pMessageDialog->GetLOKWindowId();
|
|
|
|
pMessageDialog->SetLOKTunnelingState(false);
|
|
|
|
|
2021-11-15 09:13:35 +01:00
|
|
|
InsertWindowToMap(getMapIdFromWindowId());
|
2020-12-25 13:23:40 -04:00
|
|
|
|
|
|
|
assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
|
|
|
|
m_aOwnedToplevel.set(pMessageDialog);
|
|
|
|
m_xBuilder->drop_ownership(pMessageDialog);
|
2021-01-12 14:30:05 +01:00
|
|
|
m_bHasTopLevelDialog = true;
|
|
|
|
|
|
|
|
initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
|
2020-12-25 13:23:40 -04:00
|
|
|
}
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
pRet.reset(pMessageDialog ? new JSMessageDialog(this, pMessageDialog, this, false) : nullptr);
|
2020-12-25 13:23:40 -04:00
|
|
|
|
2020-12-30 10:05:26 +01:00
|
|
|
if (pRet)
|
|
|
|
RememberWidget("__DIALOG__", pRet.get());
|
|
|
|
|
2020-12-25 13:23:40 -04:00
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
2021-05-18 17:07:30 +02:00
|
|
|
std::unique_ptr<weld::Container> JSInstanceBuilder::weld_container(const OString& id)
|
|
|
|
{
|
|
|
|
vcl::Window* pContainer = m_xBuilder->get<vcl::Window>(id);
|
|
|
|
auto pWeldWidget = std::make_unique<JSContainer>(this, pContainer, this, false);
|
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2020-10-06 09:45:54 +01:00
|
|
|
std::unique_ptr<weld::Label> JSInstanceBuilder::weld_label(const OString& id)
|
2020-02-18 15:41:56 +01:00
|
|
|
{
|
|
|
|
::FixedText* pLabel = m_xBuilder->get<FixedText>(id);
|
2021-01-12 14:30:05 +01:00
|
|
|
auto pWeldWidget = std::make_unique<JSLabel>(this, pLabel, this, false);
|
2020-03-09 14:11:06 +01:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
2020-03-06 11:11:57 +01:00
|
|
|
|
|
|
|
return pWeldWidget;
|
2020-02-18 15:41:56 +01:00
|
|
|
}
|
|
|
|
|
2020-10-06 09:45:54 +01:00
|
|
|
std::unique_ptr<weld::Button> JSInstanceBuilder::weld_button(const OString& id)
|
2020-02-28 15:10:24 +01:00
|
|
|
{
|
|
|
|
::Button* pButton = m_xBuilder->get<::Button>(id);
|
2021-01-12 14:30:05 +01:00
|
|
|
auto pWeldWidget = pButton ? std::make_unique<JSButton>(this, pButton, this, false) : nullptr;
|
2020-03-09 14:11:06 +01:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
2020-03-06 11:11:57 +01:00
|
|
|
|
|
|
|
return pWeldWidget;
|
2020-02-28 15:10:24 +01:00
|
|
|
}
|
|
|
|
|
2020-10-06 09:45:54 +01:00
|
|
|
std::unique_ptr<weld::Entry> JSInstanceBuilder::weld_entry(const OString& id)
|
2020-02-24 18:35:18 +01:00
|
|
|
{
|
|
|
|
Edit* pEntry = m_xBuilder->get<Edit>(id);
|
2021-01-12 14:30:05 +01:00
|
|
|
auto pWeldWidget = pEntry ? std::make_unique<JSEntry>(this, pEntry, this, false) : nullptr;
|
2020-03-09 14:11:06 +01:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
2020-03-06 11:11:57 +01:00
|
|
|
|
|
|
|
return pWeldWidget;
|
2020-02-24 18:35:18 +01:00
|
|
|
}
|
|
|
|
|
2020-10-06 09:45:54 +01:00
|
|
|
std::unique_ptr<weld::ComboBox> JSInstanceBuilder::weld_combo_box(const OString& id)
|
2020-02-25 13:03:34 +01:00
|
|
|
{
|
|
|
|
vcl::Window* pWidget = m_xBuilder->get<vcl::Window>(id);
|
|
|
|
::ComboBox* pComboBox = dynamic_cast<::ComboBox*>(pWidget);
|
2020-03-06 11:11:57 +01:00
|
|
|
std::unique_ptr<weld::ComboBox> pWeldWidget;
|
|
|
|
|
2020-02-25 13:03:34 +01:00
|
|
|
if (pComboBox)
|
2020-03-06 11:11:57 +01:00
|
|
|
{
|
2021-01-12 14:30:05 +01:00
|
|
|
pWeldWidget = std::make_unique<JSComboBox>(this, pComboBox, this, false);
|
2020-03-06 11:11:57 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ListBox* pListBox = dynamic_cast<ListBox*>(pWidget);
|
2021-01-12 14:30:05 +01:00
|
|
|
pWeldWidget = pListBox ? std::make_unique<JSListBox>(this, pListBox, this, false) : nullptr;
|
2020-03-06 11:11:57 +01:00
|
|
|
}
|
|
|
|
|
2020-03-09 14:11:06 +01:00
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
2020-03-06 11:11:57 +01:00
|
|
|
return pWeldWidget;
|
2020-02-25 13:03:34 +01:00
|
|
|
}
|
|
|
|
|
2020-10-06 09:45:54 +01:00
|
|
|
std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const OString& id)
|
2020-03-04 16:05:10 +01:00
|
|
|
{
|
|
|
|
TabControl* pNotebook = m_xBuilder->get<TabControl>(id);
|
2021-01-12 14:30:05 +01:00
|
|
|
auto pWeldWidget
|
|
|
|
= pNotebook ? std::make_unique<JSNotebook>(this, pNotebook, this, false) : nullptr;
|
2020-03-06 11:11:57 +01:00
|
|
|
|
2020-03-09 14:11:06 +01:00
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
2020-03-06 11:11:57 +01:00
|
|
|
return pWeldWidget;
|
2020-03-04 16:05:10 +01:00
|
|
|
}
|
|
|
|
|
2020-10-06 09:45:54 +01:00
|
|
|
std::unique_ptr<weld::SpinButton> JSInstanceBuilder::weld_spin_button(const OString& id)
|
2020-03-10 17:10:38 +01:00
|
|
|
{
|
|
|
|
FormattedField* pSpinButton = m_xBuilder->get<FormattedField>(id);
|
2021-01-12 14:30:05 +01:00
|
|
|
auto pWeldWidget
|
|
|
|
= pSpinButton ? std::make_unique<JSSpinButton>(this, pSpinButton, this, false) : nullptr;
|
2020-03-10 17:10:38 +01:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2020-10-06 09:45:54 +01:00
|
|
|
std::unique_ptr<weld::CheckButton> JSInstanceBuilder::weld_check_button(const OString& id)
|
2020-03-10 17:10:38 +01:00
|
|
|
{
|
|
|
|
CheckBox* pCheckButton = m_xBuilder->get<CheckBox>(id);
|
2020-10-21 15:45:19 +02:00
|
|
|
auto pWeldWidget
|
2021-01-12 14:30:05 +01:00
|
|
|
= pCheckButton ? std::make_unique<JSCheckButton>(this, pCheckButton, this, false) : nullptr;
|
2020-03-10 17:10:38 +01:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2020-06-15 19:03:09 +02:00
|
|
|
std::unique_ptr<weld::DrawingArea>
|
|
|
|
JSInstanceBuilder::weld_drawing_area(const OString& id, const a11yref& rA11yImpl,
|
2020-10-06 09:45:54 +01:00
|
|
|
FactoryFunction pUITestFactoryFunction, void* pUserData)
|
2020-06-15 19:03:09 +02:00
|
|
|
{
|
|
|
|
VclDrawingArea* pArea = m_xBuilder->get<VclDrawingArea>(id);
|
2021-01-12 14:30:05 +01:00
|
|
|
auto pWeldWidget = pArea ? std::make_unique<JSDrawingArea>(this, pArea, this, rA11yImpl,
|
|
|
|
pUITestFactoryFunction, pUserData)
|
2020-10-06 09:45:54 +01:00
|
|
|
: nullptr;
|
2020-06-15 19:03:09 +02:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2020-10-06 09:45:54 +01:00
|
|
|
std::unique_ptr<weld::Toolbar> JSInstanceBuilder::weld_toolbar(const OString& id)
|
2020-06-16 14:07:32 +02:00
|
|
|
{
|
|
|
|
ToolBox* pToolBox = m_xBuilder->get<ToolBox>(id);
|
2021-01-12 14:30:05 +01:00
|
|
|
auto pWeldWidget
|
|
|
|
= pToolBox ? std::make_unique<JSToolbar>(this, pToolBox, this, false) : nullptr;
|
2020-06-16 14:07:32 +02:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2020-10-06 09:45:54 +01:00
|
|
|
std::unique_ptr<weld::TextView> JSInstanceBuilder::weld_text_view(const OString& id)
|
2020-07-02 14:44:24 +02:00
|
|
|
{
|
|
|
|
VclMultiLineEdit* pTextView = m_xBuilder->get<VclMultiLineEdit>(id);
|
2021-01-12 14:30:05 +01:00
|
|
|
auto pWeldWidget
|
|
|
|
= pTextView ? std::make_unique<JSTextView>(this, pTextView, this, false) : nullptr;
|
2020-07-02 14:44:24 +02:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2020-10-30 10:51:08 +01:00
|
|
|
std::unique_ptr<weld::TreeView> JSInstanceBuilder::weld_tree_view(const OString& id)
|
|
|
|
{
|
|
|
|
SvTabListBox* pTreeView = m_xBuilder->get<SvTabListBox>(id);
|
2021-01-12 14:30:05 +01:00
|
|
|
auto pWeldWidget
|
|
|
|
= pTreeView ? std::make_unique<JSTreeView>(this, pTreeView, this, false) : nullptr;
|
2020-10-30 10:51:08 +01:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2020-11-17 14:32:04 +01:00
|
|
|
std::unique_ptr<weld::Expander> JSInstanceBuilder::weld_expander(const OString& id)
|
|
|
|
{
|
|
|
|
VclExpander* pExpander = m_xBuilder->get<VclExpander>(id);
|
2021-01-12 14:30:05 +01:00
|
|
|
auto pWeldWidget
|
|
|
|
= pExpander ? std::make_unique<JSExpander>(this, pExpander, this, false) : nullptr;
|
2020-11-17 14:32:04 +01:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2020-12-16 23:00:11 +03:00
|
|
|
std::unique_ptr<weld::IconView> JSInstanceBuilder::weld_icon_view(const OString& id)
|
|
|
|
{
|
|
|
|
::IconView* pIconView = m_xBuilder->get<::IconView>(id);
|
|
|
|
auto pWeldWidget
|
|
|
|
= pIconView ? std::make_unique<JSIconView>(this, pIconView, this, false) : nullptr;
|
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2021-01-19 09:19:03 +01:00
|
|
|
std::unique_ptr<weld::RadioButton> JSInstanceBuilder::weld_radio_button(const OString& id)
|
|
|
|
{
|
|
|
|
::RadioButton* pRadioButton = m_xBuilder->get<::RadioButton>(id);
|
|
|
|
auto pWeldWidget
|
|
|
|
= pRadioButton ? std::make_unique<JSRadioButton>(this, pRadioButton, this, false) : nullptr;
|
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2021-06-09 12:06:02 +02:00
|
|
|
std::unique_ptr<weld::Frame> JSInstanceBuilder::weld_frame(const OString& id)
|
|
|
|
{
|
|
|
|
::VclFrame* pFrame = m_xBuilder->get<::VclFrame>(id);
|
|
|
|
auto pWeldWidget = pFrame ? std::make_unique<JSFrame>(this, pFrame, this, false) : nullptr;
|
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2021-06-10 15:40:33 +02:00
|
|
|
std::unique_ptr<weld::MenuButton> JSInstanceBuilder::weld_menu_button(const OString& id)
|
|
|
|
{
|
|
|
|
::MenuButton* pMenuButton = m_xBuilder->get<::MenuButton>(id);
|
|
|
|
auto pWeldWidget
|
|
|
|
= pMenuButton ? std::make_unique<JSMenuButton>(this, pMenuButton, this, false) : nullptr;
|
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2021-06-15 13:10:00 +02:00
|
|
|
std::unique_ptr<weld::Popover> JSInstanceBuilder::weld_popover(const OString& id)
|
|
|
|
{
|
|
|
|
DockingWindow* pDockingWindow = m_xBuilder->get<DockingWindow>(id);
|
2021-06-17 11:50:26 +02:00
|
|
|
std::unique_ptr<weld::Popover> pWeldWidget(
|
2021-06-15 13:10:00 +02:00
|
|
|
pDockingWindow ? new JSPopover(this, pDockingWindow, this, false) : nullptr);
|
|
|
|
if (pDockingWindow)
|
|
|
|
{
|
|
|
|
assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
|
|
|
|
m_aOwnedToplevel.set(pDockingWindow);
|
|
|
|
m_xBuilder->drop_ownership(pDockingWindow);
|
|
|
|
|
|
|
|
if (VclPtr<vcl::Window> pWin = pDockingWindow->GetParentWithLOKNotifier())
|
|
|
|
{
|
2021-06-24 14:31:45 +02:00
|
|
|
vcl::Window* pPopupRoot = pDockingWindow->GetChild(0);
|
|
|
|
pPopupRoot->SetLOKNotifier(pWin->GetLOKNotifier());
|
|
|
|
m_aParentDialog = pPopupRoot;
|
|
|
|
m_aWindowToRelease = pPopupRoot;
|
2021-06-15 13:10:00 +02:00
|
|
|
m_nWindowId = m_aParentDialog->GetLOKWindowId();
|
2021-11-15 09:13:35 +01:00
|
|
|
InsertWindowToMap(getMapIdFromWindowId());
|
2021-06-15 13:10:00 +02:00
|
|
|
initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
|
|
|
|
}
|
|
|
|
}
|
2021-06-17 11:50:26 +02:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget("__POPOVER__", pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
2021-06-15 13:10:00 +02:00
|
|
|
}
|
|
|
|
|
2021-08-20 18:47:52 +02:00
|
|
|
std::unique_ptr<weld::Box> JSInstanceBuilder::weld_box(const OString& id)
|
|
|
|
{
|
|
|
|
VclBox* pContainer = m_xBuilder->get<VclBox>(id);
|
|
|
|
auto pWeldWidget
|
|
|
|
= pContainer ? std::make_unique<JSBox>(this, pContainer, this, false) : nullptr;
|
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2021-09-24 10:08:41 +02:00
|
|
|
std::unique_ptr<weld::Widget> JSInstanceBuilder::weld_widget(const OString& id)
|
|
|
|
{
|
|
|
|
vcl::Window* pWidget = m_xBuilder->get(id);
|
2021-10-05 17:02:56 +02:00
|
|
|
auto pWeldWidget
|
|
|
|
= pWidget ? std::make_unique<JSWidgetInstance>(this, pWidget, this, false) : nullptr;
|
2021-09-24 10:08:41 +02:00
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2021-10-20 10:59:12 +02:00
|
|
|
std::unique_ptr<weld::Image> JSInstanceBuilder::weld_image(const OString& id)
|
|
|
|
{
|
|
|
|
FixedImage* pImage = m_xBuilder->get<FixedImage>(id);
|
|
|
|
|
|
|
|
auto pWeldWidget = pImage ? std::make_unique<JSImage>(this, pImage, this, false) : nullptr;
|
|
|
|
|
|
|
|
if (pWeldWidget)
|
|
|
|
RememberWidget(id, pWeldWidget.get());
|
|
|
|
|
|
|
|
return pWeldWidget;
|
|
|
|
}
|
|
|
|
|
2020-03-17 14:50:39 +01:00
|
|
|
weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent,
|
|
|
|
VclMessageType eMessageType,
|
|
|
|
VclButtonsType eButtonType,
|
|
|
|
const OUString& rPrimaryMessage)
|
|
|
|
{
|
|
|
|
SalInstanceWidget* pParentInstance = dynamic_cast<SalInstanceWidget*>(pParent);
|
|
|
|
SystemWindow* pParentWidget = pParentInstance ? pParentInstance->getSystemWindow() : nullptr;
|
|
|
|
VclPtrInstance<::MessageDialog> xMessageDialog(pParentWidget, rPrimaryMessage, eMessageType,
|
|
|
|
eButtonType);
|
|
|
|
|
|
|
|
const vcl::ILibreOfficeKitNotifier* pNotifier = xMessageDialog->GetLOKNotifier();
|
|
|
|
if (pNotifier)
|
|
|
|
{
|
2020-06-22 16:45:03 +02:00
|
|
|
tools::JsonWriter aJsonWriter;
|
|
|
|
xMessageDialog->DumpAsPropertyTree(aJsonWriter);
|
|
|
|
aJsonWriter.put("id", xMessageDialog->GetLOKWindowId());
|
2020-10-21 15:45:19 +02:00
|
|
|
aJsonWriter.put("jsontype", "dialog");
|
2020-06-22 16:45:03 +02:00
|
|
|
std::unique_ptr<char[], o3tl::free_delete> message(aJsonWriter.extractData());
|
|
|
|
pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.get());
|
2020-03-17 14:50:39 +01:00
|
|
|
}
|
|
|
|
|
2021-03-02 19:09:21 -04:00
|
|
|
xMessageDialog->SetLOKTunnelingState(false);
|
2021-11-23 09:55:00 +01:00
|
|
|
std::string sWindowId = std::to_string(xMessageDialog->GetLOKWindowId());
|
|
|
|
InsertWindowToMap(sWindowId);
|
|
|
|
|
|
|
|
weld::MessageDialog* pRet = new JSMessageDialog(xMessageDialog, nullptr, true);
|
|
|
|
|
|
|
|
if (pRet)
|
|
|
|
RememberWidget(sWindowId, "__DIALOG__", pRet);
|
|
|
|
|
|
|
|
return pRet;
|
2020-03-17 14:50:39 +01:00
|
|
|
}
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSDialog::JSDialog(JSDialogSender* pSender, ::Dialog* pDialog, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceDialog, ::Dialog>(pSender, pDialog, pBuilder, bTakeOwnership)
|
2020-03-18 09:46:03 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSDialog::collapse(weld::Widget* pEdit, weld::Widget* pButton)
|
|
|
|
{
|
|
|
|
SalInstanceDialog::collapse(pEdit, pButton);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendFullUpdate();
|
2020-03-18 09:46:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSDialog::undo_collapse()
|
|
|
|
{
|
|
|
|
SalInstanceDialog::undo_collapse();
|
2021-01-19 12:09:45 +01:00
|
|
|
sendFullUpdate();
|
2020-03-18 09:46:03 +01:00
|
|
|
}
|
|
|
|
|
2020-12-03 11:16:08 +01:00
|
|
|
void JSDialog::response(int response)
|
|
|
|
{
|
2021-02-08 16:58:44 +01:00
|
|
|
if (response == RET_HELP)
|
|
|
|
{
|
|
|
|
response_help(m_xWidget.get());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-12-03 11:16:08 +01:00
|
|
|
sendClose();
|
|
|
|
SalInstanceDialog::response(response);
|
|
|
|
}
|
|
|
|
|
2021-05-18 17:07:30 +02:00
|
|
|
JSContainer::JSContainer(JSDialogSender* pSender, vcl::Window* pContainer,
|
|
|
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceContainer, vcl::Window>(pSender, pContainer, pBuilder, bTakeOwnership)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSLabel::JSLabel(JSDialogSender* pSender, FixedText* pLabel, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceLabel, FixedText>(pSender, pLabel, pBuilder, bTakeOwnership)
|
2020-02-18 15:41:56 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSLabel::set_label(const OUString& rText)
|
|
|
|
{
|
|
|
|
SalInstanceLabel::set_label(rText);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendUpdate();
|
2020-02-18 15:41:56 +01:00
|
|
|
};
|
2020-02-24 18:35:18 +01:00
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSButton::JSButton(JSDialogSender* pSender, ::Button* pButton, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceButton, ::Button>(pSender, pButton, pBuilder, bTakeOwnership)
|
2020-02-28 15:10:24 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSEntry::JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceEntry, ::Edit>(pSender, pEntry, pBuilder, bTakeOwnership)
|
2020-02-24 18:35:18 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSEntry::set_text(const OUString& rText)
|
|
|
|
{
|
|
|
|
SalInstanceEntry::set_text(rText);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-02-24 18:35:18 +01:00
|
|
|
}
|
2020-02-25 13:03:34 +01:00
|
|
|
|
2021-01-19 08:39:15 +01:00
|
|
|
void JSEntry::set_text_without_notify(const OUString& rText) { SalInstanceEntry::set_text(rText); }
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSListBox::JSListBox(JSDialogSender* pSender, ::ListBox* pListBox, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>(pSender, pListBox, pBuilder,
|
|
|
|
bTakeOwnership)
|
2020-02-25 13:03:34 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSListBox::insert(int pos, const OUString& rStr, const OUString* pId,
|
|
|
|
const OUString* pIconName, VirtualDevice* pImageSurface)
|
|
|
|
{
|
|
|
|
SalInstanceComboBoxWithoutEdit::insert(pos, rStr, pId, pIconName, pImageSurface);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-02-25 13:03:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSListBox::remove(int pos)
|
|
|
|
{
|
|
|
|
SalInstanceComboBoxWithoutEdit::remove(pos);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-02-25 13:03:34 +01:00
|
|
|
}
|
|
|
|
|
2020-03-09 14:11:06 +01:00
|
|
|
void JSListBox::set_active(int pos)
|
|
|
|
{
|
|
|
|
SalInstanceComboBoxWithoutEdit::set_active(pos);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-03-09 14:11:06 +01:00
|
|
|
}
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSComboBox::JSComboBox(JSDialogSender* pSender, ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>(pSender, pComboBox, pBuilder,
|
|
|
|
bTakeOwnership)
|
2020-02-25 13:03:34 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSComboBox::insert(int pos, const OUString& rStr, const OUString* pId,
|
|
|
|
const OUString* pIconName, VirtualDevice* pImageSurface)
|
|
|
|
{
|
|
|
|
SalInstanceComboBoxWithEdit::insert(pos, rStr, pId, pIconName, pImageSurface);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-02-25 13:03:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSComboBox::remove(int pos)
|
|
|
|
{
|
|
|
|
SalInstanceComboBoxWithEdit::remove(pos);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-02-25 13:03:34 +01:00
|
|
|
}
|
|
|
|
|
2021-12-08 17:22:37 +01:00
|
|
|
void JSComboBox::set_entry_text_without_notify(const OUString& rText)
|
|
|
|
{
|
|
|
|
SalInstanceComboBoxWithEdit::set_entry_text(rText);
|
|
|
|
}
|
|
|
|
|
2020-02-25 13:03:34 +01:00
|
|
|
void JSComboBox::set_entry_text(const OUString& rText)
|
|
|
|
{
|
|
|
|
SalInstanceComboBoxWithEdit::set_entry_text(rText);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-02-25 13:03:34 +01:00
|
|
|
}
|
2020-03-04 16:05:10 +01:00
|
|
|
|
2020-03-05 14:42:44 +01:00
|
|
|
void JSComboBox::set_active(int pos)
|
|
|
|
{
|
|
|
|
SalInstanceComboBoxWithEdit::set_active(pos);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-03-05 14:42:44 +01:00
|
|
|
}
|
|
|
|
|
2021-05-21 17:24:17 +02:00
|
|
|
bool JSComboBox::changed_by_direct_pick() const { return true; }
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSNotebook::JSNotebook(JSDialogSender* pSender, ::TabControl* pControl,
|
|
|
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceNotebook, ::TabControl>(pSender, pControl, pBuilder, bTakeOwnership)
|
2020-03-04 16:05:10 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSNotebook::set_current_page(int nPage)
|
|
|
|
{
|
2020-07-07 13:15:31 +02:00
|
|
|
bool bForce = false;
|
|
|
|
int nCurrent = get_current_page();
|
|
|
|
if (nCurrent == nPage)
|
|
|
|
bForce = true;
|
|
|
|
|
2020-03-04 16:05:10 +01:00
|
|
|
SalInstanceNotebook::set_current_page(nPage);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendFullUpdate(bForce);
|
2021-10-25 15:02:30 +02:00
|
|
|
|
|
|
|
m_aEnterPageHdl.Call(get_current_page_ident());
|
2020-03-04 16:05:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSNotebook::set_current_page(const OString& rIdent)
|
|
|
|
{
|
2020-07-07 13:15:31 +02:00
|
|
|
bool bForce = false;
|
|
|
|
OString sCurrent = get_current_page_ident();
|
|
|
|
if (sCurrent == rIdent)
|
|
|
|
bForce = true;
|
|
|
|
|
2020-03-04 16:05:10 +01:00
|
|
|
SalInstanceNotebook::set_current_page(rIdent);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendFullUpdate(bForce);
|
2021-10-25 15:02:30 +02:00
|
|
|
|
|
|
|
m_aEnterPageHdl.Call(get_current_page_ident());
|
2020-03-04 16:05:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSNotebook::remove_page(const OString& rIdent)
|
|
|
|
{
|
|
|
|
SalInstanceNotebook::remove_page(rIdent);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendFullUpdate();
|
2020-03-04 16:05:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSNotebook::insert_page(const OString& rIdent, const OUString& rLabel, int nPos)
|
|
|
|
{
|
|
|
|
SalInstanceNotebook::insert_page(rIdent, rLabel, nPos);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendFullUpdate();
|
2020-03-04 16:05:10 +01:00
|
|
|
}
|
2020-03-17 14:50:39 +01:00
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSSpinButton::JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin,
|
|
|
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceSpinButton, ::FormattedField>(pSender, pSpin, pBuilder, bTakeOwnership)
|
2020-03-10 17:10:38 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSSpinButton::set_value(int value)
|
|
|
|
{
|
|
|
|
SalInstanceSpinButton::set_value(value);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate(true); // if input is limited we can receive the same JSON
|
2020-03-10 17:10:38 +01:00
|
|
|
}
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSMessageDialog::JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog,
|
2020-10-21 15:45:19 +02:00
|
|
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
2021-01-12 14:30:05 +01:00
|
|
|
: JSWidget<SalInstanceMessageDialog, ::MessageDialog>(pSender, pDialog, pBuilder,
|
|
|
|
bTakeOwnership)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceMessageDialog, ::MessageDialog>(nullptr, pDialog, pBuilder,
|
|
|
|
bTakeOwnership)
|
|
|
|
, m_pOwnedSender(new JSDialogSender(pDialog, pDialog, "dialog"))
|
2020-03-17 14:50:39 +01:00
|
|
|
{
|
2021-01-12 14:30:05 +01:00
|
|
|
m_pSender = m_pOwnedSender.get();
|
2021-03-02 19:09:21 -04:00
|
|
|
|
2021-10-21 12:31:03 +02:00
|
|
|
if (pBuilder)
|
|
|
|
return;
|
|
|
|
|
2021-11-23 09:55:00 +01:00
|
|
|
m_sWindowId = std::to_string(m_xMessageDialog->GetLOKWindowId());
|
|
|
|
|
2021-10-21 12:31:03 +02:00
|
|
|
if (::OKButton* pOKBtn
|
|
|
|
= dynamic_cast<::OKButton*>(m_xMessageDialog->get_widget_for_response(RET_OK)))
|
2021-03-02 19:09:21 -04:00
|
|
|
{
|
2021-10-21 12:31:03 +02:00
|
|
|
m_pOK.reset(new JSButton(m_pSender, pOKBtn, nullptr, false));
|
2021-11-23 09:55:00 +01:00
|
|
|
JSInstanceBuilder::AddChildWidget(m_sWindowId, pOKBtn->get_id().toUtf8(), m_pOK.get());
|
2021-10-21 12:31:03 +02:00
|
|
|
m_pOK->connect_clicked(LINK(this, JSMessageDialog, OKHdl));
|
|
|
|
}
|
2021-03-02 19:09:21 -04:00
|
|
|
|
2021-10-21 12:31:03 +02:00
|
|
|
if (::CancelButton* pCancelBtn
|
|
|
|
= dynamic_cast<::CancelButton*>(m_xMessageDialog->get_widget_for_response(RET_CANCEL)))
|
|
|
|
{
|
|
|
|
m_pCancel.reset(new JSButton(m_pSender, pCancelBtn, nullptr, false));
|
2021-11-23 09:55:00 +01:00
|
|
|
JSInstanceBuilder::AddChildWidget(m_sWindowId, pCancelBtn->get_id().toUtf8(),
|
|
|
|
m_pCancel.get());
|
2021-10-21 12:31:03 +02:00
|
|
|
m_pCancel->connect_clicked(LINK(this, JSMessageDialog, CancelHdl));
|
2021-03-02 19:09:21 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
JSMessageDialog::~JSMessageDialog()
|
|
|
|
{
|
|
|
|
if (m_pOK || m_pCancel)
|
2021-11-23 09:55:00 +01:00
|
|
|
JSInstanceBuilder::RemoveWindowWidget(m_sWindowId);
|
2020-03-17 14:50:39 +01:00
|
|
|
}
|
|
|
|
|
2021-03-02 19:09:21 -04:00
|
|
|
IMPL_LINK_NOARG(JSMessageDialog, OKHdl, weld::Button&, void) { response(RET_OK); }
|
|
|
|
|
|
|
|
IMPL_LINK_NOARG(JSMessageDialog, CancelHdl, weld::Button&, void) { response(RET_CANCEL); }
|
|
|
|
|
2020-03-17 14:50:39 +01:00
|
|
|
void JSMessageDialog::set_primary_text(const OUString& rText)
|
|
|
|
{
|
|
|
|
SalInstanceMessageDialog::set_primary_text(rText);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendFullUpdate();
|
2020-03-17 14:50:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSMessageDialog::set_secondary_text(const OUString& rText)
|
|
|
|
{
|
|
|
|
SalInstanceMessageDialog::set_secondary_text(rText);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendFullUpdate();
|
2020-03-17 14:50:39 +01:00
|
|
|
}
|
2020-03-10 17:10:38 +01:00
|
|
|
|
2021-02-08 16:58:44 +01:00
|
|
|
void JSMessageDialog::response(int response)
|
|
|
|
{
|
|
|
|
if (response == RET_HELP)
|
|
|
|
{
|
|
|
|
response_help(m_xWidget.get());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sendClose();
|
|
|
|
SalInstanceMessageDialog::response(response);
|
|
|
|
}
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSCheckButton::JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox,
|
|
|
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceCheckButton, ::CheckBox>(pSender, pCheckBox, pBuilder, bTakeOwnership)
|
2020-03-10 17:10:38 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSCheckButton::set_active(bool active)
|
|
|
|
{
|
2021-06-09 10:57:41 +02:00
|
|
|
bool bWasActive = get_active();
|
2020-03-10 17:10:38 +01:00
|
|
|
SalInstanceCheckButton::set_active(active);
|
2021-06-09 10:57:41 +02:00
|
|
|
if (bWasActive != active)
|
|
|
|
sendUpdate();
|
2020-03-10 17:10:38 +01:00
|
|
|
}
|
2020-05-21 09:24:31 +02:00
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSDrawingArea::JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingArea,
|
2020-06-15 19:03:09 +02:00
|
|
|
SalInstanceBuilder* pBuilder, const a11yref& rAlly,
|
2021-01-12 14:30:05 +01:00
|
|
|
FactoryFunction pUITestFactoryFunction, void* pUserData)
|
|
|
|
: JSWidget<SalInstanceDrawingArea, VclDrawingArea>(pSender, pDrawingArea, pBuilder, rAlly,
|
|
|
|
pUITestFactoryFunction, pUserData, false)
|
2020-06-15 19:03:09 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSDrawingArea::queue_draw()
|
|
|
|
{
|
|
|
|
SalInstanceDrawingArea::queue_draw();
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-06-15 19:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSDrawingArea::queue_draw_area(int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
SalInstanceDrawingArea::queue_draw_area(x, y, width, height);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-06-15 19:03:09 +02:00
|
|
|
}
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSToolbar::JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceToolbar, ::ToolBox>(pSender, pToolbox, pBuilder, bTakeOwnership)
|
2020-06-16 14:07:32 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-06-24 14:31:45 +02:00
|
|
|
void JSToolbar::set_menu_item_active(const OString& rIdent, bool bActive)
|
|
|
|
{
|
2021-07-07 11:13:06 +02:00
|
|
|
bool bWasActive = get_menu_item_active(rIdent);
|
2021-06-24 14:31:45 +02:00
|
|
|
SalInstanceToolbar::set_menu_item_active(rIdent, bActive);
|
|
|
|
|
|
|
|
ToolBoxItemId nItemId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent));
|
|
|
|
VclPtr<vcl::Window> pFloat = m_aFloats[nItemId];
|
|
|
|
|
2021-10-21 12:31:03 +02:00
|
|
|
if (!pFloat)
|
|
|
|
return;
|
2021-06-24 14:31:45 +02:00
|
|
|
|
2021-10-21 12:31:03 +02:00
|
|
|
// See WeldToolbarPopup : include/svtools/toolbarmenu.hxx
|
|
|
|
// TopLevel (Popover) -> Container -> main container of the popup
|
|
|
|
vcl::Window* pPopupRoot = pFloat->GetChild(0);
|
|
|
|
if (pPopupRoot)
|
|
|
|
pPopupRoot = pPopupRoot->GetChild(0);
|
|
|
|
|
|
|
|
if (pPopupRoot)
|
|
|
|
{
|
|
|
|
if (bActive)
|
|
|
|
sendPopup(pPopupRoot, m_xToolBox->get_id(),
|
|
|
|
OStringToOUString(rIdent, RTL_TEXTENCODING_ASCII_US));
|
|
|
|
else if (bWasActive)
|
|
|
|
sendClosePopup(pPopupRoot->GetLOKWindowId());
|
2021-06-24 14:31:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-25 10:22:15 +02:00
|
|
|
void JSToolbar::set_item_sensitive(const OString& rIdent, bool bSensitive)
|
|
|
|
{
|
|
|
|
SalInstanceToolbar::set_item_sensitive(rIdent, bSensitive);
|
|
|
|
sendUpdate();
|
|
|
|
}
|
|
|
|
|
2021-07-06 11:50:38 +02:00
|
|
|
void JSToolbar::set_item_icon_name(const OString& rIdent, const OUString& rIconName)
|
|
|
|
{
|
|
|
|
SalInstanceToolbar::set_item_icon_name(rIdent, rIconName);
|
|
|
|
sendUpdate();
|
|
|
|
}
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSTextView::JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView,
|
|
|
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceTextView, ::VclMultiLineEdit>(pSender, pTextView, pBuilder,
|
|
|
|
bTakeOwnership)
|
2020-07-02 14:44:24 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSTextView::set_text(const OUString& rText)
|
|
|
|
{
|
|
|
|
SalInstanceTextView::set_text(rText);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-07-02 14:44:24 +02:00
|
|
|
}
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSTreeView::JSTreeView(JSDialogSender* pSender, ::SvTabListBox* pTreeView,
|
|
|
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceTreeView, ::SvTabListBox>(pSender, pTreeView, pBuilder, bTakeOwnership)
|
2020-10-30 10:51:08 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSTreeView::set_toggle(int pos, TriState eState, int col)
|
|
|
|
{
|
|
|
|
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, 0);
|
|
|
|
|
|
|
|
while (pEntry && pos--)
|
|
|
|
pEntry = m_xTreeView->Next(pEntry);
|
|
|
|
|
|
|
|
if (pEntry)
|
2020-11-12 14:28:47 +01:00
|
|
|
{
|
2020-10-30 10:51:08 +01:00
|
|
|
SalInstanceTreeView::set_toggle(pEntry, eState, col);
|
2020-11-12 14:28:47 +01:00
|
|
|
signal_toggled(iter_col(SalInstanceTreeIter(pEntry), col));
|
|
|
|
|
2021-01-19 12:09:45 +01:00
|
|
|
sendUpdate();
|
2020-11-12 14:28:47 +01:00
|
|
|
}
|
2020-10-30 10:51:08 +01:00
|
|
|
}
|
|
|
|
|
2021-01-25 15:04:17 +01:00
|
|
|
void JSTreeView::set_toggle(const weld::TreeIter& rIter, TriState bOn, int col)
|
|
|
|
{
|
|
|
|
SalInstanceTreeView::set_toggle(rIter, bOn, col);
|
|
|
|
sendUpdate();
|
|
|
|
}
|
|
|
|
|
2020-10-30 10:51:08 +01:00
|
|
|
void JSTreeView::select(int pos)
|
|
|
|
{
|
|
|
|
assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
|
|
|
|
disable_notify_events();
|
|
|
|
if (pos == -1 || (pos == 0 && n_children() == 0))
|
|
|
|
m_xTreeView->SelectAll(false);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, 0);
|
|
|
|
|
|
|
|
while (pEntry && pos--)
|
|
|
|
pEntry = m_xTreeView->Next(pEntry);
|
|
|
|
|
|
|
|
if (pEntry)
|
|
|
|
{
|
|
|
|
m_xTreeView->Select(pEntry, true);
|
|
|
|
m_xTreeView->MakeVisible(pEntry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
enable_notify_events();
|
2021-02-22 15:16:06 -04:00
|
|
|
sendUpdate();
|
2020-10-30 10:51:08 +01:00
|
|
|
}
|
|
|
|
|
2020-11-18 10:12:38 +01:00
|
|
|
weld::TreeView* JSTreeView::get_drag_source() const { return g_DragSource; }
|
|
|
|
|
|
|
|
void JSTreeView::drag_start() { g_DragSource = this; }
|
|
|
|
|
|
|
|
void JSTreeView::drag_end()
|
|
|
|
{
|
|
|
|
css::datatransfer::dnd::XDropTarget* xDropTarget = m_xDropTarget.get();
|
|
|
|
if (xDropTarget)
|
|
|
|
{
|
|
|
|
css::datatransfer::dnd::DropTargetDropEvent aEvent;
|
|
|
|
aEvent.Source = xDropTarget;
|
|
|
|
aEvent.Context = new JSDropTargetDropContext();
|
|
|
|
// dummy values
|
|
|
|
aEvent.LocationX = 50;
|
|
|
|
aEvent.LocationY = 50;
|
|
|
|
aEvent.DropAction = css::datatransfer::dnd::DNDConstants::ACTION_DEFAULT;
|
|
|
|
aEvent.SourceActions = css::datatransfer::dnd::DNDConstants::ACTION_DEFAULT;
|
|
|
|
|
|
|
|
m_xDropTarget->fire_drop(aEvent);
|
|
|
|
|
2021-01-19 12:09:45 +01:00
|
|
|
sendUpdate();
|
|
|
|
if (g_DragSource)
|
|
|
|
g_DragSource->sendUpdate();
|
2020-11-18 10:12:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
g_DragSource = nullptr;
|
|
|
|
}
|
|
|
|
|
2020-12-16 10:18:15 +01:00
|
|
|
void JSTreeView::insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
|
|
|
|
const OUString* pId, const OUString* pIconName,
|
|
|
|
VirtualDevice* pImageSurface, bool bChildrenOnDemand, weld::TreeIter* pRet)
|
|
|
|
{
|
|
|
|
SalInstanceTreeView::insert(pParent, pos, pStr, pId, pIconName, pImageSurface,
|
|
|
|
bChildrenOnDemand, pRet);
|
|
|
|
|
2021-01-19 12:09:45 +01:00
|
|
|
sendUpdate();
|
2020-12-16 10:18:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSTreeView::set_text(int row, const OUString& rText, int col)
|
|
|
|
{
|
|
|
|
SalInstanceTreeView::set_text(row, rText, col);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendUpdate();
|
2020-12-16 10:18:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSTreeView::set_text(const weld::TreeIter& rIter, const OUString& rStr, int col)
|
|
|
|
{
|
|
|
|
SalInstanceTreeView::set_text(rIter, rStr, col);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendUpdate();
|
2020-12-29 09:03:14 +01:00
|
|
|
}
|
|
|
|
|
2021-02-10 08:04:06 +01:00
|
|
|
void JSTreeView::remove(int pos)
|
|
|
|
{
|
|
|
|
SalInstanceTreeView::remove(pos);
|
|
|
|
sendUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSTreeView::remove(const weld::TreeIter& rIter)
|
|
|
|
{
|
|
|
|
SalInstanceTreeView::remove(rIter);
|
|
|
|
sendUpdate();
|
|
|
|
}
|
|
|
|
|
2021-03-01 10:01:42 +01:00
|
|
|
void JSTreeView::clear()
|
|
|
|
{
|
|
|
|
SalInstanceTreeView::clear();
|
|
|
|
sendUpdate();
|
|
|
|
}
|
|
|
|
|
2020-12-29 09:03:14 +01:00
|
|
|
void JSTreeView::expand_row(const weld::TreeIter& rIter)
|
|
|
|
{
|
|
|
|
SalInstanceTreeView::expand_row(rIter);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendUpdate();
|
2020-12-29 09:03:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSTreeView::collapse_row(const weld::TreeIter& rIter)
|
|
|
|
{
|
|
|
|
SalInstanceTreeView::collapse_row(rIter);
|
2021-01-19 12:09:45 +01:00
|
|
|
sendUpdate();
|
2020-12-16 10:18:15 +01:00
|
|
|
}
|
|
|
|
|
2021-01-12 14:30:05 +01:00
|
|
|
JSExpander::JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander,
|
|
|
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceExpander, ::VclExpander>(pSender, pExpander, pBuilder, bTakeOwnership)
|
2020-11-17 14:32:04 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSExpander::set_expanded(bool bExpand)
|
|
|
|
{
|
|
|
|
SalInstanceExpander::set_expanded(bExpand);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-11-17 14:32:04 +01:00
|
|
|
}
|
|
|
|
|
2020-12-16 23:00:11 +03:00
|
|
|
JSIconView::JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceIconView, ::IconView>(pSender, pIconView, pBuilder, bTakeOwnership)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSIconView::insert(int pos, const OUString* pStr, const OUString* pId,
|
|
|
|
const OUString* pIconName, weld::TreeIter* pRet)
|
|
|
|
{
|
|
|
|
SalInstanceIconView::insert(pos, pStr, pId, pIconName, pRet);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-12-16 23:00:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSIconView::insert(int pos, const OUString* pStr, const OUString* pId,
|
|
|
|
const VirtualDevice* pIcon, weld::TreeIter* pRet)
|
|
|
|
{
|
|
|
|
SalInstanceIconView::insert(pos, pStr, pId, pIcon, pRet);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-12-16 23:00:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSIconView::clear()
|
|
|
|
{
|
|
|
|
SalInstanceIconView::clear();
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-12-16 23:00:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSIconView::select(int pos)
|
|
|
|
{
|
|
|
|
SalInstanceIconView::select(pos);
|
2021-03-01 19:27:04 +01:00
|
|
|
|
|
|
|
std::unique_ptr<ActionDataMap> pMap = std::make_unique<ActionDataMap>();
|
|
|
|
(*pMap)[ACTION_TYPE] = "select";
|
|
|
|
(*pMap)["position"] = OUString::number(pos);
|
|
|
|
sendAction(std::move(pMap));
|
2020-12-16 23:00:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void JSIconView::unselect(int pos)
|
|
|
|
{
|
|
|
|
SalInstanceIconView::unselect(pos);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2020-12-16 23:00:11 +03:00
|
|
|
}
|
|
|
|
|
2021-01-19 09:19:03 +01:00
|
|
|
JSRadioButton::JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButton,
|
|
|
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceRadioButton, ::RadioButton>(pSender, pRadioButton, pBuilder,
|
|
|
|
bTakeOwnership)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSRadioButton::set_active(bool active)
|
|
|
|
{
|
|
|
|
SalInstanceRadioButton::set_active(active);
|
2021-01-15 11:38:50 +01:00
|
|
|
sendUpdate();
|
2021-01-19 09:19:03 +01:00
|
|
|
}
|
|
|
|
|
2021-06-09 12:06:02 +02:00
|
|
|
JSFrame::JSFrame(JSDialogSender* pSender, ::VclFrame* pFrame, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceFrame, ::VclFrame>(pSender, pFrame, pBuilder, bTakeOwnership)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-06-10 15:40:33 +02:00
|
|
|
JSMenuButton::JSMenuButton(JSDialogSender* pSender, ::MenuButton* pMenuButton,
|
|
|
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceMenuButton, ::MenuButton>(pSender, pMenuButton, pBuilder, bTakeOwnership)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-06-14 10:07:02 +02:00
|
|
|
void JSMenuButton::set_label(const OUString& rText)
|
|
|
|
{
|
|
|
|
OUString aPreviousLabel = get_label();
|
|
|
|
SalInstanceMenuButton::set_label(rText);
|
|
|
|
if (aPreviousLabel != rText)
|
|
|
|
sendUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSMenuButton::set_image(VirtualDevice* pDevice)
|
|
|
|
{
|
|
|
|
SalInstanceMenuButton::set_image(pDevice);
|
|
|
|
sendUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSMenuButton::set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage)
|
|
|
|
{
|
|
|
|
SalInstanceMenuButton::set_image(rImage);
|
|
|
|
sendUpdate();
|
|
|
|
}
|
|
|
|
|
2021-06-24 14:31:45 +02:00
|
|
|
void JSMenuButton::set_active(bool bActive)
|
2021-06-15 13:10:00 +02:00
|
|
|
{
|
2021-06-24 14:31:45 +02:00
|
|
|
SalInstanceMenuButton::set_active(bActive);
|
|
|
|
|
|
|
|
VclPtr<vcl::Window> pPopup = m_xMenuButton->GetPopover();
|
|
|
|
if (pPopup)
|
|
|
|
{
|
|
|
|
if (bActive)
|
|
|
|
sendPopup(pPopup->GetChild(0), m_xMenuButton->get_id(), m_xMenuButton->get_id());
|
|
|
|
else
|
|
|
|
sendClosePopup(pPopup->GetChild(0)->GetLOKWindowId());
|
|
|
|
}
|
2021-06-15 13:10:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
JSPopover::JSPopover(JSDialogSender* pSender, DockingWindow* pDockingWindow,
|
|
|
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstancePopover, DockingWindow>(pSender, pDockingWindow, pBuilder, bTakeOwnership)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-11-22 10:50:03 +01:00
|
|
|
void JSPopover::popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect,
|
|
|
|
weld::Placement ePlace)
|
|
|
|
{
|
|
|
|
SalInstancePopover::popup_at_rect(pParent, rRect, ePlace);
|
|
|
|
sendPopup(getWidget()->GetChild(0), "_POPOVER_", "_POPOVER_");
|
|
|
|
}
|
|
|
|
|
|
|
|
void JSPopover::popdown()
|
|
|
|
{
|
|
|
|
if (getWidget() && getWidget()->GetChild(0))
|
|
|
|
sendClosePopup(getWidget()->GetChild(0)->GetLOKWindowId());
|
|
|
|
SalInstancePopover::popdown();
|
|
|
|
}
|
|
|
|
|
2021-08-20 18:47:52 +02:00
|
|
|
JSBox::JSBox(JSDialogSender* pSender, VclBox* pBox, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceBox, VclBox>(pSender, pBox, pBuilder, bTakeOwnership)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-10-20 10:59:12 +02:00
|
|
|
JSImage::JSImage(JSDialogSender* pSender, FixedImage* pImage, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership)
|
|
|
|
: JSWidget<SalInstanceImage, FixedImage>(pSender, pImage, pBuilder, bTakeOwnership)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-05-21 09:24:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|