LCOV - code coverage report
Current view: top level - svgio/source/svgreader - svgmarkernode.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 63 0.0 %
Date: 2014-04-11 Functions: 0 7 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 <svgio/svgreader/svgmarkernode.hxx>
      21             : 
      22             : 
      23             : 
      24             : namespace svgio
      25             : {
      26             :     namespace svgreader
      27             :     {
      28           0 :         SvgMarkerNode::SvgMarkerNode(
      29             :             SvgDocument& rDocument,
      30             :             SvgNode* pParent)
      31             :         :   SvgNode(SVGTokenMarker, rDocument, pParent),
      32             :             aPrimitives(),
      33             :             maSvgStyleAttributes(*this),
      34             :             mpViewBox(0),
      35             :             maSvgAspectRatio(),
      36             :             maRefX(0),
      37             :             maRefY(0),
      38             :             maMarkerUnits(strokeWidth),
      39             :             maMarkerWidth(3),
      40             :             maMarkerHeight(3),
      41             :             mfAngle(0.0),
      42           0 :             mbOrientAuto(false)
      43             :         {
      44           0 :         }
      45             : 
      46           0 :         SvgMarkerNode::~SvgMarkerNode()
      47             :         {
      48           0 :             if(mpViewBox) delete mpViewBox;
      49           0 :         }
      50             : 
      51           0 :         const SvgStyleAttributes* SvgMarkerNode::getSvgStyleAttributes() const
      52             :         {
      53           0 :             return checkForCssStyle(OUString("marker"), maSvgStyleAttributes);
      54             :         }
      55             : 
      56           0 :         void SvgMarkerNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
      57             :         {
      58             :             // call parent
      59           0 :             SvgNode::parseAttribute(rTokenName, aSVGToken, aContent);
      60             : 
      61             :             // read style attributes
      62           0 :             maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent);
      63             : 
      64             :             // parse own
      65           0 :             switch(aSVGToken)
      66             :             {
      67             :                 case SVGTokenStyle:
      68             :                 {
      69           0 :                     maSvgStyleAttributes.readStyle(aContent);
      70           0 :                     break;
      71             :                 }
      72             :                 case SVGTokenViewBox:
      73             :                 {
      74           0 :                     const basegfx::B2DRange aRange(readViewBox(aContent, *this));
      75             : 
      76           0 :                     if(!aRange.isEmpty())
      77             :                     {
      78           0 :                         setViewBox(&aRange);
      79             :                     }
      80           0 :                     break;
      81             :                 }
      82             :                 case SVGTokenPreserveAspectRatio:
      83             :                 {
      84           0 :                     setSvgAspectRatio(readSvgAspectRatio(aContent));
      85           0 :                     break;
      86             :                 }
      87             :                 case SVGTokenRefX:
      88             :                 {
      89           0 :                     SvgNumber aNum;
      90             : 
      91           0 :                     if(readSingleNumber(aContent, aNum))
      92             :                     {
      93           0 :                         setRefX(aNum);
      94             :                     }
      95           0 :                     break;
      96             :                 }
      97             :                 case SVGTokenRefY:
      98             :                 {
      99           0 :                     SvgNumber aNum;
     100             : 
     101           0 :                     if(readSingleNumber(aContent, aNum))
     102             :                     {
     103           0 :                         setRefY(aNum);
     104             :                     }
     105           0 :                     break;
     106             :                 }
     107             :                 case SVGTokenMarkerUnits:
     108             :                 {
     109           0 :                     if(!aContent.isEmpty())
     110             :                     {
     111           0 :                         if(aContent.startsWith("strokeWidth"))
     112             :                         {
     113           0 :                             setMarkerUnits(strokeWidth);
     114             :                         }
     115           0 :                         else if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0))
     116             :                         {
     117           0 :                             setMarkerUnits(userSpaceOnUse);
     118             :                         }
     119             :                     }
     120           0 :                     break;
     121             :                 }
     122             :                 case SVGTokenMarkerWidth:
     123             :                 {
     124           0 :                     SvgNumber aNum;
     125             : 
     126           0 :                     if(readSingleNumber(aContent, aNum))
     127             :                     {
     128           0 :                         if(aNum.isPositive())
     129             :                         {
     130           0 :                             setMarkerWidth(aNum);
     131             :                         }
     132             :                     }
     133           0 :                     break;
     134             :                 }
     135             :                 case SVGTokenMarkerHeight:
     136             :                 {
     137           0 :                     SvgNumber aNum;
     138             : 
     139           0 :                     if(readSingleNumber(aContent, aNum))
     140             :                     {
     141           0 :                         if(aNum.isPositive())
     142             :                         {
     143           0 :                             setMarkerHeight(aNum);
     144             :                         }
     145             :                     }
     146           0 :                     break;
     147             :                 }
     148             :                 case SVGTokenOrient:
     149             :                 {
     150           0 :                     const sal_Int32 nLen(aContent.getLength());
     151             : 
     152           0 :                     if(nLen)
     153             :                     {
     154           0 :                         if(aContent.startsWith("auto"))
     155             :                         {
     156           0 :                             setOrientAuto(true);
     157             :                         }
     158             :                         else
     159             :                         {
     160           0 :                             sal_Int32 nPos(0);
     161           0 :                             double fAngle(0.0);
     162             : 
     163           0 :                             if(readAngle(aContent, nPos, fAngle, nLen))
     164             :                             {
     165           0 :                                 setAngle(fAngle);
     166             :                             }
     167             :                         }
     168             :                     }
     169           0 :                     break;
     170             :                 }
     171             :                 default:
     172             :                 {
     173           0 :                     break;
     174             :                 }
     175             :             }
     176           0 :         }
     177             : 
     178           0 :         const drawinglayer::primitive2d::Primitive2DSequence& SvgMarkerNode::getMarkerPrimitives() const
     179             :         {
     180           0 :             if(!aPrimitives.hasElements() && Display_none != getDisplay())
     181             :             {
     182           0 :                 decomposeSvgNode(const_cast< SvgMarkerNode* >(this)->aPrimitives, true);
     183             :             }
     184             : 
     185           0 :             return aPrimitives;
     186             :         }
     187             : 
     188           0 :         const basegfx::B2DRange SvgMarkerNode::getCurrentViewPort() const
     189             :         {
     190           0 :             if(getViewBox())
     191             :             {
     192           0 :                 return *(getViewBox());
     193             :             }
     194             :             else
     195             :             {
     196           0 :                 return SvgNode::getCurrentViewPort();
     197             :             }
     198             :         }
     199             : 
     200             :     } // end of namespace svgreader
     201             : } // end of namespace svgio
     202             : 
     203             : 
     204             : // eof
     205             : 
     206             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10