sd/source/ui/func/fuinsert.cxx | 1 + sd/source/ui/view/drviews7.cxx | 1 + sd/source/ui/view/sdview2.cxx | 3 ++- sd/source/ui/view/sdview3.cxx | 31 ++++++++++++++++++++++++++++++- 4 files changed, 34 insertions(+), 2 deletions(-)
New commits: commit 112a82566453fcf85ce3619965ca6e11fa9d29c5 Author: Varun Dhall <varun.dh...@studentpartner.com> Date: Wed Jun 7 21:31:01 2017 +0530 EditEngine: Added ODF_TEXT_FLAT copy/paste for sd Change-Id: I23777477d31f30ee18ee8926a8f3170505f74264 Reviewed-on: https://gerrit.libreoffice.org/38535 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index d7077b57ed8c..588e4a8ab0d6 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -255,6 +255,7 @@ void FuInsertClipboard::DoExecute( SfxRequest& ) pDlg->Insert( SotClipboardFormatId::RTF, OUString() ); pDlg->Insert( SotClipboardFormatId::RICHTEXT, OUString() ); pDlg->Insert( SotClipboardFormatId::EDITENGINE, OUString() ); + pDlg->Insert( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT, OUString() ); //TODO/MBA: testing nFormatId = pDlg->GetFormat( aDataHelper ); diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 37ae7934408d..976449563727 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -160,6 +160,7 @@ using namespace ::com::sun::star::linguistic2; case SotClipboardFormatId::RTF: case SotClipboardFormatId::RICHTEXT: case SotClipboardFormatId::EDITENGINE: + case SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT: pResult->AddClipbrdFormat(nTestFormat); break; default: break; diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 1865f01cc674..8199ba385cb9 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -574,6 +574,7 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge { const bool bSBAFormat = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::SVX_FORMFIELDEXCH ); const bool bEditEngine = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::EDITENGINE ); + const bool bEditEngineODF = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT ); const bool bString = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::STRING ); const bool bRTF = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::RTF ); const bool bFile = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE ); @@ -588,7 +589,7 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge if( bBookmark && bFile && ( nDropAction & DND_ACTION_MOVE ) && mpViewSh && SlideShow::IsRunning(mpViewSh->GetViewShellBase()) ) bBookmark = false; - if( bDrawing || bGraphic || bMtf || bBitmap || bBookmark || bFile || bFileList || bXFillExchange || bSBAFormat || bEditEngine || bString || bRTF ) + if( bDrawing || bGraphic || bMtf || bBitmap || bBookmark || bFile || bFileList || bXFillExchange || bSBAFormat || bEditEngine || bEditEngineODF || bString || bRTF ) nRet = nDropAction; // For entries from the navigator, change action copy. diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 7720442f6c7b..34a6cc857c01 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -1392,10 +1392,39 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, } } - if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::EDITENGINE)) + char* ODF_XML_Env = getenv ("ODF_TEXT_FLAT_XML_ENV"); + + if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) && ODF_XML_Env != nullptr) { ::tools::SvRef<SotStorageStream> xStm; + if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT, xStm ) ) + { + OutlinerView* pOLV = GetTextEditOutlinerView(); + + xStm->Seek( 0 ); + + if( pOLV ) + { + ::tools::Rectangle aRect( pOLV->GetOutputArea() ); + Point aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) ); + if( aRect.IsInside( aPos ) || ( !bDrag && IsTextEdit() ) ) + { + // mba: clipboard always must contain absolute URLs (could be from alien source) + pOLV->Read( *xStm, EE_FORMAT_XML, mpDocSh->GetHeaderAttributes() ); + bReturn = true; + } + } + + if( !bReturn ) + // mba: clipboard always must contain absolute URLs (could be from alien source) + bReturn = SdrView::Paste( *xStm, EE_FORMAT_XML, maDropPos, pPage, nPasteOptions ); + } + } + + if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::EDITENGINE) ) + { + ::tools::SvRef<SotStorageStream> xStm; if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::EDITENGINE, xStm ) ) { OutlinerView* pOLV = GetTextEditOutlinerView(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits