LibreOffice Module sw (master) 1
SwStyleNameMapper.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef INCLUDED_SW_INC_SWSTYLENAMEMAPPER_HXX
20#define INCLUDED_SW_INC_SWSTYLENAMEMAPPER_HXX
21
22#include <sal/types.h>
23#include <rtl/ustring.hxx>
25#include "swdllapi.h"
26
27#include <unordered_map>
28#include <vector>
29
74typedef std::unordered_map<OUString, sal_uInt16> NameToIdHash;
75
77{
78 friend void InitCore();
79 friend void FinitCore();
80
81 static void fillNameFromId(sal_uInt16 nId, OUString &rName, bool bProgName);
82 static const OUString& getNameFromId(sal_uInt16 nId, const OUString &rName,
83 bool bProgName);
84 static const NameToIdHash& getHashTable ( SwGetPoolIdFromName, bool bProgName );
85#ifdef _NEED_TO_DEBUG_MAPPING
86 static void testNameTable( SwGetPoolIdFromName const nFamily, sal_uInt16 const nStartIndex, sal_uInt16 const nEndIndex );
87#endif
88
89public:
90 // This gets the UI Name from the programmatic name
91 static const OUString& GetUIName(const OUString& rName, SwGetPoolIdFromName);
92 static void FillUIName(const OUString& rName, OUString& rFillName,
94
95 // Get the programmatic Name from the UI name
96 static const OUString& GetProgName(const OUString& rName,
98 static void FillProgName(const OUString& rName, OUString& rFillName,
100
101 // This gets the UI Name from the Pool ID
102 SW_DLLPUBLIC static void FillUIName(sal_uInt16 nId, OUString& rFillName);
103 SW_DLLPUBLIC static const OUString& GetUIName(sal_uInt16 nId,
104 const OUString& rName);
105
106 // This gets the programmatic Name from the Pool ID
107 static void FillProgName(sal_uInt16 nId, OUString& rFillName);
108 SW_DLLPUBLIC static const OUString& GetProgName(sal_uInt16 nId,
109 const OUString& rName);
110
111 // This gets the PoolId from the UI Name
112 SW_DLLPUBLIC static sal_uInt16 GetPoolIdFromUIName(const OUString& rName,
114
115 // Get the Pool ID from the programmatic name
116 static sal_uInt16 GetPoolIdFromProgName(const OUString& rName,
118
119 // used to convert the 4 special ExtraProg/UINames for
120 // RES_POOLCOLL_LABEL_DRAWING, RES_POOLCOLL_LABEL_ABB,
121 // RES_POOLCOLL_LABEL_TABLE, RES_POOLCOLL_LABEL_FRAME
122 // forth and back.
123 // Non-matching names remain unchanged.
124 SW_DLLPUBLIC static const OUString & GetSpecialExtraProgName(
125 const OUString& rExtraUIName);
126 static const OUString & GetSpecialExtraUIName(const OUString& rExtraProgName);
127
128 static const std::vector<OUString>& GetTextUINameArray();
129 static const std::vector<OUString>& GetListsUINameArray();
130 static const std::vector<OUString>& GetExtraUINameArray();
131 static const std::vector<OUString>& GetRegisterUINameArray();
132 static const std::vector<OUString>& GetDocUINameArray();
133 static const std::vector<OUString>& GetHTMLUINameArray();
134 static const std::vector<OUString>& GetFrameFormatUINameArray();
135 static const std::vector<OUString>& GetChrFormatUINameArray();
136 static const std::vector<OUString>& GetHTMLChrFormatUINameArray();
137 static const std::vector<OUString>& GetPageDescUINameArray();
138 static const std::vector<OUString>& GetNumRuleUINameArray();
139 static const std::vector<OUString>& GetTableStyleUINameArray();
140 static const std::vector<OUString>& GetCellStyleUINameArray();
141
142 static const std::vector<OUString>& GetTextProgNameArray();
143 static const std::vector<OUString>& GetListsProgNameArray();
144 static const std::vector<OUString>& GetExtraProgNameArray();
145 static const std::vector<OUString>& GetRegisterProgNameArray();
146 static const std::vector<OUString>& GetDocProgNameArray();
147 static const std::vector<OUString>& GetHTMLProgNameArray();
148 static const std::vector<OUString>& GetFrameFormatProgNameArray();
149 static const std::vector<OUString>& GetChrFormatProgNameArray();
150 static const std::vector<OUString>& GetHTMLChrFormatProgNameArray();
151 static const std::vector<OUString>& GetPageDescProgNameArray();
152 static const std::vector<OUString>& GetNumRuleProgNameArray();
153 static const std::vector<OUString>& GetTableStyleProgNameArray();
154 static const std::vector<OUString>& GetCellStyleProgNameArray();
155};
156#endif // _NAME_MAPPER_HXX
157
158/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwGetPoolIdFromName
std::unordered_map< OUString, sal_uInt16 > NameToIdHash
This class holds all data about the names of styles used in the user interface (UI names....
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)
friend void InitCore()
Definition: init.cxx:449
friend void FinitCore()
Definition: init.cxx:668
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)
sal_Int16 nId
#define SW_DLLPUBLIC
Definition: swdllapi.h:28