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
30namespace 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.mfTanShearAngle,
60 rGeoStat.m_nRotationAngle ? toRadians(36000_deg100 - rGeoStat.m_nRotationAngle) : 0.0,
61 aObjectRange.getMinX(), aObjectRange.getMinY()));
62
63 // calculate corner radius
64 sal_uInt32 nCornerRadius(rItemSet.Get(SDRATTR_CORNER_RADIUS).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
83 rVisitor.visit(xReference);
84}
85
86}
87
88/* 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 m_nRotationAngle
Definition: svdtrans.hxx:203
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1974
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
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
double toRadians(D x)
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange &rObjectRange, double &rfCornerRadiusX, double &rfCornerRadiusY)
attribute::SdrLineFillEffectsTextAttribute createNewSdrLineFillEffectsTextAttribute(const SfxItemSet &rSet, const SdrText *pText, bool bHasContent, bool bSuppressShadow)
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_CORNER_RADIUS(SDRATTR_MISC_FIRST+0)