Line data Source code
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_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
21 : #define INCLUDED_SVX_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 :
45 : namespace drawinglayer
46 : {
47 : namespace primitive2d
48 : {
49 0 : class SdrMeasurePrimitive2D : public BufferedDecompositionPrimitive2D
50 : {
51 : private:
52 : attribute::SdrLineShadowTextAttribute maSdrLSTAttribute;
53 : basegfx::B2DPoint maStart;
54 : basegfx::B2DPoint maEnd;
55 : MeasureTextPosition meHorizontal;
56 : MeasureTextPosition meVertical;
57 : double mfDistance;
58 : double mfUpper;
59 : double mfLower;
60 : double mfLeftDelta;
61 : double mfRightDelta;
62 :
63 : // bitfield
64 : bool mbBelow : 1;
65 : bool mbTextRotation : 1;
66 : bool mbTextAutoAngle : 1;
67 :
68 : // internal decomposition helper
69 : Primitive2DReference impCreatePart(
70 : const attribute::SdrLineAttribute& rLineAttribute,
71 : const basegfx::B2DHomMatrix& rObjectMatrix,
72 : const basegfx::B2DPoint& rStart,
73 : const basegfx::B2DPoint& rEnd,
74 : bool bLeftActive,
75 : bool bRightActive) const;
76 :
77 : protected:
78 : // local decomposition.
79 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const SAL_OVERRIDE;
80 :
81 : public:
82 : SdrMeasurePrimitive2D(
83 : const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute,
84 : const basegfx::B2DPoint& rStart,
85 : const basegfx::B2DPoint& rEnd,
86 : MeasureTextPosition eHorizontal,
87 : MeasureTextPosition eVertical,
88 : double fDistance,
89 : double fUpper,
90 : double fLower,
91 : double fLeftDelta,
92 : double fRightDelta,
93 : bool bBelow,
94 : bool bTextRotation,
95 : bool bTextAutoAngle);
96 :
97 : // data access
98 0 : const attribute::SdrLineShadowTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; }
99 0 : const basegfx::B2DPoint& getStart() const { return maStart; }
100 0 : const basegfx::B2DPoint& getEnd() const { return maEnd; }
101 0 : MeasureTextPosition getHorizontal() const { return meHorizontal; }
102 0 : MeasureTextPosition getVertical() const { return meVertical; }
103 0 : double getDistance() const { return mfDistance; }
104 0 : double getUpper() const { return mfUpper; }
105 0 : double getLower() const { return mfLower; }
106 0 : double getLeftDelta() const { return mfLeftDelta; }
107 0 : double getRightDelta() const { return mfRightDelta; }
108 0 : bool getBelow() const { return mbBelow; }
109 0 : bool getTextRotation() const { return mbTextRotation; }
110 0 : bool getTextAutoAngle() const { return mbTextAutoAngle; }
111 :
112 : // compare operator
113 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
114 :
115 : // provide unique ID
116 : DeclPrimitive2DIDBlock()
117 : };
118 : } // end of namespace primitive2d
119 : } // end of namespace drawinglayer
120 :
121 :
122 :
123 : #endif // INCLUDED_SVX_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
124 :
125 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|