Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <hintids.hxx>
22 : #include <i18npool/mslangid.hxx>
23 : #include <unotools/localedatawrapper.hxx>
24 : #include <editeng/paperinf.hxx>
25 : #include <editeng/wghtitem.hxx>
26 : #include <editeng/fontitem.hxx>
27 : #include <editeng/fhgtitem.hxx>
28 : #include <editeng/tstpitem.hxx>
29 : #include <editeng/lrspitem.hxx>
30 : #include <editeng/ulspitem.hxx>
31 : #include <editeng/adjitem.hxx>
32 : #include <editeng/postitem.hxx>
33 : #include <editeng/keepitem.hxx>
34 : #include <editeng/opaqitem.hxx>
35 : #include <editeng/boxitem.hxx>
36 : #include <editeng/cmapitem.hxx>
37 : #include <editeng/udlnitem.hxx>
38 : #include <editeng/colritem.hxx>
39 : #include <editeng/protitem.hxx>
40 : #include <editeng/escpitem.hxx>
41 : #include <editeng/langitem.hxx>
42 : #include <editeng/charrotateitem.hxx>
43 : #include <editeng/frmdiritem.hxx>
44 : #include <editeng/emphitem.hxx>
45 : #include <editeng/scriptspaceitem.hxx>
46 : #include <viewopt.hxx>
47 : #include <doc.hxx>
48 : #include <IDocumentUndoRedo.hxx>
49 : #include <fmtanchr.hxx>
50 : #include <fmtornt.hxx>
51 : #include <fmtsrnd.hxx>
52 : #include <fmtfsize.hxx>
53 : #include <poolfmt.hxx>
54 : #include <paratr.hxx>
55 : #include <pagedesc.hxx>
56 : #include <frmtool.hxx>
57 : #include <charfmt.hxx>
58 : #include <docary.hxx>
59 : #include <fmtcol.hxx>
60 : #include <ndtxt.hxx>
61 : #include <fmtline.hxx>
62 : #include <poolfmt.hrc>
63 : #include <GetMetricVal.hxx>
64 : #include <numrule.hxx>
65 :
66 :
67 : using namespace ::editeng;
68 : using namespace ::com::sun::star;
69 :
70 : const sal_uInt16 PT_3 = 3 * 20; // 3 pt
71 : const sal_uInt16 PT_6 = 6 * 20; // 6 pt
72 : const sal_uInt16 PT_7 = 7 * 20; // 6 pt
73 : const sal_uInt16 PT_8 = 8 * 20; // 8 pt
74 : const sal_uInt16 PT_9 = 9 * 20; // 9 pt
75 : const sal_uInt16 PT_10 = 10 * 20; // 10 pt
76 : const sal_uInt16 PT_11 = 11 * 20; // 11 pt
77 : const sal_uInt16 PT_12 = 12 * 20; // 12 pt
78 : const sal_uInt16 PT_14 = 14 * 20; // 14 pt
79 : const sal_uInt16 PT_16 = 16 * 20; // 16 pt
80 : const sal_uInt16 PT_18 = 18 * 20; // 18 pt
81 : const sal_uInt16 PT_22 = 22 * 20; // 22 pt
82 : const sal_uInt16 PT_24 = 24 * 20; // 22 pt
83 :
84 :
85 : #define HTML_PARSPACE GetMetricVal( CM_05 )
86 :
87 : static const sal_uInt16 aHeadlineSizes[ 2 * MAXLEVEL ] = {
88 : // PT_16, PT_14, PT_14, PT_12, PT_12, // normal
89 : // we do everything procentual now:
90 : 115, 100, 100, 85, 85,
91 : 75, 75, 75, 75, 75, // normal
92 : // PT_22, PT_16, PT_12, PT_11, PT_9 // HTML mode
93 : PT_24, PT_18, PT_14, PT_12, PT_10,
94 : PT_7, PT_7, PT_7, PT_7, PT_7 // HTML mode
95 : };
96 :
97 114 : static long lcl_GetRightMargin( SwDoc& rDoc )
98 : {
99 : // Make sure that the printer settings are taken over to the standard
100 : // page style
101 114 : const SwFrmFmt& rPgDscFmt = rDoc.GetPageDesc( 0 ).GetMaster();
102 114 : const SvxLRSpaceItem& rLR = rPgDscFmt.GetLRSpace();
103 114 : const long nLeft = rLR.GetLeft();
104 114 : const long nRight = rLR.GetRight();
105 114 : const long nWidth = rPgDscFmt.GetFrmSize().GetWidth();
106 114 : return nWidth - nLeft - nRight;
107 : }
108 :
109 2097 : void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem )
110 : {
111 2097 : rSet.Put( rItem );
112 2097 : sal_uInt16 nWhCJK = 0, nWhCTL = 0;
113 2097 : switch( rItem.Which() )
114 : {
115 : case RES_CHRATR_FONTSIZE:
116 1294 : nWhCJK = RES_CHRATR_CJK_FONTSIZE, nWhCTL = RES_CHRATR_CTL_FONTSIZE;
117 1294 : break;
118 : case RES_CHRATR_FONT:
119 7 : nWhCJK = RES_CHRATR_CJK_FONT, nWhCTL = RES_CHRATR_CTL_FONT;
120 7 : break;
121 : case RES_CHRATR_LANGUAGE:
122 0 : nWhCJK = RES_CHRATR_CJK_LANGUAGE, nWhCTL = RES_CHRATR_CTL_LANGUAGE;
123 0 : break;
124 : case RES_CHRATR_POSTURE:
125 602 : nWhCJK = RES_CHRATR_CJK_POSTURE, nWhCTL = RES_CHRATR_CTL_POSTURE;
126 602 : break;
127 : case RES_CHRATR_WEIGHT:
128 194 : nWhCJK = RES_CHRATR_CJK_WEIGHT, nWhCTL = RES_CHRATR_CTL_WEIGHT;
129 194 : break;
130 : }
131 :
132 2097 : if( nWhCJK )
133 2097 : rSet.Put( rItem, nWhCJK );
134 2097 : if( nWhCTL )
135 2097 : rSet.Put( rItem, nWhCTL );
136 2097 : }
137 :
138 14 : static void lcl_SetDfltFont( sal_uInt16 nFntType, SfxItemSet& rSet )
139 : {
140 : static struct {
141 : sal_uInt16 nResLngId;
142 : sal_uInt16 nResFntId;
143 : } aArr[ 3 ] = {
144 : { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT },
145 : { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT },
146 : { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT }
147 : };
148 56 : for( sal_uInt16 n = 0; n < 3; ++n )
149 : {
150 42 : sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem(
151 42 : aArr[n].nResLngId )).GetLanguage();
152 : Font aFnt( OutputDevice::GetDefaultFont( nFntType,
153 42 : nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
154 :
155 42 : rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
156 : aEmptyStr, aFnt.GetPitch(),
157 84 : aFnt.GetCharSet(), aArr[n].nResFntId ));
158 42 : }
159 14 : }
160 :
161 0 : static void lcl_SetDfltFont( sal_uInt16 nLatinFntType, sal_uInt16 nCJKFntType,
162 : sal_uInt16 nCTLFntType, SfxItemSet& rSet )
163 : {
164 : static struct {
165 : sal_uInt16 nResLngId;
166 : sal_uInt16 nResFntId;
167 : sal_uInt16 nFntType;
168 : } aArr[ 3 ] = {
169 : { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT, 0 },
170 : { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT, 0 },
171 : { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT, 0 }
172 : };
173 0 : aArr[0].nFntType = nLatinFntType;
174 0 : aArr[1].nFntType = nCJKFntType;
175 0 : aArr[2].nFntType = nCTLFntType;
176 :
177 0 : for( sal_uInt16 n = 0; n < 3; ++n )
178 : {
179 0 : sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem(
180 0 : aArr[n].nResLngId )).GetLanguage();
181 : Font aFnt( OutputDevice::GetDefaultFont( aArr[n].nFntType,
182 0 : nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
183 :
184 0 : rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
185 : aEmptyStr, aFnt.GetPitch(),
186 0 : aFnt.GetCharSet(), aArr[n].nResFntId ));
187 0 : }
188 0 : }
189 :
190 148 : static void lcl_SetHeadline( SwDoc* pDoc, SwTxtFmtColl* pColl,
191 : SfxItemSet& rSet,
192 : sal_uInt16 nOutLvlBits, sal_uInt8 nLevel, bool bItalic )
193 : {
194 148 : SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
195 148 : SvxFontHeightItem aHItem(240, 100, RES_CHRATR_FONTSIZE);
196 148 : const bool bHTMLMode = pDoc->get(IDocumentSettingAccess::HTML_MODE);
197 148 : if( bHTMLMode )
198 0 : aHItem.SetHeight( aHeadlineSizes[ MAXLEVEL + nLevel ] );
199 : else
200 148 : aHItem.SetHeight( PT_14, aHeadlineSizes[ nLevel ] );
201 148 : SetAllScriptItem( rSet, aHItem );
202 :
203 148 : if( bItalic && !bHTMLMode )
204 36 : SetAllScriptItem( rSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) );
205 :
206 148 : if( bHTMLMode )
207 : {
208 : ::lcl_SetDfltFont( DEFAULTFONT_LATIN_TEXT, DEFAULTFONT_CJK_TEXT,
209 0 : DEFAULTFONT_CTL_TEXT, rSet );
210 : }
211 :
212 148 : if( pColl )
213 : {
214 148 : if( !( nOutLvlBits & ( 1 << nLevel )) )
215 : {
216 148 : pColl->AssignToListLevelOfOutlineStyle(nLevel);//<-end,zhaojianwei
217 148 : if( !bHTMLMode )
218 : {
219 148 : SwNumRule * pOutlineRule = pDoc->GetOutlineNumRule();
220 148 : const SwNumFmt& rNFmt = pOutlineRule->Get( nLevel );
221 :
222 148 : if ( rNFmt.GetPositionAndSpaceMode() ==
223 : SvxNumberFormat::LABEL_WIDTH_AND_POSITION &&
224 0 : ( rNFmt.GetAbsLSpace() || rNFmt.GetFirstLineOffset() ) )
225 : {
226 0 : SvxLRSpaceItem aLR( (SvxLRSpaceItem&)pColl->GetFmtAttr( RES_LR_SPACE ) );
227 0 : aLR.SetTxtFirstLineOfstValue( rNFmt.GetFirstLineOffset() );
228 0 : aLR.SetTxtLeft( rNFmt.GetAbsLSpace() );
229 0 : pColl->SetFmtAttr( aLR );
230 : }
231 :
232 : // #i71764#
233 : // Check on document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE no longer needed.
234 : // All paragraph styles, which are assigned to a level of the
235 : // outline style has to have the outline style set as its list style.
236 : {
237 148 : SwNumRuleItem aItem(pOutlineRule->GetName());
238 :
239 148 : pColl->SetFmtAttr(aItem);
240 : }
241 : }
242 : }
243 : pColl->SetNextTxtFmtColl( *pDoc->GetTxtCollFromPool(
244 148 : RES_POOLCOLL_TEXT ));
245 148 : }
246 148 : }
247 :
248 :
249 :
250 34 : static void lcl_SetRegister( SwDoc* pDoc, SfxItemSet& rSet, sal_uInt16 nFact,
251 : bool bHeader, bool bTab )
252 : {
253 34 : SvxLRSpaceItem aLR( RES_LR_SPACE );
254 34 : sal_uInt16 nLeft = nFact ? GetMetricVal( CM_05 ) * nFact : 0;
255 34 : aLR.SetTxtLeft( nLeft );
256 :
257 34 : rSet.Put( aLR );
258 34 : if( bHeader )
259 : {
260 4 : SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
261 4 : SetAllScriptItem( rSet, SvxFontHeightItem( PT_16, 100, RES_CHRATR_FONTSIZE ) );
262 : }
263 34 : if( bTab )
264 : {
265 30 : long nRightMargin = lcl_GetRightMargin( *pDoc );
266 30 : SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
267 : aTStops.Insert( SvxTabStop( nRightMargin - nLeft,
268 : SVX_TAB_ADJUST_RIGHT,
269 30 : cDfltDecimalChar, '.' ));
270 30 : rSet.Put( aTStops );
271 34 : }
272 34 : }
273 :
274 :
275 :
276 16 : static void lcl_SetNumBul( SwDoc* pDoc, SwTxtFmtColl* pColl,
277 : SfxItemSet& rSet,
278 : sal_uInt16 nNxt, SwTwips nEZ, SwTwips nLeft,
279 : SwTwips nUpper, SwTwips nLower )
280 : {
281 :
282 16 : SvxLRSpaceItem aLR( RES_LR_SPACE ); SvxULSpaceItem aUL( RES_UL_SPACE );
283 16 : aLR.SetTxtFirstLineOfst( sal_uInt16(nEZ) ); aLR.SetTxtLeft( sal_uInt16(nLeft) );
284 16 : aUL.SetUpper( sal_uInt16(nUpper) ); aUL.SetLower( sal_uInt16(nLower) );
285 16 : rSet.Put( aLR );
286 16 : rSet.Put( aUL );
287 :
288 16 : if( pColl )
289 16 : pColl->SetNextTxtFmtColl( *pDoc->GetTxtCollFromPool( nNxt ));
290 16 : }
291 :
292 :
293 :
294 : // Return the AutoCollection by it's Id. If it doesn't
295 : // exist yet, create it.
296 : // If the String pointer is defined, then only query for
297 : // the Attribute descriptions. It doesn't create a style!
298 2635 : SvxFrameDirection GetDefaultFrameDirection(sal_uLong nLanguage)
299 : {
300 2635 : SvxFrameDirection eResult = (MsLangId::isRightToLeft( static_cast<LanguageType>(nLanguage)) ?
301 2635 : FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP);
302 2635 : return eResult;
303 : }
304 :
305 15704 : SwTxtFmtColl* SwDoc::GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage )
306 : {
307 : OSL_ENSURE(
308 : (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) ||
309 : (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) ||
310 : (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) ||
311 : (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END) ||
312 : (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) ||
313 : (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END),
314 : "Wrong AutoFormat Id" );
315 :
316 : SwTxtFmtColl* pNewColl;
317 15704 : sal_uInt16 nOutLvlBits = 0;
318 66706 : for( sal_uInt16 n = 0; n < pTxtFmtCollTbl->size(); ++n )
319 : {
320 62754 : if( nId == ( pNewColl = (*pTxtFmtCollTbl)[ n ] )->GetPoolFmtId() )
321 : {
322 11752 : return pNewColl;
323 : }
324 :
325 51002 : if( pNewColl->IsAssignedToListLevelOfOutlineStyle())
326 1342 : nOutLvlBits |= ( 1 << pNewColl->GetAssignedOutlineStyleLevel() );//<-end,zhaojianwei
327 : }
328 :
329 : // Didn't find it until here -> create anew
330 3952 : sal_uInt16 nResId = 0;
331 3952 : if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
332 1918 : nResId = RC_POOLCOLL_TEXT_BEGIN - RES_POOLCOLL_TEXT_BEGIN;
333 2034 : else if (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END)
334 570 : nResId = RC_POOLCOLL_LISTS_BEGIN - RES_POOLCOLL_LISTS_BEGIN;
335 1464 : else if (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END)
336 812 : nResId = RC_POOLCOLL_EXTRA_BEGIN - RES_POOLCOLL_EXTRA_BEGIN;
337 652 : else if (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END)
338 624 : nResId = RC_POOLCOLL_REGISTER_BEGIN - RES_POOLCOLL_REGISTER_BEGIN;
339 28 : else if (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END)
340 22 : nResId = RC_POOLCOLL_DOC_BEGIN - RES_POOLCOLL_DOC_BEGIN;
341 6 : else if (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END)
342 6 : nResId = RC_POOLCOLL_HTML_BEGIN - RES_POOLCOLL_HTML_BEGIN;
343 :
344 : OSL_ENSURE( nResId, "Invalid Pool ID" );
345 3952 : if( !nResId )
346 0 : return GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
347 :
348 3952 : ResId aResId( nResId + nId, *pSwResMgr );
349 3952 : String aNm( aResId );
350 :
351 : // A Set for all to-be-set Attributes
352 3952 : SwAttrSet aSet( GetAttrPool(), aTxtFmtCollSetRange );
353 3952 : sal_uInt16 nParent = GetPoolParent( nId );
354 :
355 : {
356 :
357 : //FEATURE::CONDCOLL
358 3952 : if(::IsConditionalByPoolId( nId ))
359 : pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), aNm, !nParent
360 : ? pDfltTxtFmtColl
361 554 : : GetTxtCollFromPool( nParent ));
362 : else
363 : //FEATURE::CONDCOLL
364 : pNewColl = new SwTxtFmtColl( GetAttrPool(), aNm, !nParent
365 : ? pDfltTxtFmtColl
366 3398 : : GetTxtCollFromPool( nParent ));
367 3952 : pNewColl->SetPoolFmtId( nId );
368 3952 : pTxtFmtCollTbl->push_back( pNewColl );
369 : }
370 :
371 3952 : bool bNoDefault = get( IDocumentSettingAccess::STYLES_NODEFAULT );
372 3952 : if ( !bNoDefault )
373 : {
374 3778 : switch( nId )
375 : {
376 : // General content forms
377 : case RES_POOLCOLL_STANDARD:
378 : /* koreans do not like SvxScriptItem(TRUE) */
379 574 : if (bRegardLanguage)
380 : {
381 574 : sal_uLong nAppLanguage = GetAppLanguage();
382 574 : if (GetDefaultFrameDirection(nAppLanguage) ==
383 : FRMDIR_HORI_RIGHT_TOP)
384 : {
385 0 : SvxAdjustItem aAdjust(SVX_ADJUST_RIGHT, RES_PARATR_ADJUST );
386 0 : aSet.Put(aAdjust);
387 : }
388 574 : if (nAppLanguage == LANGUAGE_KOREAN)
389 : {
390 0 : SvxScriptSpaceItem aScriptSpace(sal_False, RES_PARATR_SCRIPTSPACE);
391 0 : aSet.Put(aScriptSpace);
392 : }
393 : }
394 574 : break;
395 :
396 : case RES_POOLCOLL_TEXT: // Text body
397 : {
398 554 : SvxULSpaceItem aUL( 0, PT_6, RES_UL_SPACE );
399 554 : if( get(IDocumentSettingAccess::HTML_MODE) ) aUL.SetLower( HTML_PARSPACE );
400 554 : aSet.Put( aUL );
401 : }
402 554 : break;
403 : case RES_POOLCOLL_TEXT_IDENT: // Text body indentation
404 : {
405 4 : SvxLRSpaceItem aLR( RES_LR_SPACE );
406 4 : aLR.SetTxtFirstLineOfst( GetMetricVal( CM_05 ));
407 4 : aSet.Put( aLR );
408 : }
409 4 : break;
410 : case RES_POOLCOLL_TEXT_NEGIDENT: // Text body neg. indentation
411 : {
412 0 : SvxLRSpaceItem aLR( RES_LR_SPACE );
413 0 : aLR.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05 ));
414 0 : aLR.SetTxtLeft( GetMetricVal( CM_1 ));
415 0 : SvxTabStopItem aTStops(RES_PARATR_TABSTOP); aTStops.Insert( SvxTabStop( 0 ));
416 :
417 0 : aSet.Put( aLR );
418 0 : aSet.Put( aTStops );
419 : }
420 0 : break;
421 : case RES_POOLCOLL_TEXT_MOVE: // Text body move
422 : {
423 12 : SvxLRSpaceItem aLR( RES_LR_SPACE );
424 12 : aLR.SetTxtLeft( GetMetricVal( CM_05 ));
425 12 : aSet.Put( aLR );
426 : }
427 12 : break;
428 :
429 : case RES_POOLCOLL_CONFRONTATION: // Text body confrontation
430 : {
431 0 : SvxLRSpaceItem aLR( RES_LR_SPACE );
432 0 : aLR.SetTxtFirstLineOfst( - short( GetMetricVal( CM_1 ) * 4 +
433 0 : GetMetricVal( CM_05)) );
434 0 : aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 5 );
435 0 : SvxTabStopItem aTStops( RES_PARATR_TABSTOP ); aTStops.Insert( SvxTabStop( 0 ));
436 :
437 0 : aSet.Put( aLR );
438 0 : aSet.Put( aTStops );
439 : }
440 0 : break;
441 : case RES_POOLCOLL_MARGINAL: // Text body marginal
442 : {
443 0 : SvxLRSpaceItem aLR( RES_LR_SPACE );
444 0 : aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 4 );
445 0 : aSet.Put( aLR );
446 : }
447 0 : break;
448 :
449 : case RES_POOLCOLL_HEADLINE_BASE: // Base headline
450 : {
451 : static const sal_uInt16 aFntInit[] = {
452 : DEFAULTFONT_LATIN_HEADING, RES_CHRATR_FONT,
453 : RES_CHRATR_LANGUAGE, LANGUAGE_ENGLISH_US,
454 : DEFAULTFONT_CJK_HEADING, RES_CHRATR_CJK_FONT,
455 : RES_CHRATR_CJK_LANGUAGE, LANGUAGE_ENGLISH_US,
456 : DEFAULTFONT_CTL_HEADING, RES_CHRATR_CTL_FONT,
457 : RES_CHRATR_CTL_LANGUAGE, LANGUAGE_ARABIC_SAUDI_ARABIA,
458 : 0
459 : };
460 :
461 2216 : for( const sal_uInt16* pArr = aFntInit; *pArr; pArr += 4 )
462 : {
463 1662 : sal_uInt16 nLng = ((SvxLanguageItem&)GetDefault( *(pArr+2) )).GetLanguage();
464 1662 : if( LANGUAGE_DONTKNOW == nLng )
465 0 : nLng = *(pArr+3);
466 :
467 : Font aFnt( OutputDevice::GetDefaultFont( *pArr,
468 1662 : nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
469 :
470 1662 : aSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
471 : aEmptyStr, aFnt.GetPitch(),
472 3324 : aFnt.GetCharSet(), *(pArr+1) ));
473 1662 : }
474 :
475 554 : SvxFontHeightItem aFntSize( PT_14, 100, RES_CHRATR_FONTSIZE );
476 554 : SvxULSpaceItem aUL( PT_12, PT_6, RES_UL_SPACE );
477 554 : if( get(IDocumentSettingAccess::HTML_MODE) )
478 0 : aUL.SetLower( HTML_PARSPACE );
479 554 : aSet.Put( SvxFmtKeepItem( sal_True, RES_KEEP ));
480 :
481 554 : pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool( RES_POOLCOLL_TEXT ));
482 :
483 554 : aSet.Put( aUL );
484 554 : SetAllScriptItem( aSet, aFntSize );
485 : }
486 554 : break;
487 :
488 : case RES_POOLCOLL_NUMBUL_BASE: // Base Numbering
489 554 : break;
490 :
491 : case RES_POOLCOLL_GREETING: // Greeting
492 : case RES_POOLCOLL_REGISTER_BASE: // Base indexes
493 : case RES_POOLCOLL_SIGNATURE: // Signatures
494 : case RES_POOLCOLL_TABLE: // Tabele content
495 : {
496 586 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
497 586 : aSet.Put( aLN );
498 : }
499 586 : break;
500 :
501 : case RES_POOLCOLL_HEADLINE1: // Headinline 1
502 32 : lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 0, false );
503 32 : break;
504 : case RES_POOLCOLL_HEADLINE2: // Headinline 2
505 26 : lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 1, true );
506 26 : break;
507 : case RES_POOLCOLL_HEADLINE3: // Headinline 3
508 26 : lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 2, false );
509 26 : break;
510 : case RES_POOLCOLL_HEADLINE4: // Headinline 4
511 10 : lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 3, true );
512 10 : break;
513 : case RES_POOLCOLL_HEADLINE5: // Headinline 5
514 14 : lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 4, false );
515 14 : break;
516 : case RES_POOLCOLL_HEADLINE6: // Headinline 6
517 10 : lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 5, false );
518 10 : break;
519 : case RES_POOLCOLL_HEADLINE7: // Headinline 7
520 10 : lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 6, false );
521 10 : break;
522 : case RES_POOLCOLL_HEADLINE8: // Headinline 8
523 10 : lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 7, false );
524 10 : break;
525 : case RES_POOLCOLL_HEADLINE9: // Headinline 9
526 10 : lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 8, false );
527 10 : break;
528 : case RES_POOLCOLL_HEADLINE10: // Headinline 10
529 0 : lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 9, false );
530 0 : break;
531 :
532 :
533 : // Special sections:
534 : // Header
535 : case RES_POOLCOLL_HEADER:
536 : case RES_POOLCOLL_HEADERL:
537 : case RES_POOLCOLL_HEADERR:
538 : // Footer
539 : case RES_POOLCOLL_FOOTER:
540 : case RES_POOLCOLL_FOOTERL:
541 : case RES_POOLCOLL_FOOTERR:
542 : {
543 84 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
544 84 : aSet.Put( aLN );
545 :
546 84 : long nRightMargin = lcl_GetRightMargin( *this );
547 :
548 84 : SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
549 84 : aTStops.Insert( SvxTabStop( nRightMargin / 2, SVX_TAB_ADJUST_CENTER ) );
550 84 : aTStops.Insert( SvxTabStop( nRightMargin, SVX_TAB_ADJUST_RIGHT ) );
551 :
552 84 : aSet.Put( aTStops );
553 : }
554 84 : break;
555 :
556 : case RES_POOLCOLL_TABLE_HDLN:
557 : {
558 32 : SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
559 32 : aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) );
560 32 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
561 32 : aSet.Put( aLN );
562 : }
563 32 : break;
564 :
565 : case RES_POOLCOLL_FOOTNOTE: // paragraph style Footnote
566 : case RES_POOLCOLL_ENDNOTE: // paragraph style Endnote
567 : {
568 20 : SvxLRSpaceItem aLR( RES_LR_SPACE );
569 20 : aLR.SetTxtFirstLineOfst( -(short)( GetMetricVal( CM_05 ) + GetMetricVal( CM_01 ) ) );
570 20 : aLR.SetTxtLeft( GetMetricVal( CM_05 ) + GetMetricVal( CM_01 ) );
571 20 : SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) );
572 20 : aSet.Put( aLR );
573 20 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
574 20 : aSet.Put( aLN );
575 : }
576 20 : break;
577 :
578 : case RES_POOLCOLL_LABEL: // basic caption
579 : {
580 554 : SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetUpper( PT_6 ); aUL.SetLower( PT_6 );
581 554 : aSet.Put( aUL );
582 554 : SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) );
583 554 : SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) );
584 554 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
585 554 : aSet.Put( aLN );
586 : }
587 554 : break;
588 :
589 : case RES_POOLCOLL_FRAME: // Frame content
590 : case RES_POOLCOLL_LABEL_ABB: // caption image
591 : case RES_POOLCOLL_LABEL_TABLE: // caption table
592 : case RES_POOLCOLL_LABEL_FRAME: // caption frame
593 : case RES_POOLCOLL_LABEL_DRAWING: // caption drawing
594 30 : break;
595 :
596 : case RES_POOLCOLL_JAKETADRESS: // envelope address
597 : {
598 4 : SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 );
599 4 : aSet.Put( aUL );
600 4 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
601 4 : aSet.Put( aLN );
602 : }
603 4 : break;
604 :
605 : case RES_POOLCOLL_SENDADRESS: // Sender address
606 : {
607 4 : if( get(IDocumentSettingAccess::HTML_MODE) )
608 0 : SetAllScriptItem( aSet, SvxPostureItem(ITALIC_NORMAL, RES_CHRATR_POSTURE) );
609 : else
610 : {
611 4 : SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 );
612 4 : aSet.Put( aUL );
613 : }
614 4 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
615 4 : aSet.Put( aLN );
616 : }
617 4 : break;
618 :
619 : // User defined indexes:
620 : case RES_POOLCOLL_TOX_USERH: // Header
621 0 : lcl_SetRegister( this, aSet, 0, true, false );
622 : {
623 0 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
624 0 : aSet.Put( aLN );
625 : }
626 0 : break;
627 : case RES_POOLCOLL_TOX_USER1: // 1. Level
628 0 : lcl_SetRegister( this, aSet, 0, false, true );
629 0 : break;
630 : case RES_POOLCOLL_TOX_USER2: // 2. Level
631 0 : lcl_SetRegister( this, aSet, 1, false, true );
632 0 : break;
633 : case RES_POOLCOLL_TOX_USER3: // 3. Level
634 0 : lcl_SetRegister( this, aSet, 2, false, true );
635 0 : break;
636 : case RES_POOLCOLL_TOX_USER4: // 4. Level
637 0 : lcl_SetRegister( this, aSet, 3, false, true );
638 0 : break;
639 : case RES_POOLCOLL_TOX_USER5: // 5. Level
640 0 : lcl_SetRegister( this, aSet, 4, false, true );
641 0 : break;
642 : case RES_POOLCOLL_TOX_USER6: // 6. Level
643 0 : lcl_SetRegister( this, aSet, 5, false, true );
644 0 : break;
645 : case RES_POOLCOLL_TOX_USER7: // 7. Level
646 0 : lcl_SetRegister( this, aSet, 6, false, true );
647 0 : break;
648 : case RES_POOLCOLL_TOX_USER8: // 8. Level
649 0 : lcl_SetRegister( this, aSet, 7, false, true );
650 0 : break;
651 : case RES_POOLCOLL_TOX_USER9: // 9. Level
652 0 : lcl_SetRegister( this, aSet, 8, false, true );
653 0 : break;
654 : case RES_POOLCOLL_TOX_USER10: // 10. Level
655 0 : lcl_SetRegister( this, aSet, 9, false, true );
656 0 : break;
657 :
658 : // Index
659 : case RES_POOLCOLL_TOX_IDXH: // Header
660 0 : lcl_SetRegister( this, aSet, 0, true, false );
661 : {
662 0 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
663 0 : aSet.Put( aLN );
664 : }
665 0 : break;
666 : case RES_POOLCOLL_TOX_IDX1: // 1. Level
667 0 : lcl_SetRegister( this, aSet, 0, false, false );
668 0 : break;
669 : case RES_POOLCOLL_TOX_IDX2: // 2. Level
670 0 : lcl_SetRegister( this, aSet, 1, false, false );
671 0 : break;
672 : case RES_POOLCOLL_TOX_IDX3: // 3. Level
673 0 : lcl_SetRegister( this, aSet, 2, false, false );
674 0 : break;
675 : case RES_POOLCOLL_TOX_IDXBREAK: // Trenner
676 0 : lcl_SetRegister( this, aSet, 0, false, false );
677 0 : break;
678 :
679 : // Table of Content
680 : case RES_POOLCOLL_TOX_CNTNTH: // Header
681 4 : lcl_SetRegister( this, aSet, 0, true, false );
682 : {
683 4 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
684 4 : aSet.Put( aLN );
685 : }
686 4 : break;
687 : case RES_POOLCOLL_TOX_CNTNT1: // 1. Level
688 6 : lcl_SetRegister( this, aSet, 0, false, true );
689 6 : break;
690 : case RES_POOLCOLL_TOX_CNTNT2: // 2. Level
691 6 : lcl_SetRegister( this, aSet, 1, false, true );
692 6 : break;
693 : case RES_POOLCOLL_TOX_CNTNT3: // 3. Level
694 6 : lcl_SetRegister( this, aSet, 2, false, true );
695 6 : break;
696 : case RES_POOLCOLL_TOX_CNTNT4: // 4. Level
697 2 : lcl_SetRegister( this, aSet, 3, false, true );
698 2 : break;
699 : case RES_POOLCOLL_TOX_CNTNT5: // 5. Level
700 2 : lcl_SetRegister( this, aSet, 4, false, true );
701 2 : break;
702 : case RES_POOLCOLL_TOX_CNTNT6: // 6. Level
703 2 : lcl_SetRegister( this, aSet, 5, false, true );
704 2 : break;
705 : case RES_POOLCOLL_TOX_CNTNT7: // 7. Level
706 2 : lcl_SetRegister( this, aSet, 6, false, true );
707 2 : break;
708 : case RES_POOLCOLL_TOX_CNTNT8: // 8. Level
709 2 : lcl_SetRegister( this, aSet, 7, false, true );
710 2 : break;
711 : case RES_POOLCOLL_TOX_CNTNT9: // 9. Level
712 2 : lcl_SetRegister( this, aSet, 8, false, true );
713 2 : break;
714 : case RES_POOLCOLL_TOX_CNTNT10: // 10. Level
715 0 : lcl_SetRegister( this, aSet, 9, false, true );
716 0 : break;
717 :
718 : case RES_POOLCOLL_TOX_ILLUSH:
719 : case RES_POOLCOLL_TOX_OBJECTH:
720 : case RES_POOLCOLL_TOX_TABLESH:
721 : case RES_POOLCOLL_TOX_AUTHORITIESH:
722 0 : lcl_SetRegister( this, aSet, 0, true, false );
723 : {
724 0 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
725 0 : aSet.Put( aLN );
726 : }
727 0 : break;
728 : case RES_POOLCOLL_TOX_ILLUS1:
729 : case RES_POOLCOLL_TOX_OBJECT1:
730 : case RES_POOLCOLL_TOX_TABLES1:
731 : case RES_POOLCOLL_TOX_AUTHORITIES1:
732 0 : lcl_SetRegister( this, aSet, 0, false, true );
733 0 : break;
734 :
735 :
736 :
737 : case RES_POOLCOLL_NUM_LEVEL1S:
738 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
739 0 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
740 0 : PT_12, PT_6 );
741 0 : break;
742 : case RES_POOLCOLL_NUM_LEVEL1:
743 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
744 4 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
745 4 : 0, PT_6 );
746 4 : break;
747 : case RES_POOLCOLL_NUM_LEVEL1E:
748 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
749 0 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
750 0 : 0, PT_12 );
751 0 : break;
752 : case RES_POOLCOLL_NUM_NONUM1:
753 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM1,
754 0 : 0, SwNumRule::GetNumIndent( 0 ), 0, PT_6 );
755 0 : break;
756 : case RES_POOLCOLL_NUM_LEVEL2S:
757 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
758 0 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
759 0 : PT_12, PT_6 );
760 0 : break;
761 : case RES_POOLCOLL_NUM_LEVEL2:
762 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
763 4 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
764 4 : 0, PT_6 );
765 4 : break;
766 : case RES_POOLCOLL_NUM_LEVEL2E:
767 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
768 0 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
769 0 : 0, PT_12 );
770 0 : break;
771 : case RES_POOLCOLL_NUM_NONUM2:
772 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM2,
773 0 : 0, SwNumRule::GetNumIndent( 1 ), 0, PT_6 );
774 0 : break;
775 : case RES_POOLCOLL_NUM_LEVEL3S:
776 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
777 0 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
778 0 : PT_12, PT_6 );
779 0 : break;
780 : case RES_POOLCOLL_NUM_LEVEL3:
781 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
782 4 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
783 4 : 0, PT_6 );
784 4 : break;
785 : case RES_POOLCOLL_NUM_LEVEL3E:
786 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
787 0 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
788 0 : 0, PT_12 );
789 0 : break;
790 : case RES_POOLCOLL_NUM_NONUM3:
791 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM3,
792 0 : 0, SwNumRule::GetNumIndent( 2 ), 0, PT_6 );
793 0 : break;
794 : case RES_POOLCOLL_NUM_LEVEL4S:
795 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
796 0 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
797 0 : PT_12, PT_6 );
798 0 : break;
799 : case RES_POOLCOLL_NUM_LEVEL4:
800 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
801 0 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
802 0 : 0, PT_6 );
803 0 : break;
804 : case RES_POOLCOLL_NUM_LEVEL4E:
805 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
806 0 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
807 0 : 0, PT_12 );
808 0 : break;
809 : case RES_POOLCOLL_NUM_NONUM4:
810 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM4,
811 0 : 0, SwNumRule::GetNumIndent( 3 ), 0, PT_6 );
812 0 : break;
813 : case RES_POOLCOLL_NUM_LEVEL5S:
814 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
815 0 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
816 0 : PT_12, PT_6 );
817 0 : break;
818 : case RES_POOLCOLL_NUM_LEVEL5:
819 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
820 4 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
821 4 : 0, PT_6 );
822 4 : break;
823 : case RES_POOLCOLL_NUM_LEVEL5E:
824 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
825 0 : lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
826 0 : 0, PT_12 );
827 0 : break;
828 : case RES_POOLCOLL_NUM_NONUM5:
829 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM5,
830 0 : 0, SwNumRule::GetNumIndent( 4 ), 0, PT_6 );
831 0 : break;
832 :
833 : case RES_POOLCOLL_BUL_LEVEL1S:
834 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
835 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
836 0 : PT_12, PT_6 );
837 0 : break;
838 : case RES_POOLCOLL_BUL_LEVEL1:
839 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
840 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
841 0 : 0, PT_6 );
842 0 : break;
843 : case RES_POOLCOLL_BUL_LEVEL1E:
844 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
845 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
846 0 : 0, PT_12 );
847 0 : break;
848 : case RES_POOLCOLL_BUL_NONUM1:
849 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM1,
850 0 : 0, SwNumRule::GetBullIndent( 0 ), 0, PT_6 );
851 0 : break;
852 : case RES_POOLCOLL_BUL_LEVEL2S:
853 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
854 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
855 0 : PT_12, PT_6 );
856 0 : break;
857 : case RES_POOLCOLL_BUL_LEVEL2:
858 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
859 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
860 0 : 0, PT_6 );
861 0 : break;
862 : case RES_POOLCOLL_BUL_LEVEL2E:
863 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
864 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
865 0 : 0, PT_12 );
866 0 : break;
867 : case RES_POOLCOLL_BUL_NONUM2:
868 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM2,
869 0 : 0, SwNumRule::GetBullIndent( 1 ), 0, PT_6 );
870 0 : break;
871 : case RES_POOLCOLL_BUL_LEVEL3S:
872 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
873 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
874 0 : PT_12, PT_6 );
875 0 : break;
876 : case RES_POOLCOLL_BUL_LEVEL3:
877 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
878 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
879 0 : 0, PT_6 );
880 0 : break;
881 : case RES_POOLCOLL_BUL_LEVEL3E:
882 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
883 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
884 0 : 0, PT_12 );
885 0 : break;
886 : case RES_POOLCOLL_BUL_NONUM3:
887 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM3,
888 0 : 0, SwNumRule::GetBullIndent( 2 ), 0, PT_6 );
889 0 : break;
890 : case RES_POOLCOLL_BUL_LEVEL4S:
891 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
892 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
893 0 : PT_12, PT_6 );
894 0 : break;
895 : case RES_POOLCOLL_BUL_LEVEL4:
896 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
897 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
898 0 : 0, PT_6 );
899 0 : break;
900 : case RES_POOLCOLL_BUL_LEVEL4E:
901 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
902 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
903 0 : 0, PT_12 );
904 0 : break;
905 : case RES_POOLCOLL_BUL_NONUM4:
906 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM4,
907 0 : 0, SwNumRule::GetBullIndent( 3 ), 0, PT_6 );
908 0 : break;
909 : case RES_POOLCOLL_BUL_LEVEL5S:
910 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
911 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
912 0 : PT_12, PT_6 );
913 0 : break;
914 : case RES_POOLCOLL_BUL_LEVEL5:
915 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
916 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
917 0 : 0, PT_6 );
918 0 : break;
919 : case RES_POOLCOLL_BUL_LEVEL5E:
920 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
921 0 : lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
922 0 : 0, PT_12 );
923 0 : break;
924 : case RES_POOLCOLL_BUL_NONUM5:
925 : lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM5,
926 0 : 0, SwNumRule::GetBullIndent( 4 ), 0, PT_6 );
927 0 : break;
928 :
929 : case RES_POOLCOLL_DOC_TITEL: // Document Title
930 : {
931 2 : SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
932 2 : SetAllScriptItem( aSet, SvxFontHeightItem( PT_18, 100, RES_CHRATR_FONTSIZE ) );
933 :
934 2 : aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) );
935 :
936 : pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
937 2 : RES_POOLCOLL_DOC_SUBTITEL ));
938 : }
939 2 : break;
940 :
941 : case RES_POOLCOLL_DOC_SUBTITEL: // Document subtitle
942 : {
943 6 : SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ));
944 6 : SetAllScriptItem( aSet, SvxFontHeightItem( PT_14, 100, RES_CHRATR_FONTSIZE ));
945 :
946 6 : aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ));
947 :
948 : pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
949 6 : RES_POOLCOLL_TEXT ));
950 : }
951 6 : break;
952 :
953 : case RES_POOLCOLL_HTML_BLOCKQUOTE:
954 : {
955 0 : SvxLRSpaceItem aLR( RES_LR_SPACE );
956 0 : aLR.SetLeft( GetMetricVal( CM_1 ));
957 0 : aLR.SetRight( GetMetricVal( CM_1 ));
958 0 : aSet.Put( aLR );
959 0 : SvxULSpaceItem aUL( RES_UL_SPACE );
960 0 : aUL = pNewColl->GetULSpace();
961 0 : aUL.SetLower( HTML_PARSPACE );
962 0 : aSet.Put( aUL);
963 : }
964 0 : break;
965 :
966 : case RES_POOLCOLL_HTML_PRE:
967 : {
968 6 : ::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
969 :
970 : // WORKAROUND: Set PRE to 10pt
971 6 : SetAllScriptItem( aSet, SvxFontHeightItem(PT_10, 100, RES_CHRATR_FONTSIZE) );
972 : // WORKAROUND: Set PRE to 10pt
973 :
974 : // The lower paragraph distance is set explicitly (makes
975 : // assigning hard attributes easier)
976 6 : SvxULSpaceItem aULSpaceItem( RES_UL_SPACE );
977 6 : aULSpaceItem = pNewColl->GetULSpace();
978 6 : aULSpaceItem.SetLower( 0 );
979 6 : aSet.Put( aULSpaceItem );
980 : }
981 6 : break;
982 :
983 : case RES_POOLCOLL_HTML_HR:
984 : {
985 0 : SvxBoxItem aBox( RES_BOX );
986 0 : Color aColor( COL_GRAY );
987 0 : SvxBorderLine aNew(&aColor, 1, table::BorderLineStyle::DOUBLE);
988 0 : aBox.SetLine( &aNew, BOX_LINE_BOTTOM );
989 :
990 0 : aSet.Put( aBox );
991 0 : aSet.Put( SwParaConnectBorderItem( sal_False ) );
992 0 : SetAllScriptItem( aSet, SvxFontHeightItem(120, 100, RES_CHRATR_FONTSIZE) );
993 :
994 0 : SvxULSpaceItem aUL( RES_UL_SPACE );
995 : {
996 : pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
997 0 : RES_POOLCOLL_TEXT ));
998 0 : aUL = pNewColl->GetULSpace();
999 : }
1000 0 : aUL.SetLower( HTML_PARSPACE );
1001 0 : aSet.Put( aUL);
1002 0 : SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
1003 0 : aSet.Put( aLN );
1004 : }
1005 0 : break;
1006 :
1007 : case RES_POOLCOLL_HTML_DD:
1008 : {
1009 0 : SvxLRSpaceItem aLR( RES_LR_SPACE );
1010 0 : aLR = pNewColl->GetLRSpace();
1011 : // We indent by 1 cm. The IDs are always 2 away from each other!
1012 0 : aLR.SetLeft( GetMetricVal( CM_1 ));
1013 0 : aSet.Put( aLR );
1014 : }
1015 0 : break;
1016 : case RES_POOLCOLL_HTML_DT:
1017 : {
1018 0 : SvxLRSpaceItem aLR( RES_LR_SPACE );
1019 : {
1020 : pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
1021 0 : RES_POOLCOLL_HTML_DD ));
1022 0 : aLR = pNewColl->GetLRSpace();
1023 : }
1024 : // We indent by 0 cm. The IDs are always 2 away from each other!
1025 0 : aLR.SetLeft( 0 );
1026 0 : aSet.Put( aLR );
1027 : }
1028 0 : break;
1029 : }
1030 : }
1031 :
1032 3952 : if( aSet.Count() )
1033 : {
1034 : {
1035 2620 : pNewColl->SetFmtAttr( aSet );
1036 : }
1037 : }
1038 3952 : return pNewColl;
1039 : }
1040 :
1041 :
1042 :
1043 : // Check if this AutoCollection is already/still in use in this Document
1044 43920 : bool SwDoc::IsPoolTxtCollUsed( sal_uInt16 nId ) const
1045 : {
1046 : OSL_ENSURE(
1047 : (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) ||
1048 : (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) ||
1049 : (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) ||
1050 : (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END) ||
1051 : (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) ||
1052 : (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END),
1053 : "Wrong AutoFormat Id" );
1054 :
1055 43920 : SwTxtFmtColl* pNewColl = 0;
1056 43920 : bool bFnd = false;
1057 713468 : for( sal_uInt16 n = 0; !bFnd && n < pTxtFmtCollTbl->size(); ++n )
1058 : {
1059 669548 : pNewColl = (*pTxtFmtCollTbl)[ n ];
1060 669548 : if( nId == pNewColl->GetPoolFmtId() )
1061 3976 : bFnd = true;
1062 : }
1063 :
1064 43920 : if( !bFnd || !pNewColl->GetDepends() )
1065 43093 : return false;
1066 :
1067 827 : SwAutoFmtGetDocNode aGetHt( &GetNodes() );
1068 827 : return !pNewColl->GetInfo( aGetHt );
1069 : }
1070 :
1071 : // Return the AutomaticFormat with the supplied Id. If it doesn't
1072 : // exist, create it.
1073 1451 : SwFmt* SwDoc::GetFmtFromPool( sal_uInt16 nId )
1074 : {
1075 1451 : SwFmt *pNewFmt = 0;
1076 1451 : SwFmt *pDeriveFmt = 0;
1077 :
1078 : SwFmtsBase* pArray[ 2 ];
1079 1451 : sal_uInt16 nArrCnt = 1, nRCId = 0;
1080 1451 : sal_uInt16* pWhichRange = 0;
1081 :
1082 1451 : switch( nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
1083 : {
1084 : case POOLGRP_CHARFMT:
1085 : {
1086 391 : pArray[0] = pCharFmtTbl;
1087 391 : pDeriveFmt = pDfltCharFmt;
1088 :
1089 391 : if( nId > RES_POOLCHR_NORMAL_END )
1090 22 : nRCId = RC_POOLCHRFMT_HTML_BEGIN - RES_POOLCHR_HTML_BEGIN;
1091 : else
1092 369 : nRCId = RC_POOLCHRFMT_BEGIN - RES_POOLCHR_BEGIN;
1093 391 : pWhichRange = aCharFmtSetRange;
1094 :
1095 : // Fault: unknown Format, but a CharFormat
1096 : // -> return the first one
1097 391 : if( RES_POOLCHR_BEGIN > nId || nId >= RES_POOLCHR_END )
1098 : {
1099 : OSL_ENSURE( !this, "invalid Id" );
1100 0 : nId = RES_POOLCHR_BEGIN;
1101 : }
1102 : }
1103 391 : break;
1104 : case POOLGRP_FRAMEFMT:
1105 : {
1106 1060 : pArray[0] = pFrmFmtTbl;
1107 1060 : pArray[1] = pSpzFrmFmtTbl;
1108 1060 : pDeriveFmt = pDfltFrmFmt;
1109 1060 : nArrCnt = 2;
1110 1060 : nRCId = RC_POOLFRMFMT_BEGIN - RES_POOLFRM_BEGIN;
1111 1060 : pWhichRange = aFrmFmtSetRange;
1112 :
1113 : // Fault: unknown Format, but a FrameFormat
1114 : // -> return the first one
1115 1060 : if( RES_POOLFRM_BEGIN > nId || nId >= RES_POOLFRM_END )
1116 : {
1117 : OSL_ENSURE( !this, "invalid Id" );
1118 0 : nId = RES_POOLFRM_BEGIN;
1119 : }
1120 : }
1121 1060 : break;
1122 :
1123 : default:
1124 : // Fault, unknown Format
1125 : OSL_ENSURE( nId, "invalid Id" );
1126 0 : return 0;
1127 : }
1128 : OSL_ENSURE( nRCId, "invalid Id" );
1129 :
1130 4654 : while( nArrCnt-- )
1131 7489 : for( sal_uInt16 n = 0; n < (*pArray[nArrCnt]).GetFmtCount(); ++n )
1132 11474 : if( nId == ( pNewFmt = (*pArray[ nArrCnt ] ).GetFmt( n ) )->
1133 5737 : GetPoolFmtId() )
1134 : {
1135 759 : return pNewFmt;
1136 : }
1137 :
1138 692 : ResId aResId( nRCId + nId, *pSwResMgr );
1139 692 : String aNm( aResId );
1140 692 : SwAttrSet aSet( GetAttrPool(), pWhichRange );
1141 :
1142 : {
1143 692 : bool bIsModified = IsModified();
1144 :
1145 : {
1146 692 : ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
1147 692 : switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
1148 : {
1149 : case POOLGRP_CHARFMT:
1150 136 : pNewFmt = _MakeCharFmt(aNm, pDeriveFmt, false, true);
1151 136 : break;
1152 : case POOLGRP_FRAMEFMT:
1153 556 : pNewFmt = _MakeFrmFmt(aNm, pDeriveFmt, false, true);
1154 556 : break;
1155 : default:
1156 0 : break;
1157 692 : }
1158 : }
1159 :
1160 692 : if( !bIsModified )
1161 430 : ResetModified();
1162 692 : pNewFmt->SetPoolFmtId( nId );
1163 692 : pNewFmt->SetAuto( false ); // no AutoFormat
1164 : }
1165 :
1166 692 : switch( nId )
1167 : {
1168 : case RES_POOLCHR_FOOTNOTE: // Footnote
1169 : case RES_POOLCHR_PAGENO: // Page/Field
1170 : case RES_POOLCHR_LABEL: // Label
1171 : case RES_POOLCHR_DROPCAPS: // Dropcaps
1172 : case RES_POOLCHR_NUM_LEVEL: // Numbering level
1173 : case RES_POOLCHR_TOXJUMP: // Table of contents jump
1174 : case RES_POOLCHR_ENDNOTE: // Endnote
1175 : case RES_POOLCHR_LINENUM: // Line numbering
1176 47 : break;
1177 :
1178 : case RES_POOLCHR_ENDNOTE_ANCHOR: // Endnote anchor
1179 : case RES_POOLCHR_FOOTNOTE_ANCHOR: // Footnote anchor
1180 : {
1181 16 : aSet.Put( SvxEscapementItem( DFLT_ESC_AUTO_SUPER, 58, RES_CHRATR_ESCAPEMENT ) );
1182 : }
1183 16 : break;
1184 :
1185 :
1186 : case RES_POOLCHR_BUL_LEVEL: // Bullet character
1187 : {
1188 7 : const Font& rBulletFont = numfunc::GetDefBulletFont();
1189 : SetAllScriptItem( aSet, SvxFontItem( rBulletFont.GetFamily(),
1190 7 : rBulletFont.GetName(), rBulletFont.GetStyleName(),
1191 14 : rBulletFont.GetPitch(), rBulletFont.GetCharSet(), RES_CHRATR_FONT ));
1192 : }
1193 7 : break;
1194 :
1195 : case RES_POOLCHR_INET_NORMAL:
1196 : {
1197 42 : Color aCol( COL_BLUE );
1198 42 : aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
1199 42 : aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE ) );
1200 : // i40133: patch submitted by rail: set language to 'none' to prevent spell checking:
1201 42 : aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
1202 42 : aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE ) );
1203 42 : aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE ) );
1204 : }
1205 42 : break;
1206 : case RES_POOLCHR_INET_VISIT:
1207 : {
1208 2 : Color aCol( COL_RED );
1209 2 : aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
1210 2 : aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE ) );
1211 2 : aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
1212 2 : aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE ) );
1213 2 : aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE ) );
1214 : }
1215 2 : break;
1216 : case RES_POOLCHR_JUMPEDIT:
1217 : {
1218 0 : Color aCol( COL_CYAN );
1219 0 : aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
1220 0 : aSet.Put( SvxUnderlineItem( UNDERLINE_DOTTED, RES_CHRATR_UNDERLINE ) );
1221 0 : aSet.Put( SvxCaseMapItem( SVX_CASEMAP_KAPITAELCHEN, RES_CHRATR_CASEMAP ) );
1222 : }
1223 0 : break;
1224 :
1225 : case RES_POOLCHR_RUBYTEXT:
1226 : {
1227 : long nH = ((SvxFontHeightItem*)GetDfltAttr(
1228 0 : RES_CHRATR_CJK_FONTSIZE ))->GetHeight() / 2;
1229 0 : SetAllScriptItem( aSet, SvxFontHeightItem( nH, 100, RES_CHRATR_FONTSIZE));
1230 0 : aSet.Put(SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ));
1231 0 : aSet.Put(SvxEmphasisMarkItem( EMPHASISMARK_NONE, RES_CHRATR_EMPHASIS_MARK) );
1232 : }
1233 0 : break;
1234 :
1235 : case RES_POOLCHR_HTML_EMPHASIS:
1236 : case RES_POOLCHR_HTML_CITIATION:
1237 : case RES_POOLCHR_HTML_VARIABLE:
1238 : {
1239 6 : SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE) );
1240 : }
1241 6 : break;
1242 :
1243 : case RES_POOLCHR_IDX_MAIN_ENTRY:
1244 : case RES_POOLCHR_HTML_STRONG:
1245 : {
1246 8 : SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ));
1247 : }
1248 8 : break;
1249 :
1250 : case RES_POOLCHR_HTML_CODE:
1251 : case RES_POOLCHR_HTML_SAMPLE:
1252 : case RES_POOLCHR_HTML_KEYBOARD:
1253 : case RES_POOLCHR_HTML_TELETYPE:
1254 : {
1255 8 : ::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
1256 : }
1257 8 : break;
1258 : case RES_POOLCHR_VERT_NUM:
1259 0 : aSet.Put( SvxCharRotateItem( 900, sal_False, RES_CHRATR_ROTATE ) );
1260 0 : break;
1261 :
1262 : case RES_POOLFRM_FRAME:
1263 : {
1264 238 : if ( get(IDocumentSettingAccess::HTML_MODE) )
1265 : {
1266 0 : aSet.Put( SwFmtAnchor( FLY_AS_CHAR ));
1267 0 : aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::LINE_CENTER, text::RelOrientation::PRINT_AREA ) );
1268 0 : aSet.Put( SwFmtSurround( SURROUND_NONE ) );
1269 : }
1270 : else
1271 : {
1272 238 : aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
1273 238 : aSet.Put( SwFmtSurround( SURROUND_PARALLEL ) );
1274 238 : aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::PRINT_AREA ) );
1275 238 : aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::PRINT_AREA ) );
1276 238 : Color aCol( COL_BLACK );
1277 238 : SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 );
1278 238 : SvxBoxItem aBox( RES_BOX );
1279 238 : aBox.SetLine( &aLine, BOX_LINE_TOP );
1280 238 : aBox.SetLine( &aLine, BOX_LINE_BOTTOM );
1281 238 : aBox.SetLine( &aLine, BOX_LINE_LEFT );
1282 238 : aBox.SetLine( &aLine, BOX_LINE_RIGHT );
1283 238 : aBox.SetDistance( 85 );
1284 238 : aSet.Put( aBox );
1285 238 : aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1286 238 : aSet.Put( SvxULSpaceItem( 114, 114, RES_UL_SPACE ) );
1287 : }
1288 : }
1289 238 : break;
1290 : case RES_POOLFRM_GRAPHIC:
1291 : case RES_POOLFRM_OLE:
1292 : {
1293 194 : aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
1294 194 : aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
1295 194 : aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
1296 194 : aSet.Put( SwFmtSurround( SURROUND_IDEAL ));
1297 : }
1298 194 : break;
1299 : case RES_POOLFRM_FORMEL:
1300 : {
1301 124 : aSet.Put( SwFmtAnchor( FLY_AS_CHAR ) );
1302 124 : aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CHAR_CENTER, text::RelOrientation::FRAME ) );
1303 124 : aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1304 : }
1305 124 : break;
1306 : case RES_POOLFRM_MARGINAL:
1307 : {
1308 0 : aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
1309 0 : aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::FRAME ));
1310 0 : aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
1311 0 : aSet.Put( SwFmtSurround( SURROUND_PARALLEL ));
1312 : // Set the default width to 3.5 cm, use the minimum value for the height
1313 : aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE,
1314 0 : GetMetricVal( CM_1 ) * 3 + GetMetricVal( CM_05 ),
1315 0 : MM50 ));
1316 : }
1317 0 : break;
1318 : case RES_POOLFRM_WATERSIGN:
1319 : {
1320 0 : aSet.Put( SwFmtAnchor( FLY_AT_PAGE ));
1321 0 : aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
1322 0 : aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CENTER, text::RelOrientation::FRAME ));
1323 0 : aSet.Put( SvxOpaqueItem( sal_False ));
1324 0 : aSet.Put( SwFmtSurround( SURROUND_THROUGHT ));
1325 : }
1326 0 : break;
1327 :
1328 : case RES_POOLFRM_LABEL:
1329 : {
1330 0 : aSet.Put( SwFmtAnchor( FLY_AS_CHAR ) );
1331 0 : aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ) );
1332 0 : aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1333 :
1334 0 : SvxProtectItem aProtect( RES_PROTECT );
1335 0 : aProtect.SetSizeProtect( sal_True );
1336 0 : aProtect.SetPosProtect( sal_True );
1337 0 : aSet.Put( aProtect );
1338 :
1339 0 : pNewFmt->SetAutoUpdateFmt( sal_True );
1340 : }
1341 0 : break;
1342 : }
1343 692 : if( aSet.Count() )
1344 : {
1345 : {
1346 645 : pNewFmt->SetFmtAttr( aSet );
1347 : }
1348 : }
1349 692 : return pNewFmt;
1350 : }
1351 :
1352 1060 : SwFrmFmt* SwDoc::GetFrmFmtFromPool( sal_uInt16 nId )
1353 : {
1354 1060 : return (SwFrmFmt*)GetFmtFromPool( nId );
1355 : }
1356 :
1357 391 : SwCharFmt* SwDoc::GetCharFmtFromPool( sal_uInt16 nId )
1358 : {
1359 391 : return (SwCharFmt*)GetFmtFromPool( nId );
1360 : }
1361 :
1362 : // Check if this AutoCollection is already/still in use
1363 3960 : bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId ) const
1364 : {
1365 3960 : SwFmt *pNewFmt = 0;
1366 : const SwFmtsBase* pArray[ 2 ];
1367 3960 : sal_uInt16 nArrCnt = 1;
1368 3960 : bool bFnd = true;
1369 :
1370 3960 : if (RES_POOLCHR_BEGIN <= nId && nId < RES_POOLCHR_END)
1371 : {
1372 3848 : pArray[0] = pCharFmtTbl;
1373 : }
1374 112 : else if (RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END)
1375 : {
1376 112 : pArray[0] = pFrmFmtTbl;
1377 112 : pArray[1] = pSpzFrmFmtTbl;
1378 112 : nArrCnt = 2;
1379 : }
1380 : else
1381 : {
1382 : SAL_WARN("sw.core", "Invalid Pool Id: " << nId << " should be within " <<
1383 : "[" << int(RES_POOLCHR_BEGIN) << "," << int(RES_POOLCHR_END) << ") or " <<
1384 : "[" << int(RES_POOLFRM_BEGIN) << "," << int(RES_POOLFRM_END) << ")");
1385 0 : bFnd = false;
1386 : }
1387 :
1388 3960 : if( bFnd )
1389 : {
1390 3960 : bFnd = false;
1391 11992 : while( nArrCnt-- && !bFnd )
1392 67554 : for( sal_uInt16 n = 0; !bFnd && n < (*pArray[nArrCnt]).GetFmtCount(); ++n )
1393 126964 : if( nId == ( pNewFmt = (*pArray[ nArrCnt ] ).GetFmt( n ) )->
1394 63482 : GetPoolFmtId() )
1395 650 : bFnd = true;
1396 : }
1397 :
1398 : // Not found or no dependecies?
1399 3960 : if( bFnd && pNewFmt->GetDepends() )
1400 : {
1401 : // Check if we have dependent ContentNodes in the Nodes array
1402 : // (also indirect ones for derived Formats)
1403 10 : SwAutoFmtGetDocNode aGetHt( &GetNodes() );
1404 10 : bFnd = !pNewFmt->GetInfo( aGetHt );
1405 : }
1406 : else
1407 3950 : bFnd = false;
1408 :
1409 3960 : return bFnd;
1410 : }
1411 :
1412 :
1413 :
1414 122 : static void lcl_GetStdPgSize( SwDoc* pDoc, SfxItemSet& rSet )
1415 : {
1416 122 : SwPageDesc* pStdPgDsc = pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
1417 122 : SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() );
1418 122 : if( pStdPgDsc->GetLandscape() )
1419 : {
1420 0 : SwTwips nTmp = aFrmSz.GetHeight();
1421 0 : aFrmSz.SetHeight( aFrmSz.GetWidth() );
1422 0 : aFrmSz.SetWidth( nTmp );
1423 : }
1424 122 : rSet.Put( aFrmSz );
1425 122 : }
1426 :
1427 3123 : SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
1428 : {
1429 : OSL_ENSURE( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
1430 : "Wrong AutoFormat Id" );
1431 :
1432 : SwPageDesc *pNewPgDsc;
1433 : sal_uInt16 n;
1434 :
1435 3349 : for( n = 0; n < aPageDescs.size(); ++n )
1436 2649 : if( nId == ( pNewPgDsc = aPageDescs[ n ] )->GetPoolFmtId() )
1437 : {
1438 2423 : return pNewPgDsc;
1439 : }
1440 :
1441 : // error: unknown Pool style
1442 700 : if( RES_POOLPAGE_BEGIN > nId || nId >= RES_POOLPAGE_END )
1443 : {
1444 : OSL_ENSURE( !this, "invalid Id" );
1445 0 : nId = RES_POOLPAGE_BEGIN;
1446 : }
1447 :
1448 700 : ResId aResId( sal_uInt32(RC_POOLPAGEDESC_BEGIN + nId - RES_POOLPAGE_BEGIN), *pSwResMgr );
1449 700 : String aNm( aResId );
1450 : {
1451 700 : bool bIsModified = IsModified();
1452 :
1453 : {
1454 700 : ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
1455 700 : n = MakePageDesc( aNm, 0, bRegardLanguage );
1456 : }
1457 :
1458 700 : pNewPgDsc = aPageDescs[ n ];
1459 700 : pNewPgDsc->SetPoolFmtId( nId );
1460 700 : if( !bIsModified )
1461 558 : ResetModified();
1462 : }
1463 :
1464 :
1465 700 : SvxLRSpaceItem aLR( RES_LR_SPACE );
1466 700 : aLR.SetLeft( GetMetricVal( CM_1 ) * 2 );
1467 700 : aLR.SetRight( aLR.GetLeft() );
1468 700 : SvxULSpaceItem aUL( RES_UL_SPACE );
1469 700 : aUL.SetUpper( (sal_uInt16)aLR.GetLeft() );
1470 700 : aUL.SetLower( (sal_uInt16)aLR.GetLeft() );
1471 :
1472 700 : SwAttrSet aSet( GetAttrPool(), aPgFrmFmtSetRange );
1473 700 : bool bSetLeft = true;
1474 :
1475 700 : switch( nId )
1476 : {
1477 : case RES_POOLPAGE_STANDARD: // Standard page
1478 : {
1479 574 : aSet.Put( aLR );
1480 574 : aSet.Put( aUL );
1481 574 : if( pNewPgDsc )
1482 574 : pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL | nsUseOnPage::PD_FIRSTSHARE );
1483 : }
1484 574 : break;
1485 :
1486 : case RES_POOLPAGE_FIRST: // First page
1487 : case RES_POOLPAGE_REGISTER: // ToX
1488 : {
1489 110 : lcl_GetStdPgSize( this, aSet );
1490 110 : aSet.Put( aLR );
1491 110 : aSet.Put( aUL );
1492 110 : if( pNewPgDsc )
1493 : {
1494 110 : pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1495 110 : if( RES_POOLPAGE_FIRST == nId )
1496 108 : pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_STANDARD ));
1497 : }
1498 : }
1499 110 : break;
1500 :
1501 : case RES_POOLPAGE_LEFT: // Left page
1502 : {
1503 2 : lcl_GetStdPgSize( this, aSet );
1504 2 : aSet.Put( aLR );
1505 2 : aSet.Put( aUL );
1506 2 : bSetLeft = false;
1507 2 : if( pNewPgDsc )
1508 : {
1509 2 : pNewPgDsc->SetUseOn( nsUseOnPage::PD_LEFT );
1510 : // this relies on GetPageDescFromPool() not going into infinite recursion
1511 : // (by this point RES_POOLPAGE_LEFT will not reach this place again)
1512 2 : pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_RIGHT ));
1513 : }
1514 : }
1515 2 : break;
1516 : case RES_POOLPAGE_RIGHT: // Right page
1517 : {
1518 2 : lcl_GetStdPgSize( this, aSet );
1519 2 : aSet.Put( aLR );
1520 2 : aSet.Put( aUL );
1521 2 : bSetLeft = false;
1522 2 : if( pNewPgDsc )
1523 : {
1524 2 : pNewPgDsc->SetUseOn( nsUseOnPage::PD_RIGHT );
1525 2 : pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_LEFT ));
1526 : }
1527 : }
1528 2 : break;
1529 :
1530 : case RES_POOLPAGE_JAKET: // envelope
1531 : {
1532 2 : aLR.SetLeft( 0 ); aLR.SetRight( 0 );
1533 2 : aUL.SetUpper( 0 ); aUL.SetLower( 0 );
1534 2 : Size aPSize( SvxPaperInfo::GetPaperSize( PAPER_ENV_C65 ) );
1535 2 : LandscapeSwap( aPSize );
1536 2 : aSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, aPSize.Width(), aPSize.Height() ));
1537 2 : aSet.Put( aLR );
1538 2 : aSet.Put( aUL );
1539 :
1540 2 : if( pNewPgDsc )
1541 : {
1542 2 : pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1543 2 : pNewPgDsc->SetLandscape( sal_True );
1544 : }
1545 : }
1546 2 : break;
1547 :
1548 : case RES_POOLPAGE_HTML: // HTML
1549 : {
1550 2 : lcl_GetStdPgSize( this, aSet );
1551 2 : aLR.SetRight( GetMetricVal( CM_1 ));
1552 2 : aUL.SetUpper( (sal_uInt16)aLR.GetRight() );
1553 2 : aUL.SetLower( (sal_uInt16)aLR.GetRight() );
1554 2 : aSet.Put( aLR );
1555 2 : aSet.Put( aUL );
1556 :
1557 2 : if( pNewPgDsc )
1558 2 : pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1559 : }
1560 2 : break;
1561 : case RES_POOLPAGE_FOOTNOTE:
1562 : case RES_POOLPAGE_ENDNOTE:
1563 : {
1564 6 : lcl_GetStdPgSize( this, aSet );
1565 6 : aSet.Put( aLR );
1566 6 : aSet.Put( aUL );
1567 6 : if( pNewPgDsc )
1568 6 : pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1569 6 : SwPageFtnInfo aInf( pNewPgDsc->GetFtnInfo() );
1570 6 : aInf.SetLineWidth( 0 );
1571 6 : aInf.SetTopDist( 0 );
1572 6 : aInf.SetBottomDist( 0 );
1573 6 : pNewPgDsc->SetFtnInfo( aInf );
1574 : }
1575 6 : break;
1576 : case RES_POOLPAGE_LANDSCAPE:
1577 : {
1578 2 : SwPageDesc* pStdPgDsc = this->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
1579 2 : SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() );
1580 2 : SwTwips nTmp = aFrmSz.GetHeight();
1581 2 : aFrmSz.SetHeight( aFrmSz.GetWidth() );
1582 2 : aFrmSz.SetWidth( nTmp );
1583 2 : aSet.Put( aFrmSz );
1584 2 : aSet.Put( aLR );
1585 2 : aSet.Put( aUL );
1586 2 : if( pNewPgDsc )
1587 : {
1588 2 : pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1589 2 : pNewPgDsc->SetLandscape( sal_True );
1590 2 : }
1591 : }
1592 2 : break;
1593 :
1594 : }
1595 :
1596 700 : if( aSet.Count() )
1597 : {
1598 : {
1599 700 : if( bSetLeft )
1600 696 : pNewPgDsc->GetLeft().SetFmtAttr( aSet );
1601 700 : pNewPgDsc->GetMaster().SetFmtAttr( aSet );
1602 : }
1603 : }
1604 700 : return pNewPgDsc;
1605 : }
1606 :
1607 5 : SwNumRule* SwDoc::GetNumRuleFromPool( sal_uInt16 nId )
1608 : {
1609 : OSL_ENSURE( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END,
1610 : "Wrong AutoFormat Id" );
1611 :
1612 : SwNumRule* pNewRule;
1613 : sal_uInt16 n;
1614 :
1615 12 : for( n = 0; n < GetNumRuleTbl().size(); ++n )
1616 7 : if( nId == ( pNewRule = GetNumRuleTbl()[ n ] )->GetPoolFmtId() )
1617 : {
1618 0 : return pNewRule;
1619 : }
1620 :
1621 : // error: unknown Pool style
1622 5 : if( RES_POOLNUMRULE_BEGIN > nId || nId >= RES_POOLNUMRULE_END )
1623 : {
1624 : OSL_ENSURE( !this, "invalid Id" );
1625 0 : nId = RES_POOLNUMRULE_BEGIN;
1626 : }
1627 :
1628 5 : ResId aResId( sal_uInt32(RC_POOLNUMRULE_BEGIN + nId - RES_POOLNUMRULE_BEGIN), *pSwResMgr );
1629 5 : String aNm( aResId );
1630 :
1631 5 : SwCharFmt *pNumCFmt = 0, *pBullCFmt = 0;
1632 :
1633 : const SvxNumberFormat::SvxNumPositionAndSpaceMode eNumberFormatPositionAndSpaceMode
1634 5 : = numfunc::GetDefaultPositionAndSpaceMode(); //#i89178#
1635 : {
1636 5 : bool bIsModified = IsModified();
1637 :
1638 5 : n = MakeNumRule( aNm, 0, false, eNumberFormatPositionAndSpaceMode );
1639 :
1640 5 : pNewRule = GetNumRuleTbl()[ n ];
1641 5 : pNewRule->SetPoolFmtId( nId );
1642 5 : pNewRule->SetAutoRule( sal_False );
1643 :
1644 5 : if( RES_POOLNUMRULE_NUM1 <= nId && nId <= RES_POOLNUMRULE_NUM5 )
1645 3 : pNumCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
1646 :
1647 5 : if( ( RES_POOLNUMRULE_BUL1 <= nId && nId <= RES_POOLNUMRULE_BUL5 ) ||
1648 : RES_POOLNUMRULE_NUM5 == nId )
1649 2 : pBullCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
1650 :
1651 5 : if( !bIsModified )
1652 0 : ResetModified();
1653 : }
1654 :
1655 5 : switch( nId )
1656 : {
1657 : case RES_POOLNUMRULE_NUM1:
1658 : {
1659 3 : SwNumFmt aFmt;
1660 3 : aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1661 3 : aFmt.SetNumberingType(SVX_NUM_ARABIC);
1662 3 : aFmt.SetCharFmt( pNumCFmt );
1663 3 : aFmt.SetStart( 1 );
1664 3 : aFmt.SetIncludeUpperLevels( 1 );
1665 3 : aFmt.SetSuffix( aDotStr );
1666 :
1667 : static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
1668 : {
1669 : // cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
1670 : 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1671 : };
1672 : #ifdef USE_MEASUREMENT
1673 : static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
1674 : {
1675 : 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1676 : };
1677 : const sal_uInt16* pArr = MEASURE_METRIC ==
1678 : SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1679 : ? aAbsSpace
1680 : : aAbsSpaceInch;
1681 : #else
1682 3 : const sal_uInt16* pArr = aAbsSpace;
1683 : #endif
1684 :
1685 3 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1686 : {
1687 0 : aFmt.SetFirstLineOffset( - (*pArr) );
1688 : }
1689 3 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1690 : {
1691 3 : aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1692 3 : aFmt.SetFirstLineIndent( - (*pArr) );
1693 : }
1694 :
1695 33 : for( n = 0; n < MAXLEVEL; ++n, ++pArr )
1696 : {
1697 30 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1698 : {
1699 0 : aFmt.SetAbsLSpace( *pArr );
1700 : }
1701 30 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1702 : {
1703 30 : aFmt.SetListtabPos( *pArr );
1704 30 : aFmt.SetIndentAt( *pArr );
1705 : }
1706 :
1707 30 : pNewRule->Set( n, aFmt );
1708 3 : }
1709 : }
1710 3 : break;
1711 :
1712 : case RES_POOLNUMRULE_NUM2:
1713 : {
1714 : static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
1715 : {
1716 : 283, 283, 567, 709, // 0.50, 0.50, 1.00, 1.25
1717 : 850, 1021, 1304, 1474, // 1.50, 1.80, 2.30, 2.60
1718 : 1588, 1758 // 2.80, 3.10
1719 : };
1720 :
1721 : #ifdef USE_MEASUREMENT
1722 : static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
1723 : {
1724 : 385, 385, 770, 963,
1725 : 1155, 1386, 1771, 2002,
1726 : 2156, 2387
1727 : };
1728 :
1729 : const sal_uInt16* pArr = MEASURE_METRIC ==
1730 : SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1731 : ? aAbsSpace
1732 : : aAbsSpaceInch;
1733 : #else
1734 0 : const sal_uInt16* pArr = aAbsSpace;
1735 : #endif
1736 0 : SwNumFmt aFmt;
1737 :
1738 0 : aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1739 0 : aFmt.SetNumberingType(SVX_NUM_ARABIC);
1740 0 : aFmt.SetCharFmt( pNumCFmt );
1741 0 : aFmt.SetIncludeUpperLevels( 1 );
1742 :
1743 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1744 : {
1745 0 : aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1746 : }
1747 :
1748 0 : sal_uInt16 nSpace = 0;
1749 0 : for( n = 0; n < MAXLEVEL; ++n )
1750 : {
1751 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1752 : {
1753 0 : aFmt.SetAbsLSpace( nSpace = nSpace + pArr[ n ] );
1754 0 : aFmt.SetFirstLineOffset( - pArr[ n ] );
1755 : }
1756 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1757 : {
1758 0 : aFmt.SetListtabPos( nSpace = nSpace + pArr[ n ] );
1759 0 : aFmt.SetIndentAt( nSpace );
1760 0 : aFmt.SetFirstLineIndent( - pArr[ n ] );
1761 : }
1762 :
1763 0 : aFmt.SetStart( n+1 );
1764 0 : pNewRule->Set( n, aFmt );
1765 0 : }
1766 : }
1767 0 : break;
1768 : case RES_POOLNUMRULE_NUM3:
1769 : {
1770 0 : SwNumFmt aFmt;
1771 :
1772 0 : aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1773 0 : aFmt.SetNumberingType(SVX_NUM_ARABIC);
1774 0 : aFmt.SetCharFmt( pNumCFmt );
1775 0 : aFmt.SetIncludeUpperLevels( 1 );
1776 :
1777 0 : sal_uInt16 nOffs = GetMetricVal( CM_1 ) * 3;
1778 :
1779 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1780 : {
1781 0 : aFmt.SetFirstLineOffset( - nOffs );
1782 : }
1783 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1784 : {
1785 0 : aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1786 0 : aFmt.SetFirstLineIndent( - nOffs );
1787 : }
1788 :
1789 0 : for( n = 0; n < MAXLEVEL; ++n )
1790 : {
1791 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1792 : {
1793 0 : aFmt.SetAbsLSpace( (n+1) * nOffs );
1794 : }
1795 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1796 : {
1797 0 : aFmt.SetListtabPos( (n+1) * nOffs );
1798 0 : aFmt.SetIndentAt( (n+1) * nOffs );
1799 : }
1800 :
1801 0 : aFmt.SetStart( n+1 );
1802 0 : pNewRule->Set( n, aFmt );
1803 0 : }
1804 : }
1805 0 : break;
1806 : case RES_POOLNUMRULE_NUM4:
1807 : {
1808 0 : SwNumFmt aFmt;
1809 :
1810 0 : aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1811 0 : aFmt.SetNumberingType(SVX_NUM_ROMAN_UPPER);
1812 0 : aFmt.SetCharFmt( pNumCFmt );
1813 0 : aFmt.SetIncludeUpperLevels( 1 );
1814 0 : aFmt.SetSuffix( aDotStr );
1815 :
1816 : static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
1817 : {
1818 : // cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
1819 : 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1820 : };
1821 : #ifdef USE_MEASUREMENT
1822 : static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
1823 : {
1824 : 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1825 : };
1826 : const sal_uInt16* pArr = MEASURE_METRIC ==
1827 : SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1828 : ? aAbsSpace
1829 : : aAbsSpaceInch;
1830 : #else
1831 0 : const sal_uInt16* pArr = aAbsSpace;
1832 : #endif
1833 :
1834 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1835 : {
1836 0 : aFmt.SetFirstLineOffset( - (*pArr) );
1837 : }
1838 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1839 : {
1840 0 : aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
1841 0 : aFmt.SetFirstLineIndent( - (*pArr) );
1842 : }
1843 :
1844 0 : for( n = 0; n < MAXLEVEL; ++n, ++pArr )
1845 : {
1846 0 : aFmt.SetStart( n + 1 );
1847 :
1848 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1849 : {
1850 0 : aFmt.SetAbsLSpace( *pArr );
1851 : }
1852 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1853 : {
1854 0 : aFmt.SetListtabPos( *pArr );
1855 0 : aFmt.SetIndentAt( *pArr );
1856 : }
1857 :
1858 0 : pNewRule->Set( n, aFmt );
1859 0 : }
1860 : }
1861 0 : break;
1862 : case RES_POOLNUMRULE_NUM5:
1863 : {
1864 : // [ First, LSpace ]
1865 : static const sal_uInt16 aAbsSpace0to2[] =
1866 : {
1867 : 227, 227, // 0.40, 0.40,
1868 : 369, 624, // 0.65, 1.10,
1869 : 255, 879 // 0.45, 1.55
1870 : };
1871 :
1872 : #ifdef USE_MEASUREMENT
1873 : static const sal_uInt16 aAbsSpaceInch0to2[] =
1874 : {
1875 : 308, 308,
1876 : 501, 847,
1877 : 347, 1194
1878 : };
1879 : const sal_uInt16* pArr0to2 = MEASURE_METRIC ==
1880 : SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1881 : ? aAbsSpace0to2
1882 : : aAbsSpaceInch0to2;
1883 : #else
1884 0 : const sal_uInt16* pArr0to2 = aAbsSpace0to2;
1885 : #endif
1886 0 : SwNumFmt aFmt;
1887 :
1888 0 : aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1889 0 : aFmt.SetNumberingType(SVX_NUM_ARABIC);
1890 0 : aFmt.SetStart( 1 );
1891 0 : aFmt.SetIncludeUpperLevels( 1 );
1892 0 : aFmt.SetSuffix( aDotStr );
1893 :
1894 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1895 : {
1896 0 : aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1897 : }
1898 :
1899 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1900 : {
1901 0 : aFmt.SetFirstLineOffset( -pArr0to2[0] ); // == 0.40 cm
1902 0 : aFmt.SetAbsLSpace( pArr0to2[1] ); // == 0.40 cm
1903 : }
1904 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1905 : {
1906 0 : aFmt.SetFirstLineIndent( -pArr0to2[0] );
1907 0 : aFmt.SetListtabPos( pArr0to2[1] );
1908 0 : aFmt.SetIndentAt( pArr0to2[1] );
1909 : }
1910 :
1911 0 : aFmt.SetCharFmt( pNumCFmt );
1912 0 : pNewRule->Set( 0, aFmt );
1913 :
1914 0 : aFmt.SetIncludeUpperLevels( 2 );
1915 0 : aFmt.SetStart( 2 );
1916 :
1917 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1918 : {
1919 0 : aFmt.SetFirstLineOffset( -pArr0to2[2] ); // == 0.65 cm
1920 0 : aFmt.SetAbsLSpace( pArr0to2[3] ); // == 1.10 cm
1921 : }
1922 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1923 : {
1924 0 : aFmt.SetFirstLineIndent( -pArr0to2[2] );
1925 0 : aFmt.SetListtabPos( pArr0to2[3] );
1926 0 : aFmt.SetIndentAt( pArr0to2[3] );
1927 : }
1928 :
1929 0 : pNewRule->Set( 1, aFmt );
1930 :
1931 0 : aFmt.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER);
1932 0 : aFmt.SetSuffix(rtl::OUString(static_cast<sal_Unicode>(')')));
1933 0 : aFmt.SetIncludeUpperLevels( 1 );
1934 0 : aFmt.SetStart( 3 );
1935 :
1936 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1937 : {
1938 0 : aFmt.SetFirstLineOffset( - pArr0to2[4] ); // == 0.45cm
1939 0 : aFmt.SetAbsLSpace( pArr0to2[5] ); // == 1.55 cm
1940 : }
1941 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1942 : {
1943 0 : aFmt.SetFirstLineIndent( -pArr0to2[4] );
1944 0 : aFmt.SetListtabPos( pArr0to2[5] );
1945 0 : aFmt.SetIndentAt( pArr0to2[5] );
1946 : }
1947 :
1948 0 : pNewRule->Set( 2, aFmt );
1949 :
1950 :
1951 0 : aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
1952 0 : aFmt.SetCharFmt( pBullCFmt );
1953 0 : aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
1954 0 : aFmt.SetBulletChar( cBulletChar );
1955 0 : sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4,
1956 0 : nOffs2 = GetMetricVal( CM_1 ) * 2;
1957 :
1958 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1959 : {
1960 0 : aFmt.SetFirstLineOffset( - nOffs );
1961 : }
1962 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1963 : {
1964 0 : aFmt.SetFirstLineIndent( - nOffs );
1965 : }
1966 :
1967 0 : aFmt.SetSuffix( aEmptyStr );
1968 0 : for( n = 3; n < MAXLEVEL; ++n )
1969 : {
1970 0 : aFmt.SetStart( n+1 );
1971 :
1972 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1973 : {
1974 0 : aFmt.SetAbsLSpace( nOffs2 + ((n-3) * nOffs) );
1975 : }
1976 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1977 : {
1978 0 : aFmt.SetListtabPos( nOffs2 + ((n-3) * nOffs) );
1979 0 : aFmt.SetIndentAt( nOffs2 + ((n-3) * nOffs) );
1980 : }
1981 :
1982 0 : pNewRule->Set( n, aFmt );
1983 0 : }
1984 : }
1985 0 : break;
1986 :
1987 : case RES_POOLNUMRULE_BUL1:
1988 : {
1989 2 : SwNumFmt aFmt;
1990 :
1991 2 : aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1992 2 : aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
1993 2 : aFmt.SetCharFmt( pBullCFmt );
1994 2 : aFmt.SetStart( 1 );
1995 2 : aFmt.SetIncludeUpperLevels( 1 );
1996 2 : aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
1997 2 : aFmt.SetBulletChar( cBulletChar );
1998 :
1999 : static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2000 : {
2001 : // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2002 : 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2003 : };
2004 : #ifdef USE_MEASUREMENT
2005 : static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2006 : {
2007 : 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2008 : };
2009 : const sal_uInt16* pArr = MEASURE_METRIC ==
2010 : SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2011 : ? aAbsSpace
2012 : : aAbsSpaceInch;
2013 : #else
2014 2 : const sal_uInt16* pArr = aAbsSpace;
2015 : #endif
2016 :
2017 2 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2018 : {
2019 0 : aFmt.SetFirstLineOffset( - (*pArr) );
2020 : }
2021 2 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2022 : {
2023 2 : aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2024 2 : aFmt.SetFirstLineIndent( - (*pArr) );
2025 : }
2026 :
2027 22 : for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2028 : {
2029 20 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2030 : {
2031 0 : aFmt.SetAbsLSpace( *pArr );
2032 : }
2033 20 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2034 : {
2035 20 : aFmt.SetListtabPos( *pArr );
2036 20 : aFmt.SetIndentAt( *pArr );
2037 : }
2038 :
2039 20 : pNewRule->Set( n, aFmt );
2040 2 : }
2041 : }
2042 2 : break;
2043 : case RES_POOLNUMRULE_BUL2:
2044 : {
2045 0 : SwNumFmt aFmt;
2046 :
2047 0 : aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2048 0 : aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2049 0 : aFmt.SetCharFmt( pBullCFmt );
2050 0 : aFmt.SetStart( 1 );
2051 0 : aFmt.SetIncludeUpperLevels( 1 );
2052 0 : aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2053 0 : aFmt.SetBulletChar( 0x2013 );
2054 :
2055 : static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2056 : {
2057 : // cm: 0,3 0,6 0,9 1,2 1,5 1,8 2,1 2,4 2,7 3,0
2058 : 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2059 : };
2060 : #ifdef USE_MEASUREMENT
2061 : static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2062 : {
2063 : 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2064 : };
2065 : const sal_uInt16* pArr = MEASURE_METRIC ==
2066 : SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2067 : ? aAbsSpace
2068 : : aAbsSpaceInch;
2069 : #else
2070 0 : const sal_uInt16* pArr = aAbsSpace;
2071 : #endif
2072 :
2073 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2074 : {
2075 0 : aFmt.SetFirstLineOffset( - (*pArr) );
2076 : }
2077 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2078 : {
2079 0 : aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2080 0 : aFmt.SetFirstLineIndent( - (*pArr) );
2081 : }
2082 :
2083 0 : for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2084 : {
2085 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2086 : {
2087 0 : aFmt.SetAbsLSpace( *pArr );
2088 : }
2089 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2090 : {
2091 0 : aFmt.SetListtabPos( *pArr );
2092 0 : aFmt.SetIndentAt( *pArr );
2093 : }
2094 :
2095 0 : pNewRule->Set( n, aFmt );
2096 0 : }
2097 : }
2098 0 : break;
2099 : case RES_POOLNUMRULE_BUL3:
2100 : {
2101 0 : SwNumFmt aFmt;
2102 :
2103 0 : aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2104 :
2105 0 : aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2106 0 : aFmt.SetCharFmt( pBullCFmt );
2107 0 : aFmt.SetStart( 1 );
2108 0 : aFmt.SetIncludeUpperLevels( 1 );
2109 0 : aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2110 :
2111 0 : sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4;
2112 :
2113 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2114 : {
2115 0 : aFmt.SetFirstLineOffset( - nOffs );
2116 : }
2117 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2118 : {
2119 0 : aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2120 0 : aFmt.SetFirstLineIndent( - nOffs );
2121 : }
2122 :
2123 0 : for( n = 0; n < MAXLEVEL; ++n )
2124 : {
2125 0 : aFmt.SetBulletChar( ( n & 1 ? 0x25a1 : 0x2611 ) );
2126 :
2127 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2128 : {
2129 0 : aFmt.SetAbsLSpace( ((n & 1) +1) * nOffs );
2130 : }
2131 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2132 : {
2133 0 : aFmt.SetListtabPos( ((n & 1) +1) * nOffs );
2134 0 : aFmt.SetIndentAt( ((n & 1) +1) * nOffs );
2135 : }
2136 :
2137 0 : pNewRule->Set( n, aFmt );
2138 0 : }
2139 : }
2140 0 : break;
2141 : case RES_POOLNUMRULE_BUL4:
2142 : {
2143 0 : SwNumFmt aFmt;
2144 :
2145 0 : aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2146 0 : aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2147 0 : aFmt.SetCharFmt( pBullCFmt );
2148 0 : aFmt.SetStart( 1 );
2149 0 : aFmt.SetIncludeUpperLevels( 1 );
2150 0 : aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2151 :
2152 : static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2153 : {
2154 : // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2155 : 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2156 : };
2157 : #ifdef USE_MEASUREMENT
2158 : static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2159 : {
2160 : 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2161 : };
2162 : const sal_uInt16* pArr = MEASURE_METRIC ==
2163 : SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2164 : ? aAbsSpace
2165 : : aAbsSpaceInch;
2166 : #else
2167 0 : const sal_uInt16* pArr = aAbsSpace;
2168 : #endif
2169 :
2170 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2171 : {
2172 0 : aFmt.SetFirstLineOffset( - (*pArr) );
2173 : }
2174 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2175 : {
2176 0 : aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
2177 0 : aFmt.SetFirstLineIndent( - (*pArr) );
2178 : }
2179 :
2180 0 : for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2181 : {
2182 0 : switch( n )
2183 : {
2184 0 : case 0: aFmt.SetBulletChar( 0x27a2 ); break;
2185 0 : case 1: aFmt.SetBulletChar( 0xE006 ); break;
2186 0 : default: aFmt.SetBulletChar( 0xE004 ); break;
2187 : }
2188 :
2189 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2190 : {
2191 0 : aFmt.SetAbsLSpace( *pArr );
2192 : }
2193 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2194 : {
2195 0 : aFmt.SetListtabPos( *pArr );
2196 0 : aFmt.SetIndentAt( *pArr );
2197 : }
2198 :
2199 0 : pNewRule->Set( n, aFmt );
2200 0 : }
2201 : }
2202 0 : break;
2203 : case RES_POOLNUMRULE_BUL5:
2204 : {
2205 0 : SwNumFmt aFmt;
2206 :
2207 0 : aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2208 0 : aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2209 0 : aFmt.SetCharFmt( pBullCFmt );
2210 0 : aFmt.SetStart( 1 );
2211 0 : aFmt.SetIncludeUpperLevels( 1 );
2212 0 : aFmt.SetBulletChar( 0x2717 );
2213 0 : aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2214 :
2215 : static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2216 : {
2217 : // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2218 : 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2219 : };
2220 : #ifdef USE_MEASUREMENT
2221 : static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2222 : {
2223 : 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2224 : };
2225 : const sal_uInt16* pArr = MEASURE_METRIC ==
2226 : SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2227 : ? aAbsSpace
2228 : : aAbsSpaceInch;
2229 : #else
2230 0 : const sal_uInt16* pArr = aAbsSpace;
2231 : #endif
2232 :
2233 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2234 : {
2235 0 : aFmt.SetFirstLineOffset( - (*pArr) );
2236 : }
2237 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2238 : {
2239 0 : aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2240 0 : aFmt.SetFirstLineIndent( - (*pArr) );
2241 : }
2242 :
2243 0 : for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2244 : {
2245 0 : if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2246 : {
2247 0 : aFmt.SetAbsLSpace( *pArr );
2248 : }
2249 0 : else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2250 : {
2251 0 : aFmt.SetListtabPos( *pArr );
2252 0 : aFmt.SetIndentAt( *pArr );
2253 : }
2254 :
2255 0 : pNewRule->Set( n, aFmt );
2256 0 : }
2257 : }
2258 0 : break;
2259 : }
2260 :
2261 5 : return pNewRule;
2262 : }
2263 :
2264 :
2265 :
2266 : // Check if this AutoCollection is already/still in use in this Document
2267 1160 : bool SwDoc::IsPoolPageDescUsed( sal_uInt16 nId ) const
2268 : {
2269 : OSL_ENSURE( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
2270 : "Wrong AutoFormat Id" );
2271 1160 : SwPageDesc *pNewPgDsc = 0;
2272 1160 : bool bFnd = false;
2273 4288 : for( sal_uInt16 n = 0; !bFnd && n < aPageDescs.size(); ++n )
2274 : {
2275 3128 : pNewPgDsc = aPageDescs[ n ];
2276 3128 : if( nId == pNewPgDsc->GetPoolFmtId() )
2277 330 : bFnd = true;
2278 : }
2279 :
2280 : // Not found or no dependencies?
2281 1160 : if( !bFnd || !pNewPgDsc->GetDepends() ) // ??????
2282 1043 : return false;
2283 :
2284 : // Check if we have dependent ContentNodes in the Nodes array
2285 : // (also indirect ones for derived Formats)
2286 117 : SwAutoFmtGetDocNode aGetHt( &GetNodes() );
2287 117 : return !pNewPgDsc->GetInfo( aGetHt );
2288 : }
2289 :
2290 : // See if the Paragraph/Character/Frame/Page style is in use
2291 10336 : bool SwDoc::IsUsed( const SwModify& rModify ) const
2292 : {
2293 : // Check if we have dependent ContentNodes in the Nodes array
2294 : // (also indirect ones for derived Formats)
2295 10336 : SwAutoFmtGetDocNode aGetHt( &GetNodes() );
2296 10336 : return !rModify.GetInfo( aGetHt );
2297 : }
2298 :
2299 : // See if the NumRule is used
2300 77 : bool SwDoc::IsUsed( const SwNumRule& rRule ) const
2301 : {
2302 77 : bool bUsed = rRule.GetTxtNodeListSize() > 0 ||
2303 77 : rRule.GetParagraphStyleListSize() > 0;
2304 :
2305 77 : return bUsed;
2306 : }
2307 :
2308 : // Look for the style name's position. If it doesn't exist,
2309 : // insert a anew
2310 0 : sal_uInt16 SwDoc::SetDocPattern( const String& rPatternName )
2311 : {
2312 : OSL_ENSURE( rPatternName.Len(), "no Document style name" );
2313 :
2314 0 : size_t nNewPos = aPatternNms.size();
2315 0 : for(size_t n = 0; n < aPatternNms.size(); ++n)
2316 0 : if( boost::is_null(aPatternNms.begin() + n) )
2317 : {
2318 0 : if( nNewPos == aPatternNms.size() )
2319 0 : nNewPos = n;
2320 : }
2321 0 : else if( rPatternName == aPatternNms[n] )
2322 0 : return n;
2323 :
2324 0 : if( nNewPos < aPatternNms.size() )
2325 0 : aPatternNms.erase(aPatternNms.begin() + nNewPos); // Free space again
2326 :
2327 0 : aPatternNms.insert(aPatternNms.begin() + nNewPos, new String(rPatternName));
2328 0 : SetModified();
2329 0 : return nNewPos;
2330 : }
2331 :
2332 3952 : sal_uInt16 GetPoolParent( sal_uInt16 nId )
2333 : {
2334 3952 : sal_uInt16 nRet = USHRT_MAX;
2335 3952 : if( POOLGRP_NOCOLLID & nId ) // 1 == Formats / 0 == Collections
2336 : {
2337 0 : switch( ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID ) & nId )
2338 : {
2339 : case POOLGRP_CHARFMT:
2340 : case POOLGRP_FRAMEFMT:
2341 0 : nRet = 0; // derived from the default
2342 0 : break;
2343 : case POOLGRP_PAGEDESC:
2344 : case POOLGRP_NUMRULE:
2345 0 : break; // there are no derivations
2346 : }
2347 : }
2348 : else
2349 : {
2350 3952 : switch( COLL_GET_RANGE_BITS & nId )
2351 : {
2352 : case COLL_TEXT_BITS:
2353 1918 : switch( nId )
2354 : {
2355 : case RES_POOLCOLL_STANDARD:
2356 574 : nRet = 0; break;
2357 : case RES_POOLCOLL_TEXT_IDENT:
2358 : case RES_POOLCOLL_TEXT_NEGIDENT:
2359 : case RES_POOLCOLL_TEXT_MOVE:
2360 : case RES_POOLCOLL_CONFRONTATION:
2361 : case RES_POOLCOLL_MARGINAL:
2362 18 : nRet = RES_POOLCOLL_TEXT; break;
2363 :
2364 : case RES_POOLCOLL_TEXT:
2365 : case RES_POOLCOLL_GREETING:
2366 : case RES_POOLCOLL_SIGNATURE:
2367 : case RES_POOLCOLL_HEADLINE_BASE:
2368 1108 : nRet = RES_POOLCOLL_STANDARD; break;
2369 :
2370 : case RES_POOLCOLL_HEADLINE1:
2371 : case RES_POOLCOLL_HEADLINE2:
2372 : case RES_POOLCOLL_HEADLINE3:
2373 : case RES_POOLCOLL_HEADLINE4:
2374 : case RES_POOLCOLL_HEADLINE5:
2375 : case RES_POOLCOLL_HEADLINE6:
2376 : case RES_POOLCOLL_HEADLINE7:
2377 : case RES_POOLCOLL_HEADLINE8:
2378 : case RES_POOLCOLL_HEADLINE9:
2379 : case RES_POOLCOLL_HEADLINE10:
2380 218 : nRet = RES_POOLCOLL_HEADLINE_BASE; break;
2381 : }
2382 1918 : break;
2383 :
2384 : case COLL_LISTS_BITS:
2385 570 : switch( nId )
2386 : {
2387 : case RES_POOLCOLL_NUMBUL_BASE:
2388 554 : nRet = RES_POOLCOLL_TEXT; break;
2389 :
2390 : default:
2391 16 : nRet = RES_POOLCOLL_NUMBUL_BASE; break;
2392 : }
2393 570 : break;
2394 :
2395 : case COLL_EXTRA_BITS:
2396 812 : switch( nId )
2397 : {
2398 : case RES_POOLCOLL_FRAME:
2399 42 : nRet = RES_POOLCOLL_TEXT; break;
2400 :
2401 : case RES_POOLCOLL_TABLE_HDLN:
2402 32 : nRet = RES_POOLCOLL_TABLE; break;
2403 :
2404 : case RES_POOLCOLL_TABLE:
2405 : case RES_POOLCOLL_FOOTNOTE:
2406 : case RES_POOLCOLL_ENDNOTE:
2407 : case RES_POOLCOLL_JAKETADRESS:
2408 : case RES_POOLCOLL_SENDADRESS:
2409 : case RES_POOLCOLL_HEADER:
2410 : case RES_POOLCOLL_HEADERL:
2411 : case RES_POOLCOLL_HEADERR:
2412 : case RES_POOLCOLL_FOOTER:
2413 : case RES_POOLCOLL_FOOTERL:
2414 : case RES_POOLCOLL_FOOTERR:
2415 : case RES_POOLCOLL_LABEL:
2416 738 : nRet = RES_POOLCOLL_STANDARD; break;
2417 :
2418 : case RES_POOLCOLL_LABEL_ABB:
2419 : case RES_POOLCOLL_LABEL_TABLE:
2420 : case RES_POOLCOLL_LABEL_FRAME:
2421 : case RES_POOLCOLL_LABEL_DRAWING:
2422 0 : nRet = RES_POOLCOLL_LABEL; break;
2423 : }
2424 812 : break;
2425 :
2426 : case COLL_REGISTER_BITS:
2427 624 : switch( nId )
2428 : {
2429 : case RES_POOLCOLL_REGISTER_BASE:
2430 554 : nRet = RES_POOLCOLL_STANDARD; break;
2431 :
2432 : case RES_POOLCOLL_TOX_USERH:
2433 : case RES_POOLCOLL_TOX_CNTNTH:
2434 : case RES_POOLCOLL_TOX_IDXH:
2435 : case RES_POOLCOLL_TOX_ILLUSH:
2436 : case RES_POOLCOLL_TOX_OBJECTH:
2437 : case RES_POOLCOLL_TOX_TABLESH:
2438 : case RES_POOLCOLL_TOX_AUTHORITIESH:
2439 4 : nRet = RES_POOLCOLL_HEADLINE_BASE; break;
2440 :
2441 : default:
2442 66 : nRet = RES_POOLCOLL_REGISTER_BASE; break;
2443 : }
2444 624 : break;
2445 :
2446 : case COLL_DOC_BITS:
2447 22 : nRet = RES_POOLCOLL_HEADLINE_BASE;
2448 22 : break;
2449 :
2450 : case COLL_HTML_BITS:
2451 6 : nRet = RES_POOLCOLL_STANDARD;
2452 6 : break;
2453 : }
2454 : }
2455 :
2456 3952 : return nRet;
2457 : }
2458 :
2459 86 : void SwDoc::RemoveAllFmtLanguageDependencies()
2460 : {
2461 : /* Restore the language independ pool defaults and styles. */
2462 86 : GetAttrPool().ResetPoolDefaultItem( RES_PARATR_ADJUST );
2463 :
2464 86 : SwTxtFmtColl * pTxtFmtColl = GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
2465 :
2466 86 : pTxtFmtColl->ResetFmtAttr( RES_PARATR_ADJUST );
2467 : /* koreans do not like SvxScriptItem(TRUE) */
2468 86 : pTxtFmtColl->ResetFmtAttr( RES_PARATR_SCRIPTSPACE );
2469 :
2470 86 : SvxFrameDirectionItem aFrameDir( FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR );
2471 :
2472 86 : sal_uInt16 nCount = GetPageDescCnt();
2473 172 : for( sal_uInt16 i=0; i<nCount; ++i )
2474 : {
2475 86 : SwPageDesc& rDesc = GetPageDesc( i );
2476 86 : rDesc.GetMaster().SetFmtAttr( aFrameDir );
2477 86 : rDesc.GetLeft().SetFmtAttr( aFrameDir );
2478 : }
2479 :
2480 : // #i18732# - restore static pool default for item
2481 : // RES_FOLLOW_TEXT_FLOW.
2482 86 : GetAttrPool().ResetPoolDefaultItem( RES_FOLLOW_TEXT_FLOW );
2483 :
2484 : //#i16874# AutoKerning as default for new documents
2485 86 : GetAttrPool().ResetPoolDefaultItem( RES_CHRATR_AUTOKERN );
2486 86 : }
2487 :
2488 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|