Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_XMLOFF_INC_XMLVERSION_HXX
20 : #define INCLUDED_XMLOFF_INC_XMLVERSION_HXX
21 :
22 : #include <com/sun/star/uno/Sequence.hxx>
23 : #include <com/sun/star/document/XDocumentRevisionListPersistence.hpp>
24 : #include <com/sun/star/util/RevisionTag.hpp>
25 : #include <com/sun/star/embed/XStorage.hpp>
26 :
27 : #include <cppuhelper/implbase1.hxx>
28 : #include <xmloff/xmlictxt.hxx>
29 : #include <xmloff/xmlexp.hxx>
30 : #include <xmloff/xmlimp.hxx>
31 : #include <xmloff/nmspmap.hxx>
32 : #include <xmloff/xmlnmspe.hxx>
33 : #include <xmloff/xmltoken.hxx>
34 :
35 : class XMLVersionListExport : public SvXMLExport
36 : {
37 : private:
38 : const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& maVersions;
39 : public:
40 : XMLVersionListExport(
41 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
42 : const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions,
43 : const OUString &rFileName,
44 : com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > &rHandler );
45 0 : virtual ~XMLVersionListExport() {}
46 :
47 : sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) SAL_OVERRIDE;
48 0 : void _ExportAutoStyles() SAL_OVERRIDE {}
49 0 : void _ExportMasterStyles () SAL_OVERRIDE {}
50 0 : void _ExportContent() SAL_OVERRIDE {}
51 : };
52 :
53 : class XMLVersionListImport : public SvXMLImport
54 : {
55 : private:
56 : com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& maVersions;
57 :
58 : protected:
59 :
60 : // This method is called after the namespace map has been updated, but
61 : // before a context for the current element has been pushed.
62 : virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
63 : const OUString& rLocalName,
64 : const ::com::sun::star::uno::Reference<
65 : ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
66 :
67 : public:
68 :
69 : XMLVersionListImport(
70 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
71 : com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions );
72 : virtual ~XMLVersionListImport() throw();
73 :
74 : com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >&
75 0 : GetList() { return maVersions; }
76 : };
77 :
78 : class XMLVersionListContext : public SvXMLImportContext
79 : {
80 : private:
81 : XMLVersionListImport & rLocalRef;
82 :
83 : public:
84 :
85 : XMLVersionListContext( XMLVersionListImport& rImport,
86 : sal_uInt16 nPrefix,
87 : const OUString& rLocalName,
88 : const ::com::sun::star::uno::Reference<
89 : ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
90 :
91 : virtual ~XMLVersionListContext();
92 :
93 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
94 : const OUString& rLocalName,
95 : const ::com::sun::star::uno::Reference<
96 : ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
97 :
98 : };
99 :
100 : class XMLVersionContext: public SvXMLImportContext
101 : {
102 : private:
103 : XMLVersionListImport& rLocalRef;
104 :
105 : static sal_Bool ParseISODateTimeString(
106 : const OUString& rString,
107 : com::sun::star::util::DateTime& rDateTime );
108 :
109 : public:
110 :
111 : XMLVersionContext( XMLVersionListImport& rImport,
112 : sal_uInt16 nPrefix,
113 : const OUString& rLocalName,
114 : const ::com::sun::star::uno::Reference<
115 : ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
116 :
117 : virtual ~XMLVersionContext();
118 : };
119 :
120 0 : class XMLVersionListPersistence : public ::cppu::WeakImplHelper1< ::com::sun::star::document::XDocumentRevisionListPersistence >
121 : {
122 : public:
123 : 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, std::exception) SAL_OVERRIDE;
124 : 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, std::exception) SAL_OVERRIDE;
125 : };
126 :
127 : #endif
128 :
129 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|