Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / vcl / vclmedit.hxx
blobf792a4681abccb273126e60bc1e3798ca5686260
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 .
20 #ifndef INCLUDED_VCL_VCLMEDIT_HXX
21 #define INCLUDED_VCL_VCLMEDIT_HXX
23 #include <tools/lineend.hxx>
24 #include <tools/wintypes.hxx>
25 #include <vcl/edit.hxx>
26 #include <vcl/dllapi.h>
28 class ImpVclMEdit;
29 class Timer;
30 class ExtTextEngine;
31 class TextView;
33 class VCL_DLLPUBLIC VclMultiLineEdit : public Edit
35 friend class VCLXAccessibleEdit;
37 private:
38 ImpVclMEdit* pImpVclMEdit;
40 OUString aSaveValue;
41 Link<Edit&,void> aModifyHdlLink;
43 Timer* pUpdateDataTimer;
44 Link<Edit&,void> aUpdateDataHdlLink;
46 protected:
48 DECL_LINK( ImpUpdateDataHdl, Timer*, void );
49 void StateChanged( StateChangedType nType ) override;
50 void DataChanged( const DataChangedEvent& rDCEvt ) override;
51 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
52 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
53 using Control::ImplInitSettings;
54 void ImplInitSettings( bool bBackground );
55 static WinBits ImplInitStyle( WinBits nStyle );
57 ExtTextEngine* GetTextEngine() const;
58 TextView* GetTextView() const;
59 ScrollBar* GetVScrollBar() const;
61 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
62 public:
63 VclMultiLineEdit( vcl::Window* pParent,
64 WinBits nWinStyle );
65 virtual ~VclMultiLineEdit() override;
66 virtual void dispose() override;
68 void SelectionChanged();
69 void CaretChanged();
70 virtual void Modify() override;
71 virtual void UpdateData() override;
73 virtual void SetModifyFlag() override;
74 virtual void ClearModifyFlag() override;
75 virtual bool IsModified() const override;
77 virtual void EnableUpdateData( sal_uLong nTimeout = EDIT_UPDATEDATA_TIMEOUT ) override;
78 virtual void DisableUpdateData() override { delete pUpdateDataTimer; pUpdateDataTimer = nullptr; }
80 virtual void SetReadOnly( bool bReadOnly = true ) override;
81 virtual bool IsReadOnly() const override;
83 void EnableFocusSelectionHide( bool bHide );
85 virtual void SetMaxTextLen(sal_Int32 nMaxLen) override;
86 virtual sal_Int32 GetMaxTextLen() const override;
88 void SetMaxTextWidth( sal_uLong nMaxWidth );
90 virtual void SetSelection( const Selection& rSelection ) override;
91 virtual const Selection& GetSelection() const override;
93 virtual void ReplaceSelected( const OUString& rStr ) override;
94 virtual void DeleteSelected() override;
95 virtual OUString GetSelected() const override;
96 OUString GetSelected( LineEnd aSeparator ) const;
98 virtual void Cut() override;
99 virtual void Copy() override;
100 virtual void Paste() override;
102 virtual void SetText( const OUString& rStr ) override;
103 virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) override
104 { SetText( rStr ); SetSelection( rNewSelection ); }
105 OUString GetText() const override;
106 OUString GetText( LineEnd aSeparator ) const;
107 OUString GetTextLines( LineEnd aSeparator ) const;
109 void SetRightToLeft( bool bRightToLeft );
111 void SaveValue() { aSaveValue = GetText(); }
112 const OUString& GetSavedValue() const { return aSaveValue; }
114 void SetModifyHdl( const Link<Edit&,void>& rLink ) override { aModifyHdlLink = rLink; }
115 const Link<Edit&,void>& GetModifyHdl() const override { return aModifyHdlLink; }
117 void SetUpdateDataHdl( const Link<Edit&,void>& rLink ) override { aUpdateDataHdlLink = rLink; }
119 virtual void Resize() override;
120 virtual void GetFocus() override;
122 virtual Size CalcMinimumSize() const override;
123 Size CalcAdjustedSize( const Size& rPrefSize ) const;
124 Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
125 void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
127 void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) override;
129 void SetLeftMargin( sal_uInt16 n );
131 void DisableSelectionOnFocus();
133 void EnableCursor( bool bEnable );
135 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
138 #endif // INCLUDED_VCL_VCLMEDIT_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */