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