LibreOffice Module filter (master) 1
util.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
10#include <com/sun/star/awt/Size.hpp>
11#include <com/sun/star/lang/Locale.hpp>
12#include <rtl/ustring.hxx>
13#include <rtl/character.hxx>
14#include <comphelper/string.hxx>
15#include <unotools/fontcvt.hxx>
16#include <unotools/fontdefs.hxx>
17#include <utility>
18#include <vcl/BitmapPalette.hxx>
21#include <o3tl/string_view.hxx>
22#include <memory>
23#include <unordered_map>
24
25namespace msfilter::util {
26
27rtl_TextEncoding getBestTextEncodingFromLocale(const css::lang::Locale &rLocale)
28{
29 // Obviously not comprehensive, feel free to expand these, they're for ultimate fallbacks
30 // in last-ditch broken-file-format cases to guess the right 8bit encodings
31 const OUString &rLanguage = rLocale.Language;
32 if (rLanguage == "cs" || rLanguage == "hu" || rLanguage == "pl")
33 return RTL_TEXTENCODING_MS_1250;
34 if (rLanguage == "ru" || rLanguage == "uk")
35 return RTL_TEXTENCODING_MS_1251;
36 if (rLanguage == "el")
37 return RTL_TEXTENCODING_MS_1253;
38 if (rLanguage == "tr")
39 return RTL_TEXTENCODING_MS_1254;
40 if (rLanguage == "lt")
41 return RTL_TEXTENCODING_MS_1257;
42 if (rLanguage == "th")
43 return RTL_TEXTENCODING_MS_874;
44 if (rLanguage == "vi")
45 return RTL_TEXTENCODING_MS_1258;
46 return RTL_TEXTENCODING_MS_1252;
47}
48
49::Color BGRToRGB(sal_uInt32 nColor)
50{
52 r(static_cast<sal_uInt8>(nColor&0xFF)),
53 g(static_cast<sal_uInt8>((nColor>>8)&0xFF)),
54 b(static_cast<sal_uInt8>((nColor>>16)&0xFF)),
55 t(static_cast<sal_uInt8>((nColor>>24)&0xFF));
56 return ::Color(ColorTransparency, t, r, g, b);
57}
58
60{
61 /*
62 mint short :6 0000003F minutes (0-59)
63 hr short :5 000007C0 hours (0-23)
64 dom short :5 0000F800 days of month (1-31)
65 mon short :4 000F0000 months (1-12)
66 yr short :9 1FF00000 years (1900-2411)-1900
67 wdy short :3 E0000000 weekday(Sunday=0
68 Monday=1
69 ( wdy can be ignored ) Tuesday=2
70 Wednesday=3
71 Thursday=4
72 Friday=5
73 Saturday=6)
74 */
75 DateTime aDateTime(Date( 0 ), ::tools::Time( 0 ));
76 if( lDTTM )
77 {
78 sal_uInt16 lMin = static_cast<sal_uInt16>(lDTTM & 0x0000003F);
79 lDTTM >>= 6;
80 sal_uInt16 lHour= static_cast<sal_uInt16>(lDTTM & 0x0000001F);
81 lDTTM >>= 5;
82 sal_uInt16 lDay = static_cast<sal_uInt16>(lDTTM & 0x0000001F);
83 lDTTM >>= 5;
84 sal_uInt16 lMon = static_cast<sal_uInt16>(lDTTM & 0x0000000F);
85 lDTTM >>= 4;
86 sal_uInt16 lYear= static_cast<sal_uInt16>(lDTTM & 0x000001FF) + 1900;
87 aDateTime = DateTime(Date(lDay, lMon, lYear), tools::Time(lHour, lMin));
88 }
89 return aDateTime;
90}
91
93 rtl_TextEncoding& rChrSet, OUString& rFontName)
94{
95 std::unique_ptr<StarSymbolToMSMultiFont> pConvert(CreateStarSymbolToMSMultiFont());
96 OUString sFont = pConvert->ConvertChar(cChar);
97 pConvert.reset();
98 if (!sFont.isEmpty())
99 {
100 cChar = static_cast< sal_Unicode >(cChar | 0xF000);
101 rFontName = sFont;
102 rChrSet = RTL_TEXTENCODING_SYMBOL;
103 }
104 else if (cChar < 0xE000 || cChar > 0xF8FF)
105 {
106 /*
107 Ok we can't fit into a known windows unicode font, but
108 we are not in the private area, so we are a
109 standardized symbol, so turn off the symbol bit and
110 let words own font substitution kick in
111 */
112 rChrSet = RTL_TEXTENCODING_UNICODE;
113 sal_Int32 nIndex = 0;
114 rFontName = ::GetNextFontToken(rFontName, nIndex);
115 }
116 else
117 {
118 /*
119 Well we don't have an available substitution, and we're
120 in our private area, so give up and show a standard
121 bullet symbol
122 */
123 rFontName = "Wingdings";
124 cChar = u'\x6C';
125 }
126 return cChar;
127}
128
129
130OString ConvertColor( const Color &rColor )
131{
132 static constexpr OStringLiteral AUTO( "auto" );
133
134 if ( rColor == COL_AUTO )
135 return AUTO;
136
137 const char pHexDigits[] = "0123456789ABCDEF";
138 char pBuffer[] = "000000";
139
140 pBuffer[0] = pHexDigits[ ( rColor.GetRed() >> 4 ) & 0x0F ];
141 pBuffer[1] = pHexDigits[ rColor.GetRed() & 0x0F ];
142 pBuffer[2] = pHexDigits[ ( rColor.GetGreen() >> 4 ) & 0x0F ];
143 pBuffer[3] = pHexDigits[ rColor.GetGreen() & 0x0F ];
144 pBuffer[4] = pHexDigits[ ( rColor.GetBlue() >> 4 ) & 0x0F ];
145 pBuffer[5] = pHexDigits[ rColor.GetBlue() & 0x0F ];
146
147 return OString( pBuffer );
148}
149
150OUString ConvertColorOU( const Color &rColor )
151{
152 static constexpr OUStringLiteral AUTO( u"auto" );
153
154 if ( rColor == COL_AUTO )
155 return AUTO;
156
157 const char pHexDigits[] = "0123456789ABCDEF";
158 sal_Unicode pBuffer[] = u"000000";
159
160 pBuffer[0] = pHexDigits[ ( rColor.GetRed() >> 4 ) & 0x0F ];
161 pBuffer[1] = pHexDigits[ rColor.GetRed() & 0x0F ];
162 pBuffer[2] = pHexDigits[ ( rColor.GetGreen() >> 4 ) & 0x0F ];
163 pBuffer[3] = pHexDigits[ rColor.GetGreen() & 0x0F ];
164 pBuffer[4] = pHexDigits[ ( rColor.GetBlue() >> 4 ) & 0x0F ];
165 pBuffer[5] = pHexDigits[ rColor.GetBlue() & 0x0F ];
166
167 return OUString( pBuffer );
168}
169
170#define IN2MM100( v ) static_cast< sal_Int32 >( (v) * 2540.0 + 0.5 )
171#define MM2MM100( v ) static_cast< sal_Int32 >( (v) * 100.0 + 0.5 )
172
173// see XclPaperSize pPaperSizeTable in calc and aDinTab in i18nutil
175{
176 { 0, 0 }, // 0 - (undefined)
177 { IN2MM100( 8.5 ), IN2MM100( 11 ) }, // 1 - Letter paper
178 { IN2MM100( 8.5 ), IN2MM100( 11 ) }, // 2 - Letter small paper
179 { IN2MM100( 11 ), IN2MM100( 17 ) }, // 3 - Tabloid paper
180 { IN2MM100( 17 ), IN2MM100( 11 ) }, // 4 - Ledger paper
181 { IN2MM100( 8.5 ), IN2MM100( 14 ) }, // 5 - Legal paper
182 { IN2MM100( 5.5 ), IN2MM100( 8.5 ) }, // 6 - Statement paper
183 { IN2MM100( 7.25 ), IN2MM100( 10.5 ) }, // 7 - Executive paper
184 { MM2MM100( 297 ), MM2MM100( 420 ) }, // 8 - A3 paper
185 { MM2MM100( 210 ), MM2MM100( 297 ) }, // 9 - A4 paper
186 { MM2MM100( 210 ), MM2MM100( 297 ) }, // 10 - A4 small paper
187 { MM2MM100( 148 ), MM2MM100( 210 ) }, // 11 - A5 paper
188 /* for JIS vs ISO B confusion see:
189 https://docs.microsoft.com/en-us/windows/win32/intl/paper-sizes
190 http://wiki.openoffice.org/wiki/DefaultPaperSize comments
191 http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf */
192 { MM2MM100( 257 ), MM2MM100( 364 ) }, // 12 - B4 (JIS) paper
193 { MM2MM100( 182 ), MM2MM100( 257 ) }, // 13 - B5 (JIS) paper
194 { IN2MM100( 8.5 ), IN2MM100( 13 ) }, // 14 - Folio paper
195 { MM2MM100( 215 ), MM2MM100( 275 ) }, // 15 - Quarto paper
196 { IN2MM100( 10 ), IN2MM100( 14 ) }, // 16 - Standard paper
197 { IN2MM100( 11 ), IN2MM100( 17 ) }, // 17 - Standard paper
198 { IN2MM100( 8.5 ), IN2MM100( 11 ) }, // 18 - Note paper
199 { IN2MM100( 3.875 ), IN2MM100( 8.875 ) }, // 19 - #9 envelope
200 { IN2MM100( 4.125 ), IN2MM100( 9.5 ) }, // 20 - #10 envelope
201 { IN2MM100( 4.5 ), IN2MM100( 10.375 ) }, // 21 - #11 envelope
202 { IN2MM100( 4.75 ), IN2MM100( 11 ) }, // 22 - #12 envelope
203 { IN2MM100( 5 ), IN2MM100( 11.5 ) }, // 23 - #14 envelope
204 { IN2MM100( 17 ), IN2MM100( 22 ) }, // 24 - C paper
205 { IN2MM100( 22 ), IN2MM100( 34 ) }, // 25 - D paper
206 { IN2MM100( 34 ), IN2MM100( 44 ) }, // 26 - E paper
207 { MM2MM100( 110 ), MM2MM100( 220 ) }, // 27 - DL envelope
208 { MM2MM100( 162 ), MM2MM100( 229 ) }, // 28 - C5 envelope
209 { MM2MM100( 324 ), MM2MM100( 458 ) }, // 29 - C3 envelope
210 { MM2MM100( 229 ), MM2MM100( 324 ) }, // 30 - C4 envelope
211 { MM2MM100( 114 ), MM2MM100( 162 ) }, // 31 - C6 envelope
212 { MM2MM100( 114 ), MM2MM100( 229 ) }, // 32 - C65 envelope
213 { MM2MM100( 250 ), MM2MM100( 353 ) }, // 33 - B4 envelope
214 { MM2MM100( 176 ), MM2MM100( 250 ) }, // 34 - B5 envelope
215 { MM2MM100( 176 ), MM2MM100( 125 ) }, // 35 - B6 envelope
216 { MM2MM100( 110 ), MM2MM100( 230 ) }, // 36 - Italy envelope
217 { IN2MM100( 3.875 ), IN2MM100( 7.5 ) }, // 37 - Monarch envelope
218 { IN2MM100( 3.625 ), IN2MM100( 6.5 ) }, // 38 - 6 3/4 envelope
219 { IN2MM100( 14.875 ), IN2MM100( 11 ) }, // 39 - US standard fanfold
220 { IN2MM100( 8.5 ), IN2MM100( 12 ) }, // 40 - German standard fanfold
221 { IN2MM100( 8.5 ), IN2MM100( 13 ) }, // 41 - German legal fanfold
222 { MM2MM100( 250 ), MM2MM100( 353 ) }, // 42 - ISO B4
223 { MM2MM100( 200 ), MM2MM100( 148 ) }, // 43 - Japanese double postcard
224 { IN2MM100( 9 ), IN2MM100( 11 ) }, // 44 - Standard paper
225 { IN2MM100( 10 ), IN2MM100( 11 ) }, // 45 - Standard paper
226 { IN2MM100( 15 ), IN2MM100( 11 ) }, // 46 - Standard paper
227 { MM2MM100( 220 ), MM2MM100( 220 ) }, // 47 - Invite envelope
228 { 0, 0 }, // 48 - (undefined)
229 { 0, 0 }, // 49 - (undefined)
230 /* See: https://docs.microsoft.com/en-us/windows/win32/intl/paper-sizes */
231 { IN2MM100( 9.5 ), IN2MM100( 12 ) }, // 50 - Letter extra paper
232 { IN2MM100( 9.5 ), IN2MM100( 15 ) }, // 51 - Legal extra paper
233 { IN2MM100( 11.69 ), IN2MM100( 18 ) }, // 52 - Tabloid extra paper
234 { MM2MM100( 235 ), MM2MM100( 322 ) }, // 53 - A4 extra paper
235 { IN2MM100( 8.5 ), IN2MM100( 11 ) }, // 54 - Letter transverse paper
236 { MM2MM100( 210 ), MM2MM100( 297 ) }, // 55 - A4 transverse paper
237 { IN2MM100( 9.5 ), IN2MM100( 12 ) }, // 56 - Letter extra transverse paper
238 { MM2MM100( 227 ), MM2MM100( 356 ) }, // 57 - SuperA/SuperA/A4 paper
239 { MM2MM100( 305 ), MM2MM100( 487 ) }, // 58 - SuperB/SuperB/A3 paper
240 { IN2MM100( 8.5 ), IN2MM100( 12.69 ) }, // 59 - Letter plus paper
241 { MM2MM100( 210 ), MM2MM100( 330 ) }, // 60 - A4 plus paper
242 { MM2MM100( 148 ), MM2MM100( 210 ) }, // 61 - A5 transverse paper
243 { MM2MM100( 182 ), MM2MM100( 257 ) }, // 62 - JIS B5 transverse paper
244 { MM2MM100( 322 ), MM2MM100( 445 ) }, // 63 - A3 extra paper
245 { MM2MM100( 174 ), MM2MM100( 235 ) }, // 64 - A5 extra paper
246 { MM2MM100( 201 ), MM2MM100( 276 ) }, // 65 - ISO B5 extra paper
247 { MM2MM100( 420 ), MM2MM100( 594 ) }, // 66 - A2 paper
248 { MM2MM100( 297 ), MM2MM100( 420 ) }, // 67 - A3 transverse paper
249 { MM2MM100( 322 ), MM2MM100( 445 ) }, // 68 - A3 extra transverse paper
250 { MM2MM100( 200 ), MM2MM100( 148 ) }, // 69 - Japanese double postcard
251 { MM2MM100( 105 ), MM2MM100( 148 ), }, // 70 - A6 paper
252 { 0, 0 }, // 71 - Japanese Envelope Kaku #2
253 { 0, 0 }, // 72 - Japanese Envelope Kaku #3
254 { 0, 0 }, // 73 - Japanese Envelope Chou #3
255 { 0, 0 }, // 74 - Japanese Envelope Chou #4
256 { IN2MM100( 11 ), IN2MM100( 8.5 ) }, // 75 - Letter Rotated
257 { MM2MM100( 420 ), MM2MM100( 297 ) }, // 76 - A3 Rotated
258 { MM2MM100( 297 ), MM2MM100( 210 ) }, // 77 - A4 Rotated
259 { MM2MM100( 210 ), MM2MM100( 148 ) }, // 78 - A5 Rotated
260 { MM2MM100( 364 ), MM2MM100( 257 ) }, // 79 - B4 (JIS) Rotated
261 { MM2MM100( 257 ), MM2MM100( 182 ) }, // 80 - B5 (JIS) Rotated
262 { MM2MM100( 148 ), MM2MM100( 100 ) }, // 81 - Japanese Postcard Rotated
263 { MM2MM100( 148 ), MM2MM100( 200 ) }, // 82 - Double Japanese Postcard Rotated
264 { MM2MM100( 148 ), MM2MM100( 105 ) }, // 83 - A6 Rotated
265 { 0, 0 }, // 84 - Japanese Envelope Kaku #2 Rotated
266 { 0, 0 }, // 85 - Japanese Envelope Kaku #3 Rotated
267 { 0, 0 }, // 86 - Japanese Envelope Chou #3 Rotated
268 { 0, 0 }, // 87 - Japanese Envelope Chou #4 Rotated
269 { MM2MM100( 128 ), MM2MM100( 182 ) }, // 88 - B6 (JIS)
270 { MM2MM100( 182 ), MM2MM100( 128 ) }, // 89 - B6 (JIS) Rotated
271 { IN2MM100( 12 ), IN2MM100( 11 ) } // 90 - 12x11
272};
273
274sal_Int32 PaperSizeConv::getMSPaperSizeIndex( const css::awt::Size& rSize )
275{
276 // Need to find the best match for current size
277 sal_Int32 nDeltaWidth = 0;
278 sal_Int32 nDeltaHeight = 0;
279
280 sal_Int32 nPaperSizeIndex = 0; // Undefined
281 const ApiPaperSize* pItem = spPaperSizeTable;
283 for ( ; pItem != pEnd; ++pItem )
284 {
285 sal_Int32 nCurDeltaHeight = std::abs( pItem->mnHeight - rSize.Height );
286 sal_Int32 nCurDeltaWidth = std::abs( pItem->mnWidth - rSize.Width );
287 if ( pItem == spPaperSizeTable ) // initialize delta with first item
288 {
289 nDeltaWidth = nCurDeltaWidth;
290 nDeltaHeight = nCurDeltaHeight;
291 }
292 else
293 {
294 if ( nCurDeltaWidth < nDeltaWidth && nCurDeltaHeight < nDeltaHeight )
295 {
296 nDeltaWidth = nCurDeltaWidth;
297 nDeltaHeight = nCurDeltaHeight;
298 nPaperSizeIndex = (pItem - spPaperSizeTable);
299 }
300 }
301 }
302 sal_Int32 nTol = 10; // hmm not sure is this the best way
303 if ( nDeltaWidth <= nTol && nDeltaHeight <= nTol )
304 return nPaperSizeIndex;
305 return 0;
306}
307
309{
310 if ( nMSOPaperIndex < 0 || nMSOPaperIndex > sal_Int32(SAL_N_ELEMENTS( spPaperSizeTable )) - 1 )
311 return spPaperSizeTable[ 0 ];
312 return spPaperSizeTable[ nMSOPaperIndex ];
313}
314
315OUString CreateDOCXStyleId(std::u16string_view const aName)
316{
317 OUStringBuffer aStyleIdBuf(aName.size());
318 for (size_t i = 0; i < aName.size(); ++i)
319 {
320 sal_Unicode nChar = aName[i];
321 if (rtl::isAsciiAlphanumeric(nChar) || nChar == '-')
322 {
323 // first letter should be uppercase
324 if (aStyleIdBuf.isEmpty())
325 aStyleIdBuf.append(char(rtl::toAsciiUpperCase(nChar)));
326 else
327 aStyleIdBuf.append(char(nChar));
328 }
329 }
330 return aStyleIdBuf.makeStringAndClear();
331}
332
333std::u16string_view findQuotedText( std::u16string_view rCommand,
334 std::u16string_view sStartQuote, const sal_Unicode uEndQuote )
335{
336 std::u16string_view sRet;
337 size_t nStartIndex = rCommand.find( sStartQuote );
338 if( nStartIndex != std::u16string_view::npos )
339 {
340 sal_Int32 nStartLength = sStartQuote.size();
341 size_t nEndIndex = rCommand.find( uEndQuote, nStartIndex + nStartLength);
342 if( nEndIndex != std::u16string_view::npos && nEndIndex > nStartIndex )
343 {
344 sRet = rCommand.substr( nStartIndex + nStartLength, nEndIndex - nStartIndex - nStartLength);
345 }
346 }
347 return sRet;
348
349}
350
352 : aData(std::move( _aData ))
353 , nFnd( 0 )
354 , nNext( 0 )
355 , nSavPtr( 0 )
356{
357
358 /*
359 First look for an opening bracket or a space or a question mark or a backslash, so that the field (i.e. INCLUDEPICTURE or EINFUEGENGRAFIK or...) gets read over
360 */
361 const sal_Int32 nLen = aData.getLength();
362
363 while ( nNext<nLen && aData[nNext]==' ' )
364 ++nNext;
365
366 while ( nNext<nLen )
367 {
368 const sal_Unicode c = aData[nNext];
369 if ( c==' ' || c=='"' || c=='\\' || c==132 || c==0x201c )
370 break;
371 ++nNext;
372 }
373
374 nFnd = nNext;
375 nSavPtr = nNext;
376}
377
379{
380 if (nFnd<0 && nSavPtr>nFnd)
381 return OUString();
382 else
383 {
384 return nSavPtr < nFnd ? aData.copy(nFnd) : aData.copy(nFnd, nSavPtr-nFnd);
385 }
386}
387
388
390{
391 const sal_Int32 nOld = nNext;
392 if( -2 == SkipToNextToken() )
393 return GetTokenSttPtr()>=0;
394 nNext = nOld;
395 return false;
396}
397
398// ret: -2: NOT a '\' parameter but normal text
400{
401 if ( nNext<0 || nNext>=aData.getLength() )
402 return -1;
403
405 if ( nFnd<0 )
406 return -1;
407
408 nSavPtr = nNext;
409
410 if (nFnd+1<aData.getLength() && aData[nFnd+1]!='\\' && aData[nFnd]=='\\')
411 {
412 const sal_Int32 nRet = aData[++nFnd];
413 nNext = ++nFnd; // and set after
414 return nRet;
415 }
416
417 if ( nSavPtr>0 && (aData[nSavPtr-1]=='"' || aData[nSavPtr-1]==0x201d ) )
418 {
419 --nSavPtr;
420 }
421 return -2;
422}
423
424// FindNextPara searches the next backslash parameter or the next string
425// until the next blank or "\" or closing quotation mark
426// or the end of the string of pStr.
427//
428// Output ppNext (if ppNext != 0) search begin of next parameter resp. 0
429//
430// Return value: 0 if end of string reached,
431// otherwise beginning of the parameter resp. string
432//
433sal_Int32 WW8ReadFieldParams::FindNextStringPiece(const sal_Int32 nStart)
434{
435 const sal_Int32 nLen = aData.getLength();
436 sal_Int32 n = nStart<0 ? nFnd : nStart; // start
437 sal_Int32 n2; // end
438
439 nNext = -1; // if not found -> Default
440
441 while ( n<nLen && aData[n]==' ' )
442 ++n;
443
444 if ( n==nLen )
445 return -1;
446
447 if ( aData[n]==0x13 )
448 {
449 // Skip the nested field code since it's not supported
450 while ( n<nLen && aData[n]!=0x14 )
451 ++n;
452 if ( n==nLen )
453 return -1;
454 }
455
456 // quotation marks before paragraph?
457 if ( aData[n]=='"' || aData[n]==0x201c || aData[n]==132 || aData[n]==0x14 )
458 {
459 n++; // read over quotation marks
460 n2 = n; // search for the end from here on
461 while( (nLen > n2)
462 && (aData[n2] != '"')
463 && (aData[n2] != 0x201d)
464 && (aData[n2] != 147)
465 && (aData[n2] != 0x15) )
466 n2++; // search for the end of the paragraph
467 }
468 else // no quotation mark
469 {
470 n2 = n; // search for the end from here on
471 while ( n2<nLen && aData[n2]!=' ' ) // search for the end of the paragraph
472 {
473 if ( aData[n2]=='\\' )
474 {
475 if ( n2+1<nLen && aData[n2+1]=='\\' )
476 n2 += 2; // double backslash -> OK
477 else
478 {
479 if( n2 > n )
480 n2--;
481 break; // single backslash -> end
482 }
483 }
484 else
485 n2++; // no backslash -> OK
486 }
487 }
488 if( nLen > n2 )
489 {
490 if (aData[n2]!=' ') ++n2;
491 nNext = n2;
492 }
493 return n;
494}
495
496
497// read parameters "1-3" or 1-3 with both values between 1 and nMax
498bool WW8ReadFieldParams::GetTokenSttFromTo(sal_Int32* pFrom, sal_Int32* pTo, sal_Int32 nMax)
499{
500 sal_Int32 nStart = 0;
501 sal_Int32 nEnd = 0;
502 if ( GoToTokenParam() )
503 {
504
505 const OUString sParams( GetResult() );
506
507 sal_Int32 nIndex = 0;
508 const std::u16string_view sStart = o3tl::getToken(sParams, 0, '-', nIndex);
509 if (nIndex>=0)
510 {
511 nStart = o3tl::toInt32(sStart);
512 nEnd = o3tl::toInt32(sParams.subView(nIndex));
513 }
514 }
515 if( pFrom ) *pFrom = nStart;
516 if( pTo ) *pTo = nEnd;
517
518 return nStart && nEnd && (nMax >= nStart) && (nMax >= nEnd);
519}
520
522{
523 EquationResult aResult;
524
525 OUString sCombinedCharacters;
526 WW8ReadFieldParams aOriFldParam = rReadParam;
527 const sal_Int32 cGetChar = rReadParam.SkipToNextToken();
528 switch( cGetChar )
529 {
530 case 'a':
531 case 'A':
532 if ( !rReadParam.GetResult().startsWithIgnoreAsciiCase("d") )
533 {
534 break;
535 }
536 (void)rReadParam.SkipToNextToken();
537 [[fallthrough]];
538 case -2:
539 {
540 if ( rReadParam.GetResult().startsWithIgnoreAsciiCase("(") )
541 {
542 for (int i=0;i<2;i++)
543 {
544 if ('s' == rReadParam.SkipToNextToken())
545 {
546 const sal_Int32 cChar = rReadParam.SkipToNextToken();
547 if (-2 != rReadParam.SkipToNextToken())
548 break;
549 const OUString sF = rReadParam.GetResult();
550 if ((('u' == cChar) && sF.startsWithIgnoreAsciiCase("p"))
551 || (('d' == cChar) && sF.startsWithIgnoreAsciiCase("o")))
552 {
553 if (-2 == rReadParam.SkipToNextToken())
554 {
555 OUString sPart = rReadParam.GetResult();
556 sal_Int32 nBegin = sPart.indexOf('(');
557
558 // Word disallows brackets in this field, which
559 // aids figuring out the case of an end of )) vs )
560 sal_Int32 nEnd = sPart.indexOf(')');
561
562 if (nBegin != -1 && nEnd != -1)
563 {
564 sCombinedCharacters +=
565 sPart.subView(nBegin+1,nEnd-nBegin-1);
566 }
567 }
568 }
569 }
570 }
571 if (!sCombinedCharacters.isEmpty())
572 {
573 aResult.sType = "CombinedCharacters";
574 aResult.sResult = sCombinedCharacters;
575 }
576 else
577 {
578 const OUString sPart = aOriFldParam.GetResult();
579 sal_Int32 nBegin = sPart.indexOf('(');
580 sal_Int32 nEnd = sPart.indexOf(',');
581 if ( nEnd == -1 )
582 {
583 nEnd = sPart.indexOf(')');
584 }
585 if ( nBegin != -1 && nEnd != -1 )
586 {
587 // skip certain leading characters
588 for (int i = nBegin;i < nEnd-1;i++)
589 {
590 const sal_Unicode cC = sPart[nBegin+1];
591 if ( cC < 32 )
592 {
593 nBegin++;
594 }
595 else
596 break;
597 }
598 sCombinedCharacters = sPart.copy( nBegin+1, nEnd-nBegin-1 );
599 if ( !sCombinedCharacters.isEmpty() )
600 {
601 aResult.sType = "Input";
602 aResult.sResult = sCombinedCharacters;
603 }
604 }
605 }
606 }
607 break;
608 }
609 default:
610 break;
611 }
612 return aResult;
613}
614
616{
617 EquationResult aResult;
618 WW8ReadFieldParams aReadParam( rStr );
619 const sal_Int32 cChar = aReadParam.SkipToNextToken();
620 if ('o' == cChar || 'O' == cChar)
621 aResult = Read_SubF_Combined(aReadParam);
622 return aResult;
623}
624
625OString GetOOXMLPresetGeometry( std::u16string_view rShapeType )
626{
627 typedef std::unordered_map<std::u16string_view, OString> CustomShapeTypeTranslationHashMap;
628 static const CustomShapeTypeTranslationHashMap aCustomShapeTypeTranslationHashMap{
629 // { "non-primitive", mso_sptMin },
630 { u"frame", "frame" },
631 { u"rectangle", "rect" },
632 { u"round-rectangle", "roundRect" },
633 { u"ellipse", "ellipse" },
634 { u"diamond", "diamond" },
635 { u"isosceles-triangle", "triangle" },
636 { u"right-triangle", "rtTriangle" },
637 { u"parallelogram", "parallelogram" },
638 { u"trapezoid", "trapezoid" },
639 { u"hexagon", "hexagon" },
640 { u"octagon", "octagon" },
641 { u"cross", "plus" },
642 { u"star5", "star5" },
643 { u"right-arrow", "rightArrow" },
644 // { u"mso-spt14", mso_sptThickArrow },
645 { u"pentagon-right", "homePlate" },
646 { u"cube", "cube" },
647 // { u"mso-spt17", mso_sptBalloon },
648 // { u"mso-spt18", mso_sptSeal },
649 { u"mso-spt19", "arc" },
650 { u"mso-spt20", "line" },
651 { u"mso-spt21", "plaque" },
652 { u"can", "can" },
653 { u"ring", "donut" },
654 { u"mso-spt24", "textPlain" },
655 { u"mso-spt25", "textStop" },
656 { u"mso-spt26", "textTriangle" },
657 { u"mso-spt27", "textCanDown" },
658 { u"mso-spt28", "textWave1" },
659 { u"mso-spt29", "textArchUpPour" },
660 { u"mso-spt30", "textCanDown" },
661 { u"mso-spt31", "textArchUp" },
662 { u"mso-spt32", "straightConnector1" },
663 { u"mso-spt33", "bentConnector2" },
664 { u"mso-spt34", "bentConnector3" },
665 { u"mso-spt35", "bentConnector4" },
666 { u"mso-spt36", "bentConnector5" },
667 { u"mso-spt37", "curvedConnector2" },
668 { u"mso-spt38", "curvedConnector3" },
669 { u"mso-spt39", "curvedConnector4" },
670 { u"mso-spt40", "curvedConnector5" },
671 { u"mso-spt41", "callout1" },
672 { u"mso-spt42", "callout2" },
673 { u"mso-spt43", "callout3" },
674 { u"mso-spt44", "accentCallout1" },
675 { u"mso-spt45", "accentCallout2" },
676 { u"mso-spt46", "accentCallout3" },
677 { u"line-callout-1", "borderCallout1" },
678 { u"line-callout-2", "borderCallout2" },
679 { u"line-callout-3", "borderCallout3" },
680 { u"mso-spt49", "borderCallout3" },
681 { u"mso-spt50", "accentBorderCallout1" },
682 { u"mso-spt51", "accentBorderCallout2" },
683 { u"mso-spt52", "accentBorderCallout3" },
684 { u"mso-spt53", "ribbon" },
685 { u"mso-spt54", "ribbon2" },
686 { u"chevron", "chevron" },
687 { u"pentagon", "pentagon" },
688 { u"forbidden", "noSmoking" },
689 { u"star8", "star8" },
690 { u"mso-spt59", "star16" },
691 { u"mso-spt60", "star32" },
692 { u"rectangular-callout", "wedgeRectCallout" },
693 { u"round-rectangular-callout", "wedgeRoundRectCallout" },
694 { u"round-callout", "wedgeEllipseCallout" },
695 { u"mso-spt64", "wave" },
696 { u"paper", "foldedCorner" },
697 { u"left-arrow", "leftArrow" },
698 { u"down-arrow", "downArrow" },
699 { u"up-arrow", "upArrow" },
700 { u"left-right-arrow", "leftRightArrow" },
701 { u"up-down-arrow", "upDownArrow" },
702 { u"mso-spt71", "irregularSeal1" },
703 { u"bang", "irregularSeal2" },
704 { u"lightning", "lightningBolt" },
705 { u"heart", "heart" },
706 { u"quad-arrow", "quadArrow" },
707 { u"left-arrow-callout", "leftArrowCallout" },
708 { u"right-arrow-callout", "rightArrowCallout" },
709 { u"up-arrow-callout", "upArrowCallout" },
710 { u"down-arrow-callout", "downArrowCallout" },
711 { u"left-right-arrow-callout", "leftRightArrowCallout" },
712 { u"up-down-arrow-callout", "upDownArrowCallout" },
713 { u"quad-arrow-callout", "quadArrowCallout" },
714 { u"quad-bevel", "bevel" },
715 { u"left-bracket", "leftBracket" },
716 { u"right-bracket", "rightBracket" },
717 { u"left-brace", "leftBrace" },
718 { u"right-brace", "rightBrace" },
719 { u"mso-spt89", "leftUpArrow" },
720 { u"mso-spt90", "bentUpArrow" },
721 { u"mso-spt91", "bentArrow" },
722 { u"star24", "star24" },
723 { u"striped-right-arrow", "stripedRightArrow" },
724 { u"notched-right-arrow", "notchedRightArrow" },
725 { u"block-arc", "blockArc" },
726 { u"smiley", "smileyFace" },
727 { u"vertical-scroll", "verticalScroll" },
728 { u"horizontal-scroll", "horizontalScroll" },
729 { u"circular-arrow", "circularArrow" },
730 { u"mso-spt100", "pie" }, // looks like MSO_SPT is wrong here
731 { u"mso-spt101", "uturnArrow" },
732 { u"mso-spt102", "curvedRightArrow" },
733 { u"mso-spt103", "curvedLeftArrow" },
734 { u"mso-spt104", "curvedUpArrow" },
735 { u"mso-spt105", "curvedDownArrow" },
736 { u"cloud-callout", "cloudCallout" },
737 { u"mso-spt107", "ellipseRibbon" },
738 { u"mso-spt108", "ellipseRibbon2" },
739 { u"flowchart-process", "flowChartProcess" },
740 { u"flowchart-decision", "flowChartDecision" },
741 { u"flowchart-data", "flowChartInputOutput" },
742 { u"flowchart-predefined-process", "flowChartPredefinedProcess" },
743 { u"flowchart-internal-storage", "flowChartInternalStorage" },
744 { u"flowchart-document", "flowChartDocument" },
745 { u"flowchart-multidocument", "flowChartMultidocument" },
746 { u"flowchart-terminator", "flowChartTerminator" },
747 { u"flowchart-preparation", "flowChartPreparation" },
748 { u"flowchart-manual-input", "flowChartManualInput" },
749 { u"flowchart-manual-operation", "flowChartManualOperation" },
750 { u"flowchart-connector", "flowChartConnector" },
751 { u"flowchart-card", "flowChartPunchedCard" },
752 { u"flowchart-punched-tape", "flowChartPunchedTape" },
753 { u"flowchart-summing-junction", "flowChartSummingJunction" },
754 { u"flowchart-or", "flowChartOr" },
755 { u"flowchart-collate", "flowChartCollate" },
756 { u"flowchart-sort", "flowChartSort" },
757 { u"flowchart-extract", "flowChartExtract" },
758 { u"flowchart-merge", "flowChartMerge" },
759 { u"mso-spt129", "flowChartOfflineStorage" },
760 { u"flowchart-stored-data", "flowChartOnlineStorage" },
761 { u"flowchart-sequential-access", "flowChartMagneticTape" },
762 { u"flowchart-magnetic-disk", "flowChartMagneticDisk" },
763 { u"flowchart-direct-access-storage", "flowChartMagneticDrum" },
764 { u"flowchart-display", "flowChartDisplay" },
765 { u"flowchart-delay", "flowChartDelay" },
766 // { u"fontwork-plain-text", "textPlainText" },
767 // { u"fontwork-stop", "textStop" },
768 // { u"fontwork-triangle-up", "textTriangle" },
769 // { u"fontwork-triangle-down", "textTriangleInverted" },
770 // { u"fontwork-chevron-up", "textChevron" },
771 // { u"fontwork-chevron-down", "textChevronInverted" },
772 // { u"mso-spt142", "textRingInside" },
773 // { u"mso-spt143", "textRingOutside" },
774 // { u"fontwork-arch-up-curve", "textArchUpCurve" },
775 // { u"fontwork-arch-down-curve", "textArchDownCurve" },
776 // { u"fontwork-circle-curve", "textCircleCurve" },
777 // { u"fontwork-open-circle-curve", "textButtonCurve" },
778 // { u"fontwork-arch-up-pour", "textArchUpPour" },
779 // { u"fontwork-arch-down-pour", "textArchDownPour" },
780 // { u"fontwork-circle-pour", "textCirclePour" },
781 // { u"fontwork-open-circle-pour", "textButtonPour" },
782 // { u"fontwork-curve-up", "textCurveUp" },
783 // { u"fontwork-curve-down", "textCurveDown" },
784 // { u"fontwork-fade-up-and-right", "textCascadeUp" },
785 // { u"fontwork-fade-up-and-left", "textCascadeDown" },
786 // { u"fontwork-wave", "textWave1" },
787 // { u"mso-spt157", "textWave2" },
788 // { u"mso-spt158", "textWave3" },
789 // { u"mso-spt159", "textWave4" },
790 // { u"fontwork-inflate", "textInflate" },
791 // { u"mso-spt161", "textDeflate" },
792 // { u"mso-spt162", "textInflateBottom" },
793 // { u"mso-spt163", "textDeflateBottom" },
794 // { u"mso-spt164", "textInflateTop" },
795 // { u"mso-spt165", "textDeflateTop" },
796 // { u"mso-spt166", "textDeflateInflate" },
797 // { u"mso-spt167", "textDeflateInflateDeflate" },
798 // { u"fontwork-fade-right", "textFadeRight" },
799 // { u"fontwork-fade-left", "textFadeLeft" },
800 // { u"fontwork-fade-up", "textFadeUp" },
801 // { u"fontwork-fade-down", "textFadeDown" },
802 // { u"fontwork-slant-up", "textSlantUp" },
803 // { u"fontwork-slant-down", "textSlantDown" },
804 // { u"mso-spt174", "textCanUp" },
805 // { u"mso-spt175", "textCanDown" },
806 { u"flowchart-alternate-process", "flowChartAlternateProcess" },
807 { u"flowchart-off-page-connector", "flowChartOffpageConnector" },
808 { u"mso-spt178", "callout1" },
809 { u"mso-spt179", "accentCallout1" },
810 { u"mso-spt180", "borderCallout1" },
811 { u"mso-spt182", "leftRightUpArrow" },
812 { u"sun", "sun" },
813 { u"moon", "moon" },
814 { u"bracket-pair", "bracketPair" },
815 { u"brace-pair", "bracePair" },
816 { u"star4", "star4" },
817 { u"mso-spt188", "doubleWave" },
818 { u"mso-spt189", "actionButtonBlank" },
819 { u"mso-spt190", "actionButtonHome" },
820 { u"mso-spt191", "actionButtonHelp" },
821 { u"mso-spt192", "actionButtonInformation" },
822 { u"mso-spt193", "actionButtonForwardNext" },
823 { u"mso-spt194", "actionButtonBackPrevious" },
824 { u"mso-spt195", "actionButtonEnd" },
825 { u"mso-spt196", "actionButtonBeginning" },
826 { u"mso-spt197", "actionButtonReturn" },
827 { u"mso-spt198", "actionButtonDocument" },
828 { u"mso-spt199", "actionButtonSound" },
829 { u"mso-spt200", "actionButtonMovie" },
830 // { u"mso-spt201", "hostControl" },
831 { u"mso-spt202", "rect" },
832 { u"ooxml-actionButtonSound", "actionButtonSound" },
833 { u"ooxml-borderCallout1", "borderCallout1" },
834 { u"ooxml-plaqueTabs", "plaqueTabs" },
835 { u"ooxml-curvedLeftArrow", "curvedLeftArrow" },
836 { u"ooxml-octagon", "octagon" },
837 { u"ooxml-leftRightRibbon", "leftRightRibbon" },
838 { u"ooxml-actionButtonInformation", "actionButtonInformation" },
839 { u"ooxml-bentConnector5", "bentConnector5" },
840 { u"ooxml-circularArrow", "circularArrow" },
841 { u"ooxml-downArrowCallout", "downArrowCallout" },
842 { u"ooxml-mathMinus", "mathMinus" },
843 { u"ooxml-gear9", "gear9" },
844 { u"ooxml-round1Rect", "round1Rect" },
845 { u"ooxml-sun", "sun" },
846 { u"ooxml-plaque", "plaque" },
847 { u"ooxml-chevron", "chevron" },
848 { u"ooxml-flowChartPreparation", "flowChartPreparation" },
849 { u"ooxml-diagStripe", "diagStripe" },
850 { u"ooxml-pentagon", "pentagon" },
851 { u"ooxml-funnel", "funnel" },
852 { u"ooxml-chartStar", "chartStar" },
853 { u"ooxml-accentBorderCallout1", "accentBorderCallout1" },
854 { u"ooxml-notchedRightArrow", "notchedRightArrow" },
855 { u"ooxml-rightBracket", "rightBracket" },
856 { u"ooxml-flowChartOffpageConnector", "flowChartOffpageConnector" },
857 { u"ooxml-leftRightArrow", "leftRightArrow" },
858 { u"ooxml-decagon", "decagon" },
859 { u"ooxml-actionButtonHelp", "actionButtonHelp" },
860 { u"ooxml-star24", "star24" },
861 { u"ooxml-mathDivide", "mathDivide" },
862 { u"ooxml-curvedConnector4", "curvedConnector4" },
863 { u"ooxml-flowChartOr", "flowChartOr" },
864 { u"ooxml-borderCallout3", "borderCallout3" },
865 { u"ooxml-upDownArrowCallout", "upDownArrowCallout" },
866 { u"ooxml-flowChartDecision", "flowChartDecision" },
867 { u"ooxml-leftRightArrowCallout", "leftRightArrowCallout" },
868 { u"ooxml-flowChartManualOperation", "flowChartManualOperation" },
869 { u"ooxml-snipRoundRect", "snipRoundRect" },
870 { u"ooxml-mathPlus", "mathPlus" },
871 { u"ooxml-actionButtonForwardNext", "actionButtonForwardNext" },
872 { u"ooxml-can", "can" },
873 { u"ooxml-foldedCorner", "foldedCorner" },
874 { u"ooxml-star32", "star32" },
875 { u"ooxml-flowChartInternalStorage", "flowChartInternalStorage" },
876 { u"ooxml-upDownArrow", "upDownArrow" },
877 { u"ooxml-irregularSeal2", "irregularSeal2" },
878 { u"ooxml-mathEqual", "mathEqual" },
879 { u"ooxml-star12", "star12" },
880 { u"ooxml-uturnArrow", "uturnArrow" },
881 { u"ooxml-squareTabs", "squareTabs" },
882 { u"ooxml-leftRightUpArrow", "leftRightUpArrow" },
883 { u"ooxml-homePlate", "homePlate" },
884 { u"ooxml-dodecagon", "dodecagon" },
885 { u"ooxml-leftArrowCallout", "leftArrowCallout" },
886 { u"ooxml-chord", "chord" },
887 { u"ooxml-quadArrowCallout", "quadArrowCallout" },
888 { u"ooxml-actionButtonBeginning", "actionButtonBeginning" },
889 { u"ooxml-ellipse", "ellipse" },
890 { u"ooxml-actionButtonEnd", "actionButtonEnd" },
891 { u"ooxml-arc", "arc" },
892 { u"ooxml-star16", "star16" },
893 { u"ooxml-parallelogram", "parallelogram" },
894 { u"ooxml-bevel", "bevel" },
895 { u"ooxml-roundRect", "roundRect" },
896 { u"ooxml-accentCallout1", "accentCallout1" },
897 { u"ooxml-flowChartSort", "flowChartSort" },
898 { u"ooxml-star8", "star8" },
899 { u"ooxml-flowChartAlternateProcess", "flowChartAlternateProcess" },
900 { u"ooxml-moon", "moon" },
901 { u"ooxml-star6", "star6" },
902 { u"ooxml-round2SameRect", "round2SameRect" },
903 { u"ooxml-nonIsoscelesTrapezoid", "nonIsoscelesTrapezoid" },
904 { u"ooxml-diamond", "diamond" },
905 { u"ooxml-ellipseRibbon", "ellipseRibbon" },
906 { u"ooxml-callout2", "callout2" },
907 { u"ooxml-pie", "pie" },
908 { u"ooxml-star4", "star4" },
909 { u"ooxml-flowChartPredefinedProcess", "flowChartPredefinedProcess" },
910 { u"ooxml-flowChartPunchedTape", "flowChartPunchedTape" },
911 { u"ooxml-curvedConnector2", "curvedConnector2" },
912 { u"ooxml-bentConnector3", "bentConnector3" },
913 { u"ooxml-cornerTabs", "cornerTabs" },
914 { u"ooxml-hexagon", "hexagon" },
915 { u"ooxml-flowChartConnector", "flowChartConnector" },
916 { u"ooxml-flowChartMagneticDisk", "flowChartMagneticDisk" },
917 { u"ooxml-heart", "heart" },
918 { u"ooxml-ribbon2", "ribbon2" },
919 { u"ooxml-bracePair", "bracePair" },
920 { u"ooxml-flowChartExtract", "flowChartExtract" },
921 { u"ooxml-actionButtonHome", "actionButtonHome" },
922 { u"ooxml-accentBorderCallout3", "accentBorderCallout3" },
923 { u"ooxml-flowChartOfflineStorage", "flowChartOfflineStorage" },
924 { u"ooxml-irregularSeal1", "irregularSeal1" },
925 { u"ooxml-quadArrow", "quadArrow" },
926 { u"ooxml-leftBrace", "leftBrace" },
927 { u"ooxml-leftBracket", "leftBracket" },
928 { u"ooxml-blockArc", "blockArc" },
929 { u"ooxml-curvedConnector3", "curvedConnector3" },
930 { u"ooxml-wedgeRoundRectCallout", "wedgeRoundRectCallout" },
931 { u"ooxml-actionButtonMovie", "actionButtonMovie" },
932 { u"ooxml-flowChartOnlineStorage", "flowChartOnlineStorage" },
933 { u"ooxml-gear6", "gear6" },
934 { u"ooxml-halfFrame", "halfFrame" },
935 { u"ooxml-snip2SameRect", "snip2SameRect" },
936 { u"ooxml-triangle", "triangle" },
937 { u"ooxml-teardrop", "teardrop" },
938 { u"ooxml-flowChartDocument", "flowChartDocument" },
939 { u"ooxml-rightArrowCallout", "rightArrowCallout" },
940 { u"ooxml-rightBrace", "rightBrace" },
941 { u"ooxml-chartPlus", "chartPlus" },
942 { u"ooxml-flowChartManualInput", "flowChartManualInput" },
943 { u"ooxml-flowChartMerge", "flowChartMerge" },
944 { u"ooxml-line", "line" },
945 { u"ooxml-downArrow", "downArrow" },
946 { u"ooxml-upArrow", "upArrow" },
947 { u"ooxml-curvedDownArrow", "curvedDownArrow" },
948 { u"ooxml-actionButtonReturn", "actionButtonReturn" },
949 { u"ooxml-flowChartInputOutput", "flowChartInputOutput" },
950 { u"ooxml-bracketPair", "bracketPair" },
951 { u"ooxml-smileyFace", "smileyFace" },
952 { u"ooxml-actionButtonBlank", "actionButtonBlank" },
953 { u"ooxml-wave", "wave" },
954 { u"ooxml-swooshArrow", "swooshArrow" },
955 { u"ooxml-flowChartSummingJunction", "flowChartSummingJunction" },
956 { u"ooxml-lightningBolt", "lightningBolt" },
957 { u"ooxml-flowChartDisplay", "flowChartDisplay" },
958 { u"ooxml-actionButtonBackPrevious", "actionButtonBackPrevious" },
959 { u"ooxml-frame", "frame" },
960 { u"ooxml-rtTriangle", "rtTriangle" },
961 { u"ooxml-flowChartMagneticTape", "flowChartMagneticTape" },
962 { u"ooxml-curvedRightArrow", "curvedRightArrow" },
963 { u"ooxml-leftUpArrow", "leftUpArrow" },
964 { u"ooxml-wedgeEllipseCallout", "wedgeEllipseCallout" },
965 { u"ooxml-doubleWave", "doubleWave" },
966 { u"ooxml-bentArrow", "bentArrow" },
967 { u"ooxml-star10", "star10" },
968 { u"ooxml-leftArrow", "leftArrow" },
969 { u"ooxml-curvedUpArrow", "curvedUpArrow" },
970 { u"ooxml-snip1Rect", "snip1Rect" },
971 { u"ooxml-ellipseRibbon2", "ellipseRibbon2" },
972 { u"ooxml-plus", "plus" },
973 { u"ooxml-accentCallout3", "accentCallout3" },
974 { u"ooxml-leftCircularArrow", "leftCircularArrow" },
975 { u"ooxml-rightArrow", "rightArrow" },
976 { u"ooxml-flowChartPunchedCard", "flowChartPunchedCard" },
977 { u"ooxml-snip2DiagRect", "snip2DiagRect" },
978 { u"ooxml-verticalScroll", "verticalScroll" },
979 { u"ooxml-star7", "star7" },
980 { u"ooxml-chartX", "chartX" },
981 { u"ooxml-cloud", "cloud" },
982 { u"ooxml-cube", "cube" },
983 { u"ooxml-round2DiagRect", "round2DiagRect" },
984 { u"ooxml-flowChartMultidocument", "flowChartMultidocument" },
985 { u"ooxml-actionButtonDocument", "actionButtonDocument" },
986 { u"ooxml-flowChartTerminator", "flowChartTerminator" },
987 { u"ooxml-flowChartDelay", "flowChartDelay" },
988 { u"ooxml-curvedConnector5", "curvedConnector5" },
989 { u"ooxml-horizontalScroll", "horizontalScroll" },
990 { u"ooxml-bentConnector4", "bentConnector4" },
991 { u"ooxml-leftRightCircularArrow", "leftRightCircularArrow" },
992 { u"ooxml-wedgeRectCallout", "wedgeRectCallout" },
993 { u"ooxml-accentCallout2", "accentCallout2" },
994 { u"ooxml-flowChartMagneticDrum", "flowChartMagneticDrum" },
995 { u"ooxml-corner", "corner" },
996 { u"ooxml-borderCallout2", "borderCallout2" },
997 { u"ooxml-donut", "donut" },
998 { u"ooxml-flowChartCollate", "flowChartCollate" },
999 { u"ooxml-mathNotEqual", "mathNotEqual" },
1000 { u"ooxml-bentConnector2", "bentConnector2" },
1001 { u"ooxml-mathMultiply", "mathMultiply" },
1002 { u"ooxml-heptagon", "heptagon" },
1003 { u"ooxml-rect", "rect" },
1004 { u"ooxml-accentBorderCallout2", "accentBorderCallout2" },
1005 { u"ooxml-pieWedge", "pieWedge" },
1006 { u"ooxml-upArrowCallout", "upArrowCallout" },
1007 { u"ooxml-flowChartProcess", "flowChartProcess" },
1008 { u"ooxml-star5", "star5" },
1009 { u"ooxml-lineInv", "lineInv" },
1010 { u"ooxml-straightConnector1", "straightConnector1" },
1011 { u"ooxml-stripedRightArrow", "stripedRightArrow" },
1012 { u"ooxml-callout3", "callout3" },
1013 { u"ooxml-bentUpArrow", "bentUpArrow" },
1014 { u"ooxml-noSmoking", "noSmoking" },
1015 { u"ooxml-trapezoid", "trapezoid" },
1016 { u"ooxml-cloudCallout", "cloudCallout" },
1017 { u"ooxml-callout1", "callout1" },
1018 { u"ooxml-ribbon", "ribbon" },
1019 { u"ooxml-rect", "rect" },
1020 };
1021 auto i(aCustomShapeTypeTranslationHashMap.find(rShapeType));
1022 return i == aCustomShapeTypeTranslationHashMap.end() ? "rect" : i->second;
1023}
1024
1025MSO_SPT GETVMLShapeType(std::u16string_view aType)
1026{
1027 typedef std::unordered_map<std::string_view, MSO_SPT> DMLToVMLTranslationHashMap;
1028 static const DMLToVMLTranslationHashMap aDMLToVMLMap{
1029 {"notPrimitive", mso_sptNotPrimitive},
1030 {"rectangle", mso_sptRectangle},
1031 {"roundRectangle", mso_sptRoundRectangle},
1032 {"ellipse", mso_sptEllipse},
1033 {"diamond", mso_sptDiamond},
1034 {"triangle", mso_sptIsocelesTriangle},
1035 {"rtTriangle", mso_sptRightTriangle},
1036 {"parallelogram", mso_sptParallelogram},
1037 {"trapezoid", mso_sptTrapezoid},
1038 {"hexagon", mso_sptHexagon},
1039 {"octagon", mso_sptOctagon},
1040 {"plus", mso_sptPlus},
1041 {"star5", mso_sptStar},
1042 {"rightArrow", mso_sptArrow},
1043 {"thickArrow", mso_sptThickArrow},
1044 {"homePlate", mso_sptHomePlate},
1045 {"cube", mso_sptCube},
1046 {"wedgeRoundRectCallout", mso_sptBalloon},
1047 {"star16", mso_sptSeal},
1048 {"arc", mso_sptArc},
1049 {"line", mso_sptLine},
1050 {"plaque", mso_sptPlaque},
1051 {"can", mso_sptCan},
1052 {"donut", mso_sptDonut},
1053 {"textPlain", mso_sptTextSimple},
1054 {"textStop", mso_sptTextOctagon},
1055 {"textTriangle", mso_sptTextHexagon},
1056 {"textCanDown", mso_sptTextCurve},
1057 {"textWave1", mso_sptTextWave},
1058 {"textArchUpPour", mso_sptTextRing},
1059 {"textCanDown", mso_sptTextOnCurve},
1060 {"textArchUp", mso_sptTextOnRing},
1061 {"straightConnector1", mso_sptStraightConnector1},
1062 {"bentConnector2", mso_sptBentConnector2},
1063 {"bentConnector3", mso_sptBentConnector3},
1064 {"bentConnector4", mso_sptBentConnector4},
1065 {"bentConnector5", mso_sptBentConnector5},
1066 {"curvedConnector2", mso_sptCurvedConnector2},
1067 {"curvedConnector3", mso_sptCurvedConnector3},
1068 {"curvedConnector4", mso_sptCurvedConnector4},
1069 {"curvedConnector5", mso_sptCurvedConnector5},
1070 {"callout1", mso_sptCallout1},
1071 {"callout2", mso_sptCallout2},
1072 {"callout3", mso_sptCallout3},
1073 {"accentCallout1", mso_sptAccentCallout1},
1074 {"accentCallout2", mso_sptAccentCallout2},
1075 {"accentCallout3", mso_sptAccentCallout3},
1076 {"borderCallout1", mso_sptBorderCallout1},
1077 {"borderCallout2", mso_sptBorderCallout2},
1078 {"borderCallout3", mso_sptBorderCallout3},
1079 {"accentBorderCallout1", mso_sptAccentBorderCallout1},
1080 {"accentBorderCallout2", mso_sptAccentBorderCallout2},
1081 {"accentBorderCallout3", mso_sptAccentBorderCallout3},
1082 {"ribbon", mso_sptRibbon},
1083 {"ribbon2", mso_sptRibbon2},
1084 {"chevron", mso_sptChevron},
1085 {"pentagon", mso_sptPentagon},
1086 {"noSmoking", mso_sptNoSmoking},
1087 {"star8", mso_sptSeal8},
1088 {"star16", mso_sptSeal16},
1089 {"star32", mso_sptSeal32},
1090 {"wedgeRectCallout", mso_sptWedgeRectCallout},
1091 {"wedgeRoundRectCallout", mso_sptWedgeRRectCallout},
1092 {"wedgeEllipseCallout", mso_sptWedgeEllipseCallout},
1093 {"wave", mso_sptWave},
1094 {"foldedCorner", mso_sptFoldedCorner},
1095 {"leftArrow", mso_sptLeftArrow},
1096 {"downArrow", mso_sptDownArrow},
1097 {"upArrow", mso_sptUpArrow},
1098 {"leftRightArrow", mso_sptLeftRightArrow},
1099 {"upDownArrow", mso_sptUpDownArrow},
1100 {"irregularSeal1", mso_sptIrregularSeal1},
1101 {"irregularSeal2", mso_sptIrregularSeal2},
1102 {"lightningBolt", mso_sptLightningBolt},
1103 {"heart", mso_sptHeart},
1104 {"pictureFrame", mso_sptPictureFrame},
1105 {"quadArrow", mso_sptQuadArrow},
1106 {"leftArrowCallout", mso_sptLeftArrowCallout},
1107 {"rightArrowCallout", mso_sptRightArrowCallout},
1108 {"upArrowCallout", mso_sptUpArrowCallout},
1109 {"downArrowCallout", mso_sptDownArrowCallout},
1110 {"leftRightArrowCallout", mso_sptLeftRightArrowCallout},
1111 {"upDownArrowCallout", mso_sptUpDownArrowCallout},
1112 {"quadArrowCallout", mso_sptQuadArrowCallout},
1113 {"bevel", mso_sptBevel},
1114 {"leftBracket", mso_sptLeftBracket},
1115 {"rightBracket", mso_sptRightBracket},
1116 {"leftBrace", mso_sptLeftBrace},
1117 {"rightBrace", mso_sptRightBrace},
1118 {"leftUpArrow", mso_sptLeftUpArrow},
1119 {"bentUpArrow", mso_sptBentUpArrow},
1120 {"bentArrow", mso_sptBentArrow},
1121 {"star24", mso_sptSeal24},
1122 {"stripedRightArrow", mso_sptStripedRightArrow},
1123 {"notchedRightArrow", mso_sptNotchedRightArrow},
1124 {"blockArc", mso_sptBlockArc},
1125 {"smileyFace", mso_sptSmileyFace},
1126 {"verticalScroll", mso_sptVerticalScroll},
1127 {"horizontalScroll", mso_sptHorizontalScroll},
1128 {"circularArrow", mso_sptCircularArrow},
1129 {"notchedCircularArrow", mso_sptNotchedCircularArrow},
1130 {"uturnArrow", mso_sptUturnArrow},
1131 {"curvedRightArrow", mso_sptCurvedRightArrow},
1132 {"curvedLeftArrow", mso_sptCurvedLeftArrow},
1133 {"curvedUpArrow", mso_sptCurvedUpArrow},
1134 {"curvedDownArrow", mso_sptCurvedDownArrow},
1135 {"cloudCallout", mso_sptCloudCallout},
1136 {"ellipseRibbon", mso_sptEllipseRibbon},
1137 {"ellipseRibbon2", mso_sptEllipseRibbon2},
1138 {"flowChartProcess", mso_sptFlowChartProcess},
1139 {"flowChartDecision", mso_sptFlowChartDecision},
1140 {"flowChartInputOutput", mso_sptFlowChartInputOutput},
1141 {"flowChartPredefinedProcess", mso_sptFlowChartPredefinedProcess},
1142 {"flowChartInternalStorage", mso_sptFlowChartInternalStorage},
1143 {"flowChartDocument", mso_sptFlowChartDocument},
1144 {"flowChartMultidocument", mso_sptFlowChartMultidocument},
1145 {"flowChartTerminator", mso_sptFlowChartTerminator},
1146 {"flowChartPreparation", mso_sptFlowChartPreparation},
1147 {"flowChartManualInput", mso_sptFlowChartManualInput},
1148 {"flowChartManualOperation", mso_sptFlowChartManualOperation},
1149 {"flowChartConnector", mso_sptFlowChartConnector},
1150 {"flowChartPunchedCard", mso_sptFlowChartPunchedCard},
1151 {"flowChartPunchedTape", mso_sptFlowChartPunchedTape},
1152 {"flowChartSummingJunction", mso_sptFlowChartSummingJunction},
1153 {"flowChartOr", mso_sptFlowChartOr},
1154 {"flowChartCollate", mso_sptFlowChartCollate},
1155 {"flowChartSort", mso_sptFlowChartSort},
1156 {"flowChartExtract", mso_sptFlowChartExtract},
1157 {"flowChartMerge", mso_sptFlowChartMerge},
1158 {"flowChartOfflineStorage", mso_sptFlowChartOfflineStorage},
1159 {"flowChartOnlineStorage", mso_sptFlowChartOnlineStorage},
1160 {"flowChartMagneticTape", mso_sptFlowChartMagneticTape},
1161 {"flowChartMagneticDisk", mso_sptFlowChartMagneticDisk},
1162 {"flowChartMagneticDrum", mso_sptFlowChartMagneticDrum},
1163 {"flowChartDisplay", mso_sptFlowChartDisplay},
1164 {"flowChartDelay", mso_sptFlowChartDelay},
1165 {"textPlain", mso_sptTextPlainText},
1166 {"textStop", mso_sptTextStop},
1167 {"textTriangle", mso_sptTextTriangle},
1168 {"textTriangleInverted", mso_sptTextTriangleInverted},
1169 {"textChevron", mso_sptTextChevron},
1170 {"textChevronInverted", mso_sptTextChevronInverted},
1171 {"textRingInside", mso_sptTextRingInside},
1172 {"textRingOutside", mso_sptTextRingOutside},
1173 {"textArchUp", mso_sptTextArchUpCurve},
1174 {"textArchDown", mso_sptTextArchDownCurve},
1175 {"textCircle", mso_sptTextCircleCurve},
1176 {"textButton", mso_sptTextButtonCurve},
1177 {"textArchUpPour", mso_sptTextArchUpPour},
1178 {"textArchDownPour", mso_sptTextArchDownPour},
1179 {"textCirclePour", mso_sptTextCirclePour},
1180 {"textButtonPour", mso_sptTextButtonPour},
1181 {"textCurveUp", mso_sptTextCurveUp},
1182 {"textCurveDown", mso_sptTextCurveDown},
1183 {"textCascadeUp", mso_sptTextCascadeUp},
1184 {"textCascadeDown", mso_sptTextCascadeDown},
1185 {"textWave1", mso_sptTextWave1},
1186 {"textWave2", mso_sptTextWave2},
1187 {"textWave3", mso_sptTextWave3},
1188 {"textWave4", mso_sptTextWave4},
1189 {"textInflate", mso_sptTextInflate},
1190 {"textDeflate", mso_sptTextDeflate},
1191 {"textInflateBottom", mso_sptTextInflateBottom},
1192 {"textDeflateBottom", mso_sptTextDeflateBottom},
1193 {"textInflateTop", mso_sptTextInflateTop},
1194 {"textDeflateTop", mso_sptTextDeflateTop},
1195 {"textDeflateInflate", mso_sptTextDeflateInflate},
1196 {"textDeflateInflateDeflate", mso_sptTextDeflateInflateDeflate},
1197 {"textFadeRight", mso_sptTextFadeRight},
1198 {"textFadeLeft", mso_sptTextFadeLeft},
1199 {"textFadeUp", mso_sptTextFadeUp},
1200 {"textFadeDown", mso_sptTextFadeDown},
1201 {"textSlantUp", mso_sptTextSlantUp},
1202 {"textSlantDown", mso_sptTextSlantDown},
1203 {"textCanUp", mso_sptTextCanUp},
1204 {"textCanDown", mso_sptTextCanDown},
1205 {"flowChartAlternateProcess", mso_sptFlowChartAlternateProcess},
1206 {"flowChartOffpageConnector", mso_sptFlowChartOffpageConnector},
1207 {"callout1", mso_sptCallout90},
1208 {"accentCallout1", mso_sptAccentCallout90},
1209 {"borderCallout1", mso_sptBorderCallout90},
1210 {"accentBorderCallout1", mso_sptAccentBorderCallout90},
1211 {"leftRightUpArrow", mso_sptLeftRightUpArrow},
1212 {"sun", mso_sptSun},
1213 {"moon", mso_sptMoon},
1214 {"bracketPair", mso_sptBracketPair},
1215 {"bracePair", mso_sptBracePair},
1216 {"star4", mso_sptSeal4},
1217 {"doubleWave", mso_sptDoubleWave},
1218 {"actionButtonBlank", mso_sptActionButtonBlank},
1219 {"actionButtonHome", mso_sptActionButtonHome},
1220 {"actionButtonHelp", mso_sptActionButtonHelp},
1221 {"actionButtonInformation", mso_sptActionButtonInformation},
1222 {"actionButtonForwardNext", mso_sptActionButtonForwardNext},
1223 {"actionButtonBackPrevious", mso_sptActionButtonBackPrevious},
1224 {"actionButtonEnd", mso_sptActionButtonEnd},
1225 {"actionButtonBeginning", mso_sptActionButtonBeginning},
1226 {"actionButtonReturn", mso_sptActionButtonReturn},
1227 {"actionButtonDocument", mso_sptActionButtonDocument},
1228 {"actionButtonSound", mso_sptActionButtonSound},
1229 {"actionButtonMovie", mso_sptActionButtonMovie},
1230 {"hostControl", mso_sptHostControl},
1231 {"textBox", mso_sptTextBox},
1232 };
1233
1234 auto i(aDMLToVMLMap.find(GetOOXMLPresetGeometry(aType)));
1235 return i == aDMLToVMLMap.end() ? mso_sptNil : i->second;
1236}
1237
1238bool HasTextBoxContent(sal_uInt32 nShapeType)
1239{
1240 switch (nShapeType)
1241 {
1245 return false;
1246 default:
1247 return true;
1248 }
1249}
1250
1251namespace
1252{
1253
1254// Scheme means pattern of chromatic values.
1255// [2,2,1] -> red and green are approximately equal and blue is the dominant color (e.g. blue)
1256// [1,1,1] -> all chromatic values are approximately equal (e.g. white, gray, black)
1257void CalculateScheme(const BitmapColor& rBitmapColor, std::vector<int> &vScheme, sal_uInt16 nVariance)
1258{
1259 vScheme.resize(3,1);
1260 if( rBitmapColor.GetRed() < rBitmapColor.GetGreen() + nVariance )
1261 ++vScheme[0];
1262 if( rBitmapColor.GetRed() < rBitmapColor.GetBlue() + nVariance )
1263 ++vScheme[0];
1264 if( rBitmapColor.GetGreen() < rBitmapColor.GetRed() + nVariance )
1265 ++vScheme[1];
1266 if( rBitmapColor.GetGreen() < rBitmapColor.GetBlue() + nVariance )
1267 ++vScheme[1];
1268 if( rBitmapColor.GetBlue() < rBitmapColor.GetRed() + nVariance )
1269 ++vScheme[2];
1270 if( rBitmapColor.GetBlue() < rBitmapColor.GetGreen() + nVariance )
1271 ++vScheme[2];
1272}
1273
1274bool HasSimilarScheme(const BitmapColor& rBitmapColor1, const BitmapColor& rBitmapColor2, sal_uInt16 nVariance)
1275{
1276 std::vector<int> vScheme1, vScheme2;
1277 CalculateScheme(rBitmapColor1, vScheme1, nVariance);
1278 CalculateScheme(rBitmapColor2, vScheme2, nVariance);
1279 for( int i = 0; i < 3; ++i )
1280 {
1281 if( vScheme1[i] != vScheme2[i] )
1282 return false;
1283 }
1284 return true;
1285}
1286
1287// Find the best match in the color palette using scheme of the input color
1288sal_uInt16 GetBestIndex(const BitmapPalette& rPalette, const BitmapColor& rBitmapColor)
1289{
1290 sal_uInt16 nReturn = 0;
1291 sal_uInt16 nLastErr = SAL_MAX_UINT16;
1292 bool bFound = false;
1293
1294 // Prefer those colors which have similar scheme as the input
1295 // Allow bigger and bigger variance of the schemes until we find
1296 // a color in the palette with similar scheme.
1297 for( sal_uInt16 nVariance = 0; nVariance <= 255; ++nVariance )
1298 {
1299 for( sal_uInt16 i = 0; i < rPalette.GetEntryCount(); ++i )
1300 {
1301 if( HasSimilarScheme(rBitmapColor, rPalette[i], nVariance) )
1302 {
1303 const sal_uInt16 nActErr = rBitmapColor.GetColorError( rPalette[i] );
1304 if( nActErr < nLastErr )
1305 {
1306 nLastErr = nActErr;
1307 nReturn = i;
1308 bFound = true;
1309 }
1310 }
1311 }
1312 if( bFound )
1313 return nReturn;
1314 }
1315 return nReturn;
1316}
1317}
1318
1320{
1321 sal_uInt8 nCol = 0; // ->Auto
1322 switch( sal_uInt32(rCol) )
1323 {
1324 case sal_uInt32(COL_BLACK): nCol = 1; break;
1325 case sal_uInt32(COL_BLUE): nCol = 9; break;
1326 case sal_uInt32(COL_GREEN): nCol = 11; break;
1327 case sal_uInt32(COL_CYAN): nCol = 10; break;
1328 case sal_uInt32(COL_RED): nCol = 13; break;
1329 case sal_uInt32(COL_MAGENTA): nCol = 12; break;
1330 case sal_uInt32(COL_BROWN): nCol = 14; break;
1331 case sal_uInt32(COL_GRAY): nCol = 15; break;
1332 case sal_uInt32(COL_LIGHTGRAY): nCol = 16; break;
1333 case sal_uInt32(COL_LIGHTBLUE): nCol = 2; break;
1334 case sal_uInt32(COL_LIGHTGREEN): nCol = 4; break;
1335 case sal_uInt32(COL_LIGHTCYAN): nCol = 3; break;
1336 case sal_uInt32(COL_LIGHTRED): nCol = 6; break;
1337 case sal_uInt32(COL_LIGHTMAGENTA): nCol = 5; break;
1338 case sal_uInt32(COL_YELLOW): nCol = 7; break;
1339 case sal_uInt32(COL_WHITE): nCol = 8; break;
1340 case sal_uInt32(COL_AUTO): nCol = 0; break;
1341
1342 default:
1343 static const BitmapPalette aBmpPal {
1348 };
1349
1350 nCol = static_cast< sal_uInt8 >(GetBestIndex(aBmpPal, rCol) + 1);
1351 break;
1352 }
1353 return nCol;
1354}
1355
1356}
1357
1358/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 GetEntryCount() const
sal_uInt8 GetBlue() const
sal_uInt8 GetRed() const
sal_uInt8 GetGreen() const
static const ApiPaperSize & getApiSizeForMSPaperSizeIndex(sal_Int32 nMSOPaperIndex)
Definition: util.cxx:308
static sal_Int32 getMSPaperSizeIndex(const css::awt::Size &rSize)
Definition: util.cxx:274
sal_Int32 FindNextStringPiece(sal_Int32 _nStart=-1)
Definition: util.cxx:433
OUString GetResult() const
Definition: util.cxx:378
WW8ReadFieldParams(OUString aData)
Definition: util.cxx:351
bool GetTokenSttFromTo(sal_Int32 *_pFrom, sal_Int32 *_pTo, sal_Int32 _nMax)
Definition: util.cxx:498
sal_Int32 GetTokenSttPtr() const
Definition: util.hxx:103
constexpr ::Color COL_LIGHTRED(0xFF, 0x00, 0x00)
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
constexpr ::Color COL_GREEN(0x00, 0x80, 0x00)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTCYAN(0x00, 0xFF, 0xFF)
constexpr ::Color COL_MAGENTA(0x80, 0x00, 0x80)
constexpr ::Color COL_LIGHTMAGENTA(0xFF, 0x00, 0xFF)
constexpr ::Color COL_BROWN(0x80, 0x80, 0x00)
constexpr ::Color COL_YELLOW(0xFF, 0xFF, 0x00)
constexpr ::Color COL_RED(0x80, 0x00, 0x00)
ColorTransparency
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
constexpr ::Color COL_CYAN(0x00, 0x80, 0x80)
constexpr ::Color COL_LIGHTGREEN(0x00, 0xFF, 0x00)
constexpr ::Color COL_BLUE(0x00, 0x00, 0x80)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
TestData _aData
float u
#define ESCHER_ShpInst_TextDeflateInflateDeflate
Definition: escherex.hxx:118
#define ESCHER_ShpInst_TextPlainText
Definition: escherex.hxx:117
#define ESCHER_ShpInst_TextSlantUp
Definition: escherex.hxx:119
UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont * CreateStarSymbolToMSMultiFont()
sal_Int32 nIndex
OUString aName
sal_Int64 n
#define SAL_N_ELEMENTS(arr)
int n2
MSO_SPT
mso_sptSun
mso_sptAccentCallout90
mso_sptFlowChartConnector
mso_sptFlowChartMagneticDisk
mso_sptCircularArrow
mso_sptNotchedRightArrow
mso_sptTextChevronInverted
mso_sptTextFadeDown
mso_sptCurvedUpArrow
mso_sptNotchedCircularArrow
mso_sptTextRingOutside
mso_sptFlowChartDisplay
mso_sptFlowChartManualOperation
mso_sptBalloon
mso_sptTextCascadeDown
mso_sptCallout3
mso_sptSeal4
mso_sptTextFadeRight
mso_sptUpDownArrow
mso_sptRightBracket
mso_sptTextDeflateInflate
mso_sptTextCurveUp
mso_sptPlus
mso_sptActionButtonBlank
mso_sptBorderCallout2
mso_sptRoundRectangle
mso_sptFlowChartOnlineStorage
mso_sptTextArchUpPour
mso_sptTextArchDownPour
mso_sptTextWave
mso_sptAccentBorderCallout2
mso_sptTextSlantUp
mso_sptLeftRightArrow
mso_sptMoon
mso_sptTextChevron
mso_sptTextWave3
mso_sptAccentBorderCallout1
mso_sptActionButtonMovie
mso_sptThickArrow
mso_sptDoubleWave
mso_sptFlowChartPredefinedProcess
mso_sptDiamond
mso_sptWedgeRectCallout
mso_sptLeftUpArrow
mso_sptEllipseRibbon2
mso_sptTrapezoid
mso_sptFlowChartInternalStorage
mso_sptWave
mso_sptFlowChartSort
mso_sptLeftBrace
mso_sptCallout1
mso_sptCloudCallout
mso_sptFlowChartOffpageConnector
mso_sptTextArchUpCurve
mso_sptUturnArrow
mso_sptFlowChartMagneticDrum
mso_sptFlowChartManualInput
mso_sptQuadArrow
mso_sptActionButtonSound
mso_sptUpDownArrowCallout
mso_sptDonut
mso_sptRightBrace
mso_sptBorderCallout3
mso_sptIrregularSeal2
mso_sptTextButtonPour
mso_sptStripedRightArrow
mso_sptCallout2
mso_sptTextSlantDown
mso_sptBracePair
mso_sptTextWave1
mso_sptTextDeflateInflateDeflate
mso_sptFlowChartExtract
mso_sptLeftArrow
mso_sptLine
mso_sptPentagon
mso_sptTextCascadeUp
mso_sptFlowChartTerminator
mso_sptFlowChartMagneticTape
mso_sptRibbon2
mso_sptPictureFrame
mso_sptEllipse
mso_sptTextCirclePour
mso_sptTextDeflate
mso_sptSmileyFace
mso_sptNoSmoking
mso_sptDownArrowCallout
mso_sptAccentCallout1
mso_sptStraightConnector1
mso_sptTextArchDownCurve
mso_sptFlowChartOr
mso_sptRightArrowCallout
mso_sptTextPlainText
mso_sptFlowChartPreparation
mso_sptTextOnCurve
mso_sptFlowChartPunchedCard
mso_sptLeftBracket
mso_sptBevel
mso_sptHeart
mso_sptHostControl
mso_sptCurvedConnector5
mso_sptPlaque
mso_sptQuadArrowCallout
mso_sptDownArrow
mso_sptLeftRightUpArrow
mso_sptActionButtonReturn
mso_sptFlowChartMerge
mso_sptArrow
mso_sptTextHexagon
mso_sptAccentBorderCallout90
mso_sptTextWave2
mso_sptTextInflate
mso_sptHorizontalScroll
mso_sptUpArrow
mso_sptRightTriangle
mso_sptWedgeEllipseCallout
mso_sptTextCanDown
mso_sptBentArrow
mso_sptFlowChartOfflineStorage
mso_sptSeal8
mso_sptNotPrimitive
mso_sptBentUpArrow
mso_sptCurvedConnector3
mso_sptCurvedConnector4
mso_sptBentConnector4
mso_sptAccentBorderCallout3
mso_sptTextBox
mso_sptBentConnector3
mso_sptSeal32
mso_sptActionButtonHome
mso_sptTextCurveDown
mso_sptFlowChartCollate
mso_sptFlowChartInputOutput
mso_sptCurvedRightArrow
mso_sptTextCircleCurve
mso_sptFlowChartDecision
mso_sptTextFadeLeft
mso_sptBentConnector5
mso_sptFlowChartDelay
mso_sptChevron
mso_sptFlowChartDocument
mso_sptFoldedCorner
mso_sptFlowChartProcess
mso_sptIrregularSeal1
mso_sptCallout90
mso_sptCurvedLeftArrow
mso_sptSeal16
mso_sptActionButtonDocument
mso_sptCan
mso_sptOctagon
mso_sptWedgeRRectCallout
mso_sptEllipseRibbon
mso_sptTextRingInside
mso_sptTextRing
mso_sptBorderCallout90
mso_sptCube
mso_sptRectangle
mso_sptTextDeflateTop
mso_sptFlowChartAlternateProcess
mso_sptTextOnRing
mso_sptTextSimple
mso_sptBlockArc
mso_sptActionButtonForwardNext
mso_sptActionButtonBeginning
mso_sptActionButtonInformation
mso_sptNil
mso_sptSeal24
mso_sptArc
mso_sptActionButtonEnd
mso_sptFlowChartSummingJunction
mso_sptTextButtonCurve
mso_sptTextOctagon
mso_sptIsocelesTriangle
mso_sptTextFadeUp
mso_sptParallelogram
mso_sptTextCanUp
mso_sptTextInflateTop
mso_sptUpArrowCallout
mso_sptLightningBolt
mso_sptTextDeflateBottom
mso_sptTextWave4
mso_sptActionButtonHelp
mso_sptBracketPair
mso_sptCurvedDownArrow
mso_sptVerticalScroll
mso_sptCurvedConnector2
mso_sptFlowChartPunchedTape
mso_sptTextTriangle
mso_sptTextInflateBottom
mso_sptTextCurve
mso_sptFlowChartMultidocument
mso_sptHomePlate
mso_sptAccentCallout2
mso_sptHexagon
mso_sptTextTriangleInverted
mso_sptLeftRightArrowCallout
mso_sptActionButtonBackPrevious
mso_sptStar
mso_sptBorderCallout1
mso_sptTextStop
mso_sptLeftArrowCallout
mso_sptRibbon
mso_sptAccentCallout3
mso_sptSeal
mso_sptBentConnector2
constexpr OUStringLiteral aData
AUTO
int i
Definition: gentoken.py:48
string t
Definition: gentoken.py:33
::Color BGRToRGB(sal_uInt32 nColor)
Convert a color in BGR format to RGB.
Definition: util.cxx:49
const ApiPaperSize spPaperSizeTable[]
Definition: util.cxx:174
static EquationResult Read_SubF_Combined(WW8ReadFieldParams &rReadParam)
Definition: util.cxx:521
OUString ConvertColorOU(const Color &rColor)
Definition: util.cxx:150
DateTime DTTM2DateTime(tools::Long lDTTM)
Convert from DTTM to Writer's DateTime.
Definition: util.cxx:59
std::u16string_view findQuotedText(std::u16string_view rCommand, std::u16string_view sStartQuote, const sal_Unicode uEndQuote)
Finds the quoted text in a field instruction text.
Definition: util.cxx:333
OString ConvertColor(const Color &rColor)
Converts tools Color to HTML color (without leading hashmark).
Definition: util.cxx:130
rtl_TextEncoding getBestTextEncodingFromLocale(const css::lang::Locale &rLocale)
Returns the best-fit default 8bit encoding for a given locale i.e.
Definition: util.cxx:27
bool HasTextBoxContent(sal_uInt32 nShapeType)
The following function checks if a MSO shapetype is allowed to have textboxcontent.
Definition: util.cxx:1238
sal_uInt8 TransColToIco(const Color &rCol)
Convert the input color value to an ico value (0..16)
Definition: util.cxx:1319
EquationResult ParseCombinedChars(const OUString &rStr)
Definition: util.cxx:615
sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cChar, rtl_TextEncoding &rChrSet, OUString &rFontName)
Convert DateTime to xsd::dateTime string.
Definition: util.cxx:92
OUString CreateDOCXStyleId(std::u16string_view const aName)
Definition: util.cxx:315
OString GetOOXMLPresetGeometry(std::u16string_view rShapeType)
Similar to EnhancedCustomShapeTypeNames::Get(), but it also supports OOXML types and returns a drawin...
Definition: util.cxx:625
MSO_SPT GETVMLShapeType(std::u16string_view aType)
Similar to EnhancedCustomShapeTypeNames::Get(), but returns an MSO_SPT (binary / VML type).
Definition: util.cxx:1025
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
long Long
Paper size in 1/100 millimeters.
Definition: util.hxx:70
unsigned char sal_uInt8
#define SAL_MAX_UINT16
sal_uInt16 sal_Unicode
#define IN2MM100(v)
Definition: util.cxx:170
#define MM2MM100(v)
Definition: util.cxx:171