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