xref: /AOO41X/main/basic/inc/basic/mybasic.hxx (revision 234bd5c559aaf7abbd02d045859137b774cd8b34)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _MYBASIC_HXX
25 #define _MYBASIC_HXX
26 
27 #include <basic/sbstar.hxx>
28 
29 class BasicApp;
30 class AppBasEd;
31 class ErrorEntry;
32 
33 class BasicError {
34     AppBasEd* pWin;
35     sal_uInt16  nLine, nCol1, nCol2;
36     String aText;
37 public:
38     BasicError( AppBasEd*, sal_uInt16, const String&, sal_uInt16, sal_uInt16, sal_uInt16 );
39     void Show();
40 };
41 
42 DECLARE_LIST( ErrorList, BasicError* )
43 
44 #define SBXID_MYBASIC   0x594D      // MyBasic: MY
45 #define SBXCR_TEST      0x54534554  // TEST
46 
47 class MyBasic : public StarBASIC
48 {
49     SbError nError;
50     virtual sal_Bool ErrorHdl();
51     virtual sal_uInt16 BreakHdl();
52 
53 protected:
54     Link GenLogHdl();
55     Link GenWinInfoHdl();
56     Link GenModuleWinExistsHdl();
57     Link GenWriteStringHdl();
58 
59     virtual void StartListeningTT( SfxBroadcaster &rBroadcaster );
60 
61     String GenRealString( const String &aResString );
62 
63 public:
64     SBX_DECL_PERSIST_NODATA(SBXCR_TEST,SBXID_MYBASIC,1);
65     TYPEINFO();
66     ErrorList aErrors;
67     MyBasic();
68     virtual ~MyBasic();
69     virtual sal_Bool Compile( SbModule* );
70     void Reset();
GetErrors()71     SbError GetErrors() { return nError; }
72 
73         // Do not use #ifdefs here because this header file is both used for testtool and basic
74     SbxObject *pTestObject; // for Testool; otherwise NULL
75 
76     virtual void LoadIniFile();
77 
78     // Determines the extended symbol type for syntax highlighting
79     virtual SbTextType GetSymbolType( const String &Symbol, sal_Bool bWasTTControl );
80     virtual const String GetSpechialErrorText();
81     virtual void ReportRuntimeError( AppBasEd *pEditWin );
82     virtual void DebugFindNoErrors( sal_Bool bDebugFindNoErrors );
83 
84     static void SetCompileModule( SbModule *pMod );
85     static SbModule *GetCompileModule();
86 };
87 
88 SV_DECL_IMPL_REF(MyBasic)
89 
90 #endif
91