xref: /aoo4110/main/xmloff/inc/xmlversion.hxx (revision b1cdbd2c)
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 #ifndef _XMLOFF_XMLVERSION_HXX
24 #define _XMLOFF_XMLVERSION_HXX
25 
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <com/sun/star/document/XDocumentRevisionListPersistence.hpp>
28 #include <com/sun/star/util/RevisionTag.hpp>
29 #include <com/sun/star/embed/XStorage.hpp>
30 
31 #include <cppuhelper/implbase1.hxx>
32 #include <xmloff/xmlictxt.hxx>
33 #include <xmloff/xmlexp.hxx>
34 #include <xmloff/xmlimp.hxx>
35 #include <xmloff/nmspmap.hxx>
36 #include <xmloff/xmlnmspe.hxx>
37 #include <xmloff/xmltoken.hxx>
38 
39 // ------------------------------------------------------------------------
40 class XMLVersionListExport : public SvXMLExport
41 {
42 private:
43     const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& maVersions;
44 public:
45     XMLVersionListExport(
46 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
47         const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions,
48 		const rtl::OUString &rFileName,
49 		com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > &rHandler );
~XMLVersionListExport()50     virtual     ~XMLVersionListExport() {}
51 
52 	sal_uInt32	exportDoc( enum ::xmloff::token::XMLTokenEnum eClass );
_ExportAutoStyles()53 	void		_ExportAutoStyles() {}
_ExportMasterStyles()54 	void		_ExportMasterStyles () {}
_ExportContent()55 	void		_ExportContent() {}
56 };
57 
58 // ------------------------------------------------------------------------
59 class XMLVersionListImport : public SvXMLImport
60 {
61 private:
62     com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& maVersions;
63 
64 protected:
65 
66 	// This method is called after the namespace map has been updated, but
67 	// before a context for the current element has been pushed.
68 	virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
69 					const ::rtl::OUString& rLocalName,
70 					const ::com::sun::star::uno::Reference<
71 					::com::sun::star::xml::sax::XAttributeList > & xAttrList );
72 
73 public:
74 
75 	// #110897#
76     XMLVersionListImport(
77 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
78         com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions );
79     ~XMLVersionListImport() throw();
80 
81     com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >&
GetList()82         GetList() { return maVersions; }
83 };
84 
85 // ------------------------------------------------------------------------
86 class XMLVersionListContext : public SvXMLImportContext
87 {
88 private:
89     XMLVersionListImport & rLocalRef;
90 
91 public:
92 
93     XMLVersionListContext( XMLVersionListImport& rImport,
94 						   sal_uInt16 nPrefix,
95 						   const rtl::OUString& rLocalName,
96 						   const ::com::sun::star::uno::Reference<
97 						   ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
98 
99     ~XMLVersionListContext();
100 
101 	virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
102 						   const rtl::OUString& rLocalName,
103 						   const ::com::sun::star::uno::Reference<
104 						   ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
105 
106 };
107 
108 // ------------------------------------------------------------------------
109 class XMLVersionContext: public SvXMLImportContext
110 {
111 private:
112     XMLVersionListImport&  rLocalRef;
113 
114 	static sal_Bool			ParseISODateTimeString(
115 								const rtl::OUString& rString,
116                                 com::sun::star::util::DateTime& rDateTime );
117 
118 public:
119 
120     XMLVersionContext( XMLVersionListImport& rImport,
121 						  sal_uInt16 nPrefix,
122 						  const rtl::OUString& rLocalName,
123 						  const ::com::sun::star::uno::Reference<
124 						  ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
125 
126     ~XMLVersionContext();
127 };
128 
129 
130 // ------------------------------------------------------------------------
131 class XMLVersionListPersistence : public ::cppu::WeakImplHelper1< ::com::sun::star::document::XDocumentRevisionListPersistence >
132 {
133 public:
134     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::util::RevisionTag > SAL_CALL load( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
135     virtual void SAL_CALL store( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage, const ::com::sun::star::uno::Sequence< ::com::sun::star::util::RevisionTag >& List ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
136 };
137 
138 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
139     XMLVersionListPersistence_getSupportedServiceNames()
140 	throw();
141 
142 ::rtl::OUString SAL_CALL XMLVersionPersistence_getImplementationName()
143 	throw();
144 
145 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
146     XMLVersionListPersistence_createInstance(
147 		const ::com::sun::star::uno::Reference<
148 			::com::sun::star::lang::XMultiServiceFactory > & )
149 	throw( ::com::sun::star::uno::Exception );
150 
151 #endif
152