xref: /AOO41X/main/svx/inc/svx/svdobj.hxx (revision 3dceaf700ec27bdf08a615f6b12e29fa57df2c56)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVDOBJ_HXX
25 #define _SVDOBJ_HXX
26 
27 #include <memory>
28 #include <cppuhelper/weakref.hxx>
29 #include <vcl/mapmod.hxx>
30 #include <tools/weakbase.hxx>
31 #include <svl/lstner.hxx>
32 #include <vcl/timer.hxx>
33 #include <svx/svdsob.hxx>
34 #include <svx/svdtypes.hxx> // fuer SdrLayerID
35 #include <svx/svdglue.hxx> // Klebepunkte
36 #include <svx/xdash.hxx>
37 #include <svx/xpoly.hxx>
38 #include <svx/xenum.hxx>
39 #include <vcl/bitmapex.hxx>
40 #include <svx/sdrobjectuser.hxx>
41 #include "svx/svxdllapi.h"
42 #include "svx/shapeproperty.hxx"
43 #include <svl/poolitem.hxx>
44 
45 //************************************************************
46 //   Vorausdeklarationen
47 //************************************************************
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 SfxSetItem;
66 class SfxStyleSheet;
67 class SfxUndoAction;
68 class XFillAttrSetItem;
69 class XLineAttrSetItem;
70 class SfxItemPool;
71 class PolyPolygon;
72 class SfxPoolItem;
73 class SdrVirtObj;
74 class SdrDragView;
75 
76 namespace sdr
77 {
78     namespace properties
79     {
80         class BaseProperties;
81     } // end of namespace properties
82 } // end of namespace sdr
83 
84 // #110094#
85 namespace sdr
86 {
87     namespace contact
88     {
89         class ViewContact;
90     } // end of namespace contact
91 } // end of namespace sdr
92 
93 namespace svx
94 {
95     class PropertyChangeNotifier;
96 }
97 
98 //************************************************************
99 //   Defines
100 //************************************************************
101 
102 enum SdrObjKind {OBJ_NONE       = 0,  // Abstraktes Objekt (SdrObject)
103                  OBJ_GRUP       = 1,  // Objektgruppe
104                  OBJ_LINE       = 2,  // Strecke
105                  OBJ_RECT       = 3,  // Rechteck ww. mit runden Ecken
106                  OBJ_CIRC       = 4,  // Kreis, Ellipse
107                  OBJ_SECT       = 5,  // Kreissektor
108                  OBJ_CARC       = 6,  // Kreisbogen
109                  OBJ_CCUT       = 7,  // Kreisabschnitt
110                  OBJ_POLY       = 8,  // Polygon, PolyPolygon
111                  OBJ_PLIN       = 9,  // PolyLine
112                  OBJ_PATHLINE   =10,  // Offene Bezierkurve
113                  OBJ_PATHFILL   =11,  // Geschlossene Bezierkurve
114                  OBJ_FREELINE   =12,  // Offene Freihandlinie
115                  OBJ_FREEFILL   =13,  // Geschlossene Freihandlinie
116                  OBJ_SPLNLINE   =14,  // Natuerlicher kubischer Spline          (ni)
117                  OBJ_SPLNFILL   =15,  // Periodischer kubischer Spline          (ni)
118                  OBJ_TEXT       =16,  // Textobjekt
119                  OBJ_TEXTEXT    =17,  // Texterweiterungsrahmen                 (ni)
120                  OBJ_wegFITTEXT,      // FitToSize-Text (alle Zeilen gleich)
121                  OBJ_wegFITALLTEXT,   // FitToSize-Text (Zeilenweise)           (ni)
122                  OBJ_TITLETEXT  =20,  // Titeltext. Spezial-Textobjekt fuer StarDraw
123                  OBJ_OUTLINETEXT=21,  // OutlineText. Spezial-Textobjekt fuer StarDraw
124                  OBJ_GRAF       =22,  // Fremdgrafik - (StarView Graphic)
125                  OBJ_OLE2       =23,  // OLE-Objekt
126                  OBJ_EDGE       =24,  // Verbindungsobjekt fuer Konnektoren
127                  OBJ_CAPTION    =25,  // Legendenobjekt
128                  OBJ_PATHPOLY   =26,  // Polygon/PolyPolygon dargestellt durch SdrPathObj
129                  OBJ_PATHPLIN   =27,  // Polyline dargestellt durch SdrPathObj
130                  OBJ_PAGE       =28,  // Objekt, das eine SdrPage darstellt
131                  OBJ_MEASURE    =29,  // Bemassungsobjekt
132                  OBJ_DUMMY      =30,  // Dummyobjekt zum speichern von Luecken (zur anschliessenden Wiederherstellung der Surrogate)
133                  OBJ_FRAME      =31,  // staendig aktives OLE (PlugIn-Frame oder sowas)
134                  OBJ_UNO        =32,  // Universal Network Object im SvDraw-Obj eingepackt
135                  OBJ_CUSTOMSHAPE=33,  // CustomShape
136                  OBJ_MEDIA      =34,  // Media shape
137                  OBJ_TABLE      =35,  // Table
138                  OBJ_MAXI};
139 
140 enum SdrUserCallType {SDRUSERCALL_MOVEONLY,         // Nur verschoben, Groesse unveraendert
141                       SDRUSERCALL_RESIZE,           // Groesse und evtl. auch Pos veraendert
142                       SDRUSERCALL_CHGATTR,          // Attribute veraendert. Moeglicherweise neue Groesse wg. Linienbreite
143                       SDRUSERCALL_DELETE,           // Obj gibt es gleich nicht mehr. Schon keine Attr mehr.
144                       SDRUSERCALL_COPY,             // Zuweisungsoperator gerufen. Kann alles geaendert sein
145                       SDRUSERCALL_INSERTED,         // In eine Objektliste (z.B. Page) eingefuegt
146                       SDRUSERCALL_REMOVED,          // Aus der Objektliste entfernt
147                       SDRUSERCALL_CHILD_MOVEONLY,   // Ein Child einer Gruppe hat sich veraendert
148                       SDRUSERCALL_CHILD_RESIZE,     // Ein Child einer Gruppe hat sich veraendert
149                       SDRUSERCALL_CHILD_CHGATTR,    // Ein Child einer Gruppe hat sich veraendert
150                       SDRUSERCALL_CHILD_DELETE,     // Ein Child einer Gruppe hat sich veraendert
151                       SDRUSERCALL_CHILD_COPY,       // Ein Child einer Gruppe hat sich veraendert
152                       SDRUSERCALL_CHILD_INSERTED,   // Ein Child einer Gruppe hat sich veraendert
153                       SDRUSERCALL_CHILD_REMOVED};   // Ein Child einer Gruppe hat sich veraendert
154 
155 /* nur voruebergehend, weil sonst MUSS-Aenderung */
156 // #define nLayerID nLayerId
157 
158 //************************************************************
159 //   Hilfsklasse SdrObjUserCall
160 //************************************************************
161 
162 class SVX_DLLPUBLIC SdrObjUserCall
163 {
164 public:
165     TYPEINFO();
166     virtual ~SdrObjUserCall();
167     virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle& rOldBoundRect);
168 };
169 
170 //************************************************************
171 //   Hilfsklasse SdrObjMacroHitRec
172 //************************************************************
173 
174 class SdrObjMacroHitRec
175 {
176 public:
177     Point                       aPos;
178     Point                       aDownPos;
179     OutputDevice*               pOut;
180     const SetOfByte*            pVisiLayer;
181     const SdrPageView*          pPageView;
182     sal_uInt16                      nTol;
183     FASTBOOL                    bDown;
184 
185 public:
SdrObjMacroHitRec()186     SdrObjMacroHitRec()
187     :   pOut(NULL),
188         pVisiLayer(NULL),
189         pPageView(NULL),
190         nTol(0),
191         bDown(sal_False)
192     {}
193 };
194 
195 //************************************************************
196 //   Hilfsklasse SdrObjUserData
197 //
198 // Anwenderdaten an einem Zeichenobjekt, z.B. applikationsspezifische Daten.
199 // Jedes Zeichenobjekt kann beliebig viele dieser Records haben (SV-Liste).
200 // Wer hier Daten halten will, muss sich ableiten und auch an der Factory
201 // einen entsprechenden Link setzen.
202 //
203 //************************************************************
204 
205 class SVX_DLLPUBLIC SdrObjUserData
206 {
207 protected:
208     sal_uInt32                      nInventor;
209     sal_uInt16                      nIdentifier;
210     sal_uInt16                      nVersion;
211 
212 private:
213     SVX_DLLPRIVATE void operator=(const SdrObjUserData& rData);        // nicht implementiert
214     SVX_DLLPRIVATE sal_Bool operator==(const SdrObjUserData& rData) const; // nicht implementiert
215     SVX_DLLPRIVATE sal_Bool operator!=(const SdrObjUserData& rData) const; // nicht implementiert
216 
217 public:
218     TYPEINFO();
219 
SdrObjUserData(sal_uInt32 nInv,sal_uInt16 nId,sal_uInt16 nVer)220     SdrObjUserData(sal_uInt32 nInv, sal_uInt16 nId, sal_uInt16 nVer)
221     :   nInventor(nInv),
222         nIdentifier(nId),
223         nVersion(nVer)
224     {}
SdrObjUserData(const SdrObjUserData & rData)225     SdrObjUserData(const SdrObjUserData& rData)
226     :   nInventor(rData.nInventor),
227         nIdentifier(rData.nIdentifier),
228         nVersion(rData.nVersion)
229     {}
230     virtual ~SdrObjUserData();
231 
232     virtual SdrObjUserData* Clone(SdrObject* pObj1) const = 0; // #i71039# NULL -> 0
GetInventor() const233     sal_uInt32  GetInventor() const { return nInventor; }
GetId() const234     sal_uInt16  GetId() const { return nIdentifier; }
235 
236     virtual FASTBOOL HasMacro (const SdrObject* pObj) const;
237     virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
238     virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
239     virtual void PaintMacro (OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
240     virtual FASTBOOL DoMacro (const SdrObjMacroHitRec& rRec, SdrObject* pObj);
241     virtual XubString GetMacroPopupComment(const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
242 };
243 
244 //************************************************************
245 //   Hilfsklasse SdrObjUserDataList
246 //************************************************************
247 
248 class SdrObjUserDataList
249 {
250     Container                   aList;
251 
252 public:
SdrObjUserDataList()253     SdrObjUserDataList()
254     :   aList(1024,4,4)
255     {}
~SdrObjUserDataList()256     ~SdrObjUserDataList() { Clear(); }
257 
258     void Clear();
GetUserDataCount() const259     sal_uInt16 GetUserDataCount() const { return sal_uInt16(aList.Count()); }
GetUserData(sal_uInt16 nNum) const260     SdrObjUserData* GetUserData(sal_uInt16 nNum) const { return (SdrObjUserData*)aList.GetObject(nNum); }
InsertUserData(SdrObjUserData * pData,sal_uInt16 nPos=0xFFFF)261     void InsertUserData(SdrObjUserData* pData, sal_uInt16 nPos=0xFFFF) { aList.Insert(pData,nPos); }
RemoveUserData(sal_uInt16 nNum)262     SdrObjUserData* RemoveUserData(sal_uInt16 nNum) { return (SdrObjUserData*)aList.Remove(nNum);}
DeleteUserData(sal_uInt16 nNum)263     void DeleteUserData(sal_uInt16 nNum) { delete RemoveUserData(nNum); }
264 };
265 
266 //************************************************************
267 //   Hilfsklasse SdrObjGeoData
268 //
269 // Alle geometrischen Daten eines beliebigen Objektes zur �bergabe an's Undo/Redo
270 //
271 //************************************************************
272 
273 class SVX_DLLPUBLIC SdrObjGeoData
274 {
275 public:
276     Rectangle                   aBoundRect;
277     Point                       aAnchor;
278     SdrGluePointList*           pGPL;
279     sal_Bool                        bMovProt;
280     sal_Bool                        bSizProt;
281     sal_Bool                        bNoPrint;
282     sal_Bool                        bClosedObj;
283     bool                        mbVisible;
284     SdrLayerID                  mnLayerID;
285 
286 public:
287     SdrObjGeoData();
288     virtual ~SdrObjGeoData();
289 };
290 
291 //************************************************************
292 //   Hilfsklasse SdrObjPlusData
293 //
294 // Bitsack fuer DrawObjekte
295 //
296 //************************************************************
297 
298 class SdrObjPlusData
299 {
300     friend class                SdrObject;
301 
302 public:
303     SfxBroadcaster*             pBroadcast;    // Broadcaster, falls dieses Obj referenziert wird (bVirtObj=sal_True). Auch fuer Konnektoren etc.
304     SdrObjUserDataList*         pUserDataList; // applikationsspeziefische Daten
305     SdrGluePointList*           pGluePoints;   // Klebepunkte zum Ankleben von Objektverbindern
306     AutoTimer*                  pAutoTimer;
307 
308     // #i68101#
309     // object name, title and description
310     String                      aObjName;
311     String                      aObjTitle;
312     String                      aObjDescription;
313 
314     // Name to be used by applications
315     XubString                   aHTMLName;
316 
317 public:
318     TYPEINFO();
319     SdrObjPlusData();
320     virtual ~SdrObjPlusData();
321     virtual SdrObjPlusData* Clone(SdrObject* pObj1) const;
322 };
323 
324 //************************************************************
325 //   Hilfsklasse SdrObjTransformInfoRec
326 //
327 // gibt Auskunft ueber verschiedene Eigenschaften eines ZObjects
328 //
329 //************************************************************
330 
331 class SdrObjTransformInfoRec
332 {
333 public:
334     unsigned                    bSelectAllowed : 1;     // sal_False=Obj kann nicht selektiert werden
335     unsigned                    bMoveAllowed : 1;       // sal_False=Obj kann nicht verschoben werden
336     unsigned                    bResizeFreeAllowed : 1; // sal_False=Obj kann nicht frei resized werden
337     unsigned                    bResizePropAllowed : 1; // sal_False=Obj kann nichtmal proportional resized werden
338     unsigned                    bRotateFreeAllowed : 1; // sal_False=Obj kann nicht frei gedreht werden
339     unsigned                    bRotate90Allowed : 1;   // sal_False=Obj kann nichtmal im 90deg Raster gedreht werden
340     unsigned                    bMirrorFreeAllowed : 1; // sal_False=Obj kann nicht frei gespiegelt werden
341     unsigned                    bMirror45Allowed : 1;   // sal_False=Obj kann nichtmal ueber Achse im 45deg Raster gespiegelt werden
342     unsigned                    bMirror90Allowed : 1;   // sal_False=Obj kann ebenfalls nicht ueber Achse im 90deg Raster gespiegelt werden
343     unsigned                    bTransparenceAllowed : 1; // sal_False=Obj does not have an interactive transparence control
344     unsigned                    bGradientAllowed : 1; // sal_False=Obj dooes not have an interactive gradient control
345     unsigned                    bShearAllowed : 1;      // sal_False=Obj kann nicht verzerrt werden
346     unsigned                    bEdgeRadiusAllowed : 1;
347     unsigned                    bNoOrthoDesired : 1;    // sal_True bei Rect; ... sal_False bei BMP,MTF;
348     unsigned                    bNoContortion : 1;      // sal_False=Kein verzerren (bei Crook) moeglich (nur sal_True bei PathObj und Gruppierten PathObjs)
349     unsigned                    bCanConvToPath : 1;     // sal_False=Keine Konvertierung in PathObj moeglich
350     unsigned                    bCanConvToPoly : 1;     // sal_False=Keine Konvertierung in PolyObj moeglich
351     unsigned                    bCanConvToContour : 1;     // sal_False=no conversion down to whole contour possible
352     unsigned                    bCanConvToPathLineToArea : 1; // sal_False=Keine Konvertierung in PathObj moeglich mit Wandlung von LineToArea
353     unsigned                    bCanConvToPolyLineToArea : 1; // sal_False=Keine Konvertierung in PolyObj moeglich mit Wandlung von LineToArea
354 
355 public:
SdrObjTransformInfoRec()356     SdrObjTransformInfoRec()
357     :   bSelectAllowed(sal_True),
358         bMoveAllowed(sal_True),
359         bResizeFreeAllowed(sal_True),
360         bResizePropAllowed(sal_True),
361         bRotateFreeAllowed(sal_True),
362         bRotate90Allowed(sal_True),
363         bMirrorFreeAllowed(sal_True),
364         bMirror45Allowed(sal_True),
365         bMirror90Allowed(sal_True),
366         bTransparenceAllowed(sal_True),
367         bGradientAllowed(sal_True),
368         bShearAllowed(sal_True),
369         bEdgeRadiusAllowed(sal_True),
370         bNoOrthoDesired(sal_True),
371         bNoContortion(sal_True),
372         bCanConvToPath(sal_True),
373         bCanConvToPoly(sal_True),
374         bCanConvToContour(sal_False),
375         bCanConvToPathLineToArea(sal_True),
376         bCanConvToPolyLineToArea(sal_True)
377     {}
378 };
379 
380 ////////////////////////////////////////////////////////////////////////////////////////////////////
381 // To make things more safe, allow users of the object to register at it. The users need to be derived
382 // from SdrObjectUser to get a call. The users do not need to call RemoveObjectUser() at the object
383 // when they get called from PageInDestruction().
384 class SdrObject;
385 
386 class SdrObjectUser
387 {
388 public:
389     virtual void ObjectInDestruction(const SdrObject& rObject) = 0;
390 };
391 
392 // typedef for GetParentContacts()
393 typedef ::std::vector< SdrObjectUser* > ObjectUserVector;
394 
395 ////////////////////////////////////////////////////////////////////////////////////////////////////
396 ////////////////////////////////////////////////////////////////////////////////////////////////////
397 //
398 //   @@@@  @@@@@  @@@@@@ @@@@@  @@@@  @@@@@@
399 //  @@  @@ @@  @@     @@ @@    @@  @@   @@
400 //  @@  @@ @@  @@     @@ @@    @@       @@
401 //  @@  @@ @@@@@      @@ @@@@  @@       @@
402 //  @@  @@ @@  @@     @@ @@    @@       @@
403 //  @@  @@ @@  @@ @@  @@ @@    @@  @@   @@
404 //   @@@@  @@@@@   @@@@  @@@@@  @@@@    @@
405 //
406 // Abstraktes DrawObject
407 //
408 ////////////////////////////////////////////////////////////////////////////////////////////////////
409 
410 class SvxShape;
411 class SVX_DLLPUBLIC SdrObject: public SfxListener, public tools::WeakBase< SdrObject >
412 {
413 private:
414     // ObjectUser section
415     sdr::ObjectUserVector                                           maObjectUsers;
416 
417 public:
418     void AddObjectUser(sdr::ObjectUser& rNewUser);
419     void RemoveObjectUser(sdr::ObjectUser& rOldUser);
420 
421     // BaseProperties section
422 private:
423     sdr::properties::BaseProperties*                                mpProperties;
424 protected:
425     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
426 public:
427     virtual sdr::properties::BaseProperties& GetProperties() const;
428 
429     ///////////////////////////////////////////////////////////////////////////////
430     // #110094# DrawContact section
431 private:
432     sdr::contact::ViewContact*                                      mpViewContact;
433 protected:
434     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
435 public:
436     sdr::contact::ViewContact& GetViewContact() const;
437 
438     // DrawContact support: Methods for handling Object changes
439     void ActionChanged() const;
440 
441 private:
442     friend class                SdrObjListIter;
443     friend class                SdrVirtObj;
444     friend class                SdrRectObj;
445 
446 protected:
447     Rectangle                   aOutRect;     // umschliessendes Rechteck fuer Paint (inkl. LineWdt, ...)
448     Point                       aAnchor;      // Ankerposition (Writer)
449     SdrObjList*                 pObjList;     // Liste, in dem das Obj eingefuegt ist.
450     SdrPage*                    pPage;
451     SdrModel*                   pModel;
452     SdrObjUserCall*             pUserCall;
453     SdrObjPlusData*             pPlusData;    // Broadcaster, UserData, Konnektoren, ... (Das ist der Bitsack)
454 
455     sal_uInt32                  nOrdNum;      // Rangnummer des Obj in der Liste
456 
457     /** Position in the navigation order.  SAL_MAX_UINT32 when not used.
458     */
459     sal_uInt32                  mnNavigationPosition;
460     SdrLayerID                  mnLayerID;
461 
462     // Objekt zeigt nur auf ein Anderes
463     unsigned                    bVirtObj : 1;
464     unsigned                    bSnapRectDirty : 1;
465     unsigned                    bNetLock : 1;   // ni
466     unsigned                    bInserted : 1;  // nur wenn sal_True gibt's RepaintBroadcast & SetModify
467     unsigned                    bGrouped : 1;   // Member eines GroupObjektes?
468 
469     // Die folgende Flags werden gestreamt
470     unsigned                    bMovProt : 1; // If true, the position is protected
471     unsigned                    bSizProt : 1; // If true, the size is protected
472     unsigned                    bNoPrint : 1; // If true, the object is not printed.
473     unsigned                    mbVisible : 1; // If false, the object is not visible on screen (but maybe on printer, depending on bNoprint
474     // Wenn bEmptyPresObj sal_True ist, handelt es sich um ein
475     // Praesentationsobjekt, dem noch kein Inhalt zugewiesen
476     // wurde. Default ist das Flag auf FALSE. Die Verwaltung
477     // uebernimmt die Applikation. Im Zuweisungsoperator sowie
478     // beim Clone wird das Flag nicht mitkopiert!
479     // Das Flag ist persistent.
480     unsigned                    bEmptyPresObj : 1;     // Leeres Praesentationsobjekt (Draw)
481 
482     // sal_True=Objekt ist als Objekt der MasterPage nicht sichtbar
483     unsigned                    bNotVisibleAsMaster : 1;
484 
485     // sal_True=Es handelt sich hierbei um ein geschlossenes Objekt, also nicht Linie oder Kreisbogen ...
486     unsigned                    bClosedObj : 1;
487 
488     unsigned                    bIsEdge : 1;
489     unsigned                    bIs3DObj : 1;
490     unsigned                    bMarkProt : 1;  // Markieren verboten. Persistent
491     unsigned                    bIsUnoObj : 1;
492     unsigned                    bNotMasterCachable : 1;
493 
494     // #i25616#
495     unsigned                    mbLineIsOutsideGeometry : 1;
496 
497     // #i25616#
498     unsigned                    mbSupportTextIndentingOnLineWidthChange : 1;
499 
500     // on import of OLE object from MS documents the BLIP size might be retrieved,
501     // in this case the following member is initialized as nonempty rectangle
502     Rectangle                   maBLIPSizeRectangle;
503 
504     // global static ItemPool for not-yet-insetred items
505 private:
506     static SdrItemPool*         mpGlobalItemPool;
507 public:
508     static SdrItemPool& GetGlobalDrawObjectItemPool();
509 private:
510     SVX_DLLPRIVATE static void FreeGlobalDrawObjectItemPool();
511 
512 protected:
513     void ImpDeleteUserData();
514     SdrObjUserData* ImpGetMacroUserData() const;
515     Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
516 
517     // Fuer GetDragComment
518     void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, String& rStr, sal_uInt16 nVal=0) const;
519 
ImpForcePlusData()520     void ImpForcePlusData() { if (pPlusData==NULL) pPlusData=NewPlusData(); }
521 
522     String GetWinkStr(long nWink, FASTBOOL bNoDegChar=sal_False) const;
523     String GetMetrStr(long nVal, MapUnit eWantMap=MAP_MM, FASTBOOL bNoUnitChars=sal_False) const;
524 
525     // bNotMyself=sal_True bedeutet: Nur die ObjList auf Dirty setzen, nicht mich.
526     // Wird z.B. benoetigt fuer NbcMove, denn da movt man SnapRect und aOutRect
527     // i.d.R. gleich mit um die Neuberechnung zu sparen.
528 public:
529     virtual void SetRectsDirty(sal_Bool bNotMyself = sal_False);
530 protected:
531 
532     // ueberladen, wenn man sich von SdrObjPlusData abgeleitet hat:
533     virtual SdrObjPlusData* NewPlusData() const;
534 
535 protected:
536     // Diese 3 Methoden muss ein abgeleitetes Objekt ueberladen, wenn es eigene
537     // geometrische Daten besitzt, die fuer den Undo-Fall gesichert werden
538     // sollen. NewGeoData() erzeugt lediglich eine leere Instanz auf eine von
539     // SdrObjGeoData abgeleitete Klasse.
540     virtual SdrObjGeoData* NewGeoData() const;
541     virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
542     virtual void RestGeoData(const SdrObjGeoData& rGeo);
543 
544 protected:
545     virtual ~SdrObject();
546 
547 public:
548     TYPEINFO();
549     SdrObject();
550 
551     /** fres the SdrObject pointed to by the argument
552 
553         In case the object has an SvxShape, which has the ownership of the object, it
554         is actually *not* deleted.
555     */
556     static  void    Free( SdrObject*& _rpObject );
557 
558     // This method is only for access from Property objects
559     virtual void SetBoundRectDirty();
560 
561     virtual void SetObjList(SdrObjList* pNewObjList);
GetObjList() const562     SdrObjList* GetObjList() const { return pObjList; }
563 
564     virtual void SetPage(SdrPage* pNewPage);
GetPage() const565     SdrPage* GetPage() const { return pPage; }
566 
567     virtual void SetModel(SdrModel* pNewModel);
GetModel() const568     SdrModel* GetModel() const { return pModel; }
569     SdrItemPool* GetObjectItemPool() const;
570 
571     void AddListener(SfxListener& rListener);
572     void RemoveListener(SfxListener& rListener);
GetBroadcaster() const573     const SfxBroadcaster* GetBroadcaster() const { return pPlusData!=NULL ? pPlusData->pBroadcast : NULL; }
574 
575     virtual void AddReference(SdrVirtObj& rVrtObj);
576     virtual void DelReference(SdrVirtObj& rVrtObj);
577     virtual sal_uInt32 GetObjInventor() const;
578     virtual sal_uInt16 GetObjIdentifier() const;
579     virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
580 
581     // Layer interface
582     virtual SdrLayerID GetLayer() const;
583     virtual void NbcSetLayer(SdrLayerID nLayer);
584     virtual void SetLayer(SdrLayerID nLayer);
585     // renaming GetLayerSet -> getMergedHierarchyLayerSet to make clear what happens here. rSet needs to be empty.
586     virtual void getMergedHierarchyLayerSet(SetOfByte& rSet) const;
587 
588     // UserCall interface
SetUserCall(SdrObjUserCall * pUser)589     void SetUserCall(SdrObjUserCall* pUser) { pUserCall=pUser; }
GetUserCall() const590     SdrObjUserCall* GetUserCall() const { return pUserCall; }
591     void SendUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect) const;
592 
593     // Ein solcher Referenzpunkt ist z.B. der Punkt eines Symbols, der
594     // der beim Einfuegen des Symbols auf das Raster gefangen werden soll
595     // oder der Fixpunkt eines Bildes innerhalb eines Animationsobjektes.
596     virtual FASTBOOL HasRefPoint() const;
597     virtual Point GetRefPoint() const;
598     virtual void SetRefPoint(const Point& rPnt);
599 
600     // #i68101#
601     // An object may have a user-set Name (Get/SetName()), e.g SdrGrafObj, SdrObjGroup
602     // or SdrOle2Obj.
603     // It may also have a Title and a Description for accessibility purposes.
604     void SetName(const String& rStr);
605     String GetName() const;
606     void SetTitle(const String& rStr);
607     String GetTitle() const;
608     void SetDescription(const String& rStr);
609     String GetDescription() const;
610 
611     // support for HTMLName
612     void SetHTMLName(const String& rStr);
613     String GetHTMLName() const;
614 
615     // Fuer Gruppenobjekte
IsGroupObject() const616     sal_Bool IsGroupObject() const { return GetSubList()!=NULL; }
617     virtual SdrObjList* GetSubList() const;
618     SdrObject* GetUpGroup() const;
619 
620     // Ueber die Objekt-Ordnungsnummer kann man feststellen, ob ein Objekt vor
621     // oder hinter einem anderen liegt. Objekte mit kleinen Ordnungsnummern werden
622     // zuerst gezeichnet, Objekte mit grossen Ordnungsnummern zuletzt.
623     // Wird die Reihenfolge der Objekte in der Liste veraendert, so wird ein
624     // Dirty-Flag gesetzt (an der Page). Beim naechsten SdrObject::GetOrdNum()
625     // werden die Ordnungsnummer aller Objekte der Liste neu bestimmt.
626     sal_uInt32 GetOrdNum() const;
627 
628     // Diese Methode sollte nur verwendet werden, wenn man ganz  genau weiss,
629     // was man macht:
GetOrdNumDirect() const630     sal_uInt32 GetOrdNumDirect() const { return nOrdNum; }
631 
632     // Das Setzen der Ordnungsnummer sollte nur vom Model bzw. von der Page
633     // geschehen.
SetOrdNum(sal_uInt32 nNum)634     void SetOrdNum(sal_uInt32 nNum) { nOrdNum=nNum; }
635 
636     /** Return the position in the navigation order for the called object.
637         Note that this method may update the navigation position of the
638         called and of other SdrObjects.  Therefore this method can not be
639         const.
640         @return
641             If no navigation position has been explicitly defined then the
642             result of GetOrdNum() is returned.
643     */
644     sal_uInt32 GetNavigationPosition (void);
645 
646     /** Set the position in the navigation position to the given value.
647         This method is typically used only by the model after a change to
648         the navigation order.
649         This method does not change the navigation position of other
650         objects.
651         Use SdrObjList::SetObjectNavigationPosition() instead.
652     */
653     void SetNavigationPosition (const sal_uInt32 nPosition);
654 
GetAutoTimer() const655     const AutoTimer* GetAutoTimer() const { return pPlusData!=NULL ? pPlusData->pAutoTimer : NULL; }
GetAutoTimer()656     AutoTimer* GetAutoTimer() { return pPlusData!=NULL ? pPlusData->pAutoTimer : NULL; }
657     AutoTimer* ForceAutoTimer();
658 
659     // #111111#
660     // To make clearer that this method may trigger RecalcBoundRect and thus may be
661     // expensive and somtimes problematic (inside a bigger object change You will get
662     // non-useful BoundRects sometimes) i rename that method from GetBoundRect() to
663     // GetCurrentBoundRect().
664     virtual const Rectangle& GetCurrentBoundRect() const;
665 
666     // #111111#
667     // To have a possibility to get the last calculated BoundRect e.g for producing
668     // the first rectangle for repaints (old and new need to be used) without forcing
669     // a RecalcBoundRect (which may be problematical and expensive sometimes) i add here
670     // a new method for accessing the last BoundRect.
671     virtual const Rectangle& GetLastBoundRect() const;
672 
673     virtual void RecalcBoundRect();
674 
675     void BroadcastObjectChange() const;
676 
677     // Modified-Flag am Model setzen
678     virtual void SetChanged();
679 
680     // Tooling for painting a single object to a OutputDevice. This will be needed as long
681     // as not all painting is changed to use DrawContact objects.
682     sal_Bool SingleObjectPainter(OutputDevice& rOut) const;
683     sal_Bool LineGeometryUsageIsNecessary() const;
684 
685     // Clone() soll eine komplette Kopie des Objektes erzeugen.
686     virtual SdrObject* Clone() const;
687     virtual void operator=(const SdrObject& rObj);
688 
689     // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
690     virtual void TakeObjNameSingul(String& rName) const;
691     virtual void TakeObjNamePlural(String& rName) const;
692 
693     // Das Xor-Polygon wird von der View zu Draggen des Objektes benoetigt.
694     // Alle Polygone innerhalb des PolyPolygon werden als PolyLine interpretiert.
695     // Moechte man ein geschlossenes Polygon, so muss man es explizit schliessen.
696     virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
697 
698     // Die Kontur fuer TextToContour
699     virtual basegfx::B2DPolyPolygon TakeContour() const;
700 
701     // Ueber GetHdlCount gibt ein Objekt die Anzahl seiner Handles preis.
702     // Im Normalfall werden dies 8 sein, bei einer Strecke 2. Bei Polygonobjekten
703     // (Polygon,Spline,Bezier) kann die Handleanzahl wesentlich groesser werden.
704     // Polygonobjekten wird ausserdem die Moeglichkeit eingeraeumt einen Punkt
705     // eines selektierten Objekts zu selektieren. Das Handle dieses Punktes wird
706     // dann durch einen Satz neuer Handles ausgetauscht (PlusHdl). Bei einem
707     // Polygon wird das wohl ein einfacher Selektionshandle sein, bei einer
708     // Bezierkurve dagegen koennen das schon bis zu 3 Handles werden (inkl Gewichte).
709     // GetHdl() und GetPlusHdl() muessen Handleinstanzen mit new erzeugen!
710     // Ein Objekt, das bei HasSpacialDrag() sal_True liefert muss diese Methoden
711     // zur Verfuegung stellen (inkl. FillHdlList).
712     virtual sal_uInt32 GetHdlCount() const;
713     virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
714     virtual sal_uInt32 GetPlusHdlCount(const SdrHdl& rHdl) const;
715     virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const;
716     virtual void AddToHdlList(SdrHdlList& rHdlList) const;
717 
718     // Die Standardtransformationen (Move,Resize,Rotate,Mirror,Shear) werden von der
719     // View uebernommen (TakeXorPoly(),...).
720     // Objektspeziefisches draggen wie z.B. Eckenradius bei Rechtecken,
721     // Stuetzstellen bei Splines, Gewichte bei Bezierkurven und Pointer von
722     // Labelobjekten muss vom Objekt selbst gehandled werden. Um das Model
723     // Statusfrei zu halten werden die Statusdaten an der View gehalten und dem
724     // Objekt dann uebergeben. EndDrag liefrt im Normalfall sal_True fuer Erfolg.
725     // sal_False kann zurueckgegeben werden, wenn das Dragging das Objekt nicht
726     // veraendert hat, wobei dir evtl. Tatsache das die Maus nicht bewegt wurde
727     // bereits von der View abgefangen wird.
728     virtual bool hasSpecialDrag() const;
729     virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
730     virtual bool applySpecialDrag(SdrDragStat& rDrag);
731     virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
732     virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
733 
734     // FullDrag support. This is for standard interactions and for SdrObjOwn
735     // support. If supportsFullDrag() returns true, getFullDragClone has to
736     // return a cloned SdrObject (who's ownership it loses) at which modifications
737     // like Move(), Scale(), etc or applySpecialDrag() will be executed. That
738     // object will be visualized on overlay for full drag, but should not be
739     // part of the model, thus not changing anything since it's only a temporary
740     // helper object for interaction
741     virtual bool supportsFullDrag() const;
742     virtual SdrObject* getFullDragClone() const;
743 
744     // Jedes Objekt muss in der Lage sein sich selbst interaktiv zu erzeugen.
745     // Beim MausDown wird zunaechst ein neues Objekt erzeugt und dann seine
746     // BegCreate()-Methode gerufen. Bei jedem MausMode wird dann MovCreate
747     // gerufen. BrkCreate() bedeutet, dass der User die interaktive Objekt-
748     // erzeugung abgebrochen hat. EndCreate() wird gerufen beim MouseUp-Event.
749     // Liefert EndCreate() ein sal_True, so ist die Objekterzeugung abgeschlossen;
750     // das Objekt wird in die entsprechende Liste eingefuegt. Andernfalls
751     // (EndCreate()==sal_False) gehe ich davon aus, dass weitere Punkte zur
752     // Objekterzeugung notwendig sind (Polygon,...). Der Parameter eCmd
753     // enthaelt die Anzahl der Mausklicks (so die App diese durchreicht).
754     // BckCreate() -> Letztes EndCreate() rueckgaengig machen (z.B. letzten
755     // Polygonpunkt wieder loeschen).
756     // RetrunCode: sal_True=Weiter gehts, sal_False=Create dadurch abgebrochen.
757     virtual FASTBOOL BegCreate(SdrDragStat& rStat);
758     virtual FASTBOOL MovCreate(SdrDragStat& rStat); // sal_True=Xor muss repainted werden
759     virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
760     virtual FASTBOOL BckCreate(SdrDragStat& rStat);
761     virtual void BrkCreate(SdrDragStat& rStat);
762 
763     // damit holt man sich den Pointer, der das Createn dieses Objekts symbolisiert
764     virtual Pointer GetCreatePointer() const;
765 
766     // Polygon das waehrend des Erzeugens aufgezogen wird
767     virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
768 
769     // Die Methoden Move, Resize, Rotate, Mirror, Shear, SetSnapRect und
770     // SetLogicRect rufen jeweils die entsprechenden Nbc-Methoden, versenden einen
771     // Repaint-Broadcast und setzen den Modified-Status am Model. Abgeleitete
772     // Objekte sollten i.d.R. nur die Nbc-Methoden ueberladen.
773     // Nbc bedeutet: 'NoBroadcast'.
774     virtual void NbcMove  (const Size& rSiz);
775     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
776     virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
777     virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
778     virtual void NbcShear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
779 
780     virtual void Move  (const Size& rSiz);
781     virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
782     virtual void Rotate(const Point& rRef, long nWink, double sn, double cs);
783     virtual void Mirror(const Point& rRef1, const Point& rRef2);
784     virtual void Shear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
785 
786     // Die relative Position eines Zeichenobjektes ist die Entfernung der
787     // linken oberen Eche des logisch umschliessenden Rechtecks (SnapRect)
788     // zum Anker.
789     virtual void NbcSetRelativePos(const Point& rPnt);
790     virtual void SetRelativePos(const Point& rPnt);
791     virtual Point GetRelativePos() const;
ImpSetAnchorPos(const Point & rPnt)792     void ImpSetAnchorPos(const Point& rPnt) { aAnchor=rPnt; }
793     virtual void NbcSetAnchorPos(const Point& rPnt);
794     virtual void SetAnchorPos(const Point& rPnt);
795     virtual const Point& GetAnchorPos() const;
796 
797     // Snap wird nicht auf dem BoundRect ausgefuehrt, sondern nach Moeglichkeit auf
798     // logischen Koordinaten (also ohne Beruecksichtigung von Strichstaerke, ... ).
799     // SetSnapRect() versucht das Objekt so hinzusizen, dass es in das uebergebene
800     // Rect passt (ohne Strichstaerke, ...)
801     virtual void RecalcSnapRect();
802     virtual const Rectangle& GetSnapRect() const;
803     virtual void SetSnapRect(const Rectangle& rRect);
804     virtual void NbcSetSnapRect(const Rectangle& rRect);
805 
806     // Logic Rect: Beim Rect z.B. ohne Beruecksichtigung des Drehwinkels, Shear, ...
807     virtual const Rectangle& GetLogicRect() const;
808     virtual void SetLogicRect(const Rectangle& rRect);
809     virtual void NbcSetLogicRect(const Rectangle& rRect);
810 
811     /** the defaul is to set the logic rect to the given rectangle rMaxRect. If the shape
812         has an intrinsic aspect ratio it may set the logic rect so the aspect
813         ratio is kept but still inside the rectangle rMaxRect.
814 
815         If bShrinkOnly is set to true, the size of the current logic rect will not
816         be changed if it is smaller than the given rectangle rMaxRect. */
817     virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false );
818 
819     // Drehwinkel und Shear
820     virtual long GetRotateAngle() const;
821     virtual long GetShearAngle(FASTBOOL bVertical=sal_False) const;
822 
823     // Zum Fangen von/auf ausgezeichneten Punkten eines Obj (Polygonpunkte,
824     // Kreismittelpunkt, ...)
825     virtual sal_uInt32 GetSnapPointCount() const;
826     virtual Point GetSnapPoint(sal_uInt32 i) const;
827 
828     // Fuer Objekte, bei denen jeder einzelne Punkt verschoben werden kann,
829     // z.B. Polygone, Polylines, Linien, ... . Bei diesen Objekten werden
830     // Punkte selektiert (ggf. Mehrfachselektion), geloescht, eingefuegt,
831     // als Mehrfachselektion verschoben und gedreht, ...
832     // Nur solche Objekte koennen PlusHandles haben (z.B. die Gewichte an den
833     // Bezierkurven.
834     virtual sal_Bool IsPolyObj() const;
835     virtual sal_uInt32 GetPointCount() const;
836     virtual Point GetPoint(sal_uInt32 i) const;
837     void SetPoint(const Point& rPnt, sal_uInt32 i);
838     virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
839 
840     // Alle geometrischen Daten holen fuer's Undo/Redo
841     virtual SdrObjGeoData* GetGeoData() const;
842     virtual void SetGeoData(const SdrObjGeoData& rGeo);
843 
844     // ItemSet access
845     const SfxItemSet& GetMergedItemSet() const;
846     void SetMergedItem(const SfxPoolItem& rItem);
847     void ClearMergedItem(const sal_uInt16 nWhich = 0);
848     void SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False);
849     const SfxPoolItem& GetMergedItem(const sal_uInt16 nWhich) const;
850 
851     // internal versions
852 protected:
853     const SfxItemSet& GetObjectItemSet() const;
854     void SetObjectItem(const SfxPoolItem& rItem);
855     void ClearObjectItem(const sal_uInt16 nWhich = 0);
856     void SetObjectItemSet(const SfxItemSet& rSet);
857     const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const;
858 
859     // get SfxMapUnit the object is using
860     SfxMapUnit GetObjectMapUnit() const;
861 
862 public:
863     // syntactical sugar for ItemSet accesses
864     void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False);
865 
866     // NotPersistAttr fuer Layer, ObjName, geometrische Transformationen, ...
867     void TakeNotPersistAttr(SfxItemSet& rAttr, FASTBOOL bMerge) const;
868     void ApplyNotPersistAttr(const SfxItemSet& rAttr);
869     void NbcApplyNotPersistAttr(const SfxItemSet& rAttr);
870 
871     // bDontRemoveHardAttr=FALSE: alle in der Vorlage gesetzten Attribute werden am
872     // Zeichenobjekt auf Default gesetzt; TRUE: alle harten Attribute bleiben erhalten.
873     void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
874     virtual void NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
875     SfxStyleSheet* GetStyleSheet() const;
876 
877     // TextEdit
878     virtual FASTBOOL HasTextEdit() const;
879 
880     // Return==TRUE: TextEditMode gestartet
881     virtual sal_Bool BegTextEdit(SdrOutliner& rOutl);
882     virtual void EndTextEdit(SdrOutliner& rOutl);
883 
884     // Text wird im Format des Outliners gehalten
885     // SetOutlinerParaObject: Eigentumsuebereignung von *pTextObject!
886     virtual void SetOutlinerParaObject(OutlinerParaObject* pTextObject);
887     virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
888     virtual OutlinerParaObject* GetOutlinerParaObject() const;
889     virtual void NbcReformatText();
890     virtual void ReformatText();
891 
892     void BurnInStyleSheetAttributes();
893 
894     // Macrofaehigkeit, z.B. ein Rechteck als PushButton.
895     virtual FASTBOOL HasMacro() const;
896     virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const;
897     virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec) const;
898     virtual void PaintMacro (OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const;
899     virtual FASTBOOL DoMacro (const SdrObjMacroHitRec& rRec);
900     virtual XubString GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const;
IsMacroHit(const SdrObjMacroHitRec & rRec) const901     sal_Bool IsMacroHit(const SdrObjMacroHitRec& rRec) const { return CheckMacroHit(rRec)!=NULL; }
902 
903     // Konnektoren. (siehe auch Dokumentation in SvdoEdge.HXX, SdrEdgeObj
904     //               sowie SvdGlue.HXX und SvdGlEV.HXX)
905     // Es gibt Knoten und Kanten. Eine Kante kann theoretisch auch Knoten
906     // sein, das ist jedoch in dieser Version noch nicht implementiert.
907     // Ein Knoten hat eine Anzahl von Klebepunkten, wo Kanten angeklebt
908     // werden koennen.
909     // Eine Kante kann
910     // - ohne Verbindungen sein
911     // - an einem Ende auf der Wiese stehen und am anderen Ende an
912     //   genau einem Knoten gebunden sein
913     // - an beiden Enden mit jeweils genau einem Knoten verbunden sein.
914     // Die Kante ist Listener bei seinen bis zu 2 Knoten.
915     // Wird der Knoten verschoben oder Resized, folgen alle angebundenen
916     // Kanten. Ebenso bei SetGluePoint()... am Knoten.
917     // Beim Verschieben/Resizen der Kante wird dagegen die Verbindung
918     // geloesst.
919     // Objekt ist ein Knoten?
920     virtual FASTBOOL IsNode() const;
921 
922     // Automatische Klebepunkte:
923     // je 4 Scheitelpunkt- und Eckpositionen muss ein Knotenobjekt liefern
924     // i.d.R. 0=oben, 1=rechts, 2=unten, 3=links
925     virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
926 
927     // i.d.R. 0=linksoben, 1=rechtsoben, 2=rechtsunten, 3=linksunten
928     virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
929 
930     // Liste aller Klebepunkte. Kann NULL sein.
931     virtual const SdrGluePointList* GetGluePointList() const;
932     //virtual SdrGluePointList* GetGluePointList();
933 
934     // Nach veraendern der GluePointList muss man am Obj SendRepaintBroadcast rufen!
935     virtual SdrGluePointList* ForceGluePointList();
936 
937     // Temporaer zu setzen fuer Transformationen am Bezugsobjekt
938     void SetGlueReallyAbsolute(FASTBOOL bOn);
939     void NbcRotateGluePoints(const Point& rRef, long nWink, double sn, double cs);
940     void NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2);
941     void NbcShearGluePoints (const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
942 
943     // Objekt ist eine Kante?
944     virtual FASTBOOL IsEdge() const;
945 
946     // bTail1=TRUE: Linienanfang, sonst LinienEnde
947     // pObj=NULL: Disconnect
948     virtual void ConnectToNode(FASTBOOL bTail1, SdrObject* pObj);
949     virtual void DisconnectFromNode(FASTBOOL bTail1);
950     virtual SdrObject* GetConnectedNode(FASTBOOL bTail1) const;
951 
952     /** sets the writing mode of the object's context
953 
954         Objects which itself do not support different writing modes will ignore this call.
955 
956         Objects which support different writing modes, but have an own, explicit writing mode set,
957         will also ignore this call.
958 
959         Objects which support different writing modes, and whose own mode is set to css.text.WritingMode2.CONTEXT,
960         will use the given writing mode to calculate their "effective writing mode".
961 
962         The behaviour of this method is undefined if you pass css.text.WritingMode2.CONTEXT.
963 
964         @param _nContextWritingMode
965             the effective writing mode of the context of the object
966     */
967     virtual void    SetContextWritingMode( const sal_Int16 _nContextWritingMode );
968 
969     // Wenn ein Objekt in der Lage ist, sich in ein Polygon oder in eine
970     // Bezierkurve (oder beides) zu verwandeln, dann sollten die folgenden
971     // Methoden ueberladen werden.
972     // Z.B. Ein RectObj mit Strichstaerke 10, SOLID_PEN in Polygon wandeln:
973     // Im Modus bLineToArea=sal_False soll ein PolyObj mit 4 Stuetzstellen,
974     // Strichstaerke 10 und SOLiD_PEN erzeugt werden.
975     // Im Modus bLineToArea=sal_True dagegen soll das generierte Obj immer ein
976     // LinienAttribut NULL_PEN haben, und die Linie (auch Linienmuster) selbst
977     // durch Polygonflaechen emuliert werden, die dadurch anschliessend vom
978     // Anwender manipuliert werden koennen. Das RectObj kann sich somit also
979     // nur korrekt konvertieren, wenn es als Flaechenattribut NULL_BRUSH
980     // besitzt. Es muesste in diesem Fall dann:
981     // - SOLID_BRUSH mit der Farbe des gesetzten Pen setzen
982     // - NULL_PEN setzen
983     // - PolyPolygon mit 2 Polygonen zu je 4 Stuetzstellen generieren.
984     // Der Returnwert ist jeweils ein SdrObject*, da als Rueckgabe zur Not
985     // auch Gruppenobjekte erlaubt sind (z.B. fuer SdrTextObj).
986     // Bei der Konvertierung von TextObj nach PathObj wird es wohl so sein,
987     // dass beide Modi (bLineToArea=sal_True/sal_False) identisch sind.
988     // Defaulted sind diese Methoden auf "Ich kann das nicht" (FALSE/NULL).
989     virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
990     SdrObject* ConvertToPolyObj(sal_Bool bBezier, sal_Bool bLineToArea) const;
991 
992     // convert this path object to contour object; bForceLineDash converts even
993     // when there is no filled new polygon created from line-to-polygon conversion,
994     // specially used for XLINE_DASH and 3D conversion
995     SdrObject* ConvertToContourObj(SdrObject* pRet, sal_Bool bForceLineDash = sal_False) const;
996     SdrObject* ImpConvertToContourObj(SdrObject* pRet, sal_Bool bForceLineDash = sal_False) const;
997 
998     // TRUE: Referenz auf ein Obj
IsVirtualObj() const999     sal_Bool IsVirtualObj() const { return bVirtObj; }
1000 
1001     // sal_True=Obj kann warsch. gefuellt werden; sal_False=Obj kann warsch. Linienenden haben.
1002     // ungueltig, wenn es sich um ein GroupObj handelt.
IsClosedObj() const1003     sal_Bool IsClosedObj() const { return bClosedObj; }
1004 
IsEdgeObj() const1005     sal_Bool IsEdgeObj() const { return bIsEdge; }
Is3DObj() const1006     sal_Bool Is3DObj() const { return bIs3DObj; }
IsUnoObj() const1007     sal_Bool IsUnoObj() const { return bIsUnoObj; }
IsMasterCachable() const1008     sal_Bool IsMasterCachable() const { return !bNotMasterCachable; }
ShareLock()1009     sal_Bool ShareLock() { sal_Bool r=!bNetLock; bNetLock=sal_True; return r; }
ShareUnlock()1010     void ShareUnlock() { bNetLock=sal_False; }
IsShareLock() const1011     sal_Bool IsShareLock() const { return bNetLock; }
SetMarkProtect(sal_Bool bProt)1012     void SetMarkProtect(sal_Bool bProt) { bMarkProt=bProt; }
IsMarkProtect() const1013     sal_Bool IsMarkProtect() const { return bMarkProt; }
1014     void SetInserted(sal_Bool bIns);
IsInserted() const1015     sal_Bool IsInserted() const { return bInserted; }
SetGrouped(sal_Bool bGrp)1016     void SetGrouped(sal_Bool bGrp) { bGrouped=bGrp; }
IsGrouped() const1017     sal_Bool IsGrouped() const { return bGrouped; }
1018     void SetMoveProtect(sal_Bool bProt);
IsMoveProtect() const1019     sal_Bool IsMoveProtect() const { return bMovProt; }
1020     void SetResizeProtect(sal_Bool bProt);
IsResizeProtect() const1021     sal_Bool IsResizeProtect() const { return bSizProt; }
1022     void SetPrintable(sal_Bool bPrn);
IsPrintable() const1023     sal_Bool IsPrintable() const { return !bNoPrint; }
1024     void SetVisible(sal_Bool bVisible);
IsVisible() const1025     sal_Bool IsVisible() const { return mbVisible; }
SetEmptyPresObj(sal_Bool bEpt)1026     void SetEmptyPresObj(sal_Bool bEpt) { bEmptyPresObj=bEpt; }
IsEmptyPresObj() const1027     sal_Bool IsEmptyPresObj() const { return bEmptyPresObj; }
SetNotVisibleAsMaster(sal_Bool bFlg)1028     void SetNotVisibleAsMaster(sal_Bool bFlg) { bNotVisibleAsMaster=bFlg; }
IsNotVisibleAsMaster() const1029     sal_Bool IsNotVisibleAsMaster() const { return bNotVisibleAsMaster; }
1030 
1031     // #i25616#
LineIsOutsideGeometry() const1032     sal_Bool LineIsOutsideGeometry() const { return mbLineIsOutsideGeometry; }
1033 
1034     // #i25616#
DoesSupportTextIndentingOnLineWidthChange() const1035     sal_Bool DoesSupportTextIndentingOnLineWidthChange() const { return mbSupportTextIndentingOnLineWidthChange; }
1036 
1037     // applikationsspeziefische Daten
1038     sal_uInt16 GetUserDataCount() const;
1039     SdrObjUserData* GetUserData(sal_uInt16 nNum) const;
1040 
1041     // Insert uebernimmt den auf dem Heap angelegten Record in den Besitz
1042     // des Zeichenobjekts
1043     void InsertUserData(SdrObjUserData* pData, sal_uInt16 nPos=0xFFFF);
1044 
1045     // Delete entfernt den Record aus der Liste und ruft
1046     // ein delete (FreeMem+Dtor).
1047     void DeleteUserData(sal_uInt16 nNum);
1048 
1049     // ItemPool fuer dieses Objekt wechseln
1050     void MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel = 0L);
1051 
1052     ////////////////////////////////////////////////////////////////////////////////////////////////////
1053     // access to the UNO representation of the shape
1054     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape();
getWeakUnoShape() const1055     ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > getWeakUnoShape() const { return maWeakUnoShape; }
1056 
1057     static SdrObject* getSdrObjectFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt );
1058 
1059     // helper struct for granting access exclusive to SvxShape
1060     struct GrantXShapeAccess
1061     {
1062         friend class SvxShape;
1063     private:
GrantXShapeAccessSdrObject::GrantXShapeAccess1064         GrantXShapeAccess() { }
1065     };
1066 
1067     // setting the UNO representation is allowed for the UNO representation itself only!
setUnoShape(const::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface> & _rxUnoShape,GrantXShapeAccess)1068     void setUnoShape(
1069             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxUnoShape,
1070             GrantXShapeAccess /*aGrant*/
1071         )
1072     {
1073         impl_setUnoShape( _rxUnoShape );
1074     }
1075 
1076     /** retrieves the instance responsible for notifying changes in the properties of the shape associated with
1077         the SdrObject
1078 
1079         @precond
1080             There already exists an SvxShape instance associated with the SdrObject
1081         @throws ::com::sun::star::uno::RuntimeException
1082             if there does nt yet exists an SvxShape instance associated with the SdrObject.
1083     */
1084     ::svx::PropertyChangeNotifier&
1085         getShapePropertyChangeNotifier();
1086 
1087     /** notifies a change in the given property, to all applicable listeners registered at the associated SvxShape
1088 
1089         This method is equivalent to calling getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty ),
1090         exception that it is allowed to be called when there does not yet exist an associated SvxShape - in which
1091         case the method will silently return without doing anything.
1092     */
1093     void    notifyShapePropertyChange( const ::svx::ShapeProperty _eProperty ) const;
1094 
1095     ////////////////////////////////////////////////////////////////////////////////////////////////////
1096     //
1097     // transformation interface for StarOfficeAPI. This implements support for
1098     // homogen 3x3 matrices containing the transformation of the SdrObject. At the
1099     // moment it contains a shearX, rotation and translation, but for setting all linear
1100     // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
1101     //
1102     // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
1103     // with the base geometry and returns TRUE. Otherwise it returns FALSE.
1104     virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
1105 
1106     // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
1107     // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
1108     // to use (0,0) as upper left and will be scaled to the given size in the matrix.
1109     virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
1110 
1111     sal_Bool IsTransparent( sal_Bool bCheckForAlphaChannel = sal_False ) const;
1112 
1113     // #116168#
1114     // Give info if object is in destruction
1115     sal_Bool IsInDestruction() const;
1116 
1117     // return if fill is != XFILL_NONE
1118     bool HasFillStyle() const;
1119     bool HasLineStyle() const;
1120 
1121     // on import of OLE object from MS documents the BLIP size might be retrieved,
1122     // the following methods are used to control it;
1123     // usually this data makes no sence after the import is finished, since the object
1124     // might be resized
1125     Rectangle GetBLIPSizeRectangle() const;
1126     void SetBLIPSizeRectangle( const Rectangle& aRect );
1127 
1128     // #121917#
1129     virtual bool HasText() const;
1130 
1131 protected:
1132     void    impl_setUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxUnoShape );
1133 
1134 private:
1135     /** only for internal use!
1136     */
1137     SvxShape* getSvxShape();
1138 
1139     /** do not use directly, always use getSvxShape() if you have to! */
1140     SvxShape*   mpSvxShape;
1141     ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >
1142                 maWeakUnoShape;
1143 };
1144 
1145 //************************************************************
1146 //   SdrDummyObj
1147 //
1148 // Wer sich eigene Objekte schafft muss einen Link in der Klasse
1149 // SdrObjFactory setzen. Der Handler hat folgendes aussehen:
1150 //    void Hdl(SdrObjFactory*)
1151 // Er muss sich aus der uebergebenen Instanz die Werte nInventor und
1152 // nIdentifier ansehen und entsprechend mit new eine Zeichenobjektinstanz
1153 // erzeugen. Einen Zeiger auf diese Instanz hat er in der Membervariablen
1154 // pNewObj zu hinterlassen.
1155 //
1156 //************************************************************
1157 
1158 class SVX_DLLPUBLIC SdrObjFactory
1159 {
1160 public:
1161     sal_uInt32                      nInventor;
1162     sal_uInt16                      nIdentifier;
1163 
1164     // fuer MakeNewObj():
1165     SdrPage*                    pPage;
1166     SdrModel*                   pModel;
1167     SdrObject*                  pNewObj;
1168 
1169     // fuer MakeNewObjUserData():
1170     SdrObject*                  pObj;
1171     SdrObjUserData*             pNewData;
1172 
1173 private:
1174     SVX_DLLPRIVATE SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pNewPage, SdrModel* pNewModel);
1175     SVX_DLLPRIVATE SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj1);
1176 
1177 public:
1178     static SdrObject* MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pPage, SdrModel* pModel=NULL);
1179     static void InsertMakeObjectHdl(const Link& rLink);
1180     static void RemoveMakeObjectHdl(const Link& rLink);
1181     static SdrObjUserData* MakeNewObjUserData(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj);
1182     static void InsertMakeUserDataHdl(const Link& rLink);
1183     static void RemoveMakeUserDataHdl(const Link& rLink);
1184 };
1185 
1186 typedef tools::WeakReference< SdrObject > SdrObjectWeakRef;
1187 
1188 #endif //_SVDOBJ_HXX
1189 
1190