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 <algorithm>
22 :
23 : #include <comphelper/classids.hxx>
24 :
25 : #include <vcl/svapp.hxx>
26 : #include "eetext.hxx"
27 : #include <editeng/eeitem.hxx>
28 : #include <svx/svdoutl.hxx>
29 : #include <editeng/editdata.hxx>
30 : #include <svx/pageitem.hxx>
31 : #include <editeng/lrspitem.hxx>
32 : #include <editeng/bulitem.hxx>
33 : #include <svx/svdpagv.hxx>
34 : #include <editeng/fhgtitem.hxx>
35 : #include <editeng/outlobj.hxx>
36 : #include <svx/svdoole2.hxx>
37 : #include <svx/svdograf.hxx>
38 : #include <svx/svdopage.hxx>
39 : #include <sfx2/printer.hxx>
40 : #include <basic/basmgr.hxx>
41 : #include <editeng/pbinitem.hxx>
42 : #include <svx/svdundo.hxx>
43 : #include <svl/smplhint.hxx>
44 : #include <editeng/adjitem.hxx>
45 : #include <editeng/editobj.hxx>
46 : #include <editeng/scripttypeitem.hxx>
47 : #include <svx/unopage.hxx>
48 : #include <editeng/flditem.hxx>
49 : #include <svx/sdr/contact/displayinfo.hxx>
50 : #include <svx/svditer.hxx>
51 :
52 : #include "../ui/inc/DrawDocShell.hxx"
53 : #include "Outliner.hxx"
54 : #include "app.hrc"
55 : #include "drawdoc.hxx"
56 : #include "sdpage.hxx"
57 : #include "pglink.hxx"
58 : #include "sdresid.hxx"
59 : #include "stlsheet.hxx"
60 : #include "glob.hrc"
61 : #include "glob.hxx"
62 : #include "helpids.h"
63 : #include "anminfo.hxx"
64 : #include "undo/undomanager.hxx"
65 : #include "undo/undoobjects.hxx"
66 : #include <svx/sdr/contact/viewobjectcontact.hxx>
67 : #include <svx/sdr/contact/viewcontact.hxx>
68 : #include <svx/sdr/contact/objectcontact.hxx>
69 : #include <svx/unoapi.hxx>
70 :
71 : #include <set>
72 :
73 : using namespace ::sd;
74 : using namespace ::com::sun::star;
75 :
76 2258 : TYPEINIT2( SdPage, FmFormPage, SdrObjUserCall );
77 :
78 : /*************************************************************************
79 : |*
80 : |* Ctor
81 : |*
82 : \************************************************************************/
83 :
84 136 : SdPage::SdPage(SdDrawDocument& rNewDoc, StarBASIC* pBasic, sal_Bool bMasterPage)
85 : : FmFormPage(rNewDoc, pBasic, bMasterPage)
86 : , SdrObjUserCall()
87 : , mePageKind(PK_STANDARD)
88 : , meAutoLayout(AUTOLAYOUT_NONE)
89 : , mbSelected(sal_False)
90 : , mePresChange(PRESCHANGE_MANUAL)
91 : , mnTime(1)
92 : , mbSoundOn(sal_False)
93 : , mbExcluded(sal_False)
94 : , mbLoopSound(sal_False)
95 : , mbStopSound(sal_False)
96 : , mbScaleObjects(sal_True)
97 : , mbBackgroundFullSize( sal_False )
98 136 : , meCharSet(osl_getThreadTextEncoding())
99 : , mnPaperBin(PAPERBIN_PRINTER_SETTINGS)
100 : , mpPageLink(NULL)
101 : , mpItems(NULL)
102 : , mnTransitionType(0)
103 : , mnTransitionSubtype(0)
104 : , mbTransitionDirection(sal_True)
105 : , mnTransitionFadeColor(0)
106 : , mfTransitionDuration(2.0)
107 272 : , mbIsPrecious(true)
108 : {
109 : // Der Layoutname der Seite wird von SVDRAW benutzt, um die Praesentations-
110 : // vorlagen der Gliederungsobjekte zu ermitteln. Darum enthaelt er bereits
111 : // den Bezeichner fuer die Gliederung (STR_LAYOUT_OUTLINE).
112 136 : OUStringBuffer aBuf(SdResId(STR_LAYOUT_DEFAULT_NAME).toString());
113 136 : aBuf.append(SD_LT_SEPARATOR).append(SdResId(STR_LAYOUT_OUTLINE).toString());
114 136 : maLayoutName = aBuf.makeStringAndClear();
115 :
116 136 : Size aPageSize(GetSize());
117 :
118 136 : if (aPageSize.Width() > aPageSize.Height())
119 : {
120 0 : meOrientation = ORIENTATION_LANDSCAPE;
121 : }
122 : else
123 : {
124 136 : meOrientation = ORIENTATION_PORTRAIT;
125 136 : }
126 136 : }
127 :
128 : /*************************************************************************
129 : |*
130 : |* Dtor
131 : |*
132 : \************************************************************************/
133 :
134 372 : SdPage::~SdPage()
135 : {
136 124 : DisconnectLink();
137 :
138 124 : EndListenOutlineText();
139 :
140 124 : if( mpItems )
141 0 : delete mpItems;
142 248 : }
143 :
144 : struct OrdNumSorter
145 : {
146 30 : bool operator()( SdrObject* p1, SdrObject* p2 )
147 : {
148 30 : return p1->GetOrdNum() < p2->GetOrdNum();
149 : }
150 : };
151 :
152 : /** returns the nIndex'th object from the given PresObjKind, index starts with 1 */
153 851 : SdrObject* SdPage::GetPresObj(PresObjKind eObjKind, int nIndex, bool bFuzzySearch /* = false */ )
154 : {
155 : // first sort all matching shapes with z-order
156 851 : std::vector< SdrObject* > aMatches;
157 :
158 851 : SdrObject* pObj = 0;
159 4816 : while( (pObj = maPresentationShapeList.getNextShape(pObj)) != 0 )
160 : {
161 3114 : SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj);
162 3114 : if( pInfo )
163 : {
164 3114 : bool bFound = false;
165 3114 : if( pInfo->mePresObjKind == eObjKind )
166 : {
167 553 : bFound = true;
168 : }
169 2561 : else if( bFuzzySearch && (eObjKind == PRESOBJ_OUTLINE) )
170 : {
171 39 : switch( pInfo->mePresObjKind )
172 : {
173 : case PRESOBJ_GRAPHIC:
174 : case PRESOBJ_OBJECT:
175 : case PRESOBJ_CHART:
176 : case PRESOBJ_ORGCHART:
177 : case PRESOBJ_TABLE:
178 : case PRESOBJ_CALC:
179 : case PRESOBJ_IMAGE:
180 : case PRESOBJ_MEDIA:
181 0 : bFound = sal_True;
182 0 : break;
183 : default:
184 39 : break;
185 : }
186 : }
187 3114 : if( bFound )
188 : {
189 553 : aMatches.push_back( pObj );
190 : }
191 : }
192 : }
193 :
194 851 : if( aMatches.size() > 1 )
195 : {
196 : OrdNumSorter aSortHelper;
197 5 : std::sort( aMatches.begin(), aMatches.end(), aSortHelper );
198 : }
199 :
200 851 : if( nIndex > 0 )
201 851 : nIndex--;
202 :
203 851 : if( (nIndex >= 0) && ( aMatches.size() > static_cast<unsigned int>(nIndex)) )
204 523 : return aMatches[nIndex];
205 :
206 328 : return 0;
207 : }
208 :
209 : /** create background properties */
210 57 : void SdPage::EnsureMasterPageDefaultBackground()
211 : {
212 57 : if(mbMaster)
213 : {
214 : // no hard attributes on MasterPage attributes
215 57 : getSdrPageProperties().ClearItem();
216 57 : SfxStyleSheet* pSheetForPresObj = GetStyleSheetForMasterPageBackground();
217 :
218 57 : if(pSheetForPresObj)
219 : {
220 : // set StyleSheet for background fill attributes
221 57 : getSdrPageProperties().SetStyleSheet(pSheetForPresObj);
222 : }
223 : else
224 : {
225 : // no style found, assert and set at least XFILL_NONE
226 : OSL_FAIL("No Style for MasterPageBackground fill found (!)");
227 0 : getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
228 : }
229 : }
230 57 : }
231 :
232 : /** creates a presentation object with the given PresObjKind on this page. A user call will be set
233 : */
234 331 : SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, sal_Bool bVertical, const Rectangle& rRect, sal_Bool /* bInsert */ )
235 : {
236 331 : ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
237 331 : const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
238 :
239 331 : SdrObject* pSdrObj = NULL;
240 :
241 331 : bool bForceText = false; // forces the shape text to be set even if its empty
242 331 : bool bEmptyPresObj = true;
243 :
244 331 : switch( eObjKind )
245 : {
246 : case PRESOBJ_TITLE:
247 : {
248 40 : pSdrObj = new SdrRectObj(OBJ_TITLETEXT);
249 :
250 40 : if (mbMaster)
251 : {
252 19 : pSdrObj->SetNotVisibleAsMaster(sal_True);
253 : }
254 : }
255 40 : break;
256 :
257 : case PRESOBJ_OUTLINE:
258 : {
259 21 : pSdrObj = new SdrRectObj(OBJ_OUTLINETEXT);
260 :
261 21 : if (mbMaster)
262 : {
263 11 : pSdrObj->SetNotVisibleAsMaster(sal_True);
264 : }
265 : }
266 21 : break;
267 :
268 : case PRESOBJ_NOTES:
269 : {
270 44 : pSdrObj = new SdrRectObj(OBJ_TEXT);
271 :
272 44 : if (mbMaster)
273 : {
274 8 : pSdrObj->SetNotVisibleAsMaster(sal_True);
275 : }
276 : }
277 44 : break;
278 :
279 : case PRESOBJ_TEXT:
280 : {
281 8 : pSdrObj = new SdrRectObj(OBJ_TEXT);
282 : }
283 8 : break;
284 :
285 : case PRESOBJ_GRAPHIC:
286 : {
287 1 : BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_GRAPHIC ) );
288 1 : Graphic aGraphic( aBmpEx );
289 1 : OutputDevice &aOutDev = *Application::GetDefaultDevice();
290 1 : aOutDev.Push();
291 :
292 1 : aOutDev.SetMapMode( aGraphic.GetPrefMapMode() );
293 1 : Size aSizePix = aOutDev.LogicToPixel( aGraphic.GetPrefSize() );
294 1 : aOutDev.SetMapMode(MAP_100TH_MM);
295 :
296 1 : Size aSize = aOutDev.PixelToLogic(aSizePix);
297 1 : Point aPnt (0, 0);
298 1 : Rectangle aRect (aPnt, aSize);
299 1 : pSdrObj = new SdrGrafObj(aGraphic, aRect);
300 1 : aOutDev.Pop();
301 : }
302 1 : break;
303 :
304 : case PRESOBJ_MEDIA:
305 : case PRESOBJ_OBJECT:
306 : {
307 1 : pSdrObj = new SdrOle2Obj();
308 1 : BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_OBJECT ) );
309 1 : Graphic aGraphic( aBmpEx );
310 1 : ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
311 : }
312 1 : break;
313 :
314 : case PRESOBJ_CHART:
315 : {
316 0 : pSdrObj = new SdrOle2Obj();
317 0 : ( (SdrOle2Obj*) pSdrObj)->SetProgName( rtl::OUString( "StarChart" ) );
318 0 : BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_CHART ) );
319 0 : Graphic aGraphic( aBmpEx );
320 0 : ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
321 : }
322 0 : break;
323 :
324 : case PRESOBJ_ORGCHART:
325 : {
326 0 : pSdrObj = new SdrOle2Obj();
327 0 : ( (SdrOle2Obj*) pSdrObj)->SetProgName( rtl::OUString( "StarOrg" ) );
328 0 : BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_ORGCHART ) );
329 0 : Graphic aGraphic( aBmpEx );
330 0 : ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
331 : }
332 :
333 : case PRESOBJ_TABLE:
334 : case PRESOBJ_CALC:
335 : {
336 0 : pSdrObj = new SdrOle2Obj();
337 0 : ( (SdrOle2Obj*) pSdrObj)->SetProgName( rtl::OUString( "StarCalc" ) );
338 0 : BitmapEx aBmpEx( SdResId( BMP_PRESOBJ_TABLE ) );
339 0 : Graphic aGraphic( aBmpEx );
340 0 : ( (SdrOle2Obj*) pSdrObj)->SetGraphic(&aGraphic);
341 : }
342 0 : break;
343 :
344 : case PRESOBJ_HANDOUT:
345 : {
346 : //Erste Standardseite am SdrPageObj vermerken
347 : // #i105146# We want no content to be displayed for PK_HANDOUT,
348 : // so just never set a page as content
349 78 : pSdrObj = new SdrPageObj(0);
350 : }
351 78 : break;
352 :
353 : case PRESOBJ_PAGE:
354 : {
355 : //Notizseite am SdrPageObj vermerken
356 34 : sal_uInt16 nDestPageNum(GetPageNum());
357 :
358 34 : if(nDestPageNum)
359 : {
360 : // decrement only when != 0, else we get a 0xffff
361 22 : nDestPageNum -= 1;
362 : }
363 :
364 34 : if(nDestPageNum < pModel->GetPageCount())
365 : {
366 34 : pSdrObj = new SdrPageObj(pModel->GetPage(nDestPageNum));
367 : }
368 : else
369 : {
370 0 : pSdrObj = new SdrPageObj();
371 : }
372 :
373 34 : pSdrObj->SetResizeProtect(sal_True);
374 : }
375 34 : break;
376 :
377 : case PRESOBJ_HEADER:
378 : case PRESOBJ_FOOTER:
379 : case PRESOBJ_DATETIME:
380 : case PRESOBJ_SLIDENUMBER:
381 : {
382 104 : pSdrObj = new SdrRectObj(OBJ_TEXT);
383 104 : bEmptyPresObj = false;
384 104 : bForceText = true;
385 : }
386 104 : break;
387 : default:
388 0 : break;
389 : }
390 :
391 331 : if (pSdrObj)
392 : {
393 331 : pSdrObj->SetEmptyPresObj(bEmptyPresObj);
394 331 : pSdrObj->SetLogicRect(rRect);
395 :
396 331 : InsertObject(pSdrObj);
397 :
398 331 : if ( pSdrObj->ISA(SdrTextObj) )
399 : {
400 : // Tell the object EARLY that it is vertical to have the
401 : // defaults for AutoGrowWidth/Height reversed
402 219 : if(bVertical)
403 0 : ((SdrTextObj*)pSdrObj)->SetVerticalWriting(sal_True);
404 :
405 219 : SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
406 219 : if( bVertical )
407 0 : aTempAttr.Put( SdrTextMinFrameWidthItem( rRect.GetSize().Width() ) );
408 : else
409 219 : aTempAttr.Put( SdrTextMinFrameHeightItem( rRect.GetSize().Height() ) );
410 :
411 219 : if (mbMaster)
412 : {
413 : // Bei Praesentationsobjekten auf der MasterPage soll die
414 : // Groesse vom Benutzwer frei waehlbar sein
415 :
416 : // potential problem: This action was still NOT
417 : // adapted for vertical text. This sure needs to be done.
418 140 : if(bVertical)
419 0 : aTempAttr.Put(SdrTextAutoGrowWidthItem(sal_False));
420 : else
421 140 : aTempAttr.Put(SdrTextAutoGrowHeightItem(sal_False));
422 : }
423 :
424 : // check if we need another vertical adjustement than the default
425 219 : SdrTextVertAdjust eV = SDRTEXTVERTADJUST_TOP;
426 :
427 219 : if( (eObjKind == PRESOBJ_FOOTER) && (mePageKind != PK_STANDARD) )
428 : {
429 19 : eV = SDRTEXTVERTADJUST_BOTTOM;
430 : }
431 200 : else if( (eObjKind == PRESOBJ_SLIDENUMBER) && (mePageKind != PK_STANDARD) )
432 : {
433 20 : eV = SDRTEXTVERTADJUST_BOTTOM;
434 : }
435 :
436 219 : if( eV != SDRTEXTVERTADJUST_TOP )
437 39 : aTempAttr.Put(SdrTextVertAdjustItem(eV));
438 :
439 219 : pSdrObj->SetMergedItemSet(aTempAttr);
440 :
441 219 : pSdrObj->SetLogicRect(rRect);
442 : }
443 :
444 331 : String aString = GetPresObjText(eObjKind);
445 331 : if( (aString.Len() || bForceText) && pSdrObj->ISA(SdrTextObj) )
446 : {
447 219 : SdrOutliner* pOutliner = ( (SdDrawDocument*) GetModel() )->GetInternalOutliner();
448 :
449 219 : sal_uInt16 nOutlMode = pOutliner->GetMode();
450 219 : pOutliner->Init( OUTLINERMODE_TEXTOBJECT );
451 219 : pOutliner->SetStyleSheet( 0, NULL );
452 219 : pOutliner->SetVertical( bVertical );
453 :
454 219 : String aEmptyStr;
455 219 : SetObjText( (SdrTextObj*) pSdrObj, (SdrOutliner*)pOutliner, eObjKind, aString );
456 :
457 219 : pOutliner->Init( nOutlMode );
458 219 : pOutliner->SetStyleSheet( 0, NULL );
459 : }
460 :
461 331 : if( (eObjKind == PRESOBJ_HEADER) || (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_DATETIME) )
462 : {
463 104 : SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
464 104 : aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT ) );
465 104 : aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CTL ) );
466 104 : aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CJK ) );
467 :
468 104 : SvxAdjust eH = SVX_ADJUST_LEFT;
469 :
470 104 : if( (eObjKind == PRESOBJ_DATETIME) && (mePageKind != PK_STANDARD ) )
471 : {
472 19 : eH = SVX_ADJUST_RIGHT;
473 : }
474 85 : else if( (eObjKind == PRESOBJ_FOOTER) && (mePageKind == PK_STANDARD ) )
475 : {
476 9 : eH = SVX_ADJUST_CENTER;
477 : }
478 76 : else if( eObjKind == PRESOBJ_SLIDENUMBER )
479 : {
480 30 : eH = SVX_ADJUST_RIGHT;
481 : }
482 :
483 104 : if( eH != SVX_ADJUST_LEFT )
484 58 : aTempAttr.Put(SvxAdjustItem(eH, EE_PARA_JUST ));
485 :
486 104 : pSdrObj->SetMergedItemSet(aTempAttr);
487 : }
488 :
489 331 : if (mbMaster)
490 : {
491 218 : SdrLayerAdmin& rLayerAdmin = pModel->GetLayerAdmin();
492 :
493 : // Hintergrundobjekte der MasterPage
494 : pSdrObj->SetLayer( rLayerAdmin.
495 218 : GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False) );
496 : }
497 :
498 : // Objekt am StyleSheet anmelden
499 : // Set style only when one was found (as in 5.2)
500 331 : if( mePageKind != PK_HANDOUT )
501 : {
502 205 : SfxStyleSheet* pSheetForPresObj = GetStyleSheetForPresObj(eObjKind);
503 205 : if(pSheetForPresObj)
504 169 : pSdrObj->SetStyleSheet(pSheetForPresObj, sal_False);
505 : }
506 :
507 331 : if (eObjKind == PRESOBJ_OUTLINE)
508 : {
509 210 : for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
510 : {
511 189 : String aName(maLayoutName);
512 189 : aName += sal_Unicode( ' ' );
513 189 : aName += String::CreateFromInt32( nLevel );
514 189 : SfxStyleSheet* pSheet = (SfxStyleSheet*)pModel->GetStyleSheetPool()->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
515 : DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden");
516 189 : if (pSheet)
517 189 : pSdrObj->StartListening(*pSheet);
518 189 : }
519 : }
520 :
521 331 : if ( eObjKind == PRESOBJ_OBJECT ||
522 : eObjKind == PRESOBJ_CHART ||
523 : eObjKind == PRESOBJ_ORGCHART ||
524 : eObjKind == PRESOBJ_CALC ||
525 : eObjKind == PRESOBJ_GRAPHIC )
526 : {
527 2 : SfxItemSet aSet( ((SdDrawDocument*) pModel)->GetPool() );
528 2 : aSet.Put( SdrTextContourFrameItem( sal_True ) );
529 2 : aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
530 :
531 2 : pSdrObj->SetMergedItemSet(aSet);
532 : }
533 :
534 331 : if( bUndo )
535 : {
536 0 : pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj));
537 : }
538 :
539 331 : if( bUndo )
540 : {
541 0 : pUndoManager->AddUndoAction( new UndoObjectPresentationKind( *pSdrObj ) );
542 0 : pUndoManager->AddUndoAction( new UndoObjectUserCall(*pSdrObj) );
543 : }
544 :
545 331 : InsertPresObj(pSdrObj, eObjKind);
546 331 : pSdrObj->SetUserCall(this);
547 :
548 331 : pSdrObj->RecalcBoundRect();
549 : }
550 :
551 331 : return(pSdrObj);
552 : }
553 :
554 : /*************************************************************************
555 : |*
556 : |* Es werden Praesentationsobjekte auf der Page erzeugt.
557 : |* Alle Praesentationsobjekte erhalten einen UserCall auf die Page.
558 : |*
559 : \************************************************************************/
560 :
561 62 : SfxStyleSheet* SdPage::GetStyleSheetForMasterPageBackground() const
562 : {
563 62 : String aName(GetLayoutName());
564 62 : String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
565 62 : sal_uInt16 nPos = aName.Search(aSep);
566 :
567 62 : if (nPos != STRING_NOTFOUND)
568 : {
569 62 : nPos = nPos + aSep.Len();
570 62 : aName.Erase(nPos);
571 : }
572 :
573 62 : aName += String(SdResId(STR_LAYOUT_BACKGROUND));
574 :
575 62 : SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
576 62 : SfxStyleSheetBase* pResult = pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
577 62 : return (SfxStyleSheet*)pResult;
578 : }
579 :
580 332 : SfxStyleSheet* SdPage::GetStyleSheetForPresObj(PresObjKind eObjKind) const
581 : {
582 332 : String aName(GetLayoutName());
583 332 : String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
584 332 : sal_uInt16 nPos = aName.Search(aSep);
585 332 : if (nPos != STRING_NOTFOUND)
586 : {
587 332 : nPos = nPos + aSep.Len();
588 332 : aName.Erase(nPos);
589 : }
590 :
591 332 : switch (eObjKind)
592 : {
593 : case PRESOBJ_OUTLINE:
594 : {
595 44 : aName = GetLayoutName();
596 44 : aName += sal_Unicode( ' ' );
597 44 : aName += String::CreateFromInt32( 1 );
598 : }
599 44 : break;
600 :
601 : case PRESOBJ_TITLE:
602 92 : aName += String(SdResId(STR_LAYOUT_TITLE));
603 92 : break;
604 :
605 : case PRESOBJ_NOTES:
606 72 : aName += String(SdResId(STR_LAYOUT_NOTES));
607 72 : break;
608 :
609 : case PRESOBJ_TEXT:
610 15 : aName += String(SdResId(STR_LAYOUT_SUBTITLE));
611 15 : break;
612 :
613 : case PRESOBJ_HEADER:
614 : case PRESOBJ_FOOTER:
615 : case PRESOBJ_DATETIME:
616 : case PRESOBJ_SLIDENUMBER:
617 71 : aName += String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
618 71 : break;
619 :
620 : default:
621 38 : break;
622 : }
623 :
624 332 : SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
625 332 : SfxStyleSheetBase* pResult = pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
626 332 : return (SfxStyleSheet*)pResult;
627 : }
628 :
629 : /** returns the presentation style with the given helpid from this masterpage or this
630 : slides masterpage */
631 0 : SdStyleSheet* SdPage::getPresentationStyle( sal_uInt32 nHelpId ) const
632 : {
633 0 : String aStyleName( pPage->GetLayoutName() );
634 0 : const String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
635 0 : aStyleName.Erase(aStyleName.Search(aSep) + aSep.Len());
636 :
637 : sal_uInt16 nNameId;
638 0 : switch( nHelpId )
639 : {
640 0 : case HID_PSEUDOSHEET_TITLE: nNameId = STR_LAYOUT_TITLE; break;
641 0 : case HID_PSEUDOSHEET_SUBTITLE: nNameId = STR_LAYOUT_SUBTITLE; break;
642 : case HID_PSEUDOSHEET_OUTLINE1:
643 : case HID_PSEUDOSHEET_OUTLINE2:
644 : case HID_PSEUDOSHEET_OUTLINE3:
645 : case HID_PSEUDOSHEET_OUTLINE4:
646 : case HID_PSEUDOSHEET_OUTLINE5:
647 : case HID_PSEUDOSHEET_OUTLINE6:
648 : case HID_PSEUDOSHEET_OUTLINE7:
649 : case HID_PSEUDOSHEET_OUTLINE8:
650 0 : case HID_PSEUDOSHEET_OUTLINE9: nNameId = STR_LAYOUT_OUTLINE; break;
651 0 : case HID_PSEUDOSHEET_BACKGROUNDOBJECTS: nNameId = STR_LAYOUT_BACKGROUNDOBJECTS; break;
652 0 : case HID_PSEUDOSHEET_BACKGROUND: nNameId = STR_LAYOUT_BACKGROUND; break;
653 0 : case HID_PSEUDOSHEET_NOTES: nNameId = STR_LAYOUT_NOTES; break;
654 :
655 : default:
656 : OSL_FAIL( "SdPage::getPresentationStyle(), illegal argument!" );
657 0 : return 0;
658 : }
659 0 : aStyleName.Append( String( SdResId( nNameId ) ) );
660 0 : if( nNameId == STR_LAYOUT_OUTLINE )
661 : {
662 0 : aStyleName.Append( sal_Unicode( ' ' ));
663 0 : aStyleName.Append( String::CreateFromInt32( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE )));
664 : }
665 :
666 0 : SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
667 0 : SfxStyleSheetBase* pResult = pStShPool->Find(aStyleName, SD_STYLE_FAMILY_MASTERPAGE);
668 0 : return dynamic_cast<SdStyleSheet*>(pResult);
669 : }
670 :
671 : /*************************************************************************
672 : |*
673 : |* Das Praesentationsobjekt rObj hat sich geaendert und wird nicht mehr
674 : |* durch das Praesentationsobjekt der MasterPage referenziert.
675 : |* Der UserCall wird geloescht.
676 : |*
677 : \************************************************************************/
678 :
679 3403 : void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle& )
680 : {
681 3403 : if (!maLockAutoLayoutArrangement.isLocked())
682 : {
683 3293 : switch (eType)
684 : {
685 : case SDRUSERCALL_MOVEONLY:
686 : case SDRUSERCALL_RESIZE:
687 : {
688 58 : if( pModel->isLocked() )
689 58 : break;
690 :
691 0 : SdrObject* pObj = (SdrObject*) &rObj;
692 :
693 0 : if (pObj)
694 : {
695 0 : if (!mbMaster)
696 : {
697 0 : if( pObj->GetUserCall() )
698 : {
699 0 : ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
700 0 : const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
701 :
702 0 : if( bUndo )
703 0 : pUndoManager->AddUndoAction( new UndoObjectUserCall(*pObj) );
704 :
705 : // Objekt was resized by user and does not listen to its slide anymore
706 0 : pObj->SetUserCall(0);
707 : }
708 : }
709 0 : else if (pModel)
710 : {
711 : // MasterPage-Objekt wurde veraendert, daher
712 : // Objekte auf allen Seiten anpassen
713 0 : sal_uInt16 nPageCount = ((SdDrawDocument*) pModel)->GetSdPageCount(mePageKind);
714 :
715 0 : for (sal_uInt16 i = 0; i < nPageCount; i++)
716 : {
717 0 : SdPage* pLoopPage = ((SdDrawDocument*) pModel)->GetSdPage(i, mePageKind);
718 :
719 0 : if (pLoopPage && this == &(pLoopPage->TRG_GetMasterPage()))
720 : {
721 : // Seite hoert auf diese MasterPage, daher
722 : // AutoLayout anpassen
723 0 : pLoopPage->SetAutoLayout(pLoopPage->GetAutoLayout());
724 : }
725 : }
726 : }
727 : }
728 : }
729 0 : break;
730 :
731 : case SDRUSERCALL_DELETE:
732 : case SDRUSERCALL_REMOVED:
733 : default:
734 3235 : break;
735 : }
736 : }
737 3403 : }
738 :
739 : /*************************************************************************
740 : |*
741 : |* Erzeugt auf einer MasterPage Hintergrund, Titel- und Layout-Bereich
742 : |*
743 : \************************************************************************/
744 :
745 115 : void SdPage::CreateTitleAndLayout(sal_Bool bInit, sal_Bool bCreate )
746 : {
747 115 : ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
748 115 : const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
749 :
750 115 : SdPage* pMasterPage = this;
751 :
752 115 : if (!mbMaster)
753 : {
754 102 : pMasterPage = (SdPage*)(&(TRG_GetMasterPage()));
755 : }
756 :
757 115 : if (!pMasterPage)
758 : {
759 115 : return;
760 : }
761 :
762 : /**************************************************************************
763 : * Hintergrund, Titel- und Layout-Bereich werden angelegt
764 : **************************************************************************/
765 115 : if( mePageKind == PK_STANDARD )
766 : {
767 57 : pMasterPage->EnsureMasterPageDefaultBackground();
768 : }
769 :
770 115 : if( ( (SdDrawDocument*) GetModel() )->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
771 : {
772 115 : if( mePageKind == PK_HANDOUT && bInit )
773 : {
774 : // handout template
775 :
776 : // delete all available handout presentation objects
777 : SdrObject* pObj;
778 30 : while( (pObj = pMasterPage->GetPresObj(PRESOBJ_HANDOUT)) != 0 )
779 : {
780 6 : if( bUndo )
781 0 : pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
782 :
783 6 : pMasterPage->RemoveObject(pObj->GetOrdNum());
784 : }
785 :
786 12 : std::vector< Rectangle > aAreas;
787 12 : CalculateHandoutAreas( *static_cast< SdDrawDocument* >(GetModel() ), pMasterPage->GetAutoLayout(), false, aAreas );
788 :
789 12 : const bool bSkip = pMasterPage->GetAutoLayout() == AUTOLAYOUT_HANDOUT3;
790 12 : std::vector< Rectangle >::iterator iter( aAreas.begin() );
791 :
792 96 : while( iter != aAreas.end() )
793 : {
794 72 : SdrPageObj* pPageObj = static_cast<SdrPageObj*>(pMasterPage->CreatePresObj(PRESOBJ_HANDOUT, sal_False, (*iter++), sal_True) );
795 : // #i105146# We want no content to be displayed for PK_HANDOUT,
796 : // so just never set a page as content
797 72 : pPageObj->SetReferencedPage(0L);
798 :
799 72 : if( bSkip && iter != aAreas.end() )
800 0 : ++iter;
801 12 : }
802 : }
803 :
804 115 : if( mePageKind != PK_HANDOUT )
805 : {
806 103 : SdrObject* pMasterTitle = pMasterPage->GetPresObj( PRESOBJ_TITLE );
807 103 : if( pMasterTitle == NULL )
808 13 : pMasterPage->CreateDefaultPresObj(PRESOBJ_TITLE, true);
809 :
810 103 : SdrObject* pMasterOutline = pMasterPage->GetPresObj( mePageKind==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE );
811 103 : if( pMasterOutline == NULL )
812 16 : pMasterPage->CreateDefaultPresObj( mePageKind == PK_STANDARD ? PRESOBJ_OUTLINE : PRESOBJ_NOTES, true );
813 : }
814 :
815 : // create header&footer objects
816 :
817 115 : if( bCreate )
818 : {
819 23 : if( mePageKind != PK_STANDARD )
820 : {
821 17 : SdrObject* pHeader = pMasterPage->GetPresObj( PRESOBJ_HEADER );
822 17 : if( pHeader == NULL )
823 17 : pMasterPage->CreateDefaultPresObj( PRESOBJ_HEADER, true );
824 : }
825 :
826 23 : SdrObject* pDate = pMasterPage->GetPresObj( PRESOBJ_DATETIME );
827 23 : if( pDate == NULL )
828 23 : pMasterPage->CreateDefaultPresObj( PRESOBJ_DATETIME, true );
829 :
830 23 : SdrObject* pFooter = pMasterPage->GetPresObj( PRESOBJ_FOOTER );
831 23 : if( pFooter == NULL )
832 23 : pMasterPage->CreateDefaultPresObj( PRESOBJ_FOOTER, true );
833 :
834 23 : SdrObject* pNumber = pMasterPage->GetPresObj( PRESOBJ_SLIDENUMBER );
835 23 : if( pNumber == NULL )
836 23 : pMasterPage->CreateDefaultPresObj( PRESOBJ_SLIDENUMBER, true );
837 : }
838 : }
839 : }
840 :
841 115 : SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
842 : {
843 115 : if( eObjKind == PRESOBJ_TITLE )
844 : {
845 13 : Rectangle aTitleRect( GetTitleRect() );
846 13 : return CreatePresObj(PRESOBJ_TITLE, sal_False, aTitleRect, bInsert);
847 : }
848 102 : else if( eObjKind == PRESOBJ_OUTLINE )
849 : {
850 9 : Rectangle aLayoutRect( GetLayoutRect() );
851 9 : return CreatePresObj( PRESOBJ_OUTLINE, sal_False, aLayoutRect, bInsert);
852 : }
853 93 : else if( eObjKind == PRESOBJ_NOTES )
854 : {
855 7 : Rectangle aLayoutRect( GetLayoutRect() );
856 7 : return CreatePresObj( PRESOBJ_NOTES, sal_False, aLayoutRect, bInsert);
857 : }
858 86 : else if( (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_DATETIME) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_HEADER ) )
859 : {
860 : // create footer objects for standard master page
861 86 : if( mePageKind == PK_STANDARD )
862 : {
863 18 : const long nLftBorder = GetLftBorder();
864 18 : const long nUppBorder = GetUppBorder();
865 :
866 18 : Point aTitlePos ( nLftBorder, nUppBorder );
867 18 : Size aPageSize ( GetSize() );
868 18 : aPageSize.Width() -= nLftBorder + GetRgtBorder();
869 18 : aPageSize.Height() -= nUppBorder + GetLwrBorder();
870 :
871 18 : const int Y = long(nUppBorder + aPageSize.Height() * 0.911);
872 18 : const int W1 = long(aPageSize.Width() * 0.233);
873 18 : const int W2 = long(aPageSize.Width() * 0.317);
874 18 : const int H = long(aPageSize.Height() * 0.069);
875 :
876 18 : if( eObjKind == PRESOBJ_DATETIME )
877 : {
878 6 : Point aPos( long(nLftBorder+(aPageSize.Width()*0.05)), Y );
879 6 : Size aSize( W1, H );
880 6 : Rectangle aRect( aPos, aSize );
881 6 : return CreatePresObj( PRESOBJ_DATETIME, sal_False, aRect, bInsert );
882 : }
883 12 : else if( eObjKind == PRESOBJ_FOOTER )
884 : {
885 6 : Point aPos( long(nLftBorder+ aPageSize.Width() * 0.342), Y );
886 6 : Size aSize( W2, H );
887 6 : Rectangle aRect( aPos, aSize );
888 6 : return CreatePresObj( PRESOBJ_FOOTER, sal_False, aRect, bInsert );
889 : }
890 6 : else if( eObjKind == PRESOBJ_SLIDENUMBER )
891 : {
892 6 : Point aPos( long(nLftBorder+(aPageSize.Width()*0.717)), Y );
893 6 : Size aSize( W1, H );
894 6 : Rectangle aRect( aPos, aSize );
895 6 : return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert );
896 : }
897 : else
898 : {
899 : OSL_FAIL( "SdPage::CreateDefaultPresObj() - can't create a header placeholder for a slide master" );
900 0 : return NULL;
901 : }
902 : }
903 : else
904 : {
905 : // create header&footer objects for handout and notes master
906 68 : Point aTitlePos ( GetLftBorder(), GetUppBorder() );
907 68 : Size aPageSize ( GetSize() );
908 68 : aPageSize.Width() -= GetLftBorder() + GetRgtBorder();
909 68 : aPageSize.Height() -= GetUppBorder() + GetLwrBorder();
910 :
911 :
912 68 : const int NOTES_HEADER_FOOTER_WIDTH = long(aPageSize.Width() * 0.434);
913 68 : const int NOTES_HEADER_FOOTER_HEIGHT = long(aPageSize.Height() * 0.05);
914 :
915 68 : Size aSize( NOTES_HEADER_FOOTER_WIDTH, NOTES_HEADER_FOOTER_HEIGHT );
916 :
917 68 : const int X1 = GetLftBorder();
918 68 : const int X2 = GetLftBorder() + long(aPageSize.Width() - NOTES_HEADER_FOOTER_WIDTH);
919 68 : const int Y1 = GetUppBorder();
920 68 : const int Y2 = GetUppBorder() + long(aPageSize.Height() - NOTES_HEADER_FOOTER_HEIGHT );
921 :
922 68 : if( eObjKind == PRESOBJ_HEADER )
923 : {
924 17 : Point aPos( X1, Y1 );
925 17 : Rectangle aRect( aPos, aSize );
926 17 : return CreatePresObj( PRESOBJ_HEADER, sal_False, aRect, bInsert );
927 : }
928 51 : else if( eObjKind == PRESOBJ_DATETIME )
929 : {
930 17 : Point aPos( X2, Y1 );
931 17 : Rectangle aRect( aPos, aSize );
932 17 : return CreatePresObj( PRESOBJ_DATETIME, sal_False, aRect, bInsert );
933 : }
934 34 : else if( eObjKind == PRESOBJ_FOOTER )
935 : {
936 17 : Point aPos( X1, Y2 );
937 17 : Rectangle aRect( aPos, aSize );
938 17 : return CreatePresObj( PRESOBJ_FOOTER, sal_False, aRect, bInsert );
939 : }
940 17 : else if( eObjKind == PRESOBJ_SLIDENUMBER )
941 : {
942 17 : Point aPos( X2, Y2 );
943 17 : Rectangle aRect( aPos, aSize );
944 17 : return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert );
945 : }
946 :
947 : OSL_FAIL("SdPage::CreateDefaultPresObj() - this should not happen!");
948 0 : return NULL;
949 : }
950 : }
951 : else
952 : {
953 : OSL_FAIL("SdPage::CreateDefaultPresObj() - unknown PRESOBJ kind" );
954 0 : return NULL;
955 : }
956 : }
957 :
958 : /*************************************************************************
959 : |*
960 : |* Titelbereich zurueckgeben
961 : |*
962 : \************************************************************************/
963 :
964 21 : Rectangle SdPage::GetTitleRect() const
965 : {
966 21 : Rectangle aTitleRect;
967 :
968 21 : if (mePageKind != PK_HANDOUT)
969 : {
970 : /******************************************************************
971 : * Standard- oder Notiz-Seite: Titelbereich
972 : ******************************************************************/
973 21 : Point aTitlePos ( GetLftBorder(), GetUppBorder() );
974 21 : Size aTitleSize ( GetSize() );
975 21 : aTitleSize.Width() -= GetLftBorder() + GetRgtBorder();
976 21 : aTitleSize.Height() -= GetUppBorder() + GetLwrBorder();
977 :
978 21 : if (mePageKind == PK_STANDARD)
979 : {
980 12 : aTitlePos.X() += long( aTitleSize.Width() * 0.05 );
981 12 : aTitlePos.Y() += long( aTitleSize.Height() * 0.0399 );
982 12 : aTitleSize.Width() = long( aTitleSize.Width() * 0.9 );
983 12 : aTitleSize.Height() = long( aTitleSize.Height() * 0.167 );
984 : }
985 9 : else if (mePageKind == PK_NOTES)
986 : {
987 9 : Point aPos = aTitlePos;
988 9 : aPos.Y() += long( aTitleSize.Height() * 0.076 );
989 :
990 : // Hoehe beschraenken
991 9 : aTitleSize.Height() = (long) (aTitleSize.Height() * 0.375);
992 :
993 9 : Size aPartArea = aTitleSize;
994 9 : Size aSize;
995 9 : sal_uInt16 nDestPageNum(GetPageNum());
996 9 : SdrPage* pRefPage = 0L;
997 :
998 9 : if(nDestPageNum)
999 : {
1000 : // only decrement if != 0, else we get 0xffff
1001 8 : nDestPageNum -= 1;
1002 : }
1003 :
1004 9 : if(nDestPageNum < pModel->GetPageCount())
1005 : {
1006 8 : pRefPage = pModel->GetPage(nDestPageNum);
1007 : }
1008 :
1009 9 : if ( pRefPage )
1010 : {
1011 : // tatsaechliche Seitengroesse in das Handout-Rechteck skalieren
1012 8 : double fH = (double) aPartArea.Width() / pRefPage->GetWdt();
1013 8 : double fV = (double) aPartArea.Height() / pRefPage->GetHgt();
1014 :
1015 8 : if ( fH > fV )
1016 8 : fH = fV;
1017 8 : aSize.Width() = (long) (fH * pRefPage->GetWdt());
1018 8 : aSize.Height() = (long) (fH * pRefPage->GetHgt());
1019 :
1020 8 : aPos.X() += (aPartArea.Width() - aSize.Width()) / 2;
1021 8 : aPos.Y() += (aPartArea.Height()- aSize.Height())/ 2;
1022 : }
1023 :
1024 9 : aTitlePos = aPos;
1025 9 : aTitleSize = aSize;
1026 : }
1027 :
1028 21 : aTitleRect.SetPos(aTitlePos);
1029 21 : aTitleRect.SetSize(aTitleSize);
1030 : }
1031 :
1032 21 : return aTitleRect;
1033 : }
1034 :
1035 :
1036 : /*************************************************************************
1037 : |*
1038 : |* Gliederungsbereich zurueckgeben
1039 : |*
1040 : \************************************************************************/
1041 :
1042 64 : Rectangle SdPage::GetLayoutRect() const
1043 : {
1044 64 : Rectangle aLayoutRect;
1045 :
1046 64 : if (mePageKind != PK_HANDOUT)
1047 : {
1048 54 : Point aLayoutPos ( GetLftBorder(), GetUppBorder() );
1049 54 : Size aLayoutSize ( GetSize() );
1050 54 : aLayoutSize.Width() -= GetLftBorder() + GetRgtBorder();
1051 54 : aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder();
1052 :
1053 54 : if (mePageKind == PK_STANDARD)
1054 : {
1055 23 : aLayoutPos.X() += long( aLayoutSize.Width() * 0.05 );
1056 23 : aLayoutPos.Y() += long( aLayoutSize.Height() * 0.234 );
1057 23 : aLayoutSize.Width() = long( aLayoutSize.Width() * 0.88 );
1058 23 : aLayoutSize.Height() = long( aLayoutSize.Height() * 0.58 );
1059 23 : aLayoutRect.SetPos(aLayoutPos);
1060 23 : aLayoutRect.SetSize(aLayoutSize);
1061 : }
1062 31 : else if (mePageKind == PK_NOTES)
1063 : {
1064 31 : aLayoutPos.X() += long( aLayoutSize.Width() * 0.1 );
1065 31 : aLayoutPos.Y() += long( aLayoutSize.Height() * 0.475 );
1066 31 : aLayoutSize.Width() = long( aLayoutSize.Width() * 0.8 );
1067 31 : aLayoutSize.Height() = long( aLayoutSize.Height() * 0.45 );
1068 31 : aLayoutRect.SetPos(aLayoutPos);
1069 31 : aLayoutRect.SetSize(aLayoutSize);
1070 : }
1071 : }
1072 :
1073 64 : return aLayoutRect;
1074 : }
1075 :
1076 :
1077 : /**************************************************************************
1078 : |*
1079 : |* Diese Methode weist ein AutoLayout zu
1080 : |*
1081 : \*************************************************************************/
1082 :
1083 : const int MAX_PRESOBJS = 7; // maximum number of presentation objects per layout
1084 : const int VERTICAL = 0x8000;
1085 :
1086 : struct LayoutDescriptor
1087 : {
1088 : int mnLayout;
1089 : PresObjKind meKind[MAX_PRESOBJS];
1090 : bool mbVertical[MAX_PRESOBJS];
1091 :
1092 : LayoutDescriptor( int nLayout, int k0 = 0, int k1 = 0, int k2 = 0, int k3 = 0, int k4 = 0, int k5 = 0, int k6 = 0 );
1093 : };
1094 :
1095 70 : LayoutDescriptor::LayoutDescriptor( int nLayout, int k0, int k1, int k2, int k3, int k4, int k5, int k6 )
1096 70 : : mnLayout( nLayout )
1097 : {
1098 70 : meKind[0] = static_cast<PresObjKind>(k0 & (~VERTICAL)); mbVertical[0] = (k0 & VERTICAL) == VERTICAL;
1099 70 : meKind[1] = static_cast<PresObjKind>(k1 & (~VERTICAL)); mbVertical[1] = (k1 & VERTICAL) == VERTICAL;
1100 70 : meKind[2] = static_cast<PresObjKind>(k2 & (~VERTICAL)); mbVertical[2] = (k2 & VERTICAL) == VERTICAL;
1101 70 : meKind[3] = static_cast<PresObjKind>(k3 & (~VERTICAL)); mbVertical[3] = (k3 & VERTICAL) == VERTICAL;
1102 70 : meKind[4] = static_cast<PresObjKind>(k4 & (~VERTICAL)); mbVertical[4] = (k4 & VERTICAL) == VERTICAL;
1103 70 : meKind[5] = static_cast<PresObjKind>(k5 & (~VERTICAL)); mbVertical[5] = (k5 & VERTICAL) == VERTICAL;
1104 70 : meKind[6] = static_cast<PresObjKind>(k6 & (~VERTICAL)); mbVertical[6] = (k6 & VERTICAL) == VERTICAL;
1105 70 : }
1106 :
1107 95 : static const LayoutDescriptor& GetLayoutDescriptor( AutoLayout eLayout )
1108 : {
1109 : static LayoutDescriptor aLayouts[AUTOLAYOUT__END-AUTOLAYOUT__START] =
1110 : {
1111 : LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_TEXT ), // AUTOLAYOUT_TITLE
1112 : LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_ENUM
1113 : LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_CHART
1114 : LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_2TEXT
1115 : LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTCHART
1116 : LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_ORG
1117 : LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTCLbIP
1118 : LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_CHARTTEXT
1119 : LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TAB
1120 : LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_CLIPTEXT
1121 : LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTOBJ
1122 : LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OBJECT ), // AUTOLAYOUT_OBJ
1123 : LayoutDescriptor( 2, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXT2OBJ
1124 : LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTOBJ
1125 : LayoutDescriptor( 4, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_OBJOVERTEXT
1126 : LayoutDescriptor( 3, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_2OBJTEXT
1127 : LayoutDescriptor( 5, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_2OBJOVERTEXT
1128 : LayoutDescriptor( 4, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ), // AUTOLAYOUT_TEXTOVEROBJ
1129 : LayoutDescriptor( 6, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, // AUTOLAYOUT_4OBJ
1130 : PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),
1131 : LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_NONE ), // AUTOLAYOUT_ONLY_TITLE
1132 : LayoutDescriptor( 0, PRESOBJ_NONE ), // AUTOLAYOUT_NONE
1133 : LayoutDescriptor( 0, PRESOBJ_PAGE, PRESOBJ_NOTES ), // AUTOLAYOUT_NOTES
1134 : LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT1
1135 : LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT2
1136 : LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT3
1137 : LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT4
1138 : LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT6
1139 : LayoutDescriptor( 7, PRESOBJ_TITLE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL, PRESOBJ_OUTLINE ),// AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
1140 : LayoutDescriptor( 8, PRESOBJ_TITLE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL ), // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
1141 : LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE|VERTICAL ), // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
1142 : LayoutDescriptor( 9, PRESOBJ_TITLE, PRESOBJ_OUTLINE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL ), // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
1143 : LayoutDescriptor( 0 ), // AUTOLAYOUT_HANDOUT9
1144 : LayoutDescriptor( 10, PRESOBJ_TEXT, PRESOBJ_NONE ), // AUTOLAYOUT_ONLY_TEXT
1145 : LayoutDescriptor( 6, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, // AUTOLAYOUT_4CLIPART
1146 : PRESOBJ_GRAPHIC, PRESOBJ_GRAPHIC ),
1147 : LayoutDescriptor( 11, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, // AUTOLAYOUT_6CLIPART
1148 : PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE )
1149 95 : };
1150 :
1151 95 : if( (eLayout < AUTOLAYOUT__START) || (eLayout >= AUTOLAYOUT__END) )
1152 0 : eLayout = AUTOLAYOUT_NONE;
1153 :
1154 95 : return aLayouts[ eLayout - AUTOLAYOUT__START ];
1155 : }
1156 :
1157 95 : static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRectangle )
1158 : {
1159 95 : Rectangle aTitleRect;
1160 95 : Rectangle aLayoutRect;
1161 :
1162 95 : if( rPage.GetPageKind() != PK_HANDOUT )
1163 : {
1164 95 : SdPage& rMasterPage = static_cast<SdPage&>(rPage.TRG_GetMasterPage());
1165 95 : SdrObject* pMasterTitle = rMasterPage.GetPresObj( PRESOBJ_TITLE );
1166 95 : SdrObject* pMasterOutline = rMasterPage.GetPresObj( rPage.GetPageKind()==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE );
1167 :
1168 95 : if( pMasterTitle )
1169 95 : aTitleRect = pMasterTitle->GetLogicRect();
1170 :
1171 95 : if (aTitleRect.IsEmpty() )
1172 1 : aTitleRect = rPage.GetTitleRect();
1173 :
1174 95 : if( pMasterOutline )
1175 95 : aLayoutRect = pMasterOutline->GetLogicRect();
1176 :
1177 95 : if (aLayoutRect.IsEmpty() )
1178 0 : aLayoutRect = rPage.GetLayoutRect();
1179 : }
1180 :
1181 95 : rRectangle[0] = aTitleRect;
1182 :
1183 : int i;
1184 665 : for( i = 1; i < MAX_PRESOBJS; i++ )
1185 570 : rRectangle[i] = aLayoutRect;
1186 :
1187 95 : Point aTitlePos( aTitleRect.TopLeft() );
1188 95 : Size aLayoutSize( aLayoutRect.GetSize() );
1189 95 : Point aLayoutPos( aLayoutRect.TopLeft() );
1190 95 : Size aTempSize;
1191 95 : Point aTempPnt;
1192 :
1193 95 : sal_Bool bRightToLeft = ( rPage.GetModel() && static_cast< SdDrawDocument* >( rPage.GetModel() )->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB );
1194 :
1195 95 : switch( nLayout )
1196 : {
1197 : case 0: // default layout using only the title and layout area
1198 91 : break; // do nothing
1199 : case 1: // title, 2 shapes
1200 : case 9: // title, 2 vertical shapes
1201 1 : aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
1202 1 : rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
1203 :
1204 1 : aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
1205 1 : rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
1206 :
1207 1 : if( bRightToLeft && (nLayout != 9) )
1208 0 : ::std::swap( rRectangle[1], rRectangle[2] );
1209 1 : break;
1210 : case 2: // title, shape, 2 shapes
1211 3 : aTempPnt = aLayoutPos;
1212 3 : aTempSize = aLayoutSize;
1213 3 : aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
1214 3 : aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
1215 3 : aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
1216 3 : rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
1217 :
1218 3 : aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
1219 3 : rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
1220 :
1221 3 : aLayoutPos = aTempPnt;
1222 3 : aLayoutSize = aTempSize;
1223 3 : aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
1224 3 : rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
1225 :
1226 3 : if( bRightToLeft )
1227 : {
1228 0 : ::std::swap( rRectangle[1].Left(), rRectangle[2].Left() );
1229 0 : rRectangle[3].Left() = rRectangle[2].Left();
1230 : }
1231 3 : break;
1232 : case 3: // title, 2 shapes, shape
1233 0 : aTempPnt = aLayoutPos;
1234 0 : aTempSize = aLayoutSize;
1235 0 : aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
1236 0 : aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
1237 0 : rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
1238 :
1239 0 : aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
1240 0 : rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
1241 :
1242 0 : aLayoutPos = aTempPnt;
1243 0 : aLayoutSize = aTempSize;
1244 0 : aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
1245 0 : aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
1246 0 : rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
1247 :
1248 0 : if( bRightToLeft )
1249 : {
1250 0 : ::std::swap( rRectangle[1].Left(), rRectangle[2].Left() );
1251 0 : rRectangle[3].Left() = rRectangle[2].Left();
1252 : }
1253 0 : break;
1254 : case 4: // title, shape above shape
1255 0 : aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
1256 0 : rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
1257 :
1258 0 : aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
1259 0 : rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
1260 0 : break;
1261 :
1262 : case 5: // title, 2 shapes above shape
1263 0 : aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
1264 0 : aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
1265 0 : rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
1266 :
1267 0 : aTempPnt = aLayoutPos;
1268 0 : aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
1269 0 : rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
1270 :
1271 0 : aLayoutPos.X() = aTempPnt.X();
1272 0 : aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
1273 0 : aLayoutSize.Width() = long (aLayoutSize.Width() / 0.488);
1274 0 : rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
1275 0 : break;
1276 : case 6: // title, 4 shapes
1277 : {
1278 0 : sal_uLong nX = long (aLayoutPos.X());
1279 :
1280 0 : aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
1281 0 : aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
1282 0 : rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
1283 :
1284 0 : aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
1285 0 : rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
1286 :
1287 0 : aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
1288 0 : rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
1289 :
1290 0 : aLayoutPos.X() = nX;
1291 0 : rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize);
1292 0 : break;
1293 : }
1294 : case 7: // vertical title, shape above shape
1295 : {
1296 0 : Size aSize( rRectangle[0].GetSize().Height(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
1297 0 : rRectangle[0].SetSize( aSize );
1298 0 : rRectangle[0].SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) );
1299 :
1300 0 : Size aPageSize ( rPage.GetSize() );
1301 0 : aPageSize.Height() -= rPage.GetUppBorder() + rPage.GetLwrBorder();
1302 0 : aSize.Height() = long ( rRectangle[0].GetSize().Height() * 0.47 );
1303 0 : aSize.Width() = long( aPageSize.Width() * 0.7 );
1304 0 : rRectangle[1].SetPos( aTitleRect.TopLeft() );
1305 0 : rRectangle[1].SetSize( aSize );
1306 :
1307 0 : aSize.Height() = rRectangle[0].GetSize().Height();
1308 0 : Point aPos( aTitleRect.TopLeft() );
1309 0 : aPos.Y() += long ( aSize.Height() * 0.53 );
1310 0 : rRectangle[2].SetPos( aPos );
1311 0 : aSize.Height() = long ( rRectangle[0].GetSize().Height() * 0.47 );
1312 0 : rRectangle[2].SetSize( aSize );
1313 : break;
1314 : }
1315 : case 8: // vertical title, shape
1316 : {
1317 0 : Size aSize( rRectangle[0].GetSize().Height(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
1318 0 : rRectangle[0].SetSize( aSize );
1319 0 : rRectangle[0].SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) );
1320 :
1321 0 : Size aPageSize ( rPage.GetSize() );
1322 0 : aPageSize.Height() -= rPage.GetUppBorder() + rPage.GetLwrBorder();
1323 0 : aSize.Height() = rRectangle[0].GetSize().Height();
1324 0 : aSize.Width() = long( aPageSize.Width() * 0.7 );
1325 0 : rRectangle[1].SetPos( aTitleRect.TopLeft() );
1326 0 : rRectangle[1].SetSize( aSize );
1327 : break;
1328 : }
1329 : case 10: // onlytext
1330 : {
1331 0 : Size aSize( rRectangle[0].GetSize().Width(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
1332 0 : rRectangle[0].SetSize( aSize );
1333 0 : rRectangle[0].SetPos( aTitlePos);
1334 : break;
1335 : }
1336 : case 11: // title, 6 shapes
1337 : {
1338 0 : sal_uLong nX = long (aLayoutPos.X());
1339 :
1340 0 : aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
1341 0 : aLayoutSize.Width() = long (aLayoutSize.Width() * 0.322);
1342 0 : rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
1343 :
1344 0 : aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
1345 0 : rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
1346 :
1347 0 : aLayoutPos.X() = long (nX + aLayoutSize.Width() * 2 * 1.05);
1348 0 : rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
1349 :
1350 0 : aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
1351 0 : rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize);
1352 :
1353 0 : aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
1354 0 : rRectangle[5] = Rectangle (aLayoutPos, aLayoutSize);
1355 :
1356 0 : aLayoutPos.X() = nX;
1357 0 : rRectangle[6] = Rectangle (aLayoutPos, aLayoutSize);
1358 :
1359 0 : break;
1360 : }
1361 :
1362 : }
1363 95 : }
1364 :
1365 :
1366 95 : void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescriptor, std::vector< SdrObject* >& rShapes, bool bInit, bool bSwitchLayout )
1367 : {
1368 : int i;
1369 :
1370 : // init list of indexes for each presentation shape kind
1371 : // this is used to find subsequent shapes with the same presentation shape kind
1372 : int PresObjIndex[PRESOBJ_MAX];
1373 95 : for( i = 0; i < PRESOBJ_MAX; i++ ) PresObjIndex[i] = 1;
1374 :
1375 95 : bool bMissing = false;
1376 :
1377 : // for each entry in the layoutdescriptor, arrange a presentation shape
1378 290 : for (i = 0; (i < MAX_PRESOBJS) && (rDescriptor.meKind[i] != PRESOBJ_NONE); i++)
1379 : {
1380 195 : PresObjKind eKind = rDescriptor.meKind[i];
1381 195 : SdrObject* pObj = 0;
1382 400 : while( (pObj = rPage.GetPresObj( eKind, PresObjIndex[eKind], true )) != 0 )
1383 : {
1384 98 : PresObjIndex[eKind]++; // on next search for eKind, find next shape with same eKind
1385 :
1386 98 : if( !bSwitchLayout || !pObj->IsEmptyPresObj() )
1387 : {
1388 88 : rShapes[i] = pObj;
1389 88 : break;
1390 : }
1391 : }
1392 :
1393 195 : if( !pObj )
1394 107 : bMissing = true;
1395 : }
1396 :
1397 95 : if( bMissing && bInit )
1398 : {
1399 : // for each entry in the layoutdescriptor, look for an alternative shape
1400 123 : for (i = 0; (i < MAX_PRESOBJS) && (rDescriptor.meKind[i] != PRESOBJ_NONE); i++)
1401 : {
1402 82 : if( rShapes[i] )
1403 0 : continue;
1404 :
1405 82 : PresObjKind eKind = rDescriptor.meKind[i];
1406 :
1407 82 : SdrObject* pObj = 0;
1408 82 : bool bFound = false;
1409 :
1410 82 : const int nShapeCount = rPage.GetObjCount();
1411 82 : int nShapeIndex = 0;
1412 176 : while((nShapeIndex < nShapeCount) && !bFound )
1413 : {
1414 12 : pObj = rPage.GetObj(nShapeIndex++);
1415 :
1416 12 : if( pObj->IsEmptyPresObj() )
1417 12 : continue;
1418 :
1419 0 : if( pObj->GetObjInventor() != SdrInventor )
1420 0 : continue;
1421 :
1422 : // do not reuse shapes that are already part of the layout
1423 0 : if( std::find( rShapes.begin(), rShapes.end(), pObj ) != rShapes.end() )
1424 0 : continue;
1425 :
1426 0 : bool bPresStyle = pObj->GetStyleSheet() && (pObj->GetStyleSheet()->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE);
1427 0 : SdrObjKind eSdrObjKind = static_cast< SdrObjKind >( pObj->GetObjIdentifier() );
1428 :
1429 0 : switch( eKind )
1430 : {
1431 : case PRESOBJ_TITLE:
1432 0 : bFound = eSdrObjKind == OBJ_TITLETEXT;
1433 0 : break;
1434 : case PRESOBJ_TABLE:
1435 0 : bFound = eSdrObjKind == OBJ_TABLE;
1436 0 : break;
1437 : case PRESOBJ_MEDIA:
1438 0 : bFound = eSdrObjKind == OBJ_MEDIA;
1439 0 : break;
1440 : case PRESOBJ_OUTLINE:
1441 : bFound = (eSdrObjKind == OBJ_OUTLINETEXT) ||
1442 : ((eSdrObjKind == OBJ_TEXT) && bPresStyle) ||
1443 0 : (eSdrObjKind == OBJ_TABLE) || (eSdrObjKind == OBJ_MEDIA) || (eSdrObjKind == OBJ_GRAF) || (eSdrObjKind == OBJ_OLE2);
1444 0 : break;
1445 : case PRESOBJ_GRAPHIC:
1446 0 : bFound = eSdrObjKind == OBJ_GRAF;
1447 0 : break;
1448 : case PRESOBJ_OBJECT:
1449 0 : if( eSdrObjKind == OBJ_OLE2 )
1450 : {
1451 0 : SdrOle2Obj* pOle2 = dynamic_cast< SdrOle2Obj* >( pObj );
1452 0 : if( pOle2 )
1453 : {
1454 0 : if( pOle2->IsEmpty() )
1455 0 : bFound = true;
1456 0 : else if( rPage.GetModel() )
1457 : {
1458 0 : SdrModel* pSdrModel = rPage.GetModel();
1459 0 : ::comphelper::IEmbeddedHelper *pPersist = pSdrModel->GetPersist();
1460 0 : if( pPersist )
1461 : {
1462 0 : uno::Reference < embed::XEmbeddedObject > xObject = pPersist->getEmbeddedObjectContainer().
1463 0 : GetEmbeddedObject( static_cast< SdrOle2Obj* >( pObj )->GetPersistName() );
1464 :
1465 : // TODO CL->KA: Why is this not working anymore?
1466 0 : if( xObject.is() )
1467 : {
1468 0 : SvGlobalName aClassId( xObject->getClassID() );
1469 :
1470 0 : const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID );
1471 0 : const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID );
1472 0 : const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID );
1473 :
1474 0 : if( aPluginClassId != aClassId && aAppletClassId != aClassId && aIFrameClassId != aClassId )
1475 : {
1476 0 : bFound = true;
1477 0 : }
1478 0 : }
1479 : }
1480 : }
1481 : }
1482 : }
1483 0 : break;
1484 : case PRESOBJ_CHART:
1485 : case PRESOBJ_CALC:
1486 0 : if( eSdrObjKind == OBJ_OLE2 )
1487 : {
1488 0 : SdrOle2Obj* pOle2 = dynamic_cast< SdrOle2Obj* >( pObj );
1489 0 : if( pOle2 )
1490 : {
1491 0 : if(
1492 : ((eKind == PRESOBJ_CHART) &&
1493 0 : ( pOle2->GetProgName().EqualsAscii( "StarChart" ) || pOle2->IsChart() ) )
1494 : ||
1495 : ((eKind == PRESOBJ_CALC) &&
1496 0 : ( pOle2->GetProgName().EqualsAscii( "StarCalc" ) || pOle2->IsCalc() ) ) )
1497 : {
1498 0 : bFound = true;
1499 : }
1500 : }
1501 0 : break;
1502 : }
1503 0 : else if( eSdrObjKind == OBJ_TABLE )
1504 : {
1505 0 : bFound = true;
1506 : }
1507 0 : break;
1508 : case PRESOBJ_PAGE:
1509 : case PRESOBJ_HANDOUT:
1510 0 : bFound = eSdrObjKind == OBJ_PAGE;
1511 0 : break;
1512 : case PRESOBJ_NOTES:
1513 : case PRESOBJ_TEXT:
1514 0 : bFound = (bPresStyle && (eSdrObjKind == OBJ_TEXT)) || (eSdrObjKind == OBJ_OUTLINETEXT);
1515 0 : break;
1516 : default:
1517 0 : break;
1518 : }
1519 : }
1520 :
1521 82 : if( bFound )
1522 0 : rShapes[i] = pObj;
1523 : }
1524 : }
1525 95 : }
1526 :
1527 115 : void SdPage::SetAutoLayout(AutoLayout eLayout, sal_Bool bInit, sal_Bool bCreate )
1528 : {
1529 115 : sd::ScopeLockGuard aGuard( maLockAutoLayoutArrangement );
1530 :
1531 115 : const bool bSwitchLayout = eLayout != GetAutoLayout();
1532 :
1533 115 : ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
1534 115 : const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
1535 :
1536 115 : meAutoLayout = eLayout;
1537 :
1538 : // if needed, creates and initialises the presentation shapes on this slides master page
1539 115 : CreateTitleAndLayout(bInit, bCreate);
1540 :
1541 115 : if((meAutoLayout == AUTOLAYOUT_NONE && maPresentationShapeList.isEmpty()) || mbMaster)
1542 : {
1543 : // MasterPage or no layout and no presentation shapes available, noting to do
1544 115 : return;
1545 : }
1546 :
1547 95 : Rectangle aRectangle[MAX_PRESOBJS];
1548 95 : const LayoutDescriptor& aDescriptor = GetLayoutDescriptor( meAutoLayout );
1549 95 : CalcAutoLayoutRectangles( *this, aDescriptor.mnLayout, aRectangle );
1550 :
1551 95 : std::set< SdrObject* > aUsedPresentationObjects;
1552 :
1553 :
1554 95 : std::vector< SdrObject* > aLayoutShapes(PRESOBJ_MAX, 0);
1555 95 : findAutoLayoutShapesImpl( *this, aDescriptor, aLayoutShapes, bInit, bSwitchLayout );
1556 :
1557 : int i;
1558 :
1559 : // for each entry in the layoutdescriptor, arrange a presentation shape
1560 290 : for (i = 0; (i < MAX_PRESOBJS) && (aDescriptor.meKind[i] != PRESOBJ_NONE); i++)
1561 : {
1562 195 : PresObjKind eKind = aDescriptor.meKind[i];
1563 195 : SdrObject* pObj = InsertAutoLayoutShape( aLayoutShapes[i], eKind, aDescriptor.mbVertical[i], aRectangle[i], bInit );
1564 195 : if( pObj )
1565 170 : aUsedPresentationObjects.insert(pObj); // remember that we used this empty shape
1566 : }
1567 :
1568 : // now delete all empty presentation objects that are no longer used by the new layout
1569 95 : if( bInit )
1570 : {
1571 43 : SdrObject* pObj = maPresentationShapeList.getNextShape(0);
1572 :
1573 178 : while( pObj )
1574 : {
1575 92 : SdrObject* pNext = maPresentationShapeList.getNextShape(pObj);
1576 92 : if( aUsedPresentationObjects.count(pObj) == 0 )
1577 : {
1578 :
1579 8 : if( pObj->IsEmptyPresObj() )
1580 : {
1581 8 : if( bUndo )
1582 0 : pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
1583 :
1584 8 : RemoveObject( pObj->GetOrdNum() );
1585 :
1586 8 : if( !bUndo )
1587 8 : SdrObject::Free( pObj );
1588 : }
1589 : /* #i108541# keep non empty pres obj as pres obj even if they are not part of the current layout */
1590 : }
1591 92 : pObj = pNext;
1592 : }
1593 95 : }
1594 : }
1595 :
1596 : /*************************************************************************
1597 : |*
1598 : |* Objekt einfuegen
1599 : |*
1600 : \************************************************************************/
1601 :
1602 713 : void SdPage::NbcInsertObject(SdrObject* pObj, sal_uLong nPos, const SdrInsertReason* pReason)
1603 : {
1604 713 : FmFormPage::NbcInsertObject(pObj, nPos, pReason);
1605 :
1606 713 : ((SdDrawDocument*) pModel)->InsertObject(pObj, this);
1607 :
1608 713 : SdrLayerID nId = pObj->GetLayer();
1609 713 : if( mbMaster )
1610 : {
1611 277 : if( nId == 0 )
1612 227 : pObj->NbcSetLayer( 2 ); // wrong layer. corrected to BackgroundObj layer
1613 : }
1614 : else
1615 : {
1616 436 : if( nId == 2 )
1617 0 : pObj->NbcSetLayer( 0 ); // wrong layer. corrected to layout layer
1618 : }
1619 713 : }
1620 :
1621 : /*************************************************************************
1622 : |*
1623 : |* Objekt loeschen
1624 : |*
1625 : \************************************************************************/
1626 :
1627 107 : SdrObject* SdPage::RemoveObject(sal_uLong nObjNum)
1628 : {
1629 107 : onRemoveObject(GetObj( nObjNum ));
1630 107 : return FmFormPage::RemoveObject(nObjNum);
1631 : }
1632 :
1633 : /*************************************************************************
1634 : |*
1635 : |* Objekt loeschen, ohne Broadcast
1636 : |*
1637 : \************************************************************************/
1638 :
1639 0 : SdrObject* SdPage::NbcRemoveObject(sal_uLong nObjNum)
1640 : {
1641 0 : onRemoveObject(GetObj( nObjNum ));
1642 0 : return FmFormPage::NbcRemoveObject(nObjNum);
1643 : }
1644 :
1645 : // Also overload ReplaceObject methods to realize when
1646 : // objects are removed with this mechanism instead of RemoveObject
1647 0 : SdrObject* SdPage::NbcReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum)
1648 : {
1649 0 : onRemoveObject(GetObj( nObjNum ));
1650 0 : return FmFormPage::NbcReplaceObject(pNewObj, nObjNum);
1651 : }
1652 :
1653 : // Also overload ReplaceObject methods to realize when
1654 : // objects are removed with this mechanism instead of RemoveObject
1655 0 : SdrObject* SdPage::ReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum)
1656 : {
1657 0 : onRemoveObject(GetObj( nObjNum ));
1658 0 : return FmFormPage::ReplaceObject(pNewObj, nObjNum);
1659 : }
1660 :
1661 : // -------------------------------------------------------------------------
1662 :
1663 : // called after a shape is removed or replaced from this slide
1664 :
1665 107 : void SdPage::onRemoveObject( SdrObject* pObject )
1666 : {
1667 107 : if( pObject )
1668 : {
1669 107 : RemovePresObj(pObject);
1670 :
1671 107 : if( pModel )
1672 107 : static_cast<SdDrawDocument*>(pModel)->RemoveObject(pObject, this);
1673 :
1674 107 : removeAnimations( pObject );
1675 : }
1676 107 : }
1677 :
1678 171 : void SdPage::SetSize(const Size& aSize)
1679 : {
1680 171 : Size aOldSize = GetSize();
1681 :
1682 171 : if (aSize != aOldSize)
1683 : {
1684 158 : FmFormPage::SetSize(aSize);
1685 :
1686 158 : if (aOldSize.Height() == 10 && aOldSize.Width() == 10)
1687 : {
1688 : // Die Seite bekommt erstmalig eine gueltige Groesse gesetzt,
1689 : // daher wird nun die Orientation initialisiert
1690 134 : if (aSize.Width() > aSize.Height())
1691 : {
1692 56 : meOrientation = ORIENTATION_LANDSCAPE;
1693 : }
1694 : else
1695 : {
1696 78 : meOrientation = ORIENTATION_PORTRAIT;
1697 : }
1698 : }
1699 : }
1700 171 : }
1701 :
1702 63 : void SdPage::SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 nLwr)
1703 : {
1704 189 : if (nLft != GetLftBorder() || nUpp != GetUppBorder() ||
1705 126 : nRgt != GetRgtBorder() || nLwr != GetLwrBorder() )
1706 : {
1707 0 : FmFormPage::SetBorder(nLft, nUpp, nRgt, nLwr);
1708 : }
1709 63 : }
1710 :
1711 2 : void SdPage::SetLftBorder(sal_Int32 nBorder)
1712 : {
1713 2 : if (nBorder != GetLftBorder() )
1714 : {
1715 2 : FmFormPage::SetLftBorder(nBorder);
1716 : }
1717 2 : }
1718 :
1719 2 : void SdPage::SetRgtBorder(sal_Int32 nBorder)
1720 : {
1721 2 : if (nBorder != GetRgtBorder() )
1722 : {
1723 2 : FmFormPage::SetRgtBorder(nBorder);
1724 : }
1725 2 : }
1726 :
1727 2 : void SdPage::SetUppBorder(sal_Int32 nBorder)
1728 : {
1729 2 : if (nBorder != GetUppBorder() )
1730 : {
1731 2 : FmFormPage::SetUppBorder(nBorder);
1732 : }
1733 2 : }
1734 :
1735 2 : void SdPage::SetLwrBorder(sal_Int32 nBorder)
1736 : {
1737 2 : if (nBorder != GetLwrBorder() )
1738 : {
1739 2 : FmFormPage::SetLwrBorder(nBorder);
1740 : }
1741 2 : }
1742 :
1743 : /*************************************************************************
1744 : |*
1745 : |* Setzt BackgroundFullSize und ruft dann AdjustBackground auf
1746 : |*
1747 : \************************************************************************/
1748 :
1749 2 : void SdPage::SetBackgroundFullSize( sal_Bool bIn )
1750 : {
1751 2 : if( bIn != mbBackgroundFullSize )
1752 : {
1753 0 : mbBackgroundFullSize = bIn;
1754 : }
1755 2 : }
1756 :
1757 : /*************************************************************************
1758 : |*
1759 : |* Alle Objekte an neue Seitengroesse anpassen
1760 : |*
1761 : |* bScaleAllObj: Alle Objekte werden in die neue Flaeche innerhalb der
1762 : |* Seitenraender skaliert. Dabei werden die Position, Groesse und bei
1763 : |* Praesentationsobjekten auf der MasterPage auch die Schrifthoehe der
1764 : |* Praesentationsvorlagen skaliert.
1765 : |*
1766 : \************************************************************************/
1767 :
1768 0 : void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect, sal_Bool bScaleAllObj)
1769 : {
1770 0 : sd::ScopeLockGuard aGuard( maLockAutoLayoutArrangement );
1771 :
1772 0 : mbScaleObjects = bScaleAllObj;
1773 0 : SdrObject* pObj = NULL;
1774 0 : Point aRefPnt(0, 0);
1775 0 : Size aNewPageSize(rNewPageSize);
1776 0 : sal_Int32 nLeft = rNewBorderRect.Left();
1777 0 : sal_Int32 nRight = rNewBorderRect.Right();
1778 0 : sal_Int32 nUpper = rNewBorderRect.Top();
1779 0 : sal_Int32 nLower = rNewBorderRect.Bottom();
1780 :
1781 : // Negative Werte stehen fuer nicht zu aendernde Werte
1782 : // -> aktuelle Werte verwenden
1783 0 : if (aNewPageSize.Width() < 0)
1784 : {
1785 0 : aNewPageSize.Width() = GetWdt();
1786 : }
1787 0 : if (aNewPageSize.Height() < 0)
1788 : {
1789 0 : aNewPageSize.Height() = GetHgt();
1790 : }
1791 0 : if (nLeft < 0)
1792 : {
1793 0 : nLeft = GetLftBorder();
1794 : }
1795 0 : if (nRight < 0)
1796 : {
1797 0 : nRight = GetRgtBorder();
1798 : }
1799 0 : if (nUpper < 0)
1800 : {
1801 0 : nUpper = GetUppBorder();
1802 : }
1803 0 : if (nLower < 0)
1804 : {
1805 0 : nLower = GetLwrBorder();
1806 : }
1807 :
1808 0 : Point aBackgroundPos(nLeft, nUpper);
1809 0 : Size aBackgroundSize(aNewPageSize);
1810 0 : Rectangle aBorderRect (aBackgroundPos, aBackgroundSize);
1811 :
1812 0 : if (mbScaleObjects)
1813 : {
1814 0 : aBackgroundSize.Width() -= nLeft + nRight;
1815 0 : aBackgroundSize.Height() -= nUpper + nLower;
1816 0 : aBorderRect.SetSize(aBackgroundSize);
1817 0 : aNewPageSize = aBackgroundSize;
1818 : }
1819 :
1820 0 : long nOldWidth = GetWdt() - GetLftBorder() - GetRgtBorder();
1821 0 : long nOldHeight = GetHgt() - GetUppBorder() - GetLwrBorder();
1822 :
1823 0 : Fraction aFractX = Fraction(aNewPageSize.Width(), nOldWidth);
1824 0 : Fraction aFractY = Fraction(aNewPageSize.Height(), nOldHeight);
1825 :
1826 0 : sal_uLong nObjCnt = (mbScaleObjects ? GetObjCount() : 0);
1827 :
1828 0 : for (sal_uLong nObj = 0; nObj < nObjCnt; nObj++)
1829 : {
1830 0 : sal_Bool bIsPresObjOnMaster = sal_False;
1831 :
1832 : // Alle Objekte
1833 0 : pObj = GetObj(nObj);
1834 :
1835 0 : if (mbMaster && IsPresObj(pObj))
1836 : {
1837 : // Es ist ein Praesentationsobjekt auf der MasterPage
1838 0 : bIsPresObjOnMaster = sal_True;
1839 : }
1840 :
1841 0 : if (pObj)
1842 : {
1843 : // remember aTopLeft as original TopLeft
1844 0 : Point aTopLeft(pObj->GetCurrentBoundRect().TopLeft());
1845 :
1846 0 : if (!pObj->IsEdgeObj())
1847 : {
1848 : /**************************************************************
1849 : * Objekt skalieren
1850 : **************************************************************/
1851 0 : if (mbScaleObjects)
1852 : {
1853 : // use aTopLeft as original TopLeft
1854 0 : aRefPnt = aTopLeft;
1855 : }
1856 :
1857 0 : pObj->Resize(aRefPnt, aFractX, aFractY);
1858 :
1859 0 : if (mbScaleObjects)
1860 : {
1861 0 : SdrObjKind eObjKind = (SdrObjKind) pObj->GetObjIdentifier();
1862 :
1863 0 : if (bIsPresObjOnMaster)
1864 : {
1865 : /**********************************************************
1866 : * Praesentationsvorlage: Texthoehe anpassen
1867 : **********************************************************/
1868 0 : sal_uInt16 nIndexTitle = 0;
1869 0 : sal_uInt16 nIndexOutline = 0;
1870 0 : sal_uInt16 nIndexNotes = 0;
1871 :
1872 0 : if (pObj == GetPresObj(PRESOBJ_TITLE, nIndexTitle))
1873 : {
1874 0 : SfxStyleSheet* pTitleSheet = GetStyleSheetForPresObj(PRESOBJ_TITLE);
1875 :
1876 0 : if (pTitleSheet)
1877 : {
1878 0 : SfxItemSet& rSet = pTitleSheet->GetItemSet();
1879 :
1880 0 : SvxFontHeightItem& rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT);
1881 0 : sal_uLong nFontHeight = rOldHgt.GetHeight();
1882 0 : nFontHeight = long(nFontHeight * (double) aFractY);
1883 0 : rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT));
1884 :
1885 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) )
1886 : {
1887 0 : rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT_CJK);
1888 0 : nFontHeight = rOldHgt.GetHeight();
1889 0 : nFontHeight = long(nFontHeight * (double) aFractY);
1890 0 : rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
1891 : }
1892 :
1893 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( EE_CHAR_FONTHEIGHT_CTL ) )
1894 : {
1895 0 : rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT_CTL);
1896 0 : nFontHeight = rOldHgt.GetHeight();
1897 0 : nFontHeight = long(nFontHeight * (double) aFractY);
1898 0 : rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL));
1899 : }
1900 :
1901 0 : pTitleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
1902 : }
1903 : }
1904 0 : else if (pObj == GetPresObj(PRESOBJ_OUTLINE, nIndexOutline))
1905 : {
1906 0 : String aName(GetLayoutName());
1907 0 : aName += sal_Unicode( ' ' );
1908 :
1909 0 : for (sal_uInt16 i=1; i<=9; i++)
1910 : {
1911 0 : String sLayoutName(aName);
1912 0 : sLayoutName += String::CreateFromInt32( (sal_Int32)i );
1913 0 : SfxStyleSheet* pOutlineSheet = (SfxStyleSheet*)((SdDrawDocument*) pModel)->GetStyleSheetPool()->Find(sLayoutName, SD_STYLE_FAMILY_MASTERPAGE);
1914 :
1915 0 : if (pOutlineSheet)
1916 : {
1917 : // Neue Fonthoehe berechnen
1918 0 : SfxItemSet aTempSet(pOutlineSheet->GetItemSet());
1919 :
1920 0 : SvxFontHeightItem& rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT);
1921 0 : sal_uLong nFontHeight = rOldHgt.GetHeight();
1922 0 : nFontHeight = long(nFontHeight * (double) aFractY);
1923 0 : aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT));
1924 :
1925 0 : if( SFX_ITEM_AVAILABLE == aTempSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) )
1926 : {
1927 0 : rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT_CJK);
1928 0 : nFontHeight = rOldHgt.GetHeight();
1929 0 : nFontHeight = long(nFontHeight * (double) aFractY);
1930 0 : aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
1931 : }
1932 :
1933 0 : if( SFX_ITEM_AVAILABLE == aTempSet.GetItemState( EE_CHAR_FONTHEIGHT_CTL ) )
1934 : {
1935 0 : rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT_CTL);
1936 0 : nFontHeight = rOldHgt.GetHeight();
1937 0 : nFontHeight = long(nFontHeight * (double) aFractY);
1938 0 : aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL));
1939 : }
1940 :
1941 : // Bullet anpassen
1942 0 : ((SdStyleSheet*) pOutlineSheet)->AdjustToFontHeight(aTempSet, sal_False);
1943 :
1944 : // Sonderbehandlung: die INVALIDS auf NULL-Pointer
1945 : // zurueckgesetzen (sonst landen INVALIDs oder
1946 : // Pointer auf die DefaultItems in der Vorlage;
1947 : // beides wuerde die Attribut-Vererbung unterbinden)
1948 0 : aTempSet.ClearInvalidItems();
1949 :
1950 : // Sonderbehandlung: nur die gueltigen Anteile des
1951 : // BulletItems
1952 0 : if (aTempSet.GetItemState(EE_PARA_BULLET) == SFX_ITEM_AVAILABLE)
1953 : {
1954 0 : SvxBulletItem aOldBulItem((SvxBulletItem&) pOutlineSheet->GetItemSet().Get(EE_PARA_BULLET));
1955 0 : SvxBulletItem& rNewBulItem = (SvxBulletItem&) aTempSet.Get(EE_PARA_BULLET);
1956 0 : aOldBulItem.CopyValidProperties(rNewBulItem);
1957 0 : aTempSet.Put(aOldBulItem);
1958 : }
1959 :
1960 0 : pOutlineSheet->GetItemSet().Put(aTempSet);
1961 0 : pOutlineSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
1962 : }
1963 0 : }
1964 : }
1965 0 : else if (pObj == GetPresObj(PRESOBJ_NOTES, nIndexNotes))
1966 : {
1967 0 : SfxStyleSheet* pNotesSheet = GetStyleSheetForPresObj(PRESOBJ_NOTES);
1968 :
1969 0 : if (pNotesSheet)
1970 : {
1971 0 : sal_uLong nHeight = pObj->GetLogicRect().GetSize().Height();
1972 0 : sal_uLong nFontHeight = (sal_uLong) (nHeight * 0.0741);
1973 0 : SfxItemSet& rSet = pNotesSheet->GetItemSet();
1974 0 : rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT ));
1975 0 : rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK ));
1976 0 : rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL ));
1977 0 : pNotesSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
1978 : }
1979 : }
1980 : }
1981 0 : else if ( eObjKind != OBJ_TITLETEXT &&
1982 : eObjKind != OBJ_OUTLINETEXT &&
1983 0 : pObj->ISA(SdrTextObj) &&
1984 0 : pObj->GetOutlinerParaObject() )
1985 : {
1986 : /******************************************************
1987 : * Normales Textobjekt: Texthoehe anpassen
1988 : ******************************************************/
1989 0 : sal_uLong nScriptType = pObj->GetOutlinerParaObject()->GetTextObject().GetScriptType();
1990 0 : sal_uInt16 nWhich = EE_CHAR_FONTHEIGHT;
1991 0 : if ( nScriptType == SCRIPTTYPE_ASIAN )
1992 0 : nWhich = EE_CHAR_FONTHEIGHT_CJK;
1993 0 : else if ( nScriptType == SCRIPTTYPE_COMPLEX )
1994 0 : nWhich = EE_CHAR_FONTHEIGHT_CTL;
1995 :
1996 : // use more modern method to scale the text height
1997 0 : sal_uInt32 nFontHeight = ((SvxFontHeightItem&)pObj->GetMergedItem(nWhich)).GetHeight();
1998 0 : sal_uInt32 nNewFontHeight = sal_uInt32((double)nFontHeight * (double)aFractY);
1999 :
2000 0 : pObj->SetMergedItem(SvxFontHeightItem(nNewFontHeight, 100, nWhich));
2001 : }
2002 : }
2003 : }
2004 :
2005 0 : if (mbScaleObjects && !pObj->IsEdgeObj())
2006 : {
2007 : /**************************************************************
2008 : * Objektposition skalieren
2009 : **************************************************************/
2010 0 : Point aNewPos;
2011 :
2012 : // corrected scaling; only distances may be scaled
2013 : // use aTopLeft as original TopLeft
2014 0 : aNewPos.X() = long((aTopLeft.X() - GetLftBorder()) * (double)aFractX) + nLeft;
2015 0 : aNewPos.Y() = long((aTopLeft.Y() - GetUppBorder()) * (double)aFractY) + nUpper;
2016 :
2017 0 : Size aVec(aNewPos.X() - aTopLeft.X(), aNewPos.Y() - aTopLeft.Y());
2018 :
2019 0 : if (aVec.Height() != 0 || aVec.Width() != 0)
2020 : {
2021 0 : pObj->NbcMove(aVec);
2022 : }
2023 :
2024 0 : pObj->SetChanged();
2025 0 : pObj->BroadcastObjectChange();
2026 : }
2027 : }
2028 0 : }
2029 0 : }
2030 :
2031 2 : SdrObject* convertPresentationObjectImpl( SdPage& rPage, SdrObject* pSourceObj, PresObjKind& eObjKind, bool bVertical, Rectangle aRect )
2032 : {
2033 2 : SdDrawDocument* pModel = static_cast< SdDrawDocument* >( rPage.GetModel() );
2034 : DBG_ASSERT( pModel, "sd::convertPresentationObjectImpl(), no model on page!" );
2035 2 : if( !pModel || !pSourceObj )
2036 0 : return pSourceObj;
2037 :
2038 2 : ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
2039 2 : const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && rPage.IsInserted();
2040 :
2041 2 : SdrObject* pNewObj = pSourceObj;
2042 2 : if((eObjKind == PRESOBJ_OUTLINE) && (pSourceObj->GetObjIdentifier() == OBJ_TEXT) )
2043 : {
2044 0 : pNewObj = rPage.CreatePresObj(PRESOBJ_OUTLINE, bVertical, aRect);
2045 :
2046 : // Text des Untertitels in das PRESOBJ_OUTLINE setzen
2047 0 : OutlinerParaObject* pOutlParaObj = pSourceObj->GetOutlinerParaObject();
2048 :
2049 0 : if(pOutlParaObj)
2050 : {
2051 : // Text umsetzen
2052 0 : ::sd::Outliner* pOutl = pModel->GetInternalOutliner( sal_True );
2053 0 : pOutl->Clear();
2054 0 : pOutl->SetText( *pOutlParaObj );
2055 0 : pOutlParaObj = pOutl->CreateParaObject();
2056 0 : pNewObj->SetOutlinerParaObject( pOutlParaObj );
2057 0 : pOutl->Clear();
2058 0 : pNewObj->SetEmptyPresObj(sal_False);
2059 :
2060 0 : for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
2061 : {
2062 : // Neue Vorlage zuweisen
2063 0 : String aName(rPage.GetLayoutName());
2064 0 : aName += sal_Unicode( ' ' );
2065 0 : aName += String::CreateFromInt32( nLevel );
2066 0 : SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pModel->GetStyleSheetPool()->Find(aName, SD_STYLE_FAMILY_MASTERPAGE) );
2067 :
2068 0 : if (pSheet)
2069 : {
2070 0 : if (nLevel == 1)
2071 : {
2072 0 : SfxStyleSheet* pSubtitleSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
2073 :
2074 0 : if (pSubtitleSheet)
2075 0 : pOutlParaObj->ChangeStyleSheetName(SD_STYLE_FAMILY_MASTERPAGE, pSubtitleSheet->GetName(), pSheet->GetName());
2076 : }
2077 :
2078 0 : pNewObj->StartListening(*pSheet);
2079 : }
2080 0 : }
2081 :
2082 : // LRSpace-Item loeschen
2083 0 : SfxItemSet aSet(pModel->GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
2084 :
2085 0 : aSet.Put(pNewObj->GetMergedItemSet());
2086 :
2087 0 : aSet.ClearItem(EE_PARA_LRSPACE);
2088 :
2089 0 : pNewObj->SetMergedItemSet(aSet);
2090 :
2091 0 : if( bUndo )
2092 0 : pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj) );
2093 :
2094 : // Remove outline shape from page
2095 0 : rPage.RemoveObject( pSourceObj->GetOrdNum() );
2096 :
2097 0 : if( !bUndo )
2098 0 : SdrObject::Free( pSourceObj );
2099 : }
2100 : }
2101 2 : else if((eObjKind == PRESOBJ_TEXT) && (pSourceObj->GetObjIdentifier() == OBJ_OUTLINETEXT) )
2102 : {
2103 : // is there an outline shape we can use to replace empty subtitle shape?
2104 0 : pNewObj = rPage.CreatePresObj(PRESOBJ_TEXT, bVertical, aRect);
2105 :
2106 : // Text des Gliederungsobjekts in das PRESOBJ_TITLE setzen
2107 0 : OutlinerParaObject* pOutlParaObj = pSourceObj->GetOutlinerParaObject();
2108 :
2109 0 : if(pOutlParaObj)
2110 : {
2111 : // Text umsetzen
2112 0 : ::sd::Outliner* pOutl = pModel->GetInternalOutliner();
2113 0 : pOutl->Clear();
2114 0 : pOutl->SetText( *pOutlParaObj );
2115 0 : pOutlParaObj = pOutl->CreateParaObject();
2116 0 : pNewObj->SetOutlinerParaObject( pOutlParaObj );
2117 0 : pOutl->Clear();
2118 0 : pNewObj->SetEmptyPresObj(sal_False);
2119 :
2120 : // Linken Einzug zuruecksetzen
2121 0 : SfxItemSet aSet(pModel->GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
2122 :
2123 0 : aSet.Put(pNewObj->GetMergedItemSet());
2124 :
2125 0 : const SvxLRSpaceItem& rLRItem = (const SvxLRSpaceItem&) aSet.Get(EE_PARA_LRSPACE);
2126 0 : SvxLRSpaceItem aNewLRItem(rLRItem);
2127 0 : aNewLRItem.SetTxtLeft(0);
2128 0 : aSet.Put(aNewLRItem);
2129 :
2130 0 : pNewObj->SetMergedItemSet(aSet);
2131 :
2132 0 : SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
2133 0 : if (pSheet)
2134 0 : pNewObj->SetStyleSheet(pSheet, sal_True);
2135 :
2136 : // Remove subtitle shape from page
2137 0 : if( bUndo )
2138 0 : pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj));
2139 :
2140 0 : rPage.RemoveObject( pSourceObj->GetOrdNum() );
2141 :
2142 0 : if( !bUndo )
2143 0 : SdrObject::Free( pSourceObj );
2144 : }
2145 : }
2146 2 : else if((eObjKind == PRESOBJ_OUTLINE) && (pSourceObj->GetObjIdentifier() != OBJ_OUTLINETEXT) )
2147 : {
2148 0 : switch( pSourceObj->GetObjIdentifier() )
2149 : {
2150 0 : case OBJ_TABLE: eObjKind = PRESOBJ_TABLE; break;
2151 0 : case OBJ_MEDIA: eObjKind = PRESOBJ_MEDIA; break;
2152 0 : case OBJ_GRAF: eObjKind = PRESOBJ_GRAPHIC; break;
2153 0 : case OBJ_OLE2: eObjKind = PRESOBJ_OBJECT; break;
2154 : }
2155 : }
2156 :
2157 2 : return pNewObj;
2158 : }
2159 :
2160 : /** reuses or creates a presentation shape for an auto layout that fits the given parameter
2161 :
2162 : @param eObjKind
2163 : The kind of presentation shape we like to have
2164 : @param nIndex
2165 : If > 1 we skip the first nIndex-1 shapes with the presentation shape kind eObjKind while
2166 : looking for an existing presentation shape
2167 : @param bVertical
2168 : If true, the shape is created vertical if bInit is true
2169 : @param aRect
2170 : The rectangle that should be used to transform the shape
2171 : @param bInit
2172 : If true the shape is created if not found
2173 : @returns
2174 : A presentation shape that was either found or created with the given parameters
2175 : */
2176 195 : SdrObject* SdPage::InsertAutoLayoutShape( SdrObject* pObj, PresObjKind eObjKind, bool bVertical, Rectangle aRect, bool bInit )
2177 : {
2178 195 : ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
2179 195 : const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
2180 :
2181 195 : if (!pObj && bInit)
2182 : {
2183 82 : pObj = CreatePresObj(eObjKind, bVertical, aRect);
2184 : }
2185 113 : else if ( pObj && (pObj->GetUserCall() || bInit) )
2186 : {
2187 : // convert object if shape type does not match kind (f.e. converting outline text to subtitle text)
2188 2 : if( bInit )
2189 2 : pObj = convertPresentationObjectImpl( *this, pObj, eObjKind, bVertical, aRect );
2190 :
2191 2 : if( bUndo )
2192 : {
2193 0 : pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
2194 0 : pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoAttrObject( *pObj, sal_True, sal_True ) );
2195 0 : pUndoManager->AddUndoAction( new UndoObjectUserCall( *pObj ) );
2196 : }
2197 :
2198 2 : ( /*(SdrGrafObj*)*/ pObj)->AdjustToMaxRect( aRect );
2199 :
2200 2 : pObj->SetUserCall(this);
2201 :
2202 2 : SdrTextObj* pTextObject = dynamic_cast< SdrTextObj* >(pObj);
2203 2 : if( pTextObject )
2204 : {
2205 2 : if( pTextObject->IsVerticalWriting() != (bVertical ? sal_True : sal_False) )
2206 : {
2207 0 : pTextObject->SetVerticalWriting( bVertical );
2208 :
2209 : // here make sure the correct anchoring is used when the object
2210 : // is re-used but orientation is changed
2211 0 : if(PRESOBJ_OUTLINE == eObjKind)
2212 0 : pTextObject->SetMergedItem(SdrTextHorzAdjustItem( bVertical ? SDRTEXTHORZADJUST_RIGHT : SDRTEXTHORZADJUST_BLOCK ));
2213 : }
2214 :
2215 2 : if( !mbMaster && (pTextObject->GetObjIdentifier() != OBJ_TABLE) )
2216 : {
2217 2 : if ( pTextObject->IsAutoGrowHeight() )
2218 : {
2219 : // switch off AutoGrowHeight, set new MinHeight
2220 2 : SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
2221 2 : SdrTextMinFrameHeightItem aMinHeight( aRect.GetSize().Height() );
2222 2 : aTempAttr.Put( aMinHeight );
2223 2 : aTempAttr.Put( SdrTextAutoGrowHeightItem(sal_False) );
2224 2 : pTextObject->SetMergedItemSet(aTempAttr);
2225 2 : pTextObject->SetLogicRect(aRect);
2226 :
2227 : // switch on AutoGrowHeight
2228 2 : SfxItemSet aAttr( ((SdDrawDocument*) pModel)->GetPool() );
2229 2 : aAttr.Put( SdrTextAutoGrowHeightItem(sal_True) );
2230 :
2231 2 : pTextObject->SetMergedItemSet(aAttr);
2232 : }
2233 :
2234 2 : if ( pTextObject->IsAutoGrowWidth() )
2235 : {
2236 : // switch off AutoGrowWidth , set new MinWidth
2237 0 : SfxItemSet aTempAttr( ((SdDrawDocument*) pModel)->GetPool() );
2238 0 : SdrTextMinFrameWidthItem aMinWidth( aRect.GetSize().Width() );
2239 0 : aTempAttr.Put( aMinWidth );
2240 0 : aTempAttr.Put( SdrTextAutoGrowWidthItem(sal_False) );
2241 0 : pTextObject->SetMergedItemSet(aTempAttr);
2242 0 : pTextObject->SetLogicRect(aRect);
2243 :
2244 : // switch on AutoGrowWidth
2245 0 : SfxItemSet aAttr( ((SdDrawDocument*) pModel)->GetPool() );
2246 0 : aAttr.Put( SdrTextAutoGrowWidthItem(sal_True) );
2247 0 : pTextObject->SetMergedItemSet(aAttr);
2248 : }
2249 : }
2250 : }
2251 : }
2252 :
2253 195 : if(pObj && bInit )
2254 : {
2255 84 : if( !IsPresObj( pObj ) )
2256 : {
2257 0 : if( bUndo )
2258 0 : pUndoManager->AddUndoAction( new UndoObjectPresentationKind( *pObj ) );
2259 :
2260 0 : InsertPresObj( pObj, eObjKind );
2261 : }
2262 :
2263 : // make adjustments for vertical title and outline shapes
2264 84 : if( bVertical && (( eObjKind == PRESOBJ_TITLE) || (eObjKind == PRESOBJ_OUTLINE)))
2265 : {
2266 0 : SfxItemSet aNewSet(pObj->GetMergedItemSet());
2267 0 : aNewSet.Put( SdrTextAutoGrowWidthItem(sal_True) );
2268 0 : aNewSet.Put( SdrTextAutoGrowHeightItem(sal_False) );
2269 0 : if( eObjKind == PRESOBJ_OUTLINE )
2270 : {
2271 0 : aNewSet.Put( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) );
2272 0 : aNewSet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT) );
2273 : }
2274 0 : pObj->SetMergedItemSet(aNewSet);
2275 : }
2276 : }
2277 :
2278 195 : if ( pObj && (pObj->GetUserCall() || bInit) && ( pObj->IsEmptyPresObj() || !pObj->ISA(SdrGrafObj) ) )
2279 84 : pObj->AdjustToMaxRect( aRect );
2280 :
2281 195 : return pObj;
2282 : }
2283 :
2284 :
2285 : /*************************************************************************
2286 : |*
2287 : |* Liefert den PresObjKind eines Objektes zurueck
2288 : |*
2289 : \************************************************************************/
2290 :
2291 1017 : PresObjKind SdPage::GetPresObjKind(SdrObject* pObj) const
2292 : {
2293 1017 : PresObjKind eKind = PRESOBJ_NONE;
2294 1017 : if( (pObj != 0) && (maPresentationShapeList.hasShape(*pObj)) )
2295 : {
2296 111 : SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj);
2297 111 : if( pInfo )
2298 111 : eKind = pInfo->mePresObjKind;
2299 : }
2300 :
2301 1017 : return eKind;
2302 : }
2303 :
2304 130 : bool SdPage::IsPresObj(const SdrObject* pObj)
2305 : {
2306 130 : return pObj && maPresentationShapeList.hasShape( const_cast<SdrObject&>(*pObj) );
2307 : }
2308 :
2309 195 : void SdPage::RemovePresObj(const SdrObject* pObj)
2310 : {
2311 195 : if( pObj && maPresentationShapeList.hasShape(const_cast<SdrObject&>(*pObj)) )
2312 : {
2313 102 : SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(const_cast<SdrObject&>(*pObj));
2314 102 : if( pInfo )
2315 102 : pInfo->mePresObjKind = PRESOBJ_NONE;
2316 102 : maPresentationShapeList.removeShape(const_cast<SdrObject&>(*pObj));
2317 : }
2318 195 : }
2319 :
2320 465 : void SdPage::InsertPresObj(SdrObject* pObj, PresObjKind eKind )
2321 : {
2322 : DBG_ASSERT( pObj, "sd::SdPage::InsertPresObj(), invalid presentation object inserted!" );
2323 : DBG_ASSERT( !IsPresObj(pObj), "sd::SdPage::InsertPresObj(), presentation object inserted twice!" );
2324 465 : if( pObj )
2325 : {
2326 465 : SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj, true);
2327 465 : if( pInfo )
2328 465 : pInfo->mePresObjKind = eKind;
2329 465 : maPresentationShapeList.addShape(*pObj);
2330 : }
2331 465 : }
2332 :
2333 : /*************************************************************************
2334 : |*
2335 : |* Text des Objektes setzen
2336 : |*
2337 : \************************************************************************/
2338 :
2339 237 : void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const String& rString )
2340 : {
2341 237 : if ( pObj )
2342 : {
2343 : DBG_ASSERT( pObj->ISA(SdrTextObj), "SetObjText: Kein SdrTextObj!" );
2344 237 : ::Outliner* pOutl = pOutliner;
2345 :
2346 237 : if (!pOutliner)
2347 : {
2348 10 : SfxItemPool* pPool = ((SdDrawDocument*) GetModel())->GetDrawOutliner().GetEmptyItemSet().GetPool();
2349 10 : pOutl = new ::Outliner( pPool, OUTLINERMODE_OUTLINEOBJECT );
2350 10 : pOutl->SetRefDevice( SD_MOD()->GetRefDevice( *( (SdDrawDocument*) GetModel() )->GetDocSh() ) );
2351 10 : pOutl->SetEditTextObjectPool(pPool);
2352 10 : pOutl->SetStyleSheetPool((SfxStyleSheetPool*)GetModel()->GetStyleSheetPool());
2353 10 : pOutl->EnableUndo(sal_False);
2354 10 : pOutl->SetUpdateMode( sal_False );
2355 : }
2356 :
2357 237 : sal_uInt16 nOutlMode = pOutl->GetMode();
2358 237 : Size aPaperSize = pOutl->GetPaperSize();
2359 237 : sal_Bool bUpdateMode = pOutl->GetUpdateMode();
2360 237 : pOutl->SetUpdateMode(sal_False);
2361 237 : pOutl->SetParaAttribs( 0, pOutl->GetEmptyItemSet() );
2362 :
2363 : // Always set the object's StyleSheet at the Outliner to
2364 : // use the current objects StyleSheet. Thus it's the same as in
2365 : // SetText(...).
2366 : // Moved this implementation from where SetObjText(...) was called
2367 : // to inside this method to work even when outliner is fetched here.
2368 237 : pOutl->SetStyleSheet(0, pObj->GetStyleSheet());
2369 :
2370 237 : rtl::OUString aString;
2371 :
2372 237 : switch( eObjKind )
2373 : {
2374 : case PRESOBJ_OUTLINE:
2375 : {
2376 26 : pOutl->Init( OUTLINERMODE_OUTLINEOBJECT );
2377 :
2378 26 : aString += "\t";
2379 26 : aString += rString;
2380 :
2381 26 : if (mbMaster)
2382 : {
2383 16 : pOutl->SetStyleSheet( 0, GetStyleSheetForPresObj(eObjKind) );
2384 16 : aString += "\n\t\t";
2385 16 : aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER2);
2386 :
2387 16 : aString += "\n\t\t\t";
2388 16 : aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER3);
2389 :
2390 16 : aString += "\n\t\t\t\t";
2391 16 : aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER4);
2392 :
2393 16 : aString += "\n\t\t\t\t\t";
2394 16 : aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER5);
2395 :
2396 16 : aString += "\n\t\t\t\t\t\t";
2397 16 : aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER6);
2398 :
2399 16 : aString += "\n\t\t\t\t\t\t\t";
2400 16 : aString += SD_RESSTR(STR_PRESOBJ_MPOUTLLAYER7);
2401 :
2402 : }
2403 : }
2404 26 : break;
2405 :
2406 : case PRESOBJ_TITLE:
2407 : {
2408 49 : pOutl->Init( OUTLINERMODE_TITLEOBJECT );
2409 49 : aString += rString;
2410 : }
2411 49 : break;
2412 :
2413 : default:
2414 : {
2415 162 : pOutl->Init( OUTLINERMODE_TEXTOBJECT );
2416 162 : aString += rString;
2417 :
2418 : // check if we need to add a text field
2419 162 : SvxFieldData* pData = NULL;
2420 :
2421 162 : switch( eObjKind )
2422 : {
2423 : case PRESOBJ_HEADER:
2424 19 : pData = new SvxHeaderField();
2425 19 : break;
2426 : case PRESOBJ_FOOTER:
2427 28 : pData = new SvxFooterField();
2428 28 : break;
2429 : case PRESOBJ_SLIDENUMBER:
2430 30 : pData = new SvxPageField();
2431 30 : break;
2432 : case PRESOBJ_DATETIME:
2433 27 : pData = new SvxDateTimeField();
2434 27 : break;
2435 : default:
2436 58 : break;
2437 : }
2438 :
2439 162 : if( pData )
2440 : {
2441 104 : ESelection e;
2442 104 : SvxFieldItem aField( *pData, EE_FEATURE_FIELD );
2443 104 : pOutl->QuickInsertField(aField,e);
2444 104 : delete pData;
2445 : }
2446 : }
2447 162 : break;
2448 : }
2449 :
2450 237 : pOutl->SetPaperSize( pObj->GetLogicRect().GetSize() );
2451 :
2452 237 : if( !aString.isEmpty() )
2453 133 : pOutl->SetText( aString, pOutl->GetParagraph( 0 ) );
2454 :
2455 237 : ( (SdrTextObj*) pObj)->SetOutlinerParaObject( pOutl->CreateParaObject() );
2456 :
2457 237 : if (!pOutliner)
2458 : {
2459 10 : delete pOutl;
2460 10 : pOutl = NULL;
2461 : }
2462 : else
2463 : {
2464 : // Outliner restaurieren
2465 227 : pOutl->Init( nOutlMode );
2466 227 : pOutl->SetParaAttribs( 0, pOutl->GetEmptyItemSet() );
2467 227 : pOutl->SetUpdateMode( bUpdateMode );
2468 227 : pOutl->SetPaperSize( aPaperSize );
2469 237 : }
2470 : }
2471 237 : }
2472 :
2473 : /*************************************************************************
2474 : |*
2475 : |* Link & Daten von einem VControl empfangen
2476 : |*
2477 : \************************************************************************/
2478 :
2479 0 : void SdPage::SetLinkData(const String&, const String& )
2480 : {
2481 0 : }
2482 :
2483 : /*************************************************************************
2484 : |*
2485 : |* Layoutname setzen
2486 : |*
2487 : \************************************************************************/
2488 132 : void SdPage::SetLayoutName(OUString aName)
2489 : {
2490 132 : maLayoutName = aName;
2491 :
2492 132 : if( mbMaster )
2493 : {
2494 25 : OUString aSep(SD_LT_SEPARATOR);
2495 25 : sal_Int32 nPos = maLayoutName.indexOf(aSep);
2496 25 : if (nPos != -1)
2497 25 : FmFormPage::SetName(maLayoutName.copy(0, nPos));
2498 : }
2499 132 : }
2500 :
2501 :
2502 : /*************************************************************************
2503 : |*
2504 : |* Seitenname zurueckgeben und ggf. generieren
2505 : |*
2506 : \************************************************************************/
2507 :
2508 99 : const String& SdPage::GetName() const
2509 : {
2510 99 : String aCreatedPageName( maCreatedPageName );
2511 99 : if (GetRealName().Len() == 0)
2512 : {
2513 84 : if ((mePageKind == PK_STANDARD || mePageKind == PK_NOTES) && !mbMaster)
2514 : {
2515 : // default name for handout pages
2516 46 : sal_uInt16 nNum = (GetPageNum() + 1) / 2;
2517 :
2518 46 : aCreatedPageName = String(SdResId(STR_PAGE));
2519 46 : aCreatedPageName += sal_Unicode( ' ' );
2520 46 : if( GetModel()->GetPageNumType() == SVX_NUMBER_NONE )
2521 : {
2522 : // if the document has number none as a formating
2523 : // for page numbers we still default to arabic numbering
2524 : // to keep the default page names unique
2525 0 : aCreatedPageName += String::CreateFromInt32( (sal_Int32)nNum );
2526 : }
2527 : else
2528 : {
2529 46 : aCreatedPageName += ((SdDrawDocument*) GetModel())->CreatePageNumValue(nNum);
2530 46 : }
2531 : }
2532 : else
2533 : {
2534 : /******************************************************************
2535 : * Defaultname fuer Handzettelseiten
2536 : ******************************************************************/
2537 38 : aCreatedPageName = String(SdResId(STR_LAYOUT_DEFAULT_NAME));
2538 : }
2539 : }
2540 : else
2541 : {
2542 15 : aCreatedPageName = GetRealName();
2543 : }
2544 :
2545 99 : if (mePageKind == PK_NOTES)
2546 : {
2547 31 : aCreatedPageName += sal_Unicode( ' ' );
2548 31 : aCreatedPageName += String(SdResId(STR_NOTES));
2549 : }
2550 68 : else if (mePageKind == PK_HANDOUT && mbMaster)
2551 : {
2552 11 : aCreatedPageName += rtl::OUString(" (");
2553 11 : aCreatedPageName += SdResId(STR_HANDOUT).toString();
2554 11 : aCreatedPageName += sal_Unicode( ')' );
2555 : }
2556 :
2557 99 : const_cast< SdPage* >(this)->maCreatedPageName = aCreatedPageName;
2558 99 : return maCreatedPageName;
2559 : }
2560 :
2561 29 : void SdPage::SetOrientation( Orientation eOrient)
2562 : {
2563 29 : meOrientation = eOrient;
2564 29 : }
2565 :
2566 31 : Orientation SdPage::GetOrientation() const
2567 : {
2568 31 : return meOrientation;
2569 : }
2570 :
2571 : /*************************************************************************
2572 : |*
2573 : |* Liefert den Default-Text eines PresObjektes zurueck
2574 : |*
2575 : \************************************************************************/
2576 :
2577 349 : String SdPage::GetPresObjText(PresObjKind eObjKind) const
2578 : {
2579 349 : String aString;
2580 :
2581 349 : if (eObjKind == PRESOBJ_TITLE)
2582 : {
2583 49 : if (mbMaster)
2584 : {
2585 28 : if (mePageKind != PK_NOTES)
2586 : {
2587 16 : aString = String ( SdResId( STR_PRESOBJ_MPTITLE ) );
2588 : }
2589 : else
2590 : {
2591 12 : aString = String ( SdResId( STR_PRESOBJ_MPNOTESTITLE ) );
2592 : }
2593 : }
2594 : else
2595 : {
2596 21 : aString = String ( SdResId( STR_PRESOBJ_TITLE ) );
2597 : }
2598 : }
2599 300 : else if (eObjKind == PRESOBJ_OUTLINE)
2600 : {
2601 26 : if (mbMaster)
2602 : {
2603 16 : aString = String ( SdResId( STR_PRESOBJ_MPOUTLINE ) );
2604 : }
2605 : else
2606 : {
2607 10 : aString = String ( SdResId( STR_PRESOBJ_OUTLINE ) );
2608 : }
2609 : }
2610 274 : else if (eObjKind == PRESOBJ_NOTES)
2611 : {
2612 48 : if (mbMaster)
2613 : {
2614 12 : aString = String ( SdResId( STR_PRESOBJ_MPNOTESTEXT ) );
2615 : }
2616 : else
2617 : {
2618 36 : aString = String ( SdResId( STR_PRESOBJ_NOTESTEXT ) );
2619 : }
2620 : }
2621 226 : else if (eObjKind == PRESOBJ_TEXT)
2622 : {
2623 8 : aString = String ( SdResId( STR_PRESOBJ_TEXT ) );
2624 : }
2625 218 : else if (eObjKind == PRESOBJ_GRAPHIC)
2626 : {
2627 1 : aString = String ( SdResId( STR_PRESOBJ_GRAPHIC ) );
2628 : }
2629 217 : else if (eObjKind == PRESOBJ_OBJECT)
2630 : {
2631 1 : aString = String ( SdResId( STR_PRESOBJ_OBJECT ) );
2632 : }
2633 216 : else if (eObjKind == PRESOBJ_CHART)
2634 : {
2635 0 : aString = String ( SdResId( STR_PRESOBJ_CHART ) );
2636 : }
2637 216 : else if (eObjKind == PRESOBJ_ORGCHART)
2638 : {
2639 0 : aString = String ( SdResId( STR_PRESOBJ_ORGCHART ) );
2640 : }
2641 216 : else if (eObjKind == PRESOBJ_CALC)
2642 : {
2643 0 : aString = String ( SdResId( STR_PRESOBJ_TABLE ) );
2644 : }
2645 :
2646 349 : return(aString);
2647 : }
2648 :
2649 : extern uno::Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage );
2650 :
2651 64 : uno::Reference< uno::XInterface > SdPage::createUnoPage()
2652 : {
2653 64 : return createUnoPageImpl( this );
2654 : }
2655 :
2656 : /** returns the SdPage implementation for the given XDrawPage or 0 if not available */
2657 0 : SdPage* SdPage::getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage )
2658 : {
2659 : try
2660 : {
2661 0 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUnoTunnel( xPage, ::com::sun::star::uno::UNO_QUERY );
2662 0 : if( xUnoTunnel.is() )
2663 : {
2664 0 : SvxDrawPage* pUnoPage = reinterpret_cast<SvxDrawPage*>(sal::static_int_cast<sal_uIntPtr>(xUnoTunnel->getSomething( SvxDrawPage::getUnoTunnelId()) ) );
2665 0 : if( pUnoPage )
2666 0 : return static_cast< SdPage* >( pUnoPage->GetSdrPage() );
2667 0 : }
2668 : }
2669 0 : catch( ::com::sun::star::uno::Exception& )
2670 : {
2671 : OSL_FAIL("sd::SdPage::getImplementation(), exception caught!" );
2672 : }
2673 :
2674 0 : return 0;
2675 : }
2676 :
2677 70 : void SdPage::SetName (const String& rName)
2678 : {
2679 70 : String aOldName = GetName();
2680 70 : FmFormPage::SetName (rName);
2681 70 : static_cast<SdDrawDocument*>(pModel)->UpdatePageRelativeURLs(aOldName, rName);
2682 70 : ActionChanged();
2683 70 : }
2684 :
2685 352 : const HeaderFooterSettings& SdPage::getHeaderFooterSettings() const
2686 : {
2687 352 : if( mePageKind == PK_HANDOUT && !mbMaster )
2688 : {
2689 0 : return (((SdPage&)TRG_GetMasterPage()).maHeaderFooterSettings);
2690 : }
2691 : else
2692 : {
2693 352 : return maHeaderFooterSettings;
2694 : }
2695 : }
2696 :
2697 216 : void SdPage::setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings )
2698 : {
2699 216 : if( mePageKind == PK_HANDOUT && !mbMaster )
2700 : {
2701 0 : (((SdPage&)TRG_GetMasterPage()).maHeaderFooterSettings) = rNewSettings;
2702 : }
2703 : else
2704 : {
2705 216 : maHeaderFooterSettings = rNewSettings;
2706 : }
2707 :
2708 216 : SetChanged();
2709 216 : if(TRG_HasMasterPage())
2710 : {
2711 216 : TRG_GetMasterPageDescriptorViewContact().ActionChanged();
2712 : }
2713 216 : }
2714 :
2715 0 : bool SdPage::checkVisibility(
2716 : const sdr::contact::ViewObjectContact& rOriginal,
2717 : const sdr::contact::DisplayInfo& rDisplayInfo,
2718 : bool bEdit )
2719 : {
2720 0 : if( !FmFormPage::checkVisibility( rOriginal, rDisplayInfo, bEdit ) )
2721 0 : return false;
2722 :
2723 0 : SdrObject* pObj = rOriginal.GetViewContact().TryToGetSdrObject();
2724 0 : if( pObj == NULL )
2725 0 : return false;
2726 :
2727 0 : const SdrPage* pVisualizedPage = GetSdrPageFromXDrawPage(rOriginal.GetObjectContact().getViewInformation2D().getVisualizedPage());
2728 0 : const bool bIsPrinting(rOriginal.GetObjectContact().isOutputToPrinter() || rOriginal.GetObjectContact().isOutputToPDFFile());
2729 0 : const SdrPageView* pPageView = rOriginal.GetObjectContact().TryToGetSdrPageView();
2730 0 : const bool bIsInsidePageObj(pPageView && pPageView->GetPage() != pVisualizedPage);
2731 :
2732 : // empty presentation objects only visible during edit mode
2733 0 : if( (bIsPrinting || !bEdit || bIsInsidePageObj ) && pObj->IsEmptyPresObj() )
2734 : {
2735 0 : if( (pObj->GetObjInventor() != SdrInventor) || ( (pObj->GetObjIdentifier() != OBJ_RECT) && (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
2736 0 : return false;
2737 : }
2738 :
2739 0 : if( ( pObj->GetObjInventor() == SdrInventor ) && ( pObj->GetObjIdentifier() == OBJ_TEXT ) )
2740 : {
2741 0 : const SdPage* pCheckPage = dynamic_cast< const SdPage* >(pObj->GetPage());
2742 :
2743 0 : if( pCheckPage )
2744 : {
2745 0 : PresObjKind eKind = pCheckPage->GetPresObjKind(pObj);
2746 :
2747 0 : if((eKind == PRESOBJ_FOOTER) || (eKind == PRESOBJ_HEADER) || (eKind == PRESOBJ_DATETIME) || (eKind == PRESOBJ_SLIDENUMBER) )
2748 : {
2749 0 : const bool bSubContentProcessing(rDisplayInfo.GetSubContentActive());
2750 :
2751 0 : if( bSubContentProcessing || ( pCheckPage->GetPageKind() == PK_HANDOUT && bIsPrinting ) )
2752 : {
2753 : // use the page that is currently processed
2754 0 : const SdPage* pVisualizedSdPage = dynamic_cast< const SdPage* >(pVisualizedPage);
2755 :
2756 0 : if( pVisualizedSdPage )
2757 : {
2758 : // if we are not on a masterpage, see if we have to draw this header&footer object at all
2759 0 : const sd::HeaderFooterSettings& rSettings = pVisualizedSdPage->getHeaderFooterSettings();
2760 :
2761 0 : switch( eKind )
2762 : {
2763 : case PRESOBJ_FOOTER:
2764 0 : return rSettings.mbFooterVisible;
2765 : case PRESOBJ_HEADER:
2766 0 : return rSettings.mbHeaderVisible;
2767 : case PRESOBJ_DATETIME:
2768 0 : return rSettings.mbDateTimeVisible;
2769 : case PRESOBJ_SLIDENUMBER:
2770 0 : return rSettings.mbSlideNumberVisible;
2771 : default:
2772 0 : break;
2773 : }
2774 : }
2775 0 : }
2776 : } // check for placeholders on master
2777 0 : else if( (eKind != PRESOBJ_NONE) && pCheckPage->IsMasterPage() && ( pVisualizedPage != pCheckPage ) )
2778 : {
2779 : // presentation objects on master slide are always invisible if slide is shown.
2780 0 : return false;
2781 : }
2782 : }
2783 : }
2784 :
2785 : // i63977, do not print SdrpageObjs from master pages
2786 0 : if( ( pObj->GetObjInventor() == SdrInventor ) && ( pObj->GetObjIdentifier() == OBJ_PAGE ) )
2787 : {
2788 0 : if( pObj->GetPage() && pObj->GetPage()->IsMasterPage() )
2789 0 : return false;
2790 : }
2791 :
2792 0 : return true;
2793 : }
2794 :
2795 0 : bool SdPage::RestoreDefaultText( SdrObject* pObj )
2796 : {
2797 0 : bool bRet = false;
2798 :
2799 0 : SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
2800 :
2801 0 : if( pTextObj )
2802 : {
2803 0 : PresObjKind ePresObjKind = GetPresObjKind(pTextObj);
2804 :
2805 0 : if (ePresObjKind == PRESOBJ_TITLE ||
2806 : ePresObjKind == PRESOBJ_OUTLINE ||
2807 : ePresObjKind == PRESOBJ_NOTES ||
2808 : ePresObjKind == PRESOBJ_TEXT)
2809 : {
2810 0 : String aString( GetPresObjText(ePresObjKind) );
2811 :
2812 0 : if (aString.Len())
2813 : {
2814 0 : sal_Bool bVertical = sal_False;
2815 0 : OutlinerParaObject* pOldPara = pTextObj->GetOutlinerParaObject();
2816 0 : if( pOldPara )
2817 0 : bVertical = pOldPara->IsVertical(); // is old para object vertical?
2818 :
2819 0 : SetObjText( pTextObj, 0, ePresObjKind, aString );
2820 :
2821 0 : if( pOldPara )
2822 : {
2823 : // Here, only the vertical flag for the
2824 : // OutlinerParaObjects needs to be changed. The
2825 : // AutoGrowWidth/Height items still exist in the
2826 : // not changed object.
2827 0 : if(pTextObj
2828 0 : && pTextObj->GetOutlinerParaObject()
2829 0 : && pTextObj->GetOutlinerParaObject()->IsVertical() != (bool)bVertical)
2830 : {
2831 0 : Rectangle aObjectRect = pTextObj->GetSnapRect();
2832 0 : pTextObj->GetOutlinerParaObject()->SetVertical(bVertical);
2833 0 : pTextObj->SetSnapRect(aObjectRect);
2834 : }
2835 : }
2836 :
2837 0 : pTextObj->SetTextEditOutliner( NULL ); // to make stylesheet settings work
2838 0 : pTextObj->NbcSetStyleSheet( GetStyleSheetForPresObj(ePresObjKind), sal_True );
2839 0 : pTextObj->SetEmptyPresObj(sal_True);
2840 0 : bRet = true;
2841 0 : }
2842 : }
2843 : }
2844 0 : return bRet;
2845 : }
2846 :
2847 12 : void SdPage::CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas )
2848 : {
2849 12 : SdPage& rHandoutMaster = *rModel.GetMasterSdPage( 0, PK_HANDOUT );
2850 :
2851 12 : if( eLayout == AUTOLAYOUT_NONE )
2852 : {
2853 : // use layout from handout master
2854 0 : SdrObjListIter aShapeIter (rHandoutMaster);
2855 0 : while (aShapeIter.IsMore())
2856 : {
2857 0 : SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(aShapeIter.Next());
2858 0 : if (pPageObj)
2859 0 : rAreas.push_back( pPageObj->GetCurrentBoundRect() );
2860 0 : }
2861 : }
2862 : else
2863 : {
2864 12 : Size aArea = rHandoutMaster.GetSize();
2865 :
2866 12 : const long nGapW = 1000; // gap is 1cm
2867 12 : const long nGapH = 1000;
2868 :
2869 12 : long nLeftBorder = rHandoutMaster.GetLftBorder();
2870 12 : long nRightBorder = rHandoutMaster.GetRgtBorder();
2871 12 : long nTopBorder = rHandoutMaster.GetUppBorder();
2872 12 : long nBottomBorder = rHandoutMaster.GetLwrBorder();
2873 :
2874 12 : const long nHeaderFooterHeight = static_cast< long >( (aArea.Height() - nTopBorder - nLeftBorder) * 0.05 );
2875 :
2876 12 : nTopBorder += nHeaderFooterHeight;
2877 12 : nBottomBorder += nHeaderFooterHeight;
2878 :
2879 12 : long nX = nGapW + nLeftBorder;
2880 12 : long nY = nGapH + nTopBorder;
2881 :
2882 12 : aArea.Width() -= nGapW * 2 + nLeftBorder + nRightBorder;
2883 12 : aArea.Height() -= nGapH * 2 + nTopBorder + nBottomBorder;
2884 :
2885 12 : const bool bLandscape = aArea.Width() > aArea.Height();
2886 :
2887 : static sal_uInt16 aOffsets[5][9] =
2888 : {
2889 : { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, // AUTOLAYOUT_HANDOUT9, Portrait, Horizontal order
2890 : { 0, 2, 4, 1, 3, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT3, Landscape, Vertical
2891 : { 0, 2, 1, 3, 0, 0, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Landscape, Vertical
2892 : { 0, 3, 1, 4, 2, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Portrait, Vertical
2893 : { 0, 3, 6, 1, 4, 7, 2, 5, 8 }, // AUTOLAYOUT_HANDOUT9, Landscape, Vertical
2894 : };
2895 :
2896 12 : sal_uInt16* pOffsets = aOffsets[0];
2897 12 : sal_uInt16 nColCnt = 0, nRowCnt = 0;
2898 12 : switch ( eLayout )
2899 : {
2900 : case AUTOLAYOUT_HANDOUT1:
2901 0 : nColCnt = 1; nRowCnt = 1;
2902 0 : break;
2903 :
2904 : case AUTOLAYOUT_HANDOUT2:
2905 0 : if( bLandscape )
2906 : {
2907 0 : nColCnt = 2; nRowCnt = 1;
2908 : }
2909 : else
2910 : {
2911 0 : nColCnt = 1; nRowCnt = 2;
2912 : }
2913 0 : break;
2914 :
2915 : case AUTOLAYOUT_HANDOUT3:
2916 0 : if( bLandscape )
2917 : {
2918 0 : nColCnt = 3; nRowCnt = 2;
2919 : }
2920 : else
2921 : {
2922 0 : nColCnt = 2; nRowCnt = 3;
2923 : }
2924 0 : pOffsets = aOffsets[ bLandscape ? 1 : 0 ];
2925 0 : break;
2926 :
2927 : case AUTOLAYOUT_HANDOUT4:
2928 0 : nColCnt = 2; nRowCnt = 2;
2929 0 : pOffsets = aOffsets[ bHorizontal ? 0 : 2 ];
2930 0 : break;
2931 :
2932 : case AUTOLAYOUT_HANDOUT6:
2933 12 : if( bLandscape )
2934 : {
2935 0 : nColCnt = 3; nRowCnt = 2;
2936 : }
2937 : else
2938 : {
2939 12 : nColCnt = 2; nRowCnt = 3;
2940 : }
2941 12 : if( !bHorizontal )
2942 12 : pOffsets = aOffsets[ bLandscape ? 1 : 3 ];
2943 12 : break;
2944 :
2945 : default:
2946 : case AUTOLAYOUT_HANDOUT9:
2947 0 : nColCnt = 3; nRowCnt = 3;
2948 :
2949 0 : if( !bHorizontal )
2950 0 : pOffsets = aOffsets[4];
2951 0 : break;
2952 : }
2953 :
2954 12 : rAreas.resize( nColCnt * nRowCnt );
2955 :
2956 12 : Size aPartArea, aSize;
2957 12 : aPartArea.Width() = ((aArea.Width() - ((nColCnt-1) * nGapW) ) / nColCnt);
2958 12 : aPartArea.Height() = ((aArea.Height() - ((nRowCnt-1) * nGapH) ) / nRowCnt);
2959 :
2960 12 : SdrPage* pFirstPage = rModel.GetMasterSdPage(0, PK_STANDARD);
2961 12 : if ( pFirstPage )
2962 : {
2963 : // scale actual size into handout rect
2964 12 : double fScale = (double)aPartArea.Width() / (double)pFirstPage->GetWdt();
2965 :
2966 12 : aSize.Height() = (long)(fScale * pFirstPage->GetHgt() );
2967 12 : if( aSize.Height() > aPartArea.Height() )
2968 : {
2969 0 : fScale = (double)aPartArea.Height() / (double)pFirstPage->GetHgt();
2970 0 : aSize.Height() = aPartArea.Height();
2971 0 : aSize.Width() = (long)(fScale * pFirstPage->GetWdt());
2972 : }
2973 : else
2974 : {
2975 12 : aSize.Width() = aPartArea.Width();
2976 : }
2977 :
2978 12 : nX += (aPartArea.Width() - aSize.Width()) / 2;
2979 12 : nY += (aPartArea.Height()- aSize.Height())/ 2;
2980 : }
2981 : else
2982 : {
2983 0 : aSize = aPartArea;
2984 : }
2985 :
2986 12 : Point aPos( nX, nY );
2987 :
2988 12 : const bool bRTL = rModel.GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB;
2989 :
2990 12 : const long nOffsetX = (aPartArea.Width() + nGapW) * (bRTL ? -1 : 1);
2991 12 : const long nOffsetY = aPartArea.Height() + nGapH;
2992 12 : const long nStartX = bRTL ? nOffsetX*(1 - nColCnt) - nX : nX;
2993 :
2994 48 : for(sal_uInt16 nRow = 0; nRow < nRowCnt; nRow++)
2995 : {
2996 36 : aPos.X() = nStartX;
2997 108 : for(sal_uInt16 nCol = 0; nCol < nColCnt; nCol++)
2998 : {
2999 72 : rAreas[*pOffsets++] = Rectangle(aPos, aSize);
3000 72 : aPos.X() += nOffsetX;
3001 : }
3002 :
3003 36 : aPos.Y() += nOffsetY;
3004 : }
3005 : }
3006 12 : }
3007 :
3008 :
3009 :
3010 :
3011 0 : void SdPage::SetPrecious (const bool bIsPrecious)
3012 : {
3013 0 : mbIsPrecious = bIsPrecious;
3014 0 : }
3015 :
3016 :
3017 :
3018 :
3019 0 : bool SdPage::IsPrecious (void) const
3020 : {
3021 0 : return mbIsPrecious;
3022 : }
3023 :
3024 :
3025 :
3026 :
3027 136 : HeaderFooterSettings::HeaderFooterSettings()
3028 : {
3029 136 : mbHeaderVisible = true;
3030 136 : mbFooterVisible = true;
3031 136 : mbSlideNumberVisible = false;
3032 136 : mbDateTimeVisible = true;
3033 136 : mbDateTimeIsFixed = true;
3034 136 : meDateTimeFormat = SVXDATEFORMAT_A;
3035 136 : }
3036 :
3037 72 : bool HeaderFooterSettings::operator==( const HeaderFooterSettings& rSettings ) const
3038 : {
3039 : return (mbHeaderVisible == rSettings.mbHeaderVisible) &&
3040 72 : (maHeaderText == rSettings.maHeaderText) &&
3041 : (mbFooterVisible == rSettings.mbFooterVisible) &&
3042 68 : (maFooterText == rSettings.maFooterText) &&
3043 : (mbSlideNumberVisible == rSettings.mbSlideNumberVisible) &&
3044 : (mbDateTimeVisible == rSettings.mbDateTimeVisible) &&
3045 : (mbDateTimeIsFixed == rSettings.mbDateTimeIsFixed) &&
3046 : (meDateTimeFormat == rSettings.meDateTimeFormat) &&
3047 212 : (maDateTimeText == rSettings.maDateTimeText);
3048 : }
3049 :
3050 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|