|
|
@ -72,12 +72,12 @@ package com.fr.third.com.lowagie.text; |
|
|
|
|
|
|
|
|
|
|
|
public class Paragraph extends Phrase { |
|
|
|
public class Paragraph extends Phrase { |
|
|
|
|
|
|
|
|
|
|
|
// constants
|
|
|
|
// constants
|
|
|
|
private static final long serialVersionUID = 7852314969733375514L; |
|
|
|
private static final long serialVersionUID = 7852314969733375514L; |
|
|
|
|
|
|
|
|
|
|
|
// membervariables
|
|
|
|
// membervariables
|
|
|
|
|
|
|
|
|
|
|
|
/** The alignment of the text. */ |
|
|
|
/** The alignment of the text. */ |
|
|
|
protected int alignment = Element.ALIGN_UNDEFINED; |
|
|
|
protected int alignment = Element.ALIGN_UNDEFINED; |
|
|
|
|
|
|
|
|
|
|
|
/** The text leading that is multiplied by the biggest font size in the line. */ |
|
|
|
/** The text leading that is multiplied by the biggest font size in the line. */ |
|
|
@ -104,6 +104,8 @@ public class Paragraph extends Phrase { |
|
|
|
/** Does the paragraph has to be kept together on 1 page. */ |
|
|
|
/** Does the paragraph has to be kept together on 1 page. */ |
|
|
|
protected boolean keeptogether = false; |
|
|
|
protected boolean keeptogether = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected String background; |
|
|
|
|
|
|
|
|
|
|
|
// constructors
|
|
|
|
// constructors
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -193,15 +195,15 @@ public class Paragraph extends Phrase { |
|
|
|
public Paragraph(Phrase phrase) { |
|
|
|
public Paragraph(Phrase phrase) { |
|
|
|
super(phrase); |
|
|
|
super(phrase); |
|
|
|
if (phrase instanceof Paragraph) { |
|
|
|
if (phrase instanceof Paragraph) { |
|
|
|
Paragraph p = (Paragraph)phrase; |
|
|
|
Paragraph p = (Paragraph)phrase; |
|
|
|
setAlignment(p.alignment); |
|
|
|
setAlignment(p.alignment); |
|
|
|
setLeading(phrase.getLeading(), p.multipliedLeading); |
|
|
|
setLeading(phrase.getLeading(), p.multipliedLeading); |
|
|
|
setIndentationLeft(p.getIndentationLeft()); |
|
|
|
setIndentationLeft(p.getIndentationLeft()); |
|
|
|
setIndentationRight(p.getIndentationRight()); |
|
|
|
setIndentationRight(p.getIndentationRight()); |
|
|
|
setFirstLineIndent(p.getFirstLineIndent()); |
|
|
|
setFirstLineIndent(p.getFirstLineIndent()); |
|
|
|
setSpacingAfter(p.spacingAfter()); |
|
|
|
setSpacingAfter(p.spacingAfter()); |
|
|
|
setSpacingBefore(p.spacingBefore()); |
|
|
|
setSpacingBefore(p.spacingBefore()); |
|
|
|
setExtraParagraphSpace(p.getExtraParagraphSpace()); |
|
|
|
setExtraParagraphSpace(p.getExtraParagraphSpace()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -239,11 +241,11 @@ public class Paragraph extends Phrase { |
|
|
|
super.add(o); |
|
|
|
super.add(o); |
|
|
|
java.util.List chunks = getChunks(); |
|
|
|
java.util.List chunks = getChunks(); |
|
|
|
if (!chunks.isEmpty()) { |
|
|
|
if (!chunks.isEmpty()) { |
|
|
|
Chunk tmp = ((Chunk) chunks.get(chunks.size() - 1)); |
|
|
|
Chunk tmp = ((Chunk) chunks.get(chunks.size() - 1)); |
|
|
|
super.add(new Chunk("\n", tmp.getFont())); |
|
|
|
super.add(new Chunk("\n", tmp.getFont())); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
super.add(Chunk.NEWLINE); |
|
|
|
super.add(Chunk.NEWLINE); |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -381,7 +383,7 @@ public class Paragraph extends Phrase { |
|
|
|
|
|
|
|
|
|
|
|
// methods to retrieve information
|
|
|
|
// methods to retrieve information
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Gets the alignment of this paragraph. |
|
|
|
* Gets the alignment of this paragraph. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return alignment |
|
|
|
* @return alignment |
|
|
@ -407,15 +409,15 @@ public class Paragraph extends Phrase { |
|
|
|
* @return the total leading (fixed and multiplied) |
|
|
|
* @return the total leading (fixed and multiplied) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public float getTotalLeading() { |
|
|
|
public float getTotalLeading() { |
|
|
|
float m = font == null ? |
|
|
|
float m = font == null ? |
|
|
|
Font.DEFAULTSIZE * multipliedLeading : font.getCalculatedLeading(multipliedLeading); |
|
|
|
Font.DEFAULTSIZE * multipliedLeading : font.getCalculatedLeading(multipliedLeading); |
|
|
|
if (m > 0 && !hasLeading()) { |
|
|
|
if (m > 0 && !hasLeading()) { |
|
|
|
return m; |
|
|
|
return m; |
|
|
|
} |
|
|
|
} |
|
|
|
return getLeading() + m; |
|
|
|
return getLeading() + m; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Gets the indentation of this paragraph on the left side. |
|
|
|
* Gets the indentation of this paragraph on the left side. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return the indentation |
|
|
|
* @return the indentation |
|
|
@ -424,11 +426,11 @@ public class Paragraph extends Phrase { |
|
|
|
return indentationLeft; |
|
|
|
return indentationLeft; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Gets the indentation of this paragraph on the right side. |
|
|
|
* Gets the indentation of this paragraph on the right side. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return the indentation |
|
|
|
* @return the indentation |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public float getIndentationRight() { |
|
|
|
public float getIndentationRight() { |
|
|
|
return indentationRight; |
|
|
|
return indentationRight; |
|
|
|
} |
|
|
|
} |
|
|
@ -447,7 +449,7 @@ public class Paragraph extends Phrase { |
|
|
|
* @since 2.1.5 |
|
|
|
* @since 2.1.5 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public float getSpacingBefore() { |
|
|
|
public float getSpacingBefore() { |
|
|
|
return spacingBefore; |
|
|
|
return spacingBefore; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -456,7 +458,7 @@ public class Paragraph extends Phrase { |
|
|
|
* @since 2.1.5 |
|
|
|
* @since 2.1.5 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public float getSpacingAfter() { |
|
|
|
public float getSpacingAfter() { |
|
|
|
return spacingAfter; |
|
|
|
return spacingAfter; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -499,4 +501,12 @@ public class Paragraph extends Phrase { |
|
|
|
return spacingAfter; |
|
|
|
return spacingAfter; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setBackground(String background){ |
|
|
|
|
|
|
|
this.background = background; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getBackground(){ |
|
|
|
|
|
|
|
return this.background; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |