LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sfx2/source/appl - appbas.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 13 64 20.3 %
Date: 2013-07-09 Functions: 6 10 60.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/frame/XDesktop.hpp>
      21             : #include <com/sun/star/script/XLibraryContainer.hpp>
      22             : #include <com/sun/star/uno/Reference.h>
      23             : #include <basic/basrdll.hxx>
      24             : #include <officecfg/Office/Common.hxx>
      25             : #include <svl/macitem.hxx>
      26             : #include <basic/sbxfac.hxx>
      27             : #include <basic/sbx.hxx>
      28             : #include <vcl/gradient.hxx>
      29             : #include <svl/rectitem.hxx>
      30             : #include <svl/intitem.hxx>
      31             : #include <svl/eitem.hxx>
      32             : #include <basic/sbmod.hxx>
      33             : #include <svl/whiter.hxx>
      34             : #include <basic/sbmeth.hxx>
      35             : #include <basic/sbstar.hxx>
      36             : #include <vcl/wrkwin.hxx>
      37             : #include <vcl/msgbox.hxx>
      38             : #include <basic/sbuno.hxx>
      39             : #include <svtools/sfxecode.hxx>
      40             : #include <svtools/ehdl.hxx>
      41             : 
      42             : #include <unotools/pathoptions.hxx>
      43             : #include <unotools/useroptions.hxx>
      44             : #include <unotools/bootstrap.hxx>
      45             : 
      46             : #include <sfx2/appuno.hxx>
      47             : #include <sfx2/module.hxx>
      48             : #include "arrdecl.hxx"
      49             : #include <sfx2/app.hxx>
      50             : #include "sfxtypes.hxx"
      51             : #include "sfx2/sfxresid.hxx"
      52             : #include <sfx2/msg.hxx>
      53             : #include <sfx2/msgpool.hxx>
      54             : #include <sfx2/progress.hxx>
      55             : #include <sfx2/objsh.hxx>
      56             : #include <sfx2/objitem.hxx>
      57             : #include <sfx2/viewfrm.hxx>
      58             : #include <sfx2/viewsh.hxx>
      59             : #include <sfx2/dispatch.hxx>
      60             : #include "sfx2/tplpitem.hxx"
      61             : #include "sfx2/minfitem.hxx"
      62             : #include "app.hrc"
      63             : #include <sfx2/evntconf.hxx>
      64             : #include <sfx2/request.hxx>
      65             : #include <sfx2/dinfdlg.hxx>
      66             : #include "appdata.hxx"
      67             : #include "appbas.hxx"
      68             : #include "sfx2/sfxhelp.hxx"
      69             : #include <basic/basmgr.hxx>
      70             : #include <svtools/svtools.hrc>
      71             : #include "sorgitm.hxx"
      72             : #include "appbaslib.hxx"
      73             : #include <basic/basicmanagerrepository.hxx>
      74             : 
      75             : #include <svl/srchitem.hxx>
      76             : #include <osl/socket.hxx>
      77             : 
      78             : #define SFX_TYPEMAP
      79             : #include "sfxslots.hxx"
      80             : 
      81             : using namespace ::com::sun::star;
      82             : using namespace ::com::sun::star::uno;
      83             : using namespace ::com::sun::star::frame;
      84             : using namespace ::com::sun::star::script;
      85             : 
      86             : using ::basic::BasicManagerRepository;
      87             : 
      88             : //=========================================================================
      89          83 : sal_uInt16 SfxApplication::SaveBasicAndDialogContainer() const
      90             : {
      91          83 :     if ( pAppData_Impl->pBasicManager->isValid() )
      92          31 :         pAppData_Impl->pBasicManager->storeAllLibraries();
      93          83 :     return 0;
      94             : }
      95             : 
      96             : //--------------------------------------------------------------------
      97             : 
      98           0 : SbxVariable* MakeVariable( StarBASIC *pBas, SbxObject *pObject,
      99             :            const char *pName, sal_uInt32 nSID, SbxDataType eType, SbxClassType eClassType )
     100             : {
     101             : #ifdef DISABLE_SCRIPTING
     102             :     (void) pBas;
     103             :     (void) pObject;
     104             :     (void) pName;
     105             :     (void) nSID;
     106             :     (void) eType;
     107             :     (void) eClassType;
     108             :     return 0;
     109             : #else
     110           0 :     SbxVariable *pVar = pBas->Make( OUString::createFromAscii(pName), eClassType, eType ); //SbxCLASS_PROPERTY
     111           0 :     pVar->SetUserData( nSID );
     112           0 :     pVar->SetFlag( SBX_DONTSTORE );
     113           0 :     pObject->StartListening( pVar->GetBroadcaster() );
     114           0 :     return pVar;
     115             : #endif
     116             : }
     117             : 
     118             : //--------------------------------------------------------------------
     119             : 
     120        4152 : BasicManager* SfxApplication::GetBasicManager()
     121             : {
     122             : #ifdef DISABLE_SCRIPTING
     123             :     return 0;
     124             : #else
     125        4152 :     return BasicManagerRepository::getApplicationBasicManager( true );
     126             : #endif
     127             : }
     128             : 
     129             : //--------------------------------------------------------------------
     130             : 
     131           0 : Reference< XLibraryContainer > SfxApplication::GetDialogContainer()
     132             : {
     133             : #ifdef DISABLE_SCRIPTING
     134             :     Reference< XLibraryContainer >  dummy;
     135             :     return dummy;
     136             : #else
     137           0 :     if ( !pAppData_Impl->pBasicManager->isValid() )
     138           0 :         GetBasicManager();
     139           0 :     return pAppData_Impl->pBasicManager->getLibraryContainer( SfxBasicManagerHolder::DIALOGS );
     140             : #endif
     141             : }
     142             : 
     143             : //--------------------------------------------------------------------
     144             : 
     145          37 : Reference< XLibraryContainer > SfxApplication::GetBasicContainer()
     146             : {
     147             : #ifdef DISABLE_SCRIPTING
     148             :     Reference< XLibraryContainer >  dummy;
     149             :     return dummy;
     150             : #else
     151          37 :     if ( !pAppData_Impl->pBasicManager->isValid() )
     152           2 :         GetBasicManager();
     153          37 :     return pAppData_Impl->pBasicManager->getLibraryContainer( SfxBasicManagerHolder::SCRIPTS );
     154             : #endif
     155             : }
     156             : 
     157             : //--------------------------------------------------------------------
     158             : 
     159        1715 : StarBASIC* SfxApplication::GetBasic()
     160             : {
     161             : #ifdef DISABLE_SCRIPTING
     162             :     return 0;
     163             : #else
     164        1715 :     return GetBasicManager()->GetLib(0);
     165             : #endif
     166             : }
     167             : 
     168             : //-------------------------------------------------------------------------
     169           0 : void SfxApplication::PropExec_Impl( SfxRequest &rReq )
     170             : {
     171             : #ifdef DISABLE_SCRIPTING
     172             :     (void) rReq;
     173             : #else
     174           0 :     rReq.GetArgs();
     175           0 :     sal_uInt16 nSID = rReq.GetSlot();
     176           0 :     switch ( nSID )
     177             :     {
     178             :         case SID_CREATE_BASICOBJECT:
     179             :         {
     180           0 :             SFX_REQUEST_ARG(rReq, pItem, SfxStringItem, nSID, sal_False);
     181           0 :             if ( pItem )
     182             :             {
     183           0 :                 SbxObject* pObject = SbxBase::CreateObject( pItem->GetValue() );
     184           0 :                 pObject->AddRef();
     185           0 :                 rReq.Done();
     186             :             }
     187           0 :             break;
     188             :         }
     189             : 
     190             :         case SID_DELETE_BASICOBJECT:
     191             :         {
     192           0 :             break;
     193             :         }
     194             : 
     195             :         case SID_ATTR_UNDO_COUNT:
     196             :         {
     197           0 :             SFX_REQUEST_ARG(rReq, pCountItem, SfxUInt16Item, nSID, sal_False);
     198             :             boost::shared_ptr< comphelper::ConfigurationChanges > batch(
     199           0 :                 comphelper::ConfigurationChanges::create());
     200             :             officecfg::Office::Common::Undo::Steps::set(
     201           0 :                 pCountItem->GetValue(), batch);
     202           0 :             batch->commit();
     203           0 :             break;
     204             :         }
     205             : 
     206             :         case SID_WIN_VISIBLE:
     207             :         {
     208           0 :             break;
     209             :         }
     210             : 
     211             :         case SID_OFFICE_CUSTOMERNUMBER:
     212             :         {
     213           0 :             SFX_REQUEST_ARG(rReq, pStringItem, SfxStringItem, nSID, sal_False);
     214             : 
     215           0 :             if ( pStringItem )
     216           0 :                 SvtUserOptions().SetCustomerNumber( pStringItem->GetValue() );
     217           0 :             break;
     218             :         }
     219             :     }
     220             : #endif
     221           0 : }
     222             : 
     223             : //-------------------------------------------------------------------------
     224           0 : void SfxApplication::PropState_Impl( SfxItemSet &rSet )
     225             : {
     226             : #ifdef DISABLE_SCRIPTING
     227             :     (void) rSet;
     228             : #else
     229           0 :     SfxWhichIter aIter(rSet);
     230           0 :     for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
     231             :     {
     232           0 :         switch ( nSID )
     233             :         {
     234             :             case SID_PROGNAME:
     235           0 :                 rSet.Put( SfxStringItem( SID_PROGNAME, GetName() ) );
     236           0 :                 break;
     237             : 
     238             :             case SID_ACTIVEDOCUMENT:
     239           0 :                 rSet.Put( SfxObjectItem( SID_ACTIVEDOCUMENT, SfxObjectShell::Current() ) );
     240           0 :                 break;
     241             : 
     242             :             case SID_APPLICATION:
     243           0 :                 rSet.Put( SfxObjectItem( SID_APPLICATION, this ) );
     244           0 :                 break;
     245             : 
     246             :             case SID_PROGFILENAME:
     247           0 :                 rSet.Put( SfxStringItem( SID_PROGFILENAME, Application::GetAppFileName() ) );
     248           0 :                 break;
     249             : 
     250             :             case SID_ATTR_UNDO_COUNT:
     251             :                 rSet.Put(
     252             :                     SfxUInt16Item(
     253             :                         SID_ATTR_UNDO_COUNT,
     254           0 :                         officecfg::Office::Common::Undo::Steps::get()));
     255           0 :                 break;
     256             : 
     257             :             case SID_UPDATE_VERSION:
     258           0 :                 rSet.Put( SfxUInt32Item( SID_UPDATE_VERSION, SUPD ) );
     259           0 :                 break;
     260             : 
     261             :             case SID_OFFICE_CUSTOMERNUMBER:
     262             :             {
     263           0 :                 rSet.Put( SfxStringItem( nSID, SvtUserOptions().GetCustomerNumber() ) );
     264           0 :                 break;
     265             :             }
     266             :         }
     267           0 :     }
     268             : #endif
     269         408 : }
     270             : 
     271             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10