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/implbase.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 >& rContext,
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 >& rContext,
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 1 : 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 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 7416 : class XMLVersionListPersistence : public ::cppu::WeakImplHelper< ::com::sun::star::document::XDocumentRevisionListPersistence, css::lang::XServiceInfo >
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 : OUString SAL_CALL getImplementationName()
127 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 :
129 : sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
130 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 :
132 : css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
133 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 : };
135 :
136 : #endif
137 :
138 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|