xref: /aoo41x/main/sd/source/ui/notes/EditWindow.hxx (revision 67e470da)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SD_EDIT_WINDOW_HXX
25 #define SD_EDIT_WINDOW_HXX
26 
27 #include <vcl/window.hxx>
28 #include <svtools/transfer.hxx>
29 #include <vcl/timer.hxx>
30 #include <editeng/editdata.hxx>
31 #include <svtools/colorcfg.hxx>
32 
33 class EditEngine;
34 class EditStatus;
35 class EditView;
36 class Menu;
37 class ScrollBar;
38 class ScrollBarBox;
39 class SfxItemPool;
40 class Timer;
41 
42 
43 namespace sd { namespace notes {
44 
45 class EditWindow
46     : public Window,
47       public DropTargetHelper
48 {
49 public:
50     EditWindow (Window* pParentWindow, SfxItemPool* pItemPool);
51 	~EditWindow (void);
52 
53 	void InsertText (const String &rText);
54 
55 	using Window::GetText;
56 private:
57 	EditView* mpEditView;
58     EditEngine* mpEditEngine;
59     SfxItemPool* mpEditEngineItemPool;
60 	ScrollBar* mpHorizontalScrollBar;
61 	ScrollBar* mpVerticalScrollBar;
62 	ScrollBarBox* mpScrollBox;
63 	Timer maModifyTimer;
64 	Timer maCursorMoveTimer;
65 	ESelection maOldSelection;
66 
67 	virtual void KeyInput(const KeyEvent& rKEvt);
68 	virtual void Command(const CommandEvent& rCEvt);
69 	DECL_LINK(MenuSelectHdl, Menu *);
70 
71 	virtual void DataChanged( const DataChangedEvent& );
72 	virtual void Resize();
73 	virtual void MouseMove(const MouseEvent &rEvt);
74 	virtual void MouseButtonUp(const MouseEvent &rEvt);
75 	virtual void MouseButtonDown(const MouseEvent &rEvt);
76 
77     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
78     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
79 	virtual void Paint(const Rectangle& rRect);
80 
81 	DECL_LINK(EditStatusHdl ,EditStatus *);
82 	DECL_LINK(ScrollHdl, ScrollBar *);
83 
84 	void 		CreateEditView();
85 
86 	Rectangle 	AdjustScrollBars();
87 	void 		SetScrollBarRanges();
88 	void 		InitScrollBars();
89 
90     //    SmDocShell *    GetDoc();
91     //    SmViewShell *   GetView();
92     EditView* GetEditView (void);
93     EditEngine* GetEditEngine (void);
94     EditEngine* CreateEditEngine (void);
95 
96 	// Window
97 	virtual void		SetText(const XubString &rText);
98 	virtual XubString	GetText();
99 	virtual void		GetFocus();
100 	virtual void		LoseFocus();
101 
102 	ESelection			GetSelection() const;
103 	void				SetSelection(const ESelection &rSel);
104 
105 	sal_Bool 				IsEmpty() const;
106 	sal_Bool 				IsSelected() const;
107 	sal_Bool 				IsAllSelected() const;
108 	void 				Cut();
109 	void 				Copy();
110 	void 				Paste();
111 	void 				Delete();
112 	void 				SelectAll();
113 	void 				MarkError(const Point &rPos);
114 	void 				SelNextMark();
115 	void 				SelPrevMark();
116 	sal_Bool 				HasMark(const String &rText) const;
117 
118     void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
119 };
120 
121 } } // end of namespace ::sd::notes
122 
123 #endif
124 
125