LCOV - code coverage report
Current view: top level - sfx2/source/appl - appbas.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 1 58 1.7 %
Date: 2014-04-14 Functions: 2 9 22.2 %
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 <config_options.h>
      21             : 
      22             : #include <com/sun/star/frame/XDesktop.hpp>
      23             : #include <com/sun/star/script/XLibraryContainer.hpp>
      24             : #include <com/sun/star/uno/Reference.h>
      25             : #include <basic/basrdll.hxx>
      26             : #include <officecfg/Office/Common.hxx>
      27             : #include <svl/macitem.hxx>
      28             : #include <basic/sbxfac.hxx>
      29             : #include <basic/sbx.hxx>
      30             : #include <vcl/gradient.hxx>
      31             : #include <svl/rectitem.hxx>
      32             : #include <svl/intitem.hxx>
      33             : #include <svl/eitem.hxx>
      34             : #include <basic/sbmod.hxx>
      35             : #include <svl/whiter.hxx>
      36             : #include <basic/sbmeth.hxx>
      37             : #include <basic/sbstar.hxx>
      38             : #include <vcl/wrkwin.hxx>
      39             : #include <vcl/msgbox.hxx>
      40             : #include <basic/sbuno.hxx>
      41             : #include <svtools/sfxecode.hxx>
      42             : #include <svtools/ehdl.hxx>
      43             : 
      44             : #include <unotools/pathoptions.hxx>
      45             : #include <unotools/useroptions.hxx>
      46             : #include <unotools/bootstrap.hxx>
      47             : 
      48             : #include <sfx2/module.hxx>
      49             : #include "arrdecl.hxx"
      50             : #include <sfx2/app.hxx>
      51             : #include "sfxtypes.hxx"
      52             : #include <sfx2/sfxresid.hxx>
      53             : #include <sfx2/msg.hxx>
      54             : #include <sfx2/msgpool.hxx>
      55             : #include <sfx2/progress.hxx>
      56             : #include <sfx2/objsh.hxx>
      57             : #include <sfx2/objitem.hxx>
      58             : #include <sfx2/viewfrm.hxx>
      59             : #include <sfx2/viewsh.hxx>
      60             : #include <sfx2/dispatch.hxx>
      61             : #include <sfx2/tplpitem.hxx>
      62             : #include <sfx2/minfitem.hxx>
      63             : #include "app.hrc"
      64             : #include <sfx2/evntconf.hxx>
      65             : #include <sfx2/request.hxx>
      66             : #include <sfx2/dinfdlg.hxx>
      67             : #include "appdata.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           0 : sal_uInt16 SfxApplication::SaveBasicAndDialogContainer() const
      90             : {
      91           0 :     if ( pAppData_Impl->pBasicManager->isValid() )
      92           0 :         pAppData_Impl->pBasicManager->storeAllLibraries();
      93           0 :     return 0;
      94             : }
      95             : 
      96           0 : BasicManager* SfxApplication::GetBasicManager()
      97             : {
      98             : #ifdef DISABLE_SCRIPTING
      99             :     return 0;
     100             : #else
     101           0 :     return BasicManagerRepository::getApplicationBasicManager( true );
     102             : #endif
     103             : }
     104             : 
     105             : 
     106             : 
     107           0 : XLibraryContainer * SfxApplication::GetDialogContainer()
     108             : {
     109             : #ifdef DISABLE_SCRIPTING
     110             :     return NULL;
     111             : #else
     112           0 :     if ( !pAppData_Impl->pBasicManager->isValid() )
     113           0 :         GetBasicManager();
     114           0 :     return pAppData_Impl->pBasicManager->getLibraryContainer( SfxBasicManagerHolder::DIALOGS );
     115             : #endif
     116             : }
     117             : 
     118             : 
     119             : 
     120           0 : XLibraryContainer * SfxApplication::GetBasicContainer()
     121             : {
     122             : #ifdef DISABLE_SCRIPTING
     123             :     return NULL;
     124             : #else
     125           0 :     if ( !pAppData_Impl->pBasicManager->isValid() )
     126           0 :         GetBasicManager();
     127           0 :     return pAppData_Impl->pBasicManager->getLibraryContainer( SfxBasicManagerHolder::SCRIPTS );
     128             : #endif
     129             : }
     130             : 
     131             : 
     132             : 
     133           0 : StarBASIC* SfxApplication::GetBasic()
     134             : {
     135             : #ifdef DISABLE_SCRIPTING
     136             :     return 0;
     137             : #else
     138           0 :     return GetBasicManager()->GetLib(0);
     139             : #endif
     140             : }
     141             : 
     142             : 
     143           0 : void SfxApplication::PropExec_Impl( SfxRequest &rReq )
     144             : {
     145             : #ifdef DISABLE_SCRIPTING
     146             :     (void) rReq;
     147             : #else
     148           0 :     rReq.GetArgs();
     149           0 :     sal_uInt16 nSID = rReq.GetSlot();
     150           0 :     switch ( nSID )
     151             :     {
     152             :         case SID_CREATE_BASICOBJECT:
     153             :         {
     154           0 :             SFX_REQUEST_ARG(rReq, pItem, SfxStringItem, nSID, false);
     155           0 :             if ( pItem )
     156             :             {
     157           0 :                 SbxObject* pObject = SbxBase::CreateObject( pItem->GetValue() );
     158           0 :                 pObject->AddRef();
     159           0 :                 rReq.Done();
     160             :             }
     161           0 :             break;
     162             :         }
     163             : 
     164             :         case SID_DELETE_BASICOBJECT:
     165             :         {
     166           0 :             break;
     167             :         }
     168             : 
     169             :         case SID_ATTR_UNDO_COUNT:
     170             :         {
     171           0 :             SFX_REQUEST_ARG(rReq, pCountItem, SfxUInt16Item, nSID, false);
     172             :             boost::shared_ptr< comphelper::ConfigurationChanges > batch(
     173           0 :                 comphelper::ConfigurationChanges::create());
     174             :             officecfg::Office::Common::Undo::Steps::set(
     175           0 :                 pCountItem->GetValue(), batch);
     176           0 :             batch->commit();
     177           0 :             break;
     178             :         }
     179             : 
     180             :         case SID_WIN_VISIBLE:
     181             :         {
     182           0 :             break;
     183             :         }
     184             : 
     185             :         case SID_OFFICE_CUSTOMERNUMBER:
     186             :         {
     187           0 :             SFX_REQUEST_ARG(rReq, pStringItem, SfxStringItem, nSID, false);
     188             : 
     189           0 :             if ( pStringItem )
     190           0 :                 SvtUserOptions().SetCustomerNumber( pStringItem->GetValue() );
     191           0 :             break;
     192             :         }
     193             :     }
     194             : #endif
     195           0 : }
     196             : 
     197             : 
     198           0 : void SfxApplication::PropState_Impl( SfxItemSet &rSet )
     199             : {
     200             : #ifdef DISABLE_SCRIPTING
     201             :     (void) rSet;
     202             : #else
     203           0 :     SfxWhichIter aIter(rSet);
     204           0 :     for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
     205             :     {
     206           0 :         switch ( nSID )
     207             :         {
     208             :             case SID_PROGNAME:
     209           0 :                 rSet.Put( SfxStringItem( SID_PROGNAME, GetName() ) );
     210           0 :                 break;
     211             : 
     212             :             case SID_ACTIVEDOCUMENT:
     213           0 :                 rSet.Put( SfxObjectItem( SID_ACTIVEDOCUMENT, SfxObjectShell::Current() ) );
     214           0 :                 break;
     215             : 
     216             :             case SID_APPLICATION:
     217           0 :                 rSet.Put( SfxObjectItem( SID_APPLICATION, this ) );
     218           0 :                 break;
     219             : 
     220             :             case SID_PROGFILENAME:
     221           0 :                 rSet.Put( SfxStringItem( SID_PROGFILENAME, Application::GetAppFileName() ) );
     222           0 :                 break;
     223             : 
     224             :             case SID_ATTR_UNDO_COUNT:
     225             :                 rSet.Put(
     226             :                     SfxUInt16Item(
     227             :                         SID_ATTR_UNDO_COUNT,
     228           0 :                         officecfg::Office::Common::Undo::Steps::get()));
     229           0 :                 break;
     230             : 
     231             :             case SID_UPDATE_VERSION:
     232           0 :                 rSet.Put( SfxUInt32Item( SID_UPDATE_VERSION, SUPD ) );
     233           0 :                 break;
     234             : 
     235             :             case SID_OFFICE_CUSTOMERNUMBER:
     236             :             {
     237           0 :                 rSet.Put( SfxStringItem( nSID, SvtUserOptions().GetCustomerNumber() ) );
     238           0 :                 break;
     239             :             }
     240             :         }
     241           0 :     }
     242             : #endif
     243           3 : }
     244             : 
     245             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10