nss: upgrade to release 3.73
[LibreOffice.git] / include / drawinglayer / primitive2d / helplineprimitive2d.hxx
blobc0445ee05c842d7f51556482722790054f937748
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 <drawinglayer/drawinglayerdllapi.h>
24 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
25 #include <basegfx/color/bcolor.hxx>
26 #include <basegfx/matrix/b2dhommatrix.hxx>
29 // HelplinePrimitive2D class
31 namespace drawinglayer::primitive2d
33 /** HelplineStyle2D definition
35 The available styles of Helplines
37 enum class HelplineStyle2D
39 Point,
40 Line
43 /** HelplinePrimitive2D class
45 This primitive provides a view-dependent helpline definition. The Helpline
46 is defined by a line equation (Point and vector) and a style. When the style
47 is a line, dependent from Viewport the visible part of that Helpline is
48 constructed. For Point, a cross is constructed. This primitive is highly
49 view-dependent.
51 The visualisation uses the two given colors to create a dashed line with
52 the given dash length.
54 class DRAWINGLAYER_DLLPUBLIC HelplinePrimitive2D final : public BufferedDecompositionPrimitive2D
56 private:
57 /// Helpline geometry definition
58 basegfx::B2DPoint maPosition;
59 basegfx::B2DVector maDirection;
60 HelplineStyle2D meStyle;
62 /// Helpline style definition
63 basegfx::BColor maRGBColA;
64 basegfx::BColor maRGBColB;
65 double mfDiscreteDashLength;
67 /** the last used object to view transformtion and the last Viewport,
68 used from getDecomposition for decide buffering
70 basegfx::B2DHomMatrix maLastObjectToViewTransformation;
71 basegfx::B2DRange maLastViewport;
73 /// create local decomposition
74 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
76 public:
77 /// constructor
78 HelplinePrimitive2D(
79 const basegfx::B2DPoint& rPosition,
80 const basegfx::B2DVector& rDirection,
81 HelplineStyle2D eStyle,
82 const basegfx::BColor& rRGBColA,
83 const basegfx::BColor& aRGBColB,
84 double fDiscreteDashLength);
86 /// data read access
87 const basegfx::B2DPoint& getPosition() const { return maPosition; }
88 const basegfx::B2DVector& getDirection() const { return maDirection; }
89 HelplineStyle2D getStyle() const { return meStyle; }
90 const basegfx::BColor& getRGBColA() const { return maRGBColA; }
91 const basegfx::BColor& getRGBColB() const { return maRGBColB; }
92 double getDiscreteDashLength() const { return mfDiscreteDashLength; }
94 /// compare operator
95 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
97 /// provide unique ID
98 virtual sal_uInt32 getPrimitive2DID() const override;
100 /// Override standard getDecomposition to be view-dependent here
101 virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
103 } // end of namespace drawinglayer::primitive2d
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */