summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-10-09 13:55:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-10-10 20:25:07 +0200
commitbb6bcabda53dbd64dda43f09fab9f4ad6f34eba6 (patch)
tree4fe51458a061c92587c22be397fd74a2e4436aaf /include
parent68549e00d5e23aa22bc974a8151d93cd948444b3 (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')
-rw-r--r--include/test/screenshot_test.hxx15
-rw-r--r--include/vcl/dialog.hxx18
-rw-r--r--include/vcl/syswin.hxx18
-rw-r--r--include/vcl/weld.hxx57
4 files changed, 61 insertions, 47 deletions
diff --git a/include/test/screenshot_test.hxx b/include/test/screenshot_test.hxx
index 74bcfc721d53..3e1f3f84a06f 100644
--- a/include/test/screenshot_test.hxx
+++ b/include/test/screenshot_test.hxx
@@ -15,7 +15,8 @@
#include <unotest/macros_test.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <osl/file.hxx>
-#include <vcl/dialog.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/weld.hxx>
#include <map>
class VclAbstractDialog;
@@ -30,11 +31,18 @@ private:
/// the set of known dialogs and their ID for usage in createDialogByID
mapType maKnownDialogs;
+ /// parent for non-dialog buildables
+ weld::GenericDialogController maParent;
+ std::unique_ptr<weld::Container> mxParentWidget;
+
private:
/// helpers
void implSaveScreenshot(const BitmapEx& rScreenshot, const OString& rScreenshotId);
void saveScreenshot(VclAbstractDialog const & rDialog);
- void saveScreenshot(Dialog& rDialog);
+ void saveScreenshot(weld::Window& rDialog);
+
+ /// helper method to create and dump a dialog based on Builder contents.
+ void dumpDialogToPath(weld::Builder& rDialog);
/// helper method to populate maKnownDialogs, called in setUp(). Needs to be
/// written and has to add entries to maKnownDialogs
@@ -58,9 +66,6 @@ public:
/// version for AbstractDialogs, the ones created in AbstractDialogFactories
void dumpDialogToPath(VclAbstractDialog& rDialog);
- /// version for pure vcl-based dialogs
- void dumpDialogToPath(Dialog& rDialog);
-
/// fallback version for dialogs for which only the UXMLDescription is known.
/// This should be used with care - no active layouting will be done, only the
/// VclBuilder will be activated for layouting. Result can thus vary drastically
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() {}
};