1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef BASCTL_BASIDESH_HXX
20 #define BASCTL_BASIDESH_HXX
22 #include "doceventnotifier.hxx"
23 #include "sbxitem.hxx"
24 #include "../basicide/objdlg.hxx"
26 #include <com/sun/star/container/XContainerListener.hpp>
27 #include <sfx2/viewsh.hxx>
28 #include <svx/ifaceids.hxx>
29 #include <vcl/scrbar.hxx>
31 #include <boost/scoped_ptr.hpp>
42 //----------------------------------------------------------------------------
44 const sal_uLong BASICIDE_UI_FEATURE_SHOW_BROWSER
= 0x00000001;
46 //----------------------------------------------------------------------------
50 class ModulWindowLayout
;
52 class DialogWindowLayout
;
55 class LocalizationMgr
;
57 bool RemoveDialog( const ScriptDocument
& rDocument
, const OUString
& rLibName
, const OUString
& rDlgName
);
61 public DocumentEventListener
64 typedef std::map
<sal_uInt16
, BaseWindow
*> WindowTable
;
65 typedef WindowTable::const_iterator WindowTableIt
;
68 friend class JavaDebuggingListenerImpl
;
69 friend class LocalizationMgr
;
70 friend bool implImportDialog( Window
* pWin
, const OUString
& rCurPath
, const ScriptDocument
& rDocument
, const OUString
& aLibName
); // defined in baside3.cxx
72 WindowTable aWindowTable
;
75 ScriptDocument m_aCurDocument
;
76 OUString m_aCurLibName
;
77 boost::shared_ptr
<LocalizationMgr
> m_pCurLocalizationMgr
;
79 ScrollBar aHScrollBar
;
80 ScrollBar aVScrollBar
;
81 ScrollBarBox aScrollBarBox
;
82 boost::scoped_ptr
<TabBar
> pTabBar
; // basctl::TabBar
86 boost::scoped_ptr
<ModulWindowLayout
> pModulLayout
;
87 boost::scoped_ptr
<DialogWindowLayout
> pDialogLayout
;
88 // the active layout window
90 // common object catalog window
91 ObjectCatalog aObjectCatalog
;
93 bool m_bAppBasicModified
;
94 DocumentEventNotifier m_aNotifier
;
95 friend class ContainerListenerImpl
;
96 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XContainerListener
> m_xLibListener
;
100 void InitScrollBars();
102 void RemoveWindows( const ScriptDocument
& rDocument
, const OUString
& rLibName
, bool bDestroy
);
103 void UpdateWindows();
104 void InvalidateBasicIDESlots();
105 void StoreAllWindowData( bool bPersistent
= true );
107 void EnableScrollbars( bool bEnable
);
108 void SetCurLib( const ScriptDocument
& rDocument
, OUString aLibName
, bool bUpdateWindows
= true , bool bCheck
= true );
109 void SetCurLibForLocalization( const ScriptDocument
& rDocument
, OUString aLibName
);
111 void ImplStartListening( StarBASIC
* pBasic
);
113 DECL_LINK( TabBarHdl
, TabBar
* );
114 DECL_LINK( TabBarSplitHdl
, TabBar
* );
116 static unsigned nShellCount
;
119 virtual void AdjustPosSizePixel( const Point
&rPos
, const Size
&rSize
);
120 virtual void OuterResizePixel( const Point
&rPos
, const Size
&rSize
);
121 sal_uInt16
InsertWindowInTable (BaseWindow
* pNewWin
);
122 virtual sal_uInt16
PrepareClose( sal_Bool bUI
, sal_Bool bForBrowsing
);
124 void SetCurWindow (BaseWindow
* pNewWin
, bool bUpdateTabBar
= false, bool bRememberAsCurrent
= true);
125 void ManageToolbars();
126 void ArrangeTabBar();
128 ModulWindow
* CreateBasWin( const ScriptDocument
& rDocument
, const OUString
& rLibName
, const OUString
& rModName
);
129 DialogWindow
* CreateDlgWin( const ScriptDocument
& rDocument
, const OUString
& rLibName
, const OUString
& rDlgName
);
131 ModulWindow
* ShowActiveModuleWindow( StarBASIC
* pBasic
);
133 virtual void SFX_NOTIFY( SfxBroadcaster
& rBC
, const TypeId
& rBCType
,
134 const SfxHint
& rHint
, const TypeId
& rHintType
);
136 virtual void Activate(sal_Bool bMDI
);
137 virtual void Deactivate(sal_Bool bMDI
);
140 virtual void ShowCursor( bool bOn
= true );
142 // DocumentEventListener
143 virtual void onDocumentCreated( const ScriptDocument
& _rDocument
);
144 virtual void onDocumentOpened( const ScriptDocument
& _rDocument
);
145 virtual void onDocumentSave( const ScriptDocument
& _rDocument
);
146 virtual void onDocumentSaveDone( const ScriptDocument
& _rDocument
);
147 virtual void onDocumentSaveAs( const ScriptDocument
& _rDocument
);
148 virtual void onDocumentSaveAsDone( const ScriptDocument
& _rDocument
);
149 virtual void onDocumentClosed( const ScriptDocument
& _rDocument
);
150 virtual void onDocumentTitleChanged( const ScriptDocument
& _rDocument
);
151 virtual void onDocumentModeChanged( const ScriptDocument
& _rDocument
);
155 SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH
)
156 SFX_DECL_VIEWFACTORY(Shell
);
158 Shell( SfxViewFrame
*pFrame
, SfxViewShell
*pOldSh
);
161 BaseWindow
* GetCurWindow() const { return pCurWin
; }
162 ScriptDocument
const& GetCurDocument() const { return m_aCurDocument
; }
163 OUString
const& GetCurLibName() const { return m_aCurLibName
; }
164 boost::shared_ptr
<LocalizationMgr
> GetCurLocalizationMgr() const { return m_pCurLocalizationMgr
; }
166 ScrollBar
& GetHScrollBar() { return aHScrollBar
; }
167 ScrollBar
& GetVScrollBar() { return aVScrollBar
; }
168 ScrollBarBox
& GetScrollBarBox() { return aScrollBarBox
; }
169 TabBar
& GetTabBar() { return *pTabBar
; }
170 WindowTable
& GetWindowTable() { return aWindowTable
; }
171 sal_uInt16
GetWindowId (BaseWindow
const* pWin
) const;
173 SdrView
* GetCurDlgView() const;
175 svl::IUndoManager
* GetUndoManager();
177 virtual com::sun::star::uno::Reference
< com::sun::star::view::XRenderable
> GetRenderable();
179 // virtual sal_uInt16 Print( SfxProgress &rProgress, sal_Bool bIsAPI, PrintDialog *pPrintDialog = 0 );
180 virtual SfxPrinter
* GetPrinter( sal_Bool bCreate
);
181 virtual sal_uInt16
SetPrinter( SfxPrinter
*pNewPrinter
, sal_uInt16 nDiffFlags
= SFX_PRINTER_ALL
, bool bIsAPI
=false );
182 virtual String
GetSelectionText( sal_Bool bCompleteWords
);
183 virtual sal_Bool
HasSelection( sal_Bool bText
) const;
185 void GetState( SfxItemSet
& );
186 void ExecuteGlobal( SfxRequest
& rReq
);
187 void ExecuteCurrent( SfxRequest
& rReq
);
188 void ExecuteBasic( SfxRequest
& rReq
);
189 void ExecuteDialog( SfxRequest
& rReq
);
191 virtual sal_Bool
HasUIFeature( sal_uInt32 nFeature
);
193 long CallBasicErrorHdl( StarBASIC
* pBasic
);
194 long CallBasicBreakHdl( StarBASIC
* pBasic
);
196 BaseWindow
* FindWindow( const ScriptDocument
& rDocument
, const OUString
& rLibName
= OUString(), const OUString
& rName
= OUString(), ItemType nType
= TYPE_UNKNOWN
, bool bFindSuspended
= false );
197 DialogWindow
* FindDlgWin( const ScriptDocument
& rDocument
, const OUString
& rLibName
, const OUString
& rName
, bool bCreateIfNotExist
= false, bool bFindSuspended
= false );
198 ModulWindow
* FindBasWin( const ScriptDocument
& rDocument
, const OUString
& rLibName
, const OUString
& rModName
, bool bCreateIfNotExist
= false, bool bFindSuspended
= false );
199 BaseWindow
* FindApplicationWindow();
200 bool NextPage( bool bPrev
= false );
202 bool IsAppBasicModified () const { return m_bAppBasicModified
; }
203 void SetAppBasicModified (bool bModified
= true) { m_bAppBasicModified
= bModified
; }
205 // For Dialog Drag&Drop in Dialog Organizer:
206 // (defined in moduldlg.cxx)
207 static void CopyDialogResources(
208 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStreamProvider
>& io_xISP
,
209 const ScriptDocument
& rSourceDoc
, const OUString
& rSourceLibName
, const ScriptDocument
& rDestDoc
,
210 const OUString
& rDestLibName
, const OUString
& rDlgName
);
212 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
>
213 GetCurrentDocument() const;
215 void UpdateObjectCatalog () { aObjectCatalog
.UpdateEntries(); }
217 void RemoveWindow (BaseWindow
* pWindow
, bool bDestroy
, bool bAllowChangeCurWindow
= true);
220 } // namespace basctl
222 // This typedef helps baside.sdi,
223 // because I don't know how to use nested names in it.
224 typedef basctl::Shell basctl_Shell
;
226 #endif // BASCTL_BASIDESH_HXX
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */