update dev300-m58
[ooovba.git] / basctl / source / inc / basidesh.hxx
blobb7f2117ce62312f5d205dfbd6f49041d53e7d076
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: basidesh.hxx,v $
10 * $Revision: 1.10 $
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 ************************************************************************/
30 #ifndef _BASIDESH_HXX
31 #define _BASIDESH_HXX
33 #include "sbxitem.hxx"
35 #include "scriptdocument.hxx"
36 #include "doceventnotifier.hxx"
37 #include <sfx2/viewfac.hxx>
38 #include <sfx2/shell.hxx>
39 #ifndef _SCRBAR_HXX //autogen
40 #include <vcl/scrbar.hxx>
41 #endif
42 #ifndef _TABLE_HXX //autogen
43 #include <tools/table.hxx>
44 #endif
45 #include <sfx2/viewsh.hxx>
46 #include <svx/ifaceids.hxx>
48 #ifndef _COM_SUN_STAR_IO_XINPUTSTREAMPROVIDER_HXX_
49 #include <com/sun/star/io/XInputStreamProvider.hpp>
50 #endif
52 #include <com/sun/star/container/XContainerListener.hpp>
54 //----------------------------------------------------------------------------
56 const ULONG BASICIDE_UI_FEATURE_SHOW_BROWSER = 0x00000001;
58 //----------------------------------------------------------------------------
60 class ModulWindow;
61 class ModulWindowLayout;
62 class DialogWindow;
63 class SdrView;
64 class ObjectCatalog;
65 class BasicIDETabBar;
66 class TabBar;
67 class IDEBaseWindow;
68 class SbxObject;
69 class SbModule;
70 class StarBASIC;
71 class LocalizationMgr;
72 struct BasicIDEShell_Impl;
74 #if _SOLAR__PRIVATE
75 DECLARE_TABLE( IDEWindowTable, IDEBaseWindow* )
76 #else
77 typedef Table IDEWindowTable;
78 #endif
80 namespace BasicIDE
82 bool RemoveDialog( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName );
85 class BasicIDEShell :public SfxViewShell
86 ,public ::basctl::DocumentEventListener
88 friend class JavaDebuggingListenerImpl;
89 friend class LocalizationMgr;
90 friend bool BasicIDE::RemoveDialog( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName );
92 ObjectCatalog* pObjectCatalog;
94 IDEWindowTable aIDEWindowTable;
95 USHORT nCurKey;
96 IDEBaseWindow* pCurWin;
97 ScriptDocument m_aCurDocument;
98 String m_aCurLibName;
99 LocalizationMgr* m_pCurLocalizationMgr;
101 ScrollBar aHScrollBar;
102 ScrollBar aVScrollBar;
103 ScrollBarBox aScrollBarBox;
104 BasicIDETabBar* pTabBar;
105 BOOL bTabBarSplitted;
106 BOOL bCreatingWindow;
107 ModulWindowLayout* pModulLayout;
108 BOOL m_bAppBasicModified;
109 ::basctl::DocumentEventNotifier
110 m_aNotifier;
111 friend class ContainerListenerImpl;
112 ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener;
114 #if _SOLAR__PRIVATE
115 void Init();
116 void InitTabBar();
117 void InitScrollBars();
118 void CheckWindows();
119 void RemoveWindows( const ScriptDocument& rDocument, const String& rLibName, BOOL bDestroy );
120 void UpdateWindows();
121 void ShowObjectDialog( BOOL bShow, BOOL bCreateOrDestroy );
122 void InvalidateBasicIDESlots();
123 void StoreAllWindowData( BOOL bPersistent = TRUE );
124 void SetMDITitle();
125 void EnableScrollbars( BOOL bEnable );
126 void SetCurLib( const ScriptDocument& rDocument, String aLibName, bool bUpdateWindows = true , bool bCheck = true );
127 void SetCurLibForLocalization( const ScriptDocument& rDocument, String aLibName );
129 void ImplStartListening( StarBASIC* pBasic );
131 DECL_LINK( TabBarHdl, TabBar* );
132 DECL_LINK( AccelSelectHdl, Accelerator* );
133 DECL_LINK( ObjectDialogCancelHdl, ObjectCatalog * );
134 DECL_LINK( TabBarSplitHdl, TabBar * );
135 #endif
137 protected:
138 virtual void AdjustPosSizePixel( const Point &rPos, const Size &rSize );
139 virtual void OuterResizePixel( const Point &rPos, const Size &rSize );
140 virtual Size GetOptimalSizePixel() const;
141 USHORT InsertWindowInTable( IDEBaseWindow* pNewWin );
142 virtual USHORT PrepareClose( BOOL bUI, BOOL bForBrowsing );
144 void SetCurWindow( IDEBaseWindow* pNewWin, BOOL bUpdateTabBar = FALSE, BOOL bRememberAsCurrent = TRUE );
145 void ManageToolbars();
146 void RemoveWindow( IDEBaseWindow* pWindow, BOOL bDestroy, BOOL bAllowChangeCurWindow = TRUE );
147 void ArrangeTabBar();
149 ModulWindow* CreateBasWin( const ScriptDocument& rDocument, const String& rLibName, const String& rModName );
150 DialogWindow* CreateDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName );
152 ModulWindow* FindBasWin( const ScriptDocument& rDocument, const String& rLibName, const String& rModName, BOOL bCreateIfNotExist, BOOL bFindSuspended = FALSE );
153 DialogWindow* FindDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName, BOOL bCreateIfNotExist, BOOL bFindSuspended = FALSE );
154 ModulWindow* ShowActiveModuleWindow( StarBASIC* pBasic );
156 virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
157 const SfxHint& rHint, const TypeId& rHintType );
159 virtual void Activate(BOOL bMDI);
160 virtual void Deactivate(BOOL bMDI);
162 virtual void Move();
163 virtual void ShowCursor( FASTBOOL bOn = TRUE );
165 void CreateModulWindowLayout();
166 void DestroyModulWindowLayout();
167 void UpdateModulWindowLayout( bool bBasicStopped );
169 // DocumentEventListener
170 virtual void onDocumentCreated( const ScriptDocument& _rDocument );
171 virtual void onDocumentOpened( const ScriptDocument& _rDocument );
172 virtual void onDocumentSave( const ScriptDocument& _rDocument );
173 virtual void onDocumentSaveDone( const ScriptDocument& _rDocument );
174 virtual void onDocumentSaveAs( const ScriptDocument& _rDocument );
175 virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument );
176 virtual void onDocumentClosed( const ScriptDocument& _rDocument );
177 virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument );
178 virtual void onDocumentModeChanged( const ScriptDocument& _rDocument );
180 public:
181 TYPEINFO();
182 SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH )
183 SFX_DECL_VIEWFACTORY(BasicIDEShell);
185 BasicIDEShell( SfxViewFrame *pFrame, SfxViewShell *pOldSh );
186 ~BasicIDEShell();
188 IDEBaseWindow* GetCurWindow() const { return pCurWin; }
189 const ScriptDocument&
190 GetCurDocument() const { return m_aCurDocument; }
191 const String& GetCurLibName() const { return m_aCurLibName; }
192 ObjectCatalog* GetObjectCatalog() const { return pObjectCatalog; }
193 LocalizationMgr* GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; }
195 ScrollBar& GetHScrollBar() { return aHScrollBar; }
196 ScrollBar& GetVScrollBar() { return aVScrollBar; }
197 ScrollBarBox& GetScrollBarBox() { return aScrollBarBox; }
198 TabBar* GetTabBar() { return (TabBar*)pTabBar; }
199 IDEWindowTable& GetIDEWindowTable() { return aIDEWindowTable; }
201 SdrView* GetCurDlgView() const;
203 SfxUndoManager* GetUndoManager();
205 virtual USHORT Print( SfxProgress &rProgress, BOOL bIsAPI, PrintDialog *pPrintDialog = 0 );
206 virtual SfxPrinter* GetPrinter( BOOL bCreate );
207 virtual USHORT SetPrinter( SfxPrinter *pNewPrinter, USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
208 virtual String GetSelectionText( BOOL bCompleteWords );
209 virtual BOOL HasSelection( BOOL bText ) const;
211 void GetState( SfxItemSet& );
212 void ExecuteGlobal( SfxRequest& rReq );
213 void ExecuteCurrent( SfxRequest& rReq );
214 void ExecuteBasic( SfxRequest& rReq );
215 void ExecuteDialog( SfxRequest& rReq );
217 virtual sal_Bool HasUIFeature( sal_uInt32 nFeature );
219 long CallBasicErrorHdl( StarBASIC* pBasic );
220 long CallBasicBreakHdl( StarBASIC* pBasic );
222 ModulWindowLayout* GetLayoutWindow() const { return pModulLayout; }
224 IDEBaseWindow* FindWindow( const ScriptDocument& rDocument, const String& rLibName = String(), const String& rName = String(), USHORT nType = BASICIDE_TYPE_UNKNOWN, BOOL bFindSuspended = FALSE );
225 IDEBaseWindow* FindApplicationWindow();
226 BOOL NextPage( BOOL bPrev = FALSE );
228 BOOL IsAppBasicModified() const { return m_bAppBasicModified; }
229 void SetAppBasicModified( BOOL bModified = TRUE ) { m_bAppBasicModified = bModified; }
231 // For Dialog Drag&Drop in Dialog Organizer
232 static void CopyDialogResources(
233 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider >& io_xISP,
234 const ScriptDocument& rSourceDoc, const String& rSourceLibName, const ScriptDocument& rDestDoc,
235 const String& rDestLibName, const String& rDlgName );
237 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
238 GetCurrentDocument() const;
242 #endif // _BASIDESH_HXX