private void setTag(SdtBlock sdtList, BigInteger numId, BigInteger ilvl) { Tag tag = new Tag(); sdtPr.setTag(tag); tag.setVal("HTML_ELEMENT=OL"); return; tag.setVal("HTML_ELEMENT=OL"); return; tag.setVal("HTML_ELEMENT=OL"); return; tag.setVal("HTML_ELEMENT=UL"); } else { tag.setVal("HTML_ELEMENT=OL");
private void emptyRepeatTagValue(final Tag tag) { if (tag==null) { // TODO: this is ok for a w15 repeat log.warn("No tag"); return; } final String tagVal = tag.getVal(); final Pattern stripRepeatArgPattern = Pattern .compile("(.*od:repeat=)([^&]*)(.*)"); final Matcher stripPatternMatcher = stripRepeatArgPattern .matcher(tagVal); if (!stripPatternMatcher.matches()) { log.error("Cannot find repeat tag in sdtPr/tag while processing repeat; something is wrong with " + tagVal); return; } // final String emptyRepeatValue = stripPatternMatcher.group(1) // + stripPatternMatcher.group(3); final String emptyRepeatValue = BINDING_RESULT_RPTD + "=" + stripPatternMatcher.group(2) + stripPatternMatcher.group(3); tag.setVal(emptyRepeatValue); }
/** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); }
/** * Sets the value of the tag property. * * @param value * allowed object is * {@link SdtPr.Tag } * */ public void setTag(Tag value) { Tag existingTag = getTag(); if (existingTag!=null) { if (!existingTag.equals(value)) { rPrOrAliasOrLock.remove(existingTag); if (value==null) { log.debug("Changing SDT tag from " + existingTag.getVal() + " to null"); } else { log.debug("Changing SDT tag from " + existingTag.getVal() + " to " + value.getVal() ); rPrOrAliasOrLock.add(value); } } // else - they are the same, so do nothing } else if (value!=null) { //ObjectFactory factory = new ObjectFactory(); //JAXBElement idWrapper = factory.createSdtPrId(value); rPrOrAliasOrLock.add(value); } }
/** * Create an instance of {@link Tag } * */ public Tag createTag() { return new Tag(); }
private static SdtBlock createSdt(String tagVal, RPr rPr) { // .. so create content control! SdtBlock sdtBlock = Context.getWmlObjectFactory().createSdtBlock(); SdtPr sdtPr = Context.getWmlObjectFactory().createSdtPr(); sdtBlock.setSdtPr(sdtPr); SdtContentBlock sdtContent = Context.getWmlObjectFactory().createSdtContentBlock(); sdtBlock.setSdtContent(sdtContent); // For borders/shading, we'll use the values in this first paragraph. // We'll use a tag, so the XSLT can detect that its supposed to do something special. Tag tag = Context.getWmlObjectFactory().createTag(); tag.setVal(tagVal); sdtPr.setTag(tag); if (rPr != null) { sdtPr.getRPrOrAliasOrLock().add((RPr)XmlUtils.deepCopy(rPr)); /* * ECMA-376 says "specifies the set of run properties which shall be applied to * the text entered into the parent structured document tag in replacement of * placeholder text. When placeholder text is present in a structured document * tag, its formatting is often different than the desired underlying formatting, * and this element specifies the formatting which shall be used for non-placeholder * text contents when they are initially added to the control. " * * Note that docx2fo.xslt is co-opting this to do something else. */ } return sdtBlock; }
/** * Create an instance of {@link Tag } * */ public Tag createTag() { return new Tag(); }
private void processDescendantCondition(Object sdt, String xpathBase, int index, Tag tag ) { Condition c = null; HashMap<String, String> map = QueryString.parseQueryString( tag.getVal(), true); String conditionId = map.get(BINDING_ROLE_CONDITIONAL); if (conditionId != null) { //c = ConditionsPart.getConditionById(conditions, conditionId); c = conditionsMap.get(conditionId); if (c == null) { log.error("Missing condition " + conditionId); throw new InputIntegrityException("Required condition '" + conditionId + "' is missing"); } // TODO: this code assumes the condition contains // a simple xpath if(log.isDebugEnabled()) { log.debug("Using condition" + XmlUtils.marshaltoString(c, true, true)); } Condition newCondition = c.repeat(xpathBase, index, conditionsMap, xpathsMap); // set sdt to use it map.put(BINDING_ROLE_CONDITIONAL, newCondition.getId() ); tag.setVal(QueryString.create(map)); } }
/** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); }
private void setTag(SdtBlock sdtList, BigInteger numId, BigInteger ilvl) { Tag tag = new Tag(); sdtPr.setTag(tag); tag.setVal("HTML_ELEMENT=OL"); return; tag.setVal("HTML_ELEMENT=OL"); return; tag.setVal("HTML_ELEMENT=OL"); return; tag.setVal("HTML_ELEMENT=UL"); } else { tag.setVal("HTML_ELEMENT=OL");
private static SdtBlock createSdt(String tagVal, RPr rPr) { // .. so create content control! SdtBlock sdtBlock = Context.getWmlObjectFactory().createSdtBlock(); SdtPr sdtPr = Context.getWmlObjectFactory().createSdtPr(); sdtBlock.setSdtPr(sdtPr); SdtContentBlock sdtContent = Context.getWmlObjectFactory().createSdtContentBlock(); sdtBlock.setSdtContent(sdtContent); // For borders/shading, we'll use the values in this first paragraph. // We'll use a tag, so the XSLT can detect that its supposed to do something special. Tag tag = Context.getWmlObjectFactory().createTag(); tag.setVal(tagVal); sdtPr.setTag(tag); if (rPr != null) { sdtPr.getRPrOrAliasOrLock().add((RPr)XmlUtils.deepCopy(rPr)); /* * ECMA-376 says "specifies the set of run properties which shall be applied to * the text entered into the parent structured document tag in replacement of * placeholder text. When placeholder text is present in a structured document * tag, its formatting is often different than the desired underlying formatting, * and this element specifies the formatting which shall be used for non-placeholder * text contents when they are initially added to the control. " * * Note that docx2fo.xslt is co-opting this to do something else. */ } return sdtBlock; }
if (replacement==null) { log.error( OpenDoPEHandler.getSdtPr(entry).getTag().getVal() + " - No replacement SDT with ID " + key.toString() );