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