xref: /aoo42x/main/sd/source/ui/notes/EditWindow.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SD_EDIT_WINDOW_HXX
29 #define SD_EDIT_WINDOW_HXX
30 
31 #include <vcl/window.hxx>
32 #include <svtools/transfer.hxx>
33 #include <vcl/timer.hxx>
34 #include <editeng/editdata.hxx>
35 #include <svtools/colorcfg.hxx>
36 
37 class EditEngine;
38 class EditStatus;
39 class EditView;
40 class Menu;
41 class ScrollBar;
42 class ScrollBarBox;
43 class SfxItemPool;
44 class Timer;
45 
46 
47 namespace sd { namespace notes {
48 
49 class EditWindow
50     : public Window,
51       public DropTargetHelper
52 {
53 public:
54     EditWindow (Window* pParentWindow, SfxItemPool* pItemPool);
55 	~EditWindow (void);
56 
57 	void InsertText (const String &rText);
58 
59 	using Window::GetText;
60 private:
61 	EditView* mpEditView;
62     EditEngine* mpEditEngine;
63     SfxItemPool* mpEditEngineItemPool;
64 	ScrollBar* mpHorizontalScrollBar;
65 	ScrollBar* mpVerticalScrollBar;
66 	ScrollBarBox* mpScrollBox;
67 	Timer maModifyTimer;
68 	Timer maCursorMoveTimer;
69 	ESelection maOldSelection;
70 
71 	virtual void KeyInput(const KeyEvent& rKEvt);
72 	virtual void Command(const CommandEvent& rCEvt);
73 	DECL_LINK(MenuSelectHdl, Menu *);
74 
75 	virtual void DataChanged( const DataChangedEvent& );
76 	virtual void Resize();
77 	virtual void MouseMove(const MouseEvent &rEvt);
78 	virtual void MouseButtonUp(const MouseEvent &rEvt);
79 	virtual void MouseButtonDown(const MouseEvent &rEvt);
80 
81     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
82     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
83 	virtual void Paint(const Rectangle& rRect);
84 
85 	DECL_LINK(EditStatusHdl ,EditStatus *);
86 	DECL_LINK(ScrollHdl, ScrollBar *);
87 
88 	void 		CreateEditView();
89 
90 	Rectangle 	AdjustScrollBars();
91 	void 		SetScrollBarRanges();
92 	void 		InitScrollBars();
93 
94     //    SmDocShell *    GetDoc();
95     //    SmViewShell *   GetView();
96     EditView* GetEditView (void);
97     EditEngine* GetEditEngine (void);
98     EditEngine* CreateEditEngine (void);
99 
100 	// Window
101 	virtual void		SetText(const XubString &rText);
102 	virtual XubString	GetText();
103 	virtual void		GetFocus();
104 	virtual void		LoseFocus();
105 
106 	ESelection			GetSelection() const;
107 	void				SetSelection(const ESelection &rSel);
108 
109 	sal_Bool 				IsEmpty() const;
110 	sal_Bool 				IsSelected() const;
111 	sal_Bool 				IsAllSelected() const;
112 	void 				Cut();
113 	void 				Copy();
114 	void 				Paste();
115 	void 				Delete();
116 	void 				SelectAll();
117 	void 				MarkError(const Point &rPos);
118 	void 				SelNextMark();
119 	void 				SelPrevMark();
120 	sal_Bool 				HasMark(const String &rText) const;
121 
122     void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
123 };
124 
125 } } // end of namespace ::sd::notes
126 
127 #endif
128 
129