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