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