[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/textinput.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 11 +++ sw/source/filter/ww8/docxexport.cxx |7 +-- 3 files changed, 16 insertions(+), 2 deletions(-) New commits: commit d179d77b6743ffb7d77bb3671b3e49ee19d76ba3 Author: Ilhan Yesil AuthorDate: Thu May 23 17:52:04 2019 +0200 Commit: Thorsten Behrens CommitDate: Fri May 31 00:41:14 2019 +0200 tdf#125103 Writer: input fields will be exported to docx Changed the solution https://gerrit.libreoffice.org/#/c/70786/ of Vasily sligthly, so MS Office can recognize fields still as fields. ooxmlexport13 is not present in the 5.2 branch, so test case is merged into ooxmlexport7. Reviewed-on: https://gerrit.libreoffice.org/72868 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk (cherry picked from commit 62d156ef0daccd2680161ef8b9b99d8a7bc0) Change-Id: Id45330a96dfe002685c6ef3dc62e408c5f9f46c4 Reviewed-on: https://gerrit.libreoffice.org/73079 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/sw/qa/extras/ooxmlexport/data/textinput.odt b/sw/qa/extras/ooxmlexport/data/textinput.odt new file mode 100644 index ..04b8d054c354 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/textinput.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 4b3f0f1acf03..cfe5dd9c13fe 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -1910,6 +1910,17 @@ DECLARE_OOXMLEXPORT_TEST(testSignatureLineShape, "signature-line-all-props-set.d CPPUNIT_ASSERT_EQUAL(OUString("Check the machines!"), aSigningInstructions); } +DECLARE_OOXMLEXPORT_TEST(testTextInput, "textinput.odt") +{ +xmlDocPtr pXmlDoc = parseExport("word/document.xml"); +if (!pXmlDoc) +return; +// Ensure we have a formfield +assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[3]/w:instrText", " FILLIN \"\""); +// and it's content is not gone +assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[5]/w:t", "SomeText"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 2abbe899f130..063b76b2e90a 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -365,9 +365,12 @@ void DocxExport::DoComboBox(const OUString& rName, m_pDocumentFS->endElementNS( XML_w, XML_ffData ); } -void DocxExport::DoFormText(const SwInputField* /*pField*/) +void DocxExport::DoFormText(const SwInputField* pField) { -OSL_TRACE( "TODO DocxExport::ForFormText()" ); + +assert(pField); +const OUString sStr = FieldString(ww::eFILLIN) + "\"" + pField->GetPar2() + "\""; +OutputField(pField, ww::eFILLIN, sStr); } OString DocxExport::OutputChart( uno::Reference< frame::XModel >& xModel, sal_Int32 nCount, ::sax_fastparser::FSHelperPtr m_pSerializer ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/qa sw/source
sw/qa/extras/layout/data/tdf123898.odt |binary sw/qa/extras/uiwriter/uiwriter.cxx | 14 +++ sw/source/core/txtnode/txtedt.cxx | 59 + 3 files changed, 17 insertions(+), 56 deletions(-) New commits: commit 084b1c1f0a65d5e4743ae40407ccd628dbdb3864 Author: Samuel Mehrbrodt AuthorDate: Fri Mar 8 16:38:49 2019 +0100 Commit: Michael Weghorn CommitDate: Thu May 9 16:33:49 2019 +0200 tdf#123898 Fix frame content misaligned Frame was correctly formatted until spellchecker comes and calls GetCharRect which somehow reformats the frame causes the misalignment. So instead of calling GetCharRect, just call GetPaintArea as the frame is already formatted at this point. Reviewed-on: https://gerrit.libreoffice.org/68927 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt (cherry picked from commit 86567ebde2d38c44aae93064b8c102f365641f81) Change-Id: I31df9140174c40cf4cf39891490301cbe4c5806a (cherry picked from commit f3c5731b1c4fd9d5e7d41782fa6c308e72b73946) Reviewed-on: https://gerrit.libreoffice.org/72050 Reviewed-by: Michael Weghorn Tested-by: Michael Weghorn diff --git a/sw/qa/extras/layout/data/tdf123898.odt b/sw/qa/extras/layout/data/tdf123898.odt new file mode 100644 index ..31800aadb18b Binary files /dev/null and b/sw/qa/extras/layout/data/tdf123898.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 99e7bc5b20f7..73530817ce34 100755 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -116,6 +116,7 @@ public: void testFdo70807(); void testImportRTF(); void testExportRTF(); +void testTdf123898(); void testTdf67238(); void testFdo75110(); void testFdo75898(); @@ -232,6 +233,7 @@ public: CPPUNIT_TEST(testFdo70807); CPPUNIT_TEST(testImportRTF); CPPUNIT_TEST(testExportRTF); +CPPUNIT_TEST(testTdf123898); CPPUNIT_TEST(testTdf67238); CPPUNIT_TEST(testFdo75110); CPPUNIT_TEST(testFdo75898); @@ -491,6 +493,18 @@ void SwUiWriterTest::testBookmarkCopy() } } +void SwUiWriterTest::testTdf123898() +{ +load("sw/qa/extras/layout/data/", "tdf123898.odt"); + +// Make sure spellchecker has done its job already +Scheduler::ProcessEventsToIdle(); + +xmlDocPtr pXmlDoc = parseLayoutDump(); +// Make sure that the arrow on the left is not there (there are 43 children if it's there) +assertXPathChildren(pXmlDoc, "/root/page/body/txt/anchored/fly/txt", 42); +} + void SwUiWriterTest::testTdf67238() { //create a new writer document diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 57d0694367ee..3974652e67f5 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -178,71 +178,18 @@ lcl_MaskRedlinesAndHiddenText( const SwTextNode& rNode, OUStringBuffer& rText, */ static SwRect lcl_CalculateRepaintRect( SwTextFrame& rTextFrame, sal_Int32 nChgStart, sal_Int32 nChgEnd ) { -SwRect aRect; - -SwTextNode *pNode = rTextFrame.GetTextNode(); - -SwNodeIndex aNdIdx( *pNode ); -SwPosition aPos( aNdIdx, SwIndex( pNode, nChgEnd ) ); -SwCursorMoveState aTmpState( MV_NONE ); -aTmpState.m_b2Lines = true; -rTextFrame.GetCharRect( aRect, aPos, ); -// information about end of repaint area -Sw2LinesPos* pEnd2Pos = aTmpState.m_p2Lines; - -const SwTextFrame *pEndFrame = - -while( pEndFrame->HasFollow() && - nChgEnd >= pEndFrame->GetFollow()->GetOfst() ) -pEndFrame = pEndFrame->GetFollow(); - -if ( pEnd2Pos ) -{ -// we are inside a special portion, take left border -SWRECTFN( pEndFrame ) -(aRect.*fnRect->fnSetTop)( (pEnd2Pos->aLine.*fnRect->fnGetTop)() ); -if ( pEndFrame->IsRightToLeft() ) -(aRect.*fnRect->fnSetLeft)( (pEnd2Pos->aPortion.*fnRect->fnGetLeft)() ); -else -(aRect.*fnRect->fnSetLeft)( (pEnd2Pos->aPortion.*fnRect->fnGetRight)() ); -(aRect.*fnRect->fnSetWidth)( 1 ); -(aRect.*fnRect->fnSetHeight)( (pEnd2Pos->aLine.*fnRect->fnGetHeight)() ); -delete pEnd2Pos; -} +SwRect aRect = rTextFrame.GetPaintArea(); +SwRect aTmp = rTextFrame.GetPaintArea(); -aTmpState.m_p2Lines = nullptr; -SwRect aTmp; -aPos = SwPosition( aNdIdx, SwIndex( pNode, nChgStart ) ); -rTextFrame.GetCharRect( aTmp, aPos, ); - -// i63141: GetCharRect(..) could cause a formatting, -// during the formatting SwTextFrames could be joined, deleted, created... -// => we have to reinit pStartFrame and pEndFrame after the formatting const SwTextFrame* pStartFrame = while( pStartFrame->HasFollow() && nChgStart >= pStartFrame->GetFollow()->GetOfst() ) pStartFrame = pStartFrame->GetFollow(); -pEndFrame = pStartFrame; +const SwTextFrame* pEndFrame =
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/qa sw/source
sw/qa/extras/mailmerge/data/db_pagecounttest.ods |binary sw/qa/extras/mailmerge/data/pagecounttest.ott|binary sw/qa/extras/mailmerge/mailmerge.cxx | 70 +++ sw/source/uibase/dbui/dbmgr.cxx |5 - 4 files changed, 73 insertions(+), 2 deletions(-) New commits: commit 2798db11205695e1ca5355cad4d1fda213f329b1 Author: Ilhan Yesil AuthorDate: Wed Jan 30 17:43:56 2019 +0100 Commit: Thorsten Behrens CommitDate: Fri Feb 22 18:07:47 2019 +0100 tdf#123057 Correct page count in mail merge if sections are hidden Remove of invisible content has influence on page count and therefore on fields for page count. So straight after removing invisible content in the mail merge process, the layout has to be updated before fields are converted to text. Reviewed-on: https://gerrit.libreoffice.org/67343 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit b42b3acd043e3d464e2751ff17b0fda462ed62bd) Change-Id: If43f9921b6797c7ceb112860cda4baf4978c36bc Reviewed-on: https://gerrit.libreoffice.org/68206 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/sw/qa/extras/mailmerge/data/db_pagecounttest.ods b/sw/qa/extras/mailmerge/data/db_pagecounttest.ods new file mode 100644 index ..4b9f90ec9098 Binary files /dev/null and b/sw/qa/extras/mailmerge/data/db_pagecounttest.ods differ diff --git a/sw/qa/extras/mailmerge/data/pagecounttest.ott b/sw/qa/extras/mailmerge/data/pagecounttest.ott new file mode 100644 index ..d7f63419c2b7 Binary files /dev/null and b/sw/qa/extras/mailmerge/data/pagecounttest.ott differ diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx index e2fc6d26ac39..6addcfb5f13f 100644 --- a/sw/qa/extras/mailmerge/mailmerge.cxx +++ b/sw/qa/extras/mailmerge/mailmerge.cxx @@ -544,5 +544,75 @@ DECLARE_SHELL_MAILMERGE_TEST(test_sections_first_last, "sections_first_last.odt" } } +DECLARE_FILE_MAILMERGE_TEST(testTdf123057_file, "pagecounttest.ott", "db_pagecounttest.ods", "Sheet1") +{ +executeMailMerge(true); + +for (int doc = 0; doc < 4; ++doc) +{ +loadMailMergeDocument(doc); + +// get document properties +uno::Reference xSectionsSupplier(mxComponent, uno::UNO_QUERY_THROW); +uno::Reference xSections(xSectionsSupplier->getTextSections(), uno::UNO_QUERY_THROW); + +CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xSections->getCount()); +uno::Reference xSect0(xSections->getByIndex(0), uno::UNO_QUERY_THROW); +uno::Reference xSect1(xSections->getByIndex(1), uno::UNO_QUERY_THROW); + +OUString sFieldPageCount; +uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); +uno::Reference xFields(xFieldsAccess->createEnumeration()); + +if (xFields.is()) +{ +while (xFields->hasMoreElements()) +{ +uno::Any aField = xFields->nextElement(); +uno::Reference xServiceInfo(aField, uno::UNO_QUERY); +if (xServiceInfo->supportsService("com.sun.star.text.textfield.PageCount")) +{ +uno::Reference xField(aField, uno::UNO_QUERY); +sFieldPageCount = xField->getAnchor()->getString(); +} +} +} + +switch (doc) +{ +case 0: +// both sections visible, page num is 2 +CPPUNIT_ASSERT_EQUAL(2, getPages()); +CPPUNIT_ASSERT_EQUAL(true, getProperty(xSect0, "IsCurrentlyVisible")); +CPPUNIT_ASSERT_EQUAL(true, getProperty(xSect1, "IsCurrentlyVisible")); +CPPUNIT_ASSERT_EQUAL(OUString("2"), sFieldPageCount); +break; +case 1: +// second section hidden, page num is 1 +CPPUNIT_ASSERT_EQUAL(1, getPages()); +CPPUNIT_ASSERT_EQUAL(true, getProperty(xSect0, "IsCurrentlyVisible")); +CPPUNIT_ASSERT_EQUAL(false, getProperty(xSect1, "IsCurrentlyVisible")); +CPPUNIT_ASSERT_EQUAL(OUString("1"), sFieldPageCount); +break; +case 2: +// first section hidden, page num is 1 +CPPUNIT_ASSERT_EQUAL(1, getPages()); +CPPUNIT_ASSERT_EQUAL(false, getProperty(xSect0, "IsCurrentlyVisible")); +CPPUNIT_ASSERT_EQUAL(true, getProperty(xSect1, "IsCurrentlyVisible")); +CPPUNIT_ASSERT_EQUAL(OUString("1"), sFieldPageCount); +break; +case 3: +// both sections hidden, page num is 1 +CPPUNIT_ASSERT_EQUAL(1, getPages()); +CPPUNIT_ASSERT_EQUAL(false, getProperty(xSect0, "IsCurrentlyVisible")); +CPPUNIT_ASSERT_EQUAL(false, getProperty(xSect1, "IsCurrentlyVisible")); +
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf121456_tabsOffset.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 11 ++ sw/source/filter/ww8/docxattributeoutput.cxx | 27 +++-- 3 files changed, 29 insertions(+), 9 deletions(-) New commits: commit 24eff43ac009558121f15d188b1d1ab6ffc81372 Author: Serge Krot AuthorDate: Fri Nov 16 09:53:37 2018 +0100 Commit: Thorsten Behrens CommitDate: Mon Nov 26 13:40:27 2018 +0100 tdf#121456: sw: DOCX: tabs export and TABS_RELATIVE_TO_INDENT prop In DOCX, w:pos specifies the position of the current custom tab stop with respect to the current page margins. But in ODT, zero position could be page margins or paragraph indent according to used settings DocumentSettingId::TABS_RELATIVE_TO_INDENT Added new unit test. Change-Id: Ic56a8527380b6562f4239df1edce0c9b4649af24 Reviewed-on: https://gerrit.libreoffice.org/63460 Tested-by: Jenkins Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens Reviewed-on: https://gerrit.libreoffice.org/64035 diff --git a/sw/qa/extras/ooxmlexport/data/tdf121456_tabsOffset.odt b/sw/qa/extras/ooxmlexport/data/tdf121456_tabsOffset.odt new file mode 100755 index ..ff8d5400950b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf121456_tabsOffset.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 4da51b6b87a1..b3ba248cc210 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -53,6 +53,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf46938_clearTabStop, "tdf46938_clearTabStop.docx" CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty< uno::Sequence >(getParagraph(1), "ParaTabStops").getLength()); } +DECLARE_OOXMLEXPORT_TEST(testTdf121456_tabsOffset, "tdf121456_tabsOffset.odt") +{ +for (int i=2; i<8; i++) +{ +uno::Sequence< style::TabStop > stops = getProperty< uno::Sequence >(getParagraph( i ), "ParaTabStops"); +CPPUNIT_ASSERT_EQUAL( sal_Int32(1), stops.getLength()); +CPPUNIT_ASSERT_EQUAL( css::style::TabAlign_RIGHT, stops[ 0 ].Alignment ); +CPPUNIT_ASSERT_EQUAL( sal_Int32(17000), stops[ 0 ].Position ); +} +} + DECLARE_OOXMLEXPORT_TEST(testTdf82065_Ind_start_strict, "tdf82065_Ind_start_strict.docx") { uno::Reference xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index fcd5bcf5f498..8ba68c790338 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7443,8 +7443,8 @@ void DocxAttributeOutput::ParaWidows( const SvxWidowsItem& rWidows ) m_pSerializer->singleElementNS( XML_w, XML_widowControl, FSNS( XML_w, XML_val ), "false", FSEND ); } -static void impl_WriteTabElement( FSHelperPtr pSerializer, - const SvxTabStop& rTab, long /* nCurrentLeft */ ) +static void impl_WriteTabElement( FSHelperPtr const & pSerializer, + const SvxTabStop& rTab, long tabsOffset ) { FastAttributeList *pTabElementAttrList = FastSerializerHelper::createAttrList(); @@ -7466,9 +7466,11 @@ static void impl_WriteTabElement( FSHelperPtr pSerializer, break; } -// Because GetTabPos already includes indent, we don't need to add nCurrentLeft (CurrentLeft is indentation information) -//pTabElementAttrList->add( FSNS( XML_w, XML_pos ), OString::valueOf( rTab.GetTabPos() + nCurrentLeft ) ); -pTabElementAttrList->add( FSNS( XML_w, XML_pos ), OString::number( rTab.GetTabPos()) ); +// Write position according to used offset of the whole paragraph. +// In DOCX, w:pos specifies the position of the current custom tab stop with respect to the current page margins. +// But in ODT, zero position could be page margins or paragraph indent according to used settings. +// This is handled outside of this method and provided for us in tabsOffset parameter. +pTabElementAttrList->add( FSNS( XML_w, XML_pos ), OString::number( rTab.GetTabPos() + tabsOffset ) ); sal_Unicode cFillChar = rTab.GetFill(); @@ -7488,9 +7490,6 @@ static void impl_WriteTabElement( FSHelperPtr pSerializer, void DocxAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop ) { -const SfxPoolItem* pLR = m_rExport.HasItem( RES_LR_SPACE ); -long nCurrentLeft = pLR ? static_cast(pLR)->GetTextLeft() : 0; - sal_uInt16 nCount = rTabStop.Count(); // must contain at least one , so don't write it empty @@ -7504,10 +7503,20 @@ void DocxAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop ) m_pSerializer->startElementNS( XML_w, XML_tabs, FSEND ); +// Get offset for tabs +// In DOCX, w:pos specifies the position of the current
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/qa sw/source
sw/qa/extras/odfexport/data/tdf118393.odt |binary sw/qa/extras/odfexport/odfexport.cxx| 47 + sw/qa/extras/ooxmlexport/data/tdf118393.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx| 51 sw/source/filter/ww8/wrtw8sty.cxx |9 +++- sw/source/filter/ww8/wrtww8.cxx |1 sw/source/filter/ww8/wrtww8.hxx |1 sw/source/filter/ww8/ww8atr.cxx | 31 - 8 files changed, 137 insertions(+), 3 deletions(-) New commits: commit ddfe489930704e0380e09da5755599daa3ae4ab0 Author: Serge Krot AuthorDate: Wed Jun 27 11:18:41 2018 +0200 Commit: Thorsten Behrens CommitDate: Fri Sep 21 11:21:28 2018 +0200 tdf#118393: FILESAVE: DOCX Export loses header/footer Change-Id: If47a2e4953e4b98f41c9115779522a755eea8192 Reviewed-on: https://gerrit.libreoffice.org/56522 Tested-by: Jenkins Reviewed-by: Thorsten Behrens Reviewed-on: https://gerrit.libreoffice.org/60823 Tested-by: Thorsten Behrens diff --git a/sw/qa/extras/odfexport/data/tdf118393.odt b/sw/qa/extras/odfexport/data/tdf118393.odt new file mode 100755 index ..ff8d5400950b Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf118393.odt differ diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index fbb9df3a9f9d..8a3662f623a6 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -905,6 +905,53 @@ DECLARE_ODFEXPORT_TEST(testFdo86963, "fdo86963.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount()); } +// Check for correct header/footer with special first page with TOC inside: +// - DECLARE_ODFEXPORT_TEST(testTdf118393, "tdf118393.odt") +// - DECLARE_OOXMLEXPORT_TEST(testTdf118393, "tdf118393.odt") +DECLARE_ODFEXPORT_TEST(testTdf118393, "tdf118393.odt") +{ +CPPUNIT_ASSERT_EQUAL( 7, getPages() ); + +// First page has no header/footer +{ +xmlDocPtr pXmlDoc = parseLayoutDump(); + +// check first page +xmlXPathObjectPtr pXmlPage1Header = getXPathNode(pXmlDoc, "/root/page[1]/header"); +CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlPage1Header->nodesetval)); + +xmlXPathObjectPtr pXmlPage1Footer = getXPathNode(pXmlDoc, "/root/page[1]/footer"); +CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlPage1Footer->nodesetval)); + +// check second page in the same way +xmlXPathObjectPtr pXmlPage2Header = getXPathNode(pXmlDoc, "/root/page[2]/header"); +CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlPage2Header->nodesetval)); + +xmlXPathObjectPtr pXmlPage2Footer = getXPathNode(pXmlDoc, "/root/page[2]/footer"); +CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlPage2Footer->nodesetval)); + } + +// All other pages should have header/footer + +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[2]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[2]/footer/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[3]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[3]/footer/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[4]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[4]/footer/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[5]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[5]/footer/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[6]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[6]/footer/txt/text()")); + +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[7]/header/txt/text()")); +CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"), parseDump("/root/page[7]/footer/txt/text()")); +} + DECLARE_ODFEXPORT_TEST(testGerrit13858, "gerrit13858.odt") { // Just make sure the output is valid. diff --git a/sw/qa/extras/ooxmlexport/data/tdf118393.odt b/sw/qa/extras/ooxmlexport/data/tdf118393.odt new file mode 100644 index ..ff8d5400950b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf118393.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 90968b7a53d0..76dc7a87153f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -119,6 +119,53 @@ DECLARE_OOXMLEXPORT_TEST(testFooterBodyDistance, "footer-body-distance.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:br", 1); } +// Check for correct header/footer with special first
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/qa sw/source
Rebased ref, commits from common ancestor: commit ff536c6c479a160932e316e5099848151091b63c Author: Serge Krot AuthorDate: Fri Aug 24 13:31:54 2018 +0200 Commit: Thorsten Behrens CommitDate: Fri Aug 31 17:36:05 2018 +0200 sw: fix inconsistent bookmark behavior around at-char/as-char anchored frames Added fix for Change-Id: Ic1f173c85d3824afabb5b7ebf3a8594311eb9007 Reviewed-on: https://gerrit.libreoffice.org/46889 Reviewed-by: Miklos Vajna Tested-by: Jenkins The problem was (the same condition of the bOnlyFrameStarts parameter was used during output of Start and End bookmarks): if (BkmType::Start == pPtr->nBkmType && !bOnlyFrameStarts) ... if (BkmType::End == pPtr->nBkmType && !bOnlyFrameStarts) ... Should be: if (BkmType::Start == pPtr->nBkmType && bOnlyFrameStarts) ... if (BkmType::End == pPtr->nBkmType && !bOnlyFrameStarts) ... I assume this was a simple copy-paste bug. Reviewed-on: https://gerrit.libreoffice.org/59556 Tested-by: Jenkins Reviewed-by: Thorsten Behrens Conflicts: sw/source/core/unocore/unoportenum.cxx It looks like you may be committing a cherry-pick. If this is not correct, please remove the file .git/CHERRY_PICK_HEAD and try again. sw: fix inconsistent bookmark behavior around at-char/as-char anchored frames Added unit test for Added fix for Change-Id: Ic1f173c85d3824afabb5b7ebf3a8594311eb9007 Reviewed-on: https://gerrit.libreoffice.org/59828 Tested-by: Jenkins Reviewed-by: Thorsten Behrens Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx Changes to be committed: new file: sw/qa/extras/uiwriter/data/testInconsistentBookmark.ott modified: sw/qa/extras/uiwriter/uiwriter.cxx 38444587d00b96d52ff725dc7c5852e057bc6bd9 Reviewed-on: https://gerrit.libreoffice.org/59854 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens Change-Id: I712a0dccc1638fed3b81c65628033a4dc06c1ca4 diff --git a/sw/qa/extras/uiwriter/data/testInconsistentBookmark.ott b/sw/qa/extras/uiwriter/data/testInconsistentBookmark.ott new file mode 100644 index ..ff3970a27b27 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/testInconsistentBookmark.ott differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 2410ab136a8e..99e7bc5b20f7 100755 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -217,6 +217,7 @@ public: void testTdf113877NoMerge(); void testTdf113877_default_style(); void testTdf113877_Standard_style(); +void testInconsistentBookmark(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -332,6 +333,7 @@ public: CPPUNIT_TEST(testTdf113877NoMerge); CPPUNIT_TEST(testTdf113877_default_style); CPPUNIT_TEST(testTdf113877_Standard_style); +CPPUNIT_TEST(testInconsistentBookmark); CPPUNIT_TEST_SUITE_END(); private: @@ -4021,6 +4023,65 @@ void SwUiWriterTest::testTdf113877_Standard_style() CPPUNIT_ASSERT_EQUAL(listId1, listId3); } +// Unit test for fix inconsistent bookmark behavior around at-char/as-char anchored frames +// +// We have a placeholder character in the sw doc model for as-char anchored frames, +// so it's possible to have a bookmark before/after the frame or a non-collapsed bookmark +// which covers the frame. The same is not true for at-char anchored frames, +// where the anchor points to a doc model position, but there is no placeholder character. +// If a bookmark is created covering the start and end of the anchor of the frame, +// internally we create a collapsed bookmark which has the same position as the anchor of the frame. +// When this doc model is handled by SwXParagraph::createEnumeration(), +// first the frame and then the bookmark is appended to the text portion enumeration, +// so your bookmark around the frame is turned into a collapsed bookmark after the frame. +// (The same happens when we roundtrip an ODT document representing this doc model.) +// +// Fix the problem by inserting collapsed bookmarks with affected anchor positions +// (same position is the anchor for an at-char frame) into the enumeration in two stages: +// first the start of them before frames and then the end of them + other bookmarks. +// This way UNO API users get their non-collapsed bookmarks around at-char anchored frames, +// similar to as-char ones. +void SwUiWriterTest::testInconsistentBookmark() +{ +// create test document with text and bookmark +{ +SwDoc* pDoc(createDoc("testInconsistentBookmark.ott")); +IDocumentMarkAccess& rIDMA(*pDoc->getIDocumentMarkAccess()); +SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); +SwCursor aPaM(SwPosition(aIdx),
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/qa sw/source
sw/qa/extras/uiwriter/data/testInconsistentBookmark.ott |binary sw/qa/extras/uiwriter/uiwriter.cxx | 62 sw/source/core/unocore/unoportenum.cxx | 16 ++-- 3 files changed, 70 insertions(+), 8 deletions(-) New commits: commit ae6a0cac1fc367f1a5e34a2139d45b17f365de29 Author: Serge Krot AuthorDate: Fri Aug 24 13:31:54 2018 +0200 Commit: Thorsten Behrens CommitDate: Fri Aug 31 13:02:42 2018 +0200 sw: fix inconsistent bookmark behavior around at-char/as-char anchored frames Added fix for Change-Id: Ic1f173c85d3824afabb5b7ebf3a8594311eb9007 Reviewed-on: https://gerrit.libreoffice.org/46889 Reviewed-by: Miklos Vajna Tested-by: Jenkins The problem was (the same condition of the bOnlyFrameStarts parameter was used during output of Start and End bookmarks): if (BkmType::Start == pPtr->nBkmType && !bOnlyFrameStarts) ... if (BkmType::End == pPtr->nBkmType && !bOnlyFrameStarts) ... Should be: if (BkmType::Start == pPtr->nBkmType && bOnlyFrameStarts) ... if (BkmType::End == pPtr->nBkmType && !bOnlyFrameStarts) ... I assume this was a simple copy-paste bug. Reviewed-on: https://gerrit.libreoffice.org/59556 Tested-by: Jenkins Reviewed-by: Thorsten Behrens Conflicts: sw/source/core/unocore/unoportenum.cxx It looks like you may be committing a cherry-pick. If this is not correct, please remove the file .git/CHERRY_PICK_HEAD and try again. Change-Id: I712a0dccc1638fed3b81c65628033a4dc06c1ca4 sw: fix inconsistent bookmark behavior around at-char/as-char anchored frames Added unit test for Added fix for Change-Id: Ic1f173c85d3824afabb5b7ebf3a8594311eb9007 Reviewed-on: https://gerrit.libreoffice.org/59828 Tested-by: Jenkins Reviewed-by: Thorsten Behrens Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx Changes to be committed: new file: sw/qa/extras/uiwriter/data/testInconsistentBookmark.ott modified: sw/qa/extras/uiwriter/uiwriter.cxx Change-Id: I38444587d00b96d52ff725dc7c5852e057bc6bd9 Reviewed-on: https://gerrit.libreoffice.org/59854 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/sw/qa/extras/uiwriter/data/testInconsistentBookmark.ott b/sw/qa/extras/uiwriter/data/testInconsistentBookmark.ott new file mode 100644 index ..ff3970a27b27 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/testInconsistentBookmark.ott differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 2410ab136a8e..c07369a36450 100755 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -217,6 +217,7 @@ public: void testTdf113877NoMerge(); void testTdf113877_default_style(); void testTdf113877_Standard_style(); +void testInconsistentBookmark(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -332,6 +333,7 @@ public: CPPUNIT_TEST(testTdf113877NoMerge); CPPUNIT_TEST(testTdf113877_default_style); CPPUNIT_TEST(testTdf113877_Standard_style); +CPPUNIT_TEST(testInconsistentBookmark); CPPUNIT_TEST_SUITE_END(); private: @@ -4021,6 +4023,66 @@ void SwUiWriterTest::testTdf113877_Standard_style() CPPUNIT_ASSERT_EQUAL(listId1, listId3); } +// Unit test for fix inconsistent bookmark behavior around at-char/as-char anchored frames +// +// We have a placeholder character in the sw doc model for as-char anchored frames, +// so it's possible to have a bookmark before/after the frame or a non-collapsed bookmark +// which covers the frame. The same is not true for at-char anchored frames, +// where the anchor points to a doc model position, but there is no placeholder character. +// If a bookmark is created covering the start and end of the anchor of the frame, +// internally we create a collapsed bookmark which has the same position as the anchor of the frame. +// When this doc model is handled by SwXParagraph::createEnumeration(), +// first the frame and then the bookmark is appended to the text portion enumeration, +// so your bookmark around the frame is turned into a collapsed bookmark after the frame. +// (The same happens when we roundtrip an ODT document representing this doc model.) +// +// Fix the problem by inserting collapsed bookmarks with affected anchor positions +// (same position is the anchor for an at-char frame) into the enumeration in two stages: +// first the start of them before frames and then the end of them + other bookmarks. +// This way UNO API users get their non-collapsed bookmarks around at-char anchored frames, +// similar to as-char ones. +void SwUiWriterTest::testInconsistentBookmark() +{ +// create test document with text and bookmark +
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf113877_blank.odt |binary sw/qa/extras/uiwriter/data/tdf113877_blank_ownStandard.odt |binary sw/qa/extras/uiwriter/uiwriter.cxx | 68 + sw/source/core/txtnode/ndtxt.cxx | 45 4 files changed, 111 insertions(+), 2 deletions(-) New commits: commit e78239c928de1c73a7dda5a37ff38a1407ced052 Author: Serge Krot Date: Mon Jun 18 18:15:55 2018 +0200 tdf#113877 Insert doc: merge list into text with specifc style When inserting document, in the current position the text could have custom style but really it is the same Standard style. Therefore we should not merge first inserted node into the insert position and just overwrite style in the insert position with text style from the inserted node. Change-Id: Ib67c56bed3d30f356f83dc0b4d4a1710def10853 Reviewed-on: https://gerrit.libreoffice.org/56052 Tested-by: Jenkins Reviewed-by: Thorsten Behrens Reviewed-on: https://gerrit.libreoffice.org/56408 Tested-by: Thorsten Behrens diff --git a/sw/qa/extras/uiwriter/data/tdf113877_blank.odt b/sw/qa/extras/uiwriter/data/tdf113877_blank.odt new file mode 100755 index ..741d7d5e6d0a Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf113877_blank.odt differ diff --git a/sw/qa/extras/uiwriter/data/tdf113877_blank_ownStandard.odt b/sw/qa/extras/uiwriter/data/tdf113877_blank_ownStandard.odt new file mode 100755 index ..3dbebda6f93c Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf113877_blank_ownStandard.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx old mode 100644 new mode 100755 index b4d2f264bf42..2410ab136a8e --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -215,6 +215,8 @@ public: void testTdf72942(); void testTdf113877(); void testTdf113877NoMerge(); +void testTdf113877_default_style(); +void testTdf113877_Standard_style(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -328,6 +330,8 @@ public: CPPUNIT_TEST(testTdf72942); CPPUNIT_TEST(testTdf113877); CPPUNIT_TEST(testTdf113877NoMerge); +CPPUNIT_TEST(testTdf113877_default_style); +CPPUNIT_TEST(testTdf113877_Standard_style); CPPUNIT_TEST_SUITE_END(); private: @@ -3953,6 +3957,70 @@ void SwUiWriterTest::testTdf113877NoMerge() CPPUNIT_ASSERT(listId6 != listId7); } +// Related test to testTdf113877(): Inserting into empty document a new document with list. +// Insert position has NO its own paragraph style ("Standard" will be used). +// +// Resulting document should be the same for following tests: +// - testTdf113877_default_style() +// - testTdf113877_Standard_style() +// +void SwUiWriterTest::testTdf113877_default_style() +{ +load(DATA_DIRECTORY, "tdf113877_blank.odt"); + +// set a page cursor into the end of the document +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); +uno::Reference xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); +xCursor->jumpToEndOfPage(); + +// insert the same document at current cursor position +{ +const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf113877_insert_numbered_list_abcd.odt"; +uno::Sequence aPropertyValues(comphelper::InitPropertySequence({ { "Name", uno::makeAny(insertFileid) } })); +lcl_dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues); +} + +const OUString listId1 = getProperty(getParagraph(1), "ListId"); +const OUString listId2 = getProperty(getParagraph(2), "ListId"); +const OUString listId3 = getProperty(getParagraph(3), "ListId"); + +CPPUNIT_ASSERT_EQUAL(listId1, listId2); +CPPUNIT_ASSERT_EQUAL(listId1, listId3); +} + +// Related test to testTdf113877(): Inserting into empty document a new document with list. +// Insert position has its own paragraph style derived from "Standard", but this style is the same as "Standard". +// +// Resulting document should be the same for following tests: +// - testTdf113877_default_style() +// - testTdf113877_Standard_style() +// +void SwUiWriterTest::testTdf113877_Standard_style() +{ +load(DATA_DIRECTORY, "tdf113877_blank_ownStandard.odt"); + +// set a page cursor into the end of the document +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); +uno::Reference xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); +xCursor->jumpToEndOfPage(); + +// insert the same document at current cursor position +{ +const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) +