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