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