fixed 查找对象越界问题
This commit is contained in:
parent
2bf992844a
commit
59776008d3
Binary file not shown.
@ -508,7 +508,11 @@ namespace AIProofread
|
||||
var paragraph = document.Paragraphs[paragraphIndex];
|
||||
var paragraphStart = paragraph.Range.Start;
|
||||
var Start = paragraphStart + offset;
|
||||
var End = paragraph.Range.Start + length - 1;
|
||||
var End = Start + length - 1;
|
||||
if(End > paragraph.Range.End)
|
||||
{
|
||||
End = paragraph.Range.End;
|
||||
}
|
||||
|
||||
// 当前句子的选区
|
||||
var fullRange = document.Range(Start, End);
|
||||
@ -530,7 +534,6 @@ namespace AIProofread
|
||||
{
|
||||
bookmark = controls.AddBookmark(r, markName);
|
||||
bookmark.Tag = "ai_proofread";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -83,6 +83,7 @@ namespace AIProofread
|
||||
{
|
||||
// 注销吧
|
||||
Bridge.bridge.Logout(null);
|
||||
Globals.ThisAddIn.HideAllPanel();
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace AIProofread
|
||||
public List<FormLogin> LoginFormList = new List<FormLogin>();
|
||||
|
||||
public Dictionary<Word.Document, CustomTaskPane> taskPanels = new Dictionary<Word.Document, CustomTaskPane>();
|
||||
public Dictionary<Word.Document,bool> panelsVisible = new Dictionary<Word.Document, bool>();
|
||||
public Dictionary<Word.Document, bool> panelsVisible = new Dictionary<Word.Document, bool>();
|
||||
public CustomTaskPane currentDocumentTaskPane;
|
||||
|
||||
private static readonly Dictionary<Word.Document, Dictionary<int, ProofreadItem>> allMarks = new Dictionary<Word.Document, Dictionary<int, ProofreadItem>>();
|
||||
@ -65,7 +65,7 @@ namespace AIProofread
|
||||
panelsVisible[doc] = visible;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Application_WindowActivate(Word.Document activeDoc, Window Wn)
|
||||
@ -80,7 +80,7 @@ namespace AIProofread
|
||||
|
||||
if (!taskPanels.ContainsKey(activeDoc))
|
||||
{
|
||||
ShowPanel(activeDoc,false);
|
||||
ShowPanel(activeDoc, false);
|
||||
}
|
||||
this.currentDocumentTaskPane = taskPanels[activeDoc];
|
||||
if (IsWPS)
|
||||
@ -187,7 +187,7 @@ namespace AIProofread
|
||||
|
||||
private void Panel_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(currentDocumentTaskPane == sender)
|
||||
if (currentDocumentTaskPane == sender)
|
||||
{
|
||||
|
||||
}
|
||||
@ -266,7 +266,8 @@ namespace AIProofread
|
||||
// 默认直接打开文档 就直接创建panel
|
||||
ShowPanel(Application.ActiveDocument, false);
|
||||
}
|
||||
}catch (Exception ex2)
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
Logger.Log("加载默认文档失败: " + ex2.ToString());
|
||||
}
|
||||
@ -343,6 +344,16 @@ namespace AIProofread
|
||||
this.currentDocumentTaskPane.Visible = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏所有面板
|
||||
/// </summary>
|
||||
public void HideAllPanel()
|
||||
{
|
||||
foreach (var item in taskPanels)
|
||||
{
|
||||
item.Value.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowLoginForm(string action)
|
||||
{
|
||||
@ -397,8 +408,10 @@ namespace AIProofread
|
||||
{
|
||||
// 同步登录失败信息
|
||||
SendMessageToWeb(p.Control, "async-logout", null);
|
||||
}catch (Exception ex) {
|
||||
Logger.Log("async-logout:",ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Log("async-logout:", ex);
|
||||
}
|
||||
});
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user