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