1*d119d52dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*d119d52dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*d119d52dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*d119d52dSAndrew Rist * distributed with this work for additional information 6*d119d52dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*d119d52dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*d119d52dSAndrew Rist * "License"); you may not use this file except in compliance 9*d119d52dSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*d119d52dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*d119d52dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*d119d52dSAndrew Rist * software distributed under the License is distributed on an 15*d119d52dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*d119d52dSAndrew Rist * KIND, either express or implied. See the License for the 17*d119d52dSAndrew Rist * specific language governing permissions and limitations 18*d119d52dSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*d119d52dSAndrew Rist *************************************************************/ 21*d119d52dSAndrew Rist 22*d119d52dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sfx2.hxx" 26cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx> 27cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 28cdf0e10cSrcweir #include <com/sun/star/lang/IllegalArgumentException.hpp> 29cdf0e10cSrcweir #include <com/sun/star/frame/DispatchResultEvent.hpp> 30cdf0e10cSrcweir #include <com/sun/star/frame/DispatchResultState.hpp> 31cdf0e10cSrcweir #include <com/sun/star/task/XJobExecutor.hpp> 32cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> 33cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp> 34cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchHelper.hpp> 35cdf0e10cSrcweir #include <com/sun/star/frame/XFramesSupplier.hpp> 36cdf0e10cSrcweir #include <com/sun/star/util/XCloseable.hpp> 37cdf0e10cSrcweir #include <com/sun/star/util/CloseVetoException.hpp> 38cdf0e10cSrcweir #include <com/sun/star/frame/XLayoutManager.hpp> 39cdf0e10cSrcweir #include <com/sun/star/document/XEmbeddedScripts.hpp> 40cdf0e10cSrcweir #include <com/sun/star/embed/XStorage.hpp> 41cdf0e10cSrcweir #include <com/sun/star/embed/ElementModes.hpp> 42cdf0e10cSrcweir #include <com/sun/star/system/XSystemShellExecute.hpp> 43cdf0e10cSrcweir #include <com/sun/star/system/SystemShellExecuteFlags.hpp> 44cdf0e10cSrcweir #include <com/sun/star/system/SystemShellExecuteException.hpp> 45cdf0e10cSrcweir 46cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 47cdf0e10cSrcweir #include <comphelper/storagehelper.hxx> 48cdf0e10cSrcweir #include "comphelper/configurationhelper.hxx" 49cdf0e10cSrcweir 50cdf0e10cSrcweir #include <svtools/addresstemplate.hxx> 51cdf0e10cSrcweir #include <svl/visitem.hxx> 52cdf0e10cSrcweir #include <unotools/intlwrapper.hxx> 53cdf0e10cSrcweir 54cdf0e10cSrcweir #include <unotools/configmgr.hxx> 55cdf0e10cSrcweir #include <tools/config.hxx> 56cdf0e10cSrcweir #include <tools/diagnose_ex.h> 57cdf0e10cSrcweir #include <vcl/msgbox.hxx> 58cdf0e10cSrcweir #include <svl/intitem.hxx> 59cdf0e10cSrcweir #include <svl/eitem.hxx> 60cdf0e10cSrcweir #include <svl/stritem.hxx> 61cdf0e10cSrcweir #include <basic/sbstar.hxx> 62cdf0e10cSrcweir #include <basic/basmgr.hxx> 63cdf0e10cSrcweir #include <basic/basrdll.hxx> 64cdf0e10cSrcweir #include <svtools/sfxecode.hxx> 65cdf0e10cSrcweir #include <svtools/ehdl.hxx> 66cdf0e10cSrcweir #include <vcl/help.hxx> 67cdf0e10cSrcweir #include <vcl/stdtext.hxx> 68cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 69cdf0e10cSrcweir 70cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 71cdf0e10cSrcweir #include <unotools/moduleoptions.hxx> 72cdf0e10cSrcweir #include <unotools/regoptions.hxx> 73cdf0e10cSrcweir #include <svtools/helpopt.hxx> 74cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 75cdf0e10cSrcweir #include <tools/shl.hxx> 76cdf0e10cSrcweir #include <unotools/bootstrap.hxx> 77cdf0e10cSrcweir #include <vos/process.hxx> 78cdf0e10cSrcweir #include <rtl/bootstrap.hxx> 79cdf0e10cSrcweir #include <cppuhelper/exc_hlp.hxx> 80cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 81cdf0e10cSrcweir 82cdf0e10cSrcweir #include <com/sun/star/script/provider/XScriptProviderFactory.hpp> 83cdf0e10cSrcweir #include <com/sun/star/frame/XModuleManager.hpp> 84cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 85cdf0e10cSrcweir 86cdf0e10cSrcweir #include "frmload.hxx" 87cdf0e10cSrcweir #include "referers.hxx" 88cdf0e10cSrcweir #include <sfx2/app.hxx> 89cdf0e10cSrcweir #include <sfx2/request.hxx> 90cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 91cdf0e10cSrcweir #include <sfx2/bindings.hxx> 92cdf0e10cSrcweir #include <sfx2/msg.hxx> 93cdf0e10cSrcweir #include <sfx2/objface.hxx> 94cdf0e10cSrcweir #include <sfx2/objitem.hxx> 95cdf0e10cSrcweir #include <sfx2/objsh.hxx> 96cdf0e10cSrcweir #include <sfx2/hintpost.hxx> 97cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 98cdf0e10cSrcweir #include <sfx2/docfac.hxx> 99cdf0e10cSrcweir #include <sfx2/docfile.hxx> 100cdf0e10cSrcweir #include <sfx2/docfilt.hxx> 101cdf0e10cSrcweir #include "docvor.hxx" 102cdf0e10cSrcweir #include <sfx2/new.hxx> 103cdf0e10cSrcweir #include <sfx2/templdlg.hxx> 104cdf0e10cSrcweir #include "sfxtypes.hxx" 105cdf0e10cSrcweir #include <sfx2/tabdlg.hxx> 106cdf0e10cSrcweir #include "arrdecl.hxx" 107cdf0e10cSrcweir #include "fltfnc.hxx" 108cdf0e10cSrcweir #include <sfx2/sfx.hrc> 109cdf0e10cSrcweir #include "app.hrc" 110cdf0e10cSrcweir #include <sfx2/passwd.hxx> 111cdf0e10cSrcweir #include "sfx2/sfxresid.hxx" 112cdf0e10cSrcweir #include "arrdecl.hxx" 113cdf0e10cSrcweir #include <sfx2/childwin.hxx> 114cdf0e10cSrcweir #include "appdata.hxx" 115cdf0e10cSrcweir #include "sfx2/minfitem.hxx" 116cdf0e10cSrcweir #include <sfx2/event.hxx> 117cdf0e10cSrcweir #include <sfx2/module.hxx> 118cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 119cdf0e10cSrcweir #include "sfxpicklist.hxx" 120cdf0e10cSrcweir #include "imestatuswindow.hxx" 121cdf0e10cSrcweir #include <sfx2/sfxdlg.hxx> 122cdf0e10cSrcweir #include <sfx2/dialogs.hrc> 123cdf0e10cSrcweir #include "sorgitm.hxx" 124cdf0e10cSrcweir #include "sfx2/sfxhelp.hxx" 125cdf0e10cSrcweir #include <tools/svlibrary.hxx> 126cdf0e10cSrcweir 127cdf0e10cSrcweir using namespace ::com::sun::star; 128cdf0e10cSrcweir using namespace ::com::sun::star::beans; 129cdf0e10cSrcweir using namespace ::com::sun::star::uno; 130cdf0e10cSrcweir using namespace ::com::sun::star::frame; 131cdf0e10cSrcweir using namespace ::com::sun::star::container; 132cdf0e10cSrcweir using namespace ::com::sun::star::util; 133cdf0e10cSrcweir using namespace ::com::sun::star::script; 134cdf0e10cSrcweir using namespace ::com::sun::star::system; 135cdf0e10cSrcweir using namespace ::com::sun::star::lang; 136cdf0e10cSrcweir using namespace ::com::sun::star::document; 137cdf0e10cSrcweir 138cdf0e10cSrcweir namespace css = com::sun::star; 139cdf0e10cSrcweir 140cdf0e10cSrcweir //------------------------------------------------------------------------- 141cdf0e10cSrcweir long QuitAgain_Impl( void* pObj, void* pArg ) 142cdf0e10cSrcweir { 143cdf0e10cSrcweir SfxApplication* pApp = (SfxApplication*)pObj; 144cdf0e10cSrcweir Timer* pTimer = (Timer*)pArg; 145cdf0e10cSrcweir delete pTimer; 146cdf0e10cSrcweir pApp->GetDispatcher_Impl()->Execute( SID_QUITAPP, SFX_CALLMODE_ASYNCHRON ); 147cdf0e10cSrcweir return 0; 148cdf0e10cSrcweir } 149cdf0e10cSrcweir 150cdf0e10cSrcweir void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir DBG_MEMTEST(); 153cdf0e10cSrcweir bool bDone = sal_False; 154cdf0e10cSrcweir switch ( rReq.GetSlot() ) 155cdf0e10cSrcweir { 156cdf0e10cSrcweir case SID_SETOPTIONS: 157cdf0e10cSrcweir { 158cdf0e10cSrcweir if( rReq.GetArgs() ) 159cdf0e10cSrcweir SetOptions_Impl( *rReq.GetArgs() ); 160cdf0e10cSrcweir break; 161cdf0e10cSrcweir } 162cdf0e10cSrcweir 163cdf0e10cSrcweir case SID_QUITAPP: 164cdf0e10cSrcweir case SID_EXITANDRETURN: 165cdf0e10cSrcweir case SID_LOGOUT: 166cdf0e10cSrcweir { 167cdf0e10cSrcweir // protect against reentrant calls 168cdf0e10cSrcweir if ( pAppData_Impl->bInQuit ) 169cdf0e10cSrcweir return; 170cdf0e10cSrcweir 171cdf0e10cSrcweir if ( rReq.GetSlot() == SID_LOGOUT ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst(); 174cdf0e10cSrcweir pObjSh; pObjSh = SfxObjectShell::GetNext( *pObjSh ) ) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir if ( !pObjSh->IsModified() ) 177cdf0e10cSrcweir continue; 178cdf0e10cSrcweir 179cdf0e10cSrcweir SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjSh ); 180cdf0e10cSrcweir if ( !pFrame || !pFrame->GetWindow().IsReallyVisible() ) 181cdf0e10cSrcweir continue; 182cdf0e10cSrcweir 183cdf0e10cSrcweir if ( pObjSh->PrepareClose(2) ) 184cdf0e10cSrcweir pObjSh->SetModified( sal_False ); 185cdf0e10cSrcweir else 186cdf0e10cSrcweir return; 187cdf0e10cSrcweir } 188cdf0e10cSrcweir 189cdf0e10cSrcweir String aName = String::CreateFromAscii("vnd.sun.star.cmd:logout"); 190cdf0e10cSrcweir SfxStringItem aNameItem( SID_FILE_NAME, aName ); 191cdf0e10cSrcweir SfxStringItem aReferer( SID_REFERER, DEFINE_CONST_UNICODE( "private/user" ) ); 192cdf0e10cSrcweir pAppData_Impl->pAppDispat->Execute( SID_OPENDOC, SFX_CALLMODE_SLOT, &aNameItem, &aReferer, 0L ); 193cdf0e10cSrcweir return; 194cdf0e10cSrcweir } 195cdf0e10cSrcweir 196cdf0e10cSrcweir // aus verschachtelten Requests nach 100ms nochmal probieren 197cdf0e10cSrcweir if( Application::GetDispatchLevel() > 1 ) 198cdf0e10cSrcweir { 199cdf0e10cSrcweir /* Dont save the request for closing the application and try it later 200cdf0e10cSrcweir again. This is an UI bound functionality ... and the user will try it again 201cdf0e10cSrcweir if the dialog is closed. But we shouldnt close the application automaticly 202cdf0e10cSrcweir if this dialog is closed by the user ... 203cdf0e10cSrcweir So we ignore this request now and wait for a new user decision. 204cdf0e10cSrcweir */ 205cdf0e10cSrcweir DBG_TRACE1( "QueryExit => FALSE (DispatchLevel == %u)", Application::GetDispatchLevel() ); 206cdf0e10cSrcweir return; 207cdf0e10cSrcweir } 208cdf0e10cSrcweir 209cdf0e10cSrcweir // block reentrant calls 210cdf0e10cSrcweir pAppData_Impl->bInQuit = sal_True; 211cdf0e10cSrcweir Reference < XDesktop > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); 212cdf0e10cSrcweir 213cdf0e10cSrcweir rReq.ForgetAllArgs(); 214cdf0e10cSrcweir 215cdf0e10cSrcweir // if terminate() failed, pAppData_Impl->bInQuit will now be sal_False, allowing further calls of SID_QUITAPP 216cdf0e10cSrcweir sal_Bool bTerminated = xDesktop->terminate(); 217cdf0e10cSrcweir if (!bTerminated) 218cdf0e10cSrcweir // if terminate() was successful, SfxApplication is now dead! 219cdf0e10cSrcweir pAppData_Impl->bInQuit = sal_False; 220cdf0e10cSrcweir 221cdf0e10cSrcweir // Returnwert setzten, ggf. terminieren 222cdf0e10cSrcweir rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bTerminated ) ); 223cdf0e10cSrcweir return; 224cdf0e10cSrcweir } 225cdf0e10cSrcweir 226cdf0e10cSrcweir case SID_CONFIG: 227cdf0e10cSrcweir case SID_TOOLBOXOPTIONS: 228cdf0e10cSrcweir case SID_CONFIGSTATUSBAR: 229cdf0e10cSrcweir case SID_CONFIGMENU: 230cdf0e10cSrcweir case SID_CONFIGACCEL: 231cdf0e10cSrcweir case SID_CONFIGEVENT: 232cdf0e10cSrcweir { 233cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = 234cdf0e10cSrcweir SfxAbstractDialogFactory::Create(); 235cdf0e10cSrcweir 236cdf0e10cSrcweir if ( pFact ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir SFX_REQUEST_ARG(rReq, pStringItem, 239cdf0e10cSrcweir SfxStringItem, SID_CONFIG, sal_False); 240cdf0e10cSrcweir 241cdf0e10cSrcweir SfxItemSet aSet( 242cdf0e10cSrcweir GetPool(), SID_CONFIG, SID_CONFIG ); 243cdf0e10cSrcweir 244cdf0e10cSrcweir if ( pStringItem ) 245cdf0e10cSrcweir { 246cdf0e10cSrcweir aSet.Put( SfxStringItem( 247cdf0e10cSrcweir SID_CONFIG, pStringItem->GetValue() ) ); 248cdf0e10cSrcweir } 249cdf0e10cSrcweir 250cdf0e10cSrcweir Reference< XFrame > xFrame; 251cdf0e10cSrcweir const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl(); 252cdf0e10cSrcweir SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False ); 253cdf0e10cSrcweir if ( pFrameItem ) 254cdf0e10cSrcweir xFrame = pFrameItem->GetFrame(); 255cdf0e10cSrcweir 256cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( 257cdf0e10cSrcweir RID_SVXDLG_CUSTOMIZE, 258cdf0e10cSrcweir NULL, &aSet, xFrame ); 259cdf0e10cSrcweir 260cdf0e10cSrcweir if ( pDlg ) 261cdf0e10cSrcweir { 262cdf0e10cSrcweir const short nRet = pDlg->Execute(); 263cdf0e10cSrcweir 264cdf0e10cSrcweir if ( nRet ) 265cdf0e10cSrcweir bDone = sal_True; 266cdf0e10cSrcweir 267cdf0e10cSrcweir delete pDlg; 268cdf0e10cSrcweir } 269cdf0e10cSrcweir } 270cdf0e10cSrcweir break; 271cdf0e10cSrcweir } 272cdf0e10cSrcweir 273cdf0e10cSrcweir case SID_CLOSEDOCS: 274cdf0e10cSrcweir case SID_CLOSEWINS: 275cdf0e10cSrcweir { 276cdf0e10cSrcweir 277cdf0e10cSrcweir Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); 278cdf0e10cSrcweir Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY ); 279cdf0e10cSrcweir if ( !xTasks.is() ) 280cdf0e10cSrcweir break; 281cdf0e10cSrcweir 282cdf0e10cSrcweir sal_Int32 n=0; 283cdf0e10cSrcweir do 284cdf0e10cSrcweir { 285cdf0e10cSrcweir if ( xTasks->getCount() <= n ) 286cdf0e10cSrcweir break; 287cdf0e10cSrcweir 288cdf0e10cSrcweir Any aAny = xTasks->getByIndex(n); 289cdf0e10cSrcweir Reference < XCloseable > xTask; 290cdf0e10cSrcweir aAny >>= xTask; 291cdf0e10cSrcweir try 292cdf0e10cSrcweir { 293cdf0e10cSrcweir xTask->close(sal_True); 294cdf0e10cSrcweir n++; 295cdf0e10cSrcweir } 296cdf0e10cSrcweir catch( CloseVetoException& ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir } 299cdf0e10cSrcweir } 300cdf0e10cSrcweir while( sal_True ); 301cdf0e10cSrcweir 302cdf0e10cSrcweir sal_Bool bOk = ( n == 0); 303cdf0e10cSrcweir rReq.SetReturnValue( SfxBoolItem( 0, bOk ) ); 304cdf0e10cSrcweir bDone = sal_True; 305cdf0e10cSrcweir break; 306cdf0e10cSrcweir } 307cdf0e10cSrcweir 308cdf0e10cSrcweir case SID_SAVEDOCS: 309cdf0e10cSrcweir { 310cdf0e10cSrcweir sal_Bool bOK = sal_True; 311cdf0e10cSrcweir sal_Bool bTmpDone = sal_True; 312cdf0e10cSrcweir for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst(); 313cdf0e10cSrcweir pObjSh; 314cdf0e10cSrcweir pObjSh = SfxObjectShell::GetNext( *pObjSh ) ) 315cdf0e10cSrcweir { 316cdf0e10cSrcweir SfxRequest aReq( SID_SAVEDOC, 0, pObjSh->GetPool() ); 317cdf0e10cSrcweir if ( pObjSh->IsModified() ) 318cdf0e10cSrcweir { 319cdf0e10cSrcweir pObjSh->ExecuteSlot( aReq ); 320cdf0e10cSrcweir SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, aReq.GetReturnValue() ); 321cdf0e10cSrcweir bTmpDone = aReq.IsDone(); 322cdf0e10cSrcweir if ( !pItem || !pItem->GetValue() ) 323cdf0e10cSrcweir bOK = sal_False; 324cdf0e10cSrcweir } 325cdf0e10cSrcweir } 326cdf0e10cSrcweir 327cdf0e10cSrcweir rReq.SetReturnValue( SfxBoolItem( 0, bOK ) ); 328cdf0e10cSrcweir rReq.Done(); 329cdf0e10cSrcweir break; 330cdf0e10cSrcweir } 331cdf0e10cSrcweir 332cdf0e10cSrcweir // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 333cdf0e10cSrcweir case SID_HELPINDEX: 334cdf0e10cSrcweir case SID_HELP_SUPPORTPAGE: 335cdf0e10cSrcweir { 336cdf0e10cSrcweir Help* pHelp = Application::GetHelp(); 337cdf0e10cSrcweir if ( pHelp ) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir if ( rReq.GetSlot() == SID_HELP_SUPPORTPAGE ) 340cdf0e10cSrcweir { 341cdf0e10cSrcweir // show Support page with new URL 342cdf0e10cSrcweir String sHelpURL = SfxHelp::CreateHelpURL( String::CreateFromAscii(".uno:HelpSupport"), String() ); 343cdf0e10cSrcweir String sParams = sHelpURL.Copy( sHelpURL.Search( '?' ) ); 344cdf0e10cSrcweir sHelpURL = String::CreateFromAscii("vnd.sun.star.help://shared/text/shared/05/00000001.xhp"); 345cdf0e10cSrcweir sHelpURL += sParams; 346cdf0e10cSrcweir sHelpURL += String::CreateFromAscii("&UseDB=no"); 347cdf0e10cSrcweir pHelp->Start( sHelpURL, NULL ); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir else 350cdf0e10cSrcweir pHelp->Start( String::CreateFromAscii(".uno:HelpIndex"), NULL ); // show start page 351cdf0e10cSrcweir bDone = sal_True; 352cdf0e10cSrcweir } 353cdf0e10cSrcweir break; 354cdf0e10cSrcweir } 355cdf0e10cSrcweir 356cdf0e10cSrcweir // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 357cdf0e10cSrcweir case SID_HELPTIPS: 358cdf0e10cSrcweir { 359cdf0e10cSrcweir // Parameter aus werten 360cdf0e10cSrcweir SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPTIPS, sal_False); 361cdf0e10cSrcweir bool bOn = pOnItem 362cdf0e10cSrcweir ? ((SfxBoolItem*)pOnItem)->GetValue() 363cdf0e10cSrcweir : !Help::IsQuickHelpEnabled(); 364cdf0e10cSrcweir 365cdf0e10cSrcweir // ausf"uhren 366cdf0e10cSrcweir if ( bOn ) 367cdf0e10cSrcweir Help::EnableQuickHelp(); 368cdf0e10cSrcweir else 369cdf0e10cSrcweir Help::DisableQuickHelp(); 370cdf0e10cSrcweir SvtHelpOptions().SetHelpTips( bOn ); 371cdf0e10cSrcweir Invalidate(SID_HELPTIPS); 372cdf0e10cSrcweir bDone = sal_True; 373cdf0e10cSrcweir 374cdf0e10cSrcweir // ggf. recorden 375cdf0e10cSrcweir if ( !rReq.IsAPI() ) 376cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( SID_HELPTIPS, bOn) ); 377cdf0e10cSrcweir break; 378cdf0e10cSrcweir } 379cdf0e10cSrcweir // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 380cdf0e10cSrcweir case SID_EXTENDEDHELP: 381cdf0e10cSrcweir { 382cdf0e10cSrcweir Help::StartExtHelp(); 383cdf0e10cSrcweir break; 384cdf0e10cSrcweir } 385cdf0e10cSrcweir case SID_HELPBALLOONS: 386cdf0e10cSrcweir { 387cdf0e10cSrcweir // Parameter auswerten 388cdf0e10cSrcweir SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPBALLOONS, sal_False); 389cdf0e10cSrcweir bool bOn = pOnItem 390cdf0e10cSrcweir ? ((SfxBoolItem*)pOnItem)->GetValue() 391cdf0e10cSrcweir : !Help::IsBalloonHelpEnabled(); 392cdf0e10cSrcweir 393cdf0e10cSrcweir // ausf"uhren 394cdf0e10cSrcweir if ( bOn ) 395cdf0e10cSrcweir Help::EnableBalloonHelp(); 396cdf0e10cSrcweir else 397cdf0e10cSrcweir Help::DisableBalloonHelp(); 398cdf0e10cSrcweir SvtHelpOptions().SetExtendedHelp( bOn ); 399cdf0e10cSrcweir Invalidate(SID_HELPBALLOONS); 400cdf0e10cSrcweir bDone = sal_True; 401cdf0e10cSrcweir 402cdf0e10cSrcweir // ggf. recorden 403cdf0e10cSrcweir if ( !rReq.IsAPI() ) 404cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( SID_HELPBALLOONS, bOn) ); 405cdf0e10cSrcweir break; 406cdf0e10cSrcweir } 407cdf0e10cSrcweir 408cdf0e10cSrcweir // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 409cdf0e10cSrcweir case SID_HELP_PI: 410cdf0e10cSrcweir { 411cdf0e10cSrcweir SvtHelpOptions aHelpOpt; 412cdf0e10cSrcweir SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELP_PI, sal_False); 413cdf0e10cSrcweir sal_Bool bOn = pOnItem 414cdf0e10cSrcweir ? ((SfxBoolItem*)pOnItem)->GetValue() 415cdf0e10cSrcweir : !aHelpOpt.IsHelpAgentAutoStartMode(); 416cdf0e10cSrcweir aHelpOpt.SetHelpAgentAutoStartMode( bOn ); 417cdf0e10cSrcweir Invalidate(SID_HELP_PI); 418cdf0e10cSrcweir bDone = sal_True; 419cdf0e10cSrcweir break; 420cdf0e10cSrcweir } 421cdf0e10cSrcweir 422cdf0e10cSrcweir // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 423cdf0e10cSrcweir case SID_ABOUT: 424cdf0e10cSrcweir { 425cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 426cdf0e10cSrcweir if ( pFact ) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateVclDialog( 0, RID_DEFAULTABOUT ); 429cdf0e10cSrcweir pDlg->Execute(); 430cdf0e10cSrcweir delete pDlg; 431cdf0e10cSrcweir bDone = sal_True; 432cdf0e10cSrcweir } 433cdf0e10cSrcweir break; 434cdf0e10cSrcweir } 435cdf0e10cSrcweir 436cdf0e10cSrcweir // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 437cdf0e10cSrcweir case SID_ORGANIZER: 438cdf0e10cSrcweir { 439cdf0e10cSrcweir SfxTemplateOrganizeDlg *pDlg = 440cdf0e10cSrcweir new SfxTemplateOrganizeDlg(NULL); 441cdf0e10cSrcweir pDlg->Execute(); 442cdf0e10cSrcweir delete pDlg; 443cdf0e10cSrcweir bDone = sal_True; 444cdf0e10cSrcweir break; 445cdf0e10cSrcweir } 446cdf0e10cSrcweir 447cdf0e10cSrcweir case SID_TEMPLATE_ADDRESSBOKSOURCE: 448cdf0e10cSrcweir { 449cdf0e10cSrcweir svt::AddressBookSourceDialog aDialog(GetTopWindow(), ::comphelper::getProcessServiceFactory()); 450cdf0e10cSrcweir aDialog.Execute(); 451cdf0e10cSrcweir bDone = sal_True; 452cdf0e10cSrcweir break; 453cdf0e10cSrcweir } 454cdf0e10cSrcweir 455cdf0e10cSrcweir case SID_BASICSTOP: 456cdf0e10cSrcweir StarBASIC::Stop(); 457cdf0e10cSrcweir break; 458cdf0e10cSrcweir 459cdf0e10cSrcweir case SID_BASICBREAK : 460cdf0e10cSrcweir BASIC_DLL()->BasicBreak(); 461cdf0e10cSrcweir break; 462cdf0e10cSrcweir 463cdf0e10cSrcweir case SID_CRASH : 464cdf0e10cSrcweir { 465cdf0e10cSrcweir // Provoke a crash: 466cdf0e10cSrcweir char * crash = 0; 467cdf0e10cSrcweir *crash = 0; 468cdf0e10cSrcweir break; 469cdf0e10cSrcweir } 470cdf0e10cSrcweir 471cdf0e10cSrcweir case SID_SHOW_IME_STATUS_WINDOW: 472cdf0e10cSrcweir if (pAppData_Impl->m_xImeStatusWindow->canToggle()) 473cdf0e10cSrcweir { 474cdf0e10cSrcweir SfxBoolItem const * pItem = static_cast< SfxBoolItem const * >( 475cdf0e10cSrcweir rReq.GetArg(SID_SHOW_IME_STATUS_WINDOW, false, 476cdf0e10cSrcweir TYPE(SfxBoolItem))); 477cdf0e10cSrcweir bool bShow = pItem == 0 478cdf0e10cSrcweir ? !pAppData_Impl->m_xImeStatusWindow->isShowing() 479cdf0e10cSrcweir : ( pItem->GetValue() == sal_True ); 480cdf0e10cSrcweir pAppData_Impl->m_xImeStatusWindow->show(bShow); 481cdf0e10cSrcweir if (pItem == 0) 482cdf0e10cSrcweir rReq.AppendItem(SfxBoolItem(SID_SHOW_IME_STATUS_WINDOW, 483cdf0e10cSrcweir bShow)); 484cdf0e10cSrcweir } 485cdf0e10cSrcweir bDone = true; 486cdf0e10cSrcweir break; 487cdf0e10cSrcweir 488cdf0e10cSrcweir case SID_AVAILABLE_TOOLBARS: 489cdf0e10cSrcweir { 490cdf0e10cSrcweir SfxStringItem const * pToolbarName = static_cast< SfxStringItem const *>( 491cdf0e10cSrcweir rReq.GetArg(SID_AVAILABLE_TOOLBARS, false, TYPE(SfxStringItem))); 492cdf0e10cSrcweir 493cdf0e10cSrcweir if ( pToolbarName ) 494cdf0e10cSrcweir { 495cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame; 496cdf0e10cSrcweir Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( 497cdf0e10cSrcweir DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); 498cdf0e10cSrcweir xFrame = xDesktop->getActiveFrame(); 499cdf0e10cSrcweir 500cdf0e10cSrcweir Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); 501cdf0e10cSrcweir Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; 502cdf0e10cSrcweir if ( xPropSet.is() ) 503cdf0e10cSrcweir { 504cdf0e10cSrcweir try 505cdf0e10cSrcweir { 506cdf0e10cSrcweir Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); 507cdf0e10cSrcweir aValue >>= xLayoutManager; 508cdf0e10cSrcweir } 509cdf0e10cSrcweir catch ( ::com::sun::star::uno::RuntimeException& e ) 510cdf0e10cSrcweir { 511cdf0e10cSrcweir throw e; 512cdf0e10cSrcweir } 513cdf0e10cSrcweir catch ( ::com::sun::star::uno::Exception& ) 514cdf0e10cSrcweir { 515cdf0e10cSrcweir } 516cdf0e10cSrcweir } 517cdf0e10cSrcweir 518cdf0e10cSrcweir if ( xLayoutManager.is() ) 519cdf0e10cSrcweir { 520cdf0e10cSrcweir rtl::OUString aToolbarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" )); 521cdf0e10cSrcweir rtl::OUStringBuffer aBuf( aToolbarResName ); 522cdf0e10cSrcweir aBuf.append( pToolbarName->GetValue() ); 523cdf0e10cSrcweir 524cdf0e10cSrcweir // Parameter auswerten 525cdf0e10cSrcweir rtl::OUString aToolbarName( aBuf.makeStringAndClear() ); 526cdf0e10cSrcweir sal_Bool bShow( !xLayoutManager->isElementVisible( aToolbarName )); 527cdf0e10cSrcweir 528cdf0e10cSrcweir if ( bShow ) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir xLayoutManager->createElement( aToolbarName ); 531cdf0e10cSrcweir xLayoutManager->showElement( aToolbarName ); 532cdf0e10cSrcweir } 533cdf0e10cSrcweir else 534cdf0e10cSrcweir xLayoutManager->hideElement( aToolbarName ); 535cdf0e10cSrcweir } 536cdf0e10cSrcweir } 537cdf0e10cSrcweir 538cdf0e10cSrcweir bDone = true; 539cdf0e10cSrcweir break; 540cdf0e10cSrcweir } 541cdf0e10cSrcweir 542cdf0e10cSrcweir default: 543cdf0e10cSrcweir break; 544cdf0e10cSrcweir } 545cdf0e10cSrcweir 546cdf0e10cSrcweir if ( bDone ) 547cdf0e10cSrcweir rReq.Done(); 548cdf0e10cSrcweir } 549cdf0e10cSrcweir 550cdf0e10cSrcweir //-------------------------------------------------------------------- 551cdf0e10cSrcweir 552cdf0e10cSrcweir void SfxApplication::MiscState_Impl(SfxItemSet &rSet) 553cdf0e10cSrcweir { 554cdf0e10cSrcweir DBG_MEMTEST(); 555cdf0e10cSrcweir 556cdf0e10cSrcweir LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); 557cdf0e10cSrcweir const sal_uInt16 *pRanges = rSet.GetRanges(); 558cdf0e10cSrcweir DBG_ASSERT(pRanges && *pRanges, "Set ohne Bereich"); 559cdf0e10cSrcweir while ( *pRanges ) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir for(sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich) 562cdf0e10cSrcweir { 563cdf0e10cSrcweir switch(nWhich) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir case SID_TEMPLATE_ADDRESSBOKSOURCE: 566cdf0e10cSrcweir if ( !SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SDATABASE) ) 567cdf0e10cSrcweir rSet.Put(SfxVisibilityItem(nWhich, sal_False)); 568cdf0e10cSrcweir break; 569cdf0e10cSrcweir case SID_EXITANDRETURN: 570cdf0e10cSrcweir case SID_QUITAPP: 571cdf0e10cSrcweir { 572cdf0e10cSrcweir if ( pAppData_Impl->nDocModalMode ) 573cdf0e10cSrcweir rSet.DisableItem(nWhich); 574cdf0e10cSrcweir else 575cdf0e10cSrcweir rSet.Put(SfxStringItem(nWhich, String(SfxResId(STR_QUITAPP)))); 576cdf0e10cSrcweir break; 577cdf0e10cSrcweir } 578cdf0e10cSrcweir 579cdf0e10cSrcweir case SID_BASICSTOP: 580cdf0e10cSrcweir if ( !StarBASIC::IsRunning() ) 581cdf0e10cSrcweir rSet.DisableItem(nWhich); 582cdf0e10cSrcweir break; 583cdf0e10cSrcweir 584cdf0e10cSrcweir case SID_HELPTIPS: 585cdf0e10cSrcweir { 586cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HELPTIPS, Help::IsQuickHelpEnabled() ) ); 587cdf0e10cSrcweir } 588cdf0e10cSrcweir break; 589cdf0e10cSrcweir case SID_HELPBALLOONS: 590cdf0e10cSrcweir { 591cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HELPBALLOONS, Help::IsBalloonHelpEnabled() ) ); 592cdf0e10cSrcweir } 593cdf0e10cSrcweir break; 594cdf0e10cSrcweir case SID_HELP_PI: 595cdf0e10cSrcweir { 596cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HELP_PI, SvtHelpOptions().IsHelpAgentAutoStartMode() ) ); 597cdf0e10cSrcweir } 598cdf0e10cSrcweir break; 599cdf0e10cSrcweir 600cdf0e10cSrcweir case SID_EXTENDEDHELP: 601cdf0e10cSrcweir { 602cdf0e10cSrcweir } 603cdf0e10cSrcweir break; 604cdf0e10cSrcweir 605cdf0e10cSrcweir case SID_CLOSEDOCS: 606cdf0e10cSrcweir case SID_CLOSEWINS: 607cdf0e10cSrcweir { 608cdf0e10cSrcweir Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); 609cdf0e10cSrcweir Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY ); 610cdf0e10cSrcweir if ( !xTasks.is() || !xTasks->getCount() ) 611cdf0e10cSrcweir rSet.DisableItem(nWhich); 612cdf0e10cSrcweir break; 613cdf0e10cSrcweir } 614cdf0e10cSrcweir 615cdf0e10cSrcweir case SID_SAVEDOCS: 616cdf0e10cSrcweir { 617cdf0e10cSrcweir sal_Bool bModified = sal_False; 618cdf0e10cSrcweir for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst(); 619cdf0e10cSrcweir pObjSh; 620cdf0e10cSrcweir pObjSh = SfxObjectShell::GetNext( *pObjSh ) ) 621cdf0e10cSrcweir { 622cdf0e10cSrcweir if ( pObjSh->IsModified() ) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir bModified = sal_True; 625cdf0e10cSrcweir break; 626cdf0e10cSrcweir } 627cdf0e10cSrcweir } 628cdf0e10cSrcweir 629cdf0e10cSrcweir if ( !bModified ) 630cdf0e10cSrcweir rSet.DisableItem( nWhich ); 631cdf0e10cSrcweir break; 632cdf0e10cSrcweir } 633cdf0e10cSrcweir 634cdf0e10cSrcweir case SID_SHOW_IME_STATUS_WINDOW: 635cdf0e10cSrcweir if (pAppData_Impl->m_xImeStatusWindow->canToggle()) 636cdf0e10cSrcweir rSet.Put(SfxBoolItem( 637cdf0e10cSrcweir SID_SHOW_IME_STATUS_WINDOW, 638cdf0e10cSrcweir pAppData_Impl->m_xImeStatusWindow-> 639cdf0e10cSrcweir isShowing())); 640cdf0e10cSrcweir else 641cdf0e10cSrcweir rSet.DisableItem(SID_SHOW_IME_STATUS_WINDOW); 642cdf0e10cSrcweir break; 643cdf0e10cSrcweir 644cdf0e10cSrcweir default: 645cdf0e10cSrcweir break; 646cdf0e10cSrcweir } 647cdf0e10cSrcweir } 648cdf0e10cSrcweir 649cdf0e10cSrcweir ++pRanges; 650cdf0e10cSrcweir } 651cdf0e10cSrcweir } 652cdf0e10cSrcweir 653cdf0e10cSrcweir static const ::rtl::OUString& getProductRegistrationServiceName( ) 654cdf0e10cSrcweir { 655cdf0e10cSrcweir static ::rtl::OUString s_sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.setup.ProductRegistration" ); 656cdf0e10cSrcweir return s_sServiceName; 657cdf0e10cSrcweir } 658cdf0e10cSrcweir 659cdf0e10cSrcweir typedef rtl_uString* (SAL_CALL *basicide_choose_macro)(XModel*, sal_Bool, rtl_uString*); 660cdf0e10cSrcweir typedef void (SAL_CALL *basicide_macro_organizer)( sal_Int16 ); 661cdf0e10cSrcweir 662cdf0e10cSrcweir #define DOSTRING( x ) #x 663cdf0e10cSrcweir #define STRING( x ) DOSTRING( x ) 664cdf0e10cSrcweir 665cdf0e10cSrcweir extern "C" { static void SAL_CALL thisModule() {} } 666cdf0e10cSrcweir 667cdf0e10cSrcweir ::rtl::OUString ChooseMacro( const Reference< XModel >& rxLimitToDocument, sal_Bool bChooseOnly, const ::rtl::OUString& rMacroDesc = ::rtl::OUString() ) 668cdf0e10cSrcweir { 669cdf0e10cSrcweir // get basctl dllname 670cdf0e10cSrcweir static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "basctl" ) ) ); 671cdf0e10cSrcweir 672cdf0e10cSrcweir // load module 673cdf0e10cSrcweir oslModule handleMod = osl_loadModuleRelative( 674cdf0e10cSrcweir &thisModule, aLibName.pData, 0 ); 675cdf0e10cSrcweir 676cdf0e10cSrcweir // get symbol 677cdf0e10cSrcweir ::rtl::OUString aSymbol( RTL_CONSTASCII_USTRINGPARAM( "basicide_choose_macro" ) ); 678cdf0e10cSrcweir basicide_choose_macro pSymbol = (basicide_choose_macro) osl_getFunctionSymbol( handleMod, aSymbol.pData ); 679cdf0e10cSrcweir 680cdf0e10cSrcweir // call basicide_choose_macro in basctl 681cdf0e10cSrcweir rtl_uString* pScriptURL = pSymbol( rxLimitToDocument.get(), bChooseOnly, rMacroDesc.pData ); 682cdf0e10cSrcweir ::rtl::OUString aScriptURL( pScriptURL ); 683cdf0e10cSrcweir rtl_uString_release( pScriptURL ); 684cdf0e10cSrcweir return aScriptURL; 685cdf0e10cSrcweir } 686cdf0e10cSrcweir 687cdf0e10cSrcweir void MacroOrganizer( sal_Int16 nTabId ) 688cdf0e10cSrcweir { 689cdf0e10cSrcweir // get basctl dllname 690cdf0e10cSrcweir static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "basctl" ) ) ); 691cdf0e10cSrcweir 692cdf0e10cSrcweir // load module 693cdf0e10cSrcweir oslModule handleMod = osl_loadModuleRelative( 694cdf0e10cSrcweir &thisModule, aLibName.pData, 0 ); 695cdf0e10cSrcweir 696cdf0e10cSrcweir // get symbol 697cdf0e10cSrcweir ::rtl::OUString aSymbol( RTL_CONSTASCII_USTRINGPARAM( "basicide_macro_organizer" ) ); 698cdf0e10cSrcweir basicide_macro_organizer pSymbol = (basicide_macro_organizer) osl_getFunctionSymbol( handleMod, aSymbol.pData ); 699cdf0e10cSrcweir 700cdf0e10cSrcweir // call basicide_macro_organizer in basctl 701cdf0e10cSrcweir pSymbol( nTabId ); 702cdf0e10cSrcweir } 703cdf0e10cSrcweir 704cdf0e10cSrcweir #define RID_ERRBOX_MODULENOTINSTALLED (RID_OFA_START + 72) 705cdf0e10cSrcweir 706cdf0e10cSrcweir ResMgr* SfxApplication::GetOffResManager_Impl() 707cdf0e10cSrcweir { 708cdf0e10cSrcweir if ( !pAppData_Impl->pOfaResMgr ) 709cdf0e10cSrcweir pAppData_Impl->pOfaResMgr = CreateResManager( "ofa"); 710cdf0e10cSrcweir return pAppData_Impl->pOfaResMgr; 711cdf0e10cSrcweir } 712cdf0e10cSrcweir 713cdf0e10cSrcweir namespace 714cdf0e10cSrcweir { 715cdf0e10cSrcweir Window* lcl_getDialogParent( const Reference< XFrame >& _rxFrame, Window* _pFallback ) 716cdf0e10cSrcweir { 717cdf0e10cSrcweir if ( !_rxFrame.is() ) 718cdf0e10cSrcweir return _pFallback; 719cdf0e10cSrcweir 720cdf0e10cSrcweir try 721cdf0e10cSrcweir { 722cdf0e10cSrcweir Reference< awt::XWindow > xContainerWindow( _rxFrame->getContainerWindow(), UNO_SET_THROW ); 723cdf0e10cSrcweir Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow ); 724cdf0e10cSrcweir OSL_ENSURE( pWindow, "lcl_getDialogParent: cool, somebody implemented a VCL-less toolkit!" ); 725cdf0e10cSrcweir 726cdf0e10cSrcweir if ( pWindow ) 727cdf0e10cSrcweir return pWindow->GetSystemWindow(); 728cdf0e10cSrcweir } 729cdf0e10cSrcweir catch( const Exception& ) 730cdf0e10cSrcweir { 731cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 732cdf0e10cSrcweir } 733cdf0e10cSrcweir return _pFallback; 734cdf0e10cSrcweir } 735cdf0e10cSrcweir 736cdf0e10cSrcweir const ::rtl::OUString& lcl_getBasicIDEServiceName() 737cdf0e10cSrcweir { 738cdf0e10cSrcweir static const ::rtl::OUString s_sBasicName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ) ); 739cdf0e10cSrcweir return s_sBasicName; 740cdf0e10cSrcweir } 741cdf0e10cSrcweir 742cdf0e10cSrcweir SfxViewFrame* lcl_getBasicIDEViewFrame( SfxObjectShell* i_pBasicIDE ) 743cdf0e10cSrcweir { 744cdf0e10cSrcweir SfxViewFrame* pView = SfxViewFrame::GetFirst( i_pBasicIDE ); 745cdf0e10cSrcweir while ( pView ) 746cdf0e10cSrcweir { 747cdf0e10cSrcweir if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == lcl_getBasicIDEServiceName() ) 748cdf0e10cSrcweir break; 749cdf0e10cSrcweir pView = SfxViewFrame::GetNext( *pView, i_pBasicIDE ); 750cdf0e10cSrcweir } 751cdf0e10cSrcweir return pView; 752cdf0e10cSrcweir } 753cdf0e10cSrcweir Reference< XFrame > lcl_findStartModuleFrame( const ::comphelper::ComponentContext& i_rContext ) 754cdf0e10cSrcweir { 755cdf0e10cSrcweir try 756cdf0e10cSrcweir { 757cdf0e10cSrcweir Reference < XFramesSupplier > xSupplier( i_rContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); 758cdf0e10cSrcweir Reference < XIndexAccess > xContainer( xSupplier->getFrames(), UNO_QUERY_THROW ); 759cdf0e10cSrcweir 760cdf0e10cSrcweir Reference< XModuleManager > xCheck( i_rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); 761cdf0e10cSrcweir 762cdf0e10cSrcweir sal_Int32 nCount = xContainer->getCount(); 763cdf0e10cSrcweir for ( sal_Int32 i=0; i<nCount; ++i ) 764cdf0e10cSrcweir { 765cdf0e10cSrcweir try 766cdf0e10cSrcweir { 767cdf0e10cSrcweir Reference < XFrame > xFrame( xContainer->getByIndex(i), UNO_QUERY_THROW ); 768cdf0e10cSrcweir ::rtl::OUString sModule = xCheck->identify( xFrame ); 769cdf0e10cSrcweir if ( sModule.equalsAscii( "com.sun.star.frame.StartModule" ) ) 770cdf0e10cSrcweir return xFrame; 771cdf0e10cSrcweir } 772cdf0e10cSrcweir catch( const UnknownModuleException& ) 773cdf0e10cSrcweir { 774cdf0e10cSrcweir // silence 775cdf0e10cSrcweir } 776cdf0e10cSrcweir catch(const Exception&) 777cdf0e10cSrcweir { 778cdf0e10cSrcweir // re-throw, caught below 779cdf0e10cSrcweir throw; 780cdf0e10cSrcweir } 781cdf0e10cSrcweir } 782cdf0e10cSrcweir } 783cdf0e10cSrcweir catch( const Exception& ) 784cdf0e10cSrcweir { 785cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 786cdf0e10cSrcweir } 787cdf0e10cSrcweir return NULL; 788cdf0e10cSrcweir } 789cdf0e10cSrcweir } 790cdf0e10cSrcweir 791cdf0e10cSrcweir static ::rtl::OUString getConfigurationStringValue( 792cdf0e10cSrcweir const ::rtl::OUString& rPackage, 793cdf0e10cSrcweir const ::rtl::OUString& rRelPath, 794cdf0e10cSrcweir const ::rtl::OUString& rKey, 795cdf0e10cSrcweir const ::rtl::OUString& rDefaultValue ) 796cdf0e10cSrcweir { 797cdf0e10cSrcweir ::rtl::OUString aDefVal( rDefaultValue ); 798cdf0e10cSrcweir 799cdf0e10cSrcweir try 800cdf0e10cSrcweir { 801cdf0e10cSrcweir ::comphelper::ConfigurationHelper::readDirectKey( 802cdf0e10cSrcweir comphelper::getProcessServiceFactory(), 803cdf0e10cSrcweir rPackage, 804cdf0e10cSrcweir rRelPath, 805cdf0e10cSrcweir rKey, 806cdf0e10cSrcweir ::comphelper::ConfigurationHelper::E_READONLY) >>= aDefVal; 807cdf0e10cSrcweir } 808cdf0e10cSrcweir catch(const com::sun::star::uno::RuntimeException& exRun) 809cdf0e10cSrcweir { throw exRun; } 810cdf0e10cSrcweir catch(const com::sun::star::uno::Exception&) 811cdf0e10cSrcweir {} 812cdf0e10cSrcweir 813cdf0e10cSrcweir return aDefVal; 814cdf0e10cSrcweir } 815cdf0e10cSrcweir 816cdf0e10cSrcweir void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) 817cdf0e10cSrcweir { 818cdf0e10cSrcweir DBG_MEMTEST(); 819cdf0e10cSrcweir switch ( rReq.GetSlot() ) 820cdf0e10cSrcweir { 821cdf0e10cSrcweir case SID_OPTIONS_TREEDIALOG: 822cdf0e10cSrcweir { 823cdf0e10cSrcweir String sPageURL; 824cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, SID_OPTIONS_PAGEURL, sal_False ); 825cdf0e10cSrcweir if ( pURLItem ) 826cdf0e10cSrcweir sPageURL = pURLItem->GetValue(); 827cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetInternalArgs_Impl(); 828cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 829cdf0e10cSrcweir Reference < XFrame > xFrame; 830cdf0e10cSrcweir if ( pArgs && pArgs->GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET ) 831cdf0e10cSrcweir { 832cdf0e10cSrcweir OSL_ENSURE( pItem->ISA( SfxUnoFrameItem ), "SfxApplication::OfaExec_Impl: XFrames are to be transported via SfxUnoFrameItem by now!" ); 833cdf0e10cSrcweir xFrame = static_cast< const SfxUnoFrameItem*>( pItem )->GetFrame(); 834cdf0e10cSrcweir } 835cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 836cdf0e10cSrcweir if ( pFact ) 837cdf0e10cSrcweir { 838cdf0e10cSrcweir VclAbstractDialog* pDlg = 839cdf0e10cSrcweir pFact->CreateFrameDialog( NULL, xFrame, rReq.GetSlot(), sPageURL ); 840cdf0e10cSrcweir pDlg->Execute(); 841cdf0e10cSrcweir delete pDlg; 842cdf0e10cSrcweir SfxViewFrame* pView = SfxViewFrame::GetFirst(); 843cdf0e10cSrcweir while ( pView ) 844cdf0e10cSrcweir { 845cdf0e10cSrcweir pView->GetBindings().InvalidateAll(sal_False); 846cdf0e10cSrcweir pView = SfxViewFrame::GetNext( *pView ); 847cdf0e10cSrcweir } 848cdf0e10cSrcweir } 849cdf0e10cSrcweir break; 850cdf0e10cSrcweir } 851cdf0e10cSrcweir 852cdf0e10cSrcweir case SID_MORE_DICTIONARIES: 853cdf0e10cSrcweir { 854cdf0e10cSrcweir try 855cdf0e10cSrcweir { 856cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > xSMGR = 857cdf0e10cSrcweir ::comphelper::getProcessServiceFactory(); 858cdf0e10cSrcweir uno::Reference< css::system::XSystemShellExecute > xSystemShell( 859cdf0e10cSrcweir xSMGR->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute" ) ), 860cdf0e10cSrcweir uno::UNO_QUERY_THROW ); 861cdf0e10cSrcweir 862cdf0e10cSrcweir // read repository URL from configuration 863cdf0e10cSrcweir ::rtl::OUString sTemplRepoURL = 864cdf0e10cSrcweir getConfigurationStringValue( 865cdf0e10cSrcweir ::rtl::OUString::createFromAscii("org.openoffice.Office.Common"), 866cdf0e10cSrcweir ::rtl::OUString::createFromAscii("Dictionaries"), 867cdf0e10cSrcweir ::rtl::OUString::createFromAscii("RepositoryURL"), 868cdf0e10cSrcweir ::rtl::OUString()); 869cdf0e10cSrcweir 870cdf0e10cSrcweir if ( xSystemShell.is() && sTemplRepoURL.getLength() > 0 ) 871cdf0e10cSrcweir { 872cdf0e10cSrcweir ::rtl::OUStringBuffer aURLBuf( sTemplRepoURL ); 873cdf0e10cSrcweir aURLBuf.appendAscii( "?" ); 874cdf0e10cSrcweir aURLBuf.appendAscii( "lang=" ); 875cdf0e10cSrcweir 876cdf0e10cSrcweir // read locale from configuration 877cdf0e10cSrcweir ::rtl::OUString sLocale = getConfigurationStringValue( 878cdf0e10cSrcweir ::rtl::OUString::createFromAscii("org.openoffice.Setup"), 879cdf0e10cSrcweir ::rtl::OUString::createFromAscii("L10N"), 880cdf0e10cSrcweir ::rtl::OUString::createFromAscii("ooLocale"), 881cdf0e10cSrcweir ::rtl::OUString::createFromAscii("en-US")); 882cdf0e10cSrcweir 883cdf0e10cSrcweir aURLBuf.append( sLocale ); 884cdf0e10cSrcweir xSystemShell->execute( 885cdf0e10cSrcweir aURLBuf.makeStringAndClear(), 886cdf0e10cSrcweir ::rtl::OUString(), 887cdf0e10cSrcweir css::system::SystemShellExecuteFlags::DEFAULTS ); 888cdf0e10cSrcweir } 889cdf0e10cSrcweir } 890cdf0e10cSrcweir catch( const ::com::sun::star::uno::Exception& ) 891cdf0e10cSrcweir { 892cdf0e10cSrcweir DBG_ERRORFILE( "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES): caught an exception!" ); 893cdf0e10cSrcweir } 894cdf0e10cSrcweir break; 895cdf0e10cSrcweir } 896cdf0e10cSrcweir 897cdf0e10cSrcweir case SID_ONLINE_REGISTRATION: 898cdf0e10cSrcweir { 899cdf0e10cSrcweir try 900cdf0e10cSrcweir { 901cdf0e10cSrcweir // create the ProductRegistration component 902cdf0e10cSrcweir Reference< com::sun::star::lang::XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() ); 903cdf0e10cSrcweir Reference< com::sun::star::task::XJobExecutor > xProductRegistration; 904cdf0e10cSrcweir if ( xORB.is() ) 905cdf0e10cSrcweir xProductRegistration = xProductRegistration.query( xORB->createInstance( getProductRegistrationServiceName() ) ); 906cdf0e10cSrcweir DBG_ASSERT( xProductRegistration.is(), "OfficeApplication::ExecuteApp_Impl: could not create the service!" ); 907cdf0e10cSrcweir 908cdf0e10cSrcweir // tell it that the user wants to register 909cdf0e10cSrcweir if ( xProductRegistration.is() ) 910cdf0e10cSrcweir { 911cdf0e10cSrcweir xProductRegistration->trigger( ::rtl::OUString::createFromAscii( "RegistrationRequired" ) ); 912cdf0e10cSrcweir } 913cdf0e10cSrcweir } 914cdf0e10cSrcweir catch( const ::com::sun::star::uno::Exception& ) 915cdf0e10cSrcweir { 916cdf0e10cSrcweir DBG_ERROR( "OfficeApplication::ExecuteApp_Impl(SID_ONLINE_REGISTRATION): caught an exception!" ); 917cdf0e10cSrcweir } 918cdf0e10cSrcweir } 919cdf0e10cSrcweir break; 920cdf0e10cSrcweir 921cdf0e10cSrcweir case SID_BASICIDE_APPEAR: 922cdf0e10cSrcweir { 923cdf0e10cSrcweir SfxViewFrame* pView = lcl_getBasicIDEViewFrame( NULL ); 924cdf0e10cSrcweir if ( !pView ) 925cdf0e10cSrcweir { 926cdf0e10cSrcweir SfxObjectShell* pBasicIDE = SfxObjectShell::CreateObject( lcl_getBasicIDEServiceName() ); 927cdf0e10cSrcweir pBasicIDE->DoInitNew( 0 ); 928cdf0e10cSrcweir pBasicIDE->SetModified( sal_False ); 929cdf0e10cSrcweir try 930cdf0e10cSrcweir { 931cdf0e10cSrcweir // load the Basic IDE via direct access to the SFX frame loader. A generic loadComponentFromURL 932cdf0e10cSrcweir // (which could be done via SfxViewFrame::LoadDocumentIntoFrame) is not feasible here, since the Basic IDE 933cdf0e10cSrcweir // does not really play nice with the framework's concept. For instance, it is a "singleton document", 934cdf0e10cSrcweir // which conflicts, at the latest, with the framework's concept of loading into _blank frames. 935cdf0e10cSrcweir // So, since we know that our frame loader can handle it, we skip the generic framework loader 936cdf0e10cSrcweir // mechanism, and the type detection (which doesn't know about the Basic IDE). 937cdf0e10cSrcweir ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); 938cdf0e10cSrcweir Reference< XSynchronousFrameLoader > xLoader( aContext.createComponent( 939cdf0e10cSrcweir SfxFrameLoader_Impl::impl_getStaticImplementationName() ), UNO_QUERY_THROW ); 940cdf0e10cSrcweir ::comphelper::NamedValueCollection aLoadArgs; 941cdf0e10cSrcweir aLoadArgs.put( "Model", pBasicIDE->GetModel() ); 942cdf0e10cSrcweir aLoadArgs.put( "URL", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:factory/sbasic" ) ) ); 943cdf0e10cSrcweir 944cdf0e10cSrcweir Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( aContext ) ); 945cdf0e10cSrcweir if ( !xTargetFrame.is() ) 946cdf0e10cSrcweir xTargetFrame = SfxFrame::CreateBlankFrame(); 947cdf0e10cSrcweir ENSURE_OR_THROW( xTargetFrame.is(), "could not obtain a frameto load the Basic IDE into!" ); 948cdf0e10cSrcweir 949cdf0e10cSrcweir xLoader->load( aLoadArgs.getPropertyValues(), xTargetFrame ); 950cdf0e10cSrcweir } 951cdf0e10cSrcweir catch( const Exception& ) 952cdf0e10cSrcweir { 953cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 954cdf0e10cSrcweir } 955cdf0e10cSrcweir 956cdf0e10cSrcweir pView = lcl_getBasicIDEViewFrame( pBasicIDE ); 957cdf0e10cSrcweir if ( pView ) 958cdf0e10cSrcweir pView->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC:1" ) ) ); 959cdf0e10cSrcweir } 960cdf0e10cSrcweir 961cdf0e10cSrcweir if ( pView ) 962cdf0e10cSrcweir pView->GetFrame().Appear(); 963cdf0e10cSrcweir 964cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 965cdf0e10cSrcweir if ( pArgs && pView ) 966cdf0e10cSrcweir { 967cdf0e10cSrcweir SfxViewShell* pViewShell = pView->GetViewShell(); 968cdf0e10cSrcweir SfxObjectShell* pObjShell = pView->GetObjectShell(); 969cdf0e10cSrcweir if ( pViewShell && pObjShell ) 970cdf0e10cSrcweir { 971cdf0e10cSrcweir SfxRequest aReq( SID_BASICIDE_SHOWWINDOW, SFX_CALLMODE_SYNCHRON, pObjShell->GetPool() ); 972cdf0e10cSrcweir aReq.SetArgs( *pArgs ); 973cdf0e10cSrcweir pViewShell->ExecuteSlot( aReq ); 974cdf0e10cSrcweir } 975cdf0e10cSrcweir } 976cdf0e10cSrcweir 977cdf0e10cSrcweir rReq.Done(); 978cdf0e10cSrcweir } 979cdf0e10cSrcweir break; 980cdf0e10cSrcweir 981cdf0e10cSrcweir case SID_BASICCHOOSER: 982cdf0e10cSrcweir { 983cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 984cdf0e10cSrcweir const SfxPoolItem* pItem; 985cdf0e10cSrcweir sal_Bool bChooseOnly = sal_False; 986cdf0e10cSrcweir Reference< XModel > xLimitToModel; 987cdf0e10cSrcweir if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_RECORDMACRO, sal_False, &pItem) ) 988cdf0e10cSrcweir { 989cdf0e10cSrcweir sal_Bool bRecord = ((SfxBoolItem*)pItem)->GetValue(); 990cdf0e10cSrcweir if ( bRecord ) 991cdf0e10cSrcweir { 992cdf0e10cSrcweir // !Hack 993cdf0e10cSrcweir bChooseOnly = sal_False; 994cdf0e10cSrcweir SfxObjectShell* pCurrentShell = SfxObjectShell::Current(); 995cdf0e10cSrcweir OSL_ENSURE( pCurrentShell, "macro recording outside an SFX document?" ); 996cdf0e10cSrcweir if ( pCurrentShell ) 997cdf0e10cSrcweir xLimitToModel = pCurrentShell->GetModel(); 998cdf0e10cSrcweir } 999cdf0e10cSrcweir } 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir rReq.SetReturnValue( SfxStringItem( rReq.GetSlot(), ChooseMacro( xLimitToModel, bChooseOnly ) ) ); 1002cdf0e10cSrcweir rReq.Done(); 1003cdf0e10cSrcweir } 1004cdf0e10cSrcweir break; 1005cdf0e10cSrcweir 1006cdf0e10cSrcweir case SID_MACROORGANIZER: 1007cdf0e10cSrcweir { 1008cdf0e10cSrcweir OSL_TRACE("handling SID_MACROORGANIZER"); 1009cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 1010cdf0e10cSrcweir const SfxPoolItem* pItem; 1011cdf0e10cSrcweir sal_Int16 nTabId = 0; 1012cdf0e10cSrcweir if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_MACROORGANIZER, sal_False, &pItem) ) 1013cdf0e10cSrcweir { 1014cdf0e10cSrcweir nTabId = ((SfxUInt16Item*)pItem)->GetValue(); 1015cdf0e10cSrcweir } 1016cdf0e10cSrcweir 1017cdf0e10cSrcweir SfxApplication::MacroOrganizer( nTabId ); 1018cdf0e10cSrcweir rReq.Done(); 1019cdf0e10cSrcweir } 1020cdf0e10cSrcweir break; 1021cdf0e10cSrcweir 1022cdf0e10cSrcweir case SID_RUNMACRO: 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 1025cdf0e10cSrcweir OSL_TRACE("SfxApplication::OfaExec_Impl: case ScriptOrg"); 1026cdf0e10cSrcweir 1027cdf0e10cSrcweir Reference< XFrame > xFrame; 1028cdf0e10cSrcweir const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl(); 1029cdf0e10cSrcweir SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False ); 1030cdf0e10cSrcweir if ( pFrameItem ) 1031cdf0e10cSrcweir xFrame = pFrameItem->GetFrame(); 1032cdf0e10cSrcweir 1033cdf0e10cSrcweir if ( !xFrame.is() ) 1034cdf0e10cSrcweir { 1035cdf0e10cSrcweir const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); 1036cdf0e10cSrcweir if ( pViewFrame ) 1037cdf0e10cSrcweir xFrame = pViewFrame->GetFrame().GetFrameInterface(); 1038cdf0e10cSrcweir } 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir do // artificial loop for flow control 1041cdf0e10cSrcweir { 1042cdf0e10cSrcweir AbstractScriptSelectorDialog* pDlg = pFact->CreateScriptSelectorDialog( 1043cdf0e10cSrcweir lcl_getDialogParent( xFrame, GetTopWindow() ), sal_False, xFrame ); 1044cdf0e10cSrcweir OSL_ENSURE( pDlg, "SfxApplication::OfaExec_Impl( SID_RUNMACRO ): no dialog!" ); 1045cdf0e10cSrcweir if ( !pDlg ) 1046cdf0e10cSrcweir break; 1047cdf0e10cSrcweir pDlg->SetRunLabel(); 1048cdf0e10cSrcweir 1049cdf0e10cSrcweir short nDialogResult = pDlg->Execute(); 1050cdf0e10cSrcweir if ( !nDialogResult ) 1051cdf0e10cSrcweir break; 1052cdf0e10cSrcweir 1053cdf0e10cSrcweir Sequence< Any > args; 1054cdf0e10cSrcweir Sequence< sal_Int16 > outIndex; 1055cdf0e10cSrcweir Sequence< Any > outArgs; 1056cdf0e10cSrcweir Any ret; 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir Reference< XInterface > xScriptContext; 1059cdf0e10cSrcweir 1060cdf0e10cSrcweir Reference< XController > xController; 1061cdf0e10cSrcweir if ( xFrame.is() ) 1062cdf0e10cSrcweir xController = xFrame->getController(); 1063cdf0e10cSrcweir if ( xController.is() ) 1064cdf0e10cSrcweir xScriptContext = xController->getModel(); 1065cdf0e10cSrcweir if ( !xScriptContext.is() ) 1066cdf0e10cSrcweir xScriptContext = xController; 1067cdf0e10cSrcweir 1068cdf0e10cSrcweir SfxObjectShell::CallXScript( xScriptContext, pDlg->GetScriptURL(), args, ret, outIndex, outArgs ); 1069cdf0e10cSrcweir } 1070cdf0e10cSrcweir while ( false ); 1071cdf0e10cSrcweir rReq.Done(); 1072cdf0e10cSrcweir } 1073cdf0e10cSrcweir break; 1074cdf0e10cSrcweir 1075cdf0e10cSrcweir case SID_SCRIPTORGANIZER: 1076cdf0e10cSrcweir { 1077cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 1078cdf0e10cSrcweir OSL_TRACE("SfxApplication::OfaExec_Impl: case ScriptOrg"); 1079cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 1080cdf0e10cSrcweir const SfxPoolItem* pItem; 1081cdf0e10cSrcweir String aLanguage; 1082cdf0e10cSrcweir if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_SCRIPTORGANIZER, sal_False, &pItem) ) 1083cdf0e10cSrcweir { 1084cdf0e10cSrcweir aLanguage = ((SfxScriptOrganizerItem*)pItem)->getLanguage(); 1085cdf0e10cSrcweir } 1086cdf0e10cSrcweir 1087cdf0e10cSrcweir ::rtl::OUString aLang( aLanguage ); 1088cdf0e10cSrcweir OSL_TRACE("SfxApplication::OfaExec_Impl: about to create dialog for: %s", ::rtl::OUStringToOString( aLang , RTL_TEXTENCODING_ASCII_US ).pData->buffer); 1089cdf0e10cSrcweir // not sure about the Window* 1090cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateSvxScriptOrgDialog( GetTopWindow(), aLanguage ); 1091cdf0e10cSrcweir if( pDlg ) 1092cdf0e10cSrcweir { 1093cdf0e10cSrcweir pDlg->Execute(); 1094cdf0e10cSrcweir } 1095cdf0e10cSrcweir else 1096cdf0e10cSrcweir { 1097cdf0e10cSrcweir OSL_TRACE("no dialog!!!"); 1098cdf0e10cSrcweir } 1099cdf0e10cSrcweir rReq.Done(); 1100cdf0e10cSrcweir } 1101cdf0e10cSrcweir break; 1102cdf0e10cSrcweir 1103cdf0e10cSrcweir case SID_OFFICE_CHECK_PLZ: 1104cdf0e10cSrcweir { 1105cdf0e10cSrcweir sal_Bool bRet = sal_False; 1106cdf0e10cSrcweir SFX_REQUEST_ARG(rReq, pStringItem, SfxStringItem, rReq.GetSlot(), sal_False); 1107cdf0e10cSrcweir 1108cdf0e10cSrcweir if ( pStringItem ) 1109cdf0e10cSrcweir { 1110cdf0e10cSrcweir String aPLZ = pStringItem->GetValue(); 1111cdf0e10cSrcweir bRet = sal_True /*!!!SfxIniManager::CheckPLZ( aPLZ )*/; 1112cdf0e10cSrcweir } 1113cdf0e10cSrcweir else 1114cdf0e10cSrcweir SbxBase::SetError( SbxERR_WRONG_ARGS ); 1115cdf0e10cSrcweir rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bRet ) ); 1116cdf0e10cSrcweir } 1117cdf0e10cSrcweir break; 1118cdf0e10cSrcweir 1119cdf0e10cSrcweir case SID_AUTO_CORRECT_DLG: 1120cdf0e10cSrcweir { 1121cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 1122cdf0e10cSrcweir if ( pFact ) 1123cdf0e10cSrcweir { 1124cdf0e10cSrcweir SfxItemSet aSet(GetPool(), SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG); 1125cdf0e10cSrcweir const SfxPoolItem* pItem=NULL; 1126cdf0e10cSrcweir const SfxItemSet* pSet = rReq.GetArgs(); 1127cdf0e10cSrcweir SfxItemPool* pSetPool = pSet ? pSet->GetPool() : NULL; 1128cdf0e10cSrcweir if ( pSet && pSet->GetItemState( pSetPool->GetWhich( SID_AUTO_CORRECT_DLG ), sal_False, &pItem ) == SFX_ITEM_SET ) 1129cdf0e10cSrcweir aSet.Put( *pItem ); 1130cdf0e10cSrcweir 1131cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_OFA_AUTOCORR_DLG, NULL, &aSet, NULL ); 1132cdf0e10cSrcweir pDlg->Execute(); 1133cdf0e10cSrcweir delete pDlg; 1134cdf0e10cSrcweir } 1135cdf0e10cSrcweir 1136cdf0e10cSrcweir break; 1137cdf0e10cSrcweir } 1138cdf0e10cSrcweir 1139cdf0e10cSrcweir case SID_SD_AUTOPILOT : 1140cdf0e10cSrcweir case SID_NEWSD : 1141cdf0e10cSrcweir { 1142cdf0e10cSrcweir SvtModuleOptions aModuleOpt; 1143cdf0e10cSrcweir if ( !aModuleOpt.IsImpress() ) 1144cdf0e10cSrcweir { 1145cdf0e10cSrcweir ErrorBox( 0, ResId( RID_ERRBOX_MODULENOTINSTALLED, *GetOffResManager_Impl() )).Execute(); 1146cdf0e10cSrcweir return; 1147cdf0e10cSrcweir } 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); 1150cdf0e10cSrcweir Reference< com::sun::star::frame::XDispatchProvider > xProv( 1151cdf0e10cSrcweir xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY ); 1152cdf0e10cSrcweir 1153cdf0e10cSrcweir if ( xProv.is() ) 1154cdf0e10cSrcweir { 1155cdf0e10cSrcweir ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() ); 1156cdf0e10cSrcweir Reference< com::sun::star::frame::XDispatchHelper > xHelper( 1157cdf0e10cSrcweir xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY ); 1158cdf0e10cSrcweir if ( xHelper.is() ) 1159cdf0e10cSrcweir { 1160cdf0e10cSrcweir Sequence < com::sun::star::beans::PropertyValue > aSeq; 1161cdf0e10cSrcweir if ( rReq.GetArgs() ) 1162cdf0e10cSrcweir TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq ); 1163cdf0e10cSrcweir Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq ); 1164cdf0e10cSrcweir ::com::sun::star::frame::DispatchResultEvent aEvent; 1165cdf0e10cSrcweir sal_Bool bSuccess = ( 1166cdf0e10cSrcweir (aResult >>= aEvent) && 1167cdf0e10cSrcweir (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS) 1168cdf0e10cSrcweir ); 1169cdf0e10cSrcweir rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) ); 1170cdf0e10cSrcweir } 1171cdf0e10cSrcweir } 1172cdf0e10cSrcweir } 1173cdf0e10cSrcweir break; 1174cdf0e10cSrcweir 1175cdf0e10cSrcweir case FN_LABEL : 1176cdf0e10cSrcweir case FN_BUSINESS_CARD : 1177cdf0e10cSrcweir case FN_XFORMS_INIT : 1178cdf0e10cSrcweir { 1179cdf0e10cSrcweir Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); 1180cdf0e10cSrcweir Reference< com::sun::star::frame::XDispatchProvider > xProv( 1181cdf0e10cSrcweir xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.text.ModuleDispatcher")), UNO_QUERY ); 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir if ( xProv.is() ) 1184cdf0e10cSrcweir { 1185cdf0e10cSrcweir ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() ); 1186cdf0e10cSrcweir Reference< com::sun::star::frame::XDispatchHelper > xHelper( 1187cdf0e10cSrcweir xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY ); 1188cdf0e10cSrcweir if ( xHelper.is() ) 1189cdf0e10cSrcweir { 1190cdf0e10cSrcweir Sequence < com::sun::star::beans::PropertyValue > aSeq; 1191cdf0e10cSrcweir if ( rReq.GetArgs() ) 1192cdf0e10cSrcweir TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq ); 1193cdf0e10cSrcweir Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq ); 1194cdf0e10cSrcweir ::com::sun::star::frame::DispatchResultEvent aEvent; 1195cdf0e10cSrcweir sal_Bool bSuccess = ( 1196cdf0e10cSrcweir (aResult >>= aEvent) && 1197cdf0e10cSrcweir (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS) 1198cdf0e10cSrcweir ); 1199cdf0e10cSrcweir rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) ); 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir } 1202cdf0e10cSrcweir } 1203cdf0e10cSrcweir break; 1204cdf0e10cSrcweir 1205cdf0e10cSrcweir case SID_ADDRESS_DATA_SOURCE: 1206cdf0e10cSrcweir { 1207cdf0e10cSrcweir ::rtl::OUString sDialogServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.AddressBookSourcePilot" ) ); 1208cdf0e10cSrcweir try 1209cdf0e10cSrcweir { 1210cdf0e10cSrcweir Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); 1211cdf0e10cSrcweir Reference< com::sun::star::ui::dialogs::XExecutableDialog > xDialog; 1212cdf0e10cSrcweir if (xORB.is()) 1213cdf0e10cSrcweir xDialog = Reference< com::sun::star::ui::dialogs::XExecutableDialog >(xORB->createInstance(sDialogServiceName), UNO_QUERY); 1214cdf0e10cSrcweir if (xDialog.is()) 1215cdf0e10cSrcweir xDialog->execute(); 1216cdf0e10cSrcweir else 1217cdf0e10cSrcweir ShowServiceNotAvailableError(NULL, sDialogServiceName, sal_True); 1218cdf0e10cSrcweir } 1219cdf0e10cSrcweir catch(::com::sun::star::uno::Exception&) 1220cdf0e10cSrcweir { 1221cdf0e10cSrcweir } 1222cdf0e10cSrcweir } 1223cdf0e10cSrcweir break; 1224cdf0e10cSrcweir 1225cdf0e10cSrcweir case SID_COMP_BIBLIOGRAPHY: 1226cdf0e10cSrcweir { 1227cdf0e10cSrcweir SfxStringItem aURL(SID_FILE_NAME, String::CreateFromAscii(".component:Bibliography/View1")); 1228cdf0e10cSrcweir SfxStringItem aRef(SID_REFERER, String::CreateFromAscii("private:user")); 1229cdf0e10cSrcweir SfxStringItem aTarget(SID_TARGETNAME, String::CreateFromAscii("_blank")); 1230cdf0e10cSrcweir SfxViewFrame::Current()->GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, &aURL, &aRef, &aTarget, 0L); 1231cdf0e10cSrcweir } 1232cdf0e10cSrcweir break; 1233cdf0e10cSrcweir } 1234cdf0e10cSrcweir } 1235cdf0e10cSrcweir 1236cdf0e10cSrcweir void SfxApplication::OfaState_Impl(SfxItemSet &rSet) 1237cdf0e10cSrcweir { 1238cdf0e10cSrcweir const sal_uInt16 *pRanges = rSet.GetRanges(); 1239cdf0e10cSrcweir DBG_ASSERT(pRanges && *pRanges, "Set ohne Bereich"); 1240cdf0e10cSrcweir while ( *pRanges ) 1241cdf0e10cSrcweir { 1242cdf0e10cSrcweir for(sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich) 1243cdf0e10cSrcweir { 1244cdf0e10cSrcweir switch(nWhich) 1245cdf0e10cSrcweir { 1246cdf0e10cSrcweir case SID_ONLINE_REGISTRATION: 1247cdf0e10cSrcweir { 1248cdf0e10cSrcweir ::utl::RegOptions aOptions; 1249cdf0e10cSrcweir if ( !aOptions.allowMenu() ) 1250cdf0e10cSrcweir rSet.DisableItem( SID_ONLINE_REGISTRATION ); 1251cdf0e10cSrcweir } 1252cdf0e10cSrcweir break; 1253cdf0e10cSrcweir } 1254cdf0e10cSrcweir } 1255cdf0e10cSrcweir } 1256cdf0e10cSrcweir 1257cdf0e10cSrcweir SvtModuleOptions aModuleOpt; 1258cdf0e10cSrcweir 1259cdf0e10cSrcweir if( !aModuleOpt.IsWriter()) 1260cdf0e10cSrcweir { 1261cdf0e10cSrcweir rSet.DisableItem( FN_LABEL ); 1262cdf0e10cSrcweir rSet.DisableItem( FN_BUSINESS_CARD ); 1263cdf0e10cSrcweir rSet.DisableItem( FN_XFORMS_INIT ); 1264cdf0e10cSrcweir } 1265cdf0e10cSrcweir 1266cdf0e10cSrcweir if ( !aModuleOpt.IsImpress() ) 1267cdf0e10cSrcweir rSet.DisableItem( SID_SD_AUTOPILOT ); 1268cdf0e10cSrcweir } 1269