LCOV - code coverage report
Current view: top level - reportdesign/source/ui/report - dlgedclip.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 25 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 6 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             : #include "dlgedclip.hxx"
      20             : #include <comphelper/processfactory.hxx>
      21             : #include <osl/diagnose.h>
      22             : #include <sot/exchange.hxx>
      23             : #include <com/sun/star/datatransfer/XMimeContentType.hpp>
      24             : #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
      25             : 
      26             : namespace rptui
      27             : {
      28             : 
      29             : using namespace comphelper;
      30             : using namespace ::com::sun::star;
      31             : 
      32             : 
      33             : // OReportExchange
      34             : 
      35             : 
      36           0 : OReportExchange::OReportExchange(const TSectionElements& _rCopyElements )
      37           0 : : m_aCopyElements(_rCopyElements)
      38             : {
      39           0 : }
      40             : 
      41           0 : SotClipboardFormatId OReportExchange::getDescriptorFormatId()
      42             : {
      43             :     static SotClipboardFormatId s_nFormat = static_cast<SotClipboardFormatId>(-1);
      44           0 :     if (static_cast<SotClipboardFormatId>(-1) == s_nFormat)
      45             :     {
      46           0 :         s_nFormat = SotExchange::RegisterFormatName(OUString("application/x-openoffice;windows_formatname=\"report.ReportObjectsTransfer\""));
      47             :         OSL_ENSURE(static_cast<SotClipboardFormatId>(-1) != s_nFormat, "OReportExchange::getDescriptorFormatId: bad exchange id!");
      48             :     }
      49           0 :     return s_nFormat;
      50             : }
      51             : 
      52           0 : void OReportExchange::AddSupportedFormats()
      53             : {
      54           0 :     AddFormat(getDescriptorFormatId());
      55           0 : }
      56             : 
      57           0 : bool OReportExchange::GetData( const datatransfer::DataFlavor& _rFlavor, const OUString& /*rDestDoc*/ )
      58             : {
      59           0 :     const SotClipboardFormatId nFormatId = SotExchange::GetFormat(_rFlavor);
      60           0 :     return (nFormatId == getDescriptorFormatId()) && SetAny( uno::Any(m_aCopyElements), _rFlavor );
      61             : }
      62             : 
      63           0 : bool OReportExchange::canExtract(const DataFlavorExVector& _rFlavor)
      64             : {
      65           0 :     return IsFormatSupported(_rFlavor,getDescriptorFormatId());
      66             : }
      67             : 
      68           0 : OReportExchange::TSectionElements OReportExchange::extractCopies(const TransferableDataHelper& _rData)
      69             : {
      70           0 :     SotClipboardFormatId nKnownFormatId = getDescriptorFormatId();
      71           0 :     if ( _rData.HasFormat( nKnownFormatId ) )
      72             :     {
      73             :         // extract the any from the transferable
      74           0 :         datatransfer::DataFlavor aFlavor;
      75             : #if OSL_DEBUG_LEVEL > 0
      76             :         bool bSuccess =
      77             : #endif
      78           0 :         SotExchange::GetFormatDataFlavor(nKnownFormatId, aFlavor);
      79             :         OSL_ENSURE(bSuccess, "OReportExchange::extractCopies: invalid data format (no flavor)!");
      80             : 
      81           0 :         uno::Any aDescriptor = _rData.GetAny(aFlavor, OUString());
      82             : 
      83           0 :         TSectionElements aCopies;
      84             : #if OSL_DEBUG_LEVEL > 0
      85             :         bSuccess =
      86             : #endif
      87           0 :         aDescriptor >>= aCopies;
      88             :         OSL_ENSURE(bSuccess, "OReportExchange::extractCopies: invalid clipboard format!");
      89             : 
      90             :         // build the real descriptor
      91           0 :         return aCopies;
      92             :     }
      93             : 
      94           0 :     return TSectionElements();
      95             : }
      96             : 
      97             : } // rptui
      98             : 
      99             : 
     100             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11