LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/svx - xpoly.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2013-07-09 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 Polygon& rPoly );
      78             :     XPolygon( const Rectangle& rRect, long nRx = 0, long nRy = 0 );
      79             :     XPolygon( const Point& rCenter, long nRx, long nRy,
      80             :               sal_uInt16 nStartAngle = 0, sal_uInt16 nEndAngle = 3600,
      81             :               sal_Bool bClose = sal_True );
      82             : 
      83             :     ~XPolygon();
      84             : 
      85             :     sal_uInt16      GetSize() const;
      86             : 
      87             :     void        SetPointCount( sal_uInt16 nPoints );
      88             :     sal_uInt16      GetPointCount() const;
      89             : 
      90             :     void        Insert( sal_uInt16 nPos, const Point& rPt, XPolyFlags eFlags );
      91             :     void        Insert( sal_uInt16 nPos, const XPolygon& rXPoly );
      92             :     void        Remove( sal_uInt16 nPos, sal_uInt16 nCount );
      93             :     void        Move( long nHorzMove, long nVertMove );
      94             :     Rectangle   GetBoundRect() const;
      95             : 
      96             :     const Point&    operator[]( sal_uInt16 nPos ) const;
      97             :           Point&    operator[]( sal_uInt16 nPos );
      98             :     XPolygon&       operator=( const XPolygon& rXPoly );
      99             :     sal_Bool            operator==( const XPolygon& rXPoly ) const;
     100             :     sal_Bool            operator!=( const XPolygon& rXPoly ) const;
     101             : 
     102             :     XPolyFlags  GetFlags( sal_uInt16 nPos ) const;
     103             :     void        SetFlags( sal_uInt16 nPos, XPolyFlags eFlags );
     104             :     sal_Bool        IsControl(sal_uInt16 nPos) const;
     105             :     sal_Bool        IsSmooth(sal_uInt16 nPos) const;
     106             : 
     107             :     // Abstand zwischen zwei Punkten
     108             :     double  CalcDistance(sal_uInt16 nP1, sal_uInt16 nP2);
     109             : 
     110             :     // Bezierkonvertierungen
     111             :     void CalcSmoothJoin(sal_uInt16 nCenter, sal_uInt16 nDrag, sal_uInt16 nPnt);
     112             :     void CalcTangent(sal_uInt16 nCenter, sal_uInt16 nPrev, sal_uInt16 nNext);
     113             :     void PointsToBezier(sal_uInt16 nFirst);
     114             : 
     115             :     // Transformationen
     116             :     void Translate(const Point& rTrans);
     117             :     void Scale(double fSx, double fSy);
     118             :     void Distort(const Rectangle& rRefRect, const XPolygon& rDistortedRect);
     119             : 
     120             :     // #116512# convert to basegfx::B2DPolygon and return
     121             :     basegfx::B2DPolygon getB2DPolygon() const;
     122             : 
     123             :     // #116512# constructor to convert from basegfx::B2DPolygon
     124             :      // #i76339# made explicit
     125             :      explicit XPolygon(const basegfx::B2DPolygon& rPolygon);
     126             : };
     127             : 
     128             : /*************************************************************************
     129             : |*
     130             : |* Klasse XPolyPolygon; wie PolyPolygon, nur statt aus Polygonen aus
     131             : |* XPolygonen bestehend
     132             : |*
     133             : \************************************************************************/
     134             : 
     135             : class ImpXPolyPolygon;
     136             : 
     137             : class SVX_DLLPUBLIC XPolyPolygon
     138             : {
     139             : protected:
     140             :     ImpXPolyPolygon* pImpXPolyPolygon;
     141             : 
     142             :     // ImpXPolyPolygon-ReferenceCount pruefen und ggf. abkoppeln
     143             :     void    CheckReference();
     144             : 
     145             : public:
     146             :                     XPolyPolygon( sal_uInt16 nInitSize = 16, sal_uInt16 nResize = 16 );
     147             :                     XPolyPolygon( const XPolyPolygon& rXPolyPoly );
     148             : 
     149             :                     ~XPolyPolygon();
     150             : 
     151             :     void            Insert( const XPolygon& rXPoly,
     152             :                             sal_uInt16 nPos = XPOLYPOLY_APPEND );
     153             :     void            Insert( const XPolyPolygon& rXPoly,
     154             :                             sal_uInt16 nPos=XPOLYPOLY_APPEND );
     155             :     XPolygon        Remove( sal_uInt16 nPos );
     156             :     const XPolygon& GetObject( sal_uInt16 nPos ) const;
     157             : 
     158             :     void            Clear();
     159             :     sal_uInt16          Count() const;
     160             : 
     161             :     Rectangle       GetBoundRect() const;
     162             : 
     163           0 :     const XPolygon& operator[]( sal_uInt16 nPos ) const
     164           0 :                         { return GetObject( nPos ); }
     165             :     XPolygon&       operator[]( sal_uInt16 nPos );
     166             : 
     167             :     XPolyPolygon&   operator=( const XPolyPolygon& rXPolyPoly );
     168             :     sal_Bool            operator==( const XPolyPolygon& rXPolyPoly ) const;
     169             :     sal_Bool            operator!=( const XPolyPolygon& rXPolyPoly ) const;
     170             : 
     171             :     // Transformationen
     172             :     void Distort(const Rectangle& rRefRect, const XPolygon& rDistortedRect);
     173             : 
     174             :     // #116512# convert to basegfx::B2DPolyPolygon and return
     175             :     basegfx::B2DPolyPolygon getB2DPolyPolygon() const;
     176             : 
     177             :     // #116512# constructor to convert from basegfx::B2DPolyPolygon
     178             :      // #i76339# made explicit
     179             :      explicit XPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon);
     180             : };
     181             : 
     182             : #endif      // _XPOLY_HXX
     183             : 
     184             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10