sw/qa/extras/rtfimport/data/fdo67365.rtf | 35 +++++++++++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 17 ++++++++++++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 8 ++++- 3 files changed, 58 insertions(+), 2 deletions(-)
New commits: commit 83e0489217fd4b0fcf3ab62d002257b47e7a6459 Author: Miklos Vajna <vmik...@suse.cz> Date: Sat Jul 27 01:03:06 2013 +0200 fdo#67365 testcase Change-Id: I921eda30f60e5466e381922193c2a46be10ad65c diff --git a/sw/qa/extras/rtfimport/data/fdo67365.rtf b/sw/qa/extras/rtfimport/data/fdo67365.rtf new file mode 100755 index 0000000..07755cc --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo67365.rtf @@ -0,0 +1,35 @@ +{\rtf1 +\paperw11906\paperh16838\margl1134\margr567\margt851\margb567 \widowctrl\ftnbj\aenddoc\hyphcaps0\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot \fet0 +\sectd \linex0\headery397\footery397\colsx709\endnhere\sectdefaultcl +\trowd \trgaph28\trleft-28\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr \brdrs\brdrw10 \cltxlrtb \cellx5387\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx10206 +\pard \li57\widctlpar\intbl\adjustright +{\fs22 A1\cell } +\pard \qc\widctlpar\intbl\adjustright +{\fs22 +\cell } +\pard \widctlpar\intbl\adjustright +{\fs22 \row } +\trowd \trgaph28\trleft-28\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx5387\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx10206 +\pard \li57\widctlpar\intbl\adjustright +{ +\fs22 A2\cell } +\pard \qc\widctlpar\intbl\adjustright +{\fs22 \cell } +\pard \widctlpar\intbl\adjustright +{\fs22 \row } +\pard \li57\widctlpar\intbl\adjustright +{\fs22 A3\cell } +\pard +\qc\widctlpar\intbl\adjustright +{\fs22 \cell } +\pard \widctlpar\intbl\adjustright +{\fs22 \row } +\trowd \trgaph28\trleft-28\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv \brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx5387\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx10206 +\pard \li57\widctlpar\intbl\adjustright +{\fs22 A4\cell \cell } +\pard \widctlpar\intbl\adjustright +{\fs22 \row } +\pard \qj\sb120\widctlpar\adjustright +foo +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index eabdd69..c676d08 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -157,6 +157,7 @@ public: void testFdo54900(); void testFdo64637(); void testN820504(); + void testFdo67365(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -299,6 +300,7 @@ void Test::run() {"fdo54900.rtf", &Test::testFdo54900}, {"fdo64637.rtf", &Test::testFdo64637}, {"n820504.rtf", &Test::testN820504}, + {"fdo67365.rtf", &Test::testFdo67365}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1453,6 +1455,21 @@ void Test::testN820504() CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(xDraws->getByIndex(0), "AnchorType")); } +void Test::testFdo67365() +{ + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xRows = xTable->getRows(); + // The table only had 3 rows. + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xRows->getCount()); + // This was 4999, i.e. the two cells of the row had equal widths instead of a larger and a smaller cell. + CPPUNIT_ASSERT_EQUAL(sal_Int16(5290), getProperty< uno::Sequence<text::TableColumnSeparator> >(xRows->getByIndex(2), "TableColumnSeparators")[0].Position); + uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A2"), uno::UNO_QUERY); + // Paragraph was aligned to center, should be left. + CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_LEFT, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraphOfText(1, xCell->getText()), "ParaAdjust"))); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 165cd8332a0844314e698cf59936799676257ea1 Author: Miklos Vajna <vmik...@suse.cz> Date: Sat Jul 27 00:34:04 2013 +0200 fdo#67365 fix RTF import of RTF_QC in table cells wrt unusual group stack Change-Id: I487e1a941f499ab3d0a820c790af051a9b972376 diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index da64926..1ca8f17 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2279,6 +2279,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) lcl_eraseNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_after); m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PDxaLeft); m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PDxaRight); + m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PJc); } m_aStates.top().resetFrame(); break; commit 986ebb668d45a42bc1e8b744980619857e891ef5 Author: Miklos Vajna <vmik...@suse.cz> Date: Sat Jul 27 00:13:00 2013 +0200 fdo#67365 fix RTF import of inherited cell widths In theory, this is not needed since 01292f171cc851ba092510f10a97cd293670829e, and in practice it even causes a problem here. Change-Id: Id2c2f3f7815efada138f3f84724af77be3372fc1 diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 4b2b142..da64926 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1860,8 +1860,6 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) m_aStates.top().aTableCellsSprms = m_aStates.top().aTableInheritingCellsSprms; m_aStates.top().aTableCellsAttributes = m_aStates.top().aTableInheritingCellsAttributes; m_aStates.top().nCells = m_aStates.top().nInheritingCells; - // This can't be the first row, and we need cell width only there - while(m_aStates.top().aTableRowSprms.erase(NS_ooxml::LN_CT_TblGridBase_gridCol)) ; } for (int i = 0; i < m_aStates.top().nCells; ++i) { commit 494937776956370eda868f91922c4cff34656050 Author: Miklos Vajna <vmik...@suse.cz> Date: Sat Jul 27 00:06:51 2013 +0200 fdo#67365 fix RTF import of inherited row props wrt unusual group stack Change-Id: I273d89a0708601a38dd8bda734a72b4c92da2cc4 diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 56e1759..4b2b142 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -4691,6 +4691,11 @@ int RTFDocumentImpl::popState() m_aStates.top().nCells = aState.nCells; m_aStates.top().aTableCellsSprms = aState.aTableCellsSprms; m_aStates.top().aTableCellsAttributes = aState.aTableCellsAttributes; + + // Also the inherited properties should be kept accross groups. + m_aStates.top().aTableInheritingCellsSprms = aState.aTableInheritingCellsSprms; + m_aStates.top().aTableInheritingCellsAttributes = aState.aTableInheritingCellsAttributes; + m_aStates.top().nInheritingCells = aState.nInheritingCells; } return 0; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits