diff options
author | Caolán McNamara <cmc@openoffice.org> | 2002-01-15 10:21:11 +0000 |
---|---|---|
committer | Caolán McNamara <cmc@openoffice.org> | 2002-01-15 10:21:11 +0000 |
commit | 96548048cd1c55a2a45ce86fe5c46965b5a92e9c (patch) | |
tree | bde95dbd41acf106de1ab33ebddbbef1b6908a3d /sw/source/filter | |
parent | 12e23933aabb9db31140062a81cddc4e20396d87 (diff) |
#i2697# export restart numbering by exporting seperate lists
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/ww8/wrtw8num.cxx | 31 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 24 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 14 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 48 |
5 files changed, 83 insertions, 46 deletions
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 97699b99416b..c4fafc7e7ab3 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -2,9 +2,9 @@ * * $RCSfile: wrtw8num.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: cmc $ $Date: 2002-01-10 14:11:05 $ + * last change: $Author: cmc $ $Date: 2002-01-15 11:21:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -106,6 +106,33 @@ using namespace ::com::sun::star::i18n; +USHORT SwWW8Writer::DupNumRuleWithLvlStart(const SwNumRule *pRule,BYTE nLvl, + USHORT nVal) +{ + //List is set to restart at a particular value so for export make a + //completely new list based on this one and export that instead, + //which duplicates words behaviour in this respect. + USHORT nNumId = USHRT_MAX; + String sPrefix = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM + ("WW8TempExport" )); + sPrefix += String::CreateFromInt32( nUniqueList++ ); + SwNumRule* pMyNumRule = new SwNumRule(pDoc->GetUniqueNumRuleName(&sPrefix)); + pUsedNumTbl->Insert( pMyNumRule, pUsedNumTbl->Count() ); + + for (int i=0;i<MAXLEVEL;i++) + { + const SwNumFmt& rSubRule = pRule->Get(i); + pMyNumRule->Set( i, rSubRule ); + } + + SwNumFmt aNumFmt(pMyNumRule->Get(nLvl)); + aNumFmt.SetStart(nVal); + pMyNumRule->Set(nLvl,aNumFmt); + + if (pMyNumRule) + nNumId = GetId( *pMyNumRule ); + return nNumId; +} USHORT SwWW8Writer::GetId( const SwNumRule& rNumRule ) const { diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index d62d53af2961..1fc86dc8bc2a 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.22 $ + * $Revision: 1.23 $ * - * last change: $Author: cmc $ $Date: 2002-01-10 14:11:05 $ + * last change: $Author: cmc $ $Date: 2002-01-15 11:21:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2149,8 +2149,10 @@ ULONG SwWW8Writer::StoreDoc() if( pUsedNumTbl ) // all used NumRules { - // clear array - it's an auto delete array - pUsedNumTbl->Remove( 0, pUsedNumTbl->Count() ); + // clear the part of the list array that was copied from the document + // - it's an auto delete array, so the rest of the array which are + // duplicated lists that were added during the export will be deleted. + pUsedNumTbl->Remove( 0, pUsedNumTbl->Count()-nUniqueList ); delete pUsedNumTbl; } @@ -2301,7 +2303,7 @@ ULONG SwWW8Writer::WriteStorage() SwWW8Writer::SwWW8Writer( const String& rFltName ) : pChpIter( 0 ), aMainStg( sMainStream ), pPapPlc( 0 ), pChpPlc( 0 ), pO( 0 ), pAktPageDesc( 0 ), pISet( 0 ), pUsedNumTbl( 0 ), pBmpPal( 0 ), - pKeyMap( 0 ), pOLEExp( 0 ), pOCXExp(0), pOleMap(0) + pKeyMap( 0 ), pOLEExp( 0 ), pOCXExp(0), pOleMap(0), nUniqueList(0) { bWrtWW8 = rFltName.EqualsAscii( FILTER_WW8 ); } diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 48cc1226814c..58ae52fcb498 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.14 $ + * $Revision: 1.15 $ * - * last change: $Author: cmc $ $Date: 2002-01-10 14:08:09 $ + * last change: $Author: cmc $ $Date: 2002-01-15 11:21:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -297,10 +297,10 @@ friend Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ); String aMainStg; SvPtrarr aTOXArr; - SwPosFlyFrms* pFlyPos; // Pointer auf die aktuelle "FlyFrmTabelle" - const SfxItemSet* pISet; // fuer Doppel-Attribute - WW8_WrPct* pPiece; // Pointer auf Piece-Table - SwNumRuleTbl* pUsedNumTbl; // alle used NumRules + SwPosFlyFrms* pFlyPos; // Pointer auf die aktuelle "FlyFrmTabelle" + const SfxItemSet* pISet; // fuer Doppel-Attribute + WW8_WrPct* pPiece; // Pointer auf Piece-Table + SwNumRuleTbl* pUsedNumTbl; // alle used NumRules WW8_WrtBookmarks* pBkmks; WW8_WrtRedlineAuthor* pRedlAuthors; BitmapPalette* pBmpPal; @@ -309,13 +309,14 @@ friend Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ); SwMSConvertControls* pOCXExp; WW8OleMaps* pOleMap; - ULONG nIniFlags; // Flags aus der writer.ini + ULONG nIniFlags; // Flags aus der writer.ini USHORT nCharFmtStart; USHORT nFmtCollStart; - USHORT nAktFlyPos; // Index auf das naechste "FlyFrmFmt" - USHORT nStyleBeforeFly; // Style-Nummer des Nodes, - // in/an dem ein Fly verankert ist - USHORT nLastFmtId; // Style of last TxtNode in normal range + USHORT nAktFlyPos; // Index auf das naechste "FlyFrmFmt" + USHORT nStyleBeforeFly; // Style-Nummer des Nodes, + // in/an dem ein Fly verankert ist + USHORT nLastFmtId; // Style of last TxtNode in normal range + USHORT nUniqueList; // current number for creating unique list names virtual ULONG WriteStorage(); @@ -528,6 +529,7 @@ public: static void InsAsString8( WW8Bytes& rO, const String& rStr, rtl_TextEncoding eCodeSet ); static BOOL CollapseScriptsforWordOk(USHORT nScript, USHORT nWhich); + USHORT DupNumRuleWithLvlStart(const SwNumRule *pRule,BYTE nLvl,USHORT nVal); void InsUInt16( UINT16 n ) { SwWW8Writer::InsUInt16( *pO, n ); } void InsUInt32( UINT32 n ) { SwWW8Writer::InsUInt32( *pO, n ); } diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index f7520d67fe5b..9945474a5624 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.25 $ + * $Revision: 1.26 $ * - * last change: $Author: cmc $ $Date: 2002-01-14 10:53:53 $ + * last change: $Author: cmc $ $Date: 2002-01-15 11:21:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2406,8 +2406,6 @@ static Writer& OutWW8_SvxTwoLinesItem( Writer& rWrt, const SfxPoolItem& rHt ) return rWrt; } - - static Writer& OutWW8_SwNumRuleItem( Writer& rWrt, const SfxPoolItem& rHt ) { SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt; @@ -2432,6 +2430,14 @@ static Writer& OutWW8_SwNumRuleItem( Writer& rWrt, const SfxPoolItem& rHt ) if( pNum && NO_NUM > pNum->GetLevel() ) nLvl = GetRealLevel( pNum->GetLevel() ); + + if (pNum && USHRT_MAX != pNum->GetSetValue() ) + { + nNumId = rWW8Wrt.DupNumRuleWithLvlStart(pRule,nLvl, + pNum->GetSetValue()); + if (USHRT_MAX != nNumId) + ++nNumId; + } } else if( rWW8Wrt.pOutFmtNode->ISA( SwTxtFmtColl )) { diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index aa5e0da37e0f..6f1d4afdc5be 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ww8par3.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: cmc $ $Date: 2002-01-14 14:46:43 $ + * last change: $Author: cmc $ $Date: 2002-01-15 11:21:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -638,8 +638,8 @@ sal_Bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, SvxExtNumType eType; // Writer-Num-Typ SvxAdjust eAdj; // Ausrichtung (Links/rechts/zent.) sal_Unicode cBullet; - String aPrefix; - String aPostfix; + String sPrefix; + String sPostfix; WW8LVL aLVL; // // 1. LVLF einlesen @@ -794,8 +794,8 @@ sal_Bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, if( !cBullet ) // unsave control code? cBullet = 0x2190; - aPrefix = aEmptyStr; - aPostfix = aEmptyStr; + sPrefix = aEmptyStr; + sPostfix = aEmptyStr; } else { @@ -807,14 +807,14 @@ sal_Bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, 1 there is a "prefix" before the number */ if(aLVL.aOfsNumsXCH[0] <= 1) - aPrefix = aEmptyStr; + sPrefix = aEmptyStr; else - aPrefix = sNumString.Copy(0,aLVL.aOfsNumsXCH[0]-1); + sPrefix = sNumString.Copy(0,aLVL.aOfsNumsXCH[0]-1); if(nUpperLevel && (sNumString.Len() > aLVL.aOfsNumsXCH[nUpperLevel-1])) - aPostfix = sNumString.Copy(aLVL.aOfsNumsXCH[nUpperLevel-1]); + sPostfix = sNumString.Copy(aLVL.aOfsNumsXCH[nUpperLevel-1]); else - aPostfix.Erase(); + sPostfix.Erase(); } switch( aLVL.nAlign ) @@ -856,10 +856,10 @@ sal_Bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, else { // reminder: Garnix ist default Prefix - if( aPrefix.Len() ) - rNumFmt.SetPrefix( aPrefix ); + if( sPrefix.Len() ) + rNumFmt.SetPrefix( sPrefix ); // reminder: Point is default Postfix - rNumFmt.SetSuffix( aPostfix ); + rNumFmt.SetSuffix( sPostfix ); rNumFmt.SetIncludeUpperLevels( nUpperLevel ); } @@ -877,7 +877,7 @@ void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, WW8aISet& rListItemSet, WW8aCFmt& rCharFmt, sal_Bool& bNewCharFmtCreated, - String aPrefix ) + String sPrefix ) { bNewCharFmtCreated = sal_False; SfxItemSet* pThisLevelItemSet; @@ -928,7 +928,7 @@ void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, if( nWW8MaxListLevel == nIdenticalItemSetLevel ) { // Style definieren - String aName( aPrefix.Len() ? aPrefix : rNumRule.GetName() ); + String aName( sPrefix.Len() ? sPrefix : rNumRule.GetName() ); (aName += 'z') += String::CreateFromInt32( nLevel ); pFmt = rDoc.MakeCharFmt( aName, @@ -1025,11 +1025,11 @@ sal_Bool WW8ListManager::LFOequaltoLST(WW8LFOInfo& rLFOInfo) SwNumRule* WW8ListManager::CreateNextRule(BOOL bSimple) { - String aPrefix; // wird erstmal zur Bildung des Style Namens genommen - aPrefix = WW8_ASCII2STR( "WW8Num" ); - aPrefix += String::CreateFromInt32( nUniqueList++ ); + String sPrefix; // wird erstmal zur Bildung des Style Namens genommen + sPrefix = WW8_ASCII2STR( "WW8Num" ); + sPrefix += String::CreateFromInt32( nUniqueList++ ); sal_uInt16 nRul = - rDoc.MakeNumRule(rDoc.GetUniqueNumRuleName( &aPrefix )); + rDoc.MakeNumRule(rDoc.GetUniqueNumRuleName( &sPrefix )); SwNumRule* pMyNumRule = rDoc.GetNumRuleTbl()[nRul]; pMyNumRule->SetAutoRule( sal_False ); pMyNumRule->SetContinusNum( bSimple ); @@ -1056,7 +1056,7 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_) sal_uInt16 nLfo; sal_Bool bLVLOk=sal_True; sal_uInt8 aBits1; - String aPostfix; + String sPostfix; long nOriginalPos = rSt.Tell(); // @@ -1246,8 +1246,8 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_) break; // Nauemsprefix aufbauen: fuer NumRule-Name (eventuell) // und (falls vorhanden) fuer Style-Name (dann auf jeden Fall) - String aPrefix(RTL_CONSTASCII_STRINGPARAM( "WW8NumSt" )); - aPrefix += String::CreateFromInt32( nLfo + 1 ); + String sPrefix(RTL_CONSTASCII_STRINGPARAM( "WW8NumSt" )); + sPrefix += String::CreateFromInt32( nLfo + 1 ); // jetzt dem pNumRule seinen RICHTIGEN Wert zuweisen !!! // (bis dahin war hier die Parent NumRule vermerkt ) // @@ -1256,7 +1256,7 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_) if( USHRT_MAX > rReader.StyleUsingLFO( nLfo ) ) { sal_uInt16 nRul = rDoc.MakeNumRule( - rDoc.GetUniqueNumRuleName( &aPrefix ), pParentNumRule); + rDoc.GetUniqueNumRuleName( &sPrefix ), pParentNumRule); pLFOInfo->pNumRule = rDoc.GetNumRuleTbl()[ nRul ]; pLFOInfo->pNumRule->SetAutoRule( sal_False ); } @@ -1353,7 +1353,7 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_) for(nLevel = 0; nLevel < pLFOInfo->nLfoLvl; nLevel++) { AdjustLVL( nLevel, *pLFOInfo->pNumRule, aItemSet, aCharFmt, - bNewCharFmtCreated, aPrefix ); + bNewCharFmtCreated, sPrefix ); if( bNewCharFmtCreated ) aFlagsNewCharFmt += (1 << nLevel); } |