LibreOffice Module tools (master) 1
poly.h
Go to the documentation of this file.
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#pragma once
20
21#include <sal/types.h>
22#include <memory>
23#include <tools/poly.hxx>
24
26{
27public:
28 std::unique_ptr<Point[]> mxPointAry;
29 std::unique_ptr<PolyFlags[]> mxFlagAry;
30 sal_uInt16 mnPoints;
31
32public:
33 ImplPolygon() : mnPoints(0) {}
34 ImplPolygon( sal_uInt16 nInitSize );
35 ImplPolygon( sal_uInt16 nPoints, const Point* pPtAry, const PolyFlags* pInitFlags );
36 ImplPolygon( const ImplPolygon& rImplPoly );
37 ImplPolygon( const tools::Rectangle& rRect );
38 ImplPolygon( const tools::Rectangle& rRect, sal_uInt32 nHorzRound, sal_uInt32 nVertRound);
39 ImplPolygon( const Point& rCenter, tools::Long nRadX, tools::Long nRadY );
40 ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, const Point& rEnd,
41 PolyStyle eStyle, bool bClockWiseArcDirection );
42 ImplPolygon( const Point& rBezPt1, const Point& rCtrlPt1, const Point& rBezPt2,
43 const Point& rCtrlPt2, sal_uInt16 nPoints );
44 ImplPolygon(const basegfx::B2DPolygon& rPolygon);
45
46 bool operator==( const ImplPolygon& rCandidate ) const;
47
48 void ImplInitSize(sal_uInt16 nInitSize, bool bFlags = false);
49 void ImplSetSize( sal_uInt16 nSize, bool bResize = true );
50 void ImplCreateFlagArray();
51 bool ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon const * pInitPoly = nullptr );
52};
53
54#define MAX_POLYGONS SAL_MAX_UINT16
55
57{
58 std::vector<tools::Polygon> mvPolyAry;
59
60 ImplPolyPolygon( sal_uInt16 nInitSize )
61 {
62 if ( !nInitSize )
63 nInitSize = 1;
64 mvPolyAry.reserve(nInitSize);
65 }
66
68 {
69 if ( rPoly.GetSize() )
70 mvPolyAry.push_back(rPoly);
71 else
72 mvPolyAry.reserve(16);
73 }
74
75 ImplPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon);
76
77 bool operator==(ImplPolyPolygon const & other) const
78 {
79 return mvPolyAry == other.mvPolyAry;
80 }
81};
82
83/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator==(const BigInt &rVal1, const BigInt &rVal2)
Definition: bigint.cxx:806
ImplPolygon()
Definition: poly.h:33
sal_uInt16 mnPoints
Definition: poly.h:30
std::unique_ptr< Point[]> mxPointAry
Definition: poly.h:28
std::unique_ptr< PolyFlags[]> mxFlagAry
Definition: poly.h:29
Definition: gen.hxx:78
sal_uInt16 GetSize() const
Definition: poly.cxx:1018
long Long
Definition: long.hxx:34
PolyFlags
Definition: poly.hxx:53
PolyStyle
Definition: poly.hxx:46
bool operator==(ImplPolyPolygon const &other) const
Definition: poly.h:77
ImplPolyPolygon(const tools::Polygon &rPoly)
Definition: poly.h:67
ImplPolyPolygon(sal_uInt16 nInitSize)
Definition: poly.h:60
std::vector< tools::Polygon > mvPolyAry
Definition: poly.h:58
#define SAL_WARN_UNUSED