diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-06 14:46:11 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-07-23 14:44:37 +0200 |
commit | 2986b5a2589babcb51a272f72d3e3cca5833719b (patch) | |
tree | cd64f6efad6d28fb18bfb933efa0509fa01bde5e | |
parent | 9f8c77d87671ca0da124045d82cbe88fbaba3728 (diff) |
limit exposure of methods exposed for LibreOfficeKit purposes to just that
Change-Id: I4685651a6ecf48b7cbf3048b28788b351c655c3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98212
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99285
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r-- | include/vcl/jsdialog/executor.hxx | 20 | ||||
-rw-r--r-- | include/vcl/salvtables.hxx | 2 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 27 | ||||
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 2 | ||||
-rw-r--r-- | vcl/jsdialog/executor.cxx | 14 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 6 |
7 files changed, 51 insertions, 24 deletions
diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx index 9cc4471551ba..1cfa24c28a8a 100644 --- a/include/vcl/jsdialog/executor.hxx +++ b/include/vcl/jsdialog/executor.hxx @@ -13,6 +13,26 @@ #include <vcl/uitest/uiobject.hxx> #include <vcl/weld.hxx> +class LOKTrigger +{ +public: + static void trigger_changed(weld::TextView& rView) { rView.signal_changed(); } + + static void trigger_changed(weld::Entry& rEdit) { rEdit.signal_changed(); } + + static void trigger_changed(weld::ComboBox& rComboBox) { rComboBox.signal_changed(); } + + static void trigger_clicked(weld::Toolbar& rToolbar, const OString& rIdent) + { + rToolbar.signal_clicked(rIdent); + } + + static void trigger_click(weld::DrawingArea& rDrawingArea, const Point& rPos) + { + rDrawingArea.click(rPos); + } +}; + namespace jsdialog { VCL_DLLPUBLIC bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rData); diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx index c2f1382ee0de..1898278eb5b0 100644 --- a/include/vcl/salvtables.hxx +++ b/include/vcl/salvtables.hxx @@ -998,7 +998,7 @@ public: virtual OutputDevice& get_ref_device() override; - virtual void click(Point pos) override; + virtual void click(const Point& rPos) override; }; class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolbar diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 95a63ce84f82..58a80e2ec0cc 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -10,7 +10,6 @@ #ifndef INCLUDED_VCL_WELD_HXX #define INCLUDED_VCL_WELD_HXX -#include <vcl/jsdialog/executor.hxx> #include <basegfx/range/b2irange.hxx> #include <rtl/ustring.hxx> #include <tools/color.hxx> @@ -73,6 +72,8 @@ namespace vcl class ILibreOfficeKitNotifier; } +class LOKTrigger; + namespace weld { class Container; @@ -563,9 +564,6 @@ enum class EntryMessageType /// A widget used to choose from a list of items. class VCL_DLLPUBLIC ComboBox : virtual public Container { - friend VCL_DLLPUBLIC bool jsdialog::ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, - StringMap& rData); - private: OUString m_sSavedValue; @@ -575,7 +573,10 @@ protected: Link<ComboBox&, bool> m_aEntryActivateHdl; Link<OUString&, bool> m_aEntryInsertTextHdl; + friend class ::LOKTrigger; + void signal_changed() { m_aChangeHdl.Call(*this); } + virtual void signal_popup_toggled() { m_aPopupToggledHdl.Call(*this); } public: @@ -1246,9 +1247,6 @@ public: class VCL_DLLPUBLIC Entry : virtual public Widget { - friend VCL_DLLPUBLIC bool jsdialog::ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, - StringMap& rData); - private: OUString m_sSavedValue; @@ -1258,6 +1256,8 @@ protected: Link<Entry&, void> m_aCursorPositionHdl; Link<Entry&, bool> m_aActivateHdl; + friend class ::LOKTrigger; + void signal_changed() { m_aChangeHdl.Call(*this); } void signal_cursor_position() { m_aCursorPositionHdl.Call(*this); } void signal_insert_text(OUString& rString); @@ -1760,8 +1760,7 @@ public: class VCL_DLLPUBLIC TextView : virtual public Container { - friend VCL_DLLPUBLIC bool jsdialog::ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, - StringMap& rData); + friend class ::LOKTrigger; private: OUString m_sSavedValue; @@ -1862,7 +1861,10 @@ public: virtual a11yrelationset get_accessible_relation_set() = 0; virtual Point get_accessible_location() = 0; - virtual void click(Point pos) = 0; +private: + friend class ::LOKTrigger; + + virtual void click(const Point& rPos) = 0; }; class VCL_DLLPUBLIC Menu @@ -1917,6 +1919,10 @@ class VCL_DLLPUBLIC Toolbar : virtual public Widget protected: Link<const OString&, void> m_aClickHdl; + friend class ::LOKTrigger; + + virtual void signal_clicked(const OString& rIdent) { m_aClickHdl.Call(rIdent); } + public: virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) = 0; virtual bool get_item_sensitive(const OString& rIdent) const = 0; @@ -1944,7 +1950,6 @@ public: virtual vcl::ImageType get_icon_size() const = 0; void connect_clicked(const Link<const OString&, void>& rLink) { m_aClickHdl = rLink; } - virtual void signal_clicked(const OString& rIdent) { m_aClickHdl.Call(rIdent); } }; class VCL_DLLPUBLIC SizeGroup diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 3118d3b65894..ed120ffa2108 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -253,7 +253,7 @@ public: JSToolbar(VclPtr<vcl::Window> aOwnedToplevel, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder, bool bTakeOwnership); - void signal_clicked(const OString& rIdent) override; + virtual void signal_clicked(const OString& rIdent) override; }; class JSTextView : public JSWidget<SalInstanceTextView, ::VclMultiLineEdit> diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 2317258e3030..53fded14e1c1 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -53,14 +53,14 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat OString posString = OUStringToOString(entryPos, RTL_TEXTENCODING_ASCII_US); int pos = std::atoi(posString.getStr()); pCombobox->set_active(pos); - pCombobox->signal_changed(); + LOKTrigger::trigger_changed(*pCombobox); return true; } } else if (sAction == "change") { pCombobox->set_entry_text(rData["data"]); - pCombobox->signal_changed(); + LOKTrigger::trigger_changed(*pCombobox); return true; } } @@ -84,7 +84,7 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat { if (sAction == "click") { - pArea->click(Point(10, 10)); + LOKTrigger::trigger_click(*pArea, Point(10, 10)); return true; } } @@ -113,8 +113,8 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat { if (sAction == "click") { - pToolbar->signal_clicked( - OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US)); + LOKTrigger::trigger_clicked( + *pToolbar, OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US)); return true; } } @@ -127,7 +127,7 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat if (sAction == "change") { pEdit->set_text(rData["data"]); - pEdit->signal_changed(); + LOKTrigger::trigger_changed(*pEdit); return true; } } @@ -138,7 +138,7 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat if (sAction == "change") { pTextView->set_text(rData["data"]); - pTextView->signal_changed(); + LOKTrigger::trigger_changed(*pTextView); return true; } } diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index ce884b9f4aac..8a9916adc255 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5382,9 +5382,9 @@ OutputDevice& SalInstanceDrawingArea::get_ref_device() return *m_xDrawingArea; } -void SalInstanceDrawingArea::click(Point pos) +void SalInstanceDrawingArea::click(const Point& rPos) { - MouseEvent aEvent(pos); + MouseEvent aEvent(rPos); m_xDrawingArea->MouseButtonDown(aEvent); m_xDrawingArea->MouseButtonUp(aEvent); } diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index d66997c954a2..fe87b9764dcd 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -11136,9 +11136,11 @@ public: return *m_xDevice; } - void click(Point /*pos*/) override + virtual void click(const Point& rPos) override { - //TODO + MouseEvent aEvent(rPos); + m_aMousePressHdl.Call(aEvent); + m_aMouseReleaseHdl.Call(aEvent); } }; |