sot/source/base/exchange.cxx | 2 +- sw/source/uibase/dochdl/swdtflvr.cxx | 18 ++++++++++++++---- vcl/unx/gtk3/gtkinst.cxx | 10 +++++++++- 3 files changed, 24 insertions(+), 6 deletions(-)
New commits: commit 517e2fb772eec52703805c24593cc0af8f7cbac1 Author: Ujjawal Kumar <[email protected]> AuthorDate: Wed Feb 11 18:46:54 2026 +0530 Commit: Thorsten Behrens <[email protected]> CommitDate: Mon Feb 16 05:10:48 2026 +0100 Add Markdown under paste special for gtk3. Change-Id: I423bfa356c337e7a6365beda0dcf1fff233f3edd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199096 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <[email protected]> diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index 3097b43f13b0..13a2ef3a3109 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -197,7 +197,7 @@ const DataFlavor* FormatArray_Impl() /*146 STRING_TSVC*/ { u"application/x-libreoffice-tsvc"_ustr, u"Text TSV-Calc"_ustr, cppu::UnoType<OUString>::get() }, /*147 PDF*/ { u"application/pdf"_ustr, u"PDF Document"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, /*148 SVG*/ { u"image/svg+xml;windows_formatname=\"image/svg+xml\""_ustr, u"SVG"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, - /*149 MARKDOWN*/ { u"text/markdown"_ustr, u"Markdown"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, + /*149 MARKDOWN*/ { u"text/markdown"_ustr, u"Markdown"_ustr, cppu::UnoType<OUString>::get() }, /*150 BIFF_12*/ { u"application/x-openoffice-biff-12;windows_formatname=\"Biff12\""_ustr, u"Biff12"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, }; static_assert(std::size(aInstance) == size_t(SotClipboardFormatId::USER_END) + 1); diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 25aee13ea755..e3dbd4f1b468 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -2240,6 +2240,20 @@ bool SwTransferable::PasteFileContent( const TransferableDataHelper& rData, } [[fallthrough]]; // because then test if we get a stream + case SotClipboardFormatId::MARKDOWN: + { + pRead = ReadMarkdown; + if( rData.GetString( nFormat, sData ) ) + { + pStream = new SvMemoryStream( const_cast<sal_Unicode *>(sData.getStr()), + sData.getLength() * sizeof( sal_Unicode ), + StreamMode::READ ); + pStream->ResetEndianSwap(); + break; + } + } + [[fallthrough]]; + default: if( (xStrm = rData.GetSotStorageStream( nFormat )) ) { @@ -2259,10 +2273,6 @@ bool SwTransferable::PasteFileContent( const TransferableDataHelper& rData, pStream = xStrm.get(); if( SotClipboardFormatId::RTF == nFormat || SotClipboardFormatId::RICHTEXT == nFormat) pRead = SwReaderWriter::GetRtfReader(); - else if( SotClipboardFormatId::MARKDOWN == nFormat ) - { - pRead = ReadMarkdown; - } else if( !pRead ) { pRead = ReadHTML; diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 4037b6986831..9a4f3f9d2721 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -735,6 +735,14 @@ std::vector<css::datatransfer::DataFlavor> GtkTransferable::getTransferDataFlavo aVector.push_back(aFlavor); } + if(bHaveText) + { + css::datatransfer::DataFlavor aFlavor; + aFlavor.MimeType = OUString("text/markdown"); + aFlavor.DataType = cppu::UnoType<OUString>::get(); + aVector.push_back(std::move(aFlavor)); + } + return aVector; } @@ -858,7 +866,7 @@ public: css::uno::Any aRet; css::datatransfer::DataFlavor aFlavor(rFlavor); - if (aFlavor.MimeType == "text/plain;charset=utf-16") + if (aFlavor.MimeType == "text/plain;charset=utf-16" || aFlavor.MimeType == "text/markdown") aFlavor.MimeType = "text/plain;charset=utf-8"; GdkClipboard* clipboard = clipboard_get(m_eSelection);
