C2016-044: Find RO values from selected Word section text

This commit is contained in:
Kathy Ruffing 2017-01-26 12:29:06 +00:00
parent e6c65b5139
commit 90834bf875
4 changed files with 92 additions and 31 deletions

View File

@ -3188,11 +3188,13 @@ namespace VEPROMS
// Not sure why , but tc_Leave was being called over and over again.
//KBR:TmrSetTransROInVisible.Enabled = true;
}
displayRO.SetFindDocROButton(false);
}
else
{
SelectedDVI = args.MyItemInfo.MyDocVersion;
displayRO.ROTypeFilter = E_ROValueType.All; // allow all RO types for Word attachments (but fix)
displayRO.SetFindDocROButton(true);
}
}
if (ctrlAnnotationDetails.Enabled && epAnnotations.Enabled)

View File

@ -319,6 +319,16 @@ namespace Volian.Controls.Library
sel.Text = txt;
}
public string GetSelectedString()
{
LBDocumentClass wordDoc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
//This will get the selected range or just the current cursor position
LBSelection sel = wordDoc.Application.Selection;
// if the start & end are the same, nothing is selected:
if (sel.Start == sel.End) return null;
return sel.Text;
}
private string ShowException(Exception ex)
{
string sep = "\r\n ";

View File

@ -38,6 +38,7 @@ namespace Volian.Controls.Library
this.btnPreviewRO = new DevComponents.DotNetBar.ButtonX();
this.btnCancelRO = new DevComponents.DotNetBar.ButtonX();
this.btnSaveRO = new DevComponents.DotNetBar.ButtonX();
this.btnFindDocRO = new DevComponents.DotNetBar.ButtonX();
this.panelRoValue = new System.Windows.Forms.Panel();
this.tbROValue = new DevComponents.DotNetBar.Controls.TextBoxX();
this.lblROValue = new DevComponents.DotNetBar.LabelX();
@ -52,14 +53,14 @@ namespace Volian.Controls.Library
//
this.tvROFST.Dock = System.Windows.Forms.DockStyle.Fill;
this.tvROFST.HideSelection = false;
this.tvROFST.Location = new System.Drawing.Point(0, 180);
this.tvROFST.Location = new System.Drawing.Point(0, 248);
this.tvROFST.Margin = new System.Windows.Forms.Padding(4);
this.tvROFST.Name = "tvROFST";
this.tvROFST.Size = new System.Drawing.Size(311, 444);
this.tvROFST.Size = new System.Drawing.Size(311, 376);
this.tvROFST.TabIndex = 5;
this.tvROFST.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvROFST_BeforeExpand);
this.tvROFST.DoubleClick += new System.EventHandler(this.tvROFST_DoubleClick);
this.tvROFST.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvROFST_AfterSelect);
this.tvROFST.DoubleClick += new System.EventHandler(this.tvROFST_DoubleClick);
//
// panelValue
//
@ -79,16 +80,15 @@ namespace Volian.Controls.Library
//
//
//
this.lbROId.BackgroundStyle.Class = "";
this.lbROId.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lbROId.Dock = System.Windows.Forms.DockStyle.Left;
this.lbROId.ForeColor = System.Drawing.SystemColors.Highlight;
this.lbROId.Location = new System.Drawing.Point(61, 27);
this.lbROId.Location = new System.Drawing.Point(61, 30);
this.lbROId.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.lbROId.Name = "lbROId";
this.lbROId.Size = new System.Drawing.Size(244, 64);
this.lbROId.Size = new System.Drawing.Size(244, 40);
this.superTooltip1.SetSuperTooltip(this.lbROId, new DevComponents.DotNetBar.SuperTooltipInfo("RO ID", "", "The RO ID for the selected RO Value will be displayed here. Double-Click to open" +
" the RO Editor.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80)));
" the RO Editor.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80)));
this.lbROId.TabIndex = 11;
this.lbROId.DoubleClick += new System.EventHandler(this.lbROId_DoubleClick);
//
@ -97,13 +97,12 @@ namespace Volian.Controls.Library
//
//
//
this.lblROID.BackgroundStyle.Class = "";
this.lblROID.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lblROID.Dock = System.Windows.Forms.DockStyle.Left;
this.lblROID.Location = new System.Drawing.Point(0, 27);
this.lblROID.Location = new System.Drawing.Point(0, 30);
this.lblROID.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.lblROID.Name = "lblROID";
this.lblROID.Size = new System.Drawing.Size(61, 64);
this.lblROID.Size = new System.Drawing.Size(61, 40);
this.superTooltip1.SetSuperTooltip(this.lblROID, new DevComponents.DotNetBar.SuperTooltipInfo("RO ID", "", "The RO ID for the selected RO Value will be displayed here.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80)));
this.lblROID.TabIndex = 10;
this.lblROID.Text = "RO ID:";
@ -111,25 +110,25 @@ namespace Volian.Controls.Library
//
// pnlROButtons
//
this.pnlROButtons.Controls.Add(this.btnFindDocRO);
this.pnlROButtons.Controls.Add(this.btnGoToRO);
this.pnlROButtons.Controls.Add(this.btnPreviewRO);
this.pnlROButtons.Controls.Add(this.btnCancelRO);
this.pnlROButtons.Controls.Add(this.btnSaveRO);
this.pnlROButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlROButtons.Location = new System.Drawing.Point(0, 91);
this.pnlROButtons.Location = new System.Drawing.Point(0, 70);
this.pnlROButtons.Margin = new System.Windows.Forms.Padding(4);
this.pnlROButtons.Name = "pnlROButtons";
this.pnlROButtons.Size = new System.Drawing.Size(311, 89);
this.pnlROButtons.Size = new System.Drawing.Size(311, 110);
this.pnlROButtons.TabIndex = 9;
//
// btnGoToRO
//
this.btnGoToRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnGoToRO.CallBasePaintBackground = true;
this.btnGoToRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnGoToRO.Dock = System.Windows.Forms.DockStyle.Top;
this.btnGoToRO.Enabled = false;
this.btnGoToRO.Location = new System.Drawing.Point(0, 67);
this.btnGoToRO.Location = new System.Drawing.Point(0, 89);
this.btnGoToRO.Name = "btnGoToRO";
this.btnGoToRO.Size = new System.Drawing.Size(311, 22);
this.btnGoToRO.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
@ -140,11 +139,10 @@ namespace Volian.Controls.Library
// btnPreviewRO
//
this.btnPreviewRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnPreviewRO.CallBasePaintBackground = true;
this.btnPreviewRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnPreviewRO.Dock = System.Windows.Forms.DockStyle.Top;
this.btnPreviewRO.Enabled = false;
this.btnPreviewRO.Location = new System.Drawing.Point(0, 45);
this.btnPreviewRO.Location = new System.Drawing.Point(0, 67);
this.btnPreviewRO.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnPreviewRO.Name = "btnPreviewRO";
this.btnPreviewRO.Size = new System.Drawing.Size(311, 22);
@ -156,16 +154,15 @@ namespace Volian.Controls.Library
// btnCancelRO
//
this.btnCancelRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnCancelRO.CallBasePaintBackground = true;
this.btnCancelRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnCancelRO.Dock = System.Windows.Forms.DockStyle.Top;
this.btnCancelRO.Enabled = false;
this.btnCancelRO.Location = new System.Drawing.Point(0, 22);
this.btnCancelRO.Location = new System.Drawing.Point(0, 44);
this.btnCancelRO.Margin = new System.Windows.Forms.Padding(4);
this.btnCancelRO.Name = "btnCancelRO";
this.btnCancelRO.Size = new System.Drawing.Size(311, 23);
this.superTooltip1.SetSuperTooltip(this.btnCancelRO, new DevComponents.DotNetBar.SuperTooltipInfo("Cancel", "", "This become active when you about to replace an existing RO link in you procedure" +
".\r\n\r\nNOTE: This willL NOT un-do after you select the Save RO button.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(195, 145)));
".\r\n\r\nNOTE: This willL NOT un-do after you select the Save RO button.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(195, 145)));
this.btnCancelRO.TabIndex = 9;
this.btnCancelRO.Text = "Cancel";
this.btnCancelRO.Click += new System.EventHandler(this.btnCancelRO_Click);
@ -173,19 +170,32 @@ namespace Volian.Controls.Library
// btnSaveRO
//
this.btnSaveRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnSaveRO.CallBasePaintBackground = true;
this.btnSaveRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnSaveRO.Dock = System.Windows.Forms.DockStyle.Top;
this.btnSaveRO.Enabled = false;
this.btnSaveRO.Location = new System.Drawing.Point(0, 0);
this.btnSaveRO.Location = new System.Drawing.Point(0, 22);
this.btnSaveRO.Margin = new System.Windows.Forms.Padding(4);
this.btnSaveRO.Name = "btnSaveRO";
this.btnSaveRO.Size = new System.Drawing.Size(311, 22);
this.superTooltip1.SetSuperTooltip(this.btnSaveRO, new DevComponents.DotNetBar.SuperTooltipInfo("Save RO", "", resources.GetString("btnSaveRO.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(340, 125)));
this.superTooltip1.SetSuperTooltip(this.btnSaveRO, new DevComponents.DotNetBar.SuperTooltipInfo("Find Doc RO", "", resources.GetString("btnSaveRO.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(340, 125)));
this.btnSaveRO.TabIndex = 8;
this.btnSaveRO.Text = "Save RO";
this.btnSaveRO.Click += new System.EventHandler(this.btnSaveRO_Click);
//
// btnFindDocRO
//
this.btnFindDocRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnFindDocRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnFindDocRO.Dock = System.Windows.Forms.DockStyle.Top;
this.btnFindDocRO.Enabled = false;
this.btnFindDocRO.Location = new System.Drawing.Point(0, 0);
this.btnFindDocRO.Margin = new System.Windows.Forms.Padding(4);
this.btnFindDocRO.Name = "btnFindDocRO";
this.btnFindDocRO.Size = new System.Drawing.Size(311, 22);
this.btnFindDocRO.TabIndex = 9;
this.btnFindDocRO.Text = "Find Doc RO";
this.btnFindDocRO.Click += new System.EventHandler(this.btnFindDocRO_Click);
//
// panelRoValue
//
this.panelRoValue.Controls.Add(this.tbROValue);
@ -194,7 +204,7 @@ namespace Volian.Controls.Library
this.panelRoValue.Location = new System.Drawing.Point(0, 0);
this.panelRoValue.Margin = new System.Windows.Forms.Padding(4);
this.panelRoValue.Name = "panelRoValue";
this.panelRoValue.Size = new System.Drawing.Size(311, 27);
this.panelRoValue.Size = new System.Drawing.Size(311, 30);
this.panelRoValue.TabIndex = 8;
//
// tbROValue
@ -210,10 +220,10 @@ namespace Volian.Controls.Library
this.tbROValue.Margin = new System.Windows.Forms.Padding(4);
this.tbROValue.Name = "tbROValue";
this.tbROValue.ReadOnly = true;
this.tbROValue.Size = new System.Drawing.Size(247, 26);
this.tbROValue.Size = new System.Drawing.Size(247, 22);
this.superTooltip1.SetSuperTooltip(this.tbROValue, new DevComponents.DotNetBar.SuperTooltipInfo("RO Value", "", "The value of selected RO will be displayed here.\r\n\r\nExceptions:\r\n- Tables, X/Y Pl" +
"ots, and Images will state what they are. The Preview button will display the va" +
"lue.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(230, 135)));
"ots, and Images will state what they are. The Preview button will display the va" +
"lue.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(230, 135)));
this.tbROValue.TabIndex = 7;
this.tbROValue.WatermarkText = "Select RO Below";
this.tbROValue.WordWrap = false;
@ -223,23 +233,23 @@ namespace Volian.Controls.Library
//
//
//
this.lblROValue.BackgroundStyle.Class = "";
this.lblROValue.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lblROValue.Dock = System.Windows.Forms.DockStyle.Left;
this.lblROValue.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblROValue.Location = new System.Drawing.Point(0, 0);
this.lblROValue.Margin = new System.Windows.Forms.Padding(4);
this.lblROValue.Name = "lblROValue";
this.lblROValue.Size = new System.Drawing.Size(64, 27);
this.lblROValue.Size = new System.Drawing.Size(64, 30);
this.superTooltip1.SetSuperTooltip(this.lblROValue, new DevComponents.DotNetBar.SuperTooltipInfo("RO Value", "", "The value of selected RO will be displayed here.\r\n\r\nExceptions:\r\n- Tables, X/Y Pl" +
"ots, and Images will state what they are. The Preview button will display the va" +
"lue.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(230, 135)));
"ots, and Images will state what they are. The Preview button will display the va" +
"lue.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(230, 135)));
this.lblROValue.TabIndex = 6;
this.lblROValue.Text = "RO Value:";
this.lblROValue.TextLineAlignment = System.Drawing.StringAlignment.Near;
//
// superTooltip1
//
this.superTooltip1.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray);
this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
//
// lbFound
@ -247,7 +257,7 @@ namespace Volian.Controls.Library
this.lbFound.Dock = System.Windows.Forms.DockStyle.Top;
this.lbFound.FormattingEnabled = true;
this.lbFound.ItemHeight = 16;
this.lbFound.Location = new System.Drawing.Point(0, 218);
this.lbFound.Location = new System.Drawing.Point(0, 180);
this.lbFound.Margin = new System.Windows.Forms.Padding(4);
this.lbFound.Name = "lbFound";
this.lbFound.Size = new System.Drawing.Size(311, 68);
@ -289,5 +299,6 @@ namespace Volian.Controls.Library
private DevComponents.DotNetBar.SuperTooltip superTooltip1;
private System.Windows.Forms.ListBox lbFound;
private DevComponents.DotNetBar.ButtonX btnGoToRO;
private DevComponents.DotNetBar.ButtonX btnFindDocRO;
}
}

View File

@ -922,5 +922,43 @@ namespace Volian.Controls.Library
//RunRoEditor();
SaveRO();
}
public void SetFindDocROButton(bool enabled)
{
this.btnFindDocRO.Enabled = enabled;
}
// C2016-044: support click of the 'Find Doc RO' button:
private void btnFindDocRO_Click(object sender, EventArgs e)
{
DisplayTabItem dti = _TabControl==null?null:_TabControl.SelectedDisplayTabItem;
if (dti != null && dti.MyDSOTabPanel != null)
{
// the currently selected tab control is a word document - see if it has an
// active selection. If not, tell the user that text needs to be selected before
// the ro can be found.
string mytext = dti.MyDSOTabPanel.GetSelectedString();
if (mytext == null || mytext == "")
{
MessageBox.Show(this, "Text must be selected in the document in order for an RO find to be performed.", "Select Text", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
else
{
// see if there are any ro's for the selected text & if so, display in the lbFound list:
string lookFor = mytext.Replace('\u2011', '-').Replace(@"\u9586?", @"\\");
List<ROFSTLookup.roChild> children = null;
if (_MyROFST != null) children = _MyROFST.GetROFSTLookup(Mydvi).GetRosByValue(lookFor);
if (children != null)
{
lbFound.Visible = true;
lbFound.DataSource = children.ToArray();
lbFound.SelectionMode = SelectionMode.One;
lbFound.SelectedIndex = -1;
}
else
lbFound.Visible = false;
}
}
}
}
}