LCOV - code coverage report
Current view: top level - include/svx - xpoly.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 1 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             : #ifndef INCLUDED_SVX_XPOLY_HXX
      20             : #define INCLUDED_SVX_XPOLY_HXX
      21             : 
      22             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      23             : #include <svx/svxdllapi.h>
      24             : 
      25             : class Point;
      26             : class Rectangle;
      27             : class SvStream;
      28             : class Polygon;
      29             : class PolyPolygon;
      30             : class OutputDevice;
      31             : 
      32             : #define XPOLYPOLY_APPEND     0xFFFF
      33             : #define XPOLY_APPEND         0xFFFF
      34             : 
      35             : #define XPOLY_MAXPOINTS      0xFFF0 /* Auch fuer die 32-Bitter etwas Luft lassen */
      36             : 
      37             : // Punktstile im XPolygon:
      38             : // NORMAL : Anfangs- oder Endpunkt einer Kurve oder Linie
      39             : // SMOOTH : Glatter Uebergang zwischen Kurven
      40             : // SYMMTR : glatter und symmetrischer Uebergang zwischen Kurven
      41             : // CONTROL: Kontrollpunkt einer Bezierkurve
      42             : 
      43             : enum XPolyFlags { XPOLY_NORMAL, XPOLY_SMOOTH, XPOLY_CONTROL, XPOLY_SYMMTR };
      44             : 
      45             : // Klasse XPolygon; hat neben dem Point-Array noch ein Array mit Flags,
      46             : // die Informationen ueber den jeweiligen Punkt enthalten
      47             : 
      48             : class ImpXPolygon;
      49             : 
      50             : class SVX_DLLPUBLIC XPolygon
      51             : {
      52             : protected:
      53             :     ImpXPolygon*    pImpXPolygon;
      54             : 
      55             :     // ImpXPolygon-ReferenceCount pruefen und ggf. abkoppeln
      56             :     void    CheckReference();
      57             : 
      58             :     // Hilfsfunktionen fuer Bezierkonvertierung
      59             :     void    SubdivideBezier(sal_uInt16 nPos, bool bCalcFirst, double fT);
      60             :     void    GenBezArc(const Point& rCenter, long nRx, long nRy,
      61             :                       long nXHdl, long nYHdl, sal_uInt16 nStart, sal_uInt16 nEnd,
      62             :                       sal_uInt16 nQuad, sal_uInt16 nFirst);
      63             :     bool    CheckAngles(sal_uInt16& nStart, sal_uInt16 nEnd, sal_uInt16& nA1, sal_uInt16& nA2);
      64             : 
      65             : public:
      66             :     XPolygon( sal_uInt16 nSize=16, sal_uInt16 nResize=16 );
      67             :     XPolygon( const XPolygon& rXPoly );
      68             :     XPolygon( const Polygon& rPoly );
      69             :     XPolygon( const Rectangle& rRect, long nRx = 0, long nRy = 0 );
      70             :     XPolygon( const Point& rCenter, long nRx, long nRy,
      71             :               sal_uInt16 nStartAngle = 0, sal_uInt16 nEndAngle = 3600,
      72             :               bool bClose = true );
      73             : 
      74             :     ~XPolygon();
      75             : 
      76             :     sal_uInt16      GetSize() const;
      77             : 
      78             :     void        SetPointCount( sal_uInt16 nPoints );
      79             :     sal_uInt16      GetPointCount() const;
      80             : 
      81             :     void        Insert( sal_uInt16 nPos, const Point& rPt, XPolyFlags eFlags );
      82             :     void        Insert( sal_uInt16 nPos, const XPolygon& rXPoly );
      83             :     void        Remove( sal_uInt16 nPos, sal_uInt16 nCount );
      84             :     void        Move( long nHorzMove, long nVertMove );
      85             :     Rectangle   GetBoundRect() const;
      86             : 
      87             :     const Point&    operator[]( sal_uInt16 nPos ) const;
      88             :           Point&    operator[]( sal_uInt16 nPos );
      89             :     XPolygon&       operator=( const XPolygon& rXPoly );
      90             :     bool            operator==( const XPolygon& rXPoly ) const;
      91             :     bool            operator!=( const XPolygon& rXPoly ) const;
      92             : 
      93             :     XPolyFlags  GetFlags( sal_uInt16 nPos ) const;
      94             :     void        SetFlags( sal_uInt16 nPos, XPolyFlags eFlags );
      95             :     bool        IsControl(sal_uInt16 nPos) const;
      96             :     bool        IsSmooth(sal_uInt16 nPos) const;
      97             : 
      98             :     // Abstand zwischen zwei Punkten
      99             :     double  CalcDistance(sal_uInt16 nP1, sal_uInt16 nP2);
     100             : 
     101             :     // Bezierkonvertierungen
     102             :     void CalcSmoothJoin(sal_uInt16 nCenter, sal_uInt16 nDrag, sal_uInt16 nPnt);
     103             :     void CalcTangent(sal_uInt16 nCenter, sal_uInt16 nPrev, sal_uInt16 nNext);
     104             :     void PointsToBezier(sal_uInt16 nFirst);
     105             : 
     106             :     // Transformationen
     107             :     void Translate(const Point& rTrans);
     108             :     void Scale(double fSx, double fSy);
     109             :     void Distort(const Rectangle& rRefRect, const XPolygon& rDistortedRect);
     110             : 
     111             :     // #116512# convert to basegfx::B2DPolygon and return
     112             :     basegfx::B2DPolygon getB2DPolygon() const;
     113             : 
     114             :     // #116512# constructor to convert from basegfx::B2DPolygon
     115             :      // #i76339# made explicit
     116             :      explicit XPolygon(const basegfx::B2DPolygon& rPolygon);
     117             : };
     118             : 
     119             : // Klasse XPolyPolygon; wie PolyPolygon, nur statt aus Polygonen aus
     120             : // XPolygonen bestehend
     121             : 
     122             : class ImpXPolyPolygon;
     123             : 
     124             : class SVX_DLLPUBLIC XPolyPolygon
     125             : {
     126             : protected:
     127             :     ImpXPolyPolygon* pImpXPolyPolygon;
     128             : 
     129             :     // ImpXPolyPolygon-ReferenceCount pruefen und ggf. abkoppeln
     130             :     void    CheckReference();
     131             : 
     132             : public:
     133             :                     XPolyPolygon( sal_uInt16 nInitSize = 16, sal_uInt16 nResize = 16 );
     134             :                     XPolyPolygon( const XPolyPolygon& rXPolyPoly );
     135             : 
     136             :                     ~XPolyPolygon();
     137             : 
     138             :     void            Insert( const XPolygon& rXPoly,
     139             :                             sal_uInt16 nPos = XPOLYPOLY_APPEND );
     140             :     void            Insert( const XPolyPolygon& rXPoly,
     141             :                             sal_uInt16 nPos=XPOLYPOLY_APPEND );
     142             :     XPolygon        Remove( sal_uInt16 nPos );
     143             :     const XPolygon& GetObject( sal_uInt16 nPos ) const;
     144             : 
     145             :     void            Clear();
     146             :     sal_uInt16          Count() const;
     147             : 
     148             :     Rectangle       GetBoundRect() const;
     149             : 
     150           0 :     const XPolygon& operator[]( sal_uInt16 nPos ) const
     151           0 :                         { return GetObject( nPos ); }
     152             :     XPolygon&       operator[]( sal_uInt16 nPos );
     153             : 
     154             :     XPolyPolygon&   operator=( const XPolyPolygon& rXPolyPoly );
     155             :     bool            operator==( const XPolyPolygon& rXPolyPoly ) const;
     156             :     bool            operator!=( const XPolyPolygon& rXPolyPoly ) const;
     157             : 
     158             :     // Transformationen
     159             :     void Distort(const Rectangle& rRefRect, const XPolygon& rDistortedRect);
     160             : 
     161             :     // #116512# convert to basegfx::B2DPolyPolygon and return
     162             :     basegfx::B2DPolyPolygon getB2DPolyPolygon() const;
     163             : 
     164             :     // #116512# constructor to convert from basegfx::B2DPolyPolygon
     165             :      // #i76339# made explicit
     166             :      explicit XPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon);
     167             : };
     168             : 
     169             : #endif // INCLUDED_SVX_XPOLY_HXX
     170             : 
     171             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10