tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / filter / xml / editattributemap.cxx
blob93a341adaa7a2dc963e3822d38d196c0c54add84
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/.
8 */
10 #include "editattributemap.hxx"
12 #include <editeng/eeitem.hxx>
13 #include <editeng/memberids.h>
14 #include <xmloff/xmlnamespace.hxx>
16 constexpr ScXMLEditAttributeMap::Entry aEntries[] {
18 { XML_NAMESPACE_FO, u"color"_ustr, u"CharColor"_ustr, EE_CHAR_COLOR, 0 },
19 { XML_NAMESPACE_STYLE, u"font-charset"_ustr, u"CharFontCharSet"_ustr, EE_CHAR_FONTINFO, MID_FONT_CHAR_SET },
20 { XML_NAMESPACE_STYLE, u"font-charset-asian"_ustr, u"CharFontCharSetAsian"_ustr, EE_CHAR_FONTINFO_CJK, MID_FONT_CHAR_SET },
21 { XML_NAMESPACE_STYLE, u"font-charset-complex"_ustr, u"CharFontCharSetComplex"_ustr, EE_CHAR_FONTINFO_CTL, MID_FONT_CHAR_SET },
22 { XML_NAMESPACE_FO, u"font-family"_ustr, u"CharFontName"_ustr, EE_CHAR_FONTINFO, MID_FONT_FAMILY_NAME },
23 { XML_NAMESPACE_STYLE, u"font-family-asian"_ustr, u"CharFontNameAsian"_ustr, EE_CHAR_FONTINFO_CJK, MID_FONT_FAMILY_NAME },
24 { XML_NAMESPACE_STYLE, u"font-family-complex"_ustr, u"CharFontNameComplex"_ustr, EE_CHAR_FONTINFO_CTL, MID_FONT_FAMILY_NAME },
25 { XML_NAMESPACE_STYLE, u"font-family-generic"_ustr, u"CharFontFamily"_ustr, EE_CHAR_FONTINFO, MID_FONT_FAMILY },
26 { XML_NAMESPACE_STYLE, u"font-family-generic-asian"_ustr, u"CharFontFamilyAsian"_ustr, EE_CHAR_FONTINFO_CJK, MID_FONT_FAMILY },
27 { XML_NAMESPACE_STYLE, u"font-family-generic-complex"_ustr, u"CharFontFamilyComplex"_ustr, EE_CHAR_FONTINFO_CTL, MID_FONT_FAMILY },
28 { XML_NAMESPACE_STYLE, u"font-pitch"_ustr, u"CharFontPitch"_ustr, EE_CHAR_FONTINFO, MID_FONT_PITCH },
29 { XML_NAMESPACE_STYLE, u"font-pitch-asian"_ustr, u"CharFontPitchAsian"_ustr, EE_CHAR_FONTINFO_CJK, MID_FONT_PITCH },
30 { XML_NAMESPACE_STYLE, u"font-pitch-complex"_ustr, u"CharFontPitchComplex"_ustr, EE_CHAR_FONTINFO_CTL, MID_FONT_PITCH },
31 { XML_NAMESPACE_FO, u"font-size"_ustr, u"CharHeight"_ustr, EE_CHAR_FONTHEIGHT, MID_FONTHEIGHT },
32 { XML_NAMESPACE_STYLE, u"font-size-asian"_ustr, u"CharHeightAsian"_ustr, EE_CHAR_FONTHEIGHT_CJK, MID_FONTHEIGHT },
33 { XML_NAMESPACE_STYLE, u"font-size-complex"_ustr, u"CharHeightComplex"_ustr, EE_CHAR_FONTHEIGHT_CTL, MID_FONTHEIGHT },
34 { XML_NAMESPACE_FO, u"font-style"_ustr, u"CharPosture"_ustr, EE_CHAR_ITALIC, MID_POSTURE },
35 { XML_NAMESPACE_STYLE, u"font-style-asian"_ustr, u"CharPostureAsian"_ustr, EE_CHAR_ITALIC_CJK, MID_POSTURE },
36 { XML_NAMESPACE_STYLE, u"font-style-complex"_ustr, u"CharPostureComplex"_ustr, EE_CHAR_ITALIC_CTL, MID_POSTURE },
37 { XML_NAMESPACE_STYLE, u"font-style-name"_ustr, u"CharFontStyleName"_ustr, EE_CHAR_FONTINFO, MID_FONT_STYLE_NAME },
38 { XML_NAMESPACE_STYLE, u"font-style-name-asian"_ustr, u"CharFontStyleNameAsian"_ustr, EE_CHAR_FONTINFO_CJK, MID_FONT_STYLE_NAME },
39 { XML_NAMESPACE_STYLE, u"font-style-name-complex"_ustr, u"CharFontStyleNameComplex"_ustr, EE_CHAR_FONTINFO_CTL, MID_FONT_STYLE_NAME },
40 { XML_NAMESPACE_FO, u"font-weight"_ustr, u"CharWeight"_ustr, EE_CHAR_WEIGHT, MID_WEIGHT },
41 { XML_NAMESPACE_STYLE, u"font-weight-asian"_ustr, u"CharWeightAsian"_ustr, EE_CHAR_WEIGHT_CJK, MID_WEIGHT },
42 { XML_NAMESPACE_STYLE, u"font-weight-complex"_ustr, u"CharWeightComplex"_ustr, EE_CHAR_WEIGHT_CTL, MID_WEIGHT },
43 { XML_NAMESPACE_STYLE, u"text-overline-width"_ustr, u"CharOverline"_ustr, EE_CHAR_OVERLINE, MID_TL_STYLE },
44 { XML_NAMESPACE_STYLE, u"text-overline-color"_ustr, u"CharOverlineColor"_ustr, EE_CHAR_OVERLINE, MID_TL_COLOR },
45 { XML_NAMESPACE_STYLE, u"text-overline-color"_ustr, u"CharOverlineHasColor"_ustr, EE_CHAR_OVERLINE, MID_TL_HASCOLOR },
46 { XML_NAMESPACE_STYLE, u"text-underline-width"_ustr, u"CharUnderline"_ustr, EE_CHAR_UNDERLINE, MID_TL_STYLE },
47 { XML_NAMESPACE_STYLE, u"text-underline-color"_ustr, u"CharUnderlineColor"_ustr, EE_CHAR_UNDERLINE, MID_TL_COLOR },
48 { XML_NAMESPACE_STYLE, u"text-underline-color"_ustr, u"CharUnderlineHasColor"_ustr, EE_CHAR_UNDERLINE, MID_TL_HASCOLOR },
49 { XML_NAMESPACE_STYLE, u"text-line-through-mode"_ustr, u"CharWordMode"_ustr, EE_CHAR_WLM, 0 },
50 { XML_NAMESPACE_STYLE, u"text-line-through-type"_ustr, u"CharStrikeout"_ustr, EE_CHAR_STRIKEOUT, MID_CROSS_OUT },
51 { XML_NAMESPACE_STYLE, u"font-relief"_ustr, u"CharRelief"_ustr, EE_CHAR_RELIEF, MID_RELIEF },
52 { XML_NAMESPACE_STYLE, u"text-outline"_ustr, u"CharContoured"_ustr, EE_CHAR_OUTLINE, 0 },
53 { XML_NAMESPACE_FO, u"text-shadow"_ustr, u"CharShadowed"_ustr, EE_CHAR_SHADOW, 0 },
54 { XML_NAMESPACE_FO, u"letter-spacing"_ustr, u"CharKerning"_ustr, EE_CHAR_KERNING, 0 },
55 { XML_NAMESPACE_STYLE, u"letter-kerning"_ustr, u"CharAutoKerning"_ustr, EE_CHAR_PAIRKERNING, 0 },
56 { XML_NAMESPACE_STYLE, u"text-scale"_ustr, u"CharScaleWidth"_ustr, EE_CHAR_FONTWIDTH, 0 },
57 { XML_NAMESPACE_STYLE, u"text-position"_ustr, u"CharEscapement"_ustr, EE_CHAR_ESCAPEMENT, MID_ESC },
58 { XML_NAMESPACE_STYLE, u"text-position"_ustr, u"CharEscapementHeight"_ustr, EE_CHAR_ESCAPEMENT, MID_ESC_HEIGHT },
59 { XML_NAMESPACE_STYLE, u"text-emphasize"_ustr, u"CharEmphasis"_ustr, EE_CHAR_EMPHASISMARK, MID_EMPHASIS },
60 // The following 3 "country" entries are just placeholders for language,
61 // country, script and rfc-language-tag, which all map to CharLocale,
62 // EE_CHAR_LANGUAGE and MID_LANG_LOCALE and are handled individually.
63 { XML_NAMESPACE_FO, u"country"_ustr, u"CharLocale"_ustr, EE_CHAR_LANGUAGE, MID_LANG_LOCALE },
64 { XML_NAMESPACE_STYLE, u"country-asian"_ustr, u"CharLocaleAsian"_ustr, EE_CHAR_LANGUAGE_CJK, MID_LANG_LOCALE },
65 { XML_NAMESPACE_STYLE, u"country-complex"_ustr, u"CharLocaleComplex"_ustr, EE_CHAR_LANGUAGE_CTL, MID_LANG_LOCALE },
68 ScXMLEditAttributeMap::ScXMLEditAttributeMap()
70 for (size_t i = 0; i < SAL_N_ELEMENTS(aEntries); ++i)
72 maAPIEntries.emplace(aEntries[i].maAPIName, &aEntries[i]);
73 maItemIDEntries.emplace(aEntries[i].mnItemID, &aEntries[i]);
77 const ScXMLEditAttributeMap::Entry* ScXMLEditAttributeMap::getEntryByAPIName(const OUString& rAPIName) const
79 StrToEntriesType::const_iterator it = maAPIEntries.find(rAPIName);
80 return it == maAPIEntries.end() ? nullptr : it->second;
83 const ScXMLEditAttributeMap::Entry* ScXMLEditAttributeMap::getEntryByItemID(sal_uInt16 nItemID) const
85 IndexToEntriesType::const_iterator it = maItemIDEntries.find(nItemID);
86 return it == maItemIDEntries.end() ? nullptr : it->second;
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */