bump product version to 4.1.6.2
[LibreOffice.git] / basctl / source / basicide / basides1.cxx
blob67798897be90ec36bfeb628f429a41a307c18a4d
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 "basobj.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/frame/XLayoutManager.hpp>
35 #include <com/sun/star/script/XLibraryContainerPassword.hpp>
36 #include <com/sun/star/task/XStatusIndicatorFactory.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/objface.hxx>
43 #include <sfx2/printer.hxx>
44 #include <sfx2/request.hxx>
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>
53 namespace basctl
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 )
62 if ( !pCurWin )
63 return;
65 switch ( rReq.GetSlot() )
67 case SID_BASICIDE_HIDECURPAGE:
69 pCurWin->StoreData();
70 RemoveWindow( pCurWin, false );
72 break;
73 case SID_BASICIDE_RENAMECURRENT:
75 pTabBar->StartEditMode( pTabBar->GetCurPageId() );
77 break;
78 case FID_SEARCH_NOW:
80 if (!pCurWin->HasActiveEditor())
81 break;
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, "Wich fuer 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);
92 sal_Int32 nFound = 0;
93 bool bCanceled = false;
94 if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL)
96 sal_uInt16 nActModWindows = 0;
97 for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
99 BaseWindow* pWin = it->second;
100 if (pWin->HasActiveEditor())
101 nActModWindows++;
104 if ( nActModWindows <= 1 || ( !rSearchItem.GetSelection() && QueryBox( pCurWin, WB_YES_NO|WB_DEF_YES, String(IDEResId(RID_STR_SEARCHALLMODULES)) ).Execute() == RET_YES ) )
106 for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
108 BaseWindow* pWin = it->second;
109 nFound += pWin->StartSearchAndReplace(rSearchItem);
112 else
113 nFound = pCurWin->StartSearchAndReplace(rSearchItem);
115 OUString aReplStr(IDE_RESSTR(RID_STR_SEARCHREPLACES));
116 aReplStr = aReplStr.replaceAll("XX", OUString::valueOf(nFound));
117 InfoBox( pCurWin, aReplStr ).Execute();
119 else
121 nFound = pCurWin->StartSearchAndReplace(rSearchItem);
122 if ( !nFound && !rSearchItem.GetSelection() )
124 // search other modules...
125 bool bChangeCurWindow = false;
126 WindowTableIt it;
127 for (it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
128 if (it->second == pCurWin)
129 break;
130 if (it != aWindowTable.end())
131 ++it;
132 BaseWindow* pWin = it != aWindowTable.end() ? it->second : 0;
134 bool bSearchedFromStart = false;
135 while ( !nFound && !bCanceled && ( pWin || !bSearchedFromStart ) )
137 if ( !pWin )
139 SfxViewFrame* pViewFrame = GetViewFrame();
140 SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SEARCH_DLG ) : NULL;
141 Window* pParent = pChildWin ? pChildWin->GetWindow() : NULL;
142 QueryBox aQuery(pParent, WB_YES_NO|WB_DEF_YES, IDE_RESSTR(RID_STR_SEARCHFROMSTART));
143 if ( aQuery.Execute() == RET_YES )
145 it = aWindowTable.begin();
146 if ( it != aWindowTable.end() )
147 pWin = it->second;
148 bSearchedFromStart = true;
150 else
151 bCanceled = true;
154 if (pWin && pWin->HasActiveEditor())
156 if ( pWin != pCurWin )
158 if ( pCurWin )
159 pWin->SetSizePixel( pCurWin->GetSizePixel() );
160 nFound = pWin->StartSearchAndReplace(rSearchItem, true);
162 if ( nFound )
164 bChangeCurWindow = true;
165 break;
168 if ( pWin && ( pWin != pCurWin ) )
170 if ( it != aWindowTable.end() )
171 ++it;
172 pWin = it != aWindowTable.end() ? it->second : 0;
174 else
175 pWin = 0;
177 if ( !nFound && bSearchedFromStart )
178 nFound = pCurWin->StartSearchAndReplace(rSearchItem, true);
179 if ( bChangeCurWindow )
180 SetCurWindow( pWin, true );
182 if ( !nFound && !bCanceled )
183 InfoBox( pCurWin, String(IDEResId(RID_STR_SEARCHNOTFOUND)) ).Execute();
186 rReq.Done();
188 break;
189 case SID_UNDO:
190 case SID_REDO:
191 if ( GetUndoManager() && pCurWin->AllowUndo() )
192 GetViewFrame()->ExecuteSlot( rReq );
193 break;
194 default:
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();
203 switch ( nSlot )
205 case SID_BASICSTOP:
207 // maybe do not simply stop if on breakpoint!
208 if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin))
209 pMCurWin->BasicStop();
210 StopBasic();
212 break;
214 case SID_SAVEDOC:
216 if ( pCurWin )
218 // rewrite date into the BASIC
219 StoreAllWindowData();
221 // document basic
222 ScriptDocument aDocument( pCurWin->GetDocument() );
223 if ( aDocument.isDocument() )
225 uno::Reference< task::XStatusIndicator > xStatusIndicator;
227 SFX_REQUEST_ARG( rReq, pStatusIndicatorItem, SfxUnoAnyItem,
228 SID_PROGRESS_STATUSBAR_CONTROL, false );
229 if ( pStatusIndicatorItem )
230 OSL_VERIFY( pStatusIndicatorItem->GetValue() >>= xStatusIndicator );
231 else
233 // get statusindicator
234 SfxViewFrame *pFrame_ = GetFrame();
235 if ( pFrame_ )
237 uno::Reference< task::XStatusIndicatorFactory > xStatFactory(
238 pFrame_->GetFrame().GetFrameInterface(),
239 uno::UNO_QUERY );
240 if( xStatFactory.is() )
241 xStatusIndicator = xStatFactory->createStatusIndicator();
244 if ( xStatusIndicator.is() )
245 rReq.AppendItem( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, uno::makeAny( xStatusIndicator ) ) );
248 aDocument.saveDocument( xStatusIndicator );
251 if (SfxBindings* pBindings = GetBindingsPtr())
253 pBindings->Invalidate( SID_DOC_MODIFIED );
254 pBindings->Invalidate( SID_SAVEDOC );
255 pBindings->Invalidate( SID_SIGNATURE );
259 break;
260 case SID_BASICIDE_MODULEDLG:
262 if ( rReq.GetArgs() )
264 const SfxUInt16Item &rTabId = (const SfxUInt16Item&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID );
265 Organize( rTabId.GetValue() );
267 else
268 Organize( 0 );
270 break;
271 case SID_BASICIDE_CHOOSEMACRO:
273 ChooseMacro( NULL, false, OUString() );
275 break;
276 case SID_BASICIDE_CREATEMACRO:
277 case SID_BASICIDE_EDITMACRO:
279 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
280 const SfxMacroInfoItem& rInfo = (const SfxMacroInfoItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO );
281 BasicManager* pBasMgr = (BasicManager*)rInfo.GetBasicManager();
282 DBG_ASSERT( pBasMgr, "Nichts selektiert im Basic-Baum ?" );
284 ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
286 StartListening( *pBasMgr, true /* log on only once */ );
287 OUString aLibName( rInfo.GetLib() );
288 if ( aLibName.isEmpty() )
289 aLibName = "Standard" ;
290 StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
291 if ( !pBasic )
293 // load module and dialog library (if not loaded)
294 aDocument.loadLibraryIfExists( E_SCRIPTS, aLibName );
295 aDocument.loadLibraryIfExists( E_DIALOGS, aLibName );
297 // get Basic
298 pBasic = pBasMgr->GetLib( aLibName );
300 DBG_ASSERT( pBasic, "No Basic!" );
302 SetCurLib( aDocument, aLibName );
304 if ( pBasic && rReq.GetSlot() == SID_BASICIDE_CREATEMACRO )
306 SbModule* pModule = pBasic->FindModule( rInfo.GetModule() );
307 if ( !pModule )
309 if ( rInfo.GetModule().Len() || !pBasic->GetModules()->Count() )
311 OUString aModName = rInfo.GetModule();
313 OUString sModuleCode;
314 if ( aDocument.createModule( aLibName, aModName, false, sModuleCode ) )
315 pModule = pBasic->FindModule( aModName );
317 else
318 pModule = (SbModule*) pBasic->GetModules()->Get(0);
320 DBG_ASSERT( pModule, "Kein Modul!" );
321 if ( pModule && !pModule->GetMethods()->Find( rInfo.GetMethod(), SbxCLASS_METHOD ) )
322 CreateMacro( pModule, rInfo.GetMethod() );
324 SfxViewFrame* pViewFrame = GetViewFrame();
325 if ( pViewFrame )
326 pViewFrame->ToTop();
327 ModulWindow* pWin = FindBasWin( aDocument, aLibName, rInfo.GetModule(), true );
328 DBG_ASSERT( pWin, "Edit/Create Macro: Fenster wurde nicht erzeugt/gefunden!" );
329 SetCurWindow( pWin, true );
330 pWin->EditMacro( rInfo.GetMethod() );
332 break;
334 case SID_BASICIDE_OBJCAT:
335 // toggling object catalog
336 aObjectCatalog.Show(!aObjectCatalog.IsVisible());
337 if (pLayout)
338 pLayout->ArrangeWindows();
339 // refresh the button state
340 if (SfxBindings* pBindings = GetBindingsPtr())
341 pBindings->Invalidate(SID_BASICIDE_OBJCAT);
342 break;
344 case SID_BASICIDE_NAMECHANGEDONTAB:
346 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
347 const SfxUInt16Item &rTabId = (const SfxUInt16Item&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID );
348 const SfxStringItem &rModName = (const SfxStringItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MODULENAME );
349 if ( aWindowTable.find( rTabId.GetValue() ) != aWindowTable.end() )
351 BaseWindow* pWin = aWindowTable[ rTabId.GetValue() ];
352 OUString aNewName( rModName.GetValue() );
353 OUString aOldName( pWin->GetName() );
354 if ( aNewName != aOldName )
356 bool bRenameOk = false;
357 if (ModulWindow* pModWin = dynamic_cast<ModulWindow*>(pWin))
359 OUString aLibName = pModWin->GetLibName();
360 ScriptDocument aDocument( pWin->GetDocument() );
362 if (RenameModule(pModWin, aDocument, aLibName, aOldName, aNewName))
364 bRenameOk = true;
365 // Because we listen for container events for script
366 // modules, rename will delete the 'old' window
367 // pWin has been invalidated, restore now
368 pWin = FindBasWin( aDocument, aLibName, aNewName, true );
372 else if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(pWin))
374 bRenameOk = pDlgWin->RenameDialog( aNewName );
376 if ( bRenameOk )
378 MarkDocumentModified( pWin->GetDocument() );
380 else
382 // set old name in TabWriter
383 sal_uInt16 nId = GetWindowId( pWin );
384 DBG_ASSERT( nId, "No entry in Tabbar!" );
385 if ( nId )
386 pTabBar->SetPageText( nId, aOldName );
390 // set focus to current window
391 pWin->GrabFocus();
394 break;
395 case SID_BASICIDE_STOREMODULESOURCE:
396 case SID_BASICIDE_UPDATEMODULESOURCE:
398 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
399 const SfxMacroInfoItem& rInfo = (const SfxMacroInfoItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO );
400 BasicManager* pBasMgr = (BasicManager*)rInfo.GetBasicManager();
401 DBG_ASSERT( pBasMgr, "Store source: Kein BasMgr?" );
402 ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
403 ModulWindow* pWin = FindBasWin( aDocument, rInfo.GetLib(), rInfo.GetModule(), false, true );
404 if ( pWin )
406 if ( rReq.GetSlot() == SID_BASICIDE_STOREMODULESOURCE )
407 pWin->StoreData();
408 else
409 pWin->UpdateData();
412 break;
413 case SID_BASICIDE_STOREALLMODULESOURCES:
414 case SID_BASICIDE_UPDATEALLMODULESOURCES:
416 for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
418 BaseWindow* pWin = it->second;
419 if (!pWin->IsSuspended() && dynamic_cast<ModulWindow*>(pWin))
421 if ( rReq.GetSlot() == SID_BASICIDE_STOREALLMODULESOURCES )
422 pWin->StoreData();
423 else
424 pWin->UpdateData();
428 break;
429 case SID_BASICIDE_LIBSELECTED:
430 case SID_BASICIDE_LIBREMOVED:
431 case SID_BASICIDE_LIBLOADED:
433 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
434 const SfxUsrAnyItem& rShellItem = (const SfxUsrAnyItem&)rReq.GetArgs()->Get( SID_BASICIDE_ARG_DOCUMENT_MODEL );
435 uno::Reference< frame::XModel > xModel( rShellItem.GetValue(), UNO_QUERY );
436 ScriptDocument aDocument( xModel.is() ? ScriptDocument( xModel ) : ScriptDocument::getApplicationScriptDocument() );
437 const SfxStringItem& rLibNameItem = (const SfxStringItem&)rReq.GetArgs()->Get( SID_BASICIDE_ARG_LIBNAME );
438 OUString aLibName( rLibNameItem.GetValue() );
440 if ( nSlot == SID_BASICIDE_LIBSELECTED )
442 // load module and dialog library (if not loaded)
443 aDocument.loadLibraryIfExists( E_SCRIPTS, aLibName );
444 aDocument.loadLibraryIfExists( E_DIALOGS, aLibName );
446 // check password, if library is password protected and not verified
447 bool bOK = true;
448 Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
449 if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
451 Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
452 if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
454 OUString aPassword;
455 bOK = QueryPassword( xModLibContainer, aLibName, aPassword );
459 if ( bOK )
461 SetCurLib( aDocument, aLibName, true, false );
463 else
465 // adjust old value...
466 if (SfxBindings* pBindings = GetBindingsPtr())
467 pBindings->Invalidate(SID_BASICIDE_LIBSELECTOR, true, false);
470 else if ( nSlot == SID_BASICIDE_LIBREMOVED )
472 if ( m_aCurLibName.isEmpty() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) )
474 RemoveWindows( aDocument, aLibName, true );
475 if ( aDocument == m_aCurDocument && aLibName == m_aCurLibName )
477 m_aCurDocument = ScriptDocument::getApplicationScriptDocument();
478 m_aCurLibName = String();
479 // no UpdateWindows!
480 if (SfxBindings* pBindings = GetBindingsPtr())
481 pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR );
485 else // Loaded...
486 UpdateWindows();
488 break;
489 case SID_BASICIDE_NEWMODULE:
491 ModulWindow* pWin = CreateBasWin( m_aCurDocument, m_aCurLibName, String() );
492 DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" );
493 SetCurWindow( pWin, true );
495 break;
496 case SID_BASICIDE_NEWDIALOG:
498 DialogWindow* pWin = CreateDlgWin( m_aCurDocument, m_aCurLibName, String() );
499 DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" );
500 SetCurWindow( pWin, true );
502 break;
503 case SID_BASICIDE_SBXRENAMED:
505 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
507 break;
508 case SID_BASICIDE_SBXINSERTED:
510 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
511 const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX );
512 ScriptDocument aDocument( rSbxItem.GetDocument() );
513 OUString aLibName( rSbxItem.GetLibName() );
514 OUString aName( rSbxItem.GetName() );
515 if ( m_aCurLibName.isEmpty() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) )
517 if ( rSbxItem.GetType() == TYPE_MODULE )
518 FindBasWin( aDocument, aLibName, aName, true );
519 else if ( rSbxItem.GetType() == TYPE_DIALOG )
520 FindDlgWin( aDocument, aLibName, aName, true );
523 break;
524 case SID_BASICIDE_SBXDELETED:
526 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
527 const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX );
528 ScriptDocument aDocument( rSbxItem.GetDocument() );
529 BaseWindow* pWin = FindWindow( aDocument, rSbxItem.GetLibName(), rSbxItem.GetName(), rSbxItem.GetType(), true );
530 if ( pWin )
531 RemoveWindow( pWin, true );
533 break;
534 case SID_BASICIDE_SHOWSBX:
536 DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
537 const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX );
538 ScriptDocument aDocument( rSbxItem.GetDocument() );
539 OUString aLibName( rSbxItem.GetLibName() );
540 OUString aName( rSbxItem.GetName() );
541 SetCurLib( aDocument, aLibName );
542 BaseWindow* pWin = 0;
543 if ( rSbxItem.GetType() == TYPE_DIALOG )
545 pWin = FindDlgWin( aDocument, aLibName, aName, true );
547 else if ( rSbxItem.GetType() == TYPE_MODULE )
549 pWin = FindBasWin( aDocument, aLibName, aName, true );
551 else if ( rSbxItem.GetType() == TYPE_METHOD )
553 pWin = FindBasWin( aDocument, aLibName, aName, true );
554 static_cast<ModulWindow*>(pWin)->EditMacro( rSbxItem.GetMethodName() );
556 DBG_ASSERT( pWin, "Fenster wurde nicht erzeugt!" );
557 SetCurWindow( pWin, true );
558 pTabBar->MakeVisible( pTabBar->GetCurPageId() );
560 break;
561 case SID_BASICIDE_SHOWWINDOW:
563 ::std::auto_ptr< ScriptDocument > pDocument;
565 SFX_REQUEST_ARG( rReq, pDocumentItem, SfxStringItem, SID_BASICIDE_ARG_DOCUMENT, false );
566 if ( pDocumentItem )
568 OUString sDocumentCaption = pDocumentItem->GetValue();
569 if ( !sDocumentCaption.isEmpty() )
570 pDocument.reset( new ScriptDocument( ScriptDocument::getDocumentWithURLOrCaption( sDocumentCaption ) ) );
573 SFX_REQUEST_ARG( rReq, pDocModelItem, SfxUsrAnyItem, SID_BASICIDE_ARG_DOCUMENT_MODEL, false );
574 if ( !pDocument.get() && pDocModelItem )
576 uno::Reference< frame::XModel > xModel( pDocModelItem->GetValue(), UNO_QUERY );
577 if ( xModel.is() )
578 pDocument.reset( new ScriptDocument( xModel ) );
581 if ( !pDocument.get() )
582 break;
584 SFX_REQUEST_ARG( rReq, pLibNameItem, SfxStringItem, SID_BASICIDE_ARG_LIBNAME, false );
585 if ( !pLibNameItem )
586 break;
588 OUString aLibName( pLibNameItem->GetValue() );
589 pDocument->loadLibraryIfExists( E_SCRIPTS, aLibName );
590 SetCurLib( *pDocument, aLibName );
591 SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_BASICIDE_ARG_NAME, false );
592 if ( pNameItem )
594 OUString aName( pNameItem->GetValue() );
595 OUString aModType( "Module" );
596 OUString aDlgType( "Dialog" );
597 OUString aType( aModType );
598 SFX_REQUEST_ARG( rReq, pTypeItem, SfxStringItem, SID_BASICIDE_ARG_TYPE, false );
599 if ( pTypeItem )
600 aType = pTypeItem->GetValue();
602 BaseWindow* pWin = 0;
603 if ( aType == aModType )
604 pWin = FindBasWin( *pDocument, aLibName, aName, false );
605 else if ( aType == aDlgType )
606 pWin = FindDlgWin( *pDocument, aLibName, aName, false );
608 if ( pWin )
610 SetCurWindow( pWin, true );
611 if ( pTabBar )
612 pTabBar->MakeVisible( pTabBar->GetCurPageId() );
614 if (ModulWindow* pModWin = dynamic_cast<ModulWindow*>(pWin))
616 SFX_REQUEST_ARG( rReq, pLineItem, SfxUInt32Item, SID_BASICIDE_ARG_LINE, false );
617 if ( pLineItem )
619 pModWin->AssertValidEditEngine();
620 TextView* pTextView = pModWin->GetEditView();
621 if ( pTextView )
623 TextEngine* pTextEngine = pTextView->GetTextEngine();
624 if ( pTextEngine )
626 sal_uInt32 nLine = pLineItem->GetValue();
627 sal_uInt32 nLineCount = 0;
628 for ( sal_uInt32 i = 0, nCount = pTextEngine->GetParagraphCount(); i < nCount; ++i )
629 nLineCount += pTextEngine->GetLineCount( i );
630 if ( nLine > nLineCount )
631 nLine = nLineCount;
632 if ( nLine > 0 )
633 --nLine;
635 // scroll window and set selection
636 long nVisHeight = pModWin->GetOutputSizePixel().Height();
637 long nTextHeight = pTextEngine->GetTextHeight();
638 if ( nTextHeight > nVisHeight )
640 long nMaxY = nTextHeight - nVisHeight;
641 long nOldY = pTextView->GetStartDocPos().Y();
642 long nNewY = nLine * pTextEngine->GetCharHeight() - nVisHeight / 2;
643 nNewY = ::std::min( nNewY, nMaxY );
644 pTextView->Scroll( 0, -( nNewY - nOldY ) );
645 pTextView->ShowCursor( false, true );
646 pModWin->GetEditVScrollBar().SetThumbPos( pTextView->GetStartDocPos().Y() );
648 sal_uInt16 nCol1 = 0, nCol2 = 0;
649 SFX_REQUEST_ARG( rReq, pCol1Item, SfxUInt16Item, SID_BASICIDE_ARG_COLUMN1, false );
650 if ( pCol1Item )
652 nCol1 = pCol1Item->GetValue();
653 if ( nCol1 > 0 )
654 --nCol1;
655 nCol2 = nCol1;
657 SFX_REQUEST_ARG( rReq, pCol2Item, SfxUInt16Item, SID_BASICIDE_ARG_COLUMN2, false );
658 if ( pCol2Item )
660 nCol2 = pCol2Item->GetValue();
661 if ( nCol2 > 0 )
662 --nCol2;
664 TextSelection aSel( TextPaM( nLine, nCol1 ), TextPaM( nLine, nCol2 ) );
665 pTextView->SetSelection( aSel );
666 pTextView->ShowCursor();
667 Window* pWindow_ = pTextView->GetWindow();
668 if ( pWindow_ )
669 pWindow_->GrabFocus();
676 rReq.Done();
678 break;
680 case SID_BASICIDE_MANAGE_LANG:
682 ManageLanguageDialog aDlg(pCurWin, m_pCurLocalizationMgr);
683 aDlg.Execute();
684 rReq.Done();
686 break;
688 default:
689 if (pLayout)
690 pLayout->ExecuteGlobal(rReq);
691 if (pCurWin)
692 pCurWin->ExecuteGlobal(rReq);
693 break;
697 void Shell::GetState(SfxItemSet &rSet)
699 SfxWhichIter aIter(rSet);
700 for ( sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich() )
702 switch ( nWh )
704 case SID_DOCINFO:
706 rSet.DisableItem( nWh );
708 break;
709 case SID_SAVEDOC:
711 bool bDisable = false;
713 if ( pCurWin )
715 if ( !pCurWin->IsModified() )
717 ScriptDocument aDocument( pCurWin->GetDocument() );
718 bDisable = ( !aDocument.isAlive() )
719 || ( aDocument.isDocument() ? !aDocument.isDocumentModified() : !IsAppBasicModified() );
722 else
724 bDisable = true;
727 if ( bDisable )
728 rSet.DisableItem( nWh );
730 break;
731 case SID_NEWWINDOW:
732 case SID_SAVEASDOC:
734 rSet.DisableItem( nWh );
736 break;
737 case SID_SIGNATURE:
739 sal_uInt16 nState = 0;
740 if ( pCurWin )
742 DocumentSignature aSignature( pCurWin->GetDocument() );
743 nState = aSignature.getScriptingSignatureState();
745 rSet.Put( SfxUInt16Item( SID_SIGNATURE, nState ) );
747 break;
748 case SID_BASICIDE_MODULEDLG:
750 if ( StarBASIC::IsRunning() )
751 rSet.DisableItem( nWh );
753 break;
754 case SID_BASICIDE_OBJCAT:
755 if (pLayout)
756 rSet.Put(SfxBoolItem(nWh, aObjectCatalog.IsVisible()));
757 else
758 rSet.Put(SfxVisibilityItem(nWh, false));
759 break;
760 case SID_BASICIDE_SHOWSBX:
761 case SID_BASICIDE_CREATEMACRO:
762 case SID_BASICIDE_EDITMACRO:
763 case SID_BASICIDE_NAMECHANGEDONTAB:
767 break;
769 case SID_BASICIDE_ADDWATCH:
770 case SID_BASICIDE_REMOVEWATCH:
771 case SID_BASICLOAD:
772 case SID_BASICSAVEAS:
773 case SID_BASICIDE_MATCHGROUP:
775 if (!dynamic_cast<ModulWindow*>(pCurWin))
776 rSet.DisableItem( nWh );
777 else if ( ( nWh == SID_BASICLOAD ) && ( StarBASIC::IsRunning() || ( pCurWin && pCurWin->IsReadOnly() ) ) )
778 rSet.DisableItem( nWh );
780 break;
781 case SID_BASICRUN:
782 case SID_BASICSTEPINTO:
783 case SID_BASICSTEPOVER:
784 case SID_BASICSTEPOUT:
785 case SID_BASICIDE_TOGGLEBRKPNT:
786 case SID_BASICIDE_MANAGEBRKPNTS:
788 if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin))
790 if (StarBASIC::IsRunning() && !pMCurWin->GetBasicStatus().bIsInReschedule)
791 rSet.DisableItem(nWh);
793 else
794 rSet.DisableItem( nWh );
796 break;
797 case SID_BASICCOMPILE:
799 if (StarBASIC::IsRunning() || !dynamic_cast<ModulWindow*>(pCurWin))
800 rSet.DisableItem( nWh );
802 break;
803 case SID_BASICSTOP:
805 // stop is always possible when some Basic is running...
806 if (!StarBASIC::IsRunning())
807 rSet.DisableItem( nWh );
809 break;
810 case SID_CHOOSE_CONTROLS:
811 case SID_DIALOG_TESTMODE:
812 case SID_INSERT_FORM_RADIO:
813 case SID_INSERT_FORM_CHECK:
814 case SID_INSERT_FORM_LIST:
815 case SID_INSERT_FORM_COMBO:
816 case SID_INSERT_FORM_VSCROLL:
817 case SID_INSERT_FORM_HSCROLL:
818 case SID_INSERT_FORM_SPIN:
820 if (!dynamic_cast<DialogWindow*>(pCurWin))
821 rSet.DisableItem( nWh );
823 break;
824 case SID_SHOW_FORMS:
825 case SID_SHOW_HIDDEN:
827 rSet.DisableItem( nWh );
829 break;
830 case SID_SEARCH_OPTIONS:
832 sal_uInt16 nOptions = 0;
833 if( pCurWin )
834 nOptions = pCurWin->GetSearchOptions();
835 rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, nOptions ) );
837 break;
838 case SID_BASICIDE_LIBSELECTOR:
840 OUString aName;
841 if ( !m_aCurLibName.isEmpty() )
843 LibraryLocation eLocation = m_aCurDocument.getLibraryLocation( m_aCurLibName );
844 aName = CreateMgrAndLibStr( m_aCurDocument.getTitle( eLocation ), m_aCurLibName );
846 SfxStringItem aItem( SID_BASICIDE_LIBSELECTOR, aName );
847 rSet.Put( aItem );
849 break;
850 case SID_SEARCH_ITEM:
852 OUString aSelected = GetSelectionText(true);
853 SvxSearchItem& rItem = GetExtraData()->GetSearchItem();
854 rItem.SetSearchString( aSelected );
855 rSet.Put( rItem );
857 break;
858 case SID_BASICIDE_STAT_DATE:
860 OUString aDate( "Datum?!" );
861 SfxStringItem aItem( SID_BASICIDE_STAT_DATE, aDate );
862 rSet.Put( aItem );
864 break;
865 case SID_DOC_MODIFIED:
867 bool bModified = false;
869 if ( pCurWin )
871 if ( pCurWin->IsModified() )
872 bModified = true;
873 else
875 ScriptDocument aDocument( pCurWin->GetDocument() );
876 bModified = aDocument.isDocument() ? aDocument.isDocumentModified() : IsAppBasicModified();
880 SfxBoolItem aItem(SID_DOC_MODIFIED, bModified);
881 rSet.Put( aItem );
883 break;
884 case SID_BASICIDE_STAT_TITLE:
886 if ( pCurWin )
888 OUString aTitle = pCurWin->CreateQualifiedName();
889 SfxStringItem aItem( SID_BASICIDE_STAT_TITLE, aTitle );
890 rSet.Put( aItem );
893 break;
894 // are interpreted by the controller:
895 case SID_ATTR_SIZE:
896 case SID_ATTR_INSERT:
897 break;
898 case SID_UNDO:
899 case SID_REDO:
901 if( GetUndoManager() ) // recursive GetState else
902 GetViewFrame()->GetSlotState( nWh, NULL, &rSet );
904 break;
905 case SID_BASICIDE_CURRENT_LANG:
907 if( (pCurWin && pCurWin->IsReadOnly()) || GetCurLibName().isEmpty() )
908 rSet.DisableItem( nWh );
909 else
911 OUString aItemStr;
912 boost::shared_ptr<LocalizationMgr> pCurMgr(GetCurLocalizationMgr());
913 if ( pCurMgr->isLibraryLocalized() )
915 Sequence< lang::Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales();
916 const lang::Locale* pLocale = aLocaleSeq.getConstArray();
917 sal_Int32 i, nCount = aLocaleSeq.getLength();
919 // Force different results for any combination of locales and default locale
920 OUString aLangStr;
921 for ( i = 0; i <= nCount; ++i )
923 lang::Locale aLocale;
924 if( i < nCount )
925 aLocale = pLocale[i];
926 else
927 aLocale = pCurMgr->getStringResourceManager()->getDefaultLocale();
929 aLangStr += aLocale.Language;
930 aLangStr += aLocale.Country;
931 aLangStr += aLocale.Variant;
933 aItemStr = aLangStr;
935 rSet.Put( SfxStringItem( nWh, aItemStr ) );
938 break;
940 case SID_BASICIDE_MANAGE_LANG:
942 if( (pCurWin && pCurWin->IsReadOnly()) || GetCurLibName().isEmpty() )
943 rSet.DisableItem( nWh );
945 break;
946 case SID_GOTOLINE:
948 // if this is not a module window hide the
949 // setting, doesn't make sense for example if the
950 // dialog editor is open
951 if (pCurWin && !dynamic_cast<ModulWindow*>(pCurWin))
953 rSet.DisableItem( nWh );
954 rSet.Put(SfxVisibilityItem(nWh, false));
956 break;
958 default:
959 if (pLayout)
960 pLayout->GetState(rSet, nWh);
963 if ( pCurWin )
964 pCurWin->GetState( rSet );
967 sal_Bool Shell::HasUIFeature( sal_uInt32 nFeature )
969 bool bResult = false;
971 if ( (nFeature & BASICIDE_UI_FEATURE_SHOW_BROWSER) == BASICIDE_UI_FEATURE_SHOW_BROWSER )
973 // fade out (in) property browser in module (dialog) windows
974 if (dynamic_cast<DialogWindow*>(pCurWin) && !pCurWin->IsReadOnly())
975 bResult = true;
978 return bResult;
981 void Shell::SetCurWindow( BaseWindow* pNewWin, bool bUpdateTabBar, bool bRememberAsCurrent )
983 if ( pNewWin != pCurWin )
985 pCurWin = pNewWin;
986 if (pLayout)
987 pLayout->Deactivating();
988 if (pCurWin)
990 if (pCurWin->GetType() == TYPE_MODULE)
991 pLayout = pModulLayout.get();
992 else
993 pLayout = pDialogLayout.get();
994 AdjustPosSizePixel(Point(0, 0), GetViewFrame()->GetWindow().GetOutputSizePixel());
995 pLayout->Activating(*pCurWin);
996 GetViewFrame()->GetWindow().SetHelpId(pCurWin->GetHid());
997 if (bRememberAsCurrent)
998 pCurWin->InsertLibInfo();
999 if (GetViewFrame()->GetWindow().IsVisible()) // SFX will do it later otherwise
1000 pCurWin->Show();
1001 pCurWin->Init();
1002 if (!GetExtraData()->ShellInCriticalSection())
1004 Window* pFrameWindow = &GetViewFrame()->GetWindow();
1005 Window* pFocusWindow = Application::GetFocusWindow();
1006 while ( pFocusWindow && ( pFocusWindow != pFrameWindow ) )
1007 pFocusWindow = pFocusWindow->GetParent();
1008 if ( pFocusWindow ) // Focus in BasicIDE
1009 pNewWin->GrabFocus();
1012 else
1014 SetWindow(pLayout);
1015 pLayout = 0;
1017 if ( bUpdateTabBar )
1019 sal_uLong nKey = GetWindowId( pCurWin );
1020 if ( pCurWin && ( pTabBar->GetPagePos( (sal_uInt16)nKey ) == TAB_PAGE_NOTFOUND ) )
1021 pTabBar->InsertPage( (sal_uInt16)nKey, pCurWin->GetTitle() ); // has just been faded in
1022 pTabBar->SetCurPageId( (sal_uInt16)nKey );
1024 if ( pCurWin && pCurWin->IsSuspended() ) // if the window is shown in the case of an error...
1025 pCurWin->SetStatus( pCurWin->GetStatus() & ~BASWIN_SUSPENDED );
1026 if ( pCurWin )
1028 SetWindow( pCurWin );
1029 if ( pCurWin->GetDocument().isDocument() )
1030 SfxObjectShell::SetCurrentComponent( pCurWin->GetDocument().getDocument() );
1032 else if (pLayout)
1034 SetWindow(pLayout);
1035 GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW );
1036 SfxObjectShell::SetCurrentComponent(0);
1038 aObjectCatalog.SetCurrentEntry(pCurWin);
1039 SetUndoManager( pCurWin ? pCurWin->GetUndoManager() : 0 );
1040 InvalidateBasicIDESlots();
1041 EnableScrollbars(pCurWin != 0);
1043 if ( m_pCurLocalizationMgr )
1044 m_pCurLocalizationMgr->handleTranslationbar();
1046 ManageToolbars();
1048 // fade out (in) property browser in module (dialog) windows
1049 UIFeatureChanged();
1053 void Shell::ManageToolbars()
1055 static OUString aLayoutManagerName( "LayoutManager" );
1056 static OUString aMacroBarResName( "private:resource/toolbar/macrobar" );
1057 static OUString aDialogBarResName( "private:resource/toolbar/dialogbar" );
1058 static OUString aInsertControlsBarResName( "private:resource/toolbar/insertcontrolsbar" );
1059 static OUString aFormControlsBarResName( "private:resource/toolbar/formcontrolsbar" );
1060 (void)aInsertControlsBarResName;
1062 if( !pCurWin )
1063 return;
1065 Reference< beans::XPropertySet > xFrameProps
1066 ( GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
1067 if ( xFrameProps.is() )
1069 Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
1070 uno::Any a = xFrameProps->getPropertyValue( aLayoutManagerName );
1071 a >>= xLayoutManager;
1072 if ( xLayoutManager.is() )
1074 xLayoutManager->lock();
1075 if (dynamic_cast<DialogWindow*>(pCurWin))
1077 xLayoutManager->destroyElement( aMacroBarResName );
1079 xLayoutManager->requestElement( aDialogBarResName );
1080 xLayoutManager->requestElement( aInsertControlsBarResName );
1081 xLayoutManager->requestElement( aFormControlsBarResName );
1083 else
1085 xLayoutManager->destroyElement( aDialogBarResName );
1086 xLayoutManager->destroyElement( aInsertControlsBarResName );
1087 xLayoutManager->destroyElement( aFormControlsBarResName );
1089 xLayoutManager->requestElement( aMacroBarResName );
1091 xLayoutManager->unlock();
1096 BaseWindow* Shell::FindApplicationWindow()
1098 return FindWindow( ScriptDocument::getApplicationScriptDocument() );
1101 BaseWindow* Shell::FindWindow(
1102 ScriptDocument const& rDocument,
1103 OUString const& rLibName, OUString const& rName,
1104 ItemType eType, bool bFindSuspended
1107 for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
1109 BaseWindow* const pWin = it->second;
1110 if (pWin->Is(rDocument, rLibName, rName, eType, bFindSuspended))
1111 return pWin;
1113 return 0;
1116 long Shell::CallBasicErrorHdl( StarBASIC* pBasic )
1118 long nRet = 0;
1119 ModulWindow* pModWin = ShowActiveModuleWindow( pBasic );
1120 if ( pModWin )
1121 nRet = pModWin->BasicErrorHdl( pBasic );
1122 return nRet;
1125 long Shell::CallBasicBreakHdl( StarBASIC* pBasic )
1127 long nRet = 0;
1128 ModulWindow* pModWin = ShowActiveModuleWindow( pBasic );
1129 if ( pModWin )
1131 bool bAppWindowDisabled, bDispatcherLocked;
1132 sal_uInt16 nWaitCount;
1133 SfxUInt16Item *pSWActionCount, *pSWLockViewCount;
1134 BasicStopped( &bAppWindowDisabled, &bDispatcherLocked,
1135 &nWaitCount, &pSWActionCount, &pSWLockViewCount );
1137 nRet = pModWin->BasicBreakHdl( pBasic );
1139 if ( StarBASIC::IsRunning() ) // if cancelled...
1141 if ( bAppWindowDisabled )
1142 Application::GetDefDialogParent()->Enable(false);
1144 if ( nWaitCount )
1146 Shell* pShell = GetShell();
1147 for ( sal_uInt16 n = 0; n < nWaitCount; n++ )
1148 pShell->GetViewFrame()->GetWindow().EnterWait();
1152 return nRet;
1155 ModulWindow* Shell::ShowActiveModuleWindow( StarBASIC* pBasic )
1157 SetCurLib( ScriptDocument::getApplicationScriptDocument(), OUString(), false );
1159 SbModule* pActiveModule = StarBASIC::GetActiveModule();
1160 if (SbClassModuleObject* pCMO = dynamic_cast<SbClassModuleObject*>(pActiveModule))
1161 pActiveModule = pCMO->getClassModule();
1163 DBG_ASSERT( pActiveModule, "Kein aktives Modul im ErrorHdl?!" );
1164 if ( pActiveModule )
1166 ModulWindow* pWin = 0;
1167 SbxObject* pParent = pActiveModule->GetParent();
1168 if (StarBASIC* pLib = dynamic_cast<StarBASIC*>(pParent))
1170 if (BasicManager* pBasMgr = FindBasicManager(pLib))
1172 ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
1173 OUString aLibName = pLib->GetName();
1174 pWin = FindBasWin( aDocument, aLibName, pActiveModule->GetName(), true );
1175 DBG_ASSERT( pWin, "Error/Step-Hdl: Fenster wurde nicht erzeugt/gefunden!" );
1176 SetCurLib( aDocument, aLibName );
1177 SetCurWindow( pWin, true );
1180 else
1181 DBG_ASSERT(false, "No BASIC!");
1182 if (BasicManager* pBasicMgr = FindBasicManager(pBasic))
1183 StartListening( *pBasicMgr, true /* log on only once */ );
1184 return pWin;
1186 return 0;
1189 void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize )
1191 // not if iconified because the whole text would be displaced then at restore
1192 if ( GetViewFrame()->GetWindow().GetOutputSizePixel().Height() == 0 )
1193 return;
1195 Size aSz( rSize );
1196 Size aScrollBarBoxSz( aScrollBarBox.GetSizePixel() );
1197 aSz.Height() -= aScrollBarBoxSz.Height();
1199 Size aOutSz( aSz );
1200 aSz.Width() -= aScrollBarBoxSz.Width();
1201 aScrollBarBox.SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) );
1202 aVScrollBar.SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) );
1203 if ( bTabBarSplitted )
1205 // SplitSize is 0 at a resize!
1206 long nSplitPos = pTabBar->GetSizePixel().Width();
1207 if ( nSplitPos > aSz.Width() )
1208 nSplitPos = aSz.Width();
1209 pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( nSplitPos, aScrollBarBoxSz.Height() ) );
1210 long nScrlStart = rPos.X() + nSplitPos;
1211 aHScrollBar.SetPosSizePixel( Point( nScrlStart, rPos.Y()+aSz.Height() ), Size( aSz.Width() - nScrlStart + 1, aScrollBarBoxSz.Height() ) );
1212 aHScrollBar.Update();
1214 else
1216 aHScrollBar.SetPosSizePixel( Point( rPos.X()+ aSz.Width()/2 - 1, rPos.Y()+aSz.Height() ), Size( aSz.Width()/2 + 2, aScrollBarBoxSz.Height() ) );
1217 pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( aSz.Width()/2, aScrollBarBoxSz.Height() ) );
1220 if (pLayout)
1221 pLayout->SetPosSizePixel(rPos, dynamic_cast<DialogWindow*>(pCurWin) ? aSz : aOutSz);
1224 Reference< XModel > Shell::GetCurrentDocument() const
1226 Reference< XModel > xDocument;
1227 if ( pCurWin && pCurWin->GetDocument().isDocument() )
1228 xDocument = pCurWin->GetDocument().getDocument();
1229 return xDocument;
1232 void Shell::Activate( sal_Bool bMDI )
1234 SfxViewShell::Activate( bMDI );
1236 if ( bMDI )
1238 if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin))
1239 pDCurWin->UpdateBrowser();
1243 void Shell::Deactivate( sal_Bool bMDI )
1245 // bMDI == true means that another MDI has been activated; in case of a
1246 // deactivate due to a MessageBox bMDI is false
1247 if ( bMDI )
1249 if (DialogWindow* pXDlgWin = dynamic_cast<DialogWindow*>(pCurWin))
1251 pXDlgWin->DisableBrowser();
1252 if( pXDlgWin->IsModified() )
1253 MarkDocumentModified( pXDlgWin->GetDocument() );
1256 // test CanClose to also test during deactivating the BasicIDE whether
1257 // the sourcecode is too large in one of the modules...
1258 for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
1260 BaseWindow* pWin = it->second;
1261 if ( /* !pWin->IsSuspended() && */ !pWin->CanClose() )
1263 if ( !m_aCurLibName.isEmpty() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) )
1264 SetCurLib( ScriptDocument::getApplicationScriptDocument(), OUString(), false );
1265 SetCurWindow( pWin, true );
1266 break;
1272 } // namespace basctl
1274 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */