1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_basctl.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "docsignature.hxx" 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #define GLOBALOVERFLOW2 34*cdf0e10cSrcweir #include <basic/sbx.hxx> 35*cdf0e10cSrcweir #define _SVSTDARR_STRINGS 36*cdf0e10cSrcweir #include <svl/svstdarr.hxx> 37*cdf0e10cSrcweir #include <ide_pch.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #define _SOLAR__PRIVATE 1 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir // #define _SVX_NOIDERESIDS 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #define SI_NOCONTROL 44*cdf0e10cSrcweir #define SI_NOSBXCONTROLS 45*cdf0e10cSrcweir #define SI_NOITEMS 46*cdf0e10cSrcweir #define SI_NODRW 47*cdf0e10cSrcweir #define _VCTRLS_HXX 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include <basidesh.hrc> 50*cdf0e10cSrcweir #include <basidesh.hxx> 51*cdf0e10cSrcweir #include <baside2.hxx> 52*cdf0e10cSrcweir #include <baside3.hxx> 53*cdf0e10cSrcweir #include <basobj.hxx> 54*cdf0e10cSrcweir #include <iderdll.hxx> 55*cdf0e10cSrcweir #include <iderdll2.hxx> 56*cdf0e10cSrcweir #include <sbxitem.hxx> 57*cdf0e10cSrcweir #include <managelang.hxx> 58*cdf0e10cSrcweir #include <localizationmgr.hxx> 59*cdf0e10cSrcweir #include <helpid.hrc> 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir #include <svtools/texteng.hxx> 62*cdf0e10cSrcweir #include <svtools/textview.hxx> 63*cdf0e10cSrcweir #include <svtools/xtextedt.hxx> 64*cdf0e10cSrcweir #include <tools/urlobj.hxx> 65*cdf0e10cSrcweir #include <tools/diagnose_ex.h> 66*cdf0e10cSrcweir #include <sfx2/minfitem.hxx> 67*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 68*cdf0e10cSrcweir #include <com/sun/star/task/XStatusIndicator.hpp> 69*cdf0e10cSrcweir #include <com/sun/star/task/XStatusIndicatorFactory.hpp> 70*cdf0e10cSrcweir #include <com/sun/star/script/XLibraryContainer.hpp> 71*cdf0e10cSrcweir #include <com/sun/star/script/XLibraryContainerPassword.hpp> 72*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp> 73*cdf0e10cSrcweir #include <com/sun/star/frame/XLayoutManager.hpp> 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir #include <algorithm> 76*cdf0e10cSrcweir #include <memory> 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir using namespace ::com::sun::star; 80*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 81*cdf0e10cSrcweir using namespace ::com::sun::star::frame; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir class SvxSearchItem; 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir // Egal was, einfach ans aktuelle Fenster: 86*cdf0e10cSrcweir void __EXPORT BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir if ( !pCurWin ) 89*cdf0e10cSrcweir return; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir switch ( rReq.GetSlot() ) 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir case SID_BASICIDE_HIDECURPAGE: 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir pCurWin->StoreData(); 96*cdf0e10cSrcweir RemoveWindow( pCurWin, sal_False ); 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir break; 99*cdf0e10cSrcweir case SID_BASICIDE_DELETECURRENT: 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir ScriptDocument aDocument( pCurWin->GetDocument() ); 102*cdf0e10cSrcweir String aLibName = pCurWin->GetLibName(); 103*cdf0e10cSrcweir String aName = pCurWin->GetName(); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir if ( pCurWin->ISA( ModulWindow ) ) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir // module 108*cdf0e10cSrcweir if ( QueryDelModule( aName, pCurWin ) ) 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir if ( aDocument.removeModule( aLibName, aName ) ) 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir BasicIDE::MarkDocumentModified( aDocument ); 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir } 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir else 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir // dialog 119*cdf0e10cSrcweir if ( QueryDelDialog( aName, pCurWin ) ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir if ( BasicIDE::RemoveDialog( aDocument, aLibName, aName ) ) 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir RemoveWindow( pCurWin, sal_True ); 124*cdf0e10cSrcweir BasicIDE::MarkDocumentModified( aDocument ); 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir } 129*cdf0e10cSrcweir break; 130*cdf0e10cSrcweir case SID_BASICIDE_RENAMECURRENT: 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir pTabBar->StartEditMode( pTabBar->GetCurPageId() ); 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir break; 135*cdf0e10cSrcweir case FID_SEARCH_NOW: 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir if ( pCurWin->ISA( ModulWindow ) ) 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); 140*cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 141*cdf0e10cSrcweir // Leider kenne ich die ID nicht: 142*cdf0e10cSrcweir sal_uInt16 nWhich = pArgs->GetWhichByPos( 0 ); 143*cdf0e10cSrcweir DBG_ASSERT( nWhich, "Wich fuer SearchItem ?" ); 144*cdf0e10cSrcweir const SfxPoolItem& rItem = pArgs->Get( nWhich ); 145*cdf0e10cSrcweir DBG_ASSERT( rItem.ISA( SvxSearchItem ), "Kein Searchitem!" ); 146*cdf0e10cSrcweir if ( rItem.ISA( SvxSearchItem ) ) 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir // Item wegen der Einstellungen merken... 149*cdf0e10cSrcweir IDE_DLL()->GetExtraData()->SetSearchItem( (const SvxSearchItem&)rItem ); 150*cdf0e10cSrcweir sal_uInt16 nFound = 0; 151*cdf0e10cSrcweir sal_Bool bCanceled = sal_False; 152*cdf0e10cSrcweir if ( ((const SvxSearchItem&)rItem).GetCommand() == SVX_SEARCHCMD_REPLACE_ALL ) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir sal_uInt16 nActModWindows = 0; 155*cdf0e10cSrcweir IDEBaseWindow* pWin = aIDEWindowTable.First(); 156*cdf0e10cSrcweir while ( pWin ) 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) 159*cdf0e10cSrcweir nActModWindows++; 160*cdf0e10cSrcweir pWin = aIDEWindowTable.Next(); 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir if ( ( nActModWindows <= 1 ) || ( !((const SvxSearchItem&)rItem).GetSelection() && QueryBox( pCurWin, WB_YES_NO|WB_DEF_YES, String( IDEResId( RID_STR_SEARCHALLMODULES ) ) ).Execute() == RET_YES ) ) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir pWin = aIDEWindowTable.First(); 166*cdf0e10cSrcweir while ( pWin ) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) 169*cdf0e10cSrcweir nFound = nFound + ((ModulWindow*)pWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem ); 170*cdf0e10cSrcweir pWin = aIDEWindowTable.Next(); 171*cdf0e10cSrcweir } 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir else 174*cdf0e10cSrcweir nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem ); 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir IDEResId nId( RID_STR_SEARCHREPLACES ); 177*cdf0e10cSrcweir String aReplStr( nId ); 178*cdf0e10cSrcweir aReplStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), String::CreateFromInt32( nFound ) ); 179*cdf0e10cSrcweir InfoBox( pCurWin, aReplStr ).Execute(); 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir else 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem ); 184*cdf0e10cSrcweir if ( !nFound && !((const SvxSearchItem&)rItem).GetSelection() ) 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir // Andere Module durchsuchen... 187*cdf0e10cSrcweir sal_Bool bChangeCurWindow = sal_False; 188*cdf0e10cSrcweir aIDEWindowTable.Seek( pCurWin ); 189*cdf0e10cSrcweir // Erstmal beim naechsten Anfangen, ggf. spaeter von vorne 190*cdf0e10cSrcweir IDEBaseWindow* pWin = aIDEWindowTable.Next(); 191*cdf0e10cSrcweir sal_Bool bSearchedFromStart = sal_False; 192*cdf0e10cSrcweir while ( !nFound && !bCanceled && ( pWin || !bSearchedFromStart ) ) 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir if ( !pWin ) 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir SfxViewFrame* pViewFrame = GetViewFrame(); 197*cdf0e10cSrcweir SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SEARCH_DLG ) : NULL; 198*cdf0e10cSrcweir Window* pParent = pChildWin ? pChildWin->GetWindow() : NULL; 199*cdf0e10cSrcweir QueryBox aQuery( pParent, WB_YES_NO|WB_DEF_YES, String( IDEResId( RID_STR_SEARCHFROMSTART ) ) ); 200*cdf0e10cSrcweir if ( aQuery.Execute() == RET_YES ) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir pWin = aIDEWindowTable.First(); 203*cdf0e10cSrcweir bSearchedFromStart = sal_True; 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir else 206*cdf0e10cSrcweir bCanceled = sal_True; 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir if ( pWin && !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir if ( pWin != pCurWin ) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir // Groesse einstellen, damit die View 214*cdf0e10cSrcweir // gleich richtig justiert werden kann. 215*cdf0e10cSrcweir if ( pCurWin ) 216*cdf0e10cSrcweir pWin->SetSizePixel( pCurWin->GetSizePixel() ); 217*cdf0e10cSrcweir nFound = ((ModulWindow*)pWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem, sal_True ); 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir if ( nFound ) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir bChangeCurWindow = sal_True; 222*cdf0e10cSrcweir break; 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir if ( pWin && ( pWin != pCurWin ) ) 226*cdf0e10cSrcweir pWin = aIDEWindowTable.Next(); 227*cdf0e10cSrcweir else 228*cdf0e10cSrcweir pWin = 0; // Dann sind wir durch... 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir if ( !nFound && bSearchedFromStart ) // Aktuelles von vorne... 231*cdf0e10cSrcweir nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem, sal_True ); 232*cdf0e10cSrcweir if ( bChangeCurWindow ) 233*cdf0e10cSrcweir SetCurWindow( pWin, sal_True ); 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir if ( !nFound && !bCanceled ) 236*cdf0e10cSrcweir InfoBox( pCurWin, String( IDEResId( RID_STR_SEARCHNOTFOUND ) ) ).Execute(); 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir rReq.Done(); 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir break; 244*cdf0e10cSrcweir case FID_SEARCH_OFF: 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir if ( pCurWin && pCurWin->ISA( ModulWindow ) ) 247*cdf0e10cSrcweir pCurWin->GrabFocus(); 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir break; 250*cdf0e10cSrcweir case SID_UNDO: 251*cdf0e10cSrcweir case SID_REDO: 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir if ( GetUndoManager() && pCurWin->AllowUndo() ) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir GetViewFrame()->ExecuteSlot( rReq ); 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir break; 259*cdf0e10cSrcweir default: 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir pCurWin->ExecuteCommand( rReq ); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir // Egal, wer oben, Einfluss auf die Shell: 267*cdf0e10cSrcweir void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 270*cdf0e10cSrcweir switch ( nSlot ) 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir case SID_BASICSTOP: 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir // Evtl. nicht einfach anhalten, falls auf Brechpunkt! 275*cdf0e10cSrcweir if ( pCurWin && pCurWin->IsA( TYPE( ModulWindow ) ) ) 276*cdf0e10cSrcweir ((ModulWindow*)pCurWin)->BasicStop(); 277*cdf0e10cSrcweir BasicIDE::StopBasic(); 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir break; 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir case SID_SAVEDOC: 282*cdf0e10cSrcweir { 283*cdf0e10cSrcweir if ( pCurWin ) 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir // Daten ins BASIC zurueckschreiben 286*cdf0e10cSrcweir StoreAllWindowData(); 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir // document basic 289*cdf0e10cSrcweir ScriptDocument aDocument( pCurWin->GetDocument() ); 290*cdf0e10cSrcweir if ( aDocument.isDocument() ) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir uno::Reference< task::XStatusIndicator > xStatusIndicator; 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pStatusIndicatorItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, sal_False ); 295*cdf0e10cSrcweir if ( pStatusIndicatorItem ) 296*cdf0e10cSrcweir OSL_VERIFY( pStatusIndicatorItem->GetValue() >>= xStatusIndicator ); 297*cdf0e10cSrcweir else 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir // get statusindicator 300*cdf0e10cSrcweir SfxViewFrame *pFrame_ = GetFrame(); 301*cdf0e10cSrcweir if ( pFrame_ ) 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir uno::Reference< task::XStatusIndicatorFactory > xStatFactory( 304*cdf0e10cSrcweir pFrame_->GetFrame().GetFrameInterface(), 305*cdf0e10cSrcweir uno::UNO_QUERY ); 306*cdf0e10cSrcweir if( xStatFactory.is() ) 307*cdf0e10cSrcweir xStatusIndicator = xStatFactory->createStatusIndicator(); 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir if ( xStatusIndicator.is() ) 311*cdf0e10cSrcweir rReq.AppendItem( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, uno::makeAny( xStatusIndicator ) ) ); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir aDocument.saveDocument( xStatusIndicator ); 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); 318*cdf0e10cSrcweir if ( pBindings ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir pBindings->Invalidate( SID_DOC_MODIFIED ); 321*cdf0e10cSrcweir pBindings->Invalidate( SID_SAVEDOC ); 322*cdf0e10cSrcweir pBindings->Invalidate( SID_SIGNATURE ); 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir } 326*cdf0e10cSrcweir break; 327*cdf0e10cSrcweir case SID_SIGNATURE: 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir if ( pCurWin ) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir ::basctl::DocumentSignature aSignature( pCurWin->GetDocument() ); 332*cdf0e10cSrcweir if ( aSignature.supportsSignatures() ) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir aSignature.signScriptingContent(); 335*cdf0e10cSrcweir SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); 336*cdf0e10cSrcweir if ( pBindings ) 337*cdf0e10cSrcweir pBindings->Invalidate( SID_SIGNATURE ); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir break; 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir case SID_BASICIDE_MODULEDLG: 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir if ( rReq.GetArgs() ) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir const SfxUInt16Item &rTabId = (const SfxUInt16Item&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID ); 348*cdf0e10cSrcweir BasicIDE::Organize( rTabId.GetValue() ); 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir else 351*cdf0e10cSrcweir BasicIDE::Organize( 0 ); 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir break; 354*cdf0e10cSrcweir case SID_BASICIDE_CHOOSEMACRO: 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir BasicIDE::ChooseMacro( NULL, sal_False, ::rtl::OUString() ); 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir break; 359*cdf0e10cSrcweir case SID_BASICIDE_CREATEMACRO: 360*cdf0e10cSrcweir case SID_BASICIDE_EDITMACRO: 361*cdf0e10cSrcweir { 362*cdf0e10cSrcweir DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); 363*cdf0e10cSrcweir const SfxMacroInfoItem& rInfo = (const SfxMacroInfoItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO ); 364*cdf0e10cSrcweir BasicManager* pBasMgr = (BasicManager*)rInfo.GetBasicManager(); 365*cdf0e10cSrcweir DBG_ASSERT( pBasMgr, "Nichts selektiert im Basic-Baum ?" ); 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir StartListening( *pBasMgr, sal_True /* Nur einmal anmelden */ ); 370*cdf0e10cSrcweir String aLibName( rInfo.GetLib() ); 371*cdf0e10cSrcweir if ( !aLibName.Len() ) 372*cdf0e10cSrcweir aLibName = String::CreateFromAscii( "Standard" ); 373*cdf0e10cSrcweir StarBASIC* pBasic = pBasMgr->GetLib( aLibName ); 374*cdf0e10cSrcweir if ( !pBasic ) 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir // load module and dialog library (if not loaded) 377*cdf0e10cSrcweir aDocument.loadLibraryIfExists( E_SCRIPTS, aLibName ); 378*cdf0e10cSrcweir aDocument.loadLibraryIfExists( E_DIALOGS, aLibName ); 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir // get Basic 381*cdf0e10cSrcweir pBasic = pBasMgr->GetLib( aLibName ); 382*cdf0e10cSrcweir } 383*cdf0e10cSrcweir DBG_ASSERT( pBasic, "Kein Basic!" ); 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir SetCurLib( aDocument, aLibName ); 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir if ( rReq.GetSlot() == SID_BASICIDE_CREATEMACRO ) 388*cdf0e10cSrcweir { 389*cdf0e10cSrcweir SbModule* pModule = pBasic->FindModule( rInfo.GetModule() ); 390*cdf0e10cSrcweir if ( !pModule ) 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir if ( rInfo.GetModule().Len() || !pBasic->GetModules()->Count() ) 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir String aModName = rInfo.GetModule(); 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir ::rtl::OUString sModuleCode; 397*cdf0e10cSrcweir if ( aDocument.createModule( aLibName, aModName, sal_False, sModuleCode ) ) 398*cdf0e10cSrcweir pModule = pBasic->FindModule( aModName ); 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir else 401*cdf0e10cSrcweir pModule = (SbModule*) pBasic->GetModules()->Get(0); 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir DBG_ASSERT( pModule, "Kein Modul!" ); 404*cdf0e10cSrcweir if ( !pModule->GetMethods()->Find( rInfo.GetMethod(), SbxCLASS_METHOD ) ) 405*cdf0e10cSrcweir BasicIDE::CreateMacro( pModule, rInfo.GetMethod() ); 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir SfxViewFrame* pViewFrame = GetViewFrame(); 408*cdf0e10cSrcweir if ( pViewFrame ) 409*cdf0e10cSrcweir pViewFrame->ToTop(); 410*cdf0e10cSrcweir ModulWindow* pWin = FindBasWin( aDocument, aLibName, rInfo.GetModule(), sal_True ); 411*cdf0e10cSrcweir DBG_ASSERT( pWin, "Edit/Create Macro: Fenster wurde nicht erzeugt/gefunden!" ); 412*cdf0e10cSrcweir SetCurWindow( pWin, sal_True ); 413*cdf0e10cSrcweir pWin->EditMacro( rInfo.GetMethod() ); 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir break; 416*cdf0e10cSrcweir case SID_BASICIDE_OBJCAT: 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir ShowObjectDialog( sal_True, sal_True ); 419*cdf0e10cSrcweir } 420*cdf0e10cSrcweir break; 421*cdf0e10cSrcweir case SID_BASICIDE_NAMECHANGEDONTAB: 422*cdf0e10cSrcweir { 423*cdf0e10cSrcweir DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); 424*cdf0e10cSrcweir const SfxUInt16Item &rTabId = (const SfxUInt16Item&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID ); 425*cdf0e10cSrcweir const SfxStringItem &rModName = (const SfxStringItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MODULENAME ); 426*cdf0e10cSrcweir IDEBaseWindow* pWin = aIDEWindowTable.Get( rTabId.GetValue() ); 427*cdf0e10cSrcweir DBG_ASSERT( pWin, "Window nicht im Liste, aber in TabBar ?" ); 428*cdf0e10cSrcweir if ( pWin ) 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir String aNewName( rModName.GetValue() ); 431*cdf0e10cSrcweir String aOldName( pWin->GetName() ); 432*cdf0e10cSrcweir if ( aNewName != aOldName ) 433*cdf0e10cSrcweir { 434*cdf0e10cSrcweir bool bRenameOk = false; 435*cdf0e10cSrcweir if ( pWin->IsA( TYPE( ModulWindow ) ) ) 436*cdf0e10cSrcweir { 437*cdf0e10cSrcweir ModulWindow* pModWin = (ModulWindow*)pWin; 438*cdf0e10cSrcweir String aLibName = ( pModWin->GetLibName() ); 439*cdf0e10cSrcweir ScriptDocument aDocument( pWin->GetDocument() ); 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir if ( BasicIDE::RenameModule( pModWin, aDocument, aLibName, aOldName, aNewName ) ) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir bRenameOk = true; 444*cdf0e10cSrcweir // Because we listen for container events for script 445*cdf0e10cSrcweir // modules, rename will delete the 'old' window 446*cdf0e10cSrcweir // pWin has been invalidated, restore now 447*cdf0e10cSrcweir pWin = FindBasWin( aDocument, aLibName, aNewName, sal_True ); 448*cdf0e10cSrcweir } 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir else if ( pWin->IsA( TYPE( DialogWindow ) ) ) 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir DialogWindow* pDlgWin = (DialogWindow*)pWin; 454*cdf0e10cSrcweir bRenameOk = pDlgWin->RenameDialog( aNewName ); 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir if ( bRenameOk ) 457*cdf0e10cSrcweir { 458*cdf0e10cSrcweir BasicIDE::MarkDocumentModified( pWin->GetDocument() ); 459*cdf0e10cSrcweir } 460*cdf0e10cSrcweir else 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir // set old name in TabWriter 463*cdf0e10cSrcweir sal_uInt16 nId = (sal_uInt16)aIDEWindowTable.GetKey( pWin ); 464*cdf0e10cSrcweir DBG_ASSERT( nId, "No entry in Tabbar!" ); 465*cdf0e10cSrcweir if ( nId ) 466*cdf0e10cSrcweir pTabBar->SetPageText( nId, aOldName ); 467*cdf0e10cSrcweir } 468*cdf0e10cSrcweir } 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir // set focus to current window 471*cdf0e10cSrcweir pWin->GrabFocus(); 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir break; 475*cdf0e10cSrcweir case SID_BASICIDE_STOREMODULESOURCE: 476*cdf0e10cSrcweir case SID_BASICIDE_UPDATEMODULESOURCE: 477*cdf0e10cSrcweir { 478*cdf0e10cSrcweir DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); 479*cdf0e10cSrcweir const SfxMacroInfoItem& rInfo = (const SfxMacroInfoItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO ); 480*cdf0e10cSrcweir BasicManager* pBasMgr = (BasicManager*)rInfo.GetBasicManager(); 481*cdf0e10cSrcweir DBG_ASSERT( pBasMgr, "Store source: Kein BasMgr?" ); 482*cdf0e10cSrcweir ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); 483*cdf0e10cSrcweir ModulWindow* pWin = FindBasWin( aDocument, rInfo.GetLib(), rInfo.GetModule(), sal_False, sal_True ); 484*cdf0e10cSrcweir if ( pWin ) 485*cdf0e10cSrcweir { 486*cdf0e10cSrcweir if ( rReq.GetSlot() == SID_BASICIDE_STOREMODULESOURCE ) 487*cdf0e10cSrcweir pWin->StoreData(); 488*cdf0e10cSrcweir else 489*cdf0e10cSrcweir pWin->UpdateData(); 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir } 492*cdf0e10cSrcweir break; 493*cdf0e10cSrcweir case SID_BASICIDE_STOREALLMODULESOURCES: 494*cdf0e10cSrcweir case SID_BASICIDE_UPDATEALLMODULESOURCES: 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir IDEBaseWindow* pWin = aIDEWindowTable.First(); 497*cdf0e10cSrcweir while ( pWin ) 498*cdf0e10cSrcweir { 499*cdf0e10cSrcweir if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) 500*cdf0e10cSrcweir { 501*cdf0e10cSrcweir if ( rReq.GetSlot() == SID_BASICIDE_STOREALLMODULESOURCES ) 502*cdf0e10cSrcweir pWin->StoreData(); 503*cdf0e10cSrcweir else 504*cdf0e10cSrcweir pWin->UpdateData(); 505*cdf0e10cSrcweir } 506*cdf0e10cSrcweir pWin = aIDEWindowTable.Next(); 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir break; 510*cdf0e10cSrcweir case SID_BASICIDE_LIBSELECTED: 511*cdf0e10cSrcweir case SID_BASICIDE_LIBREMOVED: 512*cdf0e10cSrcweir case SID_BASICIDE_LIBLOADED: 513*cdf0e10cSrcweir { 514*cdf0e10cSrcweir DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); 515*cdf0e10cSrcweir const SfxUsrAnyItem& rShellItem = (const SfxUsrAnyItem&)rReq.GetArgs()->Get( SID_BASICIDE_ARG_DOCUMENT_MODEL ); 516*cdf0e10cSrcweir uno::Reference< frame::XModel > xModel( rShellItem.GetValue(), UNO_QUERY ); 517*cdf0e10cSrcweir ScriptDocument aDocument( xModel.is() ? ScriptDocument( xModel ) : ScriptDocument::getApplicationScriptDocument() ); 518*cdf0e10cSrcweir const SfxStringItem& rLibNameItem = (const SfxStringItem&)rReq.GetArgs()->Get( SID_BASICIDE_ARG_LIBNAME ); 519*cdf0e10cSrcweir String aLibName( rLibNameItem.GetValue() ); 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir if ( nSlot == SID_BASICIDE_LIBSELECTED ) 522*cdf0e10cSrcweir { 523*cdf0e10cSrcweir // load module and dialog library (if not loaded) 524*cdf0e10cSrcweir aDocument.loadLibraryIfExists( E_SCRIPTS, aLibName ); 525*cdf0e10cSrcweir aDocument.loadLibraryIfExists( E_DIALOGS, aLibName ); 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir // check password, if library is password protected and not verified 528*cdf0e10cSrcweir sal_Bool bOK = sal_True; 529*cdf0e10cSrcweir Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); 530*cdf0e10cSrcweir if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) ) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); 533*cdf0e10cSrcweir if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) 534*cdf0e10cSrcweir { 535*cdf0e10cSrcweir String aPassword; 536*cdf0e10cSrcweir bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); 537*cdf0e10cSrcweir } 538*cdf0e10cSrcweir } 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir if ( bOK ) 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir SetCurLib( aDocument, aLibName, true, false ); 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir else 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir // alten Wert einstellen... 547*cdf0e10cSrcweir SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); 548*cdf0e10cSrcweir if ( pBindings ) 549*cdf0e10cSrcweir pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR, sal_True, sal_False ); 550*cdf0e10cSrcweir } 551*cdf0e10cSrcweir } 552*cdf0e10cSrcweir else if ( nSlot == SID_BASICIDE_LIBREMOVED ) 553*cdf0e10cSrcweir { 554*cdf0e10cSrcweir if ( !m_aCurLibName.Len() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) ) 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir RemoveWindows( aDocument, aLibName, sal_True ); 557*cdf0e10cSrcweir if ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) 558*cdf0e10cSrcweir { 559*cdf0e10cSrcweir m_aCurDocument = ScriptDocument::getApplicationScriptDocument(); 560*cdf0e10cSrcweir m_aCurLibName = String(); 561*cdf0e10cSrcweir // Kein UpdateWindows! 562*cdf0e10cSrcweir SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); 563*cdf0e10cSrcweir if ( pBindings ) 564*cdf0e10cSrcweir pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR ); 565*cdf0e10cSrcweir } 566*cdf0e10cSrcweir } 567*cdf0e10cSrcweir } 568*cdf0e10cSrcweir else // Loaded... 569*cdf0e10cSrcweir UpdateWindows(); 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir break; 572*cdf0e10cSrcweir case SID_BASICIDE_NEWMODULE: 573*cdf0e10cSrcweir { 574*cdf0e10cSrcweir ModulWindow* pWin = CreateBasWin( m_aCurDocument, m_aCurLibName, String() ); 575*cdf0e10cSrcweir DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" ); 576*cdf0e10cSrcweir SetCurWindow( pWin, sal_True ); 577*cdf0e10cSrcweir } 578*cdf0e10cSrcweir break; 579*cdf0e10cSrcweir case SID_BASICIDE_NEWDIALOG: 580*cdf0e10cSrcweir { 581*cdf0e10cSrcweir DialogWindow* pWin = CreateDlgWin( m_aCurDocument, m_aCurLibName, String() ); 582*cdf0e10cSrcweir DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" ); 583*cdf0e10cSrcweir SetCurWindow( pWin, sal_True ); 584*cdf0e10cSrcweir } 585*cdf0e10cSrcweir break; 586*cdf0e10cSrcweir case SID_BASICIDE_SBXRENAMED: 587*cdf0e10cSrcweir { 588*cdf0e10cSrcweir DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); 589*cdf0e10cSrcweir } 590*cdf0e10cSrcweir break; 591*cdf0e10cSrcweir case SID_BASICIDE_SBXINSERTED: 592*cdf0e10cSrcweir { 593*cdf0e10cSrcweir DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); 594*cdf0e10cSrcweir const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ); 595*cdf0e10cSrcweir ScriptDocument aDocument( rSbxItem.GetDocument() ); 596*cdf0e10cSrcweir String aLibName( rSbxItem.GetLibName() ); 597*cdf0e10cSrcweir String aName( rSbxItem.GetName() ); 598*cdf0e10cSrcweir if ( !m_aCurLibName.Len() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) ) 599*cdf0e10cSrcweir { 600*cdf0e10cSrcweir IDEBaseWindow* pWin = 0; 601*cdf0e10cSrcweir if ( rSbxItem.GetType() == BASICIDE_TYPE_MODULE ) 602*cdf0e10cSrcweir pWin = FindBasWin( aDocument, aLibName, aName, sal_True ); 603*cdf0e10cSrcweir else if ( rSbxItem.GetType() == BASICIDE_TYPE_DIALOG ) 604*cdf0e10cSrcweir pWin = FindDlgWin( aDocument, aLibName, aName, sal_True ); 605*cdf0e10cSrcweir } 606*cdf0e10cSrcweir } 607*cdf0e10cSrcweir break; 608*cdf0e10cSrcweir case SID_BASICIDE_SBXDELETED: 609*cdf0e10cSrcweir { 610*cdf0e10cSrcweir DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); 611*cdf0e10cSrcweir const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ); 612*cdf0e10cSrcweir ScriptDocument aDocument( rSbxItem.GetDocument() ); 613*cdf0e10cSrcweir IDEBaseWindow* pWin = FindWindow( aDocument, rSbxItem.GetLibName(), rSbxItem.GetName(), rSbxItem.GetType(), sal_True ); 614*cdf0e10cSrcweir if ( pWin ) 615*cdf0e10cSrcweir RemoveWindow( pWin, sal_True ); 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir break; 618*cdf0e10cSrcweir case SID_BASICIDE_SHOWSBX: 619*cdf0e10cSrcweir { 620*cdf0e10cSrcweir DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); 621*cdf0e10cSrcweir const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ); 622*cdf0e10cSrcweir ScriptDocument aDocument( rSbxItem.GetDocument() ); 623*cdf0e10cSrcweir String aLibName( rSbxItem.GetLibName() ); 624*cdf0e10cSrcweir String aName( rSbxItem.GetName() ); 625*cdf0e10cSrcweir SetCurLib( aDocument, aLibName ); 626*cdf0e10cSrcweir IDEBaseWindow* pWin = 0; 627*cdf0e10cSrcweir if ( rSbxItem.GetType() == BASICIDE_TYPE_DIALOG ) 628*cdf0e10cSrcweir { 629*cdf0e10cSrcweir pWin = FindDlgWin( aDocument, aLibName, aName, sal_True ); 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir else if ( rSbxItem.GetType() == BASICIDE_TYPE_MODULE ) 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir pWin = FindBasWin( aDocument, aLibName, aName, sal_True ); 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir else if ( rSbxItem.GetType() == BASICIDE_TYPE_METHOD ) 636*cdf0e10cSrcweir { 637*cdf0e10cSrcweir pWin = FindBasWin( aDocument, aLibName, aName, sal_True ); 638*cdf0e10cSrcweir ((ModulWindow*)pWin)->EditMacro( rSbxItem.GetMethodName() ); 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir DBG_ASSERT( pWin, "Fenster wurde nicht erzeugt!" ); 641*cdf0e10cSrcweir SetCurWindow( pWin, sal_True ); 642*cdf0e10cSrcweir pTabBar->MakeVisible( pTabBar->GetCurPageId() ); 643*cdf0e10cSrcweir } 644*cdf0e10cSrcweir break; 645*cdf0e10cSrcweir case SID_SHOW_PROPERTYBROWSER: 646*cdf0e10cSrcweir { 647*cdf0e10cSrcweir GetViewFrame()->ChildWindowExecute( rReq ); 648*cdf0e10cSrcweir rReq.Done(); 649*cdf0e10cSrcweir } 650*cdf0e10cSrcweir break; 651*cdf0e10cSrcweir case SID_BASICIDE_SHOWWINDOW: 652*cdf0e10cSrcweir { 653*cdf0e10cSrcweir ::std::auto_ptr< ScriptDocument > pDocument; 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pDocumentItem, SfxStringItem, SID_BASICIDE_ARG_DOCUMENT, sal_False ); 656*cdf0e10cSrcweir if ( pDocumentItem ) 657*cdf0e10cSrcweir { 658*cdf0e10cSrcweir String sDocumentCaption = pDocumentItem->GetValue(); 659*cdf0e10cSrcweir if ( sDocumentCaption.Len() ) 660*cdf0e10cSrcweir pDocument.reset( new ScriptDocument( ScriptDocument::getDocumentWithURLOrCaption( sDocumentCaption ) ) ); 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pDocModelItem, SfxUsrAnyItem, SID_BASICIDE_ARG_DOCUMENT_MODEL, sal_False ); 664*cdf0e10cSrcweir if ( !pDocument.get() && pDocModelItem ) 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir uno::Reference< frame::XModel > xModel( pDocModelItem->GetValue(), UNO_QUERY ); 667*cdf0e10cSrcweir if ( xModel.is() ) 668*cdf0e10cSrcweir pDocument.reset( new ScriptDocument( xModel ) ); 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir if ( !pDocument.get() ) 672*cdf0e10cSrcweir break; 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pLibNameItem, SfxStringItem, SID_BASICIDE_ARG_LIBNAME, sal_False ); 675*cdf0e10cSrcweir if ( !pLibNameItem ) 676*cdf0e10cSrcweir break; 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir String aLibName( pLibNameItem->GetValue() ); 679*cdf0e10cSrcweir pDocument->loadLibraryIfExists( E_SCRIPTS, aLibName ); 680*cdf0e10cSrcweir SetCurLib( *pDocument, aLibName ); 681*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_BASICIDE_ARG_NAME, sal_False ); 682*cdf0e10cSrcweir if ( pNameItem ) 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir String aName( pNameItem->GetValue() ); 685*cdf0e10cSrcweir String aModType( String::CreateFromAscii( "Module" ) ); 686*cdf0e10cSrcweir String aDlgType( String::CreateFromAscii( "Dialog" ) ); 687*cdf0e10cSrcweir String aType( aModType ); 688*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pTypeItem, SfxStringItem, SID_BASICIDE_ARG_TYPE, sal_False ); 689*cdf0e10cSrcweir if ( pTypeItem ) 690*cdf0e10cSrcweir aType = pTypeItem->GetValue(); 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir IDEBaseWindow* pWin = 0; 693*cdf0e10cSrcweir if ( aType == aModType ) 694*cdf0e10cSrcweir pWin = FindBasWin( *pDocument, aLibName, aName, sal_False ); 695*cdf0e10cSrcweir else if ( aType == aDlgType ) 696*cdf0e10cSrcweir pWin = FindDlgWin( *pDocument, aLibName, aName, sal_False ); 697*cdf0e10cSrcweir 698*cdf0e10cSrcweir if ( pWin ) 699*cdf0e10cSrcweir { 700*cdf0e10cSrcweir SetCurWindow( pWin, sal_True ); 701*cdf0e10cSrcweir if ( pTabBar ) 702*cdf0e10cSrcweir pTabBar->MakeVisible( pTabBar->GetCurPageId() ); 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir if ( pWin->ISA( ModulWindow ) ) 705*cdf0e10cSrcweir { 706*cdf0e10cSrcweir ModulWindow* pModWin = (ModulWindow*)pWin; 707*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pLineItem, SfxUInt32Item, SID_BASICIDE_ARG_LINE, sal_False ); 708*cdf0e10cSrcweir if ( pLineItem ) 709*cdf0e10cSrcweir { 710*cdf0e10cSrcweir pModWin->AssertValidEditEngine(); 711*cdf0e10cSrcweir TextView* pTextView = pModWin->GetEditView(); 712*cdf0e10cSrcweir if ( pTextView ) 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir TextEngine* pTextEngine = pTextView->GetTextEngine(); 715*cdf0e10cSrcweir if ( pTextEngine ) 716*cdf0e10cSrcweir { 717*cdf0e10cSrcweir sal_uInt32 nLine = pLineItem->GetValue(); 718*cdf0e10cSrcweir sal_uInt32 nLineCount = 0; 719*cdf0e10cSrcweir for ( sal_uInt32 i = 0, nCount = pTextEngine->GetParagraphCount(); i < nCount; ++i ) 720*cdf0e10cSrcweir nLineCount += pTextEngine->GetLineCount( i ); 721*cdf0e10cSrcweir if ( nLine > nLineCount ) 722*cdf0e10cSrcweir nLine = nLineCount; 723*cdf0e10cSrcweir if ( nLine > 0 ) 724*cdf0e10cSrcweir --nLine; 725*cdf0e10cSrcweir 726*cdf0e10cSrcweir // scroll window and set selection 727*cdf0e10cSrcweir long nVisHeight = pModWin->GetOutputSizePixel().Height(); 728*cdf0e10cSrcweir long nTextHeight = pTextEngine->GetTextHeight(); 729*cdf0e10cSrcweir if ( nTextHeight > nVisHeight ) 730*cdf0e10cSrcweir { 731*cdf0e10cSrcweir long nMaxY = nTextHeight - nVisHeight; 732*cdf0e10cSrcweir long nOldY = pTextView->GetStartDocPos().Y(); 733*cdf0e10cSrcweir long nNewY = nLine * pTextEngine->GetCharHeight() - nVisHeight / 2; 734*cdf0e10cSrcweir nNewY = ::std::min( nNewY, nMaxY ); 735*cdf0e10cSrcweir pTextView->Scroll( 0, -( nNewY - nOldY ) ); 736*cdf0e10cSrcweir pTextView->ShowCursor( sal_False, sal_True ); 737*cdf0e10cSrcweir pModWin->GetEditVScrollBar().SetThumbPos( pTextView->GetStartDocPos().Y() ); 738*cdf0e10cSrcweir } 739*cdf0e10cSrcweir sal_uInt16 nCol1 = 0, nCol2 = 0; 740*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pCol1Item, SfxUInt16Item, SID_BASICIDE_ARG_COLUMN1, sal_False ); 741*cdf0e10cSrcweir if ( pCol1Item ) 742*cdf0e10cSrcweir { 743*cdf0e10cSrcweir nCol1 = pCol1Item->GetValue(); 744*cdf0e10cSrcweir if ( nCol1 > 0 ) 745*cdf0e10cSrcweir --nCol1; 746*cdf0e10cSrcweir nCol2 = nCol1; 747*cdf0e10cSrcweir } 748*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pCol2Item, SfxUInt16Item, SID_BASICIDE_ARG_COLUMN2, sal_False ); 749*cdf0e10cSrcweir if ( pCol2Item ) 750*cdf0e10cSrcweir { 751*cdf0e10cSrcweir nCol2 = pCol2Item->GetValue(); 752*cdf0e10cSrcweir if ( nCol2 > 0 ) 753*cdf0e10cSrcweir --nCol2; 754*cdf0e10cSrcweir } 755*cdf0e10cSrcweir TextSelection aSel( TextPaM( nLine, nCol1 ), TextPaM( nLine, nCol2 ) ); 756*cdf0e10cSrcweir pTextView->SetSelection( aSel ); 757*cdf0e10cSrcweir pTextView->ShowCursor(); 758*cdf0e10cSrcweir Window* pWindow_ = pTextView->GetWindow(); 759*cdf0e10cSrcweir if ( pWindow_ ) 760*cdf0e10cSrcweir pWindow_->GrabFocus(); 761*cdf0e10cSrcweir } 762*cdf0e10cSrcweir } 763*cdf0e10cSrcweir } 764*cdf0e10cSrcweir } 765*cdf0e10cSrcweir } 766*cdf0e10cSrcweir } 767*cdf0e10cSrcweir rReq.Done(); 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir break; 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir case SID_BASICIDE_MANAGE_LANG: 772*cdf0e10cSrcweir { 773*cdf0e10cSrcweir ManageLanguageDialog aDlg( GetCurWindow(), GetCurLocalizationMgr() ); 774*cdf0e10cSrcweir aDlg.Execute(); 775*cdf0e10cSrcweir rReq.Done(); 776*cdf0e10cSrcweir } 777*cdf0e10cSrcweir break; 778*cdf0e10cSrcweir } 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir void __EXPORT BasicIDEShell::GetState(SfxItemSet &rSet) 782*cdf0e10cSrcweir { 783*cdf0e10cSrcweir SfxWhichIter aIter(rSet); 784*cdf0e10cSrcweir for ( sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich() ) 785*cdf0e10cSrcweir { 786*cdf0e10cSrcweir switch ( nWh ) 787*cdf0e10cSrcweir { 788*cdf0e10cSrcweir case SID_DOCINFO: 789*cdf0e10cSrcweir { 790*cdf0e10cSrcweir rSet.DisableItem( nWh ); 791*cdf0e10cSrcweir } 792*cdf0e10cSrcweir break; 793*cdf0e10cSrcweir case SID_SAVEDOC: 794*cdf0e10cSrcweir { 795*cdf0e10cSrcweir sal_Bool bDisable = sal_False; 796*cdf0e10cSrcweir 797*cdf0e10cSrcweir if ( pCurWin ) 798*cdf0e10cSrcweir { 799*cdf0e10cSrcweir if ( !pCurWin->IsModified() ) 800*cdf0e10cSrcweir { 801*cdf0e10cSrcweir ScriptDocument aDocument( pCurWin->GetDocument() ); 802*cdf0e10cSrcweir bDisable = ( !aDocument.isAlive() ) 803*cdf0e10cSrcweir || ( aDocument.isDocument() ? !aDocument.isDocumentModified() : !IsAppBasicModified() ); 804*cdf0e10cSrcweir } 805*cdf0e10cSrcweir } 806*cdf0e10cSrcweir else 807*cdf0e10cSrcweir { 808*cdf0e10cSrcweir bDisable = sal_True; 809*cdf0e10cSrcweir } 810*cdf0e10cSrcweir 811*cdf0e10cSrcweir if ( bDisable ) 812*cdf0e10cSrcweir rSet.DisableItem( nWh ); 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir break; 815*cdf0e10cSrcweir case SID_NEWWINDOW: 816*cdf0e10cSrcweir case SID_SAVEASDOC: 817*cdf0e10cSrcweir { 818*cdf0e10cSrcweir rSet.DisableItem( nWh ); 819*cdf0e10cSrcweir } 820*cdf0e10cSrcweir break; 821*cdf0e10cSrcweir case SID_SIGNATURE: 822*cdf0e10cSrcweir { 823*cdf0e10cSrcweir sal_uInt16 nState = 0; 824*cdf0e10cSrcweir if ( pCurWin ) 825*cdf0e10cSrcweir { 826*cdf0e10cSrcweir ::basctl::DocumentSignature aSignature( pCurWin->GetDocument() ); 827*cdf0e10cSrcweir nState = aSignature.getScriptingSignatureState(); 828*cdf0e10cSrcweir } 829*cdf0e10cSrcweir rSet.Put( SfxUInt16Item( SID_SIGNATURE, nState ) ); 830*cdf0e10cSrcweir } 831*cdf0e10cSrcweir break; 832*cdf0e10cSrcweir case SID_BASICIDE_MODULEDLG: 833*cdf0e10cSrcweir { 834*cdf0e10cSrcweir if ( StarBASIC::IsRunning() ) 835*cdf0e10cSrcweir rSet.DisableItem( nWh ); 836*cdf0e10cSrcweir } 837*cdf0e10cSrcweir break; 838*cdf0e10cSrcweir case SID_BASICIDE_CHOOSEMACRO: 839*cdf0e10cSrcweir case SID_BASICIDE_OBJCAT: 840*cdf0e10cSrcweir case SID_BASICIDE_SHOWSBX: 841*cdf0e10cSrcweir case SID_BASICIDE_CREATEMACRO: 842*cdf0e10cSrcweir case SID_BASICIDE_EDITMACRO: 843*cdf0e10cSrcweir case SID_BASICIDE_NAMECHANGEDONTAB: 844*cdf0e10cSrcweir { 845*cdf0e10cSrcweir ; 846*cdf0e10cSrcweir } 847*cdf0e10cSrcweir break; 848*cdf0e10cSrcweir 849*cdf0e10cSrcweir case SID_BASICIDE_ADDWATCH: 850*cdf0e10cSrcweir case SID_BASICIDE_REMOVEWATCH: 851*cdf0e10cSrcweir case SID_BASICLOAD: 852*cdf0e10cSrcweir case SID_BASICSAVEAS: 853*cdf0e10cSrcweir case SID_BASICIDE_MATCHGROUP: 854*cdf0e10cSrcweir { 855*cdf0e10cSrcweir if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) ) 856*cdf0e10cSrcweir rSet.DisableItem( nWh ); 857*cdf0e10cSrcweir else if ( ( nWh == SID_BASICLOAD ) && ( StarBASIC::IsRunning() || ( pCurWin && pCurWin->IsReadOnly() ) ) ) 858*cdf0e10cSrcweir rSet.DisableItem( nWh ); 859*cdf0e10cSrcweir } 860*cdf0e10cSrcweir break; 861*cdf0e10cSrcweir case SID_BASICRUN: 862*cdf0e10cSrcweir case SID_BASICSTEPINTO: 863*cdf0e10cSrcweir case SID_BASICSTEPOVER: 864*cdf0e10cSrcweir case SID_BASICSTEPOUT: 865*cdf0e10cSrcweir case SID_BASICIDE_TOGGLEBRKPNT: 866*cdf0e10cSrcweir case SID_BASICIDE_MANAGEBRKPNTS: 867*cdf0e10cSrcweir { 868*cdf0e10cSrcweir if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) ) 869*cdf0e10cSrcweir rSet.DisableItem( nWh ); 870*cdf0e10cSrcweir else if ( StarBASIC::IsRunning() && !((ModulWindow*)pCurWin)->GetBasicStatus().bIsInReschedule ) 871*cdf0e10cSrcweir rSet.DisableItem( nWh ); 872*cdf0e10cSrcweir } 873*cdf0e10cSrcweir break; 874*cdf0e10cSrcweir case SID_BASICCOMPILE: 875*cdf0e10cSrcweir { 876*cdf0e10cSrcweir if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) || StarBASIC::IsRunning() ) 877*cdf0e10cSrcweir rSet.DisableItem( nWh ); 878*cdf0e10cSrcweir } 879*cdf0e10cSrcweir break; 880*cdf0e10cSrcweir case SID_BASICSTOP: 881*cdf0e10cSrcweir { 882*cdf0e10cSrcweir // Stop immermoeglich, wenn irgendein Basic lauft... 883*cdf0e10cSrcweir if ( !StarBASIC::IsRunning() ) 884*cdf0e10cSrcweir rSet.DisableItem( nWh ); 885*cdf0e10cSrcweir } 886*cdf0e10cSrcweir break; 887*cdf0e10cSrcweir case SID_CHOOSE_CONTROLS: 888*cdf0e10cSrcweir case SID_DIALOG_TESTMODE: 889*cdf0e10cSrcweir { 890*cdf0e10cSrcweir if( !pCurWin || !pCurWin->IsA( TYPE( DialogWindow ) ) ) 891*cdf0e10cSrcweir rSet.DisableItem( nWh ); 892*cdf0e10cSrcweir } 893*cdf0e10cSrcweir break; 894*cdf0e10cSrcweir case SID_SHOW_FORMS: 895*cdf0e10cSrcweir case SID_SHOW_HIDDEN: 896*cdf0e10cSrcweir { 897*cdf0e10cSrcweir rSet.DisableItem( nWh ); 898*cdf0e10cSrcweir } 899*cdf0e10cSrcweir break; 900*cdf0e10cSrcweir case SID_SEARCH_OPTIONS: 901*cdf0e10cSrcweir { 902*cdf0e10cSrcweir sal_uInt16 nOptions = 0; 903*cdf0e10cSrcweir if( pCurWin ) 904*cdf0e10cSrcweir nOptions = pCurWin->GetSearchOptions(); 905*cdf0e10cSrcweir rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, nOptions ) ); 906*cdf0e10cSrcweir } 907*cdf0e10cSrcweir break; 908*cdf0e10cSrcweir case SID_BASICIDE_LIBSELECTOR: 909*cdf0e10cSrcweir { 910*cdf0e10cSrcweir String aName; 911*cdf0e10cSrcweir if ( m_aCurLibName.Len() ) 912*cdf0e10cSrcweir { 913*cdf0e10cSrcweir LibraryLocation eLocation = m_aCurDocument.getLibraryLocation( m_aCurLibName ); 914*cdf0e10cSrcweir aName = CreateMgrAndLibStr( m_aCurDocument.getTitle( eLocation ), m_aCurLibName ); 915*cdf0e10cSrcweir } 916*cdf0e10cSrcweir SfxStringItem aItem( SID_BASICIDE_LIBSELECTOR, aName ); 917*cdf0e10cSrcweir rSet.Put( aItem ); 918*cdf0e10cSrcweir } 919*cdf0e10cSrcweir break; 920*cdf0e10cSrcweir case SID_SEARCH_ITEM: 921*cdf0e10cSrcweir { 922*cdf0e10cSrcweir String aSelected = GetSelectionText( sal_True ); 923*cdf0e10cSrcweir SvxSearchItem& rItem = IDE_DLL()->GetExtraData()->GetSearchItem(); 924*cdf0e10cSrcweir rItem.SetSearchString( aSelected ); 925*cdf0e10cSrcweir rSet.Put( rItem ); 926*cdf0e10cSrcweir } 927*cdf0e10cSrcweir break; 928*cdf0e10cSrcweir case SID_BASICIDE_STAT_DATE: 929*cdf0e10cSrcweir { 930*cdf0e10cSrcweir String aDate; 931*cdf0e10cSrcweir aDate = String( RTL_CONSTASCII_USTRINGPARAM( "Datum?!" ) ); 932*cdf0e10cSrcweir SfxStringItem aItem( SID_BASICIDE_STAT_DATE, aDate ); 933*cdf0e10cSrcweir rSet.Put( aItem ); 934*cdf0e10cSrcweir } 935*cdf0e10cSrcweir break; 936*cdf0e10cSrcweir case SID_DOC_MODIFIED: 937*cdf0e10cSrcweir { 938*cdf0e10cSrcweir String aModifiedMarker; 939*cdf0e10cSrcweir sal_Bool bModified = sal_False; 940*cdf0e10cSrcweir 941*cdf0e10cSrcweir if ( pCurWin ) 942*cdf0e10cSrcweir { 943*cdf0e10cSrcweir if ( pCurWin->IsModified() ) 944*cdf0e10cSrcweir bModified = sal_True; 945*cdf0e10cSrcweir else 946*cdf0e10cSrcweir { 947*cdf0e10cSrcweir ScriptDocument aDocument( pCurWin->GetDocument() ); 948*cdf0e10cSrcweir bModified = aDocument.isDocument() ? aDocument.isDocumentModified() : IsAppBasicModified(); 949*cdf0e10cSrcweir } 950*cdf0e10cSrcweir } 951*cdf0e10cSrcweir 952*cdf0e10cSrcweir if ( bModified ) 953*cdf0e10cSrcweir aModifiedMarker = '*'; 954*cdf0e10cSrcweir 955*cdf0e10cSrcweir SfxStringItem aItem( SID_DOC_MODIFIED, aModifiedMarker ); 956*cdf0e10cSrcweir rSet.Put( aItem ); 957*cdf0e10cSrcweir } 958*cdf0e10cSrcweir break; 959*cdf0e10cSrcweir case SID_BASICIDE_STAT_TITLE: 960*cdf0e10cSrcweir { 961*cdf0e10cSrcweir if ( pCurWin ) 962*cdf0e10cSrcweir { 963*cdf0e10cSrcweir String aTitle = pCurWin->CreateQualifiedName(); 964*cdf0e10cSrcweir SfxStringItem aItem( SID_BASICIDE_STAT_TITLE, aTitle ); 965*cdf0e10cSrcweir rSet.Put( aItem ); 966*cdf0e10cSrcweir } 967*cdf0e10cSrcweir } 968*cdf0e10cSrcweir break; 969*cdf0e10cSrcweir // Werden vom Controller ausgewertet: 970*cdf0e10cSrcweir case SID_ATTR_SIZE: 971*cdf0e10cSrcweir case SID_ATTR_INSERT: 972*cdf0e10cSrcweir break; 973*cdf0e10cSrcweir case SID_UNDO: 974*cdf0e10cSrcweir case SID_REDO: 975*cdf0e10cSrcweir { 976*cdf0e10cSrcweir if( GetUndoManager() ) // sonst rekursives GetState 977*cdf0e10cSrcweir GetViewFrame()->GetSlotState( nWh, NULL, &rSet ); 978*cdf0e10cSrcweir } 979*cdf0e10cSrcweir break; 980*cdf0e10cSrcweir case SID_SHOW_PROPERTYBROWSER: 981*cdf0e10cSrcweir { 982*cdf0e10cSrcweir if ( GetViewFrame()->KnowsChildWindow( nWh ) ) 983*cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWh, GetViewFrame()->HasChildWindow( nWh ) ) ); 984*cdf0e10cSrcweir else 985*cdf0e10cSrcweir rSet.DisableItem( nWh ); 986*cdf0e10cSrcweir } 987*cdf0e10cSrcweir break; 988*cdf0e10cSrcweir 989*cdf0e10cSrcweir case SID_BASICIDE_CURRENT_LANG: 990*cdf0e10cSrcweir { 991*cdf0e10cSrcweir if( (pCurWin && pCurWin->IsReadOnly()) || GetCurLibName().Len() == 0 ) 992*cdf0e10cSrcweir rSet.DisableItem( nWh ); 993*cdf0e10cSrcweir else 994*cdf0e10cSrcweir { 995*cdf0e10cSrcweir String aItemStr; 996*cdf0e10cSrcweir LocalizationMgr* pCurMgr = GetCurLocalizationMgr(); 997*cdf0e10cSrcweir if ( pCurMgr->isLibraryLocalized() ) 998*cdf0e10cSrcweir { 999*cdf0e10cSrcweir Sequence< lang::Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales(); 1000*cdf0e10cSrcweir const lang::Locale* pLocale = aLocaleSeq.getConstArray(); 1001*cdf0e10cSrcweir sal_Int32 i, nCount = aLocaleSeq.getLength(); 1002*cdf0e10cSrcweir 1003*cdf0e10cSrcweir // Force different results for any combination of locales and default locale 1004*cdf0e10cSrcweir ::rtl::OUString aLangStr; 1005*cdf0e10cSrcweir for ( i = 0; i <= nCount; ++i ) 1006*cdf0e10cSrcweir { 1007*cdf0e10cSrcweir lang::Locale aLocale; 1008*cdf0e10cSrcweir if( i < nCount ) 1009*cdf0e10cSrcweir aLocale = pLocale[i]; 1010*cdf0e10cSrcweir else 1011*cdf0e10cSrcweir aLocale = pCurMgr->getStringResourceManager()->getDefaultLocale(); 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir aLangStr += aLocale.Language; 1014*cdf0e10cSrcweir aLangStr += aLocale.Country; 1015*cdf0e10cSrcweir aLangStr += aLocale.Variant; 1016*cdf0e10cSrcweir } 1017*cdf0e10cSrcweir aItemStr = aLangStr; 1018*cdf0e10cSrcweir } 1019*cdf0e10cSrcweir rSet.Put( SfxStringItem( nWh, aItemStr ) ); 1020*cdf0e10cSrcweir } 1021*cdf0e10cSrcweir } 1022*cdf0e10cSrcweir break; 1023*cdf0e10cSrcweir 1024*cdf0e10cSrcweir case SID_BASICIDE_MANAGE_LANG: 1025*cdf0e10cSrcweir { 1026*cdf0e10cSrcweir if( (pCurWin && pCurWin->IsReadOnly()) || GetCurLibName().Len() == 0 ) 1027*cdf0e10cSrcweir rSet.DisableItem( nWh ); 1028*cdf0e10cSrcweir } 1029*cdf0e10cSrcweir break; 1030*cdf0e10cSrcweir } 1031*cdf0e10cSrcweir } 1032*cdf0e10cSrcweir if ( pCurWin ) 1033*cdf0e10cSrcweir pCurWin->GetState( rSet ); 1034*cdf0e10cSrcweir } 1035*cdf0e10cSrcweir 1036*cdf0e10cSrcweir sal_Bool BasicIDEShell::HasUIFeature( sal_uInt32 nFeature ) 1037*cdf0e10cSrcweir { 1038*cdf0e10cSrcweir sal_Bool bResult = sal_False; 1039*cdf0e10cSrcweir 1040*cdf0e10cSrcweir if ( (nFeature & BASICIDE_UI_FEATURE_SHOW_BROWSER) == BASICIDE_UI_FEATURE_SHOW_BROWSER ) 1041*cdf0e10cSrcweir { 1042*cdf0e10cSrcweir // fade out (in) property browser in module (dialog) windows 1043*cdf0e10cSrcweir if ( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) && !pCurWin->IsReadOnly() ) 1044*cdf0e10cSrcweir bResult = sal_True; 1045*cdf0e10cSrcweir } 1046*cdf0e10cSrcweir 1047*cdf0e10cSrcweir return bResult; 1048*cdf0e10cSrcweir } 1049*cdf0e10cSrcweir 1050*cdf0e10cSrcweir void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, sal_Bool bUpdateTabBar, sal_Bool bRememberAsCurrent ) 1051*cdf0e10cSrcweir { 1052*cdf0e10cSrcweir // Es muss ein EditWindow am Sfx gesetzt sein, sonst kommt kein 1053*cdf0e10cSrcweir // Resize, also stehen die Controls auf den Wiese... 1054*cdf0e10cSrcweir // Sieht dann sowieso besser aus, wenn das Modul-Layout angezeigt wird... 1055*cdf0e10cSrcweir if ( !pNewWin && ( GetWindow() != pModulLayout ) ) 1056*cdf0e10cSrcweir { 1057*cdf0e10cSrcweir pModulLayout->Show(); 1058*cdf0e10cSrcweir AdjustPosSizePixel( Point( 0, 0 ), GetViewFrame()->GetWindow().GetOutputSizePixel() ); 1059*cdf0e10cSrcweir SetWindow( pModulLayout ); 1060*cdf0e10cSrcweir EnableScrollbars( sal_False ); 1061*cdf0e10cSrcweir aVScrollBar.Hide(); 1062*cdf0e10cSrcweir } 1063*cdf0e10cSrcweir 1064*cdf0e10cSrcweir if ( pNewWin != pCurWin ) 1065*cdf0e10cSrcweir { 1066*cdf0e10cSrcweir IDEBaseWindow* pPrevCurWin = pCurWin; 1067*cdf0e10cSrcweir pCurWin = pNewWin; 1068*cdf0e10cSrcweir if ( pPrevCurWin ) 1069*cdf0e10cSrcweir { 1070*cdf0e10cSrcweir pPrevCurWin->Hide(); 1071*cdf0e10cSrcweir pPrevCurWin->Deactivating(); 1072*cdf0e10cSrcweir // pPrevCurWin->GetLayoutWindow()->Hide(); 1073*cdf0e10cSrcweir if( pPrevCurWin->IsA( TYPE( DialogWindow ) ) ) 1074*cdf0e10cSrcweir { 1075*cdf0e10cSrcweir ((DialogWindow*)pPrevCurWin)->DisableBrowser(); 1076*cdf0e10cSrcweir } 1077*cdf0e10cSrcweir else 1078*cdf0e10cSrcweir { 1079*cdf0e10cSrcweir pModulLayout->SetModulWindow( NULL ); 1080*cdf0e10cSrcweir } 1081*cdf0e10cSrcweir } 1082*cdf0e10cSrcweir if ( pCurWin ) 1083*cdf0e10cSrcweir { 1084*cdf0e10cSrcweir AdjustPosSizePixel( Point( 0, 0 ), GetViewFrame()->GetWindow().GetOutputSizePixel() ); 1085*cdf0e10cSrcweir if( pCurWin->IsA( TYPE( ModulWindow ) ) ) 1086*cdf0e10cSrcweir { 1087*cdf0e10cSrcweir GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW ); 1088*cdf0e10cSrcweir pModulLayout->SetModulWindow( (ModulWindow*)pCurWin ); 1089*cdf0e10cSrcweir pModulLayout->Show(); 1090*cdf0e10cSrcweir } 1091*cdf0e10cSrcweir else 1092*cdf0e10cSrcweir { 1093*cdf0e10cSrcweir pModulLayout->Hide(); 1094*cdf0e10cSrcweir GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_DIALOGWINDOW ); 1095*cdf0e10cSrcweir } 1096*cdf0e10cSrcweir 1097*cdf0e10cSrcweir if ( bRememberAsCurrent ) 1098*cdf0e10cSrcweir { 1099*cdf0e10cSrcweir BasicIDEData* pData = IDE_DLL()->GetExtraData(); 1100*cdf0e10cSrcweir if ( pData ) 1101*cdf0e10cSrcweir { 1102*cdf0e10cSrcweir sal_uInt16 nCurrentType = pCurWin->IsA( TYPE( ModulWindow ) ) ? BASICIDE_TYPE_MODULE : BASICIDE_TYPE_DIALOG; 1103*cdf0e10cSrcweir LibInfoItem* pLibInfoItem = new LibInfoItem( pCurWin->GetDocument(), pCurWin->GetLibName(), pCurWin->GetName(), nCurrentType ); 1104*cdf0e10cSrcweir pData->GetLibInfos().InsertInfo( pLibInfoItem ); 1105*cdf0e10cSrcweir } 1106*cdf0e10cSrcweir } 1107*cdf0e10cSrcweir 1108*cdf0e10cSrcweir if ( GetViewFrame()->GetWindow().IsVisible() ) // sonst macht es spaeter der SFX 1109*cdf0e10cSrcweir pCurWin->Show(); 1110*cdf0e10cSrcweir 1111*cdf0e10cSrcweir pCurWin->Init(); 1112*cdf0e10cSrcweir 1113*cdf0e10cSrcweir if ( !IDE_DLL()->GetExtraData()->ShellInCriticalSection() ) 1114*cdf0e10cSrcweir { 1115*cdf0e10cSrcweir Window* pFrameWindow = &GetViewFrame()->GetWindow(); 1116*cdf0e10cSrcweir Window* pFocusWindow = Application::GetFocusWindow(); 1117*cdf0e10cSrcweir while ( pFocusWindow && ( pFocusWindow != pFrameWindow ) ) 1118*cdf0e10cSrcweir pFocusWindow = pFocusWindow->GetParent(); 1119*cdf0e10cSrcweir if ( pFocusWindow ) // Focus in BasicIDE 1120*cdf0e10cSrcweir pNewWin->GrabFocus(); 1121*cdf0e10cSrcweir } 1122*cdf0e10cSrcweir if( pCurWin->IsA( TYPE( DialogWindow ) ) ) 1123*cdf0e10cSrcweir ((DialogWindow*)pCurWin)->UpdateBrowser(); 1124*cdf0e10cSrcweir } 1125*cdf0e10cSrcweir if ( bUpdateTabBar ) 1126*cdf0e10cSrcweir { 1127*cdf0e10cSrcweir sal_uLong nKey = aIDEWindowTable.GetKey( pCurWin ); 1128*cdf0e10cSrcweir if ( pCurWin && ( pTabBar->GetPagePos( (sal_uInt16)nKey ) == TAB_PAGE_NOTFOUND ) ) 1129*cdf0e10cSrcweir pTabBar->InsertPage( (sal_uInt16)nKey, pCurWin->GetTitle() ); // wurde neu eingeblendet 1130*cdf0e10cSrcweir pTabBar->SetCurPageId( (sal_uInt16)nKey ); 1131*cdf0e10cSrcweir } 1132*cdf0e10cSrcweir if ( pCurWin && pCurWin->IsSuspended() ) // Wenn das Fenster im Fehlerfall angezeigt wird... 1133*cdf0e10cSrcweir pCurWin->SetStatus( pCurWin->GetStatus() & ~BASWIN_SUSPENDED ); 1134*cdf0e10cSrcweir if ( pCurWin ) 1135*cdf0e10cSrcweir { 1136*cdf0e10cSrcweir SetWindow( pCurWin ); 1137*cdf0e10cSrcweir if ( pCurWin->GetDocument().isDocument() ) 1138*cdf0e10cSrcweir SfxObjectShell::SetCurrentComponent( pCurWin->GetDocument().getDocument() ); 1139*cdf0e10cSrcweir } 1140*cdf0e10cSrcweir else 1141*cdf0e10cSrcweir { 1142*cdf0e10cSrcweir SetWindow( pModulLayout ); 1143*cdf0e10cSrcweir GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW ); 1144*cdf0e10cSrcweir SfxObjectShell::SetCurrentComponent( NULL ); 1145*cdf0e10cSrcweir } 1146*cdf0e10cSrcweir SetUndoManager( pCurWin ? pCurWin->GetUndoManager() : 0 ); 1147*cdf0e10cSrcweir InvalidateBasicIDESlots(); 1148*cdf0e10cSrcweir EnableScrollbars( pCurWin ? sal_True : sal_False ); 1149*cdf0e10cSrcweir 1150*cdf0e10cSrcweir if ( m_pCurLocalizationMgr ) 1151*cdf0e10cSrcweir m_pCurLocalizationMgr->handleTranslationbar(); 1152*cdf0e10cSrcweir 1153*cdf0e10cSrcweir ManageToolbars(); 1154*cdf0e10cSrcweir 1155*cdf0e10cSrcweir // fade out (in) property browser in module (dialog) windows 1156*cdf0e10cSrcweir UIFeatureChanged(); 1157*cdf0e10cSrcweir } 1158*cdf0e10cSrcweir } 1159*cdf0e10cSrcweir 1160*cdf0e10cSrcweir void BasicIDEShell::ManageToolbars() 1161*cdf0e10cSrcweir { 1162*cdf0e10cSrcweir static ::rtl::OUString aLayoutManagerName = ::rtl::OUString::createFromAscii( "LayoutManager" ); 1163*cdf0e10cSrcweir static ::rtl::OUString aMacroBarResName = 1164*cdf0e10cSrcweir ::rtl::OUString::createFromAscii( "private:resource/toolbar/macrobar" ); 1165*cdf0e10cSrcweir static ::rtl::OUString aDialogBarResName = 1166*cdf0e10cSrcweir ::rtl::OUString::createFromAscii( "private:resource/toolbar/dialogbar" ); 1167*cdf0e10cSrcweir static ::rtl::OUString aInsertControlsBarResName = 1168*cdf0e10cSrcweir ::rtl::OUString::createFromAscii( "private:resource/toolbar/insertcontrolsbar" ); 1169*cdf0e10cSrcweir (void)aInsertControlsBarResName; 1170*cdf0e10cSrcweir 1171*cdf0e10cSrcweir if( !pCurWin ) 1172*cdf0e10cSrcweir return; 1173*cdf0e10cSrcweir 1174*cdf0e10cSrcweir Reference< beans::XPropertySet > xFrameProps 1175*cdf0e10cSrcweir ( GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); 1176*cdf0e10cSrcweir if ( xFrameProps.is() ) 1177*cdf0e10cSrcweir { 1178*cdf0e10cSrcweir Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; 1179*cdf0e10cSrcweir uno::Any a = xFrameProps->getPropertyValue( aLayoutManagerName ); 1180*cdf0e10cSrcweir a >>= xLayoutManager; 1181*cdf0e10cSrcweir if ( xLayoutManager.is() ) 1182*cdf0e10cSrcweir { 1183*cdf0e10cSrcweir xLayoutManager->lock(); 1184*cdf0e10cSrcweir if( pCurWin->IsA( TYPE( DialogWindow ) ) ) 1185*cdf0e10cSrcweir { 1186*cdf0e10cSrcweir xLayoutManager->destroyElement( aMacroBarResName ); 1187*cdf0e10cSrcweir 1188*cdf0e10cSrcweir xLayoutManager->requestElement( aDialogBarResName ); 1189*cdf0e10cSrcweir xLayoutManager->requestElement( aInsertControlsBarResName ); 1190*cdf0e10cSrcweir } 1191*cdf0e10cSrcweir else 1192*cdf0e10cSrcweir { 1193*cdf0e10cSrcweir xLayoutManager->destroyElement( aDialogBarResName ); 1194*cdf0e10cSrcweir xLayoutManager->destroyElement( aInsertControlsBarResName ); 1195*cdf0e10cSrcweir 1196*cdf0e10cSrcweir xLayoutManager->requestElement( aMacroBarResName ); 1197*cdf0e10cSrcweir } 1198*cdf0e10cSrcweir xLayoutManager->unlock(); 1199*cdf0e10cSrcweir } 1200*cdf0e10cSrcweir } 1201*cdf0e10cSrcweir } 1202*cdf0e10cSrcweir 1203*cdf0e10cSrcweir IDEBaseWindow* BasicIDEShell::FindApplicationWindow() 1204*cdf0e10cSrcweir { 1205*cdf0e10cSrcweir return FindWindow( ScriptDocument::getApplicationScriptDocument() ); 1206*cdf0e10cSrcweir } 1207*cdf0e10cSrcweir 1208*cdf0e10cSrcweir IDEBaseWindow* BasicIDEShell::FindWindow( const ScriptDocument& rDocument, const String& rLibName, const String& rName, sal_uInt16 nType, sal_Bool bFindSuspended ) 1209*cdf0e10cSrcweir { 1210*cdf0e10cSrcweir IDEBaseWindow* pWin = aIDEWindowTable.First(); 1211*cdf0e10cSrcweir while ( pWin ) 1212*cdf0e10cSrcweir { 1213*cdf0e10cSrcweir if ( !pWin->IsSuspended() || bFindSuspended ) 1214*cdf0e10cSrcweir { 1215*cdf0e10cSrcweir if ( !rLibName.Len() || !rName.Len() || nType == BASICIDE_TYPE_UNKNOWN ) 1216*cdf0e10cSrcweir { 1217*cdf0e10cSrcweir // return any non-suspended window 1218*cdf0e10cSrcweir return pWin; 1219*cdf0e10cSrcweir } 1220*cdf0e10cSrcweir else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rName && 1221*cdf0e10cSrcweir ( ( pWin->IsA( TYPE( ModulWindow ) ) && nType == BASICIDE_TYPE_MODULE ) || 1222*cdf0e10cSrcweir ( pWin->IsA( TYPE( DialogWindow ) ) && nType == BASICIDE_TYPE_DIALOG ) ) ) 1223*cdf0e10cSrcweir { 1224*cdf0e10cSrcweir return pWin; 1225*cdf0e10cSrcweir } 1226*cdf0e10cSrcweir } 1227*cdf0e10cSrcweir pWin = aIDEWindowTable.Next(); 1228*cdf0e10cSrcweir } 1229*cdf0e10cSrcweir return 0; 1230*cdf0e10cSrcweir } 1231*cdf0e10cSrcweir 1232*cdf0e10cSrcweir long BasicIDEShell::CallBasicErrorHdl( StarBASIC* pBasic ) 1233*cdf0e10cSrcweir { 1234*cdf0e10cSrcweir long nRet = 0; 1235*cdf0e10cSrcweir ModulWindow* pModWin = ShowActiveModuleWindow( pBasic ); 1236*cdf0e10cSrcweir if ( pModWin ) 1237*cdf0e10cSrcweir nRet = pModWin->BasicErrorHdl( pBasic ); 1238*cdf0e10cSrcweir return nRet; 1239*cdf0e10cSrcweir } 1240*cdf0e10cSrcweir 1241*cdf0e10cSrcweir long BasicIDEShell::CallBasicBreakHdl( StarBASIC* pBasic ) 1242*cdf0e10cSrcweir { 1243*cdf0e10cSrcweir long nRet = 0; 1244*cdf0e10cSrcweir ModulWindow* pModWin = ShowActiveModuleWindow( pBasic ); 1245*cdf0e10cSrcweir if ( pModWin ) 1246*cdf0e10cSrcweir { 1247*cdf0e10cSrcweir sal_Bool bAppWindowDisabled, bDispatcherLocked; 1248*cdf0e10cSrcweir sal_uInt16 nWaitCount; 1249*cdf0e10cSrcweir SfxUInt16Item *pSWActionCount, *pSWLockViewCount; 1250*cdf0e10cSrcweir BasicIDE::BasicStopped( &bAppWindowDisabled, &bDispatcherLocked, 1251*cdf0e10cSrcweir &nWaitCount, &pSWActionCount, &pSWLockViewCount ); 1252*cdf0e10cSrcweir 1253*cdf0e10cSrcweir nRet = pModWin->BasicBreakHdl( pBasic ); 1254*cdf0e10cSrcweir 1255*cdf0e10cSrcweir if ( StarBASIC::IsRunning() ) // Falls abgebrochen... 1256*cdf0e10cSrcweir { 1257*cdf0e10cSrcweir if ( bAppWindowDisabled ) 1258*cdf0e10cSrcweir Application::GetDefDialogParent()->Enable( sal_False ); 1259*cdf0e10cSrcweir /* 1260*cdf0e10cSrcweir if ( bDispatcherLocked ) 1261*cdf0e10cSrcweir SFX_APP()->LockDispatcher( sal_True ); 1262*cdf0e10cSrcweir */ 1263*cdf0e10cSrcweir if ( nWaitCount ) 1264*cdf0e10cSrcweir { 1265*cdf0e10cSrcweir BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); 1266*cdf0e10cSrcweir for ( sal_uInt16 n = 0; n < nWaitCount; n++ ) 1267*cdf0e10cSrcweir pIDEShell->GetViewFrame()->GetWindow().EnterWait(); 1268*cdf0e10cSrcweir } 1269*cdf0e10cSrcweir } 1270*cdf0e10cSrcweir } 1271*cdf0e10cSrcweir return nRet; 1272*cdf0e10cSrcweir } 1273*cdf0e10cSrcweir 1274*cdf0e10cSrcweir ModulWindow* BasicIDEShell::ShowActiveModuleWindow( StarBASIC* pBasic ) 1275*cdf0e10cSrcweir { 1276*cdf0e10cSrcweir SetCurLib( ScriptDocument::getApplicationScriptDocument(), String(), false ); 1277*cdf0e10cSrcweir 1278*cdf0e10cSrcweir SbModule* pActiveModule = StarBASIC::GetActiveModule(); 1279*cdf0e10cSrcweir SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pActiveModule); 1280*cdf0e10cSrcweir if( pClassModuleObject != NULL ) 1281*cdf0e10cSrcweir pActiveModule = pClassModuleObject->getClassModule(); 1282*cdf0e10cSrcweir 1283*cdf0e10cSrcweir DBG_ASSERT( pActiveModule, "Kein aktives Modul im ErrorHdl?!" ); 1284*cdf0e10cSrcweir if ( pActiveModule ) 1285*cdf0e10cSrcweir { 1286*cdf0e10cSrcweir ModulWindow* pWin = 0; 1287*cdf0e10cSrcweir SbxObject* pParent = pActiveModule->GetParent(); 1288*cdf0e10cSrcweir DBG_ASSERT( pParent && pParent->ISA( StarBASIC ), "Kein BASIC!" ); 1289*cdf0e10cSrcweir StarBASIC* pLib = static_cast< StarBASIC* >( pParent ); 1290*cdf0e10cSrcweir if ( pLib ) 1291*cdf0e10cSrcweir { 1292*cdf0e10cSrcweir BasicManager* pBasMgr = BasicIDE::FindBasicManager( pLib ); 1293*cdf0e10cSrcweir if ( pBasMgr ) 1294*cdf0e10cSrcweir { 1295*cdf0e10cSrcweir ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); 1296*cdf0e10cSrcweir String aLibName = pLib->GetName(); 1297*cdf0e10cSrcweir pWin = FindBasWin( aDocument, aLibName, pActiveModule->GetName(), sal_True ); 1298*cdf0e10cSrcweir DBG_ASSERT( pWin, "Error/Step-Hdl: Fenster wurde nicht erzeugt/gefunden!" ); 1299*cdf0e10cSrcweir SetCurLib( aDocument, aLibName ); 1300*cdf0e10cSrcweir SetCurWindow( pWin, sal_True ); 1301*cdf0e10cSrcweir } 1302*cdf0e10cSrcweir } 1303*cdf0e10cSrcweir BasicManager* pBasicMgr = BasicIDE::FindBasicManager( pBasic ); 1304*cdf0e10cSrcweir if ( pBasicMgr ) 1305*cdf0e10cSrcweir StartListening( *pBasicMgr, sal_True /* Nur einmal anmelden */ ); 1306*cdf0e10cSrcweir return pWin; 1307*cdf0e10cSrcweir } 1308*cdf0e10cSrcweir return 0; 1309*cdf0e10cSrcweir } 1310*cdf0e10cSrcweir 1311*cdf0e10cSrcweir void __EXPORT BasicIDEShell::AdjustPosSizePixel( const Point &rPos, const Size &rSize ) 1312*cdf0e10cSrcweir { 1313*cdf0e10cSrcweir // Nicht wenn minimiert, weil dann bei Restore der Text verschoben ist. 1314*cdf0e10cSrcweir if ( GetViewFrame()->GetWindow().GetOutputSizePixel().Height() == 0 ) 1315*cdf0e10cSrcweir return; 1316*cdf0e10cSrcweir 1317*cdf0e10cSrcweir Size aSz( rSize ); 1318*cdf0e10cSrcweir // long nScrollbarWidthPixel = aVScrollBar.GetSizePixel().Width(); 1319*cdf0e10cSrcweir Size aScrollBarBoxSz( aScrollBarBox.GetSizePixel() ); 1320*cdf0e10cSrcweir aSz.Height() -= aScrollBarBoxSz.Height(); 1321*cdf0e10cSrcweir 1322*cdf0e10cSrcweir Size aOutSz( aSz ); 1323*cdf0e10cSrcweir aSz.Width() -= aScrollBarBoxSz.Width(); 1324*cdf0e10cSrcweir aScrollBarBox.SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) ); 1325*cdf0e10cSrcweir aVScrollBar.SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) ); 1326*cdf0e10cSrcweir if ( bTabBarSplitted ) 1327*cdf0e10cSrcweir { 1328*cdf0e10cSrcweir // SplitSize ist beim Resize 0 ! 1329*cdf0e10cSrcweir long nSplitPos = pTabBar->GetSizePixel().Width(); 1330*cdf0e10cSrcweir if ( nSplitPos > aSz.Width() ) 1331*cdf0e10cSrcweir nSplitPos = aSz.Width(); 1332*cdf0e10cSrcweir pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( nSplitPos, aScrollBarBoxSz.Height() ) ); 1333*cdf0e10cSrcweir long nScrlStart = rPos.X() + nSplitPos; 1334*cdf0e10cSrcweir aHScrollBar.SetPosSizePixel( Point( nScrlStart, rPos.Y()+aSz.Height() ), Size( aSz.Width() - nScrlStart + 1, aScrollBarBoxSz.Height() ) ); 1335*cdf0e10cSrcweir aHScrollBar.Update(); 1336*cdf0e10cSrcweir } 1337*cdf0e10cSrcweir else 1338*cdf0e10cSrcweir { 1339*cdf0e10cSrcweir aHScrollBar.SetPosSizePixel( Point( rPos.X()+ aSz.Width()/2 - 1, rPos.Y()+aSz.Height() ), Size( aSz.Width()/2 + 2, aScrollBarBoxSz.Height() ) ); 1340*cdf0e10cSrcweir pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( aSz.Width()/2, aScrollBarBoxSz.Height() ) ); 1341*cdf0e10cSrcweir } 1342*cdf0e10cSrcweir 1343*cdf0e10cSrcweir Window* pEdtWin = pCurWin ? pCurWin->GetLayoutWindow() : pModulLayout; 1344*cdf0e10cSrcweir if ( pEdtWin ) 1345*cdf0e10cSrcweir { 1346*cdf0e10cSrcweir if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) ) 1347*cdf0e10cSrcweir pEdtWin->SetPosSizePixel( rPos, aSz ); // Ohne ScrollBar 1348*cdf0e10cSrcweir else 1349*cdf0e10cSrcweir pEdtWin->SetPosSizePixel( rPos, aOutSz ); 1350*cdf0e10cSrcweir } 1351*cdf0e10cSrcweir } 1352*cdf0e10cSrcweir 1353*cdf0e10cSrcweir Reference< XModel > BasicIDEShell::GetCurrentDocument() const 1354*cdf0e10cSrcweir { 1355*cdf0e10cSrcweir Reference< XModel > xDocument; 1356*cdf0e10cSrcweir if ( pCurWin && pCurWin->GetDocument().isDocument() ) 1357*cdf0e10cSrcweir xDocument = pCurWin->GetDocument().getDocument(); 1358*cdf0e10cSrcweir return xDocument; 1359*cdf0e10cSrcweir } 1360*cdf0e10cSrcweir 1361*cdf0e10cSrcweir void __EXPORT BasicIDEShell::Activate( sal_Bool bMDI ) 1362*cdf0e10cSrcweir { 1363*cdf0e10cSrcweir SfxViewShell::Activate( bMDI ); 1364*cdf0e10cSrcweir 1365*cdf0e10cSrcweir if ( bMDI ) 1366*cdf0e10cSrcweir { 1367*cdf0e10cSrcweir if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) ) 1368*cdf0e10cSrcweir ((DialogWindow*)pCurWin)->UpdateBrowser(); 1369*cdf0e10cSrcweir 1370*cdf0e10cSrcweir ShowObjectDialog( sal_True, sal_False ); 1371*cdf0e10cSrcweir } 1372*cdf0e10cSrcweir } 1373*cdf0e10cSrcweir 1374*cdf0e10cSrcweir void __EXPORT BasicIDEShell::Deactivate( sal_Bool bMDI ) 1375*cdf0e10cSrcweir { 1376*cdf0e10cSrcweir // bMDI sal_True heisst, dass ein anderes MDI aktiviert wurde, bei einem 1377*cdf0e10cSrcweir // Deactivate durch eine MessageBox ist bMDI FALSE 1378*cdf0e10cSrcweir if ( bMDI ) 1379*cdf0e10cSrcweir { 1380*cdf0e10cSrcweir if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) ) 1381*cdf0e10cSrcweir { 1382*cdf0e10cSrcweir DialogWindow* pXDlgWin = (DialogWindow*)pCurWin; 1383*cdf0e10cSrcweir pXDlgWin->DisableBrowser(); 1384*cdf0e10cSrcweir if( pXDlgWin->IsModified() ) 1385*cdf0e10cSrcweir BasicIDE::MarkDocumentModified( pXDlgWin->GetDocument() ); 1386*cdf0e10cSrcweir } 1387*cdf0e10cSrcweir 1388*cdf0e10cSrcweir // CanClose pruefen, damit auch beim deaktivieren der BasicIDE geprueft wird, 1389*cdf0e10cSrcweir // ob in einem Modul der Sourcecode zu gross ist... 1390*cdf0e10cSrcweir for ( sal_uLong nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ ) 1391*cdf0e10cSrcweir { 1392*cdf0e10cSrcweir IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin ); 1393*cdf0e10cSrcweir if ( /* !pWin->IsSuspended() && */ !pWin->CanClose() ) 1394*cdf0e10cSrcweir { 1395*cdf0e10cSrcweir if ( m_aCurLibName.Len() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) ) 1396*cdf0e10cSrcweir SetCurLib( ScriptDocument::getApplicationScriptDocument(), String(), false ); 1397*cdf0e10cSrcweir SetCurWindow( pWin, sal_True ); 1398*cdf0e10cSrcweir break; 1399*cdf0e10cSrcweir } 1400*cdf0e10cSrcweir } 1401*cdf0e10cSrcweir 1402*cdf0e10cSrcweir ShowObjectDialog( sal_False, sal_False ); 1403*cdf0e10cSrcweir } 1404*cdf0e10cSrcweir } 1405*cdf0e10cSrcweir 1406*cdf0e10cSrcweir 1407*cdf0e10cSrcweir IMPL_LINK( BasicIDEShell, AccelSelectHdl, Accelerator*, pAccel ) 1408*cdf0e10cSrcweir { 1409*cdf0e10cSrcweir sal_Bool bDone = sal_True; 1410*cdf0e10cSrcweir SfxViewFrame* pViewFrame = GetViewFrame(); 1411*cdf0e10cSrcweir SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; 1412*cdf0e10cSrcweir if( !pDispatcher ) 1413*cdf0e10cSrcweir return sal_False; 1414*cdf0e10cSrcweir switch ( pAccel->GetCurKeyCode().GetCode() ) 1415*cdf0e10cSrcweir { 1416*cdf0e10cSrcweir case KEY_F5: 1417*cdf0e10cSrcweir if ( pAccel->GetCurKeyCode().IsShift() ) 1418*cdf0e10cSrcweir pDispatcher->Execute( SID_BASICSTOP, SFX_CALLMODE_SYNCHRON ); 1419*cdf0e10cSrcweir else 1420*cdf0e10cSrcweir pDispatcher->Execute( SID_BASICRUN, SFX_CALLMODE_SYNCHRON ); 1421*cdf0e10cSrcweir break; 1422*cdf0e10cSrcweir case KEY_F7: 1423*cdf0e10cSrcweir pDispatcher->Execute( SID_BASICIDE_ADDWATCH, SFX_CALLMODE_SYNCHRON ); 1424*cdf0e10cSrcweir break; 1425*cdf0e10cSrcweir case KEY_F8: 1426*cdf0e10cSrcweir if ( pAccel->GetCurKeyCode().IsShift() ) 1427*cdf0e10cSrcweir pDispatcher->Execute( SID_BASICSTEPOVER, SFX_CALLMODE_SYNCHRON ); 1428*cdf0e10cSrcweir else 1429*cdf0e10cSrcweir pDispatcher->Execute( SID_BASICSTEPINTO, SFX_CALLMODE_SYNCHRON ); 1430*cdf0e10cSrcweir break; 1431*cdf0e10cSrcweir case KEY_F9: 1432*cdf0e10cSrcweir if ( pAccel->GetCurKeyCode().IsShift() ) 1433*cdf0e10cSrcweir pDispatcher->Execute( SID_BASICIDE_TOGGLEBRKPNTENABLED, SFX_CALLMODE_SYNCHRON ); 1434*cdf0e10cSrcweir else 1435*cdf0e10cSrcweir pDispatcher->Execute( SID_BASICIDE_TOGGLEBRKPNT, SFX_CALLMODE_SYNCHRON ); 1436*cdf0e10cSrcweir break; 1437*cdf0e10cSrcweir default: bDone = sal_False; 1438*cdf0e10cSrcweir } 1439*cdf0e10cSrcweir return bDone; 1440*cdf0e10cSrcweir } 1441*cdf0e10cSrcweir 1442