LCOV - code coverage report
Current view: top level - svtools/source/misc - stringtransfer.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 32 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 36 0.0 %

           Branch data     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 <svtools/stringtransfer.hxx>
      21                 :            : 
      22                 :            : //........................................................................
      23                 :            : namespace svt
      24                 :            : {
      25                 :            : //........................................................................
      26                 :            : 
      27                 :            :     using namespace ::com::sun::star::uno;
      28                 :            :     using namespace ::com::sun::star::datatransfer;
      29                 :            : 
      30                 :            :     //====================================================================
      31                 :            :     //= OStringTransferable
      32                 :            :     //====================================================================
      33                 :            :     //--------------------------------------------------------------------
      34                 :          0 :     OStringTransferable::OStringTransferable(const ::rtl::OUString& _rContent)
      35                 :            :         :TransferableHelper()
      36                 :          0 :         ,m_sContent( _rContent )
      37                 :            :     {
      38                 :          0 :     }
      39                 :            : 
      40                 :            :     //--------------------------------------------------------------------
      41                 :          0 :     void OStringTransferable::AddSupportedFormats()
      42                 :            :     {
      43                 :          0 :         AddFormat(SOT_FORMAT_STRING);
      44                 :          0 :     }
      45                 :            : 
      46                 :            :     //--------------------------------------------------------------------
      47                 :          0 :     sal_Bool OStringTransferable::GetData( const DataFlavor& _rFlavor )
      48                 :            :     {
      49                 :          0 :         sal_uInt32 nFormat = SotExchange::GetFormat( _rFlavor );
      50         [ #  # ]:          0 :         if (SOT_FORMAT_STRING == nFormat)
      51                 :          0 :             return SetString( m_sContent, _rFlavor );
      52                 :            : 
      53                 :          0 :         return sal_False;
      54                 :            :     }
      55                 :            : 
      56                 :            :     //====================================================================
      57                 :            :     //= OStringTransfer
      58                 :            :     //====================================================================
      59                 :            :     //--------------------------------------------------------------------
      60                 :          0 :     void OStringTransfer::CopyString( const ::rtl::OUString& _rContent, Window* _pWindow )
      61                 :            :     {
      62         [ #  # ]:          0 :         OStringTransferable* pTransferable = new OStringTransferable( _rContent );
      63 [ #  # ][ #  # ]:          0 :         Reference< XTransferable > xTransfer = pTransferable;
      64         [ #  # ]:          0 :         pTransferable->CopyToClipboard( _pWindow );
      65                 :          0 :     }
      66                 :            : 
      67                 :            :     //--------------------------------------------------------------------
      68                 :          0 :     sal_Bool OStringTransfer::PasteString( ::rtl::OUString& _rContent, Window* _pWindow )
      69                 :            :     {
      70         [ #  # ]:          0 :         TransferableDataHelper aClipboardData = TransferableDataHelper::CreateFromSystemClipboard( _pWindow );
      71                 :            : 
      72                 :            :         // check for a string format
      73                 :          0 :         const DataFlavorExVector& rFormats = aClipboardData.GetDataFlavorExVector();
      74 [ #  # ][ #  # ]:          0 :         for (   DataFlavorExVector::const_iterator aSearch = rFormats.begin();
      75                 :          0 :                 aSearch != rFormats.end();
      76                 :            :                 ++aSearch
      77                 :            :             )
      78                 :            :         {
      79         [ #  # ]:          0 :             if (SOT_FORMAT_STRING == aSearch->mnSotId)
      80                 :            :             {
      81         [ #  # ]:          0 :                 String sContent;
      82         [ #  # ]:          0 :                 sal_Bool bSuccess = aClipboardData.GetString( SOT_FORMAT_STRING, sContent );
      83         [ #  # ]:          0 :                 _rContent = sContent;
      84         [ #  # ]:          0 :                 return bSuccess;
      85                 :            :             }
      86                 :            :         }
      87                 :            : 
      88         [ #  # ]:          0 :         return sal_False;
      89                 :            :     }
      90                 :            : 
      91                 :            :     //--------------------------------------------------------------------
      92                 :          0 :     void OStringTransfer::StartStringDrag( const ::rtl::OUString& _rContent, Window* _pWindow, sal_Int8 _nDragSourceActions )
      93                 :            :     {
      94         [ #  # ]:          0 :         OStringTransferable* pTransferable = new OStringTransferable( _rContent );
      95 [ #  # ][ #  # ]:          0 :         Reference< XTransferable > xTransfer = pTransferable;
      96         [ #  # ]:          0 :         pTransferable->StartDrag(_pWindow, _nDragSourceActions);
      97                 :          0 :     }
      98                 :            : 
      99                 :            : //........................................................................
     100                 :            : }   // namespace svt
     101                 :            : //........................................................................
     102                 :            : 
     103                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10