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 .
20 #ifndef INCLUDED_SD_INC_SDPAGE_HXX
21 #define INCLUDED_SD_INC_SDPAGE_HXX
23 #include <boost/shared_ptr.hpp>
26 #include <com/sun/star/drawing/XDrawPage.hpp>
27 #include <com/sun/star/presentation/FadeEffect.hpp>
28 #include <com/sun/star/office/XAnnotation.hpp>
32 #include <svx/svdobj.hxx>
33 #include <svx/fmpage.hxx>
37 #include "shapelist.hxx"
38 #include "misc/scopelock.hxx"
41 namespace com
{ namespace sun
{ namespace star
{ namespace animations
{
51 struct StyleRequestData
;
64 template<class X
> class shared_ptr
;
69 struct SD_DLLPUBLIC HeaderFooterSettings
72 OUString maHeaderText
;
75 OUString maFooterText
;
77 bool mbSlideNumberVisible
;
79 bool mbDateTimeVisible
;
80 bool mbDateTimeIsFixed
;
81 OUString maDateTimeText
;
84 HeaderFooterSettings();
86 bool operator==( const HeaderFooterSettings
& rSettings
) const;
89 typedef std::vector
< ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> > AnnotationVector
;
99 class SD_DLLPUBLIC SdPage
: public FmFormPage
, public SdrObjUserCall
101 SdPage
& operator=(const SdPage
&) SAL_DELETED_FUNCTION
;
103 friend class SdGenericDrawPage
;
104 friend class SdDrawPage
;
105 friend class sd::UndoAnimation
;
106 friend class sd::UndoTransition
;
107 friend class ModifyPageUndoAction
;
108 friend class sd::UndoGeoObject
;
109 friend class sd::UndoAttrObject
;
112 PageKind mePageKind
; ///< page type
113 AutoLayout meAutoLayout
; ///< AutoLayout
114 sd::ShapeList maPresentationShapeList
;///< presentation objects
115 sd::ScopeLock maLockAutoLayoutArrangement
;
116 bool mbSelected
; ///< selection identifier
117 PresChange mePresChange
; ///< manual / automatic / semi automatic
118 double mfTime
; ///< Display time in seconds
119 bool mbSoundOn
; ///< with / without sound.
120 bool mbExcluded
; ///< will (not) be displayed during show.
121 OUString maLayoutName
; ///< Name of the layout
122 OUString maSoundFile
; ///< Path to sound file (MSDOS notation).
125 OUString maCreatedPageName
; ///< generated page name by GetPageName.
126 OUString maFileName
; ///< file name.
127 OUString maBookmarkName
; ///< Bookmark name.
128 bool mbScaleObjects
; ///< Objects should be scaled
129 bool mbBackgroundFullSize
; ///< Background object to represent the whole page.
130 rtl_TextEncoding meCharSet
; ///< Text encoding
131 sal_uInt16 mnPaperBin
; ///< PaperBin
132 Orientation meOrientation
; ///< Print orientation.
133 SdPageLink
* mpPageLink
; ///< Page link (at left sides only)
135 sd::AnnotationVector maAnnotations
;
137 /** holds the smil animation sequences for this page */
138 ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> mxAnimationNode
;
140 /** a helper class to manipulate effects inside the main sequence */
141 boost::shared_ptr
< sd::MainSequence
> mpMainSequence
;
143 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> createUnoPage() SAL_OVERRIDE
;
147 SfxItemSet
* getOrCreateItems();
149 sd::HeaderFooterSettings maHeaderFooterSettings
;
151 // new transition settings
152 sal_Int16 mnTransitionType
;
153 sal_Int16 mnTransitionSubtype
;
154 bool mbTransitionDirection
;
155 sal_Int32 mnTransitionFadeColor
;
156 double mfTransitionDuration
;
158 SdPage(const SdPage
& rSrcPage
);
159 void lateInit(const SdPage
& rSrcPage
);
164 SdPage(SdDrawDocument
& rNewDoc
, bool bMasterPage
=false);
166 virtual SdrPage
* Clone() const SAL_OVERRIDE
;
167 virtual SdrPage
* Clone(SdrModel
* pNewModel
) const SAL_OVERRIDE
;
169 virtual void SetSize(const Size
& aSize
) SAL_OVERRIDE
;
170 virtual void SetBorder(sal_Int32 nLft
, sal_Int32 nUpp
, sal_Int32 nRgt
, sal_Int32 Lwr
) SAL_OVERRIDE
;
171 virtual void SetLftBorder(sal_Int32 nBorder
) SAL_OVERRIDE
;
172 virtual void SetRgtBorder(sal_Int32 nBorder
) SAL_OVERRIDE
;
173 virtual void SetUppBorder(sal_Int32 nBorder
) SAL_OVERRIDE
;
174 virtual void SetLwrBorder(sal_Int32 nBorder
) SAL_OVERRIDE
;
175 virtual void SetModel(SdrModel
* pNewModel
) SAL_OVERRIDE
;
176 virtual bool IsReadOnly() const SAL_OVERRIDE
;
178 sd::ShapeList
& GetPresentationShapeList() { return maPresentationShapeList
; }
180 void EnsureMasterPageDefaultBackground();
181 SdrObject
* CreatePresObj(PresObjKind eObjKind
, bool bVertical
, const Rectangle
& rRect
, bool bInsert
=false);
182 SdrObject
* CreateDefaultPresObj(PresObjKind eObjKind
, bool bInsert
);
183 void DestroyDefaultPresObj(PresObjKind eObjKind
);
184 SdrObject
* GetPresObj(PresObjKind eObjKind
, int nIndex
= 1, bool bFuzzySearch
= false );
185 PresObjKind
GetPresObjKind(SdrObject
* pObj
) const;
186 OUString
GetPresObjText(PresObjKind eObjKind
) const;
187 SfxStyleSheet
* GetStyleSheetForMasterPageBackground() const;
188 SfxStyleSheet
* GetStyleSheetForPresObj(PresObjKind eObjKind
) const;
189 bool RestoreDefaultText( SdrObject
* pObj
);
191 /** @return true if the given SdrObject is inside the presentation object list */
192 bool IsPresObj(const SdrObject
* pObj
);
194 /** removes the given SdrObject from the presentation object list */
195 void RemovePresObj(const SdrObject
* pObj
);
197 /** inserts the given SdrObject into the presentation object list */
198 void InsertPresObj(SdrObject
* pObj
, PresObjKind eKind
);
200 void SetAutoLayout(AutoLayout eLayout
, bool bInit
=false, bool bCreate
=false);
201 AutoLayout
GetAutoLayout() const { return meAutoLayout
; }
202 void CreateTitleAndLayout(bool bInit
=false, bool bCreate
=false);
203 SdrObject
* InsertAutoLayoutShape(SdrObject
* pObj
, PresObjKind eObjKind
, bool bVertical
, const Rectangle
& rRect
, bool bInit
);
205 virtual void NbcInsertObject(SdrObject
* pObj
, size_t nPos
=SAL_MAX_SIZE
,
206 const SdrInsertReason
* pReason
=NULL
) SAL_OVERRIDE
;
207 virtual SdrObject
* NbcRemoveObject(size_t nObjNum
) SAL_OVERRIDE
;
208 virtual SdrObject
* RemoveObject(size_t nObjNum
) SAL_OVERRIDE
;
210 /** Also override ReplaceObject methods to realize when
211 objects are removed with this mechanism instead of RemoveObject*/
212 virtual SdrObject
* NbcReplaceObject(SdrObject
* pNewObj
, size_t nObjNum
) SAL_OVERRIDE
;
213 virtual SdrObject
* ReplaceObject(SdrObject
* pNewObj
, size_t nObjNum
) SAL_OVERRIDE
;
215 void SetObjText(SdrTextObj
* pObj
, SdrOutliner
* pOutliner
, PresObjKind eObjKind
, const OUString
& rStr
);
217 void SetPageKind(PageKind ePgType
) { mePageKind
= ePgType
; }
218 PageKind
GetPageKind() const { return mePageKind
; }
220 void SetSelected(bool bSel
) { mbSelected
= bSel
; }
221 bool IsSelected() const { return mbSelected
; }
223 void SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect
);
224 ::com::sun::star::presentation::FadeEffect
GetFadeEffect() const;
226 void SetPresChange(PresChange eChange
) { mePresChange
= eChange
; }
227 PresChange
GetPresChange() const { return mePresChange
; }
229 void SetTime(double fNewTime
) { mfTime
= fNewTime
; }
230 double GetTime() const { return mfTime
; }
232 void SetSound(bool bNewSoundOn
) { mbSoundOn
= bNewSoundOn
; }
233 bool IsSoundOn() const { return mbSoundOn
; }
235 void SetExcluded(bool bNewExcluded
) { mbExcluded
= bNewExcluded
; }
236 bool IsExcluded() const { return mbExcluded
; }
238 void SetScaleObjects(bool bScale
) { mbScaleObjects
= bScale
; }
239 bool IsScaleObjects() const { return mbScaleObjects
; }
241 void SetSoundFile(const OUString
& rStr
) { maSoundFile
= rStr
; }
242 OUString
GetSoundFile() const { return maSoundFile
; }
244 void SetLoopSound( bool bLoopSound
) { mbLoopSound
= bLoopSound
; }
245 bool IsLoopSound() const { return mbLoopSound
; }
247 void SetStopSound( bool bStopSound
) { mbStopSound
= bStopSound
; }
248 bool IsStopSound() const { return mbStopSound
; }
250 sal_Int16
getTransitionType() const { return mnTransitionType
;}
251 void setTransitionType( sal_Int16 nTransitionType
);
253 sal_Int16
getTransitionSubtype() const { return mnTransitionSubtype
;}
254 void setTransitionSubtype( sal_Int16 nTransitionSubtype
);
256 bool getTransitionDirection() const { return mbTransitionDirection
;}
257 void setTransitionDirection( bool bTransitionbDirection
);
259 sal_Int32
getTransitionFadeColor() const { return mnTransitionFadeColor
;}
260 void setTransitionFadeColor( sal_Int32 nTransitionFadeColor
);
262 double getTransitionDuration() const { return mfTransitionDuration
;}
263 void setTransitionDuration( double fTranstionDuration
);
265 virtual void Changed(const SdrObject
& rObj
, SdrUserCallType eType
,
266 const Rectangle
& rOldBoundRect
) SAL_OVERRIDE
;
268 void SetLayoutName(const OUString
& aName
);
269 virtual OUString
GetLayoutName() const SAL_OVERRIDE
{ return maLayoutName
; }
271 void SetFileName(const OUString
& aName
) { maFileName
= aName
; }
272 OUString
GetFileName() const { return maFileName
; }
273 void SetBookmarkName(const OUString
& aName
) { maBookmarkName
= aName
; }
274 OUString
GetBookmarkName() const { return maBookmarkName
; }
275 SdPageLink
* GetLink() { return mpPageLink
; }
278 void DisconnectLink();
280 void ScaleObjects(const Size
& rNewPageSize
, const Rectangle
& rNewBorderRect
,
283 const OUString
& GetName() const;
284 OUString
GetRealName() const { return FmFormPage::GetName(); };
286 void SetPresentationLayout(const OUString
& rLayoutName
,
287 bool bReplaceStyleSheets
= true,
288 bool bSetMasterPage
= true,
289 bool bReverseOrder
= false);
290 void EndListenOutlineText();
292 void SetBackgroundFullSize( bool bIn
);
293 bool IsBackgroundFullSize() const { return mbBackgroundFullSize
; }
295 rtl_TextEncoding
GetCharSet() { return meCharSet
; }
297 void SetPaperBin(sal_uInt16 nBin
) { mnPaperBin
= nBin
; }
298 sal_uInt16
GetPaperBin() const { return mnPaperBin
; }
299 virtual void SetOrientation(Orientation eOrient
) SAL_OVERRIDE
;
300 virtual Orientation
GetOrientation() const SAL_OVERRIDE
;
302 virtual SfxStyleSheet
* GetTextStyleSheetForObject( SdrObject
* pObj
) const SAL_OVERRIDE
;
304 bool setAlienAttributes( const com::sun::star::uno::Any
& rAttributes
);
305 void getAlienAttributes( com::sun::star::uno::Any
& rAttributes
);
307 /** @return the main animation node */
308 ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> getAnimationNode() throw (::com::sun::star::uno::RuntimeException
);
310 /** sets the main animation node */
311 void setAnimationNode( ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
) throw (::com::sun::star::uno::RuntimeException
);
313 /// @return a helper class to manipulate effects inside the main sequence
314 boost::shared_ptr
< sd::MainSequence
> getMainSequence();
316 /** quick check if this slide has an animation node.
317 This can be used to have a cost free check if there are no animations ad this slide.
318 If it returns true this does not mean that there are animations available.
320 bool hasAnimationNode() const;
322 /// @return the SdPage implementation for the given XDrawPage or 0 if not available
323 static SdPage
* getImplementation( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& xPage
);
325 /** removes all custom animations for the given shape */
326 void removeAnimations( const SdrObject
* pObj
);
328 /** Set the name of the page and broadcast a model change.
330 void SetName (const OUString
& rName
);
332 const sd::HeaderFooterSettings
& getHeaderFooterSettings() const;
333 void setHeaderFooterSettings( const sd::HeaderFooterSettings
& rNewSettings
);
336 @return true if the object from the ViewObjectContact should
337 be visible on this page while rendering.
339 bEdit selects if visibility test is for an editing view or a final render,
342 virtual bool checkVisibility(
343 const sdr::contact::ViewObjectContact
& rOriginal
,
344 const sdr::contact::DisplayInfo
& rDisplayInfo
,
345 bool bEdit
) SAL_OVERRIDE
;
347 /** callback from the sd::View when a new paragraph for one object on this page is created */
348 void onParagraphInserted( ::Outliner
* pOutliner
, Paragraph
* pPara
, SdrObject
* pObj
);
350 /** callback from the sd::View when a paragraph from one object on this page is removed */
351 void onParagraphRemoving( ::Outliner
* pOutliner
, Paragraph
* pPara
, SdrObject
* pObj
);
353 /** callback from the sd::View when an object just left text edit mode */
354 void onEndTextEdit( SdrObject
* pObj
);
356 /** @return the presentation style with the given helpid from this masterpage or this
358 SdStyleSheet
* getPresentationStyle( sal_uInt32 nHelpId
) const;
360 /** removes all empty presentation objects from this slide */
361 void RemoveEmptyPresentationObjects();
363 Rectangle
GetTitleRect() const;
364 Rectangle
GetLayoutRect() const;
366 static void CalculateHandoutAreas( SdDrawDocument
& rModel
, AutoLayout eLayout
, bool bHorizontal
, std::vector
< Rectangle
>& rAreas
);
368 /** Set the "precious" flag to the given value.
370 void SetPrecious (const bool bIsPrecious
);
372 /** The "precious" flag is used for master pages to prevent some unused
373 master pages from being deleted automatically. For pages
374 other than master pages this flag can be ignored.
376 When this method returns <TRUE/> for a master page then this
377 master page should not be deleted automatically.
379 bool IsPrecious() const { return mbIsPrecious
; }
381 void createAnnotation( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
);
382 void addAnnotation( const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
, int nIndex
= -1 );
383 void removeAnnotation( const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
);
384 const sd::AnnotationVector
& getAnnotations() const { return maAnnotations
; }
385 bool hasAnnotations() const { return !maAnnotations
.empty(); }
386 sal_Int32
getHash() const;
387 OString
stringify() const;
392 /** clone the animations from this and set them to rTargetPage
394 void cloneAnimations( SdPage
& rTargetPage
) const;
396 /** called before a shape is removed or replaced from this slide */
397 void onRemoveObject( SdrObject
* pObject
);
400 #endif // INCLUDED_SD_INC_SDPAGE_HXX
402 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */