include/vcl/transfer.hxx | 2 +- sc/source/ui/app/transobj.cxx | 2 +- sd/source/ui/app/sdxfer.cxx | 2 +- svtools/source/misc/stringtransfer.cxx | 2 +- svx/source/fmcomp/dbaexchange.cxx | 4 ++-- svx/source/fmcomp/xmlexchg.cxx | 2 +- svx/source/gallery2/galmisc.cxx | 2 +- vcl/source/treelist/transfer.cxx | 20 ++------------------ 8 files changed, 10 insertions(+), 26 deletions(-)
New commits: commit 0d2c2ab55a20bfebd87f2296bb8b2d79508de082 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Dec 1 12:29:37 2021 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Dec 1 14:59:58 2021 +0100 tdf#145964 related: also drop special-casing in TransferableHelper::SetString Follow-up to commit 5fb9f4ffa9284c7248e2e82210506babaad4044d Change-Id: I46d5ea404f77ac5ff67b6ee6a42afee13274a481 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126174 Tested-by: Mike Kaganski <mike.kagan...@collabora.com> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx index 6e546cc38a2a..ec1d0955d85c 100644 --- a/include/vcl/transfer.hxx +++ b/include/vcl/transfer.hxx @@ -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 ); diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 7783264d8801..438e922297a4 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -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() ) ) { diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index e813c687f5c7..d63fd580efef 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -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 ) { diff --git a/svtools/source/misc/stringtransfer.cxx b/svtools/source/misc/stringtransfer.cxx index 348082b77ae9..14b28dfe3520 100644 --- a/svtools/source/misc/stringtransfer.cxx +++ b/svtools/source/misc/stringtransfer.cxx @@ -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; } diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx index 4fecfac95696..26eaf9ad4894 100644 --- a/svx/source/fmcomp/dbaexchange.cxx +++ b/svx/source/fmcomp/dbaexchange.cxx @@ -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; diff --git a/svx/source/fmcomp/xmlexchg.cxx b/svx/source/fmcomp/xmlexchg.cxx index 7fe8e4b88bd7..1f8d44ee7d3a 100644 --- a/svx/source/fmcomp/xmlexchg.cxx +++ b/svx/source/fmcomp/xmlexchg.cxx @@ -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; } diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index 9713b82a109e..068a2f7e2af0 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -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 ) { diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index f86501cc8def..bb245767cb63 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -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(); }