[Libreoffice-commits] core.git: Branch 'aoo/trunk' - ooxml/source

Andre Fischer af at apache.org
Fri Jun 20 09:07:48 PDT 2014


 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/AcceptingStateTable.java               |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ElementContext.java                    |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/OOXMLParser.java                       |   13 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ParseException.java                    |   42 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ParseTableReader.java                  |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/Parser.java                            |   36 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/SkipStateTable.java                    |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/StateMachine.java                      |   49 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionDescriptor.java           |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionIterator.java             |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionManager.java              |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionTrigger.java              |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/IAction.java                    |   30 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeDescriptor.java     |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeManager.java        |   14 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeProvider.java       |    2 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeValues.java         |   20 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/BlobParser.java                   |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/DateTimeParser.java               |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/ISimpleTypeParser.java            |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/ListParser.java                   |   21 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/NumberParser.java                 |   22 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/SimpleTypeManager.java            |   38 
 ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/StringParser.java                 |   21 
 ooxml/source/framework/JavaPartManager/.classpath                                                                    |    7 
 ooxml/source/framework/JavaPartManager/.project                                                                      |   17 
 ooxml/source/framework/JavaPartManager/.settings/org.eclipse.jdt.core.prefs                                          |   11 
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/ContentType.java               |   77 +
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/ContentTypes.java              |  150 ++
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/IReferenceProvider.java        |    6 
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/OOXMLPackage.java              |   56 
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/Package.java                   |  158 ++
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/Part.java                      |   89 +
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartManager.java               |  145 ++
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartManagerPrototype.java      |   33 
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartName.java                  |  130 ++
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/RelatedParts.java              |  131 ++
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/RelationshipType.java          |  112 +
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/ContentTypesParser.java |   30 
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/ParserFactory.java      |   46 
 ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/RelationshipParser.java |   30 
 ooxml/source/framework/OOXMLViewer/.classpath                                                                        |    8 
 ooxml/source/framework/OOXMLViewer/.project                                                                          |   17 
 ooxml/source/framework/OOXMLViewer/.settings/org.eclipse.jdt.core.prefs                                              |   11 
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/DetailViewManager.java                     |  131 ++
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/ImageView.java                             |   75 +
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/KeyListener.java                           |   50 
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/OOXMLViewer.java                           |  208 +++
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/PartsView.java                             |  137 ++
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/StreamView.java                            |  266 ++++
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/content/ContentView.java                   |   77 +
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/content/PresentationImporter.java          |   81 +
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/content/PresentationModel.java             |   43 
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/content/Slide.java                         |   56 
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/content/SlideManager.java                  |   77 +
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/content/SlideParser.java                   |   80 +
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/tokenview/DocumentFactory.java             |  127 ++
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/tokenview/FormatState.java                 |   61 
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/tokenview/Formatter.java                   |   93 +
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/tokenview/Line.java                        |  239 +++
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/tokenview/LineContainer.java               |  194 +++
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/tokenview/Run.java                         |  249 +++
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/tokenview/RunRange.java                    |   87 +
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/tokenview/Style.java                       |  109 +
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/tokenview/TokenView.java                   |  406 ++++++
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/xml/DocumentTokenFormatter.java            |  399 ++++++
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/xml/Token.java                             |   51 
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/xml/TokenType.java                         |   41 
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/xml/XMLScanner.java                        |  438 +++++++
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/xml/XMLTokenViewFactory.java               |  106 +
 ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/xmltokenview/XMLViewFactory.java           |  143 ++
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/SchemaReader.java                         |   52 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/Test.java                                 |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/automaton/CreatorBase.java                |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/automaton/DFACreator.java                 |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/automaton/EpsilonTransition.java          |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/automaton/FiniteAutomatonContainer.java   |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/automaton/HopcroftMinimizer.java          |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/automaton/SkipData.java                   |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/automaton/StateContainer.java             |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/automaton/StateSet.java                   |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/generator/html/HtmlGenerator.java         |  623 ++++++++++
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/generator/html/code.js                    |  442 +++++++
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/generator/html/display.css                |   57 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/generator/html/linking-template.html      |   22 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/generator/html/template.html              |   24 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/iterator/PermutationIterator.java         |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/misc/Log.java                             |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/model/base/INode.java                     |    1 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/model/base/Node.java                      |   10 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/model/complex/ComplexTypeReference.java   |    9 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/model/optimize/SchemaOptimizer.java       |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/model/simple/BuiltInType.java             |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/parser/FormDefault.java                   |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/BlobNode.java                      |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/DateTimeNode.java                  |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/EnumerationNode.java               |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/ISimpleTypeNode.java               |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/ISimpleTypeNodeVisitor.java        |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/NumberNode.java                    |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/SimpleTypeContainer.java           |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/SimpleTypeDescriptor.java          |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/SimpleTypeDescriptorFactory.java   |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/SimpleTypeNodeVisitorAdapter.java  |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/StringNode.java                    |   21 
 ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/simple/UnionNode.java                     |   21 
 106 files changed, 7586 insertions(+), 48 deletions(-)

New commits:
commit 69b5155645ee41433cfd225b2947bc3add03b0a4
Author: Andre Fischer <af at apache.org>
Date:   Fri Jun 20 15:30:08 2014 +0000

    125035: Added support for simple types.
    
    Added new JavaPartManager project.
    Added new OOXMLViewer project.

diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/AcceptingStateTable.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/AcceptingStateTable.java
index 151cf8a..c11ea44 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/AcceptingStateTable.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/AcceptingStateTable.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser;
 
 import java.util.HashSet;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ElementContext.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ElementContext.java
index 60f2da8..2114dd7 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ElementContext.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ElementContext.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser;
 
 import org.apache.openoffice.ooxml.parser.attribute.AttributeValues;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/OOXMLParser.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/OOXMLParser.java
index d150b1f..369f5c3 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/OOXMLParser.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/OOXMLParser.java
@@ -82,7 +82,7 @@ public class OOXMLParser
         final String sInputFilename)
     {
         long nStartTime = System.currentTimeMillis();
-        final StateMachine aMachine = new StateMachine(new File(sParseTableFilename));
+        final StateMachine aMachine = new StateMachine(new File(sParseTableFilename), null);
         final InputStream aIn = GetInputStream(sInputFilename);
         long nEndTime = System.currentTimeMillis();
 
@@ -129,7 +129,8 @@ public class OOXMLParser
                     final ActionTrigger eTrigger,
                     final ElementContext aContext,
                     final String sText,
-                    final Location aLocation)
+                    final Location aStartLocation,
+                    final Location aEndLocation)
                 {
                     Integer nValue = aActionContext.TypeCounts.get(aContext.GetTypeName());
                     if (nValue == null)
@@ -148,12 +149,13 @@ public class OOXMLParser
                     final ActionTrigger eTrigger,
                     final ElementContext aContext,
                     final String sText,
-                    final Location aLocation)
+                    final Location aStartLocation,
+                    final Location aEndLocation)
                 {
                     System.out.printf("processing %s of element %s at position %d\n",
                         eTrigger,
                         aContext.GetElementName(),
-                        aLocation.getCharacterOffset());
+                        aStartLocation.getCharacterOffset());
 
                     if (aContext.GetAttributes().GetAttributeCount() == 0)
                         System.out.printf("    no attributes\n");
@@ -171,7 +173,8 @@ public class OOXMLParser
                     final ActionTrigger eTrigger,
                     final ElementContext aContext,
                     final String sText,
-                    final Location aLocation)
+                    final Location aStartLocation,
+                    final Location aEndLocation)
                 {
 //                    System.out.printf("%s text \"%s\"\n", aContext.GetTypeName(), sText.replace("\n", "\\n"));
                 }
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ParseException.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ParseException.java
new file mode 100644
index 0000000..ae07f9c
--- /dev/null
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ParseException.java
@@ -0,0 +1,42 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser;
+
+import javax.xml.stream.Location;
+
+ at SuppressWarnings("serial")
+public class ParseException
+    extends RuntimeException
+{
+    public ParseException (
+        final Exception aException,
+        final Location aLocation)
+    {
+        super(aException);
+        Location = aLocation;
+    }
+
+
+
+
+    public final Location Location;
+}
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ParseTableReader.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ParseTableReader.java
index a596d2b..0288886 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ParseTableReader.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/ParseTableReader.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser;
 
 import java.io.BufferedReader;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/Parser.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/Parser.java
index 538907f..cd51087f 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/Parser.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/Parser.java
@@ -1,7 +1,30 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser;
 
 import java.io.InputStream;
+import java.util.Vector;
 
+import javax.xml.stream.Location;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
@@ -28,11 +51,13 @@ public class Parser
 
     public void Parse ()
     {
+        Location aLocation = null;
         try
         {
             final AttributeProvider aAttributeProvider = new AttributeProvider(maReader);
             while (maReader.hasNext())
             {
+                aLocation = maReader.getLocation();
                 final int nCode = maReader.next();
                 switch(nCode)
                 {
@@ -47,6 +72,7 @@ public class Parser
                         else if ( ! maMachine.ProcessStartElement(
                             maReader.getNamespaceURI(),
                             maReader.getLocalName(),
+                            aLocation,
                             maReader.getLocation(),
                             aAttributeProvider))
                         {
@@ -60,12 +86,14 @@ public class Parser
                         maMachine.ProcessEndElement(
                             maReader.getNamespaceURI(),
                             maReader.getLocalName(),
+                            aLocation,
                             maReader.getLocation());
                         break;
 
                     case XMLStreamReader.CHARACTERS:
                         maMachine.ProcessCharacters(
                             maReader.getText(),
+                            aLocation,
                             maReader.getLocation());
                         break;
 
@@ -83,11 +111,19 @@ public class Parser
         {
             aException.printStackTrace();
         }
+        catch (final Exception aException)
+        {
+            throw new ParseException(
+                aException,
+                aLocation);
+        }
     }
 
 
 
 
+
+
     public int GetElementCount ()
     {
         return mnElementCount;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/SkipStateTable.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/SkipStateTable.java
index a609aa7..0171b74 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/SkipStateTable.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/SkipStateTable.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser;
 
 import java.util.HashSet;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/StateMachine.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/StateMachine.java
index 26fdb46..39ff4df 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/StateMachine.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/StateMachine.java
@@ -23,6 +23,7 @@ package org.apache.openoffice.ooxml.parser;
 
 import java.io.File;
 import java.util.Stack;
+import java.util.Vector;
 
 import javax.xml.stream.Location;
 
@@ -39,7 +40,9 @@ import org.apache.openoffice.ooxml.parser.type.SimpleTypeManager;
  */
 public class StateMachine
 {
-    public StateMachine (final File aParseTableFile)
+    public StateMachine (
+        final File aParseTableFile,
+        final Vector<String> aErrorsAndWarnings)
     {
         if (Log.Dbg != null)
             Log.Dbg.printf("reading parse tables from %s\n", aParseTableFile.toString());
@@ -60,7 +63,8 @@ public class StateMachine
             maNamespaceMap,
             maNameMap,
             maStateNameMap,
-            maSimpleTypeManager);
+            maSimpleTypeManager,
+            aErrorsAndWarnings);
         mnStartStateId = Integer.parseInt(aReader.GetSection("start-state").firstElement()[1]);
         mnEndStateId = Integer.parseInt(aReader.GetSection("end-state").firstElement()[1]);
 
@@ -68,6 +72,7 @@ public class StateMachine
         maStateStack = new Stack<>();
         maElementContextStack = new Stack<>();
         maActionManager = new ActionManager(maStateNameMap);
+        maErrorsAndWarnings  = aErrorsAndWarnings;
 
         if (Log.Dbg != null)
         {
@@ -89,7 +94,8 @@ public class StateMachine
     public boolean ProcessStartElement (
         final String sNamespaceURI,
         final String sElementName,
-        final Location aLocation,
+        final Location aStartLocation,
+        final Location aEndLocation,
         final AttributeProvider aAttributes)
     {
         boolean bResult = false;
@@ -104,8 +110,8 @@ public class StateMachine
                     sElementName,
                     aNamespaceDescriptor.Id,
                     nElementNameId,
-                    aLocation.getLineNumber(),
-                    aLocation.getColumnNumber());
+                    aStartLocation.getLineNumber(),
+                    aStartLocation.getColumnNumber());
 
             final Transition aTransition = maTransitions.GetTransition(
                 mnCurrentStateId,
@@ -121,8 +127,8 @@ public class StateMachine
                     maNameMap.GetNameForId(nElementNameId),
                     aNamespaceDescriptor.Id,
                     nElementNameId,
-                    aLocation.getLineNumber(),
-                    aLocation.getColumnNumber());
+                    aStartLocation.getLineNumber(),
+                    aStartLocation.getColumnNumber());
                 Log.Err.printf(sText);
                 if (Log.Dbg != null)
                     Log.Dbg.printf(sText);
@@ -176,7 +182,8 @@ public class StateMachine
                     maCurrentElementContext,
                     ActionTrigger.ElementStart,
                     null,
-                    aLocation);
+                    aStartLocation,
+                    aEndLocation);
 
                 bResult = true;
             }
@@ -184,8 +191,8 @@ public class StateMachine
         catch (RuntimeException aException)
         {
             Log.Err.printf("error at line %d and column %d\n",
-                aLocation.getLineNumber(),
-                aLocation.getColumnNumber());
+                aStartLocation.getLineNumber(),
+                aStartLocation.getColumnNumber());
             throw aException;
         }
         return bResult;
@@ -197,7 +204,8 @@ public class StateMachine
     public void ProcessEndElement (
         final String sNamespaceURI,
         final String sElementName,
-        final Location aLocation)
+        final Location aStartLocation,
+        final Location aEndLocation)
     {
         if ( ! maAcceptingStates.Contains(mnCurrentStateId)
             && mnCurrentStateId!=-1)
@@ -226,7 +234,8 @@ public class StateMachine
             aPreviousElementContext,
             ActionTrigger.ElementEnd,
             null,
-            aLocation);
+            aStartLocation,
+            aEndLocation);
 
         if (Log.Dbg != null)
         {
@@ -234,8 +243,8 @@ public class StateMachine
             Log.Dbg.printf("/%s:%s L%d%d\n",
                 aDescriptor.Prefix,
                 sElementName,
-                aLocation.getLineNumber(),
-                aLocation.getColumnNumber());
+                aStartLocation.getLineNumber(),
+                aStartLocation.getColumnNumber());
             Log.Dbg.printf(" %s(%d) <- %s(%d)\n",
                 maStateNameMap.GetNameForId(nPreviousStateId),
                 nPreviousStateId,
@@ -249,7 +258,8 @@ public class StateMachine
 
     public void ProcessCharacters (
         final String sText,
-        final Location aLocation)
+        final Location aStartLocation,
+        final Location aEndLocation)
     {
         if (Log.Dbg != null)
             Log.Dbg.printf("text [%s]\n", sText.replace("\n", "\\n"));
@@ -259,7 +269,8 @@ public class StateMachine
             maCurrentElementContext,
             ActionTrigger.Text,
             sText,
-            aLocation);
+            aStartLocation,
+            aEndLocation);
 
     }
 
@@ -287,12 +298,13 @@ public class StateMachine
         final ElementContext aElementContext,
         final ActionTrigger eTrigger,
         final String sText,
-        final Location aLocation)
+        final Location aStartLocation,
+        final Location aEndLocation)
     {
         final Iterable<IAction> aActions = maActionManager.GetActions(nStateId, eTrigger);
         if (aActions != null)
             for (final IAction aAction : aActions)
-                aAction.Run(eTrigger, aElementContext, sText, aLocation);
+                aAction.Run(eTrigger, aElementContext, sText, aStartLocation, aEndLocation);
     }
 
 
@@ -314,4 +326,5 @@ public class StateMachine
     private SkipStateTable maSkipStates;
     private AcceptingStateTable maAcceptingStates;
     private final ActionManager maActionManager;
+    private final Vector<String> maErrorsAndWarnings;
 }
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionDescriptor.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionDescriptor.java
index 25be5a9..27ce9d4 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionDescriptor.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionDescriptor.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.action;
 
 import java.util.Vector;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionIterator.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionIterator.java
index 8566dc0..0ca176a 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionIterator.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionIterator.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.action;
 
 import java.util.Iterator;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionManager.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionManager.java
index e473ab6..48d78a0 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionManager.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionManager.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.action;
 
 import java.util.HashMap;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionTrigger.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionTrigger.java
index 62735a8..33b781a 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionTrigger.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/ActionTrigger.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.action;
 
 /** An enumeration of all supported action triggers.
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/IAction.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/IAction.java
index bc14260..e784ed7 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/IAction.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/action/IAction.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.action;
 
 import javax.xml.stream.Location;
@@ -18,12 +39,15 @@ public interface IAction
      * @param sText
      *      Contains text for ActionTrigger.Text.  Is null for all other
      *      triggers.
-     * @param aLocation
-     *      The location in the source file that triggered the XML event.
+     * @param aStartLocation
+     *      The location in the source file where the triggering element starts.
+     * @param aEndLocation
+     *      The location in the source file where the triggering element ends.
      */
     void Run (
         final ActionTrigger eTrigger,
         final ElementContext aContext,
         final String sText,
-        final Location aLocation);
+        final Location aStartLocation,
+        final Location aEndLocation);
 }
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeDescriptor.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeDescriptor.java
index 3fc9cc3..a51aa54 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeDescriptor.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeDescriptor.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.attribute;
 
 /** Store information about a single attribute (per state) that was read
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeManager.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeManager.java
index 82a4052..55b1df9 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeManager.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeManager.java
@@ -47,14 +47,15 @@ public class AttributeManager
         final NamespaceMap aNamespaceMap,
         final NameMap aNameMap,
         final NameMap aStateNameMap,
-        final SimpleTypeManager aSimpleTypeManager)
+        final SimpleTypeManager aSimpleTypeManager,
+        final Vector<String> aErrorsAndWarnings)
     {
         maStateIdToAttributesMap = new HashMap<>();
         maNamespaceMap = aNamespaceMap;
         maNameMap = aNameMap;
         maStateNameMap = aStateNameMap;
         maSimpleTypeManager = aSimpleTypeManager;
-
+        maErrorsAndWarnings = aErrorsAndWarnings;
         ParseData(aData);
     }
 
@@ -185,7 +186,13 @@ public class AttributeManager
                 if ( ! aUsedAttributes.contains(aAttribute))
                 {
                     if ( ! aAttribute.IsOptional())
-                        throw new RuntimeException("attribute '"+aAttribute.GetName()+"' is not present but also not optional");
+                    {
+                        final String sMessage = String.format("attribute '"+aAttribute.GetName()+"' is not present but also not optional");
+                        if (maErrorsAndWarnings != null)
+                            maErrorsAndWarnings.add(sMessage);
+                        else
+                            throw new RuntimeException(sMessage);
+                    }
                     else
                     {
                         // Add an entry that gives access to the default value.
@@ -262,4 +269,5 @@ public class AttributeManager
     private final NameMap maNameMap;
     private final NameMap maStateNameMap;
     private final SimpleTypeManager maSimpleTypeManager;
+    private final Vector<String> maErrorsAndWarnings;
 }
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeProvider.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeProvider.java
index 132130a..ab9e285 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeProvider.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeProvider.java
@@ -30,7 +30,7 @@ import javax.xml.stream.XMLStreamReader;
 public class AttributeProvider
     implements Iterable<String[]>
 {
-    public AttributeProvider(XMLStreamReader aReader)
+    public AttributeProvider (final XMLStreamReader aReader)
     {
         maReader = aReader;
     }
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeValues.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeValues.java
index c37641f..a419abb 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeValues.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/attribute/AttributeValues.java
@@ -1,3 +1,23 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.attribute;
 
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/BlobParser.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/BlobParser.java
index 9667156..7edafae 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/BlobParser.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/BlobParser.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.type;
 
 import org.apache.openoffice.ooxml.parser.NameMap;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/DateTimeParser.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/DateTimeParser.java
index 76d7624..979d405 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/DateTimeParser.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/DateTimeParser.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.type;
 
 import org.apache.openoffice.ooxml.parser.NameMap;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/ISimpleTypeParser.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/ISimpleTypeParser.java
index 9ecd347..aaa2340 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/ISimpleTypeParser.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/ISimpleTypeParser.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.type;
 
 import org.apache.openoffice.ooxml.parser.NameMap;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/ListParser.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/ListParser.java
index a6764c5..94feeb0 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/ListParser.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/ListParser.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.type;
 
 import org.apache.openoffice.ooxml.parser.NameMap;
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/NumberParser.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/NumberParser.java
index b951d6f..19fc833 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/NumberParser.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/NumberParser.java
@@ -1,10 +1,30 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.type;
 
 import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.openoffice.ooxml.parser.NameMap;
-import org.apache.openoffice.ooxml.parser.type.StringParser.RestrictionType;
 
 public class NumberParser implements ISimpleTypeParser
 {
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/SimpleTypeManager.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/SimpleTypeManager.java
index cca933c..abeb529 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/SimpleTypeManager.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/SimpleTypeManager.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.type;
 
 import java.util.HashMap;
@@ -73,11 +94,18 @@ public class SimpleTypeManager
 
         for (final ISimpleTypeParser aParser : aTypeParsers)
         {
-            final Object aProcessedValue = aParser.Parse(
-                sRawValue,
-                maAttributeValueMap);
-            if (aProcessedValue != null)
-                return aProcessedValue;
+            try
+            {
+                final Object aProcessedValue = aParser.Parse(
+                    sRawValue,
+                    maAttributeValueMap);
+                if (aProcessedValue != null)
+                    return aProcessedValue;
+            }
+            catch(final Exception aException)
+            {
+                return "error";
+            }
         }
         return null;
     }
diff --git a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/StringParser.java b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/StringParser.java
index 192c3a5..c3b22bf 100644
--- a/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/StringParser.java
+++ b/ooxml/source/framework/JavaOOXMLParser/src/org/apache/openoffice/ooxml/parser/type/StringParser.java
@@ -1,3 +1,24 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.parser.type;
 
 import java.util.HashSet;
diff --git a/ooxml/source/framework/JavaPartManager/.classpath b/ooxml/source/framework/JavaPartManager/.classpath
new file mode 100644
index 0000000..5ec7648
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/JavaOOXMLParser"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/ooxml/source/framework/JavaPartManager/.project b/ooxml/source/framework/JavaPartManager/.project
new file mode 100644
index 0000000..08a7d0d
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>JavaPartManager</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/ooxml/source/framework/JavaPartManager/.settings/org.eclipse.jdt.core.prefs b/ooxml/source/framework/JavaPartManager/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..7341ab1
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/ContentType.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/ContentType.java
new file mode 100644
index 0000000..fc147cb
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/ContentType.java
@@ -0,0 +1,77 @@
+package org.apache.openoffice.ooxml.framework.part;
+
+public enum ContentType
+{
+    ApplicationDrawing  ("application/vnd.openxmlformats-officedocument.vmlDrawing"),
+    ApplicationExcel    ("application/vnd.ms-excel"),
+    ApplicationXML      ("application/xml"),
+    Chart               ("application/vnd.openxmlformats-officedocument.drawingml.chart+xml"),
+    ContentTypes        (""),
+    CoreProperties      ("application/vnd.openxmlformats-package.core-properties+xml"),
+    CustomXMLProperties ("application/vnd.openxmlformats-officedocument.customXmlProperties+xml"),
+    ExtendedProperties  ("application/vnd.openxmlformats-officedocument.extended-properties+xml"),
+    ImageGIF            ("image/gif"),
+    ImageJPG            ("image/png"),
+    ImagePNG            ("image/jpeg"),
+    OleObject           ("application/vnd.openxmlformats-officedocument.oleObject"),
+    PmlDocument         ("application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"),
+    PmlHandoutMaster    ("application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml"),
+    PmlNotesMaster      ("application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml"),
+    PmlNotesSlide       ("application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml"),
+    PmlProperties       ("application/vnd.openxmlformats-officedocument.presentationml.presProps+xml"),
+    PmlSlide            ("application/vnd.openxmlformats-officedocument.presentationml.slide+xml"),
+    PmlSlideLayout      ("application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"),
+    PmlSlideMaster      ("application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"),
+    PmlTableStyles      ("application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"),
+    PmlViewProperties   ("application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"),
+    Relationships       ("application/vnd.openxmlformats-package.relationships+xml"),
+    SmlSheet            ("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
+    Theme               ("application/vnd.openxmlformats-officedocument.theme+xml"),
+    ThemeOverride       ("application/vnd.openxmlformats-officedocument.themeOverride+xml"),
+    Thumbnail           ("http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"),
+    WmlDocument         ("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"),
+    WmlEndNotes         ("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"),
+    WmlFontTable        ("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"),
+    WmlFootNotes        ("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"),
+    WmlFooter           ("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml"),
+    WmlHeader           ("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"),
+    WmlNumbering        ("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"),
+    WmlSettings         ("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"),
+    WmlStyles           ("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"),
+    WmlWebSettings      ("application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"),
+
+    Unknown("");
+
+
+
+
+    ContentType (final String sMimeType)
+    {
+        msMimeType = sMimeType;
+    }
+
+
+
+
+    public static ContentType CreateForString (final String sContentType)
+    {
+        for (final ContentType eType : values())
+            if (eType.msMimeType.equals(sContentType))
+                return eType;
+        System.err.printf("content type '%s' is not known\n", sContentType);
+        return Unknown;
+    }
+
+
+
+
+    public String GetLongName ()
+    {
+        return msMimeType;
+    }
+
+
+
+
+    private final String msMimeType;
+}
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/ContentTypes.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/ContentTypes.java
new file mode 100644
index 0000000..d17a082
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/ContentTypes.java
@@ -0,0 +1,150 @@
+package org.apache.openoffice.ooxml.framework.part;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.stream.Location;
+
+import org.apache.openoffice.ooxml.framework.part.parser.ParserFactory;
+import org.apache.openoffice.ooxml.parser.ElementContext;
+import org.apache.openoffice.ooxml.parser.Parser;
+import org.apache.openoffice.ooxml.parser.action.ActionTrigger;
+import org.apache.openoffice.ooxml.parser.action.IAction;
+
+public class ContentTypes
+{
+    ContentTypes (final PartManager aPartManager)
+    {
+        maExtensionToContentTypeMap = new HashMap<>();
+        maPartNameToContentTypeMap = new HashMap<>();
+
+        // Technically the [Content_Types].xml stream is not a part and
+        // "[Content_Types].xml" is not a part name.  But handling it like one
+        // makes the implementation a little bit easier and more readable.
+        final Part aContentTypesPart = new Part(
+            ContentType.ContentTypes,
+            aPartManager,
+            new PartName("/[Content_Types].xml"));
+
+        final Parser aParser = ParserFactory.getParser(
+            aContentTypesPart.getContentType(),
+            aContentTypesPart.getStream(),
+            null);
+        /*
+        DefineContext(
+            CT_Something,
+            int nValue,
+            CallbackObject aObject);
+
+        class CT_Something_Context : public Context
+        {
+            Context parent
+
+            attribute 1
+            ...
+            attribute n
+            int nValue;
+            CallbackObject aObject;
+        }
+
+        DefineElementStartAction(
+            CT_Something_Context,
+            aObject,
+            DoSomething);
+
+
+        case ElementStart of CT_Something:
+            maCurrentContext.aObject.DoSomething(maCurrentContext);    // CT_Something_Context
+
+        //
+        CallbackObject.cxx
+
+        class CallbackObject
+        {
+            public: DoSomething(CT_Something_Context aContext)
+            {
+                aContext.attribute1
+            }
+        }
+
+            */
+        aParser.GetActionManager().AddElementStartAction(
+            ".*_CT_Default",
+            new IAction(){
+
+                @Override
+                public void Run(
+                    final ActionTrigger eTrigger,
+                    final ElementContext aContext,
+                    final String sText,
+                    final Location aStartLocation,
+                    final Location aEndLocation)
+                {
+                    ProcessDefault(
+                        aContext.GetAttributes().GetRawAttributeValue("A_Extension"),
+                        aContext.GetAttributes().GetRawAttributeValue("A_ContentType"));
+
+                }});
+        aParser.GetActionManager().AddElementStartAction(
+            ".*_CT_Override",
+            new IAction(){
+
+                @Override
+                public void Run(
+                    final ActionTrigger eTrigger,
+                    final ElementContext aContext,
+                    final String sText,
+                    final Location aStartLocation,
+                    final Location aEndLocation)
+                {
+                    ProcessOverride(
+                        aContext.GetAttributes().GetRawAttributeValue("A_PartName"),
+                        aContext.GetAttributes().GetRawAttributeValue("A_ContentType"));
+
+                }});
+
+
+        aParser.Parse();
+    }
+
+
+
+
+    public ContentType getTypeForPartName (final PartName aName)
+    {
+        ContentType eType = maPartNameToContentTypeMap.get(aName.GetFullname());
+        if (eType == null)
+            eType = maExtensionToContentTypeMap.get(aName.GetExtension());
+        if (eType == null)
+            eType = ContentType.Unknown;
+        return eType;
+    }
+
+
+
+
+    private void ProcessDefault (
+        final String sExtension,
+        final String sContentTypeName)
+    {
+        final ContentType eType = ContentType.CreateForString(sContentTypeName);
+        maExtensionToContentTypeMap.put(sExtension, eType);
+    }
+
+
+
+
+    private void ProcessOverride (
+        final String sPartName,
+        final String sContentTypeName)
+    {
+        final ContentType eType = ContentType.CreateForString(sContentTypeName);
+        maPartNameToContentTypeMap.put(sPartName, eType);
+    }
+
+
+
+
+    private final Map<String,ContentType> maExtensionToContentTypeMap;
+    private final Map<String,ContentType> maPartNameToContentTypeMap;
+}
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/IReferenceProvider.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/IReferenceProvider.java
new file mode 100644
index 0000000..9d47eb6
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/IReferenceProvider.java
@@ -0,0 +1,6 @@
+package org.apache.openoffice.ooxml.framework.part;
+
+public interface IReferenceProvider
+{
+    RelatedParts getRelatedParts ();
+}
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/OOXMLPackage.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/OOXMLPackage.java
new file mode 100644
index 0000000..3e5310a
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/OOXMLPackage.java
@@ -0,0 +1,56 @@
+package org.apache.openoffice.ooxml.framework.part;
+
+import java.io.File;
+import java.io.InputStream;
+
+public class OOXMLPackage
+    extends Package
+{
+    public static OOXMLPackage Create (final File aOOXMLFile)
+    {
+        return new OOXMLPackage(
+            aOOXMLFile.getAbsolutePath(),
+            new PartManager(aOOXMLFile));
+    }
+
+
+
+
+    private OOXMLPackage (final String sPath, final PartManager aPartManager)
+    {
+        super(sPath, aPartManager);
+    }
+
+
+
+
+    /** Return a list of stream names.
+     *  Note that that list is not necessarily identical to the list of part
+     *  names.  It can contain entries that are not parts.
+     */
+    public String[] listStreamNames ()
+    {
+        return maPartManager.listStreamNames();
+    }
+
+
+
+
+    /** Return an InputStream object for the specified stream.
+     */
+    public InputStream getStream (final String sStreamName)
+    {
+        return maPartManager.getStreamForStreamName(sStreamName);
+    }
+
+
+
+
+    public Part getPart (final PartName aPartName)
+    {
+        return new Part (
+            maPartManager.getContentTypes().getTypeForPartName(aPartName),
+            maPartManager,
+            aPartName);
+    }
+}
\ No newline at end of file
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/Package.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/Package.java
new file mode 100644
index 0000000..dd31292
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/Package.java
@@ -0,0 +1,158 @@
+package org.apache.openoffice.ooxml.framework.part;
+
+import java.io.File;
+import java.io.InputStream;
+import java.lang.ref.SoftReference;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+public class Package
+    implements IReferenceProvider
+{
+    public static Package Create (final File aOOXMLFile)
+    {
+        return new Package(
+            aOOXMLFile.getAbsolutePath(),
+            new PartManager(aOOXMLFile));
+    }
+
+
+
+
+    protected Package (
+        final String sFullFilename,
+        final PartManager aPartManager)
+    {
+        msFullFilename = sFullFilename;
+        maPartManager = aPartManager;
+        maRelatedParts = new RelatedParts(
+            new PartName(""),
+            aPartManager);
+
+        final PartName aDocumentPartName = maRelatedParts.GetSingleTargetForType(RelationshipType.OfficeDocument);
+        maOfficeDocumentPart = new Part(
+            maPartManager.getContentTypes().getTypeForPartName(aDocumentPartName),
+            maPartManager,
+            aDocumentPartName);
+    }
+
+
+
+
+    public Part getOfficeDocumentPart ()
+    {
+        return maOfficeDocumentPart;
+    }
+
+
+
+
+    public Iterable<Part> getDigitalSignaturesParts ()
+    {
+        // TODO
+        return new Vector<>();
+    }
+
+
+
+
+    public RelatedParts getRelatedParts ()
+    {
+        return maRelatedParts;
+    }
+
+
+
+
+    public boolean hasAppDefFilePropertiesPart ()
+    {
+        // TODO
+        return false;
+    }
+
+
+
+
+    public Part getAppDefFilePropertiesPart ()
+    {
+        // TODO
+        return null;
+    }
+
+
+
+
+    public boolean hasCoreFilePropertiesPart ()
+    {
+        // TODO
+        return false;
+    }
+
+
+
+
+    public Part getCoreFilePropertiesPart ()
+    {
+        // TODO
+        return null;
+    }
+
+
+
+
+    public boolean hasCustomFilePropertiesPart ()
+    {
+        // TODO
+        return false;
+    }
+
+
+
+
+    public Part getCustomFilePropertiesPart ()
+    {
+        // TODO
+        return null;
+    }
+
+
+
+
+    public String getFileName()
+    {
+        return msFullFilename;
+    }
+
+
+
+
+    /** Return a list of stream names.
+     *  Note that that list is not necessarily identical to the list of part
+     *  names.  It can contain entries that are not parts.
+     */
+    public String[] listStreamNames ()
+    {
+        return maPartManager.listStreamNames();
+    }
+
+
+
+
+    /** Return an InputStream object for the specified stream.
+     */
+    public InputStream getStream (final String sStreamName)
+    {
+        return maPartManager.getStreamForStreamName(sStreamName);
+    }
+
+
+
+
+    private final String msFullFilename;
+    protected final PartManager maPartManager;
+    private final RelatedParts maRelatedParts;
+    private final Part maOfficeDocumentPart;
+}
\ No newline at end of file
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/Part.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/Part.java
new file mode 100644
index 0000000..28b2617
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/Part.java
@@ -0,0 +1,89 @@
+package org.apache.openoffice.ooxml.framework.part;
+
+import java.io.InputStream;
+
+public class Part
+    implements IReferenceProvider
+{
+    public Part (
+        final ContentType eType,
+        final PartManager aPartManager,
+        final PartName aPartName)
+    {
+        meContentType = eType;
+        maPartManager = aPartManager;
+        maPartName = aPartName;
+        maRelatedParts = null;
+    }
+
+
+
+
+    public Part getPartById (final String sId)
+    {
+        final PartName aName = getRelatedParts().GetTargetForId(sId);
+        return new Part(
+            maPartManager.getContentTypes().getTypeForPartName(aName),
+            maPartManager,
+            aName);
+    }
+
+
+
+
+    public Part getPartByRelationshipType (final RelationshipType eType)
+    {
+        final PartName aName = getRelatedParts().GetSingleTargetForType(eType);
+        return new Part(
+            maPartManager.getContentTypes().getTypeForPartName(aName),
+            maPartManager,
+            aName);
+    }
+
+
+
+
+    public PartName getPartName ()
+    {
+        return maPartName;
+    }
+
+
+
+
+    public ContentType getContentType ()
+    {
+        return meContentType;
+    }
+
+
+
+
+    public InputStream getStream()
+    {
+        return maPartManager.getStreamForPartName(maPartName);
+    }
+
+
+
+
+    @Override
+    public RelatedParts getRelatedParts ()
+    {
+        if (maRelatedParts == null)
+        {
+            maRelatedParts = new RelatedParts(
+                maPartName,
+                maPartManager);
+        }
+        return maRelatedParts;
+    }
+
+
+
+
+    private final ContentType meContentType;
+    private final PartManager maPartManager;
+    private final PartName maPartName;
+    private RelatedParts maRelatedParts;
+}
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartManager.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartManager.java
new file mode 100644
index 0000000..c61f165
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartManager.java
@@ -0,0 +1,145 @@
+package org.apache.openoffice.ooxml.framework.part;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.ref.SoftReference;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+public class PartManager
+{
+    public PartManager (final File aFile)
+    {
+        ZipFile aZipFile = null;
+        try
+        {
+            aZipFile = new ZipFile(aFile);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        maZipFile = aZipFile;
+        maPartNameToPartMap = new HashMap<>();
+    }
+
+
+
+
+    public InputStream getStreamForPartName (final PartName aPartName)
+    {
+        final ZipEntry aEntry = maZipFile.getEntry(
+            ToZipEntryName(aPartName.GetFullname()));
+        if (aEntry == null)
+            return null;
+
+        try
+        {
+            return maZipFile.getInputStream(aEntry);
+        }
+        catch (IOException e)
+        {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+
+
+    /** This is the low-level variant of getStreamForPartName().
+     *  It can return streams for entries in the OOXML zip package
+     *  that are not, technically, parts.
+     *  @return
+     *      Returns null when the named stream does not exist or can not be
+     *      opened.
+     */
+    public InputStream getStreamForStreamName (final String sStreamName)
+    {
+        final ZipEntry aEntry = maZipFile.getEntry(
+            ToZipEntryName(sStreamName));
+        try
+        {
+            return maZipFile.getInputStream(aEntry);
+        }
+        catch (IOException e)
+        {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+
+
+    public ContentTypes getContentTypes ()
+    {
+        if (maContentTypes == null)
+        {
+            maContentTypes = new ContentTypes(this);
+        }
+        return maContentTypes;
+    }
+
+
+
+
+    private final String ToZipEntryName (final String sPath)
+    {
+        return sPath.substring(1);
+    }
+
+
+
+
+    /** Return a list of the names of all streams.
+     *  Note that that list is not necessarily identical to the list of part
+     *  names.  It can contain entries that are not parts.
+     */
+    public final String[] listStreamNames ()
+    {
+        final Vector<String> aStreamNames =  new Vector<>();
+
+        final Enumeration<? extends ZipEntry> aEntries = maZipFile.entries();
+        while (aEntries.hasMoreElements())
+        {
+            final ZipEntry aEntry = aEntries.nextElement();
+            aStreamNames.add(aEntry.getName());
+        }
+
+        return aStreamNames.toArray(new String[0]);
+    }
+
+
+
+
+    public Part getPart (final PartName aName)
+    {
+        SoftReference<Part> aSoftPart = maPartNameToPartMap.get(aName);
+        Part aPart = null;
+        if (aSoftPart != null)
+            aPart = aSoftPart.get();
+        if (aPart == null)
+        {
+            aPart = new Part(
+                getContentTypes().getTypeForPartName(aName),
+                this,
+                aName);
+            maPartNameToPartMap.put(aName, new SoftReference<Part>(aPart));
+        }
+
+        return aPart;
+    }
+
+
+
+
+    private ZipFile maZipFile;
+    private ContentTypes maContentTypes;
+    private final Map<PartName, SoftReference<Part>> maPartNameToPartMap;
+}
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartManagerPrototype.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartManagerPrototype.java
new file mode 100644
index 0000000..8aa8207
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartManagerPrototype.java
@@ -0,0 +1,33 @@
+package org.apache.openoffice.ooxml.framework.part;
+
+import java.io.File;
+
+import org.apache.openoffice.ooxml.framework.part.parser.ParserFactory;
+import org.apache.openoffice.ooxml.parser.Log;
+
+public class PartManagerPrototype
+{
+    public static void main (final String ... aArgumentList)
+    {
+        if (aArgumentList.length != 3)
+        {
+            System.err.printf("usage: PartManagerPrototype <ooxml-file-name> <parser-table-filename> <log-filename>");
+            System.exit(1);
+        }
+
+        final long nStartTime = System.currentTimeMillis();
+
+        Log.Dbg = new Log(aArgumentList[2]);
+        ParserFactory.SetParserTableFilename(aArgumentList[1]);
+
+        final File aOOXMLFile = new File(aArgumentList[0]);
+        final Part aPart = OOXMLPackage.Create(aOOXMLFile).getOfficeDocumentPart().getPartById("rId1");
+
+        final long nEndTime = System.currentTimeMillis();
+
+        System.out.printf("got content type %s for %s in %fs\n",
+            aPart.getContentType(),
+            aPart.getPartName(),
+            (nEndTime-nStartTime)/1000.0);
+    }
+}
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartName.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartName.java
new file mode 100644
index 0000000..e91aa37
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/PartName.java
@@ -0,0 +1,130 @@
+package org.apache.openoffice.ooxml.framework.part;
+
+/** Operations around part names.
+ */
+public class PartName
+    implements Comparable<PartName>
+{
+    public PartName (final String sPath)
+    {
+        if ( ! (sPath.isEmpty() || sPath.startsWith("/")))
+        {
+            assert(sPath.isEmpty() || sPath.startsWith("/"));
+        }
+        assert(sPath.indexOf('\\') == -1);
+
+        msPath = sPath;
+    }
+
+
+
+
+    public PartName (
+        final String sPath,
+        final PartName aParentName,
+        final String sMode)
+    {
+        switch(sMode)
+        {
+            case "External":
+                msPath = sPath;
+                break;
+
+            case "Internal":
+                msPath = Cleanup(aParentName.GetPathname() + "/" + sPath);
+                break;
+
+            default:
+                throw new RuntimeException();
+        }
+    }
+
+
+
+
+    public PartName getRelationshipsPartName ()
+    {
+        return new PartName(GetPathname() + "/_rels/" + GetBasename() + ".rels");
+    }
+
+
+
+
+    private String GetPathname ()
+    {
+        if (msPath.isEmpty())
+            return "";
+        else
+        {
+            final int nPathnameEnd = msPath.lastIndexOf('/');
+            assert(nPathnameEnd>=0);
+            return msPath.substring(0, nPathnameEnd);
+        }
+    }
+
+
+
+
+    public String GetBasename ()
+    {
+        if (msPath.isEmpty())
+            return "";
+        else
+        {
+            final int nBasenameStart = msPath.lastIndexOf('/');
+            assert(nBasenameStart>=0);
+            return msPath.substring(nBasenameStart+1);
+        }
+    }
+
+
+
+
+    public String GetExtension ()
+    {
+        final int nExtensionStart = msPath.lastIndexOf('.');
+        if (nExtensionStart < 0)
+            return null;
+        else
+            return msPath.substring(nExtensionStart+1);
+    }
+
+
+
+
+    public String GetFullname()
+    {
+        return msPath;
+    }
+
+
+
+
+    @Override
+    public int compareTo (final PartName aOther)
+    {
+        return msPath.compareTo(aOther.msPath);
+    }
+
+
+
+
+    private String Cleanup (final String sName)
+    {
+        return sName.replaceAll("/[^/]+/\\.\\./", "/");
+    }
+
+
+
+
+    @Override
+    public String toString ()
+    {
+        return msPath;
+    }
+
+
+
+
+    private final String msPath;
+}
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/RelatedParts.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/RelatedParts.java
new file mode 100644
index 0000000..22cd218
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/RelatedParts.java
@@ -0,0 +1,131 @@
+package org.apache.openoffice.ooxml.framework.part;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.Vector;
+
+import javax.xml.stream.Location;
+
+import org.apache.openoffice.ooxml.framework.part.parser.ParserFactory;
+import org.apache.openoffice.ooxml.parser.ElementContext;
+import org.apache.openoffice.ooxml.parser.Parser;
+import org.apache.openoffice.ooxml.parser.action.ActionTrigger;
+import org.apache.openoffice.ooxml.parser.action.IAction;
+
+public class RelatedParts
+{
+    RelatedParts (
+        final PartName aPartName,
+        final PartManager aPartManager)
+    {
+        maIdToTargetMap = new HashMap<>();
+        maTypeToTargetsMap = new HashMap<>();
+
+        final InputStream aStream = aPartManager.getStreamForPartName(aPartName.getRelationshipsPartName());
+        if (aStream != null)
+        {
+            final Parser aParser = ParserFactory.getParser(
+                ContentType.Relationships,
+                aStream,
+                null);
+            aParser.GetActionManager().AddElementStartAction(
+                "A_CT_Relationship",
+                new IAction()
+                {
+                    @Override public void Run (
+                        final ActionTrigger eTrigger,
+                        final ElementContext aContext,
+                        final String sText,
+                        final Location aStartLocation,
+                        final Location aEndLocation)
+                    {
+                        final String sId = aContext.GetAttributes().GetRawAttributeValue("A_Id");
+                        final String sType = aContext.GetAttributes().GetRawAttributeValue("A_Type");
+                        final String sTarget = aContext.GetAttributes().GetRawAttributeValue("A_Target");
+                        String sTargetMode = aContext.GetAttributes().GetRawAttributeValue("A_TargetMode");
+                        if (sTargetMode == null)
+                            sTargetMode = "Internal";
+
+                        AddRelationship(
+                            sId,
+                            RelationshipType.CreateFromString(sType),
+                            new PartName(sTarget, aPartName, sTargetMode));
+                    }
+                }
+            );
+            aParser.Parse();
+        }
+    }
+
+
+
+
+    private void AddRelationship (
+        final String sId,
+        final RelationshipType eType,
+        final PartName aTarget)
+    {
+        maIdToTargetMap.put(sId, aTarget);
+
+        Vector<PartName> aTargets = maTypeToTargetsMap.get(eType);
+        if (aTargets == null)
+        {
+            aTargets = new Vector<>();
+            maTypeToTargetsMap.put(eType, aTargets);
+        }
+        aTargets.add(aTarget);
+    }
+
+
+
+
+    public PartName GetTargetForId (final String sId)
+    {
+        return maIdToTargetMap.get(sId);
+    }
+
+
+
+
+    public Iterable<PartName> GetTargetsForType (final RelationshipType eType)
+    {
+        return maTypeToTargetsMap.get(eType);
+    }
+
+
+
+    public Iterable<PartName> getAllTargets ()
+    {
+        final Set<PartName> aAllNames = new TreeSet<>();
+        aAllNames.addAll(maIdToTargetMap.values());
+        return aAllNames;
+    }
+
+
+
+
+    public PartName GetSingleTargetForType (final RelationshipType eType)
+    {
+        if (maTypeToTargetsMap.get(eType).size() != 1)
+        {
+            System.out.printf("there are %d targets for relationship type %s\n",
+                maTypeToTargetsMap.get(eType).size(),
+                eType.toString());
+            for (final PartName aName : maTypeToTargetsMap.get(eType))
+            {
+                System.out.printf("%s\n", aName);
+            }
+            assert(false);
+        }
+        return maTypeToTargetsMap.get(eType).firstElement();
+    }
+
+
+
+
+    private final Map<String,PartName> maIdToTargetMap;
+    private final Map<RelationshipType, Vector<PartName>> maTypeToTargetsMap;
+}
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/RelationshipType.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/RelationshipType.java
new file mode 100644
index 0000000..3074d1b
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/RelationshipType.java
@@ -0,0 +1,112 @@
+package org.apache.openoffice.ooxml.framework.part;
+
+public enum RelationshipType
+{
+    ExtendedProperties,
+    CoreProperties,
+    OfficeDocument,
+    Image,
+    Header,
+    Hyperlink,
+    Styles,
+    EndNotes,
+    Footer,
+    Numbering,
+    CustomXML,
+    FootNotes,
+    WebSettings,
+    Theme,
+    Settings,
+    FontTable,
+    Thumbnail,
+    Slide,
+    ViewProperties,
+    PresentationProperties,
+    HandoutMaster,
+    TableStyles,
+    SlideMaster,
+    NotesMaster,
+    SlideLayout,
+    NotesSlide,
+    VMLDrawing,
+    OLE,
+    Chart,
+    Package,
+    ThemeOverride,
+
+    Unknown
+    ;
+
+    public static RelationshipType CreateFromString (final String sType)
+    {
+        switch(sType)
+        {
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties":
+                return ExtendedProperties;
+            case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties":
+                return CoreProperties;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
+                return OfficeDocument;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image":
+                return Image;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header":
+                return Header;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink":
+                return Hyperlink;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles":
+                return Styles;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes":
+                return EndNotes;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer":
+                return Footer;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering":
+                return Numbering;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml":
+                return CustomXML;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes":
+                return FootNotes;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings":
+                return WebSettings;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme":
+                return Theme;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings":
+                return Settings;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable":
+                return FontTable;
+            case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail":
+                return Thumbnail;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide":
+                return Slide;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps":
+                return ViewProperties;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps":
+                return PresentationProperties;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/handoutMaster":
+                return HandoutMaster;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles":
+                return TableStyles;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster":
+                return SlideMaster;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster":
+                return NotesMaster;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout":
+                return SlideLayout;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide":
+                return NotesSlide;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing":
+                return VMLDrawing;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject":
+                return OLE;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart":
+                return Chart;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package":
+                return Package;
+            case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride":
+                return ThemeOverride;
+
+            default:
+                System.err.printf(sType +" is not yet supported\n");
+                return Unknown;
+        }
+    }
+}
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/ContentTypesParser.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/ContentTypesParser.java
new file mode 100644
index 0000000..0d64f10
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/ContentTypesParser.java
@@ -0,0 +1,30 @@
+package org.apache.openoffice.ooxml.framework.part.parser;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Vector;
+
+import org.apache.openoffice.ooxml.parser.Parser;
+import org.apache.openoffice.ooxml.parser.StateMachine;
+
+public class ContentTypesParser
+    extends Parser
+{
+    public ContentTypesParser (
+        final InputStream aIn,
+        final String sParserTableFilename,
+        final Vector<String> aErrorsAndWarnings)
+    {
+        super(CreateStateMachine(sParserTableFilename, aErrorsAndWarnings), aIn);
+    }
+
+
+
+
+    private static StateMachine CreateStateMachine  (
+        final String sParserTableFilename,
+        final Vector<String> aErrorsAndWarnings)
+    {
+        return new StateMachine(new File(sParserTableFilename), aErrorsAndWarnings);
+    }
+}
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/ParserFactory.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/ParserFactory.java
new file mode 100644
index 0000000..83a635c
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/ParserFactory.java
@@ -0,0 +1,46 @@
+package org.apache.openoffice.ooxml.framework.part.parser;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Vector;
+
+import org.apache.openoffice.ooxml.framework.part.ContentType;
+import org.apache.openoffice.ooxml.parser.Parser;
+import org.apache.openoffice.ooxml.parser.StateMachine;
+
+public class ParserFactory
+{
+    public static Parser getParser (
+        final ContentType eType,
+        final InputStream aStream,
+        final Vector<String> aErrorsAndWarnings)
+    {
+        switch(eType)
+        {
+            case Relationships:
+                return new RelationshipParser(aStream, msParserTableFilename, aErrorsAndWarnings);
+
+            case ContentTypes:
+                return new ContentTypesParser(aStream, msParserTableFilename, aErrorsAndWarnings);
+
+            default:
+                return new Parser(
+                    new StateMachine(new File(msParserTableFilename), aErrorsAndWarnings),
+                    aStream);
+        }
+    }
+
+
+
+
+    public static void SetParserTableFilename (final String sFilename)
+    {
+        assert(new File(sFilename).exists());
+        msParserTableFilename = sFilename;
+    }
+
+
+
+
+    private static String msParserTableFilename = null;
+}
diff --git a/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/RelationshipParser.java b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/RelationshipParser.java
new file mode 100644
index 0000000..bcbfd33
--- /dev/null
+++ b/ooxml/source/framework/JavaPartManager/src/org/apache/openoffice/ooxml/framework/part/parser/RelationshipParser.java
@@ -0,0 +1,30 @@
+package org.apache.openoffice.ooxml.framework.part.parser;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Vector;
+
+import org.apache.openoffice.ooxml.parser.Parser;
+import org.apache.openoffice.ooxml.parser.StateMachine;
+
+public class RelationshipParser
+    extends Parser
+{
+    public RelationshipParser (
+        final InputStream aIn,
+        final String sParserTableFilename,
+        final Vector<String> aErrorsAndWarnings)
+    {
+        super(CreateStateMachine(sParserTableFilename, aErrorsAndWarnings), aIn);
+    }
+
+
+
+
+    private static StateMachine CreateStateMachine (
+        final String sParserTableFilename,
+        final Vector<String> aErrorsAndWarnings)
+    {
+        return new StateMachine(new File(sParserTableFilename), aErrorsAndWarnings);
+    }
+}
diff --git a/ooxml/source/framework/OOXMLViewer/.classpath b/ooxml/source/framework/OOXMLViewer/.classpath
new file mode 100755
index 0000000..ecd0bc8
--- /dev/null
+++ b/ooxml/source/framework/OOXMLViewer/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/JavaPartManager"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/JavaOOXMLParser"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/ooxml/source/framework/OOXMLViewer/.project b/ooxml/source/framework/OOXMLViewer/.project
new file mode 100755
index 0000000..51a9631
--- /dev/null
+++ b/ooxml/source/framework/OOXMLViewer/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>OOXMLViewer</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/ooxml/source/framework/OOXMLViewer/.settings/org.eclipse.jdt.core.prefs b/ooxml/source/framework/OOXMLViewer/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..838bd9d
--- /dev/null
+++ b/ooxml/source/framework/OOXMLViewer/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/DetailViewManager.java b/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/DetailViewManager.java
new file mode 100755
index 0000000..5bf1e19
--- /dev/null
+++ b/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/DetailViewManager.java
@@ -0,0 +1,131 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.viewer;
+
+import java.util.Vector;
+
+import javax.swing.JScrollPane;
+
+import org.apache.openoffice.ooxml.framework.part.ContentType;
+import org.apache.openoffice.ooxml.framework.part.OOXMLPackage;
+import org.apache.openoffice.ooxml.framework.part.Part;
+import org.apache.openoffice.ooxml.framework.part.PartName;
+import org.apache.openoffice.ooxml.framework.part.parser.ParserFactory;
+import org.apache.openoffice.ooxml.viewer.tokenview.TokenView;
+import org.apache.openoffice.ooxml.viewer.xml.TokenType;
+import org.apache.openoffice.ooxml.viewer.xml.XMLTokenViewFactory;
+import org.apache.openoffice.ooxml.viewer.xmltokenview.XMLViewFactory;
+
+public class DetailViewManager
+{
+    public DetailViewManager (
+        final JScrollPane aDetailViewContainer,
+        final OOXMLPackage aPackage)
+    {
+        maDetailViewContainer = aDetailViewContainer;
+        maPackage = aPackage;
+        maViewFactory = new XMLTokenViewFactory();
+    }
+
+
+
+
+    public void ShowPart (
+        final PartName aName,
+        final ContentType eType)
+    {
+        ShowPart(maPackage.getPart(aName));
+    }
+
+
+
+
+    public void ShowPart (final Part aPart)
+    {
+        switch(aPart.getContentType())
+        {
+            case ImageGIF:
+            case ImageJPG:
+            case ImagePNG:
+                maDetailViewContainer.setViewportView(
+                    new ImageView(aPart.getStream()).GetComponent());
+                break;
+
+            case ApplicationDrawing:
+            case ApplicationExcel:
+            case ApplicationXML:
+            case Chart:
+            case ContentTypes:
+            case CoreProperties:
+            case CustomXMLProperties:
+            case ExtendedProperties:
+            case PmlDocument:
+            case PmlHandoutMaster:
+            case PmlNotesMaster:
+            case PmlNotesSlide:
+            case PmlProperties:
+            case PmlSlide:
+            case PmlSlideLayout:
+            case PmlSlideMaster:
+            case PmlTableStyles:
+            case PmlViewProperties:
+            case Relationships:
+            case SmlSheet:
+            case Theme:
+            case ThemeOverride:
+            case WmlDocument:
+            case WmlEndNotes:
+            case WmlFontTable:
+            case WmlFootNotes:
+            case WmlFooter:
+            case WmlHeader:
+            case WmlNumbering:
+            case WmlSettings:
+            case WmlStyles:
+            case WmlWebSettings:
+                final TokenView<TokenType> aTokenView = maViewFactory.Create(aPart.getStream());
+                maDetailViewContainer.setViewportView(aTokenView);
+                final Vector<String> aErrorsAndWarnings = new Vector<>();
+                XMLViewFactory.AddSemanticInformation(
+                    aTokenView,
+                    ParserFactory.getParser(
+                        aPart.getContentType(),
+                        aPart.getStream(),
+                        aErrorsAndWarnings),
+                    aErrorsAndWarnings);
+                break;
+
+            case OleObject:
+            case Unknown:
+            default:
+                maDetailViewContainer.setViewportView(null);
+                break;
+        }
+    }
+
+
+
+
+    private final JScrollPane maDetailViewContainer;
+    private XMLTokenViewFactory maViewFactory;
+    private OOXMLPackage maPackage;
+}
diff --git a/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/ImageView.java b/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/ImageView.java
new file mode 100755
index 0000000..b7ea3ba
--- /dev/null
+++ b/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/ImageView.java
@@ -0,0 +1,75 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.viewer;
+
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.imageio.ImageIO;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+
+ at SuppressWarnings("serial")
+public class ImageView
+    extends JPanel
+{
+    public ImageView (final InputStream aInputStream)
+    {
+        BufferedImage aImage = null;
+        try
+        {
+            aImage = ImageIO.read(aInputStream);
+        }
+        catch (IOException e)
+        {
+            e.printStackTrace();
+        }
+        maImage = aImage;
+    }
+
+
+
+
+    public JComponent GetComponent()
+    {
+        return this;
+    }
+
+
+
+
+    @Override
+    public void paintComponent (final Graphics aGraphics)
+    {
+        super.paintComponent(aGraphics);
+        if (maImage != null)
+        {
+            aGraphics.drawImage(maImage, 10, 10, null);
+        }
+    }
+
+
+
+    private final BufferedImage maImage;
+}
diff --git a/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/KeyListener.java b/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/KeyListener.java
new file mode 100755
index 0000000..ed752ef
--- /dev/null
+++ b/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/KeyListener.java
@@ -0,0 +1,50 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you 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.apache.openoffice.ooxml.viewer;
+
+import java.awt.event.KeyEvent;
+
+public class KeyListener
+    implements java.awt.event.KeyListener
+{
+
+    @Override
+    public void keyTyped(KeyEvent e)
+    {
+        System.out.println(e);
+    }
+
+    @Override
+    public void keyPressed(KeyEvent e)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void keyReleased(KeyEvent e)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+}
diff --git a/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/OOXMLViewer.java b/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/OOXMLViewer.java
new file mode 100755
index 0000000..cc7f363
--- /dev/null
+++ b/ooxml/source/framework/OOXMLViewer/src/org/apache/openoffice/ooxml/viewer/OOXMLViewer.java

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list