This commit is contained in:
@@ -150,15 +150,9 @@ namespace Volian.Controls.Library
|
||||
text = text + (!_MyItemInfo.FormatStepData.Font.FontIsProportional() ? ReplaceLinesWithUnicode(_MyItemInfo.FormatStepData.Suffix) :
|
||||
@"\par\par\par ");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_MyItemInfo.FormatStepData.Prefix != null && _MyItemInfo.FormatStepData.Prefix != "")
|
||||
text = _MyItemInfo.FormatStepData.Prefix + text;
|
||||
if (_MyItemInfo.FormatStepData.Suffix != null && _MyItemInfo.FormatStepData.Suffix != "")
|
||||
text = text + _MyItemInfo.FormatStepData.Suffix;
|
||||
}
|
||||
}
|
||||
text = CreateRtf(colorLinks, text, tableShouldBeOutlined, wordsShouldBeReplaced, numbersShouldBeFormated, tableHasBorder, ROsShouldBeAdjusted);
|
||||
|
||||
StartText = text;
|
||||
}
|
||||
private string ReplaceLinesWithUnicode(string text)
|
||||
|
@@ -2172,13 +2172,31 @@ namespace Volian.Controls.Library
|
||||
|
||||
public string GetPasteText(bool PasteNoReturnsSetting, IDataObject myDO)
|
||||
{
|
||||
// allowable symbols are those symbols between 127-256 that the proms editor supports that
|
||||
// can be pasted from word as is. These symbols are (in the order they are in the following
|
||||
// string): degree, plus/minus, exponent 2, exponent 3, micro, quarter, half, divide:
|
||||
char[] allowableSymbols = { '\xb0', '\xb1', '\xb2', '\xb3', '\xb5', '\xbc', '\xbd', '\xf7' };
|
||||
string ptext = myDO.GetData(DataFormats.Text).ToString();
|
||||
ptext = ptext.TrimEnd("\r\n\t ".ToCharArray());
|
||||
if (PasteNoReturnsSetting) ptext = ptext.Replace("\r\n", " ");
|
||||
StringBuilder sb = new StringBuilder(ptext);
|
||||
bool didCharReplace = false;
|
||||
for (int i = 0; i < ptext.Length; i++)
|
||||
{
|
||||
// if allowable, allow for it to pasted. Otherwise, replace that character with a '?'.
|
||||
if ((sb[i] > 0x7e))
|
||||
if ((ptext.Substring(i, 1).IndexOfAny(allowableSymbols) < 0))
|
||||
{
|
||||
sb[i] = '?';
|
||||
didCharReplace = true;
|
||||
}
|
||||
}
|
||||
ptext = sb.ToString();
|
||||
ptext = ptext.Replace("\u2013", "-"); // Replace EN Dash with hyphen
|
||||
ptext = ptext.Replace("\u2014", "-"); // Replace EM Dash with hyphen
|
||||
ptext = ptext.Replace("\u2011", "-"); // Replace non-breaking hyphen with hyphen
|
||||
ptext = ptext.Replace((char)0xb7, '?'); // bullet comes in as a b7, which we don't support either
|
||||
if (didCharReplace)
|
||||
MessageBox.Show("Replacing pasted characters that are not supported by Proms with a '?'.");
|
||||
return ptext;
|
||||
}
|
||||
private void DoDeleteEndBetweenLinks()
|
||||
|
@@ -1307,7 +1307,7 @@ namespace Volian.Controls.Library
|
||||
// pasted in. But the hope is that this will happen less often than getting it from MS Word.
|
||||
if (myDO.GetDataPresent(DataFormats.Rtf) && (_PasteStepTextOvrRide || (!_PastePlainTextOvrRide && !PastePlainTextSetting)))
|
||||
{
|
||||
string tmpForLink = myDO.GetData(DataFormats.Rtf).ToString();
|
||||
string tmpForLink = myDO.GetData(DataFormats.Rtf).ToString().Replace("\r\n", "");
|
||||
if (tmpForLink.ToUpper().Contains(@"SCHEMAS.MICROSOFT.COM/OFFICE/WORD"))
|
||||
myRtb.SelectedText = _MyStepRTB.GetPasteText(PasteNoReturnsSetting, myDO);
|
||||
else
|
||||
|
Reference in New Issue
Block a user