drawinglayer/source/processor2d/vclprocessor2d.cxx | 5 - slideshow/source/engine/slide/slideimpl.cxx | 6 + sw/qa/core/text/data/tdf161990-subscripts.fodt | 44 +++++++++++ sw/qa/core/text/text.cxx | 58 +++++++++++++++ sw/source/core/doc/textboxhelper.cxx | 70 ++++++++++--------- sw/source/uibase/shells/textsh1.cxx | 2 ucb/source/ucp/tdoc/tdoc_datasupplier.cxx | 4 - writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx | 37 ++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 22 ++++- writerfilter/source/dmapper/PropertyMap.cxx | 5 - 10 files changed, 209 insertions(+), 44 deletions(-)
New commits: commit 1e7934d3fd452cf66d178ee5634b2a4e47188a7e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jul 22 12:27:08 2024 +0200 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Tue Jul 23 03:50:58 2024 +0200 crashtesting tdf135164-3.docx ./instdir/program/soffice --headless --convert-to odt ~/Downloads/tdf135164-3.docx fails after commit f98f684d22e6323185104ca9c082241c53dfc2b3 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Sat Jul 13 18:50:34 2024 +0200 remove RecalcObjOrdNums in DoTextBoxZOrderCorrection add a check to catch this case and flatten the method to make it more readable Change-Id: I7827807c77f51b28f16b1042b77b8211ab5416ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170839 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit f08fdf3e81e63469609eaafaf790cb3fea6b27c4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170866 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> (cherry picked from commit 6e05c4ae0daa175f098760dd317e18452cd310ea) diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 9cf8ca06759f..74de839f22bf 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -1513,42 +1513,48 @@ bool SwTextBoxHelper::DoTextBoxZOrderCorrection(SwFrameFormat* pShape, const Sdr pShpObj = pShape->FindRealSdrObject(); - if (pShpObj) + if (!pShpObj) { - auto pTextBox = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj); - if (!pTextBox) - return false; - SdrObject* pFrmObj = pTextBox->FindRealSdrObject(); - if (!pFrmObj) - { - // During loading there is no ready SdrObj for z-ordering, so create and cache it here - pFrmObj - = SwXTextFrame::GetOrCreateSdrObject(*dynamic_cast<SwFlyFrameFormat*>(pTextBox)); - } - if (pFrmObj) - { - // Get the draw model from the doc - SwDrawModel* pDrawModel - = pShape->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); - if (pDrawModel) - { - // Not really sure this will work on all pages, but it seems it will. - // If the shape is behind the frame, is good, but if there are some objects - // between of them that is wrong so put the frame exactly one level higher - // than the shape. - pFrmObj->ensureSortedImmediatelyAfter(*pShpObj); - return true; // Success - } - SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): " - "No Valid Draw model for SdrObject for the shape!"); - } SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): " - "No Valid SdrObject for the frame!"); + "No Valid SdrObject for the shape!"); + return false; } - SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): " - "No Valid SdrObject for the shape!"); - return false; + auto pTextBox = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj); + if (!pTextBox) + return false; + SdrObject* pFrmObj = pTextBox->FindRealSdrObject(); + if (!pFrmObj) + { + // During loading there is no ready SdrObj for z-ordering, so create and cache it here + pFrmObj = SwXTextFrame::GetOrCreateSdrObject(*dynamic_cast<SwFlyFrameFormat*>(pTextBox)); + } + if (!pFrmObj) + { + SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): " + "No Valid SdrObject for the frame!"); + return false; + } + // Get the draw model from the doc + SwDrawModel* pDrawModel = pShape->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); + if (!pDrawModel) + { + SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): " + "No Valid Draw model for SdrObject for the shape!"); + return false; + } + if (!pFrmObj->getParentSdrObjListFromSdrObject()) + { + SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): " + "Frame object is not inserted into any parent"); + return false; + } + // Not really sure this will work on all pages, but it seems it will. + // If the shape is behind the frame, is good, but if there are some objects + // between of them that is wrong so put the frame exactly one level higher + // than the shape. + pFrmObj->ensureSortedImmediatelyAfter(*pShpObj); + return true; // Success } void SwTextBoxHelper::synchronizeGroupTextBoxProperty(bool pFunc(SwFrameFormat*, SdrObject*), commit 44958d385a7594ba8bda021d3b3ac8d3efd75db1 Author: Attila Szűcs <attila.sz...@collabora.com> AuthorDate: Wed Jul 17 10:56:41 2024 +0200 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Tue Jul 23 03:50:12 2024 +0200 SW: fix warning ‘iType’ may be used uninitialized added default value: iType = 0; Change-Id: Ib8e3cde171736c4a7733107a403a64b7753339ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170613 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 14225b4cb745..ed93f3b14a0a 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -2281,7 +2281,7 @@ void SwTextShell::Execute(SfxRequest &rReq) xContentControlText->setString( OStringToOUString(aContent, RTL_TEXTENCODING_UTF8)); - sal_Int32 iType; + sal_Int32 iType = 0; xContentControlProps->getPropertyValue( UNO_NAME_CONTENT_CONTROL_TYPE) >>= iType; commit 92b7b6b5041bce98de761f919bf9bf0e0e960f52 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Jul 10 08:58:41 2024 +0200 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Tue Jul 23 03:48:03 2024 +0200 lok: sd: slideshow render: avoid using nullptr Signed-off-by: Szymon Kłos <szymon.k...@collabora.com> Change-Id: I9368a256185aa336c6cc3ed398ff1d28f6498453 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170267 Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 4ac39cf4ff0f..ea943033a8c3 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -404,6 +404,9 @@ void LOKSlideRenderer::renderMasterPageImpl(VirtualDevice& rDevice) while (!mpMPShapesFunctor->isImportDone()) { ShapeSharedPtr const& rShape(mpMPShapesFunctor->importShape()); + if (!rShape) + continue; + uno::Reference<drawing::XShape> xShape = rShape->getXShape(); if (xShape.is()) { @@ -449,6 +452,9 @@ void LOKSlideRenderer::renderTextFieldsImpl(VirtualDevice& rDevice) while( !mpTFShapesFunctor->isImportDone() ) { ShapeSharedPtr const& rShape(mpTFShapesFunctor->importShape()); + if (!rShape) + continue; + uno::Reference<drawing::XShape> xShape = rShape->getXShape(); if (xShape.is()) { commit 36d1f11e6acc14ccd9bff5a677bcb5abb57e242e Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Jul 13 22:54:05 2024 +0500 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Tue Jul 23 03:44:02 2024 +0200 tdf#161990: take MapMode's origin point into account Regression from commit cc3663bbaed4f65d64154e5f9abb51a5f622f710 (tdf#160702: improve text positioning, 2024-04-20). Change-Id: I03f461d7f03c3e67ccdb8c4376720feb69903d6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170432 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit ccc3996cfcbebe14e9d5f3511906cfc64ddf3452) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170466 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 0b6314e95928..45127a454008 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -426,13 +426,14 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( MapMode aMapMode = mpOutputDevice->GetMapMode(); aMapMode.SetScaleX(aMapMode.GetScaleX() * nFontScalingFixX); aMapMode.SetScaleY(aMapMode.GetScaleY() * nFontScalingFixY); + Point origin = aMapMode.GetOrigin(); mpOutputDevice->Push(vcl::PushFlags::MAPMODE); mpOutputDevice->SetRelativeMapMode(aMapMode); bChangeMapMode = true; - aPointX /= nFontScalingFixX; - aPointY /= nFontScalingFixY; + aPointX = (aPointX + origin.X()) / nFontScalingFixX - origin.X(); + aPointY = (aPointY + origin.Y()) / nFontScalingFixY - origin.Y(); } } diff --git a/sw/qa/core/text/data/tdf161990-subscripts.fodt b/sw/qa/core/text/data/tdf161990-subscripts.fodt new file mode 100644 index 000000000000..c9f172aa6d56 --- /dev/null +++ b/sw/qa/core/text/data/tdf161990-subscripts.fodt @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:font-face-decls> + <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="graphic"> + <style:graphic-properties draw:start-line-spacing-horizontal="2.83mm" draw:start-line-spacing-vertical="2.83mm" draw:end-line-spacing-horizontal="2.83mm" draw:end-line-spacing-vertical="2.83mm" style:writing-mode="lr-tb" style:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:font-independent-line-spacing="false"/> + <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Sans" fo:font-size="12pt" style:letter-kerning="true"/> + </style:default-style> + </office:styles> + <office:automatic-styles> + <style:style style:name="T1" style:family="text"> + <style:text-properties style:text-position="-33% 58%" fo:font-size="11pt"/> + </style:style> + <style:style style:name="gr1" style:family="graphic"> + <style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="left" draw:auto-grow-height="true" draw:auto-grow-width="true" fo:min-height="5mm" fo:min-width="4mm" fo:padding-top="0" fo:padding-bottom="0" fo:padding-left="0" fo:padding-right="0" fo:wrap-option="wrap" draw:shadow="hidden" style:run-through="foreground" style:vertical-pos="top" style:vertical-rel="page-content" style:horizontal-pos="left" style:horizontal-rel="page-content"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="210mm" fo:page-height="297mm" style:print-orientation="portrait" fo:margin-top="20mm" fo:margin-bottom="20mm" fo:margin-left="20mm" fo:margin-right="20mm" style:writing-mode="lr-tb"/> + </style:page-layout> + <style:style style:name="dp1" style:family="drawing-page"/> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/> + </office:master-styles> + <office:body> + <office:text> + <draw:frame text:anchor-type="page" text:anchor-page-number="1" draw:name="Shape_p1" draw:style-name="gr1" svg:width="9.16mm" svg:height="8.4mm" svg:x="0" svg:y="0"> + <draw:text-box> + <text:p>P<text:span text:style-name="T1">1</text:span></text:p> + </draw:text-box> + </draw:frame> + <draw:frame text:anchor-type="page" text:anchor-page-number="6" draw:name="Shape_p6" draw:style-name="gr1" svg:width="9.16mm" svg:height="8.4mm" svg:x="0" svg:y="0"> + <draw:text-box> + <text:p>P<text:span text:style-name="T1">1</text:span></text:p> + </draw:text-box> + </draw:frame> + <text:p/> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index f18c4fd531f8..722ca5ccd1d0 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -1660,6 +1660,64 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf112594) u"\u202F\u1824"_ustr); } +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf161990) +{ + auto pPDFium = vcl::pdf::PDFiumLibrary::get(); + if (!pPDFium) + return; + + // Given a file with two frames, each having a subscript run, on pages 1 and 6: + createSwDoc("tdf161990-subscripts.fodt"); + + // When exporting to PDF: + save(u"writer_pdf_Export"_ustr); + auto pPdfDocument = parsePDFExport(); + + // Check that both subscripts are positioned correctly relative to the non-subscript runs + double expectedOffset = 0; + + // Page 1 + { + auto pPage = pPdfDocument->openPage(0); + auto pTextPage = pPage->getTextPage(); + + CPPUNIT_ASSERT_EQUAL(2, pPage->getObjectCount()); + + auto pObject = pPage->getObject(0); + CPPUNIT_ASSERT_EQUAL(u"P"_ustr, pObject->getText(pTextPage)); + auto textPPos = pObject->getBounds(); + pObject = pPage->getObject(1); + CPPUNIT_ASSERT_EQUAL(u"1"_ustr, pObject->getText(pTextPage)); + auto text1Pos = pObject->getBounds(); + expectedOffset = textPPos.getMaxY() - text1Pos.getMaxY(); + // Without the fix, this would fail with + // - Expected: 7.49 + // - Actual : 7.54150390625 + // But if it fails in some configurations because of different page units, then this + // check is not as important as that this value is the same as on the 6th page below. + CPPUNIT_ASSERT_DOUBLES_EQUAL(7.49, expectedOffset, 0.01); + } + + // Page 6 + { + auto pPage = pPdfDocument->openPage(5); + auto pTextPage = pPage->getTextPage(); + + CPPUNIT_ASSERT_EQUAL(2, pPage->getObjectCount()); + + auto pObject = pPage->getObject(0); + CPPUNIT_ASSERT_EQUAL(u"P"_ustr, pObject->getText(pTextPage)); + auto textPPos = pObject->getBounds(); + pObject = pPage->getObject(1); + CPPUNIT_ASSERT_EQUAL(u"1"_ustr, pObject->getText(pTextPage)); + auto text1Pos = pObject->getBounds(); + // Without the fix, this would fail with + // - Expected: 7.4925537109375 + // - Actual : 20.9005126953125 + CPPUNIT_ASSERT_DOUBLES_EQUAL(expectedOffset, textPPos.getMaxY() - text1Pos.getMaxY(), 0.01); + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 415a3940f7916c6503194eb06bdbe90208bae8cc Author: Justin Luth <jl...@mail.com> AuthorDate: Wed Jul 10 19:26:20 2024 -0400 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Tue Jul 23 03:43:17 2024 +0200 tdf#160139 sw RTF paste: don't empty headers/footers Regression from quikee's 24.2 commit 4b0fa253a4540f5461397815d290586f9ddabe61 tdf#136472 adjust ooxml import to handle first header/footer RTF paste is particularly nasty because it calls CloseSectionGroup, which is rather strange for just pasting some characters... Fix the problem by leaving the paste alone: we already omit a number of actions in this case, and was similarly done initially by quikee in copyHeaderFooter. setHeaderFooterProperties() was newly added by quikee, so relatively safe to start avoiding on paste. make CppunitTest_sw_writerfilter_dmapper \ CPPUNIT_TEST_NAME=testPasteHeaderEmptied Change-Id: Iad997481a75bb971f9e71373175134cbec9aa7d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170328 Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> Tested-by: Jenkins (cherry picked from commit aaf93cd9629acd476284a4933a656ddd188a80aa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170349 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170386 Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx b/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx index 2952f1f93302..e06ee5236e0d 100644 --- a/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx +++ b/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx @@ -175,6 +175,43 @@ CPPUNIT_TEST_FIXTURE(Test, testPasteHeaderDisable) // Then make sure the header stays on: CPPUNIT_ASSERT(xStyle->getPropertyValue("HeaderIsOn").get<bool>()); } + +CPPUNIT_TEST_FIXTURE(Test, testPasteHeaderEmptied) +{ + // Given an empty document with a turned on footer with content: + loadFromFile(u"page-break-footer-table.docx"); + uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies + = xStyleFamiliesSupplier->getStyleFamilies(); + uno::Reference<container::XNameAccess> xStyleFamily( + xStyleFamilies->getByName(u"PageStyles"_ustr), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName(u"Standard"_ustr), + uno::UNO_QUERY); + + // When pasting RTF content: + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText = xTextDocument->getText(); + uno::Reference<text::XTextRange> xBodyEnd = xText->getEnd(); + uno::Reference<document::XFilter> xFilter( + m_xSFactory->createInstance(u"com.sun.star.comp.Writer.RtfFilter"_ustr), uno::UNO_QUERY); + uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY); + xImporter->setTargetDocument(mxComponent); + std::unique_ptr<SvStream> pStream(new SvMemoryStream); + pStream->WriteOString("{\rtf1 paste}"); + pStream->Seek(0); + uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(std::move(pStream))); + uno::Sequence aDescriptor{ comphelper::makePropertyValue(u"InputStream"_ustr, xStream), + comphelper::makePropertyValue(u"InsertMode"_ustr, true), + comphelper::makePropertyValue(u"TextInsertModeRange"_ustr, + xBodyEnd) }; + CPPUNIT_ASSERT(xFilter->filter(aDescriptor)); + + // Then make sure the header retains its contents: + uno::Reference<text::XTextRange> xFooterText(xStyle->getPropertyValue(u"FooterText"_ustr), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(u"Odd page footer"_ustr, xFooterText->getString()); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index d3263ac5ba55..62707f2c4d10 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -520,7 +520,8 @@ void SectionPropertyMap::removeXTextContent(uno::Reference<text::XText> const& r */ void SectionPropertyMap::setHeaderFooterProperties(DomainMapper_Impl& rDM_Impl) { - if (!m_aPageStyle.is()) + // do not alter header/footer during copy/paste + if (!m_aPageStyle.is() || !rDM_Impl.IsNewDoc()) return; bool bHasHeader = false; @@ -583,7 +584,7 @@ void SectionPropertyMap::setHeaderFooterProperties(DomainMapper_Impl& rDM_Impl) m_aPageStyle->setPropertyValue(sFirstIsShared, uno::Any(!m_bTitlePage)); bool bHadFirstHeader = m_bHadFirstHeader && m_bTitlePage; - if (bHasHeader && !bHadFirstHeader && !m_bHadLeftHeader && !m_bHadRightHeader && rDM_Impl.IsNewDoc()) + if (bHasHeader && !bHadFirstHeader && !m_bHadLeftHeader && !m_bHadRightHeader) { m_aPageStyle->setPropertyValue(sHeaderIsOn, uno::Any(false)); } commit ce6e7a19d30f8b7dd67f0d0b1ee646ec503c2184 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Jul 10 11:14:38 2024 +0100 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Tue Jul 23 03:41:38 2024 +0200 cid#1608592 Double lock since: commit 9301f4d486b13dac2a66b797d5e24eb6dc9f7582 Date: Thu Feb 16 14:31:25 2023 +0200 osl::Mutex->std::mutex in ResultSetDataSupplier Change-Id: I6be50541e00f8f8de3bdebe1690e14e805bee14e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170281 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 3374417097edcee8c8951fd1df6044e2d24b74a6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170293 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx b/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx index 9930f80d6e3c..272349bd6e46 100644 --- a/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx +++ b/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx @@ -77,7 +77,7 @@ ResultSetDataSupplier::queryContentIdentifierString( sal_uInt32 nIndex ) } OUString -ResultSetDataSupplier::queryContentIdentifierStringImpl( std::unique_lock<std::mutex>& /*rGuard*/, sal_uInt32 nIndex ) +ResultSetDataSupplier::queryContentIdentifierStringImpl( std::unique_lock<std::mutex>& rGuard, sal_uInt32 nIndex ) { if ( nIndex < m_aResults.size() ) { @@ -89,7 +89,7 @@ ResultSetDataSupplier::queryContentIdentifierStringImpl( std::unique_lock<std::m } } - if ( getResult( nIndex ) ) + if ( getResultImpl(rGuard, nIndex) ) { // Note: getResult fills m_pImpl->m_aResults[ nIndex ]->aURL. return m_aResults[ nIndex ].aURL; commit 70e766efb596c8c036895214da3114b8982d0447 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Jul 9 21:38:05 2024 +0200 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Tue Jul 23 03:41:25 2024 +0200 Revert "tdf#158556 speedup docx load" This reverts commit ab29c857c669bcca3d8eea8a5a9e6ad5eae622d7. As jluth points out, my logic here is wrong. Change-Id: I8887526a0a96070ad615aa07ef0e77e36214d0d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170252 Reviewed-by: Justin Luth <jl...@mail.com> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins (cherry picked from commit 6f96e7720f765d4e5e8fdef6a2a2b8cbb75c81ef) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170268 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 232ef0f98651..9e585dd6c606 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3795,14 +3795,26 @@ void DomainMapper_Impl::ConvertHeaderFooterToTextFrame(bool bDynamicHeightTop, b namespace { // Determines if the XText content is empty (no text, no shapes, no tables) -bool isContentEmpty(uno::Reference<text::XText> const& xText) +bool isContentEmpty(uno::Reference<text::XText> const& xText, uno::Reference<text::XTextDocument> const& xTextDocument) { if (!xText.is()) return true; // no XText means it's empty - uno::Reference<css::lang::XServiceInfo> xTextServiceInfo(xText, uno::UNO_QUERY); - if (xTextServiceInfo && xTextServiceInfo->getImplementationName() == "SwXHeadFootText") - return false; + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xTextDocument, uno::UNO_QUERY); + auto xDrawPage = xDrawPageSupplier->getDrawPage(); + if (xDrawPage && xDrawPage->hasElements()) + { + for (sal_Int32 i = 0; i < xDrawPage->getCount(); ++i) + { + uno::Reference<text::XTextContent> xShape(xDrawPage->getByIndex(i), uno::UNO_QUERY); + if (xShape.is()) + { + uno::Reference<text::XTextRange> xAnchor = xShape->getAnchor(); + if (xAnchor.is() && xAnchor->getText() == xText) + return false; + } + } + } uno::Reference<container::XEnumerationAccess> xEnumAccess(xText->getText(), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xEnum = xEnumAccess->createEnumeration(); @@ -3961,7 +3973,7 @@ void DomainMapper_Impl::checkIfHeaderFooterIsEmpty(PagePartType ePagePartType, P if (!xPageStyle.is()) return; - bool bEmpty = isContentEmpty(m_aTextAppendStack.top().xTextAppend); + bool bEmpty = isContentEmpty(m_aTextAppendStack.top().xTextAppend, GetTextDocument()); if (eType == PageType::FIRST && bEmpty) {