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