Update ooo320-m1
[ooovba.git] / sd / source / core / drawdoc4.cxx
blob823848d06782b993f37980ff37d065211298f3e3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drawdoc4.cxx,v $
10 * $Revision: 1.58.34.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include <com/sun/star/style/XStyle.hpp>
35 #include <com/sun/star/container/XNameAccess.hpp>
37 #include <tools/urlobj.hxx>
38 #include <sfx2/docfile.hxx>
39 #include <sfx2/dispatch.hxx>
40 #include "Outliner.hxx"
41 #include <comphelper/processfactory.hxx>
42 #include <svx/outliner.hxx>
44 #include "../ui/inc/DrawDocShell.hxx"
45 #include <svx/eeitem.hxx>
46 #include <vcl/svapp.hxx>
47 #include <eetext.hxx>
49 #include <svx/akrnitem.hxx>
51 #include <svx/svxids.hrc>
52 #include <sfx2/srchitem.hxx>
53 #include <svx/lrspitem.hxx>
54 #include <svx/ulspitem.hxx>
55 #include <svx/lspcitem.hxx>
56 #include <svx/adjitem.hxx>
57 #include <svx/dialogs.hrc>
58 #include <svx/dialmgr.hxx> // SVX_RESSTR
59 #include <svx/bulitem.hxx>
60 #include <svx/xtable.hxx>
61 #include <svx/sxmsuitm.hxx>
62 #include <svx/borderline.hxx>
63 #include <svx/boxitem.hxx>
64 #include <svx/xit.hxx>
65 #include <svx/xlineit0.hxx>
66 #include <svx/sdshitm.hxx>
67 #include <svx/svdotext.hxx>
68 #include <svx/xfillit0.hxx>
69 #include <svx/sdshcitm.hxx>
70 #include <svx/editstat.hxx>
71 #include <svx/colritem.hxx>
72 #include <svx/fhgtitem.hxx>
73 #include <svx/wghtitem.hxx>
74 #include <svx/postitem.hxx>
75 #include <svx/crsditem.hxx>
76 #include <svx/udlnitem.hxx>
77 #include <svx/cntritem.hxx>
78 #ifndef _SVX_EMPHITEM_HXX
79 #include <svx/emphitem.hxx>
80 #endif
81 #include <svx/fontitem.hxx>
82 #include <svx/shdditem.hxx>
83 #include <svx/xbtmpit.hxx>
84 #include <svx/xflhtit.hxx>
85 #include <svx/xflgrit.hxx>
86 #include <svx/xflclit.hxx>
87 #include <svx/xlnedcit.hxx>
88 #include <svx/xlnstcit.hxx>
89 #include <svx/xlnedwit.hxx>
90 #include <svx/xlnstwit.hxx>
91 #include <svx/xlnedit.hxx>
92 #include <svx/charreliefitem.hxx>
93 #include <svx/xlnstit.hxx>
94 #include <svx/xlndsit.hxx>
95 #include <svx/xlnwtit.hxx>
96 #include <svx/xlnclit.hxx>
97 #include <svx/svditer.hxx>
98 #include <svx/svdogrp.hxx>
99 #include <tools/shl.hxx>
100 #include <svx/numitem.hxx>
101 #include <svx/editeng.hxx>
102 #include <svx/unolingu.hxx>
103 #include <com/sun/star/linguistic2/XHyphenator.hpp>
104 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
105 #include <svtools/itempool.hxx>
106 #include <svx/outlobj.hxx>
107 #include <sfx2/viewfrm.hxx>
108 #include <svx/langitem.hxx>
109 #include <svx/frmdiritem.hxx>
111 #include "sdresid.hxx"
112 #include "drawdoc.hxx"
113 #include "sdpage.hxx"
114 #include "glob.hrc"
115 #include "glob.hxx"
116 #include "stlpool.hxx"
117 #include "helpids.h"
118 #include "sdiocmpt.hxx"
119 #include "shapelist.hxx"
120 #include <basegfx/point/b2dpoint.hxx>
121 #include <basegfx/polygon/b2dpolygon.hxx>
122 #include <svtools/itemset.hxx>
124 using ::rtl::OUString;
125 using namespace ::com::sun::star;
126 using namespace ::com::sun::star::uno;
127 using namespace ::com::sun::star::lang;
128 using namespace ::com::sun::star::style;
129 using namespace ::com::sun::star::container;
130 using namespace ::com::sun::star::linguistic2;
131 using namespace ::sd;
133 /*************************************************************************
135 |* CreateLayoutTemplates, Layoutvorlagen erzeugen
137 |* Z.Zt. (31.03.95) speichert der StyleSheetPool nur diejenigen Sheets, die
138 |* ein ItemSet haben. Damit alle Sheets gespeichert werden, wird die ItemSet-
139 |* Erzeugung mit einem GetItemSet-Aufruf erzwungen.
140 |* Dies kann entfallen, sobald der Pool auch Sheets ohne ItemSet speichert.
142 \************************************************************************/
144 void SdDrawDocument::CreateLayoutTemplates()
146 SdStyleSheetPool* pSSPool = (SdStyleSheetPool*)GetStyleSheetPool();
147 SfxStyleSheetBase* pSheet = NULL;
148 String aHelpFile;
149 String aStdName = String(SdResId(STR_STANDARD_STYLESHEET_NAME));
151 // ---- Standardvorlage -----------------------------------------------
153 // nicht benutzt, nicht benutzerdefiniert
154 // SB hatte wahrscheinlich Probleme mit SFXSTYLEBIT_AUTO, da dann gar nichts
155 // mehr im Gestalter angezeigt wird. Dieses Problem ist zu 364 j behoben worden
156 // USHORT nMask = SFXSTYLEBIT_ALL & ~(SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF);
157 USHORT nMask = SFXSTYLEBIT_AUTO;
159 String aName(aStdName);
160 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
161 pSheet->SetHelpId( aHelpFile, HID_STANDARD_STYLESHEET_NAME );
162 SfxItemSet& rISet = pSheet->GetItemSet();
163 SfxItemPool* pPool = rISet.GetPool();
165 String aNullStr;
167 ::basegfx::B2DPolyPolygon aNullPolyPolygon;
168 Color aNullCol(RGB_Color(COL_BLACK));
170 XDash aNullDash;
171 XGradient aNullGrad(aNullCol,RGB_Color(COL_WHITE));
172 aNullGrad.SetStartIntens( 100 );
173 aNullGrad.SetEndIntens( 100 );
174 XHatch aNullHatch(aNullCol);
176 // Linienattribute (Extended OutputDevice)
177 rISet.Put(XLineStyleItem(XLINE_SOLID));
178 rISet.Put(XLineColorItem(String(), RGB_Color(COL_BLACK)));
179 rISet.Put(XLineWidthItem(0));
180 rISet.Put(XLineDashItem(pPool,aNullDash));
181 rISet.Put(XLineStartItem(pPool,aNullPolyPolygon));
182 rISet.Put(XLineEndItem(pPool,aNullPolyPolygon));
183 rISet.Put(XLineStartWidthItem(300));
184 rISet.Put(XLineEndWidthItem(300));
185 rISet.Put(XLineStartCenterItem());
186 rISet.Put(XLineEndCenterItem());
188 // Fuellattribute (Extended OutputDevice)
189 rISet.Put(XFillStyleItem(XFILL_SOLID));
190 rISet.Put(XFillColorItem(String(), RGB_Color(COL_DEFAULT_SHAPE_FILLING))); // "Blue 8"
192 rISet.Put(XFillGradientItem(pPool,aNullGrad));
193 rISet.Put(XFillHatchItem(pPool,aNullHatch));
194 Size aNullSize( 32, 32 );
195 Color aNullColor( COL_WHITE );
196 Bitmap aNullBmp( aNullSize, 8 );
197 aNullBmp.Erase( aNullColor );
198 rISet.Put(XFillBitmapItem(pPool,aNullBmp));
200 // Schattenattribute (Drawing Engine)
201 rISet.Put(SdrShadowItem(FALSE));
202 rISet.Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
203 rISet.Put(SdrShadowXDistItem(300)); // 3 mm Schattendistanz
204 rISet.Put(SdrShadowYDistItem(300));
206 Font aLatinFont, aCJKFont, aCTLFont;
208 getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
210 SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
211 aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
213 SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
214 aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
216 SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
217 aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
219 rISet.Put( aSvxFontItem );
220 rISet.Put( aSvxFontItemCJK );
221 rISet.Put( aSvxFontItemCTL );
223 rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT ) ); // sj: (i33745) changed default from 24 to 18 pt
224 rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 18 pt
225 rISet.Put( SvxFontHeightItem( convertFontHeightToCTL( 635 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 18 pt
227 rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
228 rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
229 rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
231 rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
232 rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
233 rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
235 rISet.Put(SvxContourItem(FALSE, EE_CHAR_OUTLINE ));
236 rISet.Put(SvxShadowedItem(FALSE, EE_CHAR_SHADOW ));
237 rISet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE));
238 rISet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE));
239 rISet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
240 rISet.Put(SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK));
241 rISet.Put(SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF));
242 rISet.Put(SvxColorItem(Color(COL_AUTO), EE_CHAR_COLOR ));
244 // Absatzattribute (Edit Engine)
245 rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE));
246 rISet.Put(SvxULSpaceItem(EE_PARA_ULSPACE));
248 // only change paragraph text direction,
249 // if this is a new document and
250 // text direction is set explicitly to RTL
252 if( mpDocSh &&
253 mpDocSh->IsNewDocument() &&
254 SD_MOD()->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB )
256 SvxAdjustItem aAdjust( SVX_ADJUST_RIGHT );
257 SvxFrameDirectionItem aFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR );
259 rISet.Put( aAdjust );
260 rISet.Put( aFrameDirectionItem );
262 pItemPool->SetPoolDefaultItem( aAdjust );
263 pItemPool->SetPoolDefaultItem( aFrameDirectionItem );
265 else
266 rISet.Put( SvxAdjustItem() );
268 rISet.Put( SdrTextLeftDistItem( 250 ) ); // sj: (i33745) using text frame distances seems to be a better default
269 rISet.Put( SdrTextRightDistItem( 250 ) );
270 rISet.Put( SdrTextUpperDistItem( 125 ) );
271 rISet.Put( SdrTextLowerDistItem( 125 ) );
273 rISet.Put( SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL ) );
275 // #i16874# enable kerning by default but only for new documents
276 rISet.Put( SvxAutoKernItem( TRUE, EE_CHAR_PAIRKERNING ) );
278 // Bullet
279 // BulletItem und BulletFont fuer Titel und Gliederung
280 SvxBulletItem aBulletItem(EE_PARA_BULLET);
281 // die sind in allen Ebenen identisch
282 aBulletItem.SetStyle(BS_BULLET);
283 aBulletItem.SetStart(1);
284 aBulletItem.SetScale(45); // in Prozent
286 Font aBulletFont( pSSPool->GetBulletFont() );
288 aBulletFont.SetSize(Size(0,635)); // sj: (i33745) changed default from 24 to 18 pt
290 aBulletItem.SetFont(aBulletFont);
291 aBulletItem.SetSymbol( 0x25CF ); // Punkt
292 rISet.Put(aBulletItem);
294 // SfxUInt16Item aBulletStateItem(EE_PARA_BULLETSTATE, 0); // Bullets nicht sichtbar
295 // rISet.Put(aBulletStateItem);
297 // Neues BulletItem
298 pSSPool->PutNumBulletItem( pSheet, aBulletFont );
300 SfxItemSet* pISet = NULL;
302 // ---- Objekt mit Pfeilspitze ----------------------------------------
304 aName = String(SdResId(STR_POOLSHEET_OBJWITHARROW));
305 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
306 pSheet->SetParent(aStdName);
307 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHARROW );
308 pISet = &pSheet->GetItemSet();
310 pISet->Put(XLineStyleItem(XLINE_SOLID));
311 pISet->Put(XLineColorItem(String(), RGB_Color(COL_BLACK)));
312 pISet->Put(XLineWidthItem(150));
314 ::basegfx::B2DPolygon aArrow;
315 aArrow.append(::basegfx::B2DPoint(10.0, 0.0));
316 aArrow.append(::basegfx::B2DPoint(0.0, 30.0));
317 aArrow.append(::basegfx::B2DPoint(20.0, 30.0));
318 aArrow.setClosed(true);
319 pISet->Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
321 pISet->Put(XLineStartWidthItem(700));
322 pISet->Put(XLineEndWidthItem(300));
323 pISet->Put(XLineStartCenterItem(TRUE));
325 // ---- Objekt mit Schatten -------------------------------------------
327 aName = String(SdResId(STR_POOLSHEET_OBJWITHSHADOW));
328 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
329 pSheet->SetParent(aStdName);
330 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHSHADOW );
331 pISet = &pSheet->GetItemSet();
333 pISet->Put(SdrShadowItem(TRUE));
334 pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
335 pISet->Put(SdrShadowXDistItem(300)); // 3 mm Schattendistanz
336 pISet->Put(SdrShadowYDistItem(300));
338 // ---- Objekt ohne F�llung -------------------------------------------
340 aName = String(SdResId(STR_POOLSHEET_OBJWITHOUTFILL));
341 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
342 pSheet->SetParent(aStdName);
343 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_OBJWITHOUTFILL );
344 pISet = &pSheet->GetItemSet();
346 pISet->Put(XFillStyleItem(XFILL_NONE));
348 // ---- Text ----------------------------------------------------------
350 aName = String(SdResId(STR_POOLSHEET_TEXT));
351 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
352 pSheet->SetParent(aStdName);
353 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXT );
354 pISet = &pSheet->GetItemSet();
356 pISet->Put(XLineStyleItem(XLINE_NONE));
357 pISet->Put(XFillStyleItem(XFILL_NONE));
359 // ---- Textk”rper ----------------------------------------------------
361 aName = String(SdResId(STR_POOLSHEET_TEXTBODY));
362 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
363 pSheet->SetParent(aStdName);
364 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY );
365 pISet = &pSheet->GetItemSet();
367 pISet->Put(XLineStyleItem(XLINE_NONE));
368 pISet->Put(XFillStyleItem(XFILL_NONE));
370 pISet->Put(SvxFontHeightItem(564, 100, EE_CHAR_FONTHEIGHT)); // 16 pt
372 // ---- Textk”rper mit Blocksatz --------------------------------------
374 aName = String(SdResId(STR_POOLSHEET_TEXTBODY_JUSTIFY));
375 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
376 pSheet->SetParent(aStdName);
377 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY_JUSTIFY );
378 pISet = &pSheet->GetItemSet();
380 pISet->Put(XLineStyleItem(XLINE_NONE));
381 pISet->Put(XFillStyleItem(XFILL_NONE));
383 pISet->Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST ));
385 // ---- Textkoerper mit Einzug -----------------------------------------
387 aName = String(SdResId(STR_POOLSHEET_TEXTBODY_INDENT));
388 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
389 pSheet->SetParent(aStdName);
390 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TEXTBODY_INDENT );
391 pISet = &pSheet->GetItemSet();
393 pISet->Put(XLineStyleItem(XLINE_NONE));
394 pISet->Put(XFillStyleItem(XFILL_NONE));
396 SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE );
397 aLRSpaceItem.SetTxtFirstLineOfst(600); // Erstzeileneinzug 6mm, rechts 0
398 pISet->Put(aLRSpaceItem);
400 /* #i35937#
401 // SvxLRSpaceItem hart gesetzt: NumBulletItem anpassen
402 SvxNumBulletItem aNumBullet( (const SvxNumBulletItem&) pISet->Get(EE_PARA_NUMBULLET) );
403 EditEngine::ImportBulletItem( aNumBullet, 0, NULL, &aLRSpaceItem );
404 pISet->Put( aNumBullet );
406 // ---- Titel ---------------------------------------------------------
408 aName = String(SdResId(STR_POOLSHEET_TITLE));
409 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
410 pSheet->SetParent(aStdName);
411 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE );
412 pISet = &pSheet->GetItemSet();
414 pISet->Put(XLineStyleItem(XLINE_NONE));
415 pISet->Put(XFillStyleItem(XFILL_NONE));
417 pISet->Put(SvxFontHeightItem(1551, 100, EE_CHAR_FONTHEIGHT )); // 44 pt
419 // ---- Titel1 --------------------------------------------------------
421 aName = String(SdResId(STR_POOLSHEET_TITLE1));
422 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
423 pSheet->SetParent(aStdName);
424 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE1 );
425 pISet = &pSheet->GetItemSet();
427 pISet->Put(XLineStyleItem(XLINE_NONE));
428 pISet->Put(XFillStyleItem(XFILL_SOLID));
429 pISet->Put(XFillColorItem(String(), RGB_Color(COL_CYAN)));
431 pISet->Put(SdrShadowItem(TRUE));
432 pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
433 pISet->Put(SdrShadowXDistItem(200)); // 2 mm Schattendistanz
434 pISet->Put(SdrShadowYDistItem(200));
436 pISet->Put(SvxFontHeightItem(846, 100, EE_CHAR_FONTHEIGHT )); // 24 pt
438 pISet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
440 // ---- Titel2 --------------------------------------------------------
442 aName = String(SdResId(STR_POOLSHEET_TITLE2));
443 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
444 pSheet->SetParent(aStdName);
445 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_TITLE2 );
446 pISet = &pSheet->GetItemSet();
448 pISet->Put(XLineWidthItem(50));
450 // Farbe nicht aus der Farbtabelle holen, denn da kann diese Farbe
451 // geloescht oder veraendert sein
452 Color aOrange4(255, 204, 153);
453 pISet->Put(XFillColorItem(String(), aOrange4));
455 pISet->Put(SdrShadowItem(TRUE));
456 pISet->Put(SdrShadowColorItem(aNullStr, RGB_Color(COL_GRAY)));
457 pISet->Put(SdrShadowXDistItem(200)); // 2 mm Schattendistanz
458 pISet->Put(SdrShadowYDistItem(200));
460 pISet->Put(SvxFontHeightItem(1270, 100, EE_CHAR_FONTHEIGHT )); // 36 pt
462 SvxLRSpaceItem aLRSpItem( 200, 200, 0, 0, EE_PARA_LRSPACE);
463 pISet->Put( aLRSpItem ); // Erstzeileneinzug 0 mm, links und rechts 2 mm
465 /* #i35937#
466 // SvxLRSpaceItem hart gesetzt: NumBulletItem anpassen
467 SvxNumBulletItem aNmBullet( (const SvxNumBulletItem&) pISet->Get(EE_PARA_NUMBULLET) );
468 EditEngine::ImportBulletItem( aNmBullet, 0, NULL, &aLRSpItem );
469 pISet->Put( aNmBullet );
472 pISet->Put(SvxULSpaceItem(100, 100, EE_PARA_ULSPACE )); // Absatzrand oben/unten 1 mm
474 pISet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST ));
476 // ---- Ueberschrift ---------------------------------------------------
478 aName = String(SdResId(STR_POOLSHEET_HEADLINE));
479 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
480 pSheet->SetParent(aStdName);
481 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE );
482 pISet = &pSheet->GetItemSet();
484 pISet->Put(XLineStyleItem(XLINE_NONE));
485 pISet->Put(XFillStyleItem(XFILL_NONE));
487 pISet->Put(SvxFontHeightItem(846, 100, EE_CHAR_FONTHEIGHT )); // 24 pt
489 pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE )); // Absatzrand oben 4,2 mm,
490 // unten 2,1 mm
492 // ---- Ueberschrift1 --------------------------------------------------
494 aName = String(SdResId(STR_POOLSHEET_HEADLINE1));
495 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
496 pSheet->SetParent(aStdName);
497 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE1 );
498 pISet = &pSheet->GetItemSet();
500 pISet->Put(XLineStyleItem(XLINE_NONE));
501 pISet->Put(XFillStyleItem(XFILL_NONE));
503 pISet->Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT ));
505 pISet->Put(SvxFontHeightItem(635, 100, EE_CHAR_FONTHEIGHT )); // 18 pt
507 pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE )); // Absatzrand oben 4,2 mm,
508 // unten 2,1 mm
510 // ---- Ueberschrift2 --------------------------------------------------
512 aName = String(SdResId(STR_POOLSHEET_HEADLINE2));
513 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
514 pSheet->SetParent(aStdName);
515 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_HEADLINE2 );
516 pISet = &pSheet->GetItemSet();
518 pISet->Put(XLineStyleItem(XLINE_NONE));
519 pISet->Put(XFillStyleItem(XFILL_NONE));
521 pISet->Put(SvxPostureItem(ITALIC_NORMAL, EE_CHAR_ITALIC ));
522 pISet->Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT));
524 pISet->Put(SvxFontHeightItem(494, 100, EE_CHAR_FONTHEIGHT )); // 14 pt
526 pISet->Put(SvxULSpaceItem(420, 210, EE_PARA_ULSPACE )); // Absatzrand oben 4,2 mm,
527 // unten 2,1 mm
529 // ---- Bemassung --------------------------------------------------
531 aName = String(SdResId(STR_POOLSHEET_MEASURE));
532 pSheet = &(pSSPool->Make(aName, SD_STYLE_FAMILY_GRAPHICS, nMask));
533 pSheet->SetParent(aStdName);
534 pSheet->SetHelpId( aHelpFile, HID_POOLSHEET_MEASURE );
535 pISet = &pSheet->GetItemSet();
537 pISet->Put(XFillStyleItem(XFILL_NONE));
539 pISet->Put(SvxFontHeightItem(423, 100, EE_CHAR_FONTHEIGHT )); // 12 pt
541 pISet->Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
542 pISet->Put(XLineStartWidthItem(200));
543 pISet->Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_ARROW),::basegfx::B2DPolyPolygon(aArrow)));
544 pISet->Put(XLineEndWidthItem(200));
545 pISet->Put(XLineStyleItem(XLINE_SOLID));
546 pISet->Put(SdrMeasureShowUnitItem(true));
548 // Praesentationsvorlagen fuer das Standardlayout erzeugen
549 String aPrefix = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
550 pSSPool->CreateLayoutStyleSheets(aPrefix);
553 static Any implMakeSolidCellStyle( SdStyleSheetPool* pSSPool, const OUString& rName, const OUString rParent, const Color& rColor )
555 SfxStyleSheetBase* pSheet = &(pSSPool->Make(rName, SD_STYLE_FAMILY_CELL, SFXSTYLEBIT_AUTO));
556 pSheet->SetParent(rParent);
557 SfxItemSet* pISet = &pSheet->GetItemSet();
558 pISet->Put(XFillStyleItem(XFILL_SOLID));
559 pISet->Put(XFillColorItem(String(), rColor));
561 return Any( Reference< XStyle >( static_cast< XWeak* >( pSheet ), UNO_QUERY ) );
564 static void implCreateTableTemplate( const Reference< XNameContainer >& xTableFamily, const OUString& rName, const Any& rBody, const Any& rHeading, const Any& rBanding )
566 if( xTableFamily.is() ) try
568 if( !xTableFamily->hasByName( OUString( rName ) ) )
570 Reference< XSingleServiceFactory > xFactory( xTableFamily, UNO_QUERY_THROW );
571 Reference< XNameReplace > xDefaultTableStyle( xFactory->createInstance(), UNO_QUERY_THROW );
572 xTableFamily->insertByName( OUString( rName ), Any( xDefaultTableStyle ) );
574 xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("body") ), rBody );
575 xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("odd-rows") ), rBanding );
576 xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("odd-columns") ), rBanding );
577 xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("first-row") ), rHeading );
578 xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("first-column") ), rHeading );
579 xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("last-row") ), rHeading );
580 xDefaultTableStyle->replaceByName( OUString( RTL_CONSTASCII_USTRINGPARAM("last-column") ), rHeading );
583 catch( Exception& )
585 DBG_ERROR("sd::implCreateTableTemplate(), exception caught!");
589 void SdDrawDocument::CreateDefaultCellStyles()
591 SdStyleSheetPool* pSSPool = static_cast< SdStyleSheetPool* >(GetStyleSheetPool());
592 SfxStyleSheetBase* pSheet = NULL;
593 String aHelpFile;
595 const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM( "table" ) );
596 Reference< XNameContainer > xTableFamily( pSSPool->getByName( sFamilyName ), UNO_QUERY );
598 // ---- Default -----------------------------------------------
600 USHORT nMask = SFXSTYLEBIT_AUTO;
602 OUString aDefaultCellStyleName( RTL_CONSTASCII_USTRINGPARAM("default") );
604 pSheet = &(pSSPool->Make(aDefaultCellStyleName, SD_STYLE_FAMILY_CELL, nMask));
605 pSheet->SetHelpId( aHelpFile, HID_SD_CELL_STYLE_DEFAULT );
606 SfxItemSet& rISet = pSheet->GetItemSet();
607 // SfxItemPool* pPool = rISet.GetPool();
609 String aNullStr;
611 Color aNullCol(RGB_Color(COL_BLACK));
613 XDash aNullDash;
614 XGradient aNullGrad(aNullCol,RGB_Color(COL_WHITE));
615 aNullGrad.SetStartIntens( 100 );
616 aNullGrad.SetEndIntens( 100 );
617 XHatch aNullHatch(aNullCol);
619 rISet.Put(XFillStyleItem(XFILL_SOLID));
620 rISet.Put(XFillColorItem(String(), RGB_Color(0x00ccccff)));
622 Font aLatinFont, aCJKFont, aCTLFont;
624 getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
626 SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(),
627 aLatinFont.GetCharSet(), EE_CHAR_FONTINFO );
629 SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(),
630 aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK );
632 SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
633 aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
635 rISet.Put( aSvxFontItem );
636 rISet.Put( aSvxFontItemCJK );
637 rISet.Put( aSvxFontItemCTL );
639 rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT ) ); // sj: (i33745) changed default from 24 to 18 pt
640 rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 18 pt
641 rISet.Put( SvxFontHeightItem( convertFontHeightToCTL( 635 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 18 pt
643 // rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
644 // rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ) );
645 // rISet.Put( SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ) );
647 // rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ) );
648 // rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ) );
649 // rISet.Put( SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ) );
651 // rISet.Put(SvxContourItem(FALSE, EE_CHAR_OUTLINE ));
652 // rISet.Put(SvxShadowedItem(FALSE, EE_CHAR_SHADOW ));
653 // rISet.Put(SvxUnderlineItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE));
654 // rISet.Put(SvxOverlineItem(UNDERLINE_NONE, EE_CHAR_OVERLINE));
655 // rISet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ));
656 // rISet.Put(SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK));
657 // rISet.Put(SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF));
658 rISet.Put(SvxColorItem(Color(COL_AUTO), EE_CHAR_COLOR ));
660 // Absatzattribute (Edit Engine)
661 rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE));
662 rISet.Put(SvxULSpaceItem(EE_PARA_ULSPACE));
664 rISet.Put( SdrTextLeftDistItem( 250 ) );
665 rISet.Put( SdrTextRightDistItem( 250 ) );
666 rISet.Put( SdrTextUpperDistItem( 130 ) );
667 rISet.Put( SdrTextLowerDistItem( 130 ) );
669 rISet.Put( SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL ) );
670 rISet.Put( SvxAutoKernItem( TRUE, EE_CHAR_PAIRKERNING ) );
671 rISet.Put( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) );
672 rISet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT) );
674 Color aWhite( COL_WHITE );
675 SvxBorderLine aBorderLine( &aWhite, 1, 0, 0 );
677 SvxBoxItem aBoxItem( SDRATTR_TABLE_BORDER );
678 aBoxItem.SetLine( &aBorderLine, BOX_LINE_TOP );
679 aBoxItem.SetLine( &aBorderLine, BOX_LINE_BOTTOM );
680 aBoxItem.SetLine( &aBorderLine, BOX_LINE_LEFT );
681 aBoxItem.SetLine( &aBorderLine, BOX_LINE_RIGHT );
683 rISet.Put( aBoxItem );
685 Any aDefaultCellStyle( Reference< XStyle >( static_cast< XWeak* >( pSheet ), UNO_QUERY ) );
687 // ---- default --------------------------------------------------
689 Any aBlue1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("blue1") ), aDefaultCellStyleName, RGB_COLORDATA(153,204,255)));
690 Any aBlue2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("blue2") ), aDefaultCellStyleName, RGB_COLORDATA(0,153,255)));
691 Any aBlue3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("blue3") ), aDefaultCellStyleName, RGB_COLORDATA(0,102,204)));
693 implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("default")), aBlue1, aBlue3, aBlue2 );
695 // ---- BW ------------------------------------------------
697 Any aBW1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("bw1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,255)));
698 Any aBW2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("bw2") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,230)));
699 Any aBW3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("bw3") ), aDefaultCellStyleName, RGB_COLORDATA(0,0,0)));
701 implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("bw") ), aBW1, aBW3, aBW2 );
703 // ---- Orange --------------------------------------------------
705 Any aOrange1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("orange1") ), aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
706 Any aOrange2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("orange2") ), aDefaultCellStyleName, RGB_COLORDATA(255,153,102)));
707 Any aOrange3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("orange3") ), aDefaultCellStyleName, RGB_COLORDATA(255,102,51)));
709 implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("orange") ), aOrange1, aOrange3, aOrange2 );
711 // ---- Turquise --------------------------------------------------
713 Any aTurquise1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("turquise1") ), aDefaultCellStyleName, RGB_COLORDATA(71,184,184)));
714 Any aTurquise2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("turquise2") ), aDefaultCellStyleName, RGB_COLORDATA(51,163,163)));
715 Any aTurquise3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("turquise3") ), aDefaultCellStyleName, RGB_COLORDATA(25,138,138)));
717 implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("turquise") ), aTurquise1, aTurquise3, aTurquise2 );
719 // ---- Gray ------------------------------------------------
721 Any aGray1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("gray1") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,230)));
722 Any aGray2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("gray2") ), aDefaultCellStyleName, RGB_COLORDATA(204,204,204)));
723 Any aGray3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("gray3") ), aDefaultCellStyleName, RGB_COLORDATA(179,179,179)));
725 implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("gray") ), aGray1, aGray3, aGray2 );
727 // ---- Sun ------------------------------------------------
729 Any aSun1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("sun1") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,255)));
730 Any aSun2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("sun2") ), aDefaultCellStyleName, RGB_COLORDATA(204,204,255)));
731 Any aSun3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("sun3") ), aDefaultCellStyleName, RGB_COLORDATA(153,153,255)));
733 implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("sun") ), aSun1, aSun3, aSun2 );
735 // ---- Earth ----------------------------------------------
737 Any aEarth1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("earth1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
738 Any aEarth2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("earth2") ), aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
739 Any aEarth3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("earth3") ), aDefaultCellStyleName, RGB_COLORDATA(204,102,51)));
741 implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("earth") ), aEarth1, aEarth3, aEarth2 );
743 // ---- Green ----------------------------------------------
745 Any aGreen1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("green1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
746 Any aGreen2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("green2") ), aDefaultCellStyleName, RGB_COLORDATA(148,189,94)));
747 Any aGreen3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("green3") ), aDefaultCellStyleName, RGB_COLORDATA(92,133,38)));
749 implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("green") ), aGreen1, aGreen3, aGreen2 );
751 // ---- Seetang ----------------------------------------------
753 Any aSeetang1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("seetang1") ), aDefaultCellStyleName, RGB_COLORDATA(204,255,255)));
754 Any aSeetang2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("seetang2") ), aDefaultCellStyleName, RGB_COLORDATA(71,184,184)));
755 Any aSeetang3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("seetang3") ), aDefaultCellStyleName, RGB_COLORDATA(51,163,163)));
757 implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("seetang") ), aSeetang1, aSeetang3, aSeetang2 );
759 // ---- LightBlue ----------------------------------------------
761 Any aLightBlue1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("lightblue1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,255)));
762 Any aLightBlue2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("lightblue2") ), aDefaultCellStyleName, RGB_COLORDATA(230,230,255)));
763 Any aLightBlue3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("lightblue3") ), aDefaultCellStyleName, RGB_COLORDATA(153,153,204)));
765 implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("lightblue") ), aLightBlue1, aLightBlue3, aLightBlue2 );
767 // ---- Yellow ----------------------------------------------
769 Any aYellow1( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("yellow1") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,204)));
770 Any aYellow2( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("yellow2") ), aDefaultCellStyleName, RGB_COLORDATA(255,255,153)));
771 Any aYellow3( implMakeSolidCellStyle( pSSPool, OUString( RTL_CONSTASCII_USTRINGPARAM("yellow3") ), aDefaultCellStyleName, RGB_COLORDATA(255,204,153)));
773 implCreateTableTemplate( xTableFamily, OUString(RTL_CONSTASCII_USTRINGPARAM("yellow") ), aYellow1, aYellow3, aYellow2 );
776 /*************************************************************************
778 |* Anzahl der Seiten, die eine masterPage referenzieren
780 \************************************************************************/
782 USHORT SdDrawDocument::GetMasterPageUserCount(SdrPage* pMaster) const
784 USHORT nResult = 0;
785 USHORT nPage;
786 USHORT nPageCount = GetPageCount();
788 for (nPage = 0; nPage < nPageCount; nPage++)
790 const SdrPage* pPage = GetPage(nPage);
792 if(pPage->TRG_HasMasterPage())
794 if(&(pPage->TRG_GetMasterPage()) == pMaster)
796 nResult++;
800 return nResult;
804 /*************************************************************************
806 |* OnlineSpelling im Hintergrund beenden
808 \************************************************************************/
810 void SdDrawDocument::StopOnlineSpelling()
812 if (mpOnlineSpellingTimer && mpOnlineSpellingTimer->IsActive())
814 mpOnlineSpellingTimer->Stop();
817 delete mpOnlineSpellingTimer;
818 mpOnlineSpellingTimer = NULL;
820 delete mpOnlineSpellingList;
821 mpOnlineSpellingList = NULL;
824 /*************************************************************************
826 |* OnlineSpelling im Hintergrund starten
828 \************************************************************************/
830 void SdDrawDocument::StartOnlineSpelling(BOOL bForceSpelling)
832 if (mbOnlineSpell && (bForceSpelling || mbInitialOnlineSpellingEnabled) &&
833 mpDocSh && !mpDocSh->IsReadOnly() )
835 StopOnlineSpelling();
837 ::sd::Outliner* pOutl = GetInternalOutliner(TRUE);
839 Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
840 if ( xSpellChecker.is() )
841 pOutl->SetSpeller( xSpellChecker );
843 Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
844 if( xHyphenator.is() )
845 pOutl->SetHyphenator( xHyphenator );
847 pOutl->SetDefaultLanguage( meLanguage );
849 mpOnlineSpellingList = new ShapeList;
850 USHORT nPage;
852 for ( nPage = 0; nPage < GetPageCount(); nPage++ )
854 // Alle Pages durchsuchen
855 FillOnlineSpellingList((SdPage*) GetPage(nPage));
858 for (nPage = 0; nPage < GetMasterPageCount(); nPage++)
860 // Alle MasterPages durchsuchen
861 FillOnlineSpellingList((SdPage*) GetMasterPage(nPage));
864 mpOnlineSpellingList->seekShape(0);
865 mpOnlineSpellingTimer = new Timer();
866 mpOnlineSpellingTimer->SetTimeoutHdl( LINK(this, SdDrawDocument, OnlineSpellingHdl) );
867 mpOnlineSpellingTimer->SetTimeout(250);
868 mpOnlineSpellingTimer->Start();
872 /*************************************************************************
874 |* OnlineSpelling-Liste fuellen
876 \************************************************************************/
878 void SdDrawDocument::FillOnlineSpellingList(SdPage* pPage)
880 SdrObject* pObj = NULL;
881 SdrObjListIter aIter(*pPage, IM_FLAT);
883 while (aIter.IsMore())
885 pObj = aIter.Next();
887 if( !pObj )
888 continue;
890 if (pObj->GetOutlinerParaObject())
892 // Textobjekt gefunden
893 mpOnlineSpellingList->addShape(*pObj);
895 else if (pObj->GetObjIdentifier() == OBJ_GRUP)
897 // Gruppenobjekt gefunden
898 SdrObjListIter aGroupIter(*((SdrObjGroup*)pObj)->GetSubList(),
899 IM_DEEPNOGROUPS);
901 BOOL bSubTextObjFound = FALSE;
903 while (aGroupIter.IsMore() && !bSubTextObjFound)
905 if (aGroupIter.Next()->GetOutlinerParaObject())
907 // Textobjekt im Gruppenobjekt gefunden
908 bSubTextObjFound = TRUE;
912 if (bSubTextObjFound)
914 mpOnlineSpellingList->addShape(*pObj);
920 /*************************************************************************
922 |* OnlineSpelling im Hintergrund
924 \************************************************************************/
926 IMPL_LINK(SdDrawDocument, OnlineSpellingHdl, Timer*, EMPTYARG )
928 if (mpOnlineSpellingList!=NULL
929 && ( !mbOnlineSpell || mpOnlineSpellingList->hasMore()))
931 /**********************************************************************
932 * Naechstes Objekt spellen
933 **********************************************************************/
934 SdrObject* pObj = mpOnlineSpellingList->getNextShape();
936 if (pObj)
938 if (pObj->GetOutlinerParaObject() && pObj->ISA(SdrTextObj))
940 // Textobjekt spellen
941 SpellObject((SdrTextObj*) pObj);
943 else if (pObj->GetObjIdentifier() == OBJ_GRUP)
945 // Gruppenobjekt gefunden
946 SdrObjListIter aGroupIter(*((SdrObjGroup*)pObj)->GetSubList(),
947 IM_DEEPNOGROUPS);
949 SdrObject* pSubObj = NULL;
951 while (aGroupIter.IsMore())
953 pSubObj = aGroupIter.Next();
955 if (pSubObj->GetOutlinerParaObject() && pSubObj->ISA(SdrTextObj))
957 // Textobjekt im Gruppenobjekt gefunden
958 SpellObject((SdrTextObj*) pSubObj);
964 // Weitersuchen
965 mpOnlineSpellingTimer->Start();
967 else
969 // Spelling wurde initial durchgefuehrt
970 mbInitialOnlineSpellingEnabled = FALSE;
972 // Suche beenden
973 StopOnlineSpelling();
975 delete mpOnlineSearchItem;
976 mpOnlineSearchItem = NULL;
979 return(0);
982 /*************************************************************************
984 |* Objekt spellen (fuer OnlineSpelling)
986 \************************************************************************/
988 void SdDrawDocument::SpellObject(SdrTextObj* pObj)
990 if (pObj && pObj->GetOutlinerParaObject() /* && pObj != pView->GetTextEditObject() */)
992 mbHasOnlineSpellErrors = FALSE;
993 ::sd::Outliner* pOutl = GetInternalOutliner(TRUE);
994 pOutl->SetUpdateMode(TRUE);
995 Link aEvtHdl = pOutl->GetStatusEventHdl();
996 pOutl->SetStatusEventHdl(LINK(this, SdDrawDocument, OnlineSpellEventHdl));
998 USHORT nOldOutlMode = pOutl->GetMode();
999 USHORT nOutlMode = OUTLINERMODE_TEXTOBJECT;
1000 if (((SdrTextObj*) pObj)->GetObjInventor() == SdrInventor &&
1001 ((SdrTextObj*) pObj)->GetObjIdentifier() == OBJ_OUTLINETEXT)
1003 nOutlMode = OUTLINERMODE_OUTLINEOBJECT;
1005 pOutl->Init( nOutlMode );
1007 // Text in den Outliner setzen
1008 pOutl->SetText(*((SdrTextObj*) pObj)->GetOutlinerParaObject());
1010 if (!mpOnlineSearchItem || pOutl->HasText(*mpOnlineSearchItem))
1012 // Spelling
1013 pOutl->CompleteOnlineSpelling();
1015 if (mbHasOnlineSpellErrors)
1017 sd::ModifyGuard aGuard( this );
1018 SdrModel* pModel = pObj->GetModel();
1019 sal_Bool bLock = sal_False;
1020 if ( pModel )
1022 bLock = pModel->isLocked();
1023 pModel->setLock( sal_True );
1025 // taking text from the outliner
1026 ((SdrTextObj*) pObj)->SetOutlinerParaObject( pOutl->CreateParaObject() );
1028 pObj->BroadcastObjectChange();
1029 if ( pModel )
1030 pModel->setLock( bLock );
1034 pOutl->SetStatusEventHdl(aEvtHdl);
1035 pOutl->SetUpdateMode(FALSE);
1036 pOutl->Init( nOldOutlMode );
1037 mbHasOnlineSpellErrors = FALSE;
1041 /*************************************************************************
1043 |* Objekt wurde ins Model eingefuegt
1045 \************************************************************************/
1046 void SdDrawDocument::InsertObject(SdrObject* pObj, SdPage* /*pPage*/)
1048 if(mpOnlineSpellingList && pObj)
1050 if (pObj->GetOutlinerParaObject() || (pObj->GetObjIdentifier() == OBJ_GRUP))
1052 // Objekt in OnlineSpelling-Liste aufnehmen
1053 mpOnlineSpellingList->addShape(*pObj);
1058 /*************************************************************************
1060 |* Objekt wurde aus dem Model entfernt
1062 \************************************************************************/
1063 void SdDrawDocument::RemoveObject(SdrObject* pObj, SdPage* /*pPage*/)
1065 if(mpOnlineSpellingList && pObj)
1067 if (pObj->GetOutlinerParaObject() || (pObj->GetObjIdentifier() == OBJ_GRUP))
1069 // Objekt in OnlineSpelling-Liste durch NULL-Pointer ersetzt
1070 mpOnlineSpellingList->removeShape(*pObj);
1075 /*************************************************************************
1077 |* Callback fuer ExecuteSpellPopup()
1079 \************************************************************************/
1080 IMPL_LINK(SdDrawDocument, OnlineSpellEventHdl, EditStatus*, pEditStat)
1082 ULONG nStat = pEditStat->GetStatusWord();
1083 mbHasOnlineSpellErrors = (nStat & EE_STAT_WRONGWORDCHANGED) != 0;
1085 return(0);
1088 /*************************************************************************
1090 |* Callback fuer ExecuteSpellPopup()
1092 \************************************************************************/
1094 // #91457# removed link and replaced with Imp method
1095 void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo* pInfo, SdrObject* pObj, SdrOutliner* pOutl)
1097 delete mpOnlineSearchItem;
1098 mpOnlineSearchItem = NULL;
1100 USHORT nCommand = pInfo->nCommand;
1102 if (nCommand == SPELLCMD_IGNOREWORD
1103 // #91457# restart when add to dictionary takes place, too.
1104 || nCommand == SPELLCMD_ADDTODICTIONARY)
1106 if(pObj && pOutl && pObj->ISA(SdrTextObj))
1108 BOOL bModified(IsChanged());
1109 ((SdrTextObj*)pObj)->SetOutlinerParaObject(pOutl->CreateParaObject());
1110 SetChanged(bModified);
1111 pObj->BroadcastObjectChange();
1114 mpOnlineSearchItem = new SvxSearchItem( SID_SEARCH_ITEM );
1115 mpOnlineSearchItem->SetSearchString(pInfo->aWord);
1116 StartOnlineSpelling();
1118 else if (nCommand == SPELLCMD_STARTSPELLDLG)
1120 SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SPELL_DIALOG,
1121 SFX_CALLMODE_ASYNCHRON );
1125 /*************************************************************************
1127 |* Sprachabhaengige Namen der StandardLayer durch eindeutigen Namen ersetzen
1129 \************************************************************************/
1131 void SdDrawDocument::MakeUniqueLayerNames()
1133 String aLayerLayout(SdResId(STR_LAYER_LAYOUT));
1134 String aLayerBckgrnd(SdResId(STR_LAYER_BCKGRND));
1135 String aLayerBckgrndObj(SdResId(STR_LAYER_BCKGRNDOBJ));
1136 String aLayerControls(SdResId(STR_LAYER_CONTROLS));
1137 String aLayerMeasurelines(SdResId(STR_LAYER_MEASURELINES));
1138 SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
1139 USHORT nStandardLayer = 5;
1140 USHORT nLayerCount = Min(rLayerAdmin.GetLayerCount(), nStandardLayer);
1142 for (USHORT nLayer = 0; nLayer < nLayerCount; nLayer++)
1144 // Die sprachabhaengigen Namen der Default-Layer werden nicht mehr
1145 // gespeichert. Es werden stattdessen eindeutige Namen verwendet.
1146 SdrLayer* pLayer = rLayerAdmin.GetLayer(nLayer);
1148 if (pLayer)
1150 String aLayerName(pLayer->GetName());
1152 if (aLayerName == aLayerLayout)
1154 pLayer->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_LAYOUT" )));
1156 else if (aLayerName == aLayerBckgrnd)
1158 pLayer->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BCKGRND" )));
1160 else if (aLayerName == aLayerBckgrndObj)
1162 pLayer->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_BACKGRNDOBJ" )));
1164 else if (aLayerName == aLayerControls)
1166 pLayer->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_CONTROLS" )));
1168 else if (aLayerName == aLayerMeasurelines)
1170 pLayer->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "LAYER_MEASURELINES" )));
1176 /*************************************************************************
1178 |* Eindeutige Namen der StandardLayer durch sprachabhaengige Namen ersetzen
1180 \************************************************************************/
1181 void SdDrawDocument::RestoreLayerNames()
1183 SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
1184 USHORT nLayerCount = rLayerAdmin.GetLayerCount();
1186 for (USHORT nLayer = 0; nLayer < nLayerCount; nLayer++)
1188 SdrLayer* pLayer = rLayerAdmin.GetLayer(nLayer);
1190 if (pLayer)
1192 String aLayerName(pLayer->GetName());
1194 if (aLayerName.EqualsAscii( "LAYER_LAYOUT" ))
1196 pLayer->SetName(String(SdResId(STR_LAYER_LAYOUT)));
1198 else if (aLayerName.EqualsAscii( "LAYER_BCKGRND" ))
1200 pLayer->SetName(String(SdResId(STR_LAYER_BCKGRND)));
1202 else if (aLayerName.EqualsAscii( "LAYER_BACKGRNDOBJ" ))
1204 pLayer->SetName(String(SdResId(STR_LAYER_BCKGRNDOBJ)));
1206 else if (aLayerName.EqualsAscii( "LAYER_CONTROLS" ))
1208 pLayer->SetName(String(SdResId(STR_LAYER_CONTROLS)));
1210 else if (aLayerName.EqualsAscii( "LAYER_MEASURELINES" ))
1212 pLayer->SetName(String(SdResId(STR_LAYER_MEASURELINES)));
1218 /*************************************************************************
1220 |* Formatierte Seitennummer zurueckgeben (1, I, i, a, usw.)
1222 \************************************************************************/
1224 String SdDrawDocument::CreatePageNumValue(USHORT nNum) const
1226 String aPageNumValue;
1227 BOOL bUpper = FALSE;
1229 switch (mePageNumType)
1231 case SVX_CHARS_UPPER_LETTER:
1232 aPageNumValue += (sal_Unicode)(char)((nNum - 1) % 26 + 'A');
1233 break;
1234 case SVX_CHARS_LOWER_LETTER:
1235 aPageNumValue += (sal_Unicode)(char)((nNum - 1) % 26 + 'a');
1236 break;
1237 case SVX_ROMAN_UPPER:
1238 bUpper = TRUE;
1239 case SVX_ROMAN_LOWER:
1240 aPageNumValue += SvxNumberFormat::CreateRomanString(nNum, bUpper);
1241 break;
1242 case SVX_NUMBER_NONE:
1243 aPageNumValue.Erase();
1244 aPageNumValue += sal_Unicode(' ');
1245 break;
1246 default:
1247 aPageNumValue += String::CreateFromInt32( (sal_Int32)nNum );
1250 return(aPageNumValue);
1255 /*************************************************************************
1257 |* Layout-Template umbenennen
1258 |* Zu beachten ist, das rOldLayoutName im Gegensatz zu rNewName den
1259 |* kompletten Layout(!)-Namen enthaelt (inkl. ~LT~)!
1261 \************************************************************************/
1263 void SdDrawDocument::RenameLayoutTemplate(const String& rOldLayoutName, const String& rNewName)
1265 String aOldName(rOldLayoutName);
1266 USHORT nPos = aOldName.SearchAscii( SD_LT_SEPARATOR );
1268 // erase everything after '~LT~'
1269 aOldName.Erase(nPos + sizeof(SD_LT_SEPARATOR) - 1 );
1270 USHORT nLen = aOldName.Len();
1272 List aReplList;
1273 SfxStyleSheetIterator aIter(mxStyleSheetPool.get(), SD_STYLE_FAMILY_MASTERPAGE);
1274 SfxStyleSheetBase* pSheet = aIter.First();
1276 while (pSheet)
1278 String aSheetName = pSheet->GetName();
1280 // if the sheetname starts with aOldName + "~LT~"
1281 if (aSheetName.Match(aOldName) == nLen)
1283 aSheetName.Erase(0, nLen - sizeof(SD_LT_SEPARATOR) + 1 );
1284 aSheetName.Insert(rNewName, 0);
1286 StyleReplaceData* pReplData = new StyleReplaceData;
1287 pReplData->nFamily = pSheet->GetFamily();
1288 pReplData->nNewFamily = pSheet->GetFamily();
1289 pReplData->aName = pSheet->GetName();
1290 pReplData->aNewName = aSheetName;
1291 aReplList.Insert(pReplData, LIST_APPEND);
1293 pSheet->SetName(aSheetName);
1296 pSheet = aIter.Next();
1299 // jetzt noch den Layoutnamen der Zeichen- und der Notizseite
1300 // sowie ihrer Masterpages setzen
1301 String aPageLayoutName(rNewName);
1302 aPageLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
1303 aPageLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
1305 // an allen Seiten, die das jetzt umbeannte Layout benutzen, die
1306 // Textobjekte von der Aenderung unterrichten und Layoutnamen setzen
1307 USHORT nPage;
1308 for (nPage = 0; nPage < GetPageCount(); nPage++)
1310 SdPage* pPage = (SdPage*) GetPage(nPage);
1311 String aTemp(pPage->GetLayoutName());
1313 if (aTemp == rOldLayoutName)
1315 pPage->SetLayoutName(aPageLayoutName);
1317 for (ULONG nObj = 0; nObj < pPage->GetObjCount(); nObj++)
1319 SdrObject* pObj = pPage->GetObj(nObj);
1321 if (pObj->GetObjInventor() == SdrInventor)
1323 switch( pObj->GetObjIdentifier() )
1325 case OBJ_TEXT:
1326 case OBJ_OUTLINETEXT:
1327 case OBJ_TITLETEXT:
1329 OutlinerParaObject* pOPO = ((SdrTextObj*) pObj)->GetOutlinerParaObject();
1331 if (pOPO)
1333 StyleReplaceData* pReplData = (StyleReplaceData*) aReplList.First();
1335 while( pReplData )
1337 pOPO->ChangeStyleSheets( pReplData->aName, pReplData->nFamily, pReplData->aNewName, pReplData->nNewFamily );
1338 pReplData = (StyleReplaceData*) aReplList.Next();
1342 break;
1344 default:
1345 break;
1352 // und nochmal fuer die Masterpages
1353 // die betroffenen Masterpages erhalten als Seitennamen den Namen
1354 // des Layouts
1355 for (nPage = 0; nPage < GetMasterPageCount(); nPage++)
1357 SdPage* pPage = (SdPage*) GetMasterPage(nPage);
1358 String aTemp(pPage->GetLayoutName());
1360 if (aTemp == rOldLayoutName)
1362 pPage->SetLayoutName(aPageLayoutName);
1363 pPage->SetName(rNewName);
1365 for (ULONG nObj = 0; nObj < pPage->GetObjCount(); nObj++)
1367 SdrObject* pObj = pPage->GetObj(nObj);
1369 if (pObj->GetObjInventor() == SdrInventor)
1371 switch(pObj->GetObjIdentifier())
1373 case OBJ_TEXT:
1374 case OBJ_OUTLINETEXT:
1375 case OBJ_TITLETEXT:
1377 OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject();
1379 if (pOPO)
1381 StyleReplaceData* pReplData = (StyleReplaceData*) aReplList.First();
1383 while( pReplData )
1385 pOPO->ChangeStyleSheets( pReplData->aName, pReplData->nFamily, pReplData->aNewName, pReplData->nNewFamily );
1386 pReplData = (StyleReplaceData*) aReplList.Next();
1390 break;
1392 default:
1393 break;
1401 /*************************************************************************
1403 |* Outliner-Defaults setzen (Pool-Defaults)
1405 \************************************************************************/
1406 void SdDrawDocument::SetTextDefaults() const
1408 // BulletItem und BulletFont fuer Titel und Gliederung
1409 SvxBulletItem aBulletItem(EE_PARA_BULLET);
1410 Font aBulletFont( static_cast<SdStyleSheetPool*>( mxStyleSheetPool.get())->GetBulletFont() );
1411 aBulletFont.SetSize(Size(0,846)); // 24 pt
1412 aBulletItem.SetFont(aBulletFont);
1413 aBulletItem.SetStyle(BS_BULLET);
1414 aBulletItem.SetStart(1);
1415 aBulletItem.SetScale(45); // in Prozent
1416 aBulletItem.SetSymbol( 0x25CF ); // Punkt
1417 pItemPool->SetPoolDefaultItem( aBulletItem );
1419 // Bullets nicht sichtbar
1420 // SfxUInt16Item aBulletStateItem(EE_PARA_BULLETSTATE, 0);
1421 // pItemPool->SetPoolDefaultItem( aBulletStateItem );
1423 // Neues BulletItem
1424 SvxNumberFormat aNumberFormat(SVX_NUM_CHAR_SPECIAL);
1425 aNumberFormat.SetBulletFont(&aBulletFont);
1426 aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34
1427 aNumberFormat.SetBulletRelSize(45);
1428 aNumberFormat.SetBulletColor(Color(COL_AUTO));
1429 aNumberFormat.SetStart(1);
1430 aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT);
1432 SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10, FALSE);
1434 aNumberFormat.SetLSpace( 0 );
1435 aNumberFormat.SetAbsLSpace( 0 );
1436 aNumberFormat.SetFirstLineOffset( 0 );
1437 aNumRule.SetLevel( 0, aNumberFormat );
1439 for( USHORT i = 1; i < aNumRule.GetLevelCount(); i++ )
1441 const short nLSpace = (i + 1) * 600;
1442 aNumberFormat.SetLSpace(nLSpace);
1443 aNumberFormat.SetAbsLSpace(nLSpace);
1444 aNumberFormat.SetFirstLineOffset(-600);
1445 aNumRule.SetLevel( i, aNumberFormat );
1448 SvxNumBulletItem aNumBulletItem( aNumRule, EE_PARA_NUMBULLET );
1449 pItemPool->SetPoolDefaultItem( aNumBulletItem );
1452 /*************************************************************************
1456 \************************************************************************/
1458 ::com::sun::star::text::WritingMode SdDrawDocument::GetDefaultWritingMode() const
1460 const SfxPoolItem* pItem = ( pItemPool ? pItemPool->GetPoolDefaultItem( EE_PARA_WRITINGDIR ) : NULL );
1461 ::com::sun::star::text::WritingMode eRet = ::com::sun::star::text::WritingMode_LR_TB;
1463 if( pItem )
1465 switch( ( (SvxFrameDirectionItem&)( *pItem ) ).GetValue() )
1467 case( FRMDIR_HORI_LEFT_TOP ): eRet = ::com::sun::star::text::WritingMode_LR_TB; break;
1468 case( FRMDIR_HORI_RIGHT_TOP ): eRet = ::com::sun::star::text::WritingMode_RL_TB; break;
1469 case( FRMDIR_VERT_TOP_RIGHT ): eRet = ::com::sun::star::text::WritingMode_TB_RL; break;
1471 default:
1472 DBG_ERROR( "Frame direction not supported yet" );
1473 break;
1477 return eRet;
1480 void SdDrawDocument::SetDefaultWritingMode(::com::sun::star::text::WritingMode eMode )
1482 if( pItemPool )
1484 SvxFrameDirection nVal;
1485 switch( eMode )
1487 case ::com::sun::star::text::WritingMode_LR_TB: nVal = FRMDIR_HORI_LEFT_TOP; break;
1488 case ::com::sun::star::text::WritingMode_RL_TB: nVal = FRMDIR_HORI_RIGHT_TOP; break;
1489 case ::com::sun::star::text::WritingMode_TB_RL: nVal = FRMDIR_VERT_TOP_RIGHT; break;
1490 default:
1491 DBG_ERROR( "Frame direction not supported yet" );
1492 return;
1495 SvxFrameDirectionItem aModeItem( nVal, EE_PARA_WRITINGDIR );
1496 pItemPool->SetPoolDefaultItem( aModeItem );
1498 SvxAdjustItem aAdjust( SVX_ADJUST_LEFT, EE_PARA_JUST );
1500 if( eMode == ::com::sun::star::text::WritingMode_RL_TB )
1501 aAdjust.SetEnumValue( SVX_ADJUST_RIGHT );
1503 pItemPool->SetPoolDefaultItem( aAdjust );
1509 void SdDrawDocument::getDefaultFonts( Font& rLatinFont, Font& rCJKFont, Font& rCTLFont )
1511 LanguageType eLatin = GetLanguage( EE_CHAR_LANGUAGE );
1513 // #108374# / #107782#: If the UI language is Korean, the default Latin font has to
1514 // be queried for Korean, too (the Latin language from the document can't be Korean).
1515 // This is the same logic as in SwDocShell::InitNew.
1516 LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
1517 switch( eUiLanguage )
1519 case LANGUAGE_KOREAN:
1520 case LANGUAGE_KOREAN_JOHAB:
1521 eLatin = eUiLanguage;
1522 break;
1525 rLatinFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_PRESENTATION, eLatin, DEFAULTFONT_FLAGS_ONLYONE );
1526 rCJKFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_PRESENTATION, GetLanguage( EE_CHAR_LANGUAGE_CJK ), DEFAULTFONT_FLAGS_ONLYONE );
1527 rCTLFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_PRESENTATION, GetLanguage( EE_CHAR_LANGUAGE_CTL ), DEFAULTFONT_FLAGS_ONLYONE ) ;
1530 /* converts the given western font height to a corresponding ctl font height, deppending on the system language */
1531 sal_uInt32 SdDrawDocument::convertFontHeightToCTL( sal_uInt32 nWesternFontHeight )
1533 LanguageType eRealCTLLanguage = Application::GetSettings().GetLanguage();
1534 if( LANGUAGE_THAI == eRealCTLLanguage )
1536 // http://specs.openoffice.org/g11n/font_sizes/42775_42725_Individual_configurable_font_size_for_default_fonts.odt
1537 double fTemp = double(nWesternFontHeight) * 1.333;
1538 nWesternFontHeight = (sal_uInt32)fTemp;
1539 // make some nice values for UI that displays PT instead of 1/100th mm
1540 nWesternFontHeight = ((nWesternFontHeight * 72) + 1270) / 2540L;
1541 nWesternFontHeight = ((nWesternFontHeight * 2540L) + 36) / 72;
1543 return nWesternFontHeight;
1546 SdStyleSheetPool* SdDrawDocument::GetSdStyleSheetPool() const
1548 return dynamic_cast< SdStyleSheetPool* >( GetStyleSheetPool() );
1551 ModifyGuard::ModifyGuard( DrawDocShell* pDocShell )
1552 : mpDocShell( pDocShell ), mpDoc( 0 )
1554 init();
1557 ModifyGuard::ModifyGuard( SdDrawDocument* pDoc )
1558 : mpDocShell( 0 ), mpDoc( pDoc )
1560 init();
1563 void ModifyGuard::init()
1565 if( mpDocShell )
1567 mpDoc = mpDocShell->GetDoc();
1569 else if( mpDoc )
1571 mpDocShell = mpDoc->GetDocSh();
1574 mbIsEnableSetModified = mpDocShell ? mpDocShell->IsEnableSetModified() : FALSE;
1575 mbIsDocumentChanged = mpDoc ? mpDoc->IsChanged() : FALSE;
1577 if( mbIsEnableSetModified )
1578 mpDocShell->EnableSetModified( FALSE );
1581 ModifyGuard::~ModifyGuard()
1583 if( mbIsEnableSetModified )
1584 mpDocShell->EnableSetModified( TRUE );
1586 if( mpDoc && (mpDoc->IsChanged() != mbIsDocumentChanged) )
1587 mpDoc->SetChanged(mbIsDocumentChanged);