Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2012, Plutext Pty Ltd. This file is part of docx4j. docx4j is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.docx4j.utils;
 
 import java.util.List;
 

Author(s):
jharrop
Since:
2.8
 
 public class AltChunkFinder extends CallbackImpl {
 	
 	private List<LocatedChunkaltChunks = new ArrayList<LocatedChunk>(); 
 	
 
 	public List<Objectapply(Object o) {
 		// Not used
 		return null;
 	}
 	
 	public List<Objectapply(Object oList contentListint index) {
 		
 		if (o instanceof CTAltChunk) {				
 					new LocatedChunk((CTAltChunk)ocontentListindex));
 		}			
 		return null;
 	}
 	
 	public void walkJAXBElements(Object parent) {
 		
 		
 		List children = getChildren(parent);
 		if (children != null) {
 
 			int index = 0;
 			for (Object o : children) {
 
 				o = XmlUtils.unwrap(o);
 				
 				this.apply(ochildrenindex);
 
 				if (this.shouldTraverse(o)) {
 				}
 				index++;
 
 			}
 		}
 	}
 	
 	
 	public List<LocatedChunkgetAltChunks() {
 		return ;
 	}


Track the parent of altChunk. This is a workaround for the problem getting the parent of something wrapped in a JAXBElement (which is sometimes the case).

Author(s):
jharrop
 
 	public static class LocatedChunk {
 		
 		LocatedChunk(CTAltChunk altChunkList contentListint index) {
 			this.setAltChunk(altChunk);
 			this. = contentList;
 			this.=index;
 		}
 		
 		public CTAltChunk getAltChunk() {
			return ;
		}
		public void setAltChunk(CTAltChunk altChunk) {
			this. = altChunk;
		}
		private CTAltChunk altChunk;		
		public List getContentList() {
			return ;
		}
		int index;
		public int getIndex() {
			return ;			
		}
	}
New to GrepCode? Check out our FAQ X