diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-06-09 10:11:28 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-09 10:34:01 +0100 |
commit | 60f8dd78fa3f19e8bed867f7f5926fcf9a8d8e67 (patch) | |
tree | d0e94b185c3a691f3dba2914211053d41124131c /sw | |
parent | fce7587b4deea4d79c9da695bb8f43a2a5864ce2 (diff) |
Resolves: more crash on export of ooo47778-3.sxw to docx
This is more of the horror where the table in the frame has its cells out of
visual sequence, extend the previous fix of this kind to accept cells within
the original unmodified selected range
Change-Id: I6e8220f712fe9de5d4b98fb3cb5ed67e3762e929
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/ooo47778-4.odt | bin | 0 -> 9815 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 23 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 2 |
4 files changed, 26 insertions, 7 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/ooo47778-4.odt b/sw/qa/extras/ooxmlexport/data/ooo47778-4.odt Binary files differnew file mode 100644 index 000000000000..ae6b56b8cd38 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/ooo47778-4.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 6b2fb6eff4e1..5fe36fde8aa1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -813,12 +813,18 @@ DECLARE_OOXMLEXPORT_TEST(testSectionHeader, "sectionprot.odt") } } -DECLARE_OOXMLEXPORT_TEST(testOO47778, "ooo47778-3.odt") +DECLARE_OOXMLEXPORT_TEST(testOO47778_1, "ooo47778-3.odt") { if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) assertXPathContent(pXmlDoc, "(//w:t)[3]", "c"); } +DECLARE_OOXMLEXPORT_TEST(testOO47778_2, "ooo47778-4.odt") +{ + if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + assertXPathContent(pXmlDoc, "(//w:t)[4]", "c"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index ba7e714c9252..34af92fa31e5 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1720,6 +1720,8 @@ void MSWordExportBase::WriteSpecialText( sal_uLong nStart, sal_uLong nEnd, sal_u sal_uInt8 nOldTyp = m_nTextTyp; m_nTextTyp = nTTyp; SwPaM* pOldPam = m_pCurPam; //!! Simply shifting the PaM without restoring should do the job too + sal_uLong nOldStart = m_nCurStart; + sal_uLong nOldEnd = m_nCurEnd; SwPaM* pOldEnd = m_pOrigPam; bool bOldPageDescs = m_bOutPageDescs; m_bOutPageDescs = false; @@ -1731,6 +1733,8 @@ void MSWordExportBase::WriteSpecialText( sal_uLong nStart, sal_uLong nEnd, sal_u m_bOutPageDescs = bOldPageDescs; delete m_pCurPam; // delete Pam m_pCurPam = pOldPam; + m_nCurStart = nOldStart; + m_nCurEnd = nOldEnd; m_pOrigPam = pOldEnd; m_nTextTyp = nOldTyp; } @@ -1791,6 +1795,8 @@ void WW8Export::WriteChar( sal_Unicode c ) void MSWordExportBase::SetCurPam(sal_uLong nStt, sal_uLong nEnd) { + m_nCurStart = nStt; + m_nCurEnd = nEnd; m_pCurPam = Writer::NewSwPaM( *m_pDoc, nStt, nEnd ); // Recognize tables in special cases @@ -1842,6 +1848,8 @@ void MSWordExportBase::RestoreData() delete m_pCurPam; m_pCurPam = rData.pOldPam; + m_nCurStart = rData.nOldStart; + m_nCurEnd = rData.nOldEnd; m_pOrigPam = rData.pOldEnd; m_bOutTable = rData.bOldOutTable; @@ -2530,11 +2538,12 @@ class TrackContentToExport { private: SwPaM *m_pCurPam; - SwPaM m_aOrigPam; + sal_uLong m_nStart, m_nEnd; public: - TrackContentToExport(SwPaM *pCurPam) + TrackContentToExport(SwPaM *pCurPam, sal_uLong nCurStart, sal_uLong nCurEnd) : m_pCurPam(pCurPam) - , m_aOrigPam(*pCurPam, NULL) + , m_nStart(nCurStart) + , m_nEnd(nCurEnd) { } @@ -2559,8 +2568,8 @@ public: if (pNextNode && pCurrentNode != pNextNode) { - return pNextNode->GetIndex() >= m_aOrigPam.GetPoint()->nNode.GetIndex() && - pNextNode->GetIndex() < m_aOrigPam.GetMark()->nNode.GetIndex(); + return pNextNode->GetIndex() >= m_nStart && + pNextNode->GetIndex() < m_nEnd; } return false; @@ -2569,7 +2578,7 @@ public: void MSWordExportBase::WriteText() { - TrackContentToExport aContentTracking(m_pCurPam); + TrackContentToExport aContentTracking(m_pCurPam, m_nCurStart, m_nCurEnd); while (aContentTracking.contentRemainsToExport(m_pTableInfo.get())) { SwNode& rNd = m_pCurPam->GetNode(); @@ -3561,6 +3570,8 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM , m_bOutOutlineOnly(false) , m_bFontSizeWritten(false) , m_pDoc(pDocument) + , m_nCurStart(pCurrentPam->GetPoint()->nNode.GetIndex()) + , m_nCurEnd(pCurrentPam->GetMark()->nNode.GetIndex()) , m_pCurPam(pCurrentPam) , m_pOrigPam(pOriginalPam) { diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 1a6b06426fe5..16bf989437cc 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -437,6 +437,7 @@ struct MSWordSaveData RndStdIds eOldAnchorType; ww::bytes* pOOld; ///< WW8Export only SwPaM* pOldPam, *pOldEnd; + sal_uLong nOldStart, nOldEnd; const sw::Frame* pOldFlyFormat; const SwPageDesc* pOldPageDesc; @@ -554,6 +555,7 @@ public: bool m_bFontSizeWritten; SwDoc *m_pDoc; + sal_uLong m_nCurStart, m_nCurEnd; SwPaM *m_pCurPam, *m_pOrigPam; /// Stack to remember the nesting (see MSWordSaveData for more) |