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 .
20 #ifndef INCLUDED_SD_SOURCE_UI_ANNOTATIONS_ANNOTATIONWINDOW_HXX
21 #define INCLUDED_SD_SOURCE_UI_ANNOTATIONS_ANNOTATIONWINDOW_HXX
23 #include <vcl/ctrl.hxx>
24 #include <vcl/floatwin.hxx>
25 #include <svtools/svmedit.hxx>
26 #include <vcl/scrbar.hxx>
28 #include <basegfx/polygon/b2dpolygon.hxx>
30 namespace com
{ namespace sun
{ namespace star
{ namespace office
{ class XAnnotation
; } } } }
34 class SvxLanguageItem
;
39 class AnnotationManagerImpl
;
40 class AnnotationWindow
;
44 class AnnotationTextWindow
: public Control
47 OutlinerView
* mpOutlinerView
;
48 VclPtr
<AnnotationWindow
> mpAnnotationWindow
;
51 virtual void Paint( vcl::RenderContext
& /*rRenderContext*/, const ::tools::Rectangle
& rRect
) override
;
52 virtual void KeyInput( const KeyEvent
& rKeyEvt
) override
;
53 virtual void MouseMove( const MouseEvent
& rMEvt
) override
;
54 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) override
;
55 virtual void MouseButtonUp( const MouseEvent
& rMEvt
) override
;
56 virtual void Command( const CommandEvent
& rCEvt
) override
;
59 AnnotationTextWindow( AnnotationWindow
* pParent
, WinBits nBits
);
60 virtual ~AnnotationTextWindow() override
;
61 virtual void dispose() override
;
63 void SetOutlinerView( OutlinerView
* pOutlinerView
) { mpOutlinerView
= pOutlinerView
; }
65 virtual OUString
GetSurroundingText() const override
;
66 virtual Selection
GetSurroundingTextSelection() const override
;
69 class AnnotationWindow
: public FloatingWindow
72 AnnotationManagerImpl
& mrManager
;
73 DrawDocShell
* mpDocShell
;
74 SdDrawDocument
* mpDoc
;
76 std::unique_ptr
<OutlinerView
> mpOutlinerView
;
77 std::unique_ptr
<::Outliner
> mpOutliner
;
78 VclPtr
<ScrollBar
> mpVScrollbar
;
79 css::uno::Reference
< css::office::XAnnotation
> mxAnnotation
;
80 bool const mbReadonly
;
82 bool mbMouseOverButton
;
83 VclPtr
<AnnotationTextWindow
> mpTextWindow
;
84 VclPtr
<MultiLineEdit
> mpMeta
;
85 ::tools::Rectangle maRectMetaButton
;
86 basegfx::B2DPolygon maPopupTriangle
;
89 DECL_LINK(ScrollHdl
, ScrollBar
*, void);
92 AnnotationWindow( AnnotationManagerImpl
& rManager
, DrawDocShell
* pDocShell
, vcl::Window
* pParent
);
93 virtual ~AnnotationWindow() override
;
94 virtual void dispose() override
;
98 void setAnnotation( const css::uno::Reference
< css::office::XAnnotation
>& xAnnotation
);
100 void ExecuteSlot( sal_uInt16 nSID
);
102 DrawDocShell
* DocShell() { return mpDocShell
; }
103 OutlinerView
* getView() { return mpOutlinerView
.get(); }
104 ::Outliner
* Engine() { return mpOutliner
.get(); }
105 SdDrawDocument
* Doc() { return mpDoc
; }
107 long GetPostItTextHeight();
111 void ResizeIfNecessary(long aOldHeight
, long aNewHeight
);
116 bool IsProtected() { return mbProtected
; }
118 void SetLanguage(const SvxLanguageItem
&aNewItem
);
120 static sal_Int32
GetScrollbarWidth() { return 16; }
122 void ToggleInsMode();
124 virtual void Deactivate() override
;
125 virtual void Paint( vcl::RenderContext
& /*rRenderContext*/, const ::tools::Rectangle
& rRect
) override
;
126 virtual void MouseMove( const MouseEvent
& rMEvt
) override
;
127 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) override
;
128 virtual void Command( const CommandEvent
& rCEvt
) override
;
129 virtual void GetFocus() override
;
138 TextApiObject
* getTextApiObject( const css::uno::Reference
< css::office::XAnnotation
>& xAnnotation
);
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */