LCOV - code coverage report
Current view: top level - libreoffice/sfx2/source/appl - appserv.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 610 0.8 %
Date: 2012-12-27 Functions: 3 26 11.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/uno/Reference.hxx>
      21             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      22             : #include <com/sun/star/lang/IllegalArgumentException.hpp>
      23             : #include <com/sun/star/frame/Desktop.hpp>
      24             : #include <com/sun/star/frame/DispatchResultEvent.hpp>
      25             : #include <com/sun/star/frame/DispatchResultState.hpp>
      26             : #include <com/sun/star/task/XJobExecutor.hpp>
      27             : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
      28             : #include <com/sun/star/frame/DispatchHelper.hpp>
      29             : #include <com/sun/star/frame/XDesktop.hpp>
      30             : #include <com/sun/star/frame/XFramesSupplier.hpp>
      31             : #include <com/sun/star/util/XCloseable.hpp>
      32             : #include <com/sun/star/util/CloseVetoException.hpp>
      33             : #include <com/sun/star/frame/XLayoutManager.hpp>
      34             : #include <com/sun/star/document/XEmbeddedScripts.hpp>
      35             : #include <com/sun/star/embed/XStorage.hpp>
      36             : #include <com/sun/star/embed/ElementModes.hpp>
      37             : #include <com/sun/star/system/SystemShellExecute.hpp>
      38             : #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
      39             : #include <com/sun/star/system/SystemShellExecuteException.hpp>
      40             : #include <com/sun/star/sdbc/DriverManager.hpp>
      41             : #include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp>
      42             : 
      43             : #include <com/sun/star/frame/XComponentLoader.hpp>
      44             : 
      45             : #include <comphelper/processfactory.hxx>
      46             : #include <comphelper/storagehelper.hxx>
      47             : #include "comphelper/configurationhelper.hxx"
      48             : 
      49             : #include <svtools/addresstemplate.hxx>
      50             : #include <svtools/miscopt.hxx>
      51             : #include <svtools/restartdialog.hxx>
      52             : #include <svl/visitem.hxx>
      53             : #include <unotools/intlwrapper.hxx>
      54             : 
      55             : #include <unotools/configmgr.hxx>
      56             : #include <tools/diagnose_ex.h>
      57             : #include <vcl/msgbox.hxx>
      58             : #include <svl/intitem.hxx>
      59             : #include <svl/eitem.hxx>
      60             : #include <svl/stritem.hxx>
      61             : #include <basic/sbstar.hxx>
      62             : #include <basic/basmgr.hxx>
      63             : #include <basic/basrdll.hxx>
      64             : #include <svtools/sfxecode.hxx>
      65             : #include <svtools/ehdl.hxx>
      66             : #include <vcl/help.hxx>
      67             : #include <vcl/stdtext.hxx>
      68             : #include <rtl/ustrbuf.hxx>
      69             : #include <osl/file.hxx>
      70             : 
      71             : #include <unotools/pathoptions.hxx>
      72             : #include <unotools/moduleoptions.hxx>
      73             : #include <svtools/helpopt.hxx>
      74             : #include <svtools/miscopt.hxx>
      75             : #include <toolkit/helper/vclunohelper.hxx>
      76             : #include <tools/shl.hxx>
      77             : #include <unotools/bootstrap.hxx>
      78             : #include <rtl/bootstrap.hxx>
      79             : #include <cppuhelper/exc_hlp.hxx>
      80             : 
      81             : #include <com/sun/star/script/provider/XScriptProviderFactory.hpp>
      82             : #include <com/sun/star/frame/ModuleManager.hpp>
      83             : #include <com/sun/star/beans/XPropertySet.hpp>
      84             : 
      85             : #include "frmload.hxx"
      86             : #include "referers.hxx"
      87             : #include <sfx2/app.hxx>
      88             : #include <sfx2/request.hxx>
      89             : #include <sfx2/dispatch.hxx>
      90             : #include <sfx2/bindings.hxx>
      91             : #include <sfx2/msg.hxx>
      92             : #include <sfx2/objface.hxx>
      93             : #include <sfx2/objitem.hxx>
      94             : #include <sfx2/objsh.hxx>
      95             : #include <sfx2/hintpost.hxx>
      96             : #include <sfx2/viewsh.hxx>
      97             : #include <sfx2/docfac.hxx>
      98             : #include <sfx2/docfile.hxx>
      99             : #include <sfx2/docfilt.hxx>
     100             : #include <sfx2/new.hxx>
     101             : #include "sfxtypes.hxx"
     102             : #include <sfx2/tabdlg.hxx>
     103             : #include "arrdecl.hxx"
     104             : #include "fltfnc.hxx"
     105             : #include <sfx2/sfx.hrc>
     106             : #include "app.hrc"
     107             : #include <sfx2/passwd.hxx>
     108             : #include "sfx2/sfxresid.hxx"
     109             : #include <sfx2/childwin.hxx>
     110             : #include "appdata.hxx"
     111             : #include "sfx2/minfitem.hxx"
     112             : #include <sfx2/event.hxx>
     113             : #include <sfx2/module.hxx>
     114             : #include <sfx2/viewfrm.hxx>
     115             : #include "sfxpicklist.hxx"
     116             : #include "imestatuswindow.hxx"
     117             : #include <sfx2/sfxdlg.hxx>
     118             : #include <sfx2/dialogs.hrc>
     119             : #include "sorgitm.hxx"
     120             : #include "sfx2/sfxhelp.hxx"
     121             : #include <sfx2/zoomitem.hxx>
     122             : #include "templatedlg.hxx"
     123             : 
     124             : using namespace ::com::sun::star;
     125             : using namespace ::com::sun::star::beans;
     126             : using namespace ::com::sun::star::uno;
     127             : using namespace ::com::sun::star::frame;
     128             : using namespace ::com::sun::star::container;
     129             : using namespace ::com::sun::star::util;
     130             : using namespace ::com::sun::star::script;
     131             : using namespace ::com::sun::star::system;
     132             : using namespace ::com::sun::star::lang;
     133             : using namespace ::com::sun::star::document;
     134             : 
     135             : namespace
     136             : {
     137             :     // lp#527938, debian#602953, fdo#33266, i#105408
     138           0 :     static bool lcl_isBaseAvailable()
     139             :     {
     140             :         try
     141             :         {
     142             :             // if we get com::sun::star::sdbc::DriverManager, libsdbc2 is there
     143             :             // and the bibliography is assumed to work
     144           0 :             return com::sun::star::sdbc::DriverManager::create(comphelper::getProcessComponentContext()).is();
     145             :         }
     146           0 :         catch (Exception & e)
     147             :         {
     148             :             SAL_INFO(
     149             :                 "sfx2.appl",
     150             :                 "assuming Base to be missing; caught " << e.Message);
     151           0 :             return false;
     152             :         }
     153             :     }
     154           0 :     static void lcl_tryLoadBibliography()
     155             :     {
     156             :         // lp#527938, debian#602953, fdo#33266, i#105408
     157             :         // make sure we actually can instanciate services from base first
     158           0 :         if(!lcl_isBaseAvailable())
     159             :         {
     160             :             try
     161             :             {
     162             :                 using namespace org::freedesktop::PackageKit;
     163             :                 using namespace svtools;
     164           0 :                 Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
     165           0 :                 Sequence< ::rtl::OUString > vPackages(1);
     166           0 :                 vPackages[0] = "libreoffice-base";
     167           0 :                 ::rtl::OUString sInteraction;
     168           0 :                 xSyncDbusSessionHelper->InstallPackageNames(0, vPackages, sInteraction);
     169             :                 // Ill be back (hopefully)!
     170           0 :                 SolarMutexGuard aGuard;
     171           0 :                 executeRestartDialog(comphelper::getProcessComponentContext(), NULL, RESTART_REASON_BIBLIOGRAPHY_INSTALL);
     172             :             }
     173           0 :             catch (Exception & e)
     174             :             {
     175             :                 SAL_INFO(
     176             :                     "sfx2.appl",
     177             :                     "trying to install LibreOffice Base, caught " << e.Message);
     178             :             }
     179           0 :             return;
     180             :         }
     181           0 :         SfxStringItem aURL(SID_FILE_NAME, rtl::OUString(".component:Bibliography/View1"));
     182           0 :         SfxStringItem aRef(SID_REFERER, rtl::OUString("private:user"));
     183           0 :         SfxStringItem aTarget(SID_TARGETNAME, rtl::OUString("_blank"));
     184           0 :         SfxViewFrame::Current()->GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, &aURL, &aRef, &aTarget, 0L);
     185             :     }
     186             : }
     187             : /// Find the correct location of the document (LICENSE.odt, etc.), and return
     188             : /// it in rURL if found.
     189           0 : static sal_Bool checkURL( const char *pName, const char *pExt, rtl::OUString &rURL )
     190             : {
     191             :     using namespace osl;
     192           0 :     DirectoryItem aDirItem;
     193             : 
     194           0 :     rURL = rtl::OUString( "$BRAND_BASE_DIR/" );
     195           0 :     rURL += rtl::OUString::createFromAscii( pName );
     196           0 :     rURL += rtl::OUString::createFromAscii( pExt );
     197           0 :     rtl::Bootstrap::expandMacros( rURL );
     198             : 
     199           0 :     if (!rURL.isEmpty())
     200           0 :         return DirectoryItem::get( rURL, aDirItem ) == DirectoryItem::E_None;
     201             :     else
     202           0 :         return sal_False;
     203             : }
     204             : 
     205             : /// Displays CREDITS or LICENSE in any of the available version
     206           0 : static void showDocument( const char* pBaseName )
     207             : {
     208             :     try {
     209           0 :         Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
     210           0 :         Sequence < com::sun::star::beans::PropertyValue > args(2);
     211           0 :         args[0].Name = ::rtl::OUString("ViewOnly");
     212           0 :         args[0].Value <<= sal_True;
     213           0 :         args[1].Name = ::rtl::OUString("ReadOnly");
     214           0 :         args[1].Value <<= sal_True;
     215             : 
     216           0 :         rtl::OUString aURL;
     217           0 :         if ( checkURL ( pBaseName, ".odt", aURL ) ||
     218           0 :                 checkURL ( pBaseName, ".html", aURL ) ||
     219           0 :                 checkURL ( pBaseName, "", aURL ) ) {
     220           0 :             xDesktop->loadComponentFromURL( aURL, ::rtl::OUString("_blank"), 0, args );
     221           0 :         }
     222           0 :     } catch (const ::com::sun::star::uno::Exception &) {
     223             :     }
     224           0 : }
     225             : 
     226             : namespace
     227             : {
     228           0 :     class LicenseDialog : public ModalDialog
     229             :     {
     230             :     private:
     231             :         FixedText aText;
     232             :         OKButton aShow;
     233             :         CancelButton aClose;
     234             : 
     235             :         DECL_LINK(CancelHdl, void *);
     236             :         DECL_LINK(ShowHdl, void *);
     237             :     public:
     238             :         LicenseDialog(Window *pParent=NULL);
     239             :     };
     240             : 
     241           0 :     LicenseDialog::LicenseDialog(Window *pParent)
     242             :         : ModalDialog(pParent, SfxResId(DLG_HELP_LICENSING))
     243             :         , aText( this )
     244             :         , aShow( this, SfxResId( PB_LICENSING_SHOW ) )
     245           0 :         , aClose( this, SfxResId( PB_LICENSING_CLOSE ) )
     246             :     {
     247           0 :         aClose.SetClickHdl( LINK( this, LicenseDialog, CancelHdl ) );
     248           0 :         aShow.SetClickHdl( LINK( this, LicenseDialog, ShowHdl ) );
     249             : 
     250           0 :         String aLicensing;
     251           0 :         for ( int i = STR_LICENSING_INFORMATION_1; i <= STR_LICENSING_INFORMATION_5; ++i )
     252             :         {
     253           0 :             if ( i != STR_LICENSING_INFORMATION_1 )
     254           0 :                 aLicensing += String( RTL_CONSTASCII_USTRINGPARAM( "\n\n" ) );
     255           0 :             aLicensing += SfxResId( i ).toString();
     256             :         }
     257             : 
     258           0 :         aText.SetText( aLicensing );
     259             : 
     260             :         // positions and sizes are computed to always fit the language
     261           0 :         Size aTextSize( aText.GetOptimalSize( WINDOWSIZE_PREFERRED ) );
     262           0 :         Size aShowSize( aShow.GetOptimalSize( WINDOWSIZE_PREFERRED ) );
     263           0 :         Size aCloseSize( aClose.GetOptimalSize( WINDOWSIZE_PREFERRED ) );
     264             : 
     265           0 :         long nDelimX = 12;
     266           0 :         long nDelimY = 12;
     267           0 :         long nWidth = aTextSize.Width() + 2*nDelimX;
     268           0 :         long nButtonY = aTextSize.Height() + 2*nDelimY;
     269           0 :         Size aButtonSize( std::max( aShowSize.Width(), aCloseSize.Width() ) + nDelimX,
     270           0 :                 std::max( aShowSize.Height(), aCloseSize.Height() ) );
     271             : 
     272           0 :         SetSizePixel( Size( nWidth, aTextSize.Height() + 3*nDelimY + aButtonSize.Height() ) );
     273           0 :         aText.SetPosSizePixel( Point( nDelimX, nDelimY ), aTextSize );
     274           0 :         aShow.SetPosSizePixel( Point( ( nWidth - nDelimX ) / 2 - aButtonSize.Width(), nButtonY ), aButtonSize );
     275           0 :         aClose.SetPosSizePixel( Point( aShow.GetPosPixel().X() + aButtonSize.Width() + nDelimX, nButtonY ), aButtonSize );
     276             : 
     277           0 :         aText.Show();
     278             : 
     279           0 :         FreeResource();
     280           0 :     }
     281             : 
     282           0 :     IMPL_LINK_NOARG(LicenseDialog, CancelHdl)
     283             :     {
     284           0 :         Close();
     285           0 :         return 0;
     286             :     }
     287             : 
     288           0 :     IMPL_LINK_NOARG(LicenseDialog, ShowHdl)
     289             :     {
     290           0 :         EndDialog(RET_OK);
     291           0 :         showDocument("LICENSE");
     292           0 :         return 0;
     293             :     }
     294             : 
     295             : }
     296             : 
     297             : 
     298           0 : void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
     299             : {
     300           0 :     bool bDone = false;
     301           0 :     switch ( rReq.GetSlot() )
     302             :     {
     303             :         case SID_SETOPTIONS:
     304             :         {
     305           0 :             if( rReq.GetArgs() )
     306           0 :                 SetOptions_Impl( *rReq.GetArgs() );
     307           0 :             break;
     308             :         }
     309             : 
     310             :         case SID_QUITAPP:
     311             :         case SID_EXITANDRETURN:
     312             :         case SID_LOGOUT:
     313             :         {
     314             :             // protect against reentrant calls
     315           0 :             if ( pAppData_Impl->bInQuit )
     316             :                 return;
     317             : 
     318           0 :             if ( rReq.GetSlot() == SID_LOGOUT )
     319             :             {
     320           0 :                 for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
     321             :                     pObjSh; pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
     322             :                 {
     323           0 :                     if ( !pObjSh->IsModified() )
     324           0 :                         continue;
     325             : 
     326           0 :                     SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjSh );
     327           0 :                     if ( !pFrame || !pFrame->GetWindow().IsReallyVisible() )
     328           0 :                         continue;
     329             : 
     330           0 :                     if ( pObjSh->PrepareClose(2) )
     331           0 :                         pObjSh->SetModified( sal_False );
     332             :                     else
     333             :                         return;
     334             :                 }
     335             : 
     336           0 :                 SfxStringItem aNameItem( SID_FILE_NAME, rtl::OUString("vnd.sun.star.cmd:logout") );
     337           0 :                 SfxStringItem aReferer( SID_REFERER, DEFINE_CONST_UNICODE( "private/user" ) );
     338           0 :                 pAppData_Impl->pAppDispat->Execute( SID_OPENDOC, SFX_CALLMODE_SLOT, &aNameItem, &aReferer, 0L );
     339           0 :                 return;
     340             :             }
     341             : 
     342             :             // aus verschachtelten Requests nach 100ms nochmal probieren
     343           0 :             if( Application::GetDispatchLevel() > 1 )
     344             :             {
     345             :                 /* Dont save the request for closing the application and try it later
     346             :                    again. This is an UI bound functionality ... and the user will  try it again
     347             :                    if the dialog is closed. But we shouldnt close the application automaticly
     348             :                    if this dialog is closed by the user ...
     349             :                    So we ignore this request now and wait for a new user decision.
     350             :                 */
     351             :                 OSL_TRACE( "QueryExit => sal_False (DispatchLevel == %u)", Application::GetDispatchLevel() );
     352             :                 return;
     353             :             }
     354             : 
     355             :             // block reentrant calls
     356           0 :             pAppData_Impl->bInQuit = sal_True;
     357           0 :             Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
     358             : 
     359           0 :             rReq.ForgetAllArgs();
     360             : 
     361             :             // if terminate() failed, pAppData_Impl->bInQuit will now be sal_False, allowing further calls of SID_QUITAPP
     362           0 :             sal_Bool bTerminated = xDesktop->terminate();
     363           0 :             if (!bTerminated)
     364             :                 // if terminate() was successful, SfxApplication is now dead!
     365           0 :                 pAppData_Impl->bInQuit = sal_False;
     366             : 
     367             :             // Set return value, terminate if possible
     368           0 :             rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bTerminated ) );
     369           0 :             return;
     370             :         }
     371             : 
     372             :         case SID_CONFIG:
     373             :         case SID_TOOLBOXOPTIONS:
     374             :         case SID_CONFIGSTATUSBAR:
     375             :         case SID_CONFIGMENU:
     376             :         case SID_CONFIGACCEL:
     377             :         case SID_CONFIGEVENT:
     378             :         {
     379             :             SfxAbstractDialogFactory* pFact =
     380           0 :                 SfxAbstractDialogFactory::Create();
     381             : 
     382           0 :             if ( pFact )
     383             :             {
     384           0 :                 SFX_REQUEST_ARG(rReq, pStringItem,
     385             :                     SfxStringItem, SID_CONFIG, sal_False);
     386             : 
     387             :                 SfxItemSet aSet(
     388           0 :                     GetPool(), SID_CONFIG, SID_CONFIG );
     389             : 
     390           0 :                 if ( pStringItem )
     391             :                 {
     392             :                     aSet.Put( SfxStringItem(
     393           0 :                         SID_CONFIG, pStringItem->GetValue() ) );
     394             :                 }
     395             : 
     396           0 :                 Reference< XFrame > xFrame;
     397           0 :                 const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl();
     398           0 :                 SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False );
     399           0 :                 if ( pFrameItem )
     400           0 :                     xFrame = pFrameItem->GetFrame();
     401             : 
     402             :                 SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog(
     403             :                     RID_SVXDLG_CUSTOMIZE,
     404           0 :                     NULL, &aSet, xFrame );
     405             : 
     406           0 :                 if ( pDlg )
     407             :                 {
     408           0 :                     const short nRet = pDlg->Execute();
     409             : 
     410           0 :                     if ( nRet )
     411           0 :                         bDone = true;
     412             : 
     413           0 :                     delete pDlg;
     414           0 :                 }
     415             :             }
     416           0 :             break;
     417             :         }
     418             : 
     419             :         case SID_CLOSEDOCS:
     420             :         case SID_CLOSEWINS:
     421             :         {
     422             : 
     423           0 :             Reference < XDesktop2 > xDesktop  = Desktop::create( ::comphelper::getProcessComponentContext() );
     424           0 :             Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY );
     425           0 :             if ( !xTasks.is() )
     426             :                 break;
     427             : 
     428           0 :             sal_Int32 n=0;
     429           0 :             do
     430             :             {
     431           0 :                 if ( xTasks->getCount() <= n )
     432             :                     break;
     433             : 
     434           0 :                 Any aAny = xTasks->getByIndex(n);
     435           0 :                 Reference < XCloseable > xTask;
     436           0 :                 aAny >>= xTask;
     437             :                 try
     438             :                 {
     439           0 :                     xTask->close(sal_True);
     440           0 :                     n++;
     441             :                 }
     442           0 :                 catch( CloseVetoException& )
     443             :                 {
     444           0 :                 }
     445             :             }
     446             :             while( sal_True );
     447             : 
     448           0 :             sal_Bool bOk = ( n == 0);
     449           0 :             rReq.SetReturnValue( SfxBoolItem( 0, bOk ) );
     450           0 :             bDone = true;
     451           0 :             break;
     452             :         }
     453             : 
     454             :         case SID_SAVEDOCS:
     455             :         {
     456           0 :             sal_Bool bOK = sal_True;
     457           0 :             for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
     458             :                   pObjSh;
     459             :                   pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
     460             :             {
     461           0 :                 SfxRequest aReq( SID_SAVEDOC, 0, pObjSh->GetPool() );
     462           0 :                 if ( pObjSh->IsModified() )
     463             :                 {
     464           0 :                     pObjSh->ExecuteSlot( aReq );
     465           0 :                     SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, aReq.GetReturnValue() );
     466           0 :                     if ( !pItem || !pItem->GetValue() )
     467           0 :                         bOK = sal_False;
     468             :                 }
     469           0 :             }
     470             : 
     471           0 :             rReq.SetReturnValue( SfxBoolItem( 0, bOK ) );
     472           0 :             rReq.Done();
     473           0 :             break;
     474             :         }
     475             : 
     476             :         case SID_SEND_FEEDBACK:
     477             :         {
     478           0 :             ::rtl::OUString module = SfxHelp::GetCurrentModuleIdentifier();
     479           0 :             ::rtl::OUString sURL("http://hub.libreoffice.org/send-feedback/?LOversion=" + utl::ConfigManager::getAboutBoxProductVersion() +
     480           0 :                 "&LOlocale=" + utl::ConfigManager::getLocale() + "&LOmodule=" + module.copy(module.lastIndexOf(".") + 1 )  );
     481             :             try
     482             :             {
     483             :                 uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
     484           0 :                     com::sun::star::system::SystemShellExecute::create(::comphelper::getProcessComponentContext()) );
     485           0 :                 xSystemShellExecute->execute( sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
     486             :             }
     487           0 :             catch ( uno::Exception& )
     488             :             {
     489             :             }
     490           0 :             break;
     491             :         }
     492             : 
     493             :         case SID_SHOW_LICENSE:
     494             :         {
     495           0 :             LicenseDialog aDialog;
     496           0 :             aDialog.Execute();
     497           0 :             break;
     498             :         }
     499             : 
     500             :         case SID_SHOW_CREDITS:
     501             :         {
     502           0 :             showDocument( "CREDITS" );
     503           0 :             break;
     504             :         }
     505             : 
     506             :         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     507             :         case SID_HELPINDEX:
     508             :         {
     509           0 :             Help* pHelp = Application::GetHelp();
     510           0 :             if ( pHelp )
     511             :             {
     512           0 :                 pHelp->Start( rtl::OUString(".uno:HelpIndex"), NULL ); // show start page
     513           0 :                 bDone = true;
     514             :             }
     515           0 :             break;
     516             :         }
     517             : 
     518             :         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     519             :         case SID_HELPTIPS:
     520             :         {
     521             :             // Evaluate Parameter
     522           0 :             SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPTIPS, sal_False);
     523             :             bool bOn = pOnItem
     524           0 :                             ? ((SfxBoolItem*)pOnItem)->GetValue()
     525           0 :                             : !Help::IsQuickHelpEnabled();
     526             : 
     527           0 :             if ( bOn )
     528           0 :                 Help::EnableQuickHelp();
     529             :             else
     530           0 :                 Help::DisableQuickHelp();
     531           0 :             SvtHelpOptions().SetHelpTips( bOn );
     532           0 :             Invalidate(SID_HELPTIPS);
     533           0 :             bDone = true;
     534             : 
     535             :             // Record if possible
     536           0 :             if ( !rReq.IsAPI() )
     537           0 :                 rReq.AppendItem( SfxBoolItem( SID_HELPTIPS, bOn) );
     538           0 :             break;
     539             :         }
     540             :         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     541             :         case SID_EXTENDEDHELP:
     542             :         {
     543           0 :             Help::StartExtHelp();
     544           0 :             break;
     545             :         }
     546             :         case SID_HELPBALLOONS:
     547             :         {
     548             :             // Evaluate Parameter
     549           0 :             SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPBALLOONS, sal_False);
     550             :             bool bOn = pOnItem
     551           0 :                             ? ((SfxBoolItem*)pOnItem)->GetValue()
     552           0 :                             : !Help::IsBalloonHelpEnabled();
     553             : 
     554           0 :             if ( bOn )
     555           0 :                 Help::EnableBalloonHelp();
     556             :             else
     557           0 :                 Help::DisableBalloonHelp();
     558           0 :             SvtHelpOptions().SetExtendedHelp( bOn );
     559           0 :             Invalidate(SID_HELPBALLOONS);
     560           0 :             bDone = true;
     561             : 
     562             :             // Record if possible
     563           0 :             if ( !rReq.IsAPI() )
     564           0 :                 rReq.AppendItem( SfxBoolItem( SID_HELPBALLOONS, bOn) );
     565           0 :             break;
     566             :         }
     567             : 
     568             :         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     569             :         case SID_HELP_PI:
     570             :         {
     571           0 :             SvtHelpOptions aHelpOpt;
     572           0 :             SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELP_PI, sal_False);
     573             :             sal_Bool bOn = pOnItem
     574           0 :                             ? ((SfxBoolItem*)pOnItem)->GetValue()
     575           0 :                             : !aHelpOpt.IsHelpAgentAutoStartMode();
     576           0 :             aHelpOpt.SetHelpAgentAutoStartMode( bOn );
     577           0 :             Invalidate(SID_HELP_PI);
     578           0 :             bDone = true;
     579           0 :             break;
     580             :         }
     581             : 
     582             :         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     583             :         case SID_ABOUT:
     584             :         {
     585           0 :             SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
     586           0 :             if ( pFact )
     587             :             {
     588           0 :                 VclAbstractDialog* pDlg = pFact->CreateVclDialog( 0, RID_DEFAULTABOUT );
     589           0 :                 pDlg->Execute();
     590           0 :                 delete pDlg;
     591           0 :                 bDone = true;
     592             :             }
     593           0 :             break;
     594             :         }
     595             : 
     596             :         case SID_TEMPLATE_MANAGER:
     597             :         {
     598           0 :             SfxTemplateManagerDlg dlg;
     599           0 :             dlg.Execute();
     600           0 :             bDone = true;
     601           0 :             break;
     602             :         }
     603             : 
     604             :         case SID_TEMPLATE_ADDRESSBOKSOURCE:
     605             :         {
     606           0 :             svt::AddressBookSourceDialog aDialog(GetTopWindow(), ::comphelper::getProcessServiceFactory());
     607           0 :             aDialog.Execute();
     608           0 :             bDone = true;
     609           0 :             break;
     610             :         }
     611             : 
     612             : #ifndef DISABLE_SCRIPTING
     613             :         case SID_BASICSTOP:
     614           0 :             StarBASIC::Stop();
     615           0 :             break;
     616             : 
     617             :         case SID_BASICBREAK :
     618           0 :             BASIC_DLL()->BasicBreak();
     619           0 :             break;
     620             : #endif
     621             : 
     622             :         case SID_CRASH :
     623             :         {
     624             :             // Provoke a crash:
     625           0 :             char * crash = 0;
     626           0 :             *crash = 0;
     627           0 :             break;
     628             :         }
     629             : 
     630             :         case SID_SHOW_IME_STATUS_WINDOW:
     631           0 :             if (pAppData_Impl->m_xImeStatusWindow->canToggle())
     632             :             {
     633             :                 SfxBoolItem const * pItem = static_cast< SfxBoolItem const * >(
     634             :                     rReq.GetArg(SID_SHOW_IME_STATUS_WINDOW, false,
     635           0 :                                 TYPE(SfxBoolItem)));
     636             :                 bool bShow = pItem == 0
     637           0 :                     ? !pAppData_Impl->m_xImeStatusWindow->isShowing()
     638           0 :                     : ( pItem->GetValue() == sal_True );
     639           0 :                 pAppData_Impl->m_xImeStatusWindow->show(bShow);
     640           0 :                 if (pItem == 0)
     641             :                     rReq.AppendItem(SfxBoolItem(SID_SHOW_IME_STATUS_WINDOW,
     642           0 :                                                 bShow));
     643             :             }
     644           0 :             bDone = true;
     645           0 :             break;
     646             : 
     647             :         case SID_ZOOM_50_PERCENT:
     648             :         case SID_ZOOM_75_PERCENT:
     649             :         case SID_ZOOM_100_PERCENT:
     650             :         case SID_ZOOM_150_PERCENT:
     651             :         case SID_ZOOM_200_PERCENT:
     652             :         case SID_ZOOM_OPTIMAL:
     653             :         case SID_ZOOM_ENTIRE_PAGE:
     654             :         case SID_ZOOM_PAGE_WIDTH:
     655             :         {
     656             :             // make sure aZoom is initialized with a proper value if SetType
     657             :             // doesn't work
     658           0 :             SvxZoomItem aZoom( SVX_ZOOM_PERCENT, 100 );
     659             : 
     660           0 :             switch (rReq.GetSlot())
     661             :             {
     662             :                 case SID_ZOOM_50_PERCENT:
     663           0 :                     aZoom.SetValue(50);
     664           0 :                     break;
     665             :                 case SID_ZOOM_75_PERCENT:
     666           0 :                     aZoom.SetValue(75);
     667           0 :                     break;
     668             :                 case SID_ZOOM_100_PERCENT:
     669           0 :                     aZoom.SetValue(100);
     670           0 :                     break;
     671             :                 case SID_ZOOM_150_PERCENT:
     672           0 :                     aZoom.SetValue(150);
     673           0 :                     break;
     674             :                 case SID_ZOOM_200_PERCENT:
     675           0 :                     aZoom.SetValue(200);
     676           0 :                     break;
     677             :                 case SID_ZOOM_OPTIMAL:
     678           0 :                     aZoom.SetType( SVX_ZOOM_OPTIMAL );
     679           0 :                     break;
     680             :                 case SID_ZOOM_ENTIRE_PAGE:
     681           0 :                     aZoom.SetType( SVX_ZOOM_WHOLEPAGE );
     682           0 :                     break;
     683             :                 case SID_ZOOM_PAGE_WIDTH:
     684           0 :                     aZoom.SetType( SVX_ZOOM_PAGEWIDTH );
     685           0 :                     break;
     686             :             }
     687             : 
     688           0 :             SfxViewFrame::Current()->GetDispatcher()->Execute(SID_ATTR_ZOOM, SFX_CALLMODE_ASYNCHRON, &aZoom, 0L);
     689             : 
     690           0 :             break;
     691             :         }
     692             :         case SID_AVAILABLE_TOOLBARS:
     693             :         {
     694             :             SfxStringItem const * pToolbarName = static_cast< SfxStringItem const *>(
     695           0 :                     rReq.GetArg(SID_AVAILABLE_TOOLBARS, false, TYPE(SfxStringItem)));
     696             : 
     697           0 :             if ( pToolbarName )
     698             :             {
     699           0 :                 Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
     700           0 :                 Reference< XFrame > xFrame = xDesktop->getActiveFrame();
     701             : 
     702           0 :                 Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
     703           0 :                 Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
     704           0 :                 if ( xPropSet.is() )
     705             :                 {
     706             :                     try
     707             :                     {
     708           0 :                         Any aValue = xPropSet->getPropertyValue( rtl::OUString( "LayoutManager" ));
     709           0 :                         aValue >>= xLayoutManager;
     710             :                     }
     711           0 :                     catch ( const ::com::sun::star::uno::RuntimeException& )
     712             :                     {
     713           0 :                         throw;
     714             :                     }
     715           0 :                     catch ( ::com::sun::star::uno::Exception& )
     716             :                     {
     717             :                     }
     718             :                 }
     719             : 
     720           0 :                 if ( xLayoutManager.is() )
     721             :                 {
     722           0 :                     rtl::OUString aToolbarResName( "private:resource/toolbar/" );
     723           0 :                     rtl::OUStringBuffer aBuf( aToolbarResName );
     724           0 :                     aBuf.append( pToolbarName->GetValue() );
     725             : 
     726             :                     // Evaluate Parameter
     727           0 :                     rtl::OUString aToolbarName( aBuf.makeStringAndClear() );
     728           0 :                     sal_Bool bShow( !xLayoutManager->isElementVisible( aToolbarName ));
     729             : 
     730           0 :                     if ( bShow )
     731             :                     {
     732           0 :                         xLayoutManager->createElement( aToolbarName );
     733           0 :                         xLayoutManager->showElement( aToolbarName );
     734             :                     }
     735             :                     else
     736           0 :                         xLayoutManager->hideElement( aToolbarName );
     737           0 :                 }
     738             :             }
     739             : 
     740           0 :             bDone = true;
     741           0 :             break;
     742             :         }
     743             : 
     744             :         default:
     745           0 :             break;
     746             :     }
     747             : 
     748           0 :     if ( bDone )
     749           0 :         rReq.Done();
     750             : }
     751             : 
     752             : //--------------------------------------------------------------------
     753             : 
     754           0 : void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
     755             : {
     756           0 :     const sal_uInt16 *pRanges = rSet.GetRanges();
     757             :     DBG_ASSERT(pRanges && *pRanges, "Set without range");
     758           0 :     while ( *pRanges )
     759             :     {
     760           0 :         for(sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich)
     761             :         {
     762           0 :             switch(nWhich)
     763             :             {
     764             :                 case SID_TEMPLATE_ADDRESSBOKSOURCE:
     765           0 :                     if ( !SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SDATABASE) )
     766           0 :                         rSet.Put(SfxVisibilityItem(nWhich, sal_False));
     767           0 :                     break;
     768             :                 case SID_EXITANDRETURN:
     769             :                 case SID_QUITAPP:
     770             :                 {
     771           0 :                     if ( pAppData_Impl->nDocModalMode )
     772           0 :                         rSet.DisableItem(nWhich);
     773             :                     else
     774           0 :                         rSet.Put(SfxStringItem(nWhich, SfxResId(STR_QUITAPP).toString()));
     775           0 :                     break;
     776             :                 }
     777             : 
     778             :                 case SID_CONFIG:
     779             :                 case SID_TOOLBOXOPTIONS:
     780             :                 case SID_CONFIGSTATUSBAR:
     781             :                 case SID_CONFIGMENU:
     782             :                 case SID_CONFIGACCEL:
     783             :                 case SID_CONFIGEVENT:
     784             :                 {
     785           0 :                     if( SvtMiscOptions().DisableUICustomization() )
     786           0 :                         rSet.DisableItem(nWhich);
     787           0 :                     break;
     788             :                 }
     789             : 
     790             : #ifndef DISABLE_SCRIPTING
     791             :                 case SID_BASICSTOP:
     792           0 :                     if ( !StarBASIC::IsRunning() )
     793           0 :                         rSet.DisableItem(nWhich);
     794           0 :                     break;
     795             : #endif
     796             : 
     797             :                 case SID_HELPTIPS:
     798             :                 {
     799           0 :                     rSet.Put( SfxBoolItem( SID_HELPTIPS, Help::IsQuickHelpEnabled() ) );
     800             :                 }
     801           0 :                 break;
     802             :                 case SID_HELPBALLOONS:
     803             :                 {
     804           0 :                     rSet.Put( SfxBoolItem( SID_HELPBALLOONS, Help::IsBalloonHelpEnabled() ) );
     805             :                 }
     806           0 :                 break;
     807             :                 case SID_HELP_PI:
     808             :                 {
     809           0 :                     rSet.Put( SfxBoolItem( SID_HELP_PI, SvtHelpOptions().IsHelpAgentAutoStartMode() ) );
     810             :                 }
     811           0 :                 break;
     812             : 
     813             :                 case SID_EXTENDEDHELP:
     814             :                 {
     815             :                 }
     816           0 :                 break;
     817             : 
     818             :                 case SID_CLOSEDOCS:
     819             :                 case SID_CLOSEWINS:
     820             :                 {
     821           0 :                     Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
     822           0 :                     Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY );
     823           0 :                     if ( !xTasks.is() || !xTasks->getCount() )
     824           0 :                         rSet.DisableItem(nWhich);
     825           0 :                     break;
     826             :                 }
     827             : 
     828             :                 case SID_SAVEDOCS:
     829             :                 {
     830           0 :                     sal_Bool bModified = sal_False;
     831           0 :                     for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
     832             :                           pObjSh;
     833             :                           pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
     834             :                     {
     835           0 :                         if ( pObjSh->IsModified() )
     836             :                         {
     837           0 :                             bModified = sal_True;
     838           0 :                             break;
     839             :                         }
     840             :                     }
     841             : 
     842           0 :                     if ( !bModified )
     843           0 :                         rSet.DisableItem( nWhich );
     844           0 :                     break;
     845             :                 }
     846             : 
     847             :                 case SID_SHOW_IME_STATUS_WINDOW:
     848           0 :                     if (pAppData_Impl->m_xImeStatusWindow->canToggle())
     849             :                         rSet.Put(SfxBoolItem(
     850             :                                      SID_SHOW_IME_STATUS_WINDOW,
     851             :                                      pAppData_Impl->m_xImeStatusWindow->
     852           0 :                                          isShowing()));
     853             :                     else
     854           0 :                         rSet.DisableItem(SID_SHOW_IME_STATUS_WINDOW);
     855           0 :                     break;
     856             : 
     857             :                 case SID_TEMPLATE_MANAGER:
     858             :                     {
     859           0 :                         SvtMiscOptions aMiscOptions;
     860           0 :                         if ( !aMiscOptions.IsExperimentalMode() )
     861             :                         {
     862           0 :                            rSet.DisableItem( nWhich );
     863           0 :                            rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
     864           0 :                         }
     865             :                     }
     866           0 :                     break;
     867             : 
     868             :                 default:
     869           0 :                     break;
     870             :             }
     871             :         }
     872             : 
     873           0 :         ++pRanges;
     874             :     }
     875           0 : }
     876             : 
     877             : #ifndef DISABLE_SCRIPTING
     878             : 
     879             : #ifndef DISABLE_DYNLOADING
     880             : 
     881             : typedef rtl_uString* (SAL_CALL *basicide_choose_macro)(XModel*, sal_Bool, rtl_uString*);
     882             : typedef void (SAL_CALL *basicide_macro_organizer)( sal_Int16 );
     883             : 
     884           0 : extern "C" { static void SAL_CALL thisModule() {} }
     885             : 
     886             : #else
     887             : 
     888             : extern "C" rtl_uString* basicide_choose_macro(XModel*, sal_Bool, rtl_uString*);
     889             : extern "C" void basicide_macro_organizer( sal_Int16 );
     890             : 
     891             : #endif
     892             : 
     893           0 : ::rtl::OUString ChooseMacro( const Reference< XModel >& rxLimitToDocument, sal_Bool bChooseOnly, const ::rtl::OUString& rMacroDesc = ::rtl::OUString() )
     894             : {
     895             : #ifndef DISABLE_DYNLOADING
     896             :     // get basctl dllname
     897           0 :     static ::rtl::OUString aLibName( SVLIBRARY( "basctl"  ) );
     898             : 
     899             :     // load module
     900             :     oslModule handleMod = osl_loadModuleRelative(
     901           0 :         &thisModule, aLibName.pData, 0 );
     902             : 
     903             :     // get symbol
     904           0 :     ::rtl::OUString aSymbol( "basicide_choose_macro"  );
     905           0 :     basicide_choose_macro pSymbol = (basicide_choose_macro) osl_getFunctionSymbol( handleMod, aSymbol.pData );
     906             : #else
     907             : #define pSymbol basicide_choose_macro
     908             : #endif
     909             : 
     910             :     // call basicide_choose_macro in basctl
     911           0 :     rtl_uString* pScriptURL = pSymbol( rxLimitToDocument.get(), bChooseOnly, rMacroDesc.pData );
     912           0 :     ::rtl::OUString aScriptURL( pScriptURL );
     913           0 :     rtl_uString_release( pScriptURL );
     914           0 :     return aScriptURL;
     915             : 
     916             : #ifdef DISABLE_DYNLOADING
     917             : #undef pSymbol
     918             : #endif
     919             : }
     920             : 
     921           0 : void MacroOrganizer( sal_Int16 nTabId )
     922             : {
     923             : #ifndef DISABLE_DYNLOADING
     924             :     // get basctl dllname
     925           0 :     static ::rtl::OUString aLibName( SVLIBRARY( "basctl"  ) );
     926             : 
     927             :     // load module
     928             :     oslModule handleMod = osl_loadModuleRelative(
     929           0 :         &thisModule, aLibName.pData, 0 );
     930             : 
     931             :     // get symbol
     932           0 :     ::rtl::OUString aSymbol( "basicide_macro_organizer"  );
     933           0 :     basicide_macro_organizer pSymbol = (basicide_macro_organizer) osl_getFunctionSymbol( handleMod, aSymbol.pData );
     934             :     // call basicide_macro_organizer in basctl
     935           0 :     pSymbol( nTabId );
     936             : #else
     937             :     basicide_macro_organizer( nTabId );
     938             : #endif
     939             : 
     940           0 : }
     941             : 
     942             : #endif
     943             : 
     944             : 
     945             : #define RID_ERRBOX_MODULENOTINSTALLED     (RID_OFA_START + 72)
     946             : 
     947         930 : ResMgr* SfxApplication::GetOffResManager_Impl()
     948             : {
     949         930 :     if ( !pAppData_Impl->pOfaResMgr )
     950          19 :         pAppData_Impl->pOfaResMgr = CreateResManager( "ofa");
     951         930 :     return pAppData_Impl->pOfaResMgr;
     952             : }
     953             : 
     954             : namespace
     955             : {
     956             : #ifndef DISABLE_SCRIPTING
     957           0 :     Window* lcl_getDialogParent( const Reference< XFrame >& _rxFrame, Window* _pFallback )
     958             :     {
     959           0 :         if ( !_rxFrame.is() )
     960           0 :             return _pFallback;
     961             : 
     962             :         try
     963             :         {
     964           0 :             Reference< awt::XWindow > xContainerWindow( _rxFrame->getContainerWindow(), UNO_SET_THROW );
     965           0 :             Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
     966             :             OSL_ENSURE( pWindow, "lcl_getDialogParent: cool, somebody implemented a VCL-less toolkit!" );
     967             : 
     968           0 :             if ( pWindow )
     969           0 :                 return pWindow->GetSystemWindow();
     970             :         }
     971           0 :         catch( const Exception& )
     972             :         {
     973             :             DBG_UNHANDLED_EXCEPTION();
     974             :         }
     975           0 :         return _pFallback;
     976             :     }
     977             : 
     978           0 :     const ::rtl::OUString& lcl_getBasicIDEServiceName()
     979             :     {
     980           0 :         static const ::rtl::OUString s_sBasicName( "com.sun.star.script.BasicIDE"  );
     981           0 :         return s_sBasicName;
     982             :     }
     983             : 
     984           0 :     SfxViewFrame* lcl_getBasicIDEViewFrame( SfxObjectShell* i_pBasicIDE )
     985             :     {
     986           0 :         SfxViewFrame* pView = SfxViewFrame::GetFirst( i_pBasicIDE );
     987           0 :         while ( pView )
     988             :         {
     989           0 :             if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == lcl_getBasicIDEServiceName() )
     990           0 :                 break;
     991           0 :             pView = SfxViewFrame::GetNext( *pView, i_pBasicIDE );
     992             :         }
     993           0 :         return pView;
     994             :     }
     995           0 :     Reference< XFrame > lcl_findStartModuleFrame( const Reference<XComponentContext> & rxContext )
     996             :     {
     997             :         try
     998             :         {
     999           0 :             Reference < XDesktop2 > xDesktop = Desktop::create( rxContext );
    1000           0 :             Reference < XIndexAccess > xContainer( xDesktop->getFrames(), UNO_QUERY_THROW );
    1001             : 
    1002           0 :             Reference< XModuleManager2 > xCheck = ModuleManager::create(rxContext);
    1003             : 
    1004           0 :             sal_Int32 nCount = xContainer->getCount();
    1005           0 :             for ( sal_Int32 i=0; i<nCount; ++i )
    1006             :             {
    1007             :                 try
    1008             :                 {
    1009           0 :                     Reference < XFrame > xFrame( xContainer->getByIndex(i), UNO_QUERY_THROW );
    1010           0 :                     ::rtl::OUString sModule = xCheck->identify( xFrame );
    1011           0 :                     if ( sModule == "com.sun.star.frame.StartModule" )
    1012           0 :                         return xFrame;
    1013             :                 }
    1014           0 :                 catch( const UnknownModuleException& )
    1015             :                 {
    1016             :                     // silence
    1017             :                 }
    1018           0 :                 catch(const Exception&)
    1019             :                 {
    1020             :                     // re-throw, caught below
    1021           0 :                     throw;
    1022             :                 }
    1023           0 :             }
    1024             :         }
    1025           0 :         catch( const Exception& )
    1026             :         {
    1027             :                DBG_UNHANDLED_EXCEPTION();
    1028             :         }
    1029           0 :         return NULL;
    1030             :     }
    1031             : #endif // !DISABLE_SCRIPTING
    1032             : }
    1033             : 
    1034           0 : static ::rtl::OUString getConfigurationStringValue(
    1035             :     const ::rtl::OUString& rPackage,
    1036             :     const ::rtl::OUString& rRelPath,
    1037             :     const ::rtl::OUString& rKey,
    1038             :     const ::rtl::OUString& rDefaultValue )
    1039             : {
    1040           0 :     ::rtl::OUString aDefVal( rDefaultValue );
    1041             : 
    1042             :     try
    1043             :     {
    1044             :         ::comphelper::ConfigurationHelper::readDirectKey(
    1045             :             comphelper::getProcessComponentContext(),
    1046             :             rPackage,
    1047             :             rRelPath,
    1048             :             rKey,
    1049           0 :             ::comphelper::ConfigurationHelper::E_READONLY) >>= aDefVal;
    1050             :     }
    1051           0 :     catch(const com::sun::star::uno::RuntimeException&)
    1052           0 :     { throw; }
    1053           0 :     catch(const com::sun::star::uno::Exception&)
    1054             :     {}
    1055             : 
    1056           0 :     return aDefVal;
    1057             : }
    1058             : 
    1059           0 : void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
    1060             : {
    1061           0 :     switch ( rReq.GetSlot() )
    1062             :     {
    1063             :         case SID_OPTIONS_TREEDIALOG:
    1064             :         {
    1065           0 :             String sPageURL;
    1066           0 :             SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, SID_OPTIONS_PAGEURL, sal_False );
    1067           0 :             if ( pURLItem )
    1068           0 :                 sPageURL = pURLItem->GetValue();
    1069           0 :             const SfxItemSet* pArgs = rReq.GetInternalArgs_Impl();
    1070           0 :             const SfxPoolItem* pItem = NULL;
    1071           0 :             Reference < XFrame > xFrame;
    1072           0 :             if ( pArgs && pArgs->GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET )
    1073             :             {
    1074             :                 OSL_ENSURE( pItem->ISA( SfxUnoFrameItem ), "SfxApplication::OfaExec_Impl: XFrames are to be transported via SfxUnoFrameItem by now!" );
    1075           0 :                 xFrame = static_cast< const SfxUnoFrameItem*>( pItem )->GetFrame();
    1076             :             }
    1077           0 :             SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
    1078           0 :             if ( pFact )
    1079             :             {
    1080             :                 VclAbstractDialog* pDlg =
    1081           0 :                     pFact->CreateFrameDialog( NULL, xFrame, rReq.GetSlot(), sPageURL );
    1082           0 :                 short nRet = pDlg->Execute();
    1083           0 :                 delete pDlg;
    1084           0 :                 SfxViewFrame* pView = SfxViewFrame::GetFirst();
    1085           0 :                 while ( pView )
    1086             :                 {
    1087           0 :                     if (nRet == RET_OK)
    1088             :                     {
    1089           0 :                         SfxObjectShell* pObjSh = pView->GetObjectShell();
    1090           0 :                         if (pObjSh)
    1091           0 :                             pObjSh->SetConfigOptionsChecked(false);
    1092             :                     }
    1093           0 :                     pView->GetBindings().InvalidateAll(sal_False);
    1094           0 :                     pView = SfxViewFrame::GetNext( *pView );
    1095             :                 }
    1096             :             }
    1097           0 :             break;
    1098             :         }
    1099             : 
    1100             :         case SID_MORE_DICTIONARIES:
    1101             :         {
    1102             :             try
    1103             :             {
    1104             :                 uno::Reference< lang::XMultiServiceFactory > xSMGR =
    1105           0 :                     ::comphelper::getProcessServiceFactory();
    1106             :                 uno::Reference< uno::XComponentContext > xContext =
    1107           0 :                     ::comphelper::getProcessComponentContext();
    1108             :                 uno::Reference< css::system::XSystemShellExecute > xSystemShell(
    1109           0 :                     css::system::SystemShellExecute::create(xContext) );
    1110             : 
    1111             :                 // read repository URL from configuration
    1112             :                 ::rtl::OUString sTemplRepoURL =
    1113             :                     getConfigurationStringValue(
    1114             :                         ::rtl::OUString("org.openoffice.Office.Common"),
    1115             :                         ::rtl::OUString("Dictionaries"),
    1116             :                         ::rtl::OUString("RepositoryURL"),
    1117           0 :                         ::rtl::OUString());
    1118             : 
    1119           0 :                 if ( xSystemShell.is() && !sTemplRepoURL.isEmpty() )
    1120             :                 {
    1121           0 :                     ::rtl::OUStringBuffer aURLBuf( sTemplRepoURL );
    1122           0 :                     aURLBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM("?lang="));
    1123             : 
    1124             :                     // read locale from configuration
    1125             :                     ::rtl::OUString sLocale = getConfigurationStringValue(
    1126             :                         ::rtl::OUString("org.openoffice.Setup"),
    1127             :                         ::rtl::OUString("L10N"),
    1128             :                         ::rtl::OUString("ooLocale"),
    1129           0 :                         ::rtl::OUString("en-US"));
    1130             : 
    1131           0 :                     aURLBuf.append( sLocale );
    1132           0 :                     xSystemShell->execute(
    1133             :                         aURLBuf.makeStringAndClear(),
    1134             :                         ::rtl::OUString(),
    1135           0 :                         css::system::SystemShellExecuteFlags::URIS_ONLY );
    1136           0 :                 }
    1137             :             }
    1138           0 :             catch( const ::com::sun::star::uno::Exception& )
    1139             :             {
    1140             :                 SAL_WARN( "sfx2.appl", "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES): caught an exception!" );
    1141             :             }
    1142           0 :             break;
    1143             :         }
    1144             : #ifndef DISABLE_SCRIPTING
    1145             :         case SID_BASICIDE_APPEAR:
    1146             :         {
    1147           0 :             SfxViewFrame* pView = lcl_getBasicIDEViewFrame( NULL );
    1148           0 :             if ( !pView )
    1149             :             {
    1150           0 :                 SfxObjectShell* pBasicIDE = SfxObjectShell::CreateObject( lcl_getBasicIDEServiceName() );
    1151           0 :                 pBasicIDE->DoInitNew( 0 );
    1152           0 :                 pBasicIDE->SetModified( sal_False );
    1153             :                 try
    1154             :                 {
    1155             :                     // load the Basic IDE via direct access to the SFX frame loader. A generic loadComponentFromURL
    1156             :                     // (which could be done via SfxViewFrame::LoadDocumentIntoFrame) is not feasible here, since the Basic IDE
    1157             :                     // does not really play nice with the framework's concept. For instance, it is a "singleton document",
    1158             :                     // which conflicts, at the latest, with the framework's concept of loading into _blank frames.
    1159             :                     // So, since we know that our frame loader can handle it, we skip the generic framework loader
    1160             :                     // mechanism, and the type detection (which doesn't know about the Basic IDE).
    1161           0 :                     ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
    1162             :                     Reference< XSynchronousFrameLoader > xLoader( aContext.createComponent(
    1163           0 :                         SfxFrameLoader_Impl::impl_getStaticImplementationName() ), UNO_QUERY_THROW );
    1164           0 :                     ::comphelper::NamedValueCollection aLoadArgs;
    1165           0 :                     aLoadArgs.put( "Model", pBasicIDE->GetModel() );
    1166           0 :                     aLoadArgs.put( "URL", ::rtl::OUString( "private:factory/sbasic"  ) );
    1167             : 
    1168           0 :                     Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( aContext.getUNOContext() ) );
    1169           0 :                     if ( !xTargetFrame.is() )
    1170           0 :                         xTargetFrame = SfxFrame::CreateBlankFrame();
    1171           0 :                     ENSURE_OR_THROW( xTargetFrame.is(), "could not obtain a frameto load the Basic IDE into!" );
    1172             : 
    1173           0 :                     xLoader->load( aLoadArgs.getPropertyValues(), xTargetFrame );
    1174             :                 }
    1175           0 :                 catch( const Exception& )
    1176             :                 {
    1177             :                     DBG_UNHANDLED_EXCEPTION();
    1178             :                 }
    1179             : 
    1180           0 :                 pView = lcl_getBasicIDEViewFrame( pBasicIDE );
    1181           0 :                 if ( pView )
    1182           0 :                     pView->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC:1" ) ) );
    1183             :             }
    1184             : 
    1185           0 :             if ( pView )
    1186           0 :                 pView->GetFrame().Appear();
    1187             : 
    1188           0 :             const SfxItemSet* pArgs = rReq.GetArgs();
    1189           0 :             if ( pArgs && pView )
    1190             :             {
    1191           0 :                 SfxViewShell* pViewShell = pView->GetViewShell();
    1192           0 :                 SfxObjectShell* pObjShell = pView->GetObjectShell();
    1193           0 :                 if ( pViewShell && pObjShell )
    1194             :                 {
    1195           0 :                     SfxRequest aReq( SID_BASICIDE_SHOWWINDOW, SFX_CALLMODE_SYNCHRON, pObjShell->GetPool() );
    1196           0 :                     aReq.SetArgs( *pArgs );
    1197           0 :                     pViewShell->ExecuteSlot( aReq );
    1198             :                 }
    1199             :             }
    1200             : 
    1201           0 :             rReq.Done();
    1202             :         }
    1203           0 :         break;
    1204             : 
    1205             :         case SID_BASICCHOOSER:
    1206             :         {
    1207           0 :             const SfxItemSet* pArgs = rReq.GetArgs();
    1208             :             const SfxPoolItem* pItem;
    1209           0 :             sal_Bool bChooseOnly = sal_False;
    1210           0 :             Reference< XModel > xLimitToModel;
    1211           0 :             if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_RECORDMACRO, sal_False, &pItem) )
    1212             :             {
    1213           0 :                 sal_Bool bRecord = ((SfxBoolItem*)pItem)->GetValue();
    1214           0 :                 if ( bRecord )
    1215             :                 {
    1216             :                     // !Hack
    1217           0 :                     bChooseOnly = sal_False;
    1218           0 :                     SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
    1219             :                     OSL_ENSURE( pCurrentShell, "macro recording outside an SFX document?" );
    1220           0 :                     if ( pCurrentShell )
    1221           0 :                         xLimitToModel = pCurrentShell->GetModel();
    1222             :                 }
    1223             :             }
    1224             : 
    1225           0 :             rReq.SetReturnValue( SfxStringItem( rReq.GetSlot(), ChooseMacro( xLimitToModel, bChooseOnly ) ) );
    1226           0 :             rReq.Done();
    1227             :         }
    1228           0 :         break;
    1229             : 
    1230             :         case SID_MACROORGANIZER:
    1231             :         {
    1232             :             OSL_TRACE("handling SID_MACROORGANIZER");
    1233           0 :             const SfxItemSet* pArgs = rReq.GetArgs();
    1234             :             const SfxPoolItem* pItem;
    1235           0 :             sal_Int16 nTabId = 0;
    1236           0 :             if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_MACROORGANIZER, sal_False, &pItem) )
    1237             :             {
    1238           0 :                 nTabId = ((SfxUInt16Item*)pItem)->GetValue();
    1239             :             }
    1240             : 
    1241           0 :             SfxApplication::MacroOrganizer( nTabId );
    1242           0 :             rReq.Done();
    1243             :         }
    1244           0 :         break;
    1245             : 
    1246             :         case SID_RUNMACRO:
    1247             :         {
    1248           0 :             SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
    1249             :             OSL_TRACE("SfxApplication::OfaExec_Impl: case ScriptOrg");
    1250             : 
    1251           0 :             Reference< XFrame > xFrame;
    1252           0 :             const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl();
    1253           0 :             SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False );
    1254           0 :             if ( pFrameItem )
    1255           0 :                 xFrame = pFrameItem->GetFrame();
    1256             : 
    1257           0 :             if ( !xFrame.is() )
    1258             :             {
    1259           0 :                 const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
    1260           0 :                 if ( pViewFrame )
    1261           0 :                     xFrame = pViewFrame->GetFrame().GetFrameInterface();
    1262             :             }
    1263             : 
    1264             :             do  // artificial loop for flow control
    1265             :             {
    1266             :                 AbstractScriptSelectorDialog* pDlg = pFact->CreateScriptSelectorDialog(
    1267           0 :                     lcl_getDialogParent( xFrame, GetTopWindow() ), sal_False, xFrame );
    1268             :                 OSL_ENSURE( pDlg, "SfxApplication::OfaExec_Impl( SID_RUNMACRO ): no dialog!" );
    1269           0 :                 if ( !pDlg )
    1270             :                     break;
    1271           0 :                 pDlg->SetRunLabel();
    1272             : 
    1273           0 :                 short nDialogResult = pDlg->Execute();
    1274           0 :                 if ( !nDialogResult )
    1275             :                 {
    1276           0 :                     delete pDlg;
    1277             :                     break;
    1278             :                 }
    1279             : 
    1280           0 :                 Sequence< Any > args;
    1281           0 :                 Sequence< sal_Int16 > outIndex;
    1282           0 :                 Sequence< Any > outArgs;
    1283           0 :                 Any ret;
    1284             : 
    1285           0 :                 Reference< XInterface > xScriptContext;
    1286             : 
    1287           0 :                 Reference< XController > xController;
    1288           0 :                 if ( xFrame.is() )
    1289           0 :                     xController = xFrame->getController();
    1290           0 :                 if ( xController.is() )
    1291           0 :                     xScriptContext = xController->getModel();
    1292           0 :                 if ( !xScriptContext.is() )
    1293           0 :                     xScriptContext = xController;
    1294             : 
    1295           0 :                 SfxObjectShell::CallXScript( xScriptContext, pDlg->GetScriptURL(), args, ret, outIndex, outArgs );
    1296           0 :                 delete pDlg;
    1297             :             }
    1298             :             while ( false );
    1299           0 :             rReq.Done();
    1300             :         }
    1301           0 :         break;
    1302             : 
    1303             :         case SID_SCRIPTORGANIZER:
    1304             :         {
    1305           0 :             SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
    1306             :             OSL_TRACE("SfxApplication::OfaExec_Impl: case ScriptOrg");
    1307           0 :             const SfxItemSet* pArgs = rReq.GetArgs();
    1308             :             const SfxPoolItem* pItem;
    1309           0 :             String aLanguage;
    1310           0 :             if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_SCRIPTORGANIZER, sal_False, &pItem) )
    1311             :             {
    1312           0 :                 aLanguage = ((SfxScriptOrganizerItem*)pItem)->getLanguage();
    1313             :             }
    1314             : 
    1315           0 :             ::rtl::OUString aLang( aLanguage );
    1316             :             OSL_TRACE("SfxApplication::OfaExec_Impl: about to create dialog for: %s", ::rtl::OUStringToOString( aLang , RTL_TEXTENCODING_ASCII_US ).pData->buffer);
    1317             :             // not sure about the Window*
    1318           0 :             VclAbstractDialog* pDlg = pFact->CreateSvxScriptOrgDialog( GetTopWindow(), aLanguage );
    1319           0 :             if( pDlg )
    1320             :             {
    1321           0 :                 pDlg->Execute();
    1322           0 :                 delete pDlg;
    1323             :             }
    1324             :             else
    1325             :             {
    1326             :                 OSL_TRACE("no dialog!!!");
    1327             :             }
    1328           0 :             rReq.Done();
    1329             :         }
    1330           0 :         break;
    1331             : #endif // !DISABLE_SCRIPTING
    1332             : 
    1333             :         case SID_OFFICE_CHECK_PLZ:
    1334             :         {
    1335           0 :             sal_Bool bRet = sal_False;
    1336           0 :             SFX_REQUEST_ARG(rReq, pStringItem, SfxStringItem, rReq.GetSlot(), sal_False);
    1337             : 
    1338           0 :             if ( pStringItem )
    1339             :             {
    1340           0 :                 String aPLZ = pStringItem->GetValue();
    1341           0 :                 bRet = sal_True /*!!!SfxIniManager::CheckPLZ( aPLZ )*/;
    1342             :             }
    1343             : #ifndef DISABLE_SCRIPTING
    1344             :             else
    1345           0 :                 SbxBase::SetError( SbxERR_WRONG_ARGS );
    1346             : #endif
    1347           0 :             rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bRet ) );
    1348             :         }
    1349           0 :         break;
    1350             : 
    1351             :         case SID_AUTO_CORRECT_DLG:
    1352             :         {
    1353           0 :             SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
    1354           0 :             if ( pFact )
    1355             :             {
    1356           0 :                 SfxItemSet aSet(GetPool(), SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG);
    1357           0 :                 const SfxPoolItem* pItem=NULL;
    1358           0 :                 const SfxItemSet* pSet = rReq.GetArgs();
    1359           0 :                 SfxItemPool* pSetPool = pSet ? pSet->GetPool() : NULL;
    1360           0 :                 if ( pSet && pSet->GetItemState( pSetPool->GetWhich( SID_AUTO_CORRECT_DLG ), sal_False, &pItem ) == SFX_ITEM_SET )
    1361           0 :                     aSet.Put( *pItem );
    1362             : 
    1363           0 :                 SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_OFA_AUTOCORR_DLG, NULL, &aSet, NULL );
    1364           0 :                 pDlg->Execute();
    1365           0 :                 delete pDlg;
    1366             :             }
    1367             : 
    1368           0 :             break;
    1369             :         }
    1370             : 
    1371             :         case SID_SD_AUTOPILOT :
    1372             :         case SID_NEWSD :
    1373             :         {
    1374           0 :             SvtModuleOptions aModuleOpt;
    1375           0 :             if ( !aModuleOpt.IsImpress() )
    1376             :             {
    1377           0 :                 ErrorBox( 0, ResId( RID_ERRBOX_MODULENOTINSTALLED, *GetOffResManager_Impl() )).Execute();
    1378           0 :                 return;
    1379             :             }
    1380             : 
    1381           0 :             Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
    1382           0 :             Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
    1383             :             Reference< com::sun::star::frame::XDispatchProvider > xProv(
    1384           0 :                 xORB->createInstance( ::rtl::OUString("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY );
    1385             : 
    1386           0 :             if ( xProv.is() )
    1387             :             {
    1388           0 :                 ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
    1389           0 :                 Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
    1390           0 :                 Sequence < com::sun::star::beans::PropertyValue > aSeq;
    1391           0 :                 if ( rReq.GetArgs() )
    1392           0 :                     TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
    1393           0 :                 Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq );
    1394           0 :                 ::com::sun::star::frame::DispatchResultEvent aEvent;
    1395             :                 sal_Bool bSuccess = (
    1396           0 :                                      (aResult >>= aEvent) &&
    1397             :                                      (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS)
    1398           0 :                                     );
    1399           0 :                 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
    1400           0 :             }
    1401             :         }
    1402           0 :         break;
    1403             : 
    1404             :         case FN_LABEL :
    1405             :         case FN_BUSINESS_CARD :
    1406             :         case FN_XFORMS_INIT :
    1407             :         {
    1408           0 :             Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
    1409           0 :             Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
    1410             :             Reference< com::sun::star::frame::XDispatchProvider > xProv(
    1411           0 :                 xORB->createInstance( ::rtl::OUString("com.sun.star.text.ModuleDispatcher")), UNO_QUERY );
    1412             : 
    1413           0 :             if ( xProv.is() )
    1414             :             {
    1415           0 :                 ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
    1416           0 :                 Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
    1417           0 :                 Sequence < com::sun::star::beans::PropertyValue > aSeq;
    1418           0 :                 if ( rReq.GetArgs() )
    1419           0 :                     TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
    1420           0 :                 Any aResult = xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aSeq );
    1421           0 :                 ::com::sun::star::frame::DispatchResultEvent aEvent;
    1422             :                 sal_Bool bSuccess = (
    1423           0 :                                      (aResult >>= aEvent) &&
    1424             :                                      (aEvent.State == ::com::sun::star::frame::DispatchResultState::SUCCESS)
    1425           0 :                                     );
    1426           0 :                 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
    1427           0 :             }
    1428             :         }
    1429           0 :         break;
    1430             : 
    1431             :         case SID_ADDRESS_DATA_SOURCE:
    1432             :         {
    1433           0 :             ::rtl::OUString sDialogServiceName( "com.sun.star.ui.dialogs.AddressBookSourcePilot"  );
    1434             :             try
    1435             :             {
    1436           0 :                 Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
    1437           0 :                 Reference< com::sun::star::ui::dialogs::XExecutableDialog > xDialog;
    1438           0 :                 if (xORB.is())
    1439           0 :                     xDialog = Reference< com::sun::star::ui::dialogs::XExecutableDialog >(xORB->createInstance(sDialogServiceName), UNO_QUERY);
    1440           0 :                 if (xDialog.is())
    1441           0 :                     xDialog->execute();
    1442             :                 else
    1443           0 :                     ShowServiceNotAvailableError(NULL, sDialogServiceName, sal_True);
    1444             :             }
    1445           0 :             catch(::com::sun::star::uno::Exception&)
    1446             :             {
    1447           0 :             }
    1448             :         }
    1449           0 :         break;
    1450             : 
    1451             :         case SID_COMP_BIBLIOGRAPHY:
    1452           0 :             lcl_tryLoadBibliography();
    1453           0 :         break;
    1454             :     }
    1455             : }
    1456             : 
    1457           0 : void SfxApplication::OfaState_Impl(SfxItemSet &rSet)
    1458             : {
    1459           0 :     SvtModuleOptions aModuleOpt;
    1460             : 
    1461           0 :     if( !aModuleOpt.IsWriter())
    1462             :     {
    1463           0 :         rSet.DisableItem( FN_LABEL );
    1464           0 :         rSet.DisableItem( FN_BUSINESS_CARD );
    1465           0 :         rSet.DisableItem( FN_XFORMS_INIT );
    1466             :     }
    1467             : 
    1468           0 :     if ( !aModuleOpt.IsImpress() )
    1469           0 :         rSet.DisableItem( SID_SD_AUTOPILOT );
    1470          66 : }
    1471             : 
    1472             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10