summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-06-20 00:20:52 +0200
committerMichael Stahl <mstahl@redhat.com>2013-06-20 00:34:39 +0200
commitfe444d1f74abe417962be0bcd3340f40f2446b58 (patch)
tree5698d2b3f92c6e18779310f84ec6e94108d58203 /editeng
parent6db39dbd7378351f6476f6db25eb7110c9cfb291 (diff)
fdo#62536: sw: fix AutoCorrect bold/underline on existing AUTOFMT
With the native AUTOFMT in Writer the SETATTR_DONTEXPAND does no longer work reliably: if there is an existing AUTOFMT at the position then it will be modified and no new hint with DontExpand will be inserted. Work around this deficiency by inserting a no-length hint with the preivous formatting at the end of the range. (similar fix to the i#75891 problem in SwTextShell::InsertSymbol) (commit 062eaeffe7cb986255063bb9b0a5f3fb3fc8e34c did not introduce the problem but made it far more annoying) Change-Id: I58ece7f5bd5a786b22a066e5902f1784dafa5dce
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/misc/svxacorr.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index d1193851c790..883c1f13f9c7 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -762,24 +762,27 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const String&
if( STRING_NOTFOUND != nFndPos )
{
- // Span the Attribute over the area and delete the Character found at
+ // first delete the Character at the end - this allows insertion
+ // of an empty hint in SetAttr which would be removed by Delete
+ // (fdo#62536, AUTOFMT in Writer)
+ rDoc.Delete( nEndPos, nEndPos + 1 );
+ rDoc.Delete( nFndPos, nFndPos + 1 );
+ // Span the Attribute over the area
// the end.
if( '*' == cInsChar ) // Bold
{
SvxWeightItem aSvxWeightItem( WEIGHT_BOLD, SID_ATTR_CHAR_WEIGHT );
- rDoc.SetAttr( nFndPos + 1, nEndPos,
+ rDoc.SetAttr( nFndPos, nEndPos - 1,
SID_ATTR_CHAR_WEIGHT,
aSvxWeightItem);
}
else // underline
{
SvxUnderlineItem aSvxUnderlineItem( UNDERLINE_SINGLE, SID_ATTR_CHAR_UNDERLINE );
- rDoc.SetAttr( nFndPos + 1, nEndPos,
+ rDoc.SetAttr( nFndPos, nEndPos - 1,
SID_ATTR_CHAR_UNDERLINE,
aSvxUnderlineItem);
}
- rDoc.Delete( nEndPos, nEndPos + 1 );
- rDoc.Delete( nFndPos, nFndPos + 1 );
}
return STRING_NOTFOUND != nFndPos;