tdf#161412 - UI: fix warning in PDF password dialog didn't disappear
[LibreOffice.git] / svx / source / svdraw / presetooxhandleadjustmentrelations.cxx
blob592632dc7196e016ab35facbf47260702f6ec138
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 <sal/config.h>
12 #include <string_view>
14 #include <o3tl/string_view.hxx>
15 #include <rtl/ustring.hxx>
16 #include <unordered_map>
17 #include "presetooxhandleadjustmentrelations.hxx"
19 namespace
21 typedef std::unordered_map<OUString, OUString> HandleAdjRelHashMap;
23 struct HandleAdjRel
25 // Shape name without leading "ooxml-", underscore, zero based handle index
26 // e.g. The third handle in shape of type "ooxml-circularArrow" will be
27 // identified by key "circularArrow_2"
28 OUString sShape_Handle;
30 // 4 tokens with separator "|"
31 // first: RefX or RefR, na if not exists
32 // second: adj, or adj1 or adj2, etc. as in preset, na if not exists
33 // third: RefY or RefAngle, na if not exists
34 // forth: adj, or adj1 or adj2, etc. as in preset, na if not exists
35 // e.g. The third handle in shape <circularArrow> has in the preset
36 // the tag <ahPolar gdRefR="adj5" minR="0" maxR="25000"> .
37 // The resulting value in the map here is "RefR|adj5|na|na"
38 OUString sAdjReferences;
41 // The array initializer has been extracted from
42 // oox/source/drawingml/customshapes/presetShapeDefinitions.xml
43 // by using an XSLT file. That file is attached to tdf#126512.
44 constexpr HandleAdjRel aHandleAdjRelArray[]
45 = { { u"accentBorderCallout1_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
46 { u"accentBorderCallout1_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
47 { u"accentBorderCallout2_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
48 { u"accentBorderCallout2_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
49 { u"accentBorderCallout2_2"_ustr, u"RefX|adj6|RefY|adj5"_ustr },
50 { u"accentBorderCallout3_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
51 { u"accentBorderCallout3_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
52 { u"accentBorderCallout3_2"_ustr, u"RefX|adj6|RefY|adj5"_ustr },
53 { u"accentBorderCallout3_3"_ustr, u"RefX|adj8|RefY|adj7"_ustr },
54 { u"accentCallout1_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
55 { u"accentCallout1_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
56 { u"accentCallout2_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
57 { u"accentCallout2_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
58 { u"accentCallout2_2"_ustr, u"RefX|adj6|RefY|adj5"_ustr },
59 { u"accentCallout3_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
60 { u"accentCallout3_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
61 { u"accentCallout3_2"_ustr, u"RefX|adj6|RefY|adj5"_ustr },
62 { u"accentCallout3_3"_ustr, u"RefX|adj8|RefY|adj7"_ustr },
63 { u"arc_0"_ustr, u"na|na|RefAngle|adj1"_ustr },
64 { u"arc_1"_ustr, u"na|na|RefAngle|adj2"_ustr },
65 { u"bentArrow_0"_ustr, u"RefX|adj1|na|na"_ustr },
66 { u"bentArrow_1"_ustr, u"na|na|RefY|adj2"_ustr },
67 { u"bentArrow_2"_ustr, u"RefX|adj3|na|na"_ustr },
68 { u"bentArrow_3"_ustr, u"RefX|adj4|na|na"_ustr },
69 { u"bentConnector3_0"_ustr, u"RefX|adj1|na|na"_ustr },
70 { u"bentConnector4_0"_ustr, u"RefX|adj1|na|na"_ustr },
71 { u"bentConnector4_1"_ustr, u"na|na|RefY|adj2"_ustr },
72 { u"bentConnector5_0"_ustr, u"RefX|adj1|na|na"_ustr },
73 { u"bentConnector5_1"_ustr, u"na|na|RefY|adj2"_ustr },
74 { u"bentConnector5_2"_ustr, u"RefX|adj3|na|na"_ustr },
75 { u"bentUpArrow_0"_ustr, u"na|na|RefY|adj1"_ustr },
76 { u"bentUpArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
77 { u"bentUpArrow_2"_ustr, u"na|na|RefY|adj3"_ustr },
78 { u"bevel_0"_ustr, u"RefX|adj|na|na"_ustr },
79 { u"blockArc_0"_ustr, u"na|na|RefAngle|adj1"_ustr },
80 { u"blockArc_1"_ustr, u"RefR|adj3|RefAngle|adj2"_ustr },
81 { u"borderCallout1_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
82 { u"borderCallout1_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
83 { u"borderCallout2_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
84 { u"borderCallout2_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
85 { u"borderCallout2_2"_ustr, u"RefX|adj6|RefY|adj5"_ustr },
86 { u"borderCallout3_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
87 { u"borderCallout3_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
88 { u"borderCallout3_2"_ustr, u"RefX|adj6|RefY|adj5"_ustr },
89 { u"borderCallout3_3"_ustr, u"RefX|adj8|RefY|adj7"_ustr },
90 { u"bracePair_0"_ustr, u"na|na|RefY|adj"_ustr },
91 { u"bracketPair_0"_ustr, u"na|na|RefY|adj"_ustr },
92 { u"callout1_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
93 { u"callout1_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
94 { u"callout2_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
95 { u"callout2_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
96 { u"callout2_2"_ustr, u"RefX|adj6|RefY|adj5"_ustr },
97 { u"callout3_0"_ustr, u"RefX|adj2|RefY|adj1"_ustr },
98 { u"callout3_1"_ustr, u"RefX|adj4|RefY|adj3"_ustr },
99 { u"callout3_2"_ustr, u"RefX|adj6|RefY|adj5"_ustr },
100 { u"callout3_3"_ustr, u"RefX|adj8|RefY|adj7"_ustr },
101 { u"can_0"_ustr, u"na|na|RefY|adj"_ustr },
102 { u"chevron_0"_ustr, u"RefX|adj|na|na"_ustr },
103 { u"chord_0"_ustr, u"na|na|RefAngle|adj1"_ustr },
104 { u"chord_1"_ustr, u"na|na|RefAngle|adj2"_ustr },
105 { u"circularArrow_0"_ustr, u"na|na|RefAngle|adj2"_ustr },
106 { u"circularArrow_1"_ustr, u"na|na|RefAngle|adj4"_ustr },
107 { u"circularArrow_2"_ustr, u"RefR|adj1|RefAngle|adj3"_ustr },
108 { u"circularArrow_3"_ustr, u"RefR|adj5|na|na"_ustr },
109 { u"cloudCallout_0"_ustr, u"RefX|adj1|RefY|adj2"_ustr },
110 { u"corner_0"_ustr, u"na|na|RefY|adj1"_ustr },
111 { u"corner_1"_ustr, u"RefX|adj2|na|na"_ustr },
112 { u"cube_0"_ustr, u"na|na|RefY|adj"_ustr },
113 { u"curvedConnector3_0"_ustr, u"RefX|adj1|na|na"_ustr },
114 { u"curvedConnector4_0"_ustr, u"RefX|adj1|na|na"_ustr },
115 { u"curvedConnector4_1"_ustr, u"na|na|RefY|adj2"_ustr },
116 { u"curvedConnector5_0"_ustr, u"RefX|adj1|na|na"_ustr },
117 { u"curvedConnector5_1"_ustr, u"na|na|RefY|adj2"_ustr },
118 { u"curvedConnector5_2"_ustr, u"RefX|adj3|na|na"_ustr },
119 { u"curvedDownArrow_0"_ustr, u"RefX|adj1|na|na"_ustr },
120 { u"curvedDownArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
121 { u"curvedDownArrow_2"_ustr, u"na|na|RefY|adj3"_ustr },
122 { u"curvedLeftArrow_0"_ustr, u"na|na|RefY|adj1"_ustr },
123 { u"curvedLeftArrow_1"_ustr, u"na|na|RefY|adj2"_ustr },
124 { u"curvedLeftArrow_2"_ustr, u"RefX|adj3|na|na"_ustr },
125 { u"curvedRightArrow_0"_ustr, u"na|na|RefY|adj1"_ustr },
126 { u"curvedRightArrow_1"_ustr, u"na|na|RefY|adj2"_ustr },
127 { u"curvedRightArrow_2"_ustr, u"RefX|adj3|na|na"_ustr },
128 { u"curvedUpArrow_0"_ustr, u"RefX|adj1|na|na"_ustr },
129 { u"curvedUpArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
130 { u"curvedUpArrow_2"_ustr, u"na|na|RefY|adj3"_ustr },
131 { u"diagStripe_0"_ustr, u"na|na|RefY|adj"_ustr },
132 { u"donut_0"_ustr, u"RefR|adj|na|na"_ustr },
133 { u"doubleWave_0"_ustr, u"na|na|RefY|adj1"_ustr },
134 { u"doubleWave_1"_ustr, u"RefX|adj2|na|na"_ustr },
135 { u"downArrow_0"_ustr, u"RefX|adj1|na|na"_ustr },
136 { u"downArrow_1"_ustr, u"na|na|RefY|adj2"_ustr },
137 { u"downArrowCallout_0"_ustr, u"RefX|adj1|na|na"_ustr },
138 { u"downArrowCallout_1"_ustr, u"RefX|adj2|na|na"_ustr },
139 { u"downArrowCallout_2"_ustr, u"na|na|RefY|adj3"_ustr },
140 { u"downArrowCallout_3"_ustr, u"na|na|RefY|adj4"_ustr },
141 { u"ellipseRibbon_0"_ustr, u"na|na|RefY|adj1"_ustr },
142 { u"ellipseRibbon_1"_ustr, u"RefX|adj2|na|na"_ustr },
143 { u"ellipseRibbon_2"_ustr, u"na|na|RefY|adj3"_ustr },
144 { u"ellipseRibbon2_0"_ustr, u"na|na|RefY|adj1"_ustr },
145 { u"ellipseRibbon2_1"_ustr, u"RefX|adj2|na|na"_ustr },
146 { u"ellipseRibbon2_2"_ustr, u"na|na|RefY|adj3"_ustr },
147 { u"foldedCorner_0"_ustr, u"RefX|adj|na|na"_ustr },
148 { u"frame_0"_ustr, u"RefX|adj1|na|na"_ustr },
149 { u"gear6_0"_ustr, u"na|na|RefY|adj1"_ustr },
150 { u"gear6_1"_ustr, u"RefX|adj2|na|na"_ustr },
151 { u"gear9_0"_ustr, u"na|na|RefY|adj1"_ustr },
152 { u"gear9_1"_ustr, u"RefX|adj2|na|na"_ustr },
153 { u"halfFrame_0"_ustr, u"na|na|RefY|adj1"_ustr },
154 { u"halfFrame_1"_ustr, u"RefX|adj2|na|na"_ustr },
155 { u"hexagon_0"_ustr, u"RefX|adj|na|na"_ustr },
156 { u"homePlate_0"_ustr, u"RefX|adj|na|na"_ustr },
157 { u"horizontalScroll_0"_ustr, u"RefX|adj|na|na"_ustr },
158 { u"leftArrow_0"_ustr, u"na|na|RefY|adj1"_ustr },
159 { u"leftArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
160 { u"leftArrowCallout_0"_ustr, u"na|na|RefY|adj1"_ustr },
161 { u"leftArrowCallout_1"_ustr, u"na|na|RefY|adj2"_ustr },
162 { u"leftArrowCallout_2"_ustr, u"RefX|adj3|na|na"_ustr },
163 { u"leftArrowCallout_3"_ustr, u"RefX|adj4|na|na"_ustr },
164 { u"leftBrace_0"_ustr, u"na|na|RefY|adj1"_ustr },
165 { u"leftBrace_1"_ustr, u"na|na|RefY|adj2"_ustr },
166 { u"leftBracket_0"_ustr, u"na|na|RefY|adj"_ustr },
167 { u"leftCircularArrow_0"_ustr, u"na|na|RefAngle|adj2"_ustr },
168 { u"leftCircularArrow_1"_ustr, u"na|na|RefAngle|adj4"_ustr },
169 { u"leftCircularArrow_2"_ustr, u"RefR|adj1|RefAngle|adj3"_ustr },
170 { u"leftCircularArrow_3"_ustr, u"RefR|adj5|na|na"_ustr },
171 { u"leftRightArrow_0"_ustr, u"na|na|RefY|adj1"_ustr },
172 { u"leftRightArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
173 { u"leftRightArrowCallout_0"_ustr, u"na|na|RefY|adj1"_ustr },
174 { u"leftRightArrowCallout_1"_ustr, u"na|na|RefY|adj2"_ustr },
175 { u"leftRightArrowCallout_2"_ustr, u"RefX|adj3|na|na"_ustr },
176 { u"leftRightArrowCallout_3"_ustr, u"RefX|adj4|na|na"_ustr },
177 { u"leftRightCircularArrow_0"_ustr, u"na|na|RefAngle|adj2"_ustr },
178 { u"leftRightCircularArrow_1"_ustr, u"na|na|RefAngle|adj4"_ustr },
179 { u"leftRightCircularArrow_2"_ustr, u"RefR|adj1|RefAngle|adj3"_ustr },
180 { u"leftRightCircularArrow_3"_ustr, u"RefR|adj5|na|na"_ustr },
181 { u"leftRightRibbon_0"_ustr, u"na|na|RefY|adj1"_ustr },
182 { u"leftRightRibbon_1"_ustr, u"RefX|adj2|na|na"_ustr },
183 { u"leftRightRibbon_2"_ustr, u"na|na|RefY|adj3"_ustr },
184 { u"leftRightUpArrow_0"_ustr, u"RefX|adj1|na|na"_ustr },
185 { u"leftRightUpArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
186 { u"leftRightUpArrow_2"_ustr, u"na|na|RefY|adj3"_ustr },
187 { u"leftUpArrow_0"_ustr, u"na|na|RefY|adj1"_ustr },
188 { u"leftUpArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
189 { u"leftUpArrow_2"_ustr, u"na|na|RefY|adj3"_ustr },
190 { u"mathDivide_0"_ustr, u"na|na|RefY|adj1"_ustr },
191 { u"mathDivide_1"_ustr, u"na|na|RefY|adj2"_ustr },
192 { u"mathDivide_2"_ustr, u"RefX|adj3|na|na"_ustr },
193 { u"mathEqual_0"_ustr, u"na|na|RefY|adj1"_ustr },
194 { u"mathEqual_1"_ustr, u"na|na|RefY|adj2"_ustr },
195 { u"mathMinus_0"_ustr, u"na|na|RefY|adj1"_ustr },
196 { u"mathMultiply_0"_ustr, u"na|na|RefY|adj1"_ustr },
197 { u"mathNotEqual_0"_ustr, u"na|na|RefY|adj1"_ustr },
198 { u"mathNotEqual_1"_ustr, u"na|na|RefAngle|adj2"_ustr },
199 { u"mathNotEqual_2"_ustr, u"na|na|RefY|adj3"_ustr },
200 { u"mathPlus_0"_ustr, u"na|na|RefY|adj1"_ustr },
201 { u"moon_0"_ustr, u"RefX|adj|na|na"_ustr },
202 { u"nonIsoscelesTrapezoid_0"_ustr, u"RefX|adj1|na|na"_ustr },
203 { u"nonIsoscelesTrapezoid_1"_ustr, u"RefX|adj2|na|na"_ustr },
204 { u"noSmoking_0"_ustr, u"RefR|adj|na|na"_ustr },
205 { u"notchedRightArrow_0"_ustr, u"na|na|RefY|adj1"_ustr },
206 { u"notchedRightArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
207 { u"octagon_0"_ustr, u"RefX|adj|na|na"_ustr },
208 { u"parallelogram_0"_ustr, u"RefX|adj|na|na"_ustr },
209 { u"pie_0"_ustr, u"na|na|RefAngle|adj1"_ustr },
210 { u"pie_1"_ustr, u"na|na|RefAngle|adj2"_ustr },
211 { u"plaque_0"_ustr, u"RefX|adj|na|na"_ustr },
212 { u"plus_0"_ustr, u"RefX|adj|na|na"_ustr },
213 { u"quadArrow_0"_ustr, u"RefX|adj1|na|na"_ustr },
214 { u"quadArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
215 { u"quadArrow_2"_ustr, u"na|na|RefY|adj3"_ustr },
216 { u"quadArrowCallout_0"_ustr, u"RefX|adj1|na|na"_ustr },
217 { u"quadArrowCallout_1"_ustr, u"RefX|adj2|na|na"_ustr },
218 { u"quadArrowCallout_2"_ustr, u"na|na|RefY|adj3"_ustr },
219 { u"quadArrowCallout_3"_ustr, u"na|na|RefY|adj4"_ustr },
220 { u"ribbon_0"_ustr, u"na|na|RefY|adj1"_ustr },
221 { u"ribbon_1"_ustr, u"RefX|adj2|na|na"_ustr },
222 { u"ribbon2_0"_ustr, u"na|na|RefY|adj1"_ustr },
223 { u"ribbon2_1"_ustr, u"RefX|adj2|na|na"_ustr },
224 { u"rightArrow_0"_ustr, u"na|na|RefY|adj1"_ustr },
225 { u"rightArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
226 { u"rightArrowCallout_0"_ustr, u"na|na|RefY|adj1"_ustr },
227 { u"rightArrowCallout_1"_ustr, u"na|na|RefY|adj2"_ustr },
228 { u"rightArrowCallout_2"_ustr, u"RefX|adj3|na|na"_ustr },
229 { u"rightArrowCallout_3"_ustr, u"RefX|adj4|na|na"_ustr },
230 { u"rightBrace_0"_ustr, u"na|na|RefY|adj1"_ustr },
231 { u"rightBrace_1"_ustr, u"na|na|RefY|adj2"_ustr },
232 { u"rightBracket_0"_ustr, u"na|na|RefY|adj"_ustr },
233 { u"round1Rect_0"_ustr, u"RefX|adj|na|na"_ustr },
234 { u"round2DiagRect_0"_ustr, u"RefX|adj1|na|na"_ustr },
235 { u"round2DiagRect_1"_ustr, u"RefX|adj2|na|na"_ustr },
236 { u"round2SameRect_0"_ustr, u"RefX|adj1|na|na"_ustr },
237 { u"round2SameRect_1"_ustr, u"RefX|adj2|na|na"_ustr },
238 { u"roundRect_0"_ustr, u"RefX|adj|na|na"_ustr },
239 { u"smileyFace_0"_ustr, u"na|na|RefY|adj"_ustr },
240 { u"snip1Rect_0"_ustr, u"RefX|adj|na|na"_ustr },
241 { u"snip2DiagRect_0"_ustr, u"RefX|adj1|na|na"_ustr },
242 { u"snip2DiagRect_1"_ustr, u"RefX|adj2|na|na"_ustr },
243 { u"snip2SameRect_0"_ustr, u"RefX|adj1|na|na"_ustr },
244 { u"snip2SameRect_1"_ustr, u"RefX|adj2|na|na"_ustr },
245 { u"snipRoundRect_0"_ustr, u"RefX|adj1|na|na"_ustr },
246 { u"snipRoundRect_1"_ustr, u"RefX|adj2|na|na"_ustr },
247 { u"star10_0"_ustr, u"na|na|RefY|adj"_ustr },
248 { u"star12_0"_ustr, u"na|na|RefY|adj"_ustr },
249 { u"star16_0"_ustr, u"na|na|RefY|adj"_ustr },
250 { u"star24_0"_ustr, u"na|na|RefY|adj"_ustr },
251 { u"star32_0"_ustr, u"na|na|RefY|adj"_ustr },
252 { u"star4_0"_ustr, u"na|na|RefY|adj"_ustr },
253 { u"star5_0"_ustr, u"na|na|RefY|adj"_ustr },
254 { u"star6_0"_ustr, u"na|na|RefY|adj"_ustr },
255 { u"star7_0"_ustr, u"na|na|RefY|adj"_ustr },
256 { u"star8_0"_ustr, u"na|na|RefY|adj"_ustr },
257 { u"stripedRightArrow_0"_ustr, u"na|na|RefY|adj1"_ustr },
258 { u"stripedRightArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
259 { u"sun_0"_ustr, u"RefX|adj|na|na"_ustr },
260 { u"swooshArrow_0"_ustr, u"na|na|RefY|adj1"_ustr },
261 { u"swooshArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
262 { u"teardrop_0"_ustr, u"RefX|adj|na|na"_ustr },
263 { u"trapezoid_0"_ustr, u"RefX|adj|na|na"_ustr },
264 { u"triangle_0"_ustr, u"RefX|adj|na|na"_ustr },
265 { u"upArrowCallout_0"_ustr, u"RefX|adj1|na|na"_ustr },
266 { u"upArrowCallout_1"_ustr, u"RefX|adj2|na|na"_ustr },
267 { u"upArrowCallout_2"_ustr, u"na|na|RefY|adj3"_ustr },
268 { u"upArrowCallout_3"_ustr, u"na|na|RefY|adj4"_ustr },
269 { u"upDownArrow_0"_ustr, u"RefX|adj1|na|na"_ustr },
270 { u"upDownArrow_1"_ustr, u"na|na|RefY|adj2"_ustr },
271 { u"upArrow_0"_ustr, u"RefX|adj1|na|na"_ustr },
272 { u"upArrow_1"_ustr, u"na|na|RefY|adj2"_ustr },
273 { u"upDownArrowCallout_0"_ustr, u"RefX|adj1|na|na"_ustr },
274 { u"upDownArrowCallout_1"_ustr, u"RefX|adj2|na|na"_ustr },
275 { u"upDownArrowCallout_2"_ustr, u"na|na|RefY|adj3"_ustr },
276 { u"upDownArrowCallout_3"_ustr, u"na|na|RefY|adj4"_ustr },
277 { u"uturnArrow_0"_ustr, u"RefX|adj1|na|na"_ustr },
278 { u"uturnArrow_1"_ustr, u"RefX|adj2|na|na"_ustr },
279 { u"uturnArrow_2"_ustr, u"na|na|RefY|adj3"_ustr },
280 { u"uturnArrow_3"_ustr, u"RefX|adj4|na|na"_ustr },
281 { u"uturnArrow_4"_ustr, u"na|na|RefY|adj5"_ustr },
282 { u"verticalScroll_0"_ustr, u"na|na|RefY|adj"_ustr },
283 { u"wave_0"_ustr, u"na|na|RefY|adj1"_ustr },
284 { u"wave_1"_ustr, u"RefX|adj2|na|na"_ustr },
285 { u"wedgeEllipseCallout_0"_ustr, u"RefX|adj1|RefY|adj2"_ustr },
286 { u"wedgeRectCallout_0"_ustr, u"RefX|adj1|RefY|adj2"_ustr },
287 { u"wedgeRoundRectCallout_0"_ustr, u"RefX|adj1|RefY|adj2"_ustr } };
290 static sal_Int32 lcl_getAdjIndexFromToken(const sal_Int32 nTokenPos, std::u16string_view rMapValue)
292 std::u16string_view sAdjRef = o3tl::getToken(rMapValue, nTokenPos, '|');
293 std::u16string_view sNumber; // number part from "adj1", "adj2" etc.
294 if (o3tl::starts_with(sAdjRef, u"adj", &sNumber))
296 if (sNumber.empty() || sNumber == u"1")
297 return 0;
298 else
299 return o3tl::toInt32(sNumber) - 1;
301 else
302 return -1;
305 void PresetOOXHandleAdj::GetOOXHandleAdjRelation(
306 std::u16string_view sFullOOXShapeName, const sal_Int32 nHandleIndex, OUString& rFirstRefType,
307 sal_Int32& rFirstAdjValueIndex, OUString& rSecondRefType, sal_Int32& rSecondAdjValueIndex)
309 static const HandleAdjRelHashMap s_HashMap = []() {
310 HandleAdjRelHashMap aH;
311 aH.reserve(std::size(aHandleAdjRelArray));
312 for (const auto& item : aHandleAdjRelArray)
313 aH.emplace(item.sShape_Handle, item.sAdjReferences);
314 return aH;
315 }();
317 std::u16string_view sKey;
318 OUString sValue;
319 rFirstRefType = "na";
320 rFirstAdjValueIndex = -1;
321 rSecondRefType = "na";
322 rSecondAdjValueIndex = -1;
323 if (o3tl::starts_with(sFullOOXShapeName, u"ooxml-", &sKey))
325 HandleAdjRelHashMap::const_iterator aHashIter(
326 s_HashMap.find(OUString::Concat(sKey) + "_" + OUString::number(nHandleIndex)));
327 if (aHashIter != s_HashMap.end())
328 sValue = (*aHashIter).second;
329 else
330 return;
332 else
333 return;
335 rFirstRefType = sValue.getToken(0, '|');
336 rFirstAdjValueIndex = lcl_getAdjIndexFromToken(1, sValue);
337 rSecondRefType = sValue.getToken(2, '|');
338 rSecondAdjValueIndex = lcl_getAdjIndexFromToken(3, sValue);
339 return;
342 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */