diff options
author | Oliver Specht <oliver.specht@cib.de> | 2023-10-30 13:26:49 +0100 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2023-11-10 09:52:28 +0100 |
commit | 87be89ac27023f48f68a873b37df31aa0453d6fa (patch) | |
tree | 533e336a0fe896967af6db39116aa1fbf411f614 /sd | |
parent | 7924d8fc274bb611c829443e0eb1a53d883cc9a3 (diff) |
tdf#157363 add HTML format when pasting into draw text
adds HTML to paste(special) in draw text in impress/draw/calc/writer
Change-Id: Iaede82e1b3d48be362b70bd631e7f912b02b9822
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158659
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/func/fuinsert.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/view/sdview3.cxx | 30 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index 28a4c102b3c0..5f80abc89ebd 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -225,6 +225,7 @@ void FuInsertClipboard::DoExecute( SfxRequest& ) pDlg->Insert( SotClipboardFormatId::NETSCAPE_BOOKMARK, OUString() ); pDlg->Insert( SotClipboardFormatId::STRING, OUString() ); pDlg->Insert( SotClipboardFormatId::HTML, OUString() ); + pDlg->Insert(SotClipboardFormatId::HTML_SIMPLE, OUString()); pDlg->Insert( SotClipboardFormatId::RTF, OUString() ); pDlg->Insert( SotClipboardFormatId::RICHTEXT, OUString() ); pDlg->Insert( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT, OUString() ); diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index c0fa51d1ae67..3288fed35114 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -1491,6 +1491,36 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, } } } + + bool bIsHtmlSimple = CHECK_FORMAT_TRANS(SotClipboardFormatId::HTML_SIMPLE); + if (bIsHtmlSimple) + { + ::tools::SvRef<SotTempStream> xStm; + + if (aDataHelper.GetSotStorageStream(SotClipboardFormatId::HTML_SIMPLE, xStm)) + { + xStm->Seek(0); + + OutlinerView* pOLV = GetTextEditOutlinerView(); + + if (pOLV) + { + ::tools::Rectangle aRect(pOLV->GetOutputArea()); + Point aPos(pOLV->GetWindow()->PixelToLogic(maDropPos)); + + if (aRect.Contains(aPos) || (!bDrag && IsTextEdit())) + { + // mba: clipboard always must contain absolute URLs (could be from alien source) + pOLV->Read(*xStm, EETextFormat::Html, mpDocSh->GetHeaderAttributes()); + bReturn = true; + } + } + + if (!bReturn) + // mba: clipboard always must contain absolute URLs (could be from alien source) + bReturn = SdrView::Paste(*xStm, EETextFormat::Html, maDropPos, pPage, nPasteOptions); + } + } } if(!bReturn && CHECK_FORMAT_TRANS(SotClipboardFormatId::FILE_LIST)) |