LibreOffice Module svx (master) 1
viewcontactofsdrcircobj.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/svdocirc.hxx>
23#include <svx/sdangitm.hxx>
26#include <svl/itemset.hxx>
28#include <vcl/canvastools.hxx>
29
30
31namespace sdr::contact
32{
34 : ViewContactOfSdrRectObj(rCircObj)
35 {
36 }
37
39 {
40 }
41
43 {
44 const SfxItemSet& rItemSet = GetCircObj().GetMergedItemSet();
47 rItemSet,
48 GetCircObj().getText(0),
49 false));
50
51 // take unrotated snap rect (direct model data) for position and size
53 const GeoStat& rGeoStat(GetCircObj().GetGeoStat());
54
55 // fill object matrix
56 const basegfx::B2DHomMatrix aObjectMatrix(
58 aObjectRange.getWidth(), aObjectRange.getHeight(),
59 -rGeoStat.mfTanShearAngle,
60 rGeoStat.nRotationAngle ? toRadians(36000_deg100 - rGeoStat.nRotationAngle) : 0.0,
61 aObjectRange.getMinX(), aObjectRange.getMinY()));
62
63 // create primitive data
64 const SdrObjKind nIdentifier(GetCircObj().GetObjIdentifier());
65
66 // always create primitives to allow the decomposition of SdrEllipsePrimitive2D
67 // or SdrEllipseSegmentPrimitive2D to create needed invisible elements for HitTest
68 // and/or BoundRect
69 if(SdrObjKind::CircleOrEllipse == nIdentifier)
70 {
73 aObjectMatrix,
74 aAttribute));
75
76 rVisitor.visit(xReference);
77 }
78 else
79 {
80 const auto nNewStart(rItemSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue());
81 const auto nNewEnd(rItemSet.Get(SDRATTR_CIRCENDANGLE).GetValue());
82 const double fStart(toRadians((36000_deg100 - nNewEnd) % 36000_deg100));
83 const double fEnd(toRadians((36000_deg100 - nNewStart) % 36000_deg100));
84 const bool bCloseSegment(SdrObjKind::CircleArc != nIdentifier);
85 const bool bCloseUsingCenter(SdrObjKind::CircleSection == nIdentifier);
86
89 aObjectMatrix,
90 aAttribute,
91 fStart,
92 fEnd,
93 bCloseSegment,
94 bCloseUsingCenter));
95
96 rVisitor.visit(xReference);
97 }
98 }
99
100} // end of namespace
101
102/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
The transformation of a rectangle into a polygon, by using angle parameters from GeoStat.
Definition: svdtrans.hxx:201
double mfTanShearAngle
Definition: svdtrans.hxx:205
Degree100 nRotationAngle
Definition: svdtrans.hxx:203
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1977
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
TYPE getWidth() const
TYPE getMinX() const
TYPE getMinY() const
TYPE getHeight() const
virtual void visit(const Primitive2DReference &)=0
virtual void createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const override
double toRadians(D x)
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
attribute::SdrLineFillEffectsTextAttribute createNewSdrLineFillEffectsTextAttribute(const SfxItemSet &rSet, const SdrText *pText, bool bHasContent)
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
constexpr TypedWhichId< SdrAngleItem > SDRATTR_CIRCSTARTANGLE(SDRATTR_CIRC_FIRST+1)
constexpr TypedWhichId< SdrAngleItem > SDRATTR_CIRCENDANGLE(SDRATTR_CIRC_FIRST+2)
SdrObjKind
Definition: svdobjkind.hxx:25
@ CircleOrEllipse
rectangle (round corners optional)
@ CircleSection
circle, ellipse
@ CircleArc
circle section