merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / annotations / annotationtag.hxx
blobc8ed3a87bacc44a0e3ec8dcd2cdeb729bbd199a8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: motionpathtag.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SD_ANNOTATIONTAG_HXX_
32 #define _SD_ANNOTATIONTAG_HXX_
34 #include <com/sun/star/office/XAnnotation.hpp>
35 #include <basegfx/polygon/b2dpolypolygon.hxx>
36 #include <basegfx/polygon/b2dpolypolygontools.hxx>
37 #include "smarttag.hxx"
39 namespace css = ::com::sun::star;
41 namespace sd {
43 class View;
44 class AnnotationManagerImpl;
45 class AnnotationWindow;
47 class AnnotationTag : public SmartTag
49 public:
50 AnnotationTag( AnnotationManagerImpl& rManager, ::sd::View& rView, const css::uno::Reference< css::office::XAnnotation >& xAnnotation, Color& rColor, int nIndex, const Font& rFont );
51 virtual ~AnnotationTag();
53 /** returns true if the SmartTag handled the event. */
54 virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& );
56 /** returns true if the SmartTag consumes this event. */
57 virtual bool KeyInput( const KeyEvent& rKEvt );
59 /** returns true if the SmartTag consumes this event. */
60 virtual bool RequestHelp( const HelpEvent& rHEvt );
62 /** returns true if the SmartTag consumes this event. */
63 virtual bool Command( const CommandEvent& rCEvt );
65 // callbacks from sdr view
66 virtual ULONG GetMarkablePointCount() const;
67 virtual ULONG GetMarkedPointCount() const;
68 virtual BOOL MarkPoint(SdrHdl& rHdl, BOOL bUnmark=FALSE);
69 virtual void CheckPossibilities();
70 virtual BOOL MarkPoints(const Rectangle* pRect, BOOL bUnmark);
72 void Move( int nDX, int nDY );
73 bool OnMove( const KeyEvent& rKEvt );
75 // ---
77 BitmapEx CreateAnnotationBitmap(bool);
79 css::uno::Reference< css::office::XAnnotation > GetAnnotation() const { return mxAnnotation; }
81 void OpenPopup( bool bEdit );
82 void ClosePopup();
84 protected:
85 virtual void addCustomHandles( SdrHdlList& rHandlerList );
86 virtual bool getContext( SdrViewContext& rContext );
87 virtual void disposing();
88 virtual void select();
89 virtual void deselect();
91 DECL_LINK( WindowEventHandler, VclWindowEvent* );
92 DECL_LINK( ClosePopupHdl, void* );
94 private:
95 AnnotationManagerImpl& mrManager;
96 css::uno::Reference< css::office::XAnnotation > mxAnnotation;
97 std::auto_ptr<AnnotationWindow> mpAnnotationWindow;
98 Color maColor;
99 int mnIndex;
100 const Font& mrFont;
101 Size maSize;
102 ULONG mnClosePopupEvent;
103 ::Window* mpListenWindow;
104 Point maMouseDownPos;
107 } // end of namespace sd
109 #endif // _SD_ANNOTATIONTAG_HXX_