1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SVX_STRINGLISTRESOURCE_HXX 29 #define SVX_STRINGLISTRESOURCE_HXX 30 31 #include <tools/rc.hxx> 32 33 #include <svx/svxdllapi.h> 34 35 #include <memory> 36 37 //........................................................................ 38 namespace svx 39 { 40 //........................................................................ 41 42 //==================================================================== 43 //= StringListResource 44 //==================================================================== 45 /** loads a list of strings from a resource, where the resource is of type RSC_RESOURCE, 46 and has sub resources of type string, numbered from 1 to n 47 */ 48 class StringListResource : public Resource 49 { 50 public: 51 SVX_DLLPUBLIC StringListResource( const ResId& _rResId ); 52 SVX_DLLPUBLIC ~StringListResource(); 53 54 inline void get( ::std::vector< String >& _rStrings ) 55 { 56 _rStrings = m_aStrings; 57 } 58 59 60 /** returns the String with a given local resource id 61 62 @param _nResId 63 The resource id. It will not be checked if this id exists. 64 65 @return String 66 The string. 67 */ 68 String getString( sal_uInt16 _nResId ) 69 { 70 return String( ResId( _nResId, *m_pResMgr ) ); 71 } 72 73 size_t size() const { return m_aStrings.size(); } 74 bool empty() const { return m_aStrings.empty(); } 75 76 const String& operator[]( size_t _index ) const { return m_aStrings[ _index ]; } 77 78 private: 79 ::std::vector< String > m_aStrings; 80 }; 81 82 //........................................................................ 83 } // namespace svx 84 //........................................................................ 85 86 #endif // SVX_STRINGLISTRESOURCE_HXX 87