sw/qa/extras/ooxmlimport/data/tdf94043.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 8 ++++++++ sw/qa/extras/rtfexport/data/tdf94043.rtf | 17 +++++++++++++++++ sw/qa/extras/rtfexport/rtfexport.cxx | 9 +++++++++ sw/source/filter/ww8/rtfattributeoutput.cxx | 3 +++ writerfilter/source/dmapper/PropertyMap.cxx | 12 +++++++++--- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 3 +++ 7 files changed, 49 insertions(+), 3 deletions(-)
New commits: commit 5e09e31a3ae8941d8733855f0cca49756c80d1bb Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Dec 2 09:05:14 2015 +0100 tdf#94043 RTF filter: implement column separator handling Change-Id: I9d74642156d7bb79577671bae24346c75178c5c7 (cherry picked from commit 5cbe4bcc281c77f4929caf1c387f7732fc8f113b) diff --git a/sw/qa/extras/rtfexport/data/tdf94043.rtf b/sw/qa/extras/rtfexport/data/tdf94043.rtf new file mode 100644 index 0000000..36bd097 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf94043.rtf @@ -0,0 +1,17 @@ +{\rtf1 +\pard\plain +{AAA} +\par \sect\sectd\cols2\linebetcol\colsx0\ltrsect\sbknone\pard\plain +{\rtlch \ltrch\loch +Section 1, first column, this has a separator.} +\par \pard\plain +{Section 1, second column.} +\par \sect\sectd\sbknone\pard\plain +{BBB} +\par \sect\sectd\cols2\colsx0\ltrsect\sbknone\pard\plain +{Section 2, first column, this has no separator.} +\par \pard\plain +{Section 2, second column.} +\par \sect\sectd\sbknone\pard\plain +{CCC} +\par } diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 4ae23e9..1368608 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> #include <com/sun/star/text/RubyAdjust.hpp> +#include <com/sun/star/text/XTextColumns.hpp> #include <vcl/svapp.hxx> @@ -943,6 +944,14 @@ DECLARE_RTFEXPORT_TEST(testTdf92521, "tdf92521.odt") CPPUNIT_ASSERT_EQUAL(2, getPages()); } +DECLARE_RTFEXPORT_TEST(testTdf94043, "tdf94043.rtf") +{ + auto xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(2), "TextSection"); + auto xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns"); + // This was 0, the separator line was not visible due to 0 width. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), getProperty<sal_Int32>(xTextColumns, "SeparatorLineWidth")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 577d827..ab9ad06 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3330,6 +3330,9 @@ void RtfAttributeOutput::FormatColumns_Impl(sal_uInt16 nCols, const SwFormatCol& m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_COLS); m_rExport.OutLong(nCols); + if (rCol.GetLineAdj() != COLADJ_NONE) + m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LINEBETCOL); + if (bEven) { m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_COLSX); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 358e2b7..2c32453 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3530,6 +3530,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_WIDOWCTRL: m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_widowControl, std::make_shared<RTFValue>(1)); break; + case RTF_LINEBETCOL: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_sep, std::make_shared<RTFValue>(1)); + break; default: { SAL_INFO("writerfilter", "TODO handle flag '" << lcl_RtfToString(nKeyword) << "'"); commit e83b77681d8716e0e044ecaf53bbdd4d083f1137 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Dec 1 09:24:15 2015 +0100 Related: tdf#94043 DOCX import: fix column separator handling See wwSectionManager::SetCols() for the DOC import equivalent of this code, if line width is 0, then there will be still no visible line. Change-Id: Ifb0dc596e252a60cdac575fff2894aced1580c69 (cherry picked from commit be6a428c08467ec379b58c8908580a282f9a9d01) diff --git a/sw/qa/extras/ooxmlimport/data/tdf94043.docx b/sw/qa/extras/ooxmlimport/data/tdf94043.docx new file mode 100644 index 0000000..fa47be0 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf94043.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index ef59606..e19d1ba 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2989,6 +2989,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf95970, "tdf95970.docx") CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line3.Column3, 1.0)); } +DECLARE_OOXMLIMPORT_TEST(testTdf94043, "tdf94043.docx") +{ + auto xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(2), "TextSection"); + auto xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns"); + // This was 0, the separator line was not visible due to 0 width. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), getProperty<sal_Int32>(xTextColumns, "SeparatorLineWidth")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index ac02e62..90c4da3 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/text/XText.hpp> #include <com/sun/star/text/TextGridMode.hpp> #include <com/sun/star/text/XTextCopy.hpp> +#include <com/sun/star/style/VerticalAlignment.hpp> #include <comphelper/sequence.hxx> #include <comphelper/propertyvalue.hxx> #include "PropertyMapHelper.hxx" @@ -743,9 +744,14 @@ uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties( } if(m_bSeparatorLineIsOn) - xColumnPropSet->setPropertyValue( - getPropertyName( PROP_SEPARATOR_LINE_IS_ON ), - uno::makeAny( m_bSeparatorLineIsOn )); + { + xColumnPropSet->setPropertyValue("SeparatorLineIsOn", uno::makeAny(true)); + xColumnPropSet->setPropertyValue("SeparatorLineVerticalAlignment", uno::makeAny(style::VerticalAlignment_TOP)); + xColumnPropSet->setPropertyValue("SeparatorLineRelativeHeight", uno::makeAny(static_cast<sal_Int8>(100))); + xColumnPropSet->setPropertyValue("SeparatorLineColor", uno::makeAny(static_cast<sal_Int32>(COL_BLACK))); + // 1 twip -> 2 mm100. + xColumnPropSet->setPropertyValue("SeparatorLineWidth", uno::makeAny(static_cast<sal_Int32>(2))); + } xColumnContainer->setPropertyValue( sTextColumns, uno::makeAny( xColumns ) ); // Set the columns to be unbalanced if that compatibility option is set or this is the last section. if (rDM_Impl.GetSettingsTable()->GetNoColumnBalance() || rDM_Impl.GetIsLastSectionGroup()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits