diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-10-09 13:55:46 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-10-10 20:25:07 +0200 |
commit | bb6bcabda53dbd64dda43f09fab9f4ad6f34eba6 (patch) | |
tree | 4fe51458a061c92587c22be397fd74a2e4436aaf /include/vcl | |
parent | 68549e00d5e23aa22bc974a8151d93cd948444b3 (diff) |
support screenshotting .ui files with GtkBuilder
so...
SAL_USE_VCLPLUGIN=gtk3 make screenshot
for the "unknown dialog" cases of make screenshot, which loads .ui files and
tries to render them, will render them with the native gtk infrastructure
Change-Id: Ifc8fe264155887c4d01b7ce0e2aa53e12acbfcb0
Reviewed-on: https://gerrit.libreoffice.org/80545
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/vcl')
-rw-r--r-- | include/vcl/dialog.hxx | 18 | ||||
-rw-r--r-- | include/vcl/syswin.hxx | 18 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 57 |
3 files changed, 51 insertions, 42 deletions
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index cc5355d58132..ee2560abc475 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -50,7 +50,6 @@ private: bool mbInSyncExecute; bool mbInClose; bool mbModalMode; - bool mbPaintComplete; bool const mbForceBorderWindow; InitFlag const mnInitFlag; // used for deferred init @@ -70,11 +69,6 @@ private: DECL_DLLPRIVATE_LINK(ImplAsyncCloseHdl, void*, void); DECL_DLLPRIVATE_LINK(ResponseHdl, Button*, void); - // ensureRepaint - triggers Application::Yield until the dialog is - // completely repainted. Sometimes needed for dialogs showing progress - // during actions - void ensureRepaint(); - protected: using Window::ImplInit; void ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag = InitFlag::Default ); @@ -95,6 +89,7 @@ protected: protected: friend class VclBuilder; + friend class SalInstanceBuilder; void set_action_area(VclButtonBox* pBox); virtual void set_content_area(VclBox* pBox); @@ -119,17 +114,6 @@ public: virtual bool Close() override; - // try to extract content and return as Bitmap. To do that reliably, a Yield-loop - // like in Execute() has to be executed and it is necessary to detect when the - // paint is finished - virtual void PrePaint(vcl::RenderContext& rRenderContext) override; - virtual void PostPaint(vcl::RenderContext& rRenderContext) override; - - // Screenshot interface - virtual std::vector<OString> getAllPageUIXMLDescriptions() const; - virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription); - void createScreenshot(VirtualDevice& rOutput); - virtual short Execute(); bool IsInExecute() const { return mbInExecute; } // Return true when dialog is synchronously executed (calling ::Execute()) diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx index 402aebeb381e..cb6d15d27ead 100644 --- a/include/vcl/syswin.hxx +++ b/include/vcl/syswin.hxx @@ -141,6 +141,7 @@ private: bool mbHideBtn; bool mbSysChild; bool mbIsCalculatingInitialLayoutSize; + bool mbPaintComplete; MenuBarMode mnMenuBarMode; sal_uInt16 mnIcon; std::unique_ptr<ImplData> mpImplData; @@ -159,6 +160,17 @@ private: SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox); DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, Timer*, void ); + // try to extract content and return as Bitmap. To do that reliably, a Yield-loop + // like in Execute() has to be executed and it is necessary to detect when the + // paint is finished + virtual void PrePaint(vcl::RenderContext& rRenderContext) override; + virtual void PostPaint(vcl::RenderContext& rRenderContext) override; + + // ensureRepaint - triggers Application::Yield until the dialog is + // completely repainted. Sometimes needed for dialogs showing progress + // during actions + SAL_DLLPRIVATE void ensureRepaint(); + protected: // Single argument ctors shall be explicit. explicit SystemWindow(WindowType nType); @@ -171,6 +183,7 @@ protected: SAL_DLLPRIVATE void DoInitialLayout(); SAL_DLLPRIVATE void SetIdleDebugName( const sal_Char *pDebugName ); + public: virtual ~SystemWindow() override; virtual void dispose() override; @@ -270,6 +283,11 @@ public: SAL_DLLPRIVATE bool hasPendingLayout() const { return maLayoutIdle.IsActive(); } virtual void doDeferredInit(WinBits nBits); + + // Screenshot interface + virtual std::vector<OString> getAllPageUIXMLDescriptions() const; + virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription); + void createScreenshot(VirtualDevice& rOutput); }; inline void SystemWindow::SetIdleDebugName( const sal_Char *pDebugName ) diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 20c8d9e5751e..be9cf23f0779 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -351,6 +351,26 @@ public: void connect_enter_page(const Link<const OString&, void>& rLink) { m_aEnterPageHdl = rLink; } }; +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<ScreenShotEntry> ScreenShotCollection; + class VCL_DLLPUBLIC Window : virtual public Container { protected: @@ -397,6 +417,11 @@ public: virtual SystemEnvData get_system_data() const = 0; virtual void resize_to_request() = 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; }; class VCL_DLLPUBLIC WaitObject @@ -420,26 +445,6 @@ 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<ScreenShotEntry> ScreenShotCollection; - class VCL_DLLPUBLIC Dialog : virtual public Window { private: @@ -467,11 +472,6 @@ 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<void*, vcl::ILibreOfficeKitNotifier*>& rLink) = 0; }; @@ -1937,6 +1937,13 @@ public: virtual std::unique_ptr<Toolbar> weld_toolbar(const OString& id, bool bTakeOwnership = true) = 0; virtual std::unique_ptr<SizeGroup> create_size_group() = 0; + /* return a Dialog suitable to take a screenshot of containing the contents of the .ui file. + + If the toplevel element is a dialog, that will be returned + If the toplevel is not a dialog, a dialog will be created and the contents of the .ui + inserted into it + */ + virtual std::unique_ptr<Window> create_screenshot_window() = 0; virtual ~Builder() {} }; |