summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/txtnode')
-rw-r--r--sw/source/core/txtnode/atrfld.cxx13
-rw-r--r--sw/source/core/txtnode/fntcache.cxx178
-rw-r--r--sw/source/core/txtnode/ndhints.cxx16
-rw-r--r--sw/source/core/txtnode/thints.cxx304
4 files changed, 262 insertions, 249 deletions
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 3ddd3189bf6c..4ad6c773db1d 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -157,14 +157,16 @@ void SwFmtFld::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
if( !pTxtAttr )
return;
+ // don't do anything, especially not expand!
+ if( pNew && pNew->Which() == RES_OBJECTDYING )
+ return;
+
SwTxtNode* pTxtNd = (SwTxtNode*)&pTxtAttr->GetTxtNode();
ASSERT( pTxtNd, "wo ist denn mein Node?" );
if( pNew )
{
switch( pNew->Which() )
{
- case RES_OBJECTDYING:
- return; // don't do anything, especially not expand!
case RES_TXTATR_FLDCHG:
// "Farbe hat sich geaendert !"
// this, this fuer "nur Painten"
@@ -189,6 +191,8 @@ void SwFmtFld::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
case RES_FMT_CHG:
pTxtNd->Modify( pOld, pNew );
return;
+ default:
+ break;
}
}
@@ -265,6 +269,11 @@ SwTxtFld::SwTxtFld( SwFmtFld& rAttr, xub_StrLen nStartPos )
SwTxtFld::~SwTxtFld( )
{
+ SwFmtFld & rFmtFld( static_cast<SwFmtFld &>(GetAttr()) );
+ if (this == rFmtFld.pTxtAttr)
+ {
+ rFmtFld.pTxtAttr = 0; // #i110140# invalidate!
+ }
}
/*************************************************************************
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 7b08a0cb87e4..ff79d2266ba7 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -444,8 +444,6 @@ USHORT SwFntObj::GetFontLeading( const ViewShell *pSh, const OutputDevice& rOut
void SwFntObj::CreateScrFont( const ViewShell& rSh, const OutputDevice& rOut )
{
-static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring";
-
if ( pScrFont )
return;
@@ -481,6 +479,10 @@ static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring";
pScrFont = pPrtFont;
FontMetric aMet = pPrt->GetFontMetric( );
+ //Don't loose "faked" properties of the logical font that don't truly
+ //exist in the physical font metrics which vcl which fake up for us
+ aMet.SetWeight(pScrFont->GetWeight());
+ aMet.SetItalic(pScrFont->GetItalic());
bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet();
@@ -490,178 +492,6 @@ static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring";
if ( USHRT_MAX == nExtLeading )
nExtLeading = static_cast<USHORT>(aMet.GetExtLeading());
-#if OSL_DEBUG_LEVEL > 1
- const XubString aDbgTxt1( pPrtFont->GetName() );
- const XubString aDbgTxt2( aMet.GetName() );
-#endif
-
- if ( aMet.IsDeviceFont( ) )
- {
- if ( (RTL_TEXTENCODING_DONTKNOW == pPrtFont->GetCharSet() ||
- FAMILY_DONTKNOW == pPrtFont->GetFamily() ||
- PITCH_DONTKNOW == pPrtFont->GetPitch() ) &&
- (RTL_TEXTENCODING_DONTKNOW == aMet.GetCharSet() ||
- FAMILY_DONTKNOW == aMet.GetFamily() ||
- PITCH_DONTKNOW == aMet.GetPitch() ) )
- {
- // Das folgende ist teuer, aber selten: ein unbekannter Font
- // kann vom Drucker nicht vernuenftig zugeordnet werden. Dann
- // nehmen wir eben das Mapping des Bildschirms in Anspruch und
- // setzen den Familyname, Charset und Pitch wie dort. Dieser
- // Font wird nun nochmals auf dem Drucker eingestellt.
- Font aFnt1 = pOut->GetFontMetric();
- Font aFnt2( *pPrtFont );
-
- if (RTL_TEXTENCODING_DONTKNOW == pPrtFont->GetCharSet())
- aFnt2.SetCharSet( aFnt1.GetCharSet() );
- if (FAMILY_DONTKNOW == pPrtFont->GetFamily())
- aFnt2.SetFamily( aFnt1.GetFamily() );
- if (PITCH_DONTKNOW == pPrtFont->GetPitch())
- aFnt2.SetPitch( aFnt1.GetPitch() );
-
- pPrt->SetFont( aFnt2 );
- aMet = pPrt->GetFontMetric( );
- }
-
- const XubString aStandardStr( sStandardString,
- RTL_TEXTENCODING_MS_1252 );
-
- // This is the reference width
- const long nOWidth = pPrt->GetTextWidth( aStandardStr );
-
- // Let's have a look what's the difference to the width
- // calculated for the output device using the font set at the
- // reference device
- long nSWidth = nOWidth - pOut->GetTextWidth( aStandardStr );
- nScrHeight = (USHORT) pOut->GetTextHeight();
-
- // Um Aerger mit dem Generic Printer aus dem Wege zu gehen.
- if( aMet.GetSize().Height() )
- {
- BOOL bScrSymbol = FALSE;
- CharSet ePrtChSet = aMet.GetCharSet();
- // NoSymbol bedeutet, dass der Drucker sich fuer einen
- // Nicht-Symbol-Font entschieden hat.
- BOOL bNoSymbol = ( RTL_TEXTENCODING_DONTKNOW != ePrtChSet &&
- RTL_TEXTENCODING_SYMBOL != ePrtChSet );
- if ( bNoSymbol )
- bScrSymbol = RTL_TEXTENCODING_SYMBOL ==
- pOut->GetFontMetric().GetCharSet();
- Size aTmp( aMet.GetSize() );
-
- if( aTmp.Width() && !pPrtFont->GetSize().Width() )
- {
- aTmp.Width() = 0;
- aMet.SetSize( aTmp );
- }
-
- // Now we set the metrics used at the reference device at the
- // output device
- pOut->SetFont( aMet );
-
- if( bNoSymbol && ( bScrSymbol != ( RTL_TEXTENCODING_SYMBOL ==
- pOut->GetFontMetric().GetCharSet() ) ) )
- {
- // Hier landen wir, wenn der Drucker keinen Symbolfont waehlt,
- // aber genau einer der beiden Screenfonts ein Symbolfont ist.
- // Wir nehmen dann eben den anderen.
- if ( bScrSymbol )
- pScrFont = new Font( aMet ); // mit Abgleich
- else
- pOut->SetFont( *pPrtFont ); // ohne Abgleich
- }
- else
- {
- // Let's have a look what's the difference to the width
- // calculated for the output device using the metrics set at
- // the reference device
- long nPWidth = nOWidth - pOut->GetTextWidth( aStandardStr );
-
- // We prefer smaller fonts
- BYTE nNeg = 0;
- if ( nSWidth<0 ) { nSWidth *= -2; nNeg = 1; }
- if ( nPWidth<0 ) { nPWidth *= -2; nNeg |= 2; }
-
- // nSWidth = Difference between string width on reference device
- // and string width on output device with user font set.
- // nPWidth = Difference between string width on reference device
- // and string width on output device with metric obtained
- // from reference device.
- // We prefer to take the font with the smaller deviation,
- // exception: keep the original font unless the deviation
- // is really bad (at least 3%)
- // Since the test string is neither localized nor has a high resemblance
- // of the "real text for this font" a higher deviation is reasonable
-
- if ( (nSWidth <= nPWidth)
- || (nSWidth * 32 <= nOWidth ) )
- {
- // No adjustment, we take the same font for the output
- // device like for the reference device
- pOut->SetFont( *pPrtFont );
- pScrFont = pPrtFont;
- nPWidth = nSWidth;
- nNeg &= 1;
- }
- else
- {
- // The metrics give a better result. So we build
- // a new font for the output device based on the
- // metrics used at the reference device
- pScrFont = new Font( aMet ); // mit Abgleich
- nSWidth = nPWidth;
- nNeg &= 2;
- }
-
- //
- // now pScrFont is set to the better font and this should
- // be set at the output device
- //
-
- // we still have to check if the choosed font is not to wide
- if( nNeg && nOWidth )
- {
- nPWidth *= 100;
- nPWidth /= nOWidth;
-
- // if the screen font is too wide, we try to reduce
- // the font height and get a smaller one
- if( nPWidth > 25 )
- {
- if( nPWidth > 80 )
- nPWidth = 80;
- nPWidth = 100 - nPWidth/4;
- Size aTmpSize = pScrFont->GetSize();
- aTmpSize.Height() *= nPWidth;
- aTmpSize.Height() /= 100;
- if( aTmpSize.Width() )
- {
- aTmpSize.Width() *= nPWidth;
- aTmpSize.Width() /= 100;
- }
- Font *pNew = new Font( *pScrFont );
- pNew->SetSize( aTmpSize );
- pOut->SetFont( *pNew );
- nPWidth = nOWidth -
- pOut->GetTextWidth( aStandardStr );
- if( nPWidth < 0 ) { nPWidth *= -2; }
- if( nPWidth < nSWidth )
- {
- if( pScrFont != pPrtFont )
- delete pScrFont;
- pScrFont = pNew;
- }
- else
- {
- delete pNew;
- pOut->SetFont( *pScrFont );
- }
- }
- }
- }
- }
- }
-
// reset the original reference device font
pPrt->SetFont( aOldPrtFnt );
}
diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx
index 0cdf431ca2e6..c4c78fd6d59d 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -367,7 +367,7 @@ bool SwpHintsArray::Check() const
CHECK_ERR( !isCHRATR(nWhich),
"HintsCheck: Character attribute in end array" );
- // 8) portion check
+ // 8) style portion check
#if OSL_DEBUG_LEVEL > 1
const SwTxtAttr* pHtThis = m_HintStarts[i];
const SwTxtAttr* pHtLast = i > 0 ? m_HintStarts[i-1] : 0;
@@ -375,11 +375,19 @@ bool SwpHintsArray::Check() const
( RES_TXTATR_CHARFMT != pHtLast->Which() && RES_TXTATR_AUTOFMT != pHtLast->Which() ) ||
( RES_TXTATR_CHARFMT != pHtThis->Which() && RES_TXTATR_AUTOFMT != pHtThis->Which() ) ||
( *pHtThis->GetStart() >= *pHtLast->GetEnd() ) ||
- ( *pHtThis->GetStart() == *pHtLast->GetStart() && *pHtThis->GetEnd() == *pHtLast->GetEnd() ) ||
- ( *pHtThis->GetStart() == *pHtThis->GetEnd() ),
+ ( ( ( (*pHtThis->GetStart() == *pHtLast->GetStart())
+ && (*pHtThis->GetEnd() == *pHtLast->GetEnd())
+ ) // same range
+ || (*pHtThis->GetStart() == *pHtThis->GetEnd())
+ )
+ && ( (pHtThis->Which() != RES_TXTATR_AUTOFMT)
+ || (pHtLast->Which() != RES_TXTATR_AUTOFMT)
+ ) // never two AUTOFMT on same range
+ ),
"HintsCheck: Portion inconsistency. "
"This can be temporarily ok during undo operations" );
+ // 9) nesting portion check
if (pHtThis->IsNesting())
{
for ( USHORT j = 0; j < Count(); ++j )
@@ -397,7 +405,7 @@ bool SwpHintsArray::Check() const
}
}
- // 9) dummy char check (unfortunately cannot check SwTxtNode::m_Text)
+ // 10) dummy char check (unfortunately cannot check SwTxtNode::m_Text)
if (pHtThis->HasDummyChar())
{
for ( USHORT j = 0; j < i; ++j )
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index a2e326777383..ff2a40cdd9eb 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -773,7 +773,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint,
// For each attribute in the automatic style check if it
// is also set the the new character style:
- SfxItemSet aNewSet( *pOldStyle->GetPool(), RES_CHRATR_BEGIN, RES_CHRATR_END );
+ SfxItemSet aNewSet( *pOldStyle->GetPool(),
+ aCharAutoFmtSetRange);
SfxItemIter aItemIter( *pOldStyle );
const SfxPoolItem* pItem = aItemIter.GetCurItem();
while( TRUE )
@@ -2059,25 +2060,202 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
return rSet.Count() ? TRUE : FALSE;
}
-int lcl_IsNewAttrInSet( const SwpHints& rHints, const SfxPoolItem& rItem,
- const xub_StrLen nEnd )
+
+namespace
+{
+
+typedef std::pair<USHORT, USHORT> AttrSpan_t;
+typedef std::multimap<AttrSpan_t, const SwTxtAttr*> AttrSpanMap_t;
+
+
+struct IsAutoStyle
{
- int bIns = TRUE;
- for( USHORT i = 0; i < rHints.Count(); ++i )
+ bool
+ operator()(const AttrSpanMap_t::value_type& i_rAttrSpan)
+ const
{
- const SwTxtAttr *pOther = rHints[ i ];
- if( *pOther->GetStart() )
- break;
+ return i_rAttrSpan.second && i_rAttrSpan.second->Which() == RES_TXTATR_AUTOFMT;
+ }
+};
+
+
+/** Removes from io_rAttrSet all items that are set by style on the
+ given span.
+ */
+struct RemovePresentAttrs
+{
+ RemovePresentAttrs(SfxItemSet& io_rAttrSet)
+ : m_rAttrSet(io_rAttrSet)
+ {
+ }
+
+ void
+ operator()(const AttrSpanMap_t::value_type& i_rAttrSpan)
+ const
+ {
+ if (!i_rAttrSpan.second)
+ {
+ return;
+ }
- if( pOther->GetEnd() &&
- *pOther->GetEnd() == nEnd &&
- ( pOther->IsCharFmtAttr() || pOther->Which() == rItem.Which() ) )
+ const SwTxtAttr* const pAutoStyle(i_rAttrSpan.second);
+ SfxItemIter aIter(m_rAttrSet);
+ const SfxPoolItem* pItem(aIter.GetCurItem());
+ while (true)
+ {
+ const USHORT nWhich(pItem->Which());
+ if (CharFmt::IsItemIncluded(nWhich, pAutoStyle))
+ {
+ m_rAttrSet.ClearItem(nWhich);
+ }
+
+ if (aIter.IsAtEnd())
+ {
+ break;
+ }
+ pItem = aIter.NextItem();
+ }
+ }
+
+private:
+ SfxItemSet& m_rAttrSet;
+};
+
+
+/** Collects all style-covered spans from i_rHints to o_rSpanMap. In
+ addition inserts dummy spans with pointer to format equal to 0 for
+ all gaps (i.e. spans not covered by any style). This simplifies
+ creation of autostyles for all needed spans, but it means all code
+ that tries to access the pointer has to check if it's non-null!
+ */
+void
+lcl_CollectHintSpans(const SwpHints& i_rHints, const USHORT nLength,
+ AttrSpanMap_t& o_rSpanMap)
+{
+ USHORT nLastEnd(0);
+
+ for (USHORT i(0); i != i_rHints.Count(); ++i)
+ {
+ const SwTxtAttr* const pHint(i_rHints[i]);
+ const USHORT nWhich(pHint->Which());
+ if (nWhich == RES_TXTATR_CHARFMT || nWhich == RES_TXTATR_AUTOFMT)
+ {
+ const AttrSpan_t aSpan(*pHint->GetStart(), *pHint->GetEnd());
+ o_rSpanMap.insert(AttrSpanMap_t::value_type(aSpan, pHint));
+
+ if (aSpan.first != nLastEnd)
+ {
+ // insert dummy span covering the gap
+ o_rSpanMap.insert(AttrSpanMap_t::value_type(
+ AttrSpan_t(nLastEnd, aSpan.first), 0));
+ }
+
+ nLastEnd = aSpan.second;
+ }
+ }
+
+ // no hints at the end (special case: no hints at all in i_rHints)
+ if (nLastEnd != nLength && nLength != 0)
+ {
+ o_rSpanMap.insert(
+ AttrSpanMap_t::value_type(AttrSpan_t(nLastEnd, nLength), 0));
+ }
+}
+
+
+void
+lcl_FillWhichIds(const SfxItemSet& i_rAttrSet, std::vector<USHORT>& o_rClearIds)
+{
+ o_rClearIds.reserve(i_rAttrSet.Count());
+ SfxItemIter aIter(i_rAttrSet);
+ const SfxPoolItem* pItem(aIter.GetCurItem());
+ while (true)
+ {
+ o_rClearIds.push_back(pItem->Which());
+
+ if (aIter.IsAtEnd())
{
- bIns = FALSE;
break;
}
+ pItem = aIter.NextItem();
+ }
+}
+
+struct SfxItemSetClearer
+{
+ SfxItemSet & m_rItemSet;
+ SfxItemSetClearer(SfxItemSet & rItemSet) : m_rItemSet(rItemSet) { }
+ void operator()(USHORT const nWhich) { m_rItemSet.ClearItem(nWhich); }
+};
+
+}
+
+
+/** Does the hard work of SwTxtNode::FmtToTxtAttr: the real conversion
+ of items to automatic styles.
+ */
+void
+SwTxtNode::impl_FmtToTxtAttr(const SfxItemSet& i_rAttrSet)
+{
+ typedef AttrSpanMap_t::iterator AttrSpanMap_iterator_t;
+ AttrSpanMap_t aAttrSpanMap;
+
+ if (i_rAttrSet.Count() == 0)
+ {
+ return;
+ }
+
+ // 1. Identify all spans in hints' array
+
+ lcl_CollectHintSpans(*m_pSwpHints, m_Text.Len(), aAttrSpanMap);
+
+ // 2. Go through all spans and insert new attrs
+
+ AttrSpanMap_iterator_t aCurRange(aAttrSpanMap.begin());
+ const AttrSpanMap_iterator_t aEnd(aAttrSpanMap.end());
+ while (aCurRange != aEnd)
+ {
+ typedef std::pair<AttrSpanMap_iterator_t, AttrSpanMap_iterator_t>
+ AttrSpanMapRange_t;
+ AttrSpanMapRange_t aRange(aAttrSpanMap.equal_range(aCurRange->first));
+
+ // 2a. Collect attributes to insert
+
+ SfxItemSet aCurSet(i_rAttrSet);
+ std::for_each(aRange.first, aRange.second, RemovePresentAttrs(aCurSet));
+
+ // 2b. Insert automatic style containing the collected attributes
+
+ if (aCurSet.Count() != 0)
+ {
+ AttrSpanMap_iterator_t aAutoStyleIt(
+ std::find_if(aRange.first, aRange.second, IsAutoStyle()));
+ if (aAutoStyleIt != aRange.second)
+ {
+ // there already is an automatic style on that span:
+ // create new one and remove the original one
+ SwTxtAttr* const pAutoStyle(const_cast<SwTxtAttr*>(aAutoStyleIt->second));
+ const boost::shared_ptr<SfxItemSet> pOldStyle(
+ static_cast<const SwFmtAutoFmt&>(
+ pAutoStyle->GetAttr()).GetStyleHandle());
+ aCurSet.Put(*pOldStyle);
+
+ // remove the old hint
+ m_pSwpHints->Delete(pAutoStyle);
+ DestroyAttr(pAutoStyle);
+ }
+ m_pSwpHints->Insert(
+ MakeTxtAttr(*GetDoc(), aCurSet,
+ aCurRange->first.first, aCurRange->first.second));
+ }
+
+ aCurRange = aRange.second;
}
- return bIns;
+
+ // 3. Clear items from the node
+ std::vector<USHORT> aClearedIds;
+ lcl_FillWhichIds(i_rAttrSet, aClearedIds);
+ ClearItemsFromAttrSet(aClearedIds);
}
void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
@@ -2090,91 +2268,79 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
if( pNd == this )
{
- if( aThisSet.Count() )
- {
- SfxItemIter aIter( aThisSet );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- std::vector<USHORT> aClearWhichIds;
-
- while ( true )
- {
- if (lcl_IsNewAttrInSet( *m_pSwpHints, *pItem, GetTxt().Len() ))
- {
- m_pSwpHints->SwpHintsArray::Insert(
- MakeTxtAttr( *GetDoc(),
- const_cast<SfxPoolItem&>(*pItem),
- 0, GetTxt().Len() ) );
- aClearWhichIds.push_back( pItem->Which() );
- }
-
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
- }
-
- ClearItemsFromAttrSet( aClearWhichIds );
- }
+ impl_FmtToTxtAttr(aThisSet);
}
else
{
+ // There are five possible combinations of items from this and
+ // pNd (pNd is the 'main' node):
+ //
+ // case pNd this action
+ // ----------------------------------------------------
+ // 1 - - do nothing
+ // 2 - a convert item to attr of this
+ // 3 a - convert item to attr of pNd
+ // 4 a a clear item in this
+ // 5 a b convert item to attr of this
+
SfxItemSet aNdSet( pNd->GetDoc()->GetAttrPool(), aCharFmtSetRange );
if( pNd->HasSwAttrSet() && pNd->GetpSwAttrSet()->Count() )
aNdSet.Put( *pNd->GetpSwAttrSet() );
pNd->GetOrCreateSwpHints();
+ std::vector<USHORT> aProcessedIds;
+
if( aThisSet.Count() )
{
SfxItemIter aIter( aThisSet );
- const SfxPoolItem* pItem = aIter.GetCurItem(), *pNdItem;
+ const SfxPoolItem* pItem = aIter.GetCurItem(), *pNdItem = 0;
+ SfxItemSet aConvertSet( GetDoc()->GetAttrPool(), aCharFmtSetRange );
std::vector<USHORT> aClearWhichIds;
- while( TRUE )
+ while( true )
{
- if( ( SFX_ITEM_SET != aNdSet.GetItemState( pItem->Which(), FALSE,
- &pNdItem ) || *pItem != *pNdItem ) &&
- lcl_IsNewAttrInSet( *m_pSwpHints, *pItem, GetTxt().Len() ) )
+ if( SFX_ITEM_SET == aNdSet.GetItemState( pItem->Which(), FALSE, &pNdItem ) )
{
- m_pSwpHints->SwpHintsArray::Insert( MakeTxtAttr( *GetDoc(),
- const_cast<SfxPoolItem&>(*pItem),
- 0, GetTxt().Len() ) );
- aClearWhichIds.push_back( pItem->Which() );
+ if (*pItem == *pNdItem) // 4
+ {
+ aClearWhichIds.push_back( pItem->Which() );
+ }
+ else // 5
+ {
+ aConvertSet.Put(*pItem);
+ }
+ aProcessedIds.push_back(pItem->Which());
+ }
+ else // 2
+ {
+ aConvertSet.Put(*pItem);
}
- aNdSet.ClearItem( pItem->Which() );
if( aIter.IsAtEnd() )
break;
pItem = aIter.NextItem();
}
+
+ // 4/ clear items of this that are set with the same value on pNd
ClearItemsFromAttrSet( aClearWhichIds );
+
+ // 2, 5/ convert all other items to attrs
+ impl_FmtToTxtAttr(aConvertSet);
}
- if( aNdSet.Count() )
{
- SfxItemIter aIter( aNdSet );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- std::vector<USHORT> aClearWhichIds;
+ std::for_each(aProcessedIds.begin(), aProcessedIds.end(),
+ SfxItemSetClearer(aNdSet));
- while ( true )
- {
- if ( lcl_IsNewAttrInSet( *pNd->m_pSwpHints, *pItem,
- pNd->GetTxt().Len() ) )
- {
- pNd->m_pSwpHints->SwpHintsArray::Insert(
- MakeTxtAttr( *pNd->GetDoc(),
- const_cast<SfxPoolItem&>(*pItem),
- 0, pNd->GetTxt().Len() ) );
- }
- aClearWhichIds.push_back( pItem->Which() );
+ // 3/ convert items to attrs
+ pNd->impl_FmtToTxtAttr(aNdSet);
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
+ if( aNdSet.Count() )
+ {
+ SwFmtChg aTmp1( pNd->GetFmtColl() );
+ pNd->SwModify::Modify( &aTmp1, &aTmp1 );
}
-
- pNd->ClearItemsFromAttrSet( aClearWhichIds );
- SwFmtChg aTmp1( pNd->GetFmtColl() );
- pNd->SwModify::Modify( &aTmp1, &aTmp1 );
}
}