Kaydet (Commit) 685921ea authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann

123389: - revert change made for 121897 which triggers defect 123389

- method <SwTxtAttr::RstAttr(..)> - correct consideration of parameter <bInclRefToxMark> used by Undo to fix 121897
üst 735cd485
...@@ -285,8 +285,12 @@ public: ...@@ -285,8 +285,12 @@ public:
refmarks, toxmarks, and metas will be ignored unless this is true refmarks, toxmarks, and metas will be ignored unless this is true
ATTENTION: setting bInclRefToxMark is only allowed from UNDO! ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
*/ */
void RstAttr( const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich = 0, void RstAttr(
const SfxItemSet* pSet = 0, sal_Bool bInclRefToxMark = sal_False ); const SwIndex &rIdx,
const xub_StrLen nLen,
const sal_uInt16 nWhich = 0,
const SfxItemSet* pSet = 0,
const sal_Bool bInclRefToxMark = sal_False );
void GCAttr(); void GCAttr();
// loesche das Text-Attribut (muss beim Pool abgemeldet werden!) // loesche das Text-Attribut (muss beim Pool abgemeldet werden!)
......
...@@ -394,26 +394,25 @@ inline sal_Bool InRange(xub_StrLen nIdx, xub_StrLen nStart, xub_StrLen nEnd) { ...@@ -394,26 +394,25 @@ inline sal_Bool InRange(xub_StrLen nIdx, xub_StrLen nStart, xub_StrLen nEnd) {
* -> nothing to do * -> nothing to do
*/ */
void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, void SwTxtNode::RstAttr(
const SfxItemSet* pSet, sal_Bool bInclRefToxMark ) const SwIndex &rIdx,
const xub_StrLen nLen,
const sal_uInt16 nWhich,
const SfxItemSet* pSet,
const sal_Bool bInclRefToxMark )
{ {
// Attribute?
if ( !GetpSwpHints() ) if ( !GetpSwpHints() )
return; return;
sal_uInt16 i = 0; const xub_StrLen nStt = rIdx.GetIndex();
xub_StrLen nStt = rIdx.GetIndex(); const xub_StrLen nEnd = nStt + nLen;
xub_StrLen nEnd = nStt + nLen;
xub_StrLen nAttrStart;
SwTxtAttr *pHt;
sal_Bool bChanged = sal_False; bool bChanged = false;
// nMin and nMax initialized to maximum / minimum (inverse) // nMin and nMax initialized to maximum / minimum (inverse)
xub_StrLen nMin = m_Text.Len(); xub_StrLen nMin = m_Text.Len();
xub_StrLen nMax = nStt; xub_StrLen nMax = nStt;
const bool bNoLen = nMin == 0;
const sal_Bool bNoLen = !nMin;
// We have to remember the "new" attributes, which have // We have to remember the "new" attributes, which have
// been introduced by splitting surrounding attributes (case 4). // been introduced by splitting surrounding attributes (case 4).
...@@ -422,15 +421,27 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, ...@@ -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 // iterate over attribute array until start of attribute is behind
// deletion range // deletion range
sal_uInt16 i = 0;
xub_StrLen nAttrStart;
SwTxtAttr *pHt = NULL;
while ((i < m_pSwpHints->Count()) && while ((i < m_pSwpHints->Count()) &&
((( nAttrStart = *(*m_pSwpHints)[i]->GetStart()) < nEnd ) || nLen==0) ) ((( nAttrStart = *(*m_pSwpHints)[i]->GetStart()) < nEnd ) || nLen==0) )
{ {
pHt = m_pSwpHints->GetTextHint(i); pHt = m_pSwpHints->GetTextHint(i);
// attributes without end stay in! // attributes without end stay in!
xub_StrLen * const pAttrEnd = pHt->GetEnd(); // but consider <bInclRefToxMark> used by Undo
if ( !pAttrEnd /*|| pHt->HasDummyChar()*/ ) // see bInclRefToxMark 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++; i++;
continue; continue;
} }
...@@ -480,21 +491,22 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, ...@@ -480,21 +491,22 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich,
if( nStt <= nAttrStart ) // Faelle: 1,3,5 if( nStt <= nAttrStart ) // Faelle: 1,3,5
{ {
const xub_StrLen nAttrEnd = pAttrEnd != NULL
? *pAttrEnd
: nAttrStart;
if( nEnd > nAttrStart if( nEnd > nAttrStart
|| ( nEnd == *pAttrEnd && nEnd==nAttrStart ) ) || ( nEnd == nAttrEnd && nEnd == nAttrStart ) )
{ {
// Faelle: 1,3 // Faelle: 1,3
if ( nMin > nAttrStart ) if ( nMin > nAttrStart )
nMin = nAttrStart; nMin = nAttrStart;
if ( nMax < *pAttrEnd ) if ( nMax < nAttrEnd )
nMax = *pAttrEnd; nMax = nAttrEnd;
// Falls wir nur ein nichtaufgespanntes Attribut entfernen, // Falls wir nur ein nichtaufgespanntes Attribut entfernen,
// tun wir mal so, als ob sich nichts geaendert hat. // tun wir mal so, als ob sich nichts geaendert hat.
bChanged = bChanged || nEnd > nAttrStart || bNoLen; bChanged = bChanged || nEnd > nAttrStart || bNoLen;
if( *pAttrEnd <= nEnd ) // Fall: 1 if( nAttrEnd <= nEnd ) // Fall: 1
{ {
const xub_StrLen nAttrEnd = *pAttrEnd;
m_pSwpHints->DeleteAtPos(i); m_pSwpHints->DeleteAtPos(i);
DestroyAttr( pHt ); DestroyAttr( pHt );
...@@ -505,8 +517,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, ...@@ -505,8 +517,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich,
InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST ); InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
} }
// if the last attribute is a Field, the HintsArray is // if the last attribute is a Field, the HintsArray is deleted!
// deleted!
if ( !m_pSwpHints ) if ( !m_pSwpHints )
break; break;
...@@ -533,11 +544,12 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, ...@@ -533,11 +544,12 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich,
InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST ); 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 > nStt ) // Faelle: 2,4
{ {
if( *pAttrEnd < nEnd ) // Fall: 2 if( *pAttrEnd < nEnd ) // Fall: 2
...@@ -546,7 +558,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, ...@@ -546,7 +558,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich,
nMin = nAttrStart; nMin = nAttrStart;
if ( nMax < *pAttrEnd ) if ( nMax < *pAttrEnd )
nMax = *pAttrEnd; nMax = *pAttrEnd;
bChanged = sal_True; bChanged = true;
const xub_StrLen nAttrEnd = *pAttrEnd; const xub_StrLen nAttrEnd = *pAttrEnd;
...@@ -562,13 +574,14 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, ...@@ -562,13 +574,14 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich,
} }
} }
else if( nLen ) // Fall: 4 else if( nLen ) // Fall: 4
{ // bei Lange 0 werden beide Hints vom Insert(Ht) {
// bei Lange 0 werden beide Hints vom Insert(Ht)
// wieder zu einem zusammengezogen !!!! // wieder zu einem zusammengezogen !!!!
if ( nMin > nAttrStart ) if ( nMin > nAttrStart )
nMin = nAttrStart; nMin = nAttrStart;
if ( nMax < *pAttrEnd ) if ( nMax < *pAttrEnd )
nMax = *pAttrEnd; nMax = *pAttrEnd;
bChanged = sal_True; bChanged = true;
xub_StrLen nTmpEnd = *pAttrEnd; xub_StrLen nTmpEnd = *pAttrEnd;
m_pSwpHints->NoteInHistory( pHt ); m_pSwpHints->NoteInHistory( pHt );
*pAttrEnd = nStt; *pAttrEnd = nStt;
...@@ -604,6 +617,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich, ...@@ -604,6 +617,7 @@ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich,
} }
++i; ++i;
} }
}
TryDeleteSwpHints(); TryDeleteSwpHints();
if (bChanged) if (bChanged)
......
...@@ -248,9 +248,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) ...@@ -248,9 +248,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
pTxtNode->JoinNext(); pTxtNode->JoinNext();
} }
// reset all text attributes in the paragraph! // 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 pTxtNode->RstAttr( SwIndex(pTxtNode, 0), pTxtNode->Len(), 0, 0, true );
if( pTxtNode && pTxtNode->GetpSwpHints() )
pTxtNode->ClearSwpHintsArr( true );
// setze alle Attribute im Node zurueck // setze alle Attribute im Node zurueck
pTxtNode->ResetAllAttr(); pTxtNode->ResetAllAttr();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment