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  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  Degree100 nLineAngle=GetAngle(rRec.aPt2-rRec.aPt1);
881  double a = nLineAngle.get() * 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  tools::Long ndx0=aMov.X()-aFix.X();
912  tools::Long ndy0=aMov.Y()-aFix.Y();
913  bool bHLin=ndy0==0;
914  bool bVLin=ndx0==0;
915  if (!bHLin || !bVLin) { // else aPt1==aPt2
916  tools::Long ndx=aPt.X()-aFix.X();
917  tools::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=tools::Long(ndy0*nXFact);
923  if (bVer) ndx=tools::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  tools::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, Degree100 nAngle, double sn, double cs)
1019 {
1020  SdrTextObj::NbcRotate(rRef,nAngle,sn,cs);
1021  tools::Long nLen0=GetLen(aPt2-aPt1);
1022  RotatePoint(aPt1,rRef,sn,cs);
1023  RotatePoint(aPt2,rRef,sn,cs);
1024  tools::Long nLen1=GetLen(aPt2-aPt1);
1025  if (nLen1!=nLen0) { // rounding error!
1026  tools::Long dx=aPt2.X()-aPt1.X();
1027  tools::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, Degree100 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 
1111 std::unique_ptr<SdrObjGeoData> SdrMeasureObj::NewGeoData() const
1112 {
1113  return std::make_unique<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  return;
1421 
1422  // set model values and broadcast
1423  tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1424 
1425  aPt1 = aNewPt1;
1426  aPt2 = aNewPt2;
1427 
1428  SetTextDirty();
1429  ActionChanged();
1430  SetChanged();
1433 }
1434 
1435 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Long GetTextLowerDistance() const
Bottom inner spacing to borders.
Definition: svdotext.cxx:1768
Degree100 nHlpAngle
Definition: svdomeas.cxx:302
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdomeas.cxx:1116
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: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
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:873
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)
SdrObjUserCall * pUserCall
Definition: svdobj.hxx:877
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: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:285
tools::Long GetTextLeftDistance() const
Left inner spacing to borders.
Definition: svdotext.cxx:1753
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:1049
long Long
constexpr TypedWhichId< SdrMetricItem > SDRATTR_MEASUREHELPLINE1LEN(SDRATTR_MEASURE_FIRST+6)
void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr)
Definition: svdobj.cxx:2206
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:1041
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:310
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:1124
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:1018
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: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:174
SdrObjKind
Definition: svdobjkind.hxx:24
bool bBelowRefEdge
Definition: svdomeas.cxx:274
void SetOrtho8Possible(bool bOn=true)
Definition: svddrag.hxx:129
static tools::Long impGetLineStartEndDistance(const basegfx::B2DPolyPolygon &rPolyPolygon, tools::Long nNewWidth, bool bCenter)
Definition: svdomeas.cxx:338
bool bSnapRectDirty
Definition: svdobj.hxx:882
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdotxtr.cxx:232
virtual Degree100 GetRotateAngle() const override
Definition: svdomeas.cxx:1058
B2DRange getB2DRange() const
tools::Long nArrow1Len
Definition: svdomeas.cxx:309
SdrMeasureFieldKind GetMeasureFieldKind() const
Provides information about various ZObject properties.
Definition: svdobj.hxx:196
const SdrHdl * GetHdl() const
Definition: svddrag.hxx:101
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:1443
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:1281
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1949
SfxStyleSheet * GetStyleSheet() const
Definition: svdobj.cxx:2201
tools::Rectangle maRect
Definition: svdotext.hxx:182
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1979
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:1314
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:1959
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:380
constexpr TypedWhichId< SdrMeasureDecimalPlacesItem > SDRATTR_MEASUREDECIMALPLACES(SDRATTR_MEASURE_FIRST+20)
virtual sal_uInt32 GetPointCount() const override
Definition: svdomeas.cxx:1091
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:902
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:986
bool IsWriter() const
Definition: svdmodel.hxx:576
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:971
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:1075
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:979
sal_Int32 GetPointCount() const
Definition: svddrag.hxx:91
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:1096
void ActionChanged() const
Definition: svdobj.cxx:257
SdrView * GetView() const
Definition: svddrag.hxx:86
tools::Long Width() const
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:273
virtual void TakeTextAnchorRect(::tools::Rectangle &rAnchorRect) const
Definition: svdotext.cxx:635
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:129
void SetEndDragChangesAttributes(bool bOn)
Definition: svddrag.hxx:133
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:947
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:978
sal_uInt16 nMainlineCnt
Definition: svdomeas.cxx:305
virtual ~SdrMeasureObj() override
Definition: svdomeas.cxx:232
OUString GetName() const
Definition: svdobj.cxx:772
#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:1758
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:1374
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:942
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:1063
tools::Long GetTextUpperDistance() const
Top inner spacing to borders.
Definition: svdotext.cxx:1763
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: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:74
ImpLineRec aHelpline2
Definition: svdomeas.cxx:297
tools::Long nArrow2Wdt
Definition: svdomeas.cxx:312
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdomeas.cxx:782
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Definition: svdotext.cxx:1365
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:1954
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:1003
tools::Long Height() const
bool bTextRota90
Definition: svdomeas.cxx:275
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdomeas.cxx:1080
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:1451
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:98
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
void SetUpdateMode(bool bUpdate)
tools::Long AdjustHeight(tools::Long n)
PointerStyle
const Point & GetAnchorPos() const
Definition: svdobj.cxx:1633
void SetStyleSheet(sal_Int32 nPara, SfxStyleSheet *pStyle)
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:506
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdomeas.cxx:1010
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:1302
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdomeas.cxx:1133
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:987
constexpr TypedWhichId< SdrMeasureBelowRefEdgeItem > SDRATTR_MEASUREBELOWREFEDGE(SDRATTR_MEASURE_FIRST+8)
virtual void NbcSetPoint(const Point &rPnt, sal_uInt32 i) override
Definition: svdomeas.cxx:1101
OUString GetMetricString(tools::Long nVal, bool bNoUnitChars=false, sal_Int32 nNumDigits=-1) const
Definition: svdmodel.cxx:1021
bool LineGeometryUsageIsNecessary() const
Definition: svdobj.cxx:1036
constexpr sal_uInt16 EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
bool IsValid() const
ImpLineRec aHelpline1
Definition: svdomeas.cxx:296
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
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:1003
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 std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdomeas.cxx:185
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: svdomeas.cxx:983
SdrOutliner & ImpGetDrawOutliner() const
Definition: svdotext.cxx:1147
aStr
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: svdomeas.cxx:956
Size CalcTextSize()
constexpr TypedWhichId< SdrMetricItem > SDRATTR_MEASUREHELPLINEOVERHANG(SDRATTR_MEASURE_FIRST+4)
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
Definition: svdobj.cxx:2715
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:745
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:1375
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:1111