You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by zj...@apache.org on 2012/10/09 05:26:08 UTC

svn commit: r1395853 - in /incubator/ooo/trunk/main/sw/source/filter/ww8: ww8par.cxx ww8par.hxx ww8par2.cxx

Author: zjchen
Date: Tue Oct  9 03:26:08 2012
New Revision: 1395853

URL: http://svn.apache.org/viewvc?rev=1395853&view=rev
Log:
#i119587#  For doc file loaded by AOO, correct table position when table across pages with the Around wrap attribute.
Reported by: Yan Ji
Patch by: Lei De Bin
Review by: Chen Zuo Jun

Modified:
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.hxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par2.cxx

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx?rev=1395853&r1=1395852&r2=1395853&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx Tue Oct  9 03:26:08 2012
@@ -2099,12 +2099,15 @@ bool SwWW8ImplReader::ProcessSpecial(boo
 
     WW8_TablePos *pTabPos=0;
     WW8_TablePos aTabPos;
+    WW8PLCFx_Cp_FKP* pPap = 0;
+    bool bTableHasPositionInfo = false;
+    
     if (nCellLevel && !bVer67)
     {
         WW8PLCFxSave1 aSave;
         pPlcxMan->GetPap()->Save( aSave );
         rbReSync = true;
-        WW8PLCFx_Cp_FKP* pPap = pPlcxMan->GetPapPLCF();
+        pPap = pPlcxMan->GetPapPLCF();
         WW8_CP nMyStartCp=nStartCp;
 
         if (const sal_uInt8 *pLevel = pPlcxMan->HasParaSprm(0x6649))
@@ -2116,15 +2119,29 @@ bool SwWW8ImplReader::ProcessSpecial(boo
         if (!bHasRowEnd)
             nCellLevel = static_cast< sal_uInt8 >(nInTable);
 
-        if (bHasRowEnd && ParseTabPos(&aTabPos,pPap))
-            pTabPos = &aTabPos;
+        sal_uLong idstart = rDoc.GetNodes().GetEndOfContent().StartOfSectionIndex(); // get the node index
+        sal_uLong idcur = 0;
+        if ( pPaM && pPaM->GetPoint() )
+            idcur = pPaM->GetPoint()->nNode.GetIndex();
+    
+        // Memory first table postion info
+        if ( !pFirstTablePap && idstart + 1 == idcur )
+            pFirstTablePap = pPap;
+
+        if ( bHasRowEnd  && ParseTabPos(&aTabPos,pPap) )
+        {
+            // If table front don't have some content and it is doc first table, ignore table text wrapping property
+            bTableHasPositionInfo = true;
+            if ( pFirstTablePap != pPap )
+                pTabPos = &aTabPos;
+        }
 
         pPlcxMan->GetPap()->Restore( aSave );
     }
 
 //  then look if we are in an Apo
 
-    ApoTestResults aApo = TestApo(nCellLevel, bTableRowEnd, pTabPos);
+    ApoTestResults aApo = TestApo(nCellLevel, bTableRowEnd, pTabPos, !(pFirstTablePap == pPap && bTableHasPositionInfo));
 
     //look to see if we are in a Table, but Table in foot/end note not allowed
     bool bStartTab = (nInTable < nCellLevel) && !bFtnEdn;

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.hxx?rev=1395853&r1=1395852&r2=1395853&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.hxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.hxx Tue Oct  9 03:26:08 2012
@@ -1103,6 +1103,8 @@ private:
     bool bBidi;
     bool bReadTable;
     boost::shared_ptr<SwPaM> mpTableEndPaM;
+    WW8PLCFx_Cp_FKP* pFirstTablePap;
+
     // Indicate that currently on loading a TOC, managed by Read_F_TOX() and End_Field()
     bool mbLoadingTOCCache;
     // Indicate that current on loading a hyperlink, which is inside a TOC; Managed by Read_F_Hyperlink() and End_Field()
@@ -1239,8 +1241,8 @@ private:
     bool StartApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
     void StopApo();
     bool TestSameApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
-    ApoTestResults TestApo(int nCellLevel, bool bTableRowEnd,
-        const WW8_TablePos *pTabPos);
+    ApoTestResults TestApo(int nCellLevel, bool bTableRowEnd, const WW8_TablePos *pTabPos,
+        bool bReadTablePos = true);
 
     void EndSpecial();
     bool ProcessSpecial(bool &rbReSync, WW8_CP nStartCp);

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par2.cxx?rev=1395853&r1=1395852&r2=1395853&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par2.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par2.cxx Tue Oct  9 03:26:08 2012
@@ -528,7 +528,7 @@ bool SwWW8ImplReader::SearchRowEnd(WW8PL
 }
 
 ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd,
-    const WW8_TablePos *pTabPos)
+        const WW8_TablePos *pTabPos, bool bReadTablePos)
 {
     const WW8_TablePos *pTopLevelTable = nCellLevel <= 1 ? pTabPos : 0;
     ApoTestResults aRet;
@@ -556,9 +556,13 @@ ApoTestResults SwWW8ImplReader::TestApo(
     If we are already a table in a frame then we must grab the para properties
     to see if we are still in that frame.
     */
+    // If table front don't have some content and it is doc first table, ignore table text wrapping property
+    if ( bReadTablePos )
+    {
+        aRet.mpSprm37 = pPlcxMan->HasParaSprm( bVer67 ? 37 : 0x2423 );
+        aRet.mpSprm29 = pPlcxMan->HasParaSprm( bVer67 ? 29 : 0x261B );
+    }
 
-    aRet.mpSprm37 = pPlcxMan->HasParaSprm( bVer67 ? 37 : 0x2423 );
-    aRet.mpSprm29 = pPlcxMan->HasParaSprm( bVer67 ? 29 : 0x261B );
 
     // Is there some frame data here
     bool bNowApo = aRet.HasFrame() || pTopLevelTable;