Branch libreoffice-5-0-4
[LibreOffice.git] / include / vcl / vclmedit.hxx
blobd7eb4807b1c66bd037cf8b82d12d5fc5bcfcd3db
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 ExtTextView;
33 class VCL_DLLPUBLIC VclMultiLineEdit : public Edit
35 private:
36 ImpVclMEdit* pImpVclMEdit;
38 OUString aSaveValue;
39 Link<> aModifyHdlLink;
41 Timer* pUpdateDataTimer;
42 Link<> aUpdateDataHdlLink;
44 protected:
46 DECL_LINK_TYPED( ImpUpdateDataHdl, Timer*, void );
47 void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
48 void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
49 virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
50 virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
51 using Control::ImplInitSettings;
52 void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
53 static WinBits ImplInitStyle( WinBits nStyle );
55 ExtTextEngine* GetTextEngine() const;
56 ExtTextView* GetTextView() const;
57 ScrollBar* GetVScrollBar() const;
59 virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
60 public:
61 VclMultiLineEdit( vcl::Window* pParent,
62 WinBits nWinStyle = WB_LEFT | WB_BORDER );
63 virtual ~VclMultiLineEdit();
64 virtual void dispose() SAL_OVERRIDE;
66 void SelectionChanged();
67 void CaretChanged();
68 virtual void Modify() SAL_OVERRIDE;
69 virtual void UpdateData() SAL_OVERRIDE;
71 virtual void SetModifyFlag() SAL_OVERRIDE;
72 virtual void ClearModifyFlag() SAL_OVERRIDE;
73 virtual bool IsModified() const SAL_OVERRIDE;
75 virtual void EnableUpdateData( sal_uLong nTimeout = EDIT_UPDATEDATA_TIMEOUT ) SAL_OVERRIDE;
76 virtual void DisableUpdateData() SAL_OVERRIDE { delete pUpdateDataTimer; pUpdateDataTimer = NULL; }
78 virtual void SetReadOnly( bool bReadOnly = true ) SAL_OVERRIDE;
79 virtual bool IsReadOnly() const SAL_OVERRIDE;
81 void EnableFocusSelectionHide( bool bHide );
83 virtual void SetMaxTextLen(sal_Int32 nMaxLen = 0) SAL_OVERRIDE;
84 virtual sal_Int32 GetMaxTextLen() const SAL_OVERRIDE;
86 void SetMaxTextWidth( sal_uLong nMaxWidth );
88 virtual void SetSelection( const Selection& rSelection ) SAL_OVERRIDE;
89 virtual const Selection& GetSelection() const SAL_OVERRIDE;
91 virtual void ReplaceSelected( const OUString& rStr ) SAL_OVERRIDE;
92 virtual void DeleteSelected() SAL_OVERRIDE;
93 virtual OUString GetSelected() const SAL_OVERRIDE;
94 OUString GetSelected( LineEnd aSeparator ) const;
96 virtual void Cut() SAL_OVERRIDE;
97 virtual void Copy() SAL_OVERRIDE;
98 virtual void Paste() SAL_OVERRIDE;
100 virtual void SetText( const OUString& rStr ) SAL_OVERRIDE;
101 virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) SAL_OVERRIDE
102 { SetText( rStr ); SetSelection( rNewSelection ); }
103 OUString GetText() const SAL_OVERRIDE;
104 OUString GetText( LineEnd aSeparator ) const;
105 OUString GetTextLines( LineEnd aSeparator ) const;
107 void SetRightToLeft( bool bRightToLeft );
109 void SaveValue() { aSaveValue = GetText(); }
110 const OUString& GetSavedValue() const { return aSaveValue; }
111 bool IsValueChangedFromSaved() const { return aSaveValue != GetText(); }
113 void SetModifyHdl( const Link<>& rLink ) SAL_OVERRIDE { aModifyHdlLink = rLink; }
114 const Link<>& GetModifyHdl() const SAL_OVERRIDE { return aModifyHdlLink; }
116 void SetUpdateDataHdl( const Link<>& rLink ) SAL_OVERRIDE { aUpdateDataHdlLink = rLink; }
118 virtual void Resize() SAL_OVERRIDE;
119 virtual void GetFocus() SAL_OVERRIDE;
121 virtual Size CalcMinimumSize() const SAL_OVERRIDE;
122 Size CalcAdjustedSize( const Size& rPrefSize ) const;
123 Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
124 void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
126 void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
128 void SetLeftMargin( sal_uInt16 n );
130 void DisableSelectionOnFocus();
132 void EnableCursor( bool bEnable );
134 virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
137 #endif // INCLUDED_VCL_VCLMEDIT_HXX
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */