当前位置: 首页>>代码示例>>Java>>正文


Java OdfStyle类代码示例

本文整理汇总了Java中org.odftoolkit.odfdom.incubator.doc.style.OdfStyle的典型用法代码示例。如果您正苦于以下问题:Java OdfStyle类的具体用法?Java OdfStyle怎么用?Java OdfStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OdfStyle类属于org.odftoolkit.odfdom.incubator.doc.style包,在下文中一共展示了OdfStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findParent

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
public FamilyStyleNode findParent(OdfStyle familyStyle) {
	if (style.getStyleNameAttribute().equals(familyStyle.getStyleParentStyleNameAttribute())) {
		LOGGER.finest("Direct Find " + style.getStyleNameAttribute() + " for " + familyStyle.getStyleParentStyleNameAttribute());
		return this;
	}
	else {
		for (FamilyStyleNode child : children.values()) {
			FamilyStyleNode parent = child.findParent(familyStyle);
			if (parent != null) {
				this.parent = parent;
				return parent;
			}
		}
	}
	return null;
}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:17,代码来源:FamilyStyleNode.java

示例2: addProperties

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
public boolean addProperties(OdfStyle familyStyle, OdfStylePropertiesBase props) {
	boolean found = false;
	if (style.equals(familyStyle)) {
		found = true;
	}
	else {
		for (FamilyStyleNode child : children.values()) {
			found = child.addProperties(familyStyle, props);
			if (found) {
				return found;
			}
		}
	}
	
	return found;
}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:17,代码来源:FamilyStyleNode.java

示例3: setUpCoreStyle

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
private void setUpCoreStyle() throws Throwable {

		OdfOfficeAutomaticStyles styles = doc.getContentDom().getOrCreateAutomaticStyles();
		OdfStyle style = styles.newStyle(OdfStyleFamily.TableCell);

		style.setProperty(OdfTableCellProperties.Border, "0.035cm solid #000000");
		style.setProperty(OdfTableCellProperties.WrapOption, "wrap");
		style.setProperty(OdfTableCellProperties.BackgroundColor, "#ffffff");
		style.setProperty(OdfTableCellProperties.VerticalAlign, "middle");
		style.setProperty(OdfParagraphProperties.TextAlign, "left");
		style.setProperty(OdfParagraphProperties.MarginBottom, "0.2cm");
		style.setProperty(OdfParagraphProperties.MarginTop, "0.2cm");
		style.setProperty(OdfTableCellProperties.PaddingTop, "0.2cm");
		style.setProperty(OdfTableCellProperties.PaddingBottom, "0.2cm");
		style.setProperty(OdfTableCellProperties.PaddingLeft, "0.2cm");
		style.setProperty(OdfTextProperties.FontWeight, "Regular");
		style.setProperty(OdfTextProperties.FontSize, "10pt");

		coreCellStyle = style.getStyleNameAttribute();
	}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:21,代码来源:LogFrameCalcTemplate.java

示例4: walkFamilyTree

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
protected Integer walkFamilyTree(ArrayNode styleArray, FamilyStyleNode familyStyle, SortedMap<String, Integer> stylesUsed)
			throws XMLStreamException {

		OdfStyle style = familyStyle.getStyle();
		ObjectNode familyObj = styleArray.addObject();
		familyObj.put("name", style.getStyleNameAttribute());

//		ArrayNode familyStyleArray = addTreeObject(familyObj, style.getStyleNameAttribute(), true);

		List<Integer> hitList = new ArrayList<Integer>();
		Integer totalHits = 0;
		for (StylesData sd : styles) {
			Integer hits = sd.getStylesUsed().get(style.getStyleNameAttribute());
			if (hits != null) {
				hitList.add(hits);
				totalHits += hits;
			} else {
				hitList.add(0);
			}
		}

		if (totalHits > 0) {
			ArrayNode hitsArray = familyObj.putArray("hits");
			for (Integer hit : hitList) {
				hitsArray.add(hit);
			}
		}
		// get the style properties and iterate them
		// basically should be a copy of what is in the original document
		ArrayNode familyStyleArray = familyObj.putArray(HIDDEN_CHILDREN_TAG);			
		writePropertySets(familyStyleArray, style);


		// recurse through the trees
		Integer childHits = 0;
		Iterable<FamilyStyleNode> children = familyStyle.getChildren();
		for (FamilyStyleNode child : children) {
			childHits += walkFamilyTree(familyStyleArray, child, stylesUsed);
		}
		
		if (childHits > 0) {
			totalHits += childHits;
			familyObj.put("totalHits", totalHits);			
		}
		return totalHits;
	}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:47,代码来源:StylesJSONWriter.java

示例5: writeAutoStyles

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
private void writeAutoStyles() throws XMLStreamException {
	StylesData sd = styles.elementAt(0);
	
	//put together the styles use and the auto names
	ArrayNode autoStylesArrary = null;
	ObjectNode autoStylesObj = null;
	Integer autoStylesHits = 0;
	Iterable<OdfStyle> it = sd.getAutoStyles();
	for (OdfStyle autoStyle :it) {
		if (autoStylesArrary == null) {
			autoStylesObj = rootArray.addObject();
			autoStylesObj.put("name", "Automatic Styles");
			autoStylesArrary = autoStylesObj.putArray(HIDDEN_CHILDREN_TAG);
		}
		ObjectNode autoStyleObj = autoStylesArrary.addObject();
		String autoName = autoStyle.getStyleNameAttribute();
		String displayStyle = autoStyle.getAttribute("style:parent-style-name");
		displayStyle = autoName + " - from " + displayStyle;
		String autoListStyle = autoStyle.getAttribute("style:list-style-name");
		if(autoListStyle.length() > 0) {
			displayStyle += " list style : " + autoListStyle;
		}
		autoStyleObj.put("name", displayStyle + " - ");
		
		//was it hit?
		List<Integer> hitList = new ArrayList<Integer>();
		Integer totalHits = 0;
		for (StylesData sdata : styles) {
			Integer hits = sdata.getStylesUsed().get(autoName);
			if (hits != null) {
				hitList.add(hits);
				totalHits += hits;
			} else {
				hitList.add(0);
			}
		}

		if (totalHits > 0) {
			ArrayNode hitsArray = autoStyleObj.putArray("hits");
			for (Integer hit : hitList) {
				hitsArray.add(hit);
			}
			autoStylesHits += totalHits;
		}
		
		int objNdx = 0;
		ArrayNode detailsArray = autoStyleObj.putArray(HIDDEN_CHILDREN_TAG);
		ObjectNode familyObj = detailsArray.addObject();
		objNdx++;
		familyObj.put("name", "family");
		familyObj.put("value", autoStyle.getFamilyName());
		ObjectNode parentObj = detailsArray.addObject();
		objNdx++;
		parentObj.put("name", "parent");
		parentObj.put("value", autoStyle.getStyleParentStyleNameAttribute());
		String listStyle = autoStyle.getStyleListStyleNameAttribute();
		if(listStyle != null) {
			ObjectNode listStlyeObj = detailsArray.addObject();
			objNdx++;
			listStlyeObj.put("name", "list style");
			listStlyeObj.put("value", autoStyle.getStyleListStyleNameAttribute());
		}
		ObjectNode propsObj= detailsArray.addObject();
		objNdx++;
		propsObj.put("name", "properties");
		ArrayNode propsArray = propsObj.putArray(HIDDEN_CHILDREN_TAG);
		int propSets = writePropertySets(propsArray, autoStyle);
		if(propSets == 0) {
			detailsArray.remove(objNdx - 1);
		}

	}
	if (autoStylesObj != null && autoStylesHits > 0) {
		autoStylesObj.put("totalHits", autoStylesHits);
	}		
}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:77,代码来源:StylesJSONWriter.java

示例6: addFamilyStyle

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
public void addFamilyStyle(String name, OdfStyle familyStyle) {
	// find the right tree
	// get the parent 
	// find the correct level to add it too
	// add it
	OdfeStyleFamily family = styleFamiliesMap.get(name);
	if(family != null) {
		family.addStyle(familyStyle);
	}
}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:11,代码来源:StyleFamilyTreeBuilder.java

示例7: placeRemainingOrphans

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
public Boolean placeRemainingOrphans() {
	Boolean retval = true;
	LOGGER.finest("Starting orphans:" + orphans.size());
	List<OdfStyle> deleteThese = new ArrayList<OdfStyle>();
	//repeat this until we the number of orphans does not reduce or is null
	boolean removedSome = true;
	while (orphans.size() > 0 && removedSome) {
		for (OdfStyle orphan : orphans) {
			for (FamilyStyleNode root : roots.values()) {
				FamilyStyleNode parentNode = root.findParent(orphan);
				if (parentNode != null) {
					if(!parentNode.exists(orphan.getStyleNameAttribute()))
					{
						parentNode.addChildStyle(new FamilyStyleNode(orphan));
						LOGGER.finest("Found parent  " +  parentNode.getStyle().getStyleNameAttribute() + " for " + orphan.getStyleNameAttribute());
					}
					deleteThese.add(orphan);
				}
			}
		}

		if (deleteThese.size() == 0) {
			removedSome = false;
		}

		for (OdfStyle del : deleteThese) {
			orphans.remove(del);
		}
		LOGGER.finest("Remaining orphans:" + orphans.size());
	}
	return retval;
}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:33,代码来源:OdfeStyleFamily.java

示例8: addProperties

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
public boolean addProperties(OdfStyle familyStyle, OdfStylePropertiesBase props) {
	//find the familyStyle
	boolean found = false;
	for (FamilyStyleNode root : roots.values()) {
		found = root.addProperties(familyStyle, props);
		if (found) {
			break;
		}
	}
	
	return found;
}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:13,代码来源:OdfeStyleFamily.java

示例9: prepareCoreStyle

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
public static String prepareCoreStyle(final SpreadsheetDocument doc) throws Throwable {
	OdfOfficeAutomaticStyles styles = doc.getContentDom().getOrCreateAutomaticStyles();
	OdfStyle style = styles.newStyle(OdfStyleFamily.TableCell);

	for (OdfStyleProperty property : styleMap.keySet()) {
		style.setProperty(property, styleMap.get(property));
	}
	coreStyleName = style.getStyleNameAttribute();
	return coreStyleName;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:11,代码来源:CalcUtils.java

示例10: walkFamilyTree

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
@Override
	protected Integer walkFamilyTree(ArrayNode styleArray, FamilyStyleNode familyStyle, SortedMap<String, Integer> stylesUsed)
			throws XMLStreamException {

		OdfStyle style = familyStyle.getStyle();
		ObjectNode familyObj = styleArray.addObject();
		familyObj.put("name", style.getStyleNameAttribute());

//		ArrayNode familyStyleArray = addTreeObject(familyObj, style.getStyleNameAttribute(), true);

		List<Integer> hitList = new ArrayList<Integer>();
		Integer totalHits = 0;
		for (StylesData sd : styles) {
			Integer hits = sd.getStylesUsed().get(style.getStyleNameAttribute());
			if (hits != null) {
				hitList.add(hits);
				totalHits += hits;
			} else {
				hitList.add(0);
			}
		}

		if (totalHits > 0) {
			ArrayNode hitsArray = familyObj.putArray("hits");
			for (Integer hit : hitList) {
				hitsArray.add(hit);
			}
		}
		// get the style properties and iterate them
		// basically should be a copy of what is in the original document
		familyObj.put("diff", familyStyle.getDiffType().toString());
		ArrayNode familyStyleArray = familyObj.putArray(HIDDEN_CHILDREN_TAG);			
		if (familyStyle.getDiffType() == DiffType.ChangedStyle) {
			writeDiffPropertySets(familyStyleArray, style, familyStyle.getDiffStyle());
		} else {
			writePropertySets(familyStyleArray, style);
		}

		// recurse through the trees
		Iterable<FamilyStyleNode> children = familyStyle.getChildren();
		for (FamilyStyleNode child : children) {
			totalHits += walkFamilyTree(familyStyleArray, child, stylesUsed);
		}
		
		return totalHits;
	}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:47,代码来源:StylesJSONdiffWriter.java

示例11: getmAutoStylesMap

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
public SortedMap<String, OdfStyle> getmAutoStylesMap() {
	return autoStylesMap;
}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:4,代码来源:StyleExtractor.java

示例12: getAutoStylesMap

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
public SortedMap<String, OdfStyle> getAutoStylesMap() {
	return autoStylesMap;
}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:4,代码来源:StyleExtractor.java

示例13: setAutoStylesMap

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
public void setAutoStylesMap(SortedMap<String, OdfStyle> autoStylesMap) {
	this.autoStylesMap = autoStylesMap;
}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:4,代码来源:StyleExtractor.java

示例14: setAutoStyles

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
public void setAutoStyles(SortedMap<String, OdfStyle> autoStylesMap) {
	this.autoStylesMap = autoStylesMap;	
}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:4,代码来源:StylesData.java

示例15: getAutoStyles

import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入依赖的package包/类
public Iterable<OdfStyle>  getAutoStyles() {
	return autoStylesMap.values();
}
 
开发者ID:hammyau,项目名称:ODFExplorer,代码行数:4,代码来源:StylesData.java


注:本文中的org.odftoolkit.odfdom.incubator.doc.style.OdfStyle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。