LCOV - code coverage report
Current view: top level - sfx2/source/appl - appserv.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 20 601 3.3 %
Date: 2012-08-25 Functions: 2 22 9.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 22 1393 1.6 %

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

Generated by: LCOV version 1.10