Bump for 3.6-28
[LibreOffice.git] / extensions / source / propctrlr / propertycomposer.hxx
blobcbfd8c8209121e5d6965e5ca8aadb87b9562149c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
30 #define EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
32 #include "pcrcommon.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 SAL_WNODEPRECATED_DECLARATIONS_PUSH
73 ::std::auto_ptr< ComposedPropertyUIUpdate > m_pUIRequestComposer;
74 SAL_WNODEPRECATED_DECLARATIONS_POP
75 PropertyChangeListeners m_aPropertyListeners;
76 bool m_bSupportedPropertiesAreKnown;
77 PropertyBag m_aSupportedProperties;
79 public:
80 /** constructs an <type>XPropertyHandler</type> which composes it's information from a set
81 of other property handlers
83 @param _rSlaveHandlers
84 the set of slave handlers to invoke. Must not be <NULL/>
86 PropertyComposer( const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > >& _rSlaveHandlers );
88 public:
89 // XPropertyHandler overridables
90 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);
91 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
92 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);
93 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);
94 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);
95 virtual ::com::sun::star::beans::PropertyState
96 SAL_CALL getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
97 virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
98 virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
99 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >
100 SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException);
101 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
102 SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException);
103 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
104 SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException);
105 virtual ::com::sun::star::inspection::LineDescriptor
106 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);
107 virtual ::sal_Bool SAL_CALL isComposable( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
108 virtual ::com::sun::star::inspection::InteractiveSelectionResult
109 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);
110 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);
111 virtual sal_Bool SAL_CALL suspend( sal_Bool _bSuspend ) throw (::com::sun::star::uno::RuntimeException);
113 // XComponent
114 DECLARE_XCOMPONENT()
115 virtual void SAL_CALL disposing();
117 // XPropertyChangeListener
118 virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
120 // XEventListener
121 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
123 // IPropertyExistenceCheck
124 virtual ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& _rName ) throw (::com::sun::star::uno::RuntimeException);
126 private:
127 /** ensures that m_pUIRequestComposer exists
129 void impl_ensureUIRequestComposer( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI );
131 /** checks whether a given property exists in <member>m_aSupportedProperties</member>
133 bool impl_isSupportedProperty_nothrow( const ::rtl::OUString& _rPropertyName )
135 ::com::sun::star::beans::Property aDummy; aDummy.Name = _rPropertyName;
136 return m_aSupportedProperties.find( aDummy ) != m_aSupportedProperties.end();
139 private:
140 class MethodGuard;
141 friend class MethodGuard;
142 class MethodGuard : public ::osl::MutexGuard
144 public:
145 MethodGuard( PropertyComposer& _rInstance )
146 : ::osl::MutexGuard( _rInstance.m_aMutex )
148 if ( _rInstance.m_aSlaveHandlers.empty() )
149 throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *(&_rInstance) );
154 //........................................................................
155 } // namespace pcr
156 //........................................................................
158 #endif // EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */