xref: /AOO41X/main/xmloff/source/xforms/SchemaContext.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_xmloff.hxx"
30 
31 #include "SchemaContext.hxx"
32 
33 #include "SchemaSimpleTypeContext.hxx"
34 
35 #include <xmloff/xmltoken.hxx>
36 #include <xmloff/nmspmap.hxx>
37 #include <xmloff/xmlnmspe.hxx>
38 #include <xmloff/xmltkmap.hxx>
39 #include <xmloff/xmluconv.hxx>
40 
41 #include <com/sun/star/beans/XPropertySet.hpp>
42 #include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
43 #include <com/sun/star/xforms/XDataTypeRepository.hpp>
44 
45 #include <tools/debug.hxx>
46 
47 
48 using rtl::OUString;
49 using com::sun::star::uno::Reference;
50 using com::sun::star::uno::Any;
51 using com::sun::star::xml::sax::XAttributeList;
52 using com::sun::star::xforms::XDataTypeRepository;
53 using namespace xmloff::token;
54 
55 
56 
57 
58 static SvXMLTokenMapEntry aAttributes[] =
59 {
60     XML_TOKEN_MAP_END
61 };
62 
63 static SvXMLTokenMapEntry aChildren[] =
64 {
65     TOKEN_MAP_ENTRY( XSD, SIMPLETYPE ),
66     XML_TOKEN_MAP_END
67 };
68 
69 
70 SchemaContext::SchemaContext(
71     SvXMLImport& rImport,
72     sal_uInt16 nPrefix,
73     const OUString& rLocalName,
74     const Reference<XDataTypeRepository>& rRepository ) :
75         TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
76         mxRepository( rRepository )
77 {
78 }
79 
80 SchemaContext::~SchemaContext()
81 {
82 }
83 
84 void SchemaContext::HandleAttribute(
85     sal_uInt16,
86     const OUString& )
87 {
88 }
89 
90 SvXMLImportContext* SchemaContext::HandleChild(
91     sal_uInt16 nToken,
92     sal_uInt16 nPrefix,
93     const OUString& rLocalName,
94     const Reference<XAttributeList>& )
95 {
96     return ( nToken == XML_SIMPLETYPE )
97         ? new SchemaSimpleTypeContext( GetImport(), nPrefix, rLocalName,
98                                        mxRepository )
99         : new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
100 }
101