diff options
author | Oliver Specht <oliver.specht@cib.de> | 2016-12-30 16:47:17 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-01-09 00:34:30 +0000 |
commit | 048e30c1f8231e6cd144a9251061f6fa127b353e (patch) | |
tree | 712f9d5cf96f28e01eb980f6314df855b619a7eb /sc/source/ui | |
parent | 6f0993f2365cd8b6ce53f7a6e705c7fc9bd07ab6 (diff) |
tdf#101828 handle rtf/richtext correctly
Change-Id: Id894f62a918bd6e6fa59f8d546307343bf2bd4b0
Reviewed-on: https://gerrit.libreoffice.org/32682
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/app/seltrans.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/app/transobj.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob1.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun4.cxx | 4 |
10 files changed, 45 insertions, 15 deletions
diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx index 5dbebf4e1141..6b7eee257a08 100644 --- a/sc/source/ui/app/seltrans.cxx +++ b/sc/source/ui/app/seltrans.cxx @@ -201,6 +201,7 @@ void ScSelectionTransferObj::AddSupportedFormats() AddFormat( SotClipboardFormatId::DIF ); AddFormat( SotClipboardFormatId::STRING ); AddFormat( SotClipboardFormatId::RTF ); + AddFormat( SotClipboardFormatId::RICHTEXT ); if ( eMode == SC_SELTRANS_CELL ) AddFormat( SotClipboardFormatId::EDITENGINE ); break; diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index e8025d72c94e..21ee669859a8 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -240,6 +240,7 @@ void ScTransferObj::AddSupportedFormats() AddFormat( SotClipboardFormatId::STRING ); AddFormat( SotClipboardFormatId::RTF ); + AddFormat( SotClipboardFormatId::RICHTEXT ); if ( aBlock.aStart == aBlock.aEnd ) AddFormat( SotClipboardFormatId::EDITENGINE ); } @@ -255,7 +256,8 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt { bOK = SetTransferableObjectDescriptor( aObjDesc, rFlavor ); } - else if ( ( nFormat == SotClipboardFormatId::RTF || nFormat == SotClipboardFormatId::EDITENGINE ) && + else if ( ( nFormat == SotClipboardFormatId::RTF || nFormat == SotClipboardFormatId::RICHTEXT || + nFormat == SotClipboardFormatId::EDITENGINE ) && aBlock.aStart == aBlock.aEnd ) { // RTF from a single cell is handled by EditEngine @@ -288,7 +290,8 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt (nFormat == SotClipboardFormatId::RTF) ? SCTRANS_TYPE_EDIT_RTF : SCTRANS_TYPE_EDIT_BIN, rFlavor ); } - else if ( ScImportExport::IsFormatSupported( nFormat ) || nFormat == SotClipboardFormatId::RTF ) + else if ( ScImportExport::IsFormatSupported( nFormat ) || nFormat == SotClipboardFormatId::RTF + || nFormat == SotClipboardFormatId::RICHTEXT ) { // if this transfer object was used to create a DDE link, filtered rows // have to be included for subsequent calls (to be consistent with link data) @@ -297,7 +300,8 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt bool bIncludeFiltered = pDoc->IsCutMode() || bUsedForLink; - bool bReduceBlockFormat = nFormat == SotClipboardFormatId::HTML || nFormat == SotClipboardFormatId::RTF; + bool bReduceBlockFormat = nFormat == SotClipboardFormatId::HTML || nFormat == SotClipboardFormatId::RTF + || nFormat == SotClipboardFormatId::RICHTEXT; ScRange aReducedBlock = aBlock; if (bReduceBlockFormat && (aBlock.aEnd.Col() == MAXCOL || aBlock.aEnd.Row() == MAXROW) && aBlock.aStart.Tab() == aBlock.aEnd.Tab()) { diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index cae9393e4fc8..44694a5340cb 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -385,7 +385,7 @@ bool ScImportExport::ImportStream( SvStream& rStrm, const OUString& rBaseURL, So if( Dif2Doc( rStrm ) ) return true; } - if( nFmt == SotClipboardFormatId::RTF ) + if( nFmt == SotClipboardFormatId::RTF || nFmt == SotClipboardFormatId::RICHTEXT ) { if( RTF2Doc( rStrm, rBaseURL ) ) return true; @@ -473,7 +473,7 @@ bool ScImportExport::ExportStream( SvStream& rStrm, const OUString& rBaseURL, So if( Doc2HTML( rStrm, rBaseURL ) ) return true; } - if( nFmt == SotClipboardFormatId::RTF ) + if( nFmt == SotClipboardFormatId::RTF || nFmt == SotClipboardFormatId::RICHTEXT ) { if( Doc2RTF( rStrm ) ) return true; diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 04668a68f92a..34e2f3b81637 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -473,7 +473,8 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) IMPL_LINK( ScDrawTextObjectBar, ClipboardChanged, TransferableDataHelper*, pDataHelper, void ) { - bPastePossible = ( pDataHelper->HasFormat( SotClipboardFormatId::STRING ) || pDataHelper->HasFormat( SotClipboardFormatId::RTF ) ); + bPastePossible = ( pDataHelper->HasFormat( SotClipboardFormatId::STRING ) || pDataHelper->HasFormat( SotClipboardFormatId::RTF ) + || pDataHelper->HasFormat( SotClipboardFormatId::RICHTEXT ) ); SfxBindings& rBindings = pViewData->GetBindings(); rBindings.Invalidate( SID_PASTE ); @@ -499,7 +500,8 @@ void ScDrawTextObjectBar::GetClipState( SfxItemSet& rSet ) // get initial state TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) ); - bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ); + bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF ) + || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ); } SfxWhichIter aIter( rSet ); @@ -524,6 +526,8 @@ void ScDrawTextObjectBar::GetClipState( SfxItemSet& rSet ) aFormats.AddClipbrdFormat( SotClipboardFormatId::STRING ); if ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ) aFormats.AddClipbrdFormat( SotClipboardFormatId::RTF ); + if ( aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ) + aFormats.AddClipbrdFormat( SotClipboardFormatId::RICHTEXT ); rSet.Put( aFormats ); } diff --git a/sc/source/ui/drawfunc/drtxtob1.cxx b/sc/source/ui/drawfunc/drtxtob1.cxx index a4a23f969cca..9ccc020870ac 100644 --- a/sc/source/ui/drawfunc/drtxtob1.cxx +++ b/sc/source/ui/drawfunc/drtxtob1.cxx @@ -118,6 +118,7 @@ void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ ) pDlg->Insert( SotClipboardFormatId::STRING, EMPTY_OUSTRING ); pDlg->Insert( SotClipboardFormatId::RTF, EMPTY_OUSTRING ); + pDlg->Insert( SotClipboardFormatId::RICHTEXT, EMPTY_OUSTRING ); TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) ); diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 98254a257732..b0a49e259b0e 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -446,6 +446,7 @@ void ScCellShell::GetPossibleClipboardFormats( SvxClipboardFormatItem& rFormats lcl_TestFormat( rFormats, aDataHelper, SotClipboardFormatId::STRING ); lcl_TestFormat( rFormats, aDataHelper, SotClipboardFormatId::DIF ); lcl_TestFormat( rFormats, aDataHelper, SotClipboardFormatId::RTF ); + lcl_TestFormat( rFormats, aDataHelper, SotClipboardFormatId::RICHTEXT ); lcl_TestFormat( rFormats, aDataHelper, SotClipboardFormatId::HTML ); lcl_TestFormat( rFormats, aDataHelper, SotClipboardFormatId::HTML_SIMPLE ); lcl_TestFormat( rFormats, aDataHelper, SotClipboardFormatId::BIFF_8 ); @@ -471,6 +472,7 @@ static bool lcl_IsCellPastePossible( const TransferableDataHelper& rData ) rData.HasFormat( SotClipboardFormatId::SVXB ) || rData.HasFormat( SotClipboardFormatId::PRIVATE ) || rData.HasFormat( SotClipboardFormatId::RTF ) || + rData.HasFormat( SotClipboardFormatId::RICHTEXT ) || rData.HasFormat( SotClipboardFormatId::EMBED_SOURCE ) || rData.HasFormat( SotClipboardFormatId::LINK_SOURCE ) || rData.HasFormat( SotClipboardFormatId::EMBED_SOURCE_OLE ) || diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index bb005969f793..49d20e7ab526 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -279,6 +279,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) { pDlg->Insert( SotClipboardFormatId::STRING, EMPTY_OUSTRING ); pDlg->Insert( SotClipboardFormatId::RTF, EMPTY_OUSTRING ); + pDlg->Insert( SotClipboardFormatId::RICHTEXT, EMPTY_OUSTRING ); TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) ); @@ -799,7 +800,8 @@ const SvxURLField* ScEditShell::GetURLField() IMPL_LINK( ScEditShell, ClipboardChanged, TransferableDataHelper*, pDataHelper, void ) { - bPastePossible = ( pDataHelper->HasFormat( SotClipboardFormatId::STRING ) || pDataHelper->HasFormat( SotClipboardFormatId::RTF ) ); + bPastePossible = ( pDataHelper->HasFormat( SotClipboardFormatId::STRING ) || pDataHelper->HasFormat( SotClipboardFormatId::RTF ) + || pDataHelper->HasFormat( SotClipboardFormatId::RICHTEXT ) ); SfxBindings& rBindings = pViewData->GetBindings(); rBindings.Invalidate( SID_PASTE ); @@ -818,7 +820,8 @@ void ScEditShell::GetClipState( SfxItemSet& rSet ) // get initial state TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) ); - bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ); + bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF ) + || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ); } SfxWhichIter aIter( rSet ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 79b3ebac77df..edd5d24637e3 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -3826,6 +3826,7 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt ) IsDropFormatSupported( SotClipboardFormatId::DRAWING ) || IsDropFormatSupported( SotClipboardFormatId::SVXB ) || IsDropFormatSupported( SotClipboardFormatId::RTF ) || + IsDropFormatSupported( SotClipboardFormatId::RICHTEXT ) || IsDropFormatSupported( SotClipboardFormatId::GDIMETAFILE ) || IsDropFormatSupported( SotClipboardFormatId::PNG ) || IsDropFormatSupported( SotClipboardFormatId::BITMAP ) || @@ -3925,10 +3926,10 @@ static SotClipboardFormatId lcl_GetDropFormatId( const uno::Reference<datatransf tools::SvRef<SotStorage> xStore( new SotStorage( *xStm ) ); bDoRtf = ( ( aObjDesc.maClassName == SvGlobalName( SO3_SW_CLASSID ) || aObjDesc.maClassName == SvGlobalName( SO3_SWWEB_CLASSID ) ) - && aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ); + && ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ) ); } if ( bDoRtf ) - nFormatId = SotClipboardFormatId::RTF; + nFormatId = aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT; else nFormatId = SotClipboardFormatId::EMBED_SOURCE; } @@ -3950,6 +3951,8 @@ static SotClipboardFormatId lcl_GetDropFormatId( const uno::Reference<datatransf nFormatId = SotClipboardFormatId::LINK_SOURCE_OLE; else if ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ) nFormatId = SotClipboardFormatId::RTF; + else if ( aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ) + nFormatId = SotClipboardFormatId::RICHTEXT; else if ( aDataHelper.HasFormat( SotClipboardFormatId::HTML ) ) nFormatId = SotClipboardFormatId::HTML; else if ( aDataHelper.HasFormat( SotClipboardFormatId::HTML_SIMPLE ) ) diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 780633f7b401..2c481f5ce0fe 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -529,6 +529,10 @@ void ScViewFunc::PasteFromSystem() { PasteFromSystem( SotClipboardFormatId::RTF ); } + else if( aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ) + { + PasteFromSystem( SotClipboardFormatId::RICHTEXT ); + } else { PasteFromSystem( SotClipboardFormatId::DRAWING ); @@ -548,10 +552,10 @@ void ScViewFunc::PasteFromSystem() { bDoRtf = ( ( aObjDesc.maClassName == SvGlobalName( SO3_SW_CLASSID ) || aObjDesc.maClassName == SvGlobalName( SO3_SWWEB_CLASSID ) ) - && aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ); + && ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ) ); } if ( bDoRtf ) - PasteFromSystem( SotClipboardFormatId::RTF ); + PasteFromSystem( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT ); else if ( aObjDesc.maClassName == SvGlobalName( 0,0,0,0,0,0,0,0,0,0,0 ) && aDataHelper.HasFormat( SotClipboardFormatId::SYLK )) PasteFromSystem( SotClipboardFormatId::SYLK ); @@ -570,6 +574,8 @@ void ScViewFunc::PasteFromSystem() PasteFromSystem(nBiff5); else if (aDataHelper.HasFormat(SotClipboardFormatId::RTF)) PasteFromSystem(SotClipboardFormatId::RTF); + else if (aDataHelper.HasFormat(SotClipboardFormatId::RICHTEXT)) + PasteFromSystem(SotClipboardFormatId::RICHTEXT); else if (aDataHelper.HasFormat(SotClipboardFormatId::HTML)) PasteFromSystem(SotClipboardFormatId::HTML); else if (aDataHelper.HasFormat(SotClipboardFormatId::HTML_SIMPLE)) @@ -648,10 +654,10 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTran { bDoRtf = ( ( aObjDesc.maClassName == SvGlobalName( SO3_SW_CLASSID ) || aObjDesc.maClassName == SvGlobalName( SO3_SWWEB_CLASSID ) ) - && aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ); + && ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) )); } if ( bDoRtf ) - nFormatId = SotClipboardFormatId::RTF; + nFormatId = aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT; else nFormatId = SotClipboardFormatId::EMBED_SOURCE; } @@ -667,6 +673,8 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTran nFormatId = nBiff5; else if (aDataHelper.HasFormat(SotClipboardFormatId::RTF)) nFormatId = SotClipboardFormatId::RTF; + else if (aDataHelper.HasFormat(SotClipboardFormatId::RICHTEXT)) + nFormatId = SotClipboardFormatId::RICHTEXT; else if (aDataHelper.HasFormat(SotClipboardFormatId::HTML)) nFormatId = SotClipboardFormatId::HTML; else if (aDataHelper.HasFormat(SotClipboardFormatId::HTML_SIMPLE)) diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 1dbeb256892c..48c322485a35 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -166,6 +166,10 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow, aImpEx.ImportStream( *xStream, OUString(), SotClipboardFormatId::RTF ); else if ( aDataHelper.GetString( SotClipboardFormatId::RTF, aStr ) ) aImpEx.ImportString( aStr, SotClipboardFormatId::RTF ); + else if ( aDataHelper.GetSotStorageStream( SotClipboardFormatId::RICHTEXT, xStream ) && xStream.Is() ) + aImpEx.ImportStream( *xStream, OUString(), SotClipboardFormatId::RICHTEXT ); + else if ( aDataHelper.GetString( SotClipboardFormatId::RICHTEXT, aStr ) ) + aImpEx.ImportString( aStr, SotClipboardFormatId::RICHTEXT ); AdjustRowHeight( nStartRow, aImpEx.GetRange().aEnd.Row() ); pDocSh->UpdateOle(&GetViewData()); |