Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "SchemaSimpleTypeContext.hxx"
22 :
23 : #include "SchemaRestrictionContext.hxx"
24 : #include <xmloff/xmltoken.hxx>
25 : #include <xmloff/nmspmap.hxx>
26 : #include <xmloff/xmlnmspe.hxx>
27 : #include <xmloff/xmltkmap.hxx>
28 : #include <xmloff/xmluconv.hxx>
29 :
30 : #include <com/sun/star/beans/XPropertySet.hpp>
31 : #include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
32 :
33 : using rtl::OUString;
34 : using com::sun::star::uno::Reference;
35 : using com::sun::star::uno::Any;
36 : using com::sun::star::xml::sax::XAttributeList;
37 : using com::sun::star::beans::XPropertySet;
38 : using com::sun::star::xforms::XDataTypeRepository;
39 : using namespace xmloff::token;
40 :
41 :
42 :
43 :
44 : static SvXMLTokenMapEntry aAttributes[] =
45 : {
46 : TOKEN_MAP_ENTRY( NONE, NAME ),
47 : XML_TOKEN_MAP_END
48 : };
49 :
50 : static SvXMLTokenMapEntry aChildren[] =
51 : {
52 : TOKEN_MAP_ENTRY( XSD, RESTRICTION ),
53 : XML_TOKEN_MAP_END
54 : };
55 :
56 :
57 0 : SchemaSimpleTypeContext::SchemaSimpleTypeContext(
58 : SvXMLImport& rImport,
59 : sal_uInt16 nPrefix,
60 : const OUString& rLocalName,
61 : const Reference<XDataTypeRepository>& rRepository ) :
62 : TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
63 0 : mxRepository( rRepository )
64 : {
65 0 : }
66 :
67 0 : SchemaSimpleTypeContext::~SchemaSimpleTypeContext()
68 : {
69 0 : }
70 :
71 0 : void SchemaSimpleTypeContext::HandleAttribute(
72 : sal_uInt16 nToken,
73 : const OUString& rValue )
74 : {
75 0 : if( nToken == XML_NAME )
76 : {
77 0 : msTypeName = rValue;
78 : }
79 0 : }
80 :
81 0 : SvXMLImportContext* SchemaSimpleTypeContext::HandleChild(
82 : sal_uInt16 nToken,
83 : sal_uInt16 nPrefix,
84 : const OUString& rLocalName,
85 : const Reference<XAttributeList>& )
86 : {
87 0 : SvXMLImportContext* pContext = NULL;
88 0 : switch( nToken )
89 : {
90 : case XML_RESTRICTION:
91 0 : pContext = new SchemaRestrictionContext( GetImport(),
92 : nPrefix, rLocalName,
93 0 : mxRepository, msTypeName );
94 0 : break;
95 : default:
96 : OSL_FAIL( "Booo!" );
97 : }
98 :
99 : return ( pContext != NULL )
100 : ? pContext
101 0 : : new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
102 : }
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|