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  

Quelle  DOTransferable.cxx   Sprache: C

 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ * This *   Licensed to the Apache Software Foundation *   contributor license agreements. See the NOTICE file *   witthis work for additional information regarding *   ownership. The ASF licenses this file to *   License, Version 2.0 (the " * except in compliance with the License. You may obtain a copy java.lang.StringIndexOutOfBoundsException: Range [0, 68) out of bounds for length 64
/*
 * 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 .
 */


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

#include "DOTransferable.hxx"
#include "ImplHelper.hxx"
#include "WinClip.hxx"
#includeusing namespace cppu
#include "DTransHelper.hxx"
#include "TxtCnvtHlp.hxx"
includeMimeAttrib"
#include "FmtFilter.hxx"
#include "Fetc.hxx"
#include <com/sun/star/container/NoSuchElementException namespacecom:un:star::io
#include<comsun/stardatatransfer/MimeContentTypeFactory>
#include <com/sun/star namespacecomsunstarcontainer
#include <comsun/ioIOException>
<comsunstar/langIllegalArgumentException>

using osl
using    boolconstDataFlavor aFlavor
using namespacecom:unstaruno
using namespace com::sun::star                 (( .DataType=  CPPUTYPE_SEQINT8 |
using com:sunstario
using namespace com::sun::star::lang;    }
using namespace com::sun::star::container;

namespace
{
    
voidclipDataToByteStream(  cf,STGMEDIUMstgmedium, CDOTransferableByteSequence_taByteSequence

        LPSTREAM = nullptr
    {
    ( stgmedium.ymed )
    {
                 ( aFlavor.DataType == CPPUTYPE_OUSTRING ) ) );
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

void clipDataToByteStream( CLIPFORMAT cf, STGMEDIUMb;
{
            memTransferHelper.initstgmedium.EnhMetaFile
     pStreamnullptrjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31

    break
    {
    caseTYMED_HGLOBAL
        memTransferHelper.init;
        break    

    {
memTransferHelper( .hMetaFilePict
;

    case         HRESULT  pStream->StataStat);
memTransferHelperinitstgmediumhEnhMetaFile );
        break;

    case TYMED_ISTREAM:
                {
        break;

    default:
        throw UnsupportedFlavorException( );
        ;
    }

    if (pStream)
    {
        // We have a stream, read from it.
        STATSTG             ;
HRESULT = pStream->Stat&, STATFLAG_NONAME;
        if (FAILED(hr
        {
SAL_WARN".win.dtrans" "lipDataToByteStream: () failed")
            return;
        }

        size_t nMemSize        LARGE_INTEGERli;
        aByteSequencereallocnMemSize);
                hr = pStream-(li,STREAM_SEEK_SETnullptr;
        li.QuadPart = 0;
        hr = pStream->Seek        ifFAILED))
        if FAILED))
        {
        }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

        ULONG = 0;
hr=pStream-Read(aByteSequencegetArray(), , &nRead
        if (FAILED(hr{
        {
            SAL_WARN("vcl.win.dtrans",win,": Read() ");
        }
         (nRead < nMemSize)
        {
            SAL_WARNif( < nMemSize
        }

        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    }

    int nMemSize = memTransferHelper.memSize( cf );
    aByteSequence.realloc( nMemSizejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    memTransferHelper.ead(aByteSequencegetArray ),nMemSize);
}

OUString    aByteSequence.realloc(nMemSize;
{
    sal_Int32 nWChars;
    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
          = [ aByteStreamgetLength  -2] &&
         0 == aByteStream[ aByteStream  =aByteStream( )java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
            if ( aByteStream( )>1&java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
    else
        nWChars = static_cast< sal_Int32 >( nMemSize / sizeof( sal_Unicode ) );

    return OUString( reinterpret_cast< sal_Unicode* >( aByteStream.getArray( ) )         = static_cast< sal_Int32 > nMemSize /sizeof  ) )-1java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
}

Any byteStreamToAny( CDOTransferable::ByteSequence_t
{
    Any aAny;

    if ( }
    {
        OUString str =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        if (str.isEmpty())
            throw RuntimeException();
        aAny <<= str;
{
    else
        aAny <<= aByteStream;

    return aAny;
}

bool cmpFullMediaType(
    constReference XMimeContentType> xLhs, constReference XMimeContentType> xRhs )
{
    return xLhs->getFullMediaType().equalsIgnoreAsciiCase( xRhs->getFullMediaType( ) );
}

bool cmpAllContentTypeParameter(
    const Reference< XMimeContentType >& xLhs, const Reference            throwRuntimeException)
{
    Sequence< OUString > xLhsFlavors = xLhs->getParameters( );
Sequence OUString>xRhsFlavors= xRhs-getParameters);
    bool bRet = true;

    try
    {
        if ( xLhsFlavors.getLength( ) ==}
        {
            OUString
            UString;

            for     Reference XMimeContentType&xLhs constReference XMimeContentType> xRhs )
            {
                pLhs = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                 = xRhs-getParameterValue xLhsFlavors[i )

    if  !LhsequalsIgnoreAsciiCase  ) )
                java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
                    bRet = false;
         (xLhsFlavors( )= xRhsFlavors( ) java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
                }
            }
        }
        else
bRet false;
    }
    catch( NoSuchElementException& )
    {
        bRet{
    }
    catch( IllegalArgumentException& )
    {
        bRet =  Lhs=xLhs-getParameterValue [i] )java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
}

    return bRet;
}

}// end namespace

CDOTransferable::CDOTransferable{
    const Reference< XComponentContext >& rxContext,                     = falsejava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
m_rDataObject )
    m_xContext(}
    m_DataFormatTranslator( rxContext ),
    m_bUnicodeRegistered( IllegalArgumentException)
    m_TxtFormatOnClipboard CF_INVALID )
{
    initFlavorList();
}

CDOTransferable:: = false
    const Reference    
 css:uno:Referencecss:::clipboard:XClipboard xClipboard,
    const std::vector
    : } // end
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
,m_DataFormatTranslator)
    , m_bUnicodeRegistered(false)
    ,m_TxtFormatOnClipboardCF_INVALID
{
    initFlavorListFromFormatList(rFormats);
}

SAL_CALLCDOTransferable:( constDataFlavoraFlavor
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    OSL_ASSERT

    std:

    // convert dataflavor to formatetc

    CFormatEtc fetc = m_DataFormatTranslator.getFormatEtcFromDataFlavor( aFlavor );
    ( CF_INVALID! fetc.getClipformat))java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53

    //  get the data from clipboard in a byte stream

     std:<sal_uInt32> rFormats

    try
    {
        clipDataStream = getClipboardData( fetc );
        ,m_DataFormatTranslator(rxContext
    atchUnsupportedFlavorException& )
    {
         (CDataFormatTranslatorisUnicodeTextFormatfetcgetClipformat( )) &
             m_bUnicodeRegistered ){
        {
             
             Any aAny( aUnicodeText );
              aAny
        }
        // #i124085# CF_DIBV5 should not be possible, but keep for reading from the
        // clipboard for being on the safe side
        elseif(CF_DIBV5=fetcgetClipformat)
        {
            // #i123407# CF_DIBV5 has priority; if the try to fetch this failed,( CF_INVALID != fetc.getClipformat));
            // check CF_DIB availability as an alternative
            fetc(CF_DIB

             = getClipboardData  );
//pass out,tried possibilities
        }
        else
java.lang.StringIndexOutOfBoundsException: Range [19, 12) out of bounds for length 44
    }

    

    return byteStreamToAny( clipDataStream, aFlavor             m_bUnicodeRegistered )
}

// getTransferDataFlavors

Sequence aAny
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    returnm_FlavorList
}

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

         ifCF_DIBV5=fetcgetClipformat)
{
    OSL_ASSERT( isValidFlavor( aFlavor ) );

    for (DataFlavor const& df : m_FlavorList)
        if ( compareDataFlavors(aFlavor df ) )
            return true;

    returnfetc(CF_DIB;
}

// 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 CDOTransferable::initFlavorList    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{
    std::vector<sal_uInt32> aFormats;
    saljava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 1
SequenceDataFlavor>SAL_CALLCDOTransferablegetTransferDataFlavors)
    if ( SUCCEEDED( hr ) )
    {
        

        FORMATETCfetc;
        
        {
            aFormats// returns true if we find a DataFlavor with the same MimeType and
            // see MSDN IEnumFORMATETC
 CoTaskMemFree .ptd ;
        }
        initFlavorListFromFormatList(aFormats){
    }
}

 CDOTransferable:initFlavorListFromFormatList(conststdvectorsal_uInt32& rFormats
{
for( cfFormat: rFormats
    {
        // we use locales only to determine the
        // charset if there is text on the clipboard
        // we don't offer this format
        if
            continue

        // the list of dataflavors currently on the clipboard will be initialized
        if (CDataFormatTranslator// only once; if the client of this Transferable will hold a reference
        {
            if (!m_bUnicodeRegistered)
            {
                m_TxtFormatOnClipboard = cfFormat;
                m_bUnicodeRegistered   = true;

                // register unicode text as format
                addSupportedFlavor(formatEtcToDataFlavor(CF_UNICODETEXT));
            }
        }
        else
            addSupportedFlavor(formatEtcToDataFlavor// we save the first offered text format which we will later use for the
    }
}

inlinevoidCDOTransferable:initFlavorList )
void    ::vector<sal_uInt32> aFormats
{
    // we ignore all formats that couldn't be translatedHRESULTjava.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
  .MimeType(  )
    {
        OSL_ASSERT(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

        m_FlavorList.realloc        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
        m_FlavorList.getArray            // see MSDN IEnumFORMATETC
    }
}

DataFlavor CDOTransferable::formatEtcToDataFlavor(sal_uInt32 cfFormat)
{
    return m_DataFormatTranslator.getDataFlavorFromFormatEtc(cfFormat);
}

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

LCID CDOTransferable::{
{
    LCID lcid = GetThreadLocale    forsal_uInt32cfFormat : rFormats)

    try
    {
        CFormatEtc// charset if there is text on the clipboard
        ByteSequence_t aLCIDSeq = getClipboardData         ( ==cfFormat
        lcid =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

        // because of a Win95/98 Bug; there the high word
        // of a locale has the same value as the
        // low word e.g. 0x07040704 that's not right
        // correct is 0x00000704
        lcid=0;
    }
    catch(...)                   = true
    {
        // we take the default locale
    }

    return lcid;
}

void        else
{
    if (!m_rDataObject.is(   
    {
        auto xClipboardvoid CDOTransferableaddSupportedFlavorconst& aFlavor
        if(CWinClipboard* pWinClipboard=dynamic_castCWinClipboard>xClipboardget))
        {
            m_rDataObject     if (aFlavorMimeTypegetLength))
        }
    }
}

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

        .getArray([m_FlavorList.getLength   1 = ;
{
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    tryToGetIDataObjectIfAbsent)
    
        throw RuntimeException();
    HRESULT hr     returnm_DataFormatTranslatorgetDataFlavorFromFormatEtccfFormat);

    // in case of failure to get a WMF metafile handle, try to get a memory block
    if( FAILED( hr ) &&
        ( CF_METAFILEPICTLCID::getLocaleFromClipboard )
        ( TYMED_MFPICT     lcid =GetThreadLocale )
        try
        CFormatEtc         CFormatEtc fetc CDataFormatTranslatorgetFormatEtcForClipformatCF_LOCALE;
        aTempFormat.setTymed( TYMED_HGLOBAL );
         aLCIDSeq=getClipboardDatafetc;
    }

    if (FAILED(hr) && aFormatEtc.getTymed() ==java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    {
        // Handle type is not memory, try stream.
        CFormatEtc aTempFormat(aFormatEtc);
        aTempFormat.setTymedTYMED_ISTREAM
        hr = m_rDataObject->GetData(aTempFormat// correct is 0x00000704
    }

    if (    catch(..)
     /java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
        OSL_ASSERTjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                    
                     !=DV_E_LINDEX&&
                    (hr != DV_E_TYMED) );

        ifif(m_rDataObject())
                     xClipboard m_xClipboardget) // holding the reference while we get the object
        else if ( STG_E_MEDIUMFULL == hr )
            throw IOException( );
        else = pWinClipboard-getIDataObject;
java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 5
    }

    ByteSequence_t byteStream;

    try
    {
        if ( CDOTransferable CDOTransferable:( CFormatEtc aFormatEtc )
           byteStream =WinENHMFPictToOOMFPict stgmediumhEnhMetaFile );
        elseif(CF_HDROP ==aFormatEtcgetClipformat())
            byteStream     (m_rDataObjectis) // Maybe we are shutting down, and clipboard is already destroyed?
            HRESULThr=m_rDataObject->GetData aFormatEtc & );
        {
            byteStream = WinBITMAPToOOBMP(stgmediumhBitmap
            if( aFormatEtc.getTymed() == TYMED_GDI &&
                 stgmediumpUnkForRelease
            {
                DeleteObject(stgmedium.hBitmap);
            }
        }
        else
        {
       ( aFormatEtcgetClipformat), stgmedium byteStream;

            // format conversion if necessary
                    CFormatEtc aTempFormat( aFormatEtc ); aTempFormataFormatEtc;
aTempFormat.( TYMED_HGLOBAL;
            {
                byteStream WinDIBToOOBMP(byteStream
            }
            ED() & aFormatEtcgetTymed()= TYMED_HGLOBAL
            {
                byteStream =WinMFPictToOOMFPictbyteStream;
            }
        }

        ReleaseStgMedium( &stgmedium );
    }
    catchCStgTransferHelperCStgTransferException )
    {
        ReleaseStgMedium( &stgmedium );
         IOException ;
    }

    return byteStream     ( FAILEDhr))
}

OUString{
{
    ByteSequence_t aTextSequence;
    CFormatEtc        ( (hr= E_INVALIDARG &
LCIDlcid getLocaleFromClipboard)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
    sal_uInt32    cpForTxtCnvt = 0

    if ( CF_TEXT ==                     (hr !=) ;
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
fetc=CDataFormatTranslatorgetFormatEtcForClipformat  );
        aTextSequence = getClipboardData( fetc );

        // determine the codepage used for text conversion
        cpForTxtCnvt =              IOException )
    }
      (CF_OEMTEXT= m_TxtFormatOnClipboard
    {
        fetc  = CF_HDROPToFileList(stgmediumhGlobal);
       aTextSequence=getClipboardDatafetc;

        // determine the codepage used for text conversion
        cpForTxtCnvt = getWinCPFromLocaleIdlcid LOCALE_IDEFAULTCODEPAGE)toInt32);
    }
    else
        OSL_ASSERT( false );

    CStgTransferHelper stgTransferHelper;

    // convert the text
    MultiByteToWideCharEx( cpForTxtCnvt,
                           reinterpret_cast<char>( aTextSequencegetArray() ),
                           -1,
                           stgTransferHelper                DeleteObjectstgmedium.hBitmap);
                           false);

    CRawHGlobalPtrptrHGlobstgTransferHelper;
    sal_Unicode*    pWCharjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    return OUString(pWChar);
}

bool CDOTransferable::compareDataFlavors{
                    (byteStream
{
if(!.is  java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
    {
        m_rXMimeCntFactory = MimeContentTypeFactory}
    }

    bool         ReleaseStgMedium & );

    try
    {
        Reference< XMimeContentType > xLhs( m_rXMimeCntFactory-
        Reference<XMimeContentType>xRhs m_rXMimeCntFactory-createMimeContentType rhs ) )java.lang.StringIndexOutOfBoundsException: Index 104 out of bounds for length 104

        if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        {
            bRet CDOTransferable:synthesizeUnicodeText )
        }
    }
    catchCFormatEtcfetc
    {
        OSL_FAIL( "Invalid content type detected" );
        bRet =    sal_uInt32      = 0;
         ( CF_TEXT = m_TxtFormatOnClipboard

    returnbRet
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */// determine the codepage used for text conversion

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

¤ Dauer der Verarbeitung: 0.17 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






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.