[Libreoffice-commits] core.git: include/toolkit toolkit/source vbahelper/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 8 11:23:44 UTC 2021


 include/toolkit/helper/vclunohelper.hxx |    8 +++++---
 toolkit/source/helper/vclunohelper.cxx  |   26 ++++++++++++++++++++++----
 vbahelper/source/msforms/vbacontrol.cxx |   16 ++--------------
 3 files changed, 29 insertions(+), 21 deletions(-)

New commits:
commit 396dfdd2164d095e4ec182956b31aca8c3908655
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Apr 7 21:27:44 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Apr 8 13:23:04 2021 +0200

    move set/get Pointer to VCLUnoHelper
    
    Change-Id: I7dadc7bc881e0b892720b3eb89fdc60c8d87c541
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113776
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/toolkit/helper/vclunohelper.hxx b/include/toolkit/helper/vclunohelper.hxx
index 75af557dc801..a4e1a061ee80 100644
--- a/include/toolkit/helper/vclunohelper.hxx
+++ b/include/toolkit/helper/vclunohelper.hxx
@@ -60,13 +60,13 @@ namespace com::sun::star::awt {
 }
 
 
+enum class PointerStyle;
+
 class FontMetric;
 class OutputDevice;
 class MouseEvent;
 class KeyEvent;
 
-
-
 class TOOLKIT_DLLPUBLIC VCLUnoHelper
 {
 public:
@@ -148,8 +148,10 @@ public:
         );
 
     static ::KeyEvent createVCLKeyEvent( const css::awt::KeyEvent& _rAwtEvent );
-};
 
+    static ::PointerStyle getMousePointer(const css::uno::Reference<css::awt::XWindowPeer>& rWindowPeer);
+    static void setMousePointer(const css::uno::Reference<css::awt::XWindowPeer>& rWindowPeer, ::PointerStyle mousepointer);
+};
 
 #endif // INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX
 
diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx
index 3ef71e8aab07..3a7cc7446c1f 100644
--- a/toolkit/source/helper/vclunohelper.cxx
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -18,10 +18,13 @@
  */
 
 #include <tools/stream.hxx>
+#include <vcl/dibtools.hxx>
 #include <vcl/event.hxx>
-#include <vcl/window.hxx>
-#include <vcl/unohelp.hxx>
+#include <vcl/graph.hxx>
 #include <vcl/metric.hxx>
+#include <vcl/ptrstyle.hxx>
+#include <vcl/unohelp.hxx>
+#include <vcl/window.hxx>
 #include <com/sun/star/util/MeasureUnit.hpp>
 #include <com/sun/star/awt/XBitmap.hpp>
 #include <com/sun/star/awt/XWindow.hpp>
@@ -42,13 +45,11 @@
 #include <toolkit/awt/vclxfont.hxx>
 #include <controls/unocontrolcontainer.hxx>
 #include <controls/unocontrolcontainermodel.hxx>
-#include <vcl/graph.hxx>
 #include <comphelper/processfactory.hxx>
 
 #include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/awt/Point.hpp>
-#include <vcl/dibtools.hxx>
 
 using namespace ::com::sun::star;
 
@@ -587,4 +588,21 @@ awt::KeyEvent VCLUnoHelper::createKeyEvent( const ::KeyEvent& _rVclEvent, const
 
 }
 
+::PointerStyle VCLUnoHelper::getMousePointer(const css::uno::Reference<css::awt::XWindowPeer>& rWindowPeer)
+{
+    ::PointerStyle eType = ::PointerStyle::Arrow; // default ?
+    VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rWindowPeer);
+    if (pWindow)
+        eType = pWindow->GetPointer();
+    return eType;
+}
+
+void VCLUnoHelper::setMousePointer(const css::uno::Reference<css::awt::XWindowPeer>& rWindowPeer, ::PointerStyle ePointer)
+{
+    VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rWindowPeer);
+    if (!pWindow)
+        return;
+    pWindow->SetPointer(ePointer);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 66165d9c7ba7..050d27a19823 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -55,7 +55,6 @@
 #include "vbasystemaxcontrol.hxx"
 #include "vbaimage.hxx"
 #include <toolkit/helper/vclunohelper.hxx>
-#include <vcl/window.hxx>
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 #include <com/sun/star/form/XFormsSupplier.hpp>
 #include <svx/svdobj.hxx>
@@ -494,24 +493,13 @@ static PointerStyle lcl_msoPointerToLOPointer( tools::Long msoPointerStyle )
 ::sal_Int32 SAL_CALL
 ScVbaControl::getMousePointer()
 {
-    PointerStyle eType = PointerStyle::Arrow; // default ?
-    VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( getWindowPeer() );
-    if ( pWindow )
-    {
-        eType = pWindow->GetPointer();
-    }
-    return lcl_loPointerToMsoPointer( eType );
+    return lcl_loPointerToMsoPointer(VCLUnoHelper::getMousePointer(getWindowPeer()));
 }
 
 void SAL_CALL
 ScVbaControl::setMousePointer( ::sal_Int32 _mousepointer )
 {
-    VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( getWindowPeer() );
-    if ( pWindow )
-    {
-        PointerStyle aPointer = lcl_msoPointerToLOPointer( _mousepointer );
-        pWindow->SetPointer( aPointer );
-    }
+    VCLUnoHelper::setMousePointer(getWindowPeer(), lcl_msoPointerToLOPointer(_mousepointer));
 }
 
 void SAL_CALL ScVbaControl::fireEvent( const script::ScriptEvent& rEvt )


More information about the Libreoffice-commits mailing list