1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SwStyleNameMapper.cxx,v $
10 * $Revision: 1.15.224.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <SwStyleNameMapper.hxx>
36 #define _SVSTDARR_STRINGSDTOR
37 #include <svtools/svstdarr.hxx>
38 #include <tools/resmgr.hxx>
39 #include <poolfmt.hxx>
43 #include <tools/debug.hxx>
44 extern ResMgr
* pSwResMgr
;
45 // Initialise UI names to 0
46 SvStringsDtor
*SwStyleNameMapper::pTextUINameArray
= 0,
47 *SwStyleNameMapper::pListsUINameArray
= 0,
48 *SwStyleNameMapper::pExtraUINameArray
= 0,
49 *SwStyleNameMapper::pRegisterUINameArray
= 0,
50 *SwStyleNameMapper::pDocUINameArray
= 0,
51 *SwStyleNameMapper::pHTMLUINameArray
= 0,
52 *SwStyleNameMapper::pFrmFmtUINameArray
= 0,
53 *SwStyleNameMapper::pChrFmtUINameArray
= 0,
54 *SwStyleNameMapper::pHTMLChrFmtUINameArray
= 0,
55 *SwStyleNameMapper::pPageDescUINameArray
= 0,
56 *SwStyleNameMapper::pNumRuleUINameArray
= 0,
58 // Initialise programmatic names to 0
59 *SwStyleNameMapper::pTextProgNameArray
= 0,
60 *SwStyleNameMapper::pListsProgNameArray
= 0,
61 *SwStyleNameMapper::pExtraProgNameArray
= 0,
62 *SwStyleNameMapper::pRegisterProgNameArray
= 0,
63 *SwStyleNameMapper::pDocProgNameArray
= 0,
64 *SwStyleNameMapper::pHTMLProgNameArray
= 0,
65 *SwStyleNameMapper::pFrmFmtProgNameArray
= 0,
66 *SwStyleNameMapper::pChrFmtProgNameArray
= 0,
67 *SwStyleNameMapper::pHTMLChrFmtProgNameArray
= 0,
68 *SwStyleNameMapper::pPageDescProgNameArray
= 0,
69 *SwStyleNameMapper::pNumRuleProgNameArray
= 0;
71 NameToIdHash
*SwStyleNameMapper::pParaUIMap
= 0,
72 *SwStyleNameMapper::pCharUIMap
= 0,
73 *SwStyleNameMapper::pPageUIMap
= 0,
74 *SwStyleNameMapper::pFrameUIMap
= 0,
75 *SwStyleNameMapper::pNumRuleUIMap
= 0,
77 *SwStyleNameMapper::pParaProgMap
= 0,
78 *SwStyleNameMapper::pCharProgMap
= 0,
79 *SwStyleNameMapper::pPageProgMap
= 0,
80 *SwStyleNameMapper::pFrameProgMap
= 0,
81 *SwStyleNameMapper::pNumRuleProgMap
= 0;
83 // SwTableEntry so we can pass the length to the String CTOR
87 const sal_Char
*pChar
;
90 #define ENTRY( s ) { sizeof (s)-1, s }
92 // Hard coded Programmatic Name tables
93 const struct SwTableEntry TextProgNameTable
[] =
95 ENTRY( "Standard" ), // RES_POOLCOLL_STANDARD
97 ENTRY( "First line indent" ),
98 ENTRY( "Hanging indent" ),
99 ENTRY( "Text body indent" ),
100 ENTRY( "Salutation" ),
101 ENTRY( "Signature" ),
102 ENTRY( "List Indent" ), // RES_POOLCOLL_CONFRONTATION
103 ENTRY( "Marginalia" ),
105 ENTRY( "Heading 1" ),
106 ENTRY( "Heading 2" ),
107 ENTRY( "Heading 3" ),
108 ENTRY( "Heading 4" ),
109 ENTRY( "Heading 5" ),
110 ENTRY( "Heading 6" ),
111 ENTRY( "Heading 7" ),
112 ENTRY( "Heading 8" ),
113 ENTRY( "Heading 9" ),
114 ENTRY( "Heading 10" ), // RES_POOLCOLL_TEXT_END
118 const struct SwTableEntry ListsProgNameTable
[] =
120 ENTRY( "List" ), // STR_POCO_PRGM_NUMBUL_BASE
121 ENTRY( "Numbering 1 Start" ), // STR_POCO_PRGM_NUM_LEVEL1S
122 ENTRY( "Numbering 1" ),
123 ENTRY( "Numbering 1 End" ),
124 ENTRY( "Numbering 1 Cont." ),
125 ENTRY( "Numbering 2 Start" ),
126 ENTRY( "Numbering 2" ),
127 ENTRY( "Numbering 2 End" ),
128 ENTRY( "Numbering 2 Cont." ),
129 ENTRY( "Numbering 3 Start" ),
130 ENTRY( "Numbering 3" ),
131 ENTRY( "Numbering 3 End" ),
132 ENTRY( "Numbering 3 Cont." ),
133 ENTRY( "Numbering 4 Start" ),
134 ENTRY( "Numbering 4" ),
135 ENTRY( "Numbering 4 End" ),
136 ENTRY( "Numbering 4 Cont." ),
137 ENTRY( "Numbering 5 Start" ),
138 ENTRY( "Numbering 5" ),
139 ENTRY( "Numbering 5 End" ),
140 ENTRY( "Numbering 5 Cont." ),
141 ENTRY( "List 1 Start" ),
143 ENTRY( "List 1 End" ),
144 ENTRY( "List 1 Cont." ),
145 ENTRY( "List 2 Start" ),
147 ENTRY( "List 2 End" ),
148 ENTRY( "List 2 Cont." ),
149 ENTRY( "List 3 Start" ),
151 ENTRY( "List 3 End" ),
152 ENTRY( "List 3 Cont." ),
153 ENTRY( "List 4 Start" ),
155 ENTRY( "List 4 End" ),
156 ENTRY( "List 4 Cont." ),
157 ENTRY( "List 5 Start" ),
159 ENTRY( "List 5 End" ),
160 ENTRY( "List 5 Cont." ), // STR_POCO_PRGM_BUL_NONUM5
164 const struct SwTableEntry ExtraProgNameTable
[] =
166 ENTRY( "Header" ), // RES_POOLCOLL_EXTRA_BEGIN
167 ENTRY( "Header left" ),
168 ENTRY( "Header right" ),
170 ENTRY( "Footer left" ),
171 ENTRY( "Footer right" ),
172 ENTRY( "Table Contents" ),
173 ENTRY( "Table Heading" ),
175 ENTRY( "Illustration" ),
178 ENTRY( "Frame contents" ),
180 ENTRY( "Addressee" ),
183 ENTRY( "Drawing" ), // RES_POOLCOLL_LABEL_DRAWING
187 const struct SwTableEntry RegisterProgNameTable
[] =
189 ENTRY( "Index" ), // STR_POCO_PRGM_REGISTER_BASE
190 ENTRY( "Index Heading" ), // STR_POCO_PRGM_TOX_IDXH
194 ENTRY( "Index Separator" ),
195 ENTRY( "Contents Heading" ),
196 ENTRY( "Contents 1" ),
197 ENTRY( "Contents 2" ),
198 ENTRY( "Contents 3" ),
199 ENTRY( "Contents 4" ),
200 ENTRY( "Contents 5" ),
201 ENTRY( "User Index Heading" ),
202 ENTRY( "User Index 1" ),
203 ENTRY( "User Index 2" ),
204 ENTRY( "User Index 3" ),
205 ENTRY( "User Index 4" ),
206 ENTRY( "User Index 5" ),
207 ENTRY( "Contents 6" ),
208 ENTRY( "Contents 7" ),
209 ENTRY( "Contents 8" ),
210 ENTRY( "Contents 9" ),
211 ENTRY( "Contents 10" ),
212 ENTRY( "Illustration Index Heading" ),
213 ENTRY( "Illustration Index 1" ),
214 ENTRY( "Object index heading" ),
215 ENTRY( "Object index 1" ),
216 ENTRY( "Table index heading" ),
217 ENTRY( "Table index 1" ),
218 ENTRY( "Bibliography Heading" ),
219 ENTRY( "Bibliography 1" ),
220 ENTRY( "User Index 6" ),
221 ENTRY( "User Index 7" ),
222 ENTRY( "User Index 8" ),
223 ENTRY( "User Index 9" ),
224 ENTRY( "User Index 10" ), // STR_POCO_PRGM_TOX_USER10
228 const struct SwTableEntry DocProgNameTable
[] =
230 ENTRY( "Title" ), // STR_POCO_PRGM_DOC_TITEL
235 const struct SwTableEntry HTMLProgNameTable
[] =
237 ENTRY( "Quotations" ),
238 ENTRY( "Preformatted Text" ),
239 ENTRY( "Horizontal Line" ),
240 ENTRY( "List Contents" ),
241 ENTRY( "List Heading" ), // STR_POCO_PRGM_HTML_DT
245 const struct SwTableEntry FrmFmtProgNameTable
[] =
247 ENTRY( "Frame" ), // RES_POOLFRM_FRAME
251 ENTRY( "Marginalia" ),
252 ENTRY( "Watermark" ),
253 ENTRY( "Labels" ), // RES_POOLFRM_LABEL
257 const struct SwTableEntry ChrFmtProgNameTable
[] =
259 ENTRY( "Footnote Symbol" ), // RES_POOLCHR_FOOTNOTE
260 ENTRY( "Page Number" ),
261 ENTRY( "Caption characters" ),
262 ENTRY( "Drop Caps" ),
263 ENTRY( "Numbering Symbols" ),
264 ENTRY( "Bullet Symbols" ),
265 ENTRY( "Internet link" ),
266 ENTRY( "Visited Internet Link" ),
267 ENTRY( "Placeholder" ),
268 ENTRY( "Index Link" ),
269 ENTRY( "Endnote Symbol" ),
270 ENTRY( "Line numbering" ),
271 ENTRY( "Main index entry" ),
272 ENTRY( "Footnote anchor" ),
273 ENTRY( "Endnote anchor" ),
274 ENTRY( "Rubies" ), // RES_POOLCHR_RUBYTEXT
275 ENTRY( "Vertical Numbering Symbols" ), // RES_POOLCHR_VERT_NUMBER
279 const struct SwTableEntry HTMLChrFmtProgNameTable
[] =
281 ENTRY( "Emphasis" ), // RES_POOLCHR_HTML_EMPHASIS
283 ENTRY( "Strong Emphasis" ),
284 ENTRY( "Source Text" ),
286 ENTRY( "User Entry" ),
288 ENTRY( "Definition" ),
289 ENTRY( "Teletype" ), // RES_POOLCHR_HTML_TELETYPE
293 const struct SwTableEntry PageDescProgNameTable
[] =
295 ENTRY( "Standard" ), // STR_POOLPAGE_PRGM_STANDARD
296 ENTRY( "First Page" ),
297 ENTRY( "Left Page" ),
298 ENTRY( "Right Page" ),
303 ENTRY( "Endnote" ), // STR_POOLPAGE_PRGM_ENDNOTE
304 ENTRY( "Landscape" ),
308 const struct SwTableEntry NumRuleProgNameTable
[] =
310 ENTRY( "Numbering 1" ), // STR_POOLNUMRULE_PRGM_NUM1
311 ENTRY( "Numbering 2" ),
312 ENTRY( "Numbering 3" ),
313 ENTRY( "Numbering 4" ),
314 ENTRY( "Numbering 5" ),
319 ENTRY( "List 5" ), // STR_POOLNUMRULE_PRGM_BUL5
324 sal_Bool
SwStyleNameMapper::SuffixIsUser ( const String
& rString
)
326 const sal_Unicode
*pChar
= rString
.GetBuffer();
327 sal_Int32 nLen
= rString
.Len();
328 sal_Bool bRet
= sal_False
;
330 pChar
[nLen
-7] == ' ' &&
331 pChar
[nLen
-6] == '(' &&
332 pChar
[nLen
-5] == 'u' &&
333 pChar
[nLen
-4] == 's' &&
334 pChar
[nLen
-3] == 'e' &&
335 pChar
[nLen
-2] == 'r' &&
336 pChar
[nLen
-1] == ')' )
340 void SwStyleNameMapper::CheckSuffixAndDelete ( String
& rString
)
342 const sal_Unicode
*pChar
= rString
.GetBuffer();
343 xub_StrLen nLen
= rString
.Len();
345 pChar
[nLen
-7] == ' ' &&
346 pChar
[nLen
-6] == '(' &&
347 pChar
[nLen
-5] == 'u' &&
348 pChar
[nLen
-4] == 's' &&
349 pChar
[nLen
-3] == 'e' &&
350 pChar
[nLen
-2] == 'r' &&
351 pChar
[nLen
-1] == ')')
353 rString
.Erase ( nLen
- 7, 7 );
356 const NameToIdHash
& SwStyleNameMapper::getHashTable ( SwGetPoolIdFromName eFlags
, sal_Bool bProgName
)
358 NameToIdHash
*pHash
= 0;
359 const SvStringsDtor
*pStrings
;
363 case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
:
368 pHash
= bProgName
? pParaProgMap
: pParaUIMap
;
371 pHash
= new NameToIdHash ( RES_POOLCOLL_TEXT_END
- RES_POOLCOLL_TEXT_BEGIN
+
372 RES_POOLCOLL_LISTS_END
- RES_POOLCOLL_LISTS_BEGIN
+
373 RES_POOLCOLL_EXTRA_END
- RES_POOLCOLL_EXTRA_BEGIN
+
374 RES_POOLCOLL_REGISTER_END
- RES_POOLCOLL_REGISTER_BEGIN
+
375 RES_POOLCOLL_DOC_END
- RES_POOLCOLL_DOC_BEGIN
+
376 RES_POOLCOLL_HTML_END
- RES_POOLCOLL_HTML_BEGIN
);
377 pStrings
= bProgName
? &GetTextProgNameArray() : &GetTextUINameArray();
378 for ( nIndex
= 0, nId
= RES_POOLCOLL_TEXT_BEGIN
; nId
< RES_POOLCOLL_TEXT_END
; nId
++,nIndex
++ )
379 (*pHash
)[(*pStrings
)[nIndex
]] = nId
;
380 pStrings
= bProgName
? &GetListsProgNameArray() : &GetListsUINameArray();
381 for ( nIndex
= 0, nId
= RES_POOLCOLL_LISTS_BEGIN
; nId
< RES_POOLCOLL_LISTS_END
; nId
++,nIndex
++ )
382 (*pHash
)[(*pStrings
)[nIndex
]] = nId
;
383 pStrings
= bProgName
? &GetExtraProgNameArray() : &GetExtraUINameArray();
384 for ( nIndex
= 0, nId
= RES_POOLCOLL_EXTRA_BEGIN
; nId
< RES_POOLCOLL_EXTRA_END
; nId
++,nIndex
++ )
385 (*pHash
)[(*pStrings
)[nIndex
]] = nId
;
386 pStrings
= bProgName
? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
387 for ( nIndex
= 0, nId
= RES_POOLCOLL_REGISTER_BEGIN
; nId
< RES_POOLCOLL_REGISTER_END
; nId
++,nIndex
++ )
388 (*pHash
)[(*pStrings
)[nIndex
]] = nId
;
389 pStrings
= bProgName
? &GetDocProgNameArray() : &GetDocUINameArray();
390 for ( nIndex
= 0, nId
= RES_POOLCOLL_DOC_BEGIN
; nId
< RES_POOLCOLL_DOC_END
; nId
++,nIndex
++ )
391 (*pHash
)[(*pStrings
)[nIndex
]] = nId
;
392 pStrings
= bProgName
? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
393 for ( nIndex
= 0, nId
= RES_POOLCOLL_HTML_BEGIN
; nId
< RES_POOLCOLL_HTML_END
; nId
++,nIndex
++ )
394 (*pHash
)[(*pStrings
)[nIndex
]] = nId
;
397 pParaProgMap
= pHash
;
403 case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
:
405 pHash
= bProgName
? pCharProgMap
: pCharUIMap
;
411 pHash
= new NameToIdHash ( RES_POOLCHR_NORMAL_END
- RES_POOLCHR_NORMAL_BEGIN
+
412 RES_POOLCHR_HTML_END
- RES_POOLCHR_HTML_BEGIN
);
413 pStrings
= bProgName
? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
414 for ( nIndex
= 0, nId
= RES_POOLCHR_NORMAL_BEGIN
; nId
< RES_POOLCHR_NORMAL_END
; nId
++,nIndex
++ )
415 (*pHash
)[(*pStrings
)[nIndex
]] = nId
;
416 pStrings
= bProgName
? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
417 for ( nIndex
= 0, nId
= RES_POOLCHR_HTML_BEGIN
; nId
< RES_POOLCHR_HTML_END
; nId
++,nIndex
++ )
418 (*pHash
)[(*pStrings
)[nIndex
]] = nId
;
420 pCharProgMap
= pHash
;
426 case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT
:
428 pHash
= bProgName
? pFrameProgMap
: pFrameUIMap
;
431 pHash
= new NameToIdHash ( RES_POOLFRM_END
- RES_POOLFRM_BEGIN
);
432 pStrings
= bProgName
? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
433 for ( sal_uInt16 nIndex
=0,nId
= RES_POOLFRM_BEGIN
; nId
< RES_POOLFRM_END
; nId
++,nIndex
++ )
434 (*pHash
)[(*pStrings
)[nIndex
]] = nId
;
436 pFrameProgMap
= pHash
;
442 case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC
:
444 pHash
= bProgName
? pPageProgMap
: pPageUIMap
;
447 pHash
= new NameToIdHash ( RES_POOLPAGE_END
- RES_POOLPAGE_BEGIN
);
448 pStrings
= bProgName
? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
449 for ( sal_uInt16 nIndex
=0,nId
= RES_POOLPAGE_BEGIN
; nId
< RES_POOLPAGE_END
; nId
++,nIndex
++ )
450 (*pHash
)[(*pStrings
)[nIndex
]] = nId
;
452 pPageProgMap
= pHash
;
458 case nsSwGetPoolIdFromName::GET_POOLID_NUMRULE
:
460 pHash
= bProgName
? pNumRuleProgMap
: pNumRuleUIMap
;
463 pHash
= new NameToIdHash ( RES_POOLNUMRULE_END
- RES_POOLNUMRULE_BEGIN
);
464 pStrings
= bProgName
? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
465 for ( sal_uInt16 nIndex
=0,nId
= RES_POOLNUMRULE_BEGIN
; nId
< RES_POOLNUMRULE_END
; nId
++,nIndex
++ )
466 (*pHash
)[(*pStrings
)[nIndex
]] = nId
;
468 pNumRuleProgMap
= pHash
;
470 pNumRuleUIMap
= pHash
;
475 #ifdef _NEED_TO_DEBUG_MAPPING
476 static sal_Bool bTested
= sal_False
;
481 for ( sal_uInt16 nIndex
= 0, nId
= RES_POOLCOLL_TEXT_BEGIN
; nId
< RES_POOLCOLL_TEXT_END
; nId
++,nIndex
++ )
483 String aString
, bString
;
484 FillUIName ( nId
, aString
);
485 bString
= GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, aString
);
486 sal_uInt16 nNewId
= GetPoolIdFromProgName ( bString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
487 FillProgName ( nNewId
, aString
);
488 bString
= GetUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
489 nNewId
= GetPoolIdFromUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
491 *((sal_Int32
*)0) = 42;
493 for ( nIndex
= 0, nId
= RES_POOLCOLL_LISTS_BEGIN
; nId
< RES_POOLCOLL_LISTS_END
; nId
++,nIndex
++ )
495 String aString
, bString
;
496 FillUIName ( nId
, aString
);
497 bString
= GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, aString
);
498 sal_uInt16 nNewId
= GetPoolIdFromProgName ( bString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
499 FillProgName ( nNewId
, aString
);
500 bString
= GetUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
501 nNewId
= GetPoolIdFromUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
503 *((sal_Int32
*)0) = 42;
505 for ( nIndex
= 0, nId
= RES_POOLCOLL_EXTRA_BEGIN
; nId
< RES_POOLCOLL_EXTRA_END
; nId
++,nIndex
++ )
507 String aString
, bString
;
508 FillUIName ( nId
, aString
);
509 bString
= GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, aString
);
510 sal_uInt16 nNewId
= GetPoolIdFromProgName ( bString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
511 FillProgName ( nNewId
, aString
);
512 bString
= GetUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
513 nNewId
= GetPoolIdFromUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
515 *((sal_Int32
*)0) = 42;
517 for ( nIndex
= 0, nId
= RES_POOLCOLL_REGISTER_BEGIN
; nId
< RES_POOLCOLL_REGISTER_END
; nId
++,nIndex
++ )
519 String aString
, bString
;
520 FillUIName ( nId
, aString
);
521 bString
= GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, aString
);
522 sal_uInt16 nNewId
= GetPoolIdFromProgName ( bString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
523 FillProgName ( nNewId
, aString
);
524 bString
= GetUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
525 nNewId
= GetPoolIdFromUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
527 *((sal_Int32
*)0) = 42;
529 for ( nIndex
= 0, nId
= RES_POOLCOLL_DOC_BEGIN
; nId
< RES_POOLCOLL_DOC_END
; nId
++,nIndex
++ )
531 String aString
, bString
;
532 FillUIName ( nId
, aString
);
533 bString
= GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, aString
);
534 sal_uInt16 nNewId
= GetPoolIdFromProgName ( bString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
535 FillProgName ( nNewId
, aString
);
536 bString
= GetUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
537 nNewId
= GetPoolIdFromUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
539 *((sal_Int32
*)0) = 42;
541 for ( nIndex
= 0, nId
= RES_POOLCOLL_HTML_BEGIN
; nId
< RES_POOLCOLL_HTML_END
; nId
++,nIndex
++ )
543 String aString
, bString
;
544 FillUIName ( nId
, aString
);
545 bString
= GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, aString
);
546 sal_uInt16 nNewId
= GetPoolIdFromProgName ( bString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
547 FillProgName ( nNewId
, aString
);
548 bString
= GetUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
549 nNewId
= GetPoolIdFromUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
551 *((sal_Int32
*)0) = 42;
555 for ( sal_uInt16 nIndex
= 0, nId
= RES_POOLCHR_NORMAL_BEGIN
; nId
< RES_POOLCHR_NORMAL_END
; nId
++,nIndex
++ )
557 String aString
, bString
;
558 FillUIName ( nId
, aString
);
559 bString
= GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, aString
);
560 sal_uInt16 nNewId
= GetPoolIdFromProgName ( bString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
561 FillProgName ( nNewId
, aString
);
562 bString
= GetUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
563 nNewId
= GetPoolIdFromUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
565 *((sal_Int32
*)0) = 42;
567 for ( nIndex
= 0, nId
= RES_POOLCHR_HTML_BEGIN
; nId
< RES_POOLCHR_HTML_END
; nId
++,nIndex
++ )
569 String aString
, bString
;
570 FillUIName ( nId
, aString
);
571 bString
= GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, aString
);
572 sal_uInt16 nNewId
= GetPoolIdFromProgName ( bString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
573 FillProgName ( nNewId
, aString
);
574 bString
= GetUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
575 nNewId
= GetPoolIdFromUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
577 *((sal_Int32
*)0) = 42;
581 for ( sal_uInt16 nIndex
=0,nId
= RES_POOLFRM_BEGIN
; nId
< RES_POOLFRM_END
; nId
++,nIndex
++ )
583 String aString
, bString
;
584 FillUIName ( nId
, aString
);
585 bString
= GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, aString
);
586 sal_uInt16 nNewId
= GetPoolIdFromProgName ( bString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
587 FillProgName ( nNewId
, aString
);
588 bString
= GetUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
589 nNewId
= GetPoolIdFromUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
591 *((sal_Int32
*)0) = 42;
595 for ( sal_uInt16 nIndex
=0,nId
= RES_POOLPAGE_BEGIN
; nId
< RES_POOLPAGE_END
; nId
++,nIndex
++ )
597 String aString
, bString
;
598 FillUIName ( nId
, aString
);
599 bString
= GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, aString
);
600 sal_uInt16 nNewId
= GetPoolIdFromProgName ( bString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
601 FillProgName ( nNewId
, aString
);
602 bString
= GetUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
603 nNewId
= GetPoolIdFromUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
605 *((sal_Int32
*)0) = 42;
609 for ( sal_uInt16 nIndex
=0,nId
= RES_POOLNUMRULE_BEGIN
; nId
< RES_POOLNUMRULE_END
; nId
++,nIndex
++ )
611 String aString
, bString
;
612 FillUIName ( nId
, aString
);
613 bString
= GetProgName ( nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, aString
);
614 sal_uInt16 nNewId
= GetPoolIdFromProgName ( bString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
615 FillProgName ( nNewId
, aString
);
616 bString
= GetUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
617 nNewId
= GetPoolIdFromUIName ( aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
619 *((sal_Int32
*)0) = 42;
626 // This gets the UI Name from the programmatic name
627 const String
& SwStyleNameMapper::GetUIName ( const String
& rName
, SwGetPoolIdFromName eFlags
)
629 sal_uInt16 nId
= GetPoolIdFromProgName ( rName
, eFlags
);
630 return nId
!= USHRT_MAX
? GetUIName( nId
, rName
) : rName
;
634 // Get the programmatic Name from the UI name
635 const String
& SwStyleNameMapper::GetProgName( const String
& rName
, SwGetPoolIdFromName eFlags
)
637 sal_uInt16 nId
= GetPoolIdFromUIName ( rName
, eFlags
);
638 return nId
!= USHRT_MAX
? GetProgName( nId
, rName
) : rName
;
641 // Get the programmatic name from the UI name in rName and put it into rFillName
642 void SwStyleNameMapper::FillProgName ( const String
& rName
, String
& rFillName
, SwGetPoolIdFromName eFlags
, sal_Bool bDisambiguate
)
644 sal_uInt16 nId
= GetPoolIdFromUIName ( rName
, eFlags
);
645 if ( bDisambiguate
&& nId
== USHRT_MAX
)
647 // rName isn't in our UI name table...check if it's in the programmatic one
648 nId
= GetPoolIdFromProgName ( rName
, eFlags
);
651 if (nId
== USHRT_MAX
)
653 // It isn't ...make sure the suffix isn't already " (user)"...if it is,
654 // we need to add another one
655 if ( SuffixIsUser ( rFillName
) )
656 rFillName
.AppendAscii ( RTL_CONSTASCII_STRINGPARAM ( " (user)" ) );
660 // It's in the programmatic name table...append suffix
661 rFillName
.AppendAscii ( RTL_CONSTASCII_STRINGPARAM ( " (user)" ) );
666 // If we aren't trying to disambiguate, then just do a normal fill
667 fillNameFromId ( nId
, rFillName
, sal_True
);
670 // Get the UI name from the programmatic name in rName and put it into rFillName
671 void SwStyleNameMapper::FillUIName ( const String
& rName
, String
& rFillName
, SwGetPoolIdFromName eFlags
, sal_Bool bDisambiguate
)
673 sal_uInt16 nId
= GetPoolIdFromProgName ( rName
, eFlags
);
674 if ( bDisambiguate
&& nId
== USHRT_MAX
)
677 // rName isn't in our Prog name table...check if it has a " (user)" suffix, if so remove it
678 CheckSuffixAndDelete ( rFillName
);
682 // If we aren't trying to disambiguate, then just do a normal fill
683 fillNameFromId ( nId
, rFillName
, sal_False
);
687 const String
& SwStyleNameMapper::getNameFromId( sal_uInt16 nId
, const String
& rFillName
, sal_Bool bProgName
)
690 const SvStringsDtor
* pStrArr
= 0;
692 switch( (USER_FMT
| COLL_GET_RANGE_BITS
| POOLGRP_NOCOLLID
) & nId
)
695 if( RES_POOLCOLL_TEXT_BEGIN
<= nId
&& nId
< RES_POOLCOLL_TEXT_END
)
697 pStrArr
= bProgName
? &GetTextProgNameArray() : &GetTextUINameArray();
698 nStt
= RES_POOLCOLL_TEXT_BEGIN
;
701 case COLL_LISTS_BITS
:
702 if( RES_POOLCOLL_LISTS_BEGIN
<= nId
&& nId
< RES_POOLCOLL_LISTS_END
)
704 pStrArr
= bProgName
? &GetListsProgNameArray() : &GetListsUINameArray();
705 nStt
= RES_POOLCOLL_LISTS_BEGIN
;
708 case COLL_EXTRA_BITS
:
709 if( RES_POOLCOLL_EXTRA_BEGIN
<= nId
&& nId
< RES_POOLCOLL_EXTRA_END
)
711 pStrArr
= bProgName
? &GetExtraProgNameArray() : &GetExtraUINameArray();
712 nStt
= RES_POOLCOLL_EXTRA_BEGIN
;
715 case COLL_REGISTER_BITS
:
716 if( RES_POOLCOLL_REGISTER_BEGIN
<= nId
&& nId
< RES_POOLCOLL_REGISTER_END
)
718 pStrArr
= bProgName
? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
719 nStt
= RES_POOLCOLL_REGISTER_BEGIN
;
723 if( RES_POOLCOLL_DOC_BEGIN
<= nId
&& nId
< RES_POOLCOLL_DOC_END
)
725 pStrArr
= bProgName
? &GetDocProgNameArray() : &GetDocUINameArray();
726 nStt
= RES_POOLCOLL_DOC_BEGIN
;
730 if( RES_POOLCOLL_HTML_BEGIN
<= nId
&& nId
< RES_POOLCOLL_HTML_END
)
732 pStrArr
= bProgName
? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
733 nStt
= RES_POOLCOLL_HTML_BEGIN
;
736 case POOLGRP_CHARFMT
:
737 if( RES_POOLCHR_NORMAL_BEGIN
<= nId
&& nId
< RES_POOLCHR_NORMAL_END
)
739 pStrArr
= bProgName
? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
740 nStt
= RES_POOLCHR_NORMAL_BEGIN
;
742 else if( RES_POOLCHR_HTML_BEGIN
<= nId
&& nId
< RES_POOLCHR_HTML_END
)
744 pStrArr
= bProgName
? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
745 nStt
= RES_POOLCHR_HTML_BEGIN
;
748 case POOLGRP_FRAMEFMT
:
749 if( RES_POOLFRM_BEGIN
<= nId
&& nId
< RES_POOLFRM_END
)
751 pStrArr
= bProgName
? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
752 nStt
= RES_POOLFRM_BEGIN
;
755 case POOLGRP_PAGEDESC
:
756 if( RES_POOLPAGE_BEGIN
<= nId
&& nId
< RES_POOLPAGE_END
)
758 pStrArr
= bProgName
? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
759 nStt
= RES_POOLPAGE_BEGIN
;
762 case POOLGRP_NUMRULE
:
763 if( RES_POOLNUMRULE_BEGIN
<= nId
&& nId
< RES_POOLNUMRULE_END
)
765 pStrArr
= bProgName
? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
766 nStt
= RES_POOLNUMRULE_BEGIN
;
770 return pStrArr
? *(pStrArr
->operator[] ( nId
- nStt
) ) : rFillName
;
772 void SwStyleNameMapper::fillNameFromId( sal_uInt16 nId
, String
& rFillName
, sal_Bool bProgName
)
775 const SvStringsDtor
* pStrArr
= 0;
777 switch( (USER_FMT
| COLL_GET_RANGE_BITS
| POOLGRP_NOCOLLID
) & nId
)
780 if( RES_POOLCOLL_TEXT_BEGIN
<= nId
&& nId
< RES_POOLCOLL_TEXT_END
)
782 pStrArr
= bProgName
? &GetTextProgNameArray() : &GetTextUINameArray();
783 nStt
= RES_POOLCOLL_TEXT_BEGIN
;
786 case COLL_LISTS_BITS
:
787 if( RES_POOLCOLL_LISTS_BEGIN
<= nId
&& nId
< RES_POOLCOLL_LISTS_END
)
789 pStrArr
= bProgName
? &GetListsProgNameArray() : &GetListsUINameArray();
790 nStt
= RES_POOLCOLL_LISTS_BEGIN
;
793 case COLL_EXTRA_BITS
:
794 if( RES_POOLCOLL_EXTRA_BEGIN
<= nId
&& nId
< RES_POOLCOLL_EXTRA_END
)
796 pStrArr
= bProgName
? &GetExtraProgNameArray() : &GetExtraUINameArray();
797 nStt
= RES_POOLCOLL_EXTRA_BEGIN
;
800 case COLL_REGISTER_BITS
:
801 if( RES_POOLCOLL_REGISTER_BEGIN
<= nId
&& nId
< RES_POOLCOLL_REGISTER_END
)
803 pStrArr
= bProgName
? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
804 nStt
= RES_POOLCOLL_REGISTER_BEGIN
;
808 if( RES_POOLCOLL_DOC_BEGIN
<= nId
&& nId
< RES_POOLCOLL_DOC_END
)
810 pStrArr
= bProgName
? &GetDocProgNameArray() : &GetDocUINameArray();
811 nStt
= RES_POOLCOLL_DOC_BEGIN
;
815 if( RES_POOLCOLL_HTML_BEGIN
<= nId
&& nId
< RES_POOLCOLL_HTML_END
)
817 pStrArr
= bProgName
? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
818 nStt
= RES_POOLCOLL_HTML_BEGIN
;
821 case POOLGRP_CHARFMT
:
822 if( RES_POOLCHR_NORMAL_BEGIN
<= nId
&& nId
< RES_POOLCHR_NORMAL_END
)
824 pStrArr
= bProgName
? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
825 nStt
= RES_POOLCHR_NORMAL_BEGIN
;
827 else if( RES_POOLCHR_HTML_BEGIN
<= nId
&& nId
< RES_POOLCHR_HTML_END
)
829 pStrArr
= bProgName
? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
830 nStt
= RES_POOLCHR_HTML_BEGIN
;
833 case POOLGRP_FRAMEFMT
:
834 if( RES_POOLFRM_BEGIN
<= nId
&& nId
< RES_POOLFRM_END
)
836 pStrArr
= bProgName
? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
837 nStt
= RES_POOLFRM_BEGIN
;
840 case POOLGRP_PAGEDESC
:
841 if( RES_POOLPAGE_BEGIN
<= nId
&& nId
< RES_POOLPAGE_END
)
843 pStrArr
= bProgName
? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
844 nStt
= RES_POOLPAGE_BEGIN
;
847 case POOLGRP_NUMRULE
:
848 if( RES_POOLNUMRULE_BEGIN
<= nId
&& nId
< RES_POOLNUMRULE_END
)
850 pStrArr
= bProgName
? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
851 nStt
= RES_POOLNUMRULE_BEGIN
;
856 rFillName
= *(pStrArr
->operator[] ( nId
- nStt
) );
858 // Get the UI Name from the pool ID
859 void SwStyleNameMapper::FillUIName ( sal_uInt16 nId
, String
& rFillName
)
861 fillNameFromId ( nId
, rFillName
, sal_False
);
863 // Get the UI Name from the pool ID
864 const String
& SwStyleNameMapper::GetUIName ( sal_uInt16 nId
, const String
& rName
)
866 return getNameFromId ( nId
, rName
, sal_False
);
869 // Get the programmatic Name from the pool ID
870 void SwStyleNameMapper::FillProgName ( sal_uInt16 nId
, String
& rFillName
)
872 fillNameFromId ( nId
, rFillName
, sal_True
);
874 // Get the programmatic Name from the pool ID
875 const String
& SwStyleNameMapper::GetProgName ( sal_uInt16 nId
, const String
& rName
)
877 return getNameFromId ( nId
, rName
, sal_True
);
879 // This gets the PoolId from the UI Name
880 sal_uInt16
SwStyleNameMapper::GetPoolIdFromUIName( const String
& rName
, SwGetPoolIdFromName eFlags
)
882 const NameToIdHash
& rHashMap
= getHashTable ( eFlags
, sal_False
);
883 NameToIdHash::const_iterator aIter
= rHashMap
.find ( &rName
);
884 return aIter
!= rHashMap
.end() ? (*aIter
).second
: USHRT_MAX
;
886 // Get the Pool ID from the programmatic name
887 sal_uInt16
SwStyleNameMapper::GetPoolIdFromProgName( const String
& rName
, SwGetPoolIdFromName eFlags
)
889 const NameToIdHash
& rHashMap
= getHashTable ( eFlags
, sal_True
);
890 NameToIdHash::const_iterator aIter
= rHashMap
.find ( &rName
);
891 return aIter
!= rHashMap
.end() ? (*aIter
).second
: USHRT_MAX
;
894 SvStringsDtor
* SwStyleNameMapper::NewUINameArray( SvStringsDtor
*& pNameArray
, sal_uInt16 nStt
, sal_uInt16 nEnd
)
898 pNameArray
= new SvStringsDtor( static_cast < sal_Int8
> (nEnd
- nStt
), 1 );
901 const ResId
rRId( nStt
, *pSwResMgr
);
902 String
* pStr
= new String( rRId
);
903 pNameArray
->Insert( pStr
, pNameArray
->Count() );
910 const SvStringsDtor
& SwStyleNameMapper::GetTextUINameArray()
912 return pTextUINameArray
? *pTextUINameArray
:
913 *NewUINameArray( pTextUINameArray
, RC_POOLCOLL_TEXT_BEGIN
,
914 ( RC_POOLCOLL_TEXT_BEGIN
+
915 (RES_POOLCOLL_TEXT_END
- RES_POOLCOLL_TEXT_BEGIN
)) );
918 const SvStringsDtor
& SwStyleNameMapper::GetListsUINameArray()
920 return pListsUINameArray
? *pListsUINameArray
:
921 *NewUINameArray( pListsUINameArray
, RC_POOLCOLL_LISTS_BEGIN
,
922 ( RC_POOLCOLL_LISTS_BEGIN
+
923 (RES_POOLCOLL_LISTS_END
- RES_POOLCOLL_LISTS_BEGIN
)) );
926 const SvStringsDtor
& SwStyleNameMapper::GetExtraUINameArray()
928 return pExtraUINameArray
? *pExtraUINameArray
:
929 *NewUINameArray( pExtraUINameArray
, RC_POOLCOLL_EXTRA_BEGIN
,
930 ( RC_POOLCOLL_EXTRA_BEGIN
+
931 (RES_POOLCOLL_EXTRA_END
- RES_POOLCOLL_EXTRA_BEGIN
)) );
934 const SvStringsDtor
& SwStyleNameMapper::GetRegisterUINameArray()
936 return pRegisterUINameArray
? *pRegisterUINameArray
:
937 *NewUINameArray( pRegisterUINameArray
, RC_POOLCOLL_REGISTER_BEGIN
,
938 ( RC_POOLCOLL_REGISTER_BEGIN
+
939 (RES_POOLCOLL_REGISTER_END
- RES_POOLCOLL_REGISTER_BEGIN
)) );
942 const SvStringsDtor
& SwStyleNameMapper::GetDocUINameArray()
944 return pDocUINameArray
? *pDocUINameArray
:
945 *NewUINameArray( pDocUINameArray
, RC_POOLCOLL_DOC_BEGIN
,
946 ( RC_POOLCOLL_DOC_BEGIN
+
947 (RES_POOLCOLL_DOC_END
- RES_POOLCOLL_DOC_BEGIN
)) );
950 const SvStringsDtor
& SwStyleNameMapper::GetHTMLUINameArray()
952 return pHTMLUINameArray
? *pHTMLUINameArray
:
953 *NewUINameArray( pHTMLUINameArray
, RC_POOLCOLL_HTML_BEGIN
,
954 ( RC_POOLCOLL_HTML_BEGIN
+
955 (RES_POOLCOLL_HTML_END
- RES_POOLCOLL_HTML_BEGIN
)) );
958 const SvStringsDtor
& SwStyleNameMapper::GetFrmFmtUINameArray()
960 return pFrmFmtUINameArray
? *pFrmFmtUINameArray
:
961 *NewUINameArray( pFrmFmtUINameArray
, RC_POOLFRMFMT_BEGIN
,
962 ( RC_POOLFRMFMT_BEGIN
+
963 (RES_POOLFRM_END
- RES_POOLFRM_BEGIN
)) );
966 const SvStringsDtor
& SwStyleNameMapper::GetChrFmtUINameArray()
968 return pChrFmtUINameArray
? *pChrFmtUINameArray
:
969 *NewUINameArray( pChrFmtUINameArray
, RC_POOLCHRFMT_BEGIN
,
970 ( RC_POOLCHRFMT_BEGIN
+
971 (RES_POOLCHR_NORMAL_END
- RES_POOLCHR_NORMAL_BEGIN
)) );
974 const SvStringsDtor
& SwStyleNameMapper::GetHTMLChrFmtUINameArray()
976 return pHTMLChrFmtUINameArray
? *pHTMLChrFmtUINameArray
:
977 *NewUINameArray( pHTMLChrFmtUINameArray
, RC_POOLCHRFMT_HTML_BEGIN
,
978 ( RC_POOLCHRFMT_HTML_BEGIN
+
979 (RES_POOLCHR_HTML_END
- RES_POOLCHR_HTML_BEGIN
)) );
982 const SvStringsDtor
& SwStyleNameMapper::GetPageDescUINameArray()
984 return pPageDescUINameArray
? *pPageDescUINameArray
:
985 *NewUINameArray( pPageDescUINameArray
, RC_POOLPAGEDESC_BEGIN
,
986 ( RC_POOLPAGEDESC_BEGIN
+
987 (RES_POOLPAGE_END
- RES_POOLPAGE_BEGIN
)) );
990 const SvStringsDtor
& SwStyleNameMapper::GetNumRuleUINameArray()
992 return pNumRuleUINameArray
? *pNumRuleUINameArray
:
993 *NewUINameArray( pNumRuleUINameArray
, RC_POOLNUMRULE_BEGIN
,
994 ( RC_POOLNUMRULE_BEGIN
+
995 (RES_POOLNUMRULE_END
- RES_POOLNUMRULE_BEGIN
)) );
998 SvStringsDtor
* SwStyleNameMapper::NewProgNameArray( SvStringsDtor
*& pProgNameArray
, const SwTableEntry
*pTable
, sal_uInt8 nCount
)
1000 if( !pProgNameArray
)
1002 pProgNameArray
= new SvStringsDtor( nCount
, 1 );
1003 while (pTable
->nLength
)
1005 String
* pStr
= new String( pTable
->pChar
, pTable
->nLength
, RTL_TEXTENCODING_ASCII_US
);
1006 pProgNameArray
->Insert( pStr
, pProgNameArray
->Count() );
1010 return pProgNameArray
;
1013 const SvStringsDtor
& SwStyleNameMapper::GetTextProgNameArray()
1015 return pTextProgNameArray
? *pTextProgNameArray
:
1016 *NewProgNameArray( pTextProgNameArray
, TextProgNameTable
,
1017 sizeof ( TextProgNameTable
) / sizeof ( SwTableEntry
) );
1020 const SvStringsDtor
& SwStyleNameMapper::GetListsProgNameArray()
1022 return pListsProgNameArray
? *pListsProgNameArray
:
1023 *NewProgNameArray( pListsProgNameArray
, ListsProgNameTable
,
1024 sizeof ( ListsProgNameTable
) / sizeof ( SwTableEntry
) );
1027 const SvStringsDtor
& SwStyleNameMapper::GetExtraProgNameArray()
1029 return pExtraProgNameArray
? *pExtraProgNameArray
:
1030 *NewProgNameArray( pExtraProgNameArray
, ExtraProgNameTable
,
1031 sizeof ( ExtraProgNameTable
) / sizeof ( SwTableEntry
) );
1034 const SvStringsDtor
& SwStyleNameMapper::GetRegisterProgNameArray()
1036 return pRegisterProgNameArray
? *pRegisterProgNameArray
:
1037 *NewProgNameArray( pRegisterProgNameArray
, RegisterProgNameTable
,
1038 sizeof ( RegisterProgNameTable
) / sizeof ( SwTableEntry
) );
1041 const SvStringsDtor
& SwStyleNameMapper::GetDocProgNameArray()
1043 return pDocProgNameArray
? *pDocProgNameArray
:
1044 *NewProgNameArray( pDocProgNameArray
, DocProgNameTable
,
1045 sizeof ( DocProgNameTable
) / sizeof ( SwTableEntry
) );
1048 const SvStringsDtor
& SwStyleNameMapper::GetHTMLProgNameArray()
1050 return pHTMLProgNameArray
? *pHTMLProgNameArray
:
1051 *NewProgNameArray( pHTMLProgNameArray
, HTMLProgNameTable
,
1052 sizeof ( HTMLProgNameTable
) / sizeof ( SwTableEntry
) );
1055 const SvStringsDtor
& SwStyleNameMapper::GetFrmFmtProgNameArray()
1057 return pFrmFmtProgNameArray
? *pFrmFmtProgNameArray
:
1058 *NewProgNameArray( pFrmFmtProgNameArray
, FrmFmtProgNameTable
,
1059 sizeof ( FrmFmtProgNameTable
) / sizeof ( SwTableEntry
) );
1062 const SvStringsDtor
& SwStyleNameMapper::GetChrFmtProgNameArray()
1064 return pChrFmtProgNameArray
? *pChrFmtProgNameArray
:
1065 *NewProgNameArray( pChrFmtProgNameArray
, ChrFmtProgNameTable
,
1066 sizeof ( ChrFmtProgNameTable
) / sizeof ( SwTableEntry
) );
1069 const SvStringsDtor
& SwStyleNameMapper::GetHTMLChrFmtProgNameArray()
1071 return pHTMLChrFmtProgNameArray
? *pHTMLChrFmtProgNameArray
:
1072 *NewProgNameArray( pHTMLChrFmtProgNameArray
, HTMLChrFmtProgNameTable
,
1073 sizeof ( HTMLChrFmtProgNameTable
) / sizeof ( SwTableEntry
) );
1076 const SvStringsDtor
& SwStyleNameMapper::GetPageDescProgNameArray()
1078 return pPageDescProgNameArray
? *pPageDescProgNameArray
:
1079 *NewProgNameArray( pPageDescProgNameArray
, PageDescProgNameTable
,
1080 sizeof ( PageDescProgNameTable
) / sizeof ( SwTableEntry
) );
1083 const SvStringsDtor
& SwStyleNameMapper::GetNumRuleProgNameArray()
1085 return pNumRuleProgNameArray
? *pNumRuleProgNameArray
:
1086 *NewProgNameArray( pNumRuleProgNameArray
, NumRuleProgNameTable
,
1087 sizeof ( NumRuleProgNameTable
) / sizeof ( SwTableEntry
) );
1091 const String
SwStyleNameMapper::GetSpecialExtraProgName( const String
& rExtraUIName
)
1093 String aRes
= rExtraUIName
;
1094 BOOL bChgName
= FALSE
;
1095 const SvStringsDtor
& rExtraArr
= GetExtraUINameArray();
1096 static sal_uInt16 nIds
[] =
1098 RES_POOLCOLL_LABEL_DRAWING
- RES_POOLCOLL_EXTRA_BEGIN
,
1099 RES_POOLCOLL_LABEL_ABB
- RES_POOLCOLL_EXTRA_BEGIN
,
1100 RES_POOLCOLL_LABEL_TABLE
- RES_POOLCOLL_EXTRA_BEGIN
,
1101 RES_POOLCOLL_LABEL_FRAME
- RES_POOLCOLL_EXTRA_BEGIN
,
1104 const sal_uInt16
* pIds
;
1105 for ( pIds
= nIds
; *pIds
; ++pIds
)
1107 if (aRes
== *rExtraArr
[ *pIds
])
1114 aRes
= *GetExtraProgNameArray()[*pIds
];
1118 const String
SwStyleNameMapper::GetSpecialExtraUIName( const String
& rExtraProgName
)
1120 String aRes
= rExtraProgName
;
1121 BOOL bChgName
= FALSE
;
1122 const SvStringsDtor
& rExtraArr
= GetExtraProgNameArray();
1123 static sal_uInt16 nIds
[] =
1125 RES_POOLCOLL_LABEL_DRAWING
- RES_POOLCOLL_EXTRA_BEGIN
,
1126 RES_POOLCOLL_LABEL_ABB
- RES_POOLCOLL_EXTRA_BEGIN
,
1127 RES_POOLCOLL_LABEL_TABLE
- RES_POOLCOLL_EXTRA_BEGIN
,
1128 RES_POOLCOLL_LABEL_FRAME
- RES_POOLCOLL_EXTRA_BEGIN
,
1131 const sal_uInt16
* pIds
;
1133 for ( pIds
= nIds
; *pIds
; ++pIds
)
1135 if (aRes
== *rExtraArr
[ *pIds
])
1142 aRes
= *GetExtraUINameArray()[*pIds
];