sw/qa/extras/ooxmlexport/data/fdo77725.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |   12 ++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   12 ++++++++----
 3 files changed, 20 insertions(+), 4 deletions(-)

New commits:
commit 74126c42c309d3166235748980ee5e1e4a5fecb0
Author: Ravindra Vidhate <ravindra.vidh...@synerzip.com>
Date:   Mon Apr 21 16:32:58 2014 +0530

    fdo#77725 LO not able to open/save file when exported multiple times.
    
    Problem description:
    The LO is not able to save the file if exported multiple times and the 
exported file is used as input.
    The main root cause is Extra Line breaks getting added even though there is 
no text available.
    
    Change-Id: I0afb52380912cae140d7ded694cb7cae9a8362a9
    Reviewed-on: https://gerrit.libreoffice.org/9112
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Tested-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/fdo77725.docx 
b/sw/qa/extras/ooxmlexport/data/fdo77725.docx
new file mode 100644
index 0000000..7813459
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo77725.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b1bc8c2..2edbd28 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3185,6 +3185,18 @@ DECLARE_OOXMLEXPORT_TEST(testFDO75431, "fdo75431.docx")
     assertXPath(pXmlDoc, "//w:p/w:pPr/w:sectPr/w:type", "val", "nextPage");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFDO77725, "fdo77725.docx")
+{
+    xmlDocPtr pXmlFootnotes = parseExport("word/footnotes.xml");
+    if (!pXmlFootnotes)
+        return;
+
+    assertXPath(pXmlFootnotes, 
"//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[1]", 0);
+    assertXPath(pXmlFootnotes, 
"//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[2]", 0);
+    assertXPath(pXmlFootnotes, 
"//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[3]", 0);
+
+}
+
 DECLARE_OOXMLEXPORT_TEST(testContentTypeOLE, "fdo77759.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1bc6305..7fd9a37 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1610,7 +1610,7 @@ void DocxAttributeOutput::FootnoteEndnoteRefTag()
     1, meaning that it skips one character after the text.  This is to make
     the switch in DocxAttributeOutput::RunText() nicer ;-)
  */
-static void impl_WriteRunText( FSHelperPtr pSerializer, sal_Int32 nTextToken,
+static bool impl_WriteRunText( FSHelperPtr pSerializer, sal_Int32 nTextToken,
         const sal_Unicode* &rBegin, const sal_Unicode* pEnd, bool bMove = true 
)
 {
     const sal_Unicode *pBegin = rBegin;
@@ -1620,7 +1620,7 @@ static void impl_WriteRunText( FSHelperPtr pSerializer, 
sal_Int32 nTextToken,
         rBegin = pEnd + 1;
 
     if ( pBegin >= pEnd )
-        return; // we want to write at least one character
+        return false; // we want to write at least one character
 
     // we have to add 'preserve' when starting/ending with space
     if ( *pBegin == ' ' || *( pEnd - 1 ) == ' ' )
@@ -1633,6 +1633,8 @@ static void impl_WriteRunText( FSHelperPtr pSerializer, 
sal_Int32 nTextToken,
     pSerializer->writeEscaped( OUString( pBegin, pEnd - pBegin ) );
 
     pSerializer->endElementNS( XML_w, nTextToken );
+
+    return true;
 }
 
 void DocxAttributeOutput::RunText( const OUString& rText, rtl_TextEncoding 
/*eCharSet*/ )
@@ -1660,8 +1662,10 @@ void DocxAttributeOutput::RunText( const OUString& 
rText, rtl_TextEncoding /*eCh
                 m_pSerializer->singleElementNS( XML_w, XML_tab, FSEND );
                 break;
             case 0x0b: // line break
-                impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt );
-                m_pSerializer->singleElementNS( XML_w, XML_br, FSEND );
+                {
+                    if (impl_WriteRunText( m_pSerializer, nTextToken, pBegin, 
pIt ))
+                        m_pSerializer->singleElementNS( XML_w, XML_br, FSEND );
+                }
                 break;
             case 0x1E: //non-breaking hyphen
                 impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to