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 INCLUDED_SD_INC_SDPAGE_HXX
21 : #define INCLUDED_SD_INC_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 : #include "pres.hxx"
37 : #include "shapelist.hxx"
38 : #include "misc/scopelock.hxx"
39 : #include "sddllapi.h"
40 :
41 : namespace com { namespace sun { namespace star { namespace animations {
42 : class XAnimationNode;
43 : } } } }
44 :
45 : class SfxStyleSheet;
46 : class SdDrawDocument;
47 : class SdrTextObj;
48 : class SdPageLink;
49 : class StarBASIC;
50 : class SfxItemSet;
51 : struct StyleRequestData;
52 : class SdPage;
53 : class Paragraph;
54 : class Outliner;
55 : class SdStyleSheet;
56 :
57 : namespace sd
58 : {
59 : class MainSequence;
60 : }
61 :
62 : namespace boost
63 : {
64 : template<class X> class shared_ptr;
65 : }
66 :
67 : namespace sd {
68 :
69 5351 : struct SD_DLLPUBLIC HeaderFooterSettings
70 : {
71 : bool mbHeaderVisible;
72 : OUString maHeaderText;
73 :
74 : bool mbFooterVisible;
75 : OUString maFooterText;
76 :
77 : bool mbSlideNumberVisible;
78 :
79 : bool mbDateTimeVisible;
80 : bool mbDateTimeIsFixed;
81 : OUString maDateTimeText;
82 : int meDateTimeFormat;
83 :
84 : HeaderFooterSettings();
85 :
86 : bool operator==( const HeaderFooterSettings& rSettings ) const;
87 : };
88 :
89 : typedef std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > > AnnotationVector;
90 : }
91 :
92 : namespace sd {
93 : class UndoAnimation;
94 : class UndoTransition;
95 : class UndoGeoObject;
96 : class UndoAttrObject;
97 : }
98 :
99 : class SD_DLLPUBLIC SdPage : public FmFormPage, public SdrObjUserCall
100 : {
101 : SdPage& operator=(const SdPage&) SAL_DELETED_FUNCTION;
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 : bool mbSelected; ///< selection identifier
117 : PresChange mePresChange; ///< manual / automatic / semi automatic
118 : double mfTime; ///< Display time in seconds
119 : bool mbSoundOn; ///< with / without sound.
120 : bool mbExcluded; ///< will (not) be displayed during show.
121 : OUString maLayoutName; ///< Name of the layout
122 : OUString maSoundFile; ///< Path to sound file (MSDOS notation).
123 : bool mbLoopSound;
124 : bool mbStopSound;
125 : OUString maCreatedPageName; ///< generated page name by GetPageName.
126 : OUString maFileName; ///< file name.
127 : OUString maBookmarkName; ///< Bookmark name.
128 : bool mbScaleObjects; ///< Objects should be scaled
129 : 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() SAL_OVERRIDE;
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 : bool mbTransitionDirection;
155 : sal_Int32 mnTransitionFadeColor;
156 : double mfTransitionDuration;
157 :
158 : SdPage(const SdPage& rSrcPage);
159 : void lateInit(const SdPage& rSrcPage);
160 :
161 : public:
162 : TYPEINFO_OVERRIDE();
163 :
164 : SdPage(SdDrawDocument& rNewDoc, bool bMasterPage=false);
165 : virtual ~SdPage();
166 : virtual SdrPage* Clone() const SAL_OVERRIDE;
167 : virtual SdrPage* Clone(SdrModel* pNewModel) const SAL_OVERRIDE;
168 :
169 : virtual void SetSize(const Size& aSize) SAL_OVERRIDE;
170 : virtual void SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr) SAL_OVERRIDE;
171 : virtual void SetLftBorder(sal_Int32 nBorder) SAL_OVERRIDE;
172 : virtual void SetRgtBorder(sal_Int32 nBorder) SAL_OVERRIDE;
173 : virtual void SetUppBorder(sal_Int32 nBorder) SAL_OVERRIDE;
174 : virtual void SetLwrBorder(sal_Int32 nBorder) SAL_OVERRIDE;
175 : virtual void SetModel(SdrModel* pNewModel) SAL_OVERRIDE;
176 : virtual bool IsReadOnly() const SAL_OVERRIDE;
177 :
178 330 : sd::ShapeList& GetPresentationShapeList() { return maPresentationShapeList; }
179 :
180 : void EnsureMasterPageDefaultBackground();
181 : SdrObject* CreatePresObj(PresObjKind eObjKind, bool bVertical, const Rectangle& rRect, bool bInsert=false);
182 : SdrObject* CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert);
183 : void DestroyDefaultPresObj(PresObjKind eObjKind);
184 : SdrObject* GetPresObj(PresObjKind eObjKind, int nIndex = 1, bool bFuzzySearch = false );
185 : PresObjKind GetPresObjKind(SdrObject* pObj) const;
186 : OUString GetPresObjText(PresObjKind eObjKind) const;
187 : SfxStyleSheet* GetStyleSheetForMasterPageBackground() const;
188 : SfxStyleSheet* GetStyleSheetForPresObj(PresObjKind eObjKind) const;
189 : bool RestoreDefaultText( SdrObject* pObj );
190 :
191 : /** @return true if the given SdrObject is inside the presentation object list */
192 : bool IsPresObj(const SdrObject* pObj);
193 :
194 : /** removes the given SdrObject from the presentation object list */
195 : void RemovePresObj(const SdrObject* pObj);
196 :
197 : /** inserts the given SdrObject into the presentation object list */
198 : void InsertPresObj(SdrObject* pObj, PresObjKind eKind );
199 :
200 : void SetAutoLayout(AutoLayout eLayout, bool bInit=false, bool bCreate=false);
201 3320 : AutoLayout GetAutoLayout() const { return meAutoLayout; }
202 : void CreateTitleAndLayout(bool bInit=false, bool bCreate=false);
203 : SdrObject* InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, bool bVertical, const Rectangle& rRect, bool bInit);
204 :
205 : virtual void NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE,
206 : const SdrInsertReason* pReason=NULL) SAL_OVERRIDE;
207 : virtual SdrObject* NbcRemoveObject(size_t nObjNum) SAL_OVERRIDE;
208 : virtual SdrObject* RemoveObject(size_t nObjNum) SAL_OVERRIDE;
209 :
210 : /** Also override ReplaceObject methods to realize when
211 : objects are removed with this mechanism instead of RemoveObject*/
212 : virtual SdrObject* NbcReplaceObject(SdrObject* pNewObj, size_t nObjNum) SAL_OVERRIDE;
213 : virtual SdrObject* ReplaceObject(SdrObject* pNewObj, size_t nObjNum) SAL_OVERRIDE;
214 :
215 : void SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const OUString& rStr );
216 :
217 1549 : void SetPageKind(PageKind ePgType) { mePageKind = ePgType; }
218 19510 : PageKind GetPageKind() const { return mePageKind; }
219 :
220 2412 : void SetSelected(bool bSel) { mbSelected = bSel; }
221 596 : bool IsSelected() const { return mbSelected; }
222 :
223 : void SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect);
224 : ::com::sun::star::presentation::FadeEffect GetFadeEffect() const;
225 :
226 14 : void SetPresChange(PresChange eChange) { mePresChange = eChange; }
227 14 : PresChange GetPresChange() const { return mePresChange; }
228 :
229 0 : void SetTime(double fNewTime) { mfTime = fNewTime; }
230 14 : double GetTime() const { return mfTime; }
231 :
232 10 : void SetSound(bool bNewSoundOn) { mbSoundOn = bNewSoundOn; }
233 23 : bool IsSoundOn() const { return mbSoundOn; }
234 :
235 94 : void SetExcluded(bool bNewExcluded) { mbExcluded = bNewExcluded; }
236 933 : bool IsExcluded() const { return mbExcluded; }
237 :
238 : void SetScaleObjects(bool bScale) { mbScaleObjects = bScale; }
239 0 : bool IsScaleObjects() const { return mbScaleObjects; }
240 :
241 10 : void SetSoundFile(const OUString& rStr) { maSoundFile = rStr; }
242 0 : OUString GetSoundFile() const { return maSoundFile; }
243 :
244 0 : void SetLoopSound( bool bLoopSound ) { mbLoopSound = bLoopSound; }
245 5 : bool IsLoopSound() const { return mbLoopSound; }
246 :
247 0 : void SetStopSound( bool bStopSound ) { mbStopSound = bStopSound; }
248 23 : bool IsStopSound() const { return mbStopSound; }
249 :
250 4932 : sal_Int16 getTransitionType() const { return mnTransitionType;}
251 : void setTransitionType( sal_Int16 nTransitionType );
252 :
253 42 : sal_Int16 getTransitionSubtype() const { return mnTransitionSubtype;}
254 : void setTransitionSubtype( sal_Int16 nTransitionSubtype );
255 :
256 9 : bool getTransitionDirection() const { return mbTransitionDirection;}
257 : void setTransitionDirection( bool bTransitionbDirection );
258 :
259 9 : sal_Int32 getTransitionFadeColor() const { return mnTransitionFadeColor;}
260 : void setTransitionFadeColor( sal_Int32 nTransitionFadeColor );
261 :
262 14 : double getTransitionDuration() const { return mfTransitionDuration;}
263 : void setTransitionDuration( double fTranstionDuration );
264 :
265 : virtual void Changed(const SdrObject& rObj, SdrUserCallType eType,
266 : const Rectangle& rOldBoundRect) SAL_OVERRIDE;
267 :
268 : void SetLayoutName(const OUString& aName);
269 21676 : virtual OUString GetLayoutName() const SAL_OVERRIDE { return maLayoutName; }
270 :
271 0 : void SetFileName(const OUString& aName) { maFileName = aName; }
272 22 : OUString GetFileName() const { return maFileName; }
273 0 : void SetBookmarkName(const OUString& aName) { maBookmarkName = aName; }
274 0 : OUString GetBookmarkName() const { return maBookmarkName; }
275 : SdPageLink* GetLink() { return mpPageLink; }
276 :
277 : void ConnectLink();
278 : void DisconnectLink();
279 :
280 : void ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect,
281 : bool bScaleAllObj);
282 :
283 : const OUString& GetName() const;
284 5801 : OUString GetRealName() const { return FmFormPage::GetName(); };
285 :
286 : void SetPresentationLayout(const OUString& rLayoutName,
287 : bool bReplaceStyleSheets = true,
288 : bool bSetMasterPage = true,
289 : bool bReverseOrder = false);
290 : void EndListenOutlineText();
291 :
292 : void SetBackgroundFullSize( bool bIn );
293 15 : bool IsBackgroundFullSize() const { return mbBackgroundFullSize; }
294 :
295 : rtl_TextEncoding GetCharSet() { return meCharSet; }
296 :
297 0 : void SetPaperBin(sal_uInt16 nBin) { mnPaperBin = nBin; }
298 0 : sal_uInt16 GetPaperBin() const { return mnPaperBin; }
299 : virtual void SetOrientation(Orientation eOrient) SAL_OVERRIDE;
300 : virtual Orientation GetOrientation() const SAL_OVERRIDE;
301 :
302 : virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const SAL_OVERRIDE;
303 :
304 : bool setAlienAttributes( const com::sun::star::uno::Any& rAttributes );
305 : void getAlienAttributes( com::sun::star::uno::Any& rAttributes );
306 :
307 : /** @return the main animation node */
308 : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getAnimationNode() throw (::com::sun::star::uno::RuntimeException);
309 :
310 : /** sets the main animation node */
311 : void setAnimationNode( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) throw (::com::sun::star::uno::RuntimeException);
312 :
313 : /// @return a helper class to manipulate effects inside the main sequence
314 : boost::shared_ptr< sd::MainSequence > getMainSequence();
315 :
316 : /** quick check if this slide has an animation node.
317 : This can be used to have a cost free check if there are no animations ad this slide.
318 : If it returns true this does not mean that there are animations available.
319 : */
320 : bool hasAnimationNode() const;
321 :
322 : /// @return the SdPage implementation for the given XDrawPage or 0 if not available
323 : static SdPage* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage );
324 :
325 : /** removes all custom animations for the given shape */
326 : void removeAnimations( const SdrObject* pObj );
327 :
328 : /** Set the name of the page and broadcast a model change.
329 : */
330 : void SetName (const OUString& rName);
331 :
332 : const sd::HeaderFooterSettings& getHeaderFooterSettings() const;
333 : void setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings );
334 :
335 : /**
336 : @return true if the object from the ViewObjectContact should
337 : be visible on this page while rendering.
338 :
339 : bEdit selects if visibility test is for an editing view or a final render,
340 : like printing.
341 : */
342 : virtual bool checkVisibility(
343 : const sdr::contact::ViewObjectContact& rOriginal,
344 : const sdr::contact::DisplayInfo& rDisplayInfo,
345 : bool bEdit ) SAL_OVERRIDE;
346 :
347 : /** callback from the sd::View when a new paragraph for one object on this page is created */
348 : void onParagraphInserted( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
349 :
350 : /** callback from the sd::View when a paragraph from one object on this page is removed */
351 : void onParagraphRemoving( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
352 :
353 : /** callback from the sd::View when an object just left text edit mode */
354 : void onEndTextEdit( SdrObject* pObj );
355 :
356 : /** @return the presentation style with the given helpid from this masterpage or this
357 : slides masterpage */
358 : SdStyleSheet* getPresentationStyle( sal_uInt32 nHelpId ) const;
359 :
360 : /** removes all empty presentation objects from this slide */
361 : void RemoveEmptyPresentationObjects();
362 :
363 : Rectangle GetTitleRect() const;
364 : Rectangle GetLayoutRect() const;
365 :
366 : static void CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas );
367 :
368 : /** Set the "precious" flag to the given value.
369 : */
370 : void SetPrecious (const bool bIsPrecious);
371 :
372 : /** The "precious" flag is used for master pages to prevent some unused
373 : master pages from being deleted automatically. For pages
374 : other than master pages this flag can be ignored.
375 : @return
376 : When this method returns <TRUE/> for a master page then this
377 : master page should not be deleted automatically.
378 : */
379 0 : bool IsPrecious() const { return mbIsPrecious; }
380 :
381 : void createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
382 : void addAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, int nIndex = -1 );
383 : void removeAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
384 260 : const sd::AnnotationVector& getAnnotations() const { return maAnnotations; }
385 : bool hasAnnotations() const { return !maAnnotations.empty(); }
386 : sal_Int32 getHash() const;
387 : OString stringify() const;
388 :
389 : private:
390 : bool mbIsPrecious;
391 :
392 : /** clone the animations from this and set them to rTargetPage
393 : */
394 : void cloneAnimations( SdPage& rTargetPage ) const;
395 :
396 : /** called before a shape is removed or replaced from this slide */
397 : void onRemoveObject( SdrObject* pObject );
398 : };
399 :
400 : #endif // INCLUDED_SD_INC_SDPAGE_HXX
401 :
402 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|