Logic to pop RO Text into DSO Framer attachment at current cursor location

This commit is contained in:
John Jenko 2009-08-24 16:32:04 +00:00
parent eba37a8a10
commit 8115aa071d

View File

@ -15,6 +15,13 @@ namespace Volian.Controls.Library
public partial class DisplayRO : UserControl public partial class DisplayRO : UserControl
{ {
#region Properties #region Properties
private DisplayTabControl _TabControl;
public DisplayTabControl TabControl
{
get { return _TabControl; }
set { _TabControl = value; }
}
private ROFstInfo _CurROFST = null; private ROFstInfo _CurROFST = null;
private ROFstInfo _MyROFST; private ROFstInfo _MyROFST;
public ROFstInfo MyROFST public ROFstInfo MyROFST
@ -409,10 +416,25 @@ namespace Volian.Controls.Library
if (obj is ROFSTLookup.rochild) if (obj is ROFSTLookup.rochild)
{ {
ROFSTLookup.rochild roch = (ROFSTLookup.rochild)obj; 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 <SP1-A.1> 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:<NewID> {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; _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:<NewID> {0} {1}", roch.roid, _MyROFST.MyRODb.RODbID); string linktxt = string.Format(@"#Link:ReferencedObject:<NewID> {0} {1}", roch.roid, _MyROFST.MyRODb.RODbID);
// Resolve symbols and scientific notation in the RO return value // Resolve symbols and scientific notation in the RO return value
@ -423,14 +445,16 @@ namespace Volian.Controls.Library
} }
_MyRTB.inRoAdd = false; _MyRTB.inRoAdd = false;
} }
else // we're in an Word attachment //else // we're in an Word attachment
{ //{
string accPrefix = (roch.type == 8) ? _Mydvi.DocVersionConfig.RODefaults_graphicsprefix : _Mydvi.DocVersionConfig.RODefaults_setpointprefix; // string accPrefix = (roch.type == 8) ? _Mydvi.DocVersionConfig.RODefaults_graphicsprefix : _Mydvi.DocVersionConfig.RODefaults_setpointprefix;
string AccPageID = string.Format("<{0}-{1}>", accPrefix, roch.appid); // string AccPageID = string.Format("<{0}-{1}>", accPrefix, roch.appid);
//TODO: CAN WE AUTOMATICALLY PLACE RO ONTO WORD ATTACHEMNT? // //TODO: CAN WE AUTOMATICALLY PLACE RO ONTO WORD ATTACHEMNT?
if (MessageBox.Show(AccPageID,"Place on Windows Clipboard?",MessageBoxButtons.YesNo) == DialogResult.Yes) // //if (MessageBox.Show(AccPageID,"Place on Windows Clipboard?",MessageBoxButtons.YesNo) == DialogResult.Yes)
Clipboard.SetText(AccPageID); // // Clipboard.SetText(AccPageID);
} // if (dti.MyDSOTabPanel != null)
// dti.MyDSOTabPanel.InsertText(AccPageID);
//}
btnSaveRO.Enabled = btnCancelRO.Enabled = btnPreviewRO.Enabled = false; btnSaveRO.Enabled = btnCancelRO.Enabled = btnPreviewRO.Enabled = false;
_SavCurROLink = null; _SavCurROLink = null;
CurROLink = null; CurROLink = null;