LibreOffice Module svx (master)  1
svdmodel.hxx
Go to the documentation of this file.
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 #pragma once
21 
22 #include <functional>
23 #include <memory>
24 #include <com/sun/star/uno/Sequence.hxx>
26 #include <editeng/outliner.hxx>
27 #include <rtl/ustring.hxx>
28 #include <tools/weakbase.h>
29 #include <svl/SfxBroadcaster.hxx>
30 #include <tools/degree.hxx>
31 #include <tools/fldunit.hxx>
32 #include <tools/fract.hxx>
33 #include <svl/hint.hxx>
34 #include <o3tl/enumarray.hxx>
35 
36 #include <svl/style.hxx>
37 #include <svx/xtable.hxx>
38 
39 class OutputDevice;
40 #include <svx/svdtypes.hxx>
41 #include <svx/svxdllapi.h>
42 
43 #include <rtl/ref.hxx>
44 #include <deque>
45 
46 #ifdef DBG_UTIL
47 // SdrObjectLifetimeWatchDog
48 #include <unordered_set>
49 #endif
50 
51 constexpr const sal_Unicode DEGREE_CHAR = u'\x00B0'; /* U+00B0 DEGREE SIGN */
52 
53 class SdrOutliner;
54 class SdrLayerAdmin;
55 class SdrObjList;
56 class SdrObject;
57 class SdrPage;
58 class SdrPageView;
59 class SdrTextObj;
60 class SdrUndoAction;
61 class SdrUndoGroup;
62 class AutoTimer;
63 class SfxItemPool;
64 class SfxItemSet;
65 class SfxRepeatTarget;
66 class SfxStyleSheet;
67 class SfxUndoAction;
68 class SfxUndoManager;
69 class XBitmapList;
70 class XColorList;
71 class XDashList;
72 class XGradientList;
73 class XHatchList;
74 class XLineEndList;
76 class SvNumberFormatter;
77 class SdrOutlinerCache;
78 class SdrUndoFactory;
79 class ImageMap;
80 class TextChain;
81 enum class CharCompressType;
82 namespace comphelper
83 {
84  class IEmbeddedHelper;
85  class LifecycleProxy;
86 }
87 namespace sfx2
88 {
89  class LinkManager;
90 }
91 namespace com::sun::star::beans {
92  struct PropertyValue;
93 }
94 
95 
96 enum class SdrHintKind
97 {
98  LayerChange, // changed layer definition
99  LayerOrderChange, // order of layer changed (Insert/Remove/ChangePos)
100  PageOrderChange, // order of pages (object pages or master pages) changed (Insert/Remove/ChangePos)
101  ObjectChange, // object changed
102  ObjectInserted, // new object inserted
103  ObjectRemoved, // symbol object removed from list
104  ModelCleared, // deleted the whole model (no pages exist anymore). not impl.
105  RefDeviceChange, // RefDevice changed
106  DefaultTabChange, // Default tabulator width changed
107  SwitchToPage, // #94278# UNDO/REDO at an object evtl. on another page
108  BeginEdit, // Is called after the object has entered text edit mode
109  EndEdit // Is called after the object has left text edit mode
110 };
111 
112 class SVXCORE_DLLPUBLIC SdrHint final : public SfxHint
113 {
114 private:
116  const SdrObject* mpObj;
117  const SdrPage* mpPage;
118 
119 public:
120  explicit SdrHint(SdrHintKind eNewHint);
121  explicit SdrHint(SdrHintKind eNewHint, const SdrObject& rNewObj);
122  explicit SdrHint(SdrHintKind eNewHint, const SdrPage* pPage);
123  explicit SdrHint(SdrHintKind eNewHint, const SdrObject& rNewObj, const SdrPage* pPage);
124 
125  const SdrPage* GetPage() const { return mpPage;}
126  const SdrObject* GetObject() const { return mpObj;}
127  SdrHintKind GetKind() const { return meHint;}
128 };
129 
131 //
132 // SdrModel
133 // DlgEdModel
134 // FmFormModel
135 // ScDrawLayer
136 // SdDrawDocument
137 // SwDrawModel
138 // OReportModel
139 
140 struct SdrModelImpl;
141 
143 {
144 private:
145 #ifdef DBG_UTIL
146  // SdrObjectLifetimeWatchDog:
147  // Use maAllIncarnatedObjects to keep track of all SdrObjects incarnated using this SdrModel
148  // (what is now possible after the paradigm change that a SdrObject stays at a single SdrModel
149  // for it's whole lifetime).
150  // The two methods are exclusive, debug-only, only-accessible-by SdrObject accesses to else
151  // hidden/non-existing maAllIncarnatedObjects.
152  // SdrObject::SdrObject uses impAddIncarnatedSdrObjectToSdrModel, while SdrObject::~SdrObject
153  // uses impRemoveIncarnatedSdrObjectToSdrModel.
154  // There are two places which may trigger SAL_WARN warnings:
155  // - impRemoveIncarnatedSdrObjectToSdrModel when the to-be-removed SdrObject is not member of SdrModel
156  // - SdrModel::~SdrModel after all SdrObjects *should* be cleaned-up.
157  // SdrModel::~SdrModel will also - for convenience - Free the non-deleted SdrObjects if there
158  // are any.
159  // Using std::unordered_set will use quasi constant access times, so this watchdog will not
160  // be expensive. Nonetheless, only use with debug code. It may be seductive to use this in
161  // product code, too, especially if it will indeed trigger - but its intention is clearly
162  // to find/identify MemoryLeaks caused by SdrObjects
163  friend void impAddIncarnatedSdrObjectToSdrModel(const SdrObject& rSdrObject, SdrModel& rSdrModel);
164  friend void impRemoveIncarnatedSdrObjectToSdrModel(const SdrObject& rSdrObject, SdrModel& rSdrModel);
165  std::unordered_set< const SdrObject* > maAllIncarnatedObjects;
166 #endif
167 protected:
168  std::vector<rtl::Reference<SdrPage>> maMasterPages;
169  std::vector<rtl::Reference<SdrPage>> maPages;
170  std::function<void(std::unique_ptr<SdrUndoAction>)> m_aUndoLink; // link to a NotifyUndo-Handler
171  Size m_aMaxObjSize; // e.g. for auto-growing text
172  Fraction m_aObjUnit; // description of the coordinate units for ClipBoard, Drag&Drop, ...
173  MapUnit m_eObjUnit; // see above
174  FieldUnit m_eUIUnit; // unit, scale (e.g. 1/1000) for the UI (status bar) is set by ImpSetUIUnit()
175  Fraction m_aUIScale; // see above
176  OUString m_aUIUnitStr; // see above
177  Fraction m_aUIUnitFact; // see above
178  int m_nUIUnitDecimalMark; // see above
179 
180  std::unique_ptr<SdrLayerAdmin> m_pLayerAdmin;
182  comphelper::IEmbeddedHelper* m_pEmbeddedHelper; // helper for embedded objects to get rid of the SfxObjectShell
183  std::unique_ptr<SdrOutliner> m_pDrawOutliner; // an Outliner for outputting text
184  std::unique_ptr<SdrOutliner> m_pHitTestOutliner;// an Outliner for the HitTest
185  std::unique_ptr<SdrOutliner> m_pChainingOutliner; // an Outliner for chaining overflowing text
186  sal_Int32 mnDefTextHgt; // Default text height in logical units
187  VclPtr<OutputDevice> m_pRefOutDev; // ReferenceDevice for the EditEngine
192  std::deque<std::unique_ptr<SfxUndoAction>> m_aUndoStack;
193  std::deque<std::unique_ptr<SfxUndoAction>> m_aRedoStack;
194  std::unique_ptr<SdrUndoGroup> m_pCurrentUndoGroup; // For multi-level
195  sal_uInt16 m_nUndoLevel; // undo nesting
196  bool m_bIsWriter:1; // to clean up pMyPool from 303a
197  bool mbUndoEnabled:1; // If false no undo is recorded or we are during the execution of an undo action
198  bool mbChanged:1;
199  bool m_bPagNumsDirty:1;
200  bool m_bMPgNumsDirty:1;
201  bool m_bTransportContainer:1; // doc is temporary object container, no display (e.g. clipboard)
202  bool m_bReadOnly:1;
203  bool m_bTransparentTextFrames:1;
204  bool m_bSwapGraphics:1;
205  bool m_bPasteResize:1; // Objects are being resized due to Paste with different MapMode
206  bool m_bStarDrawPreviewMode:1;
207  bool mbDisableTextEditUsesCommonUndoManager:1;
209  sal_uInt32 m_nMaxUndoCount;
210 
211  std::unique_ptr<TextChain> m_pTextChain;
212 
213 
214 public:
215  std::shared_ptr<SvxForbiddenCharactersTable> mpForbiddenCharactersTable;
216 
217  std::unique_ptr<SdrOutlinerCache> mpOutlinerCache;
218  //get a vector of all the SdrOutliner belonging to the model
219  std::vector<SdrOutliner*> GetActiveOutliners() const;
220  std::unique_ptr<SdrModelImpl> mpImpl;
222  sal_uInt16 mnHandoutPageCount;
227 
228  // Color, Dash, Line-End, Hatch, Gradient, Bitmap property lists ...
230 
231  sal_uInt16 getHandoutPageCount() const { return mnHandoutPageCount; }
232  void setHandoutPageCount( sal_uInt16 nHandoutPageCount ) { mnHandoutPageCount = nHandoutPageCount; }
233 
234  // Adapt to given Size and Borders scaling all contained data, maybe
235  // including PresObj's in higher derivations
236  virtual void adaptSizeAndBorderForAllPages(
237  const Size& rNewSize,
238  tools::Long nLeft = 0,
239  tools::Long nRight = 0,
240  tools::Long nUpper = 0,
241  tools::Long nLower = 0);
242 
243 protected:
244  virtual css::uno::Reference< css::uno::XInterface > createUnoModel();
245 
246 private:
247  SdrModel(const SdrModel& rSrcModel) = delete;
248  void operator=(const SdrModel& rSrcModel) = delete;
249  bool operator==(const SdrModel& rCmpModel) const = delete;
250  SVX_DLLPRIVATE void ImpPostUndoAction(std::unique_ptr<SdrUndoAction> pUndo);
251  SVX_DLLPRIVATE void ImpSetUIUnit();
252  SVX_DLLPRIVATE void ImpSetOutlinerDefaults( SdrOutliner* pOutliner, bool bInit = false );
253  SVX_DLLPRIVATE void ImpReformatAllTextObjects();
254  SVX_DLLPRIVATE void ImpReformatAllEdgeObjects();
255  SVX_DLLPRIVATE void ImpCreateTables(bool bDisablePropertyFiles);
256 
257  // this is a weak reference to a possible living api wrapper for this model
258  css::uno::Reference< css::uno::XInterface > mxUnoModel;
259 
260  // used to disable unique name checking during page move
261  bool mbMakePageObjectsNamesUnique = true;
262 
263 public:
264  SVX_DLLPRIVATE virtual bool IsCreatingDataObj() const { return false; }
265  bool IsTransportContainer() const { return m_bTransportContainer; }
266  bool IsPasteResize() const { return m_bPasteResize; }
267  void SetPasteResize(bool bOn) { m_bPasteResize=bOn; }
268  // If a custom Pool is put here, the class will call methods
269  // on it (Put(), Remove()). On disposal of SdrModel the pool
270  // will be deleted with delete.
271  // If you give NULL instead, it will create an own pool (SdrItemPool)
272  // which will also be disposed in the destructor.
273  // If you do use a custom Pool, make sure you inherit from SdrItemPool,
274  // if you want to use symbol objects inherited from SdrAttrObj.
275  // If, however, you use objects inheriting from SdrObject you are free
276  // to chose a pool of your liking.
277  //
278  // tdf#118731 a bDisablePropertyFiles of true will disable ability to load
279  // XPropertyFiles describing defaults. Useful for UI preview widgets
280  explicit SdrModel(
281  SfxItemPool* pPool = nullptr,
282  ::comphelper::IEmbeddedHelper* pPers = nullptr,
283  bool bDisablePropertyFiles = false);
284  virtual ~SdrModel() override;
285  void ClearModel(bool bCalledFromDestructor);
286 
287  // Override this to enable the Swap/LoadOnDemand of graphics.
288  // If rbDeleteAfterUse is set to sal_True the SvStream instance from
289  // the caller will be disposed after use.
290  // If this method returns NULL, a temporary file will be allocated for
291  // swapping.
292  // The stream from which the model was loaded or in which is was saved last
293  // needs to be delivered
294  virtual css::uno::Reference<
295  css::embed::XStorage> GetDocumentStorage() const;
296  css::uno::Reference<
297  css::io::XInputStream >
298  GetDocumentStream(OUString const& rURL,
299  ::comphelper::LifecycleProxy const & rProxy) const;
300  // Change the template attributes of the symbol objects to hard attributes
301  void BurnInStyleSheetAttributes();
302  // If you inherit from SdrPage you also need to inherit from SdrModel
303  // and implement both VM AllocPage() and AllocModel()...
304  virtual rtl::Reference<SdrPage> AllocPage(bool bMasterPage);
305  virtual SdrModel* AllocModel() const;
306 
307  // Changes on the layers set the modified flag and broadcast on the model!
308  const SdrLayerAdmin& GetLayerAdmin() const { return *m_pLayerAdmin; }
309  SdrLayerAdmin& GetLayerAdmin() { return *m_pLayerAdmin; }
310 
311  const SfxItemPool& GetItemPool() const { return *m_pItemPool; }
312  SfxItemPool& GetItemPool() { return *m_pItemPool; }
313 
314  SdrOutliner& GetDrawOutliner(const SdrTextObj* pObj=nullptr) const;
315 
316  SdrOutliner& GetHitTestOutliner() const { return *m_pHitTestOutliner; }
317  const SdrTextObj* GetFormattingTextObj() const;
318  // put the TextDefaults (Font,Height,Color) in a Set
319  void SetTextDefaults() const;
320  static void SetTextDefaults( SfxItemPool* pItemPool, sal_Int32 nDefTextHgt );
321 
322  SdrOutliner& GetChainingOutliner(const SdrTextObj* pObj) const;
323  TextChain * GetTextChain() const;
324 
325  // ReferenceDevice for the EditEngine
326  void SetRefDevice(OutputDevice* pDev);
327  OutputDevice* GetRefDevice() const { return m_pRefOutDev.get(); }
328  // If a new MapMode is set on the RefDevice (or similar)
329  void RefDeviceChanged(); // not yet implemented
330  // default font height in logical units
331  void SetDefaultFontHeight(sal_Int32 nVal);
332  // default tabulator width for the EditEngine
333  void SetDefaultTabulator(sal_uInt16 nVal);
334  sal_uInt16 GetDefaultTabulator() const { return m_nDefaultTabulator; }
335 
336  // The DefaultStyleSheet will be used in every symbol object which is inserted
337  // in this model and does not have a StyleSheet set.
338  SfxStyleSheet* GetDefaultStyleSheet() const { return m_pDefaultStyleSheet; }
339  void SetDefaultStyleSheet(SfxStyleSheet* pDefSS) { m_pDefaultStyleSheet = pDefSS; }
340 
341  // #i119287# default StyleSheet for SdrGrafObj and SdrOle2Obj
342  SfxStyleSheet* GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj() const { return mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj; }
343  void SetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(SfxStyleSheet* pDefSS) { mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj = pDefSS; }
344 
345  sfx2::LinkManager* GetLinkManager() { return m_pLinkManager; }
346  void SetLinkManager( sfx2::LinkManager* pLinkMgr ) { m_pLinkManager = pLinkMgr; }
347 
348  ::comphelper::IEmbeddedHelper* GetPersist() const { return m_pEmbeddedHelper; }
349  void SetPersist( ::comphelper::IEmbeddedHelper *p ) { m_pEmbeddedHelper = p; }
350 
351  // Unit for the symbol coordination
352  // Default is 1 logical unit = 1/100mm (Unit=MapUnit::Map100thMM, Fract=(1,1)).
353  // Examples:
354  // MapUnit::MapPoint, Fraction(72,1) : 1 log Einh = 72 Point = 1 Inch
355  // MapUnit::MapPoint, Fraction(1,20) : 1 log Einh = 1/20 Point = 1 Twip
356  // MapUnit::MapTwip, Fraction(1,1) : 1 log Einh = 1 Twip
357  // MapUnit::Map100thMM, Fraction(1,10) : 1 log Einh = 1/1000mm
358  // MapUnit::MapMM, Fraction(1000,1) : 1 log Einh = 1000mm = 1m
359  // MapUnit::MapCM, Fraction(100,1) : 1 log Einh = 100cm = 1m
360  // MapUnit::MapCM, Fraction(100000,1): 1 log Einh = 100000cm = 1km
361  // (FWIW: you cannot represent light years).
362  // The scaling unit is needed for the Engine to serve the Clipboard
363  // with the correct sizes.
364  MapUnit GetScaleUnit() const { return m_eObjUnit; }
365  void SetScaleUnit(MapUnit eMap);
366  const Fraction& GetScaleFraction() const { return m_aObjUnit; }
367  void SetScaleFraction(const Fraction& rFrac);
368  // Setting both simultaneously performs a little better
369  void SetScaleUnit(MapUnit eMap, const Fraction& rFrac);
370 
371  // maximal size e.g. for auto growing texts
372  const Size& GetMaxObjSize() const { return m_aMaxObjSize; }
373  void SetMaxObjSize(const Size& rSiz) { m_aMaxObjSize=rSiz; }
374 
375  // For the View! to display sane numbers in the status bar: Default is mm.
376  void SetUIUnit(FieldUnit eUnit);
377  FieldUnit GetUIUnit() const { return m_eUIUnit; }
378  // The scale of the drawing. Default 1/1.
379  void SetUIScale(const Fraction& rScale);
380  const Fraction& GetUIScale() const { return m_aUIScale; }
381  // Setting both simultaneously performs a little better
382  void SetUIUnit(FieldUnit eUnit, const Fraction& rScale);
383 
384  static OUString GetUnitString(FieldUnit eUnit);
385  OUString GetMetricString(tools::Long nVal, bool bNoUnitChars = false, sal_Int32 nNumDigits = -1) const;
386  static OUString GetAngleString(Degree100 nAngle);
387  static OUString GetPercentString(const Fraction& rVal);
388 
389  // RecalcPageNums is ordinarily only called by the Page.
390  bool IsPagNumsDirty() const { return m_bPagNumsDirty; };
391  bool IsMPgNumsDirty() const { return m_bMPgNumsDirty; };
392  void RecalcPageNums(bool bMaster);
393  // After the Insert the Page belongs to the SdrModel.
394  virtual void InsertPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
395  virtual void DeletePage(sal_uInt16 nPgNum);
396  // Remove means transferring ownership to the caller (opposite of Insert)
397  virtual rtl::Reference<SdrPage> RemovePage(sal_uInt16 nPgNum);
398  virtual void MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos);
399  const SdrPage* GetPage(sal_uInt16 nPgNum) const;
400  SdrPage* GetPage(sal_uInt16 nPgNum);
401  sal_uInt16 GetPageCount() const;
402  virtual void PageListChanged();
403 
404  // Masterpages
405  virtual void InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
406  void DeleteMasterPage(sal_uInt16 nPgNum);
407  // Remove means transferring ownership to the caller (opposite of Insert)
408  virtual rtl::Reference<SdrPage> RemoveMasterPage(sal_uInt16 nPgNum);
409  void MoveMasterPage(sal_uInt16 nPgNum, sal_uInt16 nNewPos);
410  const SdrPage* GetMasterPage(sal_uInt16 nPgNum) const;
411  SdrPage* GetMasterPage(sal_uInt16 nPgNum);
412  sal_uInt16 GetMasterPageCount() const;
413  virtual void MasterPageListChanged();
414 
415  // modified flag. Is set automatically when something changes on the Pages
416  // symbol objects. You need to reset it yourself, however, e.g. on Save().
417  bool IsChanged() const { return mbChanged; }
418  virtual void SetChanged(bool bFlg = true);
419 
420  // If set to sal_True, graphics from graphics objects will:
421  // - not be loaded immediately when loading a document,
422  // but only once they are needed (e.g. displayed).
423  // - be pruned from memory if they are not needed.
424  // For that to work, override the virtual method GetDocumentStream().
425  // Default=FALSE. Flag is not persistent.
426  bool IsSwapGraphics() const { return m_bSwapGraphics; }
427  void SetSwapGraphics();
428 
429  // Text frames without filling can be select with a mouse click by default (sal_False).
430  // With this flag set to true you can hit them only in the area in which text is to be
431  // found.
432  bool IsPickThroughTransparentTextFrames() const { return m_bTransparentTextFrames; }
433  void SetPickThroughTransparentTextFrames(bool bOn) { m_bTransparentTextFrames=bOn; }
434 
435  // Can the model be changed at all?
436  // Is only evaluated by the possibility methods of the View.
437  // Direct manipulations on the model, ... do not respect this flag.
438  // Override this and return the appropriate ReadOnly status
439  // of the files, i.e. true or false. (Method is called multiple
440  // times, so use one flag only!)
441  virtual bool IsReadOnly() const;
442  void SetReadOnly(bool bYes);
443 
444  // Mixing two SdrModels. Mind that rSourceModel is not const.
445  // The pages will not be copied but moved, when inserted.
446  // rSourceModel may very well be empty afterwards.
447  // nFirstPageNum,nLastPageNum: The pages to take from rSourceModel
448  // nDestPos..................: position to insert
449  // bMergeMasterPages.........: sal_True = needed MasterPages will be taken
450  // from rSourceModel
451  // sal_False= the MasterPageDescriptors of
452  // the pages of the rSourceModel will be
453  // mapped on the existing MasterPages.
454  // bUndo.....................: An undo action is generated for the merging.
455  // Undo is only for the target model, not for the
456  // rSourceModel.
457  // bTreadSourceAsConst.......: sal_True=the SourceModel will not be changed,
458  // so pages will be copied.
459  virtual void Merge(SdrModel& rSourceModel,
460  sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
461  sal_uInt16 nDestPos,
462  bool bMergeMasterPages, bool bAllMasterPages,
463  bool bUndo = true, bool bTreadSourceAsConst = false);
464 
465  // Behaves like Merge(SourceModel=DestModel,nFirst,nLast,nDest,sal_False,sal_False,bUndo,!bMoveNoCopy);
466  void CopyPages(sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
467  sal_uInt16 nDestPos,
468  bool bUndo, bool bMoveNoCopy);
469 
470  // BegUndo() / EndUndo() enables you to group arbitrarily many UndoActions
471  // arbitrarily deeply. As comment for the UndoAction the first BegUndo(String) of all
472  // nestings will be used.
473  // In that case the NotifyUndoActionHdl will be called on the last EndUndo().
474  // No UndoAction will be generated for an empty group.
475  // All direct modifications on the SdrModel do not create an UndoActions.
476  // Actions on the SdrView however do generate those.
477  void BegUndo(); // open Undo group
478  void BegUndo(const OUString& rComment); // open Undo group
479  void BegUndo(const OUString& rComment, const OUString& rObjDescr, SdrRepeatFunc eFunc); // open Undo group
480  void EndUndo(); // close Undo group
481  void AddUndo(std::unique_ptr<SdrUndoAction> pUndo);
482  sal_uInt16 GetUndoBracketLevel() const { return m_nUndoLevel; }
483  // only after the first BegUndo or before the last EndUndo:
484  void SetUndoComment(const OUString& rComment);
485  void SetUndoComment(const OUString& rComment, const OUString& rObjDescr);
486 
487  // The Undo management is only done if NotifyUndoAction-Handler is not set.
488  // Default is 16. Minimal MaxUndoActionCount is 1.
489  void SetMaxUndoActionCount(sal_uInt32 nCount);
490  void ClearUndoBuffer();
491 
492  bool HasUndoActions() const;
493  bool HasRedoActions() const;
494  void Undo();
495  void Redo();
496  void Repeat(SfxRepeatTarget&);
497 
498  // The application can set a handler here which collects the UndoActions einsammelt.
499  // The handler has the following signature:
500  // void NotifyUndoActionHdl(SfxUndoAction* pUndoAction);
501  // When calling the handler ownership is transferred;
502  // The UndoAction belongs to the Handler, not the SdrModel.
503  void SetNotifyUndoActionHdl(const std::function<void(std::unique_ptr<SdrUndoAction>)>& rLink) { m_aUndoLink=rLink; }
504 
507  void SetSdrUndoManager( SfxUndoManager* pUndoManager );
508  SfxUndoManager* GetSdrUndoManager() const;
509 
513  void SetSdrUndoFactory( SdrUndoFactory* pUndoFactory );
514 
517  SdrUndoFactory& GetSdrUndoFactory() const;
518 
519  // Accessor methods for Palettes, Lists and Tables
520  // FIXME: this badly needs re-factoring...
521  const XPropertyListRef& GetPropertyList( XPropertyListType t ) const { return maProperties[ t ]; }
522  void SetPropertyList( XPropertyListRef const & p ) { maProperties[ p->Type() ] = p; }
523 
524  // friendlier helpers
532 
533  // The DrawingEngine only references the StyleSheetPool, whoever
534  // made it needs to delete it.
535  SfxStyleSheetBasePool* GetStyleSheetPool() const { return mxStyleSheetPool.get(); }
536  void SetStyleSheetPool(SfxStyleSheetBasePool* pPool) { mxStyleSheetPool=pPool; }
537 
538  void SetStarDrawPreviewMode(bool bPreview);
539  bool IsStarDrawPreviewMode() const { return m_bStarDrawPreviewMode; }
540 
541  bool GetDisableTextEditUsesCommonUndoManager() const { return mbDisableTextEditUsesCommonUndoManager; }
542  void SetDisableTextEditUsesCommonUndoManager(bool bNew) { mbDisableTextEditUsesCommonUndoManager = bNew; }
543 
544  css::uno::Reference< css::uno::XInterface > const & getUnoModel();
545  void setUnoModel( const css::uno::Reference< css::uno::XInterface >& xModel );
546 
547  // these functions are used by the api to disable repaints during a
548  // set of api calls.
549  bool isLocked() const { return mbModelLocked; }
550  void setLock( bool bLock );
551 
552  void SetForbiddenCharsTable( const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars );
553  const std::shared_ptr<SvxForbiddenCharactersTable>& GetForbiddenCharsTable() const { return mpForbiddenCharactersTable;}
554 
555  void SetCharCompressType( CharCompressType nType );
556  CharCompressType GetCharCompressType() const { return mnCharCompressType; }
557 
558  void SetKernAsianPunctuation( bool bEnabled );
559  bool IsKernAsianPunctuation() const { return mbKernAsianPunctuation; }
560 
561  void SetAddExtLeading( bool bEnabled );
562  bool IsAddExtLeading() const { return mbAddExtLeading; }
563 
564  // tdf#99729 compatibility flag
565  void SetAnchoredTextOverflowLegacy(bool bEnabled);
566  bool IsAnchoredTextOverflowLegacy() const;
567 
568  void ReformatAllTextObjects();
569 
570  std::unique_ptr<SdrOutliner> createOutliner( OutlinerMode nOutlinerMode );
571  void disposeOutliner( std::unique_ptr<SdrOutliner> pOutliner );
572 
573  bool IsWriter() const { return m_bIsWriter; }
574 
575  // Used as a fallback in *::ReadUserDataSequence() to process common properties
576  void ReadUserDataSequenceValue(const css::beans::PropertyValue *pValue);
577  void WriteUserDataSequence(css::uno::Sequence < css::beans::PropertyValue >& rValues);
578 
580  virtual SvxNumType GetPageNumType() const;
581 
584  static void MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSet, SdrModel* pNewModel );
585 
586  bool IsInDestruction() const { return mbInDestruction;}
587 
588  static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
589 
593  void EnableUndo( bool bEnable );
594 
598  bool IsUndoEnabled() const;
599 
600  // used to prevent object name change during page move
601  bool DoesMakePageObjectsNamesUnique() const { return mbMakePageObjectsNamesUnique; }
602  void DoMakePageObjectsNamesUnique(bool bDo) { mbMakePageObjectsNamesUnique = bDo; }
603 
604  virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
605 };
606 
607 /*
608  +-----------+
609  | SdrModel |
610  +--+------+-+
611  | +-----------+
612  +----+-----+ |
613  | ... | |
614  +----+---+ +----+---+ +-----+--------+
615  |SdrPage | |SdrPage | |SdrLayerAdmin |
616  +---+----+ +-+--+--++ +---+-------+--+
617  | | | | | +-------------------+
618  +----+----+ +-----+-----+ +-------+-------+
619  | ... | | ... | | ... |
620 +---+---+ +---+---+ +----+----+ +----+----+ +-----+------+ +------+-----+
621 |SdrObj | |SdrObj | |SdrLayer | |SdrLayer | |SdrLayerSet | |SdrLayerSet |
622 +-------+ +-------+ +---------+ +---------+ +------------+ +------------+
623 This class: SdrModel is the head of the data models for the StarView Drawing Engine.
624 
626 
627 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::deque< std::unique_ptr< SfxUndoAction > > m_aUndoStack
Definition: svdmodel.hxx:192
std::vector< rtl::Reference< SdrPage > > maPages
Definition: svdmodel.hxx:169
XPropertyListType t
Definition: xtable.cxx:370
SdrHintKind meHint
Definition: svdmodel.hxx:115
FieldUnit
std::unique_ptr< SdrOutliner > m_pHitTestOutliner
Definition: svdmodel.hxx:184
OutlinerMode
SdrHintKind GetKind() const
Definition: svdmodel.hxx:127
CharCompressType GetCharCompressType() const
Definition: svdmodel.hxx:556
const XPropertyListRef & GetPropertyList(XPropertyListType t) const
Definition: svdmodel.hxx:521
constexpr const sal_Unicode DEGREE_CHAR
Definition: svdmodel.hxx:51
struct _xmlTextWriter * xmlTextWriterPtr
void SetStyleSheetPool(SfxStyleSheetBasePool *pPool)
Definition: svdmodel.hxx:536
bool IsKernAsianPunctuation() const
Definition: svdmodel.hxx:559
static XLineEndListRef AsLineEndList(rtl::Reference< XPropertyList > const &plist)
Definition: xtable.hxx:385
bool IsStarDrawPreviewMode() const
Definition: svdmodel.hxx:539
const Fraction & GetScaleFraction() const
Definition: svdmodel.hxx:366
std::unique_ptr< SdrUndoGroup > m_pCurrentUndoGroup
Definition: svdmodel.hxx:194
long Long
void impAddIncarnatedSdrObjectToSdrModel(const SdrObject &rSdrObject, SdrModel &rSdrModel)
Definition: svdobj.cxx:323
static XBitmapListRef AsBitmapList(rtl::Reference< XPropertyList > const &plist)
Definition: xtable.hxx:379
void SetNotifyUndoActionHdl(const std::function< void(std::unique_ptr< SdrUndoAction >)> &rLink)
Definition: svdmodel.hxx:503
Abstract base class (ABC) for all UndoActions of DrawingEngine.
Definition: svdundo.hxx:56
SdrHintKind
Definition: svdmodel.hxx:96
rtl::Reference< SfxStyleSheetBasePool > mxStyleSheetPool
Definition: svdmodel.hxx:188
bool IsPickThroughTransparentTextFrames() const
Definition: svdmodel.hxx:432
std::unique_ptr< SdrOutlinerCache > mpOutlinerCache
Definition: svdmodel.hxx:217
XDashListRef GetDashList() const
Definition: svdmodel.hxx:525
bool IsSwapGraphics() const
Definition: svdmodel.hxx:426
SfxStyleSheet * mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj
Definition: svdmodel.hxx:190
const SfxBroadcaster & operator=(const SfxBroadcaster &)=delete
const Size & GetMaxObjSize() const
Definition: svdmodel.hxx:372
sal_uInt16 m_nUndoLevel
Definition: svdmodel.hxx:195
OutputDevice * GetRefDevice() const
Definition: svdmodel.hxx:327
XPatternListRef GetPatternList() const
Definition: svdmodel.hxx:529
SvxNumType
void impRemoveIncarnatedSdrObjectToSdrModel(const SdrObject &rSdrObject, SdrModel &rSdrModel)
Definition: svdobj.cxx:327
const SdrObject * mpObj
Definition: svdmodel.hxx:116
void SetDefaultStyleSheet(SfxStyleSheet *pDefSS)
Definition: svdmodel.hxx:339
sal_uInt16 sal_Unicode
SfxStyleSheet * GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj() const
Definition: svdmodel.hxx:342
std::unique_ptr< SdrOutliner > m_pDrawOutliner
Definition: svdmodel.hxx:183
static XPatternListRef AsPatternList(rtl::Reference< XPropertyList > const &plist)
Definition: xtable.hxx:382
VclPtr< OutputDevice > m_pRefOutDev
Definition: svdmodel.hxx:187
MapUnit GetScaleUnit() const
Definition: svdmodel.hxx:364
SdrRepeatFunc
Definition: svdtypes.hxx:65
void setHandoutPageCount(sal_uInt16 nHandoutPageCount)
Definition: svdmodel.hxx:232
constexpr OUStringLiteral IsReadOnly(u"IsReadOnly")
void SetMaxObjSize(const Size &rSiz)
Definition: svdmodel.hxx:373
css::uno::Reference< css::uno::XInterface > mxUnoModel
Definition: svdmodel.hxx:258
Fraction m_aObjUnit
Definition: svdmodel.hxx:172
bool isLocked() const
Definition: svdmodel.hxx:549
XLineEndListRef GetLineEndList() const
Definition: svdmodel.hxx:530
sal_uInt32 m_nMaxUndoCount
Definition: svdmodel.hxx:209
sfx2::LinkManager * GetLinkManager()
Definition: svdmodel.hxx:345
int m_nUIUnitDecimalMark
Definition: svdmodel.hxx:178
FieldUnit GetUIUnit() const
Definition: svdmodel.hxx:377
SdrOutliner & GetHitTestOutliner() const
Definition: svdmodel.hxx:316
static XColorListRef AsColorList(rtl::Reference< XPropertyList > const &plist)
Definition: xtable.hxx:376
std::unordered_set< const SdrObject * > maAllIncarnatedObjects
Definition: svdmodel.hxx:165
bool mbKernAsianPunctuation
Definition: svdmodel.hxx:224
OUString GetUnitString(tools::Long nVal_100, FieldUnit eFieldUnit, sal_Unicode cSep)
Definition: dlgunit.hxx:27
XPropertyListType
Definition: xtable.hxx:131
std::unique_ptr< TextChain > m_pTextChain
Definition: svdmodel.hxx:211
rtl::Reference< SfxItemPool > m_pItemPool
Definition: svdmodel.hxx:181
bool IsAddExtLeading() const
Definition: svdmodel.hxx:562
CharCompressType
bool IsWriter() const
Definition: svdmodel.hxx:573
bool IsPasteResize() const
Definition: svdmodel.hxx:266
bool mbAddExtLeading
Definition: svdmodel.hxx:225
sal_uInt16 mnHandoutPageCount
Definition: svdmodel.hxx:222
sal_uInt16 getHandoutPageCount() const
Definition: svdmodel.hxx:231
XGradientListRef GetGradientList() const
Definition: svdmodel.hxx:531
SdrLayerAdmin & GetLayerAdmin()
Definition: svdmodel.hxx:309
The SdrUndoFactory can be set and retrieved from the SdrModel.
Definition: svdundo.hxx:700
float u
void SetLinkManager(sfx2::LinkManager *pLinkMgr)
Definition: svdmodel.hxx:346
Fraction m_aUIScale
Definition: svdmodel.hxx:175
static bool bInit
Definition: objfac3d.cxx:30
Size m_aMaxObjSize
Definition: svdmodel.hxx:171
sal_uInt16 GetUndoBracketLevel() const
Definition: svdmodel.hxx:482
std::shared_ptr< SvxForbiddenCharactersTable > mpForbiddenCharactersTable
Definition: svdmodel.hxx:215
Abstract DrawObject.
Definition: svdobj.hxx:259
sal_uInt16 m_nDefaultTabulator
Definition: svdmodel.hxx:208
void SetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(SfxStyleSheet *pDefSS)
Definition: svdmodel.hxx:343
void SetPickThroughTransparentTextFrames(bool bOn)
Definition: svdmodel.hxx:433
bool IsChanged() const
Definition: svdmodel.hxx:417
bool mbInDestruction
Definition: svdmodel.hxx:226
Aggregation of arbitrarily many UndoActions to a single UndoAction.
Definition: svdundo.hxx:88
bool GetDisableTextEditUsesCommonUndoManager() const
Definition: svdmodel.hxx:541
void SetPasteResize(bool bOn)
Definition: svdmodel.hxx:267
bool mbModelLocked
Definition: svdmodel.hxx:223
std::vector< rtl::Reference< SdrPage > > maMasterPages
Definition: svdmodel.hxx:168
bool DoesMakePageObjectsNamesUnique() const
Definition: svdmodel.hxx:601
const std::shared_ptr< SvxForbiddenCharactersTable > & GetForbiddenCharsTable() const
Definition: svdmodel.hxx:553
const Fraction & GetUIScale() const
Definition: svdmodel.hxx:380
MapUnit m_eObjUnit
Definition: svdmodel.hxx:173
static XGradientListRef AsGradientList(rtl::Reference< XPropertyList > const &plist)
Definition: xtable.hxx:388
bool IsMPgNumsDirty() const
Definition: svdmodel.hxx:391
XHatchListRef GetHatchList() const
Definition: svdmodel.hxx:526
std::unique_ptr< SdrOutliner > m_pChainingOutliner
Definition: svdmodel.hxx:185
FieldUnit m_eUIUnit
Definition: svdmodel.hxx:174
SfxStyleSheet * m_pDefaultStyleSheet
Definition: svdmodel.hxx:189
SfxStyleSheet * GetDefaultStyleSheet() const
Definition: svdmodel.hxx:338
CharCompressType mnCharCompressType
Definition: svdmodel.hxx:221
::comphelper::IEmbeddedHelper * GetPersist() const
Definition: svdmodel.hxx:348
SfxStyleSheetBasePool * GetStyleSheetPool() const
Definition: svdmodel.hxx:535
sfx2::LinkManager * m_pLinkManager
Definition: svdmodel.hxx:191
std::unique_ptr< SdrModelImpl > mpImpl
Definition: svdmodel.hxx:220
Fraction m_aUIUnitFact
Definition: svdmodel.hxx:177
comphelper::IEmbeddedHelper * m_pEmbeddedHelper
Definition: svdmodel.hxx:182
bool mbChanged
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
std::unique_ptr< SdrLayerAdmin > m_pLayerAdmin
Definition: svdmodel.hxx:180
void DoMakePageObjectsNamesUnique(bool bDo)
Definition: svdmodel.hxx:602
bool m_bReadOnly
static XDashListRef AsDashList(rtl::Reference< XPropertyList > const &plist)
Definition: xtable.hxx:370
XBitmapListRef GetBitmapList() const
Definition: svdmodel.hxx:528
virtual SVX_DLLPRIVATE bool IsCreatingDataObj() const
Definition: svdmodel.hxx:264
OutputDevice * get() const
std::deque< std::unique_ptr< SfxUndoAction > > m_aRedoStack
Definition: svdmodel.hxx:193
MapUnit
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:311
const SdrPage * GetPage() const
Definition: svdmodel.hxx:125
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:365
const SdrPage * mpPage
Definition: svdmodel.hxx:117
bool IsInDestruction() const
Definition: svdmodel.hxx:586
XColorListRef GetColorList() const
Definition: svdmodel.hxx:527
void SetDisableTextEditUsesCommonUndoManager(bool bNew)
Definition: svdmodel.hxx:542
void SetPersist(::comphelper::IEmbeddedHelper *p)
Definition: svdmodel.hxx:349
static XHatchListRef AsHatchList(rtl::Reference< XPropertyList > const &plist)
Definition: xtable.hxx:373
const SdrLayerAdmin & GetLayerAdmin() const
Definition: svdmodel.hxx:308
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
void SetPropertyList(XPropertyListRef const &p)
Definition: svdmodel.hxx:522
bool operator==(const ScCsvLayoutData &rData1, const ScCsvLayoutData &rData2)
SfxItemPool & GetItemPool()
Definition: svdmodel.hxx:312
bool IsTransportContainer() const
Definition: svdmodel.hxx:265
o3tl::enumarray< XPropertyListType, XPropertyListRef > maProperties
Definition: svdmodel.hxx:229
sal_uInt16 GetDefaultTabulator() const
Definition: svdmodel.hxx:334
sal_Int32 mnDefTextHgt
Definition: svdmodel.hxx:186
bool IsPagNumsDirty() const
Definition: svdmodel.hxx:390
const SdrObject * GetObject() const
Definition: svdmodel.hxx:126
OUString m_aUIUnitStr
Definition: svdmodel.hxx:176