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 
27 sal_uInt32 SvxFieldUnitTable::Count() { return SAL_N_ELEMENTS(RID_SVXSTR_FIELDUNIT_TABLE); }
28 
29 OUString SvxFieldUnitTable::GetString(sal_uInt32 nPos)
30 {
31  if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
32  return SvxResId(RID_SVXSTR_FIELDUNIT_TABLE[nPos].first);
33  return OUString();
34 }
35 
37 {
38  if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
39  return RID_SVXSTR_FIELDUNIT_TABLE[nPos].second;
40  return FieldUnit::NONE;
41 }
42 
43 OUString SvxAttrNameTable::GetString(sal_uInt32 nPos)
44 {
45  if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
46  return SvxResId(RID_ATTR_NAMES[nPos].first);
47  return OUString();
48 }
49 
50 sal_uInt32 SvxAttrNameTable::Count() { return SAL_N_ELEMENTS(RID_ATTR_NAMES); }
51 
53 {
54  for (size_t i = 0; i < SAL_N_ELEMENTS(RID_ATTR_NAMES); ++i)
55  {
56  if (nValue == RID_ATTR_NAMES[i].second)
57  return i;
58  }
60 }
61 
62 OUString SvxNumberingTypeTable::GetString(sal_uInt32 nPos)
63 {
64  if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
65  return SvxResId(RID_SVXSTRARY_NUMBERINGTYPE[nPos].first);
66  return OUString();
67 }
68 
69 sal_uInt32 SvxNumberingTypeTable::Count() { return SAL_N_ELEMENTS(RID_SVXSTRARY_NUMBERINGTYPE); }
70 
71 int SvxNumberingTypeTable::GetValue(sal_uInt32 nPos)
72 {
73  if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
74  return RID_SVXSTRARY_NUMBERINGTYPE[nPos].second;
75  return 0;
76 }
77 
79 {
80  for (size_t i = 0; i < SAL_N_ELEMENTS(RID_SVXSTRARY_NUMBERINGTYPE); ++i)
81  {
82  if (nValue == RID_SVXSTRARY_NUMBERINGTYPE[i].second)
83  return i;
84  }
86 }
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FieldUnit
static sal_uInt32 FindIndex(int nValue)
Definition: strarray.cxx:78
static OUString GetString(sal_uInt32 i)
Definition: strarray.cxx:43
static int GetValue(sal_uInt32 i)
Definition: strarray.cxx:71
#define RESARRAY_INDEX_NOTFOUND
static FieldUnit GetValue(sal_uInt32 i)
Definition: strarray.cxx:36
static OUString GetString(sal_uInt32 i)
Definition: strarray.cxx:62
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
static sal_uInt32 Count()
Definition: strarray.cxx:50
#define SAL_N_ELEMENTS(arr)
int i
static OUString GetString(sal_uInt32 i)
Definition: strarray.cxx:29
static sal_uInt32 Count()
Definition: strarray.cxx:69
static sal_uInt32 Count()
Definition: strarray.cxx:27
static sal_uInt32 FindIndex(int nValue)
Definition: strarray.cxx:52
constexpr OUStringLiteral first
sal_Int16 nValue
Definition: fmsrccfg.cxx:81