xref: /aoo41x/main/starmath/inc/edit.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 #ifndef EDIT_HXX
28 #define EDIT_HXX
29 
30 #include <vcl/window.hxx>
31 #include <vcl/timer.hxx>
32 #include <svtools/transfer.hxx>
33 #include <editeng/editdata.hxx>
34 #include <svtools/colorcfg.hxx>
35 
36 //#ifndef _ACCESSIBILITY_HXX_
37 //#include "accessibility.hxx"
38 //#endif
39 
40 class SmDocShell;
41 class SmViewShell;
42 class EditView;
43 class EditEngine;
44 class EditStatus;
45 class ScrollBar;
46 class ScrollBarBox;
47 class DataChangedEvent;
48 class Menu;
49 class SmCmdBoxWindow;
50 class SmEditAccessible;
51 class CommandEvent;
52 
53 /**************************************************************************/
54 
55 	void SmGetLeftSelectionPart(const ESelection aSelection,
56 								sal_uInt16 &nPara, sal_uInt16 &nPos);
57 
58 /**************************************************************************/
59 
60 class SmEditWindow : public Window, public DropTargetHelper
61 {
62     ::com::sun::star::uno::Reference<
63         ::com::sun::star::accessibility::XAccessible >  xAccessible;
64     SmEditAccessible *                                          pAccessible;
65 
66     SmCmdBoxWindow &rCmdBox;
67 	EditView	   *pEditView;
68 	ScrollBar	   *pHScrollBar,
69 				   *pVScrollBar;
70 	ScrollBarBox   *pScrollBox;
71 	Timer			aModifyTimer,
72 					aCursorMoveTimer;
73 	ESelection		aOldSelection;
74 
75 	virtual void KeyInput(const KeyEvent& rKEvt);
76 	virtual void Command(const CommandEvent& rCEvt);
77 	DECL_LINK(MenuSelectHdl, Menu *);
78 	DECL_LINK(ModifyTimerHdl, Timer *);
79 	DECL_LINK(CursorMoveTimerHdl, Timer *);
80 
81 	virtual void DataChanged( const DataChangedEvent& );
82 	virtual void Resize();
83 	virtual void MouseMove(const MouseEvent &rEvt);
84 	virtual void MouseButtonUp(const MouseEvent &rEvt);
85 	virtual void MouseButtonDown(const MouseEvent &rEvt);
86 
87     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
88     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
89 	virtual void Paint(const Rectangle& rRect);
90 
91 	DECL_LINK(EditStatusHdl ,EditStatus *);
92 	DECL_LINK(ScrollHdl, ScrollBar *);
93 
94 	void 		CreateEditView();
95 
96 	Rectangle 	AdjustScrollBars();
97 	void 		SetScrollBarRanges();
98 	void 		InitScrollBars();
99 	void		InvalidateSlots();
100 
101 public:
102     SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin );
103 	~SmEditWindow();
104 
105     SmDocShell *    GetDoc();
106     SmViewShell *   GetView();
107     EditView *      GetEditView()   { return pEditView; }
108     EditEngine *    GetEditEngine();
109     SfxItemPool *   GetEditEngineItemPool();
110 
111 	// Window
112 	virtual void		SetText(const XubString &rText);
113     virtual String      GetText() const;
114 	virtual void		GetFocus();
115 	virtual void		LoseFocus();
116 
117 	ESelection			GetSelection() const;
118 	void				SetSelection(const ESelection &rSel);
119 
120 	sal_Bool 				IsEmpty() const;
121 	sal_Bool 				IsSelected() const;
122 	sal_Bool 				IsAllSelected() const;
123 	void 				Cut();
124 	void 				Copy();
125 	void 				Paste();
126 	void 				Delete();
127 	void 				SelectAll();
128 	void 				InsertText(const String &rText);
129 	void 				InsertCommand(sal_uInt16 nCommand);
130 	void 				MarkError(const Point &rPos);
131 	void 				SelNextMark();
132 	void 				SelPrevMark();
133 	sal_Bool 				HasMark(const String &rText) const;
134 
135 	void 				Flush();
136     void                DeleteEditView( SmViewShell &rView );
137 
138     void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
139 
140     sal_Bool                HandleWheelCommands( const CommandEvent &rCEvt );
141 
142     // for Accessibility
143     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
144 
145     using Window::GetAccessible;
146     SmEditAccessible *   GetAccessible()  { return pAccessible; }
147 };
148 
149 
150 #endif
151 
152