1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef STORAGEXMLSTREAM_HXX
25 #define STORAGEXMLSTREAM_HXX
26 
27 #include "storagestream.hxx"
28 
29 /** === begin UNO includes === **/
30 #include <com/sun/star/embed/XStorage.hpp>
31 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
32 /** === end UNO includes === **/
33 
34 #include <memory>
35 
36 namespace comphelper
37 {
38     class ComponentContext;
39 }
40 
41 //........................................................................
42 namespace dbaccess
43 {
44 //........................................................................
45 
46 	//====================================================================
47 	//= StorageXMLOutputStream
48 	//====================================================================
49     struct StorageXMLOutputStream_Data;
50     class DBACCESS_DLLPRIVATE StorageXMLOutputStream : public StorageOutputStream
51 	{
52     public:
53         StorageXMLOutputStream(
54             const ::comphelper::ComponentContext& i_rContext,
55             const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rParentStorage,
56             const ::rtl::OUString& i_rStreamName
57         );
58         ~StorageXMLOutputStream();
59 
60         // StorageOutputStream overridables
61         virtual void close();
62 
63         void    addAttribute( const ::rtl::OUString& i_rName, const ::rtl::OUString& i_rValue ) const;
64 
65         void    startElement( const ::rtl::OUString& i_rElementName ) const;
66         void    endElement() const;
67 
68         void    ignorableWhitespace( const ::rtl::OUString& i_rWhitespace ) const;
69         void    characters( const ::rtl::OUString& i_rCharacters ) const;
70 
71     private:
72         StorageXMLOutputStream();                                           // never implemented
73         StorageXMLOutputStream( const StorageXMLOutputStream& );            // never implemented
74         StorageXMLOutputStream& operator=( const StorageXMLOutputStream& ); // never implemented
75 
76     private:
77         ::std::auto_ptr< StorageXMLOutputStream_Data >   m_pData;
78 	};
79 
80 	//====================================================================
81 	//= StorageXMLInputStream
82 	//====================================================================
83     struct StorageXMLInputStream_Data;
84     class DBACCESS_DLLPRIVATE StorageXMLInputStream : public StorageInputStream
85 	{
86     public:
87         StorageXMLInputStream(
88             const ::comphelper::ComponentContext& i_rContext,
89             const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rParentStorage,
90             const ::rtl::OUString& i_rStreamName
91         );
92         ~StorageXMLInputStream();
93 
94         void    import(
95                     const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& i_rHandler
96                 );
97 
98     private:
99         StorageXMLInputStream();                                            // never implemented
100         StorageXMLInputStream( const StorageXMLInputStream& );              // never implemented
101         StorageXMLInputStream& operator=( const StorageXMLInputStream& );   // never implemented
102 
103     private:
104         ::std::auto_ptr< StorageXMLInputStream_Data >   m_pData;
105 	};
106 
107 //........................................................................
108 } // namespace dbaccess
109 //........................................................................
110 
111 #endif // STORAGEXMLSTREAM_HXX
112