28#ifdef _NEED_TO_DEBUG_MAPPING
36lcl_GetSpecialExtraName(
const OUString& rExtraName,
const bool bIsUIName )
38 const std::vector<OUString>& rExtraArr = bIsUIName
41 static const sal_uInt16 nIds[] =
50 const sal_uInt16 * pIds;
51 for ( pIds = nIds; *pIds; ++pIds)
53 if (rExtraName == rExtraArr[ *pIds ])
63bool lcl_SuffixIsUser(
const OUString & rString)
67 return rString.getLength() > 8 && rString.endsWith(
" (user)");
70void lcl_CheckSuffixAndDelete(OUString & rString)
72 if (lcl_SuffixIsUser(rString))
74 rString = rString.copy(0, rString.getLength() - 7);
79template <
typename... Rest>
80NameToIdHash HashFromRange(sal_uInt16 nAcc, sal_uInt16 nBegin, sal_uInt16 nEnd,
81 const std::vector<OUString>& (*pFunc)(), Rest... rest)
83 NameToIdHash hash(HashFromRange(nAcc + nEnd - nBegin, rest...));
85 const std::vector<OUString>& rStrings = pFunc();
86 for (nIndex = 0, nId = nBegin;
nId < nEnd;
nId++,
nIndex++)
87 hash[rStrings[nIndex]] = nId;
91template <auto initFunc>
struct TablePair
103 static std::map<LanguageTag, NameToIdHash> s_aUIMap;
105 auto it = s_aUIMap.find(rCurrentLanguage);
106 if (it == s_aUIMap.end())
107 it = s_aUIMap.emplace(rCurrentLanguage, initFunc(
false)).first;
115 return HashFromRange(0,
127 return HashFromRange(0,
135 return HashFromRange(0,
142 return HashFromRange(0,
149 return HashFromRange(0,
156 return HashFromRange(0,
163 return HashFromRange(0,
170#ifdef _NEED_TO_DEBUG_MAPPING
171void SwStyleNameMapper::testNameTable(
SwGetPoolIdFromName const nFamily, sal_uInt16
const nStartIndex, sal_uInt16
const nEndIndex )
176 for ( nIndex = 0, nId = nStartIndex ;
nId < nEndIndex ;
nId++,
nIndex++ )
178 OUString aString, bString;
183 bString =
GetUIName ( aString, nFamily );
193#ifdef _NEED_TO_DEBUG_MAPPING
194 static bool bTested =
false;
216 return TablePair<GetParaMap>::getMap(bProgName);
218 return TablePair<GetCharMap>::getMap(bProgName);
220 return TablePair<GetFrameMap>::getMap(bProgName);
222 return TablePair<GetPageMap>::getMap(bProgName);
224 return TablePair<GetNumRuleMap>::getMap(bProgName);
226 return TablePair<GetTableStyleMap>::getMap(bProgName);
228 return TablePair<GetCellStyleMap>::getMap(bProgName);
253 const OUString& rName, OUString& rFillName,
257 if (
nId == USHRT_MAX )
263 if (
nId == USHRT_MAX )
267 if (lcl_SuffixIsUser(rFillName))
268 rFillName +=
" (user)";
273 rFillName +=
" (user)";
283 rFillName =
"Standard";
288 const OUString& rName, OUString& rFillName,
291 OUString
aName = rName;
296 if (
nId == USHRT_MAX )
300 lcl_CheckSuffixAndDelete ( rFillName );
310 sal_uInt16
const nId,
const OUString& rFillName,
bool const bProgName)
313 const std::vector<OUString>* pStrArr =
nullptr;
400 return pStrArr ? pStrArr->operator[](
nId - nStt) : rFillName;
404 sal_uInt16
const nId, OUString& rFillName,
bool bProgName)
417 sal_uInt16
const nId,
const OUString& rName)
440 NameToIdHash::const_iterator aIter = rHashMap.find(rName);
441 return aIter != rHashMap.end() ? (*aIter).second : USHRT_MAX;
449 NameToIdHash::const_iterator aIter = rHashMap.find(rName);
450 return aIter != rHashMap.end() ? (*aIter).second : USHRT_MAX;
458 static const std::vector<OUString> s_aCellStyleUINameArray;
459 return s_aCellStyleUINameArray;
464 static const std::vector<OUString> s_aTextProgNameArray = {
486 return s_aTextProgNameArray;
491 static const std::vector<OUString> s_aListsProgNameArray = {
534 return s_aListsProgNameArray;
539 static const std::vector<OUString> s_aExtraProgNameArray = {
562 return s_aExtraProgNameArray;
567 static const std::vector<OUString> s_aRegisterProgNameArray = {
580 "User Index Heading",
591 "Figure Index Heading",
593 "Object index heading",
595 "Table index heading",
597 "Bibliography Heading",
605 return s_aRegisterProgNameArray;
610 static const std::vector<OUString> s_aDocProgNameArray = {
615 return s_aDocProgNameArray;
620 static const std::vector<OUString> s_aHTMLProgNameArray = {
627 return s_aHTMLProgNameArray;
632 static const std::vector<OUString> s_aFrameFormatProgNameArray = {
641 return s_aFrameFormatProgNameArray;
646 static const std::vector<OUString> s_aChrFormatProgNameArray = {
649 "Caption characters",
654 "Visited Internet Link",
663 "Vertical Numbering Symbols",
665 return s_aChrFormatProgNameArray;
670 static const std::vector<OUString> s_aHTMLChrFormatProgNameArray = {
681 return s_aHTMLChrFormatProgNameArray;
686 static const std::vector<OUString> s_aPageDescProgNameArray = {
698 return s_aPageDescProgNameArray;
703 static const std::vector<OUString> s_aNumRuleProgNameArray = {
716 return s_aNumRuleProgNameArray;
724 static const std::vector<OUString> s_aTableStyleProgNameArray = {
735 "Currency Turquoise",
749 "Simple Grid Columns",
751 "Simple List Shaded",
753 return s_aTableStyleProgNameArray;
759 static const std::vector<OUString> s_aCellStyleProgNameArray;
760 return s_aCellStyleProgNameArray;
766 return lcl_GetSpecialExtraName( rExtraUIName,
true );
772 return lcl_GetSpecialExtraName( rExtraProgName,
false );
std::unordered_map< OUString, sal_uInt16 > NameToIdHash
This class holds all data about the names of styles used in the user interface (UI names....
const LanguageTag & GetUILanguageTag() const
static const std::vector< OUString > & GetListsProgNameArray()
static const std::vector< OUString > & GetHTMLProgNameArray()
static const std::vector< OUString > & GetCellStyleProgNameArray()
returns an empty array because Cell Names aren't translated
static const std::vector< OUString > & GetFrameFormatProgNameArray()
static const std::vector< OUString > & GetCellStyleUINameArray()
returns an empty array because Cell Names aren't translated
static const std::vector< OUString > & GetPageDescProgNameArray()
static const NameToIdHash & getHashTable(SwGetPoolIdFromName, bool bProgName)
static const std::vector< OUString > & GetHTMLChrFormatProgNameArray()
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
static const std::vector< OUString > & GetChrFormatUINameArray()
static const std::vector< OUString > & GetTableStyleUINameArray()
static const std::vector< OUString > & GetDocProgNameArray()
static const std::vector< OUString > & GetExtraUINameArray()
static const std::vector< OUString > & GetHTMLUINameArray()
static const std::vector< OUString > & GetListsUINameArray()
static const OUString & GetProgName(const OUString &rName, SwGetPoolIdFromName)
static const std::vector< OUString > & GetPageDescUINameArray()
static const std::vector< OUString > & GetNumRuleUINameArray()
static const OUString & GetUIName(const OUString &rName, SwGetPoolIdFromName)
static const std::vector< OUString > & GetHTMLChrFormatUINameArray()
static void fillNameFromId(sal_uInt16 nId, OUString &rName, bool bProgName)
static const std::vector< OUString > & GetTableStyleProgNameArray()
static sal_uInt16 GetPoolIdFromProgName(const OUString &rName, SwGetPoolIdFromName)
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
static const std::vector< OUString > & GetTextProgNameArray()
static const std::vector< OUString > & GetRegisterProgNameArray()
static SW_DLLPUBLIC const OUString & GetSpecialExtraProgName(const OUString &rExtraUIName)
static const std::vector< OUString > & GetChrFormatProgNameArray()
static const std::vector< OUString > & GetFrameFormatUINameArray()
static const std::vector< OUString > & GetTextUINameArray()
static const std::vector< OUString > & GetRegisterUINameArray()
static const OUString & getNameFromId(sal_uInt16 nId, const OUString &rName, bool bProgName)
static const std::vector< OUString > & GetNumRuleProgNameArray()
static const std::vector< OUString > & GetExtraProgNameArray()
static const std::vector< OUString > & GetDocUINameArray()
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
static const OUString & GetSpecialExtraUIName(const OUString &rExtraProgName)
const sal_uInt16 POOLGRP_TABSTYLE
const sal_uInt16 COLL_DOC_BITS
@ RES_POOLCOLL_LABEL_DRAWING
Label drawing objects.
@ RES_POOLCOLL_REGISTER_BEGIN
Group indices.
@ RES_POOLCOLL_HTML_BEGIN
Group HTML-styles.
@ RES_POOLCOLL_HTML_END
End of text styles collection.
@ RES_POOLCOLL_TEXT_BEGIN
@ RES_POOLCOLL_EXTRA_BEGIN
Special ranges.
@ RES_POOLCOLL_LABEL_FRAME
Label frame.
@ RES_POOLCOLL_LABEL_FIGURE
Label figure.
@ RES_POOLCOLL_REGISTER_END
@ RES_POOLCOLL_LABEL_TABLE
Label table.
@ RES_POOLCOLL_LABEL_ABB
Label illustration.
@ RES_POOLCOLL_LISTS_BEGIN
Group lists.
@ RES_POOLCOLL_DOC_BEGIN
Group chapter / document.
const sal_uInt16 POOLGRP_FRAMEFMT
@ RES_POOLCHR_HTML_BEGIN
HTML-styles.
@ RES_POOLCHR_NORMAL_BEGIN
const sal_uInt16 POOLGRP_NOCOLLID
POOLCOLL-IDs: +-—+—+—+—+—+—+—+—+—+—+—+—+—+—+—+—+ !User! Range ! 0 ! Offset ! +-—+—+—+—+—+—+—+—+—+—+—+...
const sal_uInt16 COLL_GET_RANGE_BITS
@ RES_POOLCELLSTYLE_BEGIN
const sal_uInt16 POOLGRP_NUMRULE
const sal_uInt16 COLL_REGISTER_BITS
@ RES_POOLTABLESTYLE_BEGIN
const sal_uInt16 COLL_TEXT_BITS
const sal_uInt16 USER_FMT
POLLCOLL-groups:
const sal_uInt16 POOLGRP_CHARFMT
Other groups:
const sal_uInt16 POOLGRP_PAGEDESC
const sal_uInt16 COLL_HTML_BITS
const sal_uInt16 COLL_LISTS_BITS
const sal_uInt16 COLL_EXTRA_BITS
OUString SwResId(TranslateId aId)