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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26
27 #include <svx/svdorect.hxx>
28 #include <math.h>
29 #include <stdlib.h>
30 #include <svx/xpool.hxx>
31 #include <svx/xpoly.hxx>
32 #include <svx/svdattr.hxx>
33 #include <svx/svdpool.hxx>
34 #include <svx/svdtrans.hxx>
35 #include <svx/svdetc.hxx>
36 #include <svx/svddrag.hxx>
37 #include <svx/svdmodel.hxx>
38 #include <svx/svdpage.hxx>
39 #include <svx/svdocapt.hxx> // fuer Import von SdrFileVersion 2
40 #include <svx/svdpagv.hxx> // fuer
41 #include <svx/svdview.hxx> // das
42 #include <svx/svdundo.hxx> // Macro-Beispiel
43 #include <svx/svdopath.hxx>
44 #include "svx/svdglob.hxx" // Stringcache
45 #include "svx/svdstr.hrc" // Objektname
46 #include <svx/xflclit.hxx>
47 #include <svx/xlnclit.hxx>
48 #include <svx/xlnwtit.hxx>
49 #include "svdoimp.hxx"
50 #include <svx/sdr/properties/rectangleproperties.hxx>
51 #include <svx/sdr/contact/viewcontactofsdrrectobj.hxx>
52 #include <basegfx/polygon/b2dpolygon.hxx>
53 #include <basegfx/polygon/b2dpolygontools.hxx>
54
55 //////////////////////////////////////////////////////////////////////////////
56 // BaseProperties section
57
CreateObjectSpecificProperties()58 sdr::properties::BaseProperties* SdrRectObj::CreateObjectSpecificProperties()
59 {
60 return new sdr::properties::RectangleProperties(*this);
61 }
62
63 //////////////////////////////////////////////////////////////////////////////
64 // DrawContact section
65
CreateObjectSpecificViewContact()66 sdr::contact::ViewContact* SdrRectObj::CreateObjectSpecificViewContact()
67 {
68 return new sdr::contact::ViewContactOfSdrRectObj(*this);
69 }
70
71 //////////////////////////////////////////////////////////////////////////////
72
73 TYPEINIT1(SdrRectObj,SdrTextObj);
74
SdrRectObj()75 SdrRectObj::SdrRectObj()
76 : mpXPoly(0L)
77 {
78 bClosedObj=sal_True;
79 }
80
SdrRectObj(const Rectangle & rRect)81 SdrRectObj::SdrRectObj(const Rectangle& rRect)
82 : SdrTextObj(rRect),
83 mpXPoly(NULL)
84 {
85 bClosedObj=sal_True;
86 }
87
SdrRectObj(SdrObjKind eNewTextKind)88 SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind)
89 : SdrTextObj(eNewTextKind),
90 mpXPoly(NULL)
91 {
92 DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT ||
93 eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT,
94 "SdrRectObj::SdrRectObj(SdrObjKind) ist nur fuer Textrahmen gedacht");
95 bClosedObj=sal_True;
96 }
97
SdrRectObj(SdrObjKind eNewTextKind,const Rectangle & rRect)98 SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rRect)
99 : SdrTextObj(eNewTextKind,rRect),
100 mpXPoly(NULL)
101 {
102 DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT ||
103 eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT,
104 "SdrRectObj::SdrRectObj(SdrObjKind,...) ist nur fuer Textrahmen gedacht");
105 bClosedObj=sal_True;
106 }
107
SdrRectObj(SdrObjKind eNewTextKind,const Rectangle & rNewRect,SvStream & rInput,const String & rBaseURL,sal_uInt16 eFormat)108 SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat)
109 : SdrTextObj(eNewTextKind,rNewRect,rInput,rBaseURL,eFormat),
110 mpXPoly(NULL)
111 {
112 DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT ||
113 eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT,
114 "SdrRectObj::SdrRectObj(SdrObjKind,...) ist nur fuer Textrahmen gedacht");
115 bClosedObj=sal_True;
116 }
117
~SdrRectObj()118 SdrRectObj::~SdrRectObj()
119 {
120 if(mpXPoly)
121 {
122 delete mpXPoly;
123 }
124 }
125
SetXPolyDirty()126 void SdrRectObj::SetXPolyDirty()
127 {
128 if(mpXPoly)
129 {
130 delete mpXPoly;
131 mpXPoly = 0L;
132 }
133 }
134
PaintNeedsXPoly(long nEckRad) const135 FASTBOOL SdrRectObj::PaintNeedsXPoly(long nEckRad) const
136 {
137 FASTBOOL bNeed=aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || nEckRad!=0;
138 return bNeed;
139 }
140
ImpCalcXPoly(const Rectangle & rRect1,long nRad1) const141 XPolygon SdrRectObj::ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const
142 {
143 XPolygon aXPoly(rRect1,nRad1,nRad1);
144 const sal_uInt16 nPointAnz(aXPoly.GetPointCount());
145 XPolygon aNeuPoly(nPointAnz+1);
146 sal_uInt16 nShift=nPointAnz-2;
147 if (nRad1!=0) nShift=nPointAnz-5;
148 sal_uInt16 j=nShift;
149 for (sal_uInt16 i=1; i<nPointAnz; i++) {
150 aNeuPoly[i]=aXPoly[j];
151 aNeuPoly.SetFlags(i,aXPoly.GetFlags(j));
152 j++;
153 if (j>=nPointAnz) j=1;
154 }
155 aNeuPoly[0]=rRect1.BottomCenter();
156 aNeuPoly[nPointAnz]=aNeuPoly[0];
157 aXPoly=aNeuPoly;
158
159 // Die Winkelangaben beziehen sich immer auf die linke obere Ecke von !aRect!
160 if (aGeo.nShearWink!=0) ShearXPoly(aXPoly,aRect.TopLeft(),aGeo.nTan);
161 if (aGeo.nDrehWink!=0) RotateXPoly(aXPoly,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
162 return aXPoly;
163 }
164
RecalcXPoly()165 void SdrRectObj::RecalcXPoly()
166 {
167 mpXPoly = new XPolygon(ImpCalcXPoly(aRect,GetEckenradius()));
168 }
169
GetXPoly() const170 const XPolygon& SdrRectObj::GetXPoly() const
171 {
172 if(!mpXPoly)
173 {
174 ((SdrRectObj*)this)->RecalcXPoly();
175 }
176
177 return *mpXPoly;
178 }
179
TakeObjInfo(SdrObjTransformInfoRec & rInfo) const180 void SdrRectObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
181 {
182 FASTBOOL bNoTextFrame=!IsTextFrame();
183 rInfo.bResizeFreeAllowed=bNoTextFrame || aGeo.nDrehWink%9000==0;
184 rInfo.bResizePropAllowed=sal_True;
185 rInfo.bRotateFreeAllowed=sal_True;
186 rInfo.bRotate90Allowed =sal_True;
187 rInfo.bMirrorFreeAllowed=bNoTextFrame;
188 rInfo.bMirror45Allowed =bNoTextFrame;
189 rInfo.bMirror90Allowed =bNoTextFrame;
190
191 // allow transparence
192 rInfo.bTransparenceAllowed = sal_True;
193
194 // gradient depends on fillstyle
195 XFillStyle eFillStyle = ((XFillStyleItem&)(GetObjectItem(XATTR_FILLSTYLE))).GetValue();
196 rInfo.bGradientAllowed = (eFillStyle == XFILL_GRADIENT);
197
198 rInfo.bShearAllowed =bNoTextFrame;
199 rInfo.bEdgeRadiusAllowed=sal_True;
200
201 FASTBOOL bCanConv=!HasText() || ImpCanConvTextToCurve();
202 if (bCanConv && !bNoTextFrame && !HasText()) {
203 bCanConv=HasFill() || HasLine();
204 }
205 rInfo.bCanConvToPath =bCanConv;
206 rInfo.bCanConvToPoly =bCanConv;
207 rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
208 }
209
GetObjIdentifier() const210 sal_uInt16 SdrRectObj::GetObjIdentifier() const
211 {
212 if (IsTextFrame()) return sal_uInt16(eTextKind);
213 else return sal_uInt16(OBJ_RECT);
214 }
215
TakeUnrotatedSnapRect(Rectangle & rRect) const216 void SdrRectObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
217 {
218 rRect=aRect;
219 if (aGeo.nShearWink!=0) {
220 long nDst=Round((aRect.Bottom()-aRect.Top())*aGeo.nTan);
221 if (aGeo.nShearWink>0) {
222 Point aRef(rRect.TopLeft());
223 rRect.Left()-=nDst;
224 Point aTmpPt(rRect.TopLeft());
225 RotatePoint(aTmpPt,aRef,aGeo.nSin,aGeo.nCos);
226 aTmpPt-=rRect.TopLeft();
227 rRect.Move(aTmpPt.X(),aTmpPt.Y());
228 } else {
229 rRect.Right()-=nDst;
230 }
231 }
232 }
233
TakeObjNameSingul(XubString & rName) const234 void SdrRectObj::TakeObjNameSingul(XubString& rName) const
235 {
236 if (IsTextFrame())
237 {
238 SdrTextObj::TakeObjNameSingul(rName);
239 }
240 else
241 {
242 sal_uInt16 nResId=STR_ObjNameSingulRECT;
243 if (aGeo.nShearWink!=0) {
244 nResId+=4; // Parallelogramm oder Raute
245 // Raute ist nicht, weil Shear die vertikalen Kanten verlaengert!
246 // Wenn Zeit ist, werde ich das mal berechnen.
247 } else {
248 if (aRect.GetWidth()==aRect.GetHeight()) nResId+=2; // Quadrat
249 }
250 if (GetEckenradius()!=0) nResId+=8; // abgerundet
251 rName=ImpGetResStr(nResId);
252
253 String aName( GetName() );
254 if(aName.Len())
255 {
256 rName += sal_Unicode(' ');
257 rName += sal_Unicode('\'');
258 rName += aName;
259 rName += sal_Unicode('\'');
260 }
261 }
262 }
263
TakeObjNamePlural(XubString & rName) const264 void SdrRectObj::TakeObjNamePlural(XubString& rName) const
265 {
266 if (IsTextFrame()) SdrTextObj::TakeObjNamePlural(rName);
267 else {
268 sal_uInt16 nResId=STR_ObjNamePluralRECT;
269 if (aGeo.nShearWink!=0) {
270 nResId+=4; // Parallelogramm oder Raute
271 } else {
272 if (aRect.GetWidth()==aRect.GetHeight()) nResId+=2; // Quadrat
273 }
274 if (GetEckenradius()!=0) nResId+=8; // abgerundet
275 rName=ImpGetResStr(nResId);
276 }
277 }
278
operator =(const SdrObject & rObj)279 void SdrRectObj::operator=(const SdrObject& rObj)
280 {
281 SdrTextObj::operator=(rObj);
282 }
283
TakeXorPoly() const284 basegfx::B2DPolyPolygon SdrRectObj::TakeXorPoly() const
285 {
286 XPolyPolygon aXPP;
287 aXPP.Insert(ImpCalcXPoly(aRect,GetEckenradius()));
288 return aXPP.getB2DPolyPolygon();
289 }
290
RecalcSnapRect()291 void SdrRectObj::RecalcSnapRect()
292 {
293 long nEckRad=GetEckenradius();
294 if ((aGeo.nDrehWink!=0 || aGeo.nShearWink!=0) && nEckRad!=0) {
295 maSnapRect=GetXPoly().GetBoundRect();
296 } else {
297 SdrTextObj::RecalcSnapRect();
298 }
299 }
300
NbcSetSnapRect(const Rectangle & rRect)301 void SdrRectObj::NbcSetSnapRect(const Rectangle& rRect)
302 {
303 SdrTextObj::NbcSetSnapRect(rRect);
304 SetXPolyDirty();
305 }
306
NbcSetLogicRect(const Rectangle & rRect)307 void SdrRectObj::NbcSetLogicRect(const Rectangle& rRect)
308 {
309 SdrTextObj::NbcSetLogicRect(rRect);
310 SetXPolyDirty();
311 }
312
GetHdlCount() const313 sal_uInt32 SdrRectObj::GetHdlCount() const
314 {
315 return IsTextFrame() ? 10 : 9;
316 }
317
GetHdl(sal_uInt32 nHdlNum) const318 SdrHdl* SdrRectObj::GetHdl(sal_uInt32 nHdlNum) const
319 {
320 SdrHdl* pH = NULL;
321 Point aPnt;
322 SdrHdlKind eKind = HDL_MOVE;
323
324 if(!IsTextFrame())
325 {
326 nHdlNum++;
327 }
328
329 switch(nHdlNum)
330 {
331 case 0:
332 {
333 OSL_ENSURE(!IsTextEditActive(), "Do not use a ImpTextframeHdl for hilighting text in active text edit, this will collide with EditEngine paints (!)");
334 pH = new ImpTextframeHdl(aRect);
335 pH->SetObj((SdrObject*)this);
336 pH->SetDrehWink(aGeo.nDrehWink);
337 break;
338 }
339 case 1:
340 {
341 long a = GetEckenradius();
342 long b = Max(aRect.GetWidth(),aRect.GetHeight())/2; // Wird aufgerundet, da GetWidth() eins draufaddiert
343 if (a>b) a=b;
344 if (a<0) a=0;
345 aPnt=aRect.TopLeft();
346 aPnt.X()+=a;
347 eKind = HDL_CIRC;
348 break;
349 }
350 case 2: aPnt=aRect.TopLeft(); eKind = HDL_UPLFT; break; // Oben links
351 case 3: aPnt=aRect.TopCenter(); eKind = HDL_UPPER; break; // Oben
352 case 4: aPnt=aRect.TopRight(); eKind = HDL_UPRGT; break; // Oben rechts
353 case 5: aPnt=aRect.LeftCenter(); eKind = HDL_LEFT ; break; // Links
354 case 6: aPnt=aRect.RightCenter(); eKind = HDL_RIGHT; break; // Rechts
355 case 7: aPnt=aRect.BottomLeft(); eKind = HDL_LWLFT; break; // Unten links
356 case 8: aPnt=aRect.BottomCenter(); eKind = HDL_LOWER; break; // Unten
357 case 9: aPnt=aRect.BottomRight(); eKind = HDL_LWRGT; break; // Unten rechts
358 }
359
360 if(!pH)
361 {
362 if(aGeo.nShearWink)
363 {
364 ShearPoint(aPnt,aRect.TopLeft(),aGeo.nTan);
365 }
366
367 if(aGeo.nDrehWink)
368 {
369 RotatePoint(aPnt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
370 }
371
372 pH = new SdrHdl(aPnt,eKind);
373 pH->SetObj((SdrObject*)this);
374 pH->SetDrehWink(aGeo.nDrehWink);
375 }
376
377 return pH;
378 }
379
380 ////////////////////////////////////////////////////////////////////////////////////////////////////
381
hasSpecialDrag() const382 bool SdrRectObj::hasSpecialDrag() const
383 {
384 return true;
385 }
386
beginSpecialDrag(SdrDragStat & rDrag) const387 bool SdrRectObj::beginSpecialDrag(SdrDragStat& rDrag) const
388 {
389 const bool bRad(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind());
390
391 if(bRad)
392 {
393 rDrag.SetEndDragChangesAttributes(true);
394
395 return true;
396 }
397
398 return SdrTextObj::beginSpecialDrag(rDrag);
399 }
400
applySpecialDrag(SdrDragStat & rDrag)401 bool SdrRectObj::applySpecialDrag(SdrDragStat& rDrag)
402 {
403 const bool bRad(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind());
404
405 if (bRad)
406 {
407 Rectangle aBoundRect0;
408 Point aPt(rDrag.GetNow());
409
410 if(aGeo.nDrehWink)
411 RotatePoint(aPt,aRect.TopLeft(),-aGeo.nSin,aGeo.nCos);
412
413 sal_Int32 nRad(aPt.X() - aRect.Left());
414
415 if (nRad < 0)
416 nRad = 0;
417
418 if(nRad != GetEckenradius())
419 {
420 NbcSetEckenradius(nRad);
421 }
422
423 return true;
424 }
425 else
426 {
427 return SdrTextObj::applySpecialDrag(rDrag);
428 }
429 }
430
getSpecialDragComment(const SdrDragStat & rDrag) const431 String SdrRectObj::getSpecialDragComment(const SdrDragStat& rDrag) const
432 {
433 const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj());
434
435 if(bCreateComment)
436 {
437 return String();
438 }
439 else
440 {
441 const bool bRad(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind());
442
443 if(bRad)
444 {
445 Point aPt(rDrag.GetNow());
446
447 // -sin fuer Umkehrung
448 if(aGeo.nDrehWink)
449 RotatePoint(aPt, aRect.TopLeft(), -aGeo.nSin, aGeo.nCos);
450
451 sal_Int32 nRad(aPt.X() - aRect.Left());
452
453 if(nRad < 0)
454 nRad = 0;
455
456 XubString aStr;
457
458 ImpTakeDescriptionStr(STR_DragRectEckRad, aStr);
459 aStr.AppendAscii(" (");
460 aStr += GetMetrStr(nRad);
461 aStr += sal_Unicode(')');
462
463 return aStr;
464 }
465 else
466 {
467 return SdrTextObj::getSpecialDragComment(rDrag);
468 }
469 }
470 }
471
472 ////////////////////////////////////////////////////////////////////////////////////////////////////
473
TakeCreatePoly(const SdrDragStat & rDrag) const474 basegfx::B2DPolyPolygon SdrRectObj::TakeCreatePoly(const SdrDragStat& rDrag) const
475 {
476 Rectangle aRect1;
477 rDrag.TakeCreateRect(aRect1);
478 aRect1.Justify();
479
480 basegfx::B2DPolyPolygon aRetval;
481 aRetval.append(ImpCalcXPoly(aRect1,GetEckenradius()).getB2DPolygon());
482 return aRetval;
483 }
484
GetCreatePointer() const485 Pointer SdrRectObj::GetCreatePointer() const
486 {
487 if (IsTextFrame()) return Pointer(POINTER_DRAW_TEXT);
488 return Pointer(POINTER_DRAW_RECT);
489 }
490
NbcMove(const Size & rSiz)491 void SdrRectObj::NbcMove(const Size& rSiz)
492 {
493 SdrTextObj::NbcMove(rSiz);
494 SetXPolyDirty();
495 }
496
NbcResize(const Point & rRef,const Fraction & xFact,const Fraction & yFact)497 void SdrRectObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
498 {
499 SdrTextObj::NbcResize(rRef,xFact,yFact);
500 SetXPolyDirty();
501 }
502
NbcRotate(const Point & rRef,long nWink,double sn,double cs)503 void SdrRectObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
504 {
505 SdrTextObj::NbcRotate(rRef,nWink,sn,cs);
506 SetXPolyDirty();
507 }
508
NbcShear(const Point & rRef,long nWink,double tn,FASTBOOL bVShear)509 void SdrRectObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
510 {
511 SdrTextObj::NbcShear(rRef,nWink,tn,bVShear);
512 SetXPolyDirty();
513 }
514
NbcMirror(const Point & rRef1,const Point & rRef2)515 void SdrRectObj::NbcMirror(const Point& rRef1, const Point& rRef2)
516 {
517 SdrTextObj::NbcMirror(rRef1,rRef2);
518 SetXPolyDirty();
519 }
520
DoMacro(const SdrObjMacroHitRec & rRec)521 FASTBOOL SdrRectObj::DoMacro(const SdrObjMacroHitRec& rRec)
522 {
523 return SdrTextObj::DoMacro(rRec);
524 }
525
GetMacroPopupComment(const SdrObjMacroHitRec & rRec) const526 XubString SdrRectObj::GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const
527 {
528 return SdrTextObj::GetMacroPopupComment(rRec);
529 }
530
GetVertexGluePoint(sal_uInt16 nPosNum) const531 SdrGluePoint SdrRectObj::GetVertexGluePoint(sal_uInt16 nPosNum) const
532 {
533 sal_Int32 nWdt = ImpGetLineWdt(); // #i25616# ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
534
535 // #i25616#
536 if(!LineIsOutsideGeometry())
537 {
538 nWdt++;
539 nWdt /= 2;
540 }
541
542 Point aPt;
543 switch (nPosNum) {
544 case 0: aPt=aRect.TopCenter(); aPt.Y()-=nWdt; break;
545 case 1: aPt=aRect.RightCenter(); aPt.X()+=nWdt; break;
546 case 2: aPt=aRect.BottomCenter(); aPt.Y()+=nWdt; break;
547 case 3: aPt=aRect.LeftCenter(); aPt.X()-=nWdt; break;
548 }
549 if (aGeo.nShearWink!=0) ShearPoint(aPt,aRect.TopLeft(),aGeo.nTan);
550 if (aGeo.nDrehWink!=0) RotatePoint(aPt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
551 aPt-=GetSnapRect().Center();
552 SdrGluePoint aGP(aPt);
553 aGP.SetPercent(sal_False);
554 return aGP;
555 }
556
GetCornerGluePoint(sal_uInt16 nPosNum) const557 SdrGluePoint SdrRectObj::GetCornerGluePoint(sal_uInt16 nPosNum) const
558 {
559 sal_Int32 nWdt = ImpGetLineWdt(); // #i25616# ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
560
561 // #i25616#
562 if(!LineIsOutsideGeometry())
563 {
564 nWdt++;
565 nWdt /= 2;
566 }
567
568 Point aPt;
569 switch (nPosNum) {
570 case 0: aPt=aRect.TopLeft(); aPt.X()-=nWdt; aPt.Y()-=nWdt; break;
571 case 1: aPt=aRect.TopRight(); aPt.X()+=nWdt; aPt.Y()-=nWdt; break;
572 case 2: aPt=aRect.BottomRight(); aPt.X()+=nWdt; aPt.Y()+=nWdt; break;
573 case 3: aPt=aRect.BottomLeft(); aPt.X()-=nWdt; aPt.Y()+=nWdt; break;
574 }
575 if (aGeo.nShearWink!=0) ShearPoint(aPt,aRect.TopLeft(),aGeo.nTan);
576 if (aGeo.nDrehWink!=0) RotatePoint(aPt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
577 aPt-=GetSnapRect().Center();
578 SdrGluePoint aGP(aPt);
579 aGP.SetPercent(sal_False);
580 return aGP;
581 }
582
DoConvertToPolyObj(sal_Bool bBezier,bool bAddText) const583 SdrObject* SdrRectObj::DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const
584 {
585 XPolygon aXP(ImpCalcXPoly(aRect,GetEckenradius()));
586 { // #40608# Nur Uebergangsweise bis zum neuen TakeContour()
587 aXP.Remove(0,1);
588 aXP[aXP.GetPointCount()-1]=aXP[0];
589 }
590
591 basegfx::B2DPolyPolygon aPolyPolygon(aXP.getB2DPolygon());
592 aPolyPolygon.removeDoublePoints();
593 SdrObject* pRet = 0L;
594
595 // small correction: Do not create something when no fill and no line. To
596 // be sure to not damage something with non-text frames, do this only
597 // when used with bAddText==false from other converters
598 if((bAddText && !IsTextFrame()) || HasFill() || HasLine())
599 {
600 pRet = ImpConvertMakeObj(aPolyPolygon, sal_True, bBezier);
601 }
602
603 if(bAddText)
604 {
605 pRet = ImpConvertAddText(pRet, bBezier);
606 }
607
608 return pRet;
609 }
610
Notify(SfxBroadcaster & rBC,const SfxHint & rHint)611 void SdrRectObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
612 {
613 SdrTextObj::Notify(rBC,rHint);
614 SetXPolyDirty(); // wg. Eckenradius
615 }
616
RestGeoData(const SdrObjGeoData & rGeo)617 void SdrRectObj::RestGeoData(const SdrObjGeoData& rGeo)
618 {
619 SdrTextObj::RestGeoData(rGeo);
620 SetXPolyDirty();
621 }
622
623 // eof
624