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:
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!)
......
......@@ -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();
......
......@@ -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();
......
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