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

Generated by: LCOV version 1.10