Browse Source

style changes only


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196725 13f79535-47bb-0310-9956-ffa450edef68
tags/Root_Temp_KnuthStylePageBreaking
William Victor Mote 21 years ago
parent
commit
63ac58d71f

+ 49
- 31
src/java/org/apache/fop/fo/FOText.java View File

@@ -76,15 +76,18 @@ import org.apache.fop.fo.properties.TextTransform;
*/
public class FOText extends FObj {

protected char[] ca;
protected int start;
protected int length;
TextInfo textInfo;
TextState ts;
private char[] ca;
private int start;
private int length;
private TextInfo textInfo;
private TextState ts;

/**
* Keeps track of the last FOText object created within the current
* block. This is used to create pointers between such objects.
* TODO: As soon as the control hierarchy is straightened out, this static
* variable needs to become an instance variable in some parent object,
* probably the page-sequence.
*/
private static FOText lastFOTextProcessed = null;

@@ -106,10 +109,19 @@ public class FOText extends FObj {
*/
private Block ancestorBlock = null;

public static final int IS_WORD_CHAR_FALSE = 0;
public static final int IS_WORD_CHAR_TRUE = 1;
public static final int IS_WORD_CHAR_MAYBE = 2;
private static final int IS_WORD_CHAR_FALSE = 0;
private static final int IS_WORD_CHAR_TRUE = 1;
private static final int IS_WORD_CHAR_MAYBE = 2;

/**
*
* @param chars array of chars which contains the text in this object (may
* be a superset of the text in this object
* @param s starting index into char[] for the text in this object
* @param e ending index into char[] for the text in this object
* @param ti TextInfo object for the text in this object
* @param parent FONode that is the parent of this object
*/
public FOText(char[] chars, int s, int e, TextInfo ti, FONode parent) {
super(parent);
this.start = 0;
@@ -169,6 +181,9 @@ public class FOText extends FObj {
list.add(lm);
}

/**
* @return a new TextCharIterator
*/
public CharIterator charIterator() {
return new TextCharIterator();
}
@@ -231,12 +246,11 @@ public class FOText extends FObj {
}
}
// if the last FOText is a sibling, point to it, and have it point here
if ( lastFOTextProcessed != null) {
if (lastFOTextProcessed != null) {
if (lastFOTextProcessed.ancestorBlock == this.ancestorBlock) {
prevFOTextThisBlock = lastFOTextProcessed;
prevFOTextThisBlock.nextFOTextThisBlock = this;
}
else {
} else {
prevFOTextThisBlock = null;
}
}
@@ -266,7 +280,7 @@ public class FOText extends FObj {
* well, such as word-spacing. The definition of "word" is somewhat ambiguous
* and appears to be definable by the user agent.
*
* @param (int i) with index to ca[]
* @param i index into ca[]
*
* @return True if the character at this location is the start of a new
* word.
@@ -309,13 +323,13 @@ public class FOText extends FObj {
* block as one unit, allowing text in adjoining FOText objects to be
* returned if the parameters are outside of the current object.
*
* @param (int i) with the index for ca[]
* @param (int offset) signed integer with relative position within the
* @param i index into ca[]
* @param offset signed integer with relative position within the
* block of the character to return. To return the character immediately
* preceding i, pass -1. To return the character immediately after i,
* pass 1.
* @return char the character in the offset position within the block.
* @return \u0000 if the offset points to an area outside of the block.
* @return the character in the offset position within the block; \u0000 if
* the offset points to an area outside of the block.
*/
public char getRelativeCharInBlock(int i, int offset) {
// The easy case is where the desired character is in the same FOText
@@ -331,7 +345,7 @@ public class FOText extends FObj {
char charToReturn = '\u0000';
FOText nodeToTest = this;
int remainingOffset = offset + i;
while (! foundChar) {
while (!foundChar) {
if (nodeToTest.prevFOTextThisBlock == null) {
foundChar = true;
break;
@@ -340,8 +354,7 @@ public class FOText extends FObj {
if ((nodeToTest.ca.length + remainingOffset) >= 0) {
charToReturn = nodeToTest.ca[nodeToTest.ca.length + remainingOffset];
foundChar = true;
}
else {
} else {
remainingOffset = remainingOffset + nodeToTest.ca.length;
}
}
@@ -349,17 +362,17 @@ public class FOText extends FObj {
}

/**
* @return The previous FOText node in this Block.
* @return null, if this is the first FOText in this Block.
* @return The previous FOText node in this Block; null, if this is the
* first FOText in this Block.
*/
public FOText getPrevFOTextThisBlock () {
return prevFOTextThisBlock;
}

/**
* @return The next FOText node in this Block.
* @return null, if this is the last FOText in this Block, or if subsequent
* FOText nodes have not yet been processed.
* @return The next FOText node in this Block; null if this is the last
* FOText in this Block; null if subsequent FOText nodes have not yet been
* processed.
*/
public FOText getNextFOTextThisBlock () {
return nextFOTextThisBlock;
@@ -375,7 +388,7 @@ public class FOText extends FObj {
/**
* Transforms one character in ca[] using the text-transform property.
*
* @param int with index for ca[]
* @param i the index into ca[]
* @return char with transformed value
*/
public char charTransform(int i) {
@@ -396,8 +409,7 @@ public class FOText extends FObj {
are capitalized. We will try to let Java handle this.
*/
return Character.toTitleCase(ca[i]);
}
else {
} else {
return Character.toLowerCase(ca[i]);
}
default:
@@ -414,7 +426,7 @@ public class FOText extends FObj {
* We have not found a definition of "word" in the standard (1.0), so the
* logic used here is based on the programmer's best guess.
*
* @param char inputChar: the character to be tested.
* @param inputChar the character to be tested.
* @return int IS_WORD_CHAR_TRUE, IS_WORD_CHAR_FALSE, or IS_WORD_CHAR_MAYBE,
* depending on whether the character should be considered part of a word
* or not.
@@ -430,14 +442,18 @@ public class FOText extends FObj {
case Character.CURRENCY_SYMBOL:
return IS_WORD_CHAR_TRUE;
case Character.DASH_PUNCTUATION:
if (inputChar == '-') return IS_WORD_CHAR_TRUE; //hyphen
if (inputChar == '-') {
return IS_WORD_CHAR_TRUE; //hyphen
}
return IS_WORD_CHAR_FALSE;
case Character.DECIMAL_DIGIT_NUMBER:
return IS_WORD_CHAR_TRUE;
case Character.ENCLOSING_MARK:
return IS_WORD_CHAR_FALSE;
case Character.END_PUNCTUATION:
if (inputChar == '\u2019') return IS_WORD_CHAR_MAYBE; //apostrophe, right single quote
if (inputChar == '\u2019') {
return IS_WORD_CHAR_MAYBE; //apostrophe, right single quote
}
return IS_WORD_CHAR_FALSE;
case Character.FORMAT:
return IS_WORD_CHAR_FALSE;
@@ -460,7 +476,9 @@ public class FOText extends FObj {
case Character.OTHER_NUMBER:
return IS_WORD_CHAR_TRUE;
case Character.OTHER_PUNCTUATION:
if (inputChar == '\'') return IS_WORD_CHAR_MAYBE; //ASCII apostrophe
if (inputChar == '\'') {
return IS_WORD_CHAR_MAYBE; //ASCII apostrophe
}
return IS_WORD_CHAR_FALSE;
case Character.OTHER_SYMBOL:
return IS_WORD_CHAR_TRUE;

+ 22
- 10
src/java/org/apache/fop/fo/InlineCharIterator.java View File

@@ -3,34 +3,34 @@
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
*
*
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
*
*
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
*
*
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
*
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -42,12 +42,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
*
*
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
*/
*/
package org.apache.fop.fo;

import org.apache.fop.layout.BorderAndPadding;
@@ -59,6 +59,11 @@ public class InlineCharIterator extends RecursiveCharIterator {
private boolean bStartBoundary = false;
private boolean bEndBoundary = false;

/**
* @param fobj the object for whose character contents and for whose
* descendant's character contents should be iterated
* @param bap
*/
public InlineCharIterator(FObj fobj, BorderAndPadding bap) {
super(fobj);
checkBoundaries(bap);
@@ -73,6 +78,9 @@ public class InlineCharIterator extends RecursiveCharIterator {
|| bap.getPaddingRight(false) > 0);
}

/**
* @return true if there are more characters
*/
public boolean hasNext() {
if (bStartBoundary) {
return true;
@@ -84,6 +92,10 @@ public class InlineCharIterator extends RecursiveCharIterator {
*/
}

/**
* @return the next character
* @throws NoSuchElementException if there are no more characters
*/
public char nextChar() throws NoSuchElementException {
if (bStartBoundary) {
bStartBoundary = false;

+ 28
- 10
src/java/org/apache/fop/fo/KeepProperty.java View File

@@ -3,34 +3,34 @@
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
*
*
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
*
*
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
*
*
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
*
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -42,20 +42,29 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
*
*
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
*/
*/
package org.apache.fop.fo;

import org.apache.fop.datatypes.Keep;

/**
* Superclass for properties that wrap Keep values
*/
public class KeepProperty extends Property {

/**
* Inner class for creating instances of KeepProperty
*/
public static class Maker extends Property.Maker {

/**
* @param name name of property for which Maker should be created
*/
protected Maker(String name) {
super(name);
}
@@ -64,14 +73,23 @@ public class KeepProperty extends Property {

private Keep keep;

/**
* @param keep Keep value to wrap in this Property
*/
public KeepProperty(Keep keep) {
this.keep = keep;
}

/**
* @return this.keep
*/
public Keep getKeep() {
return this.keep;
}

/**
* @return this.keep cast as Object
*/
public Object getObject() {
return this.keep;
}

Loading…
Cancel
Save