public boolean setPartShortcut(Part part) { if (part == null ){ return false; } else { return setPartShortcut(part, part.getRelationshipType() ); } }
public boolean setPartShortcut(Part part, String relationshipType) { // Since each part knows its relationshipsType, // why is this passed in as an arg? // Answer: where the relationshipType is ascertained // from the rel itself, it is the most authoritative. // Note that we normally use the info in [Content_Types] // to create a part of the correct type. This info // will not necessary correspond to the info in the rel! if (relationshipType==null) { log.warn("trying to set part shortcut against a null relationship type."); return false; } if (relationshipType.equals(Namespaces.PRESENTATIONML_COMMENT_AUTHORS)) { commentAuthorsPart = (CommentAuthorsPart)part; return true; } else { return false; } }
public boolean setPartShortcut(Part part, String relationshipType) { // Since each part knows its relationshipsType, // why is this passed in as an arg? // Answer: where the relationshipType is ascertained // from the rel itself, it is the most authoritative. // Note that we normally use the info in [Content_Types] // to create a part of the correct type. This info // will not necessary correspond to the info in the rel! if (relationshipType==null) { log.warn("trying to set part shortcut against a null relationship type."); return false; } if (relationshipType.equals(Namespaces.SPREADSHEETML_SHARED_STRINGS)) { sharedStrings = (SharedStrings)part; return true; } else if (relationshipType.equals(Namespaces.SPREADSHEETML_STYLES)) { stylesPart = (Styles)part; return true; } else { return false; } }
public boolean setPartShortcut(Part part, String relationshipType) { // Since each part knows its relationshipsType, // why is this passed in as an arg? // Answer: where the relationshipType is ascertained // from the rel itself, it is the most authoritative. // Note that we normally use the info in [Content_Types] // to create a part of the correct type. This info // will not necessary correspond to the info in the rel! if (relationshipType==null) { log.warn("trying to set part shortcut against a null relationship type."); return false; } if (relationshipType.equals(Namespaces.PRESENTATIONML_NOTES_SLIDE)) { notes = (NotesSlidePart)part; return true; } else if (relationshipType.equals(Namespaces.PRESENTATIONML_SLIDE_LAYOUT)) { layout = (SlideLayoutPart)part; return true; } else if (relationshipType.equals(Namespaces.PRESENTATIONML_COMMENTS)) { comments = (CommentsPart)part; return true; } else { return false; } }
public boolean setPartShortcut(Part part, String relationshipType) { // Since each part knows its relationshipsType, // why is this passed in as an arg? // Answer: where the relationshipType is ascertained // from the rel itself, it is the most authoritative. // Note that we normally use the info in [Content_Types] // to create a part of the correct type. This info // will not necessary correspond to the info in the rel! if (relationshipType==null) { log.warn("trying to set part shortcut against a null relationship type."); return false; } if (relationshipType.equals(Namespaces.FONT_TABLE)) { fontTablePart = (FontTablePart)part; return true; } else if (relationshipType.equals(Namespaces.THEME)) { themePart = (ThemePart)part; return true; } else if (relationshipType.equals(Namespaces.STYLES)) { styleDefinitionsPart = (StyleDefinitionsPart)part; return true; } else if (relationshipType.equals(Namespaces.WEB_SETTINGS)) { webSettingsPart = (WebSettingsPart)part; return true; } else if (relationshipType.equals(Namespaces.SETTINGS)) { documentSettingsPart = (DocumentSettingsPart)part; return true;
protected static Part deepCopyPart(OpcPackage opcPackage, Base targetParent, Part sourcePart, Set<String> relationshipTypes) throws Docx4JException { //check if already handled Part ret = opcPackage.getParts().get(sourcePart.getPartName()); if (ret == null) { // ret = copyPart(sourcePart, opcPackage, ((relationshipTypes == null) || relationshipTypes.contains(sourcePart.getRelationshipType())) ); opcPackage.getParts().put(ret); targetParent.setPartShortcut(ret, ret.getRelationshipType()); } return ret; }
protected static Part copyPart(Part part, OpcPackage targetPackage, boolean deepCopy) throws Docx4JException { Part ret = null; try { ret = part.getClass().getConstructor(PartName.class).newInstance(part.getPartName()); } catch (Exception e) { throw new Docx4JException("Error cloning part of class " + part.getClass().getName(), e); } ret.setRelationshipType(part.getRelationshipType()); ret.setContentType(new ContentType(part.getContentType())); if (targetPackage != null) { ret.setPackage(targetPackage); } if (deepCopy) { deepCopyContent(part, ret); } else { shallowCopyContent(part, ret); } return ret; }
boolean shortcutSet = setPartShortcut(targetpart, targetpart.getRelationshipType()); if (shortcutSet) { log.debug("shortcut was set");
existsAlready.setType( part.getRelationshipType() ); rel.setType( part.getRelationshipType() );
public boolean setPartShortcut(Part part) { if (part == null ){ return false; } else { return setPartShortcut(part, part.getRelationshipType() ); } }
public boolean setPartShortcut(Part part, String relationshipType) { // Since each part knows its relationshipsType, // why is this passed in as an arg? // Answer: where the relationshipType is ascertained // from the rel itself, it is the most authoritative. // Note that we normally use the info in [Content_Types] // to create a part of the correct type. This info // will not necessary correspond to the info in the rel! if (relationshipType==null) { log.warn("trying to set part shortcut against a null relationship type."); return false; } if (relationshipType.equals(Namespaces.PRESENTATIONML_COMMENT_AUTHORS)) { commentAuthorsPart = (CommentAuthorsPart)part; return true; } else { return false; } }
public boolean setPartShortcut(Part part, String relationshipType) { // Since each part knows its relationshipsType, // why is this passed in as an arg? // Answer: where the relationshipType is ascertained // from the rel itself, it is the most authoritative. // Note that we normally use the info in [Content_Types] // to create a part of the correct type. This info // will not necessary correspond to the info in the rel! if (relationshipType==null) { log.warn("trying to set part shortcut against a null relationship type."); return false; } if (relationshipType.equals(Namespaces.SPREADSHEETML_SHARED_STRINGS)) { sharedStrings = (SharedStrings)part; return true; } else if (relationshipType.equals(Namespaces.SPREADSHEETML_STYLES)) { stylesPart = (Styles)part; return true; } else { return false; } }
public boolean setPartShortcut(Part part, String relationshipType) { // Since each part knows its relationshipsType, // why is this passed in as an arg? // Answer: where the relationshipType is ascertained // from the rel itself, it is the most authoritative. // Note that we normally use the info in [Content_Types] // to create a part of the correct type. This info // will not necessary correspond to the info in the rel! if (relationshipType==null) { log.warn("trying to set part shortcut against a null relationship type."); return false; } if (relationshipType.equals(Namespaces.PRESENTATIONML_NOTES_SLIDE)) { notes = (NotesSlidePart)part; return true; } else if (relationshipType.equals(Namespaces.PRESENTATIONML_SLIDE_LAYOUT)) { layout = (SlideLayoutPart)part; return true; } else if (relationshipType.equals(Namespaces.PRESENTATIONML_COMMENTS)) { comments = (CommentsPart)part; return true; } else { return false; } }
public boolean setPartShortcut(Part part, String relationshipType) { // Since each part knows its relationshipsType, // why is this passed in as an arg? // Answer: where the relationshipType is ascertained // from the rel itself, it is the most authoritative. // Note that we normally use the info in [Content_Types] // to create a part of the correct type. This info // will not necessary correspond to the info in the rel! if (relationshipType==null) { log.warn("trying to set part shortcut against a null relationship type."); return false; } if (relationshipType.equals(Namespaces.FONT_TABLE)) { fontTablePart = (FontTablePart)part; return true; } else if (relationshipType.equals(Namespaces.THEME)) { themePart = (ThemePart)part; return true; } else if (relationshipType.equals(Namespaces.STYLES)) { styleDefinitionsPart = (StyleDefinitionsPart)part; return true; } else if (relationshipType.equals(Namespaces.WEB_SETTINGS)) { webSettingsPart = (WebSettingsPart)part; return true; } else if (relationshipType.equals(Namespaces.SETTINGS)) { documentSettingsPart = (DocumentSettingsPart)part; return true;
protected static Part deepCopyPart(OpcPackage opcPackage, Base targetParent, Part sourcePart, Set<String> relationshipTypes) throws Docx4JException { //check if already handled Part ret = opcPackage.getParts().get(sourcePart.getPartName()); if (ret == null) { // ret = copyPart(sourcePart, opcPackage, ((relationshipTypes == null) || relationshipTypes.contains(sourcePart.getRelationshipType())) ); opcPackage.getParts().put(ret); targetParent.setPartShortcut(ret, ret.getRelationshipType()); } return ret; }
protected static Part copyPart(Part part, OpcPackage targetPackage, boolean deepCopy) throws Docx4JException { Part ret = null; try { ret = part.getClass().getConstructor(PartName.class).newInstance(part.getPartName()); } catch (Exception e) { throw new Docx4JException("Error cloning part of class " + part.getClass().getName(), e); } ret.setRelationshipType(part.getRelationshipType()); ret.setContentType(new ContentType(part.getContentType())); if (targetPackage != null) { ret.setPackage(targetPackage); } if (deepCopy) { deepCopyContent(part, ret); } else { shallowCopyContent(part, ret); } return ret; }
boolean shortcutSet = setPartShortcut(targetpart, targetpart.getRelationshipType()); if (shortcutSet) { log.debug("shortcut was set");
existsAlready.setType( part.getRelationshipType() ); rel.setType( part.getRelationshipType() );