merge the formfield patch from ooo-build
[ooovba.git] / basic / source / app / textedit.hxx
blob19efd764c2d464d21be6938d1981f899b0eb4adb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: textedit.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _TEXTEDIT_HXX
32 #define _TEXTEDIT_HXX
34 class AppEdit;
35 class TextEngine;
36 class TextView;
37 class TextEdit;
38 class BreakpointWindow;
40 #include <vcl/timer.hxx>
41 #include <tools/table.hxx>
42 #include <tools/debug.hxx>
43 #include <svtools/lstner.hxx>
44 #include <svtools/svmedit.hxx>
46 #include "dataedit.hxx"
48 //#include <xtextedt.hxx>
50 class TextEditImp : public Window, public SfxListener
52 using Window::Notify;
54 protected:
55 void DoSyntaxHighlight( ULONG nPara );
58 private:
59 AppEdit *pAppEdit;
60 Link ModifyHdl;
62 Timer aSyntaxIdleTimer;
63 Timer aImplSyntaxIdleTimer;
64 DECL_LINK( SyntaxTimerHdl, Timer * );
65 Table aSyntaxLineTable;
67 void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
69 void ImpDoHighlight( const String& rSource, ULONG nLineOff );
70 BOOL bHighlightning;
71 BOOL bDoSyntaxHighlight;
72 BOOL bDelayHighlight;
75 SbxBase* GetSbxAtMousePos( String &aWord );
76 virtual void MouseMove( const MouseEvent& rMEvt );
77 DECL_LINK( HideVarContents, void* );
78 DECL_LINK( ShowVarContents, void* );
79 Point aTipPos;
80 String aTipWord;
81 ULONG nTipId;
83 Timer HideTipTimer;
84 Timer ShowTipTimer;
86 BOOL bViewMoved;
88 public:
89 TextEditImp( AppEdit *pParent, const WinBits& aBits );
90 ~TextEditImp();
92 TextEngine *pTextEngine;
93 TextView *pTextView;
95 void SetFont( const Font& rNewFont );
96 BOOL IsModified();
97 void SetModifyHdl( Link l ){ ModifyHdl = l; }
99 void KeyInput( const KeyEvent& rKeyEvent );
100 void Paint( const Rectangle& rRect );
101 void MouseButtonUp( const MouseEvent& rMouseEvent );
102 void MouseButtonDown( const MouseEvent& rMouseEvent );
103 // void MouseMove( const MouseEvent& rMouseEvent );
104 void Command( const CommandEvent& rCEvt );
105 //BOOL Drop( const DropEvent& rEvt );
106 //BOOL QueryDrop( DropEvent& rEvt );
108 BOOL ViewMoved();
110 void DoDelayedSyntaxHighlight( xub_StrLen nPara );
111 void InvalidateSyntaxHighlight();
112 void SyntaxHighlight( BOOL bNew );
113 void BuildKontextMenu( PopupMenu *&pMenu );
118 DBG_NAMEEX(TextEdit)
119 class TextEdit : public DataEdit {
121 BreakpointWindow *pBreakpointWindow;
122 BOOL bFileWasUTF8;
123 BOOL bSaveAsUTF8;
125 public:
126 TextEdit( AppEdit*, const WinBits& );
127 ~TextEdit();
128 void Highlight( ULONG nLine, xub_StrLen nCol1, xub_StrLen nCol2 );
129 TextEditImp& GetTextEditImp() { return aEdit; }
131 void SetBreakpointWindow( BreakpointWindow *pBPWindow ){ pBreakpointWindow = pBPWindow; }
132 BreakpointWindow *GetBreakpointWindow(){ return pBreakpointWindow; }
134 DATA_FUNC_DEF( aEdit, TextEditImp )
136 virtual void BuildKontextMenu( PopupMenu *&pMenu );
138 void SaveAsUTF8( BOOL bUTF8 ) { bSaveAsUTF8 = bUTF8; }
141 #endif