source: osm/applications/editors/josm/plugins/opendata/includes/org/jopendocument/dom/ODSingleXMLDocument.java

Last change on this file was 36483, checked in by stoecker, 9 days ago

set eol-style, fix checkstyle issues, add ignores

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1/*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 2008 jOpenDocument, by ILM Informatique. All rights reserved.
5 *
6 * The contents of this file are subject to the terms of the GNU
7 * General Public License Version 3 only ("GPL").
8 * You may not use this file except in compliance with the License.
9 * You can obtain a copy of the License at http://www.gnu.org/licenses/gpl-3.0.html
10 * See the License for the specific language governing permissions and limitations under the License.
11 *
12 * When distributing the software, include this License Header Notice in each file.
13 *
14 */
15
16package org.jopendocument.dom;
17
18import java.util.HashSet;
19import java.util.Set;
20
21/**
22 * An XML document containing all of an office document, see section 2.1 of OpenDocument 1.1.
23 *
24 * @author Sylvain CUAZ 24 nov. 2004
25 */
26public class ODSingleXMLDocument extends ODXMLDocument implements Cloneable, ODDocument {
27
28 final static Set<String> DONT_PREFIX;
29 static {
30 DONT_PREFIX = new HashSet<>();
31 // don't touch to user fields and variables
32 // we want them to be the same across the document
33 DONT_PREFIX.add("user-field-decl");
34 DONT_PREFIX.add("user-field-get");
35 DONT_PREFIX.add("variable-get");
36 DONT_PREFIX.add("variable-decl");
37 DONT_PREFIX.add("variable-set");
38 }
39
40 /**
41 * fix bug when a SingleXMLDoc is used to create a document (for example with P2 and 1_P2), and
42 * then create another instance s2 with the previous document and add a second file (also with
43 * P2 and 1_P2) => s2 will contain P2, 1_P2, 1_P2, 1_1_P2.
44 */
45 private static final String COUNT = "SingleXMLDocument_count";
46
47 /** Le nombre de fichiers concat */
48 private int numero;
49 /** Les styles présent dans ce document */
50 private final Set<String> stylesNames;
51 /** Les styles de liste présent dans ce document */
52 private final Set<String> listStylesNames;
53 /** Les fichiers référencés par ce document */
54 private final ODPackage pkg;
55 private final ODMeta meta;
56
57 ODSingleXMLDocument(ODSingleXMLDocument doc, ODPackage p) {
58 super(doc);
59 this.stylesNames = new HashSet<>(doc.stylesNames);
60 this.listStylesNames = new HashSet<>(doc.listStylesNames);
61 this.pkg = p;
62 this.meta = ODMeta.create(this);
63 this.setNumero(doc.numero);
64 }
65
66 @Override
67 public ODSingleXMLDocument clone() {
68 final ODPackage copy = new ODPackage(this.pkg);
69 return (ODSingleXMLDocument) copy.getContent();
70 }
71
72 private void setNumero(int numero) {
73 this.numero = numero;
74 this.meta.getUserMeta(COUNT, true).setValue(this.numero);
75 }
76
77 @Override
78 public ODPackage getPackage() {
79 return this.pkg;
80 }
81}
Note: See TracBrowser for help on using the repository browser.