LibreOffice Module svtools (master) 1
exportdialog.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21
22#include <algorithm>
23
25#include <o3tl/safeint.hxx>
26#include <tools/stream.hxx>
27#include <tools/fract.hxx>
28#include <utility>
29#include <vcl/graphicfilter.hxx>
31#include <svtools/strings.hrc>
32#include <svtools/svtresid.hxx>
34#include <com/sun/star/beans/XPropertySet.hpp>
35#include <com/sun/star/awt/Size.hpp>
36#include <com/sun/star/drawing/GraphicExportFilter.hpp>
37#include <com/sun/star/drawing/XDrawView.hpp>
38#include <com/sun/star/frame/XModel.hpp>
39#include <com/sun/star/frame/XController.hpp>
40#include <com/sun/star/graphic/PrimitiveFactory2D.hpp>
41#include <com/sun/star/geometry/AffineMatrix2D.hpp>
42#include <com/sun/star/io/XStream.hpp>
44#include <vcl/svapp.hxx>
45#include <vcl/outdev.hxx>
46#include <vcl/graph.hxx>
47#include <rtl/ustrbuf.hxx>
49#include "exportdialog.hxx"
50
51#define FORMAT_UNKNOWN 0
52#define FORMAT_JPG 1
53#define FORMAT_PNG 2
54#define FORMAT_BMP 3
55#define FORMAT_GIF 4
56#define FORMAT_TIF 10
57#define FORMAT_WMF 12
58#define FORMAT_EMF 13
59#define FORMAT_EPS 14
60#define FORMAT_SVG 16
61#define FORMAT_WEBP 17
62
63#define UNIT_DEFAULT -1
64#define UNIT_INCH 0
65#define UNIT_CM 1
66#define UNIT_MM 2
67#define UNIT_POINT 3
68#define UNIT_PIXEL 4
69#define UNIT_MAX_ID UNIT_PIXEL
70
71using namespace ::com::sun::star;
72
73static sal_Int16 GetFilterFormat(std::u16string_view rExt)
74{
75 sal_Int16 nFormat = FORMAT_UNKNOWN;
76 if ( rExt == u"JPG" )
77 nFormat = FORMAT_JPG;
78 else if ( rExt == u"PNG" )
79 nFormat = FORMAT_PNG;
80 else if ( rExt == u"BMP" )
81 nFormat = FORMAT_BMP;
82 else if ( rExt == u"GIF" )
83 nFormat = FORMAT_GIF;
84 else if ( rExt == u"TIF" )
85 nFormat = FORMAT_TIF;
86 else if ( rExt == u"WMF" )
87 nFormat = FORMAT_WMF;
88 else if ( rExt == u"EMF" )
89 nFormat = FORMAT_EMF;
90 else if ( rExt == u"EPS" )
91 nFormat = FORMAT_EPS;
92 else if ( rExt == u"SVG" )
93 nFormat = FORMAT_SVG;
94 else if ( rExt == u"WEBP" )
95 nFormat = FORMAT_WEBP;
96 return nFormat;
97}
98
99static MapUnit GetMapUnit( sal_Int32 nUnit )
100{
101 MapUnit aMapUnit( MapUnit::MapPixel );
102 switch( nUnit )
103 {
104 case UNIT_INCH : aMapUnit = MapUnit::MapInch; break;
105 case UNIT_CM : aMapUnit = MapUnit::MapCM; break;
106 case UNIT_MM : aMapUnit = MapUnit::MapMM; break;
107 case UNIT_POINT : aMapUnit = MapUnit::MapPoint; break;
108 case UNIT_PIXEL : aMapUnit = MapUnit::MapPixel; break;
109 }
110 return aMapUnit;
111}
112
114{
115 sal_Int32 nDefaultUnit = UNIT_CM;
116 switch( mrFltCallPara.eFieldUnit )
117 {
118// case FieldUnit::NONE :
119// case FieldUnit::PERCENT :
120// case FieldUnit::CUSTOM :
121 default: nDefaultUnit = UNIT_CM; break;
122
123 case FieldUnit::MILE : // PASSTHROUGH INTENDED
124 case FieldUnit::FOOT :
125 case FieldUnit::TWIP :
126 case FieldUnit::PICA : nDefaultUnit = UNIT_INCH; break;
127
128 case FieldUnit::KM : // PASSTHROUGH INTENDED
129 case FieldUnit::M :
130 case FieldUnit::MM_100TH : nDefaultUnit = UNIT_CM; break;
131
132 case FieldUnit::INCH : nDefaultUnit = UNIT_INCH; break;
133 case FieldUnit::CM : nDefaultUnit = UNIT_CM; break;
134 case FieldUnit::MM : nDefaultUnit = UNIT_MM; break;
135 case FieldUnit::POINT : nDefaultUnit = UNIT_POINT; break;
136 }
137 return nDefaultUnit;
138}
139
140static basegfx::B2DRange GetShapeRangeForXShape( const uno::Reference< drawing::XShape >& rxShape,
141 const uno::Reference< graphic::XPrimitiveFactory2D >& rxPrimitiveFactory2D, const uno::Sequence< beans::PropertyValue >& rViewInformation )
142{
143 basegfx::B2DRange aShapeRange;
144
145 const uno::Sequence< beans::PropertyValue > aParams;
146 const uno::Sequence< uno::Reference< graphic::XPrimitive2D > > aPrimitiveSequence( rxPrimitiveFactory2D->createPrimitivesFromXShape( rxShape, aParams ) );
147
148 for( const auto& rPrimitive : aPrimitiveSequence )
149 {
150 const geometry::RealRectangle2D aRect( rPrimitive->getRange( rViewInformation ) );
151 aShapeRange.expand( basegfx::B2DTuple( aRect.X1, aRect.Y1 ) );
152 aShapeRange.expand( basegfx::B2DTuple( aRect.X2, aRect.Y2 ) );
153 }
154 return aShapeRange;
155}
156
157uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( bool bUpdateConfig )
158{
159 if ( bUpdateConfig )
160 {
161 sal_Int32 nUnit = mxLbSizeX->get_active();
162 if ( nUnit < 0 )
163 nUnit = UNIT_CM;
164
165 if ( ( mnInitialResolutionUnit == UNIT_DEFAULT ) && ( nUnit == GetDefaultUnit() ) )
166 nUnit = UNIT_DEFAULT;
167
168 // updating ui configuration
169 if ( mbIsPixelFormat )
170 {
171 if ( nUnit > UNIT_MAX_ID )
172 nUnit = UNIT_PIXEL;
173
174 sal_Int32 nResolution = mxNfResolution->get_value();
175 if ( nResolution < 1 )
176 nResolution = 96;
177
178 mpOptionsItem->WriteInt32("PixelExportUnit", nUnit);
179 mpOptionsItem->WriteInt32("PixelExportResolution", nResolution);
180 mpOptionsItem->WriteInt32("PixelExportResolutionUnit", mxLbResolution->get_active());
181 }
182 else
183 {
184 if ( nUnit >= UNIT_PIXEL )
185 nUnit = UNIT_CM;
186
187 mpOptionsItem->WriteInt32("VectorExportUnit", nUnit);
188 }
189 }
190
191 FilterConfigItem* pFilterOptions;
192 if ( bUpdateConfig )
193 pFilterOptions = mpFilterOptionsItem.get();
194 else
195 {
196 uno::Sequence< beans::PropertyValue > aFilterData( mpFilterOptionsItem->GetFilterData() );
197 pFilterOptions = new FilterConfigItem( &aFilterData );
198 }
199
200 static constexpr OUStringLiteral sLogicalWidth(u"LogicalWidth");
201 static constexpr OUStringLiteral sLogicalHeight(u"LogicalHeight");
202 if ( mbIsPixelFormat )
203 {
204 pFilterOptions->WriteInt32("PixelWidth", maSize.Width );
205 pFilterOptions->WriteInt32("PixelHeight", maSize.Height );
206 if ( maResolution.Width && maResolution.Height )
207 {
208 const double f100thmmPerPixelX = 100000.0 / maResolution.Width;
209 const double f100thmmPerPixelY = 100000.0 / maResolution.Height;
210 sal_Int32 nLogicalWidth = static_cast< sal_Int32 >( f100thmmPerPixelX * maSize.Width );
211 sal_Int32 nLogicalHeight= static_cast< sal_Int32 >( f100thmmPerPixelY * maSize.Height );
212 if ( nLogicalWidth && nLogicalHeight )
213 {
214 pFilterOptions->WriteInt32( sLogicalWidth, nLogicalWidth );
215 pFilterOptions->WriteInt32( sLogicalHeight, nLogicalHeight );
216 }
217 }
218 }
219 else
220 {
221 pFilterOptions->WriteInt32( sLogicalWidth, maSize.Width );
222 pFilterOptions->WriteInt32( sLogicalHeight, maSize.Height );
223 }
224 switch ( mnFormat )
225 {
226 case FORMAT_JPG :
227 {
228 sal_Int32 nColor = mxLbColorDepth->get_active();
229 if ( nColor == 1 )
230 nColor = 0;
231 else
232 nColor = 1;
233 pFilterOptions->WriteInt32("ColorMode", nColor);
234 assert(mpSbCompression);
235 pFilterOptions->WriteInt32("Quality", static_cast<sal_Int32>(mpSbCompression->get_value()));
236 }
237 break;
238
239 case FORMAT_PNG :
240 {
241 assert(mpSbCompression);
242 pFilterOptions->WriteInt32("Compression", static_cast<sal_Int32>(mpSbCompression->get_value()));
243 sal_Int32 nInterlace = 0;
244 if ( mxCbInterlaced->get_active() )
245 nInterlace++;
246 pFilterOptions->WriteInt32("Interlaced", nInterlace);
247 sal_Int32 nValue = 0;
248 if ( mxCbSaveTransparency->get_active() )
249 nValue++;
250 pFilterOptions->WriteInt32("Translucent", nValue);
251 }
252 break;
253
254 case FORMAT_BMP :
255 {
256 pFilterOptions->WriteInt32("Color", mxLbColorDepth->get_active() + 1);
257 pFilterOptions->WriteBool("RLE_Coding", mxCbRLEEncoding->get_active());
258 }
259 break;
260
261 case FORMAT_GIF :
262 {
263 sal_Int32 nValue = 0;
264 if ( mxCbInterlaced->get_active() )
265 nValue++;
266 pFilterOptions->WriteInt32("Interlaced", nValue);
267
268 nValue = 0;
269 if (mxCbSaveTransparency->get_active())
270 nValue++;
271 pFilterOptions->WriteInt32("Translucent", nValue);
272 }
273 break;
274
275 case FORMAT_EPS :
276 {
277 sal_Int32 nCheck = 0;
278 if ( mxCbEPSPreviewTIFF->get_active() )
279 nCheck++;
280 if ( mxCbEPSPreviewEPSI->get_active() )
281 nCheck += 2;
282 pFilterOptions->WriteInt32("Preview", nCheck);
283
284 nCheck = 1;
285 if ( mxRbEPSLevel2->get_active() )
286 nCheck++;
287 pFilterOptions->WriteInt32("Version", nCheck);
288
289 nCheck = 1;
290 if ( mxRbEPSColorFormat2->get_active() )
291 nCheck++;
292 pFilterOptions->WriteInt32("ColorFormat", nCheck);
293
294 nCheck = 1;
295 if ( mxRbEPSCompressionNone->get_active() )
296 nCheck++;
297 pFilterOptions->WriteInt32("CompressionMode", nCheck);
298 }
299 break;
300
301 case FORMAT_WEBP :
302 {
303 assert(mpSbCompression);
304 pFilterOptions->WriteInt32("Quality", static_cast<sal_Int32>(mpSbCompression->get_value()));
305 pFilterOptions->WriteBool("Lossless", mxCbLossless->get_active());
306 }
307 break;
308
309 }
310
311 uno::Sequence< beans::PropertyValue > aRet( pFilterOptions->GetFilterData() );
312 if ( !bUpdateConfig )
313 delete pFilterOptions;
314 return aRet;
315}
316
317
319{
320 basegfx::B2DRange aShapesRange;
321
322 if ( mxPage.is () )
323 {
324 uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY );
325 if ( xPagePropSet.is() )
326 {
327 sal_Int32 nWidth = 0;
328 sal_Int32 nHeight= 0;
329 css::uno::Any aAny;
330 aAny = xPagePropSet->getPropertyValue("Width");
331 aAny >>= nWidth;
332 aAny = xPagePropSet->getPropertyValue("Height");
333 aAny >>= nHeight;
334 aShapesRange = basegfx::B2DRange( 0, 0, nWidth, nHeight );
335 }
336 }
337 else if (mxShapes.is() || mxShape.is())
338 {
339 uno::Reference< graphic::XPrimitiveFactory2D > xPrimitiveFactory = graphic::PrimitiveFactory2D::create( mxContext );
340
341 basegfx::B2DHomMatrix aViewTransformation( Application::GetDefaultDevice()->GetViewTransformation() );
342 css::geometry::AffineMatrix2D aTransformation;
343 aTransformation.m00 = aViewTransformation.get(0,0);
344 aTransformation.m01 = aViewTransformation.get(0,1);
345 aTransformation.m02 = aViewTransformation.get(0,2);
346 aTransformation.m10 = aViewTransformation.get(1,0);
347 aTransformation.m11 = aViewTransformation.get(1,1);
348 aTransformation.m12 = aViewTransformation.get(1,2);
349
350 uno::Sequence< beans::PropertyValue > aViewInformation{ comphelper::makePropertyValue(
351 "ViewTransformation", aTransformation) };
352
353 if ( mxShape.is() )
354 aShapesRange = GetShapeRangeForXShape( mxShape, xPrimitiveFactory, aViewInformation );
355 else if ( mxShapes.is() )
356 {
357 const sal_Int32 nCount = mxShapes->getCount();
358 for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
359 {
360 uno::Reference< drawing::XShape > xShape;
361 mxShapes->getByIndex( nIndex ) >>= xShape;
362 aShapesRange.expand( GetShapeRangeForXShape( xShape, xPrimitiveFactory, aViewInformation ) );
363 }
364 }
365 }
366 else if (!mbGraphicsSource)
367 {
369 const sal_Int32 nCurrentPage = aRenderer.getCurrentPage();
370 const Size aSize = aRenderer.getDocumentSizeIn100mm( nCurrentPage);
371 return awt::Size( aSize.Width(), aSize.Height());
372 }
373 return awt::Size( static_cast<sal_Int32>(aShapesRange.getWidth()), static_cast<sal_Int32>(aShapesRange.getHeight()) );
374}
375
377{
378 if (mxGraphic.is())
379 return;
380
381 if ( !mxSourceDocument.is() )
382 return;
383
384 uno::Reference< frame::XModel > xModel( mxSourceDocument, uno::UNO_QUERY );
385 if ( !xModel.is() )
386 return;
387
388 uno::Reference< frame::XController > xController( xModel->getCurrentController() );
389 if ( !xController.is() )
390 return;
391
392 if ( mbExportSelection ) // check if there is a selection
393 {
395 mbGraphicsSource = true;
396 }
397 if ( !mxShape.is() && !mxShapes.is() && mbGraphicsSource )
398 {
399 uno::Reference< drawing::XDrawView > xDrawView( xController, uno::UNO_QUERY );
400 if ( xDrawView.is() )
401 {
402 uno::Reference< drawing::XDrawPage > xCurrentPage( xDrawView->getCurrentPage() );
403 if ( xCurrentPage.is() )
404 {
405 mxPage = xCurrentPage; // exporting whole page
406 }
407 }
408 }
409 // For !mbGraphicsSource the mxSourceDocument is used, from
410 // which XRenderable can query XController and
411 // XSelectionSupplier the same.
412}
413
415{
416 if ( !IsTempExportAvailable() )
417 {
418 mpTempStream.reset(new SvMemoryStream());
419 return;
420 }
421
422 bool bRecreateOutputStream = mpTempStream->Tell() == 0;
423
424 static uno::Sequence< beans::PropertyValue > aOldFilterData;
425 uno::Sequence< beans::PropertyValue > aNewFilterData( GetFilterData( false ) );
426 if ( aOldFilterData != aNewFilterData )
427 {
428 aOldFilterData = aNewFilterData;
429 bRecreateOutputStream = true;
430 }
431 try
432 {
433 if ( bRecreateOutputStream )
434 {
435 mpTempStream.reset(new SvMemoryStream());
436
437 uno::Reference< graphic::XGraphic > xGraphic;
438 if (!mbGraphicsSource && !mxGraphic.is())
439 {
440 // Create a Graphic to be used below.
442 const sal_Int32 nCurrentPage = aRenderer.getCurrentPage();
443 const Size aDocumentSizePixel = aRenderer.getDocumentSizeInPixels( nCurrentPage);
444
445 const Size aTargetSizePixel( mbIsPixelFormat ?
446 Size( maSize.Width, maSize.Height) :
447 aDocumentSizePixel );
448
449 Graphic aGraphic( aRenderer.renderToGraphic( nCurrentPage,
450 aDocumentSizePixel, aTargetSizePixel, COL_WHITE, /*bExtOutDevData=*/false));
451 xGraphic = aGraphic.GetXGraphic();
452 }
453
454 if ( mxGraphic.is() || xGraphic.is() )
455 {
456 Graphic aGraphic( mxGraphic.is() ? mxGraphic : xGraphic );
457
458 if ( aGraphic.GetType() == GraphicType::Bitmap )
459 {
460 Size aSizePixel( aGraphic.GetSizePixel() );
461 if( maSize.Width && maSize.Height &&
462 ( ( maSize.Width != aSizePixel.Width() ) ||
463 ( maSize.Height != aSizePixel.Height() ) ) )
464 {
465 BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
466 // export: use highest quality
467 aBmpEx.Scale( Size( maSize.Width, maSize.Height ), BmpScaleFlag::Lanczos );
468 aGraphic = aBmpEx;
469 }
470 }
471
473 const sal_uInt16 nFilter = rFilter.GetExportFormatNumberForShortName( maExt );
474 if ( rFilter.IsExportPixelFormat( nFilter ) )
475 {
476 mpTempStream->SetResizeOffset(1024);
477 mpTempStream->SetStreamSize(1024);
478 rFilter.ExportGraphic( aGraphic, u"", *mpTempStream, nFilter, &aNewFilterData );
479 }
480 }
481 else
482 {
483 uno::Reference< lang::XComponent > xSourceDoc;
484 if ( mxPage.is() )
485 xSourceDoc.set( mxPage, uno::UNO_QUERY_THROW );
486 else if ( mxShapes.is() )
487 xSourceDoc.set( mxShapes, uno::UNO_QUERY_THROW );
488 else if ( mxShape.is() )
489 xSourceDoc.set( mxShape, uno::UNO_QUERY_THROW );
490 if ( xSourceDoc.is() )
491 {
492 uno::Reference < io::XStream > xStream( new utl::OStreamWrapper( *mpTempStream ) );
493 uno::Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() );
494
495 OUString sFormat( maExt );
496 uno::Sequence< beans::PropertyValue > aDescriptor{
497 comphelper::makePropertyValue("OutputStream", xOutputStream),
498 comphelper::makePropertyValue("FilterName", sFormat),
499 comphelper::makePropertyValue("FilterData", aNewFilterData)
500 };
501
502 uno::Reference< drawing::XGraphicExportFilter > xGraphicExporter =
503 drawing::GraphicExportFilter::create( mxContext );
504
505 xGraphicExporter->setSourceDocument( xSourceDoc );
506 xGraphicExporter->filter( aDescriptor );
507 }
508 }
509 }
510 }
511 catch( uno::Exception& )
512 {
513
514 // ups
515
516 }
517}
518
520{
521 sal_uInt64 nRawFileSize = 0;
522 if ( mbIsPixelFormat )
523 {
524 sal_Int32 nBitsPerPixel = 24;
525 OUString aEntry(mxLbColorDepth->get_active_text());
526 if ( ms1BitThreshold == aEntry )
527 nBitsPerPixel = 1;
528 else if ( ms8BitGrayscale == aEntry )
529 nBitsPerPixel = 8;
530 else if ( ms8BitColorPalette == aEntry )
531 nBitsPerPixel = 8;
532 else if ( ms24BitColor == aEntry )
533 nBitsPerPixel = 24;
534
535 if ( mbIsPixelFormat )
536 {
537 nRawFileSize = ( maSize.Width * nBitsPerPixel + 7 ) &~ 7; // rounding up to 8 bits
538 nRawFileSize /= 8; // in bytes
539 nRawFileSize *= maSize.Height;
540 }
541 if ( nRawFileSize > SAL_MAX_UINT32 )
542 nRawFileSize = 0;
543 }
544 return static_cast< sal_uInt32 >( nRawFileSize );
545}
546
547// checks if the source dimension/resolution is not too big
548// to determine the exact graphic output size and preview for jpg
550{
552}
553
555 css::uno::Reference< css::uno::XComponentContext > xContext,
556 const css::uno::Reference< css::lang::XComponent >& rxSourceDocument,
557 bool bExportSelection, bool bIsPixelFormat, bool bGraphicsSource,
558 const css::uno::Reference< css::graphic::XGraphic >& rxGraphic)
559 : GenericDialogController(rPara.pWindow, "svt/ui/graphicexport.ui", "GraphicExportDialog")
560 , mrFltCallPara(rPara)
561 , mxContext(std::move(xContext))
562 , mxSourceDocument(rxSourceDocument)
563 , mxGraphic(rxGraphic)
564 , msEstimatedSizePix1(SvtResId(STR_SVT_ESTIMATED_SIZE_PIX_1))
565 , msEstimatedSizePix2(SvtResId(STR_SVT_ESTIMATED_SIZE_PIX_2))
566 , msEstimatedSizeVec(SvtResId(STR_SVT_ESTIMATED_SIZE_VEC))
567 , ms1BitThreshold(SvtResId(STR_SVT_1BIT_THRESHOLD))
568 , ms8BitGrayscale(SvtResId(STR_SVT_8BIT_GRAYSCALE))
569 , ms8BitColorPalette(SvtResId(STR_SVT_8BIT_COLOR_PALETTE))
570 , ms24BitColor(SvtResId(STR_SVT_24BIT_TRUE_COLOR))
571 , maExt(rPara.aFilterExt)
572 , mnFormat(FORMAT_UNKNOWN)
573 , mnMaxFilesizeForRealtimePreview(0)
574 , mpTempStream(new SvMemoryStream())
575 , maOriginalSize(awt::Size(0, 0))
576 , mbIsPixelFormat(bIsPixelFormat)
577 , mbExportSelection(bExportSelection)
578 , mbGraphicsSource(bGraphicsSource)
579 , mpSbCompression(nullptr)
580 , mpNfCompression(nullptr)
581 , mxMfSizeX(m_xBuilder->weld_spin_button("widthmf"))
582 , mxLbSizeX(m_xBuilder->weld_combo_box("widthlb"))
583 , mxMfSizeY(m_xBuilder->weld_spin_button( "heightmf"))
584 , mxFtResolution(m_xBuilder->weld_label("resolutionft"))
585 , mxNfResolution(m_xBuilder->weld_spin_button("resolutionmf"))
586 , mxLbResolution(m_xBuilder->weld_combo_box("resolutionlb"))
587 , mxColorDepth(m_xBuilder->weld_widget("colordepth"))
588 , mxLbColorDepth(m_xBuilder->weld_combo_box("colordepthlb"))
589 , mxJPGWEBPQuality(m_xBuilder->weld_widget("jpgwebpquality"))
590 , mxPNGCompression(m_xBuilder->weld_widget("pngcompression"))
591 , mxSbPngCompression(m_xBuilder->weld_scale("compressionpngsb"))
592 , mxNfPngCompression(m_xBuilder->weld_spin_button("compressionpngnf"))
593 , mxSbJpgWebpCompression(m_xBuilder->weld_scale("compressionjpgwebpsb"))
594 , mxNfJpgWebpCompression(m_xBuilder->weld_spin_button("compressionjpgwebpnf"))
595 , mxCbLossless(m_xBuilder->weld_check_button("losslesscb"))
596 , mxMode(m_xBuilder->weld_widget("mode"))
597 , mxCbInterlaced(m_xBuilder->weld_check_button("interlacedcb"))
598 , mxBMPCompression(m_xBuilder->weld_widget("bmpcompression"))
599 , mxCbRLEEncoding(m_xBuilder->weld_check_button("rlecb"))
600 , mxDrawingObjects(m_xBuilder->weld_widget("drawingobjects"))
601 , mxCbSaveTransparency(m_xBuilder->weld_check_button("savetransparencycb"))
602 , mxEncoding(m_xBuilder->weld_widget("encoding"))
603 , mxRbBinary(m_xBuilder->weld_radio_button("binarycb"))
604 , mxRbText(m_xBuilder->weld_radio_button("textcb"))
605 , mxEPSGrid(m_xBuilder->weld_widget("epsgrid"))
606 , mxModifyDimension(m_xBuilder->weld_radio_button("modifydimensionscb"))
607 , mxModifyResolution(m_xBuilder->weld_radio_button("modifyresolutioncb"))
608 , mxCbEPSPreviewTIFF(m_xBuilder->weld_check_button("tiffpreviewcb"))
609 , mxCbEPSPreviewEPSI(m_xBuilder->weld_check_button("epsipreviewcb"))
610 , mxRbEPSLevel1(m_xBuilder->weld_radio_button("level1rb"))
611 , mxRbEPSLevel2(m_xBuilder->weld_radio_button("level2rb"))
612 , mxRbEPSColorFormat1(m_xBuilder->weld_radio_button("color1rb"))
613 , mxRbEPSColorFormat2(m_xBuilder->weld_radio_button("color2rb"))
614 , mxRbEPSCompressionLZW(m_xBuilder->weld_radio_button("compresslzw"))
615 , mxRbEPSCompressionNone(m_xBuilder->weld_radio_button("compressnone"))
616 , mxInfo(m_xBuilder->weld_widget("information"))
617 , mxFtEstimatedSize(m_xBuilder->weld_label("estsizeft"))
618 , mxBtnOK(m_xBuilder->weld_button("ok"))
619{
621
622 maExt = maExt.toAsciiUpperCase();
623
624 OUString aFilterConfigPath( "Office.Common/Filter/Graphic/Export/" );
625 mpOptionsItem.reset(new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ));
626 aFilterConfigPath += maExt;
627 mpFilterOptionsItem.reset(new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ));
628
630 ? mpOptionsItem->ReadInt32("PixelExportUnit", UNIT_DEFAULT)
631 : mpOptionsItem->ReadInt32("VectorExportUnit", UNIT_DEFAULT);
632
634 mpOptionsItem->ReadInt32("MaxFilesizeForRealtimePreview", 0), sal_Int32(0));
635 mxFtEstimatedSize->set_label(" \n ");
636
637 m_xDialog->set_title(m_xDialog->get_title().replaceFirst("%1", maExt)); //Set dialog title
638
640
641 Size aResolution( Application::GetDefaultDevice()->LogicToPixel(Size(100, 100), MapMode(MapUnit::MapCM)) );
642 maResolution.Width = aResolution.Width();
643 maResolution.Height= aResolution.Height();
644
645 if ( mxGraphic.is() )
646 {
647 Graphic aGraphic(mxGraphic);
648 Size aSize = aGraphic.GetSizePixel();
649 maSize = awt::Size(aSize.getWidth(), aSize.getHeight());
650 double f100thmmPerPixel = 100000.0 / static_cast< double >( maResolution.Width );
651 maOriginalSize = awt::Size(
652 static_cast< sal_Int32 >( f100thmmPerPixel * maSize.Width ),
653 static_cast< sal_Int32 >( f100thmmPerPixel * maSize.Height ) );
654 }
655 else
656 {
658 if ( bIsPixelFormat )
659 {
660 double fPixelsPer100thmm = static_cast< double >( maResolution.Width ) / 100000.0;
661 maSize = awt::Size( static_cast< sal_Int32 >( ( fPixelsPer100thmm * maOriginalSize.Width ) + 0.5 ),
662 static_cast< sal_Int32 >( ( fPixelsPer100thmm * maOriginalSize.Height ) + 0.5 ) );
663 }
664 else
665 {
667 }
668 }
670
671 // Size
672 mxLbSizeX->connect_changed( LINK( this, ExportDialog, SelectListBoxHdl ) );
673
674 if (mpSbCompression)
675 mpSbCompression->connect_value_changed(LINK(this, ExportDialog, SbCompressionUpdateHdl));
676 if (mpNfCompression)
678
679 mxMfSizeX->connect_value_changed( LINK( this, ExportDialog, UpdateHdlMtfSizeX ) );
680 mxMfSizeY->connect_value_changed( LINK( this, ExportDialog, UpdateHdlMtfSizeY ) );
681
682 mxNfResolution->connect_value_changed( LINK( this, ExportDialog, UpdateHdlNfResolution ) );
683 mxLbResolution->connect_changed( LINK( this, ExportDialog, SelectListBoxHdl ) );
684
685 mxLbColorDepth->connect_changed( LINK( this, ExportDialog, SelectListBoxHdl ) );
686
687 mxCbInterlaced->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) );
688
689 mxCbLossless->connect_toggled( LINK( this, ExportDialog, UpdateHdlLossless ) );
690
691 mxCbSaveTransparency->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) );
692
693 mxModifyDimension->connect_toggled( LINK( this, ExportDialog, UpdateLock ) );
694 mxModifyResolution->connect_toggled( LINK( this, ExportDialog, UpdateLock ) );
695
696 mxCbEPSPreviewTIFF->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) );
697 mxCbEPSPreviewEPSI->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) );
698
699 mxRbEPSCompressionLZW->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) );
700 mxRbEPSCompressionNone->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) );
701
702 mxRbBinary->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) );
703 mxRbText->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) );
704
705 // BMP
706 mxCbRLEEncoding->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) );
707
708 // EPS
709 mxRbEPSLevel1->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) );
710 mxRbEPSLevel2->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) );
711
712 mxBtnOK->connect_clicked( LINK( this, ExportDialog, OK ) );
713
715}
716
718{
719 sal_Int32 nUnit = mnInitialResolutionUnit;
720 if (nUnit == UNIT_DEFAULT)
721 nUnit = GetDefaultUnit();
722
723 if (!mbIsPixelFormat)
724 {
725 mxFtResolution->hide();
726 mxNfResolution->hide();
727 mxLbResolution->hide();
728 mxLbSizeX->remove( UNIT_PIXEL ); // removing pixel
729 if ( nUnit >= UNIT_PIXEL )
730 nUnit = UNIT_CM;
731 }
732 else if ( nUnit > UNIT_MAX_ID )
733 nUnit = UNIT_PIXEL;
734 if ( nUnit < 0 )
735 nUnit = UNIT_CM;
736 mxLbSizeX->set_active( static_cast< sal_uInt16 >( nUnit ) );
737
738 if ( !mbIsPixelFormat ) // TODO: (metafileresolutionsupport) should be supported for vector formats also... this makes
739 return;
740
741// sense eg for bitmap fillings in metafiles, to preserve high dpi output
742 // (atm without special vector support the bitmaps are rendered with 96dpi)
743 sal_Int32 nResolution = mpOptionsItem->ReadInt32("PixelExportResolution", 96);
744 if ( nResolution < 1 )
745 nResolution = 96;
746 mxNfResolution->set_value( nResolution );
747
748 sal_Int32 nResolutionUnit = mpOptionsItem->ReadInt32("PixelExportResolutionUnit", 1);
749 if ( ( nResolutionUnit < 0 ) || ( nResolutionUnit > 2 ) )
750 nResolutionUnit = 1;
751 mxLbResolution->set_active( static_cast< sal_uInt16 >( nResolutionUnit ) );
752}
753
755{
756 switch( mnFormat )
757 {
758 case FORMAT_JPG :
759 {
760 sal_Int32 nColor = mpFilterOptionsItem->ReadInt32("ColorMode", 0);
761 if ( nColor == 1 )
762 nColor = 0;
763 else
764 nColor = 1;
765 mxLbColorDepth->append_text( ms8BitGrayscale );
766 mxLbColorDepth->append_text( ms24BitColor );
767 mxLbColorDepth->set_active( nColor );
768 mxColorDepth->show();
769
770 // Quality
771 mxJPGWEBPQuality->show();
772 sal_Int32 nQuality = mpFilterOptionsItem->ReadInt32("Quality", 75);
773 if ((nQuality < 1 ) || (nQuality > 100))
774 nQuality = 75;
777 mpSbCompression->set_range(1, 100);
778 mpNfCompression->set_range(1, 100);
779 mpNfCompression->set_value(nQuality);
780 mxCbLossless->hide(); // only for WebP
781 }
782 break;
783 case FORMAT_PNG :
784 {
785 // Compression 1..9
786 mxPNGCompression->show();
787 sal_Int32 nCompression = mpFilterOptionsItem->ReadInt32("Compression", 6);
788 if ( ( nCompression < 1 ) || ( nCompression > 9 ) )
789 nCompression = 6;
790
795 mpNfCompression->set_value(nCompression);
796
797 // Interlaced
798 mxMode->show();
799 mxCbInterlaced->set_active(mpFilterOptionsItem->ReadInt32("Interlaced", 0) != 0);
800
801 // Transparency
802 mxDrawingObjects->show();
803 mxCbSaveTransparency->set_active(mpFilterOptionsItem->ReadInt32("Translucent", 1) != 0);
804 }
805 break;
806 case FORMAT_BMP :
807 {
808 sal_Int32 nColor = mpFilterOptionsItem->ReadInt32("Color", 0);
809 if ( nColor == 0 )
810 nColor = 6;
811 else
812 nColor--;
813 mxLbColorDepth->append_text( ms1BitThreshold );
814 mxLbColorDepth->append_text( ms8BitGrayscale );
815 mxLbColorDepth->append_text( ms8BitColorPalette );
816 mxLbColorDepth->append_text( ms24BitColor );
817 mxLbColorDepth->set_active( nColor );
818 mxColorDepth->show();
819
820 // RLE coding
821 mxBMPCompression->show();
822 mxCbRLEEncoding->set_active(mpFilterOptionsItem->ReadBool("RLE_Coding", true));
823 }
824 break;
825 case FORMAT_GIF :
826 {
827 // Interlaced
828 mxMode->show();
829 mxCbInterlaced->set_active(mpFilterOptionsItem->ReadInt32("Interlaced", 1) != 0);
830
831 // Transparency
832 mxDrawingObjects->show();
833 mxCbSaveTransparency->set_active(mpFilterOptionsItem->ReadInt32("Translucent", 1) != 0);
834 }
835 break;
836 case FORMAT_EPS :
837 {
838 mxEPSGrid->show();
839
840 sal_Int32 nPreview = mpFilterOptionsItem->ReadInt32("Preview", 0);
841 sal_Int32 nVersion = mpFilterOptionsItem->ReadInt32("Version", 2);
842 sal_Int32 nColor = mpFilterOptionsItem->ReadInt32("ColorFormat", 0);
843 sal_Int32 nCompr = mpFilterOptionsItem->ReadInt32("CompressionMode", 2);
844
845 mpFilterOptionsItem->ReadInt32("TextMode", 0);
846
847 mxCbEPSPreviewTIFF->set_active( ( nPreview & 1 ) != 0 );
848 mxCbEPSPreviewEPSI->set_active( ( nPreview & 2 ) != 0 );
849
850 mxRbEPSLevel1->set_active( nVersion == 1 );
851 mxRbEPSLevel2->set_active( nVersion == 2 );
852
853 mxRbEPSColorFormat1->set_active( nColor == 1 );
854 mxRbEPSColorFormat2->set_active( nColor != 1 );
855
856 mxRbEPSCompressionLZW->set_active( nCompr == 1 );
857 mxRbEPSCompressionNone->set_active( nCompr != 1 );
858 }
859 break;
860 case FORMAT_WEBP :
861 {
862 // Quality
863 mxJPGWEBPQuality->show();
864 sal_Int32 nQuality = mpFilterOptionsItem->ReadInt32("Quality", 75);
865 if ((nQuality < 1 ) || (nQuality > 100))
866 nQuality = 75;
869 mpSbCompression->set_range(1, 100);
870 mpNfCompression->set_range(1, 100);
871 mpNfCompression->set_value(nQuality);
872
873 // Lossless
874 mxCbLossless->set_active(mpFilterOptionsItem->ReadBool("Lossless", true));
875 UpdateHdlLossless(*mxCbLossless);
876 }
877 break;
878 }
879}
880
882{
885
887 mxInfo->show();
888}
889
890static OUString ImpValueOfInKB( sal_Int64 rVal )
891{
892 double fVal( static_cast<double>( rVal ) );
893 fVal /= ( 1 << 10 );
894 fVal += 0.05;
895 OUStringBuffer aVal( OUString::number( fVal ) );
896 sal_Int32 nX( aVal.indexOf( '.' ) );
897 if ( nX > 0 )
898 aVal.setLength( nX + 2 );
899 return aVal.makeStringAndClear();
900}
901
903{
904 // Size Controls
905 if ( !mbIsPixelFormat )
906 {
907 awt::Size aSize100thmm( maSize );
908 Size aSize( OutputDevice::LogicToLogic( Size(aSize100thmm.Width * 100, aSize100thmm.Height * 100),
909 MapMode(MapUnit::Map100thMM),
910 MapMode( GetMapUnit( mxLbSizeX->get_active() ) ) ) );
911 mxMfSizeX->set_value( aSize.Width() );
912 mxMfSizeY->set_value( aSize.Height() );
913 }
914 else
915 {
916 MapUnit aMapUnit( GetMapUnit( mxLbSizeX->get_active() ) );
917 if ( aMapUnit == MapUnit::MapPixel )
918 { // calculating pixel count via resolution and original graphic size
919 mxMfSizeX->set_digits( 0 );
920 mxMfSizeY->set_digits( 0 );
921 mxMfSizeX->set_value( maSize.Width );
922 mxMfSizeY->set_value( maSize.Height );
923 }
924 else
925 {
926 mxMfSizeX->set_digits( 2 );
927 mxMfSizeY->set_digits( 2 );
928 double fRatio;
929 switch( GetMapUnit( mxLbSizeX->get_active() ) )
930 {
931 case MapUnit::MapInch : fRatio = static_cast< double >( maResolution.Width ) * 0.0254; break;
932 case MapUnit::MapMM : fRatio = static_cast< double >( maResolution.Width ) * 0.001; break;
933 case MapUnit::MapPoint :fRatio = ( static_cast< double >( maResolution.Width ) * 0.0254 ) / 72.0; break;
934 default:
935 case MapUnit::MapCM : fRatio = static_cast< double >( maResolution.Width ) * 0.01; break;
936 }
937 mxMfSizeX->set_value( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Width * 100 ) / fRatio ) + 0.5 ) );
938 mxMfSizeY->set_value( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Height * 100 ) / fRatio ) + 0.5 ) );
939 }
940 }
941 sal_Int32 nResolution = 0;
942 switch( mxLbResolution->get_active() )
943 {
944 case 0 : nResolution = maResolution.Width / 100; break; // pixels / cm
945 case 2 : nResolution = maResolution.Width; break; // pixels / meter
946 default:
947 case 1 : nResolution = static_cast< sal_Int32 >(maResolution.Width * 0.0254); break; // pixels / inch
948 }
949 mxNfResolution->set_value( nResolution );
950
953
955
956 // updating estimated size
957 sal_Int64 nRealFileSize( mpTempStream->Tell() );
958 if ( mbIsPixelFormat )
959 {
960 OUString aEst( nRealFileSize ? msEstimatedSizePix2 : msEstimatedSizePix1 );
961 sal_Int64 nRawFileSize( GetRawFileSize() );
962 sal_Int32 nInd = aEst.indexOf( "%" );
963 if (nInd != -1)
964 aEst = aEst.replaceAt( nInd, 2, ImpValueOfInKB( nRawFileSize ) );
965
966 if ( nRealFileSize && nInd != -1 )
967 {
968 nInd = aEst.indexOf( "%", nInd );
969 if (nInd != -1)
970 aEst = aEst.replaceAt( nInd, 2, ImpValueOfInKB( nRealFileSize ) );
971 }
972 mxFtEstimatedSize->set_label( aEst );
973 }
974 else
975 {
977 {
978 OUString aEst( msEstimatedSizeVec );
979 sal_Int32 nInd = aEst.indexOf( "%" );
980 if (nInd != -1)
981 aEst = aEst.replaceAt( nInd, 2, ImpValueOfInKB( nRealFileSize ) );
982 mxFtEstimatedSize->set_label( aEst );
983 }
984 }
985
986 // EPS
987 if ( mxRbEPSLevel1->get_visible() )
988 {
989 bool bEnabled = !mxRbEPSLevel1->get_active();
990 mxRbEPSColorFormat1->set_sensitive( bEnabled );
991 mxRbEPSColorFormat2->set_sensitive( bEnabled );
992 mxRbEPSCompressionLZW->set_sensitive( bEnabled );
993 mxRbEPSCompressionNone->set_sensitive( bEnabled );
994 }
995}
996
998{
999}
1000
1001/*************************************************************************
1002|*
1003|* stores values set in the ini-file
1004|*
1005\************************************************************************/
1007{
1008 updateControls();
1009}
1010
1012{
1013 updateControls();
1014}
1015
1017{
1018 updateControls();
1019}
1020
1022{
1023 mpSbCompression->set_sensitive(!mxCbLossless->get_active());
1024 mpNfCompression->set_sensitive(!mxCbLossless->get_active());
1025 updateControls();
1026}
1027
1029{
1030 if (mxModifyResolution->get_active())
1031 {
1032 mxMfSizeY->set_sensitive(false);
1033 mxMfSizeX->set_sensitive(false);
1034 mxNfResolution->set_sensitive(true);
1035 }
1036 else
1037 {
1038 mxMfSizeY->set_sensitive(true);
1039 mxMfSizeX->set_sensitive(true);
1040 mxNfResolution->set_sensitive(false);
1041 }
1042 updateControls();
1043}
1044
1045
1047{
1048 double fRatio = static_cast< double >( maOriginalSize.Height ) / maOriginalSize.Width;
1049
1050 if ( mbIsPixelFormat )
1051 {
1052 switch( GetMapUnit( mxLbSizeX->get_active() ) )
1053 {
1054 case MapUnit::MapInch : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * mxMfSizeX->get_value() / 100.0 + 0.5 ); break;
1055 case MapUnit::MapCM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.01 * mxMfSizeX->get_value() / 100.0 + 0.5 ); break;
1056 case MapUnit::MapMM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.001 * mxMfSizeX->get_value() / 100.0 + 0.5 ); break;
1057 case MapUnit::MapPoint : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * mxMfSizeX->get_value() / 100.0 * 72 + 0.5 ); break;
1058 default:
1059 case MapUnit::MapPixel : maSize.Width = mxMfSizeX->get_value(); break;
1060 }
1061 maSize.Height = static_cast< sal_Int32 >( fRatio * maSize.Width + 0.5 );
1062 }
1063 else
1064 {
1065 Fraction aFract( 1, 100 );
1066 sal_Int32 nWidth = mxMfSizeX->get_value();
1067 sal_Int32 nHeight= static_cast< sal_Int32 >( nWidth * fRatio );
1068 const Size aSource( nWidth, nHeight );
1069 MapMode aSourceMapMode( GetMapUnit( mxLbSizeX->get_active() ),Point(), aFract, aFract );
1070 Size aDest(OutputDevice::LogicToLogic(aSource, aSourceMapMode, MapMode(MapUnit::Map100thMM)));
1071
1072 maSize.Width = aDest.Width();
1073 maSize.Height = aDest.Height();
1074 }
1075 updateControls();
1076}
1077
1079{
1080 double fRatio = static_cast< double >( maOriginalSize.Width ) / maOriginalSize.Height;
1081
1082 if ( mbIsPixelFormat )
1083 {
1084 switch( GetMapUnit( mxLbSizeX->get_active() ) )
1085 {
1086 case MapUnit::MapInch : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * mxMfSizeY->get_value() / 100.0 + 0.5 ); break;
1087 case MapUnit::MapCM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.01 * mxMfSizeY->get_value() / 100.0 + 0.5 ); break;
1088 case MapUnit::MapMM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.001 * mxMfSizeY->get_value() / 100.0 + 0.5 ); break;
1089 case MapUnit::MapPoint : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * mxMfSizeY->get_value() / 100.0 * 72 + 0.5 ); break;
1090 default:
1091 case MapUnit::MapPixel : maSize.Height = mxMfSizeY->get_value(); break;
1092 }
1093 maSize.Width = static_cast< sal_Int32 >( fRatio * maSize.Height + 0.5 );
1094 }
1095 else
1096 {
1097 Fraction aFract( 1, 100 );
1098 sal_Int32 nHeight= mxMfSizeY->get_value();
1099 sal_Int32 nWidth = static_cast< sal_Int32 >( nHeight * fRatio );
1100 const Size aSource( nWidth, nHeight );
1101 MapMode aSourceMapMode( GetMapUnit( mxLbSizeX->get_active() ),Point(), aFract, aFract );
1102 Size aDest( OutputDevice::LogicToLogic(aSource, aSourceMapMode, MapMode(MapUnit::Map100thMM)) );
1103
1104 maSize.Height = aDest.Height();
1105 maSize.Width = aDest.Width();
1106 }
1107 updateControls();
1108}
1109
1110IMPL_LINK_NOARG(ExportDialog, UpdateHdlNfResolution, weld::SpinButton&, void)
1111{
1112 auto nResolution = mxNfResolution->get_value();
1113 if ( mxLbResolution->get_active() == 0 ) // pixels / cm
1114 nResolution *= 100;
1115 else if ( mxLbResolution->get_active() == 1 ) // pixels / inch
1116 nResolution = static_cast< sal_Int32 >( ( ( static_cast< double >( nResolution ) + 0.5 ) / 0.0254 ) );
1117 maResolution.Width = nResolution;
1118 maResolution.Height= nResolution;
1119
1120 updateControls();
1121}
1122
1123IMPL_LINK_NOARG(ExportDialog, SbCompressionUpdateHdl, weld::Scale&, void)
1124{
1125 mpNfCompression->set_value(mpSbCompression->get_value());
1126 updateControls();
1127}
1128
1130{
1131 // writing config parameter
1132
1133 mrFltCallPara.aFilterData = GetFilterData( true );
1134 m_xDialog->response(RET_OK);
1135}
1136
1137/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
geometry::RealSize2D maSize
Reference< XInputStream > xStream
Reference< XExecutableDialog > m_xDialog
static OutputDevice * GetDefaultDevice()
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
Size getDocumentSizeIn100mm(sal_Int32 nCurrentPage, Point *pDocumentPosition=nullptr, Point *pCalcPagePosition=nullptr, Size *pCalcPageSize=nullptr)
Graphic renderToGraphic(sal_Int32 nCurrentPage, Size aDocumentSizePixel, Size aTargetSizePixel, Color aPageColor, bool bExtOutDevData)
Size getDocumentSizeInPixels(sal_Int32 nCurrentPage)
static bool isShapeSelected(css::uno::Reference< css::drawing::XShapes > &rxShapes, css::uno::Reference< css::drawing::XShape > &rxShape, const css::uno::Reference< css::frame::XController > &rxController)
Determine whether rxController has a css::view::XSelectionSupplier at which either a css::drawing::XS...
std::unique_ptr< weld::RadioButton > mxRbEPSColorFormat1
std::unique_ptr< weld::Widget > mxJPGWEBPQuality
virtual ~ExportDialog() override
css::awt::Size maSize
std::unique_ptr< weld::SpinButton > mxMfSizeY
std::unique_ptr< weld::CheckButton > mxCbRLEEncoding
weld::SpinButton * mpNfCompression
std::unique_ptr< weld::Scale > mxSbPngCompression
css::awt::Size maResolution
std::unique_ptr< weld::RadioButton > mxRbEPSLevel1
std::unique_ptr< weld::ComboBox > mxLbColorDepth
std::unique_ptr< weld::CheckButton > mxCbEPSPreviewEPSI
std::unique_ptr< weld::RadioButton > mxRbEPSColorFormat2
std::unique_ptr< weld::RadioButton > mxModifyDimension
std::unique_ptr< weld::RadioButton > mxRbBinary
std::unique_ptr< SvMemoryStream > mpTempStream
weld::Scale * mpSbCompression
OUString ms8BitGrayscale
std::unique_ptr< weld::RadioButton > mxRbEPSLevel2
std::unique_ptr< weld::RadioButton > mxRbText
std::unique_ptr< weld::Widget > mxColorDepth
std::unique_ptr< weld::SpinButton > mxNfJpgWebpCompression
OUString ms1BitThreshold
std::unique_ptr< weld::Widget > mxMode
std::unique_ptr< weld::ComboBox > mxLbResolution
css::uno::Sequence< css::beans::PropertyValue > GetFilterData(bool bUpdateConfig)
css::uno::Reference< css::drawing::XShapes > mxShapes
void setupSizeControls()
OUString msEstimatedSizePix1
std::unique_ptr< weld::CheckButton > mxCbInterlaced
std::unique_ptr< weld::RadioButton > mxRbEPSCompressionLZW
std::unique_ptr< weld::Widget > mxEPSGrid
std::unique_ptr< weld::CheckButton > mxCbSaveTransparency
OUString msEstimatedSizePix2
std::unique_ptr< weld::Widget > mxDrawingObjects
std::unique_ptr< weld::RadioButton > mxModifyResolution
std::unique_ptr< weld::Widget > mxBMPCompression
std::unique_ptr< weld::Widget > mxPNGCompression
std::unique_ptr< weld::SpinButton > mxNfResolution
OUString msEstimatedSizeVec
sal_uInt32 GetRawFileSize() const
void updateControls()
ExportDialog(FltCallDialogParameter &rPara, css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::lang::XComponent > &rxSourceDocument, bool bExportSelection, bool bIsExportVectorFormat, bool bGraphicsSource, const css::uno::Reference< css::graphic::XGraphic > &rxGraphic)
void GetGraphicStream()
OUString maExt
std::unique_ptr< weld::Label > mxFtEstimatedSize
css::uno::Reference< css::drawing::XDrawPage > mxPage
css::uno::Reference< css::drawing::XShape > mxShape
std::unique_ptr< weld::Label > mxFtResolution
const css::uno::Reference< css::lang::XComponent > & mxSourceDocument
sal_Int32 GetDefaultUnit() const
std::unique_ptr< weld::SpinButton > mxNfPngCompression
bool mbIsPixelFormat
std::unique_ptr< weld::Widget > mxInfo
sal_Int16 mnFormat
css::awt::Size GetOriginalSize()
std::unique_ptr< weld::RadioButton > mxRbEPSCompressionNone
css::awt::Size maOriginalSize
void GetGraphicSource()
std::unique_ptr< weld::Scale > mxSbJpgWebpCompression
std::unique_ptr< weld::ComboBox > mxLbSizeX
std::unique_ptr< weld::Button > mxBtnOK
std::unique_ptr< weld::CheckButton > mxCbLossless
OUString ms8BitColorPalette
sal_Int32 mnInitialResolutionUnit
const css::uno::Reference< css::uno::XComponentContext > mxContext
const css::uno::Reference< css::graphic::XGraphic > & mxGraphic
bool mbGraphicsSource
void createFilterOptions()
bool mbExportSelection
void setupControls()
std::unique_ptr< FilterConfigItem > mpOptionsItem
std::unique_ptr< weld::SpinButton > mxMfSizeX
FltCallDialogParameter & mrFltCallPara
OUString ms24BitColor
std::unique_ptr< FilterConfigItem > mpFilterOptionsItem
sal_Int32 mnMaxFilesizeForRealtimePreview
std::unique_ptr< weld::CheckButton > mxCbEPSPreviewTIFF
bool IsTempExportAvailable() const
void WriteBool(const OUString &rKey, bool bValue)
void WriteInt32(const OUString &rKey, sal_Int32 nValue)
const css::uno::Sequence< css::beans::PropertyValue > & GetFilterData() const
sal_uInt16 GetExportFormatNumberForShortName(std::u16string_view rShortName)
static GraphicFilter & GetGraphicFilter()
bool IsExportPixelFormat(sal_uInt16 nFormat)
ErrCode ExportGraphic(const Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData=nullptr)
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
GraphicType GetType() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
Size GetSizePixel(const OutputDevice *pRefDevice=nullptr) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
constexpr tools::Long Width() const
double get(sal_uInt16 nRow, sal_uInt16 nColumn) const
TYPE getWidth() const
void expand(const Tuple2D< TYPE > &rTuple)
TYPE getHeight() const
std::shared_ptr< weld::Dialog > m_xDialog
virtual void set_range(int min, int max)=0
void connect_value_changed(const Link< Scale &, void > &rLink)
virtual int get_value() const=0
virtual void set_value(int value)=0
virtual void set_value(sal_Int64 value)=0
virtual sal_Int64 get_value() const=0
virtual void set_range(sal_Int64 min, sal_Int64 max)=0
void connect_value_changed(const Link< SpinButton &, void > &rLink)
virtual bool get_visible() const=0
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
int nCount
uno::Reference< uno::XComponentContext > mxContext
float u
#define OK
sal_Int16 nVersion
#define FORMAT_WMF
#define FORMAT_WEBP
#define UNIT_MAX_ID
static basegfx::B2DRange GetShapeRangeForXShape(const uno::Reference< drawing::XShape > &rxShape, const uno::Reference< graphic::XPrimitiveFactory2D > &rxPrimitiveFactory2D, const uno::Sequence< beans::PropertyValue > &rViewInformation)
#define UNIT_POINT
static MapUnit GetMapUnit(sal_Int32 nUnit)
#define FORMAT_TIF
#define UNIT_DEFAULT
#define FORMAT_EMF
#define UNIT_MM
#define FORMAT_UNKNOWN
#define FORMAT_BMP
static OUString ImpValueOfInKB(sal_Int64 rVal)
#define FORMAT_JPG
static sal_Int16 GetFilterFormat(std::u16string_view rExt)
#define UNIT_INCH
#define FORMAT_SVG
#define FORMAT_EPS
IMPL_LINK_NOARG(ExportDialog, SelectHdl, weld::SpinButton &, void)
#define FORMAT_GIF
#define UNIT_CM
#define FORMAT_PNG
#define UNIT_PIXEL
sal_Int16 nValue
uno::Reference< graphic::XGraphic > mxGraphic
sal_Int32 nIndex
MapUnit
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
css::uno::Sequence< css::beans::PropertyValue > aFilterData
Reference< XController > xController
Reference< XModel > xModel
OUString SvtResId(TranslateId aId)
Definition: svtresid.cxx:24
#define SAL_MAX_UINT32
RET_OK