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