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 .
22 #include <svx/weldeditview.hxx>
23 #include <vcl/idle.hxx>
30 class DataChangedEvent
;
35 void SmGetLeftSelectionPart(const ESelection
& rSelection
, sal_Int32
& nPara
, sal_uInt16
& nPos
);
39 class SmEditTextWindow
: public WeldEditView
42 SmEditWindow
& mrEditWindow
;
47 ESelection aOldSelection
;
49 DECL_LINK(ModifyTimerHdl
, Timer
*, void);
50 DECL_LINK(CursorMoveTimerHdl
, Timer
*, void);
51 DECL_LINK(EditStatusHdl
, EditStatus
&, void);
54 SmEditTextWindow(SmEditWindow
& rEditWindow
);
55 virtual ~SmEditTextWindow() override
;
57 virtual EditEngine
* GetEditEngine() const override
;
59 virtual void EditViewScrollStateChange() override
;
61 virtual void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
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
;
70 void SetText(const OUString
& rText
);
71 void InsertText(const OUString
& rText
);
73 ESelection
GetSelection() const;
74 void UserPossiblyChangedText();
76 void UpdateStatus(bool bSetDocModified
);
77 void StartCursorMove();
80 class SmEditWindow final
82 SmCmdBoxWindow
& rCmdBox
;
83 std::unique_ptr
<weld::ScrolledWindow
> mxScrolledWindow
;
84 std::unique_ptr
<SmEditTextWindow
> mxTextControl
;
85 std::unique_ptr
<weld::CustomWeld
> mxTextControlWin
;
87 DECL_LINK(ScrollHdl
, weld::ScrolledWindow
&, void);
89 void CreateEditView(weld::Builder
& rBuilder
);
92 SmEditWindow(SmCmdBoxWindow
& rMyCmdBoxWin
, weld::Builder
& rBuilder
);
93 ~SmEditWindow() COVERITY_NOEXCEPT_FALSE
;
95 weld::Window
* GetFrameWeld() const;
98 SmViewShell
* GetView();
99 EditView
* GetEditView() const;
100 EditEngine
* GetEditEngine();
101 SmCmdBoxWindow
& GetCmdBox() const { return rCmdBox
; }
103 void SetText(const OUString
& rText
);
104 OUString
GetText() const;
108 css::uno::Reference
<css::datatransfer::clipboard::XClipboard
> GetClipboard() const
110 return mxTextControl
->GetClipboard();
113 ESelection
GetSelection() const;
114 void SetSelection(const ESelection
& rSel
);
117 bool IsEmpty() const;
118 bool IsSelected() const;
119 bool IsAllSelected() const;
120 void SetScrollBarRanges();
121 tools::Rectangle
AdjustScrollBars();
122 void InvalidateSlots();
128 void InsertText(const OUString
& rText
);
129 void MarkError(const Point
& rPos
);
133 void DeleteEditView();
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */