summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brinkmann <hbrinkm@openoffice.org>2011-03-04 11:14:35 +0100
committerHenning Brinkmann <hbrinkm@openoffice.org>2011-03-04 11:14:35 +0100
commitd637fbaf283d8e8e947da3f11c7540136fd4b79f (patch)
treec7ca2011833bf529085f499cea0601ae0467cc4c
parentcb4d27eee2cb82ce6b6eb39a2da78021d594ec48 (diff)
parent0c47b8429c98ef483020016e07599bce252c901a (diff)
merged from outgoing
-rw-r--r--sw/source/core/doc/docfmt.cxx70
-rw-r--r--sw/source/core/txtnode/thints.cxx5
-rwxr-xr-xsw/source/ui/ribbar/inputwin.cxx1
3 files changed, 16 insertions, 60 deletions
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 96cfea55dc..2581b7b8f1 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -493,45 +493,14 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
SwTxtNode* pTNd = aTmpStt.GetNode().GetTxtNode();
if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
{
- SfxItemIter aIter( *pTNd->GetpSwAttrSet() );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END );
-
- while( sal_True )
+ if (pHst)
{
- if( IsInRange( aCharFmtSetRange, pItem->Which() ))
- {
- pTNd->GetOrCreateSwpHints();
-
- aCharSet.Put( *pItem );
-
- if( pHst )
- {
- SwRegHistory aRegH( pTNd, *pTNd, pHst );
- pTNd->ResetAttr( pItem->Which() );
- }
- else
- pTNd->ResetAttr( pItem->Which() );
- }
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
+ SwRegHistory history(pTNd, *pTNd, pHst);
+ pTNd->FmtToTxtAttr(pTNd);
}
-
- if ( aCharSet.Count() )
+ else
{
- if ( pHst )
- {
- SwRegHistory history( pTNd, *pTNd, pHst );
- history.InsertItems( aCharSet, 0, pTNd->GetTxt().Len(),
- nsSetAttrMode::SETATTR_NOFORMATATTR );
- }
- else
- {
- SwTxtAttr* pNew =
- MakeTxtAttr( *this, aCharSet, 0, pTNd->GetTxt().Len() );
- pTNd->InsertHint( pNew );
- }
+ pTNd->FmtToTxtAttr(pTNd);
}
}
@@ -545,29 +514,14 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
SwTxtNode* pTNd = aTmpEnd.GetNode().GetTxtNode();
if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
{
- SfxItemIter aIter( *pTNd->GetpSwAttrSet() );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- while( sal_True )
+ if (pHst)
{
- if( IsInRange( aCharFmtSetRange, pItem->Which() ))
- {
- SwTxtAttr* pTAttr = MakeTxtAttr( *this,
- const_cast<SfxPoolItem&>(*pItem),
- 0, pTNd->GetTxt().Len() );
- SwpHints & rHints = pTNd->GetOrCreateSwpHints();
- rHints.SwpHintsArray::Insert( pTAttr );
- if ( pHst )
- {
- SwRegHistory aRegH( pTNd, *pTNd, pHst );
- pTNd->ResetAttr( pItem->Which() );
- pHst->Add( pTAttr, aTmpEnd.GetIndex(), true );
- }
- else
- pTNd->ResetAttr( pItem->Which() );
- }
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
+ SwRegHistory history(pTNd, *pTNd, pHst);
+ pTNd->FmtToTxtAttr(pTNd);
+ }
+ else
+ {
+ pTNd->FmtToTxtAttr(pTNd);
}
}
}
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 9fb5d1b3e1..e011520ef3 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -2100,7 +2100,7 @@ struct RemovePresentAttrs
const SwTxtAttr* const pAutoStyle(i_rAttrSpan.second);
SfxItemIter aIter(m_rAttrSet);
const SfxPoolItem* pItem(aIter.GetCurItem());
- while (true)
+ while (pItem)
{
const sal_uInt16 nWhich(pItem->Which());
if (CharFmt::IsItemIncluded(nWhich, pAutoStyle))
@@ -2142,7 +2142,8 @@ lcl_CollectHintSpans(const SwpHints& i_rHints, const sal_uInt16 nLength,
const AttrSpan_t aSpan(*pHint->GetStart(), *pHint->GetEnd());
o_rSpanMap.insert(AttrSpanMap_t::value_type(aSpan, pHint));
- if (aSpan.first != nLastEnd)
+ // < not != because there may be multiple CHARFMT at same range
+ if (nLastEnd < aSpan.first)
{
// insert dummy span covering the gap
o_rSpanMap.insert(AttrSpanMap_t::value_type(
diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx
index 0016a4ac45..934bde75cd 100755
--- a/sw/source/ui/ribbar/inputwin.cxx
+++ b/sw/source/ui/ribbar/inputwin.cxx
@@ -165,6 +165,7 @@ void SwInputWindow::CleanupUglyHackWithUndo()
{
SW_MOD()->GetUndoOptions().SetUndoCount(0);
}
+ m_bResetUndo = false; // #i117122# once is enough :)
}
}