sw content controls: only try to insert placeholders if there is no selection
The logic is that in case there is no selection, we insert a placeholder like "type here", but if there is a selection, that can be a custom placeholder. Without this fix, we would hit an assertion failure on inserting content control when there is a selection, as the placeholder is empty and operator[](0) is not allowed for empty OUStrings. Change-Id: I8370b8d74415faf0e76dccb574aa29bea1947bb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134041 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -1050,9 +1050,12 @@ void SwWrtShell::InsertContentControl(SwContentControlType eType)
|
||||
break;
|
||||
}
|
||||
}
|
||||
Insert(aPlaceholder);
|
||||
Left(CRSR_SKIP_CHARS, /*bSelect=*/true, aPlaceholder.getLength(),
|
||||
/*bBasicCall=*/false);
|
||||
if (aPlaceholder.getLength())
|
||||
{
|
||||
Insert(aPlaceholder);
|
||||
Left(CRSR_SKIP_CHARS, /*bSelect=*/true, aPlaceholder.getLength(),
|
||||
/*bBasicCall=*/false);
|
||||
}
|
||||
SwFormatContentControl aContentControl(pContentControl, RES_TXTATR_CONTENTCONTROL);
|
||||
SetAttrItem(aContentControl);
|
||||
}
|
||||
|
Reference in New Issue
Block a user