xref: /aoo42x/main/sd/source/ui/notes/EditWindow.hxx (revision c45d927a)
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
10*c45d927aSAndrew Rist  *
11*c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c45d927aSAndrew Rist  *
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.
19*c45d927aSAndrew Rist  *
20*c45d927aSAndrew Rist  *************************************************************/
21*c45d927aSAndrew Rist 
22*c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SD_EDIT_WINDOW_HXX
25cdf0e10cSrcweir #define SD_EDIT_WINDOW_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/window.hxx>
28cdf0e10cSrcweir #include <svtools/transfer.hxx>
29cdf0e10cSrcweir #include <vcl/timer.hxx>
30cdf0e10cSrcweir #include <editeng/editdata.hxx>
31cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class EditEngine;
34cdf0e10cSrcweir class EditStatus;
35cdf0e10cSrcweir class EditView;
36cdf0e10cSrcweir class Menu;
37cdf0e10cSrcweir class ScrollBar;
38cdf0e10cSrcweir class ScrollBarBox;
39cdf0e10cSrcweir class SfxItemPool;
40cdf0e10cSrcweir class Timer;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace sd { namespace notes {
44cdf0e10cSrcweir 
45cdf0e10cSrcweir class EditWindow
46cdf0e10cSrcweir     : public Window,
47cdf0e10cSrcweir       public DropTargetHelper
48cdf0e10cSrcweir {
49cdf0e10cSrcweir public:
50cdf0e10cSrcweir     EditWindow (Window* pParentWindow, SfxItemPool* pItemPool);
51cdf0e10cSrcweir 	~EditWindow (void);
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 	void InsertText (const String &rText);
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 	using Window::GetText;
56cdf0e10cSrcweir private:
57cdf0e10cSrcweir 	EditView* mpEditView;
58cdf0e10cSrcweir     EditEngine* mpEditEngine;
59cdf0e10cSrcweir     SfxItemPool* mpEditEngineItemPool;
60cdf0e10cSrcweir 	ScrollBar* mpHorizontalScrollBar;
61cdf0e10cSrcweir 	ScrollBar* mpVerticalScrollBar;
62cdf0e10cSrcweir 	ScrollBarBox* mpScrollBox;
63cdf0e10cSrcweir 	Timer maModifyTimer;
64cdf0e10cSrcweir 	Timer maCursorMoveTimer;
65cdf0e10cSrcweir 	ESelection maOldSelection;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	virtual void KeyInput(const KeyEvent& rKEvt);
68cdf0e10cSrcweir 	virtual void Command(const CommandEvent& rCEvt);
69cdf0e10cSrcweir 	DECL_LINK(MenuSelectHdl, Menu *);
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 	virtual void DataChanged( const DataChangedEvent& );
72cdf0e10cSrcweir 	virtual void Resize();
73cdf0e10cSrcweir 	virtual void MouseMove(const MouseEvent &rEvt);
74cdf0e10cSrcweir 	virtual void MouseButtonUp(const MouseEvent &rEvt);
75cdf0e10cSrcweir 	virtual void MouseButtonDown(const MouseEvent &rEvt);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
78cdf0e10cSrcweir     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
79cdf0e10cSrcweir 	virtual void Paint(const Rectangle& rRect);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	DECL_LINK(EditStatusHdl ,EditStatus *);
82cdf0e10cSrcweir 	DECL_LINK(ScrollHdl, ScrollBar *);
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	void 		CreateEditView();
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	Rectangle 	AdjustScrollBars();
87cdf0e10cSrcweir 	void 		SetScrollBarRanges();
88cdf0e10cSrcweir 	void 		InitScrollBars();
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     //    SmDocShell *    GetDoc();
91cdf0e10cSrcweir     //    SmViewShell *   GetView();
92cdf0e10cSrcweir     EditView* GetEditView (void);
93cdf0e10cSrcweir     EditEngine* GetEditEngine (void);
94cdf0e10cSrcweir     EditEngine* CreateEditEngine (void);
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	// Window
97cdf0e10cSrcweir 	virtual void		SetText(const XubString &rText);
98cdf0e10cSrcweir 	virtual XubString	GetText();
99cdf0e10cSrcweir 	virtual void		GetFocus();
100cdf0e10cSrcweir 	virtual void		LoseFocus();
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	ESelection			GetSelection() const;
103cdf0e10cSrcweir 	void				SetSelection(const ESelection &rSel);
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	sal_Bool 				IsEmpty() const;
106cdf0e10cSrcweir 	sal_Bool 				IsSelected() const;
107cdf0e10cSrcweir 	sal_Bool 				IsAllSelected() const;
108cdf0e10cSrcweir 	void 				Cut();
109cdf0e10cSrcweir 	void 				Copy();
110cdf0e10cSrcweir 	void 				Paste();
111cdf0e10cSrcweir 	void 				Delete();
112cdf0e10cSrcweir 	void 				SelectAll();
113cdf0e10cSrcweir 	void 				MarkError(const Point &rPos);
114cdf0e10cSrcweir 	void 				SelNextMark();
115cdf0e10cSrcweir 	void 				SelPrevMark();
116cdf0e10cSrcweir 	sal_Bool 				HasMark(const String &rText) const;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
119cdf0e10cSrcweir };
120cdf0e10cSrcweir 
121cdf0e10cSrcweir } } // end of namespace ::sd::notes
122cdf0e10cSrcweir 
123cdf0e10cSrcweir #endif
124cdf0e10cSrcweir 
125