core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/piccrop.rtf| 74 + sw/qa/extras/rtfexport/rtfexport8.cxx | 25 writerfilter/source/dmapper/GraphicImport.cxx | 12 +++- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 10 +++ writerfilter/source/rtftok/rtfvalue.cxx|9 +++ writerfilter/source/rtftok/rtfvalue.hxx|6 ++ 6 files changed, 134 insertions(+), 2 deletions(-) New commits: commit 5bce41f82a487c12f11ecad37cad02c93a14c1cb Author: Michael Stahl AuthorDate: Tue Feb 13 14:45:25 2024 +0100 Commit: Thorsten Behrens CommitDate: Mon Feb 19 11:39:47 2024 +0100 tdf#155663 writerfilter: RTF import: don't lose \piccrop* For DOCX the a:srcRect is imported in oox module in BlipFillContext and set on the XShape; obviously that doesn't work for RTF. The crop was already taken into account in RTFDocumentImpl::resolvePict(), but only to set the size of the picture; to actually set a crop effect, set shape's "GraphicsCrop" property in dmapper::GraphicImport::lcl_attribute(). Change-Id: Ib12853724744542a09b0073fefc42ad32bb2ff19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163310 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 47f50af3f057bac1739b7d17d781c0b1d05faa95) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163331 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/rtfexport/data/piccrop.rtf b/sw/qa/extras/rtfexport/data/piccrop.rtf new file mode 100644 index ..4e8a70420575 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/piccrop.rtf @@ -0,0 +1,74 @@ +{ tf1deflang1025nsinsicpg1252\uc1deff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1028 hemelang1033hemelangfe1028 hemelangcs1025{onttbl{1bidi swiss charset0prq2{\*\panose 020b0604020202020204}Arial{\*alt Arial};} +{14bidi nilcharset136prq2{\*\panose 02010601000101010101}PMingLiU{\*alt Arial Unicode MS};}{34bidi romancharset0prq2{\*\panose 02040503050406030204}Cambria Math;} +{37bidi swisscharset0prq2{\*\panose 020f0502020204030204}Calibri;}{291 bidi nilcharset136prq2{\*\panose }@PMingLiU;} +{lomajor31500bidi romancharset0prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Arial};}{dbmajor31501bidi nilcharset136prq2{\*\panose 02010601000101010101}PMingLiU{\*alt Arial Unicode MS};} +{himajor31502bidi swisscharset0prq2{\*\panose 020f0302020204030204}Calibri Light;}{bimajor31503bidi romancharset0 prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Arial};} +{lominor31504bidi romancharset0prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Arial};}{dbminor31505bidi nilcharset136prq2{\*\panose 02010601000101010101}PMingLiU{\*alt Arial Unicode MS};} +{himinor31506bidi swisscharset0prq2{\*\panose 020f0502020204030204}Calibri;}{biminor31507bidi swisscharset0 prq2{\*\panose 020b0604020202020204}Arial{\*alt Arial};}{302bidi swiss charset238prq2 Arial CE{\*alt Arial};} +{303bidi swisscharset204prq2 Arial Cyr{\*alt Arial};}{305bidi swiss charset161prq2 Arial Greek{\*alt Arial};}{306bidi swisscharset162prq2 Arial Tur{\*alt Arial};} +{307bidi swisscharset177prq2 Arial (Hebrew){\*alt Arial};}{308bidi swisscharset178prq2 Arial (Arabic){\*alt Arial};}{309bidi swiss charset186prq2 Arial Baltic{\*alt Arial};} +{310bidi swisscharset163prq2 Arial (Vietnamese){\*alt Arial};}{632bidi romancharset238prq2 Cambria Math CE;}{633bidi romancharset204prq2 Cambria Math Cyr;}{635bidi romancharset161prq2 Cambria Math Greek;} +{636bidi romancharset162prq2 Cambria Math Tur;}{639bidi roman charset186prq2 Cambria Math Baltic;}{640bidi romancharset163prq2 Cambria Math (Vietnamese);}{662bidi swisscharset238prq2 Calibri CE;} +{663bidi swisscharset204prq2 Calibri Cyr;}{665bidi swisscharset161 prq2 Calibri Greek;}{666bidi swisscharset162prq2 Calibri Tur;}{667bidi swisscharset177prq2 Calibri (Hebrew);} +{668bidi swisscharset178prq2 Calibri (Arabic);}{669bidi swiss charset186prq2 Calibri Baltic;}{670bidi swisscharset163prq2 Calibri (Vietnamese);} +{lomajor31508bidi romancharset238prq2 Times New Roman CE{\*alt Arial};}{lomajor31509bidi romancharset204prq2 Times New Roman Cyr{\*alt Arial};} +{lomajor31511bidi romancharset161prq2 Times New Roman Greek{\*alt Arial};}{lomajor31512bidi romancharset162prq2 Times New Roman Tur{\*alt Arial};} +{lomajor31513bidi romancharset177prq2 Times New Roman (Hebrew){\*alt Arial};}{lomajor31514bidi romancharset178prq2 Times New Roman (Arabic){\* alt Arial};} +{lomajor31515bidi romancharset186prq2 Times New Roman Baltic{\*alt Arial};}{lomajor31516bidi romancharset163prq2 Times New Roman (Vietnamese){\*alt Arial
core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf | 23 ++ sw/qa/extras/rtfexport/rtfexport8.cxx | 14 + writerfilter/source/rtftok/rtfdispatchflag.cxx|4 ++- 3 files changed, 40 insertions(+), 1 deletion(-) New commits: commit f2ebcfc09a9d2bac9792b0215f5d97bd990ffcef Author: Justin Luth AuthorDate: Wed Dec 27 18:58:33 2023 -0500 Commit: Xisco Fauli CommitDate: Mon Feb 12 17:35:28 2024 +0100 tdf#158826 rtfimport: ignore page break before document starts This avoids a 24.2 exposed bug from my commit 016f779ee6c7f601be3ae19dc57497e63a5bf817 RTF import simply cannot be relied upon to create paragraphs where they need to be. A side effect of fixing frames is that spurious paragraphs can be created, and if a frame starts the document, then an otherwise ignored page break can be attached to the second paragraph and thus become exposed. This seems pretty much like the RTF implementation of what was done for DOC and DOCX for tdf#118711. At least it is related. make CppunitTest_sw_rtfexport8 CPPUNIT_TEST_NAME=testTdf158826_extraCR The following unit tests trigger this code (with no visible change) abi10076.odt tdf121623.rtf tdf129513.rtf tdf131963.docx Change-Id: I21afa826b6f6fbb735591603a0620b8b47de517e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161374 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161395 (cherry picked from commit 8d37b8e6430715860934ccaec8c0d1b448ac4d8c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163188 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf b/sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf new file mode 100644 index ..5461327da3ca --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf @@ -0,0 +1,23 @@ +{ tf1 +\landscape\paperh5953\paperw8391\margl720\margr720\margt432\margb1728\gutter0\ltrsect + + +\pagebb +\intbl +\pvpg\phpg + +\posx720\posy432 +\dxfrtext187\dfrmtxtx187\dfrmtxty0 +\wraparoundspalphaspnum +aautodjustright + in0\lin0bsnoovrlp1\pararsid5332093\yts39 + + +\shp + + +a +++ +} diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx index 97968caba437..0f01f4f36193 100644 --- a/sw/qa/extras/rtfexport/rtfexport8.cxx +++ b/sw/qa/extras/rtfexport/rtfexport8.cxx @@ -36,6 +36,8 @@ using namespace css; +namespace +{ class Test : public SwModelTestBase { public: @@ -141,6 +143,18 @@ DECLARE_RTFEXPORT_TEST(testAnnotationPar, "tdf136445-1-min.rtf") .isEmpty()); } +DECLARE_RTFEXPORT_TEST(testTdf158826_extraCR, "tdf158826_extraCR.rtf") +{ +// Note: this is a hand-minimized sample, and very likely doesn't follow RTF { } rules... + +// The page break defined before the document content should not cause a page break +CPPUNIT_ASSERT_EQUAL(1, getPages()); + +// There is a two-column floating table +uno::Reference xTable(getParagraphOrTable(1), uno::UNO_QUERY_THROW); +} + +} // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index 23d8f5d1f59f..49e82d3b9a88 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -520,7 +520,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } break; case RTFKeyword::PAGEBB: -nParam = NS_ooxml::LN_CT_PPrBase_pageBreakBefore; +// ignore a page break that is defined before the document content has even started +if (!m_bFirstRun) +nParam = NS_ooxml::LN_CT_PPrBase_pageBreakBefore; break; default: break;
core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/tdf158586_pageBreak1_header.rtf | 17 + sw/qa/extras/rtfexport/rtfexport8.cxx | 13 + writerfilter/source/dmapper/DomainMapper.cxx|9 - writerfilter/source/dmapper/DomainMapper_Impl.cxx | 105 +--- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 41 ++-- writerfilter/source/dmapper/SdtHelper.cxx |2 6 files changed, 105 insertions(+), 82 deletions(-) New commits: commit ae3f45e39b59583a60a751dcb54889f1ee28197b Author: Michael Stahl AuthorDate: Wed Jan 31 14:33:46 2024 +0100 Commit: Christian Lohmaier CommitDate: Thu Feb 1 12:43:49 2024 +0100 tdf#158586 writerfilter: RTF import: fix \page \sect \skbnone w/ header The problem was not fixed yet for the less-minimized bugzilla attachment where the sections contain headers and footers. What happened there is that first \page caused a deferred page break, then \sect and sectBreak() delayed-read the header substream and the \par in the header resets all the deferred break flags. Add the deferred break to an already existing Context class, and remove the direct members in DomainMapper_Impl in favor of always using the m_StreamStateStack. Probably this problem cannot occur for DOCX import, because it imports header/footer eagerly where the reference element is, and sectPr is before any runs that contain breaks in the same paragraph element. Change-Id: Iba971955e9cf0c398d416518e72d99307d3e1cfd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162833 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 17e2c7226a73675d69febf0915aaeae61ad8e9f1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162848 Reviewed-by: Christian Lohmaier diff --git a/sw/qa/extras/rtfexport/data/tdf158586_pageBreak1_header.rtf b/sw/qa/extras/rtfexport/data/tdf158586_pageBreak1_header.rtf new file mode 100644 index ..cd8eefabb276 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf158586_pageBreak1_header.rtf @@ -0,0 +1,17 @@ +{ tf1 + +\paperw8419\paperh5953 + +\spltpgpar + +\ltrpar \sectd + +{\headerl \pard\plain \par} + +\pard\plain \wrapdefault\pvmrg\posxlbsw0bsh0\phcol \posyilbslock\dxfrtext10 + +\page \sect \sectd \sbknone + +\pard\plain Second page +\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx index 70dd0974c616..d0b2ed0f2c2e 100644 --- a/sw/qa/extras/rtfexport/rtfexport8.cxx +++ b/sw/qa/extras/rtfexport/rtfexport8.cxx @@ -82,6 +82,19 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_1, "tdf158586_pageBreak1.rtf") assertXPathContent(pLayout, "/root/page[2]/body//txt", "Second page"); } +DECLARE_RTFEXPORT_TEST(testTdf158586_1header, "tdf158586_pageBreak1_header.rtf") +{ +// None of the specified text frame settings initiates a real text frame - page break not lost +CPPUNIT_ASSERT_EQUAL(2, getPages()); +CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); + +// There should be no empty carriage return at the start of the second page +const auto& pLayout = parseLayoutDump(); +// on import there is a section on page 2; on reimport there is no section +// (probably not an important difference?) +assertXPathContent(pLayout, "/root/page[2]/body//txt", "Second page"); +} + DECLARE_RTFEXPORT_TEST(testTdf158586_lostFrame, "tdf158586_lostFrame.rtf") { // The anchor and align properties are sufficient to define a frame diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 4ca1900ee173..c4001cf0fe61 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3257,7 +3257,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) * section is a table. So in case first element is a table add a dummy para * and remove it again when lcl_endSectionGroup is called */ -if(m_pImpl->m_nTableDepth == 0 && m_pImpl->GetIsFirstParagraphInSection() +if (m_pImpl->m_StreamStateStack.top().nTableDepth == 0 +&& m_pImpl->GetIsFirstParagraphInSection() && !m_pImpl->GetIsDummyParaAddedForTableInSection() && !m_pImpl->GetIsTextFrameInserted() && !m_pImpl->GetIsPreviousParagraphFramed() && !IsInHeaderFooter()) { @@ -3265,7 +3266,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) } // if first paragraph style in table has break-before-page, transfer that setting to the table itself. -if( m_pImpl->m_nTableDepth == 0 ) +if (m_pImpl->m_StreamStateStack.top().nTableDepth == 0) { const uno::Any aBreakType(style::BreakType_PAGE_BEFORE); const PropertyMapPtr pParagraphProps = m_pImpl->GetTopContextOfType(CONTEXT_PARAGR
core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/tdf158586_lostFrame.rtf | 17 + sw/qa/extras/rtfexport/rtfexport8.cxx | 11 +++ writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 ++ 3 files changed, 30 insertions(+) New commits: commit a13187055aab91cdbd0fffe309124c2a06a81032 Author: Justin Luth AuthorDate: Wed Dec 13 20:25:53 2023 -0500 Commit: Xisco Fauli CommitDate: Wed Dec 20 11:04:27 2023 +0100 partial revert tdf#153178 writerfilter: do not create text frame spuriously2 If HoriAlign/VertAlign are defined, that is enough to create a frame. This fixes mstahl's 7.6.4 regression originating with commit 4e2f2489c4c7436f8b3a21a530bc625cbef4e365 make CppunitTest_sw_rtfexport8 CPPUNIT_TEST_NAME=testTdf158586_lostFrame Change-Id: Ibb639673cebcd8d5ec79f5551a5703caf948e0d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160744 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Miklos Vajna Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160982 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161000 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/rtfexport/data/tdf158586_lostFrame.rtf b/sw/qa/extras/rtfexport/data/tdf158586_lostFrame.rtf new file mode 100644 index ..cedfd81a1dd8 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf158586_lostFrame.rtf @@ -0,0 +1,17 @@ +{ tf1 + +\paperw8419\paperh5953 + +\spltpgpar + +\ltrpar \sectd + +\pard\plain \posxc\posyc First page textbox \par +\pard 1st page + + +\page \sect \sectd \sbknone + +\pard\plain 2nd page +\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx index bcba0a9beb97..71c727e1511c 100644 --- a/sw/qa/extras/rtfexport/rtfexport8.cxx +++ b/sw/qa/extras/rtfexport/rtfexport8.cxx @@ -73,6 +73,17 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_1, "tdf158586_pageBreak1.rtf") // assertXPathContent(pLayout, "//page[2]/body/txt"_ostr, "Second page"); } +DECLARE_RTFEXPORT_TEST(testTdf158586_lostFrame, "tdf158586_lostFrame.rtf") +{ +// The anchor and align properties are sufficient to define a frame +const auto& pLayout = parseLayoutDump(); +assertXPath(pLayout, "//anchored", 1); +assertXPathContent(pLayout, "//page[1]/body//txt", "1st page"); +// assertXPathContent(pLayout, "//page[2]/body//txt"_ostr, "2nd page"); + +// CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 089016934a0d..d196993f9c60 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -4010,7 +4010,9 @@ bool RTFFrame::hasProperties() const { // tdf#153178 \dxfrtext \dfrmtxtx \dfrmtxty \wrapdefault do *not* create frame return m_nX != 0 || m_nY != 0 || m_nW != 0 || m_nH != 0 + || (m_nHoriAlign && m_nHoriAlign != NS_ooxml::LN_Value_doc_ST_XAlign_left) || (m_nHoriAnchor && m_nHoriAnchor != NS_ooxml::LN_Value_doc_ST_HAnchor_text) + || (m_nVertAlign && m_nVertAlign != NS_ooxml::LN_Value_doc_ST_YAlign_inline) || (m_nVertAnchor && m_nVertAnchor != NS_ooxml::LN_Value_doc_ST_VAnchor_margin) || (m_oWrap && *m_oWrap != NS_ooxml::LN_Value_doc_ST_Wrap_auto); }
core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/tdf158586_pageBreak0B.rtf | 15 +++ sw/qa/extras/rtfexport/rtfexport8.cxx |6 ++ writerfilter/source/rtftok/rtfdocumentimpl.cxx|2 ++ 3 files changed, 23 insertions(+) New commits: commit 9d1438cd46ab947d1e6276cefa29444dace09f8a Author: Justin Luth AuthorDate: Wed Dec 13 20:07:20 2023 -0500 Commit: Miklos Vajna CommitDate: Wed Dec 20 08:29:41 2023 +0100 partial revert tdf#153178 writerfilter: do not create text frame spuriously If HoriAnchor/VertAnchor are assigned, that is enough to create a frame. make CppunitTest_sw_rtfexport8 CPPUNIT_TEST_NAME=testTdf158586_0B Note: because of a regression, this was already one page before this commit, so need to go back to the time of the reverted patch. Change-Id: Iddbe1cc4ba6d6e95e2d977a227ae6cab5271007e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160743 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Miklos Vajna Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160981 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160999 diff --git a/sw/qa/extras/rtfexport/data/tdf158586_pageBreak0B.rtf b/sw/qa/extras/rtfexport/data/tdf158586_pageBreak0B.rtf new file mode 100644 index ..587e90500505 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf158586_pageBreak0B.rtf @@ -0,0 +1,15 @@ +{ tf1 + +\paperw8419\paperh5953 + +\spltpgpar + +\ltrpar \sectd + +\pard\plain \phpg\pvpg + +\page \sect \sectd \sbknone + +\pard\plain First page +\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx index 80309ff9b65e..bcba0a9beb97 100644 --- a/sw/qa/extras/rtfexport/rtfexport8.cxx +++ b/sw/qa/extras/rtfexport/rtfexport8.cxx @@ -56,6 +56,12 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_0, "tdf158586_pageBreak0.rtf") // assertXPathContent(pLayout, "//page[1]/body/txt"_ostr, "First page");} } +DECLARE_RTFEXPORT_TEST(testTdf158586_0B, "tdf158586_pageBreak0B.rtf") +{ +// The specified page break must be lost because it is in a text frame +CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + DECLARE_RTFEXPORT_TEST(testTdf158586_1, "tdf158586_pageBreak1.rtf") { // None of the specified text frame settings initiates a real text frame - page break not lost diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 36f71beded73..089016934a0d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -4010,6 +4010,8 @@ bool RTFFrame::hasProperties() const { // tdf#153178 \dxfrtext \dfrmtxtx \dfrmtxty \wrapdefault do *not* create frame return m_nX != 0 || m_nY != 0 || m_nW != 0 || m_nH != 0 + || (m_nHoriAnchor && m_nHoriAnchor != NS_ooxml::LN_Value_doc_ST_HAnchor_text) + || (m_nVertAnchor && m_nVertAnchor != NS_ooxml::LN_Value_doc_ST_VAnchor_margin) || (m_oWrap && *m_oWrap != NS_ooxml::LN_Value_doc_ST_Wrap_auto); }
core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
dev/null |binary sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport18.cxx| 20 +++--- writerfilter/source/dmapper/DomainMapper.cxx | 16 4 files changed, 14 insertions(+), 22 deletions(-) New commits: commit 773029159caf0164885015f6193774cebe898b9c Author: Justin Luth AuthorDate: Wed Dec 13 16:09:52 2023 -0500 Commit: Xisco Fauli CommitDate: Thu Dec 14 09:40:31 2023 +0100 tdf#158681 Revert "tdf#153613 writerfilter: don't always split para ... for shape w/ pagebreak" This reverts my 7.6 commit a9bc19c2d4a35606668aa2dcc53355651b71ee78. The commit in general is probably fine. However, it fails in case of an empty paragraph (with only anchors). Unfortunately, there is no way of knowing ahead of time, so either everything needs to be processed after a delay, or else the paragraph needs to be split and then re-joined in case it is not an empty paragraph. Both options are extremely non-trivial - I don't know how to do either of them. In this case it is also the last paragraph in the document, again something not known during import and which has special-casing in MSO. make CppunitTest_sw_ooxmlexport18 \ CPPUNIT_TEST_NAME=testTdf153613_textboxAfterPgBreak3 Change-Id: I4471e216b6523032b85178d85795434694cc1e22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160720 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit d58cd70f550e8967c2518ebb2179e15f5a3a84ea) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160695 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160746 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak.docx b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak.docx deleted file mode 100644 index 4ad4dfba8110.. Binary files a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak.docx and /dev/null differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak2.docx b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak2.docx deleted file mode 100644 index 26006abd2fe3.. Binary files a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak2.docx and /dev/null differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx new file mode 100644 index ..29c63ad71ed3 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 04c5789c19c6..30ac5e2ca11c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -355,26 +355,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153613_inlineAfterPgBreak2, "tdf153613_inlineAft assertXPath(pLayout, "//page[2]//anchored", 1); } -DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak, "tdf153613_textboxAfterPgBreak.docx") +DECLARE_OOXMLEXPORT_TEST(testTdf153613_sdtAfterPgBreak, "tdf153613_sdtAfterPgBreak.docx") { -CPPUNIT_ASSERT_EQUAL(3, getParagraphs()); - -const auto& pLayout = parseLayoutDump(); -assertXPathContent(pLayout, "//page[2]/body/txt", "There should be no prior carriage return."); +CPPUNIT_ASSERT_EQUAL(2, getPages()); } -DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak2, "tdf153613_textboxAfterPgBreak2.docx") +DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak3, "tdf153613_textboxAfterPgBreak3.docx") { -// same as previous example, except that it is the first paragraph in the section. -CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); +// both textboxes are on the second (last) page +CPPUNIT_ASSERT_EQUAL(2, getPages()); const auto& pLayout = parseLayoutDump(); -assertXPathContent(pLayout, "//page[2]/body/txt", "There should be no prior carriage return."); -} - -DECLARE_OOXMLEXPORT_TEST(testTdf153613_sdtAfterPgBreak, "tdf153613_sdtAfterPgBreak.docx") -{ -CPPUNIT_ASSERT_EQUAL(2, getPages()); +assertXPath(pLayout, "//page[2]/body/txt/anchored/fly", 2); } DECLARE_OOXMLEXPORT_TEST(testTdf153964_topMarginAfterBreak14, "tdf153964_topMarginAfterBreak14.docx") diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 2d23452c6261..4ca1900ee173 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3745,14 +3745,14 @@ void DomainMapper::lcl_startShape(uno::Reference const& xShape) // started shape will be on the correct page. if (m_pImpl->isBreakDeferred(PAGE_BREAK)) { -
core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat.rtf | 34 ++ sw/qa/extras/rtfexport/rtfexport6.cxx | 14 + writerfilter/source/dmapper/DomainMapper_Impl.cxx | 11 3 files changed, 58 insertions(+), 1 deletion(-) New commits: commit c1ac4185afc496e0af18175a6ad31c14fe43ebb3 Author: Justin Luth AuthorDate: Fri Dec 1 10:34:36 2023 -0500 Commit: Thorsten Behrens CommitDate: Wed Dec 13 00:24:36 2023 +0100 tdf#108505 writerfilter: fix legacy dropdown fields direct bold setting Any character property should be passed on, but do that in a follow-up commit, so that at least the bold case will remain intact if the broader fix gets reverted for any reason. make CppunitTest_sw_rtfexport6 \ CPPUNIT_TEST_NAME=testTdf108505_fieldCharFormat Change-Id: Id77980b704db2ff118e89c29eb9d4db82e117cdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160221 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160626 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat.rtf b/sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat.rtf new file mode 100644 index ..b05c2deec6b6 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat.rtf @@ -0,0 +1,34 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang2057\deflangfe2057\themelang3079\themelangfe0\themelangcs0 + +\noqfpromote {\stylesheet{\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 +\af0\afs20\alang1025 \ltrch\fcs0 \fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079 \snext0 \sqformat \spriority0 Normal;}{\s17\ql \li0\ri0\widctlpar +\tqc\tx4819\tqr\tx9071\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079 \sbasedon0 \snext17 \slink18 header;} +} +\paperw16834\paperh11913\margl1134\margr1418\margt1418\margb567\gutter0\ltrsect +\deftab708\widowctrl\ftnbj\aenddoc\hyphhotz425\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0 +\showxmlerrors1\noextrasprl\prcolbl\cvmme\sprsspbf\brkfrm\swpbdr\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\lytprtmet\hyphcaps0\formshade\horzdoc\fracwidth\dghspace180\dgvspace180\dghorigin1701\dgvorigin1984\dghshow0\dgvshow0 +\jexpand\viewkind1\viewscale70\pgbrdrhead\pgbrdrfoot\nolnhtadjtbl\nojkernpunct\rsidroot3825670 \fet0 + +\ltrrow\trowd \irow0\irowband0\lastrow \ltrrow +\ts11\trgaph70\trleft-70\trkeep\trftsWidth3\trwWidth8931\trftsWidthB3\trftsWidthA3\trpaddl70\trpaddr70\trpaddfl3\trpaddfr3\tblrsid16408416\tblind0\tblindtype3 \clvertalc\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl +\cltxlrtb\clftsWidth3\clwWidth1276\clshdrawnil \cellx1206\clvertalc\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrs\brdrw30 \cltxlrtb\clftsWidth3\clwWidth3969\clshdrawnil \cellx5175\clvertalt\clbrdrt\brdrs\brdrw30 \clbrdrl\brdrs\brdrw30 +\clbrdrb\brdrs\brdrw30 \clbrdrr\brdrs\brdrw30 \cltxlrtb\clftsWidth3\clwWidth2126\clshdrawnil \cellx7301\clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrs\brdrw30 \clbrdrb\brdrtbl \clbrdrr\brdrs\brdrw30 \cltxlrtb\clftsWidth3\clwWidth1560\clshdrawnil \cellx8861 +\pard\plain \ltrpar\s17\ql \li72\ri0\sb120\sa120\widctlpar\intbl\tqr\tx1561\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin72\pararsid8918882 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079 + +{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f5\fnil\fprq2\fcharset128 Linux Biolinum Keyboard O;}} + +{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;} + +{\rtlch\fcs1 \af0 \ltrch\fcs0 \f5\fs32\chcbpat7\insrsid16408416 Header}{\rtlch\fcs1 \af0 \ltrch\fcs0 \fs32\insrsid16408416\charrsid8918882 \cell }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid5246913 +\rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid16408416\charrsid8918882 Normal\cell }\pard \ltrpar +\qc \li0\ri0\sb120\sa120\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid5701682\charrsid5701682 {\*\bkmkstart Dropdown1}x}{\field\fldpriv{\*\fldinst {\ltrc
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/section-pagebreak.rtf | 15 ++ sw/qa/extras/rtfimport/rtfimport.cxx | 48 ++ writerfilter/source/dmapper/DomainMapper.cxx |1 writerfilter/source/rtftok/rtfdocumentimpl.cxx|4 + 4 files changed, 68 insertions(+) New commits: commit bcbc024757b569e1c8999ac4f897bd7f0ee8781b Author: Michael Stahl AuthorDate: Wed Nov 15 18:24:50 2023 +0100 Commit: Xisco Fauli CommitDate: Thu Nov 30 10:21:30 2023 +0100 tdf#153194 writerfilter: RTF import: testContSectionPageBreak last para For testContSectionPageBreak, Word inserts an additional empty paragraph at the end of the document that was missing in Writer. Ensure markLastSectionGroup() is always called at the end of the document so that the \par that is dispatched in m_bNeedPar case will be inserted and not automatically removed immediately. Also add a test for the same document without \sbknone, which has 4 pages instead of 2. Change-Id: Ib3e4fbdb66df55941e4a487d4b249cd98fe42008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159472 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 454e5010aec9953f586fe8af671765358f6cafc4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159531 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/rtfimport/data/section-pagebreak.rtf b/sw/qa/extras/rtfimport/data/section-pagebreak.rtf new file mode 100644 index ..077cd71e5d48 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/section-pagebreak.rtf @@ -0,0 +1,15 @@ +{\rtf1 \ansi +\fet0 \ftnbj \paperw11905 \paperh16837 \margt2267 \margb1133 \margl1417 \margr1417 + +\sectd +FIRST +\par +\sect +SECOND +\par +\page +\sect +THIRD +\par +\sect +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index be75cee76577..203bce99df23 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -881,10 +881,58 @@ CPPUNIT_TEST_FIXTURE(Test, testContSectionPageBreak) CPPUNIT_ASSERT_EQUAL(uno::Any(), uno::Reference(xParaThird, uno::UNO_QUERY_THROW) ->getPropertyValue("PageDescName")); +// there is an empty paragraph after THIRD +uno::Reference xParaLast = getParagraph(5); +CPPUNIT_ASSERT_EQUAL(OUString(), xParaLast->getString()); +try +{ +getParagraph(6); +} +catch (container::NoSuchElementException const&) +{ +// does not exist - expected +} CPPUNIT_ASSERT_EQUAL(2, getPages()); } +CPPUNIT_TEST_FIXTURE(Test, testSectionPageBreak) +{ +createSwDoc("section-pagebreak.rtf"); +uno::Reference xParaSecond = getParagraph(2); +CPPUNIT_ASSERT_EQUAL(OUString("SECOND"), xParaSecond->getString()); +CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, + getProperty(xParaSecond, "BreakType")); +CPPUNIT_ASSERT(uno::Any() != getProperty(xParaSecond, "PageDescName")); +// actually not sure how many paragraph there should be between +// SECOND and THIRD - important is that the page break is on there +// (could be either 1 or 2; in Word it's a 2-line paragraph with the 1st +// line containing only the page break being ~0 height) +uno::Reference xParaNext = getParagraph(3); +CPPUNIT_ASSERT_EQUAL(OUString(), xParaNext->getString()); +//If PageDescName is not empty, a page break / switch to page style is defined +CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, + getProperty(xParaNext, "BreakType")); +uno::Reference xParaThird = getParagraph(4); +CPPUNIT_ASSERT_EQUAL(OUString("THIRD"), xParaThird->getString()); +CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, + getProperty(xParaThird, "BreakType")); +CPPUNIT_ASSERT(uno::Any() != getProperty(xParaThird, "PageDescName")); +// there is an empty paragraph after THIRD +uno::Reference xParaLast = getParagraph(5); +CPPUNIT_ASSERT_EQUAL(OUString(), xParaLast->getString()); +try +{ +getParagraph(6); +} +catch (container::NoSuchElementException const&) +{ +// does not exist - expected +} + +CPPUNIT_ASSERT_EQUAL(4, getPages()); +} + CPPUNIT_TEST_FIXTURE(Test, testBackground) { createSwDoc("background.rtf"); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 0aeb3337f6f3..cdb2212a0a38 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -4409,6 +4409,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) (!m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && !bSingleParagraphAfterRedline && !bIsColumnBreak +&& !m_pImpl->GetIsL
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/page-break-emptyparas-spltpgpar.rtf | 13 + sw/qa/extras/rtfexport/data/page-break-emptyparas.rtf | 12 sw/qa/extras/rtfexport/rtfexport5.cxx |4 - sw/qa/extras/rtfexport/rtfexport6.cxx |7 ++ sw/qa/extras/rtfexport/rtfexport7.cxx | 25 ++ sw/qa/extras/rtfimport/rtfimport.cxx|5 +- writerfilter/source/dmapper/DomainMapper.cxx|4 + writerfilter/source/rtftok/rtfdispatchflag.cxx |7 ++ writerfilter/source/rtftok/rtfdispatchsymbol.cxx| 25 +- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 16 +- 10 files changed, 96 insertions(+), 22 deletions(-) New commits: commit 022e12e9af6e92ac3db853e73b7b2577b3c0511e Author: Michael Stahl AuthorDate: Fri Nov 10 17:04:27 2023 +0100 Commit: Thorsten Behrens CommitDate: Tue Nov 28 21:54:41 2023 +0100 tdf#153194 writerfilter: RTF import: \spltpgpar 1. Some experimenting with the bugdoc (saving it to DOCX in Word changes the layout in Word to exactly what Writer imports from RTF!) leads to DOCX w:splitPgBreakAndParaMark setting. 2. the RTF implementation of \spltpgpar was missing; apparently if the flag is present the "new" behavior is in effect, which is the opposite of how it's specified in RTF Spec 1.9.1. 3. the DomainMapper code that uses this attribute is not in the text() function to which RTFDocumentImpl sends paragraph breaks, but in the utext() function, so send the break there instead, rather than creating even more copypasta. 4. now some filters-text crashes with nullptr pContext in DomainMapper::lcl_utext(), avoid that. 5. dispatchSymbol(m_nResetBreakOnSectBreak) doesn't do anything because these are handled by dispatchFlag(). 6. Test name: testFdo81892::Load_Verify_Reload_Verify equality assertion failed - Expected: Performance - Actual : Fails because additional paragraph break inserted after \page; in dispatchSymbol() for \sect, remove the parBreak() as already hinted at in commit 3c610336a58f644525d5e4d2566c35eee6f7a618 7. rtfimport.cxx:868:Assertion Test name: testContSectionPageBreak::TestBody equality assertion failed - Expected: - Actual : THIRD It has no paragraph between SECOND and THIRD, whereas Word definitely shows a paragraph there. In dispatchSymbol() for \sect, sectBreak() is not called (which may create a paragraph break); in m_bIgnoreNextContSectBreak case this needs to be done manually for cont-section-pagebreak.rtf to get the empty paragraph between SECOND and THIRD. 8. testFdo52052 fails; in dispatchSymbol() for \sect, if the document ends with \sect (e.g. fdo52052.rtf) a paragraph break must be inserted after this (because DomainMapper unconditionally removes the last paragraph break), but not via m_bNeedCr as that creates unwanted page break in testNestedTable (m_bNeedCr => dispatchSymbol(\par) => m_bNeedSect => sectBreak()); handle it in RTFDocumentImpl::popState() for the end of the document by dispatching \par. 9. rtfimport.cxx:1519:Assertion testTdf108947 now has 1 empty paragraph in the header instead of 2; Word also shows only 1 so it's an improvement. 10. Test name: testFdo49893_2::Load_Verify_Reload_Verify equality assertion failed - Expected: 1 - Actual : 0 - xpath should match exactly 1 node This was reduced to only 2 pages, while Word shows 5; in dispatchSymbol() for \page, for the consecutive \page send an empty string to DomainMapper's utext() which causes a paragraph break to be created if \spltpgpar isn't set (this was not at all obvious!). 11. testTdf133437 fails with some numbers of flys changing, but it had those values before commit 3c610336a58f644525d5e4d2566c35eee6f7a618 which says "the exact number isn't that interesting". 12. testTdf153613_anchoredAfterPgBreak4 fails, but it now looks as in Word, so this is a bugfix. (13. Jenkins build on WNT (only) crashes in testForcepoint93 in sw layout code - strangely in the libreoffice-7-6 branch this happens on Linux too and it was fixed with commit 191babee4f0ec643b80e96b0cd98c2d04ff96e4e) Change-Id: Ia1063693d96adff900ece943020a5bf69bdeb7a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159471 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 15b886f460919ea3dce425a621dc017c2992a96b) Reviewed-on: https://g
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/tdf158044.rtf | 20 + sw/qa/extras/rtfimport/rtfimport.cxx | 54 +++ writerfilter/source/dmapper/DomainMapper.cxx | 89 + writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 writerfilter/source/rtftok/rtfsprm.cxx |9 +- 5 files changed, 170 insertions(+), 3 deletions(-) New commits: commit d06bb71d19c29eaecdf499cb5e160f2ce08b58de Author: Oliver Specht AuthorDate: Thu Nov 2 16:34:50 2023 +0100 Commit: Thorsten Behrens CommitDate: Sat Nov 11 20:54:24 2023 +0100 tdf#158044 handling of paragraph attributes in RTF import style attributes need to be repeated at the paragraph if not repeated then defaults have to be applied This includes: Fix Windows 64-bit build using VS 2022 Change-Id: Id976fe515287a4aa12d7ff8ca0ca09c31c65309f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159316 and Make the unit test linear and more explicit Change-Id: Ic28d059ed41f88c9264743034a5ce5397fff0b2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159317 Change-Id: I4ee567e8006c240c046b7e7bb75eae92e5563776 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158839 Tested-by: Jenkins Co-authored-by: Mike Kaganski Reviewed-by: Thorsten Behrens Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159328 diff --git a/sw/qa/extras/rtfimport/data/tdf158044.rtf b/sw/qa/extras/rtfimport/data/tdf158044.rtf new file mode 100755 index ..65e687f25d39 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf158044.rtf @@ -0,0 +1,20 @@ +{\rtf1\ansi +{\colortbl;\red0\green0\blue0;\red0\green0\blue255; +\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0; +\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red0\green0\blue0;\red0\green0\blue0;} + +{\stylesheet +{\fs24\sa3200 Normal;} +{\s97\tx1701\tx2835 StyleTabstops;} +{\s98\cbpat6 StyleRed;} +{\s99\qc SyleCentered;} +} + + +{\s97 Paragraph without tabstops\par} +{\s98 Pargraph without color \par} +{\s99 Paragraph without center\par} +{\s97\tx1701\tx2835 Paragraph with tabstops\par} +{\s98\cbpat6 Pargraph with color \par} +{\s99\qc Paragraph with center\par} +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 4ae5e90043f4..7dd9aa43877f 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1716,6 +1716,60 @@ CPPUNIT_TEST_FIXTURE(Test, testParaStyleBottomMargin) getProperty(xPara, "ParaLineSpacing").Height); } +CPPUNIT_TEST_FIXTURE(Test, test158044Tdf) +{ +createSwDoc("tdf158044.rtf"); + +{ +auto xPara(getParagraph(1)); +auto tabStops = getProperty>(xPara, "ParaTabStops"); + +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), tabStops.getLength()); +} + +{ +auto xPara(getParagraph(2)); +auto fillColor = getProperty(xPara, "FillColor"); +auto fillStyle = getProperty(xPara, "FillStyle"); + +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, fillStyle); +CPPUNIT_ASSERT_EQUAL(Color(0xff), fillColor); +} + +{ +auto xPara(getParagraph(3)); +auto adjust = getProperty(xPara, "ParaAdjust"); + +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), adjust); +} + +{ +auto xPara(getParagraph(4)); +auto tabStops = getProperty>(xPara, "ParaTabStops"); + +CPPUNIT_ASSERT_EQUAL(sal_Int32(2), tabStops.getLength()); +} + +{ +auto xPara(getParagraph(5)); +auto fillColor = getProperty(xPara, "FillColor"); +auto fillStyle = getProperty(xPara, "FillStyle"); +auto tabStops = getProperty>(xPara, "ParaTabStops"); + +CPPUNIT_ASSERT_LESS(sal_Int32(2), tabStops.getLength()); +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, fillStyle); +CPPUNIT_ASSERT_EQUAL(Color(0xff), fillColor); +} + +{ +auto xPara(getParagraph(6)); +auto fillStyle = getProperty(xPara, "FillStyle"); +auto tabStops = getProperty>(xPara, "ParaTabStops"); + +CPPUNIT_ASSERT_LESS(sal_Int32(2), tabStops.getLength()); +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, fillStyle); +} +} // tests should only be added to rtfIMPORT *if* they fail round-tripping in rtfEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 148bb98eaf42..adf956653071 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -3843,6 +3844,35 @@ voi
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/tdf153178.rtf |7 +++ sw/qa/extras/rtfexport/rtfexport7.cxx | 10 ++ writerfilter/source/rtftok/rtfdispatchflag.cxx | 20 writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 +++--- 4 files changed, 40 insertions(+), 3 deletions(-) New commits: commit f24ad883b15a8112d7dfeb4de14afaf67da30a47 Author: Michael Stahl AuthorDate: Thu Nov 9 19:54:19 2023 +0100 Commit: Xisco Fauli CommitDate: Sat Nov 11 00:05:30 2023 +0100 tdf#153178 writerfilter: do not create text frame spuriously There are different RTF keywords that end up in RTFFrame, and some of them cause Word to create a frame, while others don't. Getting this right requires implementing support for all the missing wrapping keywords, as most of them create a frame in Word but \wrapdefault does not. Change-Id: I1e55d15180564f3d66a5ee7d98274ae18f032872 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159228 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 4e2f2489c4c7436f8b3a21a530bc625cbef4e365) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159231 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/rtfexport/data/tdf153178.rtf b/sw/qa/extras/rtfexport/data/tdf153178.rtf new file mode 100644 index ..e1d74f4010ea --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf153178.rtf @@ -0,0 +1,7 @@ +{\rtf1 +\tqr\tlul\tx2025\dxfrtext142\dfrmtxtx142\dfrmtxty142\wrapdefault\faauto\adjustright\rin0\lin57\itap0 \rtlch\fcs1 \afs26\alang1025 \ltrch\fcs0 \fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079 + +\par +\pard +\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport7.cxx b/sw/qa/extras/rtfexport/rtfexport7.cxx index ad9249bedeb8..4d1550af4fdd 100644 --- a/sw/qa/extras/rtfexport/rtfexport7.cxx +++ b/sw/qa/extras/rtfexport/rtfexport7.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -659,6 +660,15 @@ DECLARE_RTFEXPORT_TEST(testWatermark, "watermark.rtf") CPPUNIT_ASSERT_EQUAL(float(66), nFontSize); } +DECLARE_RTFEXPORT_TEST(testTdf153178, "tdf153178.rtf") +{ +// the problem was that a frame was created +uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); +} + DECLARE_RTFEXPORT_TEST(testTdf109790, "tdf109790.rtf") { uno::Reference xTable(getParagraphOrTable(2), uno::UNO_QUERY); diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index de7b91e26fae..699698aa8df8 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -1242,6 +1242,26 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap, NS_ooxml::LN_Value_doc_ST_Wrap_notBeside); break; +case RTFKeyword::OVERLAY: +m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap, + NS_ooxml::LN_Value_doc_ST_Wrap_none); +break; +case RTFKeyword::WRAPAROUND: +m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap, + NS_ooxml::LN_Value_doc_ST_Wrap_around); +break; +case RTFKeyword::WRAPTHROUGH: +m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap, + NS_ooxml::LN_Value_doc_ST_Wrap_through); +break; +case RTFKeyword::WRAPTIGHT: +m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap, + NS_ooxml::LN_Value_doc_ST_Wrap_tight); +break; +case RTFKeyword::WRAPDEFAULT: +m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap, + NS_ooxml::LN_Value_doc_ST_Wrap_auto); +break; case RTFKeyword::MNOR: m_bMathNor = true; break; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 568ad4a8f31f..11e251b0828a 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3995,9 +3995,9 @@ RTFSprms RTFFrame::getSprms() bool RTFFrame::hasProperties() const { -return m_nX != 0 || m_nY != 0 || m_nW != 0 || m_nH != 0 || m_nHoriPadding != 0 - || m_nVertPadding != 0 || m_nHoriAlign != 0 || m_nHoriAnchor != 0 || m_nVertAlign != 0 - || m_nVertAnchor != 0; +// tdf#153178
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
dev/null |binary sw/qa/extras/ooxmlexport/ooxmlexport18.cxx| 15 --- writerfilter/source/dmapper/DomainMapper.cxx |5 + writerfilter/source/dmapper/DomainMapper_Impl.cxx | 13 - writerfilter/source/dmapper/DomainMapper_Impl.hxx |3 --- 5 files changed, 1 insertion(+), 35 deletions(-) New commits: commit 06702d8474bdac71fa2a61723ea476e888fc91d6 Author: Justin Luth AuthorDate: Thu Oct 5 07:24:56 2023 -0400 Commit: Xisco Fauli CommitDate: Thu Oct 5 21:17:04 2023 +0200 tdf#157574 Revert "tdf#153613 tdf#146984 split para after anchors" This reverts 7.6 commit 828fde37632a5bb0542b6925454690a5287d6490. and also reverts the dependent parts of the follow-up test from commit 828fde37632a5bb0542b6925454690a5287d6490 (although the patch itself is fine to remain in place) and also reverts followup "cid#1522030 Uninitialized scalar field" commit 9a123a6e63600ba3998d22bbc300ac4b65b3da2c. The commit in general is fine. However, it fails in case of an empty paragraph (with only anchors). Unfortunately, there is no way of knowing ahead of time, so either everything needs to be processed after a delay, or else the paragraph needs to be split and then re-joined in case it is not an empty paragraph. Both options are extremely non-trivial - I don't know how to do either of them. Change-Id: I9e98d825ad0008e822172b6797116ad16e90b871 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157593 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit bd18618aae500d01e665d8af07067bb99a491850) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157615 diff --git a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx deleted file mode 100644 index a282deaa0ad7.. Binary files a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx and /dev/null differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 62dc42dba5af..04c5789c19c6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -193,11 +193,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf146984_anchorInShape, "tdf146984_anchorInShape.d { // This was only one page b/c the page break was missing. CPPUNIT_ASSERT_EQUAL(2, getPages()); - -const auto& pLayout = parseLayoutDump(); -// There are shapes on both pages - these should be non-zero numbers -assertXPath(pLayout, "//page[1]//anchored", 3); -assertXPath(pLayout, "//page[2]//anchored", 2); } DECLARE_OOXMLEXPORT_TEST(testTdf127622_framePr, "tdf127622_framePr.docx") @@ -377,16 +372,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak2, "tdf153613_textboxA assertXPathContent(pLayout, "//page[2]/body/txt", "There should be no prior carriage return."); } -DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak3, "tdf153613_textboxAfterPgBreak3.docx") -{ -// All anchored TO-character shapes stay on the first page, before the page break. -CPPUNIT_ASSERT_EQUAL(2, getPages()); -CPPUNIT_ASSERT_EQUAL(3, getParagraphs()); - -const auto& pLayout = parseLayoutDump(); -assertXPath(pLayout, "//page[2]//anchored", 0); -} - DECLARE_OOXMLEXPORT_TEST(testTdf153613_sdtAfterPgBreak, "tdf153613_sdtAfterPgBreak.docx") { CPPUNIT_ASSERT_EQUAL(2, getPages()); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index e6a7e1dfde9e..148bb98eaf42 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3742,7 +3742,7 @@ void DomainMapper::lcl_startShape(uno::Reference const& xShape) { // If there is a deferred page break, handle it now, so that the // started shape will be on the correct page. -if (m_pImpl->isBreakDeferred(PAGE_BREAK) && !m_pImpl->IsBreakDeferredByAnchor()) +if (m_pImpl->isBreakDeferred(PAGE_BREAK)) { // RTF doesn't properly report IsFirstRun, so in order to prevent regressions // always split the paragraph for RTF since that is the way it has been done lately. @@ -3752,9 +3752,6 @@ void DomainMapper::lcl_startShape(uno::Reference const& xShape) finishParagraph(); lcl_startParagraphGroup(); } -else -m_pImpl->SetIsBreakDeferredByAnchor(); - } m_pImpl->PushShapeContext( xShape ); lcl_startParagraphGroup(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 2bf742d3bf1c..1a8f44d8562c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf157572_defaultVAnchor.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 11 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 16 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) New commits: commit e86d30e8bbabeb5e4a5a74d3fe439218a35cce8d Author: Justin Luth AuthorDate: Tue Oct 3 13:44:15 2023 -0400 Commit: Miklos Vajna CommitDate: Thu Oct 5 08:42:04 2023 +0200 tdf#157572 tdf#112287 tdf#154129 writerfilter framePr: fix vAnchor default Fixes LO 7.6 regression commit 630732bfd8ed531e9d412a36a083f33763def054 See bug 157572 for the documentation. To test this, I used ooxmlexport5's tdf112287B.docx with Word 2010: -changed vertical relative to Paragraph - exported w:vAnchor="text" -changed vertical relative to Page - exported w:vAnchor="page" -changed vertical relative to Margin - did not export w:vAnchor So, obviously the default is "margin" Note that it always exports w:y=1 For importing, the default vAnchor changed depending on whether w:y=0 (text) or w:y=1 (margin) * an exception is when w:y=0 and vAlign is defined - then 'margin' make CppunitTest_sw_ooxmlexport5 \ CPPUNIT_TEST_NAME=testTdf157572_defaultVAnchor Change-Id: I126094eafc43a83e3a4efdd1ebc8d9cab9d49759 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157527 Reviewed-by: Justin Luth Tested-by: Jenkins (cherry picked from commit cfa744f49e9e18dfab6a0f5930304898dc98) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157544 Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/data/tdf157572_defaultVAnchor.docx b/sw/qa/extras/ooxmlexport/data/tdf157572_defaultVAnchor.docx new file mode 100644 index ..9f63950693f7 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf157572_defaultVAnchor.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index ceb6bdff9c06..71cea9fa2964 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1429,6 +1429,17 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf112287) assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr","yAlign","bottom"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf157572_defaultVAnchor) +{ +loadAndSave("tdf157572_defaultVAnchor.docx"); +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); + +// vAnchor wasn't defined on import. It should default to 'margin' when w:y=non-zero +assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr","vAnchor","margin"); +// yAlign=something is not compatible with w:y=non-zero" - don't write anything out +// assertXPathNoAttribute(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "yAlign"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf112287B) { loadAndSave("tdf112287B.docx"); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 1758f7662c49..2bf742d3bf1c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1874,13 +1874,15 @@ DomainMapper_Impl::MakeFrameProperties(const ParagraphProperties& rProps) aFrameProperties.push_back( comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT), nVertOrient)); -//Default the anchor in case FramePr_vAnchor is missing ECMA 17.3.1.11 -sal_Int16 nVAnchor = text::RelOrientation::FRAME; // 'text' -// vAlign is ignored if vAnchor is set to 'text'. So, if w:y is not defined, -// but there is a defined vAlign, then a missing vAnchor should become 'margin'. -if (!bValidY && nVertOrient) -{ -nVAnchor = text::RelOrientation::PAGE_PRINT_AREA; // 'margin' +// Default the anchor in case FramePr_vAnchor is missing. +// ECMA 17.3.1.11 says "page", +// but errata documentation MS-OE376 2.1.48 Section 2.3.1.11 says "text" +// while actual testing usually indicates "margin" tdf#157572 tdf#112287 +sal_Int16 nVAnchor = text::RelOrientation::PAGE_PRINT_AREA; // 'margin' +if (!nY && (bValidY || nVertOrient == text::VertOrientation::NONE)) +{ +// special cases? "auto" position defaults to "paragraph" based on testing when w:y=0 +nVAnchor = text::RelOrientation::FRAME; // 'text' } for (const auto pProp : vProps) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf155736_PageNumbers_footer.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 14 ++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 21 +++--- writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 4 files changed, 30 insertions(+), 7 deletions(-) New commits: commit d3cf473ceb2a0711ca723ed680034b9251dccbbd Author: Satya AuthorDate: Wed Jun 14 18:15:35 2023 +0530 Commit: Justin Luth CommitDate: Tue Aug 1 13:18:12 2023 +0200 tdf#155736 Modified IsInTOC() to handle IsInHeaderFooter() case. This fixes a problem of page numbers missing in the footer. The importer might start processing the footer before the TOC has finished - m_bStartTOC might be true. In this case we are not actually IsInTOC,and m_bStartTOC should be ignored and make use of IsInHeaderFooter() and m_bStartTOCHeaderFooter to confirm if the footer/header itself has TOC. Change-Id: Ieede9f8e2120556630ba57b9c748935788f3cc9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153052 Reviewed-by: Justin Luth Tested-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155120 Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/data/tdf155736_PageNumbers_footer.docx b/sw/qa/extras/ooxmlexport/data/tdf155736_PageNumbers_footer.docx new file mode 100644 index ..58e36988002a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf155736_PageNumbers_footer.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index c8dca64723a1..62dc42dba5af 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -856,6 +856,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf155903, "tdf155903.odt") // because the exported file was corrupted. } +DECLARE_OOXMLEXPORT_TEST(testTdf155736, "tdf155736_PageNumbers_footer.docx") +{ +CPPUNIT_ASSERT_EQUAL(2, getPages()); + +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +assertXPath(pXmlDoc, "/root/page[1]/footer"); +assertXPath(pXmlDoc, "/root/page[2]/footer"); +//Without the fix in place, it would have failed with +//- Expected: Page * of * +//- Actual : Page of +CPPUNIT_ASSERT_EQUAL(OUString("Page * of *"), parseDump("/root/page[1]/footer/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("Page * of *"), parseDump("/root/page[2]/footer/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 308768cc78eb..1758f7662c49 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2996,7 +2996,7 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper // If we are in comments, then disable CharGrabBag, comment text doesn't support that. uno::Sequence< beans::PropertyValue > aValues = pPropertyMap->GetPropertyValues(/*bCharGrabBag=*/!m_bIsInComments); -if (m_bStartTOC || m_bStartIndex || m_bStartBibliography) +if (IsInTOC() || m_bStartIndex || m_bStartBibliography) for( auto& rValue : asNonConstRange(aValues) ) { if (rValue.Name == "CharHidden") @@ -3409,6 +3409,14 @@ void DomainMapper_Impl::fillEmptyFrameProperties(std::vector(0))); } +bool DomainMapper_Impl::IsInTOC() const +{ +if (IsInHeaderFooter()) +return m_bStartTOCHeaderFooter; +else +return m_bStartTOC; +} + void DomainMapper_Impl::ConvertHeaderFooterToTextFrame(bool bDynamicHeightTop, bool bDynamicHeightBottom) { while (!m_aHeaderFooterTextAppendStack.empty()) @@ -7125,7 +7133,7 @@ void DomainMapper_Impl::CloseFieldCommand() break; } } -if (m_bStartTOC && (aIt->second.eFieldId == FIELD_PAGEREF) ) +if (IsInTOC() && (aIt->second.eFieldId == FIELD_PAGEREF)) { bCreateField = false; } @@ -7541,7 +7549,7 @@ void DomainMapper_Impl::CloseFieldCommand() break; case FIELD_PAGEREF: case FIELD_REF: -if (xFieldProperties.is() && !m_bStartTOC) +if (xFieldProperties.is() && !IsInTOC()) { bool bPageRef = aIt->second.eFieldId == FIELD_PAGEREF; @@ -8223,9 +8231,9 @@ void DomainMapper_Impl::PopFieldContext() else { xToInsert.set(pContext->GetTC(), uno::UNO_QUERY); -if( !xToInsert.is() && !m_bStartTOC && !m_bStartIndex && !m_bStartBibliography ) +if (!xToInsert.is() && !IsInTOC() && !m_bStartIndex && !m_bStartBibliography)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/tdf154319-ToC_with_s_and_d.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |2 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 37 -- 3 files changed, 32 insertions(+), 7 deletions(-) New commits: commit 5b9471ad3698aa7892985299b169a70b4e058443 Author: Mike Kaganski AuthorDate: Mon Jul 10 21:16:32 2023 +0300 Commit: Caolán McNamara CommitDate: Wed Jul 26 14:47:38 2023 +0200 tdf#156130: Use default tab stop when TOC*N style doesn't define one When TOC*N style only defines one tab stop, it's used by Word as the page number position, and the tab between chapter number and chapter name is set to a default position. When the style has no tab stops, they are both defaulted. testTdf154319 is updated to test this. Change-Id: I561995a8e96882e1f17ee9982e3fc640e621cda2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154281 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit b915dd9e1559870045481403806dd073f4fb5818) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154259 Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/ooxmlimport/data/tdf154319-ToC_with_s_and_d.docx b/sw/qa/extras/ooxmlimport/data/tdf154319-ToC_with_s_and_d.docx index dc5a67824c9d..91a9d0b8adea 100644 Binary files a/sw/qa/extras/ooxmlimport/data/tdf154319-ToC_with_s_and_d.docx and b/sw/qa/extras/ooxmlimport/data/tdf154319-ToC_with_s_and_d.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index a0a4d8051686..6edd873dc7ed 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -1063,7 +1063,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf154319) // tdf#154360: check tab stops between the number and the entry text // The last (10th) level does not correspond to any MS level (only 9 levels there) constexpr sal_Int32 levelTabStops[] -= { 776, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, -1 }; += { 776, 1552, 2328, 3104, 3881, 4657, 5433, 6209, 6985, -1 }; //start with level 1, 0 is the header level for (sal_Int32 nLevel = 1; nLevel < xLevelFormats->getCount(); ++nLevel) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 77a68dd5a535..308768cc78eb 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6314,7 +6314,7 @@ void DomainMapper_Impl::handleAuthor } static uno::Sequence< beans::PropertyValues > lcl_createTOXLevelHyperlinks( bool bHyperlinks, const OUString& sChapterNoSeparator, - const uno::Sequence< beans::PropertyValues >& aLevel, const uno::Sequence& tabs) + const uno::Sequence< beans::PropertyValues >& aLevel, const std::optional numtab) { //create a copy of the level and add new entries @@ -6353,12 +6353,12 @@ static uno::Sequence< beans::PropertyValues > lcl_createTOXLevelHyperlinks( bool aNewLevel.push_back(item); -if (tabs.hasElements() && tokenType == tokENum) +if (numtab && tokenType == tokENum) { // There is a fixed tab stop position needed in the level after the numbering aNewLevel.push_back( { comphelper::makePropertyValue(tokType, OUString("TokenTabStop")), - comphelper::makePropertyValue("TabStopPosition", tabs[0].Position) }); + comphelper::makePropertyValue("TabStopPosition", numtab->Position) }); } } @@ -6733,7 +6733,7 @@ void DomainMapper_Impl::handleToc xLevelFormats->getByIndex( nLevel ) >>= aLevel; // Get the tab stops coming from the styles; store to the level definitions -uno::Sequence tabStops; +std::optional numTab; if (xChapterNumberingRules && xStyles) { // This relies on the chapter numbering rules already defined @@ -6758,13 +6758,38 @@ void DomainMapper_Impl::handleToc xTOC->getPropertyValue("ParaStyleLevel" + OUString::number(nLevel)) >>= style; uno::Reference xStyle; if (xStyles->getByName(style) >>= xStyle) -xStyle->getPropertyValue("ParaTabStops") >>= tabStops; +{ +if (uno::Reference xPropState{ xStyle, + uno::UNO_QUERY }) +{ +if (xPropState->getPropertyState("ParaTabStops") +== beans::PropertyState_DIRECT_VALUE) +{ +if (uno::Sequence tabStops; +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/uiwriter/data/tdf149498.docx |binary sw/qa/extras/uiwriter/uiwriter5.cxx | 18 ++ writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +++-- 3 files changed, 21 insertions(+), 2 deletions(-) New commits: commit 3ec09683bcbf85e42940108fa2ec0c49ad7d3d8b Author: László Németh AuthorDate: Fri Jul 21 17:35:12 2023 +0200 Commit: Michael Stahl CommitDate: Mon Jul 24 12:01:38 2023 +0200 tdf#149498 sw: fix Undo crash at bookmark over cells Importing DOCX files with bookmarks between w:p paragraph elements resulted bookmark ranges over cell boundaries within text tables, causing crash with Undo. Partial revert of commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519 to avoid bookmark ranges over cell boundaries, creating only collapsed bookmarks here, as before. Regression from commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519 "tdf#145720 DOCX export: fix loss of tracked moving". Note: to avoid of another assertion, skip testing with debug builds. Change-Id: I3ed6daa55323f20130fcee6cc24d00a480731d0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154743 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit b081a818b1c3024d7ec5cc5b3a251109a1d9b08d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154708 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/sw/qa/extras/uiwriter/data/tdf149498.docx b/sw/qa/extras/uiwriter/data/tdf149498.docx new file mode 100644 index ..b310e88aa735 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf149498.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index 88868f8086c2..dfe0cc80f7ec 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -2589,6 +2589,24 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf155747) assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 1); } +#ifndef DBG_UTIL +CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf149498) +{ +// load a table, and delete the first column with enabled change tracking: +// now the column is not deleted silently, but keeps the deleted cell content, +// and only accepting it will result the deletion of the table column. +createSwDoc("tdf149498.docx"); + +// select table, copy, paste and Undo +dispatchCommand(mxComponent, ".uno:SelectAll", {}); +dispatchCommand(mxComponent, ".uno:Copy", {}); +dispatchCommand(mxComponent, ".uno:Paste", {}); + +// this would crash due to bookmark over cell boundary +dispatchCommand(mxComponent, ".uno:Undo", {}); +} +#endif + CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150673_RedlineTableColumnDeletionWithExport) { // load a table, and delete the first column with enabled change tracking: diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 4a32891f2503..77a68dd5a535 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -8420,10 +8420,11 @@ void DomainMapper_Impl::StartOrEndBookmark( const OUString& rId ) // then move the bookmark-End to the earlier paragraph if (IsOutsideAParagraph()) { -// keep bookmark range +// keep bookmark range, if it doesn't exceed cell boundary uno::Reference< text::XTextRange > xStart = xCursor->getStart(); xCursor->goLeft( 1, false ); -xCursor->gotoRange(xStart, true ); +if (m_nTableDepth == 0 || !m_bFirstParagraphInCell) +xCursor->gotoRange(xStart, true ); } uno::Reference< container::XNamed > xBkmNamed( xBookmark, uno::UNO_QUERY_THROW ); SAL_WARN_IF(aBookmarkIter->second.m_sBookmarkName.isEmpty(), "writerfilter.dmapper", "anonymous bookmark");
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/tdf156030.rtf | 11 ++ sw/qa/extras/rtfexport/rtfexport7.cxx | 38 ++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 30 - 3 files changed, 78 insertions(+), 1 deletion(-) New commits: commit 8081bbcb2dd42508f8c306fe3b302392358fe892 Author: Vasily Melenchuk AuthorDate: Thu Jul 6 12:45:11 2023 +0300 Commit: Thorsten Behrens CommitDate: Tue Jul 18 22:14:40 2023 +0200 tdf#156030: sw: better import of IF field for RTF and DOCX Since long time IF field was converted to ConditionalText, but no parameters were given. So condition, then text and else text were lost during import. Change-Id: I9b45e8ab394f3c53bb34370bf3ea15a939a400fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154101 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit d434104497fa1bea5744d5ce4e9447f75834ba55) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154530 diff --git a/sw/qa/extras/rtfexport/data/tdf156030.rtf b/sw/qa/extras/rtfexport/data/tdf156030.rtf new file mode 100644 index ..db501d5bffac --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf156030.rtf @@ -0,0 +1,11 @@ +{\rtf1 +{\field{\*\fldinst IF 1 = 2 "true value 1" "false value 1"}}\par +{\field{\*\fldinst IF 1 == 2 "true value 2" "false value 2"}}\par +{\field{\*\fldinst IF 1 != 2 "true value 3" "false value 3"}}\par +{\field{\*\fldinst IF 1 <> 2 "true value 4" "false value 4"}}\par +{\field{\*\fldinst IF 1 > 2 "true value 5" "false value 5"}}\par +{\field{\*\fldinst IF 1 < 2 "true value 6" "false value 6"}}\par +{\field{\*\fldinst IF 1 1 = 1 2 1 true value 7 false value 7}}\par +{\field{\*\fldinst IF 1 1 = "1 2 1 true value 8 fal"se "value 8}}\par +{\field{\*\fldinst IF a}}\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport7.cxx b/sw/qa/extras/rtfexport/rtfexport7.cxx index 11eaadee6a88..ad9249bedeb8 100644 --- a/sw/qa/extras/rtfexport/rtfexport7.cxx +++ b/sw/qa/extras/rtfexport/rtfexport7.cxx @@ -683,6 +683,44 @@ DECLARE_RTFEXPORT_TEST(testTdf113202, "tdf113202.rtf") CPPUNIT_ASSERT(getProperty(getParagraph(4), "ParaContextMargin")); } +DECLARE_RTFEXPORT_TEST(testTdf156030, "tdf156030.rtf") +{ +uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xFieldsAccess( +xTextFieldsSupplier->getTextFields()); +uno::Reference xFields(xFieldsAccess->createEnumeration()); + +// As usual, fields given by FieldsAccess are not in same order as in the document +std::vector> aExpectedValues = { +{ "1 FORMULA 2", "true value 1", "false value 1" }, // #1, condition should be 1 = 2 +{ "", "", "" }, // #9, not enough field params +{ "1 1 FORMULA 1 2 1 true value 8 fal", "se", "value 8" }, // #8, nonsense in field params +{ "1 1 FORMULA 1 2 1 true value 7 false", "value", "7" }, // #7, another parse error +{ "1 < 2", "true value 6", "false value 6" }, // #6 +{ "1 > 2", "true value 5", "false value 5" }, // #5 +{ "1 <> 2", "true value 4", "false value 4" }, // #4 +{ "1 != 2", "true value 3", "false value 3" }, // #3 +{ "1 FORMULA FORMULA 2", "true value 2", "false value 2" }, // #2, condition expected 1 == 2 +}; +uno::Reference xPropertySet; +OUString sValue; + +for (const auto& aValues : aExpectedValues) +{ +xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT(xPropertySet.is()); +CPPUNIT_ASSERT(xPropertySet->getPropertyValue("Condition") >>= sValue); +CPPUNIT_ASSERT_EQUAL(aValues[0], sValue); +CPPUNIT_ASSERT(xPropertySet->getPropertyValue("TrueContent") >>= sValue); +CPPUNIT_ASSERT_EQUAL(aValues[1], sValue); +CPPUNIT_ASSERT(xPropertySet->getPropertyValue("FalseContent") >>= sValue); +CPPUNIT_ASSERT_EQUAL(aValues[2], sValue); +} + +// No more fields +CPPUNIT_ASSERT(!xFields->hasMoreElements()); +} + DECLARE_RTFEXPORT_TEST(testTdf153195, "tdf153195.rtf") { uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index f849a5246bf4..4a32891f2503 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -7414,7 +7414,35 @@ void DomainMapper_Impl::CloseFieldCommand() pContext->SetHyperlinkTarget(sTarget); } break; -case FIELD_IF : break; +case FIELD_IF: +{ +if (vArguments.size() < 3) +{ +SAL_WARN("writerfilter.dmapper", "IF field requires at lest 3 parameters!"); +break; +} + +if (xFieldProperties.
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |9 - writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 26 +++ 2 files changed, 33 insertions(+), 2 deletions(-) New commits: commit 6b93852a88140706561171dc75c0ebf6ddecf256 Author: Miklos Vajna AuthorDate: Thu Jul 6 08:13:40 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Jul 10 10:18:17 2023 +0200 tdf#156059 sw floattable: fix lost 0 bottom margin of anchor in ftn from DOCX The bottom margin of floating table anchor paragraph in the footnotes was non-zero, which meant that the document had 2 pages in Writer, but only 1 in Word. What happened here is that commit d1ac8df139a2a65db45d1970ccc0b80e17d827f6 (tdf#146346 DOCX import: fix table margins in footnotes, 2022-05-03) fixed this, but only for the case when the floating table conversion was delayed and not in the instant conversion case. Then later commit c50bf5a5daaae3d40f89ea0784a75a8a571c208d (sw floattable: remove no longer needed DOCX import heuristics, 2023-04-12) made all floating table conversions instant, so the problem was re-introduced. Fix the problem by now fixing the problem in DomainMapperTableHandler::endTable(), restoring code that was removed from SectionPropertyMap::CloseSectionGroup(). There was a disabled testcase for this, so just enable that. Change-Id: Ifb7c8fe2bdc70625d3e334cea0893b8e563664ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154088 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 9ac864159b241d2093e86f664ab6f4b76c69196d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154121 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index a8beca7e6b0e..67fba9e9b114 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -1383,8 +1383,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf146346, "tdf146346.docx") assertXPath(pXmlDoc, "/root/page[1]//anchored/fly", 8); assertXPath(pXmlDoc, "/root/page[1]//anchored/fly/tab", 8); -// FIXME no second page (regression since multi-page floating tables?) -//assertXPath(pXmlDoc, "/root/page[2]", 0); +// No second page. +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 0 +// - Actual : 1 +// i.e. unwanted lower margin in the floating table's anchor paragraph in the footnote created a +// second page. +assertXPath(pXmlDoc, "/root/page[2]", 0); } #endif diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index cd77182657c8..ab8e00e13731 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -1619,6 +1619,32 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab uno::Reference xContent = xTextAppendAndConvert->convertToTextFrame(xStart, xEnd, comphelper::containerToSequence(aFrameProperties)); xFrameAnchor.set(xContent->getAnchor(), uno::UNO_QUERY); +bool bConvertToFloatingInFootnote = false; +if (xContent.is() && xContent->getAnchor().is()) +{ +uno::Reference xText(xContent->getAnchor()->getText(), uno::UNO_QUERY); +if (xText.is()) +{ +bConvertToFloatingInFootnote = xText->supportsService("com.sun.star.text.Footnote"); +} +} + +// paragraph of the anchoring point of the floating table needs zero top and bottom +// margins, if the table was a not floating table in the footnote, otherwise +// docDefault margins could result bigger vertical spaces around the table +if ( bConvertToFloatingInFootnote && xContent.is() ) +{ +uno::Reference xParagraph( +xContent->getAnchor(), uno::UNO_QUERY); +if ( xParagraph.is() ) +{ +xParagraph->setPropertyValue("ParaTopMargin", +uno::Any(static_cast(0))); +xParagraph->setPropertyValue("ParaBottomMargin", +uno::Any(static_cast(0))); +} +} + AfterConvertToTextFrame(m_rDMapper_Impl, aFramedRedlines, redPos, redLen, redCell, redTable); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf153804.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx| 17 + writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +- writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 +- 4 files changed, 19 insertions(+), 2 deletions(-) New commits: commit c93083d583e7b29a27bf8ff6e2664fe0613a6542 Author: László Németh AuthorDate: Thu Jul 6 17:31:20 2023 +0200 Commit: László Németh CommitDate: Sun Jul 9 21:42:53 2023 +0200 tdf#153804 DOCX import: fix lost footnotes in case of comments Incomplete handling of m_bIsFootnote had a conflict with XNote stream COMMENTS (i.e. not FOOTNOTES and ENDNOTES) since commit 96a856f87f16cca2e039c973c18d57c8b9dca362 in DomainMapper::lcl_checkId(), resulting lost (order or content) of footnotes, when were comments in the document. Regression from commit 96a856f87f16cca2e039c973c18d57c8b9dca362 "tdf#152206 DOCX import: fix mixed first footnote". Change-Id: I8d6901e8db1e183b959fecd350d6a263e79b5591 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154147 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit cca6ccf0f5e2f72c96f4f8879b8d894faea28b81) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154185 Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/data/tdf153804.docx b/sw/qa/extras/ooxmlexport/data/tdf153804.docx new file mode 100644 index ..65a1fdfa8e17 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf153804.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 5edb4dcdcd11..a8beca7e6b0e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -1352,6 +1352,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf153255) CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg4."), xFootnote4->getString().trim() ); } +CPPUNIT_TEST_FIXTURE(Test, testTdf153804) +{ +loadAndSave("tdf153804.docx"); +xmlDocUniquePtr pXml = parseExport("word/footnotes.xml"); +CPPUNIT_ASSERT(pXml); + +uno::Reference xFootnotesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xFootnotes = xFootnotesSupplier->getFootnotes(); +uno::Reference xLastFootnote(xFootnotes->getByIndex(1), uno::UNO_QUERY); +// This was empty +CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg 6"), xLastFootnote->getString().trim() ); + +uno::Reference xLastButOne(xFootnotes->getByIndex(0), uno::UNO_QUERY); +// This was empty +CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg5"), xLastButOne->getString().trim() ); +} + // skip test for macOS (missing fonts?) #if !defined(MACOSX) DECLARE_OOXMLEXPORT_TEST(testTdf146346, "tdf146346.docx") diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 4e410c0b0be9..f849a5246bf4 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4087,7 +4087,7 @@ void DomainMapper_Impl::PopFootOrEndnote() } m_aRedlines.pop(); m_eSkipFootnoteState = SkipFootnoteSeparator::OFF; -m_bInFootOrEndnote = false; +m_bInFootOrEndnote = m_bInFootnote = false; m_pFootnoteContext = nullptr; m_bFirstParagraphInCell = m_bSaveFirstParagraphInCell; } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 4668ebc8ac4c..55f3b671c836 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -863,7 +863,7 @@ public: void PushFootOrEndnote( bool bIsFootnote ); void PopFootOrEndnote(); bool IsInFootOrEndnote() const { return m_bInFootOrEndnote; } -bool IsInFootnote() const { return m_bInFootnote; } +bool IsInFootnote() const { return IsInFootOrEndnote() && m_bInFootnote; } void StartCustomFootnote(const PropertyMapPtr pContext); void EndCustomFootnote();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf155690.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx| 47 ++ writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 ++ 3 files changed, 53 insertions(+) New commits: commit b5a50e5bd31303da8c102122b2e0adf3674eee9d Author: Michael Stahl AuthorDate: Wed Jun 14 15:35:24 2023 +0200 Commit: Xisco Fauli CommitDate: Thu Jun 15 08:59:15 2023 +0200 tdf#155690 writerfilter: fix import of bookmark in table... ... at start of section. (regression from commit 2e8aad6d45c53d554ccaf26de998ede708cfc289) Change-Id: I1e0e720758b607b69645b29c46f4092264289f9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153053 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 142aa77265361492e74707b08c5bcd366e7205ad) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153071 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf155690.docx b/sw/qa/extras/ooxmlexport/data/tdf155690.docx new file mode 100644 index ..1839862688ee Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf155690.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index f6c1b84fcec9..80243ba64a2d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -58,6 +58,53 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126994_lostPageBreak, "tdf126994_lostPageBreak.d CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 3, getPages() ); } +DECLARE_OOXMLEXPORT_TEST(testTdf155690, "tdf155690.docx") +{ +uno::Reference xBookmarksSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xBookmarks = xBookmarksSupplier->getBookmarks(); +{ +uno::Reference xMark(xBookmarks->getByName("row1_1"), uno::UNO_QUERY); +CPPUNIT_ASSERT(xMark.is()); +// the problem was that the start was after the H +CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString()); +} +{ +uno::Reference xMark(xBookmarks->getByName("row1_2"), uno::UNO_QUERY); +CPPUNIT_ASSERT(xMark.is()); +CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString()); +} +{ +uno::Reference xMark(xBookmarks->getByName("row1_3"), uno::UNO_QUERY); +CPPUNIT_ASSERT(xMark.is()); +CPPUNIT_ASSERT_EQUAL(OUString("ello world"), xMark->getAnchor()->getString()); +} +{ +uno::Reference xMark(xBookmarks->getByName("row1_4"), uno::UNO_QUERY); +CPPUNIT_ASSERT(xMark.is()); +CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString()); +} +{ +uno::Reference xMark(xBookmarks->getByName("row2_1"), uno::UNO_QUERY); +CPPUNIT_ASSERT(xMark.is()); +CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString()); +} +{ +uno::Reference xMark(xBookmarks->getByName("row2_1"), uno::UNO_QUERY); +CPPUNIT_ASSERT(xMark.is()); +CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString()); +} +{ +uno::Reference xMark(xBookmarks->getByName("row2_3"), uno::UNO_QUERY); +CPPUNIT_ASSERT(xMark.is()); +CPPUNIT_ASSERT_EQUAL(OUString("ello world"), xMark->getAnchor()->getString()); +} +{ +uno::Reference xMark(xBookmarks->getByName("row2_4"), uno::UNO_QUERY); +CPPUNIT_ASSERT(xMark.is()); +CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString()); +} +} + CPPUNIT_TEST_FIXTURE(Test, testTdf121374_sectionHF) { loadAndReload("tdf121374_sectionHF.odt"); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 41ca8bf8d45e..f75fbf529c96 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -8344,6 +8344,9 @@ void DomainMapper_Impl::StartOrEndBookmark( const OUString& rId ) else { xCursor = xText->createTextCursorByRange( aBookmarkIter->second.m_xTextRange ); +} +if (!aBookmarkIter->second.m_bIsStartOfText) +{ xCursor->goRight( 1, false ); } @@ -8485,6 +8488,9 @@ void DomainMapper_Impl::startOrEndPermissionRange(sal_Int32 permissinId) else { xCursor = xText->createTextCursorByRange(aPermIter->second.m_xTextRange); +} +if (!aPermIter->second.m_bIsStartOfText) +{ xCursor->goRight(1, false); }