xref: /trunk/main/starmath/inc/edit.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1f6a9d5caSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f6a9d5caSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6a9d5caSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6a9d5caSAndrew Rist  * distributed with this work for additional information
6f6a9d5caSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6a9d5caSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6a9d5caSAndrew Rist  * "License"); you may not use this file except in compliance
9f6a9d5caSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11f6a9d5caSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13f6a9d5caSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6a9d5caSAndrew Rist  * software distributed under the License is distributed on an
15f6a9d5caSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6a9d5caSAndrew Rist  * KIND, either express or implied.  See the License for the
17f6a9d5caSAndrew Rist  * specific language governing permissions and limitations
18f6a9d5caSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20f6a9d5caSAndrew Rist  *************************************************************/
21f6a9d5caSAndrew Rist 
22f6a9d5caSAndrew Rist 
23cdf0e10cSrcweir #ifndef EDIT_HXX
24cdf0e10cSrcweir #define EDIT_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <vcl/window.hxx>
27cdf0e10cSrcweir #include <vcl/timer.hxx>
28cdf0e10cSrcweir #include <svtools/transfer.hxx>
29cdf0e10cSrcweir #include <editeng/editdata.hxx>
30cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //#ifndef _ACCESSIBILITY_HXX_
33cdf0e10cSrcweir //#include "accessibility.hxx"
34cdf0e10cSrcweir //#endif
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class SmDocShell;
37cdf0e10cSrcweir class SmViewShell;
38cdf0e10cSrcweir class EditView;
39cdf0e10cSrcweir class EditEngine;
40cdf0e10cSrcweir class EditStatus;
41cdf0e10cSrcweir class ScrollBar;
42cdf0e10cSrcweir class ScrollBarBox;
43cdf0e10cSrcweir class DataChangedEvent;
44cdf0e10cSrcweir class Menu;
45cdf0e10cSrcweir class SmCmdBoxWindow;
46cdf0e10cSrcweir class SmEditAccessible;
47cdf0e10cSrcweir class CommandEvent;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir /**************************************************************************/
50cdf0e10cSrcweir 
51cdf0e10cSrcweir     void SmGetLeftSelectionPart(const ESelection aSelection,
52cdf0e10cSrcweir                                 sal_uInt16 &nPara, sal_uInt16 &nPos);
53cdf0e10cSrcweir 
54cdf0e10cSrcweir /**************************************************************************/
55cdf0e10cSrcweir 
56cdf0e10cSrcweir class SmEditWindow : public Window, public DropTargetHelper
57cdf0e10cSrcweir {
58cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
59cdf0e10cSrcweir         ::com::sun::star::accessibility::XAccessible >  xAccessible;
60cdf0e10cSrcweir     SmEditAccessible *                                          pAccessible;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     SmCmdBoxWindow &rCmdBox;
63cdf0e10cSrcweir     EditView       *pEditView;
64cdf0e10cSrcweir     ScrollBar      *pHScrollBar,
65cdf0e10cSrcweir                    *pVScrollBar;
66cdf0e10cSrcweir     ScrollBarBox   *pScrollBox;
67cdf0e10cSrcweir     Timer           aModifyTimer,
68cdf0e10cSrcweir                     aCursorMoveTimer;
69cdf0e10cSrcweir     ESelection      aOldSelection;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     virtual void KeyInput(const KeyEvent& rKEvt);
72cdf0e10cSrcweir     virtual void Command(const CommandEvent& rCEvt);
73cdf0e10cSrcweir     DECL_LINK(MenuSelectHdl, Menu *);
74cdf0e10cSrcweir     DECL_LINK(ModifyTimerHdl, Timer *);
75cdf0e10cSrcweir     DECL_LINK(CursorMoveTimerHdl, Timer *);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     virtual void DataChanged( const DataChangedEvent& );
78cdf0e10cSrcweir     virtual void Resize();
79cdf0e10cSrcweir     virtual void MouseMove(const MouseEvent &rEvt);
80cdf0e10cSrcweir     virtual void MouseButtonUp(const MouseEvent &rEvt);
81cdf0e10cSrcweir     virtual void MouseButtonDown(const MouseEvent &rEvt);
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
84cdf0e10cSrcweir     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
85cdf0e10cSrcweir     virtual void Paint(const Rectangle& rRect);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     DECL_LINK(EditStatusHdl ,EditStatus *);
88cdf0e10cSrcweir     DECL_LINK(ScrollHdl, ScrollBar *);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     void        CreateEditView();
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     Rectangle   AdjustScrollBars();
93cdf0e10cSrcweir     void        SetScrollBarRanges();
94cdf0e10cSrcweir     void        InitScrollBars();
95cdf0e10cSrcweir     void        InvalidateSlots();
96*a050e4e7SAriel Constenla-Haile     void        UpdateStatus( bool bSetDocModified = false );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir public:
99cdf0e10cSrcweir     SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin );
100cdf0e10cSrcweir     ~SmEditWindow();
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     SmDocShell *    GetDoc();
103cdf0e10cSrcweir     SmViewShell *   GetView();
GetEditView()104cdf0e10cSrcweir     EditView *      GetEditView()   { return pEditView; }
105cdf0e10cSrcweir     EditEngine *    GetEditEngine();
106cdf0e10cSrcweir     SfxItemPool *   GetEditEngineItemPool();
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     // Window
109cdf0e10cSrcweir     virtual void        SetText(const XubString &rText);
110cdf0e10cSrcweir     virtual String      GetText() const;
111cdf0e10cSrcweir     virtual void        GetFocus();
112cdf0e10cSrcweir     virtual void        LoseFocus();
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     ESelection          GetSelection() const;
115cdf0e10cSrcweir     void                SetSelection(const ESelection &rSel);
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     sal_Bool                IsEmpty() const;
118cdf0e10cSrcweir     sal_Bool                IsSelected() const;
119cdf0e10cSrcweir     sal_Bool                IsAllSelected() const;
120cdf0e10cSrcweir     void                Cut();
121cdf0e10cSrcweir     void                Copy();
122cdf0e10cSrcweir     void                Paste();
123cdf0e10cSrcweir     void                Delete();
124cdf0e10cSrcweir     void                SelectAll();
125cdf0e10cSrcweir     void                InsertText(const String &rText);
126cdf0e10cSrcweir     void                InsertCommand(sal_uInt16 nCommand);
127cdf0e10cSrcweir     void                MarkError(const Point &rPos);
128cdf0e10cSrcweir     void                SelNextMark();
129cdf0e10cSrcweir     void                SelPrevMark();
130cdf0e10cSrcweir     sal_Bool                HasMark(const String &rText) const;
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     void                Flush();
133cdf0e10cSrcweir     void                DeleteEditView( SmViewShell &rView );
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     sal_Bool                HandleWheelCommands( const CommandEvent &rCEvt );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     // for Accessibility
140cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     using Window::GetAccessible;
GetAccessible()143cdf0e10cSrcweir     SmEditAccessible *   GetAccessible()  { return pAccessible; }
144cdf0e10cSrcweir };
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 
147cdf0e10cSrcweir #endif
148