LCOV - code coverage report
Current view: top level - libreoffice/drawinglayer/source/processor2d - linegeometryextractor2d.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 40 0.0 %
Date: 2012-12-27 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             : #include <drawinglayer/processor2d/linegeometryextractor2d.hxx>
      21             : #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
      22             : #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
      23             : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
      24             : #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
      25             : 
      26             : //////////////////////////////////////////////////////////////////////////////
      27             : 
      28             : using namespace com::sun::star;
      29             : 
      30             : //////////////////////////////////////////////////////////////////////////////
      31             : 
      32             : namespace drawinglayer
      33             : {
      34             :     namespace processor2d
      35             :     {
      36           0 :         LineGeometryExtractor2D::LineGeometryExtractor2D(const geometry::ViewInformation2D& rViewInformation)
      37             :         :   BaseProcessor2D(rViewInformation),
      38             :             maExtractedHairlines(),
      39             :             maExtractedLineFills(),
      40           0 :             mbInLineGeometry(false)
      41             :         {
      42           0 :         }
      43             : 
      44           0 :         LineGeometryExtractor2D::~LineGeometryExtractor2D()
      45             :         {
      46           0 :         }
      47             : 
      48           0 :         void LineGeometryExtractor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate)
      49             :         {
      50           0 :             switch(rCandidate.getPrimitive2DID())
      51             :             {
      52             :                 case PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D :
      53             :                 case PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D :
      54             :                 {
      55             :                     // enter a line geometry group (with or without LineEnds)
      56           0 :                     bool bOldState(mbInLineGeometry);
      57           0 :                     mbInLineGeometry = true;
      58           0 :                     process(rCandidate.get2DDecomposition(getViewInformation2D()));
      59           0 :                     mbInLineGeometry = bOldState;
      60           0 :                     break;
      61             :                 }
      62             :                 case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D :
      63             :                 {
      64           0 :                     if(mbInLineGeometry)
      65             :                     {
      66             :                         // extract hairline line geometry in world coordinates
      67           0 :                         const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate));
      68           0 :                         basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon());
      69           0 :                         aLocalPolygon.transform(getViewInformation2D().getObjectTransformation());
      70           0 :                         maExtractedHairlines.push_back(aLocalPolygon);
      71             :                     }
      72           0 :                     break;
      73             :                 }
      74             :                 case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D :
      75             :                 {
      76           0 :                     if(mbInLineGeometry)
      77             :                     {
      78             :                         // extract filled line geometry (line with width)
      79           0 :                         const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolyPolygonColorPrimitive2D& >(rCandidate));
      80           0 :                         basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
      81           0 :                         aLocalPolyPolygon.transform(getViewInformation2D().getObjectTransformation());
      82           0 :                         maExtractedLineFills.push_back(aLocalPolyPolygon);
      83             :                     }
      84           0 :                     break;
      85             :                 }
      86             :                 case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D :
      87             :                 {
      88             :                     // remember current transformation and ViewInformation
      89           0 :                     const primitive2d::TransformPrimitive2D& rTransformCandidate(static_cast< const primitive2d::TransformPrimitive2D& >(rCandidate));
      90           0 :                     const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
      91             : 
      92             :                     // create new transformations for CurrentTransformation and for local ViewInformation2D
      93             :                     const geometry::ViewInformation2D aViewInformation2D(
      94           0 :                         getViewInformation2D().getObjectTransformation() * rTransformCandidate.getTransformation(),
      95           0 :                         getViewInformation2D().getViewTransformation(),
      96           0 :                         getViewInformation2D().getViewport(),
      97           0 :                         getViewInformation2D().getVisualizedPage(),
      98           0 :                         getViewInformation2D().getViewTime(),
      99           0 :                         getViewInformation2D().getExtendedInformationSequence());
     100           0 :                     updateViewInformation(aViewInformation2D);
     101             : 
     102             :                     // proccess content
     103           0 :                     process(rTransformCandidate.getChildren());
     104             : 
     105             :                     // restore transformations
     106           0 :                     updateViewInformation(aLastViewInformation2D);
     107             : 
     108           0 :                     break;
     109             :                 }
     110             :                 case PRIMITIVE2D_ID_SCENEPRIMITIVE2D :
     111             :                 case PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D :
     112             :                 case PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D :
     113             :                 case PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D :
     114             :                 case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
     115             :                 case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
     116             :                 case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
     117             :                 {
     118             :                     // ignorable primitives
     119           0 :                     break;
     120             :                 }
     121             :                 default :
     122             :                 {
     123             :                     // process recursively
     124           0 :                     process(rCandidate.get2DDecomposition(getViewInformation2D()));
     125           0 :                     break;
     126             :                 }
     127             :             }
     128           0 :         }
     129             :     } // end of namespace processor2d
     130             : } // end of namespace drawinglayer
     131             : 
     132             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10