Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
30 : : #define EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
31 : :
32 : : #include "pcrcommon.hxx"
33 : : #include "composeduiupdate.hxx"
34 : : #include "formbrowsertools.hxx"
35 : :
36 : : #include <com/sun/star/beans/XPropertySet.hpp>
37 : : #include <com/sun/star/inspection/XPropertyHandler.hpp>
38 : : #include <com/sun/star/lang/DisposedException.hpp>
39 : : #include <cppuhelper/compbase2.hxx>
40 : : #include <comphelper/broadcasthelper.hxx>
41 : : #include <comphelper/listenernotification.hxx>
42 : :
43 : : #include <vector>
44 : : #include <set>
45 : :
46 : : //........................................................................
47 : : namespace pcr
48 : : {
49 : : //........................................................................
50 : :
51 : : //====================================================================
52 : : //= PropertyComposer
53 : : //====================================================================
54 : : typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::inspection::XPropertyHandler
55 : : , ::com::sun::star::beans::XPropertyChangeListener
56 : : > PropertyComposer_Base;
57 : : /** implements an <type>XPropertyHandler</type> which composes it's information
58 : : from a set of other property handlers
59 : : */
60 : 0 : class PropertyComposer :public PropertyComposer_Base
61 : : ,public ::comphelper::OBaseMutex
62 : : ,public IPropertyExistenceCheck
63 : : {
64 : : public:
65 : : typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > >
66 : : HandlerArray;
67 : :
68 : : private:
69 : : HandlerArray m_aSlaveHandlers;
70 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
71 : : ::std::auto_ptr< ComposedPropertyUIUpdate > m_pUIRequestComposer;
72 : : SAL_WNODEPRECATED_DECLARATIONS_POP
73 : : PropertyChangeListeners m_aPropertyListeners;
74 : : bool m_bSupportedPropertiesAreKnown;
75 : : PropertyBag m_aSupportedProperties;
76 : :
77 : : public:
78 : : /** constructs an <type>XPropertyHandler</type> which composes it's information from a set
79 : : of other property handlers
80 : :
81 : : @param _rSlaveHandlers
82 : : the set of slave handlers to invoke. Must not be <NULL/>
83 : : */
84 : : PropertyComposer( const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > >& _rSlaveHandlers );
85 : :
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);
110 : :
111 : : // XComponent
112 : : DECLARE_XCOMPONENT()
113 : : virtual void SAL_CALL disposing();
114 : :
115 : : // XPropertyChangeListener
116 : : virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
117 : :
118 : : // XEventListener
119 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
120 : :
121 : : // IPropertyExistenceCheck
122 : : virtual ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& _rName ) throw (::com::sun::star::uno::RuntimeException);
123 : :
124 : : private:
125 : : /** ensures that m_pUIRequestComposer exists
126 : : */
127 : : void impl_ensureUIRequestComposer( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI );
128 : :
129 : : /** checks whether a given property exists in <member>m_aSupportedProperties</member>
130 : : */
131 : 0 : bool impl_isSupportedProperty_nothrow( const ::rtl::OUString& _rPropertyName )
132 : : {
133 : 0 : ::com::sun::star::beans::Property aDummy; aDummy.Name = _rPropertyName;
134 : 0 : return m_aSupportedProperties.find( aDummy ) != m_aSupportedProperties.end();
135 : : }
136 : :
137 : : private:
138 : : class MethodGuard;
139 : : friend class MethodGuard;
140 : 0 : class MethodGuard : public ::osl::MutexGuard
141 : : {
142 : : public:
143 : 0 : MethodGuard( PropertyComposer& _rInstance )
144 : 0 : : ::osl::MutexGuard( _rInstance.m_aMutex )
145 : : {
146 : 0 : if ( _rInstance.m_aSlaveHandlers.empty() )
147 : 0 : throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *(&_rInstance) );
148 : 0 : }
149 : : };
150 : : };
151 : :
152 : : //........................................................................
153 : : } // namespace pcr
154 : : //........................................................................
155 : :
156 : : #endif // EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
157 : :
158 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|