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 EDIT_HXX
20 : #define 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_uInt16 &nPara, sal_uInt16 &nPos);
45 :
46 : /**************************************************************************/
47 :
48 : class SmEditWindow : public 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);
64 : virtual void Command(const CommandEvent& rCEvt);
65 : DECL_LINK(MenuSelectHdl, Menu *);
66 : DECL_LINK(ModifyTimerHdl, Timer *);
67 : DECL_LINK(CursorMoveTimerHdl, Timer *);
68 :
69 : virtual void DataChanged( const DataChangedEvent& );
70 : virtual void Resize();
71 : virtual void MouseMove(const MouseEvent &rEvt);
72 : virtual void MouseButtonUp(const MouseEvent &rEvt);
73 : virtual void MouseButtonDown(const MouseEvent &rEvt);
74 :
75 : virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
76 : virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
77 : virtual void Paint(const Rectangle& rRect);
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 :
89 : public:
90 : SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin );
91 : ~SmEditWindow();
92 :
93 : SmDocShell * GetDoc();
94 : SmViewShell * GetView();
95 0 : EditView * GetEditView() { return pEditView; }
96 : EditEngine * GetEditEngine();
97 : SfxItemPool * GetEditEngineItemPool();
98 :
99 : // Window
100 : virtual void SetText(const XubString &rText);
101 : virtual String GetText() const;
102 : virtual void GetFocus();
103 : virtual void LoseFocus();
104 :
105 : ESelection GetSelection() const;
106 : void SetSelection(const ESelection &rSel);
107 :
108 : bool IsEmpty() const;
109 : bool IsSelected() const;
110 : bool IsAllSelected() const;
111 : void Cut();
112 : void Copy();
113 : void Paste();
114 : void Delete();
115 : void SelectAll();
116 : void InsertText(const OUString &rText);
117 : void InsertCommand(sal_uInt16 nCommand);
118 : void MarkError(const Point &rPos);
119 : void SelNextMark();
120 : void SelPrevMark();
121 : bool HasMark(const OUString &rText) const;
122 :
123 : void Flush();
124 : void DeleteEditView( SmViewShell &rView );
125 :
126 : void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
127 :
128 : bool HandleWheelCommands( const CommandEvent &rCEvt );
129 : bool IsInlineEditEnabled();
130 : void StartCursorMove();
131 :
132 : // for Accessibility
133 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
134 :
135 : using Window::GetAccessible;
136 : SmEditAccessible * GetAccessible() { return pAccessible; }
137 : };
138 :
139 :
140 : #endif
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|