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 .
21 #include <strings.hrc>
24 #include "baside2.hxx"
25 #include <baside3.hxx>
26 #include <docsignature.hxx>
27 #include <iderdll.hxx>
28 #include "iderdll2.hxx"
29 #include <localizationmgr.hxx>
30 #include <managelang.hxx>
32 #include <basic/basmgr.hxx>
33 #include <basic/sbmeth.hxx>
34 #include <com/sun/star/script/ModuleType.hpp>
35 #include <com/sun/star/script/XLibraryContainerPassword.hpp>
36 #include <com/sun/star/frame/XLayoutManager.hpp>
37 #include <sfx2/childwin.hxx>
38 #include <sfx2/docfac.hxx>
39 #include <sfx2/dinfdlg.hxx>
40 #include <sfx2/dispatch.hxx>
41 #include <sfx2/minfitem.hxx>
42 #include <sfx2/printer.hxx>
43 #include <sfx2/request.hxx>
44 #include <svx/svxids.hrc>
45 #include <svl/aeitem.hxx>
46 #include <svl/intitem.hxx>
47 #include <svl/srchitem.hxx>
48 #include <svl/visitem.hxx>
49 #include <svl/whiter.hxx>
50 #include <vcl/xtextedt.hxx>
51 #include <vcl/msgbox.hxx>
56 using namespace ::com::sun::star
;
57 using namespace ::com::sun::star::uno
;
58 using namespace ::com::sun::star::frame
;
60 void Shell::ExecuteCurrent( SfxRequest
& rReq
)
65 switch ( rReq
.GetSlot() )
67 case SID_BASICIDE_HIDECURPAGE
:
70 RemoveWindow( pCurWin
, false );
73 case SID_BASICIDE_RENAMECURRENT
:
75 pTabBar
->StartEditMode( pTabBar
->GetCurPageId() );
80 if (!pCurWin
->HasActiveEditor())
82 DBG_ASSERT( rReq
.GetArgs(), "arguments expected" );
83 SfxItemSet
const& rArgs
= *rReq
.GetArgs();
84 // unfortunately I don't know the ID:
85 sal_uInt16 nWhich
= rArgs
.GetWhichByPos( 0 );
86 DBG_ASSERT( nWhich
, "Which for SearchItem?" );
87 SfxPoolItem
const& rItem
= rArgs
.Get(nWhich
);
88 DBG_ASSERT(dynamic_cast<SvxSearchItem
const*>(&rItem
), "no searchitem!");
89 SvxSearchItem
const& rSearchItem
= static_cast<SvxSearchItem
const&>(rItem
);
90 // memorize item because of the adjustments...
91 GetExtraData()->SetSearchItem(rSearchItem
);
93 if (rSearchItem
.GetCommand() == SvxSearchCmd::REPLACE_ALL
)
95 sal_uInt16 nActModWindows
= 0;
96 for (WindowTableIt it
= aWindowTable
.begin(); it
!= aWindowTable
.end(); ++it
)
98 BaseWindow
* pWin
= it
->second
;
99 if (pWin
->HasActiveEditor())
103 if ( nActModWindows
<= 1 || ( !rSearchItem
.GetSelection() && ScopedVclPtrInstance
<QueryBox
>(pCurWin
, MessBoxStyle::YesNo
|MessBoxStyle::DefaultYes
, IDEResId(RID_STR_SEARCHALLMODULES
))->Execute() == RET_YES
) )
105 for (WindowTableIt it
= aWindowTable
.begin(); it
!= aWindowTable
.end(); ++it
)
107 BaseWindow
* pWin
= it
->second
;
108 nFound
+= pWin
->StartSearchAndReplace(rSearchItem
);
112 nFound
= pCurWin
->StartSearchAndReplace(rSearchItem
);
114 OUString
aReplStr(IDEResId(RID_STR_SEARCHREPLACES
));
115 aReplStr
= aReplStr
.replaceAll("XX", OUString::number(nFound
));
116 ScopedVclPtrInstance
<InfoBox
>(pCurWin
, aReplStr
)->Execute();
120 bool bCanceled
= false;
121 nFound
= pCurWin
->StartSearchAndReplace(rSearchItem
);
122 if ( !nFound
&& !rSearchItem
.GetSelection() )
124 // search other modules...
125 bool bChangeCurWindow
= false;
127 for (it
= aWindowTable
.begin(); it
!= aWindowTable
.end(); ++it
)
128 if (it
->second
== pCurWin
)
130 if (it
!= aWindowTable
.end())
132 BaseWindow
* pWin
= it
!= aWindowTable
.end() ? it
->second
.get() : nullptr;
134 bool bSearchedFromStart
= false;
135 while ( !nFound
&& !bCanceled
&& ( pWin
|| !bSearchedFromStart
) )
139 SfxViewFrame
* pViewFrame
= GetViewFrame();
140 SfxChildWindow
* pChildWin
= pViewFrame
? pViewFrame
->GetChildWindow( SID_SEARCH_DLG
) : nullptr;
141 vcl::Window
* pParent
= pChildWin
? pChildWin
->GetWindow() : nullptr;
142 ScopedVclPtrInstance
< QueryBox
> aQuery(pParent
, MessBoxStyle::YesNo
|MessBoxStyle::DefaultYes
, IDEResId(RID_STR_SEARCHFROMSTART
));
143 if ( aQuery
->Execute() == RET_YES
)
145 it
= aWindowTable
.begin();
146 if ( it
!= aWindowTable
.end() )
148 bSearchedFromStart
= true;
154 if (pWin
&& pWin
->HasActiveEditor())
156 if ( pWin
!= pCurWin
)
159 pWin
->SetSizePixel( pCurWin
->GetSizePixel() );
160 nFound
= pWin
->StartSearchAndReplace(rSearchItem
, true);
164 bChangeCurWindow
= true;
168 if ( pWin
&& ( pWin
!= pCurWin
) )
170 if ( it
!= aWindowTable
.end() )
172 pWin
= it
!= aWindowTable
.end() ? it
->second
.get() : nullptr;
177 if ( !nFound
&& bSearchedFromStart
)
178 nFound
= pCurWin
->StartSearchAndReplace(rSearchItem
, true);
179 if ( bChangeCurWindow
)
180 SetCurWindow( pWin
, true );
182 if ( !nFound
&& !bCanceled
)
183 ScopedVclPtrInstance
<InfoBox
>(pCurWin
, IDEResId(RID_STR_SEARCHNOTFOUND
))->Execute();
191 if ( GetUndoManager() && pCurWin
->AllowUndo() )
192 GetViewFrame()->ExecuteSlot( rReq
);
195 pCurWin
->ExecuteCommand( rReq
);
199 // no matter who's at the top, influence on the shell:
200 void Shell::ExecuteGlobal( SfxRequest
& rReq
)
202 sal_uInt16 nSlot
= rReq
.GetSlot();
207 // maybe do not simply stop if on breakpoint!
208 if (ModulWindow
* pMCurWin
= dynamic_cast<ModulWindow
*>(pCurWin
.get()))
209 pMCurWin
->BasicStop();
218 // rewrite date into the BASIC
219 StoreAllWindowData();
222 ScriptDocument
aDocument( pCurWin
->GetDocument() );
223 if ( aDocument
.isDocument() )
225 uno::Reference
< task::XStatusIndicator
> xStatusIndicator
;
227 const SfxUnoAnyItem
* pStatusIndicatorItem
= rReq
.GetArg
<SfxUnoAnyItem
>(SID_PROGRESS_STATUSBAR_CONTROL
);
228 if ( pStatusIndicatorItem
)
229 OSL_VERIFY( pStatusIndicatorItem
->GetValue() >>= xStatusIndicator
);
232 // get statusindicator
233 SfxViewFrame
*pFrame_
= GetFrame();
236 uno::Reference
< task::XStatusIndicatorFactory
> xStatFactory(
237 pFrame_
->GetFrame().GetFrameInterface(),
239 if( xStatFactory
.is() )
240 xStatusIndicator
= xStatFactory
->createStatusIndicator();
243 if ( xStatusIndicator
.is() )
244 rReq
.AppendItem( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL
, uno::Any( xStatusIndicator
) ) );
247 aDocument
.saveDocument( xStatusIndicator
);
250 if (SfxBindings
* pBindings
= GetBindingsPtr())
252 pBindings
->Invalidate( SID_DOC_MODIFIED
);
253 pBindings
->Invalidate( SID_SAVEDOC
);
254 pBindings
->Invalidate( SID_SIGNATURE
);
259 case SID_BASICIDE_MODULEDLG
:
261 if ( rReq
.GetArgs() )
263 const SfxUInt16Item
&rTabId
= static_cast<const SfxUInt16Item
&>(rReq
.GetArgs()->Get(SID_BASICIDE_ARG_TABID
));
264 Organize( rTabId
.GetValue() );
270 case SID_BASICIDE_CHOOSEMACRO
:
272 ChooseMacro( nullptr );
275 case SID_BASICIDE_CREATEMACRO
:
276 case SID_BASICIDE_EDITMACRO
:
278 DBG_ASSERT( rReq
.GetArgs(), "arguments expected" );
279 const SfxMacroInfoItem
& rInfo
= static_cast<const SfxMacroInfoItem
&>(rReq
.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO
));
280 BasicManager
* pBasMgr
= const_cast<BasicManager
*>(rInfo
.GetBasicManager());
281 DBG_ASSERT( pBasMgr
, "Nothing selected in basic tree?" );
283 ScriptDocument
aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr
) );
285 StartListening(*pBasMgr
, DuplicateHandling::Prevent
/* log on only once */);
286 OUString
aLibName( rInfo
.GetLib() );
287 if ( aLibName
.isEmpty() )
288 aLibName
= "Standard" ;
289 StarBASIC
* pBasic
= pBasMgr
->GetLib( aLibName
);
292 // load module and dialog library (if not loaded)
293 aDocument
.loadLibraryIfExists( E_SCRIPTS
, aLibName
);
294 aDocument
.loadLibraryIfExists( E_DIALOGS
, aLibName
);
297 pBasic
= pBasMgr
->GetLib( aLibName
);
299 DBG_ASSERT( pBasic
, "No Basic!" );
301 SetCurLib( aDocument
, aLibName
);
303 if ( pBasic
&& rReq
.GetSlot() == SID_BASICIDE_CREATEMACRO
)
305 SbModule
* pModule
= pBasic
->FindModule( rInfo
.GetModule() );
308 if ( !rInfo
.GetModule().isEmpty() || pBasic
->GetModules().empty() )
310 const OUString
& aModName
= rInfo
.GetModule();
312 OUString sModuleCode
;
313 if ( aDocument
.createModule( aLibName
, aModName
, false, sModuleCode
) )
314 pModule
= pBasic
->FindModule( aModName
);
317 pModule
= pBasic
->GetModules().front().get();
319 DBG_ASSERT( pModule
, "No Module!" );
320 if ( pModule
&& !pModule
->GetMethods()->Find( rInfo
.GetMethod(), SbxClassType::Method
) )
321 CreateMacro( pModule
, rInfo
.GetMethod() );
323 SfxViewFrame
* pViewFrame
= GetViewFrame();
326 VclPtr
<ModulWindow
> pWin
= FindBasWin( aDocument
, aLibName
, rInfo
.GetModule(), true );
327 DBG_ASSERT( pWin
, "Edit/Create Macro: Window was not created/found!" );
328 SetCurWindow( pWin
, true );
329 pWin
->EditMacro( rInfo
.GetMethod() );
333 case SID_BASICIDE_OBJCAT
:
334 // toggling object catalog
335 aObjectCatalog
->Show(!aObjectCatalog
->IsVisible());
337 pLayout
->ArrangeWindows();
338 // refresh the button state
339 if (SfxBindings
* pBindings
= GetBindingsPtr())
340 pBindings
->Invalidate(SID_BASICIDE_OBJCAT
);
343 case SID_BASICIDE_NAMECHANGEDONTAB
:
345 DBG_ASSERT( rReq
.GetArgs(), "arguments expected" );
346 const SfxUInt16Item
&rTabId
= static_cast<const SfxUInt16Item
&>(rReq
.GetArgs()->Get(SID_BASICIDE_ARG_TABID
));
347 const SfxStringItem
&rModName
= static_cast<const SfxStringItem
&>(rReq
.GetArgs()->Get(SID_BASICIDE_ARG_MODULENAME
));
348 if ( aWindowTable
.find( rTabId
.GetValue() ) != aWindowTable
.end() )
350 VclPtr
<BaseWindow
> pWin
= aWindowTable
[ rTabId
.GetValue() ];
351 const OUString
& aNewName( rModName
.GetValue() );
352 OUString
aOldName( pWin
->GetName() );
353 if ( aNewName
!= aOldName
)
355 bool bRenameOk
= false;
356 if (ModulWindow
* pModWin
= dynamic_cast<ModulWindow
*>(pWin
.get()))
358 OUString aLibName
= pModWin
->GetLibName();
359 ScriptDocument
aDocument( pWin
->GetDocument() );
361 if (RenameModule(pModWin
, aDocument
, aLibName
, aOldName
, aNewName
))
364 // Because we listen for container events for script
365 // modules, rename will delete the 'old' window
366 // pWin has been invalidated, restore now
367 pWin
= FindBasWin( aDocument
, aLibName
, aNewName
, true );
371 else if (DialogWindow
* pDlgWin
= dynamic_cast<DialogWindow
*>(pWin
.get()))
373 bRenameOk
= pDlgWin
->RenameDialog( aNewName
);
377 MarkDocumentModified( pWin
->GetDocument() );
381 // set old name in TabWriter
382 sal_uInt16 nId
= GetWindowId( pWin
);
383 DBG_ASSERT( nId
, "No entry in Tabbar!" );
385 pTabBar
->SetPageText( nId
, aOldName
);
389 // set focus to current window
394 case SID_BASICIDE_STOREMODULESOURCE
:
395 case SID_BASICIDE_UPDATEMODULESOURCE
:
397 DBG_ASSERT( rReq
.GetArgs(), "arguments expected" );
398 const SfxMacroInfoItem
& rInfo
= static_cast<const SfxMacroInfoItem
&>(rReq
.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO
));
399 BasicManager
* pBasMgr
= const_cast<BasicManager
*>(rInfo
.GetBasicManager());
400 DBG_ASSERT( pBasMgr
, "Store source: No BasMgr?" );
401 ScriptDocument
aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr
) );
402 VclPtr
<ModulWindow
> pWin
= FindBasWin( aDocument
, rInfo
.GetLib(), rInfo
.GetModule(), false, true );
405 if ( rReq
.GetSlot() == SID_BASICIDE_STOREMODULESOURCE
)
412 case SID_BASICIDE_STOREALLMODULESOURCES
:
413 case SID_BASICIDE_UPDATEALLMODULESOURCES
:
415 for (WindowTableIt it
= aWindowTable
.begin(); it
!= aWindowTable
.end(); ++it
)
417 BaseWindow
* pWin
= it
->second
;
418 if (!pWin
->IsSuspended() && dynamic_cast<ModulWindow
*>(pWin
))
420 if ( rReq
.GetSlot() == SID_BASICIDE_STOREALLMODULESOURCES
)
428 case SID_BASICIDE_LIBSELECTED
:
429 case SID_BASICIDE_LIBREMOVED
:
430 case SID_BASICIDE_LIBLOADED
:
432 DBG_ASSERT( rReq
.GetArgs(), "arguments expected" );
433 const SfxUsrAnyItem
& rShellItem
= static_cast<const SfxUsrAnyItem
&>(rReq
.GetArgs()->Get( SID_BASICIDE_ARG_DOCUMENT_MODEL
));
434 uno::Reference
< frame::XModel
> xModel( rShellItem
.GetValue(), UNO_QUERY
);
435 ScriptDocument
aDocument( xModel
.is() ? ScriptDocument( xModel
) : ScriptDocument::getApplicationScriptDocument() );
436 const SfxStringItem
& rLibNameItem
= static_cast<const SfxStringItem
&>(rReq
.GetArgs()->Get( SID_BASICIDE_ARG_LIBNAME
));
437 const OUString
& aLibName( rLibNameItem
.GetValue() );
439 if ( nSlot
== SID_BASICIDE_LIBSELECTED
)
441 // load module and dialog library (if not loaded)
442 aDocument
.loadLibraryIfExists( E_SCRIPTS
, aLibName
);
443 aDocument
.loadLibraryIfExists( E_DIALOGS
, aLibName
);
445 // check password, if library is password protected and not verified
447 Reference
< script::XLibraryContainer
> xModLibContainer( aDocument
.getLibraryContainer( E_SCRIPTS
) );
448 if ( xModLibContainer
.is() && xModLibContainer
->hasByName( aLibName
) )
450 Reference
< script::XLibraryContainerPassword
> xPasswd( xModLibContainer
, UNO_QUERY
);
451 if ( xPasswd
.is() && xPasswd
->isLibraryPasswordProtected( aLibName
) && !xPasswd
->isLibraryPasswordVerified( aLibName
) )
454 bOK
= QueryPassword( xModLibContainer
, aLibName
, aPassword
);
460 SetCurLib( aDocument
, aLibName
, true, false );
464 // adjust old value...
465 if (SfxBindings
* pBindings
= GetBindingsPtr())
466 pBindings
->Invalidate(SID_BASICIDE_LIBSELECTOR
, true);
469 else if ( nSlot
== SID_BASICIDE_LIBREMOVED
)
471 if ( m_aCurLibName
.isEmpty() || ( aDocument
== m_aCurDocument
&& aLibName
== m_aCurLibName
) )
473 RemoveWindows( aDocument
, aLibName
);
474 if ( aDocument
== m_aCurDocument
&& aLibName
== m_aCurLibName
)
476 m_aCurDocument
= ScriptDocument::getApplicationScriptDocument();
477 m_aCurLibName
.clear();
479 if (SfxBindings
* pBindings
= GetBindingsPtr())
480 pBindings
->Invalidate( SID_BASICIDE_LIBSELECTOR
);
488 case SID_BASICIDE_NEWMODULE
:
490 VclPtr
<ModulWindow
> pWin
= CreateBasWin( m_aCurDocument
, m_aCurLibName
, OUString() );
491 DBG_ASSERT( pWin
, "New Module: Could not create window!" );
492 SetCurWindow( pWin
, true );
495 case SID_BASICIDE_NEWDIALOG
:
497 VclPtr
<DialogWindow
> pWin
= CreateDlgWin( m_aCurDocument
, m_aCurLibName
, OUString() );
498 DBG_ASSERT( pWin
, "New Module: Could not create window!" );
499 SetCurWindow( pWin
, true );
502 case SID_BASICIDE_SBXRENAMED
:
504 DBG_ASSERT( rReq
.GetArgs(), "arguments expected" );
507 case SID_BASICIDE_SBXINSERTED
:
509 DBG_ASSERT( rReq
.GetArgs(), "arguments expected" );
510 const SbxItem
& rSbxItem
= static_cast<const SbxItem
&>(rReq
.GetArgs()->Get(SID_BASICIDE_ARG_SBX
));
511 const ScriptDocument
& aDocument( rSbxItem
.GetDocument() );
512 const OUString
& aLibName( rSbxItem
.GetLibName() );
513 const OUString
& aName( rSbxItem
.GetName() );
514 if ( m_aCurLibName
.isEmpty() || ( aDocument
== m_aCurDocument
&& aLibName
== m_aCurLibName
) )
516 if ( rSbxItem
.GetType() == TYPE_MODULE
)
517 FindBasWin( aDocument
, aLibName
, aName
, true );
518 else if ( rSbxItem
.GetType() == TYPE_DIALOG
)
519 FindDlgWin( aDocument
, aLibName
, aName
, true );
523 case SID_BASICIDE_SBXDELETED
:
525 DBG_ASSERT( rReq
.GetArgs(), "arguments expected" );
526 const SbxItem
& rSbxItem
= static_cast<const SbxItem
&>(rReq
.GetArgs()->Get(SID_BASICIDE_ARG_SBX
));
527 const ScriptDocument
& aDocument( rSbxItem
.GetDocument() );
528 VclPtr
<BaseWindow
> pWin
= FindWindow( aDocument
, rSbxItem
.GetLibName(), rSbxItem
.GetName(), rSbxItem
.GetType(), true );
530 RemoveWindow( pWin
, true );
533 case SID_BASICIDE_SHOWSBX
:
535 DBG_ASSERT( rReq
.GetArgs(), "arguments expected" );
536 const SbxItem
& rSbxItem
= static_cast<const SbxItem
&>(rReq
.GetArgs()->Get(SID_BASICIDE_ARG_SBX
));
537 const ScriptDocument
& aDocument( rSbxItem
.GetDocument() );
538 const OUString
& aLibName( rSbxItem
.GetLibName() );
539 const OUString
& aName( rSbxItem
.GetName() );
540 SetCurLib( aDocument
, aLibName
);
541 BaseWindow
* pWin
= nullptr;
542 if ( rSbxItem
.GetType() == TYPE_DIALOG
)
544 pWin
= FindDlgWin( aDocument
, aLibName
, aName
, true );
546 else if ( rSbxItem
.GetType() == TYPE_MODULE
)
548 pWin
= FindBasWin( aDocument
, aLibName
, aName
, true );
550 else if ( rSbxItem
.GetType() == TYPE_METHOD
)
552 pWin
= FindBasWin( aDocument
, aLibName
, aName
, true );
553 static_cast<ModulWindow
*>(pWin
)->EditMacro( rSbxItem
.GetMethodName() );
555 DBG_ASSERT( pWin
, "Window was not created!" );
556 SetCurWindow( pWin
, true );
557 pTabBar
->MakeVisible( pTabBar
->GetCurPageId() );
560 case SID_BASICIDE_SHOWWINDOW
:
562 std::unique_ptr
< ScriptDocument
> pDocument
;
564 const SfxStringItem
* pDocumentItem
= rReq
.GetArg
<SfxStringItem
>(SID_BASICIDE_ARG_DOCUMENT
);
567 OUString sDocumentCaption
= pDocumentItem
->GetValue();
568 if ( !sDocumentCaption
.isEmpty() )
569 pDocument
.reset( new ScriptDocument( ScriptDocument::getDocumentWithURLOrCaption( sDocumentCaption
) ) );
572 const SfxUsrAnyItem
* pDocModelItem
= rReq
.GetArg
<SfxUsrAnyItem
>(SID_BASICIDE_ARG_DOCUMENT_MODEL
);
573 if ( !pDocument
.get() && pDocModelItem
)
575 uno::Reference
< frame::XModel
> xModel( pDocModelItem
->GetValue(), UNO_QUERY
);
577 pDocument
.reset( new ScriptDocument( xModel
) );
580 if ( !pDocument
.get() )
583 const SfxStringItem
* pLibNameItem
= rReq
.GetArg
<SfxStringItem
>(SID_BASICIDE_ARG_LIBNAME
);
587 OUString
aLibName( pLibNameItem
->GetValue() );
588 pDocument
->loadLibraryIfExists( E_SCRIPTS
, aLibName
);
589 SetCurLib( *pDocument
, aLibName
);
590 const SfxStringItem
* pNameItem
= rReq
.GetArg
<SfxStringItem
>(SID_BASICIDE_ARG_NAME
);
593 OUString
aName( pNameItem
->GetValue() );
594 OUString
aModType( "Module" );
595 OUString
aType( aModType
);
596 const SfxStringItem
* pTypeItem
= rReq
.GetArg
<SfxStringItem
>(SID_BASICIDE_ARG_TYPE
);
598 aType
= pTypeItem
->GetValue();
600 BaseWindow
* pWin
= nullptr;
601 if ( aType
== aModType
)
602 pWin
= FindBasWin( *pDocument
, aLibName
, aName
);
603 else if ( aType
== "Dialog" )
604 pWin
= FindDlgWin( *pDocument
, aLibName
, aName
);
608 SetCurWindow( pWin
, true );
610 pTabBar
->MakeVisible( pTabBar
->GetCurPageId() );
612 if (ModulWindow
* pModWin
= dynamic_cast<ModulWindow
*>(pWin
))
614 const SfxUInt32Item
* pLineItem
= rReq
.GetArg
<SfxUInt32Item
>(SID_BASICIDE_ARG_LINE
);
617 pModWin
->AssertValidEditEngine();
618 TextView
* pTextView
= pModWin
->GetEditView();
621 TextEngine
* pTextEngine
= pTextView
->GetTextEngine();
624 sal_uInt32 nLine
= pLineItem
->GetValue();
625 sal_uInt32 nLineCount
= 0;
626 for ( sal_uInt32 i
= 0, nCount
= pTextEngine
->GetParagraphCount(); i
< nCount
; ++i
)
627 nLineCount
+= pTextEngine
->GetLineCount( i
);
628 if ( nLine
> nLineCount
)
633 // scroll window and set selection
634 long nVisHeight
= pModWin
->GetOutputSizePixel().Height();
635 long nTextHeight
= pTextEngine
->GetTextHeight();
636 if ( nTextHeight
> nVisHeight
)
638 long nMaxY
= nTextHeight
- nVisHeight
;
639 long nOldY
= pTextView
->GetStartDocPos().Y();
640 long nNewY
= nLine
* pTextEngine
->GetCharHeight() - nVisHeight
/ 2;
641 nNewY
= std::min( nNewY
, nMaxY
);
642 pTextView
->Scroll( 0, -( nNewY
- nOldY
) );
643 pTextView
->ShowCursor( false );
644 pModWin
->GetEditVScrollBar().SetThumbPos( pTextView
->GetStartDocPos().Y() );
646 sal_uInt16 nCol1
= 0, nCol2
= 0;
647 const SfxUInt16Item
* pCol1Item
= rReq
.GetArg
<SfxUInt16Item
>(SID_BASICIDE_ARG_COLUMN1
);
650 nCol1
= pCol1Item
->GetValue();
655 const SfxUInt16Item
* pCol2Item
= rReq
.GetArg
<SfxUInt16Item
>(SID_BASICIDE_ARG_COLUMN2
);
658 nCol2
= pCol2Item
->GetValue();
662 TextSelection
aSel( TextPaM( nLine
, nCol1
), TextPaM( nLine
, nCol2
) );
663 pTextView
->SetSelection( aSel
);
664 pTextView
->ShowCursor();
665 vcl::Window
* pWindow_
= pTextView
->GetWindow();
667 pWindow_
->GrabFocus();
678 case SID_BASICIDE_MANAGE_LANG
:
680 ScopedVclPtrInstance
< ManageLanguageDialog
> aDlg(pCurWin
, m_pCurLocalizationMgr
);
688 pLayout
->ExecuteGlobal(rReq
);
690 pCurWin
->ExecuteGlobal(rReq
);
695 void Shell::GetState(SfxItemSet
&rSet
)
697 SfxWhichIter
aIter(rSet
);
698 for ( sal_uInt16 nWh
= aIter
.FirstWhich(); nWh
!= 0; nWh
= aIter
.NextWhich() )
704 rSet
.DisableItem( nWh
);
709 bool bDisable
= false;
713 if ( !pCurWin
->IsModified() )
715 ScriptDocument
aDocument( pCurWin
->GetDocument() );
716 bDisable
= ( !aDocument
.isAlive() )
717 || ( aDocument
.isDocument() ? !aDocument
.isDocumentModified() : !IsAppBasicModified() );
726 rSet
.DisableItem( nWh
);
732 rSet
.DisableItem( nWh
);
737 SignatureState nState
= SignatureState::NOSIGNATURES
;
740 DocumentSignature
aSignature( pCurWin
->GetDocument() );
741 nState
= aSignature
.getScriptingSignatureState();
743 rSet
.Put( SfxUInt16Item( SID_SIGNATURE
, static_cast<sal_uInt16
>(nState
) ) );
746 case SID_BASICIDE_MODULEDLG
:
748 if ( StarBASIC::IsRunning() )
749 rSet
.DisableItem( nWh
);
752 case SID_BASICIDE_OBJCAT
:
754 rSet
.Put(SfxBoolItem(nWh
, aObjectCatalog
->IsVisible()));
756 rSet
.Put(SfxVisibilityItem(nWh
, false));
758 case SID_BASICIDE_SHOWSBX
:
759 case SID_BASICIDE_CREATEMACRO
:
760 case SID_BASICIDE_EDITMACRO
:
761 case SID_BASICIDE_NAMECHANGEDONTAB
:
767 case SID_BASICIDE_ADDWATCH
:
768 case SID_BASICIDE_REMOVEWATCH
:
770 case SID_BASICSAVEAS
:
771 case SID_BASICIDE_MATCHGROUP
:
773 if (!dynamic_cast<ModulWindow
*>(pCurWin
.get()))
774 rSet
.DisableItem( nWh
);
775 else if ( ( nWh
== SID_BASICLOAD
) && ( StarBASIC::IsRunning() || ( pCurWin
&& pCurWin
->IsReadOnly() ) ) )
776 rSet
.DisableItem( nWh
);
780 case SID_BASICSTEPINTO
:
781 case SID_BASICSTEPOVER
:
782 case SID_BASICSTEPOUT
:
783 case SID_BASICIDE_TOGGLEBRKPNT
:
784 case SID_BASICIDE_MANAGEBRKPNTS
:
786 if (ModulWindow
* pMCurWin
= dynamic_cast<ModulWindow
*>(pCurWin
.get()))
788 if (StarBASIC::IsRunning() && !pMCurWin
->GetBasicStatus().bIsInReschedule
)
789 rSet
.DisableItem(nWh
);
792 rSet
.DisableItem( nWh
);
795 case SID_BASICCOMPILE
:
797 if (StarBASIC::IsRunning() || !dynamic_cast<ModulWindow
*>(pCurWin
.get()))
798 rSet
.DisableItem( nWh
);
803 // stop is always possible when some Basic is running...
804 if (!StarBASIC::IsRunning())
805 rSet
.DisableItem( nWh
);
808 case SID_CHOOSE_CONTROLS
:
809 case SID_DIALOG_TESTMODE
:
810 case SID_INSERT_SELECT
:
811 case SID_INSERT_PUSHBUTTON
:
812 case SID_INSERT_RADIOBUTTON
:
813 case SID_INSERT_CHECKBOX
:
814 case SID_INSERT_LISTBOX
:
815 case SID_INSERT_COMBOBOX
:
816 case SID_INSERT_GROUPBOX
:
817 case SID_INSERT_EDIT
:
818 case SID_INSERT_FIXEDTEXT
:
819 case SID_INSERT_IMAGECONTROL
:
820 case SID_INSERT_PROGRESSBAR
:
821 case SID_INSERT_HSCROLLBAR
:
822 case SID_INSERT_VSCROLLBAR
:
823 case SID_INSERT_HFIXEDLINE
:
824 case SID_INSERT_VFIXEDLINE
:
825 case SID_INSERT_DATEFIELD
:
826 case SID_INSERT_TIMEFIELD
:
827 case SID_INSERT_NUMERICFIELD
:
828 case SID_INSERT_CURRENCYFIELD
:
829 case SID_INSERT_FORMATTEDFIELD
:
830 case SID_INSERT_PATTERNFIELD
:
831 case SID_INSERT_FILECONTROL
:
832 case SID_INSERT_SPINBUTTON
:
833 case SID_INSERT_TREECONTROL
:
834 case SID_INSERT_FORM_RADIO
:
835 case SID_INSERT_FORM_CHECK
:
836 case SID_INSERT_FORM_LIST
:
837 case SID_INSERT_FORM_COMBO
:
838 case SID_INSERT_FORM_VSCROLL
:
839 case SID_INSERT_FORM_HSCROLL
:
840 case SID_INSERT_FORM_SPIN
:
842 if (!dynamic_cast<DialogWindow
*>(pCurWin
.get()))
843 rSet
.DisableItem( nWh
);
846 case SID_SEARCH_OPTIONS
:
848 SearchOptionFlags nOptions
= SearchOptionFlags::NONE
;
850 nOptions
= pCurWin
->GetSearchOptions();
851 rSet
.Put( SfxUInt16Item( SID_SEARCH_OPTIONS
, static_cast<sal_uInt16
>(nOptions
) ) );
854 case SID_BASICIDE_LIBSELECTOR
:
857 if ( !m_aCurLibName
.isEmpty() )
859 LibraryLocation eLocation
= m_aCurDocument
.getLibraryLocation( m_aCurLibName
);
860 aName
= CreateMgrAndLibStr( m_aCurDocument
.getTitle( eLocation
), m_aCurLibName
);
862 SfxStringItem
aItem( SID_BASICIDE_LIBSELECTOR
, aName
);
866 case SID_SEARCH_ITEM
:
868 OUString aSelected
= GetSelectionText(true);
869 SvxSearchItem
& rItem
= GetExtraData()->GetSearchItem();
870 rItem
.SetSearchString( aSelected
);
874 case SID_BASICIDE_STAT_DATE
:
876 SfxStringItem
aItem( SID_BASICIDE_STAT_DATE
, "Datum?!" );
880 case SID_DOC_MODIFIED
:
882 bool bModified
= false;
886 if ( pCurWin
->IsModified() )
890 ScriptDocument
aDocument( pCurWin
->GetDocument() );
891 bModified
= aDocument
.isDocument() ? aDocument
.isDocumentModified() : IsAppBasicModified();
895 SfxBoolItem
aItem(SID_DOC_MODIFIED
, bModified
);
899 case SID_BASICIDE_STAT_TITLE
:
903 OUString aTitle
= pCurWin
->CreateQualifiedName();
904 SfxStringItem
aItem( SID_BASICIDE_STAT_TITLE
, aTitle
);
909 // are interpreted by the controller:
911 case SID_ATTR_INSERT
:
916 if( GetUndoManager() ) // recursive GetState else
917 GetViewFrame()->GetSlotState( nWh
, nullptr, &rSet
);
920 case SID_BASICIDE_CURRENT_LANG
:
922 if( (pCurWin
&& pCurWin
->IsReadOnly()) || GetCurLibName().isEmpty() )
923 rSet
.DisableItem( nWh
);
927 std::shared_ptr
<LocalizationMgr
> pCurMgr(GetCurLocalizationMgr());
928 if ( pCurMgr
->isLibraryLocalized() )
930 Sequence
< lang::Locale
> aLocaleSeq
= pCurMgr
->getStringResourceManager()->getLocales();
931 const lang::Locale
* pLocale
= aLocaleSeq
.getConstArray();
932 sal_Int32 i
, nCount
= aLocaleSeq
.getLength();
934 // Force different results for any combination of locales and default locale
936 for ( i
= 0; i
<= nCount
; ++i
)
938 lang::Locale aLocale
;
940 aLocale
= pLocale
[i
];
942 aLocale
= pCurMgr
->getStringResourceManager()->getDefaultLocale();
944 aLangStr
+= aLocale
.Language
+ aLocale
.Country
+ aLocale
.Variant
;
948 rSet
.Put( SfxStringItem( nWh
, aItemStr
) );
953 case SID_BASICIDE_MANAGE_LANG
:
955 if( (pCurWin
&& pCurWin
->IsReadOnly()) || GetCurLibName().isEmpty() )
956 rSet
.DisableItem( nWh
);
961 // if this is not a module window hide the
962 // setting, doesn't make sense for example if the
963 // dialog editor is open
964 if (pCurWin
&& !dynamic_cast<ModulWindow
*>(pCurWin
.get()))
966 rSet
.DisableItem( nWh
);
967 rSet
.Put(SfxVisibilityItem(nWh
, false));
971 case SID_BASICIDE_HIDECURPAGE
:
973 if (pTabBar
->GetPageCount() == 0)
974 rSet
.DisableItem(nWh
);
977 case SID_BASICIDE_DELETECURRENT
:
978 case SID_BASICIDE_RENAMECURRENT
:
980 if (pTabBar
->GetPageCount() == 0 || StarBASIC::IsRunning())
981 rSet
.DisableItem(nWh
);
982 else if (m_aCurDocument
.isInVBAMode())
984 // disable to delete or rename object modules in IDE
985 BasicManager
* pBasMgr
= m_aCurDocument
.getBasicManager();
986 StarBASIC
* pBasic
= pBasMgr
? pBasMgr
->GetLib(m_aCurLibName
) : nullptr;
987 if (pBasic
&& dynamic_cast<ModulWindow
*>(pCurWin
.get()))
989 SbModule
* pActiveModule
= pBasic
->FindModule( pCurWin
->GetName() );
990 if ( pActiveModule
&& ( pActiveModule
->GetModuleType() == script::ModuleType::DOCUMENT
) )
991 rSet
.DisableItem(nWh
);
997 case SID_BASICIDE_NEWMODULE
:
998 case SID_BASICIDE_NEWDIALOG
:
1000 Reference
< script::XLibraryContainer2
> xModLibContainer( m_aCurDocument
.getLibraryContainer( E_SCRIPTS
), UNO_QUERY
);
1001 Reference
< script::XLibraryContainer2
> xDlgLibContainer( m_aCurDocument
.getLibraryContainer( E_DIALOGS
), UNO_QUERY
);
1002 if ( ( xModLibContainer
.is() && xModLibContainer
->hasByName( m_aCurLibName
) && xModLibContainer
->isLibraryReadOnly( m_aCurLibName
) ) ||
1003 ( xDlgLibContainer
.is() && xDlgLibContainer
->hasByName( m_aCurLibName
) && xDlgLibContainer
->isLibraryReadOnly( m_aCurLibName
) ) )
1004 rSet
.DisableItem(nWh
);
1009 pLayout
->GetState(rSet
, nWh
);
1013 pCurWin
->GetState( rSet
);
1016 bool Shell::HasUIFeature(SfxShellFeature nFeature
) const
1018 assert((nFeature
& ~SfxShellFeature::BasicMask
) == SfxShellFeature::NONE
);
1019 bool bResult
= false;
1021 if (nFeature
& SfxShellFeature::BasicShowBrowser
)
1023 // fade out (in) property browser in module (dialog) windows
1024 if (dynamic_cast<DialogWindow
*>(pCurWin
.get()) && !pCurWin
->IsReadOnly())
1031 void Shell::SetCurWindow( BaseWindow
* pNewWin
, bool bUpdateTabBar
, bool bRememberAsCurrent
)
1033 if ( pNewWin
!= pCurWin
)
1037 pLayout
->Deactivating();
1040 if (pCurWin
->GetType() == TYPE_MODULE
)
1041 pLayout
= pModulLayout
.get();
1043 pLayout
= pDialogLayout
.get();
1044 AdjustPosSizePixel(Point(0, 0), GetViewFrame()->GetWindow().GetOutputSizePixel());
1045 pLayout
->Activating(*pCurWin
);
1046 GetViewFrame()->GetWindow().SetHelpId(pCurWin
->GetHid());
1047 if (bRememberAsCurrent
)
1048 pCurWin
->InsertLibInfo();
1049 if (GetViewFrame()->GetWindow().IsVisible()) // SFX will do it later otherwise
1052 if (!GetExtraData()->ShellInCriticalSection())
1054 vcl::Window
* pFrameWindow
= &GetViewFrame()->GetWindow();
1055 vcl::Window
* pFocusWindow
= Application::GetFocusWindow();
1056 while ( pFocusWindow
&& ( pFocusWindow
!= pFrameWindow
) )
1057 pFocusWindow
= pFocusWindow
->GetParent();
1058 if ( pFocusWindow
) // Focus in BasicIDE
1059 pCurWin
->GrabFocus();
1067 if ( bUpdateTabBar
)
1069 sal_uLong nKey
= GetWindowId( pCurWin
);
1070 if ( pCurWin
&& ( pTabBar
->GetPagePos( (sal_uInt16
)nKey
) == TAB_PAGE_NOTFOUND
) )
1071 pTabBar
->InsertPage( (sal_uInt16
)nKey
, pCurWin
->GetTitle() ); // has just been faded in
1072 pTabBar
->SetCurPageId( (sal_uInt16
)nKey
);
1074 if ( pCurWin
&& pCurWin
->IsSuspended() ) // if the window is shown in the case of an error...
1075 pCurWin
->SetStatus( pCurWin
->GetStatus() & ~BASWIN_SUSPENDED
);
1078 SetWindow( pCurWin
);
1079 if ( pCurWin
->GetDocument().isDocument() )
1080 SfxObjectShell::SetCurrentComponent( pCurWin
->GetDocument().getDocument() );
1085 GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW
);
1086 SfxObjectShell::SetCurrentComponent(nullptr);
1088 aObjectCatalog
->SetCurrentEntry(pCurWin
);
1089 SetUndoManager( pCurWin
? pCurWin
->GetUndoManager() : nullptr );
1090 InvalidateBasicIDESlots();
1091 InvalidateControlSlots();
1092 EnableScrollbars(pCurWin
!= nullptr);
1094 if ( m_pCurLocalizationMgr
)
1095 m_pCurLocalizationMgr
->handleTranslationbar();
1099 // fade out (in) property browser in module (dialog) windows
1104 void Shell::ManageToolbars()
1106 static const char aMacroBarResName
[] = "private:resource/toolbar/macrobar";
1107 static const char aDialogBarResName
[] = "private:resource/toolbar/dialogbar";
1108 static const char aInsertControlsBarResName
[] = "private:resource/toolbar/insertcontrolsbar";
1109 static const char aFormControlsBarResName
[] = "private:resource/toolbar/formcontrolsbar";
1114 Reference
< beans::XPropertySet
> xFrameProps
1115 ( GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY
);
1116 if ( xFrameProps
.is() )
1118 Reference
< css::frame::XLayoutManager
> xLayoutManager
;
1119 uno::Any a
= xFrameProps
->getPropertyValue( "LayoutManager" );
1120 a
>>= xLayoutManager
;
1121 if ( xLayoutManager
.is() )
1123 xLayoutManager
->lock();
1124 if (dynamic_cast<DialogWindow
*>(pCurWin
.get()))
1126 xLayoutManager
->destroyElement( aMacroBarResName
);
1128 xLayoutManager
->requestElement( aDialogBarResName
);
1129 xLayoutManager
->requestElement( aInsertControlsBarResName
);
1130 xLayoutManager
->requestElement( aFormControlsBarResName
);
1134 xLayoutManager
->destroyElement( aDialogBarResName
);
1135 xLayoutManager
->destroyElement( aInsertControlsBarResName
);
1136 xLayoutManager
->destroyElement( aFormControlsBarResName
);
1138 xLayoutManager
->requestElement( aMacroBarResName
);
1140 xLayoutManager
->unlock();
1145 VclPtr
<BaseWindow
> Shell::FindApplicationWindow()
1147 return FindWindow( ScriptDocument::getApplicationScriptDocument(), "", "", TYPE_UNKNOWN
);
1150 VclPtr
<BaseWindow
> Shell::FindWindow(
1151 ScriptDocument
const& rDocument
,
1152 OUString
const& rLibName
, OUString
const& rName
,
1153 ItemType eType
, bool bFindSuspended
1156 for (WindowTableIt it
= aWindowTable
.begin(); it
!= aWindowTable
.end(); ++it
)
1158 BaseWindow
* const pWin
= it
->second
;
1159 if (pWin
->Is(rDocument
, rLibName
, rName
, eType
, bFindSuspended
))
1165 bool Shell::CallBasicErrorHdl( StarBASIC
const * pBasic
)
1168 VclPtr
<ModulWindow
> pModWin
= ShowActiveModuleWindow( pBasic
);
1170 bRet
= pModWin
->BasicErrorHdl( pBasic
);
1174 BasicDebugFlags
Shell::CallBasicBreakHdl( StarBASIC
const * pBasic
)
1176 BasicDebugFlags nRet
= BasicDebugFlags::NONE
;
1177 VclPtr
<ModulWindow
> pModWin
= ShowActiveModuleWindow( pBasic
);
1180 bool bAppWindowDisabled
, bDispatcherLocked
;
1181 sal_uInt16 nWaitCount
;
1182 SfxUInt16Item
*pSWActionCount
, *pSWLockViewCount
;
1183 BasicStopped( &bAppWindowDisabled
, &bDispatcherLocked
,
1184 &nWaitCount
, &pSWActionCount
, &pSWLockViewCount
);
1186 nRet
= pModWin
->BasicBreakHdl();
1188 if ( StarBASIC::IsRunning() ) // if cancelled...
1190 if ( bAppWindowDisabled
)
1191 Application::GetDefDialogParent()->Enable(false);
1195 Shell
* pShell
= GetShell();
1196 for ( sal_uInt16 n
= 0; n
< nWaitCount
; n
++ )
1197 pShell
->GetViewFrame()->GetWindow().EnterWait();
1204 VclPtr
<ModulWindow
> Shell::ShowActiveModuleWindow( StarBASIC
const * pBasic
)
1206 SetCurLib( ScriptDocument::getApplicationScriptDocument(), OUString(), false );
1208 SbModule
* pActiveModule
= StarBASIC::GetActiveModule();
1209 if (SbClassModuleObject
* pCMO
= dynamic_cast<SbClassModuleObject
*>(pActiveModule
))
1210 pActiveModule
= pCMO
->getClassModule();
1212 DBG_ASSERT( pActiveModule
, "No active module in ErrorHdl!?" );
1213 if ( pActiveModule
)
1215 VclPtr
<ModulWindow
> pWin
;
1216 SbxObject
* pParent
= pActiveModule
->GetParent();
1217 if (StarBASIC
* pLib
= dynamic_cast<StarBASIC
*>(pParent
))
1219 if (BasicManager
* pBasMgr
= FindBasicManager(pLib
))
1221 ScriptDocument
aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr
) );
1222 OUString aLibName
= pLib
->GetName();
1223 pWin
= FindBasWin( aDocument
, aLibName
, pActiveModule
->GetName(), true );
1224 DBG_ASSERT( pWin
, "Error/Step-Hdl: Window was not created/found!" );
1225 SetCurLib( aDocument
, aLibName
);
1226 SetCurWindow( pWin
, true );
1230 SAL_WARN( "basctl.basicide", "No BASIC!");
1231 if (BasicManager
* pBasicMgr
= FindBasicManager(pBasic
))
1232 StartListening(*pBasicMgr
, DuplicateHandling::Prevent
/* log on only once */);
1238 void Shell::AdjustPosSizePixel( const Point
&rPos
, const Size
&rSize
)
1240 // not if iconified because the whole text would be displaced then at restore
1241 if ( GetViewFrame()->GetWindow().GetOutputSizePixel().Height() == 0 )
1245 aTabBarSize
.Height() = GetViewFrame()->GetWindow().GetFont().GetFontHeight() + 4;
1246 aTabBarSize
.Width() = rSize
.Width();
1249 Size
aScrollBarBoxSz( aScrollBarBox
->GetSizePixel() );
1250 aSz
.Height() -= aScrollBarBoxSz
.Height();
1251 aSz
.Height() -= aTabBarSize
.Height();
1254 aSz
.Width() -= aScrollBarBoxSz
.Width();
1255 aScrollBarBox
->SetPosPixel( Point( rSize
.Width() - aScrollBarBoxSz
.Width(), rSize
.Height() - aScrollBarBoxSz
.Height() ) );
1256 aVScrollBar
->SetPosSizePixel( Point( rPos
.X()+aSz
.Width(), rPos
.Y() ), Size( aScrollBarBoxSz
.Width(), aSz
.Height() ) );
1257 aHScrollBar
->SetPosSizePixel( Point( rPos
.X(), rPos
.Y()+aSz
.Height() ), Size( aSz
.Width(), aScrollBarBoxSz
.Height() ) );
1258 pTabBar
->SetPosSizePixel( Point( rPos
.X(), rPos
.Y()+aScrollBarBoxSz
.Height()+aSz
.Height()), aTabBarSize
);
1261 pLayout
->SetPosSizePixel(rPos
, dynamic_cast<DialogWindow
*>(pCurWin
.get()) ? aSz
: aOutSz
);
1264 Reference
< XModel
> Shell::GetCurrentDocument() const
1266 Reference
< XModel
> xDocument
;
1267 if ( pCurWin
&& pCurWin
->GetDocument().isDocument() )
1268 xDocument
= pCurWin
->GetDocument().getDocument();
1272 void Shell::Activate( bool bMDI
)
1274 SfxViewShell::Activate( bMDI
);
1278 if (DialogWindow
* pDCurWin
= dynamic_cast<DialogWindow
*>(pCurWin
.get()))
1279 pDCurWin
->UpdateBrowser();
1283 void Shell::Deactivate( bool bMDI
)
1285 // bMDI == true means that another MDI has been activated; in case of a
1286 // deactivate due to a MessageBox bMDI is false
1289 if (DialogWindow
* pXDlgWin
= dynamic_cast<DialogWindow
*>(pCurWin
.get()))
1291 pXDlgWin
->DisableBrowser();
1292 if( pXDlgWin
->IsModified() )
1293 MarkDocumentModified( pXDlgWin
->GetDocument() );
1296 // test CanClose to also test during deactivating the BasicIDE whether
1297 // the sourcecode is too large in one of the modules...
1298 for (WindowTableIt it
= aWindowTable
.begin(); it
!= aWindowTable
.end(); ++it
)
1300 BaseWindow
* pWin
= it
->second
;
1301 if ( /* !pWin->IsSuspended() && */ !pWin
->CanClose() )
1303 if ( !m_aCurLibName
.isEmpty() && ( pWin
->IsDocument( m_aCurDocument
) || pWin
->GetLibName() != m_aCurLibName
) )
1304 SetCurLib( ScriptDocument::getApplicationScriptDocument(), OUString(), false );
1305 SetCurWindow( pWin
, true );
1312 } // namespace basctl
1314 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */