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