sw/inc/ndtxt.hxx | 8 ++- sw/source/core/txtnode/txtedt.cxx | 82 ++++++++++++++++++++++---------------- sw/source/core/undo/untblk.cxx | 6 -- 3 files changed, 56 insertions(+), 40 deletions(-)
New commits: commit 685921ea31de48e26ad33e8aab9c3053cc622a34 Author: Oliver-Rainer Wittmann <o...@apache.org> Date: Mon Sep 30 13:42:34 2013 +0000 123389: - revert change made for 121897 which triggers defect 123389 - method <SwTxtAttr::RstAttr(..)> - correct consideration of parameter <bInclRefToxMark> used by Undo to fix 121897 diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 46d4128..393cd9a 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -285,8 +285,12 @@ public: refmarks, toxmarks, and metas will be ignored unless this is true ATTENTION: setting bInclRefToxMark is only allowed from UNDO! */ - void RstAttr( const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich = 0, - const SfxItemSet* pSet = 0, sal_Bool bInclRefToxMark = sal_False ); + void RstAttr( + const SwIndex &rIdx, + const xub_StrLen nLen, + const sal_uInt16 nWhich = 0, + const SfxItemSet* pSet = 0, + const sal_Bool bInclRefToxMark = sal_False ); void GCAttr(); // loesche das Text-Attribut (muss beim Pool abgemeldet werden!) diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 3f0cfca..77469bd 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -394,26 +394,25 @@ inline sal_Bool InRange(xub_StrLen nIdx, xub_StrLen nStart, xub_StrLen nEnd) { * -> nothing to do */ -void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, - const SfxItemSet* pSet, sal_Bool bInclRefToxMark ) +void SwTxtNode::RstAttr( + const SwIndex &rIdx, + const xub_StrLen nLen, + const sal_uInt16 nWhich, + const SfxItemSet* pSet, + const sal_Bool bInclRefToxMark ) { - // Attribute? if ( !GetpSwpHints() ) return; - sal_uInt16 i = 0; - xub_StrLen nStt = rIdx.GetIndex(); - xub_StrLen nEnd = nStt + nLen; - xub_StrLen nAttrStart; - SwTxtAttr *pHt; + const xub_StrLen nStt = rIdx.GetIndex(); + const xub_StrLen nEnd = nStt + nLen; - sal_Bool bChanged = sal_False; + bool bChanged = false; // nMin and nMax initialized to maximum / minimum (inverse) xub_StrLen nMin = m_Text.Len(); xub_StrLen nMax = nStt; - - const sal_Bool bNoLen = !nMin; + const bool bNoLen = nMin == 0; // We have to remember the "new" attributes, which have // been introduced by splitting surrounding attributes (case 4). @@ -422,15 +421,27 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, // iterate over attribute array until start of attribute is behind // deletion range + sal_uInt16 i = 0; + xub_StrLen nAttrStart; + SwTxtAttr *pHt = NULL; while ((i < m_pSwpHints->Count()) && ((( nAttrStart = *(*m_pSwpHints)[i]->GetStart()) < nEnd ) || nLen==0) ) { pHt = m_pSwpHints->GetTextHint(i); // attributes without end stay in! - xub_StrLen * const pAttrEnd = pHt->GetEnd(); - if ( !pAttrEnd /*|| pHt->HasDummyChar()*/ ) // see bInclRefToxMark + // but consider <bInclRefToxMark> used by Undo + xub_StrLen* const pAttrEnd = pHt->GetEnd(); + const bool bKeepAttrWithoutEnd = + pAttrEnd == NULL + && ( !bInclRefToxMark + || ( RES_TXTATR_REFMARK != pHt->Which() + && RES_TXTATR_TOXMARK != pHt->Which() + && RES_TXTATR_META != pHt->Which() + && RES_TXTATR_METAFIELD != pHt->Which() ) ); + if ( bKeepAttrWithoutEnd ) { + i++; continue; } @@ -480,21 +491,22 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, if( nStt <= nAttrStart ) // Faelle: 1,3,5 { + const xub_StrLen nAttrEnd = pAttrEnd != NULL + ? *pAttrEnd + : nAttrStart; if( nEnd > nAttrStart - || ( nEnd == *pAttrEnd && nEnd==nAttrStart ) ) + || ( nEnd == nAttrEnd && nEnd == nAttrStart ) ) { // Faelle: 1,3 if ( nMin > nAttrStart ) nMin = nAttrStart; - if ( nMax < *pAttrEnd ) - nMax = *pAttrEnd; + if ( nMax < nAttrEnd ) + nMax = nAttrEnd; // Falls wir nur ein nichtaufgespanntes Attribut entfernen, // tun wir mal so, als ob sich nichts geaendert hat. bChanged = bChanged || nEnd > nAttrStart || bNoLen; - if( *pAttrEnd <= nEnd ) // Fall: 1 + if( nAttrEnd <= nEnd ) // Fall: 1 { - const xub_StrLen nAttrEnd = *pAttrEnd; - m_pSwpHints->DeleteAtPos(i); DestroyAttr( pHt ); @@ -505,8 +517,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST ); } - // if the last attribute is a Field, the HintsArray is - // deleted! + // if the last attribute is a Field, the HintsArray is deleted! if ( !m_pSwpHints ) break; @@ -520,7 +531,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, continue; } - else // Fall: 3 + else // Fall: 3 { m_pSwpHints->NoteInHistory( pHt ); *pHt->GetStart() = nEnd; @@ -533,20 +544,21 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST ); } - bChanged = sal_True; + bChanged = true; } } } - else // Faelle: 2,4,5 + else if ( pAttrEnd != NULL ) // Faelle: 2,4,5 + { if( *pAttrEnd > nStt ) // Faelle: 2,4 { - if( *pAttrEnd < nEnd ) // Fall: 2 + if( *pAttrEnd < nEnd ) // Fall: 2 { if ( nMin > nAttrStart ) nMin = nAttrStart; if ( nMax < *pAttrEnd ) nMax = *pAttrEnd; - bChanged = sal_True; + bChanged = true; const xub_StrLen nAttrEnd = *pAttrEnd; @@ -557,18 +569,19 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, if ( pStyleHandle.get() ) { SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(), - *pStyleHandle, nStt, nAttrEnd ); + *pStyleHandle, nStt, nAttrEnd ); InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST ); } } - else if( nLen ) // Fall: 4 - { // bei Lange 0 werden beide Hints vom Insert(Ht) - // wieder zu einem zusammengezogen !!!! + else if( nLen ) // Fall: 4 + { + // bei Lange 0 werden beide Hints vom Insert(Ht) + // wieder zu einem zusammengezogen !!!! if ( nMin > nAttrStart ) nMin = nAttrStart; if ( nMax < *pAttrEnd ) nMax = *pAttrEnd; - bChanged = sal_True; + bChanged = true; xub_StrLen nTmpEnd = *pAttrEnd; m_pSwpHints->NoteInHistory( pHt ); *pAttrEnd = nStt; @@ -577,14 +590,14 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, if ( pStyleHandle.get() && nStt < nEnd ) { SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(), - *pStyleHandle, nStt, nEnd ); + *pStyleHandle, nStt, nEnd ); InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST ); } if( nEnd < nTmpEnd ) { SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(), - pHt->GetAttr(), nEnd, nTmpEnd ); + pHt->GetAttr(), nEnd, nTmpEnd ); if ( pNew ) { SwTxtCharFmt* pCharFmt = dynamic_cast<SwTxtCharFmt*>(pHt); @@ -602,7 +615,8 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, } } } - ++i; + ++i; + } } TryDeleteSwpHints(); diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index 8dfd472..57a7d73 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -243,14 +243,12 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) { { RemoveIdxRel( rIdx.GetIndex()+1, SwPosition( rIdx, - SwIndex( pTxtNode, pTxtNode->GetTxt().Len() ))); + SwIndex( pTxtNode, pTxtNode->GetTxt().Len() ))); } pTxtNode->JoinNext(); } // reset all text attributes in the paragraph! - //i121897, change the hints clearing method from 'RstAttr' to 'ClarSwpHints' as the certain tox mark index hint reason - if( pTxtNode && pTxtNode->GetpSwpHints() ) - pTxtNode->ClearSwpHintsArr( true ); + pTxtNode->RstAttr( SwIndex(pTxtNode, 0), pTxtNode->Len(), 0, 0, true ); // setze alle Attribute im Node zurueck pTxtNode->ResetAllAttr(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits