[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/vcl vcl/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 23 04:15:41 UTC 2020


 include/vcl/salvtables.hxx    |   73 +++++++++++-
 vcl/source/app/salvtables.cxx |  245 +++++++++++++++++++-----------------------
 2 files changed, 178 insertions(+), 140 deletions(-)

New commits:
commit 7478e1ce64c378905203d1c24a1b3d805a4805e4
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jun 15 18:44:11 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jun 23 06:15:10 2020 +0200

    Move SalInstanceDrawingArea decl to header file
    
    Change-Id: I941b8f52a4c69c65c3ccbe08f3cf6d1427783f90
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96850
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx
index e098736619f9..126b771b97bf 100644
--- a/include/vcl/salvtables.hxx
+++ b/include/vcl/salvtables.hxx
@@ -22,7 +22,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>());
 
     VclBuilder& get_builder() const;
 
@@ -44,7 +46,7 @@ public:
                                                       bool bTakeOwnership = true) override;
 
     virtual std::unique_ptr<weld::Widget> weld_widget(const OString& id,
-                                                      bool bTakeOwnership = true) override;
+                                                      bool bTakeOwnership = false) override;
 
     virtual std::unique_ptr<weld::Container> weld_container(const OString& id,
                                                             bool bTakeOwnership = false) override;
@@ -134,8 +136,8 @@ public:
                                                           bool bTakeOwnership = false) override;
 
     virtual std::unique_ptr<weld::DrawingArea>
-    weld_drawing_area(const OString& id, const a11yref& rA11yImpl,
-                      FactoryFunction pUITestFactoryFunction, void* pUserData,
+    weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
+                      FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = nullptr,
                       bool bTakeOwnership = false) override;
 
     virtual std::unique_ptr<weld::Menu> weld_menu(const OString& id,
@@ -487,7 +489,8 @@ public:
 
     virtual void response(int nResponse) override;
 
-    virtual void add_button(const OUString& rText, int nResponse, const OString& rHelpId) override;
+    virtual void add_button(const OUString& rText, int nResponse,
+                            const OString& rHelpId = OString()) override;
 
     virtual void set_modal(bool bModal) override;
 
@@ -799,7 +802,7 @@ public:
 
     virtual void set_entry_max_length(int /*nChars*/) override;
 
-    virtual void set_entry_completion(bool, bool) override;
+    virtual void set_entry_completion(bool, bool bCaseSensitive = false) override;
 
     virtual ~SalInstanceComboBoxWithoutEdit() override;
 };
@@ -836,7 +839,7 @@ public:
 
     virtual void set_entry_max_length(int nChars) override;
 
-    virtual void set_entry_completion(bool bEnable, bool bCaseSensitive) override;
+    virtual void set_entry_completion(bool bEnable, bool bCaseSensitive = false) override;
 
     virtual void select_entry_region(int nStartPos, int nEndPos) override;
 
@@ -951,4 +954,60 @@ public:
     virtual ~SalInstanceCheckButton() override;
 };
 
+class SalInstanceDrawingArea : public SalInstanceWidget, public virtual weld::DrawingArea
+{
+protected:
+    VclPtr<VclDrawingArea> m_xDrawingArea;
+
+    typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> target_and_area;
+    DECL_LINK(PaintHdl, target_and_area, void);
+    DECL_LINK(ResizeHdl, const Size&, void);
+    DECL_LINK(MousePressHdl, const MouseEvent&, bool);
+    DECL_LINK(MouseMoveHdl, const MouseEvent&, bool);
+    DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool);
+    DECL_LINK(KeyPressHdl, const KeyEvent&, bool);
+    DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool);
+    DECL_LINK(StyleUpdatedHdl, VclDrawingArea&, void);
+    DECL_LINK(CommandHdl, const CommandEvent&, bool);
+    DECL_LINK(QueryTooltipHdl, tools::Rectangle&, OUString);
+
+    // SalInstanceWidget has a generic listener for all these
+    // events, ignore the ones we have specializations for
+    // in VclDrawingArea
+    virtual void HandleEventListener(VclWindowEvent& rEvent) override;
+
+    virtual void HandleMouseEventListener(VclSimpleEvent& rEvent) override;
+
+    virtual bool HandleKeyEventListener(VclWindowEvent& /*rEvent*/) override;
+
+public:
+    SalInstanceDrawingArea(VclDrawingArea* pDrawingArea, SalInstanceBuilder* pBuilder,
+                           const a11yref& rAlly, FactoryFunction pUITestFactoryFunction,
+                           void* pUserData, bool bTakeOwnership);
+
+    virtual void queue_draw() override;
+
+    virtual void queue_draw_area(int x, int y, int width, int height) override;
+
+    virtual void queue_resize() override;
+
+    virtual void connect_size_allocate(const Link<const Size&, void>& rLink) override;
+
+    virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override;
+
+    virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink) override;
+
+    virtual void set_cursor(PointerStyle ePointerStyle) override;
+
+    virtual a11yref get_accessible_parent() override;
+
+    virtual a11yrelationset get_accessible_relation_set() override;
+
+    virtual Point get_accessible_location() override;
+
+    virtual ~SalInstanceDrawingArea() override;
+
+    virtual OutputDevice& get_ref_device() override;
+};
+
 #endif
\ No newline at end of file
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index e2cad9d7592a..e485d0ea770f 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5287,160 +5287,139 @@ IMPL_LINK_NOARG(SalInstanceExpander, ExpandedHdl, VclExpander&, void)
     signal_expanded();
 }
 
-class SalInstanceDrawingArea : public SalInstanceWidget, public virtual weld::DrawingArea
+
+void SalInstanceDrawingArea::HandleEventListener(VclWindowEvent& rEvent)
 {
-private:
-    VclPtr<VclDrawingArea> m_xDrawingArea;
-
-    typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> target_and_area;
-    DECL_LINK(PaintHdl, target_and_area, void);
-    DECL_LINK(ResizeHdl, const Size&, void);
-    DECL_LINK(MousePressHdl, const MouseEvent&, bool);
-    DECL_LINK(MouseMoveHdl, const MouseEvent&, bool);
-    DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool);
-    DECL_LINK(KeyPressHdl, const KeyEvent&, bool);
-    DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool);
-    DECL_LINK(StyleUpdatedHdl, VclDrawingArea&, void);
-    DECL_LINK(CommandHdl, const CommandEvent&, bool);
-    DECL_LINK(QueryTooltipHdl, tools::Rectangle&, OUString);
-
-    // SalInstanceWidget has a generic listener for all these
-    // events, ignore the ones we have specializations for
-    // in VclDrawingArea
-    virtual void HandleEventListener(VclWindowEvent& rEvent) override
-    {
-        if (rEvent.GetId() == VclEventId::WindowResize)
-            return;
-        SalInstanceWidget::HandleEventListener(rEvent);
-    }
+    if (rEvent.GetId() == VclEventId::WindowResize)
+        return;
+    SalInstanceWidget::HandleEventListener(rEvent);
+}
 
-    virtual void HandleMouseEventListener(VclSimpleEvent& rEvent) override
+void SalInstanceDrawingArea::HandleMouseEventListener(VclSimpleEvent& rEvent)
+{
+    if (rEvent.GetId() == VclEventId::WindowMouseButtonDown ||
+        rEvent.GetId() == VclEventId::WindowMouseButtonUp ||
+        rEvent.GetId() == VclEventId::WindowMouseMove)
     {
-        if (rEvent.GetId() == VclEventId::WindowMouseButtonDown ||
-            rEvent.GetId() == VclEventId::WindowMouseButtonUp ||
-            rEvent.GetId() == VclEventId::WindowMouseMove)
-        {
-            return;
-        }
-        SalInstanceWidget::HandleMouseEventListener(rEvent);
+        return;
     }
+    SalInstanceWidget::HandleMouseEventListener(rEvent);
+}
 
 
-    virtual bool HandleKeyEventListener(VclWindowEvent& /*rEvent*/) override
-    {
-        return false;
-    }
+bool SalInstanceDrawingArea::HandleKeyEventListener(VclWindowEvent& /*rEvent*/)
+{
+    return false;
+}
 
-public:
-    SalInstanceDrawingArea(VclDrawingArea* pDrawingArea, SalInstanceBuilder* pBuilder, const a11yref& rAlly,
-            FactoryFunction pUITestFactoryFunction, void* pUserData, bool bTakeOwnership)
-        : SalInstanceWidget(pDrawingArea, pBuilder, bTakeOwnership)
-        , m_xDrawingArea(pDrawingArea)
-    {
-        m_xDrawingArea->SetAccessible(rAlly);
-        m_xDrawingArea->SetUITestFactory(std::move(pUITestFactoryFunction), pUserData);
-        m_xDrawingArea->SetPaintHdl(LINK(this, SalInstanceDrawingArea, PaintHdl));
-        m_xDrawingArea->SetResizeHdl(LINK(this, SalInstanceDrawingArea, ResizeHdl));
-        m_xDrawingArea->SetMousePressHdl(LINK(this, SalInstanceDrawingArea, MousePressHdl));
-        m_xDrawingArea->SetMouseMoveHdl(LINK(this, SalInstanceDrawingArea, MouseMoveHdl));
-        m_xDrawingArea->SetMouseReleaseHdl(LINK(this, SalInstanceDrawingArea, MouseReleaseHdl));
-        m_xDrawingArea->SetKeyPressHdl(LINK(this, SalInstanceDrawingArea, KeyPressHdl));
-        m_xDrawingArea->SetKeyReleaseHdl(LINK(this, SalInstanceDrawingArea, KeyReleaseHdl));
-        m_xDrawingArea->SetStyleUpdatedHdl(LINK(this, SalInstanceDrawingArea, StyleUpdatedHdl));
-        m_xDrawingArea->SetCommandHdl(LINK(this, SalInstanceDrawingArea, CommandHdl));
-        m_xDrawingArea->SetQueryTooltipHdl(LINK(this, SalInstanceDrawingArea, QueryTooltipHdl));
-    }
+SalInstanceDrawingArea::SalInstanceDrawingArea(VclDrawingArea* pDrawingArea, SalInstanceBuilder* pBuilder, const a11yref& rAlly,
+        FactoryFunction pUITestFactoryFunction, void* pUserData, bool bTakeOwnership)
+    : SalInstanceWidget(pDrawingArea, pBuilder, bTakeOwnership)
+    , m_xDrawingArea(pDrawingArea)
+{
+    m_xDrawingArea->SetAccessible(rAlly);
+    m_xDrawingArea->SetUITestFactory(std::move(pUITestFactoryFunction), pUserData);
+    m_xDrawingArea->SetPaintHdl(LINK(this, SalInstanceDrawingArea, PaintHdl));
+    m_xDrawingArea->SetResizeHdl(LINK(this, SalInstanceDrawingArea, ResizeHdl));
+    m_xDrawingArea->SetMousePressHdl(LINK(this, SalInstanceDrawingArea, MousePressHdl));
+    m_xDrawingArea->SetMouseMoveHdl(LINK(this, SalInstanceDrawingArea, MouseMoveHdl));
+    m_xDrawingArea->SetMouseReleaseHdl(LINK(this, SalInstanceDrawingArea, MouseReleaseHdl));
+    m_xDrawingArea->SetKeyPressHdl(LINK(this, SalInstanceDrawingArea, KeyPressHdl));
+    m_xDrawingArea->SetKeyReleaseHdl(LINK(this, SalInstanceDrawingArea, KeyReleaseHdl));
+    m_xDrawingArea->SetStyleUpdatedHdl(LINK(this, SalInstanceDrawingArea, StyleUpdatedHdl));
+    m_xDrawingArea->SetCommandHdl(LINK(this, SalInstanceDrawingArea, CommandHdl));
+    m_xDrawingArea->SetQueryTooltipHdl(LINK(this, SalInstanceDrawingArea, QueryTooltipHdl));
+}
 
-    virtual void queue_draw() override
-    {
-        m_xDrawingArea->Invalidate();
-    }
+void SalInstanceDrawingArea::queue_draw()
+{
+    m_xDrawingArea->Invalidate();
+}
 
-    virtual void queue_draw_area(int x, int y, int width, int height) override
-    {
-        m_xDrawingArea->Invalidate(tools::Rectangle(Point(x, y), Size(width, height)));
-    }
+void SalInstanceDrawingArea::queue_draw_area(int x, int y, int width, int height)
+{
+    m_xDrawingArea->Invalidate(tools::Rectangle(Point(x, y), Size(width, height)));
+}
 
-    virtual void queue_resize() override
-    {
-        m_xDrawingArea->queue_resize();
-    }
+void SalInstanceDrawingArea::queue_resize()
+{
+    m_xDrawingArea->queue_resize();
+}
 
-    virtual void connect_size_allocate(const Link<const Size&, void>& rLink) override
-    {
-        weld::Widget::connect_size_allocate(rLink);
-    }
+void SalInstanceDrawingArea::connect_size_allocate(const Link<const Size&, void>& rLink)
+{
+    weld::Widget::connect_size_allocate(rLink);
+}
 
-    virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override
-    {
-        weld::Widget::connect_key_press(rLink);
-    }
+void SalInstanceDrawingArea::connect_key_press(const Link<const KeyEvent&, bool>& rLink)
+{
+    weld::Widget::connect_key_press(rLink);
+}
 
-    virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink) override
-    {
-        weld::Widget::connect_key_release(rLink);
-    }
+void SalInstanceDrawingArea::connect_key_release(const Link<const KeyEvent&, bool>& rLink)
+{
+    weld::Widget::connect_key_release(rLink);
+}
 
-    virtual void set_cursor(PointerStyle ePointerStyle) override
-    {
-        m_xDrawingArea->SetPointer(ePointerStyle);
-    }
+void SalInstanceDrawingArea::set_cursor(PointerStyle ePointerStyle)
+{
+    m_xDrawingArea->SetPointer(ePointerStyle);
+}
 
-    virtual a11yref get_accessible_parent() override
-    {
-        vcl::Window* pParent = m_xDrawingArea->GetParent();
-        if (pParent)
-            return pParent->GetAccessible();
-        return css::uno::Reference<css::accessibility::XAccessible>();
-    }
+a11yref SalInstanceDrawingArea::get_accessible_parent()
+{
+    vcl::Window* pParent = m_xDrawingArea->GetParent();
+    if (pParent)
+        return pParent->GetAccessible();
+    return css::uno::Reference<css::accessibility::XAccessible>();
+}
 
-    virtual a11yrelationset get_accessible_relation_set() override
+a11yrelationset SalInstanceDrawingArea::get_accessible_relation_set()
+{
+    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+    css::uno::Reference< css::accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
+    vcl::Window* pWindow = m_xDrawingArea.get();
+    if (pWindow)
     {
-        utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-        css::uno::Reference< css::accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
-        vcl::Window* pWindow = m_xDrawingArea.get();
-        if (pWindow)
+        vcl::Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
+        if (pLabeledBy && pLabeledBy != pWindow)
         {
-            vcl::Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
-            if (pLabeledBy && pLabeledBy != pWindow)
-            {
-                css::uno::Sequence<css::uno::Reference<css::uno::XInterface>> aSequence { pLabeledBy->GetAccessible() };
-                pRelationSetHelper->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
-            }
-            vcl::Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
-            if (pMemberOf && pMemberOf != pWindow)
-            {
-                css::uno::Sequence<css::uno::Reference<css::uno::XInterface>> aSequence { pMemberOf->GetAccessible() };
-                pRelationSetHelper->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
-            }
+            css::uno::Sequence<css::uno::Reference<css::uno::XInterface>> aSequence { pLabeledBy->GetAccessible() };
+            pRelationSetHelper->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
+        }
+        vcl::Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
+        if (pMemberOf && pMemberOf != pWindow)
+        {
+            css::uno::Sequence<css::uno::Reference<css::uno::XInterface>> aSequence { pMemberOf->GetAccessible() };
+            pRelationSetHelper->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
         }
-        return xSet;
     }
+    return xSet;
+}
 
-    virtual Point get_accessible_location() override
-    {
-        return m_xDrawingArea->OutputToAbsoluteScreenPixel(Point());
-    }
+Point SalInstanceDrawingArea::get_accessible_location()
+{
+    return m_xDrawingArea->OutputToAbsoluteScreenPixel(Point());
+}
 
-    virtual ~SalInstanceDrawingArea() override
-    {
-        m_xDrawingArea->SetQueryTooltipHdl(Link<tools::Rectangle&, OUString>());
-        m_xDrawingArea->SetCommandHdl(Link<const CommandEvent&, bool>());
-        m_xDrawingArea->SetStyleUpdatedHdl(Link<VclDrawingArea&, void>());
-        m_xDrawingArea->SetMousePressHdl(Link<const MouseEvent&, bool>());
-        m_xDrawingArea->SetMouseMoveHdl(Link<const MouseEvent&, bool>());
-        m_xDrawingArea->SetMouseReleaseHdl(Link<const MouseEvent&, bool>());
-        m_xDrawingArea->SetKeyPressHdl(Link<const KeyEvent&, bool>());
-        m_xDrawingArea->SetKeyReleaseHdl(Link<const KeyEvent&, bool>());
-        m_xDrawingArea->SetResizeHdl(Link<const Size&, void>());
-        m_xDrawingArea->SetPaintHdl(Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>());
-    }
+SalInstanceDrawingArea::~SalInstanceDrawingArea()
+{
+    m_xDrawingArea->SetQueryTooltipHdl(Link<tools::Rectangle&, OUString>());
+    m_xDrawingArea->SetCommandHdl(Link<const CommandEvent&, bool>());
+    m_xDrawingArea->SetStyleUpdatedHdl(Link<VclDrawingArea&, void>());
+    m_xDrawingArea->SetMousePressHdl(Link<const MouseEvent&, bool>());
+    m_xDrawingArea->SetMouseMoveHdl(Link<const MouseEvent&, bool>());
+    m_xDrawingArea->SetMouseReleaseHdl(Link<const MouseEvent&, bool>());
+    m_xDrawingArea->SetKeyPressHdl(Link<const KeyEvent&, bool>());
+    m_xDrawingArea->SetKeyReleaseHdl(Link<const KeyEvent&, bool>());
+    m_xDrawingArea->SetResizeHdl(Link<const Size&, void>());
+    m_xDrawingArea->SetPaintHdl(Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>());
+}
 
-    virtual OutputDevice& get_ref_device() override
-    {
-        return *m_xDrawingArea;
-    }
-};
+OutputDevice& SalInstanceDrawingArea::get_ref_device()
+{
+    return *m_xDrawingArea;
+}
 
 IMPL_LINK(SalInstanceDrawingArea, PaintHdl, target_and_area, aPayload, void)
 {
@@ -5823,9 +5802,9 @@ IMPL_LINK(SalInstanceEntryTreeView, AutocompleteHdl, Edit&, rEdit, void)
     }
 }
 
-SalInstanceBuilder::SalInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile)
+SalInstanceBuilder::SalInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, const css::uno::Reference<css::frame::XFrame>& rFrame)
     : weld::Builder(rUIFile)
-    , 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