diff options
author | Tushar Bende <tushar.bende@synerzip.com> | 2013-12-26 19:30:08 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-10 17:18:11 +0100 |
commit | 9f9c2bb4d5907be5726f50cfd5dfa8ae1d251dcf (patch) | |
tree | 9348d77226ffc7d1b09f24a8f05b0ca286344e08 | |
parent | e7a86f2d68adb40807deba29a57792a2e3d1f319 (diff) |
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
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/toc_doc.docx | bin | 0 -> 15698 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 18 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/toc_doc.docx b/sw/qa/extras/ooxmlexport/data/toc_doc.docx Binary files differnew file mode 100644 index 000000000000..26fa3dc7150b --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/toc_doc.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 4f189e1e1fc5..a3850cbc0b4b 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 e9d1069d20a2..b04d7d44c1bf 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; } } |