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>
26 #include <svx/svdmodel.hxx>
27 #include <vcl/canvastools.hxx>
28 #include <svx/sdmetitm.hxx>
29 
30 namespace sdr::contact {
31 
33 : ViewContactOfTextObj(rRectObj)
34 {
35 }
36 
38 {
39 }
40 
42 {
43  const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet();
46  rItemSet,
47  GetRectObj().getText(0),
48  false));
49 
50  // take unrotated snap rect (direct model data) for position and size
51  const tools::Rectangle aRectangle(GetRectObj().GetGeoRect());
52  const ::basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(aRectangle);
53 
54  const GeoStat& rGeoStat(GetRectObj().GetGeoStat());
55 
56  // fill object matrix
58  aObjectRange.getWidth(), aObjectRange.getHeight(),
59  rGeoStat.nShearAngle ? tan((36000 - rGeoStat.nShearAngle) * F_PI18000) : 0.0,
60  rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle) * F_PI18000 : 0.0,
61  aObjectRange.getMinX(), aObjectRange.getMinY()));
62 
63  // calculate corner radius
64  sal_uInt32 nCornerRadius(rItemSet.Get(SDRATTR_ECKENRADIUS).GetValue());
65  double fCornerRadiusX;
66  double fCornerRadiusY;
67  drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY);
68 
69  // #i105856# use knowledge about pickthrough from the model
70  const bool bPickThroughTransparentTextFrames(GetRectObj().getSdrModelFromSdrObject().IsPickThroughTransparentTextFrames());
71 
72  // create primitive. Always create primitives to allow the decomposition of
73  // SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect
76  aObjectMatrix,
77  aAttribute,
78  fCornerRadiusX,
79  fCornerRadiusY,
80  // #i105856# use fill for HitTest when TextFrame and not PickThrough
81  GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames));
82 
84 }
85 
86 }
87 
88 /* 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
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)
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1889
#define F_PI18000
constexpr TypedWhichId< SdrMetricItem > SDRATTR_ECKENRADIUS(SDRATTR_MISC_FIRST+0)
attribute::SdrLineFillEffectsTextAttribute createNewSdrLineFillEffectsTextAttribute(const SfxItemSet &rSet, const SdrText *pText, bool bHasContent)