bump product version to 5.0.4.1
[LibreOffice.git] / starmath / inc / edit.hxx
blob485ca0c3119734f83a9b13719c8e598525e57c76
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 css::uno::Reference<css::accessibility::XAccessible> xAccessible;
48 SmEditAccessible* pAccessible;
50 SmCmdBoxWindow& rCmdBox;
51 std::unique_ptr<EditView> pEditView;
52 VclPtr<ScrollBar> pHScrollBar;
53 VclPtr<ScrollBar> pVScrollBar;
54 VclPtr<ScrollBarBox> pScrollBox;
55 Idle aModifyIdle;
56 Idle aCursorMoveIdle;
57 ESelection aOldSelection;
59 virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE;
60 virtual void Command(const CommandEvent& rCEvt) SAL_OVERRIDE;
62 DECL_LINK(MenuSelectHdl, Menu *);
63 DECL_LINK_TYPED(ModifyTimerHdl, Idle *, void);
64 DECL_LINK_TYPED(CursorMoveTimerHdl, Idle *, void);
66 virtual void DataChanged( const DataChangedEvent& ) SAL_OVERRIDE;
67 virtual void Resize() SAL_OVERRIDE;
68 virtual void MouseMove(const MouseEvent &rEvt) SAL_OVERRIDE;
69 virtual void MouseButtonUp(const MouseEvent &rEvt) SAL_OVERRIDE;
70 virtual void MouseButtonDown(const MouseEvent &rEvt) SAL_OVERRIDE;
72 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
73 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
74 virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
76 DECL_LINK(EditStatusHdl ,EditStatus *);
77 DECL_LINK(ScrollHdl, ScrollBar *);
79 void CreateEditView();
80 Rectangle AdjustScrollBars();
81 void SetScrollBarRanges();
82 void InitScrollBars();
83 void InvalidateSlots();
84 void UpdateStatus(bool bSetDocModified = false);
86 public:
87 SmEditWindow(SmCmdBoxWindow& rMyCmdBoxWin);
88 virtual ~SmEditWindow();
89 virtual void dispose() SAL_OVERRIDE;
91 SmDocShell* GetDoc();
92 SmViewShell* GetView();
93 EditView* GetEditView();
94 EditEngine* GetEditEngine();
95 SfxItemPool* GetEditEngineItemPool();
97 // Window
98 virtual void SetText(const OUString& rText) SAL_OVERRIDE;
99 virtual OUString GetText() const SAL_OVERRIDE;
100 virtual void GetFocus() SAL_OVERRIDE;
101 virtual void LoseFocus() SAL_OVERRIDE;
103 ESelection GetSelection() const;
104 void SetSelection(const ESelection& rSel);
106 bool IsEmpty() const;
107 bool IsSelected() const;
108 bool IsAllSelected() const;
109 void Cut();
110 void Copy();
111 void Paste();
112 void Delete();
113 void SelectAll();
114 void InsertText(const OUString& rText);
115 void InsertCommand(sal_uInt16 nCommand);
116 void MarkError(const Point &rPos);
117 void SelNextMark();
118 void SelPrevMark();
119 static bool HasMark(const OUString &rText);
121 void Flush();
122 void DeleteEditView(SmViewShell& rView);
124 void ApplyColorConfigValues(const svtools::ColorConfig& rColorCfg);
126 bool HandleWheelCommands(const CommandEvent& rCEvt);
127 bool IsInlineEditEnabled();
128 void StartCursorMove();
130 // for Accessibility
131 virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE;
133 using Window::GetAccessible;
134 SmEditAccessible* GetAccessible()
136 return pAccessible;
141 #endif
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */