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> // for SdrLayerID 35 #include <svx/svdglue.hxx> // gluepoints 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); // not implemented 214 SVX_DLLPRIVATE sal_Bool operator==(const SdrObjUserData& rData) const; // not implemented 215 SVX_DLLPRIVATE sal_Bool operator!=(const SdrObjUserData& rData) const; // not implemented 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 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; // applikationsspezifische 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 does 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 // Abstraktes DrawObject 399 // 400 //////////////////////////////////////////////////////////////////////////////////////////////////// 401 402 class SvxShape; 403 class SVX_DLLPUBLIC SdrObject: public SfxListener, public tools::WeakBase< SdrObject > 404 { 405 private: 406 // ObjectUser section 407 sdr::ObjectUserVector maObjectUsers; 408 409 public: 410 void AddObjectUser(sdr::ObjectUser& rNewUser); 411 void RemoveObjectUser(sdr::ObjectUser& rOldUser); 412 413 // BaseProperties section 414 private: 415 sdr::properties::BaseProperties* mpProperties; 416 protected: 417 virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); 418 public: 419 virtual sdr::properties::BaseProperties& GetProperties() const; 420 421 /////////////////////////////////////////////////////////////////////////////// 422 // #110094# DrawContact section 423 private: 424 sdr::contact::ViewContact* mpViewContact; 425 protected: 426 virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); 427 public: 428 sdr::contact::ViewContact& GetViewContact() const; 429 430 // DrawContact support: Methods for handling Object changes 431 void ActionChanged() const; 432 433 private: 434 friend class SdrObjListIter; 435 friend class SdrVirtObj; 436 friend class SdrRectObj; 437 438 protected: 439 Rectangle aOutRect; // umschliessendes Rechteck fuer Paint (inkl. LineWdt, ...) 440 Point aAnchor; // Ankerposition (Writer) 441 SdrObjList* pObjList; // Liste, in dem das Obj eingefuegt ist. 442 SdrPage* pPage; 443 SdrModel* pModel; 444 SdrObjUserCall* pUserCall; 445 SdrObjPlusData* pPlusData; // Broadcaster, UserData, Konnektoren, ... (Das ist der Bitsack) 446 447 sal_uInt32 nOrdNum; // Rangnummer des Obj in der Liste 448 449 /** Position in the navigation order. SAL_MAX_UINT32 when not used. 450 */ 451 sal_uInt32 mnNavigationPosition; 452 SdrLayerID mnLayerID; 453 454 // Objekt zeigt nur auf ein Anderes 455 unsigned bVirtObj : 1; 456 unsigned bSnapRectDirty : 1; 457 unsigned bNetLock : 1; // ni 458 unsigned bInserted : 1; // nur wenn sal_True gibt es RepaintBroadcast & SetModify 459 unsigned bGrouped : 1; // Member eines GroupObjektes? 460 461 // Die folgende Flags werden gestreamt 462 unsigned bMovProt : 1; // If true, the position is protected 463 unsigned bSizProt : 1; // If true, the size is protected 464 unsigned bNoPrint : 1; // If true, the object is not printed. 465 unsigned mbVisible : 1; // If false, the object is not visible on screen (but maybe on printer, depending on bNoprint 466 // Wenn bEmptyPresObj sal_True ist, handelt es sich um ein 467 // Praesentationsobjekt, dem noch kein Inhalt zugewiesen 468 // wurde. Default ist das Flag auf FALSE. Die Verwaltung 469 // uebernimmt die Applikation. Im Zuweisungsoperator sowie 470 // beim Clone wird das Flag nicht mitkopiert! 471 // Das Flag ist persistent. 472 unsigned bEmptyPresObj : 1; // Leeres Praesentationsobjekt (Draw) 473 474 // sal_True=Objekt ist als Objekt der MasterPage nicht sichtbar 475 unsigned bNotVisibleAsMaster : 1; 476 477 // sal_True=Es handelt sich hierbei um ein geschlossenes Objekt, also nicht Linie oder Kreisbogen ... 478 unsigned bClosedObj : 1; 479 480 unsigned bIsEdge : 1; 481 unsigned bIs3DObj : 1; 482 unsigned bMarkProt : 1; // Markieren verboten. Persistent 483 unsigned bIsUnoObj : 1; 484 unsigned bNotMasterCachable : 1; 485 486 // #i25616# 487 unsigned mbLineIsOutsideGeometry : 1; 488 489 // #i25616# 490 unsigned mbSupportTextIndentingOnLineWidthChange : 1; 491 492 // on import of OLE object from MS documents the BLIP size might be retrieved, 493 // in this case the following member is initialized as nonempty rectangle 494 Rectangle maBLIPSizeRectangle; 495 496 // global static ItemPool for not-yet-inserted items 497 private: 498 static SdrItemPool* mpGlobalItemPool; 499 public: 500 static SdrItemPool& GetGlobalDrawObjectItemPool(); 501 private: 502 SVX_DLLPRIVATE static void FreeGlobalDrawObjectItemPool(); 503 504 protected: 505 void ImpDeleteUserData(); 506 SdrObjUserData* ImpGetMacroUserData() const; 507 Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const; 508 509 // Fuer GetDragComment 510 void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, String& rStr, sal_uInt16 nVal=0) const; 511 ImpForcePlusData()512 void ImpForcePlusData() { if (pPlusData==NULL) pPlusData=NewPlusData(); } 513 514 String GetWinkStr(long nWink, FASTBOOL bNoDegChar=sal_False) const; 515 String GetMetrStr(long nVal, MapUnit eWantMap=MAP_MM, FASTBOOL bNoUnitChars=sal_False) const; 516 517 // bNotMyself=sal_True bedeutet: Nur die ObjList auf Dirty setzen, nicht mich. 518 // Wird z.B. benoetigt fuer NbcMove, denn da moved man SnapRect und aOutRect 519 // i.d.R. gleich mit um die Neuberechnung zu sparen. 520 public: 521 virtual void SetRectsDirty(sal_Bool bNotMyself = sal_False); 522 protected: 523 524 // ueberladen, wenn man sich von SdrObjPlusData abgeleitet hat: 525 virtual SdrObjPlusData* NewPlusData() const; 526 527 protected: 528 // Diese 3 Methoden muss ein abgeleitetes Objekt ueberladen, wenn es eigene 529 // geometrische Daten besitzt, die fuer den Undo-Fall gesichert werden 530 // sollen. NewGeoData() erzeugt lediglich eine leere Instanz auf eine von 531 // SdrObjGeoData abgeleitete Klasse. 532 virtual SdrObjGeoData* NewGeoData() const; 533 virtual void SaveGeoData(SdrObjGeoData& rGeo) const; 534 virtual void RestGeoData(const SdrObjGeoData& rGeo); 535 536 protected: 537 virtual ~SdrObject(); 538 539 public: 540 TYPEINFO(); 541 SdrObject(); 542 543 /** frees the SdrObject pointed to by the argument 544 545 In case the object has an SvxShape, which has the ownership of the object, it 546 is actually *not* deleted. 547 */ 548 static void Free( SdrObject*& _rpObject ); 549 550 // This method is only for access from Property objects 551 virtual void SetBoundRectDirty(); 552 553 virtual void SetObjList(SdrObjList* pNewObjList); GetObjList() const554 SdrObjList* GetObjList() const { return pObjList; } 555 556 virtual void SetPage(SdrPage* pNewPage); GetPage() const557 SdrPage* GetPage() const { return pPage; } 558 559 virtual void SetModel(SdrModel* pNewModel); GetModel() const560 SdrModel* GetModel() const { return pModel; } 561 SdrItemPool* GetObjectItemPool() const; 562 563 void AddListener(SfxListener& rListener); 564 void RemoveListener(SfxListener& rListener); GetBroadcaster() const565 const SfxBroadcaster* GetBroadcaster() const { return pPlusData!=NULL ? pPlusData->pBroadcast : NULL; } 566 567 virtual void AddReference(SdrVirtObj& rVrtObj); 568 virtual void DelReference(SdrVirtObj& rVrtObj); 569 virtual sal_uInt32 GetObjInventor() const; 570 virtual sal_uInt16 GetObjIdentifier() const; 571 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; 572 573 // Layer interface 574 virtual SdrLayerID GetLayer() const; 575 virtual void NbcSetLayer(SdrLayerID nLayer); 576 virtual void SetLayer(SdrLayerID nLayer); 577 // renaming GetLayerSet -> getMergedHierarchyLayerSet to make clear what happens here. rSet needs to be empty. 578 virtual void getMergedHierarchyLayerSet(SetOfByte& rSet) const; 579 580 // UserCall interface SetUserCall(SdrObjUserCall * pUser)581 void SetUserCall(SdrObjUserCall* pUser) { pUserCall=pUser; } GetUserCall() const582 SdrObjUserCall* GetUserCall() const { return pUserCall; } 583 void SendUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect) const; 584 585 // Ein solcher Referenzpunkt ist z.B. der Punkt eines Symbols, der 586 // der beim Einfuegen des Symbols auf das Raster gefangen werden soll 587 // oder der Fixpunkt eines Bildes innerhalb eines Animationsobjektes. 588 virtual FASTBOOL HasRefPoint() const; 589 virtual Point GetRefPoint() const; 590 virtual void SetRefPoint(const Point& rPnt); 591 592 // #i68101# 593 // An object may have a user-set Name (Get/SetName()), e.g SdrGrafObj, SdrObjGroup 594 // or SdrOle2Obj. 595 // It may also have a Title and a Description for accessibility purposes. 596 void SetName(const String& rStr); 597 String GetName() const; 598 void SetTitle(const String& rStr); 599 String GetTitle() const; 600 void SetDescription(const String& rStr); 601 String GetDescription() const; 602 603 // support for HTMLName 604 void SetHTMLName(const String& rStr); 605 String GetHTMLName() const; 606 607 // Fuer Gruppenobjekte IsGroupObject() const608 sal_Bool IsGroupObject() const { return GetSubList()!=NULL; } 609 virtual SdrObjList* GetSubList() const; 610 SdrObject* GetUpGroup() const; 611 612 // Ueber die Objekt-Ordnungsnummer kann man feststellen, ob ein Objekt vor 613 // oder hinter einem anderen liegt. Objekte mit kleinen Ordnungsnummern werden 614 // zuerst gezeichnet, Objekte mit grossen Ordnungsnummern zuletzt. 615 // Wird die Reihenfolge der Objekte in der Liste veraendert, so wird ein 616 // Dirty-Flag gesetzt (an der Page). Beim naechsten SdrObject::GetOrdNum() 617 // werden die Ordnungsnummer aller Objekte der Liste neu bestimmt. 618 sal_uInt32 GetOrdNum() const; 619 620 // Diese Methode sollte nur verwendet werden, wenn man ganz genau weiss, 621 // was man macht: GetOrdNumDirect() const622 sal_uInt32 GetOrdNumDirect() const { return nOrdNum; } 623 624 // Das Setzen der Ordnungsnummer sollte nur vom Model bzw. von der Page 625 // geschehen. SetOrdNum(sal_uInt32 nNum)626 void SetOrdNum(sal_uInt32 nNum) { nOrdNum=nNum; } 627 628 /** Return the position in the navigation order for the called object. 629 Note that this method may update the navigation position of the 630 called and of other SdrObjects. Therefore this method can not be 631 const. 632 @return 633 If no navigation position has been explicitly defined then the 634 result of GetOrdNum() is returned. 635 */ 636 sal_uInt32 GetNavigationPosition (void); 637 638 /** Set the position in the navigation position to the given value. 639 This method is typically used only by the model after a change to 640 the navigation order. 641 This method does not change the navigation position of other 642 objects. 643 Use SdrObjList::SetObjectNavigationPosition() instead. 644 */ 645 void SetNavigationPosition (const sal_uInt32 nPosition); 646 GetAutoTimer() const647 const AutoTimer* GetAutoTimer() const { return pPlusData!=NULL ? pPlusData->pAutoTimer : NULL; } GetAutoTimer()648 AutoTimer* GetAutoTimer() { return pPlusData!=NULL ? pPlusData->pAutoTimer : NULL; } 649 AutoTimer* ForceAutoTimer(); 650 651 // #111111# 652 // To make clearer that this method may trigger RecalcBoundRect and thus may be 653 // expensive and sometimes problematic (inside a bigger object change You will get 654 // non-useful BoundRects sometimes) i rename that method from GetBoundRect() to 655 // GetCurrentBoundRect(). 656 virtual const Rectangle& GetCurrentBoundRect() const; 657 658 // #111111# 659 // To have a possibility to get the last calculated BoundRect e.g for producing 660 // the first rectangle for repaints (old and new need to be used) without forcing 661 // a RecalcBoundRect (which may be problematical and expensive sometimes) i add here 662 // a new method for accessing the last BoundRect. 663 virtual const Rectangle& GetLastBoundRect() const; 664 665 virtual void RecalcBoundRect(); 666 667 void BroadcastObjectChange() const; 668 669 // Modified-Flag am Model setzen 670 virtual void SetChanged(); 671 672 // Tooling for painting a single object to a OutputDevice. This will be needed as long 673 // as not all painting is changed to use DrawContact objects. 674 sal_Bool SingleObjectPainter(OutputDevice& rOut) const; 675 sal_Bool LineGeometryUsageIsNecessary() const; 676 677 // Clone() soll eine komplette Kopie des Objektes erzeugen. 678 virtual SdrObject* Clone() const; 679 virtual void operator=(const SdrObject& rObj); 680 681 // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert". 682 virtual void TakeObjNameSingul(String& rName) const; 683 virtual void TakeObjNamePlural(String& rName) const; 684 685 // Das Xor-Polygon wird von der View zu Draggen des Objektes benoetigt. 686 // Alle Polygone innerhalb des PolyPolygon werden als PolyLine interpretiert. 687 // Moechte man ein geschlossenes Polygon, so muss man es explizit schliessen. 688 virtual basegfx::B2DPolyPolygon TakeXorPoly() const; 689 690 // Die Kontur fuer TextToContour 691 virtual basegfx::B2DPolyPolygon TakeContour() const; 692 693 // Ueber GetHdlCount gibt ein Objekt die Anzahl seiner Handles preis. 694 // Im Normalfall werden dies 8 sein, bei einer Strecke 2. Bei Polygonobjekten 695 // (Polygon, Spline, Bezier) kann die Handleanzahl wesentlich groesser werden. 696 // Polygonobjekten wird ausserdem die Moeglichkeit eingeraeumt einen Punkt 697 // eines selektierten Objekts zu selektieren. Das Handle dieses Punktes wird 698 // dann durch einen Satz neuer Handles ausgetauscht (PlusHdl). Bei einem 699 // Polygon wird das wohl ein einfacher Selektionshandle sein, bei einer 700 // Bezierkurve dagegen koennen das schon bis zu 3 Handles werden (inkl Gewichte). 701 // GetHdl() und GetPlusHdl() muessen Handleinstanzen mit new erzeugen! 702 // Ein Objekt, das bei HasSpacialDrag() sal_True liefert muss diese Methoden 703 // zur Verfuegung stellen (inkl. FillHdlList). 704 virtual sal_uInt32 GetHdlCount() const; 705 virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const; 706 virtual sal_uInt32 GetPlusHdlCount(const SdrHdl& rHdl) const; 707 virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const; 708 virtual void AddToHdlList(SdrHdlList& rHdlList) const; 709 710 // Die Standardtransformationen (Move,Resize,Rotate,Mirror,Shear) werden von der 711 // View uebernommen (TakeXorPoly(),...). 712 // Objektspezifisches draggen wie z.B. Eckenradius bei Rechtecken, 713 // Stuetzstellen bei Splines, Gewichte bei Bezierkurven und Pointer von 714 // Labelobjekten muss vom Objekt selbst gehandled werden. Um das Model 715 // Statusfrei zu halten werden die Statusdaten an der View gehalten und dem 716 // Objekt dann uebergeben. EndDrag liefert im Normalfall sal_True fuer Erfolg. 717 // sal_False kann zurueckgegeben werden, wenn das Dragging das Objekt nicht 718 // veraendert hat, wobei die evtl. Tatsache, dass die Maus nicht bewegt wurde 719 // bereits von der View abgefangen wird. 720 virtual bool hasSpecialDrag() const; 721 virtual bool beginSpecialDrag(SdrDragStat& rDrag) const; 722 virtual bool applySpecialDrag(SdrDragStat& rDrag); 723 virtual String getSpecialDragComment(const SdrDragStat& rDrag) const; 724 virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const; 725 726 // FullDrag support. This is for standard interactions and for SdrObjOwn 727 // support. If supportsFullDrag() returns true, getFullDragClone has to 728 // return a cloned SdrObject (who's ownership it loses) at which modifications 729 // like Move(), Scale(), etc or applySpecialDrag() will be executed. That 730 // object will be visualized on overlay for full drag, but should not be 731 // part of the model, thus not changing anything since it's only a temporary 732 // helper object for interaction 733 virtual bool supportsFullDrag() const; 734 virtual SdrObject* getFullDragClone() const; 735 736 // Jedes Objekt muss in der Lage sein sich selbst interaktiv zu erzeugen. 737 // Beim MausDown wird zunaechst ein neues Objekt erzeugt und dann seine 738 // BegCreate()-Methode gerufen. Bei jedem MausMode wird dann MovCreate 739 // gerufen. BrkCreate() bedeutet, dass der User die interaktive Objekt- 740 // erzeugung abgebrochen hat. EndCreate() wird gerufen beim MouseUp-Event. 741 // Liefert EndCreate() ein sal_True, so ist die Objekterzeugung abgeschlossen; 742 // das Objekt wird in die entsprechende Liste eingefuegt. Andernfalls 743 // (EndCreate()==sal_False) gehe ich davon aus, dass weitere Punkte zur 744 // Objekterzeugung notwendig sind (Polygon,...). Der Parameter eCmd 745 // enthaelt die Anzahl der Mausklicks (so die App diese durchreicht). 746 // BckCreate() -> Letztes EndCreate() rueckgaengig machen (z.B. letzten 747 // Polygonpunkt wieder loeschen). 748 // ReturnCode: sal_True=Weiter geht's, sal_False=Create dadurch abgebrochen. 749 virtual FASTBOOL BegCreate(SdrDragStat& rStat); 750 virtual FASTBOOL MovCreate(SdrDragStat& rStat); // sal_True=Xor muss repainted werden 751 virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd); 752 virtual FASTBOOL BckCreate(SdrDragStat& rStat); 753 virtual void BrkCreate(SdrDragStat& rStat); 754 755 // damit holt man sich den Pointer, der das Createn dieses Objekts symbolisiert 756 virtual Pointer GetCreatePointer() const; 757 758 // Polygon das waehrend des Erzeugens aufgezogen wird 759 virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const; 760 761 // Die Methoden Move, Resize, Rotate, Mirror, Shear, SetSnapRect und 762 // SetLogicRect rufen jeweils die entsprechenden Nbc-Methoden, versenden einen 763 // Repaint-Broadcast und setzen den Modified-Status am Model. Abgeleitete 764 // Objekte sollten i.d.R. nur die Nbc-Methoden ueberladen. 765 // Nbc bedeutet: 'NoBroadcast'. 766 virtual void NbcMove (const Size& rSiz); 767 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); 768 virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs); 769 virtual void NbcMirror(const Point& rRef1, const Point& rRef2); 770 virtual void NbcShear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear); 771 772 virtual void Move (const Size& rSiz); 773 virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); 774 virtual void Rotate(const Point& rRef, long nWink, double sn, double cs); 775 virtual void Mirror(const Point& rRef1, const Point& rRef2); 776 virtual void Shear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear); 777 778 // Die relative Position eines Zeichenobjektes ist die Entfernung der 779 // linken oberen Ecke des logisch umschliessenden Rechtecks (SnapRect) 780 // zum Anker. 781 virtual void NbcSetRelativePos(const Point& rPnt); 782 virtual void SetRelativePos(const Point& rPnt); 783 virtual Point GetRelativePos() const; ImpSetAnchorPos(const Point & rPnt)784 void ImpSetAnchorPos(const Point& rPnt) { aAnchor=rPnt; } 785 virtual void NbcSetAnchorPos(const Point& rPnt); 786 virtual void SetAnchorPos(const Point& rPnt); 787 virtual const Point& GetAnchorPos() const; 788 789 // Snap wird nicht auf dem BoundRect ausgefuehrt, sondern nach Moeglichkeit auf 790 // logischen Koordinaten (also ohne Beruecksichtigung von Strichstaerke, ... ). 791 // SetSnapRect() versucht das Objekt so hinzusizen, dass es in das uebergebene 792 // Rect passt (ohne Strichstaerke, ...) 793 virtual void RecalcSnapRect(); 794 virtual const Rectangle& GetSnapRect() const; 795 virtual void SetSnapRect(const Rectangle& rRect); 796 virtual void NbcSetSnapRect(const Rectangle& rRect); 797 798 // Logic Rect: Beim Rect z.B. ohne Beruecksichtigung des Drehwinkels, Shear, ... 799 virtual const Rectangle& GetLogicRect() const; 800 virtual void SetLogicRect(const Rectangle& rRect); 801 virtual void NbcSetLogicRect(const Rectangle& rRect); 802 803 /** the default is to set the logic rect to the given rectangle rMaxRect. If the shape 804 has an intrinsic aspect ratio it may set the logic rect so the aspect 805 ratio is kept but still inside the rectangle rMaxRect. 806 807 If bShrinkOnly is set to true, the size of the current logic rect will not 808 be changed if it is smaller than the given rectangle rMaxRect. */ 809 virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); 810 811 // Drehwinkel und Shear 812 virtual long GetRotateAngle() const; 813 virtual long GetShearAngle(FASTBOOL bVertical=sal_False) const; 814 815 // Zum Fangen von/auf ausgezeichneten Punkten eines Obj (Polygonpunkte, 816 // Kreismittelpunkt, ...) 817 virtual sal_uInt32 GetSnapPointCount() const; 818 virtual Point GetSnapPoint(sal_uInt32 i) const; 819 820 // Fuer Objekte, bei denen jeder einzelne Punkt verschoben werden kann, 821 // z.B. Polygone, Polylines, Linien, ... . Bei diesen Objekten werden 822 // Punkte selektiert (ggf. Mehrfachselektion), geloescht, eingefuegt, 823 // als Mehrfachselektion verschoben und gedreht, ... 824 // Nur solche Objekte koennen PlusHandles haben (z.B. die Gewichte an den 825 // Bezierkurven. 826 virtual sal_Bool IsPolyObj() const; 827 virtual sal_uInt32 GetPointCount() const; 828 virtual Point GetPoint(sal_uInt32 i) const; 829 void SetPoint(const Point& rPnt, sal_uInt32 i); 830 virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i); 831 832 // Alle geometrischen Daten holen fuer's Undo/Redo 833 virtual SdrObjGeoData* GetGeoData() const; 834 virtual void SetGeoData(const SdrObjGeoData& rGeo); 835 836 // ItemSet access 837 const SfxItemSet& GetMergedItemSet() const; 838 void SetMergedItem(const SfxPoolItem& rItem); 839 void ClearMergedItem(const sal_uInt16 nWhich = 0); 840 void SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False); 841 const SfxPoolItem& GetMergedItem(const sal_uInt16 nWhich) const; 842 843 // internal versions 844 protected: 845 const SfxItemSet& GetObjectItemSet() const; 846 void SetObjectItem(const SfxPoolItem& rItem); 847 void ClearObjectItem(const sal_uInt16 nWhich = 0); 848 void SetObjectItemSet(const SfxItemSet& rSet); 849 const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const; 850 851 // get SfxMapUnit the object is using 852 SfxMapUnit GetObjectMapUnit() const; 853 854 public: 855 // syntactical sugar for ItemSet accesses 856 void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False); 857 858 // NotPersistAttr fuer Layer, ObjName, geometrische Transformationen, ... 859 void TakeNotPersistAttr(SfxItemSet& rAttr, FASTBOOL bMerge) const; 860 void ApplyNotPersistAttr(const SfxItemSet& rAttr); 861 void NbcApplyNotPersistAttr(const SfxItemSet& rAttr); 862 863 // bDontRemoveHardAttr=FALSE: alle in der Vorlage gesetzten Attribute werden am 864 // Zeichenobjekt auf Default gesetzt; TRUE: alle harten Attribute bleiben erhalten. 865 void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); 866 virtual void NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); 867 SfxStyleSheet* GetStyleSheet() const; 868 869 // TextEdit 870 virtual FASTBOOL HasTextEdit() const; 871 872 // Return==TRUE: TextEditMode gestartet 873 virtual sal_Bool BegTextEdit(SdrOutliner& rOutl); 874 virtual void EndTextEdit(SdrOutliner& rOutl); 875 876 // Text wird im Format des Outliners gehalten 877 // SetOutlinerParaObject: Eigentumsuebereignung von *pTextObject! 878 virtual void SetOutlinerParaObject(OutlinerParaObject* pTextObject); 879 virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject); 880 virtual OutlinerParaObject* GetOutlinerParaObject() const; 881 virtual void NbcReformatText(); 882 virtual void ReformatText(); 883 884 void BurnInStyleSheetAttributes(); 885 886 // Macrofaehigkeit, z.B. ein Rechteck als PushButton. 887 virtual FASTBOOL HasMacro() const; 888 virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const; 889 virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec) const; 890 virtual void PaintMacro (OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const; 891 virtual FASTBOOL DoMacro (const SdrObjMacroHitRec& rRec); 892 virtual XubString GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const; IsMacroHit(const SdrObjMacroHitRec & rRec) const893 sal_Bool IsMacroHit(const SdrObjMacroHitRec& rRec) const { return CheckMacroHit(rRec)!=NULL; } 894 895 // Konnektoren. (siehe auch Dokumentation in SvdoEdge.HXX, SdrEdgeObj 896 // sowie SvdGlue.HXX und SvdGlEV.HXX) 897 // Es gibt Knoten und Kanten. Eine Kante kann theoretisch auch Knoten 898 // sein, das ist jedoch in dieser Version noch nicht implementiert. 899 // Ein Knoten hat eine Anzahl von Klebepunkten, wo Kanten angeklebt 900 // werden koennen. 901 // Eine Kante kann 902 // - ohne Verbindungen sein 903 // - an einem Ende auf der Wiese stehen und am anderen Ende an 904 // genau einem Knoten gebunden sein 905 // - an beiden Enden mit jeweils genau einem Knoten verbunden sein. 906 // Die Kante ist Listener bei seinen bis zu 2 Knoten. 907 // Wird der Knoten verschoben oder Resized, folgen alle angebundenen 908 // Kanten. Ebenso bei SetGluePoint()... am Knoten. 909 // Beim Verschieben/Resizen der Kante wird dagegen die Verbindung 910 // geloesst. 911 // Objekt ist ein Knoten? 912 virtual FASTBOOL IsNode() const; 913 914 // Automatische Klebepunkte: 915 // je 4 Scheitelpunkt- und Eckpositionen muss ein Knotenobjekt liefern 916 // i.d.R. 0=oben, 1=rechts, 2=unten, 3=links 917 virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const; 918 919 // i.d.R. 0=linksoben, 1=rechtsoben, 2=rechtsunten, 3=linksunten 920 virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const; 921 922 // Liste aller Klebepunkte. Kann NULL sein. 923 virtual const SdrGluePointList* GetGluePointList() const; 924 //virtual SdrGluePointList* GetGluePointList(); 925 926 // Nach veraendern der GluePointList muss man am Obj SendRepaintBroadcast rufen! 927 virtual SdrGluePointList* ForceGluePointList(); 928 929 // Temporaer zu setzen fuer Transformationen am Bezugsobjekt 930 void SetGlueReallyAbsolute(FASTBOOL bOn); 931 void NbcRotateGluePoints(const Point& rRef, long nWink, double sn, double cs); 932 void NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2); 933 void NbcShearGluePoints (const Point& rRef, long nWink, double tn, FASTBOOL bVShear); 934 935 // Objekt ist eine Kante? 936 virtual FASTBOOL IsEdge() const; 937 938 // bTail1=TRUE: Linienanfang, sonst LinienEnde 939 // pObj=NULL: Disconnect 940 virtual void ConnectToNode(FASTBOOL bTail1, SdrObject* pObj); 941 virtual void DisconnectFromNode(FASTBOOL bTail1); 942 virtual SdrObject* GetConnectedNode(FASTBOOL bTail1) const; 943 944 /** sets the writing mode of the object's context 945 946 Objects which itself do not support different writing modes will ignore this call. 947 948 Objects which support different writing modes, but have an own, explicit writing mode set, 949 will also ignore this call. 950 951 Objects which support different writing modes, and whose own mode is set to css.text.WritingMode2.CONTEXT, 952 will use the given writing mode to calculate their "effective writing mode". 953 954 The behavior of this method is undefined if you pass css.text.WritingMode2.CONTEXT. 955 956 @param _nContextWritingMode 957 the effective writing mode of the context of the object 958 */ 959 virtual void SetContextWritingMode( const sal_Int16 _nContextWritingMode ); 960 961 // Wenn ein Objekt in der Lage ist, sich in ein Polygon oder in eine 962 // Bezierkurve (oder beides) zu verwandeln, dann sollten die folgenden 963 // Methoden ueberladen werden. 964 // Z.B. Ein RectObj mit Strichstaerke 10, SOLID_PEN in Polygon wandeln: 965 // Im Modus bLineToArea=sal_False soll ein PolyObj mit 4 Stuetzstellen, 966 // Strichstaerke 10 und SOLiD_PEN erzeugt werden. 967 // Im Modus bLineToArea=sal_True dagegen soll das generierte Obj immer ein 968 // LinienAttribut NULL_PEN haben, und die Linie (auch Linienmuster) selbst 969 // durch Polygonflaechen emuliert werden, die dadurch anschliessend vom 970 // Anwender manipuliert werden koennen. Das RectObj kann sich somit also 971 // nur korrekt konvertieren, wenn es als Flaechenattribut NULL_BRUSH 972 // besitzt. Es muesste in diesem Fall dann: 973 // - SOLID_BRUSH mit der Farbe des gesetzten Pen setzen 974 // - NULL_PEN setzen 975 // - PolyPolygon mit 2 Polygonen zu je 4 Stuetzstellen generieren. 976 // Der Returnwert ist jeweils ein SdrObject*, da als Rueckgabe zur Not 977 // auch Gruppenobjekte erlaubt sind (z.B. fuer SdrTextObj). 978 // Bei der Konvertierung von TextObj nach PathObj wird es wohl so sein, 979 // dass beide Modi (bLineToArea=sal_True/sal_False) identisch sind. 980 // Defaulted sind diese Methoden auf "Ich kann das nicht" (FALSE/NULL). 981 virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const; 982 SdrObject* ConvertToPolyObj(sal_Bool bBezier, sal_Bool bLineToArea) const; 983 984 // convert this path object to contour object; bForceLineDash converts even 985 // when there is no filled new polygon created from line-to-polygon conversion, 986 // specially used for XLINE_DASH and 3D conversion 987 SdrObject* ConvertToContourObj(SdrObject* pRet, sal_Bool bForceLineDash = sal_False) const; 988 SdrObject* ImpConvertToContourObj(SdrObject* pRet, sal_Bool bForceLineDash = sal_False) const; 989 990 // TRUE: Referenz auf ein Obj IsVirtualObj() const991 sal_Bool IsVirtualObj() const { return bVirtObj; } 992 993 // sal_True=Obj kann warsch. gefuellt werden; sal_False=Obj kann warsch. Linienenden haben. 994 // ungueltig, wenn es sich um ein GroupObj handelt. IsClosedObj() const995 sal_Bool IsClosedObj() const { return bClosedObj; } 996 IsEdgeObj() const997 sal_Bool IsEdgeObj() const { return bIsEdge; } Is3DObj() const998 sal_Bool Is3DObj() const { return bIs3DObj; } IsUnoObj() const999 sal_Bool IsUnoObj() const { return bIsUnoObj; } IsMasterCachable() const1000 sal_Bool IsMasterCachable() const { return !bNotMasterCachable; } ShareLock()1001 sal_Bool ShareLock() { sal_Bool r=!bNetLock; bNetLock=sal_True; return r; } ShareUnlock()1002 void ShareUnlock() { bNetLock=sal_False; } IsShareLock() const1003 sal_Bool IsShareLock() const { return bNetLock; } SetMarkProtect(sal_Bool bProt)1004 void SetMarkProtect(sal_Bool bProt) { bMarkProt=bProt; } IsMarkProtect() const1005 sal_Bool IsMarkProtect() const { return bMarkProt; } 1006 void SetInserted(sal_Bool bIns); IsInserted() const1007 sal_Bool IsInserted() const { return bInserted; } SetGrouped(sal_Bool bGrp)1008 void SetGrouped(sal_Bool bGrp) { bGrouped=bGrp; } IsGrouped() const1009 sal_Bool IsGrouped() const { return bGrouped; } 1010 void SetMoveProtect(sal_Bool bProt); IsMoveProtect() const1011 sal_Bool IsMoveProtect() const { return bMovProt; } 1012 void SetResizeProtect(sal_Bool bProt); IsResizeProtect() const1013 sal_Bool IsResizeProtect() const { return bSizProt; } 1014 void SetPrintable(sal_Bool bPrn); IsPrintable() const1015 sal_Bool IsPrintable() const { return !bNoPrint; } 1016 void SetVisible(sal_Bool bVisible); IsVisible() const1017 sal_Bool IsVisible() const { return mbVisible; } SetEmptyPresObj(sal_Bool bEpt)1018 void SetEmptyPresObj(sal_Bool bEpt) { bEmptyPresObj=bEpt; } IsEmptyPresObj() const1019 sal_Bool IsEmptyPresObj() const { return bEmptyPresObj; } SetNotVisibleAsMaster(sal_Bool bFlg)1020 void SetNotVisibleAsMaster(sal_Bool bFlg) { bNotVisibleAsMaster=bFlg; } IsNotVisibleAsMaster() const1021 sal_Bool IsNotVisibleAsMaster() const { return bNotVisibleAsMaster; } 1022 1023 // #i25616# LineIsOutsideGeometry() const1024 sal_Bool LineIsOutsideGeometry() const { return mbLineIsOutsideGeometry; } 1025 1026 // #i25616# DoesSupportTextIndentingOnLineWidthChange() const1027 sal_Bool DoesSupportTextIndentingOnLineWidthChange() const { return mbSupportTextIndentingOnLineWidthChange; } 1028 1029 // applikationsspeziefische Daten 1030 sal_uInt16 GetUserDataCount() const; 1031 SdrObjUserData* GetUserData(sal_uInt16 nNum) const; 1032 1033 // Insert uebernimmt den auf dem Heap angelegten Record in den Besitz 1034 // des Zeichenobjekts 1035 void InsertUserData(SdrObjUserData* pData, sal_uInt16 nPos=0xFFFF); 1036 1037 // Delete entfernt den Record aus der Liste und ruft 1038 // ein delete (FreeMem+Dtor). 1039 void DeleteUserData(sal_uInt16 nNum); 1040 1041 // ItemPool fuer dieses Objekt wechseln 1042 void MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel = 0L); 1043 1044 //////////////////////////////////////////////////////////////////////////////////////////////////// 1045 // access to the UNO representation of the shape 1046 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape(); getWeakUnoShape() const1047 ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > getWeakUnoShape() const { return maWeakUnoShape; } 1048 1049 static SdrObject* getSdrObjectFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt ); 1050 1051 // helper struct for granting access exclusive to SvxShape 1052 struct GrantXShapeAccess 1053 { 1054 friend class SvxShape; 1055 private: GrantXShapeAccessSdrObject::GrantXShapeAccess1056 GrantXShapeAccess() { } 1057 }; 1058 1059 // 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)1060 void setUnoShape( 1061 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxUnoShape, 1062 GrantXShapeAccess /*aGrant*/ 1063 ) 1064 { 1065 impl_setUnoShape( _rxUnoShape ); 1066 } 1067 1068 /** retrieves the instance responsible for notifying changes in the properties of the shape associated with 1069 the SdrObject 1070 1071 @precond 1072 There already exists an SvxShape instance associated with the SdrObject 1073 @throws ::com::sun::star::uno::RuntimeException 1074 if there does nt yet exists an SvxShape instance associated with the SdrObject. 1075 */ 1076 ::svx::PropertyChangeNotifier& 1077 getShapePropertyChangeNotifier(); 1078 1079 /** notifies a change in the given property, to all applicable listeners registered at the associated SvxShape 1080 1081 This method is equivalent to calling getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty ), 1082 exception that it is allowed to be called when there does not yet exist an associated SvxShape - in which 1083 case the method will silently return without doing anything. 1084 */ 1085 void notifyShapePropertyChange( const ::svx::ShapeProperty _eProperty ) const; 1086 1087 //////////////////////////////////////////////////////////////////////////////////////////////////// 1088 // 1089 // transformation interface for StarOfficeAPI. This implements support for 1090 // homogen 3x3 matrices containing the transformation of the SdrObject. At the 1091 // moment it contains a shearX, rotation and translation, but for setting all linear 1092 // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported. 1093 // 1094 // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon 1095 // with the base geometry and returns TRUE. Otherwise it returns FALSE. 1096 virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const; 1097 1098 // sets the base geometry of the object using infos contained in the homogen 3x3 matrix. 1099 // If it's an SdrPathObj it will use the provided geometry information. The Polygon has 1100 // to use (0,0) as upper left and will be scaled to the given size in the matrix. 1101 virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon); 1102 1103 sal_Bool IsTransparent( sal_Bool bCheckForAlphaChannel = sal_False ) const; 1104 1105 // #116168# 1106 // Give info if object is in destruction 1107 sal_Bool IsInDestruction() const; 1108 1109 // return if fill is != XFILL_NONE 1110 bool HasFillStyle() const; 1111 bool HasLineStyle() const; 1112 1113 // on import of OLE object from MS documents the BLIP size might be retrieved, 1114 // the following methods are used to control it; 1115 // usually this data makes no sense after the import is finished, since the object 1116 // might be resized 1117 Rectangle GetBLIPSizeRectangle() const; 1118 void SetBLIPSizeRectangle( const Rectangle& aRect ); 1119 1120 // #121917# 1121 virtual bool HasText() const; 1122 1123 protected: 1124 void impl_setUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxUnoShape ); 1125 1126 private: 1127 /** only for internal use! 1128 */ 1129 SvxShape* getSvxShape(); 1130 1131 /** do not use directly, always use getSvxShape() if you have to! */ 1132 SvxShape* mpSvxShape; 1133 ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > 1134 maWeakUnoShape; 1135 }; 1136 1137 //************************************************************ 1138 // SdrDummyObj 1139 // 1140 // Wer sich eigene Objekte schafft muss einen Link in der Klasse 1141 // SdrObjFactory setzen. Der Handler hat folgendes aussehen: 1142 // void Hdl(SdrObjFactory*) 1143 // Er muss sich aus der uebergebenen Instanz die Werte nInventor und 1144 // nIdentifier ansehen und entsprechend mit new eine Zeichenobjektinstanz 1145 // erzeugen. Einen Zeiger auf diese Instanz hat er in der Membervariablen 1146 // pNewObj zu hinterlassen. 1147 // 1148 //************************************************************ 1149 1150 class SVX_DLLPUBLIC SdrObjFactory 1151 { 1152 public: 1153 sal_uInt32 nInventor; 1154 sal_uInt16 nIdentifier; 1155 1156 // for MakeNewObj(): 1157 SdrPage* pPage; 1158 SdrModel* pModel; 1159 SdrObject* pNewObj; 1160 1161 // for MakeNewObjUserData(): 1162 SdrObject* pObj; 1163 SdrObjUserData* pNewData; 1164 1165 private: 1166 SVX_DLLPRIVATE SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pNewPage, SdrModel* pNewModel); 1167 SVX_DLLPRIVATE SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj1); 1168 1169 public: 1170 static SdrObject* MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pPage, SdrModel* pModel=NULL); 1171 static void InsertMakeObjectHdl(const Link& rLink); 1172 static void RemoveMakeObjectHdl(const Link& rLink); 1173 static SdrObjUserData* MakeNewObjUserData(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj); 1174 static void InsertMakeUserDataHdl(const Link& rLink); 1175 static void RemoveMakeUserDataHdl(const Link& rLink); 1176 }; 1177 1178 typedef tools::WeakReference< SdrObject > SdrObjectWeakRef; 1179 1180 #endif //_SVDOBJ_HXX 1181 1182 /* vim: set noet sw=4 ts=4: */ 1183