build fix
[LibreOffice.git] / starmath / inc / edit.hxx
blob450c310ad8b3af585243cfbe82c759f4f963d634
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/timer.hxx>
24 #include <vcl/idle.hxx>
25 #include <svtools/transfer.hxx>
26 #include <editeng/editdata.hxx>
27 #include <svtools/colorcfg.hxx>
28 #include <memory>
30 class SmDocShell;
31 class SmViewShell;
32 class EditView;
33 class EditEngine;
34 class EditStatus;
35 class ScrollBar;
36 class ScrollBarBox;
37 class DataChangedEvent;
38 class Menu;
39 class SmCmdBoxWindow;
40 class SmEditAccessible;
41 class CommandEvent;
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(MenuSelectHdl, Menu *, bool);
62 DECL_LINK(ModifyTimerHdl, Idle *, void);
63 DECL_LINK(CursorMoveTimerHdl, Idle *, void);
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 Rectangle& rRect) override;
75 DECL_LINK(EditStatusHdl, EditStatus&, void);
76 DECL_LINK(ScrollHdl, ScrollBar*, void);
78 void CreateEditView();
79 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();
94 SfxItemPool* GetEditEngineItemPool();
96 // Window
97 virtual void SetText(const OUString& rText) override;
98 virtual OUString GetText() const override;
99 virtual void GetFocus() override;
100 virtual void LoseFocus() override;
102 ESelection GetSelection() const;
103 void SetSelection(const ESelection& rSel);
105 bool IsEmpty() const;
106 bool IsSelected() const;
107 bool IsAllSelected() const;
108 void Cut();
109 void Copy();
110 void Paste();
111 void Delete();
112 void SelectAll();
113 void InsertText(const OUString& rText);
114 void InsertCommand(sal_uInt16 nCommand);
115 void MarkError(const Point &rPos);
116 void SelNextMark();
117 void SelPrevMark();
118 static bool HasMark(const OUString &rText);
120 void Flush();
121 void DeleteEditView(SmViewShell& rView);
123 void ApplyColorConfigValues(const svtools::ColorConfig& rColorCfg);
125 bool HandleWheelCommands(const CommandEvent& rCEvt);
126 bool IsInlineEditEnabled();
127 void StartCursorMove();
129 // for Accessibility
130 virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
132 using Window::GetAccessible;
136 #endif
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */