xref: /aoo42x/main/starmath/inc/edit.hxx (revision a050e4e7)
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     void        UpdateStatus( bool bSetDocModified = false );
97 
98 public:
99     SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin );
100 	~SmEditWindow();
101 
102     SmDocShell *    GetDoc();
103     SmViewShell *   GetView();
GetEditView()104     EditView *      GetEditView()   { return pEditView; }
105     EditEngine *    GetEditEngine();
106     SfxItemPool *   GetEditEngineItemPool();
107 
108 	// Window
109 	virtual void		SetText(const XubString &rText);
110     virtual String      GetText() const;
111 	virtual void		GetFocus();
112 	virtual void		LoseFocus();
113 
114 	ESelection			GetSelection() const;
115 	void				SetSelection(const ESelection &rSel);
116 
117 	sal_Bool 				IsEmpty() const;
118 	sal_Bool 				IsSelected() const;
119 	sal_Bool 				IsAllSelected() const;
120 	void 				Cut();
121 	void 				Copy();
122 	void 				Paste();
123 	void 				Delete();
124 	void 				SelectAll();
125 	void 				InsertText(const String &rText);
126 	void 				InsertCommand(sal_uInt16 nCommand);
127 	void 				MarkError(const Point &rPos);
128 	void 				SelNextMark();
129 	void 				SelPrevMark();
130 	sal_Bool 				HasMark(const String &rText) const;
131 
132 	void 				Flush();
133     void                DeleteEditView( SmViewShell &rView );
134 
135     void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
136 
137     sal_Bool                HandleWheelCommands( const CommandEvent &rCEvt );
138 
139     // for Accessibility
140     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
141 
142     using Window::GetAccessible;
GetAccessible()143     SmEditAccessible *   GetAccessible()  { return pAccessible; }
144 };
145 
146 
147 #endif
148 
149