當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。