⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uicpdfdoc.pas

📁 DelphiDoc is a program for automatic generation of documentation on a Delphi-Project. At the momen
💻 PAS
📖 第 1 页 / 共 5 页
字号:
~param BreakStyle the kind of the break }
procedure TICPDFVisitor.Break(BreakStyle: TICBreakStyle);
begin
 case BreakStyle of                   //depending on the kind
   icbsLineBreak:      FTextWriter.EndLine;       //end the line
   icbsParagraphBreak: FTextWriter.EndParagraph;  //or the paragraph
 else
  assert(False);
 end;
end;


{Called for nodes in the ~[link UICNodes COM] that change the style of the text
 for their contained nodes.
~param Node          the node representing a different text style
~param VisitChildren out: whether the children of the node should also be
                     visited; default is True }
procedure TICPDFVisitor.TextStyle(Node: TICNTextStyle;
                                  var VisitChildren: Boolean);
var       Font         :TFontSetting;       //the font used so far
          Handle       :Integer;            //handle of the new font
begin
 Font := FTextWriter.CurrentFont;           //get the font of the text so far
 case Node.TextStyle of                     //change its style
   ictsEmphasize: Include(Font.Style, pfsItalic);
   ictsStrong:    Include(Font.Style, pfsBold);
 else
  assert(False);
 end;
 Handle := FTextWriter.PushFontRec(Font);   //and set the new style
 FTextWriter.SetParagraphFont(Font);

 VisitChildren := False;                    //will be visited manually
 Node.VisitChildren(Self);                  //visit the text

 FTextWriter.PopFont(Handle);               //reset to previous font
 FTextWriter.SetParagraphFont(FTextWriter.CurrentFont);
end;


{Called for nodes in the ~[link UICNodes COM] that change the font of the text
 for their contained nodes.
~param Node          the node representing a different font
~param VisitChildren out: whether the children of the node should also be
                     visited; default is True }
procedure TICPDFVisitor.FontStyle(Node: TICNFontStyle;
                                  var VisitChildren: Boolean);
var       Font         :TFontSetting;       //the font used so far
          Handle       :Integer;            //handle of the new font
begin
 Font := FTextWriter.CurrentFont;           //get the font of the text so far
 case Node.FontStyle of
   icfsCode: Font.Font := pftCourier;         //start formatting as code
 else
  assert(False);
 end;
 Handle := FTextWriter.PushFontRec(Font);   //and set the new font
 FTextWriter.SetParagraphFont(Font);

 VisitChildren := False;                    //will be visited manually
 Node.VisitChildren(Self);                  //visit the text

 FTextWriter.PopFont(Handle);               //reset to previous font
 FTextWriter.SetParagraphFont(FTextWriter.CurrentFont);
end;


{Called for nodes in the ~[link UICNodes COM] that let their contained nodes
 keep their format. This means a fixed-width font should be used and line
 breaks should be preserved.
~param Node          the node causing its children to keep their format
~param VisitChildren out: whether the children of the node should also be
                     visited; default is True
~example
~[preformatted //a test

var       Font         :TFontSetting;    //the font used so far
          Handle       :Integer;         //handle of the new font
begin
 Separate;                               //add a vertical space

 //normally not keeping the format of the text but starting now?
 if (FPreformattedDepth = 0) and not FGenerator.KeepRawLineBreaks then
  FTextWriter.SetParagraphAlignment(taLeft);   //stop block alignment

 Font := FTextWriter.CurrentFont;        //get the font of the text so far
 Font.Font := pftCourier;                //use the fixed-width/mono-spaced font
 Handle := FTextWriter.PushFontRec(Font); //and set the new font
 FTextWriter.SetParagraphFont(Font);

 Inc(FPreformattedDepth);                //pre-formatted text will be written

 VisitChildren := False;                 //will be visited manually
 Node.VisitChildren(Self);               //visit the text

 FTextWriter.FlushLine;                  //and write the last line

 Dec(FPreformattedDepth);                //end writing pre-formatted text
 FTextWriter.PopFont(Handle);            //reset to previous font
 FTextWriter.SetParagraphFont(FTextWriter.CurrentFont);

 //normally not keeping the format of the text end ending it again now?
 if (FPreformattedDepth = 0) and not FGenerator.KeepRawLineBreaks then
  FTextWriter.SetParagraphAlignment(taBlock);    //use block alignment again

 Separate;                               //add a vertical space
end;

var       Font         :TFontSetting;    //the font used so far
          Handle       :Integer;         //handle of the new font
begin
 Separate;                               //add a vertical space

 //normally not keeping the format of the text but starting now?
 if (FPreformattedDepth = 0) and not FGenerator.KeepRawLineBreaks then
  FTextWriter.SetParagraphAlignment(taLeft);   //stop block alignment

 Font := FTextWriter.CurrentFont;        //get the font of the text so far
 Font.Font := pftCourier;                //use the fixed-width/mono-spaced font
 Handle := FTextWriter.PushFontRec(Font); //and set the new font
 FTextWriter.SetParagraphFont(Font);

 Inc(FPreformattedDepth);                //pre-formatted text will be written

 VisitChildren := False;                 //will be visited manually
 Node.VisitChildren(Self);               //visit the text

 FTextWriter.FlushLine;                  //and write the last line

 Dec(FPreformattedDepth);                //end writing pre-formatted text
 FTextWriter.PopFont(Handle);            //reset to previous font
 FTextWriter.SetParagraphFont(FTextWriter.CurrentFont);

 //normally not keeping the format of the text end ending it again now?
 if (FPreformattedDepth = 0) and not FGenerator.KeepRawLineBreaks then
  FTextWriter.SetParagraphAlignment(taBlock);    //use block alignment again

 Separate;                               //add a vertical space
end;

var       Font         :TFontSetting;    //the font used so far
          Handle       :Integer;         //handle of the new font
begin
 Separate;                               //add a vertical space

 //normally not keeping the format of the text but starting now?
 if (FPreformattedDepth = 0) and not FGenerator.KeepRawLineBreaks then
  FTextWriter.SetParagraphAlignment(taLeft);   //stop block alignment

 Font := FTextWriter.CurrentFont;        //get the font of the text so far
 Font.Font := pftCourier;                //use the fixed-width/mono-spaced font
 Handle := FTextWriter.PushFontRec(Font); //and set the new font
 FTextWriter.SetParagraphFont(Font);

 Inc(FPreformattedDepth);                //pre-formatted text will be written

 VisitChildren := False;                 //will be visited manually
 Node.VisitChildren(Self);               //visit the text

 FTextWriter.FlushLine;                  //and write the last line

 Dec(FPreformattedDepth);                //end writing pre-formatted text
 FTextWriter.PopFont(Handle);            //reset to previous font
 FTextWriter.SetParagraphFont(FTextWriter.CurrentFont);

 //normally not keeping the format of the text end ending it again now?
 if (FPreformattedDepth = 0) and not FGenerator.KeepRawLineBreaks then
  FTextWriter.SetParagraphAlignment(taBlock);    //use block alignment again

 Separate;                               //add a vertical space
end;

var       Font         :TFontSetting;    //the font used so far
          Handle       :Integer;         //handle of the new font
begin
 Separate;                               //add a vertical space

 //normally not keeping the format of the text but starting now?
 if (FPreformattedDepth = 0) and not FGenerator.KeepRawLineBreaks then
  FTextWriter.SetParagraphAlignment(taLeft);   //stop block alignment

 Font := FTextWriter.CurrentFont;        //get the font of the text so far
 Font.Font := pftCourier;                //use the fixed-width/mono-spaced font
 Handle := FTextWriter.PushFontRec(Font); //and set the new font
 FTextWriter.SetParagraphFont(Font);

 Inc(FPreformattedDepth);                //pre-formatted text will be written

 VisitChildren := False;                 //will be visited manually
 Node.VisitChildren(Self);               //visit the text

 FTextWriter.FlushLine;                  //and write the last line

 Dec(FPreformattedDepth);                //end writing pre-formatted text
 FTextWriter.PopFont(Handle);            //reset to previous font
 FTextWriter.SetParagraphFont(FTextWriter.CurrentFont);

 //normally not keeping the format of the text end ending it again now?
 if (FPreformattedDepth = 0) and not FGenerator.KeepRawLineBreaks then
  FTextWriter.SetParagraphAlignment(taBlock);    //use block alignment again

 Separate;                               //add a vertical space
end;

] }
procedure TICPDFVisitor.Preformatted(Node: TICNPreformatted;
                                     var VisitChildren: Boolean);

 {Separates the formatted text from the other text. }
 procedure Separate;
 begin
  case Node.PreformattedKind of          //depending on the format
    icpkSimple: FTextWriter.EndLine;       //just start a new line
    icpkSample: FTextWriter.EndParagraph;  //or a whole new paragraph
  else
   Assert(False);
  end;
 end;

var       Font         :TFontSetting;    //the font used so far
          Handle       :Integer;         //handle of the new font
begin
 Separate;                               //add a vertical space

 //normally not keeping the format of the text but starting now?
 if (FPreformattedDepth = 0) and not FGenerator.KeepRawLineBreaks then
  FTextWriter.SetParagraphAlignment(taLeft);   //stop block alignment

 Font := FTextWriter.CurrentFont;        //get the font of the text so far
 Font.Font := pftCourier;                //use the fixed-width/mono-spaced font
 Handle := FTextWriter.PushFontRec(Font); //and set the new font
 FTextWriter.SetParagraphFont(Font);

 Inc(FPreformattedDepth);                //pre-formatted text will be written

 VisitChildren := False;                 //will be visited manually
 Node.VisitChildren(Self);               //visit the text

 FTextWriter.FlushLine;                  //and write the last line

 Dec(FPreformattedDepth);                //end writing pre-formatted text
 FTextWriter.PopFont(Handle);            //reset to previous font
 FTextWriter.SetParagraphFont(FTextWriter.CurrentFont);

 //normally not keeping the format of the text end ending it again now?
 if (FPreformattedDepth = 0) and not FGenerator.KeepRawLineBreaks then
  FTextWriter.SetParagraphAlignment(taBlock);    //use block alignment again

 Separate;                               //add a vertical space
end;



{Called for each link to an identifier or file.
~param Identifier the identifier to link to; nil if a link to a file
~param TheFile    the file to link to; nil if a link to an identifier }
procedure TICPDFVisitor.LinkTo(Identifier: TIdentifier; TheFile: TPascalFile);
var       Ignore       :Boolean;          //whether the link should be ignored
begin
 //the target of the link should be excluded from documentation?
 Ignore := FGenerator.DoNotDocumentIdentifier(Identifier, TheFile);

 if not Ignore then                       //if not ignored
  //start the link on the identifier or file
  FTextWriter.StartLink(ltThisDoc, FGenerator.GetURIOf(Identifier, TheFile));

 if Assigned(Identifier) then             //write name of the target
  PascalCode(Identifier.Name, icpcIdentifier)
 else
  PascalCode(TheFile.InternalFileName, icpcIdentifier);

 if not Ignore then                       //if not ignored
  FTextWriter.EndLink;                      //end the link
end;

{Called for each link to a file by one of its aliases (used in the uses
 clauses).
~param TheFile the file to link to
~param Alias   the used alias of the file }
procedure TICPDFVisitor.LinkFileByAlias(TheFile: TPascalFile;
                                        const Alias: String);
begin
 Assert(not FGenerator.DoNotDocumentIdentifier(nil, TheFile));

 //start the link on the file
 FTextWriter.StartLink(ltThisDoc, FGenerator.GetURIOf(nil, TheFile));

 PascalCode(TheFile.InternalFileName, icpcIdentifier); //write name of file

 FTextWriter.EndLink;                     //end the link


 Localize(dtUnitUsedByAliasPre);          //add information of alias
 PascalCode(Alias, icpcIdentifier);
 Localize(dtUnitUsedByAliasPost);
end;

{Called for each link whose target could not be found.
~param Node          the node with the invalid/unknown link target
~param VisitChildren out: whether the children of the node (the link text)
                     should also be visited; default is True }
procedure TICPDFVisitor.InvalidLink(Node: TICNInvalidLink;
                                    var VisitChildren: Boolean);
begin
 VisitChildren := False;           //will be visited manually
 Node.VisitChildren(Self);         //visit the text

 WriteText(' @ ' + Node.LinkText); //write separator and text of unknown target
end;

{Called for each link to a target outside of the generated documentation
 (either in the internet or in the local file system).
~param Node          the node of a link to an external target
~param VisitChildren out: whether the children of the node (the link text)
                     should also be visited; default is True }
procedure TICPDFVisitor.LinkExtern(Node: TICNLinkExtern;
                                   var VisitChildren: Boolean);
begin
 //start the link to the external URI
 FTextWriter.StartLink(ltURI, Node.URI);
// FTextWriter.StartLink(ltFile, Node.URI);

 VisitChildren := False;                    //will be visited manually
 if Node.NoChildren then                    //no text of the link specified?
  WriteText(Node.LinkText)                    //write the text of the target
 else
  Node.VisitChildren(Self);                   //write the text

 FTextWriter.EndLink;                       //end the link

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -