bump product version to 4.1.6.2
[LibreOffice.git] / scripting / source / stringresource / stringresource.hxx
blobd8e2968f44d25bc1565243c025a11069cf11d7d4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SCRIPTING_DLGPROV_HXX
21 #define SCRIPTING_DLGPROV_HXX
23 #include <com/sun/star/resource/XStringResourceWithStorage.hpp>
24 #include <com/sun/star/resource/XStringResourceWithLocation.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/lang/XInitialization.hpp>
27 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
29 #include <com/sun/star/io/XInputStream.hpp>
30 #include <com/sun/star/io/XOutputStream.hpp>
31 #include <cppuhelper/implbase1.hxx>
32 #include <cppuhelper/implbase2.hxx>
33 #include <cppuhelper/interfacecontainer.hxx>
34 #include <osl/mutex.hxx>
36 #include <vector>
37 #include <boost/unordered_map.hpp>
39 //.........................................................................
40 namespace stringresource
42 //.........................................................................
44 // =============================================================================
45 // mutex
46 // =============================================================================
48 ::osl::Mutex& getMutex();
51 // =============================================================================
52 // class stringresourceImpl
53 // =============================================================================
55 // Hashtable to map string ids to string
56 struct hashName_Impl
58 size_t operator()(const OUString Str) const
60 return (size_t)Str.hashCode();
64 struct eqName_Impl
66 sal_Bool operator()(const OUString Str1, const OUString Str2) const
68 return ( Str1 == Str2 );
72 typedef boost::unordered_map
74 OUString,
75 OUString,
76 hashName_Impl,
77 eqName_Impl
79 IdToStringMap;
81 typedef boost::unordered_map
83 OUString,
84 sal_Int32,
85 hashName_Impl,
86 eqName_Impl
88 IdToIndexMap;
91 struct LocaleItem
93 ::com::sun::star::lang::Locale m_locale;
94 IdToStringMap m_aIdToStringMap;
95 IdToIndexMap m_aIdToIndexMap;
96 sal_Int32 m_nNextIndex;
97 bool m_bLoaded;
98 bool m_bModified;
100 LocaleItem( ::com::sun::star::lang::Locale locale, bool bLoaded=true )
101 : m_locale( locale )
102 , m_nNextIndex( 0 )
103 , m_bLoaded( bLoaded )
104 , m_bModified( false )
108 typedef std::vector< LocaleItem* > LocaleItemVector;
109 typedef std::vector< LocaleItem* >::iterator LocaleItemVectorIt;
110 typedef std::vector< LocaleItem* >::const_iterator LocaleItemVectorConstIt;
112 typedef ::cppu::WeakImplHelper2<
113 ::com::sun::star::lang::XServiceInfo,
114 ::com::sun::star::resource::XStringResourceManager > StringResourceImpl_BASE;
116 class StringResourceImpl : public StringResourceImpl_BASE
118 protected:
119 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
120 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > m_xMCF;
122 LocaleItem* m_pCurrentLocaleItem;
123 LocaleItem* m_pDefaultLocaleItem;
124 bool m_bDefaultModified;
126 ::cppu::OInterfaceContainerHelper m_aListenerContainer;
128 LocaleItemVector m_aLocaleItemVector;
129 LocaleItemVector m_aDeletedLocaleItemVector;
130 LocaleItemVector m_aChangedDefaultLocaleVector;
132 bool m_bModified;
133 bool m_bReadOnly;
135 sal_Int32 m_nNextUniqueNumericId;
137 // Scans ResourceID to start with number and adapt m_nNextUniqueNumericId
138 void implScanIdForNumber( const OUString& ResourceID );
139 const static sal_Int32 UNIQUE_NUMBER_NEEDS_INITIALISATION = -1;
141 // Checks read only status and throws exception if it's true
142 void implCheckReadOnly( const sal_Char* pExceptionMsg )
143 throw (::com::sun::star::lang::NoSupportException);
145 // Return the context's MultiComponentFactory
146 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory >
147 getMultiComponentFactory( void );
149 // Returns the LocalItem for a given locale, if it exists, otherwise NULL
150 // This method compares the locales exactly, no closest match search is performed
151 LocaleItem* getItemForLocale( const ::com::sun::star::lang::Locale& locale, sal_Bool bException )
152 throw (::com::sun::star::lang::IllegalArgumentException);
154 // Returns the LocalItem for a given locale, if it exists, otherwise NULL
155 // This method performes a closest match search, at least the language must match
156 LocaleItem* getClosestMatchItemForLocale( const ::com::sun::star::lang::Locale& locale );
157 void implSetCurrentLocale( const ::com::sun::star::lang::Locale& locale,
158 sal_Bool FindClosestMatch, sal_Bool bUseDefaultIfNoMatch )
159 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
161 void implModified( void );
162 void implNotifyListeners( void );
164 //=== Impl methods for ...ForLocale methods ===
165 OUString SAL_CALL implResolveString( const OUString& ResourceID, LocaleItem* pLocaleItem )
166 throw (::com::sun::star::resource::MissingResourceException);
167 ::sal_Bool implHasEntryForId( const OUString& ResourceID, LocaleItem* pLocaleItem );
168 ::com::sun::star::uno::Sequence< OUString > implGetResourceIDs( LocaleItem* pLocaleItem );
169 void implSetString( const OUString& ResourceID,
170 const OUString& Str, LocaleItem* pLocaleItem );
171 void implRemoveId( const OUString& ResourceID, LocaleItem* pLocaleItem )
172 throw (::com::sun::star::resource::MissingResourceException);
174 // Method to load a locale if necessary, returns true if loading was
175 // successful. Default implementation in base class just returns true.
176 virtual bool loadLocale( LocaleItem* pLocaleItem );
178 virtual void implLoadAllLocales( void );
180 public:
181 StringResourceImpl(
182 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
183 virtual ~StringResourceImpl();
185 // XServiceInfo
186 virtual OUString SAL_CALL getImplementationName( )
187 throw (::com::sun::star::uno::RuntimeException);
188 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
189 throw (::com::sun::star::uno::RuntimeException);
190 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
191 throw (::com::sun::star::uno::RuntimeException);
193 // XModifyBroadcaster
194 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
195 throw (::com::sun::star::uno::RuntimeException);
196 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
197 throw (::com::sun::star::uno::RuntimeException);
199 // XStringResourceResolver
200 virtual OUString SAL_CALL resolveString( const OUString& ResourceID )
201 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException);
202 virtual OUString SAL_CALL resolveStringForLocale( const OUString& ResourceID,
203 const ::com::sun::star::lang::Locale& locale )
204 throw ( ::com::sun::star::resource::MissingResourceException,
205 ::com::sun::star::uno::RuntimeException);
206 virtual ::sal_Bool SAL_CALL hasEntryForId( const OUString& ResourceID )
207 throw (::com::sun::star::uno::RuntimeException);
208 virtual ::sal_Bool SAL_CALL hasEntryForIdAndLocale( const OUString& ResourceID,
209 const ::com::sun::star::lang::Locale& locale )
210 throw (::com::sun::star::uno::RuntimeException);
211 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDs( )
212 throw (::com::sun::star::uno::RuntimeException);
213 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale
214 ( const ::com::sun::star::lang::Locale& locale )
215 throw (::com::sun::star::uno::RuntimeException);
216 virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( )
217 throw (::com::sun::star::uno::RuntimeException);
218 virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( )
219 throw (::com::sun::star::uno::RuntimeException);
220 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( )
221 throw (::com::sun::star::uno::RuntimeException);
223 // XStringResourceManager
224 virtual ::sal_Bool SAL_CALL isReadOnly()
225 throw (::com::sun::star::uno::RuntimeException);
226 virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, ::sal_Bool FindClosestMatch )
227 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
228 virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale )
229 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
230 ::com::sun::star::lang::NoSupportException);
231 virtual void SAL_CALL setString( const OUString& ResourceID, const OUString& Str )
232 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
233 virtual void SAL_CALL setStringForLocale( const OUString& ResourceID, const OUString& Str,
234 const ::com::sun::star::lang::Locale& locale )
235 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
236 virtual void SAL_CALL removeId( const OUString& ResourceID )
237 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
238 ::com::sun::star::lang::NoSupportException);
239 virtual void SAL_CALL removeIdForLocale( const OUString& ResourceID,
240 const ::com::sun::star::lang::Locale& locale )
241 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
242 ::com::sun::star::lang::NoSupportException);
243 virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale )
244 throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException,
245 ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
246 virtual void SAL_CALL removeLocale( const ::com::sun::star::lang::Locale& locale )
247 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
248 ::com::sun::star::lang::NoSupportException);
249 virtual ::sal_Int32 SAL_CALL getUniqueNumericId( )
250 throw (::com::sun::star::lang::NoSupportException,
251 ::com::sun::star::uno::RuntimeException);
254 typedef ::cppu::ImplInheritanceHelper1<
255 StringResourceImpl,
256 ::com::sun::star::resource::XStringResourcePersistence > StringResourcePersistenceImpl_BASE;
258 class BinaryOutput;
260 class StringResourcePersistenceImpl : public StringResourcePersistenceImpl_BASE
262 protected:
263 OUString m_aNameBase;
264 OUString m_aComment;
266 void SAL_CALL implInitializeCommonParameters
267 ( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
268 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
270 // Scan locale properties files
271 virtual void implScanLocales( void );
273 // Method to load a locale if necessary, returns true if loading was successful
274 virtual bool loadLocale( LocaleItem* pLocaleItem );
276 // does the actual loading
277 virtual bool implLoadLocale( LocaleItem* pLocaleItem );
279 virtual void implLoadAllLocales( void );
281 void implScanLocaleNames( const ::com::sun::star::uno::Sequence< OUString >& aContentSeq );
282 OUString implGetFileNameForLocaleItem( LocaleItem* pLocaleItem, const OUString& aNameBase );
283 OUString implGetPathForLocaleItem( LocaleItem* pLocaleItem, const OUString& aNameBase,
284 const OUString& aLocation, bool bDefaultFile=false );
286 bool implReadPropertiesFile( LocaleItem* pLocaleItem,
287 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput );
289 bool implWritePropertiesFile( LocaleItem* pLocaleItem, const ::com::sun::star::uno::Reference
290 < ::com::sun::star::io::XOutputStream >& xOutputStream, const OUString& aComment );
292 void implWriteLocaleBinary( LocaleItem* pLocaleItem, BinaryOutput& rOut );
294 void implStoreAtStorage
296 const OUString& aNameBase,
297 const OUString& aComment,
298 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage,
299 bool bUsedForStore,
300 bool bStoreAll
302 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
304 void implKillRemovedLocaleFiles
306 const OUString& Location,
307 const OUString& aNameBase,
308 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess
310 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
312 void implKillChangedDefaultFiles
314 const OUString& Location,
315 const OUString& aNameBase,
316 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess
318 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
320 void implStoreAtLocation
322 const OUString& Location,
323 const OUString& aNameBase,
324 const OUString& aComment,
325 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess,
326 bool bUsedForStore,
327 bool bStoreAll,
328 bool bKillAll = false
330 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
332 public:
333 StringResourcePersistenceImpl(
334 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
335 virtual ~StringResourcePersistenceImpl();
337 // XServiceInfo
338 virtual OUString SAL_CALL getImplementationName( )
339 throw (::com::sun::star::uno::RuntimeException);
340 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
341 throw (::com::sun::star::uno::RuntimeException);
342 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
343 throw (::com::sun::star::uno::RuntimeException);
345 // XModifyBroadcaster
346 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
347 throw (::com::sun::star::uno::RuntimeException);
348 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
349 throw (::com::sun::star::uno::RuntimeException);
351 // XStringResourceResolver
352 virtual OUString SAL_CALL resolveString( const OUString& ResourceID )
353 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException);
354 virtual OUString SAL_CALL resolveStringForLocale( const OUString& ResourceID,
355 const ::com::sun::star::lang::Locale& locale )
356 throw ( ::com::sun::star::resource::MissingResourceException,
357 ::com::sun::star::uno::RuntimeException);
358 virtual ::sal_Bool SAL_CALL hasEntryForId( const OUString& ResourceID )
359 throw (::com::sun::star::uno::RuntimeException);
360 virtual ::sal_Bool SAL_CALL hasEntryForIdAndLocale( const OUString& ResourceID,
361 const ::com::sun::star::lang::Locale& locale )
362 throw (::com::sun::star::uno::RuntimeException);
363 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDs( )
364 throw (::com::sun::star::uno::RuntimeException);
365 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale
366 ( const ::com::sun::star::lang::Locale& locale )
367 throw (::com::sun::star::uno::RuntimeException);
368 virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( )
369 throw (::com::sun::star::uno::RuntimeException);
370 virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( )
371 throw (::com::sun::star::uno::RuntimeException);
372 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( )
373 throw (::com::sun::star::uno::RuntimeException);
375 // XStringResourceManager
376 virtual ::sal_Bool SAL_CALL isReadOnly()
377 throw (::com::sun::star::uno::RuntimeException);
378 virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, ::sal_Bool FindClosestMatch )
379 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
380 virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale )
381 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
382 ::com::sun::star::lang::NoSupportException);
383 virtual void SAL_CALL setString( const OUString& ResourceID, const OUString& Str )
384 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
385 virtual void SAL_CALL setStringForLocale( const OUString& ResourceID, const OUString& Str,
386 const ::com::sun::star::lang::Locale& locale )
387 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
388 virtual void SAL_CALL removeId( const OUString& ResourceID )
389 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
390 ::com::sun::star::lang::NoSupportException);
391 virtual void SAL_CALL removeIdForLocale( const OUString& ResourceID,
392 const ::com::sun::star::lang::Locale& locale )
393 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
394 ::com::sun::star::lang::NoSupportException);
395 virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale )
396 throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException,
397 ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
398 virtual void SAL_CALL removeLocale( const ::com::sun::star::lang::Locale& locale )
399 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
400 ::com::sun::star::lang::NoSupportException);
401 virtual ::sal_Int32 SAL_CALL getUniqueNumericId( )
402 throw (::com::sun::star::lang::NoSupportException,
403 ::com::sun::star::uno::RuntimeException);
405 // XStringResourcePersistence
406 virtual void SAL_CALL store( )
407 throw (::com::sun::star::lang::NoSupportException,
408 ::com::sun::star::uno::Exception,
409 ::com::sun::star::uno::RuntimeException);
410 virtual ::sal_Bool SAL_CALL isModified( )
411 throw (::com::sun::star::uno::RuntimeException);
412 virtual void SAL_CALL setComment( const OUString& Comment )
413 throw (::com::sun::star::uno::RuntimeException);
414 virtual void SAL_CALL storeToStorage
415 ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage,
416 const OUString& NameBase, const OUString& Comment )
417 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
418 virtual void SAL_CALL storeToURL( const OUString& URL, const OUString& NameBase,
419 const OUString& Comment, const ::com::sun::star::uno::Reference
420 < ::com::sun::star::task::XInteractionHandler >& Handler )
421 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
422 virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL exportBinary( )
423 throw (::com::sun::star::uno::RuntimeException);
424 virtual void SAL_CALL importBinary( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& Data )
425 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
429 typedef ::cppu::ImplInheritanceHelper2<
430 StringResourcePersistenceImpl,
431 ::com::sun::star::lang::XInitialization,
432 ::com::sun::star::resource::XStringResourceWithStorage > StringResourceWithStorageImpl_BASE;
434 class StringResourceWithStorageImpl : public StringResourceWithStorageImpl_BASE
436 ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xStorage;
437 bool m_bStorageChanged;
439 virtual void implScanLocales( void );
440 virtual bool implLoadLocale( LocaleItem* pLocaleItem );
442 public:
443 StringResourceWithStorageImpl(
444 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
445 virtual ~StringResourceWithStorageImpl();
447 // XServiceInfo
448 virtual OUString SAL_CALL getImplementationName( )
449 throw (::com::sun::star::uno::RuntimeException);
450 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
451 throw (::com::sun::star::uno::RuntimeException);
452 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
453 throw (::com::sun::star::uno::RuntimeException);
455 // XInitialization
456 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
457 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
459 // XModifyBroadcaster
460 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
461 throw (::com::sun::star::uno::RuntimeException);
462 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
463 throw (::com::sun::star::uno::RuntimeException);
465 // XStringResourceResolver
466 virtual OUString SAL_CALL resolveString( const OUString& ResourceID )
467 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException);
468 virtual OUString SAL_CALL resolveStringForLocale( const OUString& ResourceID,
469 const ::com::sun::star::lang::Locale& locale )
470 throw ( ::com::sun::star::resource::MissingResourceException,
471 ::com::sun::star::uno::RuntimeException);
472 virtual ::sal_Bool SAL_CALL hasEntryForId( const OUString& ResourceID )
473 throw (::com::sun::star::uno::RuntimeException);
474 virtual ::sal_Bool SAL_CALL hasEntryForIdAndLocale( const OUString& ResourceID,
475 const ::com::sun::star::lang::Locale& locale )
476 throw (::com::sun::star::uno::RuntimeException);
477 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDs( )
478 throw (::com::sun::star::uno::RuntimeException);
479 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale
480 ( const ::com::sun::star::lang::Locale& locale )
481 throw (::com::sun::star::uno::RuntimeException);
482 virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( )
483 throw (::com::sun::star::uno::RuntimeException);
484 virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( )
485 throw (::com::sun::star::uno::RuntimeException);
486 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( )
487 throw (::com::sun::star::uno::RuntimeException);
489 // XStringResourceManager
490 virtual ::sal_Bool SAL_CALL isReadOnly()
491 throw (::com::sun::star::uno::RuntimeException);
492 virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, ::sal_Bool FindClosestMatch )
493 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
494 virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale )
495 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
496 ::com::sun::star::lang::NoSupportException);
497 virtual void SAL_CALL setString( const OUString& ResourceID, const OUString& Str )
498 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
499 virtual void SAL_CALL setStringForLocale( const OUString& ResourceID, const OUString& Str,
500 const ::com::sun::star::lang::Locale& locale )
501 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
502 virtual void SAL_CALL removeId( const OUString& ResourceID )
503 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
504 ::com::sun::star::lang::NoSupportException);
505 virtual void SAL_CALL removeIdForLocale( const OUString& ResourceID,
506 const ::com::sun::star::lang::Locale& locale )
507 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
508 ::com::sun::star::lang::NoSupportException);
509 virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale )
510 throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException,
511 ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
512 virtual void SAL_CALL removeLocale( const ::com::sun::star::lang::Locale& locale )
513 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
514 ::com::sun::star::lang::NoSupportException);
515 virtual ::sal_Int32 SAL_CALL getUniqueNumericId( )
516 throw (::com::sun::star::lang::NoSupportException,
517 ::com::sun::star::uno::RuntimeException);
519 // XStringResourcePersistence
520 virtual void SAL_CALL store( )
521 throw (::com::sun::star::lang::NoSupportException,
522 ::com::sun::star::uno::Exception,
523 ::com::sun::star::uno::RuntimeException);
524 virtual ::sal_Bool SAL_CALL isModified( )
525 throw (::com::sun::star::uno::RuntimeException);
526 virtual void SAL_CALL setComment( const OUString& Comment )
527 throw (::com::sun::star::uno::RuntimeException);
528 virtual void SAL_CALL storeToStorage
529 ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage,
530 const OUString& NameBase, const OUString& Comment )
531 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
532 virtual void SAL_CALL storeToURL( const OUString& URL, const OUString& NameBase,
533 const OUString& Comment, const ::com::sun::star::uno::Reference
534 < ::com::sun::star::task::XInteractionHandler >& Handler )
535 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
536 virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL exportBinary( )
537 throw (::com::sun::star::uno::RuntimeException);
538 virtual void SAL_CALL importBinary( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& Data )
539 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
541 // XStringResourceWithStorage
542 virtual void SAL_CALL storeAsStorage
543 ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage )
544 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
545 virtual void SAL_CALL setStorage
546 ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage )
547 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
551 typedef ::cppu::ImplInheritanceHelper2<
552 StringResourcePersistenceImpl,
553 ::com::sun::star::lang::XInitialization,
554 ::com::sun::star::resource::XStringResourceWithLocation > StringResourceWithLocationImpl_BASE;
556 class StringResourceWithLocationImpl : public StringResourceWithLocationImpl_BASE
558 OUString m_aLocation;
559 bool m_bLocationChanged;
560 com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess3 > m_xSFI;
561 com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInteractionHandler;
563 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 > getFileAccess( void );
565 virtual void implScanLocales( void );
566 virtual bool implLoadLocale( LocaleItem* pLocaleItem );
568 public:
569 StringResourceWithLocationImpl(
570 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
571 virtual ~StringResourceWithLocationImpl();
573 // XServiceInfo
574 virtual OUString SAL_CALL getImplementationName( )
575 throw (::com::sun::star::uno::RuntimeException);
576 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
577 throw (::com::sun::star::uno::RuntimeException);
578 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
579 throw (::com::sun::star::uno::RuntimeException);
581 // XInitialization
582 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
583 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
585 // XModifyBroadcaster
586 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
587 throw (::com::sun::star::uno::RuntimeException);
588 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
589 throw (::com::sun::star::uno::RuntimeException);
591 // XStringResourceResolver
592 virtual OUString SAL_CALL resolveString( const OUString& ResourceID )
593 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException);
594 virtual OUString SAL_CALL resolveStringForLocale( const OUString& ResourceID,
595 const ::com::sun::star::lang::Locale& locale )
596 throw ( ::com::sun::star::resource::MissingResourceException,
597 ::com::sun::star::uno::RuntimeException);
598 virtual ::sal_Bool SAL_CALL hasEntryForId( const OUString& ResourceID )
599 throw (::com::sun::star::uno::RuntimeException);
600 virtual ::sal_Bool SAL_CALL hasEntryForIdAndLocale( const OUString& ResourceID,
601 const ::com::sun::star::lang::Locale& locale )
602 throw (::com::sun::star::uno::RuntimeException);
603 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDs( )
604 throw (::com::sun::star::uno::RuntimeException);
605 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale
606 ( const ::com::sun::star::lang::Locale& locale )
607 throw (::com::sun::star::uno::RuntimeException);
608 virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( )
609 throw (::com::sun::star::uno::RuntimeException);
610 virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( )
611 throw (::com::sun::star::uno::RuntimeException);
612 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( )
613 throw (::com::sun::star::uno::RuntimeException);
615 // XStringResourceManager
616 virtual ::sal_Bool SAL_CALL isReadOnly()
617 throw (::com::sun::star::uno::RuntimeException);
618 virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, ::sal_Bool FindClosestMatch )
619 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
620 virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale )
621 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
622 ::com::sun::star::lang::NoSupportException);
623 virtual void SAL_CALL setString( const OUString& ResourceID, const OUString& Str )
624 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
625 virtual void SAL_CALL setStringForLocale( const OUString& ResourceID, const OUString& Str,
626 const ::com::sun::star::lang::Locale& locale )
627 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
628 virtual void SAL_CALL removeId( const OUString& ResourceID )
629 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
630 ::com::sun::star::lang::NoSupportException);
631 virtual void SAL_CALL removeIdForLocale( const OUString& ResourceID,
632 const ::com::sun::star::lang::Locale& locale )
633 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
634 ::com::sun::star::lang::NoSupportException);
635 virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale )
636 throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException,
637 ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
638 virtual void SAL_CALL removeLocale( const ::com::sun::star::lang::Locale& locale )
639 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
640 ::com::sun::star::lang::NoSupportException);
641 virtual ::sal_Int32 SAL_CALL getUniqueNumericId( )
642 throw (::com::sun::star::lang::NoSupportException,
643 ::com::sun::star::uno::RuntimeException);
645 // XStringResourcePersistence
646 virtual void SAL_CALL store( )
647 throw (::com::sun::star::lang::NoSupportException,
648 ::com::sun::star::uno::Exception,
649 ::com::sun::star::uno::RuntimeException);
650 virtual ::sal_Bool SAL_CALL isModified( )
651 throw (::com::sun::star::uno::RuntimeException);
652 virtual void SAL_CALL setComment( const OUString& Comment )
653 throw (::com::sun::star::uno::RuntimeException);
654 virtual void SAL_CALL storeToStorage
655 ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage,
656 const OUString& NameBase, const OUString& Comment )
657 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
658 virtual void SAL_CALL storeToURL( const OUString& URL, const OUString& NameBase,
659 const OUString& Comment, const ::com::sun::star::uno::Reference
660 < ::com::sun::star::task::XInteractionHandler >& Handler )
661 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
662 virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL exportBinary( )
663 throw (::com::sun::star::uno::RuntimeException);
664 virtual void SAL_CALL importBinary( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& Data )
665 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
667 // XStringResourceWithLocation
668 virtual void SAL_CALL storeAsURL( const OUString& URL )
669 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
670 virtual void SAL_CALL setURL( const OUString& URL )
671 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
674 //.........................................................................
675 } // namespace stringtable
676 //.........................................................................
678 #endif // SCRIPTING_DLGPROV_HXX
680 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */