xref: /AOO41X/main/basctl/source/inc/basidesh.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _BASIDESH_HXX
28*cdf0e10cSrcweir #define _BASIDESH_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include "sbxitem.hxx"
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include "scriptdocument.hxx"
33*cdf0e10cSrcweir #include "doceventnotifier.hxx"
34*cdf0e10cSrcweir #include <sfx2/viewfac.hxx>
35*cdf0e10cSrcweir #include <sfx2/shell.hxx>
36*cdf0e10cSrcweir #ifndef _SCRBAR_HXX //autogen
37*cdf0e10cSrcweir #include <vcl/scrbar.hxx>
38*cdf0e10cSrcweir #endif
39*cdf0e10cSrcweir #ifndef _TABLE_HXX //autogen
40*cdf0e10cSrcweir #include <tools/table.hxx>
41*cdf0e10cSrcweir #endif
42*cdf0e10cSrcweir #include <sfx2/viewsh.hxx>
43*cdf0e10cSrcweir #include <svx/ifaceids.hxx>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_IO_XINPUTSTREAMPROVIDER_HXX_
46*cdf0e10cSrcweir #include <com/sun/star/io/XInputStreamProvider.hpp>
47*cdf0e10cSrcweir #endif
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir #include <com/sun/star/container/XContainerListener.hpp>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir //----------------------------------------------------------------------------
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir const sal_uLong BASICIDE_UI_FEATURE_SHOW_BROWSER = 0x00000001;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir //----------------------------------------------------------------------------
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir class ModulWindow;
58*cdf0e10cSrcweir class ModulWindowLayout;
59*cdf0e10cSrcweir class DialogWindow;
60*cdf0e10cSrcweir class SdrView;
61*cdf0e10cSrcweir class ObjectCatalog;
62*cdf0e10cSrcweir class BasicIDETabBar;
63*cdf0e10cSrcweir class TabBar;
64*cdf0e10cSrcweir class IDEBaseWindow;
65*cdf0e10cSrcweir class SbxObject;
66*cdf0e10cSrcweir class SbModule;
67*cdf0e10cSrcweir class StarBASIC;
68*cdf0e10cSrcweir class LocalizationMgr;
69*cdf0e10cSrcweir struct BasicIDEShell_Impl;
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir #if _SOLAR__PRIVATE
72*cdf0e10cSrcweir DECLARE_TABLE( IDEWindowTable, IDEBaseWindow* )
73*cdf0e10cSrcweir #else
74*cdf0e10cSrcweir typedef Table IDEWindowTable;
75*cdf0e10cSrcweir #endif
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir namespace BasicIDE
78*cdf0e10cSrcweir {
79*cdf0e10cSrcweir     bool RemoveDialog( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName );
80*cdf0e10cSrcweir }
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir class BasicIDEShell :public SfxViewShell
83*cdf0e10cSrcweir                     ,public ::basctl::DocumentEventListener
84*cdf0e10cSrcweir {
85*cdf0e10cSrcweir friend class JavaDebuggingListenerImpl;
86*cdf0e10cSrcweir friend class LocalizationMgr;
87*cdf0e10cSrcweir friend sal_Bool implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocument& rDocument, const String& aLibName );
88*cdf0e10cSrcweir friend bool BasicIDE::RemoveDialog( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName );
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 	ObjectCatalog* 		pObjectCatalog;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 	IDEWindowTable		aIDEWindowTable;
93*cdf0e10cSrcweir 	sal_uInt16				nCurKey;
94*cdf0e10cSrcweir 	IDEBaseWindow* 		pCurWin;
95*cdf0e10cSrcweir     ScriptDocument      m_aCurDocument;
96*cdf0e10cSrcweir     String              m_aCurLibName;
97*cdf0e10cSrcweir 	LocalizationMgr*	m_pCurLocalizationMgr;
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 	ScrollBar			aHScrollBar;
100*cdf0e10cSrcweir 	ScrollBar			aVScrollBar;
101*cdf0e10cSrcweir 	ScrollBarBox		aScrollBarBox;
102*cdf0e10cSrcweir 	BasicIDETabBar*		pTabBar;
103*cdf0e10cSrcweir 	sal_Bool				bTabBarSplitted;
104*cdf0e10cSrcweir 	sal_Bool				bCreatingWindow;
105*cdf0e10cSrcweir 	ModulWindowLayout*	pModulLayout;
106*cdf0e10cSrcweir     sal_Bool                m_bAppBasicModified;
107*cdf0e10cSrcweir     ::basctl::DocumentEventNotifier
108*cdf0e10cSrcweir                         m_aNotifier;
109*cdf0e10cSrcweir friend class ContainerListenerImpl;
110*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener;
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir #if _SOLAR__PRIVATE
113*cdf0e10cSrcweir 	void				Init();
114*cdf0e10cSrcweir 	void				InitTabBar();
115*cdf0e10cSrcweir 	void				InitScrollBars();
116*cdf0e10cSrcweir 	void				CheckWindows();
117*cdf0e10cSrcweir 	void				RemoveWindows( const ScriptDocument& rDocument, const String& rLibName, sal_Bool bDestroy );
118*cdf0e10cSrcweir 	void				UpdateWindows();
119*cdf0e10cSrcweir 	void				ShowObjectDialog( sal_Bool bShow, sal_Bool bCreateOrDestroy );
120*cdf0e10cSrcweir 	void				InvalidateBasicIDESlots();
121*cdf0e10cSrcweir 	void				StoreAllWindowData( sal_Bool bPersistent = sal_True );
122*cdf0e10cSrcweir 	void				SetMDITitle();
123*cdf0e10cSrcweir 	void				EnableScrollbars( sal_Bool bEnable );
124*cdf0e10cSrcweir     void                SetCurLib( const ScriptDocument& rDocument, String aLibName, bool bUpdateWindows = true , bool bCheck = true );
125*cdf0e10cSrcweir 	void				SetCurLibForLocalization( const ScriptDocument& rDocument, String aLibName );
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 	void				ImplStartListening( StarBASIC* pBasic );
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir 	DECL_LINK( TabBarHdl, TabBar* );
130*cdf0e10cSrcweir 	DECL_LINK( AccelSelectHdl, Accelerator* );
131*cdf0e10cSrcweir 	DECL_LINK( ObjectDialogCancelHdl, ObjectCatalog * );
132*cdf0e10cSrcweir 	DECL_LINK( TabBarSplitHdl, TabBar * );
133*cdf0e10cSrcweir #endif
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir protected:
136*cdf0e10cSrcweir 	virtual void    	AdjustPosSizePixel( const Point &rPos, const Size &rSize );
137*cdf0e10cSrcweir 	virtual void		OuterResizePixel( const Point &rPos, const Size &rSize );
138*cdf0e10cSrcweir 	virtual Size    	GetOptimalSizePixel() const;
139*cdf0e10cSrcweir 	sal_uInt16				InsertWindowInTable( IDEBaseWindow* pNewWin );
140*cdf0e10cSrcweir 	virtual sal_uInt16 		PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing );
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 	void				SetCurWindow( IDEBaseWindow* pNewWin, sal_Bool bUpdateTabBar = sal_False, sal_Bool bRememberAsCurrent = sal_True );
143*cdf0e10cSrcweir 	void				ManageToolbars();
144*cdf0e10cSrcweir 	void 				RemoveWindow( IDEBaseWindow* pWindow, sal_Bool bDestroy, sal_Bool bAllowChangeCurWindow = sal_True );
145*cdf0e10cSrcweir 	void				ArrangeTabBar();
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir 	ModulWindow*		CreateBasWin( const ScriptDocument& rDocument, const String& rLibName, const String& rModName );
148*cdf0e10cSrcweir     DialogWindow*       CreateDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName );
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 	ModulWindow*		FindBasWin( const ScriptDocument& rDocument, const String& rLibName, const String& rModName, sal_Bool bCreateIfNotExist, sal_Bool bFindSuspended = sal_False );
151*cdf0e10cSrcweir 	ModulWindow* 		ShowActiveModuleWindow( StarBASIC* pBasic );
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 	virtual void 		SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
154*cdf0e10cSrcweir 								const SfxHint& rHint, const TypeId& rHintType );
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 	virtual void		Activate(sal_Bool bMDI);
157*cdf0e10cSrcweir 	virtual void		Deactivate(sal_Bool bMDI);
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 	virtual void		Move();
160*cdf0e10cSrcweir 	virtual	void		ShowCursor( FASTBOOL bOn = sal_True );
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 	void				CreateModulWindowLayout();
163*cdf0e10cSrcweir 	void				DestroyModulWindowLayout();
164*cdf0e10cSrcweir 	void				UpdateModulWindowLayout( bool bBasicStopped );
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir     // DocumentEventListener
167*cdf0e10cSrcweir     virtual void onDocumentCreated( const ScriptDocument& _rDocument );
168*cdf0e10cSrcweir     virtual void onDocumentOpened( const ScriptDocument& _rDocument );
169*cdf0e10cSrcweir     virtual void onDocumentSave( const ScriptDocument& _rDocument );
170*cdf0e10cSrcweir     virtual void onDocumentSaveDone( const ScriptDocument& _rDocument );
171*cdf0e10cSrcweir     virtual void onDocumentSaveAs( const ScriptDocument& _rDocument );
172*cdf0e10cSrcweir     virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument );
173*cdf0e10cSrcweir     virtual void onDocumentClosed( const ScriptDocument& _rDocument );
174*cdf0e10cSrcweir     virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument );
175*cdf0e10cSrcweir     virtual void onDocumentModeChanged( const ScriptDocument& _rDocument );
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir public:
178*cdf0e10cSrcweir 						TYPEINFO();
179*cdf0e10cSrcweir 						SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH )
180*cdf0e10cSrcweir 						SFX_DECL_VIEWFACTORY(BasicIDEShell);
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 						BasicIDEShell( SfxViewFrame *pFrame, SfxViewShell *pOldSh );
183*cdf0e10cSrcweir 						~BasicIDEShell();
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 	IDEBaseWindow*		GetCurWindow() const 	{ return pCurWin; }
186*cdf0e10cSrcweir     const ScriptDocument&
187*cdf0e10cSrcweir                         GetCurDocument() const { return m_aCurDocument; }
188*cdf0e10cSrcweir     const String&       GetCurLibName() const { return m_aCurLibName; }
189*cdf0e10cSrcweir 	ObjectCatalog* 		GetObjectCatalog() const	{ return pObjectCatalog; }
190*cdf0e10cSrcweir 	LocalizationMgr*	GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; }
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 	ScrollBar&			GetHScrollBar() 		{ return aHScrollBar; }
193*cdf0e10cSrcweir 	ScrollBar&			GetVScrollBar() 		{ return aVScrollBar; }
194*cdf0e10cSrcweir 	ScrollBarBox&		GetScrollBarBox() 		{ return aScrollBarBox; }
195*cdf0e10cSrcweir 	TabBar*				GetTabBar()				{ return (TabBar*)pTabBar; }
196*cdf0e10cSrcweir 	IDEWindowTable&		GetIDEWindowTable() 	{ return aIDEWindowTable; }
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir 	SdrView*			GetCurDlgView() const;
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir     ::svl::IUndoManager*
201*cdf0e10cSrcweir                         GetUndoManager();
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir     virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable();
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 	// virtual sal_uInt16			Print( SfxProgress &rProgress, sal_Bool bIsAPI, PrintDialog *pPrintDialog = 0 );
206*cdf0e10cSrcweir 	virtual SfxPrinter*		GetPrinter( sal_Bool bCreate );
207*cdf0e10cSrcweir 	virtual sal_uInt16			SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
208*cdf0e10cSrcweir 	virtual String			GetSelectionText( sal_Bool bCompleteWords );
209*cdf0e10cSrcweir 	virtual sal_Bool			HasSelection( sal_Bool bText ) const;
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 	void				GetState( SfxItemSet& );
212*cdf0e10cSrcweir 	void				ExecuteGlobal( SfxRequest& rReq );
213*cdf0e10cSrcweir 	void				ExecuteCurrent( SfxRequest& rReq );
214*cdf0e10cSrcweir 	void				ExecuteBasic( SfxRequest& rReq );
215*cdf0e10cSrcweir 	void				ExecuteDialog( SfxRequest& rReq );
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 	virtual	sal_Bool	HasUIFeature( sal_uInt32 nFeature );
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 	long				CallBasicErrorHdl( StarBASIC* pBasic );
220*cdf0e10cSrcweir 	long				CallBasicBreakHdl( StarBASIC* pBasic );
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 	ModulWindowLayout*	GetLayoutWindow() const { return pModulLayout; }
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 	IDEBaseWindow*		FindWindow( const ScriptDocument& rDocument, const String& rLibName = String(), const String& rName = String(), sal_uInt16 nType = BASICIDE_TYPE_UNKNOWN, sal_Bool bFindSuspended = sal_False );
225*cdf0e10cSrcweir     DialogWindow*       FindDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName, sal_Bool bCreateIfNotExist, sal_Bool bFindSuspended = sal_False );
226*cdf0e10cSrcweir 	IDEBaseWindow*		FindApplicationWindow();
227*cdf0e10cSrcweir     sal_Bool				NextPage( sal_Bool bPrev = sal_False );
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir 	sal_Bool	            IsAppBasicModified() const { return m_bAppBasicModified; }
230*cdf0e10cSrcweir 	void			    SetAppBasicModified( sal_Bool bModified = sal_True ) { m_bAppBasicModified = bModified; }
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir 	// For Dialog Drag&Drop in Dialog Organizer
233*cdf0e10cSrcweir 	static void CopyDialogResources(
234*cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider >& io_xISP,
235*cdf0e10cSrcweir 		const ScriptDocument& rSourceDoc, const String& rSourceLibName, const ScriptDocument& rDestDoc,
236*cdf0e10cSrcweir 		const String& rDestLibName,	const String& rDlgName );
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
239*cdf0e10cSrcweir                         GetCurrentDocument() const;
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir };
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir #endif // _BASIDESH_HXX
244