xref: /AOO41X/main/sw/source/ui/docvw/AnchorOverlayObject.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2008 by Sun Microsystems, Inc.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * $RCSfile:  $
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * $Revision:  $
12*cdf0e10cSrcweir  *
13*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
16*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
17*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
18*cdf0e10cSrcweir  *
19*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
20*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
23*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
24*cdf0e10cSrcweir  *
25*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
26*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
27*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
28*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
29*cdf0e10cSrcweir  *
30*cdf0e10cSrcweir  ************************************************************************/
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #ifndef _ANCHOROVERLAYOBJECT_HXX
33*cdf0e10cSrcweir #define _ANCHOROVERLAYOBJECT_HXX
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <svx/sdr/overlay/overlayobject.hxx>
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir class SwView;
40*cdf0e10cSrcweir class SwRect;
41*cdf0e10cSrcweir class Point;
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir namespace sw { namespace sidebarwindows {
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir enum AnchorState
46*cdf0e10cSrcweir {
47*cdf0e10cSrcweir     AS_ALL,
48*cdf0e10cSrcweir     AS_START,
49*cdf0e10cSrcweir     AS_END,
50*cdf0e10cSrcweir     AS_TRI
51*cdf0e10cSrcweir };
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir class AnchorOverlayObject: public sdr::overlay::OverlayObjectWithBasePosition
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir     public:
56*cdf0e10cSrcweir         static AnchorOverlayObject* CreateAnchorOverlayObject( SwView& rDocView,
57*cdf0e10cSrcweir                                                                const SwRect& aAnchorRect,
58*cdf0e10cSrcweir                                                                const long& aPageBorder,
59*cdf0e10cSrcweir                                                                const Point& aLineStart,
60*cdf0e10cSrcweir                                                                const Point& aLineEnd,
61*cdf0e10cSrcweir                                                                const Color& aColorAnchor );
62*cdf0e10cSrcweir         static void DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor );
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir         inline const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
65*cdf0e10cSrcweir         const basegfx::B2DPoint& GetThirdPosition() const { return maThirdPosition; }
66*cdf0e10cSrcweir         const basegfx::B2DPoint& GetFourthPosition() const { return maFourthPosition; }
67*cdf0e10cSrcweir         const basegfx::B2DPoint& GetFifthPosition() const { return maFifthPosition; }
68*cdf0e10cSrcweir         const basegfx::B2DPoint& GetSixthPosition() const { return maSixthPosition; }
69*cdf0e10cSrcweir         const basegfx::B2DPoint& GetSeventhPosition() const { return maSeventhPosition; }
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir         void SetAllPosition( const basegfx::B2DPoint& rPoint1,
72*cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint2,
73*cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint3,
74*cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint4,
75*cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint5,
76*cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint6,
77*cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint7 );
78*cdf0e10cSrcweir         void SetTriPosition( const basegfx::B2DPoint& rPoint1,
79*cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint2,
80*cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint3,
81*cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint4,
82*cdf0e10cSrcweir                              const basegfx::B2DPoint& rPoint5 );
83*cdf0e10cSrcweir         void SetSixthPosition( const basegfx::B2DPoint& rNew );
84*cdf0e10cSrcweir         void SetSeventhPosition( const basegfx::B2DPoint& rNew );
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir         void setLineSolid( const bool bNew );
87*cdf0e10cSrcweir         inline bool getLineSolid() const { return mbLineSolid; }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir         inline void SetHeight( const unsigned long aHeight ) { mHeight = aHeight; };
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir         bool getShadowedEffect() const { return mbShadowedEffect; }
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir         void SetAnchorState( const AnchorState aState );
94*cdf0e10cSrcweir         inline AnchorState GetAnchorState() const { return mAnchorState; }
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir     protected:
97*cdf0e10cSrcweir         /*                        6------------7
98*cdf0e10cSrcweir              1                   /
99*cdf0e10cSrcweir             /4\ ---------------5
100*cdf0e10cSrcweir            2 - 3
101*cdf0e10cSrcweir         */
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir         basegfx::B2DPoint maSecondPosition;
104*cdf0e10cSrcweir         basegfx::B2DPoint maThirdPosition;
105*cdf0e10cSrcweir         basegfx::B2DPoint maFourthPosition;
106*cdf0e10cSrcweir         basegfx::B2DPoint maFifthPosition;
107*cdf0e10cSrcweir         basegfx::B2DPoint maSixthPosition;
108*cdf0e10cSrcweir         basegfx::B2DPoint maSeventhPosition;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir         // helpers to fill and reset geometry
111*cdf0e10cSrcweir         void implEnsureGeometry();
112*cdf0e10cSrcweir         void implResetGeometry();
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir         // geometry creation for OverlayObject
115*cdf0e10cSrcweir         virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir     private:
118*cdf0e10cSrcweir         // object's geometry
119*cdf0e10cSrcweir         basegfx::B2DPolygon maTriangle;
120*cdf0e10cSrcweir         basegfx::B2DPolygon maLine;
121*cdf0e10cSrcweir         basegfx::B2DPolygon maLineTop;
122*cdf0e10cSrcweir         unsigned long mHeight;
123*cdf0e10cSrcweir         AnchorState mAnchorState;
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir         bool mbShadowedEffect : 1;
126*cdf0e10cSrcweir         bool mbLineSolid : 1;
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir         AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
129*cdf0e10cSrcweir                              const basegfx::B2DPoint& rSecondPos,
130*cdf0e10cSrcweir                              const basegfx::B2DPoint& rThirdPos,
131*cdf0e10cSrcweir                              const basegfx::B2DPoint& rFourthPos,
132*cdf0e10cSrcweir                              const basegfx::B2DPoint& rFifthPos,
133*cdf0e10cSrcweir                              const basegfx::B2DPoint& rSixthPos,
134*cdf0e10cSrcweir                              const basegfx::B2DPoint& rSeventhPos,
135*cdf0e10cSrcweir                              const Color aBaseColor,
136*cdf0e10cSrcweir                              const bool bShadowedEffect,
137*cdf0e10cSrcweir                              const bool bLineSolid );
138*cdf0e10cSrcweir         virtual ~AnchorOverlayObject();
139*cdf0e10cSrcweir };
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir } } // end of namespace sw::annotation
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir #endif
144