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 #ifndef _TOOLS_RESARY_HXX 28 #define _TOOLS_RESARY_HXX 29 30 #include "tools/toolsdllapi.h" 31 #include <tools/resid.hxx> 32 #include <tools/rc.hxx> 33 34 // --------------------- 35 // - ImplResStringItem - 36 // --------------------- 37 38 struct ImplResStringItem 39 { 40 XubString maStr; 41 long mnValue; 42 43 //#if 0 // _SOLAR__PRIVATE 44 #ifdef _TOOLS_RESARY_CXX 45 ImplResStringItem( const XubString& rStr ) : 46 maStr( rStr ) {} 47 #endif 48 //#endif 49 }; 50 51 // ------------------ 52 // - ResStringArray - 53 // ------------------ 54 55 #define RESARRAY_INDEX_NOTFOUND (0xffffffff) 56 57 class TOOLS_DLLPUBLIC ResStringArray 58 { 59 private: 60 // --------------------- 61 // - ImplResStringItem - 62 // --------------------- 63 struct ImplResStringItem 64 { 65 XubString m_aStr; 66 long m_nValue; 67 68 ImplResStringItem( const XubString& rStr, long nValue = 0 ) : 69 m_aStr( rStr ), 70 m_nValue( nValue ) 71 {} 72 }; 73 74 std::vector< ImplResStringItem > m_aStrings; 75 76 public: 77 ResStringArray( const ResId& rResId ); 78 ~ResStringArray(); 79 80 const XubString& GetString( sal_uInt32 nIndex ) const 81 { return (nIndex < m_aStrings.size()) ? m_aStrings[nIndex].m_aStr : String::EmptyString(); } 82 long GetValue( sal_uInt32 nIndex ) const 83 { return (nIndex < m_aStrings.size()) ? m_aStrings[nIndex].m_nValue : -1; } 84 sal_uInt32 Count() const { return sal_uInt32(m_aStrings.size()); } 85 86 sal_uInt32 FindIndex( long nValue ) const; 87 88 private: 89 ResStringArray( const ResStringArray& ); 90 ResStringArray& operator=( const ResStringArray& ); 91 }; 92 93 #endif // _TOOLS_RESARY_HXX 94