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_SW_SOURCE_UIBASE_DOCVW_ANCHOROVERLAYOBJECT_HXX
21 : #define INCLUDED_SW_SOURCE_UIBASE_DOCVW_ANCHOROVERLAYOBJECT_HXX
22 :
23 : #include <svx/sdr/overlay/overlayobject.hxx>
24 :
25 : #include <basegfx/polygon/b2dpolygon.hxx>
26 :
27 : class SwView;
28 : class SwRect;
29 : class Point;
30 :
31 : namespace sw { namespace sidebarwindows {
32 :
33 : enum AnchorState
34 : {
35 : AS_ALL,
36 : AS_START,
37 : AS_END,
38 : AS_TRI
39 : };
40 :
41 : class AnchorOverlayObject: public sdr::overlay::OverlayObjectWithBasePosition
42 : {
43 : public:
44 : static AnchorOverlayObject* CreateAnchorOverlayObject( SwView& rDocView,
45 : const SwRect& aAnchorRect,
46 : const long& aPageBorder,
47 : const Point& aLineStart,
48 : const Point& aLineEnd,
49 : const Color& aColorAnchor );
50 : static void DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor );
51 :
52 164 : inline const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
53 164 : const basegfx::B2DPoint& GetThirdPosition() const { return maThirdPosition; }
54 164 : const basegfx::B2DPoint& GetFourthPosition() const { return maFourthPosition; }
55 164 : const basegfx::B2DPoint& GetFifthPosition() const { return maFifthPosition; }
56 664 : const basegfx::B2DPoint& GetSixthPosition() const { return maSixthPosition; }
57 124 : const basegfx::B2DPoint& GetSeventhPosition() const { return maSeventhPosition; }
58 :
59 : void SetAllPosition( const basegfx::B2DPoint& rPoint1,
60 : const basegfx::B2DPoint& rPoint2,
61 : const basegfx::B2DPoint& rPoint3,
62 : const basegfx::B2DPoint& rPoint4,
63 : const basegfx::B2DPoint& rPoint5,
64 : const basegfx::B2DPoint& rPoint6,
65 : const basegfx::B2DPoint& rPoint7 );
66 : void SetTriPosition( const basegfx::B2DPoint& rPoint1,
67 : const basegfx::B2DPoint& rPoint2,
68 : const basegfx::B2DPoint& rPoint3,
69 : const basegfx::B2DPoint& rPoint4,
70 : const basegfx::B2DPoint& rPoint5 );
71 : void SetSixthPosition( const basegfx::B2DPoint& rNew );
72 : void SetSeventhPosition( const basegfx::B2DPoint& rNew );
73 :
74 : void setLineSolid( const bool bNew );
75 903 : inline bool getLineSolid() const { return mbLineSolid; }
76 :
77 124 : inline void SetHeight( const unsigned long aHeight ) { mHeight = aHeight; };
78 :
79 295 : bool getShadowedEffect() const { return mbShadowedEffect; }
80 :
81 : void SetAnchorState( const AnchorState aState );
82 295 : inline AnchorState GetAnchorState() const { return mAnchorState; }
83 :
84 : protected:
85 : /* 6------------7
86 : 1 /
87 : /4\ ---------------5
88 : 2 - 3
89 : */
90 :
91 : basegfx::B2DPoint maSecondPosition;
92 : basegfx::B2DPoint maThirdPosition;
93 : basegfx::B2DPoint maFourthPosition;
94 : basegfx::B2DPoint maFifthPosition;
95 : basegfx::B2DPoint maSixthPosition;
96 : basegfx::B2DPoint maSeventhPosition;
97 :
98 : // helpers to fill and reset geometry
99 : void implEnsureGeometry();
100 : void implResetGeometry();
101 :
102 : // geometry creation for OverlayObject
103 : virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence() SAL_OVERRIDE;
104 :
105 : private:
106 : // object's geometry
107 : basegfx::B2DPolygon maTriangle;
108 : basegfx::B2DPolygon maLine;
109 : basegfx::B2DPolygon maLineTop;
110 : unsigned long mHeight;
111 : AnchorState mAnchorState;
112 :
113 : bool mbShadowedEffect : 1;
114 : bool mbLineSolid : 1;
115 :
116 : AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
117 : const basegfx::B2DPoint& rSecondPos,
118 : const basegfx::B2DPoint& rThirdPos,
119 : const basegfx::B2DPoint& rFourthPos,
120 : const basegfx::B2DPoint& rFifthPos,
121 : const basegfx::B2DPoint& rSixthPos,
122 : const basegfx::B2DPoint& rSeventhPos,
123 : const Color& rBaseColor,
124 : const bool bShadowedEffect,
125 : const bool bLineSolid );
126 : virtual ~AnchorOverlayObject();
127 : };
128 :
129 : } } // end of namespace sw::annotation
130 :
131 : #endif
132 :
133 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|