LCOV - code coverage report
Current view: top level - sd/source/ui/slidesorter/controller - SlsTransferableData.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 34 2.9 %
Date: 2014-11-03 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 "controller/SlsTransferableData.hxx"
      21             : 
      22             : #include "SlideSorterViewShell.hxx"
      23             : #include "View.hxx"
      24             : 
      25             : namespace sd { namespace slidesorter { namespace controller {
      26             : 
      27           0 : SdTransferable* TransferableData::CreateTransferable (
      28             :     SdDrawDocument* pSrcDoc,
      29             :     ::sd::View* pWorkView,
      30             :     bool bInitOnGetData,
      31             :     SlideSorterViewShell* pViewShell,
      32             :     const ::std::vector<Representative>& rRepresentatives)
      33             : {
      34           0 :     SdTransferable* pTransferable = new SdTransferable (pSrcDoc, pWorkView, bInitOnGetData);
      35           0 :     ::boost::shared_ptr<TransferableData> pData (new TransferableData(pViewShell, rRepresentatives));
      36           0 :     pTransferable->AddUserData(pData);
      37           0 :     return pTransferable;
      38             : }
      39             : 
      40           0 : ::boost::shared_ptr<TransferableData> TransferableData::GetFromTransferable (const SdTransferable* pTransferable)
      41             : {
      42           0 :     if (pTransferable)
      43             :     {
      44           0 :         for (sal_Int32 nIndex=0,nCount=pTransferable->GetUserDataCount(); nIndex<nCount; ++nIndex)
      45             :         {
      46             :             ::boost::shared_ptr<TransferableData> xData =
      47           0 :                 ::boost::dynamic_pointer_cast<TransferableData>(pTransferable->GetUserData(nIndex));
      48           0 :             if (xData)
      49           0 :                 return xData;
      50           0 :         }
      51             :     }
      52           0 :     return ::boost::shared_ptr<TransferableData>();
      53             : }
      54             : 
      55           0 : TransferableData::TransferableData (
      56             :     SlideSorterViewShell* pViewShell,
      57             :     const ::std::vector<Representative>& rRepresentatives)
      58             :     : mpViewShell(pViewShell),
      59           0 :       maRepresentatives(rRepresentatives)
      60             : {
      61           0 :     if (mpViewShell != NULL)
      62           0 :         StartListening(*mpViewShell);
      63           0 : }
      64             : 
      65           0 : TransferableData::~TransferableData (void)
      66             : {
      67           0 :     if (mpViewShell != NULL)
      68           0 :         EndListening(*mpViewShell);
      69           0 : }
      70             : 
      71           0 : void TransferableData::DragFinished (sal_Int8 nDropAction)
      72             : {
      73           0 :     if (mpViewShell != NULL)
      74           0 :         mpViewShell->DragFinished(nDropAction);
      75             :     /*
      76             :     for (CallbackContainer::const_iterator
      77             :              iCallback(maDragFinishCallbacks.begin()),
      78             :              iEnd(maDragFinishCallbacks.end());
      79             :          iCallback!=iEnd;
      80             :          ++iCallback)
      81             :     {
      82             :         if (*iCallback)
      83             :             (*iCallback)(nDropAction);
      84             :     }
      85             :     maDragFinishCallbacks.clear();
      86             :     */
      87           0 : }
      88             : 
      89           0 : void TransferableData::Notify (SfxBroadcaster&, const SfxHint& rHint)
      90             : {
      91           0 :     const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
      92           0 :     if (pSimpleHint && mpViewShell)
      93             :     {
      94           0 :         if (pSimpleHint->GetId() == SFX_HINT_DYING)
      95             :         {
      96             :             // This hint may come either from the ViewShell or from the
      97             :             // document (registered by SdTransferable).  We do not know
      98             :             // which but both are sufficient to disconnect from the
      99             :             // ViewShell.
     100           0 :             EndListening(*mpViewShell);
     101           0 :             mpViewShell = NULL;
     102             :         }
     103             :     }
     104           0 : }
     105             : 
     106         114 : } } } // end of namespace ::sd::slidesorter::controller
     107             : 
     108             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10