diff options
-rw-r--r-- | include/toolkit/helper/vclunohelper.hxx | 8 | ||||
-rw-r--r-- | toolkit/source/helper/vclunohelper.cxx | 26 | ||||
-rw-r--r-- | vbahelper/source/msforms/vbacontrol.cxx | 16 |
3 files changed, 29 insertions, 21 deletions
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 ) |