LibreOffice Module svx (master)  1
strarray.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <svx/dialmgr.hxx>
21 #include <svx/strarray.hxx>
22 #include <tools/resary.hxx>
23 #include <svx/svxitems.hrc>
24 #include <fieldunit.hrc>
25 #include <numberingtype.hrc>
26 
28 {
29  return SAL_N_ELEMENTS(RID_SVXSTR_FIELDUNIT_TABLE);
30 }
31 
32 OUString SvxFieldUnitTable::GetString(sal_uInt32 nPos)
33 {
34  if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
35  return SvxResId(RID_SVXSTR_FIELDUNIT_TABLE[nPos].first);
36  return OUString();
37 }
38 
40 {
41  if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
42  return RID_SVXSTR_FIELDUNIT_TABLE[nPos].second;
43  return FieldUnit::NONE;
44 }
45 
46 OUString SvxAttrNameTable::GetString(sal_uInt32 nPos)
47 {
48  if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
49  return SvxResId(RID_ATTR_NAMES[nPos].first);
50  return OUString();
51 }
52 
54 {
55  return SAL_N_ELEMENTS(RID_ATTR_NAMES);
56 }
57 
59 {
60  for (size_t i = 0; i < SAL_N_ELEMENTS(RID_ATTR_NAMES); ++i)
61  {
62  if (nValue == RID_ATTR_NAMES[i].second)
63  return i;
64  }
66 }
67 
68 OUString SvxNumberingTypeTable::GetString(sal_uInt32 nPos)
69 {
70  if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
71  return SvxResId(RID_SVXSTRARY_NUMBERINGTYPE[nPos].first);
72  return OUString();
73 }
74 
76 {
77  return SAL_N_ELEMENTS(RID_SVXSTRARY_NUMBERINGTYPE);
78 }
79 
80 int SvxNumberingTypeTable::GetValue(sal_uInt32 nPos)
81 {
82  if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
83  return RID_SVXSTRARY_NUMBERINGTYPE[nPos].second;
84  return 0;
85 }
86 
88 {
89  for (size_t i = 0; i < SAL_N_ELEMENTS(RID_SVXSTRARY_NUMBERINGTYPE); ++i)
90  {
91  if (nValue == RID_SVXSTRARY_NUMBERINGTYPE[i].second)
92  return i;
93  }
95 }
96 
97 
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FieldUnit
static sal_uInt32 FindIndex(int nValue)
Definition: strarray.cxx:87
static OUString GetString(sal_uInt32 i)
Definition: strarray.cxx:46
static int GetValue(sal_uInt32 i)
Definition: strarray.cxx:80
#define RESARRAY_INDEX_NOTFOUND
static FieldUnit GetValue(sal_uInt32 i)
Definition: strarray.cxx:39
static OUString GetString(sal_uInt32 i)
Definition: strarray.cxx:68
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
sal_Int16 const nValue
Definition: fmsrccfg.cxx:82
static sal_uInt32 Count()
Definition: strarray.cxx:53
#define SAL_N_ELEMENTS(arr)
static OUString GetString(sal_uInt32 i)
Definition: strarray.cxx:32
int i
static sal_uInt32 Count()
Definition: strarray.cxx:75
static sal_uInt32 Count()
Definition: strarray.cxx:27
static sal_uInt32 FindIndex(int nValue)
Definition: strarray.cxx:58
void SAL_CALL first(const css::awt::SpinEvent &rEvent) override