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 .
20 #ifndef INCLUDED_VCL_INC_PRINTDLG_HXX
21 #define INCLUDED_VCL_INC_PRINTDLG_HXX
23 #include <vcl/dllapi.h>
25 #include <vcl/print.hxx>
26 #include <vcl/dialog.hxx>
27 #include <vcl/fixed.hxx>
28 #include <vcl/button.hxx>
29 #include <vcl/prgsbar.hxx>
30 #include <vcl/field.hxx>
31 #include <vcl/tabctrl.hxx>
32 #include <vcl/tabpage.hxx>
33 #include <vcl/virdev.hxx>
37 class PrintDialog
: public ModalDialog
40 class PrintPreviewWindow
: public vcl::Window
42 static const sal_Int32 PREVIEW_BITMAP_WIDTH
;
47 VclPtr
<VirtualDevice
> maPageVDev
;
48 Bitmap maPreviewBitmap
;
49 OUString maReplacementString
;
50 OUString maToolTipString
;
52 VclPtr
<FixedLine
> maHorzDim
;
53 VclPtr
<FixedLine
> maVertDim
;
55 void preparePreviewBitmap();
58 PrintPreviewWindow( vcl::Window
* pParent
);
59 virtual ~PrintPreviewWindow() override
;
60 virtual void dispose() override
;
62 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
63 virtual void Command( const CommandEvent
& ) override
;
64 virtual void Resize() override
;
65 virtual void DataChanged( const DataChangedEvent
& ) override
;
67 void setPreview( const GDIMetaFile
&, const Size
& i_rPaperSize
,
68 const OUString
& i_rPaperName
,
69 const OUString
& i_rNoPageString
,
70 sal_Int32 i_nDPIX
, sal_Int32 i_nDPIY
,
75 class ShowNupOrderWindow
: public vcl::Window
77 NupOrderType mnOrderMode
;
81 ShowNupOrderWindow( vcl::Window
* pParent
);
83 virtual Size
GetOptimalSize() const override
;
85 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& ) override
;
87 void setValues( NupOrderType i_nOrderMode
, int i_nColumns
, int i_nRows
)
89 mnOrderMode
= i_nOrderMode
;
91 mnColumns
= i_nColumns
;
101 VclPtr
<RadioButton
> mpPagesBtn
;
102 VclPtr
<RadioButton
> mpBrochureBtn
;
103 VclPtr
<FixedText
> mpPagesBoxTitleTxt
;
104 VclPtr
<ListBox
> mpNupPagesBox
;
106 // controls for "Custom" page mode
107 VclPtr
<FixedText
> mpNupNumPagesTxt
;
108 VclPtr
<NumericField
> mpNupColEdt
;
109 VclPtr
<FixedText
> mpNupTimesTxt
;
110 VclPtr
<NumericField
> mpNupRowsEdt
;
111 VclPtr
<FixedText
> mpPageMarginTxt1
;
112 VclPtr
<MetricField
> mpPageMarginEdt
;
113 VclPtr
<FixedText
> mpPageMarginTxt2
;
114 VclPtr
<FixedText
> mpSheetMarginTxt1
;
115 VclPtr
<MetricField
> mpSheetMarginEdt
;
116 VclPtr
<FixedText
> mpSheetMarginTxt2
;
117 VclPtr
<FixedText
> mpNupOrientationTxt
;
118 VclPtr
<ListBox
> mpNupOrientationBox
;
120 // page order ("left to right, then down")
121 VclPtr
<FixedText
> mpNupOrderTxt
;
122 VclPtr
<ListBox
> mpNupOrderBox
;
123 VclPtr
<ShowNupOrderWindow
> mpNupOrderWin
;
124 /// border around each page
125 VclPtr
<CheckBox
> mpBorderCB
;
127 NUpTabPage( VclBuilder
* );
129 void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup
& );
130 void enableNupControls( bool bEnable
);
132 void showAdvancedControls( bool );
138 VclPtr
<ListBox
> mpPrinters
;
139 VclPtr
<FixedText
> mpStatusTxt
;
140 VclPtr
<FixedText
> mpLocationTxt
;
141 VclPtr
<FixedText
> mpCommentTxt
;
143 VclPtr
<PushButton
> mpSetupButton
;
145 VclPtr
<NumericField
> mpCopyCountField
;
146 VclPtr
<CheckBox
> mpCollateBox
;
147 VclPtr
<FixedImage
> mpCollateImage
;
148 VclPtr
<CheckBox
> mpReverseOrderBox
;
150 BitmapEx maCollateBmp
;
151 BitmapEx maNoCollateBmp
;
153 long mnCollateUIMode
;
155 JobTabPage( VclBuilder
* );
157 void readFromSettings();
158 void storeToSettings();
164 VclPtr
<CheckBox
> mpCollateSingleJobsBox
;
165 VclPtr
<CheckBox
> mpPapersizeFromSetup
;
167 OutputOptPage( VclBuilder
* );
169 void readFromSettings();
170 void storeToSettings();
173 VclBuilder
* mpCustomOptionsUIBuilder
;
175 std::shared_ptr
<PrinterController
> maPController
;
176 VclPtr
<TabControl
> mpTabCtrl
;
177 NUpTabPage maNUpPage
;
178 JobTabPage maJobPage
;
179 OutputOptPage maOptionsPage
;
180 VclPtr
<PrintPreviewWindow
> mpPreviewWindow
;
181 VclPtr
<NumericField
> mpPageEdit
;
183 VclPtr
<FixedText
> mpNumPagesText
;
184 VclPtr
<PushButton
> mpBackwardBtn
;
185 VclPtr
<PushButton
> mpForwardBtn
;
187 VclPtr
<OKButton
> mpOKButton
;
188 VclPtr
<CancelButton
> mpCancelButton
;
189 VclPtr
<HelpButton
> mpHelpButton
;
192 OUString maNoPageStr
;
194 sal_Int32 mnCachedPages
;
196 std::map
< VclPtr
<vcl::Window
>, OUString
> maControlToPropertyMap
;
197 std::map
< OUString
, std::vector
< VclPtr
<vcl::Window
> > >
198 maPropertyToWindowMap
;
199 std::map
< VclPtr
<vcl::Window
>, sal_Int32
> maControlToNumValMap
;
200 std::set
< OUString
> maReverseDependencySet
;
202 Size maNupPortraitSize
;
203 Size maNupLandscapeSize
;
205 /// internal, used for automatic Nup-Portrait/landscape
206 Size maFirstPageSize
;
208 OUString maPrintToFileText
;
209 OUString maPrintText
;
210 OUString maDefPrtText
;
212 bool mbShowLayoutPage
;
214 Size
const & getJobPageSize();
216 void updateNupFromPages();
217 void preparePreview( bool i_bPrintChanged
= true, bool i_bMayUseCache
= false );
218 void setPreviewText();
219 void updatePrinterText();
220 void checkControlDependencies();
221 void checkOptionalControlDependencies();
222 void makeEnabled( vcl::Window
* );
223 void updateWindowFromProperty( const OUString
& );
224 void setupOptionalUI();
225 void readFromSettings();
226 void storeToSettings();
227 css::beans::PropertyValue
* getValueForWindow( vcl::Window
* ) const;
229 virtual void Resize() override
;
230 virtual void Command( const CommandEvent
& ) override
;
231 virtual void DataChanged( const DataChangedEvent
& ) override
;
233 DECL_LINK( SelectHdl
, ListBox
&, void );
234 DECL_LINK( ClickHdl
, Button
*, void );
235 DECL_LINK( ToggleHdl
, CheckBox
&, void );
236 DECL_LINK( ToggleRadioHdl
, RadioButton
&, void );
237 DECL_LINK( ModifyHdl
, Edit
&, void );
239 DECL_LINK( UIOption_CheckHdl
, CheckBox
&, void );
240 DECL_LINK( UIOption_RadioHdl
, RadioButton
&, void );
241 DECL_LINK( UIOption_SelectHdl
, ListBox
&, void );
242 DECL_LINK( UIOption_ModifyHdl
, Edit
&, void );
245 PrintDialog( vcl::Window
*, const std::shared_ptr
< PrinterController
>& );
246 virtual ~PrintDialog() override
;
247 virtual void dispose() override
;
249 bool isPrintToFile();
253 void previewForward();
254 void previewBackward();
257 class PrintProgressDialog
: public ModelessDialog
260 VclPtr
<FixedText
> mpText
;
261 VclPtr
<ProgressBar
> mpProgress
;
262 VclPtr
<CancelButton
> mpButton
;
268 DECL_LINK( ClickHdl
, Button
*, void );
271 PrintProgressDialog(vcl::Window
* i_pParent
, int i_nMax
);
272 virtual ~PrintProgressDialog() override
;
273 virtual void dispose() override
;
274 bool isCanceled() const { return mbCanceled
; }
275 void setProgress( int i_nCurrent
);
281 #endif // INCLUDED_VCL_INC_PRINTDLG_HXX
283 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */