incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chen...@apache.org
Subject svn commit: r1358968 - in /incubator/ooo/trunk/main/sw/source/filter/ww8: wrtww8.cxx ww8atr.cxx
Date Mon, 09 Jul 2012 08:32:13 GMT
Author: chengjh
Date: Mon Jul  9 08:32:12 2012
New Revision: 1358968

URL: http://svn.apache.org/viewvc?rev=1358968&view=rev
Log:
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>

Modified:
    incubator/ooo/trunk/main/sw/source/filter/ww8/wrtww8.cxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/wrtww8.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/wrtww8.cxx?rev=1358968&r1=1358967&r2=1358968&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/wrtww8.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/wrtww8.cxx Mon Jul  9 08:32:12 2012
@@ -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;
+
+					sal_uLong nRstLnNum;
+					if ( aIdx.GetNode().IsCntntNode() )
+						nRstLnNum = ((SwCntntNode&)aIdx.GetNode()).GetSwAttrSet().
+												GetLineNumber().GetStartValue();
+					else
+						nRstLnNum = 0;
 
-                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;
-
-                AppendSection( pAktPageDesc, pParentFmt, nRstLnNum );
+					AppendSection( pAktPageDesc, pParentFmt, nRstLnNum );
+				}
             }
         }
         else if ( pNd->IsStartNode() )
@@ -2731,10 +2750,9 @@ 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);
-		}
+        }
 
         // dggInfo - escher stream
         WriteEscher();

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx?rev=1358968&r1=1358967&r2=1358968&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8atr.cxx Mon Jul  9 08:32:12 2012
@@ -3574,7 +3574,8 @@ sal_uLong WW8Export::ReplaceCr( sal_uInt
                 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
             {



Mime
View raw message