Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "SchemaSimpleTypeContext.hxx"
31 : :
32 : : #include "SchemaRestrictionContext.hxx"
33 : : #include <xmloff/xmltoken.hxx>
34 : : #include <xmloff/nmspmap.hxx>
35 : : #include <xmloff/xmlnmspe.hxx>
36 : : #include <xmloff/xmltkmap.hxx>
37 : : #include <xmloff/xmluconv.hxx>
38 : :
39 : : #include <com/sun/star/beans/XPropertySet.hpp>
40 : : #include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
41 : :
42 : : using rtl::OUString;
43 : : using com::sun::star::uno::Reference;
44 : : using com::sun::star::uno::Any;
45 : : using com::sun::star::xml::sax::XAttributeList;
46 : : using com::sun::star::beans::XPropertySet;
47 : : using com::sun::star::xforms::XDataTypeRepository;
48 : : using namespace xmloff::token;
49 : :
50 : :
51 : :
52 : :
53 : : static SvXMLTokenMapEntry aAttributes[] =
54 : : {
55 : : TOKEN_MAP_ENTRY( NONE, NAME ),
56 : : XML_TOKEN_MAP_END
57 : : };
58 : :
59 : : static SvXMLTokenMapEntry aChildren[] =
60 : : {
61 : : TOKEN_MAP_ENTRY( XSD, RESTRICTION ),
62 : : XML_TOKEN_MAP_END
63 : : };
64 : :
65 : :
66 : 0 : SchemaSimpleTypeContext::SchemaSimpleTypeContext(
67 : : SvXMLImport& rImport,
68 : : sal_uInt16 nPrefix,
69 : : const OUString& rLocalName,
70 : : const Reference<XDataTypeRepository>& rRepository ) :
71 : : TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
72 : 0 : mxRepository( rRepository )
73 : : {
74 : 0 : }
75 : :
76 : 0 : SchemaSimpleTypeContext::~SchemaSimpleTypeContext()
77 : : {
78 [ # # ]: 0 : }
79 : :
80 : 0 : void SchemaSimpleTypeContext::HandleAttribute(
81 : : sal_uInt16 nToken,
82 : : const OUString& rValue )
83 : : {
84 [ # # ]: 0 : if( nToken == XML_NAME )
85 : : {
86 : 0 : msTypeName = rValue;
87 : : }
88 : 0 : }
89 : :
90 : 0 : SvXMLImportContext* SchemaSimpleTypeContext::HandleChild(
91 : : sal_uInt16 nToken,
92 : : sal_uInt16 nPrefix,
93 : : const OUString& rLocalName,
94 : : const Reference<XAttributeList>& )
95 : : {
96 : 0 : SvXMLImportContext* pContext = NULL;
97 [ # # ]: 0 : switch( nToken )
98 : : {
99 : : case XML_RESTRICTION:
100 : 0 : pContext = new SchemaRestrictionContext( GetImport(),
101 : : nPrefix, rLocalName,
102 [ # # ]: 0 : mxRepository, msTypeName );
103 : 0 : break;
104 : : default:
105 : : OSL_FAIL( "Booo!" );
106 : : }
107 : :
108 : : return ( pContext != NULL )
109 : : ? pContext
110 [ # # ][ # # ]: 0 : : new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
111 : : }
112 : :
113 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|