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/view | |
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/view')
-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 |
5 files changed, 28 insertions, 8 deletions
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()); |