Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SVX_SVDOBJ_HXX
21 : #define INCLUDED_SVX_SVDOBJ_HXX
22 :
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>
43 :
44 : #include <boost/optional.hpp>
45 : #include <boost/ptr_container/ptr_vector.hpp>
46 :
47 : // forward declarations
48 :
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 : namespace tools { class PolyPolygon; }
73 : class SfxPoolItem;
74 : class SdrVirtObj;
75 : class SdrDragView;
76 :
77 : namespace sdr
78 : {
79 : namespace properties
80 : {
81 : class BaseProperties;
82 : } // end of namespace properties
83 : } // end of namespace sdr
84 :
85 : // #110094#
86 : namespace sdr
87 : {
88 : namespace contact
89 : {
90 : class ViewContact;
91 : } // end of namespace contact
92 : } // end of namespace sdr
93 :
94 : namespace svx
95 : {
96 : class PropertyChangeNotifier;
97 : }
98 :
99 : // Defines
100 :
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};
139 :
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
154 :
155 16456 : class SVX_DLLPUBLIC SdrObjUserCall
156 : {
157 : public:
158 : TYPEINFO();
159 : virtual ~SdrObjUserCall();
160 : virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle& rOldBoundRect);
161 : };
162 :
163 : class SVX_DLLPUBLIC SdrObjMacroHitRec
164 : {
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;
173 :
174 : SdrObjMacroHitRec();
175 : };
176 :
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
181 : {
182 : protected:
183 : sal_uInt32 nInventor;
184 : sal_uInt16 nIdentifier;
185 : sal_uInt16 nVersion;
186 :
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
191 :
192 : public:
193 : TYPEINFO();
194 :
195 : SdrObjUserData(sal_uInt32 nInv, sal_uInt16 nId, sal_uInt16 nVer);
196 : SdrObjUserData(const SdrObjUserData& rData);
197 : virtual ~SdrObjUserData();
198 :
199 : virtual SdrObjUserData* Clone(SdrObject* pObj1) const = 0; // #i71039# NULL -> 0
200 96088 : sal_uInt32 GetInventor() const { return nInventor;}
201 81488 : sal_uInt16 GetId() const { return nIdentifier;}
202 :
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;
209 : };
210 :
211 : class SdrObjUserDataList
212 : {
213 : typedef boost::ptr_vector<SdrObjUserData> ListType;
214 : ListType maList;
215 :
216 : public:
217 : SdrObjUserDataList();
218 : ~SdrObjUserDataList();
219 :
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);
225 : };
226 :
227 : // all geometrical data of an arbitrary object for use in undo/redo
228 : class SVX_DLLPUBLIC SdrObjGeoData
229 : {
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;
240 :
241 : public:
242 : SdrObjGeoData();
243 : virtual ~SdrObjGeoData();
244 : };
245 :
246 : // Bitsack for DrawObjects
247 : class SdrObjPlusData
248 : {
249 : friend class SdrObject;
250 :
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
254 :
255 : // #i68101#
256 : // object name, title and description
257 : OUString aObjName;
258 : OUString aObjTitle;
259 : OUString aObjDescription;
260 :
261 : public:
262 : TYPEINFO();
263 : SdrObjPlusData();
264 : virtual ~SdrObjPlusData();
265 : virtual SdrObjPlusData* Clone(SdrObject* pObj1) const;
266 :
267 : void SetGluePoints(const SdrGluePointList& rPts);
268 : };
269 :
270 : // provides information about various ZObject properties
271 : class SVX_DLLPUBLIC SdrObjTransformInfoRec
272 : {
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
294 :
295 : SdrObjTransformInfoRec();
296 : };
297 :
298 : // Abstract DrawObject
299 :
300 : class SvxShape;
301 : class SVX_DLLPUBLIC SdrObject: public SfxListener, public tools::WeakBase< SdrObject >
302 : {
303 : private:
304 : // ObjectUser section
305 : sdr::ObjectUserVector maObjectUsers;
306 :
307 : public:
308 : void AddObjectUser(sdr::ObjectUser& rNewUser);
309 : void RemoveObjectUser(sdr::ObjectUser& rOldUser);
310 :
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;
318 :
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;
326 :
327 : // DrawContact support: Methods for handling Object changes
328 : void ActionChanged() const;
329 :
330 : private:
331 : friend class SdrObjListIter;
332 : friend class SdrVirtObj;
333 : friend class SdrRectObj;
334 :
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)
344 :
345 : sal_uInt32 nOrdNum; // order number of the object in the list
346 :
347 : SfxGrabBagItem* pGrabBagItem; // holds the GrabBagItem property
348 :
349 :
350 : // Position in the navigation order. SAL_MAX_UINT32 when not used.
351 : sal_uInt32 mnNavigationPosition;
352 : SdrLayerID mnLayerID;
353 :
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?
360 :
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)
372 :
373 : // if true, object is invisible as object of the MasterPage
374 : bool bNotVisibleAsMaster : 1;
375 :
376 : // if true, the object is closed, i.e. no line, arc...
377 : bool bClosedObj : 1;
378 :
379 : bool bIsEdge : 1;
380 : bool bIs3DObj : 1;
381 : bool bMarkProt : 1; // marking forbidden, persistent
382 : bool bIsUnoObj : 1;
383 : bool bNotMasterCachable : 1;
384 :
385 : // #i25616#
386 : bool mbLineIsOutsideGeometry : 1;
387 :
388 : // #i25616#
389 : bool mbSupportTextIndentingOnLineWidthChange : 1;
390 :
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;
394 :
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 108 : void SetRelativeWidth( double nValue ) { mnRelativeWidth.reset( nValue ); }
405 776 : void SetRelativeWidthRelation( sal_Int16 eValue ) { meRelativeWidthRelation = eValue; }
406 118 : void SetRelativeHeight( double nValue ) { mnRelativeHeight.reset( nValue ); }
407 782 : void SetRelativeHeightRelation( sal_Int16 eValue ) { meRelativeHeightRelation = eValue; }
408 10124 : boost::optional<double> GetRelativeWidth( ) const { return mnRelativeWidth; }
409 366 : sal_Int16 GetRelativeWidthRelation() const { return meRelativeWidthRelation; }
410 9830 : boost::optional<double> GetRelativeHeight( ) const { return mnRelativeHeight; }
411 380 : sal_Int16 GetRelativeHeightRelation() const { return meRelativeHeightRelation; }
412 : // evil calc grid/shape drawlayer syncing
413 145435 : Point GetGridOffset() const { return aGridOffset; }
414 20504 : void SetGridOffset( const Point& rGridOffset ){ aGridOffset = rGridOffset; }
415 : protected:
416 : void ImpDeleteUserData();
417 : SdrObjUserData* ImpGetMacroUserData() const;
418 : Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
419 :
420 : // for GetDragComment
421 : void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, OUString& rStr, sal_uInt16 nVal=0) const;
422 :
423 : void ImpForcePlusData();
424 :
425 : OUString GetWinkStr(long nWink, bool bNoDegChar = false) const;
426 : OUString GetMetrStr(long nVal, MapUnit eWantMap=MAP_MM, bool bNoUnitChars = false) const;
427 :
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:
434 :
435 : // override if the class inherits from SdrObjPlusData:
436 : virtual SdrObjPlusData* NewPlusData() const;
437 :
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);
446 :
447 : protected:
448 : virtual ~SdrObject();
449 :
450 : public:
451 : TYPEINFO_OVERRIDE();
452 : SdrObject();
453 :
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 );
458 :
459 : // this method is only for access from Property objects
460 : virtual void SetBoundRectDirty();
461 :
462 : virtual void SetObjList(SdrObjList* pNewObjList);
463 4033611 : SdrObjList* GetObjList() const { return pObjList;}
464 :
465 : virtual void SetPage(SdrPage* pNewPage);
466 476514 : SdrPage* GetPage() const { return pPage;}
467 :
468 : virtual void SetModel(SdrModel* pNewModel);
469 2342259 : SdrModel* GetModel() const { return pModel;}
470 : SfxItemPool & GetObjectItemPool() const;
471 :
472 : void AddListener(SfxListener& rListener);
473 : void RemoveListener(SfxListener& rListener);
474 : const SfxBroadcaster* GetBroadcaster() const;
475 :
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;
481 :
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;
488 :
489 : // UserCall interface
490 : void SetUserCall(SdrObjUserCall* pUser);
491 3852251 : SdrObjUserCall* GetUserCall() const { return pUserCall;}
492 : void SendUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect) const;
493 :
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);
500 :
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;
511 :
512 : // for group objects
513 : bool IsGroupObject() const;
514 : virtual SdrObjList* GetSubList() const;
515 : SdrObject* GetUpGroup() const;
516 :
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;
524 :
525 : // Warning: this method should only be used if you really knows what you're doing
526 755852 : sal_uInt32 GetOrdNumDirect() const { return nOrdNum;}
527 :
528 : // setting the order number should only happen from the model or from the page
529 : void SetOrdNum(sal_uInt32 nNum);
530 :
531 : // GrabBagItem for interim interop purposes
532 : void GetGrabBagItem(com::sun::star::uno::Any& rVal) const;
533 :
534 : void SetGrabBagItem(const com::sun::star::uno::Any& rVal);
535 :
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);
544 :
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);
552 :
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;
559 :
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;
566 :
567 : virtual void RecalcBoundRect();
568 :
569 : void BroadcastObjectChange() const;
570 :
571 : // set modified-flag in the model
572 : virtual void SetChanged();
573 :
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;
578 :
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 :
584 : virtual SdrObject* CloneWithShellIDs( const OUString& rSrcShellID, const OUString& rDestShellID ) const;
585 :
586 : // implemented mainly for the purposes of Clone()
587 : SdrObject& operator=(const SdrObject& rObj);
588 :
589 : // TakeObjName...() is for the display in the UI, e.g. "3 frames selected"
590 : virtual OUString TakeObjNameSingul() const;
591 : virtual OUString TakeObjNamePlural() const;
592 :
593 : // Das Xor-Polygon wird von der View zu Draggen des Objektes benoetigt.
594 : // Alle Polygone innerhalb des tools::PolyPolygon werden als PolyLine interpretiert.
595 : // Moechte man ein geschlossenes Polygon, so muss man es explizit schliessen.
596 : virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
597 :
598 : // Die Kontur fuer TextToContour
599 : virtual basegfx::B2DPolyPolygon TakeContour() const;
600 :
601 : // Ueber GetHdlCount gibt ein Objekt die Anzahl seiner Handles preis.
602 : // Im Normalfall werden dies 8 sein, bei einer Strecke 2. Bei Polygonobjekten
603 : // (Polygon,Spline,Bezier) kann die Handleanzahl wesentlich groesser werden.
604 : // Polygonobjekten wird ausserdem die Moeglichkeit eingeraeumt einen Punkt
605 : // eines selektierten Objekts zu selektieren. Das Handle dieses Punktes wird
606 : // dann durch einen Satz neuer Handles ausgetauscht (PlusHdl). Bei einem
607 : // Polygon wird das wohl ein einfacher Selektionshandle sein, bei einer
608 : // Bezierkurve dagegen koennen das schon bis zu 3 Handles werden (inkl Gewichte).
609 : // GetHdl() und GetPlusHdl() muessen Handleinstanzen mit new erzeugen!
610 : // Ein Objekt, das bei HasSpacialDrag() true liefert muss diese Methoden
611 : // zur Verfuegung stellen (inkl. FillHdlList).
612 : virtual sal_uInt32 GetHdlCount() const;
613 : virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
614 : virtual sal_uInt32 GetPlusHdlCount(const SdrHdl& rHdl) const;
615 : virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const;
616 : virtual void AddToHdlList(SdrHdlList& rHdlList) const;
617 :
618 : // Die Standardtransformationen (Move,Resize,Rotate,Mirror,Shear) werden von der
619 : // View uebernommen (TakeXorPoly(),...).
620 : // Objektspeziefisches draggen wie z.B. Eckenradius bei Rechtecken,
621 : // Stuetzstellen bei Splines, Gewichte bei Bezierkurven und Pointer von
622 : // Labelobjekten muss vom Objekt selbst gehandled werden. Um das Model
623 : // Statusfrei zu halten werden die Statusdaten an der View gehalten und dem
624 : // Objekt dann uebergeben. EndDrag liefrt im Normalfall true fuer Erfolg.
625 : // false kann zurueckgegeben werden, wenn das Dragging das Objekt nicht
626 : // veraendert hat, wobei dir evtl. Tatsache das die Maus nicht bewegt wurde
627 : // bereits von der View abgefangen wird.
628 : virtual bool hasSpecialDrag() const;
629 : virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
630 : virtual bool applySpecialDrag(SdrDragStat& rDrag);
631 : virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const;
632 : virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
633 :
634 : // FullDrag support. This is for standard interactions and for SdrObjOwn
635 : // support. If supportsFullDrag() returns true, getFullDragClone has to
636 : // return a cloned SdrObject (who's ownership it loses) at which modifications
637 : // like Move(), Scale(), etc or applySpecialDrag() will be executed. That
638 : // object will be visualized on overlay for full drag, but should not be
639 : // part of the model, thus not changing anything since it's only a temporary
640 : // helper object for interaction
641 : virtual bool supportsFullDrag() const;
642 : virtual SdrObject* getFullDragClone() const;
643 :
644 : // Jedes Objekt muss in der Lage sein sich selbst interaktiv zu erzeugen.
645 : // Beim MausDown wird zunaechst ein neues Objekt erzeugt und dann seine
646 : // BegCreate()-Methode gerufen. Bei jedem MausMode wird dann MovCreate
647 : // gerufen. BrkCreate() bedeutet, dass der User die interaktive Objekt-
648 : // erzeugung abgebrochen hat. EndCreate() wird gerufen beim MouseUp-Event.
649 : // Liefert EndCreate() ein true, so ist die Objekterzeugung abgeschlossen;
650 : // das Objekt wird in die entsprechende Liste eingefuegt. Andernfalls
651 : // (EndCreate()==false) gehe ich davon aus, dass weitere Punkte zur
652 : // Objekterzeugung notwendig sind (Polygon,...). Der Parameter eCmd
653 : // enthaelt die Anzahl der Mausklicks (so die App diese durchreicht).
654 : // BckCreate() -> Letztes EndCreate() rueckgaengig machen (z.B. letzten
655 : // Polygonpunkt wieder loeschen).
656 : // ReturnCode: true=Weiter gehts, false=Create dadurch abgebrochen.
657 : virtual bool BegCreate(SdrDragStat& rStat);
658 : virtual bool MovCreate(SdrDragStat& rStat); // if true, Xor needs to be repainted
659 : virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
660 : virtual bool BckCreate(SdrDragStat& rStat);
661 : virtual void BrkCreate(SdrDragStat& rStat);
662 :
663 : // damit holt man sich den Pointer, der das Createn dieses Objekts symbolisiert
664 : virtual Pointer GetCreatePointer() const;
665 :
666 : // Polygon das waehrend des Erzeugens aufgezogen wird
667 : virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
668 :
669 : // Die Methoden Move, Resize, Rotate, Mirror, Shear, SetSnapRect und
670 : // SetLogicRect rufen jeweils die entsprechenden Nbc-Methoden, versenden einen
671 : // Repaint-Broadcast und setzen den Modified-Status am Model. Abgeleitete
672 : // Objekte sollten i.d.R. nur die Nbc-Methoden ueberladen.
673 : // Nbc bedeutet: 'NoBroadcast'.
674 : virtual void NbcMove (const Size& rSiz);
675 : virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
676 : virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
677 : virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
678 : virtual void NbcShear (const Point& rRef, long nWink, double tn, bool bVShear);
679 :
680 : virtual void Move (const Size& rSiz);
681 : virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true);
682 : virtual void Rotate(const Point& rRef, long nWink, double sn, double cs);
683 : virtual void Mirror(const Point& rRef1, const Point& rRef2);
684 : virtual void Shear (const Point& rRef, long nWink, double tn, bool bVShear);
685 :
686 : // Die relative Position eines Zeichenobjektes ist die Entfernung der
687 : // linken oberen Eche des logisch umschliessenden Rechtecks (SnapRect)
688 : // zum Anker.
689 : virtual void NbcSetRelativePos(const Point& rPnt);
690 : virtual void SetRelativePos(const Point& rPnt);
691 : virtual Point GetRelativePos() const;
692 : void ImpSetAnchorPos(const Point& rPnt);
693 : virtual void NbcSetAnchorPos(const Point& rPnt);
694 : virtual void SetAnchorPos(const Point& rPnt);
695 : virtual const Point& GetAnchorPos() const;
696 :
697 : // Snap wird nicht auf dem BoundRect ausgefuehrt, sondern nach Moeglichkeit auf
698 : // logischen Koordinaten (also ohne Beruecksichtigung von Strichstaerke, ... ).
699 : // SetSnapRect() versucht das Objekt so hinzusizen, dass es in das uebergebene
700 : // Rect passt (ohne Strichstaerke, ...)
701 : virtual void RecalcSnapRect();
702 : virtual const Rectangle& GetSnapRect() const;
703 : virtual void SetSnapRect(const Rectangle& rRect);
704 : virtual void NbcSetSnapRect(const Rectangle& rRect);
705 :
706 : // Logic Rect: for the Rect for instance without regard to rotation angle, shear, ...
707 : virtual const Rectangle& GetLogicRect() const;
708 : virtual void SetLogicRect(const Rectangle& rRect);
709 : virtual void NbcSetLogicRect(const Rectangle& rRect);
710 :
711 : // the default is to set the logic rect to the given rectangle rMaxRect. If the shape
712 : // has an intrinsic aspect ratio it may set the logic rect so the aspect
713 : // ratio is kept but still inside the rectangle rMaxRect.
714 : // If bShrinkOnly is set to true, the size of the current logic rect will not
715 : // be changed if it is smaller than the given rectangle rMaxRect.
716 : virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false );
717 :
718 : // rotation and shear angle
719 : virtual long GetRotateAngle() const;
720 : virtual long GetShearAngle(bool bVertical = false) const;
721 :
722 : // Zum Fangen von/auf ausgezeichneten Punkten eines Obj (Polygonpunkte,
723 : // Kreismittelpunkt, ...)
724 : virtual sal_uInt32 GetSnapPointCount() const;
725 : virtual Point GetSnapPoint(sal_uInt32 i) const;
726 :
727 : // For objects, whose points can be moved individually.
728 : // (e.g. polygons, polylines, lines)
729 : // The points of those objects are selected (if necessary multiselection),
730 : // deleted, inserted, or as a multiselection moved or rotated...
731 : // Only such objects can have PlusHandles (e.g. the weights of an Bezier curve).
732 : virtual bool IsPolyObj() const;
733 : virtual sal_uInt32 GetPointCount() const;
734 : virtual Point GetPoint(sal_uInt32 i) const;
735 : void SetPoint(const Point& rPnt, sal_uInt32 i);
736 : virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
737 :
738 : // get all geometrical data for undo/redo
739 : virtual SdrObjGeoData* GetGeoData() const;
740 : virtual void SetGeoData(const SdrObjGeoData& rGeo);
741 :
742 : // ItemSet access
743 : const SfxItemSet& GetMergedItemSet() const;
744 : void SetMergedItem(const SfxPoolItem& rItem);
745 : void ClearMergedItem(const sal_uInt16 nWhich = 0);
746 : void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false);
747 : const SfxPoolItem& GetMergedItem(const sal_uInt16 nWhich) const;
748 :
749 : // internal versions
750 : protected:
751 : const SfxItemSet& GetObjectItemSet() const;
752 : void SetObjectItem(const SfxPoolItem& rItem);
753 : void SetObjectItemSet(const SfxItemSet& rSet);
754 : const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const;
755 :
756 : // get SfxMapUnit the object is using
757 : SfxMapUnit GetObjectMapUnit() const;
758 :
759 : public:
760 : // syntactical sugar for ItemSet accesses
761 : void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems = false);
762 :
763 : // NotPersistAttr for Layer, ObjName, geometrical transformations etc.
764 : void TakeNotPersistAttr(SfxItemSet& rAttr, bool bMerge) const;
765 : void ApplyNotPersistAttr(const SfxItemSet& rAttr);
766 : void NbcApplyNotPersistAttr(const SfxItemSet& rAttr);
767 :
768 : // if bDontRemoveHardAttr is false, set all attributes, which were set in the style sheet, to their default value
769 : // if true, all hard attributes keep their values
770 : void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr);
771 : virtual void NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr);
772 : SfxStyleSheet* GetStyleSheet() const;
773 :
774 : virtual bool HasTextEdit() const;
775 :
776 : // returns true if TextEditMode started
777 : virtual bool BegTextEdit(SdrOutliner& rOutl);
778 : virtual void EndTextEdit(SdrOutliner& rOutl);
779 :
780 : // keep text in outliner's format
781 : // SetOutlinerParaObject: transfer ownership of *pTextObject!
782 : virtual void SetOutlinerParaObject(OutlinerParaObject* pTextObject);
783 : virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
784 : virtual OutlinerParaObject* GetOutlinerParaObject() const;
785 : virtual void NbcReformatText();
786 : virtual void ReformatText();
787 :
788 : void BurnInStyleSheetAttributes();
789 :
790 : // macro abilities, e.g. a rectangle as PushButton.
791 : virtual bool HasMacro() const;
792 : virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const;
793 : virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec) const;
794 : virtual void PaintMacro (OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const;
795 : virtual bool DoMacro (const SdrObjMacroHitRec& rRec);
796 : virtual OUString GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const;
797 : bool IsMacroHit(const SdrObjMacroHitRec& rRec) const;
798 :
799 : // Connectors
800 : // (see also documentation in SvdoEdge.hxx, SdrEdgeObj,
801 : // as well as SvdGlue.hxx and SvdGlEV.hxx)
802 : // There are nodes and edges. In theory an edge can also be a node, but this isn't implemented yet.
803 : // A node has a number of glue points, onto which edges can glued to
804 : // An edge can be either
805 : // - without any connection to any node,
806 : // - or connected on one end to a node, while the other end is not connected,
807 : // - or connected on both ends with exactly one node each.
808 : // The edge is listener for its upto two nodes.
809 : // Whenever a node is moved or resized, all its connected edges follow.
810 : // This is also true for SetGluePoint()... on the node.
811 : // On the other hand, moving/resizing an edge breaks the connection.
812 :
813 : // is object a node?
814 : virtual bool IsNode() const;
815 :
816 : // automatic glue points:
817 : // a node object must provide four vertex and corner positions
818 : // usually 0: top, 1: right, 2: bottom, 3: left
819 : virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
820 :
821 : // usually:
822 : // 0: top-left, 1: top-right, 2: bottom-right, 3: bottom-left
823 : virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
824 :
825 : // list of all glue points, can be NULL
826 : virtual const SdrGluePointList* GetGluePointList() const;
827 : //virtual SdrGluePointList* GetGluePointList();
828 :
829 : // after changing the GluePointList, one has to call the object's SendRepaintBroadcast!
830 : virtual SdrGluePointList* ForceGluePointList();
831 :
832 : // to be set temporarily when transforming related object(?)
833 : void SetGlueReallyAbsolute(bool bOn);
834 : void NbcRotateGluePoints(const Point& rRef, long nWink, double sn, double cs);
835 : void NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2);
836 : void NbcShearGluePoints (const Point& rRef, long nWink, double tn, bool bVShear);
837 :
838 : // is object an edge?
839 : virtual bool IsEdge() const;
840 :
841 : // if bTail1 is true, line start, otherwise line end
842 : // if pObj is null disconnect
843 : virtual void ConnectToNode(bool bTail1, SdrObject* pObj);
844 : virtual void DisconnectFromNode(bool bTail1);
845 : virtual SdrObject* GetConnectedNode(bool bTail1) const;
846 :
847 : // sets the writing mode of the object's context
848 : // Objects which itself do not support different writing modes will ignore this call.
849 : // Objects which support different writing modes, but have an own, explicit writing mode set,
850 : // will also ignore this call.
851 : // Objects which support different writing modes, and whose own mode is set to css.text.WritingMode2.CONTEXT,
852 : // will use the given writing mode to calculate their "effective writing mode".
853 : // The behaviour of this method is undefined if you pass css.text.WritingMode2.CONTEXT.
854 : // @param _nContextWritingMode
855 : // the effective writing mode of the context of the object
856 : virtual void SetContextWritingMode( const sal_Int16 _nContextWritingMode );
857 :
858 : // If an object is able to convert itself into a polygon or into a Bezier curve (or into both),
859 : // then the following methods should be overridden.
860 : // E.g., convert a RectObj with line width 10, SOLID_PEN into a polygon:
861 : // In the bLineToArea=false mode a PolyObj with four supporting points,
862 : // line width 10 and SOLID_PEN shall be created.
863 : // On the contrary in the bLineToArea=true mode the generated object should
864 : // still have a line attribute NULL_PEN, and the line (also line pattern)
865 : // itself should be emulated by the polygon area, which thereby can be
866 : // manipulated by the user afterwards.
867 : // The RectObj therefore can only convert correctly if it has an area attribute NULL_BRUSH.
868 : // In this case it would have to:
869 : // - set SOLID_BRUSH with the color of the given pen,
870 : // - set NULL_PEN, and
871 : // - generate tools::PolyPolygon with two polygons with four supporting points each.
872 : // In each case the return value is a SdrObject*, because it is also
873 : // allowed to return group objects (e.g. for SdrTextObj).
874 : // In the case of the conversion from TextObj to PathObj,
875 : // both modi (bLineToArea=true/false) would be identical.
876 : // The methods' default implementations report "I'm unable to do this" (false/null).
877 : virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const;
878 : SdrObject* ConvertToPolyObj(bool bBezier, bool bLineToArea) const;
879 :
880 : // convert this path object to contour object; bForceLineDash converts even
881 : // when there is no filled new polygon created from line-to-polygon conversion,
882 : // specially used for XLINE_DASH and 3D conversion
883 : SdrObject* ConvertToContourObj(SdrObject* pRet, bool bForceLineDash = false) const;
884 : SdrObject* ImpConvertToContourObj(SdrObject* pRet, bool bForceLineDash = false) const;
885 :
886 : // if true, reference onto an object
887 26044 : bool IsVirtualObj() const { return bVirtObj;}
888 :
889 : // is true, if object can probably be filled
890 : // is false, if object has probably line ends
891 : // is invalid, if this is a group object
892 7048 : bool IsClosedObj() const { return bClosedObj;}
893 :
894 36984 : bool IsEdgeObj() const { return bIsEdge;}
895 1913 : bool Is3DObj() const { return bIs3DObj;}
896 704 : bool IsUnoObj() const { return bIsUnoObj;}
897 : void SetMarkProtect(bool bProt);
898 2678 : bool IsMarkProtect() const { return bMarkProt;}
899 : void SetInserted(bool bIns);
900 1448082 : bool IsInserted() const { return bInserted;}
901 : void SetMoveProtect(bool bProt);
902 1344 : bool IsMoveProtect() const { return bMovProt;}
903 : void SetResizeProtect(bool bProt);
904 2513 : bool IsResizeProtect() const { return bSizProt;}
905 : void SetPrintable(bool bPrn);
906 2266 : bool IsPrintable() const { return !bNoPrint;}
907 : void SetVisible(bool bVisible);
908 41945 : bool IsVisible() const { return mbVisible;}
909 : void SetEmptyPresObj(bool bEpt);
910 52536 : bool IsEmptyPresObj() const { return bEmptyPresObj;}
911 : void SetNotVisibleAsMaster(bool bFlg);
912 1764 : bool IsNotVisibleAsMaster() const { return bNotVisibleAsMaster;}
913 :
914 : // #i25616#
915 480 : bool LineIsOutsideGeometry() const { return mbLineIsOutsideGeometry;}
916 :
917 : // #i25616#
918 64406 : bool DoesSupportTextIndentingOnLineWidthChange() const { return mbSupportTextIndentingOnLineWidthChange;}
919 :
920 : // application specific data
921 : sal_uInt16 GetUserDataCount() const;
922 : SdrObjUserData* GetUserData(sal_uInt16 nNum) const;
923 :
924 : void AppendUserData(SdrObjUserData* pData);
925 :
926 : // removes the record from the list and performs delete (FreeMem+Dtor).
927 : void DeleteUserData(sal_uInt16 nNum);
928 :
929 : // switch ItemPool for this object
930 : void MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel = 0L);
931 :
932 : // access to the UNO representation of the shape
933 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape();
934 221323 : ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > getWeakUnoShape() const { return maWeakUnoShape; }
935 :
936 : static SdrObject* getSdrObjectFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt );
937 :
938 : // sets a new UNO representation of the shape
939 : // This is only a public interface function. The actual work is
940 : // done by impl_setUnoShape().
941 : // Calling this function is only allowed for the UNO representation
942 : // itself!
943 : void setUnoShape(
944 : const com::sun::star::uno::Reference<
945 : com::sun::star::uno::XInterface>& _rxUnoShape);
946 :
947 : // retrieves the instance responsible for notifying changes in the properties of the shape associated with
948 : // the SdrObject
949 : //
950 : // @precond
951 : // There already exists an SvxShape instance associated with the SdrObject
952 : // @throws ::com::sun::star::uno::RuntimeException
953 : // if there does nt yet exists an SvxShape instance associated with the SdrObject.
954 : ::svx::PropertyChangeNotifier&
955 : getShapePropertyChangeNotifier();
956 :
957 : // notifies a change in the given property, to all applicable listeners registered at the associated SvxShape
958 : //
959 : // This method is equivalent to calling getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty ),
960 : // exception that it is allowed to be called when there does not yet exist an associated SvxShape - in which
961 : // case the method will silently return without doing anything.
962 : void notifyShapePropertyChange( const ::svx::ShapeProperty _eProperty ) const;
963 :
964 : // transformation interface for StarOfficeAPI. This implements support for
965 : // homogen 3x3 matrices containing the transformation of the SdrObject. At the
966 : // moment it contains a shearX, rotation and translation, but for setting all linear
967 : // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
968 : //
969 : // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
970 : // with the base geometry and returns TRUE. Otherwise it returns FALSE.
971 : virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
972 :
973 : // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
974 : // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
975 : // to use (0,0) as upper left and will be scaled to the given size in the matrix.
976 : virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
977 :
978 : // #116168#
979 : // give info if object is in destruction
980 : bool IsInDestruction() const;
981 :
982 : // return if fill is != XFILL_NONE
983 : bool HasFillStyle() const;
984 : bool HasLineStyle() const;
985 :
986 : // on import of OLE object from MS documents the BLIP size might be retrieved,
987 : // the following methods are used to control it;
988 : // usually this data makes no sense after the import is finished, since the object
989 : // might be resized
990 18 : Rectangle GetBLIPSizeRectangle() const { return maBLIPSizeRectangle;}
991 : void SetBLIPSizeRectangle( const Rectangle& aRect );
992 :
993 : /// @see mbDoNotInsertIntoPageAutomatically
994 : void SetDoNotInsertIntoPageAutomatically(bool bSet);
995 : /// @see mbDoNotInsertIntoPageAutomatically
996 6518 : bool IsDoNotInsertIntoPageAutomatically() const { return mbDoNotInsertIntoPageAutomatically;}
997 :
998 : // #i121917#
999 : virtual bool HasText() const;
1000 :
1001 : OString stringify() const;
1002 :
1003 : protected:
1004 : // Sets a new UNO shape
1005 : //
1006 : // The default implementation of this function sets the new UNO
1007 : // shape. Derived classes should override the function to handle
1008 : // any other actions that are needed when the shape is being
1009 : // changed.
1010 : //
1011 : // The implementation _must_ call the same method of its parent
1012 : // class (preferably as the first step)!
1013 : virtual void impl_setUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxUnoShape );
1014 :
1015 : // helper function for reimplementing Clone().
1016 : template< typename T > T* CloneHelper() const;
1017 :
1018 : private:
1019 : // only for internal use!
1020 : SvxShape* getSvxShape();
1021 :
1022 : // do not use directly, always use getSvxShape() if you have to!
1023 : SvxShape* mpSvxShape;
1024 : ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >
1025 : maWeakUnoShape;
1026 : // HACK: Do not automatically insert newly created object into a page.
1027 : // The user needs to do it manually later.
1028 : bool mbDoNotInsertIntoPageAutomatically;
1029 : };
1030 :
1031 : // Whoever creates his own objects must set a link in the SdrObjFactory class.
1032 : // The handler must have the following signature:
1033 : // void Hdl(SdrObjFactory*)
1034 : // He must take a look at the referenced instance's nInventor and nIdentifier values,
1035 : // and must create a new drawing object instance accordingly.
1036 : // He must also make the pNewObj pointer reference to this instance.
1037 : class SVX_DLLPUBLIC SdrObjFactory
1038 : {
1039 : public:
1040 : sal_uInt32 nInventor;
1041 : sal_uInt16 nIdentifier;
1042 :
1043 : // for MakeNewObj():
1044 : SdrPage* pPage;
1045 : SdrModel* pModel;
1046 : SdrObject* pNewObj;
1047 :
1048 : // for MakeNewObjUserData():
1049 : SdrObject* pObj;
1050 : SdrObjUserData* pNewData;
1051 :
1052 : private:
1053 : SVX_DLLPRIVATE SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pNewPage, SdrModel* pNewModel);
1054 :
1055 : public:
1056 : static SdrObject* MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pPage, SdrModel* pModel=NULL);
1057 : static void InsertMakeObjectHdl(const Link& rLink);
1058 : static void RemoveMakeObjectHdl(const Link& rLink);
1059 : static void InsertMakeUserDataHdl(const Link& rLink);
1060 : static void RemoveMakeUserDataHdl(const Link& rLink);
1061 : };
1062 :
1063 : typedef tools::WeakReference< SdrObject > SdrObjectWeakRef;
1064 :
1065 1340 : template< typename T > T* SdrObject::CloneHelper() const
1066 : {
1067 : OSL_ASSERT( typeid( T ) == typeid( *this ));
1068 1340 : T* pObj = dynamic_cast< T* >( SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),NULL));
1069 1340 : if (pObj!=NULL)
1070 1340 : *pObj=*static_cast< const T* >( this );
1071 1340 : return pObj;
1072 : }
1073 :
1074 : #endif // INCLUDED_SVX_SVDOBJ_HXX
1075 :
1076 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|