fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / svx / xpoly.hxx
blobf6a846f6b470927103de2917275c26301199f0f6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _XPOLY_HXX
20 #define _XPOLY_HXX
22 #include <tools/solar.h>
23 #include <basegfx/polygon/b2dpolypolygon.hxx>
24 #include "svx/svxdllapi.h"
26 class Point;
27 class Rectangle;
28 class SvStream;
29 class Polygon;
30 class PolyPolygon;
31 class OutputDevice;
33 /************************************************************************/
35 #define XPOLYPOLY_APPEND 0xFFFF
36 #define XPOLY_APPEND 0xFFFF
38 #define XPOLY_MAXPOINTS 0xFFF0 /* Auch fuer die 32-Bitter etwas Luft lassen */
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
47 enum XPolyFlags { XPOLY_NORMAL, XPOLY_SMOOTH, XPOLY_CONTROL, XPOLY_SYMMTR };
50 /*************************************************************************
52 |* Klasse XPolygon; hat neben dem Point-Array noch ein Array mit Flags,
53 |* die Informationen ueber den jeweiligen Punkt enthalten
55 \************************************************************************/
57 class ImpXPolygon;
59 class SVX_DLLPUBLIC XPolygon
61 protected:
62 ImpXPolygon* pImpXPolygon;
64 // ImpXPolygon-ReferenceCount pruefen und ggf. abkoppeln
65 void CheckReference();
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);
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 );
82 ~XPolygon();
84 void SetPointCount( sal_uInt16 nPoints );
85 sal_uInt16 GetPointCount() const;
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;
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;
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;
104 // Abstand zwischen zwei Punkten
105 double CalcDistance(sal_uInt16 nP1, sal_uInt16 nP2);
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);
112 // Transformationen
113 void Translate(const Point& rTrans);
114 void Scale(double fSx, double fSy);
115 void Distort(const Rectangle& rRefRect, const XPolygon& rDistortedRect);
117 // #116512# convert to basegfx::B2DPolygon and return
118 basegfx::B2DPolygon getB2DPolygon() const;
120 // #116512# constructor to convert from basegfx::B2DPolygon
121 // #i76339# made explicit
122 explicit XPolygon(const basegfx::B2DPolygon& rPolygon);
125 /*************************************************************************
127 |* Klasse XPolyPolygon; wie PolyPolygon, nur statt aus Polygonen aus
128 |* XPolygonen bestehend
130 \************************************************************************/
132 class ImpXPolyPolygon;
134 class SVX_DLLPUBLIC XPolyPolygon
136 protected:
137 ImpXPolyPolygon* pImpXPolyPolygon;
139 // ImpXPolyPolygon-ReferenceCount pruefen und ggf. abkoppeln
140 void CheckReference();
142 public:
143 XPolyPolygon( sal_uInt16 nInitSize = 16, sal_uInt16 nResize = 16 );
144 XPolyPolygon( const XPolyPolygon& rXPolyPoly );
146 ~XPolyPolygon();
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;
155 void Clear();
156 sal_uInt16 Count() const;
158 Rectangle GetBoundRect() const;
160 const XPolygon& operator[]( sal_uInt16 nPos ) const
161 { return GetObject( nPos ); }
162 XPolygon& operator[]( sal_uInt16 nPos );
164 XPolyPolygon& operator=( const XPolyPolygon& rXPolyPoly );
165 sal_Bool operator==( const XPolyPolygon& rXPolyPoly ) const;
166 sal_Bool operator!=( const XPolyPolygon& rXPolyPoly ) const;
168 // Transformationen
169 void Distort(const Rectangle& rRefRect, const XPolygon& rDistortedRect);
171 // #116512# convert to basegfx::B2DPolyPolygon and return
172 basegfx::B2DPolyPolygon getB2DPolyPolygon() const;
174 // #116512# constructor to convert from basegfx::B2DPolyPolygon
175 // #i76339# made explicit
176 explicit XPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon);
179 #endif // _XPOLY_HXX
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */