[Libreoffice-commits] core.git: sw/source
Lei De Bin
leidb at apache.org
Mon Jul 29 03:58:39 PDT 2013
sw/source/filter/inc/fltshell.hxx | 1
sw/source/filter/ww1/fltshell.cxx | 17 +++++++++++++
sw/source/filter/ww8/ww8atr.cxx | 10 +++++++
sw/source/filter/ww8/ww8par.hxx | 1
sw/source/filter/ww8/ww8par6.cxx | 48 ++++++++++++++++++++++++++++++++++++++
5 files changed, 77 insertions(+)
New commits:
commit b41f03049cdc30f5fed32010f42f965711b1ded0
Author: Lei De Bin <leidb at apache.org>
Date: Thu Aug 16 01:16:22 2012 +0000
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 74f769f8c9ff5f4bba2ee08f4921ca54dd0c4c82)
Conflicts:
sw/source/filter/ww8/ww8atr.cxx
Change-Id: Ie9c01c3c7fcd74c059e97ff98a1c67b15c5fcd5c
diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx
index b5c3021..dea09ca 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -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);
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index c78c0a4..eb789ae 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -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);
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index f8c6eee..f908dcf 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -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 )
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 26e5683..ee4627a 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -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);
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 5f1a8f5..a01fb7d 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -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
More information about the Libreoffice-commits
mailing list