1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_XMLOFF_INC_XMLVERSION_HXX
20 #define INCLUDED_XMLOFF_INC_XMLVERSION_HXX
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>
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>
35 class XMLVersionListExport
: public SvXMLExport
38 const com::sun::star::uno::Sequence
< com::sun::star::util::RevisionTag
>& maVersions
;
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 virtual ~XMLVersionListExport() {}
47 sal_uInt32
exportDoc( enum ::xmloff::token::XMLTokenEnum eClass
) SAL_OVERRIDE
;
48 void _ExportAutoStyles() SAL_OVERRIDE
{}
49 void _ExportMasterStyles () SAL_OVERRIDE
{}
50 void _ExportContent() SAL_OVERRIDE
{}
53 class XMLVersionListImport
: public SvXMLImport
56 com::sun::star::uno::Sequence
< com::sun::star::util::RevisionTag
>& maVersions
;
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
;
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();
74 com::sun::star::uno::Sequence
< com::sun::star::util::RevisionTag
>&
75 GetList() { return maVersions
; }
78 class XMLVersionListContext
: public SvXMLImportContext
81 XMLVersionListImport
& rLocalRef
;
85 XMLVersionListContext( XMLVersionListImport
& rImport
,
87 const OUString
& rLocalName
,
88 const ::com::sun::star::uno::Reference
<
89 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
91 virtual ~XMLVersionListContext();
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
;
100 class XMLVersionContext
: public SvXMLImportContext
103 XMLVersionListImport
& rLocalRef
;
105 static bool ParseISODateTimeString(
106 const OUString
& rString
,
107 com::sun::star::util::DateTime
& rDateTime
);
111 XMLVersionContext( XMLVersionListImport
& rImport
,
113 const OUString
& rLocalName
,
114 const ::com::sun::star::uno::Reference
<
115 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
117 virtual ~XMLVersionContext();
120 class XMLVersionListPersistence
: public ::cppu::WeakImplHelper
< ::com::sun::star::document::XDocumentRevisionListPersistence
, css::lang::XServiceInfo
>
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
;
126 OUString SAL_CALL
getImplementationName()
127 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 sal_Bool SAL_CALL
supportsService(OUString
const & ServiceName
)
130 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
132 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames()
133 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */