Update git submodules
[LibreOffice.git] / svx / inc / sdr / primitive2d / sdrmeasureprimitive2d.hxx
blob291c70c92ff2ea2fcd0327c617e85dff09596322
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/primitive2d/BufferedDecompositionPrimitive2D.hxx>
23 #include <sdr/attribute/sdrlineeffectstextattribute.hxx>
26 // predefines
28 namespace drawinglayer::primitive2d {
29 enum MeasureTextPosition
31 MEASURETEXTPOSITION_AUTOMATIC,
32 MEASURETEXTPOSITION_NEGATIVE,
33 MEASURETEXTPOSITION_CENTERED,
34 MEASURETEXTPOSITION_POSITIVE
38 namespace drawinglayer::attribute {
39 class SdrLineAttribute;
43 namespace drawinglayer::primitive2d
45 class SdrMeasurePrimitive2D final : public BufferedDecompositionPrimitive2D
47 private:
48 attribute::SdrLineEffectsTextAttribute maSdrLSTAttribute;
49 basegfx::B2DPoint maStart;
50 basegfx::B2DPoint maEnd;
51 MeasureTextPosition meHorizontal;
52 MeasureTextPosition meVertical;
53 double mfDistance;
54 double mfUpper;
55 double mfLower;
56 double mfLeftDelta;
57 double mfRightDelta;
59 bool mbBelow : 1;
60 bool mbTextRotation : 1;
61 bool mbTextAutoAngle : 1;
63 // internal decomposition helper
64 Primitive2DReference impCreatePart(
65 const attribute::SdrLineAttribute& rLineAttribute,
66 const basegfx::B2DHomMatrix& rObjectMatrix,
67 const basegfx::B2DPoint& rStart,
68 const basegfx::B2DPoint& rEnd,
69 bool bLeftActive,
70 bool bRightActive) const;
72 // local decomposition.
73 virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override;
75 public:
76 SdrMeasurePrimitive2D(
77 const attribute::SdrLineEffectsTextAttribute& rSdrLSTAttribute,
78 const basegfx::B2DPoint& rStart,
79 const basegfx::B2DPoint& rEnd,
80 MeasureTextPosition eHorizontal,
81 MeasureTextPosition eVertical,
82 double fDistance,
83 double fUpper,
84 double fLower,
85 double fLeftDelta,
86 double fRightDelta,
87 bool bBelow,
88 bool bTextRotation,
89 bool bTextAutoAngle);
91 // data access
92 const attribute::SdrLineEffectsTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; }
93 const basegfx::B2DPoint& getStart() const { return maStart; }
94 const basegfx::B2DPoint& getEnd() const { return maEnd; }
95 MeasureTextPosition getHorizontal() const { return meHorizontal; }
96 MeasureTextPosition getVertical() const { return meVertical; }
97 double getDistance() const { return mfDistance; }
98 double getUpper() const { return mfUpper; }
99 double getLower() const { return mfLower; }
100 double getLeftDelta() const { return mfLeftDelta; }
101 double getRightDelta() const { return mfRightDelta; }
102 bool getBelow() const { return mbBelow; }
103 bool getTextRotation() const { return mbTextRotation; }
104 bool getTextAutoAngle() const { return mbTextAutoAngle; }
106 // compare operator
107 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
109 // provide unique ID
110 virtual sal_uInt32 getPrimitive2DID() const override;
112 } // end of namespace drawinglayer::primitive2d
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */