[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/odfexport/data/tdf150149.fodt | 79 + sw/qa/extras/odfexport/odfexport.cxx | 10 +++ sw/source/core/layout/tabfrm.cxx | 11 +++- 3 files changed, 98 insertions(+), 2 deletions(-) New commits: commit 0f976c3b5608ec77dc3ad539e9a8d83b2e423a60 Author: László Németh AuthorDate: Fri Apr 14 11:07:47 2023 +0200 Commit: László Németh CommitDate: Tue Apr 18 11:42:04 2023 +0200 tdf#150149 sw: fix table header in multi-column sections Disabling long repeating table header on pages resulted lost table header within multi-column sections. To fix this, revert commit f7e071a00542c414a7e9d7bcf4434d908f225e59 for tables in sections. Regression from commit f7e071a00542c414a7e9d7bcf4434d908f225e59 "tdf#88496 DOCX: disable long repeating table header". Change-Id: Idb7b9ea014be5430a185489cf449463f534c1916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150393 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit a36fda0d7c70ffd344f9636ca436e77e41dc01f1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150325 Tested-by: László Németh diff --git a/sw/qa/extras/odfexport/data/tdf150149.fodt b/sw/qa/extras/odfexport/data/tdf150149.fodt new file mode 100644 index ..51aea046a218 --- /dev/null +++ b/sw/qa/extras/odfexport/data/tdf150149.fodt @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + A + + + B + + + C + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 87a7f93893cf..88a0d657f506 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -296,6 +296,16 @@ DECLARE_ODFEXPORT_TEST(testTdf125877, "tdf95806.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); } +CPPUNIT_TEST_FIXTURE(Test, testTdf150149) +{ +loadAndReload("tdf150149.fodt"); +CPPUNIT_ASSERT_EQUAL(1, getPages()); +xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); +// This was 0 (lost table header in multi-column section) +assertXPath(pXmlDoc, "//table:table-header-rows", 1); +assertXPath(pXmlDoc, "//table:table-header-rows/table:table-row/table:table-cell", 3); +} + DECLARE_ODFEXPORT_TEST(testTdf103567, "tdf103567.odt") { CPPUNIT_ASSERT_EQUAL(1, getShapes()); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 9b3816685560..8e3a1b5dc1d1 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1097,9 +1097,16 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK // First case: One of the repeated headline does not fit to the page anymore. // tdf#88496 Disable repeated headline (like for #i44910#) to avoid loops and // to fix interoperability problems (very long tables only with headline) +// tdf#150149 except in multi-column sections, where it's possible to enlarge +// the height of the section frame instead of using this fallback OSL_ENSURE( !GetIndPrev(), "Table is supposed to be at beginning" ); -m_pTable->SetRowsToRepeat(0); -return false; +if ( !IsInSct() ) +{ +m_pTable->SetRowsToRepeat(0); +return false; +} +else +bKeepNextRow = true; } else if ( !GetIndPrev() && nRepeat == nRowCount ) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter6.cxx | 52 +++ sw/source/uibase/dochdl/swdtflvr.cxx |8 - 2 files changed, 59 insertions(+), 1 deletion(-) New commits: commit 6e6398764945045876176262f54dac6785890385 Author: László Németh AuthorDate: Fri Apr 7 18:26:04 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Apr 10 18:52:20 2023 +0200 tdf#154599 sw: fix crash at drag & drop table columns New code path for (tracked) row deletion resulted broken column deletion, by deleting more columns at their drag & drop, than needed. Regression from commit 5e8aa259e48d5602b932353bb146ebb523982cf2 "tdf#146967 sw table: fix freezing in Hide Changes mode". Change-Id: Ib649f5b534a588d192d27757e30c8f81087beb0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150132 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 491e84eb7c6d92c44ab7fa62912452f7789bb8c8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150146 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index 1e1b31ac7ed8..f12f8b57e087 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -899,6 +900,57 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf147181_TrackedMovingOfMultipleTable CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable2b->getRows()->getCount()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf154599_MovingColumn) +{ +//create new writer document +SwDoc* pDoc = createSwDoc(); +CPPUNIT_ASSERT(pDoc); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +CPPUNIT_ASSERT(pWrtShell); + +// Create a table with less columns, than row +SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0); +(void)>InsertTable(TableOpt, 4, 3); + +uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xTables(xTablesSupplier->getTextTables(), +uno::UNO_QUERY); +uno::Reference xTableNames = xTablesSupplier->getTextTables(); +CPPUNIT_ASSERT(xTableNames->hasByName("Table1")); +uno::Reference xTable1(xTableNames->getByName("Table1"), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable1->getRows()->getCount()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable1->getColumns()->getCount()); + +// without redlining +CPPUNIT_ASSERT_MESSAGE("redlining should be off", + !pDoc->getIDocumentRedlineAccess().IsRedlineOn()); + +// Move first column of the table before the third column by drag & drop + +SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); +SwFrame* pPage = pLayout->Lower(); +SwFrame* pBody = pPage->GetLower(); +SwFrame* pTable = pBody->GetLower(); +SwFrame* pRow1 = pTable->GetLower(); +SwFrame* pCellA1 = pRow1->GetLower(); +SwFrame* pCellC1 = pCellA1->GetNext()->GetNext(); +const SwRect& rCellA1Rect = pCellA1->getFrameArea(); +const SwRect& rCellC1Rect = pCellC1->getFrameArea(); +Point ptTo(rCellC1Rect.Left() + rCellC1Rect.Width() / 2, + rCellC1Rect.Top() + rCellC1Rect.Height() / 2); +// select first table column by using the middle point of the top border of column A +Point ptColumn(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() - 5); +pWrtShell->SelectTableRowCol(ptColumn); + +// This crashed here before the fix. +rtl::Reference xTransfer = new SwTransferable(*pWrtShell); + +xTransfer->PrivateDrop(*pWrtShell, ptTo, /*bMove=*/true, /*bXSelection=*/true); + +CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable1->getRows()->getCount()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable1->getColumns()->getCount()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115132) { SwDoc* pDoc = createSwDoc(); diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index dd9fc88fbe57..372019273ccd 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -4092,13 +4092,19 @@ bool SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, } } -// delete rows without track changes +// delete original rows/columns, except in track changes mode +// TODO remove all the columns, not only the first one if ( !bNeedTrack ) { for (sal_Int32 nDeleted = 0; nDeleted < nSelRows; ++nDeleted) +{ pDispatch->Execute(bTableCol ? FN_TABLE_DELETE_COL : FN_TABLE_DELETE_ROW, SfxCallMode::SYNCHRON); + +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf147892.fodt | 25 ++ sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 10 + sw/source/filter/ww8/docxattributeoutput.cxx | 30 ++- sw/source/filter/ww8/docxattributeoutput.hxx |4 +-- 4 files changed, 53 insertions(+), 16 deletions(-) New commits: commit 4c05f5b45ce8449adee81aeac355fae652b97786 Author: László Németh AuthorDate: Fri Feb 10 13:43:40 2023 +0100 Commit: László Németh CommitDate: Thu Mar 30 13:37:18 2023 + tdf#147892 DOCX: fix corrupt export at para marker revision history OOXML export of tracked deletion of tracked paragraph insertion resulted invalid document.xml, because change tracking history of paragraph markers isn't supported by OOXML. Export the tracked deletion of the last run of paragraphs without history (tracked insertion). This way w:p/w:pPr/w:rPr contains only w:del or w:ins, not both of them (with broken tag order). Note: it's possible to optimize the fix to keep the change tracking history of the characters of the last run of the paragraph, except the paragraph marker. Regression from commit 19b3fcf8b0374c361c7f6c285fd5c89b5a2f "tdf#142387 DOCX track changes: export w:del in w:ins". Minimal unit test document was created by Miklós Vajna. Change-Id: I425f4d63c8c6ac29ccd807c1574748c7b9b39e80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146782 Tested-by: László Németh Reviewed-by: László Németh (cherry-picked from commit 382892341a63e400f221e1a533fd5a5d6b4d9d70) Conflicts: sw/source/filter/ww8/docxattributeoutput.cxx Change-Id: I0e29195512d8786ac5f6a145ed88a9261f1c456e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149763 Reviewed-by: Stéphane Guillou Tested-by: Jenkins Reviewed-by: László Németh Tested-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf147892.fodt b/sw/qa/extras/ooxmlexport/data/tdf147892.fodt new file mode 100644 index ..bb3ffc324dc1 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf147892.fodt @@ -0,0 +1,25 @@ + +http://purl.org/dc/elements/1.1/; xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + Bob + 2023-01-02T00:00:00 + + + + + Alice + 2023-01-01T00:00:00 + + + + + + + + + diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index f831fd3ad61e..25a9932101ee 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -2023,6 +2023,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf142387) assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:ins/w:del/w:r/w:delText", "inserts "); } +CPPUNIT_TEST_FIXTURE(Test, testTdf147892) +{ +loadAndSave("tdf147892.fodt"); +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); +// w:del in w:ins is exported correctly +// (both w:del and w:ins were exported for para marker) +assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:del", 1); +assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:ins", 0); +} + DECLARE_OOXMLEXPORT_TEST(testTdf123054, "tdf123054.docx") { CPPUNIT_ASSERT_EQUAL(OUString("No Spacing"), diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 70c21933ebdd..b3866fbeca4d 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1466,13 +1466,13 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar if ( pRedlineParagraphMarkerDeleted ) { -StartRedline( pRedlineParagraphMarkerDeleted ); -EndRedline( pRedlineParagraphMarkerDeleted ); +StartRedline( pRedlineParagraphMarkerDeleted, /*bLastRun=*/true ); +EndRedline( pRedlineParagraphMarkerDeleted, /*bLastRun=*/true ); } if ( pRedlineParagraphMarkerInserted ) { -StartRedline( pRedlineParagraphMarkerInserted ); -EndRedline( pRedlineParagraphMarkerInserted ); +StartRedline( pRedlineParagraphMarkerInserted, /*bLastRun=*/true ); +EndRedline( pRedlineParagraphMarkerInserted, /*bLastRun=*/true ); } // mergeTopMarks() after paragraph mark properties child elements. @@ -1575,7 +1575,7 @@ void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData, sal_Int32 m_pSerializer->mark(Tag_StartRun_3); // let's call it "postponed text" } -void DocxAttributeOutput::EndRun(const SwTextNode* pNode, sal_Int32 nPos, bool /*bLastRun*/) +void DocxAttributeOutput::EndRun(const
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf153819.fodt | 174 ++ sw/qa/extras/uiwriter/uiwriter7.cxx | 18 +++ sw/source/core/docnode/ndtbl.cxx |7 - 3 files changed, 197 insertions(+), 2 deletions(-) New commits: commit fde4c9c8dfdcde2f2c60e746ebc881851e270967 Author: László Németh AuthorDate: Mon Mar 6 14:02:02 2023 +0100 Commit: Xisco Fauli CommitDate: Mon Mar 13 11:35:51 2023 + tdf#153819 sw: fix crashing MakeFramesForAdjacentContentNode() In Hide Changes mode, copying cells before a tracked deleted table crashed in SwTableNode::MakeFramesForAdjacentContentNode(). Regression from commit 794fd10af7361d5a64a0f8bfbe5c8b5f308617a5 "tdf#147347 sw: hide deleted table at deletion in Hide Changes". Change-Id: I3ac070d35006e61b01a065359431e302e6974e17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148344 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 317ed3e81a5aa7826176a5122c2d8ea76aa0fb37) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148323 Tested-by: László Németh Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148640 diff --git a/sw/qa/extras/uiwriter/data/tdf153819.fodt b/sw/qa/extras/uiwriter/data/tdf153819.fodt new file mode 100644 index ..910807825204 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf153819.fodt @@ -0,0 +1,174 @@ + + +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:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer; xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:oooc="http://openoffice.org/2004/calc; xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext: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:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office; xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns: meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + 2023-03-06T12:23:04.8519275222023-03-06T12:26:09.438416733PT1M28S2LibreOfficeDev/7.6.0.0.alpha0$Linux_X86_64 LibreOffice_project/e29c2b96b1aaba0fef5c83de7be18448e5903d08 + + + false + + + + + http://openoffice.org/2004/office; xmlns:xlink="http://www.w3.org/1999/xlink"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Unknown Author + 2023-03-06T12:26:07 + + + + + + + + + + + + + + + + x + + + + + + + + + + + + + + + + diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index 0ac6b0183068..833a35f97e61 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -147,6 +147,24 @@
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/uitest/data/tdf132714.odt |binary sw/qa/uitest/writer_tests7/tdf132714.py | 23 +++ sw/source/core/unocore/unochart.cxx |6 ++ 3 files changed, 29 insertions(+) New commits: commit 6c81e52f26f8bad39c741083fad6f21126ace53c Author: László Németh AuthorDate: Fri Feb 17 16:23:12 2023 +0100 Commit: Xisco Fauli CommitDate: Wed Feb 22 08:26:36 2023 + tdf#132714 sw: fix crash at table row deletion associated to a chart Using the table toolbar, deletion of the row of a text table resulted crashing in ActualizeSelection(), if the text table is associated to a chart, and the deleted row was the first data row of the chart. Fix this by emptying the outdated table selection cache m_SelectedBoxes in GetCellRangeName(). Note: since commit eea37aa26932d06ed8e93d001862bf45175c4446 "tdf#122995 Trigger Chart refresh directly in UpdateCharts for SW", the crash occurred immediately, i.e. without double clicking on the chart after the row deletion. Note: uitest needed to get the crash, not uiwriter. Change-Id: I78d126f245839ec1d8a8cc01257fe96d94ac0a21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147224 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 5b9855acc7fa6d1e4a5f53ff0bc47e1dd4729827) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147251 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/uitest/data/tdf132714.odt b/sw/qa/uitest/data/tdf132714.odt new file mode 100644 index ..e1a4a2c5ad51 Binary files /dev/null and b/sw/qa/uitest/data/tdf132714.odt differ diff --git a/sw/qa/uitest/writer_tests7/tdf132714.py b/sw/qa/uitest/writer_tests7/tdf132714.py new file mode 100644 index ..971db5f97ad3 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf132714.py @@ -0,0 +1,23 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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_url_for_data_file + +class tdf132714(UITestCase): +def test_tdf132714(self): +with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document: + +# delete second row (first data row) in the associated text table of the chart +self.xUITest.executeCommand(".uno:GoDown") +self.xUITest.executeCommand(".uno:GoDown") +self.xUITest.executeCommand(".uno:GoDown") +# Without the fix in place, at this point crash occurs. +self.xUITest.executeCommand(".uno:DeleteRows") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index c8c282c1d50d..89352f4af0d0 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -205,6 +205,12 @@ static OUString GetCellRangeName( const SwFrameFormat , SwUnoCursor SwUnoTableCursor* pUnoTableCursor = dynamic_cast(); if (!pUnoTableCursor) return OUString(); + +// tdf#132714 empty outdated selection cache to avoid crashing in ActualizeSelection() +size_t nCount = pUnoTableCursor->GetSelectedBoxesCount(); +while (nCount--) +pUnoTableCursor->DeleteBox(nCount); + pUnoTableCursor->MakeBoxSels(); const SwStartNode* pStart;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/uitest/writer_tests7/tdf152964.py | 50 sw/source/core/docnode/ndtbl1.cxx |1 2 files changed, 51 insertions(+) New commits: commit eff6ea0c53cfb310413db24edcaeca59b86d4fe1 Author: László Németh AuthorDate: Wed Jan 18 12:26:11 2023 +0100 Commit: Xisco Fauli CommitDate: Mon Feb 13 11:59:46 2023 + tdf#152964 sw: fix crash of Undo of tracked deletion of empty table rows In Hide Changes mode, Undo of insertion of CH_TXT_TRACKED_DUMMY_CHAR (workaround of the deletion of empty table rows), resulted a crash because of inconsistency of table and redline nodes. As a workaround, skip that insertion from the Undo. Regression from commit a74c51025fa4519caaf461492e4ed8e68bd34885 "tdf#146962 sw: hide deleted row at deletion in Hide Changes". Change-Id: I0666d7bcbbf08d84386cea64c1807f69f751479d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145737 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 4e72e646255624eda698da750383a5725e8f6c4c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145718 Reviewed-by: Christian Lohmaier (cherry picked from commit 6d47b8a09f51357851cdfa752f231ed10328b8f2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146754 Reviewed-by: Xisco Fauli diff --git a/sw/qa/uitest/writer_tests7/tdf152964.py b/sw/qa/uitest/writer_tests7/tdf152964.py new file mode 100644 index ..abbf25434668 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf152964.py @@ -0,0 +1,50 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 +from uitest.uihelper.common import select_pos + +# Bug 152964 - Undo of tracked deletion of an empty table row crashed Writer + + +class tdf152964(UITestCase): +def test_tdf152964(self): +with self.ui_test.create_doc_in_start_center("writer"): + +# redlining should be on +self.xUITest.executeCommand(".uno:TrackChanges") +# hide changes +self.xUITest.executeCommand(".uno:ShowTrackedChanges") + +# insert a table +xWriterDoc = self.xUITest.getTopFocusWindow() +xWriterEdit = xWriterDoc.getChild("writer_edit") +xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) +with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog: +formatlbinstable = xDialog.getChild("formatlbinstable") +entry = formatlbinstable.getChild("1") +entry.executeAction("SELECT", tuple()) + +# delete its second and first rows +self.xUITest.executeCommand(".uno:GoDown") +self.xUITest.executeCommand(".uno:DeleteRows") +self.xUITest.executeCommand(".uno:DeleteRows") + +# This crashed Writer +self.xUITest.executeCommand(".uno:Undo") + +# test other Undos and Redos +self.xUITest.executeCommand(".uno:Undo") +self.xUITest.executeCommand(".uno:Undo") +self.xUITest.executeCommand(".uno:Redo") +self.xUITest.executeCommand(".uno:Redo") +self.xUITest.executeCommand(".uno:Redo") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 678861ca08e1..fb1b59a400a6 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -640,6 +640,7 @@ void SwDoc::SetRowNotTracked( const SwCursor& rCursor, // new redline can cause a problem) if ( bInsertDummy && (pLn->IsEmpty() || bDeletionOfOwnRowInsertion ) ) { +::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); SwNodeIndex aInsPos( *(pLn->GetTabBoxes()[0]->GetSttNd()), 1 ); RedlineFlags eOld = getIDocumentRedlineAccess().GetRedlineFlags(); getIDocumentRedlineAccess().SetRedlineFlags_intern(RedlineFlags::NONE);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
dev/null |binary sw/qa/extras/ww8export/ww8export4.cxx | 11 --- sw/source/filter/ww8/ww8par.cxx |1 - 3 files changed, 12 deletions(-) New commits: commit 2fb1994addaa26bb11a0e698346b94089066dbb7 Author: Justin Luth AuthorDate: Wed Feb 8 11:55:42 2023 -0500 Commit: Xisco Fauli CommitDate: Fri Feb 10 14:03:52 2023 + Revert "tdf#148360 doc import: add NO_NUMBERING_SHOW_FOLLOWBY(true)" This reverts commit 2405a36f3bcd43f80371ccaed47f7523ff0d8757 which was backported to 7.4.1. This solves the regression report for DOC in tdf#153042. The problem is that the tab-without-numbering is displaying in cases where it shouldn't (i.e. when the tabstop position matches the first line indent). Although the patch itself is fine (DOC should do the same thing as DOCX) the feature is incomplete, even for DOCX/RTF. So just remove DOC from this mix - especially since there seem to be a LOT more instances of DOC files that need the incomplete aspect. Once it is proven to work OK for DOCX, we can add DOC back in. Change-Id: I3c550fc2ca29cf1490ec0a5e3979a6acbd102385 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146670 Tested-by: Justin Luth Reviewed-by: Justin Luth (cherry picked from commit 7b3e0639962bab6e757381ad2b3e4868c61ed3b7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146625 Tested-by: Jenkins Reviewed-by: Xisco Fauli Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146752 diff --git a/sw/qa/extras/ww8export/data/tdf148360.doc b/sw/qa/extras/ww8export/data/tdf148360.doc deleted file mode 100644 index 3969a560999f.. Binary files a/sw/qa/extras/ww8export/data/tdf148360.doc and /dev/null differ diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index bc0d51ff529e..7a19938caa10 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -38,17 +38,6 @@ public: } }; -CPPUNIT_TEST_FIXTURE(Test, testTdf148360) -{ -loadAndReload("tdf148360.doc"); -const auto& pLayout = parseLayoutDump(); - -// Ensure first element is a tab -assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::TabLeft"); -// and only then goes content -assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[2]", "nType", "PortionType::Text"); -} - CPPUNIT_TEST_FIXTURE(Test, testTdf77964) { loadAndReload("tdf77964.doc"); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index a48893e8cc7a..12d05bf9d102 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1888,7 +1888,6 @@ void SwWW8ImplReader::ImportDop() m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::SURROUND_TEXT_WRAP_SMALL, true); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE, true); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::CONTINUOUS_ENDNOTES, true); - m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY, true); // COMPATIBILITY FLAGS END
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/uitest/data/tdf146248.docx |binary sw/qa/uitest/writer_tests4/insertPageHeader.py | 14 ++ sw/source/core/unocore/unoobj2.cxx |3 +++ 3 files changed, 17 insertions(+) New commits: commit d1ddaa59ad34f1f5f6fcd46ad63cc432e0d01b52 Author: László Németh AuthorDate: Mon Jan 9 15:07:27 2023 +0100 Commit: Xisco Fauli CommitDate: Thu Jan 26 13:19:24 2023 + tdf#146248 sw: fix crash at Undo of hiding page header/footer When Same content on first page is enabled, Undo could result crashing after hiding header/footer with its local menu. Note: the problem could occur in DOCX more frequently, because of special handling of its header/footer, see commit f5dc6b11d2218d94c9effe7a1ab418d0133da5e3 "tdf#140117 sw UI: keep headers/footers when inactive". Manual test: load the unit test document, delete the header with its blue local menu (not with the Page Style dialog window!), and press Undo. (The Python UITest does the same, but with dispatcher calls). Regression from commit 65e52cb61d74b0c71b45b63b2da131bc6b621104 "tdf#141613 sw: fix crash at header/footer undo". Change-Id: If89d5af2e0d123d6913dfc6a4bea1ddbaf3bd80b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145244 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit cec3c719303decd3b811a328fabd71d8c4e5ba3b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145300 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit c617aafc370209b8807ba6e0eba2762595595a0f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146092 Reviewed-by: Xisco Fauli diff --git a/sw/qa/uitest/data/tdf146248.docx b/sw/qa/uitest/data/tdf146248.docx new file mode 100644 index ..2b5ed2959f94 Binary files /dev/null and b/sw/qa/uitest/data/tdf146248.docx differ diff --git a/sw/qa/uitest/writer_tests4/insertPageHeader.py b/sw/qa/uitest/writer_tests4/insertPageHeader.py index b18efd74241a..9da58db9a2b2 100644 --- a/sw/qa/uitest/writer_tests4/insertPageHeader.py +++ b/sw/qa/uitest/writer_tests4/insertPageHeader.py @@ -8,6 +8,7 @@ # from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file class WriterInsertPageHeader(UITestCase): @@ -61,4 +62,17 @@ class WriterInsertPageHeader(UITestCase): self.delete_header() +def test_tdf146248(self): +with self.ui_test.load_file(get_url_for_data_file("tdf146248.docx")): + +self.delete_header() + +# crashed before +self.xUITest.executeCommand(".uno:Undo") + +document = self.ui_test.get_component() +self.assertEqual( +document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) + + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 1bfe4fae6ae3..ddf4cca6961c 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1195,6 +1195,9 @@ lcl_IsStartNodeInFormat(const bool bHeader, SwStartNode const *const pSttNode, if (pHeadFootFormat) { const SwFormatContent& rFlyContent = pHeadFootFormat->GetContent(); +// tdf#146248 avoid Undo crash at shared first page +if ( !rFlyContent.GetContentIdx() ) +return false; const SwNode& rNode = rFlyContent.GetContentIdx()->GetNode(); SwStartNode const*const pCurSttNode = rNode.FindSttNodeByType( bHeader ? SwHeaderStartNode : SwFooterStartNode);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/core/text/data/number-portion-format.odt |binary sw/qa/core/text/data/number-portion-noformat.docx |binary sw/qa/core/text/text.cxx| 18 ++ sw/qa/extras/ooxmlexport/data/number-portion-format.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |6 sw/source/core/text/txtfld.cxx | 10 sw/source/core/unocore/unoportenum.cxx | 20 sw/source/filter/ww8/docxattributeoutput.cxx|2 - sw/source/filter/ww8/wrtw8nds.cxx | 15 +--- 9 files changed, 52 insertions(+), 19 deletions(-) New commits: commit 585d440df98ff3b967c191908ac2d4b2f7e29326 Author: Miklos Vajna AuthorDate: Fri Dec 16 10:31:03 2022 +0100 Commit: Mike Kaganski CommitDate: Wed Dec 21 14:24:39 2022 + sw, numbering portion format: ignore char formats covering the entire paragraph The bugdoc has a single paragraph, where the numbering portion is bold in Writer but not in Word. The reason for this appears to be that Writer considers text node hints for the formatting of the numbering portion where the hint covers the entire paragraph, but Word doesn't do this. This behavior was added in commits cb0e1b52d68aa6d5b505f91cb4ce577f7f3b2a8f (sw, numbering portion format: consider full-para char formats as well, 2022-10-20) and DOCX export was also adjusted in commit f546f7573158e52359bbeae6194a83a1ff8ac52c (DOCX export, numbering portion format: consider full-para char formats as well, 2022-10-28). Fix the problem by partially reverting the above two commits and instead only consider hints that both start and end at the paragraph end. The revert of the first commit fixes the new bugdoc (its numbering portion is no longer bold) and the old bugdoc keeps working if the sw UNO API's text portion enumeration is extended to expose such empty autoformats at paragraph end. Related testcases: - CppunitTest_sw_ooxmlexport13's testTdf123460 explicitly tested that we don't expose the paragraph marker's formatting on the UNO API. - CppunitTest_sw_core_text's testNumberPortionFormat now uses the new ODT markup for these explicit paragraph marker char props (empty text span at para end). - CppunitTest_sw_uiwriter2's testTdfChangeNumberingListAutoFormat failed when only the above first commit (layout) was reverted, so revert the matching DOCX export commit as well, which is also good for consistency. - CppunitTest_sw_ooxmlexport18's testNumberPortionFormatFromODT also used the old ODT markup, updated. (cherry picked from commit 99ed51bcad4008a4006dcec24aa33fd7f757a433) Change-Id: Iee8acf72dabcd10b3f4d3d68b83ed248bf50c324 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144674 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/core/text/data/number-portion-format.odt b/sw/qa/core/text/data/number-portion-format.odt index 3047153b63af..19b23ae84420 100644 Binary files a/sw/qa/core/text/data/number-portion-format.odt and b/sw/qa/core/text/data/number-portion-format.odt differ diff --git a/sw/qa/core/text/data/number-portion-noformat.docx b/sw/qa/core/text/data/number-portion-noformat.docx new file mode 100644 index ..b289b9c69ef4 Binary files /dev/null and b/sw/qa/core/text/data/number-portion-noformat.docx differ diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 5ba260bf9073..eaf5cce312ff 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -573,6 +573,24 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testNumberPortionFormat) assertXPath(pXmlDoc, "//Special[@nType='PortionType::Number']", "nHeight", "480"); } +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testNumberPortionNoformat) +{ +// Given a document with a numbering and a single paragraph, the entire run is red: +createSwDoc(DATA_DIRECTORY, "number-portion-noformat.docx"); + +// When laying out that document: +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + +// Then make sure that just because the entire run is red, the numbering portion is not red: +// Without the accompanying fix in place, this test would have failed with: +// - Expected: (COL_AUTO) +// - Actual : 00ff (COL_LIGHTRED) +// i.e. the run color affected the color of the number portion in Writer, but not in Word. +CPPUNIT_ASSERT_EQUAL( +OUString(""), +getXPath(pXmlDoc, "//Special[@nType='PortionType::Number']/SwFont", "color")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlexport/data/number-portion-format.odt b/sw/qa/extras/ooxmlexport/data/number-portion-format.odt index 3047153b63af..66f3b175b50a 100644 Binary files
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/layout/data/tdf152031-stair.odt|binary sw/qa/extras/layout/data/tdf152085-section-tblr.odt |binary sw/qa/extras/layout/layout2.cxx | 36 ++ sw/source/core/layout/calcmove.cxx | 49 +--- 4 files changed, 59 insertions(+), 26 deletions(-) New commits: commit 65cbb9c52301c784dd4e185967cec140bb8fcd50 Author: Mark Hung AuthorDate: Sat Nov 26 11:37:31 2022 +0800 Commit: Michael Stahl CommitDate: Wed Dec 21 10:50:37 2022 + tdf#152031,tdf#152085 minimize impact to table layout. Revert two commits[1][2] that are related to fixing tdf#135991 ( but keep the unit tests) and rework the solution. Cases related to IsNeighborFrame() imply either IsCellFrame() ( a table cell ), or IsColumnFrame() ( a column inside a section ). Original patch[2] affected both of tables and sections. Try to limit the affected case to the section so it does not affect table layout for tdf#152031. [1] 1bf82b26aea3a403920a64cdfcb4671c947c7a01 Author: Mark Hung Date: Fri Sep 9 16:09:47 2022 +0800 tdf#150642 fix table layout with vertical writing. [2] 1e21902106cbe57658bed03ed24d4d0863685cfd Author: Mark Hung Date: Sun Aug 14 15:23:14 2022 +0800 tdf#135991 fix unexpected hidden RTL sections. Change-Id: If50e2b50b47352dad8eafebd6cce0af0530abefa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143317 Tested-by: Jenkins Reviewed-by: Mark Hung (cherry picked from commit ae6e57d99cfdeac69cc42cd82904c24edc866310) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144180 Reviewed-by: Xisco Fauli (cherry picked from commit 6a4bedc761bba6c1d1cb44d9e36c5d12bc8719f7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144430 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/layout/data/tdf152031-stair.odt b/sw/qa/extras/layout/data/tdf152031-stair.odt new file mode 100644 index ..5171920e3496 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf152031-stair.odt differ diff --git a/sw/qa/extras/layout/data/tdf152085-section-tblr.odt b/sw/qa/extras/layout/data/tdf152085-section-tblr.odt new file mode 100644 index ..3b454edc9b41 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf152085-section-tblr.odt differ diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 1e0ec0eb97bd..d02072038d12 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -2199,6 +2200,41 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150642) assertXPath(pDump, "//bounds[@right<0]", 0); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf152085) +{ +createSwDoc(DATA_DIRECTORY, "tdf152085-section-tblr.odt"); +auto pDump = parseLayoutDump(); +sal_Int32 nSectionHeight += getXPath(pDump, "//section/infos/bounds", "bottom").toInt32(); // was 8391 +sal_Int32 nColumnHeight += getXPath(pDump, "(//column/infos/bounds)[2]", "bottom").toInt32(); // was 16216 +CPPUNIT_ASSERT_MESSAGE("The column in a TBRL page should be shorter than the section.", + nColumnHeight <= nSectionHeight); +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf152031) +{ +createSwDoc(DATA_DIRECTORY, "tdf152031-stair.odt"); + +// reproduce the bug by shrinking the table width. +uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xTables(xTablesSupplier->getTextTables(), +uno::UNO_QUERY); +uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); +// Shrink table width from 5" to 4" +sal_Int32 nWidth = getProperty(xTable, "Width") * 4 / 5; + +uno::Reference xSet(xTable, uno::UNO_QUERY); +xSet->setPropertyValue("Width", uno::Any(nWidth)); + +auto pDump = parseLayoutDump(); +// There was a stair effect after change the table size. +sal_Int32 nLeft_Row1 = getXPath(pDump, "(//row/infos/bounds)[1]", "left").toInt32(); +sal_Int32 nLeft_Row2 = getXPath(pDump, "(//row/infos/bounds)[2]", "left").toInt32(); +CPPUNIT_ASSERT_EQUAL_MESSAGE("left values of SwRowFrames should be consistent.", nLeft_Row1, + nLeft_Row2); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 4894c8524cf3..c9d5622ba02d 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -949,7 +949,7 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) const SwLayNotify aNotify( this ); bool bVert = IsVertical(); -SwRectFn fnRect = bVert ? ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T :
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/filter/ww8/ww8.cxx | 28 +++ sw/source/filter/ww8/docxattributeoutput.cxx | 11 +++--- 2 files changed, 36 insertions(+), 3 deletions(-) New commits: commit e77e25e6ac8d4fafa83cf4d1ebeb53fd719c834c Author: Miklos Vajna AuthorDate: Mon Nov 21 20:05:11 2022 +0100 Commit: Xisco Fauli CommitDate: Wed Dec 14 18:35:31 2022 + tdf#152045 DOCX export: fix empty display text for content control list items Regression from commit f726fbc2699b05199a8dec3055710a7131e0aad6 (tdf#151261 DOCX import: fix dropdown SDT when the item display text is missing, 2022-10-10), the problem was that the correct way to represent "no display value" is not an attribute with empty value but a missing attribute. Change-Id: I25b2bb56f43d1ca1bf95d1c59b208cb24530 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143048 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 017c38a9702da0566ac1ce5d758444e5ff25df9d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143257 Reviewed-by: Xisco Fauli diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx index ab9e456be695..9268a9943305 100644 --- a/sw/qa/filter/ww8/ww8.cxx +++ b/sw/qa/filter/ww8/ww8.cxx @@ -10,6 +10,10 @@ #include #include +#include +#include +#include +#include namespace { @@ -81,6 +85,30 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxHyperlinkShape) // assertion failure for not-well-formed XML output): save("Office Open XML Text", maTempFile); } + +CPPUNIT_TEST_FIXTURE(Test, testDocxContentControlDropdownEmptyDisplayText) +{ +// Given a document with a dropdown content control, the only list item has no display text +// (only a value): +mxComponent = loadFromDesktop("private:factory/swriter"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); +SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); + +// When saving to DOCX: +save("Office Open XML Text", maTempFile); +mbExported = true; + +// Then make sure that no display text attribute is written: +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); +CPPUNIT_ASSERT(pXmlDoc); +// Without the accompanying fix in place, this test would have failed with: +// - XPath '//w:sdt/w:sdtPr/w:dropDownList/w:listItem' unexpected 'displayText' attribute +// i.e. we wrote an empty attribute instead of omitting it. +assertXPathNoAttribute(pXmlDoc, "//w:sdt/w:sdtPr/w:dropDownList/w:listItem", "displayText"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index e03dd478bb76..206e0cde6478 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2396,9 +2396,14 @@ void DocxAttributeOutput::WriteContentControlStart() m_pSerializer->startElementNS(XML_w, XML_dropDownList); for (const auto& rItem : m_pContentControl->GetListItems()) { -m_pSerializer->singleElementNS(XML_w, XML_listItem, -FSNS(XML_w, XML_displayText), rItem.m_aDisplayText, -FSNS(XML_w, XML_value), rItem.m_aValue); +rtl::Reference xAttributes = FastSerializerHelper::createAttrList(); +if (!rItem.m_aDisplayText.isEmpty()) +{ +// If there is no display text, need to omit the attribute, not write an empty one. +xAttributes->add(FSNS(XML_w, XML_displayText), rItem.m_aDisplayText); +} +xAttributes->add(FSNS(XML_w, XML_value), rItem.m_aValue); +m_pSerializer->singleElementNS(XML_w, XML_listItem, xAttributes); } m_pSerializer->endElementNS(XML_w, XML_dropDownList); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/uitest/writer_tests2/deleteFootnotes.py | 46 ++ sw/source/core/crsr/swcrsr.cxx|6 ++- 2 files changed, 51 insertions(+), 1 deletion(-) New commits: commit 02fdf3bb9afef1faee9aaf9f6b437144489f8d31 Author: Hossein AuthorDate: Wed Aug 24 23:03:09 2022 +0200 Commit: Michael Stahl CommitDate: Tue Dec 13 10:35:33 2022 + tdf#150457 Fix crash on hovering removed footnote reference The regression was caused by 402f36efb215338ad545caa65d39fb8a39685ea1. Before that, 0aa0fda64057647219954480ac1bab86b0f0e433 changed the cursor jumping behavior to fix tdf#81226. The goal was to make LibreOffice behave as described in the description of the issue: "When your cursor is on the last line but not at the end of it, simply press the down arrow to go at the end of the file (end of that line)." The same behavior was achieved for pressing down on the last line. The above patches allowed removing the footnotes and their numbers (except the first number) while the reference were still present. Then, on hovering a removed footnote reference, a crash was happening. It should be noted that even with this patch, removing the first reference number was not possible. This fix limits this behavior to anywhere other than inside a footnote. In this way, it prevents crashing. With this fix, the behavior of the cursor goes back to what it was before 0aa0fda64057647219954480ac1bab86b0f0e433. The user will not be able to select all the footnotes at once. Also, removing footnote number will not be possible. It is worth noting that not being able to select all the footnotes at once prevents the user from changing the characteristics of the footnotes all at the same time. Also, not being able to remove the footnote numbers, prevents the user from having footnotes with custom numbers written manually. Both of these actions are possible in MS Word. The other difference is that by going up, one can go out of the footnote section in MS Word, but this is not the case for LibreOffice. A UI test is added to make sure the crash will not happen again. The test can be run by: cd sw && make -srj1 UITest_writer_tests2 \ UITEST_TEST_NAME="deleteFootnotes.tdf150457.test_delete_footnotes" \ SAL_USE_VCLPLUGIN=gen Change-Id: I1ce7d2189355f6763b6f31219e00516ff7a8164e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138562 Tested-by: Jenkins Reviewed-by: Hossein (cherry picked from commit d05c176cc022f1b771f7c064f6ce74e9f8c27a1b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139423 Reviewed-by: Michael Stahl diff --git a/sw/qa/uitest/writer_tests2/deleteFootnotes.py b/sw/qa/uitest/writer_tests2/deleteFootnotes.py new file mode 100644 index ..162cc7d3e1b2 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/deleteFootnotes.py @@ -0,0 +1,46 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 type_text +from libreoffice.uno.propertyvalue import mkPropertyValues +import time + + +class tdf150457(UITestCase): + + def test_delete_footnotes(self): +with self.ui_test.create_doc_in_start_center("writer") as document: +xWriterDoc = self.xUITest.getTopFocusWindow() +xWriterEdit = xWriterDoc.getChild("writer_edit") + +type_text(xWriterEdit, "a") +self.xUITest.executeCommand(".uno:InsertFootnote") +type_text(xWriterEdit, "abc") +self.assertEqual(document.Footnotes[0].String, "abc") +self.assertEqual(document.Footnotes.getCount(), 1) + +xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "PAGEUP"})) +xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) +type_text(xWriterEdit, "d") + +self.xUITest.executeCommand(".uno:InsertFootnote") +type_text(xWriterEdit, "def") +self.assertEqual(document.Footnotes[1].String, "def") +self.assertEqual(document.Footnotes.getCount(), 2) + +xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) +xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"})) +xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+DOWN"})) +xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) +xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "PAGEUP"})) +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/layout/data/tdf152106.odt |binary sw/qa/extras/layout/layout.cxx | 11 +++ sw/source/core/layout/fly.cxx |8 3 files changed, 19 insertions(+) New commits: commit 9300c36361426e724b28c25a7729543b316b258b Author: László Németh AuthorDate: Fri Nov 18 14:11:30 2022 +0100 Commit: László Németh CommitDate: Tue Nov 22 08:23:36 2022 +0100 tdf#152106 sw layout: fix freezing of multicol sections with flys Loading documents with multicol sections with flys could freeze Writer. Add loop control for multicol sections to fix it. Regression from commit 8feac9601cfe35ee0966776bab15d122206f154e "tdf#138518 sw: layout: avoid moving flys forward prematurely". Follow-up to ed12269c42f75f553bb8a8770923406f7824e473 "tdf#142080 sw: layout: fix infinite loop in CalcContent()". Change-Id: I06eb3f5a26b2d2ac3999b98a9661112b8bf7738f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142950 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 6f0736c2981042f90e83cdd71b3f9c91dbe77661) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142922 diff --git a/sw/qa/extras/layout/data/tdf152106.odt b/sw/qa/extras/layout/data/tdf152106.odt new file mode 100644 index ..49ef5e50b8bd Binary files /dev/null and b/sw/qa/extras/layout/data/tdf152106.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 431bd5a2cca2..9747fd022e30 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -1990,6 +1990,17 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf142080) "top", OUString::number(nPage9Top + 1460)); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf152106) +{ +// this caused an infinite loop +load(DATA_DIRECTORY, "tdf152106.odt"); + +xmlDocUniquePtr pLayout = parseLayoutDump(); + +// frame on page 3 +assertXPath(pLayout, "/root/page[3]/sorted_objs/fly", 1); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128198) { SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf128198-1.docx"); diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index afe143f158a9..9c61e5590e0a 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1472,6 +1472,8 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl ) // FME 2007-08-30 #i81146# new loop control int nLoopControlRuns = 0; +// tdf#152106 loop control for multi-column sections +int nLoopControlRunsInMultiCol = 0; const int nLoopControlMax = 20; const SwFrame* pLoopControlCond = nullptr; @@ -1624,10 +1626,16 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl ) // #i28701# - restart layout process, if // requested by floating screen object formatting if (bRestartLayoutProcess +// tdf#152106 loop control in multi-column sections to avoid of freezing +&& nLoopControlRunsInMultiCol < nLoopControlMax // tdf#142080 if it was already on next page, and still is, // ignore restart, as restart could cause infinite loop && (wasFrameLowerOfLay || pLay->IsAnLower(pFrame))) { +bool bIsMultiColumn = pSect && pSect->GetSection() && pSect->Lower() && +pSect->Lower()->IsColumnFrame() && pSect->Lower()->GetNext(); +if ( bIsMultiColumn ) +++nLoopControlRunsInMultiCol; pFrame = pLay->ContainsAny(); pAgainObj1 = nullptr; pAgainObj2 = nullptr;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter6.cxx |5 + sw/source/core/edit/acorrect.cxx| 15 +-- 2 files changed, 18 insertions(+), 2 deletions(-) New commits: commit 62b402030553740b96a624434f3700446e0fbd7c Author: László Németh AuthorDate: Thu Nov 3 21:42:48 2022 +0100 Commit: László Németh CommitDate: Mon Nov 14 13:35:04 2022 +0100 tdf#148672 Old Hungarian transliteration: fix "word]" Words ending with closing bracket weren't transliterated, because NatNum12 parameters couldn't contain closing bracket. Transliterate without the bracket, and append it to the result. Note: "[word]", "(word)" etc. forms will be handled by the next libnumbertext release. Conflicts: sw/source/core/edit/acorrect.cxx (cherry-picked from commit 733bfd9597fc42c569c6855bb71c56429e009fa6) Change-Id: Id0d34267575782487819e3a3f76d1b547866e362 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142254 Tested-by: Jenkins Reviewed-by: László Németh Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142672 diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index e66fae378115..48b8bcf8d22a 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -1803,6 +1803,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133589) emulateTyping(*pXTextDocument, u"„idézőjel” "); sReplaced += u"⹂ೇೋ೯ೖ‟ "; CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString()); + +// tdf#148672 transliterate word with closing bracket +emulateTyping(*pXTextDocument, u"word] "); +sReplaced += u"೮ೢೇ] "; // This was "word]" (no transliteration) +CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString()); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testAutoCorr) diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index 75b45488465d..ed2a0fb3ca41 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -564,10 +564,21 @@ bool SwAutoCorrDoc::TransliterateRTLWord( sal_Int32& rSttPos, sal_Int32 nEndPos, if (pFormatter && !sWord.isEmpty()) { const Color* pColor = nullptr; -// Send text as NatNum12 prefix -OUString sPrefix("[NatNum12 " + sDisambiguatedWord.makeStringAndClear() + "]0"); + +// Send text as NatNum12 prefix: "word" -> "[NatNum12 word]0" + +// Closing bracket doesn't allowed in NatNum parameters, remove it from transliteration: +// "[word]" -> "[NatNum12 [word]0" +bool bHasBracket = sWord.endsWith("]"); +if ( !bHasBracket ) +sDisambiguatedWord.append("]"); +OUString sPrefix("[NatNum12 " + sDisambiguatedWord.makeStringAndClear() + "0"); if (pFormatter->GetPreviewString(sPrefix, 0, sConverted, , LANGUAGE_USER_HUNGARIAN_ROVAS)) +{ +if ( bHasBracket ) +sConverted = sConverted + "]"; bRet = true; +} } SwPaM aPam(pFrame->MapViewToModelPos(TextFrameIndex(rSttPos)),
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter6.cxx | 53 sw/source/core/crsr/viscrs.cxx | 27 ++ sw/source/core/inc/txtfrm.hxx |2 - 3 files changed, 81 insertions(+), 1 deletion(-) New commits: commit f9b4ee0859676555bad4f6cc2513baf7135c4bdb Author: László Németh AuthorDate: Mon Oct 24 11:17:50 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Nov 1 20:49:12 2022 +0100 tdf#124603 sw: pressing Up/Down triggers pending spell checking Modified text wasn't checked until the next edit operation, so spelling mistake of the last edited word could go unnoticed. Leaving the edited line by pressing Up/Down triggers pending spell checking to fix the problem in most cases. Regression from commit 4c91e94e892943ef5e031d65f6f42864233cb4cd "tdf#92036: sw: fix idle spelling loop", Note: add unit test to tdf#92036, too. Change-Id: I865eb7b5d8f872421230d457989e24c3b489690d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141728 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit e3ae86a38d6282db0f54d3545015ed22ee868ae5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141852 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index 6a341088d8e6..b47da8fb386b 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -43,6 +43,7 @@ #include #include #include +#include namespace { @@ -1338,6 +1339,58 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testSpellOnlineParameter) CPPUNIT_ASSERT_EQUAL(!bSet, pOpt->IsOnlineSpell()); } +// missing spelling dictionary on Windows test platform? +#if !defined(_WIN32) +CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf124603) +{ +SwDoc* pDoc = createSwDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +const SwViewOption* pOpt = pWrtShell->GetViewOptions(); +uno::Sequence params += comphelper::InitPropertySequence({ { "Enable", uno::Any(true) } }); +dispatchCommand(mxComponent, ".uno:SpellOnline", params); + +// Automatic Spell Checking is enabled + +CPPUNIT_ASSERT(pOpt->IsOnlineSpell()); + +// Type a correct word + +SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pXTextDocument); +emulateTyping(*pXTextDocument, u"the "); +SwCursorShell* pShell(pDoc->GetEditShell()); +SwTextNode* pNode = pShell->GetCursor()->GetNode().GetTextNode(); +// no bad word +CPPUNIT_ASSERT_EQUAL(static_cast(nullptr), pNode->GetWrong()); + +// Create a bad word from the good: "the" -> "thex" + +pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); +emulateTyping(*pXTextDocument, u"x"); +CPPUNIT_ASSERT(pNode->GetWrong()); +// tdf#92036 pending spell checking +bool bPending = !pNode->GetWrong() || !pNode->GetWrong()->Count(); +CPPUNIT_ASSERT(bPending); + +// Move right, leave the bad word + +pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); +CPPUNIT_ASSERT(pNode->GetWrong()); +// tdf#92036 still pending spell checking +bPending = !pNode->GetWrong() || !pNode->GetWrong()->Count(); +CPPUNIT_ASSERT(bPending); + +// Move down to trigger spell checking + +pWrtShell->Down(/*bSelect=*/false, 1); +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT(pNode->GetWrong()); +// This was 0 (pending spell checking) +CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pNode->GetWrong()->Count()); +} +#endif + CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect) { SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "redline-autocorrect.fodt"); diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 86878ad50c82..9e41acb4abcb 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -1027,6 +1027,33 @@ void SwShellCursor::SaveTableBoxContent( const SwPosition* pPos ) bool SwShellCursor::UpDown( bool bUp, sal_uInt16 nCnt ) { +// tdf#124603 trigger pending spell checking of the node +if ( nCnt == 1 ) +{ +SwTextNode* pNode = GetPoint()->nNode.GetNode().GetTextNode(); +if( pNode && SwTextNode::WrongState::PENDING == pNode->GetWrongDirty() ) +{ +SwWrtShell* pShell = pNode->GetDoc().GetDocShell()->GetWrtShell(); +if ( pShell && !pShell->IsSelection() && !pShell->IsSelFrameMode() ) +{ +const SwViewOption* pVOpt = pShell->GetViewOptions(); +if ( pVOpt && pVOpt->IsOnlineSpell() ) +{ +const bool bOldViewLock = pShell->IsViewLocked(); +pShell->LockView( true ); + +SwTextFrame* pFrame( + static_cast(pNode->getLayoutFrame(GetShell()->GetLayout(; +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/uitest/writer_tests/trackedChanges.py |4 ++-- sw/source/core/doc/docredln.cxx | 20 +++- 2 files changed, 17 insertions(+), 7 deletions(-) New commits: commit e8580b8ef2765d5bbaafadd46d395bc4be9345b2 Author: Stephan Bergmann AuthorDate: Fri Oct 21 20:57:14 2022 +0200 Commit: Michael Stahl CommitDate: Tue Oct 25 11:07:36 2022 +0200 Improve SwRedlineData::CanCombine date comparison f240f073d228e62afd3f60563c23626efad0df7f "Related: tdf#102308 sw: ignore seconds when combining redlines" had just naively cut off the seconds for comparison, but which apparently gave unexpected results when the two dates are sufficiently close but lie on different sides of a minute tick: Autocorrection-related unit tests like CppunitTest_sw_uiwriter6 CPPUNIT_TEST_NAME=testRedlineAutoCorrect2::TestBody sporadically failed to execute some autocorrection, as in > uiwriter6.cxx:1436:Assertion > Test name: testRedlineAutoCorrect2::TestBody > equality assertion failed > - Expected: Lorem,... Lorem,… > - Actual : Lorem,... Lorem,... What happened there in testRedlineAutoCorrect2 (sw/qa/extras/uiwriter/uiwriter6.cxx) is that each emulateTyping consecutive simulated character input should extend the current redline range, by hitting the > // Merge if applicable? > if( (( SwComparePosition::Behind == eCmpPos && >IsPrevPos( *pREnd, *pStt ) ) || > ( SwComparePosition::CollideStart == eCmpPos ) || > ( SwComparePosition::OverlapBehind == eCmpPos ) ) && > pRedl->CanCombine( *pNewRedl ) && > ( n+1 >= maRedlineTable.size() || > ( *maRedlineTable[ n+1 ]->Start() >= *pEnd && > *maRedlineTable[ n+1 ]->Start() != *pREnd ) ) ) branch in DocumentRedlineManager::AppendRedline (sw/source/core/doc/DocumentRedlineManager.cxx). However, when that happened to fail on a minute tick boundary because its > pRedl->CanCombine( *pNewRedl ) && part was false, we would end up with split redline ranges, and SwAutoCorrDoc::ChgAutoCorrWord (sw/source/core/edit/acorrect.cxx) would not execute the autocorrection replacement across those split ranges due to its > // don't replace, if a redline starts or ends within the original text code. (One way of making that test fail reproducibly would be with some > diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx > index 0159c5bf07ed..8716c6a09882 100644 > --- a/sw/qa/extras/uiwriter/uiwriter6.cxx > +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx > @@ -7,6 +7,10 @@ > * file, You can obtain one at http://mozilla.org/MPL/2.0/. > */ > > +#include > + > +#include > + > #include > #include > #include > @@ -33,6 +37,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1431,7 +1436,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect2) > CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString()); > > // Continue it: > -emulateTyping(rXTextDocument, u"Lorem,... "); > +emulateTyping(rXTextDocument, u"Lorem,..."); > +osl::Thread::wait(std::chrono::seconds(70)); > +emulateTyping(rXTextDocument, u" "); > sReplaced = u"Lorem,... Lorem,… "; > CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString()); > } patch.) So at least improve SwRedlineData::CanCombine to properly check for a date delta of <= 1 minute. However, that still leaves those tests prone to sporadic failures (even though less likely), if they get delayed for a sufficient amount of time in strategically unfortunate places. Ideally, those autocorrection-related tests (which appear to be the ones in sw/qa/extras/uiwriter/uiwriter6.cxx using emulateTyping) would run with redlining turned off, but many of them explicitly enable redlining, presumably for a reason. With that change, UITest_writer_tests started to fail with > FAIL: test_tdf135018 (trackedChanges.trackedchanges) > -- > Traceback (most recent call last): > File "sw/qa/uitest/writer_tests/trackedChanges.py", line 203, in test_tdf135018 > self.assertEqual(147, len(changesList.getChildren())) > AssertionError: 147 != 111 in a test introduced with b6ab2330d97672936edc56de8d6f5b6f772908ff "tdf#135018: sw: Add UItest". That sw/qa/uitest/data/tdf135018.odt's content.xml
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/core/doc/doc.cxx | 86 +++ sw/source/core/doc/docbm.cxx | 21 +- 2 files changed, 104 insertions(+), 3 deletions(-) New commits: commit f9a3adc186b31bac198d944a03a7b53dd926da23 Author: Miklos Vajna AuthorDate: Tue Oct 18 09:22:29 2022 +0200 Commit: Michael Stahl CommitDate: Tue Oct 18 11:31:12 2022 +0200 sw: fix crash on deleting a bookmark with active selection listeners The document had a registered selection listener that created UNO cursors (bookmarks) in its selectionChanged() callback. Once an UNO API user tried to delete a bookmark, Writer crashed. What happens is that sw::mark::MarkManager::deleteMark() created an iterator pointing to an element of m_vAllMarks, then called sw::mark::Bookmark::DeregisterFromDoc(), which indirectly calls SwXTextView::NotifySelChanged(), which invokes UNO selection listeners, which are allowed to create UNO cursors, which modify m_vAllMarks, invalidating the iterator. Fix the problem by first creating a non-const iterator based on ppMark, then conditionally invoke DeregisterFromDoc(). If DeregisterFromDoc() is called, then update the iterator based on pMark, so it is valid by the time we erase the bookmark from m_vAllMarks. This was not the problem when erasing the same mark from m_vBookmarks, as in that case the iterator creation and the erase() both happen before the de-registration. Change-Id: Iaae95ec9c3038e8ee3b84408094844d0ff678213 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141489 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit e9861d8e0138028c17e93fec277125e7752439bd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141405 Reviewed-by: Michael Stahl diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index c13e7a8d6a55..a9db78ba4871 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -9,6 +9,8 @@ #include +#include + #include #include #include @@ -285,6 +287,90 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testLinkedStyleDelete) xStorable->storeAsURL(maTempFile.GetURL(), aArgs); } +namespace +{ +/// This selection listener calls getAnchor() on selection change, which creates UNO cursors and is +/// invoked in the middle of a bookmark deletion. +struct SelectionChangeListener : public cppu::WeakImplHelper +{ +uno::Reference m_xBookmarks; +std::vector> m_aAnchors; + +public: +SelectionChangeListener(const uno::Reference& xBookmarks); +// view::XSelectionChangeListener +void SAL_CALL selectionChanged(const lang::EventObject& rEvent) override; + +// lang::XEventListener +void SAL_CALL disposing(const lang::EventObject& rSource) override; +}; +} + +SelectionChangeListener::SelectionChangeListener( +const uno::Reference& xBookmarks) +: m_xBookmarks(xBookmarks) +{ +} + +void SelectionChangeListener::selectionChanged(const lang::EventObject& /*rEvent*/) +{ +uno::Sequence aElementNames = m_xBookmarks->getElementNames(); +for (const auto& rName : aElementNames) +{ +uno::Reference xTextContent(m_xBookmarks->getByName(rName), +uno::UNO_QUERY); +m_aAnchors.push_back(xTextContent->getAnchor()); +} +} + +void SelectionChangeListener::disposing(const lang::EventObject& /*rSource*/) {} + +CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBookmarkDeleteListeners) +{ +// Given a document with 2 bookmarks: +createSwDoc(); +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xText = xTextDocument->getText(); +uno::Reference xCursor = xText->createTextCursor(); +{ +xText->insertString(xCursor, "test", /*bAbsorb=*/false); +xCursor->gotoStart(/*bExpand=*/false); +xCursor->gotoEnd(/*bExpand=*/true); +uno::Reference xFactory(mxComponent, uno::UNO_QUERY); +uno::Reference xBookmark( +xFactory->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); +uno::Reference xBookmarkNamed(xBookmark, uno::UNO_QUERY); +xBookmarkNamed->setName("mybookmark"); +xText->insertTextContent(xCursor, xBookmark, /*bAbsorb=*/true); +} +{ +xCursor->gotoEnd(/*bExpand=*/false); +xText->insertString(xCursor, "test2", /*bAbsorb=*/false); +xCursor->goLeft(4, /*bExpand=*/true); +uno::Reference xFactory(mxComponent, uno::UNO_QUERY); +uno::Reference xBookmark( +xFactory->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); +uno::Reference xBookmarkNamed(xBookmark, uno::UNO_QUERY); +xBookmarkNamed->setName("mybookmark2"); +xText->insertTextContent(xCursor, xBookmark, /*bAbsorb=*/true); +} +uno::Reference xBookmarksSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xBookmarks =
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/core/crsr/crsr.cxx| 24 sw/source/core/crsr/pam.cxx |7 +++ 2 files changed, 31 insertions(+) New commits: commit 7cb6be3e866bad39a37844802d49b1f5c7031910 Author: Miklos Vajna AuthorDate: Wed Oct 12 11:44:49 2022 +0200 Commit: Michael Stahl CommitDate: Thu Oct 13 11:05:18 2022 +0200 tdf#151190 sw content controls: make them read-write in protected sections When the user picked a date in the date picker inside a protected section, then we blocked the deletion of the placeholder, but allowed insertion to the content control, which is inconsistent. The trouble was that SwPaM::HasReadonlySel() detected that the cursor is in a protected section, so deletion failed, leading to an ever growing value of the content control. Fix the problem by handling content controls similar to legacy form fields: if the cursor is inside a content control, then that value is editable, even if we're inside a protected section. This is meant to fix all content control types, not just date pickers. Change-Id: I9eca4c4f71dcfaa61d84414f7727adcd4496735c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141249 Reviewed-by: Miklos Vajna Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141266 Reviewed-by: Michael Stahl diff --git a/sw/qa/core/crsr/crsr.cxx b/sw/qa/core/crsr/crsr.cxx index 8f8d9963a285..3dc236c41f06 100644 --- a/sw/qa/core/crsr/crsr.cxx +++ b/sw/qa/core/crsr/crsr.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -164,6 +165,29 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlReadOnly) CPPUNIT_ASSERT(pWrtShell->HasReadonlySel()); } +CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlProtectedSection) +{ +// Given a document with a date content control in a protected section: +SwDoc* pDoc = createSwDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +pWrtShell->InsertContentControl(SwContentControlType::DATE); +pWrtShell->SelAll(); +OUString aSectionName = pWrtShell->GetUniqueSectionName(); +SwSectionData aSection(SectionType::Content, aSectionName); +aSection.SetProtectFlag(true); +pWrtShell->InsertSection(aSection); + +// When entering the content control: +pWrtShell->SttEndDoc(/*bStt=*/true); +pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); + +// Then make sure that the cursor is read-only: +// Without the accompanying fix in place, this test would have failed, it was not possible to +// pick a date in a protected section (the new value was inserted, but the placeholder was not +// removed). +CPPUNIT_ASSERT(!pWrtShell->HasReadonlySel()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index f771e09f5739..6dc26d2ac074 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -761,6 +761,13 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const { // Allow editing when the cursor/selection is fully inside of a legacy form field. bRet = !( pA != nullptr && !bAtStartA && !bAtStartB && pA == pB ); + +if (bRet && rDoc.GetEditShell()->CursorInsideContentControl()) +{ +// Also allow editing inside content controls in general, similar to form fields. +// Specific types will be disabled below. +bRet = false; +} } if (!bRet)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/uitest/writer_dialogs/openDialogs.py |3 - sw/qa/uitest/writer_tests7/tdf135938.py| 46 + sw/source/ui/fldui/fldref.cxx |8 +++-- 3 files changed, 52 insertions(+), 5 deletions(-) New commits: commit c5d32e7a9a58e1643f1ef10bb24de40c58ab0edc Author: Andreas Heinisch AuthorDate: Wed Oct 5 17:09:14 2022 +0200 Commit: Michael Stahl CommitDate: Fri Oct 7 12:04:26 2022 +0200 tdf#135938 - Refresh cross-reference name after filter selection has changed Change-Id: I3e92adc10da089372637174f8551d531aea2fb13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140985 Tested-by: Jenkins Reviewed-by: Andreas Heinisch (cherry picked from commit fe51aa0a8d796b456a3c6966c47afc98e4532cd0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141055 Reviewed-by: Michael Stahl diff --git a/sw/qa/uitest/writer_dialogs/openDialogs.py b/sw/qa/uitest/writer_dialogs/openDialogs.py index ed3585e2923d..896d2fd641c7 100644 --- a/sw/qa/uitest/writer_dialogs/openDialogs.py +++ b/sw/qa/uitest/writer_dialogs/openDialogs.py @@ -50,8 +50,7 @@ dialogs = [ # dialog opens but is not recognised by execute_dialog_through_command # {"command": ".uno:InsertBookmark", "closeButton": "close"}, # tested in sw/qa/uitest/writer_tests2/bookmark.py -# {"command": ".uno:InsertReferenceField", "closeButton": "close"}, -# dialog not closed +{"command": ".uno:InsertReferenceField", "closeButton": "cancel"}, # {"command": ".uno:InsertSymbol", "closeButton": "cancel"}, # tested in sw/qa/uitest/writer_tests3/specialCharacter.py # {"command": ".uno:InsertFootnoteDialog", "closeButton": "cancel"}, diff --git a/sw/qa/uitest/writer_tests7/tdf135938.py b/sw/qa/uitest/writer_tests7/tdf135938.py new file mode 100755 index ..013da93624da --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf135938.py @@ -0,0 +1,46 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 + +class tdf135938(UITestCase): + +def test_tdf135938_cross_reference_update(self): +with self.ui_test.create_doc_in_start_center("writer"): +with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertReferenceField", close_button="cancel") as xDialog: +# Select set reference type +xTreelistType = xDialog.getChild("type-ref") +xTreeEntry = xTreelistType.getChild('0') +self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "Set Reference") +xTreeEntry.executeAction("SELECT", tuple()) + +# Insert cross references +xName = xDialog.getChild("name-ref") +xName.executeAction("TYPE", mkPropertyValues({"TEXT": "ABC"})) +xInsert = xDialog.getChild("ok") +xInsert.executeAction("CLICK", tuple()) +xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) +xName.executeAction("TYPE", mkPropertyValues({"TEXT": "DEF"})) +xInsert.executeAction("CLICK", tuple()) + +# Select insert reference type +xTreeEntry = xTreelistType.getChild('1') +self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "Insert Reference") +xTreeEntry.executeAction("SELECT", tuple()) + +# Filter the cross references +xFilter = xDialog.getChild("filter") +xFilter.executeAction("TYPE", mkPropertyValues({"TEXT": "A"})) +# Without the fix in place, this test would have failed with +# AssertionError: 'ABC' != 'DEF', i.e., the text of the name field did not change +self.assertEqual(get_state_as_dict(xName)["Text"], "ABC") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 1fbd69c9f10e..bae2557f173d 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -122,6 +122,8 @@ SwFieldRefPage::~SwFieldRefPage() IMPL_LINK_NOARG(SwFieldRefPage, ModifyHdl_Impl, weld::Entry&, void) { UpdateSubType(comphelper::string::strip(m_xFilterED->get_text(), ' ')); +// tdf#135938 - refresh cross-reference name after filter selection has changed +SubTypeHdl(); } // #i83479# @@ -377,9 +379,6 @@ IMPL_LINK_NOARG(SwFieldRefPage, TypeHdl, weld::TreeView&, void) sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32(); -//
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/ww8import/ww8import.cxx |2 +- sw/source/ui/uno/swdetect.cxx| 25 ++--- 2 files changed, 19 insertions(+), 8 deletions(-) New commits: commit a814eecea816a00b1e1d796381c8f33bb51bdfc5 Author: Justin Luth AuthorDate: Tue Sep 27 22:08:48 2022 -0400 Commit: Xisco Fauli CommitDate: Tue Oct 4 11:11:14 2022 +0200 tdf#125216 import filter: allow .doc renamed as .dot A LO 6.2.2 regression prevented .doc-as-.dot files to load, giving a "Read Error. This is not a valid WinWord6 file." Well, it is not a valid .dot file (because of some bit differences), but it is a valid .doc file. Since it was renamed to be treated as a template (requiring a save-as), we should treat it as that. Change-Id: I308375797e9dae3ca6d203fab520e91ee788325e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140687 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 6cec8ba33a28de7248861b2eecfc5034cbde9d37) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140881 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ww8import/data/tdf120761_zOrder.doc b/sw/qa/extras/ww8import/data/tdf120761_zOrder.dot similarity index 100% rename from sw/qa/extras/ww8import/data/tdf120761_zOrder.doc rename to sw/qa/extras/ww8import/data/tdf120761_zOrder.dot diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index ab35fa9d7346..47a31eb650b5 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -275,7 +275,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf110987) CPPUNIT_TEST_FIXTURE(Test, testTdf120761_zOrder) { -load(mpTestDocumentPath, "tdf120761_zOrder.doc"); +load(mpTestDocumentPath, "tdf120761_zOrder.dot"); //The blue shape was covering everything (highest zorder = 2) instead of the lowest(0) uno::Reference xShape(getShapeByName(u"Picture 2"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty(xShape, "ZOrder")); diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index 9e354dedaf6b..83b7162ae2a0 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include using namespace ::com::sun::star; @@ -102,19 +103,29 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor // mis-detect it. if ( bIsDetected && aTypeName == "writer_MS_Word_97_Vorlage" ) { +// It is common practice to rename a .doc to .dot to make it a template. +// Since we have detected a.doc-ish format, always accept .dot-named-files +// as valid templates to avoid flagging this as an invalid .dot format.. +INetURLObject aParser(aMediaDesc.getUnpackedValueOrDefault( +utl::MediaDescriptor::PROP_URL, OUString())); + // Super ugly hack, but we don't want to use the whole WW8Fib thing here in // the swd library, apparently. We know (do we?) that the "aBits1" byte, as // the variable is called in WW8Fib::WW8Fib(SvStream&,sal_uInt8,sal_uInt32), // is at offset 10 in the WordDocument stream. The fDot bit is bit 0x01 of // that byte. -tools::SvRef xWordDocument = aStorage->OpenSotStream("WordDocument", StreamMode::STD_READ); -xWordDocument->Seek( 10 ); -if ( xWordDocument->Tell() == 10 ) +if (aParser.getExtension().toAsciiLowerCase() != "dot") { -sal_uInt8 aBits1; -xWordDocument->ReadUChar( aBits1 ); -// Check fDot bit -bIsDetected = ((aBits1 & 0x01) == 0x01); +tools::SvRef xWordDocument += aStorage->OpenSotStream("WordDocument", StreamMode::STD_READ); +xWordDocument->Seek(10); +if (xWordDocument->Tell() == 10) +{ +sal_uInt8 aBits1; +xWordDocument->ReadUChar(aBits1); +// Check fDot bit +bIsDetected = ((aBits1 & 0x01) == 0x01); +} } } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/filter/ww8/ww8.cxx | 33 +++ sw/source/filter/ww8/docxattributeoutput.cxx |4 +++ sw/source/filter/ww8/docxattributeoutput.hxx |1 3 files changed, 38 insertions(+) New commits: commit b9f80c6d2779e3e4ea4096653fe5f01e33d05ea8 Author: Miklos Vajna AuthorDate: Tue Sep 27 14:05:10 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Oct 3 12:40:16 2022 +0200 DOCX export: fix not-well-formed XML when hyperlink end is a textbox anchor We failed to save a document which contained anchored text and the anchor position was inside a hyperlink. The problem was that the hyperlink covered content which has anchored text, so when the text inside the shape ended its paragraph, it wanted to finish the hyperlink that was started outside the shape, which is not well-formed XML. This was a problem since 7246e57216bb20c15af0ecf6a0183f5ffa81e780 (tdf#143591 DOCX import: handle anchored objects as at-char, 2021-09-20), previously we lost the character position of such anchor positions, so in practice this problem was not visible. Fix this similarly how we stash away the current state when entering a table cell: just save / restore the number of hyperlinks we have to close, that'll close the hyperlink outside the shape. Note that the source document has the hyperlink outside the shape's anchor, while we include the shape inside the hyperlink, but that doesn't cause problems in practice. Change-Id: I711fad2336fd78e2ba709c3fc0a4f75de32aae8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140650 Reviewed-by: Miklos Vajna Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140662 diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx index 7ccb1299769e..ab9e456be695 100644 --- a/sw/qa/filter/ww8/ww8.cxx +++ b/sw/qa/filter/ww8/ww8.cxx @@ -9,6 +9,8 @@ #include +#include + namespace { constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/filter/ww8/data/"; @@ -48,6 +50,37 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorderDocImport) auto nTopBorderDistance = xStyle->getPropertyValue("TopBorderDistance").get(); CPPUNIT_ASSERT_EQUAL(static_cast(-646), nTopBorderDistance); } + +CPPUNIT_TEST_FIXTURE(Test, testDocxHyperlinkShape) +{ +// Given a document with a hyperlink at char positions 0 -> 6 and a shape with text anchored at +// char position 6: +mxComponent = loadFromDesktop("private:factory/swriter"); +uno::Reference xMSF(mxComponent, uno::UNO_QUERY); +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xText = xTextDocument->getText(); +uno::Reference xCursor = xText->createTextCursor(); +xText->insertString(xCursor, "beforeafter", /*bAbsorb=*/false); +xCursor->gotoStart(/*bExpand=*/false); +xCursor->goRight(/*nCount=*/6, /*bExpand=*/true); +uno::Reference xCursorProps(xCursor, uno::UNO_QUERY); +xCursorProps->setPropertyValue("HyperLinkURL", uno::Any(OUString("http://www.example.com/;))); +xCursor->gotoStart(/*bExpand=*/false); +xCursor->goRight(/*nCount=*/6, /*bExpand=*/false); +uno::Reference xFactory(mxComponent, uno::UNO_QUERY); +uno::Reference xShape( +xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); +xShape->setSize(awt::Size(5000, 5000)); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); +xShapeProps->setPropertyValue("AnchorType", uno::Any(text::TextContentAnchorType_AT_CHARACTER)); +uno::Reference xShapeContent(xShape, uno::UNO_QUERY); +xText->insertTextContent(xCursor, xShapeContent, /*bAbsorb=*/false); +xShapeProps->setPropertyValue("TextBox", uno::Any(true)); + +// When saving this document to DOCX, then make sure we don't crash on export (due to an +// assertion failure for not-well-formed XML output): +save("Office Open XML Text", maTempFile); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 94d1f19294d0..8020576cfcab 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6808,6 +6808,9 @@ void DocxAttributeOutput::pushToTableExportContext(DocxTableExportContext& rCont m_aParagraphSdt.m_bStartedSdt = false; rContext.m_bStartedRunSdt = m_aRunSdt.m_bStartedSdt; m_aRunSdt.m_bStartedSdt = false; + +rContext.m_nHyperLinkCount = m_nHyperLinkCount; +m_nHyperLinkCount = 0; } void DocxAttributeOutput::popFromTableExportContext(DocxTableExportContext const & rContext) @@ -6817,6 +6820,7 @@ void DocxAttributeOutput::popFromTableExportContext(DocxTableExportContext const m_tableReference->m_nTableDepth = rContext.m_nTableDepth; m_aParagraphSdt.m_bStartedSdt = rContext.m_bStartedParaSdt;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/htmlexport/htmlexport.cxx | 78 +--- sw/qa/filter/html/html.cxx | 39 sw/qa/inc/swmodeltestbase.hxx |6 ++ sw/qa/unit/swmodeltestbase.cxx |9 +++ sw/source/filter/html/htmlflywriter.cxx |7 ++ 5 files changed, 93 insertions(+), 46 deletions(-) New commits: commit 90b6fa56e3f478ce25da891cbb12339e90dbf2ba Author: Miklos Vajna AuthorDate: Mon Sep 26 15:40:29 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Sep 27 18:27:20 2022 +0200 sw HTML export: fix PNG export of Writer images containing metafiles We attempted to export SVM metafiles as SVM+PNG, but then the SVM was turned into GIF. A GIF+PNG pair is not useful, just write PNG. This is similar to commit c8a9396e5695675ffe92935a9ba40354fc76ed79 (sw XHTML / reqif export: fix PNG export of shapes, 2021-06-03), which did the same for non-SdrGrafObj shapes. Change-Id: I1a0ab266473787d263573b4813dc19426e272435 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140619 Reviewed-by: Miklos Vajna Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140645 diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 76333c842d96..5a2dca9618e5 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -197,20 +197,6 @@ public: { } -/** - * Wraps a reqif-xhtml fragment into an XHTML file, so an XML parser can - * parse it. - */ -static void wrapFragment(const utl::TempFile& rTempFile, SvMemoryStream& rStream) -{ -rStream.WriteCharPtr( -"http://www.w3.org/1999/xhtml\;>\n"); -SvFileStream aFileStream(rTempFile.GetURL(), StreamMode::READ); -rStream.WriteStream(aFileStream); -rStream.WriteCharPtr("\n"); -rStream.Seek(0); -} - /// Wraps an RTF fragment into a complete RTF file, so an RTF parser can handle it. static void wrapRtfFragment(const OUString& rURL, SvMemoryStream& rStream) { @@ -292,7 +278,7 @@ public: OUString SwHtmlDomExportTest::GetOlePath() { SvMemoryStream aStream; -HtmlExportTest::wrapFragment(maTempFile, aStream); +WrapReqifFromTempFile(aStream); xmlDocUniquePtr pDoc = parseXmlStream(); CPPUNIT_ASSERT(pDoc); OUString aOlePath = getXPath( @@ -308,7 +294,7 @@ OUString SwHtmlDomExportTest::GetOlePath() OUString SwHtmlDomExportTest::GetPngPath() { SvMemoryStream aStream; -HtmlExportTest::wrapFragment(maTempFile, aStream); +WrapReqifFromTempFile(aStream); xmlDocUniquePtr pDoc = parseXmlStream(); CPPUNIT_ASSERT(pDoc); OUString aPngPath = getXPath( @@ -842,7 +828,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIfTableHeight) // Then make sure that the explicit cell height is omitted from the output: SvMemoryStream aStream; -HtmlExportTest::wrapFragment(maTempFile, aStream); +WrapReqifFromTempFile(aStream); xmlDocUniquePtr pDoc = parseXmlStream(); // Without the accompanying fix in place, this test would have failed, explicit height was // written, which is not valid reqif-xhtml. @@ -903,7 +889,7 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOle2, "reqif-ole2.xhtml") { // Check that the replacement graphic is exported at RTF level. SvMemoryStream aStream; -wrapFragment(maTempFile, aStream); +WrapReqifFromTempFile(aStream); xmlDocUniquePtr pDoc = parseXmlStream(); CPPUNIT_ASSERT(pDoc); // Get the path of the RTF data. @@ -975,7 +961,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTransparentImageReqIf) }; xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties); SvMemoryStream aStream; -HtmlExportTest::wrapFragment(maTempFile, aStream); +WrapReqifFromTempFile(aStream); xmlDocUniquePtr pDoc = parseXmlStream(); CPPUNIT_ASSERT(pDoc); @@ -992,7 +978,7 @@ DECLARE_HTMLEXPORT_TEST(testOleNodataReqIf, "reqif-ole-nodata.odt") { // This failed, io::IOException was thrown during the filter() call. SvMemoryStream aStream; -wrapFragment(maTempFile, aStream); +WrapReqifFromTempFile(aStream); xmlDocUniquePtr pDoc = parseXmlStream(); CPPUNIT_ASSERT(pDoc); @@ -1007,7 +993,7 @@ DECLARE_HTMLEXPORT_TEST(testOleNodataReqIf, "reqif-ole-nodata.odt") DECLARE_HTMLEXPORT_TEST(testNoLangReqIf, "reqif-no-lang.odt") { SvMemoryStream aStream; -wrapFragment(maTempFile, aStream); +WrapReqifFromTempFile(aStream); xmlDocUniquePtr pDoc = parseXmlStream(); CPPUNIT_ASSERT(pDoc); @@ -1083,7 +1069,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testBlockQuoteReqIf) aMediaDescriptor["FilterOptions"] <<= OUString("xhtmlns=reqif-xhtml"); xStorable->storeToURL(maTempFile.GetURL(),
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/layout/data/in_056132_mod.odt |binary sw/qa/extras/layout/layout.cxx | 49 + sw/source/core/layout/calcmove.cxx |7 3 files changed, 49 insertions(+), 7 deletions(-) New commits: commit dc1f177b42658a5e02a2745545dba25203a81536 Author: Michael Stahl AuthorDate: Wed Sep 21 18:33:43 2022 +0200 Commit: Thorsten Behrens CommitDate: Sat Sep 24 12:50:39 2022 +0200 tdf#150616 sw: fix bad 0 height of SwTextFrame in table cell The bugdoc has a text frame 42 immediately following a section which contains a nested table, both inside a table cell 29. The problem is that with soffice --convert-to pdf, the height of frame 42 ends up as 0, after a single layout action; this does not happen when loading it from UI. When the frame 42 is formatted, it calculates the needed height, and grows, but in SwTextFrame::AdjustFrame() it doesn't fit into its upper cell frame with a negative nRstHeight at this point, and the text frame is reduced to height 0. The odd code in SwContentFrame::MakeAll() exists unchanged since CVS initial import and is poorly motivated. It is highly suspicious that it simply grows the upper frame, without invalidating the size of the current one (which was already shrunk), and/or clearing the m_bUndersized flag. If this code is removed, on formatting the next frame 43, it goes up and formats the cell frame, which grows and at the same time importantly invalidates the text frame 42, so it will be formatted again and full height. At the point when the frame 42 was formatted, its upper cell frame was size-invalid, so it looks like that will be formatted eventually in any case and then invalidate 42. (regression from commit e7874c936dd1ff9b3423eb7477cbee2494535176 but unclear why) Change-Id: I1ac0999a8fda39f7717bc183a10e3b513fbb8911 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140355 Tested-by: Jenkins Reviewed-by: Michael Stahl Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140473 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/layout/data/in_056132_mod.odt b/sw/qa/extras/layout/data/in_056132_mod.odt new file mode 100644 index ..548401063bdd Binary files /dev/null and b/sw/qa/extras/layout/data/in_056132_mod.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index e085fdf9ce66..431bd5a2cca2 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3667,6 +3667,55 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122607_regression) aTempFile.EnableKillingFile(); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150616) +{ +discardDumpedLayout(); +if (mxComponent.is()) +mxComponent->dispose(); + +OUString const pName("in_056132_mod.odt"); + +OUString const url(m_directories.getURLFromSrc(DATA_DIRECTORY) + pName); + +// note: must set Hidden property, so that SfxFrameViewWindow_Impl::Resize() +// does *not* forward initial VCL Window Resize and thereby triggers a +// layout which does not happen on soffice --convert-to pdf. +std::vector aFilterOptions = { +{ beans::PropertyValue("Hidden", -1, uno::Any(true), beans::PropertyState_DIRECT_VALUE) }, +}; + +std::cout << pName << ":\n"; + +// inline the loading because currently properties can't be passed... +mxComponent = loadFromDesktop(url, "com.sun.star.text.TextDocument", + comphelper::containerToSequence(aFilterOptions)); +uno::Sequence props(comphelper::InitPropertySequence({ +{ "FilterName", uno::Any(OUString("writer_pdf_Export")) }, +})); +utl::TempFile aTempFile; +uno::Reference xStorable(mxComponent, uno::UNO_QUERY); +xStorable->storeToURL(aTempFile.GetURL(), props); + +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +CPPUNIT_ASSERT(pXmlDoc); + +// this one was 0 height +assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/LineBreak", "Line", +"Important information here!"); +assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/infos/bounds", "height", +"253"); +assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/infos/bounds", "top", +"7925"); +assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/LineBreak", "Line", +"xxx 111 "); +assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/infos/bounds", "height", +"697"); +assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/infos/bounds", "top", +"8178"); + +aTempFile.EnableKillingFile(); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testBtlrCell) { SwDoc* pDoc =
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/layout/data/tdf150642.odt |binary sw/qa/extras/layout/layout2.cxx|9 + sw/source/core/layout/calcmove.cxx |2 +- 3 files changed, 10 insertions(+), 1 deletion(-) New commits: commit 5e3abdf6ecded4f69bc7e1bdfb9dc8300f30685d Author: Mark Hung AuthorDate: Fri Sep 9 16:09:47 2022 +0800 Commit: Christian Lohmaier CommitDate: Wed Sep 21 12:54:07 2022 +0200 tdf#150642 fix table layout with vertical writing. Revert part of 1bf82b26ae3. N | V | WAS | 1bf82b26aea3 | WAS | 1bf82b26aea3 | --- F | F | fnRectHori | fnRectHori | fnAddRight/fnSubLeft | | F | T | fnRectVert | fnRectVert | fnAddRight/fnSubLeft | | T | F | fnRectVert | fnRectHori | fnAddRight/fnSubLeft | fnAddBottom | T | T | fnRectHori | fnRectVert | fnAddRight/fnSubLeft | fnAddBottom | * *: the case fixed in this patch. Ref: commit 1bf82b26aea3a403920a64cdfcb4671c947c7a01 Author: Mark Hung Date: Sun Aug 14 15:23:14 2022 +0800 tdf#135991 fix unexpected hidden RTL sections. Change-Id: I1e30c277dd03369bef0a6930b3d3534b7d57a640 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139777 Tested-by: Jenkins Reviewed-by: Mark Hung (cherry picked from commit 11ec622b8405dcaabc359e3d6e38c8a9142dad6b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140172 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/layout/data/tdf150642.odt b/sw/qa/extras/layout/data/tdf150642.odt new file mode 100644 index ..5e316424a289 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf150642.odt differ diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 00d7a8e65a48..6bbda55706a4 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -2173,6 +2173,15 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf135991) assertXPath(pDump, "//bounds[@top<0]", 0); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150642) +{ +createSwDoc(DATA_DIRECTORY, "tdf150642.odt"); +auto pDump = parseLayoutDump(); +// There used to be negative values that made the cell frame invisible. +assertXPath(pDump, "//bounds[@left<0]", 0); +assertXPath(pDump, "//bounds[@right<0]", 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 1869794300f6..e40e1dab6ef3 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -977,7 +977,7 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) setFramePrintAreaValid(false); SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this); -if (IsNeighbourFrame()) +if (IsNeighbourFrame() && !bVert) { SwTwips nPrtHeight = (GetUpper()->getFramePrintArea().*fnRect->fnGetHeight)(); const tools::Long nDiff = nPrtHeight - (getFrameArea().*fnRect->fnGetHeight)();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/filter/html/data/relative-keep-aspect-image.xhtml |3 sw/qa/filter/html/html.cxx | 27 sw/source/filter/html/htmlgrin.cxx | 51 3 files changed, 71 insertions(+), 10 deletions(-) New commits: commit 7c926242fb2ae81c67032042eaba503f27c13865 Author: Miklos Vajna AuthorDate: Mon Sep 19 16:08:25 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Sep 20 12:05:03 2022 +0200 sw HTML import: fix height of images when it is missing and width is relative This is similar to commit 456abae730a787693c3ad98f7e57eba5f6163a76 (sw HTML import: fix height of OLE objs when it is missing and width is relative, 2022-09-06), but this is for images, while that was for OLE objects. The idea is still that in case only axis is specified in the HTML and that's a relative percentage, then the ratio should be taken from the bitmap and it should be kept. Change-Id: I36184ff6531bff2775013462cd8cc711e1a249c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140178 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 2e6144fc350fd94f8e66be5a9007c7f06c0213e0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140163 Reviewed-by: Michael Stahl diff --git a/sw/qa/filter/html/data/relative-keep-aspect-image.xhtml b/sw/qa/filter/html/data/relative-keep-aspect-image.xhtml new file mode 100644 index ..96b8d14047bb --- /dev/null +++ b/sw/qa/filter/html/data/relative-keep-aspect-image.xhtml @@ -0,0 +1,3 @@ + + + diff --git a/sw/qa/filter/html/html.cxx b/sw/qa/filter/html/html.cxx index 6739341d2566..973feeec2951 100644 --- a/sw/qa/filter/html/html.cxx +++ b/sw/qa/filter/html/html.cxx @@ -78,6 +78,33 @@ CPPUNIT_TEST_FIXTURE(Test, testRelativeKeepAspect) CPPUNIT_ASSERT_EQUAL(static_cast(SwFormatFrameSize::SYNCED), static_cast(rSize.GetHeightPercent())); } + +CPPUNIT_TEST_FIXTURE(Test, testRelativeKeepAspectImage) +{ +// Given a document with an image, width set to 100%, height is not set: +OUString aURL += m_directories.getURLFromSrc(DATA_DIRECTORY) + "relative-keep-aspect-image.xhtml"; +uno::Sequence aLoadArgs = { +comphelper::makePropertyValue("FilterName", OUString("HTML (StarWriter)")), +comphelper::makePropertyValue("FilterOptions", OUString("xhtmlns=reqif-xhtml")), +}; + +// When loading that file: +mxComponent = loadFromDesktop(aURL, OUString(), aLoadArgs); + +// Then make sure that the aspect ratio of the image is kept: +auto pTextDocument = dynamic_cast(mxComponent.get()); +SwDoc* pDoc = pTextDocument->GetDocShell()->GetDoc(); +const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); +const SwFrameFormat* pFormat = rFormats[0]; +const SwFormatFrameSize& rSize = pFormat->GetFrameSize(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 255 +// - Actual : 0 +// i.e. the height had a fixed value, not "keep aspect". +CPPUNIT_ASSERT_EQUAL(static_cast(SwFormatFrameSize::SYNCED), + static_cast(rSize.GetHeightPercent())); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 5a11fa9c6da6..cbf3727cd775 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -527,10 +527,30 @@ IMAGE_SETEVENT: if (!bHeightProvided) nHeight = aPixelSize.Height(); // tdf#142781 - calculate the width/height keeping the aspect ratio -if (!bPercentWidth && bWidthProvided && !bHeightProvided && aPixelSize.Width()) -nHeight = nWidth * aPixelSize.Height() / aPixelSize.Width(); -else if (!bPercentHeight && !bWidthProvided && bHeightProvided && aPixelSize.Height()) -nWidth = nHeight * aPixelSize.Width() / aPixelSize.Height(); +if (bWidthProvided && !bHeightProvided && aPixelSize.Width()) +{ +if (bPercentWidth) +{ +nHeight = SwFormatFrameSize::SYNCED; +bPercentHeight = true; +} +else +{ +nHeight = nWidth * aPixelSize.Height() / aPixelSize.Width(); +} +} +else if (!bWidthProvided && bHeightProvided && aPixelSize.Height()) +{ +if (bPercentHeight) +{ +nWidth = SwFormatFrameSize::SYNCED; +bPercentWidth = true; +} +else +{ +nWidth = nHeight * aPixelSize.Width() / aPixelSize.Height(); +} +} } SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); @@ -648,7 +668,11 @@ IMAGE_SETEVENT: // bPercentWidth / bPercentHeight means we have a percent size. If that's not the case and
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf147507.fodt | 77 ++ sw/qa/extras/uiwriter/uiwriter2.cxx | 19 +++ sw/source/core/doc/docredln.cxx |6 +- 3 files changed, 101 insertions(+), 1 deletion(-) New commits: commit 8c8ecb1ff2bfe5d40964736ef86ee3054791c493 Author: László Németh AuthorDate: Mon Sep 19 11:24:19 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Sep 19 17:20:49 2022 +0200 tdf#147507 sw: fix crash with Reject All around not content nodes Regression from commit f3bec764ddbf3fd3ae986f034c89626bf22940e0 "tdf144058 sw track changes: fix table deletion at paragraph join". Conflicts: sw/source/core/doc/docredln.cxx (chrery-picked from commit 7462f728df54c28cea659dbf9aa92070019b489f) Change-Id: If08a2b85c3db9fe92ad623d3d7cb30f2feaaab36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140174 Reviewed-by: László Németh Tested-by: Jenkins diff --git a/sw/qa/extras/uiwriter/data/tdf147507.fodt b/sw/qa/extras/uiwriter/data/tdf147507.fodt new file mode 100644 index ..bd579a4b85c7 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf147507.fodt @@ -0,0 +1,77 @@ + +http://www.w3.org/1999/xlink; xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:ooow="http://openoffice.org/2004/writer; xmlns:oooc="http://openoffice.org/2004/calc; xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:rpt="http://openoffice.org/2005/report; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:officeooo="http://openoffice.org/2009/office; xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names: experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Author + 2004-01-12T03:00:00 + + + + + + + Author + 2004-01-05T21:45:00 + + + + + a + + + + + + + + + + + + + + s + + + diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 38247a36ea4d..0a5fce248c58 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -2036,6 +2036,25 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf144058) CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147507) +{ +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf147507.fodt"); + +// 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())); + +// select all, backspace and reject all crashed +dispatchCommand(mxComponent, ".uno:SelectAll", {}); +dispatchCommand(mxComponent, ".uno:SwBackSpace", {}); +dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {}); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119019) { // check handling of overlapping redlines diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index ec164f5d0bb8..9a7e66051bde 100644 --- a/sw/source/core/doc/docredln.cxx +++
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source xmloff/source
sw/qa/extras/odfexport/data/table-in-frame-in-table-in-header-base.odt |binary sw/qa/extras/odfexport/odfexport.cxx | 14 +++ sw/source/filter/xml/xmltble.cxx | 40 ++ sw/source/filter/xml/xmltexte.hxx |4 + xmloff/source/text/txtparae.cxx|6 + 5 files changed, 47 insertions(+), 17 deletions(-) New commits: commit ec447be0adc32a16af02732fab4af22bc17e02cd Author: Mike Kaganski AuthorDate: Tue Sep 13 20:42:22 2022 +0300 Commit: Xisco Fauli CommitDate: Wed Sep 14 14:14:47 2022 +0200 tdf#150927: properly handle nesting in tables This re-implements the relevant part of commit 35021cd56b3b4e38035804087f215c80085564be, to follow the same recursion logic that is used in SwXMLExport::ExportTable. Additionally, it found a place where XML was still emitted when collecting autostyles (breaks were exported); fixed. Change-Id: I3b7eed06e0eca9ad20304b45db4c3e9d72478c9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139901 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 58cb4fc7d17ae5b339c5ed6ae139e6ef2433c927) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139843 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/odfexport/data/table-in-frame-in-table-in-header-base.odt b/sw/qa/extras/odfexport/data/table-in-frame-in-table-in-header-base.odt new file mode 100644 index ..44dbf0bdec69 Binary files /dev/null and b/sw/qa/extras/odfexport/data/table-in-frame-in-table-in-header-base.odt differ diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 45e690a7643c..87a7f93893cf 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -3182,6 +3182,20 @@ CPPUNIT_TEST_FIXTURE(Test, tdf135942) assertXPath(pXmlDoc, "/office:document-styles/office:automatic-styles/style:style[@style:family='table']", 2); } +CPPUNIT_TEST_FIXTURE(Test, tdf150927) +{ +// Similar to tdf135942 + +loadAndReload("table-in-frame-in-table-in-header-base.odt"); +// All table autostyles should be collected, including nested, and must not crash. + +CPPUNIT_ASSERT_EQUAL(1, getPages()); + +xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + +assertXPath(pXmlDoc, "/office:document-styles/office:automatic-styles/style:style[@style:family='table']", 2); +} + DECLARE_ODFEXPORT_TEST(testGutterLeft, "gutter-left.odt") { CPPUNIT_ASSERT_EQUAL(1, getPages()); diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index 81528e5b8c2f..8065c6ad1dbd 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -1173,6 +1173,30 @@ void SwXMLTextParagraphExport::exportTableAutoStyles() { } } +void SwXMLTextParagraphExport::CollectTableLinesAutoStyles(const SwTableLines& rLines, + SwFrameFormat& rFormat, bool _bProgress) +{ +// Follow SwXMLExport::ExportTableLines/ExportTableLine/ExportTableBox +for (const SwTableLine* pLine : rLines) +{ +for (SwTableBox* pBox : pLine->GetTabBoxes()) +{ +if (pBox->getRowSpan() <= 0) +continue; +if (pBox->GetSttNd()) +{ +if (rtl::Reference xCell = SwXCell::CreateXCell(, pBox)) +exportText(xCell, true /*bAutoStyles*/, _bProgress, true /*bExportParagraph*/); +} +else +{ +// no start node -> merged cells: export subtable in cell +CollectTableLinesAutoStyles(pBox->GetTabLines(), rFormat, _bProgress); +} +} +} +} + void SwXMLTextParagraphExport::exportTable( const Reference < XTextContent > & rTextContent, bool bAutoStyles, bool _bProgress ) @@ -1209,21 +1233,7 @@ void SwXMLTextParagraphExport::exportTable( maTableNodes.push_back(pTableNd); m_TableFormats.emplace(pTableNd, ::std::make_pair(SwXMLTextParagraphExport::FormatMap(), SwXMLTextParagraphExport::FormatMap())); // Collect all tables inside cells of this table, too -const auto aCellNames = pXTable->getCellNames(); -for (const OUString& rCellName : aCellNames) -{ - css::uno::Reference xCell( -pXTable->getCellByName(rCellName), css::uno::UNO_QUERY); -if (!xCell) -continue; -auto xEnumeration = xCell->createEnumeration(); -while (xEnumeration->hasMoreElements()) -{ -if (css::uno::Reference xInnerTable{ -
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/filter/html/data/ole2.ole | 1014 ++ sw/qa/filter/html/data/ole2.png |binary sw/qa/filter/html/data/relative-keep-aspect.xhtml |5 sw/qa/filter/html/html.cxx| 31 sw/source/filter/html/htmlplug.cxx| 18 5 files changed, 1066 insertions(+), 2 deletions(-) New commits: commit 10fe7327fd6e922bacf0ad4e1110ce4d9fab347d Author: Miklos Vajna AuthorDate: Tue Sep 6 16:14:47 2022 +0200 Commit: Xisco Fauli CommitDate: Wed Sep 7 08:17:52 2022 +0200 sw HTML import: fix height of OLE objs when it is missing and width is relative In case an OLE object's fallback bitmap had a width=100% size but no explicit height, we used to set the OLE object's size to a fixed value, based on the bitmap's pixel size. Falling back to the pixel size based on the current DPI is sensible if there is no height specified, but browsers keep the aspect ratio when only width or height is specified and we didn't. Fix the problem by explicitly checking for the "one axis has percent size, the other is unset" scenario in SwHTMLParser::InsertEmbed() and then handling the new SwFormatFrameSize::SYNCED value in SwHTMLParser::SetFixSize(). Note that SetFixSize() is not used for bitmaps (only for OLE objects), so that codepath may still need a similar fix. Change-Id: I9f70307edbfbb06e228494fb5c04e7381ed8e5cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139526 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 456abae730a787693c3ad98f7e57eba5f6163a76) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139513 Reviewed-by: Xisco Fauli diff --git a/sw/qa/filter/html/data/ole2.ole b/sw/qa/filter/html/data/ole2.ole new file mode 100644 index ..96407e88fa3d --- /dev/null +++ b/sw/qa/filter/html/data/ole2.ole @@ -0,0 +1,1014 @@ +{\object\objemb{\*\objclass PowerPoint.Show.12}\objw10020\objh5638{\*\objdata +0105 +0200 +1300 +506f776572506f696e742e53686f772e313200 + + +0094 +d0cf11e0a1b11ae13e000300feff090006 +000100011002000100feff +ff +ff +ff +ff +ff +ff +ff +ff +ff +ff +ff +fffdff4700feff480005000600070008000900 +0a000b000c000d000e000f0010001100120013 +001400150016001700180019001a001b001c00 +1d001e001f0020002100220023002400250026 +002700280029002a002b002c002d002e002f003000 +3100320033003400350036003700380039003a +003b003c003d003e003f004000410042004300 +440045004600fefffefffe +ff +ff +ff +ff +ff +52006f006f007400200045006e007400720079 +0016000500 +0200f4554fcf878f474d80bb5808164bb3f800 +0080609bf8f8bcd301030301004f006c006500 +00 +000a000201 +14005000610063006b +00610067006500 +12010100040000
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/htmlexport/data/paint-ole-bitmap-format.odt |binary sw/qa/extras/htmlexport/htmlexport.cxx | 33 +++ sw/source/filter/html/htmlreqifreader.cxx|6 ++ 3 files changed, 39 insertions(+) New commits: commit 4ab41c7e420ebba3a95457c0900eac41707e61f5 Author: Miklos Vajna AuthorDate: Tue Aug 30 15:00:19 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Sep 5 16:58:58 2022 +0200 sw reqif/xhtml export: fix invalid pixel formats of graphics exported as OLE When exporting a Writer document to reqif-xhtml in ExportImagesAsOLE mode with something like: soffice.bin --convert-to 'xhtml:HTML (StarWriter):{"XhtmlNs":{"type":"string","value":"reqif-xhtml"},"ExportImagesAsOLE":{"type":"boolean","value":"true"}}' test.odt images are exported as ms paint ole objects instead of plain images. This happens in WrapGraphicInRtf(), using GraphicConverter::Export() where we just specify we want a BMP output. This usually works, but not when the bitmap format is something exotic where we try to keep that format in BMP, but ms paint can't handle it. When this happens, we get an RPC_E_SERVERFAULT error from OleRun() in OleComponent::RunObject(), which doesn't say much, except that ms paint failed to read the byte array we handed out. Fix the problem by ensuring that if a graphic is exported as OLE data, then it always has the 24bit pixel format. Interestingly a 8bit BMP can be opened in ms paint manually, but not when embedding it as OLE object. Change-Id: I2285bf67c4528cde208ae9fba42ece56822f5403 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139044 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 13219c632b7ec154ba882a715cf890b54f10b146) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139422 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/htmlexport/data/paint-ole-bitmap-format.odt b/sw/qa/extras/htmlexport/data/paint-ole-bitmap-format.odt new file mode 100644 index ..d83b89459773 Binary files /dev/null and b/sw/qa/extras/htmlexport/data/paint-ole-bitmap-format.odt differ diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index ab4d71a7d02e..76333c842d96 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -1310,6 +1311,38 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1Paint) CPPUNIT_ASSERT_EQUAL(OString("PBrush"), aClassName); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PaintBitmapFormat) +{ +// Given a document with a 8bpp bitmap: +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "paint-ole-bitmap-format.odt"; +mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + +// When exporting to reqif-xhtml with ExportImagesAsOLE enabled: +uno::Reference xStorable(mxComponent, uno::UNO_QUERY); +uno::Sequence aStoreProperties = { +comphelper::makePropertyValue("FilterName", OUString("HTML (StarWriter)")), +comphelper::makePropertyValue("FilterOptions", OUString("xhtmlns=reqif-xhtml")), +comphelper::makePropertyValue("ExportImagesAsOLE", true), +}; +xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties); + +// Then make sure the resulting bitmap is 24bpp: +OUString aRtfUrl = GetOlePath(); +SvMemoryStream aOle1; +ParseOle1FromRtfUrl(aRtfUrl, aOle1); +OLE1Reader aOle1Reader(aOle1); +Bitmap aBitmap; +SvMemoryStream aMemory; +aMemory.WriteBytes(aOle1Reader.m_aNativeData.data(), aOle1Reader.m_aNativeData.size()); +aMemory.Seek(0); +CPPUNIT_ASSERT(ReadDIB(aBitmap, aMemory, true)); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 24 +// - Actual : 8 +// i.e. it was not a pixel format ms paint could handle in OLE mode. +CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N24_BPP, aBitmap.getPixelFormat()); +} + CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testMultiParaListItem) { // Create a document with 3 list items: A, B and D. diff --git a/sw/source/filter/html/htmlreqifreader.cxx b/sw/source/filter/html/htmlreqifreader.cxx index fd18353cf217..0387bb39447f 100644 --- a/sw/source/filter/html/htmlreqifreader.cxx +++ b/sw/source/filter/html/htmlreqifreader.cxx @@ -550,6 +550,12 @@ bool WrapGraphicInRtf(const Graphic& rGraphic, const SwFrameFormat& rFormat, SvS BitmapEx aBitmapEx = rGraphic.GetBitmapEx(); Bitmap aBitmap = aBitmapEx.GetBitmap(/*aTransparentReplaceColor=*/COL_WHITE); +if (aBitmap.getPixelFormat() != vcl::PixelFormat::N24_BPP) +{ +// More exotic pixel formats cause trouble for ms paint. +aBitmap.Convert(BmpConversion::N24Bit); +} +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/inline-sdt-header.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport18.cxx |6 ++ sw/source/filter/ww8/docxattributeoutput.cxx |3 +++ sw/source/filter/ww8/docxattributeoutput.hxx |1 + 4 files changed, 10 insertions(+) New commits: commit e1aad6d8fcb17fe893e9270ff42378aed450faa3 Author: Miklos Vajna AuthorDate: Wed Aug 31 11:17:43 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Sep 5 14:16:27 2022 +0200 crashtesting: fix DOCX export of forum-mso-de-102317.docx This went wrong in b2bc4ea8ddae6b01f344469d988e21fed3143c42 (DOCX import: handle SDT around citation field, 2014-07-16), the problem is that a run/inline SDT is pending, but we wrote a header stream in the meantime, so the invariant that Start/EndParagraph() in DocxAttributeOutput is called in pairs doesn't help, which results in not-well-formed XML, which is an assertion failure in debug build. Fix the problem similar to 5f3af56b2c0ef6c628a7cfe5ce6e86f8e1765f5f (sw: refactoring for docx sdt blocks output, 2021-11-16), which already did the same for paragraph/block SDTs. Change-Id: I5e7273b839bb5c1f841c0fab9b68b4ca239cca18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139089 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 8431cde61432893dd5ba75d8244457306a9f177b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139420 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/inline-sdt-header.docx b/sw/qa/extras/ooxmlexport/data/inline-sdt-header.docx new file mode 100644 index ..0a6009c2cd1b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/inline-sdt-header.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index e47e72667310..a2d5f2cca2b2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -56,6 +56,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf150197_predefinedNumbering) CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(getParagraph(1), "ListLabelString")); } +CPPUNIT_TEST_FIXTURE(Test, testInlineSdtHeader) +{ +// Without the accompanying fix in place, this test would have failed with an assertion failure, +// we produced not-well-formed XML on save. +loadAndSave("inline-sdt-header.docx"); +} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 1014f69ed64b..94d1f19294d0 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6806,6 +6806,8 @@ void DocxAttributeOutput::pushToTableExportContext(DocxTableExportContext& rCont rContext.m_bStartedParaSdt = m_aParagraphSdt.m_bStartedSdt; m_aParagraphSdt.m_bStartedSdt = false; +rContext.m_bStartedRunSdt = m_aRunSdt.m_bStartedSdt; +m_aRunSdt.m_bStartedSdt = false; } void DocxAttributeOutput::popFromTableExportContext(DocxTableExportContext const & rContext) @@ -6814,6 +6816,7 @@ void DocxAttributeOutput::popFromTableExportContext(DocxTableExportContext const m_tableReference->m_bTableCellOpen = rContext.m_bTableCellOpen; m_tableReference->m_nTableDepth = rContext.m_nTableDepth; m_aParagraphSdt.m_bStartedSdt = rContext.m_bStartedParaSdt; +m_aRunSdt.m_bStartedSdt = rContext.m_bStartedRunSdt; } void DocxAttributeOutput::WriteTextBox(uno::Reference xShape) diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 6dc6ea3cffb9..09dcc375a3b9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -1102,6 +1102,7 @@ struct DocxTableExportContext ww8::WW8TableInfo::Pointer_t m_pTableInfo; bool m_bTableCellOpen; bool m_bStartedParaSdt; +bool m_bStartedRunSdt; sal_uInt32 m_nTableDepth; DocxTableExportContext(DocxAttributeOutput& rOutput) : m_rOutput(rOutput) { m_rOutput.pushToTableExportContext(*this); } ~DocxTableExportContext() { m_rOutput.popFromTableExportContext(*this); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/htmlexport/htmlexport.cxx | 57 + sw/source/filter/html/wrthtml.cxx |3 + 2 files changed, 59 insertions(+), 1 deletion(-) New commits: commit 184a9eec62058dcbe185d74cfd40a3772d3b801d Author: Vasily Melenchuk AuthorDate: Fri Aug 26 16:32:57 2022 +0300 Commit: Thorsten Behrens CommitDate: Wed Aug 31 03:48:51 2022 +0200 tdf#114769: sw html export: better handling for relative URLs Usage of INetURLObject makes sense only in case of full URLs, but once relative one is provided it will contain invalid data. Change-Id: Icc5e191e2337a3dd9a76c660b1c7709551099a1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138875 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit 599da3fa69805ebf8dee4517855fd8706e19d11d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138979 diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 5e5af5e70a17..ab4d71a7d02e 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -2392,6 +2392,63 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSectionDir) assertXPath(pXmlDoc, "//reqif-xhtml:div[@id='mysect']", "style", "dir: ltr"); } +CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf114769) +{ +// Create document from scratch since relative urls to filesystem can be replaced +// by absolute during save/load +SwDoc* pDoc = createSwDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +pWrtShell->Insert("Hyperlink1"); +pWrtShell->SplitNode(); +pWrtShell->Insert("Hyperlink2"); +pWrtShell->SplitNode(); +pWrtShell->Insert("Hyperlink3"); +pWrtShell->SplitNode(); +pWrtShell->Insert("Hyperlink4"); +pWrtShell->SplitNode(); +pWrtShell->Insert("Hyperlink5"); +pWrtShell->SplitNode(); + +// Normal external URL +uno::Reference xRun(getRun(getParagraph(1), 1), uno::UNO_QUERY); +xRun->setPropertyValue("HyperLinkURL", uno::Any(OUString("http://libreoffice.org/;))); + +// Bookmark reference +xRun.set(getRun(getParagraph(2), 1), uno::UNO_QUERY); +xRun->setPropertyValue("HyperLinkURL", uno::Any(OUString("#some_bookmark"))); + +// Filesystem absolute link +xRun.set(getRun(getParagraph(3), 1), uno::UNO_QUERY); +xRun->setPropertyValue("HyperLinkURL", uno::Any(OUString("C:\\test.txt"))); + +// Filesystem relative link +xRun.set(getRun(getParagraph(4), 1), uno::UNO_QUERY); +xRun->setPropertyValue("HyperLinkURL", uno::Any(OUString("..\\..\\test.odt"))); + +// Filesystem relative link +xRun.set(getRun(getParagraph(5), 1), uno::UNO_QUERY); +xRun->setPropertyValue("HyperLinkURL", uno::Any(OUString(".\\another.odt"))); + +// Export +uno::Reference xStorable(mxComponent, uno::UNO_QUERY); +uno::Sequence aStoreProperties += { comphelper::makePropertyValue("FilterName", OUString("HTML (StarWriter)")) }; +xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties); + +htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); +CPPUNIT_ASSERT(pHtmlDoc); + +CPPUNIT_ASSERT_EQUAL(OUString("http://libreoffice.org/;), + getXPath(pHtmlDoc, "/html/body/p[1]/a", "href")); +CPPUNIT_ASSERT_EQUAL(OUString("#some_bookmark"), + getXPath(pHtmlDoc, "/html/body/p[2]/a", "href")); +CPPUNIT_ASSERT_EQUAL(OUString("C:\\test.txt"), getXPath(pHtmlDoc, "/html/body/p[3]/a", "href")); +CPPUNIT_ASSERT_EQUAL(OUString("..\\..\\test.odt"), + getXPath(pHtmlDoc, "/html/body/p[4]/a", "href")); +CPPUNIT_ASSERT_EQUAL(OUString(".\\another.odt"), + getXPath(pHtmlDoc, "/html/body/p[5]/a", "href")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 0cede88912d3..f0a963972859 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -1334,7 +1334,8 @@ OUString SwHTMLWriter::convertHyperlinkHRefValue(const OUString& rURL) { // Link is not started from "#", so looks like external link. Encode this URL. INetURLObject aURL(sURL); -sURL = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); +if (!aURL.HasError()) +sURL = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); } return URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), sURL ); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter3.cxx | 70 sw/source/core/frmedt/fetab.cxx | 23 +++ 2 files changed, 93 insertions(+) New commits: commit 6b86e529fb6681bbd8207ee7f3d9e57cb2e55502 Author: László Németh AuthorDate: Wed Aug 24 17:10:56 2022 +0200 Commit: László Németh CommitDate: Thu Aug 25 19:05:18 2022 +0200 tdf#150576 sw: fix cursor pos deleting at rows deleted already Instead of jumping in the start of the document, set cursor after (or deleting the last row, before) the rows deleted already in Hide Changes mode with enabled change tracking. Regression from commit a74c51025fa4519caaf461492e4ed8e68bd34885 "tdf#146962 sw: hide deleted row at deletion in Hide Changes". Follow-up to commit 189aa05c6ea17a8e823b4eab18ea0d1131d9d73e "tdf#148849 sw: fix cursor pos at tracked DeleteRow in Hide Changes". Conflicts: sw/qa/extras/uiwriter/uiwriter3.cxx Change-Id: Ifc2a7f41a57f413d27d9b464a0e464643d15f404 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138772 Tested-by: Jenkins Reviewed-by: László Németh Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138786 Tested-by: László Németh diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 9479e34858bd..6d93e784f394 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -3564,6 +3564,76 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf148849) CPPUNIT_ASSERT_EQUAL(OUString("Row 2"), rNode.GetTextNode()->GetText()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf150576) +{ +// load a document with a table and an empty paragraph before the table +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf148849.fodt"); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + +// record changes +pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete + | RedlineFlags::ShowInsert); +CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); +// hide changes +dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); +CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines()); + +uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xTables(xTablesSupplier->getTextTables(), +uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); + +// Check deletion of the first row, if the second row deleted already + +// put cursor in the second table row +pWrtShell->Down(/*bSelect=*/false, /*nCount=*/2); +SwNode& rNode = pWrtShell->GetCursor()->GetNode(); +CPPUNIT_ASSERT_EQUAL(OUString("Row 2"), rNode.GetTextNode()->GetText()); + +// delete the second table row +pWrtShell->DeleteRow(); + +// check cursor position (row 3) +SwNode& rNode2 = pWrtShell->GetCursor()->GetNode(); +CPPUNIT_ASSERT_EQUAL(OUString("Row 3"), rNode2.GetTextNode()->GetText()); + +// put cursor in the first row +pWrtShell->Up(/*bSelect=*/false, /*nCount=*/1); +SwNode& rNode3 = pWrtShell->GetCursor()->GetNode(); +CPPUNIT_ASSERT_EQUAL(OUString("12"), rNode3.GetTextNode()->GetText()); + +// delete the first row +pWrtShell->DeleteRow(); + +// This was empty (cursor jumped in the start of the document instead of +// the next not deleted row) +SwNode& rNode4 = pWrtShell->GetCursor()->GetNode(); +CPPUNIT_ASSERT_EQUAL(OUString("Row 3"), rNode4.GetTextNode()->GetText()); + +// Check skipping previous lines + +// restore deleted rows +dispatchCommand(mxComponent, ".uno:Undo", {}); +dispatchCommand(mxComponent, ".uno:Undo", {}); +Scheduler::ProcessEventsToIdle(); +SwNode& rNode5 = pWrtShell->GetCursor()->GetNode(); +CPPUNIT_ASSERT_EQUAL(OUString("Row 2"), rNode5.GetTextNode()->GetText()); + +// delete the second row +pWrtShell->DeleteRow(); +SwNode& rNode7 = pWrtShell->GetCursor()->GetNode(); +CPPUNIT_ASSERT_EQUAL(OUString("Row 3"), rNode7.GetTextNode()->GetText()); + +// delete the third, i.e. last row +pWrtShell->DeleteRow(); +SwNode& rNode8 = pWrtShell->GetCursor()->GetNode(); + +// This was empty (cursor jumped in the start of the document instead of +// the previous not deleted row) +CPPUNIT_ASSERT_EQUAL(OUString("12"), rNode8.GetTextNode()->GetText()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132603) { createSwDoc(); diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index c5053080d8ff..e061bbb49b68 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -417,6 +417,16 @@ bool SwFEShell::DeleteRow(bool bCompleteTable) } SwTableBox*
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf148849.fodt | 53 ++ sw/qa/extras/uiwriter/uiwriter3.cxx | 34 +++ sw/source/core/frmedt/fetab.cxx | 30 +++- 3 files changed, 108 insertions(+), 9 deletions(-) New commits: commit 16c705ec0d1ab4b4428577ccb0ea3fc14ee0fc88 Author: László Németh AuthorDate: Mon Aug 22 11:18:23 2022 +0200 Commit: László Németh CommitDate: Thu Aug 25 19:05:01 2022 +0200 tdf#148849 sw: fix cursor pos at tracked DeleteRow in Hide Changes In Hide Changes mode, the text cursor jumped to the start of the document after tracked deletion of a table row, instead of remaining in the table in the next table row. Regression from commit a74c51025fa4519caaf461492e4ed8e68bd34885 "tdf#146962 sw: hide deleted row at deletion in Hide Changes". Conflicts: sw/source/core/frmedt/fetab.cxx sw/qa/extras/uiwriter/uiwriter3.cxx Change-Id: Iff959c9a9940db013827e1c827bcb92c07b4b26a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138683 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 189aa05c6ea17a8e823b4eab18ea0d1131d9d73e) Change-Id: I17e11862cf144f150e64082e7c8b22c3877fbc2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138785 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sw/qa/extras/uiwriter/data/tdf148849.fodt b/sw/qa/extras/uiwriter/data/tdf148849.fodt new file mode 100644 index ..07efa8bb6dbd --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf148849.fodt @@ -0,0 +1,53 @@ + + +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"> + + + + + + + xxx4 + 2021-09-21T14:41:20 + + + + + + + xxx4 + 2021-09-21T14:41:20 + + + + + + + + + + + + + + + + + 12 + + + + + Row 2 + + + + + Row 3 + + + + + + + diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 1d5455341839..9479e34858bd 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -3530,6 +3530,40 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf146573) CPPUNIT_ASSERT_EQUAL(OUString("204"), xCellA4->getString()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf148849) +{ +// load a document with a table and an empty paragraph before the table +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf148849.fodt"); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + +// record changes +pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/core/text/text.cxx | 43 + sw/source/core/text/itrtxt.cxx | 37 ++- sw/source/core/text/porrst.cxx | 16 ++- sw/source/core/text/txtfly.cxx | 19 -- 4 files changed, 107 insertions(+), 8 deletions(-) New commits: commit 11d0ac7643b2a558a84931ac38e0e77b48e1e380 Author: Miklos Vajna AuthorDate: Mon Aug 15 15:00:47 2022 +0200 Commit: Michael Stahl CommitDate: Mon Aug 22 11:36:52 2022 +0200 tdf#148289 sw clearing breaks: fix vertical layout There were 3 problems here: 1) SwTextFly::GetMaxBottom() gets an already swapped frame, so going via the aRectFnSet abstraction is not correct, need to use Left() and similar functions directly. 2) SwTextCursor::AdjustBaseLine() centers portions in the vertical case, so a clearing break portion with larger height will push the other portions towards the left, and this is not wanted. Fix this by filtering out the (logic) height of the clearing break portions in the vertical case. 3) The fix for 2) has the side effect that the non-printable line break indicator character now has the wrong (logic) top position in SwBreakPortion::Paint(). Fix this by compensating for the offset done in AdjustBaseLine(). No functional changes intended for the horizontal layout. Change-Id: I9ea27b4247944cbab8e96c5c5e2c8f82bbbd731c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138314 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 251589c17c0dfa33cf5e5e5bb1ed782d2293a67c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138420 Reviewed-by: Michael Stahl diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index d94fb4c63e3b..0e608b097d9d 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -412,6 +412,49 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakLeftRTL) assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]", "height", "276"); } +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakVertical) +{ +// Given a document with an anchored object in a vertical page and a clearing break (type=all): +loadURL("private:factory/swriter", nullptr); +uno::Reference xFactory(mxComponent, uno::UNO_QUERY); +uno::Reference xDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xText = xDocument->getText(); +uno::Reference xCursor = xText->createTextCursor(); +uno::Reference xStandard(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); +xStandard->setPropertyValue("WritingMode", uno::Any(text::WritingMode2::TB_RL)); +{ +uno::Reference xShape( +xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); +xShape->setSize(awt::Size(5000, 5000)); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); +xShapeProps->setPropertyValue("AnchorType", + uno::Any(text::TextContentAnchorType_AT_CHARACTER)); +uno::Reference xShapeContent(xShape, uno::UNO_QUERY); +xText->insertTextContent(xCursor, xShapeContent, /*bAbsorb=*/false); +} +uno::Reference xLineBreak( +xFactory->createInstance("com.sun.star.text.LineBreak"), uno::UNO_QUERY); +uno::Reference xLineBreakProps(xLineBreak, uno::UNO_QUERY); +auto eClear = static_cast(SwLineBreakClear::ALL); +xLineBreakProps->setPropertyValue("Clear", uno::Any(eClear)); +xText->insertString(xCursor, "foo", /*bAbsorb=*/false); +xText->insertTextContent(xCursor, xLineBreak, /*bAbsorb=*/false); +xText->insertString(xCursor, "bar", /*bAbsorb=*/false); + +// When laying out that document: +calcLayout(); + +// Then make sure the "bar" does jump (logic) down the correct amount: +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 2837 +// - Actual : 7135 +// i.e. the expected break height is the twips value of the 5cm rectangle size, it was much +// more. +assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]/SwBreakPortion", "height", "2837"); +} + CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakHeader) { // Given a document with a shape in the header and a clearing break in the body text: diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx index 53e084b03736..1d1eed3e0837 100644 --- a/sw/source/core/text/itrtxt.cxx +++ b/sw/source/core/text/itrtxt.cxx @@ -27,6 +27,7 @@ #include #include #include "porfld.hxx" +#include "porrst.hxx" #include "itrtxt.hxx" #include @@ -283,7 +284,41 @@ SwTwips SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine, if
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source writerfilter/source
sw/qa/extras/rtfexport/data/tdf150267.rtf | 209 ++ sw/qa/extras/rtfexport/rtfexport5.cxx | 21 + sw/source/filter/ww8/rtfexport.cxx| 54 sw/source/filter/ww8/rtfexport.hxx|2 writerfilter/source/rtftok/rtfcontrolwords.hxx|1 writerfilter/source/rtftok/rtfdispatchdestination.cxx |3 writerfilter/source/rtftok/rtfdocumentimpl.cxx| 26 ++ writerfilter/source/rtftok/rtfdocumentimpl.hxx|9 8 files changed, 325 insertions(+) New commits: commit 8d36537cea6d976e3fc2a8471d7f52660603839d Author: Samuel Mehrbrodt AuthorDate: Thu Aug 18 11:13:31 2022 +0200 Commit: Michael Stahl CommitDate: Mon Aug 22 11:38:24 2022 +0200 tdf#150267 RTF: Import/Export unused document variables Previously document variables were only imported when there was a field in the document using them. This adds import/export for the RTF `docvar` group. Change-Id: I25099e037594f4b4c5530ba3a28c64aaa2927918 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138482 Reviewed-by: Michael Stahl Tested-by: Jenkins (cherry picked from commit 634bb0db617d02f1aeea89f4555a5e34baaa4e91) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138539 diff --git a/sw/qa/extras/rtfexport/data/tdf150267.rtf b/sw/qa/extras/rtfexport/data/tdf150267.rtf new file mode 100644 index ..704afa39a3f8 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf150267.rtf @@ -0,0 +1,209 @@ +{\rtf1\adeflang1025\ansi\ansicpg1250\uc1\adeff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1038\deflangfe1038\themelang1038\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;} +{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} +{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f40\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f41\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\f43\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f44\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f45\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f46\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\f47\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f48\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f40\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f41\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\f43\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f44\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f45\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f46\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\f47\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f48\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f430\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f431\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;} +{\f433\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f434\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f435\fbidi \fswiss\fcharset177\fprq2 Calibri (Hebrew);}{\f436\fbidi \fswiss\fcharset178\fprq2 Calibri (Arabic);} +{\f437\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f438\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} +{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/uitest/data/tdf150443.docx|binary sw/qa/uitest/writer_tests7/tdf150443.py | 46 sw/source/uibase/misc/redlndlg.cxx |4 ++ 3 files changed, 50 insertions(+) New commits: commit a91ad83e5eb83625ee0e1c9250365c5dc494f845 Author: László Németh AuthorDate: Thu Aug 18 12:00:32 2022 +0200 Commit: László Németh CommitDate: Fri Aug 19 13:03:44 2022 +0200 tdf#150443 sw: fix crash of rejecting table row deletion Joining "Delete" redlines of deleted table row with overlapping tracked formatting change with same time stamp resulted bad tree parent in Manage Changes dialog window (tracked formatting change instead of tracked deletion, see its pencil icon before this fix), crashing at its rejection. Regression from commit eebe4747d2d13545004937bb0267ccfc8ab9d63f "tdf#144270 sw: manage tracked table (row) deletion/insertion". Change-Id: Ia0f0b1fdff96f4acbe14025f8016e39ce95c7f09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138474 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 6f05dea5d93445042775cb8c8a8dd400e4dda3a6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138428 Tested-by: Jenkins diff --git a/sw/qa/uitest/data/tdf150443.docx b/sw/qa/uitest/data/tdf150443.docx new file mode 100644 index ..162aec01f928 Binary files /dev/null and b/sw/qa/uitest/data/tdf150443.docx differ diff --git a/sw/qa/uitest/writer_tests7/tdf150443.py b/sw/qa/uitest/writer_tests7/tdf150443.py new file mode 100644 index ..8cca7c78e6c8 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf150443.py @@ -0,0 +1,46 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf150443(UITestCase): + +def test_tdf150443(self): +with self.ui_test.load_file(get_url_for_data_file("tdf150443.docx")) as document: +xWriterDoc = self.xUITest.getTopFocusWindow() +xWriterEdit = xWriterDoc.getChild("writer_edit") +xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + +# search term "Jump here!" +with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: +searchterm = xDialog.getChild("searchterm") +searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Jump here!"})) +xsearch = xDialog.getChild("search") +xsearch.executeAction("CLICK", tuple()) #first search +xToolkit.processEventsToIdle() + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "4") + +# reject the tracked table row in Manage Changes dialog window +with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: +changesList = xTrackDlg.getChild("writerchanges") + +items = len(changesList.getChildren()) + +# select tree parent of the actual tracked row deletion in tree list +changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) +xToolkit.processEventsToIdle() + +# Without the fix in place, it would have crashed here +xAccBtn = xTrackDlg.getChild("reject") +xAccBtn.executeAction("CLICK", tuple()) +self.assertEqual(items - 1, len(changesList.getChildren())) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 2b12439494b8..a80fd90ee0f3 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -828,7 +828,11 @@ void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedli else nNewTableParent = i; } +else +nPrevRowChange = SwRedlineTable::npos; } +else +nPrevRowChange = SwRedlineTable::npos; bool bRowChange(SwRedlineTable::npos != nLastChangeInRow);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/core/docnode/docnode.cxx |4 +- sw/qa/extras/layout/data/tdf145719.odt |binary sw/qa/extras/layout/layout2.cxx | 34 +++ sw/qa/extras/ooxmlexport/data/tdf149388.docx |binary sw/qa/extras/ooxmlexport/data/tdf149388_fly.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 32 - sw/qa/extras/ooxmlexport/ooxmlexport16.cxx |7 ++-- sw/source/core/doc/docredln.cxx |6 +++- 8 files changed, 75 insertions(+), 8 deletions(-) New commits: commit 7d410442ad6d04a3da71d8b0f6ceca6e5e30adbf Author: László Németh AuthorDate: Wed Aug 3 14:11:36 2022 +0200 Commit: László Németh CommitDate: Fri Aug 19 08:01:34 2022 +0200 tdf#149388 sw: add better limit to detect tracked text moving Detection of tracked text moving needs at least 6 characters with an inner space after stripping white spaces of its redline. This way frequent deletion and insertion of articles or other common word parts, e.g. 'the' and 'of a' won't detected as text moving by mistake. Note: to still detect their redlines, as text moving, update test document of testTdf145719 to contain moved text "dolor sit" instead of "dolor", also testRedlineMoving to move list item "An ItemIt" instead of "It", and add testTdf149388 with test document of the original testTdf132371, where redline containing "Third" is not detected as text moving, unlike the new test document of the new testTdf132371, which contains "Third etc." (at least 6 character text with at least an inner space). Change-Id: I7f24fadebe2e21ae303677f74001dbc2d2ad87a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137749 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 4b885c30c292f4a08983630cb140e16a437cc63d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137814 diff --git a/sw/qa/core/docnode/docnode.cxx b/sw/qa/core/docnode/docnode.cxx index 4dbf3630f3f4..4967b95d955d 100644 --- a/sw/qa/core/docnode/docnode.cxx +++ b/sw/qa/core/docnode/docnode.cxx @@ -40,10 +40,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf150086) // Load a document where an insert redline ends right before a ToC SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf150086.docx"); const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); -CPPUNIT_ASSERT_EQUAL(static_cast(9), rTable.size()); +CPPUNIT_ASSERT_EQUAL(static_cast(8), rTable.size()); // This was "Conte" (stripped redline) -CPPUNIT_ASSERT_EQUAL(OUString("Content"), rTable[6]->GetText()); +CPPUNIT_ASSERT_EQUAL(OUString("Content\n"), rTable[6]->GetText()); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/layout/data/tdf145719.odt b/sw/qa/extras/layout/data/tdf145719.odt index 62e4cc4a73e4..5f2c6f665853 100644 Binary files a/sw/qa/extras/layout/data/tdf145719.odt and b/sw/qa/extras/layout/data/tdf145719.odt differ diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index d602d74c9bba..00d7a8e65a48 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -508,6 +508,40 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving) xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); +// text and numbering colors show moving of the list item +// tdf#145719: the moved text item "It" is not detected as text moving, +// because it consists of less than 6 characters after stripping its spaces +assertXPath(pXmlDoc, "/metafile/push/push/push/textcolor[@color='#008000']", 0); +assertXPath(pXmlDoc, "/metafile/push/push/push/font[@color='#008000']", 0); +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving2) +{ +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf42748.fodt"); +SwDocShell* pShell = pDoc->GetDocShell(); + +// create a 3-element list without change tracking +SwEditShell* const pEditShell(pDoc->GetEditShell()); +pEditShell->RejectRedline(0); +pEditShell->AcceptRedline(0); + +// extend the first item to "An ItemIt", because detection of move needs +// at least 6 characters with an inner space after stripping white spaces +// of the redline +dispatchCommand(mxComponent, ".uno:GoToStartOfDoc", {}); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +pWrtShell->Insert("An Item"); + +// move down first list item with track changes +dispatchCommand(mxComponent, ".uno:TrackChanges", {}); +dispatchCommand(mxComponent, ".uno:MoveDown", {}); + +// Dump the rendering of the first page as an XML file. +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; +xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +CPPUNIT_ASSERT(pXmlDoc); + // text and numbering colors show moving of the
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/odfexport/data/tdf150394.odt |binary sw/qa/extras/odfexport/odfexport.cxx |6 ++ sw/source/core/text/guess.cxx |7 ++- 3 files changed, 12 insertions(+), 1 deletion(-) New commits: commit 301c94a73b96c45cb4bf6ed23b7626cb43a98605 Author: László Németh AuthorDate: Mon Aug 15 12:12:23 2022 +0200 Commit: László Németh CommitDate: Fri Aug 19 07:59:27 2022 +0200 tdf#150394 sw: fix crash of "Don't hyphenate last word" Multiline last words, e.g. long URLs resulted crashing using the new hyphenation option "Don't hyphenate last word". Follow-up to commit 8c018910ae4d8701b1ce2a95727b9baed4016da3 "tdf#149248 sw offapi xmloff: add option to not hyphenate last word". Note: .fodt format is not applicable for unit testing. Change-Id: I8633af1517f09003b40a06825ad14f3ed7f882a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138296 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 619a00a0e6ec7d7c2462b533e0ba506732d94e8e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138424 diff --git a/sw/qa/extras/odfexport/data/tdf150394.odt b/sw/qa/extras/odfexport/data/tdf150394.odt new file mode 100644 index ..e514f405bcd3 Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf150394.odt differ diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 73b9bcfbf6d0..45e690a7643c 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -3045,6 +3045,12 @@ DECLARE_ODFEXPORT_TEST(tdf149248, "tdf149248.odt") CPPUNIT_ASSERT_EQUAL(true, getProperty(getParagraph(4), "ParaHyphenationNoLastWord")); } +DECLARE_ODFEXPORT_TEST(testTdf150394, "tdf150394.odt") +{ +// crashes at import time +CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + DECLARE_ODFEXPORT_TEST(tdf149324, "tdf149324.odt") { CPPUNIT_ASSERT_EQUAL(1, getPages()); diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index d469083f7eb1..d209105cd523 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -254,7 +254,12 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo , // don't hyphenate the last word of the paragraph if ( bHyphenationNoLastWord && sal_Int32(m_nCutPos) > nLastWord && -TextFrameIndex(COMPLETE_STRING) != m_nCutPos ) +TextFrameIndex(COMPLETE_STRING) != m_nCutPos && +// if the last word is multiple line long, e.g. an URL, +// apply this only if the space before the word is there +// in the actual line, i.e. start the long word in a new +// line, but still allows to break its last parts +sal_Int32(rInf.GetIdx()) < nLastWord ) { m_nCutPos = TextFrameIndex(nLastWord); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/odfimport/data/forcepoint108.fodt | 67 +++ sw/qa/extras/odfimport/odfimport.cxx| 12 +++ sw/source/filter/xml/XMLRedlineImportHelper.cxx | 81 3 files changed, 159 insertions(+), 1 deletion(-) New commits: commit 2d16f0639b74bcc9328fbb77f774cf9141d1675b Author: Michael Stahl AuthorDate: Mon Aug 15 20:47:13 2022 +0200 Commit: Thorsten Behrens CommitDate: Thu Aug 18 10:55:26 2022 +0200 forcepoint#108 sw: prevent creating SwRangeRedline anchored in itself the SwRangeRedline in frame #8 triggers deleting itself at frame #0 which repeats the DeleteSection attempt which is already in progress #0 SwRangeRedline::~SwRangeRedline() (this=0x5335300) at sw/source/core/doc/docredln.cxx:1168 #1 0x7fffc9b91aab in SwRedlineTable::DeleteAndDestroy(unsigned long) (this=0x4f388f8, nP=0) at sw/source/core/doc/docredln.cxx:669 #2 0x7fffc9c8454a in sw::DocumentRedlineManager::DeleteRedline(SwPaM const&, bool, RedlineType) (this=0x4f388e0, rRange=SwPaM = {...}, bSaveInUndo=true, nDelType=RedlineType::Any) at sw/source/core/doc/DocumentRedlineManager.cxx:2578 #3 0x7fffc9c84a2f in sw::DocumentRedlineManager::DeleteRedline(SwStartNode const&, bool, RedlineType) (this=0x4f388e0, rNode=..., bSaveInUndo=true, nDelType=RedlineType::Any) at sw/source/core/doc/DocumentRedlineManager.cxx:2676 #4 0x7fffc9c1c57f in sw::DocumentContentOperationsManager::DeleteSection(SwNode*) (this=0x4f3b460, pNode=0x5331780) at sw/source/core/doc/DocumentContentOperationsManager.cxx:2092 #5 0x7fffc9cbfea7 in sw::DocumentLayoutManager::DelLayoutFormat(SwFrameFormat*) (this=0x4edad40, pFormat=0x53318b0) at sw/source/core/doc/DocumentLayoutManager.cxx:285 #6 0x7fffc9a9abd2 in DelFlyInRange(SwNode&, SwNode&, SwContentIndex const*, SwContentIndex const*) (rMkNd=..., rPtNd=..., pMkIdx=0x0, pPtIdx=0x0) at sw/source/core/doc/docedt.cxx:254 #7 0x7fffc9c1c53d in sw::DocumentContentOperationsManager::DeleteSection(SwNode*) (this=0x4f3b460, pNode=0x532a1f0) at sw/source/core/doc/DocumentContentOperationsManager.cxx:2091 #8 0x7fffc9b965f7 in SwRangeRedline::MoveFromSection(unsigned long) (this=0x5335300, nMyPos=0) at sw/source/core/doc/docredln.cxx:1834 #9 0x7fffc9b951f8 in SwRangeRedline::Show(unsigned short, unsigned long, bool) (this=0x5335300, nLoop=1, nMyPos=0, bForced=false) at sw/source/core/doc/docredln.cxx:1277 #10 0x7fffc9c7d64b in sw::DocumentRedlineManager::SetRedlineFlags(RedlineFlags) (this=0x4f388e0, eMode=RedlineFlags::ShowMask) at sw/source/core/doc/DocumentRedlineManager.cxx:1149 #11 0x7fffcb129668 in SwXTextDocument::setPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x4f52730, rPropertyName="ShowChanges", aValue=uno::Any("boolean": 1 '\001')) at sw/source/uibase/uno/unotxdoc.cxx:1795 #12 0x7fffcab7ce8d in XMLRedlineImportHelper::~XMLRedlineImportHelper() (this=0x52792f0) at sw/source/filter/xml/XMLRedlineImportHelper.cxx:341 #13 0x7fffcac2366d in SwXMLTextImportHelper::~SwXMLTextImportHelper() (this=0x527cae0) at sw/source/filter/xml/xmltexti.cxx:157 #14 0x7fffcac236a9 in SwXMLTextImportHelper::~SwXMLTextImportHelper() (this=0x527cae0) at sw/source/filter/xml/xmltexti.cxx:152 #15 0x7fffea9d5ee2 in salhelper::SimpleReferenceObject::release() (this=0x527cae0) at include/salhelper/simplereferenceobject.hxx:76 #16 0x7fffeabc2619 in rtl::Reference::clear() (this=0x525cd60) at include/rtl/ref.hxx:196 #17 0x7fffeabb07e0 in SvXMLImport::cleanup() (this=0x525ccd0) at xmloff/source/core/xmlimp.cxx:458 #18 0x7fffeabb08bf in SvXMLImport::~SvXMLImport() (this=0x525ccd0) at xmloff/source/core/xmlimp.cxx:464 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138191 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit a8b3953531035bf93306ed90142c4172cc32ac43) forcepoint#108 sw: tweak a bit * the fly-at-fly case didn't work, iteration also skips it * delete the bad redline section in the nodes array Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138434 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 477e489e71b4a96ff10d9f2d2b802d91dec3e319) Change-Id: I640874df3fd10af935cf05df707d45bea2c9fd6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138289 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/odfimport/data/forcepoint108.fodt b/sw/qa/extras/odfimport/data/forcepoint108.fodt new file mode 100644 index ..4328ea65f61d --- /dev/null +++ b/sw/qa/extras/odfimport/data/forcepoint108.fodt @@ -0,0 +1,67 @@ + + +http://www.w3.org/1999/xlink; xmlns:dc="http://purl.org/dc/elements/1.1/;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/core/data/rtf/pass/forcepoint110.rtf |binary sw/source/core/unocore/unoframe.cxx|9 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) New commits: commit 6a26be4102e2e80bca4138fb0bdbb38cae90cbc8 Author: Caolán McNamara AuthorDate: Tue Aug 16 16:18:51 2022 +0100 Commit: Thorsten Behrens CommitDate: Thu Aug 18 10:54:30 2022 +0200 forcepoint#110 set PaMs to somewhere safe to park Change-Id: I4dbf27d67b74ff99583dad46a5448700f133c2f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138371 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit d9655727ac688753ea12aaedc09a006134dd4a13) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138292 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/core/data/rtf/pass/forcepoint110.rtf b/sw/qa/core/data/rtf/pass/forcepoint110.rtf new file mode 100644 index ..b7594ff6b622 Binary files /dev/null and b/sw/qa/core/data/rtf/pass/forcepoint110.rtf differ diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 9df8a8a180f1..ba005ac284cf 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2826,8 +2826,13 @@ void SwXFrame::attachToRange(uno::Reference const& xTextRange, aFrameSet.Put( SwFormatAnchor( RndStdIds::FLY_AT_PAGE, 1 )); } -aPam.DeleteMark(); // mark position node will be deleted! -aIntPam.DeleteMark(); // mark position node will be deleted! +// park these no longer needed PaMs somewhere safe so MakeFlyAndMove +// can delete what it likes without any assert these are pointing to +// that content +aPam.DeleteMark(); +aIntPam.DeleteMark(); +*aPam.GetPoint() = *aIntPam.GetPoint() = SwPosition(pDoc->GetNodes()); + pFormat = pDoc->MakeFlyAndMove( *pCopySource, aFrameSet, nullptr, pParentFrameFormat );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/htmlimport/data/ole-data2.xhtml | 12 sw/qa/extras/htmlimport/htmlimport.cxx | 25 + sw/source/filter/html/htmlgrin.cxx |1 + 3 files changed, 38 insertions(+) New commits: commit 1082c996b39cc4cefcfb5ff96598337f90377d87 Author: Miklos Vajna AuthorDate: Wed Aug 17 10:32:16 2022 +0200 Commit: Xisco Fauli CommitDate: Wed Aug 17 17:58:59 2022 +0200 sw XHTML import: fix unexpected link on image The trouble was that once an image got a pending link applied, the remaining images also got that link in case they didn't have an own link. This was a problem since commit 56769d3982e6afb075cb6d833662f066437fab6a (sw XHTML import: handle non-image, non-RTF objects as clickable images, 2022-05-24), the pending URL is not updated after it's applied. Fix the problem by clearing the pending URL, since we know that one pending URL is always applied just once. Change-Id: I0a363330fbcc1dec95f90f56dc7c420249769e2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138409 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit ee3ebda2be3965584d12b52c007fb047d624b64c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138414 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/htmlimport/data/ole-data2.xhtml b/sw/qa/extras/htmlimport/data/ole-data2.xhtml new file mode 100644 index ..0eb180e6ca63 --- /dev/null +++ b/sw/qa/extras/htmlimport/data/ole-data2.xhtml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx index 19c776fe687e..f6686c79c1c8 100644 --- a/sw/qa/extras/htmlimport/htmlimport.cxx +++ b/sw/qa/extras/htmlimport/htmlimport.cxx @@ -563,6 +563,31 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testOleData) CPPUNIT_ASSERT(getProperty(xShape, "HyperLinkURL").endsWith("/data.ole")); } +CPPUNIT_TEST_FIXTURE(SwModelTestBase, testOleData2) +{ +// Given an XHTML with 2 objects: the first has a link, the second does not have: +uno::Sequence aLoadProperties = { +comphelper::makePropertyValue("FilterName", OUString("HTML (StarWriter)")), +comphelper::makePropertyValue("FilterOptions", OUString("xhtmlns=reqif-xhtml")), +}; +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "ole-data2.xhtml"; + +// When loading the document: +mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", aLoadProperties); + +// Then make sure that the second image doesn't have a link set: +uno::Reference xSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xObjects(xSupplier->getGraphicObjects(), + uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(2), xObjects->getCount()); +uno::Reference xShape = getShape(1); +CPPUNIT_ASSERT(getProperty(xShape, "HyperLinkURL").endsWith("/data.ole")); +xShape = getShape(2); +// Without the accompanying fix in place, this test would have failed, the link from the 1st +// image leaked to the 2nd image. +CPPUNIT_ASSERT(getProperty(xShape, "HyperLinkURL").isEmpty()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 7d3c24d67021..5a11fa9c6da6 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -877,6 +877,7 @@ IMAGE_SETEVENT: // image. SwFormatURL aURL(pFlyFormat->GetURL()); aURL.SetURL(m_aEmbedURL, bIsMap); +m_aEmbedURL.clear(); pFlyFormat->SetFormatAttr(aURL); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/layout/data/tdf135991.odt |binary sw/qa/extras/layout/layout2.cxx|8 + sw/source/core/layout/calcmove.cxx | 46 + 3 files changed, 33 insertions(+), 21 deletions(-) New commits: commit 45e4abfed10aff768cd884ebcb1a38af0fea32d6 Author: Mark Hung AuthorDate: Sun Aug 14 15:23:14 2022 +0800 Commit: Xisco Fauli CommitDate: Mon Aug 15 15:46:45 2022 +0200 tdf#135991 fix unexpected hidden RTL sections. SwLayoutFrame::MakeAll tried to manipulate the height instead of the width for SwCellFrame and SwColumnFrame ( i.e. when IsNeghbourFrame() is true. ), by selecting a wrong SwRectFn. SwRectFn fnRect = bVert == IsNeighbourFrame() ? fnRectHori : ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert ); It doesn't make sense to select among fnRectVertL2RBT, fnRectVertL2R, and fnRectVert if the layout is horizontal. The frame position got a negative top value and make the frame invisble. Check he following commit for reference: commit c90b6806d18c8ed25015eb2ecdff13c7bab2572d Author: Andreas Martens Date: Wed Sep 19 07:45:10 2001 + Chg: Moving vertical help functions from SwFrm to SwRect Change-Id: I2f6da9cdbc2947de95a6fb9ce8fa94a79360c83a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138250 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 1bf82b26aea3a403920a64cdfcb4671c947c7a01) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138278 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/layout/data/tdf135991.odt b/sw/qa/extras/layout/data/tdf135991.odt new file mode 100644 index ..f490ee9fb28c Binary files /dev/null and b/sw/qa/extras/layout/data/tdf135991.odt differ diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 24c4d32acc5d..d602d74c9bba 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -2131,6 +2131,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124261) #endif } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf135991) +{ +createSwDoc(DATA_DIRECTORY, "tdf135991.odt"); +auto pDump = parseLayoutDump(); +// There used to be negative values that made the column frames invisible. +assertXPath(pDump, "//bounds[@top<0]", 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 1bc2506a72f4..1869794300f6 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -949,7 +949,7 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) const SwLayNotify aNotify( this ); bool bVert = IsVertical(); -SwRectFn fnRect = ( IsNeighbourFrame() == bVert )? fnRectHori : ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert ); +SwRectFn fnRect = bVert ? ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert ) : fnRectHori; std::optional oAccess; const SwBorderAttrs*pAttrs = nullptr; @@ -975,32 +975,36 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) { // Set FixSize; VarSize is set by Format() after calculating the PrtArea setFramePrintAreaValid(false); - -SwTwips nPrtWidth = (GetUpper()->getFramePrintArea().*fnRect->fnGetWidth)(); -if( bVert && ( IsBodyFrame() || IsFootnoteContFrame() ) ) -{ -SwFrame* pNxt = GetPrev(); -while( pNxt && !pNxt->IsHeaderFrame() ) -pNxt = pNxt->GetPrev(); -if( pNxt ) -nPrtWidth -= pNxt->getFrameArea().Height(); -pNxt = GetNext(); -while( pNxt && !pNxt->IsFooterFrame() ) -pNxt = pNxt->GetNext(); -if( pNxt ) -nPrtWidth -= pNxt->getFrameArea().Height(); -} - -const tools::Long nDiff = nPrtWidth - (getFrameArea().*fnRect->fnGetWidth)(); SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this); -if( IsNeighbourFrame() && IsRightToLeft() ) +if (IsNeighbourFrame()) { -(aFrm.*fnRect->fnSubLeft)( nDiff ); +SwTwips nPrtHeight = (GetUpper()->getFramePrintArea().*fnRect->fnGetHeight)(); +const tools::Long nDiff = nPrtHeight - (getFrameArea().*fnRect->fnGetHeight)(); +(aFrm.*fnRect->fnAddBottom)( nDiff ); } else { -
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/ww8export/data/tdf77964.doc |binary sw/qa/extras/ww8export/ww8export4.cxx|7 +++ sw/source/filter/ww8/ww8par.cxx |8 +++- 3 files changed, 14 insertions(+), 1 deletion(-) New commits: commit 1539a0fcd31f4ba7ef71adf4ae7761dc445199f5 Author: Justin Luth AuthorDate: Sat Aug 13 12:29:12 2022 -0400 Commit: Caolán McNamara CommitDate: Sun Aug 14 18:53:32 2022 +0200 tdf#77964 doc import: 0x1 placeholder is for AS_CHAR It looks like MS always provides an sprm that confirms this, but Kingsoft was saving without that sprm. Something similar ought to be done for ImportOLE, but it doesn't have a ready option for specifying that, so I just left it because I don't care about OLE. Change-Id: I0ae304a08b381c8c29f3db24f791f25f5e33b0c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138234 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 873c279e36cfb4d2e110c1cbd0e1682e1e470208) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138131 Reviewed-by: Caolán McNamara diff --git a/sw/qa/extras/ww8export/data/tdf77964.doc b/sw/qa/extras/ww8export/data/tdf77964.doc new file mode 100644 index ..6ef50ab15834 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf77964.doc differ diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index 91b9477a996f..bc0d51ff529e 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -48,6 +49,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148360) assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[2]", "nType", "PortionType::Text"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf77964) +{ +loadAndReload("tdf77964.doc"); +// both images were loading as AT_PARA instead of AS_CHAR. Image2 visually had text wrapping. +CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty(getShapeByName(u"Image2"), "AnchorType")); +} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 74022ea8b610..dd8484a389a8 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3714,7 +3714,13 @@ bool SwWW8ImplReader::ReadChar(tools::Long nPosCp, tools::Long nCpOfs) if (m_bObj) pResult = ImportOle(); else if (m_bSpec) -pResult = ImportGraf(); +{ +SwFrameFormat* pAsCharFlyFormat = m_rDoc.GetDfltFrameFormat(); +SwFormatAnchor aAnchor(RndStdIds::FLY_AS_CHAR); +pAsCharFlyFormat->SetFormatAttr(aAnchor); +pResult = ImportGraf(nullptr, pAsCharFlyFormat); +} + // If we have a bad 0x1 insert a space instead. if (!pResult)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source writerfilter/source
sw/qa/extras/rtfexport/data/FORMDROPDOWN.rtf | 33 sw/qa/extras/rtfexport/rtfexport4.cxx | 21 +++ sw/source/filter/ww8/rtfexport.cxx| 58 +- writerfilter/source/dmapper/FormControlHelper.cxx |5 + writerfilter/source/rtftok/rtfdocumentimpl.cxx|4 + 5 files changed, 117 insertions(+), 4 deletions(-) New commits: commit 07e20e619919114def34ddc4d6241b1f891c443b Author: Michael Stahl AuthorDate: Fri Aug 5 12:57:57 2022 +0200 Commit: Thorsten Behrens CommitDate: Tue Aug 9 09:47:09 2022 +0200 tdf#148518 writerfilter,sw: RTF import/export of FORMDROPDOWN field On import, the values overwrote each other; export of the form data was missing completely. Change-Id: I918b3cfced39dc2602c6de03cdaf5848a9825dd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137861 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 47b08551a77918e4d35a98197ac99c1c3d5dec73) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137970 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/rtfexport/data/FORMDROPDOWN.rtf b/sw/qa/extras/rtfexport/data/FORMDROPDOWN.rtf new file mode 100644 index ..ef1d3af744db --- /dev/null +++ b/sw/qa/extras/rtfexport/data/FORMDROPDOWN.rtf @@ -0,0 +1,33 @@ +{\rtf1\adeflang1025\ansi\ansicpg1250\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1038\deflangfe1038\themelang1031\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0; +\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128; +\red192\green192\blue192;}{\*\defchp \fs22 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{ +\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive +\ssemihidden Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1038\langfe1038\cgrid\langnp1038\langfenp1038 \snext11 \ssemihidden \sunhideused +Normal Table;}{\*\ts15\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 \sbasedon11 \snext15 \styrsid6366418 Table Grid;}{ +\s16\ql \li0\ri0\widctlpar\tqc\tx4513\tqr\tx9026\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 +\sbasedon0 \snext16 \slink17 \styrsid14450383 header;}{\*\cs17 \additive \rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \fs24\lang3079\langfe3079\langnp3079\langfenp3079 \sbasedon10 \slink16 \slocked \styrsid14450383 Header Char;}{\s18\ql \li0\ri0\widctlpar +\tqc\tx4513\tqr\tx9026\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 \sbasedon0 \snext18 \slink19 \styrsid14450383 footer;}{\*\cs19 +\additive \rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \fs24\lang3079\langfe3079\langnp3079\langfenp3079 \sbasedon10 \slink18 \slocked \styrsid14450383 Footer Char;}}{\*\rsidtbl \rsid1922796\rsid2437734\rsid4346699\rsid4392934\rsid5467240\rsid5720824\rsid6366418 +\rsid6843717\rsid7742502\rsid7807608\rsid7872863\rsid7957046\rsid8722154\rsid8811273\rsid9708480\rsid9904672\rsid10167906\rsid11299441\rsid12799272\rsid13922319\rsid14183170\rsid14450383\rsid14632381\rsid14900426\rsid15207980\rsid15864162\rsid16002556
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport12.cxx |9 + sw/source/filter/ww8/docxattributeoutput.cxx | 16 2 files changed, 21 insertions(+), 4 deletions(-) New commits: commit 9a74d37762d0311c608062cd715df1b35d4f6ac4 Author: László Németh AuthorDate: Wed Aug 3 16:09:14 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Aug 8 11:54:45 2022 +0200 tdf#150166 DOCX export: revert ToC w:move* to fix broken file Export w:moveFrom/w:moveTo of tracked ToC moving as w:del/w:ins (and w:delText for runs in w:del) again to avoid of interoperability problems. Partial revert of commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519 "tdf#145720 DOCX export: fix loss of tracked moving". Follow-up to commit 64ac089ad5464c832592e050f5d51a136f533f21 "tdf#150166 DOCX export: fix broken file with tracked ToC moving". Note: Commit 64ac089ad5464c832592e050f5d51a136f533f21 was only part of the fix for the broken export with interoperability problems. Change-Id: I520f3a7e08eca0ccd6aa221a2406b41925f70fa7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137752 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 9c637252f9e965302458ccfc514addc473a0a980) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137729 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 351c1f804dfe..0f4913375aac 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1235,6 +1235,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf150166, "tdf150166.docx") assertXPath(pXmlDoc, "//w:moveFromRangeStart", 0); // This was 2 (missing RangeStart elements, but bad unpaired RangeEnds) assertXPath(pXmlDoc, "//w:moveFromRangeEnd", 0); + +// These were 0 (moveFrom, moveTo and t) +assertXPath(pXmlDoc, "//w:del", 11); +assertXPath(pXmlDoc, "//w:ins", 12); +assertXPath(pXmlDoc, "//w:delText", 7); + +// no more moveFrom/moveTo to avoid of problems with ToC +assertXPath(pXmlDoc, "//w:moveFrom", 0); +assertXPath(pXmlDoc, "//w:moveTo", 0); } } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index e1e9176bdb74..1014f69ed64b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3385,8 +3385,12 @@ void DocxAttributeOutput::RunText( const OUString& rText, rtl_TextEncoding /*eCh // the text run is usually XML_t, with the exception of the deleted (and not moved) text sal_Int32 nTextToken = XML_t; -if ( m_pRedlineData && !m_pRedlineData->IsMoved() && -m_pRedlineData->GetType() == RedlineType::Delete ) + +bool bMoved = m_pRedlineData && m_pRedlineData->IsMoved() && + // tdf#150166 save tracked moving around TOC as w:ins, w:del + SwDoc::GetCurTOX(*m_rExport.m_pCurPam->GetPoint()) == nullptr; + +if ( m_pRedlineData && m_pRedlineData->GetType() == RedlineType::Delete && !bMoved ) { nTextToken = XML_delText; } @@ -3790,7 +3794,9 @@ void DocxAttributeOutput::StartRedline( const SwRedlineData * pRedlineData ) const DateTime aDateTime = pRedlineData->GetTimeStamp(); bool bNoDate = bRemovePersonalInfo || ( aDateTime.GetYear() == 1970 && aDateTime.GetMonth() == 1 && aDateTime.GetDay() == 1 ); -bool bMoved = pRedlineData->IsMoved(); +bool bMoved = pRedlineData->IsMoved() && + // tdf#150166 save tracked moving around TOC as w:ins, w:del + SwDoc::GetCurTOX(*m_rExport.m_pCurPam->GetPoint()) == nullptr; switch ( pRedlineData->GetType() ) { case RedlineType::Insert: @@ -3823,7 +3829,9 @@ void DocxAttributeOutput::EndRedline( const SwRedlineData * pRedlineData ) if ( !pRedlineData || m_bWritingField ) return; -bool bMoved = pRedlineData->IsMoved(); +bool bMoved = pRedlineData->IsMoved() && + // tdf#150166 save tracked moving around TOC as w:ins, w:del + SwDoc::GetCurTOX(*m_rExport.m_pCurPam->GetPoint()) == nullptr; switch ( pRedlineData->GetType() ) { case RedlineType::Insert:
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source writerfilter/source
sw/qa/extras/odfexport/odfexport.cxx |6 +- sw/qa/extras/ooxmlexport/ooxmlexport13.cxx|4 - sw/source/core/doc/doclay.cxx | 11 +++- sw/source/core/doc/textboxhelper.cxx |6 +- sw/source/core/unocore/unotext.cxx| 21 +++-- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 49 +++--- writerfilter/source/dmapper/GraphicImport.cxx | 11 ++-- 7 files changed, 63 insertions(+), 45 deletions(-) New commits: commit d0a8f6857e93f1f4a26f05615618ff733bfb4851 Author: Vasily Melenchuk AuthorDate: Mon Dec 27 13:54:23 2021 +0300 Commit: Thorsten Behrens CommitDate: Fri Aug 5 01:26:20 2022 +0200 tdf#143703 sw: always assign name for fly section Previously generated name was assigned only if not in doc reading mode. But there is no guarantee that it will be assigned later. Better to insert any name in SwDoc::MakeFlySection_() and later it can be overwritten, but fly will definitely have any unique name. * Some test failed because GraphicImport_Impl::applyName() overwrote the name with a different generated one. * This breaks chaining of VML shapes, see test testTDF87348. The code introduced in commit 091fe76b6329b4bb974987554369cbfadd8f2401 in DomainMapper_Impl::ChainTextFrames() breaks if the text frame already has a name; it's a bit confusing which names there come from the file and which come from the API, and it also mixes 2 different cases of VML chaining and DrawingML chaining that look like they should be using different data. * This also breaks moving flys anchored at-char in flys into them in SwXText::convertToTextFrame(), see ooxmlexport13 testFlyInFly. This kind of worked by accident before: the fly is copied and then the original deleted, keeping the same name (with help of SwDoc::mbCopyIsMove); with no name it would compare the SdrObject pointer, which is different for the new copy, now the name is the same. Fix this by only moving flys anchored at the edge of the selection back inoto the body; it turns out that Word actually supports at-char anchors in text frames, but only if it's a VML shape or Compatibility Mode or whatever; i wasn't able to do it in a document created from scratch. This is a bit tricky to ignore the nodes added for floating tables as seen in ooxmlexport10 testFloatingTablesAnchor. * Another change is required in SwDoc::SetFlyName() because of testTdf127732, as it would rename a frame named "Frame1" to "Frame2" when called to rename it to "Frame1". * Some tests failed because after MakeFlySection_() assigns a name it is immediately unconditionally overwritten; replace that with asserts Change-Id: I46752a4413ba3a9e981eccd1e153b3aaf8053781 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127556 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 4d6243693c228703394c00164276f8326447beb9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137762 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index e58b772b8cdf..3fb14b220c69 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -936,7 +936,7 @@ DECLARE_ODFEXPORT_TEST(testTdf134987, "tdf134987.docx") OUString aMediaType; // checking first object (formula) { -uno::Reference xEOSupplier(xAccess->getByName("1"), uno::UNO_QUERY); +uno::Reference xEOSupplier(xAccess->getByName("Object1"), uno::UNO_QUERY); uno::Reference xObj(xEOSupplier->getEmbeddedObject()); CPPUNIT_ASSERT(xObj.is()); @@ -950,7 +950,7 @@ DECLARE_ODFEXPORT_TEST(testTdf134987, "tdf134987.docx") } // checking second object (chart) { -uno::Reference xEOSupplier(xAccess->getByName("2"), uno::UNO_QUERY); +uno::Reference xEOSupplier(xAccess->getByName("Object2"), uno::UNO_QUERY); uno::Reference xObj(xEOSupplier->getEmbeddedObject()); CPPUNIT_ASSERT(xObj.is()); @@ -964,7 +964,7 @@ DECLARE_ODFEXPORT_TEST(testTdf134987, "tdf134987.docx") } // checking third object (chart) { -uno::Reference xEOSupplier(xAccess->getByName("3"), uno::UNO_QUERY); +uno::Reference xEOSupplier(xAccess->getByName("Object3"), uno::UNO_QUERY); uno::Reference xObj(xEOSupplier->getEmbeddedObject()); CPPUNIT_ASSERT(xObj.is()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index b97b6c241093..51634dcd8a00 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -41,11 +41,11 @@ DECLARE_SW_EXPORT_TEST(testFlyInFly,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/core/text/text.cxx | 42 + sw/source/core/text/porrst.cxx |8 ++- 2 files changed, 49 insertions(+), 1 deletion(-) New commits: commit fd4322238737ed90b6ab21fdd07ddc0688e7d9a0 Author: Miklos Vajna AuthorDate: Wed Jul 27 16:35:13 2022 +0200 Commit: Michael Stahl CommitDate: Thu Jul 28 12:22:35 2022 +0200 tdf#148291 sw clearing breaks: fix RTL layout The bugreport has two documents that show clear=left and clear=right is basically ignored in Word in the RTL paragraph case, while clear=none and clear=all work as expected. There was no special-casing for RTL in SwBreakPortion::Format() previously, as the OOXML spec does talk about left/right even in case of RTL, i.e. no expected mirroring is documented as the behavior. Looking at [MS-OI29500], "2.1.528 Part 1 Section 17.18.3, ST_BrClear" does say that the Word "behaves unpredictably" in the normal (non-web) layout. Fix the problem by handling clear=left and clear=right as clear=none in the RTL case, this fixes the rendering differences for both bugdocuments. If later we do want the mirrored layout, then such mirroring could be done in SwTextFly::GetMaxBottom(). Change-Id: I6265e64540fa9e5b893cfbea146152854416dce2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137507 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 4e329f50e42c91704b84b1fc583d6815ab22adab) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137520 Reviewed-by: Michael Stahl diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index f2c795d51a69..d94fb4c63e3b 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -370,6 +371,47 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakLeft) assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]", "height", "2837"); } +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakLeftRTL) +{ +// Given a document with an anchored object in an RTL para and a clearing break (type=left): +loadURL("private:factory/swriter", nullptr); +uno::Reference xFactory(mxComponent, uno::UNO_QUERY); +uno::Reference xDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xText = xDocument->getText(); +uno::Reference xCursor = xText->createTextCursor(); +uno::Reference xCursorProps(xCursor, uno::UNO_QUERY); +xCursorProps->setPropertyValue("WritingMode", uno::Any(text::WritingMode2::RL_TB)); +{ +uno::Reference xShape( +xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); +xShape->setSize(awt::Size(5000, 5000)); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); +xShapeProps->setPropertyValue("AnchorType", + uno::Any(text::TextContentAnchorType_AT_CHARACTER)); +uno::Reference xShapeContent(xShape, uno::UNO_QUERY); +xText->insertTextContent(xCursor, xShapeContent, /*bAbsorb=*/false); +} +uno::Reference xLineBreak( +xFactory->createInstance("com.sun.star.text.LineBreak"), uno::UNO_QUERY); +uno::Reference xLineBreakProps(xLineBreak, uno::UNO_QUERY); +auto eClear = static_cast(SwLineBreakClear::RIGHT); +xLineBreakProps->setPropertyValue("Clear", uno::Any(eClear)); +xText->insertString(xCursor, "foo", /*bAbsorb=*/false); +xText->insertTextContent(xCursor, xLineBreak, /*bAbsorb=*/false); +xText->insertString(xCursor, "bar", /*bAbsorb=*/false); + +// When laying out that document: +calcLayout(); + +// Then make sure the "bar" does not jump down (due to type=left && RTL): +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 276 +// - Actual : 2837 +// i.e. left/right was not ignored in the RTL case. +assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout[1]", "height", "276"); +} + CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakHeader) { // Given a document with a shape in the header and a clearing break in the body text: diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 5e3d6921292d..064458b43d11 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -178,7 +178,13 @@ bool SwBreakPortion::Format( SwTextFormatInfo ) // See if this is a clearing break. If so, calculate how much we need to "jump down" so the next // line can again use the full text width. -if (m_eClear != SwLineBreakClear::NONE) +SwLineBreakClear eClear = m_eClear; +if (rInf.GetTextFrame()->IsRightToLeft() && eClear != SwLineBreakClear::ALL) +{ +// RTL ignores left/right breaks. +eClear = SwLineBreakClear::NONE; +} +if (eClear
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/htmlexport/htmlexport.cxx | 23 +++ sw/source/filter/html/css1atr.cxx | 11 +++ sw/source/filter/html/css1kywd.cxx |1 + sw/source/filter/html/css1kywd.hxx |1 + sw/source/filter/html/wrthtml.cxx |7 +-- 5 files changed, 41 insertions(+), 2 deletions(-) New commits: commit 5a55010be559c0942b9f5847a7c9f763597fdeb1 Author: Miklos Vajna AuthorDate: Thu Jul 21 15:40:58 2022 +0200 Commit: Xisco Fauli CommitDate: Wed Jul 27 10:05:25 2022 +0200 sw XHTML export: fix writing of section direction The XHTML export behavior was the same as the HTML one for section text direction, the markup was used. This shares code with the HTML filter, but it's not valid in reqif-xhtml, while the CSS markup would be fine: . Fix the problem by keeping the behavior unchanged for HTML, but switch to inline CSS for XHTML. The other similar attribute was "id", but that's fine even in XHTML. Change-Id: I5797c90f9cf957dec7fc4074dd6e79dce11fada7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137305 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 3b7c18a579f3165c9d425d172d697f8978d6cd84) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137425 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 44654bdbcf5a..5e5af5e70a17 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -2369,6 +2369,29 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testImageKeepRatio) assertXPath(pDoc, "/html/body/p/img", "height", "auto"); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSectionDir) +{ +// Given a document with a section: +SwDoc* pDoc = createSwDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +pWrtShell->Insert("test"); +pWrtShell->SelAll(); +SwSectionData aSectionData(SectionType::Content, "mysect"); +pWrtShell->InsertSection(aSectionData); + +// When exporting to (reqif-)xhtml: +ExportToReqif(); + +// Then make sure CSS is used to export the text direction of the section: +SvMemoryStream aStream; +HtmlExportTest::wrapFragment(maTempFile, aStream); +xmlDocUniquePtr pXmlDoc = parseXmlStream(); +// Without the accompanying fix in place, this test would have failed with: +// - XPath '//reqif-xhtml:div[@id='mysect']' no attribute 'style' exist +// i.e. the dir="ltr" HTML attribute was used instead. +assertXPath(pXmlDoc, "//reqif-xhtml:div[@id='mysect']", "style", "dir: ltr"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index bc2449b865cc..1520a4e0596a 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -2088,6 +2088,17 @@ void SwHTMLWriter::OutCSS1_SectionFormatOptions( const SwFrameFormat& rFrameForm if( SfxItemState::SET==rItemSet.GetItemState( RES_BACKGROUND, false, ) ) OutCSS1_SvxBrush( *this, *pItem, sw::Css1Background::Section, nullptr ); +if (mbXHTML) +{ +SvxFrameDirection nDir = GetHTMLDirection(rFrameFormat.GetAttrSet()); +OString sConvertedDirection = convertDirection(nDir); +if (!sConvertedDirection.isEmpty()) +{ +OutCSS1_Property(sCSS1_P_dir, sConvertedDirection, nullptr, + sw::Css1Background::Section); +} +} + if (pCol) { OString sColumnCount(OString::number(static_cast(pCol->GetNumCols(; diff --git a/sw/source/filter/html/css1kywd.cxx b/sw/source/filter/html/css1kywd.cxx index af8c5392a765..12d70903ad39 100644 --- a/sw/source/filter/html/css1kywd.cxx +++ b/sw/source/filter/html/css1kywd.cxx @@ -171,6 +171,7 @@ const char* const sCSS1_P_height = "height"; const char* const sCSS1_P_float = "float"; const char* const sCSS1_P_column_count = "column-count"; +const char* const sCSS1_P_dir = "dir"; // Strings for positioning diff --git a/sw/source/filter/html/css1kywd.hxx b/sw/source/filter/html/css1kywd.hxx index 443af7e1ae91..67d2c9e2802c 100644 --- a/sw/source/filter/html/css1kywd.hxx +++ b/sw/source/filter/html/css1kywd.hxx @@ -172,6 +172,7 @@ extern const char* const sCSS1_P_height; extern const char* const sCSS1_P_float; extern const char* const sCSS1_P_column_count; +extern const char* const sCSS1_P_dir; // Strings for positioning diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index d216e0d51cb7..0cede88912d3 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -711,9 +711,12 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, sOut.append('\"'); } -SvxFrameDirection nDir = rHTMLWrt.GetHTMLDirection(
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/core/docnode/data/tdf150086.docx |binary sw/qa/core/docnode/docnode.cxx | 15 +++ sw/source/core/docnode/ndsect.cxx |3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) New commits: commit 3c32bc911189c55247b4c1f425a1f8dc86420eb4 Author: László Németh AuthorDate: Thu Jul 21 17:56:34 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Jul 26 12:11:34 2022 +0200 tdf#150086 DOCX import: fix ToC redline with lost content Inserted Table of Contents lost its redline partially, e.g. the redline contained only "Conte" instead of "Content". Regression from commit 69edfcf789db1920273191d93fae0bc03f385b81 "DOCX import: fix assertion failure when redline ends right before a ToC". Note: it seems, it's enough to limit the original fix for delete redlines, because that was the main target of the interoperability fix. Change-Id: I617fa855aa8e194a33caa419d2d73e76588f4bd5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137308 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit c78e0f8c6e10e3cba1f098c86aca3cf162f39cb6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137325 Reviewed-by: Xisco Fauli diff --git a/sw/qa/core/docnode/data/tdf150086.docx b/sw/qa/core/docnode/data/tdf150086.docx new file mode 100644 index ..063e68df6857 Binary files /dev/null and b/sw/qa/core/docnode/data/tdf150086.docx differ diff --git a/sw/qa/core/docnode/docnode.cxx b/sw/qa/core/docnode/docnode.cxx index bcda50c8de7a..4dbf3630f3f4 100644 --- a/sw/qa/core/docnode/docnode.cxx +++ b/sw/qa/core/docnode/docnode.cxx @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -29,6 +30,20 @@ CPPUNIT_TEST_FIXTURE(Test, testRedlineEndsBeforeToC) // Without the accompanying fix in place, this test would have resulted in an assertion failure // in InsertCnt_(), because the start of the section was hidden, but not its end. CPPUNIT_ASSERT_EQUAL(static_cast(2), rTable.size()); + +// The redline contained the newline, too +CPPUNIT_ASSERT_EQUAL(OUString(""), rTable[0]->GetText()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf150086) +{ +// Load a document where an insert redline ends right before a ToC +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf150086.docx"); +const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); +CPPUNIT_ASSERT_EQUAL(static_cast(9), rTable.size()); + +// This was "Conte" (stripped redline) +CPPUNIT_ASSERT_EQUAL(OUString("Content"), rTable[6]->GetText()); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 6c7fb8b6ecec..76831ae61925 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -834,7 +834,8 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, for (SwRedlineTable::size_type nIndex = 0; nIndex < rRedlines.size(); ++nIndex) { SwRangeRedline* pRedline = rRedlines[nIndex]; -if (!pRedline->HasMark() || pRedline->GetMark()->nNode != aInsPos) +if ( RedlineType::Delete != pRedline->GetType() || + !pRedline->HasMark() || pRedline->GetMark()->nNode != aInsPos ) { continue; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf139128.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 12 sw/source/filter/ww8/docxattributeoutput.cxx |2 ++ 3 files changed, 14 insertions(+) New commits: commit 14c4c6c1d764142a0f0ca8c02ccd2028d378e21e Author: Tünde Tóth AuthorDate: Tue Jul 12 11:50:35 2022 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Sat Jul 23 14:07:38 2022 +0200 tdf#139128 DOCX: fix export of line break in text frames Line breaks (text:line-break) of ODF text frames (draw:text-box) were lost during DOCX export. Change-Id: I2e1149234749437ceef0d4643b0e686d5ae92156 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136998 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 024d75681887dd33561917cb3ff6b213924fd59d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137327 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/ooxmlexport/data/tdf139128.odt b/sw/qa/extras/ooxmlexport/data/tdf139128.odt new file mode 100644 index ..544527c069a2 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf139128.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 74ff724dbbd3..9ab04a6aa8c3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -1050,6 +1050,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149089, "tdf149089.docx") CPPUNIT_ASSERT_EQUAL( sal_Int16(text::TextGridMode::LINES), nGridMode); // was LINES_AND_CHARS } +CPPUNIT_TEST_FIXTURE(Test, testTdf139128) +{ +loadAndReload("tdf139128.odt"); +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); +CPPUNIT_ASSERT(pXmlDoc); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 2 +// - Actual : 0 +// i.e. the line break was lost on export. +assertXPath(pXmlDoc, "//w:br", 2); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index a3a91a77827e..28e32a50929d 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -150,6 +150,7 @@ #include #include #include +#include #include #include @@ -3394,6 +3395,7 @@ void DocxAttributeOutput::RunText( const OUString& rText, rtl_TextEncoding /*eCh prevUnicode = *pIt; break; case 0x0b: // line break +case static_cast(text::ControlCharacter::LINE_BREAK): { if (impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt ) || prevUnicode < 0x0020) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/core/txtnode/txtnode.cxx| 23 ++- sw/source/core/txtnode/attrcontentcontrol.cxx |2 +- 2 files changed, 23 insertions(+), 2 deletions(-) New commits: commit 3f706577ab05242b3a914eb183197b0d532764ee Author: Miklos Vajna AuthorDate: Tue Jul 19 08:28:21 2022 +0200 Commit: Miklos Vajna CommitDate: Tue Jul 19 14:52:08 2022 +0200 sw content control, date: allow selecting via the keyboard It was not possible to select the date of a date content control via keyboard. This meant only the mouse handling codepath needed implementing, but it broke accessibility. SwContentControl::ShouldOpenPopup() already knows how to handle dropdowns via the keyboard, extend that to handle date pickers as well. The appearing vcl Calendar / GtkCalendar appears to support keyboard navigation already. Change-Id: Ic36419f69cbcdba1a9069332184966cb4b347c49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137213 Reviewed-by: Miklos Vajna Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137222 diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index 15d2188a8cb6..bd9bcd66d6fc 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -270,7 +270,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testDropdownContentControlKeyboard) CPPUNIT_ASSERT(bShouldOpen); } -CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testPicutreContentControlKeyboard) +CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testPictureContentControlKeyboard) { // Given an already selected picture content control: SwDoc* pDoc = createSwDoc(); @@ -297,6 +297,27 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testPicutreContentControlKeyboard) CPPUNIT_ASSERT(bIsInteracting); } +CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testDateContentControlKeyboard) +{ +// Given an already selected date content control: +SwDoc* pDoc = createSwDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +pWrtShell->InsertContentControl(SwContentControlType::DATE); + +// When checking if alt-down should open a popup: +SwTextContentControl* pTextContentControl = pWrtShell->CursorInsideContentControl(); +auto& rFormatContentControl += static_cast(pTextContentControl->GetAttr()); +std::shared_ptr pContentControl = rFormatContentControl.GetContentControl(); +vcl::KeyCode aKeyCode(KEY_DOWN, KEY_MOD2); +bool bShouldOpen = pContentControl->ShouldOpenPopup(aKeyCode); + +// Then make sure that the answer is yes for date: +// Without the accompanying fix in place, this test would have failed, the date popup was +// mouse-only. +CPPUNIT_ASSERT(bShouldOpen); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx b/sw/source/core/txtnode/attrcontentcontrol.cxx index 8c8b19348006..fb2176024707 100644 --- a/sw/source/core/txtnode/attrcontentcontrol.cxx +++ b/sw/source/core/txtnode/attrcontentcontrol.cxx @@ -319,7 +319,7 @@ bool SwContentControl::IsInteractingCharacter(sal_Unicode cCh) bool SwContentControl::ShouldOpenPopup(const vcl::KeyCode& rKeyCode) { -if (HasListItems()) +if (HasListItems() || GetDate()) { // Alt-down opens the popup. return rKeyCode.IsMod2() && rKeyCode.GetCode() == KEY_DOWN;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/core/txtnode/txtnode.cxx| 27 + sw/source/core/txtnode/attrcontentcontrol.cxx |5 sw/source/uibase/docvw/edtwin.cxx | 32 ++ 3 files changed, 64 insertions(+) New commits: commit 04f444328f2bb685407eee82f8933879d818364b Author: Miklos Vajna AuthorDate: Mon Jul 18 11:18:28 2022 +0200 Commit: Miklos Vajna CommitDate: Tue Jul 19 14:48:54 2022 +0200 sw content control, picture: allow replacing via the keyboard It was not possible to replace a picture placeholder with an actual bitmap without using the mouse, which breaks accessibility. The mouse handling code was added in commit b213abcb77e19fa5d22af45c7ecd17c8a63af554 (sw content controls, picture: replace placeholder image on click, 2022-05-18), which already split the functionality between SwEditWin::MouseButtonUp() and SwWrtShell::GotoContentControl(). Fix the problem by reusing the shared SwWrtShell::GotoContentControl() and extending SwEditWin::KeyInput() to allow doing the same with the keyboard. This way the scenario when Shift-F4 selects the frame and the user presses Enter now triggers the filepicker. A possible future improvement would be to also handle Enter similarly when the text cursor is inside a picture content control, but that's not implemented here. Change-Id: I756395d3811e3f4dfdce698751c4de13a0d49729 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137168 Reviewed-by: Miklos Vajna Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137221 diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index 7791cf82bbc3..15d2188a8cb6 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -270,6 +270,33 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testDropdownContentControlKeyboard) CPPUNIT_ASSERT(bShouldOpen); } +CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testPicutreContentControlKeyboard) +{ +// Given an already selected picture content control: +SwDoc* pDoc = createSwDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +pWrtShell->InsertContentControl(SwContentControlType::PICTURE); +pWrtShell->GotoObj(/*bNext=*/true, GotoObjFlags::Any); + +// When checking if enter should trigger the file picker: +const SwFrameFormat* pFlyFormat = pWrtShell->GetFlyFrameFormat(); +const SwFormatAnchor& rFormatAnchor = pFlyFormat->GetAnchor(); +const SwPosition* pAnchorPos = rFormatAnchor.GetContentAnchor(); +SwTextNode* pTextNode = pAnchorPos->nNode.GetNode().GetTextNode(); +SwTextAttr* pAttr = pTextNode->GetTextAttrAt(pAnchorPos->nContent.GetIndex(), + RES_TXTATR_CONTENTCONTROL, SwTextNode::PARENT); +auto pTextContentControl = static_txtattr_cast(pAttr); +auto& rFormatContentControl += static_cast(pTextContentControl->GetAttr()); +std::shared_ptr pContentControl = rFormatContentControl.GetContentControl(); +bool bIsInteracting = pContentControl->IsInteractingCharacter('\r'); + +// Then make sure that the answer is yes for pictures: +// Without the accompanying fix in place, this test would have failed, the picture replacement +// file-picker was mouse-only. +CPPUNIT_ASSERT(bIsInteracting); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx b/sw/source/core/txtnode/attrcontentcontrol.cxx index b90998bdcc65..8c8b19348006 100644 --- a/sw/source/core/txtnode/attrcontentcontrol.cxx +++ b/sw/source/core/txtnode/attrcontentcontrol.cxx @@ -309,6 +309,11 @@ bool SwContentControl::IsInteractingCharacter(sal_Unicode cCh) return cCh == ' '; } +if (GetPicture()) +{ +return cCh == '\r'; +} + return false; } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 3e117955436c..ac331e1cfa36 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -1545,6 +1545,38 @@ void SwEditWin::KeyInput(const KeyEvent ) } const SwFrameFormat* pFlyFormat = rSh.GetFlyFrameFormat(); + +if (pFlyFormat) +{ +// See if the fly frame's anchor is in a content control. If so, +// try to interact with it. +const SwFormatAnchor& rFormatAnchor = pFlyFormat->GetAnchor(); +const SwPosition* pAnchorPos = rFormatAnchor.GetContentAnchor(); +if (pAnchorPos) +{ +SwTextNode* pTextNode = pAnchorPos->nNode.GetNode().GetTextNode(); +if (pTextNode) +{ +SwTextAttr* pAttr = pTextNode->GetTextAttrAt( +pAnchorPos->nContent.GetIndex(), RES_TXTATR_CONTENTCONTROL, SwTextNode::PARENT); +if (pAttr)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/data/HiddenSection.odt |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 50 +++ sw/source/core/doc/docfld.cxx| 28 ++- sw/source/core/docnode/ndsect.cxx|1 4 files changed, 77 insertions(+), 2 deletions(-) New commits: commit 7e10b37030eb2a5afe783f078d36556d86da762e Author: Tomaž Vajngerl AuthorDate: Thu Jul 14 11:07:45 2022 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Tue Jul 19 06:55:30 2022 +0200 tdf#54703 fix unhiding at PDF export of cond. hidden sections The conditionally hidden sections became visible when PDF export is performed. This is due to field update where we temporary made the conditionally hidden section visible (as the frame is needed), but never put them back to hidden. Probably the expectation was that the condition will be recalculated later on, but wasn't. This change fixes this so that the changed sections will be recalculated at the end. Change-Id: Ic6d8a4a38f22ed961b2b37e05aaf3e720fc50ed4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137052 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit 868b45039d2d168e1c51d971b0d1e0589d4d11eb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137073 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/uiwriter/data/HiddenSection.odt b/sw/qa/extras/uiwriter/data/HiddenSection.odt new file mode 100644 index ..8358cbc9951a Binary files /dev/null and b/sw/qa/extras/uiwriter/data/HiddenSection.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 8e78a70f97c1..59f8047ca82f 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -14,9 +14,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -3161,6 +3163,54 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140757) CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testConditionalHiddenSectionIssue) +{ +// tdf#54703 +// When exporting the bug document as PDF, the conditional hidden +// sections became visible in the PDF and in the document. + +std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get(); +if (!pPDFium) +return; + +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "HiddenSection.odt"); + +// Check section conditional hidden status - all should be hidden (IsCondHidden == true) +for (SwNodeOffset i(0); i < pDoc->GetNodes().Count(); ++i) +{ +if (SwSectionNode const* const pNode = pDoc->GetNodes()[i]->GetSectionNode()) +{ +CPPUNIT_ASSERT_EQUAL(true, pNode->GetSection().IsCondHidden()); +} +} + +// PDF export +uno::Reference xStorable(mxComponent, uno::UNO_QUERY); +utl::MediaDescriptor aMediaDescriptor; +aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); +xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); + +SvFileStream aFile(maTempFile.GetURL(), StreamMode::READ); +SvMemoryStream aMemory; +aMemory.WriteStream(aFile); +auto pPdfDocument = pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize()); +CPPUNIT_ASSERT(pPdfDocument); +auto pPdfPage = pPdfDocument->openPage(0); +CPPUNIT_ASSERT(pPdfPage); + +// No PDF object should be present in the page - sections remained hidden +CPPUNIT_ASSERT_EQUAL(0, pPdfPage->getObjectCount()); + +// Check section conditional hidden status - all should remained hidden (IsCondHidden == true) +for (SwNodeOffset i(0); i < pDoc->GetNodes().Count(); ++i) +{ +if (SwSectionNode const* const pNode = pDoc->GetNodes()[i]->GetSectionNode()) +{ +CPPUNIT_ASSERT_EQUAL(true, pNode->GetSection().IsCondHidden()); +} +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index a1a7434a25b6..d0e489b7b027 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -840,6 +840,9 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) // new version: walk all fields of the attribute pool m_pFieldSortList.reset(new SetGetExpFields); +// remembeer sections that were unhidden and need to be hidden again +std::vector> aUnhiddenSections; + // consider and unhide sections // with hide condition, only in mode GETFLD_ALL () // notes by OD: @@ -886,13 +889,27 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) { pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode(); OSL_ENSURE( pSectNd, "Where is my SectionNode" ); -
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/layout/layout2.cxx|2 - sw/qa/extras/ooxmlexport/ooxmlexport12.cxx |3 +- sw/source/core/crsr/callnk.cxx | 42 - sw/source/core/inc/UndoTable.hxx |8 + sw/source/core/undo/untbl.cxx |2 + 5 files changed, 43 insertions(+), 14 deletions(-) New commits: commit cc7de9022b83c4103f1dc9ba6a8c1a8a98a21324 Author: Michael Stahl AuthorDate: Mon Jul 11 19:20:33 2022 +0200 Commit: Thorsten Behrens CommitDate: Thu Jul 14 23:03:06 2022 +0200 sw: fix spurious layout invalidation from ~SwCallLink() This code was added in commit 56b2cf0c10d9caa01ebae1d80465e342d046a85c "sw-collapse-empty-table-par-like-html.diff" and leaves us to guess what it should do. Apparently it's trying to replicate a Word feature where an empty paragraph at the end of a table cell and preceded by a nested table is effectively hidden, *unless* the user moves the cursor into it, at which point it grows to its ordinary height. The problem is that this is implemented by invalidating the position of any table once the cursor is moved into it, causing it to be reformatted, at potentially great expense, regardless if the cursor is actually on a paragraph that may be hidden. Also limit invalidations to when the cursor has actually moved to a different node. To fix tdf#105330, un-collapse a paragraph after Undo, requires additionally doing the same notification from SwUndoInsTable::UndoImpl() because the SwCallLink won't see the removed table any more. Mysteriously this causes the test SwLayoutWriter2 testTdf124261 to fail in Jenkins, but only on MacOSX so impossible to debug; tb86 fails with: layout2.cxx:2227:testTdf124261::TestBody equality assertion failed - Expected: 1721 - Actual : 5437 ... and tb84 with: layout2.cxx:2227:testTdf124261::TestBody equality assertion failed - Expected: 1721 - Actual : 3740 Change-Id: Ifd55097735d3675e6b82264f455baa44e9c9e30a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136963 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 6707c3323ba76ad4c148249be69ad33af63917f3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136989 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 0d9aa5058f50..24c4d32acc5d 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -2099,7 +2099,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testUserFieldTypeLanguage) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124261) { -#if !defined(_WIN32) +#if !defined(_WIN32) && !defined(MACOSX) // Make sure that pressing a key in a btlr cell frame causes an immediate, correct repaint. SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf124261.docx"); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 284651d3a760..2ba905a82c62 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1729,7 +1729,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf88496) // 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(2, getPages()); +CPPUNIT_ASSERT_EQUAL(3, getPages()); +// (this appears to have the correct result now?) // 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 diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index 50a1fc99eec9..c4f2ccdff10e 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -31,6 +31,7 @@ #include #include #include +#include SwCallLink::SwCallLink( SwCursorShell & rSh ) : m_rShell( rSh ) @@ -60,24 +61,36 @@ SwCallLink::SwCallLink( SwCursorShell & rSh ) } } -static void lcl_notifyRow(const SwContentNode* pNode, SwCursorShell & rShell) +namespace sw { + +/** + An empty paragraph inside a table with a nested table preceding it + should be hidden, unless the cursor is positioned in the paragraph. + + If the cursor is now (or was previously) inside such a paragraph, + send a size change notification on the row frame to force reformatting. + */ +void NotifyTableCollapsedParagraph(const SwContentNode *const pNode, SwCursorShell *const pShell) { if ( !pNode ) return; -SwFrame *const pMyFrame = pNode->getLayoutFrame( rShell.GetLayout() ); +SwFrame *const pMyFrame =
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/odfimport/data/tdf149978.fodt | 53 + sw/qa/extras/odfimport/odfimport.cxx | 12 ++ sw/source/core/txtnode/thints.cxx |9 ++-- 3 files changed, 69 insertions(+), 5 deletions(-) New commits: commit 589111d34eb333196490f0bae2e3542a5e6bc13d Author: Michael Stahl AuthorDate: Wed Jul 13 16:11:29 2022 +0200 Commit: Thorsten Behrens CommitDate: Thu Jul 14 23:04:08 2022 +0200 tdf#149978 sw: ODF import: fix nondeterministic automatic styles The problem is that in SwpHints::TryInsertHint() there is a check for IsInXMLImport() that is presumably an optimization to avoid the potentially expensive call to BuildPortions(). While LO would only produce 1 text:span referencing an automatic style around any given character content, this is not required by ODF, and so other producers may legitimately produce such nested text:span elements. Unfortunately the current SwpHints::Insert() isn't deterministic, the RES_TXTATR_AUTOFMT with same start/end will be compared by address in CompareSwpHtStart() (whereas RES_TXTATR_CHARFMT has a sort number for this), so the result is going to be a random order. Change-Id: Id62a7ff5fb85dbe42b7e1a27b0d8b36b74cf1100 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137033 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit d7827f712ddd21a6c1e151f54dc6eba5c12690da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137056 Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/odfimport/data/tdf149978.fodt b/sw/qa/extras/odfimport/data/tdf149978.fodt new file mode 100644 index ..5c4840c258fc --- /dev/null +++ b/sw/qa/extras/odfimport/data/tdf149978.fodt @@ -0,0 +1,53 @@ + +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"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + foo bar baz + foo bar baz + foo bar baz + foo bar baz + foo bar baz + foo bar baz + foo bar baz + foo bar baz + foo bar baz + foo bar baz + + + + diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index d0235dfbd88d..c46061a5f30c 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -371,6 +371,18 @@ CPPUNIT_TEST_FIXTURE(Test, testDateFormFormats) } } +CPPUNIT_TEST_FIXTURE(Test, testTdf149978) +{ +load(mpTestDocumentPath, "tdf149978.fodt"); +// on Linux the bug
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf149711.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 11 +++ sw/source/filter/ww8/docxattributeoutput.cxx |2 ++ 3 files changed, 13 insertions(+) New commits: commit 1e0ea56691bee9bd44e657bb4dca77d29c43ec76 Author: László Németh AuthorDate: Tue Jul 12 17:53:55 2022 +0200 Commit: László Németh CommitDate: Wed Jul 13 09:25:56 2022 +0200 tdf#149707 sw_redlinenum DOCX export: fix tracked moving of list items Change tracking of the paragraph mark of moved list items wasn't exported. I.e. moveFrom and moveTo paragraphs are exported as old paragraphs with new content, e.g. accepting a removed list item and rejecting an inserted list item leave empty list items instead removing the list items completely in MSO. Note: in Writer the import of the old (incomplete) DOCX export worked before this commit, too. Change-Id: I9367d880af16aab376178ab6d226b3013688997c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137005 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 51c7eef3fea7278679d975f75df2e7b564516258) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136983 Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/data/tdf149711.docx b/sw/qa/extras/ooxmlexport/data/tdf149711.docx new file mode 100644 index ..d90efa7c1f88 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf149711.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 3d4d3934f425..284651d3a760 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1368,6 +1368,17 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149708) assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:ins"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf149707) +{ +loadAndSave("tdf149711.docx"); +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); +assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:moveFrom"); +assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:moveTo"); +// These were missing +assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:moveFrom"); +assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:rPr/w:moveTo"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf70234) { loadAndSave("tdf70234.docx"); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 34760189fa09..a3a91a77827e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2973,6 +2973,8 @@ void DocxAttributeOutput::InitCollectedRunProperties() FSNS( XML_w, XML_rPrChange ), FSNS( XML_w, XML_del ), FSNS( XML_w, XML_ins ), +FSNS( XML_w, XML_moveFrom ), +FSNS( XML_w, XML_moveTo ), FSNS( XML_w14, XML_glow ), FSNS( XML_w14, XML_shadow ), FSNS( XML_w14, XML_reflection ),
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf142715.odt |binary sw/qa/extras/uiwriter/uiwriter6.cxx | 42 +++ sw/source/core/doc/textboxhelper.cxx | 13 + 3 files changed, 44 insertions(+), 11 deletions(-) New commits: commit 66fa07371f9db8c1f0d492ccbc493317fae7b3cc Author: Attila Bakos (NISZ) AuthorDate: Thu Jun 30 15:48:07 2022 +0200 Commit: László Németh CommitDate: Wed Jul 13 09:25:30 2022 +0200 tdf#142715 sw: fix crash on exit when textbox inserted to table This reverts commit 06e2cbb31d0ea703df872b91eb8eacdcaced7653 "tdf#130805 SwTextBoxHelper::create: fix frame position in shape" which caused this regression. That fix is not necessary any more: synchronization does the same without crashing. Note: according to this, unit test of commit 06e2cbb31d0ea703df872b91eb8eacdcaced7653 wasn't removed. Change-Id: I45bc15d3cf6a5d93b8c54cb4e68018702e58efff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136674 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 9188d7389c06496905c351a936b85974c1ae516f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136982 Tested-by: Jenkins diff --git a/sw/qa/extras/uiwriter/data/tdf142715.odt b/sw/qa/extras/uiwriter/data/tdf142715.odt new file mode 100644 index ..70682a54056c Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf142715.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index e52e16abba71..6a341088d8e6 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -2055,6 +2056,47 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testNestedGroupTextBoxCopyCrash) assertXPath(pLayout, "/root/page/body/txt/anchored/fly[2]"); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testCrashOnExit) +{ +// Load the bugdoc with a table and a textbox shape inside. +CPPUNIT_ASSERT(createSwDoc(DATA_DIRECTORY, "tdf142715.odt")); + +// Get the textbox selected +CPPUNIT_ASSERT_EQUAL(1, getShapes()); +auto xShape = getShape(1); +CPPUNIT_ASSERT(xShape); +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +CPPUNIT_ASSERT(xModel); +uno::Reference xController = xModel->getCurrentController(); +CPPUNIT_ASSERT(xController); +uno::Reference xSelection(xController, uno::UNO_QUERY); +CPPUNIT_ASSERT(xSelection); +CPPUNIT_ASSERT(xSelection->select(uno::Any(xShape))); +CPPUNIT_ASSERT(xSelection->getSelection().hasValue()); +uno::Reference xProperties(xShape, uno::UNO_QUERY); + +// Check if the textbox is selected +CPPUNIT_ASSERT_EQUAL(true, xProperties->getPropertyValue("TextBox").get()); + +// Remove the textbox +dispatchCommand(mxComponent, ".uno:RemoveTextBox", {}); +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT_EQUAL(false, xProperties->getPropertyValue("TextBox").get()); + +// Readd the textbox (to run the textboxhelper::create() method) +dispatchCommand(mxComponent, ".uno:AddTextBox", {}); +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT_EQUAL(true, xProperties->getPropertyValue("TextBox").get()); + +// save and reload +reload("writer8", "tdf142715_.odt"); + +// Before the fix this crashed here and could not reopen. +CPPUNIT_ASSERT_MESSAGE("Crash on exit, isn't it?", mxComponent); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testCaptionShape) { createSwDoc(); diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index dffe2d8acb62..131bbaa164b3 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -93,17 +93,8 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, SdrObject* pObject, bool bCo pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY); uno::Reference xTextContentAppend(xTextDocument->getText(), uno::UNO_QUERY); -try -{ -uno::Reference XSourceShape(pObject->getUnoShape(), -uno::UNO_QUERY_THROW); -xTextContentAppend->insertTextContentWithProperties( -xTextFrame, uno::Sequence(), XSourceShape->getAnchor()); -} -catch (uno::Exception&) -{ -xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence()); -} +xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence()); + // Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls). uno::Reference xRealTextFrame(xTextFrame, uno::UNO_QUERY); auto pTextFrame = dynamic_cast(xRealTextFrame.get());
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf149708.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 15 +-- sw/source/filter/ww8/docxattributeoutput.cxx |1 + 3 files changed, 14 insertions(+), 2 deletions(-) New commits: commit 80694a8fcfeb86ed69425ab6954b353b9a0ae854 Author: László Németh AuthorDate: Tue Jul 5 19:11:10 2022 +0200 Commit: Xisco Fauli CommitDate: Wed Jul 6 13:19:25 2022 +0200 tdf#149708 sw_redlinenum DOCX export: track inserted list items Change tracking of the paragraph mark of an inserted list item wasn't exported. I.e. a new list item was exported as an old empty list item with new tracked text content. It was loaded with bad actual/original numbering, and rejection of the incomplete insertion left an empty list item in the list instead of removing that list item completely. Note: the problem was inherited from OOo. See also commit 508ed558948353a3eb8be9adf3588368e440f4cf "tdf#115524 sw_redlinenum: show original numbering of insertions" and commit 4e5f89d2d3511b6421b388ecaba2f61ada14d084 "tdf#119848 DOCX export: keep tracked deleted empty line". Change-Id: I869ba2f39749e188015f7c7371e5caf1d39060f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136838 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit afe9f6b33eff5d7e7bc43d185d413117cd229572) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136857 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf149708.docx b/sw/qa/extras/ooxmlexport/data/tdf149708.docx new file mode 100644 index ..5eee4a124ff7 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf149708.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 8b4fc39dd02d..3d4d3934f425 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1359,6 +1359,15 @@ CPPUNIT_TEST_FIXTURE(Test, testTrackChangesEmptyParagraphsInADeletion) "/w:document/w:body/w:p[" + OString::number(i) + "]/w:pPr/w:rPr/w:del"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf149708) +{ +loadAndSave("tdf149708.docx"); +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); +// keep tracked insertion of a list item +// This was 0 (missing tracked insertion of the paragraph mark) +assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:ins"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf70234) { loadAndSave("tdf70234.docx"); @@ -1493,8 +1502,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128156) { loadAndSave("tdf128156.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); -// import change tracking in frames -assertXPath(pXmlDoc, "//w:ins"); +// keep tracked insertion of a paragraph +// This was 0 before 350972a8bffc1a74b531e0336954bf54b1356025, +// and 1 later (missing tracked insertion of the paragraph mark) +assertXPath(pXmlDoc, "//w:ins", 2); } CPPUNIT_TEST_FIXTURE(Test, testTdf125546) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3923f0ac7b63..34760189fa09 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2972,6 +2972,7 @@ void DocxAttributeOutput::InitCollectedRunProperties() FSNS( XML_w, XML_oMath ), FSNS( XML_w, XML_rPrChange ), FSNS( XML_w, XML_del ), +FSNS( XML_w, XML_ins ), FSNS( XML_w14, XML_glow ), FSNS( XML_w14, XML_shadow ), FSNS( XML_w14, XML_reflection ),
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/layout/data/tdf149709.fodt | 41 +++ sw/qa/extras/layout/layout2.cxx | 57 sw/source/core/txtnode/ndtxt.cxx|6 +++ 3 files changed, 104 insertions(+) New commits: commit eea2c6b59812950fd7b9a67532ac1a584da6aa46 Author: László Németh AuthorDate: Fri Jul 1 11:49:45 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Jul 4 10:57:14 2022 +0200 tdf#149709 sw_redlinenum: fix list levels Levels of ORIGTEXT SwNodeNum weren't updated, resulting bad numbering of multilevel lists during editing and file import. Follow-up to commit d0e49c07203c9ae33c5dfa1855b2b8909c3e16dc "tdf#115524 sw_redlinenum: show original numbering of insertions". Change-Id: I478971643a10b2007f37a4f0074067896d546228 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136734 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 21acc6f261ace78b470dc982dd8283bb06a975ae) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136713 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/layout/data/tdf149709.fodt b/sw/qa/extras/layout/data/tdf149709.fodt new file mode 100644 index ..0a33515d1ca9 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf149709.fodt @@ -0,0 +1,41 @@ + + +http://www.w3.org/1999/xlink; xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:ooow="http://openoffice.org/2004/writer; xmlns:oooc="http://openoffice.org/2004/calc; xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:rpt="http://openoffice.org/2005/report; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:officeooo="http://openoffice.org/2009/office; xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names: experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + + + + + + Item + + + Item + + + Item + + + + + Item + + + + + diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 08160784a4d0..9a366b00a15d 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -395,6 +395,63 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149710_RedlineNumberingEditing) assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[5]/text", "3."); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149709_RedlineNumberingLevel) +{ +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf149709.fodt"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +// Show Changes +SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); +SwRootFrame* pLayout(pWrtShell->GetLayout()); +CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); + +// insert a new list item at start of the second list item "a)" +dispatchCommand(mxComponent, ".uno:TrackChanges", {}); +pWrtShell->Down(false, 1); +pWrtShell->SplitNode(false); + +// Dump the rendering of the first page as an XML file. +SwDocShell* pShell = pDoc->GetDocShell(); +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; + +xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +CPPUNIT_ASSERT(pXmlDoc); + +// Show the correct and the original line numbering instead of counting +// the deleted list items in Show Changes mode, as part of the list +assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[1]/text", "1."); +assertXPathContent(pXmlDoc,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/layout/data/tdf115524.fodt | 44 sw/qa/extras/layout/layout2.cxx | 21 +++ sw/source/core/txtnode/ndtxt.cxx|7 + 3 files changed, 72 insertions(+) New commits: commit 508ed558948353a3eb8be9adf3588368e440f4cf Author: László Németh AuthorDate: Tue Jun 28 11:20:45 2022 +0200 Commit: László Németh CommitDate: Wed Jun 29 14:32:12 2022 +0200 tdf#115524 sw_redlinenum: show original numbering of insertions in Show Changes mode, according to the name "Show Changes" and according to the interoperability requirements. Follow-up to commit 2413f213625253a9c2b1787b3b9fe859d724a9bd "tdf#115523 sw_redlinenum: show correct, also original numbering" and commit d3b0fb222f96964d7bd2b82fe20e1547f731b7a6 "tdf#149710 sw_redlinenum: update numbering at deletion". Change-Id: I32476baa3daa73b48f9398282cbe7837d95b0a04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136562 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 05312bbcaf7c0a8b58b1e8b9f107261933e9a31b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136536 diff --git a/sw/qa/extras/layout/data/tdf115524.fodt b/sw/qa/extras/layout/data/tdf115524.fodt new file mode 100644 index ..4e589ad9a1a4 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf115524.fodt @@ -0,0 +1,44 @@ + + +http://www.w3.org/1999/xlink; xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:ooow="http://openoffice.org/2004/writer; xmlns:oooc="http://openoffice.org/2004/calc; xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:rpt="http://openoffice.org/2005/report; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:officeooo="http://openoffice.org/2009/office; xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names: experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + + + Unknown Author + 2022-06-27T14:35:42 + + + + + + + Item + + + Item + + + New item + + + Item + + + + + diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 66941abc4269..08160784a4d0 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -332,6 +332,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering) assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[5]/text", "2.[3.] "); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering2) +{ +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf115524.fodt"); +SwDocShell* pShell = pDoc->GetDocShell(); + +// Dump the rendering of the first page as an XML file. +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; + +xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +CPPUNIT_ASSERT(pXmlDoc); + +// Show the correct and the original line numbering in Show Changes mode +assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[1]/text", "1."); +assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[3]/text", "2."); +// FIXME: show as 3.[2.] +assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[5]/text", "3."); +// This was "4." (not shown the original number) +assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[7]/text", "4.[3.] "); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149710_RedlineNumberingEditing) { SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf149710.fodt"); diff --git
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/core/unocore/unocore.cxx | 40 sw/source/core/unocore/unoparagraph.cxx | 14 +++ 2 files changed, 44 insertions(+), 10 deletions(-) New commits: commit 6e66573f5d589b49865ddf9febda925da5cb1d68 Author: Miklos Vajna AuthorDate: Mon Jun 27 10:18:32 2022 +0200 Commit: Miklos Vajna CommitDate: Mon Jun 27 14:44:40 2022 +0200 tdf#149668 sw: fix DOCX->ODT: Multilevel lists causing list numbering reset The bug document had an outer (ordered) numbering and an inner one, finally the outer numbering was continued. This was fine after DOCX import, but once we saved to ODT and re-opened, the second outer numbering was restarted, not continued the first outer one. This happened because on one hand, lcl_SwXParagraph_getPropertyState() says that the state of the ListId property is "default" if the paragraph's item set doesn't have a RES_PARATR_LIST_ID, but on the other hand xmloff/ will only write the xml:id="..." attribute on a list if the ListId state is not default. This is a problem, because it can happen that xmloff/ refers to a list later by its id, even if the list doesn't have a RES_PARATR_LIST_ID set. Fix the problem by relaxing the condition where lcl_SwXParagraph_getPropertyState() reports FN_UNO_LIST_ID as non-default: just require that that the text node has a numbering rule + the numbering rule has at least one continue list. This fixes the reported DOCX -> ODT case with named list styles and keeps the original ODT import and HTML import use-cases working to not write un-referenced xml:id="..." attributes on export. This was a regression from commit 8f48f91009caa86d896f247059874242ed18bf39 (ODT export: omit unreferenced , 2022-03-10). (cherry picked from commit 5938687e5764ee50759374b54d2bb1cf0e0d59d3) Change-Id: I300ebe7aa7da71a336c03abe7530074b696417f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136486 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index 56b9ed4c74de..bd2385d1eb54 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -639,6 +639,46 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlDate) CPPUNIT_ASSERT_EQUAL(OUString("008000"), pContentControl->GetColor()); } +CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testListIdState) +{ +// Given a document with 3 paragraphs: an outer numbering on para 1 & 3, an inner numbering on +// para 2: +SwDoc* pDoc = createSwDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +{ +SfxItemSetFixed aSet(pWrtShell->GetAttrPool()); +SwNumRuleItem aItem("Numbering ABC"); +aSet.Put(aItem); +pWrtShell->SetAttrSet(aSet); +} +pWrtShell->SplitNode(); +{ +SfxItemSetFixed aSet(pWrtShell->GetAttrPool()); +SwNumRuleItem aItem("Numbering 123"); +aSet.Put(aItem); +pWrtShell->SetAttrSet(aSet); +} +pWrtShell->SplitNode(); +{ +SfxItemSetFixed aSet(pWrtShell->GetAttrPool()); +SwNumRuleItem aItem("Numbering ABC"); +aSet.Put(aItem); +pWrtShell->SetAttrSet(aSet); +} + +// When checking if xml:id="..." needs writing for the first paragraph during ODT export: +uno::Reference xPara(getParagraph(1), uno::UNO_QUERY); +beans::PropertyState eState = xPara->getPropertyState("ListId"); + +// Then make sure that xml:id="..." gets written for para 1, as it'll be continued in para 3. +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 0 (DIRECT_VALUE) +// - Actual : 1 (DEFAULT_VALUE) +// i.e. para 1 didn't write an xml:id="..." but para 3 referred to it using continue-list="...", +// which is inconsistent. +CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, eState); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index d13bd6c65945..7485b98b1580 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -922,18 +922,12 @@ static beans::PropertyState lcl_SwXParagraph_getPropertyState( } case FN_UNO_LIST_ID: { -if (*ppSet) +SwNumRule* pNumRule = rTextNode.GetNumRule(); +if (pNumRule && pNumRule->HasContinueList()) { -if ((*ppSet)->GetItemState(RES_PARATR_LIST_ID, false) == SfxItemState::SET) -{ -SwNumRule* pNumRule = rTextNode.GetNumRule(); -if (!pNumRule || pNumRule->HasContinueList()) -{ -eRet = beans::PropertyState_DIRECT_VALUE; -
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/layout/data/tdf149710.fodt | 31 +++ sw/qa/extras/layout/layout2.cxx | 42 ++ sw/source/core/doc/DocumentRedlineManager.cxx | 12 +++ 3 files changed, 85 insertions(+) New commits: commit d3b0fb222f96964d7bd2b82fe20e1547f731b7a6 Author: László Németh AuthorDate: Fri Jun 24 11:21:46 2022 +0200 Commit: László Németh CommitDate: Fri Jun 24 21:14:49 2022 +0200 tdf#149710 sw_redlinenum: update numbering at deletion in Show Changes mode. Follow-up to commit 2413f213625253a9c2b1787b3b9fe859d724a9bd "tdf#115523 sw_redlinenum: show correct, also original numbering". Change-Id: Iebf54775f3850e668ac5b12ecbd9f010b4e93ee4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136363 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 4430bf8f97b1438252dc494cae89863d24469d2b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136392 diff --git a/sw/qa/extras/layout/data/tdf149710.fodt b/sw/qa/extras/layout/data/tdf149710.fodt new file mode 100644 index ..c936b9f9bcef --- /dev/null +++ b/sw/qa/extras/layout/data/tdf149710.fodt @@ -0,0 +1,31 @@ + + +http://www.w3.org/1999/xlink; xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:ooow="http://openoffice.org/2004/writer; xmlns:oooc="http://openoffice.org/2004/calc; xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:rpt="http://openoffice.org/2005/report; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:officeooo="http://openoffice.org/2009/office; xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names: experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + Item + + + Item + + + Item + + + + + diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 57e06f05553e..66941abc4269 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -332,6 +332,48 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering) assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[5]/text", "2.[3.] "); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149710_RedlineNumberingEditing) +{ +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf149710.fodt"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +// Show Changes +SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); +SwRootFrame* pLayout(pWrtShell->GetLayout()); +CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); + +// delete the paragraph mark of the first list item with change tracking +dispatchCommand(mxComponent, ".uno:GoToEndOfLine", {}); +dispatchCommand(mxComponent, ".uno:TrackChanges", {}); +dispatchCommand(mxComponent, ".uno:Delete", {}); + +// Dump the rendering of the first page as an XML file. +SwDocShell* pShell = pDoc->GetDocShell(); +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; + +xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +CPPUNIT_ASSERT(pXmlDoc); + +// Show the correct and the original line numbering instead of counting +// the deleted list items in Show Changes mode, as part of the list +// This was "1." +assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[1]/text", "[1.] "); +// This was "2." (deleted text node, now its text content is part of the first list item) +assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[3]/text", "1.[2.] "); +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter2.cxx | 22 +- sw/source/core/docnode/nodes.cxx|1 - sw/source/core/edit/edatmisc.cxx| 34 ++ sw/source/core/edit/edfcol.cxx | 15 --- 4 files changed, 3 insertions(+), 69 deletions(-) New commits: commit c0008da4f9884c92b8403823c935750d59b9552b Author: Michael Stahl AuthorDate: Thu Jun 16 19:38:43 2022 +0200 Commit: Michael Stahl CommitDate: Thu Jun 23 12:33:36 2022 +0200 tdf#134759 sw: do CopyToModify() for both start and end node ... in SwNodes::MoveRange(). SwRangeRedline::Hide() does CopyToSection()/DelCopyOfSection() so the previous commit fixed it, and SwRangeRedline::Show() does MoveFromSection() so hopefully this should fix it to restore the situation before hiding. This caused several tests to fail, and the reason appears to be that they pretty much tested exactly the problem that's being fixed with this commit, but the pre-existing fixes and the new one cancel each other out. In all cases the pre-exising fix moves all redlines and moves them back again, which is the sort of thing that sw_redlinehide wanted to get rid of; not sure why i didn't notice this earlier. The check for the 3rd paragraph where the style was applied still succeeds with the new bugfix, but the one for the 1st paragraph fails; it is unclear why applying a style to the 3rd paragraph should have an effect on the 1st one. Hence: Revert code changes of commit 1d65ffc5a37be21e0316019b1c96eb9a1c871ac0 "tdf#105413 track changes: keep paragraph styles" Revert code changes of commit d97fc64a819f834302e384792668507df4cc412c "tdf#122893 track changes: keep paragraph alignment" Revert code changes of commit 6a54dd844d1821165642bbcc16bd12a01a23393d "tdf#122901 track changes: keep paragraph top and bottom borders" Change-Id: I0b70134902a7993c7bb11a3c619e45742764c8ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136056 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 2ba5363d19e8229bfe8948a4ac8473d794dba5e9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136246 diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 0ff16f74e59d..8e78a70f97c1 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -2147,9 +2147,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105413) IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // Set Heading 1 paragraph style in the 3th paragraph. -// Because of the tracked deleted region between them, -// this sets also the same style in the first paragraph automatically -// to keep the changed paragraph style at hiding tracked changes or saving the document SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); @@ -2165,9 +2162,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105413) getProperty(getParagraph(3), "ParaStyleName")); CPPUNIT_ASSERT_EQUAL(OUString("Standard"), getProperty(getParagraph(2), "ParaStyleName")); -// first paragraph gets the same heading style -CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), - getProperty(getParagraph(1), "ParaStyleName")); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817) @@ -2589,9 +2583,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122893) IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // Set center-aligned paragraph with preset double line spacing in the 3th paragraph. -// Because of the tracked deleted region between them, -// this sets also the same formatting in the first paragraph automatically -// to keep the changed paragraph formatting at hiding tracked changes or saving the document SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); @@ -2610,10 +2601,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122893) CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty(getParagraph(2), "ParaLineSpacing") .Height); // single line spacing -// first paragraph is also center-aligned with double line spacing -CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty(getParagraph(1), "ParaAdjust")); -CPPUNIT_ASSERT_EQUAL( -sal_Int16(200), getProperty(getParagraph(1), "ParaLineSpacing").Height); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122901) @@ -2639,9 +2626,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122901)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter7.cxx | 19 ++- sw/source/core/text/itrform2.cxx| 13 - 2 files changed, 22 insertions(+), 10 deletions(-) New commits: commit b345858e92351ceb997cf8e77024d7fe573a99c6 Author: Mark Hung AuthorDate: Sat Jun 11 19:52:28 2022 +0800 Commit: Xisco Fauli CommitDate: Thu Jun 16 21:15:29 2022 +0200 tdf#149089 snap to grid if IsSnapToChars() is false for non-CJK scripts. Non Asian text was centered within as many cells as required according to ODF1.2 20.301. But it also required that text should be snapped to grid if style:layout-grid-snap-to is true ( i.e. IsSnapToChars() is false ) per ODF1.2 20.305. That means ODF1.2 20.301 ruled. This patch changes the width of inserted SwKernGridPortion so that non-CJK text aligns to the edge of text grid to make ODF1.2 20.301 rule, an provide more consistent layout result as expected. Change-Id: Id6b4d2b965e20670eb9ddf657d36b8a49073f32a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135654 Tested-by: Jenkins Reviewed-by: Mark Hung (cherry picked from commit 47eff9bf12abf963907b4d3dcb90b73e0ccc646d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135984 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index 8b5a23d1a695..0ac6b0183068 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -2779,11 +2779,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf149089) { createSwDoc(DATA_DIRECTORY, "tdf149089.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); -sal_Int32 nTextPortionWidth = getXPath(pXmlDoc, "(//SwLinePortion)[1]", "width").toInt32(); -sal_Int32 nKernPortionWidth = getXPath(pXmlDoc, "(//SwLinePortion)[2]", "width").toInt32(); -// nKernPortionWidth was about 1/3 of nTextPortionWidth -double nRatio = double(nKernPortionWidth) / nTextPortionWidth; -CPPUNIT_ASSERT_LESS(0.05, nRatio); +sal_Int32 nPorLen1 = getXPath(pXmlDoc, "(//SwLinePortion)[1]", "length").toInt32(); +sal_Int32 nPorLen2 = getXPath(pXmlDoc, "(//SwLinePortion)[2]", "length").toInt32(); +sal_Int32 nPorLen3 = getXPath(pXmlDoc, "(//SwLinePortion)[3]", "length").toInt32(); +// Two SwTextPortion and one SwKernPortion +CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nPorLen1); // SwTextPortion " " +CPPUNIT_ASSERT_EQUAL(sal_Int32(12), nPorLen2); // SwTextPortion "BUG " +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nPorLen3); // SwKernPortion + +sal_Int32 nPorWidth1 = getXPath(pXmlDoc, "(//SwLinePortion)[1]", "width").toInt32(); +sal_Int32 nPorWidth2 = getXPath(pXmlDoc, "(//SwLinePortion)[2]", "width").toInt32(); +sal_Int32 nPorWidth3 = getXPath(pXmlDoc, "(//SwLinePortion)[3]", "width").toInt32(); +sal_Int32 nGridWidth1 = nPorWidth1 / 3; +sal_Int32 nGridWidth2 = (nPorWidth2 + nPorWidth3) / 7; +CPPUNIT_ASSERT_EQUAL(nGridWidth1, nGridWidth2); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index e7bcde5983b8..563ddd5c4c02 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -686,15 +686,18 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo ) 0; const SwTwips nTmpWidth = i * nGridWidth; const SwTwips nKernWidth = std::min(nTmpWidth - nSumWidth, nRestWidth); -const SwTwips nKernWidth_1 = nKernWidth / 2; +const SwTwips nKernWidth_1 = pGrid->IsSnapToChars() ? +nKernWidth / 2 : 0; OSL_ENSURE( nKernWidth <= nRestWidth, "Not enough space left for adjusting non-asian text in grid mode" ); +if (nKernWidth_1) +{ +pGridKernPortion->Width( pGridKernPortion->Width() + nKernWidth_1 ); +rInf.X( rInf.X() + nKernWidth_1 ); +} -pGridKernPortion->Width( pGridKernPortion->Width() + nKernWidth_1 ); -rInf.X( rInf.X() + nKernWidth_1 ); - -if ( ! bFull ) +if ( ! bFull && nKernWidth - nKernWidth_1 > 0 ) new SwKernPortion( *pPor, static_cast(nKernWidth - nKernWidth_1), false, true );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/htmlexport/htmlexport.cxx | 41 sw/source/filter/html/htmlatr.cxx | 12 +++-- sw/source/filter/html/htmlnumwriter.cxx |4 ++- sw/source/filter/html/wrthtml.hxx |3 +- 4 files changed, 56 insertions(+), 4 deletions(-) New commits: commit e1168fac4c7164454b679d4114f348a005efbcee Author: Miklos Vajna AuthorDate: Thu Jun 16 15:55:23 2022 +0200 Commit: Xisco Fauli CommitDate: Thu Jun 16 21:14:58 2022 +0200 sw HTML export, XHTML mode: fix lost with a list header + item There is a general mismatch between XHTML and Writer lists: XHTML can only contain list items (for ordered or unordered lists), while Writer can contain list headers and list items. List headers have no bullet or number at the start, list items are the normal text nodes. Commit 8c2607ae3ce143586e623532b8ae5288277ec3ac (sw HTML export, XHTML mode: fix lost when last list item is not numbered, 2022-02-21) fixed the list item end side of this problem: if all text nodes in a list are headers, then don't write ul/ol at all, otherwise end list headers with as well to make sure the output XML is valid. However, this created a mis-match, the starting for list headers in a list which have non-header text nodes at as was not adapted. Fix the problem by extending OutHTML_SwFormat() so list headers in a list with non-header text nodes always have a and , and this condition is the same on the start/end side. Calculating if at least one text node is non-header in a list may not be cheap, so reuse the already calculated info from OutHTML_NumberBulletListStart() in OutHTML_SwFormat(). Change-Id: I3817a489f16166fc5b4c33ee64e2283c41a4402c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135999 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit b2bee5a4db5552c4d408800908ca717b4ea2564a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135990 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index bc0af92e93c0..44654bdbcf5a 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -1530,6 +1530,47 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testPartiallyNumberedList) "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:p", 2); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListHeaderAndItem) +{ +// Given a document with a list, first para is not numbered, but the second is: +loadURL("private:factory/swriter", nullptr); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); +pWrtShell->Insert("not numbered"); +SwDoc* pDoc = pWrtShell->GetDoc(); +sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); +SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos]; +{ +SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->nNode.GetNode(); +SwTextNode& rTextNode = *rNode.GetTextNode(); +rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); +rTextNode.SetCountedInList(false); +} +pWrtShell->SplitNode(); +pWrtShell->Insert2("numbered"); +{ +SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->nNode.GetNode(); +SwTextNode& rTextNode = *rNode.GetTextNode(); +rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName())); +} + +// When exporting to ReqIF: +ExportToReqif(); + +// Then make sure the output is well-formed xhtml: +SvMemoryStream aStream; +HtmlExportTest::wrapFragment(maTempFile, aStream); +xmlDocUniquePtr pXmlDoc = parseXmlStream(); +// Without the accompanying fix in place, this test would have failed: +// Entity: line 3: parser error : Opening and ending tag mismatch: ol line 3 and li +// not numbered +CPPUNIT_ASSERT(pXmlDoc); +// Make sure that in case the list has a header and an item, then both are wrapped in an +// element. +assertXPath(pXmlDoc, + "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:p", 2); +} + CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testBlockQuoteNoMargin) { // Given a document with some text, para style set to Quotations, no bottom margin: diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 1f1254c19bb3..db67572c545c 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -681,11 +681,12 @@ static void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat, if( nNewDefListLvl != rHWrt.m_nDefListLvl ) rHWrt.OutAndSetDefList( nNewDefListLvl ); +bool bAtLeastOneNumbered = false; // if necessary, start a bulleted or numbered list if( rInfo.bInNumberBulletList
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter2.cxx | 95 sw/source/core/doc/DocumentContentOperationsManager.cxx |4 sw/source/core/doc/docedt.cxx |7 + sw/source/core/inc/UndoRedline.hxx |8 + sw/source/core/inc/mvsave.hxx |2 sw/source/core/undo/unredln.cxx | 32 + 6 files changed, 142 insertions(+), 6 deletions(-) New commits: commit 767237c7eace6537098de69083035dd5c322c1e5 Author: Michael Stahl AuthorDate: Wed Jun 15 15:08:16 2022 +0200 Commit: Michael Stahl CommitDate: Thu Jun 16 11:56:00 2022 +0200 tdf#135976 sw: preserve flys on backspace/delete with redlining enabled This is a continuation of commit 85376a02348810812d515ee72140dbf56f2b6040 for the case when redlining is turned on. Also try to restore the anchors in SwUndoRedlineDelete. (regression from commit 3345feb67f2c49a1b76639965b56968e1c5f03ee) Change-Id: I4199f5755398d469a606618c037ad9756cb7aeba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135909 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 4b7210b16ce6a817e154de5589a7651cbaf473c9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135935 diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index e62532c0a20d..0ff16f74e59d 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -1081,6 +1082,100 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139982) CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf135976) +{ +SwDoc* const pDoc = createSwDoc(); +SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + +pWrtShell->Insert("foobar"); + +pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, /*bBasicCall=*/false); +SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR); +anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint()); +SfxItemSet flySet(pDoc->GetAttrPool(), svl::Items); +flySet.Put(anchor); +SwFrameFormat const* pFly = pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true); +CPPUNIT_ASSERT(pFly != nullptr); + +// turn on redlining and show changes +pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete + | RedlineFlags::ShowInsert); +dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); +CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); +CPPUNIT_ASSERT_MESSAGE( +"redlines should be visible", + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); +CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines()); + +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetLayout()->GetLastPage()->GetSortedObjs()->size()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(4), pFly->GetAnchor().GetContentAnchor()->nContent.GetIndex()); + +pWrtShell->UnSelectFrame(); +pWrtShell->SttEndDoc(/*bStart=*/false); +pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); + +pWrtShell->DelLeft(); +pWrtShell->DelLeft(); + +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); +// the problem was that the fly was deleted from the layout +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetLayout()->GetLastPage()->GetSortedObjs()->size()); +// check that the anchor was moved outside the redline +CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pFly->GetAnchor().GetContentAnchor()->nContent.GetIndex()); + +pWrtShell->Undo(2); + +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetLayout()->GetLastPage()->GetSortedObjs()->size()); +// check that the anchor was restored +CPPUNIT_ASSERT_EQUAL(sal_Int32(4), pFly->GetAnchor().GetContentAnchor()->nContent.GetIndex()); + +pWrtShell->Redo(2); + +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetLayout()->GetLastPage()->GetSortedObjs()->size()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pFly->GetAnchor().GetContentAnchor()->nContent.GetIndex()); + +pWrtShell->Undo(2); + +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetLayout()->GetLastPage()->GetSortedObjs()->size()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(4), pFly->GetAnchor().GetContentAnchor()->nContent.GetIndex()); + +// now again in the other
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter2.cxx | 50 sw/source/core/doc/DocumentContentOperationsManager.cxx |9 ++ sw/source/core/doc/docedt.cxx |4 - sw/source/core/inc/mvsave.hxx |2 4 files changed, 62 insertions(+), 3 deletions(-) New commits: commit f3093d19db98ad06b7bc92ca193682d6292aa4ea Author: Michael Stahl AuthorDate: Fri Jun 10 16:26:40 2022 +0200 Commit: Michael Stahl CommitDate: Tue Jun 14 14:24:55 2022 +0200 tdf#139982 sw: preserve flys in Replace with redlining enabled The problem is that there isn't a redline type "Replace" so it's represented as Delete+Insert. To prevent the flys anchored in the text from being deleted, move the anchors to the point between the old (deleted) and new (inserted) text. (regression from commit 28b77c89dfcafae82cf2a6d85731b643ff9290e5) Change-Id: Ib600c9dbfb9421917e4b8d61195c48cf0b364f06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135604 Tested-by: Michael Stahl Reviewed-by: Michael Stahl (cherry picked from commit 646c6ddd91a98afddf914e3889cb269fc814c060) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135736 Tested-by: Jenkins diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 8aedaf38ef7a..e62532c0a20d 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1031,6 +1031,56 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140007) pDoc->GetNodes()[SwNodeOffset(11)]->GetTextNode()->GetText()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139982) +{ +SwDoc* const pDoc = createSwDoc(); +SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + +// turn on redlining 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())); + +pWrtShell->Insert("helloo"); + +pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); +{ +SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR); +anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint()); +SfxItemSet flySet(pDoc->GetAttrPool(), svl::Items); +flySet.Put(anchor); +SwFrameFormat const* pFly = pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true); +CPPUNIT_ASSERT(pFly != nullptr); +} + +pWrtShell->SttEndDoc(true); +pWrtShell->EndPara(/*bSelect=*/true); + +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); + +pWrtShell->Replace("hello", true); + +// the problem was that a redline delete with the same author as redline +// insert has its text deleted immediately, including anchored flys. +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); + +pWrtShell->Undo(); + +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); + +pWrtShell->Redo(); + +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); + +pWrtShell->Undo(); + +CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM)); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf39721) { // FIXME: disabled on Windows because of a not reproducible problem (not related to the patch) diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 4fcf4519a09f..3d38a8f9521f 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -4601,6 +4601,14 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt InsertItemSet( aTmpRange, aSet ); } +// tdf#139982: Appending the redline may immediately delete flys +// anchored in the previous text if it's inside an insert redline. +// Also flys will be deleted if the redline is accepted. Move them +// to the position between the previous text and the new text, +// there the chance of surviving both accept and reject is best. +SaveFlyArr flys; +SaveFlyInRange(aDelPam, *aDelPam.End(), flys, false); + if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { m_rDoc.GetIDocumentUndoRedo().AppendUndo( @@ -4611,6 +4619,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt pCursor->SetMark();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/uibase/shells/shells.cxx | 30 ++ sw/source/uibase/shells/textsh1.cxx |2 +- 2 files changed, 31 insertions(+), 1 deletion(-) New commits: commit a0db69e9e4cf2f7144dfc53fa32fb027c4b76f5f Author: Miklos Vajna AuthorDate: Fri Jun 10 16:13:04 2022 +0200 Commit: Miklos Vajna CommitDate: Mon Jun 13 14:23:25 2022 +0200 tdf#149509 sw content controls: reject page break insertion Similar to input fields, the intention is to keep the start and end of (inline) content controls within the same text node, so just disable the command in this context, as Word does. Change-Id: Ib797ad164a3a36b4bbde4d686cde29adf6db96bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135599 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit aa5824b2a6df99ef9d788a8d37bdfa77582375c8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135689 diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx index 902998bcdb1a..5a99b8e3c6bf 100644 --- a/sw/qa/uibase/shells/shells.cxx +++ b/sw/qa/uibase/shells/shells.cxx @@ -231,6 +231,36 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyLocalCopyContextMenu) CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, eState); } +CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testContentControlPageBreak) +{ +// Given a document with a content control and a cursor inside the content control: +SwDoc* pDoc = createSwDoc(); +uno::Reference xMSF(mxComponent, uno::UNO_QUERY); +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xText = xTextDocument->getText(); +uno::Reference xCursor = xText->createTextCursor(); +xText->insertString(xCursor, "test", /*bAbsorb=*/false); +xCursor->gotoStart(/*bExpand=*/false); +xCursor->gotoEnd(/*bExpand=*/true); +uno::Reference xContentControl( +xMSF->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY); +xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +pWrtShell->SttEndDoc(/*bStt=*/true); +pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); + +// When trying to insert a page break: +dispatchCommand(mxComponent, ".uno:InsertPagebreak", {}); + +// Then make sure that the document still has a single page: +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 1 +// - Actual : 2 +// i.e. inline content control had its start and end in different text nodes, which is not +// allowed. +CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index e74e47a98e39..4531da1486f3 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1896,7 +1896,7 @@ void SwTextShell::GetState( SfxItemSet ) case FN_INSERT_BREAK_DLG: case FN_INSERT_COLUMN_BREAK: case FN_INSERT_PAGEBREAK: -if( rSh.CursorInsideInputField() ) +if( rSh.CursorInsideInputField() || rSh.CursorInsideContentControl() ) { rSet.DisableItem( nWhich ); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter2.cxx | 87 sw/source/core/undo/unins.cxx |5 +- 2 files changed, 90 insertions(+), 2 deletions(-) New commits: commit ceb01278d8593ab4d2562f934af4fb196342bdf8 Author: Michael Stahl AuthorDate: Thu Jun 9 18:58:06 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Jun 13 13:27:08 2022 +0200 tdf#140007 sw: fix SwUndoReplace (regression from commit d6b0e84b236b78f4b21bd16e46dda3fa0876096d) Change-Id: I1facf1584a349d1d087438f4e6fd3a63a80c6f7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135585 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 45613274794636ba98d0e978fe872511297d275d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135705 diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 8e844e424578..8aedaf38ef7a 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -944,6 +944,93 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf131912) CPPUNIT_ASSERT_EQUAL(OUString("foo"), pWrtShell->GetCursor()->GetText()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140007) +{ +SwDoc* const pDoc = createSwDoc(); +SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + +pWrtShell->Insert("foo"); +pWrtShell->SplitNode(); +pWrtShell->Insert("bar"); +pWrtShell->SplitNode(); +pWrtShell->Insert("baz"); +CPPUNIT_ASSERT_EQUAL(SwNodeOffset(13), pDoc->GetNodes().Count()); +CPPUNIT_ASSERT_EQUAL(OUString("foo"), + pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText()); +CPPUNIT_ASSERT_EQUAL(OUString("bar"), + pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText()); +CPPUNIT_ASSERT_EQUAL(OUString("baz"), + pDoc->GetNodes()[SwNodeOffset(11)]->GetTextNode()->GetText()); + +pWrtShell->SttEndDoc(true); +pWrtShell->EndPara(false); +pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); +pWrtShell->Replace(" ", true); +CPPUNIT_ASSERT_EQUAL(SwNodeOffset(12), pDoc->GetNodes().Count()); +CPPUNIT_ASSERT_EQUAL(OUString("foo bar"), + pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText()); +CPPUNIT_ASSERT_EQUAL(OUString("baz"), + pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText()); + +pWrtShell->SttEndDoc(true); +pWrtShell->EndPara(false); +pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); +pWrtShell->Replace(" ", true); +CPPUNIT_ASSERT_EQUAL(OUString("foo bar baz"), + pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText()); +CPPUNIT_ASSERT_EQUAL(SwNodeOffset(11), pDoc->GetNodes().Count()); + +pWrtShell->Undo(); + +CPPUNIT_ASSERT_EQUAL(SwNodeOffset(12), pDoc->GetNodes().Count()); +CPPUNIT_ASSERT_EQUAL(OUString("foo bar"), + pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText()); +CPPUNIT_ASSERT_EQUAL(OUString("baz"), + pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText()); + +pWrtShell->Undo(); + +CPPUNIT_ASSERT_EQUAL(SwNodeOffset(13), pDoc->GetNodes().Count()); +CPPUNIT_ASSERT_EQUAL(OUString("foo"), + pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText()); +CPPUNIT_ASSERT_EQUAL(OUString("bar"), + pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText()); +CPPUNIT_ASSERT_EQUAL(OUString("baz"), + pDoc->GetNodes()[SwNodeOffset(11)]->GetTextNode()->GetText()); + +pWrtShell->Redo(); + +CPPUNIT_ASSERT_EQUAL(SwNodeOffset(12), pDoc->GetNodes().Count()); +CPPUNIT_ASSERT_EQUAL(OUString("foo bar"), + pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText()); +CPPUNIT_ASSERT_EQUAL(OUString("baz"), + pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText()); + +pWrtShell->Redo(); + +CPPUNIT_ASSERT_EQUAL(OUString("foo bar baz"), + pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText()); +CPPUNIT_ASSERT_EQUAL(SwNodeOffset(11), pDoc->GetNodes().Count()); + +pWrtShell->Undo(); + +CPPUNIT_ASSERT_EQUAL(SwNodeOffset(12), pDoc->GetNodes().Count()); +CPPUNIT_ASSERT_EQUAL(OUString("foo bar"), + pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText()); +CPPUNIT_ASSERT_EQUAL(OUString("baz"), + pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText()); + +pWrtShell->Undo(); + +CPPUNIT_ASSERT_EQUAL(SwNodeOffset(13), pDoc->GetNodes().Count()); +CPPUNIT_ASSERT_EQUAL(OUString("foo"), + pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText()); +