1*9877b273SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*9877b273SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*9877b273SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*9877b273SAndrew Rist * distributed with this work for additional information 6*9877b273SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*9877b273SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*9877b273SAndrew Rist * "License"); you may not use this file except in compliance 9*9877b273SAndrew Rist * with the License. You may obtain a copy of the License at 10*9877b273SAndrew Rist * 11*9877b273SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*9877b273SAndrew Rist * 13*9877b273SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*9877b273SAndrew Rist * software distributed under the License is distributed on an 15*9877b273SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9877b273SAndrew Rist * KIND, either express or implied. See the License for the 17*9877b273SAndrew Rist * specific language governing permissions and limitations 18*9877b273SAndrew Rist * under the License. 19*9877b273SAndrew Rist * 20*9877b273SAndrew Rist *************************************************************/ 21*9877b273SAndrew Rist 22*9877b273SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef COMPHELPER_OFFICE_RESOURCE_BUNDLE_HXX 25cdf0e10cSrcweir #define COMPHELPER_OFFICE_RESOURCE_BUNDLE_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <comphelper/comphelperdllapi.h> 28cdf0e10cSrcweir 29cdf0e10cSrcweir /** === begin UNO includes === **/ 30cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 31cdf0e10cSrcweir /** === end UNO includes === **/ 32cdf0e10cSrcweir #include <rtl/ustring.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <memory> 35cdf0e10cSrcweir 36cdf0e10cSrcweir //........................................................................ 37cdf0e10cSrcweir namespace comphelper 38cdf0e10cSrcweir { 39cdf0e10cSrcweir //........................................................................ 40cdf0e10cSrcweir 41cdf0e10cSrcweir //==================================================================== 42cdf0e10cSrcweir //= OfficeResourceBundle 43cdf0e10cSrcweir //==================================================================== 44cdf0e10cSrcweir class ResourceBundle_Impl; 45cdf0e10cSrcweir /** wraps the <type scope="com::sun::star::resource">OfficeResourceAccess</type> service 46cdf0e10cSrcweir */ 47cdf0e10cSrcweir class COMPHELPER_DLLPUBLIC OfficeResourceBundle 48cdf0e10cSrcweir { 49cdf0e10cSrcweir private: 50cdf0e10cSrcweir ::std::auto_ptr< ResourceBundle_Impl > m_pImpl; 51cdf0e10cSrcweir 52cdf0e10cSrcweir public: 53cdf0e10cSrcweir /** constructs a resource bundle 54cdf0e10cSrcweir @param _context 55cdf0e10cSrcweir the component context to operate in 56cdf0e10cSrcweir @param _bundleBaseName 57cdf0e10cSrcweir the base name of the resource file which should be accessed (*without* the SUPD!) 58cdf0e10cSrcweir @raises ::com::sun::star::lang::NullPointerException 59cdf0e10cSrcweir if the given component context is <NULL/> 60cdf0e10cSrcweir */ 61cdf0e10cSrcweir OfficeResourceBundle( 62cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _context, 63cdf0e10cSrcweir const ::rtl::OUString& _bundleBaseName 64cdf0e10cSrcweir ); 65cdf0e10cSrcweir 66cdf0e10cSrcweir /** constructs a resource bundle with the resource bundle given as 8-bit ASCII name 67cdf0e10cSrcweir 68cdf0e10cSrcweir This is a convenience constructor only, it does nothing different than the constructor 69cdf0e10cSrcweir taking an unicode string. 70cdf0e10cSrcweir 71cdf0e10cSrcweir @param _context 72cdf0e10cSrcweir the component context to operate in 73cdf0e10cSrcweir @param _bundleBaseName 74cdf0e10cSrcweir the base name of the resource file which should be accessed (*without* the SUPD!) 75cdf0e10cSrcweir @raises ::com::sun::star::lang::NullPointerException 76cdf0e10cSrcweir if the given component context is <NULL/> 77cdf0e10cSrcweir */ 78cdf0e10cSrcweir OfficeResourceBundle( 79cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _context, 80cdf0e10cSrcweir const sal_Char* _bundleBaseAsciiName 81cdf0e10cSrcweir ); 82cdf0e10cSrcweir 83cdf0e10cSrcweir /** destroys the instance 84cdf0e10cSrcweir */ 85cdf0e10cSrcweir ~OfficeResourceBundle(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir /** loads the string with the given resource id from the resource bundle 88cdf0e10cSrcweir @param _resourceId 89cdf0e10cSrcweir the id of the string to load 90cdf0e10cSrcweir @return 91cdf0e10cSrcweir the requested resource string. If no string with the given id exists in the resource bundle, 92cdf0e10cSrcweir an empty string is returned. In a non-product version, an OSL_ENSURE will notify you of this 93cdf0e10cSrcweir then. 94cdf0e10cSrcweir */ 95cdf0e10cSrcweir ::rtl::OUString loadString( sal_Int32 _resourceId ) const; 96cdf0e10cSrcweir 97cdf0e10cSrcweir /** determines whether the resource bundle has a string with the given id 98cdf0e10cSrcweir @param _resourceId 99cdf0e10cSrcweir the id of the string whose existence is to be checked 100cdf0e10cSrcweir @return 101cdf0e10cSrcweir <TRUE/> if and only if a string with the given ID exists in the resource 102cdf0e10cSrcweir bundle. 103cdf0e10cSrcweir */ 104cdf0e10cSrcweir bool hasString( sal_Int32 _resourceId ) const; 105cdf0e10cSrcweir }; 106cdf0e10cSrcweir 107cdf0e10cSrcweir //........................................................................ 108cdf0e10cSrcweir } // namespace comphelper 109cdf0e10cSrcweir //........................................................................ 110cdf0e10cSrcweir 111cdf0e10cSrcweir #endif // COMPHELPER_OFFICE_RESOURCE_BUNDLE_HXX 112cdf0e10cSrcweir 113