sfx2/source/bastyp/fltfnc.cxx | 9 +++++++++ 1 file changed, 9 insertions(+)
New commits: commit dfb5639721031bcc43905576e84a97bed512567e Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Aug 27 13:57:08 2025 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Aug 27 12:52:01 2025 +0200 tdf#168131: don't pick hybrid PDF, when normal PDF was detected When a standard PDF is dragged onto a spreadsheet, a matcher is created in ScViewFunc::PasteFile, with current document service. Inside GuessFilterControlDefaultUI call, queryTypeByDescriptor detects pdf_Portable_Document_Format type, and draw_pdf_import as filter. Detection in PDFDetector::detect checks for embedded hybrid stream, and if found, it would return one of "addstream" filter names; and when we get a simple "*_pdf_import", it means that hybrid PDF was not detected. But SfxFilterMatcher::GuessFilterControlDefaultUI tried to find a filter for the detected file type, that matches the document service. It listed all filters for the type, and found the only filter that matched Calc: calc_pdf_addstream_import, which is for hybrid PDFs. This change makes an explicit check, that when original detection was for a normal PDF, we don't pick hybrid PDF filter. Change-Id: Ibab8c9ccaf97637eebbf9f93b8618d9d5f2fe73d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190274 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 473bdfe17788..73665f295b9c 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -421,6 +421,15 @@ ErrCode SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, std: uno::Sequence< beans::NamedValue > lQuery { { u"Name"_ustr, css::uno::Any(sTypeName) } }; xNewFilter = GetFilterForProps(lQuery, nMust, nDont); + if (xNewFilter && xNewFilter->GetFilterName().endsWith("_pdf_addstream_import") + && aFilterName.endsWith("_pdf_import") + && sTypeName == "pdf_Portable_Document_Format") + { + // pdf_Portable_Document_Format covers two sets of import filters: normal PDF + // (like draw_pdf_import), and hybrid (like calc_pdf_addstream_import). + // Type detection didn't detect hybrid PDF; this new filter can't match + xNewFilter.reset(); + } } if (xNewFilter)