1*b5088357SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*b5088357SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*b5088357SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*b5088357SAndrew Rist * distributed with this work for additional information
6*b5088357SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*b5088357SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*b5088357SAndrew Rist * "License"); you may not use this file except in compliance
9*b5088357SAndrew Rist * with the License. You may obtain a copy of the License at
10*b5088357SAndrew Rist *
11*b5088357SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*b5088357SAndrew Rist *
13*b5088357SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*b5088357SAndrew Rist * software distributed under the License is distributed on an
15*b5088357SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b5088357SAndrew Rist * KIND, either express or implied. See the License for the
17*b5088357SAndrew Rist * specific language governing permissions and limitations
18*b5088357SAndrew Rist * under the License.
19*b5088357SAndrew Rist *
20*b5088357SAndrew Rist *************************************************************/
21*b5088357SAndrew Rist
22*b5088357SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_unotools.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <unotools/atom.hxx>
28cdf0e10cSrcweir
29cdf0e10cSrcweir using namespace utl;
30cdf0e10cSrcweir using namespace ::com::sun::star::uno;
31cdf0e10cSrcweir using namespace ::com::sun::star::util;
32cdf0e10cSrcweir #define NMSP_UTIL ::com::sun::star::util
33cdf0e10cSrcweir
AtomProvider()34cdf0e10cSrcweir AtomProvider::AtomProvider()
35cdf0e10cSrcweir {
36cdf0e10cSrcweir m_nAtoms = 1;
37cdf0e10cSrcweir }
38cdf0e10cSrcweir
~AtomProvider()39cdf0e10cSrcweir AtomProvider::~AtomProvider()
40cdf0e10cSrcweir {
41cdf0e10cSrcweir }
42cdf0e10cSrcweir
getAtom(const::rtl::OUString & rString,sal_Bool bCreate)43cdf0e10cSrcweir int AtomProvider::getAtom( const ::rtl::OUString& rString, sal_Bool bCreate )
44cdf0e10cSrcweir {
45cdf0e10cSrcweir ::std::hash_map< ::rtl::OUString, int, ::rtl::OUStringHash >::iterator it = m_aAtomMap.find( rString );
46cdf0e10cSrcweir if( it != m_aAtomMap.end() )
47cdf0e10cSrcweir return it->second;
48cdf0e10cSrcweir if( ! bCreate )
49cdf0e10cSrcweir return INVALID_ATOM;
50cdf0e10cSrcweir m_aAtomMap[ rString ] = m_nAtoms;
51cdf0e10cSrcweir m_aStringMap[ m_nAtoms ] = rString;
52cdf0e10cSrcweir m_nAtoms++;
53cdf0e10cSrcweir return m_nAtoms-1;
54cdf0e10cSrcweir }
55cdf0e10cSrcweir
getAll(::std::list<::utl::AtomDescription> & atoms)56cdf0e10cSrcweir void AtomProvider::getAll( ::std::list< ::utl::AtomDescription >& atoms )
57cdf0e10cSrcweir {
58cdf0e10cSrcweir atoms.clear();
59cdf0e10cSrcweir ::std::hash_map< ::rtl::OUString, int, ::rtl::OUStringHash >::const_iterator it = m_aAtomMap.begin();
60cdf0e10cSrcweir
61cdf0e10cSrcweir ::utl::AtomDescription aDesc;
62cdf0e10cSrcweir while( it != m_aAtomMap.end() )
63cdf0e10cSrcweir {
64cdf0e10cSrcweir aDesc.atom = it->second;
65cdf0e10cSrcweir aDesc.description = it->first;
66cdf0e10cSrcweir atoms.push_back( aDesc );
67cdf0e10cSrcweir ++it;
68cdf0e10cSrcweir }
69cdf0e10cSrcweir }
70cdf0e10cSrcweir
getRecent(int atom,::std::list<::utl::AtomDescription> & atoms)71cdf0e10cSrcweir void AtomProvider::getRecent( int atom, ::std::list< ::utl::AtomDescription >& atoms )
72cdf0e10cSrcweir {
73cdf0e10cSrcweir atoms.clear();
74cdf0e10cSrcweir
75cdf0e10cSrcweir ::std::hash_map< ::rtl::OUString, int, ::rtl::OUStringHash >::const_iterator it = m_aAtomMap.begin();
76cdf0e10cSrcweir
77cdf0e10cSrcweir ::utl::AtomDescription aDesc;
78cdf0e10cSrcweir while( it != m_aAtomMap.end() )
79cdf0e10cSrcweir {
80cdf0e10cSrcweir if( it->second > atom )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir aDesc.atom = it->second;
83cdf0e10cSrcweir aDesc.description = it->first;
84cdf0e10cSrcweir atoms.push_back( aDesc );
85cdf0e10cSrcweir }
86cdf0e10cSrcweir ++it;
87cdf0e10cSrcweir }
88cdf0e10cSrcweir }
89cdf0e10cSrcweir
getString(int nAtom) const90cdf0e10cSrcweir const ::rtl::OUString& AtomProvider::getString( int nAtom ) const
91cdf0e10cSrcweir {
92cdf0e10cSrcweir static ::rtl::OUString aEmpty;
93cdf0e10cSrcweir ::std::hash_map< int, ::rtl::OUString, ::std::hash< int > >::const_iterator it = m_aStringMap.find( nAtom );
94cdf0e10cSrcweir
95cdf0e10cSrcweir return it == m_aStringMap.end() ? aEmpty : it->second;
96cdf0e10cSrcweir }
97cdf0e10cSrcweir
overrideAtom(int atom,const::rtl::OUString & description)98cdf0e10cSrcweir void AtomProvider::overrideAtom( int atom, const ::rtl::OUString& description )
99cdf0e10cSrcweir {
100cdf0e10cSrcweir m_aAtomMap[ description ] = atom;
101cdf0e10cSrcweir m_aStringMap[ atom ] = description;
102cdf0e10cSrcweir if( m_nAtoms <= atom )
103cdf0e10cSrcweir m_nAtoms=atom+1;
104cdf0e10cSrcweir }
105cdf0e10cSrcweir
hasAtom(int atom) const106cdf0e10cSrcweir sal_Bool AtomProvider::hasAtom( int atom ) const
107cdf0e10cSrcweir {
108cdf0e10cSrcweir return m_aStringMap.find( atom ) != m_aStringMap.end() ? sal_True : sal_False;
109cdf0e10cSrcweir }
110cdf0e10cSrcweir
111cdf0e10cSrcweir // -----------------------------------------------------------------------
112cdf0e10cSrcweir
MultiAtomProvider()113cdf0e10cSrcweir MultiAtomProvider::MultiAtomProvider()
114cdf0e10cSrcweir {
115cdf0e10cSrcweir }
116cdf0e10cSrcweir
~MultiAtomProvider()117cdf0e10cSrcweir MultiAtomProvider::~MultiAtomProvider()
118cdf0e10cSrcweir {
119cdf0e10cSrcweir for( ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::iterator it = m_aAtomLists.begin(); it != m_aAtomLists.end(); ++it )
120cdf0e10cSrcweir delete it->second;
121cdf0e10cSrcweir }
122cdf0e10cSrcweir
123cdf0e10cSrcweir
insertAtomClass(int atomClass)124cdf0e10cSrcweir sal_Bool MultiAtomProvider::insertAtomClass( int atomClass )
125cdf0e10cSrcweir {
126cdf0e10cSrcweir ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::iterator it =
127cdf0e10cSrcweir m_aAtomLists.find( atomClass );
128cdf0e10cSrcweir if( it != m_aAtomLists.end() )
129cdf0e10cSrcweir return sal_False;
130cdf0e10cSrcweir m_aAtomLists[ atomClass ] = new AtomProvider();
131cdf0e10cSrcweir return sal_True;
132cdf0e10cSrcweir }
133cdf0e10cSrcweir
getAtom(int atomClass,const::rtl::OUString & rString,sal_Bool bCreate)134cdf0e10cSrcweir int MultiAtomProvider::getAtom( int atomClass, const ::rtl::OUString& rString, sal_Bool bCreate )
135cdf0e10cSrcweir {
136cdf0e10cSrcweir ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::iterator it =
137cdf0e10cSrcweir m_aAtomLists.find( atomClass );
138cdf0e10cSrcweir if( it != m_aAtomLists.end() )
139cdf0e10cSrcweir return it->second->getAtom( rString, bCreate );
140cdf0e10cSrcweir
141cdf0e10cSrcweir if( bCreate )
142cdf0e10cSrcweir {
143cdf0e10cSrcweir AtomProvider* pNewClass;
144cdf0e10cSrcweir m_aAtomLists[ atomClass ] = pNewClass = new AtomProvider();
145cdf0e10cSrcweir return pNewClass->getAtom( rString, bCreate );
146cdf0e10cSrcweir }
147cdf0e10cSrcweir return INVALID_ATOM;
148cdf0e10cSrcweir }
149cdf0e10cSrcweir
getLastAtom(int atomClass) const150cdf0e10cSrcweir int MultiAtomProvider::getLastAtom( int atomClass ) const
151cdf0e10cSrcweir {
152cdf0e10cSrcweir ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it =
153cdf0e10cSrcweir m_aAtomLists.find( atomClass );
154cdf0e10cSrcweir
155cdf0e10cSrcweir return it != m_aAtomLists.end() ? it->second->getLastAtom() : INVALID_ATOM;
156cdf0e10cSrcweir }
157cdf0e10cSrcweir
getRecent(int atomClass,int atom,::std::list<::utl::AtomDescription> & atoms)158cdf0e10cSrcweir void MultiAtomProvider::getRecent( int atomClass, int atom, ::std::list< ::utl::AtomDescription >& atoms )
159cdf0e10cSrcweir {
160cdf0e10cSrcweir ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it =
161cdf0e10cSrcweir m_aAtomLists.find( atomClass );
162cdf0e10cSrcweir if( it != m_aAtomLists.end() )
163cdf0e10cSrcweir it->second->getRecent( atom, atoms );
164cdf0e10cSrcweir else
165cdf0e10cSrcweir atoms.clear();
166cdf0e10cSrcweir }
167cdf0e10cSrcweir
getString(int atomClass,int atom) const168cdf0e10cSrcweir const ::rtl::OUString& MultiAtomProvider::getString( int atomClass, int atom ) const
169cdf0e10cSrcweir {
170cdf0e10cSrcweir ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it =
171cdf0e10cSrcweir m_aAtomLists.find( atomClass );
172cdf0e10cSrcweir if( it != m_aAtomLists.end() )
173cdf0e10cSrcweir return it->second->getString( atom );
174cdf0e10cSrcweir
175cdf0e10cSrcweir static ::rtl::OUString aEmpty;
176cdf0e10cSrcweir return aEmpty;
177cdf0e10cSrcweir }
178cdf0e10cSrcweir
hasAtom(int atomClass,int atom) const179cdf0e10cSrcweir sal_Bool MultiAtomProvider::hasAtom( int atomClass, int atom ) const
180cdf0e10cSrcweir {
181cdf0e10cSrcweir ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass );
182cdf0e10cSrcweir return it != m_aAtomLists.end() ? it->second->hasAtom( atom ) : sal_False;
183cdf0e10cSrcweir }
184cdf0e10cSrcweir
getClass(int atomClass,::std::list<::utl::AtomDescription> & atoms) const185cdf0e10cSrcweir void MultiAtomProvider::getClass( int atomClass, ::std::list< ::utl::AtomDescription >& atoms) const
186cdf0e10cSrcweir {
187cdf0e10cSrcweir ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass );
188cdf0e10cSrcweir
189cdf0e10cSrcweir if( it != m_aAtomLists.end() )
190cdf0e10cSrcweir it->second->getAll( atoms );
191cdf0e10cSrcweir else
192cdf0e10cSrcweir atoms.clear();
193cdf0e10cSrcweir }
194cdf0e10cSrcweir
overrideAtom(int atomClass,int atom,const::rtl::OUString & description)195cdf0e10cSrcweir void MultiAtomProvider::overrideAtom( int atomClass, int atom, const ::rtl::OUString& description )
196cdf0e10cSrcweir {
197cdf0e10cSrcweir ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass );
198cdf0e10cSrcweir if( it == m_aAtomLists.end() )
199cdf0e10cSrcweir m_aAtomLists[ atomClass ] = new AtomProvider();
200cdf0e10cSrcweir m_aAtomLists[ atomClass ]->overrideAtom( atom, description );
201cdf0e10cSrcweir }
202cdf0e10cSrcweir
203cdf0e10cSrcweir // -----------------------------------------------------------------------
204cdf0e10cSrcweir
AtomServer()205cdf0e10cSrcweir AtomServer::AtomServer()
206cdf0e10cSrcweir {
207cdf0e10cSrcweir }
208cdf0e10cSrcweir
~AtomServer()209cdf0e10cSrcweir AtomServer::~AtomServer()
210cdf0e10cSrcweir {
211cdf0e10cSrcweir }
212cdf0e10cSrcweir
getAtom(sal_Int32 atomClass,const::rtl::OUString & description,sal_Bool create)213cdf0e10cSrcweir sal_Int32 AtomServer::getAtom( sal_Int32 atomClass, const ::rtl::OUString& description, sal_Bool create ) throw()
214cdf0e10cSrcweir {
215cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > guard( m_aMutex );
216cdf0e10cSrcweir
217cdf0e10cSrcweir return m_aProvider.getAtom( atomClass, description, create );
218cdf0e10cSrcweir }
219cdf0e10cSrcweir
getClasses(const Sequence<sal_Int32> & atomClasses)220cdf0e10cSrcweir Sequence< Sequence< NMSP_UTIL::AtomDescription > > AtomServer::getClasses( const Sequence< sal_Int32 >& atomClasses ) throw()
221cdf0e10cSrcweir {
222cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > guard( m_aMutex );
223cdf0e10cSrcweir
224cdf0e10cSrcweir Sequence< Sequence< NMSP_UTIL::AtomDescription > > aRet( atomClasses.getLength() );
225cdf0e10cSrcweir for( int i = 0; i < atomClasses.getLength(); i++ )
226cdf0e10cSrcweir {
227cdf0e10cSrcweir aRet.getArray()[i] = getClass( atomClasses.getConstArray()[i] );
228cdf0e10cSrcweir }
229cdf0e10cSrcweir return aRet;
230cdf0e10cSrcweir }
231cdf0e10cSrcweir
getClass(sal_Int32 atomClass)232cdf0e10cSrcweir Sequence< NMSP_UTIL::AtomDescription > AtomServer::getClass( sal_Int32 atomClass ) throw()
233cdf0e10cSrcweir {
234cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > guard( m_aMutex );
235cdf0e10cSrcweir
236cdf0e10cSrcweir ::std::list< ::utl::AtomDescription > atoms;
237cdf0e10cSrcweir m_aProvider.getClass( atomClass, atoms );
238cdf0e10cSrcweir
239cdf0e10cSrcweir Sequence< NMSP_UTIL::AtomDescription > aRet( atoms.size() );
240cdf0e10cSrcweir for( int i = aRet.getLength()-1; i >= 0; i-- )
241cdf0e10cSrcweir {
242cdf0e10cSrcweir aRet.getArray()[i].atom = atoms.back().atom;
243cdf0e10cSrcweir aRet.getArray()[i].description = atoms.back().description;
244cdf0e10cSrcweir atoms.pop_back();
245cdf0e10cSrcweir }
246cdf0e10cSrcweir
247cdf0e10cSrcweir return aRet;
248cdf0e10cSrcweir }
249cdf0e10cSrcweir
getRecentAtoms(sal_Int32 atomClass,sal_Int32 atom)250cdf0e10cSrcweir Sequence< NMSP_UTIL::AtomDescription > AtomServer::getRecentAtoms( sal_Int32 atomClass, sal_Int32 atom ) throw()
251cdf0e10cSrcweir {
252cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > guard( m_aMutex );
253cdf0e10cSrcweir
254cdf0e10cSrcweir ::std::list< ::utl::AtomDescription > atoms;
255cdf0e10cSrcweir m_aProvider.getRecent( atomClass, atom, atoms );
256cdf0e10cSrcweir
257cdf0e10cSrcweir Sequence< NMSP_UTIL::AtomDescription > aRet( atoms.size() );
258cdf0e10cSrcweir for( int i = aRet.getLength()-1; i >= 0; i-- )
259cdf0e10cSrcweir {
260cdf0e10cSrcweir aRet.getArray()[i].atom = atoms.back().atom;
261cdf0e10cSrcweir aRet.getArray()[i].description = atoms.back().description;
262cdf0e10cSrcweir atoms.pop_back();
263cdf0e10cSrcweir }
264cdf0e10cSrcweir
265cdf0e10cSrcweir return aRet;
266cdf0e10cSrcweir }
267cdf0e10cSrcweir
getAtomDescriptions(const Sequence<AtomClassRequest> & atoms)268cdf0e10cSrcweir Sequence< ::rtl::OUString > AtomServer::getAtomDescriptions( const Sequence< AtomClassRequest >& atoms ) throw()
269cdf0e10cSrcweir {
270cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > guard( m_aMutex );
271cdf0e10cSrcweir
272cdf0e10cSrcweir int nStrings = 0, i;
273cdf0e10cSrcweir for( i = 0; i < atoms.getLength(); i++ )
274cdf0e10cSrcweir nStrings += atoms.getConstArray()[ i ].atoms.getLength();
275cdf0e10cSrcweir Sequence< ::rtl::OUString > aRet( nStrings );
276cdf0e10cSrcweir for( i = 0, nStrings = 0; i < atoms.getLength(); i++ )
277cdf0e10cSrcweir {
278cdf0e10cSrcweir const AtomClassRequest& rRequest = atoms.getConstArray()[i];
279cdf0e10cSrcweir for( int n = 0; n < rRequest.atoms.getLength(); n++ )
280cdf0e10cSrcweir aRet.getArray()[ nStrings++ ] = m_aProvider.getString( rRequest.atomClass, rRequest.atoms.getConstArray()[ n ] );
281cdf0e10cSrcweir }
282cdf0e10cSrcweir return aRet;
283cdf0e10cSrcweir }
284cdf0e10cSrcweir
285cdf0e10cSrcweir // -----------------------------------------------------------------------
286cdf0e10cSrcweir
AtomClient(const Reference<XAtomServer> & xServer)287cdf0e10cSrcweir AtomClient::AtomClient( const Reference< XAtomServer >& xServer ) :
288cdf0e10cSrcweir m_xServer( xServer )
289cdf0e10cSrcweir {
290cdf0e10cSrcweir }
291cdf0e10cSrcweir
~AtomClient()292cdf0e10cSrcweir AtomClient::~AtomClient()
293cdf0e10cSrcweir {
294cdf0e10cSrcweir }
295cdf0e10cSrcweir
getAtom(int atomClass,const::rtl::OUString & description,sal_Bool bCreate)296cdf0e10cSrcweir int AtomClient::getAtom( int atomClass, const ::rtl::OUString& description, sal_Bool bCreate )
297cdf0e10cSrcweir {
298cdf0e10cSrcweir int nAtom = m_aProvider.getAtom( atomClass, description, sal_False );
299cdf0e10cSrcweir if( nAtom == INVALID_ATOM && bCreate )
300cdf0e10cSrcweir {
301cdf0e10cSrcweir try
302cdf0e10cSrcweir {
303cdf0e10cSrcweir nAtom = m_xServer->getAtom( atomClass, description, bCreate );
304cdf0e10cSrcweir }
305cdf0e10cSrcweir catch( RuntimeException& )
306cdf0e10cSrcweir {
307cdf0e10cSrcweir return INVALID_ATOM;
308cdf0e10cSrcweir }
309cdf0e10cSrcweir if( nAtom != INVALID_ATOM )
310cdf0e10cSrcweir m_aProvider.overrideAtom( atomClass, nAtom, description );
311cdf0e10cSrcweir }
312cdf0e10cSrcweir return nAtom;
313cdf0e10cSrcweir }
314cdf0e10cSrcweir
getString(int atomClass,int atom)315cdf0e10cSrcweir const ::rtl::OUString& AtomClient::getString( int atomClass, int atom )
316cdf0e10cSrcweir {
317cdf0e10cSrcweir static ::rtl::OUString aEmpty;
318cdf0e10cSrcweir
319cdf0e10cSrcweir if( ! m_aProvider.hasAtom( atomClass, atom ) )
320cdf0e10cSrcweir {
321cdf0e10cSrcweir Sequence< NMSP_UTIL::AtomDescription > aSeq;
322cdf0e10cSrcweir try
323cdf0e10cSrcweir {
324cdf0e10cSrcweir aSeq = m_xServer->getRecentAtoms( atomClass, m_aProvider.getLastAtom( atomClass ) );
325cdf0e10cSrcweir }
326cdf0e10cSrcweir catch( RuntimeException& )
327cdf0e10cSrcweir {
328cdf0e10cSrcweir return aEmpty;
329cdf0e10cSrcweir }
330cdf0e10cSrcweir const NMSP_UTIL::AtomDescription* pDescriptions = aSeq.getConstArray();
331cdf0e10cSrcweir for( int i = 0; i < aSeq.getLength(); i++ )
332cdf0e10cSrcweir m_aProvider.overrideAtom( atomClass,
333cdf0e10cSrcweir pDescriptions[i].atom,
334cdf0e10cSrcweir pDescriptions[i].description
335cdf0e10cSrcweir );
336cdf0e10cSrcweir
337cdf0e10cSrcweir if( ! m_aProvider.hasAtom( atomClass, atom ) )
338cdf0e10cSrcweir {
339cdf0e10cSrcweir // holes may occur by the above procedure!
340cdf0e10cSrcweir Sequence< AtomClassRequest > aReq( 1 );
341cdf0e10cSrcweir aReq.getArray()[0].atomClass = atomClass;
342cdf0e10cSrcweir aReq.getArray()[0].atoms.realloc( 1 );
343cdf0e10cSrcweir aReq.getArray()[0].atoms.getArray()[0] = atom;
344cdf0e10cSrcweir Sequence< ::rtl::OUString > aRet;
345cdf0e10cSrcweir try
346cdf0e10cSrcweir {
347cdf0e10cSrcweir aRet = m_xServer->getAtomDescriptions( aReq );
348cdf0e10cSrcweir }
349cdf0e10cSrcweir catch( RuntimeException& )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir return aEmpty;
352cdf0e10cSrcweir }
353cdf0e10cSrcweir if( aRet.getLength() == 1 )
354cdf0e10cSrcweir m_aProvider.overrideAtom( atomClass, atom, aRet.getConstArray()[0] );
355cdf0e10cSrcweir }
356cdf0e10cSrcweir }
357cdf0e10cSrcweir return m_aProvider.getString( atomClass, atom );
358cdf0e10cSrcweir }
359cdf0e10cSrcweir
updateAtomClasses(const Sequence<sal_Int32> & atomClasses)360cdf0e10cSrcweir void AtomClient::updateAtomClasses( const Sequence< sal_Int32 >& atomClasses )
361cdf0e10cSrcweir {
362cdf0e10cSrcweir Sequence< Sequence< NMSP_UTIL::AtomDescription > > aUpdate;
363cdf0e10cSrcweir try
364cdf0e10cSrcweir {
365cdf0e10cSrcweir aUpdate = m_xServer->getClasses( atomClasses );
366cdf0e10cSrcweir }
367cdf0e10cSrcweir catch( RuntimeException& )
368cdf0e10cSrcweir {
369cdf0e10cSrcweir return;
370cdf0e10cSrcweir }
371cdf0e10cSrcweir for( int i = 0; i < atomClasses.getLength(); i++ )
372cdf0e10cSrcweir {
373cdf0e10cSrcweir int nClass = atomClasses.getConstArray()[i];
374cdf0e10cSrcweir const Sequence< NMSP_UTIL::AtomDescription >& rClass = aUpdate.getConstArray()[i];
375cdf0e10cSrcweir const NMSP_UTIL::AtomDescription* pDesc = rClass.getConstArray();
376cdf0e10cSrcweir for( int n = 0; n < rClass.getLength(); n++, pDesc++ )
377cdf0e10cSrcweir m_aProvider.overrideAtom( nClass, pDesc->atom, pDesc->description );
378cdf0e10cSrcweir }
379cdf0e10cSrcweir }
380