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/print.hxx>
26 #include <vcl/customweld.hxx>
27 #include <vcl/weld.hxx>
28 #include <map>
29 
30 namespace vcl {
31  class PrintDialog;
32 }
33 
34 namespace vcl
35 {
37  {
39  std::unique_ptr<weld::Button> mxOKButton;
40  std::unique_ptr<weld::Button> mxCancelButton;
41  std::unique_ptr<weld::CheckButton> mxSingleJobsBox;
42 
43  DECL_LINK( ClickHdl, weld::Button&, void );
44 
45  public:
46 
47  MoreOptionsDialog(PrintDialog* i_pParent);
48  virtual ~MoreOptionsDialog() override;
49  };
50 
52  {
53  friend class MoreOptionsDialog;
54  public:
55 
57  {
62  sal_Int32 mnDPIX;
63  sal_Int32 mnDPIY;
67 
68  OUString maHorzText;
69  OUString maVertText;
70 
71  void preparePreviewBitmap();
72 
73  public:
75  virtual ~PrintPreviewWindow() override;
76 
77  virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
78  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
79  virtual bool Command( const CommandEvent& ) override;
80  virtual void Resize() override;
81 
82  void setPreview( const GDIMetaFile&, const Size& i_rPaperSize,
83  const OUString& i_rPaperName,
84  const OUString& i_rNoPageString,
85  sal_Int32 i_nDPIX, sal_Int32 i_nDPIY,
86  bool i_bGreyscale
87  );
88  };
89 
91  {
93  int mnRows;
94  int mnColumns;
95  public:
97 
98  virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
99 
100  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
101 
102  void setValues( NupOrderType i_nOrderMode, int i_nColumns, int i_nRows )
103  {
104  mnOrderMode = i_nOrderMode;
105  mnRows = i_nRows;
106  mnColumns = i_nColumns;
107  Invalidate();
108  }
109  };
110 
111  PrintDialog(weld::Window*, const std::shared_ptr<PrinterController>&);
112  virtual ~PrintDialog() override;
113 
114  bool isPrintToFile() const;
115  bool isCollate() const;
116  bool isSingleJobs() const { return mbSingleJobs; };
117  bool hasPreview() const;
118 
119  void setPaperSizes();
120  void previewForward();
121  void previewBackward();
122  void previewFirst();
123  void previewLast();
124 
125  private:
126 
127  std::unique_ptr<weld::Builder> mxCustomOptionsUIBuilder;
128 
129  std::shared_ptr<PrinterController> maPController;
130 
131  std::unique_ptr<MoreOptionsDialog> mxMoreOptionsDlg;
132 
133  std::unique_ptr<weld::Notebook> mxTabCtrl;
134  std::unique_ptr<weld::Frame> mxPageLayoutFrame;
135  std::unique_ptr<weld::ComboBox> mxPrinters;
136  std::unique_ptr<weld::Label> mxStatusTxt;
137  std::unique_ptr<weld::Button> mxSetupButton;
138 
139  std::unique_ptr<weld::SpinButton> mxCopyCountField;
140  std::unique_ptr<weld::CheckButton> mxCollateBox;
141  std::unique_ptr<weld::Image> mxCollateImage;
142  std::unique_ptr<weld::Entry> mxPageRangeEdit;
143  std::unique_ptr<weld::RadioButton> mxPageRangesRadioButton;
144  std::unique_ptr<weld::ComboBox> mxPaperSidesBox;
145  std::unique_ptr<weld::CheckButton> mxReverseOrderBox;
146 
147  std::unique_ptr<weld::Button> mxOKButton;
148  std::unique_ptr<weld::Button> mxCancelButton;
149  std::unique_ptr<weld::Button> mxHelpButton;
150  std::unique_ptr<weld::Button> mxMoreOptionsBtn;
151 
152  std::unique_ptr<weld::Button> mxBackwardBtn;
153  std::unique_ptr<weld::Button> mxForwardBtn;
154  std::unique_ptr<weld::Button> mxFirstBtn;
155  std::unique_ptr<weld::Button> mxLastBtn;
156 
157  std::unique_ptr<weld::CheckButton> mxPreviewBox;
158  std::unique_ptr<weld::Label> mxNumPagesText;
159  std::unique_ptr<PrintPreviewWindow> mxPreview;
160  std::unique_ptr<weld::CustomWeld> mxPreviewWindow;
161  std::unique_ptr<weld::Entry> mxPageEdit;
162 
163  std::unique_ptr<weld::RadioButton> mxPagesBtn;
164  std::unique_ptr<weld::RadioButton> mxBrochureBtn;
165  std::unique_ptr<weld::Label> mxPagesBoxTitleTxt;
166  std::unique_ptr<weld::ComboBox> mxNupPagesBox;
167 
168  // controls for "Custom" page mode
169  std::unique_ptr<weld::Label> mxNupNumPagesTxt;
170  std::unique_ptr<weld::SpinButton> mxNupColEdt;
171  std::unique_ptr<weld::Label> mxNupTimesTxt;
172  std::unique_ptr<weld::SpinButton> mxNupRowsEdt;
173  std::unique_ptr<weld::Label> mxPageMarginTxt1;
174  std::unique_ptr<weld::MetricSpinButton> mxPageMarginEdt;
175  std::unique_ptr<weld::Label> mxPageMarginTxt2;
176  std::unique_ptr<weld::Label> mxSheetMarginTxt1;
177  std::unique_ptr<weld::MetricSpinButton> mxSheetMarginEdt;
178  std::unique_ptr<weld::Label> mxSheetMarginTxt2;
179  std::unique_ptr<weld::ComboBox> mxPaperSizeBox;
180  std::unique_ptr<weld::ComboBox> mxOrientationBox;
181 
182  // page order ("left to right, then down")
183  std::unique_ptr<weld::Label> mxNupOrderTxt;
184  std::unique_ptr<weld::ComboBox> mxNupOrderBox;
185  std::unique_ptr<ShowNupOrderWindow> mxNupOrder;
186  std::unique_ptr<weld::CustomWeld> mxNupOrderWin;
188  std::unique_ptr<weld::CheckButton> mxBorderCB;
189  std::unique_ptr<weld::Expander> mxRangeExpander;
190  std::unique_ptr<weld::Expander> mxLayoutExpander;
191  std::unique_ptr<weld::Widget> mxCustom;
192 
193  OUString const maPrintToFileText;
194  OUString maPrintText;
195  OUString const maDefPrtText;
196 
197  OUString maPageStr;
198  OUString const maNoPageStr;
199  OUString const maNoPreviewStr;
200  sal_Int32 mnCurPage;
201  sal_Int32 mnCachedPages;
202 
204 
205  std::vector<std::unique_ptr<weld::Widget>>
207 
208  std::map<weld::Widget*, OUString>
210  std::map<OUString, std::vector<weld::Widget*>>
212  std::map<weld::Widget*, sal_Int32>
214 
219 
222 
224 
225  DECL_LINK( ClickHdl, weld::Button&, void );
226  DECL_LINK( SelectHdl, weld::ComboBox&, void );
227  DECL_LINK( ActivateHdl, weld::Entry&, bool );
228  DECL_LINK( FocusOutHdl, weld::Widget&, void );
229  DECL_LINK( SpinModifyHdl, weld::SpinButton&, void );
230  DECL_LINK( MetricSpinModifyHdl, weld::MetricSpinButton&, void );
231  DECL_LINK( ToggleHdl, weld::ToggleButton&, void );
232 
233  DECL_LINK( UIOption_CheckHdl, weld::ToggleButton&, void );
234  DECL_LINK( UIOption_RadioHdl, weld::ToggleButton&, void );
235  DECL_LINK( UIOption_SelectHdl, weld::ComboBox&, void );
236  DECL_LINK( UIOption_SpinModifyHdl, weld::SpinButton&, void );
237  DECL_LINK( UIOption_EntryModifyHdl, weld::Entry&, void );
238 
239  DECL_LINK( ExpandHdl, weld::Expander&, void );
240 
241  css::beans::PropertyValue* getValueForWindow(weld::Widget*) const;
242 
243  void preparePreview( bool i_bMayUseCache );
244  void setupPaperSidesBox();
245  void storeToSettings();
246  void readFromSettings();
247  void setPaperOrientation( Orientation eOrientation );
248  void updateOrientationBox( bool bAutomatic = true );
249  bool hasOrientationChanged() const;
250  void checkPaperSize( Size& rPaperSize );
251  void setPreviewText();
252  void updatePrinterText();
255  void makeEnabled( weld::Widget* );
256  void updateWindowFromProperty( const OUString& );
258  void showAdvancedControls( bool );
259  void updateNup( bool i_bMayUseCache = true );
260  void updateNupFromPages( bool i_bMayUseCache = true );
261  void enableNupControls( bool bEnable );
262  void setupOptionalUI();
263  Size const & getJobPageSize();
264 
265  };
266 
268  {
269  OUString maStr;
271  sal_Int32 mnCur;
272  sal_Int32 mnMax;
273 
274  std::unique_ptr<weld::Label> mxText;
275  std::unique_ptr<weld::ProgressBar> mxProgress;
276  std::unique_ptr<weld::Button> mxButton;
277 
278  DECL_LINK( ClickHdl, weld::Button&, void );
279 
280  public:
281  PrintProgressDialog(weld::Window* i_pParent, int i_nMax);
282  virtual ~PrintProgressDialog() override;
283  bool isCanceled() const { return mbCanceled; }
284  void setProgress( int i_nCurrent );
285  void tick();
286  };
287 }
288 
289 #endif // VCL_INC_NEWPRINTDLG_HXX
290 
291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PrintPreviewWindow(PrintDialog *pDialog)
Definition: printdlg.cxx:94
bool mbShowLayoutFrame
Definition: printdlg.hxx:220
void setPaperOrientation(Orientation eOrientation)
Definition: printdlg.cxx:998
std::unique_ptr< weld::Widget > mxCustom
Definition: printdlg.hxx:191
std::unique_ptr< weld::CheckButton > mxBorderCB
border around each page
Definition: printdlg.hxx:188
std::unique_ptr< weld::Button > mxBackwardBtn
Definition: printdlg.hxx:152
std::unique_ptr< weld::ComboBox > mxNupPagesBox
Definition: printdlg.hxx:166
Orientation
Definition: Exif.hxx:25
void previewBackward()
Definition: printdlg.cxx:2149
MoreOptionsDialog(PrintDialog *i_pParent)
Definition: printdlg.cxx:64
std::shared_ptr< PrinterController > maPController
Definition: printdlg.hxx:129
std::unique_ptr< weld::MetricSpinButton > mxPageMarginEdt
Definition: printdlg.hxx:174
std::unique_ptr< weld::RadioButton > mxBrochureBtn
Definition: printdlg.hxx:164
virtual ~PrintPreviewWindow() override
Definition: printdlg.cxx:107
void checkOptionalControlDependencies()
Definition: printdlg.cxx:1032
std::unique_ptr< weld::Button > mxHelpButton
Definition: printdlg.hxx:149
std::unique_ptr< weld::Button > mxFirstBtn
Definition: printdlg.hxx:154
void showAdvancedControls(bool)
Definition: printdlg.cxx:1264
void updateNupFromPages(bool i_bMayUseCache=true)
Definition: printdlg.cxx:1144
void checkPaperSize(Size &rPaperSize)
Definition: printdlg.cxx:986
std::unique_ptr< weld::Button > mxCancelButton
Definition: printdlg.hxx:40
std::unique_ptr< weld::ComboBox > mxNupOrderBox
Definition: printdlg.hxx:184
std::unique_ptr< weld::Label > mxPageMarginTxt2
Definition: printdlg.hxx:175
std::unique_ptr< weld::Button > mxForwardBtn
Definition: printdlg.hxx:153
void setPreview(const GDIMetaFile &, const Size &i_rPaperSize, const OUString &i_rPaperName, const OUString &i_rNoPageString, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, bool i_bGreyscale)
Definition: printdlg.cxx:250
std::unique_ptr< ShowNupOrderWindow > mxNupOrder
Definition: printdlg.hxx:185
std::unique_ptr< weld::RadioButton > mxPageRangesRadioButton
Definition: printdlg.hxx:143
PrintDialog * mpParent
Definition: printdlg.hxx:38
std::unique_ptr< weld::Expander > mxRangeExpander
Definition: printdlg.hxx:189
virtual ~PrintDialog() override
Definition: printdlg.cxx:711
std::unique_ptr< weld::Expander > mxLayoutExpander
Definition: printdlg.hxx:190
std::unique_ptr< weld::RadioButton > mxPagesBtn
Definition: printdlg.hxx:163
std::map< OUString, std::vector< weld::Widget * > > maPropertyToWindowMap
Definition: printdlg.hxx:211
std::unique_ptr< weld::CheckButton > mxReverseOrderBox
Definition: printdlg.hxx:145
OUString maPrintText
Definition: printdlg.hxx:194
OUString const maPrintToFileText
Definition: printdlg.hxx:193
std::unique_ptr< weld::Button > mxCancelButton
Definition: printdlg.hxx:148
void makeEnabled(weld::Widget *)
Definition: printdlg.cxx:1680
virtual void Resize() override
Definition: printdlg.cxx:111
std::unique_ptr< weld::ComboBox > mxPaperSidesBox
Definition: printdlg.hxx:144
Paper
void previewForward()
Definition: printdlg.cxx:2139
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: printdlg.cxx:440
void setProgress(int i_nCurrent)
Definition: printdlg.cxx:2208
std::vector< std::unique_ptr< weld::Widget > > maExtraControls
Definition: printdlg.hxx:206
void updateOrientationBox(bool bAutomatic=true)
Definition: printdlg.cxx:963
std::unique_ptr< weld::Button > mxSetupButton
Definition: printdlg.hxx:137
Size const & getJobPageSize()
Definition: printdlg.cxx:505
bool hasPreview() const
Definition: printdlg.cxx:1753
std::unique_ptr< weld::ComboBox > mxOrientationBox
Definition: printdlg.hxx:180
void initFromMultiPageSetup(const vcl::PrinterController::MultiPageSetup &)
Definition: printdlg.cxx:1054
PrintProgressDialog(weld::Window *i_pParent, int i_nMax)
Definition: printdlg.cxx:2172
Size maNupPortraitSize
Definition: printdlg.hxx:215
std::unique_ptr< MoreOptionsDialog > mxMoreOptionsDlg
Definition: printdlg.hxx:131
std::unique_ptr< weld::Entry > mxPageRangeEdit
Definition: printdlg.hxx:142
std::unique_ptr< weld::CheckButton > mxSingleJobsBox
Definition: printdlg.hxx:41
std::unique_ptr< weld::Button > mxOKButton
Definition: printdlg.hxx:39
std::unique_ptr< weld::ComboBox > mxPrinters
Definition: printdlg.hxx:135
OUString const maNoPreviewStr
Definition: printdlg.hxx:199
std::unique_ptr< weld::SpinButton > mxNupRowsEdt
Definition: printdlg.hxx:172
void updatePrinterText()
Definition: printdlg.cxx:874
std::unique_ptr< weld::CustomWeld > mxPreviewWindow
Definition: printdlg.hxx:160
void storeToSettings()
Definition: printdlg.cxx:731
std::unique_ptr< weld::ProgressBar > mxProgress
Definition: printdlg.hxx:275
virtual bool Command(const CommandEvent &) override
Definition: printdlg.cxx:236
void setPreviewText()
Definition: printdlg.cxx:892
std::unique_ptr< weld::Label > mxSheetMarginTxt2
Definition: printdlg.hxx:178
DECL_LINK(ClickHdl, weld::Button &, void)
std::unique_ptr< weld::SpinButton > mxCopyCountField
Definition: printdlg.hxx:139
void setupOptionalUI()
Definition: printdlg.cxx:1295
std::unique_ptr< weld::Button > mxLastBtn
Definition: printdlg.hxx:155
OUString const maNoPageStr
Definition: printdlg.hxx:198
void checkControlDependencies()
Definition: printdlg.cxx:1016
bool hasOrientationChanged() const
Definition: printdlg.cxx:976
void setPaperSizes()
Definition: printdlg.cxx:829
std::unique_ptr< weld::Notebook > mxTabCtrl
Definition: printdlg.hxx:133
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
virtual ~MoreOptionsDialog() override
Definition: printdlg.cxx:77
bool isCanceled() const
Definition: printdlg.hxx:283
bool mbCollateAlwaysOff
Definition: printdlg.hxx:203
OUString const maDefPrtText
Definition: printdlg.hxx:195
std::unique_ptr< weld::Label > mxNumPagesText
Definition: printdlg.hxx:158
bool isPrintToFile() const
Definition: printdlg.cxx:1743
std::unique_ptr< weld::CheckButton > mxCollateBox
Definition: printdlg.hxx:140
std::unique_ptr< weld::Builder > mxCustomOptionsUIBuilder
Definition: printdlg.hxx:127
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: printdlg.cxx:148
std::unique_ptr< weld::CheckButton > mxPreviewBox
Definition: printdlg.hxx:157
std::unique_ptr< weld::Label > mxNupNumPagesTxt
Definition: printdlg.hxx:169
sal_Int32 mnCurPage
Definition: printdlg.hxx:200
std::unique_ptr< weld::Label > mxPageMarginTxt1
Definition: printdlg.hxx:173
void setValues(NupOrderType i_nOrderMode, int i_nColumns, int i_nRows)
Definition: printdlg.hxx:102
std::unique_ptr< weld::Frame > mxPageLayoutFrame
Definition: printdlg.hxx:134
std::map< weld::Widget *, OUString > maControlToPropertyMap
Definition: printdlg.hxx:209
std::unique_ptr< weld::Entry > mxPageEdit
Definition: printdlg.hxx:161
sal_Int32 mnCachedPages
Definition: printdlg.hxx:201
bool isSingleJobs() const
Definition: printdlg.hxx:116
std::unique_ptr< weld::Label > mxStatusTxt
Definition: printdlg.hxx:136
Size maNupLandscapeSize
Definition: printdlg.hxx:216
void readFromSettings()
Definition: printdlg.cxx:770
A widget used to choose from a list of items.
Definition: weld.hxx:582
std::unique_ptr< weld::Label > mxPagesBoxTitleTxt
Definition: printdlg.hxx:165
bool isCollate() const
Definition: printdlg.cxx:1748
void updateWindowFromProperty(const OUString &)
Definition: printdlg.cxx:1691
css::beans::PropertyValue * getValueForWindow(weld::Widget *) const
Definition: printdlg.cxx:1758
void enableNupControls(bool bEnable)
Definition: printdlg.cxx:1245
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: printdlg.cxx:155
std::unique_ptr< weld::CustomWeld > mxNupOrderWin
Definition: printdlg.hxx:186
void updateNup(bool i_bMayUseCache=true)
Definition: printdlg.cxx:1091
std::unique_ptr< PrintPreviewWindow > mxPreview
Definition: printdlg.hxx:159
std::unique_ptr< weld::MetricSpinButton > mxSheetMarginEdt
Definition: printdlg.hxx:177
std::unique_ptr< weld::Label > mxNupOrderTxt
Definition: printdlg.hxx:183
std::unique_ptr< weld::Label > mxSheetMarginTxt1
Definition: printdlg.hxx:176
std::unique_ptr< weld::Image > mxCollateImage
Definition: printdlg.hxx:141
std::unique_ptr< weld::Button > mxMoreOptionsBtn
Definition: printdlg.hxx:150
std::unique_ptr< weld::Label > mxNupTimesTxt
Definition: printdlg.hxx:171
std::unique_ptr< weld::Button > mxOKButton
Definition: printdlg.hxx:147
OUString maPageStr
Definition: printdlg.hxx:197
std::map< weld::Widget *, sal_Int32 > maControlToNumValMap
Definition: printdlg.hxx:213
DECL_LINK(ClickHdl, weld::Button &, void)
std::unique_ptr< weld::ComboBox > mxPaperSizeBox
Definition: printdlg.hxx:179
std::unique_ptr< weld::Button > mxButton
Definition: printdlg.hxx:276
DECL_LINK(ClickHdl, weld::Button &, void)
void setupPaperSidesBox()
Definition: printdlg.cxx:715
NupOrderType
Definition: print.hxx:387
std::unique_ptr< weld::SpinButton > mxNupColEdt
Definition: printdlg.hxx:170
Size maFirstPageSize
internal, used for automatic Nup-Portrait/landscape
Definition: printdlg.hxx:218
PrintDialog(weld::Window *, const std::shared_ptr< PrinterController > &)
Definition: printdlg.cxx:520
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &) override
Definition: printdlg.cxx:448
void preparePreview(bool i_bMayUseCache)
Definition: printdlg.cxx:898
virtual ~PrintProgressDialog() override
Definition: printdlg.cxx:2199
std::unique_ptr< weld::Label > mxText
Definition: printdlg.hxx:274