1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <swmodeltestbase.hxx>
11 #include <comphelper/propertysequence.hxx>
12 #include <vcl/scheduler.hxx>
13 #include <svx/svddef.hxx>
15 #include <fmtanchr.hxx>
16 #include <fmtfsize.hxx>
17 #include <fmtcntnt.hxx>
19 #include <unotxdoc.hxx>
20 #include <rootfrm.hxx>
21 #include <IDocumentLayoutAccess.hxx>
22 #include <IDocumentRedlineAccess.hxx>
23 #include <unoframe.hxx>
25 /// Test to assert layout / rendering result of Writer.
26 class SwLayoutWriter
: public SwModelTestBase
30 : SwModelTestBase("/sw/qa/extras/layout/data/")
35 void CheckRedlineFootnotesHidden();
36 void CheckRedlineSectionsHidden();
39 // this is a member because our test classes have protected members :(
40 void SwLayoutWriter::CheckRedlineFootnotesHidden()
42 discardDumpedLayout();
43 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
44 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "24");
45 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
46 "type", "PortionType::Footnote");
47 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
49 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
50 "type", "PortionType::Text");
51 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
53 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
54 "type", "PortionType::Footnote");
55 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
57 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[1]/txt[1]/merged", "paraPropsNodeIndex", "13");
59 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
60 "type", "PortionType::FootnoteNum");
62 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
65 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
66 "type", "PortionType::Text");
68 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
70 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[2]/txt[1]/merged", "paraPropsNodeIndex", "16");
72 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
73 "type", "PortionType::FootnoteNum");
75 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
78 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
79 "type", "PortionType::Text");
81 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
85 void SwLayoutWriter::CheckRedlineSectionsHidden()
87 discardDumpedLayout();
88 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
89 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "12");
90 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
91 "type", "PortionType::Para");
92 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
94 assertXPath(pXmlDoc
, "/root/page[1]/body/section[1]/txt[1]/merged", "paraPropsNodeIndex", "20");
96 "/root/page[1]/body/section[1]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
97 "type", "PortionType::Para");
99 "/root/page[1]/body/section[1]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
103 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf156077
)
105 createSwDoc("s4_min2.fodt");
107 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of pages does not match!", 3, getPages());
108 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
109 assertXPath(pXmlDoc
, "/root/page[1]/anchored/fly", 3);
110 assertXPath(pXmlDoc
, "/root/page[2]/anchored/fly", 1);
111 // this was 0, the at-page anchored flys were not displayed
112 assertXPath(pXmlDoc
, "/root/page[3]/anchored/fly", 3);
115 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineFootnotes
)
117 createSwDoc("redline_footnotes.odt");
118 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
119 CPPUNIT_ASSERT(pTextDoc
);
120 SwDoc
* pDoc(pTextDoc
->GetDocShell()->GetDoc());
121 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
122 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
125 CheckRedlineFootnotesHidden();
127 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
128 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
129 discardDumpedLayout();
130 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
132 // show: nothing is merged
133 assertXPath(pXmlDoc
, "//merged", 0);
135 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
136 "type", "PortionType::Footnote");
137 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
139 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
140 "type", "PortionType::Text");
141 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
143 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
144 "type", "PortionType::Text");
145 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
147 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
148 "type", "PortionType::Footnote");
149 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
153 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
154 "type", "PortionType::FootnoteNum");
156 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
159 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
160 "type", "PortionType::Text");
162 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
165 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
166 "type", "PortionType::Text");
168 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
171 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
172 "type", "PortionType::Text");
174 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
177 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
178 "type", "PortionType::FootnoteNum");
180 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
183 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
184 "type", "PortionType::Text");
186 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
188 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
189 "type", "PortionType::Text");
190 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
192 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
193 "type", "PortionType::Footnote");
194 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
196 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
197 "type", "PortionType::Text");
198 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
201 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
202 "type", "PortionType::FootnoteNum");
204 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
207 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
208 "type", "PortionType::Text");
210 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
212 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
213 "type", "PortionType::Footnote");
214 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
216 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
217 "type", "PortionType::Text");
218 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
220 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
221 "type", "PortionType::Text");
222 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
224 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
225 "type", "PortionType::Footnote");
226 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
230 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
231 "type", "PortionType::FootnoteNum");
233 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
236 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
237 "type", "PortionType::Text");
239 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
242 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
243 "type", "PortionType::FootnoteNum");
245 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
248 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
249 "type", "PortionType::Text");
251 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
254 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
255 "type", "PortionType::Text");
257 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
260 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
261 "type", "PortionType::Text");
263 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
267 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
268 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
269 discardDumpedLayout();
270 CheckRedlineFootnotesHidden();
273 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf136588
)
275 createSwDoc("tdf136588.docx");
276 auto pXMLLayoutDump
= parseLayoutDump();
277 CPPUNIT_ASSERT(pXMLLayoutDump
);
279 //there was a bad line break before, the correct break layout is this:
280 assertXPath(pXMLLayoutDump
, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[2]", "portion",
281 "effectively by modern-day small to ");
284 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineFlysInBody
)
287 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
288 CPPUNIT_ASSERT(pTextDoc
);
289 SwDoc
* pDoc(pTextDoc
->GetDocShell()->GetDoc());
290 SwWrtShell
* pWrtShell
= pTextDoc
->GetDocShell()->GetWrtShell();
291 SwRootFrame
* pLayout(pWrtShell
->GetLayout());
292 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
293 pWrtShell
->Insert("foo");
294 pWrtShell
->SplitNode(false);
295 pWrtShell
->Insert("bar");
296 pWrtShell
->SplitNode(false);
297 pWrtShell
->Insert("baz");
298 SfxItemSet
flySet(pDoc
->GetAttrPool(),
299 svl::Items
<RES_FRM_SIZE
, RES_FRM_SIZE
, RES_ANCHOR
, RES_ANCHOR
>);
300 SwFormatAnchor
anchor(RndStdIds::FLY_AT_CHAR
);
301 pWrtShell
->StartOfSection(false);
302 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
303 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
305 SwFormatFrameSize
size(SwFrameSize::Minimum
, 1000, 1000);
306 flySet
.Put(size
); // set a size, else we get 1 char per line...
307 SwFrameFormat
const* pFly
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
308 CPPUNIT_ASSERT(pFly
!= nullptr);
310 pWrtShell
->GotoFly(pFly
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
311 pWrtShell
->Insert("abc");
312 pWrtShell
->SplitNode(false);
313 pWrtShell
->Insert("def");
314 pWrtShell
->SplitNode(false);
315 pWrtShell
->Insert("ghi");
317 dispatchCommand(mxComponent
, ".uno:TrackChanges", {});
318 // delete redline inside fly
319 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
320 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/true, 8, /*bBasicCall=*/false);
323 pWrtShell
->SttEndDoc(true); // note: SttDoc actually moves to start of fly?
324 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
325 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
328 for (int i
= 0; i
< 2; ++i
)
330 if (i
== 1) // secondly, try with different anchor type
332 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
333 SwPosition
pos(*anchor
.GetAnchorNode());
334 pos
.nContent
.Assign(nullptr, 0);
335 anchor
.SetAnchor(&pos
);
336 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
339 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
340 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
341 discardDumpedLayout();
342 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
343 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "14");
345 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
346 "PortionType::Para");
348 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
350 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
351 "paraPropsNodeIndex", "6");
353 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
355 "type", "PortionType::Para");
357 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
361 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
362 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
363 discardDumpedLayout();
364 pXmlDoc
= parseLayoutDump();
366 // show: nothing is merged
367 assertXPath(pXmlDoc
, "//merged", 0);
370 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
371 "PortionType::Text");
373 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
376 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
377 "PortionType::Text");
379 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
382 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
384 "type", "PortionType::Text");
386 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
390 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
392 "type", "PortionType::Text");
394 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
398 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
400 "type", "PortionType::Para");
402 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
406 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
408 "type", "PortionType::Text");
410 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
414 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
416 "type", "PortionType::Text");
418 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
422 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
423 "PortionType::Para");
425 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
428 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
429 "PortionType::Text");
431 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
434 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
435 "PortionType::Text");
437 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
441 // anchor to 2nd (deleted) paragraph
442 pWrtShell
->StartOfSection();
443 pWrtShell
->Down(false, 1);
444 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
445 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
446 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
448 for (int i
= 0; i
< 2; ++i
)
450 if (i
== 1) // secondly, try with different anchor type
452 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
453 SwPosition
pos(*anchor
.GetAnchorNode());
454 pos
.nContent
.Assign(nullptr, 0);
455 anchor
.SetAnchor(&pos
);
456 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
459 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
460 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
461 discardDumpedLayout();
462 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
463 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "14");
465 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
466 "PortionType::Para");
468 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
471 // hide: no anchored object shown
472 assertXPath(pXmlDoc
, "//anchored", 0);
474 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
475 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
476 discardDumpedLayout();
477 pXmlDoc
= parseLayoutDump();
479 // show: nothing is merged
480 assertXPath(pXmlDoc
, "//merged", 0);
483 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
484 "PortionType::Text");
486 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
489 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
490 "PortionType::Text");
492 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
495 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
496 "PortionType::Para");
498 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
501 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
503 "type", "PortionType::Text");
505 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
509 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
511 "type", "PortionType::Text");
513 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
517 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
519 "type", "PortionType::Para");
521 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
525 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
527 "type", "PortionType::Text");
529 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
533 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
535 "type", "PortionType::Text");
537 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
541 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
542 "PortionType::Text");
544 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
547 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
548 "PortionType::Text");
550 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
554 // anchor to 3rd paragraph
555 pWrtShell
->EndOfSection();
556 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
557 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
558 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
560 for (int i
= 0; i
< 2; ++i
)
562 if (i
== 1) // secondly, try with different anchor type
564 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
565 SwPosition
pos(*anchor
.GetAnchorNode());
566 pos
.nContent
.Assign(nullptr, 0);
567 anchor
.SetAnchor(&pos
);
568 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
571 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
572 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
573 discardDumpedLayout();
574 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
575 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "14");
577 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
578 "PortionType::Para");
580 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
582 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
583 "paraPropsNodeIndex", "6");
585 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
587 "type", "PortionType::Para");
589 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
593 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
594 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
595 discardDumpedLayout();
596 pXmlDoc
= parseLayoutDump();
598 // show: nothing is merged
599 assertXPath(pXmlDoc
, "//merged", 0);
602 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
603 "PortionType::Text");
605 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
608 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
609 "PortionType::Text");
611 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
614 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
615 "PortionType::Para");
617 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
620 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
621 "PortionType::Text");
623 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
626 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
627 "PortionType::Text");
629 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
632 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
634 "type", "PortionType::Text");
636 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
640 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
642 "type", "PortionType::Text");
644 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
648 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
650 "type", "PortionType::Para");
652 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
656 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
658 "type", "PortionType::Text");
660 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
664 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
666 "type", "PortionType::Text");
668 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
674 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf134272
)
676 createSwDoc("tdf134472.odt");
677 SwDoc
* pDoc
= getSwDoc();
678 CPPUNIT_ASSERT(pDoc
);
679 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
680 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[2]/infos/bounds", "height", "843");
681 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[2]/infos/bounds", "bottom", "2819");
684 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestNestedTableMoveFwd
)
686 createSwDoc("tabellen_test_windows_1.odt");
687 SwDoc
* pDoc
= getSwDoc();
688 CPPUNIT_ASSERT(pDoc
);
689 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
690 // the row with the nested table should not be split but be the first row on page 2
691 assertXPathContent(pXmlDoc
, "/root/page[1]/body/tab[1]/row[last()]/cell[1]/txt[1]",
694 pXmlDoc
, "/root/page[2]/body/tab[1]/row[1]/cell[1]/tab[1]/row[1]/cell[1]/txt", "Tabelle 2");
697 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf136613
)
699 createSwDoc("tdf136613.docx");
700 SwDoc
* pDoc
= getSwDoc();
701 CPPUNIT_ASSERT(pDoc
);
703 //get the flys and the root frame
704 const auto vFlyFormats
= pDoc
->GetFlyFrameFormats(FLYCNTTYPE_ALL
, true);
705 const auto vFrames
= pDoc
->GetAllLayouts();
707 CPPUNIT_ASSERT(!vFrames
.empty());
708 CPPUNIT_ASSERT(!vFlyFormats
.empty());
710 //get the page frame from the root
711 SwFrame
* pPageFrame
= vFrames
[0]->Lower();
712 CPPUNIT_ASSERT(pPageFrame
);
714 //get the rectangle of the page
715 const SwRect
& rPageRect
= pPageFrame
->getFrameArea();
717 //check the flys and...
718 for (auto pFlyFormat
: vFlyFormats
)
720 //...the rectangle of the fly location...
721 const SwRect
& rRect
= pFlyFormat
->FindLayoutRect();
722 CPPUNIT_ASSERT(!rRect
.IsEmpty());
724 //...if it is on the page. This will fail if not.
725 CPPUNIT_ASSERT_MESSAGE("The pictures are outside the page!", rPageRect
.Contains(rRect
));
729 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf88496
)
731 createSwDoc("tdf88496.docx");
732 SwDoc
* pDoc
= getSwDoc();
733 CPPUNIT_ASSERT(pDoc
);
734 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
735 // This was 4, table fallback "switch off repeating header" started on a new page
736 assertXPath(pXmlDoc
, "/root/page", 3);
739 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineFlysInHeader
)
742 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
743 CPPUNIT_ASSERT(pTextDoc
);
744 SwDoc
* pDoc(pTextDoc
->GetDocShell()->GetDoc());
745 SwWrtShell
* pWrtShell
= pTextDoc
->GetDocShell()->GetWrtShell();
746 SwRootFrame
* pLayout(pWrtShell
->GetLayout());
747 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
748 pWrtShell
->ChangeHeaderOrFooter(u
"Default Page Style", /*bHeader*/ true, /*bOn*/ true, false);
751 ->IsInHeaderFooter()); // assume this is supposed to put cursor in the new header...
752 pWrtShell
->Insert("foo");
753 pWrtShell
->SplitNode(false);
754 pWrtShell
->Insert("bar");
755 pWrtShell
->SplitNode(false);
756 pWrtShell
->Insert("baz");
757 SfxItemSet
flySet(pDoc
->GetAttrPool(),
758 svl::Items
<RES_FRM_SIZE
, RES_FRM_SIZE
, RES_ANCHOR
, RES_ANCHOR
>);
759 SwFormatAnchor
anchor(RndStdIds::FLY_AT_CHAR
);
760 pWrtShell
->StartOfSection(false);
761 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
762 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
764 SwFormatFrameSize
size(SwFrameSize::Minimum
, 1000, 1000);
765 flySet
.Put(size
); // set a size, else we get 1 char per line...
766 SwFrameFormat
const* pFly
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
767 CPPUNIT_ASSERT(pFly
!= nullptr);
769 pWrtShell
->GotoFly(pFly
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
770 pWrtShell
->Insert("abc");
771 pWrtShell
->SplitNode(false);
772 pWrtShell
->Insert("def");
773 pWrtShell
->SplitNode(false);
774 pWrtShell
->Insert("ghi");
776 dispatchCommand(mxComponent
, ".uno:TrackChanges", {});
777 // delete redline inside fly
778 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
779 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/true, 8, /*bBasicCall=*/false);
782 pWrtShell
->GotoHeaderText();
783 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
784 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
787 for (int i
= 0; i
< 2; ++i
)
789 if (i
== 1) // secondly, try with different anchor type
791 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
792 SwPosition
pos(*anchor
.GetAnchorNode());
793 pos
.nContent
.Assign(nullptr, 0);
794 anchor
.SetAnchor(&pos
);
795 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
798 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
799 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
800 discardDumpedLayout();
801 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
802 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout", "type",
803 "PortionType::Para");
804 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "length",
806 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/merged", "paraPropsNodeIndex", "6");
807 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[1]", "type",
808 "PortionType::Para");
809 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[1]", "portion",
811 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/merged",
812 "paraPropsNodeIndex", "11");
815 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout[1]",
816 "type", "PortionType::Para");
819 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout[1]",
822 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
823 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
824 discardDumpedLayout();
825 pXmlDoc
= parseLayoutDump();
827 // show: nothing is merged
828 assertXPath(pXmlDoc
, "//merged", 0);
830 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "type",
831 "PortionType::Para");
832 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "length",
835 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
836 "type", "PortionType::Text");
838 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
841 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
842 "type", "PortionType::Text");
844 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
847 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
849 "type", "PortionType::Text");
851 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
855 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
857 "type", "PortionType::Text");
859 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
863 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
865 "type", "PortionType::Para");
867 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
871 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
873 "type", "PortionType::Text");
875 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
879 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
881 "type", "PortionType::Text");
883 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
887 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
888 "type", "PortionType::Para");
890 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
893 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
894 "type", "PortionType::Text");
896 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
899 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
900 "type", "PortionType::Text");
902 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
906 // anchor to 2nd (deleted) paragraph
907 pWrtShell
->StartOfSection();
908 pWrtShell
->Down(false, 1);
909 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
910 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
911 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
913 for (int i
= 0; i
< 2; ++i
)
915 if (i
== 1) // secondly, try with different anchor type
917 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
918 SwPosition
pos(*anchor
.GetAnchorNode());
919 pos
.nContent
.Assign(nullptr, 0);
920 anchor
.SetAnchor(&pos
);
921 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
924 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
925 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
926 discardDumpedLayout();
927 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
928 // now the frame has no Text portion? not sure why it's a 0-length one first and now none?
929 // assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type", "PortionType::Para");
930 // assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "length", "0");
931 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/merged", "paraPropsNodeIndex", "6");
933 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
934 "type", "PortionType::Para");
936 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
939 // hide: no anchored object shown
940 assertXPath(pXmlDoc
, "//anchored", 0);
942 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
943 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
944 discardDumpedLayout();
945 pXmlDoc
= parseLayoutDump();
947 // show: nothing is merged
948 assertXPath(pXmlDoc
, "//merged", 0);
951 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
952 "PortionType::Para");
954 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
957 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
958 "type", "PortionType::Text");
960 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
963 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
964 "type", "PortionType::Text");
966 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
969 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
970 "type", "PortionType::Para");
972 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
975 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
977 "type", "PortionType::Text");
979 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
983 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
985 "type", "PortionType::Text");
987 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
991 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
993 "type", "PortionType::Para");
995 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
999 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1001 "type", "PortionType::Text");
1002 assertXPath(pXmlDoc
,
1003 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1006 assertXPath(pXmlDoc
,
1007 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1009 "type", "PortionType::Text");
1010 assertXPath(pXmlDoc
,
1011 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1014 assertXPath(pXmlDoc
,
1015 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1016 "type", "PortionType::Text");
1017 assertXPath(pXmlDoc
,
1018 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1020 assertXPath(pXmlDoc
,
1021 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1022 "type", "PortionType::Text");
1023 assertXPath(pXmlDoc
,
1024 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1028 // anchor to 3rd paragraph
1029 pWrtShell
->EndOfSection();
1030 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
1031 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
1032 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1034 for (int i
= 0; i
< 2; ++i
)
1036 if (i
== 1) // secondly, try with different anchor type
1038 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
1039 SwPosition
pos(*anchor
.GetAnchorNode());
1040 pos
.nContent
.Assign(nullptr, 0);
1041 anchor
.SetAnchor(&pos
);
1042 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1045 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
1046 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
1047 discardDumpedLayout();
1048 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1049 assertXPath(pXmlDoc
,
1050 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
1051 "PortionType::Para");
1052 assertXPath(pXmlDoc
,
1053 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1055 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/merged", "paraPropsNodeIndex", "6");
1056 assertXPath(pXmlDoc
,
1057 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1058 "type", "PortionType::Para");
1059 assertXPath(pXmlDoc
,
1060 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1062 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/merged",
1063 "paraPropsNodeIndex", "11");
1064 assertXPath(pXmlDoc
,
1065 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1067 "type", "PortionType::Para");
1068 assertXPath(pXmlDoc
,
1069 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1073 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
1074 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
1075 discardDumpedLayout();
1076 pXmlDoc
= parseLayoutDump();
1078 // show: nothing is merged
1079 assertXPath(pXmlDoc
, "//merged", 0);
1081 assertXPath(pXmlDoc
,
1082 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
1083 "PortionType::Para");
1084 assertXPath(pXmlDoc
,
1085 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1087 assertXPath(pXmlDoc
,
1088 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1089 "type", "PortionType::Text");
1090 assertXPath(pXmlDoc
,
1091 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1093 assertXPath(pXmlDoc
,
1094 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1095 "type", "PortionType::Text");
1096 assertXPath(pXmlDoc
,
1097 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1099 assertXPath(pXmlDoc
,
1100 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1101 "type", "PortionType::Para");
1102 assertXPath(pXmlDoc
,
1103 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1105 assertXPath(pXmlDoc
,
1106 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1107 "type", "PortionType::Text");
1108 assertXPath(pXmlDoc
,
1109 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1111 assertXPath(pXmlDoc
,
1112 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1113 "type", "PortionType::Text");
1114 assertXPath(pXmlDoc
,
1115 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1117 assertXPath(pXmlDoc
,
1118 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1120 "type", "PortionType::Text");
1121 assertXPath(pXmlDoc
,
1122 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1125 assertXPath(pXmlDoc
,
1126 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1128 "type", "PortionType::Text");
1129 assertXPath(pXmlDoc
,
1130 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1133 assertXPath(pXmlDoc
,
1134 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
1136 "type", "PortionType::Para");
1137 assertXPath(pXmlDoc
,
1138 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
1141 assertXPath(pXmlDoc
,
1142 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1144 "type", "PortionType::Text");
1145 assertXPath(pXmlDoc
,
1146 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1149 assertXPath(pXmlDoc
,
1150 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1152 "type", "PortionType::Text");
1153 assertXPath(pXmlDoc
,
1154 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1160 #if !defined(MACOSX)
1161 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf150606
)
1163 createSwDoc("tdf150606-1-min.odt");
1165 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
1166 CPPUNIT_ASSERT(pTextDoc
);
1167 SwWrtShell
* pWrtShell
= pTextDoc
->GetDocShell()->GetWrtShell();
1169 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1171 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column[1]/body/tab", 1);
1172 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column[2]/body/tab", 1);
1173 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column", 2);
1174 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column[1]/body/tab", 1);
1175 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column[2]/body/tab", 1);
1176 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column", 2);
1177 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column[1]/body/tab", 1);
1178 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column[2]/body/tab", 1);
1179 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column", 2);
1180 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column[1]/body/tab", 1);
1181 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column[2]/body/tab", 1);
1182 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column", 2);
1183 // on page 5 the table is split across balanced columns
1184 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column[1]/body/tab", 1);
1185 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column[2]/body/tab", 1);
1186 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column", 2);
1187 assertXPath(pXmlDoc
, "/root/page", 5);
1189 pWrtShell
->Down(false, 1);
1190 dispatchCommand(mxComponent
, ".uno:DeleteTable", {});
1192 discardDumpedLayout();
1193 pXmlDoc
= parseLayoutDump();
1195 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column/body/tab", 0);
1196 assertXPath(pXmlDoc
, "/root/page", 1);
1199 Scheduler::ProcessEventsToIdle();
1201 discardDumpedLayout();
1202 pXmlDoc
= parseLayoutDump();
1204 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column[1]/body/tab", 1);
1205 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column[2]/body/tab", 1);
1206 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column", 2);
1207 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column[1]/body/tab", 1);
1208 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column[2]/body/tab", 1);
1209 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column", 2);
1210 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column[1]/body/tab", 1);
1211 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column[2]/body/tab", 1);
1212 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column", 2);
1213 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column[1]/body/tab", 1);
1214 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column[2]/body/tab", 1);
1215 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column", 2);
1216 // on page 5 the table is split across balanced columns
1217 // (problem was that there were empty pages and table was on page 10)
1218 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column[1]/body/tab", 1);
1219 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column[2]/body/tab", 1);
1220 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column", 2);
1221 assertXPath(pXmlDoc
, "/root/page", 5);
1225 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf152983
)
1227 //just care it doesn't crash/assert
1228 createSwDoc("tdf152983-1-min.docx");
1231 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf137025
)
1233 // Check the padding of the textbox
1234 createSwDoc("tdf137025.docx");
1235 SwDoc
* pDoc
= getSwDoc();
1236 CPPUNIT_ASSERT(pDoc
);
1237 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1238 CPPUNIT_ASSERT(pXmlDoc
);
1240 // Check the layout xml
1241 // SDRATTR_TEXT_LEFTDIST
1242 assertXPath(pXmlDoc
,
1243 "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
1244 "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
1246 + OString::number(SDRATTR_TEXT_LEFTDIST
) + "']",
1248 // SDRATTR_TEXT_RIGHTDIST
1249 assertXPath(pXmlDoc
,
1250 "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
1251 "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
1253 + OString::number(SDRATTR_TEXT_RIGHTDIST
) + "']",
1255 // SDRATTR_TEXT_UPPERDIST
1256 assertXPath(pXmlDoc
,
1257 "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
1258 "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
1260 + OString::number(SDRATTR_TEXT_UPPERDIST
) + "']",
1262 // SDRATTR_TEXT_LOWERDIST
1263 assertXPath(pXmlDoc
,
1264 "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
1265 "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
1267 + OString::number(SDRATTR_TEXT_LOWERDIST
) + "']",
1270 // Check the textbox-shape import too
1271 auto xShp
= getShape(1);
1272 CPPUNIT_ASSERT(xShp
);
1274 uno::Reference
<beans::XPropertySet
> xShapeProps(xShp
, uno::UNO_QUERY
);
1276 SwFrameFormat
* pFrameFormat
= SwTextBoxHelper::getOtherTextBoxFormat(xShp
);
1277 CPPUNIT_ASSERT(pFrameFormat
);
1279 // The shape has these values to copy to the associated text frame after modification::
1280 const tools::Long nLPaddng
1281 = xShapeProps
->getPropertyValue("TextLeftDistance").get
<tools::Long
>();
1282 const tools::Long nRPaddng
1283 = xShapeProps
->getPropertyValue("TextRightDistance").get
<tools::Long
>();
1284 const tools::Long nTPaddng
1285 = xShapeProps
->getPropertyValue("TextUpperDistance").get
<tools::Long
>();
1286 const tools::Long nBPaddng
1287 = xShapeProps
->getPropertyValue("TextLowerDistance").get
<tools::Long
>();
1289 CPPUNIT_ASSERT_EQUAL(tools::Long(1000), nLPaddng
);
1290 CPPUNIT_ASSERT_EQUAL(tools::Long(2000), nRPaddng
);
1291 CPPUNIT_ASSERT_EQUAL(tools::Long(3000), nTPaddng
);
1292 CPPUNIT_ASSERT_EQUAL(tools::Long(4001), nBPaddng
);
1294 // TODO: modify shape distance via UNO with text frame synchronization
1295 // Check the textbox as well:
1296 auto xTxFrm
= SwXTextFrame::CreateXTextFrame(*pFrameFormat
->GetDoc(), pFrameFormat
);
1297 CPPUNIT_ASSERT(xTxFrm
);
1299 const tools::Long nFrameLeftPaddng
1300 = xTxFrm
->getPropertyValue("LeftBorderDistance").get
<tools::Long
>();
1301 const tools::Long nFrameRightPaddng
1302 = xTxFrm
->getPropertyValue("RightBorderDistance").get
<tools::Long
>();
1303 const tools::Long nFrameTopPaddng
1304 = xTxFrm
->getPropertyValue("TopBorderDistance").get
<tools::Long
>();
1305 const tools::Long nFrameBottomPaddng
1306 = xTxFrm
->getPropertyValue("BottomBorderDistance").get
<tools::Long
>();
1308 // Check if the shape and frame have different setting
1309 CPPUNIT_ASSERT_EQUAL(nLPaddng
, nFrameLeftPaddng
);
1310 CPPUNIT_ASSERT_EQUAL(nRPaddng
, nFrameRightPaddng
);
1311 CPPUNIT_ASSERT_EQUAL(nTPaddng
, nFrameTopPaddng
);
1312 CPPUNIT_ASSERT_EQUAL(nBPaddng
, nFrameBottomPaddng
);
1315 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineFlysInFootnote
)
1318 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
1319 CPPUNIT_ASSERT(pTextDoc
);
1320 SwDoc
* pDoc(pTextDoc
->GetDocShell()->GetDoc());
1321 SwWrtShell
* pWrtShell
= pTextDoc
->GetDocShell()->GetWrtShell();
1322 SwRootFrame
* pLayout(pWrtShell
->GetLayout());
1323 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
1324 pWrtShell
->InsertFootnote("");
1325 CPPUNIT_ASSERT(pWrtShell
->IsCursorInFootnote());
1327 SfxItemSet
flySet(pDoc
->GetAttrPool(),
1328 svl::Items
<RES_FRM_SIZE
, RES_FRM_SIZE
, RES_ANCHOR
, RES_ANCHOR
>);
1329 SwFormatFrameSize
size(SwFrameSize::Minimum
, 1000, 1000);
1330 flySet
.Put(size
); // set a size, else we get 1 char per line...
1331 SwFormatAnchor
anchor(RndStdIds::FLY_AT_CHAR
);
1332 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
1334 // first fly is in first footnote that will be deleted
1335 /* SwFrameFormat const* pFly1 =*/pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
1336 pWrtShell
->Insert("quux");
1338 pWrtShell
->SttEndDoc(false);
1340 pWrtShell
->InsertFootnote("");
1341 CPPUNIT_ASSERT(pWrtShell
->IsCursorInFootnote());
1342 pWrtShell
->Insert("foo");
1343 pWrtShell
->SplitNode(false);
1344 pWrtShell
->Insert("bar");
1345 pWrtShell
->SplitNode(false);
1346 pWrtShell
->Insert("baz");
1348 pWrtShell
->StartOfSection(false);
1349 CPPUNIT_ASSERT(pWrtShell
->IsCursorInFootnote());
1350 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
1351 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
1353 // second fly is in second footnote that is not deleted
1354 SwFrameFormat
const* pFly
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
1355 CPPUNIT_ASSERT(pFly
!= nullptr);
1357 pWrtShell
->GotoFly(pFly
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
1358 pWrtShell
->Insert("abc");
1359 pWrtShell
->SplitNode(false);
1360 pWrtShell
->Insert("def");
1361 pWrtShell
->SplitNode(false);
1362 pWrtShell
->Insert("ghi");
1364 dispatchCommand(mxComponent
, ".uno:TrackChanges", {});
1365 // delete redline inside fly
1366 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
1367 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/true, 8, /*bBasicCall=*/false);
1368 pWrtShell
->Delete();
1370 // pWrtShell->GotoFlyAnchor(); // sigh... why, now we're in the body...
1371 pWrtShell
->SttEndDoc(false);
1372 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
1373 pWrtShell
->GotoFootnoteText();
1374 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
1375 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
1376 pWrtShell
->Delete();
1377 pWrtShell
->EndSelect(); // ?
1378 // delete first footnote
1379 pWrtShell
->SttEndDoc(true);
1380 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 1, /*bBasicCall=*/false);
1381 pWrtShell
->Delete();
1383 for (int i
= 0; i
< 2; ++i
)
1385 if (i
== 1) // secondly, try with different anchor type
1387 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
1388 SwPosition
pos(*anchor
.GetAnchorNode());
1389 pos
.nContent
.Assign(nullptr, 0);
1390 anchor
.SetAnchor(&pos
);
1391 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1394 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
1395 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
1396 discardDumpedLayout();
1397 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1398 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "25");
1399 assertXPath(pXmlDoc
,
1400 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1401 "child::*[@type='PortionType::Footnote']",
1402 "type", "PortionType::Footnote");
1403 assertXPath(pXmlDoc
,
1404 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1405 "child::*[@type='PortionType::Footnote']",
1407 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[1]/txt[1]/merged", "paraPropsNodeIndex",
1409 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/merged",
1410 "paraPropsNodeIndex", "17");
1411 assertXPath(pXmlDoc
,
1412 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1413 "SwLineLayout/SwParaPortion[1]",
1414 "type", "PortionType::Para");
1415 assertXPath(pXmlDoc
,
1416 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1417 "SwLineLayout/SwParaPortion[1]",
1421 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1422 "type", "PortionType::FootnoteNum");
1425 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1428 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
1429 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
1430 discardDumpedLayout();
1431 pXmlDoc
= parseLayoutDump();
1433 // show: nothing is merged
1434 assertXPath(pXmlDoc
, "//merged", 0);
1436 assertXPath(pXmlDoc
,
1437 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1438 "type", "PortionType::Footnote");
1439 assertXPath(pXmlDoc
,
1440 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1442 assertXPath(pXmlDoc
,
1443 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
1444 "type", "PortionType::Footnote");
1445 assertXPath(pXmlDoc
,
1446 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
1448 assertXPath(pXmlDoc
,
1449 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1450 "SwLineLayout/SwParaPortion[1]",
1451 "type", "PortionType::Para");
1452 assertXPath(pXmlDoc
,
1453 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1454 "SwLineLayout/SwParaPortion[1]",
1458 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1459 "type", "PortionType::FootnoteNum");
1462 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1464 assertXPath(pXmlDoc
,
1465 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1466 "SwLineLayout/SwLinePortion[1]",
1467 "type", "PortionType::Text");
1468 assertXPath(pXmlDoc
,
1469 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1470 "SwLineLayout/SwLinePortion[1]",
1472 assertXPath(pXmlDoc
,
1473 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1474 "SwLineLayout/SwLinePortion[2]",
1475 "type", "PortionType::Text");
1476 assertXPath(pXmlDoc
,
1477 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1478 "SwLineLayout/SwLinePortion[2]",
1480 assertXPath(pXmlDoc
,
1481 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/"
1482 "SwLineLayout/SwParaPortion[1]",
1483 "type", "PortionType::Para");
1484 assertXPath(pXmlDoc
,
1485 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/"
1486 "SwLineLayout/SwParaPortion[1]",
1488 assertXPath(pXmlDoc
,
1489 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/"
1490 "SwLineLayout/SwLinePortion[1]",
1491 "type", "PortionType::Text");
1492 assertXPath(pXmlDoc
,
1493 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/"
1494 "SwLineLayout/SwLinePortion[1]",
1496 assertXPath(pXmlDoc
,
1497 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/"
1498 "SwLineLayout/SwLinePortion[2]",
1499 "type", "PortionType::Text");
1500 assertXPath(pXmlDoc
,
1501 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/"
1502 "SwLineLayout/SwLinePortion[2]",
1506 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1507 "type", "PortionType::FootnoteNum");
1510 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1514 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1515 "type", "PortionType::Text");
1518 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1522 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1523 "type", "PortionType::Text");
1526 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1530 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1531 "type", "PortionType::Para");
1534 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1538 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1539 "type", "PortionType::Text");
1542 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1546 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1547 "type", "PortionType::Text");
1550 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1554 // anchor to 2nd (deleted) paragraph
1555 pWrtShell
->SttEndDoc(false);
1556 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
1557 pWrtShell
->GotoFootnoteText();
1558 pWrtShell
->Down(false, 1);
1559 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
1560 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
1561 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1563 for (int i
= 0; i
< 2; ++i
)
1565 if (i
== 1) // secondly, try with different anchor type
1567 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
1568 SwPosition
pos(*anchor
.GetAnchorNode());
1569 pos
.nContent
.Assign(nullptr, 0);
1570 anchor
.SetAnchor(&pos
);
1571 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1574 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
1575 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
1576 discardDumpedLayout();
1577 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1579 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "25");
1580 assertXPath(pXmlDoc
,
1581 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1582 "type", "PortionType::Footnote");
1583 assertXPath(pXmlDoc
,
1584 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1586 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[1]/txt[1]/merged", "paraPropsNodeIndex",
1590 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1591 "type", "PortionType::FootnoteNum");
1594 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1597 // hide: no anchored object shown
1598 assertXPath(pXmlDoc
, "//anchored", 0);
1600 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
1601 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
1602 discardDumpedLayout();
1603 pXmlDoc
= parseLayoutDump();
1605 // show: nothing is merged
1606 assertXPath(pXmlDoc
, "//merged", 0);
1608 assertXPath(pXmlDoc
,
1609 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1610 "type", "PortionType::Footnote");
1611 assertXPath(pXmlDoc
,
1612 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1614 assertXPath(pXmlDoc
,
1615 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
1616 "type", "PortionType::Footnote");
1617 assertXPath(pXmlDoc
,
1618 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
1620 assertXPath(pXmlDoc
,
1621 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1622 "SwLineLayout/SwParaPortion[1]",
1623 "type", "PortionType::Para");
1624 assertXPath(pXmlDoc
,
1625 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1626 "SwLineLayout/SwParaPortion[1]",
1630 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1631 "type", "PortionType::FootnoteNum");
1634 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1638 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1639 "type", "PortionType::FootnoteNum");
1642 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1646 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1647 "type", "PortionType::Text");
1650 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1654 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1655 "type", "PortionType::Text");
1658 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1660 assertXPath(pXmlDoc
,
1661 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/"
1662 "SwLineLayout/SwLinePortion[1]",
1663 "type", "PortionType::Text");
1664 assertXPath(pXmlDoc
,
1665 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/"
1666 "SwLineLayout/SwLinePortion[1]",
1668 assertXPath(pXmlDoc
,
1669 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/"
1670 "SwLineLayout/SwLinePortion[2]",
1671 "type", "PortionType::Text");
1672 assertXPath(pXmlDoc
,
1673 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/"
1674 "SwLineLayout/SwLinePortion[2]",
1676 assertXPath(pXmlDoc
,
1677 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/"
1678 "SwLineLayout/SwParaPortion[1]",
1679 "type", "PortionType::Para");
1680 assertXPath(pXmlDoc
,
1681 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/"
1682 "SwLineLayout/SwParaPortion[1]",
1684 assertXPath(pXmlDoc
,
1685 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/"
1686 "SwLineLayout/SwLinePortion[1]",
1687 "type", "PortionType::Text");
1688 assertXPath(pXmlDoc
,
1689 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/"
1690 "SwLineLayout/SwLinePortion[1]",
1692 assertXPath(pXmlDoc
,
1693 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/"
1694 "SwLineLayout/SwLinePortion[2]",
1695 "type", "PortionType::Text");
1696 assertXPath(pXmlDoc
,
1697 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/"
1698 "SwLineLayout/SwLinePortion[2]",
1702 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1703 "type", "PortionType::Para");
1706 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1710 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1711 "type", "PortionType::Text");
1714 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1718 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1719 "type", "PortionType::Text");
1722 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1726 // anchor to 3rd paragraph
1727 pWrtShell
->EndOfSection();
1728 pWrtShell
->SttEndDoc(false);
1729 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
1730 pWrtShell
->GotoFootnoteText();
1731 pWrtShell
->EndOfSection();
1732 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
1733 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
1734 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1736 for (int i
= 0; i
< 2; ++i
)
1738 if (i
== 1) // secondly, try with different anchor type
1740 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
1741 SwPosition
pos(*anchor
.GetAnchorNode());
1742 pos
.nContent
.Assign(nullptr, 0);
1743 anchor
.SetAnchor(&pos
);
1744 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1747 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
1748 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
1749 discardDumpedLayout();
1750 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1751 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "25");
1752 assertXPath(pXmlDoc
,
1753 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1754 "type", "PortionType::Footnote");
1755 assertXPath(pXmlDoc
,
1756 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1758 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[1]/txt[1]/merged", "paraPropsNodeIndex",
1760 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/merged",
1761 "paraPropsNodeIndex", "17");
1762 assertXPath(pXmlDoc
,
1763 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1764 "SwLineLayout/SwParaPortion[1]",
1765 "type", "PortionType::Para");
1766 assertXPath(pXmlDoc
,
1767 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1768 "SwLineLayout/SwParaPortion[1]",
1772 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1773 "type", "PortionType::FootnoteNum");
1776 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1779 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
1780 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
1781 discardDumpedLayout();
1782 pXmlDoc
= parseLayoutDump();
1784 // show: nothing is merged
1785 assertXPath(pXmlDoc
, "//merged", 0);
1787 assertXPath(pXmlDoc
,
1788 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1789 "child::*[@type='PortionType::Footnote'][1]",
1790 "type", "PortionType::Footnote");
1791 assertXPath(pXmlDoc
,
1792 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1793 "child::*[@type='PortionType::Footnote'][1]",
1795 assertXPath(pXmlDoc
,
1796 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1797 "child::*[@type='PortionType::Footnote'][2]",
1798 "type", "PortionType::Footnote");
1799 assertXPath(pXmlDoc
,
1800 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1801 "child::*[@type='PortionType::Footnote'][2]",
1803 assertXPath(pXmlDoc
,
1804 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1805 "SwLineLayout/SwParaPortion[1]",
1806 "type", "PortionType::Para");
1807 assertXPath(pXmlDoc
,
1808 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1809 "SwLineLayout/SwParaPortion[1]",
1813 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1814 "type", "PortionType::FootnoteNum");
1817 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1821 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1822 "type", "PortionType::FootnoteNum");
1825 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1829 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1830 "type", "PortionType::Text");
1833 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1837 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1838 "type", "PortionType::Text");
1841 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1845 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1846 "type", "PortionType::Para");
1849 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1851 assertXPath(pXmlDoc
,
1852 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/"
1853 "SwLineLayout/SwLinePortion[1]",
1854 "type", "PortionType::Text");
1855 assertXPath(pXmlDoc
,
1856 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/"
1857 "SwLineLayout/SwLinePortion[1]",
1859 assertXPath(pXmlDoc
,
1860 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/"
1861 "SwLineLayout/SwLinePortion[2]",
1862 "type", "PortionType::Text");
1863 assertXPath(pXmlDoc
,
1864 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/"
1865 "SwLineLayout/SwLinePortion[2]",
1867 assertXPath(pXmlDoc
,
1868 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/"
1869 "SwLineLayout/SwParaPortion[1]",
1870 "type", "PortionType::Para");
1871 assertXPath(pXmlDoc
,
1872 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/"
1873 "SwLineLayout/SwParaPortion[1]",
1875 assertXPath(pXmlDoc
,
1876 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/"
1877 "SwLineLayout/SwLinePortion[1]",
1878 "type", "PortionType::Text");
1879 assertXPath(pXmlDoc
,
1880 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/"
1881 "SwLineLayout/SwLinePortion[1]",
1883 assertXPath(pXmlDoc
,
1884 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/"
1885 "SwLineLayout/SwLinePortion[2]",
1886 "type", "PortionType::Text");
1887 assertXPath(pXmlDoc
,
1888 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/"
1889 "SwLineLayout/SwLinePortion[2]",
1893 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1894 "type", "PortionType::Text");
1897 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1901 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1902 "type", "PortionType::Text");
1905 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1910 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf143239
)
1912 createSwDoc("tdf143239-1-min.odt");
1913 SwDoc
* pDoc
= getSwDoc();
1914 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
1916 // These are unstable on macOS and Win64 builds,
1917 // so only test that they restore original values for now
1918 OUString p2txt1Left
, p2txt2Left
, p3txt1Left
;
1921 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1922 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly", 1);
1923 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
1926 = getXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "left");
1927 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly", 1);
1928 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "top",
1931 = getXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "left");
1932 assertXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly", 1);
1933 assertXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
1936 = getXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "left");
1937 assertXPath(pXmlDoc
, "/root/page", 3);
1938 discardDumpedLayout();
1941 pWrtShell
->SelAll();
1942 pWrtShell
->Delete();
1944 Scheduler::ProcessEventsToIdle();
1947 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1948 // now the 1st fly was on page 1, and the fly on page 2 was the 2nd one
1949 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly", 1);
1950 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
1952 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "left",
1954 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly", 1);
1955 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "top",
1957 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "left",
1959 assertXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly", 1);
1960 assertXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
1962 assertXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "left",
1964 assertXPath(pXmlDoc
, "/root/page", 3);
1965 discardDumpedLayout();
1969 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTableOverlapFooterFly
)
1971 // Load a document that has a fly anchored in the footer.
1972 // It also has a table which initially overlaps with the fly, but then moves to the next page.
1973 createSwDoc("footer-fly-table.fodt");
1974 xmlDocUniquePtr pLayout
= parseLayoutDump();
1975 // no fly portions, was: 8
1976 assertXPath(pLayout
,
1977 "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout/"
1978 "SwFixPortion[@type='PortionType::Fly'][@type='PortionType::Fly']",
1980 // one line break, was: 5
1981 assertXPath(pLayout
,
1982 "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout", 1);
1983 // one text portion, was: 1
1986 "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion",
1990 "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion",
1991 "portion", "Abc def ghi jkl mno pqr stu vwx yz.");
1993 // tdf#134782 height was: 379
1994 assertXPath(pLayout
, "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/infos/bounds", "height",
1998 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf134277
)
2000 createSwDoc("tdf134277.docx");
2001 SwDoc
* pDoc
= getSwDoc();
2002 CPPUNIT_ASSERT(pDoc
);
2003 SwDocShell
* pShell
= pDoc
->GetDocShell();
2005 std::shared_ptr
<GDIMetaFile
> xMetaFile
= pShell
->GetPreviewMetaFile();
2006 MetafileXmlDump dumper
;
2008 xmlDocUniquePtr pXmlDoc
= dumpAndParse(dumper
, *xMetaFile
);
2009 CPPUNIT_ASSERT(pXmlDoc
);
2011 assertXPath(pXmlDoc
, "/metafile/push/push/push/layoutmode[2]", 0);
2014 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf116486
)
2016 createSwDoc("tdf116486.docx");
2017 SwDoc
* pDoc
= getSwDoc();
2018 CPPUNIT_ASSERT(pDoc
);
2019 OUString aTop
= parseDump(
2020 "/root/page/body/txt/SwParaPortion/SwLineLayout[1]/child::*[@type='PortionType::Fly']",
2022 CPPUNIT_ASSERT_EQUAL(OUString("4006"), aTop
);
2025 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf142080
)
2027 // this caused an infinite loop
2028 createSwDoc("fdo43573-2-min.docx");
2030 xmlDocUniquePtr pLayout
= parseLayoutDump();
2031 // check the first paragraph on page 9 with its fly; the column was empty too
2032 assertXPath(pLayout
,
2033 "/root/page[9]/body/section[1]/column[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/"
2036 "De kleur u (rood) in het rechtervlak (R), de kleur r (wit) beneden (D),");
2037 SwTwips nPage9Top
= getXPath(pLayout
, "/root/page[9]/infos/bounds", "top").toInt32();
2040 "/root/page[9]/body/section[1]/column[1]/body/txt[1]/anchored/fly[1]/notxt/infos/bounds",
2041 "top", OUString::number(nPage9Top
+ 1460));
2044 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf152106
)
2046 // this caused an infinite loop
2047 createSwDoc("tdf152106.odt");
2049 xmlDocUniquePtr pLayout
= parseLayoutDump();
2052 assertXPath(pLayout
, "/root/page[3]/sorted_objs/fly", 1);
2055 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf128198
)
2057 createSwDoc("tdf128198-1.docx");
2058 SwDoc
* pDoc
= getSwDoc();
2059 CPPUNIT_ASSERT(pDoc
);
2060 xmlDocUniquePtr pLayout
= parseLayoutDump();
2061 // the problem was that line 5 was truncated at "this "
2062 // due to the fly anchored in previous paragraph
2063 assertXPath(pLayout
, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[5]", "portion",
2064 "to access any service, any time, anywhere. From this perspective, satellite "
2066 assertXPath(pLayout
, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[6]", "portion",
2067 "significant advantages. ");
2070 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testNoLineBreakAtSlash
)
2072 createSwDoc("no-line-break-at-slash.fodt");
2073 xmlDocUniquePtr pLayout
= parseLayoutDump();
2075 // the line break was between "Foostrasse 13/c/" and "2"
2076 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout", 2);
2077 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]/child::*", "type",
2078 "PortionType::Para");
2079 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/child::*[1]",
2080 "type", "PortionType::Text");
2081 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/child::*[2]",
2082 "type", "PortionType::Blank");
2083 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/child::*[3]",
2084 "type", "PortionType::Text");
2086 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "portion",
2087 "Blah blah bla bla bla ");
2088 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/SwLinePortion[1]",
2089 "portion", "Foostrasse");
2090 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/SwLinePortion[2]",
2091 "portion", "13/c/2, etc.");
2094 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf106153
)
2096 createSwDoc("tdf106153.docx");
2097 xmlDocUniquePtr pDump
= parseLayoutDump();
2099 const sal_Int64 nPageValLeft
= getXPath(pDump
, "/root/page/infos/bounds", "left").toInt64();
2100 const sal_Int64 nPageValTop
= getXPath(pDump
, "/root/page/infos/bounds", "top").toInt64();
2101 const sal_Int64 nPageValRight
= getXPath(pDump
, "/root/page/infos/bounds", "right").toInt64();
2102 const sal_Int64 nPageValBottom
= getXPath(pDump
, "/root/page/infos/bounds", "bottom").toInt64();
2104 const sal_Int64 nShape1ValTop
2105 = getXPath(pDump
, "/root/page/body/txt/anchored/fly[1]/infos/bounds", "top").toInt64();
2106 const sal_Int64 nShape2ValLeft
2107 = getXPath(pDump
, "/root/page/body/txt/anchored/fly[2]/infos/bounds", "left").toInt64();
2108 const sal_Int64 nShape3ValRight
2109 = getXPath(pDump
, "/root/page/body/txt/anchored/fly[3]/infos/bounds", "right").toInt64();
2110 const sal_Int64 nShape4ValBottom
2111 = getXPath(pDump
, "/root/page/body/txt/anchored/fly[4]/infos/bounds", "bottom").toInt64();
2113 CPPUNIT_ASSERT_MESSAGE("The whole top textbox is inside the page!",
2114 nPageValTop
> nShape1ValTop
);
2115 CPPUNIT_ASSERT_MESSAGE("The whole left textbox is inside the page!",
2116 nPageValLeft
> nShape2ValLeft
);
2117 CPPUNIT_ASSERT_MESSAGE("The whole right textbox is inside the page!",
2118 nPageValRight
< nShape3ValRight
);
2119 CPPUNIT_ASSERT_MESSAGE("The whole bottom textbox is inside the page!",
2120 nPageValBottom
< nShape4ValBottom
);
2123 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineFlysInFlys
)
2126 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
2127 CPPUNIT_ASSERT(pTextDoc
);
2128 SwDoc
* pDoc(pTextDoc
->GetDocShell()->GetDoc());
2129 SwWrtShell
* pWrtShell
= pTextDoc
->GetDocShell()->GetWrtShell();
2130 SwRootFrame
* pLayout(pWrtShell
->GetLayout());
2131 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2132 pWrtShell
->Insert("foo");
2133 pWrtShell
->SplitNode(false);
2134 pWrtShell
->Insert("bar");
2135 pWrtShell
->SplitNode(false);
2136 pWrtShell
->Insert("baz");
2137 SfxItemSet
flySet(pDoc
->GetAttrPool(),
2138 svl::Items
<RES_FRM_SIZE
, RES_FRM_SIZE
, RES_ANCHOR
, RES_ANCHOR
>);
2139 SwFormatFrameSize
size(SwFrameSize::Minimum
, 1000, 1000);
2140 flySet
.Put(size
); // set a size, else we get 1 char per line...
2141 pWrtShell
->StartOfSection(false);
2142 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
2143 SwFormatAnchor
anchor1(RndStdIds::FLY_AT_CHAR
);
2144 anchor1
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2145 flySet
.Put(anchor1
);
2146 SwFrameFormat
const* pFly1
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
2147 CPPUNIT_ASSERT(pFly1
!= nullptr);
2149 pWrtShell
->GotoFly(pFly1
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2150 pWrtShell
->Insert("abc");
2151 pWrtShell
->SplitNode(false);
2152 pWrtShell
->Insert("def");
2153 pWrtShell
->SplitNode(false);
2154 pWrtShell
->Insert("ghi");
2156 SwFormatAnchor
anchor2(RndStdIds::FLY_AT_CHAR
);
2157 pWrtShell
->StartOfSection(false); // start of fly...
2158 anchor2
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2159 flySet
.Put(anchor2
);
2160 SwFrameFormat
const* pFly2
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
2161 CPPUNIT_ASSERT(pFly2
!= nullptr);
2163 pWrtShell
->GotoFly(pFly2
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2164 pWrtShell
->Insert("jkl");
2165 pWrtShell
->SplitNode(false);
2166 pWrtShell
->Insert("mno");
2167 pWrtShell
->SplitNode(false);
2168 pWrtShell
->Insert("pqr");
2170 dispatchCommand(mxComponent
, ".uno:TrackChanges", {});
2171 // delete redline inside fly2
2172 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2173 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/true, 8, /*bBasicCall=*/false);
2174 pWrtShell
->Delete();
2176 // delete redline inside fly1
2177 pWrtShell
->GotoFly(pFly1
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2178 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2179 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
2180 pWrtShell
->Delete();
2182 pWrtShell
->ClearMark(); // otherwise it refuses to leave the fly...
2183 pWrtShell
->SttEndDoc(true); // note: SttDoc actually moves to start of fly?
2184 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2185 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
2186 pWrtShell
->Delete();
2188 for (int i
= 0; i
< 2; ++i
)
2190 if (i
== 1) // secondly, try with different anchor type
2192 anchor1
.SetType(RndStdIds::FLY_AT_PARA
);
2193 SwPosition
pos(*anchor1
.GetAnchorNode());
2194 pos
.nContent
.Assign(nullptr, 0);
2195 anchor1
.SetAnchor(&pos
);
2196 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
2197 anchor2
.SetType(RndStdIds::FLY_AT_PARA
);
2198 pos
.nNode
= *anchor2
.GetAnchorNode();
2199 anchor2
.SetAnchor(&pos
);
2200 pDoc
->SetAttr(anchor2
, *const_cast<SwFrameFormat
*>(pFly2
));
2203 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
2204 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
2205 discardDumpedLayout();
2206 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
2207 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "19");
2208 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
2209 "paraPropsNodeIndex", "6");
2212 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/merged",
2213 "paraPropsNodeIndex", "11");
2214 assertXPath(pXmlDoc
,
2215 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2216 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2217 "type", "PortionType::Para");
2218 assertXPath(pXmlDoc
,
2219 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2220 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2222 assertXPath(pXmlDoc
,
2223 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2226 "PortionType::Fly"); // remove???
2227 assertXPath(pXmlDoc
,
2228 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2230 "type", "PortionType::Lay");
2231 assertXPath(pXmlDoc
,
2232 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2235 assertXPath(pXmlDoc
,
2236 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2237 "PortionType::Para");
2238 assertXPath(pXmlDoc
,
2239 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2242 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
2243 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2244 discardDumpedLayout();
2245 pXmlDoc
= parseLayoutDump();
2247 // show: nothing is merged
2248 assertXPath(pXmlDoc
, "//merged", 0);
2250 assertXPath(pXmlDoc
,
2251 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2252 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2253 "type", "PortionType::Text");
2254 assertXPath(pXmlDoc
,
2255 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2256 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2258 assertXPath(pXmlDoc
,
2259 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2260 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2261 "type", "PortionType::Text");
2262 assertXPath(pXmlDoc
,
2263 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2264 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2266 assertXPath(pXmlDoc
,
2267 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[2]/"
2268 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2269 "type", "PortionType::Para");
2270 assertXPath(pXmlDoc
,
2271 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[2]/"
2272 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2274 assertXPath(pXmlDoc
,
2275 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
2276 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2277 "type", "PortionType::Text");
2278 assertXPath(pXmlDoc
,
2279 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
2280 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2282 assertXPath(pXmlDoc
,
2283 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
2284 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2285 "type", "PortionType::Text");
2286 assertXPath(pXmlDoc
,
2287 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
2288 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2290 assertXPath(pXmlDoc
,
2291 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2294 "PortionType::Fly"); // remove???
2295 assertXPath(pXmlDoc
,
2296 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2298 "type", "PortionType::Text");
2299 assertXPath(pXmlDoc
,
2300 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2303 assertXPath(pXmlDoc
,
2304 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2306 "type", "PortionType::Text");
2307 assertXPath(pXmlDoc
,
2308 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2311 assertXPath(pXmlDoc
,
2312 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2314 "type", "PortionType::Para");
2315 assertXPath(pXmlDoc
,
2316 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2319 assertXPath(pXmlDoc
,
2320 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2322 "type", "PortionType::Text");
2323 assertXPath(pXmlDoc
,
2324 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2327 assertXPath(pXmlDoc
,
2328 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2330 "type", "PortionType::Text");
2331 assertXPath(pXmlDoc
,
2332 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2335 assertXPath(pXmlDoc
,
2336 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2337 "PortionType::Text");
2338 assertXPath(pXmlDoc
,
2339 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2341 assertXPath(pXmlDoc
,
2342 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2343 "PortionType::Text");
2344 assertXPath(pXmlDoc
,
2345 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2347 assertXPath(pXmlDoc
,
2348 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2349 "PortionType::Para");
2350 assertXPath(pXmlDoc
,
2351 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2353 assertXPath(pXmlDoc
,
2354 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2355 "PortionType::Text");
2356 assertXPath(pXmlDoc
,
2357 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2359 assertXPath(pXmlDoc
,
2360 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2361 "PortionType::Text");
2362 assertXPath(pXmlDoc
,
2363 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2367 // anchor to 2nd (deleted) paragraph
2368 // also, switch the in-fly anchoring to the other fly, for additional fun!
2369 pWrtShell
->StartOfSection();
2370 pWrtShell
->Down(false, 1);
2371 anchor2
.SetType(RndStdIds::FLY_AT_CHAR
);
2372 anchor2
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2373 pDoc
->SetAttr(anchor2
, *const_cast<SwFrameFormat
*>(pFly2
));
2374 pWrtShell
->GotoFly(pFly2
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2375 pWrtShell
->Down(false, 1);
2376 anchor1
.SetType(RndStdIds::FLY_AT_CHAR
);
2377 anchor1
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2378 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
2380 for (int i
= 0; i
< 2; ++i
)
2382 if (i
== 1) // secondly, try with different anchor type
2384 anchor1
.SetType(RndStdIds::FLY_AT_PARA
);
2385 SwPosition
pos(*anchor1
.GetAnchorNode());
2386 pos
.nContent
.Assign(nullptr, 0);
2387 anchor1
.SetAnchor(&pos
);
2388 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
2389 anchor2
.SetType(RndStdIds::FLY_AT_PARA
);
2390 pos
.nNode
= *anchor2
.GetAnchorNode();
2391 anchor2
.SetAnchor(&pos
);
2392 pDoc
->SetAttr(anchor2
, *const_cast<SwFrameFormat
*>(pFly2
));
2395 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
2396 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
2397 discardDumpedLayout();
2398 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
2399 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "19");
2400 assertXPath(pXmlDoc
,
2401 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2402 "PortionType::Para");
2403 assertXPath(pXmlDoc
,
2404 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2407 // hide: no anchored object shown
2408 assertXPath(pXmlDoc
, "//anchored", 0);
2410 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
2411 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2412 discardDumpedLayout();
2413 pXmlDoc
= parseLayoutDump();
2415 // show: nothing is merged
2416 assertXPath(pXmlDoc
, "//merged", 0);
2418 assertXPath(pXmlDoc
,
2419 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2420 "PortionType::Text");
2421 assertXPath(pXmlDoc
,
2422 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2424 assertXPath(pXmlDoc
,
2425 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2426 "PortionType::Text");
2427 assertXPath(pXmlDoc
,
2428 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2430 assertXPath(pXmlDoc
,
2431 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2433 "type", "PortionType::Text");
2434 assertXPath(pXmlDoc
,
2435 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2438 assertXPath(pXmlDoc
,
2439 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2441 "type", "PortionType::Text");
2442 assertXPath(pXmlDoc
,
2443 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2446 assertXPath(pXmlDoc
,
2447 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/"
2448 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2449 "type", "PortionType::Text");
2450 assertXPath(pXmlDoc
,
2451 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/"
2452 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2454 assertXPath(pXmlDoc
,
2455 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/"
2456 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2457 "type", "PortionType::Text");
2458 assertXPath(pXmlDoc
,
2459 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/"
2460 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2462 assertXPath(pXmlDoc
,
2463 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[2]/"
2464 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2465 "type", "PortionType::Para");
2466 assertXPath(pXmlDoc
,
2467 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[2]/"
2468 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2470 assertXPath(pXmlDoc
,
2471 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/"
2472 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2473 "type", "PortionType::Text");
2474 assertXPath(pXmlDoc
,
2475 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/"
2476 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2478 assertXPath(pXmlDoc
,
2479 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/"
2480 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2481 "type", "PortionType::Text");
2482 assertXPath(pXmlDoc
,
2483 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/"
2484 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2486 assertXPath(pXmlDoc
,
2487 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2490 "PortionType::Fly"); // remove???
2491 assertXPath(pXmlDoc
,
2492 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2494 "type", "PortionType::Lay");
2495 assertXPath(pXmlDoc
,
2496 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2499 assertXPath(pXmlDoc
,
2500 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2502 "type", "PortionType::Text");
2503 assertXPath(pXmlDoc
,
2504 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2507 assertXPath(pXmlDoc
,
2508 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2510 "type", "PortionType::Text");
2511 assertXPath(pXmlDoc
,
2512 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2515 assertXPath(pXmlDoc
,
2516 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2517 "PortionType::Para");
2518 assertXPath(pXmlDoc
,
2519 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2521 assertXPath(pXmlDoc
,
2522 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2523 "PortionType::Text");
2524 assertXPath(pXmlDoc
,
2525 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2527 assertXPath(pXmlDoc
,
2528 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2529 "PortionType::Text");
2530 assertXPath(pXmlDoc
,
2531 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2535 // anchor to 3rd paragraph
2536 pWrtShell
->SttEndDoc(false);
2537 anchor1
.SetType(RndStdIds::FLY_AT_CHAR
);
2538 anchor1
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2539 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
2540 pWrtShell
->GotoFly(pFly1
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2541 pWrtShell
->EndOfSection();
2542 anchor2
.SetType(RndStdIds::FLY_AT_CHAR
);
2543 anchor2
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2544 pDoc
->SetAttr(anchor2
, *const_cast<SwFrameFormat
*>(pFly2
));
2546 for (int i
= 0; i
< 2; ++i
)
2548 if (i
== 1) // secondly, try with different anchor type
2550 anchor1
.SetType(RndStdIds::FLY_AT_PARA
);
2551 SwPosition
pos(*anchor1
.GetAnchorNode());
2552 pos
.nContent
.Assign(nullptr, 0);
2553 anchor1
.SetAnchor(&pos
);
2554 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
2555 anchor2
.SetType(RndStdIds::FLY_AT_PARA
);
2556 pos
.nNode
= *anchor2
.GetAnchorNode();
2557 anchor2
.SetAnchor(&pos
);
2558 pDoc
->SetAttr(anchor2
, *const_cast<SwFrameFormat
*>(pFly2
));
2561 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
2562 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
2563 discardDumpedLayout();
2564 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
2565 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "19");
2566 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
2567 "paraPropsNodeIndex", "6");
2570 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/merged",
2571 "paraPropsNodeIndex", "11");
2572 assertXPath(pXmlDoc
,
2573 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2574 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2575 "type", "PortionType::Para");
2576 assertXPath(pXmlDoc
,
2577 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2578 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2580 assertXPath(pXmlDoc
,
2581 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2584 "PortionType::Fly"); // remove???
2585 assertXPath(pXmlDoc
,
2586 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2588 "type", "PortionType::Lay");
2589 assertXPath(pXmlDoc
,
2590 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2593 assertXPath(pXmlDoc
,
2594 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2595 "PortionType::Para");
2596 assertXPath(pXmlDoc
,
2597 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2600 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
2601 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2602 discardDumpedLayout();
2603 pXmlDoc
= parseLayoutDump();
2605 // show: nothing is merged
2606 assertXPath(pXmlDoc
, "//merged", 0);
2608 assertXPath(pXmlDoc
,
2609 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2610 "PortionType::Text");
2611 assertXPath(pXmlDoc
,
2612 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2614 assertXPath(pXmlDoc
,
2615 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2616 "PortionType::Text");
2617 assertXPath(pXmlDoc
,
2618 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2620 assertXPath(pXmlDoc
,
2621 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2622 "PortionType::Para");
2623 assertXPath(pXmlDoc
,
2624 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2626 assertXPath(pXmlDoc
,
2627 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2629 "type", "PortionType::Text");
2630 assertXPath(pXmlDoc
,
2631 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2634 assertXPath(pXmlDoc
,
2635 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2637 "type", "PortionType::Text");
2638 assertXPath(pXmlDoc
,
2639 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2642 assertXPath(pXmlDoc
,
2643 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2645 "type", "PortionType::Para");
2646 assertXPath(pXmlDoc
,
2647 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2650 assertXPath(pXmlDoc
,
2651 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/"
2652 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2653 "type", "PortionType::Text");
2654 assertXPath(pXmlDoc
,
2655 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/"
2656 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2658 assertXPath(pXmlDoc
,
2659 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/"
2660 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2661 "type", "PortionType::Text");
2662 assertXPath(pXmlDoc
,
2663 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/"
2664 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2666 assertXPath(pXmlDoc
,
2667 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[2]/"
2668 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2669 "type", "PortionType::Para");
2670 assertXPath(pXmlDoc
,
2671 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[2]/"
2672 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2674 assertXPath(pXmlDoc
,
2675 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/"
2676 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2677 "type", "PortionType::Text");
2678 assertXPath(pXmlDoc
,
2679 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/"
2680 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2682 assertXPath(pXmlDoc
,
2683 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/"
2684 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2685 "type", "PortionType::Text");
2686 assertXPath(pXmlDoc
,
2687 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/"
2688 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2690 assertXPath(pXmlDoc
,
2691 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2693 "type", "PortionType::Text");
2694 assertXPath(pXmlDoc
,
2695 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2698 "PortionType::Fly"); // remove???
2699 assertXPath(pXmlDoc
,
2700 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2703 assertXPath(pXmlDoc
,
2704 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2706 "type", "PortionType::Text");
2707 assertXPath(pXmlDoc
,
2708 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2711 assertXPath(pXmlDoc
,
2712 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2713 "PortionType::Text");
2714 assertXPath(pXmlDoc
,
2715 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2717 assertXPath(pXmlDoc
,
2718 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2719 "PortionType::Text");
2720 assertXPath(pXmlDoc
,
2721 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2726 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineFlysAtFlys
)
2729 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
2730 CPPUNIT_ASSERT(pTextDoc
);
2731 SwDoc
* pDoc(pTextDoc
->GetDocShell()->GetDoc());
2732 SwWrtShell
* pWrtShell
= pTextDoc
->GetDocShell()->GetWrtShell();
2733 SwRootFrame
* pLayout(pWrtShell
->GetLayout());
2734 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2735 pWrtShell
->Insert("foo");
2736 pWrtShell
->SplitNode(false);
2737 pWrtShell
->Insert("bar");
2738 pWrtShell
->SplitNode(false);
2739 pWrtShell
->Insert("baz");
2740 SfxItemSet
flySet(pDoc
->GetAttrPool(),
2741 svl::Items
<RES_FRM_SIZE
, RES_FRM_SIZE
, RES_ANCHOR
, RES_ANCHOR
>);
2742 SwFormatFrameSize
size(SwFrameSize::Minimum
, 1000, 1000);
2743 flySet
.Put(size
); // set a size, else we get 1 char per line...
2744 pWrtShell
->StartOfSection(false);
2745 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
2746 SwFormatAnchor
anchor1(RndStdIds::FLY_AT_CHAR
);
2747 anchor1
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2748 flySet
.Put(anchor1
);
2749 SwFrameFormat
const* pFly1
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
2750 CPPUNIT_ASSERT(pFly1
!= nullptr);
2752 pWrtShell
->GotoFly(pFly1
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2753 pWrtShell
->Insert("abc");
2754 pWrtShell
->SplitNode(false);
2755 pWrtShell
->Insert("def");
2756 pWrtShell
->SplitNode(false);
2757 pWrtShell
->Insert("ghi");
2759 SwFormatAnchor
anchor2(RndStdIds::FLY_AT_FLY
);
2760 SwPosition
pos(*pFly1
->GetContent().GetContentIdx());
2761 anchor2
.SetAnchor(&pos
);
2762 flySet
.Put(anchor2
);
2763 SwFrameFormat
const* pFly2
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
2764 CPPUNIT_ASSERT(pFly2
!= nullptr);
2766 pWrtShell
->GotoFly(pFly2
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2767 pWrtShell
->Insert("jkl");
2768 pWrtShell
->SplitNode(false);
2769 pWrtShell
->Insert("mno");
2770 pWrtShell
->SplitNode(false);
2771 pWrtShell
->Insert("pqr");
2773 dispatchCommand(mxComponent
, ".uno:TrackChanges", {});
2774 // delete redline inside fly2
2775 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2776 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/true, 8, /*bBasicCall=*/false);
2777 pWrtShell
->Delete();
2779 // delete redline inside fly1
2780 pWrtShell
->GotoFly(pFly1
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2781 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2782 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
2783 pWrtShell
->Delete();
2785 pWrtShell
->ClearMark(); // otherwise it refuses to leave the fly...
2786 pWrtShell
->SttEndDoc(true); // note: SttDoc actually moves to start of fly?
2787 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2788 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
2789 pWrtShell
->Delete();
2791 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
2792 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
2793 discardDumpedLayout();
2794 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
2795 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "19");
2796 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
2797 "paraPropsNodeIndex", "6");
2798 assertXPath(pXmlDoc
,
2799 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/merged",
2800 "paraPropsNodeIndex", "11");
2801 assertXPath(pXmlDoc
,
2802 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2803 "SwLineLayout/SwParaPortion[1]",
2804 "type", "PortionType::Para");
2805 assertXPath(pXmlDoc
,
2806 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2807 "SwLineLayout/SwParaPortion[1]",
2809 assertXPath(pXmlDoc
,
2810 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2813 "PortionType::Fly"); // remove???
2814 assertXPath(pXmlDoc
,
2815 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2817 "type", "PortionType::Lay");
2818 assertXPath(pXmlDoc
,
2819 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2822 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2823 "type", "PortionType::Para");
2824 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2827 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
2828 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2829 discardDumpedLayout();
2830 pXmlDoc
= parseLayoutDump();
2832 // show: nothing is merged
2833 assertXPath(pXmlDoc
, "//merged", 0);
2835 assertXPath(pXmlDoc
,
2836 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2837 "SwLineLayout/SwLinePortion[1]",
2838 "type", "PortionType::Text");
2839 assertXPath(pXmlDoc
,
2840 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2841 "SwLineLayout/SwLinePortion[1]",
2843 assertXPath(pXmlDoc
,
2844 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2845 "SwLineLayout/SwLinePortion[2]",
2846 "type", "PortionType::Text");
2847 assertXPath(pXmlDoc
,
2848 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2849 "SwLineLayout/SwLinePortion[2]",
2851 assertXPath(pXmlDoc
,
2852 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/SwParaPortion/"
2853 "SwLineLayout/SwParaPortion[1]",
2854 "type", "PortionType::Para");
2855 assertXPath(pXmlDoc
,
2856 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/SwParaPortion/"
2857 "SwLineLayout/SwParaPortion[1]",
2859 assertXPath(pXmlDoc
,
2860 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
2861 "SwLineLayout/SwLinePortion[1]",
2862 "type", "PortionType::Text");
2863 assertXPath(pXmlDoc
,
2864 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
2865 "SwLineLayout/SwLinePortion[1]",
2867 assertXPath(pXmlDoc
,
2868 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
2869 "SwLineLayout/SwLinePortion[2]",
2870 "type", "PortionType::Text");
2871 assertXPath(pXmlDoc
,
2872 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
2873 "SwLineLayout/SwLinePortion[2]",
2875 assertXPath(pXmlDoc
,
2876 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2879 "PortionType::Fly"); // remove???
2880 assertXPath(pXmlDoc
,
2881 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2883 "type", "PortionType::Text");
2884 assertXPath(pXmlDoc
,
2885 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2888 assertXPath(pXmlDoc
,
2889 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2891 "type", "PortionType::Text");
2892 assertXPath(pXmlDoc
,
2893 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2896 assertXPath(pXmlDoc
,
2897 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2899 "type", "PortionType::Para");
2900 assertXPath(pXmlDoc
,
2901 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2904 assertXPath(pXmlDoc
,
2905 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2907 "type", "PortionType::Text");
2908 assertXPath(pXmlDoc
,
2909 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2912 assertXPath(pXmlDoc
,
2913 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2915 "type", "PortionType::Text");
2916 assertXPath(pXmlDoc
,
2917 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2920 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2921 "type", "PortionType::Text");
2922 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2924 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2925 "type", "PortionType::Text");
2926 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2928 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2929 "type", "PortionType::Para");
2930 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2932 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2933 "type", "PortionType::Text");
2934 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2936 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2937 "type", "PortionType::Text");
2938 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2941 // anchor to 2nd (deleted) paragraph
2942 pWrtShell
->StartOfSection();
2943 pWrtShell
->Down(false, 1);
2944 anchor1
.SetType(RndStdIds::FLY_AT_CHAR
);
2945 anchor1
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2946 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
2948 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
2949 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
2950 discardDumpedLayout();
2951 pXmlDoc
= parseLayoutDump();
2952 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "19");
2953 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2954 "type", "PortionType::Para");
2955 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2958 // hide: no anchored object shown
2959 assertXPath(pXmlDoc
, "//anchored", 0);
2961 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
2962 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2963 discardDumpedLayout();
2964 pXmlDoc
= parseLayoutDump();
2966 // show: nothing is merged
2967 assertXPath(pXmlDoc
, "//merged", 0);
2969 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2970 "type", "PortionType::Text");
2971 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2973 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2974 "type", "PortionType::Text");
2975 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2977 assertXPath(pXmlDoc
,
2978 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2979 "SwLineLayout/SwLinePortion[1]",
2980 "type", "PortionType::Text");
2981 assertXPath(pXmlDoc
,
2982 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2983 "SwLineLayout/SwLinePortion[1]",
2985 assertXPath(pXmlDoc
,
2986 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2987 "SwLineLayout/SwLinePortion[2]",
2988 "type", "PortionType::Text");
2989 assertXPath(pXmlDoc
,
2990 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2991 "SwLineLayout/SwLinePortion[2]",
2993 assertXPath(pXmlDoc
,
2994 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/SwParaPortion/"
2995 "SwLineLayout/SwParaPortion[1]",
2996 "type", "PortionType::Para");
2997 assertXPath(pXmlDoc
,
2998 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/SwParaPortion/"
2999 "SwLineLayout/SwParaPortion[1]",
3001 assertXPath(pXmlDoc
,
3002 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
3003 "SwLineLayout/SwLinePortion[1]",
3004 "type", "PortionType::Text");
3005 assertXPath(pXmlDoc
,
3006 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
3007 "SwLineLayout/SwLinePortion[1]",
3009 assertXPath(pXmlDoc
,
3010 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
3011 "SwLineLayout/SwLinePortion[2]",
3012 "type", "PortionType::Text");
3013 assertXPath(pXmlDoc
,
3014 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
3015 "SwLineLayout/SwLinePortion[2]",
3017 assertXPath(pXmlDoc
,
3018 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3020 "type", "PortionType::Text");
3021 assertXPath(pXmlDoc
,
3022 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3025 "PortionType::Fly"); // remove???
3026 assertXPath(pXmlDoc
,
3027 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3030 assertXPath(pXmlDoc
,
3031 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3033 "type", "PortionType::Text");
3034 assertXPath(pXmlDoc
,
3035 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3038 assertXPath(pXmlDoc
,
3039 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
3041 "type", "PortionType::Para");
3042 assertXPath(pXmlDoc
,
3043 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
3046 assertXPath(pXmlDoc
,
3047 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3049 "type", "PortionType::Text");
3050 assertXPath(pXmlDoc
,
3051 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3054 assertXPath(pXmlDoc
,
3055 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3057 "type", "PortionType::Text");
3058 assertXPath(pXmlDoc
,
3059 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3062 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3063 "type", "PortionType::Para");
3064 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3066 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3067 "type", "PortionType::Text");
3068 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3070 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3071 "type", "PortionType::Text");
3072 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3076 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineSections
)
3078 createSwDoc("redline_sections.fodt");
3079 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
3080 CPPUNIT_ASSERT(pTextDoc
);
3081 SwDoc
* pDoc(pTextDoc
->GetDocShell()->GetDoc());
3082 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
3083 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3085 // verify after load
3086 CheckRedlineSectionsHidden();
3088 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
3089 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3090 // why is this needed explicitly?
3091 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3092 discardDumpedLayout();
3093 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3095 // show: nothing is merged
3096 assertXPath(pXmlDoc
, "//merged", 0);
3097 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[1]", "type",
3098 "PortionType::Text");
3099 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[1]",
3101 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[2]", "type",
3102 "PortionType::Text");
3103 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[2]",
3106 assertXPath(pXmlDoc
,
3107 "/root/page[1]/body/section[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
3108 "SwLineLayout/child::*[1]",
3109 "type", "PortionType::Para");
3110 assertXPath(pXmlDoc
,
3111 "/root/page[1]/body/section[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
3112 "SwLineLayout/child::*[1]",
3113 "portion", "FRAME");
3114 assertXPath(pXmlDoc
,
3115 "/root/page[1]/body/section[1]/txt[1]/SwParaPortion/SwLineLayout/child::*[1]",
3116 "type", "PortionType::Para");
3117 assertXPath(pXmlDoc
,
3118 "/root/page[1]/body/section[1]/txt[1]/SwParaPortion/SwLineLayout/child::*[1]",
3120 assertXPath(pXmlDoc
,
3121 "/root/page[1]/body/section[1]/txt[2]/SwParaPortion/SwLineLayout/child::*[1]",
3122 "type", "PortionType::Para");
3123 assertXPath(pXmlDoc
,
3124 "/root/page[1]/body/section[1]/txt[2]/SwParaPortion/SwLineLayout/child::*[1]",
3126 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/child::*[1]", "type",
3127 "PortionType::Text");
3128 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/child::*[1]",
3130 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/child::*[2]", "type",
3131 "PortionType::Text");
3132 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/child::*[2]",
3134 assertXPath(pXmlDoc
,
3135 "/root/page[1]/body/section[2]/txt[1]/SwParaPortion/SwLineLayout/child::*[1]",
3136 "type", "PortionType::Text");
3137 assertXPath(pXmlDoc
,
3138 "/root/page[1]/body/section[2]/txt[1]/SwParaPortion/SwLineLayout/child::*[1]",
3140 assertXPath(pXmlDoc
,
3141 "/root/page[1]/body/section[2]/txt[1]/SwParaPortion/SwLineLayout/child::*[2]",
3142 "type", "PortionType::Text");
3143 assertXPath(pXmlDoc
,
3144 "/root/page[1]/body/section[2]/txt[1]/SwParaPortion/SwLineLayout/child::*[2]",
3146 assertXPath(pXmlDoc
,
3147 "/root/page[1]/body/section[2]/txt[2]/SwParaPortion/SwLineLayout/child::*[1]",
3148 "type", "PortionType::Para");
3149 assertXPath(pXmlDoc
,
3150 "/root/page[1]/body/section[2]/txt[2]/SwParaPortion/SwLineLayout/child::*[1]",
3152 assertXPath(pXmlDoc
,
3153 "/root/page[1]/body/section[2]/txt[3]/SwParaPortion/SwLineLayout/child::*[1]",
3154 "type", "PortionType::Text");
3155 assertXPath(pXmlDoc
,
3156 "/root/page[1]/body/section[2]/txt[3]/SwParaPortion/SwLineLayout/child::*[1]",
3158 assertXPath(pXmlDoc
,
3159 "/root/page[1]/body/section[2]/txt[3]/SwParaPortion/SwLineLayout/child::*[2]",
3160 "type", "PortionType::Text");
3161 assertXPath(pXmlDoc
,
3162 "/root/page[1]/body/section[2]/txt[3]/SwParaPortion/SwLineLayout/child::*[2]",
3165 // verify after hide
3166 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
3167 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3168 // why is this needed explicitly?
3169 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3170 discardDumpedLayout();
3171 CheckRedlineSectionsHidden();
3174 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TDF69647_images
)
3176 createSwDoc("tdf69647_images.odt");
3177 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
3178 CPPUNIT_ASSERT(pTextDoc
);
3179 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of pages does not match!", 2, getPages());
3182 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TDF69647_text
)
3184 createSwDoc("tdf69647_text.docx");
3185 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
3186 CPPUNIT_ASSERT(pTextDoc
);
3187 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of pages does not match!", 2, getPages());
3190 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineTables
)
3192 createSwDoc("redline_table.fodt");
3193 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
3194 CPPUNIT_ASSERT(pTextDoc
);
3195 SwDoc
* pDoc(pTextDoc
->GetDocShell()->GetDoc());
3196 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
3197 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3199 // verify after load
3200 discardDumpedLayout();
3201 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3202 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "12");
3203 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3204 "type", "PortionType::Para");
3205 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3208 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
3209 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3210 // why is this needed explicitly?
3211 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3212 discardDumpedLayout();
3213 pXmlDoc
= parseLayoutDump();
3215 // show: nothing is merged
3216 assertXPath(pXmlDoc
, "//merged", 0);
3217 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3218 "type", "PortionType::Text");
3219 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3221 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3222 "type", "PortionType::Text");
3223 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3226 assertXPath(pXmlDoc
,
3227 "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/anchored/fly[1]/txt[1]/"
3228 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
3229 "type", "PortionType::Para");
3230 assertXPath(pXmlDoc
,
3231 "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/anchored/fly[1]/txt[1]/"
3232 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
3233 "portion", "FRAME");
3234 assertXPath(pXmlDoc
,
3235 "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/SwParaPortion/SwLineLayout/"
3237 "type", "PortionType::Para");
3238 assertXPath(pXmlDoc
,
3239 "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/SwParaPortion/SwLineLayout/"
3242 assertXPath(pXmlDoc
,
3243 "/root/page[1]/body/tab[1]/row[2]/cell[2]/txt[1]/SwParaPortion/SwLineLayout/"
3245 "type", "PortionType::Para");
3246 assertXPath(pXmlDoc
,
3247 "/root/page[1]/body/tab[1]/row[2]/cell[2]/txt[1]/SwParaPortion/SwLineLayout/"
3250 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3251 "type", "PortionType::Text");
3252 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3254 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3255 "type", "PortionType::Text");
3256 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3259 // verify after hide
3260 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
3261 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3262 // why is this needed explicitly?
3263 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3264 discardDumpedLayout();
3265 pXmlDoc
= parseLayoutDump();
3266 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "12");
3267 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3268 "type", "PortionType::Para");
3269 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3273 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf144057
)
3275 createSwDoc("tdf144057.fodt");
3276 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
3277 CPPUNIT_ASSERT(pTextDoc
);
3278 SwDoc
* pDoc(pTextDoc
->GetDocShell()->GetDoc());
3279 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
3280 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3281 discardDumpedLayout();
3282 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3283 // show tracked row deletions
3284 assertXPath(pXmlDoc
, "/root/page", 4);
3285 assertXPath(pXmlDoc
,
3286 "/root/page[1]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3288 assertXPath(pXmlDoc
,
3289 "/root/page[2]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3291 assertXPath(pXmlDoc
,
3292 "/root/page[3]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3294 assertXPath(pXmlDoc
,
3295 "/root/page[4]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3298 // hide tracked table and table row deletions
3299 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
3300 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3301 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3302 discardDumpedLayout();
3303 pXmlDoc
= parseLayoutDump();
3305 // This was 4 (unhidden tracked table and table row deletions)
3306 assertXPath(pXmlDoc
, "/root/page", 1);
3307 assertXPath(pXmlDoc
, "/root/page[1]/body/tab", 1);
3308 assertXPath(pXmlDoc
, "/root/page[1]/body/tab/row", 5);
3309 assertXPath(pXmlDoc
,
3310 "/root/page[1]/body/tab/row[5]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3313 // show tracked table and table row deletions again
3314 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
3315 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3316 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3317 discardDumpedLayout();
3318 pXmlDoc
= parseLayoutDump();
3319 assertXPath(pXmlDoc
, "/root/page", 4);
3320 assertXPath(pXmlDoc
,
3321 "/root/page[1]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3323 assertXPath(pXmlDoc
,
3324 "/root/page[2]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3326 assertXPath(pXmlDoc
,
3327 "/root/page[3]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3329 assertXPath(pXmlDoc
,
3330 "/root/page[4]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3334 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf144347
)
3336 createSwDoc("tdf144057.fodt");
3337 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
3338 CPPUNIT_ASSERT(pTextDoc
);
3339 SwDoc
* pDoc(pTextDoc
->GetDocShell()->GetDoc());
3340 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
3343 dispatchCommand(mxComponent
, ".uno:TrackChanges", {});
3344 CPPUNIT_ASSERT_MESSAGE("redlining should be on",
3345 pDoc
->getIDocumentRedlineAccess().IsRedlineOn());
3346 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3348 // remove first table
3349 SwEditShell
* const pEditShell(pDoc
->GetEditShell());
3350 for (int i
= 0; i
< 12; ++i
)
3351 pEditShell
->AcceptRedline(0);
3353 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3354 discardDumpedLayout();
3355 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3356 // show tracked row deletions
3357 assertXPath(pXmlDoc
, "/root/page", 2);
3358 assertXPath(pXmlDoc
, "/root/page[1]/body/tab", 1);
3360 // select all the text, including the texts before and after the table
3361 // Note: this table contains tracked changes, which was a
3362 // problem for the original OOo implementation of track changes,
3363 // resulting empty tables after accepting the deletion of these tables.
3364 dispatchCommand(mxComponent
, ".uno:SelectAll", {});
3365 dispatchCommand(mxComponent
, ".uno:SelectAll", {});
3366 dispatchCommand(mxComponent
, ".uno:Delete", {});
3367 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3368 discardDumpedLayout();
3369 pXmlDoc
= parseLayoutDump();
3371 // table is deleted with change tracking: it still exists
3372 assertXPath(pXmlDoc
, "/root/page", 2);
3373 assertXPath(pXmlDoc
, "/root/page[1]/body/tab", 1);
3375 // accept all deletions, removing the table completely
3376 while (pEditShell
->GetRedlineCount() > 0)
3377 pEditShell
->AcceptRedline(0);
3379 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3380 discardDumpedLayout();
3381 pXmlDoc
= parseLayoutDump();
3383 assertXPath(pXmlDoc
, "/root/page", 1);
3384 // This was 1 (bad empty table)
3385 assertXPath(pXmlDoc
, "/root/page[1]/body/tab", 0);
3388 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf155345
)
3390 createSwDoc("tdf144057.fodt");
3391 SwXTextDocument
* pTextDoc
= dynamic_cast<SwXTextDocument
*>(mxComponent
.get());
3392 CPPUNIT_ASSERT(pTextDoc
);
3393 SwDoc
* pDoc(pTextDoc
->GetDocShell()->GetDoc());
3394 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
3395 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3397 // reject all deletions
3398 dispatchCommand(mxComponent
, ".uno:RejectAllTrackedChanges", {});
3401 dispatchCommand(mxComponent
, ".uno:TrackChanges", {});
3402 CPPUNIT_ASSERT_MESSAGE("redlining should be on",
3403 pDoc
->getIDocumentRedlineAccess().IsRedlineOn());
3405 // delete table column with track changes
3406 dispatchCommand(mxComponent
, ".uno:DeleteColumns", {});
3408 discardDumpedLayout();
3409 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3410 // show tracked column deletions
3411 assertXPath(pXmlDoc
, "/root/page", 4);
3413 // hide tracked table column deletions
3414 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
3415 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3416 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3417 discardDumpedLayout();
3418 pXmlDoc
= parseLayoutDump();
3420 // This was 4 (unhidden tracked table column deletions)
3421 assertXPath(pXmlDoc
, "/root/page", 2);
3423 // show tracked table column deletions again
3424 dispatchCommand(mxComponent
, ".uno:ShowTrackedChanges", {});
3425 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3426 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3427 discardDumpedLayout();
3428 pXmlDoc
= parseLayoutDump();
3429 assertXPath(pXmlDoc
, "/root/page", 4);
3432 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf109137
)
3434 createSwDoc("tdf109137.docx");
3435 // FIXME: it's not possible to use 'reload' here because the validation fails with
3436 // Error: attribute "text:start-value" has a bad value
3437 uno::Reference
<frame::XStorable
> xStorable(mxComponent
, uno::UNO_QUERY
);
3438 uno::Sequence
<beans::PropertyValue
> aDescriptor(comphelper::InitPropertySequence({
3439 { "FilterName", uno::Any(OUString("writer8")) },
3441 xStorable
->storeToURL(maTempFile
.GetURL(), aDescriptor
);
3442 mxComponent
= loadFromDesktop(maTempFile
.GetURL(), "com.sun.star.text.TextDocument");
3443 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3444 // This was 0, the blue rectangle moved from the 1st to the 2nd page.
3445 assertXPath(pXmlDoc
, "/root/page[1]/body/txt/anchored/fly/notxt",
3446 /*nNumberOfNodes=*/1);
3449 //just care it doesn't crash/assert
3450 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint72
) { createSwDoc("forcepoint72-1.rtf"); }
3452 //just care it doesn't crash/assert
3453 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint75
) { createSwDoc("forcepoint75-1.rtf"); }
3455 //just care it doesn't crash/assert
3456 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testUXTSOREL
) { createSwDoc("LIBREOFFICE-UXTSOREL.rtf"); }
3458 //just care it doesn't crash/assert
3459 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepointFootnoteFrame
)
3461 createSwDoc("forcepoint-swfootnoteframe-1.rtf");
3464 //just care it doesn't crash/assert
3465 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint76
) { createSwDoc("forcepoint76-1.rtf"); }
3467 //just care it doesn't crash/assert
3468 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testN4LA0OHZ
) { createSwDoc("LIBREOFFICE-N4LA0OHZ.rtf"); }
3470 //just care it doesn't crash/assert
3471 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint89
) { createSwWebDoc("forcepoint89.html"); }
3473 //just care it doesn't crash/assert
3474 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint90
) { createSwDoc("forcepoint90.rtf"); }
3476 //just care it doesn't crash/assert
3477 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint91
) { createSwWebDoc("forcepoint91.html"); }
3479 //just care it doesn't crash/assert
3480 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint92
) { createSwDoc("forcepoint92.doc"); }
3482 //just care it doesn't crash/assert
3483 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint93
)
3485 createSwDoc("forcepoint93-1.rtf");
3486 createSwDoc("forcepoint93-2.rtf");
3489 //just care it doesn't crash/assert
3490 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint94
) { createSwWebDoc("forcepoint94.html"); }
3492 //just care it doesn't crash/assert
3493 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint98
) { createSwWebDoc("forcepoint98.html"); }
3495 //just care it doesn't crash/assert
3496 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint100
) { createSwWebDoc("forcepoint100.html"); }
3498 //just care it doesn't crash/assert
3499 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint102
) { createSwDoc("forcepoint102.rtf"); }
3501 //just care it doesn't crash/assert
3502 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint103
) { createSwWebDoc("forcepoint103.html"); }
3504 //just care it doesn't crash/assert
3505 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf147485Forcepoint
)
3507 createSwDoc("tdf147485-forcepoint.docx");
3510 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf118058
)
3512 createSwDoc("tdf118058.fodt");
3513 SwDoc
* pDoc
= getSwDoc();
3514 // This resulted in a layout loop.
3515 pDoc
->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
3518 //just care it doesn't crash/assert
3519 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint99
) { createSwWebDoc("forcepoint99.html"); }
3521 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf128611
)
3523 createSwDoc("tdf128611.fodt");
3524 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3525 CPPUNIT_ASSERT(pXmlDoc
);
3526 // Without the accompanying fix in place, this test would have failed with:
3529 // i.e. there were multiple portions in the first paragraph of the A1 cell, which means that the
3530 // rotated text was broken into multiple lines without a good reason.
3531 assertXPathContent(pXmlDoc
, "//tab/row/cell[1]/txt", "Abcd efghijkl");
3534 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf142694
)
3536 createSwDoc("tdf142694-1.odt");
3538 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3539 CPPUNIT_ASSERT(pXmlDoc
);
3541 // the problem with this table is that the 3rd text frame (inside a nested
3542 // table) contains an as-char fly that doesn't fit on a page with the
3543 // repeated header row; currently it's split so that the 3rd text frame is
3544 // on a page of its own and extends outside the table.
3546 assertXPathNoAttribute(pXmlDoc
, "/root/page[4]/body/tab[1]", "precede");
3547 CPPUNIT_ASSERT(!getXPath(pXmlDoc
, "/root/page[4]/body/tab[1]", "follow").isEmpty());
3548 assertXPath(pXmlDoc
, "/root/page[4]/body/tab[1]/row[1]/cell[1]/tab", 1);
3549 assertXPath(pXmlDoc
, "/root/page[4]/body/tab[1]/row[2]/cell[1]/txt", 2);
3550 CPPUNIT_ASSERT(!getXPath(pXmlDoc
, "/root/page[5]/body/tab[1]", "precede").isEmpty());
3551 assertXPathNoAttribute(pXmlDoc
, "/root/page[5]/body/tab[1]", "follow");
3552 assertXPath(pXmlDoc
, "/root/page[5]/body/tab[1]/row[1]/cell[1]/tab", 1);
3553 assertXPath(pXmlDoc
, "/root/page[5]/body/tab[1]/row[2]/cell[1]/tab", 1);
3554 assertXPathNoAttribute(pXmlDoc
, "/root/page[5]/body/tab[1]/row[2]/cell[1]/tab", "follow");
3555 assertXPath(pXmlDoc
, "/root/page[5]/body/tab[1]/row[2]/cell[1]/tab/row/cell/txt", 1);
3558 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf152413
)
3560 createSwDoc("tdf152413.fodt");
3561 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3563 // Without the fix in place, this test would have failed with
3566 // - In <>, XPath '/root/page/body/txt/SwParaPortion/SwLineLayout/SwLinePortion' number of nodes is incorrect
3567 assertXPath(pXmlDoc
, "/root/page/body/txt/SwParaPortion/SwLineLayout/SwLinePortion", "portion",
3571 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf125893
)
3573 createSwDoc("tdf125893.docx");
3574 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3575 // This was 400. The paragraph must have zero top border.
3576 assertXPath(pXmlDoc
, "/root/page/body/txt[4]/infos/prtBounds", "top", "0");
3579 CPPUNIT_PLUGIN_IMPLEMENT();
3581 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */