diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index 27171c7c..dc9f1f76 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -15,6 +15,13 @@ namespace Volian.Controls.Library public partial class DisplayRO : UserControl { #region Properties + private DisplayTabControl _TabControl; + + public DisplayTabControl TabControl + { + get { return _TabControl; } + set { _TabControl = value; } + } private ROFstInfo _CurROFST = null; private ROFstInfo _MyROFST; public ROFstInfo MyROFST @@ -409,10 +416,25 @@ namespace Volian.Controls.Library if (obj is ROFSTLookup.rochild) { ROFSTLookup.rochild roch = (ROFSTLookup.rochild)obj; - if (_MyRTB != null) // if null, it's Word attachment + DisplayTabItem dti = _TabControl.SelectedDisplayTabItem; //.OpenItem(_ItemInfo); // open the corresponding procedure text + if (dti.MyDSOTabPanel != null) // A Word Document tab is the active tab + { + string accPrefix = (roch.type == 8) ? _Mydvi.DocVersionConfig.RODefaults_graphicsprefix : _Mydvi.DocVersionConfig.RODefaults_setpointprefix; + string AccPageID = string.Format("<{0}-{1}>", accPrefix, roch.appid);// makes for example + //string AccPageID = string.Format("{0} <{1}-{2}>", ConvertSymbolsAndStuff(selectedChld.value), accPrefix, roch.appid); // value and accesory ID + //string AccPageID = string.Format("{0} {1}", ConvertSymbolsAndStuff(selectedChld.value), string.Format(@"#Link:ReferencedObject: {0} {1}", roch.roid, _MyROFST.MyRODb.RODbID)); // value and link reference + //if (MessageBox.Show(AccPageID,"Place on Windows Clipboard?",MessageBoxButtons.YesNo) == DialogResult.Yes) + // Clipboard.SetText(AccPageID); + + // Insert the RO text at the current cursor position in the word document + // NOTE: assuming any type of RO can be put in an Accessory (MSWord) Document + if (dti.MyDSOTabPanel != null) + dti.MyDSOTabPanel.InsertText(AccPageID); + } + else if (_MyRTB != null) // a Procedure Steps section tab is active { _MyRTB.inRoAdd = true; - if (CheckROSelection(roch)) + if (CheckROSelection(roch)) // check for RO type is valid for this type of step/substep { string linktxt = string.Format(@"#Link:ReferencedObject: {0} {1}", roch.roid, _MyROFST.MyRODb.RODbID); // Resolve symbols and scientific notation in the RO return value @@ -423,14 +445,16 @@ namespace Volian.Controls.Library } _MyRTB.inRoAdd = false; } - else // we're in an Word attachment - { - string accPrefix = (roch.type == 8) ? _Mydvi.DocVersionConfig.RODefaults_graphicsprefix : _Mydvi.DocVersionConfig.RODefaults_setpointprefix; - string AccPageID = string.Format("<{0}-{1}>", accPrefix, roch.appid); - //TODO: CAN WE AUTOMATICALLY PLACE RO ONTO WORD ATTACHEMNT? - if (MessageBox.Show(AccPageID,"Place on Windows Clipboard?",MessageBoxButtons.YesNo) == DialogResult.Yes) - Clipboard.SetText(AccPageID); - } + //else // we're in an Word attachment + //{ + // string accPrefix = (roch.type == 8) ? _Mydvi.DocVersionConfig.RODefaults_graphicsprefix : _Mydvi.DocVersionConfig.RODefaults_setpointprefix; + // string AccPageID = string.Format("<{0}-{1}>", accPrefix, roch.appid); + // //TODO: CAN WE AUTOMATICALLY PLACE RO ONTO WORD ATTACHEMNT? + // //if (MessageBox.Show(AccPageID,"Place on Windows Clipboard?",MessageBoxButtons.YesNo) == DialogResult.Yes) + // // Clipboard.SetText(AccPageID); + // if (dti.MyDSOTabPanel != null) + // dti.MyDSOTabPanel.InsertText(AccPageID); + //} btnSaveRO.Enabled = btnCancelRO.Enabled = btnPreviewRO.Enabled = false; _SavCurROLink = null; CurROLink = null;