Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / tools / inc / poly.h
blob2c84bf7459cf095d4efb3c9198a2666c14ec0231
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 INCLUDED_TOOLS_INC_POLY_H
20 #define INCLUDED_TOOLS_INC_POLY_H
22 #include <sal/types.h>
23 #include <tools/poly.hxx>
25 class Point;
27 class SAL_WARN_UNUSED ImplPolygon
29 public:
30 std::unique_ptr<Point[]> mxPointAry;
31 std::unique_ptr<PolyFlags[]> mxFlagAry;
32 sal_uInt16 mnPoints;
34 public:
35 ImplPolygon() : mnPoints(0) {}
36 ImplPolygon( sal_uInt16 nInitSize );
37 ImplPolygon( sal_uInt16 nPoints, const Point* pPtAry, const PolyFlags* pInitFlags );
38 ImplPolygon( const ImplPolygon& rImplPoly );
39 ImplPolygon( const tools::Rectangle& rRect );
40 ImplPolygon( const tools::Rectangle& rRect, sal_uInt32 nHorzRound, sal_uInt32 nVertRound);
41 ImplPolygon( const Point& rCenter, long nRadX, long nRadY );
42 ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, const Point& rEnd,
43 PolyStyle eStyle, bool bFullCircle );
44 ImplPolygon( const Point& rBezPt1, const Point& rCtrlPt1, const Point& rBezPt2,
45 const Point& rCtrlPt2, sal_uInt16 nPoints );
46 ImplPolygon(const basegfx::B2DPolygon& rPolygon);
48 bool operator==( const ImplPolygon& rCandidate ) const;
50 void ImplInitSize(sal_uInt16 nInitSize, bool bFlags = false);
51 void ImplSetSize( sal_uInt16 nSize, bool bResize = true );
52 void ImplCreateFlagArray();
53 bool ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon const * pInitPoly = nullptr );
56 #define MAX_POLYGONS SAL_MAX_UINT16
58 namespace tools {
59 class Polygon;
62 struct ImplPolyPolygon
64 std::vector<tools::Polygon> mvPolyAry;
66 ImplPolyPolygon( sal_uInt16 nInitSize )
68 if ( !nInitSize )
69 nInitSize = 1;
70 mvPolyAry.reserve(nInitSize);
73 ImplPolyPolygon( const tools::Polygon& rPoly )
75 if ( rPoly.GetSize() )
76 mvPolyAry.push_back(rPoly);
77 else
78 mvPolyAry.reserve(16);
81 ImplPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon);
83 bool operator==(ImplPolyPolygon const & other) const
85 return mvPolyAry == other.mvPolyAry;
89 #endif
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */