1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: convdiclist.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_linguistic.hxx"
33 #include <tools/fsys.hxx>
34 #include <tools/stream.hxx>
35 #include <tools/urlobj.hxx>
36 #include <svtools/pathoptions.hxx>
37 #include <svtools/useroptions.hxx>
38 #include <svtools/lingucfg.hxx>
39 #include <sfx2/docfile.hxx>
40 #include <vcl/svapp.hxx>
41 #include <rtl/instance.hxx>
42 #include <cppuhelper/factory.hxx> // helper for factories
43 #include <unotools/localfilehelper.hxx>
44 #include <com/sun/star/linguistic2/XConversionDictionaryList.hpp>
45 #include <com/sun/star/linguistic2/XConversionDictionary.hpp>
46 #include <com/sun/star/linguistic2/ConversionDictionaryType.hpp>
47 #include <com/sun/star/util/XFlushable.hpp>
48 #include <com/sun/star/lang/Locale.hpp>
49 #ifndef _COM_SUN_STAR_UNO_REFERENCE_HPP_
50 #include <com/sun/star/uno/Reference.h>
52 #include <com/sun/star/registry/XRegistryKey.hpp>
53 #include <com/sun/star/container/XNameContainer.hpp>
55 #include <ucbhelper/content.hxx>
57 #include "convdiclist.hxx"
58 #include "convdic.hxx"
59 #include "hhconvdic.hxx"
63 //using namespace utl;
66 using namespace com::sun::star
;
67 using namespace com::sun::star::lang
;
68 using namespace com::sun::star::uno
;
69 using namespace com::sun::star::container
;
70 using namespace com::sun::star::linguistic2
;
71 using namespace linguistic
;
73 #define SN_CONV_DICTIONARY_LIST "com.sun.star.linguistic2.ConversionDictionaryList"
76 ///////////////////////////////////////////////////////////////////////////
78 bool operator == ( const Locale
&r1
, const Locale
&r2
)
80 return r1
.Language
== r2
.Language
&&
81 r1
.Country
== r2
.Country
&&
82 r1
.Variant
== r2
.Variant
;
85 ///////////////////////////////////////////////////////////////////////////
87 String
GetConvDicMainURL( const String
&rDicName
, const String
&rDirectoryURL
)
89 // build URL to use for new (persistent) dictionaries
91 String
aFullDicName( rDicName
);
92 aFullDicName
.AppendAscii( CONV_DIC_DOT_EXT
);
94 INetURLObject aURLObj
;
95 aURLObj
.SetSmartProtocol( INET_PROT_FILE
);
96 aURLObj
.SetSmartURL( rDirectoryURL
);
97 aURLObj
.Append( aFullDicName
, INetURLObject::ENCODE_ALL
);
98 DBG_ASSERT(!aURLObj
.HasError(), "invalid URL");
99 if (aURLObj
.HasError())
102 return aURLObj
.GetMainURL( INetURLObject::DECODE_TO_IURI
);
105 ///////////////////////////////////////////////////////////////////////////
107 class ConvDicNameContainer
:
108 public cppu::WeakImplHelper1
110 ::com::sun::star::container::XNameContainer
113 uno::Sequence
< uno::Reference
< XConversionDictionary
> > aConvDics
;
114 ConvDicList
&rConvDicList
;
116 // disallow copy-constructor and assignment-operator for now
117 ConvDicNameContainer(const ConvDicNameContainer
&);
118 ConvDicNameContainer
& operator = (const ConvDicNameContainer
&);
120 INT32
GetIndexByName_Impl( const OUString
& rName
);
123 ConvDicNameContainer( ConvDicList
&rMyConvDicList
);
124 virtual ~ConvDicNameContainer();
127 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType( ) throw (::com::sun::star::uno::RuntimeException
);
128 virtual sal_Bool SAL_CALL
hasElements( ) throw (::com::sun::star::uno::RuntimeException
);
131 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
132 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames( ) throw (::com::sun::star::uno::RuntimeException
);
133 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::uno::RuntimeException
);
136 virtual void SAL_CALL
replaceByName( const ::rtl::OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
139 virtual void SAL_CALL
insertByName( const ::rtl::OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::container::ElementExistException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
140 virtual void SAL_CALL
removeByName( const ::rtl::OUString
& Name
) throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
143 // looks for conversion dictionaries with the specified extension
144 // in the directory and adds them to the container
145 void AddConvDics( const String
&rSearchDirPathURL
, const String
&rExtension
);
147 // calls Flush for the dictionaries that support XFlushable
148 void FlushDics() const;
150 INT32
GetCount() const { return aConvDics
.getLength(); }
151 uno::Reference
< XConversionDictionary
> GetByName( const OUString
& rName
);
153 const uno::Reference
< XConversionDictionary
> GetByIndex( INT32 nIdx
)
155 return aConvDics
.getConstArray()[nIdx
];
160 ConvDicNameContainer::ConvDicNameContainer( ConvDicList
&rMyConvDicList
) :
161 rConvDicList( rMyConvDicList
)
166 ConvDicNameContainer::~ConvDicNameContainer()
171 void ConvDicNameContainer::FlushDics() const
173 INT32 nLen
= aConvDics
.getLength();
174 const uno::Reference
< XConversionDictionary
> *pDic
= aConvDics
.getConstArray();
175 for (INT32 i
= 0; i
< nLen
; ++i
)
177 uno::Reference
< util::XFlushable
> xFlush( pDic
[i
] , UNO_QUERY
);
186 DBG_ERROR( "flushing of conversion dictionary failed" );
193 INT32
ConvDicNameContainer::GetIndexByName_Impl(
194 const OUString
& rName
)
197 INT32 nLen
= aConvDics
.getLength();
198 const uno::Reference
< XConversionDictionary
> *pDic
= aConvDics
.getConstArray();
199 for (INT32 i
= 0; i
< nLen
&& nRes
== -1; ++i
)
201 if (rName
== pDic
[i
]->getName())
208 uno::Reference
< XConversionDictionary
> ConvDicNameContainer::GetByName(
209 const OUString
& rName
)
211 uno::Reference
< XConversionDictionary
> xRes
;
212 INT32 nIdx
= GetIndexByName_Impl( rName
);
214 xRes
= aConvDics
.getArray()[nIdx
];
219 uno::Type SAL_CALL
ConvDicNameContainer::getElementType( )
220 throw (RuntimeException
)
222 MutexGuard
aGuard( GetLinguMutex() );
223 return uno::Type( ::getCppuType( (uno::Reference
< XConversionDictionary
> *) 0) );
227 sal_Bool SAL_CALL
ConvDicNameContainer::hasElements( )
228 throw (RuntimeException
)
230 MutexGuard
aGuard( GetLinguMutex() );
231 return aConvDics
.getLength() > 0;
235 uno::Any SAL_CALL
ConvDicNameContainer::getByName( const OUString
& rName
)
236 throw (NoSuchElementException
, WrappedTargetException
, RuntimeException
)
238 MutexGuard
aGuard( GetLinguMutex() );
239 uno::Reference
< XConversionDictionary
> xRes( GetByName( rName
) );
241 throw NoSuchElementException();
242 return makeAny( xRes
);
246 uno::Sequence
< OUString
> SAL_CALL
ConvDicNameContainer::getElementNames( )
247 throw (RuntimeException
)
249 MutexGuard
aGuard( GetLinguMutex() );
251 INT32 nLen
= aConvDics
.getLength();
252 uno::Sequence
< OUString
> aRes( nLen
);
253 OUString
*pName
= aRes
.getArray();
254 const uno::Reference
< XConversionDictionary
> *pDic
= aConvDics
.getConstArray();
255 for (INT32 i
= 0; i
< nLen
; ++i
)
256 pName
[i
] = pDic
[i
]->getName();
261 sal_Bool SAL_CALL
ConvDicNameContainer::hasByName( const OUString
& rName
)
262 throw (RuntimeException
)
264 MutexGuard
aGuard( GetLinguMutex() );
265 return GetByName( rName
).is();
269 void SAL_CALL
ConvDicNameContainer::replaceByName(
270 const OUString
& rName
,
271 const uno::Any
& rElement
)
272 throw (IllegalArgumentException
, NoSuchElementException
, WrappedTargetException
, RuntimeException
)
274 MutexGuard
aGuard( GetLinguMutex() );
276 INT32 nRplcIdx
= GetIndexByName_Impl( rName
);
278 throw NoSuchElementException();
279 uno::Reference
< XConversionDictionary
> xNew
;
281 if (!xNew
.is() || xNew
->getName() != rName
)
282 throw IllegalArgumentException();
283 aConvDics
.getArray()[ nRplcIdx
] = xNew
;
287 void SAL_CALL
ConvDicNameContainer::insertByName(
288 const OUString
& rName
,
289 const Any
& rElement
)
290 throw (IllegalArgumentException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
292 MutexGuard
aGuard( GetLinguMutex() );
294 if (GetByName( rName
).is())
295 throw ElementExistException();
296 uno::Reference
< XConversionDictionary
> xNew
;
298 if (!xNew
.is() || xNew
->getName() != rName
)
299 throw IllegalArgumentException();
301 INT32 nLen
= aConvDics
.getLength();
302 aConvDics
.realloc( nLen
+ 1 );
303 aConvDics
.getArray()[ nLen
] = xNew
;
307 void SAL_CALL
ConvDicNameContainer::removeByName( const OUString
& rName
)
308 throw (NoSuchElementException
, WrappedTargetException
, RuntimeException
)
310 MutexGuard
aGuard( GetLinguMutex() );
312 INT32 nRplcIdx
= GetIndexByName_Impl( rName
);
314 throw NoSuchElementException();
316 // physically remove dictionary
317 uno::Reference
< XConversionDictionary
> xDel
= aConvDics
.getArray()[nRplcIdx
];
318 String
aName( xDel
->getName() );
319 String
aDicMainURL( GetConvDicMainURL( aName
, GetDictionaryWriteablePath() ) );
320 INetURLObject
aObj( aDicMainURL
);
321 DBG_ASSERT( aObj
.GetProtocol() == INET_PROT_FILE
, "+HangulHanjaOptionsDialog::OkHdl(): non-file URLs cannot be deleted" );
322 if( aObj
.GetProtocol() == INET_PROT_FILE
)
326 ::ucbhelper::Content
aCnt( aObj
.GetMainURL( INetURLObject::NO_DECODE
),
327 uno::Reference
< ::com::sun::star::ucb::XCommandEnvironment
> () );
328 aCnt
.executeCommand( OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True
) ) );
330 catch( ::com::sun::star::ucb::CommandAbortedException
& )
332 DBG_ERRORFILE( "HangulHanjaOptionsDialog::OkHdl(): CommandAbortedException" );
336 DBG_ERRORFILE( "HangulHanjaOptionsDialog::OkHdl(): Any other exception" );
340 INT32 nLen
= aConvDics
.getLength();
341 uno::Reference
< XConversionDictionary
> *pDic
= aConvDics
.getArray();
342 for (INT32 i
= nRplcIdx
; i
< nLen
- 1; ++i
)
343 pDic
[i
] = pDic
[i
+ 1];
344 aConvDics
.realloc( nLen
- 1 );
348 void ConvDicNameContainer::AddConvDics(
349 const String
&rSearchDirPathURL
,
350 const String
&rExtension
)
352 const Sequence
< OUString
> aDirCnt(
353 utl::LocalFileHelper::GetFolderContents( rSearchDirPathURL
, FALSE
) );
354 const OUString
*pDirCnt
= aDirCnt
.getConstArray();
355 INT32 nEntries
= aDirCnt
.getLength();
357 for (INT32 i
= 0; i
< nEntries
; ++i
)
359 String
aURL( pDirCnt
[i
] );
361 xub_StrLen nPos
= aURL
.SearchBackward('.');
362 String
aExt(aURL
.Copy(nPos
+ 1));
364 String
aSearchExt( rExtension
);
365 aSearchExt
.ToLowerAscii();
366 if(aExt
!= aSearchExt
)
367 continue; // skip other files
371 if (IsConvDic( aURL
, nLang
, nConvType
))
373 // get decoded dictionary file name
374 INetURLObject
aURLObj( aURL
);
375 String aDicName
= aURLObj
.getBase( INetURLObject::LAST_SEGMENT
,
376 true, INetURLObject::DECODE_WITH_CHARSET
,
377 RTL_TEXTENCODING_UTF8
);
379 uno::Reference
< XConversionDictionary
> xDic
;
380 if (nLang
== LANGUAGE_KOREAN
&&
381 nConvType
== ConversionDictionaryType::HANGUL_HANJA
)
383 xDic
= new HHConvDic( aDicName
, aURL
);
385 else if ((nLang
== LANGUAGE_CHINESE_SIMPLIFIED
|| nLang
== LANGUAGE_CHINESE_TRADITIONAL
) &&
386 nConvType
== ConversionDictionaryType::SCHINESE_TCHINESE
)
388 xDic
= new ConvDic( aDicName
, nLang
, nConvType
, FALSE
, aURL
);
395 insertByName( xDic
->getName(), aAny
);
401 ///////////////////////////////////////////////////////////////////////////
405 template<typename T
, typename InitData
,
406 typename Unique
= InitData
, typename Data
= T
>
407 class StaticWithInit_
{
409 /** Gets the static. Mutual exclusion is performed using the
416 return *rtl_Instance
<
417 T
, StaticInstanceWithInit
,
418 ::osl::MutexGuard
, ::osl::GetGlobalMutex
,
419 Data
, InitData
>::create( StaticInstanceWithInit(),
420 ::osl::GetGlobalMutex(),
424 struct StaticInstanceWithInit
{
425 T
* operator () ( Data d
) {
426 static T
instance(d
);
432 //after src680m62 you can replace StaticWithInit_ with rtl::StaticWithInit and remove the above definition of StaticWithInit_
434 struct StaticConvDicList
: public StaticWithInit_
<
435 uno::Reference
<XInterface
>, StaticConvDicList
> {
436 uno::Reference
<XInterface
> operator () () {
437 return (cppu::OWeakObject
*) new ConvDicList
;
443 void ConvDicList::MyAppExitListener::AtExit()
445 rMyDicList
.FlushDics();
446 StaticConvDicList::get().clear();
449 ConvDicList::ConvDicList() :
450 aEvtListeners( GetLinguMutex() )
455 pExitListener
= new MyAppExitListener( *this );
456 xExitListener
= pExitListener
;
457 pExitListener
->Activate();
461 ConvDicList::~ConvDicList()
463 // NameContainer will deleted when the reference xNameContainer
465 // delete pNameContainer;
467 if (!bDisposing
&& pNameContainer
)
468 pNameContainer
->FlushDics();
470 pExitListener
->Deactivate();
474 void ConvDicList::FlushDics()
476 // check only pointer to avoid creating the container when
477 // the dictionaries were not accessed yet
479 pNameContainer
->FlushDics();
483 ConvDicNameContainer
& ConvDicList::GetNameContainer()
487 pNameContainer
= new ConvDicNameContainer( *this );
488 pNameContainer
->AddConvDics( GetDictionaryWriteablePath(),
489 A2OU( CONV_DIC_EXT
) );
490 xNameContainer
= pNameContainer
;
492 // access list of text conversion dictionaries to activate
493 SvtLinguOptions aOpt
;
494 SvtLinguConfig().GetOptions( aOpt
);
495 INT32 nLen
= aOpt
.aActiveConvDics
.getLength();
496 const OUString
*pActiveConvDics
= aOpt
.aActiveConvDics
.getConstArray();
497 for (INT32 i
= 0; i
< nLen
; ++i
)
499 uno::Reference
< XConversionDictionary
> xDic
=
500 pNameContainer
->GetByName( pActiveConvDics
[i
] );
502 xDic
->setActive( sal_True
);
505 // since there is no UI to active/deactivate the dictionaries
506 // for chinese text conversion they should be activated by default
507 uno::Reference
< XConversionDictionary
> xS2TDic(
508 pNameContainer
->GetByName( A2OU("ChineseS2T") ), UNO_QUERY
);
509 uno::Reference
< XConversionDictionary
> xT2SDic(
510 pNameContainer
->GetByName( A2OU("ChineseT2S") ), UNO_QUERY
);
512 xS2TDic
->setActive( sal_True
);
514 xT2SDic
->setActive( sal_True
);
517 return *pNameContainer
;
521 uno::Reference
< container::XNameContainer
> SAL_CALL
ConvDicList::getDictionaryContainer( ) throw (RuntimeException
)
523 MutexGuard
aGuard( GetLinguMutex() );
525 DBG_ASSERT( xNameContainer
.is(), "missing name container" );
526 return xNameContainer
;
530 uno::Reference
< XConversionDictionary
> SAL_CALL
ConvDicList::addNewDictionary(
531 const OUString
& rName
,
532 const Locale
& rLocale
,
533 sal_Int16 nConvDicType
)
534 throw (NoSupportException
, ElementExistException
, RuntimeException
)
536 MutexGuard
aGuard( GetLinguMutex() );
538 INT16 nLang
= LocaleToLanguage( rLocale
);
540 if (GetNameContainer().hasByName( rName
))
541 throw ElementExistException();
543 uno::Reference
< XConversionDictionary
> xRes
;
544 String
aDicMainURL( GetConvDicMainURL( rName
, GetDictionaryWriteablePath() ) );
545 if (nLang
== LANGUAGE_KOREAN
&&
546 nConvDicType
== ConversionDictionaryType::HANGUL_HANJA
)
548 xRes
= new HHConvDic( rName
, aDicMainURL
);
550 else if ((nLang
== LANGUAGE_CHINESE_SIMPLIFIED
|| nLang
== LANGUAGE_CHINESE_TRADITIONAL
) &&
551 nConvDicType
== ConversionDictionaryType::SCHINESE_TCHINESE
)
553 xRes
= new ConvDic( rName
, nLang
, nConvDicType
, FALSE
, aDicMainURL
);
557 throw NoSupportException();
560 xRes
->setActive( sal_True
);
563 GetNameContainer().insertByName( rName
, aAny
);
569 uno::Sequence
< OUString
> SAL_CALL
ConvDicList::queryConversions(
570 const OUString
& rText
,
573 const Locale
& rLocale
,
574 sal_Int16 nConversionDictionaryType
,
575 ConversionDirection eDirection
,
576 sal_Int32 nTextConversionOptions
)
577 throw (IllegalArgumentException
, NoSupportException
, RuntimeException
)
579 MutexGuard
aGuard( GetLinguMutex() );
581 /*INT16 nLang = LocaleToLanguage( rLocale );*/
584 uno::Sequence
< OUString
> aRes( 20 );
585 OUString
*pRes
= aRes
.getArray();
587 sal_Bool bSupported
= sal_False
;
588 INT32 nLen
= GetNameContainer().GetCount();
589 for (INT32 i
= 0; i
< nLen
; ++i
)
591 const uno::Reference
< XConversionDictionary
> xDic( GetNameContainer().GetByIndex(i
) );
592 sal_Bool bMatch
= xDic
.is() &&
593 xDic
->getLocale() == rLocale
&&
594 xDic
->getConversionType() == nConversionDictionaryType
;
595 bSupported
|= bMatch
;
596 if (bMatch
&& xDic
->isActive())
598 Sequence
< OUString
> aNewConv( xDic
->getConversions(
599 rText
, nStartPos
, nLength
,
600 eDirection
, nTextConversionOptions
) );
601 INT32 nNewLen
= aNewConv
.getLength();
604 if (nCount
+ nNewLen
> aRes
.getLength())
606 aRes
.realloc( nCount
+ nNewLen
+ 20 );
607 pRes
= aRes
.getArray();
609 const OUString
*pNewConv
= aNewConv
.getConstArray();
610 for (INT32 k
= 0; k
< nNewLen
; ++k
)
611 pRes
[nCount
++] = pNewConv
[k
];
617 throw NoSupportException();
619 aRes
.realloc( nCount
);
624 sal_Int16 SAL_CALL
ConvDicList::queryMaxCharCount(
625 const Locale
& rLocale
,
626 sal_Int16 nConversionDictionaryType
,
627 ConversionDirection eDirection
)
628 throw (RuntimeException
)
630 MutexGuard
aGuard( GetLinguMutex() );
634 INT32 nLen
= GetNameContainer().GetCount();
635 for (INT32 i
= 0; i
< nLen
; ++i
)
637 const uno::Reference
< XConversionDictionary
> xDic( GetNameContainer().GetByIndex(i
) );
639 xDic
->getLocale() == rLocale
&&
640 xDic
->getConversionType() == nConversionDictionaryType
)
642 sal_Int16 nC
= xDic
->getMaxCharCount( eDirection
);
651 void SAL_CALL
ConvDicList::dispose( )
652 throw (RuntimeException
)
654 MutexGuard
aGuard( GetLinguMutex() );
658 EventObject
aEvtObj( (XConversionDictionaryList
*) this );
659 aEvtListeners
.disposeAndClear( aEvtObj
);
666 void SAL_CALL
ConvDicList::addEventListener(
667 const uno::Reference
< XEventListener
>& rxListener
)
668 throw (RuntimeException
)
670 MutexGuard
aGuard( GetLinguMutex() );
671 if (!bDisposing
&& rxListener
.is())
672 aEvtListeners
.addInterface( rxListener
);
676 void SAL_CALL
ConvDicList::removeEventListener(
677 const uno::Reference
< XEventListener
>& rxListener
)
678 throw (RuntimeException
)
680 MutexGuard
aGuard( GetLinguMutex() );
681 if (!bDisposing
&& rxListener
.is())
682 aEvtListeners
.removeInterface( rxListener
);
686 OUString SAL_CALL
ConvDicList::getImplementationName( )
687 throw (RuntimeException
)
689 MutexGuard
aGuard( GetLinguMutex() );
690 return getImplementationName_Static();
694 sal_Bool SAL_CALL
ConvDicList::supportsService( const OUString
& rServiceName
)
695 throw (RuntimeException
)
697 MutexGuard
aGuard( GetLinguMutex() );
698 return rServiceName
.equalsAscii( SN_CONV_DICTIONARY_LIST
);
702 uno::Sequence
< OUString
> SAL_CALL
ConvDicList::getSupportedServiceNames( )
703 throw (RuntimeException
)
705 MutexGuard
aGuard( GetLinguMutex() );
706 return getSupportedServiceNames_Static();
710 uno::Sequence
< OUString
> ConvDicList::getSupportedServiceNames_Static()
713 uno::Sequence
< OUString
> aSNS( 1 );
714 aSNS
.getArray()[0] = A2OU( SN_CONV_DICTIONARY_LIST
);
719 ///////////////////////////////////////////////////////////////////////////
721 uno::Reference
< uno::XInterface
> SAL_CALL
ConvDicList_CreateInstance(
722 const uno::Reference
< XMultiServiceFactory
> & /*rSMgr*/ )
725 return StaticConvDicList::get();
729 sal_Bool SAL_CALL
ConvDicList_writeInfo(
730 void * /*pServiceManager*/, registry::XRegistryKey
* pRegistryKey
)
735 aImpl
+= ConvDicList::getImplementationName_Static().getStr();
736 aImpl
.AppendAscii( "/UNO/SERVICES" );
737 uno::Reference
< registry::XRegistryKey
> xNewKey
=
738 pRegistryKey
->createKey(aImpl
);
739 uno::Sequence
< OUString
> aServices
=
740 ConvDicList::getSupportedServiceNames_Static();
741 for( INT32 i
= 0; i
< aServices
.getLength(); i
++ )
742 xNewKey
->createKey( aServices
.getConstArray()[i
]);
753 void * SAL_CALL
ConvDicList_getFactory(
754 const sal_Char
* pImplName
,
755 XMultiServiceFactory
* pServiceManager
, void * )
758 if ( !ConvDicList::getImplementationName_Static().compareToAscii( pImplName
) )
760 uno::Reference
< XSingleServiceFactory
> xFactory
=
761 cppu::createOneInstanceFactory(
763 ConvDicList::getImplementationName_Static(),
764 ConvDicList_CreateInstance
,
765 ConvDicList::getSupportedServiceNames_Static());
766 // acquire, because we return an interface pointer instead of a reference
768 pRet
= xFactory
.get();
773 ///////////////////////////////////////////////////////////////////////////