[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - writerfilter/source

sushil_shinde sushil.shinde at synerzip.com
Tue Sep 9 13:07:52 PDT 2014


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   34 ++++++++++++++--------
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    1 
 2 files changed, 24 insertions(+), 11 deletions(-)

New commits:
commit 3c03c0af168dd0fec4827b8d6b0761f7ca2f80c7
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
    
    (cherry picked from commit 9948d9566e86b190e74a62e63f273f5fa0eb8929)
    Signed-off-by: Luboš Luňák <l.lunak at collabora.com>
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    	writerfilter/source/dmapper/DomainMapper_Impl.cxx
    
    Change-Id: I5288f5c313c890e0fdddf3c60c4609eab30edde6

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 4e9a6f1..47f3a41 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -155,6 +155,7 @@ DomainMapper_Impl::DomainMapper_Impl(
         m_bIsColumnBreakDeferred( false ),
         m_bIsPageBreakDeferred( false ),
         m_bStartTOC(false),
+        m_bStartTOCHeaderFooter(false),
         m_bStartedTOC(false),
         m_bTOCPageRef(false),
         m_nSymboldata(-1),
@@ -1316,22 +1317,29 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, PropertyMapP
             {
                 if (m_bStartTOC)
                 {
-                    m_bStartedTOC = true;
-                    uno::Reference< text::XTextCursor > xTOCTextCursor;
-                    xTOCTextCursor = xTextAppend->getEnd()->getText( )->createTextCursor( );
-                    xTOCTextCursor->gotoEnd(false);
-                    if (xTOCTextCursor.is())
+                    if(m_bInHeaderFooterImport && !m_bStartTOCHeaderFooter)
                     {
-                        xTextRange = xTextAppend->insertTextPortion(rString, pValues, xTOCTextCursor);
-                        xTOCTextCursor->gotoRange(xTextRange->getEnd(), true);
+                        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())
+                        {
+                            xTextRange = xTextAppend->insertTextPortion(rString, pValues, xTOCTextCursor);
+                            xTOCTextCursor->gotoRange(xTextRange->getEnd(), true);
+                        }
+                        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);
@@ -2885,6 +2893,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;
@@ -3839,6 +3849,8 @@ void DomainMapper_Impl::PopFieldContext()
                         xTOCMarkerCursor->goLeft(1,sal_True);
                         xTOCMarkerCursor->setString(OUString());
                     }
+                    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 cc4232d..ca61079 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -332,6 +332,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_bTOCPageRef;


More information about the Libreoffice-commits mailing list