Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _ANNOTATIONWINDOW_HXX
21 : #define _ANNOTATIONWINDOW_HXX
22 :
23 : #include <com/sun/star/office/XAnnotation.hpp>
24 :
25 : #include <vcl/ctrl.hxx>
26 : #include <vcl/lineinfo.hxx>
27 : #include <vcl/floatwin.hxx>
28 :
29 : #include <basegfx/polygon/b2dpolygon.hxx>
30 :
31 : #include <svx/sdr/overlay/overlayobject.hxx>
32 : #include <editeng/editstat.hxx>
33 :
34 : class OutlinerView;
35 : class Outliner;
36 : class ScrollBar;
37 : class MultiLineEdit;
38 : class SvxLanguageItem;
39 : class SdDrawDocument;
40 :
41 : namespace sd {
42 :
43 : class AnnotationManagerImpl;
44 : class AnnotationWindow;
45 : class DrawDocShell;
46 : class View;
47 :
48 : class AnnotationTextWindow : public Control
49 : {
50 : private:
51 : OutlinerView* mpOutlinerView;
52 : AnnotationWindow* mpAnnotationWindow;
53 :
54 : protected:
55 : virtual void Paint( const Rectangle& rRect);
56 : virtual void KeyInput( const KeyEvent& rKeyEvt );
57 : virtual void MouseMove( const MouseEvent& rMEvt );
58 : virtual void MouseButtonDown( const MouseEvent& rMEvt );
59 : virtual void MouseButtonUp( const MouseEvent& rMEvt );
60 : virtual void Command( const CommandEvent& rCEvt );
61 : virtual void LoseFocus();
62 :
63 : public:
64 : AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits );
65 : ~AnnotationTextWindow();
66 :
67 0 : void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; }
68 :
69 : virtual rtl::OUString GetSurroundingText() const;
70 : virtual Selection GetSurroundingTextSelection() const;
71 :
72 : virtual void GetFocus();
73 : };
74 :
75 :
76 : class AnnotationWindow : public FloatingWindow
77 : {
78 : private:
79 : AnnotationManagerImpl& mrManager;
80 : DrawDocShell* mpDocShell;
81 : View* mpView;
82 : SdDrawDocument* mpDoc;
83 :
84 : OutlinerView* mpOutlinerView;
85 : Outliner* mpOutliner;
86 : ScrollBar* mpVScrollbar;
87 : ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation;
88 : bool mbReadonly;
89 : bool mbProtected;
90 : bool mbMouseOverButton;
91 : AnnotationTextWindow* mpTextWindow;
92 : MultiLineEdit* mpMeta;
93 : Rectangle maRectMetaButton;
94 : basegfx::B2DPolygon maPopupTriangle;
95 :
96 : protected:
97 : void SetSizePixel( const Size& rNewSize );
98 :
99 : DECL_LINK(ModifyHdl, void*);
100 : DECL_LINK(ScrollHdl, ScrollBar*);
101 :
102 : public:
103 : AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, ::Window* pParent );
104 : virtual ~AnnotationWindow();
105 :
106 : void StartEdit();
107 :
108 : virtual SvxLanguageItem GetLanguage(void);
109 :
110 : void setAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, bool bGrabFocus = false );
111 : const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& getAnnotation() const { return mxAnnotation; }
112 :
113 : void ExecuteSlot( sal_uInt16 nSID );
114 :
115 : ScrollBar* Scrollbar() { return mpVScrollbar;}
116 :
117 0 : DrawDocShell* DocShell() { return mpDocShell; }
118 0 : OutlinerView* getView() { return mpOutlinerView; }
119 0 : sd::View* DocView() { return mpView; }
120 0 : Outliner* Engine() { return mpOutliner; }
121 0 : SdDrawDocument* Doc() { return mpDoc; }
122 :
123 : long GetPostItTextHeight();
124 :
125 : void InitControls();
126 : void HidePostIt();
127 : void DoResize();
128 : void ResizeIfNeccessary(long aOldHeight, long aNewHeight);
129 : void SetScrollbar();
130 :
131 : void Rescale();
132 :
133 : bool IsReadOnly() { return mbReadonly;}
134 :
135 0 : bool IsProtected() { return mbProtected; }
136 :
137 : void SetLanguage(const SvxLanguageItem &aNewItem);
138 :
139 : sal_Int32 GetScrollbarWidth();
140 :
141 : void ToggleInsMode();
142 :
143 : DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
144 :
145 : virtual void Deactivate();
146 : virtual void Paint( const Rectangle& rRect);
147 : virtual void MouseMove( const MouseEvent& rMEvt );
148 : virtual void MouseButtonDown( const MouseEvent& rMEvt );
149 : virtual void Command( const CommandEvent& rCEvt );
150 : virtual void GetFocus();
151 :
152 : void SetColor();
153 :
154 : Color maColor;
155 : Color maColorDark;
156 : Color maColorLight;
157 : };
158 :
159 : } // namespace sd
160 :
161 : #endif
162 :
163 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|