LCOV - code coverage report
Current view: top level - framework/source/accelerators - globalacceleratorconfiguration.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 17 23 73.9 %
Date: 2012-08-25 Functions: 12 18 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 21 119 17.6 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <accelerators/globalacceleratorconfiguration.hxx>
      30                 :            : 
      31                 :            : #include <threadhelp/readguard.hxx>
      32                 :            : #include <threadhelp/writeguard.hxx>
      33                 :            : #include "helper/mischelper.hxx"
      34                 :            : 
      35                 :            : #include <acceleratorconst.h>
      36                 :            : #include <services.h>
      37                 :            : 
      38                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      39                 :            : #include <com/sun/star/embed/ElementModes.hpp>
      40                 :            : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      41                 :            : #include <com/sun/star/container/XNameAccess.hpp>
      42                 :            : #include <com/sun/star/util/XChangesNotifier.hpp>
      43                 :            : 
      44                 :            : #include <vcl/svapp.hxx>
      45                 :            : #include <comphelper/locale.hxx>
      46                 :            : #include <comphelper/configurationhelper.hxx>
      47                 :            : 
      48                 :            : 
      49                 :            : namespace framework
      50                 :            : {
      51                 :            : 
      52                 :            : //-----------------------------------------------
      53                 :            : // XInterface, XTypeProvider, XServiceInfo
      54 [ +  - ][ +  - ]:     202536 : DEFINE_XINTERFACE_2(GlobalAcceleratorConfiguration           ,
      55                 :            :                     XCUBasedAcceleratorConfiguration                 ,
      56                 :            :                     DIRECT_INTERFACE(css::lang::XServiceInfo),
      57                 :            :                     DIRECT_INTERFACE(css::lang::XInitialization))
      58 [ #  # ][ #  # ]:          0 : DEFINE_XTYPEPROVIDER_2_WITH_BASECLASS(GlobalAcceleratorConfiguration,
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      59                 :            :                                       XCUBasedAcceleratorConfiguration      ,
      60                 :            :                                       css::lang::XServiceInfo       ,
      61                 :            :                                       css::lang::XInitialization)
      62                 :            : 
      63 [ +  - ][ +  - ]:       4305 : DEFINE_XSERVICEINFO_MULTISERVICE(GlobalAcceleratorConfiguration                   ,
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
                 [ #  # ]
      64                 :            :                                  ::cppu::OWeakObject                              ,
      65                 :            :                                  SERVICENAME_GLOBALACCELERATORCONFIGURATION       ,
      66                 :            :                                  IMPLEMENTATIONNAME_GLOBALACCELERATORCONFIGURATION)
      67                 :            : 
      68                 :       2560 : DEFINE_INIT_SERVICE(GlobalAcceleratorConfiguration,
      69                 :            :                     {
      70                 :            :                         /*Attention
      71                 :            :                         I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance()
      72                 :            :                         to create a new instance of this class by our own supported service factory.
      73                 :            :                         see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further informations!
      74                 :            :                         */
      75                 :            :                         impl_ts_fillCache();
      76                 :            :                     }
      77                 :            :                    )
      78                 :            : 
      79                 :            : //-----------------------------------------------
      80                 :       2560 : GlobalAcceleratorConfiguration::GlobalAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR)
      81         [ +  - ]:       2560 :     : XCUBasedAcceleratorConfiguration(xSMGR)
      82                 :            : {
      83                 :       2560 : }
      84                 :            : 
      85                 :            : //-----------------------------------------------
      86                 :       2560 : GlobalAcceleratorConfiguration::~GlobalAcceleratorConfiguration()
      87                 :            : {
      88         [ -  + ]:       5120 : }
      89                 :            : 
      90                 :          0 : void SAL_CALL GlobalAcceleratorConfiguration::initialize(const css::uno::Sequence< css::uno::Any >& /*lArguments*/)
      91                 :            :     throw(css::uno::Exception       ,
      92                 :            :           css::uno::RuntimeException)
      93                 :            : {
      94                 :          0 : }
      95                 :            : 
      96                 :            : //-----------------------------------------------
      97                 :       2560 : void GlobalAcceleratorConfiguration::impl_ts_fillCache()
      98                 :            : {
      99                 :            :     // get current office locale ... but dont cache it.
     100                 :            :     // Otherwise we must be listener on the configuration layer
     101                 :            :     // which seems to superflous for this small implementation .-)
     102         [ +  - ]:       2560 :     ::comphelper::Locale aLocale = ::comphelper::Locale(m_sLocale);
     103                 :            : 
     104                 :            :     // May be there exists no accelerator config? Handle it gracefully :-)
     105                 :            :     try
     106                 :            :     {
     107                 :       2560 :         m_sGlobalOrModules = CFG_ENTRY_GLOBAL;
     108         [ +  - ]:       2560 :         XCUBasedAcceleratorConfiguration::reload();
     109                 :            : 
     110         [ +  - ]:       2560 :         css::uno::Reference< css::util::XChangesNotifier > xBroadcaster(m_xCfg, css::uno::UNO_QUERY_THROW);
     111 [ +  - ][ +  - ]:       2560 :         m_xCfgListener = new WeakChangesListener(this);
         [ +  - ][ +  - ]
     112 [ +  - ][ +  - ]:       2560 :         xBroadcaster->addChangesListener(m_xCfgListener);
     113                 :            :     }
     114      [ #  #  # ]:          0 :     catch(const css::uno::RuntimeException&)
     115                 :          0 :         { throw; }
     116         [ #  # ]:          0 :     catch(const css::uno::Exception&)
     117         [ +  - ]:       2560 :         {}
     118                 :       2560 : }
     119                 :            : 
     120                 :            : } // namespace framework
     121                 :            : 
     122                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10