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 "formbrowsertools.hxx"
34 #include "composeduiupdate.hxx"
35 #include "formbrowsertools.hxx"
37 /** === begin UNO includes === **/
38 #include <com/sun/star/beans/XPropertySet.hpp>
39 #include <com/sun/star/inspection/XPropertyHandler.hpp>
40 #include <com/sun/star/lang/DisposedException.hpp>
41 /** === end UNO includes === **/
42 #include <cppuhelper/compbase2.hxx>
43 #include <comphelper/broadcasthelper.hxx>
44 #include <comphelper/listenernotification.hxx>
49 //........................................................................
52 //........................................................................
54 //====================================================================
56 //====================================================================
57 typedef ::cppu::WeakComponentImplHelper2
< ::com::sun::star::inspection::XPropertyHandler
58 , ::com::sun::star::beans::XPropertyChangeListener
59 > PropertyComposer_Base
;
60 /** implements an <type>XPropertyHandler</type> which composes it's information
61 from a set of other property handlers
63 class PropertyComposer
:public PropertyComposer_Base
64 ,public ::comphelper::OBaseMutex
65 ,public IPropertyExistenceCheck
68 typedef ::std::vector
< ::com::sun::star::uno::Reference
< ::com::sun::star::inspection::XPropertyHandler
> >
72 HandlerArray m_aSlaveHandlers
;
73 ::std::auto_ptr
< ComposedPropertyUIUpdate
> m_pUIRequestComposer
;
74 PropertyChangeListeners m_aPropertyListeners
;
75 bool m_bSupportedPropertiesAreKnown
;
76 PropertyBag m_aSupportedProperties
;
79 /** constructs an <type>XPropertyHandler</type> which composes it's information from a set
80 of other property handlers
82 @param _rSlaveHandlers
83 the set of slave handlers to invoke. Must not be <NULL/>
85 PropertyComposer( const ::std::vector
< ::com::sun::star::uno::Reference
< ::com::sun::star::inspection::XPropertyHandler
> >& _rSlaveHandlers
);
88 // XPropertyHandler overridables
89 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
);
90 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const ::rtl::OUString
& _rPropertyName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
91 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
);
92 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
);
93 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
);
94 virtual ::com::sun::star::beans::PropertyState
95 SAL_CALL
getPropertyState( const ::rtl::OUString
& _rPropertyName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
96 virtual void SAL_CALL
addPropertyChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& _rxListener
) throw (::com::sun::star::uno::RuntimeException
);
97 virtual void SAL_CALL
removePropertyChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& _rxListener
) throw (::com::sun::star::uno::RuntimeException
);
98 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
>
99 SAL_CALL
getSupportedProperties() throw (::com::sun::star::uno::RuntimeException
);
100 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
>
101 SAL_CALL
getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException
);
102 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
>
103 SAL_CALL
getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException
);
104 virtual ::com::sun::star::inspection::LineDescriptor
105 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
);
106 virtual ::sal_Bool SAL_CALL
isComposable( const ::rtl::OUString
& _rPropertyName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
107 virtual ::com::sun::star::inspection::InteractiveSelectionResult
108 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
);
109 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
);
110 virtual sal_Bool SAL_CALL
suspend( sal_Bool _bSuspend
) throw (::com::sun::star::uno::RuntimeException
);
114 virtual void SAL_CALL
disposing();
116 // XPropertyChangeListener
117 virtual void SAL_CALL
propertyChange( const ::com::sun::star::beans::PropertyChangeEvent
& evt
) throw (::com::sun::star::uno::RuntimeException
);
120 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
);
122 // IPropertyExistenceCheck
123 virtual ::sal_Bool SAL_CALL
hasPropertyByName( const ::rtl::OUString
& _rName
) throw (::com::sun::star::uno::RuntimeException
);
126 /** ensures that m_pUIRequestComposer exists
128 void impl_ensureUIRequestComposer( const ::com::sun::star::uno::Reference
< ::com::sun::star::inspection::XObjectInspectorUI
>& _rxInspectorUI
);
130 /** checks whether a given property exists in <member>m_aSupportedProperties</member>
132 bool impl_isSupportedProperty_nothrow( const ::rtl::OUString
& _rPropertyName
)
134 ::com::sun::star::beans::Property aDummy
; aDummy
.Name
= _rPropertyName
;
135 return m_aSupportedProperties
.find( aDummy
) != m_aSupportedProperties
.end();
140 friend class MethodGuard
;
141 class MethodGuard
: public ::osl::MutexGuard
144 MethodGuard( PropertyComposer
& _rInstance
)
145 : ::osl::MutexGuard( _rInstance
.m_aMutex
)
147 if ( _rInstance
.m_aSlaveHandlers
.empty() )
148 throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *(&_rInstance
) );
153 //........................................................................
155 //........................................................................
157 #endif // EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */