/src/libreoffice/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
Line | Count | Source (jump to first uncovered line) |
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 | | #include <sdr/contact/viewcontactofsdrrectobj.hxx> |
21 | | #include <svx/svdorect.hxx> |
22 | | #include <sdr/primitive2d/sdrattributecreator.hxx> |
23 | | #include <sdr/primitive2d/sdrrectangleprimitive2d.hxx> |
24 | | #include <svl/itemset.hxx> |
25 | | #include <basegfx/matrix/b2dhommatrixtools.hxx> |
26 | | #include <svx/svdmodel.hxx> |
27 | | #include <vcl/canvastools.hxx> |
28 | | #include <svx/sdmetitm.hxx> |
29 | | |
30 | | namespace sdr::contact { |
31 | | |
32 | | ViewContactOfSdrRectObj::ViewContactOfSdrRectObj(SdrRectObj& rRectObj) |
33 | 1.45M | : ViewContactOfTextObj(rRectObj) |
34 | 1.45M | { |
35 | 1.45M | } |
36 | | |
37 | | ViewContactOfSdrRectObj::~ViewContactOfSdrRectObj() |
38 | 1.45M | { |
39 | 1.45M | } |
40 | | |
41 | | void ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const |
42 | 5 | { |
43 | 5 | const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet(); |
44 | 5 | const drawinglayer::attribute::SdrLineFillEffectsTextAttribute aAttribute( |
45 | 5 | drawinglayer::primitive2d::createNewSdrLineFillEffectsTextAttribute( |
46 | 5 | rItemSet, |
47 | 5 | GetRectObj().getText(0), |
48 | 5 | false)); |
49 | | |
50 | | // take unrotated snap rect (direct model data) for position and size |
51 | 5 | const tools::Rectangle aRectangle(GetRectObj().GetGeoRect()); |
52 | 5 | const ::basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(aRectangle); |
53 | | |
54 | 5 | const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); |
55 | | |
56 | | // fill object matrix |
57 | 5 | basegfx::B2DHomMatrix aObjectMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( |
58 | 5 | aObjectRange.getWidth(), aObjectRange.getHeight(), |
59 | 5 | -rGeoStat.mfTanShearAngle, |
60 | 5 | rGeoStat.m_nRotationAngle ? toRadians(36000_deg100 - rGeoStat.m_nRotationAngle) : 0.0, |
61 | 5 | aObjectRange.getMinX(), aObjectRange.getMinY())); |
62 | | |
63 | | // calculate corner radius |
64 | 5 | sal_uInt32 nCornerRadius(rItemSet.Get(SDRATTR_CORNER_RADIUS).GetValue()); |
65 | 5 | double fCornerRadiusX; |
66 | 5 | double fCornerRadiusY; |
67 | 5 | drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); |
68 | | |
69 | | // #i105856# use knowledge about pickthrough from the model |
70 | 5 | 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 |
74 | 5 | const drawinglayer::primitive2d::Primitive2DReference xReference( |
75 | 5 | new drawinglayer::primitive2d::SdrRectanglePrimitive2D( |
76 | 5 | aObjectMatrix, |
77 | 5 | aAttribute, |
78 | 5 | fCornerRadiusX, |
79 | 5 | fCornerRadiusY, |
80 | | // #i105856# use fill for HitTest when TextFrame and not PickThrough |
81 | 5 | GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); |
82 | | |
83 | 5 | rVisitor.visit(xReference); |
84 | 5 | } |
85 | | |
86 | | } |
87 | | |
88 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |