Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / include / svx / svdobj.hxx
blobccdf58abb68350b6fb9f20c70143a4338d48636f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_SVDOBJ_HXX
21 #define INCLUDED_SVX_SVDOBJ_HXX
23 #include <memory>
24 #include <typeinfo>
25 #include <com/sun/star/uno/Any.hxx>
26 #include <cppuhelper/weakref.hxx>
27 #include <rtl/ustring.hxx>
28 #include <svl/lstner.hxx>
29 #include <svl/poolitem.hxx>
30 #include <svx/svdsob.hxx>
31 #include <svx/svdtypes.hxx>
32 #include <svx/svdglue.hxx>
33 #include <svx/xdash.hxx>
34 #include <svx/xpoly.hxx>
35 #include <svx/xenum.hxx>
36 #include <svx/sdrobjectuser.hxx>
37 #include <svx/svxdllapi.h>
38 #include <svx/shapeproperty.hxx>
39 #include <tools/weakbase.hxx>
40 #include <vcl/bitmapex.hxx>
41 #include <vcl/mapmod.hxx>
42 #include <vcl/timer.hxx>
44 #include <boost/optional.hpp>
45 #include <boost/ptr_container/ptr_vector.hpp>
47 // forward declarations
49 class SfxBroadcaster;
50 class Pointer;
51 class AutoTimer;
52 class OutlinerParaObject;
53 class SdrOutliner;
54 class SdrDragStat;
55 class SdrHdl;
56 class SdrHdlList;
57 class SdrItemPool;
58 class SdrModel;
59 class SdrObjList;
60 class SdrObject;
61 class SdrPage;
62 class SdrPageView;
63 class SdrView;
64 class SfxItemSet;
65 class SfxGrabBagItem;
66 class SfxSetItem;
67 class SfxStyleSheet;
68 class SfxUndoAction;
69 class XFillAttrSetItem;
70 class XLineAttrSetItem;
71 class SfxItemPool;
72 class PolyPolygon;
73 class SfxPoolItem;
74 class SdrVirtObj;
75 class SdrDragView;
77 namespace sdr
79 namespace properties
81 class BaseProperties;
82 } // end of namespace properties
83 } // end of namespace sdr
85 // #110094#
86 namespace sdr
88 namespace contact
90 class ViewContact;
91 } // end of namespace contact
92 } // end of namespace sdr
94 namespace svx
96 class PropertyChangeNotifier;
99 // Defines
101 enum SdrObjKind {OBJ_NONE = 0, // abstract object (SdrObject)
102 OBJ_GRUP = 1, // object group
103 OBJ_LINE = 2, // line
104 OBJ_RECT = 3, // rectangle (round corners optional)
105 OBJ_CIRC = 4, // circle, ellipse
106 OBJ_SECT = 5, // circle section
107 OBJ_CARC = 6, // circle arc
108 OBJ_CCUT = 7, // circle cut
109 OBJ_POLY = 8, // polygon, PolyPolygon
110 OBJ_PLIN = 9, // PolyLine
111 OBJ_PATHLINE =10, // open Bezier-curve
112 OBJ_PATHFILL =11, // closed Bezier-curve
113 OBJ_FREELINE =12, // open free-hand line
114 OBJ_FREEFILL =13, // closed free-hand line
115 OBJ_SPLNLINE =14, // Natuerlicher kubischer Spline (ni)
116 OBJ_SPLNFILL =15, // Periodischer kubischer Spline (ni)
117 OBJ_TEXT =16, // text object
118 OBJ_TEXTEXT =17, // Texterweiterungsrahmen (ni)
119 OBJ_wegFITTEXT, // FitToSize-Text (alle Zeilen gleich)
120 OBJ_wegFITALLTEXT, // FitToSize-Text (Zeilenweise) (ni)
121 OBJ_TITLETEXT =20, // Titeltext. Spezial-Textobjekt fuer StarDraw
122 OBJ_OUTLINETEXT=21, // OutlineText. Spezial-Textobjekt fuer StarDraw
123 OBJ_GRAF =22, // Fremdgrafik - (StarView Graphic)
124 OBJ_OLE2 =23, // OLE object
125 OBJ_EDGE =24, // Verbindungsobjekt fuer Konnektoren
126 OBJ_CAPTION =25, // Legendenobjekt
127 OBJ_PATHPOLY =26, // Polygon/PolyPolygon dargestellt durch SdrPathObj
128 OBJ_PATHPLIN =27, // Polyline dargestellt durch SdrPathObj
129 OBJ_PAGE =28, // object that represents a SdrPage
130 OBJ_MEASURE =29, // measurement object
131 OBJ_DUMMY =30, // dummy object for saving holes (to recover surrogates later)
132 OBJ_FRAME =31, // continiously activated aktives OLE (PlugIn-Frame or similar)
133 OBJ_UNO =32, // Universal Network Object packed into SvDraw object
134 OBJ_CUSTOMSHAPE=33, // custom shape
135 OBJ_MEDIA =34, // media shape
136 OBJ_TABLE =35, // table
137 OBJ_OPENGL =36, // opengl graphic
138 OBJ_MAXI};
140 enum SdrUserCallType {SDRUSERCALL_MOVEONLY, // only moved, size unchanged
141 SDRUSERCALL_RESIZE, // size and maybe position changed
142 SDRUSERCALL_CHGATTR, // attribute changed. Eventually new size, because of line width
143 SDRUSERCALL_DELETE, // object is going to be deleted soon, no attributes anymore
144 SDRUSERCALL_COPY, // assign operator called, everything can be changed
145 SDRUSERCALL_INSERTED, // inserted into an object list (e.g. Page)
146 SDRUSERCALL_REMOVED, // removed from an object list
147 SDRUSERCALL_CHILD_MOVEONLY, // a child within a group has changed
148 SDRUSERCALL_CHILD_RESIZE, // a child within a group has changed
149 SDRUSERCALL_CHILD_CHGATTR, // a child within a group has changed
150 SDRUSERCALL_CHILD_DELETE, // a child within a group has changed
151 SDRUSERCALL_CHILD_COPY, // a child within a group has changed
152 SDRUSERCALL_CHILD_INSERTED, // a child within a group has changed
153 SDRUSERCALL_CHILD_REMOVED}; // a child within a group has changed
155 class SVX_DLLPUBLIC SdrObjUserCall
157 public:
158 TYPEINFO();
159 virtual ~SdrObjUserCall();
160 virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle& rOldBoundRect);
163 class SVX_DLLPUBLIC SdrObjMacroHitRec
165 public:
166 Point aPos;
167 Point aDownPos;
168 OutputDevice* pOut;
169 const SetOfByte* pVisiLayer;
170 const SdrPageView* pPageView;
171 sal_uInt16 nTol;
172 bool bDown;
174 SdrObjMacroHitRec();
177 // User data of a drawing object, e.g. application specific data.
178 // Every drawing object can have arbitrarily many such records (SV list).
179 // Whoever wants to save data here, must inherit from this and set a corresponding link in the factory.
180 class SVX_DLLPUBLIC SdrObjUserData
182 protected:
183 sal_uInt32 nInventor;
184 sal_uInt16 nIdentifier;
185 sal_uInt16 nVersion;
187 private:
188 SVX_DLLPRIVATE void operator=(const SdrObjUserData& rData); // not implemented
189 SVX_DLLPRIVATE bool operator==(const SdrObjUserData& rData) const; // not implemented
190 SVX_DLLPRIVATE bool operator!=(const SdrObjUserData& rData) const; // not implemented
192 public:
193 TYPEINFO();
195 SdrObjUserData(sal_uInt32 nInv, sal_uInt16 nId, sal_uInt16 nVer);
196 SdrObjUserData(const SdrObjUserData& rData);
197 virtual ~SdrObjUserData();
199 virtual SdrObjUserData* Clone(SdrObject* pObj1) const = 0; // #i71039# NULL -> 0
200 sal_uInt32 GetInventor() const;
201 sal_uInt16 GetId() const;
203 virtual bool HasMacro (const SdrObject* pObj) const;
204 virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
205 virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
206 virtual void PaintMacro (OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
207 virtual bool DoMacro (const SdrObjMacroHitRec& rRec, SdrObject* pObj);
208 virtual OUString GetMacroPopupComment(const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
211 class SdrObjUserDataList
213 typedef boost::ptr_vector<SdrObjUserData> ListType;
214 ListType maList;
216 public:
217 SdrObjUserDataList();
218 ~SdrObjUserDataList();
220 size_t GetUserDataCount() const;
221 const SdrObjUserData* GetUserData(size_t nNum) const;
222 SdrObjUserData* GetUserData(size_t nNum);
223 void AppendUserData(SdrObjUserData* pData);
224 void DeleteUserData(size_t nNum);
227 // all geometrical data of an arbitrary object for use in undo/redo
228 class SVX_DLLPUBLIC SdrObjGeoData
230 public:
231 Rectangle aBoundRect;
232 Point aAnchor;
233 SdrGluePointList* pGPL;
234 bool bMovProt;
235 bool bSizProt;
236 bool bNoPrint;
237 bool bClosedObj;
238 bool mbVisible;
239 SdrLayerID mnLayerID;
241 public:
242 SdrObjGeoData();
243 virtual ~SdrObjGeoData();
246 // Bitsack for DrawObjects
247 class SdrObjPlusData
249 friend class SdrObject;
251 SfxBroadcaster* pBroadcast; // broadcaster, if this object is referenced (bVirtObj=true). Also for connectors etc.
252 SdrObjUserDataList* pUserDataList; // application specific data
253 SdrGluePointList* pGluePoints; // glue points for glueing object connectors
255 // #i68101#
256 // object name, title and description
257 OUString aObjName;
258 OUString aObjTitle;
259 OUString aObjDescription;
261 public:
262 TYPEINFO();
263 SdrObjPlusData();
264 virtual ~SdrObjPlusData();
265 virtual SdrObjPlusData* Clone(SdrObject* pObj1) const;
267 void SetGluePoints(const SdrGluePointList& rPts);
270 // provides information about various ZObject properties
271 class SVX_DLLPUBLIC SdrObjTransformInfoRec
273 public:
274 bool bSelectAllowed : 1; // if false, object cannot be selected
275 bool bMoveAllowed : 1; // if false, object cannot be moved
276 bool bResizeFreeAllowed : 1; // if false, object cannot be resized freely
277 bool bResizePropAllowed : 1; // if false, object cannot even be resized proportionally
278 bool bRotateFreeAllowed : 1; // if false, object cannot be rotated freely
279 bool bRotate90Allowed : 1; // if false, object cannot even be rotated in 90 degree steps
280 bool bMirrorFreeAllowed : 1; // if false, object cannot be mirrored freely
281 bool bMirror45Allowed : 1; // if false, object cannot even be mirrored over axes in a 45 degree raster
282 bool bMirror90Allowed : 1; // if false, object cannot even be mirrored over axes in a 90 degree raster
283 bool bTransparenceAllowed : 1; // if false, object does not have an interactive transparence control
284 bool bGradientAllowed : 1; // if false, object dooes not have an interactive gradient control
285 bool bShearAllowed : 1; // if false, object cannot be sheared
286 bool bEdgeRadiusAllowed : 1;
287 bool bNoOrthoDesired : 1; // is true for Rect; is false for BMP, MTF
288 bool bNoContortion : 1; // if false, Kein verzerren (bei Crook) moeglich (nur true bei PathObj und Gruppierten PathObjs)
289 bool bCanConvToPath : 1; // if false, no conversion into PathObj possible
290 bool bCanConvToPoly : 1; // if false, no conversion into PolyObj possible
291 bool bCanConvToContour : 1; // if false, no conversion down to whole contour possible
292 bool bCanConvToPathLineToArea : 1; // if false, no conversion into PathObj with transformation from LineToArea possible
293 bool bCanConvToPolyLineToArea : 1; // if false, no conversion into PolyObj with transformation from LineToArea possible
295 SdrObjTransformInfoRec();
298 // Abstract DrawObject
300 class SvxShape;
301 class SVX_DLLPUBLIC SdrObject: public SfxListener, public tools::WeakBase< SdrObject >
303 private:
304 // ObjectUser section
305 sdr::ObjectUserVector maObjectUsers;
307 public:
308 void AddObjectUser(sdr::ObjectUser& rNewUser);
309 void RemoveObjectUser(sdr::ObjectUser& rOldUser);
311 // BaseProperties section
312 private:
313 sdr::properties::BaseProperties* mpProperties;
314 protected:
315 virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
316 public:
317 virtual sdr::properties::BaseProperties& GetProperties() const;
319 // #110094# DrawContact section
320 private:
321 sdr::contact::ViewContact* mpViewContact;
322 protected:
323 virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
324 public:
325 sdr::contact::ViewContact& GetViewContact() const;
327 // DrawContact support: Methods for handling Object changes
328 void ActionChanged() const;
330 private:
331 friend class SdrObjListIter;
332 friend class SdrVirtObj;
333 friend class SdrRectObj;
335 protected:
336 Rectangle aOutRect; // surrounding rectangle for Paint (incl. LineWdt, ...)
337 Point aAnchor; // anchor position (Writer)
338 Point aGridOffset; // hack (Calc)
339 SdrObjList* pObjList; // list that includes this object
340 SdrPage* pPage;
341 SdrModel* pModel;
342 SdrObjUserCall* pUserCall;
343 SdrObjPlusData* pPlusData; // Broadcaster, UserData, connektors, ... (this is the Bitsack)
345 sal_uInt32 nOrdNum; // order number of the object in the list
347 SfxGrabBagItem* pGrabBagItem; // holds the GrabBagItem property
350 // Position in the navigation order. SAL_MAX_UINT32 when not used.
351 sal_uInt32 mnNavigationPosition;
352 SdrLayerID mnLayerID;
354 // object is only pointing to another one
355 bool bVirtObj : 1;
356 bool bSnapRectDirty : 1;
357 bool bNetLock : 1; // ni
358 bool bInserted : 1; // only if set to true, there are RepaintBroadcast & SetModify
359 bool bGrouped : 1; // member of a group object?
361 // the following flags will be streamed
362 bool bMovProt : 1; // if true, the position is protected
363 bool bSizProt : 1; // if true, the size is protected
364 bool bNoPrint : 1; // if true, the object is not printed.
365 bool mbVisible : 1; // if false, the object is not visible on screen (but maybe on printer, depending on bNoprint
366 // If bEmptyPresObj is true, it is a presentation object that has no content yet.
367 // The flag's default value is false.
368 // The management is done by the application.
369 // Neither assign operator nor cloning copies the flag!
370 // The flag is persistent.
371 bool bEmptyPresObj : 1; // empty presentation object (Draw)
373 // if true, object is invisible as object of the MasterPage
374 bool bNotVisibleAsMaster : 1;
376 // if true, the object is closed, i.e. no line, arc...
377 bool bClosedObj : 1;
379 bool bIsEdge : 1;
380 bool bIs3DObj : 1;
381 bool bMarkProt : 1; // marking forbidden, persistent
382 bool bIsUnoObj : 1;
383 bool bNotMasterCachable : 1;
385 // #i25616#
386 bool mbLineIsOutsideGeometry : 1;
388 // #i25616#
389 bool mbSupportTextIndentingOnLineWidthChange : 1;
391 // on import of OLE object from MS documents the BLIP size might be retrieved,
392 // in this case the following member is initialized as nonempty rectangle
393 Rectangle maBLIPSizeRectangle;
395 // global static ItemPool for not-yet-inserted items
396 private:
397 static SdrItemPool* mpGlobalItemPool;
398 boost::optional<double> mnRelativeWidth;
399 sal_Int16 meRelativeWidthRelation;
400 boost::optional<double> mnRelativeHeight;
401 sal_Int16 meRelativeHeightRelation;
402 public:
403 static SdrItemPool& GetGlobalDrawObjectItemPool();
404 void SetRelativeWidth( double nValue ) { mnRelativeWidth.reset( nValue ); }
405 void SetRelativeWidthRelation( sal_Int16 eValue ) { meRelativeWidthRelation = eValue; }
406 void SetRelativeHeight( double nValue ) { mnRelativeHeight.reset( nValue ); }
407 void SetRelativeHeightRelation( sal_Int16 eValue ) { meRelativeHeightRelation = eValue; }
408 boost::optional<double> GetRelativeWidth( ) const { return mnRelativeWidth; }
409 sal_Int16 GetRelativeWidthRelation() const { return meRelativeWidthRelation; }
410 boost::optional<double> GetRelativeHeight( ) const { return mnRelativeHeight; }
411 sal_Int16 GetRelativeHeightRelation() const { return meRelativeHeightRelation; }
412 // evil calc grid/shape drawlayer syncing
413 Point GetGridOffset() const { return aGridOffset; }
414 void SetGridOffset( const Point& rGridOffset ){ aGridOffset = rGridOffset; }
415 protected:
416 void ImpDeleteUserData();
417 SdrObjUserData* ImpGetMacroUserData() const;
418 Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
420 // for GetDragComment
421 void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, OUString& rStr, sal_uInt16 nVal=0) const;
423 void ImpForcePlusData();
425 OUString GetWinkStr(long nWink, bool bNoDegChar = false) const;
426 OUString GetMetrStr(long nVal, MapUnit eWantMap=MAP_MM, bool bNoUnitChars = false) const;
428 // bNotMyself=true means: set only ObjList to dirty, don't mark this object as dirty.
429 // This is needed for instance for NbcMove, because usually one moves SnapRect and aOutRect
430 // at the same time to avoid recomputation.
431 public:
432 virtual void SetRectsDirty(bool bNotMyself = false);
433 protected:
435 // override if the class inherits from SdrObjPlusData:
436 virtual SdrObjPlusData* NewPlusData() const;
438 protected:
439 // Diese 3 Methoden muss ein abgeleitetes Objekt ueberladen, wenn es eigene
440 // geometrische Daten besitzt, die fuer den Undo-Fall gesichert werden
441 // sollen. NewGeoData() erzeugt lediglich eine leere Instanz auf eine von
442 // SdrObjGeoData abgeleitete Klasse.
443 virtual SdrObjGeoData* NewGeoData() const;
444 virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
445 virtual void RestGeoData(const SdrObjGeoData& rGeo);
447 protected:
448 virtual ~SdrObject();
450 public:
451 TYPEINFO_OVERRIDE();
452 SdrObject();
454 // frees the SdrObject pointed to by the argument
455 // In case the object has an SvxShape, which has the ownership of the object, it
456 // is actually *not* deleted.
457 static void Free( SdrObject*& _rpObject );
459 // this method is only for access from Property objects
460 virtual void SetBoundRectDirty();
462 virtual void SetObjList(SdrObjList* pNewObjList);
463 SdrObjList* GetObjList() const;
465 virtual void SetPage(SdrPage* pNewPage);
466 SdrPage* GetPage() const;
468 virtual void SetModel(SdrModel* pNewModel);
469 SdrModel* GetModel() const;
470 SdrItemPool* GetObjectItemPool() const;
472 void AddListener(SfxListener& rListener);
473 void RemoveListener(SfxListener& rListener);
474 const SfxBroadcaster* GetBroadcaster() const;
476 virtual void AddReference(SdrVirtObj& rVrtObj);
477 virtual void DelReference(SdrVirtObj& rVrtObj);
478 virtual sal_uInt32 GetObjInventor() const;
479 virtual sal_uInt16 GetObjIdentifier() const;
480 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
482 // Layer interface
483 virtual SdrLayerID GetLayer() const;
484 virtual void NbcSetLayer(SdrLayerID nLayer);
485 virtual void SetLayer(SdrLayerID nLayer);
486 // renaming GetLayerSet -> getMergedHierarchyLayerSet to make clear what happens here. rSet needs to be empty.
487 virtual void getMergedHierarchyLayerSet(SetOfByte& rSet) const;
489 // UserCall interface
490 void SetUserCall(SdrObjUserCall* pUser);
491 SdrObjUserCall* GetUserCall() const;
492 void SendUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect) const;
494 // Such a reference point is for instance:
495 // - a symbol's point that should snap to the raster when inserting the symbol
496 // - or an image's fix point within an animation object
497 virtual bool HasRefPoint() const;
498 virtual Point GetRefPoint() const;
499 virtual void SetRefPoint(const Point& rPnt);
501 // #i68101#
502 // An object may have a user-set Name (Get/SetName()), e.g SdrGrafObj, SdrObjGroup
503 // or SdrOle2Obj.
504 // It may also have a Title and a Description for accessibility purposes.
505 void SetName(const OUString& rStr);
506 OUString GetName() const;
507 void SetTitle(const OUString& rStr);
508 OUString GetTitle() const;
509 void SetDescription(const OUString& rStr);
510 OUString GetDescription() const;
512 // for group objects
513 bool IsGroupObject() const;
514 virtual SdrObjList* GetSubList() const;
515 SdrObject* GetUpGroup() const;
517 // Ueber die Objekt-Ordnungsnummer kann man feststellen, ob ein Objekt vor
518 // oder hinter einem anderen liegt. Objekte mit kleinen Ordnungsnummern werden
519 // zuerst gezeichnet, Objekte mit grossen Ordnungsnummern zuletzt.
520 // Wird die Reihenfolge der Objekte in der Liste veraendert, so wird ein
521 // Dirty-Flag gesetzt (an der Page). Beim naechsten SdrObject::GetOrdNum()
522 // werden die Ordnungsnummer aller Objekte der Liste neu bestimmt.
523 sal_uInt32 GetOrdNum() const;
525 // Warning: this method should only be used if you really knows what you're doing
526 sal_uInt32 GetOrdNumDirect() const;
528 // setting the order number should only happen from the model or from the page
529 void SetOrdNum(sal_uInt32 nNum);
531 // GrabBagItem for interim interop purposes
532 void GetGrabBagItem(com::sun::star::uno::Any& rVal) const;
534 void SetGrabBagItem(const com::sun::star::uno::Any& rVal);
536 // Return the position in the navigation order for the called object.
537 // Note that this method may update the navigation position of the
538 // called and of other SdrObjects. Therefore this method can not be
539 // const.
540 // @return
541 // If no navigation position has been explicitly defined then the
542 // result of GetOrdNum() is returned.
543 sal_uInt32 GetNavigationPosition (void);
545 // Set the position in the navigation position to the given value.
546 // This method is typically used only by the model after a change to
547 // the navigation order.
548 // This method does not change the navigation position of other
549 // objects.
550 // Use SdrObjList::SetObjectNavigationPosition() instead.
551 void SetNavigationPosition (const sal_uInt32 nPosition);
553 // #111111#
554 // To make clearer that this method may trigger RecalcBoundRect and thus may be
555 // expensive and sometimes problematic (inside a bigger object change You will get
556 // non-useful BoundRects sometimes) i rename that method from GetBoundRect() to
557 // GetCurrentBoundRect().
558 virtual const Rectangle& GetCurrentBoundRect() const;
560 // #111111#
561 // To have a possibility to get the last calculated BoundRect e.g for producing
562 // the first rectangle for repaints (old and new need to be used) without forcing
563 // a RecalcBoundRect (which may be problematical and expensive sometimes) i add here
564 // a new method for accessing the last BoundRect.
565 virtual const Rectangle& GetLastBoundRect() const;
567 virtual void RecalcBoundRect();
569 void BroadcastObjectChange() const;
571 // set modified-flag in the model
572 virtual void SetChanged();
574 // Tooling for painting a single object to a OutputDevice. This will be needed as long
575 // as not all painting is changed to use DrawContact objects.
576 bool SingleObjectPainter(OutputDevice& rOut) const;
577 bool LineGeometryUsageIsNecessary() const;
579 // Returns a copy of the object. Every inherited class must reimplement this (in class Foo
580 // it should be sufficient to do "virtual Foo* Clone() const { return CloneHelper< Foo >(); }".
581 // Note that this function uses operator= internally.
582 virtual SdrObject* Clone() const;
583 // implemented mainly for the purposes of Clone()
584 SdrObject& operator=(const SdrObject& rObj);
586 // TakeObjName...() is for the display in the UI, e.g. "3 frames selected"
587 virtual OUString TakeObjNameSingul() const;
588 virtual OUString TakeObjNamePlural() const;
590 // Das Xor-Polygon wird von der View zu Draggen des Objektes benoetigt.
591 // Alle Polygone innerhalb des PolyPolygon werden als PolyLine interpretiert.
592 // Moechte man ein geschlossenes Polygon, so muss man es explizit schliessen.
593 virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
595 // Die Kontur fuer TextToContour
596 virtual basegfx::B2DPolyPolygon TakeContour() const;
598 // Ueber GetHdlCount gibt ein Objekt die Anzahl seiner Handles preis.
599 // Im Normalfall werden dies 8 sein, bei einer Strecke 2. Bei Polygonobjekten
600 // (Polygon,Spline,Bezier) kann die Handleanzahl wesentlich groesser werden.
601 // Polygonobjekten wird ausserdem die Moeglichkeit eingeraeumt einen Punkt
602 // eines selektierten Objekts zu selektieren. Das Handle dieses Punktes wird
603 // dann durch einen Satz neuer Handles ausgetauscht (PlusHdl). Bei einem
604 // Polygon wird das wohl ein einfacher Selektionshandle sein, bei einer
605 // Bezierkurve dagegen koennen das schon bis zu 3 Handles werden (inkl Gewichte).
606 // GetHdl() und GetPlusHdl() muessen Handleinstanzen mit new erzeugen!
607 // Ein Objekt, das bei HasSpacialDrag() true liefert muss diese Methoden
608 // zur Verfuegung stellen (inkl. FillHdlList).
609 virtual sal_uInt32 GetHdlCount() const;
610 virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
611 virtual sal_uInt32 GetPlusHdlCount(const SdrHdl& rHdl) const;
612 virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const;
613 virtual void AddToHdlList(SdrHdlList& rHdlList) const;
615 // Die Standardtransformationen (Move,Resize,Rotate,Mirror,Shear) werden von der
616 // View uebernommen (TakeXorPoly(),...).
617 // Objektspeziefisches draggen wie z.B. Eckenradius bei Rechtecken,
618 // Stuetzstellen bei Splines, Gewichte bei Bezierkurven und Pointer von
619 // Labelobjekten muss vom Objekt selbst gehandled werden. Um das Model
620 // Statusfrei zu halten werden die Statusdaten an der View gehalten und dem
621 // Objekt dann uebergeben. EndDrag liefrt im Normalfall true fuer Erfolg.
622 // false kann zurueckgegeben werden, wenn das Dragging das Objekt nicht
623 // veraendert hat, wobei dir evtl. Tatsache das die Maus nicht bewegt wurde
624 // bereits von der View abgefangen wird.
625 virtual bool hasSpecialDrag() const;
626 virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
627 virtual bool applySpecialDrag(SdrDragStat& rDrag);
628 virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const;
629 virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
631 // FullDrag support. This is for standard interactions and for SdrObjOwn
632 // support. If supportsFullDrag() returns true, getFullDragClone has to
633 // return a cloned SdrObject (who's ownership it loses) at which modifications
634 // like Move(), Scale(), etc or applySpecialDrag() will be executed. That
635 // object will be visualized on overlay for full drag, but should not be
636 // part of the model, thus not changing anything since it's only a temporary
637 // helper object for interaction
638 virtual bool supportsFullDrag() const;
639 virtual SdrObject* getFullDragClone() const;
641 // Jedes Objekt muss in der Lage sein sich selbst interaktiv zu erzeugen.
642 // Beim MausDown wird zunaechst ein neues Objekt erzeugt und dann seine
643 // BegCreate()-Methode gerufen. Bei jedem MausMode wird dann MovCreate
644 // gerufen. BrkCreate() bedeutet, dass der User die interaktive Objekt-
645 // erzeugung abgebrochen hat. EndCreate() wird gerufen beim MouseUp-Event.
646 // Liefert EndCreate() ein true, so ist die Objekterzeugung abgeschlossen;
647 // das Objekt wird in die entsprechende Liste eingefuegt. Andernfalls
648 // (EndCreate()==false) gehe ich davon aus, dass weitere Punkte zur
649 // Objekterzeugung notwendig sind (Polygon,...). Der Parameter eCmd
650 // enthaelt die Anzahl der Mausklicks (so die App diese durchreicht).
651 // BckCreate() -> Letztes EndCreate() rueckgaengig machen (z.B. letzten
652 // Polygonpunkt wieder loeschen).
653 // ReturnCode: true=Weiter gehts, false=Create dadurch abgebrochen.
654 virtual bool BegCreate(SdrDragStat& rStat);
655 virtual bool MovCreate(SdrDragStat& rStat); // if true, Xor needs to be repainted
656 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
657 virtual bool BckCreate(SdrDragStat& rStat);
658 virtual void BrkCreate(SdrDragStat& rStat);
660 // damit holt man sich den Pointer, der das Createn dieses Objekts symbolisiert
661 virtual Pointer GetCreatePointer() const;
663 // Polygon das waehrend des Erzeugens aufgezogen wird
664 virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
666 // Die Methoden Move, Resize, Rotate, Mirror, Shear, SetSnapRect und
667 // SetLogicRect rufen jeweils die entsprechenden Nbc-Methoden, versenden einen
668 // Repaint-Broadcast und setzen den Modified-Status am Model. Abgeleitete
669 // Objekte sollten i.d.R. nur die Nbc-Methoden ueberladen.
670 // Nbc bedeutet: 'NoBroadcast'.
671 virtual void NbcMove (const Size& rSiz);
672 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
673 virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
674 virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
675 virtual void NbcShear (const Point& rRef, long nWink, double tn, bool bVShear);
677 virtual void Move (const Size& rSiz);
678 virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true);
679 virtual void Rotate(const Point& rRef, long nWink, double sn, double cs);
680 virtual void Mirror(const Point& rRef1, const Point& rRef2);
681 virtual void Shear (const Point& rRef, long nWink, double tn, bool bVShear);
683 // Die relative Position eines Zeichenobjektes ist die Entfernung der
684 // linken oberen Eche des logisch umschliessenden Rechtecks (SnapRect)
685 // zum Anker.
686 virtual void NbcSetRelativePos(const Point& rPnt);
687 virtual void SetRelativePos(const Point& rPnt);
688 virtual Point GetRelativePos() const;
689 void ImpSetAnchorPos(const Point& rPnt);
690 virtual void NbcSetAnchorPos(const Point& rPnt);
691 virtual void SetAnchorPos(const Point& rPnt);
692 virtual const Point& GetAnchorPos() const;
694 // Snap wird nicht auf dem BoundRect ausgefuehrt, sondern nach Moeglichkeit auf
695 // logischen Koordinaten (also ohne Beruecksichtigung von Strichstaerke, ... ).
696 // SetSnapRect() versucht das Objekt so hinzusizen, dass es in das uebergebene
697 // Rect passt (ohne Strichstaerke, ...)
698 virtual void RecalcSnapRect();
699 virtual const Rectangle& GetSnapRect() const;
700 virtual void SetSnapRect(const Rectangle& rRect);
701 virtual void NbcSetSnapRect(const Rectangle& rRect);
703 // Logic Rect: for the Rect for instance without regard to rotation angle, shear, ...
704 virtual const Rectangle& GetLogicRect() const;
705 virtual void SetLogicRect(const Rectangle& rRect);
706 virtual void NbcSetLogicRect(const Rectangle& rRect);
708 // the default is to set the logic rect to the given rectangle rMaxRect. If the shape
709 // has an intrinsic aspect ratio it may set the logic rect so the aspect
710 // ratio is kept but still inside the rectangle rMaxRect.
711 // If bShrinkOnly is set to true, the size of the current logic rect will not
712 // be changed if it is smaller than the given rectangle rMaxRect.
713 virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false );
715 // rotation and shear angle
716 virtual long GetRotateAngle() const;
717 virtual long GetShearAngle(bool bVertical = false) const;
719 // Zum Fangen von/auf ausgezeichneten Punkten eines Obj (Polygonpunkte,
720 // Kreismittelpunkt, ...)
721 virtual sal_uInt32 GetSnapPointCount() const;
722 virtual Point GetSnapPoint(sal_uInt32 i) const;
724 // For objects, whose points can be moved individually.
725 // (e.g. polygons, polylines, lines)
726 // The points of those objects are selected (if necessary multiselection),
727 // deleted, inserted, or as a multiselection moved or rotated...
728 // Only such objects can have PlusHandles (e.g. the weights of an Bezier curve).
729 virtual bool IsPolyObj() const;
730 virtual sal_uInt32 GetPointCount() const;
731 virtual Point GetPoint(sal_uInt32 i) const;
732 void SetPoint(const Point& rPnt, sal_uInt32 i);
733 virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
735 // get all geometrical data for undo/redo
736 virtual SdrObjGeoData* GetGeoData() const;
737 virtual void SetGeoData(const SdrObjGeoData& rGeo);
739 // ItemSet access
740 const SfxItemSet& GetMergedItemSet() const;
741 void SetMergedItem(const SfxPoolItem& rItem);
742 void ClearMergedItem(const sal_uInt16 nWhich = 0);
743 void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false);
744 const SfxPoolItem& GetMergedItem(const sal_uInt16 nWhich) const;
746 // internal versions
747 protected:
748 const SfxItemSet& GetObjectItemSet() const;
749 void SetObjectItem(const SfxPoolItem& rItem);
750 void SetObjectItemSet(const SfxItemSet& rSet);
751 const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const;
753 // get SfxMapUnit the object is using
754 SfxMapUnit GetObjectMapUnit() const;
756 public:
757 // syntactical sugar for ItemSet accesses
758 void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems = false);
760 // NotPersistAttr for Layer, ObjName, geometrical transformations etc.
761 void TakeNotPersistAttr(SfxItemSet& rAttr, bool bMerge) const;
762 void ApplyNotPersistAttr(const SfxItemSet& rAttr);
763 void NbcApplyNotPersistAttr(const SfxItemSet& rAttr);
765 // if bDontRemoveHardAttr is false, set all attributes, which were set in the style sheet, to their default value
766 // if true, all hard attributes keep their values
767 void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr);
768 virtual void NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr);
769 SfxStyleSheet* GetStyleSheet() const;
771 virtual bool HasTextEdit() const;
773 // returns true if TextEditMode started
774 virtual bool BegTextEdit(SdrOutliner& rOutl);
775 virtual void EndTextEdit(SdrOutliner& rOutl);
777 // keep text in outliner's format
778 // SetOutlinerParaObject: transfer ownership of *pTextObject!
779 virtual void SetOutlinerParaObject(OutlinerParaObject* pTextObject);
780 virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
781 virtual OutlinerParaObject* GetOutlinerParaObject() const;
782 virtual void NbcReformatText();
783 virtual void ReformatText();
785 void BurnInStyleSheetAttributes();
787 // macro abilities, e.g. a rectangle as PushButton.
788 virtual bool HasMacro() const;
789 virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const;
790 virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec) const;
791 virtual void PaintMacro (OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const;
792 virtual bool DoMacro (const SdrObjMacroHitRec& rRec);
793 virtual OUString GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const;
794 bool IsMacroHit(const SdrObjMacroHitRec& rRec) const;
796 // Connectors
797 // (see also documentation in SvdoEdge.hxx, SdrEdgeObj,
798 // as well as SvdGlue.hxx and SvdGlEV.hxx)
799 // There are nodes and edges. In theory an edge can also be a node, but this isn't implemented yet.
800 // A node has a number of glue points, onto which edges can glued to
801 // An edge can be either
802 // - without any connection to any node,
803 // - or connected on one end to a node, while the other end is not connected,
804 // - or connected on both ends with exactly one node each.
805 // The edge is listener for its upto two nodes.
806 // Whenever a node is moved or resized, all its connected edges follow.
807 // This is also true for SetGluePoint()... on the node.
808 // On the other hand, moving/resizing an edge breaks the connection.
810 // is object a node?
811 virtual bool IsNode() const;
813 // automatic glue points:
814 // a node object must provide four vertex and corner positions
815 // usually 0: top, 1: right, 2: bottom, 3: left
816 virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
818 // usually:
819 // 0: top-left, 1: top-right, 2: bottom-right, 3: bottom-left
820 virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
822 // list of all glue points, can be NULL
823 virtual const SdrGluePointList* GetGluePointList() const;
824 //virtual SdrGluePointList* GetGluePointList();
826 // after changing the GluePointList, one has to call the object's SendRepaintBroadcast!
827 virtual SdrGluePointList* ForceGluePointList();
829 // to be set temporarily when transforming related object(?)
830 void SetGlueReallyAbsolute(bool bOn);
831 void NbcRotateGluePoints(const Point& rRef, long nWink, double sn, double cs);
832 void NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2);
833 void NbcShearGluePoints (const Point& rRef, long nWink, double tn, bool bVShear);
835 // is object an edge?
836 virtual bool IsEdge() const;
838 // if bTail1 is true, line start, otherwise line end
839 // if pObj is null disconnect
840 virtual void ConnectToNode(bool bTail1, SdrObject* pObj);
841 virtual void DisconnectFromNode(bool bTail1);
842 virtual SdrObject* GetConnectedNode(bool bTail1) const;
844 // sets the writing mode of the object's context
845 // Objects which itself do not support different writing modes will ignore this call.
846 // Objects which support different writing modes, but have an own, explicit writing mode set,
847 // will also ignore this call.
848 // Objects which support different writing modes, and whose own mode is set to css.text.WritingMode2.CONTEXT,
849 // will use the given writing mode to calculate their "effective writing mode".
850 // The behaviour of this method is undefined if you pass css.text.WritingMode2.CONTEXT.
851 // @param _nContextWritingMode
852 // the effective writing mode of the context of the object
853 virtual void SetContextWritingMode( const sal_Int16 _nContextWritingMode );
855 // If an object is able to convert itself into a polygon or into a Bezier curve (or into both),
856 // then the following methods should be overridden.
857 // E.g., convert a RectObj with line width 10, SOLID_PEN into a polygon:
858 // In the bLineToArea=false mode a PolyObj with four supporting points,
859 // line width 10 and SOLID_PEN shall be created.
860 // On the contrary in the bLineToArea=true mode the generated object should
861 // still have a line attribute NULL_PEN, and the line (also line pattern)
862 // itself should be emulated by the polygon area, which thereby can be
863 // manipulated by the user afterwards.
864 // The RectObj therefore can only convert correctly if it has an area attribute NULL_BRUSH.
865 // In this case it would have to:
866 // - set SOLID_BRUSH with the color of the given pen,
867 // - set NULL_PEN, and
868 // - generate PolyPolygon with two polygons with four supporting points each.
869 // In each case the return value is a SdrObject*, because it is also
870 // allowed to return group objects (e.g. for SdrTextObj).
871 // In the case of the conversion from TextObj to PathObj,
872 // both modi (bLineToArea=true/false) would be identical.
873 // The methods' default implementations report "I'm unable to do this" (false/null).
874 virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const;
875 SdrObject* ConvertToPolyObj(bool bBezier, bool bLineToArea) const;
877 // convert this path object to contour object; bForceLineDash converts even
878 // when there is no filled new polygon created from line-to-polygon conversion,
879 // specially used for XLINE_DASH and 3D conversion
880 SdrObject* ConvertToContourObj(SdrObject* pRet, bool bForceLineDash = false) const;
881 SdrObject* ImpConvertToContourObj(SdrObject* pRet, bool bForceLineDash = false) const;
883 // if true, reference onto an object
884 bool IsVirtualObj() const;
886 // is true, if object can probably be filled
887 // is false, if object has probably line ends
888 // is invalid, if this is a group object
889 bool IsClosedObj() const;
891 bool IsEdgeObj() const;
892 bool Is3DObj() const;
893 bool IsUnoObj() const;
894 void SetMarkProtect(bool bProt);
895 bool IsMarkProtect() const;
896 void SetInserted(bool bIns);
897 bool IsInserted() const;
898 void SetMoveProtect(bool bProt);
899 bool IsMoveProtect() const;
900 void SetResizeProtect(bool bProt);
901 bool IsResizeProtect() const;
902 void SetPrintable(bool bPrn);
903 bool IsPrintable() const;
904 void SetVisible(bool bVisible);
905 bool IsVisible() const;
906 void SetEmptyPresObj(bool bEpt);
907 bool IsEmptyPresObj() const;
908 void SetNotVisibleAsMaster(bool bFlg);
909 bool IsNotVisibleAsMaster() const;
911 // #i25616#
912 bool LineIsOutsideGeometry() const;
914 // #i25616#
915 bool DoesSupportTextIndentingOnLineWidthChange() const;
917 // application specific data
918 sal_uInt16 GetUserDataCount() const;
919 SdrObjUserData* GetUserData(sal_uInt16 nNum) const;
921 void AppendUserData(SdrObjUserData* pData);
923 // removes the record from the list and performs delete (FreeMem+Dtor).
924 void DeleteUserData(sal_uInt16 nNum);
926 // switch ItemPool for this object
927 void MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel = 0L);
929 // access to the UNO representation of the shape
930 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape();
931 ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > getWeakUnoShape() const { return maWeakUnoShape; }
933 static SdrObject* getSdrObjectFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt );
935 // sets a new UNO representation of the shape
936 // This is only a public interface function. The actual work is
937 // done by impl_setUnoShape().
938 // Calling this function is only allowed for the UNO representation
939 // itself!
940 void setUnoShape(
941 const com::sun::star::uno::Reference<
942 com::sun::star::uno::XInterface>& _rxUnoShape);
944 // retrieves the instance responsible for notifying changes in the properties of the shape associated with
945 // the SdrObject
947 // @precond
948 // There already exists an SvxShape instance associated with the SdrObject
949 // @throws ::com::sun::star::uno::RuntimeException
950 // if there does nt yet exists an SvxShape instance associated with the SdrObject.
951 ::svx::PropertyChangeNotifier&
952 getShapePropertyChangeNotifier();
954 // notifies a change in the given property, to all applicable listeners registered at the associated SvxShape
956 // This method is equivalent to calling getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty ),
957 // exception that it is allowed to be called when there does not yet exist an associated SvxShape - in which
958 // case the method will silently return without doing anything.
959 void notifyShapePropertyChange( const ::svx::ShapeProperty _eProperty ) const;
961 // transformation interface for StarOfficeAPI. This implements support for
962 // homogen 3x3 matrices containing the transformation of the SdrObject. At the
963 // moment it contains a shearX, rotation and translation, but for setting all linear
964 // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
966 // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
967 // with the base geometry and returns TRUE. Otherwise it returns FALSE.
968 virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
970 // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
971 // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
972 // to use (0,0) as upper left and will be scaled to the given size in the matrix.
973 virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
975 // #116168#
976 // give info if object is in destruction
977 bool IsInDestruction() const;
979 // return if fill is != XFILL_NONE
980 bool HasFillStyle() const;
981 bool HasLineStyle() const;
983 // on import of OLE object from MS documents the BLIP size might be retrieved,
984 // the following methods are used to control it;
985 // usually this data makes no sense after the import is finished, since the object
986 // might be resized
987 Rectangle GetBLIPSizeRectangle() const;
988 void SetBLIPSizeRectangle( const Rectangle& aRect );
990 /// @see mbDoNotInsertIntoPageAutomatically
991 void SetDoNotInsertIntoPageAutomatically(bool bSet);
992 /// @see mbDoNotInsertIntoPageAutomatically
993 bool IsDoNotInsertIntoPageAutomatically() const;
995 // #i121917#
996 virtual bool HasText() const;
998 virtual OString stringify() const;
1000 protected:
1001 // Sets a new UNO shape
1003 // The default implementation of this function sets the new UNO
1004 // shape. Derived classes should override the function to handle
1005 // any other actions that are needed when the shape is being
1006 // changed.
1008 // The implementation _must_ call the same method of its parent
1009 // class (preferably as the first step)!
1010 virtual void impl_setUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxUnoShape );
1012 // helper function for reimplementing Clone().
1013 template< typename T > T* CloneHelper() const;
1015 private:
1016 // only for internal use!
1017 SvxShape* getSvxShape();
1019 // do not use directly, always use getSvxShape() if you have to!
1020 SvxShape* mpSvxShape;
1021 ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >
1022 maWeakUnoShape;
1023 // HACK: Do not automatically insert newly created object into a page.
1024 // The user needs to do it manually later.
1025 bool mbDoNotInsertIntoPageAutomatically;
1028 // Whoever creates his own objects must set a link in the SdrObjFactory class.
1029 // The handler must have the following signature:
1030 // void Hdl(SdrObjFactory*)
1031 // He must take a look at the referenced instance's nInventor and nIdentifier values,
1032 // and must create a new drawing object instance accordingly.
1033 // He must also make the pNewObj pointer reference to this instance.
1034 class SVX_DLLPUBLIC SdrObjFactory
1036 public:
1037 sal_uInt32 nInventor;
1038 sal_uInt16 nIdentifier;
1040 // for MakeNewObj():
1041 SdrPage* pPage;
1042 SdrModel* pModel;
1043 SdrObject* pNewObj;
1045 // for MakeNewObjUserData():
1046 SdrObject* pObj;
1047 SdrObjUserData* pNewData;
1049 private:
1050 SVX_DLLPRIVATE SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pNewPage, SdrModel* pNewModel);
1052 public:
1053 static SdrObject* MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pPage, SdrModel* pModel=NULL);
1054 static void InsertMakeObjectHdl(const Link& rLink);
1055 static void RemoveMakeObjectHdl(const Link& rLink);
1056 static void InsertMakeUserDataHdl(const Link& rLink);
1057 static void RemoveMakeUserDataHdl(const Link& rLink);
1060 typedef tools::WeakReference< SdrObject > SdrObjectWeakRef;
1062 template< typename T > T* SdrObject::CloneHelper() const
1064 OSL_ASSERT( typeid( T ) == typeid( *this ));
1065 T* pObj = dynamic_cast< T* >( SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),NULL));
1066 if (pObj!=NULL)
1067 *pObj=*static_cast< const T* >( this );
1068 return pObj;
1071 #endif // INCLUDED_SVX_SVDOBJ_HXX
1073 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */