1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 #ifndef _EXPORTDIALOG_HXX_
26 #define _EXPORTDIALOG_HXX_
27 
28 #include <svtools/fltcall.hxx>
29 #include <vcl/dialog.hxx>
30 #include <vcl/button.hxx>
31 #include <vcl/fixed.hxx>
32 #include <vcl/field.hxx>
33 #include <vcl/lstbox.hxx>
34 #include <vcl/msgbox.hxx>
35 #include <vcl/arrange.hxx>
36 #include <vcl/scrbar.hxx>
37 #include <com/sun/star/document/XExporter.hpp>
38 #include <com/sun/star/drawing/XShape.hpp>
39 #include <com/sun/star/drawing/XShapes.hpp>
40 #include <com/sun/star/drawing/XDrawPage.hpp>
41 
42 /*************************************************************************
43 |*
44 |* Dialog zum Einstellen von Filteroptionen bei Pixelformaten
45 |*
46 \************************************************************************/
47 
48 class FilterConfigItem;
49 class ExportDialog : public ModalDialog
50 {
51 private:
52 
53 	FltCallDialogParameter&
54 		mrFltCallPara;
55 
56 	ResMgr*				mpMgr;
57 
58 	const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
59         mxMgr;
60 	const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >&
61 		mxSourceDocument;
62 
63 	FixedLine			maFlExportSize;
64 	FixedText			maFtSizeX;
65 	MetricField			maMfSizeX;
66 	ListBox				maLbSizeX;
67 	FixedText			maFtSizeY;
68 	MetricField			maMfSizeY;
69 	ListBox				maLbSizeY;
70 	FixedText			maFtResolution;
71 	NumericField		maNfResolution;
72 	ListBox				maLbResolution;
73 	FixedLine			maFlColorDepth;
74 	ListBox				maLbColorDepth;
75 	FixedLine			maFlJPGQuality;
76 	FixedLine			maFlMode;
77 	FixedLine			maFlPBMOptions;
78 	ScrollBar			maSbCompression;
79 	NumericField		maNfCompression;
80 	FixedText			maFtJPGMin;
81 	FixedText			maFtJPGMax;
82 	FixedText			maFtPNGMin;
83 	FixedText			maFtPNGMax;
84 	CheckBox			maCbJPGPreview;
85 	CheckBox			maCbInterlaced;
86 	CheckBox			maCbRLEEncoding;
87 	FixedLine			maFlGIFDrawingObjects;
88 	CheckBox			maCbSaveTransparency;
89 	RadioButton			maRbBinary;
90 	RadioButton			maRbText;
91 	FixedLine			maFlEPSPreview;
92 	CheckBox			maCbEPSPreviewTIFF;
93 	CheckBox			maCbEPSPreviewEPSI;
94 	FixedLine			maFlEPSVersion;
95 	RadioButton			maRbEPSLevel1;
96 	RadioButton			maRbEPSLevel2;
97 	FixedLine			maFlEPSColorFormat;
98 	RadioButton			maRbEPSColorFormat1;
99 	RadioButton			maRbEPSColorFormat2;
100 	FixedLine			maFlCompression;
101 	RadioButton			maRbEPSCompressionLZW;
102 	RadioButton			maRbEPSCompressionNone;
103 	FixedLine			maFlEstimatedSize;
104 	FixedText			maFtEstimatedSize;
105 	String				msEstimatedSizePix1;
106 	String				msEstimatedSizePix2;
107 	String				msEstimatedSizeVec;
108 	FixedLine			maFlButtons;
109 	FixedBitmap			maFbJPGPreview;
110 	ScrollBar			maSbZoom;
111 	NumericField		maNfZoom;
112 	ScrollBar			maSbJPGPreviewHorz;
113 	ScrollBar			maSbJPGPreviewVert;
114 	OKButton			maBtnOK;
115 	CancelButton		maBtnCancel;
116 	HelpButton			maBtnHelp;
117 
118 	String				ms1BitTreshold;
119 	String				ms1BitDithered;
120 	String				ms4BitGrayscale;
121 	String				ms4BitColorPalette;
122 	String				ms8BitGrayscale;
123 	String				ms8BitColorPalette;
124 	String				ms24BitColor;
125 
126 	vcl::RowOrColumn	maLayout;
127 	Size				maDialogSize;
128 
129 	FilterConfigItem*	mpOptionsItem;
130 	FilterConfigItem*	mpFilterOptionsItem;
131 
132 	String				maExt;
133 	String				maEstimatedSizeText;
134 	sal_Int16			mnFormat;
135 	sal_Int32			mnMaxFilesizeForRealtimePreview;
136 
137 	Rectangle			maRectFlButtons;
138 	Rectangle			maRectBtnHelp;
139 	Rectangle			maRectBtnOK;
140 	Rectangle			maRectBtnCancel;
141 
142 	SvStream*			mpTempStream;
143 	Bitmap				maBitmap;
144 
145 	com::sun::star::awt::Size
146 						maOriginalSize;		// the original graphic size in 1/100mm
147 	com::sun::star::awt::Size
148 						maSize;				// for vector graphics it always contains the logical size in 1/100mm
149 
150 	sal_Bool			mbPreview;
151 	sal_Bool			mbIsPixelFormat;
152 	sal_Bool			mbExportSelection;
153 	sal_Bool			mbPreserveAspectRatio;
154 
155 	sal_Int32			mnInitialResolutionUnit;
156 
157 	// for pixel graphics it always contains the pixel count
158 	com::sun::star::awt::Size
159 						maResolution;		// it always contains the number of pixels per meter
160 
161 	com::sun::star::uno::Reference< com::sun::star::drawing::XShape >
162 						mxShape;
163 	com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >
164 						mxShapes;
165 	com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >
166 						mxPage;
167 
168 
169 						DECL_LINK( UpdateHdl,void* p );
170 						DECL_LINK( UpdateHdlMtfSizeX,void* p );
171 						DECL_LINK( UpdateHdlMtfSizeY,void* p );
172 						DECL_LINK( UpdateHdlNfResolution,void* p );
173 						DECL_LINK( SbCompressionUpdateHdl,void* p );
174 						DECL_LINK( NfCompressionUpdateHdlX,void* p );
175 
176 						DECL_LINK( OK, void* p );
177 
178 						void createSizeControls( vcl::RowOrColumn& );
179 						void createColorDepthControls( vcl::RowOrColumn& );
180 						void createFilterOptions( vcl::RowOrColumn& );
181 						void createButtons( vcl::RowOrColumn& );
182 						void createScrollBar( vcl::RowOrColumn& );
183 				        void setupLayout();
184 						void updatePreview();
185 						void updateControls();
186 
187 						void GetGraphicSource();
188 						sal_Bool GetGraphicStream();
189 						Bitmap GetGraphicBitmap( SvStream& rStream );
190 						::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
191 							GetFilterData( sal_Bool bUpdateConfig );
192 
193 						sal_uInt32 GetRawFileSize() const;
194 						sal_Bool IsTempExportAvailable() const;
195 
196 						com::sun::star::awt::Size
197 							GetOriginalSize();
198 
199 						sal_Int32 GetDefaultUnit();
200 
201 public:
202 						ExportDialog( FltCallDialogParameter& rPara,
203 							const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > rxMgr,
204 								const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSourceDocument,
205 									sal_Bool bExportSelection, sal_Bool bIsExportVectorFormat );
206 						~ExportDialog();
207 };
208 
209 
210 
211 #endif // _EXPORTDIALOG_HXX_
212 
213