1*ecfe53c5SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ecfe53c5SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ecfe53c5SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ecfe53c5SAndrew Rist * distributed with this work for additional information 6*ecfe53c5SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ecfe53c5SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ecfe53c5SAndrew Rist * "License"); you may not use this file except in compliance 9*ecfe53c5SAndrew Rist * with the License. You may obtain a copy of the License at 10*ecfe53c5SAndrew Rist * 11*ecfe53c5SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ecfe53c5SAndrew Rist * 13*ecfe53c5SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ecfe53c5SAndrew Rist * software distributed under the License is distributed on an 15*ecfe53c5SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ecfe53c5SAndrew Rist * KIND, either express or implied. See the License for the 17*ecfe53c5SAndrew Rist * specific language governing permissions and limitations 18*ecfe53c5SAndrew Rist * under the License. 19*ecfe53c5SAndrew Rist * 20*ecfe53c5SAndrew Rist *************************************************************/ 21*ecfe53c5SAndrew Rist 22*ecfe53c5SAndrew Rist 23cdf0e10cSrcweir #ifndef _XMLOFF_XMLVERSION_HXX 24cdf0e10cSrcweir #define _XMLOFF_XMLVERSION_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 27cdf0e10cSrcweir #include <com/sun/star/document/XDocumentRevisionListPersistence.hpp> 28cdf0e10cSrcweir #include <com/sun/star/util/RevisionTag.hpp> 29cdf0e10cSrcweir #include <com/sun/star/embed/XStorage.hpp> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 32cdf0e10cSrcweir #include <xmloff/xmlictxt.hxx> 33cdf0e10cSrcweir #include <xmloff/xmlexp.hxx> 34cdf0e10cSrcweir #include <xmloff/xmlimp.hxx> 35cdf0e10cSrcweir #include <xmloff/nmspmap.hxx> 36cdf0e10cSrcweir #include <xmloff/xmlnmspe.hxx> 37cdf0e10cSrcweir #include <xmloff/xmltoken.hxx> 38cdf0e10cSrcweir 39cdf0e10cSrcweir // ------------------------------------------------------------------------ 40cdf0e10cSrcweir class XMLVersionListExport : public SvXMLExport 41cdf0e10cSrcweir { 42cdf0e10cSrcweir private: 43cdf0e10cSrcweir const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& maVersions; 44cdf0e10cSrcweir public: 45cdf0e10cSrcweir XMLVersionListExport( 46cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, 47cdf0e10cSrcweir const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions, 48cdf0e10cSrcweir const rtl::OUString &rFileName, 49cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > &rHandler ); ~XMLVersionListExport()50cdf0e10cSrcweir virtual ~XMLVersionListExport() {} 51cdf0e10cSrcweir 52cdf0e10cSrcweir sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ); _ExportAutoStyles()53cdf0e10cSrcweir void _ExportAutoStyles() {} _ExportMasterStyles()54cdf0e10cSrcweir void _ExportMasterStyles () {} _ExportContent()55cdf0e10cSrcweir void _ExportContent() {} 56cdf0e10cSrcweir }; 57cdf0e10cSrcweir 58cdf0e10cSrcweir // ------------------------------------------------------------------------ 59cdf0e10cSrcweir class XMLVersionListImport : public SvXMLImport 60cdf0e10cSrcweir { 61cdf0e10cSrcweir private: 62cdf0e10cSrcweir com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& maVersions; 63cdf0e10cSrcweir 64cdf0e10cSrcweir protected: 65cdf0e10cSrcweir 66cdf0e10cSrcweir // This method is called after the namespace map has been updated, but 67cdf0e10cSrcweir // before a context for the current element has been pushed. 68cdf0e10cSrcweir virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix, 69cdf0e10cSrcweir const ::rtl::OUString& rLocalName, 70cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 71cdf0e10cSrcweir ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); 72cdf0e10cSrcweir 73cdf0e10cSrcweir public: 74cdf0e10cSrcweir 75cdf0e10cSrcweir // #110897# 76cdf0e10cSrcweir XMLVersionListImport( 77cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, 78cdf0e10cSrcweir com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions ); 79cdf0e10cSrcweir ~XMLVersionListImport() throw(); 80cdf0e10cSrcweir 81cdf0e10cSrcweir com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& GetList()82cdf0e10cSrcweir GetList() { return maVersions; } 83cdf0e10cSrcweir }; 84cdf0e10cSrcweir 85cdf0e10cSrcweir // ------------------------------------------------------------------------ 86cdf0e10cSrcweir class XMLVersionListContext : public SvXMLImportContext 87cdf0e10cSrcweir { 88cdf0e10cSrcweir private: 89cdf0e10cSrcweir XMLVersionListImport & rLocalRef; 90cdf0e10cSrcweir 91cdf0e10cSrcweir public: 92cdf0e10cSrcweir 93cdf0e10cSrcweir XMLVersionListContext( XMLVersionListImport& rImport, 94cdf0e10cSrcweir sal_uInt16 nPrefix, 95cdf0e10cSrcweir const rtl::OUString& rLocalName, 96cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 97cdf0e10cSrcweir ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir ~XMLVersionListContext(); 100cdf0e10cSrcweir 101cdf0e10cSrcweir virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 102cdf0e10cSrcweir const rtl::OUString& rLocalName, 103cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 104cdf0e10cSrcweir ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); 105cdf0e10cSrcweir 106cdf0e10cSrcweir }; 107cdf0e10cSrcweir 108cdf0e10cSrcweir // ------------------------------------------------------------------------ 109cdf0e10cSrcweir class XMLVersionContext: public SvXMLImportContext 110cdf0e10cSrcweir { 111cdf0e10cSrcweir private: 112cdf0e10cSrcweir XMLVersionListImport& rLocalRef; 113cdf0e10cSrcweir 114cdf0e10cSrcweir static sal_Bool ParseISODateTimeString( 115cdf0e10cSrcweir const rtl::OUString& rString, 116cdf0e10cSrcweir com::sun::star::util::DateTime& rDateTime ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir public: 119cdf0e10cSrcweir 120cdf0e10cSrcweir XMLVersionContext( XMLVersionListImport& rImport, 121cdf0e10cSrcweir sal_uInt16 nPrefix, 122cdf0e10cSrcweir const rtl::OUString& rLocalName, 123cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 124cdf0e10cSrcweir ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); 125cdf0e10cSrcweir 126cdf0e10cSrcweir ~XMLVersionContext(); 127cdf0e10cSrcweir }; 128cdf0e10cSrcweir 129cdf0e10cSrcweir 130cdf0e10cSrcweir // ------------------------------------------------------------------------ 131cdf0e10cSrcweir class XMLVersionListPersistence : public ::cppu::WeakImplHelper1< ::com::sun::star::document::XDocumentRevisionListPersistence > 132cdf0e10cSrcweir { 133cdf0e10cSrcweir public: 134cdf0e10cSrcweir 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); 135cdf0e10cSrcweir 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); 136cdf0e10cSrcweir }; 137cdf0e10cSrcweir 138cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 139cdf0e10cSrcweir XMLVersionListPersistence_getSupportedServiceNames() 140cdf0e10cSrcweir throw(); 141cdf0e10cSrcweir 142cdf0e10cSrcweir ::rtl::OUString SAL_CALL XMLVersionPersistence_getImplementationName() 143cdf0e10cSrcweir throw(); 144cdf0e10cSrcweir 145cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 146cdf0e10cSrcweir XMLVersionListPersistence_createInstance( 147cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 148cdf0e10cSrcweir ::com::sun::star::lang::XMultiServiceFactory > & ) 149cdf0e10cSrcweir throw( ::com::sun::star::uno::Exception ); 150cdf0e10cSrcweir 151cdf0e10cSrcweir #endif 152