merge the formfield patch from ooo-build
[ooovba.git] / svx / source / inc / stringlistresource.hxx
blob8fb8ff9db2158624a93622f2d957458996358030
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: stringlistresource.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SVX_STRINGLISTRESOURCE_HXX
32 #define SVX_STRINGLISTRESOURCE_HXX
34 #include <tools/rc.hxx>
36 #include <svx/svxdllapi.h>
38 #include <memory>
40 //........................................................................
41 namespace svx
43 //........................................................................
45 //====================================================================
46 //= StringListResource
47 //====================================================================
48 /** loads a list of strings from a resource, where the resource is of type RSC_RESOURCE,
49 and has sub resources of type string, numbered from 1 to n
51 class StringListResource : public Resource
53 public:
54 SVX_DLLPUBLIC StringListResource( const ResId& _rResId );
55 SVX_DLLPUBLIC ~StringListResource();
57 inline void get( ::std::vector< String >& _rStrings )
59 _rStrings = m_aStrings;
63 /** returns the String with a given local resource id
65 @param _nResId
66 The resource id. It will not be checked if this id exists.
68 @return String
69 The string.
71 String getString( USHORT _nResId )
73 return String( ResId( _nResId, *m_pResMgr ) );
76 size_t size() const { return m_aStrings.size(); }
77 bool empty() const { return m_aStrings.empty(); }
79 const String& operator[]( size_t _index ) const { return m_aStrings[ _index ]; }
81 private:
82 ::std::vector< String > m_aStrings;
85 //........................................................................
86 } // namespace svx
87 //........................................................................
89 #endif // SVX_STRINGLISTRESOURCE_HXX