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 <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
;
49 class AnnotationTextWindow
: public Control
52 OutlinerView
* mpOutlinerView
;
53 VclPtr
<AnnotationWindow
> mpAnnotationWindow
;
56 virtual void Paint( vcl::RenderContext
& /*rRenderContext*/, const Rectangle
& rRect
) SAL_OVERRIDE
;
57 virtual void KeyInput( const KeyEvent
& rKeyEvt
) SAL_OVERRIDE
;
58 virtual void MouseMove( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
59 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
60 virtual void MouseButtonUp( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
61 virtual void Command( const CommandEvent
& rCEvt
) SAL_OVERRIDE
;
62 virtual void LoseFocus() SAL_OVERRIDE
;
65 AnnotationTextWindow( AnnotationWindow
* pParent
, WinBits nBits
);
66 virtual ~AnnotationTextWindow();
67 virtual void dispose() SAL_OVERRIDE
;
69 void SetOutlinerView( OutlinerView
* pOutlinerView
) { mpOutlinerView
= pOutlinerView
; }
71 virtual OUString
GetSurroundingText() const SAL_OVERRIDE
;
72 virtual Selection
GetSurroundingTextSelection() const SAL_OVERRIDE
;
74 virtual void GetFocus() SAL_OVERRIDE
;
77 class AnnotationWindow
: public FloatingWindow
80 AnnotationManagerImpl
& mrManager
;
81 DrawDocShell
* mpDocShell
;
83 SdDrawDocument
* mpDoc
;
85 OutlinerView
* mpOutlinerView
;
87 VclPtr
<ScrollBar
> mpVScrollbar
;
88 ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> mxAnnotation
;
91 bool mbMouseOverButton
;
92 VclPtr
<AnnotationTextWindow
> mpTextWindow
;
93 VclPtr
<MultiLineEdit
> mpMeta
;
94 Rectangle maRectMetaButton
;
95 basegfx::B2DPolygon maPopupTriangle
;
98 void SetSizePixel( const Size
& rNewSize
) SAL_OVERRIDE
;
100 DECL_STATIC_LINK(AnnotationWindow
, ModifyHdl
, void*);
101 DECL_LINK(ScrollHdl
, ScrollBar
*);
104 AnnotationWindow( AnnotationManagerImpl
& rManager
, DrawDocShell
* pDocShell
, vcl::Window
* pParent
);
105 virtual ~AnnotationWindow();
106 virtual void dispose() SAL_OVERRIDE
;
110 SvxLanguageItem
GetLanguage();
112 void setAnnotation( const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
, bool bGrabFocus
= false );
113 const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& getAnnotation() const { return mxAnnotation
; }
115 void ExecuteSlot( sal_uInt16 nSID
);
117 ScrollBar
* Scrollbar() { return mpVScrollbar
;}
119 DrawDocShell
* DocShell() { return mpDocShell
; }
120 OutlinerView
* getView() { return mpOutlinerView
; }
121 sd::View
* DocView() { return mpView
; }
122 Outliner
* Engine() { return mpOutliner
; }
123 SdDrawDocument
* Doc() { return mpDoc
; }
125 long GetPostItTextHeight();
130 void ResizeIfNecessary(long aOldHeight
, long aNewHeight
);
135 bool IsReadOnly() { return mbReadonly
;}
137 bool IsProtected() { return mbProtected
; }
139 void SetLanguage(const SvxLanguageItem
&aNewItem
);
141 static sal_Int32
GetScrollbarWidth() { return 16; }
143 void ToggleInsMode();
145 DECL_LINK( OnlineSpellCallback
, SpellCallbackInfo
*);
147 virtual void Deactivate() SAL_OVERRIDE
;
148 virtual void Paint( vcl::RenderContext
& /*rRenderContext*/, const Rectangle
& rRect
) SAL_OVERRIDE
;
149 virtual void MouseMove( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
150 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
151 virtual void Command( const CommandEvent
& rCEvt
) SAL_OVERRIDE
;
152 virtual void GetFocus() SAL_OVERRIDE
;
161 TextApiObject
* getTextApiObject( const css::uno::Reference
< css::office::XAnnotation
>& xAnnotation
);
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */