[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/vcl vcl/jsdialog
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 23 04:47:05 UTC 2020
include/vcl/jsdialog/jsdialogbuilder.hxx | 18 +++++++++
vcl/jsdialog/jsdialogbuilder.cxx | 61 ++++++++++++++++++++++++++++++-
2 files changed, 78 insertions(+), 1 deletion(-)
New commits:
commit 470ca0d6dc8560a49e589eaf25bdc6df5d56b459
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jun 15 19:03:09 2020 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jun 23 06:46:32 2020 +0200
jsdialog: weld drawing area
Change-Id: I7bc75e3de99de84c59b798e4c4dad18550157e43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96851
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/vcl/jsdialog/jsdialogbuilder.hxx b/include/vcl/jsdialog/jsdialogbuilder.hxx
index 4c2173a7f009..52ada2848472 100644
--- a/include/vcl/jsdialog/jsdialogbuilder.hxx
+++ b/include/vcl/jsdialog/jsdialogbuilder.hxx
@@ -59,6 +59,8 @@ class VCL_DLLPUBLIC 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;
@@ -76,6 +78,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,
@@ -203,6 +209,18 @@ 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;
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 4a9fab076225..3fba10ad2bc3 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -68,7 +68,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 = get_builder().get_widget_root();
+ if (pRoot && pRoot->GetParent())
+ {
+ m_aParentDialog = pRoot->GetParent()->GetParentWithLOKNotifier();
+ if (m_aParentDialog)
+ m_nWindowId = m_aParentDialog->GetLOKWindowId();
InsertWindowToMap(m_nWindowId);
}
}
@@ -264,6 +283,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,
@@ -452,4 +489,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: */
More information about the Libreoffice-commits
mailing list