/src/libreoffice/include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx
Line | Count | Source |
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 | | |
20 | | #pragma once |
21 | | |
22 | | #include <drawinglayer/drawinglayerdllapi.h> |
23 | | |
24 | | #include <drawinglayer/primitive2d/baseprimitive2d.hxx> |
25 | | #include <basegfx/polygon/b2dpolygon.hxx> |
26 | | #include <basegfx/color/bcolor.hxx> |
27 | | |
28 | | namespace drawinglayer::primitive2d |
29 | | { |
30 | | /** PolygonHairlinePrimitive2D class |
31 | | |
32 | | This primitive defines a Hairline. Since hairlines are view-dependent, |
33 | | this primitive is view-dependent, too. |
34 | | |
35 | | This is one of the non-decomposable primitives, so a renderer |
36 | | should process it. |
37 | | */ |
38 | | class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive2D final : public BasePrimitive2D |
39 | | { |
40 | | private: |
41 | | /// the hairline geometry |
42 | | basegfx::B2DPolygon maPolygon; |
43 | | |
44 | | /// the hairline color |
45 | | basegfx::BColor maBColor; |
46 | | |
47 | | public: |
48 | | /// constructor |
49 | | PolygonHairlinePrimitive2D(basegfx::B2DPolygon aPolygon, const basegfx::BColor& rBColor); |
50 | | |
51 | | /// data read access |
52 | 884 | const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } |
53 | 752 | const basegfx::BColor& getBColor() const { return maBColor; } |
54 | | |
55 | | /// compare operator |
56 | | virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; |
57 | | |
58 | | /// get range |
59 | | virtual basegfx::B2DRange |
60 | | getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; |
61 | | |
62 | | /// provide unique ID |
63 | | virtual sal_uInt32 getPrimitive2DID() const override; |
64 | | }; |
65 | | |
66 | | /** SingleLinePrimitive2D class |
67 | | |
68 | | This primitive defines a simple line, just two points. It is |
69 | | sometimes useful for simpler tasks and decomposes to a |
70 | | PolygonHairlinePrimitive2D (see above). It is also a |
71 | | hairline-primitive, see above. |
72 | | */ |
73 | | class UNLESS_MERGELIBS(DRAWINGLAYER_DLLPUBLIC) SingleLinePrimitive2D final : public BasePrimitive2D |
74 | | { |
75 | | private: |
76 | | /// the line geometry |
77 | | basegfx::B2DPoint maStart; |
78 | | basegfx::B2DPoint maEnd; |
79 | | |
80 | | /// the line color |
81 | | basegfx::BColor maBColor; |
82 | | |
83 | | public: |
84 | | /// constructor |
85 | | SingleLinePrimitive2D(const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd, |
86 | | const basegfx::BColor& rBColor); |
87 | | |
88 | | /// data read access |
89 | 0 | const basegfx::B2DPoint& getStart() const { return maStart; } |
90 | 0 | const basegfx::B2DPoint& getEnd() const { return maEnd; } |
91 | 0 | const basegfx::BColor& getBColor() const { return maBColor; } |
92 | | |
93 | | /// compare operator |
94 | | virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; |
95 | | |
96 | | /// get range |
97 | | virtual basegfx::B2DRange |
98 | | getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; |
99 | | |
100 | | /// provide unique ID |
101 | | virtual sal_uInt32 getPrimitive2DID() const override; |
102 | | |
103 | | /// return as PolygonHairlinePrimitive2D |
104 | | virtual void |
105 | | get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, |
106 | | const geometry::ViewInformation2D& rViewInformation) const override; |
107 | | }; |
108 | | |
109 | | /** LineRectanglePrimitive2D class |
110 | | |
111 | | Tooling: This primitive defines a simple rectangle. It is |
112 | | sometimes useful for simpler tasks and decomposes to a |
113 | | more generalized PolygonHairlinePrimitive2D (see above) |
114 | | */ |
115 | | class UNLESS_MERGELIBS(DRAWINGLAYER_DLLPUBLIC) LineRectanglePrimitive2D final |
116 | | : public BasePrimitive2D |
117 | | { |
118 | | private: |
119 | | /// the geometry |
120 | | basegfx::B2DRange maB2DRange; |
121 | | |
122 | | /// the line color |
123 | | basegfx::BColor maBColor; |
124 | | |
125 | | public: |
126 | | /// constructor |
127 | | LineRectanglePrimitive2D(const basegfx::B2DRange& rB2DRange, const basegfx::BColor& rBColor); |
128 | | |
129 | | /// data read access |
130 | 0 | const basegfx::B2DRange& getB2DRange() const { return maB2DRange; } |
131 | 0 | const basegfx::BColor& getBColor() const { return maBColor; } |
132 | | |
133 | | /// compare operator |
134 | | virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; |
135 | | |
136 | | /// get range |
137 | | virtual basegfx::B2DRange |
138 | | getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; |
139 | | |
140 | | /// provide unique ID |
141 | | virtual sal_uInt32 getPrimitive2DID() const override; |
142 | | |
143 | | /// return as PolygonHairlinePrimitive2D |
144 | | virtual void |
145 | | get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, |
146 | | const geometry::ViewInformation2D& rViewInformation) const override; |
147 | | }; |
148 | | |
149 | | } // end of namespace primitive2d::drawinglayer |
150 | | |
151 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |