Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / include / vcl / vclmedit.hxx
blob6e292a41050bde7f1751c396b58045a9949581db
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>
29 class ImpVclMEdit;
30 class Timer;
31 class ExtTextEngine;
32 class ExtTextView;
34 class VCL_DLLPUBLIC VclMultiLineEdit : public Edit
36 private:
37 ImpVclMEdit* pImpVclMEdit;
39 OUString aSaveValue;
40 Link aModifyHdlLink;
42 Timer* pUpdateDataTimer;
43 Link aUpdateDataHdlLink;
45 protected:
47 DECL_LINK( ImpUpdateDataHdl, void* );
48 void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
49 void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
50 virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
51 virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
52 using Control::ImplInitSettings;
53 void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
54 WinBits ImplInitStyle( WinBits nStyle );
56 ExtTextEngine* GetTextEngine() const;
57 ExtTextView* GetTextView() const;
58 ScrollBar* GetVScrollBar() const;
60 public:
61 VclMultiLineEdit( Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER );
62 VclMultiLineEdit( Window* pParent, const ResId& rResId );
63 virtual ~VclMultiLineEdit();
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 virtual 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: */