Kaydet (Commit) dba637ad authored tarafından Zolnai Tamás's avatar Zolnai Tamás

Char highlight: DOC filters

Change-Id: Ia609425f6753796091d4dfdfae8e621c062e0c15
üst caf653c0
...@@ -360,7 +360,7 @@ void Test::testCharHighlight() ...@@ -360,7 +360,7 @@ void Test::testCharHighlight()
const char* aFilterNames[] = { const char* aFilterNames[] = {
// "writer8", // "writer8",
"Rich Text Format", "Rich Text Format",
// "MS Word 97", "MS Word 97",
"Office Open XML Text", "Office Open XML Text",
}; };
...@@ -371,6 +371,8 @@ void Test::testCharHighlight() ...@@ -371,6 +371,8 @@ void Test::testCharHighlight()
mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/char_highlight.docx"), mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/char_highlight.docx"),
"com.sun.star.text.TextDocument"); "com.sun.star.text.TextDocument");
const OString sFailedMessage = OString("Failed on filter: ") + aFilterNames[nFilter];
// Export the document and import again for a check // Export the document and import again for a check
uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
...@@ -410,22 +412,22 @@ void Test::testCharHighlight() ...@@ -410,22 +412,22 @@ void Test::testCharHighlight()
case 15: nHighlightColor = 0x808080; break; //dark gray case 15: nHighlightColor = 0x808080; break; //dark gray
case 16: nHighlightColor = 0xC0C0C0; break; //light gray case 16: nHighlightColor = 0xC0C0C0; break; //light gray
} }
CPPUNIT_ASSERT_EQUAL(nHighlightColor, getProperty<sal_Int32>(xRun,"CharHighlight")); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), nHighlightColor, getProperty<sal_Int32>(xRun,"CharHighlight"));
CPPUNIT_ASSERT_EQUAL(nBackColor, getProperty<sal_Int32>(xRun,"CharBackColor")); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), nBackColor, getProperty<sal_Int32>(xRun,"CharBackColor"));
} }
// Only highlight // Only highlight
{ {
const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,17), uno::UNO_QUERY); 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_MESSAGE(sFailedMessage.getStr(), 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(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharBackColor"));
} }
// Only background // Only background
{ {
const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,18), uno::UNO_QUERY); 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_MESSAGE(sFailedMessage.getStr(), 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(0x0000ff), getProperty<sal_Int32>(xRun,"CharBackColor"));
} }
} }
} }
......
...@@ -1281,6 +1281,17 @@ void WW8AttributeOutput::CharBorder( const SvxBorderLine* pAllBorder, const sal_ ...@@ -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 ); 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 ) void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline )
{ {
if ( m_rWW8Export.bWrtWW8 ) if ( m_rWW8Export.bWrtWW8 )
......
...@@ -309,7 +309,7 @@ protected: ...@@ -309,7 +309,7 @@ protected:
virtual void CharBorder( const ::editeng::SvxBorderLine* pAllBorder, const sal_uInt16 nDist, const bool bShadow ) SAL_OVERRIDE; virtual void CharBorder( const ::editeng::SvxBorderLine* pAllBorder, const sal_uInt16 nDist, const bool bShadow ) SAL_OVERRIDE;
/// Sfx item RES_CHRATR_HIGHLIGHT /// Sfx item RES_CHRATR_HIGHLIGHT
virtual void CharHighlight( const SvxBrushItem& ) SAL_OVERRIDE {}; virtual void CharHighlight( const SvxBrushItem& ) SAL_OVERRIDE;
/// Sfx item RES_TXTATR_INETFMT /// Sfx item RES_TXTATR_INETFMT
virtual void TextINetFormat( const SwFmtINetFmt& ) SAL_OVERRIDE; virtual void TextINetFormat( const SwFmtINetFmt& ) SAL_OVERRIDE;
......
...@@ -3822,7 +3822,7 @@ void SwWW8ImplReader::Read_CharHighlight(sal_uInt16, const sal_uInt8* pData, sho ...@@ -3822,7 +3822,7 @@ void SwWW8ImplReader::Read_CharHighlight(sal_uInt16, const sal_uInt8* pData, sho
{ {
if( nLen <= 0 ) if( nLen <= 0 )
{ {
pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_BACKGROUND ); pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_HIGHLIGHT );
} }
else else
{ {
...@@ -3832,7 +3832,7 @@ void SwWW8ImplReader::Read_CharHighlight(sal_uInt16, const sal_uInt8* pData, sho ...@@ -3832,7 +3832,7 @@ void SwWW8ImplReader::Read_CharHighlight(sal_uInt16, const sal_uInt8* pData, sho
b = 0; // Auto -> Black b = 0; // Auto -> Black
Color aCol(GetCol(b)); Color aCol(GetCol(b));
NewAttr( SvxBrushItem( aCol , RES_CHRATR_BACKGROUND )); NewAttr( SvxBrushItem( aCol , RES_CHRATR_HIGHLIGHT ));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment