diff --git a/.vs/AIProofread/v17/.suo b/.vs/AIProofread/v17/.suo
index 82ddac1..aa06a89 100644
Binary files a/.vs/AIProofread/v17/.suo and b/.vs/AIProofread/v17/.suo differ
diff --git a/AIProofread/Config.cs b/AIProofread/Config.cs
index c143662..c57e474 100644
--- a/AIProofread/Config.cs
+++ b/AIProofread/Config.cs
@@ -16,6 +16,10 @@ namespace AIProofread
public static bool IS_WPS = false;
public static readonly string CONFIG_FILE = AppDomain.CurrentDomain.BaseDirectory + "app.json";
+ ///
+ /// 文本背景色
+ ///
+ public static readonly string TextBackgroundColor = "#D6AA69";
#if DEBUG
///
/// 网页访问地址
diff --git a/AIProofread/Model/DocumentInfo.cs b/AIProofread/Model/DocumentInfo.cs
index b44d6fe..d6c793a 100644
--- a/AIProofread/Model/DocumentInfo.cs
+++ b/AIProofread/Model/DocumentInfo.cs
@@ -571,7 +571,7 @@ namespace AIProofread.Model
{
// 颜色转码
- var color = (WdColor)ColorTranslator.ToOle(Colors.FromHex(item.Color));
+ var color = (WdColor)ColorTranslator.ToOle(Colors.FromHex(Config.TextBackgroundColor));
// 给选区添加背景颜色
mark.Shading.BackgroundPatternColor = color;
//try
@@ -743,5 +743,19 @@ namespace AIProofread.Model
TaskPane.Visible = true;
TaskPane.Control.Focus();
}
+
+ internal void Close()
+ {
+ try
+ {
+ marks.Clear();
+ ranges.Clear();
+ TaskPane.Dispose();
+ }
+ catch (Exception ex)
+ {
+ Logger.Log(ex);
+ }
+ }
}
}
diff --git a/AIProofread/Model/DocumentList.cs b/AIProofread/Model/DocumentList.cs
index 6039d4c..cb87f54 100644
--- a/AIProofread/Model/DocumentList.cs
+++ b/AIProofread/Model/DocumentList.cs
@@ -76,6 +76,22 @@ namespace AIProofread.Model
{
return documentList.Remove(documentInfo);
}
+ public bool Remove(Document originDocument)
+ {
+ if(Count > 0 && originDocument != null)
+ {
+ documentList.RemoveAll(x =>
+ {
+ if(x.CurrentDocument == originDocument)
+ {
+ x.Close();
+ return true;
+ }
+ return false;
+ });
+ }
+ return true;
+ }
///
/// 获取文档的索引
diff --git a/AIProofread/ThisAddIn.cs b/AIProofread/ThisAddIn.cs
index e153020..b1fb4a3 100644
--- a/AIProofread/ThisAddIn.cs
+++ b/AIProofread/ThisAddIn.cs
@@ -246,6 +246,7 @@ namespace AIProofread
private void Application_DocumentBeforeClose(Document currentDoc, ref bool Cancel)
{
Logger.Log("DocumentBeforeClose", currentDoc.FullName);
+ documentList.Remove(currentDoc);
//if (allMarks.ContainsKey(currentDoc))
//{
// allMarks.Remove(currentDoc);
diff --git a/AIProofread/core/DocumentUtil.cs b/AIProofread/core/DocumentUtil.cs
index 9d6b90b..1170fcb 100644
--- a/AIProofread/core/DocumentUtil.cs
+++ b/AIProofread/core/DocumentUtil.cs
@@ -306,12 +306,13 @@ namespace AIProofread
if (!document.Bookmarks.Exists(markName)) return null;
ControlCollection controls = Globals.Factory.GetVstoObject(document).Controls;
- // 删除原有书签
- controls.Remove(markName);
//return controls[markName] as Bookmark;
+ //var obj = controls[markName];
var bookmark = marks[markName];
var start = bookmark.Range.Start;
var end = bookmark.Range.End;
+ // 删除原有书签
+ controls.Remove(markName);
return controls.AddBookmark(document.Range(start, end), markName);
}
catch (Exception ex)
@@ -550,7 +551,30 @@ namespace AIProofread
row.CreateCell(3).SetCellValue(originText);
row.CreateCell(4).SetCellValue(it.Origin);
- row.CreateCell(5).SetCellValue(it.Text);
+ if(it.Tag == "r") {
+ var suggest = it.Text;
+ if(it.Type == "sensitive")
+ {
+ suggest += "(敏感词)";
+ }
+ else if (it.Type == "blacklist")
+ {
+ suggest += "(敏感词)";
+ }
+ else if (string.IsNullOrEmpty(it.Addition))
+ {
+ suggest += $"({it.Addition})";
+ }
+ row.CreateCell(5).SetCellValue(suggest);
+ }
+ else if(it.Tag == "i")
+ {
+ row.CreateCell(5).SetCellValue("新增");
+ }
+ else if (it.Tag == "e")
+ {
+ row.CreateCell(5).SetCellValue("删除");
+ }
row.CreateCell(6).SetCellValue(StatusText(it.IsAccept));
id++;
}
@@ -583,7 +607,7 @@ namespace AIProofread
private static string StatusText(int status)
{
if (status == AcceptStatus.Accept) return "采纳";
- else if (status == AcceptStatus.Review) return "采纳";
+ else if (status == AcceptStatus.Review) return "复核";
else if (status == AcceptStatus.Ignore) return "忽略";
return "未处理";
diff --git a/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache b/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache
index 478294b..43d7ecd 100644
Binary files a/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache and b/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache differ
diff --git a/AIProofread/obj/Debug/AIProofread.dll b/AIProofread/obj/Debug/AIProofread.dll
index 873589f..79a0cdf 100644
Binary files a/AIProofread/obj/Debug/AIProofread.dll and b/AIProofread/obj/Debug/AIProofread.dll differ
diff --git a/AIProofread/obj/Debug/AIProofread.pdb b/AIProofread/obj/Debug/AIProofread.pdb
index 7bd65a8..22b07de 100644
Binary files a/AIProofread/obj/Debug/AIProofread.pdb and b/AIProofread/obj/Debug/AIProofread.pdb differ
diff --git a/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferences.cache
index 43ad1ab..5e0b9c0 100644
Binary files a/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ