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