bump product version to 4.1.6.2
[LibreOffice.git] / include / xmloff / xmlerror.hxx
blob78ecbe914850ffd7bdf07e4c51ad1c58b9738a8a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #ifndef _XMLOFF_XMLERROR_HXX
21 #define _XMLOFF_XMLERROR_HXX
23 #include <com/sun/star/xml/sax/SAXParseException.hpp>
24 #include <sal/types.h>
26 // STL includes
27 #include <vector>
31 // masks for the error ID fields
32 #define XMLERROR_MASK_FLAG 0xF0000000
33 #define XMLERROR_MASK_CLASS 0x00FF0000
34 #define XMLERROR_MASK_NUMBER 0x0000FFFF
36 // error flags:
37 #define XMLERROR_FLAG_WARNING 0x10000000
38 #define XMLERROR_FLAG_ERROR 0x20000000
39 #define XMLERROR_FLAG_SEVERE 0x40000000
41 // error classes: Error ID
42 #define XMLERROR_CLASS_IO 0x00010000
43 #define XMLERROR_CLASS_FORMAT 0x00020000
44 #define XMLERROR_CLASS_API 0x00040000
45 #define XMLERROR_CLASS_OTHER 0x00080000
48 // error numbers, listed by error class
49 // Within each class, errors should be numbered consecutively. Please
50 // always add to error code below the appropriate comment.
52 // I/O errors:
54 // format errors:
55 #define XMLERROR_SAX ( XMLERROR_CLASS_FORMAT | 0x00000001 )
56 #define XMLERROR_STYLE_ATTR_VALUE ( XMLERROR_CLASS_FORMAT | 0x00000002 )
57 #define XMLERROR_NO_INDEX_ALLOWED_HERE ( XMLERROR_CLASS_FORMAT | 0x00000003 )
58 #define XMLERROR_PARENT_STYLE_NOT_ALLOWED ( XMLERROR_CLASS_FORMAT | 0x00000004 )
59 #define XMLERROR_ILLEGAL_EVENT (XMLERROR_CLASS_FORMAT | 0x00000005 )
60 #define XMLERROR_NAMESPACE_TROUBLE (XMLERROR_CLASS_FORMAT | 0x00000006 )
62 #define XMLERROR_XFORMS_NO_SCHEMA_SUPPORT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000007 )
63 #define XMLERROR_XFORMS_UNKNOWN ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000008 )
64 #define XMLERROR_XFORMS_ONLY_ONE_INSTANCE_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000009 )
65 #define XMLERROR_UNKNOWN_ATTRIBUTE ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000a )
66 #define XMLERROR_UNKNOWN_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000b )
67 #define XMLERROR_UNKNOWN_CHARACTERS ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000c )
68 #define XMLERROR_UNKNOWN_ROOT (XMLERROR_CLASS_FORMAT | 0x0000000d )
70 // API errors:
71 #define XMLERROR_STYLE_PROP_VALUE ( XMLERROR_CLASS_API | 0x00000001 )
72 #define XMLERROR_STYLE_PROP_UNKNOWN ( XMLERROR_CLASS_API | 0x00000002 )
73 #define XMLERROR_STYLE_PROP_OTHER ( XMLERROR_CLASS_API | 0x00000003 )
74 #define XMLERROR_API ( XMLERROR_CLASS_API | 0x00000004 )
76 // other errors:
77 #define XMLERROR_CANCEL ( XMLERROR_CLASS_OTHER | 0x00000001 )
81 // 16bit error flag constants for use in the
82 // SvXMLExport/SvXMLImport error flags
83 #define ERROR_NO 0x0000
84 #define ERROR_DO_NOTHING 0x0001
85 #define ERROR_ERROR_OCCURRED 0x0002
86 #define ERROR_WARNING_OCCURRED 0x0004
91 // forward declarations
92 namespace com { namespace sun { namespace star {
93 namespace uno { template<class X> class Sequence; }
94 namespace uno { template<class X> class Reference; }
95 namespace xml { namespace sax { class XLocator; } }
96 } } }
97 class ErrorRecord;
102 * The XMLErrors is used to collect all errors and warnings that occur
103 * for appropriate processing.
105 class XMLErrors
107 /// definition of type for error list
108 typedef ::std::vector<ErrorRecord> ErrorList;
110 ErrorList aErrors; /// list of error records
112 public:
114 XMLErrors();
115 ~XMLErrors();
117 /// add a new entry to the list of error messages
118 void AddRecord(
119 sal_Int32 nId, /// error ID == error flags + error class + error number
120 const ::com::sun::star::uno::Sequence<
121 OUString> & rParams, /// parameters for error message
122 const OUString& rExceptionMessage, /// original exception string
123 sal_Int32 nRow, /// XLocator: file row number
124 sal_Int32 nColumn, /// XLocator: file column number
125 const OUString& rPublicId, /// XLocator: file public ID
126 const OUString& rSystemId ); /// XLocator: file system ID
128 void AddRecord(
129 sal_Int32 nId, /// error ID == error flags + error class + error number
130 const ::com::sun::star::uno::Sequence<
131 OUString> & rParams, /// parameters for error message
132 const OUString& rExceptionMessage, /// original exception string
133 const ::com::sun::star::uno::Reference<
134 ::com::sun::star::xml::sax::XLocator> & rLocator); /// location
137 * throw a SAXParseException that describes the first error that matches
138 * the given mask
140 void ThrowErrorAsSAXException( sal_Int32 nIdMask )
141 throw( ::com::sun::star::xml::sax::SAXParseException );
145 #endif
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */