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>
25 #include <svl/itemset.hxx>
26 #include <svx/sxciaitm.hxx>
28 #include <vcl/canvastools.hxx>
29 
30 
31 namespace sdr
32 {
33  namespace contact
34  {
36  : ViewContactOfSdrRectObj(rCircObj)
37  {
38  }
39 
41  {
42  }
43 
45  {
46  const SfxItemSet& rItemSet = GetCircObj().GetMergedItemSet();
49  rItemSet,
50  GetCircObj().getText(0),
51  false));
52 
53  // take unrotated snap rect (direct model data) for position and size
54  const basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(GetCircObj().GetGeoRect());
55  const GeoStat& rGeoStat(GetCircObj().GetGeoStat());
56 
57  // fill object matrix
58  const basegfx::B2DHomMatrix aObjectMatrix(
60  aObjectRange.getWidth(), aObjectRange.getHeight(),
61  rGeoStat.nShearAngle ? tan((36000 - rGeoStat.nShearAngle) * F_PI18000) : 0.0,
62  rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle) * F_PI18000 : 0.0,
63  aObjectRange.getMinX(), aObjectRange.getMinY()));
64 
65  // create primitive data
66  const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier());
67 
68  // always create primitives to allow the decomposition of SdrEllipsePrimitive2D
69  // or SdrEllipseSegmentPrimitive2D to create needed invisible elements for HitTest
70  // and/or BoundRect
71  if(OBJ_CIRC == nIdentifier)
72  {
75  aObjectMatrix,
76  aAttribute));
77 
79  }
80  else
81  {
82  const sal_Int32 nNewStart(rItemSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue());
83  const sal_Int32 nNewEnd(rItemSet.Get(SDRATTR_CIRCENDANGLE).GetValue());
84  const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000);
85  const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000);
86  const bool bCloseSegment(OBJ_CARC != nIdentifier);
87  const bool bCloseUsingCenter(OBJ_SECT == nIdentifier);
88 
91  aObjectMatrix,
92  aAttribute,
93  fStart,
94  fEnd,
95  bCloseSegment,
96  bCloseUsingCenter));
97 
99  }
100  }
101  } // end of namespace contact
102 } // end of namespace sdr
103 
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
double getHeight() const
long nRotationAngle
Definition: svdtrans.hxx:216
double getWidth() const
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
The transformation of a rectangle into a polygon, by using angle parameters from GeoStat.
Definition: svdtrans.hxx:214
#define SDRATTR_CIRCENDANGLE
Definition: svddef.hxx:263
circle, ellipse
Definition: svdobj.hxx:122
attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute(const SfxItemSet &rSet, const SdrText *pText, bool bHasContent)
virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override
long nShearAngle
Definition: svdtrans.hxx:217
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
circle section
Definition: svdobj.hxx:123
double getMinY() const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1911
#define F_PI18000
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
#define SDRATTR_CIRCSTARTANGLE
Definition: svddef.hxx:262
double getMinX() const
rectangle (round corners optional)
Definition: svdobj.hxx:121