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

Generated by: LCOV version 1.10