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 sal_uInt32 mnTime
; ///< 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 virtual void SetLinkData(const String
& rLinkName
, const String
& rLinkData
);
214 void SetObjText(SdrTextObj
* pObj
, SdrOutliner
* pOutliner
, PresObjKind eObjKind
, const String
& rStr
);
216 void SetPageKind(PageKind ePgType
) { mePageKind
= ePgType
; }
217 PageKind
GetPageKind() const { return mePageKind
; }
219 void SetSelected(sal_Bool bSel
) { mbSelected
= bSel
; }
220 sal_Bool
IsSelected() const { return mbSelected
; }
222 void SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect
);
223 ::com::sun::star::presentation::FadeEffect
GetFadeEffect() const;
225 void SetPresChange(PresChange eChange
) { mePresChange
= eChange
; }
226 PresChange
GetPresChange() const { return mePresChange
; }
228 void SetTime(sal_uInt32 nNewTime
) { mnTime
= nNewTime
; }
229 sal_uInt32
GetTime() const { return mnTime
; }
231 void SetSound(sal_Bool bNewSoundOn
) { mbSoundOn
= bNewSoundOn
; }
232 sal_Bool
IsSoundOn() const { return mbSoundOn
; }
234 void SetExcluded(sal_Bool bNewExcluded
) { mbExcluded
= bNewExcluded
; }
235 sal_Bool
IsExcluded() const { return mbExcluded
; }
237 void SetScaleObjects(sal_Bool bScale
) { mbScaleObjects
= bScale
; }
238 sal_Bool
IsScaleObjects() const { return mbScaleObjects
; }
240 void SetSoundFile(const String
& rStr
) { maSoundFile
= rStr
; }
241 String
GetSoundFile() const { return maSoundFile
; }
243 void SetLoopSound( bool bLoopSound
) { mbLoopSound
= bLoopSound
; }
244 bool IsLoopSound() const { return mbLoopSound
; }
246 void SetStopSound( bool bStopSound
) { mbStopSound
= bStopSound
; }
247 bool IsStopSound() const { return mbStopSound
; }
249 sal_Int16
getTransitionType() const;
250 void setTransitionType( sal_Int16 nTransitionType
);
252 sal_Int16
getTransitionSubtype() const;
253 void setTransitionSubtype( sal_Int16 nTransitionSubtype
);
255 sal_Bool
getTransitionDirection() const;
256 void setTransitionDirection( sal_Bool bTransitionbDirection
);
258 sal_Int32
getTransitionFadeColor() const;
259 void setTransitionFadeColor( sal_Int32 nTransitionFadeColor
);
261 double getTransitionDuration() const;
262 void setTransitionDuration( double fTranstionDuration
);
264 virtual void Changed(const SdrObject
& rObj
, SdrUserCallType eType
,
265 const Rectangle
& rOldBoundRect
);
267 void SetLayoutName(OUString aName
);
268 virtual OUString
GetLayoutName() const { return maLayoutName
; }
270 void SetFileName(const String
& aName
) { maFileName
= aName
; }
271 virtual String
GetFileName() const { return maFileName
; }
272 void SetBookmarkName(const String
& aName
) { maBookmarkName
= aName
; }
273 virtual String
GetBookmarkName() const { return maBookmarkName
; }
274 SdPageLink
* GetLink() { return mpPageLink
; }
277 void DisconnectLink();
279 void ScaleObjects(const Size
& rNewPageSize
, const Rectangle
& rNewBorderRect
,
280 sal_Bool bScaleAllObj
);
282 const String
& GetName() const;
283 String
GetRealName() const { return FmFormPage::GetName(); };
285 void SetPresentationLayout(const String
& rLayoutName
,
286 sal_Bool bReplaceStyleSheets
= sal_True
,
287 sal_Bool bSetMasterPage
= sal_True
,
288 sal_Bool bReverseOrder
= sal_False
);
289 void EndListenOutlineText();
291 void SetBackgroundFullSize( sal_Bool bIn
);
292 sal_Bool
IsBackgroundFullSize() const { return mbBackgroundFullSize
; }
294 rtl_TextEncoding
GetCharSet() { return(meCharSet
); }
296 void SetPaperBin(sal_uInt16 nBin
) { mnPaperBin
= nBin
; }
297 sal_uInt16
GetPaperBin() const { return mnPaperBin
; }
298 virtual void SetOrientation(Orientation eOrient
);
299 virtual Orientation
GetOrientation() const;
301 virtual SfxStyleSheet
* GetTextStyleSheetForObject( SdrObject
* pObj
) const;
303 sal_Bool
setAlienAttributes( const com::sun::star::uno::Any
& rAttributes
);
304 void getAlienAttributes( com::sun::star::uno::Any
& rAttributes
);
306 /** @return the main animation node */
307 ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> getAnimationNode() throw (::com::sun::star::uno::RuntimeException
);
309 /** sets the main animation node */
310 void setAnimationNode( ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
) throw (::com::sun::star::uno::RuntimeException
);
312 /// @return a helper class to manipulate effects inside the main sequence
313 boost::shared_ptr
< sd::MainSequence
> getMainSequence();
315 /** quick check if this slide has an animation node.
316 This can be used to have a cost free check if there are no animations ad this slide.
317 If it returns true this does not mean that there are animations available.
319 bool hasAnimationNode() const;
321 /// @return the SdPage implementation for the given XDrawPage or 0 if not available
322 static SdPage
* getImplementation( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& xPage
);
324 /** removes all custom animations for the given shape */
325 void removeAnimations( const SdrObject
* pObj
);
327 /** Set the name of the page and broadcast a model change.
329 virtual void SetName (const String
& rName
);
331 const sd::HeaderFooterSettings
& getHeaderFooterSettings() const;
332 void setHeaderFooterSettings( const sd::HeaderFooterSettings
& rNewSettings
);
335 @return true if the object from the ViewObjectContact should
336 be visible on this page while rendering.
338 bEdit selects if visibility test is for an editing view or a final render,
341 virtual bool checkVisibility(
342 const sdr::contact::ViewObjectContact
& rOriginal
,
343 const sdr::contact::DisplayInfo
& rDisplayInfo
,
346 /** callback from the sd::View when a new paragraph for one object on this page is created */
347 void onParagraphInserted( ::Outliner
* pOutliner
, Paragraph
* pPara
, SdrObject
* pObj
);
349 /** callback from the sd::View when a paragraph from one object on this page is removed */
350 void onParagraphRemoving( ::Outliner
* pOutliner
, Paragraph
* pPara
, SdrObject
* pObj
);
352 /** callback from the sd::View when an object just left text edit mode */
353 void onEndTextEdit( SdrObject
* pObj
);
355 /** @return the presentation style with the given helpid from this masterpage or this
357 SdStyleSheet
* getPresentationStyle( sal_uInt32 nHelpId
) const;
359 /** removes all empty presentation objects from this slide */
360 void RemoveEmptyPresentationObjects();
362 Rectangle
GetTitleRect() const;
363 Rectangle
GetLayoutRect() const;
365 static void CalculateHandoutAreas( SdDrawDocument
& rModel
, AutoLayout eLayout
, bool bHorizontal
, std::vector
< Rectangle
>& rAreas
);
367 /** Set the "precious" flag to the given value.
369 void SetPrecious (const bool bIsPrecious
);
371 /** The "precious" flag is used for master pages to prevent some unused
372 master pages from being deleted automatically. For pages
373 other than master pages this flag can be ignored.
375 When this method returns <TRUE/> for a master page then this
376 master page should not be deleted automatically.
378 bool IsPrecious (void) const;
380 void createAnnotation( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
);
381 void addAnnotation( const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
, int nIndex
= -1 );
382 void removeAnnotation( const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
);
383 const sd::AnnotationVector
& getAnnotations() const { return maAnnotations
; }
384 bool hasAnnotations() const { return !maAnnotations
.empty(); }
389 /** clone the animations from this and set them to rTargetPage
391 void cloneAnimations( SdPage
& rTargetPage
) const;
393 /** called before a shape is removed or replaced from this slide */
394 void onRemoveObject( SdrObject
* pObject
);
397 #endif // _SDPAGE_HXX
399 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */