fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / scripting / source / stringresource / stringresource.hxx
bloba9c51178dda2e040464132dc582064b7889bade7
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 INCLUDED_SCRIPTING_SOURCE_STRINGRESOURCE_STRINGRESOURCE_HXX
21 #define INCLUDED_SCRIPTING_SOURCE_STRINGRESOURCE_STRINGRESOURCE_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 <unordered_map>
37 #include <vector>
40 namespace stringresource
45 // mutex
48 ::osl::Mutex& getMutex();
52 // class stringresourceImpl
55 // Hashtable to map string ids to string
56 typedef std::unordered_map
58 OUString,
59 OUString,
60 OUStringHash
62 IdToStringMap;
64 typedef std::unordered_map
66 OUString,
67 sal_Int32,
68 OUStringHash
70 IdToIndexMap;
73 struct LocaleItem
75 ::com::sun::star::lang::Locale m_locale;
76 IdToStringMap m_aIdToStringMap;
77 IdToIndexMap m_aIdToIndexMap;
78 sal_Int32 m_nNextIndex;
79 bool m_bLoaded;
80 bool m_bModified;
82 LocaleItem( ::com::sun::star::lang::Locale locale, bool bLoaded=true )
83 : m_locale( locale )
84 , m_nNextIndex( 0 )
85 , m_bLoaded( bLoaded )
86 , m_bModified( false )
90 typedef std::vector< LocaleItem* > LocaleItemVector;
91 typedef std::vector< LocaleItem* >::iterator LocaleItemVectorIt;
92 typedef std::vector< LocaleItem* >::const_iterator LocaleItemVectorConstIt;
94 typedef ::cppu::WeakImplHelper2<
95 ::com::sun::star::lang::XServiceInfo,
96 ::com::sun::star::resource::XStringResourceManager > StringResourceImpl_BASE;
98 class StringResourceImpl : public StringResourceImpl_BASE
100 protected:
101 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
102 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > m_xMCF;
104 LocaleItem* m_pCurrentLocaleItem;
105 LocaleItem* m_pDefaultLocaleItem;
106 bool m_bDefaultModified;
108 ::cppu::OInterfaceContainerHelper m_aListenerContainer;
110 LocaleItemVector m_aLocaleItemVector;
111 LocaleItemVector m_aDeletedLocaleItemVector;
112 LocaleItemVector m_aChangedDefaultLocaleVector;
114 bool m_bModified;
115 bool m_bReadOnly;
117 sal_Int32 m_nNextUniqueNumericId;
119 // Scans ResourceID to start with number and adapt m_nNextUniqueNumericId
120 void implScanIdForNumber( const OUString& ResourceID );
121 const static sal_Int32 UNIQUE_NUMBER_NEEDS_INITIALISATION = -1;
123 // Checks read only status and throws exception if it's true
124 void implCheckReadOnly( const sal_Char* pExceptionMsg )
125 throw (::com::sun::star::lang::NoSupportException);
127 // Return the context's MultiComponentFactory
128 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory >
129 getMultiComponentFactory();
131 // Returns the LocalItem for a given locale, if it exists, otherwise NULL
132 // This method compares the locales exactly, no closest match search is performed
133 LocaleItem* getItemForLocale( const ::com::sun::star::lang::Locale& locale, bool bException )
134 throw (::com::sun::star::lang::IllegalArgumentException);
136 // Returns the LocalItem for a given locale, if it exists, otherwise NULL
137 // This method performs a closest match search, at least the language must match
138 LocaleItem* getClosestMatchItemForLocale( const ::com::sun::star::lang::Locale& locale );
139 void implSetCurrentLocale( const ::com::sun::star::lang::Locale& locale,
140 bool FindClosestMatch, bool bUseDefaultIfNoMatch )
141 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
143 void implModified();
144 void implNotifyListeners();
146 //=== Impl methods for ...ForLocale methods ===
147 OUString SAL_CALL implResolveString( const OUString& ResourceID, LocaleItem* pLocaleItem )
148 throw (::com::sun::star::resource::MissingResourceException);
149 bool implHasEntryForId( const OUString& ResourceID, LocaleItem* pLocaleItem );
150 ::com::sun::star::uno::Sequence< OUString > implGetResourceIDs( LocaleItem* pLocaleItem );
151 void implSetString( const OUString& ResourceID,
152 const OUString& Str, LocaleItem* pLocaleItem );
153 void implRemoveId( const OUString& ResourceID, LocaleItem* pLocaleItem )
154 throw (::com::sun::star::resource::MissingResourceException);
156 // Method to load a locale if necessary, returns true if loading was
157 // successful. Default implementation in base class just returns true.
158 virtual bool loadLocale( LocaleItem* pLocaleItem );
160 virtual void implLoadAllLocales();
162 public:
163 StringResourceImpl(
164 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
165 virtual ~StringResourceImpl();
167 // XServiceInfo
168 virtual OUString SAL_CALL getImplementationName( )
169 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
170 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
171 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
172 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
173 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
175 // XModifyBroadcaster
176 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
177 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
178 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
179 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
181 // XStringResourceResolver
182 virtual OUString SAL_CALL resolveString( const OUString& ResourceID )
183 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
184 virtual OUString SAL_CALL resolveStringForLocale( const OUString& ResourceID,
185 const ::com::sun::star::lang::Locale& locale )
186 throw ( ::com::sun::star::resource::MissingResourceException,
187 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
188 virtual sal_Bool SAL_CALL hasEntryForId( const OUString& ResourceID )
189 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
190 virtual sal_Bool SAL_CALL hasEntryForIdAndLocale( const OUString& ResourceID,
191 const ::com::sun::star::lang::Locale& locale )
192 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
193 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDs( )
194 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
195 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale
196 ( const ::com::sun::star::lang::Locale& locale )
197 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
198 virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( )
199 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
200 virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( )
201 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
202 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( )
203 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
205 // XStringResourceManager
206 virtual sal_Bool SAL_CALL isReadOnly()
207 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
208 virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, sal_Bool FindClosestMatch )
209 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
210 virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale )
211 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
212 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
213 virtual void SAL_CALL setString( const OUString& ResourceID, const OUString& Str )
214 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
215 virtual void SAL_CALL setStringForLocale( const OUString& ResourceID, const OUString& Str,
216 const ::com::sun::star::lang::Locale& locale )
217 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
218 virtual void SAL_CALL removeId( const OUString& ResourceID )
219 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
220 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
221 virtual void SAL_CALL removeIdForLocale( const OUString& ResourceID,
222 const ::com::sun::star::lang::Locale& locale )
223 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
224 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
225 virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale )
226 throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException,
227 ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
228 virtual void SAL_CALL removeLocale( 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, std::exception) SAL_OVERRIDE;
231 virtual ::sal_Int32 SAL_CALL getUniqueNumericId( )
232 throw (::com::sun::star::lang::NoSupportException,
233 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
236 typedef ::cppu::ImplInheritanceHelper1<
237 StringResourceImpl,
238 ::com::sun::star::resource::XStringResourcePersistence > StringResourcePersistenceImpl_BASE;
240 class BinaryOutput;
242 class StringResourcePersistenceImpl : public StringResourcePersistenceImpl_BASE
244 protected:
245 OUString m_aNameBase;
246 OUString m_aComment;
248 void SAL_CALL implInitializeCommonParameters
249 ( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
250 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
252 // Scan locale properties files
253 virtual void implScanLocales();
255 // Method to load a locale if necessary, returns true if loading was successful
256 virtual bool loadLocale( LocaleItem* pLocaleItem ) SAL_OVERRIDE;
258 // does the actual loading
259 virtual bool implLoadLocale( LocaleItem* pLocaleItem );
261 virtual void implLoadAllLocales() SAL_OVERRIDE;
263 void implScanLocaleNames( const ::com::sun::star::uno::Sequence< OUString >& aContentSeq );
264 static OUString implGetFileNameForLocaleItem( LocaleItem* pLocaleItem, const OUString& aNameBase );
265 static OUString implGetPathForLocaleItem( LocaleItem* pLocaleItem, const OUString& aNameBase,
266 const OUString& aLocation, bool bDefaultFile=false );
268 bool implReadPropertiesFile( LocaleItem* pLocaleItem,
269 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput );
271 bool implWritePropertiesFile( LocaleItem* pLocaleItem, const ::com::sun::star::uno::Reference
272 < ::com::sun::star::io::XOutputStream >& xOutputStream, const OUString& aComment );
274 void implWriteLocaleBinary( LocaleItem* pLocaleItem, BinaryOutput& rOut );
276 void implStoreAtStorage
278 const OUString& aNameBase,
279 const OUString& aComment,
280 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage,
281 bool bUsedForStore,
282 bool bStoreAll
284 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
286 void implKillRemovedLocaleFiles
288 const OUString& Location,
289 const OUString& aNameBase,
290 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess
292 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
294 void implKillChangedDefaultFiles
296 const OUString& Location,
297 const OUString& aNameBase,
298 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess
300 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
302 void implStoreAtLocation
304 const OUString& Location,
305 const OUString& aNameBase,
306 const OUString& aComment,
307 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess,
308 bool bUsedForStore,
309 bool bStoreAll,
310 bool bKillAll = false
312 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
314 public:
315 StringResourcePersistenceImpl(
316 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
317 virtual ~StringResourcePersistenceImpl();
319 // XServiceInfo
320 virtual OUString SAL_CALL getImplementationName( )
321 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
322 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
323 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
324 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
325 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
327 // XModifyBroadcaster
328 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
329 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
330 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
331 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
333 // XStringResourceResolver
334 virtual OUString SAL_CALL resolveString( const OUString& ResourceID )
335 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
336 virtual OUString SAL_CALL resolveStringForLocale( const OUString& ResourceID,
337 const ::com::sun::star::lang::Locale& locale )
338 throw ( ::com::sun::star::resource::MissingResourceException,
339 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
340 virtual sal_Bool SAL_CALL hasEntryForId( const OUString& ResourceID )
341 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
342 virtual sal_Bool SAL_CALL hasEntryForIdAndLocale( const OUString& ResourceID,
343 const ::com::sun::star::lang::Locale& locale )
344 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
345 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDs( )
346 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
347 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale
348 ( const ::com::sun::star::lang::Locale& locale )
349 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
350 virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( )
351 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
352 virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( )
353 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
354 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( )
355 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
357 // XStringResourceManager
358 virtual sal_Bool SAL_CALL isReadOnly()
359 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
360 virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, sal_Bool FindClosestMatch )
361 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
362 virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale )
363 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
364 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
365 virtual void SAL_CALL setString( const OUString& ResourceID, const OUString& Str )
366 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
367 virtual void SAL_CALL setStringForLocale( const OUString& ResourceID, const OUString& Str,
368 const ::com::sun::star::lang::Locale& locale )
369 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
370 virtual void SAL_CALL removeId( const OUString& ResourceID )
371 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
372 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
373 virtual void SAL_CALL removeIdForLocale( const OUString& ResourceID,
374 const ::com::sun::star::lang::Locale& locale )
375 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
376 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
377 virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale )
378 throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException,
379 ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
380 virtual void SAL_CALL removeLocale( 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, std::exception) SAL_OVERRIDE;
383 virtual ::sal_Int32 SAL_CALL getUniqueNumericId( )
384 throw (::com::sun::star::lang::NoSupportException,
385 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
387 // XStringResourcePersistence
388 virtual void SAL_CALL store( )
389 throw (::com::sun::star::lang::NoSupportException,
390 ::com::sun::star::uno::Exception,
391 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
392 virtual sal_Bool SAL_CALL isModified( )
393 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
394 virtual void SAL_CALL setComment( const OUString& Comment )
395 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
396 virtual void SAL_CALL storeToStorage
397 ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage,
398 const OUString& NameBase, const OUString& Comment )
399 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
400 virtual void SAL_CALL storeToURL( const OUString& URL, const OUString& NameBase,
401 const OUString& Comment, const ::com::sun::star::uno::Reference
402 < ::com::sun::star::task::XInteractionHandler >& Handler )
403 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
404 virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL exportBinary( )
405 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
406 virtual void SAL_CALL importBinary( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& Data )
407 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
411 typedef ::cppu::ImplInheritanceHelper2<
412 StringResourcePersistenceImpl,
413 ::com::sun::star::lang::XInitialization,
414 ::com::sun::star::resource::XStringResourceWithStorage > StringResourceWithStorageImpl_BASE;
416 class StringResourceWithStorageImpl : public StringResourceWithStorageImpl_BASE
418 ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xStorage;
419 bool m_bStorageChanged;
421 virtual void implScanLocales() SAL_OVERRIDE;
422 virtual bool implLoadLocale( LocaleItem* pLocaleItem ) SAL_OVERRIDE;
424 public:
425 StringResourceWithStorageImpl(
426 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
427 virtual ~StringResourceWithStorageImpl();
429 // XServiceInfo
430 virtual OUString SAL_CALL getImplementationName( )
431 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
432 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
433 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
434 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
435 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
437 // XInitialization
438 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
439 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
441 // XModifyBroadcaster
442 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
443 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
444 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
445 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
447 // XStringResourceResolver
448 virtual OUString SAL_CALL resolveString( const OUString& ResourceID )
449 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
450 virtual OUString SAL_CALL resolveStringForLocale( const OUString& ResourceID,
451 const ::com::sun::star::lang::Locale& locale )
452 throw ( ::com::sun::star::resource::MissingResourceException,
453 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
454 virtual sal_Bool SAL_CALL hasEntryForId( const OUString& ResourceID )
455 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
456 virtual sal_Bool SAL_CALL hasEntryForIdAndLocale( const OUString& ResourceID,
457 const ::com::sun::star::lang::Locale& locale )
458 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
459 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDs( )
460 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
461 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale
462 ( const ::com::sun::star::lang::Locale& locale )
463 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
464 virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( )
465 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
466 virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( )
467 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
468 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( )
469 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
471 // XStringResourceManager
472 virtual sal_Bool SAL_CALL isReadOnly()
473 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
474 virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, sal_Bool FindClosestMatch )
475 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
476 virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale )
477 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
478 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
479 virtual void SAL_CALL setString( const OUString& ResourceID, const OUString& Str )
480 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
481 virtual void SAL_CALL setStringForLocale( const OUString& ResourceID, const OUString& Str,
482 const ::com::sun::star::lang::Locale& locale )
483 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
484 virtual void SAL_CALL removeId( const OUString& ResourceID )
485 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
486 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
487 virtual void SAL_CALL removeIdForLocale( const OUString& ResourceID,
488 const ::com::sun::star::lang::Locale& locale )
489 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
490 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
491 virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale )
492 throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException,
493 ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
494 virtual void SAL_CALL removeLocale( 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, std::exception) SAL_OVERRIDE;
497 virtual ::sal_Int32 SAL_CALL getUniqueNumericId( )
498 throw (::com::sun::star::lang::NoSupportException,
499 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
501 // XStringResourcePersistence
502 virtual void SAL_CALL store( )
503 throw (::com::sun::star::lang::NoSupportException,
504 ::com::sun::star::uno::Exception,
505 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
506 virtual sal_Bool SAL_CALL isModified( )
507 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
508 virtual void SAL_CALL setComment( const OUString& Comment )
509 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
510 virtual void SAL_CALL storeToStorage
511 ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage,
512 const OUString& NameBase, const OUString& Comment )
513 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
514 virtual void SAL_CALL storeToURL( const OUString& URL, const OUString& NameBase,
515 const OUString& Comment, const ::com::sun::star::uno::Reference
516 < ::com::sun::star::task::XInteractionHandler >& Handler )
517 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
518 virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL exportBinary( )
519 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
520 virtual void SAL_CALL importBinary( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& Data )
521 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
523 // XStringResourceWithStorage
524 virtual void SAL_CALL storeAsStorage
525 ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage )
526 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
527 virtual void SAL_CALL setStorage
528 ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage )
529 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
533 typedef ::cppu::ImplInheritanceHelper2<
534 StringResourcePersistenceImpl,
535 ::com::sun::star::lang::XInitialization,
536 ::com::sun::star::resource::XStringResourceWithLocation > StringResourceWithLocationImpl_BASE;
538 class StringResourceWithLocationImpl : public StringResourceWithLocationImpl_BASE
540 OUString m_aLocation;
541 bool m_bLocationChanged;
542 com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess3 > m_xSFI;
543 com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInteractionHandler;
545 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 > getFileAccess();
547 virtual void implScanLocales() SAL_OVERRIDE;
548 virtual bool implLoadLocale( LocaleItem* pLocaleItem ) SAL_OVERRIDE;
550 public:
551 StringResourceWithLocationImpl(
552 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
553 virtual ~StringResourceWithLocationImpl();
555 // XServiceInfo
556 virtual OUString SAL_CALL getImplementationName( )
557 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
558 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
559 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
560 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
561 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
563 // XInitialization
564 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
565 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
567 // XModifyBroadcaster
568 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
569 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
570 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
571 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
573 // XStringResourceResolver
574 virtual OUString SAL_CALL resolveString( const OUString& ResourceID )
575 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
576 virtual OUString SAL_CALL resolveStringForLocale( const OUString& ResourceID,
577 const ::com::sun::star::lang::Locale& locale )
578 throw ( ::com::sun::star::resource::MissingResourceException,
579 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
580 virtual sal_Bool SAL_CALL hasEntryForId( const OUString& ResourceID )
581 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
582 virtual sal_Bool SAL_CALL hasEntryForIdAndLocale( const OUString& ResourceID,
583 const ::com::sun::star::lang::Locale& locale )
584 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
585 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDs( )
586 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
587 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getResourceIDsForLocale
588 ( const ::com::sun::star::lang::Locale& locale )
589 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
590 virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( )
591 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
592 virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( )
593 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
594 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( )
595 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
597 // XStringResourceManager
598 virtual sal_Bool SAL_CALL isReadOnly()
599 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
600 virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, sal_Bool FindClosestMatch )
601 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
602 virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale )
603 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException,
604 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
605 virtual void SAL_CALL setString( const OUString& ResourceID, const OUString& Str )
606 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
607 virtual void SAL_CALL setStringForLocale( const OUString& ResourceID, const OUString& Str,
608 const ::com::sun::star::lang::Locale& locale )
609 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
610 virtual void SAL_CALL removeId( const OUString& ResourceID )
611 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
612 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
613 virtual void SAL_CALL removeIdForLocale( const OUString& ResourceID,
614 const ::com::sun::star::lang::Locale& locale )
615 throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException,
616 ::com::sun::star::lang::NoSupportException, std::exception) SAL_OVERRIDE;
617 virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale )
618 throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException,
619 ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
620 virtual void SAL_CALL removeLocale( 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, std::exception) SAL_OVERRIDE;
623 virtual ::sal_Int32 SAL_CALL getUniqueNumericId( )
624 throw (::com::sun::star::lang::NoSupportException,
625 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
627 // XStringResourcePersistence
628 virtual void SAL_CALL store( )
629 throw (::com::sun::star::lang::NoSupportException,
630 ::com::sun::star::uno::Exception,
631 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
632 virtual sal_Bool SAL_CALL isModified( )
633 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
634 virtual void SAL_CALL setComment( const OUString& Comment )
635 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
636 virtual void SAL_CALL storeToStorage
637 ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage,
638 const OUString& NameBase, const OUString& Comment )
639 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
640 virtual void SAL_CALL storeToURL( const OUString& URL, const OUString& NameBase,
641 const OUString& Comment, const ::com::sun::star::uno::Reference
642 < ::com::sun::star::task::XInteractionHandler >& Handler )
643 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
644 virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL exportBinary( )
645 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
646 virtual void SAL_CALL importBinary( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& Data )
647 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
649 // XStringResourceWithLocation
650 virtual void SAL_CALL storeAsURL( const OUString& URL )
651 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
652 virtual void SAL_CALL setURL( const OUString& URL )
653 throw (css::lang::IllegalArgumentException, css::lang::NoSupportException,
654 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
658 } // namespace stringtable
661 #endif // INCLUDED_SCRIPTING_SOURCE_STRINGRESOURCE_STRINGRESOURCE_HXX
663 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */