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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 14 09:23:49 UTC 2021


 include/vcl/jsdialog/executor.hxx |    9 ++++++++-
 include/vcl/weld.hxx              |    2 ++
 vcl/jsdialog/executor.cxx         |   30 ++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit e87119a3a9bca74274cf7ec46eda550c14929dc0
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jan 11 09:47:33 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Jan 14 10:23:00 2021 +0100

    jsdialog: execute IconView actions
    
    Change-Id: If94df547096a5adb15ace432695f91ee7e879bb6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109078
    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/+/109257
    Tested-by: Jenkins

diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx
index 0c7abbf693ca..159b1dccd730 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -22,6 +22,10 @@ public:
 
     static void trigger_changed(weld::ComboBox& rComboBox) { rComboBox.signal_changed(); }
 
+    static void trigger_changed(weld::TreeView& rTreeView) { rTreeView.signal_changed(); }
+
+    static void trigger_changed(weld::IconView& rIconView) { rIconView.signal_selection_changed(); }
+
     static void trigger_toggled(weld::ToggleButton& rButton) { rButton.signal_toggled(); }
 
     static void trigger_row_activated(weld::TreeView& rTreeView)
@@ -29,7 +33,10 @@ public:
         rTreeView.signal_row_activated();
     }
 
-    static void trigger_changed(weld::TreeView& rTreeView) { rTreeView.signal_changed(); }
+    static void trigger_item_activated(weld::IconView& rIconView)
+    {
+        rIconView.signal_item_activated();
+    }
 
     static void trigger_clicked(weld::Toolbar& rToolbar, const OString& rIdent)
     {
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 29167234a31c..fcf0749f96c7 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1238,6 +1238,8 @@ public:
 
 class VCL_DLLPUBLIC IconView : virtual public Container
 {
+    friend class ::LOKTrigger;
+
 private:
     OUString m_sSavedValue;
 
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index da2cea423d3d..dc05c0f75f01 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -250,6 +250,36 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
                 }
             }
         }
+        else if (sControlType == "iconview")
+        {
+            auto pIconView = dynamic_cast<weld::IconView*>(pWidget);
+            if (pIconView)
+            {
+                if (sAction == "select")
+                {
+                    OString nPosString
+                        = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
+                    int nPos = std::atoi(nPosString.getStr());
+
+                    pIconView->select(nPos);
+                    LOKTrigger::trigger_changed(*pIconView);
+
+                    return true;
+                }
+                else if (sAction == "activate")
+                {
+                    OString nPosString
+                        = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
+                    int nPos = std::atoi(nPosString.getStr());
+
+                    pIconView->select(nPos);
+                    LOKTrigger::trigger_changed(*pIconView);
+                    LOKTrigger::trigger_item_activated(*pIconView);
+
+                    return true;
+                }
+            }
+        }
         else if (sControlType == "expander")
         {
             auto pExpander = dynamic_cast<weld::Expander*>(pWidget);


More information about the Libreoffice-commits mailing list