LibreOffice Module xmloff (master) 1
xmlerror.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_XMLOFF_XMLERROR_HXX
21#define INCLUDED_XMLOFF_XMLERROR_HXX
22
23#include <sal/types.h>
24#include <rtl/ustring.hxx>
26
27#include <vector>
28
29// masks for the error ID fields
30#define XMLERROR_MASK_FLAG 0xF0000000
31#define XMLERROR_MASK_CLASS 0x00FF0000
32#define XMLERROR_MASK_NUMBER 0x0000FFFF
33
34// error flags:
35#define XMLERROR_FLAG_WARNING 0x10000000
36#define XMLERROR_FLAG_ERROR 0x20000000
37#define XMLERROR_FLAG_SEVERE 0x40000000
38
39// error classes: Error ID
40#define XMLERROR_CLASS_IO 0x00010000
41#define XMLERROR_CLASS_FORMAT 0x00020000
42#define XMLERROR_CLASS_API 0x00040000
43#define XMLERROR_CLASS_OTHER 0x00080000
44
45// error numbers, listed by error class
46// Within each class, errors should be numbered consecutively. Please
47// always add to error code below the appropriate comment.
48
49// I/O errors:
50
51// format errors:
52#define XMLERROR_SAX ( XMLERROR_CLASS_FORMAT | 0x00000001 )
53#define XMLERROR_STYLE_ATTR_VALUE ( XMLERROR_CLASS_FORMAT | 0x00000002 )
54#define XMLERROR_NO_INDEX_ALLOWED_HERE ( XMLERROR_CLASS_FORMAT | 0x00000003 )
55#define XMLERROR_PARENT_STYLE_NOT_ALLOWED ( XMLERROR_CLASS_FORMAT | 0x00000004 )
56#define XMLERROR_ILLEGAL_EVENT (XMLERROR_CLASS_FORMAT | 0x00000005 )
57#define XMLERROR_NAMESPACE_TROUBLE (XMLERROR_CLASS_FORMAT | 0x00000006 )
58
59#define XMLERROR_XFORMS_NO_SCHEMA_SUPPORT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000007 )
60#define XMLERROR_XFORMS_UNKNOWN ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000008 )
61#define XMLERROR_XFORMS_ONLY_ONE_INSTANCE_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000009 )
62#define XMLERROR_UNKNOWN_ATTRIBUTE ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000a )
63#define XMLERROR_UNKNOWN_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000b )
64#define XMLERROR_UNKNOWN_CHARACTERS ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000c )
65#define XMLERROR_UNKNOWN_ROOT (XMLERROR_CLASS_FORMAT | 0x0000000d )
66
67// API errors:
68#define XMLERROR_STYLE_PROP_VALUE ( XMLERROR_CLASS_API | 0x00000001 )
69#define XMLERROR_STYLE_PROP_UNKNOWN ( XMLERROR_CLASS_API | 0x00000002 )
70#define XMLERROR_STYLE_PROP_OTHER ( XMLERROR_CLASS_API | 0x00000003 )
71#define XMLERROR_API ( XMLERROR_CLASS_API | 0x00000004 )
72
73// other errors:
74#define XMLERROR_CANCEL ( XMLERROR_CLASS_OTHER | 0x00000001 )
75
76// 16bit error flag constants for use in the
77// SvXMLExport/SvXMLImport error flags
78enum class SvXMLErrorFlags {
79 NO = 0x0000,
80 DO_NOTHING = 0x0001,
81 ERROR_OCCURRED = 0x0002,
82 WARNING_OCCURRED = 0x0004,
83};
84
85namespace o3tl
86{
87 template<> struct typed_flags<SvXMLErrorFlags> : is_typed_flags<SvXMLErrorFlags, 0x7> {};
88}
89
90namespace com::sun::star {
91 namespace uno { template<class X> class Sequence; }
92 namespace uno { template<class X> class Reference; }
93 namespace xml::sax { class XLocator; }
94}
95
96class ErrorRecord;
97
103{
105 typedef ::std::vector<ErrorRecord> ErrorList;
106
108
109public:
110
111 XMLErrors();
112 ~XMLErrors();
113
116 sal_Int32 nId,
117 const css::uno::Sequence< OUString> & rParams,
118 const OUString& rExceptionMessage,
119 sal_Int32 nRow,
120 sal_Int32 nColumn,
121 const OUString& rPublicId,
122 const OUString& rSystemId );
123
125 sal_Int32 nId,
126 const css::uno::Sequence<OUString> & rParams,
127 const OUString& rExceptionMessage,
128 const css::uno::Reference<css::xml::sax::XLocator> & rLocator);
129
135 void ThrowErrorAsSAXException( sal_Int32 nIdMask );
136};
137
138#endif
139
140/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ErrorRecord: contains all information for one error.
Definition: xmlerror.cxx:43
The XMLErrors is used to collect all errors and warnings that occur for appropriate processing.
Definition: xmlerror.hxx:103
XMLErrors()
list of error records
Definition: xmlerror.cxx:82
void ThrowErrorAsSAXException(sal_Int32 nIdMask)
location
Definition: xmlerror.cxx:186
void AddRecord(sal_Int32 nId, const css::uno::Sequence< OUString > &rParams, const OUString &rExceptionMessage, const css::uno::Reference< css::xml::sax::XLocator > &rLocator)
XLocator: file system ID.
ErrorList m_aErrors
Definition: xmlerror.hxx:107
~XMLErrors()
Definition: xmlerror.cxx:86
::std::vector< ErrorRecord > ErrorList
definition of type for error list
Definition: xmlerror.hxx:105
void AddRecord(sal_Int32 nId, const css::uno::Sequence< OUString > &rParams, const OUString &rExceptionMessage, sal_Int32 nRow, sal_Int32 nColumn, const OUString &rPublicId, const OUString &rSystemId)
add a new entry to the list of error messages
Reference
SvXMLErrorFlags
Definition: xmlerror.hxx:78