Index: untbl.cxx =================================================================== --- untbl.cxx 25 May 2007 13:02:09 -0000 1.30 +++ untbl.cxx 21 Jun 2007 13:00:45 -0000 1.30.12.1 @@ -2344,11 +2344,11 @@ bNewFmt = bNewFml = bNewValue = FALSE; nNode = rBox.GetSttIdx(); - ULONG nNdPos = rBox.IsValidNumTxtNd( 0 == pNewSet ); + nNdPos = rBox.IsValidNumTxtNd( 0 == pNewSet ); + SwDoc* pDoc = rBox.GetFrmFmt()->GetDoc(); if( ULONG_MAX != nNdPos ) { - SwDoc* pDoc = rBox.GetFrmFmt()->GetDoc(); SwTxtNode* pTNd = pDoc->GetNodes()[ nNdPos ]->GetTxtNode(); pHistory = new SwHistory; @@ -2365,32 +2365,32 @@ aStr = pTNd->GetTxt(); if( pTNd->GetpSwpHints() ) pTNd->GetpSwpHints()->DeRegister(); + } - pBoxSet = new SfxItemSet( pDoc->GetAttrPool(), aTableBoxSetRange ); - pBoxSet->Put( rBox.GetFrmFmt()->GetAttrSet() ); + pBoxSet = new SfxItemSet( pDoc->GetAttrPool(), aTableBoxSetRange ); + pBoxSet->Put( rBox.GetFrmFmt()->GetAttrSet() ); - if( pNewSet ) - { - const SfxPoolItem* pItem; - if( SFX_ITEM_SET == pNewSet->GetItemState( RES_BOXATR_FORMAT, - FALSE, &pItem )) - { - bNewFmt = TRUE; - nNewFmtIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); - } - if( SFX_ITEM_SET == pNewSet->GetItemState( RES_BOXATR_FORMULA, - FALSE, &pItem )) - { - bNewFml = TRUE; - aNewFml = ((SwTblBoxFormula*)pItem)->GetFormula(); - } - if( SFX_ITEM_SET == pNewSet->GetItemState( RES_BOXATR_VALUE, - FALSE, &pItem )) - { - bNewValue = TRUE; - fNewNum = ((SwTblBoxValue*)pItem)->GetValue(); - } - } + if( pNewSet ) + { + const SfxPoolItem* pItem; + if( SFX_ITEM_SET == pNewSet->GetItemState( RES_BOXATR_FORMAT, + FALSE, &pItem )) + { + bNewFmt = TRUE; + nNewFmtIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); + } + if( SFX_ITEM_SET == pNewSet->GetItemState( RES_BOXATR_FORMULA, + FALSE, &pItem )) + { + bNewFml = TRUE; + aNewFml = ((SwTblBoxFormula*)pItem)->GetFormula(); + } + if( SFX_ITEM_SET == pNewSet->GetItemState( RES_BOXATR_VALUE, + FALSE, &pItem )) + { + bNewValue = TRUE; + fNewNum = ((SwTblBoxValue*)pItem)->GetValue(); + } } // wird die History ueberhaupt benoetigt ?? @@ -2407,9 +2407,7 @@ void SwUndoTblNumFmt::Undo( SwUndoIter& rIter ) { - // konnte die Box veraendert werden ? - if( !pBoxSet ) - return ; + ASSERT( pBoxSet, "Where's the stored item set?" ) SwDoc& rDoc = rIter.GetDoc(); SwStartNode* pSttNd = rDoc.GetNodes()[ nNode ]-> @@ -2423,13 +2421,16 @@ pFmt->SetAttr( *pBoxSet ); pBox->ChgFrmFmt( pFmt ); - SwTxtNode* pTxtNd = rDoc.GetNodes()[ nNode + 1 ]->GetTxtNode(); + if( ULONG_MAX == nNdPos ) + return; + + SwTxtNode* pTxtNd = rDoc.GetNodes()[ nNdPos ]->GetTxtNode(); // wenn mehr als ein Node geloescht wurde, dann wurden auch // alle "Node"-Attribute gespeichert if( pTxtNd->HasSwAttrSet() ) pTxtNd->ResetAllAttr(); - if( pTxtNd->GetpSwpHints() ) + if( pTxtNd->GetpSwpHints() && aStr.Len() ) pTxtNd->ClearSwpHintsArr( true ); // ChgTextToNum(..) only acts when the strings are different. We @@ -2439,9 +2440,11 @@ rDoc.DeleteRedline( *( pBox->GetSttNd() ), false, USHRT_MAX ); SwIndex aIdx( pTxtNd, 0 ); - pTxtNd->Erase( aIdx ); if( aStr.Len() ) + { + pTxtNd->Erase( aIdx ); pTxtNd->Insert( aStr, aIdx, INS_NOHINTEXPAND ); + } } if( pHistory )