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

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <vcl/unohelp2.hxx>
      30                 :            : #include <sot/exchange.hxx>
      31                 :            : #include <sot/formats.hxx>
      32                 :            : #include <tools/debug.hxx>
      33                 :            : #include <vcl/svapp.hxx>
      34                 :            : #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
      35                 :            : #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
      36                 :            : 
      37                 :            : 
      38                 :            : using namespace ::com::sun::star;
      39                 :            : 
      40                 :            : namespace vcl { namespace unohelper {
      41                 :            : 
      42         [ #  # ]:          0 :     TextDataObject::TextDataObject( const String& rText ) : maText( rText )
      43                 :            :     {
      44                 :          0 :     }
      45                 :            : 
      46 [ #  # ][ #  # ]:          0 :     TextDataObject::~TextDataObject()
      47                 :            :     {
      48         [ #  # ]:          0 :     }
      49                 :            : 
      50                 :          0 :     void TextDataObject::CopyStringTo( const String& rContent,
      51                 :            :         const uno::Reference< datatransfer::clipboard::XClipboard >& rxClipboard )
      52                 :            :     {
      53                 :            :         DBG_ASSERT( rxClipboard.is(), "TextDataObject::CopyStringTo: invalid clipboard!" );
      54         [ #  # ]:          0 :         if ( !rxClipboard.is() )
      55                 :          0 :             return;
      56                 :            : 
      57         [ #  # ]:          0 :         TextDataObject* pDataObj = new TextDataObject( rContent );
      58                 :            : 
      59                 :          0 :         const sal_uInt32 nRef = Application::ReleaseSolarMutex();
      60                 :            :         try
      61                 :            :         {
      62 [ #  # ][ #  # ]:          0 :             rxClipboard->setContents( pDataObj, NULL );
         [ #  # ][ #  # ]
      63                 :            : 
      64         [ #  # ]:          0 :             uno::Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( rxClipboard, uno::UNO_QUERY );
      65         [ #  # ]:          0 :             if( xFlushableClipboard.is() )
      66 [ #  # ][ #  # ]:          0 :                 xFlushableClipboard->flushClipboard();
                 [ #  # ]
      67                 :            :         }
      68                 :          0 :         catch( const uno::Exception& )
      69                 :            :         {
      70                 :            :         }
      71                 :          0 :         Application::AcquireSolarMutex( nRef );
      72                 :            :     }
      73                 :            : 
      74                 :            :     // ::com::sun::star::uno::XInterface
      75                 :          0 :     uno::Any TextDataObject::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
      76                 :            :     {
      77         [ #  # ]:          0 :         uno::Any aRet = ::cppu::queryInterface( rType, (static_cast< datatransfer::XTransferable* >(this)) );
      78 [ #  # ][ #  # ]:          0 :         return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
      79                 :            :     }
      80                 :            : 
      81                 :            :     // ::com::sun::star::datatransfer::XTransferable
      82                 :          0 :     uno::Any TextDataObject::getTransferData( const datatransfer::DataFlavor& rFlavor ) throw(datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeException)
      83                 :            :     {
      84                 :          0 :         uno::Any aAny;
      85                 :            : 
      86         [ #  # ]:          0 :         sal_uLong nT = SotExchange::GetFormat( rFlavor );
      87         [ #  # ]:          0 :         if ( nT == SOT_FORMAT_STRING )
      88                 :            :         {
      89 [ #  # ][ #  # ]:          0 :             aAny <<= (::rtl::OUString)GetString();
      90                 :            :         }
      91                 :            :         else
      92                 :            :         {
      93         [ #  # ]:          0 :             throw datatransfer::UnsupportedFlavorException();
      94                 :            :         }
      95                 :          0 :         return aAny;
      96                 :            :     }
      97                 :            : 
      98                 :          0 :     uno::Sequence< datatransfer::DataFlavor > TextDataObject::getTransferDataFlavors(  ) throw(uno::RuntimeException)
      99                 :            :     {
     100                 :          0 :         uno::Sequence< datatransfer::DataFlavor > aDataFlavors(1);
     101 [ #  # ][ #  # ]:          0 :         SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aDataFlavors.getArray()[0] );
     102                 :          0 :         return aDataFlavors;
     103                 :            :     }
     104                 :            : 
     105                 :          0 :     sal_Bool TextDataObject::isDataFlavorSupported( const datatransfer::DataFlavor& rFlavor ) throw(uno::RuntimeException)
     106                 :            :     {
     107                 :          0 :         sal_uLong nT = SotExchange::GetFormat( rFlavor );
     108                 :          0 :         return ( nT == SOT_FORMAT_STRING );
     109                 :            :     }
     110                 :            : 
     111                 :            : }}  // namespace vcl::unohelper
     112                 :            : 
     113                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10