xref: /aoo41x/main/svx/source/dialog/strarray.cxx (revision f6e50924)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 #include <tools/shl.hxx>
27 
28 // include ---------------------------------------------------------------
29 
30 #include <svx/dialogs.hrc> // -> RID_SVXSTR_LANGUAGE_TABLE
31 #include <svx/dialmgr.hxx>
32 #include <svx/strarray.hxx>
33 
34 //------------------------------------------------------------------------
35 
SvxStringArray(sal_uInt32 nResId)36 SvxStringArray::SvxStringArray( sal_uInt32 nResId ) :
37 
38 	ResStringArray( SVX_RES( nResId ) )
39 
40 {
41 }
42 
43 //------------------------------------------------------------------------
44 
SvxStringArray(const ResId & rResId)45 SvxStringArray::SvxStringArray( const ResId& rResId ) :
46 	ResStringArray( rResId )
47 {
48 }
49 
50 
51 //------------------------------------------------------------------------
52 
~SvxStringArray()53 SvxStringArray::~SvxStringArray()
54 {
55 }
56 
57 //------------------------------------------------------------------------
58 
GetStringByPos(sal_uInt32 nPos) const59 const String& SvxStringArray::GetStringByPos( sal_uInt32 nPos ) const
60 {
61 	if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() )
62 		return ResStringArray::GetString( nPos );
63 	else
64         return String::EmptyString();
65 }
66 
67 //------------------------------------------------------------------------
68 
GetStringByType(long nType) const69 const String& SvxStringArray::GetStringByType( long nType ) const
70 {
71 	sal_uInt32 nPos = FindIndex( nType );
72 
73 	if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() )
74 		return ResStringArray::GetString( nPos );
75 	else
76         return String::EmptyString();
77 }
78 
79 //------------------------------------------------------------------------
80 
GetValueByStr(const String & rStr) const81 long SvxStringArray::GetValueByStr( const String& rStr ) const
82 {
83 	long nType = 0;
84 	sal_uInt32 nCount = Count();
85 
86 	for ( sal_uInt32 i = 0; i < nCount; ++i )
87 		if ( rStr == ResStringArray::GetString( i ) )
88 		{
89 			nType = GetValue( i );
90 			break;
91 		}
92 	return nType;
93 }
94 
95 
96