1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_STARMATH_INC_EDIT_HXX
20 #define INCLUDED_STARMATH_INC_EDIT_HXX
22 #include <vcl/window.hxx>
23 #include <vcl/idle.hxx>
24 #include <vcl/transfer.hxx>
25 #include <editeng/editdata.hxx>
35 class DataChangedEvent
;
37 class SmEditAccessible
;
46 void SmGetLeftSelectionPart(const ESelection
& rSelection
, sal_Int32
& nPara
, sal_uInt16
& nPos
);
48 class SmEditWindow final
: public vcl::Window
, public DropTargetHelper
50 rtl::Reference
<SmEditAccessible
> mxAccessible
;
52 SmCmdBoxWindow
& rCmdBox
;
53 std::unique_ptr
<EditView
> pEditView
;
54 VclPtr
<ScrollBar
> pHScrollBar
;
55 VclPtr
<ScrollBar
> pVScrollBar
;
56 VclPtr
<ScrollBarBox
> pScrollBox
;
59 ESelection aOldSelection
;
61 virtual void KeyInput(const KeyEvent
& rKEvt
) override
;
62 virtual void Command(const CommandEvent
& rCEvt
) override
;
64 DECL_LINK(ModifyTimerHdl
, Timer
*, void);
65 DECL_LINK(CursorMoveTimerHdl
, Timer
*, void);
67 virtual void ApplySettings(vcl::RenderContext
&) override
;
68 virtual void DataChanged(const DataChangedEvent
&) override
;
69 virtual void Resize() override
;
70 virtual void MouseMove(const MouseEvent
& rEvt
) override
;
71 virtual void MouseButtonUp(const MouseEvent
& rEvt
) override
;
72 virtual void MouseButtonDown(const MouseEvent
& rEvt
) override
;
74 virtual OUString
GetSurroundingText() const override
;
75 virtual Selection
GetSurroundingTextSelection() const override
;
76 virtual bool DeleteSurroundingText(const Selection
& rSelection
) override
;
78 virtual sal_Int8
AcceptDrop(const AcceptDropEvent
& rEvt
) override
;
79 virtual sal_Int8
ExecuteDrop(const ExecuteDropEvent
& rEvt
) override
;
80 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
82 DECL_LINK(EditStatusHdl
, EditStatus
&, void);
83 DECL_LINK(ScrollHdl
, ScrollBar
*, void);
85 void CreateEditView();
86 tools::Rectangle
AdjustScrollBars();
87 void SetScrollBarRanges();
88 void InitScrollBars();
89 void InvalidateSlots();
90 void UpdateStatus(bool bSetDocModified
);
91 void UserPossiblyChangedText();
94 explicit SmEditWindow(SmCmdBoxWindow
& rMyCmdBoxWin
);
95 virtual ~SmEditWindow() override
;
96 virtual void dispose() override
;
99 SmViewShell
* GetView();
100 EditView
* GetEditView();
101 EditEngine
* GetEditEngine();
104 virtual void SetText(const OUString
& rText
) override
;
105 virtual OUString
GetText() const override
;
106 virtual void GetFocus() override
;
107 virtual void LoseFocus() override
;
109 ESelection
GetSelection() const;
110 void SetSelection(const ESelection
& rSel
);
112 bool IsEmpty() const;
113 bool IsSelected() const;
114 bool IsAllSelected() const;
120 void InsertText(const OUString
& rText
);
121 void MarkError(const Point
& rPos
);
124 static bool HasMark(const OUString
& rText
);
126 void Flush() override
;
127 void DeleteEditView();
129 bool HandleWheelCommands(const CommandEvent
& rCEvt
);
130 static bool IsInlineEditEnabled();
131 void StartCursorMove();
134 virtual css::uno::Reference
<css::accessibility::XAccessible
> CreateAccessible() override
;
136 using Window::GetAccessible
;
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */