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>
26 /// Test to assert layout / rendering result of Writer.
27 class SwLayoutWriter
: public SwModelTestBase
31 : SwModelTestBase(u
"/sw/qa/extras/layout/data/"_ustr
)
36 void CheckRedlineFootnotesHidden();
37 void CheckRedlineSectionsHidden();
40 // this is a member because our test classes have protected members :(
41 void SwLayoutWriter::CheckRedlineFootnotesHidden()
43 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
44 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"24");
45 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
46 "type", u
"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", u
"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", u
"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", u
"13");
59 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
60 "type", u
"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", u
"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", u
"16");
72 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
73 "type", u
"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", u
"PortionType::Text");
81 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
85 void SwLayoutWriter::CheckRedlineSectionsHidden()
87 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
88 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"12");
89 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
90 "type", u
"PortionType::Para");
91 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
93 assertXPath(pXmlDoc
, "/root/page[1]/body/section[1]/txt[1]/merged", "paraPropsNodeIndex",
96 "/root/page[1]/body/section[1]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
97 "type", u
"PortionType::Para");
99 "/root/page[1]/body/section[1]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
100 "portion", u
"folah");
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 SwDoc
* pDoc(getSwDoc());
119 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
120 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
123 CheckRedlineFootnotesHidden();
125 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
126 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
127 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
129 // show: nothing is merged
130 assertXPath(pXmlDoc
, "//merged", 0);
132 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
133 "type", u
"PortionType::Footnote");
134 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
136 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
137 "type", u
"PortionType::Text");
138 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
140 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
141 "type", u
"PortionType::Text");
142 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
144 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
145 "type", u
"PortionType::Footnote");
146 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
150 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
151 "type", u
"PortionType::FootnoteNum");
153 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
156 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
157 "type", u
"PortionType::Text");
159 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
162 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
163 "type", u
"PortionType::Text");
165 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
168 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
169 "type", u
"PortionType::Text");
171 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
174 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
175 "type", u
"PortionType::FootnoteNum");
177 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
180 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
181 "type", u
"PortionType::Text");
183 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
185 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
186 "type", u
"PortionType::Text");
187 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
189 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
190 "type", u
"PortionType::Footnote");
191 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
193 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
194 "type", u
"PortionType::Text");
195 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
198 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
199 "type", u
"PortionType::FootnoteNum");
201 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
204 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
205 "type", u
"PortionType::Text");
207 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
209 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
210 "type", u
"PortionType::Footnote");
211 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
213 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
214 "type", u
"PortionType::Text");
215 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
217 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
218 "type", u
"PortionType::Text");
219 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
221 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
222 "type", u
"PortionType::Footnote");
223 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
227 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
228 "type", u
"PortionType::FootnoteNum");
230 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
233 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
234 "type", u
"PortionType::Text");
236 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
239 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
240 "type", u
"PortionType::FootnoteNum");
242 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
245 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
246 "type", u
"PortionType::Text");
248 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
251 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
252 "type", u
"PortionType::Text");
254 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
257 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
258 "type", u
"PortionType::Text");
260 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
264 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
265 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
266 CheckRedlineFootnotesHidden();
269 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf136588
)
271 createSwDoc("tdf136588.docx");
272 auto pXMLLayoutDump
= parseLayoutDump();
273 CPPUNIT_ASSERT(pXMLLayoutDump
);
275 //there was a bad line break before, the correct break layout is this:
276 assertXPath(pXMLLayoutDump
, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[2]", "portion",
277 u
"effectively by modern-day small to ");
280 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineFlysInBody
)
283 SwDoc
* pDoc(getSwDoc());
284 SwWrtShell
* pWrtShell
= getSwDocShell()->GetWrtShell();
285 SwRootFrame
* pLayout(pWrtShell
->GetLayout());
286 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
287 pWrtShell
->Insert(u
"foo"_ustr
);
288 pWrtShell
->SplitNode(false);
289 pWrtShell
->Insert(u
"bar"_ustr
);
290 pWrtShell
->SplitNode(false);
291 pWrtShell
->Insert(u
"baz"_ustr
);
292 SfxItemSet
flySet(pDoc
->GetAttrPool(),
293 svl::Items
<RES_FRM_SIZE
, RES_FRM_SIZE
, RES_ANCHOR
, RES_ANCHOR
>);
294 SwFormatAnchor
anchor(RndStdIds::FLY_AT_CHAR
);
295 pWrtShell
->StartOfSection(false);
296 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
297 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
299 SwFormatFrameSize
size(SwFrameSize::Minimum
, 1000, 1000);
300 flySet
.Put(size
); // set a size, else we get 1 char per line...
301 SwFrameFormat
const* pFly
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
302 CPPUNIT_ASSERT(pFly
!= nullptr);
304 pWrtShell
->GotoFly(pFly
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
305 pWrtShell
->Insert(u
"abc"_ustr
);
306 pWrtShell
->SplitNode(false);
307 pWrtShell
->Insert(u
"def"_ustr
);
308 pWrtShell
->SplitNode(false);
309 pWrtShell
->Insert(u
"ghi"_ustr
);
311 dispatchCommand(mxComponent
, u
".uno:TrackChanges"_ustr
, {});
312 // delete redline inside fly
313 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
314 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/true, 8, /*bBasicCall=*/false);
317 pWrtShell
->SttEndDoc(true); // note: SttDoc actually moves to start of fly?
318 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
319 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
322 for (int i
= 0; i
< 2; ++i
)
324 if (i
== 1) // secondly, try with different anchor type
326 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
327 SwPosition
pos(*anchor
.GetAnchorNode());
328 pos
.nContent
.Assign(nullptr, 0);
329 anchor
.SetAnchor(&pos
);
330 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
333 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
334 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
335 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
336 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"14");
338 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
339 u
"PortionType::Para");
341 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
343 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
344 "paraPropsNodeIndex", u
"6");
346 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
348 "type", u
"PortionType::Para");
350 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
354 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
355 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
356 pXmlDoc
= parseLayoutDump();
358 // show: nothing is merged
359 assertXPath(pXmlDoc
, "//merged", 0);
362 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
363 u
"PortionType::Text");
365 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
368 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
369 u
"PortionType::Text");
371 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
374 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
376 "type", u
"PortionType::Text");
378 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
382 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
384 "type", u
"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[2]/SwParaPortion/SwLineLayout/"
392 "type", u
"PortionType::Para");
394 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
398 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
400 "type", u
"PortionType::Text");
402 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
406 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
408 "type", u
"PortionType::Text");
410 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
414 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
415 u
"PortionType::Para");
417 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
420 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
421 u
"PortionType::Text");
423 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
426 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
427 u
"PortionType::Text");
429 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
433 // anchor to 2nd (deleted) paragraph
434 pWrtShell
->StartOfSection();
435 pWrtShell
->Down(false, 1);
436 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
437 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
438 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
440 for (int i
= 0; i
< 2; ++i
)
442 if (i
== 1) // secondly, try with different anchor type
444 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
445 SwPosition
pos(*anchor
.GetAnchorNode());
446 pos
.nContent
.Assign(nullptr, 0);
447 anchor
.SetAnchor(&pos
);
448 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
451 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
452 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
453 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
454 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"14");
456 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
457 u
"PortionType::Para");
459 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
462 // hide: no anchored object shown
463 assertXPath(pXmlDoc
, "//anchored", 0);
465 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
466 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
467 pXmlDoc
= parseLayoutDump();
469 // show: nothing is merged
470 assertXPath(pXmlDoc
, "//merged", 0);
473 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
474 u
"PortionType::Text");
476 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
479 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
480 u
"PortionType::Text");
482 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
485 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
486 u
"PortionType::Para");
488 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
491 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
493 "type", u
"PortionType::Text");
495 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
499 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
501 "type", u
"PortionType::Text");
503 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
507 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
509 "type", u
"PortionType::Para");
511 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
515 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
517 "type", u
"PortionType::Text");
519 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
523 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
525 "type", u
"PortionType::Text");
527 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
531 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
532 u
"PortionType::Text");
534 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
537 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
538 u
"PortionType::Text");
540 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
544 // anchor to 3rd paragraph
545 pWrtShell
->EndOfSection();
546 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
547 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
548 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
550 for (int i
= 0; i
< 2; ++i
)
552 if (i
== 1) // secondly, try with different anchor type
554 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
555 SwPosition
pos(*anchor
.GetAnchorNode());
556 pos
.nContent
.Assign(nullptr, 0);
557 anchor
.SetAnchor(&pos
);
558 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
561 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
562 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
563 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
564 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"14");
566 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
567 u
"PortionType::Para");
569 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
571 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
572 "paraPropsNodeIndex", u
"6");
574 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
576 "type", u
"PortionType::Para");
578 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
582 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
583 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
584 pXmlDoc
= parseLayoutDump();
586 // show: nothing is merged
587 assertXPath(pXmlDoc
, "//merged", 0);
590 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
591 u
"PortionType::Text");
593 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
596 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
597 u
"PortionType::Text");
599 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
602 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
603 u
"PortionType::Para");
605 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
608 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
609 u
"PortionType::Text");
611 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
614 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
615 u
"PortionType::Text");
617 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
620 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
622 "type", u
"PortionType::Text");
624 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
628 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
630 "type", u
"PortionType::Text");
632 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
636 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
638 "type", u
"PortionType::Para");
640 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
644 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
646 "type", u
"PortionType::Text");
648 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
652 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
654 "type", u
"PortionType::Text");
656 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
662 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testFlyHiddenParagraph
)
664 createSwDoc("fly_hidden_paragraph.fodt");
666 // first, disable both so para gets hidden
667 uno::Sequence
<beans::PropertyValue
> argsSH(
668 comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", uno::Any(false) } }));
669 dispatchCommand(mxComponent
, ".uno:ShowHiddenParagraphs", argsSH
);
671 uno::Sequence
<beans::PropertyValue
> args(
672 comphelper::InitPropertySequence({ { "Fieldnames", uno::Any(false) } }));
674 dispatchCommand(mxComponent
, ".uno:Fieldnames", args
);
675 Scheduler::ProcessEventsToIdle();
677 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
678 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly/txt/infos/bounds", "height", u
"0");
679 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly/infos/bounds", "height", u
"448");
681 // the problem was that now the fly was the same height as before hiding
682 dispatchCommand(mxComponent
, ".uno:Fieldnames", {});
683 Scheduler::ProcessEventsToIdle();
685 pXmlDoc
= parseLayoutDump();
686 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly/txt/infos/bounds", "height",
688 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly/infos/bounds", "height", u
"1000");
690 dispatchCommand(mxComponent
, ".uno:Fieldnames", {});
691 Scheduler::ProcessEventsToIdle();
693 pXmlDoc
= parseLayoutDump();
694 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly/txt/infos/bounds", "height", u
"0");
695 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly/infos/bounds", "height", u
"448");
697 dispatchCommand(mxComponent
, ".uno:Fieldnames", {});
698 Scheduler::ProcessEventsToIdle();
700 pXmlDoc
= parseLayoutDump();
701 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly/txt/infos/bounds", "height",
703 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly/infos/bounds", "height", u
"1000");
705 // other test like testTdf143239 and testTdf159101 depend on this;
706 // seems getting the previous value is only possible with a listener
707 // so just hardcode it...
708 dispatchCommand(mxComponent
, ".uno:Fieldnames", args
);
709 Scheduler::ProcessEventsToIdle();
712 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testFieldHideSection
)
714 createSwDoc("field_hide_section.fodt");
716 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
717 assertXPath(pXmlDoc
, "/root/page[1]/body/section/tab/row", 1);
718 assertXPath(pXmlDoc
, "/root/page[2]/body/section/tab/row", 1);
719 assertXPath(pXmlDoc
, "/root/page", 2);
721 SwWrtShell
* pWrtShell
= getSwDocShell()->GetWrtShell();
722 ::std::unique_ptr
<SwField
> pField(pWrtShell
->GetCurField()->CopyField());
723 SwFieldMgr
manager(pWrtShell
);
725 pWrtShell
->StartAllAction();
726 manager
.UpdateCurField(10000 /*(?)*/, "Foo", "1", std::move(pField
));
727 pWrtShell
->EndAllAction();
728 Scheduler::ProcessEventsToIdle();
730 pXmlDoc
= parseLayoutDump();
731 assertXPath(pXmlDoc
, "/root/page[1]/body/section/tab/row", 2);
732 assertXPath(pXmlDoc
, "/root/page[1]/body/section/tab/row[1]/infos/bounds", "height", u
"0");
733 assertXPath(pXmlDoc
, "/root/page[1]/body/section/tab/row[2]/infos/bounds", "height", u
"0");
734 assertXPath(pXmlDoc
, "/root/page[1]/body/section/infos/bounds", "height", u
"0");
735 // the problem was that there were 3 pages now
736 assertXPath(pXmlDoc
, "/root/page", 1);
738 pWrtShell
->StartAllAction();
739 manager
.UpdateCurField(10000 /*(?)*/, "Foo", "0", std::move(pField
));
740 pWrtShell
->EndAllAction();
741 Scheduler::ProcessEventsToIdle();
743 pXmlDoc
= parseLayoutDump();
744 assertXPath(pXmlDoc
, "/root/page[1]/body/section/tab/row", 1);
745 assertXPath(pXmlDoc
, "/root/page[2]/body/section/tab/row", 1);
746 assertXPath(pXmlDoc
, "/root/page", 2);
749 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestI94666
)
751 createSwDoc("i94666.odt");
754 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
755 assertXPath(pXmlDoc
, "/root/page", 2);
758 "/root/page[2]/body/section/txt[1]/SwParaPortion/SwLineLayout[1]/SwLinePortion[1]",
759 "portion", u
"pulled off ");
762 SwWrtShell
* pWrtShell
= getSwDocShell()->GetWrtShell();
763 pWrtShell
->GotoPage(2, false);
764 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 11, /*bBasicCall=*/false);
765 pWrtShell
->SetMark();
766 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 11, /*bBasicCall=*/false);
767 pWrtShell
->DelToEndOfPara();
770 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
771 // the problem was that the last paragraph moved to page 3
774 "/root/page[2]/body/section/txt[1]/SwParaPortion/SwLineLayout[1]/SwLinePortion[1]",
776 u
"Widows & orphans He heard quiet steps behind him. That didn't bode well. Who could "
781 "/root/page[2]/body/section/txt[1]/SwParaPortion/SwLineLayout[3]/SwLinePortion[1]",
782 "portion", u
"pulled off ");
785 "/root/page[2]/body/section/txt[2]/SwParaPortion/SwLineLayout[1]/SwParaPortion[1]",
786 "portion", u
"Moved paragraph");
787 assertXPath(pXmlDoc
, "/root/page[2]//txt", 3);
788 assertXPath(pXmlDoc
, "/root/page", 2);
792 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf134272
)
794 createSwDoc("tdf134472.odt");
795 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
796 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[2]/infos/bounds", "height", u
"843");
797 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[2]/infos/bounds", "bottom", u
"2819");
800 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestNestedTableMoveFwd
)
802 createSwDoc("tabellen_test_windows_1.odt");
803 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
804 // the row with the nested table should not be split but be the first row on page 2
805 assertXPathContent(pXmlDoc
, "/root/page[1]/body/tab[1]/row[last()]/cell[1]/txt[1]",
807 assertXPathContent(pXmlDoc
,
808 "/root/page[2]/body/tab[1]/row[1]/cell[1]/tab[1]/row[1]/cell[1]/txt",
812 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf136613
)
814 createSwDoc("tdf136613.docx");
815 SwDoc
* pDoc
= getSwDoc();
817 //get the flys and the root frame
818 const auto vFlyFormats
= pDoc
->GetFlyFrameFormats(FLYCNTTYPE_ALL
, true);
819 const auto vFrames
= pDoc
->GetAllLayouts();
821 CPPUNIT_ASSERT(!vFrames
.empty());
822 CPPUNIT_ASSERT(!vFlyFormats
.empty());
824 //get the page frame from the root
825 SwFrame
* pPageFrame
= vFrames
[0]->Lower();
826 CPPUNIT_ASSERT(pPageFrame
);
828 //get the rectangle of the page
829 const SwRect
& rPageRect
= pPageFrame
->getFrameArea();
831 //check the flys and...
832 for (auto pFlyFormat
: vFlyFormats
)
834 //...the rectangle of the fly location...
835 const SwRect aRect
= pFlyFormat
->FindLayoutRect();
836 CPPUNIT_ASSERT(!aRect
.IsEmpty());
838 //...if it is on the page. This will fail if not.
839 CPPUNIT_ASSERT_MESSAGE("The pictures are outside the page!", rPageRect
.Contains(aRect
));
843 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf88496
)
845 createSwDoc("tdf88496.docx");
846 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
847 // This was 4, table fallback "switch off repeating header" started on a new page
848 assertXPath(pXmlDoc
, "/root/page", 3);
851 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineFlysInHeader
)
854 SwDoc
* pDoc(getSwDoc());
855 SwWrtShell
* pWrtShell
= getSwDocShell()->GetWrtShell();
856 SwRootFrame
* pLayout(pWrtShell
->GetLayout());
857 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
858 pWrtShell
->ChangeHeaderOrFooter(u
"Default Page Style", /*bHeader*/ true, /*bOn*/ true, false);
861 ->IsInHeaderFooter()); // assume this is supposed to put cursor in the new header...
862 pWrtShell
->Insert(u
"foo"_ustr
);
863 pWrtShell
->SplitNode(false);
864 pWrtShell
->Insert(u
"bar"_ustr
);
865 pWrtShell
->SplitNode(false);
866 pWrtShell
->Insert(u
"baz"_ustr
);
867 SfxItemSet
flySet(pDoc
->GetAttrPool(),
868 svl::Items
<RES_FRM_SIZE
, RES_FRM_SIZE
, RES_ANCHOR
, RES_ANCHOR
>);
869 SwFormatAnchor
anchor(RndStdIds::FLY_AT_CHAR
);
870 pWrtShell
->StartOfSection(false);
871 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
872 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
874 SwFormatFrameSize
size(SwFrameSize::Minimum
, 1000, 1000);
875 flySet
.Put(size
); // set a size, else we get 1 char per line...
876 SwFrameFormat
const* pFly
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
877 CPPUNIT_ASSERT(pFly
!= nullptr);
879 pWrtShell
->GotoFly(pFly
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
880 pWrtShell
->Insert(u
"abc"_ustr
);
881 pWrtShell
->SplitNode(false);
882 pWrtShell
->Insert(u
"def"_ustr
);
883 pWrtShell
->SplitNode(false);
884 pWrtShell
->Insert(u
"ghi"_ustr
);
886 dispatchCommand(mxComponent
, u
".uno:TrackChanges"_ustr
, {});
887 // delete redline inside fly
888 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
889 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/true, 8, /*bBasicCall=*/false);
892 pWrtShell
->GotoHeaderText();
893 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
894 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
897 for (int i
= 0; i
< 2; ++i
)
899 if (i
== 1) // secondly, try with different anchor type
901 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
902 SwPosition
pos(*anchor
.GetAnchorNode());
903 pos
.nContent
.Assign(nullptr, 0);
904 anchor
.SetAnchor(&pos
);
905 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
908 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
909 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
910 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
911 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout", "type",
912 u
"PortionType::Para");
913 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "length",
915 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/merged", "paraPropsNodeIndex", u
"6");
916 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[1]", "type",
917 u
"PortionType::Para");
918 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[1]", "portion",
920 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/merged",
921 "paraPropsNodeIndex", u
"11");
924 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout[1]",
925 "type", u
"PortionType::Para");
928 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout[1]",
931 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
932 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
933 pXmlDoc
= parseLayoutDump();
935 // show: nothing is merged
936 assertXPath(pXmlDoc
, "//merged", 0);
938 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "type",
939 u
"PortionType::Para");
940 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "length",
943 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
944 "type", u
"PortionType::Text");
946 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
949 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
950 "type", u
"PortionType::Text");
952 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
955 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
957 "type", u
"PortionType::Text");
959 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
963 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
965 "type", u
"PortionType::Text");
967 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
971 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
973 "type", u
"PortionType::Para");
975 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
979 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
981 "type", u
"PortionType::Text");
983 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
987 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
989 "type", u
"PortionType::Text");
991 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
995 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
996 "type", u
"PortionType::Para");
998 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1000 assertXPath(pXmlDoc
,
1001 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1002 "type", u
"PortionType::Text");
1003 assertXPath(pXmlDoc
,
1004 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1006 assertXPath(pXmlDoc
,
1007 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1008 "type", u
"PortionType::Text");
1009 assertXPath(pXmlDoc
,
1010 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1014 // anchor to 2nd (deleted) paragraph
1015 pWrtShell
->StartOfSection();
1016 pWrtShell
->Down(false, 1);
1017 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
1018 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
1019 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1021 for (int i
= 0; i
< 2; ++i
)
1023 if (i
== 1) // secondly, try with different anchor type
1025 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
1026 SwPosition
pos(*anchor
.GetAnchorNode());
1027 pos
.nContent
.Assign(nullptr, 0);
1028 anchor
.SetAnchor(&pos
);
1029 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1032 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
1033 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
1034 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1035 // now the frame has no Text portion? not sure why it's a 0-length one first and now none?
1036 // assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type", "PortionType::Para");
1037 // assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "length", "0");
1038 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/merged", "paraPropsNodeIndex", u
"6");
1039 assertXPath(pXmlDoc
,
1040 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1041 "type", u
"PortionType::Para");
1042 assertXPath(pXmlDoc
,
1043 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1044 "portion", u
"foaz");
1046 // hide: no anchored object shown
1047 assertXPath(pXmlDoc
, "//anchored", 0);
1049 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
1050 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
1051 pXmlDoc
= parseLayoutDump();
1053 // show: nothing is merged
1054 assertXPath(pXmlDoc
, "//merged", 0);
1056 assertXPath(pXmlDoc
,
1057 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
1058 u
"PortionType::Para");
1059 assertXPath(pXmlDoc
,
1060 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1062 assertXPath(pXmlDoc
,
1063 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1064 "type", u
"PortionType::Text");
1065 assertXPath(pXmlDoc
,
1066 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1068 assertXPath(pXmlDoc
,
1069 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1070 "type", u
"PortionType::Text");
1071 assertXPath(pXmlDoc
,
1072 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1074 assertXPath(pXmlDoc
,
1075 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1076 "type", u
"PortionType::Para");
1077 assertXPath(pXmlDoc
,
1078 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1080 assertXPath(pXmlDoc
,
1081 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1083 "type", u
"PortionType::Text");
1084 assertXPath(pXmlDoc
,
1085 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1088 assertXPath(pXmlDoc
,
1089 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1091 "type", u
"PortionType::Text");
1092 assertXPath(pXmlDoc
,
1093 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1096 assertXPath(pXmlDoc
,
1097 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
1099 "type", u
"PortionType::Para");
1100 assertXPath(pXmlDoc
,
1101 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
1104 assertXPath(pXmlDoc
,
1105 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1107 "type", u
"PortionType::Text");
1108 assertXPath(pXmlDoc
,
1109 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1112 assertXPath(pXmlDoc
,
1113 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1115 "type", u
"PortionType::Text");
1116 assertXPath(pXmlDoc
,
1117 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1120 assertXPath(pXmlDoc
,
1121 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1122 "type", u
"PortionType::Text");
1123 assertXPath(pXmlDoc
,
1124 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1126 assertXPath(pXmlDoc
,
1127 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1128 "type", u
"PortionType::Text");
1129 assertXPath(pXmlDoc
,
1130 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1134 // anchor to 3rd paragraph
1135 pWrtShell
->EndOfSection();
1136 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
1137 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
1138 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1140 for (int i
= 0; i
< 2; ++i
)
1142 if (i
== 1) // secondly, try with different anchor type
1144 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
1145 SwPosition
pos(*anchor
.GetAnchorNode());
1146 pos
.nContent
.Assign(nullptr, 0);
1147 anchor
.SetAnchor(&pos
);
1148 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1151 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
1152 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
1153 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1154 assertXPath(pXmlDoc
,
1155 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
1156 u
"PortionType::Para");
1157 assertXPath(pXmlDoc
,
1158 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1160 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/merged", "paraPropsNodeIndex", u
"6");
1161 assertXPath(pXmlDoc
,
1162 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1163 "type", u
"PortionType::Para");
1164 assertXPath(pXmlDoc
,
1165 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1166 "portion", u
"foaz");
1167 assertXPath(pXmlDoc
, "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/merged",
1168 "paraPropsNodeIndex", u
"11");
1169 assertXPath(pXmlDoc
,
1170 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1172 "type", u
"PortionType::Para");
1173 assertXPath(pXmlDoc
,
1174 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1178 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
1179 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
1180 pXmlDoc
= parseLayoutDump();
1182 // show: nothing is merged
1183 assertXPath(pXmlDoc
, "//merged", 0);
1185 assertXPath(pXmlDoc
,
1186 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
1187 u
"PortionType::Para");
1188 assertXPath(pXmlDoc
,
1189 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1191 assertXPath(pXmlDoc
,
1192 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1193 "type", u
"PortionType::Text");
1194 assertXPath(pXmlDoc
,
1195 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1197 assertXPath(pXmlDoc
,
1198 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1199 "type", u
"PortionType::Text");
1200 assertXPath(pXmlDoc
,
1201 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1203 assertXPath(pXmlDoc
,
1204 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1205 "type", u
"PortionType::Para");
1206 assertXPath(pXmlDoc
,
1207 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1209 assertXPath(pXmlDoc
,
1210 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1211 "type", u
"PortionType::Text");
1212 assertXPath(pXmlDoc
,
1213 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1215 assertXPath(pXmlDoc
,
1216 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1217 "type", u
"PortionType::Text");
1218 assertXPath(pXmlDoc
,
1219 "/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1221 assertXPath(pXmlDoc
,
1222 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1224 "type", u
"PortionType::Text");
1225 assertXPath(pXmlDoc
,
1226 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1229 assertXPath(pXmlDoc
,
1230 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1232 "type", u
"PortionType::Text");
1233 assertXPath(pXmlDoc
,
1234 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1237 assertXPath(pXmlDoc
,
1238 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
1240 "type", u
"PortionType::Para");
1241 assertXPath(pXmlDoc
,
1242 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
1245 assertXPath(pXmlDoc
,
1246 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1248 "type", u
"PortionType::Text");
1249 assertXPath(pXmlDoc
,
1250 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1253 assertXPath(pXmlDoc
,
1254 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1256 "type", u
"PortionType::Text");
1257 assertXPath(pXmlDoc
,
1258 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1264 #if !defined(MACOSX)
1265 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf150606
)
1267 createSwDoc("tdf150606-1-min.odt");
1269 SwWrtShell
* pWrtShell
= getSwDocShell()->GetWrtShell();
1271 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1273 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column[1]/body/tab", 1);
1274 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column[2]/body/tab", 1);
1275 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column", 2);
1276 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column[1]/body/tab", 1);
1277 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column[2]/body/tab", 1);
1278 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column", 2);
1279 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column[1]/body/tab", 1);
1280 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column[2]/body/tab", 1);
1281 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column", 2);
1282 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column[1]/body/tab", 1);
1283 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column[2]/body/tab", 1);
1284 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column", 2);
1285 // on page 5 the table is split across balanced columns
1286 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column[1]/body/tab", 1);
1287 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column[2]/body/tab", 1);
1288 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column", 2);
1289 assertXPath(pXmlDoc
, "/root/page", 5);
1291 pWrtShell
->Down(false, 1);
1292 dispatchCommand(mxComponent
, u
".uno:DeleteTable"_ustr
, {});
1294 pXmlDoc
= parseLayoutDump();
1296 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column/body/tab", 0);
1297 assertXPath(pXmlDoc
, "/root/page", 1);
1300 Scheduler::ProcessEventsToIdle();
1302 pXmlDoc
= parseLayoutDump();
1304 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column[1]/body/tab", 1);
1305 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column[2]/body/tab", 1);
1306 assertXPath(pXmlDoc
, "/root/page[1]/body/section/column", 2);
1307 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column[1]/body/tab", 1);
1308 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column[2]/body/tab", 1);
1309 assertXPath(pXmlDoc
, "/root/page[2]/body/section/column", 2);
1310 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column[1]/body/tab", 1);
1311 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column[2]/body/tab", 1);
1312 assertXPath(pXmlDoc
, "/root/page[3]/body/section/column", 2);
1313 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column[1]/body/tab", 1);
1314 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column[2]/body/tab", 1);
1315 assertXPath(pXmlDoc
, "/root/page[4]/body/section/column", 2);
1316 // on page 5 the table is split across balanced columns
1317 // (problem was that there were empty pages and table was on page 10)
1318 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column[1]/body/tab", 1);
1319 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column[2]/body/tab", 1);
1320 assertXPath(pXmlDoc
, "/root/page[5]/body/section/column", 2);
1321 assertXPath(pXmlDoc
, "/root/page", 5);
1325 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf152983
)
1327 //just care it doesn't crash/assert
1328 createSwDoc("tdf152983-1-min.docx");
1331 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf137025
)
1333 // Check the padding of the textbox
1334 createSwDoc("tdf137025.docx");
1335 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1336 CPPUNIT_ASSERT(pXmlDoc
);
1338 // Check the layout xml
1339 // SDRATTR_TEXT_LEFTDIST
1340 assertXPath(pXmlDoc
,
1341 "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
1342 "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
1344 + OString::number(SDRATTR_TEXT_LEFTDIST
) + "']",
1346 // SDRATTR_TEXT_RIGHTDIST
1347 assertXPath(pXmlDoc
,
1348 "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
1349 "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
1351 + OString::number(SDRATTR_TEXT_RIGHTDIST
) + "']",
1353 // SDRATTR_TEXT_UPPERDIST
1354 assertXPath(pXmlDoc
,
1355 "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
1356 "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
1358 + OString::number(SDRATTR_TEXT_UPPERDIST
) + "']",
1360 // SDRATTR_TEXT_LOWERDIST
1361 assertXPath(pXmlDoc
,
1362 "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
1363 "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
1365 + OString::number(SDRATTR_TEXT_LOWERDIST
) + "']",
1368 // Check the textbox-shape import too
1369 auto xShp
= getShape(1);
1370 CPPUNIT_ASSERT(xShp
);
1372 uno::Reference
<beans::XPropertySet
> xShapeProps(xShp
, uno::UNO_QUERY
);
1374 SwFrameFormat
* pFrameFormat
= SwTextBoxHelper::getOtherTextBoxFormat(xShp
);
1375 CPPUNIT_ASSERT(pFrameFormat
);
1377 // The shape has these values to copy to the associated text frame after modification::
1378 const tools::Long nLPaddng
1379 = xShapeProps
->getPropertyValue(u
"TextLeftDistance"_ustr
).get
<tools::Long
>();
1380 const tools::Long nRPaddng
1381 = xShapeProps
->getPropertyValue(u
"TextRightDistance"_ustr
).get
<tools::Long
>();
1382 const tools::Long nTPaddng
1383 = xShapeProps
->getPropertyValue(u
"TextUpperDistance"_ustr
).get
<tools::Long
>();
1384 const tools::Long nBPaddng
1385 = xShapeProps
->getPropertyValue(u
"TextLowerDistance"_ustr
).get
<tools::Long
>();
1387 CPPUNIT_ASSERT_EQUAL(tools::Long(1000), nLPaddng
);
1388 CPPUNIT_ASSERT_EQUAL(tools::Long(2000), nRPaddng
);
1389 CPPUNIT_ASSERT_EQUAL(tools::Long(3000), nTPaddng
);
1390 CPPUNIT_ASSERT_EQUAL(tools::Long(4001), nBPaddng
);
1392 // TODO: modify shape distance via UNO with text frame synchronization
1393 // Check the textbox as well:
1394 auto xTxFrm
= SwXTextFrame::CreateXTextFrame(*pFrameFormat
->GetDoc(), pFrameFormat
);
1395 CPPUNIT_ASSERT(xTxFrm
);
1397 const tools::Long nFrameLeftPaddng
1398 = xTxFrm
->getPropertyValue(u
"LeftBorderDistance"_ustr
).get
<tools::Long
>();
1399 const tools::Long nFrameRightPaddng
1400 = xTxFrm
->getPropertyValue(u
"RightBorderDistance"_ustr
).get
<tools::Long
>();
1401 const tools::Long nFrameTopPaddng
1402 = xTxFrm
->getPropertyValue(u
"TopBorderDistance"_ustr
).get
<tools::Long
>();
1403 const tools::Long nFrameBottomPaddng
1404 = xTxFrm
->getPropertyValue(u
"BottomBorderDistance"_ustr
).get
<tools::Long
>();
1406 // Check if the shape and frame have different setting
1407 CPPUNIT_ASSERT_EQUAL(nLPaddng
, nFrameLeftPaddng
);
1408 CPPUNIT_ASSERT_EQUAL(nRPaddng
, nFrameRightPaddng
);
1409 CPPUNIT_ASSERT_EQUAL(nTPaddng
, nFrameTopPaddng
);
1410 CPPUNIT_ASSERT_EQUAL(nBPaddng
, nFrameBottomPaddng
);
1413 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineFlysInFootnote
)
1416 SwDoc
* pDoc(getSwDoc());
1417 SwWrtShell
* pWrtShell
= getSwDocShell()->GetWrtShell();
1418 SwRootFrame
* pLayout(pWrtShell
->GetLayout());
1419 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
1420 pWrtShell
->InsertFootnote(u
""_ustr
);
1421 CPPUNIT_ASSERT(pWrtShell
->IsCursorInFootnote());
1423 SfxItemSet
flySet(pDoc
->GetAttrPool(),
1424 svl::Items
<RES_FRM_SIZE
, RES_FRM_SIZE
, RES_ANCHOR
, RES_ANCHOR
>);
1425 SwFormatFrameSize
size(SwFrameSize::Minimum
, 1000, 1000);
1426 flySet
.Put(size
); // set a size, else we get 1 char per line...
1427 SwFormatAnchor
anchor(RndStdIds::FLY_AT_CHAR
);
1428 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
1430 // first fly is in first footnote that will be deleted
1431 /* SwFrameFormat const* pFly1 =*/pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
1432 pWrtShell
->Insert(u
"quux"_ustr
);
1434 pWrtShell
->SttEndDoc(false);
1436 pWrtShell
->InsertFootnote(u
""_ustr
);
1437 CPPUNIT_ASSERT(pWrtShell
->IsCursorInFootnote());
1438 pWrtShell
->Insert(u
"foo"_ustr
);
1439 pWrtShell
->SplitNode(false);
1440 pWrtShell
->Insert(u
"bar"_ustr
);
1441 pWrtShell
->SplitNode(false);
1442 pWrtShell
->Insert(u
"baz"_ustr
);
1444 pWrtShell
->StartOfSection(false);
1445 CPPUNIT_ASSERT(pWrtShell
->IsCursorInFootnote());
1446 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
1447 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
1449 // second fly is in second footnote that is not deleted
1450 SwFrameFormat
const* pFly
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
1451 CPPUNIT_ASSERT(pFly
!= nullptr);
1453 pWrtShell
->GotoFly(pFly
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
1454 pWrtShell
->Insert(u
"abc"_ustr
);
1455 pWrtShell
->SplitNode(false);
1456 pWrtShell
->Insert(u
"def"_ustr
);
1457 pWrtShell
->SplitNode(false);
1458 pWrtShell
->Insert(u
"ghi"_ustr
);
1460 dispatchCommand(mxComponent
, u
".uno:TrackChanges"_ustr
, {});
1461 // delete redline inside fly
1462 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
1463 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/true, 8, /*bBasicCall=*/false);
1464 pWrtShell
->Delete();
1466 // pWrtShell->GotoFlyAnchor(); // sigh... why, now we're in the body...
1467 pWrtShell
->SttEndDoc(false);
1468 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
1469 pWrtShell
->GotoFootnoteText();
1470 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
1471 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
1472 pWrtShell
->Delete();
1473 pWrtShell
->EndSelect(); // ?
1474 // delete first footnote
1475 pWrtShell
->SttEndDoc(true);
1476 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 1, /*bBasicCall=*/false);
1477 pWrtShell
->Delete();
1479 for (int i
= 0; i
< 2; ++i
)
1481 if (i
== 1) // secondly, try with different anchor type
1483 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
1484 SwPosition
pos(*anchor
.GetAnchorNode());
1485 pos
.nContent
.Assign(nullptr, 0);
1486 anchor
.SetAnchor(&pos
);
1487 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1490 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
1491 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
1492 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1493 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"25");
1494 assertXPath(pXmlDoc
,
1495 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1496 "child::*[@type='PortionType::Footnote']",
1497 "type", u
"PortionType::Footnote");
1498 assertXPath(pXmlDoc
,
1499 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1500 "child::*[@type='PortionType::Footnote']",
1502 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[1]/txt[1]/merged", "paraPropsNodeIndex",
1504 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/merged",
1505 "paraPropsNodeIndex", u
"17");
1506 assertXPath(pXmlDoc
,
1507 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1508 "SwLineLayout/SwParaPortion[1]",
1509 "type", u
"PortionType::Para");
1510 assertXPath(pXmlDoc
,
1511 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1512 "SwLineLayout/SwParaPortion[1]",
1516 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1517 "type", u
"PortionType::FootnoteNum");
1520 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1523 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
1524 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
1525 pXmlDoc
= parseLayoutDump();
1527 // show: nothing is merged
1528 assertXPath(pXmlDoc
, "//merged", 0);
1530 assertXPath(pXmlDoc
,
1531 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1532 "type", u
"PortionType::Footnote");
1533 assertXPath(pXmlDoc
,
1534 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1536 assertXPath(pXmlDoc
,
1537 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
1538 "type", u
"PortionType::Footnote");
1539 assertXPath(pXmlDoc
,
1540 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
1542 assertXPath(pXmlDoc
,
1543 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1544 "SwLineLayout/SwParaPortion[1]",
1545 "type", u
"PortionType::Para");
1546 assertXPath(pXmlDoc
,
1547 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1548 "SwLineLayout/SwParaPortion[1]",
1549 "portion", u
"quux");
1552 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1553 "type", u
"PortionType::FootnoteNum");
1556 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1558 assertXPath(pXmlDoc
,
1559 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1560 "SwLineLayout/SwLinePortion[1]",
1561 "type", u
"PortionType::Text");
1562 assertXPath(pXmlDoc
,
1563 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1564 "SwLineLayout/SwLinePortion[1]",
1566 assertXPath(pXmlDoc
,
1567 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1568 "SwLineLayout/SwLinePortion[2]",
1569 "type", u
"PortionType::Text");
1570 assertXPath(pXmlDoc
,
1571 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1572 "SwLineLayout/SwLinePortion[2]",
1574 assertXPath(pXmlDoc
,
1575 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/"
1576 "SwLineLayout/SwParaPortion[1]",
1577 "type", u
"PortionType::Para");
1578 assertXPath(pXmlDoc
,
1579 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/"
1580 "SwLineLayout/SwParaPortion[1]",
1582 assertXPath(pXmlDoc
,
1583 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/"
1584 "SwLineLayout/SwLinePortion[1]",
1585 "type", u
"PortionType::Text");
1586 assertXPath(pXmlDoc
,
1587 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/"
1588 "SwLineLayout/SwLinePortion[1]",
1590 assertXPath(pXmlDoc
,
1591 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/"
1592 "SwLineLayout/SwLinePortion[2]",
1593 "type", u
"PortionType::Text");
1594 assertXPath(pXmlDoc
,
1595 "/root/page[1]/ftncont/ftn[2]/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/"
1596 "SwLineLayout/SwLinePortion[2]",
1600 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1601 "type", u
"PortionType::FootnoteNum");
1604 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1608 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1609 "type", u
"PortionType::Text");
1612 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1616 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1617 "type", u
"PortionType::Text");
1620 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1624 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1625 "type", u
"PortionType::Para");
1628 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1632 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1633 "type", u
"PortionType::Text");
1636 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1640 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1641 "type", u
"PortionType::Text");
1644 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1648 // anchor to 2nd (deleted) paragraph
1649 pWrtShell
->SttEndDoc(false);
1650 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
1651 pWrtShell
->GotoFootnoteText();
1652 pWrtShell
->Down(false, 1);
1653 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
1654 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
1655 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1657 for (int i
= 0; i
< 2; ++i
)
1659 if (i
== 1) // secondly, try with different anchor type
1661 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
1662 SwPosition
pos(*anchor
.GetAnchorNode());
1663 pos
.nContent
.Assign(nullptr, 0);
1664 anchor
.SetAnchor(&pos
);
1665 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1668 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
1669 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
1670 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1672 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"25");
1673 assertXPath(pXmlDoc
,
1674 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1675 "type", u
"PortionType::Footnote");
1676 assertXPath(pXmlDoc
,
1677 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1679 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[1]/txt[1]/merged", "paraPropsNodeIndex",
1683 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1684 "type", u
"PortionType::FootnoteNum");
1687 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1690 // hide: no anchored object shown
1691 assertXPath(pXmlDoc
, "//anchored", 0);
1693 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
1694 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
1695 pXmlDoc
= parseLayoutDump();
1697 // show: nothing is merged
1698 assertXPath(pXmlDoc
, "//merged", 0);
1700 assertXPath(pXmlDoc
,
1701 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1702 "type", u
"PortionType::Footnote");
1703 assertXPath(pXmlDoc
,
1704 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1706 assertXPath(pXmlDoc
,
1707 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
1708 "type", u
"PortionType::Footnote");
1709 assertXPath(pXmlDoc
,
1710 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]",
1712 assertXPath(pXmlDoc
,
1713 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1714 "SwLineLayout/SwParaPortion[1]",
1715 "type", u
"PortionType::Para");
1716 assertXPath(pXmlDoc
,
1717 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1718 "SwLineLayout/SwParaPortion[1]",
1719 "portion", u
"quux");
1722 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1723 "type", u
"PortionType::FootnoteNum");
1726 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1730 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1731 "type", u
"PortionType::FootnoteNum");
1734 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1738 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1739 "type", u
"PortionType::Text");
1742 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1746 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1747 "type", u
"PortionType::Text");
1750 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1752 assertXPath(pXmlDoc
,
1753 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/"
1754 "SwLineLayout/SwLinePortion[1]",
1755 "type", u
"PortionType::Text");
1756 assertXPath(pXmlDoc
,
1757 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/"
1758 "SwLineLayout/SwLinePortion[1]",
1760 assertXPath(pXmlDoc
,
1761 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/"
1762 "SwLineLayout/SwLinePortion[2]",
1763 "type", u
"PortionType::Text");
1764 assertXPath(pXmlDoc
,
1765 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/"
1766 "SwLineLayout/SwLinePortion[2]",
1768 assertXPath(pXmlDoc
,
1769 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/"
1770 "SwLineLayout/SwParaPortion[1]",
1771 "type", u
"PortionType::Para");
1772 assertXPath(pXmlDoc
,
1773 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/"
1774 "SwLineLayout/SwParaPortion[1]",
1776 assertXPath(pXmlDoc
,
1777 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/"
1778 "SwLineLayout/SwLinePortion[1]",
1779 "type", u
"PortionType::Text");
1780 assertXPath(pXmlDoc
,
1781 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/"
1782 "SwLineLayout/SwLinePortion[1]",
1784 assertXPath(pXmlDoc
,
1785 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/"
1786 "SwLineLayout/SwLinePortion[2]",
1787 "type", u
"PortionType::Text");
1788 assertXPath(pXmlDoc
,
1789 "/root/page[1]/ftncont/ftn[2]/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/"
1790 "SwLineLayout/SwLinePortion[2]",
1794 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1795 "type", u
"PortionType::Para");
1798 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1802 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1803 "type", u
"PortionType::Text");
1806 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1810 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1811 "type", u
"PortionType::Text");
1814 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1818 // anchor to 3rd paragraph
1819 pWrtShell
->EndOfSection();
1820 pWrtShell
->SttEndDoc(false);
1821 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
1822 pWrtShell
->GotoFootnoteText();
1823 pWrtShell
->EndOfSection();
1824 anchor
.SetType(RndStdIds::FLY_AT_CHAR
);
1825 anchor
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
1826 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1828 for (int i
= 0; i
< 2; ++i
)
1830 if (i
== 1) // secondly, try with different anchor type
1832 anchor
.SetType(RndStdIds::FLY_AT_PARA
);
1833 SwPosition
pos(*anchor
.GetAnchorNode());
1834 pos
.nContent
.Assign(nullptr, 0);
1835 anchor
.SetAnchor(&pos
);
1836 pDoc
->SetAttr(anchor
, *const_cast<SwFrameFormat
*>(pFly
));
1839 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
1840 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
1841 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1842 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"25");
1843 assertXPath(pXmlDoc
,
1844 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1845 "type", u
"PortionType::Footnote");
1846 assertXPath(pXmlDoc
,
1847 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1849 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[1]/txt[1]/merged", "paraPropsNodeIndex",
1851 assertXPath(pXmlDoc
, "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/merged",
1852 "paraPropsNodeIndex", u
"17");
1853 assertXPath(pXmlDoc
,
1854 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1855 "SwLineLayout/SwParaPortion[1]",
1856 "type", u
"PortionType::Para");
1857 assertXPath(pXmlDoc
,
1858 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1859 "SwLineLayout/SwParaPortion[1]",
1863 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1864 "type", u
"PortionType::FootnoteNum");
1867 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1870 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
1871 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
1872 pXmlDoc
= parseLayoutDump();
1874 // show: nothing is merged
1875 assertXPath(pXmlDoc
, "//merged", 0);
1877 assertXPath(pXmlDoc
,
1878 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1879 "child::*[@type='PortionType::Footnote'][1]",
1880 "type", u
"PortionType::Footnote");
1881 assertXPath(pXmlDoc
,
1882 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1883 "child::*[@type='PortionType::Footnote'][1]",
1885 assertXPath(pXmlDoc
,
1886 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1887 "child::*[@type='PortionType::Footnote'][2]",
1888 "type", u
"PortionType::Footnote");
1889 assertXPath(pXmlDoc
,
1890 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/"
1891 "child::*[@type='PortionType::Footnote'][2]",
1893 assertXPath(pXmlDoc
,
1894 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1895 "SwLineLayout/SwParaPortion[1]",
1896 "type", u
"PortionType::Para");
1897 assertXPath(pXmlDoc
,
1898 "/root/page[1]/ftncont/ftn[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
1899 "SwLineLayout/SwParaPortion[1]",
1900 "portion", u
"quux");
1903 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1904 "type", u
"PortionType::FootnoteNum");
1907 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1911 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1912 "type", u
"PortionType::FootnoteNum");
1915 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1919 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1920 "type", u
"PortionType::Text");
1923 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1927 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1928 "type", u
"PortionType::Text");
1931 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1935 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1936 "type", u
"PortionType::Para");
1939 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1941 assertXPath(pXmlDoc
,
1942 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/"
1943 "SwLineLayout/SwLinePortion[1]",
1944 "type", u
"PortionType::Text");
1945 assertXPath(pXmlDoc
,
1946 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/"
1947 "SwLineLayout/SwLinePortion[1]",
1949 assertXPath(pXmlDoc
,
1950 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/"
1951 "SwLineLayout/SwLinePortion[2]",
1952 "type", u
"PortionType::Text");
1953 assertXPath(pXmlDoc
,
1954 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/"
1955 "SwLineLayout/SwLinePortion[2]",
1957 assertXPath(pXmlDoc
,
1958 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/"
1959 "SwLineLayout/SwParaPortion[1]",
1960 "type", u
"PortionType::Para");
1961 assertXPath(pXmlDoc
,
1962 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/"
1963 "SwLineLayout/SwParaPortion[1]",
1965 assertXPath(pXmlDoc
,
1966 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/"
1967 "SwLineLayout/SwLinePortion[1]",
1968 "type", u
"PortionType::Text");
1969 assertXPath(pXmlDoc
,
1970 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/"
1971 "SwLineLayout/SwLinePortion[1]",
1973 assertXPath(pXmlDoc
,
1974 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/"
1975 "SwLineLayout/SwLinePortion[2]",
1976 "type", u
"PortionType::Text");
1977 assertXPath(pXmlDoc
,
1978 "/root/page[1]/ftncont/ftn[2]/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/"
1979 "SwLineLayout/SwLinePortion[2]",
1983 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1984 "type", u
"PortionType::Text");
1987 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1991 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1992 "type", u
"PortionType::Text");
1995 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2000 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf143239
)
2002 createSwDoc("tdf143239-1-min.odt");
2003 SwWrtShell
* pWrtShell
= getSwDocShell()->GetWrtShell();
2005 // These are unstable on macOS and Win64 builds,
2006 // so only test that they restore original values for now
2007 OUString p2txt1Left
, p2txt2Left
, p3txt1Left
;
2010 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
2011 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly", 1);
2012 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
2015 = getXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "left");
2016 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly", 1);
2017 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "top",
2020 = getXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "left");
2021 assertXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly", 1);
2022 assertXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
2025 = getXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "left");
2026 assertXPath(pXmlDoc
, "/root/page", 3);
2029 pWrtShell
->SelAll();
2030 pWrtShell
->Delete();
2032 Scheduler::ProcessEventsToIdle();
2035 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
2036 // now the 1st fly was on page 1, and the fly on page 2 was the 2nd one
2037 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly", 1);
2038 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
2040 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "left",
2042 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly", 1);
2043 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "top",
2045 assertXPath(pXmlDoc
, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "left",
2047 assertXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly", 1);
2048 assertXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
2050 assertXPath(pXmlDoc
, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "left",
2052 assertXPath(pXmlDoc
, "/root/page", 3);
2056 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTableOverlapFooterFly
)
2058 // Load a document that has a fly anchored in the footer.
2059 // It also has a table which initially overlaps with the fly, but then moves to the next page.
2060 createSwDoc("footer-fly-table.fodt");
2061 xmlDocUniquePtr pLayout
= parseLayoutDump();
2062 // no fly portions, was: 8
2063 assertXPath(pLayout
,
2064 "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout/"
2065 "SwFixPortion[@type='PortionType::Fly'][@type='PortionType::Fly']",
2067 // one line break, was: 5
2068 assertXPath(pLayout
,
2069 "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout", 1);
2070 // one text portion, was: 1
2073 "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion",
2077 "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion",
2078 "portion", u
"Abc def ghi jkl mno pqr stu vwx yz.");
2080 // tdf#134782 height was: 379
2081 assertXPath(pLayout
, "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/infos/bounds", "height",
2085 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf134277
)
2087 createSwDoc("tdf134277.docx");
2088 SwDocShell
* pShell
= getSwDocShell();
2090 std::shared_ptr
<GDIMetaFile
> xMetaFile
= pShell
->GetPreviewMetaFile();
2091 MetafileXmlDump dumper
;
2093 xmlDocUniquePtr pXmlDoc
= dumpAndParse(dumper
, *xMetaFile
);
2094 CPPUNIT_ASSERT(pXmlDoc
);
2096 assertXPath(pXmlDoc
, "/metafile/push/push/push/layoutmode[2]", 0);
2099 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf116486
)
2101 createSwDoc("tdf116486.docx");
2102 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
2103 OUString aTop
= getXPath(
2105 "/root/page/body/txt/SwParaPortion/SwLineLayout[1]/child::*[@type='PortionType::Fly']",
2107 CPPUNIT_ASSERT_EQUAL(u
"4006"_ustr
, aTop
);
2110 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TestTdf142080
)
2112 // this caused an infinite loop
2113 createSwDoc("fdo43573-2-min.docx");
2115 xmlDocUniquePtr pLayout
= parseLayoutDump();
2116 // check the first paragraph on page 9 with its fly; the column was empty too
2117 assertXPath(pLayout
,
2118 "/root/page[9]/body/section[1]/column[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/"
2121 u
"De kleur u (rood) in het rechtervlak (R), de kleur r (wit) beneden (D),");
2122 SwTwips nPage9Top
= getXPath(pLayout
, "/root/page[9]/infos/bounds", "top").toInt32();
2125 "/root/page[9]/body/section[1]/column[1]/body/txt[1]/anchored/fly[1]/notxt/infos/bounds",
2126 "top", OUString::number(nPage9Top
+ 1460));
2129 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf152106
)
2131 // this caused an infinite loop
2132 createSwDoc("tdf152106.odt");
2134 xmlDocUniquePtr pLayout
= parseLayoutDump();
2137 assertXPath(pLayout
, "/root/page[3]/sorted_objs/fly", 1);
2140 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf128198
)
2142 createSwDoc("tdf128198-1.docx");
2143 xmlDocUniquePtr pLayout
= parseLayoutDump();
2144 // the problem was that line 5 was truncated at "this "
2145 // due to the fly anchored in previous paragraph
2146 assertXPath(pLayout
, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[5]", "portion",
2147 u
"to access any service, any time, anywhere. From this perspective, satellite "
2149 assertXPath(pLayout
, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[6]", "portion",
2150 u
"significant advantages. ");
2153 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testNoLineBreakAtSlash
)
2155 createSwDoc("no-line-break-at-slash.fodt");
2156 xmlDocUniquePtr pLayout
= parseLayoutDump();
2158 // the line break was between "Foostrasse 13/c/" and "2"
2159 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout", 2);
2160 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]/child::*", "type",
2161 u
"PortionType::Para");
2162 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/child::*[1]",
2163 "type", u
"PortionType::Text");
2164 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/child::*[2]",
2165 "type", u
"PortionType::Blank");
2166 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/child::*[3]",
2167 "type", u
"PortionType::Text");
2169 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "portion",
2170 u
"Blah blah bla bla bla ");
2171 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/SwLinePortion[1]",
2172 "portion", u
"Foostrasse");
2173 assertXPath(pLayout
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/SwLinePortion[2]",
2174 "portion", u
"13/c/2, etc.");
2177 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf106153
)
2179 createSwDoc("tdf106153.docx");
2180 xmlDocUniquePtr pDump
= parseLayoutDump();
2182 const sal_Int64 nPageValLeft
= getXPath(pDump
, "/root/page/infos/bounds", "left").toInt64();
2183 const sal_Int64 nPageValTop
= getXPath(pDump
, "/root/page/infos/bounds", "top").toInt64();
2184 const sal_Int64 nPageValRight
= getXPath(pDump
, "/root/page/infos/bounds", "right").toInt64();
2185 const sal_Int64 nPageValBottom
= getXPath(pDump
, "/root/page/infos/bounds", "bottom").toInt64();
2187 const sal_Int64 nShape1ValTop
2188 = getXPath(pDump
, "/root/page/body/txt/anchored/fly[1]/infos/bounds", "top").toInt64();
2189 const sal_Int64 nShape2ValLeft
2190 = getXPath(pDump
, "/root/page/body/txt/anchored/fly[2]/infos/bounds", "left").toInt64();
2191 const sal_Int64 nShape3ValRight
2192 = getXPath(pDump
, "/root/page/body/txt/anchored/fly[3]/infos/bounds", "right").toInt64();
2193 const sal_Int64 nShape4ValBottom
2194 = getXPath(pDump
, "/root/page/body/txt/anchored/fly[4]/infos/bounds", "bottom").toInt64();
2196 CPPUNIT_ASSERT_MESSAGE("The whole top textbox is inside the page!",
2197 nPageValTop
> nShape1ValTop
);
2198 CPPUNIT_ASSERT_MESSAGE("The whole left textbox is inside the page!",
2199 nPageValLeft
> nShape2ValLeft
);
2200 CPPUNIT_ASSERT_MESSAGE("The whole right textbox is inside the page!",
2201 nPageValRight
< nShape3ValRight
);
2202 CPPUNIT_ASSERT_MESSAGE("The whole bottom textbox is inside the page!",
2203 nPageValBottom
< nShape4ValBottom
);
2206 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineFlysInFlys
)
2209 SwDoc
* pDoc(getSwDoc());
2210 SwWrtShell
* pWrtShell
= getSwDocShell()->GetWrtShell();
2211 SwRootFrame
* pLayout(pWrtShell
->GetLayout());
2212 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2213 pWrtShell
->Insert(u
"foo"_ustr
);
2214 pWrtShell
->SplitNode(false);
2215 pWrtShell
->Insert(u
"bar"_ustr
);
2216 pWrtShell
->SplitNode(false);
2217 pWrtShell
->Insert(u
"baz"_ustr
);
2218 SfxItemSet
flySet(pDoc
->GetAttrPool(),
2219 svl::Items
<RES_FRM_SIZE
, RES_FRM_SIZE
, RES_ANCHOR
, RES_ANCHOR
>);
2220 SwFormatFrameSize
size(SwFrameSize::Minimum
, 1000, 1000);
2221 flySet
.Put(size
); // set a size, else we get 1 char per line...
2222 pWrtShell
->StartOfSection(false);
2223 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
2224 SwFormatAnchor
anchor1(RndStdIds::FLY_AT_CHAR
);
2225 anchor1
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2226 flySet
.Put(anchor1
);
2227 SwFrameFormat
const* pFly1
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
2228 CPPUNIT_ASSERT(pFly1
!= nullptr);
2230 pWrtShell
->GotoFly(pFly1
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2231 pWrtShell
->Insert(u
"abc"_ustr
);
2232 pWrtShell
->SplitNode(false);
2233 pWrtShell
->Insert(u
"def"_ustr
);
2234 pWrtShell
->SplitNode(false);
2235 pWrtShell
->Insert(u
"ghi"_ustr
);
2237 SwFormatAnchor
anchor2(RndStdIds::FLY_AT_CHAR
);
2238 pWrtShell
->StartOfSection(false); // start of fly...
2239 anchor2
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2240 flySet
.Put(anchor2
);
2241 SwFrameFormat
const* pFly2
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
2242 CPPUNIT_ASSERT(pFly2
!= nullptr);
2244 pWrtShell
->GotoFly(pFly2
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2245 pWrtShell
->Insert(u
"jkl"_ustr
);
2246 pWrtShell
->SplitNode(false);
2247 pWrtShell
->Insert(u
"mno"_ustr
);
2248 pWrtShell
->SplitNode(false);
2249 pWrtShell
->Insert(u
"pqr"_ustr
);
2251 dispatchCommand(mxComponent
, u
".uno:TrackChanges"_ustr
, {});
2252 // delete redline inside fly2
2253 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2254 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/true, 8, /*bBasicCall=*/false);
2255 pWrtShell
->Delete();
2257 // delete redline inside fly1
2258 pWrtShell
->GotoFly(pFly1
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2259 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2260 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
2261 pWrtShell
->Delete();
2263 pWrtShell
->ClearMark(); // otherwise it refuses to leave the fly...
2264 pWrtShell
->SttEndDoc(true); // note: SttDoc actually moves to start of fly?
2265 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2266 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
2267 pWrtShell
->Delete();
2269 for (int i
= 0; i
< 2; ++i
)
2271 if (i
== 1) // secondly, try with different anchor type
2273 anchor1
.SetType(RndStdIds::FLY_AT_PARA
);
2274 SwPosition
pos(*anchor1
.GetAnchorNode());
2275 pos
.nContent
.Assign(nullptr, 0);
2276 anchor1
.SetAnchor(&pos
);
2277 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
2278 anchor2
.SetType(RndStdIds::FLY_AT_PARA
);
2279 pos
.nNode
= *anchor2
.GetAnchorNode();
2280 anchor2
.SetAnchor(&pos
);
2281 pDoc
->SetAttr(anchor2
, *const_cast<SwFrameFormat
*>(pFly2
));
2284 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
2285 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
2286 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
2287 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"19");
2288 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
2289 "paraPropsNodeIndex", u
"6");
2292 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/merged",
2293 "paraPropsNodeIndex", u
"11");
2294 assertXPath(pXmlDoc
,
2295 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2296 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2297 "type", u
"PortionType::Para");
2298 assertXPath(pXmlDoc
,
2299 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2300 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2302 assertXPath(pXmlDoc
,
2303 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2306 u
"PortionType::Fly"); // remove???
2307 assertXPath(pXmlDoc
,
2308 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2310 "type", u
"PortionType::Lay");
2311 assertXPath(pXmlDoc
,
2312 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2314 "portion", u
"abhi");
2315 assertXPath(pXmlDoc
,
2316 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2317 u
"PortionType::Para");
2318 assertXPath(pXmlDoc
,
2319 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2320 "portion", u
"foaz");
2322 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
2323 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2324 pXmlDoc
= parseLayoutDump();
2326 // show: nothing is merged
2327 assertXPath(pXmlDoc
, "//merged", 0);
2329 assertXPath(pXmlDoc
,
2330 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2331 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2332 "type", u
"PortionType::Text");
2333 assertXPath(pXmlDoc
,
2334 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2335 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2337 assertXPath(pXmlDoc
,
2338 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2339 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2340 "type", u
"PortionType::Text");
2341 assertXPath(pXmlDoc
,
2342 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2343 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2345 assertXPath(pXmlDoc
,
2346 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[2]/"
2347 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2348 "type", u
"PortionType::Para");
2349 assertXPath(pXmlDoc
,
2350 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[2]/"
2351 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2353 assertXPath(pXmlDoc
,
2354 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
2355 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2356 "type", u
"PortionType::Text");
2357 assertXPath(pXmlDoc
,
2358 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
2359 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2361 assertXPath(pXmlDoc
,
2362 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
2363 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2364 "type", u
"PortionType::Text");
2365 assertXPath(pXmlDoc
,
2366 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
2367 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2369 assertXPath(pXmlDoc
,
2370 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2373 u
"PortionType::Fly"); // remove???
2374 assertXPath(pXmlDoc
,
2375 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2377 "type", u
"PortionType::Text");
2378 assertXPath(pXmlDoc
,
2379 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2382 assertXPath(pXmlDoc
,
2383 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2385 "type", u
"PortionType::Text");
2386 assertXPath(pXmlDoc
,
2387 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2390 assertXPath(pXmlDoc
,
2391 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2393 "type", u
"PortionType::Para");
2394 assertXPath(pXmlDoc
,
2395 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2398 assertXPath(pXmlDoc
,
2399 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2401 "type", u
"PortionType::Text");
2402 assertXPath(pXmlDoc
,
2403 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2406 assertXPath(pXmlDoc
,
2407 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2409 "type", u
"PortionType::Text");
2410 assertXPath(pXmlDoc
,
2411 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2414 assertXPath(pXmlDoc
,
2415 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2416 u
"PortionType::Text");
2417 assertXPath(pXmlDoc
,
2418 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2420 assertXPath(pXmlDoc
,
2421 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2422 u
"PortionType::Text");
2423 assertXPath(pXmlDoc
,
2424 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2426 assertXPath(pXmlDoc
,
2427 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2428 u
"PortionType::Para");
2429 assertXPath(pXmlDoc
,
2430 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2432 assertXPath(pXmlDoc
,
2433 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2434 u
"PortionType::Text");
2435 assertXPath(pXmlDoc
,
2436 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2438 assertXPath(pXmlDoc
,
2439 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2440 u
"PortionType::Text");
2441 assertXPath(pXmlDoc
,
2442 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2446 // anchor to 2nd (deleted) paragraph
2447 // also, switch the in-fly anchoring to the other fly, for additional fun!
2448 pWrtShell
->StartOfSection();
2449 pWrtShell
->Down(false, 1);
2450 anchor2
.SetType(RndStdIds::FLY_AT_CHAR
);
2451 anchor2
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2452 pDoc
->SetAttr(anchor2
, *const_cast<SwFrameFormat
*>(pFly2
));
2453 pWrtShell
->GotoFly(pFly2
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2454 pWrtShell
->Down(false, 1);
2455 anchor1
.SetType(RndStdIds::FLY_AT_CHAR
);
2456 anchor1
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2457 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
2459 for (int i
= 0; i
< 2; ++i
)
2461 if (i
== 1) // secondly, try with different anchor type
2463 anchor1
.SetType(RndStdIds::FLY_AT_PARA
);
2464 SwPosition
pos(*anchor1
.GetAnchorNode());
2465 pos
.nContent
.Assign(nullptr, 0);
2466 anchor1
.SetAnchor(&pos
);
2467 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
2468 anchor2
.SetType(RndStdIds::FLY_AT_PARA
);
2469 pos
.nNode
= *anchor2
.GetAnchorNode();
2470 anchor2
.SetAnchor(&pos
);
2471 pDoc
->SetAttr(anchor2
, *const_cast<SwFrameFormat
*>(pFly2
));
2474 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
2475 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
2476 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
2477 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"19");
2478 assertXPath(pXmlDoc
,
2479 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2480 u
"PortionType::Para");
2481 assertXPath(pXmlDoc
,
2482 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2483 "portion", u
"foaz");
2485 // hide: no anchored object shown
2486 assertXPath(pXmlDoc
, "//anchored", 0);
2488 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
2489 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2490 pXmlDoc
= parseLayoutDump();
2492 // show: nothing is merged
2493 assertXPath(pXmlDoc
, "//merged", 0);
2495 assertXPath(pXmlDoc
,
2496 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2497 u
"PortionType::Text");
2498 assertXPath(pXmlDoc
,
2499 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2501 assertXPath(pXmlDoc
,
2502 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2503 u
"PortionType::Text");
2504 assertXPath(pXmlDoc
,
2505 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2507 assertXPath(pXmlDoc
,
2508 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2510 "type", u
"PortionType::Text");
2511 assertXPath(pXmlDoc
,
2512 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2515 assertXPath(pXmlDoc
,
2516 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2518 "type", u
"PortionType::Text");
2519 assertXPath(pXmlDoc
,
2520 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2523 assertXPath(pXmlDoc
,
2524 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/"
2525 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2526 "type", u
"PortionType::Text");
2527 assertXPath(pXmlDoc
,
2528 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/"
2529 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2531 assertXPath(pXmlDoc
,
2532 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/"
2533 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2534 "type", u
"PortionType::Text");
2535 assertXPath(pXmlDoc
,
2536 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[1]/"
2537 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2539 assertXPath(pXmlDoc
,
2540 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[2]/"
2541 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2542 "type", u
"PortionType::Para");
2543 assertXPath(pXmlDoc
,
2544 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[2]/"
2545 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2547 assertXPath(pXmlDoc
,
2548 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/"
2549 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2550 "type", u
"PortionType::Text");
2551 assertXPath(pXmlDoc
,
2552 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/"
2553 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2555 assertXPath(pXmlDoc
,
2556 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/"
2557 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2558 "type", u
"PortionType::Text");
2559 assertXPath(pXmlDoc
,
2560 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/anchored[1]/fly[1]/txt[3]/"
2561 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2563 assertXPath(pXmlDoc
,
2564 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2567 u
"PortionType::Fly"); // remove???
2568 assertXPath(pXmlDoc
,
2569 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2571 "type", u
"PortionType::Lay");
2572 assertXPath(pXmlDoc
,
2573 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2576 assertXPath(pXmlDoc
,
2577 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2579 "type", u
"PortionType::Text");
2580 assertXPath(pXmlDoc
,
2581 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2584 assertXPath(pXmlDoc
,
2585 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2587 "type", u
"PortionType::Text");
2588 assertXPath(pXmlDoc
,
2589 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2592 assertXPath(pXmlDoc
,
2593 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2594 u
"PortionType::Para");
2595 assertXPath(pXmlDoc
,
2596 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2598 assertXPath(pXmlDoc
,
2599 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2600 u
"PortionType::Text");
2601 assertXPath(pXmlDoc
,
2602 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2604 assertXPath(pXmlDoc
,
2605 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2606 u
"PortionType::Text");
2607 assertXPath(pXmlDoc
,
2608 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2612 // anchor to 3rd paragraph
2613 pWrtShell
->SttEndDoc(false);
2614 anchor1
.SetType(RndStdIds::FLY_AT_CHAR
);
2615 anchor1
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2616 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
2617 pWrtShell
->GotoFly(pFly1
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2618 pWrtShell
->EndOfSection();
2619 anchor2
.SetType(RndStdIds::FLY_AT_CHAR
);
2620 anchor2
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2621 pDoc
->SetAttr(anchor2
, *const_cast<SwFrameFormat
*>(pFly2
));
2623 for (int i
= 0; i
< 2; ++i
)
2625 if (i
== 1) // secondly, try with different anchor type
2627 anchor1
.SetType(RndStdIds::FLY_AT_PARA
);
2628 SwPosition
pos(*anchor1
.GetAnchorNode());
2629 pos
.nContent
.Assign(nullptr, 0);
2630 anchor1
.SetAnchor(&pos
);
2631 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
2632 anchor2
.SetType(RndStdIds::FLY_AT_PARA
);
2633 pos
.nNode
= *anchor2
.GetAnchorNode();
2634 anchor2
.SetAnchor(&pos
);
2635 pDoc
->SetAttr(anchor2
, *const_cast<SwFrameFormat
*>(pFly2
));
2638 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
2639 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
2640 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
2641 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"19");
2642 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
2643 "paraPropsNodeIndex", u
"6");
2646 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/merged",
2647 "paraPropsNodeIndex", u
"11");
2648 assertXPath(pXmlDoc
,
2649 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2650 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2651 "type", u
"PortionType::Para");
2652 assertXPath(pXmlDoc
,
2653 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
2654 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2656 assertXPath(pXmlDoc
,
2657 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2660 u
"PortionType::Fly"); // remove???
2661 assertXPath(pXmlDoc
,
2662 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2664 "type", u
"PortionType::Lay");
2665 assertXPath(pXmlDoc
,
2666 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2668 "portion", u
"abhi");
2669 assertXPath(pXmlDoc
,
2670 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2671 u
"PortionType::Para");
2672 assertXPath(pXmlDoc
,
2673 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2674 "portion", u
"foaz");
2676 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
2677 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2678 pXmlDoc
= parseLayoutDump();
2680 // show: nothing is merged
2681 assertXPath(pXmlDoc
, "//merged", 0);
2683 assertXPath(pXmlDoc
,
2684 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2685 u
"PortionType::Text");
2686 assertXPath(pXmlDoc
,
2687 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2689 assertXPath(pXmlDoc
,
2690 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2691 u
"PortionType::Text");
2692 assertXPath(pXmlDoc
,
2693 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2695 assertXPath(pXmlDoc
,
2696 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
2697 u
"PortionType::Para");
2698 assertXPath(pXmlDoc
,
2699 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2701 assertXPath(pXmlDoc
,
2702 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2704 "type", u
"PortionType::Text");
2705 assertXPath(pXmlDoc
,
2706 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2709 assertXPath(pXmlDoc
,
2710 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2712 "type", u
"PortionType::Text");
2713 assertXPath(pXmlDoc
,
2714 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2717 assertXPath(pXmlDoc
,
2718 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2720 "type", u
"PortionType::Para");
2721 assertXPath(pXmlDoc
,
2722 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2725 assertXPath(pXmlDoc
,
2726 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/"
2727 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2728 "type", u
"PortionType::Text");
2729 assertXPath(pXmlDoc
,
2730 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/"
2731 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2733 assertXPath(pXmlDoc
,
2734 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/"
2735 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2736 "type", u
"PortionType::Text");
2737 assertXPath(pXmlDoc
,
2738 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[1]/"
2739 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2741 assertXPath(pXmlDoc
,
2742 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[2]/"
2743 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2744 "type", u
"PortionType::Para");
2745 assertXPath(pXmlDoc
,
2746 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[2]/"
2747 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
2749 assertXPath(pXmlDoc
,
2750 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/"
2751 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2752 "type", u
"PortionType::Text");
2753 assertXPath(pXmlDoc
,
2754 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/"
2755 "SwParaPortion/SwLineLayout/SwLinePortion[1]",
2757 assertXPath(pXmlDoc
,
2758 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/"
2759 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2760 "type", u
"PortionType::Text");
2761 assertXPath(pXmlDoc
,
2762 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/anchored[1]/fly[1]/txt[3]/"
2763 "SwParaPortion/SwLineLayout/SwLinePortion[2]",
2765 assertXPath(pXmlDoc
,
2766 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2768 "type", u
"PortionType::Text");
2769 assertXPath(pXmlDoc
,
2770 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2773 u
"PortionType::Fly"); // remove???
2774 assertXPath(pXmlDoc
,
2775 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2778 assertXPath(pXmlDoc
,
2779 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2781 "type", u
"PortionType::Text");
2782 assertXPath(pXmlDoc
,
2783 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2786 assertXPath(pXmlDoc
,
2787 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
2788 u
"PortionType::Text");
2789 assertXPath(pXmlDoc
,
2790 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2792 assertXPath(pXmlDoc
,
2793 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
2794 u
"PortionType::Text");
2795 assertXPath(pXmlDoc
,
2796 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2801 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineFlysAtFlys
)
2804 SwDoc
* pDoc(getSwDoc());
2805 SwWrtShell
* pWrtShell
= getSwDocShell()->GetWrtShell();
2806 SwRootFrame
* pLayout(pWrtShell
->GetLayout());
2807 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2808 pWrtShell
->Insert(u
"foo"_ustr
);
2809 pWrtShell
->SplitNode(false);
2810 pWrtShell
->Insert(u
"bar"_ustr
);
2811 pWrtShell
->SplitNode(false);
2812 pWrtShell
->Insert(u
"baz"_ustr
);
2813 SfxItemSet
flySet(pDoc
->GetAttrPool(),
2814 svl::Items
<RES_FRM_SIZE
, RES_FRM_SIZE
, RES_ANCHOR
, RES_ANCHOR
>);
2815 SwFormatFrameSize
size(SwFrameSize::Minimum
, 1000, 1000);
2816 flySet
.Put(size
); // set a size, else we get 1 char per line...
2817 pWrtShell
->StartOfSection(false);
2818 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 1, /*bBasicCall=*/false);
2819 SwFormatAnchor
anchor1(RndStdIds::FLY_AT_CHAR
);
2820 anchor1
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
2821 flySet
.Put(anchor1
);
2822 SwFrameFormat
const* pFly1
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
2823 CPPUNIT_ASSERT(pFly1
!= nullptr);
2825 pWrtShell
->GotoFly(pFly1
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2826 pWrtShell
->Insert(u
"abc"_ustr
);
2827 pWrtShell
->SplitNode(false);
2828 pWrtShell
->Insert(u
"def"_ustr
);
2829 pWrtShell
->SplitNode(false);
2830 pWrtShell
->Insert(u
"ghi"_ustr
);
2832 SwFormatAnchor
anchor2(RndStdIds::FLY_AT_FLY
);
2833 SwPosition
pos(*pFly1
->GetContent().GetContentIdx());
2834 anchor2
.SetAnchor(&pos
);
2835 flySet
.Put(anchor2
);
2836 SwFrameFormat
const* pFly2
= pWrtShell
->NewFlyFrame(flySet
, /*bAnchValid=*/true);
2837 CPPUNIT_ASSERT(pFly2
!= nullptr);
2839 pWrtShell
->GotoFly(pFly2
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2840 pWrtShell
->Insert(u
"jkl"_ustr
);
2841 pWrtShell
->SplitNode(false);
2842 pWrtShell
->Insert(u
"mno"_ustr
);
2843 pWrtShell
->SplitNode(false);
2844 pWrtShell
->Insert(u
"pqr"_ustr
);
2846 dispatchCommand(mxComponent
, u
".uno:TrackChanges"_ustr
, {});
2847 // delete redline inside fly2
2848 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2849 pWrtShell
->Left(SwCursorSkipMode::Chars
, /*bSelect=*/true, 8, /*bBasicCall=*/false);
2850 pWrtShell
->Delete();
2852 // delete redline inside fly1
2853 pWrtShell
->GotoFly(pFly1
->GetName(), FLYCNTTYPE_FRM
, /*bSelFrame=*/false);
2854 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2855 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
2856 pWrtShell
->Delete();
2858 pWrtShell
->ClearMark(); // otherwise it refuses to leave the fly...
2859 pWrtShell
->SttEndDoc(true); // note: SttDoc actually moves to start of fly?
2860 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/false, 2, /*bBasicCall=*/false);
2861 pWrtShell
->Right(SwCursorSkipMode::Chars
, /*bSelect=*/true, 7, /*bBasicCall=*/false);
2862 pWrtShell
->Delete();
2864 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
2865 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
2866 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
2867 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"19");
2868 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
2869 "paraPropsNodeIndex", u
"6");
2870 assertXPath(pXmlDoc
,
2871 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/merged",
2872 "paraPropsNodeIndex", u
"11");
2873 assertXPath(pXmlDoc
,
2874 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2875 "SwLineLayout/SwParaPortion[1]",
2876 "type", u
"PortionType::Para");
2877 assertXPath(pXmlDoc
,
2878 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2879 "SwLineLayout/SwParaPortion[1]",
2881 assertXPath(pXmlDoc
,
2882 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2885 u
"PortionType::Fly"); // remove???
2886 assertXPath(pXmlDoc
,
2887 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2889 "type", u
"PortionType::Lay");
2890 assertXPath(pXmlDoc
,
2891 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2893 "portion", u
"abhi");
2894 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2895 "type", u
"PortionType::Para");
2896 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
2897 "portion", u
"foaz");
2899 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
2900 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
2901 pXmlDoc
= parseLayoutDump();
2903 // show: nothing is merged
2904 assertXPath(pXmlDoc
, "//merged", 0);
2906 assertXPath(pXmlDoc
,
2907 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2908 "SwLineLayout/SwLinePortion[1]",
2909 "type", u
"PortionType::Text");
2910 assertXPath(pXmlDoc
,
2911 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2912 "SwLineLayout/SwLinePortion[1]",
2914 assertXPath(pXmlDoc
,
2915 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2916 "SwLineLayout/SwLinePortion[2]",
2917 "type", u
"PortionType::Text");
2918 assertXPath(pXmlDoc
,
2919 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
2920 "SwLineLayout/SwLinePortion[2]",
2922 assertXPath(pXmlDoc
,
2923 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/SwParaPortion/"
2924 "SwLineLayout/SwParaPortion[1]",
2925 "type", u
"PortionType::Para");
2926 assertXPath(pXmlDoc
,
2927 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/SwParaPortion/"
2928 "SwLineLayout/SwParaPortion[1]",
2930 assertXPath(pXmlDoc
,
2931 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
2932 "SwLineLayout/SwLinePortion[1]",
2933 "type", u
"PortionType::Text");
2934 assertXPath(pXmlDoc
,
2935 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
2936 "SwLineLayout/SwLinePortion[1]",
2938 assertXPath(pXmlDoc
,
2939 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
2940 "SwLineLayout/SwLinePortion[2]",
2941 "type", u
"PortionType::Text");
2942 assertXPath(pXmlDoc
,
2943 "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
2944 "SwLineLayout/SwLinePortion[2]",
2946 assertXPath(pXmlDoc
,
2947 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2950 u
"PortionType::Fly"); // remove???
2951 assertXPath(pXmlDoc
,
2952 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2954 "type", u
"PortionType::Text");
2955 assertXPath(pXmlDoc
,
2956 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2959 assertXPath(pXmlDoc
,
2960 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2962 "type", u
"PortionType::Text");
2963 assertXPath(pXmlDoc
,
2964 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2967 assertXPath(pXmlDoc
,
2968 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2970 "type", u
"PortionType::Para");
2971 assertXPath(pXmlDoc
,
2972 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2975 assertXPath(pXmlDoc
,
2976 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2978 "type", u
"PortionType::Text");
2979 assertXPath(pXmlDoc
,
2980 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2983 assertXPath(pXmlDoc
,
2984 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2986 "type", u
"PortionType::Text");
2987 assertXPath(pXmlDoc
,
2988 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2991 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2992 "type", u
"PortionType::Text");
2993 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
2995 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2996 "type", u
"PortionType::Text");
2997 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
2999 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3000 "type", u
"PortionType::Para");
3001 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3003 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3004 "type", u
"PortionType::Text");
3005 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3007 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3008 "type", u
"PortionType::Text");
3009 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3012 // anchor to 2nd (deleted) paragraph
3013 pWrtShell
->StartOfSection();
3014 pWrtShell
->Down(false, 1);
3015 anchor1
.SetType(RndStdIds::FLY_AT_CHAR
);
3016 anchor1
.SetAnchor(pWrtShell
->GetCursor()->GetPoint());
3017 pDoc
->SetAttr(anchor1
, *const_cast<SwFrameFormat
*>(pFly1
));
3019 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
3020 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3021 pXmlDoc
= parseLayoutDump();
3022 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"19");
3023 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3024 "type", u
"PortionType::Para");
3025 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3026 "portion", u
"foaz");
3028 // hide: no anchored object shown
3029 assertXPath(pXmlDoc
, "//anchored", 0);
3031 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
3032 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3033 pXmlDoc
= parseLayoutDump();
3035 // show: nothing is merged
3036 assertXPath(pXmlDoc
, "//merged", 0);
3038 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3039 "type", u
"PortionType::Text");
3040 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3042 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3043 "type", u
"PortionType::Text");
3044 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3046 assertXPath(pXmlDoc
,
3047 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
3048 "SwLineLayout/SwLinePortion[1]",
3049 "type", u
"PortionType::Text");
3050 assertXPath(pXmlDoc
,
3051 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
3052 "SwLineLayout/SwLinePortion[1]",
3054 assertXPath(pXmlDoc
,
3055 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
3056 "SwLineLayout/SwLinePortion[2]",
3057 "type", u
"PortionType::Text");
3058 assertXPath(pXmlDoc
,
3059 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/"
3060 "SwLineLayout/SwLinePortion[2]",
3062 assertXPath(pXmlDoc
,
3063 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/SwParaPortion/"
3064 "SwLineLayout/SwParaPortion[1]",
3065 "type", u
"PortionType::Para");
3066 assertXPath(pXmlDoc
,
3067 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[2]/SwParaPortion/"
3068 "SwLineLayout/SwParaPortion[1]",
3070 assertXPath(pXmlDoc
,
3071 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
3072 "SwLineLayout/SwLinePortion[1]",
3073 "type", u
"PortionType::Text");
3074 assertXPath(pXmlDoc
,
3075 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
3076 "SwLineLayout/SwLinePortion[1]",
3078 assertXPath(pXmlDoc
,
3079 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
3080 "SwLineLayout/SwLinePortion[2]",
3081 "type", u
"PortionType::Text");
3082 assertXPath(pXmlDoc
,
3083 "/root/page[1]/body/txt[2]/anchored/fly[1]/anchored[1]/fly[1]/txt[3]/SwParaPortion/"
3084 "SwLineLayout/SwLinePortion[2]",
3086 assertXPath(pXmlDoc
,
3087 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3089 "type", u
"PortionType::Text");
3090 assertXPath(pXmlDoc
,
3091 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3094 u
"PortionType::Fly"); // remove???
3095 assertXPath(pXmlDoc
,
3096 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3099 assertXPath(pXmlDoc
,
3100 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3102 "type", u
"PortionType::Text");
3103 assertXPath(pXmlDoc
,
3104 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3107 assertXPath(pXmlDoc
,
3108 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
3110 "type", u
"PortionType::Para");
3111 assertXPath(pXmlDoc
,
3112 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
3115 assertXPath(pXmlDoc
,
3116 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3118 "type", u
"PortionType::Text");
3119 assertXPath(pXmlDoc
,
3120 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3123 assertXPath(pXmlDoc
,
3124 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3126 "type", u
"PortionType::Text");
3127 assertXPath(pXmlDoc
,
3128 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3131 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3132 "type", u
"PortionType::Para");
3133 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3135 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3136 "type", u
"PortionType::Text");
3137 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3139 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3140 "type", u
"PortionType::Text");
3141 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3145 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineSections
)
3147 createSwDoc("redline_sections.fodt");
3148 SwDoc
* pDoc(getSwDoc());
3149 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
3150 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3152 // verify after load
3153 CheckRedlineSectionsHidden();
3155 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
3156 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3157 // why is this needed explicitly?
3159 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3161 // show: nothing is merged
3162 assertXPath(pXmlDoc
, "//merged", 0);
3163 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[1]", "type",
3164 u
"PortionType::Text");
3165 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[1]",
3167 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[2]", "type",
3168 u
"PortionType::Text");
3169 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[2]",
3172 assertXPath(pXmlDoc
,
3173 "/root/page[1]/body/section[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
3174 "SwLineLayout/child::*[1]",
3175 "type", u
"PortionType::Para");
3176 assertXPath(pXmlDoc
,
3177 "/root/page[1]/body/section[1]/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/"
3178 "SwLineLayout/child::*[1]",
3179 "portion", u
"FRAME");
3180 assertXPath(pXmlDoc
,
3181 "/root/page[1]/body/section[1]/txt[1]/SwParaPortion/SwLineLayout/child::*[1]",
3182 "type", u
"PortionType::Para");
3183 assertXPath(pXmlDoc
,
3184 "/root/page[1]/body/section[1]/txt[1]/SwParaPortion/SwLineLayout/child::*[1]",
3186 assertXPath(pXmlDoc
,
3187 "/root/page[1]/body/section[1]/txt[2]/SwParaPortion/SwLineLayout/child::*[1]",
3188 "type", u
"PortionType::Para");
3189 assertXPath(pXmlDoc
,
3190 "/root/page[1]/body/section[1]/txt[2]/SwParaPortion/SwLineLayout/child::*[1]",
3192 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/child::*[1]", "type",
3193 u
"PortionType::Text");
3194 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/child::*[1]",
3196 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/child::*[2]", "type",
3197 u
"PortionType::Text");
3198 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/child::*[2]",
3200 assertXPath(pXmlDoc
,
3201 "/root/page[1]/body/section[2]/txt[1]/SwParaPortion/SwLineLayout/child::*[1]",
3202 "type", u
"PortionType::Text");
3203 assertXPath(pXmlDoc
,
3204 "/root/page[1]/body/section[2]/txt[1]/SwParaPortion/SwLineLayout/child::*[1]",
3206 assertXPath(pXmlDoc
,
3207 "/root/page[1]/body/section[2]/txt[1]/SwParaPortion/SwLineLayout/child::*[2]",
3208 "type", u
"PortionType::Text");
3209 assertXPath(pXmlDoc
,
3210 "/root/page[1]/body/section[2]/txt[1]/SwParaPortion/SwLineLayout/child::*[2]",
3212 assertXPath(pXmlDoc
,
3213 "/root/page[1]/body/section[2]/txt[2]/SwParaPortion/SwLineLayout/child::*[1]",
3214 "type", u
"PortionType::Para");
3215 assertXPath(pXmlDoc
,
3216 "/root/page[1]/body/section[2]/txt[2]/SwParaPortion/SwLineLayout/child::*[1]",
3218 assertXPath(pXmlDoc
,
3219 "/root/page[1]/body/section[2]/txt[3]/SwParaPortion/SwLineLayout/child::*[1]",
3220 "type", u
"PortionType::Text");
3221 assertXPath(pXmlDoc
,
3222 "/root/page[1]/body/section[2]/txt[3]/SwParaPortion/SwLineLayout/child::*[1]",
3224 assertXPath(pXmlDoc
,
3225 "/root/page[1]/body/section[2]/txt[3]/SwParaPortion/SwLineLayout/child::*[2]",
3226 "type", u
"PortionType::Text");
3227 assertXPath(pXmlDoc
,
3228 "/root/page[1]/body/section[2]/txt[3]/SwParaPortion/SwLineLayout/child::*[2]",
3231 // verify after hide
3232 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
3233 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3234 // why is this needed explicitly?
3236 CheckRedlineSectionsHidden();
3239 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TDF69647_images
)
3241 createSwDoc("tdf69647_images.odt");
3242 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of pages does not match!", 2, getPages());
3245 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, TDF69647_text
)
3247 createSwDoc("tdf69647_text.docx");
3248 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of pages does not match!", 2, getPages());
3251 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testRedlineTables
)
3253 createSwDoc("redline_table.fodt");
3254 SwDoc
* pDoc(getSwDoc());
3255 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
3256 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3258 // verify after load
3259 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3260 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"12");
3261 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3262 "type", u
"PortionType::Para");
3263 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3264 "portion", u
"foar");
3266 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
3267 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3268 // why is this needed explicitly?
3270 pXmlDoc
= parseLayoutDump();
3272 // show: nothing is merged
3273 assertXPath(pXmlDoc
, "//merged", 0);
3274 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3275 "type", u
"PortionType::Text");
3276 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3278 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3279 "type", u
"PortionType::Text");
3280 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3283 assertXPath(pXmlDoc
,
3284 "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/anchored/fly[1]/txt[1]/"
3285 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
3286 "type", u
"PortionType::Para");
3287 assertXPath(pXmlDoc
,
3288 "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/anchored/fly[1]/txt[1]/"
3289 "SwParaPortion/SwLineLayout/SwParaPortion[1]",
3290 "portion", u
"FRAME");
3291 assertXPath(pXmlDoc
,
3292 "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/SwParaPortion/SwLineLayout/"
3294 "type", u
"PortionType::Para");
3295 assertXPath(pXmlDoc
,
3296 "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/SwParaPortion/SwLineLayout/"
3299 assertXPath(pXmlDoc
,
3300 "/root/page[1]/body/tab[1]/row[2]/cell[2]/txt[1]/SwParaPortion/SwLineLayout/"
3302 "type", u
"PortionType::Para");
3303 assertXPath(pXmlDoc
,
3304 "/root/page[1]/body/tab[1]/row[2]/cell[2]/txt[1]/SwParaPortion/SwLineLayout/"
3307 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3308 "type", u
"PortionType::Text");
3309 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
3311 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3312 "type", u
"PortionType::Text");
3313 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
3316 // verify after hide
3317 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
3318 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3319 // why is this needed explicitly?
3321 pXmlDoc
= parseLayoutDump();
3322 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", u
"12");
3323 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3324 "type", u
"PortionType::Para");
3325 assertXPath(pXmlDoc
, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
3326 "portion", u
"foar");
3329 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf144057
)
3331 createSwDoc("tdf144057.fodt");
3332 SwDoc
* pDoc(getSwDoc());
3333 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
3334 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3335 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3336 // show tracked row deletions
3337 assertXPath(pXmlDoc
, "/root/page", 4);
3338 assertXPath(pXmlDoc
,
3339 "/root/page[1]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3341 assertXPath(pXmlDoc
,
3342 "/root/page[2]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3344 assertXPath(pXmlDoc
,
3345 "/root/page[3]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3347 assertXPath(pXmlDoc
,
3348 "/root/page[4]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3351 // hide tracked table and table row deletions
3352 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
3353 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3355 pXmlDoc
= parseLayoutDump();
3357 // This was 4 (unhidden tracked table and table row deletions)
3358 assertXPath(pXmlDoc
, "/root/page", 1);
3359 assertXPath(pXmlDoc
, "/root/page[1]/body/tab", 1);
3360 assertXPath(pXmlDoc
, "/root/page[1]/body/tab/row", 5);
3361 assertXPath(pXmlDoc
,
3362 "/root/page[1]/body/tab/row[5]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3365 // show tracked table and table row deletions again
3366 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
3367 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3369 pXmlDoc
= parseLayoutDump();
3370 assertXPath(pXmlDoc
, "/root/page", 4);
3371 assertXPath(pXmlDoc
,
3372 "/root/page[1]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3374 assertXPath(pXmlDoc
,
3375 "/root/page[2]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3377 assertXPath(pXmlDoc
,
3378 "/root/page[3]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3380 assertXPath(pXmlDoc
,
3381 "/root/page[4]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3385 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf144347
)
3387 createSwDoc("tdf144057.fodt");
3388 SwDoc
* pDoc(getSwDoc());
3389 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
3392 dispatchCommand(mxComponent
, u
".uno:TrackChanges"_ustr
, {});
3393 CPPUNIT_ASSERT_MESSAGE("redlining should be on",
3394 pDoc
->getIDocumentRedlineAccess().IsRedlineOn());
3395 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3397 // remove first table
3398 SwEditShell
* const pEditShell(pDoc
->GetEditShell());
3399 CPPUNIT_ASSERT(pEditShell
);
3400 for (int i
= 0; i
< 12; ++i
)
3401 pEditShell
->AcceptRedline(0);
3404 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3405 // show tracked row deletions
3406 assertXPath(pXmlDoc
, "/root/page", 2);
3407 assertXPath(pXmlDoc
, "/root/page[1]/body/tab", 1);
3409 // select all the text, including the texts before and after the table
3410 // Note: this table contains tracked changes, which was a
3411 // problem for the original OOo implementation of track changes,
3412 // resulting empty tables after accepting the deletion of these tables.
3413 dispatchCommand(mxComponent
, u
".uno:SelectAll"_ustr
, {});
3414 dispatchCommand(mxComponent
, u
".uno:SelectAll"_ustr
, {});
3415 dispatchCommand(mxComponent
, u
".uno:Delete"_ustr
, {});
3417 pXmlDoc
= parseLayoutDump();
3419 // table is deleted with change tracking: it still exists
3420 assertXPath(pXmlDoc
, "/root/page", 2);
3421 assertXPath(pXmlDoc
, "/root/page[1]/body/tab", 1);
3423 // accept all deletions, removing the table completely
3424 while (pEditShell
->GetRedlineCount() > 0)
3425 pEditShell
->AcceptRedline(0);
3428 pXmlDoc
= parseLayoutDump();
3430 assertXPath(pXmlDoc
, "/root/page", 1);
3431 // This was 1 (bad empty table)
3432 assertXPath(pXmlDoc
, "/root/page[1]/body/tab", 0);
3435 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf155345
)
3437 createSwDoc("tdf144057.fodt");
3438 SwDoc
* pDoc(getSwDoc());
3439 SwRootFrame
* pLayout(pDoc
->getIDocumentLayoutAccess().GetCurrentLayout());
3440 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3442 // reject all deletions
3443 dispatchCommand(mxComponent
, u
".uno:RejectAllTrackedChanges"_ustr
, {});
3446 dispatchCommand(mxComponent
, u
".uno:TrackChanges"_ustr
, {});
3447 CPPUNIT_ASSERT_MESSAGE("redlining should be on",
3448 pDoc
->getIDocumentRedlineAccess().IsRedlineOn());
3450 // delete table column with track changes
3451 dispatchCommand(mxComponent
, u
".uno:DeleteColumns"_ustr
, {});
3453 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3454 // show tracked column deletions
3455 assertXPath(pXmlDoc
, "/root/page", 4);
3457 // hide tracked table column deletions
3458 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
3459 CPPUNIT_ASSERT(pLayout
->IsHideRedlines());
3461 pXmlDoc
= parseLayoutDump();
3463 // This was 4 (unhidden tracked table column deletions)
3464 assertXPath(pXmlDoc
, "/root/page", 2);
3466 // show tracked table column deletions again
3467 dispatchCommand(mxComponent
, u
".uno:ShowTrackedChanges"_ustr
, {});
3468 CPPUNIT_ASSERT(!pLayout
->IsHideRedlines());
3470 pXmlDoc
= parseLayoutDump();
3471 assertXPath(pXmlDoc
, "/root/page", 4);
3474 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf109137
)
3476 createSwDoc("tdf109137.docx");
3477 // FIXME: Error: attribute "text:start-value" has a bad value
3479 saveAndReload(u
"writer8"_ustr
);
3480 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3481 // This was 0, the blue rectangle moved from the 1st to the 2nd page.
3482 assertXPath(pXmlDoc
, "/root/page[1]/body/txt/anchored/fly/notxt",
3483 /*nNumberOfNodes=*/1);
3486 //just care it doesn't crash/assert
3487 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint72
) { createSwDoc("forcepoint72-1.rtf"); }
3489 //just care it doesn't crash/assert
3490 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint75
) { createSwDoc("forcepoint75-1.rtf"); }
3492 //just care it doesn't crash/assert
3493 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testUXTSOREL
) { createSwDoc("LIBREOFFICE-UXTSOREL.rtf"); }
3495 //just care it doesn't crash/assert
3496 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepointFootnoteFrame
)
3498 createSwDoc("forcepoint-swfootnoteframe-1.rtf");
3501 //just care it doesn't crash/assert
3502 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint76
) { createSwDoc("forcepoint76-1.rtf"); }
3504 //just care it doesn't crash/assert
3505 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testN4LA0OHZ
) { createSwDoc("LIBREOFFICE-N4LA0OHZ.rtf"); }
3507 //just care it doesn't crash/assert
3508 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint89
) { createSwWebDoc("forcepoint89.html"); }
3510 //just care it doesn't crash/assert
3511 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint90
) { createSwDoc("forcepoint90.rtf"); }
3513 //just care it doesn't crash/assert
3514 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint91
) { createSwWebDoc("forcepoint91.html"); }
3516 //just care it doesn't crash/assert
3517 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint92
) { createSwDoc("forcepoint92.doc"); }
3519 //just care it doesn't crash/assert
3520 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint93
)
3522 createSwDoc("forcepoint93-1.rtf");
3523 createSwDoc("forcepoint93-2.rtf");
3526 //just care it doesn't crash/assert
3527 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint94
) { createSwWebDoc("forcepoint94.html"); }
3529 //just care it doesn't crash/assert
3530 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint98
) { createSwWebDoc("forcepoint98.html"); }
3532 //just care it doesn't crash/assert
3533 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint100
) { createSwWebDoc("forcepoint100.html"); }
3535 //just care it doesn't crash/assert
3536 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint102
) { createSwDoc("forcepoint102.rtf"); }
3538 //just care it doesn't crash/assert
3539 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint103
) { createSwWebDoc("forcepoint103.html"); }
3541 //just care it doesn't crash/assert
3542 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf147485Forcepoint
)
3544 createSwDoc("tdf147485-forcepoint.docx");
3547 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf118058
)
3549 createSwDoc("tdf118058.fodt");
3550 // This resulted in a layout loop.
3554 //just care it doesn't crash/assert
3555 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testForcepoint99
) { createSwWebDoc("forcepoint99.html"); }
3557 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf128611
)
3559 createSwDoc("tdf128611.fodt");
3560 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3561 CPPUNIT_ASSERT(pXmlDoc
);
3562 // Without the accompanying fix in place, this test would have failed with:
3565 // i.e. there were multiple portions in the first paragraph of the A1 cell, which means that the
3566 // rotated text was broken into multiple lines without a good reason.
3567 assertXPathContent(pXmlDoc
, "//tab/row/cell[1]/txt", u
"Abcd efghijkl");
3570 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf159101
)
3572 createSwDoc("tdf159101.odt");
3574 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3575 CPPUNIT_ASSERT(pXmlDoc
);
3577 assertXPath(pXmlDoc
, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[1]/SwFieldPortion",
3580 // Without the fix in place, this test would have failed with
3583 assertXPath(pXmlDoc
, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[2]/SwFieldPortion",
3587 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf157628
)
3589 createSwDoc("tdf157628.docx");
3591 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3592 CPPUNIT_ASSERT(pXmlDoc
);
3594 assertXPath(pXmlDoc
, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[1]/SwLinePortion",
3595 "portion", u
"This is in first row");
3596 assertXPath(pXmlDoc
, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[2]/SwLinePortion",
3597 "portion", u
"This is second row*");
3600 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf142694
)
3602 createSwDoc("tdf142694-1.odt");
3604 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3605 CPPUNIT_ASSERT(pXmlDoc
);
3607 // the problem with this table is that the 3rd text frame (inside a nested
3608 // table) contains an as-char fly that doesn't fit on a page with the
3609 // repeated header row; currently it's split so that the 3rd text frame is
3610 // on a page of its own and extends outside the table.
3612 assertXPathNoAttribute(pXmlDoc
, "/root/page[4]/body/tab[1]", "precede");
3613 CPPUNIT_ASSERT(!getXPath(pXmlDoc
, "/root/page[4]/body/tab[1]", "follow").isEmpty());
3614 assertXPath(pXmlDoc
, "/root/page[4]/body/tab[1]/row[1]/cell[1]/tab", 1);
3615 assertXPath(pXmlDoc
, "/root/page[4]/body/tab[1]/row[2]/cell[1]/txt", 2);
3616 CPPUNIT_ASSERT(!getXPath(pXmlDoc
, "/root/page[5]/body/tab[1]", "precede").isEmpty());
3617 assertXPathNoAttribute(pXmlDoc
, "/root/page[5]/body/tab[1]", "follow");
3618 assertXPath(pXmlDoc
, "/root/page[5]/body/tab[1]/row[1]/cell[1]/tab", 1);
3619 assertXPath(pXmlDoc
, "/root/page[5]/body/tab[1]/row[2]/cell[1]/tab", 1);
3620 assertXPathNoAttribute(pXmlDoc
, "/root/page[5]/body/tab[1]/row[2]/cell[1]/tab", "follow");
3621 assertXPath(pXmlDoc
, "/root/page[5]/body/tab[1]/row[2]/cell[1]/tab/row/cell/txt", 1);
3624 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf152413
)
3626 createSwDoc("tdf152413.fodt");
3627 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3629 // Without the fix in place, this test would have failed with
3632 // - In <>, XPath '/root/page/body/txt/SwParaPortion/SwLineLayout/SwLinePortion' number of nodes is incorrect
3633 assertXPath(pXmlDoc
, "/root/page/body/txt/SwParaPortion/SwLineLayout/SwLinePortion", "portion",
3637 CPPUNIT_TEST_FIXTURE(SwLayoutWriter
, testTdf125893
)
3639 createSwDoc("tdf125893.docx");
3640 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
3641 // This was 400. The paragraph must have zero top border.
3642 assertXPath(pXmlDoc
, "/root/page/body/txt[4]/infos/prtBounds", "top", u
"0");
3645 CPPUNIT_PLUGIN_IMPLEMENT();
3647 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */