merge the formfield patch from ooo-build
[ooovba.git] / desktop / source / deployment / inc / dp_xml.h
blobb410a8d1973da95f0c62e8463066af657d359e84
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dp_xml.h,v $
10 * $Revision: 1.8 $
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 #if ! defined INCLUDED_DP_XML_H
32 #define INCLUDED_DP_XML_H
34 #include "rtl/ref.hxx"
35 #include "rtl/ustrbuf.hxx"
36 #include "cppuhelper/implbase1.hxx"
37 #include "com/sun/star/uno/XComponentContext.hpp"
38 #include "com/sun/star/xml/input/XRoot.hpp"
39 #include "com/sun/star/xml/sax/XDocumentHandler.hpp"
42 namespace ucbhelper
44 class Content;
47 namespace css = ::com::sun::star;
49 namespace dp_misc
52 //==============================================================================
53 void xml_parse(
54 css::uno::Reference< css::xml::sax::XDocumentHandler > const & xDocHandler,
55 ::ucbhelper::Content & ucb_content,
56 css::uno::Reference< css::uno::XComponentContext > const & xContext );
58 //==============================================================================
59 void xml_parse(
60 css::uno::Reference< css::xml::input::XRoot > const & xRoot,
61 ::ucbhelper::Content & ucb_content,
62 css::uno::Reference< css::uno::XComponentContext > const & xContext );
64 //==============================================================================
65 class XmlElement : public ::cppu::WeakImplHelper1< css::xml::input::XElement >
67 protected:
68 css::uno::Reference<css::xml::input::XNamespaceMapping> m_xNamespaceMapping;
69 const css::uno::Reference<css::xml::input::XElement> m_xParent;
70 sal_Int32 m_uid;
71 ::rtl::OUString m_localname;
72 css::uno::Reference<css::xml::input::XAttributes> m_xAttributes;
73 ::rtl::OUString m_characters;
74 bool m_got_endElement;
76 void check_xmlns( sal_Int32 uid ) const throw (css::xml::sax::SAXException);
78 inline XmlElement()
79 : m_uid( -1 ),
80 m_got_endElement( false )
82 virtual ~XmlElement();
83 public:
84 inline bool isParsed() const { return m_got_endElement; }
86 inline XmlElement(
87 css::uno::Reference<css::xml::input::XNamespaceMapping>
88 const & xMapping,
89 css::uno::Reference<css::xml::input::XElement> const & xParent,
90 sal_Int32 uid, ::rtl::OUString const & localname,
91 css::uno::Reference< css::xml::input::XAttributes >
92 const & xAttributes )
93 : m_xNamespaceMapping( xMapping ),
94 m_xParent( xParent ),
95 m_uid( uid ),
96 m_localname( localname ),
97 m_xAttributes( xAttributes ),
98 m_got_endElement( false )
101 // XElement
102 virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL
103 getParent() throw (css::uno::RuntimeException);
104 virtual ::rtl::OUString SAL_CALL getLocalName()
105 throw (css::uno::RuntimeException);
106 virtual sal_Int32 SAL_CALL getUid()
107 throw (css::uno::RuntimeException);
108 virtual css::uno::Reference<css::xml::input::XAttributes> SAL_CALL
109 getAttributes() throw (css::uno::RuntimeException);
110 virtual void SAL_CALL ignorableWhitespace(
111 ::rtl::OUString const & rWhitespaces )
112 throw (css::xml::sax::SAXException, css::uno::RuntimeException);
113 virtual void SAL_CALL characters( ::rtl::OUString const & rChars )
114 throw (css::xml::sax::SAXException, css::uno::RuntimeException);
115 virtual void SAL_CALL processingInstruction(
116 ::rtl::OUString const & Target, ::rtl::OUString const & Data )
117 throw (css::xml::sax::SAXException, css::uno::RuntimeException);
118 virtual void SAL_CALL endElement()
119 throw (css::xml::sax::SAXException, css::uno::RuntimeException);
120 virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL
121 startChildElement(
122 sal_Int32 nUid, ::rtl::OUString const & rLocalName,
123 css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
124 throw (css::xml::sax::SAXException, css::uno::RuntimeException);
127 //==============================================================================
128 class XmlRootElement : public ::cppu::ImplInheritanceHelper1<
129 XmlElement, css::xml::input::XRoot >
131 const ::rtl::OUString m_uri;
133 protected:
134 virtual ~XmlRootElement();
135 public:
136 inline ::rtl::OUString const & getUri() const
137 { return m_uri; }
139 XmlRootElement(
140 ::rtl::OUString const & uri, ::rtl::OUString const & localname );
142 // XRoot
143 virtual void SAL_CALL startDocument(
144 css::uno::Reference<css::xml::input::XNamespaceMapping>
145 const & xMapping )
146 throw (css::xml::sax::SAXException, css::uno::RuntimeException);
147 virtual void SAL_CALL endDocument()
148 throw (css::xml::sax::SAXException, css::uno::RuntimeException);
149 virtual void SAL_CALL processingInstruction(
150 ::rtl::OUString const & target, ::rtl::OUString const & data )
151 throw (css::xml::sax::SAXException, css::uno::RuntimeException);
152 virtual void SAL_CALL setDocumentLocator(
153 css::uno::Reference<css::xml::sax::XLocator> const & xLocator )
154 throw (css::xml::sax::SAXException, css::uno::RuntimeException);
155 virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL
156 startRootElement(
157 sal_Int32 uid, ::rtl::OUString const & localname,
158 css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
159 throw (css::xml::sax::SAXException, css::uno::RuntimeException);
164 #endif