[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 20 commits - cui/source nlpsolver/src readlicense_oo/license sccomp/source sc/source sw/qa sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Sun Aug 2 08:36:45 UTC 2020
cui/source/dialogs/SpellDialog.cxx | 13
nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java | 4
nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java | 4
nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/SCOSolverImpl.java | 5
readlicense_oo/license/CREDITS.fodt | 3209 +++++-----
sc/source/ui/dbgui/csvruler.cxx | 36
sc/source/ui/inc/csvruler.hxx | 7
sccomp/source/solver/SwarmSolver.cxx | 2
sw/qa/extras/uiwriter/data/tdf132944.odt |binary
sw/qa/extras/uiwriter/data/tdf133967.odt |binary
sw/qa/extras/uiwriter/data/tdf134250.fodt | 86
sw/qa/extras/uiwriter/data/tdf134252.fodt | 95
sw/qa/extras/uiwriter/data/tdf134436.fodt | 83
sw/qa/extras/uiwriter/uiwriter.cxx | 256
sw/source/core/doc/DocumentContentOperationsManager.cxx | 22
sw/source/core/doc/DocumentRedlineManager.cxx | 211
sw/source/core/inc/UndoDelete.hxx | 2
sw/source/core/layout/frmtool.cxx | 6
sw/source/core/layout/tabfrm.cxx | 1
sw/source/core/layout/trvlfrm.cxx | 61
sw/source/core/text/txtfrm.cxx | 5
sw/source/core/undo/undel.cxx | 48
22 files changed, 2404 insertions(+), 1752 deletions(-)
New commits:
commit 441b0848c0ef54bd2fb6bab0822890f11a884fe5
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Jul 31 14:46:13 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:33:47 2020 +0200
tdf#134965 sw: avoid RemoveFollowFlowLine() SNAFU
A follow-flow-line SwRowFrame is deleted in RemoveFollowFlowLine()
while it is being iterated in stack frame #18.
0 SwRowFrame::~SwRowFrame() (this=0xaa035b0, __in_chrg=<optimized out>) at sw/source/core/layout/tabfrm.cxx:3807
1 SwFrame::DestroyFrame(SwFrame*) (pFrame=0xaa035b0) at sw/source/core/layout/ssfrm.cxx:389
2 SwTabFrame::RemoveFollowFlowLine() (this=0x9c16790) at sw/source/core/layout/tabfrm.cxx:945
3 SwTabFrame::MakeAll(OutputDevice*) (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/tabfrm.cxx:2203
4 SwFrame::PrepareMake(OutputDevice*) (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:370
5 SwFrame::Calc(OutputDevice*) const (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
6 SwFrame::PrepareMake(OutputDevice*) (this=0x925b740, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248
7 SwFrame::Calc(OutputDevice*) const (this=0x925b740, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
8 SwFrame::PrepareMake(OutputDevice*) (this=0x925b8e0, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248
9 SwFrame::Calc(OutputDevice*) const (this=0x925b8e0, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
10 SwFrame::PrepareMake(OutputDevice*) (this=0x925ba70, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248
11 SwFrame::Calc(OutputDevice*) const (this=0x925ba70, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
12 SwFrame::MakePos() (this=0x925bc20) at sw/source/core/layout/calcmove.cxx:552
13 SwTextFrame::MakePos() (this=0x925bc20) at sw/source/core/text/frmform.cxx:339
14 SwContentFrame::MakeAll(OutputDevice*) (this=0x925bc20) at sw/source/core/layout/calcmove.cxx:1408
15 SwFrame::PrepareMake(OutputDevice*) (this=0x925bc20, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:370
16 SwFrame::Calc(OutputDevice*) const (this=0x925bc20, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
17 SwContentFrame::CalcLowers(SwLayoutFrame&, SwLayoutFrame const&, long, bool) (rLay=..., rDontLeave=..., nBottom=168478, bSkipRowSpanCells=true) at sw/source/core/layout/tabfrm.cxx:1521
18 lcl_RecalcRow(SwRowFrame&, long) (rRow=..., nBottom=168478) at sw/source/core/layout/tabfrm.cxx:1651
19 SwTabFrame::MakeAll(OutputDevice*) (this=0x93ec7e0, pRenderContext=0x72afaf0) at sw/source/core/layout/tabfrm.cxx:2421
20 SwFrame::PrepareMake(OutputDevice*) (this=0x3df3cc0, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:316
21 SwFrame::Calc(OutputDevice*) const (this=0x3df3cc0, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
22 GetFrameOfModify(SwRootFrame const*, SwModify const&, SwFrameType, SwPosition const*, std::pair<Point, bool> const*) (pLayout=0x72aa850, rMod=..., nFrameType=(SwFrameType::Txt | SwFrameType::NoTxt), pPos=0x71f35e0, pViewPosAndCalcFrame=0x7ffc99f591a0) at sw/source/core/layout/frmtool.cxx:3697
23 SwContentNode::getLayoutFrame(SwRootFrame const*, SwPosition const*, std::pair<Point, bool> const*) const (this=0x6fcfb50, _pRoot=0x72aa850, pPos=0x71f35e0, pViewPosAndCalcFrame=0x7ffc99f591a0) at sw/source/core/docnode/node.cxx:1194
24 SwCursorShell::GetCurrFrame(bool) const (this=0x72a9730, bCalcFrame=true) at sw/source/core/crsr/crsrsh.cxx:2455
25 SwFEShell::GetAnyCurRect(CurRectType, Point const*, com::sun::star::uno::Reference<com::sun::star::embed::XEmbeddedObject> const&) const (this=0x72a9730, eType=CurRectType::PageCalc, pPt=0x0, xObj=empty uno::Reference) at sw/source/core/frmedt/fews.cxx:113
26 SwView::StateStatusLine(SfxItemSet&) (this=0x72af430, rSet=SfxItemSet of pool 0x6fa3d50 with parent 0x0 and Which ranges: [(10000, 10000), (10221, 10221), (10223, 10225), (11064, 11065), (21182, 21182), (21185, 21185), (21189, 21189)] = {...}) at sw/source/uibase/uiview/view2.cxx:1517
Not obvious why this changed with calling MakeFrames() instead of
SwNodes::CopyNodes(bNewFrames=true) or how to best prevent it; adding
another FrameDeleteGuard avoids the crash at least.
(regression from 166b5010b402a41b192b1659093a25acf9065fd9)
Change-Id: Ifd5a0c93064c9536429dda30a2c4ebc7a31b7e7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99870
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit aed92491f356b008fe1cd25b5cd6cc43279db3a3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99848
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 1674ed1a08ba..9cf90591cd99 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2382,6 +2382,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
GetUpper()->Grow( LONG_MAX, true ) );
{
+ SwFrameDeleteGuard g(Lower()); // tdf#134965 prevent RemoveFollowFlowLine()
SetInRecalcLowerRow( true );
::lcl_RecalcRow(*static_cast<SwRowFrame*>(Lower()), nDeadLine);
SetInRecalcLowerRow( false );
commit 7e1144085bfa328da5e3269c59ba5c6578f2cbaa
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Jul 30 18:27:28 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:33:40 2020 +0200
tdf#134436 sw: fix SwUndoDelete::RedoImpl() with section at end...
... of document; the root cause is that in some intermediate delete
operation, the delete will remove a section start/end node pair that
surrounds the last text node in the document, but
SwUndoDelete::RedoImpl() will not remove it, thus for subsequent Undo
actions the indexes are messed up and weird things happen.
Fix this in DocumentContentOperationsManager::DeleteRangeImplImpl(),
with the same weird "is point at the end" check as SwUndoDelete.
Change-Id: Iebf20d3c129c69692df8d57e3c5b9e6fec281e4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99810
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 22a77cb83a3769a8b43d80565282988a74214866)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99858
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/qa/extras/uiwriter/data/tdf134436.fodt b/sw/qa/extras/uiwriter/data/tdf134436.fodt
new file mode 100644
index 000000000000..40d02a83a23b
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf134436.fodt
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:officeooo="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">
+ <office:font-face-decls>
+ <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="Source Han Serif CN" svg:font-family="'Source Han Serif CN'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ <style:paragraph-properties fo:orphans="0" fo:widows="0" text:number-lines="false" text:line-number="0"/>
+ </style:style>
+ <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
+ <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
+ <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="Table1" style:family="table">
+ <style:table-properties style:width="17cm" table:align="margins"/>
+ </style:style>
+ <style:style style:name="Table1.A" style:family="table-column">
+ <style:table-column-properties style:column-width="17cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Table1.A1" style:family="table-cell">
+ <style:table-cell-properties fo:padding="0.097cm" fo:border="0.05pt solid #000000"/>
+ </style:style>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+ <style:text-properties officeooo:rsid="001bc824" officeooo:paragraph-rsid="001bc824"/>
+ </style:style>
+ <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Table_20_Contents">
+ <style:text-properties officeooo:rsid="001bc824" officeooo:paragraph-rsid="001bc824"/>
+ </style:style>
+ <style:style style:name="Sect1" style:family="section">
+ <style:section-properties style:editable="false">
+ <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+ </style:section-properties>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <table:table table:name="Table1" table:style-name="Table1">
+ <table:table-column table:style-name="Table1.A"/>
+ <table:table-row>
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:p text:style-name="P2">a</text:p>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:p text:style-name="P1">b</text:p>
+ <text:section text:style-name="Sect1" text:name="Section1">
+ <text:p text:style-name="P1"/>
+ </text:section>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 77f313f04e90..49e2d3251fce 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -5478,6 +5478,87 @@ void SwUiWriterTest::testRedlineCopyPaste()
CPPUNIT_ASSERT_EQUAL(OUString("abcdefgh"), pTextNode->GetText());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf134436)
+{
+ load(DATA_DIRECTORY, "tdf134436.fodt");
+
+ SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pXTextDocument);
+ SwDoc * pDoc = pXTextDocument->GetDocShell()->GetDoc();
+ CPPUNIT_ASSERT(pDoc);
+ SwWrtShell * pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ CPPUNIT_ASSERT(pWrtShell);
+
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+
+ // select all 3 times, table at the start
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ // the stupid SwXTextView::getString doesn't work "for symmetry" so use CursorShell
+ CPPUNIT_ASSERT_EQUAL(OUString("a\nb\n"), pWrtShell->GetCursor()->GetText());
+
+ // first, the section doesn't get deleted
+ lcl_dispatchCommand(mxComponent, ".uno:Delete", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString(""), pWrtShell->GetCursor()->GetText());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString("a\nb\n"), pWrtShell->GetCursor()->GetText());
+
+ // second, the section does get deleted because point is at the end
+ lcl_dispatchCommand(mxComponent, ".uno:Delete", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString(""), pWrtShell->GetCursor()->GetText());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString("a\nb\n"), pWrtShell->GetCursor()->GetText());
+
+ // the problem was that the section was not deleted on Redo
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString(""), pWrtShell->GetCursor()->GetText());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString("a\nb\n"), pWrtShell->GetCursor()->GetText());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString(""), pWrtShell->GetCursor()->GetText());
+}
+
void SwUiWriterTest::testRedlineParam()
{
// Create a document with minimal content.
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index af03431639b2..162b8389e463 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4235,6 +4235,19 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam)
if( aSttIdx != nEnde )
{
+ // tdf#134436 delete section nodes like SwUndoDelete::SwUndoDelete
+ SwNode *pTmpNd;
+ while (pEnd == rPam.GetPoint()
+ && nEnde + 2 < m_rDoc.GetNodes().Count()
+ && (pTmpNd = m_rDoc.GetNodes()[nEnde + 1])->IsEndNode()
+ && pTmpNd->StartOfSectionNode()->IsSectionNode()
+ && aSttIdx <= pTmpNd->StartOfSectionNode()->GetIndex())
+ {
+ SwNodeRange range(*pTmpNd->StartOfSectionNode(), *pTmpNd);
+ m_rDoc.GetNodes().SectionUp(&range);
+ --nEnde; // account for deleted start node
+ }
+
// delete the Nodes into the NodesArary
m_rDoc.GetNodes().Delete( aSttIdx, nEnde - aSttIdx.GetIndex() );
}
commit 077d70b52268d48b4a21cc031636c78e1610d731
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Jul 31 13:32:29 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:33:35 2020 +0200
tdf#134931 sw_redlinehide: fix layout following paste of table
The pasted table does get a SwTabFrame but the problem is that
TurboAction() is called and formats the pre-existing SwTextFrame and
somehow that just sets all the valid flags on the new SwTabFrame without
doing any formatting.
Previously, SwNodes::CopyNodes(bNewFrames=true) would call
SwTabFrame::Paste() which invalidates the page.
In InsertCnt_(), for new SwSectionFrames InvalidatePage() is already
called so do the same for SwTabFrame which gets rid of the "turbo".
(regression from 166b5010b402a41b192b1659093a25acf9065fd9)
Change-Id: I970a04bd8e76f5418bddb66af915ac466f44daf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99867
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 5f7b937e9f81824f11022bc6b4dd222f700883cd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99845
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index af968c9d3e58..745c1818d859 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1615,6 +1615,10 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
pPageMaker->CheckInsert( nIndex );
pFrame->InsertBehind( pLay, pPrv );
+ if (pPage) // would null in SwCellFrame ctor
+ { // tdf#134931 call ResetTurbo(); not sure if Paste() would be
+ pFrame->InvalidatePage(pPage); // better than InsertBehind()?
+ }
// #i27138#
// notify accessibility paragraphs objects about changed
// CONTENT_FLOWS_FROM/_TO relation.
commit 5775510ab35a1ab9c20d4e766a9a36e03bff802e
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Jul 30 01:28:14 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:33:30 2020 +0200
tdf#133967: sw_uiwriter: Add unittest
Change-Id: I7ec43fd7109e883b0ae560cc8832e449a09fddb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99758
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
(cherry picked from commit a6e02f6337f038a445b858bb91bf14d1a14768e4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99735
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99791
diff --git a/sw/qa/extras/uiwriter/data/tdf133967.odt b/sw/qa/extras/uiwriter/data/tdf133967.odt
new file mode 100644
index 000000000000..18ed5bfb7844
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf133967.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 12d41e02ef8b..77f313f04e90 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -233,6 +233,7 @@ public:
void testSearchWithTransliterate();
void testTdf73660();
void testNewDocModifiedState();
+ void testTdf133967();
void testTdf132187();
void testTdf77342();
void testTdf63553();
@@ -444,6 +445,7 @@ public:
CPPUNIT_TEST(testSearchWithTransliterate);
CPPUNIT_TEST(testTdf73660);
CPPUNIT_TEST(testNewDocModifiedState);
+ CPPUNIT_TEST(testTdf133967);
CPPUNIT_TEST(testTdf132187);
CPPUNIT_TEST(testTdf77342);
CPPUNIT_TEST(testTdf63553);
@@ -4345,6 +4347,34 @@ void SwUiWriterTest::testUnicodeNotationToggle()
CPPUNIT_ASSERT_EQUAL( sDocString, sOriginalDocString );
}
+void SwUiWriterTest::testTdf133967()
+{
+ load(DATA_DIRECTORY, "tdf133967.odt");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ CPPUNIT_ASSERT_EQUAL(6, getPages());
+
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+ lcl_dispatchCommand(mxComponent, ".uno:Cut", {});
+ Scheduler::ProcessEventsToIdle();
+
+ for (sal_Int32 i = 0; i < 10; ++i)
+ {
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+ Scheduler::ProcessEventsToIdle();
+ }
+
+ // Without the fix in place, this test would have failed with:
+ //- Expected: 1
+ //- Actual : 45
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
void SwUiWriterTest::testTdf132187()
{
load(DATA_DIRECTORY, "tdf132187.odt");
commit c981c53ba3ec4d50cfcbceba8855c109768053a1
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jul 29 19:02:46 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:33:24 2020 +0200
tdf#134252 sw_redlinehide: fix SwUndoDelete for table before end of section
In this funny case, the SwPaM starts inside a section, and ends in the
first text node following the end of the section, which happens to be in
a different section (but that doesn't matter)... this is because
IsSelOvr() moves the end of the selection resulting in the 3rd SelAll
off of the table end node (as the section ends with a table), but then
it's on the section end node and moves forward again.
SwUndoDelete::UndoImpl() must first create the outer section frames,
skip over the start text node which has frames handled by
RecreateStartTextFrames() and then create the frames following the start
text node, where the end node of the outer section now finds its expected
outer section frame.
This relies on the code from 55576842ec72a748d0bad123d41fa03c89fc136d
to move the existing text frame below the new section frame(s).
(regression from 6c7245e789f973cf6dad03f7008ab3f9d12d350c)
Change-Id: I9f39b09e603e75ef813d5c855d828ec9bd5fdd95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99723
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 740f1796504f66408b692225a9676c9ee3d63722)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99785
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/data/tdf134252.fodt b/sw/qa/extras/uiwriter/data/tdf134252.fodt
new file mode 100644
index 000000000000..6e19ac847dd8
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf134252.fodt
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:officeooo="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">
+ <office:font-face-decls>
+ <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="Source Han Serif CN" svg:font-family="'Source Han Serif CN'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
+ <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
+ <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="Table1" style:family="table">
+ <style:table-properties style:width="17cm" table:align="margins"/>
+ </style:style>
+ <style:style style:name="Table1.A" style:family="table-column">
+ <style:table-column-properties style:column-width="17cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Table1.A1" style:family="table-cell">
+ <style:table-cell-properties fo:padding="0.097cm" fo:border="0.05pt solid #000000"/>
+ </style:style>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+ <style:text-properties officeooo:rsid="00078615" officeooo:paragraph-rsid="00078615"/>
+ </style:style>
+ <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Table_20_Contents">
+ <style:text-properties officeooo:rsid="00095b34" officeooo:paragraph-rsid="00095b34"/>
+ </style:style>
+ <style:style style:name="Sect1" style:family="section">
+ <style:section-properties fo:background-color="#81d41a" style:editable="false">
+ <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+ <style:background-image/>
+ </style:section-properties>
+ </style:style>
+ <style:style style:name="Sect2" style:family="section">
+ <style:section-properties style:editable="false">
+ <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+ </style:section-properties>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:sequence-decls>
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+ </text:sequence-decls>
+ <text:section text:style-name="Sect1" text:name="Section1">
+ <text:p text:style-name="P1">bar</text:p>
+ <table:table table:name="Table1" table:style-name="Table1">
+ <table:table-column table:style-name="Table1.A"/>
+ <table:table-row>
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:p text:style-name="P3">baz</text:p>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ </text:section>
+ <text:section text:style-name="Sect2" text:name="Section2">
+ <text:p text:style-name="P1">foo</text:p>
+ </text:section>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 0b4a9463f42c..12d41e02ef8b 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -4089,6 +4089,65 @@ static void lcl_dispatchCommand(const uno::Reference<lang::XComponent>& xCompone
xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, rPropertyValues);
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf134252)
+{
+ load(DATA_DIRECTORY, "tdf134252.fodt");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCursor(xTextViewCursorSupplier->getViewCursor());
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+
+ // select all with section
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString("bar" SAL_NEWLINE_STRING "baz" SAL_NEWLINE_STRING), xCursor->getString());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Delete", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString(""), xCursor->getString());
+
+ // this would crash
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString("bar" SAL_NEWLINE_STRING "baz" SAL_NEWLINE_STRING), xCursor->getString());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString(""), xCursor->getString());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString("bar" SAL_NEWLINE_STRING "baz" SAL_NEWLINE_STRING), xCursor->getString());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString(""), xCursor->getString());
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf134250)
{
load(DATA_DIRECTORY, "tdf134250.fodt");
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 677300380151..5cf415feab3a 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -1115,6 +1115,15 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
// create frames after SetSaveData has recreated redlines
if (0 != m_nNode)
{
+ if (m_nReplaceDummy != 0)
+ {
+ // tdf#134252 *first* create outer section frames
+ // note: text node m_nSttNode currently has frame with an upper;
+ // there's a hack in InsertCnt_() to move it below new section frame
+ SwNodeIndex const start(rDoc.GetNodes(), m_nSttNode - m_nReplaceDummy);
+ SwNodeIndex const end(rDoc.GetNodes(), m_nSttNode); // exclude m_nSttNode
+ ::MakeFrames(&rDoc, start, end);
+ }
// tdf#121031 if the start node is a text node, it already has a frame;
// if it's a table, it does not
// tdf#109376 exception: end on non-text-node -> start node was inserted
commit ff7414388cddcf4b1d4284b1376e72b976f052c8
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jul 29 14:55:49 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:33:14 2020 +0200
(related: tdf#134252) sw: fix assert when moving mouse pointer
SwPageFrame::GetModelPositionForViewPoint() was calling GetCharRect() on
a frame that doesn't match the passed prevTextPos; it was supposed to be
initialised by GetModelPositionForViewPoint() call but that didn't work
because the point was outside the frame so nothing was inited.
(regression from edd2db1c783bd571ff796a5298385cacc91877b9)
Change-Id: Ic064c3efc1b7f29d18d713206e5ea5ac0b67fbc8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99692
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 63308aa3b109271ffb4fd47e9fea2e3281a1552d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99780
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 8cb591d05026..9079d0a9cbab 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -289,42 +289,43 @@ bool SwPageFrame::GetCursorOfst( SwPosition *pPos, Point &rPoint,
comphelper::FlagRestorationGuard g(
pState->m_bPosMatchesBounds, true);
SwPosition prevTextPos(*pPos);
- SwLayoutFrame::GetCursorOfst(&prevTextPos, aPoint, pState);
-
- SwRect aTextRect;
- pTextFrame->GetCharRect(aTextRect, prevTextPos);
-
- if (prevTextPos.nContent < pContentNode->Len())
+ if (SwLayoutFrame::GetCursorOfst(&prevTextPos, aPoint, pState))
{
- // aRextRect is just a line on the left edge of the
- // previous character; to get a better measure from
- // lcl_getDistance, extend that to a rectangle over
- // the entire character.
- SwPosition const nextTextPos(prevTextPos.nNode,
- SwIndex(prevTextPos.nContent, +1));
- SwRect nextTextRect;
- pTextFrame->GetCharRect(nextTextRect, nextTextPos);
- SwRectFnSet aRectFnSet(pTextFrame);
- if (aRectFnSet.GetTop(aTextRect) ==
- aRectFnSet.GetTop(nextTextRect)) // same line?
+ SwRect aTextRect;
+ pTextFrame->GetCharRect(aTextRect, prevTextPos);
+
+ if (prevTextPos.nContent < pContentNode->Len())
{
- // need to handle mixed RTL/LTR portions somehow
- if (aRectFnSet.GetLeft(aTextRect) <
- aRectFnSet.GetLeft(nextTextRect))
+ // aRextRect is just a line on the left edge of the
+ // previous character; to get a better measure from
+ // lcl_getDistance, extend that to a rectangle over
+ // the entire character.
+ SwPosition const nextTextPos(prevTextPos.nNode,
+ SwIndex(prevTextPos.nContent, +1));
+ SwRect nextTextRect;
+ pTextFrame->GetCharRect(nextTextRect, nextTextPos);
+ SwRectFnSet aRectFnSet(pTextFrame);
+ if (aRectFnSet.GetTop(aTextRect) ==
+ aRectFnSet.GetTop(nextTextRect)) // same line?
{
- aRectFnSet.SetRight( aTextRect,
- aRectFnSet.GetLeft(nextTextRect));
- }
- else // RTL
- {
- aRectFnSet.SetLeft( aTextRect,
- aRectFnSet.GetLeft(nextTextRect));
+ // need to handle mixed RTL/LTR portions somehow
+ if (aRectFnSet.GetLeft(aTextRect) <
+ aRectFnSet.GetLeft(nextTextRect))
+ {
+ aRectFnSet.SetRight( aTextRect,
+ aRectFnSet.GetLeft(nextTextRect));
+ }
+ else // RTL
+ {
+ aRectFnSet.SetLeft( aTextRect,
+ aRectFnSet.GetLeft(nextTextRect));
+ }
}
}
- }
- nTextDistance = lcl_getDistance(aTextRect, rPoint);
- bValidTextDistance = true;
+ nTextDistance = lcl_getDistance(aTextRect, rPoint);
+ bValidTextDistance = true;
+ }
}
double nBackDistance = 0;
commit 954a0f6aacc85a0897fdd3625c14953deb9bdbf6
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Jul 28 19:12:19 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:33:09 2020 +0200
tdf#134250 sw_redlinehide: fix Undo with section before table
... at start of document, part 2:
In SwUndoDelete::UndoImpl(), the m_aEndStr wasn't inserted, because the
pTextNd was a section node.
This caused asserts when trying to add the history hints that used to be
in the end text node.
thints.cxx:1295: bool SwTextNode::InsertHint(SwTextAttr*, SetAttrMode): Assertion `!pAttr->GetEnd() || (*pAttr->GetEnd() <= Len())' failed.
(regression from 57d488660572d62ef0371e50dcdd4ca7a6d98a14)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99644
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 27613259990d39d34b036b3d717d3ceaf5c15e65)
tdf#134250 add unit test
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99672
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
(cherry picked from commit 50ceac91a4ac2057847e7d9807f5cb614e6ff755)
Change-Id: I48caa7487d2d1e6250b5aceab18f270555d3ee8f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99779
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/qa/extras/uiwriter/data/tdf134250.fodt b/sw/qa/extras/uiwriter/data/tdf134250.fodt
new file mode 100644
index 000000000000..86aaa140c9e7
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf134250.fodt
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:officeooo="http://openoffice.org/2009/office" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns
:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur
n:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:font-face-decls>
+ <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="Source Han Serif CN" svg:font-family="'Source Han Serif CN'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ <style:paragraph-properties fo:orphans="0" fo:widows="0" text:number-lines="false" text:line-number="0"/>
+ </style:style>
+
+ <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
+ <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
+ <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="Table1" style:family="table">
+ <style:table-properties style:width="17cm" table:align="margins"/>
+ </style:style>
+ <style:style style:name="Table1.A" style:family="table-column">
+ <style:table-column-properties style:column-width="17cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Table1.A1" style:family="table-cell">
+ <style:table-cell-properties fo:padding="0.097cm" fo:border="0.05pt solid #000000"/>
+ </style:style>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+ <style:text-properties officeooo:rsid="001fe5a9" officeooo:paragraph-rsid="001fe5a9"/>
+ </style:style>
+ <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Table_20_Contents">
+ <style:text-properties officeooo:rsid="001fe5a9" officeooo:paragraph-rsid="001fe5a9"/>
+ </style:style>
+ <style:style style:name="T1" style:family="text">
+ <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Sect1" style:family="section">
+ <style:section-properties style:editable="false">
+ <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+ </style:section-properties>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:section text:style-name="Sect1" text:name="Section1">
+ <table:table table:name="Table1" table:style-name="Table1">
+ <table:table-column table:style-name="Table1.A"/>
+ <table:table-row>
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:p text:style-name="P2">foo</text:p>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:p text:style-name="P1">b<text:span text:style-name="T1">a</text:span><text:bookmark text:name="Bookmark 1"/>r</text:p>
+ </text:section>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 241e27ef3aad..0b4a9463f42c 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -4089,6 +4089,67 @@ static void lcl_dispatchCommand(const uno::Reference<lang::XComponent>& xCompone
xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, rPropertyValues);
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf134250)
+{
+ load(DATA_DIRECTORY, "tdf134250.fodt");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+
+ uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+
+ uno::Reference<text::XTextContent> xTextContent(xSections->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xTextContent->getAnchor()->getString().endsWith("bar"));
+
+ // select all with table at start -> 3 times
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ lcl_dispatchCommand(mxComponent, ".uno:Copy", {});
+ lcl_dispatchCommand(mxComponent, ".uno:Paste", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+
+ // this would crash in 2 different ways
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+
+ // Without the fix in place, section's content would have been gone after undo
+ CPPUNIT_ASSERT(xTextContent->getAnchor()->getString().endsWith("bar"));
+
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT(xTextContent->getAnchor()->getString().endsWith("bar"));
+
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+}
+
void SwUiWriterTest::testDde()
{
#if HAVE_FEATURE_UI
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 0750062cfb47..677300380151 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -884,7 +884,17 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
if( m_aEndStr )
{
// discard attributes since they all saved!
- SwTextNode* pTextNd = aPos.nNode.GetNode().GetTextNode();
+ SwTextNode * pTextNd;
+ if (!m_bDelFullPara && aPos.nNode.GetNode().IsSectionNode())
+ { // tdf#134250 section node wasn't deleted; but aPos must point to it in bNodeMove case below
+ assert(m_nSttContent == 0);
+ assert(!m_aSttStr);
+ pTextNd = rDoc.GetNodes()[aPos.nNode.GetIndex() + 1]->GetTextNode();
+ }
+ else
+ {
+ pTextNd = aPos.nNode.GetNode().GetTextNode();
+ }
if( pTextNd && pTextNd->HasSwAttrSet() )
pTextNd->ResetAllAttr();
@@ -904,6 +914,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
lcl_ReAnchorAtContentFlyFrames(*rDoc.GetSpzFrameFormats(), aPos, nOldIdx);
pTextNd = aPos.nNode.GetNode().GetTextNode();
}
+ assert(pTextNd); // else where does m_aEndStr come from?
if( pTextNd )
{
OUString const ins( pTextNd->InsertText(*m_aEndStr, aPos.nContent,
commit 2657177f2b4a427b298572e6e7202f653d79e14a
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Jul 28 19:03:24 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:33:05 2020 +0200
tdf#134250 sw_redlinehide: fix copy non-empty node before non-textnode
The problem in CopyImplImpl() is that pCopyPam's end position was
updated to index 0 but text was copied into the node, which is thus not
covered by pCopyPam and thus also not by SwUndoInserts.
Then SwUndoInserts::UndoImpl() doesn't delete the bookmarks in the end
node and the bookmark positions cause ~SwIndexReg asserts.
Change-Id: I4cc03e846eae4cabd9eb4346a98c1e5c2866050d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99643
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 8ec8da5638ab465e69900a08067ad496bcb5d3d5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99778
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index f834b8817492..af03431639b2 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -5068,7 +5068,14 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
if( rPos.nNode != aInsPos )
{
pCopyPam->GetMark()->nNode = aInsPos;
- pCopyPam->GetMark()->nContent.Assign(pCopyPam->GetContentNode(false), 0);
+ if (aInsPos < rPos.nNode)
+ { // tdf#134250 decremented in (pEndTextNd && !pDestTextNd) above
+ pCopyPam->GetContentNode(false)->MakeEndIndex(&pCopyPam->GetMark()->nContent);
+ }
+ else // incremented in (!pSttTextNd && pDestTextNd) above
+ {
+ pCopyPam->GetMark()->nContent.Assign(pCopyPam->GetContentNode(false), 0);
+ }
rPos = *pCopyPam->GetMark();
}
else
commit 3683e0ac630182d6ff84aa3d797a5315c5ef793b
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Tue Jul 28 11:32:03 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:33:00 2020 +0200
Related tdf#135211: return early if no data
With DEPS or SCO Evolutionary algorithms, it'll return
"No solution found."
Change-Id: I15e8e24eb519a20e3f3645b79e990949f648fbd2
Change-Id: I7321419ccc1cd00d75f03fa86d3c0cb4bf9ad473
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99584
Tested-by: Julien Nabet <serval2412 at yahoo.fr>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
(cherry picked from commit a7e92d71d72d69b887bf716f30af37105f206915)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99548
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
(cherry picked from commit 158a3f478ff021be3c30fcc73b9ba779f4b40fbb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99738
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java
index c0b10c2f4951..c5724ca5461e 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java
@@ -189,6 +189,10 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver {
protected void initializeSolve() {
super.initializeSolve();
+ if (m_variableCount == 0)
+ {
+ return;
+ }
if (m_enhancedSolverStatus.getValue())
m_solverStatusDialog = new EvolutionarySolverStatusUno(m_xContext);
else
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
index f152cf92d481..aff425ba4e20 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
@@ -119,6 +119,10 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver
Logger.getLogger(DEPSSolverImpl.class.getName()).log(Level.SEVERE, null, ex);
}
initializeSolve();
+ if (m_problemEncoder == null)
+ {
+ return;
+ }
//Init:
DEPSAgent[] agents = new DEPSAgent[m_swarmSize.getValue()];
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/SCOSolverImpl.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/SCOSolverImpl.java
index cefe51006751..c1798606d4e6 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/SCOSolverImpl.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/SCOSolverImpl.java
@@ -90,6 +90,11 @@ public final class SCOSolverImpl extends BaseEvolutionarySolver
public void solve() {
initializeSolve();
+ if (m_problemEncoder == null)
+ {
+ return;
+ }
+
//Init:
int swarmSize = m_swarmSize.getValue();
SCAgent[] agents = new SCAgent[swarmSize];
commit 8e32e9143522c2c10170972b46a3fc691a221577
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Tue Jul 28 10:09:02 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:32:55 2020 +0200
tdf#135211: fix crash Swarm Non Linear Solver with blank input
See bt here:
https://bugs.documentfoundation.org/attachment.cgi?id=163668
Change-Id: I78f59e420aa183399f650915c7c28a138b8ed444
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99572
Tested-by: Julien Nabet <serval2412 at yahoo.fr>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
(cherry picked from commit 2d150393479bd010c8758b1a1b712f8fb4ce4024)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99546
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
(cherry picked from commit 2080c4e2a4852538d3739d70e3c706ec3fc8fb28)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99736
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sccomp/source/solver/SwarmSolver.cxx b/sccomp/source/solver/SwarmSolver.cxx
index c15745cf7eee..f7961b66d053 100644
--- a/sccomp/source/solver/SwarmSolver.cxx
+++ b/sccomp/source/solver/SwarmSolver.cxx
@@ -501,6 +501,8 @@ void SAL_CALL SwarmSolver::solve()
maStatus.clear();
mbSuccess = false;
+ if (!maVariables.getLength())
+ return;
maBounds.resize(maVariables.getLength());
commit c1d6f8458eaeeeb09479f88cb2a80f39464cdc1b
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 29 21:05:27 2020 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:32:49 2020 +0200
rhbz#1861794 csv fixed width import missing split handle
regression from...
commit 1e97ca02773e2ba968606eed61d25d88f0d7e417
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Oct 14 11:05:07 2019 +0100
EndMouseTracking was left uncalled
Change-Id: Ia952addac585737c3d3aa4fd68d772c3acbae848
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99733
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx
index 294f22526974..9fe9f6433359 100644
--- a/sc/source/ui/dbgui/csvruler.cxx
+++ b/sc/source/ui/dbgui/csvruler.cxx
@@ -106,7 +106,7 @@ void ScCsvRuler::SetDrawingArea(weld::DrawingArea* pDrawingArea)
{
ScCsvControl::SetDrawingArea(pDrawingArea);
- mnSplitSize = (GetCharWidth() * 3 / 5) | 1; // make an odd number
+ UpdateSplitSize();
Size aSize(1, GetTextHeight() + mnSplitSize + 2);
pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
@@ -162,10 +162,17 @@ void ScCsvRuler::InitColors()
InvalidateGfx();
}
+void ScCsvRuler::UpdateSplitSize()
+{
+ mnSplitSize = (GetCharWidth() * 3 / 5) | 1; // make an odd number
+}
+
void ScCsvRuler::InitSizeData()
{
maWinSize = GetOutputSizePixel();
+ UpdateSplitSize();
+
sal_Int32 nActiveWidth = std::min( GetWidth() - GetHdrWidth(), GetPosCount() * GetCharWidth() );
sal_Int32 nActiveHeight = GetTextHeight();
@@ -409,7 +416,11 @@ bool ScCsvRuler::MouseButtonDown( const MouseEvent& rMEvt )
bool ScCsvRuler::MouseButtonUp( const MouseEvent& )
{
- mbTracking = false;
+ if (mbTracking)
+ {
+ EndMouseTracking();
+ mbTracking = false;
+ }
return true;
}
@@ -498,24 +509,11 @@ void ScCsvRuler::MoveMouseTracking( sal_Int32 nPos )
}
}
-void ScCsvRuler::EndMouseTracking( bool bApply )
+void ScCsvRuler::EndMouseTracking()
{
- if( bApply ) // tracking finished successfully
- {
- // remove on simple click on an existing split
- if( (mnPosMTCurr == mnPosMTStart) && maOldSplits.HasSplit( mnPosMTCurr ) && !mbPosMTMoved )
- Execute( CSVCMD_REMOVESPLIT, mnPosMTCurr );
- }
- else // tracking cancelled
- {
- MoveCursor( mnPosMTStart );
- // move split to origin
- if( maOldSplits.HasSplit( mnPosMTStart ) )
- MoveMouseTracking( mnPosMTStart );
- // remove temporarily inserted split
- else if( !maOldSplits.HasSplit( mnPosMTCurr ) )
- Execute( CSVCMD_REMOVESPLIT, mnPosMTCurr );
- }
+ // remove on simple click on an existing split
+ if( (mnPosMTCurr == mnPosMTStart) && maOldSplits.HasSplit( mnPosMTCurr ) && !mbPosMTMoved )
+ Execute( CSVCMD_REMOVESPLIT, mnPosMTCurr );
mnPosMTStart = CSV_POS_INVALID;
}
diff --git a/sc/source/ui/inc/csvruler.hxx b/sc/source/ui/inc/csvruler.hxx
index 32d72ef93b8f..0913ac09271f 100644
--- a/sc/source/ui/inc/csvruler.hxx
+++ b/sc/source/ui/inc/csvruler.hxx
@@ -137,9 +137,8 @@ private:
void StartMouseTracking( sal_Int32 nPos );
/** Moves tracking to a new position. */
void MoveMouseTracking( sal_Int32 nPos );
- /** Applies tracking action for the current tracking position.
- @param bApply sal_True = apply action, sal_False = cancel action. */
- void EndMouseTracking( bool bApply );
+ /** Applies tracking action for the current tracking position */
+ void EndMouseTracking();
// painting ---------------------------------------------------------------
protected:
@@ -154,6 +153,8 @@ private:
sal_Int32 GetWidth() const { return maWinSize.Width(); }
/** Returns the height of the control. */
sal_Int32 GetHeight() const { return maWinSize.Height(); }
+ /** Update the split size depending on the last width set by CSVCMD_SETCHARWIDTH */
+ void UpdateSplitSize();
/** Draws the background and active area to maBackgrDev (only the given X range). */
void ImplDrawArea( sal_Int32 nPosX, sal_Int32 nWidth );
commit 286869724f12b335066ec380d98dc3416ebe88df
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Jun 18 10:24:44 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:32:44 2020 +0200
tdf#132944: sw_uiwriter: Add unittest
Change-Id: I45568da4b3dccd4e0cfe990c50217012f02540c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96590
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
(cherry picked from commit c7f7bbf082806ba74eb5a608bfeabd05bf73510d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99642
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 3a560c35bd7b652cc956d808b1f451f859c924d4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99667
diff --git a/sw/qa/extras/uiwriter/data/tdf132944.odt b/sw/qa/extras/uiwriter/data/tdf132944.odt
new file mode 100644
index 000000000000..08c3562aeaf1
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf132944.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 629038ebc990..241e27ef3aad 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -5661,6 +5661,27 @@ void SwUiWriterTest::testTdf35021_tabOverMarginDemo()
#endif
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf132944)
+{
+ load(DATA_DIRECTORY, "tdf132944.odt");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ lcl_dispatchCommand(mxComponent, ".uno:Delete", {});
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ // Without the fix in place, the document would have had 2 pages
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
void SwUiWriterTest::testTdf106701_tabOverMarginAutotab()
{
createDoc("tdf106701_tabOverMarginAutotab.doc");
commit df46bbb3371193321461265604e98a5fe630005b
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Jul 28 11:43:26 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:32:39 2020 +0200
CppunitTest_sw_uiwriter: reset the redline author after using it
See http://document-foundation-mail-archive.969070.n3.nabble.com/CppunitTest-different-results-depending-on-execution-command-td4283987.html
Change-Id: I16f07232611d3d2cec675f34f0f93aee9618d80f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99585
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
(cherry picked from commit 720b3c133cc6348537b4d013b4531856f73b392d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99666
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index cad062c0c01c..629038ebc990 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -5421,6 +5421,10 @@ void SwUiWriterTest::testRedlineViewAuthor()
uno::Reference<beans::XPropertySet> xField(xFields->nextElement(), uno::UNO_QUERY);
// This was 'Unknown Author' instead of 'A U. Thor'.
CPPUNIT_ASSERT_EQUAL(aAuthor, xField->getPropertyValue("Author").get<OUString>());
+
+ //Reset the redline author after using it, otherwise, it might interfere with other unittests
+ pView->SetRedlineAuthor("Unknown Author");
+ pDocShell->SetView(pView);
}
void SwUiWriterTest::testTdf91292()
commit e7783675b87a71e00121306a38d842dad031645b
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Jul 27 18:11:30 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:32:34 2020 +0200
tdf#133967 sw_redlinehide: delete existing MergedPara before
... creating new one in RecreateStartTextFrames().
This was causing a problem with duplicate call of AddToListRLHidden() on
a node that was already added by the existing MergedPara; logically the
add would need to be reverted when the existing MergedPara dies, but
there's no count on it, so the safe way to fix this is to delete
existing MergedPara first.
This was on node 1083 in the bugdoc.
Change-Id: I1fec613829b3b12e3846fc4b195559d9a6079560
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99523
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit c363568fcedb6b7b425b735614db0600a0362ead)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99664
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 9765451c3aca..af968c9d3e58 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1379,6 +1379,8 @@ void RecreateStartTextFrames(SwTextNode & rNode)
? *pFrame->GetMergedPara()->pFirstNode
: rNode);
assert(rFirstNode.GetIndex() <= rNode.GetIndex());
+ // clear old one first to avoid DelFrames confusing updates & asserts...
+ pFrame->SetMergedPara(nullptr);
pFrame->SetMergedPara(sw::CheckParaRedlineMerge(
*pFrame, rFirstNode, eMode));
eMode = sw::FrameMode::New; // Existing is not idempotent!
commit e2ee09d9651bcc35579e4f8a74d1f522f8664fa0
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Jul 27 18:12:19 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:32:29 2020 +0200
tdf#133967 sw_redlinehide: fix assert on undo-redo-undo
Assertion `pNode->GetRedlineMergeFlag() != SwNode::Merge::Hidden' failed.
4 IsAnchoredObjShown(SwTextFrame const&, SwFormatAnchor const&) (rFrame=..., rAnchor=...) at sw/source/core/layout/frmtool.cxx:1284
5 SwFlyFrameFormat::MakeFrames() (this=0x7a97860) at sw/source/core/layout/atrfrm.cxx:3001
6 AppendAllObjs(SwFrameFormats const*, SwFrame const*) (pTable=0x72457e0, pSib=0x4002800) at sw/source/core/layout/frmtool.cxx:1337
7 InsertCnt_(SwLayoutFrame*, SwDoc*, unsigned long, bool, unsigned long, SwFrame*, sw::FrameMode) (pLay=0x8e86ce0, pDoc=0x7242220, nIndex=854, bPages=true, nEndIndex=854, pPrv=0x7a79850, eMode=sw::FrameMode::Existing) at sw/source/core/layout/frmtool.cxx:1892
8 MakeFrames(SwDoc*, SwNodeIndex const&, SwNodeIndex const&) (pDoc=0x7242220, rSttIdx=SwNodeIndex (node 372), rEndIdx=SwNodeIndex (node 854)) at sw/source/core/layout/frmtool.cxx:2055
9 sw::UpdateFramesForRemoveDeleteRedline(SwDoc&, SwPaM const&) (rDoc=..., rPam=SwPaM = {...}) at sw/source/core/doc/DocumentRedlineManager.cxx:292
because this added an extent for the node but it still had its flag set
to Hidden:
11 sw::UpdateMergedParaForInsert(sw::MergedPara&, bool, SwTextNode const&, sal_Int32, sal_Int32) (rMerged=..., isRealInsert=false, rNode=..., nIndex=0, nLen=279) at sw/source/core/text/txtfrm.cxx:1002
12 SwTextFrame::SwClientNotify(SwModify const&, SfxHint const&) (this=0x7337940, rModify=..., rHint=...) at sw/source/core/text/txtfrm.cxx:2076
17 SwRangeRedline::InvalidateRange(SwRangeRedline::Invalidation) (this=0x8b3a120, eWhy=SwRangeRedline::Invalidation::Remove) at sw/source/core/doc/docredln.cxx:1261
18 sw::DocumentRedlineManager::DeleteRedline(SwPaM const&, bool, RedlineType) (this=0x7250b60, rRange=SwPaM = {...}, bSaveInUndo=true, nDelType=-1) at sw/source/core/doc/DocumentRedlineManager.cxx:2386
19 SwUndoRedlineDelete::UndoRedlineImpl(SwDoc&, SwPaM&) (this=0x8a65a00, rDoc=..., rPam=SwPaM = {...}) at sw/source/core/undo/unredln.cxx:198
Change-Id: I7f36705f1abb2df97a00b359e40534aef0e10d93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99524
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit b33034e7faee2cb8a602ed3342803bf731da8a8b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99665
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 6d86d2253631..f6927730edc6 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1023,6 +1023,11 @@ static TextFrameIndex UpdateMergedParaForInsert(MergedPara & rMerged,
rMerged.pParaPropsNode = &const_cast<SwTextNode&>(rNode);
rMerged.pParaPropsNode->AddToListRLHidden();
}
+ // called from SwRangeRedline::InvalidateRange()
+ if (rNode.GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ const_cast<SwTextNode&>(rNode).SetRedlineMergeFlag(SwNode::Merge::NonFirst);
+ }
}
rMerged.mergedText = text.makeStringAndClear();
return TextFrameIndex(nInserted);
commit 401e504609416b07a26a648848502949730116c4
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Jul 27 16:33:06 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:32:25 2020 +0200
Revert "tdf#132944 sw_redlinehide: delete of insert redline"
This reverts commit ad0351b84926075297fb74abbe9b31a0455782af.
It turns out that this conflicts with commit
14e87a4b15d31a34e6053f6194688f3aa23af991 "tdf#133967 sw_redlinehide: fix
redline deletion of table containing redlines"
but oddly enough that fix fixes tdf#132944 as well, but both commmits
combined don't work e.g. on node 1083/1084 in the tdf#133967 bugdoc we
got no text frame because SwUndoDelete has deleted it, but since it's
not merged it would be left alone by the new fix anyway.
This fix was quite hacky anyway, so just revert it.
Change-Id: Id17f3575c742b8761a8458914a28ae8047360fff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99522
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 4c9b292bb4ff3ad516dad37e2e0dd0ac8bbb4aa0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99580
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
(cherry picked from commit 3c12f166f96f5f6472457b7fa63effb6a6c6d847)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99663
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 5ce6584e44d2..d933de736cb1 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -25,8 +25,6 @@
#include <fmtfld.hxx>
#include <frmtool.hxx>
#include <IDocumentUndoRedo.hxx>
-#include <UndoManager.hxx>
-#include <UndoDelete.hxx>
#include <IDocumentFieldsAccess.hxx>
#include <IDocumentLayoutAccess.hxx>
#include <IDocumentState.hxx>
@@ -935,21 +933,6 @@ namespace
static_cast<SwPaM&>(m_rRedline) = *m_pCursor;
}
};
-
- auto UndoDeleteDisableFrames(SwDoc & rDoc) -> void
- {
- // inside AppendRedline(), a SwUndoDelete was created;
- // prevent it from creating duplicate layout frames on Undo
- auto & rUndo(rDoc.GetUndoManager());
- if (rUndo.DoesUndo())
- {
- SwUndo *const pUndo(rUndo.GetLastUndo());
- assert(pUndo);
- SwUndoDelete *const pUndoDel(dynamic_cast<SwUndoDelete*>(pUndo));
- assert(pUndoDel);
- pUndoDel->DisableMakeFrames(); // tdf#132944
- }
- }
}
namespace sw
@@ -1625,14 +1608,12 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
}
else
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pNewRedl );
- UndoDeleteDisableFrames(m_rDoc); // tdf#132944
bCompress = true;
}
if( !bCallDelete && !bDec && *pEnd == *pREnd )
{
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pNewRedl );
- UndoDeleteDisableFrames(m_rDoc);
bCompress = true;
}
else if ( bCallDelete || !bDec )
@@ -1652,7 +1633,6 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
{
TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl);
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pRedl );
- UndoDeleteDisableFrames(m_rDoc);
n = 0; // re-initialize
}
delete pRedl;
@@ -1677,7 +1657,6 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
{
TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl);
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
- UndoDeleteDisableFrames(m_rDoc);
n = 0; // re-initialize
}
bDec = true;
@@ -1700,7 +1679,6 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
{
TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl);
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
- UndoDeleteDisableFrames(m_rDoc);
n = 0; // re-initialize
bDec = true;
}
diff --git a/sw/source/core/inc/UndoDelete.hxx b/sw/source/core/inc/UndoDelete.hxx
index a0ff970661f0..a4eb066581c9 100644
--- a/sw/source/core/inc/UndoDelete.hxx
+++ b/sw/source/core/inc/UndoDelete.hxx
@@ -59,7 +59,6 @@ class SwUndoDelete
bool m_bResetPgDesc : 1; // TRUE: reset PgDsc on following node
bool m_bResetPgBrk : 1; // TRUE: reset PgBreak on following node
bool const m_bFromTableCopy : 1; // TRUE: called by SwUndoTableCpyTable
- bool m_bDisableMakeFrames : 1;
bool SaveContent( const SwPosition* pStt, const SwPosition* pEnd,
SwTextNode* pSttTextNd, SwTextNode* pEndTextNd );
@@ -100,7 +99,6 @@ public:
// SwUndoTableCpyTable needs this information:
bool IsDelFullPara() const { return m_bDelFullPara; }
- void DisableMakeFrames() { m_bDisableMakeFrames = true; };
};
#endif // INCLUDED_SW_SOURCE_CORE_INC_UNDODELETE_HXX
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 504bfee25164..0750062cfb47 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -190,7 +190,6 @@ SwUndoDelete::SwUndoDelete(
m_bResetPgDesc( false ),
m_bResetPgBrk( false ),
m_bFromTableCopy( bCalledByTableCpy )
- , m_bDisableMakeFrames(false)
{
m_bCacheComment = false;
@@ -1056,26 +1055,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
SetSaveData(rDoc, *m_pRedlSaveData);
sal_uLong delFullParaEndNode(m_nEndNode);
- if (m_bDisableMakeFrames) // tdf#132944
- {
- assert(!m_bDelFullPara);
- SwTextNode *const pEndNode(aIdx.GetNodes()[m_nEndNode]->GetTextNode());
- SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pEndNode);
- for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
- {
- o3tl::sorted_vector<SwRootFrame *> layouts;
- if (pFrame->getRootFrame()->IsHideRedlines())
- {
- assert(pFrame->GetTextNodeFirst() == pEndNode); // can't be merged with previous
- layouts.insert(pFrame->getRootFrame());
- }
- for (SwRootFrame const*const pLayout : layouts)
- {
- pEndNode->DelFrames(pLayout); // SwUndoRedlineDelete will create it
- }
- }
- }
- else if (m_bDelFullPara && m_pRedlSaveData)
+ if (m_bDelFullPara && m_pRedlSaveData)
{
SwTextNode * pFirstMergedDeletedTextNode(nullptr);
SwTextNode *const pNextNode = FindFirstAndNextNode(rDoc, *this,
@@ -1122,7 +1102,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
}
// create frames after SetSaveData has recreated redlines
- if (0 != m_nNode && !m_bDisableMakeFrames)
+ if (0 != m_nNode)
{
// tdf#121031 if the start node is a text node, it already has a frame;
// if it's a table, it does not
@@ -1138,7 +1118,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
::MakeFrames(&rDoc, start, end);
}
- if (pMovedNode && !m_bDisableMakeFrames)
+ if (pMovedNode)
{ // probably better do this after creating all frames
lcl_MakeAutoFrames(*rDoc.GetSpzFrameFormats(), pMovedNode->GetIndex());
}
commit 70d9f2ea593afd04b1887f925741cc99d3b2c1f2
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Jul 24 19:41:29 2020 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 2 10:32:20 2020 +0200
tdf#133967 sw_redlinehide: fix redline deletion of table containing redlines
A delete redline is created from node 371 to node 1625; there are
existing redlines in the range, so AppendRedline() splits the new
redline into pieces between and on the existing redlines.
Even worse, because some of the existing redlines are in a table,
InsertWithValidRanges() then splits the pieces that overlap the table
into even smaller pieces, such that there are now the table structural
nodes that were in the initial new delete redline's range but are now
covered by none of the pieces.
This means that multiple merged text frames are created, with non-merged
frames between them, and thus the functions
UpdateFramesForAddDeleteRedline() and
UpdateFramesForRemoveDeleteRedline() [for Undo] have to deal with this
unexpected complication.
(regression from sw_redlinehide)
Change-Id: Ibf71c1deb2bc3fa2af16035954d5ef71b6827be5
(cherry picked from commit 658baf191ccc03899aef68d03196cee5959a3d07)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99472
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 22c5d6b81b21..5ce6584e44d2 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -161,31 +161,55 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
}
else
{
- std::vector<SwTextFrame*> frames;
- SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pStartNode);
- for (SwTextFrame * pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
+ SwTextNode * pNode(pStartNode);
+ do
{
- if (pFrame->getRootFrame()->IsHideRedlines())
+ std::vector<SwTextFrame*> frames;
+ SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pNode);
+ for (SwTextFrame * pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
{
- frames.push_back(pFrame);
+ if (pFrame->getRootFrame()->IsHideRedlines())
+ {
+ frames.push_back(pFrame);
+ }
}
+ if (frames.empty())
+ {
+ auto const& layouts(rDoc.GetAllLayouts());
+ assert(std::none_of(layouts.begin(), layouts.end(),
+ [](SwRootFrame const*const pLayout) { return pLayout->IsHideRedlines(); }));
+ (void) layouts;
+ break;
+ }
+ auto eMode(sw::FrameMode::Existing);
+ SwTextNode * pLast(pNode);
+ for (SwTextFrame * pFrame : frames)
+ {
+ SwTextNode & rFirstNode(pFrame->GetMergedPara()
+ ? *pFrame->GetMergedPara()->pFirstNode
+ : *pNode);
+ assert(pNode == pStartNode
+ ? rFirstNode.GetIndex() <= pNode->GetIndex()
+ : &rFirstNode == pNode);
+ // clear old one first to avoid DelFrames confusing updates & asserts...
+ pFrame->SetMergedPara(nullptr);
+ pFrame->SetMergedPara(sw::CheckParaRedlineMerge(
+ *pFrame, rFirstNode, eMode));
+ eMode = sw::FrameMode::New; // Existing is not idempotent!
+ // the first node of the new redline is not necessarily the first
+ // node of the merged frame, there could be another redline nearby
+ sw::AddRemoveFlysAnchoredToFrameStartingAtNode(*pFrame, *pNode, nullptr);
+ // if redline is split across table and table cell is empty, there's no redline in the cell and so no merged para
+ if (pFrame->GetMergedPara())
+ {
+ pLast = const_cast<SwTextNode*>(pFrame->GetMergedPara()->pLastNode);
+ }
+ }
+ SwNodeIndex tmp(*pLast);
+ // skip over hidden sections!
+ pNode = static_cast<SwTextNode*>(pLast->GetNodes().GoNextSection(&tmp, /*bSkipHidden=*/true, /*bSkipProtect=*/false));
}
- auto eMode(sw::FrameMode::Existing);
- for (SwTextFrame * pFrame : frames)
- {
- SwTextNode & rFirstNode(pFrame->GetMergedPara()
- ? *pFrame->GetMergedPara()->pFirstNode
- : *pStartNode);
- assert(rFirstNode.GetIndex() <= pStartNode->GetIndex());
- // clear old one first to avoid DelFrames confusing updates & asserts...
- pFrame->SetMergedPara(nullptr);
- pFrame->SetMergedPara(sw::CheckParaRedlineMerge(
- *pFrame, rFirstNode, eMode));
- eMode = sw::FrameMode::New; // Existing is not idempotent!
- // the first node of the new redline is not necessarily the first
- // node of the merged frame, there could be another redline nearby
- sw::AddRemoveFlysAnchoredToFrameStartingAtNode(*pFrame, *pStartNode, nullptr);
- }
+ while (pNode && pNode->GetIndex() <= rPam.End()->nNode.GetIndex());
}
// fields last - SwGetRefField::UpdateField requires up-to-date frames
UpdateFieldsForRedline(rDoc.getIDocumentFieldsAccess()); // after footnotes
@@ -197,6 +221,7 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
{
+ bool isAppendObjsCalled(false);
rDoc.GetFootnoteIdxs().UpdateFootnote(rPam.Start()->nNode);
SwTextNode *const pStartNode(rPam.Start()->nNode.GetNode().GetTextNode());
if (!pStartNode)
@@ -212,35 +237,44 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
// note: this will also create frames for all currently hidden flys
// because it calls AppendAllObjs
::MakeFrames(&rDoc, rPam.Start()->nNode, rPam.End()->nNode);
+ isAppendObjsCalled = true;
}
}
else
{
- std::vector<SwTextFrame*> frames;
- std::set<SwRootFrame*> layouts;
- SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pStartNode);
- for (SwTextFrame * pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
+ SwTextNode * pNode(pStartNode);
+ do
{
- if (pFrame->getRootFrame()->IsHideRedlines())
+ std::vector<SwTextFrame*> frames;
+ SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pNode);
+ for (SwTextFrame * pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
{
- frames.push_back(pFrame);
- layouts.insert(pFrame->getRootFrame());
+ if (pFrame->getRootFrame()->IsHideRedlines())
+ {
+ frames.push_back(pFrame);
+ }
}
- }
- if (frames.empty())
- {
- return;
- }
- if (rPam.GetPoint()->nNode != rPam.GetMark()->nNode)
- {
+ if (frames.empty())
+ {
+ auto const& layouts(rDoc.GetAllLayouts());
+ assert(std::none_of(layouts.begin(), layouts.end(),
+ [](SwRootFrame const*const pLayout) { return pLayout->IsHideRedlines(); }));
+ (void) layouts;
+ break;
+ }
+
// first, call CheckParaRedlineMerge on the first paragraph,
// to init flag on new merge range (if any) + 1st node post the merge
auto eMode(sw::FrameMode::Existing);
+ SwTextNode * pLast(pNode);
for (SwTextFrame * pFrame : frames)
{
if (auto const pMergedPara = pFrame->GetMergedPara())
{
- assert(pMergedPara->pFirstNode->GetIndex() <= pStartNode->GetIndex());
+ pLast = const_cast<SwTextNode*>(pMergedPara->pLastNode);
+ assert(pNode == pStartNode
+ ? pMergedPara->pFirstNode->GetIndex() <= pNode->GetIndex()
+ : pMergedPara->pFirstNode == pNode);
// clear old one first to avoid DelFrames confusing updates & asserts...
SwTextNode & rFirstNode(*pMergedPara->pFirstNode);
pFrame->SetMergedPara(nullptr);
@@ -249,24 +283,36 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam)
eMode = sw::FrameMode::New; // Existing is not idempotent!
}
}
- // now start node until end of merge + 1 has proper flags; MakeFrames
- // should pick up from the next node in need of frames by checking flags
- SwNodeIndex const start(*pStartNode, +1);
- SwNodeIndex const end(rPam.End()->nNode, +1); // end is exclusive
- // note: this will also create frames for all currently hidden flys
- // both on first and non-first nodes because it calls AppendAllObjs
- ::MakeFrames(&rDoc, start, end);
- // re-use this to move flys that are now on the wrong frame, with end
- // of redline as "second" node; the nodes between start and end should
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list