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 bool mbDecorative; 314 315 // Name to be used by applications 316 XubString aHTMLName; 317 318 public: 319 TYPEINFO(); 320 SdrObjPlusData(); 321 virtual ~SdrObjPlusData(); 322 virtual SdrObjPlusData* Clone(SdrObject* pObj1) const; 323 }; 324 325 //************************************************************ 326 // Hilfsklasse SdrObjTransformInfoRec 327 // 328 // gibt Auskunft ueber verschiedene Eigenschaften eines ZObjects 329 // 330 //************************************************************ 331 332 class SdrObjTransformInfoRec 333 { 334 public: 335 unsigned bSelectAllowed : 1; // sal_False=Obj kann nicht selektiert werden 336 unsigned bMoveAllowed : 1; // sal_False=Obj kann nicht verschoben werden 337 unsigned bResizeFreeAllowed : 1; // sal_False=Obj kann nicht frei resized werden 338 unsigned bResizePropAllowed : 1; // sal_False=Obj kann nichtmal proportional resized werden 339 unsigned bRotateFreeAllowed : 1; // sal_False=Obj kann nicht frei gedreht werden 340 unsigned bRotate90Allowed : 1; // sal_False=Obj kann nichtmal im 90deg Raster gedreht werden 341 unsigned bMirrorFreeAllowed : 1; // sal_False=Obj kann nicht frei gespiegelt werden 342 unsigned bMirror45Allowed : 1; // sal_False=Obj kann nichtmal ueber Achse im 45deg Raster gespiegelt werden 343 unsigned bMirror90Allowed : 1; // sal_False=Obj kann ebenfalls nicht ueber Achse im 90deg Raster gespiegelt werden 344 unsigned bTransparenceAllowed : 1; // sal_False=Obj does not have an interactive transparence control 345 unsigned bGradientAllowed : 1; // sal_False=Obj does not have an interactive gradient control 346 unsigned bShearAllowed : 1; // sal_False=Obj kann nicht verzerrt werden 347 unsigned bEdgeRadiusAllowed : 1; 348 unsigned bNoOrthoDesired : 1; // sal_True bei Rect; ... sal_False bei BMP,MTF; 349 unsigned bNoContortion : 1; // sal_False=Kein verzerren (bei Crook) moeglich (nur sal_True bei PathObj und Gruppierten PathObjs) 350 unsigned bCanConvToPath : 1; // sal_False=Keine Konvertierung in PathObj moeglich 351 unsigned bCanConvToPoly : 1; // sal_False=Keine Konvertierung in PolyObj moeglich 352 unsigned bCanConvToContour : 1; // sal_False=no conversion down to whole contour possible 353 unsigned bCanConvToPathLineToArea : 1; // sal_False=Keine Konvertierung in PathObj moeglich mit Wandlung von LineToArea 354 unsigned bCanConvToPolyLineToArea : 1; // sal_False=Keine Konvertierung in PolyObj moeglich mit Wandlung von LineToArea 355 356 public: SdrObjTransformInfoRec()357 SdrObjTransformInfoRec() 358 : bSelectAllowed(sal_True), 359 bMoveAllowed(sal_True), 360 bResizeFreeAllowed(sal_True), 361 bResizePropAllowed(sal_True), 362 bRotateFreeAllowed(sal_True), 363 bRotate90Allowed(sal_True), 364 bMirrorFreeAllowed(sal_True), 365 bMirror45Allowed(sal_True), 366 bMirror90Allowed(sal_True), 367 bTransparenceAllowed(sal_True), 368 bGradientAllowed(sal_True), 369 bShearAllowed(sal_True), 370 bEdgeRadiusAllowed(sal_True), 371 bNoOrthoDesired(sal_True), 372 bNoContortion(sal_True), 373 bCanConvToPath(sal_True), 374 bCanConvToPoly(sal_True), 375 bCanConvToContour(sal_False), 376 bCanConvToPathLineToArea(sal_True), 377 bCanConvToPolyLineToArea(sal_True) 378 {} 379 }; 380 381 //////////////////////////////////////////////////////////////////////////////////////////////////// 382 // To make things more safe, allow users of the object to register at it. The users need to be derived 383 // from SdrObjectUser to get a call. The users do not need to call RemoveObjectUser() at the object 384 // when they get called from PageInDestruction(). 385 class SdrObject; 386 387 class SdrObjectUser 388 { 389 public: 390 virtual void ObjectInDestruction(const SdrObject& rObject) = 0; 391 }; 392 393 // typedef for GetParentContacts() 394 typedef ::std::vector< SdrObjectUser* > ObjectUserVector; 395 396 //////////////////////////////////////////////////////////////////////////////////////////////////// 397 //////////////////////////////////////////////////////////////////////////////////////////////////// 398 // 399 // Abstraktes DrawObject 400 // 401 //////////////////////////////////////////////////////////////////////////////////////////////////// 402 403 class SvxShape; 404 class SVX_DLLPUBLIC SdrObject: public SfxListener, public tools::WeakBase< SdrObject > 405 { 406 private: 407 // ObjectUser section 408 sdr::ObjectUserVector maObjectUsers; 409 410 public: 411 void AddObjectUser(sdr::ObjectUser& rNewUser); 412 void RemoveObjectUser(sdr::ObjectUser& rOldUser); 413 414 // BaseProperties section 415 private: 416 sdr::properties::BaseProperties* mpProperties; 417 protected: 418 virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); 419 public: 420 virtual sdr::properties::BaseProperties& GetProperties() const; 421 422 /////////////////////////////////////////////////////////////////////////////// 423 // #110094# DrawContact section 424 private: 425 sdr::contact::ViewContact* mpViewContact; 426 protected: 427 virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); 428 public: 429 sdr::contact::ViewContact& GetViewContact() const; 430 431 // DrawContact support: Methods for handling Object changes 432 void ActionChanged() const; 433 434 private: 435 friend class SdrObjListIter; 436 friend class SdrVirtObj; 437 friend class SdrRectObj; 438 439 protected: 440 Rectangle aOutRect; // umschliessendes Rechteck fuer Paint (inkl. LineWdt, ...) 441 Point aAnchor; // Ankerposition (Writer) 442 SdrObjList* pObjList; // Liste, in dem das Obj eingefuegt ist. 443 SdrPage* pPage; 444 SdrModel* pModel; 445 SdrObjUserCall* pUserCall; 446 SdrObjPlusData* pPlusData; // Broadcaster, UserData, Konnektoren, ... (Das ist der Bitsack) 447 448 sal_uInt32 nOrdNum; // Rangnummer des Obj in der Liste 449 450 /** Position in the navigation order. SAL_MAX_UINT32 when not used. 451 */ 452 sal_uInt32 mnNavigationPosition; 453 SdrLayerID mnLayerID; 454 455 // Objekt zeigt nur auf ein Anderes 456 unsigned bVirtObj : 1; 457 unsigned bSnapRectDirty : 1; 458 unsigned bNetLock : 1; // ni 459 unsigned bInserted : 1; // nur wenn sal_True gibt es RepaintBroadcast & SetModify 460 unsigned bGrouped : 1; // Member eines GroupObjektes? 461 462 // Die folgende Flags werden gestreamt 463 unsigned bMovProt : 1; // If true, the position is protected 464 unsigned bSizProt : 1; // If true, the size is protected 465 unsigned bNoPrint : 1; // If true, the object is not printed. 466 unsigned mbVisible : 1; // If false, the object is not visible on screen (but maybe on printer, depending on bNoprint 467 // Wenn bEmptyPresObj sal_True ist, handelt es sich um ein 468 // Praesentationsobjekt, dem noch kein Inhalt zugewiesen 469 // wurde. Default ist das Flag auf FALSE. Die Verwaltung 470 // uebernimmt die Applikation. Im Zuweisungsoperator sowie 471 // beim Clone wird das Flag nicht mitkopiert! 472 // Das Flag ist persistent. 473 unsigned bEmptyPresObj : 1; // Leeres Praesentationsobjekt (Draw) 474 475 // sal_True=Objekt ist als Objekt der MasterPage nicht sichtbar 476 unsigned bNotVisibleAsMaster : 1; 477 478 // sal_True=Es handelt sich hierbei um ein geschlossenes Objekt, also nicht Linie oder Kreisbogen ... 479 unsigned bClosedObj : 1; 480 481 unsigned bIsEdge : 1; 482 unsigned bIs3DObj : 1; 483 unsigned bMarkProt : 1; // Markieren verboten. Persistent 484 unsigned bIsUnoObj : 1; 485 unsigned bNotMasterCachable : 1; 486 487 // #i25616# 488 unsigned mbLineIsOutsideGeometry : 1; 489 490 // #i25616# 491 unsigned mbSupportTextIndentingOnLineWidthChange : 1; 492 493 // on import of OLE object from MS documents the BLIP size might be retrieved, 494 // in this case the following member is initialized as nonempty rectangle 495 Rectangle maBLIPSizeRectangle; 496 497 // global static ItemPool for not-yet-inserted items 498 private: 499 static SdrItemPool* mpGlobalItemPool; 500 public: 501 static SdrItemPool& GetGlobalDrawObjectItemPool(); 502 private: 503 SVX_DLLPRIVATE static void FreeGlobalDrawObjectItemPool(); 504 505 protected: 506 void ImpDeleteUserData(); 507 SdrObjUserData* ImpGetMacroUserData() const; 508 Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const; 509 510 // Fuer GetDragComment 511 void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, String& rStr, sal_uInt16 nVal=0) const; 512 ImpForcePlusData()513 void ImpForcePlusData() { if (pPlusData==NULL) pPlusData=NewPlusData(); } 514 515 String GetWinkStr(long nWink, FASTBOOL bNoDegChar=sal_False) const; 516 String GetMetrStr(long nVal, MapUnit eWantMap=MAP_MM, FASTBOOL bNoUnitChars=sal_False) const; 517 518 // bNotMyself=sal_True bedeutet: Nur die ObjList auf Dirty setzen, nicht mich. 519 // Wird z.B. benoetigt fuer NbcMove, denn da moved man SnapRect und aOutRect 520 // i.d.R. gleich mit um die Neuberechnung zu sparen. 521 public: 522 virtual void SetRectsDirty(sal_Bool bNotMyself = sal_False); 523 protected: 524 525 // ueberladen, wenn man sich von SdrObjPlusData abgeleitet hat: 526 virtual SdrObjPlusData* NewPlusData() const; 527 528 protected: 529 // Diese 3 Methoden muss ein abgeleitetes Objekt ueberladen, wenn es eigene 530 // geometrische Daten besitzt, die fuer den Undo-Fall gesichert werden 531 // sollen. NewGeoData() erzeugt lediglich eine leere Instanz auf eine von 532 // SdrObjGeoData abgeleitete Klasse. 533 virtual SdrObjGeoData* NewGeoData() const; 534 virtual void SaveGeoData(SdrObjGeoData& rGeo) const; 535 virtual void RestGeoData(const SdrObjGeoData& rGeo); 536 537 protected: 538 virtual ~SdrObject(); 539 540 public: 541 TYPEINFO(); 542 SdrObject(); 543 544 /** frees the SdrObject pointed to by the argument 545 546 In case the object has an SvxShape, which has the ownership of the object, it 547 is actually *not* deleted. 548 */ 549 static void Free( SdrObject*& _rpObject ); 550 551 // This method is only for access from Property objects 552 virtual void SetBoundRectDirty(); 553 554 virtual void SetObjList(SdrObjList* pNewObjList); GetObjList() const555 SdrObjList* GetObjList() const { return pObjList; } 556 557 virtual void SetPage(SdrPage* pNewPage); GetPage() const558 SdrPage* GetPage() const { return pPage; } 559 560 virtual void SetModel(SdrModel* pNewModel); GetModel() const561 SdrModel* GetModel() const { return pModel; } 562 SdrItemPool* GetObjectItemPool() const; 563 564 void AddListener(SfxListener& rListener); 565 void RemoveListener(SfxListener& rListener); GetBroadcaster() const566 const SfxBroadcaster* GetBroadcaster() const { return pPlusData!=NULL ? pPlusData->pBroadcast : NULL; } 567 568 virtual void AddReference(SdrVirtObj& rVrtObj); 569 virtual void DelReference(SdrVirtObj& rVrtObj); 570 virtual sal_uInt32 GetObjInventor() const; 571 virtual sal_uInt16 GetObjIdentifier() const; 572 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; 573 574 // Layer interface 575 virtual SdrLayerID GetLayer() const; 576 virtual void NbcSetLayer(SdrLayerID nLayer); 577 virtual void SetLayer(SdrLayerID nLayer); 578 // renaming GetLayerSet -> getMergedHierarchyLayerSet to make clear what happens here. rSet needs to be empty. 579 virtual void getMergedHierarchyLayerSet(SetOfByte& rSet) const; 580 581 // UserCall interface SetUserCall(SdrObjUserCall * pUser)582 void SetUserCall(SdrObjUserCall* pUser) { pUserCall=pUser; } GetUserCall() const583 SdrObjUserCall* GetUserCall() const { return pUserCall; } 584 void SendUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect) const; 585 586 // Ein solcher Referenzpunkt ist z.B. der Punkt eines Symbols, der 587 // der beim Einfuegen des Symbols auf das Raster gefangen werden soll 588 // oder der Fixpunkt eines Bildes innerhalb eines Animationsobjektes. 589 virtual FASTBOOL HasRefPoint() const; 590 virtual Point GetRefPoint() const; 591 virtual void SetRefPoint(const Point& rPnt); 592 593 // #i68101# 594 // An object may have a user-set Name (Get/SetName()), e.g SdrGrafObj, SdrObjGroup 595 // or SdrOle2Obj. 596 // It may also have a Title and a Description for accessibility purposes. 597 void SetName(const String& rStr); 598 String GetName() const; 599 void SetTitle(const String& rStr); 600 String GetTitle() const; 601 void SetDescription(const String& rStr); 602 String GetDescription() const; 603 // ODF 1.4 draw:decorative; not covered by undo 604 void SetDecorative(bool bNew); 605 bool IsDecorative() const; 606 607 // support for HTMLName 608 void SetHTMLName(const String& rStr); 609 String GetHTMLName() const; 610 611 // Fuer Gruppenobjekte IsGroupObject() const612 sal_Bool IsGroupObject() const { return GetSubList()!=NULL; } 613 virtual SdrObjList* GetSubList() const; 614 SdrObject* GetUpGroup() const; 615 616 // Ueber die Objekt-Ordnungsnummer kann man feststellen, ob ein Objekt vor 617 // oder hinter einem anderen liegt. Objekte mit kleinen Ordnungsnummern werden 618 // zuerst gezeichnet, Objekte mit grossen Ordnungsnummern zuletzt. 619 // Wird die Reihenfolge der Objekte in der Liste veraendert, so wird ein 620 // Dirty-Flag gesetzt (an der Page). Beim naechsten SdrObject::GetOrdNum() 621 // werden die Ordnungsnummer aller Objekte der Liste neu bestimmt. 622 sal_uInt32 GetOrdNum() const; 623 624 // Diese Methode sollte nur verwendet werden, wenn man ganz genau weiss, 625 // was man macht: GetOrdNumDirect() const626 sal_uInt32 GetOrdNumDirect() const { return nOrdNum; } 627 628 // Das Setzen der Ordnungsnummer sollte nur vom Model bzw. von der Page 629 // geschehen. SetOrdNum(sal_uInt32 nNum)630 void SetOrdNum(sal_uInt32 nNum) { nOrdNum=nNum; } 631 632 /** Return the position in the navigation order for the called object. 633 Note that this method may update the navigation position of the 634 called and of other SdrObjects. Therefore this method can not be 635 const. 636 @return 637 If no navigation position has been explicitly defined then the 638 result of GetOrdNum() is returned. 639 */ 640 sal_uInt32 GetNavigationPosition (void); 641 642 /** Set the position in the navigation position to the given value. 643 This method is typically used only by the model after a change to 644 the navigation order. 645 This method does not change the navigation position of other 646 objects. 647 Use SdrObjList::SetObjectNavigationPosition() instead. 648 */ 649 void SetNavigationPosition (const sal_uInt32 nPosition); 650 GetAutoTimer() const651 const AutoTimer* GetAutoTimer() const { return pPlusData!=NULL ? pPlusData->pAutoTimer : NULL; } GetAutoTimer()652 AutoTimer* GetAutoTimer() { return pPlusData!=NULL ? pPlusData->pAutoTimer : NULL; } 653 AutoTimer* ForceAutoTimer(); 654 655 // #111111# 656 // To make clearer that this method may trigger RecalcBoundRect and thus may be 657 // expensive and sometimes problematic (inside a bigger object change You will get 658 // non-useful BoundRects sometimes) i rename that method from GetBoundRect() to 659 // GetCurrentBoundRect(). 660 virtual const Rectangle& GetCurrentBoundRect() const; 661 662 // #111111# 663 // To have a possibility to get the last calculated BoundRect e.g for producing 664 // the first rectangle for repaints (old and new need to be used) without forcing 665 // a RecalcBoundRect (which may be problematical and expensive sometimes) i add here 666 // a new method for accessing the last BoundRect. 667 virtual const Rectangle& GetLastBoundRect() const; 668 669 virtual void RecalcBoundRect(); 670 671 void BroadcastObjectChange() const; 672 673 // Modified-Flag am Model setzen 674 virtual void SetChanged(); 675 676 // Tooling for painting a single object to a OutputDevice. This will be needed as long 677 // as not all painting is changed to use DrawContact objects. 678 sal_Bool SingleObjectPainter(OutputDevice& rOut) const; 679 sal_Bool LineGeometryUsageIsNecessary() const; 680 681 // Clone() soll eine komplette Kopie des Objektes erzeugen. 682 virtual SdrObject* Clone() const; 683 virtual void operator=(const SdrObject& rObj); 684 685 // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert". 686 virtual void TakeObjNameSingul(String& rName) const; 687 virtual void TakeObjNamePlural(String& rName) const; 688 689 // Das Xor-Polygon wird von der View zu Draggen des Objektes benoetigt. 690 // Alle Polygone innerhalb des PolyPolygon werden als PolyLine interpretiert. 691 // Moechte man ein geschlossenes Polygon, so muss man es explizit schliessen. 692 virtual basegfx::B2DPolyPolygon TakeXorPoly() const; 693 694 // Die Kontur fuer TextToContour 695 virtual basegfx::B2DPolyPolygon TakeContour() const; 696 697 // Ueber GetHdlCount gibt ein Objekt die Anzahl seiner Handles preis. 698 // Im Normalfall werden dies 8 sein, bei einer Strecke 2. Bei Polygonobjekten 699 // (Polygon, Spline, Bezier) kann die Handleanzahl wesentlich groesser werden. 700 // Polygonobjekten wird ausserdem die Moeglichkeit eingeraeumt einen Punkt 701 // eines selektierten Objekts zu selektieren. Das Handle dieses Punktes wird 702 // dann durch einen Satz neuer Handles ausgetauscht (PlusHdl). Bei einem 703 // Polygon wird das wohl ein einfacher Selektionshandle sein, bei einer 704 // Bezierkurve dagegen koennen das schon bis zu 3 Handles werden (inkl Gewichte). 705 // GetHdl() und GetPlusHdl() muessen Handleinstanzen mit new erzeugen! 706 // Ein Objekt, das bei HasSpacialDrag() sal_True liefert muss diese Methoden 707 // zur Verfuegung stellen (inkl. FillHdlList). 708 virtual sal_uInt32 GetHdlCount() const; 709 virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const; 710 virtual sal_uInt32 GetPlusHdlCount(const SdrHdl& rHdl) const; 711 virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const; 712 virtual void AddToHdlList(SdrHdlList& rHdlList) const; 713 714 // Die Standardtransformationen (Move,Resize,Rotate,Mirror,Shear) werden von der 715 // View uebernommen (TakeXorPoly(),...). 716 // Objektspezifisches draggen wie z.B. Eckenradius bei Rechtecken, 717 // Stuetzstellen bei Splines, Gewichte bei Bezierkurven und Pointer von 718 // Labelobjekten muss vom Objekt selbst gehandled werden. Um das Model 719 // Statusfrei zu halten werden die Statusdaten an der View gehalten und dem 720 // Objekt dann uebergeben. EndDrag liefert im Normalfall sal_True fuer Erfolg. 721 // sal_False kann zurueckgegeben werden, wenn das Dragging das Objekt nicht 722 // veraendert hat, wobei die evtl. Tatsache, dass die Maus nicht bewegt wurde 723 // bereits von der View abgefangen wird. 724 virtual bool hasSpecialDrag() const; 725 virtual bool beginSpecialDrag(SdrDragStat& rDrag) const; 726 virtual bool applySpecialDrag(SdrDragStat& rDrag); 727 virtual String getSpecialDragComment(const SdrDragStat& rDrag) const; 728 virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const; 729 730 // FullDrag support. This is for standard interactions and for SdrObjOwn 731 // support. If supportsFullDrag() returns true, getFullDragClone has to 732 // return a cloned SdrObject (who's ownership it loses) at which modifications 733 // like Move(), Scale(), etc or applySpecialDrag() will be executed. That 734 // object will be visualized on overlay for full drag, but should not be 735 // part of the model, thus not changing anything since it's only a temporary 736 // helper object for interaction 737 virtual bool supportsFullDrag() const; 738 virtual SdrObject* getFullDragClone() const; 739 740 // Jedes Objekt muss in der Lage sein sich selbst interaktiv zu erzeugen. 741 // Beim MausDown wird zunaechst ein neues Objekt erzeugt und dann seine 742 // BegCreate()-Methode gerufen. Bei jedem MausMode wird dann MovCreate 743 // gerufen. BrkCreate() bedeutet, dass der User die interaktive Objekt- 744 // erzeugung abgebrochen hat. EndCreate() wird gerufen beim MouseUp-Event. 745 // Liefert EndCreate() ein sal_True, so ist die Objekterzeugung abgeschlossen; 746 // das Objekt wird in die entsprechende Liste eingefuegt. Andernfalls 747 // (EndCreate()==sal_False) gehe ich davon aus, dass weitere Punkte zur 748 // Objekterzeugung notwendig sind (Polygon,...). Der Parameter eCmd 749 // enthaelt die Anzahl der Mausklicks (so die App diese durchreicht). 750 // BckCreate() -> Letztes EndCreate() rueckgaengig machen (z.B. letzten 751 // Polygonpunkt wieder loeschen). 752 // ReturnCode: sal_True=Weiter geht's, sal_False=Create dadurch abgebrochen. 753 virtual FASTBOOL BegCreate(SdrDragStat& rStat); 754 virtual FASTBOOL MovCreate(SdrDragStat& rStat); // sal_True=Xor muss repainted werden 755 virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd); 756 virtual FASTBOOL BckCreate(SdrDragStat& rStat); 757 virtual void BrkCreate(SdrDragStat& rStat); 758 759 // damit holt man sich den Pointer, der das Createn dieses Objekts symbolisiert 760 virtual Pointer GetCreatePointer() const; 761 762 // Polygon das waehrend des Erzeugens aufgezogen wird 763 virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const; 764 765 // Die Methoden Move, Resize, Rotate, Mirror, Shear, SetSnapRect und 766 // SetLogicRect rufen jeweils die entsprechenden Nbc-Methoden, versenden einen 767 // Repaint-Broadcast und setzen den Modified-Status am Model. Abgeleitete 768 // Objekte sollten i.d.R. nur die Nbc-Methoden ueberladen. 769 // Nbc bedeutet: 'NoBroadcast'. 770 virtual void NbcMove (const Size& rSiz); 771 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); 772 virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs); 773 virtual void NbcMirror(const Point& rRef1, const Point& rRef2); 774 virtual void NbcShear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear); 775 776 virtual void Move (const Size& rSiz); 777 virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); 778 virtual void Rotate(const Point& rRef, long nWink, double sn, double cs); 779 virtual void Mirror(const Point& rRef1, const Point& rRef2); 780 virtual void Shear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear); 781 782 // Die relative Position eines Zeichenobjektes ist die Entfernung der 783 // linken oberen Ecke des logisch umschliessenden Rechtecks (SnapRect) 784 // zum Anker. 785 virtual void NbcSetRelativePos(const Point& rPnt); 786 virtual void SetRelativePos(const Point& rPnt); 787 virtual Point GetRelativePos() const; ImpSetAnchorPos(const Point & rPnt)788 void ImpSetAnchorPos(const Point& rPnt) { aAnchor=rPnt; } 789 virtual void NbcSetAnchorPos(const Point& rPnt); 790 virtual void SetAnchorPos(const Point& rPnt); 791 virtual const Point& GetAnchorPos() const; 792 793 // Snap wird nicht auf dem BoundRect ausgefuehrt, sondern nach Moeglichkeit auf 794 // logischen Koordinaten (also ohne Beruecksichtigung von Strichstaerke, ... ). 795 // SetSnapRect() versucht das Objekt so hinzusizen, dass es in das uebergebene 796 // Rect passt (ohne Strichstaerke, ...) 797 virtual void RecalcSnapRect(); 798 virtual const Rectangle& GetSnapRect() const; 799 virtual void SetSnapRect(const Rectangle& rRect); 800 virtual void NbcSetSnapRect(const Rectangle& rRect); 801 802 // Logic Rect: Beim Rect z.B. ohne Beruecksichtigung des Drehwinkels, Shear, ... 803 virtual const Rectangle& GetLogicRect() const; 804 virtual void SetLogicRect(const Rectangle& rRect); 805 virtual void NbcSetLogicRect(const Rectangle& rRect); 806 807 /** the default is to set the logic rect to the given rectangle rMaxRect. If the shape 808 has an intrinsic aspect ratio it may set the logic rect so the aspect 809 ratio is kept but still inside the rectangle rMaxRect. 810 811 If bShrinkOnly is set to true, the size of the current logic rect will not 812 be changed if it is smaller than the given rectangle rMaxRect. */ 813 virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); 814 815 // Drehwinkel und Shear 816 virtual long GetRotateAngle() const; 817 virtual long GetShearAngle(FASTBOOL bVertical=sal_False) const; 818 819 // Zum Fangen von/auf ausgezeichneten Punkten eines Obj (Polygonpunkte, 820 // Kreismittelpunkt, ...) 821 virtual sal_uInt32 GetSnapPointCount() const; 822 virtual Point GetSnapPoint(sal_uInt32 i) const; 823 824 // Fuer Objekte, bei denen jeder einzelne Punkt verschoben werden kann, 825 // z.B. Polygone, Polylines, Linien, ... . Bei diesen Objekten werden 826 // Punkte selektiert (ggf. Mehrfachselektion), geloescht, eingefuegt, 827 // als Mehrfachselektion verschoben und gedreht, ... 828 // Nur solche Objekte koennen PlusHandles haben (z.B. die Gewichte an den 829 // Bezierkurven. 830 virtual sal_Bool IsPolyObj() const; 831 virtual sal_uInt32 GetPointCount() const; 832 virtual Point GetPoint(sal_uInt32 i) const; 833 void SetPoint(const Point& rPnt, sal_uInt32 i); 834 virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i); 835 836 // Alle geometrischen Daten holen fuer's Undo/Redo 837 virtual SdrObjGeoData* GetGeoData() const; 838 virtual void SetGeoData(const SdrObjGeoData& rGeo); 839 840 // ItemSet access 841 const SfxItemSet& GetMergedItemSet() const; 842 void SetMergedItem(const SfxPoolItem& rItem); 843 void ClearMergedItem(const sal_uInt16 nWhich = 0); 844 void SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False); 845 const SfxPoolItem& GetMergedItem(const sal_uInt16 nWhich) const; 846 847 // internal versions 848 protected: 849 const SfxItemSet& GetObjectItemSet() const; 850 void SetObjectItem(const SfxPoolItem& rItem); 851 void ClearObjectItem(const sal_uInt16 nWhich = 0); 852 void SetObjectItemSet(const SfxItemSet& rSet); 853 const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const; 854 855 // get SfxMapUnit the object is using 856 SfxMapUnit GetObjectMapUnit() 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; IsMacroHit(const SdrObjMacroHitRec & rRec) const897 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 behavior 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 IsVirtualObj() const995 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. IsClosedObj() const999 sal_Bool IsClosedObj() const { return bClosedObj; } 1000 IsEdgeObj() const1001 sal_Bool IsEdgeObj() const { return bIsEdge; } Is3DObj() const1002 sal_Bool Is3DObj() const { return bIs3DObj; } IsUnoObj() const1003 sal_Bool IsUnoObj() const { return bIsUnoObj; } IsMasterCachable() const1004 sal_Bool IsMasterCachable() const { return !bNotMasterCachable; } ShareLock()1005 sal_Bool ShareLock() { sal_Bool r=!bNetLock; bNetLock=sal_True; return r; } ShareUnlock()1006 void ShareUnlock() { bNetLock=sal_False; } IsShareLock() const1007 sal_Bool IsShareLock() const { return bNetLock; } SetMarkProtect(sal_Bool bProt)1008 void SetMarkProtect(sal_Bool bProt) { bMarkProt=bProt; } IsMarkProtect() const1009 sal_Bool IsMarkProtect() const { return bMarkProt; } 1010 void SetInserted(sal_Bool bIns); IsInserted() const1011 sal_Bool IsInserted() const { return bInserted; } SetGrouped(sal_Bool bGrp)1012 void SetGrouped(sal_Bool bGrp) { bGrouped=bGrp; } IsGrouped() const1013 sal_Bool IsGrouped() const { return bGrouped; } 1014 void SetMoveProtect(sal_Bool bProt); IsMoveProtect() const1015 sal_Bool IsMoveProtect() const { return bMovProt; } 1016 void SetResizeProtect(sal_Bool bProt); IsResizeProtect() const1017 sal_Bool IsResizeProtect() const { return bSizProt; } 1018 void SetPrintable(sal_Bool bPrn); IsPrintable() const1019 sal_Bool IsPrintable() const { return !bNoPrint; } 1020 void SetVisible(sal_Bool bVisible); IsVisible() const1021 sal_Bool IsVisible() const { return mbVisible; } SetEmptyPresObj(sal_Bool bEpt)1022 void SetEmptyPresObj(sal_Bool bEpt) { bEmptyPresObj=bEpt; } IsEmptyPresObj() const1023 sal_Bool IsEmptyPresObj() const { return bEmptyPresObj; } SetNotVisibleAsMaster(sal_Bool bFlg)1024 void SetNotVisibleAsMaster(sal_Bool bFlg) { bNotVisibleAsMaster=bFlg; } IsNotVisibleAsMaster() const1025 sal_Bool IsNotVisibleAsMaster() const { return bNotVisibleAsMaster; } 1026 1027 // #i25616# LineIsOutsideGeometry() const1028 sal_Bool LineIsOutsideGeometry() const { return mbLineIsOutsideGeometry; } 1029 1030 // #i25616# DoesSupportTextIndentingOnLineWidthChange() const1031 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(); getWeakUnoShape() const1051 ::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: GrantXShapeAccessSdrObject::GrantXShapeAccess1060 GrantXShapeAccess() { } 1061 }; 1062 1063 // 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)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 sense after the import is finished, since the object 1120 // might be resized 1121 Rectangle GetBLIPSizeRectangle() const; 1122 void SetBLIPSizeRectangle( const Rectangle& aRect ); 1123 1124 // #121917# 1125 virtual bool HasText() const; 1126 1127 protected: 1128 void impl_setUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxUnoShape ); 1129 1130 private: 1131 /** only for internal use! 1132 */ 1133 SvxShape* getSvxShape(); 1134 1135 /** do not use directly, always use getSvxShape() if you have to! */ 1136 SvxShape* mpSvxShape; 1137 ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > 1138 maWeakUnoShape; 1139 }; 1140 1141 //************************************************************ 1142 // SdrDummyObj 1143 // 1144 // Wer sich eigene Objekte schafft muss einen Link in der Klasse 1145 // SdrObjFactory setzen. Der Handler hat folgendes aussehen: 1146 // void Hdl(SdrObjFactory*) 1147 // Er muss sich aus der uebergebenen Instanz die Werte nInventor und 1148 // nIdentifier ansehen und entsprechend mit new eine Zeichenobjektinstanz 1149 // erzeugen. Einen Zeiger auf diese Instanz hat er in der Membervariablen 1150 // pNewObj zu hinterlassen. 1151 // 1152 //************************************************************ 1153 1154 class SVX_DLLPUBLIC SdrObjFactory 1155 { 1156 public: 1157 sal_uInt32 nInventor; 1158 sal_uInt16 nIdentifier; 1159 1160 // for MakeNewObj(): 1161 SdrPage* pPage; 1162 SdrModel* pModel; 1163 SdrObject* pNewObj; 1164 1165 // for MakeNewObjUserData(): 1166 SdrObject* pObj; 1167 SdrObjUserData* pNewData; 1168 1169 private: 1170 SVX_DLLPRIVATE SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pNewPage, SdrModel* pNewModel); 1171 SVX_DLLPRIVATE SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj1); 1172 1173 public: 1174 static SdrObject* MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pPage, SdrModel* pModel=NULL); 1175 static void InsertMakeObjectHdl(const Link& rLink); 1176 static void RemoveMakeObjectHdl(const Link& rLink); 1177 static SdrObjUserData* MakeNewObjUserData(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj); 1178 static void InsertMakeUserDataHdl(const Link& rLink); 1179 static void RemoveMakeUserDataHdl(const Link& rLink); 1180 }; 1181 1182 typedef tools::WeakReference< SdrObject > SdrObjectWeakRef; 1183 1184 #endif //_SVDOBJ_HXX 1185 1186 /* vim: set noet sw=4 ts=4: */ 1187