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