Kaydet (Commit) e4b509ed authored tarafından Jian Hong Cheng's avatar Jian Hong Cheng

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>
üst 73e01c69
......@@ -2537,20 +2537,39 @@ void MSWordExportBase::WriteText()
;
else if ( !IsInTable() ) //No sections in table
{
ReplaceCr( (char)0xc ); // Indikator fuer 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 ); // Indikator fuer 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() )
......@@ -2731,8 +2750,7 @@ void WW8Export::WriteFkpPlcUsw()
#10570# Similiarly having msvbasic storage seems to also trigger
creating this stream
*/
// memory leak #i120098#, the unnamed obj will be released in destructor.
xEscherStg = GetWriter().GetStorage().OpenSotStorage(CREATE_CONST_ASC(SL::aObjectPool),
GetWriter().GetStorage().OpenSotStorage(CREATE_CONST_ASC(SL::aObjectPool),
STREAM_READWRITE | STREAM_SHARE_DENYALL);
}
......
......@@ -3574,7 +3574,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
{
......
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