xref: /aoo41x/main/sd/source/core/drawdoc4.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 
31 #include <com/sun/star/style/XStyle.hpp>
32 #include <com/sun/star/container/XNameAccess.hpp>
33 
34 #include <tools/urlobj.hxx>
35 #include <sfx2/docfile.hxx>
36 #include <sfx2/dispatch.hxx>
37 #include "Outliner.hxx"
38 #include <comphelper/processfactory.hxx>
39 #include <editeng/outliner.hxx>
40 
41 #include "../ui/inc/DrawDocShell.hxx"
42 #include <editeng/eeitem.hxx>
43 #include <vcl/svapp.hxx>
44 #include <eetext.hxx>
45 
46 #include <editeng/akrnitem.hxx>
47 
48 #include <svx/svxids.hrc>
49 #include <svl/srchitem.hxx>
50 #include <editeng/lrspitem.hxx>
51 #include <editeng/ulspitem.hxx>
52 #include <editeng/lspcitem.hxx>
53 #include <editeng/adjitem.hxx>
54 #include <svx/dialogs.hrc>
55 #include <svx/dialmgr.hxx>					// SVX_RESSTR
56 #include <editeng/bulitem.hxx>
57 #include <svx/xtable.hxx>
58 #include <svx/sxmsuitm.hxx>
59 #include <editeng/borderline.hxx>
60 #include <editeng/boxitem.hxx>
61 #include <svx/xit.hxx>
62 #include <svx/xlineit0.hxx>
63 #include <svx/sdshitm.hxx>
64 #include <svx/svdotext.hxx>
65 #include <svx/xfillit0.hxx>
66 #include <svx/sdshcitm.hxx>
67 #include <editeng/editstat.hxx>
68 #include <editeng/colritem.hxx>
69 #include <editeng/fhgtitem.hxx>
70 #include <editeng/wghtitem.hxx>
71 #include <editeng/postitem.hxx>
72 #include <editeng/crsditem.hxx>
73 #include <editeng/udlnitem.hxx>
74 #include <editeng/cntritem.hxx>
75 #ifndef _SVX_EMPHITEM_HXX
76 #include <editeng/emphitem.hxx>
77 #endif
78 #include <editeng/fontitem.hxx>
79 #include <editeng/shdditem.hxx>
80 #include <svx/xbtmpit.hxx>
81 #include <svx/xflhtit.hxx>
82 #include <svx/xflgrit.hxx>
83 #include <svx/xflclit.hxx>
84 #include <svx/xlnedcit.hxx>
85 #include <svx/xlnstcit.hxx>
86 #include <svx/xlnedwit.hxx>
87 #include <svx/xlnstwit.hxx>
88 #include <svx/xlnedit.hxx>
89 #include <editeng/charreliefitem.hxx>
90 #include <svx/xlnstit.hxx>
91 #include <svx/xlndsit.hxx>
92 #include <svx/xlnwtit.hxx>
93 #include <svx/xlnclit.hxx>
94 #include <svx/svditer.hxx>
95 #include <svx/svdogrp.hxx>
96 #include <tools/shl.hxx>
97 #include <editeng/numitem.hxx>
98 #include <editeng/editeng.hxx>
99 #include <editeng/unolingu.hxx>
100 #include <com/sun/star/linguistic2/XHyphenator.hpp>
101 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
102 #include <svl/itempool.hxx>
103 #include <editeng/outlobj.hxx>
104 #include <sfx2/viewfrm.hxx>
105 #include <editeng/langitem.hxx>
106 #include <editeng/frmdiritem.hxx>
107 
108 #include "sdresid.hxx"
109 #include "drawdoc.hxx"
110 #include "sdpage.hxx"
111 #include "glob.hrc"
112 #include "glob.hxx"
113 #include "stlpool.hxx"
114 #include "helpids.h"
115 #include "sdiocmpt.hxx"
116 #include "shapelist.hxx"
117 #include <basegfx/point/b2dpoint.hxx>
118 #include <basegfx/polygon/b2dpolygon.hxx>
119 #include <svl/itemset.hxx>
120 #include "app.hrc"
121 
122 using ::rtl::OUString;
123 using namespace ::com::sun::star;
124 using namespace ::com::sun::star::uno;
125 using namespace ::com::sun::star::lang;
126 using namespace ::com::sun::star::style;
127 using namespace ::com::sun::star::container;
128 using namespace ::com::sun::star::linguistic2;
129 using namespace ::sd;
130 
131 /*************************************************************************
132 |*
133 |* CreateLayoutTemplates, Layoutvorlagen erzeugen
134 |*
135 |* Z.Zt. (31.03.95) speichert der StyleSheetPool nur diejenigen Sheets, die
136 |* ein ItemSet haben. Damit alle Sheets gespeichert werden, wird die ItemSet-
137 |* Erzeugung mit einem GetItemSet-Aufruf erzwungen.
138 |* Dies kann entfallen, sobald der Pool auch Sheets ohne ItemSet speichert.
139 |*
140 \************************************************************************/
141 
142 void SdDrawDocument::CreateLayoutTemplates()
143 {
144 	SdStyleSheetPool*       pSSPool = (SdStyleSheetPool*)GetStyleSheetPool();
145 	SfxStyleSheetBase*      pSheet = NULL;
146 	String                  aHelpFile;
147 	String                  aStdName = String(SdResId(STR_STANDARD_STYLESHEET_NAME));
148 
149 	// ---- Standardvorlage -----------------------------------------------
150 
151 	// nicht benutzt, nicht benutzerdefiniert
152 	// SB hatte wahrscheinlich Probleme mit SFXSTYLEBIT_AUTO, da dann gar nichts
153 	// mehr im Gestalter angezeigt wird. Dieses Problem ist zu 364 j behoben worden
154 	// sal_uInt16 nMask = SFXSTYLEBIT_ALL & ~(SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF);
155 	sal_uInt16 nMask = SFXSTYLEBIT_AUTO;
156 
157 	String aName(aStdName);
158 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
159 	pSheet->SetHelpId( aHelpFile, HID_STANDARD_STYLESHEET_NAME );
160 	SfxItemSet& rISet = pSheet->GetItemSet();
161 	SfxItemPool* pPool = rISet.GetPool();
162 
163 	String	 aNullStr;
164 
165 	::basegfx::B2DPolyPolygon aNullPolyPolygon;
166 	Color	 aNullCol(RGB_Color(COL_DEFAULT_SHAPE_STROKE));
167 
168 	XDash	  aNullDash;
169 	XGradient aNullGrad(aNullCol,RGB_Color(COL_WHITE));
170 			  aNullGrad.SetStartIntens( 100 );
171 			  aNullGrad.SetEndIntens( 100 );
172 	XHatch	  aNullHatch(aNullCol);
173 
174 					// Linienattribute (Extended OutputDevice)
175 	rISet.Put(XLineStyleItem(XLINE_SOLID));
176 	rISet.Put(XLineColorItem(String(), RGB_Color(COL_DEFAULT_SHAPE_STROKE)));
177 	rISet.Put(XLineWidthItem(0));
178 	rISet.Put(XLineDashItem(pPool,aNullDash));
179 	rISet.Put(XLineStartItem(pPool,aNullPolyPolygon));
180 	rISet.Put(XLineEndItem(pPool,aNullPolyPolygon));
181 	rISet.Put(XLineStartWidthItem(200));
182 	rISet.Put(XLineEndWidthItem(200));
183 	rISet.Put(XLineStartCenterItem());
184 	rISet.Put(XLineEndCenterItem());
185 	rISet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK));
186 
187 					// Fuellattribute (Extended OutputDevice)
188 	rISet.Put(XFillStyleItem(XFILL_SOLID));
189 	rISet.Put(XFillColorItem(String(), RGB_Color(COL_DEFAULT_SHAPE_FILLING)));
190 
191 	rISet.Put(XFillGradientItem(pPool,aNullGrad));
192 	rISet.Put(XFillHatchItem(pPool,aNullHatch));
193     Size    aNullSize( 32, 32 );
194     Color   aNullColor( COL_WHITE );
195 	Bitmap  aNullBmp( aNullSize, 8 );
196     aNullBmp.Erase( aNullColor );
197 	rISet.Put(XFillBitmapItem(pPool,aNullBmp));
198 
199 					// Schattenattribute (Drawing Engine)
200 	rISet.Put(SdrShadowItem(sal_False));
201 	rISet.Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
202 	rISet.Put(SdrShadowXDistItem(200)); 		// 3 mm Schattendistanz
203 	rISet.Put(SdrShadowYDistItem(200));
204 
205 	Font aLatinFont, aCJKFont, aCTLFont;
206 
207 	getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
208 
209 	SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
210 		                      aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
211 
212 	SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
213 		                         aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
214 
215 	SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
216 		                         aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
217 
218 	rISet.Put( aSvxFontItem );
219 	rISet.Put( aSvxFontItemCJK );
220 	rISet.Put( aSvxFontItemCTL );
221 
222 	rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT ) );     // sj: (i33745) changed default from 24 to 18 pt
223 	rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 18 pt
224 	rISet.Put( SvxFontHeightItem( convertFontHeightToCTL( 635 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 18 pt
225 
226 	rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
227 	rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
228 	rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
229 
230 	rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
231 	rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
232 	rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
233 
234     rISet.Put(SvxContourItem(sal_False, EE_CHAR_OUTLINE ));
235     rISet.Put(SvxShadowedItem(sal_False, EE_CHAR_SHADOW ));
236     rISet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE));
237     rISet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE));
238     rISet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
239     rISet.Put(SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK));
240     rISet.Put(SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF));
241     rISet.Put(SvxColorItem(Color(COL_AUTO), EE_CHAR_COLOR ));
242 
243     // Absatzattribute (Edit Engine)
244     rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE));
245     rISet.Put(SvxULSpaceItem(EE_PARA_ULSPACE));
246 
247 	rISet.Put( SdrTextLeftDistItem( 250 ) );	// sj: (i33745) using text frame distances seems to be a better default
248 	rISet.Put( SdrTextRightDistItem( 250 ) );
249 	rISet.Put( SdrTextUpperDistItem( 125 ) );
250 	rISet.Put( SdrTextLowerDistItem( 125 ) );
251 
252     rISet.Put( SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL ) );
253 
254 	// #i16874# enable kerning by default but only for new documents
255 	rISet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
256 
257 	// Bullet
258 	// BulletItem und BulletFont fuer Titel und Gliederung
259 	SvxBulletItem aBulletItem(EE_PARA_BULLET);
260 							// die sind in allen Ebenen identisch
261 	aBulletItem.SetStyle(BS_BULLET);
262 	aBulletItem.SetStart(1);
263 	aBulletItem.SetScale(45);			// in Prozent
264 
265 	Font aBulletFont( pSSPool->GetBulletFont() );
266 
267 	aBulletFont.SetSize(Size(0,635));	// sj: (i33745) changed default from 24 to 18 pt
268 
269 	aBulletItem.SetFont(aBulletFont);
270 	aBulletItem.SetSymbol( 0x25CF );					// Punkt
271 	rISet.Put(aBulletItem);
272 
273 //	SfxUInt16Item aBulletStateItem(EE_PARA_BULLETSTATE, 0); // Bullets nicht sichtbar
274 //	rISet.Put(aBulletStateItem);
275 
276 	// Neues BulletItem
277 	pSSPool->PutNumBulletItem( pSheet, aBulletFont );
278 
279 	SfxItemSet* pISet = NULL;
280 
281 	// ---- Objekt mit Pfeilspitze ----------------------------------------
282 
283 	aName = String(SdResId(STR_POOLSHEET_OBJWITHARROW));
284 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
285 	pSheet->SetParent(aStdName);
286 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHARROW );
287 	pISet = &pSheet->GetItemSet();
288 
289 	pISet->Put(XLineStyleItem(XLINE_SOLID));
290 	pISet->Put(XLineColorItem(String(), RGB_Color(COL_BLACK)));
291 	pISet->Put(XLineWidthItem(150));
292 
293 	::basegfx::B2DPolygon aArrow;
294 	aArrow.append(::basegfx::B2DPoint(10.0, 0.0));
295 	aArrow.append(::basegfx::B2DPoint(0.0, 30.0));
296 	aArrow.append(::basegfx::B2DPoint(20.0, 30.0));
297 	aArrow.setClosed(true);
298 	pISet->Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
299 
300 	pISet->Put(XLineStartWidthItem(700));
301 	pISet->Put(XLineEndWidthItem(300));
302 	pISet->Put(XLineStartCenterItem(sal_True));
303 
304 	// ---- Objekt mit Schatten -------------------------------------------
305 
306 	aName = String(SdResId(STR_POOLSHEET_OBJWITHSHADOW));
307 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
308 	pSheet->SetParent(aStdName);
309 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHSHADOW );
310 	pISet = &pSheet->GetItemSet();
311 
312 	pISet->Put(SdrShadowItem(sal_True));
313 	pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
314 	pISet->Put(SdrShadowXDistItem(200));		// 3 mm Schattendistanz
315 	pISet->Put(SdrShadowYDistItem(200));
316 
317 	// ---- Objekt ohne F�llung -------------------------------------------
318 
319 	aName = String(SdResId(STR_POOLSHEET_OBJWITHOUTFILL));
320 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
321 	pSheet->SetParent(aStdName);
322 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHOUTFILL );
323 	pISet = &pSheet->GetItemSet();
324 
325 	pISet->Put(XFillStyleItem(XFILL_NONE));
326 	pISet->Put(XLineColorItem(String(), RGB_Color(COL_BLACK)));
327 
328 	// ---- Text ----------------------------------------------------------
329 
330 	aName = String(SdResId(STR_POOLSHEET_TEXT));
331 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
332 	pSheet->SetParent(aStdName);
333 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXT );
334 	pISet = &pSheet->GetItemSet();
335 
336 	pISet->Put(XLineStyleItem(XLINE_NONE));
337 	pISet->Put(XFillStyleItem(XFILL_NONE));
338 
339 	// ---- Textk�rper ----------------------------------------------------
340 
341 	aName = String(SdResId(STR_POOLSHEET_TEXTBODY));
342 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
343 	pSheet->SetParent(aStdName);
344 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY );
345 	pISet = &pSheet->GetItemSet();
346 
347 	pISet->Put(XLineStyleItem(XLINE_NONE));
348 	pISet->Put(XFillStyleItem(XFILL_NONE));
349 
350     pISet->Put(SvxFontHeightItem(564, 100, EE_CHAR_FONTHEIGHT));        // 16 pt
351 
352 	// ---- Textk�rper mit Blocksatz --------------------------------------
353 
354 	aName = String(SdResId(STR_POOLSHEET_TEXTBODY_JUSTIFY));
355 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
356 	pSheet->SetParent(aStdName);
357 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY_JUSTIFY );
358 	pISet = &pSheet->GetItemSet();
359 
360 	pISet->Put(XLineStyleItem(XLINE_NONE));
361 	pISet->Put(XFillStyleItem(XFILL_NONE));
362 
363     pISet->Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST ));
364 
365 	// ---- Textkoerper mit Einzug -----------------------------------------
366 
367 	aName = String(SdResId(STR_POOLSHEET_TEXTBODY_INDENT));
368 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
369 	pSheet->SetParent(aStdName);
370 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY_INDENT );
371 	pISet = &pSheet->GetItemSet();
372 
373 	pISet->Put(XLineStyleItem(XLINE_NONE));
374 	pISet->Put(XFillStyleItem(XFILL_NONE));
375 
376     SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE );
377 	aLRSpaceItem.SetTxtFirstLineOfst(600); 		// Erstzeileneinzug 6mm, rechts 0
378 	pISet->Put(aLRSpaceItem);
379 
380 /* #i35937#
381 	// SvxLRSpaceItem hart gesetzt: NumBulletItem anpassen
382 	SvxNumBulletItem aNumBullet( (const SvxNumBulletItem&) pISet->Get(EE_PARA_NUMBULLET) );
383 	EditEngine::ImportBulletItem( aNumBullet, 0, NULL, &aLRSpaceItem );
384 	pISet->Put( aNumBullet );
385 */
386 	// ---- Titel ---------------------------------------------------------
387 
388 	aName = String(SdResId(STR_POOLSHEET_TITLE));
389 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
390 	pSheet->SetParent(aStdName);
391 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE );
392 	pISet = &pSheet->GetItemSet();
393 
394 	pISet->Put(XLineStyleItem(XLINE_NONE));
395 	pISet->Put(XFillStyleItem(XFILL_NONE));
396 
397     pISet->Put(SvxFontHeightItem(1551, 100, EE_CHAR_FONTHEIGHT ));      // 44 pt
398 
399 	// ---- Titel1 --------------------------------------------------------
400 
401 	aName = String(SdResId(STR_POOLSHEET_TITLE1));
402 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
403 	pSheet->SetParent(aStdName);
404 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE1 );
405 	pISet = &pSheet->GetItemSet();
406 
407 	pISet->Put(XLineStyleItem(XLINE_NONE));
408 	pISet->Put(XFillStyleItem(XFILL_SOLID));
409 	pISet->Put(XFillColorItem(String(), RGB_Color(COL_CYAN)));
410 
411 	pISet->Put(SdrShadowItem(sal_True));
412 	pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
413 	pISet->Put(SdrShadowXDistItem(200));		// 2 mm Schattendistanz
414 	pISet->Put(SdrShadowYDistItem(200));
415 
416     pISet->Put(SvxFontHeightItem(846, 100, EE_CHAR_FONTHEIGHT ));       // 24 pt
417 
418     pISet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
419 
420 	// ---- Titel2 --------------------------------------------------------
421 
422 	aName = String(SdResId(STR_POOLSHEET_TITLE2));
423 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
424 	pSheet->SetParent(aStdName);
425 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE2 );
426 	pISet = &pSheet->GetItemSet();
427 
428 	pISet->Put(XLineWidthItem(50));
429 
430 	// Farbe nicht aus der Farbtabelle holen, denn da kann diese Farbe
431 	// geloescht oder veraendert sein
432 	Color aOrange4(255, 204, 153);
433 	pISet->Put(XFillColorItem(String(), aOrange4));
434 
435 	pISet->Put(SdrShadowItem(sal_True));
436 	pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
437 	pISet->Put(SdrShadowXDistItem(200));		// 2 mm Schattendistanz
438 	pISet->Put(SdrShadowYDistItem(200));
439 
440     pISet->Put(SvxFontHeightItem(1270, 100, EE_CHAR_FONTHEIGHT ));      // 36 pt
441 
442     SvxLRSpaceItem aLRSpItem( 200, 200, 0, 0, EE_PARA_LRSPACE);
443 	pISet->Put( aLRSpItem );	// Erstzeileneinzug 0 mm, links und rechts 2 mm
444 
445 /* #i35937#
446 	// SvxLRSpaceItem hart gesetzt: NumBulletItem anpassen
447 	SvxNumBulletItem aNmBullet( (const SvxNumBulletItem&) pISet->Get(EE_PARA_NUMBULLET) );
448 	EditEngine::ImportBulletItem( aNmBullet, 0, NULL, &aLRSpItem );
449 	pISet->Put( aNmBullet );
450 */
451 
452     pISet->Put(SvxULSpaceItem(100, 100, EE_PARA_ULSPACE ));      // Absatzrand oben/unten 1 mm
453 
454     pISet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
455 
456 	// ---- Ueberschrift ---------------------------------------------------
457 
458 	aName = String(SdResId(STR_POOLSHEET_HEADLINE));
459 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
460 	pSheet->SetParent(aStdName);
461 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE );
462 	pISet = &pSheet->GetItemSet();
463 
464 	pISet->Put(XLineStyleItem(XLINE_NONE));
465 	pISet->Put(XFillStyleItem(XFILL_NONE));
466 
467     pISet->Put(SvxFontHeightItem(846, 100, EE_CHAR_FONTHEIGHT ));        // 24 pt
468 
469     pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE ));      // Absatzrand oben 4,2 mm,
470 												// unten 2,1 mm
471 
472 	// ---- Ueberschrift1 --------------------------------------------------
473 
474 	aName = String(SdResId(STR_POOLSHEET_HEADLINE1));
475 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
476 	pSheet->SetParent(aStdName);
477 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE1 );
478 	pISet = &pSheet->GetItemSet();
479 
480 	pISet->Put(XLineStyleItem(XLINE_NONE));
481 	pISet->Put(XFillStyleItem(XFILL_NONE));
482 
483     pISet->Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT ));
484 
485     pISet->Put(SvxFontHeightItem(635, 100, EE_CHAR_FONTHEIGHT ));       // 18 pt
486 
487     pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE ));      // Absatzrand oben 4,2 mm,
488 												// unten 2,1 mm
489 
490 	// ---- Ueberschrift2 --------------------------------------------------
491 
492 	aName = String(SdResId(STR_POOLSHEET_HEADLINE2));
493 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
494 	pSheet->SetParent(aStdName);
495 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE2 );
496 	pISet = &pSheet->GetItemSet();
497 
498 	pISet->Put(XLineStyleItem(XLINE_NONE));
499 	pISet->Put(XFillStyleItem(XFILL_NONE));
500 
501     pISet->Put(SvxPostureItem(ITALIC_NORMAL, EE_CHAR_ITALIC ));
502     pISet->Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT));
503 
504     pISet->Put(SvxFontHeightItem(494, 100, EE_CHAR_FONTHEIGHT ));        // 14 pt
505 
506     pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE ));      // Absatzrand oben 4,2 mm,
507 												// unten 2,1 mm
508 
509 	// ---- Bemassung --------------------------------------------------
510 
511 	aName = String(SdResId(STR_POOLSHEET_MEASURE));
512 	pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
513 	pSheet->SetParent(aStdName);
514 	pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_MEASURE );
515 	pISet = &pSheet->GetItemSet();
516 
517 	pISet->Put(XFillStyleItem(XFILL_NONE));
518 	pISet->Put(XLineColorItem(String(), RGB_Color(COL_BLACK)));
519 
520     pISet->Put(SvxFontHeightItem(423, 100, EE_CHAR_FONTHEIGHT ));         // 12 pt
521 
522 	pISet->Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
523 	pISet->Put(XLineStartWidthItem(200));
524 	pISet->Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
525 	pISet->Put(XLineEndWidthItem(200));
526 	pISet->Put(XLineStyleItem(XLINE_SOLID));
527 	pISet->Put(SdrMeasureShowUnitItem(true));
528 
529 	// Praesentationsvorlagen fuer das Standardlayout erzeugen
530 	String aPrefix = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
531 	pSSPool->CreateLayoutStyleSheets(aPrefix);
532 }
533 
534 static Any implMakeSolidCellStyle( SdStyleSheetPool* pSSPool, const OUString& rName, const OUString rParent, const Color& rColor )
535 {
536 	SfxStyleSheetBase* pSheet = &(pSSPool->Make(rName, SD_STYLE_FAMILY_CELL, SFXSTYLEBIT_AUTO));
537 	pSheet->SetParent(rParent);
538 	SfxItemSet* pISet = &pSheet->GetItemSet();
539 	pISet->Put(XFillStyleItem(XFILL_SOLID));
540 	pISet->Put(XFillColorItem(String(), rColor));
541 
542 	return Any( Reference< XStyle >( static_cast< XWeak* >( pSheet ), UNO_QUERY ) );
543 }
544 
545 static void implCreateTableTemplate( const Reference< XNameContainer >& xTableFamily, const OUString& rName, const Any& rBody, const Any& rHeading, const Any& rBanding )
546 {
547 	if( xTableFamily.is() ) try
548 	{
549         if( !xTableFamily->hasByName( OUString( rName ) ) )
550         {
551 		    Reference< XSingleServiceFactory > xFactory( xTableFamily, UNO_QUERY_THROW );
552 		    Reference< XNameReplace > xDefaultTableStyle( xFactory->createInstance(), UNO_QUERY_THROW );
553 		    xTableFamily->insertByName( OUString( rName ), Any( xDefaultTableStyle ) );
554 
555 		    xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("body") ), rBody  );
556 		    xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("odd-rows") ), rBanding );
557 		    xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("odd-columns") ), rBanding );
558 		    xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("first-row") ), rHeading );
559 		    xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("first-column") ), rHeading );
560 		    xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("last-row") ), rHeading );
561 		    xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("last-column") ), rHeading );
562         }
563 	}
564 	catch( Exception& )
565 	{
566 		DBG_ERROR("sd::implCreateTableTemplate(), exception caught!");
567 	}
568 }
569 
570 void SdDrawDocument::CreateDefaultCellStyles()
571 {
572 	SdStyleSheetPool*       pSSPool = static_cast< SdStyleSheetPool* >(GetStyleSheetPool());
573 	SfxStyleSheetBase*      pSheet = NULL;
574 	String                  aHelpFile;
575 
576 	const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM( "table" ) );
577 	Reference< XNameContainer > xTableFamily( pSSPool->getByName( sFamilyName ), UNO_QUERY );
578 
579 	// ---- Default -----------------------------------------------
580 
581 	sal_uInt16 nMask = SFXSTYLEBIT_AUTO;
582 
583 	OUString aDefaultCellStyleName( RTL_CONSTASCII_USTRINGPARAM("default") );
584 
585 	pSheet = &(pSSPool->Make(aDefaultCellStyleName, SD_STYLE_FAMILY_CELL, nMask));
586 	pSheet->SetHelpId( aHelpFile, HID_SD_CELL_STYLE_DEFAULT );
587 	SfxItemSet& rISet = pSheet->GetItemSet();
588 //	SfxItemPool* pPool = rISet.GetPool();
589 
590 	String	 aNullStr;
591 
592 	Color	 aNullCol(RGB_Color(COL_BLACK));
593 
594 	XDash	  aNullDash;
595 	XGradient aNullGrad(aNullCol,RGB_Color(COL_WHITE));
596 			  aNullGrad.SetStartIntens( 100 );
597 			  aNullGrad.SetEndIntens( 100 );
598 	XHatch	  aNullHatch(aNullCol);
599 
600 	rISet.Put(XFillStyleItem(XFILL_SOLID));
601 	rISet.Put(XFillColorItem(String(), RGB_Color(0x00ccccff)));
602 
603 	Font aLatinFont, aCJKFont, aCTLFont;
604 
605 	getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
606 
607 	SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
608 		                      aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
609 
610 	SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
611 		                         aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
612 
613 	SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
614 		                         aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
615 
616 	rISet.Put( aSvxFontItem );
617 	rISet.Put( aSvxFontItemCJK );
618 	rISet.Put( aSvxFontItemCTL );
619 
620 	rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT ) );     // sj: (i33745) changed default from 24 to 18 pt
621 	rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 18 pt
622 	rISet.Put( SvxFontHeightItem( convertFontHeightToCTL( 635 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 18 pt
623 
624 //	rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
625 //	rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
626 //	rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
627 
628 //	rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
629 //	rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
630 //	rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
631 
632 //    rISet.Put(SvxContourItem(sal_False, EE_CHAR_OUTLINE ));
633 //    rISet.Put(SvxShadowedItem(sal_False, EE_CHAR_SHADOW ));
634 //    rISet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE));
635 //    rISet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE));
636 //    rISet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
637 //    rISet.Put(SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK));
638 //    rISet.Put(SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF));
639     rISet.Put(SvxColorItem(Color(COL_AUTO), EE_CHAR_COLOR ));
640 
641     // Absatzattribute (Edit Engine)
642     rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE));
643     rISet.Put(SvxULSpaceItem(EE_PARA_ULSPACE));
644 
645 	rISet.Put( SdrTextLeftDistItem( 250 ) );
646 	rISet.Put( SdrTextRightDistItem( 250 ) );
647 	rISet.Put( SdrTextUpperDistItem( 130 ) );
648 	rISet.Put( SdrTextLowerDistItem( 130 ) );
649 
650     rISet.Put( SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL ) );
651 	rISet.Put( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );
652 	rISet.Put( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) );
653 	rISet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT) );
654 
655 	Color aWhite( COL_WHITE );
656 	SvxBorderLine aBorderLine( &aWhite, 1, 0, 0 );
657 
658 	SvxBoxItem aBoxItem( SDRATTR_TABLE_BORDER );
659 	aBoxItem.SetLine( &aBorderLine, BOX_LINE_TOP );
660 	aBoxItem.SetLine( &aBorderLine, BOX_LINE_BOTTOM );
661 	aBoxItem.SetLine( &aBorderLine, BOX_LINE_LEFT );
662 	aBoxItem.SetLine( &aBorderLine, BOX_LINE_RIGHT );
663 
664 	rISet.Put( aBoxItem );
665 
666 	Any aDefaultCellStyle( Reference< XStyle >( static_cast< XWeak* >( pSheet ), UNO_QUERY ) );
667 
668 	// ---- default --------------------------------------------------
669 
670 	Any aBlue1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("blue1") ), aDefaultCellStyleName, RGB_COLORDATA(153,204,255)));
671 	Any aBlue2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("blue2") ), aDefaultCellStyleName, RGB_COLORDATA(0,153,255)));
672 	Any aBlue3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("blue3") ), aDefaultCellStyleName, RGB_COLORDATA(0,102,204)));
673 
674 	implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("default")), aBlue1, aBlue3, aBlue2 );
675 
676 	// ---- BW ------------------------------------------------
677 
678 	Any aBW1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("bw1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,255)));
679 	Any aBW2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("bw2") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,230)));
680 	Any aBW3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("bw3") ), aDefaultCellStyleName, RGB_COLORDATA(0,0,0)));
681 
682 	implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("bw") ), aBW1, aBW3, aBW2 );
683 
684 	// ---- Orange --------------------------------------------------
685 
686 	Any aOrange1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("orange1") ), aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
687 	Any aOrange2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("orange2") ), aDefaultCellStyleName, RGB_COLORDATA(255,153,102)));
688 	Any aOrange3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("orange3") ), aDefaultCellStyleName, RGB_COLORDATA(255,102,51)));
689 
690 	implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("orange") ), aOrange1, aOrange3, aOrange2 );
691 
692 	// ---- Turquise --------------------------------------------------
693 
694 	Any aTurquise1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("turquise1") ), aDefaultCellStyleName, RGB_COLORDATA(71,184,184)));
695 	Any aTurquise2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("turquise2") ), aDefaultCellStyleName, RGB_COLORDATA(51,163,163)));
696 	Any aTurquise3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("turquise3") ), aDefaultCellStyleName, RGB_COLORDATA(25,138,138)));
697 
698 	implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("turquise") ), aTurquise1, aTurquise3, aTurquise2 );
699 
700 	// ---- Gray ------------------------------------------------
701 
702 	Any aGray1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("gray1") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,230)));
703 	Any aGray2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("gray2") ), aDefaultCellStyleName, RGB_COLORDATA(204,204,204)));
704 	Any aGray3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("gray3") ), aDefaultCellStyleName, RGB_COLORDATA(179,179,179)));
705 
706 	implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("gray") ), aGray1, aGray3, aGray2 );
707 
708 	// ---- Sun ------------------------------------------------
709 
710 	Any aSun1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("sun1") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,255)));
711 	Any aSun2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("sun2") ), aDefaultCellStyleName, RGB_COLORDATA(204,204,255)));
712 	Any aSun3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("sun3") ), aDefaultCellStyleName, RGB_COLORDATA(153,153,255)));
713 
714 	implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("sun") ), aSun1, aSun3, aSun2 );
715 
716 	// ---- Earth ----------------------------------------------
717 
718 	Any aEarth1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("earth1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
719 	Any aEarth2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("earth2") ), aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
720 	Any aEarth3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("earth3") ), aDefaultCellStyleName, RGB_COLORDATA(204,102,51)));
721 
722 	implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("earth") ), aEarth1, aEarth3, aEarth2 );
723 
724 	// ---- Green ----------------------------------------------
725 
726 	Any aGreen1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("green1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
727 	Any aGreen2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("green2") ), aDefaultCellStyleName, RGB_COLORDATA(148,189,94)));
728 	Any aGreen3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("green3") ), aDefaultCellStyleName, RGB_COLORDATA(92,133,38)));
729 
730 	implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("green") ), aGreen1, aGreen3, aGreen2 );
731 
732 	// ---- Seetang ----------------------------------------------
733 
734 	Any aSeetang1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("seetang1") ), aDefaultCellStyleName, RGB_COLORDATA(204,255,255)));
735 	Any aSeetang2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("seetang2") ), aDefaultCellStyleName, RGB_COLORDATA(71,184,184)));
736 	Any aSeetang3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("seetang3") ), aDefaultCellStyleName, RGB_COLORDATA(51,163,163)));
737 
738 	implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("seetang") ), aSeetang1, aSeetang3, aSeetang2 );
739 
740 	// ---- LightBlue ----------------------------------------------
741 
742 	Any aLightBlue1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("lightblue1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,255)));
743 	Any aLightBlue2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("lightblue2") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,255)));
744 	Any aLightBlue3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("lightblue3") ), aDefaultCellStyleName, RGB_COLORDATA(153,153,204)));
745 
746 	implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("lightblue") ), aLightBlue1, aLightBlue3, aLightBlue2 );
747 
748 	// ---- Yellow ----------------------------------------------
749 
750 	Any aYellow1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("yellow1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
751 	Any aYellow2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("yellow2") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,153)));
752 	Any aYellow3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("yellow3") ), aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
753 
754 	implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("yellow") ), aYellow1, aYellow3, aYellow2 );
755 }
756 
757 /*************************************************************************
758 |*
759 |* Anzahl der Seiten, die eine masterPage referenzieren
760 |*
761 \************************************************************************/
762 
763 sal_uInt16 SdDrawDocument::GetMasterPageUserCount(SdrPage* pMaster) const
764 {
765 	sal_uInt16 nResult = 0;
766 	sal_uInt16 nPage;
767 	sal_uInt16 nPageCount = GetPageCount();
768 
769 	for (nPage = 0; nPage < nPageCount; nPage++)
770 	{
771 		const SdrPage* pPage = GetPage(nPage);
772 
773 		if(pPage->TRG_HasMasterPage())
774 		{
775 			if(&(pPage->TRG_GetMasterPage()) == pMaster)
776 			{
777 				nResult++;
778 			}
779 		}
780 	}
781 	return nResult;
782 }
783 
784 
785 /*************************************************************************
786 |*
787 |* OnlineSpelling im Hintergrund beenden
788 |*
789 \************************************************************************/
790 
791 void SdDrawDocument::StopOnlineSpelling()
792 {
793 	if (mpOnlineSpellingTimer && mpOnlineSpellingTimer->IsActive())
794 	{
795 		mpOnlineSpellingTimer->Stop();
796 	}
797 
798 	delete mpOnlineSpellingTimer;
799 	mpOnlineSpellingTimer = NULL;
800 
801 	delete mpOnlineSpellingList;
802 	mpOnlineSpellingList = NULL;
803 }
804 
805 /*************************************************************************
806 |*
807 |* OnlineSpelling im Hintergrund starten
808 |*
809 \************************************************************************/
810 
811 void SdDrawDocument::StartOnlineSpelling(sal_Bool bForceSpelling)
812 {
813 	if (mbOnlineSpell && (bForceSpelling || mbInitialOnlineSpellingEnabled) &&
814 	    mpDocSh && !mpDocSh->IsReadOnly() )
815 	{
816 		StopOnlineSpelling();
817 
818 		::sd::Outliner* pOutl = GetInternalOutliner(sal_True);
819 
820 	    Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
821 	    if ( xSpellChecker.is() )
822 		    pOutl->SetSpeller( xSpellChecker );
823 
824 	    Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
825 	    if( xHyphenator.is() )
826 		    pOutl->SetHyphenator( xHyphenator );
827 
828 		pOutl->SetDefaultLanguage( meLanguage );
829 
830 		mpOnlineSpellingList = new ShapeList;
831 		sal_uInt16 nPage;
832 
833 		for ( nPage = 0; nPage < GetPageCount(); nPage++ )
834 		{
835 			// Alle Pages durchsuchen
836 			FillOnlineSpellingList((SdPage*) GetPage(nPage));
837 		}
838 
839 		for (nPage = 0; nPage < GetMasterPageCount(); nPage++)
840 		{
841 			// Alle MasterPages durchsuchen
842 			FillOnlineSpellingList((SdPage*) GetMasterPage(nPage));
843 		}
844 
845 		mpOnlineSpellingList->seekShape(0);
846 		mpOnlineSpellingTimer = new Timer();
847 		mpOnlineSpellingTimer->SetTimeoutHdl( LINK(this, SdDrawDocument, OnlineSpellingHdl) );
848 		mpOnlineSpellingTimer->SetTimeout(250);
849 		mpOnlineSpellingTimer->Start();
850 	}
851 }
852 
853 /*************************************************************************
854 |*
855 |* OnlineSpelling-Liste fuellen
856 |*
857 \************************************************************************/
858 
859 void SdDrawDocument::FillOnlineSpellingList(SdPage* pPage)
860 {
861 	SdrObject* pObj = NULL;
862 	SdrObjListIter aIter(*pPage, IM_FLAT);
863 
864 	while (aIter.IsMore())
865 	{
866 		pObj = aIter.Next();
867 
868 		if( !pObj )
869 			continue;
870 
871 		if (pObj->GetOutlinerParaObject())
872 		{
873 			// Textobjekt gefunden
874 			mpOnlineSpellingList->addShape(*pObj);
875 		}
876 		else if (pObj->GetObjIdentifier() == OBJ_GRUP)
877 		{
878 			// Gruppenobjekt gefunden
879 			SdrObjListIter aGroupIter(*((SdrObjGroup*)pObj)->GetSubList(),
880 									  IM_DEEPNOGROUPS);
881 
882 			sal_Bool bSubTextObjFound = sal_False;
883 
884 			while (aGroupIter.IsMore() && !bSubTextObjFound)
885 			{
886 				if (aGroupIter.Next()->GetOutlinerParaObject())
887 				{
888 					// Textobjekt im Gruppenobjekt gefunden
889 					bSubTextObjFound = sal_True;
890 				}
891 			}
892 
893 			if (bSubTextObjFound)
894 			{
895 				mpOnlineSpellingList->addShape(*pObj);
896 			}
897 		}
898 	}
899 }
900 
901 /*************************************************************************
902 |*
903 |* OnlineSpelling im Hintergrund
904 |*
905 \************************************************************************/
906 
907 IMPL_LINK(SdDrawDocument, OnlineSpellingHdl, Timer*, EMPTYARG )
908 {
909 	if (mpOnlineSpellingList!=NULL
910         && ( !mbOnlineSpell || mpOnlineSpellingList->hasMore()))
911 	{
912 		/**********************************************************************
913 		* Naechstes Objekt spellen
914 		**********************************************************************/
915 		SdrObject* pObj = mpOnlineSpellingList->getNextShape();
916 
917 		if (pObj)
918 		{
919 			if (pObj->GetOutlinerParaObject() && pObj->ISA(SdrTextObj))
920 			{
921 				// Textobjekt spellen
922 				SpellObject((SdrTextObj*) pObj);
923 			}
924 			else if (pObj->GetObjIdentifier() == OBJ_GRUP)
925 			{
926 				// Gruppenobjekt gefunden
927 				SdrObjListIter aGroupIter(*((SdrObjGroup*)pObj)->GetSubList(),
928 										  IM_DEEPNOGROUPS);
929 
930 				SdrObject* pSubObj = NULL;
931 
932 				while (aGroupIter.IsMore())
933 				{
934 					pSubObj = aGroupIter.Next();
935 
936 					if (pSubObj->GetOutlinerParaObject() && pSubObj->ISA(SdrTextObj))
937 					{
938 						// Textobjekt im Gruppenobjekt gefunden
939 						SpellObject((SdrTextObj*) pSubObj);
940 					}
941 				}
942 			}
943 		}
944 
945 		// Weitersuchen
946 		mpOnlineSpellingTimer->Start();
947 	}
948 	else
949 	{
950 		// Spelling wurde initial durchgefuehrt
951 		mbInitialOnlineSpellingEnabled = sal_False;
952 
953 		// Suche beenden
954 		StopOnlineSpelling();
955 
956 		delete mpOnlineSearchItem;
957 		mpOnlineSearchItem = NULL;
958 	}
959 
960 	return(0);
961 }
962 
963 /*************************************************************************
964 |*
965 |* Objekt spellen (fuer OnlineSpelling)
966 |*
967 \************************************************************************/
968 
969 void SdDrawDocument::SpellObject(SdrTextObj* pObj)
970 {
971 	if (pObj && pObj->GetOutlinerParaObject() /* && pObj != pView->GetTextEditObject() */)
972 	{
973 		mbHasOnlineSpellErrors = sal_False;
974 		::sd::Outliner* pOutl = GetInternalOutliner(sal_True);
975 		pOutl->SetUpdateMode(sal_True);
976 		Link aEvtHdl = pOutl->GetStatusEventHdl();
977 		pOutl->SetStatusEventHdl(LINK(this, SdDrawDocument, OnlineSpellEventHdl));
978 
979 		sal_uInt16 nOldOutlMode = pOutl->GetMode();
980 		sal_uInt16 nOutlMode = OUTLINERMODE_TEXTOBJECT;
981 		if (((SdrTextObj*) pObj)->GetObjInventor() == SdrInventor &&
982 			((SdrTextObj*) pObj)->GetObjIdentifier() == OBJ_OUTLINETEXT)
983 		{
984 			nOutlMode = OUTLINERMODE_OUTLINEOBJECT;
985 		}
986 		pOutl->Init( nOutlMode );
987 
988 		// Text in den Outliner setzen
989 		pOutl->SetText(*((SdrTextObj*) pObj)->GetOutlinerParaObject());
990 
991 		if (!mpOnlineSearchItem || pOutl->HasText(*mpOnlineSearchItem))
992 		{
993 			// Spelling
994 			pOutl->CompleteOnlineSpelling();
995 
996 			if (mbHasOnlineSpellErrors)
997 			{
998 				sd::ModifyGuard aGuard( this );
999 				SdrModel* pModel = pObj->GetModel();
1000 				sal_Bool bLock = sal_False;
1001 				if ( pModel )
1002 				{
1003 					bLock = pModel->isLocked();
1004 					pModel->setLock( sal_True );
1005 				}
1006 				// taking text from the outliner
1007 				((SdrTextObj*) pObj)->SetOutlinerParaObject( pOutl->CreateParaObject() );
1008 
1009 				pObj->BroadcastObjectChange();
1010 				if ( pModel )
1011 					pModel->setLock( bLock );
1012 			}
1013 		}
1014 
1015 		pOutl->SetStatusEventHdl(aEvtHdl);
1016 		pOutl->SetUpdateMode(sal_False);
1017 		pOutl->Init( nOldOutlMode );
1018 		mbHasOnlineSpellErrors = sal_False;
1019 	}
1020 }
1021 
1022 /*************************************************************************
1023 |*
1024 |* Objekt wurde ins Model eingefuegt
1025 |*
1026 \************************************************************************/
1027 void SdDrawDocument::InsertObject(SdrObject* pObj, SdPage* /*pPage*/)
1028 {
1029 	if(mpOnlineSpellingList && pObj)
1030 	{
1031 		if (pObj->GetOutlinerParaObject() || (pObj->GetObjIdentifier() == OBJ_GRUP))
1032 		{
1033 			// Objekt in OnlineSpelling-Liste aufnehmen
1034 			mpOnlineSpellingList->addShape(*pObj);
1035 		}
1036 	}
1037 }
1038 
1039 /*************************************************************************
1040 |*
1041 |* Objekt wurde aus dem Model entfernt
1042 |*
1043 \************************************************************************/
1044 void SdDrawDocument::RemoveObject(SdrObject* pObj, SdPage* /*pPage*/)
1045 {
1046 	if(mpOnlineSpellingList && pObj)
1047 	{
1048 		if (pObj->GetOutlinerParaObject() || (pObj->GetObjIdentifier() == OBJ_GRUP))
1049 		{
1050 			// Objekt in OnlineSpelling-Liste durch NULL-Pointer ersetzt
1051 			mpOnlineSpellingList->removeShape(*pObj);
1052 		}
1053 	}
1054 }
1055 
1056 /*************************************************************************
1057 |*
1058 |* Callback fuer ExecuteSpellPopup()
1059 |*
1060 \************************************************************************/
1061 IMPL_LINK(SdDrawDocument, OnlineSpellEventHdl, EditStatus*, pEditStat)
1062 {
1063 	sal_uLong nStat = pEditStat->GetStatusWord();
1064 	mbHasOnlineSpellErrors = (nStat & EE_STAT_WRONGWORDCHANGED) != 0;
1065 
1066 	return(0);
1067 }
1068 
1069 /*************************************************************************
1070 |*
1071 |* Callback fuer ExecuteSpellPopup()
1072 |*
1073 \************************************************************************/
1074 
1075 // #91457# removed link and replaced with Imp method
1076 void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo* pInfo, SdrObject* pObj, SdrOutliner* pOutl)
1077 {
1078 	delete mpOnlineSearchItem;
1079 	mpOnlineSearchItem = NULL;
1080 
1081 	sal_uInt16 nCommand = pInfo->nCommand;
1082 
1083 	if (nCommand == SPELLCMD_IGNOREWORD
1084 		// #91457# restart when add to dictionary takes place, too.
1085 		|| nCommand == SPELLCMD_ADDTODICTIONARY)
1086 	{
1087 		if(pObj && pOutl && pObj->ISA(SdrTextObj))
1088 		{
1089 			sal_Bool bModified(IsChanged());
1090 			((SdrTextObj*)pObj)->SetOutlinerParaObject(pOutl->CreateParaObject());
1091 			SetChanged(bModified);
1092 			pObj->BroadcastObjectChange();
1093 		}
1094 
1095         mpOnlineSearchItem = new SvxSearchItem( SID_SEARCH_ITEM );
1096 		mpOnlineSearchItem->SetSearchString(pInfo->aWord);
1097 		StartOnlineSpelling();
1098 	}
1099 	else if (nCommand == SPELLCMD_STARTSPELLDLG)
1100 	{
1101 		SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SPELL_DIALOG,
1102             SFX_CALLMODE_ASYNCHRON );
1103 	}
1104 }
1105 
1106 /*************************************************************************
1107 |*
1108 |* Eindeutige Namen der StandardLayer durch sprachabhaengige Namen ersetzen
1109 |*
1110 \************************************************************************/
1111 void SdDrawDocument::RestoreLayerNames()
1112 {
1113 	SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
1114 	sal_uInt16 nLayerCount = rLayerAdmin.GetLayerCount();
1115 
1116 	for (sal_uInt16 nLayer = 0; nLayer < nLayerCount; nLayer++)
1117 	{
1118 		SdrLayer* pLayer = rLayerAdmin.GetLayer(nLayer);
1119 
1120 		if (pLayer)
1121 		{
1122 			String aLayerName(pLayer->GetName());
1123 
1124 			if (aLayerName.EqualsAscii( "LAYER_LAYOUT" ))
1125 			{
1126 				pLayer->SetName(String(SdResId(STR_LAYER_LAYOUT)));
1127 			}
1128 			else if (aLayerName.EqualsAscii( "LAYER_BCKGRND" ))
1129 			{
1130 				pLayer->SetName(String(SdResId(STR_LAYER_BCKGRND)));
1131 			}
1132 			else if (aLayerName.EqualsAscii( "LAYER_BACKGRNDOBJ" ))
1133 			{
1134 				pLayer->SetName(String(SdResId(STR_LAYER_BCKGRNDOBJ)));
1135 			}
1136 			else if (aLayerName.EqualsAscii( "LAYER_CONTROLS" ))
1137 			{
1138 				pLayer->SetName(String(SdResId(STR_LAYER_CONTROLS)));
1139 			}
1140 			else if (aLayerName.EqualsAscii( "LAYER_MEASURELINES" ))
1141 			{
1142 				pLayer->SetName(String(SdResId(STR_LAYER_MEASURELINES)));
1143 			}
1144 		}
1145 	}
1146 }
1147 
1148 /*************************************************************************
1149 |*
1150 |* Formatierte Seitennummer zurueckgeben (1, I, i, a, usw.)
1151 |*
1152 \************************************************************************/
1153 
1154 String SdDrawDocument::CreatePageNumValue(sal_uInt16 nNum) const
1155 {
1156 	String aPageNumValue;
1157 	sal_Bool bUpper = sal_False;
1158 
1159 	switch (mePageNumType)
1160 	{
1161 		case SVX_CHARS_UPPER_LETTER:
1162 			aPageNumValue += (sal_Unicode)(char)((nNum - 1) % 26 + 'A');
1163 			break;
1164 		case SVX_CHARS_LOWER_LETTER:
1165 			aPageNumValue += (sal_Unicode)(char)((nNum - 1) % 26 + 'a');
1166 			break;
1167 		case SVX_ROMAN_UPPER:
1168 			bUpper = sal_True;
1169 		case SVX_ROMAN_LOWER:
1170 			aPageNumValue += SvxNumberFormat::CreateRomanString(nNum, bUpper);
1171 			break;
1172 		case SVX_NUMBER_NONE:
1173 			aPageNumValue.Erase();
1174 			aPageNumValue += sal_Unicode(' ');
1175 			break;
1176 		default:
1177 			aPageNumValue += String::CreateFromInt32( (sal_Int32)nNum );
1178 	}
1179 
1180 	return(aPageNumValue);
1181 }
1182 
1183 
1184 
1185 /*************************************************************************
1186 |*
1187 |* Layout-Template umbenennen
1188 |* Zu beachten ist, das rOldLayoutName im Gegensatz zu rNewName den
1189 |* kompletten Layout(!)-Namen enthaelt (inkl. ~LT~)!
1190 |*
1191 \************************************************************************/
1192 
1193 void SdDrawDocument::RenameLayoutTemplate(const String& rOldLayoutName, const String& rNewName)
1194 {
1195 	String aOldName(rOldLayoutName);
1196 	sal_uInt16 nPos = aOldName.SearchAscii( SD_LT_SEPARATOR );
1197 
1198 	// erase everything after '~LT~'
1199 	aOldName.Erase(nPos + sizeof(SD_LT_SEPARATOR) - 1 );
1200 	sal_uInt16 nLen = aOldName.Len();
1201 
1202 	List aReplList;
1203 	SfxStyleSheetIterator aIter(mxStyleSheetPool.get(), SD_STYLE_FAMILY_MASTERPAGE);
1204 	SfxStyleSheetBase* pSheet = aIter.First();
1205 
1206 	while (pSheet)
1207 	{
1208 		String aSheetName = pSheet->GetName();
1209 
1210 		// if the sheetname starts with aOldName + "~LT~"
1211 		if (aSheetName.Match(aOldName) == nLen)
1212 		{
1213 			aSheetName.Erase(0, nLen - sizeof(SD_LT_SEPARATOR) + 1 );
1214 			aSheetName.Insert(rNewName, 0);
1215 
1216 			StyleReplaceData* pReplData = new StyleReplaceData;
1217 			pReplData->nFamily	  = pSheet->GetFamily();
1218 			pReplData->nNewFamily = pSheet->GetFamily();
1219 			pReplData->aName	  = pSheet->GetName();
1220 			pReplData->aNewName   = aSheetName;
1221 			aReplList.Insert(pReplData, LIST_APPEND);
1222 
1223 			pSheet->SetName(aSheetName);
1224 		}
1225 
1226 		pSheet = aIter.Next();
1227 	}
1228 
1229 	// jetzt noch den Layoutnamen der Zeichen- und der Notizseite
1230 	// sowie ihrer Masterpages setzen
1231 	String aPageLayoutName(rNewName);
1232 	aPageLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
1233 	aPageLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
1234 
1235 	// an allen Seiten, die das jetzt umbeannte Layout benutzen, die
1236 	// Textobjekte von der Aenderung unterrichten und Layoutnamen setzen
1237 	sal_uInt16 nPage;
1238 	for (nPage = 0; nPage < GetPageCount(); nPage++)
1239 	{
1240 		SdPage* pPage = (SdPage*) GetPage(nPage);
1241 		String aTemp(pPage->GetLayoutName());
1242 
1243 		if (aTemp == rOldLayoutName)
1244 		{
1245 			pPage->SetLayoutName(aPageLayoutName);
1246 
1247 			for (sal_uLong nObj = 0; nObj < pPage->GetObjCount(); nObj++)
1248 			{
1249 				SdrObject* pObj = pPage->GetObj(nObj);
1250 
1251 				if (pObj->GetObjInventor() == SdrInventor)
1252 				{
1253 					switch( pObj->GetObjIdentifier() )
1254 					{
1255 						case OBJ_TEXT:
1256 						case OBJ_OUTLINETEXT:
1257 						case OBJ_TITLETEXT:
1258 						{
1259 							OutlinerParaObject* pOPO = ((SdrTextObj*) pObj)->GetOutlinerParaObject();
1260 
1261 							if (pOPO)
1262 							{
1263 								StyleReplaceData* pReplData = (StyleReplaceData*) aReplList.First();
1264 
1265 								while( pReplData )
1266 								{
1267 									pOPO->ChangeStyleSheets( pReplData->aName, pReplData->nFamily, pReplData->aNewName, pReplData->nNewFamily );
1268 									pReplData = (StyleReplaceData*) aReplList.Next();
1269 								}
1270 							}
1271 						}
1272 						break;
1273 
1274 						default:
1275 						break;
1276 					}
1277 				}
1278 			}
1279 		}
1280 	}
1281 
1282 	// und nochmal fuer die Masterpages
1283 	// die betroffenen Masterpages erhalten als Seitennamen den Namen
1284 	// des Layouts
1285 	for (nPage = 0; nPage < GetMasterPageCount(); nPage++)
1286 	{
1287 		SdPage* pPage = (SdPage*) GetMasterPage(nPage);
1288 		String aTemp(pPage->GetLayoutName());
1289 
1290 		if (aTemp == rOldLayoutName)
1291 		{
1292 			pPage->SetLayoutName(aPageLayoutName);
1293 			pPage->SetName(rNewName);
1294 
1295 			for (sal_uLong nObj = 0; nObj < pPage->GetObjCount(); nObj++)
1296 			{
1297 				SdrObject* pObj = pPage->GetObj(nObj);
1298 
1299 				if (pObj->GetObjInventor() == SdrInventor)
1300 				{
1301 					switch(pObj->GetObjIdentifier())
1302 					{
1303 						case OBJ_TEXT:
1304 						case OBJ_OUTLINETEXT:
1305 						case OBJ_TITLETEXT:
1306 						{
1307 							OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject();
1308 
1309 							if (pOPO)
1310 							{
1311 								StyleReplaceData* pReplData = (StyleReplaceData*) aReplList.First();
1312 
1313 								while( pReplData )
1314 								{
1315 									pOPO->ChangeStyleSheets( pReplData->aName, pReplData->nFamily, pReplData->aNewName, pReplData->nNewFamily );
1316 									pReplData = (StyleReplaceData*) aReplList.Next();
1317 								}
1318 							}
1319 						}
1320 						break;
1321 
1322 						default:
1323 						break;
1324 					}
1325 				}
1326 			}
1327 		}
1328 	}
1329 }
1330 
1331 /*************************************************************************
1332 |*
1333 |* Outliner-Defaults setzen (Pool-Defaults)
1334 |*
1335 \************************************************************************/
1336 void SdDrawDocument::SetTextDefaults() const
1337 {
1338 	// BulletItem und BulletFont fuer Titel und Gliederung
1339 	SvxBulletItem aBulletItem(EE_PARA_BULLET);
1340 	Font aBulletFont( static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->GetBulletFont() );
1341 	aBulletFont.SetSize(Size(0,846));		// 24 pt
1342 	aBulletItem.SetFont(aBulletFont);
1343 	aBulletItem.SetStyle(BS_BULLET);
1344 	aBulletItem.SetStart(1);
1345 	aBulletItem.SetScale(45);				// in Prozent
1346 	aBulletItem.SetSymbol( 0x25CF );				// Punkt
1347 	pItemPool->SetPoolDefaultItem( aBulletItem );
1348 
1349 	// Bullets nicht sichtbar
1350 //	SfxUInt16Item aBulletStateItem(EE_PARA_BULLETSTATE, 0);
1351 //	pItemPool->SetPoolDefaultItem( aBulletStateItem );
1352 
1353 	// Neues BulletItem
1354 	SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
1355 	aNumberFormat.SetBulletFont(&aBulletFont);
1356 	aNumberFormat.SetBulletChar( 0x25CF );  // StarBats: 0xF000 + 34
1357 	aNumberFormat.SetBulletRelSize(45);
1358 	aNumberFormat.SetBulletColor(Color(COL_AUTO));
1359 	aNumberFormat.SetStart(1);
1360 	aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
1361 
1362 	SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10, sal_False);
1363 
1364 	aNumberFormat.SetLSpace( 0 );
1365 	aNumberFormat.SetAbsLSpace( 0 );
1366 	aNumberFormat.SetFirstLineOffset( 0 );
1367 	aNumRule.SetLevel( 0, aNumberFormat );
1368 
1369 	for( sal_uInt16 i = 1; i < aNumRule.GetLevelCount(); i++ )
1370 	{
1371 		const short nLSpace = (i + 1) * 600;
1372 		aNumberFormat.SetLSpace(nLSpace);
1373 		aNumberFormat.SetAbsLSpace(nLSpace);
1374 		aNumberFormat.SetFirstLineOffset(-600);
1375 		aNumRule.SetLevel( i, aNumberFormat );
1376 	}
1377 
1378 	SvxNumBulletItem aNumBulletItem( aNumRule, EE_PARA_NUMBULLET );
1379 	pItemPool->SetPoolDefaultItem( aNumBulletItem );
1380 }
1381 
1382 /*************************************************************************
1383 |*
1384 |*
1385 |*
1386 \************************************************************************/
1387 
1388 ::com::sun::star::text::WritingMode SdDrawDocument::GetDefaultWritingMode() const
1389 {
1390     const SfxPoolItem*                  pItem = ( pItemPool ? pItemPool->GetPoolDefaultItem( EE_PARA_WRITINGDIR ) : NULL );
1391     ::com::sun::star::text::WritingMode eRet = ::com::sun::star::text::WritingMode_LR_TB;
1392 
1393     if( pItem )
1394     {
1395         switch( ( (SvxFrameDirectionItem&)( *pItem ) ).GetValue() )
1396         {
1397             case( FRMDIR_HORI_LEFT_TOP ): eRet = ::com::sun::star::text::WritingMode_LR_TB; break;
1398             case( FRMDIR_HORI_RIGHT_TOP ): eRet = ::com::sun::star::text::WritingMode_RL_TB; break;
1399             case( FRMDIR_VERT_TOP_RIGHT ): eRet = ::com::sun::star::text::WritingMode_TB_RL; break;
1400 
1401             default:
1402                 DBG_ERROR( "Frame direction not supported yet" );
1403             break;
1404         }
1405     }
1406 
1407     return eRet;
1408 }
1409 
1410 void SdDrawDocument::SetDefaultWritingMode(::com::sun::star::text::WritingMode eMode )
1411 {
1412 	if( pItemPool )
1413 	{
1414 		SvxFrameDirection nVal;
1415 		switch( eMode )
1416 		{
1417 		case ::com::sun::star::text::WritingMode_LR_TB: nVal = FRMDIR_HORI_LEFT_TOP; break;
1418 		case ::com::sun::star::text::WritingMode_RL_TB: nVal = FRMDIR_HORI_RIGHT_TOP; break;
1419 		case ::com::sun::star::text::WritingMode_TB_RL: nVal = FRMDIR_VERT_TOP_RIGHT; break;
1420 		default:
1421 			DBG_ERROR( "Frame direction not supported yet" );
1422 			return;
1423 		}
1424 
1425 		SvxFrameDirectionItem aModeItem( nVal, EE_PARA_WRITINGDIR );
1426 		pItemPool->SetPoolDefaultItem( aModeItem );
1427 
1428         SvxAdjustItem aAdjust( SVX_ADJUST_LEFT, EE_PARA_JUST );
1429 
1430 		if( eMode == ::com::sun::star::text::WritingMode_RL_TB )
1431 			aAdjust.SetEnumValue( SVX_ADJUST_RIGHT );
1432 
1433 		pItemPool->SetPoolDefaultItem( aAdjust );
1434 
1435 
1436 	}
1437 }
1438 
1439 void SdDrawDocument::getDefaultFonts( Font& rLatinFont, Font& rCJKFont, Font& rCTLFont )
1440 {
1441 	LanguageType eLatin = GetLanguage( EE_CHAR_LANGUAGE );
1442 
1443 	//	#108374# / #107782#: If the UI language is Korean, the default Latin font has to
1444 	//	be queried for Korean, too (the Latin language from the document can't be Korean).
1445 	//	This is the same logic as in SwDocShell::InitNew.
1446 	LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
1447 	switch( eUiLanguage )
1448 	{
1449 		case LANGUAGE_KOREAN:
1450 		case LANGUAGE_KOREAN_JOHAB:
1451 			eLatin = eUiLanguage;
1452 		break;
1453 	}
1454 
1455 	rLatinFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_PRESENTATION, eLatin, DEFAULTFONT_FLAGS_ONLYONE );
1456 	rCJKFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_PRESENTATION, GetLanguage( EE_CHAR_LANGUAGE_CJK ), DEFAULTFONT_FLAGS_ONLYONE );
1457 	rCTLFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_PRESENTATION, GetLanguage( EE_CHAR_LANGUAGE_CTL ), DEFAULTFONT_FLAGS_ONLYONE ) ;
1458 }
1459 
1460 /* converts the given western font height to a corresponding ctl font height, deppending on the system language */
1461 sal_uInt32 SdDrawDocument::convertFontHeightToCTL( sal_uInt32 nWesternFontHeight )
1462 {
1463 	LanguageType eRealCTLLanguage = Application::GetSettings().GetLanguage();
1464 	if( LANGUAGE_THAI == eRealCTLLanguage )
1465 	{
1466 		// http://specs.openoffice.org/g11n/font_sizes/42775_42725_Individual_configurable_font_size_for_default_fonts.odt
1467 		double fTemp = double(nWesternFontHeight) * 1.333;
1468 		nWesternFontHeight = (sal_uInt32)fTemp;
1469 		// make some nice values for UI that displays PT instead of 1/100th mm
1470 		nWesternFontHeight = ((nWesternFontHeight * 72) + 1270) / 2540L;
1471 		nWesternFontHeight = ((nWesternFontHeight * 2540L) + 36) / 72;
1472 	}
1473 	return nWesternFontHeight;
1474 }
1475 
1476 SdStyleSheetPool* SdDrawDocument::GetSdStyleSheetPool() const
1477 {
1478 	return dynamic_cast< SdStyleSheetPool* >( GetStyleSheetPool() );
1479 }
1480 
1481 ModifyGuard::ModifyGuard( SdDrawDocument* pDoc )
1482 : mpDocShell( 0 ), mpDoc( pDoc )
1483 {
1484 	init();
1485 }
1486 
1487 void ModifyGuard::init()
1488 {
1489 	if( mpDocShell )
1490 	{
1491 		mpDoc = mpDocShell->GetDoc();
1492 	}
1493 	else if( mpDoc )
1494 	{
1495 		mpDocShell = mpDoc->GetDocSh();
1496 	}
1497 
1498 	mbIsEnableSetModified = mpDocShell ? mpDocShell->IsEnableSetModified() : sal_False;
1499 	mbIsDocumentChanged = mpDoc ? mpDoc->IsChanged() : sal_False;
1500 
1501 	if( mbIsEnableSetModified )
1502 		mpDocShell->EnableSetModified( sal_False );
1503 }
1504 
1505 ModifyGuard::~ModifyGuard()
1506 {
1507 	if( mbIsEnableSetModified )
1508 		mpDocShell->EnableSetModified( sal_True );
1509 
1510 	if( mpDoc && (mpDoc->IsChanged() != mbIsDocumentChanged) )
1511 		mpDoc->SetChanged(mbIsDocumentChanged);
1512 }
1513