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 : class SdrView;
35 : class TabBar;
36 : class SbxObject;
37 : class SbModule;
38 : class StarBASIC;
39 :
40 : namespace basctl
41 : {
42 : //----------------------------------------------------------------------------
43 :
44 : const sal_uLong BASICIDE_UI_FEATURE_SHOW_BROWSER = 0x00000001;
45 :
46 : //----------------------------------------------------------------------------
47 :
48 : class Layout;
49 : class ModulWindow;
50 : class ModulWindowLayout;
51 : class DialogWindow;
52 : class DialogWindowLayout;
53 : class TabBar;
54 : class BaseWindow;
55 : class LocalizationMgr;
56 :
57 : bool RemoveDialog( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName );
58 :
59 : class Shell :
60 : public SfxViewShell,
61 : public DocumentEventListener
62 : {
63 : public:
64 : typedef std::map<sal_uInt16, BaseWindow*> WindowTable;
65 : typedef WindowTable::const_iterator WindowTableIt;
66 :
67 : private:
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
71 :
72 : WindowTable aWindowTable;
73 : sal_uInt16 nCurKey;
74 : BaseWindow* pCurWin;
75 : ScriptDocument m_aCurDocument;
76 : OUString m_aCurLibName;
77 : boost::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr;
78 :
79 : ScrollBar aHScrollBar;
80 : ScrollBar aVScrollBar;
81 : ScrollBarBox aScrollBarBox;
82 : boost::scoped_ptr<TabBar> pTabBar; // basctl::TabBar
83 : bool bTabBarSplitted;
84 : bool bCreatingWindow;
85 : // layout windows
86 : boost::scoped_ptr<ModulWindowLayout> pModulLayout;
87 : boost::scoped_ptr<DialogWindowLayout> pDialogLayout;
88 : // the active layout window
89 : Layout* pLayout;
90 : // common object catalog window
91 : ObjectCatalog aObjectCatalog;
92 :
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;
97 :
98 : void Init();
99 : void InitTabBar();
100 : void InitScrollBars();
101 : void CheckWindows();
102 : void RemoveWindows( const ScriptDocument& rDocument, const OUString& rLibName, bool bDestroy );
103 : void UpdateWindows();
104 : void InvalidateBasicIDESlots();
105 : void StoreAllWindowData( bool bPersistent = true );
106 : void SetMDITitle();
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 );
110 :
111 : void ImplStartListening( StarBASIC* pBasic );
112 :
113 : DECL_LINK( TabBarHdl, TabBar* );
114 : DECL_LINK( TabBarSplitHdl, TabBar * );
115 :
116 : static unsigned nShellCount;
117 :
118 : private:
119 : virtual void AdjustPosSizePixel( const Point &rPos, const Size &rSize );
120 : virtual void OuterResizePixel( const Point &rPos, const Size &rSize );
121 : virtual Size GetOptimalSizePixel() const;
122 : sal_uInt16 InsertWindowInTable (BaseWindow* pNewWin);
123 : virtual sal_uInt16 PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing );
124 :
125 : void SetCurWindow (BaseWindow* pNewWin, bool bUpdateTabBar = false, bool bRememberAsCurrent = true);
126 : void ManageToolbars();
127 : void ArrangeTabBar();
128 :
129 : ModulWindow* CreateBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName );
130 : DialogWindow* CreateDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName );
131 :
132 : ModulWindow* ShowActiveModuleWindow( StarBASIC* pBasic );
133 :
134 : virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
135 : const SfxHint& rHint, const TypeId& rHintType );
136 :
137 : virtual void Activate(sal_Bool bMDI);
138 : virtual void Deactivate(sal_Bool bMDI);
139 :
140 : virtual void Move();
141 : virtual void ShowCursor( bool bOn = true );
142 :
143 : // DocumentEventListener
144 : virtual void onDocumentCreated( const ScriptDocument& _rDocument );
145 : virtual void onDocumentOpened( const ScriptDocument& _rDocument );
146 : virtual void onDocumentSave( const ScriptDocument& _rDocument );
147 : virtual void onDocumentSaveDone( const ScriptDocument& _rDocument );
148 : virtual void onDocumentSaveAs( const ScriptDocument& _rDocument );
149 : virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument );
150 : virtual void onDocumentClosed( const ScriptDocument& _rDocument );
151 : virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument );
152 : virtual void onDocumentModeChanged( const ScriptDocument& _rDocument );
153 :
154 : public:
155 : TYPEINFO();
156 0 : SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH )
157 0 : SFX_DECL_VIEWFACTORY(Shell);
158 :
159 : Shell( SfxViewFrame *pFrame, SfxViewShell *pOldSh );
160 : ~Shell();
161 :
162 0 : BaseWindow* GetCurWindow() const { return pCurWin; }
163 0 : ScriptDocument const& GetCurDocument() const { return m_aCurDocument; }
164 0 : OUString const& GetCurLibName() const { return m_aCurLibName; }
165 0 : boost::shared_ptr<LocalizationMgr> GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; }
166 :
167 : ScrollBar& GetHScrollBar() { return aHScrollBar; }
168 : ScrollBar& GetVScrollBar() { return aVScrollBar; }
169 : ScrollBarBox& GetScrollBarBox() { return aScrollBarBox; }
170 0 : TabBar& GetTabBar() { return *pTabBar; }
171 0 : WindowTable& GetWindowTable() { return aWindowTable; }
172 : sal_uInt16 GetWindowId (BaseWindow const* pWin) const;
173 :
174 : SdrView* GetCurDlgView() const;
175 :
176 : svl::IUndoManager* GetUndoManager();
177 :
178 : virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable();
179 :
180 : // virtual sal_uInt16 Print( SfxProgress &rProgress, sal_Bool bIsAPI, PrintDialog *pPrintDialog = 0 );
181 : virtual SfxPrinter* GetPrinter( sal_Bool bCreate );
182 : virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
183 : virtual String GetSelectionText( sal_Bool bCompleteWords );
184 : virtual sal_Bool HasSelection( sal_Bool bText ) const;
185 :
186 : void GetState( SfxItemSet& );
187 : void ExecuteGlobal( SfxRequest& rReq );
188 : void ExecuteCurrent( SfxRequest& rReq );
189 : void ExecuteBasic( SfxRequest& rReq );
190 : void ExecuteDialog( SfxRequest& rReq );
191 :
192 : virtual sal_Bool HasUIFeature( sal_uInt32 nFeature );
193 :
194 : long CallBasicErrorHdl( StarBASIC* pBasic );
195 : long CallBasicBreakHdl( StarBASIC* pBasic );
196 :
197 : BaseWindow* FindWindow( const ScriptDocument& rDocument, const OUString& rLibName = OUString(), const OUString& rName = OUString(), ItemType nType = TYPE_UNKNOWN, bool bFindSuspended = false );
198 : DialogWindow* FindDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
199 : ModulWindow* FindBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
200 : BaseWindow* FindApplicationWindow();
201 : bool NextPage( bool bPrev = false );
202 :
203 0 : bool IsAppBasicModified () const { return m_bAppBasicModified; }
204 0 : void SetAppBasicModified (bool bModified = true) { m_bAppBasicModified = bModified; }
205 :
206 : // For Dialog Drag&Drop in Dialog Organizer:
207 : // (defined in moduldlg.cxx)
208 : static void CopyDialogResources(
209 : ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider >& io_xISP,
210 : const ScriptDocument& rSourceDoc, const OUString& rSourceLibName, const ScriptDocument& rDestDoc,
211 : const OUString& rDestLibName, const OUString& rDlgName );
212 :
213 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
214 : GetCurrentDocument() const;
215 :
216 0 : void UpdateObjectCatalog () { aObjectCatalog.UpdateEntries(); }
217 :
218 : void RemoveWindow (BaseWindow* pWindow, bool bDestroy, bool bAllowChangeCurWindow = true);
219 : };
220 :
221 : } // namespace basctl
222 :
223 : // This typedef helps baside.sdi,
224 : // because I don't know how to use nested names in it.
225 : typedef basctl::Shell basctl_Shell;
226 :
227 : #endif // BASCTL_BASIDESH_HXX
228 :
229 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|