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
...@@ -2536,6 +2536,24 @@ void MSWordExportBase::WriteText() ...@@ -2536,6 +2536,24 @@ void MSWordExportBase::WriteText()
else if ( aIdx.GetNode().IsSectionNode() ) else if ( aIdx.GetNode().IsSectionNode() )
; ;
else if ( !IsInTable() ) //No sections in table else if ( !IsInTable() ) //No sections in table
{
//#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 ReplaceCr( (char)0xc ); // Indikator fuer Page/Section-Break
...@@ -2553,6 +2571,7 @@ void MSWordExportBase::WriteText() ...@@ -2553,6 +2571,7 @@ void MSWordExportBase::WriteText()
AppendSection( pAktPageDesc, pParentFmt, nRstLnNum ); AppendSection( pAktPageDesc, pParentFmt, nRstLnNum );
} }
} }
}
else if ( pNd->IsStartNode() ) else if ( pNd->IsStartNode() )
{ {
OutputStartNode( *pNd->GetStartNode() ); OutputStartNode( *pNd->GetStartNode() );
...@@ -2731,8 +2750,7 @@ void WW8Export::WriteFkpPlcUsw() ...@@ -2731,8 +2750,7 @@ void WW8Export::WriteFkpPlcUsw()
#10570# Similiarly having msvbasic storage seems to also trigger #10570# Similiarly having msvbasic storage seems to also trigger
creating this stream creating this stream
*/ */
// memory leak #i120098#, the unnamed obj will be released in destructor. GetWriter().GetStorage().OpenSotStorage(CREATE_CONST_ASC(SL::aObjectPool),
xEscherStg = GetWriter().GetStorage().OpenSotStorage(CREATE_CONST_ASC(SL::aObjectPool),
STREAM_READWRITE | STREAM_SHARE_DENYALL); STREAM_READWRITE | STREAM_SHARE_DENYALL);
} }
......
...@@ -3574,7 +3574,8 @@ sal_uLong WW8Export::ReplaceCr( sal_uInt8 nChar ) ...@@ -3574,7 +3574,8 @@ sal_uLong WW8Export::ReplaceCr( sal_uInt8 nChar )
nUCode = 0x0; nUCode = 0x0;
} }
//And the para is not of len 0, then replace this cr with the mark //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; bReplaced = false;
else 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