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