LCOV - code coverage report
Current view: top level - svx/source/sidebar - SelectionChangeHandler.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 30 0.0 %
Date: 2014-04-14 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * This file is part of the LibreOffice project.
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       7             :  *
       8             :  * This file incorporates work covered by the following license notice:
       9             :  *
      10             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      11             :  *   contributor license agreements. See the NOTICE file distributed
      12             :  *   with this work for additional information regarding copyright
      13             :  *   ownership. The ASF licenses this file to you under the Apache
      14             :  *   License, Version 2.0 (the "License"); you may not use this file
      15             :  *   except in compliance with the License. You may obtain a copy of
      16             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      17             :  */
      18             : #include "svx/sidebar/SelectionChangeHandler.hxx"
      19             : #include "svx/sidebar/SelectionAnalyzer.hxx"
      20             : #include "svx/sidebar/ContextChangeEventMultiplexer.hxx"
      21             : #include "svx/svdmrkv.hxx"
      22             : 
      23             : #include <sfx2/sidebar/EnumContext.hxx>
      24             : #include <sfx2/shell.hxx>
      25             : 
      26             : 
      27             : using namespace css;
      28             : using namespace cssu;
      29             : 
      30             : using namespace sfx2::sidebar;
      31             : 
      32             : namespace svx { namespace sidebar {
      33             : 
      34           0 : SelectionChangeHandler::SelectionChangeHandler (
      35             :     const boost::function<rtl::OUString(void)>& rSelectionChangeCallback,
      36             :     const Reference<frame::XController>& rxController,
      37             :     const EnumContext::Context eDefaultContext)
      38             :     : SelectionChangeHandlerInterfaceBase(m_aMutex),
      39             :       maSelectionChangeCallback(rSelectionChangeCallback),
      40             :       mxController(rxController),
      41             :       meDefaultContext(eDefaultContext),
      42           0 :       mbIsConnected(false)
      43             : {
      44           0 : }
      45             : 
      46             : 
      47             : 
      48             : 
      49           0 : SelectionChangeHandler::~SelectionChangeHandler (void)
      50             : {
      51           0 : }
      52             : 
      53             : 
      54             : 
      55             : 
      56           0 : void SAL_CALL SelectionChangeHandler::selectionChanged (const lang::EventObject&)
      57             :     throw (uno::RuntimeException, std::exception)
      58             : {
      59           0 :     if (maSelectionChangeCallback)
      60             :     {
      61             :         const EnumContext::Context eContext (
      62           0 :             EnumContext::GetContextEnum(maSelectionChangeCallback()));
      63             :         ContextChangeEventMultiplexer::NotifyContextChange(
      64             :             mxController,
      65             :             eContext==EnumContext::Context_Unknown
      66             :                 ? meDefaultContext
      67           0 :                 : eContext);
      68             :     }
      69           0 : }
      70             : 
      71             : 
      72             : 
      73             : 
      74           0 : void SAL_CALL SelectionChangeHandler::disposing (const lang::EventObject&)
      75             :     throw (uno::RuntimeException, std::exception)
      76             : {
      77           0 : }
      78             : 
      79             : 
      80             : 
      81             : 
      82           0 : void SAL_CALL SelectionChangeHandler::disposing (void)
      83             :     throw (uno::RuntimeException)
      84             : {
      85           0 :     if (mbIsConnected)
      86           0 :         Disconnect();
      87           0 : }
      88             : 
      89             : 
      90             : 
      91             : 
      92           0 : void SelectionChangeHandler::Connect (void)
      93             : {
      94           0 :     uno::Reference<view::XSelectionSupplier> xSupplier (mxController, uno::UNO_QUERY);
      95           0 :     if (xSupplier.is())
      96             :     {
      97           0 :         mbIsConnected = true;
      98           0 :         xSupplier->addSelectionChangeListener(this);
      99           0 :     }
     100           0 : }
     101             : 
     102             : 
     103             : 
     104             : 
     105           0 : void SelectionChangeHandler::Disconnect (void)
     106             : {
     107           0 :     uno::Reference<view::XSelectionSupplier> xSupplier (mxController, uno::UNO_QUERY);
     108           0 :     if (xSupplier.is())
     109             :     {
     110           0 :         mbIsConnected = false;
     111           0 :         xSupplier->removeSelectionChangeListener(this);
     112           0 :     }
     113           0 : }
     114             : 
     115             : 
     116             : } } // end of namespace svx::sidebar

Generated by: LCOV version 1.10