summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriyankaGaikwad <priyanka.gaikwad@synerzip.com>2013-12-27 10:26:51 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-01-10 17:01:29 +0100
commitb4e9e7726f0c67938e8b80e6b7c2883459d0b533 (patch)
treede51ab737fe1067fd51a4afafce2e70ebfc69b14
parentb1236dd7e86f40e54b7efb6082fad0967edb92d2 (diff)
fdo#69613 DOCX export: Fix for '\o' flag field should export once.
(This is partial fix for this bug) Description: TOC flag field '\o' exported twice after roundtrip because the export logic for '\o' is repeated in ww8atr.cxx. XML file difference In document.xml Before : <w:instrText> TOC \o "1-3" \o "1-3" \h </w:instrText> After : <w:instrText> TOC \o "1-3" \h </w:instrText> Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/7206 Change-Id: I136744927b8d5a48869a2bfc87278bede697c655
-rw-r--r--sw/qa/extras/ooxmlexport/data/TOC_field_f.docxbin0 -> 15697 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx14
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx17
3 files changed, 14 insertions, 17 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/TOC_field_f.docx b/sw/qa/extras/ooxmlexport/data/TOC_field_f.docx
new file mode 100644
index 000000000000..ea0958a2181a
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/TOC_field_f.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 26dc77a7b902..4f189e1e1fc5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2304,6 +2304,20 @@ DECLARE_OOXMLEXPORT_TEST(testFDO71834, "fdo71834.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[4]/w:tr[2]/w:tc[1]/w:tcPr[1]/w:tcW[1]","type", "dxa");
}
+DECLARE_OOXMLEXPORT_TEST(testFieldFlagO,"TOC_field_f.docx")
+{
+ // This test case is to verify \o flag should come once.
+ 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.match(" TOC \\f \\o \"1-3\" \\h"));
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 4a800b16d1a0..e9d1069d20a2 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2120,23 +2120,6 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
sStr += OUString((sal_Char)( 'A' + GetExport( ).GetId( *pTOX->GetTOXType() ) ));
sStr += sEntryEnd;
}
-
- if( nsSwTOXElement::TOX_OUTLINELEVEL & pTOX->GetCreateType() )
- {
- const int nMinLvl = nTOXLvl;
- if ( nMinLvl > 0 )
- {
- int nTmpLvl = nMinLvl;
- if (nTmpLvl > WW8ListManager::nMaxLevel)
- nTmpLvl = WW8ListManager::nMaxLevel;
-
- sStr += "\\o \"1-";
- sStr += OUString::number(nTmpLvl);
- sStr += sEntryEnd;
-
- }
- }
-
if( nsSwTOXElement::TOX_OUTLINELEVEL & pTOX->GetCreateType() )
{
// Take the TOC value of the max level to evaluate to as