Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #ifndef GCC
31 : : # pragma hdrstop
32 : : #endif
33 : :
34 : : #include <tools/stream.hxx>
35 : : #include <svtools/filter.hxx>
36 : : #include <svtools/FilterConfigItem.hxx>
37 : : #include <com/sun/star/io/XStream.hpp>
38 : : #include <com/sun/star/awt/Size.hpp>
39 : : #include <com/sun/star/view/XSelectionSupplier.hpp>
40 : : #include <com/sun/star/frame/XModel.hpp>
41 : : #include <com/sun/star/frame/XController.hpp>
42 : : #include <com/sun/star/drawing/XDrawView.hpp>
43 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44 : : #include <com/sun/star/graphic/XPrimitiveFactory2D.hpp>
45 : : #include <com/sun/star/geometry/AffineMatrix2D.hpp>
46 : : #include <com/sun/star/document/XExporter.hpp>
47 : : #include <com/sun/star/document/XFilter.hpp>
48 : : #include <unotools/streamwrap.hxx>
49 : : #include <vcl/msgbox.hxx>
50 : : #include <vcl/svapp.hxx>
51 : : #include <vcl/outdev.hxx>
52 : : #include <vcl/graph.hxx>
53 : : #include <rtl/ustrbuf.hxx>
54 : : #include <basegfx/matrix/b2dhommatrix.hxx>
55 : : #include "exportdialog.hxx"
56 : : #include "exportdialog.hrc"
57 : :
58 : : #define FORMAT_UNKNOWN 0
59 : : #define FORMAT_JPG 1
60 : : #define FORMAT_PNG 2
61 : : #define FORMAT_BMP 3
62 : : #define FORMAT_GIF 4
63 : : #define FORMAT_PBM 5
64 : : #define FORMAT_PGM 6
65 : : #define FORMAT_PPM 7
66 : : #define FORMAT_PCT 8
67 : : #define FORMAT_RAS 9
68 : : #define FORMAT_TIF 10
69 : : #define FORMAT_XPM 11
70 : : #define FORMAT_WMF 12
71 : : #define FORMAT_EMF 13
72 : : #define FORMAT_EPS 14
73 : : #define FORMAT_MET 15
74 : : #define FORMAT_SVG 16
75 : : #define FORMAT_SVM 17
76 : :
77 : : #define UNIT_DEFAULT -1
78 : : #define UNIT_INCH 0
79 : : #define UNIT_CM 1
80 : : #define UNIT_MM 2
81 : : #define UNIT_POINT 3
82 : : #define UNIT_PIXEL 4
83 : : #define UNIT_MAX_ID UNIT_PIXEL
84 : :
85 : : using namespace ::com::sun::star;
86 : :
87 : 0 : static sal_Int16 GetFilterFormat(const rtl::OUString& rExt)
88 : : {
89 : 0 : sal_Int16 nFormat = FORMAT_UNKNOWN;
90 [ # # ]: 0 : if ( rExt == "JPG" )
91 : 0 : nFormat = FORMAT_JPG;
92 [ # # ]: 0 : else if ( rExt == "PNG" )
93 : 0 : nFormat = FORMAT_PNG;
94 [ # # ]: 0 : else if ( rExt == "BMP" )
95 : 0 : nFormat = FORMAT_BMP;
96 [ # # ]: 0 : else if ( rExt == "GIF" )
97 : 0 : nFormat = FORMAT_GIF;
98 [ # # ]: 0 : else if ( rExt == "PBM" )
99 : 0 : nFormat = FORMAT_PBM;
100 [ # # ]: 0 : else if ( rExt == "PGM" )
101 : 0 : nFormat = FORMAT_PGM;
102 [ # # ]: 0 : else if ( rExt == "PPM" )
103 : 0 : nFormat = FORMAT_PPM;
104 [ # # ]: 0 : else if ( rExt == "PCT" )
105 : 0 : nFormat = FORMAT_PCT;
106 [ # # ]: 0 : else if ( rExt == "RAS" )
107 : 0 : nFormat = FORMAT_RAS;
108 [ # # ]: 0 : else if ( rExt == "TIF" )
109 : 0 : nFormat = FORMAT_TIF;
110 [ # # ]: 0 : else if ( rExt == "XPM" )
111 : 0 : nFormat = FORMAT_XPM;
112 [ # # ]: 0 : else if ( rExt == "WMF" )
113 : 0 : nFormat = FORMAT_WMF;
114 [ # # ]: 0 : else if ( rExt == "EMF" )
115 : 0 : nFormat = FORMAT_EMF;
116 [ # # ]: 0 : else if ( rExt == "EPS" )
117 : 0 : nFormat = FORMAT_EPS;
118 [ # # ]: 0 : else if ( rExt == "MET" )
119 : 0 : nFormat = FORMAT_MET;
120 [ # # ]: 0 : else if ( rExt == "SVG" )
121 : 0 : nFormat = FORMAT_SVG;
122 [ # # ]: 0 : else if ( rExt == "SVM" )
123 : 0 : nFormat = FORMAT_SVM;
124 : 0 : return nFormat;
125 : : }
126 : :
127 : 0 : static MapUnit GetMapUnit( sal_Int32 nUnit )
128 : : {
129 : 0 : MapUnit aMapUnit( MAP_PIXEL );
130 [ # # # # : 0 : switch( nUnit )
# # ]
131 : : {
132 : 0 : case UNIT_INCH : aMapUnit = MAP_INCH; break;
133 : 0 : case UNIT_CM : aMapUnit = MAP_CM; break;
134 : 0 : case UNIT_MM : aMapUnit = MAP_MM; break;
135 : 0 : case UNIT_POINT : aMapUnit = MAP_POINT; break;
136 : 0 : case UNIT_PIXEL : aMapUnit = MAP_PIXEL; break;
137 : : }
138 : 0 : return aMapUnit;
139 : : }
140 : :
141 : 0 : sal_Int32 ExportDialog::GetDefaultUnit()
142 : : {
143 : 0 : sal_Int32 nDefaultUnit = UNIT_CM;
144 [ # # # # : 0 : switch( mrFltCallPara.eFieldUnit )
# # # ]
145 : : {
146 : : // case FUNIT_NONE :
147 : : // case FUNIT_PERCENT :
148 : : // case FUNIT_CUSTOM :
149 : 0 : default: nDefaultUnit = UNIT_CM; break;
150 : :
151 : : case FUNIT_MILE : // PASSTHROUGH INTENDED
152 : : case FUNIT_FOOT :
153 : : case FUNIT_TWIP :
154 : 0 : case FUNIT_PICA : nDefaultUnit = UNIT_INCH; break;
155 : :
156 : : case FUNIT_KM : // PASSTHROUGH INTENDED
157 : : case FUNIT_M :
158 : 0 : case FUNIT_100TH_MM : nDefaultUnit = UNIT_CM; break;
159 : :
160 : 0 : case FUNIT_INCH : nDefaultUnit = UNIT_INCH; break;
161 : 0 : case FUNIT_CM : nDefaultUnit = UNIT_CM; break;
162 : 0 : case FUNIT_MM : nDefaultUnit = UNIT_MM; break;
163 : 0 : case FUNIT_POINT : nDefaultUnit = UNIT_POINT; break;
164 : : }
165 : 0 : return nDefaultUnit;
166 : : }
167 : :
168 : 0 : static basegfx::B2DRange GetShapeRangeForXShape( const uno::Reference< drawing::XShape >& rxShape,
169 : : const uno::Reference< graphic::XPrimitiveFactory2D >& rxPrimitiveFactory2D, const uno::Sequence< beans::PropertyValue >& rViewInformation )
170 : : {
171 [ # # ]: 0 : basegfx::B2DRange aShapeRange;
172 : :
173 [ # # ]: 0 : const uno::Sequence< beans::PropertyValue > aParams;
174 [ # # ][ # # ]: 0 : const uno::Sequence< uno::Reference< graphic::XPrimitive2D > > aPrimitiveSequence( rxPrimitiveFactory2D->createPrimitivesFromXShape( rxShape, aParams ) );
175 : :
176 : 0 : const sal_Int32 nCount = aPrimitiveSequence.getLength();
177 [ # # ]: 0 : for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
178 : : {
179 [ # # ][ # # ]: 0 : const geometry::RealRectangle2D aRect( aPrimitiveSequence[ nIndex ]->getRange( rViewInformation ) );
180 [ # # ]: 0 : aShapeRange.expand( basegfx::B2DTuple( aRect.X1, aRect.Y1 ) );
181 [ # # ]: 0 : aShapeRange.expand( basegfx::B2DTuple( aRect.X2, aRect.Y2 ) );
182 : : }
183 [ # # ][ # # ]: 0 : return aShapeRange;
184 : : }
185 : :
186 : 0 : uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( sal_Bool bUpdateConfig )
187 : : {
188 [ # # ]: 0 : if ( bUpdateConfig )
189 : : {
190 [ # # ]: 0 : sal_Int32 nUnit = maLbSizeX.GetSelectEntryPos();
191 [ # # ]: 0 : if ( nUnit < 0 )
192 : 0 : nUnit = UNIT_CM;
193 : :
194 [ # # ][ # # ]: 0 : if ( ( mnInitialResolutionUnit == UNIT_DEFAULT ) && ( nUnit == GetDefaultUnit() ) )
[ # # ]
195 : 0 : nUnit = UNIT_DEFAULT;
196 : :
197 : : // updating ui configuration
198 [ # # ]: 0 : if ( mbIsPixelFormat )
199 : : {
200 [ # # ]: 0 : if ( nUnit > UNIT_MAX_ID )
201 : 0 : nUnit = UNIT_PIXEL;
202 : :
203 [ # # ]: 0 : sal_Int32 nResolution = maNfResolution.GetValue();
204 [ # # ]: 0 : if ( nResolution < 1 )
205 : 0 : nResolution = 96;
206 : :
207 [ # # ][ # # ]: 0 : mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportUnit" ) ), nUnit );
[ # # ][ # # ]
208 [ # # ][ # # ]: 0 : mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolution" ) ), nResolution );
[ # # ][ # # ]
209 [ # # ][ # # ]: 0 : mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolutionUnit" ) ), maLbResolution.GetSelectEntryPos() );
[ # # ][ # # ]
[ # # ]
210 : : }
211 : : else
212 : : {
213 [ # # ]: 0 : if ( nUnit >= UNIT_PIXEL )
214 : 0 : nUnit = UNIT_CM;
215 : :
216 [ # # ][ # # ]: 0 : mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "VectorExportUnit" ) ), nUnit );
[ # # ][ # # ]
217 : : }
218 : : }
219 : :
220 : : FilterConfigItem* pFilterOptions;
221 [ # # ]: 0 : if ( bUpdateConfig )
222 : 0 : pFilterOptions = mpFilterOptionsItem;
223 : : else
224 : : {
225 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aFilterData( mpFilterOptionsItem->GetFilterData() );
226 [ # # ][ # # ]: 0 : pFilterOptions = new FilterConfigItem( &aFilterData );
[ # # ]
227 : : }
228 : :
229 [ # # ]: 0 : const String sLogicalWidth( String( RTL_CONSTASCII_USTRINGPARAM( "LogicalWidth" ) ) );
230 [ # # ]: 0 : const String sLogicalHeight( String( RTL_CONSTASCII_USTRINGPARAM( "LogicalHeight" ) ) );
231 [ # # ]: 0 : if ( mbIsPixelFormat )
232 : : {
233 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelWidth" ) ), static_cast< sal_Int32 >( maSize.Width ) );
[ # # ][ # # ]
234 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelHeight" ) ), static_cast< sal_Int32 >( maSize.Height ) );
[ # # ][ # # ]
235 [ # # ][ # # ]: 0 : if ( maResolution.Width && maResolution.Height )
236 : : {
237 : 0 : const double f100thmmPerPixelX = 100000.0 / maResolution.Width;
238 : 0 : const double f100thmmPerPixelY = 100000.0 / maResolution.Height;
239 : 0 : sal_Int32 nLogicalWidth = static_cast< sal_Int32 >( f100thmmPerPixelX * maSize.Width );
240 : 0 : sal_Int32 nLogicalHeight= static_cast< sal_Int32 >( f100thmmPerPixelY * maSize.Height );
241 [ # # ][ # # ]: 0 : if ( nLogicalWidth && nLogicalHeight )
242 : : {
243 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( sLogicalWidth, nLogicalWidth );
244 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( sLogicalHeight, nLogicalHeight );
245 : : }
246 : : }
247 : : }
248 : : else
249 : : {
250 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( sLogicalWidth, static_cast< sal_Int32 >( maSize.Width ) );
251 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( sLogicalHeight, static_cast< sal_Int32 >( maSize.Height ) );
252 : : }
253 [ # # # # : 0 : switch ( mnFormat )
# # # ]
254 : : {
255 : : case FORMAT_JPG :
256 : : {
257 [ # # ]: 0 : sal_Int32 nColor = maLbColorDepth.GetSelectEntryPos();
258 [ # # ]: 0 : if ( nColor == 1 )
259 : 0 : nColor = 0;
260 : : else
261 : 0 : nColor = 1;
262 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), nColor );
[ # # ][ # # ]
263 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), static_cast< sal_Int32 >( maSbCompression.GetThumbPos() ) );
[ # # ][ # # ]
264 : : }
265 : 0 : break;
266 : :
267 : : case FORMAT_PNG :
268 : : {
269 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), static_cast< sal_Int32 >( maSbCompression.GetThumbPos() ) );
[ # # ][ # # ]
270 : 0 : sal_Int32 nInterlace = 0;
271 [ # # ][ # # ]: 0 : if ( maCbInterlaced.IsChecked() )
272 : 0 : nInterlace++;
273 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), nInterlace );
[ # # ][ # # ]
274 : : }
275 : 0 : break;
276 : :
277 : : case FORMAT_BMP :
278 : : {
279 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ), maLbColorDepth.GetSelectEntryPos() + 1 );
[ # # ][ # # ]
[ # # ]
280 [ # # ][ # # ]: 0 : pFilterOptions->WriteBool( String( RTL_CONSTASCII_USTRINGPARAM( "RLE_Coding" ) ), maCbRLEEncoding.IsChecked() );
[ # # ][ # # ]
[ # # ]
281 : : }
282 : 0 : break;
283 : :
284 : : case FORMAT_GIF :
285 : : {
286 : 0 : sal_Int32 nValue = 0;
287 [ # # ][ # # ]: 0 : if ( maCbInterlaced.IsChecked() )
288 : 0 : nValue++;
289 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), nValue );
[ # # ][ # # ]
290 : :
291 : 0 : nValue = 0;
292 [ # # ][ # # ]: 0 : if ( maCbSaveTransparency.IsChecked() )
293 : 0 : nValue++;
294 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Translucent" ) ), nValue );
[ # # ][ # # ]
295 : : }
296 : 0 : break;
297 : :
298 : : case FORMAT_PBM :
299 : : case FORMAT_PGM :
300 : : case FORMAT_PPM :
301 : : {
302 : 0 : sal_Int32 nFormat = 0;
303 [ # # ]: 0 : if ( maRbText.IsChecked() )
304 : 0 : nFormat++;
305 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), nFormat );
[ # # ][ # # ]
306 : : }
307 : 0 : break;
308 : :
309 : : case FORMAT_EPS :
310 : : {
311 : 0 : sal_Int32 nCheck = 0;
312 [ # # ][ # # ]: 0 : if ( maCbEPSPreviewTIFF.IsChecked() )
313 : 0 : nCheck++;
314 [ # # ][ # # ]: 0 : if ( maCbEPSPreviewEPSI.IsChecked() )
315 : 0 : nCheck += 2;
316 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ), nCheck );
[ # # ][ # # ]
317 : :
318 : 0 : nCheck = 1;
319 [ # # ]: 0 : if ( maRbEPSLevel2.IsChecked() )
320 : 0 : nCheck++;
321 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), nCheck );
[ # # ][ # # ]
322 : :
323 : 0 : nCheck = 1;
324 [ # # ]: 0 : if ( maRbEPSColorFormat2.IsChecked() )
325 : 0 : nCheck++;
326 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ), nCheck );
[ # # ][ # # ]
327 : :
328 : 0 : nCheck = 1;
329 [ # # ]: 0 : if ( maRbEPSCompressionNone.IsChecked() )
330 : 0 : nCheck++;
331 [ # # ][ # # ]: 0 : pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ), nCheck );
[ # # ][ # # ]
332 : : }
333 : 0 : break;
334 : : }
335 : :
336 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aRet( pFilterOptions->GetFilterData() );
337 [ # # ]: 0 : if ( bUpdateConfig == sal_False )
338 [ # # ][ # # ]: 0 : delete pFilterOptions;
339 [ # # ][ # # ]: 0 : return aRet;
340 : : }
341 : :
342 : : //
343 : 0 : awt::Size ExportDialog::GetOriginalSize()
344 : : {
345 [ # # ]: 0 : basegfx::B2DRange aShapesRange;
346 : :
347 [ # # ]: 0 : if ( mxPage.is () )
348 : : {
349 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY );
350 [ # # ]: 0 : if ( xPagePropSet.is() )
351 : : {
352 : 0 : sal_Int32 nWidth = 0;
353 : 0 : sal_Int32 nHeight= 0;
354 : 0 : com::sun::star::uno::Any aAny;
355 [ # # ][ # # ]: 0 : aAny = xPagePropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) );
[ # # ]
356 : 0 : aAny >>= nWidth;
357 [ # # ][ # # ]: 0 : aAny = xPagePropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) );
[ # # ]
358 : 0 : aAny >>= nHeight;
359 [ # # ]: 0 : aShapesRange = basegfx::B2DRange( 0, 0, nWidth, nHeight );
360 : 0 : }
361 : : }
362 : : else
363 : : {
364 : : uno::Reference< graphic::XPrimitiveFactory2D > xPrimitiveFactory(
365 [ # # ][ # # ]: 0 : mxMgr->createInstance( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.graphic.PrimitiveFactory2D" ) ) ), uno::UNO_QUERY );
[ # # ][ # # ]
[ # # ][ # # ]
366 [ # # ]: 0 : if ( xPrimitiveFactory.is() )
367 : : {
368 [ # # ][ # # ]: 0 : basegfx::B2DHomMatrix aViewTransformation( Application::GetDefaultDevice()->GetViewTransformation() );
369 : 0 : com::sun::star::geometry::AffineMatrix2D aTransformation;
370 [ # # ]: 0 : aTransformation.m00 = aViewTransformation.get(0,0);
371 [ # # ]: 0 : aTransformation.m01 = aViewTransformation.get(0,1);
372 [ # # ]: 0 : aTransformation.m02 = aViewTransformation.get(0,2);
373 [ # # ]: 0 : aTransformation.m10 = aViewTransformation.get(1,0);
374 [ # # ]: 0 : aTransformation.m11 = aViewTransformation.get(1,1);
375 [ # # ]: 0 : aTransformation.m12 = aViewTransformation.get(1,2);
376 : :
377 [ # # ]: 0 : const rtl::OUString sViewTransformation( RTL_CONSTASCII_USTRINGPARAM( "ViewTransformation" ) );
378 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aViewInformation( 1 );
379 [ # # ][ # # ]: 0 : aViewInformation[ 0 ].Value <<= aTransformation;
380 [ # # ]: 0 : aViewInformation[ 0 ].Name = sViewTransformation;
381 : :
382 [ # # ]: 0 : if ( mxShape.is() )
383 [ # # ]: 0 : aShapesRange = GetShapeRangeForXShape( mxShape, xPrimitiveFactory, aViewInformation );
384 [ # # ]: 0 : else if ( mxShapes.is() )
385 : : {
386 [ # # ][ # # ]: 0 : const sal_Int32 nCount = mxShapes->getCount();
387 [ # # ]: 0 : for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
388 : : {
389 : 0 : uno::Reference< drawing::XShape > xShape;
390 [ # # ][ # # ]: 0 : mxShapes->getByIndex( nIndex ) >>= xShape;
[ # # ]
391 [ # # ][ # # ]: 0 : aShapesRange.expand( GetShapeRangeForXShape( xShape, xPrimitiveFactory, aViewInformation ) );
392 : 0 : }
393 [ # # ][ # # ]: 0 : }
394 : 0 : }
395 : : }
396 [ # # ][ # # ]: 0 : return awt::Size( static_cast<sal_Int32>(aShapesRange.getWidth()), static_cast<sal_Int32>(aShapesRange.getHeight()) );
397 : : }
398 : :
399 : 0 : void ExportDialog::GetGraphicSource()
400 : : {
401 [ # # ]: 0 : if ( mxSourceDocument.is() )
402 : : {
403 [ # # ]: 0 : uno::Reference< frame::XModel > xModel( mxSourceDocument, uno::UNO_QUERY );
404 [ # # ]: 0 : if ( xModel.is() )
405 : : {
406 [ # # ][ # # ]: 0 : uno::Reference< frame::XController > xController( xModel->getCurrentController() );
407 [ # # ]: 0 : if ( xController.is() )
408 : : {
409 [ # # ]: 0 : if ( mbExportSelection ) // check if there is a selection
410 : : {
411 [ # # ]: 0 : uno::Reference< view::XSelectionSupplier > xSelectionSupplier( xController, uno::UNO_QUERY );
412 [ # # ]: 0 : if ( xSelectionSupplier.is() )
413 : : {
414 [ # # ][ # # ]: 0 : uno::Any aAny( xSelectionSupplier->getSelection() );
415 [ # # ][ # # ]: 0 : if ( ! ( aAny >>= mxShapes ) )
416 [ # # ]: 0 : aAny >>= mxShape;
417 : 0 : }
418 : : }
419 [ # # ][ # # ]: 0 : if ( !mxShape.is() && !mxShapes.is() )
[ # # ]
420 : : {
421 [ # # ]: 0 : uno::Reference< drawing::XDrawView > xDrawView( xController, uno::UNO_QUERY );
422 [ # # ]: 0 : if ( xDrawView.is() )
423 : : {
424 [ # # ][ # # ]: 0 : uno::Reference< drawing::XDrawPage > xCurrentPage( xDrawView->getCurrentPage() );
425 [ # # ]: 0 : if ( xCurrentPage.is() )
426 : : {
427 [ # # ]: 0 : mxPage = xCurrentPage; // exporting whole page
428 : 0 : }
429 : 0 : }
430 : : }
431 : 0 : }
432 : 0 : }
433 : : }
434 : 0 : }
435 : :
436 : 0 : sal_Bool ExportDialog::GetGraphicStream()
437 : : {
438 : 0 : sal_Bool bRet = sal_False;
439 : :
440 [ # # ][ # # ]: 0 : if ( !IsTempExportAvailable() )
441 : : {
442 [ # # ][ # # ]: 0 : delete mpTempStream, mpTempStream = new SvMemoryStream();
[ # # ][ # # ]
443 [ # # ][ # # ]: 0 : maBitmap = Bitmap();
[ # # ]
444 : 0 : return bRet;
445 : : }
446 : :
447 : 0 : sal_Bool bRecreateOutputStream = mpTempStream->Tell() == 0;
448 : :
449 [ # # ][ # # ]: 0 : static uno::Sequence< beans::PropertyValue > aOldFilterData;
[ # # ][ # # ]
450 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aNewFilterData( GetFilterData( sal_False ) );
451 [ # # ][ # # ]: 0 : if ( aOldFilterData != aNewFilterData )
452 : : {
453 [ # # ]: 0 : aOldFilterData = aNewFilterData;
454 : 0 : bRecreateOutputStream = sal_True;
455 : : }
456 : : try
457 : : {
458 [ # # ]: 0 : if ( bRecreateOutputStream )
459 : : {
460 [ # # ][ # # ]: 0 : delete mpTempStream, mpTempStream = new SvMemoryStream();
[ # # ][ # # ]
461 [ # # ][ # # ]: 0 : maBitmap = Bitmap();
[ # # ]
462 : :
463 [ # # ][ # # ]: 0 : uno::Reference < io::XStream > xStream( new utl::OStreamWrapper( *mpTempStream ) );
[ # # ]
464 [ # # ][ # # ]: 0 : uno::Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() );
465 : :
466 : : uno::Reference< document::XExporter > xGraphicExporter(
467 [ # # ][ # # ]: 0 : mxMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicExportFilter") ) ), uno::UNO_QUERY_THROW );
[ # # ][ # # ]
468 [ # # ]: 0 : uno::Reference< document::XFilter > xFilter( xGraphicExporter, uno::UNO_QUERY_THROW );
469 : :
470 : 0 : sal_Int32 nProperties = 2;
471 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aFilterData( nProperties );
472 : :
473 : :
474 [ # # ]: 0 : rtl::OUString sFormat( maExt );
475 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aDescriptor( 3 );
476 [ # # ][ # # ]: 0 : aDescriptor[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OutputStream") );
477 [ # # ][ # # ]: 0 : aDescriptor[0].Value <<= xOutputStream;
478 [ # # ][ # # ]: 0 : aDescriptor[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FilterName") );
479 [ # # ][ # # ]: 0 : aDescriptor[1].Value <<= sFormat;
480 [ # # ][ # # ]: 0 : aDescriptor[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FilterData") );
481 [ # # ][ # # ]: 0 : aDescriptor[2].Value <<= aNewFilterData;
482 : :
483 : 0 : uno::Reference< lang::XComponent > xSourceDoc;
484 [ # # ]: 0 : if ( mxPage.is() )
485 [ # # ][ # # ]: 0 : xSourceDoc = uno::Reference< lang::XComponent >( mxPage, uno::UNO_QUERY_THROW );
486 [ # # ]: 0 : else if ( mxShapes.is() )
487 [ # # ][ # # ]: 0 : xSourceDoc = uno::Reference< lang::XComponent >( mxShapes, uno::UNO_QUERY_THROW );
488 [ # # ]: 0 : else if ( mxShape.is() )
489 [ # # ][ # # ]: 0 : xSourceDoc = uno::Reference< lang::XComponent >( mxShape, uno::UNO_QUERY_THROW );
490 [ # # ]: 0 : if ( xSourceDoc.is() )
491 : : {
492 [ # # ][ # # ]: 0 : xGraphicExporter->setSourceDocument( xSourceDoc );
493 [ # # ][ # # ]: 0 : xFilter->filter( aDescriptor );
494 : 0 : bRet = sal_True;
495 : :
496 [ # # ]: 0 : if ( mnFormat == FORMAT_JPG )
497 : : {
498 [ # # ]: 0 : mpTempStream->Seek( STREAM_SEEK_TO_BEGIN );
499 [ # # ][ # # ]: 0 : maBitmap = GetGraphicBitmap( *mpTempStream );
[ # # ]
500 [ # # ]: 0 : mpTempStream->Seek( STREAM_SEEK_TO_END );
501 : : }
502 [ # # ][ # # ]: 0 : }
[ # # ]
503 : : }
504 : : else
505 : 0 : bRet = sal_True;
506 : : }
507 [ # # ]: 0 : catch( uno::Exception& )
508 : : {
509 : :
510 : : // ups
511 : :
512 : : }
513 [ # # ]: 0 : return bRet;
514 : : }
515 : :
516 : 0 : Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream )
517 : : {
518 [ # # ]: 0 : Bitmap aRet;
519 [ # # ]: 0 : Graphic aGraphic;
520 [ # # ]: 0 : GraphicFilter aFilter( sal_False );
521 [ # # ][ # # ]: 0 : if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, static_cast<com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*>(NULL), NULL ) == GRFILTER_OK )
[ # # ][ # # ]
522 : : {
523 [ # # ][ # # ]: 0 : aRet = aGraphic.GetBitmap();
[ # # ]
524 : : }
525 [ # # ][ # # ]: 0 : return aRet;
526 : : }
527 : :
528 : 0 : sal_uInt32 ExportDialog::GetRawFileSize() const
529 : : {
530 : 0 : sal_uInt64 nRawFileSize = 0;
531 [ # # ]: 0 : if ( mbIsPixelFormat )
532 : : {
533 : 0 : sal_Int32 nBitsPerPixel = 24;
534 [ # # ]: 0 : String aEntry( maLbColorDepth.GetSelectEntry() );
535 [ # # ][ # # ]: 0 : if ( ms1BitTreshold == aEntry )
536 : 0 : nBitsPerPixel = 1;
537 [ # # ][ # # ]: 0 : else if ( ms1BitDithered == aEntry )
538 : 0 : nBitsPerPixel = 1;
539 [ # # ][ # # ]: 0 : else if ( ms4BitGrayscale == aEntry )
540 : 0 : nBitsPerPixel = 4;
541 [ # # ][ # # ]: 0 : else if ( ms4BitColorPalette == aEntry )
542 : 0 : nBitsPerPixel = 8;
543 [ # # ][ # # ]: 0 : else if ( ms8BitGrayscale == aEntry )
544 : 0 : nBitsPerPixel = 8;
545 [ # # ][ # # ]: 0 : else if ( ms8BitColorPalette == aEntry )
546 : 0 : nBitsPerPixel = 8;
547 [ # # ][ # # ]: 0 : else if ( ms24BitColor == aEntry )
548 : 0 : nBitsPerPixel = 24;
549 : :
550 [ # # ]: 0 : if ( mbIsPixelFormat )
551 : : {
552 : 0 : nRawFileSize = ( maSize.Width * nBitsPerPixel + 7 ) &~ 7; // rounding up to 8 bits
553 : 0 : nRawFileSize /= 8; // in bytes
554 : 0 : nRawFileSize *= maSize.Height;
555 : : }
556 [ # # ]: 0 : if ( nRawFileSize > SAL_MAX_UINT32 )
557 [ # # ]: 0 : nRawFileSize = 0;
558 : : }
559 : 0 : return static_cast< sal_uInt32 >( nRawFileSize );
560 : : }
561 : :
562 : : // checks if the source dimension/resolution is not too big
563 : : // to determine the exact graphic output size and preview for jpg
564 : 0 : sal_Bool ExportDialog::IsTempExportAvailable() const
565 : : {
566 : 0 : return GetRawFileSize() < static_cast< sal_uInt32 >( mnMaxFilesizeForRealtimePreview );
567 : : }
568 : :
569 : 0 : ExportDialog::ExportDialog( FltCallDialogParameter& rPara,
570 : : const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > rxMgr,
571 : : const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSourceDocument,
572 : : sal_Bool bExportSelection, sal_Bool bIsPixelFormat ) :
573 : : ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT, *rPara.pResMgr ) ),
574 : : mrFltCallPara ( rPara ),
575 : : mpMgr ( rPara.pResMgr ),
576 : : mxMgr ( rxMgr ),
577 : : mxSourceDocument ( rxSourceDocument ),
578 : : maFlExportSize ( this, ResId( FL_EXPORT_SIZE, *rPara.pResMgr ) ),
579 : : maFtSizeX ( this, ResId( FT_SIZEX, *rPara.pResMgr ) ),
580 : : maMfSizeX ( this, ResId( MF_SIZEX, *rPara.pResMgr ) ),
581 : : maLbSizeX ( this, ResId( LB_SIZEX, *rPara.pResMgr ) ),
582 : : maFtSizeY ( this, ResId( FT_SIZEY, *rPara.pResMgr ) ),
583 : : maMfSizeY ( this, ResId( MF_SIZEY, *rPara.pResMgr ) ),
584 : : maLbSizeY ( this, ResId( LB_SIZEY, *rPara.pResMgr ) ),
585 : : maFtResolution ( this, ResId( FT_RESOLUTION, *rPara.pResMgr ) ),
586 : : maNfResolution ( this, ResId( NF_RESOLUTION, *rPara.pResMgr ) ),
587 : : maLbResolution ( this, ResId( LB_RESOLUTION, *rPara.pResMgr ) ),
588 : : maFlColorDepth ( this, ResId( FL_COLOR_DEPTH, *rPara.pResMgr ) ),
589 : : maLbColorDepth ( this, ResId( LB_COLOR_DEPTH, *rPara.pResMgr ) ),
590 : : maFlJPGQuality ( this, ResId( FL_JPG_QUALITY, *rPara.pResMgr ) ),
591 : : maFlMode ( this, ResId( FL_MODE, *rPara.pResMgr ) ),
592 : : maFlPBMOptions ( this, ResId( FL_PBM_OPTIONS, *rPara.pResMgr ) ),
593 : : maSbCompression ( this, ResId( SB_COMPRESSION, *rPara.pResMgr ) ),
594 : : maNfCompression ( this, ResId( NF_COMPRESSION, *rPara.pResMgr ) ),
595 : : maFtJPGMin ( this, ResId( FT_JPG_MIN, *rPara.pResMgr ) ),
596 : : maFtJPGMax ( this, ResId( FT_JPG_MAX, *rPara.pResMgr ) ),
597 : : maFtPNGMin ( this, ResId( FT_PNG_MIN, *rPara.pResMgr ) ),
598 : : maFtPNGMax ( this, ResId( FT_PNG_MAX, *rPara.pResMgr ) ),
599 : : maCbJPGPreview ( this, ResId( CB_JPG_PREVIEW, *rPara.pResMgr ) ),
600 : : maCbInterlaced ( this, ResId( CB_INTERLACED, *rPara.pResMgr ) ),
601 : : maCbRLEEncoding ( this, ResId( CB_RLE_ENCODING, *rPara.pResMgr ) ),
602 : : maFlGIFDrawingObjects ( this, ResId( FL_GIF_DRAWING_OBJECTS, *rPara.pResMgr ) ),
603 : : maCbSaveTransparency ( this, ResId( CB_SAVE_TRANSPARENCY, *rPara.pResMgr ) ),
604 : : maRbBinary ( this, ResId( RB_BINARY, *rPara.pResMgr ) ),
605 : : maRbText ( this, ResId( RB_TEXT, *rPara.pResMgr ) ),
606 : : maFlEPSPreview ( this, ResId( FL_EPS_PREVIEW, *rPara.pResMgr ) ),
607 : : maCbEPSPreviewTIFF ( this, ResId( CB_EPS_PREVIEW_TIFF, *rPara.pResMgr ) ),
608 : : maCbEPSPreviewEPSI ( this, ResId( CB_EPS_PREVIEW_EPSI, *rPara.pResMgr ) ),
609 : : maFlEPSVersion ( this, ResId( FL_EPS_VERSION, *rPara.pResMgr ) ),
610 : : maRbEPSLevel1 ( this, ResId( RB_EPS_LEVEL1, *rPara.pResMgr ) ),
611 : : maRbEPSLevel2 ( this, ResId( RB_EPS_LEVEL2, *rPara.pResMgr ) ),
612 : : maFlEPSColorFormat ( this, ResId( FL_EPS_COLOR_FORMAT, *rPara.pResMgr ) ),
613 : : maRbEPSColorFormat1 ( this, ResId( RB_EPS_COLOR_FORMAT1, *rPara.pResMgr ) ),
614 : : maRbEPSColorFormat2 ( this, ResId( RB_EPS_COLOR_FORMAT2, *rPara.pResMgr ) ),
615 : : maFlCompression ( this, ResId( FL_COMPRESSION, *rPara.pResMgr ) ),
616 : : maRbEPSCompressionLZW ( this, ResId( RB_EPS_COMPRESSION_LZW, *rPara.pResMgr ) ),
617 : : maRbEPSCompressionNone ( this, ResId( RB_EPS_COMPRESSION_NONE, *rPara.pResMgr ) ),
618 : : maFlEstimatedSize ( this, ResId( FL_ESTIMATED_SIZE, *rPara.pResMgr ) ),
619 : : maFtEstimatedSize ( this, ResId( FT_ESTIMATED_SIZE, *rPara.pResMgr ) ),
620 : : msEstimatedSizePix1 ( ResId( STR_ESTIMATED_SIZE_PIX_1, *rPara.pResMgr ).toString() ),
621 : : msEstimatedSizePix2 ( ResId( STR_ESTIMATED_SIZE_PIX_2, *rPara.pResMgr ).toString() ),
622 : : msEstimatedSizeVec ( ResId( STR_ESTIMATED_SIZE_VEC, *rPara.pResMgr ).toString() ),
623 : : maFlButtons ( this, ResId( FL_BUTTONS, *rPara.pResMgr ) ),
624 : : maFbJPGPreview ( this, ResId( FB_JPG_PREVIEW, *rPara.pResMgr ) ),
625 : : maSbZoom ( this, ResId( SB_ZOOM, *rPara.pResMgr ) ),
626 : : maNfZoom ( this, ResId( NF_ZOOM, *rPara.pResMgr ) ),
627 : : maSbJPGPreviewHorz ( this, ResId( SB_JPG_PREVIEW_HORZ, *rPara.pResMgr ) ),
628 : : maSbJPGPreviewVert ( this, ResId( SB_JPG_PREVIEW_VERT, *rPara.pResMgr ) ),
629 : : maBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ),
630 : : maBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ),
631 : : maBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ),
632 : : ms1BitTreshold ( ResId( STR_1BIT_THRESHOLD, *rPara.pResMgr ).toString() ),
633 : : ms1BitDithered ( ResId( STR_1BIT_DITHERED, *rPara.pResMgr ).toString() ),
634 : : ms4BitGrayscale ( ResId( STR_4BIT_GRAYSCALE, *rPara.pResMgr ).toString() ),
635 : : ms4BitColorPalette ( ResId( STR_4BIT_COLOR_PALETTE, *rPara.pResMgr ).toString() ),
636 : : ms8BitGrayscale ( ResId( STR_8BIT_GRAYSCALE, *rPara.pResMgr ).toString() ),
637 : : ms8BitColorPalette ( ResId( STR_8BIT_COLOR_PALETTE, *rPara.pResMgr ).toString() ),
638 : : ms24BitColor ( ResId( STR_24BIT_TRUE_COLOR, *rPara.pResMgr ).toString() ),
639 : : maExt ( rPara.aFilterExt ),
640 : : mnFormat ( FORMAT_UNKNOWN ),
641 : : mnMaxFilesizeForRealtimePreview( 0 ),
642 : 0 : mpTempStream ( new SvMemoryStream() ),
643 : : maOriginalSize ( awt::Size( 0, 0 ) ),
644 : : mbPreview ( sal_False ),
645 : : mbIsPixelFormat ( bIsPixelFormat ),
646 : : mbExportSelection ( bExportSelection ),
647 [ # # ][ # # ]: 0 : mbPreserveAspectRatio ( sal_True )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
648 : : {
649 [ # # ]: 0 : GetGraphicSource();
650 : :
651 [ # # ]: 0 : maExt.ToUpperAscii();
652 : :
653 [ # # ]: 0 : String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/" ) );
654 [ # # ][ # # ]: 0 : mpOptionsItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
[ # # ]
655 [ # # ]: 0 : aFilterConfigPath.Append( maExt );
656 [ # # ][ # # ]: 0 : mpFilterOptionsItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
[ # # ]
657 : :
658 : : mnInitialResolutionUnit = mbIsPixelFormat
659 [ # # ][ # # ]: 0 : ? mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportUnit" ) ), UNIT_DEFAULT )
[ # # ][ # # ]
[ # # ]
[ # # # # ]
660 [ # # ][ # # ]: 0 : : mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "VectorExportUnit" ) ), UNIT_DEFAULT );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
[ # # # # ]
[ # # ]
661 : :
662 [ # # ][ # # ]: 0 : mnMaxFilesizeForRealtimePreview = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "MaxFilesizeForRealtimePreview" ) ), 0 );
[ # # ][ # # ]
663 [ # # ][ # # ]: 0 : maFtEstimatedSize.SetText( String( RTL_CONSTASCII_USTRINGPARAM( " \n " ) ) );
[ # # ]
664 : :
665 [ # # ]: 0 : String aTitle( maExt );
666 [ # # ][ # # ]: 0 : aTitle += ResId(DLG_EXPORT_TITLE, *mpMgr).toString();
667 [ # # ]: 0 : SetText( aTitle );
668 : :
669 [ # # ][ # # ]: 0 : mnFormat = GetFilterFormat( maExt );
670 : :
671 [ # # ][ # # ]: 0 : Size aResolution( Application::GetDefaultDevice()->LogicToPixel( Size( 100, 100 ), MAP_CM ) );
[ # # ][ # # ]
672 : 0 : maResolution.Width = aResolution.Width();
673 : 0 : maResolution.Height= aResolution.Height();
674 [ # # ]: 0 : maOriginalSize = GetOriginalSize();
675 [ # # ]: 0 : if ( bIsPixelFormat )
676 : : {
677 : 0 : double fPixelsPer100thmm = static_cast< double >( maResolution.Width ) / 100000.0;
678 : : maSize = awt::Size( static_cast< sal_Int32 >( ( fPixelsPer100thmm * maOriginalSize.Width ) + 0.5 ),
679 : 0 : static_cast< sal_Int32 >( ( fPixelsPer100thmm * maOriginalSize.Height ) + 0.5 ) );
680 : : }
681 : : else
682 : : {
683 : 0 : maSize = maOriginalSize;
684 : : }
685 : :
686 : : // Size
687 [ # # ]: 0 : maLbSizeX.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) );
688 : :
689 [ # # ]: 0 : maSbCompression.SetScrollHdl( LINK( this, ExportDialog, SbCompressionUpdateHdl ) );
690 [ # # ]: 0 : maNfCompression.SetModifyHdl( LINK( this, ExportDialog, UpdateHdl ) );
691 : :
692 [ # # ]: 0 : maMfSizeX.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlMtfSizeX ) );
693 [ # # ]: 0 : maMfSizeY.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlMtfSizeY ) );
694 : :
695 [ # # ]: 0 : maNfResolution.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlNfResolution ) );
696 [ # # ]: 0 : maLbResolution.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) );
697 : :
698 [ # # ]: 0 : maLbColorDepth.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) );
699 : :
700 [ # # ]: 0 : maCbInterlaced.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
701 : :
702 [ # # ]: 0 : maCbSaveTransparency.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
703 : :
704 [ # # ]: 0 : maCbEPSPreviewTIFF.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
705 [ # # ]: 0 : maCbEPSPreviewEPSI.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
706 : :
707 [ # # ]: 0 : maRbEPSCompressionLZW.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
708 [ # # ]: 0 : maRbEPSCompressionNone.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
709 : :
710 [ # # ]: 0 : maRbBinary.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
711 [ # # ]: 0 : maRbText.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
712 : :
713 : :
714 : : // JPG Preview
715 : : // maCbJPGPreview.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
716 [ # # ]: 0 : maCbJPGPreview.Enable( sal_False );
717 : :
718 [ # # ]: 0 : maSbJPGPreviewVert.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) );
719 [ # # ]: 0 : maSbJPGPreviewHorz.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) );
720 [ # # ]: 0 : maSbZoom.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) );
721 : :
722 : : // BMP
723 [ # # ]: 0 : maCbRLEEncoding.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
724 : :
725 : : // EPS
726 [ # # ]: 0 : maRbEPSLevel1.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
727 [ # # ]: 0 : maRbEPSLevel2.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) );
728 : :
729 [ # # ]: 0 : maBtnOK.SetClickHdl( LINK( this, ExportDialog, OK ) );
730 : :
731 [ # # ]: 0 : setupLayout();
732 [ # # ]: 0 : updateControls();
733 : :
734 [ # # ][ # # ]: 0 : FreeResource();
[ # # ]
735 : 0 : }
736 : :
737 : 0 : void ExportDialog::createSizeControls( vcl::RowOrColumn& rLayout )
738 : : {
739 : : size_t nIndex;
740 [ # # ][ # # ]: 0 : Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
[ # # ]
741 : 0 : long nIndent = aBorder.Width();
742 : :
743 : : // Size controls
744 [ # # ]: 0 : rLayout.addWindow( &maFlExportSize );
745 : :
746 [ # # ]: 0 : Size aLbMax( maLbSizeX.GetSizePixel() );
747 [ # # ]: 0 : aLbMax.Width() = Max( aLbMax.Width(), maLbResolution.GetSizePixel().Width() );
748 : :
749 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::LabelColumn > xSizeColumns( new vcl::LabelColumn( &rLayout ) );
[ # # ]
750 [ # # ][ # # ]: 0 : rLayout.addChild( xSizeColumns );
[ # # ]
751 : :
752 : : // row 1
753 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xColumn( new vcl::RowOrColumn( xSizeColumns.get(), false ) );
[ # # ]
754 [ # # ][ # # ]: 0 : xSizeColumns->addRow( &maFtSizeX, xColumn, nIndent );
[ # # ]
755 [ # # ]: 0 : Size aMinSize( maMfSizeX.GetSizePixel() );
756 [ # # ]: 0 : nIndex = xColumn->addWindow( &maMfSizeX );
757 [ # # ]: 0 : xColumn->setMinimumSize( nIndex, aMinSize );
758 [ # # ]: 0 : nIndex = xColumn->addWindow( &maLbSizeX );
759 [ # # ]: 0 : xColumn->setMinimumSize( nIndex, aLbMax );
760 : :
761 : : // row 2
762 [ # # ][ # # ]: 0 : xColumn = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xSizeColumns.get(), false ) );
[ # # ][ # # ]
[ # # ]
763 [ # # ][ # # ]: 0 : xSizeColumns->addRow( &maFtSizeY, xColumn, nIndent );
[ # # ]
764 [ # # ]: 0 : nIndex = xColumn->addWindow( &maMfSizeY );
765 [ # # ]: 0 : xColumn->setMinimumSize( nIndex, aMinSize );
766 [ # # ]: 0 : nIndex = xColumn->addWindow( &maLbSizeY );
767 [ # # ]: 0 : xColumn->setMinimumSize( nIndex, aLbMax );
768 : :
769 : : // row 3
770 [ # # ]: 0 : if ( mbIsPixelFormat ) // TODO: (metafileresolutionsupport)
771 : : {
772 [ # # ][ # # ]: 0 : xColumn = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xSizeColumns.get(), false ) );
[ # # ][ # # ]
[ # # ]
773 [ # # ][ # # ]: 0 : xSizeColumns->addRow( &maFtResolution, xColumn, nIndent );
[ # # ]
774 [ # # ]: 0 : nIndex = xColumn->addWindow( &maNfResolution );
775 [ # # ]: 0 : xColumn->setMinimumSize( nIndex, aMinSize );
776 [ # # ]: 0 : nIndex = xColumn->addWindow( &maLbResolution );
777 [ # # ]: 0 : xColumn->setMinimumSize( nIndex, aLbMax );
778 : : }
779 : :
780 : 0 : sal_Int32 nUnit = mnInitialResolutionUnit;
781 [ # # ]: 0 : if ( nUnit == UNIT_DEFAULT )
782 : 0 : nUnit = GetDefaultUnit();
783 : :
784 [ # # ]: 0 : if ( !mbIsPixelFormat )
785 : : {
786 [ # # ]: 0 : maLbSizeX.RemoveEntry( UNIT_PIXEL ); // removing pixel
787 [ # # ]: 0 : if ( nUnit >= UNIT_PIXEL )
788 : 0 : nUnit = UNIT_CM;
789 : : }
790 [ # # ]: 0 : else if ( nUnit > UNIT_MAX_ID )
791 : 0 : nUnit = UNIT_PIXEL;
792 [ # # ]: 0 : if ( nUnit < 0 )
793 : 0 : nUnit = UNIT_CM;
794 [ # # ]: 0 : maLbSizeX.SelectEntryPos( static_cast< sal_uInt16 >( nUnit ) );
795 : :
796 [ # # ]: 0 : if ( mbIsPixelFormat ) // TODO: (metafileresolutionsupport) should be supported for vector formats also... this makes
797 : : { // sense eg for bitmap fillings in metafiles, to preserve high dpi output
798 : : // (atm without special vector support the bitmaps are rendered with 96dpi)
799 [ # # ][ # # ]: 0 : sal_Int32 nResolution = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolution" ) ), 96 );
[ # # ][ # # ]
800 [ # # ]: 0 : if ( nResolution < 1 )
801 : 0 : nResolution = 96;
802 [ # # ]: 0 : maNfResolution.SetValue( nResolution );
803 : :
804 [ # # ][ # # ]: 0 : sal_Int32 nResolutionUnit = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolutionUnit" ) ), 1 );
[ # # ][ # # ]
805 [ # # ][ # # ]: 0 : if ( ( nResolutionUnit < 0 ) || ( nResolutionUnit > 2 ) )
806 : 0 : nResolutionUnit = 1;
807 [ # # ]: 0 : maLbResolution.SelectEntryPos( static_cast< sal_uInt16 >( nResolutionUnit ) );
808 : : }
809 : :
810 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) );
[ # # ]
811 [ # # ][ # # ]: 0 : rLayout.addChild( xSpacer );
[ # # ][ # # ]
[ # # ][ # # ]
812 : 0 : }
813 : :
814 : 0 : void ExportDialog::createColorDepthControls( vcl::RowOrColumn& rLayout )
815 : : {
816 : : // Color Depth
817 [ # # ][ # # ]: 0 : Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
[ # # ]
818 : 0 : long nIndent = aBorder.Width();
819 : :
820 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &rLayout, false ) );
[ # # ]
821 [ # # ][ # # ]: 0 : rLayout.addChild( xRow );
[ # # ]
822 [ # # ]: 0 : xRow->addWindow( &maFlColorDepth );
823 : :
824 [ # # ][ # # ]: 0 : xRow = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( &rLayout, false ) );
[ # # ][ # # ]
[ # # ]
825 [ # # ][ # # ]: 0 : rLayout.addChild( xRow );
[ # # ]
826 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) );
[ # # ]
827 [ # # ][ # # ]: 0 : xRow->addChild( xIndenter );
[ # # ]
828 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) );
[ # # ]
829 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
830 [ # # ]: 0 : xRows->addWindow( &maLbColorDepth );
831 : :
832 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) );
[ # # ]
833 [ # # ][ # # ]: 0 : rLayout.addChild( xSpacer );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
834 : 0 : }
835 : :
836 : 0 : void ExportDialog::createScrollBar( vcl::RowOrColumn& rLayout )
837 : : {
838 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &rLayout, false ) );
[ # # ]
839 [ # # ][ # # ]: 0 : rLayout.addChild( xRow );
[ # # ]
840 : :
841 [ # # ]: 0 : Size aMinSize( maSbCompression.GetSizePixel() );
842 [ # # ]: 0 : size_t nIndex = xRow->addWindow( &maSbCompression );
843 [ # # ]: 0 : xRow->setMinimumSize( nIndex, aMinSize );
844 [ # # ]: 0 : aMinSize = maNfCompression.GetSizePixel();
845 [ # # ]: 0 : nIndex = xRow->addWindow( &maNfCompression );
846 [ # # ][ # # ]: 0 : xRow->setMinimumSize( nIndex, aMinSize );
847 : 0 : }
848 : :
849 : 0 : void ExportDialog::createFilterOptions( vcl::RowOrColumn& rLayout )
850 : : {
851 [ # # ][ # # ]: 0 : Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
[ # # ]
852 : 0 : long nIndent = aBorder.Width();
853 : :
854 [ # # # # : 0 : switch( mnFormat )
# # # ]
855 : : {
856 : : case FORMAT_JPG :
857 : : {
858 [ # # ][ # # ]: 0 : sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), 0 );
[ # # ][ # # ]
859 [ # # ]: 0 : if ( nColor == 1 )
860 : 0 : nColor = 0;
861 : : else
862 : 0 : nColor = 1;
863 [ # # ]: 0 : maLbColorDepth.InsertEntry( ms8BitGrayscale );
864 [ # # ]: 0 : maLbColorDepth.InsertEntry( ms24BitColor );
865 [ # # ]: 0 : maLbColorDepth.SelectEntryPos( nColor );
866 [ # # ]: 0 : createColorDepthControls( maLayout );
867 : :
868 [ # # ]: 0 : rLayout.addWindow( &maFlJPGQuality );
869 : :
870 : : // Quality
871 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) );
[ # # ]
872 [ # # ][ # # ]: 0 : rLayout.addChild( xIndenter );
[ # # ]
873 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) );
[ # # ]
874 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
875 [ # # ]: 0 : createScrollBar( *xRows.get() );
876 [ # # ]: 0 : xRows->addWindow( &maFtJPGMin );
877 [ # # ]: 0 : xRows->addWindow( &maFtJPGMax );
878 [ # # ][ # # ]: 0 : if ( maCbJPGPreview.IsEnabled() )
879 [ # # ]: 0 : xRows->addWindow( &maCbJPGPreview );
880 : :
881 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) );
[ # # ]
882 [ # # ][ # # ]: 0 : rLayout.addChild( xSpacer );
[ # # ]
883 : :
884 [ # # ][ # # ]: 0 : sal_Int32 nQuality = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 75 );
[ # # ][ # # ]
885 [ # # ][ # # ]: 0 : if ( ( nQuality < 1 ) || ( nQuality > 100 ) )
886 : 0 : nQuality = 75;
887 : :
888 [ # # ]: 0 : maSbCompression.SetRangeMin( 1 );
889 [ # # ]: 0 : maSbCompression.SetRangeMax( 100 );
890 [ # # ]: 0 : maNfCompression.SetMin( 1 );
891 [ # # ]: 0 : maNfCompression.SetMax( 100 );
892 [ # # ]: 0 : maNfCompression.SetValue( nQuality );
893 [ # # ]: 0 : maNfCompression.SetStrictFormat( sal_True );
894 [ # # ][ # # ]: 0 : if ( maCbJPGPreview.IsEnabled() )
895 [ # # ][ # # ]: 0 : maCbJPGPreview.Check( sal_False );
[ # # ][ # # ]
896 : : }
897 : 0 : break;
898 : : case FORMAT_PNG :
899 : : {
900 [ # # ]: 0 : rLayout.addWindow( &maFlCompression );
901 : :
902 : : // Compression 1..9
903 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) );
[ # # ]
904 [ # # ][ # # ]: 0 : rLayout.addChild( xIndenter );
[ # # ]
905 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) );
[ # # ]
906 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
907 [ # # ]: 0 : createScrollBar( *xRows.get() );
908 [ # # ]: 0 : xRows->addWindow( &maFtPNGMin );
909 [ # # ]: 0 : xRows->addWindow( &maFtPNGMax );
910 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) );
[ # # ]
911 [ # # ][ # # ]: 0 : rLayout.addChild( xSpacer );
[ # # ]
912 : :
913 : : // Interlaced
914 [ # # ]: 0 : rLayout.addWindow( &maFlMode );
915 [ # # ][ # # ]: 0 : xIndenter.reset( new vcl::Indenter( &rLayout, nIndent ) );
[ # # ]
916 [ # # ][ # # ]: 0 : rLayout.addChild( xIndenter );
[ # # ]
917 [ # # ][ # # ]: 0 : xRows.reset( new vcl::RowOrColumn( &rLayout, true ) );
[ # # ]
918 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
919 [ # # ]: 0 : xRows->addWindow( &maCbInterlaced );
920 : :
921 [ # # ][ # # ]: 0 : xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) );
[ # # ]
922 [ # # ][ # # ]: 0 : rLayout.addChild( xSpacer );
[ # # ]
923 : :
924 [ # # ][ # # ]: 0 : sal_Int32 nCompression = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), 6 );
[ # # ][ # # ]
925 [ # # ][ # # ]: 0 : if ( ( nCompression < 1 ) || ( nCompression > 9 ) )
926 : 0 : nCompression = 6;
927 [ # # ]: 0 : maSbCompression.SetRangeMin( 1 );
928 [ # # ]: 0 : maSbCompression.SetRangeMax( 9 );
929 [ # # ]: 0 : maNfCompression.SetMin( 1 );
930 [ # # ]: 0 : maNfCompression.SetMax( 9 );
931 [ # # ]: 0 : maNfCompression.SetValue( 9 );
932 [ # # ]: 0 : maNfCompression.SetStrictFormat( sal_True );
933 : :
934 [ # # ][ # # ]: 0 : maCbInterlaced.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 0 ) != 0 );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
935 : : }
936 : 0 : break;
937 : : case FORMAT_BMP :
938 : : {
939 [ # # ][ # # ]: 0 : sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ), 0 );
[ # # ][ # # ]
940 [ # # ]: 0 : if ( nColor == 0 )
941 : 0 : nColor = 6;
942 : : else
943 : 0 : nColor--;
944 [ # # ]: 0 : maLbColorDepth.InsertEntry( ms1BitTreshold );
945 [ # # ]: 0 : maLbColorDepth.InsertEntry( ms1BitDithered );
946 [ # # ]: 0 : maLbColorDepth.InsertEntry( ms4BitGrayscale );
947 [ # # ]: 0 : maLbColorDepth.InsertEntry( ms4BitColorPalette );
948 [ # # ]: 0 : maLbColorDepth.InsertEntry( ms8BitGrayscale );
949 [ # # ]: 0 : maLbColorDepth.InsertEntry( ms8BitColorPalette );
950 [ # # ]: 0 : maLbColorDepth.InsertEntry( ms24BitColor );
951 [ # # ]: 0 : maLbColorDepth.SelectEntryPos( nColor );
952 [ # # ]: 0 : createColorDepthControls( maLayout );
953 : :
954 [ # # ]: 0 : rLayout.addWindow( &maFlCompression );
955 : : // RLE coding
956 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) );
[ # # ]
957 [ # # ][ # # ]: 0 : rLayout.addChild( xIndenter );
[ # # ]
958 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) );
[ # # ]
959 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
960 [ # # ]: 0 : xRows->addWindow( &maCbRLEEncoding );
961 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) );
[ # # ]
962 [ # # ][ # # ]: 0 : rLayout.addChild( xSpacer );
[ # # ]
963 : :
964 [ # # ][ # # ]: 0 : maCbRLEEncoding.Check( mpFilterOptionsItem->ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "RLE_Coding" ) ), sal_True ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
965 : : }
966 : 0 : break;
967 : : case FORMAT_GIF :
968 : : {
969 [ # # ]: 0 : rLayout.addWindow( &maFlMode );
970 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) );
[ # # ]
971 [ # # ][ # # ]: 0 : rLayout.addChild( xIndenter );
[ # # ]
972 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) );
[ # # ]
973 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
974 [ # # ]: 0 : xRows->addWindow( &maCbInterlaced );
975 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) );
[ # # ]
976 [ # # ][ # # ]: 0 : rLayout.addChild( xSpacer );
[ # # ]
977 : :
978 [ # # ]: 0 : rLayout.addWindow( &maFlGIFDrawingObjects );
979 [ # # ][ # # ]: 0 : xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( &rLayout, nIndent ) );
[ # # ][ # # ]
[ # # ]
980 [ # # ][ # # ]: 0 : rLayout.addChild( xIndenter );
[ # # ]
981 [ # # ][ # # ]: 0 : xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( &rLayout, true ) );
[ # # ][ # # ]
[ # # ]
982 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
983 [ # # ]: 0 : xRows->addWindow( &maCbSaveTransparency );
984 [ # # ][ # # ]: 0 : xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) );
[ # # ]
985 [ # # ][ # # ]: 0 : rLayout.addChild( xSpacer );
[ # # ]
986 : :
987 [ # # ][ # # ]: 0 : maCbInterlaced.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 1 ) != 0 );
[ # # ][ # # ]
[ # # ]
988 [ # # ][ # # ]: 0 : maCbSaveTransparency.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Translucent" ) ), 1 ) != 0 );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
989 : : }
990 : 0 : break;
991 : : case FORMAT_PBM :
992 : : case FORMAT_PGM :
993 : : case FORMAT_PPM :
994 : : {
995 [ # # ]: 0 : rLayout.addWindow( &maFlJPGQuality );
996 : :
997 : : // RB Binary / Text
998 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) );
[ # # ]
999 [ # # ][ # # ]: 0 : rLayout.addChild( xIndenter );
[ # # ]
1000 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) );
[ # # ]
1001 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
1002 [ # # ]: 0 : xRows->addWindow( &maRbBinary );
1003 [ # # ]: 0 : xRows->addWindow( &maRbText );
1004 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) );
[ # # ]
1005 [ # # ][ # # ]: 0 : rLayout.addChild( xSpacer );
[ # # ]
1006 : :
1007 [ # # ][ # # ]: 0 : sal_Int32 nFormat = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 1 );
[ # # ][ # # ]
1008 [ # # ]: 0 : maRbBinary.Check( nFormat == 0 );
1009 [ # # ][ # # ]: 0 : maRbText.Check( nFormat != 0 );
[ # # ][ # # ]
1010 : : }
1011 : 0 : break;
1012 : : case FORMAT_EPS :
1013 : : {
1014 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xColumns( new vcl::RowOrColumn( &rLayout, false ) );
[ # # ]
1015 [ # # ][ # # ]: 0 : rLayout.addChild( xColumns );
[ # # ]
1016 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xLeft( new vcl::RowOrColumn( &rLayout, true ) );
[ # # ]
1017 [ # # ][ # # ]: 0 : xColumns->addChild( xLeft );
[ # # ]
1018 : :
1019 [ # # ]: 0 : xLeft->addWindow( &maFlEPSPreview );
1020 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( xLeft.get(), nIndent ) );
[ # # ]
1021 [ # # ][ # # ]: 0 : xLeft->addChild( xIndenter );
[ # # ]
1022 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( xLeft.get(), true ) );
[ # # ]
1023 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
1024 [ # # ]: 0 : xRows->addWindow( &maCbEPSPreviewTIFF );
1025 [ # # ]: 0 : xRows->addWindow( &maCbEPSPreviewEPSI );
1026 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( xLeft.get(), 2 ) );
[ # # ]
1027 [ # # ][ # # ]: 0 : xLeft->addChild( xSpacer );
[ # # ]
1028 : :
1029 [ # # ]: 0 : xLeft->addWindow( &maFlEPSVersion );
1030 [ # # ][ # # ]: 0 : xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xLeft.get(), nIndent ) );
[ # # ][ # # ]
[ # # ]
1031 [ # # ][ # # ]: 0 : xLeft->addChild( xIndenter );
[ # # ]
1032 [ # # ][ # # ]: 0 : xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xLeft.get(), true ) );
[ # # ][ # # ]
[ # # ]
1033 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
1034 [ # # ]: 0 : xRows->addWindow( &maRbEPSLevel1 );
1035 [ # # ]: 0 : xRows->addWindow( &maRbEPSLevel2 );
1036 [ # # ][ # # ]: 0 : xSpacer.reset( new vcl::Spacer( xLeft.get(), 2 ) );
[ # # ]
1037 [ # # ][ # # ]: 0 : xLeft->addChild( xSpacer );
[ # # ]
1038 : :
1039 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xRight( new vcl::RowOrColumn( &rLayout, true ) );
[ # # ]
1040 [ # # ][ # # ]: 0 : xColumns->addChild( xRight );
[ # # ]
1041 : :
1042 [ # # ]: 0 : xRight->addWindow( &maFlEPSColorFormat );
1043 [ # # ][ # # ]: 0 : xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xRight.get(), nIndent ) );
[ # # ][ # # ]
[ # # ]
1044 [ # # ][ # # ]: 0 : xRight->addChild( xIndenter );
[ # # ]
1045 [ # # ][ # # ]: 0 : xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xRight.get(), true ) );
[ # # ][ # # ]
[ # # ]
1046 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
1047 [ # # ]: 0 : xRows->addWindow( &maRbEPSColorFormat1 );
1048 [ # # ]: 0 : xRows->addWindow( &maRbEPSColorFormat2 );
1049 [ # # ][ # # ]: 0 : xSpacer.reset( new vcl::Spacer( xRight.get(), 2 ) );
[ # # ]
1050 [ # # ][ # # ]: 0 : xRight->addChild( xSpacer );
[ # # ]
1051 : :
1052 [ # # ]: 0 : xRight->addWindow( &maFlCompression );
1053 [ # # ][ # # ]: 0 : xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xRight.get(), nIndent ) );
[ # # ][ # # ]
[ # # ]
1054 [ # # ][ # # ]: 0 : xRight->addChild( xIndenter );
[ # # ]
1055 [ # # ][ # # ]: 0 : xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xRight.get(), true ) );
[ # # ][ # # ]
[ # # ]
1056 [ # # ][ # # ]: 0 : xIndenter->setChild( xRows );
[ # # ]
1057 [ # # ]: 0 : xRows->addWindow( &maRbEPSCompressionLZW );
1058 [ # # ]: 0 : xRows->addWindow( &maRbEPSCompressionNone );
1059 : :
1060 [ # # ][ # # ]: 0 : xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) );
[ # # ]
1061 [ # # ][ # # ]: 0 : rLayout.addChild( xSpacer );
[ # # ]
1062 : :
1063 [ # # ][ # # ]: 0 : sal_Int32 nPreview = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ), 0 );
[ # # ][ # # ]
1064 [ # # ][ # # ]: 0 : sal_Int32 nVersion = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), 2 );
[ # # ][ # # ]
1065 [ # # ][ # # ]: 0 : sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ), 0 );
[ # # ][ # # ]
1066 [ # # ][ # # ]: 0 : sal_Int32 nCompr = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ), 2 );
[ # # ][ # # ]
1067 : :
1068 [ # # ][ # # ]: 0 : mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "TextMode" ) ), 0 );
[ # # ][ # # ]
1069 : :
1070 [ # # ]: 0 : maCbEPSPreviewTIFF.Check( ( nPreview & 1 ) != 0 );
1071 [ # # ]: 0 : maCbEPSPreviewEPSI.Check( ( nPreview & 2 ) != 0 );
1072 : :
1073 [ # # ]: 0 : maRbEPSLevel1.Check( nVersion == 1 );
1074 [ # # ]: 0 : maRbEPSLevel2.Check( nVersion == 2 );
1075 : :
1076 [ # # ]: 0 : maRbEPSColorFormat1.Check( nColor == 1 );
1077 [ # # ]: 0 : maRbEPSColorFormat2.Check( nColor != 1 );
1078 : :
1079 [ # # ]: 0 : maRbEPSCompressionLZW.Check( nCompr == 1 );
1080 [ # # ][ # # ]: 0 : maRbEPSCompressionNone.Check( nCompr != 1 );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1081 : : }
1082 : 0 : break;
1083 : : }
1084 : 0 : }
1085 : :
1086 : 0 : void ExportDialog::createButtons( vcl::RowOrColumn& rLayout )
1087 : : {
1088 [ # # ]: 0 : rLayout.addWindow( &maFlButtons );
1089 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) );
[ # # ]
1090 [ # # ][ # # ]: 0 : rLayout.addChild( xSpacer );
[ # # ]
1091 : :
1092 [ # # ][ # # ]: 0 : Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
[ # # ]
1093 : :
1094 [ # # ][ # # ]: 0 : boost::shared_ptr< vcl::RowOrColumn > xButtons( new vcl::RowOrColumn( &rLayout, false ) );
[ # # ]
1095 [ # # ][ # # ]: 0 : size_t nIndex = rLayout.addChild( xButtons );
[ # # ]
1096 [ # # ]: 0 : rLayout.setBorders( nIndex, aBorder.Width(), 0, aBorder.Width(), aBorder.Width() );
1097 : :
1098 [ # # ]: 0 : Size aMinSize( maBtnCancel.GetSizePixel() );
1099 : : // insert help button
1100 [ # # ][ # # ]: 0 : xButtons->setMinimumSize( xButtons->addWindow( &maBtnHelp ), aMinSize );
1101 : :
1102 : : // insert a spacer, cancel and OK buttons are right aligned
1103 : :
1104 [ # # ][ # # ]: 0 : xSpacer.reset( new vcl::Spacer( xButtons.get(), 2 ) );
[ # # ]
1105 [ # # ][ # # ]: 0 : xButtons->addChild( xSpacer );
[ # # ]
1106 [ # # ][ # # ]: 0 : xButtons->setMinimumSize( xButtons->addWindow( &maBtnOK ), aMinSize );
1107 [ # # ][ # # ]: 0 : xButtons->setMinimumSize( xButtons->addWindow( &maBtnCancel ), aMinSize );
[ # # ][ # # ]
1108 : 0 : }
1109 : :
1110 : 0 : void ExportDialog::setupLayout()
1111 : : {
1112 [ # # ][ # # ]: 0 : Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
[ # # ]
1113 [ # # ]: 0 : maLayout.setParentWindow( this );
1114 [ # # ]: 0 : maLayout.setOuterBorder( aBorder.Width() );
1115 : :
1116 [ # # ]: 0 : createSizeControls( maLayout );
1117 [ # # ]: 0 : createFilterOptions( maLayout );
1118 : :
1119 [ # # ][ # # ]: 0 : if ( mnMaxFilesizeForRealtimePreview || mbIsPixelFormat )
1120 : : {
1121 [ # # ]: 0 : maLayout.addWindow( &maFlEstimatedSize );
1122 [ # # ]: 0 : maLayout.addWindow( &maFtEstimatedSize );
1123 : : }
1124 [ # # ]: 0 : createButtons( maLayout );
1125 : :
1126 [ # # ]: 0 : maLayout.show();
1127 [ # # ]: 0 : maDialogSize = maLayout.getOptimalSize( WINDOWSIZE_PREFERRED );
1128 [ # # ][ # # ]: 0 : maLayout.setManagedArea( Rectangle( Point(), maDialogSize ) );
1129 [ # # ][ # # ]: 0 : SetOutputSizePixel( Size( mbPreview ? maDialogSize.Width() * 2 : maDialogSize.Width(), maDialogSize.Height() ) );
1130 : :
1131 [ # # ][ # # ]: 0 : maRectFlButtons = Rectangle( maFlButtons.GetPosPixel(), maFlButtons.GetSizePixel() );
[ # # ]
1132 [ # # ][ # # ]: 0 : maRectBtnHelp = Rectangle( maBtnHelp.GetPosPixel(), maBtnHelp.GetSizePixel() );
[ # # ]
1133 [ # # ][ # # ]: 0 : maRectBtnOK = Rectangle( maBtnOK.GetPosPixel(), maBtnOK.GetSizePixel() );
[ # # ]
1134 [ # # ][ # # ]: 0 : maRectBtnCancel = Rectangle( maBtnCancel.GetPosPixel(), maBtnOK.GetSizePixel() );
[ # # ]
1135 : :
1136 [ # # ]: 0 : maLbSizeY.Hide();
1137 : 0 : }
1138 : :
1139 : 0 : static rtl::OUString ImpValueOfInKB( const sal_Int64& rVal )
1140 : : {
1141 : 0 : double fVal( static_cast<double>( rVal ) );
1142 : 0 : fVal /= ( 1 << 10 );
1143 : 0 : fVal += 0.05;
1144 [ # # ]: 0 : rtl::OUStringBuffer aVal( rtl::OUString::valueOf( fVal ) );
1145 : 0 : sal_Int32 nX( rtl::OUString( aVal.getStr() ).indexOf( '.', 0 ) );
1146 [ # # ]: 0 : if ( nX > 0 )
1147 [ # # ]: 0 : aVal.setLength( nX + 2 );
1148 [ # # ]: 0 : return aVal.makeStringAndClear();
1149 : : }
1150 : :
1151 : 0 : sal_Int32 static GetZoomValueFromThumbPos( sal_Int32 nThumbPos )
1152 : : {
1153 : 0 : sal_Int32 nProz = 0;
1154 [ # # ]: 0 : if ( nThumbPos <= 50 )
1155 : 0 : nProz = nThumbPos * 2; // so a range of 50 represents 100%
1156 : : else
1157 : 0 : nProz = ( ( nThumbPos - 50 ) * 60 ) + 100; // we want to scale up to 3000%
1158 : 0 : return nProz;
1159 : : }
1160 : :
1161 : 0 : void ExportDialog::updatePreview()
1162 : : {
1163 : : // JPG
1164 : : // maCbJPGPreview.Enable( IsTempExportAvailable() );
1165 : :
1166 : : // if ( maCbJPGPreview.IsEnabled() && maCbJPGPreview.IsChecked() )
1167 [ # # ]: 0 : if ( mbPreview )
1168 : : {
1169 [ # # ]: 0 : long nScrollBarSize = Application::GetSettings().GetStyleSettings().GetScrollBarSize();
1170 : :
1171 : 0 : Point aPreviewPos( maDialogSize.Width(), 0 );
1172 [ # # ]: 0 : Size aPreviewSize( maDialogSize.Width(), maFlButtons.GetPosPixel().Y() );
1173 : :
1174 : 0 : Point aFixedBitmapPos( aPreviewPos );
1175 : 0 : Size aFixedBitmapSize( aPreviewSize );
1176 : :
1177 [ # # ]: 0 : maSbZoom.Show( sal_False );
1178 [ # # ]: 0 : maSbZoom.SetPosPixel( Point( aPreviewPos.X(), aPreviewPos.Y() ) );
1179 [ # # ]: 0 : maSbZoom.SetSizePixel( Size( aPreviewSize.Width() / 4, nScrollBarSize ) );
1180 [ # # ]: 0 : maNfZoom.Show( sal_False );
1181 [ # # ]: 0 : maNfZoom.SetPosPixel( Point( aPreviewPos.X() + aPreviewSize.Width() / 4, aPreviewPos.Y() ) );
1182 [ # # ]: 0 : maNfZoom.SetSizePixel( Size( aPreviewSize.Width() / 6, nScrollBarSize ) );
1183 [ # # ]: 0 : maNfZoom.SetValue( GetZoomValueFromThumbPos( maSbZoom.GetThumbPos() ) );
1184 [ # # ]: 0 : maFbJPGPreview.Show( sal_True );
1185 : :
1186 : 0 : sal_Int32 nZoom = GetZoomValueFromThumbPos( maSbZoom.GetThumbPos() );
1187 : 0 : double fSizePixelX = static_cast< double >( maSize.Width * nZoom ) / 100.0;
1188 : 0 : double fSizePixelY = static_cast< double >( maSize.Height * nZoom ) / 100.0;
1189 : :
1190 : 0 : double fXRatio = fSizePixelX / maSize.Width; // the size of each pixel
1191 : 0 : double fYRatio = fSizePixelY / maSize.Height;
1192 : :
1193 : 0 : sal_Bool bHorzSb = fSizePixelX > aFixedBitmapSize.Width();
1194 : 0 : sal_Bool bVertSb = fSizePixelY > aFixedBitmapSize.Height();
1195 [ # # ]: 0 : if ( bHorzSb )
1196 : : {
1197 : 0 : aFixedBitmapSize.Height() -= nScrollBarSize;
1198 : :
1199 [ # # ]: 0 : maSbJPGPreviewHorz.Show( sal_True );
1200 [ # # ]: 0 : maSbJPGPreviewHorz.SetPosPixel( Point( aFixedBitmapPos.X(), aFixedBitmapPos.Y() + aFixedBitmapSize.Height() ) );
1201 [ # # ]: 0 : maSbJPGPreviewHorz.SetSizePixel( Size( aFixedBitmapSize.Width(), nScrollBarSize ) );
1202 : : }
1203 : : else
1204 : : {
1205 [ # # ]: 0 : maSbJPGPreviewHorz.Show( sal_False );
1206 : : }
1207 : :
1208 : :
1209 [ # # ]: 0 : if ( bVertSb )
1210 : : {
1211 : 0 : aFixedBitmapSize.Width() -= nScrollBarSize;
1212 : :
1213 [ # # ]: 0 : maSbJPGPreviewVert.Show( sal_True );
1214 [ # # ]: 0 : maSbJPGPreviewVert.SetPosPixel( Point( aFixedBitmapPos.X() + aFixedBitmapSize.Width(), aFixedBitmapPos.Y() ) );
1215 [ # # ]: 0 : maSbJPGPreviewVert.SetSizePixel( Size( nScrollBarSize, aFixedBitmapSize.Height() ) );
1216 : : }
1217 : : else
1218 : : {
1219 [ # # ]: 0 : maSbJPGPreviewVert.Show( sal_False );
1220 : : }
1221 : :
1222 : 0 : Point aPos( 0, 0 );
1223 : 0 : Size aSize;
1224 [ # # ]: 0 : if ( fXRatio > 1.0 )
1225 : : {
1226 [ # # ]: 0 : aSize.Width() = maSize.Width > aFixedBitmapSize.Width() ? maSize.Width : aFixedBitmapSize.Width();
1227 : 0 : aSize.Width() /= static_cast<long int>(fXRatio);
1228 : : }
1229 : : else
1230 : : {
1231 [ # # ]: 0 : aSize.Width() = maSize.Width < aFixedBitmapSize.Width() ? maSize.Width : aFixedBitmapSize.Width();
1232 : 0 : aSize.Width() /= static_cast<long int>(fXRatio);
1233 : : }
1234 : :
1235 [ # # ]: 0 : if ( fYRatio > 1.0 )
1236 : : {
1237 [ # # ]: 0 : aSize.Height() = maSize.Height > aFixedBitmapSize.Height() ? maSize.Height : aFixedBitmapSize.Height();
1238 : 0 : aSize.Height() /= static_cast<long int>(fYRatio);
1239 : : }
1240 : : else
1241 : : {
1242 [ # # ]: 0 : aSize.Height() = maSize.Height < aFixedBitmapSize.Height() ? maSize.Height : aFixedBitmapSize.Height();
1243 : 0 : aSize.Height() /= static_cast<long int>(fYRatio);
1244 : : }
1245 : :
1246 [ # # ]: 0 : if ( aSize.Width() < maSize.Width )
1247 : : {
1248 : 0 : sal_Int32 nXDiff = static_cast< sal_Int32 >( ( ( ( maSize.Width - aSize.Width() ) * maSbJPGPreviewHorz.GetThumbPos() ) / 100.0 ) );
1249 : 0 : aPos.X() += nXDiff;
1250 : : }
1251 [ # # ]: 0 : if ( aSize.Height() < maSize.Height )
1252 : : {
1253 : 0 : sal_Int32 nYDiff = static_cast< sal_Int32 >( ( ( ( maSize.Height - aSize.Height() ) * maSbJPGPreviewVert.GetThumbPos() ) / 100.0 ) );
1254 : 0 : aPos.Y() += nYDiff;
1255 : : }
1256 : :
1257 [ # # ]: 0 : Bitmap aCroppedBitmap( maBitmap );
1258 [ # # ][ # # ]: 0 : aCroppedBitmap.Crop( Rectangle( aPos, aSize ) );
1259 [ # # ]: 0 : aSize = aCroppedBitmap.GetSizePixel();
1260 : 0 : aSize = Size( static_cast<long int>(aSize.Width() * fXRatio), static_cast<long int>(aSize.Height() * fYRatio) );
1261 [ # # ]: 0 : aCroppedBitmap.Scale( aSize );
1262 : :
1263 [ # # ]: 0 : if ( aSize.Width() > aFixedBitmapSize.Width() )
1264 : 0 : aSize.Width() = aFixedBitmapSize.Width();
1265 [ # # ]: 0 : if ( aSize.Height() > aFixedBitmapSize.Height() )
1266 : 0 : aSize.Height() = aFixedBitmapSize.Height();
1267 : 0 : Point aPoint( aFixedBitmapPos );
1268 [ # # ]: 0 : if ( aSize.Width() < aFixedBitmapSize.Width() )
1269 : 0 : aPoint.X() += ( aFixedBitmapSize.Width() - aSize.Width() ) / 2;
1270 [ # # ]: 0 : if ( aSize.Height() < aFixedBitmapSize.Height() )
1271 : 0 : aPoint.Y() += ( aFixedBitmapSize.Height() - aSize.Height() ) / 2;
1272 : :
1273 [ # # ]: 0 : maFbJPGPreview.SetPosPixel( aPoint );
1274 [ # # ]: 0 : maFbJPGPreview.SetSizePixel( aSize );
1275 [ # # ]: 0 : maFbJPGPreview.SetBitmap( aCroppedBitmap );
1276 : :
1277 [ # # ]: 0 : SetOutputSizePixel( Size( maDialogSize.Width() * 2, maDialogSize.Height() ) );
1278 : :
1279 [ # # ][ # # ]: 0 : maFlButtons.SetSizePixel( Size( maRectFlButtons.GetWidth() * 2, maRectFlButtons.GetHeight() ) );
[ # # ]
1280 [ # # ]: 0 : maBtnHelp.SetPosPixel( Point( maRectBtnHelp.Left() + maDialogSize.Width(), maRectBtnHelp.Top() ) );
1281 [ # # ]: 0 : maBtnOK.SetPosPixel( Point( maRectBtnOK.Left() + maDialogSize.Width(), maRectBtnOK.Top() ) );
1282 [ # # ][ # # ]: 0 : maBtnCancel.SetPosPixel( Point( maRectBtnCancel.Left() + maDialogSize.Width(), maRectBtnCancel.Top() ) );
1283 : : }
1284 : : else
1285 : : {
1286 : 0 : maSbZoom.Show( sal_False );
1287 : 0 : maNfZoom.Show( sal_False );
1288 : 0 : maFbJPGPreview.Show( sal_False );
1289 : 0 : maSbJPGPreviewHorz.Show( sal_False );
1290 : 0 : maSbJPGPreviewVert.Show( sal_False );
1291 : :
1292 : 0 : SetOutputSizePixel( maDialogSize );
1293 : :
1294 [ # # ]: 0 : maFlButtons.SetSizePixel( Size( maRectFlButtons.GetWidth(), maRectFlButtons.GetHeight() ) );
1295 [ # # ]: 0 : maBtnHelp.SetPosPixel( Point( maRectBtnHelp.Left(), maRectBtnHelp.Top() ) );
1296 [ # # ]: 0 : maBtnOK.SetPosPixel( Point( maRectBtnOK.Left(), maRectBtnOK.Top() ) );
1297 [ # # ]: 0 : maBtnCancel.SetPosPixel( Point( maRectBtnCancel.Left(), maRectBtnCancel.Top() ) );
1298 : : }
1299 : 0 : }
1300 : :
1301 : 0 : void ExportDialog::updateControls()
1302 : : {
1303 [ # # ]: 0 : GetGraphicStream();
1304 : :
1305 : : // Size Controls
1306 [ # # ]: 0 : if ( !mbIsPixelFormat )
1307 : : {
1308 : 0 : awt::Size aSize100thmm( maSize );
1309 : : Size aSize( LogicToLogic( Size( aSize100thmm.Width * 100, aSize100thmm.Height * 100 ), MAP_100TH_MM,
1310 [ # # ][ # # ]: 0 : MapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) ) );
[ # # ][ # # ]
[ # # ][ # # ]
1311 [ # # ]: 0 : maMfSizeX.SetValue( aSize.Width() );
1312 [ # # ]: 0 : maMfSizeY.SetValue( aSize.Height() );
1313 : : }
1314 : : else
1315 : : {
1316 [ # # ]: 0 : MapUnit aMapUnit( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) );
1317 [ # # ]: 0 : if ( aMapUnit == MAP_PIXEL )
1318 : : { // calculating pixel count via resolution and original graphic size
1319 [ # # ]: 0 : maMfSizeX.SetDecimalDigits( 0 );
1320 [ # # ]: 0 : maMfSizeY.SetDecimalDigits( 0 );
1321 [ # # ]: 0 : maMfSizeX.SetValue( maSize.Width );
1322 [ # # ]: 0 : maMfSizeY.SetValue( maSize.Height );
1323 : : }
1324 : : else
1325 : : {
1326 [ # # ]: 0 : maMfSizeX.SetDecimalDigits( 2 );
1327 [ # # ]: 0 : maMfSizeY.SetDecimalDigits( 2 );
1328 : : double fRatio;
1329 [ # # ]: 0 : switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) )
[ # # # # ]
1330 : : {
1331 : 0 : case MAP_INCH : fRatio = static_cast< double >( maResolution.Width ) * 0.0254; break;
1332 : 0 : case MAP_MM : fRatio = static_cast< double >( maResolution.Width ) * 0.001; break;
1333 : 0 : case MAP_POINT :fRatio = ( static_cast< double >( maResolution.Width ) * 0.0254 ) / 72.0; break;
1334 : : default:
1335 : 0 : case MAP_CM : fRatio = static_cast< double >( maResolution.Width ) * 0.01; break;
1336 : : }
1337 [ # # ]: 0 : maMfSizeX.SetValue( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Width * 100 ) / fRatio ) + 0.5 ) );
1338 [ # # ]: 0 : maMfSizeY.SetValue( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Height * 100 ) / fRatio ) + 0.5 ) );
1339 : : }
1340 : : }
1341 : 0 : sal_Int32 nResolution = 0;
1342 [ # # ]: 0 : switch( maLbResolution.GetSelectEntryPos() )
[ # # # ]
1343 : : {
1344 : 0 : case 0 : nResolution = maResolution.Width / 100; break; // pixels / cm
1345 : 0 : case 2 : nResolution = maResolution.Width; break; // pixels / meter
1346 : : default:
1347 : 0 : case 1 : nResolution = static_cast< sal_Int32 >(maResolution.Width * 0.0254); break; // pixels / inch
1348 : : }
1349 [ # # ]: 0 : maNfResolution.SetValue( nResolution );
1350 : :
1351 [ # # ][ # # ]: 0 : if ( maSbCompression.IsVisible() )
1352 [ # # ][ # # ]: 0 : maSbCompression.SetThumbPos( maNfCompression.GetValue() );
1353 : :
1354 : : // updating estimated size
1355 : 0 : sal_Int64 nRealFileSize( mpTempStream->Tell() );
1356 [ # # ]: 0 : if ( mbIsPixelFormat )
1357 : : {
1358 [ # # ][ # # ]: 0 : String aEst( nRealFileSize ? msEstimatedSizePix2 : msEstimatedSizePix1 );
1359 [ # # ]: 0 : sal_Int64 nRawFileSize( GetRawFileSize() );
1360 [ # # ]: 0 : xub_StrLen nInd = aEst.Search( '%' );
1361 [ # # ][ # # ]: 0 : aEst.Replace( nInd, 2, ImpValueOfInKB( nRawFileSize ) );
[ # # ][ # # ]
1362 : :
1363 [ # # ]: 0 : if ( nRealFileSize )
1364 : : {
1365 [ # # ]: 0 : nInd = aEst.Search( '%', nInd );
1366 [ # # ][ # # ]: 0 : aEst.Replace( nInd, 2, ImpValueOfInKB( nRealFileSize ) );
[ # # ][ # # ]
1367 : : }
1368 [ # # ][ # # ]: 0 : maFtEstimatedSize.SetText( aEst );
1369 : : }
1370 : : else
1371 : : {
1372 [ # # ]: 0 : if ( mnMaxFilesizeForRealtimePreview )
1373 : : {
1374 [ # # ]: 0 : String aEst( msEstimatedSizeVec );
1375 [ # # ]: 0 : xub_StrLen nInd = aEst.Search( '%', 0 );
1376 [ # # ][ # # ]: 0 : aEst.Replace( nInd, 2, ImpValueOfInKB( nRealFileSize ) );
[ # # ][ # # ]
1377 [ # # ][ # # ]: 0 : maFtEstimatedSize.SetText( aEst );
1378 : : }
1379 : : }
1380 [ # # ]: 0 : updatePreview();
1381 : :
1382 : : // EPS
1383 [ # # ][ # # ]: 0 : if ( maRbEPSLevel1.IsVisible() )
1384 : : {
1385 : 0 : sal_Bool bEnabled = maRbEPSLevel1.IsChecked() == sal_False;
1386 [ # # ]: 0 : maRbEPSColorFormat1.Enable( bEnabled );
1387 [ # # ]: 0 : maRbEPSColorFormat2.Enable( bEnabled );
1388 [ # # ]: 0 : maRbEPSCompressionLZW.Enable( bEnabled );
1389 [ # # ]: 0 : maRbEPSCompressionNone.Enable( bEnabled );
1390 : : }
1391 : 0 : }
1392 : :
1393 [ # # ][ # # ]: 0 : ExportDialog::~ExportDialog()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1394 : : {
1395 [ # # ][ # # ]: 0 : delete mpFilterOptionsItem;
1396 [ # # ][ # # ]: 0 : delete mpOptionsItem;
1397 [ # # ]: 0 : }
1398 : :
1399 : :
1400 : : /*************************************************************************
1401 : : |*
1402 : : |* Speichert eingestellte Werte in ini-Datei
1403 : : |*
1404 : : \************************************************************************/
1405 : 0 : IMPL_LINK_NOARG(ExportDialog, UpdateHdl)
1406 : : {
1407 : 0 : updateControls();
1408 : 0 : return 0;
1409 : : }
1410 : :
1411 : 0 : IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeX)
1412 : : {
1413 : 0 : double fRatio = static_cast< double >( maOriginalSize.Height ) / maOriginalSize.Width;
1414 : :
1415 [ # # ]: 0 : if ( mbIsPixelFormat )
1416 : : {
1417 [ # # # # : 0 : switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) )
# ]
1418 : : {
1419 : 0 : case MAP_INCH : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break;
1420 : 0 : case MAP_CM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.01 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break;
1421 : 0 : case MAP_MM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.001 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break;
1422 : 0 : case MAP_POINT : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * maMfSizeX.GetValue() / 100.0 * 72 + 0.5 ); break;
1423 : : default:
1424 : 0 : case MAP_PIXEL : maSize.Width = maMfSizeX.GetValue(); break;
1425 : : }
1426 : 0 : maSize.Height = static_cast< sal_Int32 >( fRatio * maSize.Width + 0.5 );
1427 : : }
1428 : : else
1429 : : {
1430 [ # # ]: 0 : Fraction aFract( 1, 100 );
1431 [ # # ]: 0 : sal_Int32 nWidth = maMfSizeX.GetValue();
1432 : 0 : sal_Int32 nHeight= static_cast< sal_Int32 >( nWidth * fRatio );
1433 : 0 : const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) );
1434 [ # # ][ # # ]: 0 : MapMode aSourceMapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ),Point(), aFract, aFract );
1435 [ # # ][ # # ]: 0 : Size aDest( LogicToLogic( aSource, aSourceMapMode, MAP_100TH_MM ) );
[ # # ]
1436 : :
1437 : 0 : maSize.Width = aDest.Width();
1438 [ # # ]: 0 : if ( mbPreserveAspectRatio )
1439 [ # # ]: 0 : maSize.Height = aDest.Height();
1440 : : }
1441 : 0 : updateControls();
1442 : 0 : return 0;
1443 : : }
1444 : :
1445 : 0 : IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeY)
1446 : : {
1447 : 0 : double fRatio = static_cast< double >( maOriginalSize.Width ) / maOriginalSize.Height;
1448 : :
1449 [ # # ]: 0 : if ( mbIsPixelFormat )
1450 : : {
1451 [ # # # # : 0 : switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) )
# ]
1452 : : {
1453 : 0 : case MAP_INCH : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break;
1454 : 0 : case MAP_CM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.01 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break;
1455 : 0 : case MAP_MM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.001 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break;
1456 : 0 : case MAP_POINT : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * maMfSizeY.GetValue() / 100.0 * 72 + 0.5 ); break;
1457 : : default:
1458 : 0 : case MAP_PIXEL : maSize.Height = maMfSizeY.GetValue(); break;
1459 : : }
1460 : 0 : maSize.Width = static_cast< sal_Int32 >( fRatio * maSize.Height + 0.5 );
1461 : : }
1462 : : else
1463 : : {
1464 [ # # ]: 0 : Fraction aFract( 1, 100 );
1465 [ # # ]: 0 : sal_Int32 nHeight= maMfSizeY.GetValue();
1466 : 0 : sal_Int32 nWidth = static_cast< sal_Int32 >( nHeight * fRatio );
1467 : 0 : const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) );
1468 [ # # ][ # # ]: 0 : MapMode aSourceMapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ),Point(), aFract, aFract );
1469 [ # # ][ # # ]: 0 : Size aDest( LogicToLogic( aSource, aSourceMapMode, MAP_100TH_MM ) );
[ # # ]
1470 : :
1471 : 0 : maSize.Height = aDest.Height();
1472 [ # # ]: 0 : if ( mbPreserveAspectRatio )
1473 [ # # ]: 0 : maSize.Width = aDest.Width();
1474 : : }
1475 : 0 : updateControls();
1476 : 0 : return 0;
1477 : : }
1478 : :
1479 : 0 : IMPL_LINK_NOARG(ExportDialog, UpdateHdlNfResolution)
1480 : : {
1481 : 0 : sal_Int32 nResolution = maNfResolution.GetValue();
1482 [ # # ]: 0 : if ( maLbResolution.GetSelectEntryPos() == 0 ) // pixels / cm
1483 : 0 : nResolution *= 100;
1484 [ # # ]: 0 : else if ( maLbResolution.GetSelectEntryPos() == 1 ) // pixels / inch
1485 : 0 : nResolution = static_cast< sal_Int32 >( ( ( static_cast< double >( nResolution ) + 0.5 ) / 0.0254 ) );
1486 : 0 : maResolution.Width = nResolution;
1487 : 0 : maResolution.Height= nResolution;
1488 : :
1489 : 0 : updateControls();
1490 : 0 : return 0;
1491 : : }
1492 : :
1493 : 0 : IMPL_LINK_NOARG(ExportDialog, SbCompressionUpdateHdl)
1494 : : {
1495 : 0 : maNfCompression.SetValue( maSbCompression.GetThumbPos() );
1496 : 0 : updateControls();
1497 : 0 : return 0;
1498 : : }
1499 : :
1500 : 0 : IMPL_LINK_NOARG(ExportDialog, OK)
1501 : : {
1502 : : // writing config parameter
1503 : :
1504 : :
1505 [ # # ]: 0 : mrFltCallPara.aFilterData = GetFilterData( sal_True );
1506 : 0 : EndDialog( RET_OK );
1507 : :
1508 : 0 : return 0;
1509 : : }
1510 : :
1511 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|