亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? web.pas

?? Delphi編寫的一個支持語法高亮顯示和很多語言的文本編輯器
?? PAS
?? 第 1 頁 / 共 3 頁
字號:
unit web;

{This unit encapsulates SHDocVw.dll and MSHTML.dll functionality by subclassing
TWebBrowser object as TWeb object

TWeb was designed for easy use of HTML display and editing capacity in
SuperMemo 2002 for Windows developed by SuperMemo R&D in Fall 2001.

SuperMemo 2002 implements HTML-based incremental reading in which extensive HTML
support is vital

Pieces of this units can be used by anyone in other Delphi applications that make
use of HTML WYSIWYG interfaces made open by Microsoft

Please send comments, questions, suggestions for improvements or bugs to:
bugs(AT)supermemo(.)com}

{IMPORTANT! you need to assign TWinControl(Web).Parent to make Web:TWeb visible}
{For example, putting TWeb on a panel:
   TheWeb:=TWeb.Create(Panel);
   TheWeb.TheParent:=Self; //Form parenting the panel
   TWinControl(TheWeb).Parent:=Panel;
   TWinControl(TheWeb).Align:=alClient;
   TheWeb.Tag:=1; //Set different Tag if more TWeb's placed in a form}

interface

uses SysUtils,WinTypes,
     ActiveX,MSHTMLEvents2,SHDocVw_TLB, MSHTML_TLB,
     IeConst,Classes,Forms,Graphics;

const
  CGID_MSHTML:TGUID='{DE4BA900-59CA-11CF-9592-444553540000}';
  IID_IOleCommandTarget:TGUID='{B722BCCB-4E68-101B-A2BC-00AA00404770}';
  CGID_WebBrowser:TGUID='{ED016940-BD5B-11cf-BA4E-00C04FD70816}';
  FontScale=3;

var IEStr,LastHyperlink:string;
    ApplicationOnMessage:TMessageEvent; {set to Forms.Application.OnMessage when creating the main form}
    OnMessageCompNo:byte;

type TWeb=class(TWebBrowser)
          public
             Modified,ReadOnly,Extrinsic,SuperMemoMenu,_Filter:boolean;
             TheDoc:IHTMLDocument2; //MSHTML HTML Document 2 interface
             TheWind:IHTMLWindow2;
             DocCmd,WebCmd:IOleCommandTarget; //MSHTML IOLECommandTarget interface
             Editable:boolean;
             TheSlot,TheTextPosit:integer;
             LastClickX,LastClickY:integer;
             TheParent:TForm;
             ElWind:byte; {pointer reference error protection; to occlude ElementWindow.ElWind in SuperMemo}
             LoadedHTMLFile:string;
             procedure Clear;
             procedure Save;
             procedure SaveAs(DefaultName:string);
             function SaveFile(Filename:string):boolean;
             procedure Print;
             procedure SetState(Edit:boolean);
             procedure LoadFile(FileName:string);
             procedure StatusTextChange(Sender: TObject; const Text: WideString);
             procedure CommandStateChange(Sender: TObject; Command: Integer; Enable: WordBool);
             procedure BeforeNavigate2(Sender: TObject;const pDisp: IDispatch;
                 var URL: OleVariant;var Flags: OleVariant;var TargetFrameName:OleVariant;
                 var PostData: OleVariant;var Headers: OleVariant;var Cancel: WordBool);
             procedure NavigateComplete2(Sender: TObject;const pDisp: IDispatch; var URL: OleVariant);
             constructor Create(Owner:TComponent); override;
             destructor Destroy; override;
             procedure SetFocus; override;
             function SourceText:string;
             procedure SetSelection(Start,Length:integer);
             function GetTextRange:IHtmlTxtRange;
             function SelStart:integer;
             function SelEnd:integer;
             function SelLength:integer;
             procedure SetBackgroundColor(Color:TColor);
             function GetBackgroundColor:TColor;
             procedure SetHTMLText(HTML:WideString);
             procedure WaitLoad(peek:boolean);
             function GetScrollTop:integer;
             procedure SetScrollTop(ScrollTop:integer);
             function GetHTMLSelection:WideString;
             procedure ClearSelection;
             procedure ReplaceSelection(HTML:string);
             procedure SetFont(AFont:TFont;SetFontMode:byte);
             function Text:string;
             procedure SetBorder(Border:boolean);
             procedure SetScrollBar(ScrollBar:boolean);
             procedure Undo;
             procedure GetFont(var AFont:TFont);
             procedure FontDialog;
             function  SpecialCommand(Cmd : Cardinal; PromptUser : boolean;
                       editModeOnly : boolean; bTriEditCommandGroup : boolean;
                       InputArgs : OleVariant) : HRESULT;
             procedure ToggleBullet;
             procedure ToggleNumbering;
             procedure Indent(Indent:boolean);
             procedure Align(IDM:integer);
             function SelText:string;
             procedure Paste;
             procedure Copy;
             procedure Cut;
             procedure Delete;
             procedure SelectAll;
             procedure SetText(HTML:string);
             procedure CompleteLoading;
             function CompNo:byte;
             function Visible:boolean;
             procedure Find;
             procedure Subscript;
             procedure Superscript;
             {end public}
          private
             OleInPlaceActiveObject: IOleInPlaceActiveObject;
             Events:TMSHTMLHTMLDocumentEvents;
             CtrlToBeProcessed,ShiftToBeProcessed:boolean;
             procedure SuperMemoMessageHandler(var Msg: TMsg; var Handled: Boolean);
             procedure OnMouseDown(Sender:TObject);
             procedure OnMouseUp(Sender:TObject);
             procedure OnMouseMove(Sender:TObject);
             procedure OnMouseOver(Sender:TObject);
             procedure OnMouseOut(Sender:TObject);
             function OnClick(Sender:TObject):WordBool;
             function OnSelectStart(Sender:TObject):WordBool;
             procedure OnFocusOut(Sender:TObject);
             procedure OnFocusIn(Sender:TObject);
             function OnContextMenu(Sender:TObject):WordBool;
             function OnKeyPress(Sender:TObject):WordBool;
             procedure OnKeyDown(Sender:TObject);
             procedure OnKeyUp(Sender:TObject);
             procedure ClickPoint(X,Y:integer);
             procedure DefineEvents;
             function HyperlinkClicked:boolean;
             function HrExecCommand(ucmdID: cardinal;
                       const pVarIn: OleVariant; var pVarOut: OleVariant; bPromptUser,
                       bTriEditCmdGroup: boolean): HResult;
             procedure ProcessLoadMessages;
             procedure SetBorderWidth;
             procedure ReassignKeyboardHandler(CompNo:byte;TurnOn:boolean);
            {end private}
          end;

implementation

uses WinProcs,Messages,Controls,Variants,Clipbrd;
     {Pieces of code specific to SuperMemo are marked as: SMSpecific:}
     {SMSpecific:}{These units are specific to SuperMemo}
{     const8,Basic,Dial,Files,Component,
     DBDat,Col,Option,LayoutMan,ElementWindow,Main;}

var PtrWGUID,PtrMGUID,PtrDGUID:PGUID;
    NULL:OleVariant;

constructor TWeb.Create(Owner:TComponent);
begin
  inherited Create(Owner);
  LoadedHTMLFile:='';
  OnBeforeNavigate2:=BeforeNavigate2;
  OnStatusTextChange:=StatusTextChange;
  OnCommandStateChange:=CommandStateChange;
  OnNavigateComplete2:=NavigateComplete2;
  TheDoc:=nil;
  DocCmd:=nil;
  WebCmd:=nil;
  Modified:=false;
  SuperMemoMenu:=true; {SMSpecific}
  LastClickX:=0;
  LastClickY:=0;
  ReadOnly:=false;
  CtrlToBeProcessed:=false;
  ShiftToBeProcessed:=false;
  Events:=nil;
end;

destructor TWeb.Destroy;
begin
  ReassignKeyboardHandler(Tag,false);
  inherited Destroy;
end;

procedure TWeb.SaveAs(DefaultName:string);
begin
  if TheDoc=nil then
     exit;
  TheDoc.ExecCommand('SaveAs',false,DefaultName);
  Modified:=false;
end;

procedure TWeb.Print;
begin
  ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_PROMPTUSER,NULL,NULL);
end;

procedure TWeb.Save;
var
  sHTML:string;
  fsOut:TFileStream;
begin
  sHTML:=SourceText;
  fsOut:=TFileStream.Create(TheDoc.URL,fmCreate or fmShareExclusive);
  try
    fsOut.Write(pchar(sHTML)^, length(sHTML));
  finally
    fsOut.Free;
    Modified:=false;
  end;
end;

procedure TWeb.OnKeyUp(Sender:TObject);
begin {those empty handlers are needed for the keyboard and mouse to behave correctly with EventSink!}
  {nop}
end;

procedure TWeb.OnMouseMove(Sender:TObject);
begin
 {nop}
end;

procedure TWeb.OnMouseOver(Sender:TObject);
begin
  {nop}
end;

procedure TWeb.OnMouseOut(Sender:TObject);
begin
 {nop}
end;

function TWeb.OnClick(Sender:TObject):WordBool;
begin
  Result:=true;
end;

function TWeb.OnSelectStart(Sender:TObject):WordBool;
begin
  Result:=true;
end;

procedure TWeb.OnMouseUp(Sender:TObject);
begin
  {nop}
end;

procedure TWeb.Clear;
begin
  TheTextPosit:=0;
  SetHTMLText('');
end;

function TWeb.SelStart:integer;
var TextRange:IHtmlTxtRange;
begin
  Result:=0;
  TextRange:=GetTextRange;
  if TextRange=nil then
     exit;
//  Result:=Abs(Integer(TextRange.move('character',-MaxTextLength)));
end;

function TWeb.SelEnd:integer;
var TextRange:IHtmlTxtRange;
begin
  Result:=0;
  TextRange:=GetTextRange;
  if TextRange=nil then
     exit;
//  Result:=Abs(Integer(TextRange.MoveEnd('character',-MaxTextLength)));
end;

function TWeb.SelLength:integer;
begin
  Result:=SelEnd-SelStart;
end;

function TWeb.GetScrollTop:integer;
var FocusElement:IHTMLElement2;
begin
  Result:=0;
  try
     if TheDoc=nil then
        exit;
     FocusElement:=TheDoc.ActiveElement as IHTMLElement2;
     if FocusElement=nil then
        exit;
     Result:=FocusElement.ScrollTop;
  except
//    on E:Exception do EError('Cannot get scroll top position',E);
    end;
end;

function TWeb.GetHTMLSelection:WideString;
var TextRange:IHtmlTxtRange;
begin
  Result:='';
  TextRange:=GetTextRange;
  if TextRange=nil then
     exit;
  Result:=TextRange.HTMLText;
end;

procedure TWeb.ClearSelection;
begin
  if TheDoc=nil then
     exit;
  TheDoc.Selection.Clear;
  Modified:=true;
end;

procedure TWeb.ReplaceSelection(HTML:string);
var TextRange:IHtmlTxtRange;
begin
  try
     TextRange:=GetTextRange;
     if TextRange=nil then
        exit;
     TextRange.PasteHTML(HTML); {Warning! pasting relative paths will result in conversion to absolute paths!}
     Modified:=true;
  except
   on E:Exception do begin
//      ShortenString(HTML,80);
//      EError('Error pasting HTML'+nl+
//      'Microsoft HTML refuses to paste this string:'+nl+
//      HTML+nl,E);
      end;
   end;
end;

procedure TWeb.SetFont(AFont:TFont;SetFontMode:byte);
begin
end;

procedure TWeb.SetBorder(Border:boolean);
begin
  if TheDoc=nil then
     exit;
  if TheDoc.body=nil then
     exit;
  if not Border then begin
     if not Editable then begin
        TheDoc.body.style.borderStyle:='none';
        TheDoc.body.style.borderWidth:='thin';
        TheDoc.body.style.borderColor:='white';
        end;
     if Editable then begin
        TheDoc.body.style.borderStyle:='none';
        TheDoc.body.style.borderWidth:='thin';
        TheDoc.body.style.borderColor:='blue';
        end;
     end;
  if Border then begin
     if not Editable then begin
        TheDoc.body.style.borderStyle:='solid';
        TheDoc.body.style.borderWidth:='thin';
        TheDoc.body.style.borderColor:='silver';
        end;
     if Editable then begin
        TheDoc.body.style.borderStyle:='solid';
        TheDoc.body.style.borderWidth:='thin';
        TheDoc.body.style.borderColor:='blue';
        end;
     end;
end;

procedure TWeb.SetScrollBar(ScrollBar:boolean);
begin
  if TheDoc=nil then
     exit;
  if TheDoc.body=nil then
     exit;
  if ScrollBar then {values of "hidden" and "visible" lock PgUp and PgDn!}
     TheDoc.body.style.overflow:='scroll'
  else
     TheDoc.body.style.overflow:='auto';
end;

procedure TWeb.Undo;
begin
  if TheDoc=nil then
     exit;
  TheDoc.ExecCommand('Undo',false,0);
  Modified:=true;
end;

procedure TWeb.FontDialog;
begin
  SpecialCommand(IDM_FONT,True,True,False,Null);
  Modified:=true;
end;

function TWeb.SpecialCommand(Cmd:Cardinal;PromptUser:boolean;
                              editModeOnly:boolean;bTriEditCommandGroup:boolean;
                              InputArgs:OleVariant):HRESULT;
begin
  Result:=HrExecCommand(Cmd,null,InputArgs,promptUser,bTriEditCommandGroup);
end;

function TWeb.HrExecCommand(ucmdID: cardinal;
  const pVarIn: OleVariant; var pVarOut: OleVariant; bPromptUser,
  bTriEditCmdGroup: boolean): HResult;
var dwCmdOpt:DWORD;
begin
   result := S_OK;
   if DocCmd = nil then
      Exit;
   if (bPromptUser) then
      dwCmdOpt := MSOCMDEXECOPT_PROMPTUSER
   else
      dwCmdOpt := MSOCMDEXECOPT_DONTPROMPTUSER;
   if (bTriEditCmdGroup) then
      result := DocCmd.Exec(@GUID_TriEditCommandGroup,ucmdID,dwCmdOpt,pVarIn,pVarOut)
   else
      result := DocCmd.Exec(@CMDSETID_Forms3,ucmdID,dwCmdOpt,pVarIn,pVarOut);
end;

procedure TWeb.ToggleBullet;
begin
  if TheDoc=nil then
     exit;
  SpecialCommand(IDM_UnORDERLIST,false,true,false,Null);
  Modified:=true;
end;

procedure TWeb.ToggleNumbering;
begin
  if TheDoc=nil then
     exit;
  SpecialCommand(IDM_ORDERLIST,false,true,false,Null);
  Modified:=true;
end;

procedure TWeb.Align(IDM:integer);
begin
  if TheDoc=nil then
     exit;
  SpecialCommand(IDM,false,true,false,Null);
  Modified:=true;
end;

procedure TWeb.SetBackgroundColor(Color:TColor);
begin
  if TheDoc=nil then
     exit;
  TheDoc.ExecCommand('BackColor',false,Color);
  Modified:=true;
end;

function TWeb.SelText:string;
var TextRange:IHtmlTxtRange;
begin
  Result:='';
  TextRange:=GetTextRange;
  if TextRange=nil then
     exit;
  Result:=TextRange.text;
end;

procedure TWeb.Indent(Indent:boolean);
begin
  if TheDoc=nil then
     exit;
  if Indent then
     TheDoc.ExecCommand('Indent',false,0)
  else
     TheDoc.ExecCommand('Outdent',false,0);
  Modified:=true;
end;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一二三区不卡| 国产精品久久久久婷婷| 亚洲激情中文1区| 狠狠色丁香久久婷婷综合_中| 欧美亚洲动漫另类| 国产精品久久久久桃色tv| 裸体健美xxxx欧美裸体表演| 日本道精品一区二区三区| 国产欧美日韩在线视频| 老司机午夜精品| 欧美日韩免费观看一区三区| 国产精品久久久久四虎| 国产一区二区导航在线播放| 欧美一区二区三区免费观看视频| 亚洲欧美日韩在线播放| 国产成人av电影在线播放| 欧美v日韩v国产v| 同产精品九九九| 欧美性大战久久久| 亚洲精选视频在线| 99国产精品久久久久久久久久| 国产亚洲精品福利| 久久99精品久久久久久动态图| 欧美日韩国产免费| 亚洲一区成人在线| 欧美伊人精品成人久久综合97| 亚洲欧美日韩国产中文在线| 成人国产精品免费网站| 国产欧美日韩综合精品一区二区| 国产在线乱码一区二区三区| 欧美成人乱码一区二区三区| 日韩高清不卡在线| 3d动漫精品啪啪1区2区免费| 天天综合天天做天天综合| 在线观看91视频| 亚洲国产一二三| 欧美色网一区二区| 午夜视频久久久久久| 欧美日韩久久久| 视频在线在亚洲| 欧美一区二区三区在线观看| 老鸭窝一区二区久久精品| 日韩精品一区二区三区三区免费| 老汉av免费一区二区三区 | 日本三级亚洲精品| 91麻豆精品国产91久久久| 视频一区国产视频| 日韩欧美在线综合网| 六月丁香婷婷色狠狠久久| 精品国产在天天线2019| 国产一区二区三区久久久 | 欧美视频在线观看一区二区| 亚洲sss视频在线视频| 91精品久久久久久久99蜜桃| 色综合天天性综合| 亚洲裸体xxx| 欧美理论在线播放| 美女视频第一区二区三区免费观看网站 | 天天操天天色综合| 日韩三级中文字幕| 国产精品91一区二区| 国产精品日产欧美久久久久| 色欧美日韩亚洲| 三级成人在线视频| 久久色成人在线| 不卡av在线免费观看| 亚洲另类中文字| 欧美区视频在线观看| 久久99国产精品免费| 国产欧美视频一区二区| 色国产综合视频| 日韩高清欧美激情| 国产欧美一区二区三区沐欲| 色综合一区二区| 日本va欧美va欧美va精品| 久久精品欧美日韩精品| 91欧美激情一区二区三区成人| 亚洲123区在线观看| 久久先锋影音av鲁色资源| 成人精品鲁一区一区二区| 亚洲国产精品麻豆| 久久精品水蜜桃av综合天堂| 日本电影欧美片| 黄色日韩网站视频| 亚洲毛片av在线| 精品粉嫩超白一线天av| 97久久超碰国产精品电影| 男人的j进女人的j一区| 欧美国产日本韩| 在线成人免费视频| 国产成人精品三级麻豆| 亚洲成人自拍一区| 国产色一区二区| 欧美日韩中文一区| 东方aⅴ免费观看久久av| 午夜一区二区三区视频| 国产日韩欧美a| 青草av.久久免费一区| 国产喷白浆一区二区三区| 欧美少妇xxx| 成人免费的视频| 奇米影视在线99精品| 亚洲色图欧洲色图| 久久精品夜夜夜夜久久| 欧美自拍偷拍一区| 国产精品亚洲专一区二区三区| 亚洲成人免费在线观看| 国产精品国产三级国产普通话蜜臀| 欧美一区二区播放| 色噜噜狠狠成人网p站| 国产精品正在播放| 日韩精品乱码av一区二区| 国产精品国产三级国产| 精品国产乱码久久久久久影片| 91福利精品视频| 成人午夜电影网站| 麻豆成人av在线| 亚洲国产综合91精品麻豆| 国产精品素人视频| 精品日韩一区二区| 8v天堂国产在线一区二区| 一本色道久久加勒比精品 | 亚洲欧美另类小说视频| 国产亚洲欧美色| 欧美成人精品3d动漫h| 欧美少妇性性性| 91网站黄www| 成人激情av网| 国产成人免费在线观看不卡| 久久国产精品免费| 日本不卡123| 天堂午夜影视日韩欧美一区二区| 亚洲欧美激情小说另类| 国产精品久久国产精麻豆99网站| www亚洲一区| 精品国产乱码91久久久久久网站| 欧美男人的天堂一二区| 在线观看视频91| 91麻豆高清视频| 91玉足脚交白嫩脚丫在线播放| 国产传媒日韩欧美成人| 国产一区二区精品在线观看| 久久99国产精品麻豆| 蜜桃av一区二区| 人禽交欧美网站| 美女诱惑一区二区| 看国产成人h片视频| 麻豆国产精品一区二区三区 | 热久久一区二区| 日韩av电影免费观看高清完整版 | 欧美变态tickling挠脚心| 欧美一级日韩不卡播放免费| 在线不卡a资源高清| 777色狠狠一区二区三区| 欧美精品久久久久久久久老牛影院 | 丝袜美腿亚洲综合| 午夜成人免费视频| 水蜜桃久久夜色精品一区的特点 | 亚洲一区二区免费视频| 夜夜嗨av一区二区三区| 亚洲国产一区二区在线播放| 亚洲成av人片一区二区梦乃 | 国产精品短视频| 亚洲免费av在线| 亚洲影视在线播放| 午夜欧美在线一二页| 日韩国产成人精品| 狠狠色综合色综合网络| 国产成人久久精品77777最新版本| 国产成人综合精品三级| 成人一级片网址| 99久久精品国产导航| 91久久精品一区二区二区| 欧美视频自拍偷拍| 欧美一级日韩一级| 久久久精品天堂| 国产精品成人在线观看| 亚洲一区视频在线| 免费人成在线不卡| 国产成人无遮挡在线视频| 99国产精品国产精品久久| 欧美午夜在线观看| 日韩欧美国产一区二区三区| 久久精品夜夜夜夜久久| 综合久久久久久久| 日韩有码一区二区三区| 国产一区二区不卡老阿姨| www.爱久久.com| 欧美日韩免费观看一区二区三区| 欧美一区二区三区视频免费播放| 久久网站热最新地址| 国产精品久久久久久福利一牛影视| 成人综合在线网站| 91免费视频网址| 欧美一卡二卡在线| 国产精品免费丝袜| 五月婷婷综合在线| 国产一区二区三区四区五区美女| 99精品国产91久久久久久| 4438x亚洲最大成人网|