1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlversion.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _XMLOFF_XMLVERSION_HXX
31 #define _XMLOFF_XMLVERSION_HXX
33 #include <com/sun/star/uno/Sequence.hxx>
34 #include <com/sun/star/document/XDocumentRevisionListPersistence.hpp>
35 #include <com/sun/star/util/RevisionTag.hpp>
36 #include <com/sun/star/embed/XStorage.hpp>
38 #include <cppuhelper/implbase1.hxx>
39 #include <xmloff/xmlictxt.hxx>
40 #include <xmloff/xmlexp.hxx>
41 #include <xmloff/xmlimp.hxx>
42 #include <xmloff/nmspmap.hxx>
43 #include <xmlnmspe.hxx>
44 #include <xmloff/xmltoken.hxx>
46 // ------------------------------------------------------------------------
47 class XMLVersionListExport
: public SvXMLExport
50 const com::sun::star::uno::Sequence
< com::sun::star::util::RevisionTag
>& maVersions
;
53 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xServiceFactory
,
54 const com::sun::star::uno::Sequence
< com::sun::star::util::RevisionTag
>& rVersions
,
55 const rtl::OUString
&rFileName
,
56 com::sun::star::uno::Reference
< com::sun::star::xml::sax::XDocumentHandler
> &rHandler
);
57 virtual ~XMLVersionListExport() {}
59 sal_uInt32
exportDoc( enum ::xmloff::token::XMLTokenEnum eClass
);
60 void _ExportAutoStyles() {}
61 void _ExportMasterStyles () {}
62 void _ExportContent() {}
65 // ------------------------------------------------------------------------
66 class XMLVersionListImport
: public SvXMLImport
69 com::sun::star::uno::Sequence
< com::sun::star::util::RevisionTag
>& maVersions
;
73 // This method is called after the namespace map has been updated, but
74 // before a context for the current element has been pushed.
75 virtual SvXMLImportContext
*CreateContext( sal_uInt16 nPrefix
,
76 const ::rtl::OUString
& rLocalName
,
77 const ::com::sun::star::uno::Reference
<
78 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
84 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xServiceFactory
,
85 com::sun::star::uno::Sequence
< com::sun::star::util::RevisionTag
>& rVersions
);
86 ~XMLVersionListImport() throw();
88 com::sun::star::uno::Sequence
< com::sun::star::util::RevisionTag
>&
89 GetList() { return maVersions
; }
92 // ------------------------------------------------------------------------
93 class XMLVersionListContext
: public SvXMLImportContext
96 XMLVersionListImport
& rLocalRef
;
100 XMLVersionListContext( XMLVersionListImport
& rImport
,
102 const rtl::OUString
& rLocalName
,
103 const ::com::sun::star::uno::Reference
<
104 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
106 ~XMLVersionListContext();
108 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
109 const rtl::OUString
& rLocalName
,
110 const ::com::sun::star::uno::Reference
<
111 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
115 // ------------------------------------------------------------------------
116 class XMLVersionContext
: public SvXMLImportContext
119 XMLVersionListImport
& rLocalRef
;
121 static sal_Bool
ParseISODateTimeString(
122 const rtl::OUString
& rString
,
123 com::sun::star::util::DateTime
& rDateTime
);
127 XMLVersionContext( XMLVersionListImport
& rImport
,
129 const rtl::OUString
& rLocalName
,
130 const ::com::sun::star::uno::Reference
<
131 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
133 ~XMLVersionContext();
137 // ------------------------------------------------------------------------
138 class XMLVersionListPersistence
: public ::cppu::WeakImplHelper1
< ::com::sun::star::document::XDocumentRevisionListPersistence
>
141 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
);
142 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
);
145 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
146 XMLVersionListPersistence_getSupportedServiceNames()
149 ::rtl::OUString SAL_CALL
XMLVersionPersistence_getImplementationName()
152 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
153 XMLVersionListPersistence_createInstance(
154 const ::com::sun::star::uno::Reference
<
155 ::com::sun::star::lang::XMultiServiceFactory
> & )
156 throw( ::com::sun::star::uno::Exception
);