LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewcontactofsdrrectobj.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 22 23 95.7 %
Date: 2015-06-13 12:38:46 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11