diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-01-02 14:37:14 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-01-02 14:37:14 +0000 |
commit | f181264b5104631c1ed523f0dee769ca98cf7a87 (patch) | |
tree | 72c00b2d12789e53a8385c29d43695f9cdb3c764 /scripting | |
parent | b4f0dc4c8e8c7984c62fee1e7190d22e06aac710 (diff) |
INTEGRATION: CWS ab31 (1.1.2); FILE ADDED
2006/12/14 10:53:09 ab 1.1.2.6: #i71410# Delete files in old folder in setURL()
2006/12/13 10:15:09 ab 1.1.2.5: #i71410# Remove Linux compiler warnings
2006/12/07 09:08:58 ab 1.1.2.4: #i71410# Interface changes and extensions
2006/11/24 07:35:47 ab 1.1.2.3: #i71410# Persistance implementation
2006/11/10 13:41:47 ab 1.1.2.2: #i71410# Fixed some problems
2006/11/10 13:25:44 ab 1.1.2.1: #i71410# String Resource component
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/source/stringresource/stringresource.hxx | 696 |
1 files changed, 696 insertions, 0 deletions
diff --git a/scripting/source/stringresource/stringresource.hxx b/scripting/source/stringresource/stringresource.hxx new file mode 100644 index 000000000000..ddad294505a1 --- /dev/null +++ b/scripting/source/stringresource/stringresource.hxx @@ -0,0 +1,696 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stringresource.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: hr $ $Date: 2007-01-02 15:37:14 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef SCRIPTING_DLGPROV_HXX +#define SCRIPTING_DLGPROV_HXX + +#ifndef _COM_SUN_STAR_AWT_XSTRINGRESOURCEWITHSTORAGE_HPP_ +#include <com/sun/star/resource/XStringResourceWithStorage.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XSTRINGRESOURCEWITHSTORAGE_HPP_ +#include <com/sun/star/resource/XStringResourceWithLocation.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_ +#include <com/sun/star/lang/XInitialization.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_ +#include <com/sun/star/uno/XComponentContext.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XSIMPLEFILEACCESS_HPP_ +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_ +#include <com/sun/star/io/XOutputStream.hpp> +#endif + +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> +#endif +#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_ +#include <cppuhelper/interfacecontainer.hxx> +#endif +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <vector> +#include <hash_map> + +//......................................................................... +namespace stringresource +{ +//......................................................................... + +// ============================================================================= +// mutex +// ============================================================================= + +::osl::Mutex& getMutex(); + + +// ============================================================================= +// class stringresourceImpl +// ============================================================================= + +// Hashtable to map string ids to string +struct hashName_Impl +{ + size_t operator()(const ::rtl::OUString Str) const + { + return (size_t)Str.hashCode(); + } +}; + +struct eqName_Impl +{ + sal_Bool operator()(const ::rtl::OUString Str1, const ::rtl::OUString Str2) const + { + return ( Str1 == Str2 ); + } +}; + +typedef std::hash_map +< + ::rtl::OUString, + ::rtl::OUString, + hashName_Impl, + eqName_Impl +> +IdToStringMap; + +typedef std::hash_map +< + ::rtl::OUString, + sal_Int32, + hashName_Impl, + eqName_Impl +> +IdToIndexMap; + + +struct LocaleItem +{ + ::com::sun::star::lang::Locale m_locale; + IdToStringMap m_aIdToStringMap; + IdToIndexMap m_aIdToIndexMap; + sal_Int32 m_nNextIndex; + bool m_bLoaded; + bool m_bModified; + + LocaleItem( ::com::sun::star::lang::Locale locale, bool bLoaded=true ) + : m_locale( locale ) + , m_nNextIndex( 0 ) + , m_bLoaded( bLoaded ) + , m_bModified( false ) + {} +}; + +typedef std::vector< LocaleItem* > LocaleItemVector; +typedef std::vector< LocaleItem* >::iterator LocaleItemVectorIt; +typedef std::vector< LocaleItem* >::const_iterator LocaleItemVectorConstIt; + +typedef ::cppu::WeakImplHelper2< + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::resource::XStringResourceManager > StringResourceImpl_BASE; + +class StringResourceImpl : public StringResourceImpl_BASE +{ +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > m_xMCF; + + LocaleItem* m_pCurrentLocaleItem; + LocaleItem* m_pDefaultLocaleItem; + bool m_bDefaultModified; + + ::cppu::OInterfaceContainerHelper m_aListenerContainer; + + LocaleItemVector m_aLocaleItemVector; + LocaleItemVector m_aDeletedLocaleItemVector; + LocaleItemVector m_aChangedDefaultLocaleVector; + + bool m_bModified; + bool m_bReadOnly; + + sal_Int32 m_nNextUniqueNumericId; + + // Scans ResourceID to start with number and adapt m_nNextUniqueNumericId + void implScanIdForNumber( const ::rtl::OUString& ResourceID ); + const static sal_Int32 UNIQUE_NUMBER_NEEDS_INITIALISATION = -1; + + // Checks read only status and throws exception if it's true + void implCheckReadOnly( const sal_Char* pExceptionMsg ) + throw (::com::sun::star::lang::NoSupportException); + + // Return the context's MultiComponentFactory + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > + getMultiComponentFactory( void ); + + // Returns the LocalItem for a given locale, if it exists, otherwise NULL + // This method compares the locales exactly, no closest match search is performed + LocaleItem* getItemForLocale( const ::com::sun::star::lang::Locale& locale, sal_Bool bException ) + throw (::com::sun::star::lang::IllegalArgumentException); + + void implModified( void ); + void implNotifyListeners( void ); + + //=== Impl methods for ...ForLocale methods === + ::rtl::OUString SAL_CALL implResolveString( const ::rtl::OUString& ResourceID, LocaleItem* pLocaleItem ) + throw (::com::sun::star::resource::MissingResourceException); + ::sal_Bool implHasEntryForId( const ::rtl::OUString& ResourceID, LocaleItem* pLocaleItem ); + ::com::sun::star::uno::Sequence< ::rtl::OUString > implGetResourceIDs( LocaleItem* pLocaleItem ); + void implSetString( const ::rtl::OUString& ResourceID, + const ::rtl::OUString& Str, LocaleItem* pLocaleItem ); + void implRemoveId( const ::rtl::OUString& ResourceID, LocaleItem* pLocaleItem ) + throw (::com::sun::star::resource::MissingResourceException); + + // Method to load a locale if necessary, returns true if loading was + // successful. Default implementation in base class just returns true. + virtual bool loadLocale( LocaleItem* pLocaleItem ); + + virtual void implLoadAllLocales( void ); + +public: + StringResourceImpl( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + virtual ~StringResourceImpl(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw (::com::sun::star::uno::RuntimeException); + + // XModifyBroadcaster + virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XStringResourceResolver + virtual ::rtl::OUString SAL_CALL resolveString( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL resolveStringForLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw ( ::com::sun::star::resource::MissingResourceException, + ::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasEntryForId( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasEntryForIdAndLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getResourceIDs( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getResourceIDsForLocale + ( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( ) + throw (::com::sun::star::uno::RuntimeException); + + // XStringResourceManager + virtual ::sal_Bool SAL_CALL isReadOnly() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, ::sal_Bool FindClosestMatch ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL setString( const ::rtl::OUString& ResourceID, const ::rtl::OUString& Str ) + throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStringForLocale( const ::rtl::OUString& ResourceID, const ::rtl::OUString& Str, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeId( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL removeIdForLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual ::sal_Int32 SAL_CALL getUniqueNumericId( ) + throw (::com::sun::star::lang::NoSupportException, + ::com::sun::star::uno::RuntimeException); + }; + +typedef ::cppu::ImplInheritanceHelper1< + StringResourceImpl, + ::com::sun::star::resource::XStringResourcePersistance > StringResourcePersistanceImpl_BASE; + +class StringResourcePersistanceImpl : public StringResourcePersistanceImpl_BASE +{ +protected: + ::rtl::OUString m_aNameBase; + ::rtl::OUString m_aComment; + + void SAL_CALL implInitializeCommonParameters + ( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // Scan locale properties files + virtual void implScanLocales( void ) = 0; + + // Method to load a locale if necessary, returns true if loading was successful + virtual bool loadLocale( LocaleItem* pLocaleItem ); + + // does the actual loading + virtual bool implLoadLocale( LocaleItem* pLocaleItem ) = 0; + + virtual void implLoadAllLocales( void ); + + void implScanLocaleNames( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aContentSeq ); + ::rtl::OUString implGetFileNameForLocaleItem( LocaleItem* pLocaleItem, const ::rtl::OUString& aNameBase ); + ::rtl::OUString implGetPathForLocaleItem( LocaleItem* pLocaleItem, const ::rtl::OUString& aNameBase, + const ::rtl::OUString& aLocation, bool bDefaultFile=false ); + + bool implReadPropertiesFile( LocaleItem* pLocaleItem, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput ); + + bool implWritePropertiesFile( LocaleItem* pLocaleItem, const ::com::sun::star::uno::Reference + < ::com::sun::star::io::XOutputStream >& xOutputStream, const ::rtl::OUString& aComment ); + + void implStoreAtStorage + ( + const ::rtl::OUString& aNameBase, + const ::rtl::OUString& aComment, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage, + bool bUsedForStore, + bool bStoreAll + ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + void implKillRemovedLocaleFiles + ( + const ::rtl::OUString& Location, + const ::rtl::OUString& aNameBase, + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess + ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + void implKillChangedDefaultFiles + ( + const ::rtl::OUString& Location, + const ::rtl::OUString& aNameBase, + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess + ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + void implStoreAtLocation + ( + const ::rtl::OUString& Location, + const ::rtl::OUString& aNameBase, + const ::rtl::OUString& aComment, + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess, + bool bUsedForStore, + bool bStoreAll, + bool bKillAll = false + ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + +public: + StringResourcePersistanceImpl( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + virtual ~StringResourcePersistanceImpl(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw (::com::sun::star::uno::RuntimeException); + + // XModifyBroadcaster + virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XStringResourceResolver + virtual ::rtl::OUString SAL_CALL resolveString( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL resolveStringForLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw ( ::com::sun::star::resource::MissingResourceException, + ::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasEntryForId( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasEntryForIdAndLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getResourceIDs( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getResourceIDsForLocale + ( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( ) + throw (::com::sun::star::uno::RuntimeException); + + // XStringResourceManager + virtual ::sal_Bool SAL_CALL isReadOnly() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, ::sal_Bool FindClosestMatch ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL setString( const ::rtl::OUString& ResourceID, const ::rtl::OUString& Str ) + throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStringForLocale( const ::rtl::OUString& ResourceID, const ::rtl::OUString& Str, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeId( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL removeIdForLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual ::sal_Int32 SAL_CALL getUniqueNumericId( ) + throw (::com::sun::star::lang::NoSupportException, + ::com::sun::star::uno::RuntimeException); + + // XStringResourcePersistance + virtual void SAL_CALL store( ) + throw (::com::sun::star::lang::NoSupportException, + ::com::sun::star::uno::Exception, + ::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isModified( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setComment( const ::rtl::OUString& Comment ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL storeToStorage + ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage, + const ::rtl::OUString& NameBase, const ::rtl::OUString& Comment ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL storeToURL( const ::rtl::OUString& URL, const ::rtl::OUString& NameBase, + const ::rtl::OUString& Comment, const ::com::sun::star::uno::Reference + < ::com::sun::star::task::XInteractionHandler >& Handler ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); +}; + + +typedef ::cppu::ImplInheritanceHelper2< + StringResourcePersistanceImpl, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::resource::XStringResourceWithStorage > StringResourceWithStorageImpl_BASE; + +class StringResourceWithStorageImpl : public StringResourceWithStorageImpl_BASE +{ + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xStorage; + bool m_bStorageChanged; + + virtual void implScanLocales( void ); + virtual bool implLoadLocale( LocaleItem* pLocaleItem ); + +public: + StringResourceWithStorageImpl( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + virtual ~StringResourceWithStorageImpl(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XModifyBroadcaster + virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XStringResourceResolver + virtual ::rtl::OUString SAL_CALL resolveString( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL resolveStringForLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw ( ::com::sun::star::resource::MissingResourceException, + ::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasEntryForId( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasEntryForIdAndLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getResourceIDs( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getResourceIDsForLocale + ( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( ) + throw (::com::sun::star::uno::RuntimeException); + + // XStringResourceManager + virtual ::sal_Bool SAL_CALL isReadOnly() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, ::sal_Bool FindClosestMatch ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL setString( const ::rtl::OUString& ResourceID, const ::rtl::OUString& Str ) + throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStringForLocale( const ::rtl::OUString& ResourceID, const ::rtl::OUString& Str, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeId( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL removeIdForLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual ::sal_Int32 SAL_CALL getUniqueNumericId( ) + throw (::com::sun::star::lang::NoSupportException, + ::com::sun::star::uno::RuntimeException); + + // XStringResourcePersistance + virtual void SAL_CALL store( ) + throw (::com::sun::star::lang::NoSupportException, + ::com::sun::star::uno::Exception, + ::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isModified( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setComment( const ::rtl::OUString& Comment ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL storeToStorage + ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage, + const ::rtl::OUString& NameBase, const ::rtl::OUString& Comment ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL storeToURL( const ::rtl::OUString& URL, const ::rtl::OUString& NameBase, + const ::rtl::OUString& Comment, const ::com::sun::star::uno::Reference + < ::com::sun::star::task::XInteractionHandler >& Handler ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStringResourceWithStorage + virtual void SAL_CALL storeAsStorage + ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStorage + ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); +}; + + +typedef ::cppu::ImplInheritanceHelper2< + StringResourcePersistanceImpl, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::resource::XStringResourceWithLocation > StringResourceWithLocationImpl_BASE; + +class StringResourceWithLocationImpl : public StringResourceWithLocationImpl_BASE +{ + ::rtl::OUString m_aLocation; + bool m_bLocationChanged; + com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess > m_xSFI; + com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInteractionHandler; + + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > getFileAccess( void ); + + virtual void implScanLocales( void ); + virtual bool implLoadLocale( LocaleItem* pLocaleItem ); + +public: + StringResourceWithLocationImpl( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + virtual ~StringResourceWithLocationImpl(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XModifyBroadcaster + virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XStringResourceResolver + virtual ::rtl::OUString SAL_CALL resolveString( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL resolveStringForLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw ( ::com::sun::star::resource::MissingResourceException, + ::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasEntryForId( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasEntryForIdAndLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getResourceIDs( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getResourceIDsForLocale + ( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getCurrentLocale( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getDefaultLocale( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( ) + throw (::com::sun::star::uno::RuntimeException); + + // XStringResourceManager + virtual ::sal_Bool SAL_CALL isReadOnly() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCurrentLocale( const ::com::sun::star::lang::Locale& locale, ::sal_Bool FindClosestMatch ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDefaultLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL setString( const ::rtl::OUString& ResourceID, const ::rtl::OUString& Str ) + throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStringForLocale( const ::rtl::OUString& ResourceID, const ::rtl::OUString& Str, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeId( const ::rtl::OUString& ResourceID ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL removeIdForLocale( const ::rtl::OUString& ResourceID, + const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual void SAL_CALL newLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeLocale( const ::com::sun::star::lang::Locale& locale ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + virtual ::sal_Int32 SAL_CALL getUniqueNumericId( ) + throw (::com::sun::star::lang::NoSupportException, + ::com::sun::star::uno::RuntimeException); + + // XStringResourcePersistance + virtual void SAL_CALL store( ) + throw (::com::sun::star::lang::NoSupportException, + ::com::sun::star::uno::Exception, + ::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isModified( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setComment( const ::rtl::OUString& Comment ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL storeToStorage + ( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage, + const ::rtl::OUString& NameBase, const ::rtl::OUString& Comment ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL storeToURL( const ::rtl::OUString& URL, const ::rtl::OUString& NameBase, + const ::rtl::OUString& Comment, const ::com::sun::star::uno::Reference + < ::com::sun::star::task::XInteractionHandler >& Handler ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStringResourceWithLocation + virtual void SAL_CALL storeAsURL( const ::rtl::OUString& URL ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setURL( const ::rtl::OUString& URL ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); +}; + +//......................................................................... +} // namespace stringtable +//......................................................................... + +#endif // SCRIPTING_DLGPROV_HXX |