LCOV - code coverage report
Current view: top level - svgio/inc/svgio/svgreader - svgcharacternode.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 24 0.0 %
Date: 2014-11-03 Functions: 0 24 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             : #ifndef INCLUDED_SVGIO_INC_SVGIO_SVGREADER_SVGCHARACTERNODE_HXX
      21             : #define INCLUDED_SVGIO_INC_SVGIO_SVGREADER_SVGCHARACTERNODE_HXX
      22             : 
      23             : #include <svgio/svgreader/svgnode.hxx>
      24             : 
      25             : namespace drawinglayer { namespace primitive2d { class TextSimplePortionPrimitive2D; }}
      26             : 
      27             : namespace svgio
      28             : {
      29             :     namespace svgreader
      30             :     {
      31           0 :         class SvgTextPositions
      32             :         {
      33             :         private:
      34             :             SvgNumberVector         maX;
      35             :             SvgNumberVector         maY;
      36             :             SvgNumberVector         maDx;
      37             :             SvgNumberVector         maDy;
      38             :             SvgNumberVector         maRotate;
      39             :             SvgNumber               maTextLength;
      40             : 
      41             :             /// bitfield
      42             :             bool                    mbLengthAdjust : 1; // true = spacing, false = spacingAndGlyphs
      43             : 
      44             :         public:
      45             :             SvgTextPositions();
      46             : 
      47             :             void parseTextPositionAttributes(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent);
      48             : 
      49             :             /// X content
      50           0 :             const SvgNumberVector& getX() const { return maX; }
      51           0 :             void setX(const SvgNumberVector& aX) { maX = aX; }
      52             : 
      53             :             /// Y content
      54           0 :             const SvgNumberVector& getY() const { return maY; }
      55           0 :             void setY(const SvgNumberVector& aY) { maY = aY; }
      56             : 
      57             :             /// Dx content
      58           0 :             const SvgNumberVector& getDx() const { return maDx; }
      59           0 :             void setDx(const SvgNumberVector& aDx) { maDx = aDx; }
      60             : 
      61             :             /// Dy content
      62           0 :             const SvgNumberVector& getDy() const { return maDy; }
      63           0 :             void setDy(const SvgNumberVector& aDy) { maDy = aDy; }
      64             : 
      65             :             /// Rotate content
      66           0 :             const SvgNumberVector& getRotate() const { return maRotate; }
      67           0 :             void setRotate(const SvgNumberVector& aRotate) { maRotate = aRotate; }
      68             : 
      69             :             /// TextLength content
      70           0 :             const SvgNumber& getTextLength() const { return maTextLength; }
      71           0 :             void setTextLength(const SvgNumber& rTextLength = SvgNumber()) { maTextLength = rTextLength; }
      72             : 
      73             :             /// LengthAdjust content
      74           0 :             bool getLengthAdjust() const { return mbLengthAdjust; }
      75           0 :             void setLengthAdjust(bool bNew) { mbLengthAdjust = bNew; }
      76             :         };
      77             :     } // end of namespace svgreader
      78             : } // end of namespace svgio
      79             : 
      80             : 
      81             : 
      82             : namespace svgio
      83             : {
      84             :     namespace svgreader
      85             :     {
      86           0 :         class SvgTextPosition
      87             :         {
      88             :         private:
      89             :             SvgTextPosition*            mpParent;
      90             :             ::std::vector< double >     maX;
      91             :             ::std::vector< double >     maY;
      92             :             ::std::vector< double >     maRotate;
      93             :             double                      mfTextLength;
      94             : 
      95             :             // absolute, current, advancing position
      96             :             basegfx::B2DPoint           maPosition;
      97             : 
      98             :             // advancing rotation index
      99             :             sal_uInt32                  mnRotationIndex;
     100             : 
     101             :             /// bitfield
     102             :             bool                        mbLengthAdjust : 1; // true = spacing, false = spacingAndGlyphs
     103             :             bool                        mbAbsoluteX : 1;
     104             :             bool                        mbAbsoluteY : 1;
     105             : 
     106             :         public:
     107             :             SvgTextPosition(
     108             :                 SvgTextPosition* pParent,
     109             :                 const InfoProvider& rInfoProvider,
     110             :                 const SvgTextPositions& rSvgTextPositions);
     111             : 
     112             :             // data read access
     113           0 :             const SvgTextPosition* getParent() const { return mpParent; }
     114           0 :             const ::std::vector< double >& getX() const { return maX; }
     115             :             const ::std::vector< double >& getY() const { return maY; }
     116           0 :             double getTextLength() const { return mfTextLength; }
     117           0 :             bool getLengthAdjust() const { return mbLengthAdjust; }
     118           0 :             bool getAbsoluteX() const { return mbAbsoluteX; }
     119             :             bool getAbsoluteY() const { return mbAbsoluteY; }
     120             : 
     121             :             // get/set absolute, current, advancing position
     122           0 :             const basegfx::B2DPoint& getPosition() const { return maPosition; }
     123           0 :             void setPosition(const basegfx::B2DPoint& rNew) { maPosition = rNew; }
     124             : 
     125             :             // rotation handling
     126             :             bool isRotated() const;
     127             :             double consumeRotation();
     128             :         };
     129             :     } // end of namespace svgreader
     130             : } // end of namespace svgio
     131             : 
     132             : 
     133             : 
     134             : namespace svgio
     135             : {
     136             :     namespace svgreader
     137             :     {
     138             :         class SvgCharacterNode : public SvgNode
     139             :         {
     140             :         private:
     141             :             /// the string data
     142             :             OUString           maText;
     143             : 
     144             :             /// local helpers
     145             :             drawinglayer::primitive2d::TextSimplePortionPrimitive2D* createSimpleTextPrimitive(
     146             :                 SvgTextPosition& rSvgTextPosition,
     147             :                 const SvgStyleAttributes& rSvgStyleAttributes) const;
     148             :             void decomposeTextWithStyle(
     149             :                 drawinglayer::primitive2d::Primitive2DSequence& rTarget,
     150             :                 SvgTextPosition& rSvgTextPosition,
     151             :                 const SvgStyleAttributes& rSvgStyleAttributes) const;
     152             : 
     153             :         public:
     154             :             SvgCharacterNode(
     155             :                 SvgDocument& rDocument,
     156             :                 SvgNode* pParent,
     157             :                 const OUString& rText);
     158             :             virtual ~SvgCharacterNode();
     159             : 
     160             :             virtual const SvgStyleAttributes* getSvgStyleAttributes() const SAL_OVERRIDE;
     161             :             virtual void decomposeText(drawinglayer::primitive2d::Primitive2DSequence& rTarget, SvgTextPosition& rSvgTextPosition) const;
     162             :             void whiteSpaceHandling();
     163             :             void addGap();
     164             :             void concatenate(const OUString& rText);
     165             : 
     166             :             /// Text content
     167           0 :             const OUString& getText() const { return maText; }
     168             :         };
     169             :     } // end of namespace svgreader
     170             : } // end of namespace svgio
     171             : 
     172             : #endif // INCLUDED_SVGIO_INC_SVGIO_SVGREADER_SVGCHARACTERNODE_HXX
     173             : 
     174             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10