diff options
author | Jian Hong Cheng <chengjh@apache.org> | 2012-07-09 07:32:12 +0000 |
---|---|---|
committer | Xisco Fauli <anistenis@gmail.com> | 2013-04-14 17:52:35 +0200 |
commit | 0efd28738af121097dcc186dab85dd65c88a0b7b (patch) | |
tree | b4e225b84bdde5268722c82f4f9bf763d2ceab11 | |
parent | ce0f4825730a0f96ca5369a7d07982ea073901fb (diff) |
Fix issue #i120140: After doc file saved by AOO, one more section is created
* sw/source/filter/ww8/wrtww8.cxx
* sw/source/filter/ww8/ww8atr.cxx
MS Word Binary Interoperability
Patch by: Lin Yuan,<yuanlin.ibm@gmail.com>
Found by: Yan Ji,<yanji.yj@gmail.com>
Review by: Jian Hong Cheng,<chengjh@apache.org>
Conflicts:
sw/source/filter/ww8/wrtww8.cxx
Change-Id: If32bcced32b671f026ec8c32dd21684eb9e7b1fe
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 42 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 3 |
2 files changed, 32 insertions, 13 deletions
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index e997d6194f5e..a62370fdb3af 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2539,20 +2539,39 @@ void MSWordExportBase::WriteText() ; else if ( !IsInTable() ) //No sections in table { - ReplaceCr( (char)0xc ); // indicator for Page/Section-Break + //#120140# Do not need to insert a page/section break after a section end. Check this case first + sal_Bool bNeedExportBreakHere = sal_True; + if ( aIdx.GetNode().IsTxtNode() ) + { + SwTxtNode *pTempNext = aIdx.GetNode().GetTxtNode(); + if ( pTempNext ) + { + const SfxPoolItem * pTempItem = NULL; + if (pTempNext->GetpSwAttrSet() && SFX_ITEM_SET == pTempNext->GetpSwAttrSet()->GetItemState(RES_PAGEDESC, false, &pTempItem) + && pTempItem && ((SwFmtPageDesc*)pTempItem)->GetRegisteredIn()) + { + //Next node has a new page style which means this node is a section end. Do not insert another page/section break here + bNeedExportBreakHere = sal_False; + } + } + } + if (bNeedExportBreakHere) //#120140# End of check + { + ReplaceCr( (char)0xc ); // indicator for Page/Section-Break - const SwSectionFmt* pParentFmt = rSect.GetFmt()->GetParent(); - if ( !pParentFmt ) - pParentFmt = (SwSectionFmt*)0xFFFFFFFF; + const SwSectionFmt* pParentFmt = rSect.GetFmt()->GetParent(); + if ( !pParentFmt ) + pParentFmt = (SwSectionFmt*)0xFFFFFFFF; - sal_uLong nRstLnNum; - if ( aIdx.GetNode().IsCntntNode() ) - nRstLnNum = ((SwCntntNode&)aIdx.GetNode()).GetSwAttrSet(). - GetLineNumber().GetStartValue(); - else - nRstLnNum = 0; + sal_uLong nRstLnNum; + if ( aIdx.GetNode().IsCntntNode() ) + nRstLnNum = ((SwCntntNode&)aIdx.GetNode()).GetSwAttrSet(). + GetLineNumber().GetStartValue(); + else + nRstLnNum = 0; - AppendSection( pAktPageDesc, pParentFmt, nRstLnNum ); + AppendSection( pAktPageDesc, pParentFmt, nRstLnNum ); + } } } else if ( pNd->IsStartNode() ) @@ -2723,7 +2742,6 @@ void WW8Export::WriteFkpPlcUsw() the existence of an ObjectPool dir is necessary for triggering some magic. cmc */ - /* Similiarly having msvbasic storage seems to also trigger creating this stream */ GetWriter().GetStorage().OpenSotStorage(OUString(SL::aObjectPool), STREAM_READWRITE | STREAM_SHARE_DENYALL); } diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 2f93fafafa57..92116b2c655e 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -3485,7 +3485,8 @@ sal_uLong WW8Export::ReplaceCr( sal_uInt8 nChar ) nUCode = 0x0; } //And the para is not of len 0, then replace this cr with the mark - if( nChar == 0x0e || nUCode == 0x0d ) + //#120140# If there is a cr before a column break, need replace the cr. So remove the "nChar==0x0e" check. + if( nUCode == 0x0d ) bReplaced = false; else { |