1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: app.hxx,v $
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 ************************************************************************/
34 #include <vcl/svapp.hxx>
35 #ifndef _HELP_HXX //autogen
36 #include <vcl/help.hxx>
38 #ifndef _MENU_HXX //autogen
39 #include <vcl/menu.hxx>
41 #ifndef _WRKWIN_HXX //autogen
42 #include <vcl/wrkwin.hxx>
44 #include <vcl/timer.hxx>
45 #include <svtools/brdcst.hxx>
46 #include <svtools/lstner.hxx>
49 #include <basic/mybasic.hxx>
61 class BasicApp
: public Application
{
62 short nWait
; // Wait-Zaehler
64 // Help* pHelp; // Hilfesystem
65 BasicFrame
* pFrame
; // Frame Window
66 // MenuBar* pMainMenu; // Hauptmenue
67 Accelerator
* pMainAccel
; // Acceleratoren
74 DECL_LINK( LateInit
, void * );
77 DbgPrintLine DbgPrintMsgBox
;
82 typedef USHORT FileType
;
84 #define FT_NO_FILE (FileType)0x00 // An error has occurred ...
85 #define FT_BASIC_SOURCE (FileType)0x01
86 #define FT_BASIC_INCLUDE (FileType)0x02
87 #define FT_RESULT_FILE (FileType)0x04
88 #define FT_RESULT_FILE_TXT (FileType)0x08
89 #define FT_BASIC_LIBRARY (FileType)0x10
94 class FloatingExecutionStatus
;
96 class BasicFrame
: public WorkWindow
, public SfxBroadcaster
, public SfxListener
98 using SystemWindow::Notify
;
99 using Window::Command
;
101 virtual BOOL
Close();
102 BOOL
CloseAll(); // Close all windows
103 BOOL
CompileAll(); // Compile all texts
104 AutoTimer aLineNum
; // Show the line numbers
105 virtual void Resize();
107 virtual void GetFocus();
111 DisplayHidDlg
* pDisplayHidDlg
;
113 // BreakPoint *pRunToCursorBP;
115 SbxVariable
*pEditVar
;
119 Timer aCheckFiles
; // Checks the files for changes
122 DECL_LINK( CheckAllFiles
, Timer
* );
124 MyBasicRef pBasic
; // BASIC-Engine
126 String aAppName
; // Title bar content
127 String aAppFile
; // AppName AppFile [AppMode]
130 DECL_LINK( CloseButtonClick
, void* );
131 DECL_LINK( FloatButtonClick
, void* );
132 DECL_LINK( HideButtonClick
, void* );
134 FloatingExecutionStatus
*pExecutionStatus
;
138 void SetAutoRun( BOOL bAuto
);
139 BOOL bInBreak
; // TRUE if in Break-Handler
140 StatusLine
* pStatus
; // Status line
141 EditList
* pList
; // List of edit windows
142 AppWin
* pWork
; // Current edit window
143 BasicPrinter
* pPrn
; // Printer
144 BOOL bDisas
; // TRUE: disassemble
145 USHORT nFlags
; // Debugging-Flags
146 USHORT nMaximizedWindows
; // Number of maximized windows
147 void FocusWindow( AppWin
*pWin
);
148 void WinMax_Restore();
150 void RemoveWindow( AppWin
*pWin
);
151 void AddWindow( AppWin
*pWin
);
152 void WindowRenamed( AppWin
*pWin
);
156 MyBasic
& Basic() { return *pBasic
; }
157 void AddToLRU(String
const& aFile
);
159 DECL_LINK( InitMenu
, Menu
* );
160 DECL_LINK( DeInitMenu
, Menu
* );
161 DECL_LINK( HighlightMenu
, Menu
* );
162 DECL_LINK( MenuCommand
, Menu
* );
163 DECL_LINK( Accel
, Accelerator
* );
164 DECL_LINK( ShowLineNr
, AutoTimer
* );
165 MsgEdit
* GetMsgTree( String aLogFileName
);
166 DECL_LINK( Log
, TTLogMsg
* );
167 DECL_LINK( WinInfo
, WinInfoRec
* );
168 BOOL
LoadFile( String aFilename
);
169 long Command( short,BOOL
=FALSE
); // Command handler
170 virtual void Command( const CommandEvent
& rCEvt
); // Command handler
171 BOOL
SaveAll(); // Save all windows
172 BOOL
QueryFileName( String
& rName
, FileType nFileType
, BOOL bSave
); // Query for filename
173 DECL_LINK( ModuleWinExists
, String
* );
174 DECL_LINK( WriteString
, String
* );
175 AppBasEd
* CreateModuleWin( SbModule
* pMod
);
176 AppBasEd
* FindModuleWin( const String
& );
177 AppError
* FindErrorWin( const String
& );
178 AppWin
* FindWin( const String
& );
179 AppWin
* FindWin( USHORT nWinId
);
180 AppWin
* IsWinValid( AppWin
* pMaybeWin
);
181 USHORT
BreakHandler(); // Break-Handler-Callback
183 void SetEditVar( SbxVariable
*pVar
){ pEditVar
= pVar
;}
184 SbxVariable
* GetEditVar(){ return pEditVar
;}
185 BOOL
IsAutoReload() { return bAutoReload
; }
186 BOOL
IsAutoSave() { return bAutoSave
; }
189 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
191 void SetAppMode( const String
&aNewMode
){ aAppMode
= aNewMode
; UpdateTitle(); }
193 String
GenRealString( const String
&aResString
);
197 extern BasicApp aBasicApp
;