LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewcontactofsdrcircobj.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 18 27 66.7 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 20 52 38.5 %

           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/viewcontactofsdrcircobj.hxx>
      22                 :            : #include <svx/svdocirc.hxx>
      23                 :            : #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
      24                 :            : #include <svx/sdr/primitive2d/sdrellipseprimitive2d.hxx>
      25                 :            : #include <svl/itemset.hxx>
      26                 :            : #include <svx/sxciaitm.hxx>
      27                 :            : #include <basegfx/matrix/b2dhommatrixtools.hxx>
      28                 :            : 
      29                 :            : //////////////////////////////////////////////////////////////////////////////
      30                 :            : 
      31                 :            : namespace sdr
      32                 :            : {
      33                 :            :     namespace contact
      34                 :            :     {
      35                 :         63 :         ViewContactOfSdrCircObj::ViewContactOfSdrCircObj(SdrCircObj& rCircObj)
      36                 :         63 :         :   ViewContactOfSdrRectObj(rCircObj)
      37                 :            :         {
      38                 :         63 :         }
      39                 :            : 
      40                 :         60 :         ViewContactOfSdrCircObj::~ViewContactOfSdrCircObj()
      41                 :            :         {
      42         [ -  + ]:        120 :         }
      43                 :            : 
      44                 :        358 :         drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrCircObj::createViewIndependentPrimitive2DSequence() const
      45                 :            :         {
      46         [ +  - ]:        358 :             const SfxItemSet& rItemSet = GetCircObj().GetMergedItemSet();
      47                 :            :             const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
      48                 :            :                 drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
      49                 :            :                     rItemSet,
      50 [ +  - ][ +  - ]:        358 :                     GetCircObj().getText(0)));
      51                 :            : 
      52                 :            :             // take unrotated snap rect (direct model data) for position and size
      53                 :        358 :             const Rectangle& rRectangle = GetCircObj().GetGeoRect();
      54                 :            :             const basegfx::B2DRange aObjectRange(
      55                 :        358 :                 rRectangle.Left(), rRectangle.Top(),
      56         [ +  - ]:        716 :                 rRectangle.Right(), rRectangle.Bottom());
      57                 :        358 :             const GeoStat& rGeoStat(GetCircObj().GetGeoStat());
      58                 :            : 
      59                 :            :             // fill object matrix
      60                 :            :             const basegfx::B2DHomMatrix aObjectMatrix(
      61                 :            :                 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 [ +  - ][ -  + ]:        358 :                     aObjectRange.getMinX(), aObjectRange.getMinY()));
         [ -  + ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      66                 :            : 
      67                 :            :             // create primitive data
      68         [ +  - ]:        358 :             const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier());
      69                 :            : 
      70                 :            :             // always create primitives to allow the decomposition of SdrEllipsePrimitive2D
      71                 :            :             // or SdrEllipseSegmentPrimitive2D to create needed invisible elements for HitTest
      72                 :            :             // and/or BoundRect
      73         [ +  - ]:        358 :             if(OBJ_CIRC == nIdentifier)
      74                 :            :             {
      75                 :            :                 const drawinglayer::primitive2d::Primitive2DReference xReference(
      76                 :            :                     new drawinglayer::primitive2d::SdrEllipsePrimitive2D(
      77                 :            :                         aObjectMatrix,
      78 [ +  - ][ +  - ]:        358 :                         aAttribute));
                 [ +  - ]
      79                 :            : 
      80         [ +  - ]:        358 :                 return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
      81                 :            :             }
      82                 :            :             else
      83                 :            :             {
      84         [ #  # ]:          0 :                 const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue());
      85         [ #  # ]:          0 :                 const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue());
      86                 :          0 :                 const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000);
      87                 :          0 :                 const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000);
      88                 :          0 :                 const bool bCloseSegment(OBJ_CARC != nIdentifier);
      89                 :          0 :                 const bool bCloseUsingCenter(OBJ_SECT == nIdentifier);
      90                 :            : 
      91                 :            :                 const drawinglayer::primitive2d::Primitive2DReference xReference(
      92                 :            :                     new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D(
      93                 :            :                         aObjectMatrix,
      94                 :            :                         aAttribute,
      95                 :            :                         fStart,
      96                 :            :                         fEnd,
      97                 :            :                         bCloseSegment,
      98 [ #  # ][ #  # ]:          0 :                         bCloseUsingCenter));
                 [ #  # ]
      99                 :            : 
     100         [ #  # ]:          0 :                 return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     101 [ +  - ][ +  - ]:        358 :             }
     102                 :            :         }
     103                 :            :     } // end of namespace contact
     104                 :            : } // end of namespace sdr
     105                 :            : 
     106                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10