~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to filters/kword/msword-odf/wv2/src/zcodec.hxx

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*************************************************************************
 
2
 *
 
3
 *  OpenOffice.org - a multi-platform office productivity suite
 
4
 *
 
5
 *  $RCSfile: zcodec.hxx,v $
 
6
 *
 
7
 *  $Revision: 1.4 $
 
8
 *
 
9
 *  last change: $Author: tuubaaku $ $Date: 2009/02/14 02:51:13 $
 
10
 *
 
11
 *  The Contents of this file are made available subject to
 
12
 *  the terms of GNU Lesser General Public License Version 2.1.
 
13
 *
 
14
 *
 
15
 *    GNU Lesser General Public License Version 2.1
 
16
 *    =============================================
 
17
 *    Copyright 2005 by Sun Microsystems, Inc.
 
18
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 
19
 *
 
20
 *    This library is free software; you can redistribute it and/or
 
21
 *    modify it under the terms of the GNU Lesser General Public
 
22
 *    License version 2.1, as published by the Free Software Foundation.
 
23
 *
 
24
 *    This library is distributed in the hope that it will be useful,
 
25
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
26
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
27
 *    Lesser General Public License for more details.
 
28
 *
 
29
 *    You should have received a copy of the GNU Lesser General Public
 
30
 *    License along with this library; if not, write to the Free Software
 
31
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 
32
 *    MA  02111-1307  USA
 
33
 *
 
34
 ************************************************************************/
 
35
 
 
36
#ifndef _ZCODEC_HXX
 
37
#define _ZCODEC_HXX
 
38
 
 
39
//#ifndef INCLUDED_TOOLSDLLAPI_H
 
40
//#include "tools/toolsdllapi.h"
 
41
//#endif
 
42
 
 
43
//#ifndef _SOLAR_H
 
44
//#include <tools/solar.h>
 
45
//#endif
 
46
 
 
47
#include "global.h" //for U8
 
48
#include <vector> //for std::vector
 
49
 
 
50
// -----------
 
51
// - Defines -
 
52
// -----------
 
53
 
 
54
#define DEFAULT_IN_BUFSIZE                      (0x00008000UL)
 
55
#define DEFAULT_OUT_BUFSIZE                     (0x00008000UL)
 
56
 
 
57
#define MAX_MEM_USAGE 8
 
58
 
 
59
//
 
60
// memory requirement using compress:
 
61
//      [ INBUFFER ] + [ OUTBUFFER ] + 128KB + 1 << (MEM_USAGE+9)
 
62
//
 
63
// memory requirement using decompress:
 
64
//      [ INBUFFER ] + [ OUTBUFFER ] + 32KB
 
65
//
 
66
 
 
67
#define ZCODEC_NO_COMPRESSION           (0x00000000UL)
 
68
#define ZCODEC_BEST_SPEED                       (0x00000001UL)
 
69
#define ZCODEC_DEFAULT_COMPRESSION      (0x00000006UL)
 
70
#define ZCODEC_BEST_COMPRESSION         (0x00000009UL)
 
71
 
 
72
#define ZCODEC_DEFAULT_STRATEGY         (0x00000000UL)
 
73
#define ZCODEC_ZFILTERED                        (0x00000100UL)
 
74
#define ZCODEC_ZHUFFMAN_ONLY            (0x00000200UL)
 
75
 
 
76
#define ZCODEC_UPDATE_CRC                       (0x00010000UL)
 
77
#define ZCODEC_GZ_LIB                           (0x00020000UL)
 
78
 
 
79
#define ZCODEC_PNG_DEFAULT ( ZCODEC_NO_COMPRESSION | ZCODEC_DEFAULT_STRATEGY | ZCODEC_UPDATE_CRC )
 
80
#define ZCODEC_DEFAULT  ( ZCODEC_DEFAULT_COMPRESSION | ZCODEC_DEFAULT_STRATEGY )
 
81
 
 
82
// ----------
 
83
// - ZCodec -
 
84
// ----------
 
85
 
 
86
//class OLEStreamReader;
 
87
//class OLEStreamWriter;
 
88
 
 
89
using namespace wvWare;
 
90
 
 
91
typedef unsigned long ULONG;
 
92
typedef bool BOOL;
 
93
typedef U8 BYTE;
 
94
 
 
95
class ZCodec
 
96
{
 
97
private:
 
98
 
 
99
        ULONG                   mbInit;
 
100
        BOOL                    mbStatus; //status good or bad
 
101
        BOOL                    mbFinish; //are we finished yet?
 
102
        ULONG                   mnMemUsage; //total memory we can use?
 
103
        OLEStreamReader*        mpIStm; //in-stream
 
104
        BYTE*                   mpInBuf; //in-buffer
 
105
        ULONG                   mnInBufSize; //size of the in-buffer
 
106
        ULONG                   mnInToRead; //how many bytes overall we still want to read
 
107
        OLEStreamWriter*        mpOStm; //out-stream
 
108
        BYTE*                   mpOutBuf; //out-buffer
 
109
        ULONG                   mnOutBufSize; //size of the out-buffer
 
110
 
 
111
        ULONG                   mnCRC;
 
112
        ULONG                   mnCompressMethod;
 
113
        void*                   mpsC_Stream;
 
114
 
 
115
        void                    ImplInitBuf( BOOL nIOFlag );
 
116
        void                    ImplWriteBack( std::vector<U8>* outBuffer );
 
117
 
 
118
public: 
 
119
                                ZCodec( ULONG nInBuf, ULONG nOutBuf, ULONG nMemUsage = MAX_MEM_USAGE );
 
120
                                ZCodec( void ); 
 
121
        virtual                 ~ZCodec();
 
122
 
 
123
        virtual void    BeginCompression( ULONG nCompressMethod = ZCODEC_DEFAULT );
 
124
        virtual long    EndCompression(std::vector<U8>* outBuffer);
 
125
        BOOL            IsFinished () const { return mbFinish; }
 
126
 
 
127
        long                    Compress( OLEStreamReader& rIStm, OLEStreamWriter& rOStm );
 
128
        long                    Decompress( OLEStreamReader& rIStm, std::vector<U8>* outBuffer );
 
129
 
 
130
        //long                  Write( OLEStreamWriter& rOStm, const BYTE* pData, ULONG nSize );
 
131
        //long                  Read( OLEStreamReader& rIStm, BYTE* pData, ULONG nSize );
 
132
        //long                  ReadAsynchron( OLEStreamReader& rIStm, BYTE* pData, ULONG nSize );
 
133
 
 
134
        void                    SetBreak( ULONG );
 
135
        //ULONG                 GetBreak( void );
 
136
        //void                  SetCRC( ULONG nCurrentCRC );
 
137
        //ULONG                 UpdateCRC( ULONG nLatestCRC, ULONG nSource );   
 
138
        //ULONG                 UpdateCRC( ULONG nLatestCRC, BYTE* pSource, long nDatSize );
 
139
        //ULONG                 GetCRC();
 
140
};
 
141
 
 
142
class GZCodec : public ZCodec
 
143
{
 
144
 
 
145
public:
 
146
                                        GZCodec(){};
 
147
                                        ~GZCodec(){};
 
148
        virtual void    BeginCompression( ULONG nCompressMethod = ZCODEC_DEFAULT );
 
149
};
 
150
 
 
151
#endif // _ZCODEC_HXX