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 _ZIP_OUTPUT_STREAM_HXX
20 #define _ZIP_OUTPUT_STREAM_HXX
22 #include <com/sun/star/uno/Reference.hxx>
23 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 #include <com/sun/star/io/XOutputStream.hpp>
25 #include <com/sun/star/xml/crypto/XCipherContext.hpp>
26 #include <com/sun/star/xml/crypto/XDigestContext.hpp>
28 #include <package/Deflater.hxx>
29 #include <ByteChucker.hxx>
35 class ZipPackageStream
;
38 template < class T
> class Reference
;
44 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
45 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
> xStream
;
47 ::std::vector
< ZipEntry
* > aZipList
;
49 ::com::sun::star::uno::Sequence
< sal_Int8
> m_aDeflateBuffer
;
52 ZipUtils::Deflater aDeflater
;
54 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::crypto::XCipherContext
> m_xCipherContext
;
55 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::crypto::XDigestContext
> m_xDigestContext
;
59 ZipEntry
*pCurrentEntry
;
60 sal_Int16 nMethod
, nLevel
, mnDigested
;
61 sal_Bool bFinished
, bEncryptCurrentEntry
;
62 ZipPackageStream
* m_pCurrentStream
;
66 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
,
67 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
> &xOStream
);
70 // rawWrite to support a direct write to the output stream
71 void SAL_CALL
rawWrite( ::com::sun::star::uno::Sequence
< sal_Int8
>& rBuffer
, sal_Int32 nNewOffset
, sal_Int32 nNewLength
)
72 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
73 void SAL_CALL
rawCloseEntry( )
74 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
76 // XZipOutputStream interfaces
77 void SAL_CALL
setMethod( sal_Int32 nNewMethod
)
78 throw(::com::sun::star::uno::RuntimeException
);
79 void SAL_CALL
setLevel( sal_Int32 nNewLevel
)
80 throw(::com::sun::star::uno::RuntimeException
);
81 void SAL_CALL
putNextEntry( ZipEntry
& rEntry
,
82 ZipPackageStream
* pStream
,
83 sal_Bool bEncrypt
= sal_False
)
84 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
85 void SAL_CALL
closeEntry( )
86 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
87 void SAL_CALL
write( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rBuffer
, sal_Int32 nNewOffset
, sal_Int32 nNewLength
)
88 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
89 void SAL_CALL
finish( )
90 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
91 static sal_uInt32
getCurrentDosTime ( );
94 void writeEND(sal_uInt32 nOffset
, sal_uInt32 nLength
)
95 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
96 void writeCEN( const ZipEntry
&rEntry
)
97 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
98 void writeEXT( const ZipEntry
&rEntry
)
99 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
100 sal_Int32
writeLOC( const ZipEntry
&rEntry
)
101 throw(::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */