CWS-TOOLING: integrate CWS os150
[LibreOffice.git] / sd / inc / sdpage.hxx
blob8bc342b2bc89fd0f3a39c377708ec95d05c6d40c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _SDPAGE_HXX
29 #define _SDPAGE_HXX
31 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
32 #include <boost/shared_ptr.hpp>
33 #endif
35 #ifndef INCLUDED_FUNCTIONAL
36 #include <functional>
37 #define INCLUDED_FUNCTIONAL
38 #endif
39 #include <com/sun/star/drawing/XDrawPage.hpp>
40 #include <com/sun/star/presentation/FadeEffect.hpp>
41 #include <com/sun/star/office/XAnnotation.hpp>
43 #include <list>
44 #include <functional>
45 #include <vector>
46 #include <svx/svdobj.hxx>
47 #ifndef _FM_FMPAGE_HXX //autogen
48 #include <svx/fmpage.hxx>
49 #endif
50 #include "fadedef.h"
51 #include "diadef.h"
52 #ifndef _PRESENTATION
53 #include "pres.hxx"
54 #endif
55 #include "shapelist.hxx"
56 #include "misc/scopelock.hxx"
57 #include "sddllapi.h"
59 namespace com { namespace sun { namespace star { namespace animations {
60 class XAnimationNode;
61 } } } }
63 class SfxStyleSheet;
64 class SdDrawDocument;
65 class SdrTextObj;
66 class SdPageLink;
67 class StarBASIC;
68 class SfxItemSet;
69 struct StyleRequestData;
70 class SdPage;
71 class Paragraph;
72 class Outliner;
73 class SdStyleSheet;
75 namespace sd
77 class MainSequence;
80 namespace boost
82 template<class X> class shared_ptr;
85 namespace sd {
87 struct SD_DLLPUBLIC HeaderFooterSettings
89 bool mbHeaderVisible;
90 String maHeaderText;
92 bool mbFooterVisible;
93 String maFooterText;
95 bool mbSlideNumberVisible;
97 bool mbDateTimeVisible;
98 bool mbDateTimeIsFixed;
99 String maDateTimeText;
100 int meDateTimeFormat;
102 HeaderFooterSettings();
104 bool operator==( const HeaderFooterSettings& rSettings ) const;
107 typedef std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > > AnnotationVector;
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 sal_Bool mbSelected; // Selektionskennung
133 PresChange mePresChange; // manuell/automatisch/halbautomatisch
134 sal_uInt32 mnTime; // Anzeigedauer in Sekunden
135 sal_Bool mbSoundOn; // mit/ohne Sound (sal_True/sal_False)
136 sal_Bool mbExcluded; // wird in der Show nicht/doch
137 // angezeigt (sal_True/sal_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 sal_Bool mbScaleObjects; // Objekte sollen skaliert werden
146 sal_Bool mbBackgroundFullSize; // Hintergrundobjekt auf ganze Seite darstellen
147 rtl_TextEncoding meCharSet; // Text-Encoding
148 sal_uInt16 mnPaperBin; // PaperBin
149 Orientation meOrientation; // Print-Orientation
150 SdPageLink* mpPageLink; // PageLink (nur bei gelinkten Seiten)
152 sd::AnnotationVector maAnnotations;
154 /** holds the smil animation sequences for this page */
155 ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxAnimationNode;
157 /** a helper class to manipulate effects inside the main sequence */
158 boost::shared_ptr< sd::MainSequence > mpMainSequence;
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, sal_Bool bMasterPage=sal_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(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr);
186 virtual void SetLftBorder(sal_Int32 nBorder);
187 virtual void SetRgtBorder(sal_Int32 nBorder);
188 virtual void SetUppBorder(sal_Int32 nBorder);
189 virtual void SetLwrBorder(sal_Int32 nBorder);
190 virtual void SetModel(SdrModel* pNewModel);
191 virtual FASTBOOL IsReadOnly() const;
193 sd::ShapeList& GetPresentationShapeList() { return maPresentationShapeList; }
195 void EnsureMasterPageDefaultBackground();
196 SdrObject* CreatePresObj(PresObjKind eObjKind, sal_Bool bVertical, const Rectangle& rRect, sal_Bool bInsert=sal_False);
197 SdrObject* CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert);
198 SdrObject* GetPresObj(PresObjKind eObjKind, int nIndex = 1, bool bFuzzySearch = false );
199 PresObjKind GetPresObjKind(SdrObject* pObj) const;
200 String GetPresObjText(PresObjKind eObjKind) const;
201 SfxStyleSheet* GetStyleSheetForMasterPageBackground() const;
202 SfxStyleSheet* GetStyleSheetForPresObj(PresObjKind eObjKind) const;
203 bool RestoreDefaultText( SdrObject* pObj );
205 /** returns true if the given SdrObject is inside the presentation object list */
206 bool IsPresObj(const SdrObject* pObj);
208 /** removes the given SdrObject from the presentation object list */
209 void RemovePresObj(const SdrObject* pObj);
211 /** inserts the given SdrObject into the presentation object list */
212 void InsertPresObj(SdrObject* pObj, PresObjKind eKind );
214 void SetAutoLayout(AutoLayout eLayout, sal_Bool bInit=sal_False, sal_Bool bCreate=sal_False);
215 AutoLayout GetAutoLayout() const { return meAutoLayout; }
216 void CreateTitleAndLayout(sal_Bool bInit=sal_False, sal_Bool bCreate=sal_False);
217 SdrObject* InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, bool bVertical, Rectangle aRect, bool bInit );
219 virtual void NbcInsertObject(SdrObject* pObj, sal_uLong nPos=CONTAINER_APPEND,
220 const SdrInsertReason* pReason=NULL);
221 virtual SdrObject* NbcRemoveObject(sal_uLong nObjNum);
222 virtual SdrObject* RemoveObject(sal_uLong nObjNum);
224 // #95876# Also overload ReplaceObject methods to realize when
225 // objects are removed with this mechanism instead of RemoveObject
226 virtual SdrObject* NbcReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum);
227 virtual SdrObject* ReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum);
229 virtual void SetLinkData(const String& rLinkName, const String& rLinkData);
231 void SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const String& rStr );
233 void SetPageKind(PageKind ePgType) { mePageKind = ePgType; }
234 PageKind GetPageKind() const { return mePageKind; }
236 void SetSelected(sal_Bool bSel) { mbSelected = bSel; }
237 sal_Bool IsSelected() const { return mbSelected; }
239 void SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect);
240 ::com::sun::star::presentation::FadeEffect GetFadeEffect() const;
242 void SetPresChange(PresChange eChange) { mePresChange = eChange; }
243 PresChange GetPresChange() const { return mePresChange; }
245 void SetTime(sal_uInt32 nNewTime) { mnTime = nNewTime; }
246 sal_uInt32 GetTime() const { return mnTime; }
248 void SetSound(sal_Bool bNewSoundOn) { mbSoundOn = bNewSoundOn; }
249 sal_Bool IsSoundOn() const { return mbSoundOn; }
251 void SetExcluded(sal_Bool bNewExcluded) { mbExcluded = bNewExcluded; }
252 sal_Bool IsExcluded() const { return mbExcluded; }
254 void SetScaleObjects(sal_Bool bScale) { mbScaleObjects = bScale; }
255 sal_Bool IsScaleObjects() const { return mbScaleObjects; }
257 void SetSoundFile(const String& rStr) { maSoundFile = rStr; }
258 String GetSoundFile() const { return maSoundFile; }
260 void SetLoopSound( bool bLoopSound ) { mbLoopSound = bLoopSound; }
261 bool IsLoopSound() const { return mbLoopSound; }
263 void SetStopSound( bool bStopSound ) { mbStopSound = bStopSound; }
264 bool IsStopSound() const { return mbStopSound; }
266 sal_Int16 getTransitionType() const;
267 void setTransitionType( sal_Int16 nTransitionType );
269 sal_Int16 getTransitionSubtype() const;
270 void setTransitionSubtype( sal_Int16 nTransitionSubtype );
272 sal_Bool getTransitionDirection() const;
273 void setTransitionDirection( sal_Bool bTransitionbDirection );
275 sal_Int32 getTransitionFadeColor() const;
276 void setTransitionFadeColor( sal_Int32 nTransitionFadeColor );
278 double getTransitionDuration() const;
279 void setTransitionDuration( double fTranstionDuration );
281 // Virtuelle Methoden von SdrObjUserCall
282 virtual void Changed(const SdrObject& rObj, SdrUserCallType eType,
283 const Rectangle& rOldBoundRect);
285 void SetLayoutName(String aName);
286 virtual String GetLayoutName() const { return maLayoutName; }
288 void SetFileName(const String& aName) { maFileName = aName; }
289 virtual String GetFileName() const { return maFileName; }
290 void SetBookmarkName(const String& aName) { maBookmarkName = aName; }
291 virtual String GetBookmarkName() const { return maBookmarkName; }
292 SdPageLink* GetLink() { return mpPageLink; }
294 void ConnectLink();
295 void DisconnectLink();
297 void ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect,
298 sal_Bool bScaleAllObj);
300 const String& GetName() const;
301 String GetRealName() const { return FmFormPage::GetName(); };
303 void SetPresentationLayout(const String& rLayoutName,
304 sal_Bool bReplaceStyleSheets = sal_True,
305 sal_Bool bSetMasterPage = sal_True,
306 sal_Bool bReverseOrder = sal_False);
307 void EndListenOutlineText();
309 void SetBackgroundFullSize( sal_Bool bIn );
310 sal_Bool IsBackgroundFullSize() const { return mbBackgroundFullSize; }
312 rtl_TextEncoding GetCharSet() { return(meCharSet); }
314 void SetPaperBin(sal_uInt16 nBin) { mnPaperBin = nBin; }
315 sal_uInt16 GetPaperBin() const { return mnPaperBin; }
316 virtual void SetOrientation(Orientation eOrient);
317 virtual Orientation GetOrientation() const;
319 virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const;
321 sal_Bool setAlienAttributes( const com::sun::star::uno::Any& rAttributes );
322 void getAlienAttributes( com::sun::star::uno::Any& rAttributes );
324 /** returns the main animation node */
325 ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getAnimationNode() throw (::com::sun::star::uno::RuntimeException);
327 /** sets the main animation node */
328 void setAnimationNode( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) throw (::com::sun::star::uno::RuntimeException);
330 /** returns a helper class to manipulate effects inside the main sequence */
331 boost::shared_ptr< sd::MainSequence > getMainSequence();
333 /** quick check if this slide has an animation node.
334 This can be used to have a cost free check if there are no animations ad this slide.
335 If it returns true this does not mean that there are animations available.
337 bool hasAnimationNode() const;
339 /** returns the SdPage implementation for the given XDrawPage or 0 if not available */
340 static SdPage* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage );
342 /** removes all custom animations for the given shape */
343 void removeAnimations( const SdrObject* pObj );
345 /** Set the name of the page and broadcast a model change.
347 virtual void SetName (const String& rName);
349 const sd::HeaderFooterSettings& getHeaderFooterSettings() const;
350 void setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings );
352 /** this method returns true if the object from the ViewObjectContact should
353 be visible on this page while rendering.
354 bEdit selects if visibility test is for an editing view or a final render,
355 like printing.
357 virtual bool checkVisibility(
358 const sdr::contact::ViewObjectContact& rOriginal,
359 const sdr::contact::DisplayInfo& rDisplayInfo,
360 bool bEdit );
362 /** callback from the sd::View when a new paragraph for one object on this page is created */
363 void onParagraphInserted( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
365 /** callback from the sd::View when a paragraph from one object on this page is removed */
366 void onParagraphRemoving( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
368 /** callback from the sd::View when an object just left text edit mode */
369 void onEndTextEdit( SdrObject* pObj );
371 /** returns the presentation style with the given helpid from this masterpage or this
372 slides masterpage */
373 SdStyleSheet* getPresentationStyle( sal_uInt32 nHelpId ) const;
375 /** removes all empty presentation objects from this slide */
376 void RemoveEmptyPresentationObjects();
378 Rectangle GetTitleRect() const;
379 Rectangle GetLayoutRect() const;
381 static void CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas );
383 /** Set the "precious" flag to the given value.
385 void SetPrecious (const bool bIsPrecious);
387 /** The "precious" flag is used for master pages to prevent some unused
388 master pages from being deleted automatically. For pages
389 other than master pages this flag can be ignored.
390 @return
391 When this method returns <TRUE/> for a master page then this
392 master page should not be deleted automatically.
394 bool IsPrecious (void) const;
396 void createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
397 void addAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, int nIndex = -1 );
398 void removeAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
399 const sd::AnnotationVector& getAnnotations() const { return maAnnotations; }
400 bool hasAnnotations() const { return !maAnnotations.empty(); }
402 private:
403 bool mbIsPrecious;
405 /** clone the animations from this and set them to rTargetPage
407 void cloneAnimations( SdPage& rTargetPage ) const;
409 /** called before a shape is removed or replaced from this slide */
410 void onRemoveObject( SdrObject* pObject );
413 #endif // _SDPAGE_HXX