LibreOffice Module svx (master)  1
EnhancedCustomShapeTypeNames.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 
21 #include <osl/mutex.hxx>
22 #include <unordered_map>
23 #include <memory>
24 
25 typedef std::unordered_map< const char*, MSO_SPT, rtl::CStringHash, rtl::CStringEqual> TypeNameHashMap;
26 
27 static TypeNameHashMap* pHashMap = nullptr;
28 static ::osl::Mutex& getHashMapMutex()
29 {
30  static osl::Mutex s_aHashMapProtection;
31  return s_aHashMapProtection;
32 }
33 
34 namespace {
35 
36 struct NameTypeTable
37 {
38  const char* pS;
39  MSO_SPT pE;
40 };
41 
42 }
43 
44 static const NameTypeTable pNameTypeTableArray[] =
45 {
46  { "non-primitive", mso_sptMin },
47  { "rectangle", mso_sptRectangle },
48  { "round-rectangle", mso_sptRoundRectangle },
49  { "ellipse", mso_sptEllipse },
50  { "diamond", mso_sptDiamond },
51  { "isosceles-triangle", mso_sptIsocelesTriangle },
52  { "right-triangle", mso_sptRightTriangle },
53  { "parallelogram", mso_sptParallelogram },
54  { "trapezoid", mso_sptTrapezoid },
55  { "hexagon", mso_sptHexagon },
56  { "octagon", mso_sptOctagon },
57  { "cross", mso_sptPlus },
58  { "star5", mso_sptStar },
59  { "right-arrow", mso_sptArrow },
60  { "mso-spt14", mso_sptThickArrow },
61  { "pentagon-right", mso_sptHomePlate },
62  { "cube", mso_sptCube },
63  { "mso-spt17", mso_sptBalloon },
64  { "mso-spt18", mso_sptSeal },
65  { "mso-spt19", mso_sptArc },
66  { "mso-spt20", mso_sptLine },
67  { "mso-spt21", mso_sptPlaque },
68  { "can", mso_sptCan },
69  { "ring", mso_sptDonut },
70  { "mso-spt24", mso_sptTextSimple },
71  { "mso-spt25", mso_sptTextOctagon },
72  { "mso-spt26", mso_sptTextHexagon },
73  { "mso-spt27", mso_sptTextCurve },
74  { "mso-spt28", mso_sptTextWave },
75  { "mso-spt29", mso_sptTextRing },
76  { "mso-spt30", mso_sptTextOnCurve },
77  { "mso-spt31", mso_sptTextOnRing },
78  { "mso-spt32", mso_sptStraightConnector1 },
79  { "mso-spt33", mso_sptBentConnector2 },
80  { "mso-spt34", mso_sptBentConnector3 },
81  { "mso-spt35", mso_sptBentConnector4 },
82  { "mso-spt36", mso_sptBentConnector5 },
83  { "mso-spt37", mso_sptCurvedConnector2 },
84  { "mso-spt38", mso_sptCurvedConnector3 },
85  { "mso-spt39", mso_sptCurvedConnector4 },
86  { "mso-spt40", mso_sptCurvedConnector5 },
87  { "mso-spt41", mso_sptCallout1 },
88  { "mso-spt42", mso_sptCallout2 },
89  { "mso-spt43", mso_sptCallout3 },
90  { "mso-spt44", mso_sptAccentCallout1 },
91  { "mso-spt45", mso_sptAccentCallout2 },
92  { "mso-spt46", mso_sptAccentCallout3 },
93  { "line-callout-1", mso_sptBorderCallout1 },
94  { "line-callout-2", mso_sptBorderCallout2 },
95  { "mso-spt49", mso_sptBorderCallout3 },
96  { "mso-spt50", mso_sptAccentBorderCallout1 },
97  { "mso-spt51", mso_sptAccentBorderCallout2 },
98  { "mso-spt52", mso_sptAccentBorderCallout3 },
99  { "mso-spt53", mso_sptRibbon },
100  { "mso-spt54", mso_sptRibbon2 },
101  { "chevron", mso_sptChevron },
102  { "pentagon", mso_sptPentagon },
103  { "forbidden", mso_sptNoSmoking },
104  { "star8", mso_sptSeal8 },
105  { "mso-spt59", mso_sptSeal16 },
106  { "mso-spt60", mso_sptSeal32 },
107  { "rectangular-callout", mso_sptWedgeRectCallout },
108  { "round-rectangular-callout", mso_sptWedgeRRectCallout },
109  { "round-callout", mso_sptWedgeEllipseCallout },
110  { "mso-spt64", mso_sptWave },
111  { "paper", mso_sptFoldedCorner },
112  { "left-arrow", mso_sptLeftArrow },
113  { "down-arrow", mso_sptDownArrow },
114  { "up-arrow", mso_sptUpArrow },
115  { "left-right-arrow", mso_sptLeftRightArrow },
116  { "up-down-arrow", mso_sptUpDownArrow },
117  { "mso-spt71", mso_sptIrregularSeal1 },
118  { "bang", mso_sptIrregularSeal2 },
119  { "lightning", mso_sptLightningBolt },
120  { "heart", mso_sptHeart },
121  { "mso-spt75", mso_sptPictureFrame },
122  { "quad-arrow", mso_sptQuadArrow },
123  { "left-arrow-callout", mso_sptLeftArrowCallout },
124  { "right-arrow-callout", mso_sptRightArrowCallout },
125  { "up-arrow-callout", mso_sptUpArrowCallout },
126  { "down-arrow-callout", mso_sptDownArrowCallout },
127  { "left-right-arrow-callout", mso_sptLeftRightArrowCallout },
128  { "up-down-arrow-callout", mso_sptUpDownArrowCallout },
129  { "quad-arrow-callout", mso_sptQuadArrowCallout },
130  { "quad-bevel", mso_sptBevel },
131  { "left-bracket", mso_sptLeftBracket },
132  { "right-bracket", mso_sptRightBracket },
133  { "left-brace", mso_sptLeftBrace },
134  { "right-brace", mso_sptRightBrace },
135  { "mso-spt89", mso_sptLeftUpArrow },
136  { "mso-spt90", mso_sptBentUpArrow },
137  { "mso-spt91", mso_sptBentArrow },
138  { "star24", mso_sptSeal24 },
139  { "striped-right-arrow", mso_sptStripedRightArrow },
140  { "notched-right-arrow", mso_sptNotchedRightArrow },
141  { "block-arc", mso_sptBlockArc },
142  { "smiley", mso_sptSmileyFace },
143  { "vertical-scroll", mso_sptVerticalScroll },
144  { "horizontal-scroll", mso_sptHorizontalScroll },
145  { "circular-arrow", mso_sptCircularArrow },
146  { "mso-spt100", mso_sptNotchedCircularArrow },
147  { "mso-spt101", mso_sptUturnArrow },
148  { "mso-spt102", mso_sptCurvedRightArrow },
149  { "mso-spt103", mso_sptCurvedLeftArrow },
150  { "mso-spt104", mso_sptCurvedUpArrow },
151  { "mso-spt105", mso_sptCurvedDownArrow },
152  { "cloud-callout", mso_sptCloudCallout },
153  { "mso-spt107", mso_sptEllipseRibbon },
154  { "mso-spt108", mso_sptEllipseRibbon2 },
155  { "flowchart-process", mso_sptFlowChartProcess },
156  { "flowchart-decision", mso_sptFlowChartDecision },
157  { "flowchart-data", mso_sptFlowChartInputOutput },
158  { "flowchart-predefined-process", mso_sptFlowChartPredefinedProcess },
159  { "flowchart-internal-storage", mso_sptFlowChartInternalStorage },
160  { "flowchart-document", mso_sptFlowChartDocument },
161  { "flowchart-multidocument", mso_sptFlowChartMultidocument },
162  { "flowchart-terminator", mso_sptFlowChartTerminator },
163  { "flowchart-preparation", mso_sptFlowChartPreparation },
164  { "flowchart-manual-input", mso_sptFlowChartManualInput },
165  { "flowchart-manual-operation", mso_sptFlowChartManualOperation },
166  { "flowchart-connector", mso_sptFlowChartConnector },
167  { "flowchart-card", mso_sptFlowChartPunchedCard },
168  { "flowchart-punched-tape", mso_sptFlowChartPunchedTape },
169  { "flowchart-summing-junction", mso_sptFlowChartSummingJunction },
170  { "flowchart-or", mso_sptFlowChartOr },
171  { "flowchart-collate", mso_sptFlowChartCollate },
172  { "flowchart-sort", mso_sptFlowChartSort },
173  { "flowchart-extract", mso_sptFlowChartExtract },
174  { "flowchart-merge", mso_sptFlowChartMerge },
175  { "mso-spt129", mso_sptFlowChartOfflineStorage },
176  { "flowchart-stored-data", mso_sptFlowChartOnlineStorage },
177  { "flowchart-sequential-access", mso_sptFlowChartMagneticTape },
178  { "flowchart-magnetic-disk", mso_sptFlowChartMagneticDisk },
179  { "flowchart-direct-access-storage", mso_sptFlowChartMagneticDrum },
180  { "flowchart-display", mso_sptFlowChartDisplay },
181  { "flowchart-delay", mso_sptFlowChartDelay },
182  { "fontwork-plain-text", mso_sptTextPlainText },
183  { "fontwork-stop", mso_sptTextStop },
184  { "fontwork-triangle-up", mso_sptTextTriangle },
185  { "fontwork-triangle-down", mso_sptTextTriangleInverted },
186  { "fontwork-chevron-up", mso_sptTextChevron },
187  { "fontwork-chevron-down", mso_sptTextChevronInverted },
188  { "mso-spt142", mso_sptTextRingInside },
189  { "mso-spt143", mso_sptTextRingOutside },
190  { "fontwork-arch-up-curve", mso_sptTextArchUpCurve },
191  { "fontwork-arch-down-curve", mso_sptTextArchDownCurve },
192  { "fontwork-circle-curve", mso_sptTextCircleCurve },
193  { "fontwork-open-circle-curve", mso_sptTextButtonCurve },
194  { "fontwork-arch-up-pour", mso_sptTextArchUpPour },
195  { "fontwork-arch-down-pour", mso_sptTextArchDownPour },
196  { "fontwork-circle-pour", mso_sptTextCirclePour },
197  { "fontwork-open-circle-pour", mso_sptTextButtonPour },
198  { "fontwork-curve-up", mso_sptTextCurveUp },
199  { "fontwork-curve-down", mso_sptTextCurveDown },
200  { "fontwork-fade-up-and-right", mso_sptTextCascadeUp },
201  { "fontwork-fade-up-and-left", mso_sptTextCascadeDown },
202  { "fontwork-wave", mso_sptTextWave1 },
203  { "mso-spt157", mso_sptTextWave2 },
204  { "mso-spt158", mso_sptTextWave3 },
205  { "mso-spt159", mso_sptTextWave4 },
206  { "fontwork-inflate", mso_sptTextInflate },
207  { "mso-spt161", mso_sptTextDeflate },
208  { "mso-spt162", mso_sptTextInflateBottom },
209  { "mso-spt163", mso_sptTextDeflateBottom },
210  { "mso-spt164", mso_sptTextInflateTop },
211  { "mso-spt165", mso_sptTextDeflateTop },
212  { "mso-spt166", mso_sptTextDeflateInflate },
213  { "mso-spt167", mso_sptTextDeflateInflateDeflate },
214  { "fontwork-fade-right", mso_sptTextFadeRight },
215  { "fontwork-fade-left", mso_sptTextFadeLeft },
216  { "fontwork-fade-up", mso_sptTextFadeUp },
217  { "fontwork-fade-down", mso_sptTextFadeDown },
218  { "fontwork-slant-up", mso_sptTextSlantUp },
219  { "fontwork-slant-down", mso_sptTextSlantDown },
220  { "mso-spt174", mso_sptTextCanUp },
221  { "mso-spt175", mso_sptTextCanDown },
222  { "flowchart-alternate-process", mso_sptFlowChartAlternateProcess },
223  { "flowchart-off-page-connector", mso_sptFlowChartOffpageConnector },
224  { "mso-spt178", mso_sptCallout90 },
225  { "mso-spt179", mso_sptAccentCallout90 },
226  { "mso-spt180", mso_sptBorderCallout90 },
227  { "line-callout-3", mso_sptAccentBorderCallout90 },
228  { "mso-spt182", mso_sptLeftRightUpArrow },
229  { "sun", mso_sptSun },
230  { "moon", mso_sptMoon },
231  { "bracket-pair", mso_sptBracketPair },
232  { "brace-pair", mso_sptBracePair },
233  { "star4", mso_sptSeal4 },
234  { "mso-spt188", mso_sptDoubleWave },
235  { "mso-spt189", mso_sptActionButtonBlank },
236  { "mso-spt190", mso_sptActionButtonHome },
237  { "mso-spt191", mso_sptActionButtonHelp },
238  { "mso-spt192", mso_sptActionButtonInformation },
239  { "mso-spt193", mso_sptActionButtonForwardNext },
240  { "mso-spt194", mso_sptActionButtonBackPrevious },
241  { "mso-spt195", mso_sptActionButtonEnd },
242  { "mso-spt196", mso_sptActionButtonBeginning },
243  { "mso-spt197", mso_sptActionButtonReturn },
244  { "mso-spt198", mso_sptActionButtonDocument },
245  { "mso-spt199", mso_sptActionButtonSound },
246  { "mso-spt200", mso_sptActionButtonMovie },
247  { "mso-spt201", mso_sptHostControl },
248  { "mso-spt202", mso_sptTextBox },
249  { "teardrop", mso_sptTearDrop },
250  { "ooxml-rect", mso_sptRectangle }
251 };
252 
253  // gallery: quadrat
254  // gallery: round-quadrat
255  // gallery: circle
256  // gallery: circle-pie
257  // gallery: frame
258  // gallery: flower
259  // gallery: cloud
260  // gallery: puzzle
261  // gallery: octagon-bevel
262  // gallery: diamond-bevel
263  // gallery: up-right-arrow
264  // gallery: up-right-down-arrow
265  // gallery: corner-right-arrow
266  // gallery: split-arrow
267  // gallery: up-right-arrow-callout
268  // gallery: split-round-arrow
269  // gallery: s-sharped-arrow
270  // Gallery: star6
271  // Gallery: star12
272  // Gallery: concave-star6
273  // Gallery: signet
274  // Gallery: doorplate
275  // gallery: fontwork-arch-left-curve
276  // gallery: fontwork-arch-right-curve
277  // gallery: fontwork-arch-left-pour
278  // gallery: fontwork-arch-right-pour
279 
280 MSO_SPT EnhancedCustomShapeTypeNames::Get( const OUString& rShapeType )
281 {
282  if ( !pHashMap )
283  { // init hash map
284  ::osl::MutexGuard aGuard( getHashMapMutex() );
285  if ( !pHashMap )
286  {
288  const NameTypeTable* pPtr = pNameTypeTableArray;
289  const NameTypeTable* pEnd = pPtr + SAL_N_ELEMENTS( pNameTypeTableArray );
290  for ( ; pPtr < pEnd; pPtr++ )
291  (*pH)[ pPtr->pS ] = pPtr->pE;
292  pHashMap = pH;
293  }
294  }
295  MSO_SPT eRetValue = mso_sptNil;
296  int i, nLen = rShapeType.getLength();
297  std::unique_ptr<char[]> pBuf(new char[ nLen + 1 ]);
298  for ( i = 0; i < nLen; i++ )
299  pBuf[ i ] = static_cast<char>(rShapeType[ i ]);
300  pBuf[ i ] = 0;
301  TypeNameHashMap::const_iterator aHashIter( pHashMap->find( pBuf.get() ) );
302  if ( aHashIter != pHashMap->end() )
303  eRetValue = (*aHashIter).second;
304  return eRetValue;
305 }
306 
307 OUString EnhancedCustomShapeTypeNames::Get( const MSO_SPT eShapeType )
308 {
309  return (eShapeType <= mso_sptTextBox && eShapeType >= mso_sptMin)
310  ? OUString::createFromAscii( pNameTypeTableArray[ eShapeType ].pS )
311  : OUString();
312 }
313 
314 typedef std::unordered_map< const char*, const char*, rtl::CStringHash, rtl::CStringEqual> TypeACCNameHashMap;
315 
316 static TypeACCNameHashMap* pACCHashMap = nullptr;
317 
318 namespace {
319 
320 struct ACCNameTypeTable
321 {
322  const char* pS;
323  const char* pE;
324 };
325 
326 }
327 
328 static const ACCNameTypeTable pACCNameTypeTableArray[] =
329 {
330  { "non-primitive", "Non Primitive Shape" },
331  { "rectangle", "Rectangle" },
332  { "round-rectangle", "Rounded Rectangle" },
333  { "ellipse", "Ellipse" },
334  { "diamond", "Diamond" },
335  { "isosceles-triangle", "Triangle" },
336  { "right-triangle", "Right Triangle" },
337  { "parallelogram", "Parallelogram" },
338  { "trapezoid", "Trapezoid" },
339  { "hexagon", "Hexagon" },
340  { "octagon", "Octagon" },
341  { "cross", "Cross" },
342  { "star5", "5-Point Star" },
343  { "right-arrow", "Right Arrow" },
344  //{ "mso-spt14", mso_sptThickArrow },
345  { "pentagon-right", "Pentagon" },
346  { "cube", "Cube" },
347  { "mso-spt21", "Doorplate" },
348  /*{ "mso-spt17", mso_sptBalloon },
349  { "mso-spt18", mso_sptSeal },
350  { "mso-spt19", mso_sptArc },
351  { "mso-spt20", mso_sptLine },
352  { "mso-spt21", mso_sptPlaque },
353  { "can", mso_sptCan },*/
354  { "ring", "Ring" },
355  /*{ "mso-spt24", mso_sptTextSimple },
356  { "mso-spt25", mso_sptTextOctagon },
357  { "mso-spt26", mso_sptTextHexagon },
358  { "mso-spt27", mso_sptTextCurve },
359  { "mso-spt28", mso_sptTextWave },
360  { "mso-spt29", mso_sptTextRing },
361  { "mso-spt30", mso_sptTextOnCurve },
362  { "mso-spt31", mso_sptTextOnRing },
363  { "mso-spt32", mso_sptStraightConnector1 },
364  { "mso-spt33", mso_sptBentConnector2 },
365  { "mso-spt34", mso_sptBentConnector3 },
366  { "mso-spt35", mso_sptBentConnector4 },
367  { "mso-spt36", mso_sptBentConnector5 },
368  { "mso-spt37", mso_sptCurvedConnector2 },
369  { "mso-spt38", mso_sptCurvedConnector3 },
370  { "mso-spt39", mso_sptCurvedConnector4 },
371  { "mso-spt40", mso_sptCurvedConnector5 },
372  { "mso-spt41", mso_sptCallout1 },
373  { "mso-spt42", mso_sptCallout2 },
374  { "mso-spt43", mso_sptCallout3 },
375  { "mso-spt44", mso_sptAccentCallout1 },
376  { "mso-spt45", mso_sptAccentCallout2 },
377  { "mso-spt46", mso_sptAccentCallout3 },*/
378  { "line-callout-1", "Line Callout 1" },
379  { "line-callout-2", "Line Callout 2" },
380  /*{ "mso-spt49", mso_sptBorderCallout3 },
381  { "mso-spt50", mso_sptAccentBorderCallout1 },
382  { "mso-spt51", mso_sptAccentBorderCallout2 },
383  { "mso-spt52", mso_sptAccentBorderCallout3 },
384  { "mso-spt53", mso_sptRibbon },
385  { "mso-spt54", mso_sptRibbon2 },*/
386  { "chevron", "Chevron" },
387  { "pentagon", "Regular Pentagon" },
388  { "forbidden", "'No' Symbol" },
389  { "star8", "8-Point Star" },
390  /*{ "mso-spt59", mso_sptSeal16 },
391  { "mso-spt60", mso_sptSeal32 },*/
392  { "rectangular-callout", "Rectangular Callout" },
393  { "round-rectangular-callout", "Rounded Rectangular Callout" },
394  { "round-callout", "Round Callout" },
395  //{ "mso-spt64", mso_sptWave },
396  { "paper", "Folded Corner" },
397  { "left-arrow", "Left Arrow" },
398  { "down-arrow", "Down Arrow" },
399  { "up-arrow", "Up Arrow" },
400  { "left-right-arrow", "Left and Right Arrow" },
401  { "up-down-arrow", "Up and Down Arrow" },
402  //{ "mso-spt71", mso_sptIrregularSeal1 },
403  { "bang", "Explosion" },
404  { "lightning", "Lighting Bolt" },
405  { "heart", "Heart" },
406  //{ "mso-spt75", mso_sptPictureFrame },
407  { "quad-arrow", "4-Way Arrow" },
408  { "left-arrow-callout", "Left Arrow Callout" },
409  { "right-arrow-callout", "Right Arrow Callout" },
410  { "up-arrow-callout", "Up Arrow Callout" },
411  { "down-arrow-callout", "Down Arrow Callout" },
412  { "left-right-arrow-callout", "Left and Right Arrow Callout" },
413  { "up-down-arrow-callout", "Up and Down Arrow Callout" },
414  { "quad-arrow-callout", "4-Way Arrow Callout" },
415  { "quad-bevel", "Square Bevel" },
416  { "left-bracket", "Left Bracket" },
417  { "right-bracket", "Right Bracket" },
418  { "left-brace", "Left Brace" },
419  { "right-brace", "Right Brace" },
420  { "mso-spt89", "Up and Left Arrow" },
421  //{ "mso-spt90", mso_sptBentUpArrow },
422  //{ "mso-spt91", mso_sptBentArrow },
423  { "star24", "24-Point Star" },
424  { "striped-right-arrow", "Striped Right Arrow" },
425  { "notched-right-arrow", "Notched Right Arrow" },
426  { "block-arc", "Block Arc" },
427  { "smiley", "Smile Face" },
428  { "vertical-scroll", "Vertical Scroll" },
429  { "horizontal-scroll", "Horizontal Scroll" },
430  { "circular-arrow", "Circular Arrow" },
431  { "mso-spt100", "Notched Circular Arrow" },
432  /*
433  { "mso-spt101", mso_sptUturnArrow },
434  { "mso-spt102", mso_sptCurvedRightArrow },
435  { "mso-spt103", mso_sptCurvedLeftArrow },
436  { "mso-spt104", mso_sptCurvedUpArrow },
437  { "mso-spt105", mso_sptCurvedDownArrow },*/
438  { "cloud-callout", "Cloud Callout" },
439  /*{ "mso-spt107", mso_sptEllipseRibbon },
440  { "mso-spt108", mso_sptEllipseRibbon2 },*/
441  { "flowchart-process", "Flowchart:Process" },
442  { "flowchart-decision", "Flowchart:Decision" },
443  { "flowchart-data", "Flowchart:Data" },
444  { "flowchart-predefined-process", "Flowchart:Predefined Process" },
445  { "flowchart-internal-storage", "Flowchart:Internal Storage" },
446  { "flowchart-document", "Flowchart:Document" },
447  { "flowchart-multidocument", "Flowchart:Multidocument" },
448  { "flowchart-terminator", "Flowchart:Terminator" },
449  { "flowchart-preparation", "Flowchart:Preparation" },
450  { "flowchart-manual-input", "Flowchart:Manual Input" },
451  { "flowchart-manual-operation", "Flowchart:Manual Operation" },
452  { "flowchart-connector", "Flowchart:Connector" },
453  { "flowchart-card", "Flowchart:Card" },
454  { "flowchart-punched-tape", "Flowchart:Punched Tape" },
455  { "flowchart-summing-junction", "Flowchart:Summing Junction" },
456  { "flowchart-or", "Flowchart:Or" },
457  { "flowchart-collate", "Flowchart:Collate" },
458  { "flowchart-sort", "Flowchart:Sort" },
459  { "flowchart-extract", "Flowchart:Extract" },
460  { "flowchart-merge", "Flowchart:Merge" },
461  //{ "mso-spt129", mso_sptFlowChartOfflineStorage },
462  { "flowchart-stored-data", "Flowchart:Stored Data" },
463  { "flowchart-sequential-access", "drawingbar.fc.25=Flowchart:Sequential Access" },
464  { "flowchart-magnetic-disk", "Flowchart:Magnetic Disk" },
465  { "flowchart-direct-access-storage", "Flowchart:Direct Access Storage" },
466  { "flowchart-display", "Flowchart:Display" },
467  { "flowchart-delay", "Flowchart:Delay" },
468  /*{ "fontwork-plain-text", mso_sptTextPlainText },
469  { "fontwork-stop", mso_sptTextStop },
470  { "fontwork-triangle-up", mso_sptTextTriangle },
471  { "fontwork-triangle-down", mso_sptTextTriangleInverted },
472  { "fontwork-chevron-up", mso_sptTextChevron },
473  { "fontwork-chevron-down", mso_sptTextChevronInverted },
474  { "mso-spt142", mso_sptTextRingInside },
475  { "mso-spt143", mso_sptTextRingOutside },
476  { "fontwork-arch-up-curve", mso_sptTextArchUpCurve },
477  { "fontwork-arch-down-curve", mso_sptTextArchDownCurve },
478  { "fontwork-circle-curve", mso_sptTextCircleCurve },
479  { "fontwork-open-circle-curve", mso_sptTextButtonCurve },
480  { "fontwork-arch-up-pour", mso_sptTextArchUpPour },
481  { "fontwork-arch-down-pour", mso_sptTextArchDownPour },
482  { "fontwork-circle-pour", mso_sptTextCirclePour },
483  { "fontwork-open-circle-pour", mso_sptTextButtonPour },
484  { "fontwork-curve-up", mso_sptTextCurveUp },
485  { "fontwork-curve-down", mso_sptTextCurveDown },
486  { "fontwork-fade-up-and-right", mso_sptTextCascadeUp },
487  { "fontwork-fade-up-and-left", mso_sptTextCascadeDown },
488  { "fontwork-wave", mso_sptTextWave1 },
489  { "mso-spt157", mso_sptTextWave2 },
490  { "mso-spt158", mso_sptTextWave3 },
491  { "mso-spt159", mso_sptTextWave4 },
492  { "fontwork-inflate", mso_sptTextInflate },
493  { "mso-spt161", mso_sptTextDeflate },
494  { "mso-spt162", mso_sptTextInflateBottom },
495  { "mso-spt163", mso_sptTextDeflateBottom },
496  { "mso-spt164", mso_sptTextInflateTop },
497  { "mso-spt165", mso_sptTextDeflateTop },
498  { "mso-spt166", mso_sptTextDeflateInflate },
499  { "mso-spt167", mso_sptTextDeflateInflateDeflate },
500  { "fontwork-fade-right", mso_sptTextFadeRight },
501  { "fontwork-fade-left", mso_sptTextFadeLeft },
502  { "fontwork-fade-up", mso_sptTextFadeUp },
503  { "fontwork-fade-down", mso_sptTextFadeDown },
504  { "fontwork-slant-up", mso_sptTextSlantUp },
505  { "fontwork-slant-down", mso_sptTextSlantDown },
506  { "mso-spt174", mso_sptTextCanUp },
507  { "mso-spt175", mso_sptTextCanDown },*/
508  { "flowchart-alternate-process", "Flowchart:Alternate Process " },
509  { "flowchart-off-page-connector", "Flowchart:Off-page Connector" },
510  /*{ "mso-spt178", mso_sptCallout90 },
511  { "mso-spt179", mso_sptAccentCallout90 },
512  { "mso-spt180", mso_sptBorderCallout90 },*/
513  { "line-callout-3", "Line Callout 3" },
514  //{ "mso-spt182", mso_sptLeftRightUpArrow },
515  { "sun", "Sun" },
516  { "moon", "Moon" },
517  { "bracket-pair", "Double Bracket" },
518  { "brace-pair", "Double Brace" },
519  { "star4", "4-Point Star" },
520  /*{ "mso-spt188", mso_sptDoubleWave },
521  { "mso-spt189", mso_sptActionButtonBlank },
522  { "mso-spt190", mso_sptActionButtonHome },
523  { "mso-spt191", mso_sptActionButtonHelp },
524  { "mso-spt192", mso_sptActionButtonInformation },
525  { "mso-spt193", mso_sptActionButtonForwardNext },
526  { "mso-spt194", mso_sptActionButtonBackPrevious },
527  { "mso-spt195", mso_sptActionButtonEnd },
528  { "mso-spt196", mso_sptActionButtonBeginning },
529  { "mso-spt197", mso_sptActionButtonReturn },
530  { "mso-spt198", mso_sptActionButtonDocument },
531  { "mso-spt199", mso_sptActionButtonSound },
532  { "mso-spt200", mso_sptActionButtonMovie },
533  { "mso-spt201", mso_sptHostControl },
534  { "mso-spt202", mso_sptTextBox },*/
535  { "frame", "Frame" },
536  { "col-60da8460", "Octagon Bevel" },
537  { "col-502ad400", "Diamond Bevel" }
538 };
539 
540 OUString EnhancedCustomShapeTypeNames::GetAccName( const OUString& rShapeType )
541 {
542  if ( !pACCHashMap )
543  { // init hash map
544  ::osl::MutexGuard aGuard( getHashMapMutex() );
545  if ( !pACCHashMap )
546  {
548  const ACCNameTypeTable* pPtr = pACCNameTypeTableArray;
549  const ACCNameTypeTable* pEnd = pPtr + SAL_N_ELEMENTS( pACCNameTypeTableArray );
550  for ( ; pPtr < pEnd; pPtr++ )
551  (*pH)[ pPtr->pS ] = pPtr->pE;
552  pACCHashMap = pH;
553  }
554  }
555  OUString sRetValue;
556  int i, nLen = rShapeType.getLength();
557  std::unique_ptr<char[]> pBuf(new char[ nLen + 1 ]);
558  for ( i = 0; i < nLen; i++ )
559  pBuf[ i ] = static_cast<char>(rShapeType[ i ]);
560  pBuf[ i ] = 0;
561  TypeACCNameHashMap::const_iterator aHashIter( pACCHashMap->find( pBuf.get() ) );
562  if ( aHashIter != pACCHashMap->end() )
563  sRetValue = OUString::createFromAscii( (*aHashIter).second );
564  return sRetValue;
565 }
566 
567 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static TypeACCNameHashMap * pACCHashMap
std::unordered_map< const char *, MSO_SPT, rtl::CStringHash, rtl::CStringEqual > TypeNameHashMap
FormulaCommand pE
::osl::Mutex & getHashMapMutex()
MSO_SPT
Definition: msdffdef.hxx:274
static const NameTypeTable pNameTypeTableArray[]
std::unordered_map< const char *, PPPOptimizerTokenEnum, rtl::CStringHash, rtl::CStringEqual > TypeNameHashMap
#define SAL_N_ELEMENTS(arr)
int i
std::unordered_map< const char *, const char *, rtl::CStringHash, rtl::CStringEqual > TypeACCNameHashMap
const char * pS
static const ACCNameTypeTable pACCNameTypeTableArray[]
SVXCORE_DLLPUBLIC OUString GetAccName(const OUString &)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
static TypeNameHashMap * pHashMap