LCOV - code coverage report
Current view: top level - sd/inc - sdpage.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 26 38 68.4 %
Date: 2014-11-03 Functions: 28 40 70.0 %
Legend: Lines: hit not hit

          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        6652 :     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             : friend class SdGenericDrawPage;
     102             : friend class SdDrawPage;
     103             : friend class sd::UndoAnimation;
     104             : friend class sd::UndoTransition;
     105             : friend class ModifyPageUndoAction;
     106             : friend class sd::UndoGeoObject;
     107             : friend class sd::UndoAttrObject;
     108             : 
     109             : protected:
     110             :     PageKind    mePageKind;               ///< page type
     111             :     AutoLayout  meAutoLayout;             ///< AutoLayout
     112             :     sd::ShapeList maPresentationShapeList;///< presentation objects
     113             :     sd::ScopeLock maLockAutoLayoutArrangement;
     114             :     bool    mbSelected;               ///< selection identifier
     115             :     PresChange  mePresChange;             ///< manual / automatic / semi automatic
     116             :     double      mfTime;                   ///< Display time in seconds
     117             :     bool    mbSoundOn;                ///< with / without sound.
     118             :     bool    mbExcluded;               ///< will (not) be displayed during show.
     119             :     OUString    maLayoutName;             ///< Name of the layout
     120             :     OUString    maSoundFile;              ///< Path to sound file (MSDOS notation).
     121             :     bool        mbLoopSound;
     122             :     bool        mbStopSound;
     123             :     OUString    maCreatedPageName;        ///< generated page name by GetPageName.
     124             :     OUString    maFileName;               ///< file name.
     125             :     OUString    maBookmarkName;           ///< Bookmark name.
     126             :     bool    mbScaleObjects;           ///< Objects should be scaled
     127             :     bool    mbBackgroundFullSize;     ///< Background object to represent the whole page.
     128             :     rtl_TextEncoding meCharSet;           ///< Text encoding
     129             :     sal_uInt16  mnPaperBin;               ///< PaperBin
     130             :     Orientation meOrientation;            ///< Print orientation.
     131             :     SdPageLink* mpPageLink;               ///< Page link (at left sides only)
     132             : 
     133             :     sd::AnnotationVector    maAnnotations;
     134             : 
     135             :     /** holds the smil animation sequences for this page */
     136             :     ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxAnimationNode;
     137             : 
     138             :     /** a helper class to manipulate effects inside the main sequence */
     139             :     boost::shared_ptr< sd::MainSequence > mpMainSequence;
     140             : 
     141             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoPage() SAL_OVERRIDE;
     142             : 
     143             :     SfxItemSet* mpItems;
     144             : 
     145             :     SfxItemSet* getOrCreateItems();
     146             : 
     147             :     sd::HeaderFooterSettings    maHeaderFooterSettings;
     148             : 
     149             :     // new transition settings
     150             :     sal_Int16 mnTransitionType;
     151             :     sal_Int16 mnTransitionSubtype;
     152             :     bool mbTransitionDirection;
     153             :     sal_Int32 mnTransitionFadeColor;
     154             :     double mfTransitionDuration;
     155             : 
     156             : public:
     157             :     TYPEINFO_OVERRIDE();
     158             : 
     159             :     SdPage(SdDrawDocument& rNewDoc, bool bMasterPage=false);
     160             :     SdPage(const SdPage& rSrcPage);
     161             :     virtual ~SdPage();
     162             :     virtual SdrPage* Clone() const SAL_OVERRIDE;
     163             :     virtual SdrPage* Clone(SdrModel* pNewModel) const SAL_OVERRIDE;
     164             : 
     165             :     virtual void    SetSize(const Size& aSize) SAL_OVERRIDE;
     166             :     virtual void    SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr) SAL_OVERRIDE;
     167             :     virtual void    SetLftBorder(sal_Int32 nBorder) SAL_OVERRIDE;
     168             :     virtual void    SetRgtBorder(sal_Int32 nBorder) SAL_OVERRIDE;
     169             :     virtual void    SetUppBorder(sal_Int32 nBorder) SAL_OVERRIDE;
     170             :     virtual void    SetLwrBorder(sal_Int32 nBorder) SAL_OVERRIDE;
     171             :     virtual void    SetModel(SdrModel* pNewModel) SAL_OVERRIDE;
     172             :     virtual bool    IsReadOnly() const SAL_OVERRIDE;
     173             : 
     174         708 :     sd::ShapeList&  GetPresentationShapeList() { return maPresentationShapeList; }
     175             : 
     176             :     void EnsureMasterPageDefaultBackground();
     177             :     SdrObject*      CreatePresObj(PresObjKind eObjKind, bool bVertical, const Rectangle& rRect, bool bInsert=false);
     178             :     SdrObject*      CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert);
     179             :     SdrObject*      GetPresObj(PresObjKind eObjKind, int nIndex = 1, bool bFuzzySearch = false );
     180             :     PresObjKind     GetPresObjKind(SdrObject* pObj) const;
     181             :     OUString        GetPresObjText(PresObjKind eObjKind) const;
     182             :     SfxStyleSheet* GetStyleSheetForMasterPageBackground() const;
     183             :     SfxStyleSheet*  GetStyleSheetForPresObj(PresObjKind eObjKind) const;
     184             :     bool            RestoreDefaultText( SdrObject* pObj );
     185             : 
     186             :     /** @return true if the given SdrObject is inside the presentation object list */
     187             :     bool            IsPresObj(const SdrObject* pObj);
     188             : 
     189             :     /** removes the given SdrObject from the presentation object list */
     190             :     void            RemovePresObj(const SdrObject* pObj);
     191             : 
     192             :     /** inserts the given SdrObject into the presentation object list */
     193             :     void            InsertPresObj(SdrObject* pObj, PresObjKind eKind );
     194             : 
     195             :     void            SetAutoLayout(AutoLayout eLayout, bool bInit=false, bool bCreate=false);
     196        3883 :     AutoLayout      GetAutoLayout() const { return meAutoLayout; }
     197             :     void            CreateTitleAndLayout(bool bInit=false, bool bCreate=false);
     198             :     SdrObject*      InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, bool bVertical, Rectangle aRect, bool bInit );
     199             : 
     200             :     virtual void       NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE,
     201             :                                        const SdrInsertReason* pReason=NULL) SAL_OVERRIDE;
     202             :     virtual SdrObject* NbcRemoveObject(size_t nObjNum) SAL_OVERRIDE;
     203             :     virtual SdrObject* RemoveObject(size_t nObjNum) SAL_OVERRIDE;
     204             : 
     205             :     /** Also overload ReplaceObject methods to realize when
     206             :     objects are removed with this mechanism instead of RemoveObject*/
     207             :     virtual SdrObject* NbcReplaceObject(SdrObject* pNewObj, size_t nObjNum) SAL_OVERRIDE;
     208             :     virtual SdrObject* ReplaceObject(SdrObject* pNewObj, size_t nObjNum) SAL_OVERRIDE;
     209             : 
     210             :     void        SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const OUString& rStr );
     211             : 
     212        2068 :     void        SetPageKind(PageKind ePgType)        { mePageKind = ePgType; }
     213       25435 :     PageKind    GetPageKind() const                  { return mePageKind; }
     214             : 
     215        4040 :     void        SetSelected(bool bSel)               { mbSelected = bSel; }
     216         962 :     bool        IsSelected() const                   { return mbSelected; }
     217             : 
     218             :     void        SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect);
     219             :     ::com::sun::star::presentation::FadeEffect  GetFadeEffect() const;
     220             : 
     221          18 :     void        SetPresChange(PresChange eChange)    { mePresChange = eChange; }
     222           6 :     PresChange  GetPresChange() const                { return mePresChange; }
     223             : 
     224           0 :     void        SetTime(double fNewTime)             { mfTime = fNewTime; }
     225           6 :     double      GetTime() const                      { return mfTime; }
     226             : 
     227          10 :     void        SetSound(bool bNewSoundOn)           { mbSoundOn = bNewSoundOn; }
     228          12 :     bool        IsSoundOn() const                    { return mbSoundOn; }
     229             : 
     230         116 :     void        SetExcluded(bool bNewExcluded)      { mbExcluded = bNewExcluded; }
     231        1390 :     bool        IsExcluded() const                  { return mbExcluded; }
     232             : 
     233             :     void        SetScaleObjects(bool bScale)        { mbScaleObjects = bScale; }
     234           0 :     bool        IsScaleObjects() const              { return mbScaleObjects; }
     235             : 
     236          10 :     void        SetSoundFile(const OUString& rStr)    { maSoundFile = rStr; }
     237           0 :     OUString    GetSoundFile() const                { return maSoundFile; }
     238             : 
     239           0 :     void        SetLoopSound( bool bLoopSound ) { mbLoopSound = bLoopSound; }
     240           0 :     bool        IsLoopSound() const                 { return mbLoopSound; }
     241             : 
     242           0 :     void        SetStopSound( bool bStopSound ) { mbStopSound = bStopSound; }
     243          12 :     bool        IsStopSound() const             { return mbStopSound; }
     244             : 
     245        4888 :     sal_Int16   getTransitionType() const { return mnTransitionType;}
     246             :     void        setTransitionType( sal_Int16 nTransitionType );
     247             : 
     248          26 :     sal_Int16   getTransitionSubtype() const { return mnTransitionSubtype;}
     249             :     void        setTransitionSubtype( sal_Int16 nTransitionSubtype );
     250             : 
     251           6 :     bool    getTransitionDirection() const { return mbTransitionDirection;}
     252             :     void        setTransitionDirection( bool bTransitionbDirection );
     253             : 
     254           6 :     sal_Int32   getTransitionFadeColor() const { return mnTransitionFadeColor;}
     255             :     void        setTransitionFadeColor( sal_Int32 nTransitionFadeColor );
     256             : 
     257           6 :     double      getTransitionDuration() const { return mfTransitionDuration;}
     258             :     void        setTransitionDuration( double fTranstionDuration );
     259             : 
     260             :     virtual void Changed(const SdrObject& rObj, SdrUserCallType eType,
     261             :                          const Rectangle& rOldBoundRect) SAL_OVERRIDE;
     262             : 
     263             :     void            SetLayoutName(const OUString& aName);
     264       21442 :     virtual OUString GetLayoutName() const SAL_OVERRIDE       { return maLayoutName; }
     265             : 
     266           0 :     void            SetFileName(const OUString& aName) { maFileName = aName; }
     267          30 :     virtual OUString GetFileName() const       { return maFileName; }
     268           0 :     void            SetBookmarkName(const OUString& aName) { maBookmarkName = aName; }
     269           0 :     virtual OUString GetBookmarkName() const       { return maBookmarkName; }
     270             :     SdPageLink*     GetLink() { return mpPageLink; }
     271             : 
     272             :     void            ConnectLink();
     273             :     void            DisconnectLink();
     274             : 
     275             :     void    ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect,
     276             :                          bool bScaleAllObj);
     277             : 
     278             :     const OUString&   GetName() const;
     279        7843 :     OUString          GetRealName() const { return FmFormPage::GetName(); };
     280             : 
     281             :     void    SetPresentationLayout(const OUString& rLayoutName,
     282             :                                   bool bReplaceStyleSheets = true,
     283             :                                   bool bSetMasterPage = true,
     284             :                                   bool bReverseOrder = false);
     285             :     void    EndListenOutlineText();
     286             : 
     287             :     void    SetBackgroundFullSize( bool bIn );
     288          22 :     bool    IsBackgroundFullSize() const { return mbBackgroundFullSize; }
     289             : 
     290             :     rtl_TextEncoding GetCharSet() { return(meCharSet); }
     291             : 
     292           0 :     void    SetPaperBin(sal_uInt16 nBin) { mnPaperBin = nBin; }
     293           0 :     sal_uInt16  GetPaperBin() const { return mnPaperBin; }
     294             :     virtual void        SetOrientation(Orientation eOrient) SAL_OVERRIDE;
     295             :     virtual Orientation GetOrientation() const SAL_OVERRIDE;
     296             : 
     297             :     virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const SAL_OVERRIDE;
     298             : 
     299             :     bool setAlienAttributes( const com::sun::star::uno::Any& rAttributes );
     300             :     void getAlienAttributes( com::sun::star::uno::Any& rAttributes );
     301             : 
     302             :     /** @return the main animation node */
     303             :     ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getAnimationNode() throw (::com::sun::star::uno::RuntimeException);
     304             : 
     305             :     /** sets the main animation node */
     306             :     void setAnimationNode( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) throw (::com::sun::star::uno::RuntimeException);
     307             : 
     308             :     /// @return a helper class to manipulate effects inside the main sequence
     309             :     boost::shared_ptr< sd::MainSequence > getMainSequence();
     310             : 
     311             :     /** quick check if this slide has an animation node.
     312             :         This can be used to have a cost free check if there are no animations ad this slide.
     313             :         If it returns true this does not mean that there are animations available.
     314             :     */
     315             :     bool hasAnimationNode() const;
     316             : 
     317             :     /// @return the SdPage implementation for the given XDrawPage or 0 if not available
     318             :     static SdPage* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage );
     319             : 
     320             :     /** removes all custom animations for the given shape */
     321             :     void removeAnimations( const SdrObject* pObj );
     322             : 
     323             :     /** Set the name of the page and broadcast a model change.
     324             :     */
     325             :     virtual void SetName (const OUString& rName);
     326             : 
     327             :     const sd::HeaderFooterSettings& getHeaderFooterSettings() const;
     328             :     void setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings );
     329             : 
     330             :     /**
     331             :         @return true if the object from the ViewObjectContact should
     332             :         be visible on this page while rendering.
     333             : 
     334             :         bEdit selects if visibility test is for an editing view or a final render,
     335             :         like printing.
     336             :     */
     337             :     virtual bool checkVisibility(
     338             :         const sdr::contact::ViewObjectContact& rOriginal,
     339             :         const sdr::contact::DisplayInfo& rDisplayInfo,
     340             :         bool bEdit ) SAL_OVERRIDE;
     341             : 
     342             :     /** callback from the sd::View when a new paragraph for one object on this page is created */
     343             :     void onParagraphInserted( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
     344             : 
     345             :     /** callback from the sd::View when a paragraph from one object on this page is removed */
     346             :     void onParagraphRemoving( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
     347             : 
     348             :     /** callback from the sd::View when an object just left text edit mode */
     349             :     void onEndTextEdit( SdrObject* pObj );
     350             : 
     351             :     /** @return the presentation style with the given helpid from this masterpage or this
     352             :         slides masterpage */
     353             :     SdStyleSheet* getPresentationStyle( sal_uInt32 nHelpId ) const;
     354             : 
     355             :     /** removes all empty presentation objects from this slide */
     356             :     void RemoveEmptyPresentationObjects();
     357             : 
     358             :     Rectangle   GetTitleRect() const;
     359             :     Rectangle   GetLayoutRect() const;
     360             : 
     361             :     static void CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas );
     362             : 
     363             :     /** Set the "precious" flag to the given value.
     364             :     */
     365             :     void SetPrecious (const bool bIsPrecious);
     366             : 
     367             :     /** The "precious" flag is used for master pages to prevent some unused
     368             :         master pages from being deleted automatically.  For pages
     369             :         other than master pages this flag can be ignored.
     370             :         @return
     371             :             When this method returns <TRUE/> for a master page then this
     372             :             master page should not be deleted automatically.
     373             :     */
     374           0 :     bool IsPrecious (void) const { return mbIsPrecious; }
     375             : 
     376             :     void createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
     377             :     void addAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, int nIndex = -1 );
     378             :     void removeAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
     379         316 :     const sd::AnnotationVector& getAnnotations() const { return maAnnotations; }
     380             :     bool hasAnnotations() const { return !maAnnotations.empty(); }
     381             :     sal_Int32 getHash() const;
     382             :     OString stringify() const;
     383             : 
     384             : private:
     385             :     bool mbIsPrecious;
     386             : 
     387             :     /** clone the animations from this and set them to rTargetPage
     388             :     */
     389             :     void cloneAnimations( SdPage& rTargetPage ) const;
     390             : 
     391             :     /** called before a shape is removed or replaced from this slide */
     392             :     void onRemoveObject( SdrObject* pObject );
     393             : };
     394             : 
     395             : #endif // INCLUDED_SD_INC_SDPAGE_HXX
     396             : 
     397             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10