nss: upgrade to release 3.73
[LibreOffice.git] / basctl / source / inc / basidesh.hxx
blob6f04b4269a2b656756ade7c605de783ba3eece01
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
21 #include "doceventnotifier.hxx"
22 #include "sbxitem.hxx"
23 #include "ObjectCatalog.hxx"
25 #include <com/sun/star/container/XContainerListener.hpp>
26 #include <sfx2/viewsh.hxx>
27 #include <svx/ifaceids.hxx>
28 #include <svl/srchitem.hxx>
29 #include <vcl/scrbar.hxx>
30 #include <map>
31 #include <memory>
33 class SfxViewFactory;
34 class SdrView;
35 class TabBar;
36 class SbxObject;
37 class SbModule;
38 class StarBASIC;
40 namespace basctl
42 class Layout;
43 class ModulWindow;
44 class ModulWindowLayout;
45 class DialogWindow;
46 class DialogWindowLayout;
47 class TabBar;
48 class BaseWindow;
49 class LocalizationMgr;
51 class Shell :
52 public SfxViewShell,
53 public DocumentEventListener
55 public:
56 typedef std::map<sal_uInt16, VclPtr<BaseWindow> > WindowTable;
58 private:
59 friend class JavaDebuggingListenerImpl;
60 friend class LocalizationMgr;
61 friend bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& rLibName); // defined in baside3.cxx
63 WindowTable aWindowTable;
64 sal_uInt16 nCurKey;
65 VclPtr<BaseWindow> pCurWin;
66 ScriptDocument m_aCurDocument;
67 OUString m_aCurLibName;
68 std::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr;
70 VclPtr<ScrollBar> aHScrollBar;
71 VclPtr<ScrollBar> aVScrollBar;
72 VclPtr<ScrollBarBox> aScrollBarBox;
73 VclPtr<TabBar> pTabBar; // basctl::TabBar
74 bool bCreatingWindow;
76 // layout windows
77 VclPtr<ModulWindowLayout> pModulLayout;
78 VclPtr<DialogWindowLayout> pDialogLayout;
79 VclPtr<Layout> pLayout; // the active layout window
80 // common object catalog window
81 VclPtr<ObjectCatalog> aObjectCatalog;
83 bool m_bAppBasicModified;
84 bool mbJustOpened = false;
86 DocumentEventNotifier m_aNotifier;
88 friend class ContainerListenerImpl;
89 css::uno::Reference< css::container::XContainerListener > m_xLibListener;
90 std::unique_ptr<SvxSearchItem> mpSearchItem;
92 void Init();
93 void InitTabBar();
94 void InitScrollBars();
95 void CheckWindows();
96 void RemoveWindows( const ScriptDocument& rDocument, const OUString& rLibName );
97 void UpdateWindows();
98 static void InvalidateBasicIDESlots();
99 void StoreAllWindowData( bool bPersistent = true );
100 void SetMDITitle();
101 void EnableScrollbars( bool bEnable );
102 void SetCurLib( const ScriptDocument& rDocument, const OUString& aLibName, bool bUpdateWindows = true , bool bCheck = true );
103 void SetCurLibForLocalization( const ScriptDocument& rDocument, const OUString& aLibName );
105 DECL_LINK( TabBarHdl, ::TabBar*, void );
107 static unsigned nShellCount;
109 private:
110 void AdjustPosSizePixel( const Point &rPos, const Size &rSize );
111 virtual void OuterResizePixel( const Point &rPos, const Size &rSize ) override;
112 sal_uInt16 InsertWindowInTable (BaseWindow* pNewWin);
113 virtual bool PrepareClose( bool bUI = true ) override;
115 void SetCurWindow (BaseWindow* pNewWin, bool bUpdateTabBar = false, bool bRememberAsCurrent = true);
116 void ManageToolbars();
118 VclPtr<ModulWindow> CreateBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName );
119 VclPtr<DialogWindow> CreateDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName );
121 VclPtr<ModulWindow> ShowActiveModuleWindow( StarBASIC const * pBasic );
123 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
125 virtual void Activate(bool bMDI) override;
126 virtual void Deactivate(bool bMDI) override;
128 virtual void Move() override;
129 virtual void ShowCursor( bool bOn = true ) override;
131 // DocumentEventListener
132 virtual void onDocumentCreated( const ScriptDocument& _rDocument ) override;
133 virtual void onDocumentOpened( const ScriptDocument& _rDocument ) override;
134 virtual void onDocumentSave( const ScriptDocument& _rDocument ) override;
135 virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ) override;
136 virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ) override;
137 virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ) override;
138 virtual void onDocumentClosed( const ScriptDocument& _rDocument ) override;
139 virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ) override;
140 virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ) override;
142 public:
143 SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH )
144 SFX_DECL_VIEWFACTORY(Shell);
146 private:
147 /// SfxInterface initializer.
148 static void InitInterface_Impl();
150 public:
151 Shell( SfxViewFrame *pFrame, SfxViewShell *pOldSh );
152 virtual ~Shell() override;
154 BaseWindow* GetCurWindow() const { return pCurWin; }
155 OUString const& GetCurLibName() const { return m_aCurLibName; }
156 const std::shared_ptr<LocalizationMgr>& GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; }
158 TabBar& GetTabBar() { return *pTabBar; }
159 WindowTable& GetWindowTable() { return aWindowTable; }
160 sal_uInt16 GetWindowId (BaseWindow const* pWin) const;
162 SdrView* GetCurDlgView() const;
164 SfxUndoManager* GetUndoManager() override;
166 virtual css::uno::Reference< css::view::XRenderable > GetRenderable() override;
168 // virtual sal_uInt16 Print( SfxProgress &rProgress, sal_Bool bIsAPI, PrintDialog *pPrintDialog = 0 );
169 virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
170 virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL ) override;
171 virtual OUString GetSelectionText( bool bCompleteWords = false ) override;
172 virtual bool HasSelection( bool bText = true ) const override;
174 void GetState( SfxItemSet& );
175 void ExecuteGlobal( SfxRequest& rReq );
176 void ExecuteSearch( SfxRequest& rReq );
177 void ExecuteCurrent( SfxRequest& rReq );
178 void ExecuteBasic( SfxRequest& rReq );
179 void ExecuteDialog( SfxRequest& rReq );
181 virtual bool HasUIFeature(SfxShellFeature nFeature) const override;
183 bool CallBasicErrorHdl( StarBASIC const * pBasic );
184 BasicDebugFlags CallBasicBreakHdl( StarBASIC const * pBasic );
186 VclPtr<BaseWindow> FindWindow( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rName, ItemType nType, bool bFindSuspended = false );
187 VclPtr<DialogWindow> FindDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
188 VclPtr<ModulWindow> FindBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
189 VclPtr<BaseWindow> FindApplicationWindow();
190 bool NextPage( bool bPrev );
192 bool IsAppBasicModified () const { return m_bAppBasicModified; }
193 void SetAppBasicModified (bool bModified) { m_bAppBasicModified = bModified; }
195 // For Dialog Drag&Drop in Dialog Organizer:
196 // (defined in moduldlg.cxx)
197 static void CopyDialogResources(
198 css::uno::Reference< css::io::XInputStreamProvider >& io_xISP,
199 const ScriptDocument& rSourceDoc, const OUString& rSourceLibName, const ScriptDocument& rDestDoc,
200 const OUString& rDestLibName, const OUString& rDlgName );
202 static void InvalidateControlSlots();
204 virtual css::uno::Reference< css::frame::XModel >
205 GetCurrentDocument() const override;
207 void UpdateObjectCatalog () { aObjectCatalog->UpdateEntries(); }
209 void RemoveWindow (BaseWindow* pWindow, bool bDestroy, bool bAllowChangeCurWindow = true);
212 } // namespace basctl
214 // This typedef helps baside.sdi,
215 // because I don't know how to use nested names in it.
216 typedef basctl::Shell basctl_Shell;
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */