001: /**
002: * ===========================================
003: * JFreeReport : a free Java reporting library
004: * ===========================================
005: *
006: * Project Info: http://reporting.pentaho.org/
007: *
008: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
009: *
010: * This library is free software; you can redistribute it and/or modify it under the terms
011: * of the GNU Lesser General Public License as published by the Free Software Foundation;
012: * either version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
015: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: * See the GNU Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public License along with this
019: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020: * Boston, MA 02111-1307, USA.
021: *
022: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023: * in the United States and other countries.]
024: *
025: * ------------
026: * DefaultLayoutSupport.java
027: * ------------
028: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029: */package org.jfree.report.layout;
030:
031: import org.jfree.report.style.FontDefinition;
032:
033: /**
034: * The DefaultLayoutSupport uses the AWT to estaminate the content sizes. A LayoutSupport
035: * contains all methods required to estaminate sizes for the content-creation.
036: *
037: * @author Thomas Morgner
038: */
039: public class DefaultLayoutSupport implements LayoutSupport {
040: private boolean useMaxLineHeight;
041: private boolean imageResolutionMapping;
042:
043: /**
044: * Default-Constructor.
045: */
046: public DefaultLayoutSupport(final boolean useMaxLineHeight,
047: final boolean imageResolutionMapping) {
048: this .imageResolutionMapping = imageResolutionMapping;
049: this .useMaxLineHeight = useMaxLineHeight;
050: }
051:
052: /**
053: * Creates a size calculator for the current state of the output target. The calculator
054: * is used to calculate the string width and line height and later maybe more...
055: *
056: * @param font the font.
057: * @return the size calculator.
058: *
059: * @throws SizeCalculatorException if there is a problem with the output target.
060: */
061: public SizeCalculator createTextSizeCalculator(
062: final FontDefinition font) throws SizeCalculatorException {
063: return DefaultSizeCalculator.getDefaultSizeCalculator(font,
064: useMaxLineHeight);
065: }
066:
067: /**
068: * Returns the element alignment. Elements will be layouted aligned to this border, so
069: * that <code>mod(X, horizontalAlignment) == 0</code> and <code>mod(Y,
070: * verticalAlignment) == 0</code>. Returning 0 will disable the alignment.
071: *
072: * @return the vertical alignment grid boundry
073: */
074: public float getVerticalAlignmentBorder() {
075: return 0;
076: }
077:
078: /**
079: * Returns the element alignment. Elements will be layouted aligned to this border, so
080: * that <code>mod(X, horizontalAlignment) == 0</code> and <code>mod(Y,
081: * verticalAlignment) == 0</code>. Returning 0 will disable the alignment.
082: *
083: * @return the vertical alignment grid boundry
084: */
085: public float getHorizontalAlignmentBorder() {
086: return 0;
087: }
088:
089: /**
090: * Returns the element alignment. Elements will be layouted aligned to this border, so
091: * that <code>mod(X, horizontalAlignment) == 0</code> and <code>mod(Y,
092: * verticalAlignment) == 0</code>. Returning 0 will disable the alignment.
093: * <p/>
094: * Q&D Hack: Save some cycles of processor time by computing that thing only once.
095: *
096: * @return the vertical alignment grid boundry
097: */
098: public long getInternalHorizontalAlignmentBorder() {
099: return 0;
100: }
101:
102: /**
103: * Returns the element alignment. Elements will be layouted aligned to this border, so
104: * that <code>mod(X, horizontalAlignment) == 0</code> and <code>mod(Y,
105: * verticalAlignment) == 0</code>. Returning 0 will disable the alignment.
106: * <p/>
107: * Q&D Hack: Save some cycles of processor time by computing that thing only once.
108: *
109: * @return the vertical alignment grid boundry
110: */
111: public long getInternalVerticalAlignmentBorder() {
112: return 0;
113: }
114:
115: public boolean isImageResolutionMappingActive() {
116: return imageResolutionMapping;
117: }
118: }
|