/src/libreoffice/starmath/inc/edit.hxx
Line | Count | Source |
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 | | |
20 | | #pragma once |
21 | | |
22 | | #include <svx/weldeditview.hxx> |
23 | | #include <vcl/idle.hxx> |
24 | | #include <vcl/weld/ScrolledWindow.hxx> |
25 | | #include <vcl/weld/Window.hxx> |
26 | | |
27 | | class SmDocShell; |
28 | | class SmViewShell; |
29 | | class EditView; |
30 | | class EditEngine; |
31 | | class EditStatus; |
32 | | class SmCmdBoxWindow; |
33 | | class Timer; |
34 | | |
35 | | void SmGetLeftSelectionPart(const ESelection& rSelection, sal_Int32& nPara, sal_uInt16& nPos); |
36 | | |
37 | | class SmEditWindow; |
38 | | |
39 | | class SmEditTextWindow : public WeldEditView |
40 | | { |
41 | | private: |
42 | | SmEditWindow& mrEditWindow; |
43 | | |
44 | | Idle aModifyIdle; |
45 | | Idle aCursorMoveIdle; |
46 | | |
47 | | ESelection aOldSelection; |
48 | | |
49 | | DECL_LINK(ModifyTimerHdl, Timer*, void); |
50 | | DECL_LINK(CursorMoveTimerHdl, Timer*, void); |
51 | | DECL_LINK(EditStatusHdl, EditStatus&, void); |
52 | | |
53 | | public: |
54 | | SmEditTextWindow(SmEditWindow& rEditWindow); |
55 | | virtual ~SmEditTextWindow() override; |
56 | | |
57 | | virtual EditEngine* GetEditEngine() const override; |
58 | | |
59 | | virtual void EditViewScrollStateChange() override; |
60 | | |
61 | | virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; |
62 | | |
63 | | virtual bool KeyInput(const KeyEvent& rKeyEvt) override; |
64 | | virtual bool MouseButtonUp(const MouseEvent& rEvt) override; |
65 | | virtual bool Command(const CommandEvent& rCEvt) override; |
66 | | virtual void GetFocus() override; |
67 | | virtual void LoseFocus() override; |
68 | | virtual void StyleUpdated() override; |
69 | | |
70 | | void SetText(const OUString& rText); |
71 | | void InsertText(const OUString& rText); |
72 | | void SelNextMark(); |
73 | | ESelection GetSelection() const; |
74 | | void UserPossiblyChangedText(); |
75 | | void Flush(); |
76 | | void UpdateStatus(bool bSetDocModified); |
77 | | void StartCursorMove(); |
78 | | }; |
79 | | |
80 | | class SmEditWindow final |
81 | | { |
82 | | SmCmdBoxWindow& rCmdBox; |
83 | | std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow; |
84 | | std::unique_ptr<SmEditTextWindow> mxTextControl; |
85 | | std::unique_ptr<weld::CustomWeld> mxTextControlWin; |
86 | | |
87 | | DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void); |
88 | | |
89 | | void CreateEditView(weld::Builder& rBuilder); |
90 | | |
91 | | void ImplDestroy(); |
92 | | |
93 | | public: |
94 | | SmEditWindow(SmCmdBoxWindow& rMyCmdBoxWin, weld::Builder& rBuilder); |
95 | | ~SmEditWindow(); |
96 | | |
97 | | weld::Window* GetFrameWeld() const; |
98 | | |
99 | | SmDocShell* GetDoc(); |
100 | | SmViewShell* GetView(); |
101 | | EditView* GetEditView() const; |
102 | | EditEngine* GetEditEngine(); |
103 | 0 | SmCmdBoxWindow& GetCmdBox() const { return rCmdBox; } |
104 | | |
105 | | void SetText(const OUString& rText); |
106 | | OUString GetText() const; |
107 | | void Flush(); |
108 | | void GrabFocus(); |
109 | | |
110 | | css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const |
111 | 0 | { |
112 | 0 | return mxTextControl->GetClipboard(); |
113 | 0 | } |
114 | | |
115 | | ESelection GetSelection() const; |
116 | | void SetSelection(const ESelection& rSel); |
117 | | void UpdateStatus(); |
118 | | |
119 | | bool IsEmpty() const; |
120 | | bool IsSelected() const; |
121 | | bool IsAllSelected() const; |
122 | | void SetScrollBarRanges(); |
123 | | tools::Rectangle AdjustScrollBars(); |
124 | | void InvalidateSlots(); |
125 | | void Cut(); |
126 | | void Copy(); |
127 | | void Paste(); |
128 | | void Delete(); |
129 | | void SelectAll(); |
130 | | void InsertText(const OUString& rText); |
131 | | void MarkError(const Point& rPos); |
132 | | void SelNextMark(); |
133 | | void SelPrevMark(); |
134 | | |
135 | | void DeleteEditView(); |
136 | | }; |
137 | | |
138 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |