xref: /aoo41x/main/basic/inc/basic/mybasic.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _MYBASIC_HXX
29 #define _MYBASIC_HXX
30 
31 #include <basic/sbstar.hxx>
32 
33 class BasicApp;
34 class AppBasEd;
35 class ErrorEntry;
36 
37 class BasicError {
38 	AppBasEd* pWin;
39 	sal_uInt16  nLine, nCol1, nCol2;
40 	String aText;
41 public:
42 	BasicError( AppBasEd*, sal_uInt16, const String&, sal_uInt16, sal_uInt16, sal_uInt16 );
43 	void Show();
44 };
45 
46 DECLARE_LIST( ErrorList, BasicError* )
47 
48 #define SBXID_MYBASIC	0x594D		// MyBasic: MY
49 #define	SBXCR_TEST		0x54534554	// TEST
50 
51 class MyBasic : public StarBASIC
52 {
53     SbError nError;
54 	virtual sal_Bool ErrorHdl();
55 	virtual sal_uInt16 BreakHdl();
56 
57 protected:
58 	Link GenLogHdl();
59 	Link GenWinInfoHdl();
60 	Link GenModuleWinExistsHdl();
61     Link GenWriteStringHdl();
62 
63 	virtual void StartListeningTT( SfxBroadcaster &rBroadcaster );
64 
65 	String GenRealString( const String &aResString );
66 
67 public:
68 	SBX_DECL_PERSIST_NODATA(SBXCR_TEST,SBXID_MYBASIC,1);
69 	TYPEINFO();
70 	ErrorList aErrors;
71 	MyBasic();
72 	virtual ~MyBasic();
73 	virtual sal_Bool Compile( SbModule* );
74 	void Reset();
75 	SbError GetErrors() { return nError; }
76 
77         // Do not use #ifdefs here because this header file is both used for testtool and basic
78 	SbxObject *pTestObject; // for Testool; otherwise NULL
79 
80 	virtual void LoadIniFile();
81 
82     // Determines the extended symbol type for syntax highlighting
83     virtual SbTextType GetSymbolType( const String &Symbol, sal_Bool bWasTTControl );
84 	virtual const String GetSpechialErrorText();
85 	virtual void ReportRuntimeError( AppBasEd *pEditWin );
86 	virtual void DebugFindNoErrors( sal_Bool bDebugFindNoErrors );
87 
88 	static void SetCompileModule( SbModule *pMod );
89 	static SbModule *GetCompileModule();
90 };
91 
92 SV_DECL_IMPL_REF(MyBasic)
93 
94 #endif
95