| 1 |
with ARM_Output, |
| 2 |
ARM_Contents, |
| 3 |
Ada.Text_IO; |
| 4 |
-- private |
| 5 |
with Ada.Strings.Unbounded; |
| 6 |
package ARM_RTF is |
| 7 |
|
| 8 |
-- |
| 9 |
-- Ada reference manual formatter (ARM_Form). |
| 10 |
-- |
| 11 |
-- This package defines the RTF output object. |
| 12 |
-- Output objects are responsible for implementing the details of |
| 13 |
-- a particular format. |
| 14 |
-- |
| 15 |
-- --------------------------------------- |
| 16 |
-- Copyright 2000, 2002, 2004, 2005, 2006, 2007, 2009, 2011, 2012 |
| 17 |
-- AXE Consultants. All rights reserved. |
| 18 |
-- P.O. Box 1512, Madison WI 53701 |
| 19 |
-- E-Mail: [email protected] |
| 20 |
-- |
| 21 |
-- ARM_Form is free software: you can redistribute it and/or modify |
| 22 |
-- it under the terms of the GNU General Public License version 3 |
| 23 |
-- as published by the Free Software Foundation. |
| 24 |
-- |
| 25 |
-- AXE CONSULTANTS MAKES THIS TOOL AND SOURCE CODE AVAILABLE ON AN "AS IS" |
| 26 |
-- BASIS AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE ACCURACY, |
| 27 |
-- CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR FUNCTIONING OF THIS TOOL. |
| 28 |
-- IN NO EVENT WILL AXE CONSULTANTS BE LIABLE FOR ANY GENERAL, |
| 29 |
-- CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES, |
| 30 |
-- EVEN IF AXE CONSULTANTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 31 |
-- DAMAGES. |
| 32 |
-- |
| 33 |
-- A copy of the GNU General Public License is available in the file |
| 34 |
-- gpl-3-0.txt in the standard distribution of the ARM_Form tool. |
| 35 |
-- Otherwise, see <http://www.gnu.org/licenses/>. |
| 36 |
-- |
| 37 |
-- If the GPLv3 license is not satisfactory for your needs, a commercial |
| 38 |
-- use license is available for this tool. Contact Randy at AXE Consultants |
| 39 |
-- for more information. |
| 40 |
-- |
| 41 |
-- --------------------------------------- |
| 42 |
-- |
| 43 |
-- Edit History: |
| 44 |
-- |
| 45 |
-- 5/18/00 - RLB - Created package. |
| 46 |
-- 5/22/00 - RLB - Added Includes_Changes to Create. |
| 47 |
-- 5/23/00 - RLB - Added Set_Column and New_Column. |
| 48 |
-- - Added Tab_Info and Tab_Stops. |
| 49 |
-- 5/24/00 - RLB - Added Location to Text_Format. |
| 50 |
-- - RLB - Added No_Breaks and Keep_with_Next to Start_Paragraph. |
| 51 |
-- 5/25/00 - RLB - Added Big_Files to Create. Added Justification. |
| 52 |
-- - RLB - Added Separator_Lines and TOC routines. |
| 53 |
-- 5/26/00 - RLB - Added table operations. |
| 54 |
-- 6/ 2/00 - RLB - Added Soft_Line_Break. |
| 55 |
-- 8/ 2/00 - RLB - Added Soft_Hyphen_Break. |
| 56 |
-- 8/ 7/00 - RLB - Added Leading flag to Start_Paragraph. |
| 57 |
-- 8/17/00 - RLB - Replaced "Leading" by "Space_After". |
| 58 |
-- 8/22/00 - RLB - Added Revised_Clause_Header. |
| 59 |
-- 7/18/02 - RLB - Removed Document parameter from Create, replaced by |
| 60 |
-- three strings and For_ISO boolean. |
| 61 |
-- - RLB - Added AI_Reference. |
| 62 |
-- - RLB - Added Change_Version_Type and uses. |
| 63 |
-- 9/10/04 - RLB - Added "Both" to possible changes to handle |
| 64 |
-- replacement of changed text. |
| 65 |
-- 9/14/04 - RLB - Moved Change_Version_Type to ARM_Contents. |
| 66 |
-- 5/27/05 - RLB - Added arbitrary Unicode characters. |
| 67 |
-- 1/11/06 - RLB - Eliminated dispatching Create in favor of tailored |
| 68 |
-- versions. |
| 69 |
-- 1/13/06 - RLB - Added new Link operations. |
| 70 |
-- 2/ 8/06 - RLB - Added additional parameters to the table command. |
| 71 |
-- 2/10/06 - RLB - Added even more additional parameters to the |
| 72 |
-- table command. |
| 73 |
-- - RLB - Added picture command. |
| 74 |
-- 3/30/06 - RLB - Added shape id counter. |
| 75 |
-- 9/21/06 - RLB - Added Body_Font. |
| 76 |
-- 9/25/06 - RLB - Added Last_Column_Width to Start_Table. |
| 77 |
-- 10/13/06 - RLB - Added Local_Link_Start and Local_Link_End to allow |
| 78 |
-- formatting in the linked text. |
| 79 |
-- 2/ 9/07 - RLB - Changed comments on AI_Reference. |
| 80 |
-- 2/13/07 - RLB - Revised to separate style and indent information |
| 81 |
-- for paragraphs. |
| 82 |
-- 12/19/07 - RLB - Added limited colors to Text_Format. |
| 83 |
-- 5/ 4/09 - RLB - Added footer commands. |
| 84 |
-- 5/ 6/09 - RLB - Added version names. |
| 85 |
-- 10/18/11 - RLB - Changed to GPLv3 license. |
| 86 |
-- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header. |
| 87 |
-- 8/31/12 - RLB - Added Output_Path. |
| 88 |
-- 11/26/12 - RLB - Added subdivision names to Clause_Header and |
| 89 |
-- Revised_Clause_Header. |
| 90 |
|
| 91 |
type RTF_Output_Type is new ARM_Output.Output_Type with private; |
| 92 |
|
| 93 |
type Page_Size is (A4, Letter, Ada95, Half_Letter); |
| 94 |
-- A4 is standard European letter size. |
| 95 |
-- Letter is standard American letter size (8.5x11). |
| 96 |
-- Half_Letter is standard America half size (5.5x8.5). |
| 97 |
-- Ada95 is the size of the existing Ada 95 standard (7x9). |
| 98 |
|
| 99 |
type Serif_Fonts is (Times_New_Roman, Souvenir); |
| 100 |
type Sans_Serif_Fonts is (Arial, Helvetica); |
| 101 |
|
| 102 |
procedure Create (Output_Object : in out RTF_Output_Type; |
| 103 |
Page_Size : in ARM_RTF.Page_Size; |
| 104 |
Includes_Changes : in Boolean; |
| 105 |
Big_Files : in Boolean; |
| 106 |
File_Prefix : in String; |
| 107 |
Output_Path : in String; |
| 108 |
Primary_Sans_Serif_Font : in Sans_Serif_Fonts := Arial; |
| 109 |
Primary_Serif_Font : in Serif_Fonts := Times_New_Roman; |
| 110 |
Body_Font : in ARM_Output.Font_Family_Type := ARM_Output.Roman; |
| 111 |
Header_Prefix : in String := ""; |
| 112 |
Footer_Use_Date : in Boolean; |
| 113 |
Footer_Use_Clause_Name : in Boolean; |
| 114 |
Footer_Use_ISO_Format : in Boolean; |
| 115 |
Footer_Text : in String := ""; |
| 116 |
Version_Names : in ARM_Contents.Versioned_String; |
| 117 |
Title : in String := ""); |
| 118 |
-- Create an Output_Object for a document with the specified page |
| 119 |
-- size. Changes from the base document are included if |
| 120 |
-- Includes_Changes is True (otherwise no revisions are generated). |
| 121 |
-- Generate a few large output files if |
| 122 |
-- Big_Files is True; otherwise generate smaller output files. |
| 123 |
-- The prefix of the output file names is File_Prefix - this |
| 124 |
-- should be no more then 5 characters allowed in file names. |
| 125 |
-- The files will be written into Output_Path. |
| 126 |
-- The title of the document is Title. |
| 127 |
-- The header prefix appears in the header (if any) before the title, |
| 128 |
-- separated by a dash. |
| 129 |
-- The footer consists of the page number, the date if Footer_Use_Date |
| 130 |
-- is true, and the clause name if Footer_Use_Clase_Name is True, and |
| 131 |
-- the Footer_Text otherwise. The font and size of the footer is as |
| 132 |
-- an ISO standard if Footer_Use_ISO_Format is True, and as the |
| 133 |
-- Ada Reference Manual otherwise. |
| 134 |
-- The primary font used for the Sans_Serif text, and for the Serif |
| 135 |
-- text, is as specified. |
| 136 |
-- Which font is used for the body is specified by Body_Font. |
| 137 |
-- The author names of the various versions is specified by the |
| 138 |
-- Version_Names. |
| 139 |
|
| 140 |
procedure Close (Output_Object : in out RTF_Output_Type); |
| 141 |
-- Close an Output_Object. No further output to the object is |
| 142 |
-- allowed after this call. |
| 143 |
|
| 144 |
|
| 145 |
procedure Section (Output_Object : in out RTF_Output_Type; |
| 146 |
Section_Title : in String; |
| 147 |
Section_Name : in String); |
| 148 |
-- Start a new section. The title is Section_Title (this is |
| 149 |
-- intended for humans). The name is Section_Name (this is |
| 150 |
-- intended to be suitable to be a portion of a file name). |
| 151 |
|
| 152 |
procedure Set_Columns (Output_Object : in out RTF_Output_Type; |
| 153 |
Number_of_Columns : in ARM_Output.Column_Count); |
| 154 |
-- Set the number of columns. |
| 155 |
-- Raises Not_Valid_Error if in a paragraph. |
| 156 |
|
| 157 |
procedure Start_Paragraph (Output_Object : in out RTF_Output_Type; |
| 158 |
Style : in ARM_Output.Paragraph_Style_Type; |
| 159 |
Indent : in ARM_Output.Paragraph_Indent_Type; |
| 160 |
Number : in String; |
| 161 |
No_Prefix : in Boolean := False; |
| 162 |
Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS; |
| 163 |
No_Breaks : in Boolean := False; |
| 164 |
Keep_with_Next : in Boolean := False; |
| 165 |
Space_After : in ARM_Output.Space_After_Type |
| 166 |
:= ARM_Output.Normal; |
| 167 |
Justification : in ARM_Output.Justification_Type |
| 168 |
:= ARM_Output.Default); |
| 169 |
-- Start a new paragraph. The style and indent of the paragraph is as |
| 170 |
-- specified. The (AA)RM paragraph number (which might include update |
| 171 |
-- and version numbers as well: [12.1/1]) is Number. If the format is |
| 172 |
-- a type with a prefix (bullets, hangining items), the prefix is |
| 173 |
-- omitted if No_Prefix is true. Tab_Stops defines the tab stops for |
| 174 |
-- the paragraph. If No_Breaks is True, we will try to avoid page breaks |
| 175 |
-- in the paragraph. If Keep_with_Next is true, we will try to avoid |
| 176 |
-- separating this paragraph and the next one. (These may have no |
| 177 |
-- effect in formats that don't have page breaks). Space_After |
| 178 |
-- specifies the amount of space following the paragraph. Justification |
| 179 |
-- specifies the text justification for the paragraph. Not_Valid_Error |
| 180 |
-- is raised if Tab_Stops /= NO_TABS for a hanging or bulleted format. |
| 181 |
|
| 182 |
procedure End_Paragraph (Output_Object : in out RTF_Output_Type); |
| 183 |
-- End a paragraph. |
| 184 |
|
| 185 |
procedure Category_Header (Output_Object : in out RTF_Output_Type; |
| 186 |
Header_Text : String); |
| 187 |
-- Output a Category header (that is, "Legality Rules", |
| 188 |
-- "Dynamic Semantics", etc.) |
| 189 |
-- (Note: We did not use a enumeration here to insure that these |
| 190 |
-- headers are spelled the same in all output versions). |
| 191 |
-- Raises Not_Valid_Error if in a paragraph. |
| 192 |
|
| 193 |
procedure Clause_Header (Output_Object : in out RTF_Output_Type; |
| 194 |
Header_Text : in String; |
| 195 |
Level : in ARM_Contents.Level_Type; |
| 196 |
Clause_Number : in String; |
| 197 |
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; |
| 198 |
No_Page_Break : in Boolean := False); |
| 199 |
-- Output a Clause header. The level of the header is specified |
| 200 |
-- in Level. The Clause Number is as specified; the top-level (and |
| 201 |
-- other) subdivision names are as specified. These should appear in |
| 202 |
-- the table of contents. |
| 203 |
-- For hyperlinked formats, this should generate a link target. |
| 204 |
-- If No_Page_Break is True, suppress any page breaks. |
| 205 |
-- Raises Not_Valid_Error if in a paragraph. |
| 206 |
|
| 207 |
procedure Revised_Clause_Header |
| 208 |
(Output_Object : in out RTF_Output_Type; |
| 209 |
New_Header_Text : in String; |
| 210 |
Old_Header_Text : in String; |
| 211 |
Level : in ARM_Contents.Level_Type; |
| 212 |
Clause_Number : in String; |
| 213 |
Version : in ARM_Contents.Change_Version_Type; |
| 214 |
Old_Version : in ARM_Contents.Change_Version_Type; |
| 215 |
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; |
| 216 |
No_Page_Break : in Boolean := False); |
| 217 |
-- Output a revised clause header. Both the original and new text will |
| 218 |
-- be output. The level of the header is specified in Level. The Clause |
| 219 |
-- Number is as specified; the top-level (and other) subdivision names |
| 220 |
-- are as specified. These should appear in the table of contents. |
| 221 |
-- For hyperlinked formats, this should generate a link target. |
| 222 |
-- Version is the insertion version of the new text; Old_Version is |
| 223 |
-- the insertion version of the old text. |
| 224 |
-- If No_Page_Break is True, suppress any page breaks. |
| 225 |
-- Raises Not_Valid_Error if in a paragraph. |
| 226 |
|
| 227 |
procedure TOC_Marker (Output_Object : in out RTF_Output_Type; |
| 228 |
For_Start : in Boolean); |
| 229 |
-- Mark the start (if For_Start is True) or end (if For_Start is |
| 230 |
-- False) of the table of contents data. Output objects that |
| 231 |
-- auto-generate the table of contents can use this to do needed |
| 232 |
-- actions. |
| 233 |
|
| 234 |
procedure New_Page (Output_Object : in out RTF_Output_Type; |
| 235 |
Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page); |
| 236 |
-- Output a page break. |
| 237 |
-- Note that this has no effect on non-printing formats. |
| 238 |
-- Any_Page breaks to the top of the next page (whatever it is); |
| 239 |
-- Odd_Page_Only breaks to the top of the odd-numbered page; |
| 240 |
-- Soft_Page allows a page break but does not force one (use in |
| 241 |
-- "No_Breaks" paragraphs.) |
| 242 |
-- Raises Not_Valid_Error if in a paragraph if Kind = Any_Page or |
| 243 |
-- Odd_Page, and if not in a paragraph if Kind = Soft_Page. |
| 244 |
|
| 245 |
procedure New_Column (Output_Object : in out RTF_Output_Type); |
| 246 |
-- Output a column break. |
| 247 |
-- Raises Not_Valid_Error if in a paragraph, or if the number of |
| 248 |
-- columns is 1. |
| 249 |
|
| 250 |
procedure Separator_Line (Output_Object : in out RTF_Output_Type; |
| 251 |
Is_Thin : Boolean := True); |
| 252 |
-- Output a separator line. It is thin if "Is_Thin" is true. |
| 253 |
-- Raises Not_Valid_Error if in a paragraph. |
| 254 |
|
| 255 |
procedure Start_Table (Output_Object : in out RTF_Output_Type; |
| 256 |
Columns : in ARM_Output.Column_Count; |
| 257 |
First_Column_Width : in ARM_Output.Column_Count; |
| 258 |
Last_Column_Width : in ARM_Output.Column_Count; |
| 259 |
Alignment : in ARM_Output.Column_Text_Alignment; |
| 260 |
No_Page_Break : in Boolean; |
| 261 |
Has_Border : in Boolean; |
| 262 |
Small_Text_Size : in Boolean; |
| 263 |
Header_Kind : in ARM_Output.Header_Kind_Type); |
| 264 |
-- Starts a table. The number of columns is Columns; the first |
| 265 |
-- column has First_Column_Width times the normal column width, and |
| 266 |
-- the last column has Last_Column_Width times the normal column width. |
| 267 |
-- Alignment is the horizontal text alignment within the columns. |
| 268 |
-- No_Page_Break should be True to keep the table intact on a single |
| 269 |
-- page; False to allow it to be split across pages. |
| 270 |
-- Has_Border should be true if a border is desired, false otherwise. |
| 271 |
-- Small_Text_Size means that the contents will have the AARM size; |
| 272 |
-- otherwise it will have the normal size. |
| 273 |
-- Header_Kind determines whether the table has headers. |
| 274 |
-- This command starts a paragraph; the entire table is a single |
| 275 |
-- paragraph. Text will be considered part of the caption until the |
| 276 |
-- next table marker call. |
| 277 |
-- Raises Not_Valid_Error if in a paragraph. |
| 278 |
|
| 279 |
procedure Table_Marker (Output_Object : in out RTF_Output_Type; |
| 280 |
Marker : in ARM_Output.Table_Marker_Type); |
| 281 |
-- Marks the end of an entity in a table. |
| 282 |
-- If Marker is End_Caption, the table caption ends and the |
| 283 |
-- future text is part of the table header. |
| 284 |
-- If Marker is End_Header, the table header ends and the |
| 285 |
-- future text is part of the table body. |
| 286 |
-- If Marker is End_Row, a row in the table is completed, and another |
| 287 |
-- row started. |
| 288 |
-- If Marker is End_Item, an item in the table header or body is ended, |
| 289 |
-- and another started. |
| 290 |
-- If Marker is End_Table, the entire table is finished. |
| 291 |
-- Raises Not_Valid_Error if not in a table. |
| 292 |
|
| 293 |
-- Text output: These are only allowed after a Start_Paragraph and |
| 294 |
-- before any End_Paragraph. Raises Not_Valid_Error if not in a paragraph, |
| 295 |
-- or another error. |
| 296 |
|
| 297 |
procedure Ordinary_Text (Output_Object : in out RTF_Output_Type; |
| 298 |
Text : in String); |
| 299 |
-- Output ordinary text. |
| 300 |
-- The text must end at a word break, never in the middle of a word. |
| 301 |
|
| 302 |
procedure Ordinary_Character (Output_Object : in out RTF_Output_Type; |
| 303 |
Char : in Character); |
| 304 |
-- Output an ordinary character. |
| 305 |
-- Spaces will be used to break lines as needed. |
| 306 |
|
| 307 |
procedure Hard_Space (Output_Object : in out RTF_Output_Type); |
| 308 |
-- Output a hard space. No line break should happen at a hard space. |
| 309 |
|
| 310 |
procedure Line_Break (Output_Object : in out RTF_Output_Type); |
| 311 |
-- Output a line break. This does not start a new paragraph. |
| 312 |
-- This corresponds to a "<BR>" in RTF. |
| 313 |
|
| 314 |
procedure Index_Line_Break (Output_Object : in out RTF_Output_Type; |
| 315 |
Clear_Keep_with_Next : in Boolean); |
| 316 |
-- Output a line break for the index. This does not start a new |
| 317 |
-- paragraph in terms of spacing. This corresponds to a "<BR>" |
| 318 |
-- in HTML. If Clear_Keep_with_Next is true, insure that the next |
| 319 |
-- line does not require the following line to stay with it. |
| 320 |
-- Raises Not_Valid_Error if the paragraph is not in the index format. |
| 321 |
|
| 322 |
procedure Soft_Line_Break (Output_Object : in out RTF_Output_Type); |
| 323 |
-- Output a soft line break. This is a place (in the middle of a |
| 324 |
-- "word") that we allow a line break. It is usually used after |
| 325 |
-- underscores in long non-terminals. |
| 326 |
|
| 327 |
procedure Soft_Hyphen_Break (Output_Object : in out RTF_Output_Type); |
| 328 |
-- Output a soft line break, with a hyphen. This is a place (in the middle of |
| 329 |
-- a "word") that we allow a line break. If the line break is used, |
| 330 |
-- a hyphen will be added to the text. |
| 331 |
|
| 332 |
procedure Tab (Output_Object : in out RTF_Output_Type); |
| 333 |
-- Output a tab, inserting space up to the next tab stop. |
| 334 |
-- Raises Not_Valid_Error if the paragraph was created with |
| 335 |
-- Tab_Stops = ARM_Output.NO_TABS. |
| 336 |
|
| 337 |
procedure Special_Character (Output_Object : in out RTF_Output_Type; |
| 338 |
Char : in ARM_Output.Special_Character_Type); |
| 339 |
-- Output an special character. |
| 340 |
|
| 341 |
procedure Unicode_Character (Output_Object : in out RTF_Output_Type; |
| 342 |
Char : in ARM_Output.Unicode_Type); |
| 343 |
-- Output a Unicode character, with code position Char. |
| 344 |
|
| 345 |
procedure End_Hang_Item (Output_Object : in out RTF_Output_Type); |
| 346 |
-- Marks the end of a hanging item. Call only once per paragraph. |
| 347 |
-- Raises Not_Valid_Error if the paragraph style is not in |
| 348 |
-- Text_Prefixed_Style_Subtype, or if this has already been |
| 349 |
-- called for the current paragraph, or if the paragraph was started |
| 350 |
-- with No_Prefix = True. |
| 351 |
|
| 352 |
procedure Text_Format (Output_Object : in out RTF_Output_Type; |
| 353 |
Format : in ARM_Output.Format_Type); |
| 354 |
-- Change the text format so that all of the properties are as specified. |
| 355 |
-- Note: Changes to these properties ought be stack-like; that is, |
| 356 |
-- Bold on, Italic on, Italic off, Bold off is OK; Bold on, Italic on, |
| 357 |
-- Bold off, Italic off should be avoided (as separate commands). |
| 358 |
|
| 359 |
procedure Clause_Reference (Output_Object : in out RTF_Output_Type; |
| 360 |
Text : in String; |
| 361 |
Clause_Number : in String); |
| 362 |
-- Generate a reference to a clause in the standard. The text of |
| 363 |
-- the reference is "text", and the number of the clause is |
| 364 |
-- Clause_Number. For hyperlinked formats, this should generate |
| 365 |
-- a link; for other formats, the text alone is generated. |
| 366 |
|
| 367 |
procedure Index_Target (Output_Object : in out RTF_Output_Type; |
| 368 |
Index_Key : in Natural); |
| 369 |
-- Generate a index target. This marks the location where an index |
| 370 |
-- reference occurs. Index_Key names the index item involved. |
| 371 |
-- For hyperlinked formats, this should generate a link target; |
| 372 |
-- for other formats, nothing is generated. |
| 373 |
|
| 374 |
procedure Index_Reference (Output_Object : in out RTF_Output_Type; |
| 375 |
Text : in String; |
| 376 |
Index_Key : in Natural; |
| 377 |
Clause_Number : in String); |
| 378 |
-- Generate a reference to an index target in the standard. The text |
| 379 |
-- of the reference is "Text", and Index_Key and Clause_Number denotes |
| 380 |
-- the target. For hyperlinked formats, this should generate |
| 381 |
-- a link; for other formats, the text alone is generated. |
| 382 |
|
| 383 |
procedure DR_Reference (Output_Object : in out RTF_Output_Type; |
| 384 |
Text : in String; |
| 385 |
DR_Number : in String); |
| 386 |
-- Generate a reference to an DR from the standard. The text |
| 387 |
-- of the reference is "Text", and DR_Number denotes |
| 388 |
-- the target. For hyperlinked formats, this should generate |
| 389 |
-- a link; for other formats, the text alone is generated. |
| 390 |
|
| 391 |
procedure AI_Reference (Output_Object : in out RTF_Output_Type; |
| 392 |
Text : in String; |
| 393 |
AI_Number : in String); |
| 394 |
-- Generate a reference to an AI from the standard. The text |
| 395 |
-- of the reference is "Text", and AI_Number denotes |
| 396 |
-- the target (in unfolded format). For hyperlinked formats, this should |
| 397 |
-- generate a link; for other formats, the text alone is generated. |
| 398 |
|
| 399 |
procedure Local_Target (Output_Object : in out RTF_Output_Type; |
| 400 |
Text : in String; |
| 401 |
Target : in String); |
| 402 |
-- Generate a local target. This marks the potential target of local |
| 403 |
-- links identified by "Target". Text is the text of the target. |
| 404 |
-- For hyperlinked formats, this should generate a link target; |
| 405 |
-- for other formats, only the text is generated. |
| 406 |
|
| 407 |
procedure Local_Link (Output_Object : in out RTF_Output_Type; |
| 408 |
Text : in String; |
| 409 |
Target : in String; |
| 410 |
Clause_Number : in String); |
| 411 |
-- Generate a local link to the target and clause given. |
| 412 |
-- Text is the text of the link. |
| 413 |
-- For hyperlinked formats, this should generate a link; |
| 414 |
-- for other formats, only the text is generated. |
| 415 |
|
| 416 |
procedure Local_Link_Start (Output_Object : in out RTF_Output_Type; |
| 417 |
Target : in String; |
| 418 |
Clause_Number : in String); |
| 419 |
-- Generate a local link to the target and clause given. |
| 420 |
-- The link will surround text until Local_Link_End is called. |
| 421 |
-- Local_Link_End must be called before this routine can be used again. |
| 422 |
-- For hyperlinked formats, this should generate a link; |
| 423 |
-- for other formats, only the text is generated. |
| 424 |
|
| 425 |
procedure Local_Link_End (Output_Object : in out RTF_Output_Type; |
| 426 |
Target : in String; |
| 427 |
Clause_Number : in String); |
| 428 |
-- End a local link for the target and clause given. |
| 429 |
-- This must be in the same paragraph as the Local_Link_Start. |
| 430 |
-- For hyperlinked formats, this should generate a link; |
| 431 |
-- for other formats, only the text is generated. |
| 432 |
|
| 433 |
procedure URL_Link (Output_Object : in out RTF_Output_Type; |
| 434 |
Text : in String; |
| 435 |
URL : in String); |
| 436 |
-- Generate a link to the URL given. |
| 437 |
-- Text is the text of the link. |
| 438 |
-- For hyperlinked formats, this should generate a link; |
| 439 |
-- for other formats, only the text is generated. |
| 440 |
|
| 441 |
procedure Picture (Output_Object : in out RTF_Output_Type; |
| 442 |
Name : in String; |
| 443 |
Descr : in String; |
| 444 |
Alignment : in ARM_Output.Picture_Alignment; |
| 445 |
Height, Width : in Natural; |
| 446 |
Border : in ARM_Output.Border_Kind); |
| 447 |
-- Generate a picture. |
| 448 |
-- Name is the (simple) file name of the picture; Descr is a |
| 449 |
-- descriptive name for the picture (it will appear in some web |
| 450 |
-- browsers). |
| 451 |
-- We assume that it is a .PNG or .JPG and that it will be present |
| 452 |
-- in the same directory as the output files. |
| 453 |
-- Alignment specifies the picture alignment. |
| 454 |
-- Height and Width specify the picture size in pixels. |
| 455 |
-- Border specifies the kind of border. |
| 456 |
|
| 457 |
private |
| 458 |
|
| 459 |
subtype Prefix_String is String(1..5); |
| 460 |
type RTF_Output_Type is new ARM_Output.Output_Type with record |
| 461 |
Is_Valid : Boolean := False; |
| 462 |
Is_In_Paragraph : Boolean := False; |
| 463 |
Paragraph_Style : ARM_Output.Paragraph_Style_Type := ARM_Output.Normal; |
| 464 |
Paragraph_Indent : ARM_Output.Paragraph_Indent_Type := 0; |
| 465 |
Had_Prefix : Boolean := False; -- If in paragraph, value of (not No_Prefix). |
| 466 |
Wrote_into_Section : Boolean := False; -- Have we written into the |
| 467 |
-- current section yet? |
| 468 |
Column_Count : ARM_Output.Column_Count := 1; -- Number of columns in current section. |
| 469 |
|
| 470 |
Output_File : Ada.Text_IO.File_Type; |
| 471 |
Big_Files : Boolean; -- For RTF, this means to generate a single monster file. |
| 472 |
File_Prefix : Prefix_String; -- Blank padded. |
| 473 |
Output_Path : Ada.Strings.Unbounded.Unbounded_String; |
| 474 |
|
| 475 |
Title : Ada.Strings.Unbounded.Unbounded_String; |
| 476 |
Header_Prefix : Ada.Strings.Unbounded.Unbounded_String; |
| 477 |
Footer_Use_Date : Boolean; |
| 478 |
Footer_Use_Clause_Name : Boolean; |
| 479 |
Footer_Use_ISO_Format : Boolean; |
| 480 |
Footer_Text : Ada.Strings.Unbounded.Unbounded_String; |
| 481 |
Page_Size : ARM_RTF.Page_Size; |
| 482 |
Version_Names : ARM_Contents.Versioned_String; |
| 483 |
Includes_Changes : Boolean; |
| 484 |
Primary_Sans_Serif_Font : Sans_Serif_Fonts; |
| 485 |
Primary_Serif_Font : Serif_Fonts; |
| 486 |
Body_Font : ARM_Output.Font_Family_Type; |
| 487 |
For_ISO : Boolean; |
| 488 |
Char_Count : Natural := 0; -- Characters on current line. |
| 489 |
Saw_Hang_End : Boolean := False; -- If we are in a hanging paragraph, |
| 490 |
-- have we seen the end of the hanging part yet? |
| 491 |
Current_Space_After : ARM_Output.Space_After_Type := ARM_Output.Normal; |
| 492 |
-- The value of Space_After for the current |
| 493 |
-- paragraph. |
| 494 |
Prefix_Large_Char_Count : Natural := 0; |
| 495 |
-- If we're in a hanging paragraph, and Saw_Hang_End is False, |
| 496 |
-- this is a count of the large (capitals, mostly) characters |
| 497 |
-- visible in the prefix. |
| 498 |
Is_Bold : Boolean; -- Is the text currently bold? |
| 499 |
Is_Italic : Boolean; -- Is the text current italics? |
| 500 |
Font : ARM_Output.Font_Family_Type; -- What is the current font family? |
| 501 |
Size : ARM_Output.Size_Type; -- What is the current relative size? |
| 502 |
Real_Size : Natural; -- What is the current size in halfpoints? |
| 503 |
Color : ARM_Output.Color_Type; -- What is the current text color? |
| 504 |
Change : ARM_Output.Change_Type := ARM_Output.None; |
| 505 |
Version : ARM_Contents.Change_Version_Type := '0'; |
| 506 |
Added_Version : ARM_Contents.Change_Version_Type := '0'; |
| 507 |
Location : ARM_Output.Location_Type := ARM_Output.Normal; |
| 508 |
Tab_Stops : ARM_Output.Tab_Info := ARM_Output.NO_TABS; |
| 509 |
-- Tables: |
| 510 |
Is_In_Table : Boolean := False; -- Are we processing a table? |
| 511 |
Table_Width : Natural := 0; -- The width of the table, in twips. |
| 512 |
Table_Indent : Natural := 0; -- The indent of the table, in twips. |
| 513 |
Table_Column_Width : Natural := 0; -- The column width of the table, in twips. |
| 514 |
Table_First_Column_Mult : ARM_Output.Column_Count := 1; -- The multiple of the first column. |
| 515 |
Table_Last_Column_Mult : ARM_Output.Column_Count := 1; -- The multiple of the last column. |
| 516 |
Table_Alignment : ARM_Output.Column_Text_Alignment := ARM_Output.Center_All; |
| 517 |
Table_No_Page_Break : Boolean := False; -- Is a page break allowed in the table? |
| 518 |
Table_Has_Border : Boolean := False; -- Does the table have a border? |
| 519 |
Table_Has_Small_Text : Boolean := False; -- Does the table have small text? |
| 520 |
-- Pictures: |
| 521 |
Last_Shape_Id : Natural := 1024; -- Shape ids. |
| 522 |
end record; |
| 523 |
|
| 524 |
end ARM_RTF; |