tdf#35361 Add a Quick Look plugins for .od* files on macOS
[LibreOffice.git] / sw / source / core / doc / SwStyleNameMapper.cxx
blobb89dec6d6e6f47ece4ea5c03bcfa036cc64ea480
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <SwStyleNameMapper.hxx>
21 #include <poolfmt.hxx>
22 #include <strings.hrc>
23 #include <swtypes.hxx>
24 #include <unotools/syslocale.hxx>
25 #include <i18nlangtag/languagetag.hxx>
26 #include <o3tl/string_view.hxx>
27 #include <map>
29 #ifdef _NEED_TO_DEBUG_MAPPING
30 #include <stdlib.h>
31 #endif
33 namespace
36 const OUString &
37 lcl_GetSpecialExtraName(const OUString& rExtraName, const bool bIsUIName )
39 const std::vector<OUString>& rExtraArr = bIsUIName
40 ? SwStyleNameMapper::GetExtraUINameArray()
41 : SwStyleNameMapper::GetExtraProgNameArray();
42 static const sal_uInt16 nIds[] =
44 RES_POOLCOLL_LABEL_DRAWING - RES_POOLCOLL_EXTRA_BEGIN,
45 RES_POOLCOLL_LABEL_ABB - RES_POOLCOLL_EXTRA_BEGIN,
46 RES_POOLCOLL_LABEL_TABLE - RES_POOLCOLL_EXTRA_BEGIN,
47 RES_POOLCOLL_LABEL_FRAME- RES_POOLCOLL_EXTRA_BEGIN,
48 RES_POOLCOLL_LABEL_FIGURE-RES_POOLCOLL_EXTRA_BEGIN,
51 const sal_uInt16 * pIds;
52 for ( pIds = nIds; *pIds; ++pIds)
54 if (rExtraName == rExtraArr[ *pIds ])
56 return bIsUIName
57 ? SwStyleNameMapper::GetExtraProgNameArray()[*pIds]
58 : SwStyleNameMapper::GetExtraUINameArray()[*pIds];
61 return rExtraName;
64 bool lcl_SuffixIsUser(std::u16string_view rString)
66 // Interesting, why the rest must be longer than 1 character? It is so
67 // since commit 4fbc9dd48b7cebb304010e7337b1bbc3936c7923 (2001-08-16)
68 return rString.size() > 8 && o3tl::ends_with(rString, u" (user)");
71 void lcl_CheckSuffixAndDelete(OUString & rString)
73 if (lcl_SuffixIsUser(rString))
75 rString = rString.copy(0, rString.getLength() - 7);
79 NameToIdHash HashFromRange(sal_uInt16 nAcc) { return NameToIdHash(nAcc); }
80 template <typename... Rest>
81 NameToIdHash HashFromRange(sal_uInt16 nAcc, sal_uInt16 nBegin, sal_uInt16 nEnd,
82 const std::vector<OUString>& (*pFunc)(), Rest... rest)
84 NameToIdHash hash(HashFromRange(nAcc + nEnd - nBegin, rest...));
85 sal_uInt16 nIndex, nId;
86 const std::vector<OUString>& rStrings = pFunc();
87 for (nIndex = 0, nId = nBegin; nId < nEnd; nId++, nIndex++)
88 hash[rStrings[nIndex]] = nId;
89 return hash;
92 template <auto initFunc> struct TablePair
94 static const NameToIdHash& getMap(bool bProgName)
96 if (bProgName)
98 static const NameToIdHash s_aProgMap(initFunc(true));
99 return s_aProgMap;
102 SvtSysLocale aSysLocale;
103 const LanguageTag& rCurrentLanguage = aSysLocale.GetUILanguageTag();
104 static std::map<LanguageTag, NameToIdHash> s_aUIMap;
106 auto it = s_aUIMap.find(rCurrentLanguage);
107 if (it == s_aUIMap.end())
108 it = s_aUIMap.emplace(rCurrentLanguage, initFunc(false)).first;
110 return it->second;
114 NameToIdHash GetParaMap (bool bProgName)
116 return HashFromRange(0,
117 RES_POOLCOLL_TEXT_BEGIN, RES_POOLCOLL_TEXT_END, bProgName ? &SwStyleNameMapper::GetTextProgNameArray : &SwStyleNameMapper::GetTextUINameArray,
118 RES_POOLCOLL_LISTS_BEGIN, RES_POOLCOLL_LISTS_END, bProgName ? &SwStyleNameMapper::GetListsProgNameArray : &SwStyleNameMapper::GetListsUINameArray,
119 RES_POOLCOLL_EXTRA_BEGIN, RES_POOLCOLL_EXTRA_END, bProgName ? &SwStyleNameMapper::GetExtraProgNameArray : &SwStyleNameMapper::GetExtraUINameArray,
120 RES_POOLCOLL_REGISTER_BEGIN, RES_POOLCOLL_REGISTER_END, bProgName ? &SwStyleNameMapper::GetRegisterProgNameArray : &SwStyleNameMapper::GetRegisterUINameArray,
121 RES_POOLCOLL_DOC_BEGIN, RES_POOLCOLL_DOC_END, bProgName ? &SwStyleNameMapper::GetDocProgNameArray : &SwStyleNameMapper::GetDocUINameArray,
122 RES_POOLCOLL_HTML_BEGIN, RES_POOLCOLL_HTML_END, bProgName ? &SwStyleNameMapper::GetHTMLProgNameArray : &SwStyleNameMapper::GetHTMLUINameArray
126 NameToIdHash GetCharMap(bool bProgName)
128 return HashFromRange(0,
129 RES_POOLCHR_NORMAL_BEGIN, RES_POOLCHR_NORMAL_END, bProgName ? &SwStyleNameMapper::GetChrFormatProgNameArray : &SwStyleNameMapper::GetChrFormatUINameArray,
130 RES_POOLCHR_HTML_BEGIN, RES_POOLCHR_HTML_END, bProgName ? &SwStyleNameMapper::GetHTMLChrFormatProgNameArray : &SwStyleNameMapper::GetHTMLChrFormatUINameArray
134 NameToIdHash GetFrameMap(bool bProgName)
136 return HashFromRange(0,
137 RES_POOLFRM_BEGIN, RES_POOLFRM_END, bProgName ? &SwStyleNameMapper::GetFrameFormatProgNameArray : &SwStyleNameMapper::GetFrameFormatUINameArray
141 NameToIdHash GetPageMap(bool bProgName)
143 return HashFromRange(0,
144 RES_POOLPAGE_BEGIN, RES_POOLPAGE_END, bProgName ? &SwStyleNameMapper::GetPageDescProgNameArray : &SwStyleNameMapper::GetPageDescUINameArray
148 NameToIdHash GetNumRuleMap(bool bProgName)
150 return HashFromRange(0,
151 RES_POOLNUMRULE_BEGIN, RES_POOLNUMRULE_END, bProgName ? &SwStyleNameMapper::GetNumRuleProgNameArray : &SwStyleNameMapper::GetNumRuleUINameArray
155 NameToIdHash GetTableStyleMap(bool bProgName)
157 return HashFromRange(0,
158 RES_POOLTABLESTYLE_BEGIN, RES_POOLTABLESTYLE_END, bProgName ? &SwStyleNameMapper::GetTableStyleProgNameArray : &SwStyleNameMapper::GetTableStyleUINameArray
162 NameToIdHash GetCellStyleMap(bool bProgName)
164 return HashFromRange(0,
165 RES_POOLCELLSTYLE_BEGIN, RES_POOLCELLSTYLE_END, bProgName ? &SwStyleNameMapper::GetCellStyleProgNameArray : &SwStyleNameMapper::GetCellStyleUINameArray
169 } // namespace
171 #ifdef _NEED_TO_DEBUG_MAPPING
172 void SwStyleNameMapper::testNameTable( SwGetPoolIdFromName const nFamily, sal_uInt16 const nStartIndex, sal_uInt16 const nEndIndex )
174 sal_uInt16 nIndex;
175 sal_uInt16 nId;
177 for ( nIndex = 0, nId = nStartIndex ; nId < nEndIndex ; nId++,nIndex++ )
179 OUString aString, bString;
180 FillUIName ( nId, aString );
181 bString = GetProgName ( nFamily, aString );
182 sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nFamily );
183 FillProgName ( nNewId, aString );
184 bString = GetUIName ( aString, nFamily );
185 nNewId = GetPoolIdFromUIName ( aString, nFamily );
186 if ( nNewId != nId )
187 abort();
190 #endif
192 const NameToIdHash & SwStyleNameMapper::getHashTable ( SwGetPoolIdFromName eFlags, bool bProgName )
194 #ifdef _NEED_TO_DEBUG_MAPPING
195 static bool bTested = false;
196 if ( !bTested )
198 bTested = true;
200 testNameTable( SwGetPoolIdFromName::TxtColl, RES_POOLCOLL_TEXT_BEGIN, RES_POOLCOLL_TEXT_END );
201 testNameTable( SwGetPoolIdFromName::TxtColl, RES_POOLCOLL_LISTS_BEGIN, RES_POOLCOLL_LISTS_END );
202 testNameTable( SwGetPoolIdFromName::TxtColl, RES_POOLCOLL_EXTRA_BEGIN, RES_POOLCOLL_EXTRA_END );
203 testNameTable( SwGetPoolIdFromName::TxtColl, RES_POOLCOLL_REGISTER_BEGIN, RES_POOLCOLL_REGISTER_END );
204 testNameTable( SwGetPoolIdFromName::TxtColl, RES_POOLCOLL_DOC_BEGIN, RES_POOLCOLL_DOC_END );
205 testNameTable( SwGetPoolIdFromName::TxtColl, RES_POOLCOLL_HTML_BEGIN, RES_POOLCOLL_HTML_END );
206 testNameTable( SwGetPoolIdFromName::ChrFmt, RES_POOLCHR_NORMAL_BEGIN, RES_POOLCHR_NORMAL_END );
207 testNameTable( SwGetPoolIdFromName::ChrFmt, RES_POOLCHR_HTML_BEGIN, RES_POOLCHR_HTML_END );
208 testNameTable( SwGetPoolIdFromName::FrmFmt, RES_POOLFRM_BEGIN, RES_POOLFRM_END );
209 testNameTable( SwGetPoolIdFromName::PageDesc, RES_POOLPAGE_BEGIN, RES_POOLPAGE_END );
210 testNameTable( SwGetPoolIdFromName::NumRule, RES_POOLNUMRULE_BEGIN, RES_POOLNUMRULE_END );
212 #endif
214 switch ( eFlags )
216 case SwGetPoolIdFromName::TxtColl:
217 return TablePair<GetParaMap>::getMap(bProgName);
218 case SwGetPoolIdFromName::ChrFmt:
219 return TablePair<GetCharMap>::getMap(bProgName);
220 case SwGetPoolIdFromName::FrmFmt:
221 return TablePair<GetFrameMap>::getMap(bProgName);
222 case SwGetPoolIdFromName::PageDesc:
223 return TablePair<GetPageMap>::getMap(bProgName);
224 case SwGetPoolIdFromName::NumRule:
225 return TablePair<GetNumRuleMap>::getMap(bProgName);
226 case SwGetPoolIdFromName::TabStyle:
227 return TablePair<GetTableStyleMap>::getMap(bProgName);
228 case SwGetPoolIdFromName::CellStyle:
229 return TablePair<GetCellStyleMap>::getMap(bProgName);
232 assert(false); // must not reach here
233 abort();
236 // This gets the UI name from the programmatic name
237 const OUString& SwStyleNameMapper::GetUIName(const OUString& rName,
238 SwGetPoolIdFromName const eFlags)
240 sal_uInt16 nId = GetPoolIdFromProgName ( rName, eFlags );
241 return nId != USHRT_MAX ? GetUIName( nId, rName ) : rName;
244 // Get the programmatic name from the UI name
245 const OUString& SwStyleNameMapper::GetProgName(
246 const OUString& rName, SwGetPoolIdFromName const eFlags)
248 sal_uInt16 nId = GetPoolIdFromUIName ( rName, eFlags );
249 return nId != USHRT_MAX ? GetProgName( nId, rName ) : rName;
252 // Get the programmatic name from the UI name in rName and put it into rFillName
253 void SwStyleNameMapper::FillProgName(
254 const OUString& rName, OUString& rFillName,
255 SwGetPoolIdFromName const eFlags)
257 sal_uInt16 nId = GetPoolIdFromUIName ( rName, eFlags );
258 if ( nId == USHRT_MAX )
260 // rName isn't in our UI name table...check if it's in the programmatic one
261 nId = GetPoolIdFromProgName ( rName, eFlags );
263 rFillName = rName;
264 if (nId == USHRT_MAX )
266 if (eFlags != SwGetPoolIdFromName::TabStyle)
268 // check if it has a " (user)" suffix, if so remove it
269 lcl_CheckSuffixAndDelete(rFillName);
271 else // FIXME don't do this
273 // It isn't ...make sure the suffix isn't already " (user)"...if it is,
274 // we need to add another one
275 if (lcl_SuffixIsUser(rFillName))
276 rFillName += " (user)";
279 else
281 // It's in the programmatic name table...append suffix
282 rFillName += " (user)";
285 else
287 // If we aren't trying to disambiguate, then just do a normal fill
288 fillNameFromId(nId, rFillName, true);
291 if (eFlags == SwGetPoolIdFromName::ChrFmt && rName == SwResId(STR_POOLCHR_STANDARD))
292 rFillName = "Standard";
295 // Get the UI name from the programmatic name in rName and put it into rFillName
296 void SwStyleNameMapper::FillUIName(
297 const OUString& rName, OUString& rFillName,
298 SwGetPoolIdFromName const eFlags)
300 OUString aName = rName;
301 if (eFlags == SwGetPoolIdFromName::ChrFmt && rName == "Standard")
302 aName = SwResId(STR_POOLCHR_STANDARD);
304 sal_uInt16 nId = GetPoolIdFromProgName ( aName, eFlags );
305 if ( nId == USHRT_MAX )
307 rFillName = aName;
308 // TabStyle: unfortunately ODF documents with UIName table styles exist
309 if (eFlags == SwGetPoolIdFromName::TabStyle || // see testTdf129568ui
310 GetPoolIdFromUIName(aName, eFlags) == USHRT_MAX)
312 // aName isn't in our Prog name table...check if it has a " (user)" suffix, if so remove it
313 lcl_CheckSuffixAndDelete(rFillName);
315 else
317 rFillName += " (user)";
320 else
322 // If we aren't trying to disambiguate, then just do a normal fill
323 fillNameFromId(nId, rFillName, false);
327 const OUString& SwStyleNameMapper::getNameFromId(
328 sal_uInt16 const nId, const OUString& rFillName, bool const bProgName)
330 sal_uInt16 nStt = 0;
331 const std::vector<OUString>* pStrArr = nullptr;
333 switch( (USER_FMT | COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID) & nId )
335 case COLL_TEXT_BITS:
336 if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
338 pStrArr = bProgName ? &GetTextProgNameArray() : &GetTextUINameArray();
339 nStt = RES_POOLCOLL_TEXT_BEGIN;
341 break;
342 case COLL_LISTS_BITS:
343 if( RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END )
345 pStrArr = bProgName ? &GetListsProgNameArray() : &GetListsUINameArray();
346 nStt = RES_POOLCOLL_LISTS_BEGIN;
348 break;
349 case COLL_EXTRA_BITS:
350 if( RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END )
352 pStrArr = bProgName ? &GetExtraProgNameArray() : &GetExtraUINameArray();
353 nStt = RES_POOLCOLL_EXTRA_BEGIN;
355 break;
356 case COLL_REGISTER_BITS:
357 if( RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END )
359 pStrArr = bProgName ? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
360 nStt = RES_POOLCOLL_REGISTER_BEGIN;
362 break;
363 case COLL_DOC_BITS:
364 if( RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END )
366 pStrArr = bProgName ? &GetDocProgNameArray() : &GetDocUINameArray();
367 nStt = RES_POOLCOLL_DOC_BEGIN;
369 break;
370 case COLL_HTML_BITS:
371 if( RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END )
373 pStrArr = bProgName ? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
374 nStt = RES_POOLCOLL_HTML_BEGIN;
376 break;
377 case POOLGRP_CHARFMT:
378 if( RES_POOLCHR_NORMAL_BEGIN <= nId && nId < RES_POOLCHR_NORMAL_END )
380 pStrArr = bProgName ? &GetChrFormatProgNameArray() : &GetChrFormatUINameArray();
381 nStt = RES_POOLCHR_NORMAL_BEGIN;
383 else if( RES_POOLCHR_HTML_BEGIN <= nId && nId < RES_POOLCHR_HTML_END )
385 pStrArr = bProgName ? &GetHTMLChrFormatProgNameArray() : &GetHTMLChrFormatUINameArray();
386 nStt = RES_POOLCHR_HTML_BEGIN;
388 break;
389 case POOLGRP_FRAMEFMT:
390 if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
392 pStrArr = bProgName ? &GetFrameFormatProgNameArray() : &GetFrameFormatUINameArray();
393 nStt = RES_POOLFRM_BEGIN;
395 break;
396 case POOLGRP_PAGEDESC:
397 if( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END )
399 pStrArr = bProgName ? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
400 nStt = RES_POOLPAGE_BEGIN;
402 break;
403 case POOLGRP_NUMRULE:
404 if( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END )
406 pStrArr = bProgName ? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
407 nStt = RES_POOLNUMRULE_BEGIN;
409 break;
410 case POOLGRP_TABSTYLE:
411 if( RES_POOLTABLESTYLE_BEGIN <= nId && nId < RES_POOLTABLESTYLE_END )
413 pStrArr = bProgName ? &GetTableStyleProgNameArray() : &GetTableStyleUINameArray();
414 nStt = RES_POOLTABLESTYLE_BEGIN;
416 break;
418 return pStrArr ? pStrArr->operator[](nId - nStt) : rFillName;
421 void SwStyleNameMapper::fillNameFromId(
422 sal_uInt16 const nId, OUString& rFillName, bool bProgName)
424 rFillName = getNameFromId(nId, rFillName, bProgName);
427 // Get the UI name from the pool ID
428 void SwStyleNameMapper::FillUIName(sal_uInt16 const nId, OUString& rFillName)
430 fillNameFromId(nId, rFillName, false);
433 // Get the UI name from the pool ID
434 const OUString& SwStyleNameMapper::GetUIName(
435 sal_uInt16 const nId, const OUString& rName)
437 return getNameFromId(nId, rName, false);
440 // Get the programmatic name from the pool ID
441 void SwStyleNameMapper::FillProgName(sal_uInt16 nId, OUString& rFillName)
443 fillNameFromId(nId, rFillName, true);
446 // Get the programmatic name from the pool ID
447 const OUString&
448 SwStyleNameMapper::GetProgName(sal_uInt16 const nId, const OUString& rName)
450 return getNameFromId(nId, rName, true);
453 // This gets the PoolId from the UI Name
454 sal_uInt16 SwStyleNameMapper::GetPoolIdFromUIName(
455 const OUString& rName, SwGetPoolIdFromName const eFlags)
457 const NameToIdHash & rHashMap = getHashTable ( eFlags, false );
458 NameToIdHash::const_iterator aIter = rHashMap.find(rName);
459 return aIter != rHashMap.end() ? (*aIter).second : USHRT_MAX;
462 // Get the Pool ID from the programmatic name
463 sal_uInt16 SwStyleNameMapper::GetPoolIdFromProgName(
464 const OUString& rName, SwGetPoolIdFromName const eFlags)
466 const NameToIdHash & rHashMap = getHashTable ( eFlags, true );
467 NameToIdHash::const_iterator aIter = rHashMap.find(rName);
468 return aIter != rHashMap.end() ? (*aIter).second : USHRT_MAX;
471 // Hard coded Programmatic Name tables
473 /// returns an empty array because Cell Names aren't translated
474 const std::vector<OUString>& SwStyleNameMapper::GetCellStyleUINameArray()
476 static const std::vector<OUString> s_aCellStyleUINameArray;
477 return s_aCellStyleUINameArray;
480 const std::vector<OUString>& SwStyleNameMapper::GetTextProgNameArray()
482 static const std::vector<OUString> s_aTextProgNameArray = {
483 u"Standard"_ustr, // RES_POOLCOLL_STANDARD
484 u"Text body"_ustr,
485 u"First line indent"_ustr,
486 u"Hanging indent"_ustr,
487 u"Text body indent"_ustr,
488 u"Salutation"_ustr,
489 u"Signature"_ustr,
490 u"List Indent"_ustr, // RES_POOLCOLL_CONFRONTATION
491 u"Marginalia"_ustr,
492 // RES_POOLCOLL_TEXT_END
494 return s_aTextProgNameArray;
497 const std::vector<OUString>& SwStyleNameMapper::GetListsProgNameArray()
499 static const std::vector<OUString> s_aListsProgNameArray = {
500 u"List"_ustr, // STR_POCO_PRGM_NUMBER_BULLET_BASE
501 u"Numbering 1 Start"_ustr, // STR_POCO_PRGM_NUM_LEVEL1S
502 u"Numbering 1"_ustr,
503 u"Numbering 1 End"_ustr,
504 u"Numbering 1 Cont."_ustr,
505 u"Numbering 2 Start"_ustr,
506 u"Numbering 2"_ustr,
507 u"Numbering 2 End"_ustr,
508 u"Numbering 2 Cont."_ustr,
509 u"Numbering 3 Start"_ustr,
510 u"Numbering 3"_ustr,
511 u"Numbering 3 End"_ustr,
512 u"Numbering 3 Cont."_ustr,
513 u"Numbering 4 Start"_ustr,
514 u"Numbering 4"_ustr,
515 u"Numbering 4 End"_ustr,
516 u"Numbering 4 Cont."_ustr,
517 u"Numbering 5 Start"_ustr,
518 u"Numbering 5"_ustr,
519 u"Numbering 5 End"_ustr,
520 u"Numbering 5 Cont."_ustr,
521 u"List 1 Start"_ustr,
522 u"List 1"_ustr,
523 u"List 1 End"_ustr,
524 u"List 1 Cont."_ustr,
525 u"List 2 Start"_ustr,
526 u"List 2"_ustr,
527 u"List 2 End"_ustr,
528 u"List 2 Cont."_ustr,
529 u"List 3 Start"_ustr,
530 u"List 3"_ustr,
531 u"List 3 End"_ustr,
532 u"List 3 Cont."_ustr,
533 u"List 4 Start"_ustr,
534 u"List 4"_ustr,
535 u"List 4 End"_ustr,
536 u"List 4 Cont."_ustr,
537 u"List 5 Start"_ustr,
538 u"List 5"_ustr,
539 u"List 5 End"_ustr,
540 u"List 5 Cont."_ustr, // STR_POCO_PRGM_BULLET_NONUM5
542 return s_aListsProgNameArray;
545 const std::vector<OUString>& SwStyleNameMapper::GetExtraProgNameArray()
547 static const std::vector<OUString> s_aExtraProgNameArray = {
548 u"Header and Footer"_ustr, // RES_POOLCOLL_EXTRA_BEGIN
549 u"Header"_ustr,
550 u"Header left"_ustr,
551 u"Header right"_ustr,
552 u"Footer"_ustr,
553 u"Footer left"_ustr,
554 u"Footer right"_ustr,
555 u"Table Contents"_ustr,
556 u"Table Heading"_ustr,
557 u"Caption"_ustr,
558 u"Illustration"_ustr,
559 u"Table"_ustr,
560 u"Text"_ustr,
561 u"Figure"_ustr, // RES_POOLCOLL_LABEL_FIGURE
562 u"Frame contents"_ustr,
563 u"Footnote"_ustr,
564 u"Addressee"_ustr,
565 u"Sender"_ustr,
566 u"Endnote"_ustr,
567 u"Drawing"_ustr,
568 u"Comment"_ustr, // RES_POOLCOLL_COMMENT
570 return s_aExtraProgNameArray;
573 const std::vector<OUString>& SwStyleNameMapper::GetRegisterProgNameArray()
575 static const std::vector<OUString> s_aRegisterProgNameArray = {
576 u"Index"_ustr, // STR_POCO_PRGM_REGISTER_BASE
577 u"Index Heading"_ustr, // STR_POCO_PRGM_TOX_IDXH
578 u"Index 1"_ustr,
579 u"Index 2"_ustr,
580 u"Index 3"_ustr,
581 u"Index Separator"_ustr,
582 u"Contents Heading"_ustr,
583 u"Contents 1"_ustr,
584 u"Contents 2"_ustr,
585 u"Contents 3"_ustr,
586 u"Contents 4"_ustr,
587 u"Contents 5"_ustr,
588 u"User Index Heading"_ustr,
589 u"User Index 1"_ustr,
590 u"User Index 2"_ustr,
591 u"User Index 3"_ustr,
592 u"User Index 4"_ustr,
593 u"User Index 5"_ustr,
594 u"Contents 6"_ustr,
595 u"Contents 7"_ustr,
596 u"Contents 8"_ustr,
597 u"Contents 9"_ustr,
598 u"Contents 10"_ustr,
599 u"Figure Index Heading"_ustr,
600 u"Figure Index 1"_ustr,
601 u"Object index heading"_ustr,
602 u"Object index 1"_ustr,
603 u"Table index heading"_ustr,
604 u"Table index 1"_ustr,
605 u"Bibliography Heading"_ustr,
606 u"Bibliography 1"_ustr,
607 u"User Index 6"_ustr,
608 u"User Index 7"_ustr,
609 u"User Index 8"_ustr,
610 u"User Index 9"_ustr,
611 u"User Index 10"_ustr, // STR_POCO_PRGM_TOX_USER10
613 return s_aRegisterProgNameArray;
616 const std::vector<OUString>& SwStyleNameMapper::GetDocProgNameArray()
618 static const std::vector<OUString> s_aDocProgNameArray = {
619 u"Title"_ustr, // STR_POCO_PRGM_DOC_TITLE
620 u"Subtitle"_ustr,
621 u"Appendix"_ustr,
622 u"Heading"_ustr,
623 u"Heading 1"_ustr,
624 u"Heading 2"_ustr,
625 u"Heading 3"_ustr,
626 u"Heading 4"_ustr,
627 u"Heading 5"_ustr,
628 u"Heading 6"_ustr,
629 u"Heading 7"_ustr,
630 u"Heading 8"_ustr,
631 u"Heading 9"_ustr,
632 u"Heading 10"_ustr,
633 // RES_POOLCOLL_DOC_END
635 return s_aDocProgNameArray;
638 const std::vector<OUString>& SwStyleNameMapper::GetHTMLProgNameArray()
640 static const std::vector<OUString> s_aHTMLProgNameArray = {
641 u"Quotations"_ustr,
642 u"Preformatted Text"_ustr,
643 u"Horizontal Line"_ustr,
644 u"List Contents"_ustr,
645 u"List Heading"_ustr, // STR_POCO_PRGM_HTML_DT
647 return s_aHTMLProgNameArray;
650 const std::vector<OUString>& SwStyleNameMapper::GetFrameFormatProgNameArray()
652 static const std::vector<OUString> s_aFrameFormatProgNameArray = {
653 u"Frame"_ustr, // RES_POOLFRM_FRAME
654 u"Graphics"_ustr,
655 u"OLE"_ustr,
656 u"Formula"_ustr,
657 u"Marginalia"_ustr,
658 u"Watermark"_ustr,
659 u"Labels"_ustr, // RES_POOLFRM_LABEL
660 u"Inline Heading"_ustr,
662 return s_aFrameFormatProgNameArray;
665 const std::vector<OUString>& SwStyleNameMapper::GetChrFormatProgNameArray()
667 static const std::vector<OUString> s_aChrFormatProgNameArray = {
668 u"Footnote Symbol"_ustr, // RES_POOLCHR_FOOTNOTE
669 u"Page Number"_ustr,
670 u"Caption characters"_ustr,
671 u"Drop Caps"_ustr,
672 u"Numbering Symbols"_ustr,
673 u"Bullet Symbols"_ustr,
674 u"Internet link"_ustr,
675 u"Visited Internet Link"_ustr,
676 u"Placeholder"_ustr,
677 u"Index Link"_ustr,
678 u"Endnote Symbol"_ustr,
679 u"Line numbering"_ustr,
680 u"Main index entry"_ustr,
681 u"Footnote anchor"_ustr,
682 u"Endnote anchor"_ustr,
683 u"Rubies"_ustr, // RES_POOLCHR_RUBYTEXT
684 u"Vertical Numbering Symbols"_ustr, // RES_POOLCHR_VERT_NUMBER
686 return s_aChrFormatProgNameArray;
689 const std::vector<OUString>& SwStyleNameMapper::GetHTMLChrFormatProgNameArray()
691 static const std::vector<OUString> s_aHTMLChrFormatProgNameArray = {
692 u"Emphasis"_ustr, // RES_POOLCHR_HTML_EMPHASIS
693 u"Citation"_ustr,
694 u"Strong Emphasis"_ustr,
695 u"Source Text"_ustr,
696 u"Example"_ustr,
697 u"User Entry"_ustr,
698 u"Variable"_ustr,
699 u"Definition"_ustr,
700 u"Teletype"_ustr, // RES_POOLCHR_HTML_TELETYPE
702 return s_aHTMLChrFormatProgNameArray;
705 const std::vector<OUString>& SwStyleNameMapper::GetPageDescProgNameArray()
707 static const std::vector<OUString> s_aPageDescProgNameArray = {
708 u"Standard"_ustr, // STR_POOLPAGE_PRGM_STANDARD
709 u"First Page"_ustr,
710 u"Left Page"_ustr,
711 u"Right Page"_ustr,
712 u"Envelope"_ustr,
713 u"Index"_ustr,
714 u"HTML"_ustr,
715 u"Footnote"_ustr,
716 u"Endnote"_ustr, // STR_POOLPAGE_PRGM_ENDNOTE
717 u"Landscape"_ustr,
719 return s_aPageDescProgNameArray;
722 const std::vector<OUString>& SwStyleNameMapper::GetNumRuleProgNameArray()
724 static const std::vector<OUString> s_aNumRuleProgNameArray = {
725 u"No List"_ustr,
726 u"Numbering 123"_ustr, // STR_POOLNUMRULE_PRGM_NUM1
727 u"Numbering ABC"_ustr,
728 u"Numbering abc"_ustr,
729 u"Numbering IVX"_ustr,
730 u"Numbering ivx"_ustr,
731 u"List 1"_ustr,
732 u"List 2"_ustr,
733 u"List 3"_ustr,
734 u"List 4"_ustr,
735 u"List 5"_ustr, // STR_POOLNUMRULE_PRGM_BUL5
737 return s_aNumRuleProgNameArray;
740 const std::vector<OUString>& SwStyleNameMapper::GetTableStyleProgNameArray()
742 // XXX MUST match the entries of STR_TABSTYLE_ARY in
743 // sw/source/core/doc/DocumentStylePoolManager.cxx and MUST match the order of
744 // RES_POOL_TABLESTYLE_TYPE in sw/inc/poolfmt.hxx
745 static const std::vector<OUString> s_aTableStyleProgNameArray = {
746 u"Default Style"_ustr, // RES_POOLTABLESTYLE_DEFAULT
747 u"3D"_ustr, // RES_POOLTABLESTYLE_3D
748 u"Black 1"_ustr, // RES_POOLTABLESTYLE_BLACK1
749 u"Black 2"_ustr, // RES_POOLTABLESTYLE_BLACK2
750 u"Blue"_ustr, // RES_POOLTABLESTYLE_BLUE
751 u"Brown"_ustr, // RES_POOLTABLESTYLE_BROWN
752 u"Currency"_ustr, // RES_POOLTABLESTYLE_CURRENCY
753 u"Currency 3D"_ustr, // RES_POOLTABLESTYLE_CURRENCY_3D
754 u"Currency Gray"_ustr, // RES_POOLTABLESTYLE_CURRENCY_GRAY
755 u"Currency Lavender"_ustr, // RES_POOLTABLESTYLE_CURRENCY_LAVENDER
756 u"Currency Turquoise"_ustr, // RES_POOLTABLESTYLE_CURRENCY_TURQUOISE
757 u"Gray"_ustr, // RES_POOLTABLESTYLE_GRAY
758 u"Green"_ustr, // RES_POOLTABLESTYLE_GREEN
759 u"Lavender"_ustr, // RES_POOLTABLESTYLE_LAVENDER
760 u"Red"_ustr, // RES_POOLTABLESTYLE_RED
761 u"Turquoise"_ustr, // RES_POOLTABLESTYLE_TURQUOISE
762 u"Yellow"_ustr, // RES_POOLTABLESTYLE_YELLOW
763 u"Academic"_ustr, // RES_POOLTABLESTYLE_LO6_ACADEMIC
764 u"Box List Blue"_ustr, // RES_POOLTABLESTYLE_LO6_BOX_LIST_BLUE
765 u"Box List Green"_ustr, // RES_POOLTABLESTYLE_LO6_BOX_LIST_GREEN
766 u"Box List Red"_ustr, // RES_POOLTABLESTYLE_LO6_BOX_LIST_RED
767 u"Box List Yellow"_ustr, // RES_POOLTABLESTYLE_LO6_BOX_LIST_YELLOW
768 u"Elegant"_ustr, // RES_POOLTABLESTYLE_LO6_ELEGANT
769 u"Financial"_ustr, // RES_POOLTABLESTYLE_LO6_FINANCIAL
770 u"Simple Grid Columns"_ustr, // RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_COLUMNS
771 u"Simple Grid Rows"_ustr, // RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_ROWS
772 u"Simple List Shaded"_ustr, // RES_POOLTABLESTYLE_LO6_SIMPLE_LIST_SHADED
774 return s_aTableStyleProgNameArray;
777 /// returns an empty array because Cell Names aren't translated
778 const std::vector<OUString>& SwStyleNameMapper::GetCellStyleProgNameArray()
780 static const std::vector<OUString> s_aCellStyleProgNameArray;
781 return s_aCellStyleProgNameArray;
784 const OUString &
785 SwStyleNameMapper::GetSpecialExtraProgName(const OUString& rExtraUIName)
787 return lcl_GetSpecialExtraName( rExtraUIName, true );
790 const OUString &
791 SwStyleNameMapper::GetSpecialExtraUIName(const OUString& rExtraProgName)
793 return lcl_GetSpecialExtraName( rExtraProgName, false );
796 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */