diff options
author | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2015-02-21 10:37:54 +0100 |
---|---|---|
committer | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2015-03-21 16:19:07 +0100 |
commit | dba637ad230d132be0c8f69a630d0dfdfafc105f (patch) | |
tree | e05843b56691f386296d56b2aa399bc45d03300c /sw | |
parent | caf653c03b9152a93c3e5959921fe98adfb7d639 (diff) |
Char highlight: DOC filters
Change-Id: Ia609425f6753796091d4dfdfae8e621c062e0c15
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/globalfilter/globalfilter.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8attributeoutput.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 4 |
4 files changed, 23 insertions, 10 deletions
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index e136665e0571..6c3e94eeb260 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -360,7 +360,7 @@ void Test::testCharHighlight() const char* aFilterNames[] = { // "writer8", "Rich Text Format", -// "MS Word 97", + "MS Word 97", "Office Open XML Text", }; @@ -371,6 +371,8 @@ void Test::testCharHighlight() mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/char_highlight.docx"), "com.sun.star.text.TextDocument"); + const OString sFailedMessage = OString("Failed on filter: ") + aFilterNames[nFilter]; + // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -410,22 +412,22 @@ void Test::testCharHighlight() 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")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), nHighlightColor, getProperty<sal_Int32>(xRun,"CharHighlight")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 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")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(0xC0C0C0), getProperty<sal_Int32>(xRun,"CharHighlight")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 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_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharHighlight")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(0x0000ff), getProperty<sal_Int32>(xRun,"CharBackColor")); } } } diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 95b0010f856e..c52e9c352063 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1281,6 +1281,17 @@ void WW8AttributeOutput::CharBorder( const SvxBorderLine* pAllBorder, const sal_ m_rWW8Export.Out_BorderLine( *m_rWW8Export.pO, pAllBorder, 0, NS_sprm::LN_CBrc80, NS_sprm::LN_CBrc, bShadow ); } +void WW8AttributeOutput::CharHighlight( const SvxBrushItem& rBrush ) +{ + if( m_rWW8Export.bWrtWW8 && rBrush.GetColor() != COL_TRANSPARENT ) + { + sal_uInt8 nColor = m_rWW8Export.TransCol( rBrush.GetColor() ); + // sprmCHighlight + m_rWW8Export.InsUInt16( NS_sprm::LN_CHighlight ); + m_rWW8Export.pO->push_back( nColor ); + } +} + void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline ) { if ( m_rWW8Export.bWrtWW8 ) diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index 5b92a0f74392..eb3c64f0f1a7 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -309,7 +309,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/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 7e3148c035ff..842857309f7f 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -3822,7 +3822,7 @@ void SwWW8ImplReader::Read_CharHighlight(sal_uInt16, const sal_uInt8* pData, sho { if( nLen <= 0 ) { - pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_BACKGROUND ); + pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_HIGHLIGHT ); } else { @@ -3832,7 +3832,7 @@ void SwWW8ImplReader::Read_CharHighlight(sal_uInt16, const sal_uInt8* pData, sho b = 0; // Auto -> Black Color aCol(GetCol(b)); - NewAttr( SvxBrushItem( aCol , RES_CHRATR_BACKGROUND )); + NewAttr( SvxBrushItem( aCol , RES_CHRATR_HIGHLIGHT )); } } |