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 _ANNOTATIONWINDOW_HXX
21 #define _ANNOTATIONWINDOW_HXX
23 #include <com/sun/star/office/XAnnotation.hpp>
25 #include <vcl/ctrl.hxx>
26 #include <vcl/lineinfo.hxx>
27 #include <vcl/floatwin.hxx>
29 #include <basegfx/polygon/b2dpolygon.hxx>
31 #include <svx/sdr/overlay/overlayobject.hxx>
32 #include <editeng/editstat.hxx>
38 class SvxLanguageItem
;
43 class AnnotationManagerImpl
;
44 class AnnotationWindow
;
48 class AnnotationTextWindow
: public Control
51 OutlinerView
* mpOutlinerView
;
52 AnnotationWindow
* mpAnnotationWindow
;
55 virtual void Paint( const Rectangle
& rRect
);
56 virtual void KeyInput( const KeyEvent
& rKeyEvt
);
57 virtual void MouseMove( const MouseEvent
& rMEvt
);
58 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
59 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
60 virtual void Command( const CommandEvent
& rCEvt
);
61 virtual void LoseFocus();
64 AnnotationTextWindow( AnnotationWindow
* pParent
, WinBits nBits
);
65 ~AnnotationTextWindow();
67 void SetOutlinerView( OutlinerView
* pOutlinerView
) { mpOutlinerView
= pOutlinerView
; }
69 virtual OUString
GetSurroundingText() const;
70 virtual Selection
GetSurroundingTextSelection() const;
72 virtual void GetFocus();
76 class AnnotationWindow
: public FloatingWindow
79 AnnotationManagerImpl
& mrManager
;
80 DrawDocShell
* mpDocShell
;
82 SdDrawDocument
* mpDoc
;
84 OutlinerView
* mpOutlinerView
;
86 ScrollBar
* mpVScrollbar
;
87 ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> mxAnnotation
;
90 bool mbMouseOverButton
;
91 AnnotationTextWindow
* mpTextWindow
;
92 MultiLineEdit
* mpMeta
;
93 Rectangle maRectMetaButton
;
94 basegfx::B2DPolygon maPopupTriangle
;
97 void SetSizePixel( const Size
& rNewSize
);
99 DECL_LINK(ModifyHdl
, void*);
100 DECL_LINK(ScrollHdl
, ScrollBar
*);
103 AnnotationWindow( AnnotationManagerImpl
& rManager
, DrawDocShell
* pDocShell
, ::Window
* pParent
);
104 virtual ~AnnotationWindow();
108 virtual SvxLanguageItem
GetLanguage(void);
110 void setAnnotation( const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
, bool bGrabFocus
= false );
111 const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& getAnnotation() const { return mxAnnotation
; }
113 void ExecuteSlot( sal_uInt16 nSID
);
115 ScrollBar
* Scrollbar() { return mpVScrollbar
;}
117 DrawDocShell
* DocShell() { return mpDocShell
; }
118 OutlinerView
* getView() { return mpOutlinerView
; }
119 sd::View
* DocView() { return mpView
; }
120 Outliner
* Engine() { return mpOutliner
; }
121 SdDrawDocument
* Doc() { return mpDoc
; }
123 long GetPostItTextHeight();
128 void ResizeIfNeccessary(long aOldHeight
, long aNewHeight
);
133 bool IsReadOnly() { return mbReadonly
;}
135 bool IsProtected() { return mbProtected
; }
137 void SetLanguage(const SvxLanguageItem
&aNewItem
);
139 sal_Int32
GetScrollbarWidth();
141 void ToggleInsMode();
143 DECL_LINK( OnlineSpellCallback
, SpellCallbackInfo
*);
145 virtual void Deactivate();
146 virtual void Paint( const Rectangle
& rRect
);
147 virtual void MouseMove( const MouseEvent
& rMEvt
);
148 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
149 virtual void Command( const CommandEvent
& rCEvt
);
150 virtual void GetFocus();
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */