Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _VCLMEDIT_HXX
30 : : #define _VCLMEDIT_HXX
31 : :
32 : : #include <tools/wintypes.hxx>
33 : : #include <vcl/edit.hxx>
34 : : #include <vcl/dllapi.h>
35 : :
36 : :
37 : : class ImpSvMEdit;
38 : : class Timer;
39 : : class ExtTextEngine;
40 : : class ExtTextView;
41 : :
42 : : class VCL_DLLPUBLIC VCLMultiLineEdit : public Edit
43 : : {
44 : : private:
45 : : ImpSvMEdit* pImpSvMEdit;
46 : :
47 : : XubString aSaveValue;
48 : : Link aModifyHdlLink;
49 : :
50 : : Timer* pUpdateDataTimer;
51 : : Link aUpdateDataHdlLink;
52 : :
53 : : protected:
54 : :
55 : : DECL_LINK( ImpUpdateDataHdl, void* );
56 : : void StateChanged( StateChangedType nType );
57 : : void DataChanged( const DataChangedEvent& rDCEvt );
58 : : virtual long PreNotify( NotifyEvent& rNEvt );
59 : : long Notify( NotifyEvent& rNEvt );
60 : : using Control::ImplInitSettings;
61 : : void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
62 : : WinBits ImplInitStyle( WinBits nStyle );
63 : :
64 : : ExtTextEngine* GetTextEngine() const;
65 : : ExtTextView* GetTextView() const;
66 : : ScrollBar* GetVScrollBar() const;
67 : :
68 : : public:
69 : : VCLMultiLineEdit( Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER );
70 : : VCLMultiLineEdit( Window* pParent, const ResId& rResId );
71 : : virtual ~VCLMultiLineEdit();
72 : :
73 : :
74 : : virtual void Modify();
75 : : virtual void UpdateData();
76 : :
77 : : virtual void SetModifyFlag();
78 : : virtual void ClearModifyFlag();
79 : : virtual sal_Bool IsModified() const;
80 : :
81 : : virtual void EnableUpdateData( sal_uLong nTimeout = EDIT_UPDATEDATA_TIMEOUT );
82 [ # # ]: 0 : virtual void DisableUpdateData() { delete pUpdateDataTimer; pUpdateDataTimer = NULL; }
83 : : virtual sal_uLong IsUpdateDataEnabled() const;
84 : :
85 : : virtual void SetReadOnly( sal_Bool bReadOnly = sal_True );
86 : : virtual sal_Bool IsReadOnly() const;
87 : :
88 : : void EnableFocusSelectionHide( sal_Bool bHide );
89 : :
90 : : virtual void SetMaxTextLen( xub_StrLen nMaxLen = 0 );
91 : : virtual xub_StrLen GetMaxTextLen() const;
92 : :
93 : : virtual void SetSelection( const Selection& rSelection );
94 : : virtual const Selection& GetSelection() const;
95 : :
96 : : virtual void ReplaceSelected( const XubString& rStr );
97 : : virtual void DeleteSelected();
98 : : virtual XubString GetSelected() const;
99 : : virtual XubString GetSelected( LineEnd aSeparator ) const;
100 : :
101 : : virtual void Cut();
102 : : virtual void Copy();
103 : : virtual void Paste();
104 : :
105 : : virtual void SetText( const XubString& rStr );
106 : 0 : virtual void SetText( const XubString& rStr, const Selection& rNewSelection )
107 : 0 : { SetText( rStr ); SetSelection( rNewSelection ); }
108 : : String GetText() const;
109 : : String GetText( LineEnd aSeparator ) const;
110 : : String GetTextLines( LineEnd aSeparator ) const;
111 : :
112 : : void SetRightToLeft( sal_Bool bRightToLeft );
113 : : sal_Bool IsRightToLeft() const;
114 : :
115 [ # # ]: 0 : void SaveValue() { aSaveValue = GetText(); }
116 : 0 : const XubString& GetSavedValue() const { return aSaveValue; }
117 : :
118 : 34 : void SetModifyHdl( const Link& rLink ) { aModifyHdlLink = rLink; }
119 : 0 : const Link& GetModifyHdl() const { return aModifyHdlLink; }
120 : :
121 : 0 : void SetUpdateDataHdl( const Link& rLink ) { aUpdateDataHdlLink = rLink; }
122 : 0 : const Link& GetUpdateDataHdl() const { return aUpdateDataHdlLink; }
123 : :
124 : : virtual void Resize();
125 : : virtual void GetFocus();
126 : :
127 : : Size CalcMinimumSize() const;
128 : : Size CalcAdjustedSize( const Size& rPrefSize ) const;
129 : : using Edit::CalcSize;
130 : : Size CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
131 : : void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
132 : :
133 : : void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
134 : :
135 : : void SetLeftMargin( sal_uInt16 n );
136 : :
137 : : void DisableSelectionOnFocus();
138 : :
139 : : void SetTextSelectable( sal_Bool bTextSelectable );
140 : : };
141 : :
142 : 0 : inline sal_uLong VCLMultiLineEdit::IsUpdateDataEnabled() const
143 : : {
144 [ # # ]: 0 : return pUpdateDataTimer ? pUpdateDataTimer->GetTimeout() : 0;
145 : : }
146 : :
147 : : #endif //_VCLMEDIT_HXX
148 : :
149 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|