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

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

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;
}
}
}
}
}