B2015-001: single indent holds for entire steprtb.

B2015-001: print of single indent – handle soft return
This commit is contained in:
2015-09-28 13:40:58 +00:00
parent a8d2ba7181
commit 4f4af0156a
4 changed files with 336 additions and 322 deletions

View File

@@ -1626,13 +1626,27 @@ namespace Volian.Controls.Library
private void btnIndent_Click(object sender, EventArgs e)
{
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return;
// For now, use the button as a toggle, i.e. if indent is on - turn it off. If indent is off, use the current cursor location to
// turn it on. Later, we may want to allow for multiple indents using the DisplayTags panel.
if (_MyStepRTB.SelectionHangingIndent != 0)
// Use the button as a toggle, i.e. if indent is on - turn it off. If indent is off, use the current cursor
// location to turn it on.
// The print tool (iTextSharp) only supports 1 indent per paragraph, i.e. steprtb (that is also a table cell)
// so the user interface only allows for 1 indent. Note that soft returns maintain the hanging indent & hard
// returns do not maintain it for the FIRST line after the hard return, but any wrapping lines will indent to
// the hanging indent location.
// The following code sets the hanging indent for the entire rtb by selecting all. Without
// this multiple hanging indents could be done - but it didn't appear that way in the user
// interface since the button just toggled on/off.
int savIndent = _MyStepRTB.GetPositionFromCharIndex(_MyStepRTB.SelectionStart).X;
int selStart = _MyStepRTB.SelectionStart;
int selLength = _MyStepRTB.SelectionLength;
_MyStepRTB.SelectAll();
if (_MyStepRTB.SelectionHangingIndent != 0) // this is what does the 'toggle' indent off
_MyStepRTB.SelectionHangingIndent = 0;
else
_MyStepRTB.SelectionHangingIndent = _MyStepRTB.GetPositionFromCharIndex(_MyStepRTB.SelectionStart).X;
_MyStepRTB.SelectionHangingIndent = savIndent;
btnIndent.Checked = _MyStepRTB.SelectionHangingIndent != 0;
_MyStepRTB.SelectionStart = selStart;
_MyStepRTB.SelectionLength = selLength;
}
private void btnCMIndent_Click(object sender, EventArgs e)
{