LibreOffice Module svx (master)  1
viewcontactofsdrrectobj.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 
21 #include <svx/svdorect.hxx>
24 #include <svl/itemset.hxx>
27 #include <svx/svdmodel.hxx>
28 #include <vcl/canvastools.hxx>
29 #include <svx/sdmetitm.hxx>
30 
31 namespace sdr { namespace contact {
32 
34 : ViewContactOfTextObj(rRectObj)
35 {
36 }
37 
39 {
40 }
41 
43 {
44  const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet();
47  rItemSet,
48  GetRectObj().getText(0),
49  false));
50 
51  // take unrotated snap rect (direct model data) for position and size
52  const tools::Rectangle aRectangle(GetRectObj().GetGeoRect());
53  const ::basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(aRectangle);
54 
55  const GeoStat& rGeoStat(GetRectObj().GetGeoStat());
56 
57  // fill object matrix
59  aObjectRange.getWidth(), aObjectRange.getHeight(),
60  rGeoStat.nShearAngle ? tan((36000 - rGeoStat.nShearAngle) * F_PI18000) : 0.0,
61  rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle) * F_PI18000 : 0.0,
62  aObjectRange.getMinX(), aObjectRange.getMinY()));
63 
64  // calculate corner radius
65  sal_uInt32 nCornerRadius(rItemSet.Get(SDRATTR_ECKENRADIUS).GetValue());
66  double fCornerRadiusX;
67  double fCornerRadiusY;
68  drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY);
69 
70  // #i105856# use knowledge about pickthrough from the model
71  const bool bPickThroughTransparentTextFrames(GetRectObj().getSdrModelFromSdrObject().IsPickThroughTransparentTextFrames());
72 
73  // create primitive. Always create primitives to allow the decomposition of
74  // SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect
77  aObjectMatrix,
78  aAttribute,
79  fCornerRadiusX,
80  fCornerRadiusY,
81  // #i105856# use fill for HitTest when TextFrame and not PickThrough
82  GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames));
83 
85 }
86 
87 }}
88 
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long nRotationAngle
Definition: svdtrans.hxx:216
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
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
attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute(const SfxItemSet &rSet, const SdrText *pText, bool bHasContent)
void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange &rObjectRange, double &rfCornerRadiusX, double &rfCornerRadiusY)
long nShearAngle
Definition: svdtrans.hxx:217
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override
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_ECKENRADIUS
Definition: svddef.hxx:194