Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / dialog / strarray.cxx
blob28bf16a4355fc78ef43689374d64202e9e2956ae
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
27 sal_uInt32 SvxFieldUnitTable::Count() { return std::size(RID_SVXSTR_FIELDUNIT_TABLE); }
29 OUString SvxFieldUnitTable::GetString(sal_uInt32 nPos)
31 if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
32 return SvxResId(RID_SVXSTR_FIELDUNIT_TABLE[nPos].first);
33 return OUString();
36 FieldUnit SvxFieldUnitTable::GetValue(sal_uInt32 nPos)
38 if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
39 return RID_SVXSTR_FIELDUNIT_TABLE[nPos].second;
40 return FieldUnit::NONE;
43 OUString SvxAttrNameTable::GetString(sal_uInt32 nPos)
45 if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
46 return SvxResId(RID_ATTR_NAMES[nPos].first);
47 return OUString();
50 sal_uInt32 SvxAttrNameTable::Count() { return std::size(RID_ATTR_NAMES); }
52 sal_uInt32 SvxAttrNameTable::FindIndex(int nValue)
54 for (size_t i = 0; i < std::size(RID_ATTR_NAMES); ++i)
56 if (nValue == RID_ATTR_NAMES[i].second)
57 return i;
59 return RESARRAY_INDEX_NOTFOUND;
62 OUString SvxNumberingTypeTable::GetString(sal_uInt32 nPos)
64 if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
65 return SvxResId(RID_SVXSTRARY_NUMBERINGTYPE[nPos].first);
66 return OUString();
69 sal_uInt32 SvxNumberingTypeTable::Count() { return std::size(RID_SVXSTRARY_NUMBERINGTYPE); }
71 int SvxNumberingTypeTable::GetValue(sal_uInt32 nPos)
73 if (RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count())
74 return RID_SVXSTRARY_NUMBERINGTYPE[nPos].second;
75 return 0;
78 sal_uInt32 SvxNumberingTypeTable::FindIndex(int nValue)
80 for (size_t i = 0; i < std::size(RID_SVXSTRARY_NUMBERINGTYPE); ++i)
82 if (nValue == RID_SVXSTRARY_NUMBERINGTYPE[i].second)
83 return i;
85 return RESARRAY_INDEX_NOTFOUND;
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */