/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <swmodeltestbase.hxx>
#include <osl/process.h>
#include <comphelper/scopeguard.hxx>
#include <comphelper/propertysequence.hxx>
#include <vcl/scheduler.hxx>
#include <svx/svddef.hxx>
#include <layouter.hxx>
#include <fmtanchr.hxx>
#include <fmtfsize.hxx>
#include <fmtcntnt.hxx>
#include <wrtsh.hxx>
#include <unotxdoc.hxx>
#include <rootfrm.hxx>
#include <IDocumentLayoutAccess.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <unoframe.hxx>
#include <fldmgr.hxx>
#include <officecfg/Office/Common.hxx>
/// Test to assert layout / rendering result of Writer.
class SwLayoutWriter :
public SwModelTestBase
{
public :
SwLayoutWriter()
: SwModelTestBase(u
"/sw/qa/extras/layout/data/" _ustr)
{
}
protected :
void CheckRedlineFootnotesHidden();
void CheckRedlineSectionsHidden();
};
// this is a member because our test classes have protected members :(
void SwLayoutWriter::CheckRedlineFootnotesHidden()
{
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/merged" ,
"paraPropsNodeIndex" , u
"24" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"type" , u
"PortionType::Footnote" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"expand" , u
"1" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u
"foaz" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]" ,
"type" , u
"PortionType::Footnote" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]" ,
"expand" , u
"2" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/merged" ,
"paraPropsNodeIndex" , u
"13" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"type" , u
"PortionType::FootnoteNum" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"expand" , u
"1" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u
"ac" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[2]/txt[1]/merged" ,
"paraPropsNodeIndex" , u
"16" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"type" , u
"PortionType::FootnoteNum" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"expand" , u
"2" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u
"mo" );
}
void SwLayoutWriter::CheckRedlineSectionsHidden()
{
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/merged" ,
"paraPropsNodeIndex" , u
"12" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"type" , u
"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u
"folah" );
assertXPath(pXmlDoc,
"/root/page[1]/body/section[1]/txt[1]/merged" ,
"paraPropsNodeIndex" ,
u
"20" );
assertXPath(pXmlDoc,
"/root/page[1]/body/section[1]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"type" , u
"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/section[1]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u
"folah" );
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf156077)
{
createSwDoc(
"s4_min2.fodt" );
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Number of pages does not match!" , 3, getPages());
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc,
"/root/page[1]/anchored/fly" , 3);
assertXPath(pXmlDoc,
"/root/page[2]/anchored/fly" , 1);
// this was 0, the at-page anchored flys were not displayed
assertXPath(pXmlDoc,
"/root/page[3]/anchored/fly" , 3);
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes)
{
createSwDoc(
"redline_footnotes.odt" );
SwDoc* pDoc(getSwDoc());
SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
CPPUNIT_ASSERT(pLayout->IsHideRedlines());
// verify after load
CheckRedlineFootnotesHidden();
dispatchCommand(mxComponent, u
".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
// show: nothing is merged
assertXPath(pXmlDoc,
"//merged", 0);
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"type" , u
"PortionType::Footnote" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"expand" , u
"1" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u
"fo" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u
"o" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]" ,
"type" , u
"PortionType::Footnote" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]" ,
"expand" , u
"2" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"type" , u
"PortionType::FootnoteNum" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"expand" , u
"1" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u
"a" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u
"b" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]" ,
"portion" , u
"c" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"type" , u
"PortionType::FootnoteNum" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"expand" , u
"2" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[2]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u
"def" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u
"b" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"type" , u
"PortionType::Footnote" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"expand" , u
"3" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u
"ar" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"type" , u
"PortionType::FootnoteNum" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"expand" , u
"3" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[3]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u
"ghi" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"type" , u
"PortionType::Footnote" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"expand" , u
"4" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u
"b" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u
"az" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[2]" ,
"type" , u
"PortionType::Footnote" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion[2]" ,
"expand" , u
"5" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"type" , u
"PortionType::FootnoteNum" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"expand" , u
"4" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[4]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u
"jkl" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"type" , u
"PortionType::FootnoteNum" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]" ,
"expand" , u
"5" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u
"m" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u
"n" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]" ,
"type" , u
"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/ftncont/ftn[5]/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[3]" ,
"portion" , u
"o" );
// verify after hide
dispatchCommand(mxComponent, u
".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines());
CheckRedlineFootnotesHidden();
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136588)
{
createSwDoc(
"tdf136588.docx" );
auto pXMLLayoutDump = parseLayoutDump();
CPPUNIT_ASSERT(pXMLLayoutDump);
//there was a bad line break before, the correct break layout is this:
assertXPath(pXMLLayoutDump,
"/root/page/body/txt[2]/SwParaPortion/SwLineLayout[2]" ,
"portion" ,
u
"effectively by modern-day small to " );
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableSplitBug)
{
createSwDoc(
"table-split-bug.fodt" );
{
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc,
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]//txt[1]/infos/bounds",
"height" , u
"276" );
assertXPath(pXmlDoc,
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]/infos/bounds" ,
"height" , u
"1274" );
}
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
pWrtShell->Down(
false , 1);
pWrtShell->Right(SwCursorSkipMode::Chars,
/*bSelect=*/true, 1, /*bBasicCall=*/false);
pWrtShell->
Delete ();
{
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
// the problem was that the paragraph in the left cell had height 0
assertXPath(pXmlDoc,
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]//txt[1]/infos/bounds",
"height" , u
"276" );
assertXPath(pXmlDoc,
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]/infos/bounds" ,
"height" , u
"1688" );
}
pWrtShell->Undo();
{
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
// the problem was that the paragraph in the left cell had height 0
assertXPath(pXmlDoc,
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]//txt[1]/infos/bounds",
"height" , u
"276" );
assertXPath(pXmlDoc,
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]/infos/bounds" ,
"height" , u
"1274" );
}
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableInSectionTruncated)
{
createSwDoc(
"table-in-section-truncated.fodt" );
{
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc,
"/root/page[1]/body/txt" , 20);
assertXPath(pXmlDoc,
"/root/page[1]/body/section/txt" , 0);
assertXPath(pXmlDoc,
"/root/page[1]/body/section/tab/row/cell/txt" , 1);
assertXPath(pXmlDoc,
"/root/page[2]/body/section/tab/row/cell/txt" , 2);
assertXPath(pXmlDoc,
"/root/page[2]/body/section/txt" , 1);
assertXPath(pXmlDoc,
"/root/page[2]/body/txt" , 0);
assertXPath(pXmlDoc,
"/root/page[2]/body/section/infos/bounds" ,
"bottom" , u
"11032" )
;
}
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
pWrtShell->Down(false , 19);
dispatchCommand(mxComponent, u".uno:InsertPagebreak" _ustr, {});
{
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt" , 20);
assertXPath(pXmlDoc, "/root/page[1]/body/section/txt" , 0);
assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row/cell/txt" , 0);
assertXPath(pXmlDoc, "/root/page[2]/body/txt" , 1);
assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/row/cell/txt" , 3);
assertXPath(pXmlDoc, "/root/page[2]/body/section/txt" , 1);
assertXPath(pXmlDoc, "/root/page[2]/body/section/infos/bounds" , "top" , u"10369" );
assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/infos/bounds" , "top" , u"10369" );
assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/infos/bounds" , "height" , u"940" );
assertXPath(pXmlDoc, "/root/page[2]/body/section/txt/infos/bounds" , "bottom" , u"11584" );
// problem was that the section bottom did not grow enough (only 11309)
assertXPath(pXmlDoc, "/root/page[2]/body/section/infos/bounds" , "bottom" , u"11584" );
}
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableInSectionSplitLoop)
{
createSwDoc("table-in-section-split-loop.fodt" );
static OUString constexpr var{ u"TEST_NO_LOOP_CONTROLS" _ustr };
osl_setEnvironment(var.pData, u"1" _ustr.pData);
comphelper::ScopeGuard g([] { osl_clearEnvironment(var.pData); });
CPPUNIT_ASSERT_EQUAL(0, SwLayouter::GetLastLoopControlStage());
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false);
pWrtShell->Delete ();
CPPUNIT_ASSERT_EQUAL(0, SwLayouter::GetLastLoopControlStage());
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
{
createSwDoc();
SwDoc* pDoc(getSwDoc());
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
SwRootFrame* pLayout(pWrtShell->GetLayout());
CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
pWrtShell->Insert(u"foo" _ustr);
pWrtShell->SplitNode(false );
pWrtShell->Insert(u"bar" _ustr);
pWrtShell->SplitNode(false );
pWrtShell->Insert(u"baz" _ustr);
SfxItemSet flySet(pDoc->GetAttrPool(),
svl::Items<RES_FRM_SIZE, RES_FRM_SIZE, RES_ANCHOR, RES_ANCHOR>);
SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR);
pWrtShell->StartOfSection(false );
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false);
anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
flySet.Put(anchor);
SwFormatFrameSize size(SwFrameSize::Minimum, 1000, 1000);
flySet.Put(size); // set a size, else we get 1 char per line...
SwFrameFormat const * pFly = pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true);
CPPUNIT_ASSERT(pFly != nullptr);
// move inside fly
pWrtShell->GotoFly(pFly->GetName(), FLYCNTTYPE_FRM, /*bSelFrame=*/false);
pWrtShell->Insert(u"abc" _ustr);
pWrtShell->SplitNode(false );
pWrtShell->Insert(u"def" _ustr);
pWrtShell->SplitNode(false );
pWrtShell->Insert(u"ghi" _ustr);
dispatchCommand(mxComponent, u".uno:TrackChanges" _ustr, {});
// delete redline inside fly
pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 2, /*bBasicCall=*/false);
pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 8, /*bBasicCall=*/false);
pWrtShell->Delete ();
pWrtShell->SttEndDoc(true ); // note: SttDoc actually moves to start of fly?
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 2, /*bBasicCall=*/false);
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 7, /*bBasicCall=*/false);
pWrtShell->Delete ();
for (int i = 0; i < 2; ++i)
{
if (i == 1) // secondly, try with different anchor type
{
anchor.SetType(RndStdIds::FLY_AT_PARA);
SwPosition pos(*anchor.GetAnchorNode());
pos.nContent.Assign(nullptr, 0);
anchor.SetAnchor(&pos);
pDoc->SetAttr(anchor, *const_cast <SwFrameFormat*>(pFly));
}
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines());
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged" , "paraPropsNodeIndex" , u"14" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u"foaz" );
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged" ,
"paraPropsNodeIndex" , u"6" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"portion" , u"ahi" );
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
pXmlDoc = parseLayoutDump();
// show: nothing is merged
assertXPath(pXmlDoc, "//merged", 0);
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"fo" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"o" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"a" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"portion" , u"bc" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"portion" , u"def" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"g" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"portion" , u"hi" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u"bar" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"b" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"az" );
}
// anchor to 2nd (deleted) paragraph
pWrtShell->StartOfSection();
pWrtShell->Down(false , 1);
anchor.SetType(RndStdIds::FLY_AT_CHAR);
anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
pDoc->SetAttr(anchor, *const_cast <SwFrameFormat*>(pFly));
for (int i = 0; i < 2; ++i)
{
if (i == 1) // secondly, try with different anchor type
{
anchor.SetType(RndStdIds::FLY_AT_PARA);
SwPosition pos(*anchor.GetAnchorNode());
pos.nContent.Assign(nullptr, 0);
anchor.SetAnchor(&pos);
pDoc->SetAttr(anchor, *const_cast <SwFrameFormat*>(pFly));
}
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines());
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged" , "paraPropsNodeIndex" , u"14" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u"foaz" );
// hide: no anchored object shown
assertXPath(pXmlDoc, "//anchored", 0);
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
pXmlDoc = parseLayoutDump();
// show: nothing is merged
assertXPath(pXmlDoc, "//merged", 0);
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"fo" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"o" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u"bar" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"a" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"portion" , u"bc" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"portion" , u"def" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"g" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"portion" , u"hi" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"b" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"az" );
}
// anchor to 3rd paragraph
pWrtShell->EndOfSection();
anchor.SetType(RndStdIds::FLY_AT_CHAR);
anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
pDoc->SetAttr(anchor, *const_cast <SwFrameFormat*>(pFly));
for (int i = 0; i < 2; ++i)
{
if (i == 1) // secondly, try with different anchor type
{
anchor.SetType(RndStdIds::FLY_AT_PARA);
SwPosition pos(*anchor.GetAnchorNode());
pos.nContent.Assign(nullptr, 0);
anchor.SetAnchor(&pos);
pDoc->SetAttr(anchor, *const_cast <SwFrameFormat*>(pFly));
}
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines());
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged" , "paraPropsNodeIndex" , u"14" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u"foaz" );
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged" ,
"paraPropsNodeIndex" , u"6" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"portion" , u"ahi" );
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
pXmlDoc = parseLayoutDump();
// show: nothing is merged
assertXPath(pXmlDoc, "//merged", 0);
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"fo" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"o" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u"bar" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"b" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" , "type" ,
u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"az" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"a" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"portion" , u"bc" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"portion" , u"def" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"g" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"portion" , u"hi" );
}
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFlyHiddenParagraph)
{
// disable Field Names warning dialog
const bool bAsk = officecfg::Office::Common::Misc::QueryShowFieldName::get();
std::shared_ptr<comphelper::ConfigurationChanges> xChanges;
if (bAsk)
{
xChanges = comphelper::ConfigurationChanges::create();
officecfg::Office::Common::Misc::QueryShowFieldName::set(false , xChanges);
xChanges->commit();
}
createSwDoc("fly_hidden_paragraph.fodt" );
// first, disable both so para gets hidden
uno::Sequence<beans::PropertyValue> argsSH(
comphelper::InitPropertySequence({ { "ShowHiddenParagraphs" , uno::Any(false ) } }));
dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs" , argsSH);
uno::Sequence<beans::PropertyValue> args(
comphelper::InitPropertySequence({ { "Fieldnames" , uno::Any(false ) } }));
dispatchCommand(mxComponent, ".uno:Fieldnames" , args);
Scheduler::ProcessEventsToIdle();
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly/txt/infos/bounds" , "height" , u"0" );
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly/infos/bounds" , "height" , u"448" );
// the problem was that now the fly was the same height as before hiding
dispatchCommand(mxComponent, ".uno:Fieldnames" , {});
Scheduler::ProcessEventsToIdle();
pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly/txt/infos/bounds" , "height" ,
u"828" );
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly/infos/bounds" , "height" , u"1000" );
dispatchCommand(mxComponent, ".uno:Fieldnames" , {});
Scheduler::ProcessEventsToIdle();
pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly/txt/infos/bounds" , "height" , u"0" );
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly/infos/bounds" , "height" , u"448" );
dispatchCommand(mxComponent, ".uno:Fieldnames" , {});
Scheduler::ProcessEventsToIdle();
pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly/txt/infos/bounds" , "height" ,
u"828" );
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly/infos/bounds" , "height" , u"1000" );
// other test like testTdf143239 and testTdf159101 depend on this;
// seems getting the previous value is only possible with a listener
// so just hardcode it...
dispatchCommand(mxComponent, ".uno:Fieldnames" , args);
Scheduler::ProcessEventsToIdle();
if (bAsk)
{
officecfg::Office::Common::Misc::QueryShowFieldName::set(true , xChanges);
xChanges->commit();
}
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFieldHideSection)
{
createSwDoc("field_hide_section.fodt" );
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row" , 1);
assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/row" , 1);
assertXPath(pXmlDoc, "/root/page" , 2);
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
::std::unique_ptr<SwField> pField(pWrtShell->GetCurField()->CopyField());
SwFieldMgr manager(pWrtShell);
pWrtShell->StartAllAction();
manager.UpdateCurField(10000 /*(?)*/, "Foo", "1", std::move(pField));
pWrtShell->EndAllAction();
Scheduler::ProcessEventsToIdle();
pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row" , 2);
assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row[1]/infos/bounds" , "height" , u"0" );
assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row[2]/infos/bounds" , "height" , u"0" );
assertXPath(pXmlDoc, "/root/page[1]/body/section/infos/bounds" , "height" , u"0" );
// the problem was that there were 3 pages now
assertXPath(pXmlDoc, "/root/page" , 1);
pWrtShell->StartAllAction();
manager.UpdateCurField(10000 /*(?)*/, "Foo", "0", std::move(pField));
pWrtShell->EndAllAction();
Scheduler::ProcessEventsToIdle();
pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row" , 1);
assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/row" , 1);
assertXPath(pXmlDoc, "/root/page" , 2);
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestI94666)
{
createSwDoc("i94666.odt" );
{
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page" , 2);
assertXPath(
pXmlDoc,
"/root/page[2]/body/section/txt[1]/SwParaPortion/SwLineLayout[1]/SwLinePortion[1]" ,
"portion" , u"pulled off " );
}
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
pWrtShell->GotoPage(2, false );
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 11, /*bBasicCall=*/false);
pWrtShell->SetMark();
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 11, /*bBasicCall=*/false);
pWrtShell->DelToEndOfPara();
{
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
// the problem was that the last paragraph moved to page 3
assertXPath(
pXmlDoc,
"/root/page[2]/body/section/txt[1]/SwParaPortion/SwLineLayout[1]/SwLinePortion[1]" ,
"portion" ,
u"Widows & orphans He heard quiet steps behind him. That didn't bode well. Who could "
u"be "
"following" );
assertXPath(
pXmlDoc,
"/root/page[2]/body/section/txt[1]/SwParaPortion/SwLineLayout[3]/SwLinePortion[1]" ,
"portion" , u"pulled off " );
assertXPath(
pXmlDoc,
"/root/page[2]/body/section/txt[2]/SwParaPortion/SwLineLayout[1]/SwParaPortion[1]" ,
"portion" , u"Moved paragraph" );
assertXPath(pXmlDoc, "/root/page[2]//txt", 3);
assertXPath(pXmlDoc, "/root/page" , 2);
}
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272)
{
createSwDoc("tdf134472.odt" );
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds" , "height" , u"843" );
assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds" , "bottom" , u"2819" );
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestNestedTableMoveFwd)
{
createSwDoc("tabellen_test_windows_1.odt" );
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
// the row with the nested table should not be split but be the first row on page 2
assertXPathContent(pXmlDoc, "/root/page[1]/body/tab[1]/row[last()]/cell[1]/txt[1]" ,
u"Tabelle 1" );
assertXPathContent(pXmlDoc,
"/root/page[2]/body/tab[1]/row[1]/cell[1]/tab[1]/row[1]/cell[1]/txt" ,
u"Tabelle 2" );
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613)
{
createSwDoc("tdf136613.docx" );
SwDoc* pDoc = getSwDoc();
//get the flys and the root frame
const auto vFlyFormats = pDoc->GetFlyFrameFormats(FLYCNTTYPE_ALL, true );
const auto vFrames = pDoc->GetAllLayouts();
CPPUNIT_ASSERT(!vFrames.empty());
CPPUNIT_ASSERT(!vFlyFormats.empty());
//get the page frame from the root
SwFrame* pPageFrame = vFrames[0]->Lower();
CPPUNIT_ASSERT(pPageFrame);
//get the rectangle of the page
const SwRect& rPageRect = pPageFrame->getFrameArea();
//check the flys and...
for (auto pFlyFormat : vFlyFormats)
{
//...the rectangle of the fly location...
const SwRect aRect = pFlyFormat->FindLayoutRect();
CPPUNIT_ASSERT(!aRect.IsEmpty());
//...if it is on the page. This will fail if not.
CPPUNIT_ASSERT_MESSAGE("The pictures are outside the page!" , rPageRect.Contains(aRect));
}
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf88496)
{
createSwDoc("tdf88496.docx" );
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
// This was 4, table fallback "switch off repeating header" started on a new page
assertXPath(pXmlDoc, "/root/page" , 3);
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader)
{
createSwDoc();
SwDoc* pDoc(getSwDoc());
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
SwRootFrame* pLayout(pWrtShell->GetLayout());
CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
pWrtShell->ChangeHeaderOrFooter(UIName(u"Default Page Style" _ustr), /*bHeader*/ true,
/*bOn*/ true, false);
CPPUNIT_ASSERT(
pWrtShell
->IsInHeaderFooter()); // assume this is supposed to put cursor in the new header...
pWrtShell->Insert(u"foo" _ustr);
pWrtShell->SplitNode(false );
pWrtShell->Insert(u"bar" _ustr);
pWrtShell->SplitNode(false );
pWrtShell->Insert(u"baz" _ustr);
SfxItemSet flySet(pDoc->GetAttrPool(),
svl::Items<RES_FRM_SIZE, RES_FRM_SIZE, RES_ANCHOR, RES_ANCHOR>);
SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR);
pWrtShell->StartOfSection(false );
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false);
anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
flySet.Put(anchor);
SwFormatFrameSize size(SwFrameSize::Minimum, 1000, 1000);
flySet.Put(size); // set a size, else we get 1 char per line...
SwFrameFormat const * pFly = pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true);
CPPUNIT_ASSERT(pFly != nullptr);
// move inside fly
pWrtShell->GotoFly(pFly->GetName(), FLYCNTTYPE_FRM, /*bSelFrame=*/false);
pWrtShell->Insert(u"abc" _ustr);
pWrtShell->SplitNode(false );
pWrtShell->Insert(u"def" _ustr);
pWrtShell->SplitNode(false );
pWrtShell->Insert(u"ghi" _ustr);
dispatchCommand(mxComponent, u".uno:TrackChanges" _ustr, {});
// delete redline inside fly
pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 2, /*bBasicCall=*/false);
pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 8, /*bBasicCall=*/false);
pWrtShell->Delete ();
pWrtShell->GotoHeaderText();
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 2, /*bBasicCall=*/false);
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 7, /*bBasicCall=*/false);
pWrtShell->Delete ();
for (int i = 0; i < 2; ++i)
{
if (i == 1) // secondly, try with different anchor type
{
anchor.SetType(RndStdIds::FLY_AT_PARA);
SwPosition pos(*anchor.GetAnchorNode());
pos.nContent.Assign(nullptr, 0);
anchor.SetAnchor(&pos);
pDoc->SetAttr(anchor, *const_cast <SwFrameFormat*>(pFly));
}
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines());
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]" , "length" ,
u"0" );
assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/merged" , "paraPropsNodeIndex" , u"6" );
assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[1]" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout[1]" , "portion" ,
u"foaz" );
assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/merged" ,
"paraPropsNodeIndex" , u"11" );
assertXPath(
pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout[1]" ,
"type" , u"PortionType::Para" );
assertXPath(
pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout[1]" ,
"portion" , u"ahi" );
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
pXmlDoc = parseLayoutDump();
// show: nothing is merged
assertXPath(pXmlDoc, "//merged", 0);
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]" , "length" ,
u"0" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"fo" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"o" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"a" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"portion" , u"bc" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"portion" , u"def" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"g" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"portion" , u"hi" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u"bar" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"b" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"az" );
}
// anchor to 2nd (deleted) paragraph
pWrtShell->StartOfSection();
pWrtShell->Down(false , 1);
anchor.SetType(RndStdIds::FLY_AT_CHAR);
anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
pDoc->SetAttr(anchor, *const_cast <SwFrameFormat*>(pFly));
for (int i = 0; i < 2; ++i)
{
if (i == 1) // secondly, try with different anchor type
{
anchor.SetType(RndStdIds::FLY_AT_PARA);
SwPosition pos(*anchor.GetAnchorNode());
pos.nContent.Assign(nullptr, 0);
anchor.SetAnchor(&pos);
pDoc->SetAttr(anchor, *const_cast <SwFrameFormat*>(pFly));
}
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines());
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
// now the frame has no Text portion? not sure why it's a 0-length one first and now none?
// assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type", "PortionType::Para");
// assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "length", "0");
assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/merged" , "paraPropsNodeIndex" , u"6" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u"foaz" );
// hide: no anchored object shown
assertXPath(pXmlDoc, "//anchored", 0);
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
pXmlDoc = parseLayoutDump();
// show: nothing is merged
assertXPath(pXmlDoc, "//merged", 0);
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"length" , u"0" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"fo" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"o" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u"bar" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"a" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"portion" , u"bc" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"portion" , u"def" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"g" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"portion" , u"hi" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"b" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"az" );
}
// anchor to 3rd paragraph
pWrtShell->EndOfSection();
anchor.SetType(RndStdIds::FLY_AT_CHAR);
anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
pDoc->SetAttr(anchor, *const_cast <SwFrameFormat*>(pFly));
for (int i = 0; i < 2; ++i)
{
if (i == 1) // secondly, try with different anchor type
{
anchor.SetType(RndStdIds::FLY_AT_PARA);
SwPosition pos(*anchor.GetAnchorNode());
pos.nContent.Assign(nullptr, 0);
anchor.SetAnchor(&pos);
pDoc->SetAttr(anchor, *const_cast <SwFrameFormat*>(pFly));
}
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines());
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"length" , u"0" );
assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/merged" , "paraPropsNodeIndex" , u"6" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u"foaz" );
assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/merged" ,
"paraPropsNodeIndex" , u"11" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"portion" , u"ahi" );
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges" _ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
pXmlDoc = parseLayoutDump();
// show: nothing is merged
assertXPath(pXmlDoc, "//merged", 0);
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" , "type" ,
u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"length" , u"0" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"fo" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"o" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]" ,
"portion" , u"bar" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]" ,
"portion" , u"b" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]" ,
"portion" , u"az" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"a" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
"SwLinePortion[2]" ,
"portion" , u"bc" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"type" , u"PortionType::Para" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
"SwParaPortion[1]" ,
"portion" , u"def" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"type" , u"PortionType::Text" );
assertXPath(pXmlDoc,
"/root/page[1]/header/txt[3]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
"SwLinePortion[1]" ,
"portion" , u"g" );
assertXPath(pXmlDoc,
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5 C=94 H=87 G=90
¤ Dauer der Verarbeitung: 0.22 Sekunden
¤
*© Formatika GbR, Deutschland