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