diff options
author | Oliver Specht <oliver.specht@cib.de> | 2016-12-30 16:47:17 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-01-26 12:01:21 +0000 |
commit | a6f3ca06100bc23eee5017d6cf53e89282dc580d (patch) | |
tree | aacf736ec60852bf8b72599e33afe479bc23d896 | |
parent | 5891a45fa08729ba01f78bece9312b2c01d3a214 (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>
(cherry picked from commit 048e30c1f8231e6cd144a9251061f6fa127b353e)
Reviewed-on: https://gerrit.libreoffice.org/33567
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
31 files changed, 134 insertions, 35 deletions
diff --git a/dtrans/source/win32/ftransl/ftransl.cxx b/dtrans/source/win32/ftransl/ftransl.cxx index cb62bdd24be4..3350211d07d6 100644 --- a/dtrans/source/win32/ftransl/ftransl.cxx +++ b/dtrans/source/win32/ftransl/ftransl.cxx @@ -134,7 +134,7 @@ static const std::vector< FormatEntry > g_TranslTable { // SotClipboardFormatId::SIMPLE_FILE FormatEntry("application/x-openoffice-file;windows_formatname=\"FileName\"", "FileName", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::RTF - FormatEntry("text/richtext", "Rich Text Format", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), + FormatEntry("text/rtf", "Rich Text Format", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::DRAWING FormatEntry("application/x-openoffice-drawing;windows_formatname=\"Drawing Format\"", "Drawing Format", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), // SotClipboardFormatId::SVXB @@ -352,6 +352,8 @@ static const std::vector< FormatEntry > g_TranslTable { FormatEntry("application/x-openoffice-dummy3;windows_formatname=\"SO_DUMMYFORMAT_3\"", "SO_DUMMYFORMAT_3", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), //SotClipboardFormatId::DUMMY4 FormatEntry("application/x-openoffice-dummy4;windows_formatname=\"SO_DUMMYFORMAT_4\"", "SO_DUMMYFORMAT_4", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), + // SotClipboardFormatId::RICHTEXT + FormatEntry("text/richtext", "Richtext Format", nullptr, CF_INVALID, CPPUTYPE_DEFAULT), }; namespace { diff --git a/editeng/source/editeng/eeobj.cxx b/editeng/source/editeng/eeobj.cxx index 7347fa3f9ca8..c72354e3bb16 100644 --- a/editeng/source/editeng/eeobj.cxx +++ b/editeng/source/editeng/eeobj.cxx @@ -57,7 +57,7 @@ uno::Any EditDataObject::getTransferData( const datatransfer::DataFlavor& rFlavo { aAny <<= GetString(); } - else if ( ( nT == SotClipboardFormatId::EDITENGINE ) || ( nT == SotClipboardFormatId::RTF ) ) + else if ( ( nT == SotClipboardFormatId::EDITENGINE ) || ( nT == SotClipboardFormatId::RTF ) || ( nT == SotClipboardFormatId::RICHTEXT ) ) { // No RTF on demand any more: // 1) Was not working, because I had to flush() the clipboard immediately anyway @@ -84,10 +84,11 @@ uno::Any EditDataObject::getTransferData( const datatransfer::DataFlavor& rFlavo uno::Sequence< datatransfer::DataFlavor > EditDataObject::getTransferDataFlavors( ) throw(uno::RuntimeException, std::exception) { - uno::Sequence< datatransfer::DataFlavor > aDataFlavors(3); + uno::Sequence< datatransfer::DataFlavor > aDataFlavors(4); SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EDITENGINE, aDataFlavors.getArray()[0] ); SotExchange::GetFormatDataFlavor( SotClipboardFormatId::STRING, aDataFlavors.getArray()[1] ); SotExchange::GetFormatDataFlavor( SotClipboardFormatId::RTF, aDataFlavors.getArray()[2] ); + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::RICHTEXT, aDataFlavors.getArray()[3] ); return aDataFlavors; } @@ -97,7 +98,8 @@ sal_Bool EditDataObject::isDataFlavorSupported( const datatransfer::DataFlavor& bool bSupported = false; SotClipboardFormatId nT = SotExchange::GetFormat( rFlavor ); - if ( ( nT == SotClipboardFormatId::STRING ) || ( nT == SotClipboardFormatId::RTF ) || ( nT == SotClipboardFormatId::EDITENGINE ) ) + if ( ( nT == SotClipboardFormatId::STRING ) || ( nT == SotClipboardFormatId::RTF ) || ( nT == SotClipboardFormatId::RICHTEXT ) + || ( nT == SotClipboardFormatId::EDITENGINE ) ) bSupported = true; return bSupported; diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 4de0042675fc..a879060b0b28 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -3490,8 +3490,17 @@ EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransfer { // RTF SotExchange::GetFormatDataFlavor( SotClipboardFormatId::RTF, aFlavor ); - if ( rxDataObj->isDataFlavorSupported( aFlavor ) ) + // RICHTEXT + datatransfer::DataFlavor aFlavorRichtext; + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::RTF, aFlavorRichtext ); + bool bRtfSupported = rxDataObj->isDataFlavorSupported( aFlavor ); + bool bRichtextSupported = rxDataObj->isDataFlavorSupported( aFlavorRichtext ); + if ( bRtfSupported || bRichtextSupported ) { + if(bRichtextSupported) + { + aFlavor = aFlavorRichtext; + } try { uno::Any aData = rxDataObj->getTransferData( aFlavor ); diff --git a/forms/source/richtext/clipboarddispatcher.cxx b/forms/source/richtext/clipboarddispatcher.cxx index e8fe2321369b..9d068b428f26 100644 --- a/forms/source/richtext/clipboarddispatcher.cxx +++ b/forms/source/richtext/clipboarddispatcher.cxx @@ -137,7 +137,8 @@ namespace frm // initial state TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( _rView.GetWindow() ) ); - m_bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ); + m_bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || + aDataHelper.HasFormat( SotClipboardFormatId::RTF ) || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ); } @@ -155,7 +156,8 @@ namespace frm { OSL_ENSURE( _pDataHelper, "OPasteClipboardDispatcher::OnClipboardChanged: ooops!" ); m_bPastePossible = _pDataHelper->HasFormat( SotClipboardFormatId::STRING ) - || _pDataHelper->HasFormat( SotClipboardFormatId::RTF ); + || _pDataHelper->HasFormat( SotClipboardFormatId::RTF ) + || _pDataHelper->HasFormat( SotClipboardFormatId::RICHTEXT ); invalidate(); } diff --git a/include/sot/formats.hxx b/include/sot/formats.hxx index 04094b0010c0..482f65bad44f 100644 --- a/include/sot/formats.hxx +++ b/include/sot/formats.hxx @@ -172,8 +172,9 @@ enum class SotClipboardFormatId : sal_uLong STARWRITERGLOB_8_TEMPLATE = 142, MATHML = 143, JPEG = 144, + RICHTEXT = 145, // the point at which we start allocating "runtime" format IDs - USER_END = JPEG + USER_END = RICHTEXT }; /** Make it easier to iterate over format IDs */ diff --git a/include/svtools/sores.hxx b/include/svtools/sores.hxx index 66146721b754..1a1260aa96d1 100644 --- a/include/svtools/sores.hxx +++ b/include/svtools/sores.hxx @@ -100,7 +100,9 @@ #define STR_FORMAT_ID_DBACCESS_COMMAND (STR_FORMAT_START + 115) #define STR_FORMAT_ID_DIALOG_60 (STR_FORMAT_START + 116) #define STR_FORMAT_ID_HTML_NO_COMMENT (STR_FORMAT_START + 119) -#define STR_FORMAT_END (STR_FORMAT_ID_HTML_NO_COMMENT) +#define STR_FORMAT_ID_RICHTEXT (STR_FORMAT_START + 120) + +#define STR_FORMAT_END (STR_FORMAT_ID_RICHTEXT) #endif // INCLUDED_SVTOOLS_SORES_HXX 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 35527ff8ce7a..0f0db15d30dc 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 7521afb942f7..0fe048763f43 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -472,7 +472,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 ); @@ -498,7 +499,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 ); @@ -523,6 +525,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 cb2f79995cde..83de21b27898 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -445,6 +445,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 ); @@ -470,6 +471,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 1e1aae092de0..86817f2be5ae 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 3fd29334baaa..aea4f5365f3b 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 bd49b55cb954..614e2d98caba 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()); diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 12b55eeb1d8f..dc93f8975f17 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -445,8 +445,10 @@ void SdTransferable::AddSupportedFormats() AddFormat( SotClipboardFormatId::BITMAP ); } - if( lcl_HasOnlyOneTable( mpSdDrawDocument ) ) + if( lcl_HasOnlyOneTable( mpSdDrawDocument ) ) { AddFormat( SotClipboardFormatId::RTF ); + AddFormat( SotClipboardFormatId::RICHTEXT ); + } } if( mpImageMap ) diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index f68e92bfa0ca..c7ae0abcd395 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -253,6 +253,7 @@ void FuInsertClipboard::DoExecute( SfxRequest& ) pDlg->Insert( SotClipboardFormatId::STRING, OUString() ); pDlg->Insert( SotClipboardFormatId::HTML, OUString() ); pDlg->Insert( SotClipboardFormatId::RTF, OUString() ); + pDlg->Insert( SotClipboardFormatId::RICHTEXT, OUString() ); pDlg->Insert( SotClipboardFormatId::EDITENGINE, OUString() ); //TODO/MBA: testing diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 9af3432cf119..f8570a42f411 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -157,6 +157,7 @@ using namespace ::com::sun::star::linguistic2; case SotClipboardFormatId::STRING: case SotClipboardFormatId::HTML: case SotClipboardFormatId::RTF: + case SotClipboardFormatId::RICHTEXT: case SotClipboardFormatId::EDITENGINE: pResult->AddClipbrdFormat(nTestFormat); break; diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index e9ab3e560e7b..5dfe6f600908 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -707,6 +707,7 @@ IMPL_LINK( OutlineViewShell, ClipboardChanged, TransferableDataHelper*, pDataHel bPastePossible = pDataHelper->GetFormatCount() != 0 && ( pDataHelper->HasFormat( SotClipboardFormatId::STRING ) || pDataHelper->HasFormat( SotClipboardFormatId::RTF ) || + pDataHelper->HasFormat( SotClipboardFormatId::RICHTEXT ) || pDataHelper->HasFormat( SotClipboardFormatId::HTML ) ); SfxBindings& rBindings = GetViewFrame()->GetBindings(); @@ -890,6 +891,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) bPastePossible = ( aDataHelper.GetFormatCount() != 0 && ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF ) || + aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) || aDataHelper.HasFormat( SotClipboardFormatId::HTML ) ) ); } diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 6490032b32c9..00eb9066d5e3 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -327,14 +327,16 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, bool bTable = false; // check special cases for pasting table formats as RTL - if( !bLink && (nFormat == SotClipboardFormatId::NONE || (nFormat == SotClipboardFormatId::RTF)) ) + if( !bLink && (nFormat == SotClipboardFormatId::NONE || (nFormat == SotClipboardFormatId::RTF) || (nFormat == SotClipboardFormatId::RICHTEXT)) ) { // if the objekt supports rtf and there is a table involved, default is to create a table - if( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) && ! aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) ) + bool bIsRTF = aDataHelper.HasFormat( SotClipboardFormatId::RTF ); + if( ( bIsRTF || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ) + && ! aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) ) { ::tools::SvRef<SotStorageStream> xStm; - if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::RTF, xStm ) ) + if( aDataHelper.GetSotStorageStream( bIsRTF ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT, xStm ) ) { xStm->Seek( 0 ); @@ -345,7 +347,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if (x != -1) { bTable = true; - nFormat = SotClipboardFormatId::RTF; + nFormat = bIsRTF ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT; break; } } @@ -1419,11 +1421,12 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, } } - if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::RTF)) + bool bIsRTF = false; + if(!bReturn && !bLink && (( bIsRTF = CHECK_FORMAT_TRANS(SotClipboardFormatId::RTF) ) || CHECK_FORMAT_TRANS(SotClipboardFormatId::RICHTEXT) )) { ::tools::SvRef<SotStorageStream> xStm; - if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::RTF, xStm ) ) + if( aDataHelper.GetSotStorageStream( bIsRTF ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT, xStm ) ) { xStm->Seek( 0 ); diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 06569040d1f0..6b2347d0b365 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -434,6 +434,7 @@ bool SfxApplication::InitializeDde() // we certainly want to support RTF! pImpl->pDdeService->AddFormat( SotClipboardFormatId::RTF ); + pImpl->pDdeService->AddFormat( SotClipboardFormatId::RICHTEXT ); // Config path as a topic because of multiple starts INetURLObject aOfficeLockFile( SvtPathOptions().GetUserConfigPath() ); diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index 4665ec805fd6..0ddcb35c7987 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -203,6 +203,7 @@ namespace /*142 SotClipboardFormatId::STARWRITERGLOB_8_TEMPLATE*/ { MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE_ASCII, "Writer/Global 8 Template", &cppu::UnoType<Sequence<sal_Int8>>::get() }, /*143 SotClipboardFormatId::MATHML*/ { "application/mathml+xml", "MathML", &::cppu::UnoType<const Sequence< sal_Int8 >>::get() }, /*144 SotClipboardFormatId::JPEG*/ { "image/jpeg", "JPEG Bitmap", &cppu::UnoType<Sequence<sal_Int8>>::get() }, + /*145 SotClipboardFormatId::RICHTEXT*/ { "text/richtext", "Richtext Format", &cppu::UnoType<Sequence<sal_Int8>>::get() } }; return &aInstance[0]; } diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx index 55211eb33672..6ff84b171d73 100644 --- a/sot/source/base/formats.cxx +++ b/sot/source/base/formats.cxx @@ -195,6 +195,7 @@ static SotAction_Impl const aEXCHG_DEST_DOC_TEXTFRAME_Move[] = \ { SotClipboardFormatId::HTML_NO_COMMENT, EXCHG_OUT_ACTION_INSERT_HTML, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::RTF, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ + { SotClipboardFormatId::RICHTEXT, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertTargetUrl, 0 }, \ { SotClipboardFormatId::STRING, EXCHG_OUT_ACTION_INSERT_STRING, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ @@ -226,6 +227,7 @@ static SotAction_Impl const aEXCHG_DEST_DOC_TEXTFRAME_Copy[] = \ { SotClipboardFormatId::HTML_NO_COMMENT, EXCHG_OUT_ACTION_INSERT_HTML, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::RTF, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ + { SotClipboardFormatId::RICHTEXT, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertTargetUrl, 0 }, \ { SotClipboardFormatId::STRING, EXCHG_OUT_ACTION_INSERT_STRING, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ @@ -292,6 +294,7 @@ static SotAction_Impl const aEXCHG_DEST_DOC_TEXTFRAME_WEB_Move[] = \ { SotClipboardFormatId::HTML_NO_COMMENT, EXCHG_OUT_ACTION_INSERT_HTML, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::RTF, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ + { SotClipboardFormatId::RICHTEXT, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertTargetUrl, 0 }, \ { SotClipboardFormatId::STRING, EXCHG_OUT_ACTION_INSERT_STRING, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ @@ -317,6 +320,7 @@ static SotAction_Impl const aEXCHG_DEST_DOC_TEXTFRAME_WEB_Copy[] = \ { SotClipboardFormatId::HTML_NO_COMMENT, EXCHG_OUT_ACTION_INSERT_HTML, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::RTF, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ + { SotClipboardFormatId::RICHTEXT, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertTargetUrl, 0 }, \ { SotClipboardFormatId::STRING, EXCHG_OUT_ACTION_INSERT_STRING, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ @@ -832,6 +836,7 @@ static SotAction_Impl const aEXCHG_DEST_SWDOC_FREE_AREA_Def[] = \ { SotClipboardFormatId::HTML_NO_COMMENT, EXCHG_IN_ACTION_COPY }, \ { SotClipboardFormatId::HTML_SIMPLE, EXCHG_IN_ACTION_COPY }, \ { SotClipboardFormatId::RTF, EXCHG_IN_ACTION_COPY }, \ + { SotClipboardFormatId::RICHTEXT, EXCHG_IN_ACTION_COPY }, \ { SotClipboardFormatId::SVIM, EXCHG_IN_ACTION_COPY }, \ { SotClipboardFormatId::NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY }, \ { SotClipboardFormatId::STRING, EXCHG_IN_ACTION_COPY }, \ @@ -868,6 +873,7 @@ static SotAction_Impl const aEXCHG_DEST_SWDOC_FREE_AREA_Move[] = \ { SotClipboardFormatId::HTML_NO_COMMENT, EXCHG_OUT_ACTION_INSERT_HTML, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::RTF, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertTargetUrl, 0 }, \ + { SotClipboardFormatId::RICHTEXT, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertTargetUrl, 0 }, \ { SotClipboardFormatId::STRING, EXCHG_OUT_ACTION_INSERT_STRING }, \ { SotClipboardFormatId::GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ { SotClipboardFormatId::PNG, EXCHG_OUT_ACTION_INSERT_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 },\ diff --git a/svtools/source/dialogs/formats.src b/svtools/source/dialogs/formats.src index b9451a1f51a4..3ecaff7ac772 100644 --- a/svtools/source/dialogs/formats.src +++ b/svtools/source/dialogs/formats.src @@ -35,6 +35,10 @@ String STR_FORMAT_RTF { Text [ en-US ] = "Formatted text [RTF]" ; }; +String STR_FORMAT_ID_RICHTEXT +{ + Text [ en-US ] = "Formatted text [Richtext]" ; +}; String STR_FORMAT_ID_DRAWING { Text [ en-US ] = "Drawing format"; diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx index b9a6f535a1a3..5d76ec22de3b 100644 --- a/svtools/source/dialogs/insdlg.cxx +++ b/svtools/source/dialogs/insdlg.cxx @@ -263,7 +263,8 @@ OUString SvPasteObjectHelper::GetSotFormatUIName( SotClipboardFormatId nId ) { SotClipboardFormatId::DBACCESS_COMMAND, STR_FORMAT_ID_DBACCESS_COMMAND }, { SotClipboardFormatId::DIALOG_60, STR_FORMAT_ID_DIALOG_60 }, { SotClipboardFormatId::FILEGRPDESCRIPTOR, STR_FORMAT_ID_FILEGRPDESCRIPTOR }, - { SotClipboardFormatId::HTML_NO_COMMENT, STR_FORMAT_ID_HTML_NO_COMMENT } + { SotClipboardFormatId::HTML_NO_COMMENT, STR_FORMAT_ID_HTML_NO_COMMENT }, + { SotClipboardFormatId::RICHTEXT, STR_FORMAT_ID_RICHTEXT }, }; OUString aUIName; diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 1f7fcb7ad3ff..78849fa5dd8b 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -1271,6 +1271,10 @@ void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor { rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::RTF; } + else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "text/richtext" ) ) + { + rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SotClipboardFormatId::RICHTEXT; + } else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( "text/html" ) ) { diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index 05fe51c81cd0..ee851d45e80f 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -51,6 +51,7 @@ bool SwServerObject::GetData( uno::Any & rData, break; case SotClipboardFormatId::RTF: + case SotClipboardFormatId::RICHTEXT: // mba: no BaseURL for data exchange ::GetRTFWriter( OUString(), OUString(), xWrt ); break; diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index c47dd97e2096..275a534cae62 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1244,6 +1244,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) pRead = ReadAscii; break; + case SotClipboardFormatId::RICHTEXT: case SotClipboardFormatId::RTF: pRead = SwReaderWriter::GetRtfReader(); break; diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 6b65412c8cfb..2e7546b146ef 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -145,6 +145,7 @@ extern bool g_bExecuteDrag; #define SWTRANSFER_OBJECTTYPE_STRING static_cast<SotClipboardFormatId>(0x00000008) #define SWTRANSFER_OBJECTTYPE_SWOLE static_cast<SotClipboardFormatId>(0x00000010) #define SWTRANSFER_OBJECTTYPE_DDE static_cast<SotClipboardFormatId>(0x00000020) +#define SWTRANSFER_OBJECTTYPE_RICHTEXT static_cast<SotClipboardFormatId>(0x00000040) using namespace ::svx; using namespace ::com::sun::star; @@ -549,7 +550,13 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo SwDoc *const pDoc = lcl_GetDoc(*m_pClpDocFac); bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_RTF, rFlavor ); } - break; + break; + case SotClipboardFormatId::RICHTEXT: + { + SwDoc *const pDoc = lcl_GetDoc(*m_pClpDocFac); + bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_RICHTEXT, rFlavor ); + } + break; case SotClipboardFormatId::HTML: { @@ -721,6 +728,7 @@ bool SwTransferable::WriteObject( tools::SvRef<SotStorageStream>& xStream, break; case SWTRANSFER_OBJECTTYPE_RTF: + case SWTRANSFER_OBJECTTYPE_RICHTEXT: GetRTFWriter( aEmptyOUStr, OUString(), xWrt ); break; @@ -929,6 +937,7 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) if( !m_pWrtShell->IsObjSelected() ) { AddFormat( SotClipboardFormatId::RTF ); + AddFormat( SotClipboardFormatId::RICHTEXT ); AddFormat( SotClipboardFormatId::HTML ); } if( m_pWrtShell->IsSelection() ) @@ -1068,6 +1077,7 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr //When someone needs it, we 'OLE' her something. AddFormat( SotClipboardFormatId::EMBED_SOURCE ); AddFormat( SotClipboardFormatId::RTF ); + AddFormat( SotClipboardFormatId::RICHTEXT ); AddFormat( SotClipboardFormatId::HTML ); AddFormat( SotClipboardFormatId::STRING ); @@ -1170,6 +1180,11 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, sal_u nAction = EXCHG_OUT_ACTION_INSERT_STRING; nFormat = SotClipboardFormatId::RTF; } + else if( rData.HasFormat( SotClipboardFormatId::RICHTEXT ) ) + { + nAction = EXCHG_OUT_ACTION_INSERT_STRING; + nFormat = SotClipboardFormatId::RICHTEXT; + } } return EXCHG_INOUT_ACTION_NONE != nAction && @@ -1326,6 +1341,7 @@ bool SwTransferable::PasteData( TransferableDataHelper& rData, case SotClipboardFormatId::HTML_SIMPLE: case SotClipboardFormatId::HTML_NO_COMMENT: case SotClipboardFormatId::RTF: + case SotClipboardFormatId::RICHTEXT: case SotClipboardFormatId::STRING: bRet = SwTransferable::PasteFileContent( rData, rSh, nFormat, bMsg ); @@ -1660,7 +1676,7 @@ bool SwTransferable::PasteFileContent( TransferableDataHelper& rData, else { pStream = xStrm.get(); - if( SotClipboardFormatId::RTF == nFormat ) + if( SotClipboardFormatId::RTF == nFormat || SotClipboardFormatId::RICHTEXT == nFormat) pRead = SwReaderWriter::GetRtfReader(); else if( !pRead ) { @@ -2070,6 +2086,7 @@ bool SwTransferable::PasteDDE( TransferableDataHelper& rData, // do we want to read in a graphic now? SotClipboardFormatId nFormat; if( !rData.HasFormat( SotClipboardFormatId::RTF ) && + !rData.HasFormat( SotClipboardFormatId::RICHTEXT ) && !rData.HasFormat( SotClipboardFormatId::HTML ) && !rData.HasFormat( SotClipboardFormatId::STRING ) && (rData.HasFormat( nFormat = SotClipboardFormatId::GDIMETAFILE ) || @@ -2856,6 +2873,7 @@ static SotClipboardFormatId aPasteSpecialIds[] = SotClipboardFormatId::HTML_SIMPLE, SotClipboardFormatId::HTML_NO_COMMENT, SotClipboardFormatId::RTF, + SotClipboardFormatId::RICHTEXT, SotClipboardFormatId::STRING, SotClipboardFormatId::SONLK, SotClipboardFormatId::NETSCAPE_BOOKMARK, @@ -3052,6 +3070,7 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos ) if( !m_pWrtShell->IsObjSelected() ) { AddFormat( SotClipboardFormatId::RTF ); + AddFormat( SotClipboardFormatId::RICHTEXT ); AddFormat( SotClipboardFormatId::HTML ); } if( m_pWrtShell->IsSelection() ) diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index d2b0172215f0..195cb0f9f355 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -921,6 +921,7 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq) pDlg->Insert( SotClipboardFormatId::STRING, OUString() ); pDlg->Insert( SotClipboardFormatId::RTF, OUString() ); + pDlg->Insert( SotClipboardFormatId::RICHTEXT, OUString() ); TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &rView.GetEditWin() ) ); @@ -967,7 +968,8 @@ void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet) OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView(); TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &rView.GetEditWin() ) ); - bool bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ); + bool bPastePossible = ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF ) + || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT )); bPastePossible = bPastePossible && (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED); SfxWhichIter aIter(rSet); @@ -1003,6 +1005,8 @@ void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet) SvxClipboardFormatItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS ); if ( aDataHelper.HasFormat( SotClipboardFormatId::RTF ) ) aFormats.AddClipbrdFormat( SotClipboardFormatId::RTF ); + if ( aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ) + aFormats.AddClipbrdFormat( SotClipboardFormatId::RICHTEXT ); aFormats.AddClipbrdFormat( SotClipboardFormatId::STRING ); rSet.Put( aFormats ); } |