LibreOffice Module svx (master)  1
viewcontactofsdrmeasureobj.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 
22 #include <svx/svdomeas.hxx>
24 #include <svl/itemset.hxx>
25 #include <svx/sxmbritm.hxx>
26 #include <svx/sxmlhitm.hxx>
27 #include <svx/sxmtritm.hxx>
28 #include <sxmtaitm.hxx>
30 #include <svx/sxmtpitm.hxx>
31 
32 
33 namespace sdr::contact
34 {
36  : ViewContactOfTextObj(rMeasureObj)
37  {
38  }
39 
41  {
42  }
43 
45  {
46  const SfxItemSet& rItemSet = GetMeasureObj().GetMergedItemSet();
49  rItemSet,
50  GetMeasureObj().getText(0)));
51 
52  // take properties which are the model data.
53  const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y());
54  const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y());
55  const double fDistance(rItemSet.Get(SDRATTR_MEASURELINEDIST).GetValue());
56  const double fUpperDistance(rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG).GetValue());
57  const double fLowerDistance(rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST).GetValue());
58  const double fLeftDelta(rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN).GetValue());
59  const double fRightDelta(rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN).GetValue());
60  const bool bBelow(rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE).GetValue());
61  const bool bTextRotation(rItemSet.Get(SDRATTR_MEASURETEXTROTA90).GetValue());
62  const bool bTextAutoAngle(rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE).GetValue());
65 
66  switch(rItemSet.Get(SDRATTR_MEASURETEXTHPOS).GetValue())
67  {
68  case css::drawing::MeasureTextHorzPos::MeasureTextHorzPos_LEFTOUTSIDE:
69  {
71  break;
72  }
73  case css::drawing::MeasureTextHorzPos::MeasureTextHorzPos_INSIDE:
74  {
76  break;
77  }
78  case css::drawing::MeasureTextHorzPos::MeasureTextHorzPos_RIGHTOUTSIDE:
79  {
81  break;
82  }
83  default: // css::drawing::MeasureTextHorzPos::MeasureTextHorzPos_AUTO
84  {
85  break;
86  }
87  }
88 
89  switch(rItemSet.Get(SDRATTR_MEASURETEXTVPOS).GetValue())
90  {
91  case css::drawing::MeasureTextVertPos_EAST:
92  {
94  break;
95  }
96  case css::drawing::MeasureTextVertPos_CENTERED:
97  {
99  break;
100  }
101  case css::drawing::MeasureTextVertPos_WEST:
102  {
104  break;
105  }
106  default : // css::drawing::MeasureTextVertPos_AUTO
107  {
108  break;
109  }
110  }
111 
112  // create primitive with the model data. Always create primitives to allow the
113  // decomposition of SdrMeasurePrimitive2D to create needed invisible elements for HitTest
114  // and/or BoundRect
117  aAttribute, aStart, aEnd,
118  aMTPHor, aMTPVer, fDistance,
119  fUpperDistance, fLowerDistance,
120  fLeftDelta, fRightDelta, bBelow,
121  bTextRotation, bTextAutoAngle));
122 
124  }
125 } // end of namespace
126 
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SDRATTR_MEASURETEXTVPOS
Definition: svddef.hxx:239
#define SDRATTR_MEASUREHELPLINE2LEN
Definition: svddef.hxx:244
#define SDRATTR_MEASUREHELPLINEDIST
Definition: svddef.hxx:242
#define SDRATTR_MEASURETEXTROTA90
Definition: svddef.hxx:246
#define SDRATTR_MEASUREHELPLINE1LEN
Definition: svddef.hxx:243
#define X
#define SDRATTR_MEASUREBELOWREFEDGE
Definition: svddef.hxx:245
#define SDRATTR_MEASURETEXTAUTOANGLE
Definition: svddef.hxx:253
static void GetPoint(const tools::Polygon &rPoly, const std::vector< double > &rDistances, const double &fX, double &fx1, double &fy1)
attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute(const SfxItemSet &rSet, const SdrText *pText)
#define Y
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define SDRATTR_MEASUREHELPLINEOVERHANG
Definition: svddef.hxx:241
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1908
#define SDRATTR_MEASURETEXTHPOS
Definition: svddef.hxx:238
#define SDRATTR_MEASURELINEDIST
Definition: svddef.hxx:240
virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override