This commit is contained in:
@@ -1271,9 +1271,8 @@ namespace Volian.Controls.Library
|
||||
IDataObject myDO = Clipboard.GetDataObject();
|
||||
RichTextBox myRtb = _MyStepRTB;
|
||||
Control ctrl = FindActiveControl(); // null if on property page for procedure & section number/title
|
||||
if (ctrl == null) return;
|
||||
//Console.WriteLine("Paste myRTB == ctrl {0}", myRtb.Equals(ctrl));
|
||||
if (!_MyStepRTB.Focused)
|
||||
|
||||
if (ctrl != null && !_MyStepRTB.Focused)
|
||||
{
|
||||
if (ctrl is RichTextBox)
|
||||
{
|
||||
@@ -1298,35 +1297,35 @@ namespace Volian.Controls.Library
|
||||
return;
|
||||
}
|
||||
}
|
||||
//if (myDO.GetDataPresent(DataFormats.Rtf) && !_PastePlainTextOvrRide && !PastePlainTextSetting)
|
||||
// check if rtf is coming from Word, i.e. if it has 'SCHEMAS.MICROSOFT.COM/OFFICE/WORD'.
|
||||
// If it is coming from Word, it will be pasted as text so as not to get any rtf commands
|
||||
// that PROMS does not support such as odd Fonts, other symbols, etc. This isn't a complete
|
||||
// solution, clipboard data may come from other 3rd-party tools and unsupported Rtf may get
|
||||
// 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();
|
||||
tmpForLink = Regex.Replace(tmpForLink, @"#Link:ReferencedObject:[0-9]+ ", @"#Link:ReferencedObject:<NewID> ");
|
||||
tmpForLink = Regex.Replace(tmpForLink, @"#Link:Transition:([0-9]+) [0-9]+ ", @"#Link:Transition:$1 <NewID> ");
|
||||
tmpForLink = Regex.Replace(tmpForLink, @"#Link:TransitionRange:([0-9]+) [0-9]+ ", @"#Link:TransitionRange:$1 <NewID> ");
|
||||
tmpForLink = tmpForLink.Replace(@"\u8212 \'96", @"-"); // Replace EM Dash with hyphen
|
||||
tmpForLink = tmpForLink.Replace(@"\u8211 \'96", @"-"); // Replace EN Dash with hyphen
|
||||
tmpForLink = tmpForLink.Replace(@"\u8212 ", @"-"); // Replace EM Dash with hyphen
|
||||
tmpForLink = tmpForLink.Replace(@"\u8211 ", @"-"); // Replace EN Dash with hyphen
|
||||
myRtb.SelectedRtf = tmpForLink;
|
||||
if (tmpForLink.ToUpper().Contains(@"SCHEMAS.MICROSOFT.COM/OFFICE/WORD"))
|
||||
myRtb.SelectedText = _MyStepRTB.GetPasteText(PasteNoReturnsSetting, myDO);
|
||||
else
|
||||
{
|
||||
tmpForLink = Regex.Replace(tmpForLink, @"#Link:ReferencedObject:[0-9]+ ", @"#Link:ReferencedObject:<NewID> ");
|
||||
tmpForLink = Regex.Replace(tmpForLink, @"#Link:Transition:([0-9]+) [0-9]+ ", @"#Link:Transition:$1 <NewID> ");
|
||||
tmpForLink = Regex.Replace(tmpForLink, @"#Link:TransitionRange:([0-9]+) [0-9]+ ", @"#Link:TransitionRange:$1 <NewID> ");
|
||||
tmpForLink = tmpForLink.Replace(@"\u8212 \'96", @"-"); // Replace EM Dash with hyphen
|
||||
tmpForLink = tmpForLink.Replace(@"\u8211 \'96", @"-"); // Replace EN Dash with hyphen
|
||||
tmpForLink = tmpForLink.Replace(@"\u8212 ", @"-"); // Replace EM Dash with hyphen
|
||||
tmpForLink = tmpForLink.Replace(@"\u8211 ", @"-"); // Replace EN Dash with hyphen
|
||||
myRtb.SelectedRtf = tmpForLink;
|
||||
}
|
||||
|
||||
}
|
||||
else if (myDO.GetDataPresent(DataFormats.Text))
|
||||
{
|
||||
string ptext = myDO.GetData(DataFormats.Text).ToString();
|
||||
ptext = ptext.TrimEnd("\r\n\t ".ToCharArray());
|
||||
if (PasteNoReturnsSetting) ptext = ptext.Replace("\r\n", " ");
|
||||
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
|
||||
myRtb.SelectedText = ptext;
|
||||
//myRtb.SelectedText = myDO.GetData(DataFormats.Text).ToString();
|
||||
}
|
||||
myRtb.SelectedText = _MyStepRTB.GetPasteText(PasteNoReturnsSetting, myDO);
|
||||
if (myRtb.SelectionLength == 0 && myRtb is StepRTB) myRtb.SelectionFont = (myRtb as StepRTB).MyStyleFont.WindowsFont;
|
||||
_PastePlainTextOvrRide = false;
|
||||
_PasteStepTextOvrRide = false;
|
||||
}
|
||||
|
||||
private void SaveErrorInLogProblemWithType(Control ctrl)
|
||||
{
|
||||
StringBuilder errormsg = new StringBuilder(string.Format("Failed clipboard action with control {0} a {1} ", ctrl.Name, ctrl.GetType().Name));
|
||||
|
Reference in New Issue
Block a user