merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / source / propctrlr / propertycomposer.hxx
blob4a67c1da9e6d0753921da942f330bd4a61e478b4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
29 #define EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
31 #include "pcrcommon.hxx"
32 #include "formbrowsertools.hxx"
33 #include "composeduiupdate.hxx"
34 #include "formbrowsertools.hxx"
36 /** === begin UNO includes === **/
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <com/sun/star/inspection/XPropertyHandler.hpp>
39 #include <com/sun/star/lang/DisposedException.hpp>
40 /** === end UNO includes === **/
41 #include <cppuhelper/compbase2.hxx>
42 #include <comphelper/broadcasthelper.hxx>
43 #include <comphelper/listenernotification.hxx>
45 #include <vector>
46 #include <set>
48 //........................................................................
49 namespace pcr
51 //........................................................................
53 //====================================================================
54 //= PropertyComposer
55 //====================================================================
56 typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::inspection::XPropertyHandler
57 , ::com::sun::star::beans::XPropertyChangeListener
58 > PropertyComposer_Base;
59 /** implements an <type>XPropertyHandler</type> which composes it's information
60 from a set of other property handlers
62 class PropertyComposer :public PropertyComposer_Base
63 ,public ::comphelper::OBaseMutex
64 ,public IPropertyExistenceCheck
66 public:
67 typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > >
68 HandlerArray;
70 private:
71 HandlerArray m_aSlaveHandlers;
72 ::std::auto_ptr< ComposedPropertyUIUpdate > m_pUIRequestComposer;
73 PropertyChangeListeners m_aPropertyListeners;
74 bool m_bSupportedPropertiesAreKnown;
75 PropertyBag m_aSupportedProperties;
77 public:
78 /** constructs an <type>XPropertyHandler</type> which composes it's information from a set
79 of other property handlers
81 @param _rSlaveHandlers
82 the set of slave handlers to invoke. Must not be <NULL/>
84 PropertyComposer( const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > >& _rSlaveHandlers );
86 public:
87 // XPropertyHandler overridables
88 virtual void SAL_CALL inspect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIntrospectee ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
89 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
90 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
91 virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
92 virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
93 virtual ::com::sun::star::beans::PropertyState
94 SAL_CALL getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
95 virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
96 virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
97 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >
98 SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException);
99 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
100 SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException);
101 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
102 SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException);
103 virtual ::com::sun::star::inspection::LineDescriptor
104 SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
105 virtual ::sal_Bool SAL_CALL isComposable( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
106 virtual ::com::sun::star::inspection::InteractiveSelectionResult
107 SAL_CALL onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, ::com::sun::star::uno::Any& _rData, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
108 virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
109 virtual sal_Bool SAL_CALL suspend( sal_Bool _bSuspend ) throw (::com::sun::star::uno::RuntimeException);
111 // XComponent
112 DECLARE_XCOMPONENT()
113 virtual void SAL_CALL disposing();
115 // XPropertyChangeListener
116 virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
118 // XEventListener
119 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
121 // IPropertyExistenceCheck
122 virtual ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& _rName ) throw (::com::sun::star::uno::RuntimeException);
124 private:
125 /** ensures that m_pUIRequestComposer exists
127 void impl_ensureUIRequestComposer( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI );
129 /** checks whether a given property exists in <member>m_aSupportedProperties</member>
131 bool impl_isSupportedProperty_nothrow( const ::rtl::OUString& _rPropertyName )
133 ::com::sun::star::beans::Property aDummy; aDummy.Name = _rPropertyName;
134 return m_aSupportedProperties.find( aDummy ) != m_aSupportedProperties.end();
137 private:
138 class MethodGuard;
139 friend class MethodGuard;
140 class MethodGuard : public ::osl::MutexGuard
142 public:
143 MethodGuard( PropertyComposer& _rInstance )
144 : ::osl::MutexGuard( _rInstance.m_aMutex )
146 if ( _rInstance.m_aSlaveHandlers.empty() )
147 throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *(&_rInstance) );
152 //........................................................................
153 } // namespace pcr
154 //........................................................................
156 #endif // EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX