tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sw / qa / extras / layout / layout.cxx
blobf54d38504b36e62578cefd1c325443be11092834
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
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>
18 #include <wrtsh.hxx>
19 #include <unotxdoc.hxx>
20 #include <rootfrm.hxx>
21 #include <IDocumentLayoutAccess.hxx>
22 #include <IDocumentRedlineAccess.hxx>
23 #include <unoframe.hxx>
24 #include <fldmgr.hxx>
26 /// Test to assert layout / rendering result of Writer.
27 class SwLayoutWriter : public SwModelTestBase
29 public:
30 SwLayoutWriter()
31 : SwModelTestBase(u"/sw/qa/extras/layout/data/"_ustr)
35 protected:
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]",
48 "expand", u"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]",
52 "portion", u"foaz");
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]",
56 "expand", u"2");
57 assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn[1]/txt[1]/merged", "paraPropsNodeIndex", u"13");
58 assertXPath(pXmlDoc,
59 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
60 "type", u"PortionType::FootnoteNum");
61 assertXPath(pXmlDoc,
62 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
63 "expand", u"1");
64 assertXPath(pXmlDoc,
65 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
66 "type", u"PortionType::Text");
67 assertXPath(pXmlDoc,
68 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
69 "portion", u"ac");
70 assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn[2]/txt[1]/merged", "paraPropsNodeIndex", u"16");
71 assertXPath(pXmlDoc,
72 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
73 "type", u"PortionType::FootnoteNum");
74 assertXPath(pXmlDoc,
75 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
76 "expand", u"2");
77 assertXPath(pXmlDoc,
78 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
79 "type", u"PortionType::Text");
80 assertXPath(pXmlDoc,
81 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
82 "portion", u"mo");
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]",
92 "portion", u"folah");
93 assertXPath(pXmlDoc, "/root/page[1]/body/section[1]/txt[1]/merged", "paraPropsNodeIndex",
94 u"20");
95 assertXPath(pXmlDoc,
96 "/root/page[1]/body/section[1]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
97 "type", u"PortionType::Para");
98 assertXPath(pXmlDoc,
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());
122 // verify after load
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]",
135 "expand", u"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]",
139 "portion", u"fo");
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]",
143 "portion", u"o");
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]",
147 "expand", u"2");
149 assertXPath(pXmlDoc,
150 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
151 "type", u"PortionType::FootnoteNum");
152 assertXPath(pXmlDoc,
153 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
154 "expand", u"1");
155 assertXPath(pXmlDoc,
156 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
157 "type", u"PortionType::Text");
158 assertXPath(pXmlDoc,
159 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
160 "portion", u"a");
161 assertXPath(pXmlDoc,
162 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
163 "type", u"PortionType::Text");
164 assertXPath(pXmlDoc,
165 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
166 "portion", u"b");
167 assertXPath(pXmlDoc,
168 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
169 "type", u"PortionType::Text");
170 assertXPath(pXmlDoc,
171 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
172 "portion", u"c");
173 assertXPath(pXmlDoc,
174 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
175 "type", u"PortionType::FootnoteNum");
176 assertXPath(pXmlDoc,
177 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
178 "expand", u"2");
179 assertXPath(pXmlDoc,
180 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
181 "type", u"PortionType::Text");
182 assertXPath(pXmlDoc,
183 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
184 "portion", u"def");
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]",
188 "portion", u"b");
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]",
192 "expand", u"3");
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]",
196 "portion", u"ar");
197 assertXPath(pXmlDoc,
198 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
199 "type", u"PortionType::FootnoteNum");
200 assertXPath(pXmlDoc,
201 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
202 "expand", u"3");
203 assertXPath(pXmlDoc,
204 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
205 "type", u"PortionType::Text");
206 assertXPath(pXmlDoc,
207 "/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
208 "portion", u"ghi");
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]",
212 "expand", u"4");
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]",
216 "portion", u"b");
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]",
220 "portion", u"az");
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]",
224 "expand", u"5");
226 assertXPath(pXmlDoc,
227 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
228 "type", u"PortionType::FootnoteNum");
229 assertXPath(pXmlDoc,
230 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
231 "expand", u"4");
232 assertXPath(pXmlDoc,
233 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
234 "type", u"PortionType::Text");
235 assertXPath(pXmlDoc,
236 "/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
237 "portion", u"jkl");
238 assertXPath(pXmlDoc,
239 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
240 "type", u"PortionType::FootnoteNum");
241 assertXPath(pXmlDoc,
242 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
243 "expand", u"5");
244 assertXPath(pXmlDoc,
245 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
246 "type", u"PortionType::Text");
247 assertXPath(pXmlDoc,
248 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
249 "portion", u"m");
250 assertXPath(pXmlDoc,
251 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
252 "type", u"PortionType::Text");
253 assertXPath(pXmlDoc,
254 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
255 "portion", u"n");
256 assertXPath(pXmlDoc,
257 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
258 "type", u"PortionType::Text");
259 assertXPath(pXmlDoc,
260 "/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]",
261 "portion", u"o");
263 // verify after hide
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)
282 createSwDoc();
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());
298 flySet.Put(anchor);
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);
303 // move inside fly
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);
315 pWrtShell->Delete();
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);
320 pWrtShell->Delete();
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");
337 assertXPath(pXmlDoc,
338 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
339 u"PortionType::Para");
340 assertXPath(pXmlDoc,
341 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
342 "portion", u"foaz");
343 assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
344 "paraPropsNodeIndex", u"6");
345 assertXPath(pXmlDoc,
346 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
347 "SwParaPortion[1]",
348 "type", u"PortionType::Para");
349 assertXPath(pXmlDoc,
350 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
351 "SwParaPortion[1]",
352 "portion", u"ahi");
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);
361 assertXPath(pXmlDoc,
362 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
363 u"PortionType::Text");
364 assertXPath(pXmlDoc,
365 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
366 "portion", u"fo");
367 assertXPath(pXmlDoc,
368 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
369 u"PortionType::Text");
370 assertXPath(pXmlDoc,
371 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
372 "portion", u"o");
373 assertXPath(pXmlDoc,
374 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
375 "SwLinePortion[1]",
376 "type", u"PortionType::Text");
377 assertXPath(pXmlDoc,
378 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
379 "SwLinePortion[1]",
380 "portion", u"a");
381 assertXPath(pXmlDoc,
382 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
383 "SwLinePortion[2]",
384 "type", u"PortionType::Text");
385 assertXPath(pXmlDoc,
386 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
387 "SwLinePortion[2]",
388 "portion", u"bc");
389 assertXPath(pXmlDoc,
390 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
391 "SwParaPortion[1]",
392 "type", u"PortionType::Para");
393 assertXPath(pXmlDoc,
394 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
395 "SwParaPortion[1]",
396 "portion", u"def");
397 assertXPath(pXmlDoc,
398 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
399 "SwLinePortion[1]",
400 "type", u"PortionType::Text");
401 assertXPath(pXmlDoc,
402 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
403 "SwLinePortion[1]",
404 "portion", u"g");
405 assertXPath(pXmlDoc,
406 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
407 "SwLinePortion[2]",
408 "type", u"PortionType::Text");
409 assertXPath(pXmlDoc,
410 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
411 "SwLinePortion[2]",
412 "portion", u"hi");
413 assertXPath(pXmlDoc,
414 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
415 u"PortionType::Para");
416 assertXPath(pXmlDoc,
417 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
418 "portion", u"bar");
419 assertXPath(pXmlDoc,
420 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
421 u"PortionType::Text");
422 assertXPath(pXmlDoc,
423 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
424 "portion", u"b");
425 assertXPath(pXmlDoc,
426 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
427 u"PortionType::Text");
428 assertXPath(pXmlDoc,
429 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
430 "portion", u"az");
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");
455 assertXPath(pXmlDoc,
456 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
457 u"PortionType::Para");
458 assertXPath(pXmlDoc,
459 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
460 "portion", u"foaz");
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);
472 assertXPath(pXmlDoc,
473 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
474 u"PortionType::Text");
475 assertXPath(pXmlDoc,
476 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
477 "portion", u"fo");
478 assertXPath(pXmlDoc,
479 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
480 u"PortionType::Text");
481 assertXPath(pXmlDoc,
482 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
483 "portion", u"o");
484 assertXPath(pXmlDoc,
485 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
486 u"PortionType::Para");
487 assertXPath(pXmlDoc,
488 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
489 "portion", u"bar");
490 assertXPath(pXmlDoc,
491 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
492 "SwLinePortion[1]",
493 "type", u"PortionType::Text");
494 assertXPath(pXmlDoc,
495 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
496 "SwLinePortion[1]",
497 "portion", u"a");
498 assertXPath(pXmlDoc,
499 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
500 "SwLinePortion[2]",
501 "type", u"PortionType::Text");
502 assertXPath(pXmlDoc,
503 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
504 "SwLinePortion[2]",
505 "portion", u"bc");
506 assertXPath(pXmlDoc,
507 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
508 "SwParaPortion[1]",
509 "type", u"PortionType::Para");
510 assertXPath(pXmlDoc,
511 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
512 "SwParaPortion[1]",
513 "portion", u"def");
514 assertXPath(pXmlDoc,
515 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
516 "SwLinePortion[1]",
517 "type", u"PortionType::Text");
518 assertXPath(pXmlDoc,
519 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
520 "SwLinePortion[1]",
521 "portion", u"g");
522 assertXPath(pXmlDoc,
523 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
524 "SwLinePortion[2]",
525 "type", u"PortionType::Text");
526 assertXPath(pXmlDoc,
527 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
528 "SwLinePortion[2]",
529 "portion", u"hi");
530 assertXPath(pXmlDoc,
531 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
532 u"PortionType::Text");
533 assertXPath(pXmlDoc,
534 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
535 "portion", u"b");
536 assertXPath(pXmlDoc,
537 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
538 u"PortionType::Text");
539 assertXPath(pXmlDoc,
540 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
541 "portion", u"az");
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");
565 assertXPath(pXmlDoc,
566 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
567 u"PortionType::Para");
568 assertXPath(pXmlDoc,
569 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
570 "portion", u"foaz");
571 assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged",
572 "paraPropsNodeIndex", u"6");
573 assertXPath(pXmlDoc,
574 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
575 "SwParaPortion[1]",
576 "type", u"PortionType::Para");
577 assertXPath(pXmlDoc,
578 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
579 "SwParaPortion[1]",
580 "portion", u"ahi");
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);
589 assertXPath(pXmlDoc,
590 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
591 u"PortionType::Text");
592 assertXPath(pXmlDoc,
593 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
594 "portion", u"fo");
595 assertXPath(pXmlDoc,
596 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
597 u"PortionType::Text");
598 assertXPath(pXmlDoc,
599 "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
600 "portion", u"o");
601 assertXPath(pXmlDoc,
602 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
603 u"PortionType::Para");
604 assertXPath(pXmlDoc,
605 "/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
606 "portion", u"bar");
607 assertXPath(pXmlDoc,
608 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
609 u"PortionType::Text");
610 assertXPath(pXmlDoc,
611 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
612 "portion", u"b");
613 assertXPath(pXmlDoc,
614 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
615 u"PortionType::Text");
616 assertXPath(pXmlDoc,
617 "/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
618 "portion", u"az");
619 assertXPath(pXmlDoc,
620 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
621 "SwLinePortion[1]",
622 "type", u"PortionType::Text");
623 assertXPath(pXmlDoc,
624 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
625 "SwLinePortion[1]",
626 "portion", u"a");
627 assertXPath(pXmlDoc,
628 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
629 "SwLinePortion[2]",
630 "type", u"PortionType::Text");
631 assertXPath(pXmlDoc,
632 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
633 "SwLinePortion[2]",
634 "portion", u"bc");
635 assertXPath(pXmlDoc,
636 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
637 "SwParaPortion[1]",
638 "type", u"PortionType::Para");
639 assertXPath(pXmlDoc,
640 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
641 "SwParaPortion[1]",
642 "portion", u"def");
643 assertXPath(pXmlDoc,
644 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
645 "SwLinePortion[1]",
646 "type", u"PortionType::Text");
647 assertXPath(pXmlDoc,
648 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
649 "SwLinePortion[1]",
650 "portion", u"g");
651 assertXPath(pXmlDoc,
652 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
653 "SwLinePortion[2]",
654 "type", u"PortionType::Text");
655 assertXPath(pXmlDoc,
656 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
657 "SwLinePortion[2]",
658 "portion", u"hi");
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",
687 u"828");
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",
702 u"828");
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);
756 assertXPath(
757 pXmlDoc,
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
772 assertXPath(
773 pXmlDoc,
774 "/root/page[2]/body/section/txt[1]/SwParaPortion/SwLineLayout[1]/SwLinePortion[1]",
775 "portion",
776 u"Widows & orphans He heard quiet steps behind him. That didn't bode well. Who could "
777 u"be "
778 "following");
779 assertXPath(
780 pXmlDoc,
781 "/root/page[2]/body/section/txt[1]/SwParaPortion/SwLineLayout[3]/SwLinePortion[1]",
782 "portion", u"pulled off ");
783 assertXPath(
784 pXmlDoc,
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]",
806 u"Tabelle 1");
807 assertXPathContent(pXmlDoc,
808 "/root/page[2]/body/tab[1]/row[1]/cell[1]/tab[1]/row[1]/cell[1]/txt",
809 u"Tabelle 2");
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)
853 createSwDoc();
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);
859 CPPUNIT_ASSERT(
860 pWrtShell
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());
873 flySet.Put(anchor);
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);
878 // move inside fly
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);
890 pWrtShell->Delete();
892 pWrtShell->GotoHeaderText();
893 pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 2, /*bBasicCall=*/false);
894 pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 7, /*bBasicCall=*/false);
895 pWrtShell->Delete();
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",
914 u"0");
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",
919 u"foaz");
920 assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/merged",
921 "paraPropsNodeIndex", u"11");
922 assertXPath(
923 pXmlDoc,
924 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout[1]",
925 "type", u"PortionType::Para");
926 assertXPath(
927 pXmlDoc,
928 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout[1]",
929 "portion", u"ahi");
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",
941 u"0");
942 assertXPath(pXmlDoc,
943 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
944 "type", u"PortionType::Text");
945 assertXPath(pXmlDoc,
946 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
947 "portion", u"fo");
948 assertXPath(pXmlDoc,
949 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
950 "type", u"PortionType::Text");
951 assertXPath(pXmlDoc,
952 "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
953 "portion", u"o");
954 assertXPath(pXmlDoc,
955 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
956 "SwLinePortion[1]",
957 "type", u"PortionType::Text");
958 assertXPath(pXmlDoc,
959 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
960 "SwLinePortion[1]",
961 "portion", u"a");
962 assertXPath(pXmlDoc,
963 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
964 "SwLinePortion[2]",
965 "type", u"PortionType::Text");
966 assertXPath(pXmlDoc,
967 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
968 "SwLinePortion[2]",
969 "portion", u"bc");
970 assertXPath(pXmlDoc,
971 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
972 "SwParaPortion[1]",
973 "type", u"PortionType::Para");
974 assertXPath(pXmlDoc,
975 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
976 "SwParaPortion[1]",
977 "portion", u"def");
978 assertXPath(pXmlDoc,
979 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
980 "SwLinePortion[1]",
981 "type", u"PortionType::Text");
982 assertXPath(pXmlDoc,
983 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
984 "SwLinePortion[1]",
985 "portion", u"g");
986 assertXPath(pXmlDoc,
987 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
988 "SwLinePortion[2]",
989 "type", u"PortionType::Text");
990 assertXPath(pXmlDoc,
991 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
992 "SwLinePortion[2]",
993 "portion", u"hi");
994 assertXPath(pXmlDoc,
995 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
996 "type", u"PortionType::Para");
997 assertXPath(pXmlDoc,
998 "/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
999 "portion", u"bar");
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]",
1005 "portion", u"b");
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]",
1011 "portion", u"az");
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]",
1061 "length", u"0");
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]",
1067 "portion", u"fo");
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]",
1073 "portion", u"o");
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]",
1079 "portion", u"bar");
1080 assertXPath(pXmlDoc,
1081 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1082 "SwLinePortion[1]",
1083 "type", u"PortionType::Text");
1084 assertXPath(pXmlDoc,
1085 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1086 "SwLinePortion[1]",
1087 "portion", u"a");
1088 assertXPath(pXmlDoc,
1089 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1090 "SwLinePortion[2]",
1091 "type", u"PortionType::Text");
1092 assertXPath(pXmlDoc,
1093 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1094 "SwLinePortion[2]",
1095 "portion", u"bc");
1096 assertXPath(pXmlDoc,
1097 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
1098 "SwParaPortion[1]",
1099 "type", u"PortionType::Para");
1100 assertXPath(pXmlDoc,
1101 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
1102 "SwParaPortion[1]",
1103 "portion", u"def");
1104 assertXPath(pXmlDoc,
1105 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1106 "SwLinePortion[1]",
1107 "type", u"PortionType::Text");
1108 assertXPath(pXmlDoc,
1109 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1110 "SwLinePortion[1]",
1111 "portion", u"g");
1112 assertXPath(pXmlDoc,
1113 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1114 "SwLinePortion[2]",
1115 "type", u"PortionType::Text");
1116 assertXPath(pXmlDoc,
1117 "/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1118 "SwLinePortion[2]",
1119 "portion", u"hi");
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]",
1125 "portion", u"b");
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]",
1131 "portion", u"az");
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]",
1159 "length", u"0");
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/"
1171 "SwParaPortion[1]",
1172 "type", u"PortionType::Para");
1173 assertXPath(pXmlDoc,
1174 "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1175 "SwParaPortion[1]",
1176 "portion", u"ahi");
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]",
1190 "length", u"0");
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]",
1196 "portion", u"fo");
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]",
1202 "portion", u"o");
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]",
1208 "portion", u"bar");
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]",
1214 "portion", u"b");
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]",
1220 "portion", u"az");
1221 assertXPath(pXmlDoc,
1222 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1223 "SwLinePortion[1]",
1224 "type", u"PortionType::Text");
1225 assertXPath(pXmlDoc,
1226 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1227 "SwLinePortion[1]",
1228 "portion", u"a");
1229 assertXPath(pXmlDoc,
1230 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1231 "SwLinePortion[2]",
1232 "type", u"PortionType::Text");
1233 assertXPath(pXmlDoc,
1234 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
1235 "SwLinePortion[2]",
1236 "portion", u"bc");
1237 assertXPath(pXmlDoc,
1238 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
1239 "SwParaPortion[1]",
1240 "type", u"PortionType::Para");
1241 assertXPath(pXmlDoc,
1242 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
1243 "SwParaPortion[1]",
1244 "portion", u"def");
1245 assertXPath(pXmlDoc,
1246 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1247 "SwLinePortion[1]",
1248 "type", u"PortionType::Text");
1249 assertXPath(pXmlDoc,
1250 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1251 "SwLinePortion[1]",
1252 "portion", u"g");
1253 assertXPath(pXmlDoc,
1254 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1255 "SwLinePortion[2]",
1256 "type", u"PortionType::Text");
1257 assertXPath(pXmlDoc,
1258 "/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
1259 "SwLinePortion[2]",
1260 "portion", u"hi");
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);
1299 pWrtShell->Undo();
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);
1323 #endif
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"
1343 "[@whichId='"
1344 + OString::number(SDRATTR_TEXT_LEFTDIST) + "']",
1345 "value", u"567");
1346 // SDRATTR_TEXT_RIGHTDIST
1347 assertXPath(pXmlDoc,
1348 "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
1349 "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
1350 "[@whichId='"
1351 + OString::number(SDRATTR_TEXT_RIGHTDIST) + "']",
1352 "value", u"1134");
1353 // SDRATTR_TEXT_UPPERDIST
1354 assertXPath(pXmlDoc,
1355 "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
1356 "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
1357 "[@whichId='"
1358 + OString::number(SDRATTR_TEXT_UPPERDIST) + "']",
1359 "value", u"1701");
1360 // SDRATTR_TEXT_LOWERDIST
1361 assertXPath(pXmlDoc,
1362 "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject"
1363 "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item"
1364 "[@whichId='"
1365 + OString::number(SDRATTR_TEXT_LOWERDIST) + "']",
1366 "value", u"2268");
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)
1415 createSwDoc();
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());
1429 flySet.Put(anchor);
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());
1448 flySet.Put(anchor);
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);
1452 // move inside fly
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']",
1501 "expand", u"1");
1502 assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn[1]/txt[1]/merged", "paraPropsNodeIndex",
1503 u"7");
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]",
1513 "portion", u"ahi");
1514 assertXPath(
1515 pXmlDoc,
1516 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1517 "type", u"PortionType::FootnoteNum");
1518 assertXPath(
1519 pXmlDoc,
1520 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1521 "expand", u"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]",
1535 "expand", u"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]",
1541 "expand", u"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");
1550 assertXPath(
1551 pXmlDoc,
1552 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1553 "type", u"PortionType::FootnoteNum");
1554 assertXPath(
1555 pXmlDoc,
1556 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1557 "expand", u"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]",
1565 "portion", u"a");
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]",
1573 "portion", u"bc");
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]",
1581 "portion", u"def");
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]",
1589 "portion", u"g");
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]",
1597 "portion", u"hi");
1598 assertXPath(
1599 pXmlDoc,
1600 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1601 "type", u"PortionType::FootnoteNum");
1602 assertXPath(
1603 pXmlDoc,
1604 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1605 "expand", u"2");
1606 assertXPath(
1607 pXmlDoc,
1608 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1609 "type", u"PortionType::Text");
1610 assertXPath(
1611 pXmlDoc,
1612 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1613 "portion", u"fo");
1614 assertXPath(
1615 pXmlDoc,
1616 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1617 "type", u"PortionType::Text");
1618 assertXPath(
1619 pXmlDoc,
1620 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1621 "portion", u"o");
1622 assertXPath(
1623 pXmlDoc,
1624 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1625 "type", u"PortionType::Para");
1626 assertXPath(
1627 pXmlDoc,
1628 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1629 "portion", u"bar");
1630 assertXPath(
1631 pXmlDoc,
1632 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1633 "type", u"PortionType::Text");
1634 assertXPath(
1635 pXmlDoc,
1636 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1637 "portion", u"b");
1638 assertXPath(
1639 pXmlDoc,
1640 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1641 "type", u"PortionType::Text");
1642 assertXPath(
1643 pXmlDoc,
1644 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1645 "portion", u"az");
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]",
1678 "expand", u"1");
1679 assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn[1]/txt[1]/merged", "paraPropsNodeIndex",
1680 u"7");
1681 assertXPath(
1682 pXmlDoc,
1683 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1684 "type", u"PortionType::FootnoteNum");
1685 assertXPath(
1686 pXmlDoc,
1687 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1688 "expand", u"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]",
1705 "expand", u"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]",
1711 "expand", u"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");
1720 assertXPath(
1721 pXmlDoc,
1722 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1723 "type", u"PortionType::FootnoteNum");
1724 assertXPath(
1725 pXmlDoc,
1726 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1727 "expand", u"1");
1728 assertXPath(
1729 pXmlDoc,
1730 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1731 "type", u"PortionType::FootnoteNum");
1732 assertXPath(
1733 pXmlDoc,
1734 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1735 "expand", u"2");
1736 assertXPath(
1737 pXmlDoc,
1738 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1739 "type", u"PortionType::Text");
1740 assertXPath(
1741 pXmlDoc,
1742 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1743 "portion", u"fo");
1744 assertXPath(
1745 pXmlDoc,
1746 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1747 "type", u"PortionType::Text");
1748 assertXPath(
1749 pXmlDoc,
1750 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1751 "portion", u"o");
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]",
1759 "portion", u"a");
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]",
1767 "portion", u"bc");
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]",
1775 "portion", u"def");
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]",
1783 "portion", u"g");
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]",
1791 "portion", u"hi");
1792 assertXPath(
1793 pXmlDoc,
1794 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1795 "type", u"PortionType::Para");
1796 assertXPath(
1797 pXmlDoc,
1798 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1799 "portion", u"bar");
1800 assertXPath(
1801 pXmlDoc,
1802 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1803 "type", u"PortionType::Text");
1804 assertXPath(
1805 pXmlDoc,
1806 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1807 "portion", u"b");
1808 assertXPath(
1809 pXmlDoc,
1810 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1811 "type", u"PortionType::Text");
1812 assertXPath(
1813 pXmlDoc,
1814 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1815 "portion", u"az");
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]",
1848 "expand", u"1");
1849 assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn[1]/txt[1]/merged", "paraPropsNodeIndex",
1850 u"7");
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]",
1860 "portion", u"ahi");
1861 assertXPath(
1862 pXmlDoc,
1863 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1864 "type", u"PortionType::FootnoteNum");
1865 assertXPath(
1866 pXmlDoc,
1867 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1868 "expand", u"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]",
1884 "expand", u"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]",
1892 "expand", u"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");
1901 assertXPath(
1902 pXmlDoc,
1903 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1904 "type", u"PortionType::FootnoteNum");
1905 assertXPath(
1906 pXmlDoc,
1907 "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1908 "expand", u"1");
1909 assertXPath(
1910 pXmlDoc,
1911 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1912 "type", u"PortionType::FootnoteNum");
1913 assertXPath(
1914 pXmlDoc,
1915 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]",
1916 "expand", u"2");
1917 assertXPath(
1918 pXmlDoc,
1919 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1920 "type", u"PortionType::Text");
1921 assertXPath(
1922 pXmlDoc,
1923 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1924 "portion", u"fo");
1925 assertXPath(
1926 pXmlDoc,
1927 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1928 "type", u"PortionType::Text");
1929 assertXPath(
1930 pXmlDoc,
1931 "/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1932 "portion", u"o");
1933 assertXPath(
1934 pXmlDoc,
1935 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1936 "type", u"PortionType::Para");
1937 assertXPath(
1938 pXmlDoc,
1939 "/root/page[1]/ftncont/ftn[2]/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
1940 "portion", u"bar");
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]",
1948 "portion", u"a");
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]",
1956 "portion", u"bc");
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]",
1964 "portion", u"def");
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]",
1972 "portion", u"g");
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]",
1980 "portion", u"hi");
1981 assertXPath(
1982 pXmlDoc,
1983 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1984 "type", u"PortionType::Text");
1985 assertXPath(
1986 pXmlDoc,
1987 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
1988 "portion", u"b");
1989 assertXPath(
1990 pXmlDoc,
1991 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1992 "type", u"PortionType::Text");
1993 assertXPath(
1994 pXmlDoc,
1995 "/root/page[1]/ftncont/ftn[2]/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
1996 "portion", u"az");
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",
2013 u"18540");
2014 p2txt1Left
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",
2018 u"23894");
2019 p2txt2Left
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",
2023 u"35662");
2024 p3txt1Left
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();
2031 pWrtShell->Undo();
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",
2039 u"18540");
2040 assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "left",
2041 p2txt1Left);
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",
2044 u"23894");
2045 assertXPath(pXmlDoc, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "left",
2046 p2txt2Left);
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",
2049 u"35662");
2050 assertXPath(pXmlDoc, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "left",
2051 p3txt1Left);
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
2071 assertXPath(
2072 pLayout,
2073 "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion",
2075 assertXPath(
2076 pLayout,
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.");
2079 // height was: 1517
2080 // tdf#134782 height was: 379
2081 assertXPath(pLayout, "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/infos/bounds", "height",
2082 u"253");
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(
2104 pXmlDoc,
2105 "/root/page/body/txt/SwParaPortion/SwLineLayout[1]/child::*[@type='PortionType::Fly']",
2106 "height");
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]/"
2119 "SwLinePortion",
2120 "portion",
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();
2123 assertXPath(
2124 pLayout,
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();
2136 // frame on page 3
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 "
2148 "boasts some ");
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)
2208 createSwDoc();
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);
2229 // move inside fly1
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);
2243 // move inside fly2
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");
2290 assertXPath(
2291 pXmlDoc,
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]",
2301 "portion", u"jqr");
2302 assertXPath(pXmlDoc,
2303 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2304 "SwFixPortion[1]",
2305 "type",
2306 u"PortionType::Fly"); // remove???
2307 assertXPath(pXmlDoc,
2308 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2309 "SwLineLayout[1]",
2310 "type", u"PortionType::Lay");
2311 assertXPath(pXmlDoc,
2312 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2313 "SwLineLayout[1]",
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]",
2336 "portion", u"j");
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]",
2344 "portion", u"kl");
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]",
2352 "portion", u"mno");
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]",
2360 "portion", u"p");
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]",
2368 "portion", u"qr");
2369 assertXPath(pXmlDoc,
2370 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2371 "SwFixPortion[1]",
2372 "type",
2373 u"PortionType::Fly"); // remove???
2374 assertXPath(pXmlDoc,
2375 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2376 "SwLinePortion[1]",
2377 "type", u"PortionType::Text");
2378 assertXPath(pXmlDoc,
2379 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2380 "SwLinePortion[1]",
2381 "portion", u"ab");
2382 assertXPath(pXmlDoc,
2383 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2384 "SwLinePortion[2]",
2385 "type", u"PortionType::Text");
2386 assertXPath(pXmlDoc,
2387 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2388 "SwLinePortion[2]",
2389 "portion", u"c");
2390 assertXPath(pXmlDoc,
2391 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2392 "SwParaPortion[1]",
2393 "type", u"PortionType::Para");
2394 assertXPath(pXmlDoc,
2395 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2396 "SwParaPortion[1]",
2397 "portion", u"def");
2398 assertXPath(pXmlDoc,
2399 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2400 "SwLinePortion[1]",
2401 "type", u"PortionType::Text");
2402 assertXPath(pXmlDoc,
2403 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2404 "SwLinePortion[1]",
2405 "portion", u"g");
2406 assertXPath(pXmlDoc,
2407 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2408 "SwLinePortion[2]",
2409 "type", u"PortionType::Text");
2410 assertXPath(pXmlDoc,
2411 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2412 "SwLinePortion[2]",
2413 "portion", u"hi");
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]",
2419 "portion", u"fo");
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]",
2425 "portion", u"o");
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]",
2431 "portion", u"bar");
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]",
2437 "portion", u"b");
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]",
2443 "portion", u"az");
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]",
2500 "portion", u"fo");
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]",
2506 "portion", u"o");
2507 assertXPath(pXmlDoc,
2508 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2509 "SwLinePortion[1]",
2510 "type", u"PortionType::Text");
2511 assertXPath(pXmlDoc,
2512 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2513 "SwLinePortion[1]",
2514 "portion", u"j");
2515 assertXPath(pXmlDoc,
2516 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2517 "SwLinePortion[2]",
2518 "type", u"PortionType::Text");
2519 assertXPath(pXmlDoc,
2520 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2521 "SwLinePortion[2]",
2522 "portion", u"kl");
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]",
2530 "portion", u"ab");
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]",
2538 "portion", u"c");
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]",
2546 "portion", u"def");
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]",
2554 "portion", u"g");
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]",
2562 "portion", u"hi");
2563 assertXPath(pXmlDoc,
2564 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2565 "SwFixPortion[1]",
2566 "type",
2567 u"PortionType::Fly"); // remove???
2568 assertXPath(pXmlDoc,
2569 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2570 "SwLineLayout[1]",
2571 "type", u"PortionType::Lay");
2572 assertXPath(pXmlDoc,
2573 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2574 "SwLineLayout[1]",
2575 "portion", u"mno");
2576 assertXPath(pXmlDoc,
2577 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2578 "SwLinePortion[1]",
2579 "type", u"PortionType::Text");
2580 assertXPath(pXmlDoc,
2581 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2582 "SwLinePortion[1]",
2583 "portion", u"p");
2584 assertXPath(pXmlDoc,
2585 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2586 "SwLinePortion[2]",
2587 "type", u"PortionType::Text");
2588 assertXPath(pXmlDoc,
2589 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2590 "SwLinePortion[2]",
2591 "portion", u"qr");
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]",
2597 "portion", u"bar");
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]",
2603 "portion", u"b");
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]",
2609 "portion", u"az");
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");
2644 assertXPath(
2645 pXmlDoc,
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]",
2655 "portion", u"jqr");
2656 assertXPath(pXmlDoc,
2657 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2658 "SwFixPortion[1]",
2659 "type",
2660 u"PortionType::Fly"); // remove???
2661 assertXPath(pXmlDoc,
2662 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2663 "SwLineLayout[1]",
2664 "type", u"PortionType::Lay");
2665 assertXPath(pXmlDoc,
2666 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2667 "SwLineLayout[1]",
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]",
2688 "portion", u"fo");
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]",
2694 "portion", u"o");
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]",
2700 "portion", u"bar");
2701 assertXPath(pXmlDoc,
2702 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2703 "SwLinePortion[1]",
2704 "type", u"PortionType::Text");
2705 assertXPath(pXmlDoc,
2706 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2707 "SwLinePortion[1]",
2708 "portion", u"ab");
2709 assertXPath(pXmlDoc,
2710 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2711 "SwLinePortion[2]",
2712 "type", u"PortionType::Text");
2713 assertXPath(pXmlDoc,
2714 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2715 "SwLinePortion[2]",
2716 "portion", u"c");
2717 assertXPath(pXmlDoc,
2718 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2719 "SwParaPortion[1]",
2720 "type", u"PortionType::Para");
2721 assertXPath(pXmlDoc,
2722 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2723 "SwParaPortion[1]",
2724 "portion", u"def");
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]",
2732 "portion", u"j");
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]",
2740 "portion", u"kl");
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]",
2748 "portion", u"mno");
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]",
2756 "portion", u"p");
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]",
2764 "portion", u"qr");
2765 assertXPath(pXmlDoc,
2766 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2767 "SwLinePortion[1]",
2768 "type", u"PortionType::Text");
2769 assertXPath(pXmlDoc,
2770 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2771 "SwFixPortion[1]",
2772 "type",
2773 u"PortionType::Fly"); // remove???
2774 assertXPath(pXmlDoc,
2775 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2776 "SwLinePortion[1]",
2777 "portion", u"g");
2778 assertXPath(pXmlDoc,
2779 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2780 "SwLinePortion[2]",
2781 "type", u"PortionType::Text");
2782 assertXPath(pXmlDoc,
2783 "/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2784 "SwLinePortion[2]",
2785 "portion", u"hi");
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]",
2791 "portion", u"b");
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]",
2797 "portion", u"az");
2801 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys)
2803 createSwDoc();
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);
2824 // move inside fly1
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);
2838 // move inside fly2
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]",
2880 "portion", u"jqr");
2881 assertXPath(pXmlDoc,
2882 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2883 "SwFixPortion[1]",
2884 "type",
2885 u"PortionType::Fly"); // remove???
2886 assertXPath(pXmlDoc,
2887 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2888 "SwLineLayout[1]",
2889 "type", u"PortionType::Lay");
2890 assertXPath(pXmlDoc,
2891 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2892 "SwLineLayout[1]",
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]",
2913 "portion", u"j");
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]",
2921 "portion", u"kl");
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]",
2929 "portion", u"mno");
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]",
2937 "portion", u"p");
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]",
2945 "portion", u"qr");
2946 assertXPath(pXmlDoc,
2947 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2948 "SwFixPortion[1]",
2949 "type",
2950 u"PortionType::Fly"); // remove???
2951 assertXPath(pXmlDoc,
2952 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2953 "SwLinePortion[1]",
2954 "type", u"PortionType::Text");
2955 assertXPath(pXmlDoc,
2956 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2957 "SwLinePortion[1]",
2958 "portion", u"ab");
2959 assertXPath(pXmlDoc,
2960 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2961 "SwLinePortion[2]",
2962 "type", u"PortionType::Text");
2963 assertXPath(pXmlDoc,
2964 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
2965 "SwLinePortion[2]",
2966 "portion", u"c");
2967 assertXPath(pXmlDoc,
2968 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2969 "SwParaPortion[1]",
2970 "type", u"PortionType::Para");
2971 assertXPath(pXmlDoc,
2972 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
2973 "SwParaPortion[1]",
2974 "portion", u"def");
2975 assertXPath(pXmlDoc,
2976 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2977 "SwLinePortion[1]",
2978 "type", u"PortionType::Text");
2979 assertXPath(pXmlDoc,
2980 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2981 "SwLinePortion[1]",
2982 "portion", u"g");
2983 assertXPath(pXmlDoc,
2984 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2985 "SwLinePortion[2]",
2986 "type", u"PortionType::Text");
2987 assertXPath(pXmlDoc,
2988 "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
2989 "SwLinePortion[2]",
2990 "portion", u"hi");
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]",
2994 "portion", u"fo");
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]",
2998 "portion", u"o");
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]",
3002 "portion", u"bar");
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]",
3006 "portion", u"b");
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]",
3010 "portion", u"az");
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]",
3041 "portion", u"fo");
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]",
3045 "portion", u"o");
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]",
3053 "portion", u"j");
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]",
3061 "portion", u"kl");
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]",
3069 "portion", u"mno");
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]",
3077 "portion", u"p");
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]",
3085 "portion", u"qr");
3086 assertXPath(pXmlDoc,
3087 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3088 "SwLinePortion[1]",
3089 "type", u"PortionType::Text");
3090 assertXPath(pXmlDoc,
3091 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3092 "SwFixPortion[1]",
3093 "type",
3094 u"PortionType::Fly"); // remove???
3095 assertXPath(pXmlDoc,
3096 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3097 "SwLinePortion[1]",
3098 "portion", u"ab");
3099 assertXPath(pXmlDoc,
3100 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3101 "SwLinePortion[2]",
3102 "type", u"PortionType::Text");
3103 assertXPath(pXmlDoc,
3104 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
3105 "SwLinePortion[2]",
3106 "portion", u"c");
3107 assertXPath(pXmlDoc,
3108 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
3109 "SwParaPortion[1]",
3110 "type", u"PortionType::Para");
3111 assertXPath(pXmlDoc,
3112 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
3113 "SwParaPortion[1]",
3114 "portion", u"def");
3115 assertXPath(pXmlDoc,
3116 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3117 "SwLinePortion[1]",
3118 "type", u"PortionType::Text");
3119 assertXPath(pXmlDoc,
3120 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3121 "SwLinePortion[1]",
3122 "portion", u"g");
3123 assertXPath(pXmlDoc,
3124 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3125 "SwLinePortion[2]",
3126 "type", u"PortionType::Text");
3127 assertXPath(pXmlDoc,
3128 "/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
3129 "SwLinePortion[2]",
3130 "portion", u"hi");
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]",
3134 "portion", u"bar");
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]",
3138 "portion", u"b");
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]",
3142 "portion", u"az");
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?
3158 calcLayout();
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]",
3166 "portion", u"fo");
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]",
3170 "portion", u"o");
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]",
3185 "portion", u"bar");
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]",
3191 "portion", u"baz");
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]",
3195 "portion", u"b");
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]",
3199 "portion", u"lah");
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]",
3205 "portion", u"fo");
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]",
3211 "portion", u"o");
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]",
3217 "portion", u"bar");
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]",
3223 "portion", u"b");
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]",
3229 "portion", u"lah");
3231 // verify after hide
3232 dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
3233 CPPUNIT_ASSERT(pLayout->IsHideRedlines());
3234 // why is this needed explicitly?
3235 calcLayout();
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?
3269 calcLayout();
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]",
3277 "portion", u"fo");
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]",
3281 "portion", u"o");
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/"
3293 "SwParaPortion[1]",
3294 "type", u"PortionType::Para");
3295 assertXPath(pXmlDoc,
3296 "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/SwParaPortion/SwLineLayout/"
3297 "SwParaPortion[1]",
3298 "portion", u"aaa");
3299 assertXPath(pXmlDoc,
3300 "/root/page[1]/body/tab[1]/row[2]/cell[2]/txt[1]/SwParaPortion/SwLineLayout/"
3301 "SwParaPortion[1]",
3302 "type", u"PortionType::Para");
3303 assertXPath(pXmlDoc,
3304 "/root/page[1]/body/tab[1]/row[2]/cell[2]/txt[1]/SwParaPortion/SwLineLayout/"
3305 "SwParaPortion[1]",
3306 "portion", u"ddd");
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]",
3310 "portion", u"b");
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]",
3314 "portion", u"ar");
3316 // verify after hide
3317 dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
3318 CPPUNIT_ASSERT(pLayout->IsHideRedlines());
3319 // why is this needed explicitly?
3320 calcLayout();
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",
3340 "portion", u"A6");
3341 assertXPath(pXmlDoc,
3342 "/root/page[2]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3343 "portion", u"A12");
3344 assertXPath(pXmlDoc,
3345 "/root/page[3]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3346 "portion", u"B6");
3347 assertXPath(pXmlDoc,
3348 "/root/page[4]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3349 "portion", u"B12");
3351 // hide tracked table and table row deletions
3352 dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
3353 CPPUNIT_ASSERT(pLayout->IsHideRedlines());
3354 calcLayout();
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",
3363 "portion", u"B12");
3365 // show tracked table and table row deletions again
3366 dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
3367 CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
3368 calcLayout();
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",
3373 "portion", u"A6");
3374 assertXPath(pXmlDoc,
3375 "/root/page[2]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3376 "portion", u"A12");
3377 assertXPath(pXmlDoc,
3378 "/root/page[3]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3379 "portion", u"B6");
3380 assertXPath(pXmlDoc,
3381 "/root/page[4]/body/tab/row[6]/cell/txt/SwParaPortion/SwLineLayout/SwParaPortion",
3382 "portion", u"B12");
3385 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347)
3387 createSwDoc("tdf144057.fodt");
3388 SwDoc* pDoc(getSwDoc());
3389 SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
3391 // enable redlining
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);
3403 calcLayout();
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, {});
3416 calcLayout();
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);
3427 calcLayout();
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, {});
3445 // enable redlining
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());
3460 calcLayout();
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());
3469 calcLayout();
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
3478 skipValidation();
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.
3551 calcLayout();
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:
3563 // - Expected: 1
3564 // - Actual : 14
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",
3578 "expand", u"One");
3580 // Without the fix in place, this test would have failed with
3581 // - Expected: two
3582 // - Actual : two
3583 assertXPath(pXmlDoc, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[2]/SwFieldPortion",
3584 "expand", u"two");
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
3630 // - Expected: 1
3631 // - Actual : 2
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",
3634 u"صِرَ ٰطَ");
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: */