diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:27:54 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:27:54 +0000 |
commit | adb203bc05e3e36173cbd46b9951f79821a81799 (patch) | |
tree | 6e6739df9b3f0a567330a0dd7ee0e03ae70876a3 /editeng/source | |
parent | Adding debian version 4:24.2.0-3. (diff) | |
download | libreoffice-adb203bc05e3e36173cbd46b9951f79821a81799.tar.xz libreoffice-adb203bc05e3e36173cbd46b9951f79821a81799.zip |
Merging upstream version 4:24.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 7 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 26 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 2 | ||||
-rw-r--r-- | editeng/source/misc/acorrcfg.cxx | 7 |
4 files changed, 36 insertions, 6 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 4dbb93ce2c..260e8dfb50 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -2795,6 +2795,13 @@ bool EditEngine::HasValidData( const css::uno::Reference< css::datatransfer::XTr datatransfer::DataFlavor aFlavor; SotExchange::GetFormatDataFlavor( SotClipboardFormatId::STRING, aFlavor ); bValidData = rTransferable->isDataFlavorSupported( aFlavor ); + + if (!bValidData) + { + // Allow HTML-only clipboard, i.e. without plain text. + SotExchange::GetFormatDataFlavor(SotClipboardFormatId::HTML, aFlavor); + bValidData = rTransferable->isDataFlavorSupported(aFlavor); + } } return bValidData; diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 4b8f0a6379..40f111b72e 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -3939,7 +3939,7 @@ EditSelection ImpEditEngine::PasteText( uno::Reference< datatransfer::XTransfera } } if (!bDone) { - // HTML + // HTML_SIMPLE SotExchange::GetFormatDataFlavor(SotClipboardFormatId::HTML_SIMPLE, aFlavor); bool bHtmlSupported = rxDataObj->isDataFlavorSupported(aFlavor); if (bHtmlSupported && (SotClipboardFormatId::NONE == format || SotClipboardFormatId::HTML_SIMPLE == format)) { @@ -3963,6 +3963,30 @@ EditSelection ImpEditEngine::PasteText( uno::Reference< datatransfer::XTransfera } } } + + if (!bDone) + { + // HTML + SotExchange::GetFormatDataFlavor(SotClipboardFormatId::HTML, aFlavor); + bool bHtmlSupported = rxDataObj->isDataFlavorSupported(aFlavor); + if (bHtmlSupported + && (format == SotClipboardFormatId::NONE || format == SotClipboardFormatId::HTML)) + { + try + { + uno::Any aData = rxDataObj->getTransferData(aFlavor); + uno::Sequence<sal_Int8> aSeq; + aData >>= aSeq; + SvMemoryStream aHtmlStream(aSeq.getArray(), aSeq.getLength(), StreamMode::READ); + aNewSelection = Read(aHtmlStream, rBaseURL, EETextFormat::Html, rPaM); + bDone = true; + } + catch (const css::uno::Exception&) + { + TOOLS_WARN_EXCEPTION("editeng", "HTML paste failed"); + } + } + } } if ( !bDone ) { diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 57b3d65c54..3bf44cdb91 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -905,7 +905,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, break; case EE_FEATURE_LINEBR: { - rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_SL ); + rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_LINE ); } break; case EE_CHAR_KERNING: diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index 616d75c696..49e48bb48b 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -65,13 +65,12 @@ static void scanAutoCorrectDirForLanguageTags( const OUString& rURL ) continue; const OUString aBcp47( aTitle.copy( 5, aTitle.getLength() - 9)); - OUString aCanonicalized; // Ignore invalid langtags and canonicalize for good, // allow private-use tags. - if (!LanguageTag::isValidBcp47( aBcp47, &aCanonicalized)) + const LanguageTag aLanguageTag (aBcp47, true); + if (!aLanguageTag.isValidBcp47()) continue; - const LanguageTag aLanguageTag( aCanonicalized); if (SvtLanguageTable::HasLanguageType( aLanguageTag.getLanguageType())) continue; @@ -83,7 +82,7 @@ static void scanAutoCorrectDirForLanguageTags( const OUString& rURL ) // other private-use tag (which should not fallback, // but avoid). if (aLanguageTag.getCountry().isEmpty() - && LanguageTag::isValidBcp47( aCanonicalized, nullptr, + && LanguageTag::isValidBcp47( aLanguageTag.getBcp47(), nullptr, LanguageTag::PrivateUse::DISALLOW)) { LanguageTag aFallback( aLanguageTag); |