update dev300-m58
[ooovba.git] / sd / inc / sdpage.hxx
blobbb7d6b86ecc6b9f268f2710f73db0f1e645fb0bf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sdpage.hxx,v $
10 * $Revision: 1.33 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SDPAGE_HXX
32 #define _SDPAGE_HXX
34 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
35 #include <boost/shared_ptr.hpp>
36 #endif
38 #ifndef INCLUDED_FUNCTIONAL
39 #include <functional>
40 #define INCLUDED_FUNCTIONAL
41 #endif
42 #include <com/sun/star/drawing/XDrawPage.hpp>
43 #include <com/sun/star/presentation/FadeEffect.hpp>
45 #include <list>
46 #include <functional>
47 #include <vector>
48 #include <svx/svdobj.hxx>
49 #ifndef _FM_FMPAGE_HXX //autogen
50 #include <svx/fmpage.hxx>
51 #endif
52 #include "fadedef.h"
53 #include "diadef.h"
54 #ifndef _PRESENTATION
55 #include "pres.hxx"
56 #endif
57 #include "shapelist.hxx"
58 #include "misc/scopelock.hxx"
59 #include "sddllapi.h"
61 namespace com { namespace sun { namespace star { namespace animations {
62 class XAnimationNode;
63 } } } }
65 class SfxStyleSheet;
66 class SdDrawDocument;
67 class SdrTextObj;
68 class SdPageLink;
69 class StarBASIC;
70 class SfxItemSet;
71 struct StyleRequestData;
72 class SdPage;
73 class Paragraph;
74 class Outliner;
75 class SdStyleSheet;
77 namespace sd
79 class MainSequence;
82 namespace boost
84 template<class X> class shared_ptr;
87 namespace sd {
89 struct SD_DLLPUBLIC HeaderFooterSettings
91 bool mbHeaderVisible;
92 String maHeaderText;
94 bool mbFooterVisible;
95 String maFooterText;
97 bool mbSlideNumberVisible;
99 bool mbDateTimeVisible;
100 bool mbDateTimeIsFixed;
101 String maDateTimeText;
102 int meDateTimeFormat;
104 HeaderFooterSettings();
106 bool operator==( const HeaderFooterSettings& rSettings ) const;
110 namespace sd {
111 class UndoAnimation;
112 class UndoTransition;
113 class UndoGeoObject;
114 class UndoAttrObject;
117 class SD_DLLPUBLIC SdPage : public FmFormPage, public SdrObjUserCall
119 friend class SdGenericDrawPage;
120 friend class SdDrawPage;
121 friend class sd::UndoAnimation;
122 friend class sd::UndoTransition;
123 friend class ModifyPageUndoAction;
124 friend class sd::UndoGeoObject;
125 friend class sd::UndoAttrObject;
127 protected:
128 PageKind mePageKind; // Seitentyp
129 AutoLayout meAutoLayout; // AutoLayout
130 sd::ShapeList maPresentationShapeList; // Praesentationsobjekte
131 sd::ScopeLock maLockAutoLayoutArrangement;
132 BOOL mbSelected; // Selektionskennung
133 PresChange mePresChange; // manuell/automatisch/halbautomatisch
134 UINT32 mnTime; // Anzeigedauer in Sekunden
135 BOOL mbSoundOn; // mit/ohne Sound (TRUE/FALSE)
136 BOOL mbExcluded; // wird in der Show nicht/doch
137 // angezeigt (TRUE/FALSE)
138 String maLayoutName; // Name des Layouts
139 String maSoundFile; // Pfad zum Soundfile (MSDOS-Notation)
140 bool mbLoopSound;
141 bool mbStopSound;
142 String maCreatedPageName; // von GetPageName erzeugter Seitenname
143 String maFileName; // Filename
144 String maBookmarkName; // Bookmarkname
145 BOOL mbScaleObjects; // Objekte sollen skaliert werden
146 BOOL mbBackgroundFullSize; // Hintergrundobjekt auf ganze Seite darstellen
147 rtl_TextEncoding meCharSet; // Text-Encoding
148 USHORT mnPaperBin; // PaperBin
149 Orientation meOrientation; // Print-Orientation
150 SdPageLink* mpPageLink; // PageLink (nur bei gelinkten Seiten)
152 /** holds the smil animation sequences for this page */
153 ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxAnimationNode;
155 /** a helper class to manipulate effects inside the main sequence */
156 boost::shared_ptr< sd::MainSequence > mpMainSequence;
158 void AdjustBackgroundSize();
160 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoPage();
162 SfxItemSet* mpItems;
164 SfxItemSet* getOrCreateItems();
166 sd::HeaderFooterSettings maHeaderFooterSettings;
168 // new transition settings
169 sal_Int16 mnTransitionType;
170 sal_Int16 mnTransitionSubtype;
171 sal_Bool mbTransitionDirection;
172 sal_Int32 mnTransitionFadeColor;
173 double mfTransitionDuration;
175 public:
176 TYPEINFO();
178 SdPage(SdDrawDocument& rNewDoc, StarBASIC* pBasic, BOOL bMasterPage=FALSE);
179 SdPage(const SdPage& rSrcPage);
180 ~SdPage();
181 virtual SdrPage* Clone() const;
182 virtual SdrPage* Clone(SdrModel* pNewModel) const;
184 virtual void SetSize(const Size& aSize);
185 virtual void SetBorder(INT32 nLft, INT32 nUpp, INT32 nRgt, INT32 Lwr);
186 virtual void SetLftBorder(INT32 nBorder);
187 virtual void SetRgtBorder(INT32 nBorder);
188 virtual void SetUppBorder(INT32 nBorder);
189 virtual void SetLwrBorder(INT32 nBorder);
190 virtual void SetModel(SdrModel* pNewModel);
191 virtual FASTBOOL IsReadOnly() const;
193 sd::ShapeList& GetPresentationShapeList() { return maPresentationShapeList; }
195 SdrObject* CreatePresObj(PresObjKind eObjKind, BOOL bVertical, const Rectangle& rRect, BOOL bInsert=FALSE);
196 SdrObject* CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert);
197 SdrObject* GetPresObj(PresObjKind eObjKind, int nIndex = 1 );
198 PresObjKind GetPresObjKind(SdrObject* pObj) const;
199 String GetPresObjText(PresObjKind eObjKind) const;
200 SfxStyleSheet* GetStyleSheetForPresObj(PresObjKind eObjKind) const;
201 bool RestoreDefaultText( SdrObject* pObj );
203 /** returns true if the given SdrObject is inside the presentation object list */
204 bool IsPresObj(const SdrObject* pObj);
206 /** removes the given SdrObject from the presentation object list */
207 void RemovePresObj(const SdrObject* pObj);
209 /** inserts the given SdrObject into the presentation object list */
210 void InsertPresObj(SdrObject* pObj, PresObjKind eKind );
212 void SetAutoLayout(AutoLayout eLayout, BOOL bInit=FALSE, BOOL bCreate=FALSE);
213 AutoLayout GetAutoLayout() const { return meAutoLayout; }
214 void CreateTitleAndLayout(BOOL bInit=FALSE, BOOL bCreate=FALSE);
215 SdrObject* InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, bool bVertical, Rectangle aRect, bool bInit );
217 virtual void NbcInsertObject(SdrObject* pObj, ULONG nPos=CONTAINER_APPEND,
218 const SdrInsertReason* pReason=NULL);
219 virtual SdrObject* NbcRemoveObject(ULONG nObjNum);
220 virtual SdrObject* RemoveObject(ULONG nObjNum);
222 // #95876# Also overload ReplaceObject methods to realize when
223 // objects are removed with this mechanism instead of RemoveObject
224 virtual SdrObject* NbcReplaceObject(SdrObject* pNewObj, ULONG nObjNum);
225 virtual SdrObject* ReplaceObject(SdrObject* pNewObj, ULONG nObjNum);
227 virtual void SetLinkData(const String& rLinkName, const String& rLinkData);
229 void SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const String& rStr );
231 void SetPageKind(PageKind ePgType) { mePageKind = ePgType; }
232 PageKind GetPageKind() const { return mePageKind; }
234 void SetSelected(BOOL bSel) { mbSelected = bSel; }
235 BOOL IsSelected() const { return mbSelected; }
237 void SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect);
238 ::com::sun::star::presentation::FadeEffect GetFadeEffect() const;
240 void SetPresChange(PresChange eChange) { mePresChange = eChange; }
241 PresChange GetPresChange() const { return mePresChange; }
243 void SetTime(UINT32 nNewTime) { mnTime = nNewTime; }
244 UINT32 GetTime() const { return mnTime; }
246 void SetSound(BOOL bNewSoundOn) { mbSoundOn = bNewSoundOn; }
247 BOOL IsSoundOn() const { return mbSoundOn; }
249 void SetExcluded(BOOL bNewExcluded) { mbExcluded = bNewExcluded; }
250 BOOL IsExcluded() const { return mbExcluded; }
252 void SetScaleObjects(BOOL bScale) { mbScaleObjects = bScale; }
253 BOOL IsScaleObjects() const { return mbScaleObjects; }
255 void SetSoundFile(const String& rStr) { maSoundFile = rStr; }
256 String GetSoundFile() const { return maSoundFile; }
258 void SetLoopSound( bool bLoopSound ) { mbLoopSound = bLoopSound; }
259 bool IsLoopSound() const { return mbLoopSound; }
261 void SetStopSound( bool bStopSound ) { mbStopSound = bStopSound; }
262 bool IsStopSound() const { return mbStopSound; }
264 sal_Int16 getTransitionType() const;
265 void setTransitionType( sal_Int16 nTransitionType );
267 sal_Int16 getTransitionSubtype() const;
268 void setTransitionSubtype( sal_Int16 nTransitionSubtype );
270 sal_Bool getTransitionDirection() const;
271 void setTransitionDirection( sal_Bool bTransitionbDirection );
273 sal_Int32 getTransitionFadeColor() const;
274 void setTransitionFadeColor( sal_Int32 nTransitionFadeColor );
276 double getTransitionDuration() const;
277 void setTransitionDuration( double fTranstionDuration );
279 // Virtuelle Methoden von SdrObjUserCall
280 virtual void Changed(const SdrObject& rObj, SdrUserCallType eType,
281 const Rectangle& rOldBoundRect);
283 void SetLayoutName(String aName);
284 virtual String GetLayoutName() const { return maLayoutName; }
286 void SetFileName(const String& aName) { maFileName = aName; }
287 virtual String GetFileName() const { return maFileName; }
288 void SetBookmarkName(const String& aName) { maBookmarkName = aName; }
289 virtual String GetBookmarkName() const { return maBookmarkName; }
290 SdPageLink* GetLink() { return mpPageLink; }
292 void ConnectLink();
293 void DisconnectLink();
295 void ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect,
296 BOOL bScaleAllObj);
298 const String& GetName() const;
299 String GetRealName() const { return FmFormPage::GetName(); };
301 void SetPresentationLayout(const String& rLayoutName,
302 BOOL bReplaceStyleSheets = TRUE,
303 BOOL bSetMasterPage = TRUE,
304 BOOL bReverseOrder = FALSE);
305 void EndListenOutlineText();
307 void SetBackgroundFullSize( BOOL bIn );
308 BOOL IsBackgroundFullSize() const { return mbBackgroundFullSize; }
310 rtl_TextEncoding GetCharSet() { return(meCharSet); }
312 void SetPaperBin(USHORT nBin) { mnPaperBin = nBin; }
313 USHORT GetPaperBin() const { return mnPaperBin; }
314 virtual void SetOrientation(Orientation eOrient);
315 virtual Orientation GetOrientation() const;
317 virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const;
319 sal_Bool setAlienAttributes( const com::sun::star::uno::Any& rAttributes );
320 void getAlienAttributes( com::sun::star::uno::Any& rAttributes );
322 /** returns the main animation node */
323 ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getAnimationNode() throw (::com::sun::star::uno::RuntimeException);
325 /** sets the main animation node */
326 void setAnimationNode( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) throw (::com::sun::star::uno::RuntimeException);
328 /** returns a helper class to manipulate effects inside the main sequence */
329 boost::shared_ptr< sd::MainSequence > getMainSequence();
331 /** quick check if this slide has an animation node.
332 This can be used to have a cost free check if there are no animations ad this slide.
333 If it returns true this does not mean that there are animations available.
335 bool hasAnimationNode() const;
337 /** returns the SdPage implementation for the given XDrawPage or 0 if not available */
338 static SdPage* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage );
340 /** removes all custom animations for the given shape */
341 void removeAnimations( const SdrObject* pObj );
343 /** Set the name of the page and broadcast a model change.
345 virtual void SetName (const String& rName);
347 const sd::HeaderFooterSettings& getHeaderFooterSettings() const;
348 void setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings );
350 /** this method returns true if the object from the ViewObjectContact should
351 be visible on this page while rendering.
352 bEdit selects if visibility test is for an editing view or a final render,
353 like printing.
355 virtual bool checkVisibility(
356 const sdr::contact::ViewObjectContact& rOriginal,
357 const sdr::contact::DisplayInfo& rDisplayInfo,
358 bool bEdit );
360 /** callback from the sd::View when a new paragraph for one object on this page is created */
361 void onParagraphInserted( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
363 /** callback from the sd::View when a paragraph from one object on this page is removed */
364 void onParagraphRemoving( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
366 /** callback from the sd::View when an object just left text edit mode */
367 void onEndTextEdit( SdrObject* pObj );
369 /** returns the presentation style with the given helpid from this masterpage or this
370 slides masterpage */
371 SdStyleSheet* getPresentationStyle( sal_uInt32 nHelpId ) const;
373 /** removes all empty presentation objects from this slide */
374 void RemoveEmptyPresentationObjects();
376 Rectangle GetTitleRect() const;
377 Rectangle GetLayoutRect() const;
379 static void CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas );
381 /** Set the "precious" flag to the given value.
383 void SetPrecious (const bool bIsPrecious);
385 /** The "precious" flag is used for master pages to prevent some unused
386 master pages from being deleted automatically. For pages
387 other than master pages this flag can be ignored.
388 @return
389 When this method returns <TRUE/> for a master page then this
390 master page should not be deleted automatically.
392 bool IsPrecious (void) const;
394 private:
395 bool mbIsPrecious;
397 /** clone the animations from this and set them to rTargetPage
399 void cloneAnimations( SdPage& rTargetPage ) const;
401 /** called before a shape is removed or replaced from this slide */
402 void onRemoveObject( SdrObject* pObject );
405 #endif // _SDPAGE_HXX