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 /sw | |
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 'sw')
-rw-r--r-- | sw/source/core/doc/swserv.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/docnode/section.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 23 | ||||
-rw-r--r-- | sw/source/uibase/shells/annotsh.cxx | 6 |
4 files changed, 28 insertions, 3 deletions
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 3b03c308a2e9..da6633d4e7bb 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -144,6 +144,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; @@ -547,7 +548,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: { @@ -719,6 +726,7 @@ bool SwTransferable::WriteObject( tools::SvRef<SotStorageStream>& xStream, break; case SWTRANSFER_OBJECTTYPE_RTF: + case SWTRANSFER_OBJECTTYPE_RICHTEXT: GetRTFWriter( aEmptyOUStr, OUString(), xWrt ); break; @@ -927,6 +935,7 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) if( !m_pWrtShell->IsObjSelected() ) { AddFormat( SotClipboardFormatId::RTF ); + AddFormat( SotClipboardFormatId::RICHTEXT ); AddFormat( SotClipboardFormatId::HTML ); } if( m_pWrtShell->IsSelection() ) @@ -1066,6 +1075,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 ); @@ -1168,6 +1178,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 && @@ -1324,6 +1339,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 ); @@ -1658,7 +1674,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 ) { @@ -2068,6 +2084,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, @@ -3051,6 +3069,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 4489deb9aab8..92f465580767 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 ); } |