10#include <rtl/string.hxx>
11#include <rtl/ustring.hxx>
12#include <unordered_map>
19typedef std::unordered_map<const char*, const char*, rtl::CStringHash, rtl::CStringEqual>
20 PresetGeometryHashMap;
22struct PresetGeometryName
25 const char* pFontworkType;
28const PresetGeometryName pPresetGeometryNameArray[]
29 = { {
"textNoShape",
"" },
30 {
"textPlain",
"fontwork-plain-text" },
31 {
"textStop",
"fontwork-stop" },
32 {
"textTriangle",
"fontwork-triangle-up" },
33 {
"textTriangleInverted",
"fontwork-triangle-down" },
34 {
"textChevron",
"fontwork-chevron-up" },
35 {
"textChevronInverted",
"fontwork-chevron-down" },
36 {
"textRingInside",
"mso-spt142" },
37 {
"textRingOutside",
"mso-spt143" },
38 {
"textArchUp",
"fontwork-arch-up-curve" },
39 {
"textArchDown",
"fontwork-arch-down-curve" },
40 {
"textCircle",
"fontwork-circle-curve" },
41 {
"textButton",
"fontwork-open-circle-curve" },
42 {
"textArchUpPour",
"fontwork-arch-up-pour" },
43 {
"textArchDownPour",
"fontwork-arch-down-pour" },
44 {
"textCirclePour",
"fontwork-circle-pour" },
45 {
"textButtonPour",
"fontwork-open-circle-pour" },
46 {
"textCurveUp",
"fontwork-curve-up" },
47 {
"textCurveDown",
"fontwork-curve-down" },
48 {
"textCanUp",
"mso-spt174" },
49 {
"textCanDown",
"mso-spt175" },
50 {
"textWave1",
"fontwork-wave" },
51 {
"textWave2",
"mso-spt157" },
52 {
"textDoubleWave1",
"mso-spt158" },
53 {
"textWave4",
"mso-spt159" },
54 {
"textInflate",
"fontwork-inflate" },
55 {
"textDeflate",
"mso-spt161" },
56 {
"textInflateBottom",
"mso-spt162" },
57 {
"textDeflateBottom",
"mso-spt163" },
58 {
"textInflateTop",
"mso-spt164" },
59 {
"textDeflateTop",
"mso-spt165" },
60 {
"textDeflateInflate",
"mso-spt166" },
61 {
"textDeflateInflateDeflate",
"mso-spt167" },
62 {
"textFadeRight",
"fontwork-fade-right" },
63 {
"textFadeLeft",
"fontwork-fade-left" },
64 {
"textFadeUp",
"fontwork-fade-up" },
65 {
"textFadeDown",
"fontwork-fade-down" },
66 {
"textSlantUp",
"fontwork-slant-up" },
67 {
"textSlantDown",
"fontwork-slant-down" },
68 {
"textCascadeUp",
"fontwork-fade-up-and-right" },
69 {
"textCascadeDown",
"fontwork-fade-up-and-left" } };
74 static const PresetGeometryHashMap s_HashMap = []() {
75 PresetGeometryHashMap aH;
76 for (
const auto& item : pPresetGeometryNameArray)
77 aH[item.pMsoName] = item.pFontworkType;
80 const char* pRetValue =
"";
81 size_t i, nLen = rMsoType.size();
82 std::unique_ptr<char[]> pBuf(
new char[nLen + 1]);
83 for (
i = 0;
i < nLen;
i++)
84 pBuf[
i] =
static_cast<char>(rMsoType[
i]);
86 PresetGeometryHashMap::const_iterator aHashIter(s_HashMap.find(pBuf.get()));
87 if (aHashIter != s_HashMap.end())
88 pRetValue = (*aHashIter).second;
90 return OUString(pRetValue, strlen(pRetValue), RTL_TEXTENCODING_ASCII_US);
95 static const PresetGeometryHashMap s_HashMapInv = []() {
96 PresetGeometryHashMap aHInv;
97 for (
const auto& item : pPresetGeometryNameArray)
98 aHInv[item.pFontworkType] = item.pMsoName;
101 const char* pRetValue =
"";
102 size_t i, nLen = rFontworkType.size();
103 std::unique_ptr<char[]> pBuf(
new char[nLen + 1]);
104 for (
i = 0;
i < nLen;
i++)
105 pBuf[
i] =
static_cast<char>(rFontworkType[
i]);
107 PresetGeometryHashMap::const_iterator aHashIter(s_HashMapInv.find(pBuf.get()));
108 if (aHashIter != s_HashMapInv.end())
109 pRetValue = (*aHashIter).second;
111 return OUString(pRetValue, strlen(pRetValue), RTL_TEXTENCODING_ASCII_US);
OUString GetMsoName(std::u16string_view rFontworkType)
OUString GetFontworkType(std::u16string_view rMsoType)