1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: postit.hxx,v $
11 * $Revision: 1.8.84.7 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef _ANNOTATIONWINDOW_HXX
33 #define _ANNOTATIONWINDOW_HXX
35 #include <com/sun/star/office/XAnnotation.hpp>
37 #include <tools/datetime.hxx>
38 #include <tools/date.hxx>
40 #include <vcl/ctrl.hxx>
41 #include <vcl/lineinfo.hxx>
42 #include <vcl/floatwin.hxx>
44 #include <basegfx/polygon/b2dpolygon.hxx>
46 #include <svx/sdr/overlay/overlayobject.hxx>
47 #include <svx/editstat.hxx>
55 class SvxLanguageItem
;
56 class OutlinerParaObject
;
61 class AnnotationManagerImpl
;
62 class AnnotationWindow
;
66 class AnnotationTextWindow
: public Control
69 OutlinerView
* mpOutlinerView
;
70 AnnotationWindow
* mpAnnotationWindow
;
73 virtual void Paint( const Rectangle
& rRect
);
74 virtual void KeyInput( const KeyEvent
& rKeyEvt
);
75 virtual void MouseMove( const MouseEvent
& rMEvt
);
76 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
77 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
78 virtual void Command( const CommandEvent
& rCEvt
);
79 virtual void LoseFocus();
82 AnnotationTextWindow( AnnotationWindow
* pParent
, WinBits nBits
);
83 ~AnnotationTextWindow();
85 void SetOutlinerView( OutlinerView
* pOutlinerView
) { mpOutlinerView
= pOutlinerView
; }
87 virtual XubString
GetSurroundingText() const;
88 virtual Selection
GetSurroundingTextSelection() const;
90 virtual void GetFocus();
94 class AnnotationWindow
: public FloatingWindow
97 AnnotationManagerImpl
& mrManager
;
98 DrawDocShell
* mpDocShell
;
100 SdDrawDocument
* mpDoc
;
102 OutlinerView
* mpOutlinerView
;
103 Outliner
* mpOutliner
;
104 ScrollBar
* mpVScrollbar
;
105 ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> mxAnnotation
;
108 bool mbMouseOverButton
;
109 AnnotationTextWindow
* mpTextWindow
;
110 MultiLineEdit
* mpMeta
;
111 Rectangle maRectMetaButton
;
112 basegfx::B2DPolygon maPopupTriangle
;
115 void SetSizePixel( const Size
& rNewSize
);
117 DECL_LINK(ModifyHdl
, void*);
118 DECL_LINK(ScrollHdl
, ScrollBar
*);
121 AnnotationWindow( AnnotationManagerImpl
& rManager
, DrawDocShell
* pDocShell
, ::Window
* pParent
);
122 virtual ~AnnotationWindow();
126 virtual SvxLanguageItem
GetLanguage(void);
128 void setAnnotation( const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
, bool bGrabFocus
= false );
129 const ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& getAnnotation() const { return mxAnnotation
; }
131 void ExecuteSlot( USHORT nSID
);
133 ScrollBar
* Scrollbar() { return mpVScrollbar
;}
135 DrawDocShell
* DocShell() { return mpDocShell
; }
136 OutlinerView
* getView() { return mpOutlinerView
; }
137 sd::View
* DocView() { return mpView
; }
138 Outliner
* Engine() { return mpOutliner
; }
139 SdDrawDocument
* Doc() { return mpDoc
; }
141 long GetPostItTextHeight();
146 void ResizeIfNeccessary(long aOldHeight
, long aNewHeight
);
151 void SetReadonly(bool bSet
);
152 bool IsReadOnly() { return mbReadonly
;}
154 bool IsProtected() { return mbProtected
; }
156 void SetLanguage(const SvxLanguageItem aNewItem
);
158 sal_Int32
GetScrollbarWidth();
160 void ToggleInsMode();
162 DECL_LINK( OnlineSpellCallback
, SpellCallbackInfo
*);
164 virtual void Deactivate();
165 virtual void Paint( const Rectangle
& rRect
);
166 virtual void MouseMove( const MouseEvent
& rMEvt
);
167 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
168 virtual void Command( const CommandEvent
& rCEvt
);
169 virtual void GetFocus();