tdf#145964 related: also drop special-casing in TransferableHelper::SetString
Follow-up to commit 5fb9f4ffa9
Change-Id: I46d5ea404f77ac5ff67b6ee6a42afee13274a481
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126174
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -232,7 +232,7 @@ protected:
|
||||
void ClearFormats();
|
||||
|
||||
bool SetAny( const css::uno::Any& rAny );
|
||||
bool SetString( const OUString& rString, const css::datatransfer::DataFlavor& rFlavor );
|
||||
bool SetString( const OUString& rString );
|
||||
bool SetBitmapEx( const BitmapEx& rBitmap, const css::datatransfer::DataFlavor& rFlavor );
|
||||
bool SetGDIMetaFile( const GDIMetaFile& rMtf );
|
||||
bool SetGraphic( const Graphic& rGraphic );
|
||||
|
||||
@@ -376,7 +376,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt
|
||||
{
|
||||
OUString aString;
|
||||
if ( aObj.ExportString( aString, nFormat ) )
|
||||
bOK = SetString( aString, rFlavor );
|
||||
bOK = SetString( aString );
|
||||
}
|
||||
else if ( rFlavor.DataType.equals( cppu::UnoType<uno::Sequence< sal_Int8 >>::get() ) )
|
||||
{
|
||||
|
||||
@@ -520,7 +520,7 @@ bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo
|
||||
}
|
||||
else if( ( nFormat == SotClipboardFormatId::STRING ) && mpBookmark )
|
||||
{
|
||||
bOK = SetString( mpBookmark->GetURL(), rFlavor );
|
||||
bOK = SetString( mpBookmark->GetURL() );
|
||||
}
|
||||
else if( ( nFormat == SotClipboardFormatId::SVXB ) && mpGraphic )
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace svt
|
||||
{
|
||||
SotClipboardFormatId nFormat = SotExchange::GetFormat( _rFlavor );
|
||||
if (SotClipboardFormatId::STRING == nFormat)
|
||||
return SetString( m_sContent, _rFlavor );
|
||||
return SetString( m_sContent );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace svx
|
||||
{
|
||||
case SotClipboardFormatId::SBA_FIELDDATAEXCHANGE:
|
||||
case SotClipboardFormatId::SBA_CTRLDATAEXCHANGE:
|
||||
return SetString(m_sCompatibleFormat, _rFlavor);
|
||||
return SetString(m_sCompatibleFormat);
|
||||
default: break;
|
||||
}
|
||||
if (nFormatId == getDescriptorFormatId())
|
||||
@@ -432,7 +432,7 @@ namespace svx
|
||||
return SetAny( makeAny(m_aDescriptor.createPropertyValueSequence()) );
|
||||
|
||||
case SotClipboardFormatId::SBA_DATAEXCHANGE:
|
||||
return SetString(m_sCompatibleObjectDescription, rFlavor);
|
||||
return SetString(m_sCompatibleObjectDescription);
|
||||
default: break;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace svx
|
||||
const SotClipboardFormatId nFormatId = SotExchange::GetFormat( _rFlavor );
|
||||
if ( SotClipboardFormatId::XFORMS == nFormatId )
|
||||
{
|
||||
return SetString("XForms-Transferable", _rFlavor);
|
||||
return SetString("XForms-Transferable");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor, cons
|
||||
}
|
||||
else if( ( SotClipboardFormatId::SIMPLE_FILE == nFormat ) && mpURL )
|
||||
{
|
||||
bRet = SetString( mpURL->GetMainURL( INetURLObject::DecodeMechanism::NONE ), rFlavor );
|
||||
bRet = SetString( mpURL->GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
|
||||
}
|
||||
else if( ( SotClipboardFormatId::SVXB == nFormat ) && mpGraphicObject )
|
||||
{
|
||||
|
||||
@@ -645,25 +645,9 @@ bool TransferableHelper::SetAny( const Any& rAny )
|
||||
}
|
||||
|
||||
|
||||
bool TransferableHelper::SetString( const OUString& rString, const DataFlavor& rFlavor )
|
||||
bool TransferableHelper::SetString( const OUString& rString )
|
||||
{
|
||||
DataFlavor aFileFlavor;
|
||||
|
||||
if( !rString.isEmpty() &&
|
||||
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::SIMPLE_FILE, aFileFlavor ) &&
|
||||
TransferableDataHelper::IsEqual( aFileFlavor, rFlavor ) )
|
||||
{
|
||||
const OString aByteStr(OUStringToOString(rString, osl_getThreadTextEncoding()));
|
||||
Sequence< sal_Int8 > aSeq( aByteStr.getLength() + 1 );
|
||||
auto pSeq = aSeq.getArray();
|
||||
|
||||
memcpy( pSeq, aByteStr.getStr(), aByteStr.getLength() );
|
||||
pSeq[ aByteStr.getLength() ] = 0;
|
||||
maAny <<= aSeq;
|
||||
}
|
||||
else
|
||||
maAny <<= rString;
|
||||
|
||||
maAny <<= rString;
|
||||
return maAny.hasValue();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user