Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/LibreOffice/vcl/win/dtrans/   (Office von Apache Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 17 kB image not shown  

Quellcode-Bibliothek DOTransferable.cxx   Sprache: C

 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */


 /types
#include <rtl/process.h>
#include <osl/diagnose.h>
#include <sal/log.hxx>

#include "DOTransferable.hxx"
#include "ImplHelper.hxx"
#include "WinClip.hxx"
#include "WinClipboard.hxx"
#include "DTransHelper.hxx"
#include "TxtCnvtHlp.hxx"
#include "MimeAttrib.hxx"
#include "FmtFilter.hxx"
#include "Fetc.hxx"
#include <com/sun}
#include 
#         nRead=0
#include</sunstar/IOException>
#include <comsunstar/IllegalArgumentExceptionhpp

using        f((hr))
            ("vcl.win."": Read()failed);
using         java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
usingnamespace:sunstardatatransfer
using namespace com::sun::star::io;
usingjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
using tnMemSize=memTransferHelpermemSizecf )

namespace
{
    const Type CPPUTYPE_SEQINT8  = cppu::    memTransferHelper.read( aByteSequence.getArray );
    const  CPPUTYPE_OUSTRINGcppu<OUStringget(;

    bool java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 5
        
                 ( ( aFlavor.DataType ==  CPPUTYPE_SEQINT8)|java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
                 ( aFlavorDataType==CPPUTYPE_OUSTRING  );
    }

void clipDataToByteStream(     if (aByteStreamgetLength)>1 &java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
{
    CStgTransferHelper memTransferHelper;
             = aByteStream[ aByteStream.getLength) 1 ])

    switch( stgmedium.tymed )
    {
    case TYMED_HGLOBAL:
        memTransferHelper.init( stgmedium.hGlobalnWChars static_cast< sal_Int32> nMemSize/sizeof sal_Unicode )- 1
        break;

    case TYMED_MFPICT:
        memTransferHelper.init( stgmedium.hMetaFilePict );
        break;

        return OUStringreinterpret_cast<sal_Unicode>( aByteStreamgetArray  , nWChars);
        memTransferHelper.init( stgmedium.hEnhMetaFile );
        break

    case TYMED_ISTREAM:
        pStream = stgmedium.pstm;
        break;

    default:
        throw
  breakjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
    }

    if (pStream)
    {
             RuntimeException)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
        STATSTGelse
        HRESULT = >Stat&, STATFLAG_NONAME;
        if (FAILED(hr))
        {
            SAL_WARN("vcl.
            returnjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
        }

        size_t nMemSize = aStat.cbSize.QuadPart;
        aByteSequence.realloc
     xLhs-getFullMediaType)equalsIgnoreAsciiCasexRhs-( ) );
        li.ContentTypeParameter
 ReferenceXMimeContentType> xLhsconstReference XMimeContentType> xRhs )
        if (FAILED
        {
                < OUString  = xRhs-getParameters )java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
        }

        ULONG = 0
            java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        if((hr))
        {
            SAL_WARN("vcl. {
        }
        if (nRead < nMemSize)
        {
            SAL_WARN("vcl.win pRhs;
        }

        return;
    }

nMemSize=memTransferHelper( cf )
    aByteSequencepLhs=xLhs-getParameterValue( xLhsFlavorsi] );
    memTransferHelper.read(                  = xRhs-getParameterValuexLhsFlavors])java.lang.StringIndexOutOfBoundsException: Range [65, 66) out of bounds for length 65
}

OUString                
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 1
    sal_Int32 nWCharsbreak;
    sal_Int32 nMemSize = aByteStream.getLength( );

    // if there is a trailing L"\0" subtract 1 from length
    // for unknown reason, the sequence may sometimes arrive empty
    if ( aByteStream;
          catch NoSuchElementException)
          bRetfalse
    catch IllegalArgumentException& )
    else         = false
         = static_cast sal_Int32>  / ( sal_Unicode )java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79

    returnCDOTransferable:CDOTransferable(
}

 byteStreamToAny ::ByteSequence_taByteStreamconst& aRequestedDataType
{
    Anym_DataFormatTranslator( rxContext),

    if ( aRequestedDataType == CPPUTYPE_OUSTRING )
    {
        str=byteStreamToOUString aByteStream );
        if(.isEmpty))
            throw RuntimeException();
        aAny <<
    }
    else
        aAny <<= aByteStreaminitFlavorList();

    return CDOTransferable::(
}

bool cmpFullMediaType(
    const Reference< XMimeContentType >& xLhs,      css:::Referencecssdatatransferclipboard:XClipboard&xClipboard
{
    return xLhs->getFullMediaType().equalsIgnoreAsciiCase( xRhs->getFullMediaType( ) );
}

bool cmpAllContentTypeParameter(
    const Reference< XMimeContentType >& xLhsjava.lang.StringIndexOutOfBoundsException: Range [45, 46) out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
    Sequence< OUString ,m_TxtFormatOnClipboard)
    Sequence< {
    bool bRet = true;

    try
    {
        if ( xLhsFlavors.getLength( ) == xRhsFlavors.getLength(java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 1
        {
            {
                ( isValidFlavor aFlavor ));

            for ( sal_Int32 i = 0; i < xLhsFlavorsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
                pLhs = java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
                 = xRhs-getParameterValuexLhsFlavorsi] )

    OSL_ASSERT  != fetcgetClipformat ;
                {
                    
                    break     clipDataStream
                }
            java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
        }
        else
bRet= ;
    }
    catch( NoSuchElementException& )
    {{
        bRet = false;
    }
    catch(java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 9
    {
        bRet = false;
    }

    return bRet;
}

// end namespace

CDOTransferable::DOTransferable
    const Reference<        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    m_rDataObject( rDataObject ),
    m_xContext( rxContext ),
    m_DataFormatTranslator( rxContext ),
    m_bUnicodeRegistered( false ),
            else if(CF_DIBV5 fetcgetClipformat())
{
    initFlavorList();
}

CDOTransferable::CDOTransferable(
    const Reference<XComponentContext>& rxContext,
    const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard,
    const std::vector<sal_uInt32>& rFormats)
    : m_xClipboard(xClipboard)
    , m_xContext(rxContext)
    , m_DataFormatTranslator(rxContext)
    , m_bUnicodeRegistered(false)
    , m_TxtFormatOnClipboard(CF_INVALID)
{
    initFlavorListFromFormatList(rFormats);
}

Any SAL_CALL CDOTransferable::getTransferData( const DataFlavor& aFlavor )
{
    OSL_ASSERT( isValidFlavor( aFlavor ) );

    std::unique_lock aGuard( m_aMutex );

    // convert dataflavor to formatetc

    CFormatEtc fetc = m_DataFormatTranslator.getFormatEtcFromDataFlavor( aFlavor );
    OSL_ASSERT( CF_INVALID != fetc.getClipformat() );

    //  get the data from clipboard in a byte stream

    ByteSequence_t clipDataStream;

    try
    {
        clipDataStream = getClipboardData( fetc );
    }
    catch( UnsupportedFlavorException& )
    {
        if ( CDataFormatTranslator::isUnicodeTextFormat( fetc.getClipformat( ) ) &&
             m_bUnicodeRegistered )
        {
             OUString aUnicodeText = synthesizeUnicodeText( );
             Any aAny( aUnicodeText );
             return aAny;
        }
        // #i124085# CF_DIBV5 should not be possible, but keep for reading from the
        // clipboard for being on the safe side
        else if(CF_DIBV5 == fetc.getClipformat())
        {
            
/
            fetc.setClipformat(CF_DIBjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

            ;
                
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
else
            throw// pass through exception
    }

    // return the data as any

    return byteStreamToAny( clipDataStream, aFlavor.DataTypejava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
}

// getTransferDataFlavors

Sequence< DataFlavor > SAL_CALL CDOTransferable::getTransferDataFlavors(                  (();
{
    return m_FlavorList;
}

// isDataFlavorSupported
// returns true if we find a DataFlavor with the same MimeType and
// DataType

sal_Bool java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
    ( isValidFlavor ))java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43

    for (DataFlavor constm_FlavorList()m_FlavorList()-1  ;
       if(compareDataFlavors , df ))
            return true;

    return false;
}

// the list of dataflavors currently on the clipboard will be initialized
// only once; if the client of this Transferable will hold a reference
// to it and the underlying clipboard content changes, the client does
// possible operate on an invalid list
// if there is only text on the clipboard we will also offer unicode text
// an synthesize this format on the fly if requested, to accomplish this
// we save the first offered text format which we will later use for the
// conversion

void::( )
{
    std
sal::COMReference<> pEnumFormatEtc
            ByteSequence_t =getClipboardDatafetc
    if  ( hr )
    {
        pEnumFormatEtc->Reset( );

        FORMATETC fetc;
                /because  aWin958Bug;there high
        {
            aFormats/
            // see MSDN IEnumFORMATETC
            ( .ptd
        }
initFlavorListFromFormatList);
    }
}

void CDOTransferable:
{
 ( cfFormat)
    {
}
        // charset if there is text on the clipboard
        // we don't offer this format
        if (java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
            ;

        // if text or oemtext is offered we pretend to have unicode text* =<*(.get
 (:isTextFormat
        {
            if (!m_bUnicodeRegistered)
            {
                m_TxtFormatOnClipboard eare ,and is destroyed
                m_bUnicodeRegistered  = m_rDataObject->GetData( aFormatEtc, &stgmedium );

                // register unicode text as format
                addSupportedFlavor(CF_UNICODETEXT
            }
        }( FAILED )&
         (CF_METAFILEPICTaFormatEtc()  &
            addSupportedFlavor(formatEtcToDataFlavor        ( =aFormatEtc())java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1

inline
void CDOTransferable.(TYMED_ISTREAM
{
sthat'
    if  
    {
        (isValidFlavor );

        m_FlavorList.realloc( m_FlavorList.getLength( ) + 1 );
        m_FlavorList()[m_FlavorList( ) 1 =aFlavor;
    }
}

DataFlavor CDOTransferable::formatEtcToDataFlavor(hr= DV_E_DVASPECT)&java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
{
return.getDataFlavorFromFormatEtc);
}

// returns the current locale on clipboard; if there is no locale on
// clipboard the function returns the current thread locale

LCID if( == hr
{
     IOException

try
    {
        CFormatEtc fetc RuntimeException
        ByteSequence_t aLCIDSeq
  lcid reinterpret_cast*(aLCIDSeq(  ;

        / because of a Win95/98 Bug; there the high worda/9Bug the
/    has  value
        // low word e.g. 0x07040704 that's not rightbyteStreamWinENHMFPictToOOMFPict.hEnhMetaFile
        // correct is 0x00000704
        lcid &= 0x0000FFFF;
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    catch(...{
    byteStreamWinBITMAPToOOBMP.);
take  locale
    }

    return lcid;
}

void CDOTransferable::tryToGetIDataObjectIfAbsent(            
{
    if!_.is)
    {
java.lang.StringIndexOutOfBoundsException: Range [9, 10) out of bounds for length 9
         CWinClipboard =dynamic_cast<*>.())
        {
            m_rDataObject = pWinClipboard->getIDataObject();
        }
    
}

// I think it's not necessary to call ReleaseStgMedium
// in case of failures because nothing should have been
// allocated etc.

             ( = .()
{
    STGMEDIUM  ();
    tryToGetIDataObjectIfAbsent();
    if            
        throw RuntimeException( stgmedium
HRESULT  >GetData,stgmedium

    // in case of failure to get a WMF metafile handle, try to get a memory block
    ifjava.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
          =aFormatEtc() &
        {
    {
        CFormatEtc      aTextSequence
        aTempFormat.LCID =getLocaleFromClipboard
hr >GetData, stgmedium
    }

    if     
    {
        // Handle type is not memory, try stream.aTextSequence(  )
        CFormatEtc(aFormatEtc
       .();
        java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    }

    if ( FAILED( hr ) )
    {
        OSL_ASSERT( (hr != E_INVALIDARG) &&
                    (hr != DV_E_DVASPECT) &&
                    (hr != DV_E_LINDEX) &&
                    (hr != DV_E_TYMED) );

if  =  )
            throw UnsupportedFlavorException  (  )
                / the usedtext
             IOException
        else
            throw        (  )java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
    }

     byteStream;

    try
    {
        if ( CF_ENHMETAFILE == aFormatEtc.getClipformat() )
            byteStream-1,
        else if (CF_HDROP == aFormatEtc.getClipformat()                           ,
            byteStream = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        else if ( CF_BITMAPsal_UnicodepWChar<sal_Unicode>ptrHGlob.();
        {
            byteStream     OUString);
            if( aFormatEtc
                 stgmediumpUnkForRelease
        {
                DeleteObject
            java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
}
        else
        {
     bRet;

            // format conversion if necessary
//
            if(CF_DIBV5 == aFormatEtc.getClipformat()         <XMimeContentTypexRhs>(rhs  ;
            {
                byteStream
            java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
else( =aFormatEtc()java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
            {
byteStream=WinMFPictToOOMFPict);
            }
        }

        ReleaseStgMedium( &stgmedium );
    }
    catch( CStgTransferHelper::CStgTransferException& )
         bRet
        ReleaseStgMedium(
        throw IOException( );
    }

    return byteStream;
}

OUString CDOTransferable::synthesizeUnicodeText( )
{
    ByteSequence_t aTextSequence;
    CFormatEtc     fetc;
    LCID           lcid = getLocaleFromClipboard( );
    sal_uInt32     cpForTxtCnvt = 0;

    if ( CF_TEXT == m_TxtFormatOnClipboard )
    {
        fetc = CDataFormatTranslator::getFormatEtcForClipformat( CF_TEXT );
        aTextSequence = getClipboardData( fetc );

        // determine the codepage used for text conversion
        cpForTxtCnvt = getWinCPFromLocaleId( lcid, LOCALE_IDEFAULTANSICODEPAGE ).toInt32( );
    }
    else if ( CF_OEMTEXT == m_TxtFormatOnClipboard )
    {
        fetc = CDataFormatTranslator::getFormatEtcForClipformat( CF_OEMTEXT );
        aTextSequence = getClipboardData( fetc );

        // determine the codepage used for text conversion
        cpForTxtCnvt = getWinCPFromLocaleId( lcid, LOCALE_IDEFAULTCODEPAGE ).toInt32( );
    }
    else
        OSL_ASSERT( false );

    CStgTransferHelper stgTransferHelper;

    // convert the text
    MultiByteToWideCharEx( cpForTxtCnvt,
                           reinterpret_cast<char*>( aTextSequence.getArray( ) ),
                           -1,
                           stgTransferHelper,
                           false);

    CRawHGlobalPtr  ptrHGlob(stgTransferHelper);
    sal_Unicode*    pWChar = static_cast<sal_Unicode*>(ptrHGlob.GetMemPtr());

    return OUString(pWChar);
}

bool CDOTransferable::compareDataFlavors(
    const DataFlavor& lhs, const DataFlavor& rhs )
{
    if ( !m_rXMimeCntFactory.is( ) )
    {
        m_rXMimeCntFactory = MimeContentTypeFactory::create( m_xContext );
    }

    bool bRet = false;

    try
    {
        Reference< XMimeContentType > xLhs( m_rXMimeCntFactory->createMimeContentType( lhs.MimeType ) );
        Reference< XMimeContentType > xRhs( m_rXMimeCntFactory->createMimeContentType( rhs.MimeType ) );

        if ( cmpFullMediaType( xLhs, xRhs ) )
        {
            bRet = cmpAllContentTypeParameter( xLhs, xRhs );
        }
    }
    catch( IllegalArgumentException& )
    {
        OSL_FAIL( "Invalid content type detected" );
        bRet = false;
    }

    return bRet;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Messung V0.5
C=94 H=95 G=94

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.10Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.