diff options
Diffstat (limited to 'include/toolkit/controls')
-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 |
4 files changed, 1962 insertions, 0 deletions
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: */ |