xref: /trunk/main/sd/source/ui/annotations/annotationwindow.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c45d927aSAndrew Rist  * distributed with this work for additional information
6*c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9*c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15*c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c45d927aSAndrew Rist  * specific language governing permissions and limitations
18*c45d927aSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*c45d927aSAndrew Rist  *************************************************************/
21*c45d927aSAndrew Rist 
22*c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _ANNOTATIONWINDOW_HXX
25cdf0e10cSrcweir #define _ANNOTATIONWINDOW_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/office/XAnnotation.hpp>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <tools/datetime.hxx>
30cdf0e10cSrcweir #include <tools/date.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <vcl/ctrl.hxx>
33cdf0e10cSrcweir #include <vcl/lineinfo.hxx>
34cdf0e10cSrcweir #include <vcl/floatwin.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <svx/sdr/overlay/overlayobject.hxx>
39cdf0e10cSrcweir #include <editeng/editstat.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class OutlinerView;
42cdf0e10cSrcweir class Outliner;
43cdf0e10cSrcweir class ScrollBar;
44cdf0e10cSrcweir class Edit;
45cdf0e10cSrcweir class MultiLineEdit;
46cdf0e10cSrcweir class PopupMenu;
47cdf0e10cSrcweir class SvxLanguageItem;
48cdf0e10cSrcweir class OutlinerParaObject;
49cdf0e10cSrcweir class SdDrawDocument;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir namespace sd {
52cdf0e10cSrcweir 
53cdf0e10cSrcweir class AnnotationManagerImpl;
54cdf0e10cSrcweir class AnnotationWindow;
55cdf0e10cSrcweir class DrawDocShell;
56cdf0e10cSrcweir class View;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir class AnnotationTextWindow : public Control
59cdf0e10cSrcweir {
60cdf0e10cSrcweir private:
61cdf0e10cSrcweir     OutlinerView*       mpOutlinerView;
62cdf0e10cSrcweir     AnnotationWindow*   mpAnnotationWindow;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir protected:
65cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRect);
66cdf0e10cSrcweir     virtual void    KeyInput( const KeyEvent& rKeyEvt );
67cdf0e10cSrcweir     virtual void    MouseMove( const MouseEvent& rMEvt );
68cdf0e10cSrcweir     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
69cdf0e10cSrcweir     virtual void    MouseButtonUp( const MouseEvent& rMEvt );
70cdf0e10cSrcweir     virtual void    Command( const CommandEvent& rCEvt );
71cdf0e10cSrcweir     virtual void    LoseFocus();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir public:
74cdf0e10cSrcweir     AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits );
75cdf0e10cSrcweir     ~AnnotationTextWindow();
76cdf0e10cSrcweir 
SetOutlinerView(OutlinerView * pOutlinerView)77cdf0e10cSrcweir     void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     virtual XubString GetSurroundingText() const;
80cdf0e10cSrcweir     virtual Selection GetSurroundingTextSelection() const;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     virtual void    GetFocus();
83cdf0e10cSrcweir };
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
86cdf0e10cSrcweir class AnnotationWindow : public FloatingWindow
87cdf0e10cSrcweir {
88cdf0e10cSrcweir     private:
89cdf0e10cSrcweir         AnnotationManagerImpl&  mrManager;
90cdf0e10cSrcweir         DrawDocShell*           mpDocShell;
91cdf0e10cSrcweir         View*                   mpView;
92cdf0e10cSrcweir         SdDrawDocument*         mpDoc;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir         OutlinerView*           mpOutlinerView;
95cdf0e10cSrcweir         Outliner*               mpOutliner;
96cdf0e10cSrcweir         ScrollBar*              mpVScrollbar;
97cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation;
98cdf0e10cSrcweir         bool                    mbReadonly;
99cdf0e10cSrcweir         bool                    mbProtected;
100cdf0e10cSrcweir         bool                    mbMouseOverButton;
101cdf0e10cSrcweir         AnnotationTextWindow*   mpTextWindow;
102cdf0e10cSrcweir         MultiLineEdit*          mpMeta;
103cdf0e10cSrcweir         Rectangle               maRectMetaButton;
104cdf0e10cSrcweir         basegfx::B2DPolygon     maPopupTriangle;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     protected:
107cdf0e10cSrcweir         void            SetSizePixel( const Size& rNewSize );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir         DECL_LINK(ModifyHdl, void*);
110cdf0e10cSrcweir         DECL_LINK(ScrollHdl, ScrollBar*);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     public:
113cdf0e10cSrcweir         AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, ::Window* pParent );
114cdf0e10cSrcweir         virtual ~AnnotationWindow();
115cdf0e10cSrcweir 
116cdf0e10cSrcweir         void StartEdit();
117cdf0e10cSrcweir 
118cdf0e10cSrcweir         virtual SvxLanguageItem GetLanguage(void);
119cdf0e10cSrcweir 
120cdf0e10cSrcweir         void setAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, bool bGrabFocus = false );
getAnnotation() const121cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& getAnnotation() const { return mxAnnotation; }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir         void ExecuteSlot( sal_uInt16 nSID );
124cdf0e10cSrcweir 
Scrollbar()125cdf0e10cSrcweir         ScrollBar*      Scrollbar()     { return mpVScrollbar;}
126cdf0e10cSrcweir 
DocShell()127cdf0e10cSrcweir         DrawDocShell*           DocShell()      { return mpDocShell; }
getView()128cdf0e10cSrcweir         OutlinerView*           getView()       { return mpOutlinerView; }
DocView()129cdf0e10cSrcweir         sd::View*               DocView()       { return mpView; }
Engine()130cdf0e10cSrcweir         Outliner*               Engine()        { return mpOutliner; }
Doc()131cdf0e10cSrcweir         SdDrawDocument*         Doc()           { return mpDoc; }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir         long            GetPostItTextHeight();
134cdf0e10cSrcweir 
135cdf0e10cSrcweir         void            InitControls();
136cdf0e10cSrcweir         void            HidePostIt();
137cdf0e10cSrcweir         void            DoResize();
138cdf0e10cSrcweir         void            ResizeIfNeccessary(long aOldHeight, long aNewHeight);
139cdf0e10cSrcweir         void            SetScrollbar();
140cdf0e10cSrcweir 
141cdf0e10cSrcweir         void            Rescale();
142cdf0e10cSrcweir 
IsReadOnly()143cdf0e10cSrcweir         bool            IsReadOnly() { return mbReadonly;}
144cdf0e10cSrcweir 
IsProtected()145cdf0e10cSrcweir         bool            IsProtected() { return mbProtected; }
146cdf0e10cSrcweir 
147cdf0e10cSrcweir         void            SetLanguage(const SvxLanguageItem aNewItem);
148cdf0e10cSrcweir 
149cdf0e10cSrcweir         sal_Int32       GetScrollbarWidth();
150cdf0e10cSrcweir 
151cdf0e10cSrcweir         void            ToggleInsMode();
152cdf0e10cSrcweir 
153cdf0e10cSrcweir         DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
154cdf0e10cSrcweir 
155cdf0e10cSrcweir         virtual void    Deactivate();
156cdf0e10cSrcweir         virtual void    Paint( const Rectangle& rRect);
157cdf0e10cSrcweir         virtual void    MouseMove( const MouseEvent& rMEvt );
158cdf0e10cSrcweir         virtual void    MouseButtonDown( const MouseEvent& rMEvt );
159cdf0e10cSrcweir         virtual void    Command( const CommandEvent& rCEvt );
160cdf0e10cSrcweir         virtual void    GetFocus();
161cdf0e10cSrcweir 
162cdf0e10cSrcweir         void            SetColor();
163cdf0e10cSrcweir 
164cdf0e10cSrcweir         Color           maColor;
165cdf0e10cSrcweir         Color           maColorDark;
166cdf0e10cSrcweir         Color           maColorLight;
167cdf0e10cSrcweir };
168cdf0e10cSrcweir 
169cdf0e10cSrcweir } // namespace sd
170cdf0e10cSrcweir 
171cdf0e10cSrcweir #endif
172