[Libreoffice-commits] core.git: vcl/inc vcl/jsdialog vcl/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 29 13:16:41 UTC 2020


 vcl/inc/jsdialog/jsdialogbuilder.hxx |   18 ++++++++++
 vcl/inc/salvtables.hxx               |    4 +-
 vcl/jsdialog/jsdialogbuilder.cxx     |   61 ++++++++++++++++++++++++++++++++++-
 vcl/source/app/salvtables.cxx        |    5 +-
 4 files changed, 83 insertions(+), 5 deletions(-)

New commits:
commit ed06c5f411769c22923ae1555f9555f2460a0780
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: Mon Jun 29 15:15:25 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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97396
    Tested-by: Jenkins

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))
 {
 }
 


More information about the Libreoffice-commits mailing list