Kaydet (Commit) b41f0304 authored tarafından Lei De Bin's avatar Lei De Bin Kaydeden (comit) Caolán McNamara

Resolves: #i35763# fix WW8: Wrong import/export of underlining colours

more detail pls check

http://wiki.services.openoffice.org/wiki/Writer/Underline_Color

Reported by: gonzalez
Patch by: Chen Zuo Jun
Review by: Lei De Bin
(cherry picked from commit 74f769f8)

Conflicts:
	sw/source/filter/ww8/ww8atr.cxx

Change-Id: Ie9c01c3c7fcd74c059e97ff98a1c67b15c5fcd5c
üst 4f3d79c1
......@@ -187,6 +187,7 @@ public:
void MarkAllAttrsOld();
void KillUnlockedAttrs(const SwPosition& pPos);
SfxPoolItem* GetFmtStackAttr(sal_uInt16 nWhich, sal_uInt16 * pPos = 0);
const SfxPoolItem* GetOpenStackAttr(const SwPosition& rPos, sal_uInt16 nWhich);
const SfxPoolItem* GetFmtAttr(const SwPosition& rPos, sal_uInt16 nWhich);
void Delete(const SwPaM &rPam);
......
......@@ -730,6 +730,23 @@ SfxPoolItem* SwFltControlStack::GetFmtStackAttr(sal_uInt16 nWhich, sal_uInt16 *
return 0;
}
const SfxPoolItem* SwFltControlStack::GetOpenStackAttr(const SwPosition& rPos, sal_uInt16 nWhich)
{
SwFltPosition aFltPos(rPos);
size_t nSize = maEntries.size();
while (nSize)
{
SwFltStackEntry &rEntry = maEntries[--nSize];
if (rEntry.bOpen && rEntry.pAttr->Which() == nWhich && rEntry.m_aMkPos == aFltPos)
{
return (SfxPoolItem*)rEntry.pAttr;
}
}
return 0;
}
const SfxPoolItem* SwFltControlStack::GetFmtAttr(const SwPosition& rPos, sal_uInt16 nWhich)
{
SfxPoolItem* pHt = GetFmtStackAttr(nWhich);
......
......@@ -1283,6 +1283,16 @@ void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline )
}
m_rWW8Export.pO->push_back( b );
Color aColor = rUnderline.GetColor();
if( aColor != COL_TRANSPARENT )
{
if( m_rWW8Export.bWrtWW8 )
{
m_rWW8Export.InsUInt16( 0x6877 );
m_rWW8Export.InsUInt32( wwUtility::RGBToBGR( aColor.GetColor() ) );
}
}
}
void WW8AttributeOutput::CharLanguage( const SvxLanguageItem& rLanguage )
......
......@@ -1727,6 +1727,7 @@ public: // eigentlich private, geht aber leider nur public
void Read_ParaBiDi(sal_uInt16, const sal_uInt8* pData, short nLen);
static sal_uInt32 ExtractColour(const sal_uInt8* &rpData, bool bVer67);
void Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, short nLen);
long MapBookmarkVariables(const WW8FieldDesc* pF,String &rOrigName,
const String &rData);
String GetMappedBookmark(const String &rOrigName);
......
......@@ -3311,6 +3311,53 @@ void SwWW8ImplReader::Read_TxtForeColor(sal_uInt16, const sal_uInt8* pData, shor
}
}
void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, short nLen)
{
if( nLen < 0 )
{
//because the UnderlineColor is not a standalone attribute in SW, it belongs to the underline attribute.
//And, the .doc file stores attributes separately, this attribute ends here, the "underline"
//attribute also terminates (if the character next owns underline, that will be a new underline attribute).
//so nothing is left to be done here.
return;
}
else
{
if ( pAktColl ) //importing style
{
if( SFX_ITEM_SET == pAktColl->GetItemState( RES_CHRATR_UNDERLINE, sal_False ) )
{
const SwAttrSet& aSet = pAktColl->GetAttrSet();
SvxUnderlineItem *pUnderline
= (SvxUnderlineItem *)(aSet.Get( RES_CHRATR_UNDERLINE, sal_False ).Clone());
if(pUnderline){
pUnderline->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) ) );
pAktColl->SetFmtAttr( *pUnderline );
delete pUnderline;
}
}
}
else if ( pAktItemSet )
{
if ( SFX_ITEM_SET == pAktItemSet->GetItemState( RES_CHRATR_UNDERLINE, sal_False ) )
{
SvxUnderlineItem *pUnderline
= (SvxUnderlineItem *)(pAktItemSet->Get( RES_CHRATR_UNDERLINE, sal_False ) .Clone());
if(pUnderline){
pUnderline->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) ) );
pAktItemSet->Put( *pUnderline );
delete pUnderline;
}
}
}
else
{
SvxUnderlineItem* pUnderlineAttr = (SvxUnderlineItem*)pCtrlStck->GetOpenStackAttr( *pPaM->GetPoint(), RES_CHRATR_UNDERLINE );
if( pUnderlineAttr != NULL )
pUnderlineAttr->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32( pData ))));
}
}
}
bool SwWW8ImplReader::GetFontParams( sal_uInt16 nFCode, FontFamily& reFamily,
String& rName, FontPitch& rePitch, CharSet& reCharSet )
{
......@@ -6037,6 +6084,7 @@ const wwSprmDispatcher *GetWW8SprmDispatcher()
{0x6815, 0}, //undocumented
{0x6816, 0}, //undocumented
{0x6870, &SwWW8ImplReader::Read_TxtForeColor},
{0x6877, &SwWW8ImplReader::Read_UnderlineColor},
{0xC64D, &SwWW8ImplReader::Read_ParaBackColor},
{0x6467, 0}, //undocumented
{0xF617, 0}, //undocumented
......
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