desktop/source/lib/init.cxx | 34 +++++++++++++++++++++++++++++----- include/vcl/weld.hxx | 22 ++++++++++++++++------ vcl/inc/jsdialog/jsdialogbuilder.hxx | 2 +- vcl/inc/salvtables.hxx | 2 +- vcl/source/app/salvtables.cxx | 4 ++-- vcl/unx/gtk3/gtk3gtkinst.cxx | 6 ++++-- 6 files changed, 53 insertions(+), 17 deletions(-)
New commits: commit c1325c99f449909282ec7b592be10b62bbce2889 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Jul 6 14:46:11 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Jul 6 20:29:55 2020 +0200 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 <caol...@redhat.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index bdfcc69b5764..900e50f75c40 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -187,6 +187,30 @@ static void SetLastExceptionMsg(const OUString& s = OUString()) gImpl->maLastExceptionMsg = s; } +class LOKTrigger +{ +public: + 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 { struct ExtensionMap @@ -3669,13 +3693,13 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned long 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); } } else if (sAction == "change") { pCombobox->set_entry_text(aMap["data"]); - pCombobox->signal_changed(); + LOKTrigger::trigger_changed(*pCombobox); } else bContinueWithLOKWindow = true; @@ -3701,7 +3725,7 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned long { if (sAction == "click") { - pArea->click(Point(10, 10)); + LOKTrigger::trigger_click(*pArea, Point(10, 10)); } else bContinueWithLOKWindow = true; @@ -3731,7 +3755,7 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned long { if (sAction == "click") { - pToolbar->signal_clicked(OUStringToOString(aMap["data"], RTL_TEXTENCODING_ASCII_US)); + LOKTrigger::trigger_clicked(*pToolbar, OUStringToOString(aMap["data"], RTL_TEXTENCODING_ASCII_US)); } else bContinueWithLOKWindow = true; @@ -3745,7 +3769,7 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned long if (sAction == "change") { pEdit->set_text(aMap["data"]); - pEdit->signal_changed(); + LOKTrigger::trigger_changed(*pEdit); } else bContinueWithLOKWindow = true; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index d73b24936734..c4577d63c49d 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -80,6 +80,8 @@ namespace tools class JsonWriter; } +class LOKTrigger; + namespace weld { class Container; @@ -616,6 +618,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); } Link<render_args, void> m_aRenderHdl; @@ -629,8 +635,6 @@ protected: Size signal_custom_get_size(vcl::RenderContext& rDevice) { return m_aGetSizeHdl.Call(rDevice); } public: - void signal_changed() { m_aChangeHdl.Call(*this); } - virtual void insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName, VirtualDevice* pImageSurface) = 0; @@ -1470,12 +1474,13 @@ 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); public: - void signal_changed() { m_aChangeHdl.Call(*this); } - virtual void set_text(const OUString& rText) = 0; virtual OUString get_text() const = 0; virtual void set_width_chars(int nChars) = 0; @@ -2110,7 +2115,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 @@ -2177,6 +2185,9 @@ protected: Link<const OString&, void> m_aClickHdl; Link<const OString&, void> m_aToggleMenuHdl; + friend class ::LOKTrigger; + + virtual void signal_clicked(const OString& rIdent) { m_aClickHdl.Call(rIdent); } void signal_toggle_menu(const OString& rIdent) { m_aToggleMenuHdl.Call(rIdent); } public: @@ -2225,7 +2236,6 @@ public: void connect_clicked(const Link<const OString&, void>& rLink) { m_aClickHdl = rLink; } void connect_menu_toggled(const Link<const OString&, void>& rLink) { m_aToggleMenuHdl = 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 3842d950d029..f36b7ae3fa54 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -235,7 +235,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; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 3ee8f111bdff..377653c291ec 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -1168,7 +1168,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/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index d7d7d315f731..f3778f91340c 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5747,9 +5747,9 @@ SalInstanceDrawingArea::~SalInstanceDrawingArea() 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 bf81847a3a80..7ff4005af8b3 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -12898,9 +12898,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); } }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits