[PATCH] fdo#43105: apply old sw-nested-positionned-tables-ww8-import...

Björn Michaelsen (via_Code_Review) gerrit at gerrit.libreoffice.org
Wed Feb 13 01:24:18 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2133

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/33/2133/1

fdo#43105: apply old sw-nested-positionned-tables-ww8-import-fix.diff

- replaced the really ugly goto hack though

Change-Id: I14dfbe414dc16b634fbaca0a365e2e9ec37ab08e
---
M sw/source/filter/ww8/ww8par.cxx
1 file changed, 107 insertions(+), 103 deletions(-)



diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index e71b6c0..fb93ac5 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2196,113 +2196,117 @@
         if (!nCellLevel)
             nCellLevel = 0 != pPlcxMan->HasParaSprm(0x244B);
     }
-
-    WW8_TablePos *pTabPos=0;
-    WW8_TablePos aTabPos;
-    if (nCellLevel && !bVer67)
+    do
     {
-        WW8PLCFxSave1 aSave;
-        pPlcxMan->GetPap()->Save( aSave );
-        rbReSync = true;
-        WW8PLCFx_Cp_FKP* pPap = pPlcxMan->GetPapPLCF();
-        WW8_CP nMyStartCp=nStartCp;
-
-        if (const sal_uInt8 *pLevel = pPlcxMan->HasParaSprm(0x6649))
-            nCellLevel = *pLevel;
-
-        bool bHasRowEnd = SearchRowEnd(pPap, nMyStartCp, nCellLevel-1);
-
-        //Bad Table, remain unchanged in level, e.g. #i19667#
-        if (!bHasRowEnd)
-            nCellLevel = static_cast< sal_uInt8 >(nInTable);
-
-        if (bHasRowEnd && ParseTabPos(&aTabPos,pPap))
-            pTabPos = &aTabPos;
-
-        pPlcxMan->GetPap()->Restore( aSave );
-    }
-
-//  then look if we are in an Apo
-
-    ApoTestResults aApo = TestApo(nCellLevel, bTableRowEnd, pTabPos);
-
-    //look to see if we are in a Table, but Table in foot/end note not allowed
-    bool bStartTab = (nInTable < nCellLevel) && !bFtnEdn;
-
-    bool bStopTab = bWasTabRowEnd && (nInTable > nCellLevel) && !bFtnEdn;
-
-    bWasTabRowEnd = false;  // must be deactivated right here to prevent next
-                            // WW8TabDesc::TableCellEnd() from making nonsense
-
-    if (nInTable && !bTableRowEnd && !bStopTab && (nInTable == nCellLevel && aApo.HasStartStop()))
-        bStopTab = bStartTab = true;    // Required to stop and start table
-
-//  Dann auf Anl (Nummerierung) testen
-//  und dann alle Ereignisse in der richtigen Reihenfolge bearbeiten
-
-    if( bAnl && !bTableRowEnd )
-    {
-        const sal_uInt8* pSprm13 = pPlcxMan->HasParaSprm( 13 );
-        if( pSprm13 )
-        {                                   // Noch Anl ?
-            sal_uInt8 nT = static_cast< sal_uInt8 >(GetNumType( *pSprm13 ));
-            if( ( nT != WW8_Pause && nT != nWwNumType ) // Anl-Wechsel
-                || aApo.HasStartStop()                  // erzwungenes Anl-Ende
-                || bStopTab || bStartTab )
-            {
-                StopAnlToRestart(nT);  // Anl-Restart ( = Wechsel ) ueber sprms
-            }
-            else
-            {
-                NextAnlLine( pSprm13 );                 // naechste Anl-Zeile
-            }
-        }
-        else
-        {                                           // Anl normal zuende
-            StopAllAnl();                                  // Wirkliches Ende
-        }
-    }
-    if (bStopTab)
-    {
-        StopTable();
-        maApos.pop_back();
-        --nInTable;
-    }
-    if (aApo.mbStopApo)
-    {
-        StopApo();
-        maApos[nInTable] = false;
-    }
-
-    if (aApo.mbStartApo)
-    {
-        maApos[nInTable] = StartApo(aApo, pTabPos);
-        // nach StartApo ist ein ReSync noetig ( eigentlich nur, falls die Apo
-        // ueber eine FKP-Grenze geht
-        rbReSync = true;
-    }
-    if (bStartTab)
-    {
-        WW8PLCFxSave1 aSave;
-        pPlcxMan->GetPap()->Save( aSave );
-
-        if (bAnl)                           // Nummerierung ueber Zellengrenzen
-            StopAllAnl();                   // fuehrt zu Absturz -> keine Anls
-                                            // in Tabellen
-        while (nInTable < nCellLevel)
+        WW8_TablePos *pTabPos=0;
+        WW8_TablePos aTabPos;
+        if(nCellLevel && !bVer67)
         {
-            if (StartTable(nStartCp))
-                ++nInTable;
-            else
-                break;
+            WW8PLCFxSave1 aSave;
+            pPlcxMan->GetPap()->Save( aSave );
+            rbReSync = true;
+            WW8PLCFx_Cp_FKP* pPap = pPlcxMan->GetPapPLCF();
+            WW8_CP nMyStartCp=nStartCp;
 
-            maApos.push_back(false);
+            if (const sal_uInt8 *pLevel = pPlcxMan->HasParaSprm(0x6649))
+                nCellLevel = *pLevel;
+
+            bool bHasRowEnd = SearchRowEnd(pPap, nMyStartCp, (nInTable<nCellLevel?nInTable:nCellLevel-1));
+
+            //Bad Table, remain unchanged in level, e.g. #i19667#
+            if (!bHasRowEnd)
+                nCellLevel = static_cast< sal_uInt8 >(nInTable);
+
+            if (bHasRowEnd && ParseTabPos(&aTabPos,pPap))
+                pTabPos = &aTabPos;
+
+            pPlcxMan->GetPap()->Restore( aSave );
         }
-        // nach StartTable ist ein ReSync noetig ( eigentlich nur, falls die
-        // Tabelle ueber eine FKP-Grenze geht
-        rbReSync = true;
-        pPlcxMan->GetPap()->Restore( aSave );
-    }
+
+    //  then look if we are in an Apo
+
+        ApoTestResults aApo = TestApo(nCellLevel, bTableRowEnd, pTabPos);
+
+        //look to see if we are in a Table, but Table in foot/end note not allowed
+        bool bStartTab = (nInTable < nCellLevel) && !bFtnEdn;
+
+        bool bStopTab = bWasTabRowEnd && (nInTable > nCellLevel) && !bFtnEdn;
+
+        bWasTabRowEnd = false;  // must be deactivated right here to prevent next
+                                // WW8TabDesc::TableCellEnd() from making nonsense
+
+        if (nInTable && !bTableRowEnd && !bStopTab && (nInTable == nCellLevel && aApo.HasStartStop()))
+            bStopTab = bStartTab = true;    // Required to stop and start table
+
+    //  Dann auf Anl (Nummerierung) testen
+    //  und dann alle Ereignisse in der richtigen Reihenfolge bearbeiten
+
+        if( bAnl && !bTableRowEnd )
+        {
+            const sal_uInt8* pSprm13 = pPlcxMan->HasParaSprm( 13 );
+            if( pSprm13 )
+            {                                   // Noch Anl ?
+                sal_uInt8 nT = static_cast< sal_uInt8 >(GetNumType( *pSprm13 ));
+                if( ( nT != WW8_Pause && nT != nWwNumType ) // Anl-Wechsel
+                    || aApo.HasStartStop()                  // erzwungenes Anl-Ende
+                    || bStopTab || bStartTab )
+                {
+                    StopAnlToRestart(nT);  // Anl-Restart ( = Wechsel ) ueber sprms
+                }
+                else
+                {
+                    NextAnlLine( pSprm13 );                 // naechste Anl-Zeile
+                }
+            }
+            else
+            {                                           // Anl normal zuende
+                StopAllAnl();                                  // Wirkliches Ende
+            }
+        }
+        if (bStopTab)
+        {
+            StopTable();
+            maApos.pop_back();
+            --nInTable;
+        }
+        if (aApo.mbStopApo)
+        {
+            StopApo();
+            maApos[nInTable] = false;
+        }
+
+        if (aApo.mbStartApo)
+        {
+            maApos[nInTable] = StartApo(aApo, pTabPos);
+            // nach StartApo ist ein ReSync noetig ( eigentlich nur, falls die Apo
+            // ueber eine FKP-Grenze geht
+            rbReSync = true;
+        }
+        if (bStartTab)
+        {
+            WW8PLCFxSave1 aSave;
+            pPlcxMan->GetPap()->Save( aSave );
+
+            if (bAnl)                           // Nummerierung ueber Zellengrenzen
+                StopAllAnl();                   // fuehrt zu Absturz -> keine Anls
+                                                // in Tabellen
+            if(nInTable < nCellLevel)
+            {
+                if (StartTable(nStartCp))
+                    ++nInTable;
+                else
+                    break;
+                maApos.push_back(false);
+            }
+            if(nInTable >= nCellLevel)
+            {
+                // nach StartTable ist ein ReSync noetig ( eigentlich nur, falls die
+                // Tabelle ueber eine FKP-Grenze geht
+                rbReSync = true;
+                pPlcxMan->GetPap()->Restore( aSave );
+            }
+        }
+    } while (nInTable < nCellLevel);
     return bTableRowEnd;
 }
 

-- 
To view, visit https://gerrit.libreoffice.org/2133
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14dfbe414dc16b634fbaca0a365e2e9ec37ab08e
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Björn Michaelsen <bjoern.michaelsen at canonical.com>


More information about the LibreOffice mailing list