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

Generated by: LCOV version 1.10