diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-11 09:43:59 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-11 09:51:17 +0100 |
commit | be7d41a2bed7f424f38e2e7340f9b98c3f4f8fa2 (patch) | |
tree | 91830f6be8c34d4c255092fa1188f776304f8211 /sw | |
parent | 4357dd89ca50deddd7cec7bfba87627a8515f62c (diff) |
Revert "fdo#72563 : PAGEREF field tag not preserved during Roundtrip"
This reverts commit 138bd3d656c30911d5f45a8b6804e50857f6b30c. See
comment 5 in the bugreport, the fix in its current form causes more
trouble than it fixes.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Change-Id: I64f64f02a2e073b96e165c81bd2f85928e5527bc
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/testPageref.docx | bin | 26321 -> 0 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 15 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 47 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.hxx | 3 |
4 files changed, 3 insertions, 62 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/testPageref.docx b/sw/qa/extras/ooxmlexport/data/testPageref.docx Binary files differdeleted file mode 100644 index 65ca38aedd57..000000000000 --- a/sw/qa/extras/ooxmlexport/data/testPageref.docx +++ /dev/null diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index f6e168b67f0a..26b2fe6097c9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2299,7 +2299,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69649, "fdo69649.docx") xmlDocPtr pXmlDoc = parseExport("word/document.xml"); if (!pXmlDoc) return; - xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc,"/w:document/w:body/w:p[21]/w:hyperlink/w:r[5]/w:t"); + xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc,"/w:document/w:body/w:p[21]/w:hyperlink/w:r[2]/w:t"); xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content)); CPPUNIT_ASSERT(contents.match("15")); @@ -2863,19 +2863,6 @@ DECLARE_OOXMLEXPORT_TEST(testGradientFillPreservation, "gradient-fill-preservati "val", "160000"); } -DECLARE_OOXMLEXPORT_TEST(testPageref, "testPageref.docx") -{ - // fdo#72563 : There was a problem that in case of TOC,PAGEREF field tag was not preserved during Roundtrip - // This test case is to verify that PAGEREF tag is coming with proper values inside <hyperlink> tag. - xmlDocPtr pXmlDoc = parseExport(); - if (!pXmlDoc) - return; - xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc,"/w:document/w:body/w:p[2]/w:hyperlink/w:r[3]/w:instrText"); - xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; - OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content)); - CPPUNIT_ASSERT(contents.match("PAGEREF _Toc355095261 \\h")); -} - /* FIXME this still crashes DECLARE_OOXMLEXPORT_TEST(testSegFaultWhileSave, "test_segfault_while_save.docx") { diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 6e57286c92d9..7066d9bf6077 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -685,35 +685,10 @@ void DocxAttributeOutput::EndRun() // write the run start + the run content m_pSerializer->mergeTopMarks(); // merges the "actual run start" + // append the actual run end m_pSerializer->endElementNS( XML_w, XML_r ); - if(m_startedHyperlink && m_hyperLinkAnchor != "") - { - OUString sToken; - m_pSerializer->startElementNS( XML_w, XML_r, FSEND ); - m_pSerializer->startElementNS( XML_w, XML_fldChar, - FSNS( XML_w, XML_fldCharType ), "begin", - FSEND ); - m_pSerializer->endElementNS( XML_w, XML_fldChar ); - m_pSerializer->endElementNS( XML_w, XML_r ); - - - m_pSerializer->startElementNS( XML_w, XML_r, FSEND ); - sToken = "PAGEREF " + m_hyperLinkAnchor + " \\h"; // '\h' Creates a hyperlink to the bookmarked paragraph. - DoWriteCmd( sToken ); - m_pSerializer->endElementNS( XML_w, XML_r ); - - - // Write the Field separator - m_pSerializer->startElementNS( XML_w, XML_r, FSEND ); - m_pSerializer->singleElementNS( XML_w, XML_fldChar, - FSNS( XML_w, XML_fldCharType ), "separate", - FSEND ); - m_pSerializer->endElementNS( XML_w, XML_r ); - - } - WritePostponedMath(); WritePendingPlaceholder(); @@ -726,17 +701,6 @@ void DocxAttributeOutput::EndRun() { if ( m_startedHyperlink ) { - if( m_endPageRef ) - { - // Hyperlink is started and fldchar "end" needs to be written for PAGEREF - m_pSerializer->startElementNS( XML_w, XML_r, FSEND ); - m_pSerializer->singleElementNS( XML_w, XML_fldChar, - FSNS( XML_w, XML_fldCharType ), "end", - FSEND ); - m_pSerializer->endElementNS( XML_w, XML_r ); - m_endPageRef = false; - } - m_pSerializer->endElementNS( XML_w, XML_hyperlink ); m_startedHyperlink = false; } @@ -971,7 +935,6 @@ void DocxAttributeOutput::CmdField_Impl( FieldInfos& rInfos ) sToken = sToken.replaceAll("NNNN", "dddd"); sToken = sToken.replaceAll("NN", "ddd"); } - // Write the Field command DoWriteCmd( sToken ); @@ -1439,8 +1402,6 @@ bool DocxAttributeOutput::StartURL( const OUString& rUrl, const OUString& rTarge bool bBookmarkOnly = AnalyzeURL( rUrl, rTarget, &sUrl, &sMark ); - m_hyperLinkAnchor = sMark; - if ( !sMark.isEmpty() && !bBookmarkOnly ) { m_rExport.OutputField( NULL, ww::eHYPERLINK, sUrl ); @@ -1500,11 +1461,6 @@ bool DocxAttributeOutput::StartURL( const OUString& rUrl, const OUString& rTarge bool DocxAttributeOutput::EndURL() { m_closeHyperlinkInThisRun = true; - if(m_hyperLinkAnchor != "") - { - m_endPageRef = true; - m_hyperLinkAnchor = ""; - } return true; } @@ -6226,7 +6182,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri m_pHyperlinkAttrList( NULL ), m_pColorAttrList( NULL ), m_pBackgroundAttrList( NULL ), - m_endPageRef( false ), m_pFootnotesList( new ::docx::FootnotesList() ), m_pEndnotesList( new ::docx::FootnotesList() ), m_footnoteEndnoteRefTag( 0 ), diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 926db22ef4ba..1394906d48c0 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -685,8 +685,7 @@ private: ::sax_fastparser::FastAttributeList *m_pColorAttrList; /// Attributes of the paragraph background ::sax_fastparser::FastAttributeList *m_pBackgroundAttrList; - OUString m_hyperLinkAnchor; - bool m_endPageRef; + ::docx::FootnotesList *m_pFootnotesList; ::docx::FootnotesList *m_pEndnotesList; int m_footnoteEndnoteRefTag; |