Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_STARMATH_INC_EDIT_HXX
20 : #define INCLUDED_STARMATH_INC_EDIT_HXX
21 :
22 : #include <vcl/window.hxx>
23 : #include <vcl/timer.hxx>
24 : #include <svtools/transfer.hxx>
25 : #include <editeng/editdata.hxx>
26 : #include <svtools/colorcfg.hxx>
27 :
28 : class SmDocShell;
29 : class SmViewShell;
30 : class EditView;
31 : class EditEngine;
32 : class EditStatus;
33 : class ScrollBar;
34 : class ScrollBarBox;
35 : class DataChangedEvent;
36 : class Menu;
37 : class SmCmdBoxWindow;
38 : class SmEditAccessible;
39 : class CommandEvent;
40 :
41 : /**************************************************************************/
42 :
43 : void SmGetLeftSelectionPart(const ESelection &rSelection,
44 : sal_Int32 &nPara, sal_uInt16 &nPos);
45 :
46 : /**************************************************************************/
47 :
48 : class SmEditWindow : public vcl::Window, public DropTargetHelper
49 : {
50 : ::com::sun::star::uno::Reference<
51 : ::com::sun::star::accessibility::XAccessible > xAccessible;
52 : SmEditAccessible * pAccessible;
53 :
54 : SmCmdBoxWindow &rCmdBox;
55 : EditView *pEditView;
56 : ScrollBar *pHScrollBar,
57 : *pVScrollBar;
58 : ScrollBarBox *pScrollBox;
59 : Timer aModifyTimer,
60 : aCursorMoveTimer;
61 : ESelection aOldSelection;
62 :
63 : virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE;
64 : virtual void Command(const CommandEvent& rCEvt) SAL_OVERRIDE;
65 : DECL_LINK(MenuSelectHdl, Menu *);
66 : DECL_LINK(ModifyTimerHdl, Timer *);
67 : DECL_LINK(CursorMoveTimerHdl, Timer *);
68 :
69 : virtual void DataChanged( const DataChangedEvent& ) SAL_OVERRIDE;
70 : virtual void Resize() SAL_OVERRIDE;
71 : virtual void MouseMove(const MouseEvent &rEvt) SAL_OVERRIDE;
72 : virtual void MouseButtonUp(const MouseEvent &rEvt) SAL_OVERRIDE;
73 : virtual void MouseButtonDown(const MouseEvent &rEvt) SAL_OVERRIDE;
74 :
75 : virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
76 : virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
77 : virtual void Paint(const Rectangle& rRect) SAL_OVERRIDE;
78 :
79 : DECL_LINK(EditStatusHdl ,EditStatus *);
80 : DECL_LINK(ScrollHdl, ScrollBar *);
81 :
82 : void CreateEditView();
83 :
84 : Rectangle AdjustScrollBars();
85 : void SetScrollBarRanges();
86 : void InitScrollBars();
87 : void InvalidateSlots();
88 : void UpdateStatus( bool bSetDocModified = false );
89 :
90 : public:
91 : SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin );
92 : virtual ~SmEditWindow();
93 :
94 : SmDocShell * GetDoc();
95 : SmViewShell * GetView();
96 64 : EditView * GetEditView() { return pEditView; }
97 : EditEngine * GetEditEngine();
98 : SfxItemPool * GetEditEngineItemPool();
99 :
100 : // Window
101 : virtual void SetText(const OUString &rText) SAL_OVERRIDE;
102 : virtual OUString GetText() const SAL_OVERRIDE;
103 : virtual void GetFocus() SAL_OVERRIDE;
104 : virtual void LoseFocus() SAL_OVERRIDE;
105 :
106 : ESelection GetSelection() const;
107 : void SetSelection(const ESelection &rSel);
108 :
109 : bool IsEmpty() const;
110 : bool IsSelected() const;
111 : bool IsAllSelected() const;
112 : void Cut();
113 : void Copy();
114 : void Paste();
115 : void Delete();
116 : void SelectAll();
117 : void InsertText(const OUString &rText);
118 : void InsertCommand(sal_uInt16 nCommand);
119 : void MarkError(const Point &rPos);
120 : void SelNextMark();
121 : void SelPrevMark();
122 : bool HasMark(const OUString &rText) const;
123 :
124 : void Flush();
125 : void DeleteEditView( SmViewShell &rView );
126 :
127 : void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
128 :
129 : bool HandleWheelCommands( const CommandEvent &rCEvt );
130 : bool IsInlineEditEnabled();
131 : void StartCursorMove();
132 :
133 : // for Accessibility
134 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
135 :
136 : using Window::GetAccessible;
137 : SmEditAccessible * GetAccessible() { return pAccessible; }
138 : };
139 :
140 :
141 : #endif
142 :
143 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|