LCOV - code coverage report
Current view: top level - sd/source/ui/framework/configuration - GenericConfigurationChangeRequest.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 15 21 71.4 %
Date: 2015-06-13 12:38:46 Functions: 6 8 75.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 "GenericConfigurationChangeRequest.hxx"
      21             : 
      22             : #include "framework/FrameworkHelper.hxx"
      23             : 
      24             : using namespace ::com::sun::star;
      25             : using namespace ::com::sun::star::uno;
      26             : using namespace ::com::sun::star::drawing::framework;
      27             : 
      28             : namespace sd { namespace framework {
      29             : 
      30        1759 : GenericConfigurationChangeRequest::GenericConfigurationChangeRequest (
      31             :     const Reference<XResourceId>& rxResourceId,
      32             :     const Mode eMode) throw(::com::sun::star::lang::IllegalArgumentException)
      33             :     : GenericConfigurationChangeRequestInterfaceBase(MutexOwner::maMutex),
      34             :       mxResourceId(rxResourceId),
      35        1759 :       meMode(eMode)
      36             : {
      37        1759 :     if ( ! rxResourceId.is() || rxResourceId->getResourceURL().isEmpty())
      38           0 :         throw ::com::sun::star::lang::IllegalArgumentException();
      39        1759 : }
      40             : 
      41        3518 : GenericConfigurationChangeRequest::~GenericConfigurationChangeRequest() throw()
      42             : {
      43        3518 : }
      44             : 
      45        1701 : void SAL_CALL GenericConfigurationChangeRequest::execute (
      46             :     const Reference<XConfiguration>& rxConfiguration)
      47             :     throw (RuntimeException, std::exception)
      48             : {
      49        1701 :     if (rxConfiguration.is())
      50             :     {
      51        1701 :         switch (meMode)
      52             :         {
      53             :             case Activation:
      54         685 :                 rxConfiguration->addResource(mxResourceId);
      55         685 :                 break;
      56             : 
      57             :             case Deactivation:
      58        1016 :                 rxConfiguration->removeResource(mxResourceId);
      59        1016 :                 break;
      60             :         }
      61             :     }
      62        1701 : }
      63             : 
      64           0 : OUString SAL_CALL GenericConfigurationChangeRequest::getName()
      65             :     throw (RuntimeException, std::exception)
      66             : {
      67             :     return "GenericConfigurationChangeRequest "
      68           0 :         + (meMode==Activation ? OUString("activate ") : OUString("deactivate "))
      69           0 :         + FrameworkHelper::ResourceIdToString(mxResourceId);
      70             : }
      71             : 
      72           0 : void SAL_CALL GenericConfigurationChangeRequest::setName (const OUString& rsName)
      73             :     throw (RuntimeException, std::exception)
      74             : {
      75             :     (void)rsName;
      76             :     // Ignored.
      77           0 : }
      78             : 
      79          66 : } } // end of namespace sd::framework
      80             : 
      81             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11