[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/layout/data/tdf141079.odt |binary sw/qa/extras/layout/layout.cxx | 30 ++ sw/source/core/text/itrcrsr.cxx|8 ++-- 3 files changed, 36 insertions(+), 2 deletions(-) New commits: commit bf71581e49130e25a5f8961902ae38e87a8248e9 Author: Samuel Mehrbrodt AuthorDate: Thu Mar 18 11:41:29 2021 +0100 Commit: Miklos Vajna CommitDate: Fri Mar 26 16:56:11 2021 +0100 tdf#141079 Restore double click behavior for script fields Change-Id: I5daa730740ea042bdae56b832f2557ec974339b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112668 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt (cherry picked from commit 5302268de6a33716c7746aa13232746ad2f2b561) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113072 Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/layout/data/tdf141079.odt b/sw/qa/extras/layout/data/tdf141079.odt new file mode 100644 index ..65dfcb4a296f Binary files /dev/null and b/sw/qa/extras/layout/data/tdf141079.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 27eca2137324..642c6609f933 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3728,6 +3728,36 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testImageComment) CPPUNIT_ASSERT_EQUAL(static_cast(5), aPosition.nContent.GetIndex()); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testScriptField) +{ +// Test clicking script field inside table ( tdf#141079 ) +SwDoc* pDoc = createDoc("tdf141079.odt"); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +// Look up layout position which is the first cell in the table +SwRootFrame* pRoot = pWrtShell->GetLayout(); +CPPUNIT_ASSERT(pRoot->GetLower()->IsPageFrame()); +SwPageFrame* pPage = static_cast(pRoot->GetLower()); +CPPUNIT_ASSERT(pPage->GetLower()->IsBodyFrame()); +SwBodyFrame* pBody = static_cast(pPage->GetLower()); +CPPUNIT_ASSERT(pBody->GetLower()->IsTextFrame()); +SwTextFrame* pTextFrame = static_cast(pBody->GetLower()); +CPPUNIT_ASSERT(pTextFrame->GetNext()->IsTabFrame()); +SwFrame* pTable = pTextFrame->GetNext(); +SwFrame* pRow1 = pTable->GetLower(); +CPPUNIT_ASSERT(pRow1->GetLower()->IsCellFrame()); +SwFrame* pCell1 = pRow1->GetLower(); +CPPUNIT_ASSERT(pCell1->GetLower()->IsTextFrame()); +SwTextFrame* pCellTextFrame = static_cast(pCell1->GetLower()); +const SwRect& rCellRect = pCell1->getFrameArea(); +Point aPoint = rCellRect.Center(); +aPoint.setX(aPoint.getX() - rCellRect.Width() / 2); +// Ask for the doc model pos of this layout point. +SwPosition aPosition(*pCellTextFrame->GetTextNodeForFirstText()); +pCellTextFrame->GetModelPositionForViewPoint(, aPoint); +// Position was 1 without the fix from tdf#141079 +CPPUNIT_ASSERT_EQUAL(static_cast(0), aPosition.nContent.GetIndex()); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf64222) { createDoc("tdf64222.docx"); diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index cb830f327412..eacf4e0ac981 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -1542,8 +1542,12 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con { if (pPor->IsPostItsPortion()) { -// Offset would be nCurrStart + nLength below, do the same for post-it portions. -nCurrStart += pPor->GetLen(); +SwPostItsPortion* pPostItsPortion = dynamic_cast(pPor); +if (!pPostItsPortion->IsScript()) // tdf#141079 +{ +// Offset would be nCurrStart + nLength below, do the same for post-it portions. +nCurrStart += pPor->GetLen(); +} } return nCurrStart; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/rtfexport/rtfexport3.cxx | 47 sw/source/filter/ww8/rtfattributeoutput.cxx | 12 +-- sw/source/filter/ww8/rtfattributeoutput.hxx |2 - 3 files changed, 57 insertions(+), 4 deletions(-) New commits: commit a4bdd833a252ed4d942e4478fc820f9f2ee725fe Author: Miklos Vajna AuthorDate: Mon Mar 1 20:57:38 2021 +0100 Commit: Xisco Fauli CommitDate: Wed Mar 3 12:16:24 2021 +0100 tdf#140552 RTF export: fix hyperlink, in footnote, in hyperlink Regression from commit 7d42346ba77c9c4df241ea40eaf550993ca18783 (tdf#90421 RTF export: ignore hyperlinks without an URL, 2015-04-21), URLs can be nested in the footnote case, which requires a stack. Otherwise the inner URL clears "the" URL and we don't close the outer field as we believe it's empty, so it was not started. Change-Id: I9f87ddbb7e597c413bf836eb9b58beb76722361f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111794 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 5a74baa4f033f84c4bbcec869a68eef149f77161) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111778 Reviewed-by: Xisco Fauli Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111823 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 7bb20cbb410e..45f84f5c5089 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -13,6 +13,7 @@ #include #include #include +#include class Test : public SwModelTestBase { @@ -236,6 +237,52 @@ DECLARE_RTFEXPORT_TEST(testTdf112520, "tdf112520.docx") getProperty(getShape(3), "AnchorType")); } +CPPUNIT_TEST_FIXTURE(Test, testNestedHyperlink) +{ +// Given a hyperlink contains a footnote which contains a hyperlink: +{ +createSwDoc(); +uno::Reference xFactory(mxComponent, uno::UNO_QUERY); +uno::Reference xFootnote( +xFactory->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY); +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xText = xTextDocument->getText(); +uno::Reference xCursor = xText->createTextCursor(); +xText->insertString(xCursor, "a", /*bAbsorb=*/false); +xText->insertTextContent(xCursor, xFootnote, /*bAbsorb=*/false); +xText->insertString(xCursor, "b", /*bAbsorb=*/false); +xCursor->gotoStart(/*bExpand=*/false); +xCursor->gotoEnd(/*bExpand=*/true); +uno::Reference xCursorProps(xCursor, uno::UNO_QUERY); +xCursorProps->setPropertyValue("HyperLinkURL", uno::makeAny(OUString("http://body.com/;))); +uno::Reference xFootnoteText(xFootnote, uno::UNO_QUERY); +xCursor = xFootnoteText->createTextCursor(); +xFootnoteText->insertString(xCursor, "x", /*bAbsorb=*/false); +xCursor->gotoStart(/*bExpand=*/false); +xCursor->gotoEnd(/*bExpand=*/true); +xCursorProps.set(xCursor, uno::UNO_QUERY); +xCursorProps->setPropertyValue("HyperLinkURL", + uno::makeAny(OUString("http://footnote.com/;))); +} + +// When exporting to RTF: +// Without the accompanying fix in place, this test would have failed with: +// assertion failed +// - Expression: xComponent.is() +// i.e. the RTF output was not well-formed, loading failed. +reload(mpFilter, "nested-hyperlink.rtf"); + +// Then make sure both hyperlinks are have the correct URLs. +uno::Reference xParagraph = getParagraph(1); +uno::Reference xPortion = getRun(xParagraph, 1); +CPPUNIT_ASSERT_EQUAL(OUString("http://body.com/;), + getProperty(xPortion, "HyperLinkURL")); +auto xFootnote = getProperty>(getRun(xParagraph, 2), "Footnote"); +uno::Reference xFootnotePortion = getRun(getParagraphOfText(1, xFootnote), 1); +CPPUNIT_ASSERT_EQUAL(OUString("http://footnote.com/;), + getProperty(xFootnotePortion, "HyperLinkURL")); +} + DECLARE_RTFEXPORT_TEST(testTdf121623, "tdf121623.rtf") { // This was 2, multicolumn section was ignored at the table. diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 10d38a569e92..fe7f24e474be 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -530,7 +530,7 @@ void RtfAttributeOutput::EndRuby(const SwTextNode& rNode, sal_Int32 nPos) bool RtfAttributeOutput::StartURL(const OUString& rUrl, const OUString& rTarget) { -m_sURL = rUrl; +m_aURLs.push(rUrl); // Ignore hyperlink without a URL. if (!rUrl.isEmpty()) { @@ -560,7 +560,13 @@ bool RtfAttributeOutput::StartURL(const OUString& rUrl, const OUString& rTarget) bool RtfAttributeOutput::EndURL(bool const
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf134619_numberingProps.doc |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 14 + sw/source/filter/ww8/docxattributeoutput.cxx |8 +++ 3 files changed, 18 insertions(+), 4 deletions(-) New commits: commit 2f40c8f59cb23106e36071082d2570e2dbca4d22 Author: Justin Luth AuthorDate: Wed Jan 27 22:56:04 2021 +0300 Commit: Michael Stahl CommitDate: Fri Feb 26 13:19:49 2021 +0100 tdf#134619 docxexport: don't skip font properties in NumberingLevel This partially reverts LO 6.4.5 commit 598ca431de96d8bfcf18fa2945e9e30f98387474 The output set can contain more than just the font name. Things like colour and fontsize were being lost when the "else" clause was added. Since it looks like the main intent of the else clause was to avoid specifying a font name twice, erase that from the property set before writing out the rest of the font properties. There is a unit test that enforces that. (I was not able to reproduce the original problem that this was trying to fix. The entire commit is hard to revert, and I will assume that the rest of the commit is useful/accurate, so just fix up a careless portion of the commit.) Change-Id: I772e40e8bd75c0589f3308d4d7470229855aed8f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110034 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110169 Reviewed-by: Xisco Fauli (cherry picked from commit 5031a2932e9146db8b163ecfcaaf29e59cc4cc9d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110558 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/ooxmlexport/data/tdf134619_numberingProps.doc b/sw/qa/extras/ooxmlexport/data/tdf134619_numberingProps.doc new file mode 100644 index ..742b45ce6563 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf134619_numberingProps.doc differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index c300f7068110..04c4975056e4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -38,6 +38,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138892_noNumbering, "tdf138892_noNumbering.docx" CPPUNIT_ASSERT_MESSAGE("Para3: ", getProperty(getParagraph(3), "NumberingStyleName").isEmpty()); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134619_numberingProps, "tdf134619_numberingProps.doc") +{ +// Get the third paragraph's numbering style's 1st level's bullet size +uno::Reference xParagraph = getParagraph(3); +auto xLevels = getProperty< uno::Reference >(xParagraph, "NumberingRules"); +uno::Sequence aLevel; +xLevels->getByIndex(0) >>= aLevel; // 1st level +OUString aCharStyleName = std::find_if(aLevel.begin(), aLevel.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "CharStyleName"; })->Value.get(); + +// Make sure that the blue bullet's font size is 72 points, not 12 points. +uno::Reference xStyle(getStyles("CharacterStyles")->getByName(aCharStyleName), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(72.f, getProperty(xStyle, "CharHeight")); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFooterMarginLost, "footer-margin-lost.docx") { xmlDocUniquePtr pXmlDoc = parseExport(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 018a00c27392..013068e99335 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7127,6 +7127,7 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel, { m_pSerializer->startElementNS(XML_w, XML_rPr); +SfxItemSet aTempSet(*pOutSet); if ( pFont ) { GetExport().GetId( *pFont ); // ensure font info is written to fontTable.xml @@ -7136,11 +7137,10 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel, FSNS( XML_w, XML_hAnsi ), aFamilyName, FSNS( XML_w, XML_cs ), aFamilyName, FSNS( XML_w, XML_hint ), "default" ); +aTempSet.ClearItem(RES_CHRATR_FONT); +aTempSet.ClearItem(RES_CHRATR_CTL_FONT); } -else -{ -m_rExport.OutputItemSet(*pOutSet, false, true, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF); -} +m_rExport.OutputItemSet(aTempSet, false, true, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF); WriteCollectedRunProperties(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf140572_docDefault_superscript.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx |5 + sw/source/filter/ww8/docxattributeoutput.cxx|2 +- 3 files changed, 6 insertions(+), 1 deletion(-) New commits: commit 2f26a9c9242b8443f0fb987822404027053a98ff Author: Justin Luth AuthorDate: Tue Feb 23 15:22:47 2021 +0200 Commit: Xisco Fauli CommitDate: Thu Feb 25 10:12:23 2021 +0100 tdf#140572 docx export: avoid DocDefault superscript crash This fixes a crash situation introduced in LO 6.4 by commit d71cf6390a89ea6a4fab724e3a7996f28ca33661. The crash was occurring when the DocDefaults were being exported. Since there was no character or paragraph context, the lookup of the related fontsize was crashing. Moving this variable closer to where it is used "just happens" to fix the crash. Because the DocDefault is considered a style, we are just exporting the superscript/subscript as a default size, and so don't need to know the font size. Thus a style-context position can't cause the crash again. So it isn't a great fix, and leaves the possibility for the same thing to happen in other situations (like RES_CHRATR_BACKGROUND), but at least it quickly solves this known problem, and is easily backportable, as well as following best practice of keeping variables as close to where they are used as possible - eliminating some unnecessary lookups. I did look for a more generic fix (or whether other properties could be affected) and didn't come with any clear examples or a better fix. Change-Id: I03dc3d74a5148973c065cadb09c5c79068f12df1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111403 Tested-by: Jenkins Tested-by: Justin Luth Reviewed-by: Justin Luth (cherry picked from commit 76d2a9fd461dde817fbb1c5d4aa830cb2c42b504) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111458 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf140572_docDefault_superscript.docx b/sw/qa/extras/ooxmlexport/data/tdf140572_docDefault_superscript.docx new file mode 100755 index ..fd176dc8c896 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf140572_docDefault_superscript.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index c2d17d965781..c300f7068110 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -48,6 +48,11 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFooterMarginLost, "footer-margin-lost.do assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgMar", "footer", "709"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf140572_docDefault_superscript, "tdf140572_docDefault_superscript.docx") +{ +// A round-trip was crashing. +} + DECLARE_OOXMLEXPORT_TEST(testTdf138953, "croppedAndRotated.odt") { CPPUNIT_ASSERT_EQUAL(1, getShapes()); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 4f8773bef97b..018a00c27392 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7253,9 +7253,9 @@ void DocxAttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement ) if ( !sIss.isEmpty() ) m_pSerializer->singleElementNS(XML_w, XML_vertAlign, FSNS(XML_w, XML_val), sIss); -const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE); if (sIss.isEmpty() || sIss.match("baseline")) { +const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE); float fHeight = rItem.GetHeight(); OString sPos = OString::number( round(( fHeight * nEsc ) / 1000) ); m_pSerializer->singleElementNS(XML_w, XML_position, FSNS(XML_w, XML_val), sPos); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/footer-margin-lost.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx| 10 ++ sw/source/filter/ww8/docxattributeoutput.cxx | 11 +++ 3 files changed, 21 insertions(+) New commits: commit 77bc50ae97e2447ec997d32a91c93c5fa44a6fb3 Author: Miklos Vajna AuthorDate: Mon Jan 25 21:05:12 2021 +0100 Commit: Xisco Fauli CommitDate: Wed Jan 27 15:18:00 2021 +0100 tdf#134605 DOCX export: fix unexpected loss of footer margin Regression from commit 51534ac2b9747975945acb6a1e1ba5cc6d73f5c2 (tdf#127778 DOCX import: fix unexpected heading on non-first page ..., 2020-05-11), which replaced an import fix with an export fix. What was missed there is the import fix handled both headers and footers, while the export fix only handled headers. Fix the problem by doing the same mapping for footers: if a follow page style has no footer, but the first page style has, then take the margin from that one. The import side did the opposite of this already. (cherry picked from commit 80b360085f5974fbb3abe49a88b20f4d39704fb5) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport16.cxx Change-Id: Ibb191db4136bce0ad5e4bf14dcea15f5955bd298 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110008 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/footer-margin-lost.docx b/sw/qa/extras/ooxmlexport/data/footer-margin-lost.docx new file mode 100644 index ..d6a9d7bd8df9 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/footer-margin-lost.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index e12804e58289..c2d17d965781 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -38,6 +38,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138892_noNumbering, "tdf138892_noNumbering.docx" CPPUNIT_ASSERT_MESSAGE("Para3: ", getProperty(getParagraph(3), "NumberingStyleName").isEmpty()); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFooterMarginLost, "footer-margin-lost.docx") +{ +xmlDocUniquePtr pXmlDoc = parseExport(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 709 +// - Actual : 0 +// i.e. import + export lost the footer margin value. +assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgMar", "footer", "709"); +} + DECLARE_OOXMLEXPORT_TEST(testTdf138953, "croppedAndRotated.odt") { CPPUNIT_ASSERT_EQUAL(1, getShapes()); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index cc63cb5160ea..4f8773bef97b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -8547,6 +8547,17 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace ) sal_Int32 nFooter = 0; if ( aDistances.HasFooter() ) nFooter = sal_Int32( aDistances.dyaHdrBottom ); +else if (m_rExport.m_pFirstPageFormat) +{ +HdFtDistanceGlue aFirstPageDistances(m_rExport.m_pFirstPageFormat->GetAttrSet()); +if (aFirstPageDistances.HasFooter()) +{ +// The follow page style has no footer, but the first page style has. In Word terms, +// this means that the footer margin of "the" section is coming from the first page +// style. +nFooter = sal_Int32(aFirstPageDistances.dyaHdrBottom); +} +} // Page Bottom m_pageMargins.nBottom = aDistances.dyaBottom; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/croppedAndRotated.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |4 - sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 14 ++ sw/source/filter/ww8/docxattributeoutput.cxx| 42 sw/source/filter/ww8/docxattributeoutput.hxx|3 - 5 files changed, 45 insertions(+), 18 deletions(-) New commits: commit a9ec5c6e7b542e3c7788cdfe0aff4512e36491c6 Author: Mike Kaganski AuthorDate: Fri Dec 18 13:12:50 2020 +0300 Commit: Caolán McNamara CommitDate: Mon Dec 21 14:20:46 2020 +0100 tdf#138953: use original (cropped, but unrotated) object size in spPr This not only fixes the regression from b226383a83e41bbced9fc2a02dc09a449401ec97, but also makes the written size more correct than before, when it was slightly larger compared to original object size. Corrected unit test for tdf#116371 reflect that: the object in ODT is 241.78 mm x 240.61 mm. It previously was exported as 241.88 x 240.70; now the exported size is closer: 241.79 x 240.63. Change-Id: Ibfe85c7cd98c089e58af8d7f3848990af8e1100f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107957 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 3dc2e629b247873bfbd3190c11152d8d2bab1a03) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107997 Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/ooxmlexport/data/croppedAndRotated.odt b/sw/qa/extras/ooxmlexport/data/croppedAndRotated.odt new file mode 100644 index ..825db09da8bf Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/croppedAndRotated.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 1b9621b473b0..75d89da3f9a9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -594,8 +594,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116371, "tdf116371.odt") auto xShape(getShape(1)); CPPUNIT_ASSERT_DOUBLES_EQUAL(4700.0, getProperty(xShape, "RotateAngle"), 10); auto frameRect = getProperty(xShape, "FrameRect"); -CPPUNIT_ASSERT_EQUAL(sal_Int32(24070), frameRect.Height); -CPPUNIT_ASSERT_EQUAL(sal_Int32(24188), frameRect.Width); +CPPUNIT_ASSERT_EQUAL(sal_Int32(24063), frameRect.Height); +CPPUNIT_ASSERT_EQUAL(sal_Int32(24179), frameRect.Width); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFrameSizeExport, "floating-tables-anchor.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 174f2f0f7330..e12804e58289 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -38,6 +38,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138892_noNumbering, "tdf138892_noNumbering.docx" CPPUNIT_ASSERT_MESSAGE("Para3: ", getProperty(getParagraph(3), "NumberingStyleName").isEmpty()); } +DECLARE_OOXMLEXPORT_TEST(testTdf138953, "croppedAndRotated.odt") +{ +CPPUNIT_ASSERT_EQUAL(1, getShapes()); +CPPUNIT_ASSERT_EQUAL(1, getPages()); +// Make sure the rotation is exported correctly, and size not distorted +auto xShape(getShape(1)); +CPPUNIT_ASSERT_EQUAL(27000.0, getProperty(xShape, "RotateAngle")); +auto frameRect = getProperty(xShape, "FrameRect"); +// Before the fix, original object size (i.e., before cropping) was written to spPr in OOXML, +// and the resulting object size was much larger than should be. +CPPUNIT_ASSERT_EQUAL(sal_Int32(12961), frameRect.Height); +CPPUNIT_ASSERT_EQUAL(sal_Int32(8664), frameRect.Width); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index c7191ab8161a..cc63cb5160ea 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4813,13 +4813,12 @@ void DocxAttributeOutput::DefaultStyle() /* Writes tag back to document.xml if a file contains a cropped image. * NOTE : Tested on images of type JPEG,EMF/WMF,BMP, PNG and GIF. */ -void DocxAttributeOutput::WriteSrcRect(const SdrObject* pSdrObj, const SwFrameFormat* pFrameFormat ) +void DocxAttributeOutput::WriteSrcRect( +const css::uno::Reference& xShapePropSet, +const SwFrameFormat* pFrameFormat) { -uno::Reference< drawing::XShape > xShape( const_cast(pSdrObj)->getUnoShape(), uno::UNO_QUERY ); -uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY ); - uno::Reference xGraphic; -xPropSet->getPropertyValue("Graphic") >>= xGraphic; +xShapePropSet->getPropertyValue("Graphic") >>= xGraphic; const Graphic aGraphic(xGraphic); Size aOriginalSize(aGraphic.GetPrefSize()); @@ -4832,7 +4831,7 @@ void DocxAttributeOutput::WriteSrcRect(const SdrObject* pSdrObj, const SwFrameFo }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/odfexport/data/tdf103091.fodt |2 +- sw/qa/extras/odfexport/odfexport.cxx |2 +- sw/source/filter/xml/xmlfmt.cxx|8 +++- 3 files changed, 5 insertions(+), 7 deletions(-) New commits: commit 9d6fcca559d8dbfd77448b7aed9835c1fcae93f3 Author: Justin Luth AuthorDate: Mon Dec 7 17:11:18 2020 +0300 Commit: Michael Stahl CommitDate: Sat Dec 19 23:27:31 2020 +0100 tdf#82802 sw conditional style conditions not saved for TextBody Someone thought it would be a good idea for the built-in paragraph style Text Body to be special and support conditional formatting. It has been broken for import/export since 2015. It was mostly fixed in duplicate issue tdf#103091, but the side case of Text Body was missed. Partially reverting commit a5b4cb3f836c991d0647f55e1ef4920ce6115eac. xNewStyle didn't need to be a member variable since it is assigned to GetStyle anyway. Change-Id: I102d86c0b1f28e42b2c1350abc247b6b1f8acd4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107352 Tested-by: Justin Luth Reviewed-by: Justin Luth Reviewed-by: Michael Stahl (cherry picked from commit 4b5aaa9edfd58ec8f73de127410656f884f944d7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108000 Tested-by: Jenkins diff --git a/sw/qa/extras/odfexport/data/tdf103091.fodt b/sw/qa/extras/odfexport/data/tdf103091.fodt index c2c84115d01a..1da98f49d828 100644 --- a/sw/qa/extras/odfexport/data/tdf103091.fodt +++ b/sw/qa/extras/odfexport/data/tdf103091.fodt @@ -32,7 +32,7 @@ - + diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 6554b6abc38b..33356e1dd5ca 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1016,7 +1016,7 @@ DECLARE_ODFEXPORT_TEST(testTdf103091, "tdf103091.fodt") // check that all conditional paragraph style conditions are imported uno::Reference xParaStyles(getStyles("ParagraphStyles")); uno::Reference xStyle1(xParaStyles->getByName( -"Conditional"), uno::UNO_QUERY); +"Text Body"), uno::UNO_QUERY); auto conditions(getProperty>(xStyle1, "ParaStyleConditions")); CPPUNIT_ASSERT_EQUAL(sal_Int32(28), conditions.getLength()); diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 8bf022141423..b887fcfd6347 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -267,7 +267,6 @@ namespace { class SwXMLTextStyleContext_Impl : public XMLTextStyleContext { std::unique_ptr pConditions; -uno::Reference < style::XStyle > xNewStyle; protected: @@ -293,7 +292,7 @@ public: uno::Reference < style::XStyle > SwXMLTextStyleContext_Impl::Create() { - +uno::Reference < style::XStyle > xNewStyle; if( pConditions && XmlStyleFamily::TEXT_PARAGRAPH == GetFamily() ) { uno::Reference< lang::XMultiServiceFactory > xFactory( GetImport().GetModel(), @@ -317,12 +316,11 @@ uno::Reference < style::XStyle > SwXMLTextStyleContext_Impl::Create() void SwXMLTextStyleContext_Impl::Finish( bool bOverwrite ) { - -if( pConditions && XmlStyleFamily::TEXT_PARAGRAPH == GetFamily() && xNewStyle.is() ) +if( pConditions && XmlStyleFamily::TEXT_PARAGRAPH == GetFamily() && GetStyle().is() ) { CommandStruct const*const pCommands = SwCondCollItem::GetCmds(); -Reference< XPropertySet > xPropSet( xNewStyle, UNO_QUERY ); +Reference< XPropertySet > xPropSet( GetStyle(), UNO_QUERY ); uno::Sequence< beans::NamedValue > aSeq( pConditions->size() ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/core/layout/data/btlr-nested-cell.odt |binary sw/qa/core/layout/layout.cxx| 26 ++ sw/source/core/layout/ssfrm.cxx |3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) New commits: commit b4e9f8093daecec90e8294287029070262a634ac Author: Miklos Vajna AuthorDate: Mon Dec 14 21:05:02 2020 +0100 Commit: Xisco Fauli CommitDate: Wed Dec 16 13:13:26 2020 +0100 tdf#138600 sw: fix too small print area for btlr text in nested table Regression from commit 435ab51ec8920033b7865f27f4afee8a852a0b31 (tdf#128399 sw btlr: fix clicking to lower rotated cell, 2019-10-29), the bugdoc has a btlr table cell and the row frame of the outer table has a bottom value which is very small at the point when SwFrame::GetPaintArea() is invoked for the inner btlr cell. This means the "cell should not leave its parent" mechanism kicks in and reduces the bottom of the paint area to a small value, so the text is not visible at all. Fix the problem by teaching SwFrame::GetPaintArea() that btlr cell frames are OK to leave their parent towards the bottom of the page; that parent will grow at a later phase of the layout process anyway. Change-Id: I99334bbf0116df8d8ed27f192c81c0441b6c797d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107730 Tested-by: Jenkins Reviewed-by: Miklos Vajna Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107787 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107818 diff --git a/sw/qa/core/layout/data/btlr-nested-cell.odt b/sw/qa/core/layout/data/btlr-nested-cell.odt new file mode 100644 index ..ca7a4798db97 Binary files /dev/null and b/sw/qa/core/layout/data/btlr-nested-cell.odt differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 947152de49c6..6a6840f425a4 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -15,6 +15,8 @@ #include #include #include +#include +#include static char const DATA_DIRECTORY[] = "/sw/qa/core/layout/data/"; @@ -171,6 +173,30 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical) CPPUNIT_ASSERT(aShapeRect.IsInside(aFlyRect)); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) +{ +// Load a document with a nested table, the inner A1 cell has a btlr text direction. +load(DATA_DIRECTORY, "btlr-nested-cell.odt"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); +SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); +SwFrame* pPage = pLayout->GetLower(); +SwFrame* pBody = pPage->GetLower(); +SwFrame* pOuterTable = pBody->GetLower()->GetNext(); +SwFrame* pInnerTable = pOuterTable->GetLower()->GetLower()->GetLower(); + +// Check the paint area of the only text frame in the cell. +SwFrame* pTextFrame = pInnerTable->GetLower()->GetLower()->GetLower(); +long nFrameBottom = pTextFrame->getFrameArea().Bottom(); +SwRect aPaintArea = pTextFrame->GetPaintArea(); + +// Without the accompanying fix in place, this test would have failed with: +// - Expected greater or equal than: 2829 +// - Actual : 2080 +// i.e. part of the text frame area was not painted, hiding the actual text. +CPPUNIT_ASSERT_GREATEREQUAL(nFrameBottom, aPaintArea.Bottom()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 1a92144a5583..59d7d64afdd8 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -626,7 +626,8 @@ SwRect SwFrame::GetPaintArea() const pTmp->IsCellFrame() || pTmp->IsRowFrame() || //nobody leaves a table! pTmp->IsRootFrame() ) { -if( bLeft || aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 ) +// BTLR is OK to expand towards the physical down direction. Physical down is left. +if( bLeft || (aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 && !IsVertLRBT()) ) nLeft = nTmpLeft; if( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 ) nRight = nTmpRight; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/uitest/table/sheetToTable.py | 107 +++ sw/qa/uitest/writer_tests/data/hiddenRow.ods |binary sw/qa/uitest/writer_tests/data/tdf129083.odt |binary sw/source/uibase/dochdl/swdtflvr.cxx | 15 +++ 4 files changed, 119 insertions(+), 3 deletions(-) New commits: commit c8d335f9bfa6a6fd0887171e2b51035dcbb42078 Author: László Németh AuthorDate: Wed Dec 9 20:38:40 2020 +0100 Commit: Xisco Fauli CommitDate: Thu Dec 10 15:35:46 2020 +0100 tdf#138688 tdf#124646 sw: fix crash at pasting Calc data .. in a table before a numbered paragraph. Dispatcher calls of the workaround for tdf#124646 missed the temporary table in this case, selecting + copying nothing and after that trying to paste the same non-native Calc data again, resulting infinite recursion. Replacing FN_CHAR_LEFT with FN_LINE_UP solved the problem (FN_CHAR_LEFT selected the numbers of the numbered list instead of the temporary table). Fixing the fragile dispatcher calls, now we check the selection of the temporary table to avoid similar crashes. Unit tests are added for the fix, also for the original problem of tdf#124646 (avoid copying hidden rows from Calc, e.g. copying only visible result of a filtering). Regression from commit 0c3ac02d8a3c7ea50ae262daf134c28df5c8b343 (tdf#124646 Don't paste hidden rows of Calc sheets into Writer tables). (Note: to check/show the fix of the crash manually, run the test with $ (cd sw && make -srj8 UITest_sw_table UITEST_TEST_NAME="sheetToTable.sheetToTable.test_tdf138688" SAL_USE_VCLPLUGIN=gen) adding import time time.sleep(5) to the called function of sheetToTable.py) Change-Id: I7b90af8219d6fd00b75d91f7c92fff5744373cc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107508 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 7720f8cf22718415adb3db2304916581f864f884) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107487 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/uitest/table/sheetToTable.py b/sw/qa/uitest/table/sheetToTable.py new file mode 100644 index ..d14529d4af9e --- /dev/null +++ b/sw/qa/uitest/table/sheetToTable.py @@ -0,0 +1,107 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.uihelper.calc import enter_text_to_cell +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): +return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Calc sheet to Writer table + +class sheetToTable(UITestCase): +def test_sheet_to_table_without_hidden_rows(self): +calc_doc = self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) +xCalcDoc = self.xUITest.getTopFocusWindow() +self.xUITest.executeCommand(".uno:SelectAll") +self.xUITest.executeCommand(".uno:Copy") +gridwin = xCalcDoc.getChild("grid_window") +document = self.ui_test.get_component() +self.ui_test.close_doc() +writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) +document = self.ui_test.get_component() +xWriterDoc = self.xUITest.getTopFocusWindow() +self.xUITest.executeCommand(".uno:Paste") +#verify (don't copy hidden cells) +self.assertEqual(document.TextTables.getCount(), 1) +table = document.getTextTables()[0] +# This was 3 (copied hidden row) +self.assertEqual(len(table.getRows()), 2) +self.assertEqual(table.getCellByName("A1").getString(), "1") +# This was "2 (hidden)" (copied hidden row) +self.assertEqual(table.getCellByName("A2").getString(), "3") +self.ui_test.close_doc() + +def test_tdf138688(self): +calc_doc = self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) +xCalcDoc = self.xUITest.getTopFocusWindow() +self.xUITest.executeCommand(".uno:SelectAll") +self.xUITest.executeCommand(".uno:Copy") +gridwin = xCalcDoc.getChild("grid_window") +document = self.ui_test.get_component() +self.ui_test.close_doc() +writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) +document = self.ui_test.get_component() +xWriterDoc = self.xUITest.getTopFocusWindow() + +# set numbering in
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf123621.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport10.cxx |2 +- sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 11 +++ sw/source/core/layout/anchoreddrawobject.cxx | 12 ++-- 4 files changed, 22 insertions(+), 3 deletions(-) New commits: commit 92f1c430e4e77e71e7c914ad567d4970e5b2cd95 Author: Tibor Nagy AuthorDate: Thu Jul 9 09:54:15 2020 +0200 Commit: Xisco Fauli CommitDate: Wed Nov 25 18:08:10 2020 +0100 tdf#138130, tdf#123621 sw: fix textbox position according to DOCX i.e. when spAutoFit is present in DOCX, and size of the textbox is relative. See also commit cab956c480eb4f619580285c7b9a15b9e6d9b780 (tdf#112312 DOCX legacy shape export: keep fixed size). Co-authored-by: Attila Szűcs (NISZ) Change-Id: I29af97001954ad353a386164b68cd22f6230e3e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98401 Tested-by: László Németh Reviewed-by: László Németh Signed-off-by: Xisco Fauli This commit also includes: Clean-up of commit I29af97001954ad353a386164b68cd22f6230e3e5 Change-Id: I1963a5d899da2d122e60c4d87ca32aba4fb1f32a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102449 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106589 diff --git a/sw/qa/extras/ooxmlexport/data/tdf123621.docx b/sw/qa/extras/ooxmlexport/data/tdf123621.docx new file mode 100644 index ..471b6ef71e95 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123621.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index f209ed442175..87a5223ccd2b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -236,7 +236,7 @@ DECLARE_OOXMLEXPORT_TEST(testMceNested, "mce-nested.docx") // Vertical position of the shape was incorrect due to incorrect nested mce handling. uno::Reference xShape(getShape(1), uno::UNO_QUERY); // positionV's posOffset from the bugdoc, was 0. -CPPUNIT_ASSERT(6985 <= getProperty(xShape, "VertOrientPosition")); +CPPUNIT_ASSERT(6879 <= getProperty(xShape, "VertOrientPosition")); // This was -1 (default), make sure the background color is set. CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), getProperty(xShape, "FillColor")); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 1950b8349697..1fd8ad4a7d84 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -30,6 +30,17 @@ protected: } }; +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123621, "tdf123621.docx") +{ +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +assertXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor" +"/wp:positionV/wp:posOffset", "1080135"); +} + + DECLARE_OOXMLEXPORT_TEST(testTdf14_followPgStyle, "tdf14_followPgStyle.odt") { CPPUNIT_ASSERT_EQUAL(2, getPages()); diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 2cbe4bab0f3b..a908300b0e0c 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -34,6 +34,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -681,8 +682,15 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth()); } -long nTargetHeight = aCurrObjRect.GetHeight( ); -if ( GetDrawObj( )->GetRelativeHeight( ) ) +bool bCheck = GetDrawObj()->GetRelativeHeight(); +if (bCheck) +{ +auto pObjCustomShape = dynamic_cast(GetDrawObj()); +bCheck = !pObjCustomShape || !pObjCustomShape->IsAutoGrowHeight(); +} + +long nTargetHeight = aCurrObjRect.GetHeight(); +if (bCheck) { long nHeight = 0; if (GetDrawObj()->GetRelativeHeightRelation() == text::RelOrientation::FRAME) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/core/undo/data/textbox-cut-undo.docx |binary sw/qa/core/undo/undo.cxx | 34 + sw/source/core/undo/undobj1.cxx|7 + 3 files changed, 41 insertions(+) New commits: commit bce74af0eb8b9fff8c9b6b99c4a314d98f626570 Author: Miklos Vajna AuthorDate: Mon Nov 23 21:02:44 2020 +0100 Commit: Caolán McNamara CommitDate: Wed Nov 25 11:21:26 2020 +0100 tdf#138253 sw textbox: fix content of draw format on undo Regression from commit da4f9b77a6cd39b1ae5babdd476d1575c8b9371c (tdf#135149 sw: fix deleting textbox of as-char shapes, 2020-09-07), the crash was caused by a user-after-free triggered from the X11 clipboard code. This could happen beause the clipboard document had a draw frame format, which has an SwNode pointer, but the SwNode instance was outside that clipboard document, and the owning document is already gone. So by the time the clipboard document would be deleted, the SwNodeIndex can't de-register itself. The root cause was that the doc model was corrupted after a cut of a textbox + undo: the textbox pointers of the fly/draw formats were OK, but not the SwFormatContent of the draw format. (cherry picked from commit 42e8e16cf93dcf944e5c1106f76aaa32057c0397) Conflicts: sw/source/core/layout/atrfrm.cxx Change-Id: I5761b72948caca397320aed801559e8493c33e1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106539 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/qa/core/undo/data/textbox-cut-undo.docx b/sw/qa/core/undo/data/textbox-cut-undo.docx new file mode 100644 index ..35f0e857173e Binary files /dev/null and b/sw/qa/core/undo/data/textbox-cut-undo.docx differ diff --git a/sw/qa/core/undo/undo.cxx b/sw/qa/core/undo/undo.cxx index aeacffc78e9b..e43d154f3a66 100644 --- a/sw/qa/core/undo/undo.cxx +++ b/sw/qa/core/undo/undo.cxx @@ -10,11 +10,17 @@ #include #include +#include +#include #include #include #include #include +#include +#include +#include +#include char const DATA_DIRECTORY[] = "/sw/qa/core/undo/data/"; @@ -50,6 +56,34 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutSave) xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); } +CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutUndo) +{ +load(DATA_DIRECTORY, "textbox-cut-undo.docx"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDocShell* pDocShell = pTextDoc->GetDocShell(); +SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); +SwDoc* pDoc = pDocShell->GetDoc(); +SwView* pView = pDoc->GetDocShell()->GetView(); + +pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, SfxCallMode::SYNCHRON); +pView->StopShellTimer(); +rtl::Reference pTransfer = new SwTransferable(*pWrtShell); +pTransfer->Cut(); +SwFrameFormats& rSpzFrameFormats = *pDoc->GetSpzFrameFormats(); +CPPUNIT_ASSERT_EQUAL(static_cast(0), rSpzFrameFormats.size()); + +pWrtShell->Undo(); +CPPUNIT_ASSERT_EQUAL(static_cast(2), rSpzFrameFormats.size()); + +const SwNodeIndex* pIndex1 = rSpzFrameFormats[0]->GetContent().GetContentIdx(); +const SwNodeIndex* pIndex2 = rSpzFrameFormats[1]->GetContent().GetContentIdx(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 5 +// - Actual : 8 +// i.e. the draw frame format had a wrong node index in its content. +CPPUNIT_ASSERT_EQUAL(pIndex1->GetIndex(), pIndex2->GetIndex()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 0f969713862a..2398ea8dad09 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -130,6 +130,13 @@ void SwUndoFlyBase::InsFly(::sw::UndoRedoContext & rContext, bool bShowSelFrame) pSdrObject->setUnoShape(nullptr); } } +if (m_pFrameFormat->Which() == RES_DRAWFRMFMT) +{ +// This is a draw format and we just set the fly format's textbox pointer to this draw +// format. Sync the draw format's content with the fly format's content. +SwFrameFormat* pFlyFormat = m_pFrameFormat->GetOtherTextBoxFormat(); +m_pFrameFormat->SetFormatAttr(pFlyFormat->GetContent()); +} } m_pFrameFormat->MakeFrames(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/layout/data/tdf138039.odt |binary sw/qa/extras/layout/layout.cxx | 24 ++ sw/source/core/layout/tabfrm.cxx | 36 ++--- 3 files changed, 57 insertions(+), 3 deletions(-) New commits: commit 6f1cee347ea5057a3a1244d2f669fbb3fd272cbc Author: Michael Stahl AuthorDate: Fri Nov 13 20:51:42 2020 +0100 Commit: Caolán McNamara CommitDate: Mon Nov 16 21:26:58 2020 +0100 tdf#138039 tdf#134298 sw: layout: fix overlap of fly and table The layout is horribly borked, the fly anchored in the body-level paragraph messed with the preceding table: page id="1" top="284" width="11905" height="16837" bottom="17120" tab id="3" top="794" row id="4" top="17121" fly id="8" top="16725" txt id="7" top="1394" fly ptr="0x6ce5510" id="10" top="1302" SwTabFrame::CalcFlyOffsets() detects an overlap with the large fly, and since it has wrap NONE it resizes to below the large image. Then the SwTabFrame doesn't fit on the page, so it is split, but the split fails because nDistanceToUpperPrtBottom is -720 (negative); hence it is joined again. Meanwhile the fly was invalidated, so now CalcFlyOffsets() ignores it and the table shrinks again. Once the fly is positioned again, the process repeats from the start. Fix this in SwTabFrame::CalcFlyOffsets() by ignoring flys with wrap NONE that extend below the body of the document and are anchored in a frame in the next-chain of the table frame: these must move to the next page with their anchor frame. For the bugdoc this gives the same layout as LO 5.2. Reportedly this problem started to happen since commit 6f5024de2e1a5cc533527e45b33d9a415467c48d, but it's not obvious why. Change-Id: Iafb8a6afcba634f11c5db73869313ded0fe13bbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105809 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 6b92d2e8522ecc98d2c5532f5076c20ae295168e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105935 Reviewed-by: Mike Kaganski Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/layout/data/tdf138039.odt b/sw/qa/extras/layout/data/tdf138039.odt new file mode 100644 index ..f355fd1349a6 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf138039.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 038ee2812785..acf877c323bf 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -1123,6 +1123,30 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) } } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf138039) +{ +createDoc("tdf138039.odt"); + +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + +// there are 3 pages +assertXPath(pXmlDoc, "/root/page", 3); +// table on first page +assertXPath(pXmlDoc, "/root/page[1]/body/tab", 1); +assertXPath(pXmlDoc, "/root/page[1]/body/txt", 0); +// paragraph with large fly on second page +assertXPath(pXmlDoc, "/root/page[2]/body/tab", 0); +assertXPath(pXmlDoc, "/root/page[2]/body/txt", 1); +assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly", 1); +assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "top", "17915"); +assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "height", +"15819"); +// paragraph on third page +assertXPath(pXmlDoc, "/root/page[3]/body/tab", 0); +assertXPath(pXmlDoc, "/root/page[3]/body/txt", 1); +assertXPath(pXmlDoc, "/root/page[3]/body/txt[1]/anchored", 0); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableOverlapFooterFly) { // Load a document that has a fly anchored in the footer. diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index b89b21b9205a..009099250954 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2706,6 +2706,21 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) aNotify.SetInvaKeep(); } +static bool IsNextOnSamePage(SwPageFrame const& rPage, +SwTabFrame const& rTabFrame, SwTextFrame const& rAnchorFrame) +{ +for (SwContentFrame const* pContentFrame = rTabFrame.FindNextCnt(); +pContentFrame && pContentFrame->FindPageFrame() == +pContentFrame = pContentFrame->FindNextCnt()) +{ +if (pContentFrame == ) +{ +return true; +} +} +return false; +} + /// Calculate the offsets arising because of FlyFrames bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, long& rLeftOffset, @@ -2835,10 +2850,25 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, if (bShiftDown) { +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter.cxx | 95 + sw/source/uibase/wrtsh/wrtsh1.cxx |7 -- 2 files changed, 95 insertions(+), 7 deletions(-) New commits: commit 5f31629d88207b5842eb3dafcbf6948d0d52bb24 Author: Xisco Fauli AuthorDate: Wed Nov 4 17:30:07 2020 +0100 Commit: Xisco Fauli CommitDate: Thu Nov 5 11:55:07 2020 +0100 tdf#137532: do not reset attributes deleting selection Regression from 6abed0ea006f3616e40faf2ae782cf64f8ac2914 While at it, extend unittest for tdf#79717 to test another regression from the same commit I found while testing the patch: type 'a', type bold 'b', select both characters, type 'c' -> it should be bold Change-Id: I5b0b8ce4bfdfb4d52051e25c366827d7b594bb1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105316 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli this also includes commit tdf#79717: sw_uiwriter: Add unittest Change-Id: I866cbc057113003e5bbbd20e2e5812a1045b5133 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105300 Tested-by: Jenkins Reviewed-by: Xisco Fauli Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105329 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 0529ef6e4ab9..32788114c15f 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -209,6 +209,8 @@ public: void testCreatePortions(); void testBookmarkUndo(); void testFdo85876(); +void testTdf79717(); +void testTdf137532(); void testFdo87448(); void testTextCursorInvalidation(); void testTdf68183(); @@ -430,6 +432,8 @@ public: CPPUNIT_TEST(testCreatePortions); CPPUNIT_TEST(testBookmarkUndo); CPPUNIT_TEST(testFdo85876); +CPPUNIT_TEST(testTdf79717); +CPPUNIT_TEST(testTdf137532); CPPUNIT_TEST(testFdo87448); CPPUNIT_TEST(testTextCursorInvalidation); CPPUNIT_TEST(testTdf68183); @@ -1976,6 +1980,97 @@ void SwUiWriterTest::testFdo85876() } } +void SwUiWriterTest::testTdf79717() +{ +SwDoc* const pDoc = createDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +pWrtShell->Insert("normal"); +lcl_setWeight(pWrtShell, WEIGHT_BOLD); +pWrtShell->Insert("bold"); +pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); +// Select 'bol' and replace it +pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 3, /*bBasicCall=*/false); +pWrtShell->Insert("bol"); + +// Without the fix in place, 'bol' would have been replaced with normal font weight + +auto xText = getParagraph(1)->getText(); +CPPUNIT_ASSERT(xText.is()); +{ +auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 1))); +CPPUNIT_ASSERT(xCursor.is()); +CPPUNIT_ASSERT_EQUAL(OUString("normal"), xCursor->getString()); +CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty(xCursor, "CharWeight")); +} +{ +auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 2))); +CPPUNIT_ASSERT(xCursor.is()); +CPPUNIT_ASSERT_EQUAL(OUString("bold"), xCursor->getString()); +CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty(xCursor, "CharWeight")); +} + +// Now select characters from both runs and replace them +pWrtShell->EndPara(); +pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 5, /*bBasicCall=*/false); +pWrtShell->Insert("new"); +{ +auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 1))); +CPPUNIT_ASSERT(xCursor.is()); +CPPUNIT_ASSERT_EQUAL(OUString("norma"), xCursor->getString()); +CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty(xCursor, "CharWeight")); +} +{ +auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 2))); +CPPUNIT_ASSERT(xCursor.is()); +CPPUNIT_ASSERT_EQUAL(OUString("new"), xCursor->getString()); +CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty(xCursor, "CharWeight")); +} +} + +void SwUiWriterTest::testTdf137532() +{ +SwDoc* const pDoc = createDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +pWrtShell->Insert("test"); + +//Select the word and change it to bold +pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 4, /*bBasicCall=*/false); +lcl_setWeight(pWrtShell, WEIGHT_BOLD); + +// Select first character and replace it +pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); +pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); +pWrtShell->Insert("x"); + +auto xText = getParagraph(1)->getText(); +CPPUNIT_ASSERT(xText.is()); +auto
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/core/frmedt/data/paste-fly-in-textbox.docx |binary sw/qa/core/frmedt/frmedt.cxx | 30 sw/source/core/frmedt/fecopy.cxx | 42 +++ 3 files changed, 72 insertions(+) New commits: commit bdda0c123b28531f515c37faf804d9ed1659074f Author: Miklos Vajna AuthorDate: Mon Nov 2 21:01:14 2020 +0100 Commit: Caolán McNamara CommitDate: Tue Nov 3 21:58:38 2020 +0100 tdf#135893 sw paste: fix copying fly frame in textbox twice Regression from commit c7307c77254557646f33017af915f6808a861e29 (fdo#82191 sw::DocumentLayoutManager: copy textbox content of draw formats, 2014-08-15), the problem is that the fly+draw format copies the fly content recursively already, so when we would copy all special formats of the document, the inner fly frame is copied twice. This is normally not a problem for fly frames (where you can't select multiple fly frames at the same time), nor a problem for draw frames (which have no sw content), but it's a problem for the combination of these, TextBoxes. Fix the problem by ignoring fly frames which are anchored in such TextBoxes: we do the same for fly frames which have an associated draw format already. (cherry picked from commit 3ac675736066b47da7329269a01c1ef4a9cfe72a) Conflicts: sw/qa/core/frmedt/frmedt.cxx Change-Id: I3376beb414f91abfa6f3f5640f825ccae34911c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105247 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/qa/core/frmedt/data/paste-fly-in-textbox.docx b/sw/qa/core/frmedt/data/paste-fly-in-textbox.docx new file mode 100644 index ..75bf13b13b67 Binary files /dev/null and b/sw/qa/core/frmedt/data/paste-fly-in-textbox.docx differ diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx index c737187887c9..d0929c25d7f8 100644 --- a/sw/qa/core/frmedt/frmedt.cxx +++ b/sw/qa/core/frmedt/frmedt.cxx @@ -19,6 +19,7 @@ #include #include #include +#include static char const DATA_DIRECTORY[] = "/sw/qa/core/frmedt/data/"; @@ -106,6 +107,35 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testVertPosFromBottomBoundingBox) CPPUNIT_ASSERT_EQUAL(-1 * nPagePrintAreaBottom, aBoundRect.Pos().getY()); } +CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testPasteFlyInTextBox) +{ +// Given a document that contains a textbox, which contains an sw image (fly frame) +load(DATA_DIRECTORY, "paste-fly-in-textbox.docx"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDocShell* pDocShell = pTextDoc->GetDocShell(); +SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); +SwDoc* pDoc = pDocShell->GetDoc(); +SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); +SdrObject* pObject = pPage->GetObj(0); +pWrtShell->SelectObj(Point(), 0, pObject); +CPPUNIT_ASSERT_EQUAL(static_cast(3), pDoc->GetSpzFrameFormats()->GetFormatCount()); +rtl::Reference pTransfer = new SwTransferable(*pWrtShell); +pTransfer->Cut(); +CPPUNIT_ASSERT_EQUAL(static_cast(0), pDoc->GetSpzFrameFormats()->GetFormatCount()); +TransferableDataHelper aHelper(pTransfer.get()); + +// When pasting that to an empty document. +SwTransferable::Paste(*pWrtShell, aHelper); + +// Then we should have the image only once: 3 formats (draw+fly formats for the textbox and a +// fly format for the image). +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 3 +// - Actual : 4 +// i.e. the image was pasted twice. +CPPUNIT_ASSERT_EQUAL(static_cast(3), pDoc->GetSpzFrameFormats()->GetFormatCount()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 2522c039ce0d..67027a4c5b9e 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -671,6 +671,41 @@ namespace { { return rPaM.HasMark() && *rPaM.GetPoint() != *rPaM.GetMark(); } + +/// Is pFormat anchored in a fly frame which has an associated draw format? +bool IsInTextBox(const SwFrameFormat* pFormat) +{ +const SwFormatAnchor& rAnchor = pFormat->GetAnchor(); +const SwPosition* pPosition = rAnchor.GetContentAnchor(); +if (!pPosition) +{ +return false; +} + +const SwStartNode* pFlyNode = pPosition->nNode.GetNode().FindFlyStartNode(); +if (!pFlyNode) +{ +return false; +} + +for ( const auto& pSpzFormat : *pFormat->GetDoc()->GetSpzFrameFormats() ) +{ +if (pSpzFormat->Which() != RES_FLYFRMFMT) +{ +continue; +} + +const SwNodeIndex* pIdx = pSpzFormat->GetContent().GetContentIdx(); +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf136453.fodt | 66 ++ sw/qa/extras/uiwriter/uiwriter.cxx| 51 +++ sw/source/core/undo/undel.cxx |3 - 3 files changed, 119 insertions(+), 1 deletion(-) New commits: commit 815f58fe60dca8ee41f362748a144fc16c89b1f9 Author: Michael Stahl AuthorDate: Tue Oct 27 16:33:30 2020 +0100 Commit: Xisco Fauli CommitDate: Wed Oct 28 13:20:57 2020 +0100 tdf#136453 sw_redlinehide: SwUndoDelete: only create extra frames... ... at the start if the section nodes were at the start. m_bBackSp and m_bJoinNext can't both be true. (regression from 740f1796504f66408b692225a9676c9ee3d63722) Change-Id: I999ed3809ca8f527bc3e754b229df02da4576825 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104891 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit c4967928475f2be20ac2d79e3fa84ac435a7e560) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104846 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/data/tdf136453.fodt b/sw/qa/extras/uiwriter/data/tdf136453.fodt new file mode 100644 index ..2234957e1db8 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf136453.fodt @@ -0,0 +1,66 @@ + +http://www.w3.org/TR/css3-text/; xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:d r3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + foo + bar + +baz + + + + diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index e824be2ae56c..0529ef6e4ab9 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1207,6 +1207,57 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf134252) CPPUNIT_ASSERT_EQUAL(OUString(""), xCursor->getString()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf136453) +{ +load(DATA_DIRECTORY, "tdf136453.fodt"); + +SwXTextDocument *const pTextDoc(dynamic_cast(mxComponent.get())); +CPPUNIT_ASSERT(pTextDoc); +SwDoc* const pDoc(pTextDoc->GetDocShell()->GetDoc()); +SwWrtShell *const pWrtShell(pDoc->GetDocShell()->GetWrtShell()); + +sal_uLong const nNodes(pDoc->GetNodes().Count()); + +pWrtShell->SttEndDoc(false); +pWrtShell->SetMark(); +pWrtShell->Up(true, 1); +pWrtShell->SttPara(true); +pWrtShell->Delete(); + +// one paragraph deleted, section is gone +CPPUNIT_ASSERT_EQUAL(nNodes - 3, pDoc->GetNodes().Count()); + +pWrtShell->Undo(); + +CPPUNIT_ASSERT_EQUAL(nNodes, pDoc->GetNodes().Count()); + +// check that every node has 1 frame +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +assertXPath(pXmlDoc, "/root/page[1]/body/txt", 3); +assertXPath(pXmlDoc, "/root/page[1]/body/section", 1); +assertXPath(pXmlDoc, "/root/page[1]/body/section/txt", 1); + +pWrtShell->Redo(); + +// one paragraph deleted, section is gone +CPPUNIT_ASSERT_EQUAL(nNodes - 3, pDoc->GetNodes().Count()); + +discardDumpedLayout(); +pXmlDoc = parseLayoutDump(); +assertXPath(pXmlDoc, "/root/page[1]/body/txt",
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ww8export/ww8export3.cxx |5 + sw/source/filter/ww8/wrtww8.cxx |6 +- 2 files changed, 10 insertions(+), 1 deletion(-) New commits: commit 19b8ded3ae18dd4070a3e21d7b980782a27e5547 Author: Justin Luth AuthorDate: Mon Sep 28 20:21:52 2020 +0300 Commit: Miklos Vajna CommitDate: Mon Oct 19 17:19:11 2020 +0200 tdf#136983 partial revert NFC ww8 cleanup: remove unused variables This is a partial revert of LO 6.2 commit 2ec0cf500222aef55d02df80154b47fbb92970c9 I can't think of any excuse for how I possibly missed that xDocProps was being defined/used outside of this clause. Just plain stupid and blind. The good news is that the create and modified date still seem to be getting saved somehow/somewhere. So it isn't the disaster that it looks like it could have been. Change-Id: I72ef56fa50b9e92e4ce687b132b1919cfae6c1f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103565 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 1086654d6e8cc22f1f99195668db3f305437e570) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104495 Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index c88c23dbc581..a663a034074b 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -51,6 +52,10 @@ DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.d // tdf#127862: page fill color (in this case white) was lost uno::Reference xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty(xStyle, "FillStyle")); + +// tdf#136983 +uno::Reference xDPS(mxComponent, uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Last printed date", sal_Int16(2009), xDPS->getDocumentProperties()->getPrintDate().Year); } DECLARE_WW8EXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc") diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 9b5980f3e5e1..b3e71ba0f747 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -497,7 +497,11 @@ static void WriteDop( WW8Export& rWrt ) uno::Reference xProps; if ( pDocShell ) { -xProps.set(pDocShell->GetModel(), uno::UNO_QUERY); +uno::Reference xModelComp = pDocShell->GetModel(); +xProps.set(xModelComp, uno::UNO_QUERY); +uno::Reference xDPS(xModelComp, uno::UNO_QUERY_THROW); +xDocProps = xDPS->getDocumentProperties(); +OSL_ENSURE(xDocProps.is(), "DocumentProperties is null"); rDop.lKeyProtDoc = pDocShell->GetModifyPasswordHash(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter2.cxx | 83 sw/source/core/edit/autofmt.cxx | 25 +++--- 2 files changed, 100 insertions(+), 8 deletions(-) New commits: commit 3f554879aa90a73940041e3a1217b97a15e18bc3 Author: Michael Stahl AuthorDate: Thu Oct 15 16:47:42 2020 +0200 Commit: Caolán McNamara CommitDate: Fri Oct 16 14:13:54 2020 +0200 tdf#137245 sw: fix AutoFormat SetBorder deleting flys Since commit e1629c210ad78310e3d48c0756723134a27b89df ReplaceRange() will preserve flys, so split the delete into a DeleteAndJoin() just to join the paragraphs - which should not delete any flys because it doesn't include the "---" so isn't at the end of the section - and a ReplaceRange for the "---". (regression from 28b77c89dfcafae82cf2a6d85731b643ff9290e5 and e75dd1fc992f168f24d66595265a978071cdd277) Change-Id: Ib995e41649f69963c823a463538958d533082ee7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104380 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 9b34dc20b6946698ae6ce2d5d859885bfb444633) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104335 Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 91400f397c9c..1354244a8fc1 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -38,6 +38,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -331,6 +334,86 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineSplitContentNode) rUndoManager.Undo(); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137245) +{ +SwDoc* const pDoc(createDoc()); +SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); +corr.GetSwFlags().bSetBorder = true; +// sigh, it's a global... err i mean Singleton design pattern *eyeroll* +SvxSwAutoFormatFlags flags(*SwEditShell::GetAutoFormatFlags()); +comphelper::ScopeGuard const g([=]() { SwEditShell::SetAutoFormatFlags(); }); +flags.bSetBorder = true; +SwEditShell::SetAutoFormatFlags(); + +{ +SwFormatAnchor anchor(RndStdIds::FLY_AT_PARA); +anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint()); +SfxItemSet flySet(pDoc->GetAttrPool(), + svl::Items{}); +flySet.Put(anchor); +SwFormatFrameSize size(SwFrameSize::Minimum, 1000, 1000); +flySet.Put(size); // set a size, else we get 1 char per line... +SwFrameFormat const* pFly = pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true); +CPPUNIT_ASSERT(pFly != nullptr); +} +{ +SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR); +anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint()); +SfxItemSet flySet(pDoc->GetAttrPool(), + svl::Items{}); +flySet.Put(anchor); +SwFormatFrameSize size(SwFrameSize::Minimum, 1000, 1000); +flySet.Put(size); // set a size, else we get 1 char per line... +SwFrameFormat const* pFly = pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true); +CPPUNIT_ASSERT(pFly != nullptr); +} +// move cursor back to body +pWrtShell->SttEndDoc(false); +// keep first paragraph empty so that its flys may be deleted too +//pWrtShell->Insert("abc"); +pWrtShell->SplitNode(false); + +{ +SwFormatAnchor anchor(RndStdIds::FLY_AT_PARA); +anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint()); +SfxItemSet flySet(pDoc->GetAttrPool(), + svl::Items{}); +flySet.Put(anchor); +SwFormatFrameSize size(SwFrameSize::Minimum, 1000, 1000); +flySet.Put(size); // set a size, else we get 1 char per line... +SwFrameFormat const* pFly = pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true); +CPPUNIT_ASSERT(pFly != nullptr); +} +{ +SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR); +anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint()); +SfxItemSet flySet(pDoc->GetAttrPool(), + svl::Items{}); +flySet.Put(anchor); +SwFormatFrameSize size(SwFrameSize::Minimum, 1000, 1000); +flySet.Put(size); // set a size, else we get 1 char per line... +SwFrameFormat const* pFly = pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true); +CPPUNIT_ASSERT(pFly != nullptr); +} + +const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); +CPPUNIT_ASSERT_EQUAL(static_cast(4), rFormats.size()); + +// move cursor back to body +pWrtShell->SttEndDoc(false); +pWrtShell->Insert("---"); +pWrtShell->SplitNode(true); + +CPPUNIT_ASSERT_EQUAL(static_cast(4), rFormats.size()); + +// check that the AutoFormat did something +pWrtShell->SttEndDoc(true); +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/uiwriter/data2/try2.fodt | 66 ++ sw/qa/extras/uiwriter/uiwriter2.cxx | 42 + sw/source/core/text/txtfrm.cxx|1 sw/source/core/txtnode/ndtxt.cxx | 26 - 4 files changed, 109 insertions(+), 26 deletions(-) New commits: commit 6600403ad3f743c16eb4aef33627e7dbce3b153d Author: Michael Stahl AuthorDate: Mon Oct 12 17:43:28 2020 +0200 Commit: Caolán McNamara CommitDate: Wed Oct 14 10:30:59 2020 +0200 sw_redlinehide: fix crash in SwTextNode::SplitContentNode() Bug happens in the "top" branch of SplitContentNode(). SwTextNode::CutImpl() sends several hints to the SwTextFrame so that it invalidates itself; a SwInsText and a SwDelText most prominently. The SwInsText won't have an effect because the target node doesn't have text frames yet, but the SwDelText should be sufficient to update the text frames' MergedPara and invalidate the text frames. The MergedPara is re-created by SwTextFrame::RegisterToNode() anyway, but that *doesn't* invalidate the SwTextFrame. Then an additional SwDelText is sent, which will *not* invalidate the SwTextFrame, because its MergedPara is up-to-date so nothing gets deleted by the hint. It's unclear why the LockModify() is done here, since CVS initial import, perhaps it's some premature optimization; try to remove the manual sending of SwDelText and just let CutImpl() do it. Also remove an odd assert in UpdateMergedParaForMove() that i don't understand the reason for now. Change-Id: Iba7196556f614356dba4def74f039a88f392eb0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104219 Tested-by: Michael Stahl Reviewed-by: Michael Stahl (cherry picked from commit fefc0dfdcedbd0ef9d32c32be356f8086e756b33) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104252 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/uiwriter/data2/try2.fodt b/sw/qa/extras/uiwriter/data2/try2.fodt new file mode 100644 index ..624a75a85ea9 --- /dev/null +++ b/sw/qa/extras/uiwriter/data2/try2.fodt @@ -0,0 +1,66 @@ + + +http://www.w3.org/TR/css3-text/; xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:d r3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Unknown Author + 2020-10-12T19:26:19 + + + + + + + Unknown Author + 2020-10-12T19:26:26 + + + + + A + xxx + yy + + + diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 3702ce76a15e..91400f397c9c 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -289,6 +289,48 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineInHiddenSection) CPPUNIT_ASSERT(pNode->GetNodes()[pNode->GetIndex() + 4]->IsEndNode()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineSplitContentNode) +{ +load(DATA_DIRECTORY, "try2.fodt"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwWrtShell*
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx|6 ++ sw/source/filter/ww8/wrtw8nds.cxx |4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) New commits: commit 270604a11022ab4fb9a3ac299d9a42e1d8464c47 Author: Justin Luth AuthorDate: Sat Sep 5 13:38:04 2020 +0300 Commit: Michael Stahl CommitDate: Thu Oct 1 10:42:21 2020 +0200 tdf#136441 ms export: don't export comments in footnotes Microsoft UI does not allow comments in footnotes, or in headers/footers, or endnotes, so just throw them away for all MS formats. This avoids the biggest problem, which was an error in LO reading the DOCX. Prior to this bug fix, the status was: DOCX: Word 2016 opens it ok, but no comment in footnote. Word 2003 hangs. LO loads but has a SAX error the user must ignore, and no comment seen in the footnote anyway. DOC: Word 2016 opens, but misses the main body text, and of course no comment in footnote. Word 2003 opens, sees the main body text just fine, and no comment in footnote. LO loads, but no comment seen in footnote anyway. RTF: Word 2016/2003 open, and no comment in footnote. LO loads, but no comment seen in footnote anyway. If the SAX error problem could be fixed, then perhaps it would be worth allowing LO to export comments to DOCX for its own benefit. In that case, allow case SwFieldIds::Postit: PostitField( pField ); This patch does not fix the problem where the body text is missing in Word 2016 in DOC format. Change-Id: I0b7389616a2207d41ae525dbc0b2eea536364d90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102074 Tested-by: Jenkins Reviewed-by: Justin Luth Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103630 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt b/sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt new file mode 100644 index ..61c9632b3972 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index ab204e9c5e67..1950b8349697 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -114,6 +114,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135973, "tdf135973.odt") } } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf136441_commentInFootnote, "tdf136441_commentInFootnote.odt") +{ +// failed to load without error if footnote contained a comment. +// (MS Word's UI doesn't allow adding comments to a footnote.) +} + DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx") { CPPUNIT_ASSERT_EQUAL(2, getPages()); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index ec6f63cb222b..4f3b98089658 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2392,7 +2392,9 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) // Append bookmarks in this range after flys, exclusive of final // position of this range AppendBookmarks( rNode, nCurrentPos, nNextAttr - nCurrentPos ); -AppendAnnotationMarks(aAttrIter, nCurrentPos, nNextAttr - nCurrentPos); +//Sadly only possible for word in main document text +if ( m_nTextTyp == TXT_MAINTEXT ) +AppendAnnotationMarks(aAttrIter, nCurrentPos, nNextAttr - nCurrentPos); // At the moment smarttags are only written for paragraphs, at the // beginning of the paragraph. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf131420.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport12.cxx |6 ++ sw/source/filter/ww8/docxattributeoutput.cxx |2 ++ 3 files changed, 8 insertions(+) New commits: commit 589ae9b70346e3fae768c4e7aafbc7c504861987 Author: Tibor Nagy AuthorDate: Mon Aug 10 10:51:20 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Sep 15 16:54:41 2020 +0200 tdf#131420 DOCX export: fix missing border of frame Co-authored-by: Attila Szűcs (NISZ) Change-Id: If6ce28aab938eaf22fe578f8880e139b7b4eb22c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100418 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 49e2bd6103669ca94d4e308fc08beed57f85c7e2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102754 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf131420.docx b/sw/qa/extras/ooxmlexport/data/tdf131420.docx new file mode 100644 index ..3600735245af Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf131420.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 15ae1de673ce..1ae45cb04183 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1069,6 +1069,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116883, "tdf116883.docx") } } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131420, "tdf131420.docx") +{ +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); +assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:pPr/w:pBdr[2]"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 9dc7a4122ec2..329dc349431c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1240,10 +1240,12 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar if (!m_bWritingHeaderFooter && m_pCurrentFrame) { const SwFrameFormat& rFrameFormat = m_pCurrentFrame->GetFrameFormat(); +const SvxBoxItem& rBox = rFrameFormat.GetBox(); if (TextBoxIsFramePr(rFrameFormat)) { const Size aSize = m_pCurrentFrame->GetSize(); PopulateFrameProperties(, aSize); +FormatBox(rBox); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/core/crsr/crsr.cxx | 29 + sw/qa/core/crsr/data/sel-all-starts-with-table.odt |binary sw/source/core/crsr/callnk.cxx |5 ++- sw/source/core/doc/docfmt.cxx |1 4 files changed, 33 insertions(+), 2 deletions(-) New commits: commit ffc8cc8d7891ef4be1a364116a2bc9075f51b2b9 Author: Miklos Vajna AuthorDate: Mon Sep 14 21:02:31 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Sep 15 10:50:26 2020 +0200 tdf#135682 sw: fix lost selection-all when doc starts with table Regression from commit c56bf1479cc71d1a2b0639f6383e90c1f7e3655b (tdf#105330 sw: fix lost cursor on undoing nested table insert, 2019-09-16), the problem was that the change reverted lcl_notifyRow() back to its original state, because it seemed the conditional notification is no longer needed. However, this broke the fix for tdf#37606 (ability to select-all when the doc starts with a table). Fix the problem by handling the starts-with-table case similar to a normal table selection, so there is still no need to restore the nested table visitor code but select-all works nicely with starts-with-table documents again. (cherry picked from commit 6f1e02c96b887750f974c187a82ecd6236e6a435) Change-Id: Icb823a39432d1774a63a0c633c172bba827ac76d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102704 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/core/crsr/crsr.cxx b/sw/qa/core/crsr/crsr.cxx index 9345fdde6dd6..e1664f70a839 100644 --- a/sw/qa/core/crsr/crsr.cxx +++ b/sw/qa/core/crsr/crsr.cxx @@ -15,6 +15,13 @@ #include #include +#include + +#include +#include +#include + +char const DATA_DIRECTORY[] = "/sw/qa/core/crsr/data/"; /// Covers sw/source/core/crsr/ fixes. class SwCoreCrsrTest : public SwModelTestBase @@ -72,6 +79,28 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testFindReplace) CPPUNIT_ASSERT_EQUAL(OUString("bar"), aActualStart); } +CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testSelAllStartsWithTable) +{ +load(DATA_DIRECTORY, "sel-all-starts-with-table.odt"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDocShell* pDocShell = pTextDoc->GetDocShell(); +SwDoc* pDoc = pDocShell->GetDoc(); +SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + +CPPUNIT_ASSERT_EQUAL(static_cast(1), pDoc->GetTableFrameFormatCount(/*bUsed=*/true)); + +pWrtShell->SelAll(); +pWrtShell->SelAll(); +Scheduler::ProcessEventsToIdle(); +pWrtShell->DelLeft(); + +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 0 +// - Actual : 1 +// i.e. the table selection was lost and the table was not deleted. +CPPUNIT_ASSERT_EQUAL(static_cast(0), pDoc->GetTableFrameFormatCount(/*bUsed=*/true)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/core/crsr/data/sel-all-starts-with-table.odt b/sw/qa/core/crsr/data/sel-all-starts-with-table.odt new file mode 100644 index ..a368095a55cf Binary files /dev/null and b/sw/qa/core/crsr/data/sel-all-starts-with-table.odt differ diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index 90905da63b7a..f6c277036920 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -59,7 +59,7 @@ SwCallLink::SwCallLink( SwCursorShell & rSh ) } } -static void lcl_notifyRow(const SwContentNode* pNode, SwCursorShell const & rShell) +static void lcl_notifyRow(const SwContentNode* pNode, SwCursorShell & rShell) { if ( !pNode ) return; @@ -76,11 +76,12 @@ static void lcl_notifyRow(const SwContentNode* pNode, SwCursorShell const & rShe const SwTableLine* pLine = pRow->GetTabLine( ); -if (rShell.IsTableMode()) +if (rShell.IsTableMode() || (rShell.StartsWithTable() && rShell.ExtendedSelectedAll())) { // If we have a table selection, then avoid the notification: it's not necessary (the text // cursor needs no updating) and the notification may kill the selection overlay, leading to // flicker. +// Same for whole-document selection when it starts with a table. return; } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 230337e9d22a..7b877a7cddb2 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1955,6 +1955,7 @@ void SwDoc::dumpAsXml(xmlTextWriterPtr pWriter) const mpFrameFormatTable->dumpAsXml(pWriter, "frmFormatTable"); mpSpzFrameFormatTable->dumpAsXml(pWriter, "spzFrameFormatTable"); mpSectionFormatTable->dumpAsXml(pWriter); +mpTableFrameFormatTable->dumpAsXml(pWriter, "tableFrameFormatTable"); mpNumRuleTable->dumpAsXml(pWriter); getIDocumentRedlineAccess().GetRedlineTable().dumpAsXml(pWriter);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source writerfilter/Library_writerfilter.mk writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf123386.docx |binary sw/qa/extras/ooxmlexport/data/tdf123389.docx |binary sw/qa/extras/ooxmlexport/data/tdf133647.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 46 ++ sw/source/filter/ww8/docxattributeoutput.cxx | 35 ++-- writerfilter/Library_writerfilter.mk |6 +- writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 +++ writerfilter/source/dmapper/PropertyIds.cxx |2 writerfilter/source/dmapper/PropertyIds.hxx |2 9 files changed, 91 insertions(+), 8 deletions(-) New commits: commit 8f1cb34bdb523e17478de2b0ef7d745c29743df7 Author: László Németh AuthorDate: Mon Aug 17 14:00:54 2020 +0200 Commit: Xisco Fauli CommitDate: Wed Sep 2 15:50:03 2020 +0200 tdf133647 tdf123386 tdf123389 fix DOCX table formula export Keep original DOCX table formula during round-trip using grab-bagging. This is a temporary solution until fixing formula export and a proposed solution for formula cannot be converted. Follow-up of commit 68e74bdf63e992666016c790e8e4cfd5b28d6abe (tdf133647 tdf123386 tdf123389 Improved .docx table formula import). Change-Id: Ia4759e250c06e9cc0495fb0b57fccd1ee1f50da9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100872 Tested-by: Jenkins Reviewed-by: László Németh Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101758 diff --git a/sw/qa/extras/ooxmlexport/data/tdf123386.docx b/sw/qa/extras/ooxmlexport/data/tdf123386.docx new file mode 100644 index ..1278068ddedf Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123386.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf123389.docx b/sw/qa/extras/ooxmlexport/data/tdf123389.docx new file mode 100644 index ..4245464b820d Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123389.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf133647.docx b/sw/qa/extras/ooxmlexport/data/tdf133647.docx new file mode 100644 index ..fb525446c7fc Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133647.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 78737104c2e2..0ea9cc9f7ed9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -998,6 +998,52 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133163, "tdf133163.fodt") assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:tc/w:p/w:r[2]/w:instrText", " = SUM(A1:A3)"); } +DECLARE_OOXMLEXPORT_TEST(testTdf133647, "tdf133647.docx") +{ +xmlDocUniquePtr pXmlDoc = parseExport(); +if (!pXmlDoc) +return; + +// Keep original formula during round-trip +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[4]/w:p/w:r[2]/w:instrText", " = SUM(A1,B1)"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[5]/w:tc[4]/w:p/w:r[2]/w:instrText", " = SUM(C1:D1)"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[6]/w:tc[4]/w:p/w:r[2]/w:instrText", " = SUM(A1,5,B1:C1,6)"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[7]/w:tc[4]/w:p/w:r[2]/w:instrText", " = (1+2)*SUM(C1,D1)"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[8]/w:tc[4]/w:p/w:r[2]/w:instrText", " = 3*(2+SUM(A1:C1)+7)"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[9]/w:tc[4]/w:p/w:r[2]/w:instrText", " = 1+(SUM(1,2))"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[10]/w:tc[4]/w:p/w:r[2]/w:instrText", " = (SUM(C1,5)*(2+7))*(3+SUM(1,B1))"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[11]/w:tc[4]/w:p/w:r[2]/w:instrText", " = sum(a1,b1)"); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf123386, "tdf123386.docx") +{ +xmlDocUniquePtr pXmlDoc = parseExport(); +if (!pXmlDoc) +return; + +// Keep original formula during round-trip +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[4]/w:p/w:r[2]/w:instrText", " = A1 < 2"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[4]/w:p/w:r[2]/w:instrText", " = B1 > 1"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[5]/w:tc[4]/w:p/w:r[2]/w:instrText", " = C1=3"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[6]/w:tc[4]/w:p/w:r[2]/w:instrText", " = D1 <> 3"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[7]/w:tc[4]/w:p/w:r[2]/w:instrText", " = AND(A1=1,B1=2)"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[8]/w:tc[4]/w:p/w:r[2]/w:instrText", " = AND((A1<1),(B1<>2))"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[9]/w:tc[4]/w:p/w:r[2]/w:instrText", " = OR(A1=1,B1=2)"); +assertXPathContent(pXmlDoc,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ww8export/ww8export2.cxx |1 + sw/source/filter/ww8/ww8par6.cxx |6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) New commits: commit 1e4bb55c1dba650077ef68953e7cd6514a43d781 Author: Justin Luth AuthorDate: Mon Aug 31 14:40:55 2020 +0300 Commit: Caolán McNamara CommitDate: Tue Sep 1 13:35:29 2020 +0200 tdf#136282 ww8import: track para bidi, not char bidi for style This fixes a LO 7.0 regression from tdf#99197. Apparently I was watching the wrong SPRM for bidi change in styles. It looks like it should be sprmPFBiDi: A Bool8 value that specifies whether the paragraph uses right-to-left layout. By default, a paragraph does not use right-to-left layout. Instead, I had been using sprmCFBiDi: A ToggleOperand value that specifies whether the text is formatted with right-to-left layout. By default, text is displayed from right to left if the language for the text is a right-to-left language. [So this one looks like a character run property.] I no longer remember why I used CfBiDi. Perhaps just because it sets m_bBiDi which sounds good? However, there are no existing unit tests that have a CFBiDi in a style, but there are examples with CFBiDi. I'm really surprised that QA didn't have any documents that picked up on this regression. I was counting on that... Change-Id: If5a115db5962e7e26ca1b280cd9f31d493cee69c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101726 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna (cherry picked from commit fb8334aa79e811bb6780e072e24d2580932f1031) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101686 Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 46cae102045d..8c29d0446b26 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -346,6 +346,7 @@ DECLARE_WW8EXPORT_TEST(testTdf112074_RTLtableJustification, "tdf112074_RTLtableJ DECLARE_WW8EXPORT_TEST(testTdf98620_rtlJustify, "tdf98620_rtlJustify.doc") { CPPUNIT_ASSERT_EQUAL( style::ParagraphAdjust_RIGHT, static_cast(getProperty(getParagraph(1), "ParaAdjust")) ); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Right To Left style", text::WritingMode2::RL_TB, getProperty(getParagraph(1), "WritingMode")); } DECLARE_WW8EXPORT_TEST(testTdf121110_absJustify, "tdf121110_absJustify.doc") diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index f070a50976ca..99d9c22ce2ee 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -403,6 +403,9 @@ void SwWW8ImplReader::Read_ParaBiDi(sal_uInt16, const sal_uInt8* pData, short nL } NewAttr(SvxFrameDirectionItem(eDir, RES_FRAMEDIR)); + +if ( m_pCurrentColl && m_xStyles )// in style definition +m_xStyles->mbBidiChanged = true; } } @@ -3071,9 +3074,6 @@ void SwWW8ImplReader::Read_Bidi(sal_uInt16, const sal_uInt8* pData, short nLen) m_bBidi = true; sal_uInt8 nBidi = *pData; NewAttr( SfxInt16Item( RES_CHRATR_BIDIRTL, (nBidi!=0)? 1 : 0 ) ); - -if( m_pCurrentColl && m_xStyles )// in style definition -m_xStyles->mbBidiChanged = true; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf131801.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx| 53 ++ sw/source/core/attr/swatrset.cxx | 10 sw/source/core/text/txtfld.cxx| 31 +++- sw/source/core/unocore/unoobj.cxx | 11 sw/source/filter/ww8/wrtw8nds.cxx |3 - writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 - 7 files changed, 103 insertions(+), 9 deletions(-) New commits: commit 6aff5d2e913bebe858ced534ef059166683c7d6a Author: Vasily Melenchuk AuthorDate: Tue Aug 18 17:59:26 2020 +0200 Commit: Michael Stahl CommitDate: Fri Aug 28 20:42:41 2020 +0200 tdf#131801: sw: support of style references in ListAutoFormat ListAutoFormat property did support char attributes, but not style references ("CharStyleName"). It is important for correct formatting of pilcrow symbol or list format in some DOCX scenarios. Export to DOCX already works, but not to RTF/DOC. Change-Id: I1bf23d1e45fcc213adcf9aa6f404be803919fbee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100893 Tested-by: Michael Stahl Reviewed-by: Michael Stahl (cherry picked from commit c77b9c349f0a48392d8cb7a49532844b2cafb5ba) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101559 Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/data/tdf131801.docx b/sw/qa/extras/ooxmlexport/data/tdf131801.docx new file mode 100644 index ..61872b5399f5 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf131801.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index f585934c896f..f17d9ad3f668 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -9,6 +9,7 @@ #include +#include #include char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/"; @@ -39,6 +40,58 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133370_columnBreak, "tdf133370_columnBreak.odt") CPPUNIT_ASSERT_EQUAL(1, getPages()); } +DECLARE_OOXMLIMPORT_TEST(testTdf131801, "tdf131801.docx") +{ +CPPUNIT_ASSERT_EQUAL(1, getPages()); + +xmlDocUniquePtr pDump = parseLayoutDump(); +// "1." is red +CPPUNIT_ASSERT_EQUAL(OUString("1."), getXPath(pDump, "//page[1]/body/txt[1]/Special", "rText")); +CPPUNIT_ASSERT_EQUAL(OUString("00ff"), getXPath(pDump, "//page[1]/body/txt[1]/Special/SwFont", "color")); +// "2." is red +CPPUNIT_ASSERT_EQUAL(OUString("2."), getXPath(pDump, "//page[1]/body/txt[2]/Special", "rText")); +CPPUNIT_ASSERT_EQUAL(OUString("00ff"), getXPath(pDump, "//page[1]/body/txt[2]/Special/SwFont", "color")); +// "3." is black +CPPUNIT_ASSERT_EQUAL(OUString("3."), getXPath(pDump, "//page[1]/body/txt[3]/Special", "rText")); +CPPUNIT_ASSERT_EQUAL(OUString(""), getXPath(pDump, "//page[1]/body/txt[3]/Special/SwFont", "color")); +// "4." is black +CPPUNIT_ASSERT_EQUAL(OUString("4."), getXPath(pDump, "//page[1]/body/txt[4]/Special", "rText")); +CPPUNIT_ASSERT_EQUAL(OUString(""), getXPath(pDump, "//page[1]/body/txt[4]/Special/SwFont", "color")); +// "5." is red +CPPUNIT_ASSERT_EQUAL(OUString("5."), getXPath(pDump, "//page[1]/body/txt[5]/Special", "rText")); +CPPUNIT_ASSERT_EQUAL(OUString("00ff"), getXPath(pDump, "//page[1]/body/txt[5]/Special/SwFont", "color")); +// "6." is red +CPPUNIT_ASSERT_EQUAL(OUString("6."), getXPath(pDump, "//page[1]/body/txt[6]/Special", "rText")); +CPPUNIT_ASSERT_EQUAL(OUString("00ff"), getXPath(pDump, "//page[1]/body/txt[6]/Special/SwFont", "color")); +// "7." is black +CPPUNIT_ASSERT_EQUAL(OUString("7."), getXPath(pDump, "//page[1]/body/txt[7]/Special", "rText")); +CPPUNIT_ASSERT_EQUAL(OUString(""), getXPath(pDump, "//page[1]/body/txt[7]/Special/SwFont", "color")); +// "8." is black +CPPUNIT_ASSERT_EQUAL(OUString("8."), getXPath(pDump, "//page[1]/body/txt[8]/Special[1]", "rText")); +CPPUNIT_ASSERT_EQUAL(OUString(""), getXPath(pDump, "//page[1]/body/txt[8]/Special[1]/SwFont", "color")); + +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:rStyle", +"val", "Emphasis"); +assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:rStyle", +"val", "Emphasis"); +assertXPath(pXmlDocument, "/w:document/w:body/w:p[3]/w:pPr/w:rPr/w:rStyle", 0); +assertXPath(pXmlDocument, "/w:document/w:body/w:p[4]/w:pPr/w:rPr/w:rStyle", 0); +assertXPath(pXmlDocument, "/w:document/w:body/w:p[5]/w:pPr/w:rPr/w:rStyle", +"val", "Emphasis"); +assertXPath(pXmlDocument, "/w:document/w:body/w:p[5]/w:pPr/w:rPr/w:sz", +"val", "32"); +assertXPath(pXmlDocument,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/frame.fodt | 75 +++ sw/qa/extras/ooxmlexport/ooxmlexport6.cxx| 23 sw/source/filter/ww8/attributeoutputbase.hxx |2 sw/source/filter/ww8/docxattributeoutput.cxx | 24 sw/source/filter/ww8/docxattributeoutput.hxx |1 sw/source/filter/ww8/ww8atr.cxx |9 +++ 6 files changed, 134 insertions(+) New commits: commit 990245577df21b5ffd6fbaa548500731f31b1d36 Author: Michael Stahl AuthorDate: Wed Aug 26 17:08:00 2020 +0200 Commit: Caolán McNamara CommitDate: Thu Aug 27 15:41:16 2020 +0200 sw: DOCX export: don't export text frames as transparent Writer paints text frames without fill still as opaque but nothing is written in the DOCX file and Word by default treats DrawingML text frame as transparent (the VML fallback is opaque though). Change-Id: I0ce539ac8084c5047b4732abc5c199589ee369ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101411 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit d84e590486e2c26212931de80a84181d7aca7bbe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101426 Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/ooxmlexport/data/frame.fodt b/sw/qa/extras/ooxmlexport/data/frame.fodt new file mode 100644 index ..c474b8de5e9e --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/frame.fodt @@ -0,0 +1,75 @@ + + +http://www.w3.org/TR/css3-text/; xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:d r3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + opaque + + + + solid + + + + transparent + + + + + diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 123a339c6232..7702b935f3fe 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -149,6 +149,29 @@ DECLARE_OOXMLEXPORT_TEST(testDMLSolidfillAlpha, "dml-solidfill-alpha.docx") CPPUNIT_ASSERT_EQUAL(sal_Int16(20), getProperty(xShape, "FillTransparence")); } +DECLARE_OOXMLEXPORT_TEST(testDMLTextFrameNoFill, "frame.fodt") +{ +// Problem is that default text frame background is white in Writer and transparent in Word +uno::Reference xShape1(getShape(1), uno::UNO_QUERY); +// it is re-imported as solid +//CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty(xShape1, "FillStyle")); +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty(xShape1, "FillStyle")); +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(xShape1, "FillTransparence")); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff), getProperty(xShape1, "FillColor")); + +uno::Reference xShape2(getShape(2), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty(xShape2, "FillStyle")); +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(xShape2, "FillTransparence")); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0xE8F2A1), getProperty(xShape2, "FillColor")); + +uno::Reference xShape3(getShape(3), uno::UNO_QUERY);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf135973.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 20 +++ sw/source/filter/ww8/wrtw8num.cxx | 30 + sw/source/filter/ww8/wrtww8.hxx |3 sw/source/filter/ww8/ww8atr.cxx | 158 +--- 5 files changed, 106 insertions(+), 105 deletions(-) New commits: commit 892329fc88116cbe70f0d92f8d307775840595b4 Author: Vasily Melenchuk AuthorDate: Sun Aug 23 14:02:40 2020 +0300 Commit: Michael Stahl CommitDate: Thu Aug 27 10:39:56 2020 +0200 tdf#135973: DOCX export: improved list override support Removed remains of old override support which are not working now. Partial refactoring and fixing for listid and overrides detection. Change-Id: I1f94a09b7d51fcc3300b056d6d9e8ea6367a4446 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101238 Tested-by: Jenkins Reviewed-by: Thorsten Behrens Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101437 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/ooxmlexport/data/tdf135973.odt b/sw/qa/extras/ooxmlexport/data/tdf135973.odt new file mode 100644 index ..0eb42080f9d6 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf135973.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 8dd905a6405b..f585934c896f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -39,6 +39,26 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133370_columnBreak, "tdf133370_columnBreak.odt") CPPUNIT_ASSERT_EQUAL(1, getPages()); } +DECLARE_OOXMLEXPORT_TEST(testTdf135973, "tdf135973.odt") +{ +CPPUNIT_ASSERT_EQUAL(1, getPages()); +{ +uno::Reference xPara(getParagraph(2), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(3), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("2."), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(5), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(6), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("2."), getProperty(xPara, "ListLabelString")); +} +} DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx") { diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index df51bb99be36..87a6cb68f111 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -86,22 +86,19 @@ sal_uInt16 MSWordExportBase::OverrideNumRule( OUString const& rListId, SwNumRule const& rAbstractRule) { -auto const numdef = GetNumberingId(rExistingRule); -auto const absnumdef = rListId == rAbstractRule.GetDefaultListId() +const sal_uInt16 numdef = GetNumberingId(rExistingRule); + +const sal_uInt16 absnumdef = rListId == rAbstractRule.GetDefaultListId() ? GetNumberingId(rAbstractRule) : DuplicateAbsNum(rListId, rAbstractRule); auto const mapping = std::make_pair(numdef, absnumdef); -auto it = m_OverridingNumsR.find(mapping); -if (it == m_OverridingNumsR.end()) -{ -it = m_OverridingNumsR.insert(std::make_pair(mapping, m_pUsedNumTable->size())).first; -m_OverridingNums.insert(std::make_pair(m_pUsedNumTable->size(), mapping)); +auto it = m_OverridingNums.insert(std::make_pair(m_pUsedNumTable->size(), mapping)); -m_pUsedNumTable->push_back(nullptr); // dummy, it's unique_ptr... -++m_nUniqueList; // counter for DuplicateNumRule... -} -return it->second; +m_pUsedNumTable->push_back(nullptr); // dummy, it's unique_ptr... +++m_nUniqueList; // counter for DuplicateNumRule... + +return it.first->first; } void MSWordExportBase::AddListLevelOverride(sal_uInt16 nListId, @@ -143,17 +140,6 @@ sal_uInt16 MSWordExportBase::GetNumberingId( const SwNumRule& rNumRule ) SwNumRule* p = const_cast(); sal_uInt16 nRet = static_cast(m_pUsedNumTable->GetPos(p)); -// Is this list now duplicated into a new list which we should use -// #i77812# - perform 'deep' search in duplication map -std::map::const_iterator aResult = m_aRuleDuplicates.end(); -do { -aResult = m_aRuleDuplicates.find(nRet); -if ( aResult != m_aRuleDuplicates.end() ) -{ -nRet = (*aResult).second; -} -} while ( aResult != m_aRuleDuplicates.end() ); - return nRet; } diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 8753314664ca..50d762f6e358 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -455,8 +455,6 @@ public: std::unique_ptr m_pUsedNumTable; // all used NumRules /// overriding
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/uiwriter/data2/tdf132160.odt |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 18 ++ sw/source/core/doc/DocumentRedlineManager.cxx |5 + 3 files changed, 23 insertions(+) New commits: commit d172e9eeff21851670fd5da7c585a9ca46e02253 Author: Michael Stahl AuthorDate: Tue Aug 25 14:44:39 2020 +0200 Commit: Caolán McNamara CommitDate: Wed Aug 26 10:58:47 2020 +0200 (related: tdf#132160) sw: fix lcl_RejectRedline if end is on table node This happens on Undo: sw/source/core/undo/undobj.cxx:1394: void SwRedlineSaveData::RedlineToDoc(const SwPaM&): Assertion `result != IDocumentRedlineAccess::AppendResult::IGNORED' failed. Because the SwRedlineSaveData was created in SwUndoDelete ctor from this: (rr) p *pRedl $18 = (SwRangeRedline) { = SwPaM = { point = SwPosition (node 13457, offset 0), mark = SwPosition (node 13455, offset 0) }, (rr) p pRedl->GetPoint()->nNode.GetNode().GetNodes()[13457] $19 = (SwTableNode *) 0x80bdbe0 DelFullPara() will delete the end node, see "m_rDoc.GetNodes().Delete( aRg.aStart, nNodeDiff+1 );" or equivalent in SwUndoDelete. So if the end is on a start node, set it back to the previous node, because deleting just a start node is a bad idea. Change-Id: Ib7c35c103ce05ede39e66505fa47fa70bfece018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101334 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit e2fe4fde592564d35099ad1e2659ad682dfb77f5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101351 Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/uiwriter/data2/tdf132160.odt b/sw/qa/extras/uiwriter/data2/tdf132160.odt new file mode 100644 index ..8a8ae7b8b1cb Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf132160.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 01d05d963b3c..3702ce76a15e 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1706,6 +1706,24 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122942) CPPUNIT_ASSERT(rOutRect2.Top() > rOutRect1.Top() && rOutRect2.Top() < rOutRect1.Bottom()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132160) +{ +load(DATA_DIRECTORY, "tdf132160.odt"); + +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +// this would crash due to delete redline starting with ToX +dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {}); + +// this would crash due to insert redline ending on table node +dispatchCommand(mxComponent, ".uno:Undo", {}); + +dispatchCommand(mxComponent, ".uno:Redo", {}); + +dispatchCommand(mxComponent, ".uno:Undo", {}); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf52391) { load(DATA_DIRECTORY, "tdf52391.fodt"); diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index ace591d95dae..f3aaa13a60d1 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -660,6 +660,11 @@ namespace { aPam.GetBound().nContent.Assign( nullptr, 0 ); aPam.GetBound( false ).nContent.Assign( nullptr, 0 ); +if (aPam.End()->nNode.GetNode().IsStartNode()) +{ // end node will be deleted too! see nNodeDiff+1 +--aPam.End()->nNode; +} +assert(!aPam.End()->nNode.GetNode().IsStartNode()); rDoc.getIDocumentContentOperations().DelFullPara( aPam ); } else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/layout/data/tdf128198-1.docx |binary sw/qa/extras/layout/layout.cxx| 21 + sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |6 -- sw/source/core/text/itrform2.cxx |3 ++- 4 files changed, 23 insertions(+), 7 deletions(-) New commits: commit 81082204ca500c40c5f2e7d615422747c973a6ac Author: Michael Stahl AuthorDate: Mon Aug 10 19:14:54 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Aug 11 17:37:15 2020 +0200 tdf#128198 sw: text formatting: only consider upper margin for first line The non-first lines start below the first one so the margin is already included in the previous line's Y position. Also move the testTdf116486 to layout.cxx. (regression from d07fc485d46f431405a3f6a002f951a08c559677) Change-Id: I574516ea5f9600e2d861e43162b1a69488c68819 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100440 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 99ef50f97b6d8461b8953c2555298c7bbeb3405b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100369 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlimport/data/tdf116486.docx b/sw/qa/extras/layout/data/tdf116486.docx similarity index 100% rename from sw/qa/extras/ooxmlimport/data/tdf116486.docx rename to sw/qa/extras/layout/data/tdf116486.docx diff --git a/sw/qa/extras/layout/data/tdf128198-1.docx b/sw/qa/extras/layout/data/tdf128198-1.docx new file mode 100644 index ..7c9974d562b9 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf128198-1.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index d2fba4c8299e..44512e2ce8a2 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -1164,6 +1164,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277) xmlXPathNodeSetGetLength(pXmlNodes)); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116486) +{ +SwDoc* pDoc = createDoc("tdf116486.docx"); +CPPUNIT_ASSERT(pDoc); +OUString aTop = parseDump("/root/page/body/txt/Special", "nHeight"); +CPPUNIT_ASSERT_EQUAL(OUString("4006"), aTop); +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128198) +{ +SwDoc* pDoc = createDoc("tdf128198-1.docx"); +CPPUNIT_ASSERT(pDoc); +xmlDocUniquePtr pLayout = parseLayoutDump(); +// the problem was that line 5 was truncated at "this " +// due to the fly anchored in previous paragraph +assertXPath(pLayout, "/root/page/body/txt[2]/LineBreak[5]", "Line", +"to access any service, any time, anywhere. From this perspective, satellite " +"boasts some "); +assertXPath(pLayout, "/root/page/body/txt[2]/LineBreak[6]", "Line", "significant advantages. "); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testNoLineBreakAtSlash) { load(DATA_DIRECTORY, "no-line-break-at-slash.fodt"); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 78e79add953a..1c3b36535c6e 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -418,12 +418,6 @@ DECLARE_OOXMLIMPORT_TEST(testTdf114217, "tdf114217.docx") CPPUNIT_ASSERT_EQUAL(0, getShapes()); } -DECLARE_OOXMLIMPORT_TEST(testTdf116486, "tdf116486.docx") -{ -OUString aTop = parseDump("/root/page/body/txt/Special", "nHeight"); -CPPUNIT_ASSERT_EQUAL(OUString("4006"), aTop); -} - DECLARE_OOXMLIMPORT_TEST(testTdf119200, "tdf119200.docx") { auto xPara = getParagraph(1); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 61621611fb73..8d0cda953729 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -2357,7 +2357,8 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo ) // tdf#116486: consider also the upper margin from getFramePrintArea because intersections // with this additional space should lead to repositioning of paragraphs // For compatibility we grab a related compat flag: -if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS)) +if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS) +&& IsFirstTextLine()) { const long nUpper = m_pFrame->getFramePrintArea().Top(); // Increase the rectangle ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf134436.fodt | 83 sw/qa/extras/uiwriter/uiwriter.cxx | 81 +++ sw/source/core/doc/DocumentContentOperationsManager.cxx | 15 ++ 3 files changed, 178 insertions(+), 1 deletion(-) New commits: commit 50af5ecd1484457cccb8a62b920bf78cbe49d253 Author: Michael Stahl AuthorDate: Thu Jul 30 18:27:28 2020 +0200 Commit: Thorsten Behrens CommitDate: Sun Aug 2 00:04:46 2020 +0200 tdf#134436 sw: fix SwUndoDelete::RedoImpl() with section at end... ... of document; the root cause is that in some intermediate delete operation, the delete will remove a section start/end node pair that surrounds the last text node in the document, but SwUndoDelete::RedoImpl() will not remove it, thus for subsequent Undo actions the indexes are messed up and weird things happen. Fix this in DocumentContentOperationsManager::DeleteRangeImplImpl(), with the same weird "is point at the end" check as SwUndoDelete. Change-Id: Iebf20d3c129c69692df8d57e3c5b9e6fec281e4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99810 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 22a77cb83a3769a8b43d80565282988a74214866) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99835 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/uiwriter/data/tdf134436.fodt b/sw/qa/extras/uiwriter/data/tdf134436.fodt new file mode 100644 index ..40d02a83a23b --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf134436.fodt @@ -0,0 +1,83 @@ + + +http://openoffice.org/2009/office; xmlns:css3t="http://www.w3.org/TR/css3-text/; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns :config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur n:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a + + + + b + + + + + + diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index f9077e1bb02e..54ae76383693 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -5531,6 +5531,87 @@ void SwUiWriterTest::testRedlineCopyPaste() CPPUNIT_ASSERT_EQUAL(OUString("abcdefgh"), pTextNode->GetText()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf134436) +{ +load(DATA_DIRECTORY, "tdf134436.fodt"); + +SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pXTextDocument); +SwDoc * pDoc = pXTextDocument->GetDocShell()->GetDoc(); +CPPUNIT_ASSERT(pDoc); +SwWrtShell * pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +CPPUNIT_ASSERT(pWrtShell); + +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +uno::Reference
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf134252.fodt | 95 ++ sw/qa/extras/uiwriter/uiwriter.cxx| 59 ++ sw/source/core/undo/undel.cxx |9 ++ 3 files changed, 163 insertions(+) New commits: commit 4ee6aa2a6602ad7c7bc4e3ce1d5d857b2110f804 Author: Michael Stahl AuthorDate: Wed Jul 29 19:02:46 2020 +0200 Commit: Caolán McNamara CommitDate: Thu Jul 30 21:25:53 2020 +0200 tdf#134252 sw_redlinehide: fix SwUndoDelete for table before end of section In this funny case, the SwPaM starts inside a section, and ends in the first text node following the end of the section, which happens to be in a different section (but that doesn't matter)... this is because IsSelOvr() moves the end of the selection resulting in the 3rd SelAll off of the table end node (as the section ends with a table), but then it's on the section end node and moves forward again. SwUndoDelete::UndoImpl() must first create the outer section frames, skip over the start text node which has frames handled by RecreateStartTextFrames() and then create the frames following the start text node, where the end node of the outer section now finds its expected outer section frame. This relies on the code from 55576842ec72a748d0bad123d41fa03c89fc136d to move the existing text frame below the new section frame(s). (regression from 6c7245e789f973cf6dad03f7008ab3f9d12d350c) Change-Id: I9f39b09e603e75ef813d5c855d828ec9bd5fdd95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99723 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 740f1796504f66408b692225a9676c9ee3d63722) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99742 Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/uiwriter/data/tdf134252.fodt b/sw/qa/extras/uiwriter/data/tdf134252.fodt new file mode 100644 index ..6e19ac847dd8 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf134252.fodt @@ -0,0 +1,95 @@ + + +http://openoffice.org/2009/office; xmlns:css3t="http://www.w3.org/TR/css3-text/; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns :config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur n:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +bar + + + + + baz + + + + + +foo + + + + diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 285d7e9a35b4..f9077e1bb02e 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1148,6 +1148,65 @@ void SwUiWriterTest::testWatermarkDOCX()
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf134250.fodt | 86 ++ sw/qa/extras/uiwriter/uiwriter.cxx| 61 + sw/source/core/undo/undel.cxx | 13 3 files changed, 159 insertions(+), 1 deletion(-) New commits: commit dc3ecc61722933c4be3717ab65479fe7d60215a6 Author: Michael Stahl AuthorDate: Tue Jul 28 19:12:19 2020 +0200 Commit: Caolán McNamara CommitDate: Thu Jul 30 21:25:21 2020 +0200 tdf#134250 sw_redlinehide: fix Undo with section before table ... at start of document, part 2: In SwUndoDelete::UndoImpl(), the m_aEndStr wasn't inserted, because the pTextNd was a section node. This caused asserts when trying to add the history hints that used to be in the end text node. thints.cxx:1295: bool SwTextNode::InsertHint(SwTextAttr*, SetAttrMode): Assertion `!pAttr->GetEnd() || (*pAttr->GetEnd() <= Len())' failed. (regression from57d488660572d62ef0371e50dcdd4ca7a6d98a14) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99644 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 27613259990d39d34b036b3d717d3ceaf5c15e65) tdf#134250 add unit test Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99672 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 50ceac91a4ac2057847e7d9807f5cb614e6ff755) Change-Id: I48caa7487d2d1e6250b5aceab18f270555d3ee8f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99772 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/uiwriter/data/tdf134250.fodt b/sw/qa/extras/uiwriter/data/tdf134250.fodt new file mode 100644 index ..86aaa140c9e7 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf134250.fodt @@ -0,0 +1,86 @@ + + +http://openoffice.org/2009/office; xmlns:css3t="http://www.w3.org/TR/css3-text/; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns :config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur n:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + foo + + + +bar + + + + diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index ac68f39859df..285d7e9a35b4 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1226,6 +1226,67 @@ void SwUiWriterTest::testWatermarkPosition() } } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf134250) +{ +load(DATA_DIRECTORY, "tdf134250.fodt"); + +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ww8export/data/tdf116194.doc |binary sw/qa/extras/ww8export/ww8export3.cxx |5 + sw/source/filter/ww8/ww8scan.cxx |2 +- 3 files changed, 6 insertions(+), 1 deletion(-) New commits: commit 52f004e27fbdef114a6fa1b467a7919ab1762dab Author: Justin Luth AuthorDate: Thu Jul 16 16:02:53 2020 +0300 Commit: Justin Luth CommitDate: Thu Jul 16 22:02:30 2020 +0200 tdf#77962 ww8import: 0x4xxx sprms are always 2 byte SPRA(bytes) | SGC (property type) | A | ISPMD XXX X XXX X Focusing on the SPRA meaning: 0 is Operand is a ToggleOperand (which is 1 byte in size). 1 is Operand is 1 byte. 2 is Operand is 2 bytes. 3 is Operand is 4 bytes. 4 is Operand is 2 bytes. 5 is Operand is 2 bytes. 6 is Operand is of variable length. 7 is Operand is 3 bytes. Thus every 0x4xxx and 0x5xxx are 2 bytes sprmCIcoBi = SPRM_CHR(0x60, 1, spra::operand_2b_2); // 0x4A60 and thus it must be defined everywhere as 2 bytes. Wrongly "fixed" from 0 to 1 by commit bf24cca78e3c95d7a07e2073802c1540faec6920 Author: Caolán McNamara on Wed Dec 4 08:56:32 2002 + #105926# some bidi properties with incorrect cached len Change-Id: Ic30df735ed325a508ef3c7220d9b06878af248a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98911 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 56b04e40ab72b6333ce278ba2980650f5272025f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98845 diff --git a/sw/qa/extras/ww8export/data/tdf116194.doc b/sw/qa/extras/ww8export/data/tdf116194.doc new file mode 100644 index ..ca1edf68d501 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf116194.doc differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 49a887781859..c88c23dbc581 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -317,6 +317,11 @@ DECLARE_WW8EXPORT_TEST(testTdf133453_realFontSize, "tdf133453_realFontSize.doc") CPPUNIT_ASSERT_EQUAL( -95.f, getProperty(getRun(getParagraph(1), 2, "2"), "CharEscapement") ); } +DECLARE_WW8EXPORT_TEST(testTdf116194, "tdf116194.doc") +{ +CPPUNIT_ASSERT_EQUAL( Color(192,0,0), Color(getProperty(getRun(getParagraph(1), 1), "CharColor")) ); +} + DECLARE_WW8EXPORT_TEST(testTdf12_fillStyleNone, "tdf12_fillStyleNone.docx") { uno::Reference xStyle(getStyles("ParagraphStyles")->getByName("Numbering - First level"), diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 30294ca3ab9f..14780313c4ca 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -603,7 +603,7 @@ const wwSprmSearcher *wwSprmParser::GetWW8SprmSearcher() {0x085D, { 1, L_FIX} }, // "sprmCFItalicBi" ;;; {0x4A5E, { 2, L_FIX} }, {0x485F, { 2, L_FIX} }, // "sprmCLidBi" ;;; -{0x4A60, { 1, L_FIX} }, // "sprmCIcoBi" ;;; +{0x4A60, { 2, L_FIX} }, // "sprmCIcoBi" ;;; {0x4A61, { 2, L_FIX} }, // "sprmCHpsBi" ;;; {0xCA62, { 0, L_VAR} }, // "sprmCDispFieldRMark" chp.fDispFieldRMark, // chp.ibstDispFieldRMark, chp.dttmDispFieldRMark ; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 23 ++ sw/source/core/layout/anchoreddrawobject.cxx | 36 +- writerfilter/source/dmapper/GraphicImport.cxx |2 4 files changed, 59 insertions(+), 2 deletions(-) New commits: commit dc3137f9a5a2abdbb627a1a26392d71e26bcc283 Author: Regényi Balázs AuthorDate: Wed Jun 10 14:27:32 2020 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Thu Jul 16 16:15:03 2020 +0200 tdf#133863 tdf#133864 DOCX shape import: width relative to inside and outside margins. See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4 (offapi: document the 4 new properties which are no longer read-only). commit b46f4bc9760267ac5e45d43b77b5d2721ee4c386 (tdf#133070 DOCX import: fix shape height relative to bottom page margin) commit 330ed8120e9881656716d70d87b9f49f861f0bfa (tdf#133670 DOCX import: fix shape width relative to right margin) commit 7380905abc0833d9e4c4fe731d76174db8a8724c (tdf#132976 DOCX import: fix shape width relative to left margin) Co-authored-by: Szabolcs Tóth Change-Id: If81b7c80732141be1491ca82770cf6eee99f5656 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97627 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit d63321d949563759ee2ada96fdc2e0f8728941b2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98832 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx new file mode 100644 index ..453320f388f1 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 80ca3e83b8fe..a7fa86d47a14 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1167,6 +1167,29 @@ DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromLeftMargin, "tdf132976_testR CPPUNIT_ASSERT_EQUAL(static_cast(1133), nAnchoredWidth); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromInsideOutsideMargin, "tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx") +{ +// TODO: Fix export. +if (mbExported) +return; + +// tdf#133863 tdf#133864 The sizes of the width of these shapes depend on the sizes of the inside and outside margins. +// The open book: outside --text-- inside | inside --text-- outside +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +// Outside +sal_Int32 nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[1]/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(2552), nAnchoredWidth); +// Inside +nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[2]/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(1440), nAnchoredWidth); +// Inside +nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[3]/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(1440), nAnchoredWidth); +// Outside +nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[4]/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(2552), nAnchoredWidth); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 9b4bce8e44ef..1af32ed2fa80 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -620,6 +620,26 @@ SwRect SwAnchoredDrawObject::GetObjRect() const return GetDrawObj()->GetSnapRect(); } +namespace +{ +// Imagine an open book, inside margin is the one that is at the inner side of the pages, at the center of the book, +// outside margin is at the two opposite edges of the book. +// outside --text-- inside | inside --text-- outside +// With mirrored margins, when relating the size of an object from the inside margin for example, on the +// first page we calculate the new size of the object using the size of the right margin, +// on second page the left margin, third page right margin, etc. +long getInsideOutsideRelativeWidth(bool isOutside, const SwPageFrame* const pPageFrame) +{ +// Alternating between the only two possible cases: inside and outside. +// Inside = false, Outside = true. +auto nPageNum = pPageFrame->GetPhyPageNum(); +if (nPageNum % 2 == (isOutside ? 0 : 1)) +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx |binary sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 32 ++ sw/source/core/inc/pagefrm.hxx |3 sw/source/core/layout/anchoreddrawobject.cxx | 17 - sw/source/core/layout/pagechg.cxx | 12 +++ writerfilter/source/dmapper/GraphicImport.cxx |7 ++ 7 files changed, 67 insertions(+), 4 deletions(-) New commits: commit 86fc133348e88b84fe659258409de84c0a975941 Author: Regényi Balázs AuthorDate: Wed Jun 3 18:15:28 2020 +0200 Commit: Xisco Fauli CommitDate: Thu Jul 16 13:47:20 2020 +0200 tdf#133070 DOCX import: fix shape height relative to bottom page margin using UNO API RelativeHeightRelation and the associated lo-ext attribute for OpenDocument export. See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4 (offapi: document the 4 new properties which are no longer read-only). Co-authored-by: Szabolcs Tóth Change-Id: I31db99fac5ad24971fa427671198b47906e9c057 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95451 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit b46f4bc9760267ac5e45d43b77b5d2721ee4c386) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98831 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx new file mode 100644 index ..2625a9a56a04 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx new file mode 100644 index ..155e74857479 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 948bca6d74ac..a1f8971772c1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -52,6 +52,38 @@ DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(720), getXPath(pDump, "//page[1]/body/txt[1]/Text[3]", "nWidth").toInt32()); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginHasFooter, + "tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx") +{ +// TODO: fix export too +if (mbExported) +return; +// tdf#133070 The height was set relative to page print area bottom, +// but this was handled relative to page height. +// Note: page print area bottom = margin + footer height. +// In this case the footer exists. +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +const sal_Int32 nAnchoredHeight += getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(1147), nAnchoredHeight); +} + +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginNoFooter, + "tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx") +{ +// TODO: fix export too +if (mbExported) +return; +// tdf#133070 The height was set relative to page print area bottom, +// but this was handled relative to page height. +// Note: page print area bottom = margin + footer height. +// In this case the footer does not exist, so OpenDocument and OOXML margins are the same. +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +const sal_Int32 nAnchoredHeight += getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(1147), nAnchoredHeight); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index 81949f58e1b4..3c7f29f52ad0 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -21,6 +21,7 @@ #include #include "ftnboss.hxx" +#include "hffrm.hxx" #include @@ -328,6 +329,8 @@ public: /// Is bottom-of-page-frame - bottom-of-text-frame difference valid in case whitespace is hidden? /// If false is returned, then the caller should handle negative
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/rtfexport/data/tdf133437.rtf | 571 ++ sw/qa/extras/rtfexport/rtfexport5.cxx | 35 + sw/source/core/unocore/unodraw.cxx| 15 3 files changed, 613 insertions(+), 8 deletions(-) New commits: commit 9f05cf79a73c9c7dc00bcfb70dd5e3b1464af47b Author: Vasily Melenchuk AuthorDate: Wed Jul 8 08:49:04 2020 +0300 Commit: Adolfo Jayme Barrientos CommitDate: Wed Jul 15 11:10:00 2020 +0200 tdf#133437: sw: set generated shape name if it is missing Shape names are required for seting format name and undo/redo and correct displaying of objects in Navigator pane Change-Id: I43caf6a4d5f054283d48c46b081d43b743bd4433 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98312 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit 0c53a58b2dd9bee3d4de6843966486428fdaa78f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98752 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/rtfexport/data/tdf133437.rtf b/sw/qa/extras/rtfexport/data/tdf133437.rtf new file mode 100644 index ..4cd6ef182e06 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf133437.rtf @@ -0,0 +1,571 @@ +{\rtf1\ansi\deff0 +{\fonttbl +{\f0\fnil\fcharset204\fprq0\cpg1251 Arial;} +{\f1\fnil\fcharset204\fprq0\cpg1251 Times New Roman;} +{\f2\fnil\fcharset204\fprq0\cpg1251 Courier New;} +} +{\*\viewkind1}{\*\viewscale100}\margl0\margr0\margt0\margb0 +\paperw11905\paperh16837{\pard\plain\qc\sl-200\sb40\phmrg\pvmrg\posx840\posy1120\absw10200\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b ��� (���), �.��}\par} +{\pard\plain\qc\sl-200\sb40\phmrg\pvmrg\posx840\posy1400\absw10200\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b ��� "� ���"}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx2540\posy1680\absw3680\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b ��� ��� �� � N}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx6060\posy1680\absw2200\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20 4070281040001109}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx8160\posy1680\absw300\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b c}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx8300\posy1680\absw1100\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20 01.05.2012}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx9260\posy1680\absw420\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b ��}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx9580\posy1680\absw1100\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20 17.05.2012}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx840\posy1960\absw1520\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b �� �:}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx2200\posy1960\absw620\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20 RUR}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx7640\posy1960\absw2600\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b � :}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx10080\posy1960\absw1100\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20 28.04.2012}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx840\posy2240\absw1960\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b ���:}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx2700\posy2240\absw1100\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20 146 678.74}\par} +{\pard\plain\qr\sl-200\sb40\phmrg\pvmrg\posx840\posy2440\absw10200\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b 1 �� 3}\par} +{\shp{\*\shpinst\shpleft840\shptop2720\shpright11220\shpbottom3280\shpfhdr0\shpbxpage\shpbypage\shpwr3\shpwrk0\shpfblwtxt1\shpz0{\sp{\sn shapeType}{\sv 1}}{\sp{\sn fFilled}{\sv 0 +{\shp{\*\shpinst\shpleft1840\shptop2720\shpright1840\shpbottom3280\shpfhdr0\shpbxpage\shpbypage\shpwr3\shpwrk0\shpfblwtxt1\shpz0{\sp{\sn shapeType}{\sv 20 +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx880\posy2880\absw1160\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b .}\par} +{\shp{\*\shpinst\shpleft2180\shptop2720\shpright2180\shpbottom3280\shpfhdr0\shpbxpage\shpbypage\shpwr3\shpwrk0\shpfblwtxt1\shpz0{\sp{\sn shapeType}{\sv 20 +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx1860\posy2880\absw520\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b ��}\par} +{\shp{\*\shpinst\shpleft2860\shptop2720\shpright2860\shpbottom3280\shpfhdr0\shpbxpage\shpbypage\shpwr3\shpwrk0\shpfblwtxt1\shpz0{\sp{\sn shapeType}{\sv 20 +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx2220\posy2760\absw800\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b �}\par} +{\pard\plain\ql\sl-200\sb40\phmrg\pvmrg\posx2220\posy3000\absw820\absh0\dxfrtext0\dfrmtxtx0\dfrmtxty0{\f1\fs20\b �.}\par} +{\shp{\*\shpinst\shpleft4200\shptop2720\shpright4200\shpbottom3280\shpfhdr0\shpbxpage\shpbypage\shpwr3\shpwrk0\shpfblwtxt1\shpz0{\sp{\sn shapeType}{\sv 20
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/core/txtnode/data/textbox-node-split.docx |binary sw/qa/core/txtnode/txtnode.cxx | 12 sw/source/core/txtnode/atrflyin.cxx | 17 + 3 files changed, 29 insertions(+) New commits: commit ebbb27eb3970fd9409cbf8b38088620d5132e070 Author: Miklos Vajna AuthorDate: Mon Jul 13 21:06:19 2020 +0200 Commit: Miklos Vajna CommitDate: Tue Jul 14 12:29:12 2020 +0200 tdf#134431 sw: fix crash on setting anchor of textbox while splitting a para Regression from commit 682e0488df819c191c13a03758fad0690706e508 (tdf#134099 sw: fix textbox anchors on copy-paste and undo, 2020-06-29), the problem was that setting the anchor of a frame format triggers "modify" notifications, but the handlers of those notifications expect a consistent layout. This invariant is not held while we're still in SwTextNode::SplitContentNode(). Fix the problem by updating the textbox's anchor the same way "normal" fly frames are handled, i.e. add/remove the frame format to the new/old text node manually and block notifications. (cherry picked from commit 9c8aa11ee7ddbae34afcce2cbfc4d521122a527b) Change-Id: If1f07d4230540796a81d9ed46a932b67d5995462 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98705 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/sw/qa/core/txtnode/data/textbox-node-split.docx b/sw/qa/core/txtnode/data/textbox-node-split.docx new file mode 100644 index ..5760ee6e2dec Binary files /dev/null and b/sw/qa/core/txtnode/data/textbox-node-split.docx differ diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index 664a7ac26c7d..67326147e496 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -70,6 +70,18 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor) CPPUNIT_ASSERT_EQUAL(aFlyAnchor2.nNode, aDrawAnchor2.nNode); } +CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxNodeSplit) +{ +load(DATA_DIRECTORY, "textbox-node-split.docx"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDocShell* pShell = pTextDoc->GetDocShell(); +SwWrtShell* pWrtShell = pShell->GetWrtShell(); +pWrtShell->SttEndDoc(/*bStart=*/false); +// Without the accompanying fix in place, this would have crashed in +// SwFlyAtContentFrame::Modify(). +pWrtShell->SplitNode(); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx index 902d3bda3a1e..4e61e568e702 100644 --- a/sw/source/core/txtnode/atrflyin.cxx +++ b/sw/source/core/txtnode/atrflyin.cxx @@ -208,7 +208,24 @@ void SwTextFlyCnt::SetAnchor( const SwTextNode *pNode ) { SwFormatAnchor aTextBoxAnchor(pTextBox->GetAnchor()); aTextBoxAnchor.SetAnchor(aAnchor.GetContentAnchor()); + +// SwFlyAtContentFrame::Modify() assumes the anchor has a matching layout frame, which +// may not be the case when we're in the process of a node split, so block +// notifications. +bool bIsInSplitNode = pNode->GetpSwpHints() && pNode->GetpSwpHints()->IsInSplitNode(); +if (bIsInSplitNode) +{ +pTextBox->LockModify(); +} + pTextBox->SetFormatAttr(aTextBoxAnchor); + +if (bIsInSplitNode) +{ +pOldNode->RemoveAnchoredFly(pTextBox); +aPos.nNode.GetNode().AddAnchoredFly(pTextBox); +pTextBox->UnlockModify(); +} } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ww8export/data/tdf134570.doc |binary sw/qa/extras/ww8export/ww8export3.cxx | 10 ++ sw/source/filter/ww8/ww8par3.cxx | 21 ++--- 3 files changed, 24 insertions(+), 7 deletions(-) New commits: commit da5782a8348816adafe7894126cbe20295dd5d8e Author: Vasily Melenchuk AuthorDate: Fri Jul 10 14:07:38 2020 +0300 Commit: Xisco Fauli CommitDate: Mon Jul 13 13:26:16 2020 +0200 tdf#134570: doc import: list level format string fixed List level placeholder is defined from char at defined position, not only from position array. Change-Id: I008e6711312435571f0d04544f6bfa42c1309f31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98500 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk (cherry picked from commit b88b681743b1278b4fa44bef4d5bce3e2cb49316) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98634 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ww8export/data/tdf134570.doc b/sw/qa/extras/ww8export/data/tdf134570.doc new file mode 100644 index ..17f7842d703f Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf134570.doc differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index f998ffe1d85a..49a887781859 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -591,6 +591,16 @@ DECLARE_WW8EXPORT_TEST(testTdf120394, "tdf120394.doc") } } +DECLARE_WW8EXPORT_TEST(testTdf134570, "tdf134570.doc") +{ +CPPUNIT_ASSERT_EQUAL(1, getPages()); +{ +uno::Reference xPara(getParagraph(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(1), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty(xPara, "ListLabelString")); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 02c02ecc459d..395a1bf2e9db 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -890,18 +890,25 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr= sListFormat.getLength()) { -if (aLVL.aOfsNumsXCH[nLevelB] <= sNumString.getLength()) -sListFormat = sListFormat.replaceAt(aLVL.aOfsNumsXCH[nLevelB] + nExtraOffset - 1, 1, sReplacement); -else -SAL_WARN("sw.ww8", "List level reference is beyond the border. Ignored."); +SAL_WARN("sw.ww8", "List level reference is beyond the border. Ignored."); +nLevelB++; +continue; } +sal_uInt8 nReplacement = sListFormat[nOffset] + 1; + +OUString sReplacement("%" + OUString::number(nReplacement)); +sListFormat = sListFormat.replaceAt(nOffset, 1, sReplacement); + // We need also update an offset, since we are replacing one symbol by at least two nExtraOffset += sReplacement.getLength() - 1; +nLevelB++; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/layout/data/tdf134548.odt |binary sw/qa/extras/layout/layout.cxx | 20 sw/qa/extras/ooxmlexport/data/tdf83309.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 12 +--- sw/source/core/text/txttab.cxx |5 - 5 files changed, 25 insertions(+), 12 deletions(-) New commits: commit 41d06c9ca1f4381691d822cbf97bdb17eda716fa Author: Vasily Melenchuk AuthorDate: Fri Jul 10 10:09:06 2020 +0300 Commit: Xisco Fauli CommitDate: Sat Jul 11 19:43:53 2020 +0200 tdf#134548: sw: revert of changes to tab at zero pos It looks like solution for provided in 5ed96c for tdf#83309 is enough to resolve original bugdoc, so these changes for emission of tab at zero position are not required and produce just regressions. Corresponding unittest for tdf#83309 is adjusted: it is using now original bugdoc. Conflicts: sw/source/core/text/txttab.cxx Change-Id: I2e7683f071f78c720436b4c9ccb903133a985e7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98476 Tested-by: Jenkins Reviewed-by: Thorsten Behrens Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98547 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/layout/data/tdf134548.odt b/sw/qa/extras/layout/data/tdf134548.odt new file mode 100644 index ..bc714b0d5e01 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134548.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 9e0ee4c66c66..0a84d6ab69f6 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -4114,6 +4114,26 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testStableAtPageAnchoredFlyPosition) CPPUNIT_ASSERT_EQUAL(aOrigRect, aRelayoutRect); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134548) +{ +createDoc("tdf134548.odt"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + +// Second paragraph has two non zero width tabs in beginning of line +{ +OUString sNodeType = parseDump("/root/page/body/txt[2]/Text[1]", "nType"); +CPPUNIT_ASSERT_EQUAL(OUString("PortionType::TabLeft"), sNodeType); +sal_Int32 nWidth = parseDump("/root/page/body/txt[2]/Text[1]", "nWidth").toInt32(); +CPPUNIT_ASSERT_GREATER(sal_Int32(0), nWidth); +} +{ +OUString sNodeType = parseDump("/root/page/body/txt[2]/Text[2]", "nType"); +CPPUNIT_ASSERT_EQUAL(OUString("PortionType::TabLeft"), sNodeType); +sal_Int32 nWidth = parseDump("/root/page/body/txt[2]/Text[2]", "nWidth").toInt32(); +CPPUNIT_ASSERT_GREATER(sal_Int32(0), nWidth); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlexport/data/tdf83309.docx b/sw/qa/extras/ooxmlexport/data/tdf83309.docx index e8f59bc81969..03e0797877d8 100644 Binary files a/sw/qa/extras/ooxmlexport/data/tdf83309.docx and b/sw/qa/extras/ooxmlexport/data/tdf83309.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 167c05111a51..11499ec87c72 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -623,16 +623,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf125038c, "tdf125038c.docx") DECLARE_OOXMLEXPORT_TEST(testTdf83309, "tdf83309.docx") { -CPPUNIT_ASSERT_EQUAL(1, getPages()); -OUString sNodeType; +// Important: bug case had 4 pages +CPPUNIT_ASSERT_EQUAL(2, getPages()); // First paragraph does not have tab before -sNodeType = parseDump("/root/page/body/txt[1]/Text[1]", "nType"); +// (same applies to all paragraphs in doc, but lets assume they are +// behave same way) +OUString sNodeType = parseDump("/root/page[1]/body/txt[1]/Text[1]", "nType"); CPPUNIT_ASSERT_EQUAL(OUString("PortionType::Text"), sNodeType); - -// Second paragraph starts with tab -sNodeType = parseDump("/root/page/body/txt[2]/Text[1]", "nType"); -CPPUNIT_ASSERT_EQUAL(OUString("PortionType::TabLeft"), sNodeType); } DECLARE_OOXMLEXPORT_TEST(testTdf121661, "tdf121661.docx") diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index df8b5ee4ce75..a38cbe048d44 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -48,11 +48,6 @@ const SvxTabStop *SwLineInfo::GetTabStop( const SwTwips nSearchPos, const SwTwip if( rTabStop.GetTabPos() > SwTwips(nRight) ) return i ? nullptr : -// If we are starting search from zero position, -// than we should include tabstop at zero position -if ((nSearchPos == 0) && (rTabStop.GetTabPos() == 0)) -return - if( rTabStop.GetTabPos() > nSearchPos ) return } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/layout/data/tdf134472.odt |binary sw/qa/extras/layout/layout.cxx |9 + sw/source/core/layout/flowfrm.cxx |5 - 3 files changed, 13 insertions(+), 1 deletion(-) New commits: commit 4d9f1afa79b1446a9cab805de42bd7a8851a006a Author: Samuel Mehrbrodt AuthorDate: Mon Jul 6 21:24:49 2020 +0200 Commit: Thorsten Behrens CommitDate: Tue Jul 7 14:09:53 2020 +0200 tdf#134472 Only add spacing in header when flag is set Flag was set, but not evaluated in 9b5805d1ef2b9e9c4e8f389c069807bf4489ea95 Change-Id: I46f19945be521e886baa0fc9a9a419d88c0915fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98224 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt (cherry picked from commit 70f9c3b8f03fb28215985a5b899bd8fae9cb3ac3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98084 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/layout/data/tdf134472.odt b/sw/qa/extras/layout/data/tdf134472.odt new file mode 100644 index ..a50c99c87622 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134472.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index f24a37ba3704..9e0ee4c66c66 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -453,6 +453,15 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) } } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272) +{ +SwDoc* pDoc = createDoc("tdf134472.odt"); +CPPUNIT_ASSERT(pDoc); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "height", "843"); +assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "bottom", "2819"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader) { loadURL("private:factory/swriter", nullptr); diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 06b9db38fefd..73c939ec1a40 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1712,7 +1712,10 @@ SwTwips SwFlowFrame::CalcLowerSpace( const SwBorderAttrs* _pAttrs ) const } // tdf#128195 Consider para spacing below last paragraph in header -if (!m_rThis.IsInFly() && m_rThis.FindFooterOrHeader() && !GetFollow() && !m_rThis.GetIndNext()) +bool bHasSpacingBelowPara = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get( +DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA); +if (bHasSpacingBelowPara && !m_rThis.IsInFly() && m_rThis.FindFooterOrHeader() && !GetFollow() +&& !m_rThis.GetIndNext()) nLowerSpace += _pAttrs->GetULSpace().GetLower() + _pAttrs->CalcLineSpacing(); return nLowerSpace; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/layout/data/tdf134463.docx |binary sw/qa/extras/layout/layout.cxx |8 sw/source/core/layout/flowfrm.cxx | 24 +--- 3 files changed, 25 insertions(+), 7 deletions(-) New commits: commit 7f147ddd2764dd2ea92d4e4b92287ec1cf839848 Author: László Németh AuthorDate: Fri Jul 3 16:52:45 2020 +0200 Commit: Xisco Fauli CommitDate: Mon Jul 6 18:12:14 2020 +0200 tdf#134463 DOCX import: fix other "half" of contextualSpacing Always ignore own bottom margin setting of the previous paragraph with contextual spacing, if the actual paragraph is identical. I.e. in that case, too, when the actual paragraph has no contextual spacing, like MSO does. Note: PARA_SPACE_MAX mode hasn't included this modification, yet, so only ODT documents converted from DOCX use it at the default setting. See also commit e318d5d8146d18e2c76e23f2e3c39527f2af9f36 (tdf#125893 DOCX import: fix "half" contextual paragraph spacing). Change-Id: I83fab2a2d85eeb9d48a8546d5a4e6423988d642c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97874 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit a5073875fe551790a314b402ff209545050c17da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98076 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/layout/data/tdf134463.docx b/sw/qa/extras/layout/data/tdf134463.docx new file mode 100644 index ..9de51cc97557 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134463.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index a1eae5558356..f24a37ba3704 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3116,6 +3116,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125893) assertXPath(pXmlDoc, "/root/page/body/txt[4]/infos/prtBounds", "top", "0"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134463) +{ +createDoc("tdf134463.docx"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +// This was 621. The previous paragraph must have zero bottom border. +assertXPath(pXmlDoc, "/root/page/body/txt[3]/infos/prtBounds", "top", "21"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117188) { createDoc("tdf117188.docx"); diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 3833920c53a4..06b9db38fefd 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1419,16 +1419,25 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, if( pPrevFrame ) { const bool bUseFormerLineSpacing = rIDSA.get(DocumentSettingId::OLD_LINE_SPACING); -const bool bContextualSpacing = pAttrs->GetULSpace().GetContext() - && lcl_getContextualSpacing(pPrevFrame) +const bool bContextualSpacingThis = pAttrs->GetULSpace().GetContext(); +const bool bContextualSpacingPrev = lcl_getContextualSpacing(pPrevFrame); + +const bool bContextualSpacing = bContextualSpacingThis + && bContextualSpacingPrev && lcl_IdenticalStyles(pPrevFrame, _rThis); // tdf#125893 always ignore own top margin setting of the actual paragraph // with contextual spacing, if the previous paragraph is identical const bool bHalfContextualSpacing = !bContextualSpacing - && pAttrs->GetULSpace().GetContext() - && !lcl_getContextualSpacing(pPrevFrame) - && lcl_getContextualSpacing(_rThis) + && bContextualSpacingThis + && !bContextualSpacingPrev + && lcl_IdenticalStyles(pPrevFrame, _rThis); + +// tdf#134463 always ignore own bottom margin setting of the previous paragraph +// with contextual spacing, if the actual paragraph is identical +const bool bHalfContextualSpacingPrev = !bContextualSpacing + && !bContextualSpacingThis + && bContextualSpacingPrev && lcl_IdenticalStyles(pPrevFrame, _rThis); // i#11860 - use new method to determine needed spacing @@ -1486,8 +1495,9 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, } else { -nUpper = bContextualSpacing ? 0 : std::max(static_cast(nPrevLowerSpace), bHalfContextualSpacing - ? 0 : static_cast(pAttrs->GetULSpace().GetUpper()) ); +nUpper = bContextualSpacing ? 0
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/uibase/shells/data/ole-save-preview-update.odt |binary sw/qa/uibase/shells/shells.cxx | 33 +-- sw/source/uibase/shells/basesh.cxx |4 ++ 3 files changed, 34 insertions(+), 3 deletions(-) New commits: commit b7a465c9403cf198df3424e9893c323b9d305026 Author: Miklos Vajna AuthorDate: Tue Jun 23 10:31:05 2020 +0200 Commit: Miklos Vajna CommitDate: Wed Jul 1 11:17:09 2020 +0200 sw: fix missing OLE preview on updating links Regression from commit 74844277cc2194c9e43f5bd7a6f78a9603da32f3 (disable generation of ole previews in ODF format until after load, 2016-09-13), if the document has charts without previews, it's loaded, fields are updated and saved, we no longer generate those previews. Given that Tools -> Update -> Update all is always an explicit user action, restore the permission to update OLE previews / links before performing the actual update. With this, comphelper::EmbeddedObjectContainer::StoreAsChildren() will generate those missing previews inside the getUserAllowsLinkUpdate() conditional block. Change-Id: Ib54e06a2e2f2e1c65951fdec302e59e63c71d008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96928 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 2aad85f84235f362604b5fd385bb77de839d2014) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97492 diff --git a/sw/qa/uibase/shells/data/ole-save-preview-update.odt b/sw/qa/uibase/shells/data/ole-save-preview-update.odt new file mode 100644 index ..353ce7fa050c Binary files /dev/null and b/sw/qa/uibase/shells/data/ole-save-preview-update.odt differ diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx index c1012d6af1d1..fbdf35758156 100644 --- a/sw/qa/uibase/shells/shells.cxx +++ b/sw/qa/uibase/shells/shells.cxx @@ -26,16 +26,21 @@ #include #include +static char const DATA_DIRECTORY[] = "/sw/qa/uibase/shells/data/"; + /// Covers sw/source/uibase/shells/ fixes. class SwUibaseShellsTest : public SwModelTestBase { public: -SwDoc* createDoc(); +SwDoc* createDoc(const char* pName = nullptr); }; -SwDoc* SwUibaseShellsTest::createDoc() +SwDoc* SwUibaseShellsTest::createDoc(const char* pName) { -loadURL("private:factory/swriter", nullptr); +if (!pName) +loadURL("private:factory/swriter", nullptr); +else +load(DATA_DIRECTORY, pName); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -112,6 +117,28 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testShapeTextAlignment) #endif } +CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOleSavePreviewUpdate) +{ +// Load a document with 2 charts in it. The second is down enough that you have to scroll to +// trigger its rendering. Previews are missing for both. +createDoc("ole-save-preview-update.odt"); + +// Explicitly update OLE previews, etc. +dispatchCommand(mxComponent, ".uno:UpdateAll", {}); + +// Save the document and see if we get the previews. +uno::Reference xStorable(mxComponent, uno::UNO_QUERY); +xStorable->storeToURL(maTempFile.GetURL(), {}); +uno::Reference xNameAccess += packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), + maTempFile.GetURL()); + +// Without the accompanying fix in place, this test would have failed, because the object +// replacements were not generated, even after UpdateAll. +CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Object 1")); +CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Object 2")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 2265ea10bb2a..2253441310f0 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -717,6 +717,10 @@ void SwBaseShell::Execute(SfxRequest ) case FN_UPDATE_ALL: { +comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer += GetObjectShell()->getEmbeddedObjectContainer(); +rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true); + SwView& rTempView = GetView(); rSh.EnterStdMode(); if( !rSh.GetLinkManager().GetLinks().empty() ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/core/txtnode/data/textbox-copy-anchor.docx|binary sw/qa/core/txtnode/txtnode.cxx | 32 sw/source/core/doc/DocumentContentOperationsManager.cxx |8 sw/source/core/txtnode/atrflyin.cxx | 10 + 4 files changed, 50 insertions(+) New commits: commit 15b2b8ab801c6faf797648d94de3c17228daf4ab Author: Miklos Vajna AuthorDate: Mon Jun 29 21:05:27 2020 +0200 Commit: Miklos Vajna CommitDate: Tue Jun 30 14:02:04 2020 +0200 tdf#134099 sw: fix textbox anchors on copy-paste and undo Regression from commit c7307c77254557646f33017af915f6808a861e29 (fdo#82191 sw::DocumentLayoutManager: copy textbox content of draw formats, 2014-08-15), without which this problem gets hidden, as copy breaks the textbox into 2 pieces, so the textbox codepaths are no longer hit. The direct problem is that SwHistorySetFormat::SetInDoc() uses a raw node index into the nodes array, which is past the end of the nodes array. Root cause is that we have this invariant that actions and their undo has to be in sync, otherwise raw node indexes no longer work. In this case, SwUndoSaveContent::DelContentIndex() did not delete a fly frame format, because it was out of range, as it had a wrong anchor. Fix this in SwTextFlyCnt::SetAnchor(), so that whenever the anchor of a draw format is set via that function, we update its textbox as well. Also fix a related problem when fly formats were copied twice. (cherry picked from commit 682e0488df819c191c13a03758fad0690706e508) Change-Id: I0d6c9069544c405eb20c5fed65fb40423b0adc84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97475 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/core/txtnode/data/textbox-copy-anchor.docx b/sw/qa/core/txtnode/data/textbox-copy-anchor.docx new file mode 100644 index ..b835097f1b9b Binary files /dev/null and b/sw/qa/core/txtnode/data/textbox-copy-anchor.docx differ diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index 0638fe742ff3..664a7ac26c7d 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -11,6 +11,10 @@ #include +#include +#include +#include + static char const DATA_DIRECTORY[] = "/sw/qa/core/txtnode/data/"; /// Covers sw/source/core/txtnode/ fixes. @@ -38,6 +42,34 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese) assertXPath(pXmlDoc, "//font[1]", "vertical", "false"); } +CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor) +{ +load(DATA_DIRECTORY, "textbox-copy-anchor.docx"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDocShell* pShell = pTextDoc->GetDocShell(); +SwWrtShell* pWrtShell = pShell->GetWrtShell(); +SwDoc aClipboard; +pWrtShell->SelAll(); +pWrtShell->Copy(); +pWrtShell->SttEndDoc(/*bStart=*/false); +pWrtShell->Paste(); + +const SwFrameFormats& rFormats = *pShell->GetDoc()->GetSpzFrameFormats(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 4 +// - Actual : 6 +// i.e. 2 fly frames were copied twice. +CPPUNIT_ASSERT_EQUAL(static_cast(4), rFormats.size()); + +SwPosition aDrawAnchor1 = *rFormats[0]->GetAnchor().GetContentAnchor(); +SwPosition aFlyAnchor1 = *rFormats[1]->GetAnchor().GetContentAnchor(); +CPPUNIT_ASSERT_EQUAL(aFlyAnchor1.nNode, aDrawAnchor1.nNode); +SwPosition aDrawAnchor2 = *rFormats[2]->GetAnchor().GetContentAnchor(); +SwPosition aFlyAnchor2 = *rFormats[3]->GetAnchor().GetContentAnchor(); +// This also failed, aFlyAnchor2 was wrong, as it got out of sync with aDrawAnchor2. +CPPUNIT_ASSERT_EQUAL(aFlyAnchor2.nNode, aDrawAnchor2.nNode); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 6d048e248c3c..8fe63c30b2db 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -3786,6 +3786,14 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl( } } +// Ignore TextBoxes, they are already handled in +// sw::DocumentLayoutManager::CopyLayoutFormat(). +if (SwTextBoxHelper::isTextBox(it->GetFormat(), RES_FLYFRMFMT)) +{ +it = aSet.erase(it); +continue; +} + // Copy the format and set the new anchor aVecSwFrameFormat.push_back( pDest->getIDocumentLayoutAccess().CopyLayoutFormat( *(*it).GetFormat(), aAnchor, false, true ) ); diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx index 3fc62f51a368..902d3bda3a1e 100644 ---
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 13 ++ sw/source/core/layout/anchoreddrawobject.cxx |3 ++ writerfilter/source/dmapper/GraphicImport.cxx |8 ++ 4 files changed, 24 insertions(+) New commits: commit 718683ab1582849ea43797e404c6453ce2fbd424 Author: Szabolcs Toth AuthorDate: Fri Jun 5 12:06:22 2020 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Fri Jun 26 12:55:09 2020 +0200 tdf#133670 DOCX import: fix shape width relative to right margin using UNO API RelativeWidthRelation and the associated lo-ext attribute for OpenDocument export. See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4 (offapi: document the 4 new properties which are no longer read-only). Co-authored-by: Balázs Regényi Change-Id: Ic5d25701d46cdace6502ec55dbc0e5f0ebd7742b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95582 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 330ed8120e9881656716d70d87b9f49f861f0bfa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97067 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx new file mode 100644 index ..68f24370a31e Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 5289dec3dfc5..791d32e26435 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1229,6 +1229,19 @@ DECLARE_OOXMLEXPORT_TEST(testUnderlineColorGroupedShapes, "tdf132491_UnderlineCo "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[3]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "color"); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromRightMargin, "tdf133670_testRelativeAnchorWidthFromRightMargin.docx") +{ +// TODO: Fix export. +if (mbExported) +return; + +// tdf#133670 The width was set relative from right margin, but this was handled relative from page width. +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +const sal_Int32 nAnchoredWidth += getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(2408), nAnchoredWidth); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 4789ae807239..ae7ecf1ea295 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -641,6 +641,9 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const // E.g.: (left margin = 8 && relative size = 150%) -> width of some shape = 12. else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_LEFT) nWidth = GetPageFrame()->GetLeftMargin(); +// Same as the left margin above. +else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_RIGHT) +nWidth = GetPageFrame()->GetRightMargin(); else nWidth = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect().GetWidth(); nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth()); diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index d7128080dfeb..3773329c6a48 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -955,6 +955,14 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) xPropertySet->setPropertyValue("RelativeWidthRelation", uno::makeAny(text::RelOrientation::PAGE_LEFT)); } break; +case NS_ooxml::LN_ST_SizeRelFromH_rightMargin: +if (m_xShape.is()) +{ +// Same as the left margin above. +uno::Reference xPropertySet(m_xShape, uno::UNO_QUERY); + xPropertySet->setPropertyValue("RelativeWidthRelation", uno::makeAny(text::RelOrientation::PAGE_RIGHT)); +} +break; case NS_ooxml::LN_ST_SizeRelFromH_page: if (m_xShape.is()) { ___ Libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/layout/data/tdf125893.docx |binary sw/qa/extras/layout/layout.cxx |8 sw/source/core/layout/flowfrm.cxx | 14 -- 3 files changed, 20 insertions(+), 2 deletions(-) New commits: commit 461634632d796fc719e941d925021ae48a210e59 Author: László Németh AuthorDate: Wed Jun 24 17:18:31 2020 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Fri Jun 26 12:51:31 2020 +0200 tdf#125893 DOCX import: fix "half" contextual paragraph spacing Always ignore own top margin setting of the actual paragraph with contextual spacing, if the previous paragraph is identical. I.e. in that case, too, when the previous paragraph has no contextual spacing, like MSO does. Note: PARA_SPACE_MAX mode hasn't included this modification, yet, so only ODT documents converted from DOCX use it at the default setting. See also commit ba18832ceeda21f047a664b71a4333a54737e6c8 (tdf#75221: make margin collapsing implementation conform OASIS proposal) Change-Id: Ida9d12b2c511fcd5e38ade7eb5f4650387c65813 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97081 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit e318d5d8146d18e2c76e23f2e3c39527f2af9f36) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97065 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/layout/data/tdf125893.docx b/sw/qa/extras/layout/data/tdf125893.docx new file mode 100644 index ..f46f9af05ac3 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf125893.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index efd361609eaa..7fe63d3f2217 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3018,6 +3018,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128611) assertXPath(pXmlDoc, "//tab/row/cell[1]/txt/Text", "Portion", "Abcd efghijkl"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125893) +{ +createDoc("tdf125893.docx"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +// This was 400. The paragraph must have zero top border. +assertXPath(pXmlDoc, "/root/page/body/txt[4]/infos/prtBounds", "top", "0"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117188) { createDoc("tdf117188.docx"); diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 480d60571764..3833920c53a4 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1423,6 +1423,14 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, && lcl_getContextualSpacing(pPrevFrame) && lcl_IdenticalStyles(pPrevFrame, _rThis); +// tdf#125893 always ignore own top margin setting of the actual paragraph +// with contextual spacing, if the previous paragraph is identical +const bool bHalfContextualSpacing = !bContextualSpacing + && pAttrs->GetULSpace().GetContext() + && !lcl_getContextualSpacing(pPrevFrame) + && lcl_getContextualSpacing(_rThis) + && lcl_IdenticalStyles(pPrevFrame, _rThis); + // i#11860 - use new method to determine needed spacing // values of found previous frame and use these values. SwTwips nPrevLowerSpace = 0; @@ -1434,6 +1442,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, bPrevLineSpacingPorportional ); if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) ) { +// FIXME: apply bHalfContextualSpacing for better portability? nUpper = bContextualSpacing ? 0 : nPrevLowerSpace + pAttrs->GetULSpace().GetUpper(); SwTwips nAdd = nPrevLineSpacing; // i#11859 - consideration of the line spacing @@ -1477,8 +1486,9 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, } else { -nUpper = bContextualSpacing ? 0 : std::max(static_cast(nPrevLowerSpace), - static_cast(pAttrs->GetULSpace().GetUpper()) ); +nUpper = bContextualSpacing ? 0 : std::max(static_cast(nPrevLowerSpace), bHalfContextualSpacing + ? 0 : static_cast(pAttrs->GetULSpace().GetUpper()) ); + // i#11859 - consideration of the line spacing // for the upper spacing of a text frame if ( bUseFormerLineSpacing ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter.cxx | 14 ++ sw/source/uibase/shells/textfld.cxx | 11 +++ 2 files changed, 25 insertions(+) New commits: commit 86ed93261137e24c679baed137cc4559eb5376e4 Author: László Németh AuthorDate: Thu Jun 11 07:37:49 2020 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Thu Jun 25 13:48:58 2020 +0200 tdf#134035 sw: insert long date format for Hungarian in Writer using Insert->Field->Date or the similar toolbar function. Note: the previously used short date format -MM-DD is rare in Hungarian text documents, and it is no longer mentioned in the last Hungarian orthographic standard (But it's still default in Calc, as standardized by (MSZ) ISO 8601.) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx Change-Id: I09f2f3314356e84c73a42be9f06ceaa6769e7338 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96112 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 64641e9aa8f5399bae7846830176bcbfaf9d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96584 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index bb0d12aa7804..66137c9af662 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -375,6 +375,7 @@ public: void testTdf133589(); #endif void testInconsistentBookmark(); +void testInsertLongDateFormat(); #if HAVE_FEATURE_PDFIUM void testInsertPdf(); #endif @@ -593,6 +594,7 @@ public: #if ENABLE_LIBNUMBERTEXT CPPUNIT_TEST(testTdf133589); #endif +CPPUNIT_TEST(testInsertLongDateFormat); #if HAVE_FEATURE_PDFIUM CPPUNIT_TEST(testInsertPdf); #endif @@ -7319,6 +7321,18 @@ void SwUiWriterTest::testTdf133589() } #endif +void SwUiWriterTest::testInsertLongDateFormat() +{ +// only for Hungarian, yet +createDoc("tdf133524.fodt"); +dispatchCommand(mxComponent, ".uno:InsertDateField", {}); +// Make sure that the document starts with a field now, and its expanded string value contains space +const uno::Reference< text::XTextRange > xField = getRun(getParagraph(1), 1); +CPPUNIT_ASSERT_EQUAL(OUString("TextField"), getProperty(xField, "TextPortionType")); +// the date format was "-MM-DD", but now ". MMM DD." +CPPUNIT_ASSERT(xField->getString().indexOf(" ") > -1); +} + #if HAVE_FEATURE_PDFIUM void SwUiWriterTest::testInsertPdf() { diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 929b731e6856..9b7d3b10a4fd 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -60,6 +60,7 @@ #include #include #include +#include using namespace nsSwDocInfoSubType; @@ -605,9 +606,19 @@ void SwTextShell::ExecField(SfxRequest ) break; case FN_INSERT_FLD_DATE: +{ nInsertType = SwFieldTypesEnum::Date; bIsText = false; +// use long date format for Hungarian +SwPaM* pCursorPos = rSh.GetCursor(); +if( pCursorPos ) +{ +LanguageType nLang = pCursorPos->GetPoint()->nNode.GetNode().GetTextNode()->GetLang(pCursorPos->GetPoint()->nContent.GetIndex()); +if (nLang == LANGUAGE_HUNGARIAN) +nInsertFormat = rSh.GetNumberFormatter()->GetFormatIndex(NF_DATE_SYSTEM_LONG, nLang); +} goto FIELD_INSERT; +} case FN_INSERT_FLD_TIME: nInsertType = SwFieldTypesEnum::Time; bIsText = false; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 14 ++ sw/source/core/layout/anchoreddrawobject.cxx | 13 ++--- writerfilter/source/dmapper/GraphicImport.cxx | 10 +++ 4 files changed, 33 insertions(+), 4 deletions(-) New commits: commit 5451833f3af5582a8cab7e4b3da402f083f56908 Author: Szabolcs Toth AuthorDate: Thu Jun 4 15:43:42 2020 +0200 Commit: Xisco Fauli CommitDate: Thu Jun 25 12:17:27 2020 +0200 tdf#132976 DOCX import: fix shape width relative to left margin using UNO API RelativeWidthRelation and the associated lo-ext attribute for OpenDocument export. See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4 (offapi: document the 4 new properties which are no longer read-only). Co-authored-by: Balázs Regényi Change-Id: I2dada8ad764a1fba33d241117cc4bc5eddae74ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95525 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 7380905abc0833d9e4c4fe731d76174db8a8724c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96998 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx new file mode 100644 index ..2f1c5560c17a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 4df9baf213ea..80ca3e83b8fe 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1153,6 +1153,20 @@ DECLARE_OOXMLEXPORT_TEST(testShapeLineWidth, "tdf92526_ShapeLineWidth.odt") "/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln", "w", "0"); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromLeftMargin, "tdf132976_testRelativeAnchorWidthFromLeftMargin.docx") +{ +// TODO: Fix export. +if (mbExported) +return; + +// tdf#132976 The size of the width of this shape should come from the size of the left margin. +// It was set to the size of the width of the entire page before. +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +const sal_Int32 nAnchoredWidth += getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(1133), nAnchoredWidth); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 5f60d769a44a..4789ae807239 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -632,13 +632,18 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const long nTargetWidth = aCurrObjRect.GetWidth( ); if ( GetDrawObj( )->GetRelativeWidth( ) ) { -tools::Rectangle aPageRect; +long nWidth = 0; if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::FRAME) // Exclude margins. -aPageRect = GetPageFrame()->getFramePrintArea().SVRect(); +nWidth = GetPageFrame()->getFramePrintArea().SVRect().GetWidth(); +// Here we handle the relative size of the width of some shape. +// The size of the shape's width is going to be relative to the size of the left margin. +// E.g.: (left margin = 8 && relative size = 150%) -> width of some shape = 12. +else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_LEFT) +nWidth = GetPageFrame()->GetLeftMargin(); else -aPageRect = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect(); -nTargetWidth = aPageRect.GetWidth( ) * (*GetDrawObj( )->GetRelativeWidth()); +nWidth = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect().GetWidth(); +nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth()); } long nTargetHeight = aCurrObjRect.GetHeight( ); diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 7b23e790..d7128080dfeb 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -945,6 +945,16 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/layout/data/tdf130218.fodt | 86 sw/qa/extras/layout/layout.cxx | 16 + sw/source/core/text/itrcrsr.cxx | 10 +++ 3 files changed, 112 insertions(+) New commits: commit d593fef07be33cf7999b191e0f4aa87e79e2845c Author: László Németh AuthorDate: Mon Jun 22 15:59:05 2020 +0200 Commit: Xisco Fauli CommitDate: Wed Jun 24 14:55:51 2020 +0200 tdf#130218 sw: show hanging indent in narrow cells Instead of hiding it, show hanging first paragraph line in narrow table cells, like MSO does. Change-Id: Ibfa7242644db36c1be4d2fe93af75cb295d443b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96865 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 2eecf2b007a44c4e2ce2877af2c841875a70c282) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97001 Reviewed-by: Xisco Fauli Tested-by: Jenkins diff --git a/sw/qa/extras/layout/data/tdf130218.fodt b/sw/qa/extras/layout/data/tdf130218.fodt new file mode 100644 index ..d9031871bfd5 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf130218.fodt @@ -0,0 +1,86 @@ + + +http://www.w3.org/2003/g/data-view#; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:css3t="http://www.w3.org/TR/css3-text/; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:ooow="http://openoffice.org/2004/writer; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:tableooo="http://openoffice.org/2009/table; xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1. 0" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:ooo="http://openoffice.org/2004/office; xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:officeooo="http://openoffice.org/2009/office; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:rpt="http://op enoffice.org/2005/report" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + 2018-08-13T16:49:19.8844595662018-08-13T16:56:24.066877759PT7M6S2LibreOfficeDev/6.4.0.0.alpha0$Linux_X86_64 LibreOffice_project/628fbb66869ea82a1f38132ff2ba39e9666083eb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Text + + + First column should have visible content + + + + + Text + + + With hanging indent, too. + + + + + + + diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index cbf995ec1acf..efd361609eaa 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3515,6 +3515,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf113014) assertXPathContent(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/textarray[5]/text", "3."); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130218) +{ +SwDoc* pDoc = createDoc("tdf130218.fodt"); +SwDocShell* pShell = pDoc->GetDocShell(); + +// Dump the rendering of the first page as an XML file. +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; + +xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +CPPUNIT_ASSERT(pXmlDoc); + +// This failed, if hanging first line was hidden +assertXPathContent(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/textarray[1]/text", "Text"); +} +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf133701.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport6.cxx| 10 ++ sw/source/filter/ww8/docxattributeoutput.cxx |9 - 3 files changed, 18 insertions(+), 1 deletion(-) New commits: commit ebe228dc28773816beaa78837a8441513270cb67 Author: Tibor Nagy AuthorDate: Tue Jun 9 13:38:35 2020 +0200 Commit: Xisco Fauli CommitDate: Wed Jun 24 12:24:20 2020 +0200 tdf#133701 DOXC export: fix frame distance from text Vertical and horizontal minimum distances of frame and the text wrapping around the frame were not exported. Note: different left/right, top/bottom values aren't supported by OOXML hSpace, vSpace, so calculate average values to keep the page layout. Co-authored-by: Attila Bakos (NISZ) Change-Id: Ieef999003bcc6b9bba0a932ee4dd2b5461380c17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96110 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit a2113f5f46921c38a0c4929bb564183009a838e9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96698 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf133701.docx b/sw/qa/extras/ooxmlexport/data/tdf133701.docx new file mode 100644 index ..dfef409c268c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133701.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 0ac24cb2519a..123a339c6232 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -42,6 +42,16 @@ protected: } }; +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133701, "tdf133701.docx") +{ +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "hSpace", "567"); +assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "vSpace", "284"); +} + DECLARE_OOXMLEXPORT_TEST(testDmlShapeTitle, "dml-shape-title.docx") { CPPUNIT_ASSERT_EQUAL(OUString("Title"), getProperty(getShape(1), "Title")); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 73651c287a54..4a694015b098 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -560,7 +560,6 @@ static void lcl_deleteAndResetTheLists( rtl::ReferenceGetHoriOrient().GetPos(), pFrameFormat->GetVertOrient().GetPos()); @@ -571,6 +570,14 @@ void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFor attrList->add( FSNS( XML_w, XML_x), OString::number(aPos.X)); attrList->add( FSNS( XML_w, XML_y), OString::number(aPos.Y)); +sal_Int16 nLeft = pFrameFormat->GetLRSpace().GetLeft(); +sal_Int16 nRight = pFrameFormat->GetLRSpace().GetRight(); +sal_Int16 nUpper = pFrameFormat->GetULSpace().GetUpper(); +sal_Int16 nLower = pFrameFormat->GetULSpace().GetLower(); + +attrList->add(FSNS(XML_w, XML_hSpace), OString::number((nLeft + nRight) / 2)); +attrList->add(FSNS(XML_w, XML_vSpace), OString::number((nUpper + nLower) / 2)); + OString relativeFromH = convertToOOXMLHoriOrientRel( pFrameFormat->GetHoriOrient().GetRelationOrient() ); OString relativeFromV = convertToOOXMLVertOrientRel( pFrameFormat->GetVertOrient().GetRelationOrient() ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf133924.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport6.cxx| 12 +++- sw/source/filter/ww8/docxattributeoutput.cxx | 11 --- 3 files changed, 15 insertions(+), 8 deletions(-) New commits: commit d4dbf1cc87ae21567acc96a409974f1d159d550f Author: Tibor Nagy AuthorDate: Sun Jun 14 16:23:54 2020 +0200 Commit: Xisco Fauli CommitDate: Wed Jun 24 12:20:19 2020 +0200 tdf#133924 DOCX export: fix text wraps around frame Co-authored-by: Attila Bakos (NISZ) Change-Id: I08f0c8a8f4f554178548ca5fc8d072998a379b32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96290 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 9bbc60c0d5e60eacecd624f343aecc94e4219c84) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96699 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf133924.docx b/sw/qa/extras/ooxmlexport/data/tdf133924.docx new file mode 100644 index ..3bdbe8d6f1e0 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133924.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 877594f9f2f2..0ac24cb2519a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -967,7 +967,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133457, "tdf133457.docx") if (!pXmlDocument) return; -assertXPath(pXmlDocument, "/w:document/w:body/w:p[4]/w:pPr/w:framePr","vAnchor","text"); +assertXPath(pXmlDocument, "/w:document/w:body/w:p[4]/w:pPr/w:framePr", "vAnchor", "text"); +} + +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133924, "tdf133924.docx") +{ +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "wrap", "around"); +assertXPath(pXmlDocument, "/w:document/w:body/w:p[3]/w:pPr/w:framePr", "wrap", "notBeside"); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 7cca8917d565..73651c287a54 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -577,17 +577,14 @@ void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFor switch (pFrameFormat->GetSurround().GetValue()) { case css::text::WrapTextMode_NONE: -attrList->add( FSNS( XML_w, XML_wrap), "none"); -break; -case css::text::WrapTextMode_THROUGH: -attrList->add( FSNS( XML_w, XML_wrap), "through"); -break; -case css::text::WrapTextMode_PARALLEL: attrList->add( FSNS( XML_w, XML_wrap), "notBeside"); break; case css::text::WrapTextMode_DYNAMIC: +attrList->add(FSNS(XML_w, XML_wrap), "auto"); +break; +case css::text::WrapTextMode_PARALLEL: default: -attrList->add( FSNS( XML_w, XML_wrap), "auto"); +attrList->add(FSNS(XML_w, XML_wrap), "around"); break; } attrList->add( FSNS( XML_w, XML_vAnchor), relativeFromV ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/uiwriter/data3/tdf130805.odt |binary sw/qa/extras/uiwriter/uiwriter3.cxx | 31 ++ sw/source/core/doc/textboxhelper.cxx | 14 +++-- 3 files changed, 43 insertions(+), 2 deletions(-) New commits: commit 2479ae3ee20fc5f3cbb0c88eb09110a36e86710c Author: Attila Bakos AuthorDate: Tue May 26 10:09:51 2020 +0200 Commit: Xisco Fauli CommitDate: Fri Jun 19 15:12:34 2020 +0200 tdf#130805 SwTextBoxHelper::create: fix frame position in shape Text frame added by menu option "Add Text Box" of a shape was misplaced if there were more paragraphs after the shape anchor position. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I8a47aff57d3a60f7dbd2a1b75296e2664a1f745f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94822 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 06e2cbb31d0ea703df872b91eb8eacdcaced7653) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95976 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/data3/tdf130805.odt b/sw/qa/extras/uiwriter/data3/tdf130805.odt new file mode 100644 index ..12e215123aa3 Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf130805.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 2ba1db6974d2..cdb1e5c3bb41 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -13,6 +13,10 @@ #include #include #include +#include +#include +#include +#include #include @@ -525,6 +529,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf80663) CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTextTable->getColumns()->getCount()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130805) +{ +load(DATA_DIRECTORY, "tdf130805.odt"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +SwWrtShell* pWrtSh = pTextDoc->GetDocShell()->GetWrtShell(); +CPPUNIT_ASSERT(pWrtSh); + +const SwFrameFormats& rFrmFormats = *pWrtSh->GetDoc()->GetSpzFrameFormats(); +CPPUNIT_ASSERT(rFrmFormats.size() >= size_t(o3tl::make_unsigned(1))); +auto pShape = rFrmFormats.front(); +CPPUNIT_ASSERT(pShape); + +SwTextBoxHelper::create(pShape); +auto pTxBxFrm = SwTextBoxHelper::getOtherTextBoxFormat(getShape(1)); +CPPUNIT_ASSERT(pTxBxFrm); + +auto pTxAnch = pTxBxFrm->GetAnchor().GetContentAnchor(); +auto pShpAnch = pShape->GetAnchor().GetContentAnchor(); +CPPUNIT_ASSERT(pTxAnch); +CPPUNIT_ASSERT(pShpAnch); + +CPPUNIT_ASSERT_EQUAL_MESSAGE("The textbox got apart!", pTxAnch->nNode, pShpAnch->nNode); +//CPPUNIT_ASSERT_EQUAL_MESSAGE("", xShp->getPosition().Y, xShp2->getPosition().Y); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf96067) { mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index e2b1e9fa6498..ae7084605e4c 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -63,8 +63,18 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape) pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY); uno::Reference xTextContentAppend(xTextDocument->getText(), uno::UNO_QUERY); - -xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence()); +try +{ +SdrObject* pSourceSDRShape = pShape->FindRealSdrObject(); +uno::Reference XSourceShape(pSourceSDRShape->getUnoShape(), +uno::UNO_QUERY_THROW); +xTextContentAppend->insertTextContentWithProperties( +xTextFrame, uno::Sequence(), XSourceShape->getAnchor()); +} +catch (uno::Exception&) +{ +xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence()); +} // Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls). uno::Reference xRealTextFrame(xTextFrame, uno::UNO_QUERY); auto pTextFrame = dynamic_cast(xRealTextFrame.get()); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf134063.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 13 + sw/source/core/text/txttab.cxx | 15 ++- 3 files changed, 19 insertions(+), 9 deletions(-) New commits: commit 94269e6cb2a0566f67bcd3a8499489de90ffd39f Author: Vasily Melenchuk AuthorDate: Wed Jun 17 13:42:37 2020 +0300 Commit: Vasily Melenchuk CommitDate: Thu Jun 18 19:23:45 2020 +0200 tdf#134063: sw: redesigned support for tab at zero position Initial support for tab position at zero (d2e428d1) was not taking into account hack for tab positions below zero. So previous behavior is restored (search is started from 0) but we also taking into account potential tabs at zero position in SwLineInfo::GetTabStop() Change-Id: I8b315ab69f9a53ac15002a41a81e069ff832f692 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96526 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit 02c0e015f84ddcc6fa94433f603ef89f358a0391) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96582 Reviewed-by: Vasily Melenchuk diff --git a/sw/qa/extras/ooxmlexport/data/tdf134063.docx b/sw/qa/extras/ooxmlexport/data/tdf134063.docx new file mode 100644 index ..372fed20e57f Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf134063.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 08bbc76883d5..948bca6d74ac 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -39,6 +39,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133370_columnBreak, "tdf133370_columnBreak.odt") CPPUNIT_ASSERT_EQUAL(1, getPages()); } + +DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx") +{ +CPPUNIT_ASSERT_EQUAL(2, getPages()); + +xmlDocUniquePtr pDump = parseLayoutDump(); + +// There are three tabs with default width +CPPUNIT_ASSERT_EQUAL(sal_Int32(720), getXPath(pDump, "//page[1]/body/txt[1]/Text[1]", "nWidth").toInt32()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(720), getXPath(pDump, "//page[1]/body/txt[1]/Text[2]", "nWidth").toInt32()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(720), getXPath(pDump, "//page[1]/body/txt[1]/Text[3]", "nWidth").toInt32()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 616a919eb2e0..df8b5ee4ce75 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -48,6 +48,11 @@ const SvxTabStop *SwLineInfo::GetTabStop( const SwTwips nSearchPos, const SwTwip if( rTabStop.GetTabPos() > SwTwips(nRight) ) return i ? nullptr : +// If we are starting search from zero position, +// than we should include tabstop at zero position +if ((nSearchPos == 0) && (rTabStop.GetTabPos() == 0)) +return + if( rTabStop.GetTabPos() > nSearchPos ) return } @@ -119,7 +124,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo , bool bAuto // #i24363# tab stops relative to indent // nSearchPos: The current position relative to the tabs origin -SwTwips nSearchPos = bRTL ? +const SwTwips nSearchPos = bRTL ? nTabLeft - nCurrentAbsPos : nCurrentAbsPos - nTabLeft; @@ -127,14 +132,6 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo , bool bAuto // any hard set tab stops: // Note: If there are no user defined tab stops, there is always a // default tab stop. - -// If search is started from zero position (beginning of line), than -// lets do it from -1: this will allow to include into account potential -// tab stop at zero position. Yes, it will be zero width tab useless -// mostly, but this have sense in case of lists. -if (nSearchPos == 0) -nSearchPos = -1; - const SvxTabStop* pTabStop = m_aLineInf.GetTabStop( nSearchPos, nMyRight ); if ( pTabStop ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ww8export/data/tdf120394.doc |binary sw/qa/extras/ww8export/ww8export3.cxx | 30 + sw/source/filter/ww8/ww8par.hxx |3 sw/source/filter/ww8/ww8par3.cxx | 157 ++ 4 files changed, 63 insertions(+), 127 deletions(-) New commits: commit e66bd1f65ffdad9ea5450a11dfd1fb78556b1927 Author: Vasily Melenchuk AuthorDate: Tue May 19 10:24:35 2020 +0300 Commit: Vasily Melenchuk CommitDate: Thu Jun 18 19:23:05 2020 +0200 tdf#120394: doc import: use list format string Since introducion of list level format string there is no need in complex parsing of doc level string and convering it to prefix-number-suffix format. We can just replace there special chars by %n placeholders (used in docx and now in LO) and this should be enough. Change-Id: I4e947939c4d4f393ee7e16c851cf22567d352ac3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94475 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit 7e605bc3ff0cfea76be4683f0170d821fcae7203) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96630 Reviewed-by: Vasily Melenchuk diff --git a/sw/qa/extras/ww8export/data/tdf120394.doc b/sw/qa/extras/ww8export/data/tdf120394.doc new file mode 100644 index ..2ee9058a59ef Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf120394.doc differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 96547e30133a..f998ffe1d85a 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -561,6 +561,36 @@ DECLARE_WW8EXPORT_TEST(testPresetDash, "tdf127166_prstDash_Word97.doc") } } +DECLARE_WW8EXPORT_TEST(testTdf120394, "tdf120394.doc") +{ +CPPUNIT_ASSERT_EQUAL(1, getPages()); +{ +uno::Reference xPara(getParagraph(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(2), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1.1.1"), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(5), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString(CHAR_ZWSP), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(8), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(2), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString(CHAR_ZWSP), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(9), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(2), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1.1.2"), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(10), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(2), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString(CHAR_ZWSP), getProperty(xPara, "ListLabelString")); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 679c56a01ad5..810b692ee6aa 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -176,8 +176,7 @@ private: //the rParaSprms returns back the original word paragraph indent //sprms which are attached to this numbering level bool ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr& rpItemSet, sal_uInt16 nLevelStyle, -bool bSetStartNo, std::deque , sal_uInt16 nLevel, -ww::bytes ); +bool bSetStartNo, sal_uInt16 nLevel, ww::bytes ); // character attributes from GrpprlChpx typedef std::unique_ptr WW8aISet[nMaxLevel]; diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index d35adc6ca42e..02c02ecc459d 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -70,6 +70,7 @@ #include #include #include +#include using namespace com::sun::star; using namespace sw::util; @@ -489,18 +490,6 @@ WW8LSTInfo* WW8ListManager::GetLSTByListId( sal_uInt32 nIdLst ) const return aResult->get(); } -static void lcl_CopyGreaterEight(OUString , OUString const , -sal_Int32 nStart, sal_Int32 nLen = SAL_MAX_INT32) -{ -const sal_Int32 nMaxLen = std::min(rSrc.getLength(), nLen); -for( sal_Int32 nI = nStart; nI < nMaxLen; ++nI) -{ -sal_Unicode nChar = rSrc[nI]; -if (nChar > WW8ListManager::nMaxLevel) -rDest += OUStringChar(nChar); -} -} - static OUString sanitizeString(const OUString& rString) { sal_Int32 i=0; @@ -628,20 +617,15 @@ SvxNumType WW8ListManager::GetSvxNumTypeFromMSONFC(sal_uInt16 nNFC) } bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr&
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/layout/data/tdf106234.fodt | 31 +++ sw/qa/extras/layout/layout.cxx | 21 + sw/source/core/text/itradj.cxx | 17 - 3 files changed, 68 insertions(+), 1 deletion(-) New commits: commit 0d963060b612977139138d25b9e4649f84800a28 Author: László Németh AuthorDate: Tue Jun 16 08:13:19 2020 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Wed Jun 17 05:25:25 2020 +0200 tdf#106234 sw: don't justify after centered tabs (also after right-aligned and decimal-aligned tabs) before manual line break in a justified paragraph. Justify only after left-aligned tabs, like MSO does. Regression from commit 07dcbed5fb6d88f69d84313ddede81c222a5a7a6 (INTEGRATION: CWS fmebugs01 (1.15.104); FILE MERGED 2004/02/09 15:13:57 fme 1.15.104.1: #i13507# Justified alignment for lines containing manual breaks). See also commit 5d7b3475278f59a423c2139ae51f9b4849621890 (INTEGRATION: CWS swqbf34 (1.17.96); FILE MERGED 2005/06/29 12:12:25 fme 1.17.96.2: #i49277# New compatibility option bDoNotJustifyLinesWithManualBreak). Change-Id: Ib92e301aaf46eec283c0850d23549b1b54106068 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96438 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit d5325013c4f71595dc4edd08e3957d27bc5e0d9b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96426 Tested-by: Adolfo Jayme Barrientos Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/layout/data/tdf106234.fodt b/sw/qa/extras/layout/data/tdf106234.fodt new file mode 100644 index ..18667c4ab152 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf106234.fodt @@ -0,0 +1,31 @@ + +http://openoffice.org/2009/office; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + + + + + + + + + Lorem ipsumdolor sit amet, consectetur adipiscing elit. (Justify after left-aligned tab) + Lorem ipsumdolor sit amet, consectetur adipiscing elit. (Don’t justify after centered tab!) + + + diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 96c6edc51634..cbf995ec1acf 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3071,6 +3071,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287) assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak", 1); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf106234) +{ +createDoc("tdf106234.fodt"); +// Ensure that all text portions are calculated before testing. +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); +SwViewShell* pViewShell += pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); +CPPUNIT_ASSERT(pViewShell); +pViewShell->Reformat(); + +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +// In justified paragraphs, there is justification between left tabulators and page breaks +assertXPath(pXmlDoc, "/root/page/body/txt[1]/Special", "nType", "PortionType::Margin"); +assertXPathNoAttribute(pXmlDoc, "/root/page/body/txt[1]/Special", "nWidth"); +// but not after centered, right and decimal tabulators +assertXPath(pXmlDoc, "/root/page/body/txt[2]/Special", "nType", "PortionType::Margin"); +// This was a justified line, without nWidth +assertXPath(pXmlDoc, "/root/page/body/txt[2]/Special", "nWidth", "7881"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287b) { createDoc("tdf120287b.fodt"); diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx index e3c24e6cf5ca..64a53c3c4481 100644 --- a/sw/source/core/text/itradj.cxx +++ b/sw/source/core/text/itradj.cxx @@ -287,18 +287,33 @@ void SwTextAdjuster::CalcNewBlock( SwLineLayout *pCurrent, // #i49277# const bool bDoNotJustifyLinesWithManualBreak = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK); +bool bDoNotJustifyTab = false; SwLinePortion *pPos = pCurrent->GetNextPortion(); while( pPos ) { -if ( bDoNotJustifyLinesWithManualBreak && +if ( ( bDoNotJustifyLinesWithManualBreak || bDoNotJustifyTab ) && pPos->IsBreakPortion() && !IsLastBlock() ) { pCurrent->FinishSpaceAdd(); break; } +switch ( pPos->GetWhichPor() ) +{ +case PortionType::TabCenter : +case PortionType::TabRight : +case PortionType::TabDecimal : +bDoNotJustifyTab = true; +break; +case PortionType::TabLeft : +case
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf133065.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 28 +++ sw/qa/inc/swmodeltestbase.hxx|1 sw/source/filter/ww8/docxattributeoutput.cxx | 25 4 files changed, 54 insertions(+) New commits: commit e0ba88a08c9c16fd805e13956ac9676f4ddfd377 Author: Attila Bakos AuthorDate: Thu May 14 15:48:21 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Jun 16 13:30:05 2020 +0200 tdf#133065 tdf#133602 DOCX export: fix OLE wrap regression caused by commit 2150fdc7d0f63288ac56c33cb898589512057642 (tdf#131539 DOCX export: fix position of OLE objects). The wrap setting of the anchored OLE object were not preserved. Note: It needs also z-order export for background mode. Co-authored-by: Tibor Nagy Change-Id: I7f8c48019157dda00bcc97a490c5f582eccf1b22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94220 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 8233feccaada8cf5f5bbcb1fc365ee99299dd701) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95983 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf133065.odt b/sw/qa/extras/ooxmlexport/data/tdf133065.odt new file mode 100644 index ..a5e1b3587a5d Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133065.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 43cdd62d5b20..e2c5f0dbf9b6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -114,6 +114,34 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123873, "tdf123873.docx") p_XmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:drawing/wp:anchor/wp:wrapTopAndBottom"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Tdf133065, "tdf133065.odt") +{ +auto pxmldoc = parseExport("word/document.xml"); +CPPUNIT_ASSERT(pxmldoc); +OUString aVal; + +aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[3]/w:r[2]/w:object/v:shape/w10:wrap", "type"); +CPPUNIT_ASSERT(aVal.indexOf("square") > -1); +aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[3]/w:r[2]/w:object/v:shape/w10:wrap", "side"); +CPPUNIT_ASSERT(aVal.indexOf("left") > -1); + +aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[8]/w:r[2]/w:object/v:shape/w10:wrap", "type"); +CPPUNIT_ASSERT(aVal.indexOf("square") > -1); +aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[8]/w:r[2]/w:object/v:shape/w10:wrap", "side"); +CPPUNIT_ASSERT(aVal.indexOf("right") > -1); + +aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[12]/w:r[2]/w:object/v:shape/w10:wrap", "type"); +CPPUNIT_ASSERT(aVal.indexOf("square") > -1); +aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[12]/w:r[2]/w:object/v:shape/w10:wrap", "side"); +CPPUNIT_ASSERT(aVal.indexOf("largest") > -1); + +aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[20]/w:r[2]/w:object/v:shape/w10:wrap", "type"); +CPPUNIT_ASSERT(aVal.indexOf("topAndBottom") > -1); + +aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[24]/w:r[2]/w:object/v:shape/w10:wrap", "type"); +CPPUNIT_ASSERT(aVal.indexOf("square") > -1); +} + DECLARE_OOXMLEXPORT_TEST(testTdf130814model, "tdf130814.docx") { CPPUNIT_ASSERT_EQUAL(sal_Int32(0x1F497D), getProperty(getRun(getParagraph(2), 1), "CharColor")); diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 32db863d5d3d..8265801f36f8 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -989,6 +989,7 @@ protected: xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a14"), BAD_CAST("http://schemas.microsoft.com/office/drawing/2010/main;)); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("c"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/chart;)); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("o"), BAD_CAST("urn:schemas-microsoft-com:office:office")); +xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w10"), BAD_CAST("urn:schemas-microsoft-com:office:word")); // odt xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("office"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:office:1.0")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("style"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:style:1.0")); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 2df0e557ae1e..7cca8917d565 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5608,6 +5608,31 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S FSNS( XML_r, XML_id ), sImageId.toUtf8(), FSNS( XML_o, XML_title ), "" ); +//export wrap settings +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/core/layout/data/continuous-endnotes-move-backwards.doc |binary sw/qa/core/layout/layout.cxx | 17 + sw/source/core/layout/ftnfrm.cxx | 18 ++ 3 files changed, 35 insertions(+) New commits: commit b67ee7ed04fb081c21205ada72c0843af92de28c Author: Miklos Vajna AuthorDate: Mon Jun 15 21:04:56 2020 +0200 Commit: Miklos Vajna CommitDate: Tue Jun 16 13:19:35 2020 +0200 tdf#133145 sw ContinuousEndnotes: fix moving endnotes to a previous page Regression from commit 4814e8caa5f06c4fe438dfd7d7315e4a2410ea18 (tdf#124601 sw: add ContinuousEndnotes layout compat option, 2019-09-30), the problem was that SwFrame::GetPrevFootnoteLeaf() did not take the new compat flag into account when determining the previous footnote page for endnotes. Do the same pattern here as the cases already handled in the above commit, just try to get the "last but one" and not the "last" page, since we try to move these endnotes to a previous page. (cherry picked from commit 35bb0594b2d977312ef06fc5262cc7592bc13d0f) Change-Id: I77841a3a0fb68f054941184ee2a8aca0707d2a9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96432 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/core/layout/data/continuous-endnotes-move-backwards.doc b/sw/qa/core/layout/data/continuous-endnotes-move-backwards.doc new file mode 100644 index ..3ee6c56aa370 Binary files /dev/null and b/sw/qa/core/layout/data/continuous-endnotes-move-backwards.doc differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index cfc13640c471..ccf2b5cd513a 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -129,6 +129,23 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTablesMoveBackwards) assertXPath(pLayout, "//page", 1); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testContinuousEndnotesMoveBackwards) +{ +// Load a document with the ContinuousEndnotes flag turned on. +load(DATA_DIRECTORY, "continuous-endnotes-move-backwards.doc"); +xmlDocUniquePtr pLayout = parseLayoutDump(); +// We have 2 pages. +assertXPath(pLayout, "/root/page", 2); +// No endnote container on page 1. +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 0 +// - Actual : 1 +// i.e. there were unexpected endnotes on page 1. +assertXPath(pLayout, "/root/page[1]/ftncont", 0); +// All endnotes are in a container on page 2. +assertXPath(pLayout, "/root/page[2]/ftncont", 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 1b143e7d7b87..8ddd9747f840 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -750,13 +750,31 @@ SwLayoutFrame *SwFrame::GetPrevFootnoteLeaf( MakePageType eMakeFootnote ) { bool bEndn = pFootnote->GetAttr()->GetFootnote().IsEndNote(); SwFrame* pTmpRef = nullptr; +const IDocumentSettingAccess& rSettings += pFootnote->GetAttrSet()->GetDoc()->getIDocumentSettingAccess(); if( bEndn && pFootnote->IsInSct() ) { SwSectionFrame* pSect = pFootnote->FindSctFrame(); if( pSect->IsEndnAtEnd() ) +// Endnotes at the end of the section. pTmpRef = pSect->FindLastContent( SwFindMode::LastCnt ); } +else if (bEndn && rSettings.get(DocumentSettingId::CONTINUOUS_ENDNOTES)) +{ +// Endnotes at the end of the document. +SwPageFrame* pPage = getRootFrame()->GetLastPage(); +assert(pPage); +SwFrame* pPrevPage = pPage->GetPrev(); +if (pPrevPage) +{ +// Have a last but one page, use that since we try to get a preceding frame. +assert(pPrevPage->IsPageFrame()); +pPage = static_cast(pPrevPage); +} +pTmpRef = pPage->FindLastBodyContent(); +} if( !pTmpRef ) +// Endnotes on a separate page. pTmpRef = pFootnote->GetRef(); SwFootnoteBossFrame* pStop = pTmpRef->FindFootnoteBossFrame( !bEndn ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ww8import/data/image-lazy-read-0size.doc |binary sw/qa/extras/ww8import/ww8import.cxx | 16 sw/source/core/bastyp/swtypes.cxx |7 +++ 3 files changed, 23 insertions(+) New commits: commit 2da8c272528386e38deb679712adb879f2f412b2 Author: Miklos Vajna AuthorDate: Mon Jun 8 21:05:07 2020 +0200 Commit: Miklos Vajna CommitDate: Tue Jun 9 16:56:02 2020 +0200 tdf#133474 DOC import: fix lazy-loading of images with zero size DOC typically contains images with a size hint outside the image, but this is optional. Make sure that we load the image in case the size is not available without loading. The effect is that once SwWW8ImplReader::MapWrapIntoFlyFormat() calls SwGrfNode::GetTwipSize(), we always get a valid size. Ideally without loading the graphic. (cherry picked from commit 369355da5c1e25bad7124dd6e187d9e381759751) Change-Id: I81536ceb44c6e455e9bf274a5852008443f9d64f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95897 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ww8import/data/image-lazy-read-0size.doc b/sw/qa/extras/ww8import/data/image-lazy-read-0size.doc new file mode 100644 index ..80306cb1deda Binary files /dev/null and b/sw/qa/extras/ww8import/data/image-lazy-read-0size.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index dfbd496a31df..8a085472ea4a 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -186,6 +186,22 @@ DECLARE_OOXMLIMPORT_TEST(testImageLazyRead, "image-lazy-read.doc") CPPUNIT_ASSERT(!aGraphic.isAvailable()); } +DECLARE_OOXMLIMPORT_TEST(testImageLazyRead0size, "image-lazy-read-0size.doc") +{ +// Load a document with a single bitmap in it: it's declared as a WMF one, but actually a TGA +// bitmap. +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); +SwNode* pNode = pDoc->GetNodes()[6]; +SwGrfNode* pGrfNode = pNode->GetGrfNode(); +CPPUNIT_ASSERT(pGrfNode); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 7590x10440 +// - Actual : 0x0 +// i.e. the size was 0, even if the actual bitmap had a non-0 size. +CPPUNIT_ASSERT_EQUAL(Size(7590, 10440), pGrfNode->GetTwipSize()); +} + DECLARE_WW8IMPORT_TEST(testTdf106799, "tdf106799.doc") { // Ensure that all text portions are calculated before testing. diff --git a/sw/source/core/bastyp/swtypes.cxx b/sw/source/core/bastyp/swtypes.cxx index 620f4bab771a..59c01abb55cb 100644 --- a/sw/source/core/bastyp/swtypes.cxx +++ b/sw/source/core/bastyp/swtypes.cxx @@ -29,6 +29,13 @@ Size GetGraphicSizeTwip(const Graphic& rGraphic, vcl::RenderContext* pOutDev) { const MapMode aMapTwip(MapUnit::MapTwip); Size aSize(rGraphic.GetPrefSize()); + +if (!aSize.getWidth() && !aSize.getHeight()) +{ +const_cast(rGraphic).makeAvailable(); +aSize = rGraphic.GetPrefSize(); +} + if (MapUnit::MapPixel == rGraphic.GetPrefMapMode().GetMapUnit()) { if (!pOutDev) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf83309.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 14 ++ sw/source/core/text/txttab.cxx | 10 +- sw/source/filter/ww8/docxattributeoutput.cxx |2 +- sw/source/filter/ww8/wrtw8num.cxx|2 +- writerfilter/source/dmapper/NumberingManager.cxx |4 ++-- writerfilter/source/dmapper/NumberingManager.hxx |3 +-- 7 files changed, 28 insertions(+), 7 deletions(-) New commits: commit a380a06c1872091e8fa8c810e95a8e1d5dfe1820 Author: Vasily Melenchuk AuthorDate: Fri May 29 14:25:04 2020 +0300 Commit: Thorsten Behrens CommitDate: Sat Jun 6 02:19:42 2020 +0200 tdf#83309: docx import: allow for lists tabstop at zero position Zero position is valid value for tabstop, but previously it was treated as "no tab stop defined". Right now writer distinguishes tab stop at zero postion and no tab stop. Change-Id: Ie32da3d36a263644ba85a882029a8b29ae0501c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95132 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit d2e428d1abb9f2907c0b87d55830e8742f8209b9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95561 diff --git a/sw/qa/extras/ooxmlexport/data/tdf83309.docx b/sw/qa/extras/ooxmlexport/data/tdf83309.docx new file mode 100644 index ..8dfddb6ed201 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf83309.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index b95d0afe4e8f..43cdd62d5b20 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -578,6 +578,20 @@ DECLARE_OOXMLIMPORT_TEST(testTdf125038c, "tdf125038c.docx") CPPUNIT_ASSERT_EQUAL(OUString("email: t...@test.test"), aActual); } +DECLARE_OOXMLEXPORT_TEST(testTdf83309, "tdf83309.docx") +{ +CPPUNIT_ASSERT_EQUAL(1, getPages()); +OUString sNodeType; + +// First paragraph does not have tab before +sNodeType = parseDump("/root/page/body/txt[1]/Text[1]", "nType"); +CPPUNIT_ASSERT_EQUAL(OUString("PortionType::Text"), sNodeType); + +// Second paragraph starts with tab +sNodeType = parseDump("/root/page/body/txt[2]/Text[1]", "nType"); +CPPUNIT_ASSERT_EQUAL(OUString("PortionType::TabLeft"), sNodeType); +} + DECLARE_OOXMLEXPORT_TEST(testTdf121661, "tdf121661.docx") { xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"); diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index a38cbe048d44..616a919eb2e0 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -119,7 +119,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo , bool bAuto // #i24363# tab stops relative to indent // nSearchPos: The current position relative to the tabs origin -const SwTwips nSearchPos = bRTL ? +SwTwips nSearchPos = bRTL ? nTabLeft - nCurrentAbsPos : nCurrentAbsPos - nTabLeft; @@ -127,6 +127,14 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo , bool bAuto // any hard set tab stops: // Note: If there are no user defined tab stops, there is always a // default tab stop. + +// If search is started from zero position (beginning of line), than +// lets do it from -1: this will allow to include into account potential +// tab stop at zero position. Yes, it will be zero width tab useless +// mostly, but this have sense in case of lists. +if (nSearchPos == 0) +nSearchPos = -1; + const SvxTabStop* pTabStop = m_aLineInf.GetTabStop( nSearchPos, nMyRight ); if ( pTabStop ) { diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f5551f90ce57..2df0e557ae1e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6996,7 +6996,7 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel, // indentation m_pSerializer->startElementNS(XML_w, XML_pPr); -if( nListTabPos != 0 ) +if( nListTabPos >= 0 ) { m_pSerializer->startElementNS(XML_w, XML_tabs); m_pSerializer->singleElementNS( XML_w, XML_tab, diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 1774c37239e7..df51bb99be36 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -583,7 +583,7 @@ void MSWordExportBase::NumberingLevel( sal_Int16 nIndentAt = 0; sal_Int16 nFirstLineIndex = 0; -sal_Int16 nListTabPos = 0; +sal_Int16 nListTabPos = -1; // #i86652# if (rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION) diff --git
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf120394.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 25 + sw/qa/extras/rtfimport/rtfimport.cxx |5 +- sw/source/core/doc/number.cxx|7 +++ sw/source/filter/ww8/wrtw8num.cxx| 30 +++ writerfilter/source/dmapper/NumberingManager.cxx | 44 +++ 6 files changed, 56 insertions(+), 55 deletions(-) New commits: commit 36c713f673796f51b9bc657492b0c16396231805 Author: Vasily Melenchuk AuthorDate: Sun May 17 13:35:46 2020 +0300 Commit: Thorsten Behrens CommitDate: Fri Jun 5 01:13:05 2020 +0200 tdf#120394: DOCX list import: simplify zero width space hack Since introducion of list format string hack with creation of zero-width-space can be much more simple. It was being used to indicate existing, but empty list label suffix to avoid stripping down numbering. Change-Id: I9a0c6047f806b2c656ef5dbab0c6b38200818bd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94383 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit 8401181bf0232959efb516802abcda42377ea06e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95315 diff --git a/sw/qa/extras/ooxmlexport/data/tdf120394.docx b/sw/qa/extras/ooxmlexport/data/tdf120394.docx new file mode 100644 index ..39bd5886c0fe Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf120394.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index b372f2e86dcd..b95d0afe4e8f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -887,6 +887,31 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128290, "tdf128290.odt") assertXPath(pXml, "/w:document/w:body/w:tbl/w:tblPr/w:tblLayout", "type", "fixed"); } +DECLARE_OOXMLEXPORT_TEST(testTdf120394, "tdf120394.docx") +{ +CPPUNIT_ASSERT_EQUAL(1, getPages()); +{ +uno::Reference xPara(getParagraph(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(2), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(1), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString(CHAR_ZWSP), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(3), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(1), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString(CHAR_ZWSP), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(5), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(2), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1.2.1"), getProperty(xPara, "ListLabelString")); +} +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123757, "tdf123757.docx") { xmlDocUniquePtr pXml = parseExport("word/document.xml"); diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 085a71aedc86..cf9d5dd31309 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -343,8 +343,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo49692) if (rProp.Name == "Suffix") { -OUString aExpected(u'\x200B'); -CPPUNIT_ASSERT_EQUAL(aExpected, rProp.Value.get()); +CPPUNIT_ASSERT(rProp.Value.get().isEmpty()); } } } @@ -1358,7 +1357,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf78506) if (rProp.Name == "Suffix") // This was '0', invalid \levelnumbers wasn't ignored. -CPPUNIT_ASSERT_EQUAL(CHAR_ZWSP, rProp.Value.get().toChar()); +CPPUNIT_ASSERT(rProp.Value.get().isEmpty()); } } diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index d871a8033410..1de08ae9f761 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -667,6 +667,13 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto if (nPosition >= 0) sLevelFormat = sLevelFormat.replaceAt(nPosition, sFind.getLength(), sReplacement); } + +// As a fallback: caller code expects nonempty string as a result. +// But if we have empty string (and had no errors before) this is valid result. +// So use classical hack with zero-width-space as a string filling. +if (sLevelFormat.isEmpty()) +sLevelFormat = OUStringChar(CHAR_ZWSP); + aStr = sLevelFormat; } else diff --git a/sw/source/filter/ww8/wrtw8num.cxx
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
dev/null |binary sw/qa/extras/layout/layout.cxx |9 - sw/source/core/layout/tabfrm.cxx | 16 +--- 3 files changed, 1 insertion(+), 24 deletions(-) New commits: commit 0fe109a27c9a1b10b0b8a3314cb55926ecf103ae Author: Justin Luth AuthorDate: Sat May 30 14:20:02 2020 +0300 Commit: Justin Luth CommitDate: Wed Jun 3 15:48:44 2020 +0200 Revert "tdf#105478 sw layout: treat minHeight as "do not split row"" This reverts LO7.0 commit aa5dc0b48cd4db6883c9b52c68b16170c9c81d1f, in order to prevent regressions like tdf#133441. Change-Id: Id08f5277621703e1577fc9db917841b8b7c0bda5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95180 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 4e81ef96e3e1c10ca5162e4e4971c803780a75b4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95327 diff --git a/sw/qa/extras/layout/data/tdf105478_rowMinHeight.odt b/sw/qa/extras/layout/data/tdf105478_rowMinHeight.odt deleted file mode 100644 index 3a7fd600ceee.. Binary files a/sw/qa/extras/layout/data/tdf105478_rowMinHeight.odt and /dev/null differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index b896df2e03d4..96c6edc51634 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2841,15 +2841,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableExtrusion2) assertXPath(pXmlDoc, sXPath, 0); } -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf105478) -{ -createDoc("tdf105478_rowMinHeight.odt"); -xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - -// Minimum row height forces the cell (with table header as row 1) to start on page 2, not page 1. -assertXPathContent(pXmlDoc, "/root/page[2]/body/tab/row[2]/cell/txt[1]", "Cell 1"); -} - CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116848) { SwDoc* pDoc = createDoc("tdf116848.odt"); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index b0376110a433..f4aed1ed650d 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1091,21 +1091,7 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK m_pTable->SetRowsToRepeat(0); return false; } - -// Minimum row height has the same force as "do not split row" (as long as it fits on one page) -if ( bSplitRowAllowed && bTryToSplit && !pRow->IsRowSpanLine() ) -{ -const SwFormatFrameSize = pRow->GetFormat()->GetFrameSize(); -const sal_Int32 nMinHeight = rSz.GetHeightSizeType() == SwFrameSize::Minimum ? rSz.GetHeight() : 0; -if ( nMinHeight > nRemainingSpaceForLastRow ) -{ -// TODO: what if we are not in a page, but a column or something that is not page-sized. -const sal_Int32 nFullPageHeight = FindPageFrame()->getFramePrintArea().Height(); -bSplitRowAllowed = nMinHeight > nFullPageHeight; -} -} - -if ( !GetIndPrev() && nRepeat == nRowCount ) +else if ( !GetIndPrev() && nRepeat == nRowCount ) { // Second case: The first non-headline row does not fit to the page. // If it is not allowed to be split, or it contains a sub-row that ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/layout/data/abi11870-2.odt |binary sw/qa/extras/layout/layout.cxx |6 ++ sw/source/core/text/itrform2.cxx|2 +- sw/source/core/text/pormulti.cxx|8 +++- sw/source/core/text/porrst.cxx |9 - sw/source/core/text/porrst.hxx |7 +-- 6 files changed, 15 insertions(+), 17 deletions(-) New commits: commit deee67c566811189ee66d5766d0c9fc644a0120b Author: Michael Stahl AuthorDate: Tue Jun 2 18:16:15 2020 +0200 Commit: Michael Stahl CommitDate: Wed Jun 3 14:39:31 2020 +0200 crashtesting: fix abi11870-2.odt assert in SwBookmarkPortion::Unchain() This m_pPrevious pointer is a bad idea, should just use FindPrevPortion() to find it, which shouldn't take that long to iterate all the portions in the current line. (regression from 4ce8120f1e53f7b81e653b01d141643013bc69ab) Change-Id: Ibb5f2bb28d959958547ed27c51e5084cc746d642 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91622 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit f68749054f36f070310e70e2dbf0a11c496539c0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95415 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/layout/data/abi11870-2.odt b/sw/qa/extras/layout/data/abi11870-2.odt new file mode 100644 index ..b02bb85646aa Binary files /dev/null and b/sw/qa/extras/layout/data/abi11870-2.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index adac583c8ed2..b896df2e03d4 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3403,6 +3403,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116501) createDoc("tdf116501.odt"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testAbi11870) +{ +//just care it doesn't assert +createDoc("abi11870-2.odt"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118719) { // Insert a page break. diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 9e1abfa1bec8..17900f1a17e0 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1190,7 +1190,7 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo ) assert(bookmark & SwScriptInfo::MarkKind::Point); mark = '|'; } -pPor = new SwBookmarkPortion(rInf.GetLast(), mark); +pPor = new SwBookmarkPortion(mark); } } diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index f72e120848f6..2154eba1df73 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -2039,7 +2039,13 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo , if (rInf.GetLast()->GetWhichPor() == PortionType::Bookmark) { auto const pBookmark(static_cast(rInf.GetLast())); -rInf.SetLast(pBookmark->Unchain()); +auto *const pPrevious = pBookmark->FindPrevPortion(rInf.GetRoot()); +assert(!pPrevious || pPrevious->GetNextPortion() == pBookmark); +if (pPrevious) +{ +pPrevious->SetNextPortion(nullptr); +} +rInf.SetLast(pPrevious); assert(m_pCurr->GetNextPortion() == nullptr); m_pCurr->SetNextPortion(pBookmark); } diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 32b1e0b389c0..69183bc58557 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -630,13 +630,4 @@ sal_uInt16 SwControlCharPortion::GetViewWidth( const SwTextSizeInfo& rInf ) cons return mnViewWidth; } -SwLinePortion * SwBookmarkPortion::Unchain() -{ -assert(!m_pPrevious || m_pPrevious->GetNextPortion() == this); -m_pPrevious->SetNextPortion(nullptr); -auto const pTmp(m_pPrevious); -m_pPrevious = nullptr; -return pTmp; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/porrst.hxx b/sw/source/core/text/porrst.hxx index 3d4c54c7ecd8..7c716be8dba5 100644 --- a/sw/source/core/text/porrst.hxx +++ b/sw/source/core/text/porrst.hxx @@ -156,13 +156,9 @@ public: /// SwControlCharPortion these do not have a character in the text. class SwBookmarkPortion : public SwControlCharPortion { -private: -SwLinePortion * m_pPrevious; - public: -explicit SwBookmarkPortion(SwLinePortion *const pPrevious, sal_Unicode const cChar) +explicit SwBookmarkPortion(sal_Unicode const cChar) : SwControlCharPortion(cChar) -, m_pPrevious(pPrevious) { SetWhichPor(PortionType::Bookmark); SetLen(TextFrameIndex(0)); @@ -171,7 +167,6 @@ public: virtual bool DoPaint(SwTextPaintInfo const& rInf, OUString & rOutString, SwFont & rTmpFont, int & rDeltaY) const override; virtual SwLinePortion * Compress() override { return
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
sw/qa/extras/ww8export/data/tdf133453_realFontSize.doc |binary sw/qa/extras/ww8export/ww8export3.cxx |5 ++ sw/source/filter/ww8/ww8par6.cxx |2 - sw/source/filter/ww8/ww8scan.cxx | 32 + sw/source/filter/ww8/ww8scan.hxx |9 +++- 5 files changed, 30 insertions(+), 18 deletions(-) New commits: commit 59c2a8f3ceacabb3132ba1c02ab5e76e510572e9 Author: Justin Luth AuthorDate: Thu May 28 10:41:58 2020 +0300 Commit: Justin Luth CommitDate: Sat May 30 08:41:58 2020 +0200 tdf#133453 doc import: HasSprm can return last one The last sprm is the one that takes effect in the rare cases of duplicate SPRMs defined, so at least have an option to return that one as the matching value. Unfortunately, that seems to have been ignored in the last 20+ years of .doc support. So I added it carefully and only enabled finding the last SPRM in the specific case I was dealing with. However, I expect it should ~always be true, so perhaps I will followup with a patch looking for examples of duplicate/different SPRMs defined. Change-Id: I5539aa3d6117380cd6d852ca165d40c7c7f3c330 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95013 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna (cherry picked from commit 4efeee09bce9835f587ea7d1577471768bf73e2d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95125 diff --git a/sw/qa/extras/ww8export/data/tdf133453_realFontSize.doc b/sw/qa/extras/ww8export/data/tdf133453_realFontSize.doc new file mode 100644 index ..6fa50368087e Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf133453_realFontSize.doc differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 12a939eb6d31..96547e30133a 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -312,6 +312,11 @@ DECLARE_WW8EXPORT_TEST(testTdf120412_proportionalEscapement, "tdf120412_proporti CPPUNIT_ASSERT_EQUAL(2, getPages()); } +DECLARE_WW8EXPORT_TEST(testTdf133453_realFontSize, "tdf133453_realFontSize.doc") +{ +CPPUNIT_ASSERT_EQUAL( -95.f, getProperty(getRun(getParagraph(1), 2, "2"), "CharEscapement") ); +} + DECLARE_WW8EXPORT_TEST(testTdf12_fillStyleNone, "tdf12_fillStyleNone.docx") { uno::Reference xStyle(getStyles("ParagraphStyles")->getByName("Numbering - First level"), diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 7fd6ed3abc57..f070a50976ca 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -3450,7 +3450,7 @@ void SwWW8ImplReader::Read_SubSuperProp( sal_uInt16, const sal_uInt8* pData, sho if ( m_xPlcxMan ) { const sal_uInt16 nFontsizeID = m_bVer67 ? NS_sprm::v6::sprmCHps : NS_sprm::sprmCHps; -const SprmResult aFontsize = m_xPlcxMan->GetChpPLCF()->HasSprm( nFontsizeID ); +const SprmResult aFontsize = m_xPlcxMan->GetChpPLCF()->HasSprm( nFontsizeID, /*bFindFirst=*/false ); if ( aFontsize.pSprm && aFontsize.nRemainingData ) Read_FontSize(nFontsizeID, aFontsize.pSprm, aFontsize.nRemainingData); } diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 89cba1fce16f..30294ca3ab9f 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -915,26 +915,30 @@ void WW8SprmIter::UpdateMyMembers() } } -SprmResult WW8SprmIter::FindSprm(sal_uInt16 nId, const sal_uInt8* pNextByteMatch) +SprmResult WW8SprmIter::FindSprm(sal_uInt16 nId, bool bFindFirst, const sal_uInt8* pNextByteMatch) { +SprmResult aRet; + while (GetSprms()) { if (GetCurrentId() == nId) { sal_uInt16 nFixedLen = mrSprmParser.DistanceToData(nId); sal_uInt16 nL = mrSprmParser.GetSprmSize(nId, GetSprms(), GetRemLen()); -SprmResult aRet(GetCurrentParams(), nL - nFixedLen); // SPRM found! +SprmResult aSprmResult(GetCurrentParams(), nL - nFixedLen); // typically pNextByteMatch is nullptr and we just return the first match -if (!pNextByteMatch) -return aRet; // very occasionally we want one with a specific following byte -if (aRet.nRemainingData >= 1 && *aRet.pSprm == *pNextByteMatch) -return aRet; +if ( !pNextByteMatch || (aSprmResult.nRemainingData >= 1 && *aSprmResult.pSprm == *pNextByteMatch) ) +{ +if ( bFindFirst ) +return aSprmResult; +aRet = aSprmResult; +} } advance(); } -return SprmResult(); // SPRM _not_ found +return aRet; } // temporary test @@ -2945,7 +2949,7 @@ sal_uInt8*