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