summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/swtypes.hxx2
-rw-r--r--sw/source/core/doc/docfmt.cxx24
2 files changed, 26 insertions, 0 deletions
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index f5ba633310ab..d3c668818495 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -188,6 +188,8 @@ typedef sal_uInt16 SetAttrMode;
namespace nsSetAttrMode
{
const SetAttrMode SETATTR_DEFAULT = 0x0000; // Default.
+ /// @attention: DONTEXPAND does not work very well for CHARATR
+ /// because it can expand only the whole AUTOFMT or nothing
const SetAttrMode SETATTR_DONTEXPAND = 0x0001; // Don't expand text attribute any further.
const SetAttrMode SETATTR_DONTREPLACE = 0x0002; // Don't replace another text attribute.
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 748b5b28ca5b..c94b913f104a 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -2475,7 +2475,31 @@ void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet )
SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
}
+ xub_StrLen const nEnd(rPam.End()->nContent.GetIndex());
+ std::vector<sal_uInt16> whichIds;
+ SfxItemIter iter(rSet);
+ for (SfxPoolItem const* pItem = iter.FirstItem();
+ pItem; pItem = iter.NextItem())
+ {
+ whichIds.push_back(pItem->Which());
+ whichIds.push_back(pItem->Which());
+ }
+ whichIds.push_back(0);
+ SfxItemSet currentSet(GetAttrPool(), &whichIds[0]);
+ pTNd->GetAttr(currentSet, nEnd, nEnd, false, true, false);
+ for (size_t i = 0; whichIds[i]; i += 2)
+ { // yuk - want to explicitly set the pool defaults too :-/
+ currentSet.Put(currentSet.Get(whichIds[i], true));
+ }
+
InsertItemSet( rPam, rSet, nsSetAttrMode::SETATTR_DONTEXPAND );
+
+ // fdo#62536: DONTEXPAND does not work when there is already an AUTOFMT
+ // here, so insert the old attributes as an empty hint to stop expand
+ SwPaM endPam(*pTNd, nEnd);
+ endPam.SetMark();
+ InsertItemSet(endPam, currentSet, nsSetAttrMode::SETATTR_DEFAULT);
+
SetRedlineMode_intern( eOld );
}