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

Generated by: LCOV version 1.11