LCOV - code coverage report
Current view: top level - include/svx - svdmodel.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 55 65 84.6 %
Date: 2014-11-03 Functions: 57 67 85.1 %
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_SVX_SVDMODEL_HXX
      21             : #define INCLUDED_SVX_SVDMODEL_HXX
      22             : 
      23             : #include <com/sun/star/uno/Sequence.hxx>
      24             : #include <cppuhelper/weakref.hxx>
      25             : #include <editeng/forbiddencharacterstable.hxx>
      26             : #include <rtl/ustring.hxx>
      27             : #include <sot/storage.hxx>
      28             : #include <tools/link.hxx>
      29             : #include <tools/weakbase.hxx>
      30             : #include <vcl/mapmod.hxx>
      31             : #include <svl/SfxBroadcaster.hxx>
      32             : #include <tools/datetime.hxx>
      33             : #include <svl/hint.hxx>
      34             : 
      35             : #include <svl/style.hxx>
      36             : #include <svx/xtable.hxx>
      37             : #include <svx/pageitem.hxx>
      38             : #include <vcl/field.hxx>
      39             : 
      40             : #include <boost/shared_ptr.hpp>
      41             : 
      42             : class OutputDevice;
      43             : #include <svx/svdtypes.hxx>
      44             : #include <svx/svxdllapi.h>
      45             : 
      46             : #include <rtl/ref.hxx>
      47             : #include <deque>
      48             : 
      49             : #define DEGREE_CHAR ((sal_Unicode)0x00B0)   /* U+00B0 DEGREE SIGN */
      50             : 
      51             : class SdrOutliner;
      52             : class SdrLayerAdmin;
      53             : class SdrObjList;
      54             : class SdrObject;
      55             : class SdrPage;
      56             : class SdrPageView;
      57             : class SdrTextObj;
      58             : class SdrUndoAction;
      59             : class SdrUndoGroup;
      60             : class AutoTimer;
      61             : class SfxItemPool;
      62             : class SfxItemSet;
      63             : class SfxRepeatTarget;
      64             : class SfxStyleSheet;
      65             : class SfxUndoAction;
      66             : class SfxUndoManager;
      67             : class XBitmapList;
      68             : class XColorList;
      69             : class XDashList;
      70             : class XGradientList;
      71             : class XHatchList;
      72             : class XLineEndList;
      73             : class SvxForbiddenCharactersTable;
      74             : class SvNumberFormatter;
      75             : class SotStorage;
      76             : class SdrOutlinerCache;
      77             : class SdrUndoFactory;
      78             : class ImageMap;
      79             : namespace comphelper
      80             : {
      81             :     class IEmbeddedHelper;
      82             :     class LifecycleProxy;
      83             : }
      84             : namespace sfx2
      85             : {
      86             :     class LinkManager;
      87             : }
      88             : 
      89             : 
      90             : #define SDR_SWAPGRAPHICSMODE_NONE       0x00000000
      91             : #define SDR_SWAPGRAPHICSMODE_TEMP       0x00000001
      92             : #define SDR_SWAPGRAPHICSMODE_DOC        0x00000002
      93             : #define SDR_SWAPGRAPHICSMODE_PURGE      0x00000100
      94             : #define SDR_SWAPGRAPHICSMODE_DEFAULT    (SDR_SWAPGRAPHICSMODE_TEMP|SDR_SWAPGRAPHICSMODE_DOC|SDR_SWAPGRAPHICSMODE_PURGE)
      95             : 
      96             : 
      97             : 
      98             : enum SdrHintKind
      99             : {
     100             :                   HINT_UNKNOWN,         // Unknown
     101             :                   HINT_LAYERCHG,        // changed layer definition
     102             :                   HINT_LAYERORDERCHG,   // order of layer changed (Insert/Remove/ChangePos)
     103             :                   HINT_PAGEORDERCHG,    // order of pages (object pages or master pages) changed (Insert/Remove/ChangePos)
     104             :                   HINT_OBJCHG,          // object changed
     105             :                   HINT_OBJINSERTED,     // new object inserted
     106             :                   HINT_OBJREMOVED,      // symbol object removed from list
     107             :                   HINT_MODELCLEARED,    // deleted the whole model (no pages exist anymore). not impl.
     108             :                   HINT_REFDEVICECHG,    // RefDevice changed
     109             :                   HINT_DEFAULTTABCHG,   // Default tabulator width changed
     110             :                   HINT_DEFFONTHGTCHG,   // Default FontHeight changed
     111             :                   HINT_MODELSAVED,      // Document was saved
     112             :                   HINT_SWITCHTOPAGE,    // #94278# UNDO/REDO at an object evtl. on another page
     113             :                   HINT_BEGEDIT,         // Is called after the object has entered text edit mode
     114             :                   HINT_ENDEDIT          // Is called after the object has left text edit mode
     115             : };
     116             : 
     117      316275 : class SVX_DLLPUBLIC SdrHint: public SfxHint
     118             : {
     119             : public:
     120             :     Rectangle                               maRectangle;
     121             :     const SdrPage*                          mpPage;
     122             :     const SdrObject*                        mpObj;
     123             :     const SdrObjList*                       mpObjList;
     124             :     SdrHintKind                             meHint;
     125             : 
     126             : public:
     127             :     explicit SdrHint(SdrHintKind eNewHint);
     128             :     explicit SdrHint(const SdrObject& rNewObj);
     129             : 
     130             :     void SetPage(const SdrPage* pNewPage);
     131             :     void SetObject(const SdrObject* pNewObj);
     132             :     void SetKind(SdrHintKind eNewKind);
     133             : 
     134       21895 :     const SdrPage* GetPage() const { return mpPage;}
     135     2003390 :     const SdrObject* GetObject() const { return mpObj;}
     136    10528345 :     SdrHintKind GetKind() const { return meHint;}
     137             : };
     138             : 
     139             : 
     140             : 
     141             : // Flag for cleaning up after the loading of the pools, meaning the
     142             : // recalculate the RefCounts and dispose unused items)
     143             : // sal_False == active
     144             : #define LOADREFCOUNTS (false)
     145             : 
     146             : struct SdrModelImpl;
     147             : 
     148             : class SVX_DLLPUBLIC SdrModel : public SfxBroadcaster, public tools::WeakBase< SdrModel >
     149             : {
     150             : protected:
     151             :     DateTime       aReadDate;  // date of the incoming stream
     152             :     std::vector<SdrPage*> maMaPag;     // master pages
     153             :     std::vector<SdrPage*> maPages;
     154             :     Link           aUndoLink;  // link to a NotifyUndo-Handler
     155             :     Link           aIOProgressLink;
     156             :     OUString       aTablePath;
     157             :     Size           aMaxObjSize; // e.g. for auto-growing text
     158             :     Fraction       aObjUnit;   // description of the coordinate units for ClipBoard, Drag&Drop, ...
     159             :     MapUnit        eObjUnit;   // see above
     160             :     FieldUnit      eUIUnit;      // unit, scale (e.g. 1/1000) for the UI (status bar) is set by ImpSetUIUnit()
     161             :     Fraction       aUIScale;     // see above
     162             :     OUString       aUIUnitStr;   // see above
     163             :     Fraction       aUIUnitFact;  // see above
     164             :     int            nUIUnitKomma; // see above
     165             : 
     166             :     SdrLayerAdmin*  pLayerAdmin;
     167             :     SfxItemPool*    pItemPool;
     168             :     comphelper::IEmbeddedHelper*
     169             :                     m_pEmbeddedHelper; // helper for embedded objects to get rid of the SfxObjectShell
     170             :     SdrOutliner*    pDrawOutliner;  // an Outliner for outputting text
     171             :     SdrOutliner*    pHitTestOutliner;// an Outliner for the HitTest
     172             :     sal_uIntPtr           nDefTextHgt;    // Default text heigth in logical units
     173             :     OutputDevice*   pRefOutDev;     // ReferenceDevice for the EditEngine
     174             :     sal_uIntPtr           nProgressAkt;   // for the
     175             :     sal_uIntPtr           nProgressMax;   // ProgressBar-
     176             :     sal_uIntPtr           nProgressOfs;   // -Handler
     177             :     rtl::Reference< SfxStyleSheetBasePool > mxStyleSheetPool;
     178             :     SfxStyleSheet*  pDefaultStyleSheet;
     179             :     SfxStyleSheet* mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj; // #i119287#
     180             :     sfx2::LinkManager* pLinkManager;   // LinkManager
     181             :     std::deque<SfxUndoAction*>* pUndoStack;
     182             :     std::deque<SfxUndoAction*>* pRedoStack;
     183             :     SdrUndoGroup*   pAktUndoGroup;  // for deeper
     184             :     sal_uInt16          nUndoLevel;     // undo nesting
     185             :     sal_uInt16          nProgressPercent; // for the ProgressBar-Handler
     186             :     sal_uInt16          nLoadVersion;   // version number of the loaded file
     187             :     bool            bMyPool:1;        // to clean up pMyPool from 303a
     188             :     bool            bUIOnlyKomma:1; // see eUIUnit
     189             :     bool            mbUndoEnabled:1;  // If false no undo is recorded or we are during the execution of an undo action
     190             :     bool            bExtColorTable:1; // ne separate ColorTable
     191             :     bool            mbChanged:1;
     192             :     bool            bInfoChanged:1;
     193             :     bool            bPagNumsDirty:1;
     194             :     bool            bMPgNumsDirty:1;
     195             :     bool            bPageNotValid:1;  // TRUE=Doc is only object container. Page is invalid.
     196             :     bool            bSavePortable:1;  // save metafiles portably
     197             :     bool            bNoBitmapCaching:1;   // cache bitmaps for screen output
     198             :     bool            bReadOnly:1;
     199             :     bool            bTransparentTextFrames:1;
     200             :     bool            bSaveCompressed:1;
     201             :     bool            bSwapGraphics:1;
     202             :     bool            bPasteResize:1; // Objects are beingresized due to Paste with different MapMode
     203             :     bool            bSaveOLEPreview:1;      // save preview metafile of OLE objects
     204             :     bool            bSaveNative:1;
     205             :     bool            bStarDrawPreviewMode:1;
     206             :     bool            mbDisableTextEditUsesCommonUndoManager:1;
     207             :     sal_uInt16          nStreamCompressMode;  // write compressedly?
     208             :     sal_uInt16          nStreamNumberFormat;
     209             :     sal_uInt16          nDefaultTabulator;
     210             :     sal_uInt32          nMaxUndoCount;
     211             : 
     212             : 
     213             : 
     214             : // sdr::Comment interface
     215             : private:
     216             :     // the next unique comment ID, used for counting added comments. Initialized
     217             :     // to 0. UI shows one more due to the fact that 0 is a no-no for users.
     218             :     sal_uInt32                                          mnUniqueCommentID;
     219             : 
     220             : public:
     221             :     // create a new, unique comment ID
     222             :     sal_uInt32 GetNextUniqueCommentID();
     223             : 
     224             :     // for export
     225             :     sal_uInt32 GetUniqueCommentID() const { return mnUniqueCommentID; }
     226             : 
     227             :     // for import
     228             :     void SetUniqueCommentID(sal_uInt32 nNewID) { if(nNewID != mnUniqueCommentID) { mnUniqueCommentID = nNewID; } }
     229             : 
     230             :     sal_uInt16          nStarDrawPreviewMasterPageNum;
     231             :     SvxForbiddenCharactersTable* mpForbiddenCharactersTable;
     232             :     sal_uIntPtr         nSwapGraphicsMode;
     233             : 
     234             :     SdrOutlinerCache* mpOutlinerCache;
     235             :     //get a vector of all the SdrOutliner belonging to the model
     236             :     std::vector<SdrOutliner*> GetActiveOutliners() const;
     237             :     SdrModelImpl*   mpImpl;
     238             :     sal_uInt16          mnCharCompressType;
     239             :     sal_uInt16          mnHandoutPageCount;
     240             :     sal_uInt16          nReserveUInt6;
     241             :     sal_uInt16          nReserveUInt7;
     242             :     bool            mbModelLocked;
     243             :     bool            mbKernAsianPunctuation;
     244             :     bool            mbAddExtLeading;
     245             :     bool            mbInDestruction;
     246             : 
     247             :     // Color, Dash, Line-End, Hatch, Gradient, Bitmap property lists ...
     248             :     XPropertyListRef maProperties[XPROPERTY_LIST_COUNT];
     249             : 
     250             :     // New src638: NumberFormatter for drawing layer and
     251             :     // method for getting it. It is constructed on demand
     252             :     // and destroyed when destroying the SdrModel.
     253             :     SvNumberFormatter* mpNumberFormatter;
     254             : public:
     255           0 :     sal_uInt16 getHandoutPageCount() const { return mnHandoutPageCount; }
     256           0 :     void setHandoutPageCount( sal_uInt16 nHandoutPageCount ) { mnHandoutPageCount = nHandoutPageCount; }
     257             : 
     258             : protected:
     259             : 
     260             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel();
     261             : 
     262             : private:
     263             :     // not implemented:
     264             :     SVX_DLLPRIVATE SdrModel(const SdrModel& rSrcModel);
     265             :     SVX_DLLPRIVATE void operator=(const SdrModel& rSrcModel);
     266             :     SVX_DLLPRIVATE bool operator==(const SdrModel& rCmpModel) const;
     267             :     SVX_DLLPRIVATE void ImpPostUndoAction(SdrUndoAction* pUndo);
     268             :     SVX_DLLPRIVATE void ImpSetUIUnit();
     269             :     SVX_DLLPRIVATE void ImpSetOutlinerDefaults( SdrOutliner* pOutliner, bool bInit = false );
     270             :     SVX_DLLPRIVATE void ImpReformatAllTextObjects();
     271             :     SVX_DLLPRIVATE void ImpReformatAllEdgeObjects();    // #103122#
     272             :     SVX_DLLPRIVATE void ImpCreateTables();
     273             :     SVX_DLLPRIVATE void ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, bool bUseExtColorTable,
     274             :         bool bLoadRefCounts = true);
     275             : 
     276             : 
     277             :     // this is a weak reference to a possible living api wrapper for this model
     278             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxUnoModel;
     279             : 
     280             : public:
     281       93164 :     bool     IsPasteResize() const        { return bPasteResize; }
     282           0 :     void     SetPasteResize(bool bOn) { bPasteResize=bOn; }
     283             :     TYPEINFO_OVERRIDE();
     284             :     // If a custom Pool is put here, the class will call methods
     285             :     // on it (Put(), Remove()). On disposal of SdrModel the pool
     286             :     // will be deleted with   delete.
     287             :     // If you give NULL instead, it will create an own pool (SdrItemPool)
     288             :     // which will also be disposed in the destructor.
     289             :     // If you do use a custom Pool, make sure you inherit from SdrItemPool,
     290             :     // if you want to use symbol objects inherited from SdrAttrObj.
     291             :     // If, however, you use objects inheriting from SdrObject you are free
     292             :     // to chose a pool of your liking.
     293             :     explicit SdrModel();
     294             :     explicit SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, bool bUseExtColorTable, bool bLoadRefCounts);
     295             :     explicit SdrModel(const OUString& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, bool bUseExtColorTable, bool bLoadRefCounts);
     296             :     virtual ~SdrModel();
     297             :     void ClearModel(bool bCalledFromDestructor);
     298             : 
     299             :     // Whether the model is being streamed in at the moment
     300      110146 :     bool IsLoading() const                  { return false /*BFS01 bLoading */; }
     301             :     // Needs to be overladed to enable the Swap/LoadOnDemand of graphics.
     302             :     // If rbDeleteAfterUse is set to sal_True the SvStream instance from
     303             :     // the caller will be disposed after use.
     304             :     // If this method returns NULL, a temporary file will be allocated for
     305             :     // swapping.
     306             :     // The stream from which the model was loaded or in which is was saved last
     307             :     // needs to be delivered
     308             :     virtual ::com::sun::star::uno::Reference<
     309             :                 ::com::sun::star::embed::XStorage> GetDocumentStorage() const;
     310             :     ::com::sun::star::uno::Reference<
     311             :             ::com::sun::star::io::XInputStream >
     312             :         GetDocumentStream(OUString const& rURL,
     313             :                 ::comphelper::LifecycleProxy & rProxy) const;
     314             :     // Change the template attributes of the symbol objects to hard attributes
     315             :     void BurnInStyleSheetAttributes();
     316             :     // If you inherit from SdrPage you also need to inherit from SdrModel
     317             :     // and implement both VM AllocPage() and AllocModel()...
     318             :     virtual SdrPage*  AllocPage(bool bMasterPage);
     319             :     virtual SdrModel* AllocModel() const;
     320             : 
     321             :     // Changes on the layers set the modified flag and broadcast on the model!
     322       15382 :     const SdrLayerAdmin& GetLayerAdmin() const                  { return *pLayerAdmin; }
     323      100162 :     SdrLayerAdmin&       GetLayerAdmin()                        { return *pLayerAdmin; }
     324             : 
     325           0 :     const SfxItemPool&   GetItemPool() const                    { return *pItemPool; }
     326     1122433 :     SfxItemPool&         GetItemPool()                          { return *pItemPool; }
     327             : 
     328             :     SdrOutliner&         GetDrawOutliner(const SdrTextObj* pObj=NULL) const;
     329             : 
     330      156252 :     SdrOutliner&         GetHitTestOutliner() const { return *pHitTestOutliner; }
     331             :     const SdrTextObj*    GetFormattingTextObj() const;
     332             :     // put the TextDefaults (Font,Height,Color) in a Set
     333             :     void                 SetTextDefaults() const;
     334             :     static void          SetTextDefaults( SfxItemPool* pItemPool, sal_uIntPtr nDefTextHgt );
     335             : 
     336             :     // ReferenceDevice for the EditEngine
     337             :     void                 SetRefDevice(OutputDevice* pDev);
     338      122998 :     OutputDevice*        GetRefDevice() const                   { return pRefOutDev; }
     339             :     // If a new MapMode is set on the RefDevice (or similar)
     340             :     void                 RefDeviceChanged(); // not yet implemented
     341             :     // default font heigth in logical units
     342             :     void                 SetDefaultFontHeight(sal_uIntPtr nVal);
     343           0 :     sal_uIntPtr                GetDefaultFontHeight() const           { return nDefTextHgt; }
     344             :     // default tabulator width for the EditEngine
     345             :     void                 SetDefaultTabulator(sal_uInt16 nVal);
     346       33836 :     sal_uInt16               GetDefaultTabulator() const            { return nDefaultTabulator; }
     347             : 
     348             :     // The DefaultStyleSheet will be used in every symbol object which is inserted
     349             :     // in this model and does not have a StyleSheet set.
     350       75078 :     SfxStyleSheet*       GetDefaultStyleSheet() const             { return pDefaultStyleSheet; }
     351         364 :     void                 SetDefaultStyleSheet(SfxStyleSheet* pDefSS) { pDefaultStyleSheet = pDefSS; }
     352             : 
     353             :     // #i119287# default StyleSheet for SdrGrafObj and SdrOle2Obj
     354        1446 :     SfxStyleSheet* GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj() const { return mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj; }
     355         364 :     void SetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(SfxStyleSheet* pDefSS) { mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj = pDefSS; }
     356             : 
     357       65470 :     sfx2::LinkManager*      GetLinkManager()                         { return pLinkManager; }
     358        6314 :     void                 SetLinkManager( sfx2::LinkManager* pLinkMgr ) { pLinkManager = pLinkMgr; }
     359             : 
     360        2482 :     ::comphelper::IEmbeddedHelper*     GetPersist() const               { return m_pEmbeddedHelper; }
     361             :     void                 ClearPersist()                                 { m_pEmbeddedHelper = 0; }
     362       10453 :     void                 SetPersist( ::comphelper::IEmbeddedHelper *p ) { m_pEmbeddedHelper = p; }
     363             : 
     364             :     // Unit for the symbol coordination
     365             :     // Default is 1 logical unit = 1/100mm (Unit=MAP_100TH_MM, Fract=(1,1)).
     366             :     // Examples:
     367             :     //   MAP_POINT,    Fraction(72,1)    : 1 log Einh = 72 Point   = 1 Inch
     368             :     //   MAP_POINT,    Fraction(1,20)    : 1 log Einh = 1/20 Point = 1 Twip
     369             :     //   MAP_TWIP,     Fraction(1,1)     : 1 log Einh = 1 Twip
     370             :     //   MAP_100TH_MM, Fraction(1,10)    : 1 log Einh = 1/1000mm
     371             :     //   MAP_MM,       Fraction(1000,1)  : 1 log Einh = 1000mm     = 1m
     372             :     //   MAP_CM,       Fraction(100,1)   : 1 log Einh = 100cm      = 1m
     373             :     //   MAP_CM,       Fraction(100000,1): 1 log Einh = 100000cm   = 1km
     374             :     // (FWIW: you cannot represent light years).
     375             :     // The scaling unit is needed for the Engine to serve the Clipboard
     376             :     // with the correct sizes.
     377        9046 :     MapUnit          GetScaleUnit() const                       { return eObjUnit; }
     378             :     void             SetScaleUnit(MapUnit eMap);
     379        6592 :     const Fraction&  GetScaleFraction() const                   { return aObjUnit; }
     380             :     void             SetScaleFraction(const Fraction& rFrac);
     381             :     // Setting both simultaneously performs a little better
     382             :     void             SetScaleUnit(MapUnit eMap, const Fraction& rFrac);
     383             : 
     384             :     // maximal size e.g. for auto growing texts
     385       86992 :     const Size&      GetMaxObjSize() const                      { return aMaxObjSize; }
     386         368 :     void             SetMaxObjSize(const Size& rSiz)            { aMaxObjSize=rSiz; }
     387             : 
     388             :     // For the View! to display sane numbers in the status bar: Default is mm.
     389             :     void             SetUIUnit(FieldUnit eUnit);
     390         420 :     FieldUnit        GetUIUnit() const                          { return eUIUnit; }
     391             :     // The scale of the drawing. Default 1/1.
     392             :     void             SetUIScale(const Fraction& rScale);
     393        2271 :     const Fraction&  GetUIScale() const                         { return aUIScale; }
     394             :     // Setting both simultaneously performs a little better
     395             :     void             SetUIUnit(FieldUnit eUnit, const Fraction& rScale);
     396             : 
     397             :     const Fraction&  GetUIUnitFact() const                      { return aUIUnitFact; }
     398             :     const OUString&  GetUIUnitStr() const                       { return aUIUnitStr; }
     399             :     int              GetUIUnitKomma() const                     { return nUIUnitKomma; }
     400             :     bool             IsUIOnlyKomma() const                      { return bUIOnlyKomma; }
     401             : 
     402             :     static void      TakeUnitStr(FieldUnit eUnit, OUString& rStr);
     403             :     void             TakeMetricStr(long nVal, OUString& rStr, bool bNoUnitChars = false, sal_Int32 nNumDigits = -1) const;
     404             :     void             TakeWinkStr(long nWink, OUString& rStr, bool bNoDegChar = false) const;
     405             :     void             TakePercentStr(const Fraction& rVal, OUString& rStr, bool bNoPercentChar = false) const;
     406             : 
     407             :     // RecalcPageNums is ordinarily only called by the Page.
     408       13507 :     bool         IsPagNumsDirty() const                     { return bPagNumsDirty; };
     409        1316 :     bool         IsMPgNumsDirty() const                     { return bMPgNumsDirty; };
     410             :     void             RecalcPageNums(bool bMaster);
     411             :     // After the Insert the Page belongs to the SdrModel.
     412             :     virtual void     InsertPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
     413             :     virtual void     DeletePage(sal_uInt16 nPgNum);
     414             :     // Remove means transferring ownership to the caller (opposite of Insert)
     415             :     virtual SdrPage* RemovePage(sal_uInt16 nPgNum);
     416             :     virtual void     MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos);
     417             :     const SdrPage* GetPage(sal_uInt16 nPgNum) const;
     418             :     SdrPage* GetPage(sal_uInt16 nPgNum);
     419             :     sal_uInt16 GetPageCount() const;
     420             :     // #109538#
     421             :     virtual void PageListChanged();
     422             : 
     423             :     // Masterpages
     424             :     virtual void     InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
     425             :     virtual void     DeleteMasterPage(sal_uInt16 nPgNum);
     426             :     // Remove means transferring ownership to the caller (opposite of Insert)
     427             :     virtual SdrPage* RemoveMasterPage(sal_uInt16 nPgNum);
     428             :     virtual void     MoveMasterPage(sal_uInt16 nPgNum, sal_uInt16 nNewPos);
     429             :     const SdrPage* GetMasterPage(sal_uInt16 nPgNum) const;
     430             :     SdrPage* GetMasterPage(sal_uInt16 nPgNum);
     431             :     sal_uInt16 GetMasterPageCount() const;
     432             :     // #109538#
     433             :     virtual void MasterPageListChanged();
     434             : 
     435             :     // modified flag. Is set automatically when something changes on the Pages
     436             :     // symbol objects. You need to reset it yourself, however, e.g. on Save().
     437        5122 :     bool IsChanged() const { return mbChanged; }
     438             :     virtual void SetChanged(bool bFlg = true);
     439             : 
     440             :     // PageNotValid means that the model carries objects which are
     441             :     // anchored on a Page but the Page is invalid. This mark is needed for
     442             :     // Clipboard/Drag&Drop.
     443             :     bool            IsPageNotValid() const                     { return bPageNotValid; }
     444             :     void            SetPageNotValid(bool bJa = true)           { bPageNotValid=bJa; }
     445             : 
     446             :     // Setting this flag to sal_True, graphic objects are saved
     447             :     // portably. Meta files will eventually implicitly changed, i.e. during save.
     448             :     // Default=FALSE. Flag is not persistent.
     449             :     bool            IsSavePortable() const                     { return bSavePortable; }
     450             :     void            SetSavePortable(bool bJa = true)           { bSavePortable=bJa; }
     451             : 
     452             :     // If you set this flag to sal_True, the
     453             :     // pixel objects will be saved (heavily) compressed.
     454             :     // Default=FALSE. Flag is not persistent.
     455             :     bool            IsSaveCompressed() const                   { return bSaveCompressed; }
     456             :     void            SetSaveCompressed(bool bJa = true)         { bSaveCompressed=bJa; }
     457             : 
     458             :     // If true, graphic objects with set Native-Link
     459             :     // native will be saved.
     460             :     // Default=FALSE. Flag is not persistent.
     461             :     bool            IsSaveNative() const                       { return bSaveNative; }
     462             :     void            SetSaveNative(bool bJa = true)             { bSaveNative=bJa; }
     463             : 
     464             :     // If set to sal_True, graphics from graphics objects will:
     465             :     // - not be loaded immediately when loading a document,
     466             :     //   but only once they are needed (e.g. displayed).
     467             :     // - be pruned from memory if they are not needed.
     468             :     // For that to work, the virtual method
     469             :     // GetDocumentStream() needs to be overloaded.
     470             :     // Default=FALSE. Flag is not persistent.
     471         550 :     bool            IsSwapGraphics() const { return bSwapGraphics; }
     472             :     void            SetSwapGraphics(bool bJa = true);
     473           2 :     void            SetSwapGraphicsMode(sal_uIntPtr nMode) { nSwapGraphicsMode = nMode; }
     474          62 :     sal_uIntPtr         GetSwapGraphicsMode() const { return nSwapGraphicsMode; }
     475             : 
     476           0 :     bool            IsSaveOLEPreview() const          { return bSaveOLEPreview; }
     477             :     void            SetSaveOLEPreview( bool bSet) { bSaveOLEPreview = bSet; }
     478             : 
     479             :     // To accelarate the screen output of Bitmaps (especially rotated ones)
     480             :     // they will be cached. The existence of that cache can be toggled with this
     481             :     // flag. During the next Paint an image will be remembered or freed.
     482             :     // If a Bitmap object is placed in Undo its Cache for this object is turned off
     483             :     // immediately to save memory.
     484             :     // Default=Cache activated. Flag is not persistent.
     485             :     bool            IsBitmapCaching() const                     { return !bNoBitmapCaching; }
     486             :     void            SetBitmapCaching(bool bJa = true)           { bNoBitmapCaching=!bJa; }
     487             : 
     488             :     // Text frames without filling can be select with a mouse click by default (sal_False).
     489             :     // With this flag set to true you can hit them only in the area in which text is to be
     490             :     // found.
     491       24119 :     bool            IsPickThroughTransparentTextFrames() const  { return bTransparentTextFrames; }
     492        1144 :     void            SetPickThroughTransparentTextFrames(bool bOn) { bTransparentTextFrames=bOn; }
     493             : 
     494             :     // Can the model be changed at all?
     495             :     // Is only evaluated by the possibility methods of the View.
     496             :     // Direct manipulations on the model, ... do not respect this flag.
     497             :     // Should be overloaded and return the appriopriate ReadOnly status
     498             :     // of the files, i.e. sal_True or sal_False. (Method is called multiple
     499             :     // times, so use one flag only!)
     500             :     virtual bool IsReadOnly() const;
     501             :     virtual void     SetReadOnly(bool bYes);
     502             : 
     503             :     // Mixing two SdrModels. Mind that rSourceModel is not const.
     504             :     // The pages will not be copied but moved, when inserted.
     505             :     // rSourceModel may very well be empty afterwards.
     506             :     // nFirstPageNum,nLastPageNum: The pages to take from rSourceModel
     507             :     // nDestPos..................: position to insert
     508             :     // bMergeMasterPages.........: sal_True = needed MasterPages will be taken
     509             :     //                                   from rSourceModel
     510             :     //                             sal_False= the MasterPageDescriptors of
     511             :     //                                   the pages of the rSourceModel will be
     512             :     //                                   mapped on the exisiting  MasterPages.
     513             :     // bUndo.....................: An undo action is generated for the merging.
     514             :     //                             Undo is only for the target model, not for the
     515             :     //                             rSourceModel.
     516             :     // bTreadSourceAsConst.......: sal_True=the SourceModel will not be changed,
     517             :     //                             so pages will be copied.
     518             :     virtual void Merge(SdrModel& rSourceModel,
     519             :                sal_uInt16 nFirstPageNum=0, sal_uInt16 nLastPageNum=0xFFFF,
     520             :                sal_uInt16 nDestPos=0xFFFF,
     521             :                bool bMergeMasterPages = false, bool bAllMasterPages = false,
     522             :                bool bUndo = true, bool bTreadSourceAsConst = false);
     523             : 
     524             :     // Behaves like Merge(SourceModel=DestModel,nFirst,nLast,nDest,sal_False,sal_False,bUndo,!bMoveNoCopy);
     525             :     void CopyPages(sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
     526             :                    sal_uInt16 nDestPos,
     527             :                    bool bUndo = true, bool bMoveNoCopy = false);
     528             : 
     529             :     // BegUndo() / EndUndo() enables you to group arbitrarily many UndoActions
     530             :     // arbitrarily deeply. As comment for the UndoAction the first BegUndo(String) of all
     531             :     // nestings will be used.
     532             :     // In that case the NotifyUndoActionHdl will be called on the last EndUndo().
     533             :     // No UndoAction will be generated for an empty group.
     534             :     // All direct modifications on the SdrModel do not create an UndoActions.
     535             :     // Actions on the SdrView however do generate those.
     536             :     void BegUndo();                       // open Undo group
     537             :     void BegUndo(const OUString& rComment); // open Undo group
     538             :     void BegUndo(const OUString& rComment, const OUString& rObjDescr, SdrRepeatFunc eFunc=SDRREPFUNC_OBJ_NONE); // open Undo group
     539             :     void EndUndo();                       // close Undo group
     540             :     void AddUndo(SdrUndoAction* pUndo);
     541         130 :     sal_uInt16 GetUndoBracketLevel() const                       { return nUndoLevel; }
     542             :     const SdrUndoGroup* GetAktUndoGroup() const              { return pAktUndoGroup; }
     543             :     // only after the first BegUndo or before the last EndUndo:
     544             :     void SetUndoComment(const OUString& rComment);
     545             :     void SetUndoComment(const OUString& rComment, const OUString& rObjDescr);
     546             : 
     547             :     // The Undo management is only done if not NotifyUndoAction-Handler is set.
     548             :     // Default is 16. Minimal MaxUndoActionCount is 1!
     549             :     void  SetMaxUndoActionCount(sal_uIntPtr nAnz);
     550             :     sal_uIntPtr GetMaxUndoActionCount() const { return nMaxUndoCount; }
     551             :     void  ClearUndoBuffer();
     552             : 
     553             :     bool HasUndoActions() const;
     554             :     bool HasRedoActions() const;
     555             :     bool Undo();
     556             :     bool Redo();
     557             :     bool Repeat(SfxRepeatTarget&);
     558             : 
     559             :     // The application can set a handler here which collects the UndoActions einsammelt.
     560             :     // The handler has the following signature:
     561             :     //   void NotifyUndoActionHdl(SfxUndoAction* pUndoAction);
     562             :     // When calling the handler ownership is transferred;
     563             :     // The UndoAction belongs to the Handler, not the SdrModel.
     564       11235 :     void        SetNotifyUndoActionHdl(const Link& rLink)    { aUndoLink=rLink; }
     565           0 :     const Link& GetNotifyUndoActionHdl() const               { return aUndoLink; }
     566             : 
     567             :     /** application can set its own undo manager, BegUndo, EndUndo and AddUndoAction
     568             :         calls are routet to this interface if given */
     569             :     void SetSdrUndoManager( SfxUndoManager* pUndoManager );
     570             :     SfxUndoManager* GetSdrUndoManager() const;
     571             : 
     572             :     /** applications can set their own undo factory to overide creation of
     573             :         undo actions. The SdrModel will become owner of the given SdrUndoFactory
     574             :         and delete it upon its destruction. */
     575             :     void SetSdrUndoFactory( SdrUndoFactory* pUndoFactory );
     576             : 
     577             :     /** returns the models undo factory. This must be used to create
     578             :         undo actions for this model. */
     579             :     SdrUndoFactory& GetSdrUndoFactory() const;
     580             : 
     581             :     // You can set a handler which will be called multiple times while
     582             :     // streaming and which estimates the progress of the function.
     583             :     // The handler needs to have this signature:
     584             :     //   void class::IOProgressHdl(const USHORT& nPercent);
     585             :     // The first call of the handler will be with 0. The last call with 100.
     586             :     // In between there will at most be 99 calls with 1..99.
     587             :     // You can thus initialise the progres bar with 0 and close it on 100.
     588             :     // Mind that the handler will also be called if the App serves Draw data in the
     589             :     // office wide Draw-Exchange-Format because that happens through streaming into
     590             :     // a MemoryStream.
     591             :     void        SetIOProgressHdl(const Link& rLink)          { aIOProgressLink=rLink; }
     592             :     const Link& GetIOProgressHdl() const                     { return aIOProgressLink; }
     593             : 
     594             :     // Accessor methods for Palettes, Lists and Tabeles
     595             :     // FIXME: this badly needs re-factoring ...
     596       58192 :     XPropertyListRef GetPropertyList( XPropertyListType t ) const { return maProperties[ t ]; }
     597        6078 :     void             SetPropertyList( XPropertyListRef p ) { maProperties[ p->Type() ] = p; }
     598             : 
     599             :     // friendlier helpers
     600        7210 :     XDashListRef     GetDashList() const     { return XPropertyList::AsDashList(GetPropertyList( XDASH_LIST )); }
     601       10138 :     XHatchListRef    GetHatchList() const    { return XPropertyList::AsHatchList(GetPropertyList( XHATCH_LIST )); }
     602        9954 :     XColorListRef    GetColorList() const    { return XPropertyList::AsColorList(GetPropertyList( XCOLOR_LIST )); }
     603       10138 :     XBitmapListRef   GetBitmapList() const   { return XPropertyList::AsBitmapList(GetPropertyList( XBITMAP_LIST )); }
     604        6764 :     XLineEndListRef  GetLineEndList() const  { return XPropertyList::AsLineEndList(GetPropertyList( XLINE_END_LIST )); }
     605       10138 :     XGradientListRef GetGradientList() const { return XPropertyList::AsGradientList(GetPropertyList( XGRADIENT_LIST )); }
     606             : 
     607             :     // The DrawingEngine only references the StyleSheetPool, whoever
     608             :     // made it needs to delete it.
     609      172849 :     SfxStyleSheetBasePool* GetStyleSheetPool() const         { return mxStyleSheetPool.get(); }
     610         442 :     void SetStyleSheetPool(SfxStyleSheetBasePool* pPool)     { mxStyleSheetPool=pPool; }
     611             : 
     612             :     void    SetStarDrawPreviewMode(bool bPreview);
     613          36 :     bool    IsStarDrawPreviewMode() { return bStarDrawPreviewMode; }
     614             : 
     615           0 :     bool GetDisableTextEditUsesCommonUndoManager() const { return mbDisableTextEditUsesCommonUndoManager; }
     616         716 :     void SetDisableTextEditUsesCommonUndoManager(bool bNew) { mbDisableTextEditUsesCommonUndoManager = bNew; }
     617             : 
     618             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoModel();
     619             :     void setUnoModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xModel );
     620             : 
     621             :     // these functions are used by the api to disable repaints during a
     622             :     // set of api calls.
     623     1080461 :     bool isLocked() const { return mbModelLocked; }
     624             :     void setLock( bool bLock );
     625             : 
     626             :     void            SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
     627       95234 :     rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const { return mpForbiddenCharactersTable;}
     628             : 
     629             :     void SetCharCompressType( sal_uInt16 nType );
     630       33656 :     sal_uInt16 GetCharCompressType() const { return mnCharCompressType; }
     631             : 
     632             :     void SetKernAsianPunctuation( bool bEnabled );
     633       94848 :     bool IsKernAsianPunctuation() const { return mbKernAsianPunctuation; }
     634             : 
     635             :     void SetAddExtLeading( bool bEnabled );
     636       94860 :     bool IsAddExtLeading() const { return mbAddExtLeading; }
     637             : 
     638             :     void ReformatAllTextObjects();
     639             : 
     640             :     SdrOutliner* createOutliner( sal_uInt16 nOutlinerMode );
     641             :     void disposeOutliner( SdrOutliner* pOutliner );
     642             : 
     643      205586 :     bool IsWriter() const { return !bMyPool; }
     644             : 
     645             :     /** returns the numbering type that is used to format page fields in drawing shapes */
     646             :     virtual SvxNumType GetPageNumType() const;
     647             : 
     648             :     /** copies the items from the source set to the destination set. Both sets must have
     649             :         same ranges but can have different pools. */
     650             :     static void MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSet, SdrModel* pNewModel );
     651             : 
     652         424 :     bool IsInDestruction() const { return mbInDestruction;}
     653             : 
     654             :     static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelImplementationId();
     655             : 
     656           0 :     virtual ImageMap* GetImageMapForObject(SdrObject*){return NULL;};
     657           0 :     virtual sal_Int32 GetHyperlinkCount(SdrObject*){return 0;}
     658             : 
     659             :     /** enables (true) or disables (false) recording of undo actions
     660             :         If undo actions are added while undo is disabled, they are deleted.
     661             :         Disabling undo does not clear the current undo buffer! */
     662             :     void EnableUndo( bool bEnable );
     663             : 
     664             :     /** returns true if undo is currently enabled
     665             :         This returns false if undo was disabled using EnableUndo( false ) and
     666             :         also during the runtime of the Undo() and Redo() methods. */
     667             :     bool IsUndoEnabled() const;
     668             : };
     669             : 
     670             : typedef tools::WeakReference< SdrModel > SdrModelWeakRef;
     671             : 
     672             : 
     673             : 
     674             : #endif // INCLUDED_SVX_SVDMODEL_HXX
     675             : 
     676             : /*
     677             :             +-----------+
     678             :             | SdrModel  |
     679             :             +--+------+-+
     680             :                |      +-----------+
     681             :           +----+-----+            |
     682             :           |   ...    |            |
     683             :      +----+---+ +----+---+  +-----+--------+
     684             :      |SdrPage | |SdrPage |  |SdrLayerAdmin |
     685             :      +---+----+ +-+--+--++  +---+-------+--+
     686             :          |        |  |  |       |       +-------------------+
     687             :     +----+----+           +-----+-----+             +-------+-------+
     688             :     |   ...   |           |    ...    |             |      ...      |
     689             : +---+---+ +---+---+  +----+----+ +----+----+  +-----+------+ +------+-----+
     690             : |SdrObj | |SdrObj |  |SdrLayer | |SdrLayer |  |SdrLayerSet | |SdrLayerSet |
     691             : +-------+ +-------+  +---------+ +---------+  +------------+ +------------+
     692             : This class: SdrModel is the head of the data models for the StarView Drawing Engine.
     693             : 
     694             : ///////////////////////////////////////////////////////////////////////////////////////////////// */
     695             : 
     696             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10