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 .
23 #include <tools/wintypes.hxx>
24 #include <vcl/edit.hxx>
25 #include <vcl/dllapi.h>
33 class VCL_DLLPUBLIC VclMultiLineEdit
: public Edit
36 ImpVclMEdit
* pImpVclMEdit
;
41 Timer
* pUpdateDataTimer
;
42 Link aUpdateDataHdlLink
;
46 DECL_LINK( ImpUpdateDataHdl
, void* );
47 void StateChanged( StateChangedType nType
);
48 void DataChanged( const DataChangedEvent
& rDCEvt
);
49 virtual long PreNotify( NotifyEvent
& rNEvt
);
50 long Notify( NotifyEvent
& rNEvt
);
51 using Control::ImplInitSettings
;
52 void ImplInitSettings( sal_Bool bFont
, sal_Bool bForeground
, sal_Bool bBackground
);
53 WinBits
ImplInitStyle( WinBits nStyle
);
55 ExtTextEngine
* GetTextEngine() const;
56 ExtTextView
* GetTextView() const;
57 ScrollBar
* GetVScrollBar() const;
60 VclMultiLineEdit( Window
* pParent
, WinBits nWinStyle
= WB_LEFT
| WB_BORDER
);
61 VclMultiLineEdit( Window
* pParent
, const ResId
& rResId
);
62 virtual ~VclMultiLineEdit();
65 virtual void Modify();
66 virtual void UpdateData();
68 virtual void SetModifyFlag();
69 virtual void ClearModifyFlag();
70 virtual sal_Bool
IsModified() const;
72 virtual void EnableUpdateData( sal_uLong nTimeout
= EDIT_UPDATEDATA_TIMEOUT
);
73 virtual void DisableUpdateData() { delete pUpdateDataTimer
; pUpdateDataTimer
= NULL
; }
74 virtual sal_uLong
IsUpdateDataEnabled() const;
76 virtual void SetReadOnly( sal_Bool bReadOnly
= sal_True
);
77 virtual sal_Bool
IsReadOnly() const;
79 void EnableFocusSelectionHide( sal_Bool bHide
);
81 virtual void SetMaxTextLen( xub_StrLen nMaxLen
= 0 );
82 virtual xub_StrLen
GetMaxTextLen() const;
84 void SetMaxTextWidth( sal_uLong nMaxWidth
);
86 virtual void SetSelection( const Selection
& rSelection
);
87 virtual const Selection
& GetSelection() const;
89 virtual void ReplaceSelected( const OUString
& rStr
);
90 virtual void DeleteSelected();
91 virtual OUString
GetSelected() const;
92 virtual OUString
GetSelected( LineEnd aSeparator
) const;
98 virtual void SetText( const OUString
& rStr
);
99 virtual void SetText( const OUString
& rStr
, const Selection
& rNewSelection
)
100 { SetText( rStr
); SetSelection( rNewSelection
); }
101 OUString
GetText() const;
102 OUString
GetText( LineEnd aSeparator
) const;
103 String
GetTextLines( LineEnd aSeparator
) const;
105 void SetRightToLeft( sal_Bool bRightToLeft
);
106 sal_Bool
IsRightToLeft() const;
108 void SaveValue() { aSaveValue
= GetText(); }
109 const OUString
& GetSavedValue() const { return aSaveValue
; }
111 void SetModifyHdl( const Link
& rLink
) { aModifyHdlLink
= rLink
; }
112 const Link
& GetModifyHdl() const { return aModifyHdlLink
; }
114 void SetUpdateDataHdl( const Link
& rLink
) { aUpdateDataHdlLink
= rLink
; }
116 virtual void Resize();
117 virtual void GetFocus();
119 Size
CalcMinimumSize() const;
120 Size
CalcAdjustedSize( const Size
& rPrefSize
) const;
121 using Edit::CalcSize
;
122 Size
CalcSize( sal_uInt16 nColumns
, sal_uInt16 nLines
) const;
123 void GetMaxVisColumnsAndLines( sal_uInt16
& rnCols
, sal_uInt16
& rnLines
) const;
125 void Draw( OutputDevice
* pDev
, const Point
& rPos
, const Size
& rSize
, sal_uLong nFlags
);
127 void SetLeftMargin( sal_uInt16 n
);
129 void DisableSelectionOnFocus();
131 void SetTextSelectable( sal_Bool bTextSelectable
);
132 void EnableCursor( sal_Bool bEnable
);
134 virtual bool set_property(const OString
&rKey
, const OString
&rValue
);
137 inline sal_uLong
VclMultiLineEdit::IsUpdateDataEnabled() const
139 return pUpdateDataTimer
? pUpdateDataTimer
->GetTimeout() : 0;
142 #endif //_VCLMEDIT_HXX
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */