diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-10-27 23:39:27 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-10-28 08:56:08 +0100 |
commit | 0a6813ad5d57d0df72562c797a8b0581bfd65a11 (patch) | |
tree | 4256d0ce8383dcd5b2948be075359e0296cebc13 /svx/source/tbxctrls/colrctrl.cxx | |
parent | e89e8941e114d4d1adf76df995a3f1a8d1bff4b1 (diff) |
tdf#119235 svx,sd: fix drag&drop from ColorBar
This was using the SfxPoolItem serialisation of XATTR_FILL* items,
where only XFillColorItem and XFillStyleItem were actually used;
the binary serialisation was removed without being aware of this
feature.
Fix this by using uno::Any instead, rather than reviving the binary
serialisation.
Also change the clipboard format strings, just to be safe.
(regression from 97b889b8b2b2554ce33fd6b3f0359fc18f39832d)
Change-Id: I1828621a9aae606a1ca47835eef608062efe64a0
Reviewed-on: https://gerrit.libreoffice.org/62455
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Tested-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'svx/source/tbxctrls/colrctrl.cxx')
-rw-r--r-- | svx/source/tbxctrls/colrctrl.cxx | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx index c7bc43f67f23..6b86c381dfc4 100644 --- a/svx/source/tbxctrls/colrctrl.cxx +++ b/svx/source/tbxctrls/colrctrl.cxx @@ -48,18 +48,18 @@ class SvxColorValueSetData : public TransferableHelper { private: - XFillExchangeData maData; + uno::Sequence<beans::NamedValue> m_Data; protected: virtual void AddSupportedFormats() override; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; - virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; public: - explicit SvxColorValueSetData( const XFillAttrSetItem& rSetItem ) : - maData( rSetItem ) {} + explicit SvxColorValueSetData(const uno::Sequence<beans::NamedValue>& rProps) + : m_Data(rProps) + {} }; void SvxColorValueSetData::AddSupportedFormats() @@ -73,19 +73,13 @@ bool SvxColorValueSetData::GetData( const css::datatransfer::DataFlavor& rFlavor if( SotExchange::GetFormat( rFlavor ) == SotClipboardFormatId::XFA ) { - SetObject( &maData, 0, rFlavor ); + SetAny(uno::makeAny(m_Data)); bRet = true; } return bRet; } -bool SvxColorValueSetData::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void*, sal_uInt32, const css::datatransfer::DataFlavor& ) -{ - WriteXFillExchangeData( *rxOStm, maData ); - return( rxOStm->GetError() == ERRCODE_NONE ); -} - SvxColorValueSet_docking::SvxColorValueSet_docking( vcl::Window* _pParent ) : SvxColorValueSet( _pParent, WB_ITEMBORDER ), DragSourceHelper( this ), @@ -149,14 +143,18 @@ void SvxColorValueSet_docking::DoDrag() if( pDocSh && nItemId ) { - XFillAttrSetItem aXFillSetItem( &pDocSh->GetPool() ); - SfxItemSet& rSet = aXFillSetItem.GetItemSet(); - - rSet.Put( XFillColorItem( GetItemText( nItemId ), GetItemColor( nItemId ) ) ); - rSet.Put(XFillStyleItem( ( 1 == nItemId ) ? drawing::FillStyle_NONE : drawing::FillStyle_SOLID ) ); + uno::Sequence<beans::NamedValue> props(2); + XFillColorItem const color(GetItemText(nItemId), GetItemColor(nItemId)); + props[0].Name = "FillColor"; + color.QueryValue(props[0].Value, 0); + XFillStyleItem const style((1 == nItemId) + ? drawing::FillStyle_NONE + : drawing::FillStyle_SOLID); + props[1].Name = "FillStyle"; + style.QueryValue(props[1].Value, 0); EndSelection(); - ( new SvxColorValueSetData( aXFillSetItem ) )->StartDrag( this, DND_ACTION_COPY ); + ( new SvxColorValueSetData(props) )->StartDrag( this, DND_ACTION_COPY ); ReleaseMouse(); } } |