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: stringresource.hxx,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 #ifndef SCRIPTING_DLGPROV_HXX
32 #define SCRIPTING_DLGPROV_HXX
34 #ifndef _COM_SUN_STAR_AWT_XSTRINGRESOURCEWITHSTORAGE_HPP_
35 #include <com/sun/star/resource/XStringResourceWithStorage.hpp>
37 #ifndef _COM_SUN_STAR_AWT_XSTRINGRESOURCEWITHSTORAGE_HPP_
38 #include <com/sun/star/resource/XStringResourceWithLocation.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/lang/XInitialization.hpp>
42 #include <com/sun/star/uno/XComponentContext.hpp>
43 #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
44 #include <com/sun/star/io/XInputStream.hpp>
45 #include <com/sun/star/io/XOutputStream.hpp>
46 #include <cppuhelper/implbase1.hxx>
47 #include <cppuhelper/implbase2.hxx>
48 #include <cppuhelper/interfacecontainer.hxx>
49 #include <osl/mutex.hxx>
54 //.........................................................................
55 namespace stringresource
57 //.........................................................................
59 // =============================================================================
61 // =============================================================================
63 ::osl::Mutex
& getMutex();
66 // =============================================================================
67 // class stringresourceImpl
68 // =============================================================================
70 // Hashtable to map string ids to string
73 size_t operator()(const ::rtl::OUString Str
) const
75 return (size_t)Str
.hashCode();
81 sal_Bool
operator()(const ::rtl::OUString Str1
, const ::rtl::OUString Str2
) const
83 return ( Str1
== Str2
);
108 ::com::sun::star::lang::Locale m_locale
;
109 IdToStringMap m_aIdToStringMap
;
110 IdToIndexMap m_aIdToIndexMap
;
111 sal_Int32 m_nNextIndex
;
115 LocaleItem( ::com::sun::star::lang::Locale locale
, bool bLoaded
=true )
118 , m_bLoaded( bLoaded
)
119 , m_bModified( false )
123 typedef std::vector
< LocaleItem
* > LocaleItemVector
;
124 typedef std::vector
< LocaleItem
* >::iterator LocaleItemVectorIt
;
125 typedef std::vector
< LocaleItem
* >::const_iterator LocaleItemVectorConstIt
;
127 typedef ::cppu::WeakImplHelper2
<
128 ::com::sun::star::lang::XServiceInfo
,
129 ::com::sun::star::resource::XStringResourceManager
> StringResourceImpl_BASE
;
131 class StringResourceImpl
: public StringResourceImpl_BASE
134 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
135 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiComponentFactory
> m_xMCF
;
137 LocaleItem
* m_pCurrentLocaleItem
;
138 LocaleItem
* m_pDefaultLocaleItem
;
139 bool m_bDefaultModified
;
141 ::cppu::OInterfaceContainerHelper m_aListenerContainer
;
143 LocaleItemVector m_aLocaleItemVector
;
144 LocaleItemVector m_aDeletedLocaleItemVector
;
145 LocaleItemVector m_aChangedDefaultLocaleVector
;
150 sal_Int32 m_nNextUniqueNumericId
;
152 // Scans ResourceID to start with number and adapt m_nNextUniqueNumericId
153 void implScanIdForNumber( const ::rtl::OUString
& ResourceID
);
154 const static sal_Int32 UNIQUE_NUMBER_NEEDS_INITIALISATION
= -1;
156 // Checks read only status and throws exception if it's true
157 void implCheckReadOnly( const sal_Char
* pExceptionMsg
)
158 throw (::com::sun::star::lang::NoSupportException
);
160 // Return the context's MultiComponentFactory
161 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiComponentFactory
>
162 getMultiComponentFactory( void );
164 // Returns the LocalItem for a given locale, if it exists, otherwise NULL
165 // This method compares the locales exactly, no closest match search is performed
166 LocaleItem
* getItemForLocale( const ::com::sun::star::lang::Locale
& locale
, sal_Bool bException
)
167 throw (::com::sun::star::lang::IllegalArgumentException
);
169 // Returns the LocalItem for a given locale, if it exists, otherwise NULL
170 // This method performes a closest match search, at least the language must match
171 LocaleItem
* getClosestMatchItemForLocale( const ::com::sun::star::lang::Locale
& locale
);
172 void implSetCurrentLocale( const ::com::sun::star::lang::Locale
& locale
,
173 sal_Bool FindClosestMatch
, sal_Bool bUseDefaultIfNoMatch
)
174 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
176 void implModified( void );
177 void implNotifyListeners( void );
179 //=== Impl methods for ...ForLocale methods ===
180 ::rtl::OUString SAL_CALL
implResolveString( const ::rtl::OUString
& ResourceID
, LocaleItem
* pLocaleItem
)
181 throw (::com::sun::star::resource::MissingResourceException
);
182 ::sal_Bool
implHasEntryForId( const ::rtl::OUString
& ResourceID
, LocaleItem
* pLocaleItem
);
183 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> implGetResourceIDs( LocaleItem
* pLocaleItem
);
184 void implSetString( const ::rtl::OUString
& ResourceID
,
185 const ::rtl::OUString
& Str
, LocaleItem
* pLocaleItem
);
186 void implRemoveId( const ::rtl::OUString
& ResourceID
, LocaleItem
* pLocaleItem
)
187 throw (::com::sun::star::resource::MissingResourceException
);
189 // Method to load a locale if necessary, returns true if loading was
190 // successful. Default implementation in base class just returns true.
191 virtual bool loadLocale( LocaleItem
* pLocaleItem
);
193 virtual void implLoadAllLocales( void );
197 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
198 virtual ~StringResourceImpl();
201 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
202 throw (::com::sun::star::uno::RuntimeException
);
203 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
204 throw (::com::sun::star::uno::RuntimeException
);
205 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( )
206 throw (::com::sun::star::uno::RuntimeException
);
208 // XModifyBroadcaster
209 virtual void SAL_CALL
addModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
210 throw (::com::sun::star::uno::RuntimeException
);
211 virtual void SAL_CALL
removeModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
212 throw (::com::sun::star::uno::RuntimeException
);
214 // XStringResourceResolver
215 virtual ::rtl::OUString SAL_CALL
resolveString( const ::rtl::OUString
& ResourceID
)
216 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
);
217 virtual ::rtl::OUString SAL_CALL
resolveStringForLocale( const ::rtl::OUString
& ResourceID
,
218 const ::com::sun::star::lang::Locale
& locale
)
219 throw ( ::com::sun::star::resource::MissingResourceException
,
220 ::com::sun::star::uno::RuntimeException
);
221 virtual ::sal_Bool SAL_CALL
hasEntryForId( const ::rtl::OUString
& ResourceID
)
222 throw (::com::sun::star::uno::RuntimeException
);
223 virtual ::sal_Bool SAL_CALL
hasEntryForIdAndLocale( const ::rtl::OUString
& ResourceID
,
224 const ::com::sun::star::lang::Locale
& locale
)
225 throw (::com::sun::star::uno::RuntimeException
);
226 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getResourceIDs( )
227 throw (::com::sun::star::uno::RuntimeException
);
228 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL getResourceIDsForLocale
229 ( const ::com::sun::star::lang::Locale
& locale
)
230 throw (::com::sun::star::uno::RuntimeException
);
231 virtual ::com::sun::star::lang::Locale SAL_CALL
getCurrentLocale( )
232 throw (::com::sun::star::uno::RuntimeException
);
233 virtual ::com::sun::star::lang::Locale SAL_CALL
getDefaultLocale( )
234 throw (::com::sun::star::uno::RuntimeException
);
235 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::lang::Locale
> SAL_CALL
getLocales( )
236 throw (::com::sun::star::uno::RuntimeException
);
238 // XStringResourceManager
239 virtual ::sal_Bool SAL_CALL
isReadOnly()
240 throw (::com::sun::star::uno::RuntimeException
);
241 virtual void SAL_CALL
setCurrentLocale( const ::com::sun::star::lang::Locale
& locale
, ::sal_Bool FindClosestMatch
)
242 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
243 virtual void SAL_CALL
setDefaultLocale( const ::com::sun::star::lang::Locale
& locale
)
244 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
,
245 ::com::sun::star::lang::NoSupportException
);
246 virtual void SAL_CALL
setString( const ::rtl::OUString
& ResourceID
, const ::rtl::OUString
& Str
)
247 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
248 virtual void SAL_CALL
setStringForLocale( const ::rtl::OUString
& ResourceID
, const ::rtl::OUString
& Str
,
249 const ::com::sun::star::lang::Locale
& locale
)
250 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
251 virtual void SAL_CALL
removeId( const ::rtl::OUString
& ResourceID
)
252 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
,
253 ::com::sun::star::lang::NoSupportException
);
254 virtual void SAL_CALL
removeIdForLocale( const ::rtl::OUString
& ResourceID
,
255 const ::com::sun::star::lang::Locale
& locale
)
256 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
,
257 ::com::sun::star::lang::NoSupportException
);
258 virtual void SAL_CALL
newLocale( const ::com::sun::star::lang::Locale
& locale
)
259 throw (::com::sun::star::container::ElementExistException
, ::com::sun::star::lang::IllegalArgumentException
,
260 ::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
261 virtual void SAL_CALL
removeLocale( const ::com::sun::star::lang::Locale
& locale
)
262 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
,
263 ::com::sun::star::lang::NoSupportException
);
264 virtual ::sal_Int32 SAL_CALL
getUniqueNumericId( )
265 throw (::com::sun::star::lang::NoSupportException
,
266 ::com::sun::star::uno::RuntimeException
);
269 typedef ::cppu::ImplInheritanceHelper1
<
271 ::com::sun::star::resource::XStringResourcePersistence
> StringResourcePersistenceImpl_BASE
;
276 class StringResourcePersistenceImpl
: public StringResourcePersistenceImpl_BASE
279 ::rtl::OUString m_aNameBase
;
280 ::rtl::OUString m_aComment
;
282 void SAL_CALL implInitializeCommonParameters
283 ( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
284 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
286 // Scan locale properties files
287 virtual void implScanLocales( void );
289 // Method to load a locale if necessary, returns true if loading was successful
290 virtual bool loadLocale( LocaleItem
* pLocaleItem
);
292 // does the actual loading
293 virtual bool implLoadLocale( LocaleItem
* pLocaleItem
);
295 virtual void implLoadAllLocales( void );
297 void implScanLocaleNames( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aContentSeq
);
298 ::rtl::OUString
implGetFileNameForLocaleItem( LocaleItem
* pLocaleItem
, const ::rtl::OUString
& aNameBase
);
299 ::rtl::OUString
implGetPathForLocaleItem( LocaleItem
* pLocaleItem
, const ::rtl::OUString
& aNameBase
,
300 const ::rtl::OUString
& aLocation
, bool bDefaultFile
=false );
302 bool implReadPropertiesFile( LocaleItem
* pLocaleItem
,
303 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xInput
);
305 bool implWritePropertiesFile( LocaleItem
* pLocaleItem
, const ::com::sun::star::uno::Reference
306 < ::com::sun::star::io::XOutputStream
>& xOutputStream
, const ::rtl::OUString
& aComment
);
308 void implWriteLocaleBinary( LocaleItem
* pLocaleItem
, BinaryOutput
& rOut
);
310 void implStoreAtStorage
312 const ::rtl::OUString
& aNameBase
,
313 const ::rtl::OUString
& aComment
,
314 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& Storage
,
318 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
320 void implKillRemovedLocaleFiles
322 const ::rtl::OUString
& Location
,
323 const ::rtl::OUString
& aNameBase
,
324 const ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XSimpleFileAccess
>& xFileAccess
326 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
328 void implKillChangedDefaultFiles
330 const ::rtl::OUString
& Location
,
331 const ::rtl::OUString
& aNameBase
,
332 const ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XSimpleFileAccess
>& xFileAccess
334 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
336 void implStoreAtLocation
338 const ::rtl::OUString
& Location
,
339 const ::rtl::OUString
& aNameBase
,
340 const ::rtl::OUString
& aComment
,
341 const ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XSimpleFileAccess
>& xFileAccess
,
344 bool bKillAll
= false
346 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
349 StringResourcePersistenceImpl(
350 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
351 virtual ~StringResourcePersistenceImpl();
354 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
355 throw (::com::sun::star::uno::RuntimeException
);
356 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
357 throw (::com::sun::star::uno::RuntimeException
);
358 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( )
359 throw (::com::sun::star::uno::RuntimeException
);
361 // XModifyBroadcaster
362 virtual void SAL_CALL
addModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
363 throw (::com::sun::star::uno::RuntimeException
);
364 virtual void SAL_CALL
removeModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
365 throw (::com::sun::star::uno::RuntimeException
);
367 // XStringResourceResolver
368 virtual ::rtl::OUString SAL_CALL
resolveString( const ::rtl::OUString
& ResourceID
)
369 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
);
370 virtual ::rtl::OUString SAL_CALL
resolveStringForLocale( const ::rtl::OUString
& ResourceID
,
371 const ::com::sun::star::lang::Locale
& locale
)
372 throw ( ::com::sun::star::resource::MissingResourceException
,
373 ::com::sun::star::uno::RuntimeException
);
374 virtual ::sal_Bool SAL_CALL
hasEntryForId( const ::rtl::OUString
& ResourceID
)
375 throw (::com::sun::star::uno::RuntimeException
);
376 virtual ::sal_Bool SAL_CALL
hasEntryForIdAndLocale( const ::rtl::OUString
& ResourceID
,
377 const ::com::sun::star::lang::Locale
& locale
)
378 throw (::com::sun::star::uno::RuntimeException
);
379 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getResourceIDs( )
380 throw (::com::sun::star::uno::RuntimeException
);
381 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL getResourceIDsForLocale
382 ( const ::com::sun::star::lang::Locale
& locale
)
383 throw (::com::sun::star::uno::RuntimeException
);
384 virtual ::com::sun::star::lang::Locale SAL_CALL
getCurrentLocale( )
385 throw (::com::sun::star::uno::RuntimeException
);
386 virtual ::com::sun::star::lang::Locale SAL_CALL
getDefaultLocale( )
387 throw (::com::sun::star::uno::RuntimeException
);
388 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::lang::Locale
> SAL_CALL
getLocales( )
389 throw (::com::sun::star::uno::RuntimeException
);
391 // XStringResourceManager
392 virtual ::sal_Bool SAL_CALL
isReadOnly()
393 throw (::com::sun::star::uno::RuntimeException
);
394 virtual void SAL_CALL
setCurrentLocale( const ::com::sun::star::lang::Locale
& locale
, ::sal_Bool FindClosestMatch
)
395 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
396 virtual void SAL_CALL
setDefaultLocale( const ::com::sun::star::lang::Locale
& locale
)
397 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
,
398 ::com::sun::star::lang::NoSupportException
);
399 virtual void SAL_CALL
setString( const ::rtl::OUString
& ResourceID
, const ::rtl::OUString
& Str
)
400 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
401 virtual void SAL_CALL
setStringForLocale( const ::rtl::OUString
& ResourceID
, const ::rtl::OUString
& Str
,
402 const ::com::sun::star::lang::Locale
& locale
)
403 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
404 virtual void SAL_CALL
removeId( const ::rtl::OUString
& ResourceID
)
405 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
,
406 ::com::sun::star::lang::NoSupportException
);
407 virtual void SAL_CALL
removeIdForLocale( const ::rtl::OUString
& ResourceID
,
408 const ::com::sun::star::lang::Locale
& locale
)
409 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
,
410 ::com::sun::star::lang::NoSupportException
);
411 virtual void SAL_CALL
newLocale( const ::com::sun::star::lang::Locale
& locale
)
412 throw (::com::sun::star::container::ElementExistException
, ::com::sun::star::lang::IllegalArgumentException
,
413 ::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
414 virtual void SAL_CALL
removeLocale( const ::com::sun::star::lang::Locale
& locale
)
415 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
,
416 ::com::sun::star::lang::NoSupportException
);
417 virtual ::sal_Int32 SAL_CALL
getUniqueNumericId( )
418 throw (::com::sun::star::lang::NoSupportException
,
419 ::com::sun::star::uno::RuntimeException
);
421 // XStringResourcePersistence
422 virtual void SAL_CALL
store( )
423 throw (::com::sun::star::lang::NoSupportException
,
424 ::com::sun::star::uno::Exception
,
425 ::com::sun::star::uno::RuntimeException
);
426 virtual ::sal_Bool SAL_CALL
isModified( )
427 throw (::com::sun::star::uno::RuntimeException
);
428 virtual void SAL_CALL
setComment( const ::rtl::OUString
& Comment
)
429 throw (::com::sun::star::uno::RuntimeException
);
430 virtual void SAL_CALL storeToStorage
431 ( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& Storage
,
432 const ::rtl::OUString
& NameBase
, const ::rtl::OUString
& Comment
)
433 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
434 virtual void SAL_CALL
storeToURL( const ::rtl::OUString
& URL
, const ::rtl::OUString
& NameBase
,
435 const ::rtl::OUString
& Comment
, const ::com::sun::star::uno::Reference
436 < ::com::sun::star::task::XInteractionHandler
>& Handler
)
437 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
438 virtual ::com::sun::star::uno::Sequence
< ::sal_Int8
> SAL_CALL
exportBinary( )
439 throw (::com::sun::star::uno::RuntimeException
);
440 virtual void SAL_CALL
importBinary( const ::com::sun::star::uno::Sequence
< ::sal_Int8
>& Data
)
441 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
445 typedef ::cppu::ImplInheritanceHelper2
<
446 StringResourcePersistenceImpl
,
447 ::com::sun::star::lang::XInitialization
,
448 ::com::sun::star::resource::XStringResourceWithStorage
> StringResourceWithStorageImpl_BASE
;
450 class StringResourceWithStorageImpl
: public StringResourceWithStorageImpl_BASE
452 ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
> m_xStorage
;
453 bool m_bStorageChanged
;
455 virtual void implScanLocales( void );
456 virtual bool implLoadLocale( LocaleItem
* pLocaleItem
);
459 StringResourceWithStorageImpl(
460 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
461 virtual ~StringResourceWithStorageImpl();
464 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
465 throw (::com::sun::star::uno::RuntimeException
);
466 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
467 throw (::com::sun::star::uno::RuntimeException
);
468 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( )
469 throw (::com::sun::star::uno::RuntimeException
);
472 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
473 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
475 // XModifyBroadcaster
476 virtual void SAL_CALL
addModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
477 throw (::com::sun::star::uno::RuntimeException
);
478 virtual void SAL_CALL
removeModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
479 throw (::com::sun::star::uno::RuntimeException
);
481 // XStringResourceResolver
482 virtual ::rtl::OUString SAL_CALL
resolveString( const ::rtl::OUString
& ResourceID
)
483 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
);
484 virtual ::rtl::OUString SAL_CALL
resolveStringForLocale( const ::rtl::OUString
& ResourceID
,
485 const ::com::sun::star::lang::Locale
& locale
)
486 throw ( ::com::sun::star::resource::MissingResourceException
,
487 ::com::sun::star::uno::RuntimeException
);
488 virtual ::sal_Bool SAL_CALL
hasEntryForId( const ::rtl::OUString
& ResourceID
)
489 throw (::com::sun::star::uno::RuntimeException
);
490 virtual ::sal_Bool SAL_CALL
hasEntryForIdAndLocale( const ::rtl::OUString
& ResourceID
,
491 const ::com::sun::star::lang::Locale
& locale
)
492 throw (::com::sun::star::uno::RuntimeException
);
493 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getResourceIDs( )
494 throw (::com::sun::star::uno::RuntimeException
);
495 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL getResourceIDsForLocale
496 ( const ::com::sun::star::lang::Locale
& locale
)
497 throw (::com::sun::star::uno::RuntimeException
);
498 virtual ::com::sun::star::lang::Locale SAL_CALL
getCurrentLocale( )
499 throw (::com::sun::star::uno::RuntimeException
);
500 virtual ::com::sun::star::lang::Locale SAL_CALL
getDefaultLocale( )
501 throw (::com::sun::star::uno::RuntimeException
);
502 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::lang::Locale
> SAL_CALL
getLocales( )
503 throw (::com::sun::star::uno::RuntimeException
);
505 // XStringResourceManager
506 virtual ::sal_Bool SAL_CALL
isReadOnly()
507 throw (::com::sun::star::uno::RuntimeException
);
508 virtual void SAL_CALL
setCurrentLocale( const ::com::sun::star::lang::Locale
& locale
, ::sal_Bool FindClosestMatch
)
509 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
510 virtual void SAL_CALL
setDefaultLocale( const ::com::sun::star::lang::Locale
& locale
)
511 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
,
512 ::com::sun::star::lang::NoSupportException
);
513 virtual void SAL_CALL
setString( const ::rtl::OUString
& ResourceID
, const ::rtl::OUString
& Str
)
514 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
515 virtual void SAL_CALL
setStringForLocale( const ::rtl::OUString
& ResourceID
, const ::rtl::OUString
& Str
,
516 const ::com::sun::star::lang::Locale
& locale
)
517 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
518 virtual void SAL_CALL
removeId( const ::rtl::OUString
& ResourceID
)
519 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
,
520 ::com::sun::star::lang::NoSupportException
);
521 virtual void SAL_CALL
removeIdForLocale( const ::rtl::OUString
& ResourceID
,
522 const ::com::sun::star::lang::Locale
& locale
)
523 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
,
524 ::com::sun::star::lang::NoSupportException
);
525 virtual void SAL_CALL
newLocale( const ::com::sun::star::lang::Locale
& locale
)
526 throw (::com::sun::star::container::ElementExistException
, ::com::sun::star::lang::IllegalArgumentException
,
527 ::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
528 virtual void SAL_CALL
removeLocale( const ::com::sun::star::lang::Locale
& locale
)
529 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
,
530 ::com::sun::star::lang::NoSupportException
);
531 virtual ::sal_Int32 SAL_CALL
getUniqueNumericId( )
532 throw (::com::sun::star::lang::NoSupportException
,
533 ::com::sun::star::uno::RuntimeException
);
535 // XStringResourcePersistence
536 virtual void SAL_CALL
store( )
537 throw (::com::sun::star::lang::NoSupportException
,
538 ::com::sun::star::uno::Exception
,
539 ::com::sun::star::uno::RuntimeException
);
540 virtual ::sal_Bool SAL_CALL
isModified( )
541 throw (::com::sun::star::uno::RuntimeException
);
542 virtual void SAL_CALL
setComment( const ::rtl::OUString
& Comment
)
543 throw (::com::sun::star::uno::RuntimeException
);
544 virtual void SAL_CALL storeToStorage
545 ( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& Storage
,
546 const ::rtl::OUString
& NameBase
, const ::rtl::OUString
& Comment
)
547 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
548 virtual void SAL_CALL
storeToURL( const ::rtl::OUString
& URL
, const ::rtl::OUString
& NameBase
,
549 const ::rtl::OUString
& Comment
, const ::com::sun::star::uno::Reference
550 < ::com::sun::star::task::XInteractionHandler
>& Handler
)
551 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
552 virtual ::com::sun::star::uno::Sequence
< ::sal_Int8
> SAL_CALL
exportBinary( )
553 throw (::com::sun::star::uno::RuntimeException
);
554 virtual void SAL_CALL
importBinary( const ::com::sun::star::uno::Sequence
< ::sal_Int8
>& Data
)
555 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
557 // XStringResourceWithStorage
558 virtual void SAL_CALL storeAsStorage
559 ( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& Storage
)
560 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
561 virtual void SAL_CALL setStorage
562 ( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& Storage
)
563 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
567 typedef ::cppu::ImplInheritanceHelper2
<
568 StringResourcePersistenceImpl
,
569 ::com::sun::star::lang::XInitialization
,
570 ::com::sun::star::resource::XStringResourceWithLocation
> StringResourceWithLocationImpl_BASE
;
572 class StringResourceWithLocationImpl
: public StringResourceWithLocationImpl_BASE
574 ::rtl::OUString m_aLocation
;
575 bool m_bLocationChanged
;
576 com::sun::star::uno::Reference
< com::sun::star::ucb::XSimpleFileAccess
> m_xSFI
;
577 com::sun::star::uno::Reference
< com::sun::star::task::XInteractionHandler
> m_xInteractionHandler
;
579 const ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XSimpleFileAccess
> getFileAccess( void );
581 virtual void implScanLocales( void );
582 virtual bool implLoadLocale( LocaleItem
* pLocaleItem
);
585 StringResourceWithLocationImpl(
586 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
587 virtual ~StringResourceWithLocationImpl();
590 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
591 throw (::com::sun::star::uno::RuntimeException
);
592 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
593 throw (::com::sun::star::uno::RuntimeException
);
594 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( )
595 throw (::com::sun::star::uno::RuntimeException
);
598 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
599 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
601 // XModifyBroadcaster
602 virtual void SAL_CALL
addModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
603 throw (::com::sun::star::uno::RuntimeException
);
604 virtual void SAL_CALL
removeModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
605 throw (::com::sun::star::uno::RuntimeException
);
607 // XStringResourceResolver
608 virtual ::rtl::OUString SAL_CALL
resolveString( const ::rtl::OUString
& ResourceID
)
609 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
);
610 virtual ::rtl::OUString SAL_CALL
resolveStringForLocale( const ::rtl::OUString
& ResourceID
,
611 const ::com::sun::star::lang::Locale
& locale
)
612 throw ( ::com::sun::star::resource::MissingResourceException
,
613 ::com::sun::star::uno::RuntimeException
);
614 virtual ::sal_Bool SAL_CALL
hasEntryForId( const ::rtl::OUString
& ResourceID
)
615 throw (::com::sun::star::uno::RuntimeException
);
616 virtual ::sal_Bool SAL_CALL
hasEntryForIdAndLocale( const ::rtl::OUString
& ResourceID
,
617 const ::com::sun::star::lang::Locale
& locale
)
618 throw (::com::sun::star::uno::RuntimeException
);
619 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getResourceIDs( )
620 throw (::com::sun::star::uno::RuntimeException
);
621 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL getResourceIDsForLocale
622 ( const ::com::sun::star::lang::Locale
& locale
)
623 throw (::com::sun::star::uno::RuntimeException
);
624 virtual ::com::sun::star::lang::Locale SAL_CALL
getCurrentLocale( )
625 throw (::com::sun::star::uno::RuntimeException
);
626 virtual ::com::sun::star::lang::Locale SAL_CALL
getDefaultLocale( )
627 throw (::com::sun::star::uno::RuntimeException
);
628 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::lang::Locale
> SAL_CALL
getLocales( )
629 throw (::com::sun::star::uno::RuntimeException
);
631 // XStringResourceManager
632 virtual ::sal_Bool SAL_CALL
isReadOnly()
633 throw (::com::sun::star::uno::RuntimeException
);
634 virtual void SAL_CALL
setCurrentLocale( const ::com::sun::star::lang::Locale
& locale
, ::sal_Bool FindClosestMatch
)
635 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
636 virtual void SAL_CALL
setDefaultLocale( const ::com::sun::star::lang::Locale
& locale
)
637 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
,
638 ::com::sun::star::lang::NoSupportException
);
639 virtual void SAL_CALL
setString( const ::rtl::OUString
& ResourceID
, const ::rtl::OUString
& Str
)
640 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
641 virtual void SAL_CALL
setStringForLocale( const ::rtl::OUString
& ResourceID
, const ::rtl::OUString
& Str
,
642 const ::com::sun::star::lang::Locale
& locale
)
643 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
644 virtual void SAL_CALL
removeId( const ::rtl::OUString
& ResourceID
)
645 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
,
646 ::com::sun::star::lang::NoSupportException
);
647 virtual void SAL_CALL
removeIdForLocale( const ::rtl::OUString
& ResourceID
,
648 const ::com::sun::star::lang::Locale
& locale
)
649 throw (::com::sun::star::resource::MissingResourceException
, ::com::sun::star::uno::RuntimeException
,
650 ::com::sun::star::lang::NoSupportException
);
651 virtual void SAL_CALL
newLocale( const ::com::sun::star::lang::Locale
& locale
)
652 throw (::com::sun::star::container::ElementExistException
, ::com::sun::star::lang::IllegalArgumentException
,
653 ::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
654 virtual void SAL_CALL
removeLocale( const ::com::sun::star::lang::Locale
& locale
)
655 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
,
656 ::com::sun::star::lang::NoSupportException
);
657 virtual ::sal_Int32 SAL_CALL
getUniqueNumericId( )
658 throw (::com::sun::star::lang::NoSupportException
,
659 ::com::sun::star::uno::RuntimeException
);
661 // XStringResourcePersistence
662 virtual void SAL_CALL
store( )
663 throw (::com::sun::star::lang::NoSupportException
,
664 ::com::sun::star::uno::Exception
,
665 ::com::sun::star::uno::RuntimeException
);
666 virtual ::sal_Bool SAL_CALL
isModified( )
667 throw (::com::sun::star::uno::RuntimeException
);
668 virtual void SAL_CALL
setComment( const ::rtl::OUString
& Comment
)
669 throw (::com::sun::star::uno::RuntimeException
);
670 virtual void SAL_CALL storeToStorage
671 ( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& Storage
,
672 const ::rtl::OUString
& NameBase
, const ::rtl::OUString
& Comment
)
673 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
674 virtual void SAL_CALL
storeToURL( const ::rtl::OUString
& URL
, const ::rtl::OUString
& NameBase
,
675 const ::rtl::OUString
& Comment
, const ::com::sun::star::uno::Reference
676 < ::com::sun::star::task::XInteractionHandler
>& Handler
)
677 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
678 virtual ::com::sun::star::uno::Sequence
< ::sal_Int8
> SAL_CALL
exportBinary( )
679 throw (::com::sun::star::uno::RuntimeException
);
680 virtual void SAL_CALL
importBinary( const ::com::sun::star::uno::Sequence
< ::sal_Int8
>& Data
)
681 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
683 // XStringResourceWithLocation
684 virtual void SAL_CALL
storeAsURL( const ::rtl::OUString
& URL
)
685 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
686 virtual void SAL_CALL
setURL( const ::rtl::OUString
& URL
)
687 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
690 //.........................................................................
691 } // namespace stringtable
692 //.........................................................................
694 #endif // SCRIPTING_DLGPROV_HXX