1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SVDMODEL_HXX
21 #define INCLUDED_SVX_SVDMODEL_HXX
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include <cppuhelper/weakref.hxx>
25 #include <editeng/forbiddencharacterstable.hxx>
26 #include <editeng/outliner.hxx>
27 #include <rtl/ustring.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 <tools/fract.hxx>
34 #include <svl/hint.hxx>
35 #include <o3tl/typed_flags_set.hxx>
36 #include <o3tl/enumarray.hxx>
38 #include <svl/style.hxx>
39 #include <svx/xtable.hxx>
40 #include <svx/pageitem.hxx>
41 #include <vcl/field.hxx>
42 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
45 #include <svx/svdtypes.hxx>
46 #include <svx/svxdllapi.h>
48 #include <rtl/ref.hxx>
51 #define DEGREE_CHAR ((sal_Unicode)0x00B0) /* U+00B0 DEGREE SIGN */
65 class SfxRepeatTarget
;
75 class SvxForbiddenCharactersTable
;
76 class SvNumberFormatter
;
77 class SdrOutlinerCache
;
83 class IEmbeddedHelper
;
92 enum class SdrSwapGraphicsMode
96 DEFAULT
= TEMP
| PURGE
,
100 template<> struct typed_flags
<SdrSwapGraphicsMode
> : is_typed_flags
<SdrSwapGraphicsMode
, 0x0101> {};
104 enum class SdrHintKind
107 LayerChange
, // changed layer definition
108 LayerOrderChange
, // order of layer changed (Insert/Remove/ChangePos)
109 PageOrderChange
, // order of pages (object pages or master pages) changed (Insert/Remove/ChangePos)
110 ObjectChange
, // object changed
111 ObjectInserted
, // new object inserted
112 ObjectRemoved
, // symbol object removed from list
113 ModelCleared
, // deleted the whole model (no pages exist anymore). not impl.
114 RefDeviceChange
, // RefDevice changed
115 DefaultTabChange
, // Default tabulator width changed
116 DefaultFontHeightChange
, // Default FontHeight changed
117 ModelSaved
, // Document was saved
118 SwitchToPage
, // #94278# UNDO/REDO at an object evtl. on another page
119 BeginEdit
, // Is called after the object has entered text edit mode
120 EndEdit
// Is called after the object has left text edit mode
123 class SVX_DLLPUBLIC SdrHint
: public SfxHint
127 const SdrObject
* mpObj
;
128 const SdrPage
* mpPage
;
131 explicit SdrHint(SdrHintKind eNewHint
);
132 explicit SdrHint(SdrHintKind eNewHint
, const SdrObject
& rNewObj
);
133 explicit SdrHint(SdrHintKind eNewHint
, const SdrPage
* pPage
);
134 explicit SdrHint(SdrHintKind eNewHint
, const SdrObject
& rNewObj
, const SdrPage
* pPage
);
136 const SdrPage
* GetPage() const { return mpPage
;}
137 const SdrObject
* GetObject() const { return mpObj
;}
138 SdrHintKind
GetKind() const { return meHint
;}
144 class SVX_DLLPUBLIC SdrModel
: public SfxBroadcaster
, public tools::WeakBase
< SdrModel
>
147 std::vector
<SdrPage
*> maMaPag
; // master pages
148 std::vector
<SdrPage
*> maPages
;
149 Link
<SdrUndoAction
*,void> aUndoLink
; // link to a NotifyUndo-Handler
151 Size aMaxObjSize
; // e.g. for auto-growing text
152 Fraction aObjUnit
; // description of the coordinate units for ClipBoard, Drag&Drop, ...
153 MapUnit eObjUnit
; // see above
154 FieldUnit eUIUnit
; // unit, scale (e.g. 1/1000) for the UI (status bar) is set by ImpSetUIUnit()
155 Fraction aUIScale
; // see above
156 OUString aUIUnitStr
; // see above
157 Fraction aUIUnitFact
; // see above
158 int nUIUnitKomma
; // see above
160 SdrLayerAdmin
* pLayerAdmin
;
161 SfxItemPool
* pItemPool
;
162 comphelper::IEmbeddedHelper
*
163 m_pEmbeddedHelper
; // helper for embedded objects to get rid of the SfxObjectShell
164 SdrOutliner
* pDrawOutliner
; // an Outliner for outputting text
165 SdrOutliner
* pHitTestOutliner
;// an Outliner for the HitTest
166 SdrOutliner
* pChainingOutliner
; // an Outliner for chaining overflowing text
167 sal_uIntPtr nDefTextHgt
; // Default text height in logical units
168 VclPtr
<OutputDevice
> pRefOutDev
; // ReferenceDevice for the EditEngine
169 rtl::Reference
< SfxStyleSheetBasePool
> mxStyleSheetPool
;
170 SfxStyleSheet
* pDefaultStyleSheet
;
171 SfxStyleSheet
* mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj
; // #i119287#
172 sfx2::LinkManager
* pLinkManager
; // LinkManager
173 std::deque
<SfxUndoAction
*>* pUndoStack
;
174 std::deque
<SfxUndoAction
*>* pRedoStack
;
175 SdrUndoGroup
* pAktUndoGroup
; // for deeper
176 sal_uInt16 nUndoLevel
; // undo nesting
177 bool bMyPool
:1; // to clean up pMyPool from 303a
178 bool bUIOnlyKomma
:1; // see eUIUnit
179 bool mbUndoEnabled
:1; // If false no undo is recorded or we are during the execution of an undo action
180 bool bExtColorTable
:1; // ne separate ColorTable
182 bool bPagNumsDirty
:1;
183 bool bMPgNumsDirty
:1;
184 bool bTransportContainer
:1; // doc is temporary object container, no display (e.g. clipboard)
186 bool bTransparentTextFrames
:1;
187 bool bSwapGraphics
:1;
188 bool bPasteResize
:1; // Objects are being resized due to Paste with different MapMode
189 bool bStarDrawPreviewMode
:1;
190 bool mbDisableTextEditUsesCommonUndoManager
:1;
191 SvStreamEndian nStreamNumberFormat
;
192 sal_uInt16 nDefaultTabulator
;
193 sal_uInt32 nMaxUndoCount
;
195 TextChain
* pTextChain
;
199 sal_uInt16 nStarDrawPreviewMasterPageNum
;
200 rtl::Reference
<SvxForbiddenCharactersTable
> mpForbiddenCharactersTable
;
201 SdrSwapGraphicsMode nSwapGraphicsMode
;
203 SdrOutlinerCache
* mpOutlinerCache
;
204 //get a vector of all the SdrOutliner belonging to the model
205 std::vector
<SdrOutliner
*> GetActiveOutliners() const;
206 std::unique_ptr
<SdrModelImpl
> mpImpl
;
207 sal_uInt16 mnCharCompressType
;
208 sal_uInt16 mnHandoutPageCount
;
210 bool mbKernAsianPunctuation
;
211 bool mbAddExtLeading
;
212 bool mbInDestruction
;
214 // Color, Dash, Line-End, Hatch, Gradient, Bitmap property lists ...
215 o3tl::enumarray
<XPropertyListType
, XPropertyListRef
> maProperties
;
217 // New src638: NumberFormatter for drawing layer and
218 // method for getting it. It is constructed on demand
219 // and destroyed when destroying the SdrModel.
220 SvNumberFormatter
* mpNumberFormatter
;
222 sal_uInt16
getHandoutPageCount() const { return mnHandoutPageCount
; }
223 void setHandoutPageCount( sal_uInt16 nHandoutPageCount
) { mnHandoutPageCount
= nHandoutPageCount
; }
227 virtual css::uno::Reference
< css::uno::XInterface
> createUnoModel();
230 SdrModel(const SdrModel
& rSrcModel
) = delete;
231 void operator=(const SdrModel
& rSrcModel
) = delete;
232 bool operator==(const SdrModel
& rCmpModel
) const = delete;
233 SVX_DLLPRIVATE
void ImpPostUndoAction(SdrUndoAction
* pUndo
);
234 SVX_DLLPRIVATE
void ImpSetUIUnit();
235 SVX_DLLPRIVATE
void ImpSetOutlinerDefaults( SdrOutliner
* pOutliner
, bool bInit
= false );
236 SVX_DLLPRIVATE
void ImpReformatAllTextObjects();
237 SVX_DLLPRIVATE
void ImpReformatAllEdgeObjects();
238 SVX_DLLPRIVATE
void ImpCreateTables();
239 SVX_DLLPRIVATE
void ImpCtor(SfxItemPool
* pPool
, ::comphelper::IEmbeddedHelper
* pPers
, bool bUseExtColorTable
);
242 // this is a weak reference to a possible living api wrapper for this model
243 css::uno::Reference
< css::uno::XInterface
> mxUnoModel
;
246 SVX_DLLPRIVATE
virtual bool IsCreatingDataObj() const { return false; }
247 bool IsTransportContainer() const { return bTransportContainer
; }
248 bool IsPasteResize() const { return bPasteResize
; }
249 void SetPasteResize(bool bOn
) { bPasteResize
=bOn
; }
250 // If a custom Pool is put here, the class will call methods
251 // on it (Put(), Remove()). On disposal of SdrModel the pool
252 // will be deleted with delete.
253 // If you give NULL instead, it will create an own pool (SdrItemPool)
254 // which will also be disposed in the destructor.
255 // If you do use a custom Pool, make sure you inherit from SdrItemPool,
256 // if you want to use symbol objects inherited from SdrAttrObj.
257 // If, however, you use objects inheriting from SdrObject you are free
258 // to chose a pool of your liking.
260 explicit SdrModel(SfxItemPool
* pPool
, ::comphelper::IEmbeddedHelper
* pPers
);
261 explicit SdrModel(const OUString
& rPath
, SfxItemPool
* pPool
, ::comphelper::IEmbeddedHelper
* pPers
, bool bUseExtColorTable
);
262 virtual ~SdrModel() override
;
263 void ClearModel(bool bCalledFromDestructor
);
265 // Override this to enable the Swap/LoadOnDemand of graphics.
266 // If rbDeleteAfterUse is set to sal_True the SvStream instance from
267 // the caller will be disposed after use.
268 // If this method returns NULL, a temporary file will be allocated for
270 // The stream from which the model was loaded or in which is was saved last
271 // needs to be delivered
272 virtual css::uno::Reference
<
273 css::embed::XStorage
> GetDocumentStorage() const;
275 css::io::XInputStream
>
276 GetDocumentStream(OUString
const& rURL
,
277 ::comphelper::LifecycleProxy
& rProxy
) const;
278 // Change the template attributes of the symbol objects to hard attributes
279 void BurnInStyleSheetAttributes();
280 // If you inherit from SdrPage you also need to inherit from SdrModel
281 // and implement both VM AllocPage() and AllocModel()...
282 virtual SdrPage
* AllocPage(bool bMasterPage
);
283 virtual SdrModel
* AllocModel() const;
285 // Changes on the layers set the modified flag and broadcast on the model!
286 const SdrLayerAdmin
& GetLayerAdmin() const { return *pLayerAdmin
; }
287 SdrLayerAdmin
& GetLayerAdmin() { return *pLayerAdmin
; }
289 const SfxItemPool
& GetItemPool() const { return *pItemPool
; }
290 SfxItemPool
& GetItemPool() { return *pItemPool
; }
292 SdrOutliner
& GetDrawOutliner(const SdrTextObj
* pObj
=nullptr) const;
294 SdrOutliner
& GetHitTestOutliner() const { return *pHitTestOutliner
; }
295 const SdrTextObj
* GetFormattingTextObj() const;
296 // put the TextDefaults (Font,Height,Color) in a Set
297 void SetTextDefaults() const;
298 static void SetTextDefaults( SfxItemPool
* pItemPool
, sal_uIntPtr nDefTextHgt
);
300 SdrOutliner
& GetChainingOutliner(const SdrTextObj
* pObj
) const;
301 TextChain
* GetTextChain() const;
303 // ReferenceDevice for the EditEngine
304 void SetRefDevice(OutputDevice
* pDev
);
305 OutputDevice
* GetRefDevice() const { return pRefOutDev
.get(); }
306 // If a new MapMode is set on the RefDevice (or similar)
307 void RefDeviceChanged(); // not yet implemented
308 // default font height in logical units
309 void SetDefaultFontHeight(sal_uIntPtr nVal
);
310 sal_uIntPtr
GetDefaultFontHeight() const { return nDefTextHgt
; }
311 // default tabulator width for the EditEngine
312 void SetDefaultTabulator(sal_uInt16 nVal
);
313 sal_uInt16
GetDefaultTabulator() const { return nDefaultTabulator
; }
315 // The DefaultStyleSheet will be used in every symbol object which is inserted
316 // in this model and does not have a StyleSheet set.
317 SfxStyleSheet
* GetDefaultStyleSheet() const { return pDefaultStyleSheet
; }
318 void SetDefaultStyleSheet(SfxStyleSheet
* pDefSS
) { pDefaultStyleSheet
= pDefSS
; }
320 // #i119287# default StyleSheet for SdrGrafObj and SdrOle2Obj
321 SfxStyleSheet
* GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj() const { return mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj
; }
322 void SetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(SfxStyleSheet
* pDefSS
) { mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj
= pDefSS
; }
324 sfx2::LinkManager
* GetLinkManager() { return pLinkManager
; }
325 void SetLinkManager( sfx2::LinkManager
* pLinkMgr
) { pLinkManager
= pLinkMgr
; }
327 ::comphelper::IEmbeddedHelper
* GetPersist() const { return m_pEmbeddedHelper
; }
328 void SetPersist( ::comphelper::IEmbeddedHelper
*p
) { m_pEmbeddedHelper
= p
; }
330 // Unit for the symbol coordination
331 // Default is 1 logical unit = 1/100mm (Unit=MapUnit::Map100thMM, Fract=(1,1)).
333 // MapUnit::MapPoint, Fraction(72,1) : 1 log Einh = 72 Point = 1 Inch
334 // MapUnit::MapPoint, Fraction(1,20) : 1 log Einh = 1/20 Point = 1 Twip
335 // MapUnit::MapTwip, Fraction(1,1) : 1 log Einh = 1 Twip
336 // MapUnit::Map100thMM, Fraction(1,10) : 1 log Einh = 1/1000mm
337 // MapUnit::MapMM, Fraction(1000,1) : 1 log Einh = 1000mm = 1m
338 // MapUnit::MapCM, Fraction(100,1) : 1 log Einh = 100cm = 1m
339 // MapUnit::MapCM, Fraction(100000,1): 1 log Einh = 100000cm = 1km
340 // (FWIW: you cannot represent light years).
341 // The scaling unit is needed for the Engine to serve the Clipboard
342 // with the correct sizes.
343 MapUnit
GetScaleUnit() const { return eObjUnit
; }
344 void SetScaleUnit(MapUnit eMap
);
345 const Fraction
& GetScaleFraction() const { return aObjUnit
; }
346 void SetScaleFraction(const Fraction
& rFrac
);
347 // Setting both simultaneously performs a little better
348 void SetScaleUnit(MapUnit eMap
, const Fraction
& rFrac
);
350 // maximal size e.g. for auto growing texts
351 const Size
& GetMaxObjSize() const { return aMaxObjSize
; }
352 void SetMaxObjSize(const Size
& rSiz
) { aMaxObjSize
=rSiz
; }
354 // For the View! to display sane numbers in the status bar: Default is mm.
355 void SetUIUnit(FieldUnit eUnit
);
356 FieldUnit
GetUIUnit() const { return eUIUnit
; }
357 // The scale of the drawing. Default 1/1.
358 void SetUIScale(const Fraction
& rScale
);
359 const Fraction
& GetUIScale() const { return aUIScale
; }
360 // Setting both simultaneously performs a little better
361 void SetUIUnit(FieldUnit eUnit
, const Fraction
& rScale
);
363 static void TakeUnitStr(FieldUnit eUnit
, OUString
& rStr
);
364 void TakeMetricStr(long nVal
, OUString
& rStr
, bool bNoUnitChars
= false, sal_Int32 nNumDigits
= -1) const;
365 static void TakeAngleStr(long nAngle
, OUString
& rStr
, bool bNoDegChar
= false);
366 static void TakePercentStr(const Fraction
& rVal
, OUString
& rStr
);
368 // RecalcPageNums is ordinarily only called by the Page.
369 bool IsPagNumsDirty() const { return bPagNumsDirty
; };
370 bool IsMPgNumsDirty() const { return bMPgNumsDirty
; };
371 void RecalcPageNums(bool bMaster
);
372 // After the Insert the Page belongs to the SdrModel.
373 virtual void InsertPage(SdrPage
* pPage
, sal_uInt16 nPos
=0xFFFF);
374 virtual void DeletePage(sal_uInt16 nPgNum
);
375 // Remove means transferring ownership to the caller (opposite of Insert)
376 virtual SdrPage
* RemovePage(sal_uInt16 nPgNum
);
377 virtual void MovePage(sal_uInt16 nPgNum
, sal_uInt16 nNewPos
);
378 const SdrPage
* GetPage(sal_uInt16 nPgNum
) const;
379 SdrPage
* GetPage(sal_uInt16 nPgNum
);
380 sal_uInt16
GetPageCount() const;
381 virtual void PageListChanged();
384 virtual void InsertMasterPage(SdrPage
* pPage
, sal_uInt16 nPos
=0xFFFF);
385 void DeleteMasterPage(sal_uInt16 nPgNum
);
386 // Remove means transferring ownership to the caller (opposite of Insert)
387 virtual SdrPage
* RemoveMasterPage(sal_uInt16 nPgNum
);
388 void MoveMasterPage(sal_uInt16 nPgNum
, sal_uInt16 nNewPos
);
389 const SdrPage
* GetMasterPage(sal_uInt16 nPgNum
) const;
390 SdrPage
* GetMasterPage(sal_uInt16 nPgNum
);
391 sal_uInt16
GetMasterPageCount() const;
392 virtual void MasterPageListChanged();
394 // modified flag. Is set automatically when something changes on the Pages
395 // symbol objects. You need to reset it yourself, however, e.g. on Save().
396 bool IsChanged() const { return mbChanged
; }
397 virtual void SetChanged(bool bFlg
= true);
399 // If set to sal_True, graphics from graphics objects will:
400 // - not be loaded immediately when loading a document,
401 // but only once they are needed (e.g. displayed).
402 // - be pruned from memory if they are not needed.
403 // For that to work, override the virtual method GetDocumentStream().
404 // Default=FALSE. Flag is not persistent.
405 bool IsSwapGraphics() const { return bSwapGraphics
; }
406 void SetSwapGraphics();
407 void SetSwapGraphicsMode(SdrSwapGraphicsMode nMode
) { nSwapGraphicsMode
= nMode
; }
408 SdrSwapGraphicsMode
GetSwapGraphicsMode() const { return nSwapGraphicsMode
; }
410 // Text frames without filling can be select with a mouse click by default (sal_False).
411 // With this flag set to true you can hit them only in the area in which text is to be
413 bool IsPickThroughTransparentTextFrames() const { return bTransparentTextFrames
; }
414 void SetPickThroughTransparentTextFrames(bool bOn
) { bTransparentTextFrames
=bOn
; }
416 // Can the model be changed at all?
417 // Is only evaluated by the possibility methods of the View.
418 // Direct manipulations on the model, ... do not respect this flag.
419 // Override this and return the appropriate ReadOnly status
420 // of the files, i.e. true or false. (Method is called multiple
421 // times, so use one flag only!)
422 virtual bool IsReadOnly() const;
423 void SetReadOnly(bool bYes
);
425 // Mixing two SdrModels. Mind that rSourceModel is not const.
426 // The pages will not be copied but moved, when inserted.
427 // rSourceModel may very well be empty afterwards.
428 // nFirstPageNum,nLastPageNum: The pages to take from rSourceModel
429 // nDestPos..................: position to insert
430 // bMergeMasterPages.........: sal_True = needed MasterPages will be taken
432 // sal_False= the MasterPageDescriptors of
433 // the pages of the rSourceModel will be
434 // mapped on the exisiting MasterPages.
435 // bUndo.....................: An undo action is generated for the merging.
436 // Undo is only for the target model, not for the
438 // bTreadSourceAsConst.......: sal_True=the SourceModel will not be changed,
439 // so pages will be copied.
440 virtual void Merge(SdrModel
& rSourceModel
,
441 sal_uInt16 nFirstPageNum
, sal_uInt16 nLastPageNum
,
443 bool bMergeMasterPages
= false, bool bAllMasterPages
= false,
444 bool bUndo
= true, bool bTreadSourceAsConst
= false);
446 // Behaves like Merge(SourceModel=DestModel,nFirst,nLast,nDest,sal_False,sal_False,bUndo,!bMoveNoCopy);
447 void CopyPages(sal_uInt16 nFirstPageNum
, sal_uInt16 nLastPageNum
,
449 bool bUndo
, bool bMoveNoCopy
);
451 // BegUndo() / EndUndo() enables you to group arbitrarily many UndoActions
452 // arbitrarily deeply. As comment for the UndoAction the first BegUndo(String) of all
453 // nestings will be used.
454 // In that case the NotifyUndoActionHdl will be called on the last EndUndo().
455 // No UndoAction will be generated for an empty group.
456 // All direct modifications on the SdrModel do not create an UndoActions.
457 // Actions on the SdrView however do generate those.
458 void BegUndo(); // open Undo group
459 void BegUndo(const OUString
& rComment
); // open Undo group
460 void BegUndo(const OUString
& rComment
, const OUString
& rObjDescr
, SdrRepeatFunc eFunc
); // open Undo group
461 void EndUndo(); // close Undo group
462 void AddUndo(SdrUndoAction
* pUndo
);
463 sal_uInt16
GetUndoBracketLevel() const { return nUndoLevel
; }
464 // only after the first BegUndo or before the last EndUndo:
465 void SetUndoComment(const OUString
& rComment
);
466 void SetUndoComment(const OUString
& rComment
, const OUString
& rObjDescr
);
468 // The Undo management is only done if not NotifyUndoAction-Handler is set.
469 // Default is 16. Minimal MaxUndoActionCount is 1!
470 void SetMaxUndoActionCount(sal_uIntPtr nCount
);
471 void ClearUndoBuffer();
473 bool HasUndoActions() const;
474 bool HasRedoActions() const;
477 void Repeat(SfxRepeatTarget
&);
479 // The application can set a handler here which collects the UndoActions einsammelt.
480 // The handler has the following signature:
481 // void NotifyUndoActionHdl(SfxUndoAction* pUndoAction);
482 // When calling the handler ownership is transferred;
483 // The UndoAction belongs to the Handler, not the SdrModel.
484 void SetNotifyUndoActionHdl(const Link
<SdrUndoAction
*,void>& rLink
) { aUndoLink
=rLink
; }
486 /** application can set its own undo manager, BegUndo, EndUndo and AddUndoAction
487 calls are routed to this interface if given */
488 void SetSdrUndoManager( SfxUndoManager
* pUndoManager
);
489 SfxUndoManager
* GetSdrUndoManager() const;
491 /** applications can set their own undo factory to override creation of
492 undo actions. The SdrModel will become owner of the given SdrUndoFactory
493 and delete it upon its destruction. */
494 void SetSdrUndoFactory( SdrUndoFactory
* pUndoFactory
);
496 /** returns the models undo factory. This must be used to create
497 undo actions for this model. */
498 SdrUndoFactory
& GetSdrUndoFactory() const;
500 // Accessor methods for Palettes, Lists and Tables
501 // FIXME: this badly needs re-factoring...
502 const XPropertyListRef
& GetPropertyList( XPropertyListType t
) const { return maProperties
[ t
]; }
503 void SetPropertyList( XPropertyListRef
const & p
) { maProperties
[ p
->Type() ] = p
; }
505 // friendlier helpers
506 XDashListRef
GetDashList() const { return XPropertyList::AsDashList(GetPropertyList( XPropertyListType::Dash
)); }
507 XHatchListRef
GetHatchList() const { return XPropertyList::AsHatchList(GetPropertyList( XPropertyListType::Hatch
)); }
508 XColorListRef
GetColorList() const { return XPropertyList::AsColorList(GetPropertyList( XPropertyListType::Color
)); }
509 XBitmapListRef
GetBitmapList() const { return XPropertyList::AsBitmapList(GetPropertyList( XPropertyListType::Bitmap
)); }
510 XPatternListRef
GetPatternList() const { return XPropertyList::AsPatternList(GetPropertyList( XPropertyListType::Pattern
)); }
511 XLineEndListRef
GetLineEndList() const { return XPropertyList::AsLineEndList(GetPropertyList( XPropertyListType::LineEnd
)); }
512 XGradientListRef
GetGradientList() const { return XPropertyList::AsGradientList(GetPropertyList( XPropertyListType::Gradient
)); }
514 // The DrawingEngine only references the StyleSheetPool, whoever
515 // made it needs to delete it.
516 SfxStyleSheetBasePool
* GetStyleSheetPool() const { return mxStyleSheetPool
.get(); }
517 void SetStyleSheetPool(SfxStyleSheetBasePool
* pPool
) { mxStyleSheetPool
=pPool
; }
519 void SetStarDrawPreviewMode(bool bPreview
);
520 bool IsStarDrawPreviewMode() { return bStarDrawPreviewMode
; }
522 bool GetDisableTextEditUsesCommonUndoManager() const { return mbDisableTextEditUsesCommonUndoManager
; }
523 void SetDisableTextEditUsesCommonUndoManager(bool bNew
) { mbDisableTextEditUsesCommonUndoManager
= bNew
; }
525 css::uno::Reference
< css::uno::XInterface
> const & getUnoModel();
526 void setUnoModel( const css::uno::Reference
< css::uno::XInterface
>& xModel
);
528 // these functions are used by the api to disable repaints during a
530 bool isLocked() const { return mbModelLocked
; }
531 void setLock( bool bLock
);
533 void SetForbiddenCharsTable( const rtl::Reference
<SvxForbiddenCharactersTable
>& xForbiddenChars
);
534 const rtl::Reference
<SvxForbiddenCharactersTable
>& GetForbiddenCharsTable() const { return mpForbiddenCharactersTable
;}
536 void SetCharCompressType( sal_uInt16 nType
);
537 sal_uInt16
GetCharCompressType() const { return mnCharCompressType
; }
539 void SetKernAsianPunctuation( bool bEnabled
);
540 bool IsKernAsianPunctuation() const { return mbKernAsianPunctuation
; }
542 void SetAddExtLeading( bool bEnabled
);
543 bool IsAddExtLeading() const { return mbAddExtLeading
; }
545 // tdf#99729 compatibility flag
546 void SetAnchoredTextOverflowLegacy(bool bEnabled
);
547 bool IsAnchoredTextOverflowLegacy() const;
549 // tdf#115639 compatibility flag
550 void SetHoriAlignIgnoreTrailingWhitespace(bool bEnabled
);
551 bool IsHoriAlignIgnoreTrailingWhitespace() const;
553 void ReformatAllTextObjects();
555 SdrOutliner
* createOutliner( OutlinerMode nOutlinerMode
);
556 void disposeOutliner( SdrOutliner
* pOutliner
);
558 bool IsWriter() const { return !bMyPool
; }
560 // Used as a fallback in *::ReadUserDataSequence() to process common properties
561 void ReadUserDataSequenceValue(const css::beans::PropertyValue
*pValue
);
562 void WriteUserDataSequence(css::uno::Sequence
< css::beans::PropertyValue
>& rValues
, bool bBrowse
= false);
564 /** returns the numbering type that is used to format page fields in drawing shapes */
565 virtual SvxNumType
GetPageNumType() const;
567 /** copies the items from the source set to the destination set. Both sets must have
568 same ranges but can have different pools. */
569 static void MigrateItemSet( const SfxItemSet
* pSourceSet
, SfxItemSet
* pDestSet
, SdrModel
* pNewModel
);
571 bool IsInDestruction() const { return mbInDestruction
;}
573 static const css::uno::Sequence
< sal_Int8
>& getUnoTunnelImplementationId();
575 virtual ImageMap
* GetImageMapForObject(SdrObject
*){return nullptr;};
577 /** enables (true) or disables (false) recording of undo actions
578 If undo actions are added while undo is disabled, they are deleted.
579 Disabling undo does not clear the current undo buffer! */
580 void EnableUndo( bool bEnable
);
582 /** returns true if undo is currently enabled
583 This returns false if undo was disabled using EnableUndo( false ) and
584 also during the runtime of the Undo() and Redo() methods. */
585 bool IsUndoEnabled() const;
587 virtual void dumpAsXml(struct _xmlTextWriter
* pWriter
) const;
591 #endif // INCLUDED_SVX_SVDMODEL_HXX
600 +----+---+ +----+---+ +-----+--------+
601 |SdrPage | |SdrPage | |SdrLayerAdmin |
602 +---+----+ +-+--+--++ +---+-------+--+
603 | | | | | +-------------------+
604 +----+----+ +-----+-----+ +-------+-------+
605 | ... | | ... | | ... |
606 +---+---+ +---+---+ +----+----+ +----+----+ +-----+------+ +------+-----+
607 |SdrObj | |SdrObj | |SdrLayer | |SdrLayer | |SdrLayerSet | |SdrLayerSet |
608 +-------+ +-------+ +---------+ +---------+ +------------+ +------------+
609 This class: SdrModel is the head of the data models for the StarView Drawing Engine.
611 ///////////////////////////////////////////////////////////////////////////////////////////////// */
613 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */