xref: /AOO41X/main/comphelper/source/misc/namedvaluecollection.cxx (revision 1b25760164e35c0728e1601dc9533c9a9fc8b2d5)
1cdf0e10cSrcweir /*************************************************************************
2cdf0e10cSrcweir  *
3cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4cdf0e10cSrcweir  *
5cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6cdf0e10cSrcweir  *
7cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8cdf0e10cSrcweir  *
9cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10cdf0e10cSrcweir  *
11cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14cdf0e10cSrcweir  *
15cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20cdf0e10cSrcweir  *
21cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25cdf0e10cSrcweir  *
26cdf0e10cSrcweir  ************************************************************************/
27cdf0e10cSrcweir 
28cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29cdf0e10cSrcweir #include "precompiled_comphelper.hxx"
30cdf0e10cSrcweir #include <comphelper/namedvaluecollection.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir /** === begin UNO includes === **/
33cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp>
34cdf0e10cSrcweir #include <com/sun/star/lang/IllegalArgumentException.hpp>
35cdf0e10cSrcweir #include <com/sun/star/beans/PropertyState.hpp>
36cdf0e10cSrcweir /** === end UNO includes === **/
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
39cdf0e10cSrcweir #include <rtl/strbuf.hxx>
40cdf0e10cSrcweir #include <osl/diagnose.h>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <hash_map>
43cdf0e10cSrcweir #include <functional>
44cdf0e10cSrcweir #include <algorithm>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir //........................................................................
47cdf0e10cSrcweir namespace comphelper
48cdf0e10cSrcweir {
49cdf0e10cSrcweir //........................................................................
50cdf0e10cSrcweir 
51cdf0e10cSrcweir     /** === begin UNO using === **/
52cdf0e10cSrcweir     using ::com::sun::star::uno::Any;
53cdf0e10cSrcweir     using ::com::sun::star::uno::Sequence;
54cdf0e10cSrcweir     using ::com::sun::star::beans::PropertyValue;
55cdf0e10cSrcweir     using ::com::sun::star::beans::NamedValue;
56cdf0e10cSrcweir     using ::com::sun::star::uno::Type;
57cdf0e10cSrcweir     using ::com::sun::star::uno::cpp_acquire;
58cdf0e10cSrcweir     using ::com::sun::star::uno::cpp_release;
59cdf0e10cSrcweir     using ::com::sun::star::uno::cpp_queryInterface;
60cdf0e10cSrcweir     using ::com::sun::star::lang::IllegalArgumentException;
61cdf0e10cSrcweir     using ::com::sun::star::beans::NamedValue;
62cdf0e10cSrcweir     using ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
63cdf0e10cSrcweir     /** === end UNO using === **/
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     //====================================================================
66cdf0e10cSrcweir 	//= NamedValueCollection_Impl
67cdf0e10cSrcweir 	//====================================================================
68cdf0e10cSrcweir     typedef ::std::hash_map< ::rtl::OUString, Any, ::rtl::OUStringHash >    NamedValueRepository;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     struct NamedValueCollection_Impl
71cdf0e10cSrcweir     {
72cdf0e10cSrcweir         NamedValueRepository    aValues;
73cdf0e10cSrcweir     };
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     //====================================================================
76cdf0e10cSrcweir 	//= NamedValueCollection
77cdf0e10cSrcweir 	//====================================================================
78cdf0e10cSrcweir 	//--------------------------------------------------------------------
79cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection()
80cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
81cdf0e10cSrcweir     {
82cdf0e10cSrcweir     }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	//--------------------------------------------------------------------
85cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection( const NamedValueCollection& _rCopySource )
86cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
87cdf0e10cSrcweir     {
88cdf0e10cSrcweir         *this = _rCopySource;
89cdf0e10cSrcweir     }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	//--------------------------------------------------------------------
92cdf0e10cSrcweir     NamedValueCollection& NamedValueCollection::operator=( const NamedValueCollection& i_rCopySource )
93cdf0e10cSrcweir     {
94cdf0e10cSrcweir         m_pImpl->aValues = i_rCopySource.m_pImpl->aValues;
95cdf0e10cSrcweir         return *this;
96cdf0e10cSrcweir     }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	//--------------------------------------------------------------------
99cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection( const Any& _rElements )
100cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
101cdf0e10cSrcweir     {
102cdf0e10cSrcweir         impl_assign( _rElements );
103cdf0e10cSrcweir     }
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	//--------------------------------------------------------------------
106cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection( const Sequence< Any >& _rArguments )
107cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
108cdf0e10cSrcweir     {
109cdf0e10cSrcweir         impl_assign( _rArguments );
110cdf0e10cSrcweir     }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 	//--------------------------------------------------------------------
113cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection( const Sequence< PropertyValue >& _rArguments )
114cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
115cdf0e10cSrcweir     {
116cdf0e10cSrcweir         impl_assign( _rArguments );
117cdf0e10cSrcweir     }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	//--------------------------------------------------------------------
120cdf0e10cSrcweir     NamedValueCollection::NamedValueCollection( const Sequence< NamedValue >& _rArguments )
121cdf0e10cSrcweir         :m_pImpl( new NamedValueCollection_Impl )
122cdf0e10cSrcweir     {
123cdf0e10cSrcweir         impl_assign( _rArguments );
124cdf0e10cSrcweir     }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	//--------------------------------------------------------------------
127cdf0e10cSrcweir     NamedValueCollection::~NamedValueCollection()
128cdf0e10cSrcweir     {
129cdf0e10cSrcweir     }
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	//--------------------------------------------------------------------
132*1b257601SMichael Stahl     bool NamedValueCollection::canExtractFrom( ::com::sun::star::uno::Any const & i_value )
133*1b257601SMichael Stahl     {
134*1b257601SMichael Stahl         Type const & aValueType = i_value.getValueType();
135*1b257601SMichael Stahl         if  (   aValueType.equals( ::cppu::UnoType< PropertyValue >::get() )
136*1b257601SMichael Stahl             ||  aValueType.equals( ::cppu::UnoType< NamedValue >::get() )
137*1b257601SMichael Stahl             ||  aValueType.equals( ::cppu::UnoType< Sequence< PropertyValue > >::get() )
138*1b257601SMichael Stahl             ||  aValueType.equals( ::cppu::UnoType< Sequence< NamedValue > >::get() )
139*1b257601SMichael Stahl             )
140*1b257601SMichael Stahl             return true;
141*1b257601SMichael Stahl         return false;
142*1b257601SMichael Stahl     }
143*1b257601SMichael Stahl 
144*1b257601SMichael Stahl 	//--------------------------------------------------------------------
145cdf0e10cSrcweir     NamedValueCollection& NamedValueCollection::merge( const NamedValueCollection& _rAdditionalValues, bool _bOverwriteExisting )
146cdf0e10cSrcweir     {
147cdf0e10cSrcweir         for (   NamedValueRepository::const_iterator namedValue = _rAdditionalValues.m_pImpl->aValues.begin();
148cdf0e10cSrcweir                 namedValue != _rAdditionalValues.m_pImpl->aValues.end();
149cdf0e10cSrcweir                 ++namedValue
150cdf0e10cSrcweir             )
151cdf0e10cSrcweir         {
152cdf0e10cSrcweir             if ( _bOverwriteExisting || !impl_has( namedValue->first ) )
153cdf0e10cSrcweir                 impl_put( namedValue->first, namedValue->second );
154cdf0e10cSrcweir         }
155cdf0e10cSrcweir 
156cdf0e10cSrcweir         return *this;
157cdf0e10cSrcweir     }
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	//--------------------------------------------------------------------
160cdf0e10cSrcweir     size_t NamedValueCollection::size() const
161cdf0e10cSrcweir     {
162cdf0e10cSrcweir         return m_pImpl->aValues.size();
163cdf0e10cSrcweir     }
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 	//--------------------------------------------------------------------
166cdf0e10cSrcweir     bool NamedValueCollection::empty() const
167cdf0e10cSrcweir     {
168cdf0e10cSrcweir         return m_pImpl->aValues.empty();
169cdf0e10cSrcweir     }
170cdf0e10cSrcweir 
171cdf0e10cSrcweir 	//--------------------------------------------------------------------
172cdf0e10cSrcweir     ::std::vector< ::rtl::OUString > NamedValueCollection::getNames() const
173cdf0e10cSrcweir     {
174cdf0e10cSrcweir         ::std::vector< ::rtl::OUString > aNames( m_pImpl->aValues.size() );
175cdf0e10cSrcweir         ::std::transform(
176cdf0e10cSrcweir             m_pImpl->aValues.begin(),
177cdf0e10cSrcweir             m_pImpl->aValues.end(),
178cdf0e10cSrcweir             aNames.begin(),
179cdf0e10cSrcweir             ::std::select1st< NamedValueRepository::value_type >()
180cdf0e10cSrcweir         );
181cdf0e10cSrcweir         return aNames;
182cdf0e10cSrcweir     }
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 	//--------------------------------------------------------------------
185cdf0e10cSrcweir     void NamedValueCollection::impl_assign( const Any& i_rWrappedElements )
186cdf0e10cSrcweir     {
187cdf0e10cSrcweir         Sequence< NamedValue > aNamedValues;
188cdf0e10cSrcweir         Sequence< PropertyValue > aPropertyValues;
189cdf0e10cSrcweir         NamedValue aNamedValue;
190cdf0e10cSrcweir         PropertyValue aPropertyValue;
191cdf0e10cSrcweir 
192cdf0e10cSrcweir         if ( i_rWrappedElements >>= aNamedValues )
193cdf0e10cSrcweir             impl_assign( aNamedValues );
194cdf0e10cSrcweir         else if ( i_rWrappedElements >>= aPropertyValues )
195cdf0e10cSrcweir             impl_assign( aPropertyValues );
196cdf0e10cSrcweir         else if ( i_rWrappedElements >>= aNamedValue )
197cdf0e10cSrcweir             impl_assign( Sequence< NamedValue >( &aNamedValue, 1 ) );
198cdf0e10cSrcweir         else if ( i_rWrappedElements >>= aPropertyValue )
199cdf0e10cSrcweir             impl_assign( Sequence< PropertyValue >( &aPropertyValue, 1 ) );
200cdf0e10cSrcweir         else
201cdf0e10cSrcweir             OSL_ENSURE( !i_rWrappedElements.hasValue(), "NamedValueCollection::impl_assign(Any): unsupported type!" );
202cdf0e10cSrcweir     }
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 	//--------------------------------------------------------------------
205cdf0e10cSrcweir     void NamedValueCollection::impl_assign( const Sequence< Any >& _rArguments )
206cdf0e10cSrcweir     {
207cdf0e10cSrcweir         {
208cdf0e10cSrcweir             NamedValueRepository aEmpty;
209cdf0e10cSrcweir             m_pImpl->aValues.swap( aEmpty );
210cdf0e10cSrcweir         }
211cdf0e10cSrcweir 
212cdf0e10cSrcweir         PropertyValue aPropertyValue;
213cdf0e10cSrcweir         NamedValue aNamedValue;
214cdf0e10cSrcweir 
215cdf0e10cSrcweir         const Any* pArgument = _rArguments.getConstArray();
216cdf0e10cSrcweir         const Any* pArgumentEnd = _rArguments.getConstArray() + _rArguments.getLength();
217cdf0e10cSrcweir         for ( ; pArgument != pArgumentEnd; ++pArgument )
218cdf0e10cSrcweir         {
219cdf0e10cSrcweir             if ( *pArgument >>= aPropertyValue )
220cdf0e10cSrcweir                 m_pImpl->aValues[ aPropertyValue.Name ] = aPropertyValue.Value;
221cdf0e10cSrcweir             else if ( *pArgument >>= aNamedValue )
222cdf0e10cSrcweir                 m_pImpl->aValues[ aNamedValue.Name ] = aNamedValue.Value;
223cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
224cdf0e10cSrcweir             else if ( pArgument->hasValue() )
225cdf0e10cSrcweir             {
226cdf0e10cSrcweir                 ::rtl::OStringBuffer message;
227cdf0e10cSrcweir                 message.append( "NamedValueCollection::impl_assign: encountered a value type which I cannot handle:\n" );
228cdf0e10cSrcweir                 message.append( ::rtl::OUStringToOString( pArgument->getValueTypeName(), RTL_TEXTENCODING_ASCII_US ) );
229cdf0e10cSrcweir                 OSL_ENSURE( false, message.makeStringAndClear() );
230cdf0e10cSrcweir             }
231cdf0e10cSrcweir #endif
232cdf0e10cSrcweir         }
233cdf0e10cSrcweir     }
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 	//--------------------------------------------------------------------
236cdf0e10cSrcweir     void NamedValueCollection::impl_assign( const Sequence< PropertyValue >& _rArguments )
237cdf0e10cSrcweir     {
238cdf0e10cSrcweir         {
239cdf0e10cSrcweir             NamedValueRepository aEmpty;
240cdf0e10cSrcweir             m_pImpl->aValues.swap( aEmpty );
241cdf0e10cSrcweir         }
242cdf0e10cSrcweir 
243cdf0e10cSrcweir         const PropertyValue* pArgument = _rArguments.getConstArray();
244cdf0e10cSrcweir         const PropertyValue* pArgumentEnd = _rArguments.getConstArray() + _rArguments.getLength();
245cdf0e10cSrcweir         for ( ; pArgument != pArgumentEnd; ++pArgument )
246cdf0e10cSrcweir             m_pImpl->aValues[ pArgument->Name ] = pArgument->Value;
247cdf0e10cSrcweir     }
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 	//--------------------------------------------------------------------
250cdf0e10cSrcweir     void NamedValueCollection::impl_assign( const Sequence< NamedValue >& _rArguments )
251cdf0e10cSrcweir     {
252cdf0e10cSrcweir         {
253cdf0e10cSrcweir             NamedValueRepository aEmpty;
254cdf0e10cSrcweir             m_pImpl->aValues.swap( aEmpty );
255cdf0e10cSrcweir         }
256cdf0e10cSrcweir 
257cdf0e10cSrcweir         const NamedValue* pArgument = _rArguments.getConstArray();
258cdf0e10cSrcweir         const NamedValue* pArgumentEnd = _rArguments.getConstArray() + _rArguments.getLength();
259cdf0e10cSrcweir         for ( ; pArgument != pArgumentEnd; ++pArgument )
260cdf0e10cSrcweir             m_pImpl->aValues[ pArgument->Name ] = pArgument->Value;
261cdf0e10cSrcweir     }
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 	//--------------------------------------------------------------------
264cdf0e10cSrcweir     bool NamedValueCollection::get_ensureType( const ::rtl::OUString& _rValueName, void* _pValueLocation, const Type& _rExpectedValueType ) const
265cdf0e10cSrcweir     {
266cdf0e10cSrcweir         NamedValueRepository::const_iterator pos = m_pImpl->aValues.find( _rValueName );
267cdf0e10cSrcweir         if ( pos != m_pImpl->aValues.end() )
268cdf0e10cSrcweir         {
269cdf0e10cSrcweir 		    if ( uno_type_assignData(
270cdf0e10cSrcweir 			        _pValueLocation, _rExpectedValueType.getTypeLibType(),
271cdf0e10cSrcweir 				    const_cast< void* >( pos->second.getValue() ), pos->second.getValueType().getTypeLibType(),
272cdf0e10cSrcweir 			    	reinterpret_cast< uno_QueryInterfaceFunc >( cpp_queryInterface ),
273cdf0e10cSrcweir                     reinterpret_cast< uno_AcquireFunc >( cpp_acquire ),
274cdf0e10cSrcweir                     reinterpret_cast< uno_ReleaseFunc >( cpp_release )
275cdf0e10cSrcweir                 ) )
276cdf0e10cSrcweir                 // argument exists, and could be extracted
277cdf0e10cSrcweir                 return true;
278cdf0e10cSrcweir 
279cdf0e10cSrcweir             // argument exists, but is of wrong type
280cdf0e10cSrcweir             ::rtl::OUStringBuffer aBuffer;
281cdf0e10cSrcweir             aBuffer.appendAscii( "Invalid value type for '" );
282cdf0e10cSrcweir             aBuffer.append     ( _rValueName );
283cdf0e10cSrcweir             aBuffer.appendAscii( "'.\nExpected: " );
284cdf0e10cSrcweir             aBuffer.append     ( _rExpectedValueType.getTypeName() );
285cdf0e10cSrcweir             aBuffer.appendAscii( "\nFound: " );
286cdf0e10cSrcweir             aBuffer.append     ( pos->second.getValueType().getTypeName() );
287cdf0e10cSrcweir             throw IllegalArgumentException( aBuffer.makeStringAndClear(), NULL, 0 );
288cdf0e10cSrcweir         }
289cdf0e10cSrcweir 
290cdf0e10cSrcweir         // argument does not exist
291cdf0e10cSrcweir         return false;
292cdf0e10cSrcweir     }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir     //--------------------------------------------------------------------
295cdf0e10cSrcweir     const Any& NamedValueCollection::impl_get( const ::rtl::OUString& _rValueName ) const
296cdf0e10cSrcweir     {
297cdf0e10cSrcweir         NamedValueRepository::const_iterator pos = m_pImpl->aValues.find( _rValueName );
298cdf0e10cSrcweir         if ( pos != m_pImpl->aValues.end() )
299cdf0e10cSrcweir             return pos->second;
300cdf0e10cSrcweir 
301cdf0e10cSrcweir         static Any aEmptyDefault;
302cdf0e10cSrcweir         return aEmptyDefault;
303cdf0e10cSrcweir     }
304cdf0e10cSrcweir 
305cdf0e10cSrcweir     //--------------------------------------------------------------------
306cdf0e10cSrcweir     bool NamedValueCollection::impl_has( const ::rtl::OUString& _rValueName ) const
307cdf0e10cSrcweir     {
308cdf0e10cSrcweir         NamedValueRepository::const_iterator pos = m_pImpl->aValues.find( _rValueName );
309cdf0e10cSrcweir         return ( pos != m_pImpl->aValues.end() );
310cdf0e10cSrcweir     }
311cdf0e10cSrcweir 
312cdf0e10cSrcweir     //--------------------------------------------------------------------
313cdf0e10cSrcweir     bool NamedValueCollection::impl_put( const ::rtl::OUString& _rValueName, const Any& _rValue )
314cdf0e10cSrcweir     {
315cdf0e10cSrcweir         bool bHas = impl_has( _rValueName );
316cdf0e10cSrcweir         m_pImpl->aValues[ _rValueName ] = _rValue;
317cdf0e10cSrcweir         return bHas;
318cdf0e10cSrcweir     }
319cdf0e10cSrcweir 
320cdf0e10cSrcweir     //--------------------------------------------------------------------
321cdf0e10cSrcweir     bool NamedValueCollection::impl_remove( const ::rtl::OUString& _rValueName )
322cdf0e10cSrcweir     {
323cdf0e10cSrcweir         NamedValueRepository::iterator pos = m_pImpl->aValues.find( _rValueName );
324cdf0e10cSrcweir         if ( pos == m_pImpl->aValues.end() )
325cdf0e10cSrcweir             return false;
326cdf0e10cSrcweir         m_pImpl->aValues.erase( pos );
327cdf0e10cSrcweir         return true;
328cdf0e10cSrcweir     }
329cdf0e10cSrcweir 
330cdf0e10cSrcweir     //--------------------------------------------------------------------
331cdf0e10cSrcweir     namespace
332cdf0e10cSrcweir     {
333cdf0e10cSrcweir         struct Value2PropertyValue : public ::std::unary_function< NamedValueRepository::value_type, PropertyValue >
334cdf0e10cSrcweir         {
335cdf0e10cSrcweir             PropertyValue operator()( const NamedValueRepository::value_type& _rValue )
336cdf0e10cSrcweir             {
337cdf0e10cSrcweir                 return PropertyValue(
338cdf0e10cSrcweir                     _rValue.first, 0, _rValue.second, PropertyState_DIRECT_VALUE );
339cdf0e10cSrcweir             }
340cdf0e10cSrcweir         };
341cdf0e10cSrcweir 
342cdf0e10cSrcweir         struct Value2NamedValue : public ::std::unary_function< NamedValueRepository::value_type, NamedValue >
343cdf0e10cSrcweir         {
344cdf0e10cSrcweir             NamedValue operator()( const NamedValueRepository::value_type& _rValue )
345cdf0e10cSrcweir             {
346cdf0e10cSrcweir                 return NamedValue( _rValue.first, _rValue.second );
347cdf0e10cSrcweir             }
348cdf0e10cSrcweir         };
349cdf0e10cSrcweir     }
350cdf0e10cSrcweir 
351cdf0e10cSrcweir     //--------------------------------------------------------------------
352cdf0e10cSrcweir     sal_Int32 NamedValueCollection::operator >>= ( Sequence< PropertyValue >& _out_rValues ) const
353cdf0e10cSrcweir     {
354cdf0e10cSrcweir         _out_rValues.realloc( m_pImpl->aValues.size() );
355cdf0e10cSrcweir         ::std::transform( m_pImpl->aValues.begin(), m_pImpl->aValues.end(), _out_rValues.getArray(), Value2PropertyValue() );
356cdf0e10cSrcweir         return _out_rValues.getLength();
357cdf0e10cSrcweir     }
358cdf0e10cSrcweir 
359cdf0e10cSrcweir     //--------------------------------------------------------------------
360cdf0e10cSrcweir     sal_Int32 NamedValueCollection::operator >>= ( Sequence< NamedValue >& _out_rValues ) const
361cdf0e10cSrcweir     {
362cdf0e10cSrcweir         _out_rValues.realloc( m_pImpl->aValues.size() );
363cdf0e10cSrcweir         ::std::transform( m_pImpl->aValues.begin(), m_pImpl->aValues.end(), _out_rValues.getArray(), Value2NamedValue() );
364cdf0e10cSrcweir         return _out_rValues.getLength();
365cdf0e10cSrcweir     }
366cdf0e10cSrcweir 
367cdf0e10cSrcweir //........................................................................
368cdf0e10cSrcweir } // namespace comphelper
369cdf0e10cSrcweir //........................................................................
370cdf0e10cSrcweir 
371