1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: strarray.cxx,v $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <tools/shl.hxx>
35 // include ---------------------------------------------------------------
37 #include <svx/dialogs.hrc> // -> RID_SVXSTR_LANGUAGE_TABLE
38 #include <svx/dialmgr.hxx>
39 #include <svx/strarray.hxx>
41 //------------------------------------------------------------------------
43 SvxStringArray::SvxStringArray( sal_uInt32 nResId
) :
45 ResStringArray( SVX_RES( nResId
) )
50 //------------------------------------------------------------------------
52 SvxStringArray::SvxStringArray( const ResId
& rResId
) :
53 ResStringArray( rResId
)
58 //------------------------------------------------------------------------
60 SvxStringArray::~SvxStringArray()
64 //------------------------------------------------------------------------
66 const String
& SvxStringArray::GetStringByPos( sal_uInt32 nPos
) const
68 if ( RESARRAY_INDEX_NOTFOUND
!= nPos
&& nPos
< Count() )
69 return ResStringArray::GetString( nPos
);
71 return String::EmptyString();
74 //------------------------------------------------------------------------
76 const String
& SvxStringArray::GetStringByType( long nType
) const
78 sal_uInt32 nPos
= FindIndex( nType
);
80 if ( RESARRAY_INDEX_NOTFOUND
!= nPos
&& nPos
< Count() )
81 return ResStringArray::GetString( nPos
);
83 return String::EmptyString();
86 //------------------------------------------------------------------------
88 long SvxStringArray::GetValueByStr( const String
& rStr
) const
91 sal_uInt32 nCount
= Count();
93 for ( sal_uInt32 i
= 0; i
< nCount
; ++i
)
94 if ( rStr
== ResStringArray::GetString( i
) )
96 nType
= GetValue( i
);