summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <zolnaitamas2000@gmail.com>2015-03-18 10:22:51 +0100
committerZolnai Tamás <zolnaitamas2000@gmail.com>2015-03-21 16:19:07 +0100
commitcaf653c03b9152a93c3e5959921fe98adfb7d639 (patch)
tree36adce1243ada028d7fbd667eed5f629349efdd2
parent8f01925d98dabdbf400c9263e08242267b2b9701 (diff)
Char highlight: RTF filters
Handle \highlightN and \chcbpatN separately. Change-Id: I20546bd4c26154e8b1168f87dcb4ab44a192ad83
-rw-r--r--sw/qa/extras/globalfilter/data/char_highlight.docx (renamed from sw/qa/extras/ooxmlexport/data/char_highlight.docx)bin4091 -> 4091 bytes
-rw-r--r--sw/qa/extras/globalfilter/globalfilter.cxx80
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport3.cxx49
-rw-r--r--sw/qa/extras/rtfexport/data/fdo79599.rtf38
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx9
-rw-r--r--sw/qa/extras/rtfimport/data/fdo79599.rtf38
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx56
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx11
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.hxx2
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx2
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx21
-rw-r--r--writerfilter/source/dmapper/DomainMapper.hxx2
12 files changed, 106 insertions, 202 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/char_highlight.docx b/sw/qa/extras/globalfilter/data/char_highlight.docx
index 841fc3e3a8e9..841fc3e3a8e9 100644
--- a/sw/qa/extras/ooxmlexport/data/char_highlight.docx
+++ b/sw/qa/extras/globalfilter/data/char_highlight.docx
Binary files differ
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index ae874729d505..e136665e0571 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -28,12 +28,14 @@ public:
void testLinkedGraphicRT();
void testImageWithSpecialID();
void testGraphicShape();
+ void testCharHighlight();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testSwappedOutImageExport);
CPPUNIT_TEST(testLinkedGraphicRT);
CPPUNIT_TEST(testImageWithSpecialID);
CPPUNIT_TEST(testGraphicShape);
+ CPPUNIT_TEST(testCharHighlight);
CPPUNIT_TEST_SUITE_END();
};
@@ -350,6 +352,84 @@ void Test::testGraphicShape()
}
}
+void Test::testCharHighlight()
+{
+ // MS Word has two kind of character backgrounds called character shading and highlighting
+ // Now we support these two background attributes colors both in import and export code
+
+ const char* aFilterNames[] = {
+// "writer8",
+ "Rich Text Format",
+// "MS Word 97",
+ "Office Open XML Text",
+ };
+
+ for( size_t nFilter = 0; nFilter < SAL_N_ELEMENTS(aFilterNames); ++nFilter )
+ {
+ if (mxComponent.is())
+ mxComponent->dispose();
+ mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/char_highlight.docx"),
+ "com.sun.star.text.TextDocument");
+
+ // Export the document and import again for a check
+ uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+
+ utl::MediaDescriptor aMediaDescriptor;
+ aMediaDescriptor["FilterName"] <<= OUString::createFromAscii(aFilterNames[nFilter]);
+
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+ uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY);
+ xComponent->dispose();
+ mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument");
+
+ const uno::Reference< text::XTextRange > xPara = getParagraph(1);
+ // Both highlight and background
+ const sal_Int32 nBackColor(0x4F81BD);
+ for( int nRun = 1; nRun <= 16; ++nRun )
+ {
+ const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,nRun), uno::UNO_QUERY);
+ sal_Int32 nHighlightColor = 0;
+ switch( nRun )
+ {
+ case 1: nHighlightColor = 0x000000; break; //black
+ case 2: nHighlightColor = 0x0000ff; break; //blue
+ case 3: nHighlightColor = 0x00ffff; break; //cyan
+ case 4: nHighlightColor = 0x00ff00; break; //green
+ case 5: nHighlightColor = 0xff00ff; break; //magenta
+ case 6: nHighlightColor = 0xff0000; break; //red
+ case 7: nHighlightColor = 0xffff00; break; //yellow
+ case 8: nHighlightColor = 0xffffff; break; //white
+ case 9: nHighlightColor = 0x000080; break;//dark blue
+ case 10: nHighlightColor = 0x008080; break; //dark cyan
+ case 11: nHighlightColor = 0x008000; break; //dark green
+ case 12: nHighlightColor = 0x800080; break; //dark magenta
+ case 13: nHighlightColor = 0x800000; break; //dark red
+ case 14: nHighlightColor = 0x808000; break; //dark yellow
+ case 15: nHighlightColor = 0x808080; break; //dark gray
+ case 16: nHighlightColor = 0xC0C0C0; break; //light gray
+ }
+ CPPUNIT_ASSERT_EQUAL(nHighlightColor, getProperty<sal_Int32>(xRun,"CharHighlight"));
+ CPPUNIT_ASSERT_EQUAL(nBackColor, getProperty<sal_Int32>(xRun,"CharBackColor"));
+ }
+
+ // Only highlight
+ {
+ const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,17), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0C0C0), getProperty<sal_Int32>(xRun,"CharHighlight"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharBackColor"));
+ }
+
+ // Only background
+ {
+ const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,18), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharHighlight"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x0000ff), getProperty<sal_Int32>(xRun,"CharBackColor"));
+ }
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 0036db92f1ff..19c079ede5ef 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -469,55 +469,6 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx")
CPPUNIT_ASSERT_EQUAL(OUString("RenderedShapes"), nValue); // Rendered bitmap has the proper name
}
-
-DECLARE_OOXMLEXPORT_TEST(testCharHighlight, "char_highlight.docx")
-{
- const uno::Reference< text::XTextRange > xPara = getParagraph(1);
- // Both highlight and background
- const sal_Int32 nBackColor(0x4F81BD);
- for( int nRun = 1; nRun <= 16; ++nRun )
- {
- const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,nRun), uno::UNO_QUERY);
- sal_Int32 nHighlightColor = 0;
- switch( nRun )
- {
- case 1: nHighlightColor = 0x000000; break; //black
- case 2: nHighlightColor = 0x0000ff; break; //blue
- case 3: nHighlightColor = 0x00ffff; break; //cyan
- case 4: nHighlightColor = 0x00ff00; break; //green
- case 5: nHighlightColor = 0xff00ff; break; //magenta
- case 6: nHighlightColor = 0xff0000; break; //red
- case 7: nHighlightColor = 0xffff00; break; //yellow
- case 8: nHighlightColor = 0xffffff; break; //white
- case 9: nHighlightColor = 0x000080; break;//dark blue
- case 10: nHighlightColor = 0x008080; break; //dark cyan
- case 11: nHighlightColor = 0x008000; break; //dark green
- case 12: nHighlightColor = 0x800080; break; //dark magenta
- case 13: nHighlightColor = 0x800000; break; //dark red
- case 14: nHighlightColor = 0x808000; break; //dark yellow
- case 15: nHighlightColor = 0x808080; break; //dark gray
- case 16: nHighlightColor = 0xC0C0C0; break; //light gray
- }
- CPPUNIT_ASSERT_EQUAL(nHighlightColor, getProperty<sal_Int32>(xRun,"CharHighlight"));
- CPPUNIT_ASSERT_EQUAL(nBackColor, getProperty<sal_Int32>(xRun,"CharBackColor"));
- }
-
- // Only highlight
- {
- const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,17), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0C0C0), getProperty<sal_Int32>(xRun,"CharHighlight"));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharBackColor"));
- }
-
- // Only background
- {
- const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,18), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharHighlight"));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(0x0000ff), getProperty<sal_Int32>(xRun,"CharBackColor"));
- }
-}
-
-
DECLARE_OOXMLEXPORT_TEST(testFontNameIsEmpty, "font-name-is-empty.docx")
{
// Check no empty font name is exported
diff --git a/sw/qa/extras/rtfexport/data/fdo79599.rtf b/sw/qa/extras/rtfexport/data/fdo79599.rtf
deleted file mode 100644
index f9087091e1b3..000000000000
--- a/sw/qa/extras/rtfexport/data/fdo79599.rtf
+++ /dev/null
@@ -1,38 +0,0 @@
-{\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 de571a2eda7e..3ef2f13bfc07 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -670,15 +670,6 @@ 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"));
-}
-
DECLARE_RTFEXPORT_TEST(testFdo80167, "fdo80167.rtf")
{
// Problem was that after export, the page break was missing, so this was 1.
diff --git a/sw/qa/extras/rtfimport/data/fdo79599.rtf b/sw/qa/extras/rtfimport/data/fdo79599.rtf
deleted file mode 100644
index f9087091e1b3..000000000000
--- a/sw/qa/extras/rtfimport/data/fdo79599.rtf
+++ /dev/null
@@ -1,38 +0,0 @@
-{\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 766ade91daa6..5cffa27215bb 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -604,59 +604,6 @@ 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
@@ -1211,8 +1158,7 @@ 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"));
- // It is white (0xFFFFFF) in document
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFFFFFF), getProperty<sal_uInt32>(xTextRange, "CharBackColor"));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, 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 83ef2bad3444..ad3cf5e932d1 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -2305,7 +2305,7 @@ void RtfAttributeOutput::CharBackground(const SvxBrushItem& rBrush)
{
if (!rBrush.GetColor().GetTransparency())
{
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HIGHLIGHT);
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CHCBPAT);
m_aStyles.append((sal_Int32)m_rExport.GetColor(rBrush.GetColor()));
}
}
@@ -2470,6 +2470,15 @@ void RtfAttributeOutput::CharBorder(const SvxBorderLine* pAllBorder, const sal_u
m_aStyles.append(OutBorderLine(m_rExport, pAllBorder, OOO_STRING_SVTOOLS_RTF_CHBRDR, nDist, bShadow ? SVX_SHADOW_BOTTOMRIGHT : SVX_SHADOW_NONE));
}
+void RtfAttributeOutput::CharHighlight(const SvxBrushItem& rBrush)
+{
+ if (!rBrush.GetColor().GetTransparency())
+ {
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HIGHLIGHT);
+ m_aStyles.append((sal_Int32)m_rExport.GetColor(rBrush.GetColor()));
+ }
+}
+
void RtfAttributeOutput::TextINetFormat(const SwFmtINetFmt& rURL)
{
if (!rURL.GetValue().isEmpty())
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 20b76a27b25a..a307885d7182 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -328,7 +328,7 @@ protected:
virtual void CharBorder(const ::editeng::SvxBorderLine* pAllBorder, const sal_uInt16 nDist, const bool bShadow) SAL_OVERRIDE;
/// Sfx item RES_CHRATR_HIGHLIGHT
- virtual void CharHighlight(const SvxBrushItem&) SAL_OVERRIDE {};
+ virtual void CharHighlight(const SvxBrushItem&) SAL_OVERRIDE;
/// Sfx item RES_TXTATR_INETFMT
virtual void TextINetFormat(const SwFmtINetFmt&) SAL_OVERRIDE;
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index a8b991bcfd67..8b1ae6d715ab 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -976,7 +976,7 @@ void RtfExport::OutColorTable()
// background color
static const sal_uInt16 aBrushIds[] =
{
- RES_BACKGROUND, RES_CHRATR_BACKGROUND, 0
+ RES_BACKGROUND, RES_CHRATR_BACKGROUND, RES_CHRATR_HIGHLIGHT, 0
};
for (const sal_uInt16* pIds = aBrushIds; *pIds; ++pIds)
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 5ee0239ece12..989465101f62 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -102,7 +102,7 @@ LoggedProperties(dmapper_logger, "DomainMapper"),
LoggedTable(dmapper_logger, "DomainMapper"),
LoggedStream(dmapper_logger, "DomainMapper"),
m_pImpl( new DomainMapper_Impl( *this, xContext, xModel, eDocumentType, xInsertTextRange, !rMediaDesc.getUnpackedValueOrDefault("InsertMode", false))),
- mnBackgroundColor(0), mbIsHighlightSet(false), mbIsSplitPara(false)
+ mbIsSplitPara(false)
{
// #i24363# tab stops relative to indent
m_pImpl->SetDocumentSettingsProperty(
@@ -1412,13 +1412,18 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
break;
case NS_ooxml::LN_EG_RPrBase_highlight:
{
- sal_Int32 nColor = 0;
- if( (mbIsHighlightSet = getColorFromId(nIntValue, nColor)) )
- 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 ));
+ // OOXML import uses an ID
+ if( IsOOXMLImport() )
+ {
+ sal_Int32 nColor = 0;
+ if( getColorFromId(nIntValue, nColor) )
+ rContext->Insert(PROP_CHAR_HIGHLIGHT, uno::makeAny( nColor ));
+ }
+ // RTF import uses the actual color value
+ else if( IsRTFImport() )
+ {
+ rContext->Insert(PROP_CHAR_HIGHLIGHT, uno::makeAny( nIntValue ));
+ }
}
break;
case NS_ooxml::LN_EG_RPrBase_em:
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx
index 988c7ab8396d..9340722ea257 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -170,8 +170,6 @@ private:
OUString getBracketStringFromEnum(const sal_Int32 nIntValue, const bool bIsPrefix = true);
com::sun::star::style::TabAlign getTabAlignFromValue(const sal_Int32 nIntValue);
sal_Unicode getFillCharFromValue(const sal_Int32 nIntValue);
- sal_Int32 mnBackgroundColor;
- bool mbIsHighlightSet;
bool mbIsSplitPara;
boost::scoped_ptr< GraphicZOrderHelper > zOrderHelper;
};