1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
23 #include <comphelper/classids.hxx>
24 #include <comphelper/embeddedobjectcontainer.hxx>
26 #include <sfx2/viewsh.hxx>
27 #include <vcl/svapp.hxx>
28 #include <editeng/outliner.hxx>
29 #include <editeng/eeitem.hxx>
30 #include <svx/svdoutl.hxx>
31 #include <editeng/editdata.hxx>
32 #include <editeng/lrspitem.hxx>
33 #include <editeng/bulletitem.hxx>
34 #include <svx/svdpagv.hxx>
35 #include <editeng/fhgtitem.hxx>
36 #include <editeng/outlobj.hxx>
37 #include <svx/svdoole2.hxx>
38 #include <svx/svdograf.hxx>
39 #include <svx/svdopage.hxx>
40 #include <editeng/pbinitem.hxx>
41 #include <svx/svdundo.hxx>
42 #include <svl/hint.hxx>
43 #include <editeng/adjustitem.hxx>
44 #include <editeng/editobj.hxx>
45 #include <svx/unopage.hxx>
46 #include <editeng/flditem.hxx>
47 #include <svx/sdr/contact/displayinfo.hxx>
48 #include <svx/svditer.hxx>
49 #include <svx/svdlayer.hxx>
50 #include <svx/sdtmfitm.hxx>
51 #include <svx/sdtagitm.hxx>
52 #include <svx/sdtcfitm.hxx>
53 #include <svx/xfillit0.hxx>
54 #include <comphelper/diagnose_ex.hxx>
55 #include <com/sun/star/animations/XAnimationNode.hpp>
56 #include <com/sun/star/animations/XTimeContainer.hpp>
57 #include <com/sun/star/container/XEnumerationAccess.hpp>
58 #include <com/sun/star/embed/XEmbeddedObject.hpp>
59 #include <com/sun/star/xml/dom/XNode.hpp>
60 #include <com/sun/star/xml/dom/XNodeList.hpp>
61 #include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
62 #include <rtl/ustring.hxx>
63 #include <sal/log.hxx>
64 #include <o3tl/enumarray.hxx>
65 #include <o3tl/safeint.hxx>
66 #include <o3tl/sorted_vector.hxx>
67 #include <xmloff/autolayout.hxx>
69 #include <Outliner.hxx>
71 #include <createunopageimpl.hxx>
72 #include <drawdoc.hxx>
75 #include <sdresid.hxx>
76 #include <stlsheet.hxx>
77 #include <strings.hrc>
78 #include <strings.hxx>
79 #include <bitmaps.hlst>
81 #include <anminfo.hxx>
82 #include <undo/undomanager.hxx>
83 #include <undo/undoobjects.hxx>
84 #include <svx/sdr/contact/viewobjectcontact.hxx>
85 #include <svx/sdr/contact/viewcontact.hxx>
86 #include <svx/sdr/contact/objectcontact.hxx>
87 #include <svx/unoapi.hxx>
88 #include <unokywds.hxx>
91 using namespace ::com::sun::star
;
92 using namespace ::com::sun::star::uno
;
93 using namespace com::sun::star::xml::dom
;
94 using ::com::sun::star::uno::Reference
;
97 sal_uInt16
SdPage::mnLastPageId
= 1;
99 /*************************************************************************
103 \************************************************************************/
105 SdPage::SdPage(SdDrawDocument
& rNewDoc
, bool bMasterPage
)
106 : FmFormPage(rNewDoc
, bMasterPage
)
108 , mePageKind(PageKind::Standard
)
109 , meAutoLayout(AUTOLAYOUT_NONE
)
111 , mePresChange(PresChange::Manual
)
117 , mbScaleObjects(true)
118 , meCharSet(osl_getThreadTextEncoding())
119 , mnPaperBin(PAPERBIN_PRINTER_SETTINGS
)
120 , mpPageLink(nullptr)
121 , mnTransitionType(0)
122 , mnTransitionSubtype(0)
123 , mbTransitionDirection(true)
124 , mnTransitionFadeColor(0)
125 , mfTransitionDuration(2.0)
127 , mnPageId(mnLastPageId
++)
129 // The name of the layout of the page is used by SVDRAW to determine the
130 // presentation template of the outline objects. Therefore, it already
131 // contains the designator for the outline (STR_LAYOUT_OUTLINE).
132 maLayoutName
= SdResId(STR_LAYOUT_DEFAULT_NAME
)+ SD_LT_SEPARATOR
+ STR_LAYOUT_OUTLINE
;
134 // Stuff that former SetModel did also:
140 void clearChildNodes(css::uno::Reference
<css::animations::XAnimationNode
> const & rAnimationNode
)
142 css::uno::Reference
<css::container::XEnumerationAccess
> xEnumerationAccess(rAnimationNode
, UNO_QUERY
);
143 if (!xEnumerationAccess
.is())
145 css::uno::Reference
<css::container::XEnumeration
> xEnumeration
= xEnumerationAccess
->createEnumeration();
146 if (!xEnumeration
.is())
148 while (xEnumeration
->hasMoreElements())
150 css::uno::Reference
<css::animations::XAnimationNode
> xChildNode(xEnumeration
->nextElement(), UNO_QUERY
);
151 if (!xChildNode
.is())
153 clearChildNodes(xChildNode
);
154 css::uno::Reference
<css::animations::XTimeContainer
> xAnimationNode(rAnimationNode
, UNO_QUERY
);
155 if (!xAnimationNode
.is())
157 SAL_WARN("sd.core", "can't remove node child, possible leak");
160 xAnimationNode
->removeChild(xChildNode
);
165 /*************************************************************************
169 \************************************************************************/
175 EndListenOutlineText();
177 clearChildNodes(mxAnimationNode
);
179 // disconnect the UserCall link, so we don't get calls
180 // back into this dying object when the child objects die
181 SdrObjListIter
aIter( this, SdrIterMode::DeepWithGroups
);
182 while( aIter
.IsMore() )
184 SdrObject
* pChild
= aIter
.Next();
185 if( pChild
->GetUserCall() == this )
186 pChild
->SetUserCall(nullptr);
194 bool operator()( SdrObject
const * p1
, SdrObject
const * p2
)
196 return p1
->GetOrdNum() < p2
->GetOrdNum();
202 /** returns the nIndex'th object from the given PresObjKind, index starts with 1 */
203 SdrObject
* SdPage::GetPresObj(PresObjKind eObjKind
, int nIndex
, bool bFuzzySearch
/* = false */ )
205 // first sort all matching shapes with z-order
206 std::vector
< SdrObject
* > aMatches
;
208 SdrObject
* pObj
= nullptr;
209 maPresentationShapeList
.seekShape(0);
211 while( (pObj
= maPresentationShapeList
.getNextShape()) )
213 SdAnimationInfo
* pInfo
= SdDrawDocument::GetShapeUserData(*pObj
);
217 if( pInfo
->mePresObjKind
== eObjKind
)
221 else if( bFuzzySearch
&& (eObjKind
== PresObjKind::Outline
) )
223 switch( pInfo
->mePresObjKind
)
225 case PresObjKind::Graphic
:
226 case PresObjKind::Object
:
227 case PresObjKind::Chart
:
228 case PresObjKind::OrgChart
:
229 case PresObjKind::Table
:
230 case PresObjKind::Calc
:
231 case PresObjKind::Media
:
240 aMatches
.push_back( pObj
);
248 if( (nIndex
>= 0) && ( aMatches
.size() > o3tl::make_unsigned(nIndex
)) )
250 if( aMatches
.size() > 1 )
251 std::nth_element( aMatches
.begin(), aMatches
.begin() + nIndex
, aMatches
.end(),
253 return aMatches
[nIndex
];
259 /** create background properties */
260 void SdPage::EnsureMasterPageDefaultBackground()
265 // no hard attributes on MasterPage attributes
266 getSdrPageProperties().ClearItem();
267 SfxStyleSheet
* pSheetForPresObj
= GetStyleSheetForMasterPageBackground();
271 // set StyleSheet for background fill attributes
272 getSdrPageProperties().SetStyleSheet(pSheetForPresObj
);
276 // no style found, assert and set at least drawing::FillStyle_NONE
277 OSL_FAIL("No Style for MasterPageBackground fill found (!)");
278 getSdrPageProperties().PutItem(XFillStyleItem(drawing::FillStyle_NONE
));
282 /** creates a presentation object with the given PresObjKind on this page. A user call will be set
284 SdrObject
* SdPage::CreatePresObj(PresObjKind eObjKind
, bool bVertical
, const ::tools::Rectangle
& rRect
)
286 SfxUndoManager
* pUndoManager(static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetUndoManager());
287 const bool bUndo
= pUndoManager
&& pUndoManager
->IsInListAction() && IsInserted();
289 rtl::Reference
<SdrObject
> pSdrObj
;
291 bool bForceText
= false; // forces the shape text to be set even if it's empty
292 bool bEmptyPresObj
= true;
296 case PresObjKind::Title
:
298 pSdrObj
= new SdrRectObj(getSdrModelFromSdrPage(), SdrObjKind::TitleText
);
302 pSdrObj
->SetNotVisibleAsMaster(true);
307 case PresObjKind::Outline
:
309 pSdrObj
= new SdrRectObj(getSdrModelFromSdrPage(), SdrObjKind::OutlineText
);
313 pSdrObj
->SetNotVisibleAsMaster(true);
318 case PresObjKind::Notes
:
320 pSdrObj
= new SdrRectObj(getSdrModelFromSdrPage(), SdrObjKind::Text
);
324 pSdrObj
->SetNotVisibleAsMaster(true);
329 case PresObjKind::Text
:
331 pSdrObj
= new SdrRectObj(getSdrModelFromSdrPage(), SdrObjKind::Text
);
335 case PresObjKind::Graphic
:
337 BitmapEx
aBmpEx(BMP_PRESOBJ_GRAPHIC
);
338 Graphic
aGraphic( aBmpEx
);
339 OutputDevice
&aOutDev
= *Application::GetDefaultDevice();
342 aOutDev
.SetMapMode( aGraphic
.GetPrefMapMode() );
343 Size aSizePix
= aOutDev
.LogicToPixel( aGraphic
.GetPrefSize() );
344 aOutDev
.SetMapMode(MapMode(MapUnit::Map100thMM
));
346 Size aSize
= aOutDev
.PixelToLogic(aSizePix
);
348 ::tools::Rectangle
aRect (aPnt
, aSize
);
349 pSdrObj
= new SdrGrafObj(getSdrModelFromSdrPage(), aGraphic
, aRect
);
354 case PresObjKind::Media
:
355 case PresObjKind::Object
:
357 pSdrObj
= new SdrOle2Obj(getSdrModelFromSdrPage());
358 BitmapEx
aBmpEx(BMP_PRESOBJ_OBJECT
);
359 Graphic
aGraphic( aBmpEx
);
360 static_cast<SdrOle2Obj
*>(pSdrObj
.get())->SetGraphic(aGraphic
);
364 case PresObjKind::Chart
:
366 pSdrObj
= new SdrOle2Obj(getSdrModelFromSdrPage());
367 static_cast<SdrOle2Obj
*>(pSdrObj
.get())->SetProgName( "StarChart" );
368 BitmapEx
aBmpEx(BMP_PRESOBJ_CHART
);
369 Graphic
aGraphic( aBmpEx
);
370 static_cast<SdrOle2Obj
*>(pSdrObj
.get())->SetGraphic(aGraphic
);
374 case PresObjKind::OrgChart
:
376 pSdrObj
= new SdrOle2Obj(getSdrModelFromSdrPage());
377 static_cast<SdrOle2Obj
*>(pSdrObj
.get())->SetProgName( "StarOrg" );
378 BitmapEx
aBmpEx(BMP_PRESOBJ_ORGCHART
);
379 Graphic
aGraphic( aBmpEx
);
380 static_cast<SdrOle2Obj
*>(pSdrObj
.get())->SetGraphic(aGraphic
);
384 case PresObjKind::Table
:
385 case PresObjKind::Calc
:
387 pSdrObj
= new SdrOle2Obj(getSdrModelFromSdrPage());
388 static_cast<SdrOle2Obj
*>(pSdrObj
.get())->SetProgName( "StarCalc" );
389 BitmapEx
aBmpEx(BMP_PRESOBJ_TABLE
);
390 Graphic
aGraphic( aBmpEx
);
391 static_cast<SdrOle2Obj
*>(pSdrObj
.get())->SetGraphic(aGraphic
);
395 case PresObjKind::Handout
:
397 // Save the first standard page at SdrPageObj
398 // #i105146# We want no content to be displayed for PageKind::Handout,
399 // so just never set a page as content
400 pSdrObj
= new SdrPageObj(getSdrModelFromSdrPage(), nullptr);
404 case PresObjKind::Page
:
406 // Save note pages at SdrPageObj
407 sal_uInt16
nDestPageNum(GetPageNum());
411 // decrement only when != 0, else we get a 0xffff
415 if (nDestPageNum
< getSdrModelFromSdrPage().GetPageCount())
417 pSdrObj
= new SdrPageObj(getSdrModelFromSdrPage(), getSdrModelFromSdrPage().GetPage(nDestPageNum
));
421 pSdrObj
= new SdrPageObj(getSdrModelFromSdrPage());
424 pSdrObj
->SetResizeProtect(true);
428 case PresObjKind::Header
:
429 case PresObjKind::Footer
:
430 case PresObjKind::DateTime
:
431 case PresObjKind::SlideNumber
:
433 pSdrObj
= new SdrRectObj(getSdrModelFromSdrPage(), SdrObjKind::Text
);
434 bEmptyPresObj
= false;
444 pSdrObj
->SetEmptyPresObj(bEmptyPresObj
);
445 pSdrObj
->SetLogicRect(rRect
);
447 InsertObject(pSdrObj
.get());
449 if ( auto pTextObj
= DynCastSdrTextObj( pSdrObj
.get() ) )
451 // Tell the object EARLY that it is vertical to have the
452 // defaults for AutoGrowWidth/Height reversed
454 pTextObj
->SetVerticalWriting(true);
456 SfxItemSet
aTempAttr(static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetPool());
458 aTempAttr
.Put( makeSdrTextMinFrameWidthItem( rRect
.GetSize().Width() ) );
460 aTempAttr
.Put( makeSdrTextMinFrameHeightItem( rRect
.GetSize().Height() ) );
464 // The size of presentation objects on the master page have to
465 // be freely selectable by the user.
467 // potential problem: This action was still NOT
468 // adapted for vertical text. This sure needs to be done.
470 aTempAttr
.Put(makeSdrTextAutoGrowWidthItem(false));
472 aTempAttr
.Put(makeSdrTextAutoGrowHeightItem(false));
475 // check if we need another vertical adjustment than the default
476 SdrTextVertAdjust eV
= SDRTEXTVERTADJUST_TOP
;
478 if( (eObjKind
== PresObjKind::Footer
) && (mePageKind
!= PageKind::Standard
) )
480 eV
= SDRTEXTVERTADJUST_BOTTOM
;
482 else if( (eObjKind
== PresObjKind::SlideNumber
) && (mePageKind
!= PageKind::Standard
) )
484 eV
= SDRTEXTVERTADJUST_BOTTOM
;
487 if( eV
!= SDRTEXTVERTADJUST_TOP
)
488 aTempAttr
.Put(SdrTextVertAdjustItem(eV
));
490 pSdrObj
->SetMergedItemSet(aTempAttr
);
492 pSdrObj
->SetLogicRect(rRect
);
495 OUString aString
= GetPresObjText(eObjKind
);
496 if(!aString
.isEmpty() || bForceText
)
497 if (auto pTextObj
= DynCastSdrTextObj( pSdrObj
.get() ) )
499 SdrOutliner
* pOutliner
= static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetInternalOutliner();
501 OutlinerMode nOutlMode
= pOutliner
->GetOutlinerMode();
502 pOutliner
->Init( OutlinerMode::TextObject
);
503 pOutliner
->SetStyleSheet( 0, nullptr );
504 pOutliner
->SetVertical( bVertical
);
506 SetObjText( pTextObj
, pOutliner
, eObjKind
, aString
);
508 pOutliner
->Init( nOutlMode
);
509 pOutliner
->SetStyleSheet( 0, nullptr );
512 if( (eObjKind
== PresObjKind::Header
) || (eObjKind
== PresObjKind::Footer
) || (eObjKind
== PresObjKind::SlideNumber
) || (eObjKind
== PresObjKind::DateTime
) )
514 SfxItemSet
aTempAttr(static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetPool());
515 aTempAttr
.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT
) );
516 aTempAttr
.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CTL
) );
517 aTempAttr
.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CJK
) );
519 SvxAdjust eH
= SvxAdjust::Left
;
521 if( (eObjKind
== PresObjKind::DateTime
) && (mePageKind
!= PageKind::Standard
) )
523 eH
= SvxAdjust::Right
;
525 else if( (eObjKind
== PresObjKind::Footer
) && (mePageKind
== PageKind::Standard
) )
527 eH
= SvxAdjust::Center
;
529 else if( eObjKind
== PresObjKind::SlideNumber
)
531 eH
= SvxAdjust::Right
;
534 if( eH
!= SvxAdjust::Left
)
535 aTempAttr
.Put(SvxAdjustItem(eH
, EE_PARA_JUST
));
537 pSdrObj
->SetMergedItemSet(aTempAttr
);
542 SdrLayerAdmin
& rLayerAdmin(getSdrModelFromSdrPage().GetLayerAdmin());
544 // background objects of the master page
545 pSdrObj
->SetLayer( rLayerAdmin
.GetLayerID(sUNO_LayerName_background_objects
) );
548 // Subscribe object at the style sheet
549 // Set style only when one was found (as in 5.2)
550 if( mePageKind
!= PageKind::Handout
)
552 SfxStyleSheet
* pSheetForPresObj
= GetStyleSheetForPresObj(eObjKind
);
554 pSdrObj
->SetStyleSheet(pSheetForPresObj
, false);
557 if (eObjKind
== PresObjKind::Outline
)
559 for (sal_uInt16 nLevel
= 1; nLevel
< 10; nLevel
++)
561 OUString
aName( maLayoutName
+ " " + OUString::number( nLevel
) );
562 SfxStyleSheet
* pSheet
= static_cast<SfxStyleSheet
*>(getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName
, SfxStyleFamily::Page
));
563 DBG_ASSERT(pSheet
, "StyleSheet for outline object not found");
565 pSdrObj
->StartListening(*pSheet
, DuplicateHandling::Allow
);
569 if ( eObjKind
== PresObjKind::Object
||
570 eObjKind
== PresObjKind::Chart
||
571 eObjKind
== PresObjKind::OrgChart
||
572 eObjKind
== PresObjKind::Calc
||
573 eObjKind
== PresObjKind::Graphic
)
575 SfxItemSet
aSet( static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetPool() );
576 aSet
.Put( makeSdrTextContourFrameItem( true ) );
577 aSet
.Put( SvxAdjustItem( SvxAdjust::Center
, EE_PARA_JUST
) );
579 pSdrObj
->SetMergedItemSet(aSet
);
584 pUndoManager
->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj
));
586 pUndoManager
->AddUndoAction( std::make_unique
<UndoObjectPresentationKind
>( *pSdrObj
) );
587 pUndoManager
->AddUndoAction( std::make_unique
<UndoObjectUserCall
>(*pSdrObj
) );
590 InsertPresObj(pSdrObj
.get(), eObjKind
);
591 pSdrObj
->SetUserCall(this);
593 pSdrObj
->RecalcBoundRect();
596 return pSdrObj
.get();
599 /*************************************************************************
601 |* Creates presentation objects on the master page.
602 |* All presentation objects get a UserCall to the page.
604 \************************************************************************/
606 SfxStyleSheet
* SdPage::GetStyleSheetForMasterPageBackground() const
608 OUString
aName(GetLayoutName());
609 OUString
aSep( SD_LT_SEPARATOR
);
610 sal_Int32 nPos
= aName
.indexOf(aSep
);
614 nPos
= nPos
+ aSep
.getLength();
615 aName
= aName
.copy(0, nPos
);
618 aName
+= STR_LAYOUT_BACKGROUND
;
620 SfxStyleSheetBasePool
* pStShPool
= getSdrModelFromSdrPage().GetStyleSheetPool();
621 SfxStyleSheetBase
* pResult
= pStShPool
->Find(aName
, SfxStyleFamily::Page
);
622 return static_cast<SfxStyleSheet
*>(pResult
);
625 SfxStyleSheet
* SdPage::GetStyleSheetForPresObj(PresObjKind eObjKind
) const
627 OUString
aName(GetLayoutName());
628 OUString
aSep( SD_LT_SEPARATOR
);
629 sal_Int32 nPos
= aName
.indexOf(aSep
);
632 nPos
= nPos
+ aSep
.getLength();
633 aName
= aName
.copy(0, nPos
);
638 case PresObjKind::Outline
:
640 aName
= GetLayoutName() + " " + OUString::number( 1 );
644 case PresObjKind::Title
:
645 aName
+= STR_LAYOUT_TITLE
;
648 case PresObjKind::Notes
:
649 aName
+= STR_LAYOUT_NOTES
;
652 case PresObjKind::Text
:
653 aName
+= STR_LAYOUT_SUBTITLE
;
656 case PresObjKind::Header
:
657 case PresObjKind::Footer
:
658 case PresObjKind::DateTime
:
659 case PresObjKind::SlideNumber
:
660 aName
+= STR_LAYOUT_BACKGROUNDOBJECTS
;
667 SfxStyleSheetBasePool
* pStShPool
= getSdrModelFromSdrPage().GetStyleSheetPool();
668 SfxStyleSheetBase
* pResult
= pStShPool
->Find(aName
, SfxStyleFamily::Page
);
669 return static_cast<SfxStyleSheet
*>(pResult
);
672 /** returns the presentation style with the given helpid from this masterpage or this
674 SdStyleSheet
* SdPage::getPresentationStyle( sal_uInt32 nHelpId
) const
676 OUString
aStyleName( GetLayoutName() );
677 const OUString
aSep( SD_LT_SEPARATOR
);
678 sal_Int32 nIndex
= aStyleName
.indexOf(aSep
);
680 aStyleName
= aStyleName
.copy(0, nIndex
+ aSep
.getLength());
683 bool bOutline
= false;
686 case HID_PSEUDOSHEET_TITLE
: pNameId
= STR_LAYOUT_TITLE
; break;
687 case HID_PSEUDOSHEET_SUBTITLE
: pNameId
= STR_LAYOUT_SUBTITLE
; break;
688 case HID_PSEUDOSHEET_OUTLINE1
:
689 case HID_PSEUDOSHEET_OUTLINE2
:
690 case HID_PSEUDOSHEET_OUTLINE3
:
691 case HID_PSEUDOSHEET_OUTLINE4
:
692 case HID_PSEUDOSHEET_OUTLINE5
:
693 case HID_PSEUDOSHEET_OUTLINE6
:
694 case HID_PSEUDOSHEET_OUTLINE7
:
695 case HID_PSEUDOSHEET_OUTLINE8
:
696 case HID_PSEUDOSHEET_OUTLINE9
: pNameId
= STR_LAYOUT_OUTLINE
; bOutline
= true; break;
697 case HID_PSEUDOSHEET_BACKGROUNDOBJECTS
: pNameId
= STR_LAYOUT_BACKGROUNDOBJECTS
; break;
698 case HID_PSEUDOSHEET_BACKGROUND
: pNameId
= STR_LAYOUT_BACKGROUND
; break;
699 case HID_PSEUDOSHEET_NOTES
: pNameId
= STR_LAYOUT_NOTES
; break;
702 OSL_FAIL( "SdPage::getPresentationStyle(), illegal argument!" );
705 aStyleName
+= pNameId
;
709 OUString::number( sal_Int32( nHelpId
- HID_PSEUDOSHEET_OUTLINE
));
712 SfxStyleSheetBasePool
* pStShPool
= getSdrModelFromSdrPage().GetStyleSheetPool();
713 SfxStyleSheetBase
* pResult
= pStShPool
->Find(aStyleName
, SfxStyleFamily::Page
);
714 return dynamic_cast<SdStyleSheet
*>(pResult
);
717 /*************************************************************************
719 |* The presentation object rObj has changed and is no longer referenced by the
720 |* presentation object of the master page.
721 |* The UserCall is deleted.
723 \************************************************************************/
725 void SdPage::Changed(const SdrObject
& rObj
, SdrUserCallType eType
, const ::tools::Rectangle
& )
727 if (maLockAutoLayoutArrangement
.isLocked())
732 case SdrUserCallType::MoveOnly
:
733 case SdrUserCallType::Resize
:
735 if ( getSdrModelFromSdrPage().isLocked())
740 if (rObj
.GetUserCall())
742 SdrObject
& _rObj
= const_cast<SdrObject
&>(rObj
);
743 SfxUndoManager
* pUndoManager
744 = static_cast<SdDrawDocument
&>(getSdrModelFromSdrPage())
747 = pUndoManager
&& pUndoManager
->IsInListAction() && IsInserted();
750 pUndoManager
->AddUndoAction(
751 std::make_unique
<UndoObjectUserCall
>(_rObj
));
753 // Object was resized by user and does not listen to its slide anymore
754 _rObj
.SetUserCall(nullptr);
759 // Object of the master page changed, therefore adjust
760 // object on all pages
761 sal_uInt16 nPageCount
= static_cast<SdDrawDocument
&>(getSdrModelFromSdrPage())
762 .GetSdPageCount(mePageKind
);
764 for (sal_uInt16 i
= 0; i
< nPageCount
; i
++)
766 SdPage
* pLoopPage
= static_cast<SdDrawDocument
&>(getSdrModelFromSdrPage())
767 .GetSdPage(i
, mePageKind
);
769 if (pLoopPage
&& this == &(pLoopPage
->TRG_GetMasterPage()))
771 // Page listens to this master page, therefore
773 pLoopPage
->SetAutoLayout(pLoopPage
->GetAutoLayout());
780 case SdrUserCallType::Delete
:
781 case SdrUserCallType::Removed
:
787 /*************************************************************************
789 |* Creates on a master page: background, title- and layout area
791 \************************************************************************/
793 void SdPage::CreateTitleAndLayout(bool bInit
, bool bCreate
)
795 SfxUndoManager
* pUndoManager(static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetUndoManager());
796 const bool bUndo
= pUndoManager
&& pUndoManager
->IsInListAction() && IsInserted();
798 SdPage
* pMasterPage
= this;
802 pMasterPage
= static_cast<SdPage
*>(&(TRG_GetMasterPage()));
810 /**************************************************************************
811 * create background, title- and layout area
812 **************************************************************************/
813 if( mePageKind
== PageKind::Standard
)
815 pMasterPage
->EnsureMasterPageDefaultBackground();
818 if (static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetDocumentType() != DocumentType::Impress
)
821 if( mePageKind
== PageKind::Handout
&& bInit
)
825 // delete all available handout presentation objects
826 rtl::Reference
<SdrObject
> pObj
;
827 while( (pObj
= pMasterPage
->GetPresObj(PresObjKind::Handout
)) )
829 pMasterPage
->RemoveObject(pObj
->GetOrdNum());
833 pUndoManager
->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj
));
838 std::vector
< ::tools::Rectangle
> aAreas
;
839 CalculateHandoutAreas( static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()), pMasterPage
->GetAutoLayout(), false, aAreas
);
841 const bool bSkip
= pMasterPage
->GetAutoLayout() == AUTOLAYOUT_HANDOUT3
;
842 std::vector
< ::tools::Rectangle
>::iterator
iter( aAreas
.begin() );
844 while( iter
!= aAreas
.end() )
846 SdrPageObj
* pPageObj
= static_cast<SdrPageObj
*>(pMasterPage
->CreatePresObj(PresObjKind::Handout
, false, (*iter
++)) );
847 // #i105146# We want no content to be displayed for PageKind::Handout,
848 // so just never set a page as content
849 pPageObj
->SetReferencedPage(nullptr);
851 if( bSkip
&& iter
!= aAreas
.end() )
856 if( mePageKind
!= PageKind::Handout
)
858 SdrObject
* pMasterTitle
= pMasterPage
->GetPresObj( PresObjKind::Title
);
859 if( pMasterTitle
== nullptr )
860 pMasterPage
->CreateDefaultPresObj(PresObjKind::Title
);
862 SdrObject
* pMasterOutline
= pMasterPage
->GetPresObj( mePageKind
==PageKind::Notes
? PresObjKind::Notes
: PresObjKind::Outline
);
863 if( pMasterOutline
== nullptr )
864 pMasterPage
->CreateDefaultPresObj( mePageKind
== PageKind::Standard
? PresObjKind::Outline
: PresObjKind::Notes
);
867 // create header&footer objects
872 if( mePageKind
!= PageKind::Standard
)
874 SdrObject
* pHeader
= pMasterPage
->GetPresObj( PresObjKind::Header
);
875 if( pHeader
== nullptr )
876 pMasterPage
->CreateDefaultPresObj( PresObjKind::Header
);
879 SdrObject
* pDate
= pMasterPage
->GetPresObj( PresObjKind::DateTime
);
880 if( pDate
== nullptr )
881 pMasterPage
->CreateDefaultPresObj( PresObjKind::DateTime
);
883 SdrObject
* pFooter
= pMasterPage
->GetPresObj( PresObjKind::Footer
);
884 if( pFooter
== nullptr )
885 pMasterPage
->CreateDefaultPresObj( PresObjKind::Footer
);
887 SdrObject
* pNumber
= pMasterPage
->GetPresObj( PresObjKind::SlideNumber
);
888 if( pNumber
== nullptr )
889 pMasterPage
->CreateDefaultPresObj( PresObjKind::SlideNumber
);
894 const o3tl::enumarray
<PageKind
, char const *> PageKindVector
= {
895 "PageKind::Standard", "PageKind::Notes", "PageKind::Handout"
898 const o3tl::enumarray
<PresObjKind
, const char*> PresObjKindVector
= {
899 "PRESOBJ_NONE", "PRESOBJ_TITLE", "PRESOBJ_OUTLINE",
900 "PRESOBJ_TEXT" ,"PRESOBJ_GRAPHIC" , "PRESOBJ_OBJECT",
901 "PRESOBJ_CHART", "PRESOBJ_ORGCHART", "PRESOBJ_TABLE",
902 "PRESOBJ_PAGE", "PRESOBJ_HANDOUT",
903 "PRESOBJ_NOTES","PRESOBJ_HEADER", "PRESOBJ_FOOTER",
904 "PRESOBJ_DATETIME", "PRESOBJ_SLIDENUMBER", "PRESOBJ_CALC",
908 void getPresObjProp( const SdPage
& rPage
, const char* sObjKind
, const char* sPageKind
, double presObjPropValue
[] )
910 bool bNoObjectFound
= true; //used to break from outer loop
912 const std::vector
< Reference
<XNode
> >& objectInfo
= static_cast< const SdDrawDocument
& >(rPage
.getSdrModelFromSdrPage()).GetObjectVector();
913 for( const Reference
<XNode
>& objectNode
: objectInfo
)
917 Reference
<XNamedNodeMap
> objectattrlist
= objectNode
->getAttributes();
918 Reference
<XNode
> objectattr
= objectattrlist
->getNamedItem("type");
919 OUString sObjType
= objectattr
->getNodeValue();
921 if (sObjType
.equalsAscii(sObjKind
))
923 Reference
<XNodeList
> objectChildren
= objectNode
->getChildNodes();
924 const int objSize
= objectChildren
->getLength();
926 for( int j
=0; j
< objSize
; j
++)
928 Reference
<XNode
> obj
= objectChildren
->item(j
);
929 OUString nodename
= obj
->getNodeName();
931 //check whether child is blank 'text-node' or 'object-prop' node
932 if(nodename
== "object-prop")
934 Reference
<XNamedNodeMap
> ObjAttributes
= obj
->getAttributes();
935 Reference
<XNode
> ObjPageKind
= ObjAttributes
->getNamedItem("pagekind");
936 OUString sObjPageKind
= ObjPageKind
->getNodeValue();
938 if (sObjPageKind
.equalsAscii(sPageKind
))
940 Reference
<XNode
> ObjSizeHeight
= ObjAttributes
->getNamedItem("relative-height");
941 OUString sValue
= ObjSizeHeight
->getNodeValue();
942 presObjPropValue
[0] = sValue
.toDouble();
944 Reference
<XNode
> ObjSizeWidth
= ObjAttributes
->getNamedItem("relative-width");
945 sValue
= ObjSizeWidth
->getNodeValue();
946 presObjPropValue
[1] = sValue
.toDouble();
948 Reference
<XNode
> ObjPosX
= ObjAttributes
->getNamedItem("relative-posX");
949 sValue
= ObjPosX
->getNodeValue();
950 presObjPropValue
[2] = sValue
.toDouble();
952 Reference
<XNode
> ObjPosY
= ObjAttributes
->getNamedItem("relative-posY");
953 sValue
= ObjPosY
->getNodeValue();
954 presObjPropValue
[3] = sValue
.toDouble();
956 bNoObjectFound
= false;
970 rtl::Reference
<SdrObject
> SdPage::CreateDefaultPresObj(PresObjKind eObjKind
)
972 if( eObjKind
== PresObjKind::Title
)
974 ::tools::Rectangle
aTitleRect( GetTitleRect() );
975 return CreatePresObj(PresObjKind::Title
, false, aTitleRect
);
977 else if( eObjKind
== PresObjKind::Outline
)
979 ::tools::Rectangle
aLayoutRect( GetLayoutRect() );
980 return CreatePresObj( PresObjKind::Outline
, false, aLayoutRect
);
982 else if( eObjKind
== PresObjKind::Notes
)
984 ::tools::Rectangle
aLayoutRect( GetLayoutRect() );
985 return CreatePresObj( PresObjKind::Notes
, false, aLayoutRect
);
987 else if( (eObjKind
== PresObjKind::Footer
) || (eObjKind
== PresObjKind::DateTime
) || (eObjKind
== PresObjKind::SlideNumber
) || (eObjKind
== PresObjKind::Header
) )
989 double propvalue
[] = {0,0,0,0};
990 const char* sObjKind
= PresObjKindVector
[eObjKind
];
991 const char* sPageKind
= PageKindVector
[mePageKind
];
992 // create footer objects for standard master page
993 if( mePageKind
== PageKind::Standard
)
995 const ::tools::Long nLftBorder
= GetLeftBorder();
996 const ::tools::Long nUppBorder
= GetUpperBorder();
998 Point
aPos ( nLftBorder
, nUppBorder
);
999 Size
aSize ( GetSize() );
1001 aSize
.AdjustWidth( -(nLftBorder
+ GetRightBorder()) );
1002 aSize
.AdjustHeight( -(nUppBorder
+ GetLowerBorder()) );
1004 getPresObjProp( *this, sObjKind
, sPageKind
, propvalue
);
1005 aPos
.AdjustX(::tools::Long( aSize
.Width() * propvalue
[2] ) );
1006 aPos
.AdjustY(::tools::Long( aSize
.Height() * propvalue
[3] ) );
1007 aSize
.setWidth( ::tools::Long( aSize
.Width() * propvalue
[1] ) );
1008 aSize
.setHeight( ::tools::Long( aSize
.Height() * propvalue
[0] ) );
1010 if(eObjKind
== PresObjKind::Header
)
1012 OSL_FAIL( "SdPage::CreateDefaultPresObj() - can't create a header placeholder for a master slide" );
1017 ::tools::Rectangle
aRect( aPos
, aSize
);
1018 return CreatePresObj( eObjKind
, false, aRect
);
1023 // create header&footer objects for handout and notes master
1024 Size
aPageSize ( GetSize() );
1025 aPageSize
.AdjustWidth( -(GetLeftBorder() + GetRightBorder()) );
1026 aPageSize
.AdjustHeight( -(GetUpperBorder() + GetLowerBorder()) );
1028 Point
aPosition ( GetLeftBorder(), GetUpperBorder() );
1030 getPresObjProp( *this, sObjKind
, sPageKind
, propvalue
);
1031 int NOTES_HEADER_FOOTER_WIDTH
= ::tools::Long(aPageSize
.Width() * propvalue
[1]);
1032 int NOTES_HEADER_FOOTER_HEIGHT
= ::tools::Long(aPageSize
.Height() * propvalue
[0]);
1033 Size
aSize( NOTES_HEADER_FOOTER_WIDTH
, NOTES_HEADER_FOOTER_HEIGHT
);
1034 Point
aPos ( 0 ,0 );
1035 if( propvalue
[2] == 0 )
1036 aPos
.setX( aPosition
.X() );
1038 aPos
.setX( aPosition
.X() + ::tools::Long( aPageSize
.Width() - NOTES_HEADER_FOOTER_WIDTH
) );
1039 if( propvalue
[3] == 0 )
1040 aPos
.setY( aPosition
.Y() );
1042 aPos
.setY( aPosition
.Y() + ::tools::Long( aPageSize
.Height() - NOTES_HEADER_FOOTER_HEIGHT
) );
1044 ::tools::Rectangle
aRect( aPos
, aSize
);
1045 return CreatePresObj( eObjKind
, false, aRect
);
1050 OSL_FAIL("SdPage::CreateDefaultPresObj() - unknown PRESOBJ kind" );
1055 void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind
)
1057 SdrObject
* pObject
= GetPresObj( eObjKind
);
1061 SdDrawDocument
* pDoc(static_cast< SdDrawDocument
* >(&getSdrModelFromSdrPage()));
1062 const bool bUndo
= pDoc
->IsUndoEnabled();
1064 pDoc
->AddUndo(pDoc
->GetSdrUndoFactory().CreateUndoDeleteObject(*pObject
));
1065 SdrObjList
* pOL
= pObject
->getParentSdrObjListFromSdrObject();
1066 pOL
->RemoveObject(pObject
->GetOrdNumDirect());
1070 /*************************************************************************
1072 |* return title area
1074 \************************************************************************/
1076 ::tools::Rectangle
SdPage::GetTitleRect() const
1078 ::tools::Rectangle aTitleRect
;
1080 if (mePageKind
!= PageKind::Handout
)
1082 double propvalue
[] = {0,0,0,0};
1084 /******************************************************************
1085 * standard- or note page: title area
1086 ******************************************************************/
1087 Point
aTitlePos ( GetLeftBorder(), GetUpperBorder() );
1088 Size
aTitleSize ( GetSize() );
1089 aTitleSize
.AdjustWidth( -(GetLeftBorder() + GetRightBorder()) );
1090 aTitleSize
.AdjustHeight( -(GetUpperBorder() + GetLowerBorder()) );
1091 const char* sPageKind
= PageKindVector
[mePageKind
];
1093 if (mePageKind
== PageKind::Standard
)
1095 getPresObjProp( *this , "PRESOBJ_TITLE" ,sPageKind
, propvalue
);
1096 aTitlePos
.AdjustX(::tools::Long( aTitleSize
.Width() * propvalue
[2] ) );
1097 aTitlePos
.AdjustY(::tools::Long( aTitleSize
.Height() * propvalue
[3] ) );
1098 aTitleSize
.setWidth( ::tools::Long( aTitleSize
.Width() * propvalue
[1] ) );
1099 aTitleSize
.setHeight( ::tools::Long( aTitleSize
.Height() * propvalue
[0] ) );
1101 else if (mePageKind
== PageKind::Notes
)
1103 Point aPos
= aTitlePos
;
1104 getPresObjProp( *this, "PRESOBJ_TITLE" ,sPageKind
, propvalue
);
1105 aPos
.AdjustX(::tools::Long( aTitleSize
.Width() * propvalue
[2] ) );
1106 aPos
.AdjustY(::tools::Long( aTitleSize
.Height() * propvalue
[3] ) );
1109 aTitleSize
.setHeight( ::tools::Long( aTitleSize
.Height() * propvalue
[0] ) );
1110 aTitleSize
.setWidth( ::tools::Long( aTitleSize
.Width() * propvalue
[1] ) );
1112 Size aPartArea
= aTitleSize
;
1114 sal_uInt16
nDestPageNum(GetPageNum());
1115 SdrPage
* pRefPage
= nullptr;
1119 // only decrement if != 0, else we get 0xffff
1123 if(nDestPageNum
< getSdrModelFromSdrPage().GetPageCount())
1125 pRefPage
= getSdrModelFromSdrPage().GetPage(nDestPageNum
);
1130 // scale actually page size into handout rectangle
1131 double fH
= pRefPage
->GetWidth() == 0
1132 ? 0 : static_cast<double>(aPartArea
.Width()) / pRefPage
->GetWidth();
1133 double fV
= pRefPage
->GetHeight() == 0
1134 ? 0 : static_cast<double>(aPartArea
.Height()) / pRefPage
->GetHeight();
1138 aSize
.setWidth( static_cast<::tools::Long
>(fH
* pRefPage
->GetWidth()) );
1139 aSize
.setHeight( static_cast<::tools::Long
>(fH
* pRefPage
->GetHeight()) );
1141 aPos
.AdjustX((aPartArea
.Width() - aSize
.Width()) / 2 );
1142 aPos
.AdjustY((aPartArea
.Height()- aSize
.Height())/ 2 );
1149 aTitleRect
.SetPos(aTitlePos
);
1150 aTitleRect
.SetSize(aTitleSize
);
1156 /*************************************************************************
1158 |* return outline area
1160 \************************************************************************/
1162 ::tools::Rectangle
SdPage::GetLayoutRect() const
1164 ::tools::Rectangle aLayoutRect
;
1166 if (mePageKind
!= PageKind::Handout
)
1168 double propvalue
[] = {0,0,0,0};
1170 Point
aLayoutPos ( GetLeftBorder(), GetUpperBorder() );
1171 Size
aLayoutSize ( GetSize() );
1172 aLayoutSize
.AdjustWidth( -(GetLeftBorder() + GetRightBorder()) );
1173 aLayoutSize
.AdjustHeight( -(GetUpperBorder() + GetLowerBorder()) );
1174 const char* sPageKind
= PageKindVector
[mePageKind
];
1176 if (mePageKind
== PageKind::Standard
)
1178 getPresObjProp( *this ,"PRESOBJ_OUTLINE", sPageKind
, propvalue
);
1179 aLayoutPos
.AdjustX(::tools::Long( aLayoutSize
.Width() * propvalue
[2] ) );
1180 aLayoutPos
.AdjustY(::tools::Long( aLayoutSize
.Height() * propvalue
[3] ) );
1181 aLayoutSize
.setWidth( ::tools::Long( aLayoutSize
.Width() * propvalue
[1] ) );
1182 aLayoutSize
.setHeight( ::tools::Long( aLayoutSize
.Height() * propvalue
[0] ) );
1183 aLayoutRect
.SetPos(aLayoutPos
);
1184 aLayoutRect
.SetSize(aLayoutSize
);
1186 else if (mePageKind
== PageKind::Notes
)
1188 getPresObjProp( *this, "PRESOBJ_NOTES", sPageKind
, propvalue
);
1189 aLayoutPos
.AdjustX(::tools::Long( aLayoutSize
.Width() * propvalue
[2] ) );
1190 aLayoutPos
.AdjustY(::tools::Long( aLayoutSize
.Height() * propvalue
[3] ) );
1191 aLayoutSize
.setWidth( ::tools::Long( aLayoutSize
.Width() * propvalue
[1] ) );
1192 aLayoutSize
.setHeight( ::tools::Long( aLayoutSize
.Height() * propvalue
[0] ) );
1193 aLayoutRect
.SetPos(aLayoutPos
);
1194 aLayoutRect
.SetSize(aLayoutSize
);
1201 /**************************************************************************
1203 |* assign an AutoLayout
1205 \*************************************************************************/
1207 const int MAX_PRESOBJS
= 7; // maximum number of presentation objects per layout
1208 const int VERTICAL
= 0x8000;
1210 static constexpr PresObjKind
operator|(PresObjKind e
, int x
)
1212 return static_cast<PresObjKind
>(static_cast<int>(e
) | x
);
1217 struct LayoutDescriptor
1219 PresObjKind meKind
[MAX_PRESOBJS
];
1220 bool mbVertical
[MAX_PRESOBJS
];
1222 LayoutDescriptor( PresObjKind k0
= PresObjKind::NONE
, PresObjKind k1
= PresObjKind::NONE
, PresObjKind k2
= PresObjKind::NONE
, PresObjKind k3
= PresObjKind::NONE
, PresObjKind k4
= PresObjKind::NONE
, PresObjKind k5
= PresObjKind::NONE
, PresObjKind k6
= PresObjKind::NONE
);
1227 LayoutDescriptor::LayoutDescriptor( PresObjKind k0
, PresObjKind k1
, PresObjKind k2
, PresObjKind k3
, PresObjKind k4
, PresObjKind k5
, PresObjKind k6
)
1229 auto removeVertical
= [] (PresObjKind k
) { return static_cast<PresObjKind
>(static_cast<int>(k
) & ~VERTICAL
); };
1230 auto isVertical
= [] (PresObjKind k
) { return bool(static_cast<int>(k
) & VERTICAL
); };
1231 meKind
[0] = removeVertical(k0
); mbVertical
[0] = isVertical(k0
);
1232 meKind
[1] = removeVertical(k1
); mbVertical
[1] = isVertical(k1
);
1233 meKind
[2] = removeVertical(k2
); mbVertical
[2] = isVertical(k2
);
1234 meKind
[3] = removeVertical(k3
); mbVertical
[3] = isVertical(k3
);
1235 meKind
[4] = removeVertical(k4
); mbVertical
[4] = isVertical(k4
);
1236 meKind
[5] = removeVertical(k5
); mbVertical
[5] = isVertical(k5
);
1237 meKind
[6] = removeVertical(k6
); mbVertical
[6] = isVertical(k6
);
1240 static const LayoutDescriptor
& GetLayoutDescriptor( AutoLayout eLayout
)
1242 static const LayoutDescriptor aLayouts
[AUTOLAYOUT_END
-AUTOLAYOUT_START
] =
1244 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Text
), // AUTOLAYOUT_TITLE
1245 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
), // AUTOLAYOUT_TITLE_CONTENT
1246 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
), // AUTOLAYOUT_CHART
1247 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_TITLE_2CONTENT
1248 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_TEXTCHART
1249 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
), // AUTOLAYOUT_ORG
1250 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_TEXTCLbIP
1251 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_CHARTTEXT
1252 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
), // AUTOLAYOUT_TAB
1253 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_CLIPTEXT
1254 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_TEXTOBJ
1255 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Object
), // AUTOLAYOUT_OBJ
1256 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_TITLE_CONTENT_2CONTENT
1257 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_TEXTOBJ
1258 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT
1259 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_TITLE_2CONTENT_CONTENT
1260 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT
1261 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
), // AUTOLAYOUT_TEXTOVEROBJ
1262 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
, // AUTOLAYOUT_TITLE_4CONTENT
1263 PresObjKind::Outline
, PresObjKind::Outline
),
1264 LayoutDescriptor( PresObjKind::Title
, PresObjKind::NONE
), // AUTOLAYOUT_TITLE_ONLY
1265 LayoutDescriptor( PresObjKind::NONE
), // AUTOLAYOUT_NONE
1266 LayoutDescriptor( PresObjKind::Page
, PresObjKind::Notes
), // AUTOLAYOUT_NOTES
1267 LayoutDescriptor( ), // AUTOLAYOUT_HANDOUT1
1268 LayoutDescriptor( ), // AUTOLAYOUT_HANDOUT2
1269 LayoutDescriptor( ), // AUTOLAYOUT_HANDOUT3
1270 LayoutDescriptor( ), // AUTOLAYOUT_HANDOUT4
1271 LayoutDescriptor( ), // AUTOLAYOUT_HANDOUT6
1272 LayoutDescriptor( PresObjKind::Title
|VERTICAL
, PresObjKind::Outline
|VERTICAL
, PresObjKind::Outline
),// AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT
1273 LayoutDescriptor( PresObjKind::Title
|VERTICAL
, PresObjKind::Outline
|VERTICAL
), // AUTOLAYOUT_VTITLE_VCONTENT
1274 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
|VERTICAL
), // AUTOLAYOUT_TITLE_VCONTENT
1275 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
|VERTICAL
, PresObjKind::Outline
|VERTICAL
), // AUTOLAYOUT_TITLE_2VTEXT
1276 LayoutDescriptor( ), // AUTOLAYOUT_HANDOUT9
1277 LayoutDescriptor( PresObjKind::Text
, PresObjKind::NONE
), // AUTOLAYOUT_ONLY_TEXT
1278 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
, // AUTOLAYOUT_4CLIPART
1279 PresObjKind::Graphic
, PresObjKind::Graphic
),
1280 LayoutDescriptor( PresObjKind::Title
, PresObjKind::Outline
, PresObjKind::Outline
, // AUTOLAYOUT_TITLE_6CONTENT
1281 PresObjKind::Outline
, PresObjKind::Outline
, PresObjKind::Outline
, PresObjKind::Outline
)
1284 if( (eLayout
< AUTOLAYOUT_START
) || (eLayout
>= AUTOLAYOUT_END
) )
1285 eLayout
= AUTOLAYOUT_NONE
;
1287 return aLayouts
[ eLayout
- AUTOLAYOUT_START
];
1290 static OUString
enumtoString(AutoLayout aut
)
1295 case AUTOLAYOUT_TITLE_CONTENT
:
1296 retstr
="AUTOLAYOUT_TITLE_CONTENT";
1298 case AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT
:
1299 retstr
="AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT";
1301 case AUTOLAYOUT_TITLE_CONTENT_2CONTENT
:
1302 retstr
="AUTOLAYOUT_TITLE_CONTENT_2CONTENT";
1304 case AUTOLAYOUT_TITLE_4CONTENT
:
1305 retstr
="AUTOLAYOUT_TITLE_4CONTENT";
1307 case AUTOLAYOUT_ONLY_TEXT
:
1308 retstr
="AUTOLAYOUT_ONLY_TEXT";
1310 case AUTOLAYOUT_TITLE_ONLY
:
1311 retstr
="AUTOLAYOUT_TITLE_ONLY";
1313 case AUTOLAYOUT_TITLE_6CONTENT
:
1314 retstr
="AUTOLAYOUT_TITLE_6CONTENT";
1316 case AUTOLAYOUT_START
:
1317 retstr
="AUTOLAYOUT_START";
1319 case AUTOLAYOUT_TITLE_2CONTENT_CONTENT
:
1320 retstr
="AUTOLAYOUT_TITLE_2CONTENT_CONTENT";
1322 case AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT
:
1323 retstr
="AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT";
1325 case AUTOLAYOUT_TITLE_2CONTENT
:
1326 retstr
="AUTOLAYOUT_TITLE_2CONTENT";
1328 case AUTOLAYOUT_VTITLE_VCONTENT
:
1329 retstr
="AUTOLAYOUT_VTITLE_VCONTENT";
1331 case AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT
:
1332 retstr
="AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT";
1334 case AUTOLAYOUT_TITLE_VCONTENT
:
1335 retstr
="AUTOLAYOUT_TITLE_VCONTENT";
1337 case AUTOLAYOUT_TITLE_2VTEXT
:
1338 retstr
="AUTOLAYOUT_TITLE_2VTEXT";
1343 // case AUTOLAYOUT_TITLE_4SCONTENT: return "AUTOLAYOUT_TITLE_4SCONTENT";
1348 static void CalcAutoLayoutRectangles( SdPage
const & rPage
,::tools::Rectangle
* rRectangle
,const OUString
& sLayoutType
)
1350 ::tools::Rectangle aTitleRect
;
1351 ::tools::Rectangle aLayoutRect
;
1353 if( rPage
.GetPageKind() != PageKind::Handout
)
1355 SdPage
& rMasterPage
= static_cast<SdPage
&>(rPage
.TRG_GetMasterPage());
1356 SdrObject
* pMasterTitle
= rMasterPage
.GetPresObj( PresObjKind::Title
);
1357 SdrObject
* pMasterSubTitle
= rMasterPage
.GetPresObj( PresObjKind::Text
);
1358 SdrObject
* pMasterOutline
= rMasterPage
.GetPresObj( rPage
.GetPageKind()==PageKind::Notes
? PresObjKind::Notes
: PresObjKind::Outline
);
1361 aTitleRect
= pMasterTitle
->GetLogicRect();
1363 if (aTitleRect
.IsEmpty() )
1364 aTitleRect
= rPage
.GetTitleRect();
1365 if( pMasterSubTitle
)
1366 aLayoutRect
= pMasterSubTitle
->GetLogicRect();
1367 else if( pMasterOutline
)
1368 aLayoutRect
= pMasterOutline
->GetLogicRect();
1370 if (aLayoutRect
.IsEmpty() )
1371 aLayoutRect
= rPage
.GetLayoutRect();
1374 rRectangle
[0] = aTitleRect
;
1375 for( int i
= 1; i
< MAX_PRESOBJS
; i
++ )
1376 rRectangle
[i
] = aLayoutRect
;
1378 const Point
aTitlePos( aTitleRect
.TopLeft() );
1379 const Size
aLayoutSize( aLayoutRect
.GetSize() );
1380 const Point
aLayoutPos( aLayoutRect
.TopLeft() );
1381 double propvalue
[] = {0,0,0,0};
1383 const std::vector
< Reference
<XNode
> >& layoutInfo
= static_cast< const SdDrawDocument
& >(rPage
.getSdrModelFromSdrPage()).GetLayoutVector();
1384 auto aIter
= std::find_if(layoutInfo
.begin(), layoutInfo
.end(),
1385 [&sLayoutType
](const Reference
<XNode
>& layoutNode
) {
1386 Reference
<XNamedNodeMap
> layoutAttrList
= layoutNode
->getAttributes();
1388 // get the attribute value of layout (i.e it's type)
1389 OUString sLayoutAttName
= layoutAttrList
->getNamedItem("type")->getNodeValue();
1390 return sLayoutAttName
== sLayoutType
;
1392 if (aIter
== layoutInfo
.end())
1396 Reference
<XNode
> layoutNode
= *aIter
;
1397 Reference
<XNodeList
> layoutChildren
= layoutNode
->getChildNodes();
1398 const int presobjsize
= layoutChildren
->getLength();
1399 for( int j
=0; j
< presobjsize
; j
++)
1402 Reference
<XNode
> presobj
= layoutChildren
->item(j
);
1403 nodename
=presobj
->getNodeName();
1405 //check whether child is blank 'text-node' or 'presobj' node
1406 if(nodename
== "presobj")
1408 // TODO: rework sd to permit arbitrary number of presentation objects
1409 assert(count
< MAX_PRESOBJS
);
1411 Reference
<XNamedNodeMap
> presObjAttributes
= presobj
->getAttributes();
1413 Reference
<XNode
> presObjSizeHeight
= presObjAttributes
->getNamedItem("relative-height");
1414 OUString sValue
= presObjSizeHeight
->getNodeValue();
1415 propvalue
[0] = sValue
.toDouble();
1417 Reference
<XNode
> presObjSizeWidth
= presObjAttributes
->getNamedItem("relative-width");
1418 sValue
= presObjSizeWidth
->getNodeValue();
1419 propvalue
[1] = sValue
.toDouble();
1421 Reference
<XNode
> presObjPosX
= presObjAttributes
->getNamedItem("relative-posX");
1422 sValue
= presObjPosX
->getNodeValue();
1423 propvalue
[2] = sValue
.toDouble();
1425 Reference
<XNode
> presObjPosY
= presObjAttributes
->getNamedItem("relative-posY");
1426 sValue
= presObjPosY
->getNodeValue();
1427 propvalue
[3] = sValue
.toDouble();
1431 Size
aSize ( aTitleRect
.GetSize() );
1432 aSize
.setHeight( basegfx::fround(aSize
.Height() * propvalue
[0]) );
1433 aSize
.setWidth( basegfx::fround(aSize
.Width() * propvalue
[1]) );
1434 Point
aPos( basegfx::fround(aTitlePos
.X() +(aSize
.Width() * propvalue
[2])),
1435 basegfx::fround(aTitlePos
.Y() + (aSize
.Height() * propvalue
[3])) );
1436 rRectangle
[count
] = ::tools::Rectangle(aPos
, aSize
);
1441 Size
aSize( basegfx::fround(aLayoutSize
.Width() * propvalue
[1]),
1442 basegfx::fround(aLayoutSize
.Height() * propvalue
[0]) );
1443 Point
aPos( basegfx::fround(aLayoutPos
.X() +(aSize
.Width() * propvalue
[2])),
1444 basegfx::fround(aLayoutPos
.Y() + (aSize
.Height() * propvalue
[3])) );
1445 rRectangle
[count
] = ::tools::Rectangle (aPos
, aSize
);
1452 static void findAutoLayoutShapesImpl( SdPage
& rPage
, const LayoutDescriptor
& rDescriptor
, std::array
<SdrObject
*, MAX_PRESOBJS
>& rShapes
, bool bInit
, bool bSwitchLayout
)
1454 // init list of indexes for each presentation shape kind
1455 // this is used to find subsequent shapes with the same presentation shape kind
1456 o3tl::enumarray
<PresObjKind
,int> PresObjIndex
;
1457 PresObjIndex
.fill(1);
1459 bool bMissing
= false;
1461 // for each entry in the layoutdescriptor, arrange a presentation shape
1462 for (int i
= 0; (i
< MAX_PRESOBJS
) && (rDescriptor
.meKind
[i
] != PresObjKind::NONE
); i
++)
1464 PresObjKind eKind
= rDescriptor
.meKind
[i
];
1465 SdrObject
* pObj
= nullptr;
1466 while( (pObj
= rPage
.GetPresObj( eKind
, PresObjIndex
[eKind
], true )) != nullptr )
1468 PresObjIndex
[eKind
]++; // on next search for eKind, find next shape with same eKind
1470 if( !bSwitchLayout
|| !pObj
->IsEmptyPresObj() )
1481 if( !(bMissing
&& bInit
) )
1484 // for each entry in the layoutdescriptor, look for an alternative shape
1485 for (int i
= 0; (i
< MAX_PRESOBJS
) && (rDescriptor
.meKind
[i
] != PresObjKind::NONE
); i
++)
1490 PresObjKind eKind
= rDescriptor
.meKind
[i
];
1492 SdrObject
* pObj
= nullptr;
1493 bool bFound
= false;
1495 const size_t nShapeCount
= rPage
.GetObjCount();
1496 for(size_t nShapeIndex
= 0; nShapeIndex
< nShapeCount
&& !bFound
; ++nShapeIndex
)
1498 pObj
= rPage
.GetObj(nShapeIndex
);
1500 if( pObj
->IsEmptyPresObj() )
1503 if( pObj
->GetObjInventor() != SdrInventor::Default
)
1506 // do not reuse shapes that are already part of the layout
1507 if( std::find( rShapes
.begin(), rShapes
.end(), pObj
) != rShapes
.end() )
1510 bool bPresStyle
= pObj
->GetStyleSheet() && (pObj
->GetStyleSheet()->GetFamily() == SfxStyleFamily::Page
);
1511 SdrObjKind eSdrObjKind
= pObj
->GetObjIdentifier();
1515 case PresObjKind::Title
:
1516 bFound
= eSdrObjKind
== SdrObjKind::TitleText
;
1518 case PresObjKind::Table
:
1519 bFound
= eSdrObjKind
== SdrObjKind::Table
;
1521 case PresObjKind::Media
:
1522 bFound
= eSdrObjKind
== SdrObjKind::Media
;
1524 case PresObjKind::Outline
:
1525 bFound
= (eSdrObjKind
== SdrObjKind::OutlineText
) ||
1526 ((eSdrObjKind
== SdrObjKind::Text
) && bPresStyle
) ||
1527 (eSdrObjKind
== SdrObjKind::Table
) || (eSdrObjKind
== SdrObjKind::Media
) || (eSdrObjKind
== SdrObjKind::Graphic
) || (eSdrObjKind
== SdrObjKind::OLE2
);
1529 case PresObjKind::Graphic
:
1530 bFound
= eSdrObjKind
== SdrObjKind::Graphic
;
1532 case PresObjKind::Object
:
1533 if( eSdrObjKind
== SdrObjKind::OLE2
)
1535 SdrOle2Obj
* pOle2
= dynamic_cast< SdrOle2Obj
* >( pObj
);
1538 if( pOle2
->IsEmpty() )
1542 ::comphelper::IEmbeddedHelper
* pPersist(rPage
.getSdrModelFromSdrPage().GetPersist());
1546 uno::Reference
< embed::XEmbeddedObject
> xObject
= pPersist
->getEmbeddedObjectContainer().
1547 GetEmbeddedObject( pOle2
->GetPersistName() );
1549 // TODO CL->KA: Why is this not working anymore?
1552 SvGlobalName
aClassId( xObject
->getClassID() );
1554 const SvGlobalName
aAppletClassId( SO3_APPLET_CLASSID
);
1555 const SvGlobalName
aPluginClassId( SO3_PLUGIN_CLASSID
);
1556 const SvGlobalName
aIFrameClassId( SO3_IFRAME_CLASSID
);
1558 if( aPluginClassId
!= aClassId
&& aAppletClassId
!= aClassId
&& aIFrameClassId
!= aClassId
)
1568 case PresObjKind::Chart
:
1569 case PresObjKind::Calc
:
1570 if( eSdrObjKind
== SdrObjKind::OLE2
)
1572 SdrOle2Obj
* pOle2
= dynamic_cast< SdrOle2Obj
* >( pObj
);
1576 ((eKind
== PresObjKind::Chart
) &&
1577 ( pOle2
->GetProgName() == "StarChart" || pOle2
->IsChart() ) )
1579 ((eKind
== PresObjKind::Calc
) &&
1580 ( pOle2
->GetProgName() == "StarCalc" || pOle2
->IsCalc() ) ) )
1587 else if( eSdrObjKind
== SdrObjKind::Table
)
1592 case PresObjKind::Page
:
1593 case PresObjKind::Handout
:
1594 bFound
= eSdrObjKind
== SdrObjKind::Page
;
1596 case PresObjKind::Notes
:
1597 case PresObjKind::Text
:
1598 bFound
= (bPresStyle
&& (eSdrObjKind
== SdrObjKind::Text
)) || (eSdrObjKind
== SdrObjKind::OutlineText
);
1610 void SdPage::SetAutoLayout(AutoLayout eLayout
, bool bInit
, bool bCreate
)
1612 sd::ScopeLockGuard
aGuard( maLockAutoLayoutArrangement
);
1614 const bool bSwitchLayout
= eLayout
!= GetAutoLayout();
1616 SfxUndoManager
* pUndoManager(static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetUndoManager());
1617 const bool bUndo
= pUndoManager
&& pUndoManager
->IsInListAction() && IsInserted();
1619 meAutoLayout
= eLayout
;
1621 // if needed, creates and initialises the presentation shapes on this slides master page
1622 CreateTitleAndLayout(bInit
, bCreate
);
1624 if((meAutoLayout
== AUTOLAYOUT_NONE
&& maPresentationShapeList
.isEmpty()) || mbMaster
)
1626 // MasterPage or no layout and no presentation shapes available, nothing to do
1630 ::tools::Rectangle aRectangle
[MAX_PRESOBJS
];
1631 const LayoutDescriptor
& aDescriptor
= GetLayoutDescriptor( meAutoLayout
);
1632 OUString
sLayoutName( enumtoString(meAutoLayout
) );
1633 CalcAutoLayoutRectangles( *this, aRectangle
, sLayoutName
);
1635 o3tl::sorted_vector
< SdrObject
* > aUsedPresentationObjects
;
1637 std::array
<SdrObject
*, MAX_PRESOBJS
> aLayoutShapes
;
1638 aLayoutShapes
.fill(nullptr);
1639 findAutoLayoutShapesImpl( *this, aDescriptor
, aLayoutShapes
, bInit
, bSwitchLayout
);
1641 // for each entry in the layoutdescriptor, arrange a presentation shape
1642 for (int i
= 0; (i
< MAX_PRESOBJS
) && (aDescriptor
.meKind
[i
] != PresObjKind::NONE
); i
++)
1644 PresObjKind eKind
= aDescriptor
.meKind
[i
];
1645 SdrObject
* pObj
= InsertAutoLayoutShape( aLayoutShapes
[i
], eKind
, aDescriptor
.mbVertical
[i
], aRectangle
[i
], bInit
);
1647 aUsedPresentationObjects
.insert(pObj
); // remember that we used this empty shape
1650 // now delete all empty presentation objects that are no longer used by the new layout
1654 maPresentationShapeList
.seekShape(0);
1656 rtl::Reference
<SdrObject
> pObj
;
1657 while( (pObj
= maPresentationShapeList
.getNextShape()) )
1659 if( aUsedPresentationObjects
.count(pObj
.get()) == 0 )
1662 if( pObj
->IsEmptyPresObj() )
1665 pUndoManager
->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj
));
1667 RemoveObject( pObj
->GetOrdNum() );
1670 /* #i108541# keep non empty pres obj as pres obj even if they are not part of the current layout */
1675 /*************************************************************************
1679 \************************************************************************/
1681 void SdPage::NbcInsertObject(SdrObject
* pObj
, size_t nPos
)
1683 FmFormPage::NbcInsertObject(pObj
, nPos
);
1685 static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).InsertObject(pObj
);
1687 SdrLayerID nId
= pObj
->GetLayer();
1690 if( nId
== SdrLayerID(0) )
1691 pObj
->NbcSetLayer( SdrLayerID(2) ); // wrong layer. corrected to BackgroundObj layer
1695 if( nId
== SdrLayerID(2) )
1696 pObj
->NbcSetLayer( SdrLayerID(0) ); // wrong layer. corrected to layout layer
1700 /*************************************************************************
1704 \************************************************************************/
1706 rtl::Reference
<SdrObject
> SdPage::RemoveObject(size_t nObjNum
)
1708 onRemoveObject(GetObj( nObjNum
));
1709 return FmFormPage::RemoveObject(nObjNum
);
1712 /*************************************************************************
1714 |* remove object without broadcast
1716 \************************************************************************/
1718 rtl::Reference
<SdrObject
> SdPage::NbcRemoveObject(size_t nObjNum
)
1720 onRemoveObject(GetObj( nObjNum
));
1721 return FmFormPage::NbcRemoveObject(nObjNum
);
1724 // Also override ReplaceObject methods to realize when
1725 // objects are removed with this mechanism instead of RemoveObject
1726 rtl::Reference
<SdrObject
> SdPage::ReplaceObject(SdrObject
* pNewObj
, size_t nObjNum
)
1728 onRemoveObject(GetObj( nObjNum
));
1729 return FmFormPage::ReplaceObject(pNewObj
, nObjNum
);
1732 // called after a shape is removed or replaced from this slide
1734 void SdPage::onRemoveObject( SdrObject
* pObject
)
1738 RemovePresObj(pObject
);
1740 static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).RemoveObject(pObject
);
1742 removeAnimations( pObject
);
1746 void SdPage::SetSize(const Size
& aSize
)
1748 Size aOldSize
= GetSize();
1750 if (aSize
!= aOldSize
)
1752 FmFormPage::SetSize(aSize
);
1756 void SdPage::SetBorder(sal_Int32 nLft
, sal_Int32 nUpp
, sal_Int32 nRgt
, sal_Int32 nLwr
)
1758 if (nLft
!= GetLeftBorder() || nUpp
!= GetUpperBorder() ||
1759 nRgt
!= GetRightBorder() || nLwr
!= GetLowerBorder() )
1761 FmFormPage::SetBorder(nLft
, nUpp
, nRgt
, nLwr
);
1765 void SdPage::SetLeftBorder(sal_Int32 nBorder
)
1767 if (nBorder
!= GetLeftBorder() )
1769 FmFormPage::SetLeftBorder(nBorder
);
1773 void SdPage::SetRightBorder(sal_Int32 nBorder
)
1775 if (nBorder
!= GetRightBorder() )
1777 FmFormPage::SetRightBorder(nBorder
);
1781 void SdPage::SetUpperBorder(sal_Int32 nBorder
)
1783 if (nBorder
!= GetUpperBorder() )
1785 FmFormPage::SetUpperBorder(nBorder
);
1789 void SdPage::SetLowerBorder(sal_Int32 nBorder
)
1791 if (nBorder
!= GetLowerBorder() )
1793 FmFormPage::SetLowerBorder(nBorder
);
1797 /*************************************************************************
1799 |* Adjust all objects to new page size.
1801 |* bScaleAllObj: all objects are scaled into the new area within the page
1802 |* margins. We scale the position and size. For presentation objects on the
1803 |* master page, we also scale the font height of the presentation template.
1805 \************************************************************************/
1807 void SdPage::ScaleObjects(const Size
& rNewPageSize
, const ::tools::Rectangle
& rNewBorderRect
, bool bScaleAllObj
)
1809 sd::ScopeLockGuard
aGuard( maLockAutoLayoutArrangement
);
1811 mbScaleObjects
= bScaleAllObj
;
1812 SdrObject
* pObj
= nullptr;
1813 Point
aRefPnt(0, 0);
1814 Size
aNewPageSize(rNewPageSize
);
1815 sal_Int32 nLeft
= rNewBorderRect
.Left();
1816 sal_Int32 nRight
= rNewBorderRect
.Right();
1817 sal_Int32 nUpper
= rNewBorderRect
.Top();
1818 sal_Int32 nLower
= rNewBorderRect
.Bottom();
1820 // negative values are fixed values
1821 // -> use up to date values
1822 if (aNewPageSize
.Width() < 0)
1824 aNewPageSize
.setWidth( GetWidth() );
1826 if (aNewPageSize
.Height() < 0)
1828 aNewPageSize
.setHeight( GetHeight() );
1832 nLeft
= GetLeftBorder();
1836 nRight
= GetRightBorder();
1840 nUpper
= GetUpperBorder();
1844 nLower
= GetLowerBorder();
1847 Size
aBackgroundSize(aNewPageSize
);
1851 aBackgroundSize
.AdjustWidth( -(nLeft
+ nRight
) );
1852 aBackgroundSize
.AdjustHeight( -(nUpper
+ nLower
) );
1853 aNewPageSize
= aBackgroundSize
;
1856 ::tools::Long nOldWidth
= GetWidth() - GetLeftBorder() - GetRightBorder();
1857 ::tools::Long nOldHeight
= GetHeight() - GetUpperBorder() - GetLowerBorder();
1859 Fraction
aFractX(aNewPageSize
.Width(), nOldWidth
);
1860 Fraction
aFractY(aNewPageSize
.Height(), nOldHeight
);
1862 const size_t nObjCnt
= (mbScaleObjects
? GetObjCount() : 0);
1864 for (size_t nObj
= 0; nObj
< nObjCnt
; ++nObj
)
1866 bool bIsPresObjOnMaster
= false;
1869 pObj
= GetObj(nObj
);
1871 if (mbMaster
&& IsPresObj(pObj
))
1873 // There is a presentation object on the master page
1874 bIsPresObjOnMaster
= true;
1879 // remember aTopLeft as original TopLeft
1880 Point
aTopLeft(pObj
->GetCurrentBoundRect().TopLeft());
1882 if (!pObj
->IsEdgeObj())
1884 /**************************************************************
1886 **************************************************************/
1889 // use aTopLeft as original TopLeft
1893 pObj
->Resize(aRefPnt
, aFractX
, aFractY
);
1897 SdrObjKind eObjKind
= pObj
->GetObjIdentifier();
1899 if (bIsPresObjOnMaster
)
1901 /**********************************************************
1902 * presentation template: adjust test height
1903 **********************************************************/
1905 if (pObj
== GetPresObj(PresObjKind::Title
, 0))
1907 SfxStyleSheet
* pTitleSheet
= GetStyleSheetForPresObj(PresObjKind::Title
);
1911 SfxItemSet
& rSet
= pTitleSheet
->GetItemSet();
1913 const SvxFontHeightItem
& rOldHgt
= rSet
.Get(EE_CHAR_FONTHEIGHT
);
1914 sal_uLong nFontHeight
= rOldHgt
.GetHeight();
1915 nFontHeight
= ::tools::Long(nFontHeight
* static_cast<double>(aFractY
));
1916 rSet
.Put(SvxFontHeightItem(nFontHeight
, 100, EE_CHAR_FONTHEIGHT
));
1918 if( SfxItemState::DEFAULT
== rSet
.GetItemState( EE_CHAR_FONTHEIGHT_CJK
) )
1920 const SvxFontHeightItem
& rOldHgt2
= rSet
.Get(EE_CHAR_FONTHEIGHT_CJK
);
1921 nFontHeight
= rOldHgt2
.GetHeight();
1922 nFontHeight
= ::tools::Long(nFontHeight
* static_cast<double>(aFractY
));
1923 rSet
.Put(SvxFontHeightItem(nFontHeight
, 100, EE_CHAR_FONTHEIGHT_CJK
));
1926 if( SfxItemState::DEFAULT
== rSet
.GetItemState( EE_CHAR_FONTHEIGHT_CTL
) )
1928 const SvxFontHeightItem
& rOldHgt2
= rSet
.Get(EE_CHAR_FONTHEIGHT_CTL
);
1929 nFontHeight
= rOldHgt2
.GetHeight();
1930 nFontHeight
= ::tools::Long(nFontHeight
* static_cast<double>(aFractY
));
1931 rSet
.Put(SvxFontHeightItem(nFontHeight
, 100, EE_CHAR_FONTHEIGHT_CTL
));
1934 pTitleSheet
->Broadcast(SfxHint(SfxHintId::DataChanged
));
1937 else if (pObj
== GetPresObj(PresObjKind::Outline
, 0))
1939 OUString
aName(GetLayoutName() + " ");
1941 for (sal_Int32 i
=1; i
<=9; i
++)
1943 OUString
sLayoutName( aName
+ OUString::number( i
) );
1944 SfxStyleSheet
* pOutlineSheet
= static_cast<SfxStyleSheet
*>(static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetStyleSheetPool()->Find(sLayoutName
, SfxStyleFamily::Page
));
1948 // Calculate new font height
1949 SfxItemSet
aTempSet(pOutlineSheet
->GetItemSet());
1951 const SvxFontHeightItem
& rOldHgt
= aTempSet
.Get(EE_CHAR_FONTHEIGHT
);
1952 sal_uLong nFontHeight
= rOldHgt
.GetHeight();
1953 nFontHeight
= ::tools::Long(nFontHeight
* static_cast<double>(aFractY
));
1954 aTempSet
.Put(SvxFontHeightItem(nFontHeight
, 100, EE_CHAR_FONTHEIGHT
));
1956 if( SfxItemState::DEFAULT
== aTempSet
.GetItemState( EE_CHAR_FONTHEIGHT_CJK
) )
1958 const SvxFontHeightItem
& rOldHgt2
= aTempSet
.Get(EE_CHAR_FONTHEIGHT_CJK
);
1959 nFontHeight
= rOldHgt2
.GetHeight();
1960 nFontHeight
= ::tools::Long(nFontHeight
* static_cast<double>(aFractY
));
1961 aTempSet
.Put(SvxFontHeightItem(nFontHeight
, 100, EE_CHAR_FONTHEIGHT_CJK
));
1964 if( SfxItemState::DEFAULT
== aTempSet
.GetItemState( EE_CHAR_FONTHEIGHT_CTL
) )
1966 const SvxFontHeightItem
& rOldHgt2
= aTempSet
.Get(EE_CHAR_FONTHEIGHT_CTL
);
1967 nFontHeight
= rOldHgt2
.GetHeight();
1968 nFontHeight
= ::tools::Long(nFontHeight
* static_cast<double>(aFractY
));
1969 aTempSet
.Put(SvxFontHeightItem(nFontHeight
, 100, EE_CHAR_FONTHEIGHT_CTL
));
1973 static_cast<SdStyleSheet
*>(pOutlineSheet
)->AdjustToFontHeight(aTempSet
, false);
1975 // Special treatment: reset the INVALIDS to
1976 // NULL pointer (otherwise we have INVALID's
1977 // or pointer to the DefaultItems in the
1978 // template; both would suppress the
1979 // attribute inheritance)
1980 aTempSet
.ClearInvalidItems();
1982 // Special treatment: only the valid parts
1983 // of the BulletItems
1984 if (aTempSet
.GetItemState(EE_PARA_BULLET
) == SfxItemState::DEFAULT
)
1986 SvxBulletItem
aOldBulItem( pOutlineSheet
->GetItemSet().Get(EE_PARA_BULLET
) );
1987 const SvxBulletItem
& rNewBulItem
= aTempSet
.Get(EE_PARA_BULLET
);
1988 aOldBulItem
.CopyValidProperties(rNewBulItem
);
1989 aTempSet
.Put(aOldBulItem
);
1992 pOutlineSheet
->GetItemSet().Put(aTempSet
);
1993 pOutlineSheet
->Broadcast(SfxHint(SfxHintId::DataChanged
));
1997 else if (pObj
== GetPresObj(PresObjKind::Notes
, 0))
1999 SfxStyleSheet
* pNotesSheet
= GetStyleSheetForPresObj(PresObjKind::Notes
);
2003 sal_uLong nHeight
= pObj
->GetLogicRect().GetSize().Height();
2004 sal_uLong nFontHeight
= static_cast<sal_uLong
>(nHeight
* 0.0741);
2005 SfxItemSet
& rSet
= pNotesSheet
->GetItemSet();
2006 rSet
.Put( SvxFontHeightItem(nFontHeight
, 100, EE_CHAR_FONTHEIGHT
));
2007 rSet
.Put( SvxFontHeightItem(nFontHeight
, 100, EE_CHAR_FONTHEIGHT_CJK
));
2008 rSet
.Put( SvxFontHeightItem(nFontHeight
, 100, EE_CHAR_FONTHEIGHT_CTL
));
2009 pNotesSheet
->Broadcast(SfxHint(SfxHintId::DataChanged
));
2013 else if ( eObjKind
!= SdrObjKind::TitleText
&&
2014 eObjKind
!= SdrObjKind::OutlineText
&&
2015 DynCastSdrTextObj( pObj
) != nullptr &&
2016 pObj
->GetOutlinerParaObject() )
2018 /******************************************************
2019 * normal text object: adjust text height
2020 ******************************************************/
2021 SvtScriptType nScriptType
= pObj
->GetOutlinerParaObject()->GetTextObject().GetScriptType();
2022 sal_uInt16 nWhich
= EE_CHAR_FONTHEIGHT
;
2023 if ( nScriptType
== SvtScriptType::ASIAN
)
2024 nWhich
= EE_CHAR_FONTHEIGHT_CJK
;
2025 else if ( nScriptType
== SvtScriptType::COMPLEX
)
2026 nWhich
= EE_CHAR_FONTHEIGHT_CTL
;
2028 // use more modern method to scale the text height
2029 sal_uInt32 nFontHeight
= static_cast<const SvxFontHeightItem
&>(pObj
->GetMergedItem(nWhich
)).GetHeight();
2030 sal_uInt32 nNewFontHeight
= sal_uInt32(static_cast<double>(nFontHeight
) * static_cast<double>(aFractY
));
2032 pObj
->SetMergedItem(SvxFontHeightItem(nNewFontHeight
, 100, nWhich
));
2037 if (mbScaleObjects
&& !pObj
->IsEdgeObj())
2039 /**************************************************************
2040 * scale object position
2041 **************************************************************/
2044 // corrected scaling; only distances may be scaled
2045 // use aTopLeft as original TopLeft
2046 aNewPos
.setX( ::tools::Long((aTopLeft
.X() - GetLeftBorder()) * static_cast<double>(aFractX
)) + nLeft
);
2047 aNewPos
.setY( ::tools::Long((aTopLeft
.Y() - GetUpperBorder()) * static_cast<double>(aFractY
)) + nUpper
);
2049 Size
aVec(aNewPos
.X() - aTopLeft
.X(), aNewPos
.Y() - aTopLeft
.Y());
2051 if (aVec
.Height() != 0 || aVec
.Width() != 0)
2053 pObj
->NbcMove(aVec
);
2057 pObj
->BroadcastObjectChange();
2063 static rtl::Reference
<SdrObject
> convertPresentationObjectImpl(SdPage
& rPage
, SdrObject
* pSourceObj
, PresObjKind
& eObjKind
, bool bVertical
, const ::tools::Rectangle
& rRect
)
2065 SdDrawDocument
& rModel(static_cast< SdDrawDocument
& >(rPage
.getSdrModelFromSdrPage()));
2069 SfxUndoManager
* pUndoManager
= rModel
.GetUndoManager();
2070 const bool bUndo
= pUndoManager
&& pUndoManager
->IsInListAction() && rPage
.IsInserted();
2072 rtl::Reference
<SdrObject
> pNewObj
= pSourceObj
;
2073 if((eObjKind
== PresObjKind::Outline
) && (pSourceObj
->GetObjIdentifier() == SdrObjKind::Text
) )
2075 pNewObj
= rPage
.CreatePresObj(PresObjKind::Outline
, bVertical
, rRect
);
2077 // Set text of the subtitle into PRESOBJ_OUTLINE
2078 OutlinerParaObject
* pOutlParaObj
= pSourceObj
->GetOutlinerParaObject();
2083 SdOutliner
* pOutl
= rModel
.GetInternalOutliner();
2085 pOutl
->SetText( *pOutlParaObj
);
2086 pNewObj
->SetOutlinerParaObject( pOutl
->CreateParaObject() );
2087 pOutlParaObj
= pNewObj
->GetOutlinerParaObject();
2089 pNewObj
->SetEmptyPresObj(false);
2091 for (sal_uInt16 nLevel
= 1; nLevel
< 10; nLevel
++)
2093 // assign new template
2094 OUString
aName( rPage
.GetLayoutName() + " " + OUString::number( nLevel
) );
2095 SfxStyleSheet
* pSheet
= static_cast<SfxStyleSheet
*>( rModel
.GetStyleSheetPool()->Find(aName
, SfxStyleFamily::Page
) );
2097 if (pSheet
&& nLevel
== 1)
2099 SfxStyleSheet
* pSubtitleSheet
= rPage
.GetStyleSheetForPresObj(PresObjKind::Text
);
2102 pOutlParaObj
->ChangeStyleSheetName(SfxStyleFamily::Page
, pSubtitleSheet
->GetName(), pSheet
->GetName());
2106 // Remove LRSpace item
2107 SfxItemSetFixed
<EE_PARA_LRSPACE
, EE_PARA_LRSPACE
> aSet(rModel
.GetPool());
2109 aSet
.Put(pNewObj
->GetMergedItemSet());
2111 aSet
.ClearItem(EE_PARA_LRSPACE
);
2113 pNewObj
->SetMergedItemSet(aSet
);
2116 pUndoManager
->AddUndoAction( rModel
.GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj
) );
2118 // Remove outline shape from page
2119 rPage
.RemoveObject( pSourceObj
->GetOrdNum() );
2122 else if((eObjKind
== PresObjKind::Text
) && (pSourceObj
->GetObjIdentifier() == SdrObjKind::OutlineText
) )
2124 // is there an outline shape we can use to replace empty subtitle shape?
2125 pNewObj
= rPage
.CreatePresObj(PresObjKind::Text
, bVertical
, rRect
);
2127 // Set text of the outline object into PRESOBJ_TITLE
2128 OutlinerParaObject
* pOutlParaObj
= pSourceObj
->GetOutlinerParaObject();
2133 SdOutliner
* pOutl
= rModel
.GetInternalOutliner();
2135 pOutl
->SetText( *pOutlParaObj
);
2136 pNewObj
->SetOutlinerParaObject( pOutl
->CreateParaObject() );
2138 pNewObj
->SetEmptyPresObj(false);
2140 // reset left indent
2141 SfxItemSetFixed
<EE_PARA_LRSPACE
, EE_PARA_LRSPACE
> aSet(rModel
.GetPool());
2143 aSet
.Put(pNewObj
->GetMergedItemSet());
2145 const SvxLRSpaceItem
& rLRItem
= aSet
.Get(EE_PARA_LRSPACE
);
2146 SvxLRSpaceItem
aNewLRItem(rLRItem
);
2147 aNewLRItem
.SetTextLeft(0);
2148 aSet
.Put(aNewLRItem
);
2150 pNewObj
->SetMergedItemSet(aSet
);
2152 SfxStyleSheet
* pSheet
= rPage
.GetStyleSheetForPresObj(PresObjKind::Text
);
2154 pNewObj
->SetStyleSheet(pSheet
, true);
2156 // Remove subtitle shape from page
2158 pUndoManager
->AddUndoAction(rModel
.GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj
));
2160 rPage
.RemoveObject( pSourceObj
->GetOrdNum() );
2163 else if((eObjKind
== PresObjKind::Outline
) && (pSourceObj
->GetObjIdentifier() != SdrObjKind::OutlineText
) )
2165 switch( pSourceObj
->GetObjIdentifier() )
2167 case SdrObjKind::Table
: eObjKind
= PresObjKind::Table
; break;
2168 case SdrObjKind::Media
: eObjKind
= PresObjKind::Media
; break;
2169 case SdrObjKind::Graphic
: eObjKind
= PresObjKind::Graphic
; break;
2170 case SdrObjKind::OLE2
: eObjKind
= PresObjKind::Object
; break;
2178 /** reuses or creates a presentation shape for an auto layout that fits the given parameter
2181 The kind of presentation shape we like to have
2183 If > 1 we skip the first nIndex-1 shapes with the presentation shape kind eObjKind while
2184 looking for an existing presentation shape
2186 If true, the shape is created vertical if bInit is true
2188 The rectangle that should be used to transform the shape
2190 If true the shape is created if not found
2192 A presentation shape that was either found or created with the given parameters
2194 SdrObject
* SdPage::InsertAutoLayoutShape(SdrObject
* pObj1
, PresObjKind eObjKind
, bool bVertical
, const ::tools::Rectangle
& rRect
, bool bInit
)
2196 rtl::Reference
<SdrObject
> pObj
= pObj1
;
2197 SfxUndoManager
* pUndoManager(static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetUndoManager());
2198 const bool bUndo
= pUndoManager
&& pUndoManager
->IsInListAction() && IsInserted();
2202 pObj
= CreatePresObj(eObjKind
, bVertical
, rRect
);
2204 else if ( pObj
&& (pObj
->GetUserCall() || bInit
) )
2206 // convert object if shape type does not match kind (f.e. converting outline text to subtitle text)
2208 pObj
= convertPresentationObjectImpl(*this, pObj
.get(), eObjKind
, bVertical
, rRect
);
2212 pUndoManager
->AddUndoAction( getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoGeoObject( *pObj
) );
2213 pUndoManager
->AddUndoAction( getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoAttrObject( *pObj
, true, true ) );
2214 pUndoManager
->AddUndoAction( std::make_unique
<UndoObjectUserCall
>( *pObj
) );
2217 pObj
->AdjustToMaxRect(rRect
);
2219 pObj
->SetUserCall(this);
2221 SdrTextObj
* pTextObject
= DynCastSdrTextObj(pObj
.get());
2224 if( pTextObject
->IsVerticalWriting() != bVertical
)
2226 pTextObject
->SetVerticalWriting( bVertical
);
2228 // here make sure the correct anchoring is used when the object
2229 // is re-used but orientation is changed
2230 if(PresObjKind::Outline
== eObjKind
)
2231 pTextObject
->SetMergedItem(SdrTextHorzAdjustItem( bVertical
? SDRTEXTHORZADJUST_RIGHT
: SDRTEXTHORZADJUST_BLOCK
));
2234 if( !mbMaster
&& (pTextObject
->GetObjIdentifier() != SdrObjKind::Table
) )
2236 if ( pTextObject
->IsAutoGrowHeight() )
2238 // switch off AutoGrowHeight, set new MinHeight
2239 SfxItemSet
aTempAttr( static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetPool() );
2240 SdrMetricItem
aMinHeight( makeSdrTextMinFrameHeightItem(rRect
.GetSize().Height()) );
2241 aTempAttr
.Put( aMinHeight
);
2242 aTempAttr
.Put( makeSdrTextAutoGrowHeightItem(false) );
2243 pTextObject
->SetMergedItemSet(aTempAttr
);
2244 pTextObject
->SetLogicRect(rRect
);
2246 // switch on AutoGrowHeight
2247 SfxItemSet
aAttr( static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetPool() );
2248 aAttr
.Put( makeSdrTextAutoGrowHeightItem(true) );
2250 pTextObject
->SetMergedItemSet(aAttr
);
2253 if ( pTextObject
->IsAutoGrowWidth() )
2255 // switch off AutoGrowWidth , set new MinWidth
2256 SfxItemSet
aTempAttr( static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetPool() );
2257 SdrMetricItem
aMinWidth( makeSdrTextMinFrameWidthItem(rRect
.GetSize().Width()) );
2258 aTempAttr
.Put( aMinWidth
);
2259 aTempAttr
.Put( makeSdrTextAutoGrowWidthItem(false) );
2260 pTextObject
->SetMergedItemSet(aTempAttr
);
2261 pTextObject
->SetLogicRect(rRect
);
2263 // switch on AutoGrowWidth
2264 SfxItemSet
aAttr( static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetPool() );
2265 aAttr
.Put( makeSdrTextAutoGrowWidthItem(true) );
2266 pTextObject
->SetMergedItemSet(aAttr
);
2274 if( !IsPresObj( pObj
.get() ) )
2277 pUndoManager
->AddUndoAction( std::make_unique
<UndoObjectPresentationKind
>( *pObj
) );
2279 InsertPresObj( pObj
.get(), eObjKind
);
2282 // make adjustments for vertical title and outline shapes
2283 if( bVertical
&& (( eObjKind
== PresObjKind::Title
) || (eObjKind
== PresObjKind::Outline
)))
2285 SfxItemSet
aNewSet(pObj
->GetMergedItemSet());
2286 aNewSet
.Put( makeSdrTextAutoGrowWidthItem(true) );
2287 aNewSet
.Put( makeSdrTextAutoGrowHeightItem(false) );
2288 if( eObjKind
== PresObjKind::Outline
)
2290 aNewSet
.Put( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP
) );
2291 aNewSet
.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT
) );
2293 pObj
->SetMergedItemSet(aNewSet
);
2297 if ( pObj
&& (pObj
->GetUserCall() || bInit
) && ( pObj
->IsEmptyPresObj() || dynamic_cast< const SdrGrafObj
*>( pObj
.get() ) == nullptr ) )
2298 pObj
->AdjustToMaxRect(rRect
);
2303 /*************************************************************************
2305 |* Returns the PresObjKind of an object
2307 \************************************************************************/
2309 PresObjKind
SdPage::GetPresObjKind(SdrObject
* pObj
) const
2311 PresObjKind eKind
= PresObjKind::NONE
;
2312 if( (pObj
!= nullptr) && (maPresentationShapeList
.hasShape(*pObj
)) )
2314 SdAnimationInfo
* pInfo
= SdDrawDocument::GetShapeUserData(*pObj
);
2316 eKind
= pInfo
->mePresObjKind
;
2322 bool SdPage::IsPresObj(const SdrObject
* pObj
)
2324 return pObj
&& maPresentationShapeList
.hasShape( const_cast<SdrObject
&>(*pObj
) );
2327 void SdPage::RemovePresObj(const SdrObject
* pObj
)
2329 if( pObj
&& maPresentationShapeList
.hasShape(const_cast<SdrObject
&>(*pObj
)) )
2331 SdAnimationInfo
* pInfo
= SdDrawDocument::GetShapeUserData(const_cast<SdrObject
&>(*pObj
));
2333 pInfo
->mePresObjKind
= PresObjKind::NONE
;
2334 maPresentationShapeList
.removeShape(const_cast<SdrObject
&>(*pObj
));
2338 void SdPage::InsertPresObj(SdrObject
* pObj
, PresObjKind eKind
)
2340 DBG_ASSERT( pObj
, "sd::SdPage::InsertPresObj(), invalid presentation object inserted!" );
2341 DBG_ASSERT( !IsPresObj(pObj
), "sd::SdPage::InsertPresObj(), presentation object inserted twice!" );
2344 SdAnimationInfo
* pInfo
= SdDrawDocument::GetShapeUserData(*pObj
, true);
2346 pInfo
->mePresObjKind
= eKind
;
2347 maPresentationShapeList
.addShape(*pObj
);
2351 /*************************************************************************
2353 |* Set the text of an object
2355 \************************************************************************/
2357 void SdPage::SetObjText(SdrTextObj
* pObj
, SdrOutliner
* pOutliner
, PresObjKind eObjKind
, std::u16string_view rString
)
2362 ::Outliner
* pOutl
= pOutliner
;
2366 SfxItemPool
* pPool(static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).GetDrawOutliner().GetEmptyItemSet().GetPool());
2367 pOutl
= new ::Outliner( pPool
, OutlinerMode::OutlineObject
);
2368 pOutl
->SetRefDevice( SD_MOD()->GetVirtualRefDevice() );
2369 pOutl
->SetEditTextObjectPool(pPool
);
2370 pOutl
->SetStyleSheetPool(static_cast<SfxStyleSheetPool
*>(getSdrModelFromSdrPage().GetStyleSheetPool()));
2371 pOutl
->EnableUndo(false);
2372 pOutl
->SetUpdateLayout( false );
2375 OutlinerMode nOutlMode
= pOutl
->GetOutlinerMode();
2376 Size aPaperSize
= pOutl
->GetPaperSize();
2377 bool bUpdateMode
= pOutl
->SetUpdateLayout(false);
2378 pOutl
->SetParaAttribs( 0, pOutl
->GetEmptyItemSet() );
2380 // Always set the object's StyleSheet at the Outliner to
2381 // use the current objects StyleSheet. Thus it's the same as in
2383 // Moved this implementation from where SetObjText(...) was called
2384 // to inside this method to work even when outliner is fetched here.
2385 pOutl
->SetStyleSheet(0, pObj
->GetStyleSheet());
2391 case PresObjKind::Outline
:
2393 pOutl
->Init( OutlinerMode::OutlineObject
);
2395 aString
+= OUString::Concat("\t") + rString
;
2399 pOutl
->SetStyleSheet( 0, GetStyleSheetForPresObj(eObjKind
) );
2400 aString
+= "\n\t\t" +
2401 SdResId(STR_PRESOBJ_MPOUTLLAYER2
) +
2403 SdResId(STR_PRESOBJ_MPOUTLLAYER3
) +
2405 SdResId(STR_PRESOBJ_MPOUTLLAYER4
) +
2407 SdResId(STR_PRESOBJ_MPOUTLLAYER5
) +
2409 SdResId(STR_PRESOBJ_MPOUTLLAYER6
) +
2410 "\n\t\t\t\t\t\t\t" +
2411 SdResId(STR_PRESOBJ_MPOUTLLAYER7
);
2417 case PresObjKind::Title
:
2419 pOutl
->Init( OutlinerMode::TitleObject
);
2426 pOutl
->Init( OutlinerMode::TextObject
);
2429 // check if we need to add a text field
2430 std::unique_ptr
<SvxFieldData
> pData
;
2434 case PresObjKind::Header
:
2435 pData
.reset(new SvxHeaderField());
2437 case PresObjKind::Footer
:
2438 pData
.reset(new SvxFooterField());
2440 case PresObjKind::SlideNumber
:
2441 pData
.reset(new SvxPageField());
2443 case PresObjKind::DateTime
:
2444 pData
.reset(new SvxDateTimeField());
2453 SvxFieldItem
aField( *pData
, EE_FEATURE_FIELD
);
2454 pOutl
->QuickInsertField(aField
,e
);
2460 pOutl
->SetPaperSize( pObj
->GetLogicRect().GetSize() );
2462 if( !aString
.isEmpty() )
2463 pOutl
->SetText( aString
, pOutl
->GetParagraph( 0 ) );
2465 pObj
->SetOutlinerParaObject( pOutl
->CreateParaObject() );
2474 // restore the outliner
2475 pOutl
->Init( nOutlMode
);
2476 pOutl
->SetParaAttribs( 0, pOutl
->GetEmptyItemSet() );
2477 pOutl
->SetUpdateLayout( bUpdateMode
);
2478 pOutl
->SetPaperSize( aPaperSize
);
2482 /*************************************************************************
2484 |* Set the name of the layout
2486 \************************************************************************/
2487 void SdPage::SetLayoutName(const OUString
& aName
)
2489 maLayoutName
= aName
;
2493 sal_Int32 nPos
= maLayoutName
.indexOf(SD_LT_SEPARATOR
);
2495 FmFormPage::SetName(maLayoutName
.copy(0, nPos
));
2499 /*************************************************************************
2501 |* Return the page name and generates it if necessary
2503 \************************************************************************/
2505 const OUString
& SdPage::GetName() const
2507 OUString
aCreatedPageName( maCreatedPageName
);
2508 if (GetRealName().isEmpty())
2510 if ((mePageKind
== PageKind::Standard
|| mePageKind
== PageKind::Notes
) && !mbMaster
)
2512 // default name for handout pages
2513 sal_uInt16 nNum
= (GetPageNum() + 1) / 2;
2515 aCreatedPageName
= SdResId(STR_PAGE
) + " ";
2516 if (static_cast<SdDrawDocument
&>(getSdrModelFromSdrPage()).GetDocumentType() == DocumentType::Draw
)
2517 aCreatedPageName
= SdResId(STR_PAGE_NAME
) + " ";
2519 if( getSdrModelFromSdrPage().GetPageNumType() == css::style::NumberingType::NUMBER_NONE
)
2521 // if the document has number none as a formatting
2522 // for page numbers we still default to arabic numbering
2523 // to keep the default page names unique
2524 aCreatedPageName
+= OUString::number( static_cast<sal_Int32
>(nNum
) );
2528 aCreatedPageName
+= static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).CreatePageNumValue(nNum
);
2533 /******************************************************************
2534 * default name for note pages
2535 ******************************************************************/
2536 aCreatedPageName
= SdResId(STR_LAYOUT_DEFAULT_NAME
);
2541 aCreatedPageName
= GetRealName();
2544 if (mePageKind
== PageKind::Notes
)
2546 aCreatedPageName
+= " " + SdResId(STR_NOTES
);
2548 else if (mePageKind
== PageKind::Handout
&& mbMaster
)
2550 aCreatedPageName
+= " (" + SdResId(STR_HANDOUT
) + ")";
2553 const_cast< SdPage
* >(this)->maCreatedPageName
= aCreatedPageName
;
2554 return maCreatedPageName
;
2557 void SdPage::SetOrientation( Orientation
/*eOrient*/)
2562 Orientation
SdPage::GetOrientation() const
2564 Size aSize
= GetSize();
2565 if ( aSize
.getWidth() > aSize
.getHeight() )
2567 return Orientation::Landscape
;
2571 return Orientation::Portrait
;
2575 /*************************************************************************
2577 |* returns the default text of a PresObjektes
2579 \************************************************************************/
2581 OUString
SdPage::GetPresObjText(PresObjKind eObjKind
) const
2585 #if defined(IOS) || defined(ANDROID)
2586 bool isMobileDevice
= true;
2588 bool isMobileDevice
= false;
2589 if (const SfxViewShell
* pCurrentViewShell
= SfxViewShell::Current())
2590 isMobileDevice
= pCurrentViewShell
->isLOKMobilePhone() || pCurrentViewShell
->isLOKTablet();
2593 if (eObjKind
== PresObjKind::Title
)
2597 if (mePageKind
!= PageKind::Notes
)
2600 aString
= SdResId(STR_PRESOBJ_MPTITLE_MOBILE
);
2602 aString
= SdResId(STR_PRESOBJ_MPTITLE
);
2607 aString
= SdResId(STR_PRESOBJ_MPNOTESTITLE_MOBILE
);
2609 aString
= SdResId(STR_PRESOBJ_MPNOTESTITLE
);
2612 else if (isMobileDevice
)
2613 aString
= SdResId(STR_PRESOBJ_TITLE_MOBILE
);
2615 aString
= SdResId(STR_PRESOBJ_TITLE
);
2617 else if (eObjKind
== PresObjKind::Outline
)
2622 aString
= SdResId(STR_PRESOBJ_MPOUTLINE_MOBILE
);
2624 aString
= SdResId(STR_PRESOBJ_MPOUTLINE
);
2626 else if (isMobileDevice
)
2627 aString
= SdResId(STR_PRESOBJ_OUTLINE_MOBILE
);
2629 aString
= SdResId(STR_PRESOBJ_OUTLINE
);
2631 else if (eObjKind
== PresObjKind::Notes
)
2636 aString
= SdResId(STR_PRESOBJ_MPNOTESTEXT_MOBILE
);
2638 aString
= SdResId(STR_PRESOBJ_MPNOTESTEXT
);
2640 else if (isMobileDevice
)
2641 aString
= SdResId(STR_PRESOBJ_NOTESTEXT_MOBILE
);
2643 aString
= SdResId(STR_PRESOBJ_NOTESTEXT
);
2645 else if (eObjKind
== PresObjKind::Text
)
2648 aString
= SdResId(STR_PRESOBJ_TEXT_MOBILE
);
2650 aString
= SdResId(STR_PRESOBJ_TEXT
);
2652 else if (eObjKind
== PresObjKind::Graphic
)
2654 aString
= SdResId( STR_PRESOBJ_GRAPHIC
);
2656 else if (eObjKind
== PresObjKind::Object
)
2658 aString
= SdResId( STR_PRESOBJ_OBJECT
);
2660 else if (eObjKind
== PresObjKind::Chart
)
2662 aString
= SdResId( STR_PRESOBJ_CHART
);
2664 else if (eObjKind
== PresObjKind::OrgChart
)
2666 aString
= SdResId( STR_PRESOBJ_ORGCHART
);
2668 else if (eObjKind
== PresObjKind::Calc
)
2670 aString
= SdResId( STR_PRESOBJ_TABLE
);
2676 uno::Reference
< uno::XInterface
> SdPage::createUnoPage()
2678 return createUnoPageImpl( this );
2681 /** returns the SdPage implementation for the given XDrawPage or 0 if not available */
2682 SdPage
* SdPage::getImplementation( const css::uno::Reference
< css::drawing::XDrawPage
>& xPage
)
2686 auto pUnoPage
= comphelper::getFromUnoTunnel
<SvxDrawPage
>(xPage
);
2688 return static_cast< SdPage
* >( pUnoPage
->GetSdrPage() );
2690 catch( css::uno::Exception
& )
2692 TOOLS_WARN_EXCEPTION( "sd", "sd::SdPage::getImplementation()" );
2698 sal_Int64
SdPage::GetHashCode() const
2700 return sal::static_int_cast
<sal_Int64
>(reinterpret_cast<sal_IntPtr
>(this));
2703 void SdPage::SetName (const OUString
& rName
)
2705 OUString
aOldName( GetName() );
2706 FmFormPage::SetName (rName
);
2707 static_cast< SdDrawDocument
& >(getSdrModelFromSdrPage()).UpdatePageRelativeURLs(aOldName
, rName
);
2711 const HeaderFooterSettings
& SdPage::getHeaderFooterSettings() const
2713 if( mePageKind
== PageKind::Handout
&& !mbMaster
)
2715 return static_cast<SdPage
&>(TRG_GetMasterPage()).maHeaderFooterSettings
;
2719 return maHeaderFooterSettings
;
2723 void SdPage::setHeaderFooterSettings( const sd::HeaderFooterSettings
& rNewSettings
)
2725 if( mePageKind
== PageKind::Handout
&& !mbMaster
)
2727 static_cast<SdPage
&>(TRG_GetMasterPage()).maHeaderFooterSettings
= rNewSettings
;
2731 maHeaderFooterSettings
= rNewSettings
;
2736 if(!TRG_HasMasterPage())
2739 TRG_GetMasterPageDescriptorViewContact().ActionChanged();
2741 // #i119056# For HeaderFooterSettings SdrObjects are used, but the properties
2742 // used are not part of their model data, but kept in SD. This data is applied
2743 // using a 'backdoor' on primitive creation. Thus, the normal mechanism to detect
2744 // object changes does not work here. It is necessary to trigger updates here
2745 // directly. BroadcastObjectChange used for PagePreview invalidations,
2746 // flushViewObjectContacts used to invalidate and flush all visualizations in
2748 SdPage
* pMasterPage
= dynamic_cast< SdPage
* >(&TRG_GetMasterPage());
2753 SdrObject
* pCandidate
= pMasterPage
->GetPresObj( PresObjKind::Header
);
2757 pCandidate
->BroadcastObjectChange();
2758 pCandidate
->GetViewContact().flushViewObjectContacts();
2761 pCandidate
= pMasterPage
->GetPresObj( PresObjKind::DateTime
);
2765 pCandidate
->BroadcastObjectChange();
2766 pCandidate
->GetViewContact().flushViewObjectContacts();
2769 pCandidate
= pMasterPage
->GetPresObj( PresObjKind::Footer
);
2773 pCandidate
->BroadcastObjectChange();
2774 pCandidate
->GetViewContact().flushViewObjectContacts();
2777 pCandidate
= pMasterPage
->GetPresObj( PresObjKind::SlideNumber
);
2781 pCandidate
->BroadcastObjectChange();
2782 pCandidate
->GetViewContact().flushViewObjectContacts();
2786 bool SdPage::checkVisibility(
2787 const sdr::contact::ViewObjectContact
& rOriginal
,
2788 const sdr::contact::DisplayInfo
& rDisplayInfo
,
2791 if( !FmFormPage::checkVisibility( rOriginal
, rDisplayInfo
, bEdit
) )
2794 SdrObject
* pObj
= rOriginal
.GetViewContact().TryToGetSdrObject();
2795 if( pObj
== nullptr )
2798 const SdrPage
* pVisualizedPage
= GetSdrPageFromXDrawPage(rOriginal
.GetObjectContact().getViewInformation2D().getVisualizedPage());
2799 const bool bIsPrinting(rOriginal
.GetObjectContact().isOutputToPrinter() || rOriginal
.GetObjectContact().isOutputToPDFFile());
2800 const SdrPageView
* pPageView
= rOriginal
.GetObjectContact().TryToGetSdrPageView();
2801 const bool bIsInsidePageObj(pPageView
&& pPageView
->GetPage() != pVisualizedPage
);
2803 // empty presentation objects only visible during edit mode
2804 if( (bIsPrinting
|| !bEdit
|| bIsInsidePageObj
) && pObj
->IsEmptyPresObj() )
2806 if( (pObj
->GetObjInventor() != SdrInventor::Default
) || ( (pObj
->GetObjIdentifier() != SdrObjKind::Rectangle
) && (pObj
->GetObjIdentifier() != SdrObjKind::Page
) ) )
2810 if( ( pObj
->GetObjInventor() == SdrInventor::Default
) && ( pObj
->GetObjIdentifier() == SdrObjKind::Text
) )
2812 const SdPage
* pCheckPage
= dynamic_cast< const SdPage
* >(pObj
->getSdrPageFromSdrObject());
2816 PresObjKind eKind
= pCheckPage
->GetPresObjKind(pObj
);
2818 if((eKind
== PresObjKind::Footer
) || (eKind
== PresObjKind::Header
) || (eKind
== PresObjKind::DateTime
) || (eKind
== PresObjKind::SlideNumber
) )
2820 const bool bSubContentProcessing(rDisplayInfo
.GetSubContentActive());
2822 if( bSubContentProcessing
|| ( pCheckPage
->GetPageKind() == PageKind::Handout
&& bIsPrinting
) )
2824 // use the page that is currently processed
2825 const SdPage
* pVisualizedSdPage
= dynamic_cast< const SdPage
* >(pVisualizedPage
);
2827 if( pVisualizedSdPage
)
2829 // if we are not on a masterpage, see if we have to draw this header&footer object at all
2830 const sd::HeaderFooterSettings
& rSettings
= pVisualizedSdPage
->getHeaderFooterSettings();
2834 case PresObjKind::Footer
:
2835 return rSettings
.mbFooterVisible
;
2836 case PresObjKind::Header
:
2837 return rSettings
.mbHeaderVisible
;
2838 case PresObjKind::DateTime
:
2839 return rSettings
.mbDateTimeVisible
;
2840 case PresObjKind::SlideNumber
:
2841 return rSettings
.mbSlideNumberVisible
;
2847 } // check for placeholders on master
2848 else if( (eKind
!= PresObjKind::NONE
) && pCheckPage
->IsMasterPage() && ( pVisualizedPage
!= pCheckPage
) )
2850 // presentation objects on master slide are always invisible if slide is shown.
2856 // i63977, do not print SdrpageObjs from master pages
2857 if( ( pObj
->GetObjInventor() == SdrInventor::Default
) && ( pObj
->GetObjIdentifier() == SdrObjKind::Page
) )
2859 if( pObj
->getSdrPageFromSdrObject() && pObj
->getSdrPageFromSdrObject()->IsMasterPage() )
2866 bool SdPage::RestoreDefaultText( SdrObject
* pObj
)
2870 SdrTextObj
* pTextObj
= DynCastSdrTextObj( pObj
);
2874 PresObjKind ePresObjKind
= GetPresObjKind(pTextObj
);
2876 if (ePresObjKind
== PresObjKind::Title
||
2877 ePresObjKind
== PresObjKind::Outline
||
2878 ePresObjKind
== PresObjKind::Notes
||
2879 ePresObjKind
== PresObjKind::Text
)
2881 OUString
aString( GetPresObjText(ePresObjKind
) );
2883 if (!aString
.isEmpty())
2885 bool bVertical
= false;
2886 OutlinerParaObject
* pOldPara
= pTextObj
->GetOutlinerParaObject();
2888 bVertical
= pOldPara
->IsEffectivelyVertical(); // is old para object vertical?
2890 SetObjText( pTextObj
, nullptr, ePresObjKind
, aString
);
2894 // Here, only the vertical flag for the
2895 // OutlinerParaObjects needs to be changed. The
2896 // AutoGrowWidth/Height items still exist in the
2897 // not changed object.
2898 if(pTextObj
->GetOutlinerParaObject()
2899 && pTextObj
->GetOutlinerParaObject()->IsEffectivelyVertical() != bVertical
)
2901 ::tools::Rectangle aObjectRect
= pTextObj
->GetSnapRect();
2902 pTextObj
->GetOutlinerParaObject()->SetVertical(bVertical
);
2903 pTextObj
->SetSnapRect(aObjectRect
);
2907 pTextObj
->SetTextEditOutliner( nullptr ); // to make stylesheet settings work
2908 pTextObj
->NbcSetStyleSheet( GetStyleSheetForPresObj(ePresObjKind
), true );
2909 pTextObj
->SetEmptyPresObj(true);
2917 void SdPage::CalculateHandoutAreas( SdDrawDocument
& rModel
, AutoLayout eLayout
, bool bHorizontal
, std::vector
< ::tools::Rectangle
>& rAreas
)
2919 SdPage
& rHandoutMaster
= *rModel
.GetMasterSdPage( 0, PageKind::Handout
);
2921 static const sal_uInt16 aOffsets
[5][9] =
2923 { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, // AUTOLAYOUT_HANDOUT9, Portrait, Horizontal order
2924 { 0, 2, 4, 1, 3, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT3, Landscape, Vertical
2925 { 0, 2, 1, 3, 0, 0, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Landscape, Vertical
2926 { 0, 3, 1, 4, 2, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Portrait, Vertical
2927 { 0, 3, 6, 1, 4, 7, 2, 5, 8 }, // AUTOLAYOUT_HANDOUT9, Landscape, Vertical
2930 const sal_uInt16
* pOffsets
= aOffsets
[0];
2932 Size aArea
= rHandoutMaster
.GetSize();
2933 const bool bLandscape
= aArea
.Width() > aArea
.Height();
2935 if( eLayout
== AUTOLAYOUT_NONE
)
2937 // use layout from handout master
2938 SdrObjListIter
aShapeIter(&rHandoutMaster
);
2940 std::vector
< ::tools::Rectangle
> vSlidesAreas
;
2941 while ( aShapeIter
.IsMore() )
2943 SdrPageObj
* pPageObj
= dynamic_cast<SdrPageObj
*>( aShapeIter
.Next() );
2944 // get slide rectangles
2946 vSlidesAreas
.push_back( pPageObj
->GetCurrentBoundRect() );
2949 if ( !bHorizontal
|| vSlidesAreas
.size() < 4 )
2950 { // top to bottom, then right
2951 rAreas
.swap( vSlidesAreas
);
2954 { // left to right, then down
2955 switch ( vSlidesAreas
.size() )
2958 pOffsets
= aOffsets
[2];
2964 pOffsets
= aOffsets
[ bLandscape
? 3 : 1 ];
2968 pOffsets
= aOffsets
[4];
2972 rAreas
.resize( static_cast<size_t>(vSlidesAreas
.size()) );
2974 for( const ::tools::Rectangle
& rRect
: vSlidesAreas
)
2976 rAreas
[*pOffsets
++] = rRect
;
2982 const ::tools::Long nGapW
= 1000; // gap is 1cm
2983 const ::tools::Long nGapH
= 1000;
2985 ::tools::Long nLeftBorder
= rHandoutMaster
.GetLeftBorder();
2986 ::tools::Long nRightBorder
= rHandoutMaster
.GetRightBorder();
2987 ::tools::Long nTopBorder
= rHandoutMaster
.GetUpperBorder();
2988 ::tools::Long nBottomBorder
= rHandoutMaster
.GetLowerBorder();
2990 const ::tools::Long nHeaderFooterHeight
= static_cast< ::tools::Long
>( (aArea
.Height() - nTopBorder
- nLeftBorder
) * 0.05 );
2992 nTopBorder
+= nHeaderFooterHeight
;
2993 nBottomBorder
+= nHeaderFooterHeight
;
2995 ::tools::Long nX
= nGapW
+ nLeftBorder
;
2996 ::tools::Long nY
= nGapH
+ nTopBorder
;
2998 aArea
.AdjustWidth( -(nGapW
* 2 + nLeftBorder
+ nRightBorder
) );
2999 aArea
.AdjustHeight( -(nGapH
* 2 + nTopBorder
+ nBottomBorder
) );
3001 sal_uInt16 nColCnt
= 0, nRowCnt
= 0;
3004 case AUTOLAYOUT_HANDOUT1
:
3005 nColCnt
= 1; nRowCnt
= 1;
3008 case AUTOLAYOUT_HANDOUT2
:
3011 nColCnt
= 2; nRowCnt
= 1;
3015 nColCnt
= 1; nRowCnt
= 2;
3019 case AUTOLAYOUT_HANDOUT3
:
3022 nColCnt
= 3; nRowCnt
= 2;
3026 nColCnt
= 2; nRowCnt
= 3;
3028 pOffsets
= aOffsets
[ bLandscape
? 1 : 0 ];
3031 case AUTOLAYOUT_HANDOUT4
:
3032 nColCnt
= 2; nRowCnt
= 2;
3033 pOffsets
= aOffsets
[ bHorizontal
? 0 : 2 ];
3036 case AUTOLAYOUT_HANDOUT6
:
3039 nColCnt
= 3; nRowCnt
= 2;
3043 nColCnt
= 2; nRowCnt
= 3;
3046 pOffsets
= aOffsets
[ bLandscape
? 1 : 3 ];
3050 case AUTOLAYOUT_HANDOUT9
:
3051 nColCnt
= 3; nRowCnt
= 3;
3054 pOffsets
= aOffsets
[4];
3058 rAreas
.resize(static_cast<size_t>(nColCnt
) * nRowCnt
);
3060 Size aPartArea
, aSize
;
3061 aPartArea
.setWidth( (aArea
.Width() - ((nColCnt
-1) * nGapW
) ) / nColCnt
);
3062 aPartArea
.setHeight( (aArea
.Height() - ((nRowCnt
-1) * nGapH
) ) / nRowCnt
);
3064 SdrPage
* pFirstPage
= rModel
.GetMasterSdPage(0, PageKind::Standard
);
3065 if (pFirstPage
&& pFirstPage
->GetWidth() && pFirstPage
->GetHeight())
3067 // scale actual size into handout rect
3068 double fScale
= static_cast<double>(aPartArea
.Width()) / static_cast<double>(pFirstPage
->GetWidth());
3070 aSize
.setHeight( static_cast<::tools::Long
>(fScale
* pFirstPage
->GetHeight() ) );
3071 if( aSize
.Height() > aPartArea
.Height() )
3073 fScale
= static_cast<double>(aPartArea
.Height()) / static_cast<double>(pFirstPage
->GetHeight());
3074 aSize
.setHeight( aPartArea
.Height() );
3075 aSize
.setWidth( static_cast<::tools::Long
>(fScale
* pFirstPage
->GetWidth()) );
3079 aSize
.setWidth( aPartArea
.Width() );
3082 nX
+= (aPartArea
.Width() - aSize
.Width()) / 2;
3083 nY
+= (aPartArea
.Height()- aSize
.Height())/ 2;
3090 Point
aPos( nX
, nY
);
3092 const bool bRTL
= rModel
.GetDefaultWritingMode() == css::text::WritingMode_RL_TB
;
3094 const ::tools::Long nOffsetX
= (aPartArea
.Width() + nGapW
) * (bRTL
? -1 : 1);
3095 const ::tools::Long nOffsetY
= aPartArea
.Height() + nGapH
;
3096 const ::tools::Long nStartX
= bRTL
? nOffsetX
*(1 - nColCnt
) + nX
: nX
;
3098 for(sal_uInt16 nRow
= 0; nRow
< nRowCnt
; nRow
++)
3100 aPos
.setX( nStartX
);
3101 for(sal_uInt16 nCol
= 0; nCol
< nColCnt
; nCol
++)
3103 rAreas
[*pOffsets
++] = ::tools::Rectangle(aPos
, aSize
);
3104 aPos
.AdjustX(nOffsetX
);
3107 aPos
.AdjustY(nOffsetY
);
3112 void SdPage::SetPrecious (const bool bIsPrecious
)
3114 mbIsPrecious
= bIsPrecious
;
3117 HeaderFooterSettings::HeaderFooterSettings()
3119 mbHeaderVisible
= true;
3120 mbFooterVisible
= true;
3121 mbSlideNumberVisible
= false;
3122 mbDateTimeVisible
= true;
3123 mbDateTimeIsFixed
= true;
3124 meDateFormat
= SvxDateFormat::A
;
3125 meTimeFormat
= SvxTimeFormat::AppDefault
;
3128 bool HeaderFooterSettings::operator==( const HeaderFooterSettings
& rSettings
) const
3130 return (mbHeaderVisible
== rSettings
.mbHeaderVisible
) &&
3131 (maHeaderText
== rSettings
.maHeaderText
) &&
3132 (mbFooterVisible
== rSettings
.mbFooterVisible
) &&
3133 (maFooterText
== rSettings
.maFooterText
) &&
3134 (mbSlideNumberVisible
== rSettings
.mbSlideNumberVisible
) &&
3135 (mbDateTimeVisible
== rSettings
.mbDateTimeVisible
) &&
3136 (mbDateTimeIsFixed
== rSettings
.mbDateTimeIsFixed
) &&
3137 (meDateFormat
== rSettings
.meDateFormat
) &&
3138 (meTimeFormat
== rSettings
.meTimeFormat
) &&
3139 (maDateTimeText
== rSettings
.maDateTimeText
);
3142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */