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