package net.sf.jpluck.plucker;
import net.sf.jpluck.plucker.functions.Align;
import net.sf.jpluck.plucker.functions.EmbeddedImage;
import net.sf.jpluck.plucker.functions.EmbeddedTable;
import net.sf.jpluck.plucker.functions.Font;
import net.sf.jpluck.plucker.functions.Function;
import net.sf.jpluck.plucker.functions.HorizontalRule;
import net.sf.jpluck.plucker.functions.LinkEnd;
import net.sf.jpluck.plucker.functions.LinkStart;
import net.sf.jpluck.plucker.functions.Margin;
import net.sf.jpluck.plucker.functions.Newline;
import net.sf.jpluck.plucker.functions.NoArgumentFunction;
import net.sf.jpluck.plucker.functions.ParagraphLinkStart;
import net.sf.jpluck.plucker.functions.TextColor;
import java.awt.Color;
public class Functions {
private static final LinkEnd LINK_END = new LinkEnd();
private static final NoArgumentFunction NEW_LINE = new Newline();
private static final NoArgumentFunction ITALIC_START = new NoArgumentFunction(Function.ITALIC_BEGINS);
private static final NoArgumentFunction ITALIC_END = new NoArgumentFunction(Function.ITALIC_ENDS);
private static final NoArgumentFunction UNDERLINE_START = new NoArgumentFunction(Function.UNDERLINE_BEGINS);
private static final NoArgumentFunction UNDERLINE_END = new NoArgumentFunction(Function.UNDERLINE_ENDS);
private static final NoArgumentFunction STRIKETHROUGH_START = new NoArgumentFunction(Function.STRIKETHROUGH_BEGINS);
private static final NoArgumentFunction STRIKETHROUGH_END = new NoArgumentFunction(Function.STRIKETHROUGH_ENDS);
private static final Font FONT_REGULAR = new Font(Font.REGULAR);
private static final Font FONT_H1 = new Font(Font.H1);
private static final Font FONT_H2 = new Font(Font.H2);
private static final Font FONT_H3 = new Font(Font.H3);
private static final Font FONT_H4 = new Font(Font.H4);
private static final Font FONT_H5 = new Font(Font.H5);
private static final Font FONT_H6 = new Font(Font.H6);
private static final Font FONT_BOLD = new Font(Font.BOLD);
private static final Font FONT_FIXED_WIDTH = new Font(Font.FIXED_WIDTH);
//private static final Font FONT_SMALL = new Font(Font.SMALL);
private static final Font FONT_SUBSCRIPT = new Font(Font.SUBSCRIPT);
private static final Font FONT_SUPERSCRIPT = new Font(Font.SUPERSCRIPT);
private static final Align ALIGN_LEFT = new Align(Align.LEFT);
private static final Align ALIGN_RIGHT = new Align(Align.RIGHT);
private static final Align ALIGN_CENTER = new Align(Align.CENTER);
private static final Align ALIGN_JUSTIFY = new Align(Align.JUSTIFY);
public static final TextColor TEXT_COLOR_BLACK = new TextColor(0, 0, 0);
public static final TextColor TEXT_COLOR_RED = new TextColor(255, 0, 0);
public static final TextColor TEXT_COLOR_BLUE = new TextColor(0, 0, 255);
private Functions() {
// Private constructor to prevent instantiation and subclassing.
}
public static EmbeddedImage embeddedImage(String uri) {
return new EmbeddedImage(uri);
}
public static EmbeddedTable table(String uri) {
return new EmbeddedTable(uri);
}
public static LinkStart linkStart(String uri) {
return new LinkStart(uri);
}
public static ParagraphLinkStart linkStart(String uri, int paragraphNumber) {
return new ParagraphLinkStart(uri, paragraphNumber);
}
public static NoArgumentFunction linkEnd() {
return LINK_END;
}
public static NoArgumentFunction newline() {
return NEW_LINE;
}
public static final NoArgumentFunction italicStart() {
return ITALIC_START;
}
public static final NoArgumentFunction italicEnd() {
return ITALIC_END;
}
public static final NoArgumentFunction underlineStart() {
return UNDERLINE_START;
}
public static final NoArgumentFunction underlineEnd() {
return UNDERLINE_END;
}
public static final NoArgumentFunction strikethroughStart() {
return STRIKETHROUGH_START;
}
public static final NoArgumentFunction strikethroughEnd() {
return STRIKETHROUGH_END;
}
public static final Font fontRegular() {
return FONT_REGULAR;
}
public static final Font fontH1() {
return FONT_H1;
}
public static final Font fontH2() {
return FONT_H2;
}
public static final Font fontH3() {
return FONT_H3;
}
public static final Font fontH4() {
return FONT_H4;
}
public static final Font fontH5() {
return FONT_H5;
}
public static final Font fontH6() {
return FONT_H6;
}
public static final Font fontBold() {
return FONT_BOLD;
}
public static final Font fontFixedWidth() {
return FONT_FIXED_WIDTH;
}
// Small fonts are not supported by the viewer for now so we leave it out for the time being
/*public static final Font fontSmall() {
return FONT_SMALL;
}*/
public static final Font fontSubscript() {
return FONT_SUBSCRIPT;
}
public static final Font fontSuperScript() {
return FONT_SUPERSCRIPT;
}
public static final Align alignLeft() {
return ALIGN_LEFT;
}
public static final Align alignRight() {
return ALIGN_RIGHT;
}
public static final Align alignCenter() {
return ALIGN_CENTER;
}
public static final Align alignJustify() {
return ALIGN_JUSTIFY;
}
public static final TextColor textColor(int red, int green, int blue) {
return new TextColor(red, green, blue);
}
public static final TextColor textColor(Color color) {
return new TextColor(color);
}
public static final Margin margin(int left, int right) {
return new Margin(left, right);
}
public static final HorizontalRule horizontalRuleRelative(int height, int width) {
return new HorizontalRule(height, width, true);
}
public static final HorizontalRule horizontalRuleAbsolute(int height, int width) {
return new HorizontalRule(height, width, false);
}
}