LibreOffice Module svtools (master) 1
indexentryres.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
21#include <svtools/svtresid.hxx>
22#include <svtools/strings.hrc>
24
25// implementation of the indexentry-algorithm-name translation
27{
28 m_aData.emplace_back("alphanumeric", SvtResId(STR_SVT_INDEXENTRY_ALPHANUMERIC));
29 m_aData.emplace_back("dict", SvtResId(STR_SVT_INDEXENTRY_DICTIONARY));
30 m_aData.emplace_back("pinyin", SvtResId(STR_SVT_INDEXENTRY_PINYIN));
31 m_aData.emplace_back("radical", SvtResId(STR_SVT_INDEXENTRY_RADICAL));
32 m_aData.emplace_back("stroke", SvtResId(STR_SVT_INDEXENTRY_STROKE));
33 m_aData.emplace_back("zhuyin", SvtResId(STR_SVT_INDEXENTRY_ZHUYIN));
34 m_aData.emplace_back("phonetic (alphanumeric first) (grouped by syllable)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_FS));
35 m_aData.emplace_back("phonetic (alphanumeric first) (grouped by consonant)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_FC));
36 m_aData.emplace_back("phonetic (alphanumeric last) (grouped by syllable)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_LS));
37 m_aData.emplace_back("phonetic (alphanumeric last) (grouped by consonant)", SvtResId(STR_SVT_INDEXENTRY_PHONETIC_LC));
38}
39
40const OUString& IndexEntryResource::GetTranslation(const OUString &r_Algorithm)
41{
42 sal_Int32 nIndex = r_Algorithm.indexOf('.');
43 OUString aLocaleFreeAlgorithm;
44
45 if (nIndex == -1)
46 aLocaleFreeAlgorithm = r_Algorithm;
47 else {
48 nIndex += 1;
49 aLocaleFreeAlgorithm = r_Algorithm.copy(nIndex);
50 }
51
52 for (size_t i = 0; i < m_aData.size(); ++i)
53 if (aLocaleFreeAlgorithm == m_aData[i].GetAlgorithm())
54 return m_aData[i].GetTranslation();
55 return r_Algorithm;
56}
57
58/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & GetTranslation(const OUString &rAlgorithm)
std::vector< IndexEntryResourceData > m_aData
sal_Int32 nIndex
int i
OUString SvtResId(TranslateId aId)
Definition: svtresid.cxx:24