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 css::uno::Sequence
< css::util::RevisionTag
>& maVersions
;
41 const css::uno::Reference
< css::uno::XComponentContext
>& rContext
,
42 const css::uno::Sequence
< css::util::RevisionTag
>& rVersions
,
43 const OUString
&rFileName
,
44 css::uno::Reference
< css::xml::sax::XDocumentHandler
> &rHandler
);
45 virtual ~XMLVersionListExport() override
{}
47 sal_uInt32
exportDoc( enum ::xmloff::token::XMLTokenEnum eClass
= ::xmloff::token::XML_TOKEN_INVALID
) override
;
48 void ExportAutoStyles_() override
{}
49 void ExportMasterStyles_ () override
{}
50 void ExportContent_() override
{}
53 class XMLVersionListImport
: public SvXMLImport
56 css::uno::Sequence
< css::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 css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
) override
;
69 const css::uno::Reference
< css::uno::XComponentContext
>& rContext
,
70 css::uno::Sequence
< css::util::RevisionTag
>& rVersions
);
71 virtual ~XMLVersionListImport() throw() override
;
73 css::uno::Sequence
< css::util::RevisionTag
>&
74 GetList() { return maVersions
; }
77 class XMLVersionListContext
: public SvXMLImportContext
80 XMLVersionListImport
& rLocalRef
;
84 XMLVersionListContext( XMLVersionListImport
& rImport
,
86 const OUString
& rLocalName
,
87 const css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
);
89 virtual ~XMLVersionListContext() override
;
91 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
92 const OUString
& rLocalName
,
93 const css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
) override
;
97 class XMLVersionContext
: public SvXMLImportContext
100 XMLVersionListImport
& rLocalRef
;
102 static bool ParseISODateTimeString(
103 const OUString
& rString
,
104 css::util::DateTime
& rDateTime
);
108 XMLVersionContext( XMLVersionListImport
& rImport
,
110 const OUString
& rLocalName
,
111 const css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
);
113 virtual ~XMLVersionContext() override
;
116 class XMLVersionListPersistence
: public ::cppu::WeakImplHelper
< css::document::XDocumentRevisionListPersistence
, css::lang::XServiceInfo
>
119 virtual css::uno::Sequence
< css::util::RevisionTag
> SAL_CALL
load( const css::uno::Reference
< css::embed::XStorage
>& Storage
) throw (css::container::NoSuchElementException
, css::io::IOException
, css::uno::Exception
, css::uno::RuntimeException
, std::exception
) override
;
120 virtual void SAL_CALL
store( const css::uno::Reference
< css::embed::XStorage
>& Storage
, const css::uno::Sequence
< css::util::RevisionTag
>& List
) throw (css::io::IOException
, css::uno::Exception
, css::uno::RuntimeException
, std::exception
) override
;
122 OUString SAL_CALL
getImplementationName()
123 throw (css::uno::RuntimeException
, std::exception
) override
;
125 sal_Bool SAL_CALL
supportsService(OUString
const & ServiceName
)
126 throw (css::uno::RuntimeException
, std::exception
) override
;
128 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames()
129 throw (css::uno::RuntimeException
, std::exception
) override
;
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */