diff options
author | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2013-09-07 19:50:25 +0200 |
---|---|---|
committer | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2013-09-08 11:23:46 +0200 |
commit | aa2faee4b3954b57a613963b501ecf611b3a14ca (patch) | |
tree | 63615779cb7c1f421f49ad3ae744d9eeda6a831d /sw/source | |
parent | 05e1439107deacb8416c9aee1b6fb2c72a171eaf (diff) |
CharBrd 9.4: DOC filters
-WW8 filter is the only MS filter which ignores padding
of character border.
Change-Id: I17973d8d2ae624d68356729334c701864fe0a10d
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8attributeoutput.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 60 |
5 files changed, 63 insertions, 17 deletions
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index b082755a57c7..7bef91db78fd 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -950,8 +950,6 @@ private: static void BuildAnlvBase( WW8_ANLV& rAnlv, sal_uInt8*& rpCh, sal_uInt16& rCharLen, const SwNumRule& rRul, const SwNumFmt& rFmt, sal_uInt8 nSwLevel ); - void Out_BorderLine(ww::bytes& rO, const ::editeng::SvxBorderLine* pLine, - sal_uInt16 nDist, sal_uInt16 nSprmNo, bool bShadow); /// Output the numbering table. virtual void WriteNumbering(); @@ -1050,6 +1048,9 @@ public: const SwFmtPageDesc* pNewPgDescFmt = 0, const SwPageDesc* pNewPgDesc = 0 ); + void Out_BorderLine(ww::bytes& rO, const ::editeng::SvxBorderLine* pLine, + sal_uInt16 nDist, sal_uInt16 nSprmNo, bool bShadow); + void Out_SwFmtBox(const SvxBoxItem& rBox, bool bShadow); void Out_SwFmtTableBox( ww::bytes& rO, const SvxBoxItem * rBox ); sal_uInt8 TransCol( const Color& rCol ); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index b504ccfb75ed..6cd123ca6bfe 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1204,6 +1204,11 @@ void WW8AttributeOutput::CharHidden( const SvxCharHiddenItem& rHidden ) OutputWW8Attribute( 7, rHidden.GetValue() ); } +void WW8AttributeOutput::CharBorder( const SvxBorderLine* pAllBorder, const sal_uInt16 /*nDist*/, const bool bShadow ) +{ + m_rWW8Export.Out_BorderLine( *m_rWW8Export.pO, pAllBorder, 0, NS_sprm::LN_CBrc, bShadow ); +} + void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline ) { if ( m_rWW8Export.bWrtWW8 ) @@ -5347,9 +5352,10 @@ void AttributeOutputBase::FormatCharBorder( const SvxBoxItem& rBox ) if( pBorderLine ) { const SfxPoolItem* pItem = GetExport().HasItem( RES_CHRATR_SHADOW ); + const SvxShadowItem* pShadowItem = static_cast<const SvxShadowItem*>(pItem); const bool bShadow = - pItem && - static_cast<const SvxShadowItem*>(pItem)->GetLocation() != SVX_SHADOW_NONE; + pShadowItem && pShadowItem->GetLocation() != SVX_SHADOW_NONE && + pShadowItem->GetWidth() > 0; CharBorder( pBorderLine, nDist, bShadow ); } diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index d5483efbbee4..c1e0c2779895 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -294,7 +294,7 @@ protected: virtual void CharHidden( const SvxCharHiddenItem& ); /// Sfx item RES_CHRATR_BOX - virtual void CharBorder( const SvxBorderLine* /*pAllBorder*/, const sal_uInt16 /*nDist*/, const bool /*bShadow*/ ){}; + virtual void CharBorder( const SvxBorderLine* pAllBorder, const sal_uInt16 nDist, const bool bShadow ); /// Sfx item RES_TXTATR_INETFMT virtual void TextINetFormat( const SwFmtINetFmt& ); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 5c74252d50f5..56bfa43cf1d0 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1369,7 +1369,7 @@ private: void GetBorderDistance(const WW8_BRC* pbrc, Rectangle& rInnerDist) const; sal_uInt16 GetParagraphAutoSpace(bool fDontUseHTMLAutoSpacing); bool SetShadow(SvxShadowItem& rShadow, const short *pSizeArray, - const WW8_BRC *pbrc) const; + const WW8_BRC& aRightBrc) const; //returns true is a shadow was set bool SetFlyBordersShadow(SfxItemSet& rFlySet, const WW8_BRC *pbrc, short *SizeArray=0) const; @@ -1673,6 +1673,7 @@ public: // eigentlich private, geht aber leider nur public void Read_BoolItem( sal_uInt16 nId, const sal_uInt8*, short nLen ); void Read_Border( sal_uInt16 nId, const sal_uInt8* pData, short nLen ); + void Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, short nLen ); void Read_Tab( sal_uInt16 nId, const sal_uInt8* pData, short nLen ); void Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen); void Read_FldVanish( sal_uInt16 nId, const sal_uInt8* pData, short nLen ); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index e8766e0cb720..28ca3db10130 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -1290,14 +1290,14 @@ void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace, sal_uInt } void Set1Border(bool bVer67, SvxBoxItem &rBox, const WW8_BRC& rBor, - sal_uInt16 nOOIndex, sal_uInt16 nWWIndex, short *pSize=0) + sal_uInt16 nOOIndex, sal_uInt16 nWWIndex, short *pSize, const bool bIgnoreSpace) { sal_uInt8 nCol; short nSpace, nIdx; short nLineThickness = rBor.DetermineBorderProperties(bVer67,&nSpace,&nCol, &nIdx); - GetLineIndex(rBox, nLineThickness, nSpace, nCol, nIdx, nOOIndex, nWWIndex, pSize ); + GetLineIndex(rBox, nLineThickness, bIgnoreSpace ? 0 : nSpace, nCol, nIdx, nOOIndex, nWWIndex, pSize ); } @@ -1365,7 +1365,7 @@ bool SwWW8ImplReader::SetBorder(SvxBoxItem& rBox, const WW8_BRC* pbrc, const WW8_BRC& rB = pbrc[ aIdArr[ i ] ]; if( !rB.IsEmpty(bVer67)) { - Set1Border(bVer67, rBox, rB, aIdArr[i+1], aIdArr[i], pSizeArray); + Set1Border(bVer67, rBox, rB, aIdArr[i+1], aIdArr[i], pSizeArray, false); bChange = true; } else if ( nSetBorders & (1 << aIdArr[i]) ) @@ -1389,18 +1389,18 @@ bool SwWW8ImplReader::SetBorder(SvxBoxItem& rBox, const WW8_BRC* pbrc, bool SwWW8ImplReader::SetShadow(SvxShadowItem& rShadow, const short *pSizeArray, - const WW8_BRC *pbrc) const + const WW8_BRC& aRightBrc) const { bool bRet = ( - ( bVer67 ? (pbrc[WW8_RIGHT].aBits1[ 0 ] & 0x20 ) - : (pbrc[WW8_RIGHT].aBits2[ 1 ] & 0x20 ) ) + ( bVer67 ? (aRightBrc.aBits1[ 0 ] & 0x20 ) + : (aRightBrc.aBits2[ 1 ] & 0x20 ) ) && (pSizeArray && pSizeArray[WW8_RIGHT]) ); if (bRet) { rShadow.SetColor(Color(COL_BLACK)); //i120718 - short nVal = pbrc[WW8_RIGHT].DetermineBorderProperties(bVer67); + short nVal = aRightBrc.DetermineBorderProperties(bVer67); //End if (nVal < 0x10) nVal = 0x10; @@ -1445,7 +1445,7 @@ bool SwWW8ImplReader::SetFlyBordersShadow(SfxItemSet& rFlySet, // fShadow SvxShadowItem aShadow( RES_SHADOW ); - if( SetShadow( aShadow, pSizeArray, pbrc )) + if( SetShadow( aShadow, pSizeArray, pbrc[WW8_RIGHT] )) { bShadowed = true; rFlySet.Put( aShadow ); @@ -4648,7 +4648,7 @@ sal_uInt32 SwWW8ImplReader::ExtractColour(const sal_uInt8* &rpData, bool bVer67) return aShade.aColor.GetColor(); } -void SwWW8ImplReader::Read_Border(sal_uInt16 , const sal_uInt8* , short nLen) +void SwWW8ImplReader::Read_Border(sal_uInt16 , const sal_uInt8*, short nLen) { if( nLen < 0 ) { @@ -4715,13 +4715,51 @@ void SwWW8ImplReader::Read_Border(sal_uInt16 , const sal_uInt8* , short nLen) NewAttr( aBox ); SvxShadowItem aS(RES_SHADOW); - if( SetShadow( aS, &aSizeArray[0], aBrcs ) ) + if( SetShadow( aS, &aSizeArray[0], aBrcs[WW8_RIGHT] ) ) NewAttr( aS ); } } } } +void SwWW8ImplReader::Read_CharBorder(sal_uInt16 /*nId*/, const sal_uInt8* pData, short nLen ) +{ + //Ignore this old border type + if (!bVer67 && pPlcxMan && pPlcxMan->GetChpPLCF()->HasSprm(0xCA72)) + return; + + if( nLen < 0 ) + { + pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_BOX ); + pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_SHADOW ); + } + else + { + const SvxBoxItem* pBox + = (const SvxBoxItem*)GetFmtAttr( RES_CHRATR_BOX ); + if( pBox ) + { + SvxBoxItem aBoxItem(RES_CHRATR_BOX); + aBoxItem = *pBox; + WW8_BRC aBrc; + _SetWW8_BRC(bVer67, aBrc, pData); + + Set1Border(bVer67, aBoxItem, aBrc, BOX_LINE_TOP, 0, 0, true); + Set1Border(bVer67, aBoxItem, aBrc, BOX_LINE_BOTTOM, 0, 0, true); + Set1Border(bVer67, aBoxItem, aBrc, BOX_LINE_LEFT, 0, 0, true); + Set1Border(bVer67, aBoxItem, aBrc, BOX_LINE_RIGHT, 0, 0, true); + NewAttr( aBoxItem ); + + short aSizeArray[WW8_RIGHT+1]={0}; aSizeArray[WW8_RIGHT] = 1; + SvxShadowItem aShadowItem(RES_CHRATR_SHADOW); + if( SetShadow( aShadowItem, &aSizeArray[0], aBrc ) ) + NewAttr( aShadowItem ); + } + } + + +} + void SwWW8ImplReader::Read_Hyphenation( sal_uInt16, const sal_uInt8* pData, short nLen ) { // set Hyphenation flag @@ -5802,7 +5840,7 @@ const wwSprmDispatcher *GetWW8SprmDispatcher() //sttbRMark;short; {0x6864, 0}, //"sprmCDttmRMarkDel" //chp.dttmRMarkDel;DTTM;long; - {0x6865, 0}, //"sprmCBrc" chp.brc;BRC;long; + {0x6865, &SwWW8ImplReader::Read_CharBorder}, //"sprmCBrc" chp.brc;BRC;long; {0x4866, &SwWW8ImplReader::Read_CharShadow}, //"sprmCShd" chp.shd;SHD;short; {0x4867, 0}, //"sprmCIdslRMarkDel" //chp.idslRMReasonDel;an index |