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 .
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 <sdr/attribute/sdrlineeffectstextattribute.hxx>
29 namespace drawinglayer::primitive2d
{
30 enum MeasureTextPosition
32 MEASURETEXTPOSITION_AUTOMATIC
,
33 MEASURETEXTPOSITION_NEGATIVE
,
34 MEASURETEXTPOSITION_CENTERED
,
35 MEASURETEXTPOSITION_POSITIVE
39 namespace drawinglayer::attribute
{
40 class SdrLineAttribute
;
44 namespace drawinglayer::primitive2d
46 class SdrMeasurePrimitive2D final
: public BufferedDecompositionPrimitive2D
49 attribute::SdrLineEffectsTextAttribute maSdrLSTAttribute
;
50 basegfx::B2DPoint maStart
;
51 basegfx::B2DPoint maEnd
;
52 MeasureTextPosition meHorizontal
;
53 MeasureTextPosition meVertical
;
61 bool mbTextRotation
: 1;
62 bool mbTextAutoAngle
: 1;
64 // internal decomposition helper
65 Primitive2DReference
impCreatePart(
66 const attribute::SdrLineAttribute
& rLineAttribute
,
67 const basegfx::B2DHomMatrix
& rObjectMatrix
,
68 const basegfx::B2DPoint
& rStart
,
69 const basegfx::B2DPoint
& rEnd
,
71 bool bRightActive
) const;
73 // local decomposition.
74 virtual void create2DDecomposition(Primitive2DContainer
& rContainer
, const geometry::ViewInformation2D
& aViewInformation
) const override
;
77 SdrMeasurePrimitive2D(
78 const attribute::SdrLineEffectsTextAttribute
& rSdrLSTAttribute
,
79 const basegfx::B2DPoint
& rStart
,
80 const basegfx::B2DPoint
& rEnd
,
81 MeasureTextPosition eHorizontal
,
82 MeasureTextPosition eVertical
,
93 const attribute::SdrLineEffectsTextAttribute
& getSdrLSTAttribute() const { return maSdrLSTAttribute
; }
94 const basegfx::B2DPoint
& getStart() const { return maStart
; }
95 const basegfx::B2DPoint
& getEnd() const { return maEnd
; }
96 MeasureTextPosition
getHorizontal() const { return meHorizontal
; }
97 MeasureTextPosition
getVertical() const { return meVertical
; }
98 double getDistance() const { return mfDistance
; }
99 double getUpper() const { return mfUpper
; }
100 double getLower() const { return mfLower
; }
101 double getLeftDelta() const { return mfLeftDelta
; }
102 double getRightDelta() const { return mfRightDelta
; }
103 bool getBelow() const { return mbBelow
; }
104 bool getTextRotation() const { return mbTextRotation
; }
105 bool getTextAutoAngle() const { return mbTextAutoAngle
; }
108 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
111 virtual sal_uInt32
getPrimitive2DID() const override
;
113 } // end of namespace drawinglayer::primitive2d
116 #endif // INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */