1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmloff.hxx"
26
27 #include "SchemaContext.hxx"
28
29 #include "SchemaSimpleTypeContext.hxx"
30
31 #include <xmloff/xmltoken.hxx>
32 #include <xmloff/nmspmap.hxx>
33 #include <xmloff/xmlnmspe.hxx>
34 #include <xmloff/xmltkmap.hxx>
35 #include <xmloff/xmluconv.hxx>
36
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
39 #include <com/sun/star/xforms/XDataTypeRepository.hpp>
40
41 #include <tools/debug.hxx>
42
43
44 using rtl::OUString;
45 using com::sun::star::uno::Reference;
46 using com::sun::star::uno::Any;
47 using com::sun::star::xml::sax::XAttributeList;
48 using com::sun::star::xforms::XDataTypeRepository;
49 using namespace xmloff::token;
50
51
52
53
54 static SvXMLTokenMapEntry aAttributes[] =
55 {
56 XML_TOKEN_MAP_END
57 };
58
59 static SvXMLTokenMapEntry aChildren[] =
60 {
61 TOKEN_MAP_ENTRY( XSD, SIMPLETYPE ),
62 XML_TOKEN_MAP_END
63 };
64
65
SchemaContext(SvXMLImport & rImport,sal_uInt16 nPrefix,const OUString & rLocalName,const Reference<XDataTypeRepository> & rRepository)66 SchemaContext::SchemaContext(
67 SvXMLImport& rImport,
68 sal_uInt16 nPrefix,
69 const OUString& rLocalName,
70 const Reference<XDataTypeRepository>& rRepository ) :
71 TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
72 mxRepository( rRepository )
73 {
74 }
75
~SchemaContext()76 SchemaContext::~SchemaContext()
77 {
78 }
79
HandleAttribute(sal_uInt16,const OUString &)80 void SchemaContext::HandleAttribute(
81 sal_uInt16,
82 const OUString& )
83 {
84 }
85
HandleChild(sal_uInt16 nToken,sal_uInt16 nPrefix,const OUString & rLocalName,const Reference<XAttributeList> &)86 SvXMLImportContext* SchemaContext::HandleChild(
87 sal_uInt16 nToken,
88 sal_uInt16 nPrefix,
89 const OUString& rLocalName,
90 const Reference<XAttributeList>& )
91 {
92 return ( nToken == XML_SIMPLETYPE )
93 ? new SchemaSimpleTypeContext( GetImport(), nPrefix, rLocalName,
94 mxRepository )
95 : new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
96 }
97