LCOV - code coverage report
Current view: top level - svx/source/sdr/primitive2d - sdrpathprimitive2d.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 33 39 84.6 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 39 76 51.3 %

           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                 :            : #include <svx/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                 :      15198 :         Primitive2DSequence SdrPathPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
      38                 :            :         {
      39                 :      15198 :             Primitive2DSequence aRetval;
      40                 :            : 
      41                 :            :             // add fill
      42 [ +  + ][ +  + ]:      30171 :             if(!getSdrLFSTAttribute().getFill().isDefault()
         [ +  + ][ +  - ]
      43         [ +  - ]:      14973 :                 && getUnitPolyPolygon().isClosed())
      44                 :            :             {
      45                 :            :                 // #i108255# no need to use correctOrientations here; target is
      46                 :            :                 // straight visualisation
      47                 :            :                 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
      48                 :            :                     createPolyPolygonFillPrimitive(
      49                 :       8658 :                         getUnitPolyPolygon(),
      50                 :       8658 :                         getTransform(),
      51                 :       8658 :                         getSdrLFSTAttribute().getFill(),
      52 [ +  - ][ +  - ]:      17316 :                         getSdrLFSTAttribute().getFillFloatTransGradient()));
      53                 :            :             }
      54                 :            : 
      55                 :            :             // add line
      56 [ +  - ][ +  + ]:      15198 :             if(getSdrLFSTAttribute().getLine().isDefault())
      57                 :            :             {
      58                 :            :                 // if initially no line is defined, create one for HitTest and BoundRect
      59                 :            :                 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
      60                 :            :                     createHiddenGeometryPrimitives2D(
      61                 :            :                         false,
      62                 :       8525 :                         getUnitPolyPolygon(),
      63 [ +  - ][ +  - ]:      17050 :                         getTransform()));
      64                 :            :             }
      65                 :            :             else
      66                 :            :             {
      67 [ +  - ][ +  - ]:       6673 :                 Primitive2DSequence aTemp(getUnitPolyPolygon().count());
      68                 :            : 
      69 [ +  - ][ +  + ]:      29497 :                 for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++)
      70                 :            :                 {
      71         [ +  - ]:      22824 :                     aTemp[a] = createPolygonLinePrimitive(
      72                 :      22824 :                         getUnitPolyPolygon().getB2DPolygon(a),
      73                 :      22824 :                         getTransform(),
      74                 :      22824 :                         getSdrLFSTAttribute().getLine(),
      75 [ +  - ][ +  - ]:      68472 :                         getSdrLFSTAttribute().getLineStartEnd());
         [ +  - ][ +  - ]
      76                 :            :                 }
      77                 :            : 
      78 [ +  - ][ +  - ]:       6673 :                 appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp);
      79                 :            :             }
      80                 :            : 
      81                 :            :             // add text
      82 [ +  - ][ -  + ]:      15198 :             if(!getSdrLFSTAttribute().getText().isDefault())
      83                 :            :             {
      84                 :            :                 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
      85                 :            :                     createTextPrimitive(
      86                 :          0 :                         getUnitPolyPolygon(),
      87                 :          0 :                         getTransform(),
      88                 :          0 :                         getSdrLFSTAttribute().getText(),
      89                 :          0 :                         getSdrLFSTAttribute().getLine(),
      90                 :            :                         false,
      91                 :            :                         false,
      92 [ #  # ][ #  # ]:          0 :                         false));
      93                 :            :             }
      94                 :            : 
      95                 :            :             // add shadow
      96 [ +  - ][ -  + ]:      15198 :             if(!getSdrLFSTAttribute().getShadow().isDefault())
      97                 :            :             {
      98                 :            :                 aRetval = createEmbeddedShadowPrimitive(
      99                 :            :                     aRetval,
     100 [ #  # ][ #  # ]:          0 :                     getSdrLFSTAttribute().getShadow());
                 [ #  # ]
     101                 :            :             }
     102                 :            : 
     103                 :      15198 :             return aRetval;
     104                 :            :         }
     105                 :            : 
     106                 :      33552 :         SdrPathPrimitive2D::SdrPathPrimitive2D(
     107                 :            :             const basegfx::B2DHomMatrix& rTransform,
     108                 :            :             const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
     109                 :            :             const basegfx::B2DPolyPolygon& rUnitPolyPolygon)
     110                 :            :         :   BufferedDecompositionPrimitive2D(),
     111                 :            :             maTransform(rTransform),
     112                 :            :             maSdrLFSTAttribute(rSdrLFSTAttribute),
     113 [ +  - ][ +  - ]:      33552 :             maUnitPolyPolygon(rUnitPolyPolygon)
                 [ +  - ]
     114                 :            :         {
     115                 :      33552 :         }
     116                 :            : 
     117                 :      23056 :         bool SdrPathPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
     118                 :            :         {
     119         [ +  - ]:      23056 :             if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
     120                 :            :             {
     121                 :      23056 :                 const SdrPathPrimitive2D& rCompare = (SdrPathPrimitive2D&)rPrimitive;
     122                 :            : 
     123                 :      23056 :                 return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon()
     124                 :      23056 :                     && getTransform() == rCompare.getTransform()
     125         [ +  - ]:      46112 :                     && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute());
           [ +  -  +  + ]
     126                 :            :             }
     127                 :            : 
     128                 :      23056 :             return false;
     129                 :            :         }
     130                 :            : 
     131                 :            :         // provide unique ID
     132                 :      78633 :         ImplPrimitrive2DIDBlock(SdrPathPrimitive2D, PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D)
     133                 :            : 
     134                 :            :     } // end of namespace primitive2d
     135                 :            : } // end of namespace drawinglayer
     136                 :            : 
     137                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10