Branch data 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 _SD_ANNOTATIONTAG_HXX_
21 : : #define _SD_ANNOTATIONTAG_HXX_
22 : :
23 : : #include <com/sun/star/office/XAnnotation.hpp>
24 : : #include <basegfx/polygon/b2dpolypolygon.hxx>
25 : : #include <basegfx/polygon/b2dpolypolygontools.hxx>
26 : : #include "smarttag.hxx"
27 : :
28 : : namespace css = ::com::sun::star;
29 : :
30 : : namespace sd {
31 : :
32 : : class View;
33 : : class AnnotationManagerImpl;
34 : : class AnnotationWindow;
35 : :
36 : : class AnnotationTag : public SmartTag
37 : : {
38 : : public:
39 : : AnnotationTag( AnnotationManagerImpl& rManager, ::sd::View& rView, const css::uno::Reference< css::office::XAnnotation >& xAnnotation, Color& rColor, int nIndex, const Font& rFont );
40 : : virtual ~AnnotationTag();
41 : :
42 : : /// @return true if the SmartTag handled the event.
43 : : virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& );
44 : :
45 : : /// @return true if the SmartTag consumes this event.
46 : : virtual bool KeyInput( const KeyEvent& rKEvt );
47 : :
48 : : /// @return true if the SmartTag consumes this event.
49 : : virtual bool RequestHelp( const HelpEvent& rHEvt );
50 : :
51 : : /// @return true if the SmartTag consumes this event.
52 : : virtual bool Command( const CommandEvent& rCEvt );
53 : :
54 : : // callbacks from sdr view
55 : : virtual sal_uLong GetMarkablePointCount() const;
56 : : virtual sal_uLong GetMarkedPointCount() const;
57 : : virtual sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False);
58 : : virtual void CheckPossibilities();
59 : : virtual sal_Bool MarkPoints(const Rectangle* pRect, sal_Bool bUnmark);
60 : :
61 : : void Move( int nDX, int nDY );
62 : : bool OnMove( const KeyEvent& rKEvt );
63 : :
64 : : BitmapEx CreateAnnotationBitmap(bool);
65 : :
66 : 0 : css::uno::Reference< css::office::XAnnotation > GetAnnotation() const { return mxAnnotation; }
67 : :
68 : : void OpenPopup( bool bEdit );
69 : : void ClosePopup();
70 : :
71 : : protected:
72 : : virtual void addCustomHandles( SdrHdlList& rHandlerList );
73 : : virtual bool getContext( SdrViewContext& rContext );
74 : : virtual void disposing();
75 : : virtual void select();
76 : : virtual void deselect();
77 : :
78 : : DECL_LINK( WindowEventHandler, VclWindowEvent* );
79 : : DECL_LINK( ClosePopupHdl, void* );
80 : :
81 : : private:
82 : : AnnotationManagerImpl& mrManager;
83 : : css::uno::Reference< css::office::XAnnotation > mxAnnotation;
84 : : std::auto_ptr<AnnotationWindow> mpAnnotationWindow;
85 : : Color maColor;
86 : : int mnIndex;
87 : : const Font& mrFont;
88 : : Size maSize;
89 : : sal_uLong mnClosePopupEvent;
90 : : ::Window* mpListenWindow;
91 : : Point maMouseDownPos;
92 : : };
93 : :
94 : : } // end of namespace sd
95 : :
96 : : #endif // _SD_ANNOTATIONTAG_HXX_
97 : :
98 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|