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 <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>
39 #include "shapelist.hxx"
40 #include "misc/scopelock.hxx"
43 namespace com
{ namespace sun
{ namespace star
{ namespace animations
{
53 struct StyleRequestData
;
66 template<class X
> class shared_ptr
;
71 struct SD_DLLPUBLIC HeaderFooterSettings
79 bool mbSlideNumberVisible
;
81 bool mbDateTimeVisible
;
82 bool mbDateTimeIsFixed
;
83 String maDateTimeText
;
86 HeaderFooterSettings();
88 bool operator==( const HeaderFooterSettings
& rSettings
) const;
91 typedef std::vector
< ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> > AnnotationVector
;
101 class SD_DLLPUBLIC SdPage
: public FmFormPage
, public SdrObjUserCall
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 sal_Bool mbSelected
; ///< selection identifier
117 PresChange mePresChange
; ///< manual / automatic / semi automatic
118 double mfTime
; ///< Display time in seconds
119 sal_Bool mbSoundOn
; ///< with / without sound.
120 sal_Bool mbExcluded
; ///< will (not) be displayed during show.
121 OUString maLayoutName
; ///< Name of the layout
122 String maSoundFile
; ///< Path to sound file (MSDOS notation).
125 String maCreatedPageName
; ///< generated page name by GetPageName.
126 String maFileName
; ///< file name.
127 String maBookmarkName
; ///< Bookmark name.
128 sal_Bool mbScaleObjects
; ///< Objects should be scaled
129 sal_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();
147 SfxItemSet
* getOrCreateItems();
149 sd::HeaderFooterSettings maHeaderFooterSettings
;
151 // new transition settings
152 sal_Int16 mnTransitionType
;
153 sal_Int16 mnTransitionSubtype
;
154 sal_Bool mbTransitionDirection
;
155 sal_Int32 mnTransitionFadeColor
;
156 double mfTransitionDuration
;
161 SdPage(SdDrawDocument
& rNewDoc
, StarBASIC
* pBasic
, sal_Bool bMasterPage
=sal_False
);
162 SdPage(const SdPage
& rSrcPage
);
164 virtual SdrPage
* Clone() const;
165 virtual SdrPage
* Clone(SdrModel
* pNewModel
) const;
167 virtual void SetSize(const Size
& aSize
);
168 virtual void SetBorder(sal_Int32 nLft
, sal_Int32 nUpp
, sal_Int32 nRgt
, sal_Int32 Lwr
);
169 virtual void SetLftBorder(sal_Int32 nBorder
);
170 virtual void SetRgtBorder(sal_Int32 nBorder
);
171 virtual void SetUppBorder(sal_Int32 nBorder
);
172 virtual void SetLwrBorder(sal_Int32 nBorder
);
173 virtual void SetModel(SdrModel
* pNewModel
);
174 virtual bool IsReadOnly() const;
176 sd::ShapeList
& GetPresentationShapeList() { return maPresentationShapeList
; }
178 void EnsureMasterPageDefaultBackground();
179 SdrObject
* CreatePresObj(PresObjKind eObjKind
, sal_Bool bVertical
, const Rectangle
& rRect
, sal_Bool bInsert
=sal_False
);
180 SdrObject
* CreateDefaultPresObj(PresObjKind eObjKind
, bool bInsert
);
181 SdrObject
* GetPresObj(PresObjKind eObjKind
, int nIndex
= 1, bool bFuzzySearch
= false );
182 PresObjKind
GetPresObjKind(SdrObject
* pObj
) const;
183 String
GetPresObjText(PresObjKind eObjKind
) const;
184 SfxStyleSheet
* GetStyleSheetForMasterPageBackground() const;
185 SfxStyleSheet
* GetStyleSheetForPresObj(PresObjKind eObjKind
) const;
186 bool RestoreDefaultText( SdrObject
* pObj
);
188 /** @return true if the given SdrObject is inside the presentation object list */
189 bool IsPresObj(const SdrObject
* pObj
);
191 /** removes the given SdrObject from the presentation object list */
192 void RemovePresObj(const SdrObject
* pObj
);
194 /** inserts the given SdrObject into the presentation object list */
195 void InsertPresObj(SdrObject
* pObj
, PresObjKind eKind
);
197 void SetAutoLayout(AutoLayout eLayout
, sal_Bool bInit
=sal_False
, sal_Bool bCreate
=sal_False
);
198 AutoLayout
GetAutoLayout() const { return meAutoLayout
; }
199 void CreateTitleAndLayout(sal_Bool bInit
=sal_False
, sal_Bool bCreate
=sal_False
);
200 SdrObject
* InsertAutoLayoutShape(SdrObject
* pObj
, PresObjKind eObjKind
, bool bVertical
, Rectangle aRect
, bool bInit
);
202 virtual void NbcInsertObject(SdrObject
* pObj
, sal_uLong nPos
=CONTAINER_APPEND
,
203 const SdrInsertReason
* pReason
=NULL
);
204 virtual SdrObject
* NbcRemoveObject(sal_uLong nObjNum
);
205 virtual SdrObject
* RemoveObject(sal_uLong nObjNum
);
207 /** Also overload ReplaceObject methods to realize when
208 objects are removed with this mechanism instead of RemoveObject*/
209 virtual SdrObject
* NbcReplaceObject(SdrObject
* pNewObj
, sal_uLong nObjNum
);
210 virtual SdrObject
* ReplaceObject(SdrObject
* pNewObj
, sal_uLong nObjNum
);
212 void SetObjText(SdrTextObj
* pObj
, SdrOutliner
* pOutliner
, PresObjKind eObjKind
, const String
& rStr
);
214 void SetPageKind(PageKind ePgType
) { mePageKind
= ePgType
; }
215 PageKind
GetPageKind() const { return mePageKind
; }
217 void SetSelected(sal_Bool bSel
) { mbSelected
= bSel
; }
218 sal_Bool
IsSelected() const { return mbSelected
; }
220 void SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect
);
221 ::com::sun::star::presentation::FadeEffect
GetFadeEffect() const;
223 void SetPresChange(PresChange eChange
) { mePresChange
= eChange
; }
224 PresChange
GetPresChange() const { return mePresChange
; }
226 void SetTime(double fNewTime
) { mfTime
= fNewTime
; }
227 double GetTime() const { return mfTime
; }
229 void SetSound(sal_Bool bNewSoundOn
) { mbSoundOn
= bNewSoundOn
; }
230 sal_Bool
IsSoundOn() const { return mbSoundOn
; }
232 void SetExcluded(sal_Bool bNewExcluded
) { mbExcluded
= bNewExcluded
; }
233 sal_Bool
IsExcluded() const { return mbExcluded
; }
235 void SetScaleObjects(sal_Bool bScale
) { mbScaleObjects
= bScale
; }
236 sal_Bool
IsScaleObjects() const { return mbScaleObjects
; }
238 void SetSoundFile(const String
& rStr
) { maSoundFile
= rStr
; }
239 String
GetSoundFile() const { return maSoundFile
; }
241 void SetLoopSound( bool bLoopSound
) { mbLoopSound
= bLoopSound
; }
242 bool IsLoopSound() const { return mbLoopSound
; }
244 void SetStopSound( bool bStopSound
) { mbStopSound
= bStopSound
; }
245 bool IsStopSound() const { return mbStopSound
; }
247 sal_Int16
getTransitionType() const;
248 void setTransitionType( sal_Int16 nTransitionType
);
250 sal_Int16
getTransitionSubtype() const;
251 void setTransitionSubtype( sal_Int16 nTransitionSubtype
);
253 sal_Bool
getTransitionDirection() const;
254 void setTransitionDirection( sal_Bool bTransitionbDirection
);
256 sal_Int32
getTransitionFadeColor() const;
257 void setTransitionFadeColor( sal_Int32 nTransitionFadeColor
);
259 double getTransitionDuration() const;
260 void setTransitionDuration( double fTranstionDuration
);
262 virtual void Changed(const SdrObject
& rObj
, SdrUserCallType eType
,
263 const Rectangle
& rOldBoundRect
);
265 void SetLayoutName(OUString aName
);
266 virtual OUString
GetLayoutName() const { return maLayoutName
; }
268 void SetFileName(const String
& aName
) { maFileName
= aName
; }
269 virtual String
GetFileName() const { return maFileName
; }
270 void SetBookmarkName(const String
& aName
) { maBookmarkName
= aName
; }
271 virtual String
GetBookmarkName() const { return maBookmarkName
; }
272 SdPageLink
* GetLink() { return mpPageLink
; }
275 void DisconnectLink();
277 void ScaleObjects(const Size
& rNewPageSize
, const Rectangle
& rNewBorderRect
,
278 sal_Bool bScaleAllObj
);
280 const String
& GetName() const;
281 String
GetRealName() const { return FmFormPage::GetName(); };
283 void SetPresentationLayout(const String
& rLayoutName
,
284 sal_Bool bReplaceStyleSheets
= sal_True
,
285 sal_Bool bSetMasterPage
= sal_True
,
286 sal_Bool bReverseOrder
= sal_False
);
287 void EndListenOutlineText();
289 void SetBackgroundFullSize( sal_Bool bIn
);
290 sal_Bool
IsBackgroundFullSize() const { return mbBackgroundFullSize
; }
292 rtl_TextEncoding
GetCharSet() { return(meCharSet
); }
294 void SetPaperBin(sal_uInt16 nBin
) { mnPaperBin
= nBin
; }
295 sal_uInt16
GetPaperBin() const { return mnPaperBin
; }
296 virtual void SetOrientation(Orientation eOrient
);
297 virtual Orientation
GetOrientation() const;
299 virtual SfxStyleSheet
* GetTextStyleSheetForObject( SdrObject
* pObj
) const;
301 sal_Bool
setAlienAttributes( const com::sun::star::uno::Any
& rAttributes
);
302 void getAlienAttributes( com::sun::star::uno::Any
& rAttributes
);
304 /** @return the main animation node */
305 ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> getAnimationNode() throw (::com::sun::star::uno::RuntimeException
);
307 /** sets the main animation node */
308 void setAnimationNode( ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
) throw (::com::sun::star::uno::RuntimeException
);
310 /// @return a helper class to manipulate effects inside the main sequence
311 boost::shared_ptr
< sd::MainSequence
> getMainSequence();
313 /** quick check if this slide has an animation node.
314 This can be used to have a cost free check if there are no animations ad this slide.
315 If it returns true this does not mean that there are animations available.
317 bool hasAnimationNode() const;
319 /// @return the SdPage implementation for the given XDrawPage or 0 if not available
320 static SdPage
* getImplementation( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& xPage
);
322 /** removes all custom animations for the given shape */
323 void removeAnimations( const SdrObject
* pObj
);
325 /** Set the name of the page and broadcast a model change.
327 virtual void SetName (const String
& rName
);
329 const sd::HeaderFooterSettings
& getHeaderFooterSettings() const;
330 void setHeaderFooterSettings( const sd::HeaderFooterSettings
& rNewSettings
);
333 @return true if the object from the ViewObjectContact should
334 be visible on this page while rendering.
336 bEdit selects if visibility test is for an editing view or a final render,
339 virtual bool checkVisibility(
340 const sdr::contact::ViewObjectContact
& rOriginal
,
341 const sdr::contact::DisplayInfo
& rDisplayInfo
,
344 /** callback from the sd::View when a new paragraph for one object on this page is created */
345 void onParagraphInserted( ::Outliner
* pOutliner
, Paragraph
* pPara
, SdrObject
* pObj
);
347 /** callback from the sd::View when a paragraph from one object on this page is removed */
348 void onParagraphRemoving( ::Outliner
* pOutliner
, Paragraph
* pPara
, SdrObject
* pObj
);
350 /** callback from the sd::View when an object just left text edit mode */
351 void onEndTextEdit( SdrObject
* pObj
);
353 /** @return the presentation style with the given helpid from this masterpage or this
355 SdStyleSheet
* getPresentationStyle( sal_uInt32 nHelpId
) const;
357 /** removes all empty presentation objects from this slide */
358 void RemoveEmptyPresentationObjects();
360 Rectangle
GetTitleRect() const;
361 Rectangle
GetLayoutRect() const;
363 static void CalculateHandoutAreas( SdDrawDocument
& rModel
, AutoLayout eLayout
, bool bHorizontal
, std::vector
< Rectangle
>& rAreas
);
365 /** Set the "precious" flag to the given value.
367 void SetPrecious (const bool bIsPrecious
);
369 /** The "precious" flag is used for master pages to prevent some unused
370 master pages from being deleted automatically. For pages
371 other than master pages this flag can be ignored.
373 When this method returns <TRUE/> for a master page then this
374 master page should not be deleted automatically.
376 bool IsPrecious (void) const;
378 void createAnnotation( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
);
379 void addAnnotation( const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
, int nIndex
= -1 );
380 void removeAnnotation( const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
);
381 const sd::AnnotationVector
& getAnnotations() const { return maAnnotations
; }
382 bool hasAnnotations() const { return !maAnnotations
.empty(); }
387 /** clone the animations from this and set them to rTargetPage
389 void cloneAnimations( SdPage
& rTargetPage
) const;
391 /** called before a shape is removed or replaced from this slide */
392 void onRemoveObject( SdrObject
* pObject
);
395 #endif // _SDPAGE_HXX
397 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */