nss: upgrade to release 3.73
[LibreOffice.git] / sd / inc / sdpage.hxx
bloba70fbf61be8a418b02c0c7a1d9d67317528c9595
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_INC_SDPAGE_HXX
21 #define INCLUDED_SD_INC_SDPAGE_HXX
23 #include <com/sun/star/drawing/XDrawPage.hpp>
24 #include <com/sun/star/presentation/FadeEffect.hpp>
25 #include <com/sun/star/office/XAnnotation.hpp>
27 #include <memory>
28 #include <vector>
29 #include <editeng/flditem.hxx>
30 #include <svx/svdobj.hxx>
31 #include <svx/fmpage.hxx>
32 #include <xmloff/autolayout.hxx>
33 #include "diadef.h"
34 #include "pres.hxx"
35 #include "shapelist.hxx"
36 #include "misc/scopelock.hxx"
37 #include "sddllapi.h"
39 namespace com::sun::star::animations {
40 class XAnimationNode;
43 class SfxStyleSheet;
44 class SdDrawDocument;
45 class SdrTextObj;
46 class SdPageLink;
47 class SfxItemSet;
48 class Paragraph;
49 class Outliner;
50 class SdStyleSheet;
51 class Graphic;
53 namespace sd
55 class MainSequence;
58 namespace sd {
60 struct SD_DLLPUBLIC HeaderFooterSettings
62 bool mbHeaderVisible;
63 OUString maHeaderText;
65 bool mbFooterVisible;
66 OUString maFooterText;
68 bool mbSlideNumberVisible;
70 bool mbDateTimeVisible;
71 bool mbDateTimeIsFixed;
72 OUString maDateTimeText;
73 SvxDateFormat meDateFormat;
74 SvxTimeFormat meTimeFormat;
76 HeaderFooterSettings();
78 bool operator==( const HeaderFooterSettings& rSettings ) const;
81 typedef std::vector< css::uno::Reference< css::office::XAnnotation > > AnnotationVector;
84 namespace sd {
85 class UndoAnimation;
86 class UndoTransition;
87 class UndoGeoObject;
88 class UndoAttrObject;
91 class SD_DLLPUBLIC SdPage final : public FmFormPage, public SdrObjUserCall
93 SdPage& operator=(const SdPage&) = delete;
94 SdPage(const SdPage&) = delete;
96 friend class SdGenericDrawPage;
97 friend class SdDrawPage;
98 friend class sd::UndoAnimation;
99 friend class sd::UndoTransition;
100 friend class ModifyPageUndoAction;
101 friend class sd::UndoGeoObject;
102 friend class sd::UndoAttrObject;
104 PageKind mePageKind; ///< page type
105 AutoLayout meAutoLayout; ///< AutoLayout
106 sd::ShapeList maPresentationShapeList;///< presentation objects
107 sd::ScopeLock maLockAutoLayoutArrangement;
108 bool mbSelected; ///< selection identifier
109 PresChange mePresChange; ///< manual / automatic / semi automatic
110 double mfTime; ///< Display time in seconds
111 bool mbSoundOn; ///< with / without sound.
112 bool mbExcluded; ///< will (not) be displayed during show.
113 OUString maLayoutName; ///< Name of the layout
114 OUString maSoundFile; ///< Path to sound file (MS-DOS notation).
115 bool mbLoopSound;
116 bool mbStopSound;
117 OUString maCreatedPageName; ///< generated page name by GetPageName.
118 OUString maFileName; ///< file name.
119 OUString maBookmarkName; ///< Bookmark name.
120 bool mbScaleObjects; ///< Objects should be scaled
121 bool mbBackgroundFullSize; ///< Background object to represent the whole page.
122 rtl_TextEncoding meCharSet; ///< Text encoding
123 sal_uInt16 mnPaperBin; ///< PaperBin
124 SdPageLink* mpPageLink; ///< Page link (at left sides only)
126 sd::AnnotationVector maAnnotations;
128 /** holds the smil animation sequences for this page */
129 css::uno::Reference< css::animations::XAnimationNode > mxAnimationNode;
131 /** a helper class to manipulate effects inside the main sequence */
132 std::shared_ptr< sd::MainSequence > mpMainSequence;
134 virtual css::uno::Reference< css::uno::XInterface > createUnoPage() override;
136 std::unique_ptr<SfxItemSet> mpItems;
138 SfxItemSet* getOrCreateItems();
140 sd::HeaderFooterSettings maHeaderFooterSettings;
142 // new transition settings
143 sal_Int16 mnTransitionType;
144 sal_Int16 mnTransitionSubtype;
145 bool mbTransitionDirection;
146 sal_Int32 mnTransitionFadeColor;
147 double mfTransitionDuration;
149 void lateInit(const SdPage& rSrcPage);
151 public:
153 SdPage(SdDrawDocument& rNewDoc, bool bMasterPage);
154 virtual ~SdPage() override;
156 virtual SdrPage* CloneSdrPage(SdrModel& rTargetModel) const override;
158 virtual void SetSize(const Size& aSize) override;
159 virtual void SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr) override;
160 virtual void SetLeftBorder(sal_Int32 nBorder) override;
161 virtual void SetRightBorder(sal_Int32 nBorder) override;
162 virtual void SetUpperBorder(sal_Int32 nBorder) override;
163 virtual void SetLowerBorder(sal_Int32 nBorder) override;
164 virtual bool IsReadOnly() const override;
166 sd::ShapeList& GetPresentationShapeList() { return maPresentationShapeList; }
168 void EnsureMasterPageDefaultBackground();
169 SdrObject* CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::tools::Rectangle& rRect);
170 SdrObject* CreateDefaultPresObj(PresObjKind eObjKind);
171 void DestroyDefaultPresObj(PresObjKind eObjKind);
172 SdrObject* GetPresObj(PresObjKind eObjKind, int nIndex = 1, bool bFuzzySearch = false );
173 PresObjKind GetPresObjKind(SdrObject* pObj) const;
174 OUString GetPresObjText(PresObjKind eObjKind) const;
175 SfxStyleSheet* GetStyleSheetForMasterPageBackground() const;
176 SfxStyleSheet* GetStyleSheetForPresObj(PresObjKind eObjKind) const;
177 sal_Int64 GetHashCode() const;
178 bool RestoreDefaultText( SdrObject* pObj );
180 /** @return true if the given SdrObject is inside the presentation object list */
181 bool IsPresObj(const SdrObject* pObj);
183 /** removes the given SdrObject from the presentation object list */
184 void RemovePresObj(const SdrObject* pObj);
186 /** inserts the given SdrObject into the presentation object list */
187 void InsertPresObj(SdrObject* pObj, PresObjKind eKind );
189 void SetAutoLayout(AutoLayout eLayout, bool bInit=false, bool bCreate=false);
190 AutoLayout GetAutoLayout() const { return meAutoLayout; }
191 void CreateTitleAndLayout(bool bInit=false, bool bCreate=false);
192 SdrObject* InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, bool bVertical, const ::tools::Rectangle& rRect, bool bInit);
194 virtual void NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override;
195 virtual SdrObject* NbcRemoveObject(size_t nObjNum) override;
196 virtual SdrObject* RemoveObject(size_t nObjNum) override;
198 /** Also override ReplaceObject methods to realize when
199 objects are removed with this mechanism instead of RemoveObject*/
200 virtual SdrObject* ReplaceObject(SdrObject* pNewObj, size_t nObjNum) override;
202 void SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const OUString& rStr );
204 void SetPageKind(PageKind ePgType) { mePageKind = ePgType; }
205 PageKind GetPageKind() const { return mePageKind; }
207 void SetSelected(bool bSel) { mbSelected = bSel; }
208 bool IsSelected() const { return mbSelected; }
210 void SetFadeEffect(css::presentation::FadeEffect eNewEffect);
211 css::presentation::FadeEffect GetFadeEffect() const;
213 void SetPresChange(PresChange eChange) { mePresChange = eChange; }
214 PresChange GetPresChange() const { return mePresChange; }
216 void SetTime(double fNewTime) { mfTime = fNewTime; }
217 double GetTime() const { return mfTime; }
219 void SetSound(bool bNewSoundOn) { mbSoundOn = bNewSoundOn; }
220 bool IsSoundOn() const { return mbSoundOn; }
222 void SetExcluded(bool bNewExcluded) { mbExcluded = bNewExcluded; }
223 bool IsExcluded() const { return mbExcluded; }
225 bool IsScaleObjects() const { return mbScaleObjects; }
227 void SetSoundFile(const OUString& rStr) { maSoundFile = rStr; }
228 const OUString& GetSoundFile() const { return maSoundFile; }
230 void SetLoopSound( bool bLoopSound ) { mbLoopSound = bLoopSound; }
231 bool IsLoopSound() const { return mbLoopSound; }
233 void SetStopSound( bool bStopSound ) { mbStopSound = bStopSound; }
234 bool IsStopSound() const { return mbStopSound; }
236 sal_Int16 getTransitionType() const { return mnTransitionType;}
237 void setTransitionType( sal_Int16 nTransitionType );
239 sal_Int16 getTransitionSubtype() const { return mnTransitionSubtype;}
240 void setTransitionSubtype( sal_Int16 nTransitionSubtype );
242 bool getTransitionDirection() const { return mbTransitionDirection;}
243 void setTransitionDirection( bool bTransitionbDirection );
245 sal_Int32 getTransitionFadeColor() const { return mnTransitionFadeColor;}
246 void setTransitionFadeColor( sal_Int32 nTransitionFadeColor );
248 double getTransitionDuration() const { return mfTransitionDuration;}
249 void setTransitionDuration( double fTransitionDuration );
251 virtual void Changed(const SdrObject& rObj, SdrUserCallType eType,
252 const ::tools::Rectangle& rOldBoundRect) override;
254 void SetLayoutName(const OUString& aName);
255 virtual OUString GetLayoutName() const override { return maLayoutName; }
257 void SetFileName(const OUString& aName) { maFileName = aName; }
258 const OUString& GetFileName() const { return maFileName; }
259 void SetBookmarkName(const OUString& aName) { maBookmarkName = aName; }
260 const OUString& GetBookmarkName() const { return maBookmarkName; }
262 void ConnectLink();
263 void DisconnectLink();
265 void ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rNewBorderRect,
266 bool bScaleAllObj);
268 const OUString& GetName() const;
269 OUString const & GetRealName() const { return FmFormPage::GetName(); };
271 void SetPresentationLayout(const OUString& rLayoutName,
272 bool bReplaceStyleSheets = true,
273 bool bSetMasterPage = true,
274 bool bReverseOrder = false);
275 void EndListenOutlineText();
277 void SetBackgroundFullSize( bool bIn );
278 bool IsBackgroundFullSize() const { return mbBackgroundFullSize; }
280 void SetPaperBin(sal_uInt16 nBin) { mnPaperBin = nBin; }
281 sal_uInt16 GetPaperBin() const { return mnPaperBin; }
282 virtual void SetOrientation(Orientation eOrient) override;
283 virtual Orientation GetOrientation() const override;
285 virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const override;
287 bool setAlienAttributes( const css::uno::Any& rAttributes );
288 void getAlienAttributes( css::uno::Any& rAttributes );
290 /** @return the main animation node
292 @throws css::uno::RuntimeException
294 css::uno::Reference< css::animations::XAnimationNode > const & getAnimationNode();
296 /** sets the main animation node
298 @throws css::uno::RuntimeException
300 void setAnimationNode( css::uno::Reference< css::animations::XAnimationNode > const & xNode );
302 /// @return a helper class to manipulate effects inside the main sequence
303 std::shared_ptr< sd::MainSequence > const & getMainSequence();
305 /** quick check if this slide has an animation node.
306 This can be used to have a cost free check if there are no animations ad this slide.
307 If it returns true this does not mean that there are animations available.
309 bool hasAnimationNode() const;
311 /// @return the SdPage implementation for the given XDrawPage or 0 if not available
312 static SdPage* getImplementation( const css::uno::Reference< css::drawing::XDrawPage >& xPage );
314 /** removes all custom animations for the given shape */
315 void removeAnimations( const SdrObject* pObj );
317 /** Notify that the object has been renamed and the animation effects has to update. */
318 void notifyObjectRenamed(const SdrObject* pObj);
320 /** Set the name of the page and broadcast a model change.
322 void SetName (const OUString& rName);
324 const sd::HeaderFooterSettings& getHeaderFooterSettings() const;
325 void setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings );
328 @return true if the object from the ViewObjectContact should
329 be visible on this page while rendering.
331 bEdit selects if visibility test is for an editing view or a final render,
332 like printing.
334 virtual bool checkVisibility(
335 const sdr::contact::ViewObjectContact& rOriginal,
336 const sdr::contact::DisplayInfo& rDisplayInfo,
337 bool bEdit ) override;
339 /** callback from the sd::View when a new paragraph for one object on this page is created */
340 void onParagraphInserted( ::Outliner* pOutliner, Paragraph const * pPara, SdrObject* pObj );
342 /** callback from the sd::View when a paragraph from one object on this page is removed */
343 void onParagraphRemoving( ::Outliner* pOutliner, Paragraph const * pPara, SdrObject* pObj );
345 /** callback from the sd::View when an object just left text edit mode */
346 void onEndTextEdit( SdrObject* pObj );
348 /** @return the presentation style with the given helpid from this masterpage or this
349 slides masterpage */
350 SdStyleSheet* getPresentationStyle( sal_uInt32 nHelpId ) const;
352 /** removes all empty presentation objects from this slide */
353 void RemoveEmptyPresentationObjects();
355 ::tools::Rectangle GetTitleRect() const;
356 ::tools::Rectangle GetLayoutRect() const;
358 static void CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< ::tools::Rectangle >& rAreas );
360 /** Set the "precious" flag to the given value.
362 void SetPrecious (const bool bIsPrecious);
364 /** The "precious" flag is used for master pages to prevent some unused
365 master pages from being deleted automatically. For pages
366 other than master pages this flag can be ignored.
367 @return
368 When this method returns <TRUE/> for a master page then this
369 master page should not be deleted automatically.
371 bool IsPrecious() const { return mbIsPrecious; }
373 void createAnnotation( css::uno::Reference< css::office::XAnnotation >& xAnnotation );
374 void addAnnotation( const css::uno::Reference< css::office::XAnnotation >& xAnnotation, int nIndex );
375 void removeAnnotation( const css::uno::Reference< css::office::XAnnotation >& xAnnotation );
376 const sd::AnnotationVector& getAnnotations() const { return maAnnotations; }
377 bool Equals(const SdPage&) const;
378 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
379 sal_uInt16 getPageId() const { return mnPageId; }
382 Returns graphics objects from the page that can be prefetched before it's painted.
383 The pointers are temporary and should not be kept.
385 void getGraphicsForPrefetch(std::vector<Graphic*>& graphics) const;
387 static sal_uInt16 mnLastPageId;
389 private:
390 bool mbIsPrecious;
392 // page id of this page
393 sal_uInt16 mnPageId;
395 /** clone the animations from this and set them to rTargetPage
396 * TTTT: Order is strange, should be the other way around by
397 * convention/convenience and makes usage a little dangerous...
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 // INCLUDED_SD_INC_SDPAGE_HXX
407 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */