LibreOffice Module vcl (master)  1
executor.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #pragma once
11 
12 #include <vcl/dllapi.h>
13 #include <vcl/uitest/uiobject.hxx>
14 #include <vcl/weld.hxx>
15 #include <unordered_map>
16 
18 {
19 public:
20  static void trigger_changed(weld::TextView& rView) { rView.signal_changed(); }
21 
22  static void trigger_changed(weld::Entry& rEdit) { rEdit.signal_changed(); }
23 
24  static void trigger_changed(weld::ComboBox& rComboBox) { rComboBox.signal_changed(); }
25 
26  static void trigger_changed(weld::TreeView& rTreeView) { rTreeView.signal_changed(); }
27 
28  static void trigger_changed(weld::IconView& rIconView) { rIconView.signal_selection_changed(); }
29 
30  static void trigger_toggled(weld::Toggleable& rButton) { rButton.signal_toggled(); }
31 
32  static void trigger_row_activated(weld::TreeView& rTreeView)
33  {
34  rTreeView.signal_row_activated();
35  }
36 
37  static void trigger_item_activated(weld::IconView& rIconView)
38  {
39  rIconView.signal_item_activated();
40  }
41 
42  static void trigger_clicked(weld::Toolbar& rToolbar, const OString& rIdent)
43  {
44  rToolbar.signal_clicked(rIdent);
45  }
46 
47  static void trigger_clicked(weld::Button& rButton) { rButton.signal_clicked(); }
48 
49  static void trigger_click(weld::DrawingArea& rDrawingArea, const Point& rPos)
50  {
51  rDrawingArea.click(rPos);
52  }
53 
54  static void trigger_value_changed(weld::SpinButton& rSpinButton)
55  {
56  rSpinButton.signal_value_changed();
57  }
58 
59  static void trigger_closed(weld::Popover& rPopover) { rPopover.popdown(); }
60 
61  static void trigger_key_press(weld::Widget& rWidget, const KeyEvent& rEvent)
62  {
63  rWidget.m_aKeyPressHdl.Call(rEvent);
64  }
65 
66  static void trigger_key_release(weld::Widget& rWidget, const KeyEvent& rEvent)
67  {
68  rWidget.m_aKeyReleaseHdl.Call(rEvent);
69  }
70 
71  static void command(weld::DrawingArea& rArea, const CommandEvent& rCmd)
72  {
73  rArea.m_aCommandHdl.Call(rCmd);
74  }
75 };
76 
77 namespace jsdialog
78 {
79 // type used to store key-value pairs to put in the generated messages
80 typedef std::unordered_map<std::string, OUString> ActionDataMap;
81 
83 VCL_DLLPUBLIC bool ExecuteAction(const std::string& nWindowId, const OString& rWidget,
84  StringMap& rData);
86 VCL_DLLPUBLIC void SendFullUpdate(const std::string& nWindowId, const OString& rWidget);
88 VCL_DLLPUBLIC void SendAction(const std::string& nWindowId, const OString& rWidget,
89  std::unique_ptr<ActionDataMap> pData);
90 VCL_DLLPUBLIC StringMap jsonToStringMap(const char* pJSON);
91 };
92 
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
static void trigger_value_changed(weld::SpinButton &rSpinButton)
Definition: executor.hxx:54
static void trigger_changed(weld::ComboBox &rComboBox)
Definition: executor.hxx:24
static void trigger_changed(weld::TreeView &rTreeView)
Definition: executor.hxx:26
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
static void trigger_click(weld::DrawingArea &rDrawingArea, const Point &rPos)
Definition: executor.hxx:49
virtual void popdown()=0
void signal_changed()
Definition: weld.hxx:2135
virtual void click(const Point &rPos)=0
Link< const CommandEvent &, bool > m_aCommandHdl
Definition: weld.hxx:2224
static void command(weld::DrawingArea &rArea, const CommandEvent &rCmd)
Definition: executor.hxx:71
static void trigger_row_activated(weld::TreeView &rTreeView)
Definition: executor.hxx:32
void signal_clicked(const OString &rIdent)
Definition: weld.hxx:2400
static void trigger_key_press(weld::Widget &rWidget, const KeyEvent &rEvent)
Definition: executor.hxx:61
VCL_DLLPUBLIC void SendAction(const std::string &nWindowId, const OString &rWidget, std::unique_ptr< ActionDataMap > pData)
send action message to the client
void signal_clicked()
Definition: weld.hxx:1427
static void trigger_changed(weld::TextView &rView)
Definition: executor.hxx:20
static void trigger_toggled(weld::Toggleable &rButton)
Definition: executor.hxx:30
void signal_changed()
Definition: weld.hxx:1649
static void trigger_changed(weld::Entry &rEdit)
Definition: executor.hxx:22
void signal_changed()
Definition: weld.hxx:908
Link< const KeyEvent &, bool > m_aKeyPressHdl
Definition: weld.hxx:89
std::unordered_map< std::string, OUString > ActionDataMap
Definition: executor.hxx:80
static void trigger_key_release(weld::Widget &rWidget, const KeyEvent &rEvent)
Definition: executor.hxx:66
void signal_changed()
Definition: weld.hxx:711
Link< const KeyEvent &, bool > m_aKeyReleaseHdl
Definition: weld.hxx:90
static void trigger_clicked(weld::Toolbar &rToolbar, const OString &rIdent)
Definition: executor.hxx:42
static void trigger_item_activated(weld::IconView &rIconView)
Definition: executor.hxx:37
A widget used to choose from a list of items.
Definition: weld.hxx:693
VCL_DLLPUBLIC StringMap jsonToStringMap(const char *pJSON)
bool signal_row_activated()
Definition: weld.hxx:909
VCL_DLLPUBLIC bool ExecuteAction(const std::string &nWindowId, const OString &rWidget, StringMap &rData)
execute action on a widget
std::map< OUString, OUString > StringMap
bool signal_item_activated()
Definition: weld.hxx:1348
static void trigger_clicked(weld::Button &rButton)
Definition: executor.hxx:47
void signal_toggled()
Definition: weld.hxx:1461
void signal_selection_changed()
Definition: weld.hxx:1347
static void trigger_changed(weld::IconView &rIconView)
Definition: executor.hxx:28
void signal_value_changed()
Definition: weld.hxx:1717
static void trigger_closed(weld::Popover &rPopover)
Definition: executor.hxx:59
VCL_DLLPUBLIC void SendFullUpdate(const std::string &nWindowId, const OString &rWidget)
send full update message to the client