sw/qa/extras/rtfexport/data/fdo79599.rtf | 38 ++++++++++++++++ sw/qa/extras/rtfexport/rtfexport.cxx | 9 +++ sw/qa/extras/rtfimport/data/fdo79599.rtf | 38 ++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 57 ++++++++++++++++++++++++- sw/source/filter/ww8/rtfattributeoutput.cxx | 2 writerfilter/source/dmapper/DomainMapper.cxx | 2 writerfilter/source/rtftok/rtfdocumentimpl.cxx | 4 - 7 files changed, 145 insertions(+), 5 deletions(-)
New commits: commit aca657b380477f122e1b541e6b0050f34bfc23de Author: Miklos Vajna <[email protected]> Date: Thu Jun 19 21:39:37 2014 +0200 whitespace Change-Id: I2db68597c83285571da2ddd1257a61a4603a90ef diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 2c747f2..3a7ebfb 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -772,7 +772,7 @@ int RTFDocumentImpl::resolvePict(bool bInline) if (xShape.is()) { uno::Reference<lang::XServiceInfo> xSI(xShape, uno::UNO_QUERY_THROW); - if(!xSI->supportsService("com.sun.star.drawing.GraphicObjectShape")) + if (!xSI->supportsService("com.sun.star.drawing.GraphicObjectShape")) xShape.clear(); } commit 7eafd8ccac56d7503b4287dfa3acac2cf0560b20 Author: [email protected] <[email protected]> Date: Tue Jun 10 12:26:26 2014 +0400 fdo#79599: use \highlightN instead of \chcbpatN in RTF import and export Reviewed on: https://gerrit.libreoffice.org/9776 Change-Id: I98ef606fb73368a3c275819cb83b936e2162769d diff --git a/sw/qa/extras/rtfexport/data/fdo79599.rtf b/sw/qa/extras/rtfexport/data/fdo79599.rtf new file mode 100755 index 0000000..f908709 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/fdo79599.rtf @@ -0,0 +1,38 @@ +{\rtf1\deff0 +{\fonttbl +{\f000 Courier New;} +} +{\colortbl; +\red0\green0\blue0; +\red255\green255\blue0; +\red0\green255\blue0; +\red0\green255\blue255; +\red255\green0\blue255; +\red0\green0\blue255; +\red255\green0\blue0; +\red0\green0\blue128; +\red0\green128\blue128; +\red0\green128\blue0; +\red128\green0\blue128; +\red128\green0\blue0; +\red128\green128\blue0; +\red128\green128\blue128; +\red192\green192\blue192; +} +\highlight0 Should be ignored\par +\highlight2 #FFFF00 = Yellow\par +\highlight3 #00FF00 = Green\par +\highlight4 #00FFFF = Cyan\par +\highlight5 #FF00FF = Magenta\par +\highlight6 #0000FF = Blue\par +\highlight7 #FF0000 = Red\par +\highlight8 #000080 = Dark blue\par +\highlight9 #008080 = Dark cyan\par +\highlight10 #008000 = Dark green\par +\highlight11 #800080 = Dark magenta\par +\highlight12 #800000 = Dark red\par +\highlight13 #808000 = Dark yellow\par +\highlight14 #808080 = Dark gray\par +\highlight15 #C0C0C0 = Light gray\par +\highlight1 #000000 = Black\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 71113f1..c01dc38 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -634,6 +634,15 @@ DECLARE_RTFEXPORT_TEST(testFdo77600, "fdo77600.rtf") CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty<OUString>(getRun(getParagraph(1), 3), "CharFontName")); } +DECLARE_RTFEXPORT_TEST(testFdo79599, "fdo79599.rtf") +{ + // test for \highlightNN, document has full \colortbl (produced in MS Word 2003 or 2007) + + // test \highlight11 = dark magenta + uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(11),1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x800080), getProperty<sal_uInt32>(xRun, "CharBackColor")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/rtfimport/data/fdo79599.rtf b/sw/qa/extras/rtfimport/data/fdo79599.rtf new file mode 100755 index 0000000..f908709 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo79599.rtf @@ -0,0 +1,38 @@ +{\rtf1\deff0 +{\fonttbl +{\f000 Courier New;} +} +{\colortbl; +\red0\green0\blue0; +\red255\green255\blue0; +\red0\green255\blue0; +\red0\green255\blue255; +\red255\green0\blue255; +\red0\green0\blue255; +\red255\green0\blue0; +\red0\green0\blue128; +\red0\green128\blue128; +\red0\green128\blue0; +\red128\green0\blue128; +\red128\green0\blue0; +\red128\green128\blue0; +\red128\green128\blue128; +\red192\green192\blue192; +} +\highlight0 Should be ignored\par +\highlight2 #FFFF00 = Yellow\par +\highlight3 #00FF00 = Green\par +\highlight4 #00FFFF = Cyan\par +\highlight5 #FF00FF = Magenta\par +\highlight6 #0000FF = Blue\par +\highlight7 #FF0000 = Red\par +\highlight8 #000080 = Dark blue\par +\highlight9 #008080 = Dark cyan\par +\highlight10 #008000 = Dark green\par +\highlight11 #800080 = Dark magenta\par +\highlight12 #800000 = Dark red\par +\highlight13 #808000 = Dark yellow\par +\highlight14 #808080 = Dark gray\par +\highlight15 #C0C0C0 = Light gray\par +\highlight1 #000000 = Black\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 8d8e048..3dec26e 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -530,6 +530,59 @@ DECLARE_RTFIMPORT_TEST(testFdo50539, "fdo50539.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharBackColor")); } +DECLARE_RTFIMPORT_TEST(testFdo79599, "fdo79599.rtf") +{ + // test for \highlightNN, document has full \colortbl (produced in MS Word 2003 or 2007) + + // ignore \highlight0 + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharBackColor")); + + // test \highlight2 = yellow + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFFFF00), getProperty<sal_uInt32>(getRun(getParagraph(2), 1), "CharBackColor")); + + // test \highlight3 = green + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00FF00), getProperty<sal_uInt32>(getRun(getParagraph(3), 1), "CharBackColor")); + + // test \highlight4 = cyan + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00FFFF), getProperty<sal_uInt32>(getRun(getParagraph(4), 1), "CharBackColor")); + + // test \highlight5 = magenta + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF00FF), getProperty<sal_uInt32>(getRun(getParagraph(5), 1), "CharBackColor")); + + // test \highlight6 = blue + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x0000FF), getProperty<sal_uInt32>(getRun(getParagraph(6), 1), "CharBackColor")); + + // test \highlight7 = red + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF0000), getProperty<sal_uInt32>(getRun(getParagraph(7), 1), "CharBackColor")); + + // test \highlight8 = dark blue + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x000080), getProperty<sal_uInt32>(getRun(getParagraph(8), 1), "CharBackColor")); + + // test \highlight9 = dark cyan + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x008080), getProperty<sal_uInt32>(getRun(getParagraph(9), 1), "CharBackColor")); + + // test \highlight10 = dark green + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x008000), getProperty<sal_uInt32>(getRun(getParagraph(10), 1), "CharBackColor")); + + // test \highlight11 = dark magenta + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x800080), getProperty<sal_uInt32>(getRun(getParagraph(11), 1), "CharBackColor")); + + // test \highlight12 = dark red + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x800000), getProperty<sal_uInt32>(getRun(getParagraph(12), 1), "CharBackColor")); + + // test \highlight13 = dark yellow + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x808000), getProperty<sal_uInt32>(getRun(getParagraph(13), 1), "CharBackColor")); + + // test \highlight14 = dark gray + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x808080), getProperty<sal_uInt32>(getRun(getParagraph(14), 1), "CharBackColor")); + + // test \highlight15 = light gray + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xC0C0C0), getProperty<sal_uInt32>(getRun(getParagraph(15), 1), "CharBackColor")); + + // test \highlight1 = black + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x000000), getProperty<sal_uInt32>(getRun(getParagraph(16), 1), "CharBackColor")); +} + DECLARE_RTFIMPORT_TEST(testFdo50665, "fdo50665.rtf") { // Access the second run, which is a textfield @@ -1059,8 +1112,8 @@ DECLARE_RTFIMPORT_TEST(testFdo61909, "fdo61909.rtf") uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1); // Was the Writer default font. CPPUNIT_ASSERT_EQUAL(OUString("Courier New"), getProperty<OUString>(xTextRange, "CharFontName")); - // Was 0x008000. - CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<sal_uInt32>(xTextRange, "CharBackColor")); + // It is white (0xFFFFFF) in document + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFFFFFF), getProperty<sal_uInt32>(xTextRange, "CharBackColor")); } DECLARE_RTFIMPORT_TEST(testFdo62288, "fdo62288.rtf") diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 969e0e2..5f41c34 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2236,7 +2236,7 @@ void RtfAttributeOutput::CharBackground(const SvxBrushItem& rBrush) { if (!rBrush.GetColor().GetTransparency()) { - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CHCBPAT); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HIGHLIGHT); m_aStyles.append((sal_Int32)m_rExport.GetColor(rBrush.GetColor())); } } diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index fea2828..a103474 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1340,6 +1340,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) rContext->Insert(PROP_CHAR_HIGHLIGHT, uno::makeAny( nColor )); else if (mnBackgroundColor) rContext->Insert(PROP_CHAR_BACK_COLOR, uno::makeAny( mnBackgroundColor )); + else + rContext->Insert(PROP_CHAR_BACK_COLOR, uno::makeAny( nIntValue )); } break; case NS_ooxml::LN_EG_RPrBase_em: diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index a2b0c60..2c747f2 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3688,7 +3688,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_HIGHLIGHT: { - RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam))); + RTFValue::Pointer_t pValue(new RTFValue(nParam ? getColorTable(nParam) : COL_AUTO)); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_highlight, pValue); } break; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
