[Libreoffice-commits] core.git: sw/qa writerfilter/source
sushil_shinde
sushil.shinde at synerzip.com
Thu Jul 3 05:59:41 PDT 2014
sw/qa/extras/ooxmlexport/data/fdo77129.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 ++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 42 ++++++++++++++--------
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 1
4 files changed, 40 insertions(+), 15 deletions(-)
New commits:
commit 9948d9566e86b190e74a62e63f273f5fa0eb8929
Author: sushil_shinde <sushil.shinde at synerzip.com>
Date: Thu Jun 26 15:40:05 2014 +0530
fdo#77129 DOCX:Only Six pages were loaded out of 60 pages.
- Footer reference was inside TOC field.
- m_bStartTOC flag was enabled while handling TOC from document.
- Since m_bStartTOC was enabled while importing footer it was inserting extra textcursors entries
to m_aTextAppendStack.
- Due to bad entries in textappendstack, footer was not popped properly.
- Because of this all lost data after sixth page was inserted into footer node and it was not
visible on page.
- Added new flag to differentiate TOC from main document and Header or Footer.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/9930
Change-Id: I5288f5c313c890e0fdddf3c60c4609eab30edde6
diff --git a/sw/qa/extras/ooxmlexport/data/fdo77129.docx b/sw/qa/extras/ooxmlexport/data/fdo77129.docx
new file mode 100644
index 0000000..b0661e9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo77129.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 0d03eb4..30ced5b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3666,6 +3666,18 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80097, "fdo80097.docx")
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:color = '00000A']", 1);
}
+DECLARE_OOXMLEXPORT_TEST(testFdo77129, "fdo77129.docx")
+{
+ // The problem was that text after TOC field was missing if footer reference comes in field.
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+
+ if (!pXmlDoc)
+ return;
+
+ // Data was lost from this paragraph.
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[5]/w:r[1]/w:t", "Abstract");
+}
+
DECLARE_OOXMLEXPORT_TEST(testfdo79969_xlsm, "fdo79969_xlsm.docx")
{
// This UT for DOCX embedded with excel work sheet.
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8bd5900..9457568 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -161,6 +161,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bIsColumnBreakDeferred( false ),
m_bIsPageBreakDeferred( false ),
m_bStartTOC(false),
+ m_bStartTOCHeaderFooter(false),
m_bStartedTOC(false),
m_bStartIndex(false),
m_bStartBibliography(false),
@@ -1183,26 +1184,33 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, PropertyMapP
{
if (m_bStartTOC || m_bStartIndex || m_bStartBibliography || m_bStartGenericField)
{
- m_bStartedTOC = true;
- uno::Reference< text::XTextCursor > xTOCTextCursor;
- xTOCTextCursor = xTextAppend->getEnd()->getText( )->createTextCursor( );
- xTOCTextCursor->gotoEnd(false);
- if (xTOCTextCursor.is())
+ if(m_bInHeaderFooterImport && !m_bStartTOCHeaderFooter)
{
- if (m_bStartIndex || m_bStartBibliography || m_bStartGenericField)
- xTOCTextCursor->goLeft(1, false);
- xTextRange = xTextAppend->insertTextPortion(rString, pValues, xTOCTextCursor);
- m_bTextInserted = true;
- xTOCTextCursor->gotoRange(xTextRange->getEnd(), true);
- mxTOCTextCursor = xTOCTextCursor;
+ xTextRange = xTextAppend->appendTextPortion(rString, pValues);
}
else
{
- xTextRange = xTextAppend->appendTextPortion(rString, pValues);
- xTOCTextCursor = xTextAppend->createTextCursor();
- xTOCTextCursor->gotoRange(xTextRange->getEnd(), false);
+ m_bStartedTOC = true;
+ uno::Reference< text::XTextCursor > xTOCTextCursor;
+ xTOCTextCursor = xTextAppend->getEnd()->getText( )->createTextCursor( );
+ xTOCTextCursor->gotoEnd(false);
+ if (xTOCTextCursor.is())
+ {
+ if (m_bStartIndex || m_bStartBibliography || m_bStartGenericField)
+ xTOCTextCursor->goLeft(1, false);
+ xTextRange = xTextAppend->insertTextPortion(rString, pValues, xTOCTextCursor);
+ m_bTextInserted = true;
+ xTOCTextCursor->gotoRange(xTextRange->getEnd(), true);
+ mxTOCTextCursor = xTOCTextCursor;
+ }
+ else
+ {
+ xTextRange = xTextAppend->appendTextPortion(rString, pValues);
+ xTOCTextCursor = xTextAppend->createTextCursor();
+ xTOCTextCursor->gotoRange(xTextRange->getEnd(), false);
+ }
+ m_aTextAppendStack.push(TextAppendContext(xTextAppend, xTOCTextCursor));
}
- m_aTextAppendStack.push(TextAppendContext(xTextAppend, xTOCTextCursor));
}
else
xTextRange = xTextAppend->appendTextPortion(rString, pValues);
@@ -2901,6 +2909,8 @@ void DomainMapper_Impl::handleToc
{
OUString sValue;
m_bStartTOC = true;
+ if(m_bInHeaderFooterImport)
+ m_bStartTOCHeaderFooter = true;
bool bTableOfFigures = false;
bool bHyperlinks = false;
bool bFromOutline = false;
@@ -4104,6 +4114,8 @@ void DomainMapper_Impl::PopFieldContext()
m_bStartTOC = false;
m_bStartIndex = false;
m_bStartBibliography = false;
+ if(m_bInHeaderFooterImport && m_bStartTOCHeaderFooter)
+ m_bStartTOCHeaderFooter = false;
}
else
{
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index a09e8b9..778d7b0 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -320,6 +320,7 @@ private:
bool m_bIsColumnBreakDeferred;
bool m_bIsPageBreakDeferred;
bool m_bStartTOC;
+ bool m_bStartTOCHeaderFooter;
/// If we got any text that is the pre-rendered result of the TOC field.
bool m_bStartedTOC;
bool m_bStartIndex;
More information about the Libreoffice-commits
mailing list