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 #ifndef INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
21 #define INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
22 
23 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
24 #include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx>
25 
26 
27 // predefines
28 
29 namespace drawinglayer { namespace primitive2d {
30     enum MeasureTextPosition
31     {
32         MEASURETEXTPOSITION_AUTOMATIC,
33         MEASURETEXTPOSITION_NEGATIVE,
34         MEASURETEXTPOSITION_CENTERED,
35         MEASURETEXTPOSITION_POSITIVE
36     };
37 }}
38 
39 namespace drawinglayer { namespace attribute {
40     class SdrLineAttribute;
41 }}
42 
43 
44 namespace drawinglayer
45 {
46     namespace primitive2d
47     {
48         class SdrMeasurePrimitive2D : public BufferedDecompositionPrimitive2D
49         {
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;
61 
62             bool const                                        mbBelow : 1;
63             bool const                                        mbTextRotation : 1;
64             bool const                                        mbTextAutoAngle : 1;
65 
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;
74 
75         protected:
76             // local decomposition.
77             virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
78 
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);
94 
95             // data access
getSdrLSTAttribute() const96             const attribute::SdrLineShadowTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; }
getStart() const97             const basegfx::B2DPoint& getStart() const { return maStart; }
getEnd() const98             const basegfx::B2DPoint& getEnd() const { return maEnd; }
getHorizontal() const99             MeasureTextPosition getHorizontal() const { return meHorizontal; }
getVertical() const100             MeasureTextPosition getVertical() const { return meVertical; }
getDistance() const101             double getDistance() const { return mfDistance; }
getUpper() const102             double getUpper() const { return mfUpper; }
getLower() const103             double getLower() const { return mfLower; }
getLeftDelta() const104             double getLeftDelta() const { return mfLeftDelta; }
getRightDelta() const105             double getRightDelta() const { return mfRightDelta; }
getBelow() const106             bool getBelow() const { return mbBelow; }
getTextRotation() const107             bool getTextRotation() const { return mbTextRotation; }
getTextAutoAngle() const108             bool getTextAutoAngle() const { return mbTextAutoAngle; }
109 
110             // compare operator
111             virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
112 
113             // provide unique ID
114             DeclPrimitive2DIDBlock()
115         };
116     } // end of namespace primitive2d
117 } // end of namespace drawinglayer
118 
119 
120 #endif // INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
121 
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
123