1*2a97ec55SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*2a97ec55SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*2a97ec55SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*2a97ec55SAndrew Rist * distributed with this work for additional information
6*2a97ec55SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*2a97ec55SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*2a97ec55SAndrew Rist * "License"); you may not use this file except in compliance
9*2a97ec55SAndrew Rist * with the License. You may obtain a copy of the License at
10*2a97ec55SAndrew Rist *
11*2a97ec55SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*2a97ec55SAndrew Rist *
13*2a97ec55SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*2a97ec55SAndrew Rist * software distributed under the License is distributed on an
15*2a97ec55SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2a97ec55SAndrew Rist * KIND, either express or implied. See the License for the
17*2a97ec55SAndrew Rist * specific language governing permissions and limitations
18*2a97ec55SAndrew Rist * under the License.
19*2a97ec55SAndrew Rist *
20*2a97ec55SAndrew Rist *************************************************************/
21*2a97ec55SAndrew Rist
22*2a97ec55SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_extensions.hxx"
26cdf0e10cSrcweir #include "genericpropertyhandler.hxx"
27cdf0e10cSrcweir #include "formmetadata.hxx"
28cdf0e10cSrcweir #include "handlerhelper.hxx"
29cdf0e10cSrcweir
30cdf0e10cSrcweir /** === begin UNO includes === **/
31cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
32cdf0e10cSrcweir #include <com/sun/star/reflection/XEnumTypeDescription.hpp>
33cdf0e10cSrcweir #include <com/sun/star/beans/XIntrospection.hpp>
34cdf0e10cSrcweir #include <com/sun/star/inspection/PropertyControlType.hpp>
35cdf0e10cSrcweir #include <com/sun/star/inspection/XHyperlinkControl.hpp>
36cdf0e10cSrcweir #include <com/sun/star/awt/XActionListener.hpp>
37cdf0e10cSrcweir #include <com/sun/star/util/XURLTransformer.hpp>
38cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
39cdf0e10cSrcweir /** === end UNO includes === **/
40cdf0e10cSrcweir #include <tools/debug.hxx>
41cdf0e10cSrcweir #include <comphelper/extract.hxx>
42cdf0e10cSrcweir
43cdf0e10cSrcweir #include <algorithm>
44cdf0e10cSrcweir
45cdf0e10cSrcweir //------------------------------------------------------------------------
createRegistryInfo_GenericPropertyHandler()46cdf0e10cSrcweir extern "C" void SAL_CALL createRegistryInfo_GenericPropertyHandler()
47cdf0e10cSrcweir {
48cdf0e10cSrcweir ::pcr::OAutoRegistration< ::pcr::GenericPropertyHandler > aAutoRegistration;
49cdf0e10cSrcweir }
50cdf0e10cSrcweir
51cdf0e10cSrcweir //........................................................................
52cdf0e10cSrcweir namespace pcr
53cdf0e10cSrcweir {
54cdf0e10cSrcweir //........................................................................
55cdf0e10cSrcweir
56cdf0e10cSrcweir using namespace ::com::sun::star::uno;
57cdf0e10cSrcweir using namespace ::com::sun::star::beans;
58cdf0e10cSrcweir using namespace ::com::sun::star::script;
59cdf0e10cSrcweir using namespace ::com::sun::star::frame;
60cdf0e10cSrcweir using namespace ::com::sun::star::lang;
61cdf0e10cSrcweir using namespace ::com::sun::star::util;
62cdf0e10cSrcweir using namespace ::com::sun::star::container;
63cdf0e10cSrcweir using namespace ::com::sun::star::reflection;
64cdf0e10cSrcweir using namespace ::com::sun::star::inspection;
65cdf0e10cSrcweir using ::com::sun::star::awt::XActionListener;
66cdf0e10cSrcweir using ::com::sun::star::awt::ActionEvent;
67cdf0e10cSrcweir
68cdf0e10cSrcweir //====================================================================
69cdf0e10cSrcweir //= EnumRepresentation
70cdf0e10cSrcweir //====================================================================
71cdf0e10cSrcweir class EnumRepresentation : public IPropertyEnumRepresentation
72cdf0e10cSrcweir {
73cdf0e10cSrcweir private:
74cdf0e10cSrcweir oslInterlockedCount m_refCount;
75cdf0e10cSrcweir Reference< XEnumTypeDescription > m_xTypeDescription;
76cdf0e10cSrcweir Type m_aEnumType;
77cdf0e10cSrcweir
78cdf0e10cSrcweir public:
79cdf0e10cSrcweir EnumRepresentation( const Reference< XComponentContext >& _rxContext, const Type& _rEnumType );
80cdf0e10cSrcweir
81cdf0e10cSrcweir // IPropertyEnumRepresentation implementqation
82cdf0e10cSrcweir virtual ::std::vector< ::rtl::OUString >
83cdf0e10cSrcweir SAL_CALL getDescriptions() const;
84cdf0e10cSrcweir virtual void SAL_CALL getValueFromDescription( const ::rtl::OUString& _rDescription, ::com::sun::star::uno::Any& _out_rValue ) const;
85cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getDescriptionForValue( const ::com::sun::star::uno::Any& _rEnumValue ) const;
86cdf0e10cSrcweir
87cdf0e10cSrcweir // IReference implementqation
88cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL acquire();
89cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL release();
90cdf0e10cSrcweir
91cdf0e10cSrcweir private:
92cdf0e10cSrcweir void impl_getValues( Sequence< sal_Int32 >& _out_rValues ) const;
93cdf0e10cSrcweir
94cdf0e10cSrcweir private:
95cdf0e10cSrcweir EnumRepresentation(); // never implemented
96cdf0e10cSrcweir EnumRepresentation( const EnumRepresentation& ); // never implemented
97cdf0e10cSrcweir EnumRepresentation& operator=( const EnumRepresentation& ); // never implemented
98cdf0e10cSrcweir };
99cdf0e10cSrcweir
100cdf0e10cSrcweir //--------------------------------------------------------------------
EnumRepresentation(const Reference<XComponentContext> & _rxContext,const Type & _rEnumType)101cdf0e10cSrcweir EnumRepresentation::EnumRepresentation( const Reference< XComponentContext >& _rxContext, const Type& _rEnumType )
102cdf0e10cSrcweir :m_refCount( 0 )
103cdf0e10cSrcweir ,m_aEnumType( _rEnumType )
104cdf0e10cSrcweir {
105cdf0e10cSrcweir try
106cdf0e10cSrcweir {
107cdf0e10cSrcweir if ( _rxContext.is() )
108cdf0e10cSrcweir {
109cdf0e10cSrcweir Reference< XHierarchicalNameAccess > xTypeDescProv(
110cdf0e10cSrcweir _rxContext->getValueByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.reflection.theTypeDescriptionManager" ) ) ),
111cdf0e10cSrcweir UNO_QUERY_THROW );
112cdf0e10cSrcweir
113cdf0e10cSrcweir m_xTypeDescription = Reference< XEnumTypeDescription >( xTypeDescProv->getByHierarchicalName( m_aEnumType.getTypeName() ), UNO_QUERY_THROW );
114cdf0e10cSrcweir }
115cdf0e10cSrcweir }
116cdf0e10cSrcweir catch( const Exception& )
117cdf0e10cSrcweir {
118cdf0e10cSrcweir OSL_ENSURE( sal_False, "EnumRepresentation::EnumRepresentation: caught an exception!" );
119cdf0e10cSrcweir }
120cdf0e10cSrcweir }
121cdf0e10cSrcweir
122cdf0e10cSrcweir //--------------------------------------------------------------------
getDescriptions() const123cdf0e10cSrcweir ::std::vector< ::rtl::OUString > EnumRepresentation::getDescriptions() const
124cdf0e10cSrcweir {
125cdf0e10cSrcweir Sequence< ::rtl::OUString > aNames;
126cdf0e10cSrcweir try
127cdf0e10cSrcweir {
128cdf0e10cSrcweir if ( m_xTypeDescription.is() )
129cdf0e10cSrcweir aNames = m_xTypeDescription->getEnumNames();
130cdf0e10cSrcweir }
131cdf0e10cSrcweir catch( const Exception& )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir OSL_ENSURE( sal_False, "EnumRepresentation::getDescriptions: caught an exception!" );
134cdf0e10cSrcweir }
135cdf0e10cSrcweir
136cdf0e10cSrcweir return ::std::vector< ::rtl::OUString >( aNames.getConstArray(), aNames.getConstArray() + aNames.getLength() );
137cdf0e10cSrcweir }
138cdf0e10cSrcweir
139cdf0e10cSrcweir //--------------------------------------------------------------------
impl_getValues(Sequence<sal_Int32> & _out_rValues) const140cdf0e10cSrcweir void EnumRepresentation::impl_getValues( Sequence< sal_Int32 >& _out_rValues ) const
141cdf0e10cSrcweir {
142cdf0e10cSrcweir _out_rValues.realloc( 0 );
143cdf0e10cSrcweir try
144cdf0e10cSrcweir {
145cdf0e10cSrcweir if ( m_xTypeDescription.is() )
146cdf0e10cSrcweir _out_rValues = m_xTypeDescription->getEnumValues();
147cdf0e10cSrcweir }
148cdf0e10cSrcweir catch( const Exception& )
149cdf0e10cSrcweir {
150cdf0e10cSrcweir OSL_ENSURE( sal_False, "EnumRepresentation::impl_getValues: caught an exception!" );
151cdf0e10cSrcweir }
152cdf0e10cSrcweir }
153cdf0e10cSrcweir
154cdf0e10cSrcweir //--------------------------------------------------------------------
getValueFromDescription(const::rtl::OUString & _rDescription,Any & _out_rValue) const155cdf0e10cSrcweir void EnumRepresentation::getValueFromDescription( const ::rtl::OUString& _rDescription, Any& _out_rValue ) const
156cdf0e10cSrcweir {
157cdf0e10cSrcweir ::std::vector< ::rtl::OUString > aDescriptions( getDescriptions() );
158cdf0e10cSrcweir
159cdf0e10cSrcweir sal_Int32 index = ::std::find( aDescriptions.begin(), aDescriptions.end(),
160cdf0e10cSrcweir _rDescription ) - aDescriptions.begin();
161cdf0e10cSrcweir
162cdf0e10cSrcweir Sequence< sal_Int32 > aValues;
163cdf0e10cSrcweir impl_getValues( aValues );
164cdf0e10cSrcweir
165cdf0e10cSrcweir if ( ( index >= 0 ) && ( index < aValues.getLength() ) )
166cdf0e10cSrcweir _out_rValue = ::cppu::int2enum( aValues[ index ], m_aEnumType );
167cdf0e10cSrcweir else
168cdf0e10cSrcweir {
169cdf0e10cSrcweir DBG_ERROR( "EnumRepresentation::getValueFromDescription: cannot convert!" );
170cdf0e10cSrcweir _out_rValue.clear();
171cdf0e10cSrcweir }
172cdf0e10cSrcweir }
173cdf0e10cSrcweir
174cdf0e10cSrcweir //--------------------------------------------------------------------
getDescriptionForValue(const Any & _rEnumValue) const175cdf0e10cSrcweir ::rtl::OUString EnumRepresentation::getDescriptionForValue( const Any& _rEnumValue ) const
176cdf0e10cSrcweir {
177cdf0e10cSrcweir ::rtl::OUString sDescription;
178cdf0e10cSrcweir
179cdf0e10cSrcweir sal_Int32 nAsInt = 0;
180cdf0e10cSrcweir OSL_VERIFY( ::cppu::enum2int( nAsInt, _rEnumValue ) );
181cdf0e10cSrcweir
182cdf0e10cSrcweir Sequence< sal_Int32 > aValues;
183cdf0e10cSrcweir impl_getValues( aValues );
184cdf0e10cSrcweir
185cdf0e10cSrcweir sal_Int32 index = ::std::find( aValues.getConstArray(), aValues.getConstArray() + aValues.getLength(),
186cdf0e10cSrcweir nAsInt ) - aValues.getConstArray();
187cdf0e10cSrcweir
188cdf0e10cSrcweir ::std::vector< ::rtl::OUString > aDescriptions( getDescriptions() );
189cdf0e10cSrcweir if ( ( index >= 0 ) && ( index < (sal_Int32)aDescriptions.size() ) )
190cdf0e10cSrcweir sDescription = aDescriptions[ index ];
191cdf0e10cSrcweir else
192cdf0e10cSrcweir {
193cdf0e10cSrcweir DBG_ERROR( "EnumRepresentation::getDescriptionForValue: cannot convert!" );
194cdf0e10cSrcweir }
195cdf0e10cSrcweir return sDescription;
196cdf0e10cSrcweir }
197cdf0e10cSrcweir
198cdf0e10cSrcweir //--------------------------------------------------------------------
acquire()199cdf0e10cSrcweir oslInterlockedCount SAL_CALL EnumRepresentation::acquire()
200cdf0e10cSrcweir {
201cdf0e10cSrcweir return osl_incrementInterlockedCount( &m_refCount );
202cdf0e10cSrcweir }
203cdf0e10cSrcweir
204cdf0e10cSrcweir //--------------------------------------------------------------------
release()205cdf0e10cSrcweir oslInterlockedCount SAL_CALL EnumRepresentation::release()
206cdf0e10cSrcweir {
207cdf0e10cSrcweir if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
208cdf0e10cSrcweir {
209cdf0e10cSrcweir delete this;
210cdf0e10cSrcweir return 0;
211cdf0e10cSrcweir }
212cdf0e10cSrcweir return m_refCount;
213cdf0e10cSrcweir }
214cdf0e10cSrcweir
215cdf0e10cSrcweir //====================================================================
216cdf0e10cSrcweir //= UrlClickHandler
217cdf0e10cSrcweir //====================================================================
218cdf0e10cSrcweir typedef ::cppu::WeakImplHelper1 < XActionListener
219cdf0e10cSrcweir > UrlClickHandler_Base;
220cdf0e10cSrcweir class UrlClickHandler : public UrlClickHandler_Base
221cdf0e10cSrcweir {
222cdf0e10cSrcweir ComponentContext m_aContext;
223cdf0e10cSrcweir public:
224cdf0e10cSrcweir UrlClickHandler( const ComponentContext& _rContext, const Reference< XHyperlinkControl >& _rxControl );
225cdf0e10cSrcweir
226cdf0e10cSrcweir protected:
227cdf0e10cSrcweir ~UrlClickHandler();
228cdf0e10cSrcweir
229cdf0e10cSrcweir // XActionListener
230cdf0e10cSrcweir virtual void SAL_CALL actionPerformed( const ActionEvent& rEvent ) throw (RuntimeException);
231cdf0e10cSrcweir
232cdf0e10cSrcweir // XEventListener
233cdf0e10cSrcweir virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
234cdf0e10cSrcweir
235cdf0e10cSrcweir protected:
236cdf0e10cSrcweir void impl_dispatch_throw( const ::rtl::OUString& _rURL );
237cdf0e10cSrcweir };
238cdf0e10cSrcweir
239cdf0e10cSrcweir //--------------------------------------------------------------------
DBG_NAME(UrlClickHandler)240cdf0e10cSrcweir DBG_NAME( UrlClickHandler )
241cdf0e10cSrcweir //--------------------------------------------------------------------
242cdf0e10cSrcweir UrlClickHandler::UrlClickHandler( const ComponentContext& _rContext, const Reference< XHyperlinkControl >& _rxControl )
243cdf0e10cSrcweir :m_aContext( _rContext )
244cdf0e10cSrcweir {
245cdf0e10cSrcweir if ( !_rxControl.is() )
246cdf0e10cSrcweir throw NullPointerException();
247cdf0e10cSrcweir
248cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount );
249cdf0e10cSrcweir {
250cdf0e10cSrcweir _rxControl->addActionListener( this );
251cdf0e10cSrcweir }
252cdf0e10cSrcweir osl_decrementInterlockedCount( &m_refCount );
253cdf0e10cSrcweir OSL_ENSURE( m_refCount > 0, "UrlClickHandler::UrlClickHandler: leaking!" );
254cdf0e10cSrcweir
255cdf0e10cSrcweir DBG_CTOR( UrlClickHandler, NULL );
256cdf0e10cSrcweir }
257cdf0e10cSrcweir
258cdf0e10cSrcweir //--------------------------------------------------------------------
~UrlClickHandler()259cdf0e10cSrcweir UrlClickHandler::~UrlClickHandler()
260cdf0e10cSrcweir {
261cdf0e10cSrcweir DBG_DTOR( UrlClickHandler, NULL );
262cdf0e10cSrcweir }
263cdf0e10cSrcweir
264cdf0e10cSrcweir //--------------------------------------------------------------------
actionPerformed(const ActionEvent & rEvent)265cdf0e10cSrcweir void SAL_CALL UrlClickHandler::actionPerformed( const ActionEvent& rEvent ) throw (RuntimeException)
266cdf0e10cSrcweir {
267cdf0e10cSrcweir Reference< XPropertyControl > xControl( rEvent.Source, UNO_QUERY_THROW );
268cdf0e10cSrcweir Any aControlValue( xControl->getValue() );
269cdf0e10cSrcweir
270cdf0e10cSrcweir ::rtl::OUString sURL;
271cdf0e10cSrcweir if ( aControlValue.hasValue() && !( aControlValue >>= sURL ) )
272cdf0e10cSrcweir throw RuntimeException( ::rtl::OUString(), *this );
273cdf0e10cSrcweir
274cdf0e10cSrcweir if ( !sURL.getLength() )
275cdf0e10cSrcweir return;
276cdf0e10cSrcweir
277cdf0e10cSrcweir impl_dispatch_throw( sURL );
278cdf0e10cSrcweir }
279cdf0e10cSrcweir
280cdf0e10cSrcweir //--------------------------------------------------------------------
disposing(const EventObject &)281cdf0e10cSrcweir void SAL_CALL UrlClickHandler::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
282cdf0e10cSrcweir {
283cdf0e10cSrcweir // not interested in
284cdf0e10cSrcweir }
285cdf0e10cSrcweir
286cdf0e10cSrcweir //--------------------------------------------------------------------
impl_dispatch_throw(const::rtl::OUString & _rURL)287cdf0e10cSrcweir void UrlClickHandler::impl_dispatch_throw( const ::rtl::OUString& _rURL )
288cdf0e10cSrcweir {
289cdf0e10cSrcweir Reference< XURLTransformer > xTransformer( m_aContext.createComponent( "com.sun.star.util.URLTransformer" ), UNO_QUERY_THROW );
290cdf0e10cSrcweir URL aURL; aURL.Complete = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:OpenHyperlink" ) );
291cdf0e10cSrcweir xTransformer->parseStrict( aURL );
292cdf0e10cSrcweir
293cdf0e10cSrcweir Reference< XDispatchProvider > xDispProv( m_aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW );
294cdf0e10cSrcweir Reference< XDispatch > xDispatch( xDispProv->queryDispatch( aURL, ::rtl::OUString(), 0 ), UNO_QUERY_THROW );
295cdf0e10cSrcweir
296cdf0e10cSrcweir Sequence< PropertyValue > aDispatchArgs(1);
297cdf0e10cSrcweir aDispatchArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
298cdf0e10cSrcweir aDispatchArgs[0].Value <<= _rURL;
299cdf0e10cSrcweir
300cdf0e10cSrcweir xDispatch->dispatch( aURL, aDispatchArgs );
301cdf0e10cSrcweir }
302cdf0e10cSrcweir
303cdf0e10cSrcweir //====================================================================
304cdf0e10cSrcweir //= GenericPropertyHandler
305cdf0e10cSrcweir //====================================================================
DBG_NAME(GenericPropertyHandler)306cdf0e10cSrcweir DBG_NAME( GenericPropertyHandler )
307cdf0e10cSrcweir //--------------------------------------------------------------------
308cdf0e10cSrcweir GenericPropertyHandler::GenericPropertyHandler( const Reference< XComponentContext >& _rxContext )
309cdf0e10cSrcweir :GenericPropertyHandler_Base( m_aMutex )
310cdf0e10cSrcweir ,m_aContext( _rxContext )
311cdf0e10cSrcweir ,m_aPropertyListeners( m_aMutex )
312cdf0e10cSrcweir ,m_bPropertyMapInitialized( false )
313cdf0e10cSrcweir {
314cdf0e10cSrcweir DBG_CTOR( GenericPropertyHandler, NULL );
315cdf0e10cSrcweir
316cdf0e10cSrcweir m_xTypeConverter = Reference< XTypeConverter >(
317cdf0e10cSrcweir m_aContext.createComponent( "com.sun.star.script.Converter" ),
318cdf0e10cSrcweir UNO_QUERY_THROW
319cdf0e10cSrcweir );
320cdf0e10cSrcweir }
321cdf0e10cSrcweir
322cdf0e10cSrcweir //--------------------------------------------------------------------
~GenericPropertyHandler()323cdf0e10cSrcweir GenericPropertyHandler::~GenericPropertyHandler()
324cdf0e10cSrcweir {
325cdf0e10cSrcweir DBG_DTOR( GenericPropertyHandler, NULL );
326cdf0e10cSrcweir }
327cdf0e10cSrcweir
328cdf0e10cSrcweir //--------------------------------------------------------------------
getImplementationName()329cdf0e10cSrcweir ::rtl::OUString SAL_CALL GenericPropertyHandler::getImplementationName( ) throw (RuntimeException)
330cdf0e10cSrcweir {
331cdf0e10cSrcweir return getImplementationName_static();
332cdf0e10cSrcweir }
333cdf0e10cSrcweir
334cdf0e10cSrcweir //--------------------------------------------------------------------
supportsService(const::rtl::OUString & ServiceName)335cdf0e10cSrcweir ::sal_Bool SAL_CALL GenericPropertyHandler::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
336cdf0e10cSrcweir {
337cdf0e10cSrcweir StlSyntaxSequence< ::rtl::OUString > aAllServices( getSupportedServiceNames() );
338cdf0e10cSrcweir return ::std::find( aAllServices.begin(), aAllServices.end(), ServiceName ) != aAllServices.end();
339cdf0e10cSrcweir }
340cdf0e10cSrcweir
341cdf0e10cSrcweir //--------------------------------------------------------------------
getSupportedServiceNames()342cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL GenericPropertyHandler::getSupportedServiceNames( ) throw (RuntimeException)
343cdf0e10cSrcweir {
344cdf0e10cSrcweir return getSupportedServiceNames_static();
345cdf0e10cSrcweir }
346cdf0e10cSrcweir
347cdf0e10cSrcweir //--------------------------------------------------------------------
getImplementationName_static()348cdf0e10cSrcweir ::rtl::OUString SAL_CALL GenericPropertyHandler::getImplementationName_static( ) throw (RuntimeException)
349cdf0e10cSrcweir {
350cdf0e10cSrcweir return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.GenericPropertyHandler" ) );
351cdf0e10cSrcweir }
352cdf0e10cSrcweir
353cdf0e10cSrcweir //--------------------------------------------------------------------
getSupportedServiceNames_static()354cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL GenericPropertyHandler::getSupportedServiceNames_static( ) throw (RuntimeException)
355cdf0e10cSrcweir {
356cdf0e10cSrcweir Sequence< ::rtl::OUString > aSupported( 1 );
357cdf0e10cSrcweir aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.inspection.GenericPropertyHandler" ) );
358cdf0e10cSrcweir return aSupported;
359cdf0e10cSrcweir }
360cdf0e10cSrcweir
361cdf0e10cSrcweir //--------------------------------------------------------------------
Create(const Reference<XComponentContext> & _rxContext)362cdf0e10cSrcweir Reference< XInterface > SAL_CALL GenericPropertyHandler::Create( const Reference< XComponentContext >& _rxContext )
363cdf0e10cSrcweir {
364cdf0e10cSrcweir return *( new GenericPropertyHandler( _rxContext ) );
365cdf0e10cSrcweir }
366cdf0e10cSrcweir
367cdf0e10cSrcweir //--------------------------------------------------------------------
inspect(const Reference<XInterface> & _rxIntrospectee)368cdf0e10cSrcweir void SAL_CALL GenericPropertyHandler::inspect( const Reference< XInterface >& _rxIntrospectee ) throw (RuntimeException, NullPointerException)
369cdf0e10cSrcweir {
370cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex );
371cdf0e10cSrcweir
372cdf0e10cSrcweir if ( !_rxIntrospectee.is() )
373cdf0e10cSrcweir throw NullPointerException();
374cdf0e10cSrcweir
375cdf0e10cSrcweir // revoke old property change listeners
376cdf0e10cSrcweir ::cppu::OInterfaceIteratorHelper iterRemove( m_aPropertyListeners );
377cdf0e10cSrcweir ::cppu::OInterfaceIteratorHelper iterReAdd( m_aPropertyListeners ); // this holds a copy of the container ...
378cdf0e10cSrcweir while ( iterRemove.hasMoreElements() )
379cdf0e10cSrcweir m_xComponent->removePropertyChangeListener( ::rtl::OUString(), static_cast< XPropertyChangeListener* >( iterRemove.next() ) );
380cdf0e10cSrcweir
381cdf0e10cSrcweir m_xComponentIntrospectionAccess.clear();
382cdf0e10cSrcweir m_xComponent.clear();
383cdf0e10cSrcweir m_xPropertyState.clear();
384cdf0e10cSrcweir
385cdf0e10cSrcweir // create an introspection adapter for the component
386cdf0e10cSrcweir Reference< XIntrospection > xIntrospection;
387cdf0e10cSrcweir if ( !m_aContext.createComponent( "com.sun.star.beans.Introspection", xIntrospection ) )
388cdf0e10cSrcweir throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Could not create an instance of the service com.sun.star.beans.Introspection." ) ), *this );
389cdf0e10cSrcweir
390cdf0e10cSrcweir Reference< XIntrospectionAccess > xIntrospectionAccess( xIntrospection->inspect( makeAny( _rxIntrospectee ) ) );
391cdf0e10cSrcweir if ( !xIntrospectionAccess.is() )
392cdf0e10cSrcweir throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The introspection service could not handle the given component." ) ), *this );
393cdf0e10cSrcweir
394cdf0e10cSrcweir m_xComponent = Reference< XPropertySet >( xIntrospectionAccess->queryAdapter( XPropertySet::static_type() ), UNO_QUERY_THROW );
395cdf0e10cSrcweir // now that we survived so far, remember m_xComponentIntrospectionAccess
396cdf0e10cSrcweir m_xComponentIntrospectionAccess = xIntrospectionAccess;
397cdf0e10cSrcweir m_xPropertyState = m_xPropertyState.query( m_xComponent );
398cdf0e10cSrcweir
399cdf0e10cSrcweir m_bPropertyMapInitialized = false;
400cdf0e10cSrcweir m_aProperties.clear();
401cdf0e10cSrcweir
402cdf0e10cSrcweir // re-add the property change listeners
403cdf0e10cSrcweir while ( iterReAdd.hasMoreElements() )
404cdf0e10cSrcweir m_xComponent->addPropertyChangeListener( ::rtl::OUString(), static_cast< XPropertyChangeListener* >( iterReAdd.next() ) );
405cdf0e10cSrcweir }
406cdf0e10cSrcweir
407cdf0e10cSrcweir //--------------------------------------------------------------------
getPropertyValue(const::rtl::OUString & _rPropertyName)408cdf0e10cSrcweir Any SAL_CALL GenericPropertyHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException)
409cdf0e10cSrcweir {
410cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex );
411cdf0e10cSrcweir if ( !m_xComponent.is() )
412cdf0e10cSrcweir throw UnknownPropertyException();
413cdf0e10cSrcweir
414cdf0e10cSrcweir return m_xComponent->getPropertyValue( _rPropertyName );
415cdf0e10cSrcweir }
416cdf0e10cSrcweir
417cdf0e10cSrcweir //--------------------------------------------------------------------
setPropertyValue(const::rtl::OUString & _rPropertyName,const Any & _rValue)418cdf0e10cSrcweir void SAL_CALL GenericPropertyHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException)
419cdf0e10cSrcweir {
420cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex );
421cdf0e10cSrcweir if ( !m_xComponent.is() )
422cdf0e10cSrcweir throw UnknownPropertyException();
423cdf0e10cSrcweir
424cdf0e10cSrcweir m_xComponent->setPropertyValue( _rPropertyName, _rValue );
425cdf0e10cSrcweir }
426cdf0e10cSrcweir
427cdf0e10cSrcweir //--------------------------------------------------------------------
impl_getEnumConverter(const Type & _rEnumType)428cdf0e10cSrcweir ::rtl::Reference< IPropertyEnumRepresentation > GenericPropertyHandler::impl_getEnumConverter( const Type& _rEnumType )
429cdf0e10cSrcweir {
430cdf0e10cSrcweir ::rtl::Reference< IPropertyEnumRepresentation >& rConverter = m_aEnumConverters[ _rEnumType ];
431cdf0e10cSrcweir if ( !rConverter.is() )
432cdf0e10cSrcweir rConverter = new EnumRepresentation( m_aContext.getUNOContext(), _rEnumType );
433cdf0e10cSrcweir return rConverter;
434cdf0e10cSrcweir }
435cdf0e10cSrcweir
436cdf0e10cSrcweir //--------------------------------------------------------------------
convertToPropertyValue(const::rtl::OUString & _rPropertyName,const Any & _rControlValue)437cdf0e10cSrcweir Any SAL_CALL GenericPropertyHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException)
438cdf0e10cSrcweir {
439cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex );
440cdf0e10cSrcweir const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap();
441cdf0e10cSrcweir
442cdf0e10cSrcweir PropertyMap::const_iterator pos = m_aProperties.find( _rPropertyName );
443cdf0e10cSrcweir if ( pos == m_aProperties.end() )
444cdf0e10cSrcweir throw UnknownPropertyException();
445cdf0e10cSrcweir
446cdf0e10cSrcweir Any aPropertyValue;
447cdf0e10cSrcweir if ( !_rControlValue.hasValue() )
448cdf0e10cSrcweir // NULL is converted to NULL
449cdf0e10cSrcweir return aPropertyValue;
450cdf0e10cSrcweir
451cdf0e10cSrcweir if ( pos->second.Type.getTypeClass() == TypeClass_ENUM )
452cdf0e10cSrcweir {
453cdf0e10cSrcweir ::rtl::OUString sControlValue;
454cdf0e10cSrcweir OSL_VERIFY( _rControlValue >>= sControlValue );
455cdf0e10cSrcweir impl_getEnumConverter( pos->second.Type )->getValueFromDescription( sControlValue, aPropertyValue );
456cdf0e10cSrcweir }
457cdf0e10cSrcweir else
458cdf0e10cSrcweir aPropertyValue = PropertyHandlerHelper::convertToPropertyValue( m_aContext.getContext(),m_xTypeConverter, pos->second, _rControlValue );
459cdf0e10cSrcweir
460cdf0e10cSrcweir return aPropertyValue;
461cdf0e10cSrcweir }
462cdf0e10cSrcweir
463cdf0e10cSrcweir //--------------------------------------------------------------------
convertToControlValue(const::rtl::OUString & _rPropertyName,const Any & _rPropertyValue,const Type & _rControlValueType)464cdf0e10cSrcweir Any SAL_CALL GenericPropertyHandler::convertToControlValue( const ::rtl::OUString& _rPropertyName, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException)
465cdf0e10cSrcweir {
466cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex );
467cdf0e10cSrcweir const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap();
468cdf0e10cSrcweir
469cdf0e10cSrcweir PropertyMap::const_iterator pos = m_aProperties.find( _rPropertyName );
470cdf0e10cSrcweir if ( pos == m_aProperties.end() )
471cdf0e10cSrcweir throw UnknownPropertyException();
472cdf0e10cSrcweir
473cdf0e10cSrcweir Any aControlValue;
474cdf0e10cSrcweir if ( !_rPropertyValue.hasValue() )
475cdf0e10cSrcweir // NULL is converted to NULL
476cdf0e10cSrcweir return aControlValue;
477cdf0e10cSrcweir
478cdf0e10cSrcweir if ( pos->second.Type.getTypeClass() == TypeClass_ENUM )
479cdf0e10cSrcweir {
480cdf0e10cSrcweir aControlValue <<= impl_getEnumConverter( pos->second.Type )->getDescriptionForValue( _rPropertyValue );
481cdf0e10cSrcweir }
482cdf0e10cSrcweir else
483cdf0e10cSrcweir aControlValue = PropertyHandlerHelper::convertToControlValue( m_aContext.getContext(),m_xTypeConverter, _rPropertyValue, _rControlValueType );
484cdf0e10cSrcweir return aControlValue;
485cdf0e10cSrcweir }
486cdf0e10cSrcweir
487cdf0e10cSrcweir //--------------------------------------------------------------------
getPropertyState(const::rtl::OUString & _rPropertyName)488cdf0e10cSrcweir PropertyState SAL_CALL GenericPropertyHandler::getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException)
489cdf0e10cSrcweir {
490cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex );
491cdf0e10cSrcweir PropertyState eState = PropertyState_DIRECT_VALUE;
492cdf0e10cSrcweir if ( m_xPropertyState.is() )
493cdf0e10cSrcweir eState = m_xPropertyState->getPropertyState( _rPropertyName );
494cdf0e10cSrcweir return eState;
495cdf0e10cSrcweir }
496cdf0e10cSrcweir
497cdf0e10cSrcweir //--------------------------------------------------------------------
addPropertyChangeListener(const Reference<XPropertyChangeListener> & _rxListener)498cdf0e10cSrcweir void SAL_CALL GenericPropertyHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException)
499cdf0e10cSrcweir {
500cdf0e10cSrcweir if ( !_rxListener.is() )
501cdf0e10cSrcweir throw NullPointerException();
502cdf0e10cSrcweir
503cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex );
504cdf0e10cSrcweir m_aPropertyListeners.addInterface( _rxListener );
505cdf0e10cSrcweir if ( m_xComponent.is() )
506cdf0e10cSrcweir {
507cdf0e10cSrcweir try
508cdf0e10cSrcweir {
509cdf0e10cSrcweir m_xComponent->addPropertyChangeListener( ::rtl::OUString(), _rxListener );
510cdf0e10cSrcweir }
511cdf0e10cSrcweir catch( const UnknownPropertyException& )
512cdf0e10cSrcweir {
513cdf0e10cSrcweir OSL_ENSURE( false, "GenericPropertyHandler::addPropertyChangeListener:\nThe inspected component does not allow registering for all properties at once! This violates the interface contract!" );
514cdf0e10cSrcweir }
515cdf0e10cSrcweir }
516cdf0e10cSrcweir }
517cdf0e10cSrcweir
518cdf0e10cSrcweir //--------------------------------------------------------------------
removePropertyChangeListener(const Reference<XPropertyChangeListener> & _rxListener)519cdf0e10cSrcweir void SAL_CALL GenericPropertyHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException)
520cdf0e10cSrcweir {
521cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex );
522cdf0e10cSrcweir if ( m_xComponent.is() )
523cdf0e10cSrcweir {
524cdf0e10cSrcweir try
525cdf0e10cSrcweir {
526cdf0e10cSrcweir m_xComponent->removePropertyChangeListener( ::rtl::OUString(), _rxListener );
527cdf0e10cSrcweir }
528cdf0e10cSrcweir catch( const UnknownPropertyException& )
529cdf0e10cSrcweir {
530cdf0e10cSrcweir OSL_ENSURE( false, "GenericPropertyHandler::removePropertyChangeListener:\nThe inspected component does not allow de-registering for all properties at once! This violates the interface contract!" );
531cdf0e10cSrcweir }
532cdf0e10cSrcweir }
533cdf0e10cSrcweir m_aPropertyListeners.removeInterface( _rxListener );
534cdf0e10cSrcweir }
535cdf0e10cSrcweir
536cdf0e10cSrcweir //--------------------------------------------------------------------
impl_ensurePropertyMap()537cdf0e10cSrcweir void GenericPropertyHandler::impl_ensurePropertyMap()
538cdf0e10cSrcweir {
539cdf0e10cSrcweir if ( !m_bPropertyMapInitialized )
540cdf0e10cSrcweir {
541cdf0e10cSrcweir m_bPropertyMapInitialized = true;
542cdf0e10cSrcweir try
543cdf0e10cSrcweir {
544cdf0e10cSrcweir Reference< XPropertySetInfo > xPSI;
545cdf0e10cSrcweir if ( m_xComponent.is() )
546cdf0e10cSrcweir xPSI = m_xComponent->getPropertySetInfo();
547cdf0e10cSrcweir Sequence< Property > aProperties;
548cdf0e10cSrcweir if ( xPSI.is() )
549cdf0e10cSrcweir aProperties = xPSI->getProperties();
550cdf0e10cSrcweir DBG_ASSERT( aProperties.getLength(), "GenericPropertyHandler::getSupportedProperties: no properties!" );
551cdf0e10cSrcweir
552cdf0e10cSrcweir for ( const Property* pProperties = aProperties.getConstArray();
553cdf0e10cSrcweir pProperties != aProperties.getConstArray() + aProperties.getLength();
554cdf0e10cSrcweir ++pProperties
555cdf0e10cSrcweir )
556cdf0e10cSrcweir {
557cdf0e10cSrcweir switch ( pProperties->Type.getTypeClass() )
558cdf0e10cSrcweir {
559cdf0e10cSrcweir case TypeClass_BOOLEAN:
560cdf0e10cSrcweir case TypeClass_BYTE:
561cdf0e10cSrcweir case TypeClass_SHORT:
562cdf0e10cSrcweir case TypeClass_UNSIGNED_SHORT:
563cdf0e10cSrcweir case TypeClass_LONG:
564cdf0e10cSrcweir case TypeClass_UNSIGNED_LONG:
565cdf0e10cSrcweir case TypeClass_HYPER:
566cdf0e10cSrcweir case TypeClass_UNSIGNED_HYPER:
567cdf0e10cSrcweir case TypeClass_FLOAT:
568cdf0e10cSrcweir case TypeClass_DOUBLE:
569cdf0e10cSrcweir case TypeClass_ENUM:
570cdf0e10cSrcweir case TypeClass_STRING:
571cdf0e10cSrcweir // allowed, we can handle this type
572cdf0e10cSrcweir break;
573cdf0e10cSrcweir
574cdf0e10cSrcweir case TypeClass_SEQUENCE:
575cdf0e10cSrcweir {
576cdf0e10cSrcweir TypeClass eElementTypeClass = ::comphelper::getSequenceElementType( pProperties->Type ).getTypeClass();
577cdf0e10cSrcweir if ( ( eElementTypeClass != TypeClass_STRING )
578cdf0e10cSrcweir && ( eElementTypeClass != TypeClass_BYTE )
579cdf0e10cSrcweir && ( eElementTypeClass != TypeClass_SHORT )
580cdf0e10cSrcweir && ( eElementTypeClass != TypeClass_UNSIGNED_SHORT )
581cdf0e10cSrcweir && ( eElementTypeClass != TypeClass_LONG )
582cdf0e10cSrcweir && ( eElementTypeClass != TypeClass_UNSIGNED_LONG )
583cdf0e10cSrcweir )
584cdf0e10cSrcweir // can only handle the above
585cdf0e10cSrcweir continue;
586cdf0e10cSrcweir }
587cdf0e10cSrcweir break;
588cdf0e10cSrcweir
589cdf0e10cSrcweir default:
590cdf0e10cSrcweir // next property, we don't support this type
591cdf0e10cSrcweir continue;
592cdf0e10cSrcweir }
593cdf0e10cSrcweir
594cdf0e10cSrcweir m_aProperties.insert( PropertyMap::value_type( pProperties->Name, *pProperties ) );
595cdf0e10cSrcweir }
596cdf0e10cSrcweir }
597cdf0e10cSrcweir catch( const Exception& )
598cdf0e10cSrcweir {
599cdf0e10cSrcweir OSL_ENSURE( sal_False, "GenericPropertyHandler::impl_ensurePropertyMap: caught an exception!" );
600cdf0e10cSrcweir }
601cdf0e10cSrcweir }
602cdf0e10cSrcweir }
603cdf0e10cSrcweir
604cdf0e10cSrcweir //--------------------------------------------------------------------
getSupportedProperties()605cdf0e10cSrcweir Sequence< Property > SAL_CALL GenericPropertyHandler::getSupportedProperties() throw (RuntimeException)
606cdf0e10cSrcweir {
607cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex );
608cdf0e10cSrcweir const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap();
609cdf0e10cSrcweir
610cdf0e10cSrcweir Sequence< Property > aReturn( m_aProperties.size() );
611cdf0e10cSrcweir ::std::transform( m_aProperties.begin(), m_aProperties.end(),
612cdf0e10cSrcweir aReturn.getArray(), ::std::select2nd< PropertyMap::value_type >() );
613cdf0e10cSrcweir return aReturn;
614cdf0e10cSrcweir }
615cdf0e10cSrcweir
616cdf0e10cSrcweir //--------------------------------------------------------------------
getSupersededProperties()617cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL GenericPropertyHandler::getSupersededProperties( ) throw (RuntimeException)
618cdf0e10cSrcweir {
619cdf0e10cSrcweir // no superseded properties at all. This handler offers the very basic PropertyHandler
620cdf0e10cSrcweir // functionality, so it's much more likely that other handlers want to supersede
621cdf0e10cSrcweir // *our* properties ....
622cdf0e10cSrcweir return Sequence< ::rtl::OUString >( );
623cdf0e10cSrcweir }
624cdf0e10cSrcweir
625cdf0e10cSrcweir //--------------------------------------------------------------------
getActuatingProperties()626cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL GenericPropertyHandler::getActuatingProperties( ) throw (RuntimeException)
627cdf0e10cSrcweir {
628cdf0e10cSrcweir // This basic PropertyHandler implementation is too dumb^Wgeneric to know
629cdf0e10cSrcweir // anything about property dependencies
630cdf0e10cSrcweir return Sequence< ::rtl::OUString >( );
631cdf0e10cSrcweir }
632cdf0e10cSrcweir
633cdf0e10cSrcweir //--------------------------------------------------------------------
describePropertyLine(const::rtl::OUString & _rPropertyName,const Reference<XPropertyControlFactory> & _rxControlFactory)634cdf0e10cSrcweir LineDescriptor SAL_CALL GenericPropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName,
635cdf0e10cSrcweir const Reference< XPropertyControlFactory >& _rxControlFactory )
636cdf0e10cSrcweir throw (UnknownPropertyException, NullPointerException, RuntimeException)
637cdf0e10cSrcweir {
638cdf0e10cSrcweir if ( !_rxControlFactory.is() )
639cdf0e10cSrcweir throw NullPointerException();
640cdf0e10cSrcweir
641cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex );
642cdf0e10cSrcweir const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap();
643cdf0e10cSrcweir
644cdf0e10cSrcweir PropertyMap::const_iterator pos = m_aProperties.find( _rPropertyName );
645cdf0e10cSrcweir if ( pos == m_aProperties.end() )
646cdf0e10cSrcweir throw UnknownPropertyException();
647cdf0e10cSrcweir
648cdf0e10cSrcweir LineDescriptor aDescriptor;
649cdf0e10cSrcweir aDescriptor.DisplayName = _rPropertyName;
650cdf0e10cSrcweir switch ( pos->second.Type.getTypeClass() )
651cdf0e10cSrcweir {
652cdf0e10cSrcweir case TypeClass_ENUM:
653cdf0e10cSrcweir aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory,
654cdf0e10cSrcweir impl_getEnumConverter( pos->second.Type )->getDescriptions(),
655cdf0e10cSrcweir PropertyHandlerHelper::requiresReadOnlyControl( pos->second.Attributes ),
656cdf0e10cSrcweir sal_False );
657cdf0e10cSrcweir break;
658cdf0e10cSrcweir case TypeClass_STRING:
659cdf0e10cSrcweir {
660cdf0e10cSrcweir // some special handling for URL properties
661cdf0e10cSrcweir bool bIsURLProperty = ( _rPropertyName.getLength() >= 3 ) && _rPropertyName.matchAsciiL( "URL", 3, _rPropertyName.getLength() - 3 );
662cdf0e10cSrcweir if ( bIsURLProperty )
663cdf0e10cSrcweir {
664cdf0e10cSrcweir aDescriptor.Control = _rxControlFactory->createPropertyControl(
665cdf0e10cSrcweir PropertyControlType::HyperlinkField, PropertyHandlerHelper::requiresReadOnlyControl( pos->second.Attributes ) );
666cdf0e10cSrcweir
667cdf0e10cSrcweir Reference< XHyperlinkControl > xControl( aDescriptor.Control, UNO_QUERY_THROW );
668cdf0e10cSrcweir Reference< XActionListener > xEnsureDelete( new UrlClickHandler( m_aContext, xControl ) );
669cdf0e10cSrcweir }
670cdf0e10cSrcweir }
671cdf0e10cSrcweir break;
672cdf0e10cSrcweir default:
673cdf0e10cSrcweir break;
674cdf0e10cSrcweir }
675cdf0e10cSrcweir // fallback
676cdf0e10cSrcweir if ( !aDescriptor.Control.is() )
677cdf0e10cSrcweir PropertyHandlerHelper::describePropertyLine( pos->second, aDescriptor, _rxControlFactory );
678cdf0e10cSrcweir
679cdf0e10cSrcweir aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "General" ) );
680cdf0e10cSrcweir return aDescriptor;
681cdf0e10cSrcweir }
682cdf0e10cSrcweir
683cdf0e10cSrcweir //--------------------------------------------------------------------
isComposable(const::rtl::OUString &)684cdf0e10cSrcweir ::sal_Bool SAL_CALL GenericPropertyHandler::isComposable( const ::rtl::OUString& /*_rPropertyName*/ ) throw (UnknownPropertyException, RuntimeException)
685cdf0e10cSrcweir {
686cdf0e10cSrcweir return sal_False;
687cdf0e10cSrcweir }
688cdf0e10cSrcweir
689cdf0e10cSrcweir //--------------------------------------------------------------------
onInteractivePropertySelection(const::rtl::OUString &,sal_Bool,Any &,const Reference<XObjectInspectorUI> &)690cdf0e10cSrcweir InteractiveSelectionResult SAL_CALL GenericPropertyHandler::onInteractivePropertySelection( const ::rtl::OUString& /*_rPropertyName*/, sal_Bool /*_bPrimary*/, Any& /*_rData*/, const Reference< XObjectInspectorUI >& /*_rxInspectorUI*/ ) throw (UnknownPropertyException, NullPointerException, RuntimeException)
691cdf0e10cSrcweir {
692cdf0e10cSrcweir DBG_ERROR( "GenericPropertyHandler::onInteractivePropertySelection: I'm too dumb to know anything about property browse buttons!" );
693cdf0e10cSrcweir return InteractiveSelectionResult_Cancelled;
694cdf0e10cSrcweir }
695cdf0e10cSrcweir
696cdf0e10cSrcweir //--------------------------------------------------------------------
actuatingPropertyChanged(const::rtl::OUString &,const Any &,const Any &,const Reference<XObjectInspectorUI> &,sal_Bool)697cdf0e10cSrcweir void SAL_CALL GenericPropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& /*_rActuatingPropertyName*/, const Any& /*_rNewValue*/, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& /*_rxInspectorUI*/, sal_Bool /*_bFirstTimeInit*/ ) throw (NullPointerException, RuntimeException)
698cdf0e10cSrcweir {
699cdf0e10cSrcweir DBG_ERROR( "GenericPropertyHandler::actuatingPropertyChanged: no no no, I did not register for any actuating properties!" );
700cdf0e10cSrcweir }
701cdf0e10cSrcweir
702cdf0e10cSrcweir //--------------------------------------------------------------------
suspend(sal_Bool)703cdf0e10cSrcweir sal_Bool SAL_CALL GenericPropertyHandler::suspend( sal_Bool /*_bSuspend*/ ) throw (RuntimeException)
704cdf0e10cSrcweir {
705cdf0e10cSrcweir return sal_True;
706cdf0e10cSrcweir }
707cdf0e10cSrcweir
708cdf0e10cSrcweir //--------------------------------------------------------------------
disposing()709cdf0e10cSrcweir void SAL_CALL GenericPropertyHandler::disposing()
710cdf0e10cSrcweir {
711cdf0e10cSrcweir m_aPropertyListeners.clear();
712cdf0e10cSrcweir // not disposeAndClear: the listeners are (virtually) listeners at our introspectee, not
713cdf0e10cSrcweir // at this handler instance
714cdf0e10cSrcweir }
715cdf0e10cSrcweir
716cdf0e10cSrcweir //--------------------------------------------------------------------
717cdf0e10cSrcweir IMPLEMENT_FORWARD_XCOMPONENT( GenericPropertyHandler, GenericPropertyHandler_Base );
718cdf0e10cSrcweir
719cdf0e10cSrcweir //........................................................................
720cdf0e10cSrcweir } // namespace pcr
721cdf0e10cSrcweir //........................................................................
722cdf0e10cSrcweir
723