1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*efeef26fSAndrew Rist * distributed with this work for additional information
6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10*efeef26fSAndrew Rist *
11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist *
13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17*efeef26fSAndrew Rist * specific language governing permissions and limitations
18*efeef26fSAndrew Rist * under the License.
19*efeef26fSAndrew Rist *
20*efeef26fSAndrew Rist *************************************************************/
21*efeef26fSAndrew Rist
22*efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include <SwStyleNameMapper.hxx>
29cdf0e10cSrcweir #define _SVSTDARR_STRINGSDTOR
30cdf0e10cSrcweir #include <svl/svstdarr.hxx>
31cdf0e10cSrcweir #include <tools/resmgr.hxx>
32cdf0e10cSrcweir #include <poolfmt.hxx>
33cdf0e10cSrcweir #ifndef _RDIC_HRC
34cdf0e10cSrcweir #include <rcid.hrc>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #include <tools/debug.hxx>
37cdf0e10cSrcweir extern ResMgr* pSwResMgr;
38cdf0e10cSrcweir // Initialise UI names to 0
39cdf0e10cSrcweir SvStringsDtor *SwStyleNameMapper::pTextUINameArray = 0,
40cdf0e10cSrcweir *SwStyleNameMapper::pListsUINameArray = 0,
41cdf0e10cSrcweir *SwStyleNameMapper::pExtraUINameArray = 0,
42cdf0e10cSrcweir *SwStyleNameMapper::pRegisterUINameArray = 0,
43cdf0e10cSrcweir *SwStyleNameMapper::pDocUINameArray = 0,
44cdf0e10cSrcweir *SwStyleNameMapper::pHTMLUINameArray = 0,
45cdf0e10cSrcweir *SwStyleNameMapper::pFrmFmtUINameArray = 0,
46cdf0e10cSrcweir *SwStyleNameMapper::pChrFmtUINameArray = 0,
47cdf0e10cSrcweir *SwStyleNameMapper::pHTMLChrFmtUINameArray = 0,
48cdf0e10cSrcweir *SwStyleNameMapper::pPageDescUINameArray = 0,
49cdf0e10cSrcweir *SwStyleNameMapper::pNumRuleUINameArray = 0,
50cdf0e10cSrcweir
51cdf0e10cSrcweir // Initialise programmatic names to 0
52cdf0e10cSrcweir *SwStyleNameMapper::pTextProgNameArray = 0,
53cdf0e10cSrcweir *SwStyleNameMapper::pListsProgNameArray = 0,
54cdf0e10cSrcweir *SwStyleNameMapper::pExtraProgNameArray = 0,
55cdf0e10cSrcweir *SwStyleNameMapper::pRegisterProgNameArray = 0,
56cdf0e10cSrcweir *SwStyleNameMapper::pDocProgNameArray = 0,
57cdf0e10cSrcweir *SwStyleNameMapper::pHTMLProgNameArray = 0,
58cdf0e10cSrcweir *SwStyleNameMapper::pFrmFmtProgNameArray = 0,
59cdf0e10cSrcweir *SwStyleNameMapper::pChrFmtProgNameArray = 0,
60cdf0e10cSrcweir *SwStyleNameMapper::pHTMLChrFmtProgNameArray = 0,
61cdf0e10cSrcweir *SwStyleNameMapper::pPageDescProgNameArray = 0,
62cdf0e10cSrcweir *SwStyleNameMapper::pNumRuleProgNameArray = 0;
63cdf0e10cSrcweir
64cdf0e10cSrcweir NameToIdHash *SwStyleNameMapper::pParaUIMap = 0,
65cdf0e10cSrcweir *SwStyleNameMapper::pCharUIMap = 0,
66cdf0e10cSrcweir *SwStyleNameMapper::pPageUIMap = 0,
67cdf0e10cSrcweir *SwStyleNameMapper::pFrameUIMap = 0,
68cdf0e10cSrcweir *SwStyleNameMapper::pNumRuleUIMap = 0,
69cdf0e10cSrcweir
70cdf0e10cSrcweir *SwStyleNameMapper::pParaProgMap = 0,
71cdf0e10cSrcweir *SwStyleNameMapper::pCharProgMap = 0,
72cdf0e10cSrcweir *SwStyleNameMapper::pPageProgMap = 0,
73cdf0e10cSrcweir *SwStyleNameMapper::pFrameProgMap = 0,
74cdf0e10cSrcweir *SwStyleNameMapper::pNumRuleProgMap = 0;
75cdf0e10cSrcweir
76cdf0e10cSrcweir // SwTableEntry so we can pass the length to the String CTOR
77cdf0e10cSrcweir struct SwTableEntry
78cdf0e10cSrcweir {
79cdf0e10cSrcweir sal_uInt8 nLength;
80cdf0e10cSrcweir const sal_Char *pChar;
81cdf0e10cSrcweir };
82cdf0e10cSrcweir
83cdf0e10cSrcweir #define ENTRY( s ) { sizeof (s)-1, s }
84cdf0e10cSrcweir
85cdf0e10cSrcweir // Hard coded Programmatic Name tables
86cdf0e10cSrcweir const struct SwTableEntry TextProgNameTable [] =
87cdf0e10cSrcweir {
88cdf0e10cSrcweir ENTRY( "Standard" ), // RES_POOLCOLL_STANDARD
89cdf0e10cSrcweir ENTRY( "Text body" ),
90cdf0e10cSrcweir ENTRY( "First line indent" ),
91cdf0e10cSrcweir ENTRY( "Hanging indent" ),
92cdf0e10cSrcweir ENTRY( "Text body indent" ),
93cdf0e10cSrcweir ENTRY( "Salutation" ),
94cdf0e10cSrcweir ENTRY( "Signature" ),
95cdf0e10cSrcweir ENTRY( "List Indent" ), // RES_POOLCOLL_CONFRONTATION
96cdf0e10cSrcweir ENTRY( "Marginalia" ),
97cdf0e10cSrcweir ENTRY( "Heading" ),
98cdf0e10cSrcweir ENTRY( "Heading 1" ),
99cdf0e10cSrcweir ENTRY( "Heading 2" ),
100cdf0e10cSrcweir ENTRY( "Heading 3" ),
101cdf0e10cSrcweir ENTRY( "Heading 4" ),
102cdf0e10cSrcweir ENTRY( "Heading 5" ),
103cdf0e10cSrcweir ENTRY( "Heading 6" ),
104cdf0e10cSrcweir ENTRY( "Heading 7" ),
105cdf0e10cSrcweir ENTRY( "Heading 8" ),
106cdf0e10cSrcweir ENTRY( "Heading 9" ),
107cdf0e10cSrcweir ENTRY( "Heading 10" ), // RES_POOLCOLL_TEXT_END
108cdf0e10cSrcweir { 0, NULL }
109cdf0e10cSrcweir };
110cdf0e10cSrcweir
111cdf0e10cSrcweir const struct SwTableEntry ListsProgNameTable [] =
112cdf0e10cSrcweir {
113cdf0e10cSrcweir ENTRY( "List" ), // STR_POCO_PRGM_NUMBUL_BASE
114cdf0e10cSrcweir ENTRY( "Numbering 1 Start" ), // STR_POCO_PRGM_NUM_LEVEL1S
115cdf0e10cSrcweir ENTRY( "Numbering 1" ),
116cdf0e10cSrcweir ENTRY( "Numbering 1 End" ),
117cdf0e10cSrcweir ENTRY( "Numbering 1 Cont." ),
118cdf0e10cSrcweir ENTRY( "Numbering 2 Start" ),
119cdf0e10cSrcweir ENTRY( "Numbering 2" ),
120cdf0e10cSrcweir ENTRY( "Numbering 2 End" ),
121cdf0e10cSrcweir ENTRY( "Numbering 2 Cont." ),
122cdf0e10cSrcweir ENTRY( "Numbering 3 Start" ),
123cdf0e10cSrcweir ENTRY( "Numbering 3" ),
124cdf0e10cSrcweir ENTRY( "Numbering 3 End" ),
125cdf0e10cSrcweir ENTRY( "Numbering 3 Cont." ),
126cdf0e10cSrcweir ENTRY( "Numbering 4 Start" ),
127cdf0e10cSrcweir ENTRY( "Numbering 4" ),
128cdf0e10cSrcweir ENTRY( "Numbering 4 End" ),
129cdf0e10cSrcweir ENTRY( "Numbering 4 Cont." ),
130cdf0e10cSrcweir ENTRY( "Numbering 5 Start" ),
131cdf0e10cSrcweir ENTRY( "Numbering 5" ),
132cdf0e10cSrcweir ENTRY( "Numbering 5 End" ),
133cdf0e10cSrcweir ENTRY( "Numbering 5 Cont." ),
134cdf0e10cSrcweir ENTRY( "List 1 Start" ),
135cdf0e10cSrcweir ENTRY( "List 1" ),
136cdf0e10cSrcweir ENTRY( "List 1 End" ),
137cdf0e10cSrcweir ENTRY( "List 1 Cont." ),
138cdf0e10cSrcweir ENTRY( "List 2 Start" ),
139cdf0e10cSrcweir ENTRY( "List 2" ),
140cdf0e10cSrcweir ENTRY( "List 2 End" ),
141cdf0e10cSrcweir ENTRY( "List 2 Cont." ),
142cdf0e10cSrcweir ENTRY( "List 3 Start" ),
143cdf0e10cSrcweir ENTRY( "List 3" ),
144cdf0e10cSrcweir ENTRY( "List 3 End" ),
145cdf0e10cSrcweir ENTRY( "List 3 Cont." ),
146cdf0e10cSrcweir ENTRY( "List 4 Start" ),
147cdf0e10cSrcweir ENTRY( "List 4" ),
148cdf0e10cSrcweir ENTRY( "List 4 End" ),
149cdf0e10cSrcweir ENTRY( "List 4 Cont." ),
150cdf0e10cSrcweir ENTRY( "List 5 Start" ),
151cdf0e10cSrcweir ENTRY( "List 5" ),
152cdf0e10cSrcweir ENTRY( "List 5 End" ),
153cdf0e10cSrcweir ENTRY( "List 5 Cont." ), // STR_POCO_PRGM_BUL_NONUM5
154cdf0e10cSrcweir { 0, NULL }
155cdf0e10cSrcweir };
156cdf0e10cSrcweir
157cdf0e10cSrcweir const struct SwTableEntry ExtraProgNameTable [] =
158cdf0e10cSrcweir {
159cdf0e10cSrcweir ENTRY( "Header" ), // RES_POOLCOLL_EXTRA_BEGIN
160cdf0e10cSrcweir ENTRY( "Header left" ),
161cdf0e10cSrcweir ENTRY( "Header right" ),
162cdf0e10cSrcweir ENTRY( "Footer" ),
163cdf0e10cSrcweir ENTRY( "Footer left" ),
164cdf0e10cSrcweir ENTRY( "Footer right" ),
165cdf0e10cSrcweir ENTRY( "Table Contents" ),
166cdf0e10cSrcweir ENTRY( "Table Heading" ),
167cdf0e10cSrcweir ENTRY( "Caption" ),
168cdf0e10cSrcweir ENTRY( "Illustration" ),
169cdf0e10cSrcweir ENTRY( "Table" ),
170cdf0e10cSrcweir ENTRY( "Text" ),
171cdf0e10cSrcweir ENTRY( "Frame contents" ),
172cdf0e10cSrcweir ENTRY( "Footnote" ),
173cdf0e10cSrcweir ENTRY( "Addressee" ),
174cdf0e10cSrcweir ENTRY( "Sender" ),
175cdf0e10cSrcweir ENTRY( "Endnote" ),
176cdf0e10cSrcweir ENTRY( "Drawing" ), // RES_POOLCOLL_LABEL_DRAWING
177cdf0e10cSrcweir { 0, NULL }
178cdf0e10cSrcweir };
179cdf0e10cSrcweir
180cdf0e10cSrcweir const struct SwTableEntry RegisterProgNameTable [] =
181cdf0e10cSrcweir {
182cdf0e10cSrcweir ENTRY( "Index" ), // STR_POCO_PRGM_REGISTER_BASE
183cdf0e10cSrcweir ENTRY( "Index Heading" ), // STR_POCO_PRGM_TOX_IDXH
184cdf0e10cSrcweir ENTRY( "Index 1" ),
185cdf0e10cSrcweir ENTRY( "Index 2" ),
186cdf0e10cSrcweir ENTRY( "Index 3" ),
187cdf0e10cSrcweir ENTRY( "Index Separator" ),
188cdf0e10cSrcweir ENTRY( "Contents Heading" ),
189cdf0e10cSrcweir ENTRY( "Contents 1" ),
190cdf0e10cSrcweir ENTRY( "Contents 2" ),
191cdf0e10cSrcweir ENTRY( "Contents 3" ),
192cdf0e10cSrcweir ENTRY( "Contents 4" ),
193cdf0e10cSrcweir ENTRY( "Contents 5" ),
194cdf0e10cSrcweir ENTRY( "User Index Heading" ),
195cdf0e10cSrcweir ENTRY( "User Index 1" ),
196cdf0e10cSrcweir ENTRY( "User Index 2" ),
197cdf0e10cSrcweir ENTRY( "User Index 3" ),
198cdf0e10cSrcweir ENTRY( "User Index 4" ),
199cdf0e10cSrcweir ENTRY( "User Index 5" ),
200cdf0e10cSrcweir ENTRY( "Contents 6" ),
201cdf0e10cSrcweir ENTRY( "Contents 7" ),
202cdf0e10cSrcweir ENTRY( "Contents 8" ),
203cdf0e10cSrcweir ENTRY( "Contents 9" ),
204cdf0e10cSrcweir ENTRY( "Contents 10" ),
205cdf0e10cSrcweir ENTRY( "Illustration Index Heading" ),
206cdf0e10cSrcweir ENTRY( "Illustration Index 1" ),
207cdf0e10cSrcweir ENTRY( "Object index heading" ),
208cdf0e10cSrcweir ENTRY( "Object index 1" ),
209cdf0e10cSrcweir ENTRY( "Table index heading" ),
210cdf0e10cSrcweir ENTRY( "Table index 1" ),
211cdf0e10cSrcweir ENTRY( "Bibliography Heading" ),
212cdf0e10cSrcweir ENTRY( "Bibliography 1" ),
213cdf0e10cSrcweir ENTRY( "User Index 6" ),
214cdf0e10cSrcweir ENTRY( "User Index 7" ),
215cdf0e10cSrcweir ENTRY( "User Index 8" ),
216cdf0e10cSrcweir ENTRY( "User Index 9" ),
217cdf0e10cSrcweir ENTRY( "User Index 10" ), // STR_POCO_PRGM_TOX_USER10
218cdf0e10cSrcweir { 0, NULL }
219cdf0e10cSrcweir };
220cdf0e10cSrcweir
221cdf0e10cSrcweir const struct SwTableEntry DocProgNameTable [] =
222cdf0e10cSrcweir {
223cdf0e10cSrcweir ENTRY( "Title" ), // STR_POCO_PRGM_DOC_TITEL
224cdf0e10cSrcweir ENTRY( "Subtitle" ),
225cdf0e10cSrcweir { 0, NULL }
226cdf0e10cSrcweir };
227cdf0e10cSrcweir
228cdf0e10cSrcweir const struct SwTableEntry HTMLProgNameTable [] =
229cdf0e10cSrcweir {
230cdf0e10cSrcweir ENTRY( "Quotations" ),
231cdf0e10cSrcweir ENTRY( "Preformatted Text" ),
232cdf0e10cSrcweir ENTRY( "Horizontal Line" ),
233cdf0e10cSrcweir ENTRY( "List Contents" ),
234cdf0e10cSrcweir ENTRY( "List Heading" ), // STR_POCO_PRGM_HTML_DT
235cdf0e10cSrcweir { 0, NULL }
236cdf0e10cSrcweir };
237cdf0e10cSrcweir
238cdf0e10cSrcweir const struct SwTableEntry FrmFmtProgNameTable [] =
239cdf0e10cSrcweir {
240cdf0e10cSrcweir ENTRY( "Frame" ), // RES_POOLFRM_FRAME
241cdf0e10cSrcweir ENTRY( "Graphics" ),
242cdf0e10cSrcweir ENTRY( "OLE" ),
243cdf0e10cSrcweir ENTRY( "Formula" ),
244cdf0e10cSrcweir ENTRY( "Marginalia" ),
245cdf0e10cSrcweir ENTRY( "Watermark" ),
246cdf0e10cSrcweir ENTRY( "Labels" ), // RES_POOLFRM_LABEL
247cdf0e10cSrcweir { 0, NULL }
248cdf0e10cSrcweir };
249cdf0e10cSrcweir
250cdf0e10cSrcweir const struct SwTableEntry ChrFmtProgNameTable [] =
251cdf0e10cSrcweir {
252cdf0e10cSrcweir ENTRY( "Footnote Symbol" ), // RES_POOLCHR_FOOTNOTE
253cdf0e10cSrcweir ENTRY( "Page Number" ),
254cdf0e10cSrcweir ENTRY( "Caption characters" ),
255cdf0e10cSrcweir ENTRY( "Drop Caps" ),
256cdf0e10cSrcweir ENTRY( "Numbering Symbols" ),
257cdf0e10cSrcweir ENTRY( "Bullet Symbols" ),
258cdf0e10cSrcweir ENTRY( "Internet link" ),
259cdf0e10cSrcweir ENTRY( "Visited Internet Link" ),
260cdf0e10cSrcweir ENTRY( "Placeholder" ),
261cdf0e10cSrcweir ENTRY( "Index Link" ),
262cdf0e10cSrcweir ENTRY( "Endnote Symbol" ),
263cdf0e10cSrcweir ENTRY( "Line numbering" ),
264cdf0e10cSrcweir ENTRY( "Main index entry" ),
265cdf0e10cSrcweir ENTRY( "Footnote anchor" ),
266cdf0e10cSrcweir ENTRY( "Endnote anchor" ),
267cdf0e10cSrcweir ENTRY( "Rubies" ), // RES_POOLCHR_RUBYTEXT
268cdf0e10cSrcweir ENTRY( "Vertical Numbering Symbols" ), // RES_POOLCHR_VERT_NUMBER
269cdf0e10cSrcweir { 0, NULL }
270cdf0e10cSrcweir };
271cdf0e10cSrcweir
272cdf0e10cSrcweir const struct SwTableEntry HTMLChrFmtProgNameTable [] =
273cdf0e10cSrcweir {
274cdf0e10cSrcweir ENTRY( "Emphasis" ), // RES_POOLCHR_HTML_EMPHASIS
275cdf0e10cSrcweir ENTRY( "Citation" ),
276cdf0e10cSrcweir ENTRY( "Strong Emphasis" ),
277cdf0e10cSrcweir ENTRY( "Source Text" ),
278cdf0e10cSrcweir ENTRY( "Example" ),
279cdf0e10cSrcweir ENTRY( "User Entry" ),
280cdf0e10cSrcweir ENTRY( "Variable" ),
281cdf0e10cSrcweir ENTRY( "Definition" ),
282cdf0e10cSrcweir ENTRY( "Teletype" ), // RES_POOLCHR_HTML_TELETYPE
283cdf0e10cSrcweir { 0, NULL }
284cdf0e10cSrcweir };
285cdf0e10cSrcweir
286cdf0e10cSrcweir const struct SwTableEntry PageDescProgNameTable [] =
287cdf0e10cSrcweir {
288cdf0e10cSrcweir ENTRY( "Standard" ), // STR_POOLPAGE_PRGM_STANDARD
289cdf0e10cSrcweir ENTRY( "First Page" ),
290cdf0e10cSrcweir ENTRY( "Left Page" ),
291cdf0e10cSrcweir ENTRY( "Right Page" ),
292cdf0e10cSrcweir ENTRY( "Envelope" ),
293cdf0e10cSrcweir ENTRY( "Index" ),
294cdf0e10cSrcweir ENTRY( "HTML" ),
295cdf0e10cSrcweir ENTRY( "Footnote" ),
296cdf0e10cSrcweir ENTRY( "Endnote" ), // STR_POOLPAGE_PRGM_ENDNOTE
297cdf0e10cSrcweir ENTRY( "Landscape" ),
298cdf0e10cSrcweir { 0, NULL }
299cdf0e10cSrcweir };
300cdf0e10cSrcweir
301cdf0e10cSrcweir const struct SwTableEntry NumRuleProgNameTable [] =
302cdf0e10cSrcweir {
303cdf0e10cSrcweir ENTRY( "Numbering 1" ), // STR_POOLNUMRULE_PRGM_NUM1
304cdf0e10cSrcweir ENTRY( "Numbering 2" ),
305cdf0e10cSrcweir ENTRY( "Numbering 3" ),
306cdf0e10cSrcweir ENTRY( "Numbering 4" ),
307cdf0e10cSrcweir ENTRY( "Numbering 5" ),
308cdf0e10cSrcweir ENTRY( "List 1" ),
309cdf0e10cSrcweir ENTRY( "List 2" ),
310cdf0e10cSrcweir ENTRY( "List 3" ),
311cdf0e10cSrcweir ENTRY( "List 4" ),
312cdf0e10cSrcweir ENTRY( "List 5" ), // STR_POOLNUMRULE_PRGM_BUL5
313cdf0e10cSrcweir { 0, NULL }
314cdf0e10cSrcweir };
315cdf0e10cSrcweir #undef ENTRY
316cdf0e10cSrcweir
SuffixIsUser(const String & rString)317cdf0e10cSrcweir sal_Bool SwStyleNameMapper::SuffixIsUser ( const String & rString )
318cdf0e10cSrcweir {
319cdf0e10cSrcweir const sal_Unicode *pChar = rString.GetBuffer();
320cdf0e10cSrcweir sal_Int32 nLen = rString.Len();
321cdf0e10cSrcweir sal_Bool bRet = sal_False;
322cdf0e10cSrcweir if( nLen > 8 &&
323cdf0e10cSrcweir pChar[nLen-7] == ' ' &&
324cdf0e10cSrcweir pChar[nLen-6] == '(' &&
325cdf0e10cSrcweir pChar[nLen-5] == 'u' &&
326cdf0e10cSrcweir pChar[nLen-4] == 's' &&
327cdf0e10cSrcweir pChar[nLen-3] == 'e' &&
328cdf0e10cSrcweir pChar[nLen-2] == 'r' &&
329cdf0e10cSrcweir pChar[nLen-1] == ')' )
330cdf0e10cSrcweir bRet = sal_True;
331cdf0e10cSrcweir return bRet;
332cdf0e10cSrcweir }
CheckSuffixAndDelete(String & rString)333cdf0e10cSrcweir void SwStyleNameMapper::CheckSuffixAndDelete ( String & rString )
334cdf0e10cSrcweir {
335cdf0e10cSrcweir const sal_Unicode *pChar = rString.GetBuffer();
336cdf0e10cSrcweir xub_StrLen nLen = rString.Len();
337cdf0e10cSrcweir if (nLen > 8 &&
338cdf0e10cSrcweir pChar[nLen-7] == ' ' &&
339cdf0e10cSrcweir pChar[nLen-6] == '(' &&
340cdf0e10cSrcweir pChar[nLen-5] == 'u' &&
341cdf0e10cSrcweir pChar[nLen-4] == 's' &&
342cdf0e10cSrcweir pChar[nLen-3] == 'e' &&
343cdf0e10cSrcweir pChar[nLen-2] == 'r' &&
344cdf0e10cSrcweir pChar[nLen-1] == ')')
345cdf0e10cSrcweir {
346cdf0e10cSrcweir rString.Erase ( nLen - 7, 7 );
347cdf0e10cSrcweir }
348cdf0e10cSrcweir }
getHashTable(SwGetPoolIdFromName eFlags,sal_Bool bProgName)349cdf0e10cSrcweir const NameToIdHash & SwStyleNameMapper::getHashTable ( SwGetPoolIdFromName eFlags, sal_Bool bProgName )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir NameToIdHash *pHash = 0;
352cdf0e10cSrcweir const SvStringsDtor *pStrings;
353cdf0e10cSrcweir
354cdf0e10cSrcweir switch ( eFlags )
355cdf0e10cSrcweir {
356cdf0e10cSrcweir case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL:
357cdf0e10cSrcweir {
358cdf0e10cSrcweir sal_uInt16 nIndex;
359cdf0e10cSrcweir sal_uInt16 nId;
360cdf0e10cSrcweir
361cdf0e10cSrcweir pHash = bProgName ? pParaProgMap : pParaUIMap;
362cdf0e10cSrcweir if ( !pHash )
363cdf0e10cSrcweir {
364cdf0e10cSrcweir pHash = new NameToIdHash ( RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN +
365cdf0e10cSrcweir RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
366cdf0e10cSrcweir RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
367cdf0e10cSrcweir RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
368cdf0e10cSrcweir RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
369cdf0e10cSrcweir RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN );
370cdf0e10cSrcweir pStrings = bProgName ? &GetTextProgNameArray() : &GetTextUINameArray();
371cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCOLL_TEXT_BEGIN ; nId < RES_POOLCOLL_TEXT_END ; nId++,nIndex++ )
372cdf0e10cSrcweir (*pHash)[(*pStrings)[nIndex]] = nId;
373cdf0e10cSrcweir pStrings = bProgName ? &GetListsProgNameArray() : &GetListsUINameArray();
374cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCOLL_LISTS_BEGIN ; nId < RES_POOLCOLL_LISTS_END ; nId++,nIndex++ )
375cdf0e10cSrcweir (*pHash)[(*pStrings)[nIndex]] = nId;
376cdf0e10cSrcweir pStrings = bProgName ? &GetExtraProgNameArray() : &GetExtraUINameArray();
377cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCOLL_EXTRA_BEGIN ; nId < RES_POOLCOLL_EXTRA_END ; nId++,nIndex++ )
378cdf0e10cSrcweir (*pHash)[(*pStrings)[nIndex]] = nId;
379cdf0e10cSrcweir pStrings = bProgName ? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
380cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCOLL_REGISTER_BEGIN ; nId < RES_POOLCOLL_REGISTER_END ; nId++,nIndex++ )
381cdf0e10cSrcweir (*pHash)[(*pStrings)[nIndex]] = nId;
382cdf0e10cSrcweir pStrings = bProgName ? &GetDocProgNameArray() : &GetDocUINameArray();
383cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCOLL_DOC_BEGIN ; nId < RES_POOLCOLL_DOC_END ; nId++,nIndex++ )
384cdf0e10cSrcweir (*pHash)[(*pStrings)[nIndex]] = nId;
385cdf0e10cSrcweir pStrings = bProgName ? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
386cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCOLL_HTML_BEGIN ; nId < RES_POOLCOLL_HTML_END ; nId++,nIndex++ )
387cdf0e10cSrcweir (*pHash)[(*pStrings)[nIndex]] = nId;
388cdf0e10cSrcweir
389cdf0e10cSrcweir if ( bProgName )
390cdf0e10cSrcweir pParaProgMap = pHash;
391cdf0e10cSrcweir else
392cdf0e10cSrcweir pParaUIMap = pHash;
393cdf0e10cSrcweir }
394cdf0e10cSrcweir }
395cdf0e10cSrcweir break;
396cdf0e10cSrcweir case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT:
397cdf0e10cSrcweir {
398cdf0e10cSrcweir pHash = bProgName ? pCharProgMap : pCharUIMap;
399cdf0e10cSrcweir if ( !pHash )
400cdf0e10cSrcweir {
401cdf0e10cSrcweir sal_uInt16 nIndex;
402cdf0e10cSrcweir sal_uInt16 nId;
403cdf0e10cSrcweir
404cdf0e10cSrcweir pHash = new NameToIdHash ( RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN +
405cdf0e10cSrcweir RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN );
406cdf0e10cSrcweir pStrings = bProgName ? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
407cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCHR_NORMAL_BEGIN ; nId < RES_POOLCHR_NORMAL_END ; nId++,nIndex++ )
408cdf0e10cSrcweir (*pHash)[(*pStrings)[nIndex]] = nId;
409cdf0e10cSrcweir pStrings = bProgName ? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
410cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCHR_HTML_BEGIN ; nId < RES_POOLCHR_HTML_END ; nId++,nIndex++ )
411cdf0e10cSrcweir (*pHash)[(*pStrings)[nIndex]] = nId;
412cdf0e10cSrcweir if (bProgName )
413cdf0e10cSrcweir pCharProgMap = pHash;
414cdf0e10cSrcweir else
415cdf0e10cSrcweir pCharUIMap = pHash;
416cdf0e10cSrcweir }
417cdf0e10cSrcweir }
418cdf0e10cSrcweir break;
419cdf0e10cSrcweir case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT:
420cdf0e10cSrcweir {
421cdf0e10cSrcweir pHash = bProgName ? pFrameProgMap : pFrameUIMap;
422cdf0e10cSrcweir if ( !pHash )
423cdf0e10cSrcweir {
424cdf0e10cSrcweir pHash = new NameToIdHash ( RES_POOLFRM_END - RES_POOLFRM_BEGIN );
425cdf0e10cSrcweir pStrings = bProgName ? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
426cdf0e10cSrcweir for ( sal_uInt16 nIndex=0,nId = RES_POOLFRM_BEGIN ; nId < RES_POOLFRM_END ; nId++,nIndex++ )
427cdf0e10cSrcweir (*pHash)[(*pStrings)[nIndex]] = nId;
428cdf0e10cSrcweir if ( bProgName )
429cdf0e10cSrcweir pFrameProgMap = pHash;
430cdf0e10cSrcweir else
431cdf0e10cSrcweir pFrameUIMap = pHash;
432cdf0e10cSrcweir }
433cdf0e10cSrcweir }
434cdf0e10cSrcweir break;
435cdf0e10cSrcweir case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC:
436cdf0e10cSrcweir {
437cdf0e10cSrcweir pHash = bProgName ? pPageProgMap : pPageUIMap;
438cdf0e10cSrcweir if ( !pHash )
439cdf0e10cSrcweir {
440cdf0e10cSrcweir pHash = new NameToIdHash ( RES_POOLPAGE_END - RES_POOLPAGE_BEGIN );
441cdf0e10cSrcweir pStrings = bProgName ? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
442cdf0e10cSrcweir for ( sal_uInt16 nIndex=0,nId = RES_POOLPAGE_BEGIN ; nId < RES_POOLPAGE_END ; nId++,nIndex++ )
443cdf0e10cSrcweir (*pHash)[(*pStrings)[nIndex]] = nId;
444cdf0e10cSrcweir if ( bProgName )
445cdf0e10cSrcweir pPageProgMap = pHash;
446cdf0e10cSrcweir else
447cdf0e10cSrcweir pPageUIMap = pHash;
448cdf0e10cSrcweir }
449cdf0e10cSrcweir }
450cdf0e10cSrcweir break;
451cdf0e10cSrcweir case nsSwGetPoolIdFromName::GET_POOLID_NUMRULE:
452cdf0e10cSrcweir {
453cdf0e10cSrcweir pHash = bProgName ? pNumRuleProgMap : pNumRuleUIMap;
454cdf0e10cSrcweir if ( !pHash )
455cdf0e10cSrcweir {
456cdf0e10cSrcweir pHash = new NameToIdHash ( RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN );
457cdf0e10cSrcweir pStrings = bProgName ? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
458cdf0e10cSrcweir for ( sal_uInt16 nIndex=0,nId = RES_POOLNUMRULE_BEGIN ; nId < RES_POOLNUMRULE_END ; nId++,nIndex++ )
459cdf0e10cSrcweir (*pHash)[(*pStrings)[nIndex]] = nId;
460cdf0e10cSrcweir if ( bProgName )
461cdf0e10cSrcweir pNumRuleProgMap = pHash;
462cdf0e10cSrcweir else
463cdf0e10cSrcweir pNumRuleUIMap = pHash;
464cdf0e10cSrcweir }
465cdf0e10cSrcweir }
466cdf0e10cSrcweir break;
467cdf0e10cSrcweir }
468cdf0e10cSrcweir #ifdef _NEED_TO_DEBUG_MAPPING
469cdf0e10cSrcweir static sal_Bool bTested = sal_False;
470cdf0e10cSrcweir if ( !bTested )
471cdf0e10cSrcweir {
472cdf0e10cSrcweir bTested = sal_True;
473cdf0e10cSrcweir {
474cdf0e10cSrcweir for ( sal_uInt16 nIndex = 0, nId = RES_POOLCOLL_TEXT_BEGIN ; nId < RES_POOLCOLL_TEXT_END ; nId++,nIndex++ )
475cdf0e10cSrcweir {
476cdf0e10cSrcweir String aString, bString;
477cdf0e10cSrcweir FillUIName ( nId, aString );
478cdf0e10cSrcweir bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
479cdf0e10cSrcweir sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
480cdf0e10cSrcweir FillProgName ( nNewId, aString );
481cdf0e10cSrcweir bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
482cdf0e10cSrcweir nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
483cdf0e10cSrcweir if ( nNewId != nId )
484cdf0e10cSrcweir *((sal_Int32*)0) = 42;
485cdf0e10cSrcweir }
486cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCOLL_LISTS_BEGIN ; nId < RES_POOLCOLL_LISTS_END ; nId++,nIndex++ )
487cdf0e10cSrcweir {
488cdf0e10cSrcweir String aString, bString;
489cdf0e10cSrcweir FillUIName ( nId, aString );
490cdf0e10cSrcweir bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
491cdf0e10cSrcweir sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
492cdf0e10cSrcweir FillProgName ( nNewId, aString );
493cdf0e10cSrcweir bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
494cdf0e10cSrcweir nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
495cdf0e10cSrcweir if ( nNewId != nId )
496cdf0e10cSrcweir *((sal_Int32*)0) = 42;
497cdf0e10cSrcweir }
498cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCOLL_EXTRA_BEGIN ; nId < RES_POOLCOLL_EXTRA_END ; nId++,nIndex++ )
499cdf0e10cSrcweir {
500cdf0e10cSrcweir String aString, bString;
501cdf0e10cSrcweir FillUIName ( nId, aString );
502cdf0e10cSrcweir bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
503cdf0e10cSrcweir sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
504cdf0e10cSrcweir FillProgName ( nNewId, aString );
505cdf0e10cSrcweir bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
506cdf0e10cSrcweir nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
507cdf0e10cSrcweir if ( nNewId != nId )
508cdf0e10cSrcweir *((sal_Int32*)0) = 42;
509cdf0e10cSrcweir }
510cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCOLL_REGISTER_BEGIN ; nId < RES_POOLCOLL_REGISTER_END ; nId++,nIndex++ )
511cdf0e10cSrcweir {
512cdf0e10cSrcweir String aString, bString;
513cdf0e10cSrcweir FillUIName ( nId, aString );
514cdf0e10cSrcweir bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
515cdf0e10cSrcweir sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
516cdf0e10cSrcweir FillProgName ( nNewId, aString );
517cdf0e10cSrcweir bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
518cdf0e10cSrcweir nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
519cdf0e10cSrcweir if ( nNewId != nId )
520cdf0e10cSrcweir *((sal_Int32*)0) = 42;
521cdf0e10cSrcweir }
522cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCOLL_DOC_BEGIN ; nId < RES_POOLCOLL_DOC_END ; nId++,nIndex++ )
523cdf0e10cSrcweir {
524cdf0e10cSrcweir String aString, bString;
525cdf0e10cSrcweir FillUIName ( nId, aString );
526cdf0e10cSrcweir bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
527cdf0e10cSrcweir sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
528cdf0e10cSrcweir FillProgName ( nNewId, aString );
529cdf0e10cSrcweir bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
530cdf0e10cSrcweir nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
531cdf0e10cSrcweir if ( nNewId != nId )
532cdf0e10cSrcweir *((sal_Int32*)0) = 42;
533cdf0e10cSrcweir }
534cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCOLL_HTML_BEGIN ; nId < RES_POOLCOLL_HTML_END ; nId++,nIndex++ )
535cdf0e10cSrcweir {
536cdf0e10cSrcweir String aString, bString;
537cdf0e10cSrcweir FillUIName ( nId, aString );
538cdf0e10cSrcweir bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
539cdf0e10cSrcweir sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
540cdf0e10cSrcweir FillProgName ( nNewId, aString );
541cdf0e10cSrcweir bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
542cdf0e10cSrcweir nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
543cdf0e10cSrcweir if ( nNewId != nId )
544cdf0e10cSrcweir *((sal_Int32*)0) = 42;
545cdf0e10cSrcweir }
546cdf0e10cSrcweir }
547cdf0e10cSrcweir {
548cdf0e10cSrcweir for ( sal_uInt16 nIndex = 0, nId = RES_POOLCHR_NORMAL_BEGIN ; nId < RES_POOLCHR_NORMAL_END ; nId++,nIndex++ )
549cdf0e10cSrcweir {
550cdf0e10cSrcweir String aString, bString;
551cdf0e10cSrcweir FillUIName ( nId, aString );
552cdf0e10cSrcweir bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
553cdf0e10cSrcweir sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
554cdf0e10cSrcweir FillProgName ( nNewId, aString );
555cdf0e10cSrcweir bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
556cdf0e10cSrcweir nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
557cdf0e10cSrcweir if ( nNewId != nId )
558cdf0e10cSrcweir *((sal_Int32*)0) = 42;
559cdf0e10cSrcweir }
560cdf0e10cSrcweir for ( nIndex = 0, nId = RES_POOLCHR_HTML_BEGIN ; nId < RES_POOLCHR_HTML_END ; nId++,nIndex++ )
561cdf0e10cSrcweir {
562cdf0e10cSrcweir String aString, bString;
563cdf0e10cSrcweir FillUIName ( nId, aString );
564cdf0e10cSrcweir bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
565cdf0e10cSrcweir sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
566cdf0e10cSrcweir FillProgName ( nNewId, aString );
567cdf0e10cSrcweir bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
568cdf0e10cSrcweir nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
569cdf0e10cSrcweir if ( nNewId != nId )
570cdf0e10cSrcweir *((sal_Int32*)0) = 42;
571cdf0e10cSrcweir }
572cdf0e10cSrcweir }
573cdf0e10cSrcweir {
574cdf0e10cSrcweir for ( sal_uInt16 nIndex=0,nId = RES_POOLFRM_BEGIN ; nId < RES_POOLFRM_END ; nId++,nIndex++ )
575cdf0e10cSrcweir {
576cdf0e10cSrcweir String aString, bString;
577cdf0e10cSrcweir FillUIName ( nId, aString );
578cdf0e10cSrcweir bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
579cdf0e10cSrcweir sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
580cdf0e10cSrcweir FillProgName ( nNewId, aString );
581cdf0e10cSrcweir bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
582cdf0e10cSrcweir nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
583cdf0e10cSrcweir if ( nNewId != nId )
584cdf0e10cSrcweir *((sal_Int32*)0) = 42;
585cdf0e10cSrcweir }
586cdf0e10cSrcweir }
587cdf0e10cSrcweir {
588cdf0e10cSrcweir for ( sal_uInt16 nIndex=0,nId = RES_POOLPAGE_BEGIN ; nId < RES_POOLPAGE_END ; nId++,nIndex++ )
589cdf0e10cSrcweir {
590cdf0e10cSrcweir String aString, bString;
591cdf0e10cSrcweir FillUIName ( nId, aString );
592cdf0e10cSrcweir bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
593cdf0e10cSrcweir sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
594cdf0e10cSrcweir FillProgName ( nNewId, aString );
595cdf0e10cSrcweir bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
596cdf0e10cSrcweir nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
597cdf0e10cSrcweir if ( nNewId != nId )
598cdf0e10cSrcweir *((sal_Int32*)0) = 42;
599cdf0e10cSrcweir }
600cdf0e10cSrcweir }
601cdf0e10cSrcweir {
602cdf0e10cSrcweir for ( sal_uInt16 nIndex=0,nId = RES_POOLNUMRULE_BEGIN ; nId < RES_POOLNUMRULE_END ; nId++,nIndex++ )
603cdf0e10cSrcweir {
604cdf0e10cSrcweir String aString, bString;
605cdf0e10cSrcweir FillUIName ( nId, aString );
606cdf0e10cSrcweir bString = GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, aString );
607cdf0e10cSrcweir sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
608cdf0e10cSrcweir FillProgName ( nNewId, aString );
609cdf0e10cSrcweir bString = GetUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
610cdf0e10cSrcweir nNewId = GetPoolIdFromUIName ( aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
611cdf0e10cSrcweir if ( nNewId != nId )
612cdf0e10cSrcweir *((sal_Int32*)0) = 42;
613cdf0e10cSrcweir }
614cdf0e10cSrcweir }
615cdf0e10cSrcweir }
616cdf0e10cSrcweir #endif
617cdf0e10cSrcweir return *pHash;
618cdf0e10cSrcweir }
619cdf0e10cSrcweir // This gets the UI Name from the programmatic name
GetUIName(const String & rName,SwGetPoolIdFromName eFlags)620cdf0e10cSrcweir const String& SwStyleNameMapper::GetUIName ( const String& rName, SwGetPoolIdFromName eFlags )
621cdf0e10cSrcweir {
622cdf0e10cSrcweir sal_uInt16 nId = GetPoolIdFromProgName ( rName, eFlags );
623cdf0e10cSrcweir return nId != USHRT_MAX ? GetUIName( nId, rName ) : rName;
624cdf0e10cSrcweir }
625cdf0e10cSrcweir
626cdf0e10cSrcweir
627cdf0e10cSrcweir // Get the programmatic Name from the UI name
GetProgName(const String & rName,SwGetPoolIdFromName eFlags)628cdf0e10cSrcweir const String& SwStyleNameMapper::GetProgName( const String& rName, SwGetPoolIdFromName eFlags )
629cdf0e10cSrcweir {
630cdf0e10cSrcweir sal_uInt16 nId = GetPoolIdFromUIName ( rName, eFlags );
631cdf0e10cSrcweir return nId != USHRT_MAX ? GetProgName( nId, rName ) : rName;
632cdf0e10cSrcweir }
633cdf0e10cSrcweir
634cdf0e10cSrcweir // Get the programmatic name from the UI name in rName and put it into rFillName
FillProgName(const String & rName,String & rFillName,SwGetPoolIdFromName eFlags,sal_Bool bDisambiguate)635cdf0e10cSrcweir void SwStyleNameMapper::FillProgName ( const String& rName, String& rFillName, SwGetPoolIdFromName eFlags, sal_Bool bDisambiguate )
636cdf0e10cSrcweir {
637cdf0e10cSrcweir sal_uInt16 nId = GetPoolIdFromUIName ( rName, eFlags );
638cdf0e10cSrcweir if ( bDisambiguate && nId == USHRT_MAX )
639cdf0e10cSrcweir {
640cdf0e10cSrcweir // rName isn't in our UI name table...check if it's in the programmatic one
641cdf0e10cSrcweir nId = GetPoolIdFromProgName ( rName, eFlags );
642cdf0e10cSrcweir
643cdf0e10cSrcweir rFillName = rName;
644cdf0e10cSrcweir if (nId == USHRT_MAX )
645cdf0e10cSrcweir {
646cdf0e10cSrcweir // It isn't ...make sure the suffix isn't already " (user)"...if it is,
647cdf0e10cSrcweir // we need to add another one
648cdf0e10cSrcweir if ( SuffixIsUser ( rFillName ) )
649cdf0e10cSrcweir rFillName.AppendAscii ( RTL_CONSTASCII_STRINGPARAM ( " (user)" ) );
650cdf0e10cSrcweir }
651cdf0e10cSrcweir else
652cdf0e10cSrcweir {
653cdf0e10cSrcweir // It's in the programmatic name table...append suffix
654cdf0e10cSrcweir rFillName.AppendAscii ( RTL_CONSTASCII_STRINGPARAM ( " (user)" ) );
655cdf0e10cSrcweir }
656cdf0e10cSrcweir }
657cdf0e10cSrcweir else
658cdf0e10cSrcweir {
659cdf0e10cSrcweir // If we aren't trying to disambiguate, then just do a normal fill
660cdf0e10cSrcweir fillNameFromId ( nId, rFillName, sal_True);
661cdf0e10cSrcweir }
662cdf0e10cSrcweir }
663cdf0e10cSrcweir // Get the UI name from the programmatic name in rName and put it into rFillName
FillUIName(const String & rName,String & rFillName,SwGetPoolIdFromName eFlags,sal_Bool bDisambiguate)664cdf0e10cSrcweir void SwStyleNameMapper::FillUIName ( const String& rName, String& rFillName, SwGetPoolIdFromName eFlags, sal_Bool bDisambiguate )
665cdf0e10cSrcweir {
666cdf0e10cSrcweir sal_uInt16 nId = GetPoolIdFromProgName ( rName, eFlags );
667cdf0e10cSrcweir if ( bDisambiguate && nId == USHRT_MAX )
668cdf0e10cSrcweir {
669cdf0e10cSrcweir rFillName = rName;
670cdf0e10cSrcweir // rName isn't in our Prog name table...check if it has a " (user)" suffix, if so remove it
671cdf0e10cSrcweir CheckSuffixAndDelete ( rFillName );
672cdf0e10cSrcweir }
673cdf0e10cSrcweir else
674cdf0e10cSrcweir {
675cdf0e10cSrcweir // If we aren't trying to disambiguate, then just do a normal fill
676cdf0e10cSrcweir fillNameFromId ( nId, rFillName, sal_False);
677cdf0e10cSrcweir }
678cdf0e10cSrcweir }
679cdf0e10cSrcweir
getNameFromId(sal_uInt16 nId,const String & rFillName,sal_Bool bProgName)680cdf0e10cSrcweir const String& SwStyleNameMapper::getNameFromId( sal_uInt16 nId, const String& rFillName, sal_Bool bProgName )
681cdf0e10cSrcweir {
682cdf0e10cSrcweir sal_uInt16 nStt = 0;
683cdf0e10cSrcweir const SvStringsDtor* pStrArr = 0;
684cdf0e10cSrcweir
685cdf0e10cSrcweir switch( (USER_FMT | COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID) & nId )
686cdf0e10cSrcweir {
687cdf0e10cSrcweir case COLL_TEXT_BITS:
688cdf0e10cSrcweir if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
689cdf0e10cSrcweir {
690cdf0e10cSrcweir pStrArr = bProgName ? &GetTextProgNameArray() : &GetTextUINameArray();
691cdf0e10cSrcweir nStt = RES_POOLCOLL_TEXT_BEGIN;
692cdf0e10cSrcweir }
693cdf0e10cSrcweir break;
694cdf0e10cSrcweir case COLL_LISTS_BITS:
695cdf0e10cSrcweir if( RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END )
696cdf0e10cSrcweir {
697cdf0e10cSrcweir pStrArr = bProgName ? &GetListsProgNameArray() : &GetListsUINameArray();
698cdf0e10cSrcweir nStt = RES_POOLCOLL_LISTS_BEGIN;
699cdf0e10cSrcweir }
700cdf0e10cSrcweir break;
701cdf0e10cSrcweir case COLL_EXTRA_BITS:
702cdf0e10cSrcweir if( RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END )
703cdf0e10cSrcweir {
704cdf0e10cSrcweir pStrArr = bProgName ? &GetExtraProgNameArray() : &GetExtraUINameArray();
705cdf0e10cSrcweir nStt = RES_POOLCOLL_EXTRA_BEGIN;
706cdf0e10cSrcweir }
707cdf0e10cSrcweir break;
708cdf0e10cSrcweir case COLL_REGISTER_BITS:
709cdf0e10cSrcweir if( RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END )
710cdf0e10cSrcweir {
711cdf0e10cSrcweir pStrArr = bProgName ? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
712cdf0e10cSrcweir nStt = RES_POOLCOLL_REGISTER_BEGIN;
713cdf0e10cSrcweir }
714cdf0e10cSrcweir break;
715cdf0e10cSrcweir case COLL_DOC_BITS:
716cdf0e10cSrcweir if( RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END )
717cdf0e10cSrcweir {
718cdf0e10cSrcweir pStrArr = bProgName ? &GetDocProgNameArray() : &GetDocUINameArray();
719cdf0e10cSrcweir nStt = RES_POOLCOLL_DOC_BEGIN;
720cdf0e10cSrcweir }
721cdf0e10cSrcweir break;
722cdf0e10cSrcweir case COLL_HTML_BITS:
723cdf0e10cSrcweir if( RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END )
724cdf0e10cSrcweir {
725cdf0e10cSrcweir pStrArr = bProgName ? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
726cdf0e10cSrcweir nStt = RES_POOLCOLL_HTML_BEGIN;
727cdf0e10cSrcweir }
728cdf0e10cSrcweir break;
729cdf0e10cSrcweir case POOLGRP_CHARFMT:
730cdf0e10cSrcweir if( RES_POOLCHR_NORMAL_BEGIN <= nId && nId < RES_POOLCHR_NORMAL_END )
731cdf0e10cSrcweir {
732cdf0e10cSrcweir pStrArr = bProgName ? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
733cdf0e10cSrcweir nStt = RES_POOLCHR_NORMAL_BEGIN;
734cdf0e10cSrcweir }
735cdf0e10cSrcweir else if( RES_POOLCHR_HTML_BEGIN <= nId && nId < RES_POOLCHR_HTML_END )
736cdf0e10cSrcweir {
737cdf0e10cSrcweir pStrArr = bProgName ? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
738cdf0e10cSrcweir nStt = RES_POOLCHR_HTML_BEGIN;
739cdf0e10cSrcweir }
740cdf0e10cSrcweir break;
741cdf0e10cSrcweir case POOLGRP_FRAMEFMT:
742cdf0e10cSrcweir if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
743cdf0e10cSrcweir {
744cdf0e10cSrcweir pStrArr = bProgName ? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
745cdf0e10cSrcweir nStt = RES_POOLFRM_BEGIN;
746cdf0e10cSrcweir }
747cdf0e10cSrcweir break;
748cdf0e10cSrcweir case POOLGRP_PAGEDESC:
749cdf0e10cSrcweir if( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END )
750cdf0e10cSrcweir {
751cdf0e10cSrcweir pStrArr = bProgName ? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
752cdf0e10cSrcweir nStt = RES_POOLPAGE_BEGIN;
753cdf0e10cSrcweir }
754cdf0e10cSrcweir break;
755cdf0e10cSrcweir case POOLGRP_NUMRULE:
756cdf0e10cSrcweir if( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END )
757cdf0e10cSrcweir {
758cdf0e10cSrcweir pStrArr = bProgName ? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
759cdf0e10cSrcweir nStt = RES_POOLNUMRULE_BEGIN;
760cdf0e10cSrcweir }
761cdf0e10cSrcweir break;
762cdf0e10cSrcweir }
763cdf0e10cSrcweir return pStrArr ? *(pStrArr->operator[] ( nId - nStt ) ) : rFillName;
764cdf0e10cSrcweir }
fillNameFromId(sal_uInt16 nId,String & rFillName,sal_Bool bProgName)765cdf0e10cSrcweir void SwStyleNameMapper::fillNameFromId( sal_uInt16 nId, String& rFillName, sal_Bool bProgName )
766cdf0e10cSrcweir {
767cdf0e10cSrcweir sal_uInt16 nStt = 0;
768cdf0e10cSrcweir const SvStringsDtor* pStrArr = 0;
769cdf0e10cSrcweir
770cdf0e10cSrcweir switch( (USER_FMT | COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID) & nId )
771cdf0e10cSrcweir {
772cdf0e10cSrcweir case COLL_TEXT_BITS:
773cdf0e10cSrcweir if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
774cdf0e10cSrcweir {
775cdf0e10cSrcweir pStrArr = bProgName ? &GetTextProgNameArray() : &GetTextUINameArray();
776cdf0e10cSrcweir nStt = RES_POOLCOLL_TEXT_BEGIN;
777cdf0e10cSrcweir }
778cdf0e10cSrcweir break;
779cdf0e10cSrcweir case COLL_LISTS_BITS:
780cdf0e10cSrcweir if( RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END )
781cdf0e10cSrcweir {
782cdf0e10cSrcweir pStrArr = bProgName ? &GetListsProgNameArray() : &GetListsUINameArray();
783cdf0e10cSrcweir nStt = RES_POOLCOLL_LISTS_BEGIN;
784cdf0e10cSrcweir }
785cdf0e10cSrcweir break;
786cdf0e10cSrcweir case COLL_EXTRA_BITS:
787cdf0e10cSrcweir if( RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END )
788cdf0e10cSrcweir {
789cdf0e10cSrcweir pStrArr = bProgName ? &GetExtraProgNameArray() : &GetExtraUINameArray();
790cdf0e10cSrcweir nStt = RES_POOLCOLL_EXTRA_BEGIN;
791cdf0e10cSrcweir }
792cdf0e10cSrcweir break;
793cdf0e10cSrcweir case COLL_REGISTER_BITS:
794cdf0e10cSrcweir if( RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END )
795cdf0e10cSrcweir {
796cdf0e10cSrcweir pStrArr = bProgName ? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
797cdf0e10cSrcweir nStt = RES_POOLCOLL_REGISTER_BEGIN;
798cdf0e10cSrcweir }
799cdf0e10cSrcweir break;
800cdf0e10cSrcweir case COLL_DOC_BITS:
801cdf0e10cSrcweir if( RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END )
802cdf0e10cSrcweir {
803cdf0e10cSrcweir pStrArr = bProgName ? &GetDocProgNameArray() : &GetDocUINameArray();
804cdf0e10cSrcweir nStt = RES_POOLCOLL_DOC_BEGIN;
805cdf0e10cSrcweir }
806cdf0e10cSrcweir break;
807cdf0e10cSrcweir case COLL_HTML_BITS:
808cdf0e10cSrcweir if( RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END )
809cdf0e10cSrcweir {
810cdf0e10cSrcweir pStrArr = bProgName ? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
811cdf0e10cSrcweir nStt = RES_POOLCOLL_HTML_BEGIN;
812cdf0e10cSrcweir }
813cdf0e10cSrcweir break;
814cdf0e10cSrcweir case POOLGRP_CHARFMT:
815cdf0e10cSrcweir if( RES_POOLCHR_NORMAL_BEGIN <= nId && nId < RES_POOLCHR_NORMAL_END )
816cdf0e10cSrcweir {
817cdf0e10cSrcweir pStrArr = bProgName ? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
818cdf0e10cSrcweir nStt = RES_POOLCHR_NORMAL_BEGIN;
819cdf0e10cSrcweir }
820cdf0e10cSrcweir else if( RES_POOLCHR_HTML_BEGIN <= nId && nId < RES_POOLCHR_HTML_END )
821cdf0e10cSrcweir {
822cdf0e10cSrcweir pStrArr = bProgName ? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
823cdf0e10cSrcweir nStt = RES_POOLCHR_HTML_BEGIN;
824cdf0e10cSrcweir }
825cdf0e10cSrcweir break;
826cdf0e10cSrcweir case POOLGRP_FRAMEFMT:
827cdf0e10cSrcweir if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
828cdf0e10cSrcweir {
829cdf0e10cSrcweir pStrArr = bProgName ? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
830cdf0e10cSrcweir nStt = RES_POOLFRM_BEGIN;
831cdf0e10cSrcweir }
832cdf0e10cSrcweir break;
833cdf0e10cSrcweir case POOLGRP_PAGEDESC:
834cdf0e10cSrcweir if( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END )
835cdf0e10cSrcweir {
836cdf0e10cSrcweir pStrArr = bProgName ? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
837cdf0e10cSrcweir nStt = RES_POOLPAGE_BEGIN;
838cdf0e10cSrcweir }
839cdf0e10cSrcweir break;
840cdf0e10cSrcweir case POOLGRP_NUMRULE:
841cdf0e10cSrcweir if( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END )
842cdf0e10cSrcweir {
843cdf0e10cSrcweir pStrArr = bProgName ? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
844cdf0e10cSrcweir nStt = RES_POOLNUMRULE_BEGIN;
845cdf0e10cSrcweir }
846cdf0e10cSrcweir break;
847cdf0e10cSrcweir }
848cdf0e10cSrcweir if (pStrArr)
849cdf0e10cSrcweir rFillName = *(pStrArr->operator[] ( nId - nStt ) );
850cdf0e10cSrcweir }
851cdf0e10cSrcweir // Get the UI Name from the pool ID
FillUIName(sal_uInt16 nId,String & rFillName)852cdf0e10cSrcweir void SwStyleNameMapper::FillUIName ( sal_uInt16 nId, String& rFillName )
853cdf0e10cSrcweir {
854cdf0e10cSrcweir fillNameFromId ( nId, rFillName, sal_False );
855cdf0e10cSrcweir }
856cdf0e10cSrcweir // Get the UI Name from the pool ID
GetUIName(sal_uInt16 nId,const String & rName)857cdf0e10cSrcweir const String& SwStyleNameMapper::GetUIName ( sal_uInt16 nId, const String& rName )
858cdf0e10cSrcweir {
859cdf0e10cSrcweir return getNameFromId ( nId, rName, sal_False );
860cdf0e10cSrcweir }
861cdf0e10cSrcweir
862cdf0e10cSrcweir // Get the programmatic Name from the pool ID
FillProgName(sal_uInt16 nId,String & rFillName)863cdf0e10cSrcweir void SwStyleNameMapper::FillProgName ( sal_uInt16 nId, String& rFillName )
864cdf0e10cSrcweir {
865cdf0e10cSrcweir fillNameFromId ( nId, rFillName, sal_True );
866cdf0e10cSrcweir }
867cdf0e10cSrcweir // Get the programmatic Name from the pool ID
GetProgName(sal_uInt16 nId,const String & rName)868cdf0e10cSrcweir const String& SwStyleNameMapper::GetProgName ( sal_uInt16 nId, const String& rName )
869cdf0e10cSrcweir {
870cdf0e10cSrcweir return getNameFromId ( nId, rName, sal_True );
871cdf0e10cSrcweir }
872cdf0e10cSrcweir // This gets the PoolId from the UI Name
GetPoolIdFromUIName(const String & rName,SwGetPoolIdFromName eFlags)873cdf0e10cSrcweir sal_uInt16 SwStyleNameMapper::GetPoolIdFromUIName( const String& rName, SwGetPoolIdFromName eFlags )
874cdf0e10cSrcweir {
875cdf0e10cSrcweir const NameToIdHash & rHashMap = getHashTable ( eFlags, sal_False );
876cdf0e10cSrcweir NameToIdHash::const_iterator aIter = rHashMap.find ( &rName );
877cdf0e10cSrcweir return aIter != rHashMap.end() ? (*aIter).second : USHRT_MAX;
878cdf0e10cSrcweir }
879cdf0e10cSrcweir // Get the Pool ID from the programmatic name
GetPoolIdFromProgName(const String & rName,SwGetPoolIdFromName eFlags)880cdf0e10cSrcweir sal_uInt16 SwStyleNameMapper::GetPoolIdFromProgName( const String& rName, SwGetPoolIdFromName eFlags )
881cdf0e10cSrcweir {
882cdf0e10cSrcweir const NameToIdHash & rHashMap = getHashTable ( eFlags, sal_True );
883cdf0e10cSrcweir NameToIdHash::const_iterator aIter = rHashMap.find ( &rName );
884cdf0e10cSrcweir return aIter != rHashMap.end() ? (*aIter).second : USHRT_MAX;
885cdf0e10cSrcweir }
886cdf0e10cSrcweir
NewUINameArray(SvStringsDtor * & pNameArray,sal_uInt16 nStt,sal_uInt16 nEnd)887cdf0e10cSrcweir SvStringsDtor* SwStyleNameMapper::NewUINameArray( SvStringsDtor*& pNameArray, sal_uInt16 nStt, sal_uInt16 nEnd )
888cdf0e10cSrcweir {
889cdf0e10cSrcweir if( !pNameArray )
890cdf0e10cSrcweir {
891cdf0e10cSrcweir pNameArray = new SvStringsDtor( static_cast < sal_Int8 > (nEnd - nStt), 1 );
892cdf0e10cSrcweir while( nStt < nEnd )
893cdf0e10cSrcweir {
894cdf0e10cSrcweir const ResId rRId( nStt, *pSwResMgr );
895cdf0e10cSrcweir String* pStr = new String( rRId );
896cdf0e10cSrcweir pNameArray->Insert( pStr, pNameArray->Count() );
897cdf0e10cSrcweir ++nStt;
898cdf0e10cSrcweir }
899cdf0e10cSrcweir }
900cdf0e10cSrcweir return pNameArray;
901cdf0e10cSrcweir }
902cdf0e10cSrcweir
GetTextUINameArray()903cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetTextUINameArray()
904cdf0e10cSrcweir {
905cdf0e10cSrcweir return pTextUINameArray ? *pTextUINameArray :
906cdf0e10cSrcweir *NewUINameArray( pTextUINameArray, RC_POOLCOLL_TEXT_BEGIN,
907cdf0e10cSrcweir ( RC_POOLCOLL_TEXT_BEGIN +
908cdf0e10cSrcweir (RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN )) );
909cdf0e10cSrcweir }
910cdf0e10cSrcweir
GetListsUINameArray()911cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetListsUINameArray()
912cdf0e10cSrcweir {
913cdf0e10cSrcweir return pListsUINameArray ? *pListsUINameArray :
914cdf0e10cSrcweir *NewUINameArray( pListsUINameArray, RC_POOLCOLL_LISTS_BEGIN,
915cdf0e10cSrcweir ( RC_POOLCOLL_LISTS_BEGIN +
916cdf0e10cSrcweir (RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN )) );
917cdf0e10cSrcweir }
918cdf0e10cSrcweir
GetExtraUINameArray()919cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetExtraUINameArray()
920cdf0e10cSrcweir {
921cdf0e10cSrcweir return pExtraUINameArray ? *pExtraUINameArray :
922cdf0e10cSrcweir *NewUINameArray( pExtraUINameArray, RC_POOLCOLL_EXTRA_BEGIN,
923cdf0e10cSrcweir ( RC_POOLCOLL_EXTRA_BEGIN +
924cdf0e10cSrcweir (RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN )) );
925cdf0e10cSrcweir }
926cdf0e10cSrcweir
GetRegisterUINameArray()927cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetRegisterUINameArray()
928cdf0e10cSrcweir {
929cdf0e10cSrcweir return pRegisterUINameArray ? *pRegisterUINameArray :
930cdf0e10cSrcweir *NewUINameArray( pRegisterUINameArray, RC_POOLCOLL_REGISTER_BEGIN,
931cdf0e10cSrcweir ( RC_POOLCOLL_REGISTER_BEGIN +
932cdf0e10cSrcweir (RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN )) );
933cdf0e10cSrcweir }
934cdf0e10cSrcweir
GetDocUINameArray()935cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetDocUINameArray()
936cdf0e10cSrcweir {
937cdf0e10cSrcweir return pDocUINameArray ? *pDocUINameArray :
938cdf0e10cSrcweir *NewUINameArray( pDocUINameArray, RC_POOLCOLL_DOC_BEGIN,
939cdf0e10cSrcweir ( RC_POOLCOLL_DOC_BEGIN +
940cdf0e10cSrcweir (RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN )) );
941cdf0e10cSrcweir }
942cdf0e10cSrcweir
GetHTMLUINameArray()943cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetHTMLUINameArray()
944cdf0e10cSrcweir {
945cdf0e10cSrcweir return pHTMLUINameArray ? *pHTMLUINameArray :
946cdf0e10cSrcweir *NewUINameArray( pHTMLUINameArray, RC_POOLCOLL_HTML_BEGIN,
947cdf0e10cSrcweir ( RC_POOLCOLL_HTML_BEGIN +
948cdf0e10cSrcweir (RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN )) );
949cdf0e10cSrcweir }
950cdf0e10cSrcweir
GetFrmFmtUINameArray()951cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetFrmFmtUINameArray()
952cdf0e10cSrcweir {
953cdf0e10cSrcweir return pFrmFmtUINameArray ? *pFrmFmtUINameArray :
954cdf0e10cSrcweir *NewUINameArray( pFrmFmtUINameArray, RC_POOLFRMFMT_BEGIN,
955cdf0e10cSrcweir ( RC_POOLFRMFMT_BEGIN +
956cdf0e10cSrcweir (RES_POOLFRM_END - RES_POOLFRM_BEGIN )) );
957cdf0e10cSrcweir }
958cdf0e10cSrcweir
GetChrFmtUINameArray()959cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetChrFmtUINameArray()
960cdf0e10cSrcweir {
961cdf0e10cSrcweir return pChrFmtUINameArray ? *pChrFmtUINameArray :
962cdf0e10cSrcweir *NewUINameArray( pChrFmtUINameArray, RC_POOLCHRFMT_BEGIN,
963cdf0e10cSrcweir ( RC_POOLCHRFMT_BEGIN +
964cdf0e10cSrcweir (RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN )) );
965cdf0e10cSrcweir }
966cdf0e10cSrcweir
GetHTMLChrFmtUINameArray()967cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetHTMLChrFmtUINameArray()
968cdf0e10cSrcweir {
969cdf0e10cSrcweir return pHTMLChrFmtUINameArray ? *pHTMLChrFmtUINameArray :
970cdf0e10cSrcweir *NewUINameArray( pHTMLChrFmtUINameArray, RC_POOLCHRFMT_HTML_BEGIN,
971cdf0e10cSrcweir ( RC_POOLCHRFMT_HTML_BEGIN +
972cdf0e10cSrcweir (RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN )) );
973cdf0e10cSrcweir }
974cdf0e10cSrcweir
GetPageDescUINameArray()975cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetPageDescUINameArray()
976cdf0e10cSrcweir {
977cdf0e10cSrcweir return pPageDescUINameArray ? *pPageDescUINameArray :
978cdf0e10cSrcweir *NewUINameArray( pPageDescUINameArray, RC_POOLPAGEDESC_BEGIN,
979cdf0e10cSrcweir ( RC_POOLPAGEDESC_BEGIN +
980cdf0e10cSrcweir (RES_POOLPAGE_END - RES_POOLPAGE_BEGIN )) );
981cdf0e10cSrcweir }
982cdf0e10cSrcweir
GetNumRuleUINameArray()983cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetNumRuleUINameArray()
984cdf0e10cSrcweir {
985cdf0e10cSrcweir return pNumRuleUINameArray ? *pNumRuleUINameArray :
986cdf0e10cSrcweir *NewUINameArray( pNumRuleUINameArray, RC_POOLNUMRULE_BEGIN,
987cdf0e10cSrcweir ( RC_POOLNUMRULE_BEGIN +
988cdf0e10cSrcweir (RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN )) );
989cdf0e10cSrcweir }
990cdf0e10cSrcweir
NewProgNameArray(SvStringsDtor * & pProgNameArray,const SwTableEntry * pTable,sal_uInt8 nCount)991cdf0e10cSrcweir SvStringsDtor* SwStyleNameMapper::NewProgNameArray( SvStringsDtor*& pProgNameArray, const SwTableEntry *pTable, sal_uInt8 nCount )
992cdf0e10cSrcweir {
993cdf0e10cSrcweir if( !pProgNameArray )
994cdf0e10cSrcweir {
995cdf0e10cSrcweir pProgNameArray = new SvStringsDtor( nCount, 1 );
996cdf0e10cSrcweir while (pTable->nLength)
997cdf0e10cSrcweir {
998cdf0e10cSrcweir String* pStr = new String( pTable->pChar, pTable->nLength, RTL_TEXTENCODING_ASCII_US );
999cdf0e10cSrcweir pProgNameArray->Insert( pStr, pProgNameArray->Count() );
1000cdf0e10cSrcweir pTable++;
1001cdf0e10cSrcweir }
1002cdf0e10cSrcweir }
1003cdf0e10cSrcweir return pProgNameArray;
1004cdf0e10cSrcweir }
1005cdf0e10cSrcweir
GetTextProgNameArray()1006cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetTextProgNameArray()
1007cdf0e10cSrcweir {
1008cdf0e10cSrcweir return pTextProgNameArray ? *pTextProgNameArray :
1009cdf0e10cSrcweir *NewProgNameArray( pTextProgNameArray, TextProgNameTable,
1010cdf0e10cSrcweir sizeof ( TextProgNameTable ) / sizeof ( SwTableEntry ) );
1011cdf0e10cSrcweir }
1012cdf0e10cSrcweir
GetListsProgNameArray()1013cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetListsProgNameArray()
1014cdf0e10cSrcweir {
1015cdf0e10cSrcweir return pListsProgNameArray ? *pListsProgNameArray :
1016cdf0e10cSrcweir *NewProgNameArray( pListsProgNameArray, ListsProgNameTable,
1017cdf0e10cSrcweir sizeof ( ListsProgNameTable ) / sizeof ( SwTableEntry ) );
1018cdf0e10cSrcweir }
1019cdf0e10cSrcweir
GetExtraProgNameArray()1020cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetExtraProgNameArray()
1021cdf0e10cSrcweir {
1022cdf0e10cSrcweir return pExtraProgNameArray ? *pExtraProgNameArray :
1023cdf0e10cSrcweir *NewProgNameArray( pExtraProgNameArray, ExtraProgNameTable,
1024cdf0e10cSrcweir sizeof ( ExtraProgNameTable ) / sizeof ( SwTableEntry ) );
1025cdf0e10cSrcweir }
1026cdf0e10cSrcweir
GetRegisterProgNameArray()1027cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetRegisterProgNameArray()
1028cdf0e10cSrcweir {
1029cdf0e10cSrcweir return pRegisterProgNameArray ? *pRegisterProgNameArray :
1030cdf0e10cSrcweir *NewProgNameArray( pRegisterProgNameArray, RegisterProgNameTable,
1031cdf0e10cSrcweir sizeof ( RegisterProgNameTable ) / sizeof ( SwTableEntry ) );
1032cdf0e10cSrcweir }
1033cdf0e10cSrcweir
GetDocProgNameArray()1034cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetDocProgNameArray()
1035cdf0e10cSrcweir {
1036cdf0e10cSrcweir return pDocProgNameArray ? *pDocProgNameArray :
1037cdf0e10cSrcweir *NewProgNameArray( pDocProgNameArray, DocProgNameTable,
1038cdf0e10cSrcweir sizeof ( DocProgNameTable ) / sizeof ( SwTableEntry ) );
1039cdf0e10cSrcweir }
1040cdf0e10cSrcweir
GetHTMLProgNameArray()1041cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetHTMLProgNameArray()
1042cdf0e10cSrcweir {
1043cdf0e10cSrcweir return pHTMLProgNameArray ? *pHTMLProgNameArray :
1044cdf0e10cSrcweir *NewProgNameArray( pHTMLProgNameArray, HTMLProgNameTable,
1045cdf0e10cSrcweir sizeof ( HTMLProgNameTable ) / sizeof ( SwTableEntry ) );
1046cdf0e10cSrcweir }
1047cdf0e10cSrcweir
GetFrmFmtProgNameArray()1048cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetFrmFmtProgNameArray()
1049cdf0e10cSrcweir {
1050cdf0e10cSrcweir return pFrmFmtProgNameArray ? *pFrmFmtProgNameArray :
1051cdf0e10cSrcweir *NewProgNameArray( pFrmFmtProgNameArray, FrmFmtProgNameTable,
1052cdf0e10cSrcweir sizeof ( FrmFmtProgNameTable ) / sizeof ( SwTableEntry ) );
1053cdf0e10cSrcweir }
1054cdf0e10cSrcweir
GetChrFmtProgNameArray()1055cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetChrFmtProgNameArray()
1056cdf0e10cSrcweir {
1057cdf0e10cSrcweir return pChrFmtProgNameArray ? *pChrFmtProgNameArray :
1058cdf0e10cSrcweir *NewProgNameArray( pChrFmtProgNameArray, ChrFmtProgNameTable,
1059cdf0e10cSrcweir sizeof ( ChrFmtProgNameTable ) / sizeof ( SwTableEntry ) );
1060cdf0e10cSrcweir }
1061cdf0e10cSrcweir
GetHTMLChrFmtProgNameArray()1062cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetHTMLChrFmtProgNameArray()
1063cdf0e10cSrcweir {
1064cdf0e10cSrcweir return pHTMLChrFmtProgNameArray ? *pHTMLChrFmtProgNameArray :
1065cdf0e10cSrcweir *NewProgNameArray( pHTMLChrFmtProgNameArray, HTMLChrFmtProgNameTable,
1066cdf0e10cSrcweir sizeof ( HTMLChrFmtProgNameTable ) / sizeof ( SwTableEntry ) );
1067cdf0e10cSrcweir }
1068cdf0e10cSrcweir
GetPageDescProgNameArray()1069cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetPageDescProgNameArray()
1070cdf0e10cSrcweir {
1071cdf0e10cSrcweir return pPageDescProgNameArray ? *pPageDescProgNameArray :
1072cdf0e10cSrcweir *NewProgNameArray( pPageDescProgNameArray, PageDescProgNameTable,
1073cdf0e10cSrcweir sizeof ( PageDescProgNameTable ) / sizeof ( SwTableEntry ) );
1074cdf0e10cSrcweir }
1075cdf0e10cSrcweir
GetNumRuleProgNameArray()1076cdf0e10cSrcweir const SvStringsDtor& SwStyleNameMapper::GetNumRuleProgNameArray()
1077cdf0e10cSrcweir {
1078cdf0e10cSrcweir return pNumRuleProgNameArray ? *pNumRuleProgNameArray :
1079cdf0e10cSrcweir *NewProgNameArray( pNumRuleProgNameArray, NumRuleProgNameTable,
1080cdf0e10cSrcweir sizeof ( NumRuleProgNameTable ) / sizeof ( SwTableEntry ) );
1081cdf0e10cSrcweir }
1082cdf0e10cSrcweir
1083cdf0e10cSrcweir
GetSpecialExtraProgName(const String & rExtraUIName)1084cdf0e10cSrcweir const String SwStyleNameMapper::GetSpecialExtraProgName( const String& rExtraUIName )
1085cdf0e10cSrcweir {
1086cdf0e10cSrcweir String aRes = rExtraUIName;
1087cdf0e10cSrcweir sal_Bool bChgName = sal_False;
1088cdf0e10cSrcweir const SvStringsDtor& rExtraArr = GetExtraUINameArray();
1089cdf0e10cSrcweir static sal_uInt16 nIds[] =
1090cdf0e10cSrcweir {
1091cdf0e10cSrcweir RES_POOLCOLL_LABEL_DRAWING - RES_POOLCOLL_EXTRA_BEGIN,
1092cdf0e10cSrcweir RES_POOLCOLL_LABEL_ABB - RES_POOLCOLL_EXTRA_BEGIN,
1093cdf0e10cSrcweir RES_POOLCOLL_LABEL_TABLE - RES_POOLCOLL_EXTRA_BEGIN,
1094cdf0e10cSrcweir RES_POOLCOLL_LABEL_FRAME- RES_POOLCOLL_EXTRA_BEGIN,
1095cdf0e10cSrcweir 0
1096cdf0e10cSrcweir };
1097cdf0e10cSrcweir const sal_uInt16 * pIds;
1098cdf0e10cSrcweir for ( pIds = nIds; *pIds; ++pIds)
1099cdf0e10cSrcweir {
1100cdf0e10cSrcweir if (aRes == *rExtraArr[ *pIds ])
1101cdf0e10cSrcweir {
1102cdf0e10cSrcweir bChgName = sal_True;
1103cdf0e10cSrcweir break;
1104cdf0e10cSrcweir }
1105cdf0e10cSrcweir }
1106cdf0e10cSrcweir if (bChgName)
1107cdf0e10cSrcweir aRes = *GetExtraProgNameArray()[*pIds];
1108cdf0e10cSrcweir return aRes;
1109cdf0e10cSrcweir }
1110cdf0e10cSrcweir
GetSpecialExtraUIName(const String & rExtraProgName)1111cdf0e10cSrcweir const String SwStyleNameMapper::GetSpecialExtraUIName( const String& rExtraProgName )
1112cdf0e10cSrcweir {
1113cdf0e10cSrcweir String aRes = rExtraProgName;
1114cdf0e10cSrcweir sal_Bool bChgName = sal_False;
1115cdf0e10cSrcweir const SvStringsDtor& rExtraArr = GetExtraProgNameArray();
1116cdf0e10cSrcweir static sal_uInt16 nIds[] =
1117cdf0e10cSrcweir {
1118cdf0e10cSrcweir RES_POOLCOLL_LABEL_DRAWING - RES_POOLCOLL_EXTRA_BEGIN,
1119cdf0e10cSrcweir RES_POOLCOLL_LABEL_ABB - RES_POOLCOLL_EXTRA_BEGIN,
1120cdf0e10cSrcweir RES_POOLCOLL_LABEL_TABLE - RES_POOLCOLL_EXTRA_BEGIN,
1121cdf0e10cSrcweir RES_POOLCOLL_LABEL_FRAME- RES_POOLCOLL_EXTRA_BEGIN,
1122cdf0e10cSrcweir 0
1123cdf0e10cSrcweir };
1124cdf0e10cSrcweir const sal_uInt16 * pIds;
1125cdf0e10cSrcweir
1126cdf0e10cSrcweir for ( pIds = nIds; *pIds; ++pIds)
1127cdf0e10cSrcweir {
1128cdf0e10cSrcweir if (aRes == *rExtraArr[ *pIds ])
1129cdf0e10cSrcweir {
1130cdf0e10cSrcweir bChgName = sal_True;
1131cdf0e10cSrcweir break;
1132cdf0e10cSrcweir }
1133cdf0e10cSrcweir }
1134cdf0e10cSrcweir if (bChgName)
1135cdf0e10cSrcweir aRes = *GetExtraUINameArray()[*pIds];
1136cdf0e10cSrcweir return aRes;
1137cdf0e10cSrcweir }
1138cdf0e10cSrcweir
1139