update dev300-m58
[ooovba.git] / sfx2 / source / appl / appserv.cxx
blobdda51d72461dbddf3bb7d3cf3edd26f9ee4b92ab
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_CURRENTTIME:
703 rSet.Put( SfxStringItem( nWhich, aLocaleWrapper.getTime( Time(), FALSE ) ) );
704 break;
706 case SID_CURRENTDATE:
708 rSet.Put( SfxStringItem( nWhich, aLocaleWrapper.getDate( Date() ) ) );
709 break;
712 case SID_HELPTIPS:
714 rSet.Put( SfxBoolItem( SID_HELPTIPS, Help::IsQuickHelpEnabled() ) );
716 break;
717 case SID_HELPBALLOONS:
719 rSet.Put( SfxBoolItem( SID_HELPBALLOONS, Help::IsBalloonHelpEnabled() ) );
721 break;
722 case SID_HELP_PI:
724 rSet.Put( SfxBoolItem( SID_HELP_PI, SvtHelpOptions().IsHelpAgentAutoStartMode() ) );
726 break;
728 case SID_EXTENDEDHELP:
731 break;
733 case SID_CLOSEDOCS:
734 case SID_CLOSEWINS:
736 Reference < XFramesSupplier > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
737 Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY );
738 if ( !xTasks.is() || !xTasks->getCount() )
739 rSet.DisableItem(nWhich);
740 break;
743 case SID_SAVEDOCS:
745 BOOL bModified = FALSE;
746 for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
747 pObjSh;
748 pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
750 if ( pObjSh->IsModified() )
752 bModified = TRUE;
753 break;
757 if ( !bModified )
758 rSet.DisableItem( nWhich );
759 break;
762 case SID_SHOW_IME_STATUS_WINDOW:
763 if (pAppData_Impl->m_xImeStatusWindow->canToggle())
764 rSet.Put(SfxBoolItem(
765 SID_SHOW_IME_STATUS_WINDOW,
766 pAppData_Impl->m_xImeStatusWindow->
767 isShowing()));
768 else
769 rSet.DisableItem(SID_SHOW_IME_STATUS_WINDOW);
770 break;
772 default:
773 break;
777 ++pRanges;
781 static const ::rtl::OUString& getProductRegistrationServiceName( )
783 static ::rtl::OUString s_sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.setup.ProductRegistration" );
784 return s_sServiceName;
787 typedef rtl_uString* (SAL_CALL *basicide_choose_macro)(XModel*, BOOL, rtl_uString*);
788 typedef void (SAL_CALL *basicide_macro_organizer)( INT16 );
790 #define DOSTRING( x ) #x
791 #define STRING( x ) DOSTRING( x )
793 extern "C" { static void SAL_CALL thisModule() {} }
795 ::rtl::OUString ChooseMacro( const Reference< XModel >& rxLimitToDocument, BOOL bChooseOnly, const ::rtl::OUString& rMacroDesc = ::rtl::OUString() )
797 // get basctl dllname
798 String sLibName = String::CreateFromAscii( STRING( DLL_NAME ) );
799 sLibName.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "sfx" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "basctl" ) ) );
800 ::rtl::OUString aLibName( sLibName );
802 // load module
803 oslModule handleMod = osl_loadModuleRelative(
804 &thisModule, aLibName.pData, 0 );
806 // get symbol
807 ::rtl::OUString aSymbol( RTL_CONSTASCII_USTRINGPARAM( "basicide_choose_macro" ) );
808 basicide_choose_macro pSymbol = (basicide_choose_macro) osl_getFunctionSymbol( handleMod, aSymbol.pData );
810 // call basicide_choose_macro in basctl
811 rtl_uString* pScriptURL = pSymbol( rxLimitToDocument.get(), bChooseOnly, rMacroDesc.pData );
812 ::rtl::OUString aScriptURL( pScriptURL );
813 rtl_uString_release( pScriptURL );
814 return aScriptURL;
817 void MacroOrganizer( INT16 nTabId )
819 // get basctl dllname
820 String sLibName = String::CreateFromAscii( STRING( DLL_NAME ) );
821 sLibName.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "sfx" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "basctl" ) ) );
822 ::rtl::OUString aLibName( sLibName );
824 // load module
825 oslModule handleMod = osl_loadModuleRelative(
826 &thisModule, aLibName.pData, 0 );
828 // get symbol
829 ::rtl::OUString aSymbol( RTL_CONSTASCII_USTRINGPARAM( "basicide_macro_organizer" ) );
830 basicide_macro_organizer pSymbol = (basicide_macro_organizer) osl_getFunctionSymbol( handleMod, aSymbol.pData );
832 // call basicide_macro_organizer in basctl
833 pSymbol( nTabId );
836 #define RID_ERRBOX_MODULENOTINSTALLED (RID_OFA_START + 72)
838 ResMgr* SfxApplication::GetOffResManager_Impl()
840 if ( !pAppData_Impl->pOfaResMgr )
841 pAppData_Impl->pOfaResMgr = CreateResManager( "ofa");
842 return pAppData_Impl->pOfaResMgr;
845 namespace
847 Window* lcl_getDialogParent( const Reference< XFrame >& _rxFrame, Window* _pFallback )
849 if ( !_rxFrame.is() )
850 return _pFallback;
854 Reference< awt::XWindow > xContainerWindow( _rxFrame->getContainerWindow(), UNO_SET_THROW );
855 Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
856 OSL_ENSURE( pWindow, "lcl_getDialogParent: cool, somebody implemented a VCL-less toolkit!" );
858 if ( pWindow )
859 return pWindow->GetSystemWindow();
861 catch( const Exception& )
863 DBG_UNHANDLED_EXCEPTION();
865 return _pFallback;
869 void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
871 DBG_MEMTEST();
872 switch ( rReq.GetSlot() )
874 case SID_OPTIONS_TREEDIALOG:
876 String sPageURL;
877 SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, SID_OPTIONS_PAGEURL, sal_False );
878 if ( pURLItem )
879 sPageURL = pURLItem->GetValue();
880 const SfxItemSet* pArgs = rReq.GetInternalArgs_Impl();
881 const SfxPoolItem* pItem = NULL;
882 Reference < XFrame > xFrame;
883 if ( pArgs && pArgs->GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET )
884 ( (SfxUnoAnyItem*)pItem )->GetValue() >>= xFrame;
885 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
886 if ( pFact )
888 VclAbstractDialog* pDlg =
889 pFact->CreateFrameDialog( NULL, xFrame, rReq.GetSlot(), sPageURL );
890 pDlg->Execute();
891 delete pDlg;
893 break;
896 case SID_MORE_DICTIONARIES:
900 uno::Reference< lang::XMultiServiceFactory > xSMGR =
901 ::comphelper::getProcessServiceFactory();
902 uno::Reference< css::system::XSystemShellExecute > xSystemShell(
903 xSMGR->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute" ) ),
904 uno::UNO_QUERY_THROW );
905 if ( xSystemShell.is() )
906 xSystemShell->execute( DEFINE_CONST_UNICODE("http://extensions.go-oo.org/dictionary?cid=926385"), ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS );
908 catch( const ::com::sun::star::uno::Exception& )
910 DBG_ERRORFILE( "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES): caught an exception!" );
912 break;
915 case SID_ONLINE_REGISTRATION:
919 // create the ProductRegistration component
920 Reference< com::sun::star::lang::XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() );
921 Reference< com::sun::star::task::XJobExecutor > xProductRegistration;
922 if ( xORB.is() )
923 xProductRegistration = xProductRegistration.query( xORB->createInstance( getProductRegistrationServiceName() ) );
924 DBG_ASSERT( xProductRegistration.is(), "OfficeApplication::ExecuteApp_Impl: could not create the service!" );
926 // tell it that the user wants to register
927 if ( xProductRegistration.is() )
929 xProductRegistration->trigger( ::rtl::OUString::createFromAscii( "RegistrationRequired" ) );
932 catch( const ::com::sun::star::uno::Exception& )
934 DBG_ERROR( "OfficeApplication::ExecuteApp_Impl(SID_ONLINE_REGISTRATION): caught an exception!" );
937 break;
939 case SID_BASICIDE_APPEAR:
941 SfxViewFrame* pView = SfxViewFrame::GetFirst();
942 ::rtl::OUString aBasicName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ) );
943 while ( pView )
945 if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == aBasicName )
946 break;
947 pView = SfxViewFrame::GetNext( *pView );
950 if ( !pView )
952 SfxObjectShell* pDocShell = SfxObjectShell::CreateObject( aBasicName );
953 pDocShell->DoInitNew( 0 );
954 pDocShell->SetModified( FALSE );
955 pView = SfxViewFrame::CreateViewFrame( *pDocShell, 0 );
956 pView->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC:1" ) ) );
959 if ( pView )
960 pView->GetFrame()->Appear();
962 const SfxItemSet* pArgs = rReq.GetArgs();
963 if ( pArgs && pView )
965 SfxViewShell* pViewShell = pView->GetViewShell();
966 SfxObjectShell* pObjShell = pView->GetObjectShell();
967 if ( pViewShell && pObjShell )
969 SfxRequest aReq( SID_BASICIDE_SHOWWINDOW, SFX_CALLMODE_SYNCHRON, pObjShell->GetPool() );
970 aReq.SetArgs( *pArgs );
971 pViewShell->ExecuteSlot( aReq );
975 rReq.Done();
977 break;
979 case SID_BASICCHOOSER:
981 const SfxItemSet* pArgs = rReq.GetArgs();
982 const SfxPoolItem* pItem;
983 BOOL bChooseOnly = FALSE;
984 Reference< XModel > xLimitToModel;
985 if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_RECORDMACRO, sal_False, &pItem) )
987 BOOL bRecord = ((SfxBoolItem*)pItem)->GetValue();
988 if ( bRecord )
990 // !Hack
991 bChooseOnly = FALSE;
992 SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
993 OSL_ENSURE( pCurrentShell, "macro recording outside an SFX document?" );
994 if ( pCurrentShell )
995 xLimitToModel = pCurrentShell->GetModel();
999 rReq.SetReturnValue( SfxStringItem( rReq.GetSlot(), ChooseMacro( xLimitToModel, bChooseOnly ) ) );
1000 rReq.Done();
1002 break;
1004 case SID_MACROORGANIZER:
1006 OSL_TRACE("handling SID_MACROORGANIZER");
1007 const SfxItemSet* pArgs = rReq.GetArgs();
1008 const SfxPoolItem* pItem;
1009 INT16 nTabId = 0;
1010 if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_MACROORGANIZER, sal_False, &pItem) )
1012 nTabId = ((SfxUInt16Item*)pItem)->GetValue();
1015 SfxApplication::MacroOrganizer( nTabId );
1016 rReq.Done();
1018 break;
1020 case SID_RUNMACRO:
1022 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1023 OSL_TRACE("SfxApplication::OfaExec_Impl: case ScriptOrg");
1025 Reference< XFrame > xFrame;
1026 const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl();
1027 SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, FALSE );
1028 if ( pFrameItem )
1029 pFrameItem->GetValue() >>= xFrame;
1031 if ( !xFrame.is() )
1033 const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
1034 const SfxFrame* pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL;
1035 if ( pFrame )
1036 xFrame = pFrame->GetFrameInterface();
1039 do // artificial loop for flow control
1041 AbstractScriptSelectorDialog* pDlg = pFact->CreateScriptSelectorDialog(
1042 lcl_getDialogParent( xFrame, GetTopWindow() ), FALSE, xFrame );
1043 OSL_ENSURE( pDlg, "SfxApplication::OfaExec_Impl( SID_RUNMACRO ): no dialog!" );
1044 if ( !pDlg )
1045 break;
1046 pDlg->SetRunLabel();
1048 short nDialogResult = pDlg->Execute();
1049 if ( !nDialogResult )
1050 break;
1052 Sequence< Any > args;
1053 Sequence< sal_Int16 > outIndex;
1054 Sequence< Any > outArgs;
1055 Any ret;
1057 Reference< XInterface > xScriptContext;
1059 Reference< XController > xController;
1060 if ( xFrame.is() )
1061 xController = xFrame->getController();
1062 if ( xController.is() )
1063 xScriptContext = xController->getModel();
1064 if ( !xScriptContext.is() )
1065 xScriptContext = xController;
1067 SfxObjectShell::CallXScript( xScriptContext, pDlg->GetScriptURL(), args, ret, outIndex, outArgs );
1069 while ( false );
1070 rReq.Done();
1072 break;
1074 case SID_SCRIPTORGANIZER:
1076 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1077 OSL_TRACE("SfxApplication::OfaExec_Impl: case ScriptOrg");
1078 const SfxItemSet* pArgs = rReq.GetArgs();
1079 const SfxPoolItem* pItem;
1080 String aLanguage;
1081 if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_SCRIPTORGANIZER, sal_False, &pItem) )
1083 aLanguage = ((SfxScriptOrganizerItem*)pItem)->getLanguage();
1086 ::rtl::OUString aLang( aLanguage );
1087 OSL_TRACE("SfxApplication::OfaExec_Impl: about to create dialog for: %s", ::rtl::OUStringToOString( aLang , RTL_TEXTENCODING_ASCII_US ).pData->buffer);
1088 // not sure about the Window*
1089 VclAbstractDialog* pDlg = pFact->CreateSvxScriptOrgDialog( GetTopWindow(), aLanguage );
1090 if( pDlg )
1092 pDlg->Execute();
1094 else
1096 OSL_TRACE("no dialog!!!");
1098 rReq.Done();
1100 break;
1102 case SID_OFFICE_CHECK_PLZ:
1104 sal_Bool bRet = sal_False;
1105 SFX_REQUEST_ARG(rReq, pStringItem, SfxStringItem, rReq.GetSlot(), sal_False);
1107 if ( pStringItem )
1109 String aPLZ = pStringItem->GetValue();
1110 bRet = TRUE /*!!!SfxIniManager::CheckPLZ( aPLZ )*/;
1112 else
1113 SbxBase::SetError( SbxERR_WRONG_ARGS );
1114 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bRet ) );
1116 break;
1118 case SID_AUTO_CORRECT_DLG:
1120 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1121 if ( pFact )
1123 SfxItemSet aSet(GetPool(), SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG);
1124 const SfxPoolItem* pItem=NULL;
1125 const SfxItemSet* pSet = rReq.GetArgs();
1126 SfxItemPool* pSetPool = pSet ? pSet->GetPool() : NULL;
1127 if ( pSet && pSet->GetItemState( pSetPool->GetWhich( SID_AUTO_CORRECT_DLG ), FALSE, &pItem ) == SFX_ITEM_SET )
1128 aSet.Put( *pItem );
1130 SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_OFA_AUTOCORR_DLG, NULL, &aSet, NULL );
1131 pDlg->Execute();
1132 delete pDlg;
1135 break;
1138 case SID_SD_AUTOPILOT :
1139 case SID_NEWSD :
1141 SvtModuleOptions aModuleOpt;
1142 if ( !aModuleOpt.IsImpress() )
1144 ErrorBox( 0, ResId( RID_ERRBOX_MODULENOTINSTALLED, *GetOffResManager_Impl() )).Execute();
1145 return;
1148 Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
1149 Reference< com::sun::star::frame::XDispatchProvider > xProv(
1150 xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY );
1152 if ( xProv.is() )
1154 ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
1155 Reference< com::sun::star::frame::XDispatchHelper > xHelper(
1156 xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY );
1157 if ( xHelper.is() )
1159 Sequence < com::sun::star::beans::PropertyValue > aSeq;
1160 if ( rReq.GetArgs() )
1161 TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
1162 Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq );
1163 ::com::sun::star::frame::DispatchResultEvent aEvent;
1164 sal_Bool bSuccess = (
1165 (aResult >>= aEvent) &&
1166 (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS)
1168 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
1172 break;
1174 case FN_LABEL :
1175 case FN_BUSINESS_CARD :
1176 case FN_XFORMS_INIT :
1178 Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
1179 Reference< com::sun::star::frame::XDispatchProvider > xProv(
1180 xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.text.ModuleDispatcher")), UNO_QUERY );
1182 if ( xProv.is() )
1184 ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
1185 Reference< com::sun::star::frame::XDispatchHelper > xHelper(
1186 xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY );
1187 if ( xHelper.is() )
1189 Sequence < com::sun::star::beans::PropertyValue > aSeq;
1190 if ( rReq.GetArgs() )
1191 TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
1192 Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq );
1193 ::com::sun::star::frame::DispatchResultEvent aEvent;
1194 sal_Bool bSuccess = (
1195 (aResult >>= aEvent) &&
1196 (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS)
1198 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
1202 break;
1204 case SID_ADDRESS_DATA_SOURCE:
1206 ::rtl::OUString sDialogServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.AddressBookSourcePilot" ) );
1209 Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
1210 Reference< com::sun::star::ui::dialogs::XExecutableDialog > xDialog;
1211 if (xORB.is())
1212 xDialog = Reference< com::sun::star::ui::dialogs::XExecutableDialog >(xORB->createInstance(sDialogServiceName), UNO_QUERY);
1213 if (xDialog.is())
1214 xDialog->execute();
1215 else
1216 ShowServiceNotAvailableError(NULL, sDialogServiceName, TRUE);
1218 catch(::com::sun::star::uno::Exception&)
1222 break;
1224 case SID_COMP_BIBLIOGRAPHY:
1226 SfxStringItem aURL(SID_FILE_NAME, String::CreateFromAscii(".component:Bibliography/View1"));
1227 SfxStringItem aRef(SID_REFERER, String::CreateFromAscii("private:user"));
1228 SfxStringItem aTarget(SID_TARGETNAME, String::CreateFromAscii("_blank"));
1229 SfxViewFrame::Current()->GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, &aURL, &aRef, &aTarget, 0L);
1231 break;
1235 void SfxApplication::OfaState_Impl(SfxItemSet &rSet)
1237 const USHORT *pRanges = rSet.GetRanges();
1238 DBG_ASSERT(pRanges && *pRanges, "Set ohne Bereich");
1239 while ( *pRanges )
1241 for(USHORT nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich)
1243 switch(nWhich)
1245 case SID_ONLINE_REGISTRATION:
1247 ::svt::RegOptions aOptions;
1248 if ( !aOptions.allowMenu() )
1249 rSet.DisableItem( SID_ONLINE_REGISTRATION );
1251 break;
1256 SvtModuleOptions aModuleOpt;
1258 if( !aModuleOpt.IsWriter())
1260 rSet.DisableItem( FN_LABEL );
1261 rSet.DisableItem( FN_BUSINESS_CARD );
1262 rSet.DisableItem( FN_XFORMS_INIT );
1265 if ( !aModuleOpt.IsImpress() )
1266 rSet.DisableItem( SID_SD_AUTOPILOT );