sw/qa/extras/ooxmlexport/data/toc_doc.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 18 ++++++++++++++++++ sw/source/filter/ww8/ww8atr.cxx | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-)
New commits: commit 9f9c2bb4d5907be5726f50cfd5dfa8ae1d251dcf Author: Tushar Bende <tushar.be...@synerzip.com> Date: Thu Dec 26 19:30:08 2013 +0530 fdo#69613: Fix for DOCX Export loses Table-of-Contents flags (This is partial fix for this bug includes flag 'f' processing) Issue description: Export logic for all TOC field flags was enclosed inside if( nsSwTOXElement::TOX_MARK & pTOX->GetCreateType() ) in ww8atr.cxx, which gets true for 'f' flag, this was the reason if there is 'f' flag present in original doc then only other flags like \o \h used to come after RoundTrip. Added Unit test case to verify even if there is no 'f' flag in original doc,other flags eg. \h is getting preserved after RT. Conflicts: sw/source/filter/ww8/ww8atr.cxx Reviewed on: https://gerrit.libreoffice.org/7203 Change-Id: I29d22b363cc91ae5fabffca959786134bf1ba1cc diff --git a/sw/qa/extras/ooxmlexport/data/toc_doc.docx b/sw/qa/extras/ooxmlexport/data/toc_doc.docx new file mode 100644 index 0000000..26fa3dc Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/toc_doc.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 4f189e1..a3850cb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2318,6 +2318,24 @@ DECLARE_OOXMLEXPORT_TEST(testFieldFlagO,"TOC_field_f.docx") CPPUNIT_ASSERT(contents.match(" TOC \\f \\o \"1-3\" \\h")); } +DECLARE_OOXMLEXPORT_TEST(testTOCFlag_f, "toc_doc.docx") +{ + // Export logic for all TOC field flags was enclosed inside + // if( nsSwTOXElement::TOX_MARK & pTOX->GetCreateType() ) in ww8atr.cxx which gets true for \f, + // this was the reason if there is \f flag present in original doc then only other flags like + // \o \h \n used to come after RoundTrip. + // This test case is to verify even if there is no \f flag in original doc, \h flag is getting + // preserved after RT. + xmlDocPtr pXmlDoc = parseExport(); + if (!pXmlDoc) + return; + // FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed + // not to insert an empty paragraph before TOC. + xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc,"/w:document/w:body/w:p[2]/w:r[2]/w:instrText"); + xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; + OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content)); + CPPUNIT_ASSERT(contents.endsWith("\\h")); +} #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index e9d1069..b04d7d4 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2120,6 +2120,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) sStr += OUString((sal_Char)( 'A' + GetExport( ).GetId( *pTOX->GetTOXType() ) )); sStr += sEntryEnd; } + } if( nsSwTOXElement::TOX_OUTLINELEVEL & pTOX->GetCreateType() ) { // Take the TOC value of the max level to evaluate to as @@ -2287,7 +2288,6 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) if (lcl_IsHyperlinked(pTOX->GetTOXForm(), nTOXLvl)) sStr += "\\h"; - } break; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits