LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewcontactofsdrrectobj.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 22 0.0 %
Date: 2014-04-14 Functions: 0 4 0.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             : 
      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           0 :         ViewContactOfSdrRectObj::ViewContactOfSdrRectObj(SdrRectObj& rRectObj)
      37           0 :         :   ViewContactOfTextObj(rRectObj)
      38             :         {
      39           0 :         }
      40             : 
      41           0 :         ViewContactOfSdrRectObj::~ViewContactOfSdrRectObj()
      42             :         {
      43           0 :         }
      44             : 
      45           0 :         drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence() const
      46             :         {
      47           0 :             const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet();
      48             :             const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
      49             :                 drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
      50             :                     rItemSet,
      51           0 :                     GetRectObj().getText(0),
      52           0 :                     false));
      53             : 
      54             :             // take unrotated snap rect (direct model data) for position and size
      55           0 :             Rectangle rRectangle = GetRectObj().GetGeoRect();
      56             :             // Hack for calc, transform position of object according
      57             :             // to current zoom so as objects relative position to grid
      58             :             // appears stable
      59           0 :             rRectangle += GetRectObj().GetGridOffset();
      60             :             const ::basegfx::B2DRange aObjectRange(
      61           0 :                 rRectangle.Left(), rRectangle.Top(),
      62           0 :                 rRectangle.Right(), rRectangle.Bottom() );
      63             : 
      64           0 :             const GeoStat& rGeoStat(GetRectObj().GetGeoStat());
      65             : 
      66             :             // fill object matrix
      67             :             basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
      68             :                 aObjectRange.getWidth(), aObjectRange.getHeight(),
      69           0 :                 rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
      70           0 :                 rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
      71           0 :                 aObjectRange.getMinX(), aObjectRange.getMinY()));
      72             : 
      73             :             // calculate corner radius
      74           0 :             sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue());
      75             :             double fCornerRadiusX;
      76             :             double fCornerRadiusY;
      77           0 :             drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY);
      78             : 
      79             :             // #i105856# use knowledge about pickthrough from the model
      80             :             const bool bPickThroughTransparentTextFrames(
      81           0 :                 GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames());
      82             : 
      83             :             // create primitive. Always create primitives to allow the decomposition of
      84             :             // SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect
      85             :             const drawinglayer::primitive2d::Primitive2DReference xReference(
      86             :                 new drawinglayer::primitive2d::SdrRectanglePrimitive2D(
      87             :                     aObjectMatrix,
      88             :                     aAttribute,
      89             :                     fCornerRadiusX,
      90             :                     fCornerRadiusY,
      91             :                     // #i105856# use fill for HitTest when TextFrame and not PickThrough
      92           0 :                     GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames));
      93             : 
      94           0 :             return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
      95             :         }
      96             :     } // end of namespace contact
      97             : } // end of namespace sdr
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10