1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlerror.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _XMLOFF_XMLERROR_HXX
32 #define _XMLOFF_XMLERROR_HXX
34 #include <com/sun/star/xml/sax/SAXParseException.hpp>
35 #include <sal/types.h>
42 // masks for the error ID fields
43 #define XMLERROR_MASK_FLAG 0xF0000000
44 #define XMLERROR_MASK_CLASS 0x00FF0000
45 #define XMLERROR_MASK_NUMBER 0x0000FFFF
48 #define XMLERROR_FLAG_WARNING 0x10000000
49 #define XMLERROR_FLAG_ERROR 0x20000000
50 #define XMLERROR_FLAG_SEVERE 0x40000000
52 // error classes: Error ID
53 #define XMLERROR_CLASS_IO 0x00010000
54 #define XMLERROR_CLASS_FORMAT 0x00020000
55 #define XMLERROR_CLASS_API 0x00040000
56 #define XMLERROR_CLASS_OTHER 0x00080000
59 // error numbers, listed by error class
60 // Within each class, errors should be numbered consecutively. Please
61 // allways add to error code below the appropriate comment.
66 #define XMLERROR_SAX ( XMLERROR_CLASS_FORMAT | 0x00000001 )
67 #define XMLERROR_STYLE_ATTR_VALUE ( XMLERROR_CLASS_FORMAT | 0x00000002 )
68 #define XMLERROR_NO_INDEX_ALLOWED_HERE ( XMLERROR_CLASS_FORMAT | 0x00000003 )
69 #define XMLERROR_PARENT_STYLE_NOT_ALLOWED ( XMLERROR_CLASS_FORMAT | 0x00000004 )
70 #define XMLERROR_ILLEGAL_EVENT (XMLERROR_CLASS_FORMAT | 0x00000005 )
71 #define XMLERROR_NAMESPACE_TROUBLE (XMLERROR_CLASS_FORMAT | 0x00000006 )
73 #define XMLERROR_XFORMS_NO_SCHEMA_SUPPORT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000007 )
74 #define XMLERROR_XFORMS_UNKNOWN ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000008 )
75 #define XMLERROR_XFORMS_ONLY_ONE_INSTANCE_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000009 )
76 #define XMLERROR_UNKNOWN_ATTRIBUTE ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000a )
77 #define XMLERROR_UNKNOWN_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000b )
78 #define XMLERROR_UNKNOWN_CHARACTERS ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000c )
79 #define XMLERROR_UNKNWON_ROOT (XMLERROR_CLASS_FORMAT | 0x0000000d )
82 #define XMLERROR_STYLE_PROP_VALUE ( XMLERROR_CLASS_API | 0x00000001 )
83 #define XMLERROR_STYLE_PROP_UNKNOWN ( XMLERROR_CLASS_API | 0x00000002 )
84 #define XMLERROR_STYLE_PROP_OTHER ( XMLERROR_CLASS_API | 0x00000003 )
85 #define XMLERROR_API ( XMLERROR_CLASS_API | 0x00000004 )
88 #define XMLERROR_CANCEL ( XMLERROR_CLASS_OTHER | 0x00000001 )
92 // 16bit error flag constants for use in the
93 // SvXMLExport/SvXMLImport error flags
94 #define ERROR_NO 0x0000
95 #define ERROR_DO_NOTHING 0x0001
96 #define ERROR_ERROR_OCCURED 0x0002
97 #define ERROR_WARNING_OCCURED 0x0004
102 // forward declarations
103 namespace rtl
{ class OUString
; }
104 namespace com
{ namespace sun
{ namespace star
{
105 namespace uno
{ template<class X
> class Sequence
; }
106 namespace uno
{ template<class X
> class Reference
; }
107 namespace xml
{ namespace sax
{ class XLocator
; } }
114 * The XMLErrors is used to collect all errors and warnings that occur
115 * for appropriate processing.
119 /// definition of type for error list
120 typedef ::std::vector
<ErrorRecord
> ErrorList
;
122 ErrorList aErrors
; /// list of error records
129 /// add a new entry to the list of error messages
131 sal_Int32 nId
, /// error ID == error flags + error class + error number
132 const ::com::sun::star::uno::Sequence
<
133 ::rtl::OUString
> & rParams
, /// parameters for error message
134 const ::rtl::OUString
& rExceptionMessage
, /// original exception string
135 sal_Int32 nRow
, /// XLocator: file row number
136 sal_Int32 nColumn
, /// XLocator: file column number
137 const ::rtl::OUString
& rPublicId
, /// XLocator: file public ID
138 const ::rtl::OUString
& rSystemId
); /// XLocator: file system ID
141 sal_Int32 nId
, /// error ID == error flags + error class + error number
142 const ::com::sun::star::uno::Sequence
<
143 ::rtl::OUString
> & rParams
, /// parameters for error message
144 const ::rtl::OUString
& rExceptionMessage
, /// original exception string
145 const ::com::sun::star::uno::Reference
<
146 ::com::sun::star::xml::sax::XLocator
> & rLocator
); /// location
149 sal_Int32 nId
, /// error ID == error flags + error class + error number
150 const ::com::sun::star::uno::Sequence
<
151 ::rtl::OUString
> & rParams
, /// parameters for error message
152 const ::rtl::OUString
& rExceptionMessage
); /// original exception string
155 sal_Int32 nId
, /// error ID == error flags + error class + error number
156 const ::com::sun::star::uno::Sequence
<
157 ::rtl::OUString
> & rParams
); /// parameters for error message
161 * throw a SAXParseException that describes the first error that matches
164 void ThrowErrorAsSAXException( sal_Int32 nIdMask
)
165 throw( ::com::sun::star::xml::sax::SAXParseException
);