summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2013-02-13 02:49:57 +0100
committerBjörn Michaelsen <bjoern.michaelsen@canonical.com>2013-02-15 10:05:31 +0000
commitee1db992b98378b5e2f5e9aa8af0e36c375e582f (patch)
tree28db88f0fa412e13db35319628b211b6b2ae976b
parent0ea32acfa5f7d3ab78d4c01ef2cd03ff04503ef8 (diff)
fdo#43105: apply old sw-nested-positionned-tables-ww8-import-fix.diff
- replaced the really ugly goto hack though Change-Id: I14dfbe414dc16b634fbaca0a365e2e9ec37ab08e Reviewed-on: https://gerrit.libreoffice.org/2133 Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com> Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
-rw-r--r--sw/source/filter/ww8/ww8par.cxx172
1 files changed, 88 insertions, 84 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 26596247e1f1..b2468163acbe 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2235,113 +2235,117 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp)
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;
+ WW8_TablePos *pTabPos=0;
+ WW8_TablePos aTabPos;
+ if(nCellLevel && !bVer67)
+ {
+ 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;
+ if (const sal_uInt8 *pLevel = pPlcxMan->HasParaSprm(0x6649))
+ nCellLevel = *pLevel;
- bool bHasRowEnd = SearchRowEnd(pPap, nMyStartCp, nCellLevel-1);
+ 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);
+ //Bad Table, remain unchanged in level, e.g. #i19667#
+ if (!bHasRowEnd)
+ nCellLevel = static_cast< sal_uInt8 >(nInTable);
- if (bHasRowEnd && ParseTabPos(&aTabPos,pPap))
- pTabPos = &aTabPos;
+ if (bHasRowEnd && ParseTabPos(&aTabPos,pPap))
+ pTabPos = &aTabPos;
- pPlcxMan->GetPap()->Restore( aSave );
- }
+ pPlcxMan->GetPap()->Restore( aSave );
+ }
-// then look if we are in an Apo
+ // then look if we are in an Apo
- ApoTestResults aApo = TestApo(nCellLevel, bTableRowEnd, pTabPos);
+ 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;
+ //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;
+ bool bStopTab = bWasTabRowEnd && (nInTable > nCellLevel) && !bFtnEdn;
- bWasTabRowEnd = false; // must be deactivated right here to prevent next
- // WW8TabDesc::TableCellEnd() from making nonsense
+ 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
+ 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
+ // 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
+ 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
- {
- NextAnlLine( pSprm13 ); // naechste Anl-Zeile
+ { // Anl normal zuende
+ StopAllAnl(); // Wirkliches Ende
}
}
- else
- { // Anl normal zuende
- StopAllAnl(); // Wirkliches Ende
+ if (bStopTab)
+ {
+ StopTable();
+ maApos.pop_back();
+ --nInTable;
+ }
+ if (aApo.mbStopApo)
+ {
+ StopApo();
+ maApos[nInTable] = false;
}
- }
- 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)
+ if (aApo.mbStartApo)
{
- if (StartTable(nStartCp))
- ++nInTable;
- else
- break;
+ 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 );
- maApos.push_back(false);
+ 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 );
+ }
}
- // 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;
}