This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push: new f5484c2 Fixed typos, removed whitespace f5484c2 is described below commit f5484c28a9f93b7ffd5277f4c07926a74767c60c Author: mseidel <msei...@apache.org> AuthorDate: Thu Feb 27 22:22:39 2020 +0100 Fixed typos, removed whitespace (cherry picked from commit c58c98639aee672dad53c365db9757a13bf51016) --- main/dtrans/source/win32/dtobj/APNDataObject.hxx | 45 +++--- main/dtrans/source/win32/dtobj/DataFmtTransl.cxx | 186 +++++++++++------------ main/dtrans/source/win32/dtobj/Fetc.hxx | 13 +- main/dtrans/source/win32/dtobj/XTDataObject.cxx | 122 +++++++-------- main/dtrans/source/win32/dtobj/XTDataObject.hxx | 111 +++++++------- 5 files changed, 237 insertions(+), 240 deletions(-) diff --git a/main/dtrans/source/win32/dtobj/APNDataObject.hxx b/main/dtrans/source/win32/dtobj/APNDataObject.hxx index f4fae74..96ab329 100644 --- a/main/dtrans/source/win32/dtobj/APNDataObject.hxx +++ b/main/dtrans/source/win32/dtobj/APNDataObject.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,64 +7,63 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - #ifndef _APNDATAOBJECT_HXX_ #define _APNDATAOBJECT_HXX_ #include <systools/win32/comtools.hxx> //------------------------------------------------------------------------ -// deklarations +// declarations //------------------------------------------------------------------------ /* 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( ); //----------------------------------------------------------------- - //IUnknown interface methods + // IUnknown interface methods //----------------------------------------------------------------- - STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject); - STDMETHODIMP_( ULONG ) AddRef( ); - STDMETHODIMP_( ULONG ) Release( ); + STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject); + STDMETHODIMP_( ULONG ) AddRef( ); + STDMETHODIMP_( ULONG ) Release( ); //----------------------------------------------------------------- - // IDataObject interface methods + // IDataObject interface methods //----------------------------------------------------------------- - STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); - STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); - STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ); - STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ); - STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ); - STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ); - STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ); - STDMETHODIMP DUnadvise( DWORD dwConnection ); - STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ); + STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); + STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); + STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ); + STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ); + STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ); + STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ); + STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ); + STDMETHODIMP DUnadvise( DWORD dwConnection ); + STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ); operator IDataObject*( ); @@ -72,7 +71,7 @@ private: HRESULT MarshalIDataObjectIntoCurrentApartment( IDataObject** ppIDataObj ); private: - IDataObjectPtr m_rIDataObjectOrg; + IDataObjectPtr m_rIDataObjectOrg; HGLOBAL m_hGlobal; LONG m_nRefCnt; diff --git a/main/dtrans/source/win32/dtobj/DataFmtTransl.cxx b/main/dtrans/source/win32/dtobj/DataFmtTransl.cxx index bda788b..7911ef2 100644 --- a/main/dtrans/source/win32/dtobj/DataFmtTransl.cxx +++ b/main/dtrans/source/win32/dtobj/DataFmtTransl.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -50,7 +50,7 @@ #if defined _MSC_VER #pragma warning(pop) #endif - + //------------------------------------------------------------------------ // namespace directives @@ -79,52 +79,52 @@ 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 { - if( m_XDataFormatTranslator.is( ) ) - { - Any aFormat = m_XDataFormatTranslator->getSystemDataTypeFromDataFlavor( aDataFlavor ); - - if ( aFormat.hasValue( ) ) - { - if ( aFormat.getValueType( ) == CPPUTYPE_SALINT32 ) - { - 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( )) ); - - OSL_ENSURE( CF_INVALID != cf, "RegisterClipboardFormat failed" ); - } - else - OSL_ENSURE( sal_False, "Wrong Any-Type detected" ); - } - } - } + if( m_XDataFormatTranslator.is( ) ) + { + Any aFormat = m_XDataFormatTranslator->getSystemDataTypeFromDataFlavor( aDataFlavor ); + + if ( aFormat.hasValue( ) ) + { + if ( aFormat.getValueType( ) == CPPUTYPE_SALINT32 ) + { + 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( )) ); + + OSL_ENSURE( CF_INVALID != cf, "RegisterClipboardFormat failed" ); + } + else + OSL_ENSURE( sal_False, "Wrong Any-Type detected" ); + } + } + } catch( ... ) { OSL_ENSURE( sal_False, "Unexpected error" ); @@ -134,13 +134,13 @@ CFormatEtc CDataFormatTranslator::getFormatEtcFromDataFlavor( const DataFlavor& } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ DataFlavor CDataFormatTranslator::getDataFlavorFromFormatEtc( const FORMATETC& aFormatEtc, LCID lcid ) const { DataFlavor aFlavor; - + try { CLIPFORMAT aClipformat = aFormatEtc.cfFormat; @@ -149,37 +149,37 @@ 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 ) { - if ( m_XDataFormatTranslator.is( ) ) - { - aFlavor = m_XDataFormatTranslator->getDataFlavorFromSystemDataType( aAny ); - - if ( !aFlavor.MimeType.getLength( ) ) - { - // lookup of DataFlavor from clipboard format id - // 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 occurred or it is a standard - // clipboard format that we don't translate, e.g. - // CF_BITMAP (the office only uses CF_DIB) - if ( clipFormatName.getLength( ) ) - { - aAny <<= clipFormatName; - aFlavor = m_XDataFormatTranslator->getDataFlavorFromSystemDataType( aAny ); - } - } - } + if ( m_XDataFormatTranslator.is( ) ) + { + aFlavor = m_XDataFormatTranslator->getDataFlavorFromSystemDataType( aAny ); + + if ( !aFlavor.MimeType.getLength( ) ) + { + // lookup of DataFlavor from clipboard format id + // 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 occurred or it is a standard + // clipboard format that we don't translate, e.g. + // CF_BITMAP (the office only uses CF_DIB) + if ( clipFormatName.getLength( ) ) + { + aAny <<= clipFormatName; + aFlavor = m_XDataFormatTranslator->getDataFlavorFromSystemDataType( aAny ); + } + } + } } } catch( ... ) @@ -191,7 +191,7 @@ DataFlavor CDataFormatTranslator::getDataFlavorFromFormatEtc( const FORMATETC& a } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformatName( const OUString& aClipFmtName ) const @@ -205,7 +205,7 @@ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformatName( const } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ OUString CDataFormatTranslator::getClipboardFormatName( CLIPFORMAT aClipformat ) const @@ -219,7 +219,7 @@ OUString CDataFormatTranslator::getClipboardFormatName( CLIPFORMAT aClipformat ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformat( CLIPFORMAT cf ) const @@ -240,23 +240,23 @@ CFormatEtc SAL_CALL CDataFormatTranslator::getFormatEtcForClipformat( CLIPFORMAT fetc.setTymed( TYMED_HGLOBAL /*| TYMED_ISTREAM*/ ); } - /* - hack: in order to paste urls copied by Internet Explorer - 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 - of which FileContents it wants to paste - see MSDN: "Handling Shell Data Transfer Scenarios" - */ - if ( cf == RegisterClipboardFormatA( CFSTR_FILECONTENTS ) ) - fetc.setLindex( 0 ); + /* + hack: in order to paste urls copied by Internet Explorer + 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 + of which FileContents it wants to paste + see MSDN: "Handling Shell Data Transfer Scenarios" + */ + if ( cf == RegisterClipboardFormatA( CFSTR_FILECONTENTS ) ) + fetc.setLindex( 0 ); return fetc; } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CDataFormatTranslator::isOemOrAnsiTextFormat( CLIPFORMAT cf ) const @@ -265,7 +265,7 @@ sal_Bool SAL_CALL CDataFormatTranslator::isOemOrAnsiTextFormat( CLIPFORMAT cf ) } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ sal_Bool SAL_CALL CDataFormatTranslator::isUnicodeTextFormat( CLIPFORMAT cf ) const @@ -274,16 +274,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 @@ -293,17 +293,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 @@ -312,21 +312,21 @@ 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/main/dtrans/source/win32/dtobj/Fetc.hxx b/main/dtrans/source/win32/dtobj/Fetc.hxx index 7c0a4e3..7b8c053 100644 --- a/main/dtrans/source/win32/dtobj/Fetc.hxx +++ b/main/dtrans/source/win32/dtobj/Fetc.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,21 +7,20 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - #ifndef _FETC_HXX_ #define _FETC_HXX_ @@ -41,9 +40,9 @@ /********************************************************************** stl container elements must fulfill the following requirements: - 1. they need a copy ctor and assignement operator(?) + 1. they need a copy ctor and assignment 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/main/dtrans/source/win32/dtobj/XTDataObject.cxx b/main/dtrans/source/win32/dtobj/XTDataObject.cxx index cb23ef0..30b9713 100644 --- a/main/dtrans/source/win32/dtobj/XTDataObject.cxx +++ b/main/dtrans/source/win32/dtobj/XTDataObject.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -84,7 +84,7 @@ CXTDataObject::CXTDataObject( const Reference< XMultiServiceFactory >& aServiceM m_SrvMgr( aServiceManager ), m_XTransferable( aXTransferable ), m_DataFormatTranslator( aServiceManager ), - m_bFormatEtcContainerInitialized( sal_False ), + m_bFormatEtcContainerInitialized( sal_False ), m_FormatRegistrar( m_SrvMgr, m_DataFormatTranslator ) { } @@ -203,11 +203,11 @@ void SAL_CALL CXTDataObject::renderDataAndSetupStgMedium( stgTransfHelper.init( nInitStgSize, GHND ); #if OSL_DEBUG_LEVEL > 0 - sal_uInt32 nBytesWritten = 0; - stgTransfHelper.write( lpStorage, nBytesToTransfer, &nBytesWritten ); - OSL_ASSERT( nBytesWritten == nBytesToTransfer ); + sal_uInt32 nBytesWritten = 0; + stgTransfHelper.write( lpStorage, nBytesToTransfer, &nBytesWritten ); + OSL_ASSERT( nBytesWritten == nBytesToTransfer ); #else - stgTransfHelper.write( lpStorage, nBytesToTransfer ); + stgTransfHelper.write( lpStorage, nBytesToTransfer ); #endif setupStgMedium( fetc, stgTransfHelper, stgmedium ); @@ -306,24 +306,24 @@ void SAL_CALL CXTDataObject::renderAnyDataAndSetupStgMedium( if ( m_DataFormatTranslator.isOemOrAnsiTextFormat( fetc.cfFormat ) ) nRequiredMemSize = sizeof( sal_Int8 ) * clipDataStream.getLength( ) + 1; - // prepare data for transmision - // #124085# DIBV5 should not happen for now, but keep as hint here + // prepare data for transmission + // #124085# DIBV5 should not happen for now, but keep as hint here if ( CF_DIBV5 == fetc.cfFormat || CF_DIB == fetc.cfFormat ) - { + { #ifdef DBG_UTIL - if(CF_DIBV5 == fetc.cfFormat) - { - OSL_ENSURE(clipDataStream.getLength( ) > (sizeof(BITMAPFILEHEADER) + sizeof(BITMAPV5HEADER)), "Wrong size on CF_DIBV5 data (!)"); - } - else // CF_DIB == fetc.cfFormat - { - OSL_ENSURE(clipDataStream.getLength( ) > (sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)), "Wrong size on CF_DIB data (!)"); - } + if(CF_DIBV5 == fetc.cfFormat) + { + OSL_ENSURE(clipDataStream.getLength( ) > (sizeof(BITMAPFILEHEADER) + sizeof(BITMAPV5HEADER)), "Wrong size on CF_DIBV5 data (!)"); + } + else // CF_DIB == fetc.cfFormat + { + OSL_ENSURE(clipDataStream.getLength( ) > (sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)), "Wrong size on CF_DIB data (!)"); + } #endif - // remove BITMAPFILEHEADER - clipDataStream = OOBmpToWinDIB( clipDataStream ); - } + // remove BITMAPFILEHEADER + clipDataStream = OOBmpToWinDIB( clipDataStream ); + } if ( CF_METAFILEPICT == fetc.cfFormat ) { @@ -420,7 +420,7 @@ void SAL_CALL CXTDataObject::renderSynthesizedUnicodeAndSetupStgMedium( FORMATET } //------------------------------------------------------------------------ -// the transferable must have only unicode text so we will sythesize text +// the transferable must have only unicode text so we will synthesize text //------------------------------------------------------------------------ void SAL_CALL CXTDataObject::renderSynthesizedTextAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium ) @@ -486,12 +486,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 ); } @@ -499,25 +499,25 @@ 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; *ppenumFormatetc = NULL; - InitializeFormatEtcContainer( ); + InitializeFormatEtcContainer( ); HRESULT hr; if ( DATADIR_GET == dwDirection ) { *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; } @@ -536,7 +536,7 @@ STDMETHODIMP CXTDataObject::QueryGetData( LPFORMATETC pFormatetc ) if ( (NULL == pFormatetc) || IsBadReadPtr( pFormatetc, sizeof( FORMATETC ) ) ) return E_INVALIDARG; - InitializeFormatEtcContainer( ); + InitializeFormatEtcContainer( ); return m_FormatEtcContainer.hasFormatEtc( *pFormatetc ) ? S_OK : S_FALSE; } @@ -612,9 +612,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 ); @@ -626,7 +626,7 @@ DataFlavor SAL_CALL CXTDataObject::formatEtcToDataFlavor( const FORMATETC& aForm } //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ inline @@ -647,28 +647,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( ) ); } @@ -688,21 +688,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 @@ -730,11 +730,11 @@ HRESULT SAL_CALL CXTDataObject::translateStgExceptionCode( HRESULT hr ) const inline void SAL_CALL CXTDataObject::InitializeFormatEtcContainer( ) { - if ( !m_bFormatEtcContainerInitialized ) - { - m_FormatRegistrar.RegisterFormats( m_XTransferable, m_FormatEtcContainer ); - m_bFormatEtcContainerInitialized = sal_True; - } + if ( !m_bFormatEtcContainerInitialized ) + { + m_FormatRegistrar.RegisterFormats( m_XTransferable, m_FormatEtcContainer ); + m_bFormatEtcContainerInitialized = sal_True; + } } //============================================================================ @@ -766,7 +766,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 ); @@ -784,7 +784,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 ); } @@ -794,7 +794,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 ); @@ -810,7 +810,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; @@ -829,7 +829,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; } //---------------------------------------------------------------------------- @@ -850,10 +850,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/main/dtrans/source/win32/dtobj/XTDataObject.hxx b/main/dtrans/source/win32/dtobj/XTDataObject.hxx index d09a52f..9495a7d 100644 --- a/main/dtrans/source/win32/dtobj/XTDataObject.hxx +++ b/main/dtrans/source/win32/dtobj/XTDataObject.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,21 +7,20 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - #ifndef _XTDATAOBJECT_HXX_ #define _XTDATAOBJECT_HXX_ @@ -57,15 +56,15 @@ 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 wraps a transferable object which is the original DataSource - - DataFlavors offerd by this transferable will be translated into - appropriate clipboard formats + - DataFlavors offered by this transferable will be translated into + 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 + - text data will be automatically converted between text and unicode text - although the transferable may support text in different charsets (codepages) only text in one codepage can be offered by the clipboard @@ -78,39 +77,39 @@ class CXTDataObject : public IDataObject 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() {} - + virtual ~CXTDataObject() {} + //----------------------------------------------------------------- // ole interface implementation //----------------------------------------------------------------- - //IUnknown interface methods - STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject); - STDMETHODIMP_( ULONG ) AddRef( ); - STDMETHODIMP_( ULONG ) Release( ); - - // IDataObject interface methods - STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); - STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); - STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ); - STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ); - STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ); - STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ); - STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ); - STDMETHODIMP DUnadvise( DWORD dwConnection ); - STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ); + //IUnknown interface methods + STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject); + STDMETHODIMP_( ULONG ) AddRef( ); + STDMETHODIMP_( ULONG ) Release( ); + + // IDataObject interface methods + STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); + STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); + STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ); + STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ); + STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ); + STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ); + STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ); + STDMETHODIMP DUnadvise( DWORD dwConnection ); + STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ); 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 ); @@ -120,52 +119,52 @@ 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( ); + 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; - sal_Bool m_bFormatEtcContainerInitialized; + sal_Bool m_bFormatEtcContainerInitialized; CDataFormatTranslator m_DataFormatTranslator; - CFormatRegistrar m_FormatRegistrar; + CFormatRegistrar m_FormatRegistrar; }; //------------------------------------------------------------------------ -// +// //------------------------------------------------------------------------ class CEnumFormatEtc : public IEnumFORMATETC { public: CEnumFormatEtc( LPUNKNOWN lpUnkOuter, const CFormatEtcContainer& aFormatEtcContainer ); - virtual ~CEnumFormatEtc() {} - - // IUnknown - STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject ); - STDMETHODIMP_( ULONG ) AddRef( ); - STDMETHODIMP_( ULONG ) Release( ); - - //IEnumFORMATETC - STDMETHODIMP Next( ULONG nRequested, LPFORMATETC lpDest, ULONG* lpFetched ); - STDMETHODIMP Skip( ULONG celt ); - STDMETHODIMP Reset( ); - STDMETHODIMP Clone( IEnumFORMATETC** ppenum ); + virtual ~CEnumFormatEtc() {} + + // IUnknown + STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject ); + STDMETHODIMP_( ULONG ) AddRef( ); + STDMETHODIMP_( ULONG ) Release( ); + + // IEnumFORMATETC + STDMETHODIMP Next( ULONG nRequested, LPFORMATETC lpDest, ULONG* lpFetched ); + STDMETHODIMP Skip( ULONG celt ); + STDMETHODIMP Reset( ); + STDMETHODIMP Clone( IEnumFORMATETC** ppenum ); private: LONG m_nRefCnt; LPUNKNOWN m_lpUnkOuter; - CFormatEtcContainer m_FormatEtcContainer; + CFormatEtcContainer m_FormatEtcContainer; }; typedef CEnumFormatEtc *PCEnumFormatEtc;