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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 29 09:05:29 UTC 2021


 vcl/inc/jsdialog/jsdialogbuilder.hxx |    1 +
 vcl/jsdialog/enabled.cxx             |    9 ++++++++-
 vcl/jsdialog/executor.cxx            |    6 ++++++
 vcl/jsdialog/jsdialogbuilder.cxx     |   28 +++++++++++++++++++++++++++-
 vcl/source/window/window.cxx         |    3 +++
 5 files changed, 45 insertions(+), 2 deletions(-)

New commits:
commit 77c39371e3c2965982006f3d060148d05839e95b
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: Thu Jul 29 11:04:54 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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119609
    Tested-by: Jenkins

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 92acff3fc594..ee17dac321b2 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -565,6 +565,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 final : public JSWidget<SalInstanceTextView, ::VclMultiLineEdit>
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 67a7cb90c1f0..90ffcdc8dd5d 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -61,7 +61,14 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile)
 
 bool isBuilderEnabledForPopup(std::u16string_view rUIFile)
 {
-    if (rUIFile == u"svx/ui/colorwindow.ui" || rUIFile == u"modules/scalc/ui/floatinglinestyle.ui")
+    if (rUIFile == u"svx/ui/colorwindow.ui" || rUIFile == u"modules/scalc/ui/floatinglinestyle.ui"
+        || rUIFile == u"svx/ui/textcharacterspacingcontrol.ui"
+        || rUIFile == u"svx/ui/currencywindow.ui"
+        || rUIFile == u"modules/scalc/ui/floatingborderstyle.ui"
+        || rUIFile == u"svx/ui/textunderlinecontrol.ui" || rUIFile == u"svx/ui/numberingwindow.ui"
+        || rUIFile == u"svx/ui/paralinespacingcontrol.ui"
+        || rUIFile == u"svx/ui/floatinglineproperty.ui"
+        || rUIFile == u"svx/ui/floatinglinestyle.ui")
         return true;
 
     return false;
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index c1882d5a2d5b..613cf7f5d26d 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -231,6 +231,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 9526b9e020fa..879ae9bf9d72 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -306,11 +306,16 @@ void JSDialogNotifyIdle::clearQueue() { m_aMessageQueue.clear(); }
 JSDialogSender::~JSDialogSender() COVERITY_NOEXCEPT_FALSE
 {
     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 88a2b24e1b35..c3897fddda76 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3346,6 +3346,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