xref: /trunk/main/sd/source/ui/annotations/annotationwindow.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _ANNOTATIONWINDOW_HXX
29*cdf0e10cSrcweir #define _ANNOTATIONWINDOW_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/office/XAnnotation.hpp>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include <tools/datetime.hxx>
34*cdf0e10cSrcweir #include <tools/date.hxx>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include <vcl/ctrl.hxx>
37*cdf0e10cSrcweir #include <vcl/lineinfo.hxx>
38*cdf0e10cSrcweir #include <vcl/floatwin.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include <svx/sdr/overlay/overlayobject.hxx>
43*cdf0e10cSrcweir #include <editeng/editstat.hxx>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir class OutlinerView;
46*cdf0e10cSrcweir class Outliner;
47*cdf0e10cSrcweir class ScrollBar;
48*cdf0e10cSrcweir class Edit;
49*cdf0e10cSrcweir class MultiLineEdit;
50*cdf0e10cSrcweir class PopupMenu;
51*cdf0e10cSrcweir class SvxLanguageItem;
52*cdf0e10cSrcweir class OutlinerParaObject;
53*cdf0e10cSrcweir class SdDrawDocument;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir namespace sd {
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir class AnnotationManagerImpl;
58*cdf0e10cSrcweir class AnnotationWindow;
59*cdf0e10cSrcweir class DrawDocShell;
60*cdf0e10cSrcweir class View;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir class AnnotationTextWindow : public Control
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir private:
65*cdf0e10cSrcweir     OutlinerView*       mpOutlinerView;
66*cdf0e10cSrcweir     AnnotationWindow*   mpAnnotationWindow;
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir protected:
69*cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRect);
70*cdf0e10cSrcweir     virtual void    KeyInput( const KeyEvent& rKeyEvt );
71*cdf0e10cSrcweir     virtual void    MouseMove( const MouseEvent& rMEvt );
72*cdf0e10cSrcweir     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
73*cdf0e10cSrcweir     virtual void    MouseButtonUp( const MouseEvent& rMEvt );
74*cdf0e10cSrcweir     virtual void    Command( const CommandEvent& rCEvt );
75*cdf0e10cSrcweir     virtual void    LoseFocus();
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir public:
78*cdf0e10cSrcweir     AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits );
79*cdf0e10cSrcweir     ~AnnotationTextWindow();
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir     void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; }
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir     virtual XubString GetSurroundingText() const;
84*cdf0e10cSrcweir     virtual Selection GetSurroundingTextSelection() const;
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir     virtual void    GetFocus();
87*cdf0e10cSrcweir };
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir class AnnotationWindow : public FloatingWindow
91*cdf0e10cSrcweir {
92*cdf0e10cSrcweir     private:
93*cdf0e10cSrcweir         AnnotationManagerImpl&  mrManager;
94*cdf0e10cSrcweir         DrawDocShell*           mpDocShell;
95*cdf0e10cSrcweir         View*                   mpView;
96*cdf0e10cSrcweir         SdDrawDocument*         mpDoc;
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir         OutlinerView*           mpOutlinerView;
99*cdf0e10cSrcweir         Outliner*               mpOutliner;
100*cdf0e10cSrcweir         ScrollBar*              mpVScrollbar;
101*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation;
102*cdf0e10cSrcweir         bool                    mbReadonly;
103*cdf0e10cSrcweir         bool                    mbProtected;
104*cdf0e10cSrcweir         bool                    mbMouseOverButton;
105*cdf0e10cSrcweir         AnnotationTextWindow*   mpTextWindow;
106*cdf0e10cSrcweir         MultiLineEdit*          mpMeta;
107*cdf0e10cSrcweir         Rectangle               maRectMetaButton;
108*cdf0e10cSrcweir         basegfx::B2DPolygon     maPopupTriangle;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir     protected:
111*cdf0e10cSrcweir         void            SetSizePixel( const Size& rNewSize );
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir         DECL_LINK(ModifyHdl, void*);
114*cdf0e10cSrcweir         DECL_LINK(ScrollHdl, ScrollBar*);
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir     public:
117*cdf0e10cSrcweir         AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, ::Window* pParent );
118*cdf0e10cSrcweir         virtual ~AnnotationWindow();
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir         void StartEdit();
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir         virtual SvxLanguageItem GetLanguage(void);
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir         void setAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, bool bGrabFocus = false );
125*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& getAnnotation() const { return mxAnnotation; }
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir         void ExecuteSlot( sal_uInt16 nSID );
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir         ScrollBar*      Scrollbar()     { return mpVScrollbar;}
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir         DrawDocShell*           DocShell()      { return mpDocShell; }
132*cdf0e10cSrcweir         OutlinerView*           getView()       { return mpOutlinerView; }
133*cdf0e10cSrcweir         sd::View*               DocView()       { return mpView; }
134*cdf0e10cSrcweir         Outliner*               Engine()        { return mpOutliner; }
135*cdf0e10cSrcweir         SdDrawDocument*         Doc()           { return mpDoc; }
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir         long            GetPostItTextHeight();
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir         void            InitControls();
140*cdf0e10cSrcweir         void            HidePostIt();
141*cdf0e10cSrcweir         void            DoResize();
142*cdf0e10cSrcweir         void            ResizeIfNeccessary(long aOldHeight, long aNewHeight);
143*cdf0e10cSrcweir         void            SetScrollbar();
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir         void            Rescale();
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir         bool            IsReadOnly() { return mbReadonly;}
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir         bool            IsProtected() { return mbProtected; }
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir         void            SetLanguage(const SvxLanguageItem aNewItem);
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir         sal_Int32       GetScrollbarWidth();
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir         void            ToggleInsMode();
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir         DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir         virtual void    Deactivate();
160*cdf0e10cSrcweir         virtual void    Paint( const Rectangle& rRect);
161*cdf0e10cSrcweir         virtual void    MouseMove( const MouseEvent& rMEvt );
162*cdf0e10cSrcweir         virtual void    MouseButtonDown( const MouseEvent& rMEvt );
163*cdf0e10cSrcweir         virtual void    Command( const CommandEvent& rCEvt );
164*cdf0e10cSrcweir         virtual void    GetFocus();
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir         void            SetColor();
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir         Color           maColor;
169*cdf0e10cSrcweir         Color           maColorDark;
170*cdf0e10cSrcweir         Color           maColorLight;
171*cdf0e10cSrcweir };
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir } // namespace sd
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir #endif
176