1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 package org.apache.openoffice.ooxml.parser; 23 24 import org.apache.openoffice.ooxml.parser.attribute.AttributeValues; 25 26 /** Context that has the same life time (by default) as the element it represents. 27 * Gives access to the attribute values and the parent context. 28 */ 29 public class ElementContext 30 { ElementContext( final String sElementName, final String sTypeName, final boolean bIsSkipping, final AttributeValues aValues, final ElementContext aParentContext)31 ElementContext ( 32 final String sElementName, 33 final String sTypeName, 34 final boolean bIsSkipping, 35 final AttributeValues aValues, 36 final ElementContext aParentContext) 37 { 38 msElementName = sElementName; 39 msTypeName = sTypeName; 40 mbIsSkipping = bIsSkipping; 41 maAttributeValues = aValues; 42 maParentContext = aParentContext; 43 } 44 45 46 47 GetElementName()48 public String GetElementName () 49 { 50 return msElementName; 51 } 52 53 54 55 GetTypeName()56 public String GetTypeName () 57 { 58 return msTypeName; 59 } 60 61 62 63 GetAttributes()64 public AttributeValues GetAttributes () 65 { 66 return maAttributeValues; 67 } 68 69 70 71 72 /** Return the context of the parent element. 73 * Can be null when there is no parent element. 74 */ GetParentContext()75 public ElementContext GetParentContext () 76 { 77 return maParentContext; 78 } 79 80 81 82 83 private final String msElementName; 84 private final String msTypeName; 85 private final boolean mbIsSkipping; 86 private final AttributeValues maAttributeValues; 87 private final ElementContext maParentContext; 88 } 89