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/sdmetitm.hxx>
26#include <svx/sxmbritm.hxx>
27#include <svx/sxmtritm.hxx>
28#include <sxmtaitm.hxx>
30#include <svx/sxmtpitm.hxx>
31
32
33namespace 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
123 rVisitor.visit(xReference);
124 }
125} // end of namespace
126
127/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void GetPoint(const tools::Polygon &rPoly, const std::vector< double > &rDistances, const double &fX, double &fx1, double &fy1)
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1974
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual void visit(const Primitive2DReference &)=0
virtual void createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const override
attribute::SdrLineEffectsTextAttribute createNewSdrLineEffectsTextAttribute(const SfxItemSet &rSet, const SdrText *pText)
#define Y
constexpr TypedWhichId< SdrMetricItem > SDRATTR_MEASUREHELPLINE1LEN(SDRATTR_MEASURE_FIRST+6)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_MEASUREHELPLINE2LEN(SDRATTR_MEASURE_FIRST+7)
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< SdrMeasureTextHPosItem > SDRATTR_MEASURETEXTHPOS(SDRATTR_MEASURE_FIRST+1)
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)