Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SDPAGE_HXX
30 : : #define _SDPAGE_HXX
31 : :
32 : : #include <boost/shared_ptr.hpp>
33 : :
34 : : #include <functional>
35 : : #include <com/sun/star/drawing/XDrawPage.hpp>
36 : : #include <com/sun/star/presentation/FadeEffect.hpp>
37 : : #include <com/sun/star/office/XAnnotation.hpp>
38 : :
39 : : #include <list>
40 : : #include <vector>
41 : : #include <svx/svdobj.hxx>
42 : : #include <svx/fmpage.hxx>
43 : : #include "fadedef.h"
44 : : #include "diadef.h"
45 : : #ifndef _PRESENTATION
46 : : #include "pres.hxx"
47 : : #endif
48 : : #include "shapelist.hxx"
49 : : #include "misc/scopelock.hxx"
50 : : #include "sddllapi.h"
51 : :
52 : : namespace com { namespace sun { namespace star { namespace animations {
53 : : class XAnimationNode;
54 : : } } } }
55 : :
56 : : class SfxStyleSheet;
57 : : class SdDrawDocument;
58 : : class SdrTextObj;
59 : : class SdPageLink;
60 : : class StarBASIC;
61 : : class SfxItemSet;
62 : : struct StyleRequestData;
63 : : class SdPage;
64 : : class Paragraph;
65 : : class Outliner;
66 : : class SdStyleSheet;
67 : :
68 : : namespace sd
69 : : {
70 : : class MainSequence;
71 : : }
72 : :
73 : : namespace boost
74 : : {
75 : : template<class X> class shared_ptr;
76 : : }
77 : :
78 : : namespace sd {
79 : :
80 [ + - ][ + - ]: 1771 : struct SD_DLLPUBLIC HeaderFooterSettings
[ + - ][ + - ]
[ + - ][ + - ]
81 : : {
82 : : bool mbHeaderVisible;
83 : : String maHeaderText;
84 : :
85 : : bool mbFooterVisible;
86 : : String maFooterText;
87 : :
88 : : bool mbSlideNumberVisible;
89 : :
90 : : bool mbDateTimeVisible;
91 : : bool mbDateTimeIsFixed;
92 : : String maDateTimeText;
93 : : int meDateTimeFormat;
94 : :
95 : : HeaderFooterSettings();
96 : :
97 : : bool operator==( const HeaderFooterSettings& rSettings ) const;
98 : : };
99 : :
100 : : typedef std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > > AnnotationVector;
101 : : }
102 : :
103 : : namespace sd {
104 : : class UndoAnimation;
105 : : class UndoTransition;
106 : : class UndoGeoObject;
107 : : class UndoAttrObject;
108 : : }
109 : :
110 : : class SD_DLLPUBLIC SdPage : public FmFormPage, public SdrObjUserCall
111 : : {
112 : : friend class SdGenericDrawPage;
113 : : friend class SdDrawPage;
114 : : friend class sd::UndoAnimation;
115 : : friend class sd::UndoTransition;
116 : : friend class ModifyPageUndoAction;
117 : : friend class sd::UndoGeoObject;
118 : : friend class sd::UndoAttrObject;
119 : :
120 : : protected:
121 : : PageKind mePageKind; ///< page type
122 : : AutoLayout meAutoLayout; ///< AutoLayout
123 : : sd::ShapeList maPresentationShapeList;///< presentation objects
124 : : sd::ScopeLock maLockAutoLayoutArrangement;
125 : : sal_Bool mbSelected; ///< selection identifier
126 : : PresChange mePresChange; ///< manual / automatic / semi automatic
127 : : sal_uInt32 mnTime; ///< Display time in seconds
128 : : sal_Bool mbSoundOn; ///< with / without sound.
129 : : sal_Bool mbExcluded; ///< will (not) be displayed during show.
130 : : String maLayoutName; ///< Name of the layout
131 : : String maSoundFile; ///< Path to sound file (MSDOS notation).
132 : : bool mbLoopSound;
133 : : bool mbStopSound;
134 : : String maCreatedPageName; ///< generated page name by GetPageName.
135 : : String maFileName; ///< file name.
136 : : String maBookmarkName; ///< Bookmark name.
137 : : sal_Bool mbScaleObjects; ///< Objects should be scaled
138 : : sal_Bool mbBackgroundFullSize; ///< Background object to represent the whole page.
139 : : rtl_TextEncoding meCharSet; ///< Text encoding
140 : : sal_uInt16 mnPaperBin; ///< PaperBin
141 : : Orientation meOrientation; ///< Print orientation.
142 : : SdPageLink* mpPageLink; ///< Page link (at left sides only)
143 : :
144 : : sd::AnnotationVector maAnnotations;
145 : :
146 : : /** holds the smil animation sequences for this page */
147 : : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxAnimationNode;
148 : :
149 : : /** a helper class to manipulate effects inside the main sequence */
150 : : boost::shared_ptr< sd::MainSequence > mpMainSequence;
151 : :
152 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoPage();
153 : :
154 : : SfxItemSet* mpItems;
155 : :
156 : : SfxItemSet* getOrCreateItems();
157 : :
158 : : sd::HeaderFooterSettings maHeaderFooterSettings;
159 : :
160 : : // new transition settings
161 : : sal_Int16 mnTransitionType;
162 : : sal_Int16 mnTransitionSubtype;
163 : : sal_Bool mbTransitionDirection;
164 : : sal_Int32 mnTransitionFadeColor;
165 : : double mfTransitionDuration;
166 : :
167 : : public:
168 : : TYPEINFO();
169 : :
170 : : SdPage(SdDrawDocument& rNewDoc, StarBASIC* pBasic, sal_Bool bMasterPage=sal_False);
171 : : SdPage(const SdPage& rSrcPage);
172 : : ~SdPage();
173 : : virtual SdrPage* Clone() const;
174 : : virtual SdrPage* Clone(SdrModel* pNewModel) const;
175 : :
176 : : virtual void SetSize(const Size& aSize);
177 : : virtual void SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr);
178 : : virtual void SetLftBorder(sal_Int32 nBorder);
179 : : virtual void SetRgtBorder(sal_Int32 nBorder);
180 : : virtual void SetUppBorder(sal_Int32 nBorder);
181 : : virtual void SetLwrBorder(sal_Int32 nBorder);
182 : : virtual void SetModel(SdrModel* pNewModel);
183 : : virtual bool IsReadOnly() const;
184 : :
185 : 546 : sd::ShapeList& GetPresentationShapeList() { return maPresentationShapeList; }
186 : :
187 : : void EnsureMasterPageDefaultBackground();
188 : : SdrObject* CreatePresObj(PresObjKind eObjKind, sal_Bool bVertical, const Rectangle& rRect, sal_Bool bInsert=sal_False);
189 : : SdrObject* CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert);
190 : : SdrObject* GetPresObj(PresObjKind eObjKind, int nIndex = 1, bool bFuzzySearch = false );
191 : : PresObjKind GetPresObjKind(SdrObject* pObj) const;
192 : : String GetPresObjText(PresObjKind eObjKind) const;
193 : : SfxStyleSheet* GetStyleSheetForMasterPageBackground() const;
194 : : SfxStyleSheet* GetStyleSheetForPresObj(PresObjKind eObjKind) const;
195 : : bool RestoreDefaultText( SdrObject* pObj );
196 : :
197 : : /** @return true if the given SdrObject is inside the presentation object list */
198 : : bool IsPresObj(const SdrObject* pObj);
199 : :
200 : : /** removes the given SdrObject from the presentation object list */
201 : : void RemovePresObj(const SdrObject* pObj);
202 : :
203 : : /** inserts the given SdrObject into the presentation object list */
204 : : void InsertPresObj(SdrObject* pObj, PresObjKind eKind );
205 : :
206 : : void SetAutoLayout(AutoLayout eLayout, sal_Bool bInit=sal_False, sal_Bool bCreate=sal_False);
207 : 1194 : AutoLayout GetAutoLayout() const { return meAutoLayout; }
208 : : void CreateTitleAndLayout(sal_Bool bInit=sal_False, sal_Bool bCreate=sal_False);
209 : : SdrObject* InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, bool bVertical, Rectangle aRect, bool bInit );
210 : :
211 : : virtual void NbcInsertObject(SdrObject* pObj, sal_uLong nPos=CONTAINER_APPEND,
212 : : const SdrInsertReason* pReason=NULL);
213 : : virtual SdrObject* NbcRemoveObject(sal_uLong nObjNum);
214 : : virtual SdrObject* RemoveObject(sal_uLong nObjNum);
215 : :
216 : : /** Also overload ReplaceObject methods to realize when
217 : : objects are removed with this mechanism instead of RemoveObject*/
218 : : virtual SdrObject* NbcReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum);
219 : : virtual SdrObject* ReplaceObject(SdrObject* pNewObj, sal_uLong nObjNum);
220 : :
221 : : virtual void SetLinkData(const String& rLinkName, const String& rLinkData);
222 : :
223 : : void SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const String& rStr );
224 : :
225 : 725 : void SetPageKind(PageKind ePgType) { mePageKind = ePgType; }
226 : 13979 : PageKind GetPageKind() const { return mePageKind; }
227 : :
228 : 2072 : void SetSelected(sal_Bool bSel) { mbSelected = bSel; }
229 : 424 : sal_Bool IsSelected() const { return mbSelected; }
230 : :
231 : : void SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect);
232 : : ::com::sun::star::presentation::FadeEffect GetFadeEffect() const;
233 : :
234 : 9 : void SetPresChange(PresChange eChange) { mePresChange = eChange; }
235 : 4 : PresChange GetPresChange() const { return mePresChange; }
236 : :
237 : 0 : void SetTime(sal_uInt32 nNewTime) { mnTime = nNewTime; }
238 : 4 : sal_uInt32 GetTime() const { return mnTime; }
239 : :
240 : 9 : void SetSound(sal_Bool bNewSoundOn) { mbSoundOn = bNewSoundOn; }
241 : 6 : sal_Bool IsSoundOn() const { return mbSoundOn; }
242 : :
243 : 9 : void SetExcluded(sal_Bool bNewExcluded) { mbExcluded = bNewExcluded; }
244 : 1668 : sal_Bool IsExcluded() const { return mbExcluded; }
245 : :
246 : : void SetScaleObjects(sal_Bool bScale) { mbScaleObjects = bScale; }
247 : 0 : sal_Bool IsScaleObjects() const { return mbScaleObjects; }
248 : :
249 : 9 : void SetSoundFile(const String& rStr) { maSoundFile = rStr; }
250 : 0 : String GetSoundFile() const { return maSoundFile; }
251 : :
252 : 0 : void SetLoopSound( bool bLoopSound ) { mbLoopSound = bLoopSound; }
253 : 0 : bool IsLoopSound() const { return mbLoopSound; }
254 : :
255 : 0 : void SetStopSound( bool bStopSound ) { mbStopSound = bStopSound; }
256 : 6 : bool IsStopSound() const { return mbStopSound; }
257 : :
258 : : sal_Int16 getTransitionType() const;
259 : : void setTransitionType( sal_Int16 nTransitionType );
260 : :
261 : : sal_Int16 getTransitionSubtype() const;
262 : : void setTransitionSubtype( sal_Int16 nTransitionSubtype );
263 : :
264 : : sal_Bool getTransitionDirection() const;
265 : : void setTransitionDirection( sal_Bool bTransitionbDirection );
266 : :
267 : : sal_Int32 getTransitionFadeColor() const;
268 : : void setTransitionFadeColor( sal_Int32 nTransitionFadeColor );
269 : :
270 : : double getTransitionDuration() const;
271 : : void setTransitionDuration( double fTranstionDuration );
272 : :
273 : : virtual void Changed(const SdrObject& rObj, SdrUserCallType eType,
274 : : const Rectangle& rOldBoundRect);
275 : :
276 : : void SetLayoutName(String aName);
277 : 3910 : virtual String GetLayoutName() const { return maLayoutName; }
278 : :
279 : 0 : void SetFileName(const String& aName) { maFileName = aName; }
280 : 16 : virtual String GetFileName() const { return maFileName; }
281 : 0 : void SetBookmarkName(const String& aName) { maBookmarkName = aName; }
282 : 0 : virtual String GetBookmarkName() const { return maBookmarkName; }
283 : : SdPageLink* GetLink() { return mpPageLink; }
284 : :
285 : : void ConnectLink();
286 : : void DisconnectLink();
287 : :
288 : : void ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect,
289 : : sal_Bool bScaleAllObj);
290 : :
291 : : const String& GetName() const;
292 : 2843 : String GetRealName() const { return FmFormPage::GetName(); };
293 : :
294 : : void SetPresentationLayout(const String& rLayoutName,
295 : : sal_Bool bReplaceStyleSheets = sal_True,
296 : : sal_Bool bSetMasterPage = sal_True,
297 : : sal_Bool bReverseOrder = sal_False);
298 : : void EndListenOutlineText();
299 : :
300 : : void SetBackgroundFullSize( sal_Bool bIn );
301 : 22 : sal_Bool IsBackgroundFullSize() const { return mbBackgroundFullSize; }
302 : :
303 : : rtl_TextEncoding GetCharSet() { return(meCharSet); }
304 : :
305 : 0 : void SetPaperBin(sal_uInt16 nBin) { mnPaperBin = nBin; }
306 : 0 : sal_uInt16 GetPaperBin() const { return mnPaperBin; }
307 : : virtual void SetOrientation(Orientation eOrient);
308 : : virtual Orientation GetOrientation() const;
309 : :
310 : : virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const;
311 : :
312 : : sal_Bool setAlienAttributes( const com::sun::star::uno::Any& rAttributes );
313 : : void getAlienAttributes( com::sun::star::uno::Any& rAttributes );
314 : :
315 : : /** @return the main animation node */
316 : : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getAnimationNode() throw (::com::sun::star::uno::RuntimeException);
317 : :
318 : : /** sets the main animation node */
319 : : void setAnimationNode( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) throw (::com::sun::star::uno::RuntimeException);
320 : :
321 : : /// @return a helper class to manipulate effects inside the main sequence
322 : : boost::shared_ptr< sd::MainSequence > getMainSequence();
323 : :
324 : : /** quick check if this slide has an animation node.
325 : : This can be used to have a cost free check if there are no animations ad this slide.
326 : : If it returns true this does not mean that there are animations available.
327 : : */
328 : : bool hasAnimationNode() const;
329 : :
330 : : /// @return the SdPage implementation for the given XDrawPage or 0 if not available
331 : : static SdPage* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage );
332 : :
333 : : /** removes all custom animations for the given shape */
334 : : void removeAnimations( const SdrObject* pObj );
335 : :
336 : : /** Set the name of the page and broadcast a model change.
337 : : */
338 : : virtual void SetName (const String& rName);
339 : :
340 : : const sd::HeaderFooterSettings& getHeaderFooterSettings() const;
341 : : void setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings );
342 : :
343 : : /**
344 : : @return true if the object from the ViewObjectContact should
345 : : be visible on this page while rendering.
346 : :
347 : : bEdit selects if visibility test is for an editing view or a final render,
348 : : like printing.
349 : : */
350 : : virtual bool checkVisibility(
351 : : const sdr::contact::ViewObjectContact& rOriginal,
352 : : const sdr::contact::DisplayInfo& rDisplayInfo,
353 : : bool bEdit );
354 : :
355 : : /** callback from the sd::View when a new paragraph for one object on this page is created */
356 : : void onParagraphInserted( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
357 : :
358 : : /** callback from the sd::View when a paragraph from one object on this page is removed */
359 : : void onParagraphRemoving( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
360 : :
361 : : /** callback from the sd::View when an object just left text edit mode */
362 : : void onEndTextEdit( SdrObject* pObj );
363 : :
364 : : /** @return the presentation style with the given helpid from this masterpage or this
365 : : slides masterpage */
366 : : SdStyleSheet* getPresentationStyle( sal_uInt32 nHelpId ) const;
367 : :
368 : : /** removes all empty presentation objects from this slide */
369 : : void RemoveEmptyPresentationObjects();
370 : :
371 : : Rectangle GetTitleRect() const;
372 : : Rectangle GetLayoutRect() const;
373 : :
374 : : static void CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas );
375 : :
376 : : /** Set the "precious" flag to the given value.
377 : : */
378 : : void SetPrecious (const bool bIsPrecious);
379 : :
380 : : /** The "precious" flag is used for master pages to prevent some unused
381 : : master pages from being deleted automatically. For pages
382 : : other than master pages this flag can be ignored.
383 : : @return
384 : : When this method returns <TRUE/> for a master page then this
385 : : master page should not be deleted automatically.
386 : : */
387 : : bool IsPrecious (void) const;
388 : :
389 : : void createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
390 : : void addAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, int nIndex = -1 );
391 : : void removeAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
392 : 194 : const sd::AnnotationVector& getAnnotations() const { return maAnnotations; }
393 : : bool hasAnnotations() const { return !maAnnotations.empty(); }
394 : :
395 : : private:
396 : : bool mbIsPrecious;
397 : :
398 : : /** clone the animations from this and set them to rTargetPage
399 : : */
400 : : void cloneAnimations( SdPage& rTargetPage ) const;
401 : :
402 : : /** called before a shape is removed or replaced from this slide */
403 : : void onRemoveObject( SdrObject* pObject );
404 : : };
405 : :
406 : : #endif // _SDPAGE_HXX
407 : :
408 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|