Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / svx / inc / sdr / primitive2d / sdrmeasureprimitive2d.hxx
blobb28158895b2d66633af33f344f0e6fc892d5cfe9
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 #ifndef INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
21 #define INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
23 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
24 #include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx>
27 // predefines
29 namespace drawinglayer { namespace primitive2d {
30 enum MeasureTextPosition
32 MEASURETEXTPOSITION_AUTOMATIC,
33 MEASURETEXTPOSITION_NEGATIVE,
34 MEASURETEXTPOSITION_CENTERED,
35 MEASURETEXTPOSITION_POSITIVE
39 namespace drawinglayer { namespace attribute {
40 class SdrLineAttribute;
44 namespace drawinglayer
46 namespace primitive2d
48 class SdrMeasurePrimitive2D : public BufferedDecompositionPrimitive2D
50 private:
51 attribute::SdrLineShadowTextAttribute const maSdrLSTAttribute;
52 basegfx::B2DPoint const maStart;
53 basegfx::B2DPoint const maEnd;
54 MeasureTextPosition const meHorizontal;
55 MeasureTextPosition const meVertical;
56 double const mfDistance;
57 double const mfUpper;
58 double const mfLower;
59 double const mfLeftDelta;
60 double const mfRightDelta;
62 bool const mbBelow : 1;
63 bool const mbTextRotation : 1;
64 bool const mbTextAutoAngle : 1;
66 // internal decomposition helper
67 Primitive2DReference impCreatePart(
68 const attribute::SdrLineAttribute& rLineAttribute,
69 const basegfx::B2DHomMatrix& rObjectMatrix,
70 const basegfx::B2DPoint& rStart,
71 const basegfx::B2DPoint& rEnd,
72 bool bLeftActive,
73 bool bRightActive) const;
75 protected:
76 // local decomposition.
77 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
79 public:
80 SdrMeasurePrimitive2D(
81 const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute,
82 const basegfx::B2DPoint& rStart,
83 const basegfx::B2DPoint& rEnd,
84 MeasureTextPosition eHorizontal,
85 MeasureTextPosition eVertical,
86 double fDistance,
87 double fUpper,
88 double fLower,
89 double fLeftDelta,
90 double fRightDelta,
91 bool bBelow,
92 bool bTextRotation,
93 bool bTextAutoAngle);
95 // data access
96 const attribute::SdrLineShadowTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; }
97 const basegfx::B2DPoint& getStart() const { return maStart; }
98 const basegfx::B2DPoint& getEnd() const { return maEnd; }
99 MeasureTextPosition getHorizontal() const { return meHorizontal; }
100 MeasureTextPosition getVertical() const { return meVertical; }
101 double getDistance() const { return mfDistance; }
102 double getUpper() const { return mfUpper; }
103 double getLower() const { return mfLower; }
104 double getLeftDelta() const { return mfLeftDelta; }
105 double getRightDelta() const { return mfRightDelta; }
106 bool getBelow() const { return mbBelow; }
107 bool getTextRotation() const { return mbTextRotation; }
108 bool getTextAutoAngle() const { return mbTextAutoAngle; }
110 // compare operator
111 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
113 // provide unique ID
114 DeclPrimitive2DIDBlock()
116 } // end of namespace primitive2d
117 } // end of namespace drawinglayer
120 #endif // INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */