1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
23 #include <sdr/attribute/sdrlineeffectstextattribute.hxx>
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
48 attribute::SdrLineEffectsTextAttribute maSdrLSTAttribute
;
49 basegfx::B2DPoint maStart
;
50 basegfx::B2DPoint maEnd
;
51 MeasureTextPosition meHorizontal
;
52 MeasureTextPosition meVertical
;
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
,
70 bool bRightActive
) const;
72 // local decomposition.
73 virtual Primitive2DReference
create2DDecomposition(const geometry::ViewInformation2D
& aViewInformation
) const override
;
76 SdrMeasurePrimitive2D(
77 const attribute::SdrLineEffectsTextAttribute
& rSdrLSTAttribute
,
78 const basegfx::B2DPoint
& rStart
,
79 const basegfx::B2DPoint
& rEnd
,
80 MeasureTextPosition eHorizontal
,
81 MeasureTextPosition eVertical
,
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
; }
107 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
110 virtual sal_uInt32
getPrimitive2DID() const override
;
112 } // end of namespace drawinglayer::primitive2d
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */