From 21cdeb7b93bfbf8093f6d67aface05ca38a9ab11 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Thu, 26 May 2011 11:04:53 +0200 Subject: remove broken VclStringResourceLoader, add ResourceStringIndexAccess * remove com.sun.star.resource.VclStringResourceLoader, it is broken beyond repair * implement org.libreoffice.resource.ResourceStringIndexAccess * same functionality, better interface * migrate libresXXXX to comphelper/servicedecl.hxx component registration --- .../source/resource/ResourceStringIndexAccess.cxx | 94 ++++ .../source/resource/ResourceStringIndexAccess.hxx | 71 +++ extensions/source/resource/makefile.mk | 8 +- extensions/source/resource/oooresourceloader.cxx | 169 +------- extensions/source/resource/oooresourceloader.hxx | 87 ++++ extensions/source/resource/res.component | 6 +- extensions/source/resource/res_services.cxx | 89 ---- extensions/source/resource/res_services.hxx | 67 --- extensions/source/resource/resource.cxx | 476 --------------------- extensions/source/resource/resourceservices.cxx | 58 +++ 10 files changed, 327 insertions(+), 798 deletions(-) create mode 100644 extensions/source/resource/ResourceStringIndexAccess.cxx create mode 100644 extensions/source/resource/ResourceStringIndexAccess.hxx create mode 100644 extensions/source/resource/oooresourceloader.hxx delete mode 100644 extensions/source/resource/res_services.cxx delete mode 100644 extensions/source/resource/res_services.hxx delete mode 100644 extensions/source/resource/resource.cxx create mode 100644 extensions/source/resource/resourceservices.cxx (limited to 'extensions') diff --git a/extensions/source/resource/ResourceStringIndexAccess.cxx b/extensions/source/resource/ResourceStringIndexAccess.cxx new file mode 100644 index 000000000000..d48d636bfa11 --- /dev/null +++ b/extensions/source/resource/ResourceStringIndexAccess.cxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Bjoern Michaelsen + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Major Contributor(s): + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include + +#include +#include +#include +#include +#include + +using namespace ::extensions::resource; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; + +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OUStringToOString; + +namespace +{ + static ::std::auto_ptr GetResMgr(Sequence const& rArgs) + { + if(rArgs.getLength()!=1) + return ::std::auto_ptr(); + OUString sFilename; + rArgs[0] >>= sFilename; + SolarMutexGuard aGuard; + const OString sEncName(OUStringToOString(sFilename, osl_getThreadTextEncoding())); + return ::std::auto_ptr(ResMgr::CreateResMgr(sEncName)); + } +} + + +ResourceStringIndexAccess::ResourceStringIndexAccess(Sequence const& rArgs, Reference const&) + : m_pResMgr(GetResMgr(rArgs)) +{}; + +Reference initResourceStringIndexAccess(ResourceStringIndexAccess* pResourceStringIndexAccess) +{ + Reference xResult(static_cast(pResourceStringIndexAccess)); + if(!pResourceStringIndexAccess->hasElements()) + // xResult does not help the client to analyse the problem + // and will crash on getByIndex calls, better just give back an empty Reference + // so that such ResourceStringIndexAccess instances are never release into the wild + throw RuntimeException( + OUString(RTL_CONSTASCII_USTRINGPARAM("ressource manager could not get initialized")), + /* xResult */ Reference()); + return xResult; +} + +Any SAL_CALL ResourceStringIndexAccess::getByIndex(sal_Int32 nIdx) + throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException) +{ + if(nIdx > SAL_MAX_UINT16 || nIdx < 0) + throw IndexOutOfBoundsException(); + SolarMutexGuard aGuard; + const ResId aId(static_cast(nIdx), *m_pResMgr); + aId.SetRT(RSC_STRING); + if(!m_pResMgr->IsAvailable(aId)) + throw RuntimeException( + OUString(RTL_CONSTASCII_USTRINGPARAM("string ressource for id not available")), + Reference()); + return makeAny(OUString(String(aId))); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/ResourceStringIndexAccess.hxx b/extensions/source/resource/ResourceStringIndexAccess.hxx new file mode 100644 index 000000000000..e1a01e3a5de0 --- /dev/null +++ b/extensions/source/resource/ResourceStringIndexAccess.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Bjoern Michaelsen + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Major Contributor(s): + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_HXX +#define EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_HXX + +#include "precompiled_extensions.hxx" + +#include +#include +#include +#include +#include +#include + +class ResMgr; + +namespace extensions { namespace resource +{ + class ResourceStringIndexAccess : public cppu::WeakImplHelper1< ::com::sun::star::container::XIndexAccess> + { + public: + ResourceStringIndexAccess(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> const& rArgs, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&); + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException) + { return m_pResMgr.get() ? SAL_MAX_UINT16 : 0; }; + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException) + { return ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)); }; + virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException) + { return static_cast(m_pResMgr.get()); }; + + private: + // m_pResMgr should never be NULL, see initResourceStringIndexAccess + const ::std::auto_ptr m_pResMgr; + }; + +}} + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> initResourceStringIndexAccess(::extensions::resource::ResourceStringIndexAccess*); + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/makefile.mk b/extensions/source/resource/makefile.mk index adeec5fd09dc..d9143d2d37be 100644 --- a/extensions/source/resource/makefile.mk +++ b/extensions/source/resource/makefile.mk @@ -39,9 +39,10 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- -SLOFILES= $(SLO)$/resource.obj \ - $(SLO)$/oooresourceloader.obj \ - $(SLO)$/res_services.obj +SLOFILES= \ + $(SLO)$/ResourceStringIndexAccess.obj \ + $(SLO)$/oooresourceloader.obj \ + $(SLO)$/resourceservices.obj LIB1TARGET= $(SLB)$/$(TARGET).lib LIB1OBJFILES= $(SLOFILES) @@ -49,6 +50,7 @@ LIB1OBJFILES= $(SLOFILES) SHL1TARGET= $(TARGET)$(DLLPOSTFIX) SHL1STDLIBS= \ + $(COMPHELPERLIB) \ $(CPPULIB) \ $(CPPUHELPERLIB) \ $(SALLIB) \ diff --git a/extensions/source/resource/oooresourceloader.cxx b/extensions/source/resource/oooresourceloader.cxx index ee5cc2a0ea3f..6e89ff24168b 100644 --- a/extensions/source/resource/oooresourceloader.cxx +++ b/extensions/source/resource/oooresourceloader.cxx @@ -29,15 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_extensions.hxx" -#ifndef EXTENSIONS_SOURCE_RESOURCE_OOORESOURCELOADER_CXX -#define EXTENSIONS_SOURCE_RESOURCE_OOORESOURCELOADER_CXX -#include "res_services.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ +#include #include #include #include @@ -47,87 +39,14 @@ #include #include -//........................................................................ -namespace res -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::resource::XResourceBundleLoader; - using ::com::sun::star::resource::XResourceBundle; - using ::com::sun::star::resource::MissingResourceException; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::lang::Locale; - using ::com::sun::star::uno::Any; - using ::com::sun::star::container::NoSuchElementException; - using ::com::sun::star::lang::WrappedTargetException; - using ::com::sun::star::uno::Type; - using ::com::sun::star::uno::WeakReference; - /** === end UNO using === **/ - - //==================================================================== - //= helper - //==================================================================== - typedef ::std::pair< ::rtl::OUString, Locale > ResourceBundleDescriptor; - - struct ResourceBundleDescriptorLess : public ::std::binary_function< ResourceBundleDescriptor, ResourceBundleDescriptor, bool > - { - bool operator()( const ResourceBundleDescriptor& _lhs, const ResourceBundleDescriptor& _rhs ) const - { - if ( _lhs.first < _rhs.first ) - return true; - if ( _lhs.second.Language < _rhs.second.Language ) - return true; - if ( _lhs.second.Country < _rhs.second.Country ) - return true; - if ( _lhs.second.Variant < _rhs.second.Variant ) - return true; - return false; - } - }; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::resource; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; - //==================================================================== - //= OpenOfficeResourceLoader - //==================================================================== - typedef ::cppu::WeakImplHelper1 < XResourceBundleLoader - > OpenOfficeResourceLoader_Base; - class OpenOfficeResourceLoader : public OpenOfficeResourceLoader_Base - { - private: - typedef ::std::map< ResourceBundleDescriptor, WeakReference< XResourceBundle >, ResourceBundleDescriptorLess > - ResourceBundleCache; - - private: - Reference< XComponentContext > m_xContext; - ::osl::Mutex m_aMutex; - ResourceBundleCache m_aBundleCache; - - protected: - OpenOfficeResourceLoader( const Reference< XComponentContext >& _rxContext ); - - public: - static Sequence< ::rtl::OUString > getSupportedServiceNames_static(); - static ::rtl::OUString getImplementationName_static(); - static ::rtl::OUString getSingletonName_static(); - static Reference< XInterface > Create( const Reference< XComponentContext >& _rxContext ); - // XResourceBundleLoader - virtual Reference< XResourceBundle > SAL_CALL loadBundle_Default( const ::rtl::OUString& aBaseName ) throw (MissingResourceException, RuntimeException); - virtual Reference< XResourceBundle > SAL_CALL loadBundle( const ::rtl::OUString& abaseName, const Locale& aLocale ) throw (MissingResourceException, RuntimeException); - - private: - OpenOfficeResourceLoader(); // never implemented - OpenOfficeResourceLoader( const OpenOfficeResourceLoader& ); // never implemented - OpenOfficeResourceLoader& operator=( const OpenOfficeResourceLoader& ); // never implemented - }; - - //==================================================================== - //= IResourceType - //==================================================================== +namespace extensions { namespace resource +{ /** encapsulates access to a fixed resource type */ class IResourceType @@ -153,9 +72,6 @@ namespace res virtual ~IResourceType() { }; }; - //==================================================================== - //= StringResourceAccess - //==================================================================== class StringResourceAccess : public IResourceType { public: @@ -166,18 +82,15 @@ namespace res virtual Any getResource( SimpleResMgr& _resourceManager, sal_Int32 _resourceId ) const; }; - //-------------------------------------------------------------------- StringResourceAccess::StringResourceAccess() { } - //-------------------------------------------------------------------- RESOURCE_TYPE StringResourceAccess::getResourceType() const { return RSC_STRING; } - //-------------------------------------------------------------------- Any StringResourceAccess::getResource( SimpleResMgr& _resourceManager, sal_Int32 _resourceId ) const { OSL_PRECOND( _resourceManager.IsAvailable( getResourceType(), _resourceId ), "StringResourceAccess::getResource: precondition not met!" ); @@ -186,9 +99,6 @@ namespace res return aResource; } - //==================================================================== - //= OpenOfficeResourceBundle - //==================================================================== typedef ::cppu::WeakImplHelper1 < XResourceBundle > OpenOfficeResourceBundle_Base; class OpenOfficeResourceBundle : public OpenOfficeResourceBundle_Base @@ -257,41 +167,11 @@ namespace res bool impl_getResourceTypeAndId_nothrow( const ::rtl::OUString& _key, ResourceTypePtr& _out_resourceType, sal_Int32& _out_resourceId ) const; }; - //==================================================================== - //= OpenOfficeResourceLoader - //==================================================================== - //-------------------------------------------------------------------- - OpenOfficeResourceLoader::OpenOfficeResourceLoader( const Reference< XComponentContext >& _rxContext ) + OpenOfficeResourceLoader::OpenOfficeResourceLoader( Reference< XComponentContext > const& _rxContext ) :m_xContext( _rxContext ) { } - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > OpenOfficeResourceLoader::getSupportedServiceNames_static() - { - Sequence< ::rtl::OUString > aServices( 1 ); - aServices[ 0 ] = getSingletonName_static(); - return aServices; - } - - //-------------------------------------------------------------------- - ::rtl::OUString OpenOfficeResourceLoader::getImplementationName_static() - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.resource.OpenOfficeResourceLoader" ) ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString OpenOfficeResourceLoader::getSingletonName_static() - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.resource.OfficeResourceLoader" ) ); - } - - //-------------------------------------------------------------------- - Reference< XInterface > OpenOfficeResourceLoader::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new OpenOfficeResourceLoader( _rxContext ) ); - } - //-------------------------------------------------------------------- Reference< XResourceBundle > SAL_CALL OpenOfficeResourceLoader::loadBundle_Default( const ::rtl::OUString& _baseName ) throw (MissingResourceException, RuntimeException) { @@ -319,21 +199,6 @@ namespace res return xBundle; } - //-------------------------------------------------------------------- - ComponentInfo getComponentInfo_OpenOfficeResourceLoader() - { - ComponentInfo aInfo; - aInfo.aSupportedServices = OpenOfficeResourceLoader::getSupportedServiceNames_static(); - aInfo.sImplementationName = OpenOfficeResourceLoader::getImplementationName_static(); - aInfo.sSingletonName = OpenOfficeResourceLoader::getSingletonName_static(); - aInfo.pFactory = &OpenOfficeResourceLoader::Create; - return aInfo; - } - - //==================================================================== - //= OpenOfficeResourceBundle - //==================================================================== - //-------------------------------------------------------------------- OpenOfficeResourceBundle::OpenOfficeResourceBundle( const Reference< XComponentContext >& /*_rxContext*/, const ::rtl::OUString& _rBaseName, const Locale& _rLocale ) :m_aLocale( _rLocale ) ,m_pResourceManager( NULL ) @@ -352,34 +217,29 @@ namespace res ResourceTypePtr( new StringResourceAccess ); } - //-------------------------------------------------------------------- OpenOfficeResourceBundle::~OpenOfficeResourceBundle() { delete m_pResourceManager; } - //-------------------------------------------------------------------- Reference< XResourceBundle > SAL_CALL OpenOfficeResourceBundle::getParent() throw (RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); return m_xParent; } - //-------------------------------------------------------------------- void SAL_CALL OpenOfficeResourceBundle::setParent( const Reference< XResourceBundle >& _parent ) throw (RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); m_xParent = _parent; } - //-------------------------------------------------------------------- Locale SAL_CALL OpenOfficeResourceBundle::getLocale( ) throw (RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); return m_aLocale; } - //-------------------------------------------------------------------- bool OpenOfficeResourceBundle::impl_getResourceTypeAndId_nothrow( const ::rtl::OUString& _key, ResourceTypePtr& _out_resourceType, sal_Int32& _out_resourceId ) const { sal_Int32 typeSeparatorPos = _key.indexOf( ':' ); @@ -399,7 +259,6 @@ namespace res return true; } - //-------------------------------------------------------------------- bool OpenOfficeResourceBundle::impl_getDirectElement_nothrow( const ::rtl::OUString& _key, Any& _out_Element ) const { ResourceTypePtr resourceType; @@ -415,7 +274,6 @@ namespace res return _out_Element.hasValue(); } - //-------------------------------------------------------------------- Any SAL_CALL OpenOfficeResourceBundle::getDirectElement( const ::rtl::OUString& _key ) throw (RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -425,7 +283,6 @@ namespace res return aElement; } - //-------------------------------------------------------------------- Any SAL_CALL OpenOfficeResourceBundle::getByName( const ::rtl::OUString& _key ) throw (NoSuchElementException, WrappedTargetException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -443,7 +300,6 @@ namespace res return aElement; } - //-------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL OpenOfficeResourceBundle::getElementNames( ) throw (RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -452,7 +308,6 @@ namespace res return Sequence< ::rtl::OUString >( ); } - //-------------------------------------------------------------------- ::sal_Bool SAL_CALL OpenOfficeResourceBundle::hasByName( const ::rtl::OUString& _key ) throw (RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -468,13 +323,11 @@ namespace res return sal_True; } - //-------------------------------------------------------------------- Type SAL_CALL OpenOfficeResourceBundle::getElementType( ) throw (RuntimeException) { return ::cppu::UnoType< Any >::get(); } - //-------------------------------------------------------------------- ::sal_Bool SAL_CALL OpenOfficeResourceBundle::hasElements( ) throw (RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -483,10 +336,6 @@ namespace res return ::sal_Bool( ); } -//........................................................................ -} // namespace res -//........................................................................ - -#endif // EXTENSIONS_SOURCE_RESOURCE_OOORESOURCELOADER_CXX +}} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/oooresourceloader.hxx b/extensions/source/resource/oooresourceloader.hxx new file mode 100644 index 000000000000..fd7f526ce30b --- /dev/null +++ b/extensions/source/resource/oooresourceloader.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX +#define EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX + +#include +#include +#include +#include + +#include +#include +#include + +namespace extensions { namespace resource +{ + typedef ::std::pair< ::rtl::OUString, ::com::sun::star::lang::Locale> ResourceBundleDescriptor; + + struct ResourceBundleDescriptorLess : public ::std::binary_function + { + bool operator()( const ResourceBundleDescriptor& _lhs, const ResourceBundleDescriptor& _rhs ) const + { + if ( _lhs.first < _rhs.first ) + return true; + if ( _lhs.second.Language < _rhs.second.Language ) + return true; + if ( _lhs.second.Country < _rhs.second.Country ) + return true; + if ( _lhs.second.Variant < _rhs.second.Variant ) + return true; + return false; + } + }; + + class OpenOfficeResourceLoader : public ::cppu::WeakImplHelper1< ::com::sun::star::resource::XResourceBundleLoader> + { + public: + typedef ::std::map< + ResourceBundleDescriptor, + ::com::sun::star::uno::WeakReference< ::com::sun::star::resource::XResourceBundle>, + ResourceBundleDescriptorLess> ResourceBundleCache; + + OpenOfficeResourceLoader(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&); + // XResourceBundleLoader + virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XResourceBundle> SAL_CALL loadBundle_Default( const ::rtl::OUString& aBaseName ) throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XResourceBundle> SAL_CALL loadBundle( const ::rtl::OUString& abaseName, const ::com::sun::star::lang::Locale& aLocale ) throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException); + + private: + OpenOfficeResourceLoader(); // never implemented + OpenOfficeResourceLoader( const OpenOfficeResourceLoader& ); // never implemented + OpenOfficeResourceLoader& operator=( const OpenOfficeResourceLoader& ); // never implemented + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext; + ::osl::Mutex m_aMutex; + ResourceBundleCache m_aBundleCache; + }; +}} + +#endif // EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/res.component b/extensions/source/resource/res.component index 57f96609d5df..36227874216d 100644 --- a/extensions/source/resource/res.component +++ b/extensions/source/resource/res.component @@ -28,11 +28,11 @@ - - - + + + diff --git a/extensions/source/resource/res_services.cxx b/extensions/source/resource/res_services.cxx deleted file mode 100644 index 91315d0162f0..000000000000 --- a/extensions/source/resource/res_services.cxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "res_services.hxx" - -/** === begin UNO using === **/ -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Exception; -using ::com::sun::star::lang::XMultiServiceFactory; -using ::com::sun::star::lang::XSingleServiceFactory; -using ::com::sun::star::uno::UNO_QUERY; -/** === end UNO using === **/ - -#include - -namespace res -{ - ::std::vector< ComponentInfo > getComponentInfos() - { - ::std::vector< ::res::ComponentInfo > aComponentInfos; - aComponentInfos.push_back( getComponentInfo_VclStringResourceLoader() ); - aComponentInfos.push_back( getComponentInfo_OpenOfficeResourceLoader() ); - return aComponentInfos; - } -} - -extern "C" { - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, XMultiServiceFactory * /*pServiceManager*/, void * /*pRegistryKey*/ ) -{ - void * pRet = 0; - ::std::vector< ::res::ComponentInfo > aComponentInfos( ::res::getComponentInfos() ); - for ( ::std::vector< ::res::ComponentInfo >::const_iterator loop = aComponentInfos.begin(); - loop != aComponentInfos.end(); - ++loop - ) - { - if ( 0 == loop->sImplementationName.compareToAscii( pImplName ) ) - { - // create the factory - Reference< XSingleServiceFactory > xFactory( ::cppu::createSingleComponentFactory( - loop->pFactory, loop->sImplementationName, loop->aSupportedServices ), - UNO_QUERY ); - // acquire, because we return an interface pointer instead of a reference - xFactory->acquire(); - pRet = xFactory.get(); - } - } - return pRet; -} - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/res_services.hxx b/extensions/source/resource/res_services.hxx deleted file mode 100644 index ac61f0e423ac..000000000000 --- a/extensions/source/resource/res_services.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_RESOURCE_SERVICES_HXX -#define EXTENSIONS_RESOURCE_SERVICES_HXX - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ -#include - -//........................................................................ -namespace res -{ -//........................................................................ - - struct ComponentInfo - { - /// services supported by the component - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupportedServices; - /// implementation name of the component - ::rtl::OUString sImplementationName; - /** name of the singleton instance of the component, if it is a singleton, empty otherwise - If the component is a singleton, aSupportedServices must contain exactly one element. - */ - ::rtl::OUString sSingletonName; - /// factory for creating the component - ::cppu::ComponentFactoryFunc pFactory; - }; - - ComponentInfo getComponentInfo_VclStringResourceLoader(); - ComponentInfo getComponentInfo_OpenOfficeResourceLoader(); - -//........................................................................ -} // namespace res -//........................................................................ - -#endif // EXTENSIONS_RESOURCE_SERVICES_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/resource.cxx b/extensions/source/resource/resource.cxx deleted file mode 100644 index 01943a68fceb..000000000000 --- a/extensions/source/resource/resource.cxx +++ /dev/null @@ -1,476 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "res_services.hxx" - -#include -#include // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type -#include // helper for factories -#include // helper for implementations - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::registry; -using namespace com::sun::star::script; -using namespace com::sun::star::beans; -using namespace com::sun::star::reflection; - -using ::rtl::OUString; -using ::rtl::OStringBuffer; -using ::rtl::OUStringToOString; -using ::rtl::OStringToOUString; - -//------------------------------------------------------------------------ -//------------------------------------------------------------------------ -//------------------------------------------------------------------------ -class ResourceService : public cppu::WeakImplHelper3< XInvocation, XExactName, XServiceInfo > -{ -public: - ResourceService( const Reference< XMultiServiceFactory > & ); - ~ResourceService(); - - // XServiceInfo - OUString SAL_CALL getImplementationName() throw(); - sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(); - Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw(); - - static Sequence< OUString > getSupportedServiceNames_Static(void) throw(); - static OUString getImplementationName_Static() throw() - { - return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.extensions.ResourceService")); - } - static Reference< XInterface > Create( const Reference< XComponentContext >& _rxContext ); - - // XExactName - OUString SAL_CALL getExactName( const OUString & ApproximateName ) throw(RuntimeException); - - // XInvokation - Reference< XIntrospectionAccess > SAL_CALL getIntrospection(void) throw(RuntimeException); - Any SAL_CALL invoke(const OUString& FunctionName, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam) throw(IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException); - void SAL_CALL setValue(const OUString& PropertyName, const Any& Value) throw(UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException); - Any SAL_CALL getValue(const OUString& PropertyName) throw(UnknownPropertyException, RuntimeException); - sal_Bool SAL_CALL hasMethod(const OUString& Name) throw(RuntimeException); - sal_Bool SAL_CALL hasProperty(const OUString& Name) throw(RuntimeException); -private: - Reference< XTypeConverter > getTypeConverter() const; - Reference< XInvocation > getDefaultInvocation() const; - - Reference< XMultiServiceFactory > xSMgr; - Reference< XInvocation > xDefaultInvocation; - Reference< XTypeConverter > xTypeConverter; - OUString aFileName; - ResMgr * pResMgr; -}; - - -//----------------------------------------------------------------------------- -ResourceService::ResourceService( const Reference< XMultiServiceFactory > & rSMgr ) - : xSMgr( rSMgr ) - , pResMgr( NULL ) -{ -} - -//----------------------------------------------------------------------------- -Reference< XInterface > ResourceService::Create( const Reference< XComponentContext >& _rxContext ) -{ - Reference< XMultiServiceFactory > xFactory( _rxContext->getServiceManager(), UNO_QUERY_THROW ); - return *( new ResourceService( xFactory ) ); -} - -//----------------------------------------------------------------------------- -ResourceService::~ResourceService() -{ - delete pResMgr; -} - -// XServiceInfo -OUString ResourceService::getImplementationName() throw() -{ - return getImplementationName_Static(); -} - -// XServiceInfo -sal_Bool SAL_CALL ResourceService::supportsService(const OUString& ServiceName) throw() -{ - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; -} - -// XServiceInfo -Sequence< OUString > SAL_CALL ResourceService::getSupportedServiceNames(void) throw() -{ - return getSupportedServiceNames_Static(); -} - -// ResourceService -Sequence< OUString > ResourceService::getSupportedServiceNames_Static(void) throw() -{ - Sequence< OUString > aSNS( 1 ); - aSNS.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.resource.VclStringResourceLoader")); - return aSNS; -} - -// ResourceService -Reference< XTypeConverter > ResourceService::getTypeConverter() const -{ - SolarMutexGuard aGuard; - if( xSMgr.is() ) - { - Reference< XTypeConverter > xConv( xSMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter" ))), UNO_QUERY ); - ((ResourceService*)this)->xTypeConverter = xConv; - } - return xTypeConverter; -} - -// ResourceService -Reference< XInvocation > ResourceService::getDefaultInvocation() const -{ - SolarMutexGuard aGuard; - /* f�hrt zur Zeit noch zu einer rekursion - if( xSMgr.is() ) - { - Reference< XSingleServiceFactory > xFact( xSMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Invocation")) ), UNO_QUERY ); - if( xFact.is() ) - { - Sequence< Any > aArgs( 1 ); - Reference< XInterface > xThis( *this ); - aArgs.getArray()[0].set( &xThis, XInterface_Reference< get >lection() ); - Reference< XInvokation > xI( xFact->createInstanceWithArguments( aArgs ), UNO_QUERY ); - ((ResourceService*)this)->xDefaultInvocation = xI; - } - } - */ - return xDefaultInvocation; -} - -// XExactName -OUString SAL_CALL ResourceService::getExactName( const OUString & ApproximateName ) throw(RuntimeException) -{ - OUString aName( ApproximateName ); - aName = aName.toAsciiLowerCase(); - if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("filename")) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("FileName")); - else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("getstring" ) )) - return OUString(RTL_CONSTASCII_USTRINGPARAM("getString")); - else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("getstrings" ) )) - return OUString(RTL_CONSTASCII_USTRINGPARAM("getStrings")); - else if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("hasstring")) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("hasString")); - else if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("hasstrings")) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("hasStrings")); - else if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getstringlist")) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("getStringList")); - else if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("hasStringList")) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("hasStringList")); - Reference< XExactName > xEN( getDefaultInvocation(), UNO_QUERY ); - if( xEN.is() ) - return xEN->getExactName( ApproximateName ); - return OUString(); -} - -// XInvokation -Reference< XIntrospectionAccess > SAL_CALL ResourceService::getIntrospection(void) - throw(RuntimeException) -{ - Reference< XInvocation > xI = getDefaultInvocation(); - if( xI.is() ) - return xI->getIntrospection(); - return Reference< XIntrospectionAccess >(); -} - -// XInvokation -Any SAL_CALL ResourceService::invoke -( - const OUString& FunctionName, - const Sequence< Any >& Params, - Sequence< sal_Int16 >& OutParamIndex, - Sequence< Any >& OutParam -) - throw(IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException) -{ - Any aRet; - if( FunctionName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getString")) - || FunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("getStrings" ) ) - || FunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("hasString" ) ) - || FunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("hasStrings" ) ) - ) - { - sal_Int32 nElements = Params.getLength(); - if( nElements < 1 ) - throw IllegalArgumentException(); - if( nElements > 1 && (FunctionName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getString")) || FunctionName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("hasString")) ) ) - throw IllegalArgumentException(); - if( !pResMgr ) - throw IllegalArgumentException(); - - Sequence< OUString > aStrings( Params.getLength() ); - Sequence< sal_Bool > aBools( Params.getLength() ); - const Any* pIn = Params.getConstArray(); - OUString* pOutString = aStrings.getArray(); - sal_Bool* pOutBool = aBools.getArray(); - - Reference< XTypeConverter > xC = getTypeConverter(); - bool bGetBranch = FunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getString" ) ) || FunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getStrings" ) ); - - SolarMutexGuard aGuard; - for( sal_Int32 n = 0; n < nElements; n++ ) - { - sal_Int32 nId = 0; - if( !(pIn[n] >>= nId) ) - { - if( xC.is() ) - { - xC->convertToSimpleType( pIn[n], TypeClass_LONG ) >>= nId; - } - else - throw CannotConvertException(); - } - if( nId > 0xFFFF || nId < 0 ) - throw IllegalArgumentException(); - - if( bGetBranch ) - { - ResId aId( (sal_uInt16)nId, *pResMgr ); - aId.SetRT( RSC_STRING ); - if( pResMgr->IsAvailable( aId ) ) - { - String aStr( aId ); - pOutString[n] = aStr; - } - else - throw IllegalArgumentException(); - } - else // hasString(s) - { - sal_Bool bRet = sal_False; - if( pResMgr ) - { - ResId aId( (sal_uInt16)nId, *pResMgr ); - aId.SetRT( RSC_STRING ); - bRet = pResMgr->IsAvailable( aId ); - } - pOutBool[n] = bRet; - } - } - if( FunctionName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getString")) ) - aRet <<= pOutString[0]; - else if( FunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("getStrings" ) ) ) - aRet <<= aStrings; - else if( FunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("hasString" ) ) ) - aRet <<= pOutBool[0]; - else - aRet <<= aBools; - } - else if( FunctionName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getStringList")) || FunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("hasStringList" ) ) ) - { - if( Params.getLength() != 1 ) - throw IllegalArgumentException(); - Reference< XTypeConverter > xC = getTypeConverter(); - SolarMutexGuard aGuard; - - sal_Int32 nId = 0; - if( !(Params.getConstArray()[0] >>= nId) ) - { - if( xC.is() ) - { - xC->convertToSimpleType( Params.getConstArray()[0], TypeClass_LONG ) >>= nId; - } - else - throw CannotConvertException(); - } - - if( FunctionName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getStringList")) ) - { - ResId aId( (sal_uInt16)nId, *pResMgr ); - aId.SetRT( RSC_STRINGARRAY ); - if( pResMgr->IsAvailable( aId ) ) - { - ResStringArray aStr( aId ); - int nEntries = aStr.Count(); - Sequence< PropertyValue > aPropSeq( nEntries ); - PropertyValue* pOut = aPropSeq.getArray(); - for( int i = 0; i < nEntries; i++ ) - { - pOut[i].Name = aStr.GetString( i ); - pOut[i].Handle = -1; - pOut[i].Value <<= aStr.GetValue( i ); - pOut[i].State = PropertyState_DIRECT_VALUE; - } - aRet <<= aPropSeq; - } - else - throw IllegalArgumentException(); - } - else // hasStringList - { - sal_Bool bRet = sal_False; - if( pResMgr ) - { - ResId aId( (sal_uInt16)nId, *pResMgr ); - aId.SetRT( RSC_STRINGARRAY ); - bRet = pResMgr->IsAvailable( aId ); - } - aRet <<= bRet; - } - } - else - { - Reference< XInvocation > xI = getDefaultInvocation(); - if( xI.is() ) - return xI->invoke( FunctionName, Params, OutParamIndex, OutParam ); - else - throw IllegalArgumentException(); - } - return aRet; -} - -// XInvokation -void SAL_CALL ResourceService::setValue(const OUString& PropertyName, const Any& Value) - throw(UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException) -{ - if( PropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FileName")) ) - { - OUString aName; - if( !(Value >>= aName) ) - { - Reference< XTypeConverter > xC = getTypeConverter(); - if( xC.is() ) - xC->convertToSimpleType( Value, TypeClass_STRING ) >>= aName; - else - throw CannotConvertException(); - } - - SolarMutexGuard aGuard; - OStringBuffer aBuf( aName.getLength()+8 ); - aBuf.append( OUStringToOString( aName, osl_getThreadTextEncoding() ) ); - ResMgr * pRM = ResMgr::CreateResMgr( aBuf.getStr() ); - if( !pRM ) - throw InvocationTargetException(); - if( pResMgr ) - delete pResMgr; - pResMgr = pRM; - aFileName = OStringToOUString( aBuf.makeStringAndClear(), osl_getThreadTextEncoding() ); - } - else - { - Reference< XInvocation > xI = getDefaultInvocation(); - if( xI.is() ) - xI->setValue( PropertyName, Value ); - else - throw UnknownPropertyException(); - } -} - -// XInvokation -Any SAL_CALL ResourceService::getValue(const OUString& PropertyName) - throw(UnknownPropertyException, RuntimeException) -{ - SolarMutexGuard aGuard; - if( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FileName" ) )) - return makeAny( aFileName ); - - Reference< XInvocation > xI = getDefaultInvocation(); - if( xI.is() ) - return xI->getValue( PropertyName ); - - throw UnknownPropertyException(); -} - -// XInvokation -sal_Bool SAL_CALL ResourceService::hasMethod(const OUString& Name) - throw(RuntimeException) -{ - if( Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getString")) || - Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getStrings")) || - Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("hasString")) || - Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("hasStrings")) || - Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getStringList")) || - Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("hasStringList")) - ) - return sal_True; - else - { - Reference< XInvocation > xI = getDefaultInvocation(); - if( xI.is() ) - return xI->hasMethod( Name ); - else - return sal_False; - } -} - -// XInvokation -sal_Bool SAL_CALL ResourceService::hasProperty(const OUString& Name) - throw(RuntimeException) -{ - if( Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FileName")) ) - return sal_True; - else - { - Reference< XInvocation > xI = getDefaultInvocation(); - if( xI.is() ) - return xI->hasProperty( Name ); - else - return sal_False; - } -} - -namespace res -{ - ComponentInfo getComponentInfo_VclStringResourceLoader() - { - ComponentInfo aInfo; - aInfo.aSupportedServices = ResourceService::getSupportedServiceNames_Static(); - aInfo.sImplementationName = ResourceService::getImplementationName_Static(); - aInfo.pFactory = &ResourceService::Create; - return aInfo; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/resourceservices.cxx b/extensions/source/resource/resourceservices.cxx new file mode 100644 index 000000000000..1ed27148ab9d --- /dev/null +++ b/extensions/source/resource/resourceservices.cxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Bjoern Michaelsen + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Major Contributor(s): + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "precompiled_extensions.hxx" + +#include +#include +#include +#include + +namespace sdecl = ::comphelper::service_decl; + +sdecl::class_< ::extensions::resource::ResourceStringIndexAccess, sdecl::with_args > ResourceStringIndexAccessServiceImpl; +sdecl::class_< ::extensions::resource::OpenOfficeResourceLoader> OpenOfficeResourceLoaderServiceImpl; + +const sdecl::ServiceDecl ResourceStringIndexAccessDecl( + ResourceStringIndexAccessServiceImpl, + "org.libreoffice.extensions.resource.ResourceStringIndexAccess", + "org.libreoffice.resource.ResourceStringIndexAccess"); + +const sdecl::ServiceDecl OpenOfficeResourceLoaderDecl( + OpenOfficeResourceLoaderServiceImpl, + "com.sun.star.comp.resource.OpenOfficeResourceLoader", + "com.sun.star.resource.OfficeResourceLoader"); + +COMPHELPER_SERVICEDECL_EXPORTS2( + ResourceStringIndexAccessDecl, + OpenOfficeResourceLoaderDecl +); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3 From fe96939958765fef33dd7c8473a1322154700087 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Fri, 27 May 2011 19:54:53 +0200 Subject: fdo#37290: allow also access to StringList resources --- extensions/source/resource/ResourceIndexAccess.cxx | 208 +++++++++++++++++++++ extensions/source/resource/ResourceIndexAccess.hxx | 75 ++++++++ .../source/resource/ResourceStringIndexAccess.cxx | 94 ---------- .../source/resource/ResourceStringIndexAccess.hxx | 71 ------- extensions/source/resource/makefile.mk | 2 +- extensions/source/resource/res.component | 4 +- extensions/source/resource/resourceservices.cxx | 14 +- 7 files changed, 293 insertions(+), 175 deletions(-) create mode 100644 extensions/source/resource/ResourceIndexAccess.cxx create mode 100644 extensions/source/resource/ResourceIndexAccess.hxx delete mode 100644 extensions/source/resource/ResourceStringIndexAccess.cxx delete mode 100644 extensions/source/resource/ResourceStringIndexAccess.hxx (limited to 'extensions') diff --git a/extensions/source/resource/ResourceIndexAccess.cxx b/extensions/source/resource/ResourceIndexAccess.cxx new file mode 100644 index 000000000000..31a244b96a5f --- /dev/null +++ b/extensions/source/resource/ResourceIndexAccess.cxx @@ -0,0 +1,208 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Bjoern Michaelsen + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Major Contributor(s): + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::extensions::resource; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; + +using ::comphelper::stl_begin; +using ::comphelper::stl_end; +using ::rtl::OString; +using ::rtl::OUString; +using ::rtl::OUStringToOString; + +namespace +{ + static ::boost::shared_ptr GetResMgr(Sequence const& rArgs) + { + if(rArgs.getLength()!=1) + return ::boost::shared_ptr(); + OUString sFilename; + rArgs[0] >>= sFilename; + SolarMutexGuard aGuard; + const OString sEncName(OUStringToOString(sFilename, osl_getThreadTextEncoding())); + return ::boost::shared_ptr(ResMgr::CreateResMgr(sEncName)); + } + + class ResourceIndexAccessBase : public cppu::WeakImplHelper1< ::com::sun::star::container::XIndexAccess> + { + public: + ResourceIndexAccessBase( ::boost::shared_ptr pResMgr) + : m_pResMgr(pResMgr) + { + OSL_ENSURE(m_pResMgr, "no ressource manager given"); + } + + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException) + { return m_pResMgr.get() ? SAL_MAX_UINT16 : 0; }; + // XElementAccess + virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException) + { return static_cast(m_pResMgr.get()); }; + + protected: + // m_pResMgr should never be NULL + const ::boost::shared_ptr m_pResMgr; + }; + + class ResourceStringIndexAccess : public ResourceIndexAccessBase + { + public: + ResourceStringIndexAccess( ::boost::shared_ptr pResMgr) + : ResourceIndexAccessBase(pResMgr) {} + // XIndexAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + // XElementAccessBase + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException) + { return ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)); }; + }; + + class ResourceStringListIndexAccess : public ResourceIndexAccessBase + { + public: + ResourceStringListIndexAccess( ::boost::shared_ptr pResMgr) + : ResourceIndexAccessBase(pResMgr) {} + // XIndexAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + // XElementAccessBase + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException) + { return ::getCppuType(reinterpret_cast * >(NULL)); }; + }; +} + +ResourceIndexAccess::ResourceIndexAccess(Sequence const& rArgs, Reference const&) + : m_pResMgr(GetResMgr(rArgs)) +{}; + +Reference initResourceIndexAccess(ResourceIndexAccess* pResourceIndexAccess) +{ + Reference xResult(static_cast(pResourceIndexAccess)); + if(!pResourceIndexAccess->hasElements()) + // xResult does not help the client to analyse the problem + // and will crash on getByIndex calls, better just give back an empty Reference + // so that such ResourceStringIndexAccess instances are never release into the wild + throw RuntimeException( + OUString(RTL_CONSTASCII_USTRINGPARAM("ressource manager could not get initialized")), + /* xResult */ Reference()); + return xResult; +} + +Any SAL_CALL ResourceIndexAccess::getByName(const OUString& aName) + throw (NoSuchElementException, WrappedTargetException, RuntimeException) +{ + const Sequence aNames(getElementNames()); + Reference xResult; + switch(::std::find(stl_begin(aNames), stl_end(aNames), aName)-stl_begin(aNames)) + { + case 0: + xResult = Reference(new ResourceStringIndexAccess(m_pResMgr)); + break; + case 1: + xResult = Reference(new ResourceStringListIndexAccess(m_pResMgr)); + break; + default: + throw NoSuchElementException(); + } + return makeAny(xResult); +} + +Sequence SAL_CALL ResourceIndexAccess::getElementNames( ) + throw (RuntimeException) +{ + static Sequence aResult; + if( aResult.getLength() == 0) + { + aResult.realloc(2); + aResult[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("String")); + aResult[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("StringList")); + } + return aResult; +} + +::sal_Bool SAL_CALL ResourceIndexAccess::hasByName(const OUString& aName) + throw (RuntimeException) +{ + const Sequence aNames(getElementNames()); + return (::std::find(stl_begin(aNames), stl_end(aNames), aName) != stl_end(aNames)); +} + +Any SAL_CALL ResourceStringIndexAccess::getByIndex(sal_Int32 nIdx) + throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException) +{ + if(nIdx > SAL_MAX_UINT16 || nIdx < 0) + throw IndexOutOfBoundsException(); + SolarMutexGuard aGuard; + const ResId aId(static_cast(nIdx), *m_pResMgr); + aId.SetRT(RSC_STRING); + if(!m_pResMgr->IsAvailable(aId)) + throw RuntimeException( + OUString(RTL_CONSTASCII_USTRINGPARAM("string ressource for id not available")), + Reference()); + return makeAny(OUString(String(aId))); +} + +Any SAL_CALL ResourceStringListIndexAccess::getByIndex(sal_Int32 nIdx) + throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException) +{ + if(nIdx > SAL_MAX_UINT16 || nIdx < 0) + throw IndexOutOfBoundsException(); + SolarMutexGuard aGuard; + const ResId aId(static_cast(nIdx), *m_pResMgr); + aId.SetRT(RSC_STRINGARRAY); + if(!m_pResMgr->IsAvailable(aId)) + throw RuntimeException( + OUString(RTL_CONSTASCII_USTRINGPARAM("string list ressource for id not available")), + Reference()); + const ResStringArray aStringList(aId); + Sequence aPropList(aStringList.Count()); + for(sal_Int32 nCount = 0; nCount != aPropList.getLength(); ++nCount) + { + aPropList[nCount].Name = aStringList.GetString(nCount); + aPropList[nCount].Handle = -1; + aPropList[nCount].Value <<= aStringList.GetValue(nCount); + aPropList[nCount].State = PropertyState_DIRECT_VALUE; + } + return makeAny(aPropList); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/ResourceIndexAccess.hxx b/extensions/source/resource/ResourceIndexAccess.hxx new file mode 100644 index 000000000000..41632591aa10 --- /dev/null +++ b/extensions/source/resource/ResourceIndexAccess.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Bjoern Michaelsen + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Major Contributor(s): + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_HXX +#define EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_HXX + +#include "precompiled_extensions.hxx" + +#include +#include +#include +#include +#include +#include + +class ResMgr; + +namespace extensions { namespace resource +{ + /** This class provides access to tools library text resources */ + class ResourceIndexAccess : public cppu::WeakImplHelper1< ::com::sun::star::container::XNameAccess> + { + public: + /** The ctor takes a sequence with one element: the name of the resource, e.g. svt */ + ResourceIndexAccess(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> const& rArgs, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&); + // XNameAccess + // The XNameAccess provides access to two named elements: + // "String" returns a XIndexAccess to String resources + // "StringList" returns a XIndexAccess to StringList/StringArray resources + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException) + { return ::getCppuType(reinterpret_cast< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*>(NULL)); }; + virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException) + { return static_cast(m_pResMgr.get()); }; + + private: + // m_pResMgr should never be NULL + const ::boost::shared_ptr m_pResMgr; + }; +}} + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> initResourceIndexAccess(::extensions::resource::ResourceIndexAccess*); + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/ResourceStringIndexAccess.cxx b/extensions/source/resource/ResourceStringIndexAccess.cxx deleted file mode 100644 index d48d636bfa11..000000000000 --- a/extensions/source/resource/ResourceStringIndexAccess.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Bjoern Michaelsen - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include - -#include -#include -#include -#include -#include - -using namespace ::extensions::resource; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; - -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OUStringToOString; - -namespace -{ - static ::std::auto_ptr GetResMgr(Sequence const& rArgs) - { - if(rArgs.getLength()!=1) - return ::std::auto_ptr(); - OUString sFilename; - rArgs[0] >>= sFilename; - SolarMutexGuard aGuard; - const OString sEncName(OUStringToOString(sFilename, osl_getThreadTextEncoding())); - return ::std::auto_ptr(ResMgr::CreateResMgr(sEncName)); - } -} - - -ResourceStringIndexAccess::ResourceStringIndexAccess(Sequence const& rArgs, Reference const&) - : m_pResMgr(GetResMgr(rArgs)) -{}; - -Reference initResourceStringIndexAccess(ResourceStringIndexAccess* pResourceStringIndexAccess) -{ - Reference xResult(static_cast(pResourceStringIndexAccess)); - if(!pResourceStringIndexAccess->hasElements()) - // xResult does not help the client to analyse the problem - // and will crash on getByIndex calls, better just give back an empty Reference - // so that such ResourceStringIndexAccess instances are never release into the wild - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("ressource manager could not get initialized")), - /* xResult */ Reference()); - return xResult; -} - -Any SAL_CALL ResourceStringIndexAccess::getByIndex(sal_Int32 nIdx) - throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException) -{ - if(nIdx > SAL_MAX_UINT16 || nIdx < 0) - throw IndexOutOfBoundsException(); - SolarMutexGuard aGuard; - const ResId aId(static_cast(nIdx), *m_pResMgr); - aId.SetRT(RSC_STRING); - if(!m_pResMgr->IsAvailable(aId)) - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("string ressource for id not available")), - Reference()); - return makeAny(OUString(String(aId))); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/ResourceStringIndexAccess.hxx b/extensions/source/resource/ResourceStringIndexAccess.hxx deleted file mode 100644 index e1a01e3a5de0..000000000000 --- a/extensions/source/resource/ResourceStringIndexAccess.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Bjoern Michaelsen - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#ifndef EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_HXX -#define EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_HXX - -#include "precompiled_extensions.hxx" - -#include -#include -#include -#include -#include -#include - -class ResMgr; - -namespace extensions { namespace resource -{ - class ResourceStringIndexAccess : public cppu::WeakImplHelper1< ::com::sun::star::container::XIndexAccess> - { - public: - ResourceStringIndexAccess(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> const& rArgs, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&); - // XIndexAccess - virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException) - { return m_pResMgr.get() ? SAL_MAX_UINT16 : 0; }; - virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - // XElementAccess - virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException) - { return ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)); }; - virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException) - { return static_cast(m_pResMgr.get()); }; - - private: - // m_pResMgr should never be NULL, see initResourceStringIndexAccess - const ::std::auto_ptr m_pResMgr; - }; - -}} - -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> initResourceStringIndexAccess(::extensions::resource::ResourceStringIndexAccess*); - -#endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/makefile.mk b/extensions/source/resource/makefile.mk index d9143d2d37be..4839ec0b7ca2 100644 --- a/extensions/source/resource/makefile.mk +++ b/extensions/source/resource/makefile.mk @@ -40,7 +40,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES= \ - $(SLO)$/ResourceStringIndexAccess.obj \ + $(SLO)$/ResourceIndexAccess.obj \ $(SLO)$/oooresourceloader.obj \ $(SLO)$/resourceservices.obj diff --git a/extensions/source/resource/res.component b/extensions/source/resource/res.component index 36227874216d..b5df9748e464 100644 --- a/extensions/source/resource/res.component +++ b/extensions/source/resource/res.component @@ -32,7 +32,7 @@ - - + + diff --git a/extensions/source/resource/resourceservices.cxx b/extensions/source/resource/resourceservices.cxx index 1ed27148ab9d..0a08bb52666a 100644 --- a/extensions/source/resource/resourceservices.cxx +++ b/extensions/source/resource/resourceservices.cxx @@ -30,20 +30,20 @@ #include "precompiled_extensions.hxx" -#include +#include #include #include #include namespace sdecl = ::comphelper::service_decl; -sdecl::class_< ::extensions::resource::ResourceStringIndexAccess, sdecl::with_args > ResourceStringIndexAccessServiceImpl; +sdecl::class_< ::extensions::resource::ResourceIndexAccess, sdecl::with_args > ResourceIndexAccessServiceImpl; sdecl::class_< ::extensions::resource::OpenOfficeResourceLoader> OpenOfficeResourceLoaderServiceImpl; -const sdecl::ServiceDecl ResourceStringIndexAccessDecl( - ResourceStringIndexAccessServiceImpl, - "org.libreoffice.extensions.resource.ResourceStringIndexAccess", - "org.libreoffice.resource.ResourceStringIndexAccess"); +const sdecl::ServiceDecl ResourceIndexAccessDecl( + ResourceIndexAccessServiceImpl, + "org.libreoffice.extensions.resource.ResourceIndexAccess", + "org.libreoffice.resource.ResourceIndexAccess"); const sdecl::ServiceDecl OpenOfficeResourceLoaderDecl( OpenOfficeResourceLoaderServiceImpl, @@ -51,7 +51,7 @@ const sdecl::ServiceDecl OpenOfficeResourceLoaderDecl( "com.sun.star.resource.OfficeResourceLoader"); COMPHELPER_SERVICEDECL_EXPORTS2( - ResourceStringIndexAccessDecl, + ResourceIndexAccessDecl, OpenOfficeResourceLoaderDecl ); -- cgit v1.2.3