[Libreoffice-commits] core.git: sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Jan 23 08:41:36 PST 2014


 sw/qa/core/data/rtf/pass/fdo54641.rtf             |   39 ++++++++++++++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    8 +++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    2 +
 3 files changed, 48 insertions(+), 1 deletion(-)

New commits:
commit 018bbe6c538d99c2f14fd4c761048848dc458f4a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jan 23 17:04:38 2014 +0100

    fdo#69649 RTF import: don't crash on empty TOC result
    
    Regression from commit 9679e9c23216decb5f9f25f85b04cb3f25211111
    (fdo#69649 Fix for pre-rendered Table Of Contents, 2013-12-30), the
    situation that the field doesn't have a result wasn't handled, resulting
    in a m_aTextAppendStack.pop() call in dmapper, without a matching
    .push() one.
    
    Change-Id: I456d9096d01fb27832a40f6b72802ec555d62647

diff --git a/sw/qa/core/data/rtf/pass/fdo54641.rtf b/sw/qa/core/data/rtf/pass/fdo54641.rtf
new file mode 100644
index 0000000..25a3f7e
--- /dev/null
+++ b/sw/qa/core/data/rtf/pass/fdo54641.rtf
@@ -0,0 +1,39 @@
+{\rtf1
+{\stylesheet
+{\s0\qj\widctlpar\f0\fs20 \snext0 Normal;}
+{\cs10 \additive\ssemihidden Default Paragraph Font;}
+{\s1\qc\sb240\sa120\keepn\f0\b\fs40 \sbasedon0\snext0 Part;}
+{\s2\ql\sb240\sa120\keepn\f0\b\fs40 \sbasedon0\snext0 heading 1;}
+{\s3\ql\sb240\sa120\keepn\f0\b\fs32 \sbasedon0\snext0 heading 2;}
+}
+\paperw11960\paperh16900\margl2500\margr2560\margt2520\margb1820\pgnstart0\widowctrl\qj\ftnbj\f0\aftnnar
+{\pard\plain\s20\qc\sb240\sa240\b\f0\fs36\sl240\slmult1 \fi0 De titel van het testfile\par
+\pard\plain\s21\qc\sa120\f0\fs20\sl240\slmult1 \sb120 \fi0 \chdate \par
+\pard\plain\s80\ql\sb240\sa120\keepn\f0\b\fs20\sl240\slmult1 \sb120 \fi0  Inhoudsopgave\par
+\pard\plain\s0\qj\widctlpar\f0\fs20\sl240\slmult1 \sb120 \fi0 \par
+{\field
+{\*\fldinst TOC \\o "1-3" }
+{\fldrslt }
+}
+\page
+\pard\plain\s0\qj\widctlpar\f0\fs20\sl240\slmult1 \sb180 \fi0 
+{}
+\par
+\pard\plain\ql\sb240\sa120\keepn\f0\b\fs40\sl240\slmult1 \sb120 \fi0 Hoofdstuk 1\par
+\pard\plain\s2\ql\sb240\sa120\keepn\f0\b\fs40\sl240\slmult1 \sb360 \fi0 De eerste test\par
+\pard\plain\s0\qj\widctlpar\f0\fs20\sl240\slmult1 \sb360 \fi0 In dit hoofdstuk zullen de eerste tests uitgevoerd worden.\par
+\pard\plain\s3\ql\sb240\sa120\keepn\f0\b\fs32\sl240\slmult1 \sb360 \fi0 1.1  Figuren\par
+{\pard\plain\s31\qc\sb120\sa0\keep\widctlpar\f0\fs20\sl240\slmult1 \sb420 \fi0  
+{\pict\picscalex92\picscaley92\piccropl0\piccropr0\piccropt0\piccropb0
+\picw20032\pich2725\picwgoal5357\pichgoal1545\pngblip\bliptag-1891142031
+{\*\blipuid 8f477671d3377e167ce61bb2e9de72f7}
+47494638396110001000d5ff00000000ffffffc0c0c0555f00ffffaafcfcfcf6f6f6eaeaeae6e6e6e4e4e4e3e3e3c2c2c2c1c1c1bcbcbcb5b5b5b3b3b3b0b0b0adadada5a5a5a2a2a2a1a1a19f9f9f9494948a8a8a8888888686867b7b7b6c6c6c5c5c5c4e4e4e4b4b4b4747474646463d3d3d3c3c3c2e2e2e2525251b1b1b18181810101009090906060603030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021f90401000002002c0000000010001000000684408170482c0a06c8a4728924389f506833b281302a8e6b164b18103024c52111504cca67332102e0042e9a40d9319f8300a343c1200f54e47f7e2a00001e0b0a7d0d728a010d838400261a7c0d94947784252700127e9d159f6c8411140019080ea7a9a85f842122281612b1b3b25d6b1f29291d0fbbbdbc5d5e51c34e4cc64a46c94341003b
+}
+\par
+}
+\pard\plain\s0\qj\widctlpar\f0\fs20\sl240\slmult1 \sb240 \fi0 De test wordt gevormd door een enkele, simpele figuur
+[
+].\par
+\pard\plain\s3\ql\sb240\sa120\keepn\f0\b\fs32\sl240\slmult1 \sb360 \fi0 1.2  Tabellen\par
+}
+}
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1d44373..74173fd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -145,6 +145,7 @@ DomainMapper_Impl::DomainMapper_Impl(
         m_bIsColumnBreakDeferred( false ),
         m_bIsPageBreakDeferred( false ),
         m_bStartTOC(false),
+        m_bStartedTOC(false),
         m_bTOCPageRef(false),
         m_pLastSectionContext( ),
         m_pLastCharacterContext(),
@@ -1164,6 +1165,7 @@ 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);
@@ -3584,7 +3586,11 @@ void DomainMapper_Impl::PopFieldContext()
                 if( xToInsert.is() )
                 {
                     m_bStartTOC = false;
-                    m_aTextAppendStack.pop();
+                    if (m_bStartedTOC)
+                    {
+                        m_aTextAppendStack.pop();
+                        m_bStartedTOC = false;
+                    }
                     if(xTOCMarkerCursor.is())
                     {
                         xTOCMarkerCursor->goLeft(1,sal_True);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index c7c7f59..11fa2e4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -313,6 +313,8 @@ private:
     bool                                                                            m_bIsColumnBreakDeferred;
     bool                                                                            m_bIsPageBreakDeferred;
     bool                                                                            m_bStartTOC;
+    /// If we got any text that is the pre-rendered result of the TOC field.
+    bool                                                                            m_bStartedTOC;
     bool                                                                            m_bTOCPageRef;
 
     LineNumberSettings                                                              m_aLineNumberSettings;


More information about the Libreoffice-commits mailing list