Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : : #ifndef BASCTL_BASIDESH_HXX
20 : : #define BASCTL_BASIDESH_HXX
21 : :
22 : : #include "doceventnotifier.hxx"
23 : : #include "sbxitem.hxx"
24 : : #include "../basicide/objdlg.hxx"
25 : :
26 : : #include <com/sun/star/container/XContainerListener.hpp>
27 : : #include <sfx2/viewsh.hxx>
28 : : #include <svx/ifaceids.hxx>
29 : : #include <vcl/scrbar.hxx>
30 : : #include <map>
31 : : #include <boost/scoped_ptr.hpp>
32 : :
33 : : class SfxViewFactory;
34 : :
35 : : //----------------------------------------------------------------------------
36 : :
37 : : const sal_uLong BASICIDE_UI_FEATURE_SHOW_BROWSER = 0x00000001;
38 : :
39 : : //----------------------------------------------------------------------------
40 : :
41 : : namespace basctl
42 : : {
43 : : class Layout;
44 : : class ModulWindow;
45 : : class ModulWindowLayout;
46 : : class DialogWindow;
47 : : class DialogWindowLayout;
48 : : }
49 : : class SdrView;
50 : : class BasicIDETabBar;
51 : : class TabBar;
52 : : class IDEBaseWindow;
53 : : class SbxObject;
54 : : class SbModule;
55 : : class StarBASIC;
56 : : class LocalizationMgr;
57 : :
58 : : #if _SOLAR__PRIVATE
59 : : typedef std::map<sal_uInt16, IDEBaseWindow*> IDEWindowTable;
60 : : #else
61 : : typedef std::map<sal_uInt16, void*> IDEWindowTable;
62 : : #endif
63 : :
64 : : namespace BasicIDE
65 : : {
66 : : bool RemoveDialog( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rDlgName );
67 : : }
68 : :
69 : : class BasicIDEShell :
70 : : public SfxViewShell,
71 : : public basctl::DocumentEventListener
72 : : {
73 : : typedef basctl::DialogWindow DialogWindow;
74 : : typedef basctl::ModulWindow ModulWindow;
75 : :
76 : : friend class JavaDebuggingListenerImpl;
77 : : friend class LocalizationMgr;
78 : : friend bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName );
79 : :
80 : : typedef IDEWindowTable::const_iterator WindowTableIt;
81 : :
82 : : IDEWindowTable aIDEWindowTable;
83 : : sal_uInt16 nCurKey;
84 : : IDEBaseWindow* pCurWin;
85 : : ScriptDocument m_aCurDocument;
86 : : ::rtl::OUString m_aCurLibName;
87 : : boost::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr;
88 : :
89 : : ScrollBar aHScrollBar;
90 : : ScrollBar aVScrollBar;
91 : : ScrollBarBox aScrollBarBox;
92 : : BasicIDETabBar* pTabBar;
93 : : bool bTabBarSplitted;
94 : : bool bCreatingWindow;
95 : : // layout windows
96 : : boost::scoped_ptr<basctl::ModulWindowLayout> pModulLayout;
97 : : boost::scoped_ptr<basctl::DialogWindowLayout> pDialogLayout;
98 : : // the active layout window
99 : : basctl::Layout* pLayout;
100 : : // common object catalog window
101 : : basctl::ObjectCatalog aObjectCatalog;
102 : :
103 : : bool m_bAppBasicModified;
104 : : ::basctl::DocumentEventNotifier
105 : : m_aNotifier;
106 : : friend class ContainerListenerImpl;
107 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener;
108 : :
109 : : #if _SOLAR__PRIVATE
110 : : void Init();
111 : : void InitTabBar();
112 : : void InitScrollBars();
113 : : void CheckWindows();
114 : : void RemoveWindows( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, bool bDestroy );
115 : : void UpdateWindows();
116 : : void InvalidateBasicIDESlots();
117 : : void StoreAllWindowData( bool bPersistent = true );
118 : : void SetMDITitle();
119 : : void EnableScrollbars( bool bEnable );
120 : : void SetCurLib( const ScriptDocument& rDocument, ::rtl::OUString aLibName, bool bUpdateWindows = true , bool bCheck = true );
121 : : void SetCurLibForLocalization( const ScriptDocument& rDocument, ::rtl::OUString aLibName );
122 : :
123 : : void ImplStartListening( StarBASIC* pBasic );
124 : :
125 : : DECL_LINK( TabBarHdl, TabBar* );
126 : : DECL_LINK( TabBarSplitHdl, TabBar * );
127 : : #endif
128 : :
129 : : protected:
130 : : virtual void AdjustPosSizePixel( const Point &rPos, const Size &rSize );
131 : : virtual void OuterResizePixel( const Point &rPos, const Size &rSize );
132 : : virtual Size GetOptimalSizePixel() const;
133 : : sal_uInt16 InsertWindowInTable( IDEBaseWindow* pNewWin );
134 : : virtual sal_uInt16 PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing );
135 : :
136 : : void SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar = false, bool bRememberAsCurrent = true );
137 : : void ManageToolbars();
138 : : void ArrangeTabBar();
139 : :
140 : : ModulWindow* CreateBasWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModName );
141 : : DialogWindow* CreateDlgWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rDlgName );
142 : :
143 : : ModulWindow* ShowActiveModuleWindow( StarBASIC* pBasic );
144 : :
145 : : virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
146 : : const SfxHint& rHint, const TypeId& rHintType );
147 : :
148 : : virtual void Activate(sal_Bool bMDI);
149 : : virtual void Deactivate(sal_Bool bMDI);
150 : :
151 : : virtual void Move();
152 : : virtual void ShowCursor( bool bOn = true );
153 : :
154 : : // DocumentEventListener
155 : : virtual void onDocumentCreated( const ScriptDocument& _rDocument );
156 : : virtual void onDocumentOpened( const ScriptDocument& _rDocument );
157 : : virtual void onDocumentSave( const ScriptDocument& _rDocument );
158 : : virtual void onDocumentSaveDone( const ScriptDocument& _rDocument );
159 : : virtual void onDocumentSaveAs( const ScriptDocument& _rDocument );
160 : : virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument );
161 : : virtual void onDocumentClosed( const ScriptDocument& _rDocument );
162 : : virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument );
163 : : virtual void onDocumentModeChanged( const ScriptDocument& _rDocument );
164 : :
165 : : public:
166 : : TYPEINFO();
167 : 0 : SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH )
168 : 0 : SFX_DECL_VIEWFACTORY(BasicIDEShell);
169 : :
170 : : BasicIDEShell( SfxViewFrame *pFrame, SfxViewShell *pOldSh );
171 : : ~BasicIDEShell();
172 : :
173 : 0 : IDEBaseWindow* GetCurWindow() const { return pCurWin; }
174 : : const ScriptDocument&
175 : 0 : GetCurDocument() const { return m_aCurDocument; }
176 : 0 : const ::rtl::OUString& GetCurLibName() const { return m_aCurLibName; }
177 : 0 : boost::shared_ptr<LocalizationMgr> GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; }
178 : :
179 : : ScrollBar& GetHScrollBar() { return aHScrollBar; }
180 : : ScrollBar& GetVScrollBar() { return aVScrollBar; }
181 : : ScrollBarBox& GetScrollBarBox() { return aScrollBarBox; }
182 : 0 : TabBar* GetTabBar() { return (TabBar*)pTabBar; }
183 : 0 : IDEWindowTable& GetIDEWindowTable() { return aIDEWindowTable; }
184 : : sal_uInt16 GetIDEWindowId(const IDEBaseWindow* pWin) const;
185 : :
186 : : SdrView* GetCurDlgView() const;
187 : :
188 : : ::svl::IUndoManager*
189 : : GetUndoManager();
190 : :
191 : : virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable();
192 : :
193 : : // virtual sal_uInt16 Print( SfxProgress &rProgress, sal_Bool bIsAPI, PrintDialog *pPrintDialog = 0 );
194 : : virtual SfxPrinter* GetPrinter( sal_Bool bCreate );
195 : : virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
196 : : virtual String GetSelectionText( sal_Bool bCompleteWords );
197 : : virtual sal_Bool HasSelection( sal_Bool bText ) const;
198 : :
199 : : void GetState( SfxItemSet& );
200 : : void ExecuteGlobal( SfxRequest& rReq );
201 : : void ExecuteCurrent( SfxRequest& rReq );
202 : : void ExecuteBasic( SfxRequest& rReq );
203 : : void ExecuteDialog( SfxRequest& rReq );
204 : :
205 : : virtual sal_Bool HasUIFeature( sal_uInt32 nFeature );
206 : :
207 : : long CallBasicErrorHdl( StarBASIC* pBasic );
208 : : long CallBasicBreakHdl( StarBASIC* pBasic );
209 : :
210 : : IDEBaseWindow* FindWindow( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName = ::rtl::OUString(), const ::rtl::OUString& rName = ::rtl::OUString(), BasicIDEType nType = BASICIDE_TYPE_UNKNOWN, bool bFindSuspended = false );
211 : : DialogWindow* FindDlgWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
212 : : ModulWindow* FindBasWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
213 : : IDEBaseWindow* FindApplicationWindow();
214 : : bool NextPage( bool bPrev = false );
215 : :
216 : 0 : bool IsAppBasicModified () const { return m_bAppBasicModified; }
217 : 0 : void SetAppBasicModified (bool bModified = true) { m_bAppBasicModified = bModified; }
218 : :
219 : : // For Dialog Drag&Drop in Dialog Organizer
220 : : static void CopyDialogResources(
221 : : ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider >& io_xISP,
222 : : const ScriptDocument& rSourceDoc, const ::rtl::OUString& rSourceLibName, const ScriptDocument& rDestDoc,
223 : : const ::rtl::OUString& rDestLibName, const ::rtl::OUString& rDlgName );
224 : :
225 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
226 : : GetCurrentDocument() const;
227 : :
228 : 0 : void UpdateObjectCatalog () { aObjectCatalog.UpdateEntries(); }
229 : :
230 : : void RemoveWindow (IDEBaseWindow* pWindow, bool bDestroy, bool bAllowChangeCurWindow = true);
231 : : };
232 : :
233 : : #endif // BASCTL_BASIDESH_HXX
234 : :
235 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|