[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter.cxx | 49 - sw/source/uibase/wrtsh/wrtsh1.cxx | 21 --- 2 files changed, 70 deletions(-) New commits: commit 08ede5d51a33f83ededee8a03c10f9bb8244690e Author: Justin Luth AuthorDate: Wed Oct 13 14:56:44 2021 +0200 Commit: Xisco Fauli CommitDate: Thu Oct 14 12:23:37 2021 +0200 tdf#134426 tdf#138873 sw: Revert "tdf#79717 ... ...save/restore character format on selection overwrite" which might also fix tdf#144638 as well. This reverts LO 6.3 commit 6abed0ea006f3616e40faf2ae782cf64f8ac2914. This 6.3 fix for bug 79717 has caused too many other problems that are not being looked at, so it should just be reverted. It is spamming documents with direct formatting which is a terrible thing to have happen by accident. It completely wrecks the proper use of styles. Also revert asscoiated follow-up commits: Revert "tdf#79717 save/restore character style on selection overwrite" This reverts commit 6.3 04bd1925706360414438b814046b543c5e317d0a. Revert "tdf#79717: sw_uiwriter: Add unittest" This reverts commit 7.1 b05955b480fe4d32852e7be8a118d46ca7e6dbfa. These effectively revert 7.0.4 12eac5bcbc9b71bf00cb88b918988826229cca35 but its unit test is left intact. Change-Id: Ideced4d38bfdf4c82f1744534afbaad29689fded Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123566 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123577 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 702dc90636fd..8579f46b9b87 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -216,7 +216,6 @@ public: void testCaretPositionMovingUp(); void testTdf93441(); void testTdf81226(); -void testTdf79717(); void testTdf137532(); void testFdo87448(); void testTextCursorInvalidation(); @@ -451,7 +450,6 @@ public: CPPUNIT_TEST(testCaretPositionMovingUp); CPPUNIT_TEST(testTdf93441); CPPUNIT_TEST(testTdf81226); -CPPUNIT_TEST(testTdf79717); CPPUNIT_TEST(testTdf137532); CPPUNIT_TEST(testFdo87448); CPPUNIT_TEST(testTextCursorInvalidation); @@ -2069,53 +2067,6 @@ void SwUiWriterTest::testTdf81226() CPPUNIT_ASSERT_EQUAL(OUString("beforeafter"), getParagraph(1)->getString()); } -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(); diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 8251a9978142..bec2831d5531 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -198,11 +198,6 @@ void SwWrtShell::Insert( const OUString ) bCallIns = m_bIns /*||
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |9 - sw/source/core/layout/wsfrm.cxx| 18 ++ 2 files changed, 22 insertions(+), 5 deletions(-) New commits: commit 583ca42c3f83058aa6ccfff1063aef373d98e4c8 Author: Michael Stahl AuthorDate: Fri Jun 25 10:25:59 2021 +0200 Commit: Thorsten Behrens CommitDate: Mon Jun 28 09:40:54 2021 +0200 sw: layout: fix table split loop caused by RemoveFollowFlowLinePending In no_view.odt, the table 1340 does RemoveFollowFlowLine(), then splits again, and by the time Split() returns, its flag m_bRemoveFollowFlowLinePending is set and so in the next SwTabFrame::MakeAll() it will do the same thing again, until eventually it hits layact.cxx:544: LoopControl_1 in SwLayAction::InternalAction The flag is set during lcl_RecalcSplitLine(), in SwContentFrame::Cut(), which operates under the assumption that there are no other cells in the follow flow line that may contain content frames. This only happens if "Verdana" and "Arial" fonts are available and not substituted with "DejaVu Sans" etc. (regression from c4af8b0f106f31b6e79a145bc4ab83bb6a55c808) Unfortunately this uncovers another pagination bug in testTdf88496 which was hidden by this flag being set from text frames that shouldn't exist anyway. Change-Id: I3cc82c13bfc06960b827aefc64f5b5b12520955a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117851 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit a0cd270a99f43049fc099ddd463e57aa243d5b0e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117860 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index aa29afd218e0..1638d93cf878 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -1226,7 +1226,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf88496, "tdf88496.docx") // Switch off repeating header, there is no place for it. // Now there are only 3 pages with complete table content // instead of a 51-page long table only with header. -CPPUNIT_ASSERT_EQUAL(3, getPages()); +CPPUNIT_ASSERT_EQUAL(2, getPages()); +// FIXME: this actually has 3 pages but SwWrtShell::SttPg() puts the cursor +// into the single SwTextFrame in the follow-flow-row at the top of the +// table but that SwTextFrame 1105 should not exist and the cursor ends up +// at the end of its master frame 848 instead; the problem is somewhere in +// SwTextFrame::FormatAdjust() which first determines nNew = 1 but then +// grows this frame anyway so that the follow is empty, but nothing +// invalidates 1105 again. } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf77417, "tdf77417.docx") diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 438eaaef79fd..184ee0d6c9a8 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -1160,6 +1161,7 @@ void SwContentFrame::Cut() } } +SwTabFrame* pMasterTab(nullptr); pFrame = GetIndNext(); if( pFrame ) { @@ -1240,11 +1242,9 @@ void SwContentFrame::Cut() if ( IsInTab() ) { SwTabFrame* pThisTab = FindTabFrame(); -SwTabFrame* pMasterTab = pThisTab && pThisTab->IsFollow() ? pThisTab->FindMaster() : nullptr; -if ( pMasterTab ) +if (pThisTab && pThisTab->IsFollow()) { -pMasterTab->InvalidatePos_(); -pMasterTab->SetRemoveFollowFlowLinePending( true ); +pMasterTab = pThisTab->FindMaster(); } } } @@ -1253,7 +1253,17 @@ void SwContentFrame::Cut() SwLayoutFrame *pUp = GetUpper(); RemoveFromLayout(); if ( !pUp ) +{ +assert(!pMasterTab); return; +} + +if (pMasterTab +&& !pMasterTab->GetFollow()->GetFirstNonHeadlineRow()->ContainsContent()) +{ // only do this if there's no content in other cells of the row! +pMasterTab->InvalidatePos_(); +pMasterTab->SetRemoveFollowFlowLinePending(true); +} SwSectionFrame *pSct = nullptr; if ( !pUp->Lower() && ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/ww8export/data/tdf138302_restartNumbering.odt |binary sw/qa/extras/ww8export/ww8export3.cxx |6 ++ sw/source/filter/ww8/wrtw8num.cxx | 11 +++ sw/source/filter/ww8/wrtww8.hxx|1 + sw/source/filter/ww8/ww8atr.cxx|7 +++ 5 files changed, 25 insertions(+) New commits: commit 5107bc515fba130bf4a488324f97971789a92f37 Author: Justin Luth AuthorDate: Fri May 28 16:03:52 2021 +0200 Commit: Justin Luth CommitDate: Mon May 31 10:51:04 2021 +0200 tdf#138302 partial revert tdf#108496: DOCX: redesign of override in lists LO 6.4.5 commit cf13fe3e6f6a40f6db064d65d4514d13a23a31f0 was only concerned about DOCX, but just elinated shared code. So restore the shared code and just don't execute it for DOCX. It doesn't look like RTF was working before this, but this does fix DOC format. I looked for existing unit tests in rtf and doc, but none were found that hit this code. Change-Id: Id624f73181384f38e1ef9f27575e0fb82eea19c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116349 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk (cherry picked from commit f49e5902a3737c02fabf5bec23243ccb126426c4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116170 Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ww8export/data/tdf138302_restartNumbering.odt b/sw/qa/extras/ww8export/data/tdf138302_restartNumbering.odt new file mode 100644 index ..8c99963616a7 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf138302_restartNumbering.odt differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index c16272c2707d..08f7cf5b1614 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -185,6 +185,12 @@ DECLARE_WW8EXPORT_TEST(testdf79553_lineNumbers, "tdf79553_lineNumbers.doc") CPPUNIT_ASSERT_MESSAGE("automatic distance", nValue > 0); } +DECLARE_WW8EXPORT_TEST(tesTdf138302_restartNumbering, "tdf138302_restartNumbering.odt") +{ +uno::Reference xPara(getParagraph(8), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(xPara, "ListLabelString")); +} + DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc") { uno::Reference pageStyles = getStyles("PageStyles"); diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index c3f8eabe9fd9..7c1866f74718 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -56,6 +56,17 @@ SwNumRule* MSWordExportBase::DuplicateNumRuleImpl(const SwNumRule *pRule) return pMyNumRule; } +sal_uInt16 MSWordExportBase::DuplicateNumRule(const SwNumRule* pRule, sal_uInt8 nLevel, sal_uInt16 nVal) +{ +SwNumRule* const pMyNumRule = DuplicateNumRuleImpl(pRule); + +SwNumFormat aNumFormat(pMyNumRule->Get(nLevel)); +aNumFormat.SetStart(nVal); +pMyNumRule->Set(nLevel, aNumFormat); + +return GetNumberingId(*pMyNumRule); +} + // multiple SwList can be based on the same SwNumRule; ensure one w:abstractNum // per SwList sal_uInt16 MSWordExportBase::DuplicateAbsNum(OUString const& rListId, diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 1baa627ece71..69f9f2b1a2ed 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -651,6 +651,7 @@ public: /// List is set to restart at a particular value so for export make a /// completely new list based on this one and export that instead, /// which duplicates words behaviour in this respect. +sal_uInt16 DuplicateNumRule(const SwNumRule* pRule, sal_uInt8 nLevel, sal_uInt16 nVal); SwNumRule * DuplicateNumRuleImpl(const SwNumRule *pRule); /// check if a new abstractNum is needed for this list diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index c1959186979c..14afa9919405 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -3627,6 +3627,13 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule ) } } } +else if (pTextNd->IsListRestart()) +{ +sal_uInt16 nStartWith = static_cast(pTextNd->GetActualListStartValue()); +nNumId = GetExport().DuplicateNumRule(pRule, nLvl, nStartWith); +if (USHRT_MAX != nNumId) +++nNumId; +} } 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-1' - sw/qa sw/source
sw/qa/extras/uiwriter/data2/tdf39721.fodt | 42 sw/qa/extras/uiwriter/uiwriter2.cxx | 52 ++ sw/source/core/crsr/crstrvl.cxx | 18 ++ 3 files changed, 112 insertions(+) New commits: commit 58720cad9ad9221d2bc0bb668beff18468d266d5 Author: László Németh AuthorDate: Wed Apr 7 09:35:15 2021 +0200 Commit: Xisco Fauli CommitDate: Thu May 6 22:16:18 2021 +0200 tdf#126226, tdf#126735 sw Next Change: cycle through tracked changes Next/Previous Change commands don't stop at the start or end of the document, but continue on the end or start of the document to cycle through all tracked changes, like Find Next/Previous and other office suites do. Change-Id: I5578d6b98b81ca1f8f222ba78e7d3c08339eca89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113716 Tested-by: Jenkins Reviewed-by: László Németh Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115183 diff --git a/sw/qa/extras/uiwriter/data2/tdf39721.fodt b/sw/qa/extras/uiwriter/data2/tdf39721.fodt new file mode 100644 index ..1acf06c5e2a5 --- /dev/null +++ b/sw/qa/extras/uiwriter/data2/tdf39721.fodt @@ -0,0 +1,42 @@ + +http://openoffice.org/2009/office; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text" xmlns:dc="http://purl.org/dc/elements/1.1/;> + + + + + + + + + + + + + Unknown Author + 2021-01-06T16:18:57 + + + + + + + Unknown Author + 2021-01-06T16:20:17 + + + + + + + Lorem ipsum + + + dolor sit + + + amet. + + + + + diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 64ad80da0f3b..185187cfbccc 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -3636,4 +3636,56 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf123218) aScaleData = xYAxis->getScaleData(); CPPUNIT_ASSERT_EQUAL(chart2::AxisOrientation_REVERSE, aScaleData.Orientation); } + +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126735) +{ +SwDoc* pDoc = createDoc("tdf39721.fodt"); + +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +//turn on red-lining and show changes +pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete + | RedlineFlags::ShowInsert); +CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); +CPPUNIT_ASSERT_MESSAGE( +"redlines should be visible", + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + +// check next selected tracked change +dispatchCommand(mxComponent, ".uno:NextTrackedChange", {}); +uno::Reference xSelSupplier(pTextDoc->getCurrentController(), + uno::UNO_QUERY_THROW); +uno::Any aSelection = xSelSupplier->getSelection(); +uno::Reference xTextRange = getAssociatedTextRange(aSelection); +CPPUNIT_ASSERT(xTextRange); +CPPUNIT_ASSERT_EQUAL(OUString(" ipsu"), xTextRange->getString()); + +// check next selected tracked change +dispatchCommand(mxComponent, ".uno:NextTrackedChange", {}); +aSelection = xSelSupplier->getSelection(); +xTextRange = getAssociatedTextRange(aSelection); +CPPUNIT_ASSERT(xTextRange); +CPPUNIT_ASSERT_EQUAL(OUString("or "), xTextRange->getString()); + +// check next selected tracked change at the end of the document: +// select the first tracked change of the document +dispatchCommand(mxComponent, ".uno:NextTrackedChange", {}); +aSelection = xSelSupplier->getSelection(); +xTextRange = getAssociatedTextRange(aSelection); +CPPUNIT_ASSERT(xTextRange); +// This was empty (collapsing at the end of the last tracked change) +CPPUNIT_ASSERT_EQUAL(OUString(" ipsu"), xTextRange->getString()); + +// check the previous tracked change at the start of the document: +// select the last tracked change of the document +dispatchCommand(mxComponent, ".uno:PreviousTrackedChange", {}); +aSelection = xSelSupplier->getSelection(); +xTextRange = getAssociatedTextRange(aSelection); +CPPUNIT_ASSERT(xTextRange); +// This was empty (collapsing at the start of the last tracked change) +CPPUNIT_ASSERT_EQUAL(OUString("or "), xTextRange->getString()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 7e27e1ee899a..32c5e14eacc3 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -71,6 +71,8 @@ #include #include #include +#include
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/layout/data/fdo43573-2-min.docx |binary sw/qa/extras/layout/layout.cxx | 16 sw/source/core/layout/fly.cxx| 14 +- 3 files changed, 25 insertions(+), 5 deletions(-) New commits: commit 858cd97b2682510cbf6abddf68e63a502a4b3202 Author: Michael Stahl AuthorDate: Wed May 5 12:21:42 2021 +0200 Commit: Caolán McNamara CommitDate: Thu May 6 10:42:07 2021 +0200 tdf#142080 sw: layout: fix infinite loop in CalcContent() On page 9, SwSectionFrame::Format() calls CalcContent() and that formats all its content frames, then on SwTextFrame 91 SwObjectFormatter::FormatObj() fails becuase it moved forward. With commit c799de145f7e289f31e3669646e5bd12814e6c5e this now sets the o_rbPageHasFlysAnchoredBelowThis to true, which prevents a call to SwLayouter::InsertMovedFwdFrame(), and the flys anchored in next frames aren't moved off the page at this time. Then the loop starts over at the beginning of the SwSectionFrame, and frame 91 will be formatted again because the loop tries to format the first frame on the next page to see if it will move back; now the MoveBwd() isn't prevented any more so the result is the same failure in SwObjectFormatter::FormatObj(). Fix this by ignoring the bRestartLayoutProcess in case the current frame was originally on the next page and didn't move back (or, as is the case here, moved back and then forward again); it should just be formatted again on the next page. Once that happens, it will eventually be entered into SwLayouter::InsertMovedFwdFrame() too. This happens to fix another problem with this bugdoc too: the first column of the section on page 9 is empty. This also happens in LO 6.4 but not LO 6.1. An alternative would be to move the flys anchored below off the page as is done in SwLayAction::FormatContent() now but sections can be in flys or footnotes or headers so perhaps it should be done only at the top-level. (regression from c799de145f7e289f31e3669646e5bd12814e6c5e) Change-Id: I0965aebb4e3cec687f4e70f8d5e3aa8a55da3393 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115144 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit ed12269c42f75f553bb8a8770923406f7824e473) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115087 Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/layout/data/fdo43573-2-min.docx b/sw/qa/extras/layout/data/fdo43573-2-min.docx new file mode 100644 index ..429b7948ed02 Binary files /dev/null and b/sw/qa/extras/layout/data/fdo43573-2-min.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index d4450264826a..cd1a2ae80511 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -1329,6 +1329,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116486) CPPUNIT_ASSERT_EQUAL(OUString("4006"), aTop); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf142080) +{ +// this caused an infinite loop +load(DATA_DIRECTORY, "fdo43573-2-min.docx"); + +xmlDocUniquePtr pLayout = parseLayoutDump(); +// check the first paragraph on page 9 with its fly; the colum was empty too +assertXPath(pLayout, "/root/page[9]/body/section[1]/column[1]/body/txt[1]/Text[1]", "Portion", +"De kleur u (rood) in het rechtervlak (R), de kleur r (wit) beneden (D),"); +SwTwips nPage9Top = getXPath(pLayout, "/root/page[9]/infos/bounds", "top").toInt32(); +assertXPath( +pLayout, + "/root/page[9]/body/section[1]/column[1]/body/txt[1]/anchored/fly[1]/notxt/infos/bounds", +"top", OUString::number(nPage9Top + 1460)); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128198) { SwDoc* pDoc = createDoc("tdf128198-1.docx"); diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index d5b7f5427992..fded9ec70417 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1460,6 +1460,7 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl ) do { pLast = pFrame; +bool const wasFrameLowerOfLay(pLay->IsAnLower(pFrame)); if( pFrame->IsVertical() ? ( pFrame->GetUpper()->getFramePrintArea().Height() != pFrame->getFrameArea().Height() ) : ( pFrame->GetUpper()->getFramePrintArea().Width() != pFrame->getFrameArea().Width() ) ) @@ -1601,7 +1602,10 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl ) // #i28701# - restart layout process, if // requested by floating screen object formatting -if ( bRestartLayoutProcess ) +if (bRestartLayoutProcess +// tdf#142080 if it was aleady on next page, and still is, +// ignore restart, as restart
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/layout/data/tabellen_test_windows_1.odt |binary sw/qa/extras/layout/layout.cxx | 12 sw/source/core/layout/flowfrm.cxx|3 +-- 3 files changed, 13 insertions(+), 2 deletions(-) New commits: commit a12367ac5267508e4eccd1b2e2d8e57aec4812cf Author: Michael Stahl AuthorDate: Tue Apr 27 20:07:14 2021 +0200 Commit: Thorsten Behrens CommitDate: Sun May 2 00:55:08 2021 +0200 sw: layout: let nested table move forward The problem is that a nested table at the bottom of the page doesn't fit into its cell, but it is split and its first row still remains on the page where it doesn't fit. The outer table 3 tries to split with bTryToSplit=true. In SwTabFrame::MakeAll(), first a split of the nested table 435 with bTryToSplit=true is attempted; this fails and is partially undone - the follow flow line is removed, but the last 2 rows remain in follow. The bTryToSplit=false is skipped because there's only one row now. Then MoveFwd() is tried, but it fails because the top-level table doesn't have a previous frame. Then bTryToSplit=false is tried, and succeeds, again leaving row 436 on page 1 and other 2 in follow. Now another attempt with bTryToSplit=true is made, failing again, not effectively changing anything. During all of this, growing of the outer cell frame 434 and row frame 433 is prevented by the outer table 3 having a follow flow line, see SwRowFrame::GrowFrame(). The result is that cell 434 has content area height 190 but the table 435 with its single row is all valid with height 406, so it's cut off in the rendering. This doesn't happen for SwTextFrame inside table because that one does the MoveFwd(). Plausibly it's the inner table's responsibility to finish with a valid state that fits the constraints of the current page; there are some checks in lcl_RecalcSplitLine() to check for no content frame in the row but none for the row being too small to contain the content that was formatted. So the only valid results for the inner table are that it either moved forward, or it left behind a row containing no content (such as that produced by its own failed attempt to split with bTryToSplit=true), which could be handled by the outer table split code - but the latter could be insufficient in case the outer table is itself a follow, or at least would require further changes in lcl_RecalcSplitLine(). So fix this by removing a condition in MoveFwd() that doesn't make any sense to me - why is it relevant for an inner table during a split of the outer table whether the outer table itself can move forward? Change-Id: I1e01ce233383cc70b9aea72d25369b7278eb75f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114760 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit ca19177728c66d913996a48c91a0ba47d08825d6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114718 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/layout/data/tabellen_test_windows_1.odt b/sw/qa/extras/layout/data/tabellen_test_windows_1.odt new file mode 100644 index ..a666fe5fd47d Binary files /dev/null and b/sw/qa/extras/layout/data/tabellen_test_windows_1.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 15e33d74d18e..d4450264826a 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -492,6 +492,18 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272) assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "bottom", "2819"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestNestedTableMoveFwd) +{ +SwDoc* pDoc = createDoc("tabellen_test_windows_1.odt"); +CPPUNIT_ASSERT(pDoc); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +// the row with the nested table should not be split but be the first row on page 2 +assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row[last()]/cell[1]/txt[1]/Text", "Portion", +"Tabelle 1"); +assertXPath(pXmlDoc, "/root/page[2]/body/tab[1]/row[1]/cell[1]/tab[1]/row[1]/cell[1]/txt/Text", +"Portion", "Tabelle 2"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613) { SwDoc* pDoc = createDoc("tdf136613.docx"); diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index aeeb9df158cf..6a2c12a5044f 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1951,8 +1951,7 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways ) // Allow the MoveFwd even if we do not have an IndPrev in these cases: if ( m_rThis.IsInTab() && ( !m_rThis.IsTabFrame() || -( m_rThis.GetUpper()->IsInTab() &&
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/core/doc/data/textbox-makeflyframe.docx |binary sw/qa/core/doc/doc.cxx| 36 ++ sw/source/core/doc/DocumentLayoutManager.cxx |8 + sw/source/core/txtnode/atrflyin.cxx |9 ++ 4 files changed, 53 insertions(+) New commits: commit 603c73c73c0c5e62a02627879bc5cf2f96723f32 Author: Miklos Vajna AuthorDate: Mon Apr 26 21:01:45 2021 +0200 Commit: Xisco Fauli CommitDate: Wed Apr 28 10:16:08 2021 +0200 tdf#138604 sw textbox copy: fix missing fly frames of as-char draw frame Regression from commit 682e0488df819c191c13a03758fad0690706e508 (tdf#134099 sw: fix textbox anchors on copy-paste and undo, 2020-06-29), now that we don't copy draw+fly format pairs more than once, the fly frame of a fly format was missing. This was broken because sw::DocumentContentOperationsManager::CopyFlyInFlyImpl() calls CopyLayoutFormat() with bMakeFrames=true, but the frame format list doesn't contain as-char frames. For as-char frames CopyLayoutFormat() is called by SwTextFlyCnt::CopyFlyFormat() instead, but with bMakeFrames=false, so the fly frame's layout frame were never made. Fix the problem by explicitly making frames in DocumentLayoutManager::CopyLayoutFormat(), which also requires delete+make in SwTextFlyCnt::SetAnchor(). [ This is now consistent with the start of SwTextFlyCnt::SetAnchor(), which also deletes frames for fly frame formats. Otherwise CppunitTest_sw_core_txtnode would crash in testTextBoxCopyAnchor. ] Change-Id: I87003ee09ca75b9fecd70a1aa5c42f762f715be8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114680 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit feeaa5d3ca0c784344549816fbaab2c8716b4105) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114611 Reviewed-by: Xisco Fauli diff --git a/sw/qa/core/doc/data/textbox-makeflyframe.docx b/sw/qa/core/doc/data/textbox-makeflyframe.docx new file mode 100644 index ..9e26cda3c6a6 Binary files /dev/null and b/sw/qa/core/doc/data/textbox-makeflyframe.docx differ diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index 1bd9b4207444..14f724328fe0 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include #include @@ -24,6 +26,9 @@ #include #include #include +#include +#include +#include char const DATA_DIRECTORY[] = "/sw/qa/core/doc/data/"; @@ -129,6 +134,37 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxZOrder) CPPUNIT_ASSERT_EQUAL(static_cast(2), pEllipseShape->GetOrdNum()); } +CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxMakeFlyFrame) +{ +// Given a document with an as-char textbox (as-char draw format + at-char fly format): +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "textbox-makeflyframe.docx"); + +// When cutting the textbox and pasting it to a new document: +SwView* pView = pDoc->GetDocShell()->GetView(); +pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, SfxCallMode::SYNCHRON); +pView->StopShellTimer(); +SwDocShell* pDocShell = pDoc->GetDocShell(); +SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); +rtl::Reference pTransfer = new SwTransferable(*pWrtShell); +pTransfer->Cut(); +TransferableDataHelper aHelper(pTransfer.get()); +uno::Reference xDoc2 += loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument", {}); +SwXTextDocument* pTextDoc2 = dynamic_cast(xDoc2.get()); +SwDocShell* pDocShell2 = pTextDoc2->GetDocShell(); +SwWrtShell* pWrtShell2 = pDocShell2->GetWrtShell(); +SwTransferable::Paste(*pWrtShell2, aHelper); + +// Then make sure its fly frame is created. +mxComponent->dispose(); +mxComponent = xDoc2; +xmlDocUniquePtr pLayout = parseLayoutDump(); +// Without the accompanying fix in place, this test would have failed, because the first text +// frame in the body frame had an SwAnchoredDrawObject anchored to it, but not a fly frame, so +// a blank square was painted, not the image. +assertXPath(pLayout, "/root/page/body/txt/anchored/fly", 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx index 7df5d2871f91..08dcdc80b540 100644 --- a/sw/source/core/doc/DocumentLayoutManager.cxx +++ b/sw/source/core/doc/DocumentLayoutManager.cxx @@ -474,6 +474,14 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat( // presumably these anchors are supported though not sure assert(RndStdIds::FLY_AT_CHAR == boxAnchor.GetAnchorId() || RndStdIds::FLY_AT_PARA == boxAnchor.GetAnchorId() || boxAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE); + +if (!bMakeFrames &&
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/core/text/data/tabovermargin-section.fodt | 50 sw/qa/core/text/text.cxx| 14 ++ sw/source/core/text/txttab.cxx |7 ++- 3 files changed, 70 insertions(+), 1 deletion(-) New commits: commit 3c54bbc15c8076aa9caaa27642045cb38d4a6b35 Author: Miklos Vajna AuthorDate: Mon Apr 12 21:06:52 2021 +0200 Commit: Xisco Fauli CommitDate: Thu Apr 15 16:07:24 2021 +0200 tdf#132393 sw: disable TabOverMargin layout flag inside sections Regression from commit bdfc6363d66aa079512cc8008996b633f693fed1 (n#793998 sw: add TabOverMargin compat mode, 2013-01-08), the problem is that currently adding an alphabetical index generates document model where tab positions are explicitly over the margin and users expect that the page numbers are still visible, even for Word documents. Fix the problem by disabling this mode inside sections. Long-term we may want to fix the ToX generator to create a more sane document model and then this flag can be handled even inside sections. (cherry picked from commit e1cc5041cfb7272eb96f174e1c64285420397588) Conflicts: sw/qa/core/text/text.cxx Change-Id: Ic91ac36e703d59e4711a009db1f921e456bf8645 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114039 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/core/text/data/tabovermargin-section.fodt b/sw/qa/core/text/data/tabovermargin-section.fodt new file mode 100644 index ..6fd39c471228 --- /dev/null +++ b/sw/qa/core/text/data/tabovermargin-section.fodt @@ -0,0 +1,50 @@ + +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"> + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + before + +hello1 + + after + + + diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 6122bab09911..7d0495cbb69c 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -69,6 +69,20 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testSemiTransparentText) assertXPath(pXmlDoc, "//floattransparent"); } +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTabOverMarginSection) +{ +createSwDoc(DATA_DIRECTORY, "tabovermargin-section.fodt"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +sal_Int32 nWidth += getXPath(pXmlDoc, "//Text[@nType='PortionType::TabRight']", "nWidth").toInt32(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected less than: 5000 +// - Actual : 9372 +// i.e. the tab portion width was not the expected 4386, but
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport.cxx |8 sw/source/filter/ww8/docxattributeoutput.cxx |8 2 files changed, 8 insertions(+), 8 deletions(-) New commits: commit 057d38385b7bc79c688b837416fa881050b2b370 Author: Justin Luth AuthorDate: Thu Apr 8 20:27:58 2021 +0200 Commit: Xisco Fauli CommitDate: Fri Apr 9 14:48:35 2021 +0200 tdf#97569 docxexport: export russianUpper/russianLower numbering Change-Id: Iad5f5d4687eccc05a63d6a9a4f81cf3f552cb17d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113829 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 3236020c4b8bed68dcf57210c0437f43f4160130) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113771 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 26151ebcc0c9..2044d76b82e7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -760,10 +760,10 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOOxmlOutlineNumberTypes, "outline-number assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[2]/w:numFmt", "val", "decimal"); assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[3]/w:numFmt", "val", "decimal"); assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[4]/w:numFmt", "val", "decimal"); -assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[5]/w:numFmt", "val", "decimal"); -assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[6]/w:numFmt", "val", "decimal"); -assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[7]/w:numFmt", "val", "decimal"); -assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[8]/w:numFmt", "val", "decimal"); +assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[5]/w:numFmt", "val", "russianUpper"); +assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[6]/w:numFmt", "val", "russianLower"); +assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[7]/w:numFmt", "val", "russianUpper"); +assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[2]/w:lvl[8]/w:numFmt", "val", "russianLower"); assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[1]/w:numFmt", "val", "decimal"); assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[3]/w:lvl[2]/w:numFmt", "val", "decimal"); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index ebca5798144e..3ba079cde7f4 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6827,6 +6827,10 @@ static OString impl_LevelNFC(sal_uInt16 nNumberingType, const SfxItemSet* pOutSe case style::NumberingType::CHARS_ARABIC: aType="arabicAlpha"; break; case style::NumberingType::CHARS_THAI: aType="thaiLetters"; break; case style::NumberingType::CHARS_PERSIAN: aType="hindiVowels"; break; +case style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_RU: +case style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_RU: aType = "russianUpper"; break; +case style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_RU: +case style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_RU: aType = "russianLower"; break; case style::NumberingType::TEXT_NUMBER: aType="ordinal"; break; case style::NumberingType::TEXT_CARDINAL: aType="cardinalText"; break; case style::NumberingType::TEXT_ORDINAL: aType="ordinalText"; break; @@ -6861,10 +6865,6 @@ static OString impl_LevelNFC(sal_uInt16 nNumberingType, const SfxItemSet* pOutSe case style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_BG: case style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_BG: case style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_BG: -case style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_RU: -case style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_RU: -case style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_RU: -case style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_RU: case style::NumberingType::CHARS_MYANMAR: case style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_SR: case style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_SR: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/ww8export/data/tdf139495_tinyHeader.doc |binary sw/qa/extras/ww8export/ww8export3.cxx|6 ++ sw/qa/extras/ww8import/ww8import.cxx |4 sw/source/filter/ww8/ww8par6.cxx |6 -- 4 files changed, 14 insertions(+), 2 deletions(-) New commits: commit a159d7d2db7a86c770a165b04999f3ab513d3127 Author: Justin Luth AuthorDate: Tue Apr 6 16:40:25 2021 +0200 Commit: Xisco Fauli CommitDate: Fri Apr 9 14:47:01 2021 +0200 tdf#139495 doc import: prevent negative Int forced into uInt Don't cast a negative number into a sal_uInt16 and expect good results. (ww8import test) But for bug 139495 (and ww8export3), the problem area is also related to pHdFormat->SetFormatAttr(SwFormatFrameSize... which takes an awt::Size which consists of Longs. So they should accept negative numbers. Likely the result is being treated as a uInt somewhere. And a negative height doesn't mean very much anyway. There seems to be a fundamental difference between Word and LO here. Word sets the page margins, but that is irrelevant to the header/footer, which have their own distance from the edge. In LO, the header starts at the page margin, and the body text must follow the header, (In Word, the body text can start above the header, as seen in the ww8export3 unit test.) [FYI: DOC format (since forever) seems to ignore the header size, allowing the content to at least overlap with the body text, but DOCX doesn't have that. Likely this is #112727# using floating frames hack. So I'd better not keep messing around in here.] Change-Id: Ie7bffec8a3de25958cf1f311ff2c8338d4870d99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113681 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 28a9a92105f3155d82fd9e31095efabd3ec706ea) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113769 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ww8export/data/tdf139495_tinyHeader.doc b/sw/qa/extras/ww8export/data/tdf139495_tinyHeader.doc new file mode 100644 index ..c45a6c25fd99 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf139495_tinyHeader.doc differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index dd7de5ff543a..c16272c2707d 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -202,6 +202,12 @@ DECLARE_WW8EXPORT_TEST(testTdf122460_header, "tdf122460_header.odt") CPPUNIT_ASSERT(headerIsOn); } +DECLARE_WW8EXPORT_TEST(testTdf139495_tinyHeader, "tdf139495_tinyHeader.doc") +{ +// In Word 2003, this is one page, but definitely not six pages. +CPPUNIT_ASSERT(getPages() < 3); +} + DECLARE_WW8EXPORT_TEST(testFdo53985, "fdo53985.doc") { uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 9cbae7f83a3a..0698c9578fa8 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -246,6 +246,10 @@ DECLARE_WW8IMPORT_TEST(testTdf122425_1, "tdf122425_1.doc") CPPUNIT_ASSERT(!pBox->GetLine(eLine)); } } + +//tdf#139495: without the fix, a negative number was converted into a uInt16, overflowing to 115501 +auto nDist = getProperty(getStyles("PageStyles")->getByName("Standard"), "HeaderBodyDistance"); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), nDist); } DECLARE_WW8IMPORT_TEST(testTdf110987, "tdf110987") diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index adbfaf20bae3..ec87b0abc1b6 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -661,8 +661,10 @@ void wwSectionManager::SetPageULSpaceItems(SwFrameFormat , } else { +// Hack alert: these calculations are based on +// #112727# import negative height headers/footers as floating frames inside fixed height headers/footer // #i48832# - set correct spacing between header and body. -const sal_Int32 nHdLowerSpace( std::abs(rSection.maSep.dyaTop) - rData.nSwUp - rData.nSwHLo ); +const sal_Int32 nHdLowerSpace(std::max(0, std::abs(rSection.maSep.dyaTop) - rData.nSwUp - rData.nSwHLo)); pHdFormat->SetFormatAttr(SwFormatFrameSize(SwFrameSize::Fixed, 0, rData.nSwHLo + nHdLowerSpace)); aHdUL.SetLower( static_cast< sal_uInt16 >(nHdLowerSpace) ); pHdFormat->SetFormatAttr(SwHeaderAndFooterEatSpacingItem( @@ -689,7 +691,7 @@ void wwSectionManager::SetPageULSpaceItems(SwFrameFormat , else { // #i48832# - set correct spacing between footer and body. -const SwTwips
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/uiwriter/data3/tdf140828.docx |binary sw/qa/extras/uiwriter/uiwriter3.cxx| 32 + sw/source/core/doc/textboxhelper.cxx |5 ++-- sw/source/core/text/porfly.cxx |4 +++ 4 files changed, 39 insertions(+), 2 deletions(-) New commits: commit 9e90062dfc39b023c988d7982457dea2e0d1a923 Author: Attila Bakos (NISZ) AuthorDate: Tue Mar 9 16:32:27 2021 +0100 Commit: Xisco Fauli CommitDate: Wed Mar 31 12:06:28 2021 +0200 tdf#140828 sw textbox: fix AS_CHAR regression Textboxes anchored as characters don't lose their text frames after changing the anchor "To character". Regression from commit 493a916a3113e877835c9bc7c93faef0d29f9a33 (tdf#140158 tdf#138598 tdf#140598 sw: fix sync of AS_CHAR textboxes). Change-Id: I0e6d88c9dcdeff515744bc4c201a5640eb810d1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112209 Tested-by: László Németh Reviewed-by: László Németh Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113321 Tested-by: Jenkins Reviewed-by: Attila Bakos diff --git a/sw/qa/extras/uiwriter/data3/tdf140828.docx b/sw/qa/extras/uiwriter/data3/tdf140828.docx new file mode 100755 index ..bfdabc5d77ea Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf140828.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index a2b8c8bc1c38..e0623c817a91 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -854,6 +855,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf76636_2) CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xTextTable->getColumns()->getCount()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf140828) +{ +load(DATA_DIRECTORY, "tdf140828.docx"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +CPPUNIT_ASSERT_EQUAL(1, getShapes()); +uno::Reference xShp = getShape(1); +CPPUNIT_ASSERT(xShp); + +uno::Reference ShpProps(xShp, uno::UNO_QUERY_THROW); +dispatchCommand(mxComponent, ".uno:JumpToNextFrame", {}); +Scheduler::ProcessEventsToIdle(); + +dispatchCommand(mxComponent, ".uno:SetAnchorAtChar", {}); +Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT(ShpProps->getPropertyValue("AnchorType").get() + != text::TextContentAnchorType::TextContentAnchorType_AS_CHARACTER); + +uno::Reference xTxBx(SwTextBoxHelper::getUnoTextFrame(xShp)); +CPPUNIT_ASSERT(xTxBx); + +uno::Reference TxBxProps(xTxBx, uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT_EQUAL(OUString("top left image"), xTxBx->getText()->getString()); + +CPPUNIT_ASSERT_MESSAGE("Bad Relative Orientation and Position!", + TxBxProps->getPropertyValue("HoriOrientRelation").get() + != text::RelOrientation::CHAR); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132725) { load(DATA_DIRECTORY, "tdf132725.odt"); diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 5257d448bd55..6b9f87655d8d 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -165,8 +165,6 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, bool bCopyText) if (xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_WRITINGMODE) >>= eMode) syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(sal_Int16(eMode))); -// TODO: Text dialog attr setting to frame - const SwFormatAnchor& rAnch = pShape->GetAnchor(); if (!((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE && rAnch.GetPageNum() != 0) || ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA @@ -723,6 +721,9 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u } else // Otherwise copy the anchor type of the shape { +// tdf#140828: Do not keep CHAR rel-orientation: + xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT_RELATION, + uno::Any(text::RelOrientation::FRAME)); xPropertySet->setPropertyValue(UNO_NAME_ANCHOR_TYPE, aValue); } // After anchoring the position must be set as well: diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index cafa70c48227..9426359156f1 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -351,9 +351,11 @@ void SwFlyCntPortion::SetBase( const SwTextFrame& rFrame, const Point , // Both rectangles are absolute, SwFormatHori/VertOrient's position // is relative to the print area of the anchor text
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/layout/data/tdf141079.odt |binary sw/qa/extras/layout/layout2.cxx| 33 + sw/source/core/text/itrcrsr.cxx|8 ++-- 3 files changed, 39 insertions(+), 2 deletions(-) New commits: commit 9804b72b76def2c17a4b40166eb47be8fe83d3df Author: Samuel Mehrbrodt AuthorDate: Thu Mar 18 11:41:29 2021 +0100 Commit: Miklos Vajna CommitDate: Fri Mar 26 16:55:27 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/+/112970 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/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index ff07375bfabb..f0fb593df6a9 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -1956,6 +1956,39 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testImageComment) CPPUNIT_ASSERT_EQUAL(static_cast(5), aPosition.nContent.GetIndex()); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 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(SwLayoutWriter2, testCommentCursorPosition) { // Load a document that has "aaa" in it, followed by three comments. diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 7a6e1d3cdd03..3e4c15c9226d 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -1554,8 +1554,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-1' - sw/qa sw/source
dev/null |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx |7 --- sw/source/filter/ww8/docxattributeoutput.cxx | 27 ++- sw/source/filter/ww8/docxattributeoutput.hxx |2 +- 4 files changed, 7 insertions(+), 29 deletions(-) New commits: commit b850105570d0e99644ff1ad5d6d0f09734db7952 Author: Justin Luth AuthorDate: Tue Mar 23 07:51:19 2021 +0200 Commit: Xisco Fauli CommitDate: Tue Mar 23 16:07:04 2021 +0100 Revert "tdf#136929 docx export: keep frame with paragraph" This reverts 7.1 backport 7d90b50285f294a3c9cce0b22399fefe3ab46ee5. because tdf#141173 gives a disasterous example that fails. Change-Id: Ib3700c582c67973f7b0fac0edda6ae4033acc218 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112986 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf136929_framesOfParagraph.odt b/sw/qa/extras/ooxmlexport/data/tdf136929_framesOfParagraph.odt deleted file mode 100644 index 918b24f670db.. Binary files a/sw/qa/extras/ooxmlexport/data/tdf136929_framesOfParagraph.odt and /dev/null differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 4c8f05e945d4..3d61784547cc 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -465,13 +465,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135216_evenOddFooter, "tdf135216_evenOddFooter.o getParagraph(2, "2"); } -DECLARE_OOXMLEXPORT_TEST(testTdf136929_framesOfParagraph, "tdf136929_framesOfParagraph.odt") -{ -// Before this fix, the image was placed in the footer instead of in the text body - messing everything up. -CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 5, getPages() ); -CPPUNIT_ASSERT_EQUAL_MESSAGE("Header2 text", OUString("* | *"), parseDump("/root/page[4]/footer/txt")); -} - DECLARE_OOXMLEXPORT_TEST(testTdf136589_paraHadField, "tdf136589_paraHadField.docx") { // The section break should not add an additional CR - which equals an empty page two. diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index ffdc0c04f147..ebca5798144e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -383,12 +383,6 @@ static void checkAndWriteFloatingTables(DocxAttributeOutput& rDocxAttributeOutpu void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo ) { -// Paragraphs (in headers/footers/comments/frames etc) can start before another finishes. -// So a stack is needed to keep track of each paragraph's status separately. -// Complication: Word can't handle nested text boxes, so those need to be collected together. -if ( !m_aFramesOfParagraph.size() || !m_nTextFrameLevel ) -m_aFramesOfParagraph.push(std::vector()); - // look ahead for floating tables that were put into a frame during import // floating tables in shapes are not supported: exclude this case if (!pTextNodeInfo && !m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen()) @@ -653,13 +647,10 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT assert(!m_pPostponedCustomShape); m_pPostponedCustomShape.reset(new std::vector); - -// The for loop can change the size of m_aFramesOfParagraph, so the max size cannot be set in stone before the loop. -size_t nFrames = m_aFramesOfParagraph.size() ? m_aFramesOfParagraph.top().size() : 0; -for (size_t nIndex = 0; nIndex < nFrames; ++nIndex) +for (size_t nIndex = 0; nIndex < m_aFramesOfParagraph.size(); ++nIndex) { m_bParagraphFrameOpen = true; -ww8::Frame aFrame = m_aFramesOfParagraph.top()[nIndex]; +ww8::Frame aFrame = m_aFramesOfParagraph[nIndex]; const SwFrameFormat& rFrameFormat = aFrame.GetFrameFormat(); if (!TextBoxIsFramePr(rFrameFormat) || m_bWritingHeaderFooter) @@ -723,8 +714,6 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT std::shared_ptr pFramePr = std::make_shared(aFrame); aFramePrTextbox.push_back(pFramePr); } - -nFrames = m_aFramesOfParagraph.size() ? m_aFramesOfParagraph.top().size() : 0; } if (!m_pPostponedCustomShape->empty()) { @@ -734,8 +723,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT } m_pPostponedCustomShape.reset(); -if ( m_aFramesOfParagraph.size() ) -m_aFramesOfParagraph.top().clear(); +m_aFramesOfParagraph.clear(); if (!pTextNodeInfoInner) { @@ -745,8 +733,6 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/core/undo/data/table-copy-redline.odt |binary sw/qa/core/undo/undo.cxx| 19 +++ sw/source/core/undo/untbl.cxx | 10 +- 3 files changed, 28 insertions(+), 1 deletion(-) New commits: commit ac1056f9d9a922660b84f20ea86e5aabbe0e8716 Author: Miklos Vajna AuthorDate: Mon Mar 22 21:03:15 2021 +0100 Commit: Xisco Fauli CommitDate: Tue Mar 23 15:15:30 2021 +0100 tdf#133933 sw: fix crash on undo of redlined pasted table This is just a crash fix, there is some deeper problem here around undo: once redlining is on, overwriting table content during paste does not delete the fly frames anchored to empty cells (see lcl_CpyBox()), and we have the same problem on undo as well (see SwUndoTableCpyTable::UndoImpl()). And node indexes are recorded before inserting flys, so if they are not deleted, then the indexes don't match. Change-Id: I419e96c4d64f70a582358cab3808cea8b0e36649 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112939 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 140192fd5a2fc5e9d250d077d00bcebc014f7cbf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112810 Reviewed-by: Xisco Fauli diff --git a/sw/qa/core/undo/data/table-copy-redline.odt b/sw/qa/core/undo/data/table-copy-redline.odt new file mode 100644 index ..f391687823aa Binary files /dev/null and b/sw/qa/core/undo/data/table-copy-redline.odt differ diff --git a/sw/qa/core/undo/undo.cxx b/sw/qa/core/undo/undo.cxx index e43d154f3a66..6aacac27aa68 100644 --- a/sw/qa/core/undo/undo.cxx +++ b/sw/qa/core/undo/undo.cxx @@ -84,6 +84,25 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutUndo) CPPUNIT_ASSERT_EQUAL(pIndex1->GetIndex(), pIndex2->GetIndex()); } +CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTableCopyRedline) +{ +// Given a document with two table cells and redlining enabled: +load(DATA_DIRECTORY, "table-copy-redline.odt"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDocShell* pDocShell = pTextDoc->GetDocShell(); +SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + +// When doing select-all, copy, paste and undo: +pWrtShell->SelAll(); +rtl::Reference pTransfer = new SwTransferable(*pWrtShell); +pTransfer->Copy(); +TransferableDataHelper aHelper(pTransfer.get()); +SwTransferable::Paste(*pWrtShell, aHelper); + +// Without the accompanying fix in place, this test would have crashed. +pWrtShell->Undo(); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 85a797d5f509..d3cf5d465d01 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -2328,7 +2328,15 @@ void SwUndoTableCpyTable::UndoImpl(::sw::UndoRedoContext & rContext) if( !pTableNd ) pTableNd = pSNd->FindTableNode(); -SwTableBox& rBox = *pTableNd->GetTable().GetTableBox( nSttPos ); +SwTableBox* pBox = pTableNd->GetTable().GetTableBox( nSttPos ); +if (!pBox) +{ +SAL_WARN("sw.core", + "SwUndoTableCpyTable::UndoImpl: invalid start node index for table box"); +continue; +} + +SwTableBox& rBox = *pBox; SwNodeIndex aInsIdx( *rBox.GetSttNd(), 1 ); rDoc.GetNodes().MakeTextNode( aInsIdx, rDoc.GetDfltTextFormatColl() ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/effect-extent-line-width.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 21 +++ sw/source/filter/ww8/docxsdrexport.cxx | 11 +++ writerfilter/source/dmapper/GraphicImport.cxx | 36 ++-- 4 files changed, 63 insertions(+), 5 deletions(-) New commits: commit ea6193d64c5bed72bfb919b782434a0b3674c525 Author: Miklos Vajna AuthorDate: Tue Mar 16 09:05:57 2021 +0100 Commit: Xisco Fauli CommitDate: Thu Mar 18 14:10:26 2021 +0100 tdf#138895 DOCX filter: fix handling for effect extent vs line width Regression from commit a5a836d8c43dc9cebbbf8af39bf0142de603a7c6 (DOCX filter: effect extent should be part of the margin, 2014-12-04), the problem was that effect extent is OK to be added as an extra margin, but line width is part of that effect extent in Word, so Writer margin should not be increased with the line width. The Word behavior seems to be that half of the line width is part of e.g. the top effect extent, then the other half is part of the bottom one (and so on). The bugdoc's case was that a too large margin shifted the last line below the shape, and this tiny half-line-width extra margin handled correctly puts the line back to its correct place. Change-Id: Ic897926f3d79f979ea84aef3dbda49c46b18a3ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112558 Reviewed-by: Miklos Vajna Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112582 diff --git a/sw/qa/extras/ooxmlexport/data/effect-extent-line-width.docx b/sw/qa/extras/ooxmlexport/data/effect-extent-line-width.docx new file mode 100644 index ..5cc4d4e374ee Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/effect-extent-line-width.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index f532794e3874..a397bb073ecf 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -74,6 +74,27 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFooterMarginLost, "footer-margin-lost.do assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgMar", "footer", "709"); } +CPPUNIT_TEST_FIXTURE(Test, testEffectExtentLineWidth) +{ +auto verify = [this]() { +CPPUNIT_ASSERT_EQUAL(static_cast(508), + getProperty(getShape(1), "TopMargin")); +}; + +// Given a document with a shape that has a non-zero line width and effect extent: +// When loading the document: +load(mpTestDocumentPath, "effect-extent-line-width.docx"); +// Then make sure that the line width is not taken twice (once as part of the margin, and then +// also as the line width): +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 508 +// - Actual : 561 +// i.e. the upper spacing was too large, the last line of the text moved below the shape. +verify(); +reload(mpFilter, "effect-extent-line-width.docx"); +verify(); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf140572_docDefault_superscript, "tdf140572_docDefault_superscript.docx") { // A round-trip was crashing. diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 8d68eb5da6f7..bcf2959dd149 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -35,6 +35,7 @@ #include #include #include +#include using namespace com::sun::star; using namespace oox; @@ -447,22 +448,32 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons } } attrList->add(XML_behindDoc, bOpaque ? "0" : "1"); +sal_Int32 nLineWidth = 0; +if (const SdrObject* pObject = pFrameFormat->FindRealSdrObject()) +{ +nLineWidth = pObject->GetMergedItem(XATTR_LINEWIDTH).GetValue(); +} + // Extend distance with the effect extent if the shape is not rotated, which is the opposite // of the mapping done at import time. // The type of dist* attributes is unsigned, so make sure no negative value is written. sal_Int64 nTopExtDist = nRotation ? 0 : nTopExt; +nTopExtDist -= TwipsToEMU(nLineWidth / 2); sal_Int64 nDistT = std::max(static_cast(0), TwipsToEMU(aULSpaceItem.GetUpper()) - nTopExtDist); attrList->add(XML_distT, OString::number(nDistT).getStr()); sal_Int64 nBottomExtDist = nRotation ? 0 : nBottomExt; +nBottomExtDist -= TwipsToEMU(nLineWidth / 2); sal_Int64 nDistB = std::max(static_cast(0), TwipsToEMU(aULSpaceItem.GetLower()) - nBottomExtDist); attrList->add(XML_distB,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/core/layout/data/tdf122894-4.doc |binary sw/qa/core/layout/layout.cxx|5 + sw/source/core/layout/objectformattertxtfrm.cxx |3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) New commits: commit 7d7eb9895e18a48660965a87c9e2136f028e7022 Author: Caolán McNamara AuthorDate: Tue Mar 16 10:18:18 2021 + Commit: Caolán McNamara CommitDate: Wed Mar 17 21:10:12 2021 +0100 tdf#122894 skipping anchor in column in footnote a trawl of crash testing document didn't show up another example and it doesn't seem possible to create this scenario directly in out UI Change-Id: Ie65a51bf609e8bacd261f368f0b8037431c116ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112567 Tested-by: Jenkins Reviewed-by: Caolán McNamara Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112581 Tested-by: Caolán McNamara diff --git a/sw/qa/core/layout/data/tdf122894-4.doc b/sw/qa/core/layout/data/tdf122894-4.doc new file mode 100644 index ..4ebdb53de04f Binary files /dev/null and b/sw/qa/core/layout/data/tdf122894-4.doc differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index e9f1d22bd70b..3f6199f8dd01 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -260,6 +260,11 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testKeepwithnextFullheight) assertXPath(pXmlDoc, "//page[2]/body/txt/anchored/fly", 1); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testCrashRemoveFromLayout) +{ +load(DATA_DIRECTORY, "tdf122894-4.doc"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx index bf066909251f..98e374a7e5fb 100644 --- a/sw/source/core/layout/objectformattertxtfrm.cxx +++ b/sw/source/core/layout/objectformattertxtfrm.cxx @@ -748,7 +748,8 @@ void SwObjectFormatterTextFrame::FormatAnchorFrameAndItsPrevs( SwTextFrame& _rAn // format the content of the previous columns. // Note: It's a very simple format without formatting objects. SwFrame* pColFrameOfAnchor = _rAnchorTextFrame.FindColFrame(); -if ( pColFrameOfAnchor ) +SAL_WARN_IF(pColFrameOfAnchor && _rAnchorTextFrame.IsInFootnote(), "sw.layout", "tdf#122894 skipping anchor in column in footnote"); +if (pColFrameOfAnchor && !_rAnchorTextFrame.IsInFootnote()) { // #i44049# _rAnchorTextFrame.LockJoin(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/fly_fieldmark.fodt | 60 +++ sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx| 12 sw/source/filter/ww8/wrtw8nds.cxx| 23 +++- sw/source/filter/ww8/wrtww8.hxx |1 4 files changed, 92 insertions(+), 4 deletions(-) New commits: commit e79c637f291d552bfe8f32ccfc23300c67f51fcc Author: Michael Stahl AuthorDate: Wed Mar 10 11:26:07 2021 +0100 Commit: Caolán McNamara CommitDate: Fri Mar 12 16:14:09 2021 +0100 sw: DOCX export: put fly before fieldmark start into its own run If a fly starts at the same position as a CH_TXT_ATR_FIELDSTART, it is anchored before the field, and written in OutFlys() before the field is written in EndRun(), but the DOCX export reorders things in confusing ways. StartField_Impl() and CmdField_Impl() will actually end the current run (after putting the field char in it) and start a new one. So do something similar in this situation and create a new run if flys have been processed. Restrict this extra run to when there is actually a fly, because otherwise a dozen tests break; this requires a new FLY_NONE result for OutFlys() because FLY_PROCESSED is returned even if there are no flys. Change-Id: Id469c53d07eacad3992c7c0e451ab3756e02c8fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112267 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 3eced2d52415abeac266804ab682bee022322a19) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112230 Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/ooxmlexport/data/fly_fieldmark.fodt b/sw/qa/extras/ooxmlexport/data/fly_fieldmark.fodt new file mode 100644 index ..af1ae9a86243 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fly_fieldmark.fodt @@ -0,0 +1,60 @@ + + +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"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +foobar + + + diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 240678318f9a..40f93ab67664 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -484,6 +484,18 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testEditTime, "fdo81341.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[5]/w:fldChar", "fldCharType", "end"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFlyFieldmark, "fly_fieldmark.fodt") +{ +// the problem was that the flys were written after the field start +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source test/user-template
sw/qa/extras/uiwriter/uiwriter.cxx | 35 sw/source/core/doc/DocumentRedlineManager.cxx |4 +- test/user-template/user/autocorr/acor_en-GB.dat |binary 3 files changed, 37 insertions(+), 2 deletions(-) New commits: commit fa90d6da27a56cd2002aabb5f026d39b852f1160 Author: László Németh AuthorDate: Mon Mar 8 14:13:39 2021 +0100 Commit: Xisco Fauli CommitDate: Wed Mar 10 12:05:24 2021 +0100 tdf#140674 sw change tracking: fix :emoji: replacement Regression from commit 2951c96bcb673a260a09e2c6eb92ca0f99bf0c18 (tdf#83419 sw change tracking: clean-up autocorrect). Note: only :snowman: -> ☃ was added to the test autocorrect file acor_en-GB.dat. Change-Id: Ic3013e969ab937a5f9e5b6d1a6fac2f533b541f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112166 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit db999ddee7a890390f66d7e34906066c8bf178da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112218 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index e205f94656ce..d7e7519acdda 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -392,6 +392,7 @@ public: void testSpellOnlineParameter(); void testRedlineAutoCorrect(); void testRedlineAutoCorrect2(); +void testEmojiAutoCorrect(); #if HAVE_FEATURE_PDFIUM void testInsertPdf(); #endif @@ -620,6 +621,7 @@ public: CPPUNIT_TEST(testSpellOnlineParameter); CPPUNIT_TEST(testRedlineAutoCorrect); CPPUNIT_TEST(testRedlineAutoCorrect2); +CPPUNIT_TEST(testEmojiAutoCorrect); #if HAVE_FEATURE_PDFIUM CPPUNIT_TEST(testInsertPdf); #endif @@ -7704,6 +7706,39 @@ void SwUiWriterTest::testRedlineAutoCorrect2() CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); } +void SwUiWriterTest::testEmojiAutoCorrect() +{ +SwDoc* pDoc = createDoc("redline-autocorrect2.fodt"); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + +// Emoji replacement (:snowman: -> ☃) + +// without change tracking +CPPUNIT_ASSERT(!(pWrtShell->GetRedlineFlags() & RedlineFlags::On)); +SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); +pWrtShell->Insert(":snowman"); +pWrtShell->AutoCorrect(corr, ':'); +sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); +OUString sReplaced = u"☃Lorem,"; +nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); +CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); + +// with change tracking (showing redlines) +RedlineFlags const nMode(pWrtShell->GetRedlineFlags() | RedlineFlags::On); +CPPUNIT_ASSERT(nMode & (RedlineFlags::ShowDelete | RedlineFlags::ShowInsert)); +pWrtShell->SetRedlineFlags(nMode); +CPPUNIT_ASSERT(nMode & RedlineFlags::On); +CPPUNIT_ASSERT(nMode & RedlineFlags::ShowDelete); + +pWrtShell->Insert(":snowman"); +pWrtShell->AutoCorrect(corr, ':'); +sReplaced = u"☃☃Lorem,"; +nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + +// tdf#140674 This was ":snowman:" instead of autocorrect +CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); +} + void SwUiWriterTest::testTdf108423() { SwDoc* pDoc = createDoc(); diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 25d26f6a7743..14d6b76c71f0 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -2551,7 +2551,7 @@ SwRedlineTable::size_type DocumentRedlineManager::GetRedlinePos( const SwNode& r // #TODO - add 'SwExtraRedlineTable' also ? } -bool DocumentRedlineManager::HasRedline( const SwPaM& rPam, RedlineType nType, bool bStartOrEndInRange ) const // xxx +bool DocumentRedlineManager::HasRedline( const SwPaM& rPam, RedlineType nType, bool bStartOrEndInRange ) const { SwPosition currentStart(*rPam.Start()); SwPosition currentEnd(*rPam.End()); @@ -2572,7 +2572,7 @@ bool DocumentRedlineManager::HasRedline( const SwPaM& rPam, RedlineType nType, b if ( currentStart < *pTmp->End() && *pTmp->Start() <= currentEnd && // starting or ending within the range ( !bStartOrEndInRange || - ( currentStart <= *pTmp->Start() || *pTmp->End() <= currentEnd ) ) ) + ( currentStart < *pTmp->Start() || *pTmp->End() < currentEnd ) ) ) { return true; } diff --git a/test/user-template/user/autocorr/acor_en-GB.dat b/test/user-template/user/autocorr/acor_en-GB.dat index b74f1834caac..ae2f12db59d8 100644 Binary files a/test/user-template/user/autocorr/acor_en-GB.dat and b/test/user-template/user/autocorr/acor_en-GB.dat differ ___
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf124678_no_leading_paragraph.odt |binary sw/qa/extras/ooxmlexport/data/tdf124678_with_leading_paragraph.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 21 ++ sw/source/filter/ww8/wrtw8sty.cxx |6 +- 4 files changed, 24 insertions(+), 3 deletions(-) New commits: commit 93b66d0e99c9b601616f5110318eeec3ebac8091 Author: Vasily Melenchuk AuthorDate: Fri Apr 12 09:31:28 2019 +0200 Commit: Vasily Melenchuk CommitDate: Thu Mar 4 10:44:24 2021 +0100 tdf#124678 DOCX export: always write title page in section props Even if page description is not set we should try to mark title page because chaining of two page styles can not work for continuous sections. Unittests were implemented previously and were taken from abandoned patch https://gerrit.libreoffice.org/c/core/+/70646 Change-Id: I0b953d72d762f868735dc658f023d96944c9d308 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111757 Tested-by: Jenkins Tested-by: Thorsten Behrens Reviewed-by: Thorsten Behrens (cherry picked from commit e305289f87ea058cc92ecd83379b848697aa5a80) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111884 Reviewed-by: Vasily Melenchuk diff --git a/sw/qa/extras/ooxmlexport/data/tdf124678_no_leading_paragraph.odt b/sw/qa/extras/ooxmlexport/data/tdf124678_no_leading_paragraph.odt new file mode 100644 index ..a694ff613633 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124678_no_leading_paragraph.odt differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf124678_with_leading_paragraph.odt b/sw/qa/extras/ooxmlexport/data/tdf124678_with_leading_paragraph.odt new file mode 100644 index ..cb14c8ea4df3 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124678_with_leading_paragraph.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index f26d7570d38a..aa29afd218e0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -1395,6 +1395,27 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf101122_noFillForCustomShape, "tdf1011 "a:graphicData/wps:wsp/wps:spPr/a:custGeom/a:pathLst/a:path", "fill"); } +// The (tdf124678_no_leading_paragraph.odt, tdf124678_with_leading_paragraph.odt) documents are the same, +// except: +// - tdf124678_no_leading_paragraph.odt doesn't contain leading empty paragraph +// before the first section +// +DECLARE_OOXMLEXPORT_TEST(testTdf124678_case1, "tdf124678_no_leading_paragraph.odt") +{ +CPPUNIT_ASSERT_EQUAL_MESSAGE("First page header text", OUString(""), parseDump("/root/page[1]/header/txt")); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Second page header text", OUString("HEADER"), parseDump("/root/page[2]/header/txt")); +} + +// The (tdf124678_no_leading_paragraph.odt, tdf124678_with_leading_paragraph.odt) documents are the same, +// except: +// - tdf124678_no_leading_paragraph.odt doesn't contain leading empty paragraph +// before the first section +// +DECLARE_OOXMLEXPORT_TEST(testTdf124678_case2, "tdf124678_with_leading_paragraph.odt") +{ +CPPUNIT_ASSERT_EQUAL_MESSAGE("First page header text", OUString(""), parseDump("/root/page[1]/header/txt")); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Second page header text", OUString("HEADER"), parseDump("/root/page[2]/header/txt")); +} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index caae58fbb163..282bd90efab9 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1745,9 +1745,6 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt } } -if( titlePage ) -AttrOutput().SectionTitlePage(); - const SfxItemSet* pOldI = m_pISet; const SfxPoolItem* pItem; @@ -1813,6 +1810,9 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt } } +if (titlePage) +AttrOutput().SectionTitlePage(); + AttrOutput().SectionType( nBreakCode ); if( rSepInfo.pPageDesc ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - 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 49dad315bb776a13e404578ffd239ca85d6869cb Author: Miklos Vajna AuthorDate: Mon Mar 1 20:57:38 2021 +0100 Commit: Xisco Fauli CommitDate: Tue Mar 2 12:25:26 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 diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 442a508a355a..d9473275d180 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -245,6 +246,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 f1a6da4f3f47..5440afbed3aa 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -538,7 +538,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()) { @@ -568,7 +568,13 @@ bool RtfAttributeOutput::StartURL(const OUString& rUrl, const OUString& rTarget) bool RtfAttributeOutput::EndURL(bool const isAtEndOfParagraph) { -if (!m_sURL.isEmpty()) +if (m_aURLs.empty()) +{ +return true; +} + +const OUString& rURL =
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - 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 2465b0467d57ca325e820f13efeb40e69386b4a1 Author: Justin Luth AuthorDate: Tue Feb 23 15:22:47 2021 +0200 Commit: Xisco Fauli CommitDate: Thu Feb 25 10:44:10 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/+/111457 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 f3b291fcb8e9..04c4975056e4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -62,6 +62,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 a07b5d7e66b4..ffdc0c04f147 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7517,9 +7517,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-1' - 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 5031a2932e9146db8b163ecfcaaf29e59cc4cc9d Author: Justin Luth AuthorDate: Wed Jan 27 22:56:04 2021 +0300 Commit: Xisco Fauli CommitDate: Mon Feb 8 13:09:45 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 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 c2d17d965781..f3b291fcb8e9 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 dfec9f0affad..a07b5d7e66b4 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7391,6 +7391,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 @@ -7400,11 +7401,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-1' - 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 b708f31bf5f2993bf3f9fb2a832267f02bf90eac Author: Miklos Vajna AuthorDate: Mon Jan 25 21:05:12 2021 +0100 Commit: Michael Stahl CommitDate: Tue Jan 26 10:36:55 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/+/109933 Tested-by: Jenkins Reviewed-by: Michael Stahl 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 f2cdc7e9cdf2..dfec9f0affad 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -8832,6 +8832,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-1' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx|9 + sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |2 - sw/source/filter/ww8/ww8atr.cxx | 24 -- 4 files changed, 24 insertions(+), 11 deletions(-) New commits: commit fdb42d82d1240d3ba274f3f25a1072d0044d3c5c Author: Justin Luth AuthorDate: Thu Jan 21 16:19:35 2021 +0300 Commit: Xisco Fauli CommitDate: Mon Jan 25 17:28:19 2021 +0100 tdf#121669 ww8 export: use the "we have equal columns" flag If the columns are marked as AutoWidth, then there is no need to go to the remarkably poor layout code to determine if the columns should be exported as equal. In this case, it appears as if the layout engine hadn't really identified the full width, or evaluated the wish values of each column. This fixes DOCX, DOC, and RTF. Change-Id: I1a1193b65d01e654b3bfbfaee7d8c02a683ae2c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109762 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna (cherry picked from commit 9e41002701285dc89a4dc8c91619a51071995172) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109811 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx b/sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx new file mode 100644 index ..4f962e1bddf6 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf121669_equalColumns.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index c875d560e592..4c8f05e945d4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -560,6 +560,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c15, "tdf135343_column CPPUNIT_ASSERT_EQUAL_MESSAGE("Fits on two pages", 2, getPages()); } +DECLARE_OOXMLEXPORT_TEST(testTdf121669_equalColumns, "tdf121669_equalColumns.docx") +{ +uno::Reference xTextSection = getProperty< uno::Reference >(getParagraph(1), "TextSection"); +CPPUNIT_ASSERT(xTextSection.is()); +uno::Reference xTextColumns = getProperty< uno::Reference >(xTextSection, "TextColumns"); +// The property was ignored when deciding at export whether the columns were equal or not. Layout isn't reliable. +CPPUNIT_ASSERT(getProperty(xTextColumns, "IsAutomatic")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf132149_pgBreak, "tdf132149_pgBreak.odt") { // This 5 page document is designed to visually exaggerate the problems diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 1a94982df7e9..240678318f9a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -255,7 +255,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlphabeticalIndex_MultipleColumns,"alpha assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:sectPr/w:type","val","continuous"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:pPr/w:sectPr/w:type","val","continuous"); // check for "w:space" attribute for the columns in Section Properties -assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:pPr/w:sectPr/w:cols/w:col[1]","space","720"); +assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:pPr/w:sectPr/w:cols","space","720"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageref, "testPageref.docx") diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index fb26419025e0..c1959186979c 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -4661,18 +4661,22 @@ void AttributeOutputBase::FormatColumns( const SwFormatCol& rCol ) } // look if all columns are equal -bool bEven = true; -sal_uInt16 n; -sal_uInt16 nColWidth = rCol.CalcPrtColWidth( 0, static_cast(nPageSize) ); -for ( n = 1; n < nCols; n++ ) +bool bEven = rCol.IsOrtho(); +if (!bEven) { -short nDiff = nColWidth - -rCol.CalcPrtColWidth( n, static_cast(nPageSize) ); - -if ( nDiff > 10 || nDiff < -10 ) // Tolerance: 10 tw +bEven = true; +sal_uInt16 n; +sal_uInt16 nColWidth = rCol.CalcPrtColWidth( 0, static_cast(nPageSize) ); +for ( n = 1; n < nCols; n++ ) { -bEven = false; -break; +short nDiff = nColWidth - +rCol.CalcPrtColWidth( n, static_cast(nPageSize) ); + +if ( nDiff > 10 || nDiff < -10 ) // Tolerance: 10 tw +{ +bEven = false; +break; +} } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter.cxx |8 ++-- sw/source/core/edit/acorrect.cxx | 17 ++--- 2 files changed, 12 insertions(+), 13 deletions(-) New commits: commit 2c25f59fae2201ef57237bf67625dcdcf238d5ed Author: László Németh AuthorDate: Mon Jan 4 14:05:46 2021 +0100 Commit: Xisco Fauli CommitDate: Thu Jan 7 10:41:36 2021 +0100 tdf#106380 sw AutoCorrect: track deletion at capitalization Deletion of the original lowercase character wasn't tracked during sentence capitalization, resulting broken change tracking data. Note: for similar potential problems, see FIXME at the end of DocumentContentOperationsManager::Overwrite(). Change-Id: If6ddbb77675d87eb126f7d3bf554b529892b88d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108670 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit aecb7364713871ce068effdb59a5da68ab4b2e53) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108857 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 21b3e2f3b958..5ea7da588a02 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -7598,12 +7598,15 @@ void SwUiWriterTest::testRedlineAutoCorrect() SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); -// show tracked deletion +// show tracked deletion with enabled change tracking RedlineFlags const nMode(pWrtShell->GetRedlineFlags() | RedlineFlags::On); CPPUNIT_ASSERT(nMode & (RedlineFlags::ShowDelete | RedlineFlags::ShowInsert)); pWrtShell->SetRedlineFlags(nMode); CPPUNIT_ASSERT(nMode & RedlineFlags::ShowDelete); +CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); + SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); pWrtShell->AutoCorrect(corr, ' '); sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); @@ -7630,7 +7633,8 @@ void SwUiWriterTest::testRedlineAutoCorrect() nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); // This still keep the tracked deletion, capitalize only the visible text "s" -sReplaced = "tS "; +// with tracked deletion of the original character +sReplaced = "tsS "; CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); // repeat it with visible redlining and word auto replacement of "tset" diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index a1c06e0442d1..04efdc213c47 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -263,17 +263,12 @@ bool SwAutoCorrDoc::ReplaceRange( sal_Int32 nPos, sal_Int32 nSourceLength, const } else { -if( nSourceLength != rText.getLength() ) -{ -pPam->SetMark(); -pPam->GetPoint()->nContent = std::min( -pos.first->GetText().getLength(), pos.second + nSourceLength); -pDoc->getIDocumentContentOperations().ReplaceRange( *pPam, rText, false ); -pPam->Exchange(); -pPam->DeleteMark(); -} -else -pDoc->getIDocumentContentOperations().Overwrite( *pPam, rText ); +pPam->SetMark(); +pPam->GetPoint()->nContent = std::min( +pos.first->GetText().getLength(), pos.second + nSourceLength); +pDoc->getIDocumentContentOperations().ReplaceRange( *pPam, rText, false ); +pPam->Exchange(); +pPam->DeleteMark(); } if( m_bUndoIdInitialized ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/rtfexport/data/tdf138779.docx |binary sw/qa/extras/rtfexport/rtfexport5.cxx |6 ++ sw/source/filter/ww8/rtfattributeoutput.cxx | 19 +++ sw/source/filter/ww8/rtfattributeoutput.hxx |2 ++ 4 files changed, 19 insertions(+), 8 deletions(-) New commits: commit 30ad09049bf76956a696c2b61f5b9922bb744a08 Author: Mark Hung AuthorDate: Sun Dec 20 22:36:20 2020 +0800 Commit: Xisco Fauli CommitDate: Mon Jan 4 12:25:39 2021 +0100 tdf#138779 do not call EndRun() in StartRuby() and EndRuby(). Ruby is implemented as EQ field in RTF. The original run text become the ruby base text in this case. Calling EndRun() in StartRuby() might cause the run completed early and text attributes that hasn't be processed mistakenly applied to next run. This patch close the in EQ field command in EndRun, in case StartRuby has already inserted EQ field command. Change-Id: I3a755f235b79d11b7897f85ae3989cc3ac73b06a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108194 Tested-by: Jenkins Reviewed-by: Mark Hung (cherry picked from commit 326388da4e40c85f8a1af40264aaf56c7845e224) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108343 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/rtfexport/data/tdf138779.docx b/sw/qa/extras/rtfexport/data/tdf138779.docx new file mode 100644 index ..ef7d5dd84105 Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf138779.docx differ diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 0d921ed6c7b6..fea953889795 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -1276,6 +1276,12 @@ DECLARE_RTFEXPORT_TEST(testTdf137894, "tdf137894.odt") CPPUNIT_ASSERT_EQUAL(32.f, getProperty(getRun(getParagraph(2), 1), "CharHeightComplex")); } +DECLARE_RTFEXPORT_TEST(testTdf138779, "tdf138779.docx") +{ +// The text "2. Kozuka Mincho Pro, 8 pt Ruby ..." has font size 11pt ( was 20pt ). +CPPUNIT_ASSERT_EQUAL(11.f, getProperty(getRun(getParagraph(2), 14), "CharHeight")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 23dc3af728e2..f1a6da4f3f47 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -405,6 +405,13 @@ void RtfAttributeOutput::EndRun(const SwTextNode* /*pNode*/, sal_Int32 /*nPos*/, { m_aRun->append(SAL_NEWLINE_STRING); m_aRun.appendAndClear(m_aRunText); + +if (m_bInRuby) +{ +m_aRun->append(")}}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " {}}}"); +m_bInRuby = false; +} + if (!m_bSingleEmptyRun && m_bInRun) m_aRun->append('}'); m_bInRun = false; @@ -508,7 +515,7 @@ void RtfAttributeOutput::RawText(const OUString& rText, rtl_TextEncoding eCharSe m_aRunText->append(msfilter::rtfutil::OutString(rText, eCharSet)); } -void RtfAttributeOutput::StartRuby(const SwTextNode& rNode, sal_Int32 nPos, +void RtfAttributeOutput::StartRuby(const SwTextNode& rNode, sal_Int32 /*nPos*/, const SwFormatRuby& rRuby) { WW8Ruby aWW8Ruby(rNode, rRuby, GetExport()); @@ -521,18 +528,13 @@ void RtfAttributeOutput::StartRuby(const SwTextNode& rNode, sal_Int32 nPos, aStr += "\\a" + OUStringChar(aWW8Ruby.GetDirective()); } aStr += "(\\s\\up " + OUString::number((aWW8Ruby.GetBaseHeight() + 10) / 20 - 1) + "("; -EndRun(, nPos); m_rExport.OutputField(nullptr, ww::eEQ, aStr, FieldFlags::Start | FieldFlags::CmdStart); aStr = rRuby.GetText() + "),"; m_rExport.OutputField(nullptr, ww::eEQ, aStr, FieldFlags::NONE); +m_bInRuby = true; } -void RtfAttributeOutput::EndRuby(const SwTextNode& rNode, sal_Int32 nPos) -{ -m_rExport.OutputField(nullptr, ww::eEQ, ")", - FieldFlags::CmdEnd | FieldFlags::End | FieldFlags::Close); -EndRun(, nPos); -} +void RtfAttributeOutput::EndRuby(const SwTextNode& /*rNode*/, sal_Int32 /*nPos*/) {} bool RtfAttributeOutput::StartURL(const OUString& rUrl, const OUString& rTarget) { @@ -3810,6 +3812,7 @@ RtfAttributeOutput::RtfAttributeOutput(RtfExport& rExport) , m_bIsBeforeFirstParagraph(true) , m_bSingleEmptyRun(false) , m_bInRun(false) +, m_bInRuby(false) , m_pFlyFrameSize(nullptr) , m_bParaBeforeAutoSpacing(false) , m_nParaBeforeSpacing(0) diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index 246ab4aba50b..a7f95813c2c0 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -610,6 +610,8 @@ private: bool m_bInRun; +bool m_bInRuby; + /// Maps ID's to postit fields, used in atrfstart/end and atnref. std::map
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/uitest/data/tdf138907_titlePageDialog.odt |binary sw/qa/uitest/writer_tests5/titlePageWizard.py | 73 sw/source/ui/misc/titlepage.cxx | 19 +++--- 3 files changed, 84 insertions(+), 8 deletions(-) New commits: commit 4f7d5b0ed8df89dec6cc2ae45be5885f5f4ebae6 Author: Justin Luth AuthorDate: Sat Dec 26 10:52:08 2020 +0300 Commit: Xisco Fauli CommitDate: Mon Jan 4 12:03:52 2021 +0100 tdf#138907 sw TitlePageDlg: fix round-tripping This Format -> Title Pages dialog is completely broken, so I threw in lots of FIXME notes. At least for the case of just using the existing pages and setting them up as title/follow page, fix: 1.) the ability to round-trip page number restart if a numbering restart without a page style already existed. (Yes, this likely is an odd case of someone messing around. In any case, a page number restart REQUIRES a page style) make UITest_writer_tests5 UITEST_TEST_NAME=\ titlePageWizard.tdf138907.test_tdf138907 Change-Id: I544145e9f749f471b54fa6686242e93bc98f50be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108322 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit ccfd8e9d09f9ac0a0ea92d0f378391006faaf934) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108346 Reviewed-by: Xisco Fauli diff --git a/sw/qa/uitest/data/tdf138907_titlePageDialog.odt b/sw/qa/uitest/data/tdf138907_titlePageDialog.odt new file mode 100644 index ..837e0d0132cb Binary files /dev/null and b/sw/qa/uitest/data/tdf138907_titlePageDialog.odt differ diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard.py b/sw/qa/uitest/writer_tests5/titlePageWizard.py new file mode 100644 index ..f23c79c68768 --- /dev/null +++ b/sw/qa/uitest/writer_tests5/titlePageWizard.py @@ -0,0 +1,73 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +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() + +# This tests the Format->Title Page wizard, specifically the reset page number portion. +class tdf138907(UITestCase): +def test_tdf138907(self): + self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")) +document = self.ui_test.get_component() + +# Confirm the starting state. Just a page break, without a valid restart page number on page 2 +self.assertEqual(document.CurrentController.PageCount, 5) +Paragraphs = document.Text.createEnumeration() +Para1 = Paragraphs.nextElement() +self.assertEqual(Para1.String, "6") +self.assertEqual(Para1.PageDescName, "First Page") +Para2 = Paragraphs.nextElement() +self.assertEqual(Para2.String, "7") +self.assertEqual(Para2.PageDescName, None) + +#dialog Title Page +self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") +xDialog = self.xUITest.getTopFocusWindow() +#set restart page number to 2. With this doc, it defaults to resetting to 1. +xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING") +xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2 +xOKBtn = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOKBtn) + +# This correctly reset the starting page number for page 2 as "1". +# It wasn't persistent across round-trips though +Paragraphs = document.Text.createEnumeration() +Para1 = Paragraphs.nextElement() +self.assertEqual(Para1.String, "6") +self.assertEqual(Para1.PageDescName, "First Page") +self.assertEqual(Para2.String, "2") +Para2 = Paragraphs.nextElement() +# Without this fix, there was no PageDescName specified, just Landscape as default. +self.assertEqual(Para2.PageDescName, "Landscape") + +#re-run dialog Title Page +self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") +xDialog = self.xUITest.getTopFocusWindow() +#accept defaults and OK without making any changes. +xOKBtn = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOKBtn) + +# Without this fix, re-running the wizard was failing with the title page restarting at page 2. +Paragraphs = document.Text.createEnumeration() +Para1 = Paragraphs.nextElement() +#self.assertEqual(Para1.String, "6") +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/uiwriter/data2/tdf139127.fodt| 45 +++ sw/qa/extras/uiwriter/uiwriter2.cxx | 100 ++ sw/source/core/doc/DocumentRedlineManager.cxx | 11 ++ 3 files changed, 156 insertions(+) New commits: commit 8dd2e9900d4f00dbc7ce289d9ce9a9c6739b4851 Author: László Németh AuthorDate: Mon Dec 21 21:09:44 2020 +0100 Commit: Xisco Fauli CommitDate: Wed Dec 23 19:08:31 2020 +0100 tdf#139120 tdf#139127 sw: fix empty redline related crash and bad "$2" redline text in ChangesInMargin mode. Also in the default "changes-in-text" mode, Undo didn't remove this empty redline added for tdf#119571 in the case of associated redline ExtraData (i.e. joining paragraphs with different styles), see also commit 66b39ca79b36da8d5e151deab17a0fb7690eebe6 (tdf#131147 don't store redline ExtraData during Undo). Change-Id: I7faa7c3acd8f8a0312339087072453a15751dd81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108126 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 207a709bcf1af2eee7fbac8d3c30de6f8d43a8a3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108177 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/data2/tdf139127.fodt b/sw/qa/extras/uiwriter/data2/tdf139127.fodt new file mode 100644 index ..1acd9dc24506 --- /dev/null +++ b/sw/qa/extras/uiwriter/data2/tdf139127.fodt @@ -0,0 +1,45 @@ + +http://openoffice.org/2009/office; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text" xmlns:dc="http://purl.org/dc/elements/1.1/;> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + First page + B + + + diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 496b9b8602bc..64ad80da0f3b 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -2084,6 +2084,60 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137771) CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139120) +{ +SwDoc* pDoc = createDoc("tdf54819.fodt"); + +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +// switch on "Show changes in margin" mode +dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); + +SwWrtShell* const pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); +CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); + +// turn on red-lining and show changes +pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowInsert + | RedlineFlags::ShowDelete); +CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); +CPPUNIT_ASSERT_MESSAGE( +"redlines should be visible", + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + +// delete paragraph break +dispatchCommand(mxComponent, ".uno:GotoEndOfPara", {}); +for (int i = 0; i < 6; ++i) +{ +dispatchCommand(mxComponent, ".uno:Delete", {}); +} + +CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsum sit amet."), pTextDoc->getText()->getString()); + +for (int i = 0; i < 6; ++i) +{ +dispatchCommand(mxComponent, ".uno:Undo", {}); +} + +CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsum"), getParagraph(1)->getString()); +CPPUNIT_ASSERT_EQUAL(OUString("dolor sit amet."), getParagraph(2)->getString()); + +// Dump the rendering of the first page as an XML file. +SwDocShell* pShell = pTextDoc->GetDocShell(); +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; +xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +CPPUNIT_ASSERT(pXmlDoc); + +// This was the 3, containing the text "$2" instead of nothing +assertXPath(pXmlDoc, "/metafile/push/push/push/textarray", 2); + +// switch off "Show changes in margin" mode +dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); +CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testJoinParaChangesInMargin) { load(DATA_DIRECTORY, "tdf54819.fodt"); @@ -2125,6 +2179,52 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testJoinParaChangesInMargin) CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139127) +{ +load(DATA_DIRECTORY, "tdf139127.fodt"); + +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +// switch on "Show changes in margin"
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - 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 3d7c90b45c607fe560bacd8f57de0966a93edb4d Author: Mike Kaganski AuthorDate: Fri Dec 18 13:12:50 2020 +0300 Commit: Mike Kaganski CommitDate: Tue Dec 22 06:37:22 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/+/107996 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 daaecd43df9f..a9ea821e1700 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -610,8 +610,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 534ba9b4f8bf..fd304e9f4fe9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4837,13 +4837,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()); @@ -4856,7 +4855,7 @@ void DocxAttributeOutput::WriteSrcRect(const SdrObject* pSdrObj, const SwFrameFo } css::text::GraphicCrop
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - 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 64b3727adb12601d9a4010ec9160a8958d2ee878 Author: Justin Luth AuthorDate: Mon Dec 7 17:11:18 2020 +0300 Commit: Michael Stahl CommitDate: Sat Dec 19 22:48:30 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/+/107999 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 8767b76110bb..54dbddf20825 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1094,7 +1094,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 789d6ed410f9..6e8ee9e34f37 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -259,7 +259,6 @@ namespace { class SwXMLTextStyleContext_Impl : public XMLTextStyleContext { std::unique_ptr pConditions; -uno::Reference < style::XStyle > xNewStyle; protected: @@ -281,7 +280,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(), @@ -305,12 +304,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-1' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter2.cxx | 41 sw/source/core/undo/unredln.cxx |4 +-- 2 files changed, 43 insertions(+), 2 deletions(-) New commits: commit 709f14321f3e6da69677c138d769fd8084b1c7e6 Author: László Németh AuthorDate: Wed Dec 16 12:23:22 2020 +0100 Commit: László Németh CommitDate: Thu Dec 17 22:50:18 2020 +0100 sw ChangesInMargin: fix crash at Undo of deletion of paragraph break Deletion of the paragraph break by pressing Delete results an empty hidden redline, too, which caused a problem during Undo (if there were other tracked redlines, too). Change-Id: I64968688688be72d4e501631244b4c57ab634585 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107830 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 172373c4a2c4a66b8abbe26dbe07fd621c971ed0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107899 diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index c3d4d71d6b5c..496b9b8602bc 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -2084,6 +2084,47 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137771) CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testJoinParaChangesInMargin) +{ +load(DATA_DIRECTORY, "tdf54819.fodt"); + +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +// switch on "Show changes in margin" mode +dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); + +SwWrtShell* const pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); +CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); + +// turn on red-lining and show changes +SwDoc* pDoc = pWrtShell->GetDoc(); +pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowInsert + | RedlineFlags::ShowDelete); +CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); +CPPUNIT_ASSERT_MESSAGE( +"redlines should be visible", + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + +// delete a character and the paragraph break at the end of the paragraph +dispatchCommand(mxComponent, ".uno:GotoEndOfPara", {}); +pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); +dispatchCommand(mxComponent, ".uno:Delete", {}); +dispatchCommand(mxComponent, ".uno:Delete", {}); +CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsudolor sit amet."), getParagraph(1)->getString()); + +// Undo +dispatchCommand(mxComponent, ".uno:Undo", {}); +// this would crash due to bad redline range +dispatchCommand(mxComponent, ".uno:Undo", {}); +CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsum"), getParagraph(1)->getString()); + +// switch off "Show changes in margin" mode +dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); +CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138479) { SwDoc* const pDoc = createDoc(); diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 93d0b0d393a2..0e0d89765beb 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -107,7 +107,7 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext) for( SwRedlineTable::size_type n = 1; n < rTable.size(); ++n ) { SwRangeRedline *pRed(rTable[n]); -if ( pRedline->GetId() < pRed->GetId() && pRed->GetId() < nMaxId ) +if ( !pRed->HasMark() && pRedline->GetId() < pRed->GetId() && pRed->GetId() < nMaxId ) { nCurRedlinePos = n; pRedline = pRed; @@ -116,7 +116,7 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext) nMaxId = pRedline->GetId(); -if ( !pRedline->IsVisible() ) +if ( !pRedline->IsVisible() && !pRedline->HasMark() ) { // set it visible pRedline->Show(0, rTable.GetPos(pRedline), /*bForced=*/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-1' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter2.cxx |3 ++- sw/source/core/text/redlnitr.cxx| 29 +++-- 2 files changed, 29 insertions(+), 3 deletions(-) New commits: commit 6585f250d13fa27c2b3a5faf28d2cdab882ce323 Author: László Németh AuthorDate: Tue Dec 15 11:50:53 2020 +0100 Commit: László Németh CommitDate: Wed Dec 16 21:37:30 2020 +0100 tdf#138847 sw ChangesInMargin: show all characters in margin deleted by pressing backspace or delete, not only the first character from the deleted character sequence. Regression from commit 469f472fb31c4ef1a57f8ec54ba750c1332feec2 (tdf#138479 tdf#137769 sw ChangesInMargin: fix Undo in paragraphs). Change-Id: I0027cc0da02df8bccba2d957d4cc0407f34ba014 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107745 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 8bd229c4e42e92545db11832b29bf97540707c32) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107797 diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index cb33dc0ac5b3..c3d4d71d6b5c 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -2069,7 +2069,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137771) assertXPath(pXmlDoc, "/metafile/push/push/push/line", 13); // This was the content of the next (missing deletion on margin) -assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[16]/text", " s"); +// or only the first character of the deleted character sequence +assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[16]/text", " saved."); // this would crash due to bad redline range for (int i = 0; i < 6; ++i) diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 3a6a2749f8a4..2e3d1f55a06e 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -956,11 +956,14 @@ bool SwRedlineItr::CheckLine( SwPosition const start(*m_rDoc.GetNodes()[nStartNode]->GetContentNode(), nChkStart); SwPosition const end(*m_rDoc.GetNodes()[nEndNode]->GetContentNode(), nChkEnd); +SwRangeRedline const* pPrevRedline = nullptr; +bool isBreak(false); for (m_nAct = m_nFirst; m_nAct < m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++m_nAct) { SwRangeRedline const*const pRedline( m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ m_nAct ] ); -bool isBreak(false); +// collect text of the hidden redlines at the end of the line +bool isExtendText(false); switch (ComparePosition(*pRedline->Start(), *pRedline->End(), start, end)) { case SwComparePosition::Behind: @@ -983,13 +986,35 @@ bool SwRedlineItr::CheckLine( if (rRedlineText.isEmpty() && pRedline->GetType() == RedlineType::Delete) { rRedlineText = const_cast(pRedline)->GetDescr(/*bSimplified=*/true); +pPrevRedline = pRedline; +isExtendText = true; +} +// join the text of the next short delete redlines in the same position +// i.e. characters deleted by pressing backspace or delete +else if (pPrevRedline && pRedline->GetType() == RedlineType::Delete && +*pRedline->Start() == *pPrevRedline->Start() && *pRedline->End() == *pPrevRedline->End() ) +{ +OUString sExtendText(const_cast(pRedline)->GetDescr(/*bSimplified=*/true)); +if (!sExtendText.isEmpty()) +{ +if (rRedlineText.getLength() < 12) +{ +// TODO: remove extra space from GetDescr(true), +// but show deletion of paragraph or line break +rRedlineText = rRedlineText + + const_cast(pRedline)->GetDescr(/*bSimplified=*/true).subView(1); +} +else +rRedlineText = OUString::Concat(rRedlineText.subView(0, rRedlineText.getLength() - 3)) + "..."; +} +isExtendText = true; } break; } case SwComparePosition::Before: break; // -Werror=switch } -if (isBreak) +if (isBreak && !isExtendText) { break; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/core/layout/data/btlr-nested-cell.odt |binary sw/qa/core/layout/layout.cxx| 28 +++- sw/source/core/layout/ssfrm.cxx |3 ++- 3 files changed, 29 insertions(+), 2 deletions(-) New commits: commit 20f12960ae546ab90b1e216d5ed3f0dc576f1b48 Author: Miklos Vajna AuthorDate: Mon Dec 14 21:05:02 2020 +0100 Commit: Miklos Vajna CommitDate: Wed Dec 16 09:08:55 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 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 2151b870da13..76445faa4cfe 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -17,7 +18,8 @@ #include #include #include -#include +#include +#include char const DATA_DIRECTORY[] = "/sw/qa/core/layout/data/"; @@ -216,6 +218,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(); +tools::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 467a60a9d374..d8404b947c04 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -633,7 +633,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-1' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf136929_framesOfParagraph.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx|7 ++ sw/source/filter/ww8/docxattributeoutput.cxx | 27 +++--- sw/source/filter/ww8/docxattributeoutput.hxx |2 4 files changed, 29 insertions(+), 7 deletions(-) New commits: commit 7d90b50285f294a3c9cce0b22399fefe3ab46ee5 Author: Justin Luth AuthorDate: Thu Dec 10 11:29:53 2020 +0300 Commit: Xisco Fauli CommitDate: Mon Dec 14 11:23:31 2020 +0100 tdf#136929 docx export: keep frame with paragraph EndParagraph was checking if any frames were to be attached. Well, startParagraph can occur multiple times before endParagraph, so the frames can be attached to the wrong paragraph. In this case, it was moving the text-body frame into the footer. So make a stack of these things, so that each paragraph can keep track of it's own setting. RTF can have endParagraph without startParagraph. Although that doesn't seem to apply in this DOCX-only context, just to be safe I'm assuming that it could in theory happen as well with a DOCX, and so never assume that the stack exists. Based on a code read, (and then a confirming unit test,) things seem to be complicated by multi-levels of textboxes that need to be squished. The for loop with a changing upper end really threw me for a loop, so I'm clearly documenting that. Change-Id: I1060736c0a2174af125d853ff7d72265e000c8de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107516 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna (cherry picked from commit 3fd156419654ba5e2f248357a2eed5eeaad04548) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107552 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf136929_framesOfParagraph.odt b/sw/qa/extras/ooxmlexport/data/tdf136929_framesOfParagraph.odt new file mode 100644 index ..918b24f670db Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf136929_framesOfParagraph.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index b9ae69668c6d..20f9c75a311c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -458,6 +458,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135216_evenOddFooter, "tdf135216_evenOddFooter.o getParagraph(2, "2"); } +DECLARE_OOXMLEXPORT_TEST(testTdf136929_framesOfParagraph, "tdf136929_framesOfParagraph.odt") +{ +// Before this fix, the image was placed in the footer instead of in the text body - messing everything up. +CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 5, getPages() ); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Header2 text", OUString("* | *"), parseDump("/root/page[4]/footer/txt")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf136589_paraHadField, "tdf136589_paraHadField.docx") { // The section break should not add an additional CR - which equals an empty page two. diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 0ae46d86525e..534ba9b4f8bf 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -383,6 +383,12 @@ static void checkAndWriteFloatingTables(DocxAttributeOutput& rDocxAttributeOutpu void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo ) { +// Paragraphs (in headers/footers/comments/frames etc) can start before another finishes. +// So a stack is needed to keep track of each paragraph's status separately. +// Complication: Word can't handle nested text boxes, so those need to be collected together. +if ( !m_aFramesOfParagraph.size() || !m_nTextFrameLevel ) +m_aFramesOfParagraph.push(std::vector()); + // look ahead for floating tables that were put into a frame during import // floating tables in shapes are not supported: exclude this case if (!pTextNodeInfo && !m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen()) @@ -647,10 +653,13 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT assert(!m_pPostponedCustomShape); m_pPostponedCustomShape.reset(new std::vector); -for (size_t nIndex = 0; nIndex < m_aFramesOfParagraph.size(); ++nIndex) + +// The for loop can change the size of m_aFramesOfParagraph, so the max size cannot be set in stone before the loop. +size_t nFrames = m_aFramesOfParagraph.size() ? m_aFramesOfParagraph.top().size() : 0; +for (size_t nIndex = 0; nIndex < nFrames; ++nIndex) { m_bParagraphFrameOpen = true; -ww8::Frame aFrame = m_aFramesOfParagraph[nIndex]; +ww8::Frame aFrame = m_aFramesOfParagraph.top()[nIndex];
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter2.cxx | 30 ++ sw/source/core/undo/unredln.cxx |6 +++--- 2 files changed, 33 insertions(+), 3 deletions(-) New commits: commit 039b8ab4329a56420ac6da6cd78087d5a42e8dd3 Author: László Németh AuthorDate: Sat Dec 12 13:19:01 2020 +0100 Commit: László Németh CommitDate: Sat Dec 12 18:02:43 2020 +0100 tdf#138605 sw change tracking: fix crash with Undo Regression from commit 469f472fb31c4ef1a57f8ec54ba750c1332feec2 (tdf#138479 tdf#137769 sw ChangesInMargin: fix Undo in paragraphs) Change-Id: I7826b7920e51733da98c00bfdcb8636d42655afc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107637 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit e57d77cb01d3e76a942c5e2bb896135dd900f807) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107620 diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 4bbaeee20341..cb33dc0ac5b3 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1957,6 +1957,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137503) CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138605) +{ +SwDoc* const pDoc(createDoc()); +SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +// turn on red-lining and show changes +pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowInsert + | RedlineFlags::ShowDelete); +CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); +CPPUNIT_ASSERT_MESSAGE( +"redlines should be visible", + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + +// insert a word, delete it with change tracking and try to undo it +pWrtShell->Insert("word"); +dispatchCommand(mxComponent, ".uno:SelectAll", {}); +dispatchCommand(mxComponent, ".uno:Delete", {}); +// this crashed due to bad access to the empty redline table +dispatchCommand(mxComponent, ".uno:Undo", {}); + +// more Undo +CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("word")); +dispatchCommand(mxComponent, ".uno:Undo", {}); +CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("")); +dispatchCommand(mxComponent, ".uno:Undo", {}); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138135) { load(DATA_DIRECTORY, "tdf132160.odt"); diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index c385df3252f4..93d0b0d393a2 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -92,15 +92,15 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext) // fix PaM for deletions shown in margin bool bIsDeletion = dynamic_cast(this); +const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); sal_uInt32 nMaxId = SAL_MAX_UINT32; -if ( bIsDeletion ) +if ( bIsDeletion && rTable.size() > 0 ) { // Nodes of the deletion range are in the newest invisible redlines. // Set all redlines visible and recover the original deletion range. -for (sal_uInt32 nNodes = 0; nNodes < m_nEndNode - m_nSttNode + 1; ++ nNodes) +for (sal_uInt32 nNodes = 0; nNodes < m_nEndNode - m_nSttNode + 1; ++nNodes) { SwRedlineTable::size_type nCurRedlinePos = 0; -const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); SwRangeRedline * pRedline(rTable[nCurRedlinePos]); // search last but nNodes redline by its nth biggest id ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/uitest/data/hiddenRow.ods |binary sw/qa/uitest/data/tdf129083.odt |binary sw/qa/uitest/table/sheetToTable.py | 107 +++ sw/source/uibase/dochdl/swdtflvr.cxx | 15 +++- 4 files changed, 119 insertions(+), 3 deletions(-) New commits: commit e7065337630d414bd17e626155fa4e9fc5a2e29d Author: László Németh AuthorDate: Wed Dec 9 20:38:40 2020 +0100 Commit: Xisco Fauli CommitDate: Thu Dec 10 14:09:39 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/+/107484 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/uitest/data/hiddenRow.ods b/sw/qa/uitest/data/hiddenRow.ods new file mode 100644 index ..8b5d98a182fb Binary files /dev/null and b/sw/qa/uitest/data/hiddenRow.ods differ diff --git a/sw/qa/uitest/data/tdf129083.odt b/sw/qa/uitest/data/tdf129083.odt new file mode 100644 index ..3de65273e8a1 Binary files /dev/null and b/sw/qa/uitest/data/tdf129083.odt differ 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") +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/uiwriter/data3/tdf100691.fodt | 230 + sw/qa/extras/uiwriter/uiwriter3.cxx| 25 +++ sw/source/core/tox/txmsrt.cxx |2 3 files changed, 256 insertions(+), 1 deletion(-) New commits: commit 474f79224d2db89dc33bae89edd69979d53e745b Author: László Németh AuthorDate: Fri Dec 4 12:02:19 2020 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Fri Dec 4 15:08:42 2020 +0100 tdf#100691 sw Table of Contents: remove hidden text part of chapter, section etc. names. See also commit daf2a7d957c829c551754871a3545495c0f76bc0 (tdf#61154 sw Table of Contents: remove tracked deletion). Change-Id: I96f2308b1b5241f62bcb0091aae32757caeab73b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107214 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 69a73d0443d408f04837c8781e8fd2296fdd49c6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107206 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/uiwriter/data3/tdf100691.fodt b/sw/qa/extras/uiwriter/data3/tdf100691.fodt new file mode 100644 index ..6488f0b40663 --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf100691.fodt @@ -0,0 +1,230 @@ + +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:dom="http://www.w3.org/2001/xml-events; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:tableooo="http://openoffice.org/2009/table; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:ooo="http://openoffice.org/2004/office; xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:officeooo="http://openoffice.org/2009/office; xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:open document:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + 2020-12-04T11:52:59.211331599PT29S1LibreOfficeDev/7.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/e3e68283a0a3457df3501428f8c1310077a7d9b8 + + + http://openoffice.org/2004/office; xmlns:xlink="http://www.w3.org/1999/xlink"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Table of Contents + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/uiwriter/data3/tdf61154.fodt | 132 ++ sw/qa/extras/uiwriter/uiwriter3.cxx | 36 sw/source/core/tox/txmsrt.cxx |2 3 files changed, 169 insertions(+), 1 deletion(-) New commits: commit d0a1179d2ee9de52bcad864cc19af76c46917817 Author: László Németh AuthorDate: Thu Dec 3 20:27:13 2020 +0100 Commit: László Németh CommitDate: Fri Dec 4 11:06:05 2020 +0100 tdf#61154 sw Table of Contents: remove tracked deletion ... part of chapter, section etc. names also in Show Changes mode, instead of showing as normal text. Note: This problem was worse, than the case of references, because hiding tracked changes didn't fix the Table of Contents automatically, so it's better to avoid the generation of the bad mixed names, which showed also the deleted text as normal, without any visible differences (strikethrough etc.). Change-Id: Ieef8cf6e2f8bef64f99e5cb0542b7b43d8e76a27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107176 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit daf2a7d957c829c551754871a3545495c0f76bc0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107200 diff --git a/sw/qa/extras/uiwriter/data3/tdf61154.fodt b/sw/qa/extras/uiwriter/data3/tdf61154.fodt new file mode 100644 index ..18e0c0a64331 --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf61154.fodt @@ -0,0 +1,132 @@ + +http://openoffice.org/2009/office; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text" xmlns:dc="http://purl.org/dc/elements/1.1/;> + + + + + + + + + + + + + X + 2020-12-03 + + + + + + + X + 2020-12-03 + + + + + + + X + 2020-12-03 + + + + + + + + Table of Contents + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Table of Contents + + Update me!1 + + + Text InsertedDeleted + + + diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 972cc6af88b5..0a518971272b 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -34,6 +34,8 @@ #include #include #include +#include +#include namespace { @@ -219,6 +221,40 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132911) //CPPUNIT_ASSERT_EQUAL(4, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf61154) +{ +load(DATA_DIRECTORY, "tdf61154.fodt"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); +CPPUNIT_ASSERT(pWrtShell); + +SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + +pWrtShell->GotoNextTOXBase(); + +// show changes +pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::ShowDelete + | RedlineFlags::ShowInsert); +CPPUNIT_ASSERT_MESSAGE("redlining should be off", + !pDoc->getIDocumentRedlineAccess().IsRedlineOn()); +CPPUNIT_ASSERT_MESSAGE( +"redlines should be visible", + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + +const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX(); +pWrtShell->UpdateTableOf(*pTOXBase); +SwCursorShell* pShell(pDoc->GetEditShell()); +SwTextNode* pTitleNode = pShell->GetCursor()->GetNode().GetTextNode(); +SwNodeIndex aIdx(*pTitleNode); + +// table of contents node shouldn't contain tracked deletion +// This was "Text InsertedDeleted\t1" +SwTextNode* pNext = static_cast(pDoc->GetNodes().GoNext()); +CPPUNIT_ASSERT_EQUAL(OUString("Text Inserted\t1"), pNext->GetText()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134404) { load(DATA_DIRECTORY, "tdf134404.odt"); diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index d69e57ba2c3b..e2591dfb3514 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -550,7 +550,7 @@ TextAndReading SwTOXPara::GetText_Impl(SwRootFrame const*const pLayout) const assert(nEndIndex == -1); return
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/uitest/data/tdf66043.fodt | 35 ++ sw/qa/uitest/writer_tests4/spellDialog.py | 33 +++- sw/source/core/txtnode/txtedt.cxx | 15 ++-- 3 files changed, 79 insertions(+), 4 deletions(-) New commits: commit b4707a331d8f28c87e3e48709937da1260ace596 Author: László Németh AuthorDate: Tue Dec 1 15:12:54 2020 +0100 Commit: Xisco Fauli CommitDate: Thu Dec 3 09:57:48 2020 +0100 tdf#66043 sw: fix spell checking of word with deletion Correct words were underlined as spelling mistakes, if they contained tracked deletions, related to the unwanted CH_TXTATR_INWORD characters (result of removing tracked deletions) at calling spell checking API functions. Fix it by checking the "invalid" words without CH_TXTATR_INWORD characters, too. Change-Id: I6d8a8d619a571dfb613991cb8cf67faab57de4c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106988 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit d08e41379d39a3b552c2c8a34fe1c4849bb80bc9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107097 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/uitest/data/tdf66043.fodt b/sw/qa/uitest/data/tdf66043.fodt new file mode 100644 index ..5fcdde71d4ae --- /dev/null +++ b/sw/qa/uitest/data/tdf66043.fodt @@ -0,0 +1,35 @@ + +http://openoffice.org/2009/office; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text" xmlns:dc="http://purl.org/dc/elements/1.1/;> + + + + + + + + + + + + + Unknown Author + 2020-12-01T12:49:53 + +o + + + + + + Unknown Author + 2020-12-01T12:50:00 + +a + + + + good baad eeend + + + + diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py index e678afea53e9..3b9e4c31f3da 100644 --- a/sw/qa/uitest/writer_tests4/spellDialog.py +++ b/sw/qa/uitest/writer_tests4/spellDialog.py @@ -5,6 +5,8 @@ # import re +import org.libreoffice.unotest +import pathlib from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict @@ -12,6 +14,9 @@ from uitest.uihelper.common import get_state_as_dict from libreoffice.linguistic.linguservice import get_spellchecker from com.sun.star.lang import Locale +def get_url_for_data_file(file_name): +return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + class SpellingAndGrammarDialog(UITestCase): def is_supported_locale(self, language, country): @@ -99,4 +104,30 @@ frog, dogg, catt""" output_text = document.Text.getString().replace('\r\n', '\n') self.assertTrue(re.match(self.TDF46852_REGEX, output_text)) - + +def test_tdf66043(self): +writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf66043.fodt")) +document = self.ui_test.get_component() +# Step 1: Initiate spellchecking, and make sure "Check grammar" is +# unchecked +spell_dialog = self.launch_dialog() +checkgrammar = spell_dialog.getChild('checkgrammar') +if get_state_as_dict(checkgrammar)['Selected'] == 'true': +checkgrammar.executeAction('CLICK', ()) +self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false') + +# Step 2: Click on "Correct all" for each misspelling +# prompt until end of document is reached. +changeall = spell_dialog.getChild('changeall') +changeall.executeAction("CLICK", ()) + +xCloseBtn = spell_dialog.getChild("close") +xCloseBtn.executeAction("CLICK", tuple()) + +output_text = document.Text.getString().replace('\r\n', '\n') +# This was "gooodgood baaad eeend" ("goood" is a deletion, +# "good" is an insertion by fixing the first misspelling), +# but now "goood" is not a misspelling because it is accepted +# correctly without the redline containing a deleted "o" +self.assertTrue(output_text == 'goood baaadbaaed eeend') + diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index ba47a0021b73..cc66f68ed23e 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1022,7 +1022,12 @@ bool SwTextNode::Spell(SwSpellArgs* pArgs) } if( pArgs->xSpellAlt.is() ) { -if (IsSymbolAt(aScanner.GetBegin())) +if ( IsSymbolAt(aScanner.GetBegin()) || +// redlines can leave "in word" character within word, +// we must remove them before spell checking +// to avoid false
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/core/layout/data/textbox-phantom-change.docx |binary sw/qa/core/layout/layout.cxx | 14 sw/source/core/draw/dcontact.cxx | 29 +- sw/source/core/layout/objectformattertxtfrm.cxx| 33 - 4 files changed, 42 insertions(+), 34 deletions(-) New commits: commit cc04f0b6ff5a5e35cfc9dea1a98ea27b0efe6d5d Author: Daniel Arato (NISZ) AuthorDate: Mon Nov 16 11:53:47 2020 +0100 Commit: Xisco Fauli CommitDate: Thu Nov 26 16:39:46 2020 +0100 tdf#135198 tdf#138050 sw editing: fix text box position sync Follow-up to commit c9eb53f200225f2ee6ca695e1326843a487aee51 (tdf#135198 sw editing: text box fell out of its shape) Every time a shape is repositioned, make sure the text box inside the shape follows the shape. The previous solution to this bug, the one implemented in SwObjectFormatterTextFrame::DoFormatObjs, was a little more cumbersome. This one should produce fewer regressions, I hope. Change-Id: I3e88eb8616cd299cabb7b74b188ab7220746ec89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106421 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 59fec754a1523eede0f19a59e4eeeff593a4d688) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106681 Reviewed-by: Xisco Fauli diff --git a/sw/qa/core/layout/data/textbox-phantom-change.docx b/sw/qa/core/layout/data/textbox-phantom-change.docx new file mode 100644 index ..75ac039561f6 Binary files /dev/null and b/sw/qa/core/layout/data/textbox-phantom-change.docx differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 15f2c4edb846..2151b870da13 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include char const DATA_DIRECTORY[] = "/sw/qa/core/layout/data/"; @@ -180,6 +181,19 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxStaysInsideShape) assertXPath(pXmlDoc, "//fly/infos/bounds", "bottom", "7184"); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxNotModifiedOnOpen) +{ +// tdf#138050: a freshly opened document containing a shape with a text box +// should not appear to be modified +load(DATA_DIRECTORY, "textbox-phantom-change.docx"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + +// Without the fix in place this test would have shown that the document +// was modified due to a fix to tdf#135198 +CPPUNIT_ASSERT(!pDoc->getIDocumentState().IsModified()); +} + CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical) { load(DATA_DIRECTORY, "textbox-autogrow-vertical.docx"); diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 8707bcbaeb84..bece3f460079 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -50,6 +50,8 @@ #include #include #include +#include +#include #include #include #include @@ -1262,7 +1264,6 @@ void SwDrawContact::Changed_( const SdrObject& rObj, const SwFormatVertOrient& rVert = GetFormat()->GetVertOrient(); if ( nYPosDiff != 0 ) { - if ( rVert.GetRelationOrient() == text::RelOrientation::CHAR || rVert.GetRelationOrient() == text::RelOrientation::TEXT_LINE ) { @@ -1315,6 +1316,32 @@ void SwDrawContact::Changed_( const SdrObject& rObj, // may affect the size of the underlying textbox. lcl_textBoxSizeNotify(GetFormat()); } + +// tdf#135198: keep text box together with its shape +SwRect aObjRect(rObj.GetSnapRect()); +const SwPageFrame* rPageFrame = pAnchoredDrawObj->GetPageFrame(); +if (rPageFrame && rPageFrame->isFrameAreaPositionValid()) +{ +SwDoc* const pDoc = GetFormat()->GetDoc(); + +// avoid Undo creation +::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo()); + +// hide any artificial "changes" made by synchronizing the textbox position +const bool bEnableSetModified = pDoc->getIDocumentState().IsEnableSetModified(); +pDoc->getIDocumentState().SetEnableSetModified(false); + +SfxItemSet aSyncSet(pDoc->GetAttrPool(), +svl::Items{}); +aSyncSet.Put(SwFormatVertOrient(aObjRect.Top() - rPageFrame->getFrameArea().Top(), +text::VertOrientation::NONE, + text::RelOrientation::PAGE_FRAME)); +aSyncSet.Put(SwFormatAnchor(RndStdIds::FLY_AT_PAGE,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter2.cxx | 33 +++ sw/source/core/undo/unredln.cxx | 50 2 files changed, 67 insertions(+), 16 deletions(-) New commits: commit 1a9ab76e9cc904ecad902f460e985b8721eb6fdd Author: László Németh AuthorDate: Wed Nov 25 18:06:54 2020 +0100 Commit: Xisco Fauli CommitDate: Thu Nov 26 13:01:04 2020 +0100 tdf#137503 sw ChangesInMargin: fix Undo/Redo of deleted paragraph Tracked deletion of paragraph(s) consists of several hidden redlines in "Show changes in margin" mode. Fix Undo by setting them all visible with recovering the original deletion range. Follow-up of commit 469f472fb31c4ef1a57f8ec54ba750c1332feec2 (tdf#138479 tdf#137769 sw ChangesInMargin: fix Undo in paragraphs). Change-Id: Ib92aa5055eaf3e0754a154a2c78172378f6e6f6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106608 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 586bd08fa2655ad90ef4777626ad8f17d6a2c4ce) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106676 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 28019c51df0b..4bbaeee20341 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1924,6 +1924,39 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137684) CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137503) +{ +load(DATA_DIRECTORY, "tdf132160.odt"); + +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +// switch on "Show changes in margin" mode +dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); + +SwWrtShell* const pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); +CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); + +// select and delete the first two paragraphs +pWrtShell->EndPara(/*bSelect=*/true); +pWrtShell->EndPara(/*bSelect=*/true); +pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); +dispatchCommand(mxComponent, ".uno:Delete", {}); +CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("The")); + +// this would crash due to bad redline range +dispatchCommand(mxComponent, ".uno:Undo", {}); +CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Encryption ")); + +// this would crash due to bad redline range +dispatchCommand(mxComponent, ".uno:Redo", {}); +CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("The")); + +// switch off "Show changes in margin" mode +dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); +CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138135) { load(DATA_DIRECTORY, "tdf132160.odt"); diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index e02b9a594623..c385df3252f4 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -92,28 +92,46 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext) // fix PaM for deletions shown in margin bool bIsDeletion = dynamic_cast(this); +sal_uInt32 nMaxId = SAL_MAX_UINT32; if ( bIsDeletion ) { -SwRedlineTable::size_type nCurRedlinePos = 0; -const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); -SwRangeRedline * pRedline(rTable[nCurRedlinePos]); -// search last redline by its biggest id -// TODO handle multiple nodes -for( SwRedlineTable::size_type n = 1; n < rTable.size(); ++n ) +// Nodes of the deletion range are in the newest invisible redlines. +// Set all redlines visible and recover the original deletion range. +for (sal_uInt32 nNodes = 0; nNodes < m_nEndNode - m_nSttNode + 1; ++ nNodes) { -SwRangeRedline *pRed(rTable[n]); -if ( pRedline->GetId() < pRed->GetId() ) +SwRedlineTable::size_type nCurRedlinePos = 0; +const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); +SwRangeRedline * pRedline(rTable[nCurRedlinePos]); + +// search last but nNodes redline by its nth biggest id +for( SwRedlineTable::size_type n = 1; n < rTable.size(); ++n ) { -nCurRedlinePos = n; -pRedline = pRed; +SwRangeRedline *pRed(rTable[n]); +if ( pRedline->GetId() < pRed->GetId() && pRed->GetId() < nMaxId ) +{ +nCurRedlinePos = n; +pRedline = pRed; +} } -} -if ( !pRedline->IsVisible() ) -{ -
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source writerfilter/source
sw/qa/extras/rtfexport/data/tdf137894.odt |binary sw/qa/extras/rtfexport/rtfexport5.cxx | 16 ++ sw/source/filter/ww8/rtfattributeoutput.cxx | 138 sw/source/filter/ww8/rtfattributeoutput.hxx |6 - writerfilter/source/rtftok/rtfdispatchvalue.cxx |4 5 files changed, 95 insertions(+), 69 deletions(-) New commits: commit efe85aa1ef4034ae70c50a256b491737199b8747 Author: Mark Hung AuthorDate: Sun Nov 22 19:32:32 2020 +0800 Commit: Xisco Fauli CommitDate: Wed Nov 25 18:17:43 2020 +0100 tdf#137894 separate associated character properties in ww8filter/RtfAttributeOutput and treat \dbch as CJK and \hich Western in order to roundtrip the RTF document. ww8filter mix all the associated style, including properties for CJK and CTL scripts. Both RtfAttributeOutput::CharFontCJK and RtfAttributeOutput::CharFontCTL output \dbch, that result in incorrect assocation. CharFontCTL should use \rtlch, but it was already in RtfAttributeOutput::MoveCharacterProperties. To make the order correct, I separate the associated character properties that were stored in m_aSyltesAssoc into m_aSyltesAssocRtlch, and m_aSyltesAssocDbch by their script types. Note that it is not clear what associated character properties that we should adopt for \hich and \ltrch. In theory RTL scripts can output high ANSI chars too, so \hich may get properties from either Western or CTL scripts. However, examining Hebrew RTF documents, I didn't see any sign that \hich is used in that way. Use RTL as CTL might be a problem for Mongolian, Manchu and Xibe. They are CTL but top-to-bottom (aka LTR) . But I don't think they will be expressed as high ANSI chars either. Change-Id: I214edbb00a67c2ffe19c5a37254c8988a0828f40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106355 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit f97af19460fbd7483a0e1c1d0137e814f5390e69) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106523 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/rtfexport/data/tdf137894.odt b/sw/qa/extras/rtfexport/data/tdf137894.odt new file mode 100755 index ..79c7eb178a7f Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf137894.odt differ diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index a48adfa653cd..0d921ed6c7b6 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -1260,6 +1260,22 @@ DECLARE_RTFEXPORT_TEST(testTdf138210, "tdf138210.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); } +DECLARE_RTFEXPORT_TEST(testTdf137894, "tdf137894.odt") +{ +lang::Locale locale1(getProperty(getRun(getParagraph(1), 1), "CharLocaleAsian")); +CPPUNIT_ASSERT_EQUAL(OUString("ja"), locale1.Language); +CPPUNIT_ASSERT_EQUAL(OUString("MS UI Gothic"), + getProperty(getRun(getParagraph(1), 1), "CharFontNameAsian")); +CPPUNIT_ASSERT_EQUAL(20.f, getProperty(getRun(getParagraph(1), 1), "CharHeightAsian")); +CPPUNIT_ASSERT_EQUAL(OUString("Mangal"), + getProperty(getRun(getParagraph(1), 1), "CharFontNameComplex")); +CPPUNIT_ASSERT_EQUAL(20.f, getProperty(getRun(getParagraph(1), 1), "CharHeightComplex")); +lang::Locale locale2( +getProperty(getRun(getParagraph(2), 1), "CharLocaleComplex")); +CPPUNIT_ASSERT_EQUAL(OUString("he"), locale2.Language); +CPPUNIT_ASSERT_EQUAL(32.f, getProperty(getRun(getParagraph(2), 1), "CharHeightComplex")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 9e76b3d3fd48..23dc3af728e2 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -423,49 +423,58 @@ void RtfAttributeOutput::EndRunProperties(const SwRedlineData* /*pRedlineData*/) OString RtfAttributeOutput::MoveCharacterProperties(bool aAutoWriteRtlLtr) { -const OString aAssoc = m_aStylesAssoc.makeStringAndClear(); +const OString aAssocHich = m_aStylesAssocHich.makeStringAndClear(); +const OString aAssocDbch = m_aStylesAssocDbch.makeStringAndClear(); +const OString aAssocRtlch = m_aStylesAssocRtlch.makeStringAndClear(); +const OString aAssocLtrch = m_aStylesAssocLtrch.makeStringAndClear(); const OString aNormal = m_aStyles.makeStringAndClear(); OStringBuffer aBuf; if (aAutoWriteRtlLtr && !m_bControlLtrRtl) { -m_bControlLtrRtl = !aAssoc.isEmpty(); +m_bControlLtrRtl = !aAssocRtlch.isEmpty(); m_bIsRTL = false; m_nScript = i18n::ScriptType::LATIN; } -if (m_bControlLtrRtl) +if (m_bIsRTL) { -
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
sw/qa/core/undo/data/textbox-cut-undo.docx |binary sw/qa/core/undo/undo.cxx | 34 + sw/source/core/layout/atrfrm.cxx |2 + sw/source/core/undo/undobj1.cxx|7 + 4 files changed, 43 insertions(+) New commits: commit 67ff7910fc5b9799bcd1f6ed66dc537aa7bbf336 Author: Miklos Vajna AuthorDate: Mon Nov 23 21:02:44 2020 +0100 Commit: Miklos Vajna CommitDate: Tue Nov 24 11:12:25 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) Change-Id: I5761b72948caca397320aed801559e8493c33e1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106481 Tested-by: Jenkins Reviewed-by: Miklos Vajna 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/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 84076a24ced6..8755ee81235d 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -615,6 +615,8 @@ void SwFormatContent::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterWriteAttribute( pWriter, BAD_CAST("startNode"), BAD_CAST(OString::number(m_pStartNode->GetNode().GetIndex()).getStr())); +xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("startNodePtr"), "%p", + _pStartNode->GetNode()); } xmlTextWriterEndElement(pWriter); } diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 15801bca46e2..fb779e53d4f9 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -155,6 +155,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