Line data Source code
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 : #ifndef INCLUDED_VCL_VCLMEDIT_HXX
21 : #define INCLUDED_VCL_VCLMEDIT_HXX
22 :
23 : #include <tools/lineend.hxx>
24 : #include <tools/wintypes.hxx>
25 : #include <vcl/edit.hxx>
26 : #include <vcl/dllapi.h>
27 :
28 :
29 : class ImpVclMEdit;
30 : class Timer;
31 : class ExtTextEngine;
32 : class ExtTextView;
33 :
34 : class VCL_DLLPUBLIC VclMultiLineEdit : public Edit
35 : {
36 : private:
37 : ImpVclMEdit* pImpVclMEdit;
38 :
39 : OUString aSaveValue;
40 : Link aModifyHdlLink;
41 :
42 : Timer* pUpdateDataTimer;
43 : Link aUpdateDataHdlLink;
44 :
45 : protected:
46 :
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 );
55 :
56 : ExtTextEngine* GetTextEngine() const;
57 : ExtTextView* GetTextView() const;
58 : ScrollBar* GetVScrollBar() const;
59 :
60 : public:
61 : VclMultiLineEdit( Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER );
62 : VclMultiLineEdit( Window* pParent, const ResId& rResId );
63 : virtual ~VclMultiLineEdit();
64 :
65 :
66 : void SelectionChanged();
67 : void CaretChanged();
68 : virtual void Modify() SAL_OVERRIDE;
69 : virtual void UpdateData() SAL_OVERRIDE;
70 :
71 : virtual void SetModifyFlag() SAL_OVERRIDE;
72 : virtual void ClearModifyFlag() SAL_OVERRIDE;
73 : virtual bool IsModified() const SAL_OVERRIDE;
74 :
75 : virtual void EnableUpdateData( sal_uLong nTimeout = EDIT_UPDATEDATA_TIMEOUT ) SAL_OVERRIDE;
76 0 : virtual void DisableUpdateData() SAL_OVERRIDE { delete pUpdateDataTimer; pUpdateDataTimer = NULL; }
77 :
78 : virtual void SetReadOnly( bool bReadOnly = true ) SAL_OVERRIDE;
79 : virtual bool IsReadOnly() const SAL_OVERRIDE;
80 :
81 : void EnableFocusSelectionHide( bool bHide );
82 :
83 : virtual void SetMaxTextLen(sal_Int32 nMaxLen = 0) SAL_OVERRIDE;
84 : virtual sal_Int32 GetMaxTextLen() const SAL_OVERRIDE;
85 :
86 : void SetMaxTextWidth( sal_uLong nMaxWidth );
87 :
88 : virtual void SetSelection( const Selection& rSelection ) SAL_OVERRIDE;
89 : virtual const Selection& GetSelection() const SAL_OVERRIDE;
90 :
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;
95 :
96 : virtual void Cut() SAL_OVERRIDE;
97 : virtual void Copy() SAL_OVERRIDE;
98 : virtual void Paste() SAL_OVERRIDE;
99 :
100 : virtual void SetText( const OUString& rStr ) SAL_OVERRIDE;
101 0 : virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) SAL_OVERRIDE
102 0 : { SetText( rStr ); SetSelection( rNewSelection ); }
103 : OUString GetText() const SAL_OVERRIDE;
104 : OUString GetText( LineEnd aSeparator ) const;
105 : OUString GetTextLines( LineEnd aSeparator ) const;
106 :
107 : void SetRightToLeft( bool bRightToLeft );
108 :
109 0 : void SaveValue() { aSaveValue = GetText(); }
110 0 : const OUString& GetSavedValue() const { return aSaveValue; }
111 :
112 0 : void SetModifyHdl( const Link& rLink ) SAL_OVERRIDE { aModifyHdlLink = rLink; }
113 0 : const Link& GetModifyHdl() const SAL_OVERRIDE { return aModifyHdlLink; }
114 :
115 0 : void SetUpdateDataHdl( const Link& rLink ) SAL_OVERRIDE { aUpdateDataHdlLink = rLink; }
116 :
117 : virtual void Resize() SAL_OVERRIDE;
118 : virtual void GetFocus() SAL_OVERRIDE;
119 :
120 : virtual Size CalcMinimumSize() const SAL_OVERRIDE;
121 : Size CalcAdjustedSize( const Size& rPrefSize ) const;
122 : Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
123 : void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
124 :
125 : void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
126 :
127 : void SetLeftMargin( sal_uInt16 n );
128 :
129 : void DisableSelectionOnFocus();
130 :
131 : void EnableCursor( bool bEnable );
132 :
133 : virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
134 : };
135 :
136 : #endif // INCLUDED_VCL_VCLMEDIT_HXX
137 :
138 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|