xref: /trunk/main/dbaccess/source/core/recovery/storagexmlstream.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * Copyright 2009 by Sun Microsystems, Inc.
5 *
6 * OpenOffice.org - a multi-platform office productivity suite
7 *
8 * This file is part of OpenOffice.org.
9 *
10 * OpenOffice.org is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License version 3
12 * only, as published by the Free Software Foundation.
13 *
14 * OpenOffice.org is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU Lesser General Public License version 3 for more details
18 * (a copy is included in the LICENSE file that accompanied this code).
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * version 3 along with OpenOffice.org.  If not, see
22 * <http://www.openoffice.org/license.html>
23 * for a copy of the LGPLv3 License.
24 ************************************************************************/
25 
26 #ifndef STORAGEXMLSTREAM_HXX
27 #define STORAGEXMLSTREAM_HXX
28 
29 #include "storagestream.hxx"
30 
31 /** === begin UNO includes === **/
32 #include <com/sun/star/embed/XStorage.hpp>
33 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
34 /** === end UNO includes === **/
35 
36 #include <memory>
37 
38 namespace comphelper
39 {
40     class ComponentContext;
41 }
42 
43 //........................................................................
44 namespace dbaccess
45 {
46 //........................................................................
47 
48     //====================================================================
49     //= StorageXMLOutputStream
50     //====================================================================
51     struct StorageXMLOutputStream_Data;
52     class DBACCESS_DLLPRIVATE StorageXMLOutputStream : public StorageOutputStream
53     {
54     public:
55         StorageXMLOutputStream(
56             const ::comphelper::ComponentContext& i_rContext,
57             const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rParentStorage,
58             const ::rtl::OUString& i_rStreamName
59         );
60         ~StorageXMLOutputStream();
61 
62         // StorageOutputStream overridables
63         virtual void close();
64 
65         void    addAttribute( const ::rtl::OUString& i_rName, const ::rtl::OUString& i_rValue ) const;
66 
67         void    startElement( const ::rtl::OUString& i_rElementName ) const;
68         void    endElement() const;
69 
70         void    ignorableWhitespace( const ::rtl::OUString& i_rWhitespace ) const;
71         void    characters( const ::rtl::OUString& i_rCharacters ) const;
72 
73     private:
74         StorageXMLOutputStream();                                           // never implemented
75         StorageXMLOutputStream( const StorageXMLOutputStream& );            // never implemented
76         StorageXMLOutputStream& operator=( const StorageXMLOutputStream& ); // never implemented
77 
78     private:
79         ::std::auto_ptr< StorageXMLOutputStream_Data >   m_pData;
80     };
81 
82     //====================================================================
83     //= StorageXMLInputStream
84     //====================================================================
85     struct StorageXMLInputStream_Data;
86     class DBACCESS_DLLPRIVATE StorageXMLInputStream : public StorageInputStream
87     {
88     public:
89         StorageXMLInputStream(
90             const ::comphelper::ComponentContext& i_rContext,
91             const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rParentStorage,
92             const ::rtl::OUString& i_rStreamName
93         );
94         ~StorageXMLInputStream();
95 
96         void    import(
97                     const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& i_rHandler
98                 );
99 
100     private:
101         StorageXMLInputStream();                                            // never implemented
102         StorageXMLInputStream( const StorageXMLInputStream& );              // never implemented
103         StorageXMLInputStream& operator=( const StorageXMLInputStream& );   // never implemented
104 
105     private:
106         ::std::auto_ptr< StorageXMLInputStream_Data >   m_pData;
107     };
108 
109 //........................................................................
110 } // namespace dbaccess
111 //........................................................................
112 
113 #endif // STORAGEXMLSTREAM_HXX
114