Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_svtools / jpeg.hxx
blob066d6ac12a600b5f000081c852522db4ff1cb758
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: jpeg.hxx,v $
10 * $Revision: 1.3 $
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 ************************************************************************/
31 #ifndef _JPEG_HXX
32 #define _JPEG_HXX
34 #ifndef _GRAPH_HXX
35 #include <vcl/graph.hxx>
36 #endif
37 #ifndef _FLTCALL_HXX
38 #include <bf_svtools/fltcall.hxx>
39 #endif
40 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
41 #include <com/sun/star/uno/Sequence.h>
42 #endif
43 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
44 #include <com/sun/star/beans/PropertyValue.hpp>
45 #endif
46 #ifndef _COM_SUN_STAR_TASK_XSTATUSINDICATOR_HPP_
47 #include <com/sun/star/task/XStatusIndicator.hpp>
48 #endif
50 namespace binfilter
53 #ifdef _JPEGPRIVATE
55 // --------
56 // - Enum -
57 // --------
59 enum ReadState
61 JPEGREAD_OK,
62 JPEGREAD_ERROR,
63 JPEGREAD_NEED_MORE
66 // --------------
67 // - JPEGReader -
68 // --------------
70 class JPEGReader : public GraphicReader
72 SvStream& rIStm;
73 Bitmap aBmp;
74 Bitmap aBmp1;
75 BitmapWriteAccess* pAcc;
76 BitmapWriteAccess* pAcc1;
77 void* pBuffer;
78 long nLastPos;
79 long nFormerPos;
80 long nLastLines;
81 sal_Bool bSetLogSize;
83 Graphic CreateIntermediateGraphic( const Bitmap& rBitmap, long nLines );
84 void FillBitmap();
86 public:
88 void* CreateBitmap( void* JPEGCreateBitmapParam );
90 public:
94 JPEGReader( SvStream& rStm, void* pCallData, sal_Bool bSetLogSize );
95 virtual ~JPEGReader();
98 ReadState Read( Graphic& rGraphic );
101 // --------------
102 // - JPEGWriter -
103 // --------------
105 class JPEGWriter
107 SvStream& rOStm;
108 Bitmap aBmp;
109 BitmapReadAccess* pAcc;
110 BYTE* pBuffer;
111 BOOL bNative;
113 sal_Bool bGreys;
114 sal_Int32 nQuality;
116 com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
118 public:
120 void* GetScanline( long nY );
122 JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData );
123 ~JPEGWriter() {};
125 BOOL Write( const Graphic& rGraphic );
128 #endif // _JPEGPRIVATE
130 // ---------------------
131 // - Import/ExportJPEG -
132 // ---------------------
134 BOOL ImportJPEG( SvStream& rStream, Graphic& rGraphic, void* pCallerData, sal_Int32 nImportFlags );
136 BOOL ExportJPEG( SvStream& rStream, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData );
140 #endif // _JPEG_HXX