Linux x86 build fix
[LibreOffice.git] / extensions / source / propctrlr / propertycomposer.hxx
blob159d4378efbfbf6c5bb90c0960f4eecb5cae5433
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
23 #include "pcrcommon.hxx"
24 #include "composeduiupdate.hxx"
25 #include "formbrowsertools.hxx"
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/inspection/XPropertyHandler.hpp>
29 #include <com/sun/star/lang/DisposedException.hpp>
30 #include <com/sun/star/beans/UnknownPropertyException.hpp>
31 #include <com/sun/star/beans/PropertyVetoException.hpp>
32 #include <cppuhelper/compbase2.hxx>
33 #include <comphelper/broadcasthelper.hxx>
34 #include <comphelper/listenernotification.hxx>
36 #include <vector>
37 #include <set>
40 namespace pcr
45 //= PropertyComposer
47 typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::inspection::XPropertyHandler
48 , ::com::sun::star::beans::XPropertyChangeListener
49 > PropertyComposer_Base;
50 /** implements an <type>XPropertyHandler</type> which composes it's information
51 from a set of other property handlers
53 class PropertyComposer :public ::comphelper::OBaseMutex
54 ,public PropertyComposer_Base
55 ,public IPropertyExistenceCheck
57 public:
58 typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > >
59 HandlerArray;
61 private:
62 HandlerArray m_aSlaveHandlers;
63 ::std::unique_ptr< ComposedPropertyUIUpdate > m_pUIRequestComposer;
64 PropertyChangeListeners m_aPropertyListeners;
65 bool m_bSupportedPropertiesAreKnown;
66 PropertyBag m_aSupportedProperties;
68 public:
69 /** constructs an <type>XPropertyHandler</type> which composes it's information from a set
70 of other property handlers
72 @param _rSlaveHandlers
73 the set of slave handlers to invoke. Must not be <NULL/>
75 PropertyComposer( const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > >& _rSlaveHandlers );
77 public:
78 // XPropertyHandler overridables
79 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, std::exception) SAL_OVERRIDE;
80 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
81 virtual void SAL_CALL setPropertyValue( const OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::PropertyVetoException, std::exception) SAL_OVERRIDE;
82 virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const 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, std::exception) SAL_OVERRIDE;
84 virtual ::com::sun::star::beans::PropertyState
85 SAL_CALL getPropertyState( const OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >
89 SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 virtual ::com::sun::star::uno::Sequence< OUString >
91 SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
92 virtual ::com::sun::star::uno::Sequence< OUString >
93 SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 virtual ::com::sun::star::inspection::LineDescriptor
95 SAL_CALL describePropertyLine( const 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, std::exception) SAL_OVERRIDE;
96 virtual sal_Bool SAL_CALL isComposable( const OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 virtual ::com::sun::star::inspection::InteractiveSelectionResult
98 SAL_CALL onInteractivePropertySelection( const 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, std::exception) SAL_OVERRIDE;
99 virtual void SAL_CALL actuatingPropertyChanged( const 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, std::exception) SAL_OVERRIDE;
100 virtual sal_Bool SAL_CALL suspend( sal_Bool _bSuspend ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 // XComponent
103 DECLARE_XCOMPONENT()
104 virtual void SAL_CALL disposing() SAL_OVERRIDE;
106 // XPropertyChangeListener
107 virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 // XEventListener
110 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 // IPropertyExistenceCheck
113 virtual bool SAL_CALL hasPropertyByName( const OUString& _rName ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
115 private:
116 /** ensures that m_pUIRequestComposer exists
118 void impl_ensureUIRequestComposer( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI );
120 /** checks whether a given property exists in <member>m_aSupportedProperties</member>
122 bool impl_isSupportedProperty_nothrow( const OUString& _rPropertyName )
124 ::com::sun::star::beans::Property aDummy; aDummy.Name = _rPropertyName;
125 return m_aSupportedProperties.find( aDummy ) != m_aSupportedProperties.end();
128 private:
129 class MethodGuard;
130 friend class MethodGuard;
131 class MethodGuard : public ::osl::MutexGuard
133 public:
134 MethodGuard( PropertyComposer& _rInstance )
135 : ::osl::MutexGuard( _rInstance.m_aMutex )
137 if ( _rInstance.m_aSlaveHandlers.empty() )
138 throw ::com::sun::star::lang::DisposedException( OUString(), *(&_rInstance) );
144 } // namespace pcr
147 #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */