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 INCLUDED_BASCTL_SOURCE_INC_BASIDESH_HXX
20 #define INCLUDED_BASCTL_SOURCE_INC_BASIDESH_HXX
22 #include "doceventnotifier.hxx"
23 #include "sbxitem.hxx"
26 #include <com/sun/star/container/XContainerListener.hpp>
27 #include <sfx2/viewsh.hxx>
28 #include <svx/ifaceids.hxx>
29 #include <svl/srchitem.hxx>
30 #include <vcl/scrbar.hxx>
45 class ModulWindowLayout
;
47 class DialogWindowLayout
;
50 class LocalizationMgr
;
54 public DocumentEventListener
57 typedef std::map
<sal_uInt16
, VclPtr
<BaseWindow
> > WindowTable
;
58 typedef WindowTable::const_iterator WindowTableIt
;
61 friend class JavaDebuggingListenerImpl
;
62 friend class LocalizationMgr
;
63 friend bool implImportDialog(weld::Window
* pWin
, const OUString
& rCurPath
, const ScriptDocument
& rDocument
, const OUString
& rLibName
); // defined in baside3.cxx
65 WindowTable aWindowTable
;
67 VclPtr
<BaseWindow
> pCurWin
;
68 ScriptDocument m_aCurDocument
;
69 OUString m_aCurLibName
;
70 std::shared_ptr
<LocalizationMgr
> m_pCurLocalizationMgr
;
72 VclPtr
<ScrollBar
> aHScrollBar
;
73 VclPtr
<ScrollBar
> aVScrollBar
;
74 VclPtr
<ScrollBarBox
> aScrollBarBox
;
75 VclPtr
<TabBar
> pTabBar
; // basctl::TabBar
79 VclPtr
<ModulWindowLayout
> pModulLayout
;
80 VclPtr
<DialogWindowLayout
> pDialogLayout
;
81 VclPtr
<Layout
> pLayout
; // the active layout window
82 // common object catalog window
83 VclPtr
<ObjectCatalog
> aObjectCatalog
;
85 bool m_bAppBasicModified
;
86 bool mbJustOpened
= false;
88 DocumentEventNotifier m_aNotifier
;
90 friend class ContainerListenerImpl
;
91 css::uno::Reference
< css::container::XContainerListener
> m_xLibListener
;
92 std::unique_ptr
<SvxSearchItem
> mpSearchItem
;
96 void InitScrollBars();
98 void RemoveWindows( const ScriptDocument
& rDocument
, const OUString
& rLibName
);
100 static void InvalidateBasicIDESlots();
101 void StoreAllWindowData( bool bPersistent
= true );
103 void EnableScrollbars( bool bEnable
);
104 void SetCurLib( const ScriptDocument
& rDocument
, const OUString
& aLibName
, bool bUpdateWindows
= true , bool bCheck
= true );
105 void SetCurLibForLocalization( const ScriptDocument
& rDocument
, const OUString
& aLibName
);
107 DECL_LINK( TabBarHdl
, ::TabBar
*, void );
109 static unsigned nShellCount
;
112 void AdjustPosSizePixel( const Point
&rPos
, const Size
&rSize
);
113 virtual void OuterResizePixel( const Point
&rPos
, const Size
&rSize
) override
;
114 sal_uInt16
InsertWindowInTable (BaseWindow
* pNewWin
);
115 virtual bool PrepareClose( bool bUI
= true ) override
;
117 void SetCurWindow (BaseWindow
* pNewWin
, bool bUpdateTabBar
= false, bool bRememberAsCurrent
= true);
118 void ManageToolbars();
120 VclPtr
<ModulWindow
> CreateBasWin( const ScriptDocument
& rDocument
, const OUString
& rLibName
, const OUString
& rModName
);
121 VclPtr
<DialogWindow
> CreateDlgWin( const ScriptDocument
& rDocument
, const OUString
& rLibName
, const OUString
& rDlgName
);
123 VclPtr
<ModulWindow
> ShowActiveModuleWindow( StarBASIC
const * pBasic
);
125 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
127 virtual void Activate(bool bMDI
) override
;
128 virtual void Deactivate(bool bMDI
) override
;
130 virtual void Move() override
;
131 virtual void ShowCursor( bool bOn
= true ) override
;
133 // DocumentEventListener
134 virtual void onDocumentCreated( const ScriptDocument
& _rDocument
) override
;
135 virtual void onDocumentOpened( const ScriptDocument
& _rDocument
) override
;
136 virtual void onDocumentSave( const ScriptDocument
& _rDocument
) override
;
137 virtual void onDocumentSaveDone( const ScriptDocument
& _rDocument
) override
;
138 virtual void onDocumentSaveAs( const ScriptDocument
& _rDocument
) override
;
139 virtual void onDocumentSaveAsDone( const ScriptDocument
& _rDocument
) override
;
140 virtual void onDocumentClosed( const ScriptDocument
& _rDocument
) override
;
141 virtual void onDocumentTitleChanged( const ScriptDocument
& _rDocument
) override
;
142 virtual void onDocumentModeChanged( const ScriptDocument
& _rDocument
) override
;
145 SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH
)
146 SFX_DECL_VIEWFACTORY(Shell
);
149 /// SfxInterface initializer.
150 static void InitInterface_Impl();
153 Shell( SfxViewFrame
*pFrame
, SfxViewShell
*pOldSh
);
154 virtual ~Shell() override
;
156 BaseWindow
* GetCurWindow() const { return pCurWin
; }
157 OUString
const& GetCurLibName() const { return m_aCurLibName
; }
158 const std::shared_ptr
<LocalizationMgr
>& GetCurLocalizationMgr() const { return m_pCurLocalizationMgr
; }
160 TabBar
& GetTabBar() { return *pTabBar
; }
161 WindowTable
& GetWindowTable() { return aWindowTable
; }
162 sal_uInt16
GetWindowId (BaseWindow
const* pWin
) const;
164 SdrView
* GetCurDlgView() const;
166 svl::IUndoManager
* GetUndoManager() override
;
168 virtual css::uno::Reference
< css::view::XRenderable
> GetRenderable() override
;
170 // virtual sal_uInt16 Print( SfxProgress &rProgress, sal_Bool bIsAPI, PrintDialog *pPrintDialog = 0 );
171 virtual SfxPrinter
* GetPrinter( bool bCreate
= false ) override
;
172 virtual sal_uInt16
SetPrinter( SfxPrinter
*pNewPrinter
, SfxPrinterChangeFlags nDiffFlags
= SFX_PRINTER_ALL
) override
;
173 virtual OUString
GetSelectionText( bool bCompleteWords
= false ) override
;
174 virtual bool HasSelection( bool bText
= true ) const override
;
176 void GetState( SfxItemSet
& );
177 void ExecuteGlobal( SfxRequest
& rReq
);
178 void ExecuteSearch( SfxRequest
& rReq
);
179 void ExecuteCurrent( SfxRequest
& rReq
);
180 void ExecuteBasic( SfxRequest
& rReq
);
181 void ExecuteDialog( SfxRequest
& rReq
);
183 virtual bool HasUIFeature(SfxShellFeature nFeature
) const override
;
185 bool CallBasicErrorHdl( StarBASIC
const * pBasic
);
186 BasicDebugFlags
CallBasicBreakHdl( StarBASIC
const * pBasic
);
188 VclPtr
<BaseWindow
> FindWindow( const ScriptDocument
& rDocument
, const OUString
& rLibName
, const OUString
& rName
, ItemType nType
, bool bFindSuspended
= false );
189 VclPtr
<DialogWindow
> FindDlgWin( const ScriptDocument
& rDocument
, const OUString
& rLibName
, const OUString
& rName
, bool bCreateIfNotExist
= false, bool bFindSuspended
= false );
190 VclPtr
<ModulWindow
> FindBasWin( const ScriptDocument
& rDocument
, const OUString
& rLibName
, const OUString
& rModName
, bool bCreateIfNotExist
= false, bool bFindSuspended
= false );
191 VclPtr
<BaseWindow
> FindApplicationWindow();
192 bool NextPage( bool bPrev
);
194 bool IsAppBasicModified () const { return m_bAppBasicModified
; }
195 void SetAppBasicModified (bool bModified
) { m_bAppBasicModified
= bModified
; }
197 // For Dialog Drag&Drop in Dialog Organizer:
198 // (defined in moduldlg.cxx)
199 static void CopyDialogResources(
200 css::uno::Reference
< css::io::XInputStreamProvider
>& io_xISP
,
201 const ScriptDocument
& rSourceDoc
, const OUString
& rSourceLibName
, const ScriptDocument
& rDestDoc
,
202 const OUString
& rDestLibName
, const OUString
& rDlgName
);
204 static void InvalidateControlSlots();
206 virtual css::uno::Reference
< css::frame::XModel
>
207 GetCurrentDocument() const override
;
209 void UpdateObjectCatalog () { aObjectCatalog
->UpdateEntries(); }
211 void RemoveWindow (BaseWindow
* pWindow
, bool bDestroy
, bool bAllowChangeCurWindow
= true);
214 } // namespace basctl
216 // This typedef helps baside.sdi,
217 // because I don't know how to use nested names in it.
218 typedef basctl::Shell basctl_Shell
;
220 #endif // INCLUDED_BASCTL_SOURCE_INC_BASIDESH_HXX
222 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */