summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-06-15 19:03:09 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2020-06-29 15:15:25 +0200
commited06c5f411769c22923ae1555f9555f2460a0780 (patch)
treea2420ebe96b088968a09acc0e2872b3fd1272dbc
parenta40cb25a21d6d36ca227c77c5e58c102660bdd65 (diff)
jsdialog: weld drawing area
Change-Id: I7bc75e3de99de84c59b798e4c4dad18550157e43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96851 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97396 Tested-by: Jenkins
-rw-r--r--vcl/inc/jsdialog/jsdialogbuilder.hxx18
-rw-r--r--vcl/inc/salvtables.hxx4
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx61
-rw-r--r--vcl/source/app/salvtables.cxx5
4 files changed, 83 insertions, 5 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index f5d0d098cb68..f68853d34037 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -62,6 +62,8 @@ class JSInstanceBuilder : public SalInstanceBuilder
public:
JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile);
+ JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile,
+ const css::uno::Reference<css::frame::XFrame>& rFrame);
virtual ~JSInstanceBuilder() override;
virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString& id,
bool bTakeOwnership = true) override;
@@ -79,6 +81,10 @@ public:
weld_spin_button(const OString& id, bool bTakeOwnership = false) override;
virtual std::unique_ptr<weld::CheckButton>
weld_check_button(const OString& id, bool bTakeOwnership = false) override;
+ virtual std::unique_ptr<weld::DrawingArea>
+ weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
+ FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = nullptr,
+ bool bTakeOwnership = false) override;
static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent,
VclMessageType eMessageType,
@@ -205,4 +211,16 @@ public:
virtual void set_active(bool active) override;
};
+class VCL_DLLPUBLIC JSDrawingArea : public SalInstanceDrawingArea, public JSDialogSender
+{
+public:
+ JSDrawingArea(VclPtr<vcl::Window> aOwnedToplevel, VclDrawingArea* pDrawingArea,
+ SalInstanceBuilder* pBuilder, const a11yref& rAlly,
+ FactoryFunction pUITestFactoryFunction, void* pUserData,
+ bool bTakeOwnership = false);
+
+ virtual void queue_draw() override;
+ virtual void queue_draw_area(int x, int y, int width, int height) 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 53515ad13ac6..527e3cd2b722 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -32,7 +32,9 @@ protected:
VclPtr<vcl::Window> m_aOwnedToplevel;
public:
- SalInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile);
+ SalInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile,
+ const css::uno::Reference<css::frame::XFrame>& rFrame
+ = css::uno::Reference<css::frame::XFrame>());
virtual std::unique_ptr<weld::MessageDialog>
weld_message_dialog(const OString& id, bool bTakeOwnership = true) override;
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 28eecea4d713..b678c34333b2 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -76,7 +76,26 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR
if (pRoot && pRoot->GetParent())
{
m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier();
- m_nWindowId = m_aParentDialog->GetLOKWindowId();
+ if (m_aParentDialog)
+ m_nWindowId = m_aParentDialog->GetLOKWindowId();
+ InsertWindowToMap(m_nWindowId);
+ }
+}
+
+JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot,
+ const OUString& rUIFile,
+ const css::uno::Reference<css::frame::XFrame>& rFrame)
+ : SalInstanceBuilder(pParent, rUIRoot, rUIFile, rFrame)
+ , m_nWindowId(0)
+ , m_aParentDialog(nullptr)
+ , m_bHasTopLevelDialog(false)
+{
+ vcl::Window* pRoot = m_xBuilder->get_widget_root();
+ if (pRoot && pRoot->GetParent())
+ {
+ m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier();
+ if (m_aParentDialog)
+ m_nWindowId = m_aParentDialog->GetLOKWindowId();
InsertWindowToMap(m_nWindowId);
}
}
@@ -272,6 +291,24 @@ std::unique_ptr<weld::CheckButton> JSInstanceBuilder::weld_check_button(const OS
return pWeldWidget;
}
+std::unique_ptr<weld::DrawingArea>
+JSInstanceBuilder::weld_drawing_area(const OString& id, const a11yref& rA11yImpl,
+ FactoryFunction pUITestFactoryFunction, void* pUserData,
+ bool bTakeOwnership)
+{
+ VclDrawingArea* pArea = m_xBuilder->get<VclDrawingArea>(id);
+ auto pWeldWidget = pArea
+ ? std::make_unique<JSDrawingArea>(
+ m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog, pArea,
+ this, rA11yImpl, pUITestFactoryFunction, pUserData, bTakeOwnership)
+ : nullptr;
+
+ if (pWeldWidget)
+ RememberWidget(id, pWeldWidget.get());
+
+ return pWeldWidget;
+}
+
weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent,
VclMessageType eMessageType,
VclButtonsType eButtonType,
@@ -459,4 +496,26 @@ void JSCheckButton::set_active(bool active)
notifyDialogState();
}
+JSDrawingArea::JSDrawingArea(VclPtr<vcl::Window> aOwnedToplevel, VclDrawingArea* pDrawingArea,
+ SalInstanceBuilder* pBuilder, const a11yref& rAlly,
+ FactoryFunction pUITestFactoryFunction, void* pUserData,
+ bool bTakeOwnership)
+ : SalInstanceDrawingArea(pDrawingArea, pBuilder, rAlly, pUITestFactoryFunction, pUserData,
+ bTakeOwnership)
+ , JSDialogSender(aOwnedToplevel)
+{
+}
+
+void JSDrawingArea::queue_draw()
+{
+ SalInstanceDrawingArea::queue_draw();
+ notifyDialogState();
+}
+
+void JSDrawingArea::queue_draw_area(int x, int y, int width, int height)
+{
+ SalInstanceDrawingArea::queue_draw_area(x, y, width, height);
+ notifyDialogState();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 391f2a6dc40a..a6012f4ca6a5 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6351,10 +6351,9 @@ IMPL_LINK(SalInstanceEntryTreeView, AutocompleteHdl, Edit&, rEdit, void)
}
SalInstanceBuilder::SalInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot,
- const OUString& rUIFile)
+ const OUString& rUIFile, const css::uno::Reference<css::frame::XFrame>& rFrame)
: weld::Builder()
- , m_xBuilder(new VclBuilder(pParent, rUIRoot, rUIFile, OString(),
- css::uno::Reference<css::frame::XFrame>(), false))
+ , m_xBuilder(new VclBuilder(pParent, rUIRoot, rUIFile, OString(), rFrame, false))
{
}