diff options
Diffstat (limited to 'dtrans/source/win32/dtobj')
22 files changed, 588 insertions, 588 deletions
diff --git a/dtrans/source/win32/dtobj/APNDataObject.cxx b/dtrans/source/win32/dtobj/APNDataObject.cxx index 80a8c1e737e6..1cae8652d310 100644 --- a/dtrans/source/win32/dtobj/APNDataObject.cxx +++ b/dtrans/source/win32/dtobj/APNDataObject.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,8 +44,8 @@ // defines //------------------------------------------------------------------------ -#define FREE_HGLOB_ON_RELEASE TRUE -#define KEEP_HGLOB_ON_RELEASE FALSE +#define FREE_HGLOB_ON_RELEASE TRUE +#define KEEP_HGLOB_ON_RELEASE FALSE //------------------------------------------------------------------------ // ctor @@ -55,58 +55,58 @@ CAPNDataObject::CAPNDataObject( IDataObjectPtr rIDataObject ) : m_rIDataObjectOrg( rIDataObject ), m_hGlobal( NULL ), m_nRefCnt( 0 ) -{ - +{ + OSL_ENSURE( m_rIDataObjectOrg.get( ), "constructing CAPNDataObject with empty data object" ); - + // we marshal the IDataObject interface pointer here so - // that it can be unmarshaled multiple times when this + // that it can be unmarshaled multiple times when this // class will be used from another apartment IStreamPtr pStm; HRESULT hr = CreateStreamOnHGlobal( 0, KEEP_HGLOB_ON_RELEASE, &pStm ); - + OSL_ENSURE( E_INVALIDARG != hr, "invalid args passed to CreateStreamOnHGlobal" ); if ( SUCCEEDED( hr ) ) - { - HRESULT hr_marshal = CoMarshalInterface( - pStm.get(), - __uuidof(IDataObject), + { + HRESULT hr_marshal = CoMarshalInterface( + pStm.get(), + __uuidof(IDataObject), static_cast<LPUNKNOWN>(m_rIDataObjectOrg.get()), MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK ); - + OSL_ENSURE( CO_E_NOTINITIALIZED != hr_marshal, "COM is not initialized" ); - // marshalling may fail if COM is not initialized + // marshalling may fail if COM is not initialized // for the calling thread which is a program time // error or because of stream errors which are runtime // errors for instance E_OUTOFMEMORY etc. - + hr = GetHGlobalFromStream(pStm.get(), &m_hGlobal ); OSL_ENSURE( E_INVALIDARG != hr, "invalid stream passed to GetHGlobalFromStream" ); - // if the marshalling failed we free the + // if the marshalling failed we free the // global memory again and set m_hGlobal // to a defined value if (FAILED(hr_marshal)) { OSL_ENSURE(sal_False, "marshalling failed"); - + #if OSL_DEBUG_LEVEL > 0 HGLOBAL hGlobal = #endif - GlobalFree(m_hGlobal); + GlobalFree(m_hGlobal); OSL_ENSURE(NULL == hGlobal, "GlobalFree failed"); m_hGlobal = NULL; } - } + } } CAPNDataObject::~CAPNDataObject( ) -{ +{ if (m_hGlobal) { IStreamPtr pStm; @@ -119,7 +119,7 @@ CAPNDataObject::~CAPNDataObject( ) hr = CoReleaseMarshalData(pStm.get()); OSL_ENSURE(SUCCEEDED(hr), "CoReleaseMarshalData failed"); } - } + } } //------------------------------------------------------------------------ @@ -127,7 +127,7 @@ CAPNDataObject::~CAPNDataObject( ) //------------------------------------------------------------------------ STDMETHODIMP CAPNDataObject::QueryInterface( REFIID iid, LPVOID* ppvObject ) -{ +{ OSL_ASSERT( NULL != ppvObject ); if ( NULL == ppvObject ) @@ -143,7 +143,7 @@ STDMETHODIMP CAPNDataObject::QueryInterface( REFIID iid, LPVOID* ppvObject ) hr = S_OK; } - return hr; + return hr; } //------------------------------------------------------------------------ @@ -161,7 +161,7 @@ STDMETHODIMP_(ULONG) CAPNDataObject::AddRef( ) STDMETHODIMP_(ULONG) CAPNDataObject::Release( ) { - // we need a helper variable because it's not allowed to access + // we need a helper variable because it's not allowed to access // a member variable after an object is destroyed ULONG nRefCnt = static_cast< ULONG >( InterlockedDecrement( &m_nRefCnt ) ); @@ -176,16 +176,16 @@ STDMETHODIMP_(ULONG) CAPNDataObject::Release( ) //------------------------------------------------------------------------ STDMETHODIMP CAPNDataObject::GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ) -{ +{ HRESULT hr = m_rIDataObjectOrg->GetData( pFormatetc, pmedium ); - + if (RPC_E_WRONG_THREAD == hr) { IDataObjectPtr pIDOTmp; hr = MarshalIDataObjectIntoCurrentApartment(&pIDOTmp); if (SUCCEEDED(hr)) - hr = pIDOTmp->GetData(pFormatetc, pmedium); + hr = pIDOTmp->GetData(pFormatetc, pmedium); } return hr; } @@ -205,7 +205,7 @@ STDMETHODIMP CAPNDataObject::EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** if (SUCCEEDED(hr)) hr = pIDOTmp->EnumFormatEtc(dwDirection, ppenumFormatetc); - } + } return hr; } @@ -218,12 +218,12 @@ STDMETHODIMP CAPNDataObject::QueryGetData( LPFORMATETC pFormatetc ) HRESULT hr = m_rIDataObjectOrg->QueryGetData( pFormatetc ); if (RPC_E_WRONG_THREAD == hr) - { + { IDataObjectPtr pIDOTmp; hr = MarshalIDataObjectIntoCurrentApartment( &pIDOTmp ); if (SUCCEEDED(hr)) - hr = pIDOTmp->QueryGetData(pFormatetc); + hr = pIDOTmp->QueryGetData(pFormatetc); } return hr; } @@ -242,8 +242,8 @@ STDMETHODIMP CAPNDataObject::GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pm hr = MarshalIDataObjectIntoCurrentApartment(&pIDOTmp); if (SUCCEEDED(hr)) - hr = pIDOTmp->GetDataHere(pFormatetc, pmedium); - } + hr = pIDOTmp->GetDataHere(pFormatetc, pmedium); + } return hr; } @@ -262,7 +262,7 @@ STDMETHODIMP CAPNDataObject::GetCanonicalFormatEtc(LPFORMATETC pFormatectIn, LPF if (SUCCEEDED(hr)) hr = pIDOTmp->GetCanonicalFormatEtc(pFormatectIn, pFormatetcOut); - } + } return hr; } @@ -280,8 +280,8 @@ STDMETHODIMP CAPNDataObject::SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmediu hr = MarshalIDataObjectIntoCurrentApartment(&pIDOTmp); if (SUCCEEDED(hr)) - hr = pIDOTmp->SetData(pFormatetc, pmedium, fRelease); - } + hr = pIDOTmp->SetData(pFormatetc, pmedium, fRelease); + } return hr; } @@ -299,8 +299,8 @@ STDMETHODIMP CAPNDataObject::DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVI hr = MarshalIDataObjectIntoCurrentApartment(&pIDOTmp); if (SUCCEEDED(hr)) - hr = pIDOTmp->DAdvise(pFormatetc, advf, pAdvSink, pdwConnection); - } + hr = pIDOTmp->DAdvise(pFormatetc, advf, pAdvSink, pdwConnection); + } return hr; } @@ -318,8 +318,8 @@ STDMETHODIMP CAPNDataObject::DUnadvise( DWORD dwConnection ) hr = MarshalIDataObjectIntoCurrentApartment(&pIDOTmp); if (SUCCEEDED(hr)) - hr = pIDOTmp->DUnadvise(dwConnection); - } + hr = pIDOTmp->DUnadvise(dwConnection); + } return hr; } @@ -337,8 +337,8 @@ STDMETHODIMP CAPNDataObject::EnumDAdvise( LPENUMSTATDATA * ppenumAdvise ) hr = MarshalIDataObjectIntoCurrentApartment(&pIDOTmp); if (SUCCEEDED(hr)) - hr = pIDOTmp->EnumDAdvise(ppenumAdvise); - } + hr = pIDOTmp->EnumDAdvise(ppenumAdvise); + } return hr; } @@ -361,20 +361,20 @@ HRESULT CAPNDataObject::MarshalIDataObjectIntoCurrentApartment( IDataObject** pp *ppIDataObj = NULL; HRESULT hr = E_FAIL; - + if (m_hGlobal) { IStreamPtr pStm; hr = CreateStreamOnHGlobal(m_hGlobal, KEEP_HGLOB_ON_RELEASE, &pStm); - + OSL_ENSURE(E_INVALIDARG != hr, "CreateStreamOnHGlobal with invalid args called"); if (SUCCEEDED(hr)) { - hr = CoUnmarshalInterface(pStm.get(), __uuidof(IDataObject), (void**)ppIDataObj); + hr = CoUnmarshalInterface(pStm.get(), __uuidof(IDataObject), (void**)ppIDataObj); OSL_ENSURE(CO_E_NOTINITIALIZED != hr, "COM is not initialized"); } - } + } return hr; } diff --git a/dtrans/source/win32/dtobj/APNDataObject.hxx b/dtrans/source/win32/dtobj/APNDataObject.hxx index cd9bd2f9a5b0..23fce0f674e6 100644 --- a/dtrans/source/win32/dtobj/APNDataObject.hxx +++ b/dtrans/source/win32/dtobj/APNDataObject.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,13 +39,13 @@ /* an APartment Neutral dataobject wrapper; this wrapper of a IDataObject pointer can be used from any apartment without RPC_E_WRONG_THREAD - which normally occurs if an apartment tries to use an interface + which normally occurs if an apartment tries to use an interface pointer of another apartment; we use containment to hold the original DataObject */ class CAPNDataObject : public IDataObject { -public: +public: CAPNDataObject( IDataObjectPtr rIDataObject ); virtual ~CAPNDataObject( ); @@ -78,8 +78,8 @@ private: private: IDataObjectPtr m_rIDataObjectOrg; - HGLOBAL m_hGlobal; - LONG m_nRefCnt; + HGLOBAL m_hGlobal; + LONG m_nRefCnt; // prevent copy and assignment private: diff --git a/dtrans/source/win32/dtobj/DOTransferable.cxx b/dtrans/source/win32/dtobj/DOTransferable.cxx index 5c051da5678d..630f08b2f955 100644 --- a/dtrans/source/win32/dtobj/DOTransferable.cxx +++ b/dtrans/source/win32/dtobj/DOTransferable.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -69,7 +69,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::container; //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ namespace @@ -81,7 +81,7 @@ namespace sal_Bool isValidFlavor( const DataFlavor& aFlavor ) { return ( aFlavor.MimeType.getLength( ) && - ( ( aFlavor.DataType == CPPUTYPE_SEQINT8 ) || + ( ( aFlavor.DataType == CPPUTYPE_SEQINT8 ) || ( aFlavor.DataType == CPPUTYPE_OUSTRING ) ) ); } @@ -92,21 +92,21 @@ namespace // ctor //------------------------------------------------------------------------ -CDOTransferable::CDOTransferable( +CDOTransferable::CDOTransferable( const Reference< XMultiServiceFactory >& ServiceManager, IDataObjectPtr rDataObject ) : m_rDataObject( rDataObject ), m_SrvMgr( ServiceManager ), m_DataFormatTranslator( m_SrvMgr ), m_bUnicodeRegistered( sal_False ), m_TxtFormatOnClipboard( CF_INVALID ) -{ +{ } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ -Any SAL_CALL CDOTransferable::getTransferData( const DataFlavor& aFlavor ) +Any SAL_CALL CDOTransferable::getTransferData( const DataFlavor& aFlavor ) throw( UnsupportedFlavorException, IOException, RuntimeException ) { OSL_ASSERT( isValidFlavor( aFlavor ) ); @@ -121,21 +121,21 @@ Any SAL_CALL CDOTransferable::getTransferData( const DataFlavor& aFlavor ) OSL_ASSERT( CF_INVALID != fetc.getClipformat() ); //------------------------------------------------ - // get the data from clipboard in a byte stream + // get the data from clipboard in a byte stream //------------------------------------------------ - + ByteSequence_t clipDataStream; - + try { clipDataStream = getClipboardData( fetc ); } catch( UnsupportedFlavorException& ) { - if ( m_DataFormatTranslator.isUnicodeTextFormat( fetc.getClipformat( ) ) && + if ( m_DataFormatTranslator.isUnicodeTextFormat( fetc.getClipformat( ) ) && m_bUnicodeRegistered ) { - OUString aUnicodeText = synthesizeUnicodeText( ); + OUString aUnicodeText = synthesizeUnicodeText( ); Any aAny = makeAny( aUnicodeText ); return aAny; } @@ -154,19 +154,19 @@ Any SAL_CALL CDOTransferable::getTransferData( const DataFlavor& aFlavor ) // getTransferDataFlavors //------------------------------------------------------------------------ -Sequence< DataFlavor > SAL_CALL CDOTransferable::getTransferDataFlavors( ) +Sequence< DataFlavor > SAL_CALL CDOTransferable::getTransferDataFlavors( ) throw( RuntimeException ) -{ - return m_FlavorList; +{ + return m_FlavorList; } //------------------------------------------------------------------------ // isDataFlavorSupported -// returns true if we find a DataFlavor with the same MimeType and +// returns true if we find a DataFlavor with the same MimeType and // DataType //------------------------------------------------------------------------ -sal_Bool SAL_CALL CDOTransferable::isDataFlavorSupported( const DataFlavor& aFlavor ) +sal_Bool SAL_CALL CDOTransferable::isDataFlavorSupported( const DataFlavor& aFlavor ) throw( RuntimeException ) { OSL_ASSERT( isValidFlavor( aFlavor ) ); @@ -181,7 +181,7 @@ sal_Bool SAL_CALL CDOTransferable::isDataFlavorSupported( const DataFlavor& aFla //------------------------------------------------------------------------ // helper function // the list of datafalvors currently on the clipboard will be initialized -// only once; if the client of this Transferable will hold a reference +// only once; if the client of this Transferable will hold a reference // to it und the underlying clipboard content changes, the client does // possible operate on a invalid list // if there is only text on the clipboard we will also offer unicode text @@ -197,7 +197,7 @@ void SAL_CALL CDOTransferable::initFlavorList( ) if ( SUCCEEDED( hr ) ) { pEnumFormatEtc->Reset( ); - + FORMATETC fetc; while ( S_FALSE != pEnumFormatEtc->Next( 1, &fetc, NULL ) ) { @@ -206,9 +206,9 @@ void SAL_CALL CDOTransferable::initFlavorList( ) // we don't offer this format if ( CF_LOCALE == fetc.cfFormat ) continue; - - DataFlavor aFlavor = formatEtcToDataFlavor( fetc ); - + + DataFlavor aFlavor = formatEtcToDataFlavor( fetc ); + // if text or oemtext is offered we also pretend to have unicode text if ( m_DataFormatTranslator.isOemOrAnsiTextFormat( fetc.cfFormat ) && !m_bUnicodeRegistered ) @@ -219,7 +219,7 @@ void SAL_CALL CDOTransferable::initFlavorList( ) m_bUnicodeRegistered = sal_True; // register unicode text as accompany format - aFlavor = formatEtcToDataFlavor( + aFlavor = formatEtcToDataFlavor( m_DataFormatTranslator.getFormatEtcForClipformat( CF_UNICODETEXT ) ); addSupportedFlavor( aFlavor ); } @@ -233,12 +233,12 @@ void SAL_CALL CDOTransferable::initFlavorList( ) // see MSDN IEnumFORMATETC CoTaskMemFree( fetc.ptd ); - } - } + } + } } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ inline @@ -255,20 +255,20 @@ void SAL_CALL CDOTransferable::addSupportedFlavor( const DataFlavor& aFlavor ) } //------------------------------------------------------------------------ -// helper function +// helper function //------------------------------------------------------------------------ //inline DataFlavor SAL_CALL CDOTransferable::formatEtcToDataFlavor( const FORMATETC& aFormatEtc ) -{ +{ DataFlavor aFlavor; LCID lcid = 0; - + // for non-unicode text format we must provid a locale to get // the character-set of the text, if there is no locale on the // clipboard we assume the text is in a charset appropriate for // the current thread locale - if ( (CF_TEXT == aFormatEtc.cfFormat) || (CF_OEMTEXT == aFormatEtc.cfFormat) ) + if ( (CF_TEXT == aFormatEtc.cfFormat) || (CF_OEMTEXT == aFormatEtc.cfFormat) ) lcid = getLocaleFromClipboard( ); return m_DataFormatTranslator.getDataFlavorFromFormatEtc( aFormatEtc, lcid ); @@ -279,22 +279,22 @@ DataFlavor SAL_CALL CDOTransferable::formatEtcToDataFlavor( const FORMATETC& aFo // clipboard the function returns the current thread locale //------------------------------------------------------------------------ -LCID SAL_CALL CDOTransferable::getLocaleFromClipboard( ) +LCID SAL_CALL CDOTransferable::getLocaleFromClipboard( ) { LCID lcid = GetThreadLocale( ); try - { + { CFormatEtc fetc = m_DataFormatTranslator.getFormatEtcForClipformat( CF_LOCALE ); ByteSequence_t aLCIDSeq = getClipboardData( fetc ); lcid = *(reinterpret_cast<LCID*>( aLCIDSeq.getArray( ) ) ); - - // because of a Win95/98 Bug; there the high word + + // 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 &= 0x0000FFFF; - } + lcid &= 0x0000FFFF; + } catch(...) { // we take the default locale @@ -310,27 +310,27 @@ LCID SAL_CALL CDOTransferable::getLocaleFromClipboard( ) //------------------------------------------------------------------------ CDOTransferable::ByteSequence_t SAL_CALL CDOTransferable::getClipboardData( CFormatEtc& aFormatEtc ) -{ +{ STGMEDIUM stgmedium; HRESULT hr = m_rDataObject->GetData( aFormatEtc, &stgmedium ); - + // in case of failure to get a WMF metafile handle, try to get a memory block - if( FAILED( hr ) && - ( CF_METAFILEPICT == aFormatEtc.getClipformat() ) && + if( FAILED( hr ) && + ( CF_METAFILEPICT == aFormatEtc.getClipformat() ) && ( TYMED_MFPICT == aFormatEtc.getTymed() ) ) { CFormatEtc aTempFormat( aFormatEtc ); aTempFormat.setTymed( TYMED_HGLOBAL ); hr = m_rDataObject->GetData( aTempFormat, &stgmedium ); } - - if ( FAILED( hr ) ) + + if ( FAILED( hr ) ) { - OSL_ASSERT( (hr != E_INVALIDARG) && + OSL_ASSERT( (hr != E_INVALIDARG) && (hr != DV_E_DVASPECT) && (hr != DV_E_LINDEX) && (hr != DV_E_TYMED) ); - + if ( DV_E_FORMATETC == hr ) throw UnsupportedFlavorException( ); else if ( STG_E_MEDIUMFULL == hr ) @@ -338,61 +338,61 @@ CDOTransferable::ByteSequence_t SAL_CALL CDOTransferable::getClipboardData( CFor else throw RuntimeException( ); } - + ByteSequence_t byteStream; try - { + { if ( CF_ENHMETAFILE == aFormatEtc.getClipformat() ) - byteStream = WinENHMFPictToOOMFPict( stgmedium.hEnhMetaFile ); + byteStream = WinENHMFPictToOOMFPict( stgmedium.hEnhMetaFile ); else if (CF_HDROP == aFormatEtc.getClipformat()) - byteStream = CF_HDROPToFileList(stgmedium.hGlobal); + byteStream = CF_HDROPToFileList(stgmedium.hGlobal); else { clipDataToByteStream( aFormatEtc.getClipformat( ), stgmedium, byteStream ); - + // format conversion if necessary if ( CF_DIB == aFormatEtc.getClipformat() ) byteStream = WinDIBToOOBMP( byteStream ); else if ( CF_METAFILEPICT == aFormatEtc.getClipformat() ) - byteStream = WinMFPictToOOMFPict( byteStream ); + byteStream = WinMFPictToOOMFPict( byteStream ); } ReleaseStgMedium( &stgmedium ); } catch( CStgTransferHelper::CStgTransferException& ) - { + { ReleaseStgMedium( &stgmedium ); throw IOException( ); - } + } return byteStream; } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ OUString SAL_CALL CDOTransferable::synthesizeUnicodeText( ) -{ +{ ByteSequence_t aTextSequence; - CFormatEtc fetc; - LCID lcid = getLocaleFromClipboard( ); - sal_uInt32 cpForTxtCnvt = 0; - + CFormatEtc fetc; + LCID lcid = getLocaleFromClipboard( ); + sal_uInt32 cpForTxtCnvt = 0; + if ( CF_TEXT == m_TxtFormatOnClipboard ) { fetc = m_DataFormatTranslator.getFormatEtcForClipformat( CF_TEXT ); aTextSequence = getClipboardData( fetc ); - + // determine the codepage used for text conversion - cpForTxtCnvt = getWinCPFromLocaleId( lcid, LOCALE_IDEFAULTANSICODEPAGE ).toInt32( ); + cpForTxtCnvt = getWinCPFromLocaleId( lcid, LOCALE_IDEFAULTANSICODEPAGE ).toInt32( ); } else if ( CF_OEMTEXT == m_TxtFormatOnClipboard ) { fetc = m_DataFormatTranslator.getFormatEtcForClipformat( CF_OEMTEXT ); aTextSequence = getClipboardData( fetc ); - + // determine the codepage used for text conversion cpForTxtCnvt = getWinCPFromLocaleId( lcid, LOCALE_IDEFAULTCODEPAGE ).toInt32( ); } @@ -407,15 +407,15 @@ OUString SAL_CALL CDOTransferable::synthesizeUnicodeText( ) sal::static_int_cast<sal_uInt32>(-1), // Huh ? stgTransferHelper, sal_False); - - CRawHGlobalPtr ptrHGlob(stgTransferHelper); - sal_Unicode* pWChar = reinterpret_cast<sal_Unicode*>(ptrHGlob.GetMemPtr()); - + + CRawHGlobalPtr ptrHGlob(stgTransferHelper); + sal_Unicode* pWChar = reinterpret_cast<sal_Unicode*>(ptrHGlob.GetMemPtr()); + return OUString(pWChar); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ void CDOTransferable::clipDataToByteStream( CLIPFORMAT cf, STGMEDIUM stgmedium, ByteSequence_t& aByteSequence ) @@ -446,25 +446,25 @@ void CDOTransferable::clipDataToByteStream( CLIPFORMAT cf, STGMEDIUM stgmedium, throw UnsupportedFlavorException( ); break; } - + int nMemSize = memTransferHelper.memSize( cf ); aByteSequence.realloc( nMemSize ); - memTransferHelper.read( aByteSequence.getArray( ), nMemSize ); + memTransferHelper.read( aByteSequence.getArray( ), nMemSize ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ -inline +inline Any CDOTransferable::byteStreamToAny( ByteSequence_t& aByteStream, const Type& aRequestedDataType ) -{ +{ Any aAny; - if ( aRequestedDataType == CPPUTYPE_OUSTRING ) - { + if ( aRequestedDataType == CPPUTYPE_OUSTRING ) + { OUString str = byteStreamToOUString( aByteStream ); - aAny = makeAny( str ); + aAny = makeAny( str ); } else aAny = makeAny( aByteStream ); @@ -473,17 +473,17 @@ Any CDOTransferable::byteStreamToAny( ByteSequence_t& aByteStream, const Type& a } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ -inline +inline OUString CDOTransferable::byteStreamToOUString( ByteSequence_t& aByteStream ) { sal_Int32 nWChars; sal_Int32 nMemSize = aByteStream.getLength( ); // if there is a trailing L"\0" substract 1 from length - if ( 0 == aByteStream[ aByteStream.getLength( ) - 2 ] && + if ( 0 == aByteStream[ aByteStream.getLength( ) - 2 ] && 0 == aByteStream[ aByteStream.getLength( ) - 1 ] ) nWChars = static_cast< sal_Int32 >( nMemSize / sizeof( sal_Unicode ) ) - 1; else @@ -493,15 +493,15 @@ OUString CDOTransferable::byteStreamToOUString( ByteSequence_t& aByteStream ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ -sal_Bool SAL_CALL CDOTransferable::compareDataFlavors( +sal_Bool SAL_CALL CDOTransferable::compareDataFlavors( const DataFlavor& lhs, const DataFlavor& rhs ) { if ( !m_rXMimeCntFactory.is( ) ) { - m_rXMimeCntFactory = Reference< XMimeContentTypeFactory >( m_SrvMgr->createInstance( + m_rXMimeCntFactory = Reference< XMimeContentTypeFactory >( m_SrvMgr->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.MimeContentTypeFactory" ) ), UNO_QUERY ); } OSL_ASSERT( m_rXMimeCntFactory.is( ) ); @@ -528,20 +528,20 @@ sal_Bool SAL_CALL CDOTransferable::compareDataFlavors( } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ -sal_Bool SAL_CALL CDOTransferable::cmpFullMediaType( +sal_Bool SAL_CALL CDOTransferable::cmpFullMediaType( const Reference< XMimeContentType >& xLhs, const Reference< XMimeContentType >& xRhs ) const { return xLhs->getFullMediaType().equalsIgnoreAsciiCase( xRhs->getFullMediaType( ) ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ -sal_Bool SAL_CALL CDOTransferable::cmpAllContentTypeParameter( +sal_Bool SAL_CALL CDOTransferable::cmpAllContentTypeParameter( const Reference< XMimeContentType >& xLhs, const Reference< XMimeContentType >& xRhs ) const { Sequence< OUString > xLhsFlavors = xLhs->getParameters( ); @@ -556,7 +556,7 @@ sal_Bool SAL_CALL CDOTransferable::cmpAllContentTypeParameter( OUString pRhs; for ( sal_Int32 i = 0; i < xLhsFlavors.getLength( ); i++ ) - { + { pLhs = xLhs->getParameterValue( xLhsFlavors[i] ); pRhs = xRhs->getParameterValue( xLhsFlavors[i] ); @@ -594,13 +594,13 @@ sal_Bool SAL_CALL CDOTransferable::cmpAllContentTypeParameter( { if (m_rDataObject.is()) { - IDataObject* pObj= m_rDataObject.get(); + IDataObject* pObj= m_rDataObject.get(); pObj->AddRef(); retVal.setValue( &pObj, getCppuType((sal_uInt32*)0)); } } return retVal; } - + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/dtobj/DOTransferable.hxx b/dtrans/source/win32/dtobj/DOTransferable.hxx index eec3c5bb34cd..bdf31dc4ba44 100644 --- a/dtrans/source/win32/dtobj/DOTransferable.hxx +++ b/dtrans/source/win32/dtobj/DOTransferable.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -62,25 +62,25 @@ public: // XTransferable //------------------------------------------------------------------------ - virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) + virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw( ::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) throw( ::com::sun::star::uno::RuntimeException ); - - virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) + + virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw( ::com::sun::star::uno::RuntimeException ); //------------------------------------------------------------------------ // XSystemTransferable //------------------------------------------------------------------------ virtual ::com::sun::star::uno::Any SAL_CALL getData( const com::sun::star::uno::Sequence<sal_Int8>& aProcessId ) throw (::com::sun::star::uno::RuntimeException); - + private: // should be created only by CDTransObjFactory - explicit CDOTransferable( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager, + explicit CDOTransferable( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager, IDataObjectPtr rDataObject ); //------------------------------------------------------------------------ @@ -88,38 +88,38 @@ private: //------------------------------------------------------------------------ void SAL_CALL initFlavorList( ); - - void SAL_CALL addSupportedFlavor( const com::sun::star::datatransfer::DataFlavor& aFlavor ); + + void SAL_CALL addSupportedFlavor( const com::sun::star::datatransfer::DataFlavor& aFlavor ); com::sun::star::datatransfer::DataFlavor SAL_CALL formatEtcToDataFlavor( const FORMATETC& aFormatEtc ); ByteSequence_t SAL_CALL getClipboardData( CFormatEtc& aFormatEtc ); rtl::OUString SAL_CALL synthesizeUnicodeText( ); - void SAL_CALL clipDataToByteStream( CLIPFORMAT cf, STGMEDIUM stgmedium, ByteSequence_t& aByteSequence ); - + void SAL_CALL clipDataToByteStream( CLIPFORMAT cf, STGMEDIUM stgmedium, ByteSequence_t& aByteSequence ); + ::com::sun::star::uno::Any SAL_CALL byteStreamToAny( ByteSequence_t& aByteStream, const com::sun::star::uno::Type& aRequestedDataType ); - rtl::OUString SAL_CALL byteStreamToOUString( ByteSequence_t& aByteStream ); - + rtl::OUString SAL_CALL byteStreamToOUString( ByteSequence_t& aByteStream ); + LCID SAL_CALL getLocaleFromClipboard( ); sal_Bool SAL_CALL compareDataFlavors( const com::sun::star::datatransfer::DataFlavor& lhs, const com::sun::star::datatransfer::DataFlavor& rhs ); - sal_Bool SAL_CALL cmpFullMediaType( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType >& xLhs, + sal_Bool SAL_CALL cmpFullMediaType( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType >& xLhs, const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType >& xRhs ) const; - sal_Bool SAL_CALL cmpAllContentTypeParameter( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType >& xLhs, + sal_Bool SAL_CALL cmpAllContentTypeParameter( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType >& xLhs, const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType >& xRhs ) const; private: - IDataObjectPtr m_rDataObject; - com::sun::star::uno::Sequence< com::sun::star::datatransfer::DataFlavor > m_FlavorList; - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr; - CDataFormatTranslator m_DataFormatTranslator; + IDataObjectPtr m_rDataObject; + com::sun::star::uno::Sequence< com::sun::star::datatransfer::DataFlavor > m_FlavorList; + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr; + CDataFormatTranslator m_DataFormatTranslator; com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentTypeFactory > m_rXMimeCntFactory; - ::osl::Mutex m_aMutex; - sal_Bool m_bUnicodeRegistered; - CLIPFORMAT m_TxtFormatOnClipboard; + ::osl::Mutex m_aMutex; + sal_Bool m_bUnicodeRegistered; + CLIPFORMAT m_TxtFormatOnClipboard; // non supported operations private: diff --git a/dtrans/source/win32/dtobj/DTransHelper.cxx b/dtrans/source/win32/dtobj/DTransHelper.cxx index 34db85ffeed9..2b512092f0f1 100644 --- a/dtrans/source/win32/dtobj/DTransHelper.cxx +++ b/dtrans/source/win32/dtobj/DTransHelper.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/dtrans/source/win32/dtobj/DTransHelper.hxx b/dtrans/source/win32/dtobj/DTransHelper.hxx index 0e6003211f90..0c8ee5b92182 100644 --- a/dtrans/source/win32/dtobj/DTransHelper.hxx +++ b/dtrans/source/win32/dtobj/DTransHelper.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -75,9 +75,9 @@ public: }; public: - CStgTransferHelper( - sal_Bool bAutoInit = sal_False, - HGLOBAL hGlob = NULL, + CStgTransferHelper( + sal_Bool bAutoInit = sal_False, + HGLOBAL hGlob = NULL, sal_Bool bDelStgOnRelease = sal_False ); ~CStgTransferHelper( ); @@ -88,25 +88,25 @@ public: HGLOBAL SAL_CALL getHGlobal( ) const; void SAL_CALL getIStream( LPSTREAM* ppStream ); - void SAL_CALL init( - SIZE_T newSize, - sal_uInt32 uiFlags = GHND, + void SAL_CALL init( + SIZE_T newSize, + sal_uInt32 uiFlags = GHND, sal_Bool bDelStgOnRelease = sal_False ); - void SAL_CALL init( - HGLOBAL hGlob, + void SAL_CALL init( + HGLOBAL hGlob, sal_Bool bDelStgOnRelease = sal_False ); // returns the size of the managed memory sal_uInt32 SAL_CALL memSize( CLIPFORMAT cf = CF_INVALID ) const; - - // free the global memory and necessary + + // free the global memory and necessary // release the internal stream pointer void SAL_CALL cleanup( ); private: LPSTREAM m_lpStream; - sal_Bool m_bDelStgOnRelease; + sal_Bool m_bDelStgOnRelease; private: CStgTransferHelper( const CStgTransferHelper& ); @@ -115,7 +115,7 @@ private: //------------------------------------------------------------------------- // something like an auto-pointer - allows access to the memory belonging -// to a HGLOBAL and automatically unlocks a global memory at destruction +// to a HGLOBAL and automatically unlocks a global memory at destruction // time //------------------------------------------------------------------------- @@ -133,7 +133,7 @@ public: m_pGlobMem( NULL ) { } - + //--------------------------------------------- // ctor @@ -157,7 +157,7 @@ public: } //--------------------------------------------- - // lock the global memory (initializes a + // lock the global memory (initializes a // pointer to this memory) //--------------------------------------------- @@ -182,17 +182,17 @@ public: GlobalUnlock( m_hGlob ); m_bIsLocked = FALSE; m_pGlobMem = NULL; - + return ( NO_ERROR == GetLastError( ) ); } //--------------------------------------------- - // locks the global memory and returns a + // locks the global memory and returns a // pointer to this memory //--------------------------------------------- LPVOID GetMemPtr( ) - { + { Lock( ); return m_pGlobMem; } diff --git a/dtrans/source/win32/dtobj/DataFmtTransl.cxx b/dtrans/source/win32/dtobj/DataFmtTransl.cxx index c832a7a24996..fe5845f2558e 100644 --- a/dtrans/source/win32/dtobj/DataFmtTransl.cxx +++ b/dtrans/source/win32/dtobj/DataFmtTransl.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -55,7 +55,7 @@ #if defined _MSC_VER #pragma warning(pop) #endif - + //------------------------------------------------------------------------ // namespace directives @@ -84,22 +84,22 @@ const OUString HTML_FORMAT_NAME_WINDOWS = OUString::createFromAscii( "HTML Forma const OUString HTML_FORMAT_NAME_SOFFICE = OUString::createFromAscii( "HTML (HyperText Markup Language)" ); //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CDataFormatTranslator::CDataFormatTranslator( const Reference< XMultiServiceFactory >& aServiceManager ) : m_SrvMgr( aServiceManager ) { m_XDataFormatTranslator = Reference< XDataFormatTranslator >( - m_SrvMgr->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.DataFormatTranslator" ) ), UNO_QUERY ); + m_SrvMgr->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.DataFormatTranslator" ) ), UNO_QUERY ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc CDataFormatTranslator::getFormatEtcFromDataFlavor( const DataFlavor& aDataFlavor ) const -{ +{ sal_Int32 cf = CF_INVALID; try @@ -107,21 +107,21 @@ CFormatEtc CDataFormatTranslator::getFormatEtcFromDataFlavor( const DataFlavor& if( m_XDataFormatTranslator.is( ) ) { Any aFormat = m_XDataFormatTranslator->getSystemDataTypeFromDataFlavor( aDataFlavor ); - + if ( aFormat.hasValue( ) ) { if ( aFormat.getValueType( ) == CPPUTYPE_SALINT32 ) { - aFormat >>= cf; + aFormat >>= cf; OSL_ENSURE( CF_INVALID != cf, "Invalid Clipboard format delivered" ); } else if ( aFormat.getValueType( ) == CPPUTYPE_OUSTRING ) { OUString aClipFmtName; aFormat >>= aClipFmtName; - + OSL_ASSERT( aClipFmtName.getLength( ) ); - cf = RegisterClipboardFormatW( reinterpret_cast<LPCWSTR>(aClipFmtName.getStr( )) ); + cf = RegisterClipboardFormatW( reinterpret_cast<LPCWSTR>(aClipFmtName.getStr( )) ); OSL_ENSURE( CF_INVALID != cf, "RegisterClipboardFormat failed" ); } @@ -139,13 +139,13 @@ CFormatEtc CDataFormatTranslator::getFormatEtcFromDataFlavor( const DataFlavor& } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ DataFlavor CDataFormatTranslator::getDataFlavorFromFormatEtc( const FORMATETC& aFormatEtc, LCID lcid ) const { DataFlavor aFlavor; - + try { CLIPFORMAT aClipformat = aFormatEtc.cfFormat; @@ -154,12 +154,12 @@ DataFlavor CDataFormatTranslator::getDataFlavorFromFormatEtc( const FORMATETC& a aAny <<= static_cast< sal_Int32 >( aClipformat ); if ( isOemOrAnsiTextFormat( aClipformat ) ) - { + { aFlavor.MimeType = TEXT_PLAIN_CHARSET; aFlavor.MimeType += getTextCharsetFromLCID( lcid, aClipformat ); aFlavor.HumanPresentableName = HPNAME_OEM_ANSI_TEXT; - aFlavor.DataType = CPPUTYPE_SEQSALINT8; + aFlavor.DataType = CPPUTYPE_SEQSALINT8; } else if ( CF_INVALID != aClipformat ) { @@ -173,7 +173,7 @@ DataFlavor CDataFormatTranslator::getDataFlavorFromFormatEtc( const FORMATETC& a // failed, so we try to resolve via clipboard // format name OUString clipFormatName = getClipboardFormatName( aClipformat ); - + // if we could not get a clipboard format name an // error must have occured or it is a standard // clipboard format that we don't translate, e.g. @@ -196,7 +196,7 @@ DataFlavor CDataFormatTranslator::getDataFlavorFromFormatEtc( const FORMATETC& a } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformatName( const OUString& aClipFmtName ) const @@ -210,7 +210,7 @@ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformatName( const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ OUString CDataFormatTranslator::getClipboardFormatName( CLIPFORMAT aClipformat ) const @@ -224,7 +224,7 @@ OUString CDataFormatTranslator::getClipboardFormatName( CLIPFORMAT aClipformat ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformat( CLIPFORMAT cf ) const @@ -247,10 +247,10 @@ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformat( CLIPFORMAT /* hack: in order to paste urls copied by Internet Explorer - with "copy link" we set the lindex member to 0 + with "copy link" we set the lindex member to 0 but if we really want to support CFSTR_FILECONTENT and the accompany format CFSTR_FILEDESCRIPTOR (FileGroupDescriptor) - the client of the clipboard service has to provide a id + the client of the clipboard service has to provide a id of which FileContents it wants to paste see MSDN: "Handling Shell Data Transfer Scenarios" */ @@ -261,7 +261,7 @@ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformat( CLIPFORMAT } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CDataFormatTranslator::isOemOrAnsiTextFormat( CLIPFORMAT cf ) const @@ -270,7 +270,7 @@ sal_Bool SAL_CALL CDataFormatTranslator::isOemOrAnsiTextFormat( CLIPFORMAT cf ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CDataFormatTranslator::isUnicodeTextFormat( CLIPFORMAT cf ) const @@ -279,16 +279,16 @@ sal_Bool SAL_CALL CDataFormatTranslator::isUnicodeTextFormat( CLIPFORMAT cf ) co } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ -sal_Bool SAL_CALL CDataFormatTranslator::isTextFormat( CLIPFORMAT cf ) const +sal_Bool SAL_CALL CDataFormatTranslator::isTextFormat( CLIPFORMAT cf ) const { return ( isOemOrAnsiTextFormat( cf ) || isUnicodeTextFormat( cf ) ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CDataFormatTranslator::isHTMLFormat( CLIPFORMAT cf ) const @@ -298,17 +298,17 @@ sal_Bool SAL_CALL CDataFormatTranslator::isHTMLFormat( CLIPFORMAT cf ) const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CDataFormatTranslator::isTextHtmlFormat( CLIPFORMAT cf ) const { - OUString clipFormatName = getClipboardFormatName( cf ); + OUString clipFormatName = getClipboardFormatName( cf ); return ( clipFormatName.equalsIgnoreAsciiCase( HTML_FORMAT_NAME_SOFFICE ) ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ OUString SAL_CALL CDataFormatTranslator::getTextCharsetFromLCID( LCID lcid, CLIPFORMAT aClipformat ) const @@ -317,22 +317,22 @@ OUString SAL_CALL CDataFormatTranslator::getTextCharsetFromLCID( LCID lcid, CLIP OUString charset; if ( CF_TEXT == aClipformat ) - { - charset = getMimeCharsetFromLocaleId( - lcid, - LOCALE_IDEFAULTANSICODEPAGE, + { + charset = getMimeCharsetFromLocaleId( + lcid, + LOCALE_IDEFAULTANSICODEPAGE, PRE_WINDOWS_CODEPAGE ); } else if ( CF_OEMTEXT == aClipformat ) - { - charset = getMimeCharsetFromLocaleId( - lcid, - LOCALE_IDEFAULTCODEPAGE, - PRE_OEM_CODEPAGE ); + { + charset = getMimeCharsetFromLocaleId( + lcid, + LOCALE_IDEFAULTCODEPAGE, + PRE_OEM_CODEPAGE ); } else // CF_UNICODE OSL_ASSERT( sal_False ); - + return charset; } diff --git a/dtrans/source/win32/dtobj/DataFmtTransl.hxx b/dtrans/source/win32/dtobj/DataFmtTransl.hxx index 58cf51a89f63..0ed9426bd69b 100644 --- a/dtrans/source/win32/dtobj/DataFmtTransl.hxx +++ b/dtrans/source/win32/dtobj/DataFmtTransl.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -57,15 +57,15 @@ class CFormatEtc; class CDataFormatTranslator { public: - CDataFormatTranslator( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager ); + CDataFormatTranslator( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager ); CFormatEtc getFormatEtcFromDataFlavor( const com::sun::star::datatransfer::DataFlavor& aDataFlavor ) const; - com::sun::star::datatransfer::DataFlavor getDataFlavorFromFormatEtc( + com::sun::star::datatransfer::DataFlavor getDataFlavorFromFormatEtc( const FORMATETC& aFormatEtc, LCID lcid = GetThreadLocale( ) ) const; CFormatEtc SAL_CALL getFormatEtcForClipformat( CLIPFORMAT cf ) const; CFormatEtc SAL_CALL getFormatEtcForClipformatName( const rtl::OUString& aClipFmtName ) const; - rtl::OUString SAL_CALL getClipboardFormatName( CLIPFORMAT aClipformat ) const; + rtl::OUString SAL_CALL getClipboardFormatName( CLIPFORMAT aClipformat ) const; sal_Bool SAL_CALL isHTMLFormat( CLIPFORMAT cf ) const; sal_Bool SAL_CALL isTextHtmlFormat( CLIPFORMAT cf ) const; @@ -73,12 +73,12 @@ public: sal_Bool SAL_CALL isUnicodeTextFormat( CLIPFORMAT cf ) const; sal_Bool SAL_CALL isTextFormat( CLIPFORMAT cf ) const; -private: +private: rtl::OUString SAL_CALL getTextCharsetFromLCID( LCID lcid, CLIPFORMAT aClipformat ) const; private: - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr; - com::sun::star::uno::Reference< com::sun::star::datatransfer::XDataFormatTranslator > m_XDataFormatTranslator; + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr; + com::sun::star::uno::Reference< com::sun::star::datatransfer::XDataFormatTranslator > m_XDataFormatTranslator; }; #endif diff --git a/dtrans/source/win32/dtobj/DtObjFactory.cxx b/dtrans/source/win32/dtobj/DtObjFactory.cxx index 0f69b389e8ce..581ef2b723c1 100644 --- a/dtrans/source/win32/dtobj/DtObjFactory.cxx +++ b/dtrans/source/win32/dtobj/DtObjFactory.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -66,7 +66,7 @@ Reference< XTransferable > SAL_CALL CDTransObjFactory::createTransferableFromDat pTransf->initFlavorList(); pTransf->release(); - return refDOTransf; + return refDOTransf; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/dtobj/Fetc.cxx b/dtrans/source/win32/dtobj/Fetc.cxx index f9bbe856436e..9443599ff479 100644 --- a/dtrans/source/win32/dtobj/Fetc.cxx +++ b/dtrans/source/win32/dtobj/Fetc.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,7 +37,7 @@ #include "..\misc\ImplHelper.hxx" //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc::CFormatEtc( ) @@ -59,7 +59,7 @@ CFormatEtc::CFormatEtc( const FORMATETC& aFormatEtc ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc::~CFormatEtc( ) @@ -68,7 +68,7 @@ CFormatEtc::~CFormatEtc( ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc::CFormatEtc( CLIPFORMAT cf, DWORD tymed, DVTARGETDEVICE* ptd, DWORD dwAspect, LONG lindex ) @@ -77,11 +77,11 @@ CFormatEtc::CFormatEtc( CLIPFORMAT cf, DWORD tymed, DVTARGETDEVICE* ptd, DWORD d m_FormatEtc.ptd = CopyTargetDevice( ptd ); m_FormatEtc.dwAspect = dwAspect; m_FormatEtc.lindex = lindex; - m_FormatEtc.tymed = tymed; + m_FormatEtc.tymed = tymed; } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc::CFormatEtc( const CFormatEtc& theOther ) @@ -94,7 +94,7 @@ CFormatEtc::CFormatEtc( const CFormatEtc& theOther ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc& CFormatEtc::operator=( const CFormatEtc& theOther ) @@ -114,7 +114,7 @@ CFormatEtc& CFormatEtc::operator=( const CFormatEtc& theOther ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc::operator FORMATETC*( ) @@ -123,7 +123,7 @@ CFormatEtc::operator FORMATETC*( ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc::operator FORMATETC( ) @@ -132,7 +132,7 @@ CFormatEtc::operator FORMATETC( ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ void CFormatEtc::getFORMATETC( LPFORMATETC lpFormatEtc ) @@ -144,7 +144,7 @@ void CFormatEtc::getFORMATETC( LPFORMATETC lpFormatEtc ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CLIPFORMAT CFormatEtc::getClipformat( ) const @@ -153,7 +153,7 @@ CLIPFORMAT CFormatEtc::getClipformat( ) const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ DWORD CFormatEtc::getTymed( ) const @@ -162,7 +162,7 @@ DWORD CFormatEtc::getTymed( ) const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ void CFormatEtc::getTargetDevice( DVTARGETDEVICE** lpDvTargetDevice ) const @@ -177,7 +177,7 @@ void CFormatEtc::getTargetDevice( DVTARGETDEVICE** lpDvTargetDevice ) const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ DWORD CFormatEtc::getDvAspect( ) const @@ -186,7 +186,7 @@ DWORD CFormatEtc::getDvAspect( ) const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ LONG CFormatEtc::getLindex( ) const @@ -195,7 +195,7 @@ LONG CFormatEtc::getLindex( ) const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ void CFormatEtc::setClipformat( CLIPFORMAT cf ) @@ -204,7 +204,7 @@ void CFormatEtc::setClipformat( CLIPFORMAT cf ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ void CFormatEtc::setTymed( DWORD tymed ) @@ -223,7 +223,7 @@ void CFormatEtc::setTargetDevice( DVTARGETDEVICE* ptd ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ void CFormatEtc::setDvAspect( DWORD dwAspect ) @@ -232,7 +232,7 @@ void CFormatEtc::setDvAspect( DWORD dwAspect ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ void CFormatEtc::setLindex( LONG lindex ) @@ -241,7 +241,7 @@ void CFormatEtc::setLindex( LONG lindex ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Int32 operator==( const CFormatEtc& lhs, const CFormatEtc& rhs ) @@ -250,7 +250,7 @@ sal_Int32 operator==( const CFormatEtc& lhs, const CFormatEtc& rhs ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Int32 operator!=( const CFormatEtc& lhs, const CFormatEtc& rhs ) diff --git a/dtrans/source/win32/dtobj/Fetc.hxx b/dtrans/source/win32/dtobj/Fetc.hxx index 8dfba3672ac9..9c6be8e2b799 100644 --- a/dtrans/source/win32/dtobj/Fetc.hxx +++ b/dtrans/source/win32/dtobj/Fetc.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -48,7 +48,7 @@ stl container elements must fulfill the following requirements: 1. they need a copy ctor and assignement operator(?) 2. they must be compareable - because the FORMATETC structure has a pointer to a TARGETDEVICE + because the FORMATETC structure has a pointer to a TARGETDEVICE structure we need a simple wrapper class to fulfill these needs ***********************************************************************/ diff --git a/dtrans/source/win32/dtobj/FetcList.cxx b/dtrans/source/win32/dtobj/FetcList.cxx index 2364a0a14341..00cd28c2a279 100644 --- a/dtrans/source/win32/dtobj/FetcList.cxx +++ b/dtrans/source/win32/dtobj/FetcList.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -58,14 +58,14 @@ using namespace rtl; using namespace std; //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ LCID CFormatRegistrar::m_TxtLocale = 0; sal_uInt32 CFormatRegistrar::m_TxtCodePage = GetACP( ); //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtcContainer::CFormatEtcContainer( ) @@ -74,29 +74,29 @@ CFormatEtcContainer::CFormatEtcContainer( ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ void CFormatEtcContainer::addFormatEtc( const CFormatEtc& fetc ) { - m_FormatMap.push_back( CFormatEtc( fetc ) ); + m_FormatMap.push_back( CFormatEtc( fetc ) ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ void SAL_CALL CFormatEtcContainer::removeFormatEtc( const CFormatEtc& fetc ) { - FormatEtcMap_t::iterator iter = + FormatEtcMap_t::iterator iter = find( m_FormatMap.begin(), m_FormatMap.end(), fetc ); - + if ( iter != m_FormatMap.end( ) ) m_FormatMap.erase( iter ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ void SAL_CALL CFormatEtcContainer::removeAllFormatEtc( ) @@ -105,40 +105,40 @@ void SAL_CALL CFormatEtcContainer::removeAllFormatEtc( ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool CFormatEtcContainer::hasFormatEtc( const CFormatEtc& fetc ) const -{ - FormatEtcMap_t::const_iterator iter = +{ + FormatEtcMap_t::const_iterator iter = find( m_FormatMap.begin(), m_FormatMap.end(), fetc ); - + return ( iter != m_FormatMap.end( ) ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ - + sal_Bool CFormatEtcContainer::hasElements( ) const { return ( m_FormatMap.size( ) > 0 ); } - + //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ void CFormatEtcContainer::beginEnumFormatEtc( ) { m_EnumIterator = m_FormatMap.begin( ); } - + //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ -sal_uInt32 SAL_CALL CFormatEtcContainer::nextFormatEtc( LPFORMATETC lpFetc, +sal_uInt32 SAL_CALL CFormatEtcContainer::nextFormatEtc( LPFORMATETC lpFetc, sal_uInt32 aNum ) { OSL_ASSERT( lpFetc ); @@ -157,15 +157,15 @@ sal_uInt32 SAL_CALL CFormatEtcContainer::nextFormatEtc( LPFORMATETC lpFetc, //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CFormatEtcContainer::skipFormatEtc( sal_uInt32 aNum ) { FormatEtcMap_t::const_iterator iter_end = m_FormatMap.end( ); - for ( sal_uInt32 i = 0; - (i < aNum) && (m_EnumIterator != iter_end); - i++, ++m_EnumIterator ) + for ( sal_uInt32 i = 0; + (i < aNum) && (m_EnumIterator != iter_end); + i++, ++m_EnumIterator ) ;/* intentionally left empty */ return ( m_EnumIterator != m_FormatMap.end( ) ); @@ -176,15 +176,15 @@ sal_Bool SAL_CALL CFormatEtcContainer::skipFormatEtc( sal_uInt32 aNum ) //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatRegistrar::CFormatRegistrar( const Reference< XMultiServiceFactory >& ServiceManager, - const CDataFormatTranslator& aDataFormatTranslator ) : + const CDataFormatTranslator& aDataFormatTranslator ) : m_DataFormatTranslator( aDataFormatTranslator ), m_bHasSynthesizedLocale( sal_False ), m_SrvMgr( ServiceManager ) -{ +{ } // ---------------------------------------------------------------------------------------- @@ -192,26 +192,26 @@ CFormatRegistrar::CFormatRegistrar( const Reference< XMultiServiceFactory >& Ser // an appropriate FORMATETC structure, for some formats like unicodetext, // text and text/html we will offer an accompany format e.g.: // -// DataFlavor | Registered Clipformat | Registered accompany clipformat +// DataFlavor | Registered Clipformat | Registered accompany clipformat // -------------------------|---------------------------|----------------------------------- -// text/plain;charset=ansi | CF_TEXT | CF_UNICODETEXT -// | | CF_LOCALE (if charset != GetACP() -// | | -// text/plain;charset=oem | CF_OEMTEXT | CF_UNICODETEXT -// | | CF_LOCALE (if charset != GetOEMCP() -// | | -// text/plain;charset=utf-16| CF_UNICODETEXT | CF_TEXT -// | | -// text/html | HTML (Hypertext ...) | HTML Format -// | | +// text/plain;charset=ansi | CF_TEXT | CF_UNICODETEXT +// | | CF_LOCALE (if charset != GetACP() +// | | +// text/plain;charset=oem | CF_OEMTEXT | CF_UNICODETEXT +// | | CF_LOCALE (if charset != GetOEMCP() +// | | +// text/plain;charset=utf-16| CF_UNICODETEXT | CF_TEXT +// | | +// text/html | HTML (Hypertext ...) | HTML Format +// | | // -// if some tries to register different text formats with different charsets the last +// if some tries to register different text formats with different charsets the last // registered wins and the others are ignored // ---------------------------------------------------------------------------------------- -void SAL_CALL CFormatRegistrar::RegisterFormats( +void SAL_CALL CFormatRegistrar::RegisterFormats( const Reference< XTransferable >& aXTransferable, CFormatEtcContainer& aFormatEtcContainer ) -{ +{ Sequence< DataFlavor > aFlavorList = aXTransferable->getTransferDataFlavors( ); sal_Int32 nFlavors = aFlavorList.getLength( ); sal_Bool bUnicodeRegistered = sal_False; @@ -221,7 +221,7 @@ void SAL_CALL CFormatRegistrar::RegisterFormats( { aFlavor = aFlavorList[i]; CFormatEtc fetc = m_DataFormatTranslator.getFormatEtcFromDataFlavor( aFlavor ); - + // maybe an internal format so we ignore it if ( CF_INVALID == fetc.getClipformat( ) ) continue; @@ -239,52 +239,52 @@ void SAL_CALL CFormatRegistrar::RegisterFormats( // we register CF_TEXT for non unicode clients if ( m_DataFormatTranslator.isUnicodeTextFormat( fetc.getClipformat() ) ) { - aFormatEtcContainer.addFormatEtc( fetc ); // add CF_UNICODE - aFormatEtcContainer.addFormatEtc( + aFormatEtcContainer.addFormatEtc( fetc ); // add CF_UNICODE + aFormatEtcContainer.addFormatEtc( m_DataFormatTranslator.getFormatEtcForClipformat( CF_TEXT ) ); // add CF_TEXT bUnicodeRegistered = sal_True; } - else if ( !hasUnicodeFlavor( aXTransferable ) ) + else if ( !hasUnicodeFlavor( aXTransferable ) ) { // we try to investigate the charset and make a valid // windows codepage from this charset the default // return value is the result of GetACP( ) OUString charset = getCharsetFromDataFlavor( aFlavor ); - sal_uInt32 txtCP = getWinCPFromMimeCharset( charset ); - + sal_uInt32 txtCP = getWinCPFromMimeCharset( charset ); + // we try to get a Locale appropriate for this codepage if ( findLocaleForTextCodePage( ) ) { m_TxtCodePage = txtCP; - aFormatEtcContainer.addFormatEtc( + aFormatEtcContainer.addFormatEtc( m_DataFormatTranslator.getFormatEtcForClipformat( CF_UNICODETEXT ) ); - + if ( !IsOEMCP( m_TxtCodePage ) ) - aFormatEtcContainer.addFormatEtc( + aFormatEtcContainer.addFormatEtc( m_DataFormatTranslator.getFormatEtcForClipformat( CF_TEXT ) ); else - aFormatEtcContainer.addFormatEtc( + aFormatEtcContainer.addFormatEtc( m_DataFormatTranslator.getFormatEtcForClipformat( CF_OEMTEXT ) ); - aFormatEtcContainer.addFormatEtc( + aFormatEtcContainer.addFormatEtc( m_DataFormatTranslator.getFormatEtcForClipformat( CF_LOCALE ) ); - - // we save the flavor so it's easier when + + // we save the flavor so it's easier when // queried for it in XTDataObject::GetData(...) m_RegisteredTextFlavor = aFlavor; m_bHasSynthesizedLocale = sal_True; - } + } } } else if ( m_DataFormatTranslator.isTextHtmlFormat( fetc.getClipformat( ) ) ) // Html (Hyper Text...) { // we add text/html ( HTML (HyperText Markup Language) ) aFormatEtcContainer.addFormatEtc( fetc ); - + // and HTML Format OUString htmlFormat( OUString::createFromAscii( "HTML Format" ) ); - aFormatEtcContainer.addFormatEtc( + aFormatEtcContainer.addFormatEtc( m_DataFormatTranslator.getFormatEtcForClipformatName( htmlFormat ) ); } } @@ -292,7 +292,7 @@ void SAL_CALL CFormatRegistrar::RegisterFormats( } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CFormatRegistrar::hasSynthesizedLocale( ) const @@ -301,7 +301,7 @@ sal_Bool SAL_CALL CFormatRegistrar::hasSynthesizedLocale( ) const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ LCID SAL_CALL CFormatRegistrar::getSynthesizedLocale( ) const @@ -310,7 +310,7 @@ LCID SAL_CALL CFormatRegistrar::getSynthesizedLocale( ) const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_uInt32 SAL_CALL CFormatRegistrar::getRegisteredTextCodePage( ) const @@ -319,7 +319,7 @@ sal_uInt32 SAL_CALL CFormatRegistrar::getRegisteredTextCodePage( ) const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ DataFlavor SAL_CALL CFormatRegistrar::getRegisteredTextFlavor( ) const @@ -328,7 +328,7 @@ DataFlavor SAL_CALL CFormatRegistrar::getRegisteredTextFlavor( ) const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CFormatRegistrar::isSynthesizeableFormat( const CFormatEtc& aFormatEtc ) const @@ -339,7 +339,7 @@ sal_Bool SAL_CALL CFormatRegistrar::isSynthesizeableFormat( const CFormatEtc& aF } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ inline @@ -351,7 +351,7 @@ sal_Bool SAL_CALL CFormatRegistrar::needsToSynthesizeAccompanyFormats( const CFo } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ OUString SAL_CALL CFormatRegistrar::getCharsetFromDataFlavor( const DataFlavor& aFlavor ) @@ -360,22 +360,22 @@ OUString SAL_CALL CFormatRegistrar::getCharsetFromDataFlavor( const DataFlavor& try { - Reference< XMimeContentTypeFactory > xMimeFac( + Reference< XMimeContentTypeFactory > xMimeFac( m_SrvMgr->createInstance( OUString::createFromAscii( \ "com.sun.star.datatransfer.MimeContentTypeFactory" ) ), UNO_QUERY ); - + if( xMimeFac.is( ) ) { Reference< XMimeContentType > xMimeType( xMimeFac->createMimeContentType( aFlavor.MimeType ) ); if ( xMimeType->hasParameter( TEXTPLAIN_PARAM_CHARSET ) ) charset = xMimeType->getParameterValue( TEXTPLAIN_PARAM_CHARSET ); - else + else charset = getMimeCharsetFromWinCP( GetACP( ), PRE_WINDOWS_CODEPAGE ); } } catch(NoSuchElementException&) { - OSL_ENSURE( sal_False, "Unexpected" ); + OSL_ENSURE( sal_False, "Unexpected" ); } catch(...) { @@ -386,21 +386,21 @@ OUString SAL_CALL CFormatRegistrar::getCharsetFromDataFlavor( const DataFlavor& } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CFormatRegistrar::hasUnicodeFlavor( const Reference< XTransferable >& aXTransferable ) const { CFormatEtc fetc( CF_UNICODETEXT ); - DataFlavor aFlavor = + DataFlavor aFlavor = m_DataFormatTranslator.getDataFlavorFromFormatEtc( fetc ); - + return aXTransferable->isDataFlavorSupported( aFlavor ); -} +} //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ inline @@ -410,7 +410,7 @@ sal_Bool CFormatRegistrar::isEqualCurrentSystemCodePage( sal_uInt32 aCodePage ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CFormatRegistrar::findLocaleForTextCodePage( ) @@ -421,59 +421,59 @@ sal_Bool SAL_CALL CFormatRegistrar::findLocaleForTextCodePage( ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CFormatRegistrar::isLocaleCodePage( LCID lcid, LCTYPE lctype, sal_uInt32 codepage ) -{ - char buff[6]; +{ + char buff[6]; sal_uInt32 localeCodePage; - + OSL_ASSERT( IsValidLocale( lcid, LCID_INSTALLED ) ); // get the ansi codepage of the current locale - GetLocaleInfoA( lcid, lctype, buff, sizeof( buff ) ); + GetLocaleInfoA( lcid, lctype, buff, sizeof( buff ) ); localeCodePage = atol( buff ); return ( localeCodePage == codepage ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ inline -sal_Bool SAL_CALL CFormatRegistrar::isLocaleOemCodePage( LCID lcid, sal_uInt32 codepage ) +sal_Bool SAL_CALL CFormatRegistrar::isLocaleOemCodePage( LCID lcid, sal_uInt32 codepage ) { return isLocaleCodePage( lcid, LOCALE_IDEFAULTCODEPAGE, codepage ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ inline sal_Bool SAL_CALL CFormatRegistrar::isLocaleAnsiCodePage( LCID lcid, sal_uInt32 codepage ) { - return isLocaleCodePage( lcid, LOCALE_IDEFAULTANSICODEPAGE, codepage ); -} + return isLocaleCodePage( lcid, LOCALE_IDEFAULTANSICODEPAGE, codepage ); +} //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ BOOL CALLBACK CFormatRegistrar::EnumLocalesProc( LPSTR lpLocaleStr ) { // the lpLocaleStr parametere is hexadecimal LCID lcid = strtol( lpLocaleStr, NULL, 16 ); - - if ( isLocaleAnsiCodePage( lcid, CFormatRegistrar::m_TxtCodePage ) || + + if ( isLocaleAnsiCodePage( lcid, CFormatRegistrar::m_TxtCodePage ) || isLocaleOemCodePage( lcid, CFormatRegistrar::m_TxtCodePage ) ) - { - CFormatRegistrar::m_TxtLocale = lcid; + { + CFormatRegistrar::m_TxtLocale = lcid; return sal_False; // stop enumerating } - + return sal_True; } diff --git a/dtrans/source/win32/dtobj/FetcList.hxx b/dtrans/source/win32/dtobj/FetcList.hxx index de5e00fa9c3a..51ead901b9de 100644 --- a/dtrans/source/win32/dtobj/FetcList.hxx +++ b/dtrans/source/win32/dtobj/FetcList.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,7 +50,7 @@ /***************************************************************** a simple container for FORMATECT structures - instances of this class are not thread-safe + instances of this class are not thread-safe *****************************************************************/ class CFormatEtcContainer @@ -60,23 +60,23 @@ public: // duplicates not allowed void SAL_CALL addFormatEtc( const CFormatEtc& fetc ); - - // removes the specified formatetc + + // removes the specified formatetc void SAL_CALL removeFormatEtc( const CFormatEtc& fetc ); - + // removes the formatetc at pos void SAL_CALL removeAllFormatEtc( ); sal_Bool SAL_CALL hasFormatEtc( const CFormatEtc& fetc ) const; - + sal_Bool SAL_CALL hasElements( ) const; - + // begin enumeration void SAL_CALL beginEnumFormatEtc( ); - + // copies the specified number of formatetc structures starting // at the current enum position - // the return value is the number of copied elements; if the + // the return value is the number of copied elements; if the // current enum position is at the end the return value is 0 sal_uInt32 SAL_CALL nextFormatEtc( LPFORMATETC lpFetc, sal_uInt32 aNum = 1 ); @@ -86,7 +86,7 @@ public: protected: typedef std::vector< CFormatEtc > FormatEtcMap_t; -private: +private: FormatEtcMap_t m_FormatMap; FormatEtcMap_t::iterator m_EnumIterator; }; @@ -95,10 +95,10 @@ private: a helper class which converts data flavors to clipformats, creates an appropriate formatetc structures and if possible synthesizes clipboard formats if necessary, e.g. if text - is provided a locale will also be provided; + is provided a locale will also be provided; the class registers the formatetc within a CFormatEtcContainer - instances of this class are not thread-safe and multiple + instances of this class are not thread-safe and multiple instances of this class would use the same static variables that's why this class should not be used by multiple threads, only one thread of a process should use it @@ -111,24 +111,24 @@ class CFormatRegistrar { public: CFormatRegistrar( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager, - const CDataFormatTranslator& aDataFormatTranslator ); - + const CDataFormatTranslator& aDataFormatTranslator ); + void SAL_CALL RegisterFormats( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable >& aXTransferable, CFormatEtcContainer& aFormatEtcContainer ); - + sal_Bool SAL_CALL hasSynthesizedLocale( ) const; LCID SAL_CALL getSynthesizedLocale( ) const; sal_uInt32 SAL_CALL getRegisteredTextCodePage( ) const; com::sun::star::datatransfer::DataFlavor SAL_CALL getRegisteredTextFlavor( ) const; - + sal_Bool SAL_CALL isSynthesizeableFormat( const CFormatEtc& aFormatEtc ) const; sal_Bool SAL_CALL needsToSynthesizeAccompanyFormats( const CFormatEtc& aFormatEtc ) const; -private: +private: sal_Bool SAL_CALL isEqualCurrentSystemCodePage( sal_uInt32 aCodePage ) const; rtl::OUString SAL_CALL getCharsetFromDataFlavor( const com::sun::star::datatransfer::DataFlavor& aFlavor ); - - sal_Bool SAL_CALL hasUnicodeFlavor( + + sal_Bool SAL_CALL hasUnicodeFlavor( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable >& aXTransferable ) const; sal_Bool SAL_CALL findLocaleForTextCodePage( ); @@ -138,17 +138,17 @@ private: static sal_Bool SAL_CALL isLocaleCodePage( LCID lcid, LCTYPE lctype, sal_uInt32 codepage ); static BOOL CALLBACK EnumLocalesProc( LPSTR lpLocaleStr ); - -private: - const CDataFormatTranslator& m_DataFormatTranslator; - sal_Bool m_bHasSynthesizedLocale; + +private: + const CDataFormatTranslator& m_DataFormatTranslator; + sal_Bool m_bHasSynthesizedLocale; com::sun::star::datatransfer::DataFlavor m_RegisteredTextFlavor; - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr; - + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr; + static LCID m_TxtLocale; static sal_uInt32 m_TxtCodePage; - + private: CFormatRegistrar( const CFormatRegistrar& ); CFormatRegistrar& operator=( const CFormatRegistrar& ); diff --git a/dtrans/source/win32/dtobj/FmtFilter.cxx b/dtrans/source/win32/dtobj/FmtFilter.cxx index 235c63e298f9..0702ef4892d0 100644 --- a/dtrans/source/win32/dtobj/FmtFilter.cxx +++ b/dtrans/source/win32/dtobj/FmtFilter.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -74,24 +74,24 @@ Sequence< sal_Int8 > SAL_CALL WinMFPictToOOMFPict( Sequence< sal_Int8 >& aMetaFi { OSL_ASSERT( aMetaFilePict.getLength( ) == sizeof( METAFILEPICT ) ); - Sequence< sal_Int8 > mfpictStream; + Sequence< sal_Int8 > mfpictStream; METAFILEPICT* pMFPict = reinterpret_cast< METAFILEPICT* >( aMetaFilePict.getArray( ) ); HMETAFILE hMf = pMFPict->hMF; sal_uInt32 nCount = GetMetaFileBitsEx( hMf, 0, NULL ); - + if ( nCount > 0 ) { mfpictStream.realloc( nCount + sizeof( METAFILEHEADER ) ); METAFILEHEADER* pMFHeader = reinterpret_cast< METAFILEHEADER* >( mfpictStream.getArray( ) ); - SMALL_RECT aRect = { 0, - 0, - static_cast< short >( pMFPict->xExt ), + SMALL_RECT aRect = { 0, + 0, + static_cast< short >( pMFPict->xExt ), static_cast< short >( pMFPict->yExt ) }; USHORT nInch; switch( pMFPict->mm ) - { + { case MM_TEXT: nInch = 72; break; @@ -107,7 +107,7 @@ Sequence< sal_Int8 > SAL_CALL WinMFPictToOOMFPict( Sequence< sal_Int8 >& aMetaFi case MM_LOENGLISH: nInch = 254; break; - + case MM_HIENGLISH: case MM_ISOTROPIC: case MM_ANISOTROPIC: @@ -134,20 +134,20 @@ Sequence< sal_Int8 > SAL_CALL WinMFPictToOOMFPict( Sequence< sal_Int8 >& aMetaFi nCount = GetMetaFileBitsEx( pMFPict->hMF, nCount, pMFBuff + sizeof( METAFILEHEADER ) ); OSL_ASSERT( nCount > 0 ); } - + return mfpictStream; } //------------------------------------------------------------- -// convert a windows enhanced metafile to a openoffice metafile +// convert a windows enhanced metafile to a openoffice metafile //------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL WinENHMFPictToOOMFPict( HENHMETAFILE hEnhMetaFile ) { - Sequence< sal_Int8 > aRet; - UINT nSize = 0; + Sequence< sal_Int8 > aRet; + UINT nSize = 0; - if( hEnhMetaFile && + if( hEnhMetaFile && ( ( nSize = GetEnhMetaFileBits( hEnhMetaFile, 0, NULL ) ) != 0 ) ) { aRet.realloc( nSize ); @@ -165,8 +165,8 @@ Sequence< sal_Int8 > SAL_CALL WinENHMFPictToOOMFPict( HENHMETAFILE hEnhMetaFile HMETAFILEPICT SAL_CALL OOMFPictToWinMFPict( Sequence< sal_Int8 >& aOOMetaFilePict ) { - HMETAFILEPICT hPict = NULL; - HMETAFILE hMtf = SetMetaFileBitsEx( aOOMetaFilePict.getLength(), (sal_uChar*) aOOMetaFilePict.getConstArray() ); + HMETAFILEPICT hPict = NULL; + HMETAFILE hMtf = SetMetaFileBitsEx( aOOMetaFilePict.getLength(), (sal_uChar*) aOOMetaFilePict.getConstArray() ); if( hMtf ) { @@ -201,14 +201,14 @@ HENHMETAFILE SAL_CALL OOMFPictToWinENHMFPict( Sequence< sal_Int8 >& aOOMetaFileP Sequence< sal_Int8 > SAL_CALL WinDIBToOOBMP( const Sequence< sal_Int8 >& aWinDIB ) { OSL_ASSERT( aWinDIB.getLength( ) > sizeof( BITMAPINFOHEADER ) ); - + Sequence< sal_Int8 > ooBmpStream; ooBmpStream.realloc( aWinDIB.getLength( ) + sizeof(BITMAPFILEHEADER) ); - - const BITMAPINFOHEADER *pBmpInfoHdr = (const BITMAPINFOHEADER*)aWinDIB.getConstArray(); - BITMAPFILEHEADER *pBmpFileHdr = reinterpret_cast< BITMAPFILEHEADER* >( ooBmpStream.getArray() ); - DWORD nOffset = sizeof( BITMAPFILEHEADER ) + sizeof( BITMAPINFOHEADER ); + + const BITMAPINFOHEADER *pBmpInfoHdr = (const BITMAPINFOHEADER*)aWinDIB.getConstArray(); + BITMAPFILEHEADER *pBmpFileHdr = reinterpret_cast< BITMAPFILEHEADER* >( ooBmpStream.getArray() ); + DWORD nOffset = sizeof( BITMAPFILEHEADER ) + sizeof( BITMAPINFOHEADER ); rtl_copyMemory( pBmpFileHdr + 1, pBmpInfoHdr, aWinDIB.getLength( ) ); @@ -216,12 +216,12 @@ Sequence< sal_Int8 > SAL_CALL WinDIBToOOBMP( const Sequence< sal_Int8 >& aWinDIB nOffset += ( pBmpInfoHdr->biClrUsed ? pBmpInfoHdr->biClrUsed : ( 1 << pBmpInfoHdr->biBitCount ) ) << 2; else if( ( BI_BITFIELDS == pBmpInfoHdr->biCompression ) && ( ( 16 == pBmpInfoHdr->biBitCount ) || ( 32 == pBmpInfoHdr->biBitCount ) ) ) nOffset += 12; - + pBmpFileHdr->bfType = 'MB'; pBmpFileHdr->bfSize = 0; // maybe: nMemSize + sizeof(BITMAPFILEHEADER) pBmpFileHdr->bfReserved1 = 0; pBmpFileHdr->bfReserved2 = 0; - pBmpFileHdr->bfOffBits = nOffset; + pBmpFileHdr->bfOffBits = nOffset; return ooBmpStream; } @@ -232,12 +232,12 @@ Sequence< sal_Int8 > SAL_CALL WinDIBToOOBMP( const Sequence< sal_Int8 >& aWinDIB Sequence< sal_Int8 > SAL_CALL OOBmpToWinDIB( Sequence< sal_Int8 >& aOOBmp ) { - OSL_ASSERT( aOOBmp.getLength( ) > + OSL_ASSERT( aOOBmp.getLength( ) > ( sizeof( BITMAPFILEHEADER ) + sizeof( BITMAPINFOHEADER ) ) ); Sequence< sal_Int8 > winDIBStream( aOOBmp.getLength( ) - sizeof( BITMAPFILEHEADER ) ); - rtl_copyMemory( winDIBStream.getArray( ), + rtl_copyMemory( winDIBStream.getArray( ), aOOBmp.getArray( ) + sizeof( BITMAPFILEHEADER ), aOOBmp.getLength( ) - sizeof( BITMAPFILEHEADER ) ); @@ -249,49 +249,49 @@ Sequence< sal_Int8 > SAL_CALL OOBmpToWinDIB( Sequence< sal_Int8 >& aOOBmp ) // well known under MS Windows // the MS HTML Format has a header before the real html data // -// Version:1.0 Version number of the clipboard. Staring is 0.9 -// StartHTML: Byte count from the beginning of the clipboard to the start -// of the context, or -1 if no context -// EndHTML: Byte count from the beginning of the clipboard to the end -// of the context, or -1 if no context -// StartFragment: Byte count from the beginning of the clipboard to the -// start of the fragment -// EndFragment: Byte count from the beginning of the clipboard to the -// end of the fragment -// StartSelection: Byte count from the beginning of the clipboard to the -// start of the selection -// EndSelection: Byte count from the beginning of the clipboard to the -// end of the selection +// Version:1.0 Version number of the clipboard. Staring is 0.9 +// StartHTML: Byte count from the beginning of the clipboard to the start +// of the context, or -1 if no context +// EndHTML: Byte count from the beginning of the clipboard to the end +// of the context, or -1 if no context +// StartFragment: Byte count from the beginning of the clipboard to the +// start of the fragment +// EndFragment: Byte count from the beginning of the clipboard to the +// end of the fragment +// StartSelection: Byte count from the beginning of the clipboard to the +// start of the selection +// EndSelection: Byte count from the beginning of the clipboard to the +// end of the selection // // StartSelection and EndSelection are optional // The fragment should be preceded and followed by the HTML comments -// <!--StartFragment--> and <!--EndFragment--> (no space between !-- and the +// <!--StartFragment--> and <!--EndFragment--> (no space between !-- and the // text //------------------------------------------------------------------------------ /* Sequence< sal_Int8 > SAL_CALL TextHtmlToHTMLFormat( Sequence< sal_Int8 >& aTextHtml ) { OSL_ASSERT( aTextHtml.getLength( ) > 0 ); - + // check parameter if ( !(aTextHtml.getLength( ) > 0) ) return Sequence< sal_Int8 >( ); - // we create a buffer with the approximated size of + // we create a buffer with the approximated size of // the HTML Format header char aHTMLFmtHdr[120]; - + rtl_zeroMemory( aHTMLFmtHdr, sizeof( aHTMLFmtHdr ) ); // fill the buffer with dummy values to calc the // exact length - - wsprintf( - aHTMLFmtHdr, + + wsprintf( + aHTMLFmtHdr, "Version:1.0\nStartHTML:%010d\r\nnEndHTML:%010d\r\nStartFragment:%010\r\nnEndFragment:%010d\r\n", 0, 0, 0, 0 ); sal_uInt32 lHTMLFmtHdr = rtl_str_getLength( aHTMLFmtHdr ); - + // the office allways writes the start // and end html tag in upper cases and // without spaces @@ -306,8 +306,8 @@ Sequence< sal_Int8 > SAL_CALL TextHtmlToHTMLFormat( Sequence< sal_Int8 >& aTextH OString startBodyTag( "<BODY" ); OString endBodyTag( "</BODY" ); - OString textHtml( - reinterpret_cast< const sal_Char* >( aTextHtml.getConstArray( ) ), + OString textHtml( + reinterpret_cast< const sal_Char* >( aTextHtml.getConstArray( ) ), aTextHtml.getLength( ) ); sal_Int32 nStartHtml = textHtml.indexOf( startHtmlTag ); @@ -329,27 +329,27 @@ Sequence< sal_Int8 > SAL_CALL TextHtmlToHTMLFormat( Sequence< sal_Int8 >& aTextH // fill the html header rtl_zeroMemory( aHTMLFmtHdr, sizeof( aHTMLFmtHdr ) ); - wsprintf( - aHTMLFmtHdr, + wsprintf( + aHTMLFmtHdr, "Version:1.0\nStartHTML:%010d\r\nEndHTML:%010d\r\nStartFragment:%010d\r\nEndFragment:%010d\r\n", nStartHtml, nEndHtml, nStartFrgmt, nEndFrgmt ); - + // we add space for a trailing \0 aHTMLFmtSequence.realloc( lHTMLFmtHdr + aTextHtml.getLength( ) + 1 ); rtl_zeroMemory( aHTMLFmtSequence.getArray( ), aHTMLFmtSequence.getLength( ) ); - + // copy the HTML Format header - rtl_copyMemory( + rtl_copyMemory( static_cast< LPVOID >( aHTMLFmtSequence.getArray( ) ), static_cast< LPVOID >( aHTMLFmtHdr ), lHTMLFmtHdr ); - + // concat the text/html rtl_copyMemory( static_cast< LPVOID >( aHTMLFmtSequence.getArray( ) + lHTMLFmtHdr ), static_cast< LPVOID >( aTextHtml.getArray( ) ), - aTextHtml.getLength( ) ); + aTextHtml.getLength( ) ); } - + return aHTMLFmtSequence; } */ @@ -378,37 +378,37 @@ const std::string TAG_END_BODY = std::string("</BODY"); Sequence<sal_Int8> SAL_CALL TextHtmlToHTMLFormat(Sequence<sal_Int8>& aTextHtml) { OSL_ASSERT(aTextHtml.getLength() > 0); - + if (!(aTextHtml.getLength() > 0)) return Sequence<sal_Int8>(); - + // fill the buffer with dummy values to calc the exact length - std::string dummyHtmlHeader = GetHtmlFormatHeader(0, 0, 0, 0); + std::string dummyHtmlHeader = GetHtmlFormatHeader(0, 0, 0, 0); size_t lHtmlFormatHeader = dummyHtmlHeader.length(); - + std::string textHtml( - reinterpret_cast<const sal_Char*>(aTextHtml.getConstArray()), + reinterpret_cast<const sal_Char*>(aTextHtml.getConstArray()), reinterpret_cast<const sal_Char*>(aTextHtml.getConstArray()) + aTextHtml.getLength()); - + std::string::size_type nStartHtml = textHtml.find(TAG_HTML) + lHtmlFormatHeader - 1; // we start one before '<HTML>' Word 2000 does also so std::string::size_type nEndHtml = textHtml.find(TAG_END_HTML) + lHtmlFormatHeader + TAG_END_HTML.length() + 1; // our SOffice 5.2 wants 2 behind </HTML>? - + // The body tag may have parameters so we need to search for the // closing '>' manually e.g. <BODY param> #92840# - std::string::size_type nStartFragment = textHtml.find(">", textHtml.find(TAG_BODY)) + lHtmlFormatHeader + 1; + std::string::size_type nStartFragment = textHtml.find(">", textHtml.find(TAG_BODY)) + lHtmlFormatHeader + 1; std::string::size_type nEndFragment = textHtml.find(TAG_END_BODY) + lHtmlFormatHeader; - std::string htmlFormat = GetHtmlFormatHeader(nStartHtml, nEndHtml, nStartFragment, nEndFragment); + std::string htmlFormat = GetHtmlFormatHeader(nStartHtml, nEndHtml, nStartFragment, nEndFragment); htmlFormat += textHtml; - + Sequence<sal_Int8> byteSequence(htmlFormat.length() + 1); // space the trailing '\0' - rtl_zeroMemory(byteSequence.getArray(), byteSequence.getLength()); - + rtl_zeroMemory(byteSequence.getArray(), byteSequence.getLength()); + rtl_copyMemory( static_cast<void*>(byteSequence.getArray()), static_cast<const void*>(htmlFormat.c_str()), htmlFormat.length()); - + return byteSequence; } @@ -418,27 +418,27 @@ std::wstring getFileExtension(const std::wstring& aFilename) if ((idx != std::wstring::npos)) { return std::wstring(aFilename, idx); - } + } return std::wstring(); } const std::wstring SHELL_LINK_FILE_EXTENSION = L".lnk"; bool isShellLink(const std::wstring& aFilename) -{ +{ std::wstring ext = getFileExtension(aFilename); - return (_wcsicmp(ext.c_str(), SHELL_LINK_FILE_EXTENSION.c_str()) == 0); + return (_wcsicmp(ext.c_str(), SHELL_LINK_FILE_EXTENSION.c_str()) == 0); } - -/** Resolve a Windows Shell Link (lnk) file. If a resolution + +/** Resolve a Windows Shell Link (lnk) file. If a resolution is not possible simply return the provided name of the lnk file. */ -std::wstring getShellLinkTarget(const std::wstring& aLnkFile) +std::wstring getShellLinkTarget(const std::wstring& aLnkFile) { OSL_ASSERT(isShellLink(aLnkFile)); - + std::wstring target = aLnkFile; - + try { sal::systools::COMReference<IShellLinkA> pIShellLink; @@ -446,34 +446,34 @@ std::wstring getShellLinkTarget(const std::wstring& aLnkFile) CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, reinterpret_cast<LPVOID*>(&pIShellLink)); if (FAILED(hr)) return target; - + sal::systools::COMReference<IPersistFile> pIPersistFile = - pIShellLink.QueryInterface<IPersistFile>(IID_IPersistFile); - + pIShellLink.QueryInterface<IPersistFile>(IID_IPersistFile); + hr = pIPersistFile->Load(aLnkFile.c_str(), STGM_READ); if (FAILED(hr)) return target; - + hr = pIShellLink->Resolve(NULL, SLR_UPDATE | SLR_NO_UI); if (FAILED(hr)) return target; - + char pathA[MAX_PATH]; - WIN32_FIND_DATA wfd; - hr = pIShellLink->GetPath(pathA, MAX_PATH, &wfd, SLGP_RAWPATH); + WIN32_FIND_DATA wfd; + hr = pIShellLink->GetPath(pathA, MAX_PATH, &wfd, SLGP_RAWPATH); if (FAILED(hr)) - return target; - + return target; + wchar_t pathW[MAX_PATH]; - MultiByteToWideChar(CP_ACP, 0, pathA, -1, pathW, MAX_PATH); - target = pathW; + MultiByteToWideChar(CP_ACP, 0, pathA, -1, pathW, MAX_PATH); + target = pathW; } catch(sal::systools::ComError& ex) { OSL_ENSURE(false, ex.what()); ex = ex; - } - return target; + } + return target; } typedef std::vector<std::wstring> FileList_t; @@ -484,54 +484,54 @@ typedef Sequence<sal_Int8> ByteSequence_t; a double '\0' terminated string buffer */ size_t CalcSizeForStringListBuffer(const FileList_t& fileList) { - if (fileList.size() == 0) - return 0; - - size_t size = 1; // one for the very final '\0' + if (fileList.size() == 0) + return 0; + + size_t size = 1; // one for the very final '\0' FileList_t::const_iterator iter_end = fileList.end(); - for (FileList_t::const_iterator iter = fileList.begin(); iter != iter_end; ++iter) + for (FileList_t::const_iterator iter = fileList.begin(); iter != iter_end; ++iter) { size += iter->length() + 1; // length including terminating '\0' - } + } return (size * sizeof(FileList_ValueType_t::value_type)); } ByteSequence_t FileListToByteSequence(const FileList_t& fileList) -{ +{ ByteSequence_t bseq; - size_t size = CalcSizeForStringListBuffer(fileList); - + size_t size = CalcSizeForStringListBuffer(fileList); + if (size > 0) { bseq.realloc(size); wchar_t* p = reinterpret_cast<wchar_t*>(bseq.getArray()); ZeroMemory(p, size); - + FileList_t::const_iterator iter; FileList_t::const_iterator iter_end = fileList.end(); for (iter = fileList.begin(); iter != iter_end; ++iter) { wcsncpy(p, iter->c_str(), iter->length()); p += (iter->length() + 1); - } + } } return bseq; } - + ByteSequence_t CF_HDROPToFileList(HGLOBAL hGlobal) -{ - UINT nFiles = DragQueryFileW((HDROP)hGlobal, 0xFFFFFFFF, NULL, 0); +{ + UINT nFiles = DragQueryFileW((HDROP)hGlobal, 0xFFFFFFFF, NULL, 0); FileList_t files; - + for (UINT i = 0; i < nFiles; i++) { wchar_t buff[MAX_PATH]; - /*UINT size =*/ DragQueryFileW((HDROP)hGlobal, i, buff, MAX_PATH); + /*UINT size =*/ DragQueryFileW((HDROP)hGlobal, i, buff, MAX_PATH); std::wstring filename = buff; if (isShellLink(filename)) filename = getShellLinkTarget(filename); - files.push_back(filename); - } + files.push_back(filename); + } return FileListToByteSequence(files); } diff --git a/dtrans/source/win32/dtobj/FmtFilter.hxx b/dtrans/source/win32/dtobj/FmtFilter.hxx index 0e91710729fc..552b872fc1ef 100644 --- a/dtrans/source/win32/dtobj/FmtFilter.hxx +++ b/dtrans/source/win32/dtobj/FmtFilter.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -72,7 +72,7 @@ com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL OOBmpToWinDIB( com::sun::star /*------------------------------------------------------------------------ input: - aTextHtml - a sequence of text/html which will be converted to the + aTextHtml - a sequence of text/html which will be converted to the HTML Format; the HTML Format has header before the real html data the Format is described in the MSDN Library under HTML Clipboard Format diff --git a/dtrans/source/win32/dtobj/MimeAttrib.hxx b/dtrans/source/win32/dtobj/MimeAttrib.hxx index e9538ac7ae1f..0b73a64a5ded 100644 --- a/dtrans/source/win32/dtobj/MimeAttrib.hxx +++ b/dtrans/source/win32/dtobj/MimeAttrib.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx b/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx index 669ee78eff6d..06fc87d8587b 100644 --- a/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx +++ b/dtrans/source/win32/dtobj/TxtCnvtHlp.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -76,8 +76,8 @@ int CalcBuffSizeForTextConversion( UINT code_page, LPCWSTR lpWideCharString, int // the buffer //------------------------------------------------------------------ -int MultiByteToWideCharEx( UINT cp_src, - LPCSTR lpMultiByteString, +int MultiByteToWideCharEx( UINT cp_src, + LPCSTR lpMultiByteString, sal_uInt32 lenStr, CStgTransferHelper& refDTransHelper, BOOL bEnsureTrailingZero ) @@ -85,9 +85,9 @@ int MultiByteToWideCharEx( UINT cp_src, OSL_ASSERT( IsValidCodePage( cp_src ) ); OSL_ASSERT( NULL != lpMultiByteString ); - // calculate the required buff size + // calculate the required buff size int reqSize = CalcBuffSizeForTextConversion( cp_src, lpMultiByteString, lenStr ); - + if ( bEnsureTrailingZero ) reqSize += sizeof( sal_Unicode ); @@ -97,9 +97,9 @@ int MultiByteToWideCharEx( UINT cp_src, // setup a global memory pointer CRawHGlobalPtr ptrHGlob( refDTransHelper ); - // do the converssion an return - return MultiByteToWideChar( cp_src, - 0, + // do the converssion an return + return MultiByteToWideChar( cp_src, + 0, lpMultiByteString, lenStr, static_cast< LPWSTR >( ptrHGlob.GetMemPtr( ) ), @@ -112,8 +112,8 @@ int MultiByteToWideCharEx( UINT cp_src, // the buffer //------------------------------------------------------------------ -int WideCharToMultiByteEx( UINT cp_dest, - LPCWSTR lpWideCharString, +int WideCharToMultiByteEx( UINT cp_dest, + LPCWSTR lpWideCharString, sal_uInt32 lenStr, CStgTransferHelper& refDTransHelper, BOOL bEnsureTrailingZero ) @@ -121,7 +121,7 @@ int WideCharToMultiByteEx( UINT cp_dest, OSL_ASSERT( IsValidCodePage( cp_dest ) ); OSL_ASSERT( NULL != lpWideCharString ); - // calculate the required buff size + // calculate the required buff size int reqSize = CalcBuffSizeForTextConversion( cp_dest, lpWideCharString, lenStr ); if ( bEnsureTrailingZero ) @@ -133,7 +133,7 @@ int WideCharToMultiByteEx( UINT cp_dest, // setup a global memory pointer CRawHGlobalPtr ptrHGlob( refDTransHelper ); - // do the converssion an return + // do the converssion an return return WideCharToMultiByte( cp_dest, 0, lpWideCharString, diff --git a/dtrans/source/win32/dtobj/TxtCnvtHlp.hxx b/dtrans/source/win32/dtobj/TxtCnvtHlp.hxx index 5f37e19ce4d6..f9b9369255f6 100644 --- a/dtrans/source/win32/dtobj/TxtCnvtHlp.hxx +++ b/dtrans/source/win32/dtobj/TxtCnvtHlp.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,16 +47,16 @@ // deklarations //------------------------------------------------------------------------ -int MultiByteToWideCharEx( UINT cp_src, +int MultiByteToWideCharEx( UINT cp_src, LPCSTR lpMultiByteString, sal_uInt32 lenStr, - CStgTransferHelper& refDTransHelper, + CStgTransferHelper& refDTransHelper, BOOL bEnsureTrailingZero = TRUE ); -int WideCharToMultiByteEx( UINT cp_dest, - LPCWSTR lpWideCharString, +int WideCharToMultiByteEx( UINT cp_dest, + LPCWSTR lpWideCharString, sal_uInt32 lenStr, - CStgTransferHelper& refDTransHelper, + CStgTransferHelper& refDTransHelper, BOOL bEnsureTrailingZero = TRUE ); #endif diff --git a/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx b/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx index fd12b6583626..adc6c1c36195 100644 --- a/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx +++ b/dtrans/source/win32/dtobj/XNotifyingDataObject.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,28 +44,28 @@ using com::sun::star::uno::RuntimeException; using com::sun::star::uno::Reference; -CXNotifyingDataObject::CXNotifyingDataObject( - const IDataObjectPtr& aIDataObject, +CXNotifyingDataObject::CXNotifyingDataObject( + const IDataObjectPtr& aIDataObject, const Reference< XTransferable >& aXTransferable, const Reference< XClipboardOwner >& aXClipOwner, CWinClipbImpl* theWinClipImpl ) : - m_nRefCnt( 0 ), + m_nRefCnt( 0 ), m_aIDataObject( aIDataObject ), m_XTransferable( aXTransferable ), m_XClipboardOwner( aXClipOwner ), m_pWinClipImpl( theWinClipImpl ) -{ +{ } STDMETHODIMP CXNotifyingDataObject::QueryInterface( REFIID iid, LPVOID* ppvObject ) -{ +{ if ( NULL == ppvObject ) return E_INVALIDARG; HRESULT hr = E_NOINTERFACE; *ppvObject = NULL; - if ( ( __uuidof( IUnknown ) == iid ) || + if ( ( __uuidof( IUnknown ) == iid ) || ( __uuidof( IDataObject ) == iid ) ) { *ppvObject = static_cast< IUnknown* >( this ); @@ -82,8 +82,8 @@ STDMETHODIMP_(ULONG) CXNotifyingDataObject::AddRef( ) } STDMETHODIMP_(ULONG) CXNotifyingDataObject::Release( ) -{ - ULONG nRefCnt = +{ + ULONG nRefCnt = static_cast< ULONG >( InterlockedDecrement( &m_nRefCnt ) ); if ( 0 == nRefCnt ) @@ -98,50 +98,50 @@ STDMETHODIMP_(ULONG) CXNotifyingDataObject::Release( ) } STDMETHODIMP CXNotifyingDataObject::GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ) -{ - return m_aIDataObject->GetData(pFormatetc, pmedium); +{ + return m_aIDataObject->GetData(pFormatetc, pmedium); } -STDMETHODIMP CXNotifyingDataObject::EnumFormatEtc( +STDMETHODIMP CXNotifyingDataObject::EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ) -{ - return m_aIDataObject->EnumFormatEtc(dwDirection, ppenumFormatetc); +{ + return m_aIDataObject->EnumFormatEtc(dwDirection, ppenumFormatetc); } STDMETHODIMP CXNotifyingDataObject::QueryGetData( LPFORMATETC pFormatetc ) { - return m_aIDataObject->QueryGetData(pFormatetc); + return m_aIDataObject->QueryGetData(pFormatetc); } STDMETHODIMP CXNotifyingDataObject::GetDataHere( LPFORMATETC lpFetc, LPSTGMEDIUM lpStgMedium ) { - return m_aIDataObject->GetDataHere(lpFetc, lpStgMedium); + return m_aIDataObject->GetDataHere(lpFetc, lpStgMedium); } STDMETHODIMP CXNotifyingDataObject::GetCanonicalFormatEtc( LPFORMATETC lpFetc, LPFORMATETC lpCanonicalFetc ) { - return m_aIDataObject->GetCanonicalFormatEtc(lpFetc, lpCanonicalFetc); + return m_aIDataObject->GetCanonicalFormatEtc(lpFetc, lpCanonicalFetc); } STDMETHODIMP CXNotifyingDataObject::SetData( LPFORMATETC lpFetc, LPSTGMEDIUM lpStgMedium, BOOL bRelease ) -{ - return m_aIDataObject->SetData( lpFetc, lpStgMedium, bRelease ); +{ + return m_aIDataObject->SetData( lpFetc, lpStgMedium, bRelease ); } -STDMETHODIMP CXNotifyingDataObject::DAdvise( +STDMETHODIMP CXNotifyingDataObject::DAdvise( LPFORMATETC lpFetc, DWORD advf, LPADVISESINK lpAdvSink, DWORD* pdwConnection ) -{ - return m_aIDataObject->DAdvise( lpFetc, advf, lpAdvSink, pdwConnection ); +{ + return m_aIDataObject->DAdvise( lpFetc, advf, lpAdvSink, pdwConnection ); } STDMETHODIMP CXNotifyingDataObject::DUnadvise( DWORD dwConnection ) -{ +{ return m_aIDataObject->DUnadvise( dwConnection ); } STDMETHODIMP CXNotifyingDataObject::EnumDAdvise( LPENUMSTATDATA * ppenumAdvise ) { - return m_aIDataObject->EnumDAdvise( ppenumAdvise ); + return m_aIDataObject->EnumDAdvise( ppenumAdvise ); } CXNotifyingDataObject::operator IDataObject*( ) @@ -154,13 +154,13 @@ void SAL_CALL CXNotifyingDataObject::lostOwnership( ) try { if (m_XClipboardOwner.is()) - m_XClipboardOwner->lostOwnership( + m_XClipboardOwner->lostOwnership( static_cast<XClipboardEx*>(m_pWinClipImpl->m_pWinClipboard ), m_XTransferable); } catch(RuntimeException&) { OSL_ENSURE( sal_False, "RuntimeException caught" ); - } + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/dtobj/XNotifyingDataObject.hxx b/dtrans/source/win32/dtobj/XNotifyingDataObject.hxx index 20b12f7009cd..f52e75f32e99 100644 --- a/dtrans/source/win32/dtobj/XNotifyingDataObject.hxx +++ b/dtrans/source/win32/dtobj/XNotifyingDataObject.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -60,14 +60,14 @@ class CWinClipbImpl; class CXNotifyingDataObject : public IDataObject { public: - CXNotifyingDataObject( - const IDataObjectPtr& aIDataObject, + CXNotifyingDataObject( + const IDataObjectPtr& aIDataObject, const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable >& aXTransferable, const com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboardOwner >& aXClipOwner, CWinClipbImpl* theWinClipImpl ); virtual ~CXNotifyingDataObject() {} - + //----------------------------------------------------------------- // ole interface implementation //----------------------------------------------------------------- @@ -93,12 +93,12 @@ public: private: void SAL_CALL lostOwnership( ); -private: - sal_Int32 m_nRefCnt; - IDataObjectPtr m_aIDataObject; - const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable > m_XTransferable; - const com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboardOwner > m_XClipboardOwner; - CWinClipbImpl* m_pWinClipImpl; +private: + sal_Int32 m_nRefCnt; + IDataObjectPtr m_aIDataObject; + const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable > m_XTransferable; + const com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboardOwner > m_XClipboardOwner; + CWinClipbImpl* m_pWinClipImpl; friend class CWinClipbImpl; }; diff --git a/dtrans/source/win32/dtobj/XTDataObject.cxx b/dtrans/source/win32/dtobj/XTDataObject.cxx index 16c0e0f0afd0..ef961fff1001 100644 --- a/dtrans/source/win32/dtobj/XTDataObject.cxx +++ b/dtrans/source/win32/dtobj/XTDataObject.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -319,7 +319,7 @@ void SAL_CALL CXTDataObject::renderAnyDataAndSetupStgMedium( stgmedium.hMetaFilePict = OOMFPictToWinMFPict( clipDataStream ); stgmedium.pUnkForRelease = NULL; } - else if( CF_ENHMETAFILE == fetc.cfFormat ) + else if( CF_ENHMETAFILE == fetc.cfFormat ) { stgmedium.tymed = TYMED_ENHMF; stgmedium.hMetaFilePict = OOMFPictToWinENHMFPict( clipDataStream ); @@ -474,12 +474,12 @@ void SAL_CALL CXTDataObject::renderSynthesizedHtmlAndSetupStgMedium( FORMATETC& Sequence< sal_Int8 > aHTMLFormatSequence = TextHtmlToHTMLFormat( aTextHtmlSequence ); sal_uInt32 nBytesToTransfer = aHTMLFormatSequence.getLength( ); - - renderDataAndSetupStgMedium( - reinterpret_cast< const sal_Int8* >( aHTMLFormatSequence.getArray( ) ), - fetc, - 0, - nBytesToTransfer, + + renderDataAndSetupStgMedium( + reinterpret_cast< const sal_Int8* >( aHTMLFormatSequence.getArray( ) ), + fetc, + 0, + nBytesToTransfer, stgmedium ); } @@ -487,12 +487,12 @@ void SAL_CALL CXTDataObject::renderSynthesizedHtmlAndSetupStgMedium( FORMATETC& // IDataObject->EnumFormatEtc //------------------------------------------------------------------------ -STDMETHODIMP CXTDataObject::EnumFormatEtc( +STDMETHODIMP CXTDataObject::EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ) { - if ( NULL == ppenumFormatetc ) + if ( NULL == ppenumFormatetc ) return E_INVALIDARG; - + if ( DATADIR_SET == dwDirection ) return E_NOTIMPL; @@ -505,7 +505,7 @@ STDMETHODIMP CXTDataObject::EnumFormatEtc( { *ppenumFormatetc = new CEnumFormatEtc( this, m_FormatEtcContainer ); if ( NULL != *ppenumFormatetc ) - static_cast< LPUNKNOWN >( *ppenumFormatetc )->AddRef( ); + static_cast< LPUNKNOWN >( *ppenumFormatetc )->AddRef( ); hr = ( NULL != *ppenumFormatetc ) ? S_OK : E_OUTOFMEMORY; } @@ -600,9 +600,9 @@ inline DataFlavor SAL_CALL CXTDataObject::formatEtcToDataFlavor( const FORMATETC& aFormatEtc ) const { DataFlavor aFlavor; - + if ( m_FormatRegistrar.hasSynthesizedLocale( ) ) - aFlavor = + aFlavor = m_DataFormatTranslator.getDataFlavorFromFormatEtc( aFormatEtc, m_FormatRegistrar.getSynthesizedLocale( ) ); else aFlavor = m_DataFormatTranslator.getDataFlavorFromFormatEtc( aFormatEtc ); @@ -614,7 +614,7 @@ DataFlavor SAL_CALL CXTDataObject::formatEtcToDataFlavor( const FORMATETC& aForm } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ inline @@ -635,28 +635,28 @@ void CXTDataObject::validateFormatEtc( LPFORMATETC lpFormatEtc ) const !(lpFormatEtc->tymed & TYMED_ENHMF) ) throw CInvalidFormatEtcException( DV_E_TYMED ); - if ( lpFormatEtc->cfFormat == CF_METAFILEPICT && + if ( lpFormatEtc->cfFormat == CF_METAFILEPICT && !(lpFormatEtc->tymed & TYMED_MFPICT) ) throw CInvalidFormatEtcException( DV_E_TYMED ); - - if ( lpFormatEtc->cfFormat == CF_ENHMETAFILE && + + if ( lpFormatEtc->cfFormat == CF_ENHMETAFILE && !(lpFormatEtc->tymed & TYMED_ENHMF) ) throw CInvalidFormatEtcException( DV_E_TYMED ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ //inline -void SAL_CALL CXTDataObject::setupStgMedium( const FORMATETC& fetc, +void SAL_CALL CXTDataObject::setupStgMedium( const FORMATETC& fetc, CStgTransferHelper& stgTransHlp, STGMEDIUM& stgmedium ) { stgmedium.pUnkForRelease = NULL; if ( fetc.cfFormat == CF_METAFILEPICT ) - { + { stgmedium.tymed = TYMED_MFPICT; stgmedium.hMetaFilePict = static_cast< HMETAFILEPICT >( stgTransHlp.getHGlobal( ) ); } @@ -676,21 +676,21 @@ void SAL_CALL CXTDataObject::setupStgMedium( const FORMATETC& fetc, stgTransHlp.getIStream( &stgmedium.pstm ); } else - OSL_ASSERT( sal_False ); + OSL_ASSERT( sal_False ); } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ -inline +inline void SAL_CALL CXTDataObject::invalidateStgMedium( STGMEDIUM& stgmedium ) const { stgmedium.tymed = TYMED_NULL; } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ inline @@ -720,7 +720,7 @@ inline void SAL_CALL CXTDataObject::InitializeFormatEtcContainer( ) { if ( !m_bFormatEtcContainerInitialized ) { - m_FormatRegistrar.RegisterFormats( m_XTransferable, m_FormatEtcContainer ); + m_FormatRegistrar.RegisterFormats( m_XTransferable, m_FormatEtcContainer ); m_bFormatEtcContainerInitialized = sal_True; } } @@ -754,7 +754,7 @@ STDMETHODIMP CEnumFormatEtc::QueryInterface( REFIID iid, LPVOID* ppvObject ) *ppvObject = NULL; - if ( ( __uuidof( IUnknown ) == iid ) || + if ( ( __uuidof( IUnknown ) == iid ) || ( __uuidof( IEnumFORMATETC ) == iid ) ) { *ppvObject = static_cast< IUnknown* >( this ); @@ -772,7 +772,7 @@ STDMETHODIMP CEnumFormatEtc::QueryInterface( REFIID iid, LPVOID* ppvObject ) STDMETHODIMP_(ULONG) CEnumFormatEtc::AddRef( ) { // keep the dataobject alive - m_lpUnkOuter->AddRef( ); + m_lpUnkOuter->AddRef( ); return InterlockedIncrement( &m_nRefCnt ); } @@ -782,7 +782,7 @@ STDMETHODIMP_(ULONG) CEnumFormatEtc::AddRef( ) STDMETHODIMP_(ULONG) CEnumFormatEtc::Release( ) { - // release the outer dataobject + // release the outer dataobject m_lpUnkOuter->Release( ); ULONG nRefCnt = InterlockedDecrement( &m_nRefCnt ); @@ -798,7 +798,7 @@ STDMETHODIMP_(ULONG) CEnumFormatEtc::Release( ) STDMETHODIMP CEnumFormatEtc::Next( ULONG nRequested, LPFORMATETC lpDest, ULONG* lpFetched ) { - if ( ( nRequested < 1 ) || + if ( ( nRequested < 1 ) || (( nRequested > 1 ) && ( NULL == lpFetched )) || IsBadWritePtr( lpDest, sizeof( FORMATETC ) * nRequested ) ) return E_INVALIDARG; @@ -817,7 +817,7 @@ STDMETHODIMP CEnumFormatEtc::Next( ULONG nRequested, LPFORMATETC lpDest, ULONG* STDMETHODIMP CEnumFormatEtc::Skip( ULONG celt ) { - return m_FormatEtcContainer.skipFormatEtc( celt ) ? S_OK : S_FALSE; + return m_FormatEtcContainer.skipFormatEtc( celt ) ? S_OK : S_FALSE; } //---------------------------------------------------------------------------- @@ -838,10 +838,10 @@ STDMETHODIMP CEnumFormatEtc::Clone( IEnumFORMATETC** ppenum ) { if ( NULL == ppenum ) return E_INVALIDARG; - + *ppenum = new CEnumFormatEtc( m_lpUnkOuter, m_FormatEtcContainer ); if ( NULL != ppenum ) - static_cast< LPUNKNOWN >( *ppenum )->AddRef( ); + static_cast< LPUNKNOWN >( *ppenum )->AddRef( ); return ( NULL != *ppenum ) ? S_OK : E_OUTOFMEMORY; } diff --git a/dtrans/source/win32/dtobj/XTDataObject.hxx b/dtrans/source/win32/dtobj/XTDataObject.hxx index 1958be4afcbe..2b6540d170d0 100644 --- a/dtrans/source/win32/dtobj/XTDataObject.hxx +++ b/dtrans/source/win32/dtobj/XTDataObject.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -58,12 +58,12 @@ a clipboard client ask for the available formats on the clipboard and decides if there is a format he can use if there is one, he requests the data in this format - - - This class inherits from IDataObject an so can be placed on the - OleClipboard. The class wrapps a transferable object which is the + + - This class inherits from IDataObject an so can be placed on the + OleClipboard. The class wrapps a transferable object which is the original DataSource - DataFlavors offerd by this transferable will be translated into - appropriate clipboard formats + appropriate clipboard formats - if the transferable contains text data always text and unicodetext will be offered or vice versa - text data will be automaticaly converted between text und unicode text @@ -80,7 +80,7 @@ public: CXTDataObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& aXTransferable ); virtual ~CXTDataObject() {} - + //----------------------------------------------------------------- // ole interface implementation //----------------------------------------------------------------- @@ -103,15 +103,15 @@ public: operator IDataObject*( ); -private: - com::sun::star::datatransfer::DataFlavor SAL_CALL formatEtcToDataFlavor( const FORMATETC& aFormatEtc ) const; - +private: + com::sun::star::datatransfer::DataFlavor SAL_CALL formatEtcToDataFlavor( const FORMATETC& aFormatEtc ) const; + void SAL_CALL renderDataAndSetupStgMedium( const sal_Int8* lpStorage, - const FORMATETC& fetc, + const FORMATETC& fetc, sal_uInt32 nInitStgSize, sal_uInt32 nBytesToTransfer, STGMEDIUM& stgmedium ); - + void SAL_CALL renderLocaleAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ); void SAL_CALL renderUnicodeAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ); void SAL_CALL renderAnyDataAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ); @@ -121,29 +121,29 @@ private: void SAL_CALL renderSynthesizedTextAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ); void SAL_CALL renderSynthesizedHtmlAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ); - void SAL_CALL setupStgMedium( const FORMATETC& fetc, - CStgTransferHelper& stgTransHlp, + void SAL_CALL setupStgMedium( const FORMATETC& fetc, + CStgTransferHelper& stgTransHlp, STGMEDIUM& stgmedium ); - - void validateFormatEtc( LPFORMATETC lpFormatEtc ) const; + + void validateFormatEtc( LPFORMATETC lpFormatEtc ) const; void SAL_CALL invalidateStgMedium( STGMEDIUM& stgmedium ) const; HRESULT SAL_CALL translateStgExceptionCode( HRESULT hr ) const; inline void SAL_CALL InitializeFormatEtcContainer( ); -private: - LONG m_nRefCnt; +private: + LONG m_nRefCnt; const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr; ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_XTransferable; - CFormatEtcContainer m_FormatEtcContainer; + CFormatEtcContainer m_FormatEtcContainer; sal_Bool m_bFormatEtcContainerInitialized; - CDataFormatTranslator m_DataFormatTranslator; - CFormatRegistrar m_FormatRegistrar; + CDataFormatTranslator m_DataFormatTranslator; + CFormatRegistrar m_FormatRegistrar; }; //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ class CEnumFormatEtc : public IEnumFORMATETC @@ -151,22 +151,22 @@ class CEnumFormatEtc : public IEnumFORMATETC public: CEnumFormatEtc( LPUNKNOWN lpUnkOuter, const CFormatEtcContainer& aFormatEtcContainer ); virtual ~CEnumFormatEtc() {} - - // IUnknown + + // IUnknown STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject ); STDMETHODIMP_( ULONG ) AddRef( ); STDMETHODIMP_( ULONG ) Release( ); - //IEnumFORMATETC + //IEnumFORMATETC STDMETHODIMP Next( ULONG nRequested, LPFORMATETC lpDest, ULONG* lpFetched ); STDMETHODIMP Skip( ULONG celt ); STDMETHODIMP Reset( ); STDMETHODIMP Clone( IEnumFORMATETC** ppenum ); private: - LONG m_nRefCnt; + LONG m_nRefCnt; LPUNKNOWN m_lpUnkOuter; - CFormatEtcContainer m_FormatEtcContainer; + CFormatEtcContainer m_FormatEtcContainer; }; typedef CEnumFormatEtc *PCEnumFormatEtc; |