LCOV - code coverage report
Current view: top level - svx/source/sdr/primitive2d - sdrpathprimitive2d.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 34 41 82.9 %
Date: 2015-06-13 12:38:46 Functions: 4 4 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 <sdr/primitive2d/sdrpathprimitive2d.hxx>
      21             : #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
      22             : #include <basegfx/polygon/b2dpolypolygontools.hxx>
      23             : #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
      24             : #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
      25             : #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
      26             : 
      27             : 
      28             : 
      29             : using namespace com::sun::star;
      30             : 
      31             : 
      32             : 
      33             : namespace drawinglayer
      34             : {
      35             :     namespace primitive2d
      36             :     {
      37       20932 :         Primitive2DSequence SdrPathPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
      38             :         {
      39       20932 :             Primitive2DSequence aRetval;
      40             : 
      41             :             // add fill
      42       41864 :             if(!getSdrLFSTAttribute().getFill().isDefault()
      43       20932 :                 && getUnitPolyPolygon().isClosed())
      44             :             {
      45             :                 // #i108255# no need to use correctOrientations here; target is
      46             :                 // straight visualisation
      47       12427 :                 basegfx::B2DPolyPolygon aTransformed(getUnitPolyPolygon());
      48             : 
      49       12427 :                 aTransformed.transform(getTransform());
      50             :                 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
      51             :                     createPolyPolygonFillPrimitive(
      52             :                         aTransformed,
      53       12427 :                         getSdrLFSTAttribute().getFill(),
      54       24854 :                         getSdrLFSTAttribute().getFillFloatTransGradient()));
      55             :             }
      56             : 
      57             :             // add line
      58       20932 :             if(getSdrLFSTAttribute().getLine().isDefault())
      59             :             {
      60             :                 // if initially no line is defined, create one for HitTest and BoundRect
      61             :                 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
      62             :                     createHiddenGeometryPrimitives2D(
      63             :                         false,
      64       12134 :                         getUnitPolyPolygon(),
      65       24268 :                         getTransform()));
      66             :             }
      67             :             else
      68             :             {
      69        8798 :                 Primitive2DSequence aTemp(getUnitPolyPolygon().count());
      70             : 
      71       41881 :                 for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++)
      72             :                 {
      73       33083 :                     basegfx::B2DPolygon aTransformed(getUnitPolyPolygon().getB2DPolygon(a));
      74             : 
      75       33083 :                     aTransformed.transform(getTransform());
      76       66166 :                     aTemp[a] = createPolygonLinePrimitive(
      77             :                         aTransformed,
      78       33083 :                         getSdrLFSTAttribute().getLine(),
      79       66166 :                         getSdrLFSTAttribute().getLineStartEnd());
      80       33083 :                 }
      81             : 
      82        8798 :                 appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp);
      83             :             }
      84             : 
      85             :             // add text
      86       20932 :             if(!getSdrLFSTAttribute().getText().isDefault())
      87             :             {
      88             :                 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
      89             :                     createTextPrimitive(
      90           0 :                         getUnitPolyPolygon(),
      91           0 :                         getTransform(),
      92           0 :                         getSdrLFSTAttribute().getText(),
      93           0 :                         getSdrLFSTAttribute().getLine(),
      94             :                         false,
      95             :                         false,
      96           0 :                         false));
      97             :             }
      98             : 
      99             :             // add shadow
     100       20932 :             if(!getSdrLFSTAttribute().getShadow().isDefault())
     101             :             {
     102           0 :                 aRetval = createEmbeddedShadowPrimitive(
     103             :                     aRetval,
     104           0 :                     getSdrLFSTAttribute().getShadow());
     105             :             }
     106             : 
     107       20932 :             return aRetval;
     108             :         }
     109             : 
     110       37258 :         SdrPathPrimitive2D::SdrPathPrimitive2D(
     111             :             const basegfx::B2DHomMatrix& rTransform,
     112             :             const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
     113             :             const basegfx::B2DPolyPolygon& rUnitPolyPolygon)
     114             :         :   BufferedDecompositionPrimitive2D(),
     115             :             maTransform(rTransform),
     116             :             maSdrLFSTAttribute(rSdrLFSTAttribute),
     117       37258 :             maUnitPolyPolygon(rUnitPolyPolygon)
     118             :         {
     119       37258 :         }
     120             : 
     121       23264 :         bool SdrPathPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
     122             :         {
     123       23264 :             if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
     124             :             {
     125       23093 :                 const SdrPathPrimitive2D& rCompare = static_cast<const SdrPathPrimitive2D&>(rPrimitive);
     126             : 
     127       23093 :                 return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon()
     128       20184 :                     && getTransform() == rCompare.getTransform()
     129       43027 :                     && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute());
     130             :             }
     131             : 
     132         171 :             return false;
     133             :         }
     134             : 
     135             :         // provide unique ID
     136       64847 :         ImplPrimitive2DIDBlock(SdrPathPrimitive2D, PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D)
     137             : 
     138             :     } // end of namespace primitive2d
     139             : } // end of namespace drawinglayer
     140             : 
     141             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11