diff options
| author | Caolán McNamara <cmc@openoffice.org> | 2002-04-04 13:11:10 +0000 |
|---|---|---|
| committer | Caolán McNamara <cmc@openoffice.org> | 2002-04-04 13:11:10 +0000 |
| commit | b88924a09b3932535afb177e8944fb354aacfa81 (patch) | |
| tree | 79ec6d3277bc46231d2858354d1540eb3ea0663b | |
| parent | 902fbda960e504efbd39973478261b4efc245850 (diff) | |
#98316# export looses two column setting
| -rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 17 | ||||
| -rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 23 | ||||
| -rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 21 | ||||
| -rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 6 | ||||
| -rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 7 | ||||
| -rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 83 | ||||
| -rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 83 | ||||
| -rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 12 | ||||
| -rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 5 | ||||
| -rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 86 |
10 files changed, 227 insertions, 116 deletions
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 46ba2c75adcc..5d10437b329a 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2,9 +2,9 @@ * * $RCSfile: wrtw8esh.cxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.32 $ * - * last change: $Author: cmc $ $Date: 2002-03-05 11:59:06 $ + * last change: $Author: cmc $ $Date: 2002-04-04 14:11:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -403,12 +403,15 @@ BOOL WW8_WrPlcDrawObj::Append( SwWW8Writer& rWrt, WW8_CP nCp, void WW8_WrPlcDrawObj::SetShapeDetails( const SwFrmFmt& rFmt, UINT32 nId, INT32 nThick ) { - const VoidPtr p = (void*)&rFmt; - USHORT nPos = aCntnt.GetPos( p ); - if( USHRT_MAX != nPos ) + const VoidPtr p = (const VoidPtr)&rFmt; + USHORT nTotal = aCntnt.Count(); + for (USHORT nI=0;nI<nTotal;++nI) { - aShapeIds[ nPos ] = nId; - aThick[ nPos ] = nThick; + if (aCntnt[nI] == p) + { + aShapeIds[nI] = nId; + aThick[nI] = nThick; + } } } diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 3c2e29c0b652..1cde4cae8f6d 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2,9 +2,9 @@ * * $RCSfile: wrtw8nds.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: cmc $ $Date: 2002-03-05 11:59:06 $ + * last change: $Author: cmc $ $Date: 2002-04-04 14:11:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1694,6 +1694,18 @@ Writer& OutWW8_SwTblNode( Writer& rWrt, SwTableNode & rNode ) return rWrt; } +BOOL SwWW8Writer::NoPageBreakSection(const SfxItemSet* pSet) +{ + BOOL bRet=FALSE; + const SfxPoolItem* pI; + if( pSet && ( + ( SFX_ITEM_ON != pSet->GetItemState( RES_PAGEDESC, TRUE, &pI ) + || 0 == ((SwFmtPageDesc*)pI)->GetPageDesc() ) && + ( SFX_ITEM_ON != pSet->GetItemState( RES_BREAK, TRUE, &pI ) + || SVX_BREAK_NONE == ((SvxFmtBreakItem*)pI)->GetBreak() ))) + bRet = TRUE; + return bRet; +} /* */ @@ -1722,12 +1734,7 @@ Writer& OutWW8_SwSectionNode( Writer& rWrt, SwSectionNode& rSectionNode ) else pSet = 0; - const SfxPoolItem* pI; - if( pSet && ( - ( SFX_ITEM_ON != pSet->GetItemState( RES_PAGEDESC, TRUE, &pI ) - || 0 == ((SwFmtPageDesc*)pI)->GetPageDesc() ) || - ( SFX_ITEM_ON != pSet->GetItemState( RES_BREAK, TRUE, &pI ) - || SVX_BREAK_NONE == ((SvxFmtBreakItem*)pI)->GetBreak() ))) + if( pSet && SwWW8Writer::NoPageBreakSection(pSet)) pSet = 0; if( !pSet ) diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 46a982cb8ffd..14e47061768a 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -2,9 +2,9 @@ * * $RCSfile: wrtw8sty.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: cmc $ $Date: 2002-03-05 11:59:06 $ + * last change: $Author: cmc $ $Date: 2002-04-04 14:11:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -929,10 +929,10 @@ void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, } void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwFmtPageDesc& rPD, - const SwNode& rNd, ULONG nLnNumRestartNo ) + const SwNode& rNd, const SwSectionFmt* pSectionFmt, ULONG nLnNumRestartNo ) { aCps.Insert( nStartCp, aCps.Count() ); - WW8_SepInfo aI( rPD.GetPageDesc(), 0, nLnNumRestartNo ); + WW8_SepInfo aI( rPD.GetPageDesc(), pSectionFmt, nLnNumRestartNo ); aI.nPgRestartNo = rPD.GetNumOffset(); aI.pPDNd = &rNd; aSects.Insert( aI, aSects.Count() ); @@ -1237,6 +1237,16 @@ BOOL WW8_WrPlcSepx::WriteKFTxt( SwWW8Writer& rWrt ) // gueltiger Pointer -> Section beginnt, // 0xfff -> Section wird beendet nBreakCode = 0; // fortlaufender Abschnitt + + if (rSepInfo.pPDNd && rSepInfo.pPDNd->IsCntntNode()) + { + if (!(SwWW8Writer::NoPageBreakSection( + &rSepInfo.pPDNd->GetCntntNode()->GetSwAttrSet()))) + { + nBreakCode = 2; + } + } + if( (SwSectionFmt*)0xFFFFFFFF != rSepInfo.pSectionFmt ) { // Itemset erzeugen, das das PgDesk-AttrSet beerbt: @@ -1246,7 +1256,8 @@ BOOL WW8_WrPlcSepx::WriteKFTxt( SwWW8Writer& rWrt ) SfxItemSet aSet( *pPdSet->GetPool(), pPdSet->GetRanges() ); aSet.SetParent( pPdSet ); - // am Nachkommen NUR die Spaltigkeit gemaess Sect-Attr. umsetzen + // am Nachkommen NUR die Spaltigkeit gemaess Sect-Attr. + // umsetzen aSet.Put( rSepInfo.pSectionFmt->GetAttr( RES_COL ) ); // und raus damit ins WW-File diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index f1f07bff58d3..d81192fdda0d 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2,9 +2,9 @@ * * $RCSfile: wrtww8.cxx,v $ * - * $Revision: 1.30 $ + * $Revision: 1.31 $ * - * last change: $Author: cmc $ $Date: 2002-03-19 11:04:55 $ + * last change: $Author: cmc $ $Date: 2002-04-04 14:11:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2203,7 +2203,7 @@ ULONG SwWW8Writer::StoreDoc() // Hole evtl. Pagedesc des 1. Nodes if( pSet && SFX_ITEM_ON == pSet->GetItemState(RES_PAGEDESC,TRUE,&pI) && ((SwFmtPageDesc*)pI)->GetPageDesc() ) - pSepx->AppendSep( 0, *(SwFmtPageDesc*)pI, *pNd, nRstLnNum ); + pSepx->AppendSep( 0, *(SwFmtPageDesc*)pI, *pNd, pFmt, nRstLnNum ); else pSepx->AppendSep( 0, pAktPageDesc, pFmt, nRstLnNum ); } diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 74f8a72b9a79..f6dbd4f65270 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -2,9 +2,9 @@ * * $RCSfile: wrtww8.hxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: cmc $ $Date: 2002-03-20 11:26:34 $ + * last change: $Author: cmc $ $Date: 2002-04-04 14:11:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -264,6 +264,7 @@ public: ULONG nLnNumRestartNo = 0 ); void AppendSep( WW8_CP nStartCp, const SwFmtPageDesc& rPd, const SwNode& rNd, + const SwSectionFmt* pSectionFmt, ULONG nLnNumRestartNo ); void Finish( WW8_CP nEndCp ) { aCps.Insert( nEndCp, aCps.Count() ); } void SetNum( const SwTxtNode* pNumNd ); @@ -556,6 +557,8 @@ public: // fuer WW8SaveData SwPaM* GetEndPaM() { return pOrigPam; } void SetEndPaM( SwPaM* pPam ) { pOrigPam = pPam; } + + static BOOL NoPageBreakSection(const SfxItemSet *pSet); }; class WW8_WrPlcSubDoc // Doppel-Plc fuer Foot-/Endnotes und Postits diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index a1d2394a4a06..417ef4704120 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ww8atr.cxx,v $ * - * $Revision: 1.33 $ + * $Revision: 1.34 $ * - * last change: $Author: cmc $ $Date: 2002-03-01 13:58:52 $ + * last change: $Author: cmc $ $Date: 2002-04-04 14:11:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -489,19 +489,25 @@ void SwWW8Writer::Out_SfxBreakItems( const SfxItemSet& rSet, const SwNode& rNd ) ((SwFmtPageDesc*)pItem)->GetRegisteredIn() ) { // Die PageDescs werden beim Auftreten von PageDesc-Attributen nur - // in WW8Writer::pSepx mit der entsprechenden Position eingetragen. - // Das Aufbauen und die Ausgabe der am PageDesc haengenden Attribute - // und Kopf/Fusszeilen passiert nach dem Haupttext und seinen Attributen. + // in WW8Writer::pSepx mit der entsprechenden Position + // eingetragen. Das Aufbauen und die Ausgabe der am PageDesc + // haengenden Attribute und Kopf/Fusszeilen passiert nach dem + // Haupttext und seinen Attributen. const SwFmtPageDesc& rPgDesc = *(SwFmtPageDesc*)pItem; pAktPageDesc = rPgDesc.GetPageDesc(); if( pAktPageDesc ) { ULONG nFcPos = ReplaceCr( 0x0c ); // Page/Section-Break + const SwSectionFmt *pFmt=0; + const SwSectionNode* pSect = rNd.FindSectionNode(); + if (pSect && CONTENT_SECTION == pSect->GetSection().GetType()) + pFmt = pSect->GetSection().GetFmt(); + // tatsaechlich wird hier NOCH NICHTS ausgegeben, sondern // nur die Merk-Arrays aCps, aSects entsprechend ergaenzt if( nFcPos ) - pSepx->AppendSep( Fc2Cp( nFcPos ), rPgDesc, rNd, + pSepx->AppendSep( Fc2Cp( nFcPos ), rPgDesc, rNd, pFmt, ((SwFmtLineNumber&)rSet.Get( RES_LINENUMBER )).GetStartValue()); } @@ -833,7 +839,7 @@ static Writer& OutWW8_SvxAutoKern( Writer& rWrt, const SfxPoolItem& rHt ) rWrtWW8.InsUInt16( 0x484B ); else rWrtWW8.pO->Insert( 107, rWrtWW8.pO->Count() ); - rWrtWW8.pO->Insert( rAttr.GetValue() ? 1 : 0, rWrtWW8.pO->Count() ); + rWrtWW8.InsUInt16( rAttr.GetValue() ? 1 : 0 ); return rWrt; } @@ -2691,23 +2697,62 @@ ULONG SwWW8Writer::ReplaceCr( BYTE nChar ) // Bug #49917# ASSERT( nChar, "gegen 0 ersetzt bringt WW97/95 zum Absturz" ); - ULONG nRetPos = 0, nPos = Strm().Tell(); - Strm().SeekRel( IsUnicode() ? -2 : -1 ); - BYTE nC1; - Strm().Read( &nC1, 1 ); - if( nC1 == 0x0d ) // CR ? + BOOL bReplaced = FALSE; + SvStream& rStrm = Strm(); + ULONG nRetPos = 0, nPos = rStrm.Tell(); + BYTE nBCode=0; + UINT16 nUCode=0; + //If there is at least two characters already output + if (nPos - (IsUnicode() ? 2 : 1) >= ULONG(pFib->fcMin)) { - Strm().SeekRel( -1 ); // CR hinter Zeile - Strm().Write( &nChar, 1 ); // durch nChar ersetzen - nRetPos = nPos; + rStrm.SeekRel(IsUnicode() ? -2 : -1); + if (IsUnicode()) + rStrm >> nUCode; + else + { + rStrm >> nUCode; + nUCode = nBCode; + } + //If the last char was a cr + if (nUCode == 0x0d) // CR ? + { + if ((nChar == 0x0c) && + (nPos - (IsUnicode() ? 4 : 2) >= ULONG(pFib->fcMin))) + { + rStrm.SeekRel( IsUnicode() ? -4 : -2 ); + if (IsUnicode()) + rStrm >> nUCode; + else + { + rStrm >> nUCode; + nUCode = nBCode; + } + } + else + { + rStrm.SeekRel( IsUnicode() ? -2 : -1 ); + nUCode = 0x0; + } + //And the para is not of len 0, then replace this cr with the mark + if (nUCode == 0x0d) + bReplaced=FALSE; + else + { + bReplaced=TRUE; + WriteChar(nChar); + nRetPos = nPos; + } + } + rStrm.Seek( nPos ); } - Strm().Seek( nPos ); + else + bReplaced = TRUE; - if( 0x7 == nC1 ) // at end of TableRow ? + if (!bReplaced) { // then write as normal char - WriteChar( nChar ); - nRetPos = Strm().Tell(); + WriteChar(nChar); + nRetPos = rStrm.Tell(); } #ifdef PRODUCT else diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 57a3b321e7de..8f150cb8dc85 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ww8par.cxx,v $ * - * $Revision: 1.50 $ + * $Revision: 1.51 $ * - * last change: $Author: cmc $ $Date: 2002-03-21 14:41:21 $ + * last change: $Author: cmc $ $Date: 2002-04-04 14:11:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -189,15 +189,15 @@ #ifndef _FMTCOL_HXX #include <fmtcol.hxx> // ReadFilterFlags #endif -#ifndef _FMTCLDS_HXX //autogen +#ifndef _FMTCLDS_HXX #include <fmtclds.hxx> #endif -#ifndef _SECTION_HXX -#include <section.hxx> -#endif #ifndef _FMTCLBL_HXX #include <fmtclbl.hxx> #endif +#ifndef _SECTION_HXX +#include <section.hxx> +#endif #ifndef _SWDOCSH_HXX //autogen #include <docsh.hxx> #endif @@ -871,6 +871,7 @@ WW8ReaderSave::WW8ReaderSave( SwWW8ImplReader* pRdr ,WW8_CP nStartCp) bInHyperlink = pRdr->bInHyperlink; bPgSecBreak = pRdr->bPgSecBreak; bVerticalEnviron = pRdr->bVerticalEnviron; + bWasParaEnd = pRdr->bWasParaEnd; nAktColl = pRdr->nAktColl; nNoAttrScan = pRdr->pSBase->GetNoAttrScan(); @@ -922,6 +923,7 @@ void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr ) pRdr->bAnl = bAnl; pRdr->bInHyperlink = bInHyperlink; pRdr->bVerticalEnviron = bVerticalEnviron; + pRdr->bWasParaEnd = bWasParaEnd; pRdr->bPgSecBreak = bPgSecBreak; pRdr->nAktColl = nAktColl; pRdr->pSBase->SetNoAttrScan( nNoAttrScan ); @@ -1054,7 +1056,7 @@ long SwWW8ImplReader::Read_Ftn( WW8PLCFManResult* pRes, BOOL ) // insert Section to get this Ft-/End-Note at the end of the section, // when there is no open section at the moment - if( bFtEdOk && pLastPgDeskIdx && !pBehindSection ) + if( bFtEdOk && pLastPgDeskIdx && !pNewSection) { const SwNodeIndex aOrgLastPgDeskIdx( *pLastPgDeskIdx ); @@ -1891,11 +1893,26 @@ BOOL SwWW8ImplReader::ReadChar( long nPosCp, long nCpOfs ) if (!nTable) { bPgSecBreak = TRUE; - // new behavior: insert additional node only WHEN the - // Pagebreak ( #74468# ) is in a NODE that is NOT EMPTY - if( 0 < pPaM->GetPoint()->nContent.GetIndex() ) + pCtrlStck->KillUnlockedAttrs(*pPaM->GetPoint()); + /* + #74468# + If its a 0x0c without a paragraph end before it, act like a + paragraph end, but nevertheless, numbering (and perhaps other + similiar constructs) do not exist on the para. + */ + if (!bWasParaEnd) + { bRet = TRUE; - pCtrlStck->KillUnlockedAttrs( *pPaM->GetPoint() ); + if (0 >= pPaM->GetPoint()->nContent.GetIndex()) + { + if (SwTxtNode* pTxtNode = pPaM->GetNode()->GetTxtNode()) + { + pTxtNode->SwCntntNode::SetAttr( + *GetDfltAttr(RES_PARATR_NUMRULE)); + pTxtNode->UpdateNum(SwNodeNum(NO_NUMBERING)); + } + } + } } break; case 0x1e: @@ -2171,6 +2188,7 @@ BOOL SwWW8ImplReader::ReadText( long nStartCp, long nTextLen, short nType ) BOOL bStartLine = TRUE; short nCrCount = 0; + bWasParaEnd = FALSE; nAktColl = 0; pAktItemSet = 0; nCharFmt = -1; @@ -2216,7 +2234,7 @@ BOOL SwWW8ImplReader::ReadText( long nStartCp, long nTextLen, short nType ) if( l>= nStartCp + nTextLen ) break; - bStartLine = ReadChars( l, nNext, nStartCp+nTextLen, nCpOfs ); + bStartLine = bWasParaEnd = ReadChars(l, nNext, nStartCp+nTextLen, nCpOfs); if( bStartLine ) // Zeilenende { @@ -2324,6 +2342,7 @@ SwWW8ImplReader::SwWW8ImplReader( BYTE nVersionPara, SvStorage* pStorage, bRestartLnNumPerSection = FALSE; bInHyperlink = FALSE; bVerticalEnviron = FALSE; + bWasParaEnd = FALSE; nProgress = 0; nHdTextHeight = nFtTextHeight = 0; nPgWidth = lA4Width; @@ -2333,7 +2352,6 @@ SwWW8ImplReader::SwWW8ImplReader( BYTE nVersionPara, SvStorage* pStorage, pTableDesc = 0; pNumRule = 0; pNumOlst = 0; - pBehindSection = 0; pNewSection = 0; pNode_FLY_AT_CNTNT = 0; pDrawFmt = 0; @@ -2379,6 +2397,15 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss) { ULONG nErrRet = 0; + if (bNew) + { + //Needed to unlock last node so that we can delete it without + //giving writer a fit. Necessary for deleting the para after + //a section. i.e. see section cleanup at the end of this method + rPaM.GetBound( TRUE ).nContent.Assign( 0, 0 ); + rPaM.GetBound( FALSE ).nContent.Assign( 0, 0 ); + } + if( bNew && pStg && !pGloss) ReadDocInfo(); @@ -2665,7 +2692,7 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss) } else //ordinary case { - ReadText( 0, pWwFib->ccpText, MAN_MAINTEXT ); + ReadText(0, pWwFib->ccpText, MAN_MAINTEXT); } ::SetProgressState( nProgress, rDoc.GetDocShell() ); // Update @@ -2877,7 +2904,7 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss) pDataStream = 0; pTableStream = 0; } - DELETEZ( pBehindSection ); + if (!pGloss) DELETEZ( pWwFib ); DeleteCtrlStk(); @@ -2885,10 +2912,6 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss) DeleteAnchorStk(); DeleteRefStk(); - // set NoBallanced flag on last inserted section - if( pNewSection ) - pNewSection->GetFmt()->SetAttr( SwFmtNoBalancedColumns( TRUE ) ); - aRelNumRule.SetNumRelSpaces( rDoc ); if( !bNew && !nErrRet && aSttNdIdx.GetIndex() ) { @@ -2899,11 +2922,30 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss) UpdateFields(); - DELETEZ( pPaM ); // delete the pam before the call for hide all redlines (Bug 73683) if( bNew ) rDoc.SetRedlineMode( eMode ); + // set NoBallanced flag on last inserted section and remove the trailing + // para that inserting the section pushed after the PaM + if (pNewSection) + { + SwSectionFmt *pFmt = pNewSection->GetFmt(); + pFmt->SetAttr(SwFmtNoBalancedColumns(TRUE)); + if (bNew) + { + //See the setup at the beginning of this method for the necessary + //node unlocking that makes deleting the final para a safe + //operation + pPaM->SetMark(); + SwNodeIndex aPref(*pFmt->GetSectionNode()->EndOfSectionNode(), 1); + pPaM->GetPoint()->nNode = aPref; + pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0); + + rDoc.DeleteAndJoin(*pPaM); + } + } + DELETEZ(pPaM); return nErrRet; } @@ -3035,6 +3077,7 @@ ULONG SwWW8ImplReader::LoadDoc( SwPaM& rPaM,WW8Glossary *pGloss) if( !nErrRet ) nErrRet = LoadDoc1( rPaM ,pGloss); + return nErrRet; // return Errorcode } diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index ad368bb09285..dad1a185cca6 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ww8par.hxx,v $ * - * $Revision: 1.55 $ + * $Revision: 1.56 $ * - * last change: $Author: cmc $ $Date: 2002-03-21 14:41:21 $ + * last change: $Author: cmc $ $Date: 2002-04-04 14:11:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -407,6 +407,7 @@ class WW8ReaderSave WW8FlyPara* pWFlyPara; WW8SwFlyPara* pSFlyPara; WW8TabDesc* pTableDesc; + int nTable; USHORT nAktColl; USHORT nNoAttrScan; sal_Unicode cSymbol; @@ -420,8 +421,8 @@ class WW8ReaderSave BOOL bAnl : 1; BOOL bInHyperlink : 1; BOOL bPgSecBreak : 1; - BOOL bVerticalEnviron :1; - int nTable; + BOOL bVerticalEnviron : 1; + BOOL bWasParaEnd : 1; public: WW8ReaderSave( SwWW8ImplReader* pRdr, WW8_CP nStart=-1 ); void Restore( SwWW8ImplReader* pRdr ); @@ -634,7 +635,6 @@ friend class WW8FormulaControl; SwNumRule* pNumRule; // fuer Nummerierung / Aufzaehlungen im Text WW8_OLST* pNumOlst; // Gliederung im Text - SwNodeIndex* pBehindSection;// Node-Index zum Zuruecksetzen des PaM nach einem Bereich SwSection* pNewSection; // last Section that was inserted into the doc SwNode* pNode_FLY_AT_CNTNT; // set: WW8SwFlyPara() read: CreateSwTable() @@ -773,6 +773,7 @@ friend class WW8FormulaControl; BOOL bInHyperlink; // Sonderfall zum einlesen eines 0x01 // siehe: SwWW8ImplReader::Read_F_Hyperlink() BOOL bVerticalEnviron; + BOOL bWasParaEnd; // praktische Hilfsvariablen: BOOL bVer67; // ( (6 == nVersion) || (7 == nVersion) ); @@ -820,6 +821,7 @@ friend class WW8FormulaControl; void SetUseOn(SwPageDesc* pPageDesc0, SwPageDesc* pPageDesc1, BYTE nHdFt); void InsertSectionWithWithoutCols( SwPaM& rMyPaM, const SwFmtCol* pCol ); void CreateSep( const long nTxtPos, BOOL bMustHaveBreak ); + BOOL MustCloseSection(long nTxtPos); void CopyPageDescHdFt( const SwPageDesc* pOrgPageDesc, SwPageDesc* pNewPageDesc, BYTE nCode ); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 413c5bbeb4ff..17198a6b276c 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ww8par5.cxx,v $ * - * $Revision: 1.40 $ + * $Revision: 1.41 $ * - * last change: $Author: cmc $ $Date: 2002-03-01 09:50:36 $ + * last change: $Author: cmc $ $Date: 2002-04-04 14:11:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2111,7 +2111,6 @@ eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* pF, String& rStr ) pNewSection = rDoc.Insert( *pPaM, aSection, 0 ,FALSE); const SwSectionNode* pSectionNode = pNewSection->GetFmt()->GetSectionNode(); - pBehindSection = new SwNodeIndex( *pSectionNode->EndOfSectionNode(), 1 ); pPaM->GetPoint()->nNode = pSectionNode->GetIndex()+1; pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0 ); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index ae8fb628bc13..b3aab9306def 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ww8par6.cxx,v $ * - * $Revision: 1.67 $ + * $Revision: 1.68 $ * - * last change: $Author: cmc $ $Date: 2002-03-20 16:17:09 $ + * last change: $Author: cmc $ $Date: 2002-04-04 14:11:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -199,7 +199,7 @@ #ifndef _SVX_CHARRELIEFITEM_HXX #include <svx/charreliefitem.hxx> #endif -#ifndef _SVX_HYZNITEM_HXX //autogen +#ifndef _SVX_HYZNITEM_HXX #include <svx/hyznitem.hxx> #endif #ifndef _SVX_PARAVERTALIGNITEM_HXX @@ -1068,8 +1068,8 @@ void SwWW8ImplReader::SetUseOn( SwPageDesc* pPageDesc0, SwPageDesc* pPageDesc1, } } -void SwWW8ImplReader::InsertSectionWithWithoutCols( SwPaM& rMyPaM, - const SwFmtCol* pCol ) +void SwWW8ImplReader::InsertSectionWithWithoutCols(SwPaM& rMyPaM, + const SwFmtCol* pCol) { // if this Node is not empty create a new Node befor inserting the Section const SwPosition* pPos = rMyPaM.GetPoint(); @@ -1106,21 +1106,36 @@ void SwWW8ImplReader::InsertSectionWithWithoutCols( SwPaM& rMyPaM, aSet.Put( SwFmtEndAtTxtEnd( FTNEND_ATTXTEND )); pNewSection = rDoc.Insert( rMyPaM, aSection, &aSet ); - ASSERT( !pBehindSection, "pBehindSection ungleich Null! why Recursion?"); // set PaM into first Node of the new Section - const SwSectionNode* pSectionNode = - pNewSection->GetFmt()->GetSectionNode(); + const SwSectionNode* pSectionNode = pNewSection->GetFmt()->GetSectionNode(); ASSERT( pSectionNode, "Kein Inhalt vorbereitet." ); - pBehindSection = new SwNodeIndex( *pSectionNode->EndOfSectionNode(), 1 ); - - rMyPaM.GetPoint()->nNode = - pSectionNode->GetIndex()+1; - rMyPaM.GetPoint()->nContent.Assign( - rMyPaM.GetCntntNode(), 0 ); + rMyPaM.GetPoint()->nNode = pSectionNode->GetIndex()+1; + rMyPaM.GetPoint()->nContent.Assign(rMyPaM.GetCntntNode(), 0); } +BOOL SwWW8ImplReader::MustCloseSection(long nTxtPos) +{ + // Might we have to close a section first? + BOOL bSectionWasJustClosed = pNewSection && nTxtPos; + if( bSectionWasJustClosed ) + { + // remove preceeding Node + // if a 0x0d came immediately before + if( 0 == pPaM->GetPoint()->nContent.GetIndex() ) + JoinNode( pPaM ); + // set PaM behind section + const SwSectionNode* pSectionNode = pNewSection->GetFmt()-> + GetSectionNode(); + SwNodeIndex aPref(*pSectionNode->EndOfSectionNode(), 1); + pPaM->GetPoint()->nNode = aPref; + pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0); + + DELETEZ( pLastPgDeskIdx ); + } + return bSectionWasJustClosed; +} // Bei jedem Abschnittswechsel ( auch am Anfang eines Dokuments ) wird @@ -1137,22 +1152,7 @@ void SwWW8ImplReader::CreateSep(const long nTxtPos,BOOL bMustHaveBreak) BYTE nLastSectionCorrIhdt = nCorrIhdt; BOOL bLastSectionHadATitlePage = bSectionHasATitlePage; - // Might we have to close a section first? - BOOL bSectionWasJustClosed = pBehindSection && nTxtPos; - if( bSectionWasJustClosed ) - { - // remove preceeding Node - // if a 0x0d came immediately before - if( 0 == pPaM->GetPoint()->nContent.GetIndex() ) - JoinNode( pPaM ); - // set PaM behind section - pPaM->GetPoint()->nNode = *pBehindSection; - pPaM->GetPoint()->nContent.Assign( - pPaM->GetCntntNode(), 0 ); - - DELETEZ( pBehindSection ); - DELETEZ( pLastPgDeskIdx ); - } + BOOL bSectionWasJustClosed = MustCloseSection(nTxtPos); SwPageDesc* pOldPageDesc = pPageDesc; SwPageDesc* pPageDesc1 = 0; @@ -1370,6 +1370,7 @@ void SwWW8ImplReader::CreateSep(const long nTxtPos,BOOL bMustHaveBreak) // zu ignorierende Attribute sammeln SvUShortsSort aIgnore(9, 1); + BOOL bEqual = FALSE; if( bContinuousBreak ) { /* @@ -1397,24 +1398,27 @@ void SwWW8ImplReader::CreateSep(const long nTxtPos,BOOL bMustHaveBreak) 136, 137, 138, 139, 142, 144, 145, 147, 152, 154, 155, 158, 160 }; - static USHORT __READONLY_DATA aVer8Ids[16] = + static USHORT __READONLY_DATA aVer8Ids[20] = { //sortiert! 0x3005, 0x3006, 0x3009, 0x300E, 0x3013, 0x3019, 0x3229, 0x500B, 0x5015, 0x501B, 0x5026, 0x703A, 0x900C, 0x9016, - 0xF203, 0xF204 + 0x9023, 0x9024, 0xB017, 0xB018, 0xF203, 0xF204 }; if( bVer67 ) - aIgnore.Insert(aVer67Ids, 13); + aIgnore.Insert(aVer67Ids, sizeof(aVer67Ids)/sizeof(USHORT)); else - aIgnore.Insert(aVer8Ids, 16); - } + aIgnore.Insert(aVer8Ids, sizeof(aVer8Ids)/sizeof(USHORT)); - // nachschauen, ob die nicht zu ignor. Attr. gleich sind - BOOL bEqual = (bSectionHasATitlePage == bLastSectionHadATitlePage) + bEqual = TRUE; + } + else + { + bEqual = (bSectionHasATitlePage == bLastSectionHadATitlePage) && (nCorrIhdt == nLastSectionCorrIhdt) && (nCorrIhdt == (nCorrIhdt & nJustCopyHdFt)) && (nNfcPgn == nLastNfcPgn); + } if (bEqual) //Give continious breaks leniency. { @@ -1431,7 +1435,7 @@ void SwWW8ImplReader::CreateSep(const long nTxtPos,BOOL bMustHaveBreak) sections could have margins independant of the host page, like tables or graphics. */ - pOldPageDesc = pOldPageDesc->GetFollow(); + pOldPageDesc = pOldPageDesc ? pOldPageDesc->GetFollow() : 0; if (bSectionHasATitlePage) { bSectionHasATitlePage = 0; @@ -1481,9 +1485,6 @@ void SwWW8ImplReader::CreateSep(const long nTxtPos,BOOL bMustHaveBreak) */ if( bNew ) { - if( 0 <= pPaM->GetPoint()->nContent.GetIndex() ) - AppendTxtNode(*pPaM->GetPoint()); - if( pPageDesc ) rDoc.Insert(*pPaM, SwFmtPageDesc( pPageDesc )); else @@ -1504,9 +1505,6 @@ void SwWW8ImplReader::CreateSep(const long nTxtPos,BOOL bMustHaveBreak) { if ((nBreakCode > 1) && bMustHaveBreak) { - if( 0 < pPaM->GetPoint()->nContent.GetIndex() ) - AppendTxtNode(*pPaM->GetPoint()); - if( pPageDesc ) rDoc.Insert(*pPaM, SwFmtPageDesc( pPageDesc )); } |
