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