diff options
Diffstat (limited to 'include/toolkit')
-rw-r--r-- | include/toolkit/awt/vclxaccessiblecomponent.hxx | 129 | ||||
-rw-r--r-- | include/toolkit/awt/vclxdevice.hxx | 82 | ||||
-rw-r--r-- | include/toolkit/awt/vclxfont.hxx | 72 | ||||
-rw-r--r-- | include/toolkit/awt/vclxmenu.hxx | 156 | ||||
-rw-r--r-- | include/toolkit/awt/vclxwindow.hxx | 232 | ||||
-rw-r--r-- | include/toolkit/awt/vclxwindows.hxx | 727 | ||||
-rw-r--r-- | include/toolkit/controls/unocontrol.hxx | 231 | ||||
-rw-r--r-- | include/toolkit/controls/unocontrolbase.hxx | 66 | ||||
-rw-r--r-- | include/toolkit/controls/unocontrolmodel.hxx | 174 | ||||
-rw-r--r-- | include/toolkit/controls/unocontrols.hxx | 1491 | ||||
-rw-r--r-- | include/toolkit/dllapi.h | 34 | ||||
-rw-r--r-- | include/toolkit/helper/accessiblefactory.hxx | 151 | ||||
-rw-r--r-- | include/toolkit/helper/convert.hxx | 61 | ||||
-rw-r--r-- | include/toolkit/helper/emptyfontdescriptor.hxx | 40 | ||||
-rw-r--r-- | include/toolkit/helper/listenermultiplexer.hxx | 310 | ||||
-rw-r--r-- | include/toolkit/helper/macros.hxx | 166 | ||||
-rw-r--r-- | include/toolkit/helper/vclunohelper.hxx | 156 |
17 files changed, 4278 insertions, 0 deletions
diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx new file mode 100644 index 0000000000..d3aaa30f56 --- /dev/null +++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx @@ -0,0 +1,129 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX +#define INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX + +#include <toolkit/dllapi.h> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase.hxx> +#include <comphelper/accessiblecomponenthelper.hxx> + + +#include <tools/link.hxx> +#include <vcl/vclptr.hxx> + +namespace com::sun::star::accessibility { class XAccessible; } + +namespace vcl { class Window; } +class VCLXWindow; +class VclWindowEvent; + +namespace utl { +class AccessibleRelationSetHelper; +} + + + +class TOOLKIT_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") VCLXAccessibleComponent + :public cppu::ImplInheritanceHelper< + comphelper::OAccessibleExtendedComponentHelper, css::lang::XServiceInfo> +{ +private: + rtl::Reference<VCLXWindow> m_xVCLXWindow; + VclPtr<vcl::Window> m_xEventSource; + + DECL_DLLPRIVATE_LINK( WindowEventListener, VclWindowEvent&, void ); + DECL_DLLPRIVATE_LINK( WindowChildEventListener, VclWindowEvent&, void ); + void DisconnectEvents(); + +protected: + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ); + virtual void FillAccessibleStateSet( sal_Int64& rStateSet ); + + virtual css::uno::Reference< css::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent ); + +public: + VCLXAccessibleComponent( VCLXWindow* pVCLXWindow ); + virtual ~VCLXAccessibleComponent() override; + + VCLXWindow* GetVCLXWindow() const; + vcl::Window* GetWindow() const; + template< class derived_type > derived_type* GetAs() const { + return static_cast< derived_type * >( GetWindow() ); } + template< class derived_type > derived_type* GetAsDynamic() const { + return dynamic_cast< derived_type * >( GetWindow() ); } + + virtual void SAL_CALL disposing() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // css::accessibility::XAccessibleContext + sal_Int64 SAL_CALL getAccessibleChildCount( ) override; + css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; + css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override; + sal_Int16 SAL_CALL getAccessibleRole( ) override; + OUString SAL_CALL getAccessibleDescription( ) override; + OUString SAL_CALL getAccessibleName( ) override; + OUString SAL_CALL getAccessibleId( ) override; + css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; + sal_Int64 SAL_CALL getAccessibleStateSet( ) override; + css::lang::Locale SAL_CALL getLocale( ) override; + + // css::accessibility::XAccessibleComponent + css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + css::awt::Point SAL_CALL getLocationOnScreen( ) override; + void SAL_CALL grabFocus( ) override; + virtual sal_Int32 SAL_CALL getForeground( ) override; + virtual sal_Int32 SAL_CALL getBackground( ) override; + + // css::accessibility::XAccessibleExtendedComponent + virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; + virtual OUString SAL_CALL getTitledBorderText( ) override; + virtual OUString SAL_CALL getToolTipText( ) override; + +protected: + // base class overridables + css::awt::Rectangle implGetBounds( ) override; +}; + +/* ---------------------------------------------------------- + Accessibility only for the Window hierarchy! + Maybe derived classes must overwrite these Accessibility interfaces: + + // XAccessibleContext: + sal_Int16 getAccessibleRole() => VCL Window::GetAccessibleRole() + OUString getAccessibleDescription() => VCL Window::GetAccessibleDescription + OUString getAccessibleName() => VCL Window::GetAccessibleText() => Most windows return Window::GetText() + OUString getAccessibleId() => VCL Window::get_id() + Reference< XAccessibleRelationSet > getAccessibleRelationSet() + sal_Int64 getAccessibleStateSet() => override FillAccessibleStateSet( ... ) + +---------------------------------------------------------- */ + + +#endif // INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/awt/vclxdevice.hxx b/include/toolkit/awt/vclxdevice.hxx new file mode 100644 index 0000000000..4538eb9d87 --- /dev/null +++ b/include/toolkit/awt/vclxdevice.hxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_AWT_VCLXDEVICE_HXX +#define INCLUDED_TOOLKIT_AWT_VCLXDEVICE_HXX + +#include <toolkit/dllapi.h> +#include <com/sun/star/awt/XDevice.hpp> +#include <cppuhelper/implbase.hxx> +#include <vcl/virdev.hxx> +#include <vcl/vclptr.hxx> + +#include <com/sun/star/awt/XUnitConversion.hpp> + +/// A UNO wrapper for the VCL OutputDevice +class TOOLKIT_DLLPUBLIC VCLXDevice : + public cppu::WeakImplHelper< + css::awt::XDevice, + css::awt::XUnitConversion> +{ + friend class VCLXGraphics; + friend class VCLXVirtualDevice; + +private: + VclPtr<OutputDevice> mpOutputDevice; + +public: + VCLXDevice(); + virtual ~VCLXDevice() override; + + void SetOutputDevice( const VclPtr<OutputDevice> &pOutDev ) { mpOutputDevice = pOutDev; } + const VclPtr<OutputDevice>& GetOutputDevice() const { return mpOutputDevice; } + + // css::awt::XDevice, + css::uno::Reference< css::awt::XGraphics > SAL_CALL createGraphics( ) override; + css::uno::Reference< css::awt::XDevice > SAL_CALL createDevice( sal_Int32 nWidth, sal_Int32 nHeight ) override; + css::awt::DeviceInfo SAL_CALL getInfo() override; + css::uno::Sequence< css::awt::FontDescriptor > SAL_CALL getFontDescriptors( ) override; + css::uno::Reference< css::awt::XFont > SAL_CALL getFont( const css::awt::FontDescriptor& aDescriptor ) override; + css::uno::Reference< css::awt::XBitmap > SAL_CALL createBitmap( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight ) override; + css::uno::Reference< css::awt::XDisplayBitmap > SAL_CALL createDisplayBitmap( const css::uno::Reference< css::awt::XBitmap >& Bitmap ) override; + + // css::awt::XUnitConversion + css::awt::Point SAL_CALL convertPointToLogic( const css::awt::Point& aPoint, ::sal_Int16 TargetUnit ) override; + css::awt::Point SAL_CALL convertPointToPixel( const css::awt::Point& aPoint, ::sal_Int16 SourceUnit ) override; + css::awt::Size SAL_CALL convertSizeToLogic( const css::awt::Size& aSize, ::sal_Int16 TargetUnit ) override; + css::awt::Size SAL_CALL convertSizeToPixel( const css::awt::Size& aSize, ::sal_Int16 SourceUnit ) override; + + +}; + + + + +class VCLXVirtualDevice final : public VCLXDevice +{ +public: + virtual ~VCLXVirtualDevice() override; + + void SetVirtualDevice( VirtualDevice* pVDev ) { SetOutputDevice( pVDev ); } +}; + + +#endif // INCLUDED_TOOLKIT_AWT_VCLXDEVICE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/awt/vclxfont.hxx b/include/toolkit/awt/vclxfont.hxx new file mode 100644 index 0000000000..3142a18123 --- /dev/null +++ b/include/toolkit/awt/vclxfont.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX +#define INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX + +#include <memory> +#include <toolkit/dllapi.h> +#include <com/sun/star/awt/XFont2.hpp> +#include <cppuhelper/implbase.hxx> +#include <mutex> +#include <vcl/font.hxx> + +namespace com::sun::star::awt { class XDevice; } + +class FontMetric; + + + + +class TOOLKIT_DLLPUBLIC VCLXFont final : + public cppu::WeakImplHelper< + css::awt::XFont2> +{ + std::mutex maMutex; + css::uno::Reference< css::awt::XDevice> mxDevice; + vcl::Font maFont; + std::unique_ptr<FontMetric> + mpFontMetric; + + bool ImplAssertValidFontMetric(); + +public: + VCLXFont(); + virtual ~VCLXFont() override; + + void Init( css::awt::XDevice& rxDev, const vcl::Font& rFont ); + const vcl::Font& GetFont() const { return maFont; } + + // css::lang::XFont + css::awt::FontDescriptor SAL_CALL getFontDescriptor( ) override; + css::awt::SimpleFontMetric SAL_CALL getFontMetric( ) override; + sal_Int16 SAL_CALL getCharWidth( sal_Unicode c ) override; + css::uno::Sequence< sal_Int16 > SAL_CALL getCharWidths( sal_Unicode nFirst, sal_Unicode nLast ) override; + sal_Int32 SAL_CALL getStringWidth( const OUString& str ) override; + sal_Int32 SAL_CALL getStringWidthArray( const OUString& str, css::uno::Sequence< sal_Int32 >& rDXArray ) override; + void SAL_CALL getKernPairs( css::uno::Sequence< sal_Unicode >& rnChars1, css::uno::Sequence< sal_Unicode >& rnChars2, css::uno::Sequence< sal_Int16 >& rnKerns ) override; + + // css::lang::XFont2 + sal_Bool SAL_CALL hasGlyphs( const OUString& aText ) override; +}; + + +#endif // INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/awt/vclxmenu.hxx b/include/toolkit/awt/vclxmenu.hxx new file mode 100644 index 0000000000..3498e8dabe --- /dev/null +++ b/include/toolkit/awt/vclxmenu.hxx @@ -0,0 +1,156 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_AWT_VCLXMENU_HXX +#define INCLUDED_TOOLKIT_AWT_VCLXMENU_HXX + +#include <config_options.h> +#include <toolkit/dllapi.h> +#include <toolkit/helper/listenermultiplexer.hxx> + +#include <com/sun/star/awt/XMenuBar.hpp> +#include <com/sun/star/awt/XPopupMenu.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> + +#include <cppuhelper/weak.hxx> +#include <mutex> + +#include <tools/link.hxx> +#include <vcl/vclptr.hxx> + +#include <vector> + +class Menu; +class MenuBar; +class PopupMenu; +class VclMenuEvent; + +typedef ::std::vector< + css::uno::Reference< css::awt::XPopupMenu > +> PopupMenuRefList; + +typedef void (*MenuUserDataReleaseFunction)(void*); + +class TOOLKIT_DLLPUBLIC VCLXMenu : public css::awt::XMenuBar, + public css::awt::XPopupMenu, + public css::lang::XServiceInfo, + public css::lang::XTypeProvider, + public ::cppu::OWeakObject +{ +private: + std::mutex maMutex; + VclPtr<Menu> mpMenu; + MenuListenerMultiplexer maMenuListeners; + PopupMenuRefList maPopupMenuRefs; + sal_Int16 mnDefaultItem; + +protected: + + DECL_DLLPRIVATE_LINK( MenuEventListener, VclMenuEvent&, void ); + + void ImplCreateMenu( bool bPopup ); + void ImplAddListener(); + +public: + VCLXMenu(); + VCLXMenu( Menu* pMenu ); + virtual ~VCLXMenu() override; + + + Menu* GetMenu() const { return mpMenu; } + bool IsPopupMenu() const; + void setUserValue(sal_uInt16 nItemId, void* nUserValue, MenuUserDataReleaseFunction aFunc); + void* getUserValue(sal_uInt16 nItemId); + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XMenu + virtual void SAL_CALL addMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) override; + virtual void SAL_CALL removeMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) override; + virtual void SAL_CALL insertItem( sal_Int16 nItemId, const OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) override; + virtual void SAL_CALL removeItem( sal_Int16 nPos, sal_Int16 nCount ) override; + virtual void SAL_CALL clear( ) override; + virtual sal_Int16 SAL_CALL getItemCount( ) override; + virtual sal_Int16 SAL_CALL getItemId( sal_Int16 nPos ) override; + virtual sal_Int16 SAL_CALL getItemPos( sal_Int16 nId ) override; + virtual css::awt::MenuItemType SAL_CALL getItemType( ::sal_Int16 nItemPos ) override; + virtual void SAL_CALL enableItem( sal_Int16 nItemId, sal_Bool bEnable ) override; + virtual sal_Bool SAL_CALL isItemEnabled( sal_Int16 nItemId ) override; + virtual void SAL_CALL hideDisabledEntries( sal_Bool bHide ) override; + virtual void SAL_CALL enableAutoMnemonics( sal_Bool bEnable ) override; + virtual void SAL_CALL setItemText( sal_Int16 nItemId, const OUString& aText ) override; + virtual OUString SAL_CALL getItemText( sal_Int16 nItemId ) override; + virtual void SAL_CALL setCommand( sal_Int16 nItemId, const OUString& aCommand ) override; + virtual OUString SAL_CALL getCommand( sal_Int16 nItemId ) override; + virtual void SAL_CALL setHelpCommand( sal_Int16 nItemId, const OUString& aHelp ) override; + virtual OUString SAL_CALL getHelpCommand( sal_Int16 nItemId ) override; + virtual void SAL_CALL setHelpText( ::sal_Int16 nItemId, const OUString& sHelpText ) override; + virtual OUString SAL_CALL getHelpText( ::sal_Int16 nItemId ) override; + virtual void SAL_CALL setTipHelpText( ::sal_Int16 nItemId, const OUString& sTipHelpText ) override; + virtual OUString SAL_CALL getTipHelpText( ::sal_Int16 nItemId ) override; + + virtual sal_Bool SAL_CALL isPopupMenu( ) override; + virtual void SAL_CALL setPopupMenu( sal_Int16 nItemId, const css::uno::Reference< css::awt::XPopupMenu >& aPopupMenu ) override; + virtual css::uno::Reference< css::awt::XPopupMenu > SAL_CALL getPopupMenu( sal_Int16 nItemId ) override; + + // css::awt::XPopupMenu + virtual void SAL_CALL insertSeparator( sal_Int16 nPos ) override; + virtual void SAL_CALL setDefaultItem( sal_Int16 nItemId ) override; + virtual sal_Int16 SAL_CALL getDefaultItem( ) override; + virtual void SAL_CALL checkItem( sal_Int16 nItemId, sal_Bool bCheck ) override; + virtual sal_Bool SAL_CALL isItemChecked( sal_Int16 nItemId ) override; + virtual ::sal_Int16 SAL_CALL execute( const css::uno::Reference< css::awt::XWindowPeer >& Parent, const css::awt::Rectangle& Position, ::sal_Int16 Direction ) override; + virtual sal_Bool SAL_CALL isInExecute( ) override; + virtual void SAL_CALL endExecute( ) override; + virtual void SAL_CALL setAcceleratorKeyEvent( ::sal_Int16 nItemId, const css::awt::KeyEvent& aKeyEvent ) override; + virtual css::awt::KeyEvent SAL_CALL getAcceleratorKeyEvent( ::sal_Int16 nItemId ) override; + virtual void SAL_CALL setItemImage( ::sal_Int16 nItemId, const css::uno::Reference< css::graphic::XGraphic >& xGraphic, sal_Bool bScale ) override; + virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getItemImage( ::sal_Int16 nItemId ) override; + + // css::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; +}; + +class UNLESS_MERGELIBS(TOOLKIT_DLLPUBLIC) VCLXMenuBar final : public VCLXMenu +{ +public: + VCLXMenuBar(); + VCLXMenuBar( MenuBar* pMenuBar ); +}; + +class TOOLKIT_DLLPUBLIC VCLXPopupMenu final : public VCLXMenu +{ +public: + VCLXPopupMenu(); + VCLXPopupMenu( PopupMenu* pPopMenu ); +}; + +#endif // INCLUDED_TOOLKIT_AWT_VCLXMENU_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/awt/vclxwindow.hxx b/include/toolkit/awt/vclxwindow.hxx new file mode 100644 index 0000000000..f3b605bc84 --- /dev/null +++ b/include/toolkit/awt/vclxwindow.hxx @@ -0,0 +1,232 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <toolkit/dllapi.h> +#include <toolkit/awt/vclxdevice.hxx> +#include <vcl/vclptr.hxx> + +#include <com/sun/star/awt/XWindow2.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/awt/XLayoutConstrains.hpp> +#include <com/sun/star/awt/XView.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/awt/XDockableWindow.hpp> +#include <com/sun/star/awt/XStyleSettingsSupplier.hpp> + +#include <cppuhelper/implbase.hxx> + +#include <tools/gen.hxx> +#include <tools/link.hxx> + +#include <memory> +#include <vector> +#include <functional> + +template <class ListenerT> class ListenerMultiplexerBase; +namespace com::sun::star::accessibility { class XAccessibleContext; } +namespace com::sun::star::awt { class XTopWindowListener; } +namespace com::sun::star::awt { class XVclContainerListener; } +namespace vcl { class Window; } + +class VclWindowEvent; + +namespace toolkit +{ + class IAccessibleFactory; +} + + +class UnoPropertyArrayHelper; +class VCLXWindowImpl; +typedef cppu::ImplInheritanceHelper< VCLXDevice, + css::awt::XWindow2, + css::awt::XVclWindowPeer, + css::awt::XLayoutConstrains, + css::awt::XView, + css::awt::XDockableWindow, + css::accessibility::XAccessible, + css::lang::XEventListener, + css::beans::XPropertySetInfo, + css::awt::XStyleSettingsSupplier + > VCLXWindow_Base; + +class TOOLKIT_DLLPUBLIC VCLXWindow : public VCLXWindow_Base +{ +private: + std::unique_ptr<VCLXWindowImpl> mpImpl; + + UnoPropertyArrayHelper *GetPropHelper(); + +protected: + Size ImplCalcWindowSize( const Size& rOutSz ) const; + DECL_DLLPRIVATE_LINK(WindowEventListener, VclWindowEvent&, void ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + CreateAccessibleContext(); + + void SetSynthesizingVCLEvent( bool b ); + bool IsSynthesizingVCLEvent() const; + + void SetSystemParent_Impl( const css::uno::Any& rHandle ); + + ::toolkit::IAccessibleFactory& getAccessibleFactory(); + + // helper ... + static void PushPropertyIds( std::vector< sal_uInt16 > &aIds, int nFirstId, ...); + // for use in controls/ + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds, + bool bWithDefaults = false ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ); + + ListenerMultiplexerBase<css::awt::XVclContainerListener>& GetContainerListeners(); + ListenerMultiplexerBase<css::awt::XTopWindowListener>& GetTopWindowListeners(); + +public: + typedef ::std::function<void ()> Callback; + +protected: + /** executes the given callback asynchronously + + At the moment the callback is called, the Solar Mutex is not locked. In particular, this implies that + you cannot rely on |this| not being disposed. However, you *can* rely on |this| being still alive (i.e. + having a ref count > 0). + + As a consequence, this can be used for doing listener notifications, using event multiplexers. Those multiplexers + care for the disposed state themself, and are alive as long as |this| is alive. + */ + void ImplExecuteAsyncWithoutSolarLock( + const Callback& i_callback + ); + +public: + VCLXWindow( bool bWithDefaultProps = false ); + virtual ~VCLXWindow() override; + + virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ); + template< class derived_type > derived_type* GetAs() const { + return static_cast< derived_type * >( GetWindow() ); } + template< class derived_type > derived_type* GetAsDynamic() const { + return dynamic_cast< derived_type * >( GetWindow() ); } + vcl::Window* GetWindow() const + { + auto p = GetOutputDevice().get(); + return p ? p->GetOwnerWindow() : nullptr; + } + + void suspendVclEventListening( ); + void resumeVclEventListening( ); + + void notifyWindowRemoved( vcl::Window const & _rWindow ); + + bool IsDisposed() const; + + // css::lang::XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& rxListener ) override; + void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& rxListener ) override; + + // css::awt::XWindow + void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) override; + css::awt::Rectangle SAL_CALL getPosSize( ) override; + void SAL_CALL setVisible( sal_Bool Visible ) override; + void SAL_CALL setEnable( sal_Bool Enable ) override; + void SAL_CALL setFocus( ) override; + void SAL_CALL addWindowListener( const css::uno::Reference< css::awt::XWindowListener >& rrxListener ) override; + void SAL_CALL removeWindowListener( const css::uno::Reference< css::awt::XWindowListener >& rrxListener ) override; + void SAL_CALL addFocusListener( const css::uno::Reference< css::awt::XFocusListener >& rrxListener ) override; + void SAL_CALL removeFocusListener( const css::uno::Reference< css::awt::XFocusListener >& rrxListener ) override; + void SAL_CALL addKeyListener( const css::uno::Reference< css::awt::XKeyListener >& rrxListener ) override; + void SAL_CALL removeKeyListener( const css::uno::Reference< css::awt::XKeyListener >& rrxListener ) override; + void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& rrxListener ) override; + void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& rrxListener ) override; + void SAL_CALL addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& rrxListener ) override; + void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& rrxListener ) override; + void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& rrxListener ) override; + void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& rrxListener ) override; + + // css::awt::XWindowPeer + css::uno::Reference< css::awt::XToolkit > SAL_CALL getToolkit( ) override; + void SAL_CALL setPointer( const css::uno::Reference< css::awt::XPointer >& Pointer ) override; + void SAL_CALL setBackground( sal_Int32 Color ) override; + void SAL_CALL invalidate( sal_Int16 Flags ) override; + void SAL_CALL invalidateRect( const css::awt::Rectangle& Rect, sal_Int16 Flags ) override; + + // css::awt::XVclWindowPeer + sal_Bool SAL_CALL isChild( const css::uno::Reference< css::awt::XWindowPeer >& Peer ) override; + void SAL_CALL setDesignMode( sal_Bool bOn ) override; + sal_Bool SAL_CALL isDesignMode( ) override; + void SAL_CALL enableClipSiblings( sal_Bool bClip ) override; + void SAL_CALL setForeground( sal_Int32 Color ) override; + void SAL_CALL setControlFont( const css::awt::FontDescriptor& aFont ) override; + void SAL_CALL getStyles( sal_Int16 nType, css::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) override; + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::awt::XView + sal_Bool SAL_CALL setGraphics( const css::uno::Reference< css::awt::XGraphics >& aDevice ) override; + css::uno::Reference< css::awt::XGraphics > SAL_CALL getGraphics( ) override; + css::awt::Size SAL_CALL getSize( ) override; + void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) override; + void SAL_CALL setZoom( float fZoomX, float fZoomY ) override; + + // css::accessibility::XAccessible + css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + + // css::awt::XDockableWindow + void SAL_CALL addDockableWindowListener( const css::uno::Reference< css::awt::XDockableWindowListener >& xListener ) override; + void SAL_CALL removeDockableWindowListener( const css::uno::Reference< css::awt::XDockableWindowListener >& xListener ) override; + void SAL_CALL enableDocking( sal_Bool bEnable ) override; + sal_Bool SAL_CALL isFloating( ) override; + void SAL_CALL setFloatingMode( sal_Bool bFloating ) override; + void SAL_CALL lock( ) override; + void SAL_CALL unlock( ) override; + sal_Bool SAL_CALL isLocked( ) override; + void SAL_CALL startPopupMode( const css::awt::Rectangle& WindowRect ) override; + sal_Bool SAL_CALL isInPopupMode( ) override; + + // css::awt::XWindow2 + void SAL_CALL setOutputSize( const css::awt::Size& aSize ) override; + css::awt::Size SAL_CALL getOutputSize( ) override; + sal_Bool SAL_CALL isVisible( ) override; + sal_Bool SAL_CALL isActive( ) override; + sal_Bool SAL_CALL isEnabled( ) override; + sal_Bool SAL_CALL hasFocus( ) override; + + // css::beans::XPropertySetInfo + css::uno::Sequence< css::beans::Property > SAL_CALL getProperties( ) override; + css::beans::Property SAL_CALL getPropertyByName( const OUString& aName ) override; + sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) override; + + // XStyleSettingsSupplier + virtual css::uno::Reference< css::awt::XStyleSettings > SAL_CALL getStyleSettings() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx new file mode 100644 index 0000000000..b6d333374a --- /dev/null +++ b/include/toolkit/awt/vclxwindows.hxx @@ -0,0 +1,727 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <toolkit/dllapi.h> + +#include <com/sun/star/awt/XTextArea.hpp> +#include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/awt/XListBox.hpp> +#include <com/sun/star/awt/XNumericField.hpp> +#include <com/sun/star/awt/XScrollBar.hpp> +#include <com/sun/star/awt/XTextEditField.hpp> +#include <com/sun/star/awt/XSpinField.hpp> +#include <com/sun/star/awt/XTextLayoutConstrains.hpp> +#include <com/sun/star/awt/XButton.hpp> +#include <com/sun/star/awt/XToggleButton.hpp> +#include <com/sun/star/awt/XFixedHyperlink.hpp> +#include <com/sun/star/awt/XFixedText.hpp> +#include <com/sun/star/awt/XRadioButton.hpp> +#include <com/sun/star/awt/XComboBox.hpp> +#include <com/sun/star/awt/XCheckBox.hpp> +#include <com/sun/star/awt/XItemListListener.hpp> +#include <cppuhelper/implbase.hxx> + +#include <svl/numuno.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> +#include <tools/lineend.hxx> + +#include <vcl/image.hxx> + +// class VCLXGraphicControl +// deriving from VCLXWindow, drawing the graphic which exists as "Graphic" at the model + +class VCLXGraphicControl : public VCLXWindow +{ +private: + /// the image we currently display + Image maImage; + +protected: + const Image& GetImage() const { return maImage; } + +protected: + // css::awt::XWindow + void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + +protected: + /** forward our bitmap to our window + @precond + our mutex is locked + @precond + GetWindow is not <NULL/> + @see GetBitmap + */ + virtual void ImplSetNewImage(); + +public: + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } + +}; + + +// class VCLXButton + +typedef cppu::ImplInheritanceHelper< VCLXGraphicControl, + css::awt::XButton, + css::awt::XToggleButton + > VCLXButton_Base; +class VCLXButton final : public VCLXButton_Base +{ +private: + OUString maActionCommand; + ActionListenerMultiplexer maActionListeners; + ItemListenerMultiplexer maItemListeners; + + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; + +public: + VCLXButton(); + virtual ~VCLXButton() override; + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + + // css::awt::XButton + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL setLabel( const OUString& Label ) override; + void SAL_CALL setActionCommand( const OUString& Command ) override; + + // css::awt::XToggleButton + // css::awt::XItemEventBroadcaster + void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +// class VCLXCheckBox + +class TOOLKIT_DLLPUBLIC VCLXCheckBox final : public cppu::ImplInheritanceHelper< + VCLXGraphicControl, + css::awt::XCheckBox, + css::awt::XButton> +{ +private: + ActionListenerMultiplexer maActionListeners; + OUString maActionCommand; + ItemListenerMultiplexer maItemListeners; + + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; + +public: + VCLXCheckBox(); + + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + + // css::awt::XCheckBox + void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + sal_Int16 SAL_CALL getState( ) override; + void SAL_CALL setState( sal_Int16 n ) override; + void SAL_CALL setLabel( const OUString& Label ) override; + void SAL_CALL enableTriState( sal_Bool b ) override; + + // css::awt::XButton: + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL setActionCommand( const OUString& Command ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +// class VCLXRadioButton + +class TOOLKIT_DLLPUBLIC VCLXRadioButton final : public cppu::ImplInheritanceHelper< + VCLXGraphicControl, + css::awt::XRadioButton, + css::awt::XButton> +{ +private: + ItemListenerMultiplexer maItemListeners; + ActionListenerMultiplexer maActionListeners; + OUString maActionCommand; + + void ImplClickedOrToggled( bool bToggled ); + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; + +public: + VCLXRadioButton(); + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + + // css::awt::XRadioButton + void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + sal_Bool SAL_CALL getState( ) override; + void SAL_CALL setState( sal_Bool b ) override; + void SAL_CALL setLabel( const OUString& Label ) override; + + // css::awt::XButton: + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL setActionCommand( const OUString& Command ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } + +}; + +// class VCLXFixedHyperlink +class VCLXFixedHyperlink final : + public cppu::ImplInheritanceHelper<VCLXWindow, css::awt::XFixedHyperlink> +{ +private: + ActionListenerMultiplexer maActionListeners; + + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + CreateAccessibleContext() override; + +public: + VCLXFixedHyperlink(); + virtual ~VCLXFixedHyperlink() override; + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + + // css::awt::XFixedHyperlink + void SAL_CALL setText( const OUString& Text ) override; + OUString SAL_CALL getText( ) override; + void SAL_CALL setURL( const OUString& URL ) override; + OUString SAL_CALL getURL( ) override; + void SAL_CALL setAlignment( sal_Int16 nAlign ) override; + sal_Int16 SAL_CALL getAlignment( ) override; + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +// class VCLXFixedText + +class VCLXFixedText final : public cppu::ImplInheritanceHelper<VCLXWindow, css::awt::XFixedText> +{ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; + +public: + VCLXFixedText(); + virtual ~VCLXFixedText() override; + + // css::awt::XFixedText + void SAL_CALL setText( const OUString& Text ) override; + OUString SAL_CALL getText( ) override; + void SAL_CALL setAlignment( sal_Int16 nAlign ) override; + sal_Int16 SAL_CALL getAlignment( ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +// class VCLXScrollBar + +class TOOLKIT_DLLPUBLIC VCLXScrollBar final : + public cppu::ImplInheritanceHelper<VCLXWindow, css::awt::XScrollBar> +{ +private: + AdjustmentListenerMultiplexer maAdjustmentListeners; + + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; + +public: + VCLXScrollBar(); + + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + + // css::awt::XScrollbar + void SAL_CALL addAdjustmentListener( const css::uno::Reference< css::awt::XAdjustmentListener >& l ) override; + void SAL_CALL removeAdjustmentListener( const css::uno::Reference< css::awt::XAdjustmentListener >& l ) override; + void SAL_CALL setValue( sal_Int32 n ) override; + void SAL_CALL setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) override; + sal_Int32 SAL_CALL getValue( ) override; + void SAL_CALL setMaximum( sal_Int32 n ) override; + sal_Int32 SAL_CALL getMaximum( ) override; + void SAL_CALL setLineIncrement( sal_Int32 n ) override; + sal_Int32 SAL_CALL getLineIncrement( ) override; + void SAL_CALL setBlockIncrement( sal_Int32 n ) override; + sal_Int32 SAL_CALL getBlockIncrement( ) override; + void SAL_CALL setVisibleSize( sal_Int32 n ) override; + sal_Int32 SAL_CALL getVisibleSize( ) override; + void SAL_CALL setOrientation( sal_Int32 n ) override; + sal_Int32 SAL_CALL getOrientation( ) override; + + // why isn't this part of the XScrollbar? + /// @throws css::uno::RuntimeException + void setMinimum( sal_Int32 n ); + /// @throws css::uno::RuntimeException + sal_Int32 getMinimum( ) const; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize() override; + /// @throws css::uno::RuntimeException + static css::awt::Size implGetMinimumSize( vcl::Window const * p ); + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +// class VCLXEdit + +class SAL_DLLPUBLIC_RTTI VCLXEdit : public cppu::ImplInheritanceHelper< + VCLXWindow, + css::awt::XTextComponent, + css::awt::XTextEditField, + css::awt::XTextLayoutConstrains> +{ +private: + TextListenerMultiplexer maTextListeners; + +protected: + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; + + +public: + VCLXEdit(); + + TextListenerMultiplexer& GetTextListeners() { return maTextListeners; } + + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + + // css::awt::XTextComponent + void SAL_CALL addTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override; + void SAL_CALL removeTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override; + void SAL_CALL setText( const OUString& aText ) override; + void SAL_CALL insertText( const css::awt::Selection& Sel, const OUString& Text ) override; + OUString SAL_CALL getText( ) override; + OUString SAL_CALL getSelectedText( ) override; + void SAL_CALL setSelection( const css::awt::Selection& aSelection ) override; + css::awt::Selection SAL_CALL getSelection( ) override; + sal_Bool SAL_CALL isEditable( ) override; + void SAL_CALL setEditable( sal_Bool bEditable ) override; + void SAL_CALL setMaxTextLen( sal_Int16 nLen ) override; + sal_Int16 SAL_CALL getMaxTextLen( ) override; + + // css::awt::XTextEditField: + void SAL_CALL setEchoChar( sal_Unicode cEcho ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override; + + // css::awt::XTextLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override; + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +class VCLXMultiLineEdit final : public cppu::ImplInheritanceHelper< + VCLXWindow, + css::awt::XTextComponent, + css::awt::XTextArea, + css::awt::XTextLayoutConstrains> +{ +private: + TextListenerMultiplexer maTextListeners; + LineEnd meLineEndType; + + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + +public: + VCLXMultiLineEdit(); + virtual ~VCLXMultiLineEdit() override; + + // css::awt::XTextComponent + void SAL_CALL addTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override; + void SAL_CALL removeTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override; + void SAL_CALL setText( const OUString& aText ) override; + void SAL_CALL insertText( const css::awt::Selection& Sel, const OUString& Text ) override; + OUString SAL_CALL getText( ) override; + OUString SAL_CALL getSelectedText( ) override; + void SAL_CALL setSelection( const css::awt::Selection& aSelection ) override; + css::awt::Selection SAL_CALL getSelection( ) override; + sal_Bool SAL_CALL isEditable( ) override; + void SAL_CALL setEditable( sal_Bool bEditable ) override; + void SAL_CALL setMaxTextLen( sal_Int16 nLen ) override; + sal_Int16 SAL_CALL getMaxTextLen( ) override; + + //XTextArea + OUString SAL_CALL getTextLines( ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::awt::XTextLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override; + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override; + + // css::awt::XVclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + // css::awt::XWindow + void SAL_CALL setFocus( ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } + +protected: + virtual css::uno::Reference<css::accessibility::XAccessibleContext> CreateAccessibleContext() override; +}; + +// class VCLXSpinField +class VCLXSpinField : public cppu::ImplInheritanceHelper<VCLXEdit, css::awt::XSpinField> +{ +private: + SpinListenerMultiplexer maSpinListeners; + +protected: + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + +public: + VCLXSpinField(); + + + // css::awt::XSpinField + void SAL_CALL addSpinListener( const css::uno::Reference< css::awt::XSpinListener >& l ) override; + void SAL_CALL removeSpinListener( const css::uno::Reference< css::awt::XSpinListener >& l ) override; + void SAL_CALL up( ) override; + void SAL_CALL down( ) override; + void SAL_CALL first( ) override; + void SAL_CALL last( ) override; + void SAL_CALL enableRepeat( sal_Bool bRepeat ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +class SVTXFormattedField : public VCLXSpinField +{ + rtl::Reference<SvNumberFormatsSupplierObj> m_xCurrentSupplier; + bool bIsStandardSupplier; + sal_Int32 nKeyToSetDelayed; + +public: + SVTXFormattedField(); + virtual ~SVTXFormattedField() override; + + // css::awt::XVclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + +protected: + void setFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier > & xSupplier); + sal_Int32 getFormatKey() const; + void setFormatKey(sal_Int32 nKey); + + void SetValue(const css::uno::Any& rValue); + css::uno::Any GetValue() const; + + void SetTreatAsNumber(bool bSet); + bool GetTreatAsNumber() const; + + void SetDefaultValue(const css::uno::Any& rValue); + css::uno::Any GetDefaultValue() const; + + void SetMinValue(const css::uno::Any& rValue); + css::uno::Any GetMinValue() const; + + void SetMaxValue(const css::uno::Any& rValue); + css::uno::Any GetMaxValue() const; + + void NotifyTextListeners(); + css::uno::Any convertEffectiveValue(const css::uno::Any& rValue) const; + + virtual void SetWindow( const VclPtr< vcl::Window > &_pWindow) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +class TOOLKIT_DLLPUBLIC SVTXNumericField final : public cppu::ImplInheritanceHelper<SVTXFormattedField, css::awt::XNumericField> +{ +public: + SVTXNumericField(); + virtual ~SVTXNumericField() override; + + // css::awt::XNumericField + void SAL_CALL setValue( double Value ) override; + double SAL_CALL getValue( ) override; + void SAL_CALL setMin( double Value ) override; + double SAL_CALL getMin( ) override; + void SAL_CALL setMax( double Value ) override; + double SAL_CALL getMax( ) override; + void SAL_CALL setFirst( double Value ) override; + double SAL_CALL getFirst( ) override; + void SAL_CALL setLast( double Value ) override; + double SAL_CALL getLast( ) override; + void SAL_CALL setSpinSize( double Value ) override; + double SAL_CALL getSpinSize( ) override; + void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override; + sal_Int16 SAL_CALL getDecimalDigits( ) override; + void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + sal_Bool SAL_CALL isStrictFormat( ) override; + + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override; + + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; +}; + +// class VCLXListBox + +typedef cppu::ImplInheritanceHelper< VCLXWindow, + css::awt::XListBox, + css::awt::XTextLayoutConstrains, + css::awt::XItemListListener + > VCLXListBox_Base; +class VCLXListBox final : public VCLXListBox_Base +{ +private: + ActionListenerMultiplexer maActionListeners; + ItemListenerMultiplexer maItemListeners; + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + CreateAccessibleContext() override; + void ImplCallItemListeners(); + +public: + VCLXListBox(); + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + + // css::awt::XListBox + void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL addItem( const OUString& aItem, sal_Int16 nPos ) override; + void SAL_CALL addItems( const css::uno::Sequence< OUString >& aItems, sal_Int16 nPos ) override; + void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) override; + sal_Int16 SAL_CALL getItemCount( ) override; + OUString SAL_CALL getItem( sal_Int16 nPos ) override; + css::uno::Sequence< OUString > SAL_CALL getItems( ) override; + sal_Int16 SAL_CALL getSelectedItemPos( ) override; + css::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos( ) override; + OUString SAL_CALL getSelectedItem( ) override; + css::uno::Sequence< OUString > SAL_CALL getSelectedItems( ) override; + void SAL_CALL selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) override; + void SAL_CALL selectItemsPos( const css::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect ) override; + void SAL_CALL selectItem( const OUString& aItem, sal_Bool bSelect ) override; + sal_Bool SAL_CALL isMutipleMode( ) override; + void SAL_CALL setMultipleMode( sal_Bool bMulti ) override; + sal_Int16 SAL_CALL getDropDownLineCount( ) override; + void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) override; + void SAL_CALL makeVisible( sal_Int16 nEntry ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override; + + // css::awt::XTextLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override; + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + // XItemListListener + virtual void SAL_CALL listItemInserted( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL listItemRemoved( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL listItemModified( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL allItemsRemoved( const css::lang::EventObject& Event ) override; + virtual void SAL_CALL itemListChanged( const css::lang::EventObject& Event ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& i_rEvent ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +// class VCLXComboBox + +typedef cppu::ImplInheritanceHelper< VCLXEdit, + css::awt::XComboBox, + css::awt::XItemListListener + > VCLXComboBox_Base; +class VCLXComboBox final : public VCLXComboBox_Base +{ +private: + ActionListenerMultiplexer maActionListeners; + ItemListenerMultiplexer maItemListeners; + + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; + + +public: + VCLXComboBox(); + virtual ~VCLXComboBox() override; + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + + // css::awt::XComboBox + void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL addItem( const OUString& aItem, sal_Int16 nPos ) override; + void SAL_CALL addItems( const css::uno::Sequence< OUString >& aItems, sal_Int16 nPos ) override; + void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) override; + sal_Int16 SAL_CALL getItemCount( ) override; + OUString SAL_CALL getItem( sal_Int16 nPos ) override; + css::uno::Sequence< OUString > SAL_CALL getItems( ) override; + sal_Int16 SAL_CALL getDropDownLineCount( ) override; + void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override; + + // css::awt::XTextLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override; + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + // XItemListListener + virtual void SAL_CALL listItemInserted( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL listItemRemoved( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL listItemModified( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL allItemsRemoved( const css::lang::EventObject& Event ) override; + virtual void SAL_CALL itemListChanged( const css::lang::EventObject& Event ) override; + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& i_rEvent ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +// class VCLXToolBox +class VCLXToolBox final : public VCLXWindow +{ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + CreateAccessibleContext() override; + +public: + VCLXToolBox(); + virtual ~VCLXToolBox() override; +}; + +class VCLXHeaderBar final : public VCLXWindow +{ +public: + VCLXHeaderBar(); + virtual ~VCLXHeaderBar() override; + + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/controls/unocontrol.hxx b/include/toolkit/controls/unocontrol.hxx new file mode 100644 index 0000000000..999a5ed785 --- /dev/null +++ b/include/toolkit/controls/unocontrol.hxx @@ -0,0 +1,231 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_CONTROLS_UNOCONTROL_HXX +#define INCLUDED_TOOLKIT_CONTROLS_UNOCONTROL_HXX + +#include <toolkit/dllapi.h> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XWindow2.hpp> +#include <com/sun/star/awt/XView.hpp> +#include <com/sun/star/beans/XPropertiesChangeListener.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/awt/XUnitConversion.hpp> +#include <com/sun/star/awt/XStyleSettingsSupplier.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <osl/mutex.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> +#include <tools/long.hxx> +#include <comphelper/interfacecontainer3.hxx> +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/implbase9.hxx> +#include <com/sun/star/util/XModeChangeBroadcaster.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <memory> + + +struct UnoControlComponentInfos +{ + tools::Long nX, nY, nWidth, nHeight; + float nZoomX, nZoomY; + sal_uInt16 nFlags; + bool bVisible; + bool bEnable; + + UnoControlComponentInfos() + { + bVisible = true; + bEnable = true; + nX = nY = nWidth = nHeight = 0; + nFlags = 0; // POSSIZE_POSSIZE; + nZoomX = nZoomY = 1.0f; + } +}; + +struct UnoControl_Data; + + +typedef ::cppu::WeakAggImplHelper9 < css::awt::XControl + , css::awt::XWindow2 + , css::awt::XView + , css::beans::XPropertiesChangeListener + , css::lang::XServiceInfo + , css::accessibility::XAccessible + , css::util::XModeChangeBroadcaster + , css::awt::XUnitConversion + , css::awt::XStyleSettingsSupplier + > UnoControl_Base; + +class TOOLKIT_DLLPUBLIC UnoControl : public UnoControl_Base +{ +private: + ::osl::Mutex maMutex; + + css::uno::Reference< css::awt::XVclWindowPeer > mxVclWindowPeer; + +protected: + EventListenerMultiplexer maDisposeListeners; + WindowListenerMultiplexer maWindowListeners; + FocusListenerMultiplexer maFocusListeners; + KeyListenerMultiplexer maKeyListeners; + MouseListenerMultiplexer maMouseListeners; + MouseMotionListenerMultiplexer maMouseMotionListeners; + PaintListenerMultiplexer maPaintListeners; + ::comphelper::OInterfaceContainerHelper3<css::util::XModeChangeListener> maModeChangeListeners; + + css::uno::Reference< css::uno::XInterface > mxContext; + css::uno::Reference< css::awt::XControlModel > mxModel; + css::uno::Reference< css::awt::XGraphics > mxGraphics; + + css::uno::WeakReferenceHelper + maAccessibleContext; /// our most recent XAccessibleContext instance + + bool mbDisposePeer; + bool mbRefreshingPeer; + bool mbCreatingPeer; + bool mbCreatingCompatiblePeer; + bool mbDesignMode; + + UnoControlComponentInfos maComponentInfos; + std::unique_ptr<UnoControl_Data> mpData; + + ::osl::Mutex& GetMutex() { return maMutex; } + + css::uno::Reference< css::awt::XWindow > getParentPeer() const; + virtual void updateFromModel(); + void peerCreated(); + bool ImplCheckLocalize( OUString& _rPossiblyLocalizable ); + css::uno::Reference< css::awt::XVclWindowPeer > ImplGetCompatiblePeer(); + virtual void ImplSetPeerProperty( const OUString& rPropName, const css::uno::Any& rVal ); + virtual void PrepareWindowDescriptor( css::awt::WindowDescriptor& rDesc ); + virtual void ImplModelPropertiesChanged( const css::uno::Sequence< css::beans::PropertyChangeEvent >& rEvents ); + + void ImplLockPropertyChangeNotification( const OUString& rPropertyName, bool bLock ); + void ImplLockPropertyChangeNotifications( const css::uno::Sequence< OUString >& rPropertyNames, bool bLock ); + + void DisposeAccessibleContext(css::uno::Reference< + css::lang::XComponent> const& xContext); + + void setPeer( const css::uno::Reference< css::awt::XVclWindowPeer >& _xPeer) + { + mxVclWindowPeer = _xPeer; + } + + virtual bool requiresNewPeer( const OUString& _rPropertyName ) const; + +public: + UnoControl(); + virtual ~UnoControl() override; + + UnoControlComponentInfos& GetComponentInfos() { return maComponentInfos; } + + + virtual OUString GetComponentServiceName() const; + + // css::lang::XTypeProvider + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; + + // XEventListener + void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // css::awt::XWindow2 + virtual void SAL_CALL setOutputSize( const css::awt::Size& aSize ) override; + virtual css::awt::Size SAL_CALL getOutputSize( ) override; + virtual sal_Bool SAL_CALL isVisible( ) override; + virtual sal_Bool SAL_CALL isActive( ) override; + virtual sal_Bool SAL_CALL isEnabled( ) override; + virtual sal_Bool SAL_CALL hasFocus( ) override; + + // css::awt::XWindow + void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) override; + css::awt::Rectangle SAL_CALL getPosSize( ) override; + void SAL_CALL setVisible( sal_Bool Visible ) override; + void SAL_CALL setEnable( sal_Bool Enable ) override; + void SAL_CALL setFocus( ) override; + void SAL_CALL addWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override; + void SAL_CALL removeWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override; + void SAL_CALL addFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override; + void SAL_CALL removeFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override; + void SAL_CALL addKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override; + void SAL_CALL removeKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override; + void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override; + void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override; + void SAL_CALL addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override; + void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override; + void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override; + void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override; + + // css::awt::XView + sal_Bool SAL_CALL setGraphics( const css::uno::Reference< css::awt::XGraphics >& aDevice ) override; + css::uno::Reference< css::awt::XGraphics > SAL_CALL getGraphics( ) override; + css::awt::Size SAL_CALL getSize( ) override; + void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) override; + void SAL_CALL setZoom( float fZoomX, float fZoomY ) override; + + // css::awt::XControl + void SAL_CALL setContext( const css::uno::Reference< css::uno::XInterface >& Context ) override; + css::uno::Reference< css::uno::XInterface > SAL_CALL getContext( ) override; + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + css::uno::Reference< css::awt::XWindowPeer > SAL_CALL getPeer( ) override; + sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& Model ) override; + css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel( ) override; + css::uno::Reference< css::awt::XView > SAL_CALL getView( ) override; + void SAL_CALL setDesignMode( sal_Bool bOn ) override; + sal_Bool SAL_CALL isDesignMode( ) override; + sal_Bool SAL_CALL isTransparent( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName( ) override; + sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + + // XModeChangeBroadcaster + virtual void SAL_CALL addModeChangeListener( const css::uno::Reference< css::util::XModeChangeListener >& _rxListener ) override; + virtual void SAL_CALL removeModeChangeListener( const css::uno::Reference< css::util::XModeChangeListener >& _rxListener ) override; + virtual void SAL_CALL addModeChangeApproveListener( const css::uno::Reference< css::util::XModeChangeApproveListener >& _rxListener ) override; + virtual void SAL_CALL removeModeChangeApproveListener( const css::uno::Reference< css::util::XModeChangeApproveListener >& _rxListener ) override; + + // XUnitConversion + virtual css::awt::Point SAL_CALL convertPointToLogic( const css::awt::Point& Point, ::sal_Int16 TargetUnit ) override; + virtual css::awt::Point SAL_CALL convertPointToPixel( const css::awt::Point& aPoint, ::sal_Int16 SourceUnit ) override; + virtual css::awt::Size SAL_CALL convertSizeToLogic( const css::awt::Size& aSize, ::sal_Int16 TargetUnit ) override; + virtual css::awt::Size SAL_CALL convertSizeToPixel( const css::awt::Size& aSize, ::sal_Int16 SourceUnit ) override; + + // XStyleSettingsSupplier + virtual css::uno::Reference< css::awt::XStyleSettings > SAL_CALL getStyleSettings() override; + + css::uno::Reference< css::awt::XVclWindowPeer > getVclWindowPeer(); + +protected: + // css::beans::XPropertiesChangeListener + void SAL_CALL propertiesChange( const css::uno::Sequence< css::beans::PropertyChangeEvent >& evt ) override; +}; + + +#endif // INCLUDED_TOOLKIT_CONTROLS_UNOCONTROL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/controls/unocontrolbase.hxx b/include/toolkit/controls/unocontrolbase.hxx new file mode 100644 index 0000000000..06e57067d8 --- /dev/null +++ b/include/toolkit/controls/unocontrolbase.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLBASE_HXX +#define INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLBASE_HXX + +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/Time.hpp> + +#include <toolkit/controls/unocontrol.hxx> + + + + +class UnoControlBase : public UnoControl +{ +protected: + UnoControlBase() {} + + bool ImplHasProperty( sal_uInt16 nProp ); + bool ImplHasProperty( const OUString& aPropertyName ); + void ImplSetPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue, bool bUpdateThis ); + void ImplSetPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues, bool bUpdateThis ); + css::uno::Any ImplGetPropertyValue( const OUString& aPropertyName ) const; + + template <typename T> T ImplGetPropertyValuePOD( sal_uInt16 nProp ); + template <typename T> T ImplGetPropertyValueClass( sal_uInt16 nProp ); + bool ImplGetPropertyValue_BOOL( sal_uInt16 nProp ); + sal_Int16 ImplGetPropertyValue_INT16( sal_uInt16 nProp ); + sal_Int32 ImplGetPropertyValue_INT32( sal_uInt16 nProp ); + double ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp ); + OUString ImplGetPropertyValue_UString( sal_uInt16 nProp ); + css::util::Date ImplGetPropertyValue_Date( sal_uInt16 nProp ); + css::util::Time ImplGetPropertyValue_Time( sal_uInt16 nProp ); + + // XLayoutConstrains (only when the Control supporting it) + css::awt::Size Impl_getMinimumSize(); + css::awt::Size Impl_getPreferredSize(); + css::awt::Size Impl_calcAdjustedSize( const css::awt::Size& rNewSize ); + + // XTextLayoutConstrains (only when the Control supporting it) + css::awt::Size Impl_getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ); + void Impl_getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ); +}; + + +#endif // INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLBASE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/controls/unocontrolmodel.hxx b/include/toolkit/controls/unocontrolmodel.hxx new file mode 100644 index 0000000000..f157c2cd00 --- /dev/null +++ b/include/toolkit/controls/unocontrolmodel.hxx @@ -0,0 +1,174 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLMODEL_HXX +#define INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLMODEL_HXX + +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/io/XPersistObject.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <cppuhelper/weakagg.hxx> + +#include <toolkit/helper/listenermultiplexer.hxx> + +#include <comphelper/propshlp.hxx> +#include <cppuhelper/implbase6.hxx> +#include <comphelper/uno3.hxx> +#include <rtl/ref.hxx> + +#include <vector> +#include <map> + +namespace com::sun::star::uno { class XComponentContext; } + +typedef std::map<sal_uInt16, css::uno::Any> ImplPropertyTable; + +typedef ::cppu::WeakAggImplHelper6 < css::awt::XControlModel + , css::beans::XPropertyState + , css::io::XPersistObject + , css::lang::XComponent + , css::lang::XServiceInfo + , css::util::XCloneable + > UnoControlModel_Base; + +class UnoControlModel : public UnoControlModel_Base + ,public ::comphelper::OPropertySetHelper +{ +private: + ImplPropertyTable maData; + EventListenerMultiplexer maDisposeListeners; + +protected: + css::uno::Reference< css::uno::XComponentContext > m_xContext; + +protected: + void ImplRegisterProperty( sal_uInt16 nPropType ); + void ImplRegisterProperties( const std::vector< sal_uInt16 > &rIds ); + void ImplRegisterProperty( sal_uInt16 nPropId, const css::uno::Any& rDefault ); + css::uno::Sequence<sal_Int32> ImplGetPropertyIds() const; + virtual css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + bool ImplHasProperty( sal_uInt16 nPropId ) const; + + /** called before setting multiple properties, allows to care for property dependencies + + <p>When multiple property values are set (e.g. XPropertySet::setPropertyValues), it may happen that some + of them are dependent. For this, derivees which know such dependencies can affect the order in which + the properties are internally really set.</p> + */ + virtual void ImplNormalizePropertySequence( + const sal_Int32 _nCount, /// the number of entries in the arrays + sal_Int32* _pHandles, /// the handles of the properties to set + css::uno::Any* _pValues, /// the values of the properties to set + sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted + ) const; + + /// ensures that two property values in a sequence have a certain order + static void ImplEnsureHandleOrder( + const sal_Int32 _nCount, /// number of entries in the array + sal_Int32* _pHandles, /// pointer to the handles + css::uno::Any* _pValues, /// pointer to the values + sal_Int32 _nFirstHandle, /// first handle, which should precede _nSecondHandle in the sequence + sal_Int32 _nSecondHandle /// second handle, which should supersede _nFirstHandle in the sequence + ); + + template<typename T> void UNO_CONTROL_MODEL_REGISTER_PROPERTIES() { + std::vector< sal_uInt16 > aIds; + T::ImplGetPropertyIds( aIds ); + ImplRegisterProperties( aIds ); + } + +protected: +#ifdef _MSC_VER + UnoControlModel() //do not use! needed by MSVC at compile time to satisfy WeakAggImplHelper7 + : UnoControlModel_Base() + , OPropertySetHelper() + , maDisposeListeners( *this ) + , m_xContext( css::uno::Reference< css::uno::XComponentContext >() ) + { + assert(false); + } +#endif + +public: + UnoControlModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlModel( const UnoControlModel& rModel ); + + virtual rtl::Reference<UnoControlModel> Clone() const = 0; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return OWeakAggObject::queryInterface(rType); } + void SAL_CALL acquire() noexcept override; + void SAL_CALL release() noexcept override; + + // css::uno::XAggregation + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + + // css::util::XCloneable + css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; + + // css::lang::XTypeProvider + DECLARE_XTYPEPROVIDER() + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; + + // css::beans::XPropertyState + css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override; + css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override; + void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override; + css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override; + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + void SAL_CALL write( const css::uno::Reference< css::io::XObjectOutputStream >& OutStream ) override; + void SAL_CALL read( const css::uno::Reference< css::io::XObjectInputStream >& InStream ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName( ) override; + sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // ::cppu::OPropertySetHelper + ::cppu::IPropertyArrayHelper& getInfoHelper() override = 0; + bool convertFastPropertyValue( std::unique_lock<std::mutex>& rGuard, css::uno::Any & rConvertedValue, css::uno::Any & rOldValue, sal_Int32 nHandle, const css::uno::Any& rValue ) override; + void setFastPropertyValue_NoBroadcast( + std::unique_lock<std::mutex>& rGuard, + sal_Int32 nHandle, const css::uno::Any& rValue ) override; + using comphelper::OPropertySetHelper::getFastPropertyValue; + void getFastPropertyValue( std::unique_lock<std::mutex>& rGuard, css::uno::Any& rValue, sal_Int32 nHandle ) const override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& PropertyNames, const css::uno::Sequence< css::uno::Any >& Values ) override; +protected: + // override setValue methods to handle properties of FontDescriptor + // css::beans::XFastPropertySet + void setFastPropertyValueImpl( std::unique_lock<std::mutex>& rGuard, sal_Int32 nHandle, const css::uno::Any& aValue ) override; + css::beans::PropertyState getPropertyStateImpl( std::unique_lock<std::mutex>& rGuard, const OUString& PropertyName ); + void setPropertyValuesImpl( std::unique_lock<std::mutex>& rGuard, const css::uno::Sequence< OUString >& PropertyNames, const css::uno::Sequence< css::uno::Any >& Values ); +}; + +#endif // INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLMODEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/controls/unocontrols.hxx b/include/toolkit/controls/unocontrols.hxx new file mode 100644 index 0000000000..1fba20389a --- /dev/null +++ b/include/toolkit/controls/unocontrols.hxx @@ -0,0 +1,1491 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLS_HXX +#define INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLS_HXX + +#include <config_options.h> +#include <toolkit/dllapi.h> +#include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/awt/XTextListener.hpp> +#include <com/sun/star/awt/XLayoutConstrains.hpp> +#include <com/sun/star/awt/XTextLayoutConstrains.hpp> +#include <com/sun/star/awt/XButton.hpp> +#include <com/sun/star/awt/XToggleButton.hpp> +#include <com/sun/star/awt/XRadioButton.hpp> +#include <com/sun/star/awt/XItemListener.hpp> +#include <com/sun/star/awt/XCheckBox.hpp> +#include <com/sun/star/awt/XFixedHyperlink.hpp> +#include <com/sun/star/awt/XFixedText.hpp> +#include <com/sun/star/awt/XListBox.hpp> +#include <com/sun/star/awt/XComboBox.hpp> +#include <com/sun/star/awt/XDateField.hpp> +#include <com/sun/star/awt/XSpinField.hpp> +#include <com/sun/star/awt/XTimeField.hpp> +#include <com/sun/star/awt/XNumericField.hpp> +#include <com/sun/star/awt/XCurrencyField.hpp> +#include <com/sun/star/awt/XPatternField.hpp> +#include <com/sun/star/awt/XProgressBar.hpp> +#include <com/sun/star/awt/XItemList.hpp> +#include <toolkit/controls/unocontrolmodel.hxx> +#include <toolkit/controls/unocontrolbase.hxx> +#include <toolkit/helper/macros.hxx> +#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase1.hxx> +#include <comphelper/interfacecontainer4.hxx> +#include <comphelper/uno3.hxx> +#include <tools/gen.hxx> + +#include <memory> +#include <vector> + +#include <optional> + +namespace com::sun::star::graphic { class XGraphic; } +namespace com::sun::star::graphic { class XGraphicObject; } + +class ImageHelper +{ +public: + // The routine will always attempt to return a valid XGraphic for the + // passed _rURL, additionally xOutGraphicObject will contain the + // associated XGraphicObject ( if url is valid for that ) and is set + // appropriately ( e.g. NULL if non GraphicObject scheme ) or a valid + // object if the rURL points to a valid object + static css::uno::Reference< css::graphic::XGraphic > getGraphicAndGraphicObjectFromURL_nothrow( css::uno::Reference< css::graphic::XGraphicObject >& xOutGraphicObject, const OUString& _rURL ); + static css::uno::Reference< css::graphic::XGraphic > getGraphicFromURL_nothrow( const OUString& _rURL ); + +}; + + + +class UnoControlEditModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlEditModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlEditModel( const UnoControlEditModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlEditModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + + // XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +typedef ::cppu::ImplHelper4 < css::awt::XTextComponent + , css::awt::XTextListener + , css::awt::XLayoutConstrains + , css::awt::XTextLayoutConstrains + > UnoEditControl_Base; +class UNLESS_MERGELIBS(TOOLKIT_DLLPUBLIC) UnoEditControl :public UnoControlBase + ,public UnoEditControl_Base +{ +private: + TextListenerMultiplexer maTextListeners; + + // Not all fields derived from UnoEditCOntrol have the property "Text" + // They only support XTextComponent, so keep the text + // here, maybe there is no Peer when calling setText()... + OUString maText; + sal_uInt16 mnMaxTextLen; + + bool mbSetTextInPeer; + bool mbSetMaxTextLenInPeer; + bool mbHasTextProperty; + +public: + + UnoEditControl(); + OUString GetComponentServiceName() const override; + TextListenerMultiplexer& GetTextListeners() { return maTextListeners; } + + void ImplSetPeerProperty( const OUString& rPropName, const css::uno::Any& rVal ) override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoControlBase::disposing( Source ); } + void SAL_CALL dispose( ) override; + + // disambiguate XInterface + DECLARE_XINTERFACE() + + // XAggregation + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XTextListener + void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override; + + // XTextComponent + void SAL_CALL addTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override; + void SAL_CALL removeTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override; + void SAL_CALL setText( const OUString& aText ) override; + void SAL_CALL insertText( const css::awt::Selection& Sel, const OUString& Text ) override; + OUString SAL_CALL getText( ) override; + OUString SAL_CALL getSelectedText( ) override; + void SAL_CALL setSelection( const css::awt::Selection& aSelection ) override; + css::awt::Selection SAL_CALL getSelection( ) override; + sal_Bool SAL_CALL isEditable( ) override; + void SAL_CALL setEditable( sal_Bool bEditable ) override; + void SAL_CALL setMaxTextLen( sal_Int16 nLen ) override; + sal_Int16 SAL_CALL getMaxTextLen( ) override; + + // XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // XTextLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override; + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override; + + // XServiceInfo + OUString SAL_CALL getImplementationName( ) override; + css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel >& Model) override; +}; + + + +class UnoControlFileControlModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlFileControlModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlFileControlModel( const UnoControlFileControlModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlFileControlModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoFileControl final : public UnoEditControl +{ +public: + UnoFileControl(); + OUString GetComponentServiceName() const override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class GraphicControlModel : public UnoControlModel +{ +private: + bool mbAdjustingImagePosition; + bool mbAdjustingGraphic; + +protected: + GraphicControlModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) + :UnoControlModel( rxContext ) + ,mbAdjustingImagePosition( false ) + ,mbAdjustingGraphic( false ) + { + } + GraphicControlModel( const GraphicControlModel& _rSource ) : UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { } + + // ::comphelper::OPropertySetHelper + void setFastPropertyValue_NoBroadcast( std::unique_lock<std::mutex>& rGuard, sal_Int32 nHandle, const css::uno::Any& rValue ) override; + + // UnoControlModel + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + +private: + GraphicControlModel& operator=( const GraphicControlModel& ) = delete; +}; + + + +class UnoControlButtonModel final : public GraphicControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlButtonModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlButtonModel( const UnoControlButtonModel& rModel ) : GraphicControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlButtonModel( *this ); } + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase + , css::awt::XButton + , css::awt::XToggleButton + , css::awt::XLayoutConstrains + , css::awt::XItemListener + > UnoButtonControl_Base; +class UnoButtonControl final : public UnoButtonControl_Base +{ +private: + ActionListenerMultiplexer maActionListeners; + ItemListenerMultiplexer maItemListeners; + OUString maActionCommand; + +public: + + UnoButtonControl(); + OUString GetComponentServiceName() const override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + void SAL_CALL dispose( ) override; + + // css::awt::XButton + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL setLabel( const OUString& Label ) override; + void SAL_CALL setActionCommand( const OUString& Command ) override; + + // css::awt::XToggleButton + // css::awt::XItemEventBroadcaster + void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + + // css::lang::XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XItemListener + virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoControlImageControlModel final : public GraphicControlModel +{ +private: + bool mbAdjustingImageScaleMode; + + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlImageControlModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlImageControlModel( const UnoControlImageControlModel& rModel ) : GraphicControlModel( rModel ), mbAdjustingImageScaleMode( false ) { } + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlImageControlModel( *this ); } + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // ::cppu::OPropertySetHelper + void setFastPropertyValue_NoBroadcast( std::unique_lock<std::mutex>& rGuard, sal_Int32 nHandle, const css::uno::Any& rValue ) override; +}; + + + +typedef ::cppu::AggImplInheritanceHelper1 < UnoControlBase + , css::awt::XLayoutConstrains + > UnoImageControlControl_Base; +class UnoImageControlControl final : public UnoImageControlControl_Base +{ +private: + ActionListenerMultiplexer maActionListeners; + +public: + + UnoImageControlControl(); + OUString GetComponentServiceName() const override; + + void SAL_CALL dispose( ) override; + + // css::awt::XControl + sal_Bool SAL_CALL isTransparent( ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoControlRadioButtonModel final : public GraphicControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlRadioButtonModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlRadioButtonModel( const UnoControlRadioButtonModel& rModel ) : GraphicControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlRadioButtonModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase + , css::awt::XButton + , css::awt::XRadioButton + , css::awt::XItemListener + , css::awt::XLayoutConstrains + > UnoRadioButtonControl_Base; +class UnoRadioButtonControl final : public UnoRadioButtonControl_Base +{ +private: + ItemListenerMultiplexer maItemListeners; + ActionListenerMultiplexer maActionListeners; + OUString maActionCommand; + +public: + + UnoRadioButtonControl(); + OUString GetComponentServiceName() const override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + void SAL_CALL dispose( ) override; + void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoControlBase::disposing( Source ); } + + // css::awt::XControl + sal_Bool SAL_CALL isTransparent( ) override; + + // css::awt::XButton + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL setActionCommand( const OUString& Command ) override; + + // css::awt::XRadioButton + void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + sal_Bool SAL_CALL getState( ) override; + void SAL_CALL setState( sal_Bool b ) override; + void SAL_CALL setLabel( const OUString& Label ) override; + + // css::awt::XItemListener + void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoControlCheckBoxModel final : public GraphicControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlCheckBoxModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlCheckBoxModel( const UnoControlCheckBoxModel& rModel ) : GraphicControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlCheckBoxModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase + , css::awt::XButton + , css::awt::XCheckBox + , css::awt::XItemListener + , css::awt::XLayoutConstrains + > UnoCheckBoxControl_Base; +class UnoCheckBoxControl final : public UnoCheckBoxControl_Base +{ +private: + ItemListenerMultiplexer maItemListeners; + ActionListenerMultiplexer maActionListeners; + OUString maActionCommand; + +public: + + UnoCheckBoxControl(); + OUString GetComponentServiceName() const override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + void SAL_CALL dispose( ) override; + void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoControlBase::disposing( Source ); } + + // css::awt::XControl + sal_Bool SAL_CALL isTransparent( ) override; + + // css::awt::XButton + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL setActionCommand( const OUString& Command ) override; + + virtual void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + virtual void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + + + sal_Int16 SAL_CALL getState( ) override; + void SAL_CALL setState( sal_Int16 n ) override; + void SAL_CALL setLabel( const OUString& Label ) override; + void SAL_CALL enableTriState( sal_Bool b ) override; + + // css::awt::XItemListener + void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoControlFixedHyperlinkModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlFixedHyperlinkModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlFixedHyperlinkModel( const UnoControlFixedHyperlinkModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlFixedHyperlinkModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XServiceInfo + DECLIMPL_SERVICEINFO_DERIVED( UnoControlFixedHyperlinkModel, UnoControlModel, "com.sun.star.awt.UnoControlFixedHyperlinkModel" ) +}; + + + +class UnoFixedHyperlinkControl final : public UnoControlBase, + public css::awt::XFixedHyperlink, + public css::awt::XLayoutConstrains +{ +private: + ActionListenerMultiplexer maActionListeners; + +public: + UnoFixedHyperlinkControl(); + + OUString GetComponentServiceName() const override; + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoControlBase::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + void SAL_CALL dispose( ) override; + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XControl + sal_Bool SAL_CALL isTransparent( ) override; + + // css::awt::XFixedHyperlink + void SAL_CALL setText( const OUString& Text ) override; + OUString SAL_CALL getText( ) override; + void SAL_CALL setURL( const OUString& URL ) override; + OUString SAL_CALL getURL( ) override; + void SAL_CALL setAlignment( sal_Int16 nAlign ) override; + sal_Int16 SAL_CALL getAlignment( ) override; + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::lang::XServiceInfo + DECLIMPL_SERVICEINFO_DERIVED( UnoFixedHyperlinkControl, UnoControlBase, "com.sun.star.awt.UnoControlFixedHyperlink" ) +}; + + + +class UnoControlFixedTextModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlFixedTextModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlFixedTextModel( const UnoControlFixedTextModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlFixedTextModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoFixedTextControl final : public UnoControlBase, + public css::awt::XFixedText, + public css::awt::XLayoutConstrains +{ +public: + UnoFixedTextControl(); + OUString GetComponentServiceName() const override; + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoControlBase::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XControl + sal_Bool SAL_CALL isTransparent( ) override; + + // css::awt::XFixedText + void SAL_CALL setText( const OUString& Text ) override; + OUString SAL_CALL getText( ) override; + void SAL_CALL setAlignment( sal_Int16 nAlign ) override; + sal_Int16 SAL_CALL getAlignment( ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoControlGroupBoxModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlGroupBoxModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlGroupBoxModel( const UnoControlGroupBoxModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlGroupBoxModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoGroupBoxControl final : public UnoControlBase +{ +public: + UnoGroupBoxControl(); + OUString GetComponentServiceName() const override; + + sal_Bool SAL_CALL isTransparent( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +struct UnoControlListBoxModel_Data; +typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel + , css::awt::XItemList + > UnoControlListBoxModel_Base; +class UnoControlListBoxModel : public UnoControlListBoxModel_Base +{ +protected: + enum ConstructorMode + { + ConstructDefault, + ConstructWithoutProperties + }; + +public: + UnoControlListBoxModel( + const css::uno::Reference< css::uno::XComponentContext >& rxContext, + ConstructorMode const i_mode = ConstructDefault + ); + UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource ); + virtual ~UnoControlListBoxModel() override; + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlListBoxModel( *this ); } + + virtual void ImplNormalizePropertySequence( + const sal_Int32 _nCount, /// the number of entries in the arrays + sal_Int32* _pHandles, /// the handles of the properties to set + css::uno::Any* _pValues, /// the values of the properties to set + sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted + ) const override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName( ) override; + css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // css::awt::XItemList + virtual ::sal_Int32 SAL_CALL getItemCount() override; + virtual void SAL_CALL insertItem( ::sal_Int32 Position, const OUString& ItemText, const OUString& ItemImageURL ) override; + virtual void SAL_CALL insertItemText( ::sal_Int32 Position, const OUString& ItemText ) override; + virtual void SAL_CALL insertItemImage( ::sal_Int32 Position, const OUString& ItemImageURL ) override; + virtual void SAL_CALL removeItem( ::sal_Int32 Position ) override; + virtual void SAL_CALL removeAllItems( ) override; + virtual void SAL_CALL setItemText( ::sal_Int32 Position, const OUString& ItemText ) override; + virtual void SAL_CALL setItemImage( ::sal_Int32 Position, const OUString& ItemImageURL ) override; + virtual void SAL_CALL setItemTextAndImage( ::sal_Int32 Position, const OUString& ItemText, const OUString& ItemImageURL ) override; + virtual void SAL_CALL setItemData( ::sal_Int32 Position, const css::uno::Any& DataValue ) override; + virtual OUString SAL_CALL getItemText( ::sal_Int32 Position ) override; + virtual OUString SAL_CALL getItemImage( ::sal_Int32 Position ) override; + virtual css::beans::Pair< OUString, OUString > SAL_CALL getItemTextAndImage( ::sal_Int32 Position ) override; + virtual css::uno::Any SAL_CALL getItemData( ::sal_Int32 Position ) override; + virtual css::uno::Sequence< css::beans::Pair< OUString, OUString > > SAL_CALL getAllItems( ) override; + virtual void SAL_CALL addItemListListener( const css::uno::Reference< css::awt::XItemListListener >& Listener ) override; + virtual void SAL_CALL removeItemListListener( const css::uno::Reference< css::awt::XItemListListener >& Listener ) override; + + // OPropertySetHelper + void setFastPropertyValue_NoBroadcast( std::unique_lock<std::mutex>& rGuard, sal_Int32 nHandle, const css::uno::Any& rValue ) override; + +protected: + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +private: + void impl_notifyItemListEvent( + std::unique_lock<std::mutex>& rGuard, + const sal_Int32 i_nItemPosition, + const ::std::optional< OUString >& i_rItemText, + const ::std::optional< OUString >& i_rItemImageURL, + void ( SAL_CALL css::awt::XItemListListener::*NotificationMethod )( const css::awt::ItemListEvent& ) + ); + + void impl_handleInsert( + std::unique_lock<std::mutex>& rGuard, + const sal_Int32 i_nItemPosition, + const ::std::optional< OUString >& i_rItemText, + const ::std::optional< OUString >& i_rItemImageURL + ); + + void impl_handleRemove( + const sal_Int32 i_nItemPosition, + std::unique_lock<std::mutex>& i_rClearBeforeNotify + ); + + void impl_handleModify( + const sal_Int32 i_nItemPosition, + const ::std::optional< OUString >& i_rItemText, + const ::std::optional< OUString >& i_rItemImageURL, + std::unique_lock<std::mutex>& i_rClearBeforeNotify + ); + + void impl_getStringItemList( std::unique_lock<std::mutex>& rGuard, ::std::vector< OUString >& o_rStringItems ) const; + void impl_setStringItemList( std::unique_lock<std::mutex>& rGuard, const ::std::vector< OUString >& i_rStringItems ); + +protected: + std::unique_ptr<UnoControlListBoxModel_Data> m_xData; + ::comphelper::OInterfaceContainerHelper4<css::awt::XItemListListener> m_aItemListListeners; +}; + + + +typedef ::cppu::AggImplInheritanceHelper5 < UnoControlBase + , css::awt::XListBox + , css::awt::XItemListener + , css::awt::XLayoutConstrains + , css::awt::XTextLayoutConstrains + , css::awt::XItemListListener + > UnoListBoxControl_Base; +class UnoListBoxControl final : public UnoListBoxControl_Base +{ +public: + UnoListBoxControl(); + OUString GetComponentServiceName() const override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + void SAL_CALL dispose( ) override; + void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoControlBase::disposing( Source ); } + + // css::awt::XListBox + void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL addItem( const OUString& aItem, sal_Int16 nPos ) override; + void SAL_CALL addItems( const css::uno::Sequence< OUString >& aItems, sal_Int16 nPos ) override; + void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) override; + sal_Int16 SAL_CALL getItemCount( ) override; + OUString SAL_CALL getItem( sal_Int16 nPos ) override; + css::uno::Sequence< OUString > SAL_CALL getItems( ) override; + sal_Int16 SAL_CALL getSelectedItemPos( ) override; + css::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos( ) override; + OUString SAL_CALL getSelectedItem( ) override; + css::uno::Sequence< OUString > SAL_CALL getSelectedItems( ) override; + void SAL_CALL selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) override; + void SAL_CALL selectItemsPos( const css::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect ) override; + void SAL_CALL selectItem( const OUString& aItem, sal_Bool bSelect ) override; + sal_Bool SAL_CALL isMutipleMode( ) override; + void SAL_CALL setMultipleMode( sal_Bool bMulti ) override; + sal_Int16 SAL_CALL getDropDownLineCount( ) override; + void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) override; + void SAL_CALL makeVisible( sal_Int16 nEntry ) override; + + // css::awt::XItemListener + void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::awt::XTextLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override; + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override; + + // XUnoControl + sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel >& Model) override; + + // XItemListListener + virtual void SAL_CALL listItemInserted( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL listItemRemoved( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL listItemModified( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL allItemsRemoved( const css::lang::EventObject& Event ) override; + virtual void SAL_CALL itemListChanged( const css::lang::EventObject& Event ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName( ) override; + css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +private: + void ImplUpdateSelectedItemsProperty(); + virtual void ImplSetPeerProperty( const OUString& rPropName, const css::uno::Any& rVal ) override; + virtual void updateFromModel() override; + + ActionListenerMultiplexer maActionListeners; + ItemListenerMultiplexer maItemListeners; +}; + + + +class UnoControlComboBoxModel final : public UnoControlListBoxModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlComboBoxModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlComboBoxModel( const UnoControlComboBoxModel& rModel ) : UnoControlListBoxModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlComboBoxModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // OPropertySetHelper + void setFastPropertyValue_NoBroadcast( std::unique_lock<std::mutex>& rGuard, sal_Int32 nHandle, const css::uno::Any& rValue ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName( ) override; + css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + + + +class UnoComboBoxControl final : public UnoEditControl + , public css::awt::XComboBox + , public css::awt::XItemListener + , public css::awt::XItemListListener +{ +private: + ActionListenerMultiplexer maActionListeners; + ItemListenerMultiplexer maItemListeners; + +public: + + UnoComboBoxControl(); + OUString GetComponentServiceName() const override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoEditControl::disposing( Source ); } + void SAL_CALL dispose( ) override; + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoEditControl::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XComboBox + void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + void SAL_CALL addItem( const OUString& aItem, sal_Int16 nPos ) override; + void SAL_CALL addItems( const css::uno::Sequence< OUString >& aItems, sal_Int16 nPos ) override; + void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) override; + sal_Int16 SAL_CALL getItemCount( ) override; + OUString SAL_CALL getItem( sal_Int16 nPos ) override; + css::uno::Sequence< OUString > SAL_CALL getItems( ) override; + sal_Int16 SAL_CALL getDropDownLineCount( ) override; + void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) override; + + // XUnoControl + virtual sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel >& Model) override; + + // XItemListListener + virtual void SAL_CALL listItemInserted( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL listItemRemoved( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL listItemModified( const css::awt::ItemListEvent& Event ) override; + virtual void SAL_CALL allItemsRemoved( const css::lang::EventObject& Event ) override; + virtual void SAL_CALL itemListChanged( const css::lang::EventObject& Event ) override; + + // XItemListener + virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName( ) override; + css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +private: + virtual void ImplSetPeerProperty( const OUString& rPropName, const css::uno::Any& rVal ) override; + virtual void updateFromModel() override; + +}; + + + +class UnoSpinFieldControl : public UnoEditControl, + public css::awt::XSpinField +{ +private: + SpinListenerMultiplexer maSpinListeners; + bool mbRepeat; + +public: + UnoSpinFieldControl(); + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoEditControl::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + + // css::awt::XSpinField + void SAL_CALL addSpinListener( const css::uno::Reference< css::awt::XSpinListener >& l ) override; + void SAL_CALL removeSpinListener( const css::uno::Reference< css::awt::XSpinListener >& l ) override; + void SAL_CALL up() override; + void SAL_CALL down() override; + void SAL_CALL first() override; + void SAL_CALL last() override; + void SAL_CALL enableRepeat( sal_Bool bRepeat ) override; + + + // css::lang::XServiceInfo + // No service info, only base class for other fields. +}; + + + +class UnoControlDateFieldModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlDateFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlDateFieldModel( const UnoControlDateFieldModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlDateFieldModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoDateFieldControl final : public UnoSpinFieldControl, + public css::awt::XDateField +{ +private: + css::util::Date mnFirst; + css::util::Date mnLast; + TriState mbLongFormat; +public: + UnoDateFieldControl(); + OUString GetComponentServiceName() const override; + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoSpinFieldControl::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + + // css::awt::XTextListener + void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override; + + //XDateField + void SAL_CALL setDate( const css::util::Date& Date ) override; + css::util::Date SAL_CALL getDate( ) override; + void SAL_CALL setMin( const css::util::Date& Date ) override; + css::util::Date SAL_CALL getMin( ) override; + void SAL_CALL setMax( const css::util::Date& Date ) override; + css::util::Date SAL_CALL getMax( ) override; + void SAL_CALL setFirst( const css::util::Date& Date ) override; + css::util::Date SAL_CALL getFirst( ) override; + void SAL_CALL setLast( const css::util::Date& Date ) override; + css::util::Date SAL_CALL getLast( ) override; + void SAL_CALL setLongFormat( sal_Bool bLong ) override; + sal_Bool SAL_CALL isLongFormat( ) override; + void SAL_CALL setEmpty( ) override; + sal_Bool SAL_CALL isEmpty( ) override; + void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + sal_Bool SAL_CALL isStrictFormat( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoControlTimeFieldModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlTimeFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlTimeFieldModel( const UnoControlTimeFieldModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlTimeFieldModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoTimeFieldControl final : public UnoSpinFieldControl, + public css::awt::XTimeField +{ +private: + css::util::Time mnFirst; + css::util::Time mnLast; + +public: + UnoTimeFieldControl(); + OUString GetComponentServiceName() const override; + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoSpinFieldControl::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + + // css::awt::XTextListener + void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override; + + //XTimeField + void SAL_CALL setTime( const css::util::Time& Time ) override; + css::util::Time SAL_CALL getTime( ) override; + void SAL_CALL setMin( const css::util::Time& Time ) override; + css::util::Time SAL_CALL getMin( ) override; + void SAL_CALL setMax( const css::util::Time& Time ) override; + css::util::Time SAL_CALL getMax( ) override; + void SAL_CALL setFirst( const css::util::Time& Time ) override; + css::util::Time SAL_CALL getFirst( ) override; + void SAL_CALL setLast( const css::util::Time& Time ) override; + css::util::Time SAL_CALL getLast( ) override; + void SAL_CALL setEmpty( ) override; + sal_Bool SAL_CALL isEmpty( ) override; + void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + sal_Bool SAL_CALL isStrictFormat( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoControlNumericFieldModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlNumericFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlNumericFieldModel( const UnoControlNumericFieldModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlNumericFieldModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoNumericFieldControl final : public UnoSpinFieldControl, + public css::awt::XNumericField +{ +private: + double mnFirst; + double mnLast; + +public: + UnoNumericFieldControl(); + OUString GetComponentServiceName() const override; + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoSpinFieldControl::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XTextListener + void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override; + + // css::awt::XNumericField + void SAL_CALL setValue( double Value ) override; + double SAL_CALL getValue( ) override; + void SAL_CALL setMin( double Value ) override; + double SAL_CALL getMin( ) override; + void SAL_CALL setMax( double Value ) override; + double SAL_CALL getMax( ) override; + void SAL_CALL setFirst( double Value ) override; + double SAL_CALL getFirst( ) override; + void SAL_CALL setLast( double Value ) override; + double SAL_CALL getLast( ) override; + void SAL_CALL setSpinSize( double Value ) override; + double SAL_CALL getSpinSize( ) override; + void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override; + sal_Int16 SAL_CALL getDecimalDigits( ) override; + void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + sal_Bool SAL_CALL isStrictFormat( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoControlCurrencyFieldModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlCurrencyFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlCurrencyFieldModel( const UnoControlCurrencyFieldModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlCurrencyFieldModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoCurrencyFieldControl final : public UnoSpinFieldControl, + public css::awt::XCurrencyField +{ +private: + double mnFirst; + double mnLast; + +public: + UnoCurrencyFieldControl(); + OUString GetComponentServiceName() const override; + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoSpinFieldControl::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XTextListener + void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override; + + // css::awt::XCurrencyField + void SAL_CALL setValue( double Value ) override; + double SAL_CALL getValue( ) override; + void SAL_CALL setMin( double Value ) override; + double SAL_CALL getMin( ) override; + void SAL_CALL setMax( double Value ) override; + double SAL_CALL getMax( ) override; + void SAL_CALL setFirst( double Value ) override; + double SAL_CALL getFirst( ) override; + void SAL_CALL setLast( double Value ) override; + double SAL_CALL getLast( ) override; + void SAL_CALL setSpinSize( double Value ) override; + double SAL_CALL getSpinSize( ) override; + void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override; + sal_Int16 SAL_CALL getDecimalDigits( ) override; + void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + sal_Bool SAL_CALL isStrictFormat( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoControlPatternFieldModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlPatternFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlPatternFieldModel( const UnoControlPatternFieldModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlPatternFieldModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoPatternFieldControl final : public UnoSpinFieldControl, + public css::awt::XPatternField +{ + void ImplSetPeerProperty( const OUString& rPropName, const css::uno::Any& rVal ) override; + +public: + UnoPatternFieldControl(); + OUString GetComponentServiceName() const override; + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoSpinFieldControl::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XPatternField + void SAL_CALL setMasks( const OUString& EditMask, const OUString& LiteralMask ) override; + void SAL_CALL getMasks( OUString& EditMask, OUString& LiteralMask ) override; + void SAL_CALL setString( const OUString& Str ) override; + OUString SAL_CALL getString( ) override; + void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + sal_Bool SAL_CALL isStrictFormat( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoControlProgressBarModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlProgressBarModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlProgressBarModel( const UnoControlProgressBarModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlProgressBarModel( *this ); } + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoProgressBarControl final : public UnoControlBase, + public css::awt::XProgressBar +{ +public: + UnoProgressBarControl(); + OUString GetComponentServiceName() const override; + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoControlBase::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XProgressBar + void SAL_CALL setForegroundColor( sal_Int32 nColor ) override; + void SAL_CALL setBackgroundColor( sal_Int32 nColor ) override; + void SAL_CALL setValue( sal_Int32 nValue ) override; + void SAL_CALL setRange( sal_Int32 nMin, sal_Int32 nMax ) override; + sal_Int32 SAL_CALL getValue() override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoControlFixedLineModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + +public: + UnoControlFixedLineModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlFixedLineModel( const UnoControlFixedLineModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlFixedLineModel( *this ); } + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + + +class UnoFixedLineControl final : public UnoControlBase +{ +public: + UnoFixedLineControl(); + OUString GetComponentServiceName() const override; + + sal_Bool SAL_CALL isTransparent( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + +#endif // INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/dllapi.h b/include/toolkit/dllapi.h new file mode 100644 index 0000000000..3b61a68c56 --- /dev/null +++ b/include/toolkit/dllapi.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_DLLAPI_H +#define INCLUDED_TOOLKIT_DLLAPI_H + +#include <sal/config.h> +#include <sal/types.h> + +#if defined TOOLKIT_DLLIMPLEMENTATION +#define TOOLKIT_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define TOOLKIT_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/accessiblefactory.hxx b/include/toolkit/helper/accessiblefactory.hxx new file mode 100644 index 0000000000..6c0532ce9e --- /dev/null +++ b/include/toolkit/helper/accessiblefactory.hxx @@ -0,0 +1,151 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_HELPER_ACCESSIBLEFACTORY_HXX +#define INCLUDED_TOOLKIT_HELPER_ACCESSIBLEFACTORY_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <salhelper/simplereferenceobject.hxx> + +namespace com::sun::star::accessibility { + class XAccessible; + class XAccessibleContext; +} +class SVTXNumericField; +class VCLXButton; +class VCLXCheckBox; +class VCLXRadioButton; +class VCLXListBox; +class VCLXFixedHyperlink; +class VCLXFixedText; +class VCLXScrollBar; +class VCLXEdit; +class VCLXComboBox; +class VCLXMultiLineEdit; +class VCLXToolBox; +class VCLXHeaderBar; +class VCLXWindow; +class Menu; + + +namespace toolkit +{ + + + /** a function which is able to create a factory for the standard Accessible/Context + components needed for standard toolkit controls + + The returned pointer denotes an instance of the IAccessibleFactory, which has been acquired + <em>once</em>. The caller is responsible for holding this reference as long as it needs the + factory, and release it afterwards. + */ + typedef void* (* GetStandardAccComponentFactory)( ); + + + //= IAccessibleFactory + + class IAccessibleFactory : public virtual salhelper::SimpleReferenceObject + { + public: + /** creates an accessible context for a button window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXButton* _pXWindow ) = 0; + + /** creates an accessible context for a checkbox window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXCheckBox* _pXWindow ) = 0; + + /** creates an accessible context for a radio button window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXRadioButton* _pXWindow ) = 0; + + /** creates an accessible context for a listbox window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXListBox* _pXWindow ) = 0; + + /** creates an accessible context for a fixed hyperlink window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXFixedHyperlink* _pXWindow ) = 0; + + /** creates an accessible context for a fixed text window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXFixedText* _pXWindow ) = 0; + + /** creates an accessible context for a scrollbar window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXScrollBar* _pXWindow ) = 0; + + /** creates an accessible context for an edit window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXEdit* _pXWindow ) = 0; + + /** creates an accessible context for a multiline edit window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXMultiLineEdit* _pXWindow ) = 0; + + /** creates an accessible context for a combo box window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXComboBox* _pXWindow ) = 0; + + /** creates an accessible context for a toolbox window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXToolBox* _pXWindow ) = 0; + + /** creates an accessible context for a headerbar window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXHeaderBar* _pXWindow ) = 0; + + /** creates an accessible context for a numeric field + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( SVTXNumericField* _pXWindow ) = 0; + + /** creates an accessible context for a generic window + */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > + createAccessibleContext( VCLXWindow* _pXWindow ) = 0; + + /** creates an accessible component for the given menu + */ + virtual css::uno::Reference< css::accessibility::XAccessible > + createAccessible( Menu* _pMenu, bool _bIsMenuBar ) = 0; + + protected: + virtual ~IAccessibleFactory() override {} + }; + + +} // namespace toolkit + + +#endif // INCLUDED_TOOLKIT_HELPER_ACCESSIBLEFACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/convert.hxx b/include/toolkit/helper/convert.hxx new file mode 100644 index 0000000000..255d5b26b4 --- /dev/null +++ b/include/toolkit/helper/convert.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_HELPER_CONVERT_HXX +#define INCLUDED_TOOLKIT_HELPER_CONVERT_HXX + +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/awt/Point.hpp> + +#include <tools/gen.hxx> + +inline css::awt::Size AWTSize( const Size& rVCLSize ) +{ + return css::awt::Size( rVCLSize.Width(), rVCLSize.Height() ); +} + +inline ::Size VCLSize( const css::awt::Size& rAWTSize ) +{ + return ::Size( rAWTSize.Width, rAWTSize.Height ); +} + +inline css::awt::Point AWTPoint( const PointTemplateBase& rVCLPoint ) +{ + return css::awt::Point( rVCLPoint.X(), rVCLPoint.Y() ); +} + +inline ::Point VCLPoint( const css::awt::Point& rAWTPoint ) +{ + return ::Point( rAWTPoint.X, rAWTPoint.Y ); +} + +inline css::awt::Rectangle AWTRectangle( const RectangleTemplateBase& rVCLRect ) +{ + return css::awt::Rectangle( rVCLRect.Left(), rVCLRect.Top(), rVCLRect.GetWidth(), rVCLRect.GetHeight() ); +} + +inline ::tools::Rectangle VCLRectangle( const css::awt::Rectangle& rAWTRect ) +{ + return ::tools::Rectangle( ::Point( rAWTRect.X, rAWTRect.Y ), ::Size( rAWTRect.Width, rAWTRect.Height ) ); +} + +#endif // INCLUDED_TOOLKIT_HELPER_CONVERT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/emptyfontdescriptor.hxx b/include/toolkit/helper/emptyfontdescriptor.hxx new file mode 100644 index 0000000000..77ac9a1d18 --- /dev/null +++ b/include/toolkit/helper/emptyfontdescriptor.hxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/awt/FontDescriptor.hpp> +#include <com/sun/star/awt/FontSlant.hpp> +#include <com/sun/star/awt/FontUnderline.hpp> +#include <com/sun/star/awt/FontStrikeout.hpp> + +class EmptyFontDescriptor : public css::awt::FontDescriptor +{ +public: + EmptyFontDescriptor() + { + // Not all enums are initialized correctly in FontDescriptor-CTOR because + // they are set to the first enum value, this is not always the default value. + Slant = css::awt::FontSlant_DONTKNOW; + Underline = css::awt::FontUnderline::DONTKNOW; + Strikeout = css::awt::FontStrikeout::DONTKNOW; + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/listenermultiplexer.hxx b/include/toolkit/helper/listenermultiplexer.hxx new file mode 100644 index 0000000000..b7113c17ee --- /dev/null +++ b/include/toolkit/helper/listenermultiplexer.hxx @@ -0,0 +1,310 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX +#define INCLUDED_TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX + +#include <config_options.h> +#include <toolkit/dllapi.h> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/awt/XVclContainerListener.hpp> +#include <com/sun/star/awt/XKeyListener.hpp> +#include <com/sun/star/awt/XMouseListener.hpp> +#include <com/sun/star/awt/XMouseMotionListener.hpp> +#include <com/sun/star/awt/XPaintListener.hpp> +#include <com/sun/star/awt/XTopWindowListener.hpp> +#include <com/sun/star/awt/XTextListener.hpp> +#include <com/sun/star/awt/XActionListener.hpp> +#include <com/sun/star/awt/XItemListener.hpp> +#include <com/sun/star/awt/XTabListener.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/awt/XSpinListener.hpp> +#include <com/sun/star/awt/XAdjustmentListener.hpp> +#include <com/sun/star/awt/XMenuListener.hpp> +#include <com/sun/star/awt/tree/XTreeExpansionListener.hpp> +#include <com/sun/star/awt/tree/XTreeEditListener.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> +#include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/weak.hxx> +#include <comphelper/interfacecontainer4.hxx> +#include <toolkit/helper/macros.hxx> +#include <com/sun/star/awt/grid/XGridSelectionListener.hpp> +#include <com/sun/star/awt/tab/XTabPageContainerListener.hpp> + +// class ListenerMultiplexerBase + +template <class ListenerT> +class UNLESS_MERGELIBS(TOOLKIT_DLLPUBLIC) ListenerMultiplexerBase : + public css::uno::XInterface +{ +private: + ::cppu::OWeakObject& mrContext; +protected: + mutable std::mutex m_aMutex; + ::comphelper::OInterfaceContainerHelper4<ListenerT> maListeners; + + ::cppu::OWeakObject& GetContext() { return mrContext; } + +public: + ListenerMultiplexerBase( ::cppu::OWeakObject& rSource ) + : mrContext(rSource) + { + } + + virtual ~ListenerMultiplexerBase() + { + } + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface(const css::uno::Type & rType) override + { + return ::cppu::queryInterface(rType, static_cast<css::uno::XInterface*>(this)); + } + + void SAL_CALL acquire() noexcept override { mrContext.acquire(); } + void SAL_CALL release() noexcept override { mrContext.release(); } + + void addInterface( const css::uno::Reference<ListenerT>& l) + { + std::unique_lock g(m_aMutex); + maListeners.addInterface(g, l); + } + + void removeInterface( const css::uno::Reference<ListenerT>& l) + { + std::unique_lock g(m_aMutex); + maListeners.removeInterface(g, l); + } + + void disposeAndClear(const css::lang::EventObject& rDisposeEvent) + { + std::unique_lock g(m_aMutex); + maListeners.disposeAndClear(g, rDisposeEvent); + } + + void disposeAndClear(std::unique_lock<std::mutex>& rGuard, const css::lang::EventObject& rDisposeEvent) + { + maListeners.disposeAndClear(rGuard, rDisposeEvent); + } + + sal_Int32 getLength() const + { + std::unique_lock g(m_aMutex); + return maListeners.getLength(g); + } + + template <typename EventT> + inline void notifyEach(void (SAL_CALL ListenerT::*NotificationMethod)(const EventT&), + const EventT& Event) const + { + std::unique_lock g(m_aMutex); + return maListeners.notifyEach(g, NotificationMethod, Event); + } +}; + +// class EventListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( EventListenerMultiplexer, css::lang::XEventListener ) +DECL_LISTENERMULTIPLEXER_END + + +// class FocusListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( FocusListenerMultiplexer, css::awt::XFocusListener ) + void SAL_CALL focusGained( const css::awt::FocusEvent& e ) override; + void SAL_CALL focusLost( const css::awt::FocusEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class WindowListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( WindowListenerMultiplexer, css::awt::XWindowListener ) + void SAL_CALL windowResized( const css::awt::WindowEvent& e ) override; + void SAL_CALL windowMoved( const css::awt::WindowEvent& e ) override; + void SAL_CALL windowShown( const css::lang::EventObject& e ) override; + void SAL_CALL windowHidden( const css::lang::EventObject& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class VclContainerListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( VclContainerListenerMultiplexer, css::awt::XVclContainerListener ) + void SAL_CALL windowAdded( const css::awt::VclContainerEvent& e ) override; + void SAL_CALL windowRemoved( const css::awt::VclContainerEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class KeyListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( KeyListenerMultiplexer, css::awt::XKeyListener ) + void SAL_CALL keyPressed( const css::awt::KeyEvent& e ) override; + void SAL_CALL keyReleased( const css::awt::KeyEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class MouseListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseListenerMultiplexer, css::awt::XMouseListener ) + void SAL_CALL mousePressed( const css::awt::MouseEvent& e ) override; + void SAL_CALL mouseReleased( const css::awt::MouseEvent& e ) override; + void SAL_CALL mouseEntered( const css::awt::MouseEvent& e ) override; + void SAL_CALL mouseExited( const css::awt::MouseEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class MouseMotionListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseMotionListenerMultiplexer, css::awt::XMouseMotionListener ) + void SAL_CALL mouseDragged( const css::awt::MouseEvent& e ) override; + void SAL_CALL mouseMoved( const css::awt::MouseEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class PaintListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( PaintListenerMultiplexer, css::awt::XPaintListener ) + void SAL_CALL windowPaint( const css::awt::PaintEvent& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TopWindowListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TopWindowListenerMultiplexer, css::awt::XTopWindowListener ) + void SAL_CALL windowOpened( const css::lang::EventObject& e ) override; + void SAL_CALL windowClosing( const css::lang::EventObject& e ) override; + void SAL_CALL windowClosed( const css::lang::EventObject& e ) override; + void SAL_CALL windowMinimized( const css::lang::EventObject& e ) override; + void SAL_CALL windowNormalized( const css::lang::EventObject& e ) override; + void SAL_CALL windowActivated( const css::lang::EventObject& e ) override; + void SAL_CALL windowDeactivated( const css::lang::EventObject& e ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TextListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( TextListenerMultiplexer, css::awt::XTextListener ) + void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class ActionListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( ActionListenerMultiplexer, css::awt::XActionListener ) + void SAL_CALL actionPerformed( const css::awt::ActionEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class ItemListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( ItemListenerMultiplexer, css::awt::XItemListener ) + void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TabListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TabListenerMultiplexer, css::awt::XTabListener ) + void SAL_CALL inserted( ::sal_Int32 ID ) override; + void SAL_CALL removed( ::sal_Int32 ID ) override; + void SAL_CALL changed( ::sal_Int32 ID, const css::uno::Sequence< css::beans::NamedValue >& Properties ) override; + void SAL_CALL activated( ::sal_Int32 ID ) override; + void SAL_CALL deactivated( ::sal_Int32 ID ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class ContainerListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer, css::container::XContainerListener ) + void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override; + void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override; + void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class SpinListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( SpinListenerMultiplexer, css::awt::XSpinListener ) + void SAL_CALL up( const css::awt::SpinEvent& rEvent ) override; + void SAL_CALL down( const css::awt::SpinEvent& rEvent ) override; + void SAL_CALL first( const css::awt::SpinEvent& rEvent ) override; + void SAL_CALL last( const css::awt::SpinEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class AdjustmentListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( AdjustmentListenerMultiplexer, css::awt::XAdjustmentListener ) + void SAL_CALL adjustmentValueChanged( const css::awt::AdjustmentEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class MenuListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer, css::awt::XMenuListener ) + void SAL_CALL itemHighlighted( const css::awt::MenuEvent& rEvent ) override; + void SAL_CALL itemSelected( const css::awt::MenuEvent& rEvent ) override; + void SAL_CALL itemActivated( const css::awt::MenuEvent& rEvent ) override; + void SAL_CALL itemDeactivated( const css::awt::MenuEvent& rEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TreeSelectionListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TreeSelectionListenerMultiplexer, css::view::XSelectionChangeListener ) + virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TreeExpansionListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TreeExpansionListenerMultiplexer, css::awt::tree::XTreeExpansionListener ) + virtual void SAL_CALL requestChildNodes( const css::awt::tree::TreeExpansionEvent& aEvent ) override; + virtual void SAL_CALL treeExpanding( const css::awt::tree::TreeExpansionEvent& aEvent ) override; + virtual void SAL_CALL treeCollapsing( const css::awt::tree::TreeExpansionEvent& aEvent ) override; + virtual void SAL_CALL treeExpanded( const css::awt::tree::TreeExpansionEvent& aEvent ) override; + virtual void SAL_CALL treeCollapsed( const css::awt::tree::TreeExpansionEvent& aEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TreeEditListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TreeEditListenerMultiplexer, css::awt::tree::XTreeEditListener ) + virtual void SAL_CALL nodeEditing( const css::uno::Reference< css::awt::tree::XTreeNode >& Node ) override; + virtual void SAL_CALL nodeEdited( const css::uno::Reference< css::awt::tree::XTreeNode >& Node, const OUString& NewText ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class SelectionListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, css::awt::grid::XGridSelectionListener ) + void SAL_CALL selectionChanged( const css::awt::grid::GridSelectionEvent& aEvent ) override; +DECL_LISTENERMULTIPLEXER_END + + +// class TabPageListenerMultiplexer + +DECL_LISTENERMULTIPLEXER_START( TabPageListenerMultiplexer, css::awt::tab::XTabPageContainerListener ) + void SAL_CALL tabPageActivated( const css::awt::tab::TabPageActivatedEvent& aEvent ) override; +DECL_LISTENERMULTIPLEXER_END + +#endif // INCLUDED_TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/macros.hxx b/include/toolkit/helper/macros.hxx new file mode 100644 index 0000000000..a959acd879 --- /dev/null +++ b/include/toolkit/helper/macros.hxx @@ -0,0 +1,166 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_HELPER_MACROS_HXX +#define INCLUDED_TOOLKIT_HELPER_MACROS_HXX + +#include <sal/log.hxx> +#include <osl/diagnose.h> +#include <comphelper/diagnose_ex.hxx> + +#define IMPL_IMPLEMENTATION_ID( ClassName ) \ +css::uno::Sequence< sal_Int8 > ClassName::getImplementationId() \ +{ \ + return css::uno::Sequence<sal_Int8>(); \ +} + + +#define DECL_LISTENERMULTIPLEXER_START( ClassName, InterfaceName ) \ +class ClassName final : public ListenerMultiplexerBase<InterfaceName>, public InterfaceName \ +{ \ +public: \ + ClassName( ::cppu::OWeakObject& rSource ); \ + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; \ + void SAL_CALL acquire() noexcept override; \ + void SAL_CALL release() noexcept override; \ + void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + +#define DECL_LISTENERMULTIPLEXER_START_DLLPUB( ClassName, InterfaceName ) \ +class TOOLKIT_DLLPUBLIC ClassName final : public ListenerMultiplexerBase<InterfaceName>, public InterfaceName \ +{ \ +public: \ + ClassName( ::cppu::OWeakObject& rSource ); \ + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; \ + void SAL_CALL acquire() noexcept override; \ + void SAL_CALL release() noexcept override; \ + void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + +#define DECL_LISTENERMULTIPLEXER_END \ +}; + + +#define IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ClassName, InterfaceName ) \ +ClassName::ClassName( ::cppu::OWeakObject& rSource ) \ + : ListenerMultiplexerBase<InterfaceName>(rSource) \ +{ \ +} \ +void SAL_CALL ClassName::acquire() noexcept { ListenerMultiplexerBase::acquire(); } \ +void SAL_CALL ClassName::release() noexcept { ListenerMultiplexerBase::release(); } \ +css::uno::Any ClassName::queryInterface( const css::uno::Type & rType ) \ +{ \ + css::uno::Any aRet = ::cppu::queryInterface( rType, \ + (static_cast< css::lang::XEventListener* >(this)), \ + (static_cast< InterfaceName* >(this)) ); \ + return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType )); \ +} \ +void ClassName::disposing( const css::lang::EventObject& ) \ +{ \ +} + + +#if OSL_DEBUG_LEVEL > 0 + #define DISPLAY_EXCEPTION( ClassName, MethodName ) \ + css::uno::Any ex( cppu::getCaughtException() ); \ + SAL_WARN( "toolkit", #ClassName "::" #MethodName ": caught an exception! " << exceptionToString(ex)); +#else + #define DISPLAY_EXCEPTION( ClassName, MethodName ) +#endif + +#define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( ClassName, InterfaceName, MethodName, ParamType1 ) \ +{ \ + ParamType1 aMulti( evt ); \ + std::unique_lock g(m_aMutex); \ + ::comphelper::OInterfaceIteratorHelper4 aIt(g, maListeners); \ + g.unlock(); \ + while( aIt.hasMoreElements() ) \ + { \ + css::uno::Reference<InterfaceName> xListener(aIt.next()); \ + try \ + { \ + xListener->MethodName( aMulti ); \ + } \ + catch(const css::lang::DisposedException& e) \ + { \ + OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \ + if ( e.Context == xListener || !e.Context.is() ) \ + { \ + std::unique_lock g2(m_aMutex); \ + aIt.remove(g2); \ + } \ + } \ + catch(const css::uno::RuntimeException&) \ + { \ + DISPLAY_EXCEPTION( ClassName, MethodName ) \ + } \ + } \ +} + +#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) \ +{ \ + EventType aMulti( evt ); \ + aMulti.Source = &GetContext(); \ + std::unique_lock g(m_aMutex); \ + ::comphelper::OInterfaceIteratorHelper4 aIt(g, maListeners); \ + g.unlock(); \ + while( aIt.hasMoreElements() ) \ + { \ + css::uno::Reference<InterfaceName> xListener(aIt.next()); \ + try \ + { \ + xListener->MethodName( aMulti ); \ + } \ + catch(const css::lang::DisposedException& e) \ + { \ + OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \ + if ( e.Context == xListener || !e.Context.is() ) \ + { \ + std::unique_lock g2(m_aMutex); \ + aIt.remove(g2); \ + } \ + } \ + catch(const css::uno::RuntimeException&) \ + { \ + DISPLAY_EXCEPTION( ClassName, MethodName ) \ + } \ + } \ +} + +#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( ClassName, InterfaceName, MethodName, EventType, Exception ) \ +void ClassName::MethodName( const EventType& evt ) \ +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) + +#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ClassName, InterfaceName, MethodName, EventType ) \ +void ClassName::MethodName( const EventType& evt ) \ +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) + +#define DECLIMPL_SERVICEINFO_DERIVED( ImplName, BaseClass, ServiceName ) \ + OUString SAL_CALL getImplementationName( ) override { return "stardiv.Toolkit." #ImplName; } \ + css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override \ + { \ + css::uno::Sequence< OUString > aNames = BaseClass::getSupportedServiceNames( ); \ + aNames.realloc( aNames.getLength() + 1 ); \ + aNames.getArray()[ aNames.getLength() - 1 ] = ServiceName; \ + return aNames; \ + } \ + +#endif // INCLUDED_TOOLKIT_HELPER_MACROS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/toolkit/helper/vclunohelper.hxx b/include/toolkit/helper/vclunohelper.hxx new file mode 100644 index 0000000000..07d4aeff10 --- /dev/null +++ b/include/toolkit/helper/vclunohelper.hxx @@ -0,0 +1,156 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX +#define INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX + +#include <toolkit/dllapi.h> +#include <com/sun/star/uno/Reference.h> + +#include <com/sun/star/awt/MouseEvent.hpp> + +#include <vcl/bitmapex.hxx> +#include <vcl/font.hxx> +#include <vcl/region.hxx> +#include <tools/mapunit.hxx> +#include <tools/fldunit.hxx> +#include <tools/poly.hxx> + + +namespace com::sun::star::uno { template <typename > class Sequence; } + +namespace com::sun::star::uno { + class XInterface; +} + +namespace com::sun::star::awt { + class XBitmap; + class XWindow; + class XWindow2; + class XWindowPeer; + class XGraphics; + class XRegion; + class XDevice; + class XToolkit; + class XFont; + class XControlContainer; + struct Size; + struct Point; + struct SimpleFontMetric; + struct FontDescriptor; + struct Rectangle; + struct KeyEvent; +} + + +enum class PointerStyle; + +class FontMetric; +class OutputDevice; +class MouseEvent; +class KeyEvent; + +class TOOLKIT_DLLPUBLIC VCLUnoHelper +{ +public: + // Toolkit + static css::uno::Reference< css::awt::XToolkit> CreateToolkit(); + + // Bitmap + static BitmapEx GetBitmap( const css::uno::Reference< css::awt::XBitmap>& rxBitmap ); + static css::uno::Reference< css::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap ); + + // Window + static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow ); + static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow2 ); + static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindowPeer ); + static css::uno::Reference< css::awt::XWindow> GetInterface( vcl::Window* pWindow ); + + // OutputDevice + static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XDevice>& rxDevice ); + static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XGraphics>& rxGraphics ); + + // Region + static vcl::Region GetRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion ); + + // Polygon + static tools::Polygon CreatePolygon( const css::uno::Sequence< sal_Int32 >& DataX, const css::uno::Sequence< sal_Int32 >& DataY ); + + /** convert Font to css::awt::FontDescriptor + @param rFont Font to be converted + @return the new FontDescriptor + */ + static css::awt::FontDescriptor CreateFontDescriptor( const vcl::Font& rFont ); + static vcl::Font CreateFont( const css::awt::FontDescriptor& rDescr, const vcl::Font& rInitFont ); + static vcl::Font CreateFont( const css::uno::Reference< css::awt::XFont >& rxFont ); + static css::awt::SimpleFontMetric CreateFontMetric( const FontMetric& rFontMetric ); + + // Rectangle + static bool IsZero(const css::awt::Rectangle& rRect); + + static css::uno::Reference< css::awt::XControlContainer> CreateControlContainer( vcl::Window* pWindow ); + + // MapUnits + static MapUnit UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit ); + static sal_Int32 VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit ); + + + //= MeasurementUnitConversion + + /** small helper to convert between MeasurementUnit and + FieldUnit + */ + static sal_Int16 ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _rFieldToUNOValueFactor ); + static FieldUnit ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor ); + + /// @throws css::lang::IllegalArgumentException + static MapUnit /* MapModeUnit */ ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit); + + static ::Size /* VCLSize */ ConvertToVCLSize(css::awt::Size const& _aSize); + static css::awt::Size ConvertToAWTSize(::Size /* VCLSize */ const& _aSize); + + static ::Point /* VCLPoint */ ConvertToVCLPoint(css::awt::Point const& _aPoint); + static css::awt::Point ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint); + + static ::tools::Rectangle ConvertToVCLRect( css::awt::Rectangle const & _rRect ); + static css::awt::Rectangle ConvertToAWTRect( ::tools::Rectangle const & _rRect ); + + static css::awt::MouseEvent + createMouseEvent( + const ::MouseEvent& _rVclEvent, + const css::uno::Reference< css::uno::XInterface >& _rxContext + ); + + static ::MouseEvent createVCLMouseEvent( const css::awt::MouseEvent& _rAwtEvent ); + + static css::awt::KeyEvent + createKeyEvent( + const ::KeyEvent& _rVclEvent, + const css::uno::Reference< css::uno::XInterface >& _rxContext + ); + + 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |