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: * LegacyLayoutSupport.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.layout.output.OutputProcessorFeature;
032: import org.jfree.report.layout.output.OutputProcessorMetaData;
033: import org.jfree.report.style.FontDefinition;
034:
035: /**
036: * Creation-Date: 08.04.2007, 15:49:03
037: *
038: * @author Thomas Morgner
039: */
040: public class LegacyLayoutSupport implements LayoutSupport {
041: private OutputProcessorMetaData outputProcessorMetaData;
042:
043: public LegacyLayoutSupport(
044: final OutputProcessorMetaData outputProcessorMetaData) {
045: if (outputProcessorMetaData == null) {
046: throw new NullPointerException();
047: }
048: this .outputProcessorMetaData = outputProcessorMetaData;
049: }
050:
051: /**
052: * Creates a size calculator for the current state of the output target. The calculator is used to calculate the
053: * string width and line height and later maybe more...
054: *
055: * @param font the font.
056: * @return the size calculator.
057: * @throws org.jfree.report.layout.SizeCalculatorException
058: * if there is a problem with the output target.
059: */
060: public SizeCalculator createTextSizeCalculator(
061: final FontDefinition font) throws SizeCalculatorException {
062: return new DefaultSizeCalculator(
063: font,
064: outputProcessorMetaData
065: .isFeatureSupported(OutputProcessorFeature.LEGACY_LINEHEIGHT_CALC));
066: }
067:
068: /**
069: * Returns the element alignment. Elements will be layouted aligned to this border, so that <code>mod(X,
070: * horizontalAlignment) == 0</code> and <code>mod(Y, verticalAlignment) == 0</code>. Returning 0 will disable the
071: * alignment.
072: *
073: * @return the vertical alignment grid boundry
074: */
075: public float getVerticalAlignmentBorder() {
076: return 0;
077: }
078:
079: /**
080: * Returns the element alignment. Elements will be layouted aligned to this border, so that <code>mod(X,
081: * horizontalAlignment) == 0</code> and <code>mod(Y, verticalAlignment) == 0</code>. Returning 0 will disable the
082: * alignment.
083: *
084: * @return the vertical alignment grid boundry
085: */
086: public float getHorizontalAlignmentBorder() {
087: return 0;
088: }
089:
090: /**
091: * Returns the element alignment. Elements will be layouted aligned to this border, so that <code>mod(X,
092: * horizontalAlignment) == 0</code> and <code>mod(Y, verticalAlignment) == 0</code>. Returning 0 will disable the
093: * alignment.
094: * <p/>
095: * Q&D Hack: Save some cycles of processor time by computing that thing only once.
096: *
097: * @return the vertical alignment grid boundry
098: */
099: public long getInternalVerticalAlignmentBorder() {
100: return 0;
101: }
102:
103: /**
104: * Returns the element alignment. Elements will be layouted aligned to this border, so that <code>mod(X,
105: * horizontalAlignment) == 0</code> and <code>mod(Y, verticalAlignment) == 0</code>. Returning 0 will disable the
106: * alignment.
107: * <p/>
108: * Q&D Hack: Save some cycles of processor time by computing that thing only once.
109: *
110: * @return the vertical alignment grid boundry
111: */
112: public long getInternalHorizontalAlignmentBorder() {
113: return 0;
114: }
115:
116: public boolean isImageResolutionMappingActive() {
117: return outputProcessorMetaData
118: .isFeatureSupported(OutputProcessorFeature.IMAGE_RESOLUTION_MAPPING);
119: }
120: }
|