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