Branch data Line data Source code
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 : :
21 : : #include <svx/sdr/contact/viewcontactofsdrrectobj.hxx>
22 : : #include <svx/svdorect.hxx>
23 : : #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
24 : : #include <svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx>
25 : : #include <svl/itemset.hxx>
26 : : #include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
27 : : #include <basegfx/matrix/b2dhommatrixtools.hxx>
28 : : #include <svx/svdmodel.hxx>
29 : :
30 : : //////////////////////////////////////////////////////////////////////////////
31 : :
32 : : namespace sdr
33 : : {
34 : : namespace contact
35 : : {
36 : 36554 : ViewContactOfSdrRectObj::ViewContactOfSdrRectObj(SdrRectObj& rRectObj)
37 : 36554 : : ViewContactOfTextObj(rRectObj)
38 : : {
39 : 36554 : }
40 : :
41 : 36497 : ViewContactOfSdrRectObj::~ViewContactOfSdrRectObj()
42 : : {
43 [ - + ]: 72887 : }
44 : :
45 : 49168 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence() const
46 : : {
47 [ + - ]: 49168 : const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet();
48 : : const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
49 : : drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
50 : : rItemSet,
51 [ + - ][ + - ]: 49168 : GetRectObj().getText(0)));
52 : :
53 : : // take unrotated snap rect (direct model data) for position and size
54 : 49168 : const Rectangle& rRectangle = GetRectObj().GetGeoRect();
55 : : const ::basegfx::B2DRange aObjectRange(
56 : 49168 : rRectangle.Left(), rRectangle.Top(),
57 [ + - ]: 98336 : rRectangle.Right(), rRectangle.Bottom());
58 : 49168 : const GeoStat& rGeoStat(GetRectObj().GetGeoStat());
59 : :
60 : : // fill object matrix
61 : : basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
62 : : aObjectRange.getWidth(), aObjectRange.getHeight(),
63 : 0 : rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
64 : : rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
65 [ + - ][ + + ]: 49168 : aObjectRange.getMinX(), aObjectRange.getMinY()));
[ - + ][ + - ]
[ + - ][ + - ]
[ + - ]
66 : :
67 : : // calculate corner radius
68 [ + - ]: 49168 : sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue());
69 : : double fCornerRadiusX;
70 : : double fCornerRadiusY;
71 [ + - ]: 49168 : drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY);
72 : :
73 : : // #i105856# use knowledge about pickthrough from the model
74 : : const bool bPickThroughTransparentTextFrames(
75 [ + - ][ + - ]: 49168 : GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames());
[ + - ][ + + ]
76 : :
77 : : // create primitive. Always create primitives to allow the decomposition of
78 : : // SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect
79 : : const drawinglayer::primitive2d::Primitive2DReference xReference(
80 : : new drawinglayer::primitive2d::SdrRectanglePrimitive2D(
81 : : aObjectMatrix,
82 : : aAttribute,
83 : : fCornerRadiusX,
84 : : fCornerRadiusY,
85 : : // #i105856# use fill for HitTest when TextFrame and not PickThrough
86 [ + + ][ + + ]: 49168 : GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames));
[ + - ][ + - ]
[ + - ]
87 : :
88 [ + - ][ + - ]: 49168 : return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
[ + - ]
89 : : }
90 : : } // end of namespace contact
91 : : } // end of namespace sdr
92 : :
93 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|