merge the formfield patch from ooo-build
[ooovba.git] / sfx2 / source / appl / appserv.cxx
blobb51117097070bb8509c788d44a32c2e78b3fb7d0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: appserv.cxx,v $
10 * $Revision: 1.78 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sfx2.hxx"
33 #include <com/sun/star/uno/Reference.hxx>
34 #ifndef _COM_SUN_STAR_LANG_XMultiServiceFactory_HPP_
35 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 #endif
37 #include <com/sun/star/lang/IllegalArgumentException.hpp>
38 #include <com/sun/star/frame/DispatchResultEvent.hpp>
39 #include <com/sun/star/frame/DispatchResultState.hpp>
40 #include <com/sun/star/task/XJobExecutor.hpp>
41 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
42 #include <com/sun/star/frame/XDesktop.hpp>
43 #include <com/sun/star/frame/XDispatchHelper.hpp>
44 #include <com/sun/star/frame/XFramesSupplier.hpp>
45 #include <com/sun/star/util/XCloseable.hpp>
46 #ifndef _COM_SUN_STAR_UTIL_CloseVetoException_HPP_
47 #include <com/sun/star/util/CloseVetoException.hpp>
48 #endif
49 #include <com/sun/star/frame/XLayoutManager.hpp>
50 #include <com/sun/star/document/XEmbeddedScripts.hpp>
51 #include <com/sun/star/embed/XStorage.hpp>
52 #include <com/sun/star/embed/ElementModes.hpp>
53 #include <com/sun/star/system/XSystemShellExecute.hpp>
54 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
55 #include <com/sun/star/system/SystemShellExecuteException.hpp>
57 #ifndef _UNOTOOLS_PROCESSFACTORY_HXX
58 #include <comphelper/processfactory.hxx>
59 #endif
60 #include <comphelper/storagehelper.hxx>
62 #ifndef _SVT_DOC_ADDRESSTEMPLATE_HXX_
63 #include <svtools/addresstemplate.hxx>
64 #endif
65 #include <svtools/visitem.hxx>
66 #include <unotools/intlwrapper.hxx>
68 #ifndef _UNOTOOLS_CONFIGMGR_HXX_
69 #include <unotools/configmgr.hxx>
70 #endif
71 #include <tools/config.hxx>
72 #include <tools/diagnose_ex.h>
73 #include <vcl/msgbox.hxx>
74 #include <com/sun/star/system/XSystemShellExecute.hpp>
75 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
76 #include <svtools/cancel.hxx>
77 #include <svtools/intitem.hxx>
78 #include <svtools/eitem.hxx>
79 #include <svtools/stritem.hxx>
80 #include <basic/sbstar.hxx>
81 #include <basic/basmgr.hxx>
82 #include <basic/basrdll.hxx>
83 #include <svtools/sfxecode.hxx>
84 #include <svtools/ehdl.hxx>
85 #include <vcl/help.hxx>
86 #include <vcl/stdtext.hxx>
87 #include <rtl/ustrbuf.hxx>
89 #include <svtools/pathoptions.hxx>
90 #include <svtools/moduleoptions.hxx>
91 #include <svtools/regoptions.hxx>
92 #include <svtools/helpopt.hxx>
93 #include <svtools/miscopt.hxx>
94 #include <toolkit/helper/vclunohelper.hxx>
95 #include <tools/shl.hxx>
96 #include <unotools/bootstrap.hxx>
97 #include <vos/process.hxx>
98 #include <rtl/bootstrap.hxx>
99 #include <cppuhelper/exc_hlp.hxx>
101 #include <com/sun/star/script/provider/XScriptProviderFactory.hpp>
102 #include <com/sun/star/beans/XPropertySet.hpp>
104 #include "about.hxx"
105 #include "referers.hxx"
106 #include <sfx2/app.hxx>
107 #include <sfx2/request.hxx>
108 #include <sfx2/dispatch.hxx>
109 #include <sfx2/bindings.hxx>
110 #include <sfx2/msg.hxx>
111 #include <sfx2/objface.hxx>
112 #include <sfx2/objitem.hxx>
113 #include <sfx2/objsh.hxx>
114 #include <sfx2/hintpost.hxx>
115 #include <sfx2/viewsh.hxx>
116 #include <sfx2/docfac.hxx>
117 #include <sfx2/docfile.hxx>
118 #include <sfx2/docfilt.hxx>
119 #include "docvor.hxx"
120 #include <sfx2/new.hxx>
121 #include <sfx2/templdlg.hxx>
122 #include "sfxtypes.hxx"
123 #include "sfxbasic.hxx"
124 #include <sfx2/tabdlg.hxx>
125 #include "arrdecl.hxx"
126 #include "fltfnc.hxx"
127 #include <sfx2/sfx.hrc>
128 #include "app.hrc"
129 #include <sfx2/passwd.hxx>
130 #include "sfxresid.hxx"
131 #include "arrdecl.hxx"
132 #include <sfx2/childwin.hxx>
133 #include "appdata.hxx"
134 #include <sfx2/macrconf.hxx>
135 #include "minfitem.hxx"
136 #include <sfx2/event.hxx>
137 #include <sfx2/module.hxx>
138 #include <sfx2/topfrm.hxx>
139 #include "sfxpicklist.hxx"
140 #include "imestatuswindow.hxx"
141 #include <sfx2/sfxdlg.hxx>
142 #include <sfx2/dialogs.hrc>
143 #include "sorgitm.hxx"
144 #include "sfxhelp.hxx"
146 using namespace ::com::sun::star;
147 using namespace ::com::sun::star::beans;
148 using namespace ::com::sun::star::uno;
149 using namespace ::com::sun::star::frame;
150 using namespace ::com::sun::star::container;
151 using namespace ::com::sun::star::util;
152 using namespace ::com::sun::star::script;
153 using namespace ::com::sun::star::system;
154 using namespace ::com::sun::star::lang;
155 using namespace ::com::sun::star::document;
157 namespace css = com::sun::star;
159 //-------------------------------------------------------------------------
160 long QuitAgain_Impl( void* pObj, void* pArg )
162 SfxApplication* pApp = (SfxApplication*)pObj;
163 Timer* pTimer = (Timer*)pArg;
164 delete pTimer;
165 pApp->GetDispatcher_Impl()->Execute( SID_QUITAPP, SFX_CALLMODE_ASYNCHRON );
166 return 0;
169 void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
171 DBG_MEMTEST();
172 FASTBOOL bDone = FALSE;
173 switch ( rReq.GetSlot() )
175 case SID_SETOPTIONS:
177 if( rReq.GetArgs() )
178 SetOptions_Impl( *rReq.GetArgs() );
179 break;
182 case SID_QUITAPP:
183 case SID_EXITANDRETURN:
184 case SID_LOGOUT:
186 // protect against reentrant calls
187 if ( pAppData_Impl->bInQuit )
188 return;
190 if ( rReq.GetSlot() == SID_LOGOUT )
192 for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
193 pObjSh; pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
195 if ( !pObjSh->IsModified() )
196 continue;
198 SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjSh );
199 if ( !pFrame || !pFrame->GetWindow().IsReallyVisible() )
200 continue;
202 if ( pObjSh->PrepareClose(2) )
203 pObjSh->SetModified( FALSE );
204 else
205 return;
208 String aName = String::CreateFromAscii("vnd.sun.star.cmd:logout");
209 SfxStringItem aNameItem( SID_FILE_NAME, aName );
210 SfxStringItem aReferer( SID_REFERER, DEFINE_CONST_UNICODE( "private/user" ) );
211 pAppData_Impl->pAppDispat->Execute( SID_OPENDOC, SFX_CALLMODE_SLOT, &aNameItem, &aReferer, 0L );
212 return;
215 // aus verschachtelten Requests nach 100ms nochmal probieren
216 if( Application::GetDispatchLevel() > 1 )
218 /* Dont save the request for closing the application and try it later
219 again. This is an UI bound functionality ... and the user will try it again
220 if the dialog is closed. But we shouldnt close the application automaticly
221 if this dialog is closed by the user ...
222 So we ignore this request now and wait for a new user decision.
224 DBG_TRACE1( "QueryExit => FALSE (DispatchLevel == %u)", Application::GetDispatchLevel() );
225 return;
228 // block reentrant calls
229 pAppData_Impl->bInQuit = TRUE;
230 Reference < XDesktop > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
232 rReq.ForgetAllArgs();
234 // if terminate() failed, pAppData_Impl->bInQuit will now be FALSE, allowing further calls of SID_QUITAPP
235 BOOL bTerminated = xDesktop->terminate();
236 if (!bTerminated)
237 // if terminate() was successful, SfxApplication is now dead!
238 pAppData_Impl->bInQuit = FALSE;
240 // Returnwert setzten, ggf. terminieren
241 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bTerminated ) );
242 return;
245 case SID_CONFIG:
246 case SID_TOOLBOXOPTIONS:
247 case SID_CONFIGSTATUSBAR:
248 case SID_CONFIGMENU:
249 case SID_CONFIGACCEL:
250 case SID_CONFIGEVENT:
252 SfxAbstractDialogFactory* pFact =
253 SfxAbstractDialogFactory::Create();
255 if ( pFact )
257 SFX_REQUEST_ARG(rReq, pStringItem,
258 SfxStringItem, SID_CONFIG, sal_False);
260 SfxItemSet aSet(
261 GetPool(), SID_CONFIG, SID_CONFIG );
263 if ( pStringItem )
265 aSet.Put( SfxStringItem(
266 SID_CONFIG, pStringItem->GetValue() ) );
269 Reference< XFrame > xFrame;
270 const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl();
271 SFX_ITEMSET_ARG( pIntSet, pFrame, SfxUnoAnyItem, SID_FILLFRAME, FALSE );
272 if (pFrame)
273 pFrame->GetValue() >>= xFrame;
275 SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog(
276 RID_SVXDLG_CUSTOMIZE,
277 NULL, &aSet, xFrame );
279 if ( pDlg )
281 const short nRet = pDlg->Execute();
283 if ( nRet )
284 bDone = TRUE;
286 delete pDlg;
289 break;
292 case SID_CLOSEDOCS:
293 case SID_CLOSEWINS:
296 Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
297 Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY );
298 if ( !xTasks.is() )
299 break;
301 sal_Int32 n=0;
304 if ( xTasks->getCount() <= n )
305 break;
307 Any aAny = xTasks->getByIndex(n);
308 Reference < XCloseable > xTask;
309 aAny >>= xTask;
312 xTask->close(sal_True);
313 n++;
315 catch( CloseVetoException& )
319 while( sal_True );
321 BOOL bOk = ( n == 0);
322 rReq.SetReturnValue( SfxBoolItem( 0, bOk ) );
323 bDone = TRUE;
324 break;
327 case SID_SAVEDOCS:
329 BOOL bOK = TRUE;
330 BOOL bTmpDone = TRUE;
331 for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
332 pObjSh;
333 pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
335 SfxRequest aReq( SID_SAVEDOC, 0, pObjSh->GetPool() );
336 if ( pObjSh->IsModified() )
338 pObjSh->ExecuteSlot( aReq );
339 SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, aReq.GetReturnValue() );
340 bTmpDone = aReq.IsDone();
341 if ( !pItem || !pItem->GetValue() )
342 bOK = FALSE;
346 rReq.SetReturnValue( SfxBoolItem( 0, bOK ) );
347 rReq.Done();
348 break;
351 case SID_HELP_SUPPORTPAGE:
353 try {
354 Reference< com::sun::star::system::XSystemShellExecute > xSystemShell
355 ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute" ) ), UNO_QUERY );
356 if ( xSystemShell.is()) {
357 rtl::OUString aURI( DEFINE_CONST_UNICODE( "http://www.novell.com/support" ) );
358 xSystemShell->execute( aURI, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS );
361 break;
362 } catch (const ::com::sun::star::uno::Exception &) {
364 /* drop through on exception */
367 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
368 case SID_HELPINDEX:
370 Help* pHelp = Application::GetHelp();
371 if ( pHelp )
373 ULONG nHelpId = ( rReq.GetSlot() == SID_HELP_SUPPORTPAGE ) ? 66056 : 0;
374 if ( 66056 == nHelpId )
376 // show Support page with new URL
377 String sHelpURL = SfxHelp::CreateHelpURL( nHelpId, String() );
378 String sParams = sHelpURL.Copy( sHelpURL.Search( '?' ) );
379 sHelpURL = String::CreateFromAscii("vnd.sun.star.help://shared/text/shared/05/00000001.xhp");
380 sHelpURL += sParams;
381 sHelpURL += String::CreateFromAscii("&UseDB=no");
382 pHelp->Start( sHelpURL, NULL );
384 else
385 pHelp->Start( nHelpId, NULL ); // show start page
386 bDone = TRUE;
388 break;
391 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
392 case SID_HELPTIPS:
394 // Parameter aus werten
395 SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPTIPS, FALSE);
396 bool bOn = pOnItem
397 ? ((SfxBoolItem*)pOnItem)->GetValue()
398 : !Help::IsQuickHelpEnabled();
400 // ausf"uhren
401 if ( bOn )
402 Help::EnableQuickHelp();
403 else
404 Help::DisableQuickHelp();
405 SvtHelpOptions().SetHelpTips( bOn );
406 Invalidate(SID_HELPTIPS);
407 bDone = TRUE;
409 // ggf. recorden
410 if ( !rReq.IsAPI() )
411 rReq.AppendItem( SfxBoolItem( SID_HELPTIPS, bOn) );
412 break;
414 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
415 case SID_EXTENDEDHELP:
417 Help::StartExtHelp();
418 break;
420 case SID_HELPBALLOONS:
422 // Parameter auswerten
423 SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPBALLOONS, FALSE);
424 bool bOn = pOnItem
425 ? ((SfxBoolItem*)pOnItem)->GetValue()
426 : !Help::IsBalloonHelpEnabled();
428 // ausf"uhren
429 if ( bOn )
430 Help::EnableBalloonHelp();
431 else
432 Help::DisableBalloonHelp();
433 SvtHelpOptions().SetExtendedHelp( bOn );
434 Invalidate(SID_HELPBALLOONS);
435 bDone = TRUE;
437 // ggf. recorden
438 if ( !rReq.IsAPI() )
439 rReq.AppendItem( SfxBoolItem( SID_HELPBALLOONS, bOn) );
440 break;
443 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
444 case SID_HELP_PI:
446 SvtHelpOptions aHelpOpt;
447 SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELP_PI, FALSE);
448 sal_Bool bOn = pOnItem
449 ? ((SfxBoolItem*)pOnItem)->GetValue()
450 : !aHelpOpt.IsHelpAgentAutoStartMode();
451 aHelpOpt.SetHelpAgentAutoStartMode( bOn );
452 Invalidate(SID_HELP_PI);
453 bDone = TRUE;
454 break;
457 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
458 case SID_ABOUT:
460 const String sCWSSchema( String::CreateFromAscii( "[CWS:" ) );
461 rtl::OUString sDefault;
462 String sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) );
463 OSL_ENSURE( sBuildId.Len() > 0, "No BUILDID in bootstrap file" );
464 if ( sBuildId.Len() > 0 && sBuildId.Search( sCWSSchema ) == STRING_NOTFOUND )
466 // no cws part in brand buildid -> try basis buildid
467 rtl::OUString sBasisBuildId( DEFINE_CONST_OUSTRING(
468 "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) );
469 rtl::Bootstrap::expandMacros( sBasisBuildId );
470 sal_Int32 nIndex = sBasisBuildId.indexOf( sCWSSchema );
471 if ( nIndex != -1 )
472 sBuildId += String( sBasisBuildId.copy( nIndex ) );
475 String sProductSource( utl::Bootstrap::getProductSource( sDefault ) );
476 OSL_ENSURE( sProductSource.Len() > 0, "No ProductSource in bootstrap file" );
478 // the product source is something like "DEV300", where the
479 // build id is something like "300m12(Build:12345)". For better readability,
480 // strip the duplicate UPD ("300").
481 if ( sProductSource.Len() )
483 bool bMatchingUPD =
484 ( sProductSource.Len() >= 3 )
485 && ( sBuildId.Len() >= 3 )
486 && ( sProductSource.Copy( sProductSource.Len() - 3 ) == sBuildId.Copy( 0, 3 ) );
487 OSL_ENSURE( bMatchingUPD, "BUILDID and ProductSource do not match in their UPD" );
488 if ( bMatchingUPD )
489 sProductSource = sProductSource.Copy( 0, sProductSource.Len() - 3 );
491 // prepend the product source
492 sBuildId.Insert( sProductSource, 0 );
495 // --> PB 2008-10-30 #i94693#
496 /* if the build ids of the basis or ure layer are different from the build id
497 * of the brand layer then show them */
498 rtl::OUString aBasisProductBuildId( DEFINE_CONST_OUSTRING(
499 "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":ProductBuildid}" ) );
500 rtl::Bootstrap::expandMacros( aBasisProductBuildId );
501 rtl::OUString aUREProductBuildId( DEFINE_CONST_OUSTRING(
502 "${$URE_BIN_DIR/" SAL_CONFIGFILE("version") ":ProductBuildid}" ) );
503 rtl::Bootstrap::expandMacros( aUREProductBuildId );
504 if ( sBuildId.Search( String( aBasisProductBuildId ) ) == STRING_NOTFOUND
505 || sBuildId.Search( String( aUREProductBuildId ) ) == STRING_NOTFOUND )
507 String sTemp( '-' );
508 sTemp += String( aBasisProductBuildId );
509 sTemp += '-';
510 sTemp += String( aUREProductBuildId );
511 sBuildId.Insert( sTemp, sBuildId.Search( ')' ) );
513 // <--
515 // the build id format is "milestone(build)[cwsname]". For readability, it would
516 // be nice to have some more spaces in there.
517 xub_StrLen nPos = 0;
518 if ( ( nPos = sBuildId.Search( sal_Unicode( '(' ) ) ) != STRING_NOTFOUND )
519 sBuildId.Insert( sal_Unicode( ' ' ), nPos );
520 if ( ( nPos = sBuildId.Search( sal_Unicode( '[' ) ) ) != STRING_NOTFOUND )
521 sBuildId.Insert( sal_Unicode( ' ' ), nPos );
523 // search for the resource of the about box
524 ResId aDialogResId( RID_DEFAULTABOUT, *pAppData_Impl->pLabelResMgr );
525 ResMgr* pResMgr = pAppData_Impl->pLabelResMgr;
526 if( ! pResMgr->IsAvailable( aDialogResId.SetRT( RSC_MODALDIALOG ) ) )
527 pResMgr = GetOffResManager_Impl();
529 aDialogResId.SetResMgr( pResMgr );
530 if ( !pResMgr->IsAvailable( aDialogResId ) )
532 DBG_ERRORFILE( "No RID_DEFAULTABOUT in label-resource-dll" );
535 // then show the about box
536 AboutDialog* pDlg = new AboutDialog( 0, aDialogResId, sBuildId );
537 pDlg->Execute();
538 delete pDlg;
539 bDone = TRUE;
540 break;
543 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
544 case SID_ORGANIZER:
546 SfxTemplateOrganizeDlg *pDlg =
547 new SfxTemplateOrganizeDlg(NULL);
548 pDlg->Execute();
549 delete pDlg;
550 bDone = TRUE;
551 break;
554 case SID_TEMPLATE_ADDRESSBOKSOURCE:
556 svt::AddressBookSourceDialog aDialog(GetTopWindow(), ::comphelper::getProcessServiceFactory());
557 aDialog.Execute();
558 bDone = TRUE;
559 break;
562 case SID_BASICSTOP:
563 StarBASIC::Stop();
564 break;
566 case SID_BASICBREAK :
567 BASIC_DLL()->BasicBreak();
568 break;
570 case SID_CRASH :
572 GetpApp()->Exception( EXC_SYSTEM );
573 abort();
576 case SID_SHOW_IME_STATUS_WINDOW:
577 if (pAppData_Impl->m_xImeStatusWindow->canToggle())
579 SfxBoolItem const * pItem = static_cast< SfxBoolItem const * >(
580 rReq.GetArg(SID_SHOW_IME_STATUS_WINDOW, false,
581 TYPE(SfxBoolItem)));
582 bool bShow = pItem == 0
583 ? !pAppData_Impl->m_xImeStatusWindow->isShowing()
584 : ( pItem->GetValue() == TRUE );
585 pAppData_Impl->m_xImeStatusWindow->show(bShow);
586 if (pItem == 0)
587 rReq.AppendItem(SfxBoolItem(SID_SHOW_IME_STATUS_WINDOW,
588 bShow));
590 bDone = true;
591 break;
593 case SID_AVAILABLE_TOOLBARS:
595 SfxStringItem const * pToolbarName = static_cast< SfxStringItem const *>(
596 rReq.GetArg(SID_AVAILABLE_TOOLBARS, false, TYPE(SfxStringItem)));
598 if ( pToolbarName )
600 com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame;
601 Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance(
602 DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
603 xFrame = xDesktop->getActiveFrame();
605 Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
606 Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
607 if ( xPropSet.is() )
611 Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )));
612 aValue >>= xLayoutManager;
614 catch ( ::com::sun::star::uno::RuntimeException& e )
616 throw e;
618 catch ( ::com::sun::star::uno::Exception& )
623 if ( xLayoutManager.is() )
625 rtl::OUString aToolbarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" ));
626 rtl::OUStringBuffer aBuf( aToolbarResName );
627 aBuf.append( pToolbarName->GetValue() );
629 // Parameter auswerten
630 rtl::OUString aToolbarName( aBuf.makeStringAndClear() );
631 BOOL bShow( !xLayoutManager->isElementVisible( aToolbarName ));
633 if ( bShow )
635 xLayoutManager->createElement( aToolbarName );
636 xLayoutManager->showElement( aToolbarName );
638 else
639 xLayoutManager->hideElement( aToolbarName );
643 bDone = true;
644 break;
647 default:
648 break;
651 if ( bDone )
652 rReq.Done();
655 //--------------------------------------------------------------------
657 void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
659 DBG_MEMTEST();
661 LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
662 const USHORT *pRanges = rSet.GetRanges();
663 DBG_ASSERT(pRanges && *pRanges, "Set ohne Bereich");
664 while ( *pRanges )
666 for(USHORT nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich)
668 switch(nWhich)
670 case SID_TEMPLATE_ADDRESSBOKSOURCE:
671 if ( !SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SDATABASE) )
672 rSet.Put(SfxVisibilityItem(nWhich, sal_False));
673 break;
674 case SID_EXITANDRETURN:
675 case SID_QUITAPP:
677 if ( pAppData_Impl->nDocModalMode )
678 rSet.DisableItem(nWhich);
679 else
680 rSet.Put(SfxStringItem(nWhich, String(SfxResId(STR_QUITAPP))));
681 break;
684 case SID_CONFIG:
685 case SID_TOOLBOXOPTIONS:
686 case SID_CONFIGSTATUSBAR:
687 case SID_CONFIGMENU:
688 case SID_CONFIGACCEL:
689 case SID_CONFIGEVENT:
691 if( SvtMiscOptions().DisableUICustomization() )
692 rSet.DisableItem(nWhich);
693 break;
696 case SID_BASICSTOP:
697 if ( !StarBASIC::IsRunning() )
698 rSet.DisableItem(nWhich);
699 break;
701 case SID_HELPTIPS:
703 rSet.Put( SfxBoolItem( SID_HELPTIPS, Help::IsQuickHelpEnabled() ) );
705 break;
706 case SID_HELPBALLOONS:
708 rSet.Put( SfxBoolItem( SID_HELPBALLOONS, Help::IsBalloonHelpEnabled() ) );
710 break;
711 case SID_HELP_PI:
713 rSet.Put( SfxBoolItem( SID_HELP_PI, SvtHelpOptions().IsHelpAgentAutoStartMode() ) );
715 break;
717 case SID_EXTENDEDHELP:
720 break;
722 case SID_CLOSEDOCS:
723 case SID_CLOSEWINS:
725 Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
726 Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY );
727 if ( !xTasks.is() || !xTasks->getCount() )
728 rSet.DisableItem(nWhich);
729 break;
732 case SID_SAVEDOCS:
734 BOOL bModified = FALSE;
735 for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
736 pObjSh;
737 pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
739 if ( pObjSh->IsModified() )
741 bModified = TRUE;
742 break;
746 if ( !bModified )
747 rSet.DisableItem( nWhich );
748 break;
751 case SID_SHOW_IME_STATUS_WINDOW:
752 if (pAppData_Impl->m_xImeStatusWindow->canToggle())
753 rSet.Put(SfxBoolItem(
754 SID_SHOW_IME_STATUS_WINDOW,
755 pAppData_Impl->m_xImeStatusWindow->
756 isShowing()));
757 else
758 rSet.DisableItem(SID_SHOW_IME_STATUS_WINDOW);
759 break;
761 default:
762 break;
766 ++pRanges;
770 static const ::rtl::OUString& getProductRegistrationServiceName( )
772 static ::rtl::OUString s_sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.setup.ProductRegistration" );
773 return s_sServiceName;
776 typedef rtl_uString* (SAL_CALL *basicide_choose_macro)(XModel*, BOOL, rtl_uString*);
777 typedef void (SAL_CALL *basicide_macro_organizer)( INT16 );
779 #define DOSTRING( x ) #x
780 #define STRING( x ) DOSTRING( x )
782 extern "C" { static void SAL_CALL thisModule() {} }
784 ::rtl::OUString ChooseMacro( const Reference< XModel >& rxLimitToDocument, BOOL bChooseOnly, const ::rtl::OUString& rMacroDesc = ::rtl::OUString() )
786 // get basctl dllname
787 String sLibName = String::CreateFromAscii( STRING( DLL_NAME ) );
788 sLibName.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "sfx" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "basctl" ) ) );
789 ::rtl::OUString aLibName( sLibName );
791 // load module
792 oslModule handleMod = osl_loadModuleRelative(
793 &thisModule, aLibName.pData, 0 );
795 // get symbol
796 ::rtl::OUString aSymbol( RTL_CONSTASCII_USTRINGPARAM( "basicide_choose_macro" ) );
797 basicide_choose_macro pSymbol = (basicide_choose_macro) osl_getFunctionSymbol( handleMod, aSymbol.pData );
799 // call basicide_choose_macro in basctl
800 rtl_uString* pScriptURL = pSymbol( rxLimitToDocument.get(), bChooseOnly, rMacroDesc.pData );
801 ::rtl::OUString aScriptURL( pScriptURL );
802 rtl_uString_release( pScriptURL );
803 return aScriptURL;
806 void MacroOrganizer( INT16 nTabId )
808 // get basctl dllname
809 String sLibName = String::CreateFromAscii( STRING( DLL_NAME ) );
810 sLibName.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "sfx" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "basctl" ) ) );
811 ::rtl::OUString aLibName( sLibName );
813 // load module
814 oslModule handleMod = osl_loadModuleRelative(
815 &thisModule, aLibName.pData, 0 );
817 // get symbol
818 ::rtl::OUString aSymbol( RTL_CONSTASCII_USTRINGPARAM( "basicide_macro_organizer" ) );
819 basicide_macro_organizer pSymbol = (basicide_macro_organizer) osl_getFunctionSymbol( handleMod, aSymbol.pData );
821 // call basicide_macro_organizer in basctl
822 pSymbol( nTabId );
825 #define RID_ERRBOX_MODULENOTINSTALLED (RID_OFA_START + 72)
827 ResMgr* SfxApplication::GetOffResManager_Impl()
829 if ( !pAppData_Impl->pOfaResMgr )
830 pAppData_Impl->pOfaResMgr = CreateResManager( "ofa");
831 return pAppData_Impl->pOfaResMgr;
834 namespace
836 Window* lcl_getDialogParent( const Reference< XFrame >& _rxFrame, Window* _pFallback )
838 if ( !_rxFrame.is() )
839 return _pFallback;
843 Reference< awt::XWindow > xContainerWindow( _rxFrame->getContainerWindow(), UNO_SET_THROW );
844 Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
845 OSL_ENSURE( pWindow, "lcl_getDialogParent: cool, somebody implemented a VCL-less toolkit!" );
847 if ( pWindow )
848 return pWindow->GetSystemWindow();
850 catch( const Exception& )
852 DBG_UNHANDLED_EXCEPTION();
854 return _pFallback;
858 void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
860 DBG_MEMTEST();
861 switch ( rReq.GetSlot() )
863 case SID_OPTIONS_TREEDIALOG:
865 String sPageURL;
866 SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, SID_OPTIONS_PAGEURL, sal_False );
867 if ( pURLItem )
868 sPageURL = pURLItem->GetValue();
869 const SfxItemSet* pArgs = rReq.GetInternalArgs_Impl();
870 const SfxPoolItem* pItem = NULL;
871 Reference < XFrame > xFrame;
872 if ( pArgs && pArgs->GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET )
873 ( (SfxUnoAnyItem*)pItem )->GetValue() >>= xFrame;
874 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
875 if ( pFact )
877 VclAbstractDialog* pDlg =
878 pFact->CreateFrameDialog( NULL, xFrame, rReq.GetSlot(), sPageURL );
879 pDlg->Execute();
880 delete pDlg;
881 SfxViewFrame* pView = SfxViewFrame::GetFirst();
882 while ( pView )
884 pView->GetBindings().InvalidateAll(FALSE);
885 pView = SfxViewFrame::GetNext( *pView );
888 break;
891 case SID_MORE_DICTIONARIES:
895 uno::Reference< lang::XMultiServiceFactory > xSMGR =
896 ::comphelper::getProcessServiceFactory();
897 uno::Reference< css::system::XSystemShellExecute > xSystemShell(
898 xSMGR->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute" ) ),
899 uno::UNO_QUERY_THROW );
900 if ( xSystemShell.is() )
901 xSystemShell->execute( DEFINE_CONST_UNICODE("http://extensions.go-oo.org/dictionary?cid=926385"), ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS );
903 catch( const ::com::sun::star::uno::Exception& )
905 DBG_ERRORFILE( "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES): caught an exception!" );
907 break;
910 case SID_ONLINE_REGISTRATION:
914 // create the ProductRegistration component
915 Reference< com::sun::star::lang::XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() );
916 Reference< com::sun::star::task::XJobExecutor > xProductRegistration;
917 if ( xORB.is() )
918 xProductRegistration = xProductRegistration.query( xORB->createInstance( getProductRegistrationServiceName() ) );
919 DBG_ASSERT( xProductRegistration.is(), "OfficeApplication::ExecuteApp_Impl: could not create the service!" );
921 // tell it that the user wants to register
922 if ( xProductRegistration.is() )
924 xProductRegistration->trigger( ::rtl::OUString::createFromAscii( "RegistrationRequired" ) );
927 catch( const ::com::sun::star::uno::Exception& )
929 DBG_ERROR( "OfficeApplication::ExecuteApp_Impl(SID_ONLINE_REGISTRATION): caught an exception!" );
932 break;
934 case SID_BASICIDE_APPEAR:
936 SfxViewFrame* pView = SfxViewFrame::GetFirst();
937 ::rtl::OUString aBasicName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ) );
938 while ( pView )
940 if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == aBasicName )
941 break;
942 pView = SfxViewFrame::GetNext( *pView );
945 if ( !pView )
947 SfxObjectShell* pDocShell = SfxObjectShell::CreateObject( aBasicName );
948 pDocShell->DoInitNew( 0 );
949 pDocShell->SetModified( FALSE );
950 pView = SfxViewFrame::CreateViewFrame( *pDocShell, 0 );
951 pView->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC:1" ) ) );
954 if ( pView )
955 pView->GetFrame()->Appear();
957 const SfxItemSet* pArgs = rReq.GetArgs();
958 if ( pArgs && pView )
960 SfxViewShell* pViewShell = pView->GetViewShell();
961 SfxObjectShell* pObjShell = pView->GetObjectShell();
962 if ( pViewShell && pObjShell )
964 SfxRequest aReq( SID_BASICIDE_SHOWWINDOW, SFX_CALLMODE_SYNCHRON, pObjShell->GetPool() );
965 aReq.SetArgs( *pArgs );
966 pViewShell->ExecuteSlot( aReq );
970 rReq.Done();
972 break;
974 case SID_BASICCHOOSER:
976 const SfxItemSet* pArgs = rReq.GetArgs();
977 const SfxPoolItem* pItem;
978 BOOL bChooseOnly = FALSE;
979 Reference< XModel > xLimitToModel;
980 if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_RECORDMACRO, sal_False, &pItem) )
982 BOOL bRecord = ((SfxBoolItem*)pItem)->GetValue();
983 if ( bRecord )
985 // !Hack
986 bChooseOnly = FALSE;
987 SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
988 OSL_ENSURE( pCurrentShell, "macro recording outside an SFX document?" );
989 if ( pCurrentShell )
990 xLimitToModel = pCurrentShell->GetModel();
994 rReq.SetReturnValue( SfxStringItem( rReq.GetSlot(), ChooseMacro( xLimitToModel, bChooseOnly ) ) );
995 rReq.Done();
997 break;
999 case SID_MACROORGANIZER:
1001 OSL_TRACE("handling SID_MACROORGANIZER");
1002 const SfxItemSet* pArgs = rReq.GetArgs();
1003 const SfxPoolItem* pItem;
1004 INT16 nTabId = 0;
1005 if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_MACROORGANIZER, sal_False, &pItem) )
1007 nTabId = ((SfxUInt16Item*)pItem)->GetValue();
1010 SfxApplication::MacroOrganizer( nTabId );
1011 rReq.Done();
1013 break;
1015 case SID_RUNMACRO:
1017 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1018 OSL_TRACE("SfxApplication::OfaExec_Impl: case ScriptOrg");
1020 Reference< XFrame > xFrame;
1021 const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl();
1022 SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, FALSE );
1023 if ( pFrameItem )
1024 pFrameItem->GetValue() >>= xFrame;
1026 if ( !xFrame.is() )
1028 const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
1029 const SfxFrame* pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL;
1030 if ( pFrame )
1031 xFrame = pFrame->GetFrameInterface();
1034 do // artificial loop for flow control
1036 AbstractScriptSelectorDialog* pDlg = pFact->CreateScriptSelectorDialog(
1037 lcl_getDialogParent( xFrame, GetTopWindow() ), FALSE, xFrame );
1038 OSL_ENSURE( pDlg, "SfxApplication::OfaExec_Impl( SID_RUNMACRO ): no dialog!" );
1039 if ( !pDlg )
1040 break;
1041 pDlg->SetRunLabel();
1043 short nDialogResult = pDlg->Execute();
1044 if ( !nDialogResult )
1045 break;
1047 Sequence< Any > args;
1048 Sequence< sal_Int16 > outIndex;
1049 Sequence< Any > outArgs;
1050 Any ret;
1052 Reference< XInterface > xScriptContext;
1054 Reference< XController > xController;
1055 if ( xFrame.is() )
1056 xController = xFrame->getController();
1057 if ( xController.is() )
1058 xScriptContext = xController->getModel();
1059 if ( !xScriptContext.is() )
1060 xScriptContext = xController;
1062 SfxObjectShell::CallXScript( xScriptContext, pDlg->GetScriptURL(), args, ret, outIndex, outArgs );
1064 while ( false );
1065 rReq.Done();
1067 break;
1069 case SID_SCRIPTORGANIZER:
1071 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1072 OSL_TRACE("SfxApplication::OfaExec_Impl: case ScriptOrg");
1073 const SfxItemSet* pArgs = rReq.GetArgs();
1074 const SfxPoolItem* pItem;
1075 String aLanguage;
1076 if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_SCRIPTORGANIZER, sal_False, &pItem) )
1078 aLanguage = ((SfxScriptOrganizerItem*)pItem)->getLanguage();
1081 ::rtl::OUString aLang( aLanguage );
1082 OSL_TRACE("SfxApplication::OfaExec_Impl: about to create dialog for: %s", ::rtl::OUStringToOString( aLang , RTL_TEXTENCODING_ASCII_US ).pData->buffer);
1083 // not sure about the Window*
1084 VclAbstractDialog* pDlg = pFact->CreateSvxScriptOrgDialog( GetTopWindow(), aLanguage );
1085 if( pDlg )
1087 pDlg->Execute();
1089 else
1091 OSL_TRACE("no dialog!!!");
1093 rReq.Done();
1095 break;
1097 case SID_OFFICE_CHECK_PLZ:
1099 sal_Bool bRet = sal_False;
1100 SFX_REQUEST_ARG(rReq, pStringItem, SfxStringItem, rReq.GetSlot(), sal_False);
1102 if ( pStringItem )
1104 String aPLZ = pStringItem->GetValue();
1105 bRet = TRUE /*!!!SfxIniManager::CheckPLZ( aPLZ )*/;
1107 else
1108 SbxBase::SetError( SbxERR_WRONG_ARGS );
1109 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bRet ) );
1111 break;
1113 case SID_AUTO_CORRECT_DLG:
1115 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1116 if ( pFact )
1118 SfxItemSet aSet(GetPool(), SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG);
1119 const SfxPoolItem* pItem=NULL;
1120 const SfxItemSet* pSet = rReq.GetArgs();
1121 SfxItemPool* pSetPool = pSet ? pSet->GetPool() : NULL;
1122 if ( pSet && pSet->GetItemState( pSetPool->GetWhich( SID_AUTO_CORRECT_DLG ), FALSE, &pItem ) == SFX_ITEM_SET )
1123 aSet.Put( *pItem );
1125 SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_OFA_AUTOCORR_DLG, NULL, &aSet, NULL );
1126 pDlg->Execute();
1127 delete pDlg;
1130 break;
1133 case SID_SD_AUTOPILOT :
1134 case SID_NEWSD :
1136 SvtModuleOptions aModuleOpt;
1137 if ( !aModuleOpt.IsImpress() )
1139 ErrorBox( 0, ResId( RID_ERRBOX_MODULENOTINSTALLED, *GetOffResManager_Impl() )).Execute();
1140 return;
1143 Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
1144 Reference< com::sun::star::frame::XDispatchProvider > xProv(
1145 xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY );
1147 if ( xProv.is() )
1149 ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
1150 Reference< com::sun::star::frame::XDispatchHelper > xHelper(
1151 xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY );
1152 if ( xHelper.is() )
1154 Sequence < com::sun::star::beans::PropertyValue > aSeq;
1155 if ( rReq.GetArgs() )
1156 TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
1157 Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq );
1158 ::com::sun::star::frame::DispatchResultEvent aEvent;
1159 sal_Bool bSuccess = (
1160 (aResult >>= aEvent) &&
1161 (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS)
1163 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
1167 break;
1169 case FN_LABEL :
1170 case FN_BUSINESS_CARD :
1171 case FN_XFORMS_INIT :
1173 Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
1174 Reference< com::sun::star::frame::XDispatchProvider > xProv(
1175 xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.text.ModuleDispatcher")), UNO_QUERY );
1177 if ( xProv.is() )
1179 ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
1180 Reference< com::sun::star::frame::XDispatchHelper > xHelper(
1181 xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY );
1182 if ( xHelper.is() )
1184 Sequence < com::sun::star::beans::PropertyValue > aSeq;
1185 if ( rReq.GetArgs() )
1186 TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
1187 Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq );
1188 ::com::sun::star::frame::DispatchResultEvent aEvent;
1189 sal_Bool bSuccess = (
1190 (aResult >>= aEvent) &&
1191 (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS)
1193 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
1197 break;
1199 case SID_ADDRESS_DATA_SOURCE:
1201 ::rtl::OUString sDialogServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.AddressBookSourcePilot" ) );
1204 Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
1205 Reference< com::sun::star::ui::dialogs::XExecutableDialog > xDialog;
1206 if (xORB.is())
1207 xDialog = Reference< com::sun::star::ui::dialogs::XExecutableDialog >(xORB->createInstance(sDialogServiceName), UNO_QUERY);
1208 if (xDialog.is())
1209 xDialog->execute();
1210 else
1211 ShowServiceNotAvailableError(NULL, sDialogServiceName, TRUE);
1213 catch(::com::sun::star::uno::Exception&)
1217 break;
1219 case SID_COMP_BIBLIOGRAPHY:
1221 SfxStringItem aURL(SID_FILE_NAME, String::CreateFromAscii(".component:Bibliography/View1"));
1222 SfxStringItem aRef(SID_REFERER, String::CreateFromAscii("private:user"));
1223 SfxStringItem aTarget(SID_TARGETNAME, String::CreateFromAscii("_blank"));
1224 SfxViewFrame::Current()->GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, &aURL, &aRef, &aTarget, 0L);
1226 break;
1230 void SfxApplication::OfaState_Impl(SfxItemSet &rSet)
1232 const USHORT *pRanges = rSet.GetRanges();
1233 DBG_ASSERT(pRanges && *pRanges, "Set ohne Bereich");
1234 while ( *pRanges )
1236 for(USHORT nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich)
1238 switch(nWhich)
1240 case SID_ONLINE_REGISTRATION:
1242 ::svt::RegOptions aOptions;
1243 if ( !aOptions.allowMenu() )
1244 rSet.DisableItem( SID_ONLINE_REGISTRATION );
1246 break;
1251 SvtModuleOptions aModuleOpt;
1253 if( !aModuleOpt.IsWriter())
1255 rSet.DisableItem( FN_LABEL );
1256 rSet.DisableItem( FN_BUSINESS_CARD );
1257 rSet.DisableItem( FN_XFORMS_INIT );
1260 if ( !aModuleOpt.IsImpress() )
1261 rSet.DisableItem( SID_SD_AUTOPILOT );