diff options
Diffstat (limited to 'forms/source/inc')
27 files changed, 5121 insertions, 0 deletions
diff --git a/forms/source/inc/FormComponent.hxx b/forms/source/inc/FormComponent.hxx new file mode 100644 index 000000000000..de72e2b392e8 --- /dev/null +++ b/forms/source/inc/FormComponent.hxx @@ -0,0 +1,1298 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FORMS_FORMCOMPONENT_HXX_ +#define _FORMS_FORMCOMPONENT_HXX_ + +#include "cloneable.hxx" +#include "ids.hxx" +#include "property.hrc" +#include "property.hxx" +#include "propertybaghelper.hxx" +#include "resettable.hxx" +#include "services.hxx" +#include "windowstateguard.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/beans/XPropertyContainer.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/form/binding/XBindableValue.hpp> +#include <com/sun/star/form/FormComponentType.hpp> +#include <com/sun/star/form/validation/XValidatableFormComponent.hpp> +#include <com/sun/star/form/validation/XValidityConstraintListener.hpp> +#include <com/sun/star/form/XBoundComponent.hpp> +#include <com/sun/star/form/XBoundControl.hpp> +#include <com/sun/star/form/XFormComponent.hpp> +#include <com/sun/star/form/XLoadListener.hpp> +#include <com/sun/star/form/XReset.hpp> +#include <com/sun/star/io/XMarkableStream.hpp> +#include <com/sun/star/io/XPersistObject.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/sdb/XColumn.hpp> +#include <com/sun/star/sdb/XColumnUpdate.hpp> +#include <com/sun/star/sdb/XRowSetChangeListener.hpp> +#include <com/sun/star/sdbc/XRowSet.hpp> +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#include <com/sun/star/uno/XAggregation.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/form/XLoadable.hpp> +/** === end UNO includes === **/ + +#include <comphelper/componentcontext.hxx> +#include <comphelper/propagg.hxx> +#include <comphelper/propertybag.hxx> +#include <comphelper/propmultiplex.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/uno3.hxx> +#include <cppuhelper/component.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase7.hxx> +#include <osl/mutex.hxx> +#include <rtl/ustring.hxx> + +#include <memory> + +//......................................................................... +namespace frm +{ +//......................................................................... + + // default tab index for components + const sal_Int16 FRM_DEFAULT_TABINDEX = 0; + + // macros for quickly declaring/implementing XServiceInfo + #define DECLARE_XPERSISTOBJECT() \ + virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); \ + virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); \ + virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); \ + + // old macro for quickly implementing XServiceInfo::getImplementationName + #define IMPLEMENTATION_NAME(ImplName) \ + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) \ + { return ::rtl::OUString::createFromAscii("com.sun.star.comp.forms.") + ::rtl::OUString::createFromAscii(#ImplName); } + + class OControlModel; + + //========================================================================= + //= ControlModelLock + //========================================================================= + /** class whose instances lock a OControlModel + + Locking here merely means locking the OControlModel's mutex. + + In addition to the locking facility, the class is also able to fire property + change notifications. This happens when the last ControlModelLock instance on a stack + dies. + */ + class ControlModelLock + { + public: + ControlModelLock( OControlModel& _rModel ) + :m_rModel( _rModel ) + ,m_bLocked( false ) + { + acquire(); + } + + ~ControlModelLock() + { + if ( m_bLocked ) + release(); + } + inline void acquire(); + inline void release(); + + inline OControlModel& getModel() const { return m_rModel; }; + + /** adds a property change notification, which is to be fired when the last lock on the model + (in the current thread) is released. + */ + void addPropertyNotification( + const sal_Int32 _nHandle, + const ::com::sun::star::uno::Any& _rOldValue, + const ::com::sun::star::uno::Any& _rNewValue + ); + + private: + void impl_notifyAll_nothrow(); + + private: + OControlModel& m_rModel; + bool m_bLocked; + ::com::sun::star::uno::Sequence< sal_Int32 > m_aHandles; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_aOldValues; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_aNewValues; + + private: + ControlModelLock(); // never implemented + ControlModelLock( const ControlModelLock& ); // never implemented + ControlModelLock& operator=( const ControlModelLock& ); // never implemented + }; + +//========================================================================= +//= OControl +//= base class for form layer controls +//========================================================================= +typedef ::cppu::ImplHelper3 < ::com::sun::star::awt::XControl + , ::com::sun::star::lang::XEventListener + , ::com::sun::star::lang::XServiceInfo + > OControl_BASE; + +class OControl :public ::cppu::OComponentHelper + ,public OControl_BASE +{ +protected: + ::osl::Mutex m_aMutex; + OImplementationIdsRef m_aHoldIdHelper; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > + m_xControl; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> + m_xAggregate; + + ::comphelper::ComponentContext m_aContext; + WindowStateGuard m_aWindowStateGuard; + +public: + /** constructs a control + + @param _rFactory + the service factory for this control + @param _rAggregateService + the service name of the component to aggregate + @param _bSetDelegator + set this to <FALSE/> if you don't want the constructor to set the delegator at + the aggregate. In this case, you <em>have</em> to call doSetDelegator within your + own constructor. + + This is helpfull, if your derived class wants to cache an interface of the aggregate. + In this case, the aggregate needs to be queried for this interface <b>before</b> the + <member scope="com::sun::star::uno">XAggregation::setDelegator</member> call. + + In such a case, pass <FALSE/> to this parameter. Then, cache the aggregate's interface(s) + as needed. Afterwards, call <member>doSetDelegator</member>. + + In your destructor, you need to call <member>doResetDelegator</member> before + resetting the cached interfaces. This will reset the aggregates delegator to <NULL/>, + which will ensure that the <member scope="com::sun::star::uno">XInterface::release</member> + calls on the cached interfaces are really applied to the aggregate, instead of + the <type>OControl</type> itself. + */ + OControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rFactory, + const ::rtl::OUString& _rAggregateService, + const sal_Bool _bSetDelegator = sal_True + ); + + /** initializes the given peer with various settings necessary for form controls + */ + static void initFormControlPeer( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& _rxPeer ); + +protected: + virtual ~OControl(); + + /** sets the control as delegator at the aggregate + + This has to be called from within your derived class' constructor, if and only + if you passed <FALSE/> to the <arg>_bSetDelegator</arg> parameter of the + <type>OControl</type> constructor. + */ + void doSetDelegator(); + void doResetDelegator(); + +// UNO + DECLARE_UNO3_AGG_DEFAULTS(OControl, OComponentHelper); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + +// XTypeProvider + virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + +// OComponentHelper + virtual void SAL_CALL disposing(); + +// XComponent (as base of XControl) + virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException) + { OComponentHelper::dispose(); } + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException) + { OComponentHelper::addEventListener(_rxListener); } + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException) + { OComponentHelper::removeEventListener(_rxListener); } + +// XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException); + +// XServiceInfo + virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw (::com::sun::star::uno::RuntimeException); + virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException) = 0; + +// XServiceInfo - static version + static StringSequence SAL_CALL getSupportedServiceNames_Static() throw(::com::sun::star::uno::RuntimeException); + +// XControl + virtual void SAL_CALL setContext(const InterfaceRef& Context) throw (::com::sun::star::uno::RuntimeException); + virtual InterfaceRef SAL_CALL getContext() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL createPeer(const ::com::sun::star::uno::Reference<starawt::XToolkit>& Toolkit, const ::com::sun::star::uno::Reference<starawt::XWindowPeer>& Parent) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference<starawt::XWindowPeer> SAL_CALL getPeer() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference<starawt::XControlModel>& Model) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference<starawt::XControlModel> SAL_CALL getModel() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference<starawt::XView> SAL_CALL getView() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDesignMode(sal_Bool bOn) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDesignMode() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isTransparent() throw (::com::sun::star::uno::RuntimeException); + +protected: + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); + // overwrite this and call the base class if you have additional types + + ::com::sun::star::uno::Sequence< ::rtl::OUString > getAggregateServiceNames(); + +private: + void impl_resetStateGuard_nothrow(); +}; + +//================================================================== +//= OBoundControl +//= a form control implementing the XBoundControl interface +//================================================================== +typedef ::cppu::ImplHelper1 < ::com::sun::star::form::XBoundControl + > OBoundControl_BASE; +class OBoundControl :public OControl + ,public OBoundControl_BASE +{ +protected: + sal_Bool m_bLocked : 1; + + ::rtl::OUString m_sOriginalHelpText; // as long as the text/value is invalid, we change the help text of our peer + ::com::sun::star::awt::FontDescriptor + m_aOriginalFont; // as long as the text/value is invalid, we also change the font + sal_Int32 m_nOriginalTextLineColor; // (we add red underlining) + +public: + OBoundControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory, + const ::rtl::OUString& _rAggregateService, + const sal_Bool _bSetDelegator = sal_True + ); + + virtual ~OBoundControl(); + + DECLARE_UNO3_AGG_DEFAULTS(OBoundControl, OControl); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + + // XBoundControl + virtual sal_Bool SAL_CALL getLock() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLock(sal_Bool _bLock) throw(::com::sun::star::uno::RuntimeException); + // default implementation just disables the controls, overwrite _setLock to change this behaviour + + // XControl + virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + +protected: + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); + // implement the lock setting + virtual void _setLock(sal_Bool _bLock); +}; + +//================================================================== +//= OControlModel +//= model of a form layer control +//================================================================== + +typedef ::cppu::ImplHelper7 < ::com::sun::star::form::XFormComponent + , ::com::sun::star::io::XPersistObject + , ::com::sun::star::container::XNamed + , ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::util::XCloneable + , ::com::sun::star::beans::XPropertyContainer + , ::com::sun::star::beans::XPropertyAccess + > OControlModel_BASE; + +class OControlModel :public ::cppu::OComponentHelper + ,public OPropertySetAggregationHelper + ,public OControlModel_BASE + ,public OCloneableAggregation + ,public IPropertyBagHelperContext +{ + +protected: + ::comphelper::ComponentContext m_aContext; + + ::osl::Mutex m_aMutex; + oslInterlockedCount m_lockCount; + + InterfaceRef m_xParent; // ParentComponent + OImplementationIdsRef m_aHoldIdHelper; + PropertyBagHelper m_aPropertyBagHelper; + + const ::comphelper::ComponentContext& + getContext() const { return m_aContext; } + +// <properties> + ::rtl::OUString m_aName; // name of the control + ::rtl::OUString m_aTag; // tag for additional data + sal_Int16 m_nTabIndex; // index within the taborder + sal_Int16 m_nClassId; // type of the control + sal_Bool m_bNativeLook; // should the control use the native platform look? +// </properties> + + +protected: + OControlModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory, // factory to create the aggregate with + const ::rtl::OUString& _rUnoControlModelTypeName, // service name of te model to aggregate + const ::rtl::OUString& rDefault = ::rtl::OUString(), // service name of the default control + const sal_Bool _bSetDelegator = sal_True // set to FALSE if you want to call setDelegator later (after returning from this ctor) + ); + OControlModel( + const OControlModel* _pOriginal, // the original object to clone + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory, // factory to create the aggregate with + const sal_Bool _bCloneAggregate = sal_True, // should the aggregate of the original be cloned, too? + const sal_Bool _bSetDelegator = sal_True // set to FALSE if you want to call setDelegator later (after returning from this ctor) + ); + virtual ~OControlModel(); + + /** to be called after a OBoundControlModel (a derivee, respectively) has been cloned + + <p>This method contains late initializations which cannot be done in the + constructor of this base class, since the virtual method of derived classes do + not yet work there.</p> + */ + virtual void clonedFrom( const OControlModel* _pOriginal ); + + using OComponentHelper::rBHelper; + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); + + void readHelpTextCompatibly(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& _rxInStream); + void writeHelpTextCompatibly(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& _rxOutStream); + + void doSetDelegator(); + void doResetDelegator(); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > getAggregateServiceNames(); + +public: + DECLARE_UNO3_AGG_DEFAULTS(OControl, OComponentHelper); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); + +// XTypeProvider + virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + +// OComponentHelper + virtual void SAL_CALL disposing(); + +// XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName(const ::rtl::OUString& aName) throw(::com::sun::star::uno::RuntimeException); + +// XServiceInfo + virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw (::com::sun::star::uno::RuntimeException); + virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException) = 0; + +// XSericeInfo - static version(s) + static StringSequence SAL_CALL getSupportedServiceNames_Static() throw(::com::sun::star::uno::RuntimeException); + +// XPersistObject + virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException) = 0; + virtual void SAL_CALL + write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL + read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + +// XChild (base of XFormComponent) + virtual InterfaceRef SAL_CALL getParent() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + +// XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException); + +// XPropertySet + virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::uno::Exception); + using ::cppu::OPropertySetHelper::getFastPropertyValue; + +// ::com::sun::star::beans::XPropertyState + virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle); + virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle); + virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; + +// XCloneable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException) = 0; + +// XPropertyContainer + virtual void SAL_CALL addProperty( const ::rtl::OUString& Name, ::sal_Int16 Attributes, const ::com::sun::star::uno::Any& DefaultValue ) throw (::com::sun::star::beans::PropertyExistException, ::com::sun::star::beans::IllegalTypeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeProperty( const ::rtl::OUString& Name ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::NotRemoveableException, ::com::sun::star::uno::RuntimeException); + +// XPropertyAccess + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + +protected: + using OPropertySetAggregationHelper::setPropertyValues; + using OPropertySetAggregationHelper::getPropertyValues; + +protected: + virtual void writeAggregate( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& _rxOutStream ) const; + virtual void readAggregate( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& _rxInStream ); + +protected: + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException); + // OPropertySetHelper + virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + /** describes the properties provided by this class, or its respective + derived class + + Derived classes usually call the base class first, and then append own properties. + */ + virtual void describeFixedProperties( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps + ) const; + + // IPropertyBagHelperContext + virtual ::osl::Mutex& getMutex(); + virtual void describeFixedAndAggregateProperties( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _out_rFixedProperties, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _out_rAggregateProperties + ) const; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > + getPropertiesInterface(); + + /** describes the properties of our aggregate + + The default implementation simply asks m_xAggregateSet for its properties. + + You usually only need to overload this method if you want to filter the aggregate + properties. + */ + virtual void describeAggregateProperties( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps + ) const; + +public: + struct LockAccess { friend class ControlModelLock; private: LockAccess() { } }; + + void lockInstance( LockAccess ); + oslInterlockedCount unlockInstance( LockAccess ); + + void firePropertyChanges( + const ::com::sun::star::uno::Sequence< sal_Int32 >& _rHandles, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rOldValues, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rNewValues, + LockAccess + ); + + inline ::osl::Mutex& + getInstanceMutex() { return m_aMutex; } +}; + +//================================================================== +// simple destructor +#define DECLARE_DEFAULT_DTOR( classname ) \ + ~classname() \ + +// constructor for cloning a class +#define DECLARE_DEFAULT_CLONE_CTOR( classname ) \ + classname( \ + const classname* _pOriginal, \ + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory \ + ); \ + +// all xtors for an inner class of the object hierarchy +#define DECLARE_DEFAULT_XTOR( classname ) \ + classname( \ + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, \ + const ::rtl::OUString& _rUnoControlModelTypeName, \ + const ::rtl::OUString& _rDefault \ + ); \ + DECLARE_DEFAULT_CLONE_CTOR( classname ) \ + DECLARE_DEFAULT_DTOR( classname ) \ + +// all xtors for an inner class of the object hierarchy which is *bound* +#define DECLARE_DEFAULT_BOUND_XTOR( classname ) \ + classname( \ + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, \ + const ::rtl::OUString& _rUnoControlModelTypeName, \ + const ::rtl::OUString& _rDefault, \ + const sal_Bool _bSupportExternalBinding, \ + const sal_Bool _bSupportsValidation \ + ); \ + DECLARE_DEFAULT_CLONE_CTOR( classname ) \ + DECLARE_DEFAULT_DTOR( classname ) \ + +// all xtors for a leas class of the object hierarchy +#define DECLARE_DEFAULT_LEAF_XTOR( classname ) \ + classname( \ + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory \ + ); \ + classname( \ + const classname* _pOriginal, \ + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory \ + ); \ + DECLARE_DEFAULT_DTOR( classname ) \ + +//================================================================== +// XCloneable +#define DECLARE_XCLONEABLE( ) \ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException) + +#define IMPLEMENT_DEFAULT_CLONING( classname ) \ + ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL classname::createClone( ) throw (::com::sun::star::uno::RuntimeException) \ + { \ + classname* pClone = new classname( this, getContext().getLegacyServiceFactory() ); \ + pClone->clonedFrom( this ); \ + return pClone; \ + } + +//================================================================== +//= OBoundControlModel +//= model of a form layer control which is bound to a data source field +//================================================================== +typedef ::cppu::ImplHelper4 < ::com::sun::star::form::XLoadListener + , ::com::sun::star::form::XReset + , ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::sdb::XRowSetChangeListener + > OBoundControlModel_BASE1; + +// separated into an own base class since derivees can disable the support for this +// interface, thus we want to easily exclude it in the queryInterface and getTypes +typedef ::cppu::ImplHelper1 < ::com::sun::star::form::XBoundComponent + > OBoundControlModel_COMMITTING; + +// dito +typedef ::cppu::ImplHelper2 < ::com::sun::star::form::binding::XBindableValue + , ::com::sun::star::util::XModifyListener + > OBoundControlModel_BINDING; + +// dito +typedef ::cppu::ImplHelper2 < ::com::sun::star::form::validation::XValidityConstraintListener + , ::com::sun::star::form::validation::XValidatableFormComponent + > OBoundControlModel_VALIDATION; + +class OBoundControlModel :public OControlModel + ,public OBoundControlModel_BASE1 + ,public OBoundControlModel_COMMITTING + ,public OBoundControlModel_BINDING + ,public OBoundControlModel_VALIDATION + ,public ::comphelper::OPropertyChangeListener +{ +protected: + enum ValueChangeInstigator + { + eDbColumnBinding, + eExternalBinding, + eOther + }; + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + m_xField; + // the form which controls supplies the field we bind to. + ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > + m_xAmbientForm; + + ::rtl::OUString m_sValuePropertyName; + sal_Int32 m_nValuePropertyAggregateHandle; + sal_Int32 m_nFieldType; + ::com::sun::star::uno::Type m_aValuePropertyType; + bool m_bValuePropertyMayBeVoid; + + ResetHelper m_aResetHelper; + ::cppu::OInterfaceContainerHelper m_aUpdateListeners; + ::cppu::OInterfaceContainerHelper m_aFormComponentListeners; + + ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding > + m_xExternalBinding; + ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XValidator > + m_xValidator; + ::com::sun::star::uno::Type m_aExternalValueType; + +// <properties> + ::rtl::OUString m_aControlSource; // Datenquelle, Name des Feldes + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + m_xLabelControl; // reference to a sibling control (model) which is our label + sal_Bool m_bInputRequired; +// </properties> + + ::comphelper::OPropertyChangeMultiplexer* + m_pAggPropMultiplexer; + + bool m_bFormListening : 1; // are we currently a XLoadListener at our ambient form? + sal_Bool m_bLoaded : 1; + sal_Bool m_bRequired : 1; + const sal_Bool m_bCommitable : 1; // do we support XBoundComponent? + const sal_Bool m_bSupportsExternalBinding : 1; // do we support XBindableValue? + const sal_Bool m_bSupportsValidation : 1; // do we support XValidatable? + sal_Bool m_bForwardValueChanges : 1; // do we currently handle changes in the bound database field? + sal_Bool m_bTransferingValue : 1; // true if we're currently transfering our value to an external binding + sal_Bool m_bIsCurrentValueValid : 1; // flag specifying whether our current value is valid, relative to our external validator + sal_Bool m_bBindingControlsRO : 1; // is our ReadOnly property currently controlled by our external binding? + sal_Bool m_bBindingControlsEnable : 1; // is our Enabled property currently controlled by our external binding? + + ValueChangeInstigator m_eControlValueChangeInstigator; + +protected: + ::rtl::OUString m_aLabelServiceName; + // when setting the label for our control (property FM_PROP_CONTROLLABEL, member m_xLabelControl), + // we accept only objects supporting an XControlModel interface, an XServiceInfo interface and + // support for a service (XServiceInfo::supportsService) determined by this string. + // Any other arguments will throw an IllegalArgumentException. + // The default value is FM_COMPONENT_FIXEDTEXT. + + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > + m_xCursor; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate > + m_xColumnUpdate; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn > + m_xColumn; + +protected: + inline const ::rtl::OUString& getValuePropertyName( ) const { return m_sValuePropertyName; } + inline sal_Int32 getValuePropertyAggHandle( ) const { return m_nValuePropertyAggregateHandle; } + inline const ::rtl::OUString& getControlSource( ) const { return m_aControlSource; } + inline sal_Bool isRequired() const { return m_bRequired; } + inline sal_Bool isLoaded() const { return m_bLoaded; } + +protected: + + OBoundControlModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory, + // factory to create the aggregate with + const ::rtl::OUString& _rUnoControlModelTypeName, // service name of te model to aggregate + const ::rtl::OUString& _rDefault, // service name of the default control + const sal_Bool _bCommitable, // is the control (model) commitable ? + const sal_Bool _bSupportExternalBinding, // set to TRUE if you want to support XBindableValue + const sal_Bool _bSupportsValidation // set to TRUE if you want to support XValidatable + ); + OBoundControlModel( + const OBoundControlModel* _pOriginal, // the original object to clone + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory + // factory to create the aggregate with + ); + virtual ~OBoundControlModel(); + + /// late ctor after cloning + virtual void clonedFrom( const OControlModel* _pOriginal ); + + /** initializes the part of the class which is related to the control value. + + <p>Kind of late ctor, to be called for derivees which have a dedicated value property.<br/> + The value property is the property which's value is synced with either the database + column the object is bound to, or with the external value binding, if present.<br/> + E.g. for a text control model, this property will most probably be "Text".</p> + + <p>Derived classes are stronly recommend to call this method - at least the + "DataFieldProperty" (exposed in getFastPropertyValue) relies on the information + given herein, and needs to be supplied otherwise else.</p> + + <p>If this method has been called properly, then <member>setControlValue</member> + does not need to be overridden - it will simply set the property value at the + aggregate then.</p> + + @precond + The method has not be called before during the life time of the object. + + @param _rValuePropertyName + the name of the value property + @param _nValuePropertyExternalHandle + the handle of the property, as exposed to external components.<br/> + Normally, this information can be obtained dynamically (e.g. from describeFixedProperties), + but since this method is to be called from within the constructor of derived classes, + we prefer to be on the *really* safe side here .... + + @see setControlValue + @see suspendValueListening + @see resumeValueListening + @see describeFixedProperties + */ + void initValueProperty( + const ::rtl::OUString& _rValuePropertyName, + sal_Int32 _nValuePropertyExternalHandle + ); + + /** suspends listening at the value property + + <p>As long as this listening is suspended, changes in the value property will not be + recognized and not be handled.</p> + + @see initValueProperty + @see resumeValueListening + */ + void suspendValueListening( ); + + /** resumes listening at the value property + + <p>As long as this listening is suspended, changes in the value property will not be + recognized and not be handled.</p> + + @precond + listening at the value property is currently suspended + + @see initValueProperty + @see resumeValueListening + */ + void resumeValueListening( ); + + /** starts listening at the aggregate, for changes in the given property + + <p>The OBoundControlModel automatically registers a multiplexer which listens for + changes in the aggregate property values. By default, only the control value property + is observed. You may add additional properties to be observed with this method.</p> + + @see initValueProperty + @see _propertyChanged + */ + void startAggregatePropertyListening( const ::rtl::OUString& _rPropertyName ); + + /** returns the default which should be used when resetting the control + + <p>The default implementation returns an empty Any.</p> + + @see resetNoBroadcast + */ + virtual ::com::sun::star::uno::Any + getDefaultForReset() const; + + /** translates a db column value into a control value. + + <p>Must transform the very current value of the database column we're bound to + (<member>m_xColumn</member>) into a value which can be used as current value + for the control.</p> + + @see setControlValue + @pure + */ + virtual ::com::sun::star::uno::Any + translateDbColumnToControlValue( ) = 0; + + /** returns the data types which the control could use to exchange data with + an external value binding + + The types returned here are completely independent from the concrete value binding, + they're just candidates which depend on the control type, and possible the concrete state + of the control (i.e. some property value). + + If a control implementation supports multiple types, the ordering in the returned + sequence indicates preference: Preferred types are mentioned first. + + The default implementation returns the type of our value property. + */ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > + getSupportedBindingTypes(); + + /** translates the given value, which was obtained from the current external value binding, + to a value which can be used in setControlValue + + <p>The default implementation returns the value itself, exception when it is VOID, and + our value property is not allowed to be void - in this case, the returned value is a + default-constructed value of the type required by our value property. + + @see hasExternalValueBinding + @see getExternalValueType + */ + virtual ::com::sun::star::uno::Any + translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const; + + /** commits the current control value to our external value binding + + <p>The default implementation simply calls getControlValue.</p> + + @see hasExternalValueBinding + @see initValueProperty + */ + virtual ::com::sun::star::uno::Any + translateControlValueToExternalValue( ) const; + + /** commits the current control value to the database column we're bound to + @precond + we're properly bound to a database column, especially <member>m_xColumnUpdate</member> + is not <NULL/> + @param _bPostReset + <TRUE/> if and only if the current control value results from a reset (<member>getDefaultForReset</member>) + @pure + */ + virtual sal_Bool commitControlValueToDbColumn( + bool _bPostReset + ) = 0; + + /** sets the given value as new current value for the control + + Besides some administrative work (such as caring for <member>m_eControlValueChangeInstigator</member>), + this method simply calls <member>doSetControlValue</member>. + + @precond + Our own mutex is locked. + @param _rValue + The value to set. This value is guaranteed to be created by + <member>translateDbColumnToControlValue</member> or + <member>translateExternalValueToControlValue</member> + @param _eInstigator + the instigator of the value change + */ + void setControlValue( + const ::com::sun::star::uno::Any& _rValue, + ValueChangeInstigator _eInstigator + ); + /** + <p>The default implementation will forward the given value to the aggregate, using + m_nValuePropertyAggregateHandle and/or m_sValuePropertyName.</p> + + @precond + Our own mutex is locked. + @param _rValue + The value to set. This value is guaranteed to be created by + <member>translateDbColumnToControlValue</member> or + <member>translateExternalValueToControlValue</member> + */ + virtual void doSetControlValue( + const ::com::sun::star::uno::Any& _rValue + ); + + /** retrieves the current value of the control + + <p>The default implementation will ask the aggregate for the property value + determined by either m_nValuePropertyAggregateHandle and/or m_sValuePropertyName.</p> + + @precond + Our own mutex is locked. + */ + virtual ::com::sun::star::uno::Any + getControlValue( ) const; + + /** called whenever a connection to a database column has been established + */ + virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm ); + /** called whenever a connection to a database column has been suspended + */ + virtual void onDisconnectedDbColumn(); + + /** called whenever a connection to an external supplier of values (XValueBinding) has been established + @see m_xExternalBinding + */ + virtual void onConnectedExternalValue( ); + /** called whenever a connection to an external supplier of values (XValueBinding) has been suspended + */ + virtual void onDisconnectedExternalValue(); + + /** called whenever an external validator has been registered + */ + virtual void onConnectedValidator( ); + /** called whenever an external validator has been revoked + */ + virtual void onDisconnectedValidator( ); + + /** nFieldType ist der Typ des Feldes, an das das Model gebunden werden soll. + Das Binden erfolgt genau dann, wenn Rueckgabewert sal_True. + Die Standard-Implementation erlaubt alles ausser den drei binary-Typen und + FieldType_OTHER. + */ + virtual sal_Bool approveDbColumnType(sal_Int32 _nColumnType); + + /** retrieves the current value of the control, in a shape which can be used with our + external validator. + + The default implementation simply calls <member>>translateControlValueToExternalValue</member>. + + @precond + Our own mutex is locked. + */ + virtual ::com::sun::star::uno::Any + translateControlValueToValidatableValue( ) const; + + /** retrieves the current value of the form component + + This is the implementation method for XValidatableFormComponent::getCurrentValue. The default implementation + calls translateControlValueToValidatableValue if a validator is present, otherwise getControlValue. + + @precond + our mutex is locked when this method is called + */ + virtual ::com::sun::star::uno::Any + getCurrentFormComponentValue() const; + + /** We can't write (new) common properties in this base class, as the file format doesn't allow this + (unfortunally). So derived classes may use the following to methods. They secure the written + data with marks, so any new common properties in newer versions will be skipped by older ones. + */ + void writeCommonProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream); + void readCommonProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream); + // the next method may be used in derived classes's read when an unknown version is encountered + void defaultCommonProperties(); + + /** called to reset the control to some kind of default. + + <p>The semantics of "default" is finally defined by the derived class (in particular, + by <member>getDefaultForReset</member>).</p> + + <p>No listener notification needs to be done in the derived class.</p> + + <p>Normally, you won't override this method, but <member>getDefaultForReset</member> instead.</p> + + @see getDefaultForReset + */ + virtual void resetNoBroadcast(); + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); + + /// sets m_xField to the given new value, without notifying our listeners + void impl_setField_noNotify( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxField + ); + inline bool hasField() const + { + return m_xField.is(); + } + inline sal_Int32 getFieldType() const + { + return m_nFieldType; + } + + // OControlModel's property handling + virtual void describeFixedProperties( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps + ) const; + +public: + inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& getField() const + { + return m_xField; + } + +public: + // UNO Anbindung + DECLARE_UNO3_AGG_DEFAULTS(OBoundControlModel, OControlModel); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // XReset + virtual void SAL_CALL reset( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual StringSequence SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo - static version + static StringSequence SAL_CALL getSupportedServiceNames_Static() throw(::com::sun::star::uno::RuntimeException); + + // XChild + virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + + // XPersistObject + virtual void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + + // XBoundComponent + virtual sal_Bool SAL_CALL commit() throw(::com::sun::star::uno::RuntimeException); + + // XUpdateBroadcaster (base of XBoundComponent) + virtual void SAL_CALL addUpdateListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeUpdateListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::uno::Exception); + using ::cppu::OPropertySetHelper::getFastPropertyValue; + +// ::com::sun::star::beans::XPropertyState + virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; + +// XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException); + +// XPropertyChangeListener + virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); + + // XRowSetChangeListener + virtual void SAL_CALL onRowSetChanged( const ::com::sun::star::lang::EventObject& i_Event ) throw (::com::sun::star::uno::RuntimeException); + +// XLoadListener + virtual void SAL_CALL loaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL unloading( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL unloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL reloading( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL reloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); + +private: + // XBindableValue + virtual void SAL_CALL setValueBinding( const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding ) throw (::com::sun::star::form::binding::IncompatibleTypesException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding > SAL_CALL getValueBinding( ) throw (::com::sun::star::uno::RuntimeException); + + // XModifyListener + virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& _rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XValidatable + virtual void SAL_CALL setValidator( const ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XValidator >& Validator ) throw (::com::sun::star::util::VetoException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XValidator > SAL_CALL getValidator( ) throw (::com::sun::star::uno::RuntimeException); + + // XValidityConstraintListener + virtual void SAL_CALL validityConstraintChanged( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + // XValidatableFormComponent + virtual sal_Bool SAL_CALL isValid( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addFormComponentValidityListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XFormComponentValidityListener >& Listener ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeFormComponentValidityListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XFormComponentValidityListener >& Listener ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); + +protected: + // OPropertyChangeListener + virtual void + _propertyChanged( const ::com::sun::star::beans::PropertyChangeEvent& _rEvt ) throw ( ::com::sun::star::uno::RuntimeException ); + + /// checks whether we currently have an external value binding in place + inline bool hasExternalValueBinding() const { return m_xExternalBinding.is(); } + + // checks whether we currently have an external validator + inline bool hasValidator() const { return m_xValidator.is(); } + + /** transfers the very current value of the db column we're bound to the control + @precond + our own mutex is locked + @precond + we don't have an external binding in place + */ + void transferDbValueToControl( ); + + /** transfers the current value of the active external binding to the control + @precond + we do have an active external binding in place + */ + void transferExternalValueToControl( ControlModelLock& _rInstanceLock ); + + /** transfers the control value to the external binding + @precond + our own mutex is locked, and _rInstanceLock is the guard locking it + @precond + we do have an active external binding in place + */ + void transferControlValueToExternal( ControlModelLock& _rInstanceLock ); + + /** calculates the type which is to be used to communicate with the current external binding, + and stores it in m_aExternalValueType + + The method checks the possible type candidates as returned by getSupportedBindingTypes, + and the types supported by the current external binding, if any. + */ + void calculateExternalValueType(); + + /** returns the type which should be used to exchange data with our external value binding + + @see initValueProperty + */ + const ::com::sun::star::uno::Type& + getExternalValueType() const { return m_aExternalValueType; } + + /** initializes the control from m_xField + + Basically, this method calls transferDbValueToControl - but only if our cursor is positioned + on a valid row. Otherwise, the control is reset. + + @precond + m_xField is not <NULL/> + */ + void initFromField( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxForm ); + +private: + sal_Bool connectToField( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxForm ); + void resetField(); + + /** does a new validation of the control value + + If necessary, our <member>m_bIsCurrentValueValid</member> member will be adjusted, + and changes will be notified. + + Note that it's not necessary that we're connected to a validator. If we are not, + it's assumed that our value is valid, and this is handled appropriately. + + Use this method if there is a potential that <b>only</b> the validity flag changed. If + any of the other aspects (our current value, or our current text) changed, then + pass <TRUE/> for <member>_bForceNotification</member>. + + @param _bForceNotification + if <TRUE/>, then the validity listeners will be notified, not matter whether the validity + changed. + */ + void recheckValidity( bool _bForceNotification ); + + /// initializes m_pAggPropMultiplexer + void implInitAggMultiplexer( ); + + /// initializes listening at the value property + void implInitValuePropertyListening( ) const; + + /** adds or removes the component as load listener to/from our form, and (if necessary) as RowSetChange listener at + our parent. + + @precond there must no external value binding be in place + */ + void doFormListening( const bool _bStart ); + + inline bool isFormListening() const { return m_bFormListening; } + + /** determines the new value of m_xAmbientForm + */ + void impl_determineAmbientForm_nothrow(); + + /** connects to a value supplier which is an database column. + + The column is take from our parent, which must be a database form respectively row set. + + @precond The control does not have an external value supplier + + @param _bFromReload + Determines whether the connection is made after the row set has been loaded (<FALSE/>) + or reloaded (<TRUE/>) + + @see impl_disconnectDatabaseColumn_noNotify + */ + void impl_connectDatabaseColumn_noNotify( + bool _bFromReload + ); + + /** disconnects from a value supplier which is an database column + + @precond The control does not have an external value supplier + @see impl_connectDatabaseColumn_noNotify + */ + void impl_disconnectDatabaseColumn_noNotify(); + + /** connects to an external value binding + + <p>Note that by definition, external data bindings superseede the SQL data binding which + is defined by our RowSet-column-related properties. This means that in case we're currently + connected to a database column when this is called, this connection is suspended.</p> + + @precond + the new external binding has already been approved (see <member>impl_approveValueBinding_nolock</member>) + @precond + there currently is no external binding in place + */ + void connectExternalValueBinding( + const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding, + ControlModelLock& _rInstanceLock + ); + + /** disconnects from an external value binding + + @precond + there currently is an external binding in place + */ + void disconnectExternalValueBinding( ); + + /** connects the component to an external validator + + @precond + there currently is no active validator + @precond + our mutex is currently locked exactly once + */ + void connectValidator( + const ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XValidator >& _rxValidator + ); + + /** disconnects the component from it's current an external validator + + @precond + there currently is an active validator + @precond + our mutex is currently locked exactly once + */ + void disconnectValidator( ); + + /** called from within <member scope="com::sun::star:::form::binding">XBindableValue::setValueBinding</member> + to approve the new binding + + The default implementation approves the binding if and only if it is not <NULL/>, and supports + the type returned by getExternalValueType. + + @param _rxBinding + the binding which applies for being responsible for our value, Must not be + <NULL/> + @return + <TRUE/> if and only if the given binding can supply values in the proper type + + @seealso getExternalValueType + */ + sal_Bool impl_approveValueBinding_nolock( + const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding + ); +}; + + //========================================================================= + //= inlines + //========================================================================= + inline void ControlModelLock::acquire() + { + m_rModel.lockInstance( OControlModel::LockAccess() ); + m_bLocked = true; + } + inline void ControlModelLock::release() + { + OSL_ENSURE( m_bLocked, "ControlModelLock::release: not locked!" ); + m_bLocked = false; + + if ( 0 == m_rModel.unlockInstance( OControlModel::LockAccess() ) ) + impl_notifyAll_nothrow(); + } + +//......................................................................... +} +//......................................................................... + +#endif // _FORMS_FORMCOMPONENT_HXX_ + diff --git a/forms/source/inc/InterfaceContainer.hxx b/forms/source/inc/InterfaceContainer.hxx new file mode 100644 index 000000000000..427d0c6ed190 --- /dev/null +++ b/forms/source/inc/InterfaceContainer.hxx @@ -0,0 +1,328 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FRM_INTERFACE_CONTAINER_HXX_ +#define _FRM_INTERFACE_CONTAINER_HXX_ + +#include <hash_map> +#include <comphelper/stl_types.hxx> +#include <comphelper/types.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/io/XPersistObject.hpp> +#include <com/sun/star/form/XFormComponent.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/script/XEventAttacherManager.hpp> +#include <com/sun/star/script/ScriptEvent.hpp> +#include <com/sun/star/script/ScriptEventDescriptor.hpp> +#include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/form/XFormComponent.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <osl/mutex.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/component.hxx> +#include <cppuhelper/implbase8.hxx> + +using namespace comphelper; + +//......................................................................... +namespace frm +{ +//......................................................................... + + +//================================================================== + struct ElementDescription + { + public: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInterface; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropertySet; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild > xChild; + ::com::sun::star::uno::Any aElementTypeInterface; + + public: + ElementDescription( ); + virtual ~ElementDescription(); + + private: + ElementDescription( const ElementDescription& ); // never implemented + ElementDescription& operator=( const ElementDescription& ); // never implemented + }; + +typedef ::std::vector<InterfaceRef> OInterfaceArray; +typedef ::std::hash_multimap< ::rtl::OUString, InterfaceRef, ::comphelper::UStringHash, ::comphelper::UStringEqual> OInterfaceMap; + +//================================================================== +// OInterfaceContainer +// implements a container for form components +//================================================================== +typedef ::cppu::ImplHelper8 < ::com::sun::star::container::XNameContainer + , ::com::sun::star::container::XIndexContainer + , ::com::sun::star::container::XContainer + , ::com::sun::star::container::XEnumerationAccess + , ::com::sun::star::script::XEventAttacherManager + , ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::io::XPersistObject + , ::com::sun::star::util::XCloneable + > OInterfaceContainer_BASE; + +class OInterfaceContainer : public OInterfaceContainer_BASE +{ +protected: + ::osl::Mutex& m_rMutex; + + OInterfaceArray m_aItems; + OInterfaceMap m_aMap; + ::cppu::OInterfaceContainerHelper m_aContainerListeners; + + const ::com::sun::star::uno::Type m_aElementType; + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xServiceFactory; + + + // EventManager + ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager> m_xEventAttacher; + +public: + OInterfaceContainer( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, + ::osl::Mutex& _rMutex, + const ::com::sun::star::uno::Type& _rElementType); + + OInterfaceContainer( ::osl::Mutex& _rMutex, const OInterfaceContainer& _cloneSource ); + + // late constructor for cloning + void clonedFrom( const OInterfaceContainer& _cloneSource ); + +protected: + virtual ~OInterfaceContainer(); + +public: +// ::com::sun::star::io::XPersistObject + virtual ::rtl::OUString SAL_CALL getServiceName( ) throw(::com::sun::star::uno::RuntimeException) = 0; + virtual void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::lang::XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::beans::XPropertyChangeListener + virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw (::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration> SAL_CALL createEnumeration() throw(::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual StringSequence SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XNameReplace + virtual void SAL_CALL replaceByName(const ::rtl::OUString& Name, const ::com::sun::star::uno::Any& _rElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XNameContainer + virtual void SAL_CALL insertByName(const ::rtl::OUString& Name, const ::com::sun::star::uno::Any& _rElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName(const ::rtl::OUString& Name) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _nIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XIndexReplace + virtual void SAL_CALL replaceByIndex(sal_Int32 _nIndex, const ::com::sun::star::uno::Any& _rElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XIndexContainer + virtual void SAL_CALL insertByIndex(sal_Int32 _nIndex, const ::com::sun::star::uno::Any& Element) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByIndex(sal_Int32 _nIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XContainer + virtual void SAL_CALL addContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::script::XEventAttacherManager + virtual void SAL_CALL registerScriptEvent( sal_Int32 nIndex, const ::com::sun::star::script::ScriptEventDescriptor& aScriptEvent ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL registerScriptEvents( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& aScriptEvents ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokeScriptEvent( sal_Int32 nIndex, const ::rtl::OUString& aListenerType, const ::rtl::OUString& aEventMethod, const ::rtl::OUString& aRemoveListenerParam ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokeScriptEvents( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertEntry( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEntry( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor > SAL_CALL getScriptEvents( sal_Int32 Index ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL attach( sal_Int32 nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xObject, const ::com::sun::star::uno::Any& aHelper ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::ServiceNotRegisteredException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL detach( sal_Int32 nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xObject ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addScriptListener( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xListener ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeScriptListener( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& Listener ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + +protected: + // helper + virtual void SAL_CALL disposing(); + virtual void removeElementsNoEvents(sal_Int32 nIndex); + + /** to be overridden if elements which are to be inserted into the container shall be checked + + <p>the ElementDescription given can be used to cache information about the object - it will be passed + later on to implInserted/implReplaced.</p> + */ + virtual void approveNewElement( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject, + ElementDescription* _pElement + ); + + virtual ElementDescription* createElementMetaData( ); + + /** inserts an object into our internal structures + + @param _nIndex + the index at which position it should be inserted + @param _bEvents + if <TRUE/>, event knittings will be done + @param _pApprovalResult + must contain the result of an approveNewElement call. Can be <NULL/>, in this case, the approval + is done within implInsert. + @param _bFire + if <TRUE/>, a notification about the insertion will be fired + */ + void implInsert( + sal_Int32 _nIndex, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject, + sal_Bool _bEvents /* = sal_True */, + ElementDescription* _pApprovalResult /* = NULL */ , + sal_Bool _bFire /* = sal_True */ + ) throw(::com::sun::star::lang::IllegalArgumentException); + + // called after the object is inserted, but before the "real listeners" are notified + virtual void implInserted( const ElementDescription* _pElement ); + // called after the object is removed, but before the "real listeners" are notified + virtual void implRemoved(const InterfaceRef& _rxObject); + + /** called after an object was replaced. The default implementation notifies our listeners, after releasing + the instance lock. + */ + virtual void impl_replacedElement( + const ::com::sun::star::container::ContainerEvent& _rEvent, + ::osl::ClearableMutexGuard& _rInstanceLock + ); + + void SAL_CALL writeEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream); + void SAL_CALL readEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream); + + /** replace an element, specified by position + + @precond <arg>_nIndex</arg> is a valid index + @precond our mutex is locked exactly once, by the guard specified with <arg>_rClearBeforeNotify</arg> + + */ + void implReplaceByIndex( + const sal_Int32 _nIndex, + const ::com::sun::star::uno::Any& _rNewElement, + ::osl::ClearableMutexGuard& _rClearBeforeNotify + ); + + /** removes an element, specified by position + + @precond <arg>_nIndex</arg> is a valid index + @precond our mutex is locked exactly once, by the guard specified with <arg>_rClearBeforeNotify</arg> + + */ + void implRemoveByIndex( + const sal_Int32 _nIndex, + ::osl::ClearableMutexGuard& _rClearBeforeNotify + ); + + /** validates the given index + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if the given index does not denote a valid position in our childs array + */ + void implCheckIndex( const sal_Int32 _nIndex ) SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) ); + +private: + // hack for Vba Events + void fakeVbaEventsHack( sal_Int32 _nIndex ); + + // the runtime event format has changed from version SO5.2 to OOo + enum EventFormat + { + efVersionSO5x, + efVersionSO6x + }; + void transformEvents( const EventFormat _eTargetFormat ); + + void impl_createEventAttacher_nothrow(); +}; + +//================================================================== +//= OFormComponents +//================================================================== +typedef ::cppu::ImplHelper1< ::com::sun::star::form::XFormComponent> OFormComponents_BASE; +typedef ::cppu::OComponentHelper FormComponentsBase; + // else MSVC kills itself on some statements +class OFormComponents :public FormComponentsBase + ,public OInterfaceContainer + ,public OFormComponents_BASE +{ +protected: + ::osl::Mutex m_aMutex; + ::comphelper::InterfaceRef m_xParent; + +public: + OFormComponents(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); + OFormComponents( const OFormComponents& _cloneSource ); + virtual ~OFormComponents(); + + DECLARE_UNO3_AGG_DEFAULTS(OFormComponents, FormComponentsBase); + + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + +// OComponentHelper + virtual void SAL_CALL disposing(); + +// ::com::sun::star::form::XFormComponent + virtual ::comphelper::InterfaceRef SAL_CALL getParent() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setParent(const ::comphelper::InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + + // XEventListener + using OInterfaceContainer::disposing; +}; +//......................................................................... +} // namespace frm +//......................................................................... + +#endif // _FRM_INTERFACE_CONTAINER_HXX_ + diff --git a/forms/source/inc/cloneable.hxx b/forms/source/inc/cloneable.hxx new file mode 100644 index 000000000000..da3641d305bc --- /dev/null +++ b/forms/source/inc/cloneable.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FORMS_COMPONENT_CLONEABLE_HXX +#define FORMS_COMPONENT_CLONEABLE_HXX + +#include <com/sun/star/uno/XAggregation.hpp> + +//......................................................................... +namespace frm +{ +//......................................................................... + + //==================================================================== + //= OCloneableAggregation + //==================================================================== + class OCloneableAggregation + { + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> m_xAggregate; + + protected: + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > createAggregateClone( const OCloneableAggregation* _pOriginal ); + }; + +//......................................................................... +} // namespace frm +//......................................................................... + +#endif // FORMS_COMPONENT_CLONEABLE_HXX + diff --git a/forms/source/inc/commanddescriptionprovider.hxx b/forms/source/inc/commanddescriptionprovider.hxx new file mode 100644 index 000000000000..f5d4823af477 --- /dev/null +++ b/forms/source/inc/commanddescriptionprovider.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef COMMANDDESCRIPTIONPROVIDER_HXX +#define COMMANDDESCRIPTIONPROVIDER_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/frame/XModel.hpp> +/** === end UNO includes === **/ + +#include <comphelper/componentcontext.hxx> + +#include <boost/shared_ptr.hpp> + +//........................................................................ +namespace frm +{ +//........................................................................ + + //==================================================================== + //= ICommandDescriptionProvider + //==================================================================== + class SAL_NO_VTABLE ICommandDescriptionProvider + { + public: + virtual ::rtl::OUString getCommandDescription( const ::rtl::OUString& _rCommandURL ) const = 0; + + virtual ~ICommandDescriptionProvider() { } + }; + + typedef ::boost::shared_ptr< const ICommandDescriptionProvider > PCommandDescriptionProvider; + + //===================================================================== + //= factory + //===================================================================== + PCommandDescriptionProvider + createDocumentCommandDescriptionProvider( + const ::comphelper::ComponentContext& _rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument + ); + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // COMMANDDESCRIPTIONPROVIDER_HXX diff --git a/forms/source/inc/commandimageprovider.hxx b/forms/source/inc/commandimageprovider.hxx new file mode 100644 index 000000000000..d5d5b86a9b41 --- /dev/null +++ b/forms/source/inc/commandimageprovider.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef COMMANDIMAGEPROVIDER_HXX +#define COMMANDIMAGEPROVIDER_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/frame/XModel.hpp> +/** === end UNO includes === **/ + +#include <comphelper/componentcontext.hxx> +#include <vcl/image.hxx> + +#include <boost/shared_ptr.hpp> + +//........................................................................ +namespace frm +{ +//........................................................................ + + //===================================================================== + //= ICommandImageProvider + //===================================================================== + typedef ::rtl::OUString CommandURL; + typedef ::com::sun::star::uno::Sequence< CommandURL > CommandURLs; + typedef ::std::vector< Image > CommandImages; + + class SAL_NO_VTABLE ICommandImageProvider + { + public: + virtual CommandImages getCommandImages( + const CommandURLs& _rCommandURLs, + const bool _bLarge, + const bool _bHiContrast + ) const = 0; + + virtual ~ICommandImageProvider() { } + }; + + typedef ::boost::shared_ptr< const ICommandImageProvider > PCommandImageProvider; + + //===================================================================== + //= factory + //===================================================================== + PCommandImageProvider + createDocumentCommandImageProvider( + const ::comphelper::ComponentContext& _rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument + ); + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // COMMANDIMAGEPROVIDER_HXX diff --git a/forms/source/inc/componenttools.hxx b/forms/source/inc/componenttools.hxx new file mode 100644 index 000000000000..73771f19783a --- /dev/null +++ b/forms/source/inc/componenttools.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FORMS_SOURCE_INC_COMPONENTTOOLS_HXX +#define FORMS_SOURCE_INC_COMPONENTTOOLS_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/uno/Type.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/frame/XModel.hpp> +/** === end UNO includes === **/ + +#include <set> +#include <functional> + +//........................................................................ +namespace frm +{ +//........................................................................ + + struct TypeCompareLess : public ::std::binary_function< ::com::sun::star::uno::Type, ::com::sun::star::uno::Type, bool > + { + private: + typedef ::com::sun::star::uno::Type Type; + + public: + bool operator()( const Type& _rLHS, const Type& _rRHS ) + { + return _rLHS.getTypeName() < _rRHS.getTypeName(); + } + }; + + //==================================================================== + //= TypeBag + //==================================================================== + /** a helper class which merges sequences of <type scope="com::sun::star::uno">Type</type>s, + so that the resulting sequence contains every type at most once + */ + class TypeBag + { + public: + typedef ::com::sun::star::uno::Type Type; + typedef ::com::sun::star::uno::Sequence< Type > TypeSequence; + typedef ::std::set< Type, TypeCompareLess > TypeSet; + + private: + TypeSet m_aTypes; + + public: + TypeBag( + const TypeSequence& _rTypes1 + ); + + TypeBag( + const TypeSequence& _rTypes1, + const TypeSequence& _rTypes2 + ); + TypeBag( + const TypeSequence& _rTypes1, + const TypeSequence& _rTypes2, + const TypeSequence& _rTypes3 + ); + + void addTypes( const TypeSequence& _rTypes ); + + /** returns the types represented by this bag + */ + TypeSequence getTypes() const; + }; + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getXModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent ); + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_SOURCE_INC_COMPONENTTOOLS_HXX + diff --git a/forms/source/inc/controlfeatureinterception.hxx b/forms/source/inc/controlfeatureinterception.hxx new file mode 100644 index 000000000000..73f3b9d876c8 --- /dev/null +++ b/forms/source/inc/controlfeatureinterception.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FORMS_SOURCE_INC_CONTROLFEATUREINTERCEPTION_HXX +#define FORMS_SOURCE_INC_CONTROLFEATUREINTERCEPTION_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> +/** === end UNO includes === **/ + +#include <memory> + +//........................................................................ +namespace frm +{ +//........................................................................ + + class UrlTransformer; + //==================================================================== + //= ControlFeatureInterception + //==================================================================== + /** helper class for controls which allow some of their features to be intercepted + by external instances + + For using this class, instantiate it as member, derive yourself from + <type scope="com::sun::star::frame">XDispatchProviderInterception</type>, and forward all + respective methods to this member. + + Additionally, don't forget to call <member>dispose</member> when your class is disposed itself. + */ + class ControlFeatureInterception + { + private: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > + m_xFirstDispatchInterceptor; + ::std::auto_ptr< UrlTransformer > m_pUrlTransformer; + + public: + /** retrieves our URL transformer, so our clients may use it, too + */ + const UrlTransformer& getTransformer() const { return *m_pUrlTransformer; } + + public: + ControlFeatureInterception( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); + + // XDispatchProviderInterception + void SAL_CALL registerDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException ); + void SAL_CALL releaseDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException ); + + // XComponent + void SAL_CALL dispose(); + + /** queries the interceptor chain for the given dispatch + */ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > + queryDispatch( const ::com::sun::star::util::URL& _rURL, const ::rtl::OUString& _rTargetFrameName, ::sal_Int32 _nSearchFlags ) SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** queries the interceptor chain for the given dispatch, with a blank target frame and no frame search flags + */ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > + queryDispatch( const ::com::sun::star::util::URL& _rURL ) SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** queries the interceptor chain for the URL given as ASCII string, + with a blank target frame and no frame search flags + */ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > + queryDispatch( const sal_Char* _pAsciiURL ) SAL_THROW((::com::sun::star::uno::RuntimeException)); + }; + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_SOURCE_INC_CONTROLFEATUREINTERCEPTION_HXX + diff --git a/forms/source/inc/featuredispatcher.hxx b/forms/source/inc/featuredispatcher.hxx new file mode 100644 index 000000000000..eec111c00406 --- /dev/null +++ b/forms/source/inc/featuredispatcher.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FORMS_SOLAR_DISPATCHER_HXX +#define FORMS_SOLAR_DISPATCHER_HXX + +#include <rtl/ustring.hxx> + +//......................................................................... +namespace frm +{ +//......................................................................... + + //========================================================================= + //= IFeatureDispatcher + //========================================================================= + class IFeatureDispatcher + { + public: + /** dispatches a feature + + @param _nFeatureId + the id of the feature to dispatch + */ + virtual void dispatch( sal_Int16 _nFeatureId ) const = 0; + + /** dispatches a feature, with an additional named parameter + + @param _nFeatureId + the id of the feature to dispatch + + @param _pParamAsciiName + the Ascii name of the parameter of the dispatch call + + @param _rParamValue + the value of the parameter of the dispatch call + */ + virtual void dispatchWithArgument( + sal_Int16 _nFeatureId, + const sal_Char* _pParamName, + const ::com::sun::star::uno::Any& _rParamValue + ) const = 0; + + /** checks whether a given feature is enabled + */ + virtual bool isEnabled( sal_Int16 _nFeatureId ) const = 0; + + /** returns the boolean state of a feature + + Certain features may support more status information than only the enabled/disabled + state. The type of such additional information is fixed relative to a given feature, but + may differ between different features. + + This method allows retrieving status information about features which have an additional + boolean information associated with it. + */ + virtual bool getBooleanState( sal_Int16 _nFeatureId ) const = 0; + + /** returns the string state of a feature + + Certain features may support more status information than only the enabled/disabled + state. The type of such additional information is fixed relative to a given feature, but + may differ between different features. + + This method allows retrieving status information about features which have an additional + string information associated with it. + */ + virtual ::rtl::OUString getStringState( sal_Int16 _nFeatureId ) const = 0; + + /** returns the integer state of a feature + + Certain features may support more status information than only the enabled/disabled + state. The type of such additional information is fixed relative to a given feature, but + may differ between different features. + + This method allows retrieving status information about features which have an additional + integer information associated with it. + */ + virtual sal_Int32 getIntegerState( sal_Int16 _nFeatureId ) const = 0; + }; + +//......................................................................... +} // namespace frm +//......................................................................... + +#endif // FORMS_SOLAR_DISPATCHER_HXX diff --git a/forms/source/inc/formcontrolfont.hxx b/forms/source/inc/formcontrolfont.hxx new file mode 100644 index 000000000000..d14203046b7d --- /dev/null +++ b/forms/source/inc/formcontrolfont.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FORMS_SOURCE_COMPONENT_FORMCONTROLFONT_HXX +#define FORMS_SOURCE_COMPONENT_FORMCONTROLFONT_HXX + +#include <com/sun/star/io/XObjectOutputStream.hpp> +#include <com/sun/star/awt/FontDescriptor.hpp> +#include <com/sun/star/beans/Property.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> + +//......................................................................... +namespace frm +{ +//......................................................................... + + //===================================================================== + //= FontControlModel + //===================================================================== + class FontControlModel + { + private: + // <properties> + ::com::sun::star::awt::FontDescriptor m_aFont; + sal_Int16 m_nFontRelief; + sal_Int16 m_nFontEmphasis; + ::com::sun::star::uno::Any m_aTextLineColor; + ::com::sun::star::uno::Any m_aTextColor; + // </properties> + + bool m_bToolkitCompatibleDefaults; + + protected: + const ::com::sun::star::awt::FontDescriptor& getFont() const { return m_aFont; } + void setFont( const ::com::sun::star::awt::FontDescriptor& _rFont ) { m_aFont = _rFont; } + + void setTextColor( sal_Int32 _nColor ) { m_aTextColor <<= _nColor; } + void clearTextColor( ) { m_aTextColor.clear(); } + bool hasTextColor( ) const { return m_aTextColor.hasValue(); } + sal_Int32 getTextColor( ) const; + + void setTextLineColor( sal_Int32 _nColor ) { m_aTextLineColor <<= _nColor; } + void clearTextLineColor( ) { m_aTextLineColor.clear(); } + bool hasTextLineColor( ) const { return m_aTextLineColor.hasValue(); } + sal_Int32 getTextLineColor( ) const; + + protected: + FontControlModel( bool _bToolkitCompatibleDefaults ); + FontControlModel( const FontControlModel* _pOriginal ); + + protected: + bool isFontRelatedProperty( sal_Int32 _nPropertyHandle ) const; + bool isFontAggregateProperty( sal_Int32 _nPropertyHandle ) const; + + /// appends (!) the description of all font related properties to the given sequence + void describeFontRelatedProperties( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps ) const; + + void getFastPropertyValue ( ::com::sun::star::uno::Any& _rValue, sal_Int32 _nHandle ) const; + sal_Bool convertFastPropertyValue ( ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw( ::com::sun::star::lang::IllegalArgumentException ); + void setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw ( ::com::sun::star::uno::Exception ); + ::com::sun::star::uno::Any + getPropertyDefaultByHandle ( sal_Int32 _nHandle ) const; + + private: + + private: + FontControlModel(); // never implemented + FontControlModel( const FontControlModel& ); // never implemented + FontControlModel& operator=( const FontControlModel& ); // never implemented + }; + +//......................................................................... +} // namespace frm +//......................................................................... + +#endif // FORMS_SOURCE_COMPONENT_FORMCONTROLFONT_HXX diff --git a/forms/source/inc/formnavigation.hxx b/forms/source/inc/formnavigation.hxx new file mode 100644 index 000000000000..6dc848bd8abe --- /dev/null +++ b/forms/source/inc/formnavigation.hxx @@ -0,0 +1,235 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FORMS_FORM_NAVIGATION_HXX +#define FORMS_FORM_NAVIGATION_HXX + +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <cppuhelper/implbase2.hxx> +#include "featuredispatcher.hxx" +#include <vector> +#include <map> +#include <memory> + + +//......................................................................... +namespace frm +{ +//......................................................................... + + class UrlTransformer; + class ControlFeatureInterception; + + //================================================================== + //= OFormNavigationHelper + //================================================================== + typedef ::cppu::ImplHelper2 < ::com::sun::star::frame::XDispatchProviderInterception + , ::com::sun::star::frame::XStatusListener + > OFormNavigationHelper_Base; + + class OFormNavigationHelper + :public OFormNavigationHelper_Base + ,public IFeatureDispatcher + { + private: + struct FeatureInfo + { + ::com::sun::star::util::URL aURL; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatcher; + sal_Bool bCachedState; + ::com::sun::star::uno::Any aCachedAdditionalState; + + FeatureInfo() : bCachedState( sal_False ) { } + }; + typedef ::std::map< sal_Int16, FeatureInfo > FeatureMap; + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xORB; + ::std::auto_ptr< ControlFeatureInterception > + m_pFeatureInterception; + + // all supported features + FeatureMap m_aSupportedFeatures; + // all features which we have an external dispatcher for + sal_Int32 m_nConnectedFeatures; + + protected: + inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& + getORB( ) const { return m_xORB; } + + protected: + OFormNavigationHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); + virtual ~OFormNavigationHelper(); + + // XComponent + void SAL_CALL dispose( ) throw( ::com::sun::star::uno::RuntimeException ); + + // XDispatchProviderInterception + virtual void SAL_CALL registerDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL releaseDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& State ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + // IFeatureDispatcher + virtual void dispatch( sal_Int16 _nFeatureId ) const; + virtual void dispatchWithArgument( sal_Int16 _nFeatureId, const sal_Char* _pParamName, const ::com::sun::star::uno::Any& _rParamValue ) const; + virtual bool isEnabled( sal_Int16 _nFeatureId ) const; + virtual bool getBooleanState( sal_Int16 _nFeatureId ) const; + virtual ::rtl::OUString getStringState( sal_Int16 _nFeatureId ) const; + virtual sal_Int32 getIntegerState( sal_Int16 _nFeatureId ) const; + + // own overridables + /** is called when the interceptors have. + <p>The default implementations simply calls <member>updateDispatches</member>, + derived classes can prevent this in certain cases, or do additional handling.</p> + */ + virtual void interceptorsChanged( ); + + /** called when the status of a feature changed + + <p>The default implementation does nothing.</p> + + <p>If the feature in question does support more state information that just the + enabled/disabled state, then this additional information is to be retrieved in + a separate call.</p> + + @param _nFeatureId + the id of the feature + @param _bEnabled + determines if the features is enabled or disabled + @see getBooleanState + */ + virtual void featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled ); + + /** notification for (potential) changes in the state of all features + <p>The base class implementation does nothing. Derived classes could force + their peer to update it's state, depending on the result of calls to + <member>IFeatureDispatcher::isEnabled</member>.</p> + */ + virtual void allFeatureStatesChanged( ); + + /** retrieves the list of supported features + <p>To be overridden by derived classes</p> + @param _rFeatureIds + the array of features to support. Out parameter to fill by the derivee's implementation + @pure + */ + virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds ) = 0; + + protected: + /** update all our dispatches which are controlled by our dispatch interceptors + */ + void updateDispatches(); + + /** connect to the dispatch interceptors + */ + void connectDispatchers(); + + /** disconnect from the dispatch interceptors + */ + void disconnectDispatchers(); + + /** queries the interceptor chain for a dispatcher for the given URL + */ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > + queryDispatch( const ::com::sun::star::util::URL& _rURL ); + + /** invalidates the set of supported features + + <p>This will invalidate all structures which are tied to the set of supported + features. All dispatches will be disconnected.<br/> + No automatic re-connection to potential external dispatchers is done, instead, + you have to call updateDispatches explicitly, if necessary.</p> + */ + void invalidateSupportedFeaturesSet(); + + private: + /** initialize m_aSupportedFeatures, if necessary + */ + void initializeSupportedFeatures(); + }; + + //================================================================== + //= OFormNavigationMapper + //================================================================== + /** helper class mapping between feature ids and feature URLs + */ + class OFormNavigationMapper + { + private: + ::std::auto_ptr< UrlTransformer > m_pUrlTransformer; + + public: + OFormNavigationMapper( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB + ); + ~OFormNavigationMapper( ); + + /** retrieves the ASCII representation of a feature URL belonging to an id + + @complexity O(log n) + @return NULL if the given id is not a known feature id (which is a valid usage) + */ + const char* getFeatureURLAscii( sal_Int16 _nFeatureId ); + + /** retrieves the feature URL belonging to an feature id + + @complexity O(log n), with n being the number of all potentially known URLs + @return + <TRUE/> if and only if the given id is a known feature id + (which is a valid usage) + */ + bool getFeatureURL( sal_Int16 _nFeatureId, ::com::sun::star::util::URL& /* [out] */ _rURL ); + + /** retrieves the feature id belonging to an feature URL + + @complexity O(n), with n being the number of all potentially known URLs + @return + the id of the feature URL, or -1 if the URl is not known + (which is a valid usage) + */ + sal_Int16 getFeatureId( const ::rtl::OUString& _rCompleteURL ); + + private: + OFormNavigationMapper( ); // never implemented + OFormNavigationMapper( const OFormNavigationMapper& ); // never implemented + OFormNavigationMapper& operator=( const OFormNavigationMapper& ); // never implemented + }; + +//......................................................................... +} // namespace frm +//......................................................................... + +#endif // FORMS_FORM_NAVIGATION_HXX diff --git a/forms/source/inc/forms_module.hxx b/forms/source/inc/forms_module.hxx new file mode 100644 index 000000000000..6655fb750e8d --- /dev/null +++ b/forms/source/inc/forms_module.hxx @@ -0,0 +1,332 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FORMS_MODULE_INCLUDE_CONTEXT + #error "not to be included directly! use 'foo_module.hxx instead'!" +#endif + +#ifndef FORMS_MODULE_NAMESPACE + #error "set FORMS_MODULE_NAMESPACE to your namespace identifier!" +#endif + +#include <osl/mutex.hxx> +#include <tools/resid.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <cppuhelper/factory.hxx> +#include <rtl/string.hxx> + +//......................................................................... +namespace FORMS_MODULE_NAMESPACE +{ +//......................................................................... + + typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > (SAL_CALL *FactoryInstantiation) + ( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rServiceManager, + const ::rtl::OUString & _rComponentName, + ::cppu::ComponentInstantiation _pCreateFunction, + const ::com::sun::star::uno::Sequence< ::rtl::OUString > & _rServiceNames, + rtl_ModuleCount* _pModuleCounter + ); + + //========================================================================= + //= OFormsModule + //========================================================================= + class OFormsModule + { + private: + OFormsModule(); + // not implemented. OFormsModule is a static class + + protected: + // auto registration administration + static ::com::sun::star::uno::Sequence< ::rtl::OUString >* + s_pImplementationNames; + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >* + s_pSupportedServices; + static ::com::sun::star::uno::Sequence< sal_Int64 >* + s_pCreationFunctionPointers; + static ::com::sun::star::uno::Sequence< sal_Int64 >* + s_pFactoryFunctionPointers; + + public: + /** register a component implementing a service with the given data. + @param _rImplementationName + the implementation name of the component + @param _rServiceNames + the services the component supports + @param _pCreateFunction + a function for creating an instance of the component + @param _pFactoryFunction + a function for creating a factory for that component + @see revokeComponent + */ + static void registerComponent( + const ::rtl::OUString& _rImplementationName, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rServiceNames, + ::cppu::ComponentInstantiation _pCreateFunction, + FactoryInstantiation _pFactoryFunction); + + /** revoke the registration for the specified component + @param _rImplementationName + the implementation name of the component + */ + static void revokeComponent( + const ::rtl::OUString& _rImplementationName); + + /** write the registration information of all known components + <p>writes the registration information of all components which are currently registered into the + specified registry.<p/> + <p>Usually used from within component_writeInfo.<p/> + @param _rxServiceManager + the service manager + @param _rRootKey + the registry key under which the information will be stored + @return + sal_True if the registration of all implementations was successfull, sal_False otherwise + */ + static sal_Bool writeComponentInfos( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceManager, + const ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey >& _rRootKey); + + /** creates a Factory for the component with the given implementation name. + <p>Usually used from within component_getFactory.<p/> + @param _rxServiceManager + a pointer to an XMultiServiceFactory interface as got in component_getFactory + @param _pImplementationName + the implementation name of the component + @return + the XInterface access to a factory for the component + */ + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getComponentFactory( + const ::rtl::OUString& _rImplementationName, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceManager + ); + + private: + /** ensure that the impl class exists + @precond m_aMutex is guarded when this method gets called + */ + static void ensureImpl(); + }; + + //========================================================================== + //= OMultiInstanceAutoRegistration + //========================================================================== + template <class TYPE> + class OMultiInstanceAutoRegistration + { + public: + /** automatically registeres a multi instance component + <p>Assumed that the template argument has the three methods + <ul> + <li><code>static ::rtl::OUString getImplementationName_Static()</code><li/> + <li><code>static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static()</code><li/> + <li><code>static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)</code> + </li> + <ul/> + the instantiation of this object will automatically register the class via <method>OFormsModule::registerComponent</method>. + <p/> + <p>The factory creation function used is <code>::cppu::createSingleFactory</code>.</p> + + @see OOneInstanceAutoRegistration + */ + OMultiInstanceAutoRegistration(); + ~OMultiInstanceAutoRegistration(); + }; + + template <class TYPE> + OMultiInstanceAutoRegistration<TYPE>::OMultiInstanceAutoRegistration() + { + OFormsModule::registerComponent( + TYPE::getImplementationName_Static(), + TYPE::getSupportedServiceNames_Static(), + TYPE::Create, + ::cppu::createSingleFactory + ); + } + + template <class TYPE> + OMultiInstanceAutoRegistration<TYPE>::~OMultiInstanceAutoRegistration() + { + OFormsModule::revokeComponent(TYPE::getImplementationName_Static()); + } + + //========================================================================== + //= OOneInstanceAutoRegistration + //========================================================================== + template <class TYPE> + class OOneInstanceAutoRegistration + { + public: + /** automatically registeres a single instance component + <p>Assumed that the template argument has the three methods + <ul> + <li><code>static ::rtl::OUString getImplementationName_Static()</code><li/> + <li><code>static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static()</code><li/> + <li><code>static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)</code> + </li> + <ul/> + the instantiation of this object will automatically register the class via <method>OFormsModule::registerComponent</method>. + <p/> + The factory creation function used is <code>::cppu::createOneInstanceFactory</code>. + @see OOneInstanceAutoRegistration + */ + OOneInstanceAutoRegistration(); + ~OOneInstanceAutoRegistration(); + }; + + template <class TYPE> + OOneInstanceAutoRegistration<TYPE>::OOneInstanceAutoRegistration() + { + OFormsModule::registerComponent( + TYPE::getImplementationName_Static(), + TYPE::getSupportedServiceNames_Static(), + TYPE::Create, + ::cppu::createOneInstanceFactory + ); + } + + template <class TYPE> + OOneInstanceAutoRegistration<TYPE>::~OOneInstanceAutoRegistration() + { + OFormsModule::revokeComponent(TYPE::getImplementationName_Static()); + } + + //========================================================================== + //= helper for classes implementing the service handling via + //= OMultiInstanceAutoRegistration or OOneInstanceAutoRegistration + //========================================================================== + #define DECLARE_SERVICE_REGISTRATION( classname ) \ + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); \ + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); \ + \ + static ::rtl::OUString SAL_CALL getImplementationName_Static(); \ + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(); \ + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); \ + \ + friend class OOneInstanceAutoRegistration< classname >; \ + friend class OMultiInstanceAutoRegistration< classname >; \ + + #define IMPLEMENT_SERVICE_REGISTRATION_BASE( classname, baseclass ) \ + \ + ::rtl::OUString SAL_CALL classname::getImplementationName( ) throw ( RuntimeException ) \ + { return getImplementationName_Static(); } \ + \ + Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames( ) throw (RuntimeException) \ + { \ + return ::comphelper::concatSequences( \ + getAggregateServiceNames(), \ + getSupportedServiceNames_Static() \ + ); \ + } \ + \ + ::rtl::OUString SAL_CALL classname::getImplementationName_Static() \ + { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.forms."#classname ) ); } \ + \ + Reference< XInterface > SAL_CALL classname::Create( const Reference< XMultiServiceFactory >& _rxFactory ) \ + { return static_cast< XServiceInfo* >( new classname( _rxFactory ) ); } \ + \ + + #define IMPLEMENT_SERVICE_REGISTRATION_1( classname, baseclass, service1 ) \ + IMPLEMENT_SERVICE_REGISTRATION_BASE( classname, baseclass ) \ + \ + Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames_Static() \ + { \ + Sequence< ::rtl::OUString > aOwnNames( 1 ); \ + aOwnNames[ 0 ] = service1; \ + \ + return ::comphelper::concatSequences( \ + baseclass::getSupportedServiceNames_Static(), \ + aOwnNames \ + ); \ + } \ + + #define IMPLEMENT_SERVICE_REGISTRATION_2( classname, baseclass, service1, service2 ) \ + IMPLEMENT_SERVICE_REGISTRATION_BASE( classname, baseclass ) \ + \ + Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames_Static() \ + { \ + Sequence< ::rtl::OUString > aOwnNames( 2 ); \ + aOwnNames[ 0 ] = service1; \ + aOwnNames[ 1 ] = service2; \ + \ + return ::comphelper::concatSequences( \ + baseclass::getSupportedServiceNames_Static(), \ + aOwnNames \ + ); \ + } \ + + #define IMPLEMENT_SERVICE_REGISTRATION_7( classname, baseclass, service1, service2, service3, service4 , service5, service6, service7 ) \ + IMPLEMENT_SERVICE_REGISTRATION_BASE( classname, baseclass ) \ + \ + Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames_Static() \ + { \ + Sequence< ::rtl::OUString > aOwnNames( 7 ); \ + aOwnNames[ 0 ] = service1; \ + aOwnNames[ 1 ] = service2; \ + aOwnNames[ 2 ] = service3; \ + aOwnNames[ 3 ] = service4; \ + aOwnNames[ 4 ] = service5; \ + aOwnNames[ 5 ] = service6; \ + aOwnNames[ 6 ] = service7; \ + \ + return ::comphelper::concatSequences( \ + baseclass::getSupportedServiceNames_Static(), \ + aOwnNames \ + ); \ + } \ + + #define IMPLEMENT_SERVICE_REGISTRATION_8( classname, baseclass, service1, service2, service3, service4 , service5, service6, service7, service8 ) \ + IMPLEMENT_SERVICE_REGISTRATION_BASE( classname, baseclass ) \ + \ + Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames_Static() \ + { \ + Sequence< ::rtl::OUString > aOwnNames( 8 ); \ + aOwnNames[ 0 ] = service1; \ + aOwnNames[ 1 ] = service2; \ + aOwnNames[ 2 ] = service3; \ + aOwnNames[ 3 ] = service4; \ + aOwnNames[ 4 ] = service5; \ + aOwnNames[ 5 ] = service6; \ + aOwnNames[ 6 ] = service7; \ + aOwnNames[ 6 ] = service8; \ + \ + return ::comphelper::concatSequences( \ + baseclass::getSupportedServiceNames_Static(), \ + aOwnNames \ + ); \ + } \ + +//......................................................................... +} // namespace FORMS_MODULE_NAMESPACE +//......................................................................... diff --git a/forms/source/inc/forms_module_impl.hxx b/forms/source/inc/forms_module_impl.hxx new file mode 100644 index 000000000000..a2c0e50e55e7 --- /dev/null +++ b/forms/source/inc/forms_module_impl.hxx @@ -0,0 +1,209 @@ +#ifndef FORMS_MODULE_IMPLEMENTATION_INCLUDE_CONTEXT + #error "not to be included directly! use 'foo_module.hxx instead'!" +#endif + +#ifndef FORMS_MODULE_NAMESPACE + #error "set FORMS_MODULE_NAMESPACE to your namespace identifier!" +#endif + +#include <comphelper/sequence.hxx> + +//......................................................................... +namespace FORMS_MODULE_NAMESPACE +{ +//......................................................................... + + using namespace ::com::sun::star::uno; + using namespace ::com::sun::star::lang; + using namespace ::com::sun::star::registry; + using namespace ::comphelper; + using namespace ::cppu; + + //========================================================================= + //= OFormsModule + //========================================================================= + + //-------------------------------------------------------------------------- + //- registration helper + //-------------------------------------------------------------------------- + + Sequence< ::rtl::OUString >* OFormsModule::s_pImplementationNames = NULL; + Sequence< Sequence< ::rtl::OUString > >* OFormsModule::s_pSupportedServices = NULL; + Sequence< sal_Int64 >* OFormsModule::s_pCreationFunctionPointers = NULL; + Sequence< sal_Int64 >* OFormsModule::s_pFactoryFunctionPointers = NULL; + + //-------------------------------------------------------------------------- + void OFormsModule::registerComponent( + const ::rtl::OUString& _rImplementationName, + const Sequence< ::rtl::OUString >& _rServiceNames, + ComponentInstantiation _pCreateFunction, + FactoryInstantiation _pFactoryFunction) + { + if (!s_pImplementationNames) + { + OSL_ENSURE(!s_pSupportedServices && !s_pCreationFunctionPointers && !s_pFactoryFunctionPointers, + "OFormsModule::registerComponent : inconsistent state (the pointers (1)) !"); + s_pImplementationNames = new Sequence< ::rtl::OUString >; + s_pSupportedServices = new Sequence< Sequence< ::rtl::OUString > >; + s_pCreationFunctionPointers = new Sequence< sal_Int64 >; + s_pFactoryFunctionPointers = new Sequence< sal_Int64 >; + } + OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, + "OFormsModule::registerComponent : inconsistent state (the pointers (2)) !"); + + OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) + && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) + && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), + "OFormsModule::registerComponent : inconsistent state !"); + + sal_Int32 nOldLen = s_pImplementationNames->getLength(); + s_pImplementationNames->realloc(nOldLen + 1); + s_pSupportedServices->realloc(nOldLen + 1); + s_pCreationFunctionPointers->realloc(nOldLen + 1); + s_pFactoryFunctionPointers->realloc(nOldLen + 1); + + s_pImplementationNames->getArray()[nOldLen] = _rImplementationName; + s_pSupportedServices->getArray()[nOldLen] = _rServiceNames; + s_pCreationFunctionPointers->getArray()[nOldLen] = reinterpret_cast<sal_Int64>(_pCreateFunction); + s_pFactoryFunctionPointers->getArray()[nOldLen] = reinterpret_cast<sal_Int64>(_pFactoryFunction); + } + + //-------------------------------------------------------------------------- + void OFormsModule::revokeComponent(const ::rtl::OUString& _rImplementationName) + { + if (!s_pImplementationNames) + { + OSL_ASSERT("OFormsModule::revokeComponent : have no class infos ! Are you sure called this method at the right time ?"); + return; + } + OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, + "OFormsModule::revokeComponent : inconsistent state (the pointers) !"); + OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) + && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) + && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), + "OFormsModule::revokeComponent : inconsistent state !"); + + sal_Int32 nLen = s_pImplementationNames->getLength(); + const ::rtl::OUString* pImplNames = s_pImplementationNames->getConstArray(); + for (sal_Int32 i=0; i<nLen; ++i, ++pImplNames) + { + if (pImplNames->equals(_rImplementationName)) + { + removeElementAt(*s_pImplementationNames, i); + removeElementAt(*s_pSupportedServices, i); + removeElementAt(*s_pCreationFunctionPointers, i); + removeElementAt(*s_pFactoryFunctionPointers, i); + break; + } + } + + if (s_pImplementationNames->getLength() == 0) + { + delete s_pImplementationNames; s_pImplementationNames = NULL; + delete s_pSupportedServices; s_pSupportedServices = NULL; + delete s_pCreationFunctionPointers; s_pCreationFunctionPointers = NULL; + delete s_pFactoryFunctionPointers; s_pFactoryFunctionPointers = NULL; + } + } + + //-------------------------------------------------------------------------- + sal_Bool OFormsModule::writeComponentInfos( + const Reference< XMultiServiceFactory >& /*_rxServiceManager*/, + const Reference< XRegistryKey >& _rxRootKey) + { + OSL_ENSURE(_rxRootKey.is(), "OFormsModule::writeComponentInfos : invalid argument !"); + + if (!s_pImplementationNames) + { + OSL_ASSERT("OFormsModule::writeComponentInfos : have no class infos ! Are you sure called this method at the right time ?"); + return sal_True; + } + OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, + "OFormsModule::writeComponentInfos : inconsistent state (the pointers) !"); + OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) + && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) + && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), + "OFormsModule::writeComponentInfos : inconsistent state !"); + + sal_Int32 nLen = s_pImplementationNames->getLength(); + const ::rtl::OUString* pImplName = s_pImplementationNames->getConstArray(); + const Sequence< ::rtl::OUString >* pServices = s_pSupportedServices->getConstArray(); + + ::rtl::OUString sRootKey("/", 1, RTL_TEXTENCODING_ASCII_US); + for (sal_Int32 i=0; i<nLen; ++i, ++pImplName, ++pServices) + { + ::rtl::OUString aMainKeyName(sRootKey); + aMainKeyName += *pImplName; + aMainKeyName += ::rtl::OUString::createFromAscii("/UNO/SERVICES"); + + try + { + Reference< XRegistryKey > xNewKey( _rxRootKey->createKey(aMainKeyName) ); + + const ::rtl::OUString* pService = pServices->getConstArray(); + for (sal_Int32 j=0; j<pServices->getLength(); ++j, ++pService) + xNewKey->createKey(*pService); + } + catch(Exception&) + { + OSL_ASSERT("OFormsModule::writeComponentInfos : something went wrong while creating the keys !"); + return sal_False; + } + } + + return sal_True; + } + + //-------------------------------------------------------------------------- + Reference< XInterface > OFormsModule::getComponentFactory( + const ::rtl::OUString& _rImplementationName, + const Reference< XMultiServiceFactory >& _rxServiceManager) + { + OSL_ENSURE(_rxServiceManager.is(), "OFormsModule::getComponentFactory : invalid argument (service manager) !"); + OSL_ENSURE(_rImplementationName.getLength(), "OFormsModule::getComponentFactory : invalid argument (implementation name) !"); + + if (!s_pImplementationNames) + { + OSL_ASSERT("OFormsModule::getComponentFactory : have no class infos ! Are you sure called this method at the right time ?"); + return NULL; + } + OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, + "OFormsModule::getComponentFactory : inconsistent state (the pointers) !"); + OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) + && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) + && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), + "OFormsModule::getComponentFactory : inconsistent state !"); + + + Reference< XInterface > xReturn; + + + sal_Int32 nLen = s_pImplementationNames->getLength(); + const ::rtl::OUString* pImplName = s_pImplementationNames->getConstArray(); + const Sequence< ::rtl::OUString >* pServices = s_pSupportedServices->getConstArray(); + const sal_Int64* pComponentFunction = s_pCreationFunctionPointers->getConstArray(); + const sal_Int64* pFactoryFunction = s_pFactoryFunctionPointers->getConstArray(); + + for (sal_Int32 i=0; i<nLen; ++i, ++pImplName, ++pServices, ++pComponentFunction, ++pFactoryFunction) + { + if (pImplName->equals(_rImplementationName)) + { + const FactoryInstantiation FactoryInstantiationFunction = reinterpret_cast<const FactoryInstantiation>(*pFactoryFunction); + const ComponentInstantiation ComponentInstantiationFunction = reinterpret_cast<const ComponentInstantiation>(*pComponentFunction); + + xReturn = FactoryInstantiationFunction( _rxServiceManager, *pImplName, ComponentInstantiationFunction, *pServices, NULL); + if (xReturn.is()) + { + xReturn->acquire(); + return xReturn.get(); + } + } + } + + return NULL; + } + +//......................................................................... +} // namespace FORMS_MODULE_NAMESPACE +//......................................................................... + diff --git a/forms/source/inc/frm_module.hxx b/forms/source/inc/frm_module.hxx new file mode 100644 index 000000000000..33d17d863d63 --- /dev/null +++ b/forms/source/inc/frm_module.hxx @@ -0,0 +1,37 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FRM_MODULE_HXX +#define FRM_MODULE_HXX + +#define FORMS_MODULE_INCLUDE_CONTEXT + #define FORMS_MODULE_NAMESPACE frm + #include "forms_module.hxx" +#undef FORMS_MODULE_INCLUDE_CONTEXT + +#endif // FRM_MODULE_HXX + diff --git a/forms/source/inc/frm_resource.hrc b/forms/source/inc/frm_resource.hrc new file mode 100644 index 000000000000..a35707cb1708 --- /dev/null +++ b/forms/source/inc/frm_resource.hrc @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FRM_RESOURCE_HRC_ +#define _FRM_RESOURCE_HRC_ + +#ifndef _SOLAR_HRC +#include <svl/solar.hrc> +#endif + +//------------------------------------------------------------------------------ +#define RID_FRM_STRINGS_START RID_FORMLAYER_START + + + +//------------------------------------------------------------------------------ +//- String-IDs +#define RID_BASELISTBOX_ERROR_FILLLIST ( RID_FRM_STRINGS_START + 0 ) +#define RID_STR_IMPORT_GRAPHIC ( RID_FRM_STRINGS_START + 1 ) +#define RID_STR_CONTROL_SUBSTITUTED_NAME ( RID_FRM_STRINGS_START + 2 ) +#define RID_STR_CONTROL_SUBSTITUTED_EPXPLAIN ( RID_FRM_STRINGS_START + 3 ) +#define RID_STR_READERROR ( RID_FRM_STRINGS_START + 4 ) +#define RID_STR_CONNECTERROR ( RID_FRM_STRINGS_START + 5 ) +#define RID_ERR_LOADING_FORM ( RID_FRM_STRINGS_START + 6 ) +#define RID_ERR_REFRESHING_FORM ( RID_FRM_STRINGS_START + 7 ) +#define RID_STR_ERR_INSERTRECORD ( RID_FRM_STRINGS_START + 8 ) +#define RID_STR_ERR_UPDATERECORD ( RID_FRM_STRINGS_START + 9 ) +#define RID_STR_ERR_DELETERECORD ( RID_FRM_STRINGS_START + 10 ) +#define RID_STR_ERR_DELETERECORDS ( RID_FRM_STRINGS_START + 11 ) +#define RID_STR_NEED_NON_NULL_OBJECT ( RID_FRM_STRINGS_START + 12 ) +#define RID_STR_OPEN_GRAPHICS ( RID_FRM_STRINGS_START + 13 ) +#define RID_STR_CLEAR_GRAPHICS ( RID_FRM_STRINGS_START + 14 ) +#define RID_STR_INVALIDSTREAM ( RID_FRM_STRINGS_START + 15 ) +#define RID_STR_SYNTAXERROR ( RID_FRM_STRINGS_START + 16 ) +#define RID_STR_INCOMPATIBLE_TYPES ( RID_FRM_STRINGS_START + 17 ) +#define RID_STR_INVALID_VALIDATOR ( RID_FRM_STRINGS_START + 18 ) +#define RID_STR_LABEL_RECORD ( RID_FRM_STRINGS_START + 19 ) +#define RID_STR_LABEL_OF ( RID_FRM_STRINGS_START + 20 ) + +#define RID_STR_XFORMS_NO_BINDING_EXPRESSION ( RID_FRM_STRINGS_START + 21 ) +#define RID_STR_XFORMS_INVALID_BINDING_EXPRESSION (RID_FRM_STRINGS_START + 22) +#define RID_STR_XFORMS_INVALID_VALUE ( RID_FRM_STRINGS_START + 23 ) +#define RID_STR_XFORMS_REQUIRED ( RID_FRM_STRINGS_START + 24 ) +#define RID_STR_XFORMS_INVALID_CONSTRAINT ( RID_FRM_STRINGS_START + 25 ) +#define RID_STR_XFORMS_VALUE_IS_NOT_A ( RID_FRM_STRINGS_START + 26 ) +#define RID_STR_XFORMS_VALUE_MAX_INCL ( RID_FRM_STRINGS_START + 27 ) +#define RID_STR_XFORMS_VALUE_MAX_EXCL ( RID_FRM_STRINGS_START + 28 ) +#define RID_STR_XFORMS_VALUE_MIN_INCL ( RID_FRM_STRINGS_START + 29 ) +#define RID_STR_XFORMS_VALUE_MIN_EXCL ( RID_FRM_STRINGS_START + 30 ) +#define RID_STR_XFORMS_VALUE_PATTERN ( RID_FRM_STRINGS_START + 31 ) +#define RID_STR_XFORMS_VALUE_TOTAL_DIGITS ( RID_FRM_STRINGS_START + 32 ) +#define RID_STR_XFORMS_VALUE_FRACTION_DIGITS ( RID_FRM_STRINGS_START + 33 ) +#define RID_STR_XFORMS_VALUE_LENGTH ( RID_FRM_STRINGS_START + 34 ) +#define RID_STR_XFORMS_VALUE_MIN_LENGTH ( RID_FRM_STRINGS_START + 35 ) +#define RID_STR_XFORMS_VALUE_MAX_LENGTH ( RID_FRM_STRINGS_START + 36 ) + +#define RID_STR_DATATYPE_STRING ( RID_FRM_STRINGS_START + 37 ) +#define RID_STR_DATATYPE_URL ( RID_FRM_STRINGS_START + 38 ) +#define RID_STR_DATATYPE_BOOLEAN ( RID_FRM_STRINGS_START + 39 ) +#define RID_STR_DATATYPE_DECIMAL ( RID_FRM_STRINGS_START + 40 ) +#define RID_STR_DATATYPE_FLOAT ( RID_FRM_STRINGS_START + 41 ) +#define RID_STR_DATATYPE_DOUBLE ( RID_FRM_STRINGS_START + 42 ) +#define RID_STR_DATATYPE_DATE ( RID_FRM_STRINGS_START + 43 ) +#define RID_STR_DATATYPE_TIME ( RID_FRM_STRINGS_START + 44 ) +#define RID_STR_DATATYPE_DATETIME ( RID_FRM_STRINGS_START + 45 ) +#define RID_STR_DATATYPE_YEARMONTH ( RID_FRM_STRINGS_START + 46 ) +#define RID_STR_DATATYPE_YEAR ( RID_FRM_STRINGS_START + 47 ) +#define RID_STR_DATATYPE_MONTHDAY ( RID_FRM_STRINGS_START + 48 ) +#define RID_STR_DATATYPE_MONTH ( RID_FRM_STRINGS_START + 49 ) +#define RID_STR_DATATYPE_DAY ( RID_FRM_STRINGS_START + 50 ) + +#define RID_STR_XFORMS_CANT_EVALUATE ( RID_FRM_STRINGS_START + 51 ) +#define RID_STR_XFORMS_PATTERN_DOESNT_MATCH ( RID_FRM_STRINGS_START + 52 ) +#define RID_STR_XFORMS_BINDING_UI_NAME ( RID_FRM_STRINGS_START + 53 ) + +#define RID_STR_QUERY_SAVE_MODIFIED_ROW ( RID_FRM_STRINGS_START + 54 ) +#define RID_STR_COULD_NOT_SET_ORDER ( RID_FRM_STRINGS_START + 55 ) +#define RID_STR_COULD_NOT_SET_FILTER ( RID_FRM_STRINGS_START + 56 ) +#define RID_STR_FEATURE_REQUIRES_PARAMETERS ( RID_FRM_STRINGS_START + 57 ) +#define RID_STR_FEATURE_NOT_EXECUTABLE ( RID_FRM_STRINGS_START + 58 ) +#define RID_STR_FEATURE_UNKNOWN ( RID_FRM_STRINGS_START + 59 ) + +#endif // _FRM_RESOURCE_HRC_ + diff --git a/forms/source/inc/frm_resource.hxx b/forms/source/inc/frm_resource.hxx new file mode 100644 index 000000000000..33349e6ad620 --- /dev/null +++ b/forms/source/inc/frm_resource.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FRM_RESOURCE_HXX_ +#define _FRM_RESOURCE_HXX_ + +#include <rtl/ustring.hxx> + +class SimpleResMgr; +//......................................................................... +namespace frm +{ + +#define FRM_RES_STRING(id) ResourceManager::loadString(id) + + //================================================================== + //= ResourceManager + //= handling ressources within the FormLayer library + //================================================================== + class ResourceManager + { + static SimpleResMgr* m_pImpl; + + private: + // no instantiation allowed + ResourceManager() { } + ~ResourceManager() { } + + // we'll instantiate one static member of the following class, which, in it's dtor, + // ensures that m_pImpl will be deleted + class EnsureDelete + { + public: + EnsureDelete() { } + ~EnsureDelete(); + }; + friend class EnsureDelete; + + protected: + static void ensureImplExists(); + + public: + /** loads the string with the specified resource id from the FormLayer resource file + */ + static ::rtl::OUString loadString(sal_uInt16 _nResId); + }; + +//......................................................................... +} +//......................................................................... + +#endif // _FRM_RESOURCE_HXX_ + diff --git a/forms/source/inc/frm_strings.hxx b/forms/source/inc/frm_strings.hxx new file mode 100644 index 000000000000..8a8105d2e1a7 --- /dev/null +++ b/forms/source/inc/frm_strings.hxx @@ -0,0 +1,360 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FRM_STRINGS_HXX +#define FRM_STRINGS_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> + +//.............................................................................. +namespace frm +{ +//.............................................................................. + + struct ConstAsciiString + { + const sal_Char* ascii; + sal_Int32 length; + + inline operator ::rtl::OUString () const; + inline operator const sal_Char* () const { return ascii; } + + inline ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength); + inline ~ConstAsciiString(); + + private: + mutable ::rtl::OUString* ustring; + }; + + //------------------------------------------------------------ + inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength) + :ascii(_pAsciiZeroTerminated) + ,length(_nLength) + ,ustring(NULL) + { + } + + //------------------------------------------------------------ + inline ConstAsciiString::~ConstAsciiString() + { + delete ustring; + ustring = NULL; + } + + //------------------------------------------------------------ + inline ConstAsciiString::operator ::rtl::OUString () const + { + if ( !ustring ) + ustring = new ::rtl::OUString( ascii, length, RTL_TEXTENCODING_ASCII_US ); + return *ustring; + } + + #ifndef FORMS_IMPLEMENT_STRINGS + #define FORMS_CONSTASCII_STRING( ident, string ) \ + extern const ConstAsciiString ident + #else + #define FORMS_CONSTASCII_STRING( ident, string ) \ + extern const ConstAsciiString ident( string, sizeof( string )-1 ) + #endif + +//.............................................................................. +} // namespace frm +//.............................................................................. + +//.............................................................................. +namespace frm +{ +//.............................................................................. + + //-------------------------------------------------------------------------- + //- properties + //-------------------------------------------------------------------------- + FORMS_CONSTASCII_STRING( PROPERTY_TABINDEX, "TabIndex" ); + FORMS_CONSTASCII_STRING( PROPERTY_TAG, "Tag" ); + FORMS_CONSTASCII_STRING( PROPERTY_NAME, "Name" ); + FORMS_CONSTASCII_STRING( PROPERTY_CLASSID, "ClassId" ); + FORMS_CONSTASCII_STRING( PROPERTY_FETCHSIZE, "FetchSize" ); + FORMS_CONSTASCII_STRING( PROPERTY_VALUE, "Value" ); + FORMS_CONSTASCII_STRING( PROPERTY_TEXT, "Text" ); + FORMS_CONSTASCII_STRING( PROPERTY_LABEL, "Label" ); + FORMS_CONSTASCII_STRING( PROPERTY_CANINSERT, "CanInsert" ); + FORMS_CONSTASCII_STRING( PROPERTY_CANUPDATE, "CanUpdate" ); + FORMS_CONSTASCII_STRING( PROPERTY_CANDELETE, "CanDelete" ); + FORMS_CONSTASCII_STRING( PROPERTY_NAVIGATION, "NavigationBarMode" ); + FORMS_CONSTASCII_STRING( PROPERTY_HASNAVIGATION, "HasNavigationBar" ); + FORMS_CONSTASCII_STRING( PROPERTY_CYCLE, "Cycle" ); + FORMS_CONSTASCII_STRING( PROPERTY_CONTROLSOURCE, "DataField" ); + FORMS_CONSTASCII_STRING( PROPERTY_ENABLED, "Enabled" ); + FORMS_CONSTASCII_STRING( PROPERTY_ENABLEVISIBLE, "EnableVisible" ); + FORMS_CONSTASCII_STRING( PROPERTY_READONLY, "ReadOnly" ); + FORMS_CONSTASCII_STRING( PROPERTY_RELEVANT, "Relevant" ); + FORMS_CONSTASCII_STRING( PROPERTY_ISREADONLY, "IsReadOnly" ); + FORMS_CONSTASCII_STRING( PROPERTY_FILTER, "Filter" ); + FORMS_CONSTASCII_STRING( PROPERTY_WIDTH, "Width" ); + FORMS_CONSTASCII_STRING( PROPERTY_SEARCHABLE, "IsSearchable" ); + FORMS_CONSTASCII_STRING( PROPERTY_MULTILINE, "MultiLine" ); + FORMS_CONSTASCII_STRING( PROPERTY_TARGET_URL, "TargetURL" ); + FORMS_CONSTASCII_STRING( PROPERTY_TARGET_FRAME, "TargetFrame" ); + FORMS_CONSTASCII_STRING( PROPERTY_DEFAULTCONTROL, "DefaultControl" ); + FORMS_CONSTASCII_STRING( PROPERTY_MAXTEXTLEN, "MaxTextLen" ); + FORMS_CONSTASCII_STRING( PROPERTY_EDITMASK, "EditMask" ); + FORMS_CONSTASCII_STRING( PROPERTY_SIZE, "Size" ); + FORMS_CONSTASCII_STRING( PROPERTY_SPIN, "Spin" ); + FORMS_CONSTASCII_STRING( PROPERTY_DATE, "Date" ); + FORMS_CONSTASCII_STRING( PROPERTY_TIME, "Time" ); + FORMS_CONSTASCII_STRING( PROPERTY_STATE, "State" ); + FORMS_CONSTASCII_STRING( PROPERTY_TRISTATE, "TriState" ); + FORMS_CONSTASCII_STRING( PROPERTY_HIDDEN_VALUE, "HiddenValue" ); + FORMS_CONSTASCII_STRING( PROPERTY_BUTTONTYPE, "ButtonType" ); + FORMS_CONSTASCII_STRING( PROPERTY_STRINGITEMLIST, "StringItemList" ); + FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_TEXT, "DefaultText" ); + FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_STATE, "DefaultState" ); + FORMS_CONSTASCII_STRING( PROPERTY_FORMATKEY, "FormatKey" ); + FORMS_CONSTASCII_STRING( PROPERTY_FORMATSSUPPLIER, "FormatsSupplier" ); + FORMS_CONSTASCII_STRING( PROPERTY_SUBMIT_ACTION, "SubmitAction" ); + FORMS_CONSTASCII_STRING( PROPERTY_SUBMIT_TARGET, "SubmitTarget" ); + FORMS_CONSTASCII_STRING( PROPERTY_SUBMIT_METHOD, "SubmitMethod" ); + FORMS_CONSTASCII_STRING( PROPERTY_SUBMIT_ENCODING, "SubmitEncoding" ); + FORMS_CONSTASCII_STRING( PROPERTY_IMAGE_URL, "ImageURL" ); + FORMS_CONSTASCII_STRING( PROPERTY_IMAGE_POSITION, "ImagePosition" ); + FORMS_CONSTASCII_STRING( PROPERTY_EMPTY_IS_NULL, "ConvertEmptyToNull" ); + FORMS_CONSTASCII_STRING( PROPERTY_LISTSOURCETYPE, "ListSourceType" ); + FORMS_CONSTASCII_STRING( PROPERTY_LISTSOURCE, "ListSource" ); + FORMS_CONSTASCII_STRING( PROPERTY_SELECT_SEQ, "SelectedItems" ); + FORMS_CONSTASCII_STRING( PROPERTY_VALUE_SEQ, "ValueItemList" ); + FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_SELECT_SEQ, "DefaultSelection" ); + FORMS_CONSTASCII_STRING( PROPERTY_MULTISELECTION, "MultiSelection" ); + FORMS_CONSTASCII_STRING( PROPERTY_ALIGN, "Align" ); + FORMS_CONSTASCII_STRING( PROPERTY_VERTICAL_ALIGN, "VerticalAlign" ); + FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_DATE, "DefaultDate" ); + FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_TIME, "DefaultTime" ); + FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_VALUE, "DefaultValue" ); + FORMS_CONSTASCII_STRING( PROPERTY_DECIMAL_ACCURACY, "DecimalAccuracy" ); + FORMS_CONSTASCII_STRING( PROPERTY_CURSORSOURCE, "DataSelection" ); + FORMS_CONSTASCII_STRING( PROPERTY_CURSORSOURCETYPE, "DataSelectionType" ); + FORMS_CONSTASCII_STRING( PROPERTY_FIELDTYPE, "Type" ); + FORMS_CONSTASCII_STRING( PROPERTY_DECIMALS, "Decimals" ); + FORMS_CONSTASCII_STRING( PROPERTY_REFVALUE, "RefValue" ); + FORMS_CONSTASCII_STRING( PROPERTY_UNCHECKED_REFVALUE, "SecondaryRefValue" ); + FORMS_CONSTASCII_STRING( PROPERTY_VALUEMIN, "ValueMin" ); + FORMS_CONSTASCII_STRING( PROPERTY_VALUEMAX, "ValueMax" ); + FORMS_CONSTASCII_STRING( PROPERTY_STRICTFORMAT, "StrictFormat" ); + FORMS_CONSTASCII_STRING( PROPERTY_ALLOWADDITIONS, "AllowInserts" ); + FORMS_CONSTASCII_STRING( PROPERTY_ALLOWEDITS, "AllowUpdates" ); + FORMS_CONSTASCII_STRING( PROPERTY_ALLOWDELETIONS, "AllowDeletes" ); + FORMS_CONSTASCII_STRING( PROPERTY_MASTERFIELDS, "MasterFields" ); + FORMS_CONSTASCII_STRING( PROPERTY_ISPASSTHROUGH, "IsPassThrough" ); + FORMS_CONSTASCII_STRING( PROPERTY_QUERY, "Query" ); + FORMS_CONSTASCII_STRING( PROPERTY_LITERALMASK, "LiteralMask" ); + FORMS_CONSTASCII_STRING( PROPERTY_VALUESTEP, "ValueStep" ); + FORMS_CONSTASCII_STRING( PROPERTY_SHOWTHOUSANDSEP, "ShowThousandsSeparator" ); + FORMS_CONSTASCII_STRING( PROPERTY_CURRENCYSYMBOL, "CurrencySymbol" ); + FORMS_CONSTASCII_STRING( PROPERTY_DATEFORMAT, "DateFormat" ); + FORMS_CONSTASCII_STRING( PROPERTY_DATEMIN, "DateMin" ); + FORMS_CONSTASCII_STRING( PROPERTY_DATEMAX, "DateMax" ); + FORMS_CONSTASCII_STRING( PROPERTY_DATE_SHOW_CENTURY, "DateShowCentury" ); + FORMS_CONSTASCII_STRING( PROPERTY_TIMEFORMAT, "TimeFormat" ); + FORMS_CONSTASCII_STRING( PROPERTY_TIMEMIN, "TimeMin" ); + FORMS_CONSTASCII_STRING( PROPERTY_TIMEMAX, "TimeMax" ); + FORMS_CONSTASCII_STRING( PROPERTY_LINECOUNT, "LineCount" ); + FORMS_CONSTASCII_STRING( PROPERTY_BOUNDCOLUMN, "BoundColumn" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT, "FontDescriptor" ); + FORMS_CONSTASCII_STRING( PROPERTY_FILLCOLOR, "FillColor" ); + FORMS_CONSTASCII_STRING( PROPERTY_LINECOLOR, "LineColor" ); + FORMS_CONSTASCII_STRING( PROPERTY_DROPDOWN, "Dropdown" ); + FORMS_CONSTASCII_STRING( PROPERTY_HSCROLL, "HScroll" ); + FORMS_CONSTASCII_STRING( PROPERTY_VSCROLL, "VScroll" ); + FORMS_CONSTASCII_STRING( PROPERTY_TABSTOP, "Tabstop" ); + FORMS_CONSTASCII_STRING( PROPERTY_AUTOCOMPLETE, "Autocomplete" ); + FORMS_CONSTASCII_STRING( PROPERTY_HARDLINEBREAKS, "HardLineBreaks" ); + FORMS_CONSTASCII_STRING( PROPERTY_PRINTABLE, "Printable" ); + FORMS_CONSTASCII_STRING( PROPERTY_ECHO_CHAR, "EchoChar" ); + FORMS_CONSTASCII_STRING( PROPERTY_ROWHEIGHT, "RowHeight" ); + FORMS_CONSTASCII_STRING( PROPERTY_HELPTEXT, "HelpText" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_NAME, "FontName" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_STYLENAME, "FontStyleName" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_FAMILY, "FontFamily" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_CHARSET, "FontCharset" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_HEIGHT, "FontHeight" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_WEIGHT, "FontWeight" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_SLANT, "FontSlant" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_UNDERLINE, "FontUnderline" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_WORDLINEMODE, "FontWordLineMode" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_STRIKEOUT, "FontStrikeout" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONTEMPHASISMARK, "FontEmphasisMark" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONTRELIEF, "FontRelief" ); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_CHARWIDTH, "FontCharWidth"); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_KERNING, "FontKerning"); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_ORIENTATION, "FontOrientation"); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_PITCH, "FontPitch"); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_TYPE, "FontType"); + FORMS_CONSTASCII_STRING( PROPERTY_FONT_WIDTH, "FontWidth"); + FORMS_CONSTASCII_STRING( PROPERTY_HELPURL, "HelpURL" ); + FORMS_CONSTASCII_STRING( PROPERTY_RECORDMARKER, "HasRecordMarker" ); + FORMS_CONSTASCII_STRING( PROPERTY_BOUNDFIELD, "BoundField" ); + FORMS_CONSTASCII_STRING( PROPERTY_INPUT_REQUIRED, "InputRequired" ); + FORMS_CONSTASCII_STRING( PROPERTY_TREATASNUMERIC, "TreatAsNumber" ); + FORMS_CONSTASCII_STRING( PROPERTY_EFFECTIVE_VALUE, "EffectiveValue" ); + FORMS_CONSTASCII_STRING( PROPERTY_EFFECTIVE_DEFAULT, "EffectiveDefault" ); + FORMS_CONSTASCII_STRING( PROPERTY_EFFECTIVE_MIN, "EffectiveMin" ); + FORMS_CONSTASCII_STRING( PROPERTY_EFFECTIVE_MAX, "EffectiveMax" ); + FORMS_CONSTASCII_STRING( PROPERTY_HIDDEN, "Hidden" ); + FORMS_CONSTASCII_STRING( PROPERTY_FILTERPROPOSAL, "UseFilterValueProposal" ); + FORMS_CONSTASCII_STRING( PROPERTY_FIELDSOURCE, "FieldSource" ); + FORMS_CONSTASCII_STRING( PROPERTY_TABLENAME, "TableName" ); + FORMS_CONSTASCII_STRING( PROPERTY_ISFILTERAPPLIED, "IsFilterApplied" ); + FORMS_CONSTASCII_STRING( PROPERTY_CONTROLLABEL, "LabelControl" ); + FORMS_CONSTASCII_STRING( PROPERTY_CURRSYM_POSITION, "PrependCurrencySymbol" ); + FORMS_CONSTASCII_STRING( PROPERTY_CURSORCOLOR, "CursorColor" ); + FORMS_CONSTASCII_STRING( PROPERTY_ALWAYSSHOWCURSOR, "AlwaysShowCursor" ); + FORMS_CONSTASCII_STRING( PROPERTY_DISPLAYSYNCHRON, "DisplayIsSynchron" ); + FORMS_CONSTASCII_STRING( PROPERTY_TEXTCOLOR, "TextColor" ); + FORMS_CONSTASCII_STRING( PROPERTY_DELAY, "RepeatDelay" ); + FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_SCROLL_VALUE, "DefaultScrollValue" ); + FORMS_CONSTASCII_STRING( PROPERTY_SCROLL_VALUE, "ScrollValue" ); + FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_SPIN_VALUE, "DefaultSpinValue" ); + FORMS_CONSTASCII_STRING( PROPERTY_SPIN_VALUE, "SpinValue" ); + FORMS_CONSTASCII_STRING( PROPERTY_REFERENCE_DEVICE, "ReferenceDevice" ); + FORMS_CONSTASCII_STRING( PROPERTY_ISMODIFIED, "IsModified" ); + FORMS_CONSTASCII_STRING( PROPERTY_ISNEW, "IsNew" ); + FORMS_CONSTASCII_STRING( PROPERTY_PRIVILEGES, "Privileges" ); + FORMS_CONSTASCII_STRING( PROPERTY_COMMAND, "Command" ); + FORMS_CONSTASCII_STRING( PROPERTY_COMMANDTYPE, "CommandType" ); + FORMS_CONSTASCII_STRING( PROPERTY_RESULTSET_CONCURRENCY, "ResultSetConcurrency" ); + FORMS_CONSTASCII_STRING( PROPERTY_INSERTONLY, "IgnoreResult" ); + FORMS_CONSTASCII_STRING( PROPERTY_RESULTSET_TYPE, "ResultSetType" ); + FORMS_CONSTASCII_STRING( PROPERTY_ESCAPE_PROCESSING, "EscapeProcessing" ); + FORMS_CONSTASCII_STRING( PROPERTY_APPLYFILTER, "ApplyFilter" ); + FORMS_CONSTASCII_STRING( PROPERTY_ROWCOUNT, "RowCount" ); + FORMS_CONSTASCII_STRING( PROPERTY_ROWCOUNTFINAL, "IsRowCountFinal" ); + + FORMS_CONSTASCII_STRING( PROPERTY_ISNULLABLE, "IsNullable" ); + FORMS_CONSTASCII_STRING( PROPERTY_ACTIVECOMMAND, "ActiveCommand" ); + FORMS_CONSTASCII_STRING( PROPERTY_ISCURRENCY, "IsCurrency" ); + FORMS_CONSTASCII_STRING( PROPERTY_URL, "URL" ); + FORMS_CONSTASCII_STRING( PROPERTY_TITLE, "Title" ); + FORMS_CONSTASCII_STRING( PROPERTY_ACTIVE_CONNECTION, "ActiveConnection" ); + FORMS_CONSTASCII_STRING( PROPERTY_SCALE, "Scale" ); + FORMS_CONSTASCII_STRING( PROPERTY_SORT, "Order" ); + FORMS_CONSTASCII_STRING( PROPERTY_DATASOURCE, "DataSourceName" ); + FORMS_CONSTASCII_STRING( PROPERTY_DETAILFIELDS, "DetailFields" ); + + FORMS_CONSTASCII_STRING( PROPERTY_COLUMNSERVICENAME, "ColumnServiceName" ); + FORMS_CONSTASCII_STRING( PROPERTY_REALNAME, "RealName" ); + FORMS_CONSTASCII_STRING( PROPERTY_CONTROLSOURCEPROPERTY, "DataFieldProperty" ); + FORMS_CONSTASCII_STRING( PROPERTY_USER, "User" ); + FORMS_CONSTASCII_STRING( PROPERTY_PASSWORD, "Password" ); + FORMS_CONSTASCII_STRING( PROPERTY_DISPATCHURLINTERNAL, "DispatchURLInternal" ); + FORMS_CONSTASCII_STRING( PROPERTY_PERSISTENCE_MAXTEXTLENGTH,"PersistenceMaxTextLength" ); + FORMS_CONSTASCII_STRING( PROPERTY_RICH_TEXT, "RichText" ); + FORMS_CONSTASCII_STRING( PROPERTY_ENFORCE_FORMAT, "EnforceFormat" ); + FORMS_CONSTASCII_STRING( PROPERTY_LINEEND_FORMAT, "LineEndFormat" ); + FORMS_CONSTASCII_STRING( PROPERTY_WRITING_MODE, "WritingMode" ); + FORMS_CONSTASCII_STRING( PROPERTY_CONTEXT_WRITING_MODE, "ContextWritingMode" ); + + FORMS_CONSTASCII_STRING( PROPERTY_NATIVE_LOOK, "NativeWidgetLook" ); + FORMS_CONSTASCII_STRING( PROPERTY_BORDER, "Border" ); + FORMS_CONSTASCII_STRING( PROPERTY_BORDERCOLOR, "BorderColor" ); + FORMS_CONSTASCII_STRING( PROPERTY_BACKGROUNDCOLOR, "BackgroundColor" ); + FORMS_CONSTASCII_STRING( PROPERTY_ICONSIZE, "IconSize" ); + FORMS_CONSTASCII_STRING( PROPERTY_TEXTLINECOLOR, "TextLineColor" ); + FORMS_CONSTASCII_STRING( PROPERTY_HIDEINACTIVESELECTION, "HideInactiveSelection" ); + + FORMS_CONSTASCII_STRING( PROPERTY_SHOW_POSITION, "ShowPosition" ); + FORMS_CONSTASCII_STRING( PROPERTY_SHOW_NAVIGATION, "ShowNavigation" ); + FORMS_CONSTASCII_STRING( PROPERTY_SHOW_RECORDACTIONS, "ShowRecordActions" ); + FORMS_CONSTASCII_STRING( PROPERTY_SHOW_FILTERSORT, "ShowFilterSort" ); + + FORMS_CONSTASCII_STRING( PROPERTY_XSD_WHITESPACE, "WhiteSpace" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_PATTERN, "Pattern" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_LENGTH, "Length" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MIN_LENGTH, "MinLength" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MAX_LENGTH, "MaxLength" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_TOTAL_DIGITS, "TotalDigits" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_FRACTION_DIGITS, "FractionDigits" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MAX_INCLUSIVE_INT, "MaxInclusiveInt" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MAX_EXCLUSIVE_INT, "MaxExclusiveInt" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MIN_INCLUSIVE_INT, "MinInclusiveInt" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MIN_EXCLUSIVE_INT, "MinExclusiveInt" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE, "MaxInclusiveDouble" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE, "MaxExclusiveDouble" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE, "MinInclusiveDouble" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE, "MinExclusiveDouble" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MAX_INCLUSIVE_DATE, "MaxInclusiveDate" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MAX_EXCLUSIVE_DATE, "MaxExclusiveDate" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MIN_INCLUSIVE_DATE, "MinInclusiveDate" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MIN_EXCLUSIVE_DATE, "MinExclusiveDate" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MAX_INCLUSIVE_TIME, "MaxInclusiveTime" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MAX_EXCLUSIVE_TIME, "MaxExclusiveTime" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MIN_INCLUSIVE_TIME, "MinInclusiveTime" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MIN_EXCLUSIVE_TIME, "MinExclusiveTime" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME, "MaxInclusiveDateTime" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME, "MaxExclusiveDateTime" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME, "MinInclusiveDateTime" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME, "MinExclusiveDateTime" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_IS_BASIC, "IsBasic" ); + FORMS_CONSTASCII_STRING( PROPERTY_XSD_TYPE_CLASS, "TypeClass" ); + + FORMS_CONSTASCII_STRING( PROPERTY_DYNAMIC_CONTROL_BORDER, "DynamicControlBorder" ); + FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_FOCUS, "ControlBorderColorOnFocus" ); + FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_MOUSE, "ControlBorderColorOnHover" ); + FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_INVALID,"ControlBorderColorOnInvalid" ); + + //-------------------------------------------------------------------------- + //- URLs + //-------------------------------------------------------------------------- + FORMS_CONSTASCII_STRING( URL_CONTROLLER_PREFIX, ".uno:FormController/" ); + + FORMS_CONSTASCII_STRING( URL_FORM_POSITION, ".uno:FormController/positionForm" ); + FORMS_CONSTASCII_STRING( URL_FORM_RECORDCOUNT, ".uno:FormController/RecordCount" ); + FORMS_CONSTASCII_STRING( URL_RECORD_FIRST, ".uno:FormController/moveToFirst" ); + FORMS_CONSTASCII_STRING( URL_RECORD_PREV, ".uno:FormController/moveToPrev" ); + FORMS_CONSTASCII_STRING( URL_RECORD_NEXT, ".uno:FormController/moveToNext" ); + FORMS_CONSTASCII_STRING( URL_RECORD_LAST, ".uno:FormController/moveToLast" ); + FORMS_CONSTASCII_STRING( URL_RECORD_SAVE, ".uno:FormController/saveRecord" ); + FORMS_CONSTASCII_STRING( URL_RECORD_UNDO, ".uno:FormController/undoRecord" ); + FORMS_CONSTASCII_STRING( URL_RECORD_NEW, ".uno:FormController/moveToNew" ); + FORMS_CONSTASCII_STRING( URL_RECORD_DELETE, ".uno:FormController/deleteRecord" ); + FORMS_CONSTASCII_STRING( URL_FORM_REFRESH, ".uno:FormController/refreshForm" ); + FORMS_CONSTASCII_STRING( URL_FORM_REFRESH_CURRENT_CONTROL, + ".uno:FormController/refreshCurrentControl" ); + + FORMS_CONSTASCII_STRING( URL_FORM_SORT_UP, ".uno:FormController/sortUp" ); + FORMS_CONSTASCII_STRING( URL_FORM_SORT_DOWN, ".uno:FormController/sortDown" ); + FORMS_CONSTASCII_STRING( URL_FORM_SORT, ".uno:FormController/sort" ); + FORMS_CONSTASCII_STRING( URL_FORM_AUTO_FILTER, ".uno:FormController/autoFilter" ); + FORMS_CONSTASCII_STRING( URL_FORM_FILTER, ".uno:FormController/filter" ); + FORMS_CONSTASCII_STRING( URL_FORM_APPLY_FILTER, ".uno:FormController/applyFilter" ); + FORMS_CONSTASCII_STRING( URL_FORM_REMOVE_FILTER,".uno:FormController/removeFilterOrder" ); + +//.............................................................................. +} // namespace frm +//.............................................................................. + + +#endif // FRM_STRINGS_HXX diff --git a/forms/source/inc/ids.hxx b/forms/source/inc/ids.hxx new file mode 100644 index 000000000000..ef391341c1d4 --- /dev/null +++ b/forms/source/inc/ids.hxx @@ -0,0 +1,36 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FRM_IDS_HXX_ +#define _FRM_IDS_HXX_ + +#include <unotools/idhelper.hxx> + +DECLARE_IMPLEMENTATIONID_HELPER(frm, OImplementationIds) + +#endif // _FRM_IDS_HXX_ + diff --git a/forms/source/inc/limitedformats.hxx b/forms/source/inc/limitedformats.hxx new file mode 100644 index 000000000000..fee3221ce17f --- /dev/null +++ b/forms/source/inc/limitedformats.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FORMS_LIMITED_FORMATS_HXX_ +#define _FORMS_LIMITED_FORMATS_HXX_ + +#include <osl/mutex.hxx> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/XFastPropertySet.hpp> + +//......................................................................... +namespace frm +{ +//......................................................................... + + //===================================================================== + //= OLimitedFormats + //===================================================================== + /** maintains translation tables format key <-> enum value + <p>Used for controls which provide a limited number for (standard) formats, which + should be available as format keys.</p> + */ + class OLimitedFormats + { + private: + static sal_Int32 s_nInstanceCount; + static ::osl::Mutex s_aMutex; + static ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > + s_xStandardFormats; + + protected: + sal_Int32 m_nFormatEnumPropertyHandle; + const sal_Int16 m_nTableId; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > + m_xAggregate; + + protected: + /** ctor + <p>The class id is used to determine the translation table to use. All instances which + pass the same value here share one table.</p> + */ + OLimitedFormats( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const sal_Int16 _nClassId + ); + ~OLimitedFormats(); + + protected: + void setAggregateSet( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet >& _rxAggregate, + sal_Int32 _nOriginalPropertyHandle + ); + + protected: + void getFormatKeyPropertyValue( ::com::sun::star::uno::Any& _rValue ) const; + sal_Bool convertFormatKeyPropertyValue( + ::com::sun::star::uno::Any& _rConvertedValue, + ::com::sun::star::uno::Any& _rOldValue, + const ::com::sun::star::uno::Any& _rNewValue + ); + void setFormatKeyPropertyValue( const ::com::sun::star::uno::Any& _rNewValue ); + // setFormatKeyPropertyValue should only be called with a value got from convertFormatKeyPropertyValue! + + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > + getFormatsSupplier() const { return s_xStandardFormats; } + + private: + void acquireSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + void releaseSupplier(); + + static void ensureTableInitialized(const sal_Int16 _nTableId); + static void clearTable(const sal_Int16 _nTableId); + }; + +//......................................................................... +} // namespace frm +//......................................................................... + +#endif // _FORMS_LIMITED_FORMATS_HXX_ + diff --git a/forms/source/inc/listenercontainers.hxx b/forms/source/inc/listenercontainers.hxx new file mode 100644 index 000000000000..d4f088d4e180 --- /dev/null +++ b/forms/source/inc/listenercontainers.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FORMS_SOURCE_INC_LISTENERCONTAINERS_HXX +#define FORMS_SOURCE_INC_LISTENERCONTAINERS_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/form/XResetListener.hpp> +/** === end UNO includes === **/ +#include <comphelper/listenernotification.hxx> +#include <cppuhelper/weak.hxx> + +//........................................................................ +namespace frm +{ +//........................................................................ + + //===================================================================== + //= EventListeners + //===================================================================== + template < class LISTENER > + class EventListeners : public ::comphelper::OListenerContainerBase< LISTENER, ::com::sun::star::lang::EventObject > + { + public: + typedef LISTENER ListenerClass; + typedef ::com::sun::star::lang::EventObject EventClass; + typedef ::comphelper::OListenerContainerBase< ListenerClass, EventClass > + EventListeners_Base; + + private: + ::cppu::OWeakObject& m_rInstigator; + + protected: + ::cppu::OWeakObject& getInstigator() { return m_rInstigator; } + + protected: + inline EventListeners( ::cppu::OWeakObject& _rInstigator, ::osl::Mutex& _rMutex ) + :EventListeners_Base( _rMutex ) + ,m_rInstigator( _rInstigator ) + { + } + + // still waiting to be overwritten + virtual bool implTypedNotify( + const ::com::sun::star::uno::Reference< ListenerClass >& _rxListener, + const EventClass& _rEvent + ) SAL_THROW( ( ::com::sun::star::uno::Exception ) ) = 0; + + public: + inline bool notify() + { + ::com::sun::star::lang::EventObject aEvent( m_rInstigator ); + return EventListeners_Base::notify( aEvent ); + } + + inline void disposing() + { + ::com::sun::star::lang::EventObject aEvent( m_rInstigator ); + EventListeners_Base::disposing( aEvent ); + } + protected: + using EventListeners_Base::notify; + using EventListeners_Base::disposing; + }; + + //===================================================================== + //= ResetListeners + //===================================================================== + typedef EventListeners < ::com::sun::star::form::XResetListener + > ResetListeners_Base; + class ResetListeners : public ResetListeners_Base + { + private: + enum NotificationType + { + eApproval, + eFinal + }; + NotificationType m_eCurrentNotificationType; + + public: + inline ResetListeners( ::cppu::OWeakObject& _rInstigator, ::osl::Mutex& _rMutex ) + :ResetListeners_Base( _rInstigator, _rMutex ) + ,m_eCurrentNotificationType( eApproval ) + { + } + + /** see whether all our listeners approve the reset + */ + sal_Bool approveReset() + { + m_eCurrentNotificationType = eApproval; + return notify(); + } + + /** tell all our listeners that the reset happened + */ + void resetted() + { + m_eCurrentNotificationType = eFinal; + notify(); + } + + protected: + virtual bool implTypedNotify( + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& _rxListener, + const ::com::sun::star::lang::EventObject& _rEvent + ) SAL_THROW( ( ::com::sun::star::uno::Exception ) ); + }; + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_SOURCE_INC_LISTENERCONTAINERS_HXX + diff --git a/forms/source/inc/property.hrc b/forms/source/inc/property.hrc new file mode 100644 index 000000000000..c1064e6d56b9 --- /dev/null +++ b/forms/source/inc/property.hrc @@ -0,0 +1,316 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FRM_PROPERTY_HRC_ +#define _FRM_PROPERTY_HRC_ + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +#ifndef FRM_STRINGS_HXX +#include "frm_strings.hxx" +#endif + +//......................................................................... +namespace frm +{ +//......................................................................... + +// PropertyId's, welche eine Zuordnung zu einen PropertyName haben +#define PROPERTY_ID_START 0 + +#define PROPERTY_ID_NAME (PROPERTY_ID_START + 1) +#define PROPERTY_ID_TABINDEX (PROPERTY_ID_START + 2) +#define PROPERTY_ID_CONTROLSOURCE (PROPERTY_ID_START + 3) +#define PROPERTY_ID_MASTERFIELDS (PROPERTY_ID_START + 4) +#define PROPERTY_ID_DATASOURCE (PROPERTY_ID_START + 6) +#define PROPERTY_ID_CLASSID (PROPERTY_ID_START + 9) +#define PROPERTY_ID_CURSORTYPE (PROPERTY_ID_START + 10) +#define PROPERTY_ID_READONLY (PROPERTY_ID_START + 11) +#define PROPERTY_ID_NAVIGATION (PROPERTY_ID_START + 13) +#define PROPERTY_ID_CYCLE (PROPERTY_ID_START + 14) +#define PROPERTY_ID_ALLOWADDITIONS (PROPERTY_ID_START + 15) +#define PROPERTY_ID_ALLOWEDITS (PROPERTY_ID_START + 16) +#define PROPERTY_ID_ALLOWDELETIONS (PROPERTY_ID_START + 17) +#define PROPERTY_ID_NATIVE_LOOK (PROPERTY_ID_START + 18) +#define PROPERTY_ID_INPUT_REQUIRED (PROPERTY_ID_START + 19) +#define PROPERTY_ID_WRITING_MODE (PROPERTY_ID_START + 20) +#define PROPERTY_ID_CONTEXT_WRITING_MODE (PROPERTY_ID_START + 21) +#define PROPERTY_ID_VERTICAL_ALIGN (PROPERTY_ID_START + 22) + // free + // free + // free + // free + // free + // free + // free + // free +#define PROPERTY_ID_VALUE (PROPERTY_ID_START + 31) // INT32 + // free +#define PROPERTY_ID_FORMATKEY (PROPERTY_ID_START + 33) // UINT32 + // free + // free + // free +#define PROPERTY_ID_SIZE (PROPERTY_ID_START + 37) // UINT32 +#define PROPERTY_ID_REFERENCE_DEVICE (PROPERTY_ID_START + 38) // XDevice + // free + // free + // free +#define PROPERTY_ID_WIDTH (PROPERTY_ID_START + 42) // UINT16 +#define PROPERTY_ID_DEFAULTCONTROL (PROPERTY_ID_START + 43) // string +#define PROPERTY_ID_BOUNDCOLUMN (PROPERTY_ID_START + 44) // UINT16 may be null +#define PROPERTY_ID_LISTSOURCETYPE (PROPERTY_ID_START + 45) // UINT16 +#define PROPERTY_ID_LISTSOURCE (PROPERTY_ID_START + 46) // string + // FREE +#define PROPERTY_ID_TEXT (PROPERTY_ID_START + 48) // string +#define PROPERTY_ID_STRINGITEMLIST (PROPERTY_ID_START + 49) // wsstringsequence +#define PROPERTY_ID_LABEL (PROPERTY_ID_START + 50) // string +#define PROPERTY_ID_HIDEINACTIVESELECTION (PROPERTY_ID_START + 51) // sal_Bool +#define PROPERTY_ID_STATE (PROPERTY_ID_START + 52) // UINT16 +#define PROPERTY_ID_DELAY (PROPERTY_ID_START + 53) // sal_Int32 +#define PROPERTY_ID_FONT (PROPERTY_ID_START + 54) // font +#define PROPERTY_ID_HASNAVIGATION (PROPERTY_ID_START + 55) +#define PROPERTY_ID_BORDERCOLOR (PROPERTY_ID_START + 56) // sal_Int32 +#define PROPERTY_ID_ROWHEIGHT (PROPERTY_ID_START + 57) // UINT16 +#define PROPERTY_ID_BACKGROUNDCOLOR (PROPERTY_ID_START + 58) // sal_Int32 +#define PROPERTY_ID_FILLCOLOR (PROPERTY_ID_START + 59) // UINT32 +#define PROPERTY_ID_TEXTCOLOR (PROPERTY_ID_START + 60) // UINT32 +#define PROPERTY_ID_LINECOLOR (PROPERTY_ID_START + 61) // UINT32 +#define PROPERTY_ID_BORDER (PROPERTY_ID_START + 62) // UINT16 +#define PROPERTY_ID_ALIGN (PROPERTY_ID_START + 63) // UINT16 +#define PROPERTY_ID_DROPDOWN (PROPERTY_ID_START + 64) // BOOL +#define PROPERTY_ID_UNCHECKED_REFVALUE (PROPERTY_ID_START + 65) // ::rtl::OUString +#define PROPERTY_ID_HSCROLL (PROPERTY_ID_START + 66) // BOOL +#define PROPERTY_ID_VSCROLL (PROPERTY_ID_START + 67) // BOOL +#define PROPERTY_ID_TABSTOP (PROPERTY_ID_START + 68) // BOOL +#define PROPERTY_ID_REFVALUE (PROPERTY_ID_START + 69) // ::rtl::OUString +#define PROPERTY_ID_BUTTONTYPE (PROPERTY_ID_START + 70) // UINT16 +#define PROPERTY_ID_DEFAULT_TEXT (PROPERTY_ID_START + 71) // ::rtl::OUString +#define PROPERTY_ID_SUBMIT_ACTION (PROPERTY_ID_START + 72) // string +#define PROPERTY_ID_SUBMIT_METHOD (PROPERTY_ID_START + 73) // FmSubmitMethod +#define PROPERTY_ID_SUBMIT_ENCODING (PROPERTY_ID_START + 74) // FmSubmitEncoding +#define PROPERTY_ID_DEFAULT_VALUE (PROPERTY_ID_START + 75) // ::rtl::OUString +#define PROPERTY_ID_SUBMIT_TARGET (PROPERTY_ID_START + 76) // ::rtl::OUString +#define PROPERTY_ID_DEFAULT_STATE (PROPERTY_ID_START + 77) // UINT16 +#define PROPERTY_ID_VALUE_SEQ (PROPERTY_ID_START + 78) // StringSeq +#define PROPERTY_ID_IMAGE_URL (PROPERTY_ID_START + 79) // ::rtl::OUString + // free + // free + // free + // free + // free + // free + // free + // free + // free + // free + // free +#define PROPERTY_ID_SELECT_SEQ (PROPERTY_ID_START + 91) // INT16Seq +#define PROPERTY_ID_DEFAULT_SELECT_SEQ (PROPERTY_ID_START + 92) // INT16Seq +#define PROPERTY_ID_MULTISELECTION (PROPERTY_ID_START + 93) // BOOL +#define PROPERTY_ID_MULTILINE (PROPERTY_ID_START + 94) // BOOL +#define PROPERTY_ID_DATE (PROPERTY_ID_START + 95) // UINT32 +#define PROPERTY_ID_DATEMIN (PROPERTY_ID_START + 96) // UINT32 +#define PROPERTY_ID_DATEMAX (PROPERTY_ID_START + 97) // UINT32 +#define PROPERTY_ID_DATEFORMAT (PROPERTY_ID_START + 98) // UINT16 +#define PROPERTY_ID_TIME (PROPERTY_ID_START + 99) // UINT32 +#define PROPERTY_ID_TIMEMIN (PROPERTY_ID_START +100) // UINT32 +#define PROPERTY_ID_TIMEMAX (PROPERTY_ID_START +101) // UINT32 +#define PROPERTY_ID_TIMEFORMAT (PROPERTY_ID_START +102) // UINT16 +#define PROPERTY_ID_VALUEMIN (PROPERTY_ID_START +103) // INT32 +#define PROPERTY_ID_VALUEMAX (PROPERTY_ID_START +104) // INT32 +#define PROPERTY_ID_VALUESTEP (PROPERTY_ID_START +105) // INT32 +#define PROPERTY_ID_CURRENCYSYMBOL (PROPERTY_ID_START +106) // ::rtl::OUString +#define PROPERTY_ID_EDITMASK (PROPERTY_ID_START +107) // ::rtl::OUString +#define PROPERTY_ID_LITERALMASK (PROPERTY_ID_START +108) // ::rtl::OUString +#define PROPERTY_ID_ENABLED (PROPERTY_ID_START +109) // BOOL +#define PROPERTY_ID_AUTOCOMPLETE (PROPERTY_ID_START +110) // BOOL +#define PROPERTY_ID_LINECOUNT (PROPERTY_ID_START +111) // UINT16 +#define PROPERTY_ID_MAXTEXTLEN (PROPERTY_ID_START +112) // UINT16 +#define PROPERTY_ID_SPIN (PROPERTY_ID_START +113) // BOOL +#define PROPERTY_ID_STRICTFORMAT (PROPERTY_ID_START +114) // BOOL +#define PROPERTY_ID_SHOWTHOUSANDSEP (PROPERTY_ID_START +115) // BOOL +#define PROPERTY_ID_HARDLINEBREAKS (PROPERTY_ID_START +116) // BOOL +#define PROPERTY_ID_PRINTABLE (PROPERTY_ID_START +117) // BOOL +#define PROPERTY_ID_TARGET_URL (PROPERTY_ID_START +118) // ::rtl::OUString +#define PROPERTY_ID_TARGET_FRAME (PROPERTY_ID_START +119) // ::rtl::OUString +#define PROPERTY_ID_TAG (PROPERTY_ID_START +120) // ::rtl::OUString +#define PROPERTY_ID_ECHO_CHAR (PROPERTY_ID_START +121) // UINT16 +#define PROPERTY_ID_SHOW_POSITION (PROPERTY_ID_START +122) // sal_Bool +#define PROPERTY_ID_SHOW_NAVIGATION (PROPERTY_ID_START +123) // sal_Bool +#define PROPERTY_ID_SHOW_RECORDACTIONS (PROPERTY_ID_START +124) // sal_Bool +#define PROPERTY_ID_SHOW_FILTERSORT (PROPERTY_ID_START +125) // sal_Bool +#define PROPERTY_ID_EMPTY_IS_NULL (PROPERTY_ID_START +126) // Bool +#define PROPERTY_ID_DECIMAL_ACCURACY (PROPERTY_ID_START +127) // UINT16 +#define PROPERTY_ID_DATE_SHOW_CENTURY (PROPERTY_ID_START +128) // Bool +#define PROPERTY_ID_TRISTATE (PROPERTY_ID_START +129) // Bool +#define PROPERTY_ID_DEFAULT_BUTTON (PROPERTY_ID_START +130) // Bool +#define PROPERTY_ID_HIDDEN_VALUE (PROPERTY_ID_START +131) // ::rtl::OUString +#define PROPERTY_ID_DECIMALS (PROPERTY_ID_START +132) // UINT16 +#define PROPERTY_ID_AUTOINCREMENT (PROPERTY_ID_START +133) // UINT16 + // free +#define PROPERTY_ID_FILTER (PROPERTY_ID_START +135) // ::rtl::OUString + // free +#define PROPERTY_ID_QUERY (PROPERTY_ID_START +137) // ::rtl::OUString +#define PROPERTY_ID_DEFAULT_LONG_VALUE (PROPERTY_ID_START +138) // Double +#define PROPERTY_ID_DEFAULT_DATE (PROPERTY_ID_START +139) // UINT32 +#define PROPERTY_ID_DEFAULT_TIME (PROPERTY_ID_START +140) +#define PROPERTY_ID_HELPTEXT (PROPERTY_ID_START +141) +#define PROPERTY_ID_FONT_NAME (PROPERTY_ID_START +142) +#define PROPERTY_ID_FONT_STYLENAME (PROPERTY_ID_START +143) +#define PROPERTY_ID_FONT_FAMILY (PROPERTY_ID_START +144) +#define PROPERTY_ID_FONT_CHARSET (PROPERTY_ID_START +145) +#define PROPERTY_ID_FONT_HEIGHT (PROPERTY_ID_START +146) +#define PROPERTY_ID_FONT_WEIGHT (PROPERTY_ID_START +147) +#define PROPERTY_ID_FONT_SLANT (PROPERTY_ID_START +148) +#define PROPERTY_ID_FONT_UNDERLINE (PROPERTY_ID_START +149) +#define PROPERTY_ID_FONT_STRIKEOUT (PROPERTY_ID_START +150) +#define PROPERTY_ID_ISPASSTHROUGH (PROPERTY_ID_START +151) +#define PROPERTY_ID_HELPURL (PROPERTY_ID_START +152) // ::rtl::OUString +#define PROPERTY_ID_RECORDMARKER (PROPERTY_ID_START +153) +#define PROPERTY_ID_BOUNDFIELD (PROPERTY_ID_START +154) +#define PROPERTY_ID_FORMATSSUPPLIER (PROPERTY_ID_START +155) // XNumberFormatsSupplier +#define PROPERTY_ID_TREATASNUMERIC (PROPERTY_ID_START +156) // BOOL +#define PROPERTY_ID_EFFECTIVE_VALUE (PROPERTY_ID_START +157) // ANY (string or double) +#define PROPERTY_ID_EFFECTIVE_DEFAULT (PROPERTY_ID_START +158) // dito +#define PROPERTY_ID_EFFECTIVE_MIN (PROPERTY_ID_START +159) // dito +#define PROPERTY_ID_EFFECTIVE_MAX (PROPERTY_ID_START +160) // dito +#define PROPERTY_ID_HIDDEN (PROPERTY_ID_START +161) // BOOL +#define PROPERTY_ID_FILTERPROPOSAL (PROPERTY_ID_START +162) // BOOL +#define PROPERTY_ID_FIELDSOURCE (PROPERTY_ID_START +163) // String +#define PROPERTY_ID_TABLENAME (PROPERTY_ID_START +164) // String +#define PROPERTY_ID_ENABLEVISIBLE (PROPERTY_ID_START +165) // BOOL + // FREE + // FREE + // FREE + // FREE +#define PROPERTY_ID_CONTROLLABEL (PROPERTY_ID_START +171) // XPropertySet +#define PROPERTY_ID_CURRSYM_POSITION (PROPERTY_ID_START +172) // String + // FREE +#define PROPERTY_ID_CURSORCOLOR (PROPERTY_ID_START +174) // INT32 +#define PROPERTY_ID_ALWAYSSHOWCURSOR (PROPERTY_ID_START +175) // BOOL +#define PROPERTY_ID_DISPLAYSYNCHRON (PROPERTY_ID_START +176) // BOOL +#define PROPERTY_ID_ISMODIFIED (PROPERTY_ID_START +177) // BOOL +#define PROPERTY_ID_ISNEW (PROPERTY_ID_START +178) // BOOL +#define PROPERTY_ID_PRIVILEGES (PROPERTY_ID_START +179) // INT32 +#define PROPERTY_ID_DETAILFIELDS (PROPERTY_ID_START +180) // Sequence< ::rtl::OUString > +#define PROPERTY_ID_COMMAND (PROPERTY_ID_START +181) // String +#define PROPERTY_ID_COMMANDTYPE (PROPERTY_ID_START +182) // INT32 (com::sun::star::sdb::CommandType) +#define PROPERTY_ID_RESULTSET_CONCURRENCY (PROPERTY_ID_START +183)// INT32 (com::sun::star::sdbc::ResultSetConcurrency) +#define PROPERTY_ID_INSERTONLY (PROPERTY_ID_START +184) // BOOL +#define PROPERTY_ID_RESULTSET_TYPE (PROPERTY_ID_START +185) // INT32 (com::sun::star::sdbc::ResultSetType) +#define PROPERTY_ID_ESCAPE_PROCESSING (PROPERTY_ID_START +186) // BOOL +#define PROPERTY_ID_APPLYFILTER (PROPERTY_ID_START +187) // BOOL + +#define PROPERTY_ID_ISNULLABLE (PROPERTY_ID_START +188) // BOOL +#define PROPERTY_ID_ACTIVECOMMAND (PROPERTY_ID_START +189) // String +#define PROPERTY_ID_ISCURRENCY (PROPERTY_ID_START +190) // BOOL +#define PROPERTY_ID_URL (PROPERTY_ID_START +192) // String +#define PROPERTY_ID_TITLE (PROPERTY_ID_START +193) // String +#define PROPERTY_ID_ACTIVE_CONNECTION (PROPERTY_ID_START +194) // com::sun::star::sdbc::XConnection +#define PROPERTY_ID_SCALE (PROPERTY_ID_START +195) // INT32 +#define PROPERTY_ID_SORT (PROPERTY_ID_START +196) // String + + // free + // free +#define PROPERTY_ID_FETCHSIZE (PROPERTY_ID_START +199) + // free +#define PROPERTY_ID_SEARCHABLE (PROPERTY_ID_START +201) +#define PROPERTY_ID_ISREADONLY (PROPERTY_ID_START +202) + // free +#define PROPERTY_ID_FIELDTYPE (PROPERTY_ID_START +204) +#define PROPERTY_ID_COLUMNSERVICENAME (PROPERTY_ID_START +205) +#define PROPERTY_ID_CONTROLSOURCEPROPERTY (PROPERTY_ID_START +206) +#define PROPERTY_ID_REALNAME (PROPERTY_ID_START +207) +#define PROPERTY_ID_FONT_WORDLINEMODE (PROPERTY_ID_START +208) +#define PROPERTY_ID_TEXTLINECOLOR (PROPERTY_ID_START +209) +#define PROPERTY_ID_FONTEMPHASISMARK (PROPERTY_ID_START +210) +#define PROPERTY_ID_FONTRELIEF (PROPERTY_ID_START +211) + +#define PROPERTY_ID_DISPATCHURLINTERNAL ( PROPERTY_ID_START + 212 ) // sal_Bool +#define PROPERTY_ID_PERSISTENCE_MAXTEXTLENGTH ( PROPERTY_ID_START + 213 ) // sal_Int16 +#define PROPERTY_ID_DEFAULT_SCROLL_VALUE ( PROPERTY_ID_START + 214 ) // sal_Int32 +#define PROPERTY_ID_DEFAULT_SPIN_VALUE ( PROPERTY_ID_START + 215 ) // sal_Int32 +#define PROPERTY_ID_SCROLL_VALUE ( PROPERTY_ID_START + 216 ) // sal_Int32 +#define PROPERTY_ID_SPIN_VALUE ( PROPERTY_ID_START + 217 ) // sal_Int32 +#define PROPERTY_ID_ICONSIZE ( PROPERTY_ID_START + 218 ) // sal_Int16 + +#define PROPERTY_ID_FONT_CHARWIDTH ( PROPERTY_ID_START + 219 ) // float +#define PROPERTY_ID_FONT_KERNING ( PROPERTY_ID_START + 220 ) // sal_Bool +#define PROPERTY_ID_FONT_ORIENTATION ( PROPERTY_ID_START + 221 ) // float +#define PROPERTY_ID_FONT_PITCH ( PROPERTY_ID_START + 222 ) // sal_Int16 +#define PROPERTY_ID_FONT_TYPE ( PROPERTY_ID_START + 223 ) // sal_Int16 +#define PROPERTY_ID_FONT_WIDTH ( PROPERTY_ID_START + 224 ) // sal_Int16 +#define PROPERTY_ID_RICH_TEXT ( PROPERTY_ID_START + 225 ) // sal_Bool + +#define PROPERTY_ID_DYNAMIC_CONTROL_BORDER ( PROPERTY_ID_START + 226 ) // sal_Bool +#define PROPERTY_ID_CONTROL_BORDER_COLOR_FOCUS ( PROPERTY_ID_START + 227 ) // sal_Int32 +#define PROPERTY_ID_CONTROL_BORDER_COLOR_MOUSE ( PROPERTY_ID_START + 228 ) // sal_Int32 +#define PROPERTY_ID_CONTROL_BORDER_COLOR_INVALID ( PROPERTY_ID_START + 229 ) // sal_Int32 + +#define PROPERTY_ID_XSD_PATTERN ( PROPERTY_ID_START + 230 ) +#define PROPERTY_ID_XSD_WHITESPACE ( PROPERTY_ID_START + 231 ) +#define PROPERTY_ID_XSD_LENGTH ( PROPERTY_ID_START + 232 ) +#define PROPERTY_ID_XSD_MIN_LENGTH ( PROPERTY_ID_START + 233 ) +#define PROPERTY_ID_XSD_MAX_LENGTH ( PROPERTY_ID_START + 234 ) +#define PROPERTY_ID_XSD_TOTAL_DIGITS ( PROPERTY_ID_START + 235 ) +#define PROPERTY_ID_XSD_FRACTION_DIGITS ( PROPERTY_ID_START + 236 ) +#define PROPERTY_ID_XSD_MAX_INCLUSIVE_INT ( PROPERTY_ID_START + 237 ) +#define PROPERTY_ID_XSD_MAX_EXCLUSIVE_INT ( PROPERTY_ID_START + 238 ) +#define PROPERTY_ID_XSD_MIN_INCLUSIVE_INT ( PROPERTY_ID_START + 239 ) +#define PROPERTY_ID_XSD_MIN_EXCLUSIVE_INT ( PROPERTY_ID_START + 240 ) +#define PROPERTY_ID_XSD_MAX_INCLUSIVE_DOUBLE ( PROPERTY_ID_START + 241 ) +#define PROPERTY_ID_XSD_MAX_EXCLUSIVE_DOUBLE ( PROPERTY_ID_START + 242 ) +#define PROPERTY_ID_XSD_MIN_INCLUSIVE_DOUBLE ( PROPERTY_ID_START + 243 ) +#define PROPERTY_ID_XSD_MIN_EXCLUSIVE_DOUBLE ( PROPERTY_ID_START + 244 ) +#define PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE ( PROPERTY_ID_START + 245 ) +#define PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE ( PROPERTY_ID_START + 246 ) +#define PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE ( PROPERTY_ID_START + 247 ) +#define PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE ( PROPERTY_ID_START + 248 ) +#define PROPERTY_ID_XSD_MAX_INCLUSIVE_TIME ( PROPERTY_ID_START + 249 ) +#define PROPERTY_ID_XSD_MAX_EXCLUSIVE_TIME ( PROPERTY_ID_START + 250 ) +#define PROPERTY_ID_XSD_MIN_INCLUSIVE_TIME ( PROPERTY_ID_START + 251 ) +#define PROPERTY_ID_XSD_MIN_EXCLUSIVE_TIME ( PROPERTY_ID_START + 252 ) +#define PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE_TIME ( PROPERTY_ID_START + 253 ) +#define PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE_TIME ( PROPERTY_ID_START + 254 ) +#define PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE_TIME ( PROPERTY_ID_START + 255 ) +#define PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE_TIME ( PROPERTY_ID_START + 256 ) +#define PROPERTY_ID_XSD_IS_BASIC ( PROPERTY_ID_START + 257 ) +#define PROPERTY_ID_XSD_TYPE_CLASS ( PROPERTY_ID_START + 258 ) + +#define PROPERTY_ID_LINEEND_FORMAT ( PROPERTY_ID_START + 259 ) // css.awt.LineEndFormat + +// start ID fuer aggregierte Properties +#define PROPERTY_ID_AGGREGATE_ID (PROPERTY_ID_START + 10000) + +//......................................................................... +} +//......................................................................... + + +#endif // _FRM_PROPERTY_HRC_ + diff --git a/forms/source/inc/property.hxx b/forms/source/inc/property.hxx new file mode 100644 index 000000000000..e2b6f08377cd --- /dev/null +++ b/forms/source/inc/property.hxx @@ -0,0 +1,236 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FRM_PROPERTY_HXX_ +#define _FRM_PROPERTY_HXX_ + +#include <com/sun/star/uno/XAggregation.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/proptypehlp.hxx> +#include <comphelper/property.hxx> +#include <comphelper/propagg.hxx> +#include <comphelper/stl_types.hxx> + +using namespace comphelper; + +//========================================================================= +//= property helper classes +//========================================================================= + +//... namespace frm ....................................................... +namespace frm +{ +//......................................................................... + +//================================================================== +//= assigment property handle <-> property name +//= used by the PropertySetAggregationHelper +//================================================================== + +class PropertyInfoService +{ + //.................................................................. + struct PropertyAssignment + { + ::rtl::OUString sName; + sal_Int32 nHandle; + + PropertyAssignment() { nHandle = -1; } + PropertyAssignment(const PropertyAssignment& _rSource) + :sName(_rSource.sName), nHandle(_rSource.nHandle) { } + PropertyAssignment(const ::rtl::OUString& _rName, sal_Int32 _nHandle) + :sName(_rName), nHandle(_nHandle) { } + + }; + + DECLARE_STL_VECTOR(PropertyAssignment, PropertyMap); + static PropertyMap s_AllKnownProperties; + + //.................................................................. + // comparing two PropertyAssignment's +public: + typedef PropertyAssignment PUBLIC_SOLARIS_COMPILER_HACK; + // did not get the following compiled under with SUNPRO 5 without this + // public typedef +private: + friend struct PropertyAssignmentNameCompareLess; + typedef ::std::binary_function< PUBLIC_SOLARIS_COMPILER_HACK, PUBLIC_SOLARIS_COMPILER_HACK, sal_Bool > PropertyAssignmentNameCompareLess_Base; + struct PropertyAssignmentNameCompareLess : public PropertyAssignmentNameCompareLess_Base + { + inline sal_Bool operator() (const PUBLIC_SOLARIS_COMPILER_HACK& _rL, const PUBLIC_SOLARIS_COMPILER_HACK& _rR) const + { + return (_rL.sName.compareTo(_rR.sName) < 0); + } + }; + +public: + PropertyInfoService() { } + +public: + static sal_Int32 getPropertyId(const ::rtl::OUString& _rName); + static ::rtl::OUString getPropertyName(sal_Int32 _nHandle); + +private: + static void initialize(); +}; + +//.................................................................. +// a class implementing the comphelper::IPropertyInfoService +class ConcreteInfoService : public ::comphelper::IPropertyInfoService +{ +public: + virtual sal_Int32 getPreferedPropertyId(const ::rtl::OUString& _rName); +}; + +//------------------------------------------------------------------------------ +#define DECL_PROP_IMPL(varname, type) \ + *pProperties++ = com::sun::star::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< type* >(NULL)), + +//------------------------------------------------------------------------------ +#define DECL_BOOL_PROP_IMPL(varname) \ + *pProperties++ = com::sun::star::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, ::getBooleanCppuType(), + +//------------------------------------------------------------------------------ +#define DECL_IFACE_PROP_IMPL(varname, type) \ + *pProperties++ = com::sun::star::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< com::sun::star::uno::Reference< type >* >(NULL)), + +//------------------------------------------------------------------------------ +#define BEGIN_DESCRIBE_PROPERTIES( count, baseclass ) \ + baseclass::describeFixedProperties( _rProps ); \ + sal_Int32 nOldCount = _rProps.getLength(); \ + _rProps.realloc( nOldCount + ( count ) ); \ + ::com::sun::star::beans::Property* pProperties = _rProps.getArray() + nOldCount; \ + +//------------------------------------------------------------------------------ +#define BEGIN_DESCRIBE_BASE_PROPERTIES( count ) \ + _rProps.realloc( count ); \ + ::com::sun::star::beans::Property* pProperties = _rProps.getArray(); \ + +//------------------------------------------------------------------------------ +#define BEGIN_DESCRIBE_AGGREGATION_PROPERTIES( count, aggregate ) \ + _rProps.realloc( count ); \ + ::com::sun::star::beans::Property* pProperties = _rProps.getArray(); \ + \ + if (aggregate.is()) \ + _rAggregateProps = aggregate->getPropertySetInfo()->getProperties(); \ + +// === +//------------------------------------------------------------------------------ +#define DECL_PROP0(varname, type) \ + DECL_PROP_IMPL(varname, type) 0) + +//------------------------------------------------------------------------------ +#define DECL_PROP1(varname, type, attrib1) \ + DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1) + +//------------------------------------------------------------------------------ +#define DECL_PROP2(varname, type, attrib1, attrib2) \ + DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2) + +//------------------------------------------------------------------------------ +#define DECL_PROP3(varname, type, attrib1, attrib2, attrib3) \ + DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2 | com::sun::star::beans::PropertyAttribute::attrib3) + +//------------------------------------------------------------------------------ +#define DECL_PROP4(varname, type, attrib1, attrib2, attrib3, attrib4) \ + DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2 | com::sun::star::beans::PropertyAttribute::attrib3 | com::sun::star::beans::PropertyAttribute::attrib4) + +// === some property types require special handling +// === such as interfaces +//------------------------------------------------------------------------------ +#define DECL_IFACE_PROP0(varname, type) \ + DECL_IFACE_PROP_IMPL(varname, type) 0) + +//------------------------------------------------------------------------------ +#define DECL_IFACE_PROP1(varname, type, attrib1) \ + DECL_IFACE_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1) + +//------------------------------------------------------------------------------ +#define DECL_IFACE_PROP2(varname, type, attrib1, attrib2) \ + DECL_IFACE_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2) + +//------------------------------------------------------------------------------ +#define DECL_IFACE_PROP3(varname, type, attrib1, attrib2, attrib3) \ + DECL_IFACE_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1 | starbeans::PropertyAttribute::attrib2 | starbeans::PropertyAttribute::attrib3) + +//------------------------------------------------------------------------------ +#define DECL_IFACE_PROP4(varname, type, attrib1, attrib2, attrib3, attrib4) \ + DECL_IFACE_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1 | starbeans::PropertyAttribute::attrib2 | starbeans::PropertyAttribute::attrib3 | PropertyAttribute::attrib4) + +// === or Boolean properties +//------------------------------------------------------------------------------ +#define DECL_BOOL_PROP0(varname) \ + DECL_BOOL_PROP_IMPL(varname) 0) + +//------------------------------------------------------------------------------ +#define DECL_BOOL_PROP1(varname, attrib1) \ + DECL_BOOL_PROP_IMPL(varname) com::sun::star::beans::PropertyAttribute::attrib1) + +//------------------------------------------------------------------------------ +#define DECL_BOOL_PROP2(varname, attrib1, attrib2) \ + DECL_BOOL_PROP_IMPL(varname) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2) + +//------------------------------------------------------------------------------ +#define DECL_BOOL_PROP3( varname, attrib1, attrib2, attrib3 ) \ + DECL_BOOL_PROP_IMPL(varname) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2 | com::sun::star::beans::PropertyAttribute::attrib3 ) + +// === +//------------------------------------------------------------------------------ +#define END_DESCRIBE_PROPERTIES() \ + DBG_ASSERT( pProperties == _rProps.getArray() + _rProps.getLength(), "<...>::describeFixedProperties/getInfoHelper: forgot to adjust the count ?"); \ + +//============================================================================== +//------------------------------------------------------------------------------ +#define REGISTER_PROP_1( prop, member, attrib1 ) \ + registerProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::attrib1, \ + &member, ::getCppuType( &member ) ); + +#define REGISTER_PROP_2( prop, member, attrib1, attrib2 ) \ + registerProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::attrib1 | PropertyAttribute::attrib2, \ + &member, ::getCppuType( &member ) ); + +#define REGISTER_PROP_3( prop, member, attrib1, attrib2, attrib3 ) \ + registerProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::attrib1 | PropertyAttribute::attrib2 | PropertyAttribute::attrib3, \ + &member, ::getCppuType( &member ) ); + +//------------------------------------------------------------------------------ +#define REGISTER_VOID_PROP_1( prop, memberAny, type, attrib1 ) \ + registerMayBeVoidProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::MAYBEVOID | PropertyAttribute::attrib1, \ + &memberAny, ::getCppuType( static_cast< type* >( NULL ) ) ); + +#define REGISTER_VOID_PROP_2( prop, memberAny, type, attrib1, attrib2 ) \ + registerMayBeVoidProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::MAYBEVOID | PropertyAttribute::attrib1 | PropertyAttribute::attrib2, \ + &memberAny, ::getCppuType( static_cast< type* >( NULL ) ) ); + +//......................................................................... +} +//... namespace frm ....................................................... + +#endif // _FRM_PROPERTY_HXX_ + diff --git a/forms/source/inc/propertybaghelper.hxx b/forms/source/inc/propertybaghelper.hxx new file mode 100644 index 000000000000..9d135516f964 --- /dev/null +++ b/forms/source/inc/propertybaghelper.hxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FORMS_PROPERTYBAGHELPER_HXX +#define FORMS_PROPERTYBAGHELPER_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/PropertyValue.hpp> +/** === end UNO includes === **/ + +#include <comphelper/propertybag.hxx> +#include <comphelper/propagg.hxx> + +#include <boost/noncopyable.hpp> + +//........................................................................ +namespace frm +{ +//........................................................................ + + //==================================================================== + //= class IPropertyBagHelperContext + //==================================================================== + class SAL_NO_VTABLE IPropertyBagHelperContext + { + public: + virtual ::osl::Mutex& getMutex() = 0; + + virtual void describeFixedAndAggregateProperties( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _out_rFixedProperties, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _out_rAggregateProperties + ) const = 0; + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > + getPropertiesInterface() = 0; + }; + + //==================================================================== + //= class PropertyBagHelper + //==================================================================== + class PropertyBagHelper : public ::boost::noncopyable + { + private: + IPropertyBagHelperContext& m_rContext; + ::comphelper::OPropertyArrayAggregationHelper* m_pPropertyArrayHelper; + ::comphelper::PropertyBag m_aDynamicProperties; + bool m_bDisposed; + + public: + PropertyBagHelper( IPropertyBagHelperContext& _rContext ); + ~PropertyBagHelper(); + + // XComponent equivalent + void dispose(); + + // OPropertySetHelper equivalent + inline ::comphelper::OPropertyArrayAggregationHelper& getInfoHelper() const; + + // XPropertyContainer equivalent + void addProperty( const ::rtl::OUString& _rName, ::sal_Int16 _nAttributes, const ::com::sun::star::uno::Any& _rInitialValue ); + void removeProperty( const ::rtl::OUString& _rName ); + + // XPropertyAccess equivalent + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues(); + void setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rProps ); + + // forwards to m_aDynamicProperties + inline void getDynamicFastPropertyValue( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _out_rValue ) const; + inline bool convertDynamicFastPropertyValue( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rNewValue, ::com::sun::star::uno::Any& _out_rConvertedValue, ::com::sun::star::uno::Any& _out_rCurrentValue ) const; + inline void setDynamicFastPropertyValue( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ); + inline void getDynamicPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _out_rValue ) const; + inline bool hasDynamicPropertyByName( const ::rtl::OUString& _rName ) const; + inline bool hasDynamicPropertyByHandle( sal_Int32 _nHandle ) const; + + private: + void impl_nts_checkDisposed_throw() const; + + /** invalidates our property set info, so subsequent calls to impl_ts_getArrayHelper and thus + getInfoHelper will return a newly created instance + */ + void impl_nts_invalidatePropertySetInfo(); + + /** returns the IPropertyArrayHelper instance used by |this| + */ + ::comphelper::OPropertyArrayAggregationHelper& impl_ts_getArrayHelper() const; + + /** finds a free property handle + @param _rPropertyName + the name of the property to find a handle for. If possible, the handle as determined by + our ConcreteInfoService instance will be used + */ + sal_Int32 impl_findFreeHandle( const ::rtl::OUString& _rPropertyName ); + }; + + //-------------------------------------------------------------------- + inline ::comphelper::OPropertyArrayAggregationHelper& PropertyBagHelper::getInfoHelper() const + { + return impl_ts_getArrayHelper(); + } + + //-------------------------------------------------------------------- + inline void PropertyBagHelper::getDynamicFastPropertyValue( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _out_rValue ) const + { + m_aDynamicProperties.getFastPropertyValue( _nHandle, _out_rValue ); + } + + //-------------------------------------------------------------------- + inline bool PropertyBagHelper::convertDynamicFastPropertyValue( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rNewValue, ::com::sun::star::uno::Any& _out_rConvertedValue, ::com::sun::star::uno::Any& _out_rCurrentValue ) const + { + return m_aDynamicProperties.convertFastPropertyValue( _nHandle, _rNewValue, _out_rConvertedValue, _out_rCurrentValue ); + } + + //-------------------------------------------------------------------- + inline void PropertyBagHelper::setDynamicFastPropertyValue( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) + { + m_aDynamicProperties.setFastPropertyValue( _nHandle, _rValue ); + } + + //-------------------------------------------------------------------- + inline void PropertyBagHelper::getDynamicPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _out_rValue ) const + { + m_aDynamicProperties.getPropertyDefaultByHandle( _nHandle, _out_rValue ); + } + + //-------------------------------------------------------------------- + inline bool PropertyBagHelper::hasDynamicPropertyByName( const ::rtl::OUString& _rName ) const + { + return m_aDynamicProperties.hasPropertyByName( _rName ); + } + + //-------------------------------------------------------------------- + inline bool PropertyBagHelper::hasDynamicPropertyByHandle( sal_Int32 _nHandle ) const + { + return m_aDynamicProperties.hasPropertyByHandle( _nHandle ); + } + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_PROPERTYBAGHELPER_HXX + diff --git a/forms/source/inc/resettable.hxx b/forms/source/inc/resettable.hxx new file mode 100644 index 000000000000..1e743806fb23 --- /dev/null +++ b/forms/source/inc/resettable.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef FORMS_RESETTABLE_HXX +#define FORMS_RESETTABLE_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/form/XResetListener.hpp> +/** === end UNO includes === **/ + +#include <cppuhelper/interfacecontainer.hxx> + +namespace cppu +{ + class OWeakObject; +} + +//........................................................................ +namespace frm +{ +//........................................................................ + + //==================================================================== + //= ResetHelper + //==================================================================== + class ResetHelper + { + public: + ResetHelper( ::cppu::OWeakObject& _parent, ::osl::Mutex& _mutex ) + :m_rParent( _parent ) + ,m_aResetListeners( _mutex ) + { + } + + // XReset equivalents + void addResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& _listener ); + void removeResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& _listener ); + + // calling listeners + bool approveReset(); + void notifyResetted(); + void disposing(); + + private: + ::cppu::OWeakObject& m_rParent; + ::cppu::OInterfaceContainerHelper m_aResetListeners; + }; + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_RESETTABLE_HXX diff --git a/forms/source/inc/services.hxx b/forms/source/inc/services.hxx new file mode 100644 index 000000000000..9fcb5db408a1 --- /dev/null +++ b/forms/source/inc/services.hxx @@ -0,0 +1,233 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FRM_SERVICES_HXX_ +#define _FRM_SERVICES_HXX_ + +#include <rtl/ustring.hxx> +#include "frm_strings.hxx" + +//......................................................................... +namespace frm +{ +//......................................................................... + + FORMS_CONSTASCII_STRING( AWT_CONTROL_TEXTFIELD, "com.sun.star.awt.TextField" ); + + FORMS_CONSTASCII_STRING( VCL_CONTROL_EDIT, "stardiv.vcl.control.Edit" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_LISTBOX, "stardiv.vcl.control.ListBox" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_COMBOBOX, "stardiv.vcl.control.ComboBox" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_RADIOBUTTON, "stardiv.vcl.control.RadioButton" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_GROUPBOX, "stardiv.vcl.control.GroupBox" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_FIXEDTEXT, "stardiv.vcl.control.FixedText" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_COMMANDBUTTON, "stardiv.vcl.control.Button" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_CHECKBOX, "stardiv.vcl.control.CheckBox" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_IMAGEBUTTON, "stardiv.vcl.control.ImageButton" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_FILECONTROL, "stardiv.vcl.control.FileControl" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_TIMEFIELD, "stardiv.vcl.control.TimeField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_DATEFIELD, "stardiv.vcl.control.DateField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_NUMERICFIELD, "stardiv.vcl.control.NumericField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_CURRENCYFIELD, "stardiv.vcl.control.CurrencyField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_PATTERNFIELD, "stardiv.vcl.control.PatternField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_FORMATTEDFIELD, "stardiv.vcl.control.FormattedField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_IMAGECONTROL, "stardiv.vcl.control.ImageControl" ); + + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_EDIT, "stardiv.vcl.controlmodel.Edit" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_LISTBOX, "stardiv.vcl.controlmodel.ListBox" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_COMBOBOX, "stardiv.vcl.controlmodel.ComboBox" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_RADIOBUTTON, "stardiv.vcl.controlmodel.RadioButton" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_GROUPBOX, "stardiv.vcl.controlmodel.GroupBox" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_FIXEDTEXT, "stardiv.vcl.controlmodel.FixedText" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_COMMANDBUTTON, "stardiv.vcl.controlmodel.Button" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_CHECKBOX, "stardiv.vcl.controlmodel.CheckBox" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_IMAGEBUTTON, "stardiv.vcl.controlmodel.ImageButton" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_FILECONTROL, "stardiv.vcl.controlmodel.FileControl" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_TIMEFIELD, "stardiv.vcl.controlmodel.TimeField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_DATEFIELD, "stardiv.vcl.controlmodel.DateField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_NUMERICFIELD, "stardiv.vcl.controlmodel.NumericField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_CURRENCYFIELD, "stardiv.vcl.controlmodel.CurrencyField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_PATTERNFIELD, "stardiv.vcl.controlmodel.PatternField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_FORMATTEDFIELD, "stardiv.vcl.controlmodel.FormattedField" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_IMAGECONTROL, "stardiv.vcl.controlmodel.ImageControl" ); + + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_SCROLLBAR, "com.sun.star.awt.UnoControlScrollBarModel" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_SCROLLBAR, "com.sun.star.awt.UnoControlScrollBar" ); + FORMS_CONSTASCII_STRING( VCL_CONTROLMODEL_SPINBUTTON, "com.sun.star.awt.UnoControlSpinButtonModel" ); + FORMS_CONSTASCII_STRING( VCL_CONTROL_SPINBUTTON, "com.sun.star.awt.UnoControlSpinButton" ); + + // ----------------------- + // service names for compatibility + // ----------------------- + FORMS_CONSTASCII_STRING( FRM_COMPONENT_FORM, "stardiv.one.form.component.Form" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_EDIT, "stardiv.one.form.component.Edit" ); // compatibility + FORMS_CONSTASCII_STRING( FRM_COMPONENT_TEXTFIELD, "stardiv.one.form.component.TextField" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_LISTBOX, "stardiv.one.form.component.ListBox" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_COMBOBOX, "stardiv.one.form.component.ComboBox" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_RADIOBUTTON, "stardiv.one.form.component.RadioButton" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_GROUPBOX, "stardiv.one.form.component.GroupBox" ); // compatibility + FORMS_CONSTASCII_STRING( FRM_COMPONENT_FIXEDTEXT, "stardiv.one.form.component.FixedText" ); // compatibility + FORMS_CONSTASCII_STRING( FRM_COMPONENT_COMMANDBUTTON, "stardiv.one.form.component.CommandButton" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_CHECKBOX, "stardiv.one.form.component.CheckBox" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_GRID, "stardiv.one.form.component.Grid" ); // compatibility + FORMS_CONSTASCII_STRING( FRM_COMPONENT_GRIDCONTROL, "stardiv.one.form.component.GridControl" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_IMAGEBUTTON, "stardiv.one.form.component.ImageButton" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_FILECONTROL, "stardiv.one.form.component.FileControl" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_TIMEFIELD, "stardiv.one.form.component.TimeField" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_DATEFIELD, "stardiv.one.form.component.DateField" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_NUMERICFIELD, "stardiv.one.form.component.NumericField" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_CURRENCYFIELD, "stardiv.one.form.component.CurrencyField" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_PATTERNFIELD, "stardiv.one.form.component.PatternField" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_HIDDEN, "stardiv.one.form.component.Hidden" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_HIDDENCONTROL, "stardiv.one.form.component.HiddenControl" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_IMAGECONTROL, "stardiv.one.form.component.ImageControl" ); + FORMS_CONSTASCII_STRING( FRM_COMPONENT_FORMATTEDFIELD, "stardiv.one.form.component.FormattedField" ); + + // <compatibility_I> + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_COMMANDBUTTON, "stardiv.one.form.control.CommandButton" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_RADIOBUTTON, "stardiv.one.form.control.RadioButton" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_CHECKBOX, "stardiv.one.form.control.CheckBox" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_EDIT, "stardiv.one.form.control.Edit" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_LISTBOX, "stardiv.one.form.control.ListBox" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_COMBOBOX, "stardiv.one.form.control.ComboBox" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_GROUPBOX, "stardiv.one.form.control.GroupBox" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_TEXTFIELD, "stardiv.one.form.control.TextField" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_GRID, "stardiv.one.form.control.Grid" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_IMAGEBUTTON, "stardiv.one.form.control.ImageButton" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_TIMEFIELD, "stardiv.one.form.control.TimeField" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_DATEFIELD, "stardiv.one.form.control.DateField" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_NUMERICFIELD, "stardiv.one.form.control.NumericField" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_CURRENCYFIELD, "stardiv.one.form.control.CurrencyField" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_PATTERNFIELD, "stardiv.one.form.control.PatternField" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_IMAGECONTROL, "stardiv.one.form.control.ImageControl" ); + FORMS_CONSTASCII_STRING( STARDIV_ONE_FORM_CONTROL_FORMATTEDFIELD, "stardiv.one.form.control.FormattedField"); + // </compatibility_I> + + // ----------------------- + // new (sun) service names + // ----------------------- + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_FORM, "com.sun.star.form.component.Form" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_HTMLFORM, "com.sun.star.form.component.HTMLForm" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATAFORM, "com.sun.star.form.component.DataForm" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_TEXTFIELD, "com.sun.star.form.component.TextField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_LISTBOX, "com.sun.star.form.component.ListBox" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_COMBOBOX, "com.sun.star.form.component.ComboBox" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_RADIOBUTTON, "com.sun.star.form.component.RadioButton" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_GROUPBOX, "com.sun.star.form.component.GroupBox" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_FIXEDTEXT, "com.sun.star.form.component.FixedText" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_COMMANDBUTTON, "com.sun.star.form.component.CommandButton" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_CHECKBOX, "com.sun.star.form.component.CheckBox" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_GRIDCONTROL, "com.sun.star.form.component.GridControl" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_IMAGEBUTTON, "com.sun.star.form.component.ImageButton" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_FILECONTROL, "com.sun.star.form.component.FileControl" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_TIMEFIELD, "com.sun.star.form.component.TimeField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATEFIELD, "com.sun.star.form.component.DateField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_NUMERICFIELD, "com.sun.star.form.component.NumericField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_CURRENCYFIELD, "com.sun.star.form.component.CurrencyField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_PATTERNFIELD, "com.sun.star.form.component.PatternField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_HIDDENCONTROL, "com.sun.star.form.component.HiddenControl" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_FORMATTEDFIELD, "com.sun.star.form.component.FormattedField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_SCROLLBAR, "com.sun.star.form.component.ScrollBar" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_SPINBUTTON, "com.sun.star.form.component.SpinButton" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_RICHTEXTCONTROL, "com.sun.star.form.component.RichTextControl" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_NAVTOOLBAR, "com.sun.star.form.component.NavigationToolBar" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_SUBMITBUTTON, "com.sun.star.form.component.SubmitButton" ); + + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_IMAGECONTROL, "com.sun.star.form.component.DatabaseImageControl" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATABASE_RADIOBUTTON, "com.sun.star.form.component.DatabaseRadioButton" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATABASE_CHECKBOX, "com.sun.star.form.component.DatabaseCheckBox" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATABASE_LISTBOX, "com.sun.star.form.component.DatabaseListBox" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATABASE_COMBOBOX, "com.sun.star.form.component.DatabaseComboBox" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATABASE_FORMATTEDFIELD, "com.sun.star.form.component.DatabaseFormattedField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATABASE_TEXTFIELD, "com.sun.star.form.component.DatabaseTextField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATABASE_DATEFIELD, "com.sun.star.form.component.DatabaseDateField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATABASE_TIMEFIELD, "com.sun.star.form.component.DatabaseTimeField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATABASE_NUMERICFIELD, "com.sun.star.form.component.DatabaseNumericField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATABASE_CURRENCYFIELD, "com.sun.star.form.component.DatabaseCurrencyField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_COMPONENT_DATABASE_PATTERNFIELD, "com.sun.star.form.component.DatabasePatternField" ); + + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_TEXTFIELD, "com.sun.star.form.control.TextField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_LISTBOX, "com.sun.star.form.control.ListBox" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_COMBOBOX, "com.sun.star.form.control.ComboBox" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_RADIOBUTTON, "com.sun.star.form.control.RadioButton" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_GROUPBOX, "com.sun.star.form.control.GroupBox" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_FIXEDTEXT, "com.sun.star.form.control.FixedText" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_COMMANDBUTTON, "com.sun.star.form.control.CommandButton" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_CHECKBOX, "com.sun.star.form.control.CheckBox" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_GRIDCONTROL, "com.sun.star.form.control.GridControl" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_IMAGEBUTTON, "com.sun.star.form.control.ImageButton" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_TIMEFIELD, "com.sun.star.form.control.TimeField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_DATEFIELD, "com.sun.star.form.control.DateField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_NUMERICFIELD, "com.sun.star.form.control.NumericField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_CURRENCYFIELD, "com.sun.star.form.control.CurrencyField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_PATTERNFIELD, "com.sun.star.form.control.PatternField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_IMAGECONTROL, "com.sun.star.form.control.ImageControl" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_FORMATTEDFIELD, "com.sun.star.form.control.FormattedField" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_RICHTEXTCONTROL,"com.sun.star.form.control.RichTextControl" ); + FORMS_CONSTASCII_STRING( FRM_SUN_CONTROL_SUBMITBUTTON, "com.sun.star.form.control.SubmitButton" ); + + FORMS_CONSTASCII_STRING( FRM_SUN_FORMS_COLLECTION, "com.sun.star.form.Forms" ); + + FORMS_CONSTASCII_STRING( BINDABLE_DATABASE_CHECK_BOX, "com.sun.star.form.binding.BindableDatabaseCheckBox" ); + FORMS_CONSTASCII_STRING( BINDABLE_DATABASE_COMBO_BOX, "com.sun.star.form.binding.BindableDatabaseComboBox" ); + FORMS_CONSTASCII_STRING( BINDABLE_DATABASE_FORMATTED_FIELD,"com.sun.star.form.binding.BindableDatabaseFormattedField" ); + FORMS_CONSTASCII_STRING( BINDABLE_DATABASE_LIST_BOX, "com.sun.star.form.binding.BindableDatabaseListBox" ); + FORMS_CONSTASCII_STRING( BINDABLE_DATABASE_NUMERIC_FIELD, "com.sun.star.form.binding.BindableDatabaseNumericField" ); + FORMS_CONSTASCII_STRING( BINDABLE_DATABASE_RADIO_BUTTON, "com.sun.star.form.binding.BindableDatabaseRadioButton" ); + FORMS_CONSTASCII_STRING( BINDABLE_DATABASE_TEXT_FIELD, "com.sun.star.form.binding.BindableDatabaseTextField" ); + FORMS_CONSTASCII_STRING( BINDABLE_DATABASE_DATE_FIELD, "com.sun.star.form.binding.BindableDatabaseDateField" ); + FORMS_CONSTASCII_STRING( BINDABLE_DATABASE_TIME_FIELD, "com.sun.star.form.binding.BindableDatabaseTimeField" ); + + FORMS_CONSTASCII_STRING( BINDABLE_CONTROL_MODEL, "com.sun.star.form.binding.BindableControlModel" ); + FORMS_CONSTASCII_STRING( BINDABLE_INTEGER_VALUE_RANGE, "com.sun.star.form.binding.BindableIntegerValueRange" ); + FORMS_CONSTASCII_STRING( BINDABLE_DATA_AWARE_CONTROL_MODEL, "com.sun.star.form.binding.BindableDataAwareControlModel" ); + FORMS_CONSTASCII_STRING( DATA_AWARE_CONTROL_MODEL, "com.sun.star.form.binding.DataAwareControlModel" ); + FORMS_CONSTASCII_STRING( VALIDATABLE_CONTROL_MODEL, "com.sun.star.form.binding.ValidatableControlModel" ); + FORMS_CONSTASCII_STRING( VALIDATABLE_BINDABLE_CONTROL_MODEL,"com.sun.star.form.binding.ValidatableBindableControlModel" ); + + // ----------------------- + // common + // ----------------------- + FORMS_CONSTASCII_STRING( FRM_SUN_FORMCOMPONENT, "com.sun.star.form.FormComponent" ); + + // ----------------------- + // misc + // ----------------------- + FORMS_CONSTASCII_STRING( SRV_AWT_POINTER, "com.sun.star.awt.Pointer" ); + FORMS_CONSTASCII_STRING( SRV_AWT_IMAGEPRODUCER, "com.sun.star.awt.ImageProducer" ); + FORMS_CONSTASCII_STRING( FRM_NUMBER_FORMATTER, "com.sun.star.util.NumberFormatter" ); + FORMS_CONSTASCII_STRING( FRM_NUMBER_FORMATS_SUPPLIER, "com.sun.star.util.NumberFormatsSupplier" ); + + FORMS_CONSTASCII_STRING( SRV_SDB_ROWSET, "com.sun.star.sdb.RowSet" ); + FORMS_CONSTASCII_STRING( SRV_SDB_CONNECTION, "com.sun.star.sdb.Connection" ); + + +//......................................................................... +} // namespace frm +//......................................................................... + +#endif // _FRM_SERVICES_HXX_ + diff --git a/forms/source/inc/togglestate.hxx b/forms/source/inc/togglestate.hxx new file mode 100644 index 000000000000..30efa6f14ed5 --- /dev/null +++ b/forms/source/inc/togglestate.hxx @@ -0,0 +1,44 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef FORMS_TOGGLESTATE_HXX +#define FORMS_TOGGLESTATE_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +//........................................................................ +namespace frm +{ +//........................................................................ + + enum ToggleState { STATE_NOCHECK = 0, STATE_CHECK = 1, STATE_DONTKNOW = 2 }; + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_TOGGLESTATE_HXX diff --git a/forms/source/inc/urltransformer.hxx b/forms/source/inc/urltransformer.hxx new file mode 100644 index 000000000000..2e8bdf1f684a --- /dev/null +++ b/forms/source/inc/urltransformer.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FORMS_SOURCE_INC_URLTRANSFORMER_HXX +#define FORMS_SOURCE_INC_URLTRANSFORMER_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/util/URL.hpp> +/** === end UNO includes === **/ + +//........................................................................ +namespace frm +{ +//........................................................................ + + //==================================================================== + //= UrlTransformer + //==================================================================== + class UrlTransformer + { + private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xORB; + mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > + m_xTransformer; + mutable bool m_bTriedToCreateTransformer; + + public: + UrlTransformer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); + + /** returns an URL object for the given URL string + */ + ::com::sun::star::util::URL + getStrictURL( const ::rtl::OUString& _rURL ) const; + + /** returns an URL object for the given URL ASCII string + */ + ::com::sun::star::util::URL + getStrictURLFromAscii( const sal_Char* _pAsciiURL ) const; + + /** parses a given URL smartly, with a protocol given by ASCII string + */ + void + parseSmartWithAsciiProtocol( ::com::sun::star::util::URL& _rURL, const sal_Char* _pAsciiURL ) const; + + private: + /** ensures that we have an URLTransformer instance in <member>m_xTransformer</member> + + @return + <TRUE/> if and only if m_xTransformer is not <NULL/> + */ + bool implEnsureTransformer() const; + }; + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_SOURCE_INC_URLTRANSFORMER_HXX + diff --git a/forms/source/inc/windowstateguard.hxx b/forms/source/inc/windowstateguard.hxx new file mode 100644 index 000000000000..b4c93636f825 --- /dev/null +++ b/forms/source/inc/windowstateguard.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef FORMS_WINDOWSTATEGUARD_HXX +#define FORMS_WINDOWSTATEGUARD_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/awt/XWindow2.hpp> +#include <com/sun/star/awt/XControlModel.hpp> +/** === end UNO includes === **/ +#include <rtl/ref.hxx> + +//........................................................................ +namespace frm +{ +//........................................................................ + + //==================================================================== + //= WindowStateGuard + //==================================================================== + class WindowStateGuard_Impl; + + /** a helper class which monitors certain states of an XWindow2, and ensures + that they're consistent with respective properties at an XModel. + + For form controls, window states - such as "Enabled" - can be set by various + means. You can set the respective control model property, you can directly manipulate + the XWindow2, or the state can change implicitly due to VCL actions. In any case, + we need to ensure that the state does not contradict the model property "too much". + + As an example, consider a form control which, according to its model's property, is disabled. + Now when the parent VCL window of the control's VCL window is enabled, then the the control's + window is enabled, too - which contradicts the model property. + + A WindowStateGuard helps you preventing such inconsistent states. + + The class is not threadsafe. + */ + class WindowStateGuard + { + private: + ::rtl::Reference< WindowStateGuard_Impl > m_pImpl; + + public: + WindowStateGuard(); + ~WindowStateGuard(); + + void attach( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2 >& _rxWindow, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel + ); + }; + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_WINDOWSTATEGUARD_HXX + |