OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 17 | Rev 180 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17 Rev 21
Line 12... Line 12...
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.openoffice;
14
 package org.openconcerto.openoffice;
15
 
15
 
16
import org.openconcerto.utils.FileUtils;
16
import org.openconcerto.utils.FileUtils;
17
import org.openconcerto.utils.FormatGroup;
-
 
18
import org.openconcerto.utils.XMLDateFormat;
-
 
19
import org.openconcerto.xml.JDOMUtils;
17
import org.openconcerto.xml.JDOMUtils;
20
 
18
 
21
import java.awt.Color;
19
import java.awt.Color;
22
import java.io.File;
20
import java.io.File;
23
import java.io.IOException;
21
import java.io.IOException;
24
import java.io.StringReader;
22
import java.io.StringReader;
25
import java.text.Format;
-
 
26
import java.text.SimpleDateFormat;
-
 
27
 
23
 
28
import org.jdom.Document;
24
import org.jdom.Document;
29
import org.jdom.JDOMException;
25
import org.jdom.JDOMException;
30
import org.jdom.Namespace;
26
import org.jdom.Namespace;
31
import org.jdom.input.SAXBuilder;
27
import org.jdom.input.SAXBuilder;
32
import org.jdom.xpath.XPath;
28
import org.jdom.xpath.XPath;
33
import org.xml.sax.EntityResolver;
29
import org.xml.sax.EntityResolver;
34
import org.xml.sax.InputSource;
30
import org.xml.sax.InputSource;
35
 
31
 
36
public class OOUtils {
32
public class OOUtils {
37
    // as per 16.1 "Data Types" and 6.7.1 "Variable Value Types and Values"
-
 
38
    // see http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#isoformats
-
 
39
 
-
 
40
    // time means Duration for OpenDocument (see 6.7.1)
-
 
41
    public static final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("'PT'HH'H'mm'M'ss'S'");
-
 
42
    static public final Format DATE_FORMAT;
-
 
43
    static {
-
 
44
        // first date and time so we don't loose time information on format() or parse()
-
 
45
        // MAYBE add HH':'mm':'ss,SSS for OOo 1
-
 
46
        DATE_FORMAT = new FormatGroup(new XMLDateFormat(), new SimpleDateFormat("yyyy-MM-dd'T'HH':'mm':'ss"), new SimpleDateFormat("yyyy-MM-dd"));
-
 
47
    }
-
 
48
 
33
 
49
    // MAYBE configurable
34
    // MAYBE configurable
50
    static private final String[] executables = { "ooffice2", "ooffice", "soffice" };
35
    static private final String[] executables = { "ooffice2", "ooffice", "soffice" };
51
 
36
 
52
    /**
37
    /**