Author: leidb Date: Thu Aug 16 02:16:22 2012 New Revision: 1373697 URL: http://svn.apache.org/viewvc?rev=1373697&view=rev Log: #35763# 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 Modified: incubator/ooo/trunk/main/sw/source/filter/inc/fltshell.hxx incubator/ooo/trunk/main/sw/source/filter/ww1/fltshell.cxx incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.hxx incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par6.cxx Modified: incubator/ooo/trunk/main/sw/source/filter/inc/fltshell.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/inc/fltshell.hxx?rev=1373697&r1=1373696&r2=1373697&view=diff ============================================================================== --- incubator/ooo/trunk/main/sw/source/filter/inc/fltshell.hxx (original) +++ incubator/ooo/trunk/main/sw/source/filter/inc/fltshell.hxx Thu Aug 16 02:16:22 2012 @@ -126,6 +126,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); Modified: incubator/ooo/trunk/main/sw/source/filter/ww1/fltshell.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww1/fltshell.cxx?rev=1373697&r1=1373696&r2=1373697&view=diff ============================================================================== --- incubator/ooo/trunk/main/sw/source/filter/ww1/fltshell.cxx (original) +++ incubator/ooo/trunk/main/sw/source/filter/ww1/fltshell.cxx Thu Aug 16 02:16:22 2012 @@ -621,6 +621,27 @@ SfxPoolItem* SwFltControlStack::GetFmtSt return 0; } +const SfxPoolItem* SwFltControlStack::GetOpenStackAttr(const SwPosition& rPos, sal_uInt16 nWhich) +{ + SwFltStackEntry* pEntry; + sal_uInt16 nSize = static_cast< sal_uInt16 >(Count()); + SwNodeIndex aAktNode( rPos.nNode, -1 ); + sal_uInt16 nAktIdx = rPos.nContent.GetIndex(); + + while (nSize) + { + pEntry = (*this)[ --nSize ]; + if( pEntry->bLocked + && (pEntry->pAttr->Which() == nWhich) + && (pEntry->nMkNode == aAktNode) + && (pEntry->nMkCntnt == nAktIdx )) + { + return (SfxPoolItem*)pEntry->pAttr; + } + } + return 0; +} + const SfxPoolItem* SwFltControlStack::GetFmtAttr(const SwPosition& rPos, sal_uInt16 nWhich) { SfxPoolItem* pHt = GetFmtStackAttr(nWhich); Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx?rev=1373697&r1=1373696&r2=1373697&view=diff ============================================================================== --- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx (original) +++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx Thu Aug 16 02:16:22 2012 @@ -1310,6 +1310,16 @@ void WW8AttributeOutput::CharUnderline( } m_rWW8Export.pO->Insert( b, m_rWW8Export.pO->Count() ); + 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 ) Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.hxx?rev=1373697&r1=1373696&r2=1373697&view=diff ============================================================================== --- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.hxx (original) +++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.hxx Thu Aug 16 02:16:22 2012 @@ -1528,6 +1528,7 @@ public: // eigentlich private, geht 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); Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par6.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par6.cxx?rev=1373697&r1=1373696&r2=1373697&view=diff ============================================================================== --- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par6.cxx (original) +++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par6.cxx Thu Aug 16 02:16:22 2012 @@ -3449,6 +3449,53 @@ void SwWW8ImplReader::Read_TxtForeColor( } } +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( wwUtility::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( wwUtility::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( wwUtility::BGRToRGB(SVBT32ToUInt32( pData )))); + } + } +} bool SwWW8ImplReader::GetFontParams( sal_uInt16 nFCode, FontFamily& reFamily, String& rName, FontPitch& rePitch, CharSet& reCharSet ) { @@ -6130,6 +6177,7 @@ const wwSprmDispatcher *GetWW8SprmDispat {0x6815, 0}, //undocumented {0x6816, 0}, //undocumented {0x6870, &SwWW8ImplReader::Read_TxtForeColor}, + {0x6877, &SwWW8ImplReader::Read_UnderlineColor}, {0xC64D, &SwWW8ImplReader::Read_ParaBackColor}, {0x6467, 0}, //undocumented {0xF617, 0}, //undocumented
