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 .
21 #include <com/sun/star/uno/Sequence.hxx>
22 #include <com/sun/star/document/XDocumentRevisionListPersistence.hpp>
23 #include <com/sun/star/util/RevisionTag.hpp>
24 #include <com/sun/star/embed/XStorage.hpp>
26 #include <cppuhelper/implbase.hxx>
27 #include <xmloff/xmlictxt.hxx>
28 #include <xmloff/xmlexp.hxx>
29 #include <xmloff/xmlimp.hxx>
30 #include <xmloff/xmltoken.hxx>
32 class XMLVersionListExport final
: public SvXMLExport
35 const css::uno::Sequence
< css::util::RevisionTag
>& maVersions
;
38 const css::uno::Reference
< css::uno::XComponentContext
>& rContext
,
39 const css::uno::Sequence
< css::util::RevisionTag
>& rVersions
,
40 const OUString
&rFileName
,
41 css::uno::Reference
< css::xml::sax::XDocumentHandler
> const &rHandler
);
43 ErrCode
exportDoc( enum ::xmloff::token::XMLTokenEnum eClass
= ::xmloff::token::XML_TOKEN_INVALID
) override
;
44 void ExportAutoStyles_() override
{}
45 void ExportMasterStyles_ () override
{}
46 void ExportContent_() override
{}
49 class XMLVersionListImport final
: public SvXMLImport
52 css::uno::Sequence
< css::util::RevisionTag
>& maVersions
;
54 virtual SvXMLImportContext
*CreateFastContext( sal_Int32 Element
,
55 const ::css::uno::Reference
< ::css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
60 const css::uno::Reference
< css::uno::XComponentContext
>& rContext
,
61 css::uno::Sequence
< css::util::RevisionTag
>& rVersions
);
62 virtual ~XMLVersionListImport() noexcept override
;
64 css::uno::Sequence
< css::util::RevisionTag
>&
65 GetList() { return maVersions
; }
68 class XMLVersionListContext final
: public SvXMLImportContext
71 XMLVersionListImport
& GetImport() { return static_cast<XMLVersionListImport
&>(SvXMLImportContext::GetImport()); }
75 XMLVersionListContext( XMLVersionListImport
& rImport
);
77 virtual ~XMLVersionListContext() override
;
79 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
80 createFastChildContext(sal_Int32 nElement
,
81 const css::uno::Reference
< css::xml::sax::XFastAttributeList
> & xAttribs
) override
;
84 class XMLVersionContext final
: public SvXMLImportContext
87 static bool ParseISODateTimeString(
88 std::u16string_view rString
,
89 css::util::DateTime
& rDateTime
);
93 XMLVersionContext( XMLVersionListImport
& rImport
,
94 const css::uno::Reference
< css::xml::sax::XFastAttributeList
> & xAttrList
);
96 virtual ~XMLVersionContext() override
;
99 class XMLVersionListPersistence final
: public ::cppu::WeakImplHelper
< css::document::XDocumentRevisionListPersistence
, css::lang::XServiceInfo
>
102 virtual css::uno::Sequence
< css::util::RevisionTag
> SAL_CALL
load( const css::uno::Reference
< css::embed::XStorage
>& Storage
) override
;
103 virtual void SAL_CALL
store( const css::uno::Reference
< css::embed::XStorage
>& Storage
, const css::uno::Sequence
< css::util::RevisionTag
>& List
) override
;
105 OUString SAL_CALL
getImplementationName() override
;
107 sal_Bool SAL_CALL
supportsService(OUString
const & ServiceName
) override
;
109 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */