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 INCLUDED_BASCTL_SOURCE_INC_BASIDESH_HXX
20 : #define INCLUDED_BASCTL_SOURCE_INC_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 : const sal_uLong BASICIDE_UI_FEATURE_SHOW_BROWSER = 0x00000001;
44 :
45 : class Layout;
46 : class ModulWindow;
47 : class ModulWindowLayout;
48 : class DialogWindow;
49 : class DialogWindowLayout;
50 : class TabBar;
51 : class BaseWindow;
52 : class LocalizationMgr;
53 :
54 : class Shell :
55 : public SfxViewShell,
56 : public DocumentEventListener
57 : {
58 : public:
59 : typedef std::map<sal_uInt16, BaseWindow*> WindowTable;
60 : typedef WindowTable::const_iterator WindowTableIt;
61 :
62 : private:
63 : friend class JavaDebuggingListenerImpl;
64 : friend class LocalizationMgr;
65 : friend bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName ); // defined in baside3.cxx
66 :
67 : WindowTable aWindowTable;
68 : sal_uInt16 nCurKey;
69 : BaseWindow* pCurWin;
70 : ScriptDocument m_aCurDocument;
71 : OUString m_aCurLibName;
72 : boost::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr;
73 :
74 : ScrollBar aHScrollBar;
75 : ScrollBar aVScrollBar;
76 : ScrollBarBox aScrollBarBox;
77 : boost::scoped_ptr<TabBar> pTabBar; // basctl::TabBar
78 : bool bTabBarSplitted;
79 : bool bCreatingWindow;
80 : // layout windows
81 : boost::scoped_ptr<ModulWindowLayout> pModulLayout;
82 : boost::scoped_ptr<DialogWindowLayout> pDialogLayout;
83 : // the active layout window
84 : Layout* pLayout;
85 : // common object catalog window
86 : ObjectCatalog aObjectCatalog;
87 :
88 : bool m_bAppBasicModified;
89 : DocumentEventNotifier m_aNotifier;
90 : friend class ContainerListenerImpl;
91 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener;
92 :
93 : void Init();
94 : void InitTabBar();
95 : void InitScrollBars();
96 : void CheckWindows();
97 : void RemoveWindows( const ScriptDocument& rDocument, const OUString& rLibName, bool bDestroy );
98 : void UpdateWindows();
99 : void InvalidateBasicIDESlots();
100 : void StoreAllWindowData( bool bPersistent = true );
101 : void SetMDITitle();
102 : void EnableScrollbars( bool bEnable );
103 : void SetCurLib( const ScriptDocument& rDocument, const OUString& aLibName, bool bUpdateWindows = true , bool bCheck = true );
104 : void SetCurLibForLocalization( const ScriptDocument& rDocument, const OUString& aLibName );
105 :
106 : void ImplStartListening( StarBASIC* pBasic );
107 :
108 : DECL_LINK( TabBarHdl, TabBar* );
109 : DECL_LINK( TabBarSplitHdl, TabBar * );
110 :
111 : static unsigned nShellCount;
112 :
113 : private:
114 : virtual void AdjustPosSizePixel( const Point &rPos, const Size &rSize ) SAL_OVERRIDE;
115 : virtual void OuterResizePixel( const Point &rPos, const Size &rSize ) SAL_OVERRIDE;
116 : sal_uInt16 InsertWindowInTable (BaseWindow* pNewWin);
117 : virtual bool PrepareClose( bool bUI ) SAL_OVERRIDE;
118 :
119 : void SetCurWindow (BaseWindow* pNewWin, bool bUpdateTabBar = false, bool bRememberAsCurrent = true);
120 : void ManageToolbars();
121 : void ArrangeTabBar();
122 :
123 : ModulWindow* CreateBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName );
124 : DialogWindow* CreateDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName );
125 :
126 : ModulWindow* ShowActiveModuleWindow( StarBASIC* pBasic );
127 :
128 : virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
129 : const SfxHint& rHint, const TypeId& rHintType ) SAL_OVERRIDE;
130 :
131 : virtual void Activate(bool bMDI) SAL_OVERRIDE;
132 : virtual void Deactivate(bool bMDI) SAL_OVERRIDE;
133 :
134 : virtual void Move() SAL_OVERRIDE;
135 : virtual void ShowCursor( bool bOn = true ) SAL_OVERRIDE;
136 :
137 : // DocumentEventListener
138 : virtual void onDocumentCreated( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
139 : virtual void onDocumentOpened( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
140 : virtual void onDocumentSave( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
141 : virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
142 : virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
143 : virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
144 : virtual void onDocumentClosed( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
145 : virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
146 : virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ) SAL_OVERRIDE;
147 :
148 : public:
149 : TYPEINFO_OVERRIDE();
150 0 : SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH )
151 0 : SFX_DECL_VIEWFACTORY(Shell);
152 :
153 : private:
154 : /// SfxInterface initializer.
155 : static void InitInterface_Impl();
156 :
157 : public:
158 : Shell( SfxViewFrame *pFrame, SfxViewShell *pOldSh );
159 : virtual ~Shell();
160 :
161 0 : BaseWindow* GetCurWindow() const { return pCurWin; }
162 0 : ScriptDocument const& GetCurDocument() const { return m_aCurDocument; }
163 0 : OUString const& GetCurLibName() const { return m_aCurLibName; }
164 0 : boost::shared_ptr<LocalizationMgr> GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; }
165 :
166 : ScrollBar& GetHScrollBar() { return aHScrollBar; }
167 : ScrollBar& GetVScrollBar() { return aVScrollBar; }
168 : ScrollBarBox& GetScrollBarBox() { return aScrollBarBox; }
169 0 : TabBar& GetTabBar() { return *pTabBar; }
170 0 : WindowTable& GetWindowTable() { return aWindowTable; }
171 : sal_uInt16 GetWindowId (BaseWindow const* pWin) const;
172 :
173 : SdrView* GetCurDlgView() const;
174 :
175 : svl::IUndoManager* GetUndoManager() SAL_OVERRIDE;
176 :
177 : virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable() SAL_OVERRIDE;
178 :
179 : // virtual sal_uInt16 Print( SfxProgress &rProgress, sal_Bool bIsAPI, PrintDialog *pPrintDialog = 0 );
180 : virtual SfxPrinter* GetPrinter( bool bCreate ) SAL_OVERRIDE;
181 : virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ) SAL_OVERRIDE;
182 : virtual OUString GetSelectionText( bool bCompleteWords ) SAL_OVERRIDE;
183 : virtual bool HasSelection( bool bText ) const SAL_OVERRIDE;
184 :
185 : void GetState( SfxItemSet& );
186 : void ExecuteGlobal( SfxRequest& rReq );
187 : void ExecuteCurrent( SfxRequest& rReq );
188 : void ExecuteBasic( SfxRequest& rReq );
189 : void ExecuteDialog( SfxRequest& rReq );
190 :
191 : virtual bool HasUIFeature( sal_uInt32 nFeature ) SAL_OVERRIDE;
192 :
193 : bool CallBasicErrorHdl( StarBASIC* pBasic );
194 : long CallBasicBreakHdl( StarBASIC* pBasic );
195 :
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 );
201 :
202 0 : bool IsAppBasicModified () const { return m_bAppBasicModified; }
203 0 : void SetAppBasicModified (bool bModified = true) { m_bAppBasicModified = bModified; }
204 :
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 );
211 :
212 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
213 : GetCurrentDocument() const SAL_OVERRIDE;
214 :
215 0 : void UpdateObjectCatalog () { aObjectCatalog.UpdateEntries(); }
216 :
217 : void RemoveWindow (BaseWindow* pWindow, bool bDestroy, bool bAllowChangeCurWindow = true);
218 : };
219 :
220 : } // namespace basctl
221 :
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;
225 :
226 : #endif // INCLUDED_BASCTL_SOURCE_INC_BASIDESH_HXX
227 :
228 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|