1*ac9096f4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ac9096f4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ac9096f4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ac9096f4SAndrew Rist  * distributed with this work for additional information
6*ac9096f4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ac9096f4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ac9096f4SAndrew Rist  * "License"); you may not use this file except in compliance
9*ac9096f4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ac9096f4SAndrew Rist  *
11*ac9096f4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ac9096f4SAndrew Rist  *
13*ac9096f4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ac9096f4SAndrew Rist  * software distributed under the License is distributed on an
15*ac9096f4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ac9096f4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*ac9096f4SAndrew Rist  * specific language governing permissions and limitations
18*ac9096f4SAndrew Rist  * under the License.
19*ac9096f4SAndrew Rist  *
20*ac9096f4SAndrew Rist  *************************************************************/
21*ac9096f4SAndrew Rist 
22*ac9096f4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_ucbhelper.hxx"
26cdf0e10cSrcweir /**************************************************************************
27cdf0e10cSrcweir 								TODO
28cdf0e10cSrcweir  **************************************************************************
29cdf0e10cSrcweir 
30cdf0e10cSrcweir  *************************************************************************/
31cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
32cdf0e10cSrcweir #include <com/sun/star/ucb/XPropertySetRegistry.hpp>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include "osl/diagnose.h"
35cdf0e10cSrcweir #include "osl/mutex.hxx"
36cdf0e10cSrcweir #include <ucbhelper/contenthelper.hxx>
37cdf0e10cSrcweir #include <ucbhelper/contentinfo.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir using namespace com::sun::star;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir //=========================================================================
42cdf0e10cSrcweir //=========================================================================
43cdf0e10cSrcweir //
44cdf0e10cSrcweir // PropertySetInfo Implementation.
45cdf0e10cSrcweir //
46cdf0e10cSrcweir //=========================================================================
47cdf0e10cSrcweir //=========================================================================
48cdf0e10cSrcweir 
49cdf0e10cSrcweir namespace ucbhelper {
50cdf0e10cSrcweir 
PropertySetInfo(const uno::Reference<lang::XMultiServiceFactory> & rxSMgr,const uno::Reference<com::sun::star::ucb::XCommandEnvironment> & rxEnv,ContentImplHelper * pContent)51cdf0e10cSrcweir PropertySetInfo::PropertySetInfo(
52cdf0e10cSrcweir     const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
53cdf0e10cSrcweir     const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv,
54cdf0e10cSrcweir     ContentImplHelper* pContent )
55cdf0e10cSrcweir : m_xSMgr( rxSMgr ),
56cdf0e10cSrcweir   m_xEnv( rxEnv ),
57cdf0e10cSrcweir   m_pProps( 0 ),
58cdf0e10cSrcweir   m_pContent( pContent )
59cdf0e10cSrcweir {
60cdf0e10cSrcweir }
61cdf0e10cSrcweir 
62cdf0e10cSrcweir //=========================================================================
63cdf0e10cSrcweir // virtual
~PropertySetInfo()64cdf0e10cSrcweir PropertySetInfo::~PropertySetInfo()
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 	delete m_pProps;
67cdf0e10cSrcweir }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir //=========================================================================
70cdf0e10cSrcweir //
71cdf0e10cSrcweir // XInterface methods.
72cdf0e10cSrcweir //
73cdf0e10cSrcweir //=========================================================================
74cdf0e10cSrcweir 
75cdf0e10cSrcweir XINTERFACE_IMPL_2( PropertySetInfo,
76cdf0e10cSrcweir 				   lang::XTypeProvider,
77cdf0e10cSrcweir 				   beans::XPropertySetInfo );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir //=========================================================================
80cdf0e10cSrcweir //
81cdf0e10cSrcweir // XTypeProvider methods.
82cdf0e10cSrcweir //
83cdf0e10cSrcweir //=========================================================================
84cdf0e10cSrcweir 
85cdf0e10cSrcweir XTYPEPROVIDER_IMPL_2( PropertySetInfo,
86cdf0e10cSrcweir 	 		   		  lang::XTypeProvider,
87cdf0e10cSrcweir 	 		   		  beans::XPropertySetInfo );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir //=========================================================================
90cdf0e10cSrcweir //
91cdf0e10cSrcweir // XPropertySetInfo methods.
92cdf0e10cSrcweir //
93cdf0e10cSrcweir //=========================================================================
94cdf0e10cSrcweir 
95cdf0e10cSrcweir // virtual
getProperties()96cdf0e10cSrcweir uno::Sequence< beans::Property > SAL_CALL PropertySetInfo::getProperties()
97cdf0e10cSrcweir 	throw( uno::RuntimeException )
98cdf0e10cSrcweir {
99cdf0e10cSrcweir 	if ( !m_pProps )
100cdf0e10cSrcweir 	{
101cdf0e10cSrcweir 		osl::MutexGuard aGuard( m_aMutex );
102cdf0e10cSrcweir 		if ( !m_pProps )
103cdf0e10cSrcweir 		{
104cdf0e10cSrcweir 			//////////////////////////////////////////////////////////////
105cdf0e10cSrcweir 			// Get info for core ( native) properties.
106cdf0e10cSrcweir 			//////////////////////////////////////////////////////////////
107cdf0e10cSrcweir 
108cdf0e10cSrcweir             try
109cdf0e10cSrcweir             {
110cdf0e10cSrcweir                 uno::Sequence< beans::Property > aProps
111cdf0e10cSrcweir                     = m_pContent->getProperties( m_xEnv );
112cdf0e10cSrcweir                 m_pProps = new uno::Sequence< beans::Property >( aProps );
113cdf0e10cSrcweir             }
114cdf0e10cSrcweir             catch ( uno::RuntimeException const & )
115cdf0e10cSrcweir             {
116cdf0e10cSrcweir                 throw;
117cdf0e10cSrcweir             }
118cdf0e10cSrcweir             catch ( uno::Exception const & )
119cdf0e10cSrcweir             {
120cdf0e10cSrcweir                 m_pProps = new uno::Sequence< beans::Property >( 0 );
121cdf0e10cSrcweir             }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 			//////////////////////////////////////////////////////////////
124cdf0e10cSrcweir 			// Get info for additional properties.
125cdf0e10cSrcweir 			//////////////////////////////////////////////////////////////
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 			uno::Reference< com::sun::star::ucb::XPersistentPropertySet >
128cdf0e10cSrcweir                 xSet ( m_pContent->getAdditionalPropertySet( sal_False ) );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 			if ( xSet.is() )
131cdf0e10cSrcweir 			{
132cdf0e10cSrcweir 				// Get property set info.
133cdf0e10cSrcweir 				uno::Reference< beans::XPropertySetInfo > xInfo(
134cdf0e10cSrcweir                     xSet->getPropertySetInfo() );
135cdf0e10cSrcweir 				if ( xInfo.is() )
136cdf0e10cSrcweir 				{
137cdf0e10cSrcweir 					const uno::Sequence< beans::Property >& rAddProps
138cdf0e10cSrcweir 						= xInfo->getProperties();
139cdf0e10cSrcweir 					sal_Int32 nAddProps = rAddProps.getLength();
140cdf0e10cSrcweir 					if ( nAddProps > 0 )
141cdf0e10cSrcweir 					{
142cdf0e10cSrcweir 						sal_Int32 nPos = m_pProps->getLength();
143cdf0e10cSrcweir 						m_pProps->realloc( nPos + nAddProps );
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 						beans::Property* pProps = m_pProps->getArray();
146cdf0e10cSrcweir 						const beans::Property* pAddProps
147cdf0e10cSrcweir                             = rAddProps.getConstArray();
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 						for ( sal_Int32 n = 0; n < nAddProps; ++n, ++nPos )
150cdf0e10cSrcweir 							pProps[ nPos ] = pAddProps[ n ];
151cdf0e10cSrcweir 					}
152cdf0e10cSrcweir 				}
153cdf0e10cSrcweir 			}
154cdf0e10cSrcweir 		}
155cdf0e10cSrcweir 	}
156cdf0e10cSrcweir 	return *m_pProps;
157cdf0e10cSrcweir }
158cdf0e10cSrcweir 
159cdf0e10cSrcweir //=========================================================================
160cdf0e10cSrcweir // virtual
getPropertyByName(const rtl::OUString & aName)161cdf0e10cSrcweir beans::Property SAL_CALL PropertySetInfo::getPropertyByName(
162cdf0e10cSrcweir         const rtl::OUString& aName )
163cdf0e10cSrcweir 	throw( beans::UnknownPropertyException, uno::RuntimeException )
164cdf0e10cSrcweir {
165cdf0e10cSrcweir 	beans::Property aProp;
166cdf0e10cSrcweir 	if ( queryProperty( aName, aProp ) )
167cdf0e10cSrcweir 		return aProp;
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	throw beans::UnknownPropertyException();
170cdf0e10cSrcweir }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir //=========================================================================
173cdf0e10cSrcweir // virtual
hasPropertyByName(const rtl::OUString & Name)174cdf0e10cSrcweir sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName(
175cdf0e10cSrcweir         const rtl::OUString& Name )
176cdf0e10cSrcweir 	throw( uno::RuntimeException )
177cdf0e10cSrcweir {
178cdf0e10cSrcweir 	beans::Property aProp;
179cdf0e10cSrcweir 	return queryProperty( Name, aProp );
180cdf0e10cSrcweir }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir //=========================================================================
183cdf0e10cSrcweir //
184cdf0e10cSrcweir // Non-Interface methods.
185cdf0e10cSrcweir //
186cdf0e10cSrcweir //=========================================================================
187cdf0e10cSrcweir 
reset()188cdf0e10cSrcweir void PropertySetInfo::reset()
189cdf0e10cSrcweir {
190cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_aMutex );
191cdf0e10cSrcweir 	delete m_pProps;
192cdf0e10cSrcweir 	m_pProps = 0;
193cdf0e10cSrcweir }
194cdf0e10cSrcweir 
195cdf0e10cSrcweir //=========================================================================
queryProperty(const rtl::OUString & rName,beans::Property & rProp)196cdf0e10cSrcweir sal_Bool PropertySetInfo::queryProperty(
197cdf0e10cSrcweir     const rtl::OUString& rName, beans::Property& rProp )
198cdf0e10cSrcweir {
199cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_aMutex );
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 	getProperties();
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 	const beans::Property* pProps = m_pProps->getConstArray();
204cdf0e10cSrcweir 	sal_Int32 nCount = m_pProps->getLength();
205cdf0e10cSrcweir 	for ( sal_Int32 n = 0; n < nCount; ++n )
206cdf0e10cSrcweir 	{
207cdf0e10cSrcweir 		const beans::Property& rCurrProp = pProps[ n ];
208cdf0e10cSrcweir 		if ( rCurrProp.Name == rName )
209cdf0e10cSrcweir 		{
210cdf0e10cSrcweir 			rProp = rCurrProp;
211cdf0e10cSrcweir 			return sal_True;
212cdf0e10cSrcweir 		}
213cdf0e10cSrcweir 	}
214cdf0e10cSrcweir 
215cdf0e10cSrcweir 	return sal_False;
216cdf0e10cSrcweir }
217cdf0e10cSrcweir 
218cdf0e10cSrcweir //=========================================================================
219cdf0e10cSrcweir //=========================================================================
220cdf0e10cSrcweir //
221cdf0e10cSrcweir // CommandProcessorInfo Implementation.
222cdf0e10cSrcweir //
223cdf0e10cSrcweir //=========================================================================
224cdf0e10cSrcweir //=========================================================================
225cdf0e10cSrcweir 
CommandProcessorInfo(const uno::Reference<lang::XMultiServiceFactory> & rxSMgr,const uno::Reference<com::sun::star::ucb::XCommandEnvironment> & rxEnv,ContentImplHelper * pContent)226cdf0e10cSrcweir CommandProcessorInfo::CommandProcessorInfo(
227cdf0e10cSrcweir     const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
228cdf0e10cSrcweir     const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv,
229cdf0e10cSrcweir     ContentImplHelper* pContent )
230cdf0e10cSrcweir : m_xSMgr( rxSMgr ),
231cdf0e10cSrcweir   m_xEnv( rxEnv ),
232cdf0e10cSrcweir   m_pCommands( 0 ),
233cdf0e10cSrcweir   m_pContent( pContent )
234cdf0e10cSrcweir {
235cdf0e10cSrcweir }
236cdf0e10cSrcweir 
237cdf0e10cSrcweir //=========================================================================
238cdf0e10cSrcweir // virtual
~CommandProcessorInfo()239cdf0e10cSrcweir CommandProcessorInfo::~CommandProcessorInfo()
240cdf0e10cSrcweir {
241cdf0e10cSrcweir 	delete m_pCommands;
242cdf0e10cSrcweir }
243cdf0e10cSrcweir 
244cdf0e10cSrcweir //=========================================================================
245cdf0e10cSrcweir //
246cdf0e10cSrcweir // XInterface methods.
247cdf0e10cSrcweir //
248cdf0e10cSrcweir //=========================================================================
249cdf0e10cSrcweir 
250cdf0e10cSrcweir XINTERFACE_IMPL_2( CommandProcessorInfo,
251cdf0e10cSrcweir 				   lang::XTypeProvider,
252cdf0e10cSrcweir 				   com::sun::star::ucb::XCommandInfo );
253cdf0e10cSrcweir 
254cdf0e10cSrcweir //=========================================================================
255cdf0e10cSrcweir //
256cdf0e10cSrcweir // XTypeProvider methods.
257cdf0e10cSrcweir //
258cdf0e10cSrcweir //=========================================================================
259cdf0e10cSrcweir 
260cdf0e10cSrcweir XTYPEPROVIDER_IMPL_2( CommandProcessorInfo,
261cdf0e10cSrcweir 			   		  lang::XTypeProvider,
262cdf0e10cSrcweir 			   		  com::sun::star::ucb::XCommandInfo );
263cdf0e10cSrcweir 
264cdf0e10cSrcweir //=========================================================================
265cdf0e10cSrcweir //
266cdf0e10cSrcweir // XCommandInfo methods.
267cdf0e10cSrcweir //
268cdf0e10cSrcweir //=========================================================================
269cdf0e10cSrcweir 
270cdf0e10cSrcweir // virtual
271cdf0e10cSrcweir uno::Sequence< com::sun::star::ucb::CommandInfo > SAL_CALL
getCommands()272cdf0e10cSrcweir CommandProcessorInfo::getCommands()
273cdf0e10cSrcweir 	throw( uno::RuntimeException )
274cdf0e10cSrcweir {
275cdf0e10cSrcweir 	if ( !m_pCommands )
276cdf0e10cSrcweir 	{
277cdf0e10cSrcweir 		osl::MutexGuard aGuard( m_aMutex );
278cdf0e10cSrcweir 		if ( !m_pCommands )
279cdf0e10cSrcweir 		{
280cdf0e10cSrcweir 			//////////////////////////////////////////////////////////////
281cdf0e10cSrcweir 			// Get info for commands.
282cdf0e10cSrcweir 			//////////////////////////////////////////////////////////////
283cdf0e10cSrcweir 
284cdf0e10cSrcweir             try
285cdf0e10cSrcweir             {
286cdf0e10cSrcweir                 uno::Sequence< com::sun::star::ucb::CommandInfo > aCmds
287cdf0e10cSrcweir                     = m_pContent->getCommands( m_xEnv );
288cdf0e10cSrcweir                 m_pCommands
289cdf0e10cSrcweir                     = new uno::Sequence< com::sun::star::ucb::CommandInfo >(
290cdf0e10cSrcweir                         aCmds );
291cdf0e10cSrcweir             }
292cdf0e10cSrcweir             catch ( uno::RuntimeException const & )
293cdf0e10cSrcweir             {
294cdf0e10cSrcweir                 throw;
295cdf0e10cSrcweir             }
296cdf0e10cSrcweir             catch ( uno::Exception const & )
297cdf0e10cSrcweir             {
298cdf0e10cSrcweir                 m_pCommands
299cdf0e10cSrcweir                     = new uno::Sequence< com::sun::star::ucb::CommandInfo >(
300cdf0e10cSrcweir                         0 );
301cdf0e10cSrcweir             }
302cdf0e10cSrcweir 		}
303cdf0e10cSrcweir 	}
304cdf0e10cSrcweir 	return *m_pCommands;
305cdf0e10cSrcweir }
306cdf0e10cSrcweir 
307cdf0e10cSrcweir //=========================================================================
308cdf0e10cSrcweir // virtual
309cdf0e10cSrcweir com::sun::star::ucb::CommandInfo SAL_CALL
getCommandInfoByName(const rtl::OUString & Name)310cdf0e10cSrcweir CommandProcessorInfo::getCommandInfoByName(
311cdf0e10cSrcweir         const rtl::OUString& Name )
312cdf0e10cSrcweir 	throw( com::sun::star::ucb::UnsupportedCommandException,
313cdf0e10cSrcweir            uno::RuntimeException )
314cdf0e10cSrcweir {
315cdf0e10cSrcweir 	com::sun::star::ucb::CommandInfo aInfo;
316cdf0e10cSrcweir 	if ( queryCommand( Name, aInfo ) )
317cdf0e10cSrcweir 		return aInfo;
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 	throw com::sun::star::ucb::UnsupportedCommandException();
320cdf0e10cSrcweir }
321cdf0e10cSrcweir 
322cdf0e10cSrcweir //=========================================================================
323cdf0e10cSrcweir // virtual
324cdf0e10cSrcweir com::sun::star::ucb::CommandInfo SAL_CALL
getCommandInfoByHandle(sal_Int32 Handle)325cdf0e10cSrcweir CommandProcessorInfo::getCommandInfoByHandle( sal_Int32 Handle )
326cdf0e10cSrcweir 	throw( com::sun::star::ucb::UnsupportedCommandException,
327cdf0e10cSrcweir            uno::RuntimeException )
328cdf0e10cSrcweir {
329cdf0e10cSrcweir 	com::sun::star::ucb::CommandInfo aInfo;
330cdf0e10cSrcweir 	if ( queryCommand( Handle, aInfo ) )
331cdf0e10cSrcweir 		return aInfo;
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 	throw com::sun::star::ucb::UnsupportedCommandException();
334cdf0e10cSrcweir }
335cdf0e10cSrcweir 
336cdf0e10cSrcweir //=========================================================================
337cdf0e10cSrcweir // virtual
hasCommandByName(const rtl::OUString & Name)338cdf0e10cSrcweir sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByName(
339cdf0e10cSrcweir        const rtl::OUString& Name )
340cdf0e10cSrcweir 	throw( uno::RuntimeException )
341cdf0e10cSrcweir {
342cdf0e10cSrcweir 	com::sun::star::ucb::CommandInfo aInfo;
343cdf0e10cSrcweir 	return queryCommand( Name, aInfo );
344cdf0e10cSrcweir }
345cdf0e10cSrcweir 
346cdf0e10cSrcweir //=========================================================================
347cdf0e10cSrcweir // virtual
hasCommandByHandle(sal_Int32 Handle)348cdf0e10cSrcweir sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByHandle( sal_Int32 Handle )
349cdf0e10cSrcweir 	throw( uno::RuntimeException )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir 	com::sun::star::ucb::CommandInfo aInfo;
352cdf0e10cSrcweir 	return queryCommand( Handle, aInfo );
353cdf0e10cSrcweir }
354cdf0e10cSrcweir 
355cdf0e10cSrcweir //=========================================================================
356cdf0e10cSrcweir //
357cdf0e10cSrcweir // Non-Interface methods.
358cdf0e10cSrcweir //
359cdf0e10cSrcweir //=========================================================================
360cdf0e10cSrcweir 
reset()361cdf0e10cSrcweir void CommandProcessorInfo::reset()
362cdf0e10cSrcweir {
363cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_aMutex );
364cdf0e10cSrcweir 	delete m_pCommands;
365cdf0e10cSrcweir 	m_pCommands = 0;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 
369cdf0e10cSrcweir //=========================================================================
queryCommand(const rtl::OUString & rName,com::sun::star::ucb::CommandInfo & rCommand)370cdf0e10cSrcweir sal_Bool CommandProcessorInfo::queryCommand(
371cdf0e10cSrcweir     const rtl::OUString& rName,
372cdf0e10cSrcweir     com::sun::star::ucb::CommandInfo& rCommand )
373cdf0e10cSrcweir {
374cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_aMutex );
375cdf0e10cSrcweir 
376cdf0e10cSrcweir 	getCommands();
377cdf0e10cSrcweir 
378cdf0e10cSrcweir 	const com::sun::star::ucb::CommandInfo* pCommands
379cdf0e10cSrcweir         = m_pCommands->getConstArray();
380cdf0e10cSrcweir 	sal_Int32 nCount = m_pCommands->getLength();
381cdf0e10cSrcweir 	for ( sal_Int32 n = 0; n < nCount; ++n )
382cdf0e10cSrcweir 	{
383cdf0e10cSrcweir 		const com::sun::star::ucb::CommandInfo& rCurrCommand = pCommands[ n ];
384cdf0e10cSrcweir 		if ( rCurrCommand.Name == rName )
385cdf0e10cSrcweir 		{
386cdf0e10cSrcweir 			rCommand = rCurrCommand;
387cdf0e10cSrcweir 			return sal_True;
388cdf0e10cSrcweir 		}
389cdf0e10cSrcweir 	}
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 	return sal_False;
392cdf0e10cSrcweir }
393cdf0e10cSrcweir 
394cdf0e10cSrcweir //=========================================================================
queryCommand(sal_Int32 nHandle,com::sun::star::ucb::CommandInfo & rCommand)395cdf0e10cSrcweir sal_Bool CommandProcessorInfo::queryCommand(
396cdf0e10cSrcweir     sal_Int32 nHandle,
397cdf0e10cSrcweir     com::sun::star::ucb::CommandInfo& rCommand )
398cdf0e10cSrcweir {
399cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_aMutex );
400cdf0e10cSrcweir 
401cdf0e10cSrcweir 	getCommands();
402cdf0e10cSrcweir 
403cdf0e10cSrcweir 	const com::sun::star::ucb::CommandInfo* pCommands
404cdf0e10cSrcweir         = m_pCommands->getConstArray();
405cdf0e10cSrcweir 	sal_Int32 nCount = m_pCommands->getLength();
406cdf0e10cSrcweir 	for ( sal_Int32 n = 0; n < nCount; ++n )
407cdf0e10cSrcweir 	{
408cdf0e10cSrcweir 		const com::sun::star::ucb::CommandInfo& rCurrCommand = pCommands[ n ];
409cdf0e10cSrcweir 		if ( rCurrCommand.Handle == nHandle )
410cdf0e10cSrcweir 		{
411cdf0e10cSrcweir 			rCommand = rCurrCommand;
412cdf0e10cSrcweir 			return sal_True;
413cdf0e10cSrcweir 		}
414cdf0e10cSrcweir 	}
415cdf0e10cSrcweir 
416cdf0e10cSrcweir 	return sal_False;
417cdf0e10cSrcweir }
418cdf0e10cSrcweir 
419cdf0e10cSrcweir } // namespace ucbhelper
420