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 <com/sun/star/lang/DisposedException.hpp>
31 : : #include <editeng/eeitem.hxx>
32 : : #include <editeng/fhgtitem.hxx>
33 : : #include <editeng/colritem.hxx>
34 : : #include <editeng/cntritem.hxx>
35 : : #include <editeng/shdditem.hxx>
36 : : #include <editeng/crsditem.hxx>
37 : : #include <editeng/udlnitem.hxx>
38 : : #include <editeng/wghtitem.hxx>
39 : : #include <editeng/postitem.hxx>
40 : : #include <editeng/fontitem.hxx>
41 : : #include <svl/poolitem.hxx>
42 : : #include <svx/xfillit0.hxx>
43 : : #include <svx/xlineit0.hxx>
44 : : #include <editeng/ulspitem.hxx>
45 : : #include <editeng/numitem.hxx>
46 : : #include <editeng/brshitem.hxx>
47 : : #include <editeng/editeng.hxx>
48 : : #include <svl/smplhint.hxx>
49 : : #include <editeng/langitem.hxx>
50 : : #include <editeng/charreliefitem.hxx>
51 : : #include <editeng/emphitem.hxx>
52 : : #include <svx/sdr/table/tabledesign.hxx>
53 : : #include <editeng/akrnitem.hxx>
54 : :
55 : : #include <svx/svdattr.hxx>
56 : : #include "eetext.hxx"
57 : : #include <svx/xtable.hxx> // fuer RGB_Color
58 : : #include <editeng/bulitem.hxx>
59 : : #include <editeng/lrspitem.hxx>
60 : : #include <editeng/adjitem.hxx>
61 : : #include <svl/itempool.hxx>
62 : :
63 : : #include "stlpool.hxx"
64 : : #include "sdresid.hxx"
65 : : #include "stlsheet.hxx"
66 : : #include "glob.hrc"
67 : : #include "glob.hxx"
68 : : #include "drawdoc.hxx"
69 : : #include "sdmod.hxx"
70 : : #include "sdpage.hxx"
71 : : #include "helpids.h"
72 : : #include <svl/itemset.hxx>
73 : : #include "app.hrc"
74 : :
75 : : using ::rtl::OUString;
76 : : using namespace ::com::sun::star::uno;
77 : : using namespace ::com::sun::star::lang;
78 : : using namespace ::com::sun::star::style;
79 : : using namespace ::com::sun::star::container;
80 : :
81 : : // ----------------------------------------------------------
82 : :
83 : 178 : SdStyleSheetPool::SdStyleSheetPool(SfxItemPool const& _rPool, SdDrawDocument* pDocument)
84 : : : SdStyleSheetPoolBase( _rPool )
85 : : , mpActualStyleSheet(NULL)
86 [ + - ][ + - ]: 178 : , mpDoc(pDocument)
87 : : {
88 [ + - ]: 178 : if( mpDoc )
89 : : {
90 : 178 : rtl::Reference< SfxStyleSheetPool > xPool( this );
91 : :
92 : : // create graphics family
93 [ + - ][ + - ]: 178 : mxGraphicFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_GRAPHICS );
94 [ + - ][ + - ]: 178 : mxCellFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_CELL );
95 : :
96 [ + - ][ + - ]: 178 : mxTableFamily = sdr::table::CreateTableDesignFamily();
97 [ + - ]: 178 : Reference< XNamed > xNamed( mxTableFamily, UNO_QUERY );
98 [ + - ]: 178 : if( xNamed.is() )
99 [ + - ][ + - ]: 178 : msTableFamilyName = xNamed->getName();
100 : :
101 : : // create presentation families, one for each master page
102 [ + - ]: 178 : const sal_uInt16 nCount = mpDoc->GetMasterSdPageCount(PK_STANDARD);
103 [ - + ]: 178 : for( sal_uInt16 nPage = 0; nPage < nCount; ++nPage )
104 [ # # ][ # # ]: 178 : AddStyleFamily( mpDoc->GetMasterSdPage(nPage,PK_STANDARD) );
105 : :
106 : : }
107 : 178 : }
108 : :
109 : : // ----------------------------------------------------------
110 : :
111 [ + - ]: 175 : SdStyleSheetPool::~SdStyleSheetPool()
112 : : {
113 : : DBG_ASSERT( mpDoc == NULL, "sd::SdStyleSheetPool::~SdStyleSheetPool(), dispose me first!" );
114 [ - + ]: 350 : }
115 : :
116 : : // ----------------------------------------------------------
117 : :
118 : 12201 : SfxStyleSheetBase* SdStyleSheetPool::Create(const String& rName, SfxStyleFamily eFamily, sal_uInt16 _nMask )
119 : : {
120 [ + - ]: 12201 : return new SdStyleSheet(rName, *this, eFamily, _nMask);
121 : : }
122 : :
123 : : // ----------------------------------------------------------
124 : :
125 : 0 : SfxStyleSheetBase* SdStyleSheetPool::Create(const SdStyleSheet& rStyle)
126 : : {
127 [ # # ]: 0 : return new SdStyleSheet( rStyle );
128 : : }
129 : :
130 : : // ----------------------------------------------------------
131 : :
132 : 0 : SfxStyleSheetBase* SdStyleSheetPool::GetTitleSheet(const String& rLayoutName)
133 : : {
134 [ # # ]: 0 : String aName(rLayoutName);
135 [ # # ]: 0 : aName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
136 [ # # ][ # # ]: 0 : aName += String(SdResId(STR_LAYOUT_TITLE));
[ # # ][ # # ]
137 [ # # ]: 0 : SfxStyleSheetBase* pResult = Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
138 [ # # ]: 0 : return pResult;
139 : : }
140 : :
141 : : /*************************************************************************
142 : : |*
143 : : |* eine Liste der Gliederungstextvorlagen fuer ein Praesentationlayout
144 : : |* erstellen, der Aufrufer muss die Liste wieder loeschen
145 : : |*
146 : : \************************************************************************/
147 : :
148 : 47 : void SdStyleSheetPool::CreateOutlineSheetList (const String& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles)
149 : : {
150 [ + - ]: 47 : String aName(rLayoutName);
151 [ + - ]: 47 : aName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
152 [ + - ][ + - ]: 47 : aName += String(SdResId(STR_LAYOUT_OUTLINE));
[ + - ][ + - ]
153 : :
154 [ + + ]: 470 : for (sal_uInt16 nSheet = 1; nSheet < 10; nSheet++)
155 : : {
156 [ + - ]: 423 : String aFullName(aName);
157 [ + - ]: 423 : aFullName.Append( sal_Unicode( ' ' ));
158 [ + - ][ + - ]: 423 : aFullName.Append( String::CreateFromInt32( (sal_Int32)nSheet ));
[ + - ]
159 [ + - ]: 423 : SfxStyleSheetBase* pSheet = Find(aFullName, SD_STYLE_FAMILY_MASTERPAGE);
160 : :
161 [ + - ]: 423 : if (pSheet)
162 [ + - ]: 423 : rOutlineStyles.push_back(pSheet);
163 [ + - ][ + - ]: 470 : }
164 : 47 : }
165 : :
166 : : /*************************************************************************
167 : : |*
168 : : |* StyleSheets mit Defaultweren fuer das genannte Praesentationslayout erzeugen
169 : : |*
170 : : \************************************************************************/
171 : :
172 : 165 : void SdStyleSheetPool::CreateLayoutStyleSheets(const String& rLayoutName, sal_Bool bCheck /*= sal_False*/ )
173 : : {
174 : 165 : const sal_uInt16 nUsedMask = SFXSTYLEBIT_ALL & ~SFXSTYLEBIT_USERDEF;
175 : :
176 : : (void)bCheck;
177 : 165 : sal_Bool bCreated = sal_False;
178 : :
179 : 165 : SfxStyleSheetBase* pSheet = NULL;
180 : :
181 [ + - ]: 165 : String aPrefix(rLayoutName);
182 [ + - ]: 165 : String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
183 [ + - ]: 165 : aPrefix.Insert(aSep);
184 : :
185 [ + - ][ + - ]: 165 : Font aLatinFont, aCJKFont, aCTLFont;
[ + - ]
186 : :
187 [ + - ]: 165 : mpDoc->getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
188 : :
189 : : // Font fuer Titel und Gliederung
190 [ + - ][ + - ]: 165 : SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
191 [ + - ][ + - ]: 330 : aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
[ + - ][ + - ]
192 : :
193 [ + - ][ + - ]: 165 : SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
194 [ + - ][ + - ]: 330 : aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
[ + - ][ + - ]
195 : :
196 [ + - ][ + - ]: 165 : SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
197 [ + - ][ + - ]: 330 : aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
[ + - ][ + - ]
198 : :
199 [ + - ]: 165 : Font aBulletFont( GetBulletFont() );
200 : :
201 : : /**************************************************************************
202 : : * Gliederungsebenen
203 : : **************************************************************************/
204 [ + - ][ + - ]: 165 : String aName(SdResId(STR_LAYOUT_OUTLINE));
205 [ + - ]: 165 : String aHelpFile;
206 : :
207 : 165 : SfxStyleSheetBase* pParent = NULL;
208 [ + - ]: 165 : SvxLRSpaceItem aSvxLRSpaceItem( EE_PARA_LRSPACE );
209 [ + - ]: 165 : SvxULSpaceItem aSvxULSpaceItem( EE_PARA_ULSPACE );
210 : : sal_uInt16 nLevel;
211 : :
212 [ + + ]: 1650 : for( nLevel = 1; nLevel < 10; nLevel++)
213 : : {
214 [ + - ]: 1485 : String aLevelName(aName);
215 [ + - ]: 1485 : aLevelName.Append( sal_Unicode( ' ' ));
216 [ + - ][ + - ]: 1485 : aLevelName.Append( String::CreateFromInt32( sal_Int32( nLevel )));
[ + - ]
217 : :
218 [ + - ]: 1485 : aLevelName.Insert(aPrefix, 0);
219 : :
220 [ + - ][ + - ]: 1485 : if (!Find(aLevelName, SD_STYLE_FAMILY_MASTERPAGE))
221 : : {
222 : 1485 : bCreated = sal_True;
223 [ + - ]: 1485 : pSheet = &Make(aLevelName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
224 [ + - ]: 1485 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
225 : :
226 [ + - ][ + - ]: 1485 : pSheet->SetParent( String() );
[ + - ]
227 : :
228 : : // Attributierung fuer Level 1, die anderen Ebenen "erben"
229 [ + + ]: 1485 : if (nLevel == 1)
230 : : {
231 [ + - ]: 165 : SfxItemSet& rSet = pSheet->GetItemSet();
232 : :
233 [ + - ]: 165 : rSet.Put(aSvxFontItem);
234 [ + - ]: 165 : rSet.Put(aSvxFontItemCJK);
235 [ + - ]: 165 : rSet.Put(aSvxFontItemCTL);
236 [ + - ][ + - ]: 165 : rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
[ + - ]
237 [ + - ][ + - ]: 165 : rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
[ + - ]
238 [ + - ][ + - ]: 165 : rSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
[ + - ]
239 [ + - ][ + - ]: 165 : rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
[ + - ]
240 [ + - ][ + - ]: 165 : rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
[ + - ]
241 [ + - ][ + - ]: 165 : rSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
[ + - ]
242 [ + - ][ + - ]: 165 : rSet.Put( SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
[ + - ]
243 [ + - ][ + - ]: 165 : rSet.Put( SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ) );
[ + - ]
244 [ + - ][ + - ]: 165 : rSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
[ + - ]
245 [ + - ][ + - ]: 165 : rSet.Put( SvxShadowedItem(sal_False, EE_CHAR_SHADOW ) );
[ + - ]
246 [ + - ][ + - ]: 165 : rSet.Put( SvxContourItem(sal_False, EE_CHAR_OUTLINE ) );
[ + - ]
247 [ + - ][ + - ]: 165 : rSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
[ + - ]
248 [ + - ][ + - ]: 165 : rSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) );
[ + - ]
249 [ + - ][ + - ]: 165 : rSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR) );
[ + - ]
250 [ + - ][ + - ]: 165 : rSet.Put( XLineStyleItem(XLINE_NONE) );
[ + - ]
251 [ + - ][ + - ]: 165 : rSet.Put( XFillStyleItem(XFILL_NONE) );
[ + - ]
252 [ + - ][ + - ]: 165 : rSet.Put( SdrTextFitToSizeTypeItem(SDRTEXTFIT_AUTOFIT) );
[ + - ]
253 [ + - ][ + - ]: 165 : rSet.Put( SdrTextAutoGrowHeightItem(sal_False) );
[ + - ]
254 : : // #i16874# enable kerning by default but only for new documents
255 [ + - ][ + - ]: 165 : rSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
[ + - ]
256 : :
257 [ + - ]: 165 : if( nLevel == 1 )
258 : : {
259 [ + - ]: 165 : Font f( GetBulletFont() );
260 [ + - ][ + - ]: 165 : PutNumBulletItem( pSheet, f );
261 : : }
262 : : }
263 : :
264 : 1485 : sal_uLong nFontSize = 20;
265 : 1485 : sal_uInt16 nLower = 100;
266 : :
267 [ + + + + : 1485 : switch (nLevel)
+ ]
268 : : {
269 : : case 1:
270 : : {
271 : 165 : nFontSize = 32;
272 : 165 : nLower = 500;
273 : : }
274 : 165 : break;
275 : :
276 : : case 2:
277 : : {
278 : 165 : nFontSize = 28;
279 : 165 : nLower = 400;
280 : : }
281 : 165 : break;
282 : :
283 : : case 3:
284 : : {
285 : 165 : nFontSize = 24;
286 : 165 : nLower = 300;
287 : : }
288 : 165 : break;
289 : :
290 : : case 4:
291 : : {
292 : 165 : nLower = 200;
293 : : }
294 : 165 : break;
295 : : }
296 : :
297 : : // FontSize
298 : 1485 : nFontSize = (sal_uInt16)((nFontSize * 2540L) / 72); // Pt --> 1/100 mm
299 [ + - ]: 1485 : SfxItemSet& rOutlineSet = pSheet->GetItemSet();
300 [ + - ][ + - ]: 1485 : rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT ) );
[ + - ]
301 [ + - ][ + - ]: 1485 : rOutlineSet.Put( SvxFontHeightItem( nFontSize, 100, EE_CHAR_FONTHEIGHT_CJK ) );
[ + - ]
302 [ + - ][ + - ]: 1485 : rOutlineSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( nFontSize ), 100, EE_CHAR_FONTHEIGHT_CTL ) );
[ + - ][ + - ]
303 : :
304 : : // Line distance (downwards). Stuff around here cleaned up in i35937
305 : 1485 : aSvxULSpaceItem.SetLower(nLower);
306 [ + - ][ + - ]: 1485 : pSheet->GetItemSet().Put(aSvxULSpaceItem);
307 : : }
308 [ + - ]: 1485 : }
309 : :
310 : : // if we created outline styles, we need to chain them
311 [ + - ]: 165 : if( bCreated )
312 : : {
313 : 165 : pParent = NULL;
314 [ + + ]: 1650 : for (nLevel = 1; nLevel < 10; nLevel++)
315 : : {
316 [ + - ]: 1485 : String aLevelName(aName);
317 [ + - ]: 1485 : aLevelName.Append( sal_Unicode( ' ' ));
318 [ + - ][ + - ]: 1485 : aLevelName.Append( String::CreateFromInt32( sal_Int32( nLevel )));
[ + - ]
319 : :
320 [ + - ]: 1485 : aLevelName.Insert(aPrefix, 0);
321 : :
322 [ + - ]: 1485 : pSheet = Find(aLevelName, SD_STYLE_FAMILY_MASTERPAGE);
323 : :
324 : : DBG_ASSERT( pSheet, "missing layout style!");
325 : :
326 [ + - ]: 1485 : if( pSheet )
327 : : {
328 [ + + ]: 1485 : if (pParent)
329 [ + - ][ + - ]: 1320 : pSheet->SetParent(pParent->GetName());
330 : 1485 : pParent = pSheet;
331 : : }
332 [ + - ]: 1485 : }
333 : : }
334 : :
335 : : /**************************************************************************
336 : : * Titel
337 : : **************************************************************************/
338 [ + - ][ + - ]: 165 : aName = String(SdResId(STR_LAYOUT_TITLE));
[ + - ][ + - ]
339 [ + - ]: 165 : aName.Insert(aPrefix, 0);
340 : :
341 [ + - ][ + - ]: 165 : if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
342 : : {
343 : 165 : bCreated = sal_True;
344 : :
345 [ + - ]: 165 : pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
346 [ + - ]: 165 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE );
347 [ + - ][ + - ]: 165 : pSheet->SetParent(String());
[ + - ]
348 [ + - ]: 165 : SfxItemSet& rTitleSet = pSheet->GetItemSet();
349 [ + - ][ + - ]: 165 : rTitleSet.Put(XLineStyleItem(XLINE_NONE));
[ + - ]
350 [ + - ][ + - ]: 165 : rTitleSet.Put(XFillStyleItem(XFILL_NONE));
[ + - ]
351 [ + - ]: 165 : rTitleSet.Put(aSvxFontItem);
352 [ + - ]: 165 : rTitleSet.Put(aSvxFontItemCJK);
353 [ + - ]: 165 : rTitleSet.Put(aSvxFontItemCTL);
354 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
[ + - ]
355 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
[ + - ]
356 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
[ + - ]
357 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
[ + - ]
358 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
[ + - ]
359 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
[ + - ]
360 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT ) ); // 44 pt
[ + - ]
361 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxFontHeightItem( 1552, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 44 pt
[ + - ]
362 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1552 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 44 pt
[ + - ][ + - ]
363 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ));
[ + - ]
364 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ));
[ + - ]
365 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
[ + - ]
366 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxShadowedItem(sal_False, EE_CHAR_SHADOW ));
[ + - ]
367 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxContourItem(sal_False, EE_CHAR_OUTLINE ));
[ + - ]
368 [ + - ][ + - ]: 165 : rTitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
[ + - ]
369 [ + - ][ + - ]: 165 : rTitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) );
[ + - ]
370 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ));
[ + - ]
371 [ + - ][ + - ]: 165 : rTitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
[ + - ]
372 [ + - ][ + - ]: 165 : rTitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
[ + - ]
373 : : // #i16874# enable kerning by default but only for new documents
374 [ + - ][ + - ]: 165 : rTitleSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
[ + - ]
375 : :
376 [ + - ]: 165 : aBulletFont.SetSize(Size(0,1552)); // 44 pt
377 [ + - ]: 165 : PutNumBulletItem( pSheet, aBulletFont );
378 : : }
379 : :
380 : : /**************************************************************************
381 : : * Untertitel
382 : : **************************************************************************/
383 [ + - ][ + - ]: 165 : aName = String(SdResId(STR_LAYOUT_SUBTITLE));
[ + - ][ + - ]
384 [ + - ]: 165 : aName.Insert(aPrefix, 0);
385 : :
386 [ + - ][ + - ]: 165 : if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
387 : : {
388 : 165 : bCreated = sal_True;
389 : :
390 [ + - ]: 165 : pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
391 [ + - ]: 165 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE );
392 [ + - ][ + - ]: 165 : pSheet->SetParent(String());
[ + - ]
393 [ + - ]: 165 : SfxItemSet& rSubtitleSet = pSheet->GetItemSet();
394 [ + - ][ + - ]: 165 : rSubtitleSet.Put(XLineStyleItem(XLINE_NONE));
[ + - ]
395 [ + - ][ + - ]: 165 : rSubtitleSet.Put(XFillStyleItem(XFILL_NONE));
[ + - ]
396 [ + - ]: 165 : rSubtitleSet.Put(aSvxFontItem);
397 [ + - ]: 165 : rSubtitleSet.Put(aSvxFontItemCJK);
398 [ + - ]: 165 : rSubtitleSet.Put(aSvxFontItemCTL);
399 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
[ + - ]
400 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
[ + - ]
401 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
[ + - ]
402 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
[ + - ]
403 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
[ + - ]
404 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
[ + - ]
405 [ + - ][ + - ]: 165 : rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT ) ); // 32 pt
[ + - ]
406 [ + - ][ + - ]: 165 : rSubtitleSet.Put( SvxFontHeightItem( 1129, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 32 pt
[ + - ]
407 [ + - ][ + - ]: 165 : rSubtitleSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 1129 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 32 pt
[ + - ][ + - ]
408 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ));
[ + - ]
409 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ));
[ + - ]
410 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
[ + - ]
411 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxShadowedItem(sal_False, EE_CHAR_SHADOW ));
[ + - ]
412 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxContourItem(sal_False, EE_CHAR_OUTLINE ));
[ + - ]
413 [ + - ][ + - ]: 165 : rSubtitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
[ + - ]
414 [ + - ][ + - ]: 165 : rSubtitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) );
[ + - ]
415 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ));
[ + - ]
416 [ + - ][ + - ]: 165 : rSubtitleSet.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
[ + - ]
417 [ + - ][ + - ]: 165 : rSubtitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
[ + - ]
418 : : // #i16874# enable kerning by default but only for new documents
419 [ + - ][ + - ]: 165 : rSubtitleSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
[ + - ]
420 [ + - ]: 165 : aSvxLRSpaceItem.SetTxtLeft(0);
421 [ + - ]: 165 : rSubtitleSet.Put(aSvxLRSpaceItem);
422 : :
423 [ + - ]: 165 : Font aTmpFont( GetBulletFont() );
424 [ + - ]: 165 : aTmpFont.SetSize(Size(0, 1129)); // 32 pt
425 [ + - ][ + - ]: 165 : PutNumBulletItem( pSheet, aTmpFont );
426 : : }
427 : :
428 : : /**************************************************************************
429 : : * Notizen
430 : : **************************************************************************/
431 [ + - ][ + - ]: 165 : aName = String(SdResId(STR_LAYOUT_NOTES));
[ + - ][ + - ]
432 [ + - ]: 165 : aName.Insert(aPrefix, 0);
433 : :
434 [ + - ][ + - ]: 165 : if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
435 : : {
436 : 165 : bCreated = sal_True;
437 : :
438 [ + - ]: 165 : pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
439 [ + - ]: 165 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES );
440 [ + - ][ + - ]: 165 : pSheet->SetParent(String());
[ + - ]
441 [ + - ]: 165 : SfxItemSet& rNotesSet = pSheet->GetItemSet();
442 [ + - ][ + - ]: 165 : rNotesSet.Put(XLineStyleItem(XLINE_NONE));
[ + - ]
443 [ + - ][ + - ]: 165 : rNotesSet.Put(XFillStyleItem(XFILL_NONE));
[ + - ]
444 [ + - ]: 165 : rNotesSet.Put(aSvxFontItem);
445 [ + - ]: 165 : rNotesSet.Put(aSvxFontItemCJK);
446 [ + - ]: 165 : rNotesSet.Put(aSvxFontItemCTL);
447 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
[ + - ]
448 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
[ + - ]
449 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
[ + - ]
450 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
[ + - ]
451 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
[ + - ]
452 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
[ + - ]
453 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT ) ); // 20 pt
[ + - ]
454 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxFontHeightItem( 705, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 20 pt
[ + - ]
455 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxFontHeightItem( SdDrawDocument::convertFontHeightToCTL( 705 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 20 pt
[ + - ][ + - ]
456 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
[ + - ]
457 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE ) );
[ + - ]
458 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
[ + - ]
459 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxShadowedItem(sal_False, EE_CHAR_SHADOW ) );
[ + - ]
460 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxContourItem(sal_False, EE_CHAR_OUTLINE ) );
[ + - ]
461 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) );
[ + - ]
462 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) );
[ + - ]
463 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ) );
[ + - ]
464 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxLRSpaceItem( 0, 0, 600, -600, EE_PARA_LRSPACE ) );
[ + - ]
465 : : // #i16874# enable kerning by default but only for new documents
466 [ + - ][ + - ]: 165 : rNotesSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
[ + - ]
467 : :
468 : : /* #i35937# */
469 : :
470 : : }
471 : :
472 : : /**************************************************************************
473 : : * Hintergrundobjekte
474 : : **************************************************************************/
475 [ + - ][ + - ]: 165 : aName = String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
[ + - ][ + - ]
476 [ + - ]: 165 : aName.Insert(aPrefix, 0);
477 : :
478 [ + - ][ + - ]: 165 : if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
479 : : {
480 : 165 : bCreated = sal_True;
481 : :
482 [ + - ]: 165 : pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
483 [ + - ]: 165 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS );
484 [ + - ][ + - ]: 165 : pSheet->SetParent(String());
[ + - ]
485 [ + - ]: 165 : SfxItemSet& rBackgroundObjectsSet = pSheet->GetItemSet();
486 [ + - ][ + - ]: 165 : rBackgroundObjectsSet.Put(SdrShadowItem(sal_False));
[ + - ]
487 [ + - ][ + - ]: 165 : rBackgroundObjectsSet.Put(SdrShadowColorItem(String(), Color(COL_GRAY)));
[ + - ][ + - ]
[ + - ]
488 [ + - ][ + - ]: 165 : rBackgroundObjectsSet.Put(SdrShadowXDistItem(200)); // 3 mm Schattendistanz
[ + - ]
489 [ + - ][ + - ]: 165 : rBackgroundObjectsSet.Put(SdrShadowYDistItem(200));
[ + - ]
490 : : // #i16874# enable kerning by default but only for new documents
491 [ + - ][ + - ]: 165 : rBackgroundObjectsSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
[ + - ]
492 [ + - ][ + - ]: 165 : rBackgroundObjectsSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK));
[ + - ]
493 : : }
494 : :
495 : : /**************************************************************************
496 : : * Hintergrund
497 : : **************************************************************************/
498 [ + - ][ + - ]: 165 : aName = String(SdResId(STR_LAYOUT_BACKGROUND));
[ + - ][ + - ]
499 [ + - ]: 165 : aName.Insert(aPrefix, 0);
500 : :
501 [ + - ][ + - ]: 165 : if (!Find(aName, SD_STYLE_FAMILY_MASTERPAGE))
502 : : {
503 : 165 : bCreated = sal_True;
504 : :
505 [ + - ]: 165 : pSheet = &Make(aName, SD_STYLE_FAMILY_MASTERPAGE,nUsedMask);
506 [ + - ]: 165 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND );
507 [ + - ][ + - ]: 165 : pSheet->SetParent(String());
[ + - ]
508 [ + - ]: 165 : SfxItemSet& rBackgroundSet = pSheet->GetItemSet();
509 [ + - ][ + - ]: 165 : rBackgroundSet.Put(XLineStyleItem(XLINE_NONE));
[ + - ]
510 [ + - ][ + - ]: 165 : rBackgroundSet.Put(XFillStyleItem(XFILL_NONE));
[ + - ]
511 : : // #i16874# enable kerning by default but only for new documents
512 [ + - ][ + - ]: 165 : rBackgroundSet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
[ + - ]
513 : : }
514 : :
515 [ + - ][ + - ]: 165 : DBG_ASSERT( !bCheck || !bCreated, "missing layout style sheets detected!" );
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
516 : 165 : }
517 : :
518 : : /*************************************************************************
519 : : |*
520 : : |* Graphik-StyleSheets aus dem Quellpool in diesen Pool kopieren
521 : : |*
522 : : |* (rSourcePool kann nicht const sein, weil SfxStyleSheetPoolBase::Find
523 : : |* nicht const ist)
524 : : |*
525 : : \************************************************************************/
526 : :
527 : 0 : void SdStyleSheetPool::CopyGraphicSheets(SdStyleSheetPool& rSourcePool)
528 : : {
529 : 0 : CopySheets( rSourcePool, SD_STYLE_FAMILY_GRAPHICS );
530 : 0 : }
531 : :
532 : 0 : void SdStyleSheetPool::CopyCellSheets(SdStyleSheetPool& rSourcePool)
533 : : {
534 : 0 : CopySheets( rSourcePool, SD_STYLE_FAMILY_CELL );
535 : 0 : }
536 : :
537 : 0 : void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool& rSourcePool)
538 : : {
539 [ # # ]: 0 : Reference< XIndexAccess > xSource( rSourcePool.mxTableFamily, UNO_QUERY );
540 [ # # ]: 0 : Reference< XNameContainer > xTarget( mxTableFamily, UNO_QUERY );
541 [ # # ]: 0 : Reference< XSingleServiceFactory > xFactory( mxTableFamily, UNO_QUERY );
542 : :
543 [ # # ][ # # ]: 0 : if( xSource.is() && xFactory.is() && mxTableFamily.is() )
[ # # ][ # # ]
544 : : {
545 [ # # ][ # # ]: 0 : for( sal_Int32 nIndex = 0; nIndex < xSource->getCount(); nIndex++ ) try
[ # # ]
546 : : {
547 [ # # ][ # # ]: 0 : Reference< XStyle > xSourceTableStyle( xSource->getByIndex( nIndex ), UNO_QUERY );
[ # # ]
548 [ # # ]: 0 : if( xSourceTableStyle.is() )
549 : : {
550 [ # # ][ # # ]: 0 : Reference< XStyle > xNewTableStyle( xFactory->createInstance(), UNO_QUERY );
[ # # ]
551 [ # # ]: 0 : if( xNewTableStyle.is() )
552 : : {
553 [ # # ]: 0 : Reference< XNameAccess> xSourceNames( xSourceTableStyle, UNO_QUERY_THROW );
554 : :
555 [ # # ][ # # ]: 0 : Sequence< OUString > aStyleNames( xSourceNames->getElementNames() );
556 [ # # ]: 0 : OUString* pStyleNames( aStyleNames.getArray() );
557 : :
558 [ # # ]: 0 : Reference< XNameReplace > xTargetNames( xNewTableStyle, UNO_QUERY );
559 : :
560 : 0 : sal_Int32 nNames = aStyleNames.getLength();
561 [ # # ]: 0 : while( nNames-- )
562 : : {
563 : 0 : const OUString aName( *pStyleNames++ );
564 [ # # ][ # # ]: 0 : Reference< XStyle > xSourceStyle( xSourceNames->getByName( aName ), UNO_QUERY );
[ # # ]
565 : 0 : Reference< XStyle > xTargetStyle;
566 [ # # ]: 0 : if( xSourceStyle.is() ) try
567 : : {
568 [ # # ][ # # ]: 0 : mxCellFamily->getByName( xSourceStyle->getName() ) >>= xTargetStyle;
[ # # ][ # # ]
[ # # ]
569 : : }
570 [ # # ]: 0 : catch( Exception& )
571 : : {
572 : : OSL_FAIL( "sd::SdStyleSheetPool::CopyTableStyles(), exception caught!" );
573 : : }
574 : :
575 [ # # ]: 0 : if( xTargetStyle.is() )
576 [ # # ][ # # ]: 0 : xTargetNames->replaceByName( aName, Any( xTargetStyle ) );
[ # # ]
577 [ # # ]: 0 : }
578 : : }
579 : :
580 [ # # ][ # # ]: 0 : OUString sName( Reference< XNamed >( xSourceTableStyle, UNO_QUERY_THROW )->getName() );
[ # # ]
581 [ # # ][ # # ]: 0 : if( xTarget->hasByName( sName ) )
[ # # ]
582 [ # # ][ # # ]: 0 : xTarget->replaceByName( sName, Any( xNewTableStyle ) );
[ # # ]
583 : : else
584 [ # # ][ # # ]: 0 : xTarget->insertByName( sName, Any( xNewTableStyle ) );
[ # # ]
585 [ # # ]: 0 : }
586 : : }
587 [ # # ]: 0 : catch( Exception& )
588 : : {
589 : : OSL_FAIL("sd::SdStyleSheetPool::CopyTableStyles(), exception caught!");
590 : : }
591 : 0 : }
592 : 0 : }
593 : :
594 : 0 : void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily )
595 : : {
596 [ # # ]: 0 : String aHelpFile;
597 : :
598 : 0 : sal_uInt32 nCount = rSourcePool.aStyles.size();
599 : :
600 [ # # ]: 0 : std::vector< std::pair< rtl::Reference< SfxStyleSheetBase >, String > > aNewStyles;
601 : :
602 [ # # ]: 0 : for (sal_uInt32 n = 0; n < nCount; n++)
603 : : {
604 : 0 : rtl::Reference< SfxStyleSheetBase > xSheet( rSourcePool.aStyles[sal::static_int_cast<sal_uInt16>(n)] );
605 : :
606 [ # # ]: 0 : if( xSheet->GetFamily() == eFamily )
607 : : {
608 [ # # ][ # # ]: 0 : String aName( xSheet->GetName() );
609 [ # # ][ # # ]: 0 : if ( !Find( aName, eFamily ) )
610 : : {
611 [ # # ]: 0 : rtl::Reference< SfxStyleSheetBase > xNewSheet( &Make( aName, eFamily ) );
612 : :
613 : 0 : xNewSheet->SetMask( xSheet->GetMask() );
614 : :
615 : : // Also set parent relation for copied style sheets
616 [ # # ][ # # ]: 0 : String aParent( xSheet->GetParent() );
617 [ # # ]: 0 : if( aParent.Len() )
618 [ # # ][ # # ]: 0 : aNewStyles.push_back( std::pair< rtl::Reference< SfxStyleSheetBase >, String >( xNewSheet, aParent ) );
[ # # ]
619 : :
620 [ # # ][ # # ]: 0 : xNewSheet->SetHelpId( aHelpFile, xSheet->GetHelpId( aHelpFile ) );
621 [ # # ][ # # ]: 0 : xNewSheet->GetItemSet().Put( xSheet->GetItemSet() );
[ # # ][ # # ]
622 [ # # ]: 0 : }
623 : : }
624 : 0 : }
625 : :
626 : : // set parents on newly added stylesheets
627 : 0 : std::vector< std::pair< rtl::Reference< SfxStyleSheetBase >, String > >::iterator aIter;
628 [ # # ][ # # ]: 0 : for( aIter = aNewStyles.begin(); aIter != aNewStyles.end(); ++aIter )
629 : : {
630 : : DBG_ASSERT( rSourcePool.Find( (*aIter).second, eFamily ), "StyleSheet has invalid parent: Family mismatch" );
631 [ # # ]: 0 : (*aIter).first->SetParent( (*aIter).second );
632 [ # # ]: 0 : }
633 : 0 : }
634 : :
635 : :
636 : : /*************************************************************************
637 : : |*
638 : : |* StyleSheets des genannten Praesentationslayouts aus dem Quellpool in diesen
639 : : |* Pool kopieren. Kopiert werden nur solche StyleSheets, die in diesem Pool
640 : : |* noch nicht vorhanden sind.
641 : : |* pCreatedSheets wird - wenn ungleich NULL - mit Zeigern auf die erzeugten
642 : : |* StyleSheets gefuellt.
643 : : |*
644 : : |* (rSourcePool kann nicht const sein, weil SfxStyleSheetPoolBase::Find
645 : : |* nicht const ist)
646 : : |*
647 : : \************************************************************************/
648 : :
649 : 0 : void SdStyleSheetPool::CopyLayoutSheets(const String& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets)
650 : : {
651 : 0 : SfxStyleSheetBase* pSheet = NULL;
652 : :
653 [ # # ][ # # ]: 0 : String aOutlineTag(SdResId(STR_LAYOUT_OUTLINE));
654 : :
655 [ # # ]: 0 : std::vector<String> aNameList;
656 [ # # ]: 0 : CreateLayoutSheetNames(rLayoutName,aNameList);
657 : :
658 [ # # ]: 0 : String sEmpty;
659 [ # # ][ # # ]: 0 : for (std::vector<String>::const_iterator it = aNameList.begin(); it != aNameList.end(); ++it)
[ # # ][ # # ]
660 : : {
661 [ # # ][ # # ]: 0 : pSheet = Find(*it, SD_STYLE_FAMILY_MASTERPAGE);
662 [ # # ]: 0 : if (!pSheet)
663 : : {
664 [ # # ][ # # ]: 0 : SfxStyleSheetBase* pSourceSheet = rSourcePool.Find(*it, SD_STYLE_FAMILY_MASTERPAGE);
665 : : DBG_ASSERT(pSourceSheet, "CopyLayoutSheets: Quellvorlage nicht gefunden");
666 [ # # ]: 0 : if (pSourceSheet)
667 : : {
668 : : // falls einer mit Methusalem-Doks. ankommt
669 [ # # ][ # # ]: 0 : SfxStyleSheetBase& rNewSheet = Make(*it, SD_STYLE_FAMILY_MASTERPAGE);
670 [ # # ][ # # ]: 0 : rNewSheet.SetHelpId( sEmpty, pSourceSheet->GetHelpId( sEmpty ) );
671 [ # # ][ # # ]: 0 : rNewSheet.GetItemSet().Put(pSourceSheet->GetItemSet());
[ # # ]
672 [ # # ]: 0 : rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( &rNewSheet ) ) );
673 : : }
674 : : }
675 : : }
676 : :
677 : : // Sonderbehandlung fuer Gliederungsvorlagen: Parentbeziehungen aufbauen
678 [ # # ]: 0 : std::vector<SfxStyleSheetBase*> aOutlineSheets;
679 [ # # ]: 0 : CreateOutlineSheetList(rLayoutName,aOutlineSheets);
680 : :
681 [ # # ]: 0 : if( !aOutlineSheets.empty() )
682 : : {
683 : 0 : std::vector<SfxStyleSheetBase*>::iterator it = aOutlineSheets.begin();
684 [ # # ]: 0 : SfxStyleSheetBase* pParent = *it;
685 [ # # ]: 0 : ++it;
686 : :
687 [ # # ][ # # ]: 0 : while (it != aOutlineSheets.end())
688 : : {
689 [ # # ]: 0 : pSheet = *it;
690 : :
691 [ # # ]: 0 : if (!pSheet)
692 : 0 : break;
693 : :
694 [ # # ][ # # ]: 0 : if (pSheet->GetParent().Len() == 0)
695 [ # # ][ # # ]: 0 : pSheet->SetParent(pParent->GetName());
696 : :
697 : 0 : pParent = pSheet;
698 : :
699 [ # # ]: 0 : ++it;
700 : : }
701 [ # # ][ # # ]: 0 : }
702 : 0 : }
703 : :
704 : : /*************************************************************************
705 : : |*
706 : : |* Liste mit den Namen der Praesentationsvorlagen eines Layouts erzeugen.
707 : : |* Die Liste und die enthaltenen Strings gehoeren dem Caller!
708 : : |*
709 : : \************************************************************************/
710 : :
711 : 0 : void SdStyleSheetPool::CreateLayoutSheetNames(const String& rLayoutName, std::vector<String> &aNameList) const
712 : : {
713 [ # # ]: 0 : String aPrefix(rLayoutName);
714 [ # # ]: 0 : String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
715 [ # # ]: 0 : aPrefix.Insert(aSep);
716 : :
717 [ # # ][ # # ]: 0 : String aName(SdResId(STR_LAYOUT_OUTLINE));
718 [ # # ]: 0 : String aStr;
719 : :
720 [ # # ]: 0 : for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
721 : : {
722 [ # # ][ # # ]: 0 : aStr = String( aPrefix );
[ # # ]
723 [ # # ]: 0 : aStr.Append(aName);
724 [ # # ]: 0 : aStr.Append( sal_Unicode( ' ' ));
725 [ # # ][ # # ]: 0 : aStr.Append( String::CreateFromInt32( sal_Int32( nLevel )));
[ # # ]
726 [ # # ]: 0 : aNameList.push_back(aStr);
727 : : }
728 : :
729 [ # # ][ # # ]: 0 : aStr = String(SdResId(STR_LAYOUT_TITLE));
[ # # ][ # # ]
730 [ # # ]: 0 : aStr.Insert(aPrefix, 0);
731 [ # # ]: 0 : aNameList.push_back(aStr);
732 : :
733 [ # # ][ # # ]: 0 : aStr = String(SdResId(STR_LAYOUT_SUBTITLE));
[ # # ][ # # ]
734 [ # # ]: 0 : aStr.Insert(aPrefix, 0);
735 [ # # ]: 0 : aNameList.push_back(aStr);
736 : :
737 [ # # ][ # # ]: 0 : aStr = String(SdResId(STR_LAYOUT_NOTES));
[ # # ][ # # ]
738 [ # # ]: 0 : aStr.Insert(aPrefix, 0);
739 [ # # ]: 0 : aNameList.push_back(aStr);
740 : :
741 [ # # ][ # # ]: 0 : aStr = String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
[ # # ][ # # ]
742 [ # # ]: 0 : aStr.Insert(aPrefix, 0);
743 [ # # ]: 0 : aNameList.push_back(aStr);
744 : :
745 [ # # ][ # # ]: 0 : aStr = String(SdResId(STR_LAYOUT_BACKGROUND));
[ # # ][ # # ]
746 [ # # ]: 0 : aStr.Insert(aPrefix, 0);
747 [ # # ][ # # ]: 0 : aNameList.push_back(aStr);
[ # # ][ # # ]
[ # # ]
748 : 0 : }
749 : :
750 : : /*************************************************************************
751 : : |*
752 : : |* Liste mit Zeigern auf Praesentationsvorlagen eines Layouts erzeugen.
753 : : |* Die Liste gehoert dem Caller!
754 : : |*
755 : : \************************************************************************/
756 : :
757 : 0 : void SdStyleSheetPool::CreateLayoutSheetList(const String& rLayoutName, SdStyleSheetVector& rLayoutSheets )
758 : : {
759 [ # # ]: 0 : String aLayoutNameWithSep(rLayoutName);
760 [ # # ]: 0 : aLayoutNameWithSep.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
761 : 0 : sal_uInt16 nLen = aLayoutNameWithSep.Len();
762 : :
763 [ # # ]: 0 : SfxStyleSheetIterator aIter(this, SD_STYLE_FAMILY_MASTERPAGE);
764 [ # # ]: 0 : SfxStyleSheetBase* pSheet = aIter.First();
765 : :
766 [ # # ]: 0 : while (pSheet)
767 : : {
768 [ # # ][ # # ]: 0 : if (pSheet->GetName().Match(aLayoutNameWithSep) == nLen)
[ # # ]
769 [ # # ]: 0 : rLayoutSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( pSheet ) ) );
770 [ # # ]: 0 : pSheet = aIter.Next();
771 [ # # ][ # # ]: 0 : }
772 : 0 : }
773 : :
774 : : /*************************************************************************
775 : : |*
776 : : |* ggfs. PseudoStyleSheets erzeugen
777 : : |*
778 : : \************************************************************************/
779 : :
780 : 157 : void SdStyleSheetPool::CreatePseudosIfNecessary()
781 : : {
782 [ + - ]: 157 : String aName;
783 [ + - ]: 157 : String aHelpFile;
784 : 157 : SfxStyleSheetBase* pSheet = NULL;
785 : 157 : SfxStyleSheetBase* pParent = NULL;
786 : :
787 : 157 : sal_uInt16 nUsedMask = SFXSTYLEBIT_USED;
788 : :
789 [ + - ][ + - ]: 157 : aName = String(SdResId(STR_PSEUDOSHEET_TITLE));
[ + - ][ + - ]
790 [ + - ][ + - ]: 157 : if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
791 : : {
792 [ + - ]: 157 : pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
793 [ + - ][ + - ]: 157 : pSheet->SetParent( String() );
[ + - ]
794 [ + - ]: 157 : ((SfxStyleSheet*)pSheet)->StartListening(*this);
795 : : }
796 [ + - ]: 157 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_TITLE );
797 : :
798 [ + - ][ + - ]: 157 : aName = String(SdResId(STR_PSEUDOSHEET_SUBTITLE));
[ + - ][ + - ]
799 [ + - ][ + - ]: 157 : if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
800 : : {
801 [ + - ]: 157 : pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
802 [ + - ][ + - ]: 157 : pSheet->SetParent(String());
[ + - ]
803 [ + - ]: 157 : ((SfxStyleSheet*)pSheet)->StartListening(*this);
804 : : }
805 [ + - ]: 157 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_SUBTITLE );
806 : :
807 [ + - ][ + - ]: 157 : aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS));
[ + - ][ + - ]
808 [ + - ][ + - ]: 157 : if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
809 : : {
810 [ + - ]: 157 : pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
811 [ + - ][ + - ]: 157 : pSheet->SetParent( String() );
[ + - ]
812 [ + - ]: 157 : ((SfxStyleSheet*)pSheet)->StartListening(*this);
813 : : }
814 [ + - ]: 157 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUNDOBJECTS );
815 : :
816 [ + - ][ + - ]: 157 : aName = String(SdResId(STR_PSEUDOSHEET_BACKGROUND));
[ + - ][ + - ]
817 [ + - ][ + - ]: 157 : if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
818 : : {
819 [ + - ]: 157 : pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
820 [ + - ][ + - ]: 157 : pSheet->SetParent( String() );
[ + - ]
821 [ + - ]: 157 : ((SfxStyleSheet*)pSheet)->StartListening(*this);
822 : : }
823 [ + - ]: 157 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_BACKGROUND );
824 : :
825 [ + - ][ + - ]: 157 : aName = String(SdResId(STR_PSEUDOSHEET_NOTES));
[ + - ][ + - ]
826 [ + - ][ + - ]: 157 : if( (pSheet = Find(aName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
827 : : {
828 [ + - ]: 157 : pSheet = &Make(aName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
829 [ + - ][ + - ]: 157 : pSheet->SetParent( String() );
[ + - ]
830 [ + - ]: 157 : ((SfxStyleSheet*)pSheet)->StartListening(*this);
831 : : }
832 [ + - ]: 157 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_NOTES );
833 : :
834 : 157 : pParent = NULL;
835 [ + - ]: 157 : SetSearchMask(SD_STYLE_FAMILY_PSEUDO);
836 [ + - ][ + - ]: 157 : aName = String(SdResId(STR_PSEUDOSHEET_OUTLINE));
[ + - ][ + - ]
837 [ + + ]: 1570 : for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
838 : : {
839 [ + - ]: 1413 : String aLevelName(aName);
840 [ + - ]: 1413 : aLevelName.Append( sal_Unicode( ' ' ));
841 [ + - ][ + - ]: 1413 : aLevelName.Append( String::CreateFromInt32( sal_Int32( nLevel )));
[ + - ]
842 : :
843 [ + - ][ + - ]: 1413 : if( (pSheet = Find(aLevelName, SD_STYLE_FAMILY_PSEUDO)) == 0 )
844 : : {
845 [ + - ]: 1413 : pSheet = &Make(aLevelName, SD_STYLE_FAMILY_PSEUDO, nUsedMask);
846 : :
847 [ + - ]: 1413 : if (pSheet)
848 : : {
849 [ + + ]: 1413 : if (pParent)
850 [ + - ][ + - ]: 1256 : pSheet->SetParent(pParent->GetName());
851 : 1413 : pParent = pSheet;
852 [ + - ]: 1413 : ((SfxStyleSheet*)pSheet)->StartListening(*this);
853 : : }
854 : : }
855 [ + - ]: 1413 : pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel );
856 [ + - ][ + - ]: 1570 : }
[ + - ]
857 : 157 : }
858 : :
859 : :
860 : : /*************************************************************************
861 : : |*
862 : : |* Standard-Styles den richtigen Namen in der Programm-Sprache geben
863 : : |*
864 : : \************************************************************************/
865 : :
866 : 0 : void SdStyleSheetPool::UpdateStdNames()
867 : : {
868 [ # # ]: 0 : String aHelpFile;
869 : 0 : sal_uInt32 nCount = aStyles.size();
870 [ # # ]: 0 : std::vector<SfxStyleSheetBase*> aEraseList;
871 : :
872 [ # # ]: 0 : for( sal_uInt32 n=0; n < nCount; n++ )
873 : : {
874 : 0 : SfxStyleSheetBase* pStyle = aStyles[ n ].get();
875 : :
876 [ # # ]: 0 : if( !pStyle->IsUserDefined() )
877 : : {
878 [ # # ][ # # ]: 0 : String aOldName = pStyle->GetName();
879 [ # # ]: 0 : sal_uLong nHelpId = pStyle->GetHelpId( aHelpFile );
880 : 0 : SfxStyleFamily eFam = pStyle->GetFamily();
881 : :
882 : 0 : sal_Bool bHelpKnown = sal_True;
883 [ # # ]: 0 : String aNewName;
884 : 0 : sal_uInt16 nNameId = 0;
885 [ # # # # : 0 : switch( nHelpId )
# # # # #
# # # # #
# # # # #
# # # # #
# # # # ]
886 : : {
887 : 0 : case HID_STANDARD_STYLESHEET_NAME: nNameId = STR_STANDARD_STYLESHEET_NAME; break;
888 : 0 : case HID_POOLSHEET_OBJWITHARROW: nNameId = STR_POOLSHEET_OBJWITHARROW; break;
889 : 0 : case HID_POOLSHEET_OBJWITHSHADOW: nNameId = STR_POOLSHEET_OBJWITHSHADOW; break;
890 : 0 : case HID_POOLSHEET_OBJWITHOUTFILL: nNameId = STR_POOLSHEET_OBJWITHOUTFILL; break;
891 : 0 : case HID_POOLSHEET_TEXT: nNameId = STR_POOLSHEET_TEXT; break;
892 : 0 : case HID_POOLSHEET_TEXTBODY: nNameId = STR_POOLSHEET_TEXTBODY; break;
893 : 0 : case HID_POOLSHEET_TEXTBODY_JUSTIFY:nNameId = STR_POOLSHEET_TEXTBODY_JUSTIFY;break;
894 : 0 : case HID_POOLSHEET_TEXTBODY_INDENT: nNameId = STR_POOLSHEET_TEXTBODY_INDENT;break;
895 : 0 : case HID_POOLSHEET_TITLE: nNameId = STR_POOLSHEET_TITLE; break;
896 : 0 : case HID_POOLSHEET_TITLE1: nNameId = STR_POOLSHEET_TITLE1; break;
897 : 0 : case HID_POOLSHEET_TITLE2: nNameId = STR_POOLSHEET_TITLE2; break;
898 : 0 : case HID_POOLSHEET_HEADLINE: nNameId = STR_POOLSHEET_HEADLINE; break;
899 : 0 : case HID_POOLSHEET_HEADLINE1: nNameId = STR_POOLSHEET_HEADLINE1; break;
900 : 0 : case HID_POOLSHEET_HEADLINE2: nNameId = STR_POOLSHEET_HEADLINE2; break;
901 : 0 : case HID_POOLSHEET_MEASURE: nNameId = STR_POOLSHEET_MEASURE; break;
902 : :
903 : 0 : case HID_PSEUDOSHEET_TITLE: nNameId = STR_PSEUDOSHEET_TITLE; break;
904 : 0 : case HID_PSEUDOSHEET_SUBTITLE: nNameId = STR_PSEUDOSHEET_SUBTITLE; break;
905 : : case HID_PSEUDOSHEET_OUTLINE1:
906 : : case HID_PSEUDOSHEET_OUTLINE2:
907 : : case HID_PSEUDOSHEET_OUTLINE3:
908 : : case HID_PSEUDOSHEET_OUTLINE4:
909 : : case HID_PSEUDOSHEET_OUTLINE5:
910 : : case HID_PSEUDOSHEET_OUTLINE6:
911 : : case HID_PSEUDOSHEET_OUTLINE7:
912 : : case HID_PSEUDOSHEET_OUTLINE8:
913 : 0 : case HID_PSEUDOSHEET_OUTLINE9: nNameId = STR_PSEUDOSHEET_OUTLINE; break;
914 : 0 : case HID_PSEUDOSHEET_BACKGROUNDOBJECTS: nNameId = STR_PSEUDOSHEET_BACKGROUNDOBJECTS; break;
915 : 0 : case HID_PSEUDOSHEET_BACKGROUND: nNameId = STR_PSEUDOSHEET_BACKGROUND; break;
916 : 0 : case HID_PSEUDOSHEET_NOTES: nNameId = STR_PSEUDOSHEET_NOTES; break;
917 : :
918 : 0 : case HID_SD_CELL_STYLE_DEFAULT: nNameId = STR_STANDARD_STYLESHEET_NAME; break;
919 : 0 : case HID_SD_CELL_STYLE_BANDED: nNameId = STR_POOLSHEET_BANDED_CELL; break;
920 : 0 : case HID_SD_CELL_STYLE_HEADER: nNameId = STR_POOLSHEET_HEADER; break;
921 : 0 : case HID_SD_CELL_STYLE_TOTAL: nNameId = STR_POOLSHEET_TOTAL; break;
922 : 0 : case HID_SD_CELL_STYLE_FIRST_COLUMN: nNameId = STR_POOLSHEET_FIRST_COLUMN; break;
923 : 0 : case HID_SD_CELL_STYLE_LAST_COLUMN: nNameId = STR_POOLSHEET_LAST_COLUMN; break;
924 : :
925 : : default:
926 : : // 0 oder falsche (alte) HelpId
927 : 0 : bHelpKnown = sal_False;
928 : : }
929 [ # # ]: 0 : if( bHelpKnown )
930 : : {
931 [ # # ]: 0 : if( nNameId )
932 : : {
933 [ # # ][ # # ]: 0 : aNewName = String( SdResId( nNameId ) );
[ # # ][ # # ]
934 [ # # ]: 0 : if( nNameId == STR_PSEUDOSHEET_OUTLINE )
935 : : {
936 [ # # ]: 0 : aNewName.Append( sal_Unicode( ' ' ));
937 [ # # ][ # # ]: 0 : aNewName.Append( String::CreateFromInt32( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE )));
[ # # ]
938 : : }
939 : : }
940 : :
941 [ # # ][ # # ]: 0 : if( aNewName.Len() && aNewName != aOldName )
[ # # ][ # # ]
942 : : {
943 [ # # ]: 0 : SfxStyleSheetBase* pSheetFound = Find( aNewName, eFam );
944 : :
945 [ # # ]: 0 : if ( !pSheetFound )
946 : : {
947 : : // Sheet existiert noch nicht: Altes Sheet wird umbenannt
948 [ # # ]: 0 : pStyle->SetName( aNewName ); // setzt auch Parents um
949 : : }
950 : : else
951 : : {
952 : : // Sheet existiert schon: Altes Sheet muss entfernt werden
953 [ # # ]: 0 : aEraseList.push_back( pStyle );
954 : : }
955 : : }
956 [ # # ][ # # ]: 0 : }
957 : : }
958 : : }
959 : :
960 : : // Styles, welche nicht umbenannt werden konnten, muessen entfernt werden
961 [ # # ]: 0 : for ( size_t i = 0, n = aEraseList.size(); i < n; ++i )
962 [ # # ][ # # ]: 0 : Remove( aEraseList[ i ] );
[ # # ]
963 : 0 : }
964 : : // --------------------------------------------------------------------
965 : : // Neues SvxNumBulletItem fuer das jeweilige StyleSheet setzen
966 : : // --------------------------------------------------------------------
967 : :
968 : 684 : void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
969 : : Font& rBulletFont )
970 : : {
971 [ + - ]: 684 : String aHelpFile;
972 [ + - ]: 684 : sal_uLong nHelpId = pSheet->GetHelpId( aHelpFile );
973 [ + - ]: 684 : SfxItemSet& rSet = pSheet->GetItemSet();
974 : :
975 [ + + + - ]: 684 : switch ( nHelpId )
976 : : {
977 : : case HID_STANDARD_STYLESHEET_NAME :
978 : : {
979 : : // Standard-Vorlage
980 [ + - ]: 168 : SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
981 [ + - ]: 168 : aNumberFormat.SetBulletFont(&rBulletFont);
982 : 168 : aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
983 : 168 : aNumberFormat.SetBulletRelSize(45);
984 : 168 : aNumberFormat.SetBulletColor(Color(COL_AUTO));
985 : 168 : aNumberFormat.SetStart(1);
986 : 168 : aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
987 : :
988 [ + - ]: 168 : SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10 , sal_False);
989 : :
990 [ + + ]: 1848 : for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
991 : : {
992 : 1680 : const short nLSpace = (i + 1) * 600;
993 : 1680 : aNumberFormat.SetLSpace(nLSpace);
994 : 1680 : aNumberFormat.SetAbsLSpace(nLSpace);
995 : 1680 : aNumberFormat.SetFirstLineOffset(-600);
996 [ + - ]: 1680 : aNumRule.SetLevel( i, aNumberFormat );
997 : : }
998 : :
999 [ + - ][ + - ]: 168 : rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
[ + - ]
1000 [ + - ][ + - ]: 168 : ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
[ + - ][ + - ]
[ + - ]
1001 : : }
1002 : 168 : break;
1003 : :
1004 : : case HID_PSEUDOSHEET_TITLE:
1005 : : /* title gets same bullet as subtitle and not that page symbol anymore */
1006 : : case HID_PSEUDOSHEET_SUBTITLE :
1007 : : {
1008 : : // Untertitel-Vorlage
1009 [ + - ][ + - ]: 344 : SvxNumRule* pDefaultRule = ((SvxNumBulletItem*) rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET))->GetNumRule();
1010 : : DBG_ASSERT( pDefaultRule, "Wo ist mein Default? [CL]" );
1011 : :
1012 [ + - ]: 344 : if(pDefaultRule)
1013 : : {
1014 [ + - ]: 344 : SvxNumRule aNumRule(pDefaultRule->GetFeatureFlags(), 10, sal_False);
1015 [ + + ]: 3784 : for(sal_uInt16 i=0; i < aNumRule.GetLevelCount(); i++)
1016 : : {
1017 [ + - ][ + - ]: 3440 : SvxNumberFormat aFrmt( pDefaultRule->GetLevel(i) );
1018 : 3440 : aFrmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
1019 : : // #i93908# clear suffix for bullet lists
1020 : 3440 : aFrmt.SetPrefix(::rtl::OUString());
1021 : 3440 : aFrmt.SetSuffix(::rtl::OUString());
1022 : 3440 : aFrmt.SetStart(1);
1023 : 3440 : aFrmt.SetBulletRelSize(45);
1024 : 3440 : aFrmt.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
1025 [ + - ]: 3440 : aFrmt.SetBulletFont(&rBulletFont);
1026 [ + - ]: 3440 : aNumRule.SetLevel(i, aFrmt);
1027 [ + - ]: 3440 : }
1028 : :
1029 [ + - ][ + - ]: 344 : rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
[ + - ]
1030 [ + - ][ + - ]: 344 : ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
[ + - ][ + - ]
1031 : : }
1032 : : }
1033 : 344 : break;
1034 : :
1035 : : case HID_PSEUDOSHEET_OUTLINE + 1 :
1036 : : {
1037 : : // Gliederungs-Vorlage
1038 [ + - ]: 172 : SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
1039 : 172 : aNumberFormat.SetBulletColor(Color(COL_AUTO));
1040 : 172 : aNumberFormat.SetStart(1);
1041 : 172 : aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
1042 : :
1043 : : SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,
1044 [ + - ]: 172 : 10, sal_False );
1045 [ + + ]: 1892 : for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
1046 : : {
1047 : 1720 : aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
1048 : 1720 : aNumberFormat.SetBulletRelSize(45);
1049 : 1720 : const short nLSpace = (i + 1) * 1200;
1050 : 1720 : aNumberFormat.SetLSpace(nLSpace);
1051 : 1720 : aNumberFormat.SetAbsLSpace(nLSpace);
1052 : 1720 : short nFirstLineOffset = -600;
1053 : :
1054 : 1720 : sal_uLong nFontSize = 20;
1055 [ + + + + : 1720 : switch(i)
+ ]
1056 : : {
1057 : : case 0:
1058 : : {
1059 : 172 : nFontSize = 32;
1060 : 172 : nFirstLineOffset = -900;
1061 : : }
1062 : 172 : break;
1063 : :
1064 : : case 1:
1065 : : {
1066 : 172 : aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
1067 : 172 : aNumberFormat.SetBulletRelSize(75);
1068 : 172 : nFontSize = 32;
1069 : 172 : nFirstLineOffset = -900;
1070 : : }
1071 : 172 : break;
1072 : :
1073 : : case 2:
1074 : : {
1075 : 172 : nFontSize = 28;
1076 : 172 : nFirstLineOffset = -800;
1077 : : }
1078 : 172 : break;
1079 : :
1080 : : case 3:
1081 : : {
1082 : 172 : aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150
1083 : 172 : aNumberFormat.SetBulletRelSize(75);
1084 : 172 : nFontSize = 24;
1085 : : }
1086 : 172 : break;
1087 : : }
1088 : :
1089 : 1720 : aNumberFormat.SetFirstLineOffset(nFirstLineOffset);
1090 : 1720 : nFontSize = (sal_uInt16)((nFontSize * 2540L) / 72); // Pt --> 1/100 mm
1091 [ + - ]: 1720 : rBulletFont.SetSize(Size(0,846)); // 24 pt
1092 [ + - ]: 1720 : aNumberFormat.SetBulletFont(&rBulletFont);
1093 [ + - ]: 1720 : aNumRule.SetLevel( i, aNumberFormat );
1094 : : }
1095 : :
1096 [ + - ][ + - ]: 172 : rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
[ + - ]
1097 [ + - ][ + - ]: 172 : ((SfxStyleSheet*)pSheet)->Broadcast(SfxSimpleHint( SFX_HINT_DATACHANGED ) );
[ + - ][ + - ]
[ + - ]
1098 : : }
1099 : 172 : break;
1100 [ + - ]: 684 : }
1101 : 684 : }
1102 : :
1103 : : /*************************************************************************
1104 : : |*
1105 : : |* Standard Bullet-Font erzeugen (ohne Groesse)
1106 : : |*
1107 : : \************************************************************************/
1108 : :
1109 : 830 : Font SdStyleSheetPool::GetBulletFont() const
1110 : : {
1111 [ + - ][ + - ]: 830 : Font aBulletFont( OUString( "StarSymbol" ), Size(0, 1000) );
[ + - ]
1112 [ + - ]: 830 : aBulletFont.SetCharSet(RTL_TEXTENCODING_UNICODE);
1113 [ + - ]: 830 : aBulletFont.SetWeight(WEIGHT_NORMAL);
1114 [ + - ]: 830 : aBulletFont.SetUnderline(UNDERLINE_NONE);
1115 [ + - ]: 830 : aBulletFont.SetOverline(UNDERLINE_NONE);
1116 [ + - ]: 830 : aBulletFont.SetStrikeout(STRIKEOUT_NONE);
1117 [ + - ]: 830 : aBulletFont.SetItalic(ITALIC_NONE);
1118 [ + - ]: 830 : aBulletFont.SetOutline(sal_False);
1119 [ + - ]: 830 : aBulletFont.SetShadow(sal_False);
1120 [ + - ]: 830 : aBulletFont.SetColor(Color(COL_AUTO));
1121 [ + - ]: 830 : aBulletFont.SetTransparent(sal_True);
1122 : :
1123 : 830 : return aBulletFont;
1124 : : }
1125 : :
1126 : : // --------------------------------------------------------------------
1127 : :
1128 : 177 : void SdStyleSheetPool::AddStyleFamily( const SdPage* pPage )
1129 : : {
1130 : 177 : rtl::Reference< SfxStyleSheetPool > xPool( this );
1131 [ + - ][ + - ]: 177 : maStyleFamilyMap[pPage] = new SdStyleFamily( xPool, pPage );
[ + - ]
1132 : 177 : }
1133 : :
1134 : : // --------------------------------------------------------------------
1135 : :
1136 : 162 : void SdStyleSheetPool::RemoveStyleFamily( const SdPage* pPage )
1137 : : {
1138 [ + - ]: 162 : SdStyleFamilyMap::iterator iter( maStyleFamilyMap.find( pPage ) );
1139 [ + - ]: 162 : if( iter != maStyleFamilyMap.end() )
1140 : : {
1141 : 162 : SdStyleFamilyRef xStyle( (*iter).second );
1142 [ + - ]: 162 : maStyleFamilyMap.erase( iter );
1143 : :
1144 [ + - ]: 162 : if( xStyle.is() ) try
1145 : : {
1146 [ + - ]: 162 : xStyle->dispose();
1147 : : }
1148 [ # # ]: 0 : catch( Exception& )
1149 : : {
1150 : 162 : }
1151 : : }
1152 [ # # ]: 162 : }
1153 : :
1154 : : // --------------------------------------------------------------------
1155 : :
1156 : 795 : void SdStyleSheetPool::throwIfDisposed() throw(::com::sun::star::uno::RuntimeException)
1157 : : {
1158 [ - + ]: 795 : if( mpDoc == NULL )
1159 [ # # ]: 0 : throw DisposedException();
1160 : 795 : }
1161 : :
1162 : : // --------------------------------------------------------------------
1163 : : // XServiceInfo
1164 : : // --------------------------------------------------------------------
1165 : :
1166 : 0 : OUString SAL_CALL SdStyleSheetPool::getImplementationName() throw(RuntimeException)
1167 : : {
1168 : 0 : return OUString( "SdStyleSheetPool" );
1169 : : }
1170 : :
1171 : : // --------------------------------------------------------------------
1172 : :
1173 : : static const sal_Char* gpServiceName = "com.sun.star.style.StyleFamilies";
1174 : :
1175 : 0 : sal_Bool SAL_CALL SdStyleSheetPool::supportsService( const OUString& ServiceName ) throw(RuntimeException)
1176 : : {
1177 : 0 : return ServiceName.equalsAscii( gpServiceName );
1178 : : }
1179 : :
1180 : : // --------------------------------------------------------------------
1181 : :
1182 : 0 : Sequence< OUString > SAL_CALL SdStyleSheetPool::getSupportedServiceNames() throw(RuntimeException)
1183 : : {
1184 : 0 : OUString aStr( OUString::createFromAscii( gpServiceName ) );
1185 [ # # ]: 0 : return Sequence< OUString >( &aStr, 1 );
1186 : : }
1187 : :
1188 : : // --------------------------------------------------------------------
1189 : : // XNameAccess
1190 : : // --------------------------------------------------------------------
1191 : :
1192 : 610 : Any SAL_CALL SdStyleSheetPool::getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
1193 : : {
1194 : 610 : throwIfDisposed();
1195 : :
1196 [ + + ]: 610 : if( mxGraphicFamily->getName() == aName )
1197 [ + - ][ + - ]: 250 : return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxGraphicFamily.get() ) ) );
1198 : :
1199 [ + + ]: 360 : if( mxCellFamily->getName() == aName )
1200 [ + - ][ + - ]: 26 : return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxCellFamily.get() ) ) );
1201 : :
1202 [ + + ]: 334 : if( msTableFamilyName == aName )
1203 : 195 : return Any( mxTableFamily );
1204 : :
1205 [ + - ]: 139 : for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
1206 : : {
1207 [ + - ][ + - ]: 139 : if( (*iter).second->getName() == aName )
1208 [ + - ][ + - ]: 139 : return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( (*iter).second.get() ) ) );
[ + - ]
1209 : : }
1210 : :
1211 [ # # ]: 610 : throw NoSuchElementException();
1212 : : }
1213 : :
1214 : : // --------------------------------------------------------------------
1215 : :
1216 : 0 : Sequence< OUString > SAL_CALL SdStyleSheetPool::getElementNames() throw(RuntimeException)
1217 : : {
1218 : 0 : throwIfDisposed();
1219 : :
1220 : 0 : Sequence< OUString > aNames( maStyleFamilyMap.size() + 3 );
1221 [ # # ]: 0 : OUString* pNames = aNames.getArray();
1222 : :
1223 [ # # ]: 0 : *pNames++ = mxGraphicFamily->getName();
1224 [ # # ]: 0 : *pNames++ = mxCellFamily->getName();
1225 : 0 : *pNames++ = msTableFamilyName;
1226 : :
1227 [ # # ]: 0 : for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
1228 : : {
1229 [ # # ]: 0 : *pNames++ = (*iter).second->getName();
1230 : : }
1231 : :
1232 : 0 : return aNames;
1233 : : }
1234 : :
1235 : : // --------------------------------------------------------------------
1236 : :
1237 : 185 : sal_Bool SAL_CALL SdStyleSheetPool::hasByName( const OUString& aName ) throw(RuntimeException)
1238 : : {
1239 : 185 : throwIfDisposed();
1240 : :
1241 [ + + ]: 185 : if( mxGraphicFamily->getName() == aName )
1242 : 12 : return sal_True;
1243 : :
1244 [ + + ]: 173 : if( mxCellFamily->getName() == aName )
1245 : 12 : return sal_True;
1246 : :
1247 [ - + ]: 161 : if( msTableFamilyName == aName )
1248 : 0 : return sal_True;
1249 : :
1250 [ + + ]: 271 : for( SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() ); iter != maStyleFamilyMap.end(); ++iter )
1251 : : {
1252 [ + - ][ + + ]: 161 : if( (*iter).second->getName() == aName )
1253 : 51 : return sal_True;
1254 : : }
1255 : :
1256 : 185 : return sal_False;
1257 : : }
1258 : :
1259 : : // --------------------------------------------------------------------
1260 : : // XElementAccess
1261 : : // --------------------------------------------------------------------
1262 : :
1263 : 0 : Type SAL_CALL SdStyleSheetPool::getElementType() throw(RuntimeException)
1264 : : {
1265 : 0 : throwIfDisposed();
1266 : :
1267 : 0 : return XNameAccess::static_type();
1268 : : }
1269 : :
1270 : : // --------------------------------------------------------------------
1271 : :
1272 : 0 : sal_Bool SAL_CALL SdStyleSheetPool::hasElements() throw(RuntimeException)
1273 : : {
1274 : 0 : return sal_True;
1275 : : }
1276 : :
1277 : : // --------------------------------------------------------------------
1278 : : // XIndexAccess
1279 : : // --------------------------------------------------------------------
1280 : :
1281 : 0 : sal_Int32 SAL_CALL SdStyleSheetPool::getCount() throw(RuntimeException)
1282 : : {
1283 : 0 : throwIfDisposed();
1284 : :
1285 : 0 : return maStyleFamilyMap.size() + 3;
1286 : : }
1287 : :
1288 : : // --------------------------------------------------------------------
1289 : :
1290 : 0 : Any SAL_CALL SdStyleSheetPool::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
1291 : : {
1292 [ # # # # ]: 0 : switch( Index )
1293 : : {
1294 : : case 0:
1295 [ # # ][ # # ]: 0 : return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxGraphicFamily.get() ) ) );
1296 : :
1297 : : case 1:
1298 [ # # ][ # # ]: 0 : return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( mxCellFamily.get() ) ) );
1299 : :
1300 : : case 2:
1301 : 0 : return Any( mxTableFamily );
1302 : :
1303 : : default:
1304 : : {
1305 : 0 : Index -= 3;
1306 [ # # ][ # # ]: 0 : if( (Index < 0) || (Index >= sal::static_int_cast<sal_Int32>(maStyleFamilyMap.size())) )
[ # # ]
1307 [ # # ]: 0 : throw IndexOutOfBoundsException();
1308 : 0 : SdStyleFamilyMap::iterator iter( maStyleFamilyMap.begin() );
1309 [ # # ]: 0 : while( Index-- )
1310 : 0 : ++iter;
1311 : :
1312 [ # # ][ # # ]: 0 : return Any( Reference< XNameAccess >( static_cast< XNameAccess* >( (*iter).second.get() ) ) );
[ # # ]
1313 : : }
1314 : : }
1315 : : }
1316 : :
1317 : : // --------------------------------------------------------------------
1318 : : // XComponent
1319 : : // --------------------------------------------------------------------
1320 : :
1321 : 175 : void SAL_CALL SdStyleSheetPool::dispose() throw (RuntimeException)
1322 : : {
1323 [ + - ]: 175 : if( mpDoc )
1324 : : {
1325 [ + - ]: 175 : mxGraphicFamily->dispose();
1326 : 175 : mxGraphicFamily.clear();
1327 [ + - ]: 175 : mxCellFamily->dispose();
1328 : 175 : mxCellFamily.clear();
1329 : :
1330 [ + - ]: 175 : Reference< XComponent > xComp( mxTableFamily, UNO_QUERY );
1331 [ + - ]: 175 : if( xComp.is() )
1332 [ + - ][ + - ]: 175 : xComp->dispose();
1333 [ + - ]: 175 : mxTableFamily = 0;
1334 : :
1335 [ + - ]: 175 : SdStyleFamilyMap aTempMap;
1336 [ + - ]: 175 : aTempMap.swap( maStyleFamilyMap );
1337 : :
1338 [ + + ]: 187 : for( SdStyleFamilyMap::iterator iter( aTempMap.begin() ); iter != aTempMap.end(); ++iter ) try
1339 : : {
1340 [ + - ]: 12 : (*iter).second->dispose();
1341 : : }
1342 [ # # ]: 0 : catch( Exception& )
1343 : : {
1344 : : }
1345 : :
1346 : 175 : mpDoc = 0;
1347 : :
1348 [ + - ]: 175 : Clear();
1349 : : }
1350 [ # # ]: 175 : }
1351 : :
1352 : : // --------------------------------------------------------------------
1353 : :
1354 : 0 : void SAL_CALL SdStyleSheetPool::addEventListener( const Reference< XEventListener >& /*xListener*/ ) throw (RuntimeException)
1355 : : {
1356 : 0 : }
1357 : :
1358 : : // --------------------------------------------------------------------
1359 : :
1360 : 0 : void SAL_CALL SdStyleSheetPool::removeEventListener( const Reference< XEventListener >& /*aListener*/ ) throw (RuntimeException)
1361 : : {
1362 : 0 : }
1363 : :
1364 : : // --------------------------------------------------------------------
1365 : :
1366 : 0 : SdStyleSheetVector SdStyleSheetPool::CreateChildList( SdStyleSheet* pSheet )
1367 : : {
1368 : 0 : SdStyleSheetVector aResult;
1369 : :
1370 : 0 : sal_uInt16 nListenerCount = pSheet->GetListenerCount();
1371 [ # # ]: 0 : if (nListenerCount > 0)
1372 : : {
1373 [ # # ]: 0 : for (sal_uInt16 n = 0; n < nListenerCount; n++)
1374 : : {
1375 [ # # ][ # # ]: 0 : SdStyleSheet* pChild = dynamic_cast< SdStyleSheet* >( pSheet->GetListener(n) );
1376 [ # # ][ # # ]: 0 : if(pChild && pChild->GetParent() == pSheet->GetName())
[ # # ][ # # ]
[ # # ][ # # ]
1377 : : {
1378 [ # # ]: 0 : aResult.push_back( SdStyleSheetRef( pChild ) );
1379 : : }
1380 : : }
1381 : : }
1382 : :
1383 : 0 : return aResult;
1384 : : }
1385 : :
1386 : : // --------------------------------------------------------------------
1387 : :
1388 : 14482 : void SAL_CALL SdStyleSheetPool::acquire (void) throw ()
1389 : : {
1390 : 14482 : SdStyleSheetPoolBase::acquire();
1391 : 14482 : }
1392 : :
1393 : 14236 : void SAL_CALL SdStyleSheetPool::release (void) throw ()
1394 : : {
1395 : 14236 : SdStyleSheetPoolBase::release();
1396 : 14236 : }
1397 : :
1398 : : // --------------------------------------------------------------------
1399 : :
1400 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|