tdf#164803 sw: Fix SwTextSizeInfo applying grid metrics without grid
[LibreOffice.git] / include / basegfx / polygon / b3dpolygon.hxx
blob09544766e6626dbe7b818e0530db8ca507e9c2af
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 .
20 #pragma once
22 #include <sal/types.h>
23 #include <o3tl/cow_wrapper.hxx>
24 #include <basegfx/basegfxdllapi.h>
26 class ImplB3DPolygon;
28 namespace basegfx
30 class B3DPoint;
31 class B3DHomMatrix;
32 class B3DVector;
33 class B2DPoint;
34 class B2DHomMatrix;
35 class BColor;
38 namespace basegfx
40 class BASEGFX_DLLPUBLIC B3DPolygon
42 public:
43 typedef o3tl::cow_wrapper< ImplB3DPolygon, o3tl::ThreadSafeRefCountingPolicy > ImplType;
45 private:
46 // internal data.
47 ImplType mpPolygon;
49 public:
50 B3DPolygon();
51 B3DPolygon(const B3DPolygon& rPolygon);
52 B3DPolygon(B3DPolygon&& rPolygon);
53 ~B3DPolygon();
55 // assignment operator
56 B3DPolygon& operator=(const B3DPolygon& rPolygon);
57 B3DPolygon& operator=(B3DPolygon&& rPolygon);
59 // compare operators
60 bool operator==(const B3DPolygon& rPolygon) const;
62 // member count
63 sal_uInt32 count() const;
65 // Coordinate interface
66 B3DPoint const & getB3DPoint(sal_uInt32 nIndex) const;
67 void setB3DPoint(sal_uInt32 nIndex, const B3DPoint& rValue);
69 // Coordinate append
70 void append(const B3DPoint& rPoint, sal_uInt32 nCount = 1);
72 // BColor interface
73 BColor const & getBColor(sal_uInt32 nIndex) const;
74 void setBColor(sal_uInt32 nIndex, const BColor& rValue);
75 bool areBColorsUsed() const;
76 void clearBColors();
78 // Normals interface
79 B3DVector getNormal() const; // plane normal
80 B3DVector const & getNormal(sal_uInt32 nIndex) const; // normal in each point
81 void setNormal(sal_uInt32 nIndex, const B3DVector& rValue);
82 void transformNormals(const B3DHomMatrix& rMatrix);
83 bool areNormalsUsed() const;
84 void clearNormals();
86 // TextureCoordinate interface
87 B2DPoint const & getTextureCoordinate(sal_uInt32 nIndex) const;
88 void setTextureCoordinate(sal_uInt32 nIndex, const B2DPoint& rValue);
89 void transformTextureCoordinates(const B2DHomMatrix& rMatrix);
90 bool areTextureCoordinatesUsed() const;
91 void clearTextureCoordinates();
93 // append other 2D polygons
94 void append(const B3DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
96 // remove
97 void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
99 // clear all points
100 void clear();
102 // closed state
103 bool isClosed() const;
104 void setClosed(bool bNew);
106 // flip polygon direction
107 void flip();
109 // test if Polygon has double points
110 bool hasDoublePoints() const;
112 // remove double points, at the begin/end and follow-ups, too
113 void removeDoublePoints();
115 // apply transformation given in matrix form to the polygon
116 void transform(const B3DHomMatrix& rMatrix);
118 } // end of namespace basegfx
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */