LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/inc - sdpage.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 21 32 65.6 %
Date: 2013-07-09 Functions: 23 34 67.6 %
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 _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        1515 :     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             :     double      mfTime;                   ///< 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         276 :     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         690 :     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             :     void        SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eObjKind, const String& rStr );
     213             : 
     214         472 :     void        SetPageKind(PageKind ePgType)        { mePageKind = ePgType; }
     215        8455 :     PageKind    GetPageKind() const                  { return mePageKind; }
     216             : 
     217        1024 :     void        SetSelected(sal_Bool bSel)               { mbSelected = bSel; }
     218         212 :     sal_Bool        IsSelected() const                   { return mbSelected; }
     219             : 
     220             :     void        SetFadeEffect(::com::sun::star::presentation::FadeEffect eNewEffect);
     221             :     ::com::sun::star::presentation::FadeEffect  GetFadeEffect() const;
     222             : 
     223           6 :     void        SetPresChange(PresChange eChange)    { mePresChange = eChange; }
     224           2 :     PresChange  GetPresChange() const                { return mePresChange; }
     225             : 
     226           0 :     void        SetTime(double fNewTime)             { mfTime = fNewTime; }
     227           2 :     double      GetTime() const                      { return mfTime; }
     228             : 
     229           4 :     void        SetSound(sal_Bool bNewSoundOn)           { mbSoundOn = bNewSoundOn; }
     230           3 :     sal_Bool        IsSoundOn() const                    { return mbSoundOn; }
     231             : 
     232           8 :     void        SetExcluded(sal_Bool bNewExcluded)      { mbExcluded = bNewExcluded; }
     233        1313 :     sal_Bool        IsExcluded() const                  { return mbExcluded; }
     234             : 
     235             :     void        SetScaleObjects(sal_Bool bScale)        { mbScaleObjects = bScale; }
     236           0 :     sal_Bool        IsScaleObjects() const              { return mbScaleObjects; }
     237             : 
     238           4 :     void        SetSoundFile(const String& rStr)    { maSoundFile = rStr; }
     239           0 :     String      GetSoundFile() const                { return maSoundFile; }
     240             : 
     241           0 :     void        SetLoopSound( bool bLoopSound ) { mbLoopSound = bLoopSound; }
     242           0 :     bool        IsLoopSound() const                 { return mbLoopSound; }
     243             : 
     244           0 :     void        SetStopSound( bool bStopSound ) { mbStopSound = bStopSound; }
     245           3 :     bool        IsStopSound() const             { return mbStopSound; }
     246             : 
     247             :     sal_Int16   getTransitionType() const;
     248             :     void        setTransitionType( sal_Int16 nTransitionType );
     249             : 
     250             :     sal_Int16   getTransitionSubtype() const;
     251             :     void        setTransitionSubtype( sal_Int16 nTransitionSubtype );
     252             : 
     253             :     sal_Bool    getTransitionDirection() const;
     254             :     void        setTransitionDirection( sal_Bool bTransitionbDirection );
     255             : 
     256             :     sal_Int32   getTransitionFadeColor() const;
     257             :     void        setTransitionFadeColor( sal_Int32 nTransitionFadeColor );
     258             : 
     259             :     double      getTransitionDuration() const;
     260             :     void        setTransitionDuration( double fTranstionDuration );
     261             : 
     262             :     virtual void Changed(const SdrObject& rObj, SdrUserCallType eType,
     263             :                          const Rectangle& rOldBoundRect);
     264             : 
     265             :     void            SetLayoutName(OUString aName);
     266        2574 :     virtual OUString GetLayoutName() const       { return maLayoutName; }
     267             : 
     268           0 :     void            SetFileName(const String& aName) { maFileName = aName; }
     269           9 :     virtual String  GetFileName() const       { return maFileName; }
     270           0 :     void            SetBookmarkName(const String& aName) { maBookmarkName = aName; }
     271           0 :     virtual String  GetBookmarkName() const       { return maBookmarkName; }
     272             :     SdPageLink*     GetLink() { return mpPageLink; }
     273             : 
     274             :     void            ConnectLink();
     275             :     void            DisconnectLink();
     276             : 
     277             :     void    ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderRect,
     278             :                          sal_Bool bScaleAllObj);
     279             : 
     280             :     const String&   GetName() const;
     281        1482 :     String          GetRealName() const { return FmFormPage::GetName(); };
     282             : 
     283             :     void    SetPresentationLayout(const String& rLayoutName,
     284             :                                   sal_Bool bReplaceStyleSheets = sal_True,
     285             :                                   sal_Bool bSetMasterPage = sal_True,
     286             :                                   sal_Bool bReverseOrder = sal_False);
     287             :     void    EndListenOutlineText();
     288             : 
     289             :     void    SetBackgroundFullSize( sal_Bool bIn );
     290          11 :     sal_Bool    IsBackgroundFullSize() const { return mbBackgroundFullSize; }
     291             : 
     292             :     rtl_TextEncoding GetCharSet() { return(meCharSet); }
     293             : 
     294           0 :     void    SetPaperBin(sal_uInt16 nBin) { mnPaperBin = nBin; }
     295           0 :     sal_uInt16  GetPaperBin() const { return mnPaperBin; }
     296             :     virtual void        SetOrientation(Orientation eOrient);
     297             :     virtual Orientation GetOrientation() const;
     298             : 
     299             :     virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const;
     300             : 
     301             :     sal_Bool setAlienAttributes( const com::sun::star::uno::Any& rAttributes );
     302             :     void getAlienAttributes( com::sun::star::uno::Any& rAttributes );
     303             : 
     304             :     /** @return the main animation node */
     305             :     ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getAnimationNode() throw (::com::sun::star::uno::RuntimeException);
     306             : 
     307             :     /** sets the main animation node */
     308             :     void setAnimationNode( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) throw (::com::sun::star::uno::RuntimeException);
     309             : 
     310             :     /// @return a helper class to manipulate effects inside the main sequence
     311             :     boost::shared_ptr< sd::MainSequence > getMainSequence();
     312             : 
     313             :     /** quick check if this slide has an animation node.
     314             :         This can be used to have a cost free check if there are no animations ad this slide.
     315             :         If it returns true this does not mean that there are animations available.
     316             :     */
     317             :     bool hasAnimationNode() const;
     318             : 
     319             :     /// @return the SdPage implementation for the given XDrawPage or 0 if not available
     320             :     static SdPage* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage );
     321             : 
     322             :     /** removes all custom animations for the given shape */
     323             :     void removeAnimations( const SdrObject* pObj );
     324             : 
     325             :     /** Set the name of the page and broadcast a model change.
     326             :     */
     327             :     virtual void SetName (const String& rName);
     328             : 
     329             :     const sd::HeaderFooterSettings& getHeaderFooterSettings() const;
     330             :     void setHeaderFooterSettings( const sd::HeaderFooterSettings& rNewSettings );
     331             : 
     332             :     /**
     333             :         @return true if the object from the ViewObjectContact should
     334             :         be visible on this page while rendering.
     335             : 
     336             :         bEdit selects if visibility test is for an editing view or a final render,
     337             :         like printing.
     338             :     */
     339             :     virtual bool checkVisibility(
     340             :         const sdr::contact::ViewObjectContact& rOriginal,
     341             :         const sdr::contact::DisplayInfo& rDisplayInfo,
     342             :         bool bEdit );
     343             : 
     344             :     /** callback from the sd::View when a new paragraph for one object on this page is created */
     345             :     void onParagraphInserted( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
     346             : 
     347             :     /** callback from the sd::View when a paragraph from one object on this page is removed */
     348             :     void onParagraphRemoving( ::Outliner* pOutliner, Paragraph* pPara, SdrObject* pObj );
     349             : 
     350             :     /** callback from the sd::View when an object just left text edit mode */
     351             :     void onEndTextEdit( SdrObject* pObj );
     352             : 
     353             :     /** @return the presentation style with the given helpid from this masterpage or this
     354             :         slides masterpage */
     355             :     SdStyleSheet* getPresentationStyle( sal_uInt32 nHelpId ) const;
     356             : 
     357             :     /** removes all empty presentation objects from this slide */
     358             :     void RemoveEmptyPresentationObjects();
     359             : 
     360             :     Rectangle   GetTitleRect() const;
     361             :     Rectangle   GetLayoutRect() const;
     362             : 
     363             :     static void CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas );
     364             : 
     365             :     /** Set the "precious" flag to the given value.
     366             :     */
     367             :     void SetPrecious (const bool bIsPrecious);
     368             : 
     369             :     /** The "precious" flag is used for master pages to prevent some unused
     370             :         master pages from being deleted automatically.  For pages
     371             :         other than master pages this flag can be ignored.
     372             :         @return
     373             :             When this method returns <TRUE/> for a master page then this
     374             :             master page should not be deleted automatically.
     375             :     */
     376             :     bool IsPrecious (void) const;
     377             : 
     378             :     void createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
     379             :     void addAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, int nIndex = -1 );
     380             :     void removeAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
     381          97 :     const sd::AnnotationVector& getAnnotations() const { return maAnnotations; }
     382             :     bool hasAnnotations() const { return !maAnnotations.empty(); }
     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     // _SDPAGE_HXX
     396             : 
     397             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10