lok: Don't attempt to select the exact text after a failed search.
[LibreOffice.git] / basctl / source / basicide / basides1.cxx
blobf99f7bba0f5be8e6bf9adefe32cd5af76aa29503
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 .
20 #include "basidesh.hrc"
21 #include "helpid.hrc"
23 #include "baside2.hxx"
24 #include "baside3.hxx"
25 #include "docsignature.hxx"
26 #include "iderdll.hxx"
27 #include "iderdll2.hxx"
28 #include "localizationmgr.hxx"
29 #include "managelang.hxx"
31 #include <basic/basmgr.hxx>
32 #include <basic/sbmeth.hxx>
33 #include <com/sun/star/script/XLibraryContainerPassword.hpp>
34 #include <com/sun/star/frame/XLayoutManager.hpp>
35 #include <sfx2/childwin.hxx>
36 #include <sfx2/docfac.hxx>
37 #include <sfx2/dinfdlg.hxx>
38 #include <sfx2/dispatch.hxx>
39 #include <sfx2/minfitem.hxx>
40 #include <sfx2/printer.hxx>
41 #include <sfx2/request.hxx>
42 #include <svl/aeitem.hxx>
43 #include <svl/intitem.hxx>
44 #include <svl/srchitem.hxx>
45 #include <svl/visitem.hxx>
46 #include <svl/whiter.hxx>
47 #include <vcl/xtextedt.hxx>
48 #include <vcl/msgbox.hxx>
50 namespace basctl
53 using namespace ::com::sun::star;
54 using namespace ::com::sun::star::uno;
55 using namespace ::com::sun::star::frame;
57 void Shell::ExecuteCurrent( SfxRequest& rReq )
59 if ( !pCurWin )
60 return;
62 switch ( rReq.GetSlot() )
64 case SID_BASICIDE_HIDECURPAGE:
66 pCurWin->StoreData();
67 RemoveWindow( pCurWin, false );
69 break;
70 case SID_BASICIDE_RENAMECURRENT:
72 pTabBar->StartEditMode( pTabBar->GetCurPageId() );
74 break;
75 case FID_SEARCH_NOW:
77 if (!pCurWin->HasActiveEditor())
78 break;
79 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
80 SfxItemSet const& rArgs = *rReq.GetArgs();
81 // unfortunately I don't know the ID:
82 sal_uInt16 nWhich = rArgs.GetWhichByPos( 0 );
83 DBG_ASSERT( nWhich, "Which for SearchItem?" );
84 SfxPoolItem const& rItem = rArgs.Get(nWhich);
85 DBG_ASSERT(dynamic_cast<SvxSearchItem const*>(&rItem), "no searchitem!");
86 SvxSearchItem const& rSearchItem = static_cast<SvxSearchItem const&>(rItem);
87 // memorize item because of the adjustments...
88 GetExtraData()->SetSearchItem(rSearchItem);
89 sal_Int32 nFound = 0;
90 if (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL)
92 sal_uInt16 nActModWindows = 0;
93 for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
95 BaseWindow* pWin = it->second;
96 if (pWin->HasActiveEditor())
97 nActModWindows++;
100 if ( nActModWindows <= 1 || ( !rSearchItem.GetSelection() && QueryBox( pCurWin, WB_YES_NO|WB_DEF_YES, IDEResId(RID_STR_SEARCHALLMODULES).toString() ).Execute() == RET_YES ) )
102 for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
104 BaseWindow* pWin = it->second;
105 nFound += pWin->StartSearchAndReplace(rSearchItem);
108 else
109 nFound = pCurWin->StartSearchAndReplace(rSearchItem);
111 OUString aReplStr(IDE_RESSTR(RID_STR_SEARCHREPLACES));
112 aReplStr = aReplStr.replaceAll("XX", OUString::number(nFound));
113 InfoBox( pCurWin, aReplStr ).Execute();
115 else
117 bool bCanceled = false;
118 nFound = pCurWin->StartSearchAndReplace(rSearchItem);
119 if ( !nFound && !rSearchItem.GetSelection() )
121 // search other modules...
122 bool bChangeCurWindow = false;
123 WindowTableIt it;
124 for (it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
125 if (it->second == pCurWin)
126 break;
127 if (it != aWindowTable.end())
128 ++it;
129 BaseWindow* pWin = it != aWindowTable.end() ? it->second.get() : 0;
131 bool bSearchedFromStart = false;
132 while ( !nFound && !bCanceled && ( pWin || !bSearchedFromStart ) )
134 if ( !pWin )
136 SfxViewFrame* pViewFrame = GetViewFrame();
137 SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SEARCH_DLG ) : NULL;
138 vcl::Window* pParent = pChildWin ? pChildWin->GetWindow() : NULL;
139 ScopedVclPtrInstance< QueryBox > aQuery(pParent, WB_YES_NO|WB_DEF_YES, IDE_RESSTR(RID_STR_SEARCHFROMSTART));
140 if ( aQuery->Execute() == RET_YES )
142 it = aWindowTable.begin();
143 if ( it != aWindowTable.end() )
144 pWin = it->second;
145 bSearchedFromStart = true;
147 else
148 bCanceled = true;
151 if (pWin && pWin->HasActiveEditor())
153 if ( pWin != pCurWin )
155 if ( pCurWin )
156 pWin->SetSizePixel( pCurWin->GetSizePixel() );
157 nFound = pWin->StartSearchAndReplace(rSearchItem, true);
159 if ( nFound )
161 bChangeCurWindow = true;
162 break;
165 if ( pWin && ( pWin != pCurWin ) )
167 if ( it != aWindowTable.end() )
168 ++it;
169 pWin = it != aWindowTable.end() ? it->second.get() : 0;
171 else
172 pWin = 0;
174 if ( !nFound && bSearchedFromStart )
175 nFound = pCurWin->StartSearchAndReplace(rSearchItem, true);
176 if ( bChangeCurWindow )
177 SetCurWindow( pWin, true );
179 if ( !nFound && !bCanceled )
180 InfoBox( pCurWin, IDEResId(RID_STR_SEARCHNOTFOUND).toString() ).Execute();
183 rReq.Done();
185 break;
186 case SID_UNDO:
187 case SID_REDO:
188 if ( GetUndoManager() && pCurWin->AllowUndo() )
189 GetViewFrame()->ExecuteSlot( rReq );
190 break;
191 default:
192 pCurWin->ExecuteCommand( rReq );
196 // no matter who's at the top, influence on the shell:
197 void Shell::ExecuteGlobal( SfxRequest& rReq )
199 sal_uInt16 nSlot = rReq.GetSlot();
200 switch ( nSlot )
202 case SID_BASICSTOP:
204 // maybe do not simply stop if on breakpoint!
205 if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get()))
206 pMCurWin->BasicStop();
207 StopBasic();
209 break;
211 case SID_SAVEDOC:
213 if ( pCurWin )
215 // rewrite date into the BASIC
216 StoreAllWindowData();
218 // document basic
219 ScriptDocument aDocument( pCurWin->GetDocument() );
220 if ( aDocument.isDocument() )
222 uno::Reference< task::XStatusIndicator > xStatusIndicator;
224 SFX_REQUEST_ARG( rReq, pStatusIndicatorItem, SfxUnoAnyItem,
225 SID_PROGRESS_STATUSBAR_CONTROL, false );
226 if ( pStatusIndicatorItem )
227 OSL_VERIFY( pStatusIndicatorItem->GetValue() >>= xStatusIndicator );
228 else
230 // get statusindicator
231 SfxViewFrame *pFrame_ = GetFrame();
232 if ( pFrame_ )
234 uno::Reference< task::XStatusIndicatorFactory > xStatFactory(
235 pFrame_->GetFrame().GetFrameInterface(),
236 uno::UNO_QUERY );
237 if( xStatFactory.is() )
238 xStatusIndicator = xStatFactory->createStatusIndicator();
241 if ( xStatusIndicator.is() )
242 rReq.AppendItem( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, uno::makeAny( xStatusIndicator ) ) );
245 aDocument.saveDocument( xStatusIndicator );
248 if (SfxBindings* pBindings = GetBindingsPtr())
250 pBindings->Invalidate( SID_DOC_MODIFIED );
251 pBindings->Invalidate( SID_SAVEDOC );
252 pBindings->Invalidate( SID_SIGNATURE );
256 break;
257 case SID_BASICIDE_MODULEDLG:
259 if ( rReq.GetArgs() )
261 const SfxUInt16Item &rTabId = static_cast<const SfxUInt16Item&>(rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID ));
262 Organize( rTabId.GetValue() );
264 else
265 Organize( 0 );
267 break;
268 case SID_BASICIDE_CHOOSEMACRO:
270 ChooseMacro( NULL, false, OUString() );
272 break;
273 case SID_BASICIDE_CREATEMACRO:
274 case SID_BASICIDE_EDITMACRO:
276 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
277 const SfxMacroInfoItem& rInfo = static_cast<const SfxMacroInfoItem&>(rReq.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO ));
278 BasicManager* pBasMgr = const_cast<BasicManager*>(rInfo.GetBasicManager());
279 DBG_ASSERT( pBasMgr, "Nichts selektiert im Basic-Baum ?" );
281 ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
283 StartListening( *pBasMgr, true /* log on only once */ );
284 OUString aLibName( rInfo.GetLib() );
285 if ( aLibName.isEmpty() )
286 aLibName = "Standard" ;
287 StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
288 if ( !pBasic )
290 // load module and dialog library (if not loaded)
291 aDocument.loadLibraryIfExists( E_SCRIPTS, aLibName );
292 aDocument.loadLibraryIfExists( E_DIALOGS, aLibName );
294 // get Basic
295 pBasic = pBasMgr->GetLib( aLibName );
297 DBG_ASSERT( pBasic, "No Basic!" );
299 SetCurLib( aDocument, aLibName );
301 if ( pBasic && rReq.GetSlot() == SID_BASICIDE_CREATEMACRO )
303 SbModule* pModule = pBasic->FindModule( rInfo.GetModule() );
304 if ( !pModule )
306 if ( !rInfo.GetModule().isEmpty() || !pBasic->GetModules()->Count() )
308 OUString aModName = rInfo.GetModule();
310 OUString sModuleCode;
311 if ( aDocument.createModule( aLibName, aModName, false, sModuleCode ) )
312 pModule = pBasic->FindModule( aModName );
314 else
315 pModule = static_cast<SbModule*>( pBasic->GetModules()->Get(0) );
317 DBG_ASSERT( pModule, "Kein Modul!" );
318 if ( pModule && !pModule->GetMethods()->Find( rInfo.GetMethod(), SbxCLASS_METHOD ) )
319 CreateMacro( pModule, rInfo.GetMethod() );
321 SfxViewFrame* pViewFrame = GetViewFrame();
322 if ( pViewFrame )
323 pViewFrame->ToTop();
324 ModulWindow* pWin = FindBasWin( aDocument, aLibName, rInfo.GetModule(), true );
325 DBG_ASSERT( pWin, "Edit/Create Macro: Fenster wurde nicht erzeugt/gefunden!" );
326 SetCurWindow( pWin, true );
327 pWin->EditMacro( rInfo.GetMethod() );
329 break;
331 case SID_BASICIDE_OBJCAT:
332 // toggling object catalog
333 aObjectCatalog->Show(!aObjectCatalog->IsVisible());
334 if (pLayout)
335 pLayout->ArrangeWindows();
336 // refresh the button state
337 if (SfxBindings* pBindings = GetBindingsPtr())
338 pBindings->Invalidate(SID_BASICIDE_OBJCAT);
339 break;
341 case SID_BASICIDE_NAMECHANGEDONTAB:
343 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
344 const SfxUInt16Item &rTabId = static_cast<const SfxUInt16Item&>(rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID ));
345 const SfxStringItem &rModName = static_cast<const SfxStringItem&>(rReq.GetArgs()->Get(SID_BASICIDE_ARG_MODULENAME ));
346 if ( aWindowTable.find( rTabId.GetValue() ) != aWindowTable.end() )
348 BaseWindow* pWin = aWindowTable[ rTabId.GetValue() ];
349 OUString aNewName( rModName.GetValue() );
350 OUString aOldName( pWin->GetName() );
351 if ( aNewName != aOldName )
353 bool bRenameOk = false;
354 if (ModulWindow* pModWin = dynamic_cast<ModulWindow*>(pWin))
356 OUString aLibName = pModWin->GetLibName();
357 ScriptDocument aDocument( pWin->GetDocument() );
359 if (RenameModule(pModWin, aDocument, aLibName, aOldName, aNewName))
361 bRenameOk = true;
362 // Because we listen for container events for script
363 // modules, rename will delete the 'old' window
364 // pWin has been invalidated, restore now
365 pWin = FindBasWin( aDocument, aLibName, aNewName, true );
369 else if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(pWin))
371 bRenameOk = pDlgWin->RenameDialog( aNewName );
373 if ( bRenameOk )
375 MarkDocumentModified( pWin->GetDocument() );
377 else
379 // set old name in TabWriter
380 sal_uInt16 nId = GetWindowId( pWin );
381 DBG_ASSERT( nId, "No entry in Tabbar!" );
382 if ( nId )
383 pTabBar->SetPageText( nId, aOldName );
387 // set focus to current window
388 pWin->GrabFocus();
391 break;
392 case SID_BASICIDE_STOREMODULESOURCE:
393 case SID_BASICIDE_UPDATEMODULESOURCE:
395 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
396 const SfxMacroInfoItem& rInfo = static_cast<const SfxMacroInfoItem&>(rReq.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO ));
397 BasicManager* pBasMgr = const_cast<BasicManager*>(rInfo.GetBasicManager());
398 DBG_ASSERT( pBasMgr, "Store source: Kein BasMgr?" );
399 ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
400 ModulWindow* pWin = FindBasWin( aDocument, rInfo.GetLib(), rInfo.GetModule(), false, true );
401 if ( pWin )
403 if ( rReq.GetSlot() == SID_BASICIDE_STOREMODULESOURCE )
404 pWin->StoreData();
405 else
406 pWin->UpdateData();
409 break;
410 case SID_BASICIDE_STOREALLMODULESOURCES:
411 case SID_BASICIDE_UPDATEALLMODULESOURCES:
413 for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
415 BaseWindow* pWin = it->second;
416 if (!pWin->IsSuspended() && dynamic_cast<ModulWindow*>(pWin))
418 if ( rReq.GetSlot() == SID_BASICIDE_STOREALLMODULESOURCES )
419 pWin->StoreData();
420 else
421 pWin->UpdateData();
425 break;
426 case SID_BASICIDE_LIBSELECTED:
427 case SID_BASICIDE_LIBREMOVED:
428 case SID_BASICIDE_LIBLOADED:
430 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
431 const SfxUsrAnyItem& rShellItem = static_cast<const SfxUsrAnyItem&>(rReq.GetArgs()->Get( SID_BASICIDE_ARG_DOCUMENT_MODEL ));
432 uno::Reference< frame::XModel > xModel( rShellItem.GetValue(), UNO_QUERY );
433 ScriptDocument aDocument( xModel.is() ? ScriptDocument( xModel ) : ScriptDocument::getApplicationScriptDocument() );
434 const SfxStringItem& rLibNameItem = static_cast<const SfxStringItem&>(rReq.GetArgs()->Get( SID_BASICIDE_ARG_LIBNAME ));
435 OUString aLibName( rLibNameItem.GetValue() );
437 if ( nSlot == SID_BASICIDE_LIBSELECTED )
439 // load module and dialog library (if not loaded)
440 aDocument.loadLibraryIfExists( E_SCRIPTS, aLibName );
441 aDocument.loadLibraryIfExists( E_DIALOGS, aLibName );
443 // check password, if library is password protected and not verified
444 bool bOK = true;
445 Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
446 if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
448 Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
449 if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
451 OUString aPassword;
452 bOK = QueryPassword( xModLibContainer, aLibName, aPassword );
456 if ( bOK )
458 SetCurLib( aDocument, aLibName, true, false );
460 else
462 // adjust old value...
463 if (SfxBindings* pBindings = GetBindingsPtr())
464 pBindings->Invalidate(SID_BASICIDE_LIBSELECTOR, true, false);
467 else if ( nSlot == SID_BASICIDE_LIBREMOVED )
469 if ( m_aCurLibName.isEmpty() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) )
471 RemoveWindows( aDocument, aLibName, true );
472 if ( aDocument == m_aCurDocument && aLibName == m_aCurLibName )
474 m_aCurDocument = ScriptDocument::getApplicationScriptDocument();
475 m_aCurLibName.clear();
476 // no UpdateWindows!
477 if (SfxBindings* pBindings = GetBindingsPtr())
478 pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR );
482 else // Loaded...
483 UpdateWindows();
485 break;
486 case SID_BASICIDE_NEWMODULE:
488 VclPtr<ModulWindow> pWin = CreateBasWin( m_aCurDocument, m_aCurLibName, OUString() );
489 DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" );
490 SetCurWindow( pWin, true );
492 break;
493 case SID_BASICIDE_NEWDIALOG:
495 VclPtr<DialogWindow> pWin = CreateDlgWin( m_aCurDocument, m_aCurLibName, OUString() );
496 DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" );
497 SetCurWindow( pWin, true );
499 break;
500 case SID_BASICIDE_SBXRENAMED:
502 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
504 break;
505 case SID_BASICIDE_SBXINSERTED:
507 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
508 const SbxItem& rSbxItem = static_cast<const SbxItem&>(rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ));
509 ScriptDocument aDocument( rSbxItem.GetDocument() );
510 OUString aLibName( rSbxItem.GetLibName() );
511 OUString aName( rSbxItem.GetName() );
512 if ( m_aCurLibName.isEmpty() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) )
514 if ( rSbxItem.GetType() == TYPE_MODULE )
515 FindBasWin( aDocument, aLibName, aName, true );
516 else if ( rSbxItem.GetType() == TYPE_DIALOG )
517 FindDlgWin( aDocument, aLibName, aName, true );
520 break;
521 case SID_BASICIDE_SBXDELETED:
523 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
524 const SbxItem& rSbxItem = static_cast<const SbxItem&>(rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ));
525 ScriptDocument aDocument( rSbxItem.GetDocument() );
526 BaseWindow* pWin = FindWindow( aDocument, rSbxItem.GetLibName(), rSbxItem.GetName(), rSbxItem.GetType(), true );
527 if ( pWin )
528 RemoveWindow( pWin, true );
530 break;
531 case SID_BASICIDE_SHOWSBX:
533 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
534 const SbxItem& rSbxItem = static_cast<const SbxItem&>(rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ));
535 ScriptDocument aDocument( rSbxItem.GetDocument() );
536 OUString aLibName( rSbxItem.GetLibName() );
537 OUString aName( rSbxItem.GetName() );
538 SetCurLib( aDocument, aLibName );
539 BaseWindow* pWin = 0;
540 if ( rSbxItem.GetType() == TYPE_DIALOG )
542 pWin = FindDlgWin( aDocument, aLibName, aName, true );
544 else if ( rSbxItem.GetType() == TYPE_MODULE )
546 pWin = FindBasWin( aDocument, aLibName, aName, true );
548 else if ( rSbxItem.GetType() == TYPE_METHOD )
550 pWin = FindBasWin( aDocument, aLibName, aName, true );
551 static_cast<ModulWindow*>(pWin)->EditMacro( rSbxItem.GetMethodName() );
553 DBG_ASSERT( pWin, "Fenster wurde nicht erzeugt!" );
554 SetCurWindow( pWin, true );
555 pTabBar->MakeVisible( pTabBar->GetCurPageId() );
557 break;
558 case SID_BASICIDE_SHOWWINDOW:
560 boost::scoped_ptr< ScriptDocument > pDocument;
562 SFX_REQUEST_ARG( rReq, pDocumentItem, SfxStringItem, SID_BASICIDE_ARG_DOCUMENT, false );
563 if ( pDocumentItem )
565 OUString sDocumentCaption = pDocumentItem->GetValue();
566 if ( !sDocumentCaption.isEmpty() )
567 pDocument.reset( new ScriptDocument( ScriptDocument::getDocumentWithURLOrCaption( sDocumentCaption ) ) );
570 SFX_REQUEST_ARG( rReq, pDocModelItem, SfxUsrAnyItem, SID_BASICIDE_ARG_DOCUMENT_MODEL, false );
571 if ( !pDocument.get() && pDocModelItem )
573 uno::Reference< frame::XModel > xModel( pDocModelItem->GetValue(), UNO_QUERY );
574 if ( xModel.is() )
575 pDocument.reset( new ScriptDocument( xModel ) );
578 if ( !pDocument.get() )
579 break;
581 SFX_REQUEST_ARG( rReq, pLibNameItem, SfxStringItem, SID_BASICIDE_ARG_LIBNAME, false );
582 if ( !pLibNameItem )
583 break;
585 OUString aLibName( pLibNameItem->GetValue() );
586 pDocument->loadLibraryIfExists( E_SCRIPTS, aLibName );
587 SetCurLib( *pDocument, aLibName );
588 SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_BASICIDE_ARG_NAME, false );
589 if ( pNameItem )
591 OUString aName( pNameItem->GetValue() );
592 OUString aModType( "Module" );
593 OUString aDlgType( "Dialog" );
594 OUString aType( aModType );
595 SFX_REQUEST_ARG( rReq, pTypeItem, SfxStringItem, SID_BASICIDE_ARG_TYPE, false );
596 if ( pTypeItem )
597 aType = pTypeItem->GetValue();
599 BaseWindow* pWin = 0;
600 if ( aType == aModType )
601 pWin = FindBasWin( *pDocument, aLibName, aName, false );
602 else if ( aType == aDlgType )
603 pWin = FindDlgWin( *pDocument, aLibName, aName, false );
605 if ( pWin )
607 SetCurWindow( pWin, true );
608 if ( pTabBar )
609 pTabBar->MakeVisible( pTabBar->GetCurPageId() );
611 if (ModulWindow* pModWin = dynamic_cast<ModulWindow*>(pWin))
613 SFX_REQUEST_ARG( rReq, pLineItem, SfxUInt32Item, SID_BASICIDE_ARG_LINE, false );
614 if ( pLineItem )
616 pModWin->AssertValidEditEngine();
617 TextView* pTextView = pModWin->GetEditView();
618 if ( pTextView )
620 TextEngine* pTextEngine = pTextView->GetTextEngine();
621 if ( pTextEngine )
623 sal_uInt32 nLine = pLineItem->GetValue();
624 sal_uInt32 nLineCount = 0;
625 for ( sal_uInt32 i = 0, nCount = pTextEngine->GetParagraphCount(); i < nCount; ++i )
626 nLineCount += pTextEngine->GetLineCount( i );
627 if ( nLine > nLineCount )
628 nLine = nLineCount;
629 if ( nLine > 0 )
630 --nLine;
632 // scroll window and set selection
633 long nVisHeight = pModWin->GetOutputSizePixel().Height();
634 long nTextHeight = pTextEngine->GetTextHeight();
635 if ( nTextHeight > nVisHeight )
637 long nMaxY = nTextHeight - nVisHeight;
638 long nOldY = pTextView->GetStartDocPos().Y();
639 long nNewY = nLine * pTextEngine->GetCharHeight() - nVisHeight / 2;
640 nNewY = ::std::min( nNewY, nMaxY );
641 pTextView->Scroll( 0, -( nNewY - nOldY ) );
642 pTextView->ShowCursor( false, true );
643 pModWin->GetEditVScrollBar().SetThumbPos( pTextView->GetStartDocPos().Y() );
645 sal_uInt16 nCol1 = 0, nCol2 = 0;
646 SFX_REQUEST_ARG( rReq, pCol1Item, SfxUInt16Item, SID_BASICIDE_ARG_COLUMN1, false );
647 if ( pCol1Item )
649 nCol1 = pCol1Item->GetValue();
650 if ( nCol1 > 0 )
651 --nCol1;
652 nCol2 = nCol1;
654 SFX_REQUEST_ARG( rReq, pCol2Item, SfxUInt16Item, SID_BASICIDE_ARG_COLUMN2, false );
655 if ( pCol2Item )
657 nCol2 = pCol2Item->GetValue();
658 if ( nCol2 > 0 )
659 --nCol2;
661 TextSelection aSel( TextPaM( nLine, nCol1 ), TextPaM( nLine, nCol2 ) );
662 pTextView->SetSelection( aSel );
663 pTextView->ShowCursor();
664 vcl::Window* pWindow_ = pTextView->GetWindow();
665 if ( pWindow_ )
666 pWindow_->GrabFocus();
673 rReq.Done();
675 break;
677 case SID_BASICIDE_MANAGE_LANG:
679 ScopedVclPtrInstance< ManageLanguageDialog > aDlg(pCurWin, m_pCurLocalizationMgr);
680 aDlg->Execute();
681 rReq.Done();
683 break;
685 default:
686 if (pLayout)
687 pLayout->ExecuteGlobal(rReq);
688 if (pCurWin)
689 pCurWin->ExecuteGlobal(rReq);
690 break;
694 void Shell::GetState(SfxItemSet &rSet)
696 SfxWhichIter aIter(rSet);
697 for ( sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich() )
699 switch ( nWh )
701 case SID_DOCINFO:
703 rSet.DisableItem( nWh );
705 break;
706 case SID_SAVEDOC:
708 bool bDisable = false;
710 if ( pCurWin )
712 if ( !pCurWin->IsModified() )
714 ScriptDocument aDocument( pCurWin->GetDocument() );
715 bDisable = ( !aDocument.isAlive() )
716 || ( aDocument.isDocument() ? !aDocument.isDocumentModified() : !IsAppBasicModified() );
719 else
721 bDisable = true;
724 if ( bDisable )
725 rSet.DisableItem( nWh );
727 break;
728 case SID_NEWWINDOW:
729 case SID_SAVEASDOC:
731 rSet.DisableItem( nWh );
733 break;
734 case SID_SIGNATURE:
736 SignatureState nState = SignatureState::NOSIGNATURES;
737 if ( pCurWin )
739 DocumentSignature aSignature( pCurWin->GetDocument() );
740 nState = aSignature.getScriptingSignatureState();
742 rSet.Put( SfxUInt16Item( SID_SIGNATURE, static_cast<sal_uInt16>(nState) ) );
744 break;
745 case SID_BASICIDE_MODULEDLG:
747 if ( StarBASIC::IsRunning() )
748 rSet.DisableItem( nWh );
750 break;
751 case SID_BASICIDE_OBJCAT:
752 if (pLayout)
753 rSet.Put(SfxBoolItem(nWh, aObjectCatalog->IsVisible()));
754 else
755 rSet.Put(SfxVisibilityItem(nWh, false));
756 break;
757 case SID_BASICIDE_SHOWSBX:
758 case SID_BASICIDE_CREATEMACRO:
759 case SID_BASICIDE_EDITMACRO:
760 case SID_BASICIDE_NAMECHANGEDONTAB:
764 break;
766 case SID_BASICIDE_ADDWATCH:
767 case SID_BASICIDE_REMOVEWATCH:
768 case SID_BASICLOAD:
769 case SID_BASICSAVEAS:
770 case SID_BASICIDE_MATCHGROUP:
772 if (!dynamic_cast<ModulWindow*>(pCurWin.get()))
773 rSet.DisableItem( nWh );
774 else if ( ( nWh == SID_BASICLOAD ) && ( StarBASIC::IsRunning() || ( pCurWin && pCurWin->IsReadOnly() ) ) )
775 rSet.DisableItem( nWh );
777 break;
778 case SID_BASICRUN:
779 case SID_BASICSTEPINTO:
780 case SID_BASICSTEPOVER:
781 case SID_BASICSTEPOUT:
782 case SID_BASICIDE_TOGGLEBRKPNT:
783 case SID_BASICIDE_MANAGEBRKPNTS:
785 if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get()))
787 if (StarBASIC::IsRunning() && !pMCurWin->GetBasicStatus().bIsInReschedule)
788 rSet.DisableItem(nWh);
790 else
791 rSet.DisableItem( nWh );
793 break;
794 case SID_BASICCOMPILE:
796 if (StarBASIC::IsRunning() || !dynamic_cast<ModulWindow*>(pCurWin.get()))
797 rSet.DisableItem( nWh );
799 break;
800 case SID_BASICSTOP:
802 // stop is always possible when some Basic is running...
803 if (!StarBASIC::IsRunning())
804 rSet.DisableItem( nWh );
806 break;
807 case SID_CHOOSE_CONTROLS:
808 case SID_DIALOG_TESTMODE:
809 case SID_INSERT_FORM_RADIO:
810 case SID_INSERT_FORM_CHECK:
811 case SID_INSERT_FORM_LIST:
812 case SID_INSERT_FORM_COMBO:
813 case SID_INSERT_FORM_VSCROLL:
814 case SID_INSERT_FORM_HSCROLL:
815 case SID_INSERT_FORM_SPIN:
817 if (!dynamic_cast<DialogWindow*>(pCurWin.get()))
818 rSet.DisableItem( nWh );
820 break;
821 case SID_SHOW_FORMS:
822 case SID_SHOW_HIDDEN:
824 rSet.DisableItem( nWh );
826 break;
827 case SID_SEARCH_OPTIONS:
829 SearchOptionFlags nOptions = SearchOptionFlags::NONE;
830 if( pCurWin )
831 nOptions = pCurWin->GetSearchOptions();
832 rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, static_cast<sal_uInt16>(nOptions) ) );
834 break;
835 case SID_BASICIDE_LIBSELECTOR:
837 OUString aName;
838 if ( !m_aCurLibName.isEmpty() )
840 LibraryLocation eLocation = m_aCurDocument.getLibraryLocation( m_aCurLibName );
841 aName = CreateMgrAndLibStr( m_aCurDocument.getTitle( eLocation ), m_aCurLibName );
843 SfxStringItem aItem( SID_BASICIDE_LIBSELECTOR, aName );
844 rSet.Put( aItem );
846 break;
847 case SID_SEARCH_ITEM:
849 OUString aSelected = GetSelectionText(true);
850 SvxSearchItem& rItem = GetExtraData()->GetSearchItem();
851 rItem.SetSearchString( aSelected );
852 rSet.Put( rItem );
854 break;
855 case SID_BASICIDE_STAT_DATE:
857 OUString aDate( "Datum?!" );
858 SfxStringItem aItem( SID_BASICIDE_STAT_DATE, aDate );
859 rSet.Put( aItem );
861 break;
862 case SID_DOC_MODIFIED:
864 bool bModified = false;
866 if ( pCurWin )
868 if ( pCurWin->IsModified() )
869 bModified = true;
870 else
872 ScriptDocument aDocument( pCurWin->GetDocument() );
873 bModified = aDocument.isDocument() ? aDocument.isDocumentModified() : IsAppBasicModified();
877 SfxBoolItem aItem(SID_DOC_MODIFIED, bModified);
878 rSet.Put( aItem );
880 break;
881 case SID_BASICIDE_STAT_TITLE:
883 if ( pCurWin )
885 OUString aTitle = pCurWin->CreateQualifiedName();
886 SfxStringItem aItem( SID_BASICIDE_STAT_TITLE, aTitle );
887 rSet.Put( aItem );
890 break;
891 // are interpreted by the controller:
892 case SID_ATTR_SIZE:
893 case SID_ATTR_INSERT:
894 break;
895 case SID_UNDO:
896 case SID_REDO:
898 if( GetUndoManager() ) // recursive GetState else
899 GetViewFrame()->GetSlotState( nWh, NULL, &rSet );
901 break;
902 case SID_BASICIDE_CURRENT_LANG:
904 if( (pCurWin && pCurWin->IsReadOnly()) || GetCurLibName().isEmpty() )
905 rSet.DisableItem( nWh );
906 else
908 OUString aItemStr;
909 boost::shared_ptr<LocalizationMgr> pCurMgr(GetCurLocalizationMgr());
910 if ( pCurMgr->isLibraryLocalized() )
912 Sequence< lang::Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales();
913 const lang::Locale* pLocale = aLocaleSeq.getConstArray();
914 sal_Int32 i, nCount = aLocaleSeq.getLength();
916 // Force different results for any combination of locales and default locale
917 OUString aLangStr;
918 for ( i = 0; i <= nCount; ++i )
920 lang::Locale aLocale;
921 if( i < nCount )
922 aLocale = pLocale[i];
923 else
924 aLocale = pCurMgr->getStringResourceManager()->getDefaultLocale();
926 aLangStr += aLocale.Language;
927 aLangStr += aLocale.Country;
928 aLangStr += aLocale.Variant;
930 aItemStr = aLangStr;
932 rSet.Put( SfxStringItem( nWh, aItemStr ) );
935 break;
937 case SID_BASICIDE_MANAGE_LANG:
939 if( (pCurWin && pCurWin->IsReadOnly()) || GetCurLibName().isEmpty() )
940 rSet.DisableItem( nWh );
942 break;
943 case SID_GOTOLINE:
945 // if this is not a module window hide the
946 // setting, doesn't make sense for example if the
947 // dialog editor is open
948 if (pCurWin && !dynamic_cast<ModulWindow*>(pCurWin.get()))
950 rSet.DisableItem( nWh );
951 rSet.Put(SfxVisibilityItem(nWh, false));
953 break;
955 default:
956 if (pLayout)
957 pLayout->GetState(rSet, nWh);
960 if ( pCurWin )
961 pCurWin->GetState( rSet );
964 bool Shell::HasUIFeature( sal_uInt32 nFeature )
966 bool bResult = false;
968 if ( (nFeature & BASICIDE_UI_FEATURE_SHOW_BROWSER) == BASICIDE_UI_FEATURE_SHOW_BROWSER )
970 // fade out (in) property browser in module (dialog) windows
971 if (dynamic_cast<DialogWindow*>(pCurWin.get()) && !pCurWin->IsReadOnly())
972 bResult = true;
975 return bResult;
978 void Shell::SetCurWindow( BaseWindow* pNewWin, bool bUpdateTabBar, bool bRememberAsCurrent )
980 if ( pNewWin != pCurWin )
982 pCurWin = pNewWin;
983 if (pLayout)
984 pLayout->Deactivating();
985 if (pCurWin)
987 if (pCurWin->GetType() == TYPE_MODULE)
988 pLayout = pModulLayout.get();
989 else
990 pLayout = pDialogLayout.get();
991 AdjustPosSizePixel(Point(0, 0), GetViewFrame()->GetWindow().GetOutputSizePixel());
992 pLayout->Activating(*pCurWin);
993 GetViewFrame()->GetWindow().SetHelpId(pCurWin->GetHid());
994 if (bRememberAsCurrent)
995 pCurWin->InsertLibInfo();
996 if (GetViewFrame()->GetWindow().IsVisible()) // SFX will do it later otherwise
997 pCurWin->Show();
998 pCurWin->Init();
999 if (!GetExtraData()->ShellInCriticalSection())
1001 vcl::Window* pFrameWindow = &GetViewFrame()->GetWindow();
1002 vcl::Window* pFocusWindow = Application::GetFocusWindow();
1003 while ( pFocusWindow && ( pFocusWindow != pFrameWindow ) )
1004 pFocusWindow = pFocusWindow->GetParent();
1005 if ( pFocusWindow ) // Focus in BasicIDE
1006 pCurWin->GrabFocus();
1009 else
1011 SetWindow(pLayout);
1012 pLayout = 0;
1014 if ( bUpdateTabBar )
1016 sal_uLong nKey = GetWindowId( pCurWin );
1017 if ( pCurWin && ( pTabBar->GetPagePos( (sal_uInt16)nKey ) == TAB_PAGE_NOTFOUND ) )
1018 pTabBar->InsertPage( (sal_uInt16)nKey, pCurWin->GetTitle() ); // has just been faded in
1019 pTabBar->SetCurPageId( (sal_uInt16)nKey );
1021 if ( pCurWin && pCurWin->IsSuspended() ) // if the window is shown in the case of an error...
1022 pCurWin->SetStatus( pCurWin->GetStatus() & ~BASWIN_SUSPENDED );
1023 if ( pCurWin )
1025 SetWindow( pCurWin );
1026 if ( pCurWin->GetDocument().isDocument() )
1027 SfxObjectShell::SetCurrentComponent( pCurWin->GetDocument().getDocument() );
1029 else if (pLayout)
1031 SetWindow(pLayout);
1032 GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW );
1033 SfxObjectShell::SetCurrentComponent(0);
1035 aObjectCatalog->SetCurrentEntry(pCurWin);
1036 SetUndoManager( pCurWin ? pCurWin->GetUndoManager() : 0 );
1037 InvalidateBasicIDESlots();
1038 EnableScrollbars(pCurWin != nullptr);
1040 if ( m_pCurLocalizationMgr )
1041 m_pCurLocalizationMgr->handleTranslationbar();
1043 ManageToolbars();
1045 // fade out (in) property browser in module (dialog) windows
1046 UIFeatureChanged();
1050 void Shell::ManageToolbars()
1052 static const char aMacroBarResName[] = "private:resource/toolbar/macrobar";
1053 static const char aDialogBarResName[] = "private:resource/toolbar/dialogbar";
1054 static const char aInsertControlsBarResName[] = "private:resource/toolbar/insertcontrolsbar";
1055 static const char aFormControlsBarResName[] = "private:resource/toolbar/formcontrolsbar";
1057 if( !pCurWin )
1058 return;
1060 Reference< beans::XPropertySet > xFrameProps
1061 ( GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
1062 if ( xFrameProps.is() )
1064 Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
1065 uno::Any a = xFrameProps->getPropertyValue( "LayoutManager" );
1066 a >>= xLayoutManager;
1067 if ( xLayoutManager.is() )
1069 xLayoutManager->lock();
1070 if (dynamic_cast<DialogWindow*>(pCurWin.get()))
1072 xLayoutManager->destroyElement( aMacroBarResName );
1074 xLayoutManager->requestElement( aDialogBarResName );
1075 xLayoutManager->requestElement( aInsertControlsBarResName );
1076 xLayoutManager->requestElement( aFormControlsBarResName );
1078 else
1080 xLayoutManager->destroyElement( aDialogBarResName );
1081 xLayoutManager->destroyElement( aInsertControlsBarResName );
1082 xLayoutManager->destroyElement( aFormControlsBarResName );
1084 xLayoutManager->requestElement( aMacroBarResName );
1086 xLayoutManager->unlock();
1091 VclPtr<BaseWindow> Shell::FindApplicationWindow()
1093 return FindWindow( ScriptDocument::getApplicationScriptDocument() );
1096 VclPtr<BaseWindow> Shell::FindWindow(
1097 ScriptDocument const& rDocument,
1098 OUString const& rLibName, OUString const& rName,
1099 ItemType eType, bool bFindSuspended
1102 for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
1104 BaseWindow* const pWin = it->second;
1105 if (pWin->Is(rDocument, rLibName, rName, eType, bFindSuspended))
1106 return pWin;
1108 return 0;
1111 bool Shell::CallBasicErrorHdl( StarBASIC* pBasic )
1113 bool nRet = false;
1114 ModulWindow* pModWin = ShowActiveModuleWindow( pBasic );
1115 if ( pModWin )
1116 nRet = pModWin->BasicErrorHdl( pBasic );
1117 return nRet;
1120 long Shell::CallBasicBreakHdl( StarBASIC* pBasic )
1122 long nRet = 0;
1123 ModulWindow* pModWin = ShowActiveModuleWindow( pBasic );
1124 if ( pModWin )
1126 bool bAppWindowDisabled, bDispatcherLocked;
1127 sal_uInt16 nWaitCount;
1128 SfxUInt16Item *pSWActionCount, *pSWLockViewCount;
1129 BasicStopped( &bAppWindowDisabled, &bDispatcherLocked,
1130 &nWaitCount, &pSWActionCount, &pSWLockViewCount );
1132 nRet = pModWin->BasicBreakHdl( pBasic );
1134 if ( StarBASIC::IsRunning() ) // if cancelled...
1136 if ( bAppWindowDisabled )
1137 Application::GetDefDialogParent()->Enable(false);
1139 if ( nWaitCount )
1141 Shell* pShell = GetShell();
1142 for ( sal_uInt16 n = 0; n < nWaitCount; n++ )
1143 pShell->GetViewFrame()->GetWindow().EnterWait();
1147 return nRet;
1150 VclPtr<ModulWindow> Shell::ShowActiveModuleWindow( StarBASIC* pBasic )
1152 SetCurLib( ScriptDocument::getApplicationScriptDocument(), OUString(), false );
1154 SbModule* pActiveModule = StarBASIC::GetActiveModule();
1155 if (SbClassModuleObject* pCMO = dynamic_cast<SbClassModuleObject*>(pActiveModule))
1156 pActiveModule = pCMO->getClassModule();
1158 DBG_ASSERT( pActiveModule, "Kein aktives Modul im ErrorHdl?!" );
1159 if ( pActiveModule )
1161 VclPtr<ModulWindow> pWin;
1162 SbxObject* pParent = pActiveModule->GetParent();
1163 if (StarBASIC* pLib = dynamic_cast<StarBASIC*>(pParent))
1165 if (BasicManager* pBasMgr = FindBasicManager(pLib))
1167 ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
1168 OUString aLibName = pLib->GetName();
1169 pWin = FindBasWin( aDocument, aLibName, pActiveModule->GetName(), true );
1170 DBG_ASSERT( pWin, "Error/Step-Hdl: Fenster wurde nicht erzeugt/gefunden!" );
1171 SetCurLib( aDocument, aLibName );
1172 SetCurWindow( pWin, true );
1175 else
1176 DBG_ASSERT(false, "No BASIC!");
1177 if (BasicManager* pBasicMgr = FindBasicManager(pBasic))
1178 StartListening( *pBasicMgr, true /* log on only once */ );
1179 return pWin;
1181 return 0;
1184 void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize )
1186 // not if iconified because the whole text would be displaced then at restore
1187 if ( GetViewFrame()->GetWindow().GetOutputSizePixel().Height() == 0 )
1188 return;
1190 Size aSz( rSize );
1191 Size aScrollBarBoxSz( aScrollBarBox->GetSizePixel() );
1192 aSz.Height() -= aScrollBarBoxSz.Height();
1194 Size aOutSz( aSz );
1195 aSz.Width() -= aScrollBarBoxSz.Width();
1196 aScrollBarBox->SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) );
1197 aVScrollBar->SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) );
1198 if ( bTabBarSplitted )
1200 // SplitSize is 0 at a resize!
1201 long nSplitPos = pTabBar->GetSizePixel().Width();
1202 if ( nSplitPos > aSz.Width() )
1203 nSplitPos = aSz.Width();
1204 pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( nSplitPos, aScrollBarBoxSz.Height() ) );
1205 long nScrlStart = rPos.X() + nSplitPos;
1206 aHScrollBar->SetPosSizePixel( Point( nScrlStart, rPos.Y()+aSz.Height() ), Size( aSz.Width() - nScrlStart + 1, aScrollBarBoxSz.Height() ) );
1207 aHScrollBar->Update();
1209 else
1211 aHScrollBar->SetPosSizePixel( Point( rPos.X()+ aSz.Width()/2 - 1, rPos.Y()+aSz.Height() ), Size( aSz.Width()/2 + 2, aScrollBarBoxSz.Height() ) );
1212 pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( aSz.Width()/2, aScrollBarBoxSz.Height() ) );
1215 if (pLayout)
1216 pLayout->SetPosSizePixel(rPos, dynamic_cast<DialogWindow*>(pCurWin.get()) ? aSz : aOutSz);
1219 Reference< XModel > Shell::GetCurrentDocument() const
1221 Reference< XModel > xDocument;
1222 if ( pCurWin && pCurWin->GetDocument().isDocument() )
1223 xDocument = pCurWin->GetDocument().getDocument();
1224 return xDocument;
1227 void Shell::Activate( bool bMDI )
1229 SfxViewShell::Activate( bMDI );
1231 if ( bMDI )
1233 if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin.get()))
1234 pDCurWin->UpdateBrowser();
1238 void Shell::Deactivate( bool bMDI )
1240 // bMDI == true means that another MDI has been activated; in case of a
1241 // deactivate due to a MessageBox bMDI is false
1242 if ( bMDI )
1244 if (DialogWindow* pXDlgWin = dynamic_cast<DialogWindow*>(pCurWin.get()))
1246 pXDlgWin->DisableBrowser();
1247 if( pXDlgWin->IsModified() )
1248 MarkDocumentModified( pXDlgWin->GetDocument() );
1251 // test CanClose to also test during deactivating the BasicIDE whether
1252 // the sourcecode is too large in one of the modules...
1253 for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
1255 BaseWindow* pWin = it->second;
1256 if ( /* !pWin->IsSuspended() && */ !pWin->CanClose() )
1258 if ( !m_aCurLibName.isEmpty() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) )
1259 SetCurLib( ScriptDocument::getApplicationScriptDocument(), OUString(), false );
1260 SetCurWindow( pWin, true );
1261 break;
1267 } // namespace basctl
1269 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */