LCOV - code coverage report
Current view: top level - drawinglayer/source/processor2d - contourextractor2d.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 66 0.0 %
Date: 2012-08-25 Functions: 0 4 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 159 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <drawinglayer/processor2d/contourextractor2d.hxx>
      30                 :            : #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
      31                 :            : #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
      32                 :            : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
      33                 :            : #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
      34                 :            : #include <basegfx/polygon/b2dpolygontools.hxx>
      35                 :            : #include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
      36                 :            : #include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
      37                 :            : #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
      38                 :            : #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
      39                 :            : #include <drawinglayer/primitive2d/sceneprimitive2d.hxx>
      40                 :            : 
      41                 :            : //////////////////////////////////////////////////////////////////////////////
      42                 :            : 
      43                 :            : using namespace com::sun::star;
      44                 :            : 
      45                 :            : //////////////////////////////////////////////////////////////////////////////
      46                 :            : 
      47                 :            : namespace drawinglayer
      48                 :            : {
      49                 :            :     namespace processor2d
      50                 :            :     {
      51                 :          0 :         ContourExtractor2D::ContourExtractor2D(const geometry::ViewInformation2D& rViewInformation)
      52                 :            :         :   BaseProcessor2D(rViewInformation),
      53         [ #  # ]:          0 :             maExtractedContour()
      54                 :            :         {
      55                 :          0 :         }
      56                 :            : 
      57                 :          0 :         ContourExtractor2D::~ContourExtractor2D()
      58                 :            :         {
      59         [ #  # ]:          0 :         }
      60                 :            : 
      61                 :          0 :         void ContourExtractor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate)
      62                 :            :         {
      63   [ #  #  #  #  :          0 :             switch(rCandidate.getPrimitive2DID())
          #  #  #  #  #  
                   #  # ]
      64                 :            :             {
      65                 :            :                 case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D :
      66                 :            :                 {
      67                 :            :                     // extract hairline in world coordinates
      68                 :          0 :                     const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate));
      69         [ #  # ]:          0 :                     basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon());
      70 [ #  # ][ #  # ]:          0 :                     aLocalPolygon.transform(getViewInformation2D().getObjectTransformation());
      71                 :            : 
      72 [ #  # ][ #  # ]:          0 :                     if(aLocalPolygon.isClosed())
      73                 :            :                     {
      74                 :            :                         // line polygons need to be represented as open polygons to differentiate them
      75                 :            :                         // from filled polygons
      76         [ #  # ]:          0 :                         basegfx::tools::openWithGeometryChange(aLocalPolygon);
      77                 :            :                     }
      78                 :            : 
      79 [ #  # ][ #  # ]:          0 :                     maExtractedContour.push_back(basegfx::B2DPolyPolygon(aLocalPolygon));
                 [ #  # ]
      80         [ #  # ]:          0 :                     break;
      81                 :            :                 }
      82                 :            :                 case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D :
      83                 :            :                 {
      84                 :            :                     // extract fill in world coordinates
      85                 :          0 :                     const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolyPolygonColorPrimitive2D& >(rCandidate));
      86         [ #  # ]:          0 :                     basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
      87 [ #  # ][ #  # ]:          0 :                     aLocalPolyPolygon.transform(getViewInformation2D().getObjectTransformation());
      88         [ #  # ]:          0 :                     maExtractedContour.push_back(aLocalPolyPolygon);
      89         [ #  # ]:          0 :                     break;
      90                 :            :                 }
      91                 :            :                 case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
      92                 :            :                 {
      93                 :            :                     // extract BoundRect from bitmaps in world coordinates
      94                 :          0 :                     const primitive2d::BitmapPrimitive2D& rBitmapCandidate(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate));
      95 [ #  # ][ #  # ]:          0 :                     basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectTransformation() * rBitmapCandidate.getTransform());
      96         [ #  # ]:          0 :                     basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
      97         [ #  # ]:          0 :                     aPolygon.transform(aLocalTransform);
      98 [ #  # ][ #  # ]:          0 :                     maExtractedContour.push_back(basegfx::B2DPolyPolygon(aPolygon));
                 [ #  # ]
      99 [ #  # ][ #  # ]:          0 :                     break;
     100                 :            :                 }
     101                 :            :                 case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
     102                 :            :                 {
     103                 :            :                     // extract BoundRect from MetaFiles in world coordinates
     104                 :          0 :                     const primitive2d::MetafilePrimitive2D& rMetaCandidate(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate));
     105 [ #  # ][ #  # ]:          0 :                     basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectTransformation() * rMetaCandidate.getTransform());
     106         [ #  # ]:          0 :                     basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
     107         [ #  # ]:          0 :                     aPolygon.transform(aLocalTransform);
     108 [ #  # ][ #  # ]:          0 :                     maExtractedContour.push_back(basegfx::B2DPolyPolygon(aPolygon));
                 [ #  # ]
     109 [ #  # ][ #  # ]:          0 :                     break;
     110                 :            :                 }
     111                 :            :                 case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D :
     112                 :            :                 {
     113                 :            :                     // sub-transparence group. Look at children
     114                 :          0 :                     const primitive2d::TransparencePrimitive2D& rTransCandidate(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate));
     115                 :          0 :                     process(rTransCandidate.getChildren());
     116                 :          0 :                     break;
     117                 :            :                 }
     118                 :            :                 case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
     119                 :            :                 {
     120                 :            :                     // extract mask in world coordinates, ignore content
     121                 :          0 :                     const primitive2d::MaskPrimitive2D& rMaskCandidate(static_cast< const primitive2d::MaskPrimitive2D& >(rCandidate));
     122         [ #  # ]:          0 :                     basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask());
     123 [ #  # ][ #  # ]:          0 :                     aMask.transform(getViewInformation2D().getObjectTransformation());
     124 [ #  # ][ #  # ]:          0 :                     maExtractedContour.push_back(basegfx::B2DPolyPolygon(aMask));
                 [ #  # ]
     125         [ #  # ]:          0 :                     break;
     126                 :            :                 }
     127                 :            :                 case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D :
     128                 :            :                 {
     129                 :            :                     // remember current ViewInformation2D
     130                 :          0 :                     const primitive2d::TransformPrimitive2D& rTransformCandidate(static_cast< const primitive2d::TransformPrimitive2D& >(rCandidate));
     131         [ #  # ]:          0 :                     const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
     132                 :            : 
     133                 :            :                     // create new local ViewInformation2D
     134                 :            :                     const geometry::ViewInformation2D aViewInformation2D(
     135         [ #  # ]:          0 :                         getViewInformation2D().getObjectTransformation() * rTransformCandidate.getTransformation(),
     136         [ #  # ]:          0 :                         getViewInformation2D().getViewTransformation(),
     137         [ #  # ]:          0 :                         getViewInformation2D().getViewport(),
     138         [ #  # ]:          0 :                         getViewInformation2D().getVisualizedPage(),
     139                 :          0 :                         getViewInformation2D().getViewTime(),
     140   [ #  #  #  # ]:          0 :                         getViewInformation2D().getExtendedInformationSequence());
         [ #  # ][ #  # ]
                 [ #  # ]
     141         [ #  # ]:          0 :                     updateViewInformation(aViewInformation2D);
     142                 :            : 
     143                 :            :                     // proccess content
     144         [ #  # ]:          0 :                     process(rTransformCandidate.getChildren());
     145                 :            : 
     146                 :            :                     // restore transformations
     147         [ #  # ]:          0 :                     updateViewInformation(aLastViewInformation2D);
     148                 :            : 
     149 [ #  # ][ #  # ]:          0 :                     break;
     150                 :            :                 }
     151                 :            :                 case PRIMITIVE2D_ID_SCENEPRIMITIVE2D :
     152                 :            :                 {
     153                 :            :                     // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates
     154                 :          0 :                     const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate));
     155         [ #  # ]:          0 :                     const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D());
     156         [ #  # ]:          0 :                     const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rScenePrimitive2DCandidate.getShadow2D(getViewInformation2D()));
     157                 :            : 
     158                 :            :                     // proccess content
     159         [ #  # ]:          0 :                     if(xExtracted2DSceneGeometry.hasElements())
     160                 :            :                     {
     161         [ #  # ]:          0 :                         process(xExtracted2DSceneGeometry);
     162                 :            :                     }
     163                 :            : 
     164                 :            :                     // proccess content
     165         [ #  # ]:          0 :                     if(xExtracted2DSceneShadow.hasElements())
     166                 :            :                     {
     167         [ #  # ]:          0 :                         process(xExtracted2DSceneShadow);
     168                 :            :                     }
     169                 :            : 
     170 [ #  # ][ #  # ]:          0 :                     break;
     171                 :            :                 }
     172                 :            :                 case PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D :
     173                 :            :                 case PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D :
     174                 :            :                 case PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D :
     175                 :            :                 {
     176                 :            :                     // ignorable primitives
     177                 :          0 :                     break;
     178                 :            :                 }
     179                 :            :                 case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D :
     180                 :            :                 case PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D :
     181                 :            :                 {
     182                 :            :                     // primitives who's BoundRect will be added in world coordinates
     183         [ #  # ]:          0 :                     basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D()));
     184 [ #  # ][ #  # ]:          0 :                     aRange.transform(getViewInformation2D().getObjectTransformation());
     185 [ #  # ][ #  # ]:          0 :                     maExtractedContour.push_back(basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(aRange)));
         [ #  # ][ #  # ]
                 [ #  # ]
     186                 :            :                     break;
     187                 :            :                 }
     188                 :            :                 default :
     189                 :            :                 {
     190                 :            :                     // process recursively
     191         [ #  # ]:          0 :                     process(rCandidate.get2DDecomposition(getViewInformation2D()));
     192                 :          0 :                     break;
     193                 :            :                 }
     194                 :            :             }
     195                 :          0 :         }
     196                 :            : 
     197                 :            :     } // end of namespace processor2d
     198                 :            : } // end of namespace drawinglayer
     199                 :            : 
     200                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10