[Libreoffice-commits] .: sw/qa writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Dec 24 06:24:05 PST 2012
sw/qa/extras/rtfimport/data/fdo57678.rtf | 34 +++++++++++++++++++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 10 +++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 12 +++++---
3 files changed, 52 insertions(+), 4 deletions(-)
New commits:
commit 4a507f732d82c188ad81b022cbe3037951e58ac3
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Mon Dec 24 15:06:15 2012 +0100
fdo#57678 fix import of RTF_PARD between RTF_CELL and RTF_ROW
diff --git a/sw/qa/extras/rtfimport/data/fdo57678.rtf b/sw/qa/extras/rtfimport/data/fdo57678.rtf
new file mode 100644
index 0000000..e0a26cd
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo57678.rtf
@@ -0,0 +1,34 @@
+{\rtf\ansi\deff0
+{\fonttbl{\f0 Times New Roman;}}
+{\colortbl;\red0\green0\blue0;}
+{\info
+}
+\paperw11907 \paperh16443 \deftab1298 \margl1701 \margr1701 \margt567 \margb1134 \pgnstart1\ftnnar \aftnnrlc \ftnstart1 \aftnstart1
+\trowd\trowd\cellx1701\cellx3402
+
+\intbl\itap1
+\qc{Cell 1:1}
+\cell\pard
+
+\intbl\itap1
+\qc{Cell 1:2}
+\cell\pard
+
+\row
+\pard\itap0
+\par \trowd\trowd \cellx1701\cellx3402\cellx5103\cellx6804
+
+\intbl\itap1
+{cell 1:1}
+\cell\pard
+
+{{\~}}\cell\pard
+
+{{\~}}\cell\pard
+
+{{\~}}\cell\pard
+
+\row
+\pard\itap0
+
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 0d0f3af..8a904ba 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -131,6 +131,7 @@ public:
void testFdo49934();
void testFdo57886();
void testFdo58076();
+ void testFdo57678();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -212,6 +213,7 @@ void Test::run()
{"fdo49934.rtf", &Test::testFdo49934},
{"fdo57886.rtf", &Test::testFdo57886},
{"fdo58076.rtf", &Test::testFdo58076},
+ {"fdo57678.rtf", &Test::testFdo57678},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -980,6 +982,14 @@ void Test::testFdo58076()
CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xStyle, "BottomMargin"));
}
+void Test::testFdo57678()
+{
+ // Paragraphs of the two tables were not converted to tables.
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 4ad99ce..e5f9c29 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2078,11 +2078,15 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_PARD:
if (m_bHadPicture)
dispatchSymbol(RTF_PAR);
- m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
- m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes;
+ // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table.
+ if (m_aStates.top().nCells == 0)
+ {
+ m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
+ m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes;
+ if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT)
+ m_pCurrentBuffer = 0;
+ }
m_aStates.top().resetFrame();
- if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT)
- m_pCurrentBuffer = 0;
break;
case RTF_SECTD:
m_aStates.top().aSectionSprms = m_aDefaultState.aSectionSprms;
More information about the Libreoffice-commits
mailing list