Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SDPAGE_HXX
21 : #define _SDPAGE_HXX
22 :
23 : #include <boost/shared_ptr.hpp>
24 :
25 : #include <functional>
26 : #include <com/sun/star/drawing/XDrawPage.hpp>
27 : #include <com/sun/star/presentation/FadeEffect.hpp>
28 : #include <com/sun/star/office/XAnnotation.hpp>
29 :
30 : #include <list>
31 : #include <vector>
32 : #include <svx/svdobj.hxx>
33 : #include <svx/fmpage.hxx>
34 : #include "fadedef.h"
35 : #include "diadef.h"
36 : #ifndef _PRESENTATION
37 : #include "pres.hxx"
38 : #endif
39 : #include "shapelist.hxx"
40 : #include "misc/scopelock.hxx"
41 : #include "sddllapi.h"
42 :
43 : namespace com { namespace sun { namespace star { namespace animations {
44 : class XAnimationNode;
45 : } } } }
46 :
47 : class SfxStyleSheet;
48 : class SdDrawDocument;
49 : class SdrTextObj;
50 : class SdPageLink;
51 : class StarBASIC;
52 : class SfxItemSet;
53 : struct StyleRequestData;
54 : class SdPage;
55 : class Paragraph;
56 : class Outliner;
57 : class SdStyleSheet;
58 :
59 : namespace sd
60 : {
61 : class MainSequence;
62 : }
63 :
64 : namespace boost
65 : {
66 : template<class X> class shared_ptr;
67 : }
68 :
69 : namespace sd {
70 :
71 900 : struct SD_DLLPUBLIC HeaderFooterSettings
72 : {
73 : bool mbHeaderVisible;
74 : String maHeaderText;
75 :
76 : bool mbFooterVisible;
77 : String maFooterText;
78 :
79 : bool mbSlideNumberVisible;
80 :
81 : bool mbDateTimeVisible;
82 : bool mbDateTimeIsFixed;
83 : String maDateTimeText;
84 : int meDateTimeFormat;
85 :
86 : HeaderFooterSettings();
87 :
88 : bool operator==( const HeaderFooterSettings& rSettings ) const;
89 : };
90 :
91 : typedef std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > > AnnotationVector;
92 : }
93 :
94 : namespace sd {
95 : class UndoAnimation;
96 : class UndoTransition;
97 : class UndoGeoObject;
98 : class UndoAttrObject;
99 : }
100 :
101 : class SD_DLLPUBLIC SdPage : public FmFormPage, public SdrObjUserCall
102 : {
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;
110 :
111 : protected:
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).
123 : bool mbLoopSound;
124 : bool mbStopSound;
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)
134 :
135 : sd::AnnotationVector maAnnotations;
136 :
137 : /** holds the smil animation sequences for this page */
138 : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxAnimationNode;
139 :
140 : /** a helper class to manipulate effects inside the main sequence */
141 : boost::shared_ptr< sd::MainSequence > mpMainSequence;
142 :
143 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoPage();
144 :
145 : SfxItemSet* mpItems;
146 :
147 : SfxItemSet* getOrCreateItems();
148 :
149 : sd::HeaderFooterSettings maHeaderFooterSettings;
150 :
151 : // new transition settings
152 : sal_Int16 mnTransitionType;
153 : sal_Int16 mnTransitionSubtype;
154 : sal_Bool mbTransitionDirection;
155 : sal_Int32 mnTransitionFadeColor;
156 : double mfTransitionDuration;
157 :
158 : public:
159 : TYPEINFO();
160 :
161 : SdPage(SdDrawDocument& rNewDoc, StarBASIC* pBasic, sal_Bool bMasterPage=sal_False);
162 : SdPage(const SdPage& rSrcPage);
163 : ~SdPage();
164 : virtual SdrPage* Clone() const;
165 : virtual SdrPage* Clone(SdrModel* pNewModel) const;
166 :
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;
175 :
176 0 : sd::ShapeList& GetPresentationShapeList() { return maPresentationShapeList; }
177 :
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 );
187 :
188 : /** @return true if the given SdrObject is inside the presentation object list */
189 : bool IsPresObj(const SdrObject* pObj);
190 :
191 : /** removes the given SdrObject from the presentation object list */
192 : void RemovePresObj(const SdrObject* pObj);
193 :
194 : /** inserts the given SdrObject into the presentation object list */
195 : void InsertPresObj(SdrObject* pObj, PresObjKind eKind );
196 :
197 : void SetAutoLayout(AutoLayout eLayout, sal_Bool bInit=sal_False, sal_Bool bCreate=sal_False);
198 157 : 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 );
201 :
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);
206 :
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);
211 :
212 : virtual void SetLinkData(const String& rLinkName, const String& rLinkData);
213 :
214 : void SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const String& rStr );
215 :
216 157 : void SetPageKind(PageKind ePgType) { mePageKind = ePgType; }
217 2081 : PageKind GetPageKind() const { return mePageKind; }
218 :
219 0 : void SetSelected(sal_Bool bSel) { mbSelected = bSel; }
220 0 : sal_Bool IsSelected() const { return mbSelected; }
221 :
222 : void SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect);
223 : ::com::sun::star::presentation::FadeEffect GetFadeEffect() const;
224 :
225 5 : void SetPresChange(PresChange eChange) { mePresChange = eChange; }
226 0 : PresChange GetPresChange() const { return mePresChange; }
227 :
228 0 : void SetTime(sal_uInt32 nNewTime) { mnTime = nNewTime; }
229 0 : sal_uInt32 GetTime() const { return mnTime; }
230 :
231 3 : void SetSound(sal_Bool bNewSoundOn) { mbSoundOn = bNewSoundOn; }
232 0 : sal_Bool IsSoundOn() const { return mbSoundOn; }
233 :
234 4 : void SetExcluded(sal_Bool bNewExcluded) { mbExcluded = bNewExcluded; }
235 0 : sal_Bool IsExcluded() const { return mbExcluded; }
236 :
237 : void SetScaleObjects(sal_Bool bScale) { mbScaleObjects = bScale; }
238 0 : sal_Bool IsScaleObjects() const { return mbScaleObjects; }
239 :
240 3 : void SetSoundFile(const String& rStr) { maSoundFile = rStr; }
241 0 : String GetSoundFile() const { return maSoundFile; }
242 :
243 0 : void SetLoopSound( bool bLoopSound ) { mbLoopSound = bLoopSound; }
244 0 : bool IsLoopSound() const { return mbLoopSound; }
245 :
246 0 : void SetStopSound( bool bStopSound ) { mbStopSound = bStopSound; }
247 0 : bool IsStopSound() const { return mbStopSound; }
248 :
249 : sal_Int16 getTransitionType() const;
250 : void setTransitionType( sal_Int16 nTransitionType );
251 :
252 : sal_Int16 getTransitionSubtype() const;
253 : void setTransitionSubtype( sal_Int16 nTransitionSubtype );
254 :
255 : sal_Bool getTransitionDirection() const;
256 : void setTransitionDirection( sal_Bool bTransitionbDirection );
257 :
258 : sal_Int32 getTransitionFadeColor() const;
259 : void setTransitionFadeColor( sal_Int32 nTransitionFadeColor );
260 :
261 : double getTransitionDuration() const;
262 : void setTransitionDuration( double fTranstionDuration );
263 :
264 : virtual void Changed(const SdrObject& rObj, SdrUserCallType eType,
265 : const Rectangle& rOldBoundRect);
266 :
267 : void SetLayoutName(OUString aName);
268 1189 : virtual OUString GetLayoutName() const { return maLayoutName; }
269 :
270 0 : void SetFileName(const String& aName) { maFileName = aName; }
271 1 : virtual String GetFileName() const { return maFileName; }
272 0 : void SetBookmarkName(const String& aName) { maBookmarkName = aName; }
273 0 : virtual String GetBookmarkName() const { return maBookmarkName; }
274 : SdPageLink* GetLink() { return mpPageLink; }
275 :
276 : void ConnectLink();
277 : void DisconnectLink();
278 :
279 : void ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect,
280 : sal_Bool bScaleAllObj);
281 :
282 : const String& GetName() const;
283 114 : String GetRealName() const { return FmFormPage::GetName(); };
284 :
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();
290 :
291 : void SetBackgroundFullSize( sal_Bool bIn );
292 0 : sal_Bool IsBackgroundFullSize() const { return mbBackgroundFullSize; }
293 :
294 : rtl_TextEncoding GetCharSet() { return(meCharSet); }
295 :
296 0 : void SetPaperBin(sal_uInt16 nBin) { mnPaperBin = nBin; }
297 0 : sal_uInt16 GetPaperBin() const { return mnPaperBin; }
298 : virtual void SetOrientation(Orientation eOrient);
299 : virtual Orientation GetOrientation() const;
300 :
301 : virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const;
302 :
303 : sal_Bool setAlienAttributes( const com::sun::star::uno::Any& rAttributes );
304 : void getAlienAttributes( com::sun::star::uno::Any& rAttributes );
305 :
306 : /** @return the main animation node */
307 : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getAnimationNode() throw (::com::sun::star::uno::RuntimeException);
308 :
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);
311 :
312 : /// @return a helper class to manipulate effects inside the main sequence
313 : boost::shared_ptr< sd::MainSequence > getMainSequence();
314 :
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.
318 : */
319 : bool hasAnimationNode() const;
320 :
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 );
323 :
324 : /** removes all custom animations for the given shape */
325 : void removeAnimations( const SdrObject* pObj );
326 :
327 : /** Set the name of the page and broadcast a model change.
328 : */
329 : virtual void SetName (const String& rName);
330 :
331 : const sd::HeaderFooterSettings& getHeaderFooterSettings() const;
332 : void setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings );
333 :
334 : /**
335 : @return true if the object from the ViewObjectContact should
336 : be visible on this page while rendering.
337 :
338 : bEdit selects if visibility test is for an editing view or a final render,
339 : like printing.
340 : */
341 : virtual bool checkVisibility(
342 : const sdr::contact::ViewObjectContact& rOriginal,
343 : const sdr::contact::DisplayInfo& rDisplayInfo,
344 : bool bEdit );
345 :
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 );
348 :
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 );
351 :
352 : /** callback from the sd::View when an object just left text edit mode */
353 : void onEndTextEdit( SdrObject* pObj );
354 :
355 : /** @return the presentation style with the given helpid from this masterpage or this
356 : slides masterpage */
357 : SdStyleSheet* getPresentationStyle( sal_uInt32 nHelpId ) const;
358 :
359 : /** removes all empty presentation objects from this slide */
360 : void RemoveEmptyPresentationObjects();
361 :
362 : Rectangle GetTitleRect() const;
363 : Rectangle GetLayoutRect() const;
364 :
365 : static void CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas );
366 :
367 : /** Set the "precious" flag to the given value.
368 : */
369 : void SetPrecious (const bool bIsPrecious);
370 :
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.
374 : @return
375 : When this method returns <TRUE/> for a master page then this
376 : master page should not be deleted automatically.
377 : */
378 : bool IsPrecious (void) const;
379 :
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 0 : const sd::AnnotationVector& getAnnotations() const { return maAnnotations; }
384 : bool hasAnnotations() const { return !maAnnotations.empty(); }
385 :
386 : private:
387 : bool mbIsPrecious;
388 :
389 : /** clone the animations from this and set them to rTargetPage
390 : */
391 : void cloneAnimations( SdPage& rTargetPage ) const;
392 :
393 : /** called before a shape is removed or replaced from this slide */
394 : void onRemoveObject( SdrObject* pObject );
395 : };
396 :
397 : #endif // _SDPAGE_HXX
398 :
399 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|