LibreOffice Module vcl (master) 1
vclmedit.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
23#error "don't use this in new code"
24#endif
25
26#include <tools/lineend.hxx>
27#include <vcl/wintypes.hxx>
28#include <vcl/toolkit/edit.hxx>
29#include <vcl/dllapi.h>
30#include <vcl/timer.hxx>
31#include <memory>
32
33class ImpVclMEdit;
34class ExtTextEngine;
35class TextView;
36
37class TextWindow final : public vcl::Window
38{
39private:
41 std::unique_ptr<ExtTextEngine> mpExtTextEngine;
42 std::unique_ptr<TextView> mpExtTextView;
43
49
50public:
51 explicit TextWindow(Edit* pParent);
52 virtual ~TextWindow() override;
53 virtual void dispose() override;
54
55 ExtTextEngine* GetTextEngine() const { return mpExtTextEngine.get(); }
56 TextView* GetTextView() const { return mpExtTextView.get(); }
57
58 virtual void MouseMove( const MouseEvent& rMEvt ) override;
59 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
60 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
61 virtual void KeyInput( const KeyEvent& rKEvent ) override;
62
63 virtual void Command( const CommandEvent& rCEvt ) override;
64
65 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
66 virtual void Resize() override;
67
68 virtual void GetFocus() override;
69 virtual void LoseFocus() override;
70
71 void SetAutoFocusHide( bool bAutoHide ) { mbFocusSelectionHide = bAutoHide; }
72
73 void SetIgnoreTab( bool bIgnore ) { mbIgnoreTab = bIgnore; }
74
76};
77
79{
80 friend class VCLXAccessibleEdit;
81
82private:
83 std::unique_ptr<ImpVclMEdit> pImpVclMEdit;
84
86
87protected:
88
89 void StateChanged( StateChangedType nType ) override;
90 void DataChanged( const DataChangedEvent& rDCEvt ) override;
91 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
92 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
94 void ImplInitSettings( bool bBackground );
95 static WinBits ImplInitStyle( WinBits nStyle );
96
97 TextView* GetTextView() const;
98 ExtTextEngine* GetTextEngine() const;
99
100 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
101public:
103 WinBits nWinStyle );
104 virtual ~VclMultiLineEdit() override;
105 virtual void dispose() override;
106
107 void SelectionChanged();
108 void CaretChanged();
109 virtual void Modify() override;
110
111 virtual void SetModifyFlag() override;
112
113 virtual void SetReadOnly( bool bReadOnly = true ) override;
114 virtual bool IsReadOnly() const override;
115
116 void EnableFocusSelectionHide( bool bHide );
117
118 virtual void SetMaxTextLen(sal_Int32 nMaxLen) override;
119 virtual sal_Int32 GetMaxTextLen() const override;
120
121 void SetMaxTextWidth(tools::Long nMaxWidth);
122
123 virtual void SetSelection( const Selection& rSelection ) override;
124 virtual const Selection& GetSelection() const override;
125
126 virtual void ReplaceSelected( const OUString& rStr ) override;
127 virtual void DeleteSelected() override;
128 virtual OUString GetSelected() const override;
129 OUString GetSelected( LineEnd aSeparator ) const;
130
131 bool CanUp() const;
132 bool CanDown() const;
133
134 virtual void Cut() override;
135 virtual void Copy() override;
136 virtual void Paste() override;
137
138 virtual void SetText( const OUString& rStr ) override;
139 virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) override
140 { SetText( rStr ); SetSelection( rNewSelection ); }
141 OUString GetText() const override;
142 OUString GetText( LineEnd aSeparator ) const;
143 OUString GetTextLines( LineEnd aSeparator ) const;
144
145 void SetModifyHdl( const Link<Edit&,void>& rLink ) override { aModifyHdlLink = rLink; }
146 const Link<Edit&,void>& GetModifyHdl() const override { return aModifyHdlLink; }
147
148 virtual void Resize() override;
149 virtual void GetFocus() override;
150
151 virtual Size CalcMinimumSize() const override;
152 Size CalcAdjustedSize( const Size& rPrefSize ) const;
153 Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
154 void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
155
156 void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
157
158 void DisableSelectionOnFocus();
159
160 void EnableCursor( bool bEnable );
161
162 ScrollBar& GetVScrollBar() const;
163
164 TextWindow* GetTextWindow();
165
166 virtual FactoryFunction GetUITestFactory() const override;
167
168 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
169
170 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
171};
172
173/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SystemTextColorFlags
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: ctrl.cxx:225
void ImplInitSettings()
Definition: ctrl.cxx:423
Definition: edit.hxx:56
virtual void Modify()
Definition: edit.cxx:2316
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: edit.cxx:183
virtual void ReplaceSelected(const OUString &rStr)
Definition: edit.cxx:2478
virtual void Copy()
Definition: edit.cxx:2518
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: edit.cxx:225
virtual void SetText(const OUString &rStr) override
Definition: edit.cxx:2547
virtual sal_Int32 GetMaxTextLen() const
Definition: edit.hxx:181
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: edit.cxx:2237
virtual const Selection & GetSelection() const
Definition: edit.cxx:2470
virtual void DeleteSelected()
Definition: edit.cxx:2486
virtual void Cut()
Definition: edit.cxx:2509
static SAL_DLLPRIVATE WinBits ImplInitStyle(WinBits nStyle)
Definition: edit.cxx:345
virtual void SetMaxTextLen(sal_Int32 nMaxLen)
Definition: edit.cxx:2383
virtual void GetFocus() override
Definition: edit.cxx:1850
virtual Size CalcMinimumSize() const
Definition: edit.cxx:2659
virtual void DumpAsPropertyTree(tools::JsonWriter &rJsonWriter) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
Definition: edit.cxx:2920
virtual void SetSelection(const Selection &rSelection)
Definition: edit.cxx:2396
virtual void SetReadOnly(bool bReadOnly=true)
Definition: edit.cxx:2351
virtual OUString GetSelected() const
Definition: edit.cxx:2497
virtual bool IsReadOnly() const
Definition: edit.hxx:175
virtual void SetModifyFlag()
Definition: edit.cxx:2590
virtual FactoryFunction GetUITestFactory() const override
Definition: edit.cxx:2914
virtual void Draw(OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags) override
Definition: edit.cxx:1743
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: edit.cxx:365
virtual void Resize() override
Definition: edit.cxx:1730
virtual void Paste()
Definition: edit.cxx:2527
void ImplInitSettings()
Definition: ctrl.cxx:423
virtual void StateChanged(StateChangedType nType) override
Definition: edit.cxx:2156
virtual OUString GetText() const override
Definition: edit.cxx:2566
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
bool mbSelectOnTab
Definition: vclmedit.hxx:48
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: vclmedit.cxx:671
virtual void LoseFocus() override
Definition: vclmedit.cxx:867
TextView * GetTextView() const
Definition: vclmedit.hxx:56
void DisableSelectionOnFocus()
Definition: vclmedit.hxx:75
std::unique_ptr< TextView > mpExtTextView
Definition: vclmedit.hxx:42
std::unique_ptr< ExtTextEngine > mpExtTextEngine
Definition: vclmedit.hxx:41
void SetIgnoreTab(bool bIgnore)
Definition: vclmedit.hxx:73
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: vclmedit.cxx:739
bool mbInMBDown
Definition: vclmedit.hxx:44
bool mbIgnoreTab
Definition: vclmedit.hxx:46
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: vclmedit.cxx:685
ExtTextEngine * GetTextEngine() const
Definition: vclmedit.hxx:55
virtual void KeyInput(const KeyEvent &rKEvent) override
Definition: vclmedit.cxx:698
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: vclmedit.cxx:693
virtual void Resize() override
Definition: vclmedit.cxx:744
void SetAutoFocusHide(bool bAutoHide)
Definition: vclmedit.hxx:71
bool mbFocusSelectionHide
Definition: vclmedit.hxx:45
bool mbActivePopup
Definition: vclmedit.hxx:47
VclPtr< Edit > mxParent
Definition: vclmedit.hxx:40
virtual ~TextWindow() override
Definition: vclmedit.cxx:666
virtual void GetFocus() override
Definition: vclmedit.cxx:847
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: vclmedit.cxx:679
virtual void Command(const CommandEvent &rCEvt) override
Definition: vclmedit.cxx:748
TextWindow(Edit *pParent)
Definition: vclmedit.cxx:639
void SetModifyHdl(const Link< Edit &, void > &rLink) override
Definition: vclmedit.hxx:145
Link< Edit &, void > aModifyHdlLink
Definition: vclmedit.hxx:85
virtual void SetText(const OUString &rStr, const Selection &rNewSelection) override
Definition: vclmedit.hxx:139
std::unique_ptr< ImpVclMEdit > pImpVclMEdit
Definition: vclmedit.hxx:83
const Link< Edit &, void > & GetModifyHdl() const override
Definition: vclmedit.hxx:146
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:52
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
LineEnd
long Long
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109