/src/libreoffice/svx/inc/sdr/primitive2d/sdrmeasureprimitive2d.hxx
Line | Count | Source (jump to first uncovered line) |
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 | | #pragma once |
21 | | |
22 | | #include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx> |
23 | | #include <sdr/attribute/sdrlineeffectstextattribute.hxx> |
24 | | |
25 | | |
26 | | // predefines |
27 | | |
28 | | namespace drawinglayer::primitive2d { |
29 | | enum MeasureTextPosition |
30 | | { |
31 | | MEASURETEXTPOSITION_AUTOMATIC, |
32 | | MEASURETEXTPOSITION_NEGATIVE, |
33 | | MEASURETEXTPOSITION_CENTERED, |
34 | | MEASURETEXTPOSITION_POSITIVE |
35 | | }; |
36 | | } |
37 | | |
38 | | namespace drawinglayer::attribute { |
39 | | class SdrLineAttribute; |
40 | | } |
41 | | |
42 | | |
43 | | namespace drawinglayer::primitive2d |
44 | | { |
45 | | class SdrMeasurePrimitive2D final : public BufferedDecompositionPrimitive2D |
46 | | { |
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; |
58 | | |
59 | | bool mbBelow : 1; |
60 | | bool mbTextRotation : 1; |
61 | | bool mbTextAutoAngle : 1; |
62 | | |
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; |
71 | | |
72 | | // local decomposition. |
73 | | virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; |
74 | | |
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); |
90 | | |
91 | | // data access |
92 | 0 | const attribute::SdrLineEffectsTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; } |
93 | 0 | const basegfx::B2DPoint& getStart() const { return maStart; } |
94 | 0 | const basegfx::B2DPoint& getEnd() const { return maEnd; } |
95 | 0 | MeasureTextPosition getHorizontal() const { return meHorizontal; } |
96 | 0 | MeasureTextPosition getVertical() const { return meVertical; } |
97 | 0 | double getDistance() const { return mfDistance; } |
98 | 0 | double getUpper() const { return mfUpper; } |
99 | 0 | double getLower() const { return mfLower; } |
100 | 0 | double getLeftDelta() const { return mfLeftDelta; } |
101 | 0 | double getRightDelta() const { return mfRightDelta; } |
102 | 0 | bool getBelow() const { return mbBelow; } |
103 | 0 | bool getTextRotation() const { return mbTextRotation; } |
104 | 0 | bool getTextAutoAngle() const { return mbTextAutoAngle; } |
105 | | |
106 | | // compare operator |
107 | | virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; |
108 | | |
109 | | // provide unique ID |
110 | | virtual sal_uInt32 getPrimitive2DID() const override; |
111 | | }; |
112 | | } // end of namespace drawinglayer::primitive2d |
113 | | |
114 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |