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