1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
23 #include <FltCallDialogParameter.hxx>
24 #include <vcl/weld.hxx>
25 #include <tools/stream.hxx>
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/drawing/XShape.hpp>
28 #include <com/sun/star/drawing/XShapes.hpp>
29 #include <com/sun/star/drawing/XDrawPage.hpp>
30 #include <com/sun/star/uno/XComponentContext.hpp>
34 /*************************************************************************
36 |* dialog to set filter options for pixel formats
38 \************************************************************************/
40 class FilterConfigItem
;
41 class ExportDialog
: public weld::GenericDialogController
45 FltCallDialogParameter
& mrFltCallPara
;
47 const css::uno::Reference
< css::uno::XComponentContext
>
49 const css::uno::Reference
< css::lang::XComponent
>&
51 const css::uno::Reference
< css::graphic::XGraphic
>&
54 OUString msEstimatedSizePix1
;
55 OUString msEstimatedSizePix2
;
56 OUString msEstimatedSizeVec
;
58 OUString ms1BitThreshold
;
59 OUString ms8BitGrayscale
;
60 OUString ms8BitColorPalette
;
61 OUString ms24BitColor
;
63 std::unique_ptr
<FilterConfigItem
> mpOptionsItem
;
64 std::unique_ptr
<FilterConfigItem
> mpFilterOptionsItem
;
68 sal_Int32 mnMaxFilesizeForRealtimePreview
;
70 std::unique_ptr
<SvMemoryStream
> mpTempStream
;
72 css::awt::Size maOriginalSize
; // the original graphic size in 1/100mm
73 css::awt::Size maSize
; // for vector graphics it always contains the logical size in 1/100mm
76 bool mbExportSelection
;
77 bool mbGraphicsSource
; // whether source document is graphics (Draw, Impress) or not (Calc, Writer)
79 sal_Int32 mnInitialResolutionUnit
;
81 // for pixel graphics it always contains the pixel count
82 css::awt::Size maResolution
; // it always contains the number of pixels per meter
84 css::uno::Reference
< css::drawing::XShape
>
86 css::uno::Reference
< css::drawing::XShapes
>
88 css::uno::Reference
< css::drawing::XDrawPage
>
91 weld::Scale
* mpSbCompression
;
92 weld::SpinButton
* mpNfCompression
;
94 std::unique_ptr
<weld::SpinButton
> mxMfSizeX
;
95 std::unique_ptr
<weld::ComboBox
> mxLbSizeX
;
96 std::unique_ptr
<weld::SpinButton
> mxMfSizeY
;
97 std::unique_ptr
<weld::Label
> mxFtResolution
;
98 std::unique_ptr
<weld::SpinButton
> mxNfResolution
;
99 std::unique_ptr
<weld::ComboBox
> mxLbResolution
;
101 std::unique_ptr
<weld::Widget
> mxColorDepth
;
102 std::unique_ptr
<weld::ComboBox
> mxLbColorDepth
;
104 std::unique_ptr
<weld::Widget
> mxJPGWEBPQuality
;
105 std::unique_ptr
<weld::Widget
> mxPNGCompression
;
107 std::unique_ptr
<weld::Scale
> mxSbPngCompression
;
108 std::unique_ptr
<weld::SpinButton
> mxNfPngCompression
;
110 std::unique_ptr
<weld::Scale
> mxSbJpgWebpCompression
;
111 std::unique_ptr
<weld::SpinButton
> mxNfJpgWebpCompression
;
113 std::unique_ptr
<weld::CheckButton
> mxCbLossless
;
115 std::unique_ptr
<weld::Widget
> mxMode
;
116 std::unique_ptr
<weld::CheckButton
> mxCbInterlaced
;
118 std::unique_ptr
<weld::Widget
> mxBMPCompression
;
119 std::unique_ptr
<weld::CheckButton
> mxCbRLEEncoding
;
121 std::unique_ptr
<weld::Widget
> mxDrawingObjects
;
122 std::unique_ptr
<weld::CheckButton
> mxCbSaveTransparency
;
124 std::unique_ptr
<weld::Widget
> mxEncoding
;
125 std::unique_ptr
<weld::RadioButton
> mxRbBinary
;
126 std::unique_ptr
<weld::RadioButton
> mxRbText
;
128 std::unique_ptr
<weld::Widget
> mxEPSGrid
;
129 std::unique_ptr
<weld::RadioButton
> mxModifyDimension
;
130 std::unique_ptr
<weld::RadioButton
> mxModifyResolution
;
131 std::unique_ptr
<weld::CheckButton
> mxCbEPSPreviewTIFF
;
132 std::unique_ptr
<weld::CheckButton
> mxCbEPSPreviewEPSI
;
133 std::unique_ptr
<weld::RadioButton
> mxRbEPSLevel1
;
134 std::unique_ptr
<weld::RadioButton
> mxRbEPSLevel2
;
135 std::unique_ptr
<weld::RadioButton
> mxRbEPSColorFormat1
;
136 std::unique_ptr
<weld::RadioButton
> mxRbEPSColorFormat2
;
137 std::unique_ptr
<weld::RadioButton
> mxRbEPSCompressionLZW
;
138 std::unique_ptr
<weld::RadioButton
> mxRbEPSCompressionNone
;
141 std::unique_ptr
<weld::Widget
> mxInfo
;
142 std::unique_ptr
<weld::Label
> mxFtEstimatedSize
;
144 std::unique_ptr
<weld::Button
> mxBtnOK
;
146 DECL_LINK(UpdateHdl
, weld::Toggleable
&, void);
147 DECL_LINK(UpdateLock
, weld::Toggleable
&, void);
148 DECL_LINK(SelectListBoxHdl
, weld::ComboBox
&, void);
149 DECL_LINK(SelectHdl
, weld::SpinButton
&, void);
150 DECL_LINK(UpdateHdlMtfSizeX
, weld::SpinButton
&, void);
151 DECL_LINK(UpdateHdlMtfSizeY
, weld::SpinButton
&, void);
152 DECL_LINK(UpdateHdlNfResolution
, weld::SpinButton
&, void);
153 DECL_LINK(SbCompressionUpdateHdl
, weld::Scale
&, void);
154 DECL_LINK(UpdateHdlLossless
, weld::Toggleable
&, void);
156 DECL_LINK(OK
, weld::Button
&, void);
158 void setupSizeControls();
159 void createFilterOptions();
160 void setupControls();
161 void updateControls();
163 void GetGraphicSource();
164 void GetGraphicStream();
165 css::uno::Sequence
< css::beans::PropertyValue
>
166 GetFilterData( bool bUpdateConfig
);
168 sal_uInt32
GetRawFileSize() const;
169 bool IsTempExportAvailable() const;
171 css::awt::Size
GetOriginalSize();
173 sal_Int32
GetDefaultUnit() const;
176 ExportDialog( FltCallDialogParameter
& rPara
,
177 css::uno::Reference
< css::uno::XComponentContext
> xContext
,
178 const css::uno::Reference
< css::lang::XComponent
>& rxSourceDocument
,
179 bool bExportSelection
, bool bIsExportVectorFormat
, bool bGraphicsSource
,
180 const css::uno::Reference
< css::graphic::XGraphic
>& rxGraphic
);
181 virtual ~ExportDialog() override
;
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */