1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
26 #include <com/sun/star/uno/Any.hxx>
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <com/sun/star/uno/RuntimeException.hpp>
29 #include <com/sun/star/uno/XInterface.hpp>
30 #include <osl/file.hxx>
31 #include <rtl/ref.hxx>
32 #include <rtl/string.h>
33 #include <rtl/ustring.hxx>
34 #include <sal/types.h>
35 #include <xmlreader/span.hxx>
36 #include <xmlreader/xmlreader.hxx>
39 #include "groupnode.hxx"
40 #include "localizedpropertynode.hxx"
41 #include "localizedvaluenode.hxx"
43 #include "nodemap.hxx"
44 #include "parsemanager.hxx"
46 #include "propertynode.hxx"
47 #include "setnode.hxx"
49 #include "xmldata.hxx"
56 xmlreader::XmlReader
const & reader
, xmlreader::Span
const & text
)
59 sal_Int32 i
= rtl_str_indexOfChar_WithLength(text
.begin
, text
.length
, ':');
61 switch (reader
.getNamespaceId(xmlreader::Span(text
.begin
, i
))) {
62 case ParseManager::NAMESPACE_OOR
:
63 if (xmlreader::Span(text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
67 } else if (xmlreader::Span(
68 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
69 equals("boolean-list"))
71 return TYPE_BOOLEAN_LIST
;
72 } else if (xmlreader::Span(
73 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
76 return TYPE_SHORT_LIST
;
77 } else if (xmlreader::Span(
78 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
82 } else if (xmlreader::Span(
83 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
86 return TYPE_LONG_LIST
;
87 } else if (xmlreader::Span(
88 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
89 equals("double-list"))
91 return TYPE_DOUBLE_LIST
;
92 } else if (xmlreader::Span(
93 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
94 equals("string-list"))
96 return TYPE_STRING_LIST
;
97 } else if (xmlreader::Span(
98 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
99 equals("hexBinary-list"))
101 return TYPE_HEXBINARY_LIST
;
104 case ParseManager::NAMESPACE_XS
:
105 if (xmlreader::Span(text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
109 } else if (xmlreader::Span(
110 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
114 } else if (xmlreader::Span(
115 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
119 } else if (xmlreader::Span(
120 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
124 } else if (xmlreader::Span(
125 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
129 } else if (xmlreader::Span(
130 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
134 } else if (xmlreader::Span(
135 text
.begin
+ i
+ 1, text
.length
- (i
+ 1)).
138 return TYPE_HEXBINARY
;
145 throw css::uno::RuntimeException(
146 "invalid type " + text
.convertFromUtf8());
149 bool parseBoolean(xmlreader::Span
const & text
) {
151 if (text
.equals("true")) {
154 if (text
.equals("false")) {
157 throw css::uno::RuntimeException(
158 "invalid boolean " + text
.convertFromUtf8());
161 OUString
parseTemplateReference(
162 OUString
const & component
, bool hasNodeType
,
163 OUString
const & nodeType
, OUString
const * defaultTemplateName
)
166 if (defaultTemplateName
!= 0) {
167 return *defaultTemplateName
;
169 throw css::uno::RuntimeException(
170 "missing node-type attribute");
172 return Data::fullTemplateName(component
, nodeType
);
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */