diff options
author | Noel Power <noel.power@novell.com> | 2010-11-03 23:10:43 +0000 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2010-11-03 23:10:43 +0000 |
commit | 3ba9edf4164eb231a3f4208c0b234456a2e34e58 (patch) | |
tree | 6306af95841957acda7eebbcf80ee97f199dcbeb /toolkit/inc | |
parent | febd9e0c181be958688b4b04313b4a2d75fb5b29 (diff) |
separation of new container controls and existing Dialog control & model
Diffstat (limited to 'toolkit/inc')
-rw-r--r-- | toolkit/inc/toolkit/controls/dialogcontrol.hxx | 178 |
1 files changed, 105 insertions, 73 deletions
diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx index db9f9ee41fe7..6adec8eeae4f 100644 --- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx +++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx @@ -78,6 +78,7 @@ public: typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >, ::rtl::OUString > UnoControlModelHolder; protected: + void updateUserFormChildren( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xAllChildren, const rtl::OUString& aName, ChildOperation Operation, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xTarget ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); typedef ::std::list< UnoControlModelHolder > UnoControlModelHolderList; // for grouping control models (XTabControllerModel::getGroupXXX) @@ -89,7 +90,6 @@ protected: friend struct FindControlModel; friend struct CompareControlModel; -protected: ContainerListenerMultiplexer maContainerListeners; ::cppu::OInterfaceContainerHelper maChangeListeners; UnoControlModelHolderList maModels; @@ -99,15 +99,15 @@ protected: ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj; bool mbAdjustingGraphic; -protected: - virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); UnoControlModelHolderList::iterator ImplFindElement( const ::rtl::OUString& rName ); - void updateUserFormChildren( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xAllChildren, const rtl::OUString& aName, ChildOperation Operation, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xTarget ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) ; public: - UnoControlDialogModel( bool bRegProps = true ); + // bRegProps = false => subclass will register its own props + UnoControlDialogModel( bool bRegProps = true ); UnoControlDialogModel( const UnoControlDialogModel& rModel ); ~UnoControlDialogModel(); @@ -130,6 +130,13 @@ public: ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException); sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::container::XIndexContainer, XIndexReplace, XIndexAcces + // void SAL_CALL replaceByIndex( sal_Int32 Index, 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) = 0; + // sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException) = 0; + // ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0; + // void SAL_CALL insertByIndex( sal_Int32 Index, 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) = 0; + // void SAL_CALL removeByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0; + // ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); ::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); @@ -179,11 +186,12 @@ public: protected: void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel ); void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel ); + // ::cppu::OPropertySetHelper + void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); + void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor ); void implUpdateGroupStructure(); - // ::cppu::OPropertySetHelper - void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); private: void AddRadioButtonToGroup ( const ::com::sun::star::uno::Reference< XControlModel >& rControlModel, @@ -194,6 +202,17 @@ private: ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups ); }; +// ---------------------------------------------------- +// class UnoDialogControl +// ---------------------------------------------------- +typedef ::cppu::ImplHelper6 < ::com::sun::star::container::XContainerListener + , ::com::sun::star::awt::XTopWindow + , ::com::sun::star::awt::XDialog2 + , ::com::sun::star::util::XChangesListener + , ::com::sun::star::util::XModifyListener + , ::com::sun::star::awt::XWindowListener + > UnoDialogControl_IBase; + class ResourceListener :public ::com::sun::star::util::XModifyListener, public ::cppu::OWeakObject, public ::cppu::BaseMutex @@ -222,78 +241,29 @@ class ResourceListener :public ::com::sun::star::util::XModifyListener, bool m_bListening; }; -typedef ::cppu::ImplHelper2< ::com::sun::star::container::XContainerListener, - ::com::sun::star::util::XChangesListener > - UnoDialogContainerControl_IBase; - -class UnoDialogContainerControl : public UnoControlContainer, public UnoDialogContainerControl_IBase -{ -protected: - bool mbSizeModified; - bool mbPosModified; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController; - void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName ); - void ImplRemoveControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ); - virtual void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl ); - -public: - UnoDialogContainerControl(); - ~UnoDialogContainerControl(); - - DECLIMPL_SERVICEINFO_DERIVED( UnoDialogContainerControl, UnoControlBase, "com.sun.star.awt.UnoDialogContainerControl" ) - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlContainer::queryInterface(rType); } - ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); } - void SAL_CALL release() throw() { OWeakAggObject::release(); } - - void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); - - void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::container::XContainerListener - void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XTypeProvider - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - - // XChangesListener - virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XControl - sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException); -protected: - virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException); - virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ); - virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ); -}; - - - -class UnoDialogControl :public UnoDialogContainerControl - ,public ::com::sun::star::awt::XTopWindow, public ::com::sun::star::awt::XDialog2, public ::com::sun::star::awt::XWindowListener +class UnoDialogControl :public UnoControlContainer + ,public UnoDialogControl_IBase { private: ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar > mxMenuBar; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener; TopWindowListenerMultiplexer maTopWindowListeners; bool mbWindowListener; - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener; + bool mbSizeModified; + bool mbPosModified; protected: void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName ); + void ImplRemoveControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ); + void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl ); void ImplUpdateResourceResolver(); void ImplStartListingForResourceEvents(); public: - UnoDialogControl(); - ~UnoDialogControl(); + UnoDialogControl(); ::rtl::OUString GetComponentServiceName(); ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlContainer::queryInterface(rType); } @@ -318,6 +288,11 @@ public: virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::container::XContainerListener + void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XDialog2 virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setHelpId( ::sal_Int32 Id ) throw (::com::sun::star::uno::RuntimeException); @@ -334,6 +309,10 @@ public: // ::com::sun::star::awt::XControl sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException); + + // XChangesListener + virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException); // XModifyListener virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); @@ -344,7 +323,61 @@ public: protected: virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException); virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc ); + protected: + virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ); + virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ); +}; + + +typedef ::cppu::ImplHelper2< ::com::sun::star::container::XContainerListener, + ::com::sun::star::util::XChangesListener > + UnoParentControl_IBase; + +class UnoParentControl : public UnoControlContainer, public UnoParentControl_IBase +{ +protected: + bool mbSizeModified; + bool mbPosModified; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController; + void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName ); + void ImplRemoveControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ); + virtual void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl ); + +public: + UnoParentControl(); + ~UnoParentControl(); + + DECLIMPL_SERVICEINFO_DERIVED( UnoParentControl, UnoControlBase, "com.sun.star.awt.UnoParentControl" ) + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlContainer::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); } + void SAL_CALL release() throw() { OWeakAggObject::release(); } + + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + + void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::container::XContainerListener + void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // XChangesListener + virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XControl + sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException); +protected: + virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException); + virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ); + virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ); }; class UnoMultiPageModel : public UnoControlDialogModel @@ -371,7 +404,7 @@ protected: }; -class UnoMultiPageControl : public UnoDialogContainerControl +class UnoMultiPageControl : public UnoParentControl ,public ::com::sun::star::awt::XSimpleTabController ,public ::com::sun::star::awt::XTabListener { @@ -383,8 +416,8 @@ public: ::rtl::OUString GetComponentServiceName(); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoDialogContainerControl, szServiceName_UnoMultiPageControl ) - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoDialogContainerControl::queryInterface(rType); } + DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoParentControl, szServiceName_UnoMultiPageControl ) + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoParentControl::queryInterface(rType); } ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); } void SAL_CALL release() throw() { OWeakAggObject::release(); } @@ -444,8 +477,7 @@ protected: }; - -class UnoPageControl : public UnoDialogContainerControl +class UnoPageControl : public UnoParentControl { public: UnoPageControl(); @@ -454,7 +486,7 @@ public: // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl, UnoDialogContainerControl, szServiceName_UnoPageControl ) + DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl, UnoParentControl, szServiceName_UnoPageControl ) }; class UnoFrameModel : public UnoControlDialogModel @@ -476,7 +508,7 @@ protected: ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); }; -class UnoFrameControl : public UnoDialogContainerControl +class UnoFrameControl : public UnoParentControl { protected: virtual void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl ); @@ -486,7 +518,7 @@ public: ::rtl::OUString GetComponentServiceName(); // ::com::sun::star::lang::XServiceInfo -DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl, UnoDialogContainerControl, szServiceName_UnoPageControl ) +DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl, UnoParentControl, szServiceName_UnoPageControl ) }; #endif // TOOLKIT_DIALOG_CONTROL_HXX |