Branch libreoffice-6-3
[LibreOffice.git] / starmath / inc / edit.hxx
blob45d130b0c6580a80b9350477bdc729c028854fa7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
26 #include <memory>
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 SmCmdBoxWindow;
37 class SmEditAccessible;
38 class CommandEvent;
39 class Timer;
41 namespace svtools { class ColorConfig; }
43 void SmGetLeftSelectionPart(const ESelection &rSelection, sal_Int32 &nPara, sal_uInt16 &nPos);
45 class SmEditWindow : public vcl::Window, public DropTargetHelper
47 rtl::Reference<SmEditAccessible> mxAccessible;
49 SmCmdBoxWindow& rCmdBox;
50 std::unique_ptr<EditView> pEditView;
51 VclPtr<ScrollBar> pHScrollBar;
52 VclPtr<ScrollBar> pVScrollBar;
53 VclPtr<ScrollBarBox> pScrollBox;
54 Idle aModifyIdle;
55 Idle aCursorMoveIdle;
56 ESelection aOldSelection;
58 virtual void KeyInput(const KeyEvent& rKEvt) override;
59 virtual void Command(const CommandEvent& rCEvt) override;
61 DECL_LINK(ModifyTimerHdl, Timer *, void);
62 DECL_LINK(CursorMoveTimerHdl, Timer *, void);
64 virtual void ApplySettings(vcl::RenderContext&) override;
65 virtual void DataChanged( const DataChangedEvent& ) override;
66 virtual void Resize() override;
67 virtual void MouseMove(const MouseEvent &rEvt) override;
68 virtual void MouseButtonUp(const MouseEvent &rEvt) override;
69 virtual void MouseButtonDown(const MouseEvent &rEvt) override;
71 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
72 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
73 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
75 DECL_LINK(EditStatusHdl, EditStatus&, void);
76 DECL_LINK(ScrollHdl, ScrollBar*, void);
78 void CreateEditView();
79 tools::Rectangle AdjustScrollBars();
80 void SetScrollBarRanges();
81 void InitScrollBars();
82 void InvalidateSlots();
83 void UpdateStatus(bool bSetDocModified);
85 public:
86 explicit SmEditWindow(SmCmdBoxWindow& rMyCmdBoxWin);
87 virtual ~SmEditWindow() override;
88 virtual void dispose() override;
90 SmDocShell* GetDoc();
91 SmViewShell* GetView();
92 EditView* GetEditView();
93 EditEngine* GetEditEngine();
95 // Window
96 virtual void SetText(const OUString& rText) override;
97 virtual OUString GetText() const override;
98 virtual void GetFocus() override;
99 virtual void LoseFocus() override;
101 ESelection GetSelection() const;
102 void SetSelection(const ESelection& rSel);
104 bool IsEmpty() const;
105 bool IsSelected() const;
106 bool IsAllSelected() const;
107 void Cut();
108 void Copy();
109 void Paste();
110 void Delete();
111 void SelectAll();
112 void InsertText(const OUString& rText);
113 void MarkError(const Point &rPos);
114 void SelNextMark();
115 void SelPrevMark();
116 static bool HasMark(const OUString &rText);
118 void Flush();
119 void DeleteEditView();
121 bool HandleWheelCommands(const CommandEvent& rCEvt);
122 bool IsInlineEditEnabled();
123 void StartCursorMove();
125 // for Accessibility
126 virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
128 using Window::GetAccessible;
132 #endif
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */