LibreOffice Module vcl (master) 1
printdlg.hxx
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#ifndef VCL_INC_NEWPRINTDLG_HXX
21#define VCL_INC_NEWPRINTDLG_HXX
22
23#include <vcl/bitmapex.hxx>
24#include <vcl/gdimtf.hxx>
25#include <vcl/idle.hxx>
26#include <vcl/print.hxx>
27#include <vcl/customweld.hxx>
28#include <vcl/weld.hxx>
29#include <map>
30
31namespace vcl {
32 class PrintDialog;
33}
34
35namespace vcl
36{
38 {
39 friend class MoreOptionsDialog;
40 public:
41
43 {
48 sal_Int32 mnDPIX;
49 sal_Int32 mnDPIY;
53
54 OUString maHorzText;
55 OUString maVertText;
56
58
59 public:
61 virtual ~PrintPreviewWindow() override;
62
63 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
64 virtual bool Command( const CommandEvent& ) override;
65 virtual void Resize() override;
66
67 void setPreview( const GDIMetaFile&, const Size& i_rPaperSize,
68 std::u16string_view i_rPaperName,
69 const OUString& i_rNoPageString,
70 sal_Int32 i_nDPIX, sal_Int32 i_nDPIY,
71 bool i_bGreyscale
72 );
73 };
74
76 {
78 int mnRows;
80 public:
82
83 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
84
85 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
86
87 void setValues( NupOrderType i_nOrderMode, int i_nColumns, int i_nRows )
88 {
89 mnOrderMode = i_nOrderMode;
90 mnRows = i_nRows;
91 mnColumns = i_nColumns;
92 Invalidate();
93 }
94 };
95
96 PrintDialog(weld::Window*, std::shared_ptr<PrinterController> );
97 virtual ~PrintDialog() override;
98
99 bool isPrintToFile() const;
100 bool isCollate() const;
101 bool isSingleJobs() const;
102 bool hasPreview() const;
103
104 void setPaperSizes();
105 void previewForward();
106 void previewBackward();
107 void previewFirst();
108 void previewLast();
109
110 private:
111
112 std::unique_ptr<weld::Builder> mxCustomOptionsUIBuilder;
113
114 std::shared_ptr<PrinterController> maPController;
115
116 std::unique_ptr<weld::Notebook> mxTabCtrl;
117 std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow;
118 std::unique_ptr<weld::Frame> mxPageLayoutFrame;
119 std::unique_ptr<weld::ComboBox> mxPrinters;
120 std::unique_ptr<weld::Label> mxStatusTxt;
121 std::unique_ptr<weld::Button> mxSetupButton;
122
123 std::unique_ptr<weld::SpinButton> mxCopyCountField;
124 std::unique_ptr<weld::CheckButton> mxCollateBox;
125 std::unique_ptr<weld::Image> mxCollateImage;
126 std::unique_ptr<weld::Entry> mxPageRangeEdit;
127 std::unique_ptr<weld::RadioButton> mxPageRangesRadioButton;
128 std::unique_ptr<weld::ComboBox> mxPaperSidesBox;
129 std::unique_ptr<weld::CheckButton> mxSingleJobsBox;
130 std::unique_ptr<weld::CheckButton> mxReverseOrderBox;
131
132 std::unique_ptr<weld::Button> mxOKButton;
133 std::unique_ptr<weld::Button> mxCancelButton;
134 std::unique_ptr<weld::Button> mxHelpButton;
135
136 std::unique_ptr<weld::Button> mxBackwardBtn;
137 std::unique_ptr<weld::Button> mxForwardBtn;
138 std::unique_ptr<weld::Button> mxFirstBtn;
139 std::unique_ptr<weld::Button> mxLastBtn;
140
141 std::unique_ptr<weld::CheckButton> mxPreviewBox;
142 std::unique_ptr<weld::Label> mxNumPagesText;
143 std::unique_ptr<PrintPreviewWindow> mxPreview;
144 std::unique_ptr<weld::CustomWeld> mxPreviewWindow;
145 std::unique_ptr<weld::Entry> mxPageEdit;
146
147 std::unique_ptr<weld::RadioButton> mxPagesBtn;
148 std::unique_ptr<weld::RadioButton> mxBrochureBtn;
149 std::unique_ptr<weld::Label> mxPagesBoxTitleTxt;
150 std::unique_ptr<weld::ComboBox> mxNupPagesBox;
151
152 // controls for "Custom" page mode
153 std::unique_ptr<weld::Label> mxNupNumPagesTxt;
154 std::unique_ptr<weld::SpinButton> mxNupColEdt;
155 std::unique_ptr<weld::Label> mxNupTimesTxt;
156 std::unique_ptr<weld::SpinButton> mxNupRowsEdt;
157 std::unique_ptr<weld::Label> mxPageMarginTxt1;
158 std::unique_ptr<weld::MetricSpinButton> mxPageMarginEdt;
159 std::unique_ptr<weld::Label> mxPageMarginTxt2;
160 std::unique_ptr<weld::Label> mxSheetMarginTxt1;
161 std::unique_ptr<weld::MetricSpinButton> mxSheetMarginEdt;
162 std::unique_ptr<weld::Label> mxSheetMarginTxt2;
163 std::unique_ptr<weld::ComboBox> mxPaperSizeBox;
164 std::unique_ptr<weld::ComboBox> mxOrientationBox;
165
166 // page order ("left to right, then down")
167 std::unique_ptr<weld::Label> mxNupOrderTxt;
168 std::unique_ptr<weld::ComboBox> mxNupOrderBox;
169 std::unique_ptr<ShowNupOrderWindow> mxNupOrder;
170 std::unique_ptr<weld::CustomWeld> mxNupOrderWin;
172 std::unique_ptr<weld::CheckButton> mxBorderCB;
173 std::unique_ptr<weld::Expander> mxRangeExpander;
174 std::unique_ptr<weld::Expander> mxLayoutExpander;
175 std::unique_ptr<weld::Widget> mxCustom;
176
178 OUString maPrintText;
179 OUString maDefPrtText;
180
181 OUString maPageStr;
182 OUString maNoPageStr;
184 sal_Int32 mnCurPage;
185 sal_Int32 mnCachedPages;
186
188
189 std::vector<std::unique_ptr<weld::Widget>>
191
192 std::map<weld::Widget*, OUString>
194 std::map<OUString, std::vector<weld::Widget*>>
196 std::map<weld::Widget*, sal_Int32>
198
203
205
207
209 DECL_LINK(updatePreviewIdle, Timer*, void);
211 DECL_LINK(updatePreviewNoCacheIdle, Timer*, void);
212
213 DECL_LINK( ClickHdl, weld::Button&, void );
214 DECL_LINK( SelectHdl, weld::ComboBox&, void );
215 DECL_LINK( ActivateHdl, weld::Entry&, bool );
216 DECL_LINK( FocusOutHdl, weld::Widget&, void );
217 DECL_LINK( SpinModifyHdl, weld::SpinButton&, void );
218 DECL_LINK( MetricSpinModifyHdl, weld::MetricSpinButton&, void );
219 DECL_LINK( ToggleHdl, weld::Toggleable&, void );
220
221 DECL_LINK( UIOption_CheckHdl, weld::Toggleable&, void );
222 DECL_LINK( UIOption_RadioHdl, weld::Toggleable&, void );
223 DECL_LINK( UIOption_SelectHdl, weld::ComboBox&, void );
224 DECL_LINK( UIOption_SpinModifyHdl, weld::SpinButton&, void );
225 DECL_LINK( UIOption_EntryModifyHdl, weld::Entry&, void );
226
227 css::beans::PropertyValue* getValueForWindow(weld::Widget*) const;
228
229 void preparePreview( bool i_bMayUseCache );
230 void setupPaperSidesBox();
231 void storeToSettings();
232 void readFromSettings();
233 void setPaperOrientation( Orientation eOrientation, bool fromUser );
234 void updateOrientationBox( bool bAutomatic = true );
235 bool hasOrientationChanged() const;
236 void setPreviewText();
237 void updatePrinterText();
240 void makeEnabled( weld::Widget* );
241 void updateWindowFromProperty( const OUString& );
243 void showAdvancedControls( bool );
244 void updateNup( bool i_bMayUseCache = true );
245 void updateNupFromPages( bool i_bMayUseCache = true );
246 void enableNupControls( bool bEnable );
247 void setupOptionalUI();
248 Size const & getJobPageSize();
249
250 };
251
253 {
254 OUString maStr;
256 sal_Int32 mnCur;
257 sal_Int32 mnMax;
258
259 std::unique_ptr<weld::Label> mxText;
260 std::unique_ptr<weld::ProgressBar> mxProgress;
261 std::unique_ptr<weld::Button> mxButton;
262
263 DECL_LINK( ClickHdl, weld::Button&, void );
264
265 public:
266 PrintProgressDialog(weld::Window* i_pParent, int i_nMax);
267 virtual ~PrintProgressDialog() override;
268 bool isCanceled() const { return mbCanceled; }
269 void setProgress( int i_nCurrent );
270 void tick();
271 };
272}
273
274#endif // VCL_INC_NEWPRINTDLG_HXX
275
276/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:35
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
Definition: timer.hxx:27
virtual ~PrintPreviewWindow() override
Definition: printdlg.cxx:80
virtual void Resize() override
Definition: printdlg.cxx:84
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: printdlg.cxx:121
PrintPreviewWindow(PrintDialog *pDialog)
Definition: printdlg.cxx:71
void setPreview(const GDIMetaFile &, const Size &i_rPaperSize, std::u16string_view i_rPaperName, const OUString &i_rNoPageString, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, bool i_bGreyscale)
Definition: printdlg.cxx:210
virtual bool Command(const CommandEvent &) override
Definition: printdlg.cxx:196
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &) override
Definition: printdlg.cxx:455
void setValues(NupOrderType i_nOrderMode, int i_nColumns, int i_nRows)
Definition: printdlg.hxx:87
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: printdlg.cxx:447
DECL_LINK(MetricSpinModifyHdl, weld::MetricSpinButton &, void)
std::unique_ptr< weld::Image > mxCollateImage
Definition: printdlg.hxx:125
std::unique_ptr< weld::CheckButton > mxSingleJobsBox
Definition: printdlg.hxx:129
void updateOrientationBox(bool bAutomatic=true)
Definition: printdlg.cxx:1006
std::unique_ptr< weld::Label > mxNupNumPagesTxt
Definition: printdlg.hxx:153
std::unique_ptr< weld::Frame > mxPageLayoutFrame
Definition: printdlg.hxx:118
void setupPaperSidesBox()
Definition: printdlg.cxx:738
DECL_LINK(ToggleHdl, weld::Toggleable &, void)
std::unique_ptr< weld::Label > mxNupOrderTxt
Definition: printdlg.hxx:167
bool hasPreview() const
Definition: printdlg.cxx:1784
std::unique_ptr< weld::MetricSpinButton > mxPageMarginEdt
Definition: printdlg.hxx:158
bool mbCollateAlwaysOff
Definition: printdlg.hxx:187
OUString maDefPrtText
Definition: printdlg.hxx:179
DECL_LINK(UIOption_SelectHdl, weld::ComboBox &, void)
std::vector< std::unique_ptr< weld::Widget > > maExtraControls
Definition: printdlg.hxx:190
Idle maUpdatePreviewNoCacheIdle
Definition: printdlg.hxx:210
void updateWindowFromProperty(const OUString &)
Definition: printdlg.cxx:1717
std::unique_ptr< weld::RadioButton > mxPageRangesRadioButton
Definition: printdlg.hxx:127
std::unique_ptr< weld::Entry > mxPageEdit
Definition: printdlg.hxx:145
bool isSingleJobs() const
Definition: printdlg.cxx:1779
std::unique_ptr< weld::CustomWeld > mxNupOrderWin
Definition: printdlg.hxx:170
void enableNupControls(bool bEnable)
Definition: printdlg.cxx:1274
PrintDialog(weld::Window *, std::shared_ptr< PrinterController >)
Definition: printdlg.cxx:527
std::unique_ptr< weld::MetricSpinButton > mxSheetMarginEdt
Definition: printdlg.hxx:161
void showAdvancedControls(bool)
Definition: printdlg.cxx:1293
Size maFirstPageSize
internal, used for automatic Nup-Portrait/landscape
Definition: printdlg.hxx:202
std::unique_ptr< weld::ComboBox > mxPrinters
Definition: printdlg.hxx:119
std::unique_ptr< weld::Notebook > mxTabCtrl
Definition: printdlg.hxx:116
bool hasOrientationChanged() const
Definition: printdlg.cxx:1019
std::unique_ptr< weld::ComboBox > mxNupPagesBox
Definition: printdlg.hxx:150
std::shared_ptr< PrinterController > maPController
Definition: printdlg.hxx:114
void updateNup(bool i_bMayUseCache=true)
Definition: printdlg.cxx:1117
std::unique_ptr< weld::CheckButton > mxBorderCB
border around each page
Definition: printdlg.hxx:172
std::unique_ptr< weld::Label > mxPageMarginTxt1
Definition: printdlg.hxx:157
std::unique_ptr< weld::Label > mxPagesBoxTitleTxt
Definition: printdlg.hxx:149
std::unique_ptr< weld::SpinButton > mxNupColEdt
Definition: printdlg.hxx:154
std::unique_ptr< weld::Button > mxBackwardBtn
Definition: printdlg.hxx:136
sal_Int32 mnCurPage
Definition: printdlg.hxx:184
virtual ~PrintDialog() override
Definition: printdlg.cxx:730
std::map< weld::Widget *, OUString > maControlToPropertyMap
Definition: printdlg.hxx:193
void makeEnabled(weld::Widget *)
Definition: printdlg.cxx:1706
std::map< OUString, std::vector< weld::Widget * > > maPropertyToWindowMap
Definition: printdlg.hxx:195
std::unique_ptr< weld::ComboBox > mxNupOrderBox
Definition: printdlg.hxx:168
std::unique_ptr< weld::ComboBox > mxOrientationBox
Definition: printdlg.hxx:164
std::unique_ptr< weld::SpinButton > mxNupRowsEdt
Definition: printdlg.hxx:156
std::unique_ptr< weld::Button > mxHelpButton
Definition: printdlg.hxx:134
DECL_LINK(ClickHdl, weld::Button &, void)
std::unique_ptr< weld::CheckButton > mxCollateBox
Definition: printdlg.hxx:124
Idle maUpdatePreviewIdle
Definition: printdlg.hxx:208
void previewBackward()
Definition: printdlg.cxx:2175
std::unique_ptr< weld::Button > mxSetupButton
Definition: printdlg.hxx:121
std::unique_ptr< weld::Button > mxFirstBtn
Definition: printdlg.hxx:138
OUString maPrintText
Definition: printdlg.hxx:178
std::unique_ptr< weld::CheckButton > mxReverseOrderBox
Definition: printdlg.hxx:130
std::unique_ptr< weld::Label > mxSheetMarginTxt1
Definition: printdlg.hxx:160
DECL_LINK(updatePreviewNoCacheIdle, Timer *, void)
std::unique_ptr< weld::Button > mxLastBtn
Definition: printdlg.hxx:139
std::unique_ptr< weld::SpinButton > mxCopyCountField
Definition: printdlg.hxx:123
friend class MoreOptionsDialog
Definition: printdlg.hxx:39
std::unique_ptr< weld::Label > mxSheetMarginTxt2
Definition: printdlg.hxx:162
void setPreviewText()
Definition: printdlg.cxx:922
void setPaperOrientation(Orientation eOrientation, bool fromUser)
Definition: printdlg.cxx:1029
OUString maNoPageStr
Definition: printdlg.hxx:182
void previewForward()
Definition: printdlg.cxx:2165
std::unique_ptr< weld::ComboBox > mxPaperSidesBox
Definition: printdlg.hxx:128
std::unique_ptr< weld::Builder > mxCustomOptionsUIBuilder
Definition: printdlg.hxx:112
void setupOptionalUI()
Definition: printdlg.cxx:1324
sal_Int32 mnCachedPages
Definition: printdlg.hxx:185
std::unique_ptr< weld::RadioButton > mxPagesBtn
Definition: printdlg.hxx:147
bool isPrintToFile() const
Definition: printdlg.cxx:1769
std::unique_ptr< weld::Label > mxNupTimesTxt
Definition: printdlg.hxx:155
std::unique_ptr< weld::RadioButton > mxBrochureBtn
Definition: printdlg.hxx:148
DECL_LINK(UIOption_EntryModifyHdl, weld::Entry &, void)
std::unique_ptr< weld::Label > mxStatusTxt
Definition: printdlg.hxx:120
OUString maPrintToFileText
Definition: printdlg.hxx:177
std::map< weld::Widget *, sal_Int32 > maControlToNumValMap
Definition: printdlg.hxx:197
DECL_LINK(FocusOutHdl, weld::Widget &, void)
std::unique_ptr< ShowNupOrderWindow > mxNupOrder
Definition: printdlg.hxx:169
bool isCollate() const
Definition: printdlg.cxx:1774
std::unique_ptr< weld::ScrolledWindow > mxScrolledWindow
Definition: printdlg.hxx:117
std::unique_ptr< weld::Expander > mxRangeExpander
Definition: printdlg.hxx:173
void checkControlDependencies()
Definition: printdlg.cxx:1036
std::unique_ptr< weld::ComboBox > mxPaperSizeBox
Definition: printdlg.hxx:163
DECL_LINK(UIOption_CheckHdl, weld::Toggleable &, void)
DECL_LINK(SelectHdl, weld::ComboBox &, void)
void preparePreview(bool i_bMayUseCache)
Definition: printdlg.cxx:938
OUString maPageStr
Definition: printdlg.hxx:181
Size maNupLandscapeSize
Definition: printdlg.hxx:200
void storeToSettings()
Definition: printdlg.cxx:754
std::unique_ptr< PrintPreviewWindow > mxPreview
Definition: printdlg.hxx:143
Size maNupPortraitSize
Definition: printdlg.hxx:199
DECL_LINK(UIOption_RadioHdl, weld::Toggleable &, void)
void initFromMultiPageSetup(const vcl::PrinterController::MultiPageSetup &)
Definition: printdlg.cxx:1080
std::unique_ptr< weld::Expander > mxLayoutExpander
Definition: printdlg.hxx:174
css::beans::PropertyValue * getValueForWindow(weld::Widget *) const
Definition: printdlg.cxx:1789
DECL_LINK(ActivateHdl, weld::Entry &, bool)
std::unique_ptr< weld::Label > mxPageMarginTxt2
Definition: printdlg.hxx:159
std::unique_ptr< weld::Entry > mxPageRangeEdit
Definition: printdlg.hxx:126
std::unique_ptr< weld::Widget > mxCustom
Definition: printdlg.hxx:175
void updateNupFromPages(bool i_bMayUseCache=true)
Definition: printdlg.cxx:1173
void readFromSettings()
Definition: printdlg.cxx:793
std::unique_ptr< weld::CustomWeld > mxPreviewWindow
Definition: printdlg.hxx:144
void checkOptionalControlDependencies()
Definition: printdlg.cxx:1058
std::unique_ptr< weld::Button > mxForwardBtn
Definition: printdlg.hxx:137
void updatePrinterText()
Definition: printdlg.cxx:904
void setPaperSizes()
Definition: printdlg.cxx:849
DECL_LINK(SpinModifyHdl, weld::SpinButton &, void)
std::unique_ptr< weld::Button > mxCancelButton
Definition: printdlg.hxx:133
DECL_LINK(updatePreviewIdle, Timer *, void)
std::unique_ptr< weld::Button > mxOKButton
Definition: printdlg.hxx:132
Size const & getJobPageSize()
Definition: printdlg.cxx:512
OUString maNoPreviewStr
Definition: printdlg.hxx:183
std::unique_ptr< weld::Label > mxNumPagesText
Definition: printdlg.hxx:142
DECL_LINK(UIOption_SpinModifyHdl, weld::SpinButton &, void)
std::unique_ptr< weld::CheckButton > mxPreviewBox
Definition: printdlg.hxx:141
bool mbShowLayoutFrame
Definition: printdlg.hxx:204
void setProgress(int i_nCurrent)
Definition: printdlg.cxx:2245
bool isCanceled() const
Definition: printdlg.hxx:268
DECL_LINK(ClickHdl, weld::Button &, void)
std::unique_ptr< weld::Button > mxButton
Definition: printdlg.hxx:261
std::unique_ptr< weld::Label > mxText
Definition: printdlg.hxx:259
std::unique_ptr< weld::ProgressBar > mxProgress
Definition: printdlg.hxx:260
virtual ~PrintProgressDialog() override
Definition: printdlg.cxx:2236
PrintProgressDialog(weld::Window *i_pParent, int i_nMax)
Definition: printdlg.cxx:2207
A widget used to choose from a list of items.
Definition: weld.hxx:713
NupOrderType
Definition: print.hxx:312
Paper
Orientation
Definition: prntypes.hxx:31