|
|
|
@ -53,6 +53,7 @@ package com.fr.third.v2.lowagie.text.html.simpleparser;
|
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Iterator; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Properties; |
|
|
|
|
import java.util.StringTokenizer; |
|
|
|
|
import com.fr.third.v2.lowagie.text.Chunk; |
|
|
|
@ -143,18 +144,9 @@ public class FactoryProperties {
|
|
|
|
|
if (props.hasProperty("noexist-attrid")) { |
|
|
|
|
p.setAttribute("noexist-attrid", props.getProperty("noexist-attrid")); |
|
|
|
|
} |
|
|
|
|
for(String margin : HtmlConstants.MARGIN){ |
|
|
|
|
if(props.hasPropertyInChain("div", margin)){ |
|
|
|
|
String ss = props.getPropertyFromChain("div", margin); |
|
|
|
|
p.setAttribute(margin, ss); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for(String padding : HtmlConstants.PADDING){ |
|
|
|
|
if(props.hasPropertyInChain("div", padding)){ |
|
|
|
|
String ss = props.getPropertyFromChain("div", padding); |
|
|
|
|
p.setAttribute(padding, ss); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
parseMarginAttr( p, props); |
|
|
|
|
parsePaddingAttr( p, props); |
|
|
|
|
|
|
|
|
|
if(props.hasPropertyInChain("div", "text-indent")){ |
|
|
|
|
String ss = props.getPropertyFromChain("div", "text-indent"); |
|
|
|
@ -190,6 +182,52 @@ public class FactoryProperties {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 解析margin属性 |
|
|
|
|
* |
|
|
|
|
* @param p |
|
|
|
|
* @param props |
|
|
|
|
*/ |
|
|
|
|
private static void parseMarginAttr(Paragraph p, ChainedProperties props) { |
|
|
|
|
if (props.hasPropertyInChain("div", Markup.CSS_KEY_MARGIN)) { |
|
|
|
|
List<String> list = Markup.parseNESW(props.getPropertyFromChain("div", Markup.CSS_KEY_MARGIN)); |
|
|
|
|
if (null != list && 4 == list.size()) { |
|
|
|
|
for (int i = 0; i < HtmlConstants.MARGIN.size() && i < list.size(); i++) { |
|
|
|
|
p.setAttribute(HtmlConstants.MARGIN.get(i), list.get(i)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (String margin : HtmlConstants.MARGIN) { |
|
|
|
|
if (props.hasPropertyInChain("div", margin)) { |
|
|
|
|
String ss = props.getPropertyFromChain("div", margin); |
|
|
|
|
p.setAttribute(margin, ss); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 解析padding属性 |
|
|
|
|
* |
|
|
|
|
* @param p |
|
|
|
|
* @param props |
|
|
|
|
*/ |
|
|
|
|
private static void parsePaddingAttr(Paragraph p, ChainedProperties props) { |
|
|
|
|
if (props.hasPropertyInChain("div", Markup.CSS_KEY_PADDING)) { |
|
|
|
|
List<String> list = Markup.parseNESW(props.getPropertyFromChain("div", Markup.CSS_KEY_PADDING)); |
|
|
|
|
if (null != list && 4 == list.size()) { |
|
|
|
|
for (int i = 0; i < HtmlConstants.PADDING.size() && i < list.size(); i++) { |
|
|
|
|
p.setAttribute(HtmlConstants.PADDING.get(i), list.get(i)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (String padding : HtmlConstants.PADDING) { |
|
|
|
|
if (props.hasPropertyInChain("div", padding)) { |
|
|
|
|
String ss = props.getPropertyFromChain("div", padding); |
|
|
|
|
p.setAttribute(padding, ss); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static Paragraph createParagraph(ChainedProperties props) { |
|
|
|
|
Paragraph p = new Paragraph(); |
|
|
|
|
createParagraph(p, props); |
|
|
|
|