1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <vcl/vclevent.hxx>
24 #include <smarttag.hxx>
25 #include "annotationwindow.hxx"
27 namespace com::sun::star::office
{ class XAnnotation
; }
32 class AnnotationManagerImpl
;
34 class AnnotationTag final
: public SmartTag
37 AnnotationTag( AnnotationManagerImpl
& rManager
, ::sd::View
& rView
, const css::uno::Reference
< css::office::XAnnotation
>& xAnnotation
, Color
const & rColor
, int nIndex
, const vcl::Font
& rFont
);
38 virtual ~AnnotationTag() override
;
40 /// @return true if the SmartTag handled the event.
41 virtual bool MouseButtonDown( const MouseEvent
&, SmartHdl
& ) override
;
43 /// @return true if the SmartTag consumes this event.
44 virtual bool KeyInput( const KeyEvent
& rKEvt
) override
;
46 /// @return true if the SmartTag consumes this event.
47 virtual bool Command( const CommandEvent
& rCEvt
) override
;
49 // callbacks from sdr view
50 virtual sal_Int32
GetMarkablePointCount() const override
;
51 virtual sal_Int32
GetMarkedPointCount() const override
;
52 virtual bool MarkPoint(SdrHdl
& rHdl
, bool bUnmark
) override
;
53 virtual void CheckPossibilities() override
;
54 virtual bool MarkPoints(const ::tools::Rectangle
* pRect
, bool bUnmark
) override
;
56 void Move( int nDX
, int nDY
);
57 bool OnMove( const KeyEvent
& rKEvt
);
59 BitmapEx
CreateAnnotationBitmap(bool);
61 const css::uno::Reference
< css::office::XAnnotation
>& GetAnnotation() const { return mxAnnotation
; }
63 void OpenPopup( bool bEdit
);
67 virtual void addCustomHandles( SdrHdlList
& rHandlerList
) override
;
68 virtual bool getContext( SdrViewContext
& rContext
) override
;
69 virtual void disposing() override
;
70 virtual void select() override
;
71 virtual void deselect() override
;
73 DECL_LINK( WindowEventHandler
, VclWindowEvent
&, void );
74 DECL_LINK(PopupModeEndHdl
, weld::Popover
&, void);
76 AnnotationManagerImpl
& mrManager
;
77 css::uno::Reference
< css::office::XAnnotation
> mxAnnotation
;
78 std::unique_ptr
<AnnotationWindow
> mpAnnotationWindow
;
81 const vcl::Font
& mrFont
;
83 VclPtr
<vcl::Window
> mpListenWindow
;
87 } // end of namespace sd
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */