summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-06-20 00:20:52 +0200
committerNoel Power <noel.power@suse.com>2013-06-20 14:11:43 +0000
commit5b3867f801dadc5c2c6346561e7d71990cd7eb33 (patch)
treeb86bfa93a7359303586b9701a6f48498d4d07aa8 /editeng
parent60d26eab97ec50a92f19994a3694f3f1d2d61038 (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 (cherry picked from commit fe444d1f74abe417962be0bcd3340f40f2446b58) Reviewed-on: https://gerrit.libreoffice.org/4393 Reviewed-by: Noel Power <noel.power@suse.com> Tested-by: Noel Power <noel.power@suse.com>
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 cf486af87c1d..046c4b392772 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -732,24 +732,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;