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

Generated by: LCOV version 1.10