From 64fc5986607eaba5db627c546cb1321f00abc501 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 7 Oct 2019 16:43:59 +0100 Subject: implement gtk dialog screenshotting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If4e570f775bd1e29dfb75cb7e5dd9d9dfc35e654 Reviewed-on: https://gerrit.libreoffice.org/80416 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- include/vcl/abstdlg.hxx | 2 +- include/vcl/dialog.hxx | 5 +++-- include/vcl/layout.hxx | 2 +- include/vcl/weld.hxx | 26 ++++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx index d9a5058c7e42..ccbc64a753a0 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -172,7 +172,7 @@ public: // creates instance of ScreenshotAnnotationDlg from cui virtual VclPtr CreateScreenshotAnnotationDlg( - weld::Window* pParent, Dialog& rParentDialog) = 0; + weld::Dialog& rParentDialog) = 0; // create info dialog to show tip-of-the-day virtual VclPtr diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index e2ddea74be78..cc5355d58132 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -110,6 +110,7 @@ public: virtual bool EventNotify( NotifyEvent& rNEvt ) override; virtual void StateChanged( StateChangedType nStateChange ) override; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual void Command( const CommandEvent& rCEvt ) override; virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override; virtual bool set_property(const OString &rKey, const OUString &rValue) override; @@ -127,7 +128,7 @@ public: // Screenshot interface virtual std::vector getAllPageUIXMLDescriptions() const; virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription); - BitmapEx createScreenshot(); + void createScreenshot(VirtualDevice& rOutput); virtual short Execute(); bool IsInExecute() const { return mbInExecute; } @@ -174,7 +175,7 @@ public: void Activate() override; - + void SetPopupMenuHdl(const Link& rLink); void SetInstallLOKNotifierHdl(const Link& rLink); void add_button(PushButton* pButton, int nResponse, bool bTransferOwnership); diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index 0164b2b09df0..494cb708f292 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -50,7 +50,7 @@ protected: virtual sal_uInt16 getDefaultAccessibleRole() const override; - // evtl. support for screenshot context menu + // support for screenshot context menu virtual void Command(const CommandEvent& rCEvt) override; public: diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 5559833799fc..20c8d9e5751e 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -10,6 +10,7 @@ #ifndef INCLUDED_VCL_WELD_HXX #define INCLUDED_VCL_WELD_HXX +#include #include #include #include @@ -419,6 +420,26 @@ public: class Button; +class VCL_DLLPUBLIC ScreenShotEntry +{ +public: + ScreenShotEntry(const OString& rHelpId, const basegfx::B2IRange& rB2IRange) + : msHelpId(rHelpId) + , maB2IRange(rB2IRange) + { + } + + const basegfx::B2IRange& getB2IRange() const { return maB2IRange; } + + const OString& GetHelpId() const { return msHelpId; } + +private: + OString msHelpId; + basegfx::B2IRange maB2IRange; +}; + +typedef std::vector ScreenShotCollection; + class VCL_DLLPUBLIC Dialog : virtual public Window { private: @@ -446,6 +467,11 @@ public: // undo previous dialog collapse virtual void undo_collapse() = 0; + // render the dialog for a screenshot + virtual void draw(VirtualDevice& rOutput) = 0; + // collect positions of widgets and their help ids for screenshot purposes + virtual ScreenShotCollection collect_screenshot_data() = 0; + virtual void SetInstallLOKNotifierHdl(const Link& rLink) = 0; }; -- cgit