From 0a6813ad5d57d0df72562c797a8b0581bfd65a11 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Sat, 27 Oct 2018 23:39:27 +0200 Subject: 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 Tested-by: Michael Stahl --- sd/source/ui/view/sdview3.cxx | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'sd/source/ui/view/sdview3.cxx') diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index e15e67a860de..127671347b3d 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -72,6 +72,7 @@ #include #include #include +#include #include #include #include @@ -1330,14 +1331,10 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if(!bReturn && pPickObj && CHECK_FORMAT_TRANS( SotClipboardFormatId::XFA ) ) { - ::tools::SvRef xStm; - - if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::XFA, xStm ) ) + uno::Any const data(aDataHelper.GetAny(SotClipboardFormatId::XFA, "")); + uno::Sequence props; + if (data >>= props) { - XFillExchangeData aFillData( XFillAttrSetItem( &mrDoc.GetPool() ) ); - - ReadXFillExchangeData( *xStm, aFillData ); - if( IsUndoEnabled() ) { BegUndo( SdResId(STR_UNDO_DRAGDROP) ); @@ -1345,15 +1342,27 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, EndUndo(); } - XFillAttrSetItem* pSetItem = aFillData.GetXFillAttrSetItem(); - SfxItemSet rSet = pSetItem->GetItemSet(); - drawing::FillStyle eFill = rSet.Get( XATTR_FILLSTYLE ).GetValue(); + ::comphelper::SequenceAsHashMap const map(props); + drawing::FillStyle eFill(drawing::FillStyle_BITMAP); // default to something that's ignored + Color aColor(COL_BLACK); + auto it = map.find("FillStyle"); + if (it != map.end()) + { + XFillStyleItem style; + style.PutValue(it->second, 0); + eFill = style.GetValue(); + } + it = map.find("FillColor"); + if (it != map.end()) + { + XFillColorItem color; + color.PutValue(it->second, 0); + aColor = color.GetColorValue(); + } if( eFill == drawing::FillStyle_SOLID || eFill == drawing::FillStyle_NONE ) { - const XFillColorItem& rColItem = rSet.Get( XATTR_FILLCOLOR ); - Color aColor( rColItem.GetColorValue() ); - OUString aName( rColItem.GetName() ); + OUString aName; SfxItemSet aSet( mrDoc.GetPool() ); bool bClosed = pPickObj->IsClosedObj(); ::sd::Window* pWin = mpViewSh->GetActiveWindow(); -- cgit