[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - vcl/inc vcl/jsdialog vcl/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 28 08:13:36 UTC 2021
vcl/inc/jsdialog/jsdialogbuilder.hxx | 1 +
vcl/jsdialog/enabled.cxx | 8 +++++++-
vcl/jsdialog/executor.cxx | 6 ++++++
vcl/jsdialog/jsdialogbuilder.cxx | 28 +++++++++++++++++++++++++++-
vcl/source/window/window.cxx | 3 +++
5 files changed, 44 insertions(+), 2 deletions(-)
New commits:
commit a135076e65deb79b8cfc73011d3aebd42b4d4166
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Jun 25 10:22:15 2021 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Jun 28 10:13:02 2021 +0200
jsdialog: handle toolbox menus toggling
Change-Id: I85881531f041cbd5402ac8de2a96b2c7150cbba8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117839
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index fdd952f93968..c8282783b3e3 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -564,6 +564,7 @@ public:
bool bTakeOwnership);
virtual void set_menu_item_active(const OString& rIdent, bool bActive) override;
+ virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override;
};
class JSTextView : public JSWidget<SalInstanceTextView, ::VclMultiLineEdit>
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index fbb111f59289..dfadee95019c 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -62,7 +62,13 @@ bool isBuilderEnabled(const OUString& rUIFile, bool bMobile)
bool isBuilderEnabledForPopup(const OUString& rUIFile)
{
- if (rUIFile == "svx/ui/colorwindow.ui" || rUIFile == "modules/scalc/ui/floatinglinestyle.ui")
+ if (rUIFile == "svx/ui/colorwindow.ui" || rUIFile == "modules/scalc/ui/floatinglinestyle.ui"
+ || rUIFile == "svx/ui/textcharacterspacingcontrol.ui"
+ || rUIFile == "svx/ui/currencywindow.ui"
+ || rUIFile == "modules/scalc/ui/floatingborderstyle.ui"
+ || rUIFile == "svx/ui/textunderlinecontrol.ui" || rUIFile == "svx/ui/numberingwindow.ui"
+ || rUIFile == "svx/ui/paralinespacingcontrol.ui"
+ || rUIFile == "svx/ui/floatinglineproperty.ui" || rUIFile == "svx/ui/floatinglinestyle.ui")
return true;
return false;
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 28148b0f1578..bddf849d503f 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -236,6 +236,12 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
*pToolbar, OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US));
return true;
}
+ else if (sAction == "togglemenu")
+ {
+ pToolbar->set_menu_item_active(
+ OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US), true);
+ return true;
+ }
}
}
else if (sControlType == "edit")
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index c58eaf00e3fd..7e42f40f421c 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -306,11 +306,16 @@ void JSDialogNotifyIdle::clearQueue() { m_aMessageQueue.clear(); }
JSDialogSender::~JSDialogSender()
{
sendClose();
- mpIdleNotify->Stop();
+
+ if (mpIdleNotify)
+ mpIdleNotify->Stop();
}
void JSDialogSender::sendFullUpdate(bool bForce)
{
+ if (!mpIdleNotify)
+ return;
+
if (bForce)
mpIdleNotify->forceUpdate();
@@ -320,6 +325,9 @@ void JSDialogSender::sendFullUpdate(bool bForce)
void JSDialogSender::sendClose()
{
+ if (!mpIdleNotify)
+ return;
+
mpIdleNotify->clearQueue();
mpIdleNotify->sendMessage(jsdialog::MessageType::Close, nullptr);
flush();
@@ -327,6 +335,9 @@ void JSDialogSender::sendClose()
void JSDialogSender::sendUpdate(VclPtr<vcl::Window> pWindow, bool bForce)
{
+ if (!mpIdleNotify)
+ return;
+
if (bForce)
mpIdleNotify->forceUpdate();
@@ -336,12 +347,18 @@ void JSDialogSender::sendUpdate(VclPtr<vcl::Window> pWindow, bool bForce)
void JSDialogSender::sendAction(VclPtr<vcl::Window> pWindow, std::unique_ptr<ActionDataMap> pData)
{
+ if (!mpIdleNotify)
+ return;
+
mpIdleNotify->sendMessage(jsdialog::MessageType::Action, pWindow, std::move(pData));
mpIdleNotify->Start();
}
void JSDialogSender::sendPopup(VclPtr<vcl::Window> pWindow, OUString sParentId, OUString sCloseId)
{
+ if (!mpIdleNotify)
+ return;
+
std::unique_ptr<ActionDataMap> pData = std::make_unique<ActionDataMap>();
(*pData)[PARENT_ID] = sParentId;
(*pData)[CLOSE_ID] = sCloseId;
@@ -351,6 +368,9 @@ void JSDialogSender::sendPopup(VclPtr<vcl::Window> pWindow, OUString sParentId,
void JSDialogSender::sendClosePopup(vcl::LOKWindowId nWindowId)
{
+ if (!mpIdleNotify)
+ return;
+
std::unique_ptr<ActionDataMap> pData = std::make_unique<ActionDataMap>();
(*pData)[WINDOW_ID] = OUString::number(nWindowId);
mpIdleNotify->sendMessage(jsdialog::MessageType::Popup, nullptr, std::move(pData));
@@ -1357,6 +1377,12 @@ void JSToolbar::set_menu_item_active(const OString& rIdent, bool bActive)
}
}
+void JSToolbar::set_item_sensitive(const OString& rIdent, bool bSensitive)
+{
+ SalInstanceToolbar::set_item_sensitive(rIdent, bSensitive);
+ sendUpdate();
+}
+
JSTextView::JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView,
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
: JSWidget<SalInstanceTextView, ::VclMultiLineEdit>(pSender, pTextView, pBuilder,
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 967dc1375679..b7f62400eb34 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3347,6 +3347,9 @@ const char* windowTypeName(WindowType nWindowType)
void Window::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
{
+ if (!mpWindowImpl)
+ return;
+
rJsonWriter.put("id", get_id()); // TODO could be missing - sort out
rJsonWriter.put("type", windowTypeName(GetType()));
rJsonWriter.put("text", GetText());
More information about the Libreoffice-commits
mailing list