OpenPetra
Free Administration Software for Non-Profits
|
The TTxtPrinter class allows to freely position text in a file. More...
Public Member Functions | |
TTxtPrinter () | |
constructor More... | |
override void | Init (eOrientation AOrientation, TPrinterLayout APrinterLayout, eMarginType AMarginType) |
set the orientation of the page More... | |
override float | LineFeed () |
Line Feed; increases the current y position by one More... | |
override float | LineFeed (eFont AFont) |
Line Feed; increases the current y position by one More... | |
override float | LineSpaceFeed (eFont AFont) |
Line Feed, but not full line; increases the current y position by half the height of the given font More... | |
override float | LineUnFeed (eFont AFont) |
Reverse Line Feed; decreases the current y position by the height of the given font More... | |
override Boolean | ValidXPos (float APosition) |
Is the given position still on the page? More... | |
override Boolean | ValidYPos () |
Is the current line still on the page? More... | |
override float | LineFeedToPageFooter () |
Jump to the position where the page footer starts. SetPageFooterSpace is used to define the space reserved for the footer. More... | |
override void | SetPageFooterSpace (System.Int32 ANumberOfLines, eFont AFont) |
Set the space that is required by the page footer. ValidYPos will consider this value. More... | |
override void | SetHasMorePages (bool AHasMorePages) |
Tell the printer, that there are more pages coming More... | |
override bool | HasMorePages () |
not implemented More... | |
override float | Cm (float AValueInCm) |
Converts the given value in cm to the currently used measurement unit (here only letters) More... | |
override float | PixelHorizontal (float AWidth) |
convert pixels to inches or other unit used for output More... | |
override float | PixelVertical (float AHeight) |
convert pixels to inches or other unit used for output More... | |
string | GetLine (Int32 y) |
retrieve a complete line from the text in memory More... | |
void | SetLine (Int32 y, string line) |
write a complete line; overwrites any existing line More... | |
bool | InsertLineForMarkingLine (float AYPos) |
Insert a line that can be used for lines, ie. ====== More... | |
void | Print (Int32 x, Int32 y, string s) |
write text to a specified position More... | |
override Boolean | PrintString (String ATxt, eFont AFont, eAlignment AAlign) |
prints into the current line, aligned x position More... | |
override bool | PrintString (String ATxt, eFont AFont, float AXPos, float AWidth, eAlignment AAlign) |
prints into the current line, absolute x position with width and alignment More... | |
override Boolean | PrintString (String ATxt, eFont AFont, float AXPos) |
prints into the current line, absolute x position More... | |
override bool | PrintStringWrap (String ATxt, eFont AFont, float AXPos, float AWidth, eAlignment AAlign) |
prints into the current line, absolute x position with width and alignment this method uses FCurrentXPos and FCurrentYPos to be able to continue a paragraph uses FCurrentXPos and FCurrentYPos to know where to start to print, and also sets valid values in those member variables More... | |
override Boolean | PrintStringAndFits (String ATxt, eFont AFont, float AXPos, float AWidth, eAlignment AAlign) |
This function uses the normal PrintString function to print into a given space. More... | |
override float | GetWidthString (String ATxt, eFont AFont) |
Return the width of the string, if it was printed in one line, using the given Font More... | |
override Boolean | DrawLine (float AXPos1, float AXPos2, eLinePosition ALinePosition, eFont AFont) |
Draws a line, either above or below the current text line the font is required to get the height of the row More... | |
void | WriteToFile (string filename) |
finally write the text from memory into a file More... | |
String[] | GetArrayOfString () |
copies the generated report into an array of strings. More... | |
String | GetString () |
copies the generated report into a single string seperated with line breaks. More... | |
virtual void | SaveState () |
save the state before a rotation etc More... | |
virtual void | RestoreState () |
restore the state after a rotation etc More... | |
virtual void | RotateAtTransform (double ADegrees, double XPos, double YPos) |
rotate the following output by some degrees, at the given position More... | |
float | LineFeed (float height) |
Line Feed; increases the current y position by the given height More... | |
virtual void | DrawLine (Int32 APenPixels, float AXPos1, float AYPos1, float AXPos2, float AYPos2) |
Draws a line, at specified position More... | |
virtual void | DrawRectangle (Int32 APenPixels, float AXPos, float AYPos, float AWidth, float AHeight) |
draws a rectangle More... | |
virtual void | DrawBitmap (string APath, float AXPos, float AYPos) |
todoComment More... | |
virtual void | DrawBitmap (string APath, float AXPos, float AYPos, float AWidth, float AHeight, float AWidthPercentage, float AHeightPercentage) |
Draw a bitmap. More... | |
void | StartSimulatePrinting () |
start the simulation of printing; nothing is actually printed, but the CurrentYPos is increased More... | |
void | FinishSimulatePrinting () |
finish the simulation of printing; the actual CurrentYPos is restored More... | |
void | PushCurrentState () |
store the current printer state (font size etc) More... | |
void | PopCurrentState () |
return to previous printer state; this is used for printing table cells More... | |
void | PopCurrentStateApartFromYPosition () |
return to previous printer state; but keep the new y position (used eg. for printing the page header) More... | |
float | Inch (float AValueInInch) |
Converts the given value in inch to the currently used measurement unit; uses Inch2Cm and Cm More... | |
virtual void | InsertDocument (string AFilename) |
insert another document into the current document. At the moment only used for PDF More... | |
virtual float | PrintTable (float AXPos, float AWidthAvailable, List< TTableRowGfx >rows, out Int32 ARowsFittingOnPage) |
renders a table at the current FCurrentYPos does not support rowspan at the moment colspan might be implemented in the generation of the TTableRowGfx structure does not care about fitting on page etc. More... | |
Static Public Member Functions | |
static float | Cm2Inch (float AValueInCm) |
Converts the given value in cm to the equivalent value in inches More... | |
static float | Inch2Cm (float AValueInInch) |
Converts the given value in inches to the equivalent value in centimeters More... | |
Static Public Attributes | |
const Int16 | NumberOfCharactersPerLineLandscape = 163 |
todoComment More... | |
const Int16 | NumberOfCharactersPerLinePortrait = 112 |
todoComment More... | |
const Int16 | DEFAULT_LENGTH_LINE = 800 |
todoComment More... | |
const float | FACTOR_CM_2_LETTER = 2.0f |
todoComment More... | |
Protected Member Functions | |
float | CalculateXPos (float AXPos, float AWidth, String ATxt, eAlignment AAlign) |
Calculate the x position for a text, considering the width of the space and the width of the text, and the alignment More... | |
String | GetFittedText (String ATxt, eFont AFont, float AWidth) |
Check if the text will fit into the given width. If yes, the text will be returned. If no, the text will be shortened and a "..." will be added to indicate that some text is missing. More... | |
String | CutTextToLength (String ATxt, eFont AFont, float AWidth) |
Cuts a given text so it will not extend the given width. More... | |
Int32 | GetTextLengthThatWillFit (String ATxt, eFont AFont, float AWidth, out Int32 firstWordLength) |
word wrap text, return the number of characters that fit the line width More... | |
Protected Attributes | |
eOrientation | FOrientation |
todoComment More... | |
eMarginType | FMarginType |
use printable area or default margins More... | |
Int32 | FNumberOfPages |
todoComment More... | |
float | FPageFooterSpace |
how much space is needed for the footer lines; footerspace = font.height number of lines More... | |
float | FLeftMargin |
todoComment More... | |
float | FTopMargin |
todoComment More... | |
float | FRightMargin |
todoComment More... | |
float | FBottomMargin |
todoComment More... | |
float | FWidth |
todoComment More... | |
float | FHeight |
todoComment More... | |
TPrinterLayout | FPrinterLayout |
todoComment More... | |
TPrinterState | FCurrentState = new TPrinterState() |
current state of printer More... | |
PrintAction | FprintAction |
I can check whether I'm printing to a preview or a real printer. More... | |
Properties | |
System.Int32 | CurrentPageNr [get, set] |
todoComment More... | |
System.Int32 | CurrentDocumentNr [get, set] |
a document can consist of several pages; a document is one body element More... | |
System.Int32 | NumberOfPages [get, set] |
this only has a valid value after the first rendering of the report More... | |
float | CurrentYPos [get, set] |
todoComment More... | |
float | CurrentXPos [get, set] |
todoComment More... | |
float | AnchorXPos [get, set] |
other elements can be positioned relative to this position More... | |
float | AnchorYPos [get, set] |
other elements can be positioned relative to this position More... | |
float | LeftMargin [get] |
todoComment More... | |
float | RightMargin [get] |
todoComment More... | |
eFont | CurrentFont [get, set] |
todoComment More... | |
float | CurrentLineHeight [get, set] |
1 is the normal height of the font, CurrentLineHeight is multiplied with the height of the font More... | |
float | CurrentRelativeFontSize [get, set] |
the relative font size; 0 is default size More... | |
eAlignment | CurrentAlignment [get, set] |
todoComment More... | |
ePrintingMode | PrintingMode [get, set] |
this is about simulation or printing More... | |
float | Width [get] |
todoComment More... | |
float | PageFooterSpace [get] |
todoComment More... | |
The TTxtPrinter class allows to freely position text in a file.
The printing is done in memory, and in the end the result is written to a file. That way the centering and aligning is possible, and jumping between lines is possible as well.
|
inline |
constructor
|
inlineprotected |
Calculate the x position for a text, considering the width of the space and the width of the text, and the alignment
|
inlinevirtual |
Converts the given value in cm to the currently used measurement unit (here only letters)
Implements Ict.Common.Printing.TPrinter.
|
inlinestaticinherited |
Converts the given value in cm to the equivalent value in inches
|
inlineprotected |
Cuts a given text so it will not extend the given width.
ATxt | The text to cut |
AFont | The font used |
AWidth | The available length for the text in cm. |
|
inlinevirtualinherited |
todoComment
APath | |
AXPos | |
AYPos |
Reimplemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TPdfPrinter.
|
inlinevirtualinherited |
Draw a bitmap.
Either Width or WidthPercentage should be unequals 0, but only one should have a value. Same applies to Height
Reimplemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TPdfPrinter.
|
inlinevirtual |
Draws a line, either above or below the current text line the font is required to get the height of the row
Implements Ict.Common.Printing.TPrinter.
|
inlinevirtualinherited |
Draws a line, at specified position
Reimplemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TPdfPrinter.
|
inlinevirtualinherited |
draws a rectangle
Reimplemented in Ict.Common.Printing.TGfxPrinter, and Ict.Common.Printing.TPdfPrinter.
|
inlineinherited |
finish the simulation of printing; the actual CurrentYPos is restored
|
inline |
copies the generated report into an array of strings.
|
inlineprotected |
Check if the text will fit into the given width. If yes, the text will be returned. If no, the text will be shortened and a "..." will be added to indicate that some text is missing.
ATxt | the original text |
AFont | the font |
AWidth | the space available for the text in cm |
|
inline |
retrieve a complete line from the text in memory
|
inline |
copies the generated report into a single string seperated with line breaks.
|
inlineprotected |
word wrap text, return the number of characters that fit the line width
ATxt | |
AFont | |
AWidth | |
firstWordLength | returns the length of the first word; this is needed if even the first word does not fit |
|
inlinevirtual |
Return the width of the string, if it was printed in one line, using the given Font
Implements Ict.Common.Printing.TPrinter.
|
inlinevirtual |
|
inlineinherited |
Converts the given value in inch to the currently used measurement unit; uses Inch2Cm and Cm
|
inlinestaticinherited |
Converts the given value in inches to the equivalent value in centimeters
|
inlinevirtual |
set the orientation of the page
Reimplemented from Ict.Common.Printing.TPrinter.
|
inlinevirtualinherited |
insert another document into the current document. At the moment only used for PDF
AFilename |
Reimplemented in Ict.Common.Printing.TPdfPrinter.
|
inline |
Insert a line that can be used for lines, ie. ======
If a line has already been inserted in that position, don't do anything. Otherwise move the text down, and create a new empty line in the given place AYPos
|
inlinevirtual |
Line Feed; increases the current y position by one
Reimplemented from Ict.Common.Printing.TPrinter.
|
inlinevirtual |
Line Feed; increases the current y position by one
Implements Ict.Common.Printing.TPrinter.
|
inlineinherited |
Line Feed; increases the current y position by the given height
|
inlinevirtual |
Jump to the position where the page footer starts. SetPageFooterSpace is used to define the space reserved for the footer.
Implements Ict.Common.Printing.TPrinter.
|
inlinevirtual |
Line Feed, but not full line; increases the current y position by half the height of the given font
Implements Ict.Common.Printing.TPrinter.
|
inlinevirtual |
Reverse Line Feed; decreases the current y position by the height of the given font
Implements Ict.Common.Printing.TPrinter.
|
inlinevirtual |
convert pixels to inches or other unit used for output
AWidth |
Implements Ict.Common.Printing.TPrinter.
|
inlinevirtual |
convert pixels to inches or other unit used for output
Implements Ict.Common.Printing.TPrinter.
|
inlineinherited |
return to previous printer state; this is used for printing table cells
|
inlineinherited |
return to previous printer state; but keep the new y position (used eg. for printing the page header)
|
inline |
write text to a specified position
|
inlinevirtual |
prints into the current line, aligned x position
Implements Ict.Common.Printing.TPrinter.
|
inlinevirtual |
prints into the current line, absolute x position
Implements Ict.Common.Printing.TPrinter.
|
inlinevirtual |
prints into the current line, absolute x position with width and alignment
Implements Ict.Common.Printing.TPrinter.
|
inlinevirtual |
This function uses the normal PrintString function to print into a given space.
Implements Ict.Common.Printing.TPrinter.
|
inlinevirtual |
prints into the current line, absolute x position with width and alignment this method uses FCurrentXPos and FCurrentYPos to be able to continue a paragraph uses FCurrentXPos and FCurrentYPos to know where to start to print, and also sets valid values in those member variables
Reimplemented from Ict.Common.Printing.TPrinter.
|
inlinevirtualinherited |
renders a table at the current FCurrentYPos does not support rowspan at the moment colspan might be implemented in the generation of the TTableRowGfx structure does not care about fitting on page etc.
AXPos | the X position to start the table |
AWidthAvailable | AWidthAvailable |
rows | |
ARowsFittingOnPage | number of rows that fitted on the page |
|
inlineinherited |
store the current printer state (font size etc)
|
inlinevirtualinherited |
restore the state after a rotation etc
Reimplemented in Ict.Common.Printing.TPdfPrinter.
|
inlinevirtualinherited |
rotate the following output by some degrees, at the given position
Reimplemented in Ict.Common.Printing.TPdfPrinter.
|
inlinevirtualinherited |
save the state before a rotation etc
Reimplemented in Ict.Common.Printing.TPdfPrinter.
|
inlinevirtual |
Tell the printer, that there are more pages coming
Implements Ict.Common.Printing.TPrinter.
|
inline |
write a complete line; overwrites any existing line
|
inlinevirtual |
Set the space that is required by the page footer. ValidYPos will consider this value.
Implements Ict.Common.Printing.TPrinter.
|
inlineinherited |
start the simulation of printing; nothing is actually printed, but the CurrentYPos is increased
|
inlinevirtual |
|
inlinevirtual |
|
inline |
finally write the text from memory into a file
|
static |
todoComment
|
static |
todoComment
|
protectedinherited |
todoComment
|
protectedinherited |
current state of printer
|
protectedinherited |
todoComment
|
protectedinherited |
todoComment
|
protectedinherited |
use printable area or default margins
|
protectedinherited |
todoComment
|
protectedinherited |
todoComment
|
protectedinherited |
how much space is needed for the footer lines; footerspace = font.height number of lines
|
protectedinherited |
I can check whether I'm printing to a preview or a real printer.
|
protectedinherited |
todoComment
|
protectedinherited |
todoComment
|
protectedinherited |
todoComment
|
protectedinherited |
todoComment
|
static |
todoComment
|
static |
todoComment
|
getsetinherited |
other elements can be positioned relative to this position
|
getsetinherited |
other elements can be positioned relative to this position
|
getsetinherited |
todoComment
|
getsetinherited |
a document can consist of several pages; a document is one body element
|
getsetinherited |
todoComment
|
getsetinherited |
1 is the normal height of the font, CurrentLineHeight is multiplied with the height of the font
|
getsetinherited |
todoComment
|
getsetinherited |
the relative font size; 0 is default size
|
getsetinherited |
todoComment
|
getsetinherited |
todoComment
|
getinherited |
todoComment
|
getsetinherited |
this only has a valid value after the first rendering of the report
|
getinherited |
todoComment
|
getsetinherited |
this is about simulation or printing
|
getinherited |
todoComment
|
getinherited |
todoComment