LibreOffice Module svx (master)  1
svdomeas.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <svx/dialmgr.hxx>
21 #include <svx/strings.hrc>
22 
28 #include <editeng/editdata.hxx>
29 #include <editeng/editobj.hxx>
30 #include <editeng/eeitem.hxx>
31 #include <editeng/flditem.hxx>
32 #include <editeng/measfld.hxx>
33 #include <editeng/outlobj.hxx>
34 #include <math.h>
35 #include <svl/style.hxx>
36 
39 #include <svx/svddrag.hxx>
40 #include <svx/svdhdl.hxx>
41 #include <svx/svdmodel.hxx>
42 #include <svx/svdogrp.hxx>
43 #include <svx/svdomeas.hxx>
44 #include <svx/svdopath.hxx>
45 #include <svx/svdoutl.hxx>
46 #include <svx/svdpage.hxx>
47 #include <svx/svdtrans.hxx>
48 #include <svx/svdview.hxx>
49 #include <svx/sxmbritm.hxx>
50 #include <svx/sxmlhitm.hxx>
51 #include <sxmsitm.hxx>
52 #include <sxmtaitm.hxx>
53 #include <svx/sxmtfitm.hxx>
54 #include <svx/sxmtpitm.hxx>
55 #include <svx/sxmtritm.hxx>
56 #include <svx/sxmuitm.hxx>
57 #include <svx/xlnedcit.hxx>
58 #include <svx/xlnedit.hxx>
59 #include <svx/xlnedwit.hxx>
60 #include <svx/xlnstcit.hxx>
61 #include <svx/xlnstit.hxx>
62 #include <svx/xlnstwit.hxx>
63 #include <svx/xlnwtit.hxx>
64 #include <svx/xpoly.hxx>
65 #include <unotools/syslocale.hxx>
67 #include <vcl/ptrstyle.hxx>
68 
69 
72 
73 OUString SdrMeasureObj::TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind) const
74 {
75  OUString aStr;
76  Fraction aMeasureScale(1, 1);
77  bool bTextRota90(false);
78  bool bShowUnit(false);
79  FieldUnit eMeasureUnit(FieldUnit::NONE);
80  FieldUnit eModUIUnit(FieldUnit::NONE);
81 
82  const SfxItemSet& rSet = GetMergedItemSet();
83  bTextRota90 = rSet.Get(SDRATTR_MEASURETEXTROTA90).GetValue();
84  eMeasureUnit = rSet.Get(SDRATTR_MEASUREUNIT).GetValue();
85  aMeasureScale = rSet.Get(SDRATTR_MEASURESCALE).GetValue();
86  bShowUnit = rSet.Get(SDRATTR_MEASURESHOWUNIT).GetValue();
87  sal_Int16 nNumDigits = rSet.Get(SDRATTR_MEASUREDECIMALPLACES).GetValue();
88 
89  switch(eMeasureFieldKind)
90  {
91  case SdrMeasureFieldKind::Value:
92  {
93  eModUIUnit = getSdrModelFromSdrObject().GetUIUnit();
94 
95  if(eMeasureUnit == FieldUnit::NONE)
96  eMeasureUnit = eModUIUnit;
97 
98  sal_Int32 nLen(GetLen(aPt2 - aPt1));
99  Fraction aFact(1,1);
100 
101  if(eMeasureUnit != eModUIUnit)
102  {
103  // for the unit conversion
104  aFact *= GetMapFactor(eModUIUnit, eMeasureUnit).X();
105  }
106 
107  if(aMeasureScale.GetNumerator() != aMeasureScale.GetDenominator())
108  {
109  aFact *= aMeasureScale;
110  }
111 
112  if(aFact.GetNumerator() != aFact.GetDenominator())
113  {
114  // scale via BigInt, to avoid overruns
115  nLen = BigMulDiv(nLen, aFact.GetNumerator(), aFact.GetDenominator());
116  }
117 
118  if(!aFact.IsValid())
119  {
120  aStr = "?";
121  }
122  else
123  {
124  aStr = getSdrModelFromSdrObject().GetMetricString(nLen, true, nNumDigits);
125  }
126 
127  SvtSysLocale aSysLocale;
128  const LocaleDataWrapper& rLocaleDataWrapper = aSysLocale.GetLocaleData();
129  sal_Unicode cDec(rLocaleDataWrapper.getNumDecimalSep()[0]);
130  sal_Unicode cDecAlt(rLocaleDataWrapper.getNumDecimalSepAlt().toChar());
131 
132  if(aStr.indexOf(cDec) != -1 || (cDecAlt && aStr.indexOf(cDecAlt) != -1))
133  {
134  sal_Int32 nLen2(aStr.getLength() - 1);
135 
136  while(aStr[nLen2] == '0')
137  {
138  aStr = aStr.copy(0, nLen2);
139  nLen2--;
140  }
141 
142  if(aStr[nLen2] == cDec || (cDecAlt && aStr[nLen2] == cDecAlt))
143  {
144  aStr = aStr.copy(0, nLen2);
145  nLen2--;
146  }
147 
148  if(aStr.isEmpty())
149  aStr += "0";
150  }
151 
152  break;
153  }
154  case SdrMeasureFieldKind::Unit:
155  {
156  if(bShowUnit)
157  {
158  eModUIUnit = getSdrModelFromSdrObject().GetUIUnit();
159 
160  if(eMeasureUnit == FieldUnit::NONE)
161  eMeasureUnit = eModUIUnit;
162 
163  aStr = SdrModel::GetUnitString(eMeasureUnit);
164  }
165 
166  break;
167  }
168  case SdrMeasureFieldKind::Rotate90Blanks:
169  {
170  if(bTextRota90)
171  {
172  aStr = " ";
173  }
174 
175  break;
176  }
177  }
178  return aStr;
179 }
180 
181 
182 // BaseProperties section
183 
184 std::unique_ptr<sdr::properties::BaseProperties> SdrMeasureObj::CreateObjectSpecificProperties()
185 {
186  return std::make_unique<sdr::properties::MeasureProperties>(*this);
187 }
188 
189 
190 // DrawContact section
191 
192 std::unique_ptr<sdr::contact::ViewContact> SdrMeasureObj::CreateObjectSpecificViewContact()
193 {
194  return std::make_unique<sdr::contact::ViewContactOfSdrMeasureObj>(*this);
195 }
196 
197 
199 : SdrTextObj(rSdrModel),
200  bTextDirty(false)
201 {
202  // #i25616#
204 }
205 
207  SdrModel& rSdrModel,
208  const Point& rPt1,
209  const Point& rPt2)
210 : SdrTextObj(rSdrModel),
211  aPt1(rPt1),
212  aPt2(rPt2),
213  bTextDirty(false)
214 {
215  // #i25616#
217 }
218 
220 {
221 }
222 
224 {
225  rInfo.bMoveAllowed =true;
226  rInfo.bResizeFreeAllowed=true;
227  rInfo.bResizePropAllowed=true;
228  rInfo.bRotateFreeAllowed=true;
229  rInfo.bRotate90Allowed =true;
230  rInfo.bMirrorFreeAllowed=true;
231  rInfo.bMirror45Allowed =true;
232  rInfo.bMirror90Allowed =true;
233  rInfo.bTransparenceAllowed = false;
234  rInfo.bShearAllowed =true;
235  rInfo.bEdgeRadiusAllowed=false;
236  rInfo.bNoOrthoDesired =true;
237  rInfo.bNoContortion =false;
238  rInfo.bCanConvToPath =false;
239  rInfo.bCanConvToPoly =true;
240  rInfo.bCanConvToPathLineToArea=false;
241  rInfo.bCanConvToPolyLineToArea=false;
243 }
244 
246 {
247  return sal_uInt16(OBJ_MEASURE);
248 }
249 
251 {
254  css::drawing::MeasureTextHorzPos eWantTextHPos;
255  css::drawing::MeasureTextVertPos eWantTextVPos;
256  long nLineDist;
266 };
267 
268 namespace {
269 
270 struct ImpLineRec
271 {
272  Point aP1;
273  Point aP2;
274 };
275 
276 }
277 
279 {
280  ImpLineRec aMainline1; // those with the 1st arrowhead
281  ImpLineRec aMainline2; // those with the 2nd arrowhead
282  ImpLineRec aMainline3; // those in between
283  ImpLineRec aHelpline1;
284  ImpLineRec aHelpline2;
286  long nLineLen;
289  long nHlpAngle;
290  double nLineSin;
291  double nLineCos;
292  sal_uInt16 nMainlineCnt;
293  css::drawing::MeasureTextHorzPos eUsedTextHPos;
294  css::drawing::MeasureTextVertPos eUsedTextVPos;
295  long nLineWdt2; // half the line width
296  long nArrow1Len; // length of 1st arrowhead; for Center, use only half
297  long nArrow2Len; // length of 2nd arrowhead; for Center, use only half
298  long nArrow1Wdt; // width of 1st arrow
299  long nArrow2Wdt; // width of 2nd arrow
300  long nShortLineLen; // line length, if PfeileAussen (arrowheads on the outside)
301  bool bAutoUpsideDown; // UpsideDown via automation
303 };
304 
306 {
307  rRec.aPt1 = aPt1;
308  rRec.aPt2 = aPt2;
309 
310  const SfxItemSet& rSet = GetObjectItemSet();
311  rRec.eWantTextHPos =rSet.Get(SDRATTR_MEASURETEXTHPOS ).GetValue();
312  rRec.eWantTextVPos =rSet.Get(SDRATTR_MEASURETEXTVPOS ).GetValue();
313  rRec.nLineDist =rSet.Get(SDRATTR_MEASURELINEDIST ).GetValue();
315  rRec.nHelplineDist =rSet.Get(SDRATTR_MEASUREHELPLINEDIST ).GetValue();
316  rRec.nHelpline1Len =rSet.Get(SDRATTR_MEASUREHELPLINE1LEN ).GetValue();
317  rRec.nHelpline2Len =rSet.Get(SDRATTR_MEASUREHELPLINE2LEN ).GetValue();
318  rRec.bBelowRefEdge =rSet.Get(SDRATTR_MEASUREBELOWREFEDGE ).GetValue();
319  rRec.bTextRota90 =rSet.Get(SDRATTR_MEASURETEXTROTA90 ).GetValue();
321  rRec.bTextAutoAngle =rSet.Get(SDRATTR_MEASURETEXTAUTOANGLE ).GetValue();
323 }
324 
325 static long impGetLineStartEndDistance(const basegfx::B2DPolyPolygon& rPolyPolygon, long nNewWidth, bool bCenter)
326 {
327  const basegfx::B2DRange aPolygonRange(rPolyPolygon.getB2DRange());
328  const double fOldWidth(std::max(aPolygonRange.getWidth(), 1.0));
329  const double fScale(static_cast<double>(nNewWidth) / fOldWidth);
330  long nHeight(basegfx::fround(aPolygonRange.getHeight() * fScale));
331 
332  if(bCenter)
333  {
334  nHeight /= 2;
335  }
336 
337  return nHeight;
338 }
339 
341 {
342  Point aP1(rRec.aPt1);
343  Point aP2(rRec.aPt2);
344  Point aDelt(aP2); aDelt-=aP1;
345 
346  rPol.aTextSize=GetTextSize();
347  rPol.nLineLen=GetLen(aDelt);
348 
349  rPol.nLineWdt2=0;
350  long nArrow1Len=0; bool bArrow1Center=false;
351  long nArrow2Len=0; bool bArrow2Center=false;
352  long nArrow1Wdt=0;
353  long nArrow2Wdt=0;
354  rPol.nArrow1Wdt=0;
355  rPol.nArrow2Wdt=0;
356  long nArrowNeed=0;
357  long nShortLen=0;
358  bool bPfeileAussen = false;
359 
360  const SfxItemSet& rSet = GetObjectItemSet();
361  sal_Int32 nLineWdt = rSet.Get(XATTR_LINEWIDTH).GetValue(); // line width
362  rPol.nLineWdt2 = (nLineWdt + 1) / 2;
363 
364  nArrow1Wdt = rSet.Get(XATTR_LINESTARTWIDTH).GetValue();
365  if(nArrow1Wdt < 0)
366  nArrow1Wdt = -nLineWdt * nArrow1Wdt / 100; // <0 = relative
367 
368  nArrow2Wdt = rSet.Get(XATTR_LINEENDWIDTH).GetValue();
369  if(nArrow2Wdt < 0)
370  nArrow2Wdt = -nLineWdt * nArrow2Wdt / 100; // <0 = relative
371 
372  basegfx::B2DPolyPolygon aPol1(rSet.Get(XATTR_LINESTART).GetLineStartValue());
373  basegfx::B2DPolyPolygon aPol2(rSet.Get(XATTR_LINEEND).GetLineEndValue());
374  bArrow1Center = rSet.Get(XATTR_LINESTARTCENTER).GetValue();
375  bArrow2Center = rSet.Get(XATTR_LINEENDCENTER).GetValue();
376  nArrow1Len = impGetLineStartEndDistance(aPol1, nArrow1Wdt, bArrow1Center) - 1;
377  nArrow2Len = impGetLineStartEndDistance(aPol2, nArrow2Wdt, bArrow2Center) - 1;
378 
379  // nArrowLen is already halved at bCenter.
380  // In the case of 2 arrowheads each 4mm long, we can't go below 10mm.
381  nArrowNeed=nArrow1Len+nArrow2Len+(nArrow1Wdt+nArrow2Wdt)/2;
382  if (rPol.nLineLen<nArrowNeed) bPfeileAussen = true;
383  nShortLen=(nArrow1Len+nArrow1Wdt + nArrow2Len+nArrow2Wdt) /2;
384 
385  rPol.eUsedTextHPos=rRec.eWantTextHPos;
386  rPol.eUsedTextVPos=rRec.eWantTextVPos;
387  if (rPol.eUsedTextVPos == css::drawing::MeasureTextVertPos_AUTO)
388  rPol.eUsedTextVPos = css::drawing::MeasureTextVertPos_EAST;
389  bool bBrkLine=false;
390  if (rPol.eUsedTextVPos == css::drawing::MeasureTextVertPos_CENTERED)
391  {
392  OutlinerParaObject* pOutlinerParaObject = SdrTextObj::GetOutlinerParaObject();
393  if (pOutlinerParaObject!=nullptr && pOutlinerParaObject->GetTextObject().GetParagraphCount()==1)
394  {
395  bBrkLine=true; // dashed line if there's only on paragraph.
396  }
397  }
398  rPol.bBreakedLine=bBrkLine;
399  if (rPol.eUsedTextHPos==css::drawing::MeasureTextHorzPos_AUTO) { // if text is too wide, push it outside
400  bool bOutside = false;
401  long nNeedSiz=!rRec.bTextRota90 ? rPol.aTextSize.Width() : rPol.aTextSize.Height();
402  if (nNeedSiz>rPol.nLineLen) bOutside = true; // text doesn't fit in between
403  if (bBrkLine) {
404  if (nNeedSiz+nArrowNeed>rPol.nLineLen) bPfeileAussen = true; // text fits in between, if arrowheads are on the outside
405  } else {
406  long nSmallNeed=nArrow1Len+nArrow2Len+(nArrow1Wdt+nArrow2Wdt)/2/4;
407  if (nNeedSiz+nSmallNeed>rPol.nLineLen) bPfeileAussen = true; // text fits in between, if arrowheads are on the outside
408  }
409  rPol.eUsedTextHPos=bOutside ? css::drawing::MeasureTextHorzPos_LEFTOUTSIDE : css::drawing::MeasureTextHorzPos_INSIDE;
410  }
411  if (rPol.eUsedTextHPos != css::drawing::MeasureTextHorzPos_INSIDE) bPfeileAussen = true;
412  rPol.nArrow1Wdt=nArrow1Wdt;
413  rPol.nArrow2Wdt=nArrow2Wdt;
414  rPol.nShortLineLen=nShortLen;
415  rPol.nArrow1Len=nArrow1Len;
416  rPol.nArrow2Len=nArrow2Len;
417 
418  rPol.nLineAngle=GetAngle(aDelt);
419  double a = rPol.nLineAngle * F_PI18000;
420  double nLineSin=sin(a);
421  double nLineCos=cos(a);
422  rPol.nLineSin=nLineSin;
423  rPol.nLineCos=nLineCos;
424 
425  rPol.nTextAngle=rPol.nLineAngle;
426  if (rRec.bTextRota90) rPol.nTextAngle+=9000;
427 
428  rPol.bAutoUpsideDown=false;
429  if (rRec.bTextAutoAngle) {
430  long nTmpAngle=NormAngle36000(rPol.nTextAngle-rRec.nTextAutoAngleView);
431  if (nTmpAngle>=18000) {
432  rPol.nTextAngle+=18000;
433  rPol.bAutoUpsideDown=true;
434  }
435  }
436 
437  if (rRec.bTextUpsideDown) rPol.nTextAngle+=18000;
439  rPol.nHlpAngle=rPol.nLineAngle+9000;
440  if (rRec.bBelowRefEdge) rPol.nHlpAngle+=18000;
442  double nHlpSin=nLineCos;
443  double nHlpCos=-nLineSin;
444  if (rRec.bBelowRefEdge) {
445  nHlpSin=-nHlpSin;
446  nHlpCos=-nHlpCos;
447  }
448 
449  long nLineDist=rRec.nLineDist;
450  long nOverhang=rRec.nHelplineOverhang;
451  long nHelplineDist=rRec.nHelplineDist;
452 
453  long dx= FRound(nLineDist*nHlpCos);
454  long dy=-FRound(nLineDist*nHlpSin);
455  long dxh1a= FRound((nHelplineDist-rRec.nHelpline1Len)*nHlpCos);
456  long dyh1a=-FRound((nHelplineDist-rRec.nHelpline1Len)*nHlpSin);
457  long dxh1b= FRound((nHelplineDist-rRec.nHelpline2Len)*nHlpCos);
458  long dyh1b=-FRound((nHelplineDist-rRec.nHelpline2Len)*nHlpSin);
459  long dxh2= FRound((nLineDist+nOverhang)*nHlpCos);
460  long dyh2=-FRound((nLineDist+nOverhang)*nHlpSin);
461 
462  // extension line 1
463  rPol.aHelpline1.aP1=Point(aP1.X()+dxh1a,aP1.Y()+dyh1a);
464  rPol.aHelpline1.aP2=Point(aP1.X()+dxh2,aP1.Y()+dyh2);
465 
466  // extension line 2
467  rPol.aHelpline2.aP1=Point(aP2.X()+dxh1b,aP2.Y()+dyh1b);
468  rPol.aHelpline2.aP2=Point(aP2.X()+dxh2,aP2.Y()+dyh2);
469 
470  // dimension line
471  Point aMainlinePt1(aP1.X()+dx,aP1.Y()+dy);
472  Point aMainlinePt2(aP2.X()+dx,aP2.Y()+dy);
473  if (!bPfeileAussen) {
474  rPol.aMainline1.aP1=aMainlinePt1;
475  rPol.aMainline1.aP2=aMainlinePt2;
476  rPol.aMainline2=rPol.aMainline1;
477  rPol.aMainline3=rPol.aMainline1;
478  rPol.nMainlineCnt=1;
479  if (bBrkLine) {
480  long nNeedSiz=!rRec.bTextRota90 ? rPol.aTextSize.Width() : rPol.aTextSize.Height();
481  long nHalfLen=(rPol.nLineLen-nNeedSiz-nArrow1Wdt/4-nArrow2Wdt/4) /2;
482  rPol.nMainlineCnt=2;
483  rPol.aMainline1.aP2=aMainlinePt1;
484  rPol.aMainline1.aP2.AdjustX(nHalfLen );
485  RotatePoint(rPol.aMainline1.aP2,rPol.aMainline1.aP1,nLineSin,nLineCos);
486  rPol.aMainline2.aP1=aMainlinePt2;
487  rPol.aMainline2.aP1.AdjustX( -nHalfLen );
488  RotatePoint(rPol.aMainline2.aP1,rPol.aMainline2.aP2,nLineSin,nLineCos);
489  }
490  } else {
491  long nLen1=nShortLen; // arrowhead's width as line length outside of the arrowhead
492  long nLen2=nShortLen;
493  long nTextWdt=rRec.bTextRota90 ? rPol.aTextSize.Height() : rPol.aTextSize.Width();
494  if (!bBrkLine) {
495  if (rPol.eUsedTextHPos==css::drawing::MeasureTextHorzPos_LEFTOUTSIDE) nLen1=nArrow1Len+nTextWdt;
496  if (rPol.eUsedTextHPos==css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE) nLen2=nArrow2Len+nTextWdt;
497  }
498  rPol.aMainline1.aP1=aMainlinePt1;
499  rPol.aMainline1.aP2=aMainlinePt1; rPol.aMainline1.aP2.AdjustX( -nLen1 ); RotatePoint(rPol.aMainline1.aP2,aMainlinePt1,nLineSin,nLineCos);
500  rPol.aMainline2.aP1=aMainlinePt2; rPol.aMainline2.aP1.AdjustX(nLen2 ); RotatePoint(rPol.aMainline2.aP1,aMainlinePt2,nLineSin,nLineCos);
501  rPol.aMainline2.aP2=aMainlinePt2;
502  rPol.aMainline3.aP1=aMainlinePt1;
503  rPol.aMainline3.aP2=aMainlinePt2;
504  rPol.nMainlineCnt=3;
505  if (bBrkLine && rPol.eUsedTextHPos==css::drawing::MeasureTextHorzPos_INSIDE) rPol.nMainlineCnt=2;
506  }
507 }
508 
510 {
511  basegfx::B2DPolyPolygon aRetval;
512  basegfx::B2DPolygon aPartPolyA;
513  aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline1.aP1.X(), rPol.aMainline1.aP1.Y()));
514  aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline1.aP2.X(), rPol.aMainline1.aP2.Y()));
515  aRetval.append(aPartPolyA);
516 
517  if(rPol.nMainlineCnt > 1)
518  {
519  aPartPolyA.clear();
520  aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline2.aP1.X(), rPol.aMainline2.aP1.Y()));
521  aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline2.aP2.X(), rPol.aMainline2.aP2.Y()));
522  aRetval.append(aPartPolyA);
523  }
524 
525  if(rPol.nMainlineCnt > 2)
526  {
527  aPartPolyA.clear();
528  aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline3.aP1.X(), rPol.aMainline3.aP1.Y()));
529  aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline3.aP2.X(), rPol.aMainline3.aP2.Y()));
530  aRetval.append(aPartPolyA);
531  }
532 
533  aPartPolyA.clear();
534  aPartPolyA.append(basegfx::B2DPoint(rPol.aHelpline1.aP1.X(), rPol.aHelpline1.aP1.Y()));
535  aPartPolyA.append(basegfx::B2DPoint(rPol.aHelpline1.aP2.X(), rPol.aHelpline1.aP2.Y()));
536  aRetval.append(aPartPolyA);
537 
538  aPartPolyA.clear();
539  aPartPolyA.append(basegfx::B2DPoint(rPol.aHelpline2.aP1.X(), rPol.aHelpline2.aP1.Y()));
540  aPartPolyA.append(basegfx::B2DPoint(rPol.aHelpline2.aP2.X(), rPol.aHelpline2.aP2.Y()));
541  aRetval.append(aPartPolyA);
542 
543  return aRetval;
544 }
545 
546 bool SdrMeasureObj::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos,
547  bool bEdit,
548  std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, OUString& rRet) const
549 {
550  const SvxFieldData* pField=rField.GetField();
551  const SdrMeasureField* pMeasureField=dynamic_cast<const SdrMeasureField*>( pField );
552  if (pMeasureField!=nullptr) {
553  rRet = TakeRepresentation(pMeasureField->GetMeasureFieldKind());
554  if (rpFldColor && !bEdit)
555  {
556  rpFldColor.reset();
557  }
558  return true;
559  } else {
560  return SdrTextObj::CalcFieldValue(rField,nPara,nPos,bEdit,rpTxtColor,rpFldColor,rRet);
561  }
562 }
563 
565 {
566  if (bTextDirty)
567  {
568  SdrOutliner& rOutliner=ImpGetDrawOutliner();
569  OutlinerParaObject* pOutlinerParaObject = SdrTextObj::GetOutlinerParaObject();
570  if(pOutlinerParaObject==nullptr)
571  {
572  rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SdrMeasureFieldKind::Rotate90Blanks), EE_FEATURE_FIELD), ESelection(0,0));
573  rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SdrMeasureFieldKind::Value), EE_FEATURE_FIELD),ESelection(0,1));
574  rOutliner.QuickInsertText(" ", ESelection(0,2));
575  rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SdrMeasureFieldKind::Unit), EE_FEATURE_FIELD),ESelection(0,3));
576  rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SdrMeasureFieldKind::Rotate90Blanks), EE_FEATURE_FIELD),ESelection(0,4));
577 
578  if(GetStyleSheet())
579  rOutliner.SetStyleSheet(0, GetStyleSheet());
580 
581  rOutliner.SetParaAttribs(0, GetObjectItemSet());
582 
583  // cast to nonconst
584  const_cast<SdrMeasureObj*>(this)->NbcSetOutlinerParaObject( rOutliner.CreateParaObject() );
585  }
586  else
587  {
588  rOutliner.SetText(*pOutlinerParaObject);
589  }
590 
591  rOutliner.SetUpdateMode(true);
592  rOutliner.UpdateFields();
593  Size aSiz(rOutliner.CalcTextSize());
594  rOutliner.Clear();
595  // cast to nonconst three times
596  const_cast<SdrMeasureObj*>(this)->aTextSize=aSiz;
597  const_cast<SdrMeasureObj*>(this)->bTextSizeDirty=false;
598  const_cast<SdrMeasureObj*>(this)->bTextDirty=false;
599  }
600 }
601 
603 {
604  if (bTextDirty) UndirtyText();
605  ImpMeasureRec aRec;
606  ImpMeasurePoly aMPol;
607  ImpTakeAttr(aRec);
608  ImpCalcGeometrics(aRec,aMPol);
609 
610  // determine TextSize including text frame margins
611  Size aTextSize2(aMPol.aTextSize);
612  if (aTextSize2.Width()<1) aTextSize2.setWidth(1 );
613  if (aTextSize2.Height()<1) aTextSize2.setHeight(1 );
616 
617  Point aPt1b(aMPol.aMainline1.aP1);
618  long nLen=aMPol.nLineLen;
619  long nLWdt=aMPol.nLineWdt2;
620  long nArr1Len=aMPol.nArrow1Len;
621  long nArr2Len=aMPol.nArrow2Len;
622  if (aMPol.bBreakedLine) {
623  // In the case of a dashed line and Outside, the text should be
624  // placed next to the line at the arrowhead instead of directly
625  // at the arrowhead.
626  nArr1Len=aMPol.nShortLineLen+aMPol.nArrow1Wdt/4;
627  nArr2Len=aMPol.nShortLineLen+aMPol.nArrow2Wdt/4;
628  }
629 
630  Point aTextPos;
631  bool bRota90=aRec.bTextRota90;
632  bool bUpsideDown=aRec.bTextUpsideDown!=aMPol.bAutoUpsideDown;
633  bool bBelowRefEdge=aRec.bBelowRefEdge;
634  css::drawing::MeasureTextHorzPos eMH=aMPol.eUsedTextHPos;
635  css::drawing::MeasureTextVertPos eMV=aMPol.eUsedTextVPos;
636  if (!bRota90) {
637  switch (eMH) {
638  case css::drawing::MeasureTextHorzPos_LEFTOUTSIDE: aTextPos.setX(aPt1b.X()-aTextSize2.Width()-nArr1Len-nLWdt ); break;
639  case css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE: aTextPos.setX(aPt1b.X()+nLen+nArr2Len+nLWdt ); break;
640  default: aTextPos.setX(aPt1b.X() ); aTextSize2.setWidth(nLen );
641  }
642  switch (eMV) {
643  case css::drawing::MeasureTextVertPos_CENTERED:
644  aTextPos.setY(aPt1b.Y()-aTextSize2.Height()/2 ); break;
645  case css::drawing::MeasureTextVertPos_WEST: {
646  if (!bUpsideDown) aTextPos.setY(aPt1b.Y()+nLWdt );
647  else aTextPos.setY(aPt1b.Y()-aTextSize2.Height()-nLWdt );
648  } break;
649  default: {
650  if (!bUpsideDown) aTextPos.setY(aPt1b.Y()-aTextSize2.Height()-nLWdt );
651  else aTextPos.setY(aPt1b.Y()+nLWdt );
652  }
653  }
654  if (bUpsideDown) {
655  aTextPos.AdjustX(aTextSize2.Width() );
656  aTextPos.AdjustY(aTextSize2.Height() );
657  }
658  } else { // also if bTextRota90==TRUE
659  switch (eMH) {
660  case css::drawing::MeasureTextHorzPos_LEFTOUTSIDE: aTextPos.setX(aPt1b.X()-aTextSize2.Height()-nArr1Len ); break;
661  case css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE: aTextPos.setX(aPt1b.X()+nLen+nArr2Len ); break;
662  default: aTextPos.setX(aPt1b.X() ); aTextSize2.setHeight(nLen );
663  }
664  switch (eMV) {
665  case css::drawing::MeasureTextVertPos_CENTERED:
666  aTextPos.setY(aPt1b.Y()+aTextSize2.Width()/2 ); break;
667  case css::drawing::MeasureTextVertPos_WEST: {
668  if (!bBelowRefEdge) aTextPos.setY(aPt1b.Y()+aTextSize2.Width()+nLWdt );
669  else aTextPos.setY(aPt1b.Y()-nLWdt );
670  } break;
671  default: {
672  if (!bBelowRefEdge) aTextPos.setY(aPt1b.Y()-nLWdt );
673  else aTextPos.setY(aPt1b.Y()+aTextSize2.Width()+nLWdt );
674  }
675  }
676  if (bUpsideDown) {
677  aTextPos.AdjustX(aTextSize2.Height() );
678  aTextPos.AdjustY( -(aTextSize2.Width()) );
679  }
680  }
681  if (aMPol.nTextAngle!=aGeo.nRotationAngle) {
682  const_cast<SdrMeasureObj*>(this)->aGeo.nRotationAngle=aMPol.nTextAngle;
683  const_cast<SdrMeasureObj*>(this)->aGeo.RecalcSinCos();
684  }
685  RotatePoint(aTextPos,aPt1b,aMPol.nLineSin,aMPol.nLineCos);
686  aTextSize2.AdjustWidth( 1 ); aTextSize2.AdjustHeight( 1 ); // because of the Rect-Ctor's odd behavior
687  rRect=tools::Rectangle(aTextPos,aTextSize2);
688  rRect.Justify();
689  const_cast<SdrMeasureObj*>(this)->maRect=rRect;
690 
691  if (aMPol.nTextAngle!=aGeo.nRotationAngle) {
692  const_cast<SdrMeasureObj*>(this)->aGeo.nRotationAngle=aMPol.nTextAngle;
693  const_cast<SdrMeasureObj*>(this)->aGeo.RecalcSinCos();
694  }
695 }
696 
698 {
699  return CloneHelper< SdrMeasureObj >(rTargetModel);
700 }
701 
703 {
704  if( this == &rObj )
705  return *this;
706  SdrTextObj::operator=(rObj);
707 
708  aPt1 = rObj.aPt1;
709  aPt2 = rObj.aPt2;
710  bTextDirty = rObj.bTextDirty;
711 
712  return *this;
713 }
714 
716 {
717  OUStringBuffer sName(SvxResId(STR_ObjNameSingulMEASURE));
718 
719  OUString aName( GetName() );
720  if (!aName.isEmpty())
721  {
722  sName.append(' ');
723  sName.append('\'');
724  sName.append(aName);
725  sName.append('\'');
726  }
727 
728  return sName.makeStringAndClear();
729 }
730 
732 {
733  return SvxResId(STR_ObjNamePluralMEASURE);
734 }
735 
737 {
738  ImpMeasureRec aRec;
739  ImpMeasurePoly aMPol;
740  ImpTakeAttr(aRec);
741  ImpCalcGeometrics(aRec,aMPol);
742  return ImpCalcXPoly(aMPol);
743 }
744 
745 sal_uInt32 SdrMeasureObj::GetHdlCount() const
746 {
747  return 6;
748 }
749 
751 {
752  ImpMeasureRec aRec;
753  ImpMeasurePoly aMPol;
754  ImpTakeAttr(aRec);
755  aRec.nHelplineDist=0;
756  ImpCalcGeometrics(aRec,aMPol);
757 
758  for (sal_uInt32 nHdlNum=0; nHdlNum<6; ++nHdlNum)
759  {
760  Point aPt;
761  switch (nHdlNum) {
762  case 0: aPt=aMPol.aHelpline1.aP1; break;
763  case 1: aPt=aMPol.aHelpline2.aP1; break;
764  case 2: aPt=aPt1; break;
765  case 3: aPt=aPt2; break;
766  case 4: aPt=aMPol.aHelpline1.aP2; break;
767  case 5: aPt=aMPol.aHelpline2.aP2; break;
768  } // switch
769  std::unique_ptr<SdrHdl> pHdl(new ImpMeasureHdl(aPt,SdrHdlKind::User));
770  pHdl->SetObjHdlNum(nHdlNum);
771  pHdl->SetRotationAngle(aMPol.nLineAngle);
772  rHdlList.AddHdl(std::move(pHdl));
773  }
774 }
775 
776 
778 {
779  return true;
780 }
781 
783 {
784  const SdrHdl* pHdl = rDrag.GetHdl();
785 
786  if(pHdl)
787  {
788  const sal_uInt32 nHdlNum(pHdl->GetObjHdlNum());
789 
790  if(nHdlNum != 2 && nHdlNum != 3)
791  {
792  rDrag.SetEndDragChangesAttributes(true);
793  }
794 
795  return true;
796  }
797 
798  return false;
799 }
800 
802 {
803  ImpMeasureRec aMeasureRec;
804  const SdrHdl* pHdl = rDrag.GetHdl();
805  const sal_uInt32 nHdlNum(pHdl->GetObjHdlNum());
806 
807  ImpTakeAttr(aMeasureRec);
808  ImpEvalDrag(aMeasureRec, rDrag);
809 
810  switch (nHdlNum)
811  {
812  case 2:
813  {
814  aPt1 = aMeasureRec.aPt1;
815  SetTextDirty();
816  break;
817  }
818  case 3:
819  {
820  aPt2 = aMeasureRec.aPt2;
821  SetTextDirty();
822  break;
823  }
824  default:
825  {
826  switch(nHdlNum)
827  {
828  case 0:
829  case 1:
830  {
831  ImpMeasureRec aOrigMeasureRec;
832  ImpTakeAttr(aOrigMeasureRec);
833 
834  if(aMeasureRec.nHelpline1Len != aOrigMeasureRec.nHelpline1Len)
835  {
837  }
838 
839  if(aMeasureRec.nHelpline2Len != aOrigMeasureRec.nHelpline2Len)
840  {
842  }
843 
844  break;
845  }
846 
847  case 4:
848  case 5:
849  {
850  ImpMeasureRec aOrigMeasureRec;
851  ImpTakeAttr(aOrigMeasureRec);
852 
853  if(aMeasureRec.nLineDist != aOrigMeasureRec.nLineDist)
854  {
856  }
857 
858  if(aMeasureRec.bBelowRefEdge != aOrigMeasureRec.bBelowRefEdge)
859  {
861  }
862  }
863  }
864  }
865  } // switch
866 
867  SetRectsDirty();
868  SetChanged();
869 
870  return true;
871 }
872 
873 OUString SdrMeasureObj::getSpecialDragComment(const SdrDragStat& /*rDrag*/) const
874 {
875  return OUString();
876 }
877 
878 void SdrMeasureObj::ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) const
879 {
880  long nLineAngle=GetAngle(rRec.aPt2-rRec.aPt1);
881  double a = nLineAngle * F_PI18000;
882  double nSin=sin(a);
883  double nCos=cos(a);
884 
885  const SdrHdl* pHdl=rDrag.GetHdl();
886  sal_uInt32 nHdlNum(pHdl->GetObjHdlNum());
887  bool bOrtho=rDrag.GetView()!=nullptr && rDrag.GetView()->IsOrtho();
888  bool bBigOrtho=bOrtho && rDrag.GetView()->IsBigOrtho();
889  bool bBelow=rRec.bBelowRefEdge;
890  Point aPt(rDrag.GetNow());
891 
892  switch (nHdlNum) {
893  case 0: {
894  RotatePoint(aPt,aPt1,nSin,-nCos);
895  rRec.nHelpline1Len=aPt1.Y()-aPt.Y();
896  if (bBelow) rRec.nHelpline1Len=-rRec.nHelpline1Len;
897  if (bOrtho) rRec.nHelpline2Len=rRec.nHelpline1Len;
898  } break;
899  case 1: {
900  RotatePoint(aPt,aPt2,nSin,-nCos);
901  rRec.nHelpline2Len=aPt2.Y()-aPt.Y();
902  if (bBelow) rRec.nHelpline2Len=-rRec.nHelpline2Len;
903  if (bOrtho) rRec.nHelpline1Len=rRec.nHelpline2Len;
904  } break;
905  case 2: case 3: {
906  bool bAnf=nHdlNum==2;
907  Point& rMov=bAnf ? rRec.aPt1 : rRec.aPt2;
908  Point aMov(rMov);
909  Point aFix(bAnf ? rRec.aPt2 : rRec.aPt1);
910  if (bOrtho) {
911  long ndx0=aMov.X()-aFix.X();
912  long ndy0=aMov.Y()-aFix.Y();
913  bool bHLin=ndy0==0;
914  bool bVLin=ndx0==0;
915  if (!bHLin || !bVLin) { // else aPt1==aPt2
916  long ndx=aPt.X()-aFix.X();
917  long ndy=aPt.Y()-aFix.Y();
918  double nXFact=0; if (!bVLin) nXFact=static_cast<double>(ndx)/static_cast<double>(ndx0);
919  double nYFact=0; if (!bHLin) nYFact=static_cast<double>(ndy)/static_cast<double>(ndy0);
920  bool bHor=bHLin || (!bVLin && (nXFact>nYFact) ==bBigOrtho);
921  bool bVer=bVLin || (!bHLin && (nXFact<=nYFact)==bBigOrtho);
922  if (bHor) ndy=long(ndy0*nXFact);
923  if (bVer) ndx=long(ndx0*nYFact);
924  aPt=aFix;
925  aPt.AdjustX(ndx );
926  aPt.AdjustY(ndy );
927  } // else Ortho8
928  }
929  rMov=aPt;
930  } break;
931  case 4: case 5: {
932  long nVal0=rRec.nLineDist;
933  RotatePoint(aPt,(nHdlNum==4 ? aPt1 : aPt2),nSin,-nCos);
934  rRec.nLineDist=aPt.Y()- (nHdlNum==4 ? aPt1.Y() : aPt2.Y());
935  if (bBelow) rRec.nLineDist=-rRec.nLineDist;
936  if (rRec.nLineDist<0) {
937  rRec.nLineDist=-rRec.nLineDist;
938  rRec.bBelowRefEdge=!bBelow;
939  }
940  rRec.nLineDist-=rRec.nHelplineOverhang;
941  if (bOrtho) rRec.nLineDist=nVal0;
942  } break;
943  } // switch
944 }
945 
946 
948 {
949  rStat.SetOrtho8Possible();
950  aPt1=rStat.GetStart();
951  aPt2=rStat.GetNow();
952  SetTextDirty();
953  return true;
954 }
955 
957 {
958  SdrView* pView=rStat.GetView();
959  aPt1=rStat.GetStart();
960  aPt2=rStat.GetNow();
961  if (pView!=nullptr && pView->IsCreate1stPointAsCenter()) {
962  aPt1+=aPt1;
963  aPt1-=rStat.GetNow();
964  }
965  SetTextDirty();
967  bSnapRectDirty=true;
968  return true;
969 }
970 
972 {
973  SetTextDirty();
974  SetRectsDirty();
975  return (eCmd==SdrCreateCmd::ForceEnd || rStat.GetPointCount()>=2);
976 }
977 
979 {
980  return false;
981 }
982 
984 {
985 }
986 
988 {
989  ImpMeasureRec aRec;
990  ImpMeasurePoly aMPol;
991 
992  ImpTakeAttr(aRec);
993  ImpCalcGeometrics(aRec, aMPol);
994 
995  return ImpCalcXPoly(aMPol);
996 }
997 
999 {
1000  return PointerStyle::Cross;
1001 }
1002 
1003 void SdrMeasureObj::NbcMove(const Size& rSiz)
1004 {
1005  SdrTextObj::NbcMove(rSiz);
1006  aPt1.Move(rSiz);
1007  aPt2.Move(rSiz);
1008 }
1009 
1010 void SdrMeasureObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
1011 {
1012  SdrTextObj::NbcResize(rRef,xFact,yFact);
1013  ResizePoint(aPt1,rRef,xFact,yFact);
1014  ResizePoint(aPt2,rRef,xFact,yFact);
1015  SetTextDirty();
1016 }
1017 
1018 void SdrMeasureObj::NbcRotate(const Point& rRef, long nAngle, double sn, double cs)
1019 {
1020  SdrTextObj::NbcRotate(rRef,nAngle,sn,cs);
1021  long nLen0=GetLen(aPt2-aPt1);
1022  RotatePoint(aPt1,rRef,sn,cs);
1023  RotatePoint(aPt2,rRef,sn,cs);
1024  long nLen1=GetLen(aPt2-aPt1);
1025  if (nLen1!=nLen0) { // rounding error!
1026  long dx=aPt2.X()-aPt1.X();
1027  long dy=aPt2.Y()-aPt1.Y();
1028  dx=BigMulDiv(dx,nLen0,nLen1);
1029  dy=BigMulDiv(dy,nLen0,nLen1);
1030  if (rRef==aPt2) {
1031  aPt1.setX(aPt2.X()-dx );
1032  aPt1.setY(aPt2.Y()-dy );
1033  } else {
1034  aPt2.setX(aPt1.X()+dx );
1035  aPt2.setY(aPt1.Y()+dy );
1036  }
1037  }
1038  SetRectsDirty();
1039 }
1040 
1041 void SdrMeasureObj::NbcMirror(const Point& rRef1, const Point& rRef2)
1042 {
1043  SdrTextObj::NbcMirror(rRef1,rRef2);
1044  MirrorPoint(aPt1,rRef1,rRef2);
1045  MirrorPoint(aPt2,rRef1,rRef2);
1046  SetRectsDirty();
1047 }
1048 
1049 void SdrMeasureObj::NbcShear(const Point& rRef, long nAngle, double tn, bool bVShear)
1050 {
1051  SdrTextObj::NbcShear(rRef,nAngle,tn,bVShear);
1052  ShearPoint(aPt1,rRef,tn,bVShear);
1053  ShearPoint(aPt2,rRef,tn,bVShear);
1054  SetRectsDirty();
1055  SetTextDirty();
1056 }
1057 
1059 {
1060  return GetAngle(aPt2-aPt1);
1061 }
1062 
1064 {
1065  ImpMeasureRec aRec;
1066  ImpMeasurePoly aMPol;
1067  XPolyPolygon aXPP;
1068 
1069  ImpTakeAttr(aRec);
1070  ImpCalcGeometrics(aRec, aMPol);
1071  aXPP = XPolyPolygon(ImpCalcXPoly(aMPol));
1072  maSnapRect = aXPP.GetBoundRect();
1073 }
1074 
1076 {
1077  return 2;
1078 }
1079 
1081 {
1082  if (i==0) return aPt1;
1083  else return aPt2;
1084 }
1085 
1087 {
1088  return true;
1089 }
1090 
1092 {
1093  return 2;
1094 }
1095 
1096 Point SdrMeasureObj::GetPoint(sal_uInt32 i) const
1097 {
1098  return (0 == i) ? aPt1 : aPt2;
1099 }
1100 
1101 void SdrMeasureObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
1102 {
1103  if (0 == i)
1104  aPt1=rPnt;
1105  if (1 == i)
1106  aPt2=rPnt;
1107  SetRectsDirty();
1108  SetTextDirty();
1109 }
1110 
1112 {
1113  return new SdrMeasureObjGeoData;
1114 }
1115 
1117 {
1119  SdrMeasureObjGeoData& rMGeo=static_cast<SdrMeasureObjGeoData&>(rGeo);
1120  rMGeo.aPt1=aPt1;
1121  rMGeo.aPt2=aPt2;
1122 }
1123 
1125 {
1127  const SdrMeasureObjGeoData& rMGeo=static_cast<const SdrMeasureObjGeoData&>(rGeo);
1128  aPt1=rMGeo.aPt1;
1129  aPt2=rMGeo.aPt2;
1130  SetTextDirty();
1131 }
1132 
1133 SdrObjectUniquePtr SdrMeasureObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
1134 {
1135  // get XOR Poly as base
1136  XPolyPolygon aTmpPolyPolygon(TakeXorPoly());
1137 
1138  // get local ItemSet and StyleSheet
1139  SfxItemSet aSet(GetObjectItemSet());
1140  SfxStyleSheet* pStyleSheet = GetStyleSheet();
1141 
1142  // prepare group
1143  std::unique_ptr<SdrObjGroup,SdrObjectFreeOp> pGroup(new SdrObjGroup(getSdrModelFromSdrObject()));
1144 
1145  // prepare parameters
1146  basegfx::B2DPolyPolygon aPolyPoly;
1147  SdrPathObj* pPath;
1148  sal_uInt16 nCount(aTmpPolyPolygon.Count());
1149  sal_uInt16 nLoopStart(0);
1150 
1151  if(nCount == 3)
1152  {
1153  // three lines, first one is the middle one
1154  aPolyPoly.clear();
1155  aPolyPoly.append(aTmpPolyPolygon[0].getB2DPolygon());
1156 
1157  pPath = new SdrPathObj(
1159  OBJ_PATHLINE,
1160  aPolyPoly);
1161 
1162  pPath->SetMergedItemSet(aSet);
1163  pPath->SetStyleSheet(pStyleSheet, true);
1164  pGroup->GetSubList()->NbcInsertObject(pPath);
1165  aSet.Put(XLineStartWidthItem(0));
1166  aSet.Put(XLineEndWidthItem(0));
1167  nLoopStart = 1;
1168  }
1169  else if(nCount == 4)
1170  {
1171  // four lines, middle line with gap, so there are two lines used
1172  // which have one arrow each
1173  sal_Int32 nEndWidth = aSet.Get(XATTR_LINEENDWIDTH).GetValue();
1174  aSet.Put(XLineEndWidthItem(0));
1175 
1176  aPolyPoly.clear();
1177  aPolyPoly.append(aTmpPolyPolygon[0].getB2DPolygon());
1178  pPath = new SdrPathObj(
1180  OBJ_PATHLINE,
1181  aPolyPoly);
1182 
1183  pPath->SetMergedItemSet(aSet);
1184  pPath->SetStyleSheet(pStyleSheet, true);
1185 
1186  pGroup->GetSubList()->NbcInsertObject(pPath);
1187 
1188  aSet.Put(XLineEndWidthItem(nEndWidth));
1189  aSet.Put(XLineStartWidthItem(0));
1190 
1191  aPolyPoly.clear();
1192  aPolyPoly.append(aTmpPolyPolygon[1].getB2DPolygon());
1193  pPath = new SdrPathObj(
1195  OBJ_PATHLINE,
1196  aPolyPoly);
1197 
1198  pPath->SetMergedItemSet(aSet);
1199  pPath->SetStyleSheet(pStyleSheet, true);
1200 
1201  pGroup->GetSubList()->NbcInsertObject(pPath);
1202 
1203  aSet.Put(XLineEndWidthItem(0));
1204  nLoopStart = 2;
1205  }
1206  else if(nCount == 5)
1207  {
1208  // five lines, first two are the outer ones
1209  sal_Int32 nEndWidth = aSet.Get(XATTR_LINEENDWIDTH).GetValue();
1210 
1211  aSet.Put(XLineEndWidthItem(0));
1212 
1213  aPolyPoly.clear();
1214  aPolyPoly.append(aTmpPolyPolygon[0].getB2DPolygon());
1215  pPath = new SdrPathObj(
1217  OBJ_PATHLINE,
1218  aPolyPoly);
1219 
1220  pPath->SetMergedItemSet(aSet);
1221  pPath->SetStyleSheet(pStyleSheet, true);
1222 
1223  pGroup->GetSubList()->NbcInsertObject(pPath);
1224 
1225  aSet.Put(XLineEndWidthItem(nEndWidth));
1226  aSet.Put(XLineStartWidthItem(0));
1227 
1228  aPolyPoly.clear();
1229  aPolyPoly.append(aTmpPolyPolygon[1].getB2DPolygon());
1230  pPath = new SdrPathObj(
1232  OBJ_PATHLINE,
1233  aPolyPoly);
1234 
1235  pPath->SetMergedItemSet(aSet);
1236  pPath->SetStyleSheet(pStyleSheet, true);
1237 
1238  pGroup->GetSubList()->NbcInsertObject(pPath);
1239 
1240  aSet.Put(XLineEndWidthItem(0));
1241  nLoopStart = 2;
1242  }
1243 
1244  for(;nLoopStart<nCount;nLoopStart++)
1245  {
1246  aPolyPoly.clear();
1247  aPolyPoly.append(aTmpPolyPolygon[nLoopStart].getB2DPolygon());
1248  pPath = new SdrPathObj(
1250  OBJ_PATHLINE,
1251  aPolyPoly);
1252 
1253  pPath->SetMergedItemSet(aSet);
1254  pPath->SetStyleSheet(pStyleSheet, true);
1255 
1256  pGroup->GetSubList()->NbcInsertObject(pPath);
1257  }
1258 
1259  if(bAddText)
1260  {
1261  return ImpConvertAddText(std::move(pGroup), bBezier);
1262  }
1263  else
1264  {
1265  return pGroup;
1266  }
1267 }
1268 
1270 {
1271  UndirtyText();
1272  return SdrTextObj::BegTextEdit(rOutl);
1273 }
1274 
1276 {
1277  if (bTextDirty) UndirtyText();
1278  return SdrTextObj::GetTextSize();
1279 }
1280 
1282 {
1283  if(bTextDirty)
1284  UndirtyText();
1286 }
1287 
1288 void SdrMeasureObj::NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject)
1289 {
1290  SdrTextObj::NbcSetOutlinerParaObject(std::move(pTextObject));
1292  SetTextDirty(); // recalculate text
1293 }
1294 
1295 void SdrMeasureObj::TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText,
1296  tools::Rectangle* pAnchorRect, bool bLineWidth ) const
1297 {
1298  if (bTextDirty) UndirtyText();
1299  SdrTextObj::TakeTextRect( rOutliner, rTextRect, bNoEditText, pAnchorRect, bLineWidth );
1300 }
1301 
1303 {
1304  if (bTextDirty) UndirtyText();
1305  SdrTextObj::TakeTextAnchorRect(rAnchorRect);
1306 }
1307 
1308 void SdrMeasureObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const
1309 {
1310  if (bTextDirty) UndirtyText();
1311  SdrTextObj::TakeTextEditArea(pPaperMin,pPaperMax,pViewInit,pViewMin);
1312 }
1313 
1315 {
1316  if (bTextDirty) UndirtyText();
1317  ImpMeasureRec aRec;
1318  ImpMeasurePoly aMPol;
1319  ImpTakeAttr(aRec);
1320  ImpCalcGeometrics(aRec,aMPol);
1321 
1324  css::drawing::MeasureTextHorzPos eMH = aMPol.eUsedTextHPos;
1325  css::drawing::MeasureTextVertPos eMV = aMPol.eUsedTextVPos;
1326  bool bTextRota90=aRec.bTextRota90;
1327  bool bBelowRefEdge=aRec.bBelowRefEdge;
1328 
1329  // TODO: bTextUpsideDown should be interpreted here!
1330  if (!bTextRota90) {
1331  if (eMH==css::drawing::MeasureTextHorzPos_LEFTOUTSIDE) eTH=SDRTEXTHORZADJUST_RIGHT;
1332  if (eMH==css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE) eTH=SDRTEXTHORZADJUST_LEFT;
1333  // at eMH==css::drawing::MeasureTextHorzPos_INSIDE we can anchor horizontally
1334  if (eMV==css::drawing::MeasureTextVertPos_EAST) eTV=SDRTEXTVERTADJUST_BOTTOM;
1335  if (eMV==css::drawing::MeasureTextVertPos_WEST) eTV=SDRTEXTVERTADJUST_TOP;
1336  if (eMV==css::drawing::MeasureTextVertPos_CENTERED) eTV=SDRTEXTVERTADJUST_CENTER;
1337  } else {
1338  if (eMH==css::drawing::MeasureTextHorzPos_LEFTOUTSIDE) eTV=SDRTEXTVERTADJUST_BOTTOM;
1339  if (eMH==css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE) eTV=SDRTEXTVERTADJUST_TOP;
1340  // at eMH==css::drawing::MeasureTextHorzPos_INSIDE we can anchor vertically
1341  if (!bBelowRefEdge) {
1342  if (eMV==css::drawing::MeasureTextVertPos_EAST) eTH=SDRTEXTHORZADJUST_LEFT;
1343  if (eMV==css::drawing::MeasureTextVertPos_WEST) eTH=SDRTEXTHORZADJUST_RIGHT;
1344  } else {
1345  if (eMV==css::drawing::MeasureTextVertPos_EAST) eTH=SDRTEXTHORZADJUST_RIGHT;
1346  if (eMV==css::drawing::MeasureTextVertPos_WEST) eTH=SDRTEXTHORZADJUST_LEFT;
1347  }
1348  if (eMV==css::drawing::MeasureTextVertPos_CENTERED) eTH=SDRTEXTHORZADJUST_CENTER;
1349  }
1350 
1351  EEAnchorMode eRet=EEAnchorMode::BottomHCenter;
1352  if (eTH==SDRTEXTHORZADJUST_LEFT) {
1353  if (eTV==SDRTEXTVERTADJUST_TOP) eRet=EEAnchorMode::TopLeft;
1354  else if (eTV==SDRTEXTVERTADJUST_BOTTOM) eRet=EEAnchorMode::BottomLeft;
1355  else eRet=EEAnchorMode::VCenterLeft;
1356  } else if (eTH==SDRTEXTHORZADJUST_RIGHT) {
1357  if (eTV==SDRTEXTVERTADJUST_TOP) eRet=EEAnchorMode::TopRight;
1358  else if (eTV==SDRTEXTVERTADJUST_BOTTOM) eRet=EEAnchorMode::BottomRight;
1359  else eRet=EEAnchorMode::VCenterRight;
1360  } else {
1361  if (eTV==SDRTEXTVERTADJUST_TOP) eRet=EEAnchorMode::TopHCenter;
1362  else if (eTV==SDRTEXTVERTADJUST_BOTTOM) eRet=EEAnchorMode::BottomHCenter;
1363  else eRet=EEAnchorMode::VCenterHCenter;
1364  }
1365  return eRet;
1366 }
1367 
1368 
1369 // #i97878#
1370 // TRGetBaseGeometry/TRSetBaseGeometry needs to be based on two positions,
1371 // same as line geometry in SdrPathObj. Thus needs to be overridden and
1372 // implemented since currently it is derived from SdrTextObj which uses
1373 // a functionality based on SnapRect which is not useful here
1374 
1376 {
1377  // handle the same as a simple line since the definition is based on two points
1378  const basegfx::B2DRange aRange(aPt1.X(), aPt1.Y(), aPt2.X(), aPt2.Y());
1379  basegfx::B2DTuple aScale(aRange.getRange());
1380  basegfx::B2DTuple aTranslate(aRange.getMinimum());
1381 
1382  // position maybe relative to anchor position, convert
1384  {
1385  if(GetAnchorPos().X() || GetAnchorPos().Y())
1386  {
1387  aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
1388  }
1389  }
1390 
1391  // build return value matrix
1392  rMatrix = basegfx::utils::createScaleTranslateB2DHomMatrix(aScale, aTranslate);
1393 
1394  return true;
1395 }
1396 
1398 {
1399  // use given transformation to derive the two defining points from unit line
1400  basegfx::B2DPoint aPosA(rMatrix * basegfx::B2DPoint(0.0, 0.0));
1401  basegfx::B2DPoint aPosB(rMatrix * basegfx::B2DPoint(1.0, 0.0));
1402 
1403  if( getSdrModelFromSdrObject().IsWriter() )
1404  {
1405  // if anchor is used, make position relative to it
1406  if(GetAnchorPos().X() || GetAnchorPos().Y())
1407  {
1408  const basegfx::B2DVector aAnchorOffset(GetAnchorPos().X(), GetAnchorPos().Y());
1409 
1410  aPosA += aAnchorOffset;
1411  aPosB += aAnchorOffset;
1412  }
1413  }
1414 
1415  // derive new model data
1416  const Point aNewPt1(basegfx::fround(aPosA.getX()), basegfx::fround(aPosA.getY()));
1417  const Point aNewPt2(basegfx::fround(aPosB.getX()), basegfx::fround(aPosB.getY()));
1418 
1419  if(aNewPt1 != aPt1 || aNewPt2 != aPt2)
1420  {
1421  // set model values and broadcast
1422  tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1423 
1424  aPt1 = aNewPt1;
1425  aPt2 = aNewPt2;
1426 
1427  SetTextDirty();
1428  ActionChanged();
1429  SetChanged();
1432  }
1433 }
1434 
1435 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long Width() const
#define XATTR_LINESTARTCENTER
Definition: xdef.hxx:98
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdomeas.cxx:1116
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
Definition: svdomeas.cxx:998
FieldUnit
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdotxtr.cxx:102
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
virtual const Size & GetTextSize() const override
Definition: svdomeas.cxx:1275
virtual ~SdrMeasureObjGeoData() override
Definition: svdomeas.cxx:71
sal_uInt16 Count() const
Definition: _xpoly.cxx:890
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdomeas.cxx:873
css::drawing::MeasureTextHorzPos eWantTextHPos
Definition: svdomeas.cxx:254
void ShearPoint(Point &rPnt, const Point &rRef, double tn, bool bVShear=false)
Definition: svdtrans.hxx:122
long nTextAutoAngleView
Definition: svdomeas.cxx:265
long FRound(double fVal)
long AdjustWidth(long n)
SdrObjUserCall * pUserCall
Definition: svdobj.hxx:923
virtual sal_uInt16 GetObjIdentifier() const override
Definition: svdomeas.cxx:245
void UndirtyText() const
Definition: svdomeas.cxx:564
std::string GetValue
#define XATTR_LINEENDWIDTH
Definition: xdef.hxx:97
void ResizePoint(Point &rPnt, const Point &rRef, const Fraction &xFract, const Fraction &yFract)
Definition: svdtrans.hxx:106
long Height() const
virtual void NbcSetOutlinerParaObject(std::unique_ptr< OutlinerParaObject > pTextObject) override
Definition: svdomeas.cxx:1288
const Point & GetStart() const
Definition: svddrag.hxx:92
virtual void TakeTextEditArea(Size *pPaperMin, Size *pPaperMax, tools::Rectangle *pViewInit, tools::Rectangle *pViewMin) const
Definition: svdotxed.cxx:131
GeoStat aGeo
Definition: svdotext.hxx:185
virtual const Size & GetTextSize() const
Definition: svdotext.cxx:236
SdrTextHorzAdjust
Definition: sdtaitm.hxx:53
#define SDRATTR_MEASURETEXTVPOS
Definition: svddef.hxx:244
void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr)
Definition: svdobj.cxx:2139
long nRotationAngle
Definition: svdtrans.hxx:216
double nLineCos
Definition: svdomeas.cxx:291
double getX() const
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdomeas.cxx:1041
bool bTextUpsideDown
Definition: svdomeas.cxx:263
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:309
css::drawing::MeasureTextVertPos eUsedTextVPos
Definition: svdomeas.cxx:294
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdomeas.cxx:223
void ImpCalcGeometrics(const ImpMeasureRec &rRec, ImpMeasurePoly &rPol) const
Definition: svdomeas.cxx:340
double getY() const
SdrObjectUniquePtr ImpConvertAddText(SdrObjectUniquePtr pObj, bool bBezier) const
Definition: svdotxtr.cxx:463
#define SDRATTR_MEASUREHELPLINE2LEN
Definition: svddef.hxx:249
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdomeas.cxx:777
virtual bool BegTextEdit(SdrOutliner &rOutl) override
Definition: svdomeas.cxx:1269
ImpLineRec aMainline1
Definition: svdomeas.cxx:280
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:226
long AdjustHeight(long n)
long NormAngle36000(long a)
Normalize angle to -180.00..179.99.
Definition: svdtrans.cxx:407
SdrMeasureObj & operator=(const SdrMeasureObj &rObj)
Definition: svdomeas.cxx:702
object that represents a SdrPage
Definition: svdobj.hxx:143
bool bBelowRefEdge
Definition: svdomeas.cxx:261
#define SDRATTR_MEASUREHELPLINEDIST
Definition: svddef.hxx:247
void SetOrtho8Possible(bool bOn=true)
Definition: svddrag.hxx:129
bool bSnapRectDirty
Definition: svdobj.hxx:928
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdotxtr.cxx:232
B2DRange getB2DRange() const
long GetLen(const Point &rPnt)
Determine sector within the cartesian coordinate system.
Definition: svdtrans.cxx:424
SdrMeasureFieldKind GetMeasureFieldKind() const
Provides information about various ZObject properties.
Definition: svdobj.hxx:248
const SdrHdl * GetHdl() const
Definition: svddrag.hxx:101
virtual void NbcShear(const Point &rRef, long nAngle, double tn, bool bVShear) override
Definition: svdomeas.cxx:1049
sal_uInt16 sal_Unicode
#define SDRATTR_MEASURETEXTROTA90
Definition: svddef.hxx:251
const LocaleDataWrapper & GetLocaleData() const
SdrMeasureFieldKind
bool IsOrtho() const
Definition: svdsnpv.hxx:246
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
#define SDRATTR_MEASUREHELPLINE1LEN
Definition: svddef.hxx:248
#define X
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1432
virtual bool CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_uInt16 nPos, bool bEdit, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor, OUString &rRet) const
Definition: svdotxfl.cxx:22
#define SDRATTR_MEASUREBELOWREFEDGE
Definition: svddef.hxx:250
int nCount
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Definition: svdomeas.cxx:1281
SdrMetricItem makeSdrMeasureLineDistItem(long nVal)
Definition: sxmlhitm.hxx:39
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1878
long nShortLineLen
Definition: svdomeas.cxx:300
SfxStyleSheet * GetStyleSheet() const
Definition: svdobj.cxx:2134
tools::Rectangle maRect
Definition: svdotext.hxx:182
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1908
PolyLine.
Definition: svdobj.hxx:127
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
void ImpTakeAttr(ImpMeasureRec &rRec) const
Definition: svdomeas.cxx:305
virtual EEAnchorMode GetOutlinerViewAnchorMode() const override
Definition: svdomeas.cxx:1314
void SetObjectItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1888
tools::Rectangle maSnapRect
Definition: svdoattr.hxx:42
B2IRange fround(const B2DRange &rRange)
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const override
Definition: svdomeas.cxx:602
void SetParaAttribs(sal_Int32 nPara, const SfxItemSet &)
#define SDRATTR_MEASURETEXTAUTOANGLE
Definition: svddef.hxx:258
FieldUnit GetUIUnit() const
Definition: svdmodel.hxx:380
#define XATTR_LINEENDCENTER
Definition: xdef.hxx:99
virtual sal_uInt32 GetPointCount() const override
Definition: svdomeas.cxx:1091
#define SDRATTR_MEASURESHOWUNIT
Definition: svddef.hxx:256
long nHelplineDist
Definition: svdomeas.cxx:258
SdrTextHorzAdjust GetTextHorizontalAdjust() const
Definition: svdotext.cxx:309
const OUString & getNumDecimalSep() const
const EditTextObject & GetTextObject() const
SdrTextVertAdjust GetTextVerticalAdjust() const
Definition: svdotext.cxx:341
bool mbSupportTextIndentingOnLineWidthChange
Definition: svdobj.hxx:948
long GetTextLeftDistance() const
Left inner spacing to borders.
Definition: svdotext.cxx:1742
void SetText(const OutlinerParaObject &)
long GetTextRightDistance() const
Right inner spacing to borders.
Definition: svdotext.cxx:1747
uno_Any a
bool bAutoUpsideDown
Definition: svdomeas.cxx:301
static OUString GetUnitString(FieldUnit eUnit)
Definition: svdmodel.cxx:1047
virtual long GetRotateAngle() const override
Definition: svdomeas.cxx:1058
bool IsWriter() const
Definition: svdmodel.hxx:576
bool bTextSizeDirty
Definition: svdotext.hxx:233
virtual bool BegTextEdit(SdrOutliner &rOutl)
Definition: svdotxed.cxx:40
OUString sName
#define SDRATTR_MEASUREDECIMALPLACES
Definition: svddef.hxx:262
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: svdomeas.cxx:971
virtual SdrMeasureObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdomeas.cxx:697
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
Definition: svdomeas.cxx:1075
#define EE_FEATURE_FIELD
void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)
void BroadcastObjectChange() const
Definition: svdobj.cxx:904
virtual void NbcRotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: svdomeas.cxx:1018
sal_Int32 GetPointCount() const
Definition: svddrag.hxx:91
void MirrorPoint(Point &rPnt, const Point &rRef1, const Point &rRef2)
Definition: svdtrans.cxx:103
const Fraction & X() const
Definition: svdtrans.hxx:245
virtual Point GetPoint(sal_uInt32 i) const override
Definition: svdomeas.cxx:1096
SdrTextObj & operator=(const SdrTextObj &rObj)
Definition: svdotext.cxx:1007
void ActionChanged() const
Definition: svdobj.cxx:256
SdrView * GetView() const
Definition: svddrag.hxx:86
static basegfx::B2DPolyPolygon ImpCalcXPoly(const ImpMeasurePoly &rPol)
Definition: svdomeas.cxx:509
SdrMeasureObj(SdrModel &rSdrModel)
Definition: svdomeas.cxx:198
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:272
#define SDRATTR_MEASURETEXTAUTOANGLEVIEW
Definition: svddef.hxx:259
virtual void TakeTextAnchorRect(::tools::Rectangle &rAnchorRect) const
Definition: svdotext.cxx:586
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdomeas.cxx:750
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdomeas.cxx:801
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdotxtr.cxx:94
virtual OUString TakeObjNameSingul() const override
Definition: svdomeas.cxx:715
bool IsCreate1stPointAsCenter() const
Definition: svdcrtv.hxx:132
long nHelpline1Len
Definition: svdomeas.cxx:259
void SetEndDragChangesAttributes(bool bOn)
Definition: svddrag.hxx:133
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
Definition: svdomeas.cxx:947
css::drawing::MeasureTextHorzPos eUsedTextHPos
Definition: svdomeas.cxx:293
virtual bool BckCreate(SdrDragStat &rStat) override
Definition: svdomeas.cxx:978
sal_uInt16 nMainlineCnt
Definition: svdomeas.cxx:292
#define SDRATTR_MEASUREUNIT
Definition: svddef.hxx:254
long GetTextUpperDistance() const
Top inner spacing to borders.
Definition: svdotext.cxx:1752
long nHelplineOverhang
Definition: svdomeas.cxx:257
virtual ~SdrMeasureObj() override
Definition: svdomeas.cxx:219
OUString GetName() const
Definition: svdobj.cxx:697
#define Y
void QuickInsertText(const OUString &rText, const ESelection &rSel)
long BigMulDiv(long nVal, long nMul, long nDiv)
Definition: svdtrans.cxx:558
OUString GetMetricString(long nVal, bool bNoUnitChars=false, sal_Int32 nNumDigits=-1) const
Definition: svdmodel.cxx:1082
ImpLineRec aMainline3
Definition: svdomeas.cxx:282
#define XATTR_LINEWIDTH
Definition: xdef.hxx:92
const OUString & getNumDecimalSepAlt() const
#define SDRATTR_MEASURESCALE
Definition: svddef.hxx:255
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
sal_Int32 GetParagraphCount() const
SdrMetricItem makeSdrMeasureHelpline1LenItem(long nVal)
Definition: sxmlhitm.hxx:56
virtual void NbcSetOutlinerParaObject(std::unique_ptr< OutlinerParaObject > pTextObject) override
Definition: svdotext.cxx:1363
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:867
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void RotatePoint(Point &rPnt, const Point &rRef, double sn, double cs)
Definition: svdtrans.hxx:114
std::unique_ptr< OutlinerParaObject > CreateParaObject(sal_Int32 nStartPara=0, sal_Int32 nParaCount=EE_PARA_ALL) const
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdomeas.cxx:1063
FrPair GetMapFactor(MapUnit eS, MapUnit eD)
Definition: svdtrans.cxx:632
sal_uInt32 GetObjHdlNum() const
Definition: svdhdl.hxx:216
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdomeas.cxx:192
virtual void RestGeoData(const SdrObjGeoData &rGeo) override
Definition: svdotext.cxx:1440
virtual void TakeTextRect(SdrOutliner &rOutliner, tools::Rectangle &rTextRect, bool bNoEditText, tools::Rectangle *pAnchorRect, bool bLineWidth=true) const
Definition: svdotext.cxx:621
virtual void RestGeoData(const SdrObjGeoData &rGeo) override
Definition: svdomeas.cxx:1124
sal_Int32 GetDenominator() const
virtual void TakeTextEditArea(Size *pPaperMin, Size *pPaperMax, tools::Rectangle *pViewInit, tools::Rectangle *pViewMin) const override
Definition: svdomeas.cxx:1308
void ImpEvalDrag(ImpMeasureRec &rRec, const SdrDragStat &rDrag) const
Definition: svdomeas.cxx:878
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
OUString TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind) const
Definition: svdomeas.cxx:73
ImpLineRec aHelpline2
Definition: svdomeas.cxx:284
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdomeas.cxx:782
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Definition: svdotext.cxx:1354
#define SDRATTR_MEASUREHELPLINEOVERHANG
Definition: svddef.hxx:246
#define XATTR_LINEEND
Definition: xdef.hxx:95
OUString aName
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1883
css::drawing::MeasureTextVertPos eWantTextVPos
Definition: svdomeas.cxx:255
double nLineSin
Definition: svdomeas.cxx:290
ImpLineRec aMainline2
Definition: svdomeas.cxx:281
virtual bool CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_uInt16 nPos, bool bEdit, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor, OUString &rRet) const override
Definition: svdomeas.cxx:546
#define SDRATTR_MEASURETEXTUPSIDEDOWN
Definition: svddef.hxx:252
bool bTextDirty
Definition: svdomeas.hxx:60
#define F_PI18000
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdomeas.cxx:1003
#define SDRATTR_MEASURETEXTHPOS
Definition: svddef.hxx:243
bool bTextRota90
Definition: svdomeas.cxx:262
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdomeas.cxx:1080
bool bTextAutoAngle
Definition: svdomeas.cxx:264
Size aTextSize
Definition: svdotext.hxx:191
sal_Int32 GetNumerator() const
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:114
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdomeas.cxx:736
const Point & GetNow() const
Definition: svddrag.hxx:95
long GetAngle(const Point &rPnt)
The Y axis points down! The function negates the Y axis, when calculating the angle, such that GetAngle(Point(0,-1))=90 deg.
Definition: svdtrans.cxx:385
void SetUpdateMode(bool bUpdate)
PointerStyle
const Point & GetAnchorPos() const
Definition: svdobj.cxx:1587
void SetStyleSheet(sal_Int32 nPara, SfxStyleSheet *pStyle)
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:434
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdomeas.cxx:1010
#define SDRATTR_MEASURELINEDIST
Definition: svddef.hxx:245
EEAnchorMode
friend class SdrMeasureField
Definition: svdomeas.hxx:52
virtual void TakeTextAnchorRect(tools::Rectangle &rAnchorRect) const override
Definition: svdomeas.cxx:1302
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdomeas.cxx:1133
void SetTextDirty()
Definition: svdomeas.hxx:68
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: svdomeas.cxx:987
#define XATTR_LINESTARTWIDTH
Definition: xdef.hxx:96
virtual void NbcSetPoint(const Point &rPnt, sal_uInt32 i) override
Definition: svdomeas.cxx:1101
bool LineGeometryUsageIsNecessary() const
Definition: svdobj.cxx:961
bool IsValid() const
ImpLineRec aHelpline1
Definition: svdomeas.cxx:283
virtual bool IsPolyObj() const override
Definition: svdomeas.cxx:1086
bool UpdateFields()
virtual void TakeTextRect(SdrOutliner &rOutliner, tools::Rectangle &rTextRect, bool bNoEditText, tools::Rectangle *pAnchorRect, bool bLineWidth=true) const override
Definition: svdomeas.cxx:1295
virtual void NbcRotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: svdotxtr.cxx:186
void Clear()
SdrCreateCmd
Definition: svdtypes.hxx:27
bool IsBigOrtho() const
Definition: svdsnpv.hxx:258
virtual void SetChanged()
Definition: svdobj.cxx:928
virtual OUString TakeObjNamePlural() const override
Definition: svdomeas.cxx:731
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
Definition: svdomeas.cxx:1397
virtual void NbcShear(const Point &rRef, long nAngle, double tn, bool bVShear) override
Definition: svdotxtr.cxx:210
long nHelpline2Len
Definition: svdomeas.cxx:260
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdomeas.cxx:184
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: svdomeas.cxx:983
void setWidth(long nWidth)
SdrOutliner & ImpGetDrawOutliner() const
Definition: svdotext.cxx:1144
aStr
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: svdomeas.cxx:956
Size CalcTextSize()
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
Definition: svdobj.cxx:2648
SdrTextVertAdjust
Definition: sdtaitm.hxx:29
long GetTextLowerDistance() const
Bottom inner spacing to borders.
Definition: svdotext.cxx:1757
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdomeas.cxx:745
tools::Rectangle GetBoundRect() const
Definition: _xpoly.cxx:895
virtual SdrObjGeoData * NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
Definition: svdomeas.cxx:1111
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
Definition: svdhdl.cxx:2294
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const override
Definition: svdomeas.cxx:1375
#define XATTR_LINESTART
Definition: xdef.hxx:94
const SvxFieldData * GetField() const
static long impGetLineStartEndDistance(const basegfx::B2DPolyPolygon &rPolyPolygon, long nNewWidth, bool bCenter)
Definition: svdomeas.cxx:325
SdrMetricItem makeSdrMeasureHelpline2LenItem(long nVal)
Definition: sxmlhitm.hxx:59
void setHeight(long nHeight)