基于WORD文档的防篡改水印系统设计与实现(13)
时间:2016-12-28 13:15 来源:毕业论文 作者:毕业论文 点击:次
fontwrong.SetColor(255); sel.MoveRight(COleVariant((short)1),COleVariant((short)(tempwrong)),COleVariant((short)1)); sel.MoveRight(COleVariant((short)1),COleVariant((short)1),COleVariant((short)0)); } else {tempwrong=-(tempwrong); sel.MoveRight(COleVariant((short)1),COleVariant((short)(tempwrong)),COleVariant((short)1)); sel.MoveRight(COleVariant((short)1),COleVariant((short)1),COleVariant((short)0)); sel.MoveRight(COleVariant((short)1),COleVariant((short)1),COleVariant((short)1)); fontwrong.AttachDispatch(sel.GetFont()); fontwrong.SetStrikeThrough(1); fontwrong.SetColor(255); sel.MoveLeft(COleVariant((short)1),COleVariant((short)(tempwrong)),COleVariant((short)1)); sel.MoveLeft(COleVariant((short)1),COleVariant((short)1),COleVariant((short)0)); } if (tempwrong==0) {fontwrong.AttachDispatch(sel.GetFont()); fontwrong.SetStrikeThrough(1); fontwrong.SetColor(255); } fontwrong.ReleaseDispatch(); wrongflag=0; } font.AttachDispatch (sel.GetFont()); sel.MoveLeft(COleVariant((short)1),COleVariant((short)1),COleVariant((short)0)); } sel.MoveRight(COleVariant((short)1),COleVariant((short)m),COleVariant((short)1)); sel.MoveRight(COleVariant((short)1),COleVariant((short)1),COleVariant((short)0)); tempp=m; m=tempp+p; p=tempp; if (m>n) {m=3;p=1;} } if (1!=wrongflag) {sel.MoveRight(COleVariant((short)1),COleVariant((short)m),COleVariant((short)1)); tempsum=int(fmod(double(tempsum),double(10))); switch (tempsum) { case 0: wf[0].line=55;break; case 1: wf[0].line=1;break; case 2: wf[0].line=3;break; case 3: wf[0].line=4;break; case 4: wf[0].line=6;break; case 5: wf[0].line=7;break; case 6: wf[0].line=9;break; case 7: wf[0].line=10;break; case 8: wf[0].line=11;break; case 9: wf[0].line=20;break; } font.AttachDispatch (sel.GetFont()); font.GetUnderlineColor(); font.GetUnderline(); if ((font.GetUnderline()!=wf[0].line)) { sel.WholeStory(); fontwrong.AttachDispatch(sel.GetFont()); fontwrong.SetStrikeThrough(1); fontwrong.SetColor(255); fontwrong.ReleaseDispatch(); wrongflag=0; } } (4)如果检测到文档被篡改,软件会对文章内容画红线并且弹出提示框提示用户,如图3.5所示。 if (1!=wrongflag) {MessageBox("水印错误,文档已被篡改");} fontwrong.ReleaseDispatch(); font.ReleaseDispatch(); sel.ReleaseDispatch(); 图3.5 文档错误提示 4 系统性能测试 4.1 水印嵌入测试 用户打开要嵌入的WORD文档后可以输入任意1-99范围内的密钥,然后生成对应水印如图4.1所示。 (责任编辑:qin) |