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 <svx/sdr/overlay/overlayobject.hxx>
23 #include <tools/long.hxx>
24 #include <basegfx/polygon/b2dpolygon.hxx>
30 namespace sw::sidebarwindows
{
32 enum class AnchorState
39 class AnchorOverlayObject final
: public sdr::overlay::OverlayObjectWithBasePosition
42 static std::unique_ptr
<AnchorOverlayObject
> CreateAnchorOverlayObject( SwView
const & rDocView
,
43 const SwRect
& aAnchorRect
,
44 tools::Long aPageBorder
,
45 const Point
& aLineStart
,
46 const Point
& aLineEnd
,
47 const Color
& aColorAnchor
);
49 const basegfx::B2DPoint
& GetSecondPosition() const { return maSecondPosition
; }
50 const basegfx::B2DPoint
& GetThirdPosition() const { return maThirdPosition
; }
51 const basegfx::B2DPoint
& GetFourthPosition() const { return maFourthPosition
; }
52 const basegfx::B2DPoint
& GetFifthPosition() const { return maFifthPosition
; }
53 const basegfx::B2DPoint
& GetSixthPosition() const { return maSixthPosition
; }
54 const basegfx::B2DPoint
& GetSeventhPosition() const { return maSeventhPosition
; }
56 void SetAllPosition( const basegfx::B2DPoint
& rPoint1
,
57 const basegfx::B2DPoint
& rPoint2
,
58 const basegfx::B2DPoint
& rPoint3
,
59 const basegfx::B2DPoint
& rPoint4
,
60 const basegfx::B2DPoint
& rPoint5
,
61 const basegfx::B2DPoint
& rPoint6
,
62 const basegfx::B2DPoint
& rPoint7
);
63 void SetTriPosition( const basegfx::B2DPoint
& rPoint1
,
64 const basegfx::B2DPoint
& rPoint2
,
65 const basegfx::B2DPoint
& rPoint3
,
66 const basegfx::B2DPoint
& rPoint4
,
67 const basegfx::B2DPoint
& rPoint5
);
68 void SetSixthPosition( const basegfx::B2DPoint
& rNew
);
69 void SetSeventhPosition( const basegfx::B2DPoint
& rNew
);
71 void setLineSolid( const bool bNew
);
72 bool getLineSolid() const { return mbLineSolid
; }
74 void SetAnchorState( const AnchorState aState
);
75 AnchorState
GetAnchorState() const { return mAnchorState
; }
84 basegfx::B2DPoint maSecondPosition
;
85 basegfx::B2DPoint maThirdPosition
;
86 basegfx::B2DPoint maFourthPosition
;
87 basegfx::B2DPoint maFifthPosition
;
88 basegfx::B2DPoint maSixthPosition
;
89 basegfx::B2DPoint maSeventhPosition
;
91 // helpers to fill and reset geometry
92 void implEnsureGeometry();
93 void implResetGeometry();
95 // geometry creation for OverlayObject
96 virtual drawinglayer::primitive2d::Primitive2DContainer
createOverlayObjectPrimitive2DSequence() override
;
99 basegfx::B2DPolygon maTriangle
;
100 basegfx::B2DPolygon maLine
;
101 basegfx::B2DPolygon maLineTop
;
102 AnchorState mAnchorState
;
104 bool mbLineSolid
: 1;
106 AnchorOverlayObject( const basegfx::B2DPoint
& rBasePos
,
107 const basegfx::B2DPoint
& rSecondPos
,
108 const basegfx::B2DPoint
& rThirdPos
,
109 const basegfx::B2DPoint
& rFourthPos
,
110 const basegfx::B2DPoint
& rFifthPos
,
111 const basegfx::B2DPoint
& rSixthPos
,
112 const basegfx::B2DPoint
& rSeventhPos
,
113 const Color
& rBaseColor
);
115 virtual ~AnchorOverlayObject() override
;
118 } // end of namespace sw::annotation
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */