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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 24 12:02:27 UTC 2020


 vcl/inc/salvtables.hxx        |   60 ++++++++++
 vcl/source/app/salvtables.cxx |  252 +++++++++++++++++++-----------------------
 2 files changed, 174 insertions(+), 138 deletions(-)

New commits:
commit 3ad02c1728345d7829be9f01dba6261edce78eb8
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jun 24 11:05:41 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Jun 24 14:01:46 2020 +0200

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

diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index c95c4fb05187..f1fbb4136076 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1103,4 +1103,64 @@ public:
     virtual ~SalInstanceCheckButton() override;
 };
 
+class SalInstanceDrawingArea : public SalInstanceWidget, public virtual weld::DrawingArea
+{
+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);
+    DECL_LINK(StartDragHdl, VclDrawingArea*, bool);
+
+    // 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 void enable_drag_source(rtl::Reference<TransferDataContainer>& rHelper,
+                                    sal_uInt8 eDNDConstants) override;
+
+    virtual ~SalInstanceDrawingArea() override;
+
+    virtual OutputDevice& get_ref_device() override;
+};
+
 /* 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 0f4ba0ecc2b0..9a9484397274 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5583,168 +5583,144 @@ public:
 
 IMPL_LINK_NOARG(SalInstanceExpander, ExpandedHdl, VclExpander&, void) { signal_expanded(); }
 
-namespace
-{
-class SalInstanceDrawingArea : public SalInstanceWidget, public virtual weld::DrawingArea
+// SalInstanceWidget has a generic listener for all these
+// events, ignore the ones we have specializations for
+// in VclDrawingArea
+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);
-    DECL_LINK(StartDragHdl, VclDrawingArea*, bool);
-
-    // 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));
-        m_xDrawingArea->SetStartDragHdl(LINK(this, SalInstanceDrawingArea, StartDragHdl));
-    }
+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));
+    m_xDrawingArea->SetStartDragHdl(LINK(this, SalInstanceDrawingArea, StartDragHdl));
+}
 
-    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;
-    }
-
-    virtual Point get_accessible_location() override
-    {
-        return m_xDrawingArea->OutputToAbsoluteScreenPixel(Point());
-    }
-
-    virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rHelper,
-                                    sal_uInt8 eDNDConstants) override
-    {
-        m_xDrawingArea->SetDragHelper(rHelper, eDNDConstants);
     }
+    return xSet;
+}
 
-    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>());
-    }
+Point SalInstanceDrawingArea::get_accessible_location()
+{
+    return m_xDrawingArea->OutputToAbsoluteScreenPixel(Point());
+}
 
-    virtual OutputDevice& get_ref_device() override { return *m_xDrawingArea; }
-};
+void SalInstanceDrawingArea::enable_drag_source(rtl::Reference<TransferDataContainer>& rHelper,
+                                sal_uInt8 eDNDConstants)
+{
+    m_xDrawingArea->SetDragHelper(rHelper, eDNDConstants);
+}
 
+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>());
 }
 
+OutputDevice& SalInstanceDrawingArea::get_ref_device() { return *m_xDrawingArea; }
+
 IMPL_LINK(SalInstanceDrawingArea, PaintHdl, target_and_area, aPayload, void)
 {
     m_aDrawHdl.Call(aPayload);


More information about the Libreoffice-commits mailing list