xref: /AOO41X/main/sw/source/ui/docvw/AnchorOverlayObject.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _ANCHOROVERLAYOBJECT_HXX
25cdf0e10cSrcweir #define _ANCHOROVERLAYOBJECT_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svx/sdr/overlay/overlayobject.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir class SwView;
32cdf0e10cSrcweir class SwRect;
33cdf0e10cSrcweir class Point;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace sw { namespace sidebarwindows {
36cdf0e10cSrcweir 
37cdf0e10cSrcweir enum AnchorState
38cdf0e10cSrcweir {
39cdf0e10cSrcweir     AS_ALL,
40cdf0e10cSrcweir     AS_START,
41cdf0e10cSrcweir     AS_END,
42cdf0e10cSrcweir     AS_TRI
43cdf0e10cSrcweir };
44cdf0e10cSrcweir 
45cdf0e10cSrcweir class AnchorOverlayObject: public sdr::overlay::OverlayObjectWithBasePosition
46cdf0e10cSrcweir {
47cdf0e10cSrcweir     public:
48cdf0e10cSrcweir         static AnchorOverlayObject* CreateAnchorOverlayObject( SwView& rDocView,
49cdf0e10cSrcweir                                                                const SwRect& aAnchorRect,
50cdf0e10cSrcweir                                                                const long& aPageBorder,
51cdf0e10cSrcweir                                                                const Point& aLineStart,
52cdf0e10cSrcweir                                                                const Point& aLineEnd,
53cdf0e10cSrcweir                                                                const Color& aColorAnchor );
54cdf0e10cSrcweir         static void DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor );
55cdf0e10cSrcweir 
GetSecondPosition() const56cdf0e10cSrcweir         inline const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
GetThirdPosition() const57cdf0e10cSrcweir         const basegfx::B2DPoint& GetThirdPosition() const { return maThirdPosition; }
GetFourthPosition() const58cdf0e10cSrcweir         const basegfx::B2DPoint& GetFourthPosition() const { return maFourthPosition; }
GetFifthPosition() const59cdf0e10cSrcweir         const basegfx::B2DPoint& GetFifthPosition() const { return maFifthPosition; }
GetSixthPosition() const60cdf0e10cSrcweir         const basegfx::B2DPoint& GetSixthPosition() const { return maSixthPosition; }
GetSeventhPosition() const61cdf0e10cSrcweir         const basegfx::B2DPoint& GetSeventhPosition() const { return maSeventhPosition; }
62cdf0e10cSrcweir 
63cdf0e10cSrcweir         void SetAllPosition( const basegfx::B2DPoint& rPoint1,
64cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint2,
65cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint3,
66cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint4,
67cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint5,
68cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint6,
69cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint7 );
70cdf0e10cSrcweir         void SetTriPosition( const basegfx::B2DPoint& rPoint1,
71cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint2,
72cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint3,
73cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint4,
74cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint5 );
75cdf0e10cSrcweir         void SetSixthPosition( const basegfx::B2DPoint& rNew );
76cdf0e10cSrcweir         void SetSeventhPosition( const basegfx::B2DPoint& rNew );
77cdf0e10cSrcweir 
78cdf0e10cSrcweir         void setLineSolid( const bool bNew );
getLineSolid() const79cdf0e10cSrcweir         inline bool getLineSolid() const { return mbLineSolid; }
80cdf0e10cSrcweir 
SetHeight(const unsigned long aHeight)81cdf0e10cSrcweir         inline void SetHeight( const unsigned long aHeight ) { mHeight = aHeight; };
82cdf0e10cSrcweir 
getShadowedEffect() const83cdf0e10cSrcweir         bool getShadowedEffect() const { return mbShadowedEffect; }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir         void SetAnchorState( const AnchorState aState );
GetAnchorState() const86cdf0e10cSrcweir         inline AnchorState GetAnchorState() const { return mAnchorState; }
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     protected:
89cdf0e10cSrcweir         /*                        6------------7
90cdf0e10cSrcweir              1                   /
91cdf0e10cSrcweir             /4\ ---------------5
92cdf0e10cSrcweir            2 - 3
93cdf0e10cSrcweir         */
94cdf0e10cSrcweir 
95cdf0e10cSrcweir         basegfx::B2DPoint maSecondPosition;
96cdf0e10cSrcweir         basegfx::B2DPoint maThirdPosition;
97cdf0e10cSrcweir         basegfx::B2DPoint maFourthPosition;
98cdf0e10cSrcweir         basegfx::B2DPoint maFifthPosition;
99cdf0e10cSrcweir         basegfx::B2DPoint maSixthPosition;
100cdf0e10cSrcweir         basegfx::B2DPoint maSeventhPosition;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir         // helpers to fill and reset geometry
103cdf0e10cSrcweir         void implEnsureGeometry();
104cdf0e10cSrcweir         void implResetGeometry();
105cdf0e10cSrcweir 
106cdf0e10cSrcweir         // geometry creation for OverlayObject
107cdf0e10cSrcweir         virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     private:
110cdf0e10cSrcweir         // object's geometry
111cdf0e10cSrcweir         basegfx::B2DPolygon maTriangle;
112cdf0e10cSrcweir         basegfx::B2DPolygon maLine;
113cdf0e10cSrcweir         basegfx::B2DPolygon maLineTop;
114cdf0e10cSrcweir         unsigned long mHeight;
115cdf0e10cSrcweir         AnchorState mAnchorState;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir         bool mbShadowedEffect : 1;
118cdf0e10cSrcweir         bool mbLineSolid : 1;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir         AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
121cdf0e10cSrcweir                              const basegfx::B2DPoint& rSecondPos,
122cdf0e10cSrcweir                              const basegfx::B2DPoint& rThirdPos,
123cdf0e10cSrcweir                              const basegfx::B2DPoint& rFourthPos,
124cdf0e10cSrcweir                              const basegfx::B2DPoint& rFifthPos,
125cdf0e10cSrcweir                              const basegfx::B2DPoint& rSixthPos,
126cdf0e10cSrcweir                              const basegfx::B2DPoint& rSeventhPos,
127cdf0e10cSrcweir                              const Color aBaseColor,
128cdf0e10cSrcweir                              const bool bShadowedEffect,
129cdf0e10cSrcweir                              const bool bLineSolid );
130cdf0e10cSrcweir         virtual ~AnchorOverlayObject();
131cdf0e10cSrcweir };
132cdf0e10cSrcweir 
133cdf0e10cSrcweir } } // end of namespace sw::annotation
134cdf0e10cSrcweir 
135cdf0e10cSrcweir #endif
136