calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / vcl / inc / printdlg.hxx
blobfc4085a99b4a526d9d251de23d5b3f961415cbb8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 VCL_INC_NEWPRINTDLG_HXX
21 #define VCL_INC_NEWPRINTDLG_HXX
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>
31 namespace vcl {
32 class PrintDialog;
35 namespace vcl
37 class PrintDialog final : public weld::GenericDialogController
39 friend class MoreOptionsDialog;
40 public:
42 class PrintPreviewWindow final : public weld::CustomWidgetController
44 PrintDialog* mpDialog;
45 GDIMetaFile maMtf;
46 Size maOrigSize;
47 Size maPreviewSize;
48 sal_Int32 mnDPIX;
49 sal_Int32 mnDPIY;
50 BitmapEx maPreviewBitmap;
51 OUString maReplacementString;
52 bool mbGreyscale;
54 OUString maHorzText;
55 OUString maVertText;
57 void preparePreviewBitmap();
59 public:
60 PrintPreviewWindow(PrintDialog* pDialog);
61 virtual ~PrintPreviewWindow() override;
63 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
64 virtual bool Command( const CommandEvent& ) override;
65 virtual void Resize() override;
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
75 class ShowNupOrderWindow final : public weld::CustomWidgetController
77 NupOrderType mnOrderMode;
78 int mnRows;
79 int mnColumns;
80 public:
81 ShowNupOrderWindow();
83 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) 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;
90 mnRows = i_nRows;
91 mnColumns = i_nColumns;
92 Invalidate();
96 PrintDialog(weld::Window*, std::shared_ptr<PrinterController> );
97 virtual ~PrintDialog() override;
99 bool isPrintToFile() const;
100 bool isCollate() const;
101 bool isSingleJobs() const;
102 bool hasPreview() const;
104 void setPaperSizes();
105 void previewForward();
106 void previewBackward();
107 void previewFirst();
108 void previewLast();
110 private:
112 std::unique_ptr<weld::Builder> mxCustomOptionsUIBuilder;
114 std::shared_ptr<PrinterController> maPController;
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;
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;
132 std::unique_ptr<weld::Button> mxOKButton;
133 std::unique_ptr<weld::Button> mxCancelButton;
134 std::unique_ptr<weld::Button> mxHelpButton;
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;
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;
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;
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;
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;
171 /// border around each page
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;
177 OUString maPrintToFileText;
178 OUString maPrintText;
179 OUString maDefPrtText;
181 OUString maPageStr;
182 OUString maNoPageStr;
183 OUString maNoPreviewStr;
184 sal_Int32 mnCurPage;
185 sal_Int32 mnCachedPages;
187 bool mbCollateAlwaysOff;
189 std::vector<std::unique_ptr<weld::Widget>>
190 maExtraControls;
192 std::map<weld::Widget*, OUString>
193 maControlToPropertyMap;
194 std::map<OUString, std::vector<weld::Widget*>>
195 maPropertyToWindowMap;
196 std::map<weld::Widget*, sal_Int32>
197 maControlToNumValMap;
199 Size maNupPortraitSize;
200 Size maNupLandscapeSize;
201 /// internal, used for automatic Nup-Portrait/landscape
202 Size maFirstPageSize;
204 bool mbShowLayoutFrame;
206 Paper mePaper;
208 Idle maUpdatePreviewIdle;
209 DECL_LINK(updatePreviewIdle, Timer*, void);
210 Idle maUpdatePreviewNoCacheIdle;
211 DECL_LINK(updatePreviewNoCacheIdle, Timer*, void);
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 );
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 );
227 css::beans::PropertyValue* getValueForWindow(weld::Widget*) const;
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();
238 void checkControlDependencies();
239 void checkOptionalControlDependencies();
240 void makeEnabled( weld::Widget* );
241 void updateWindowFromProperty( const OUString& );
242 void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& );
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();
252 class PrintProgressDialog final : public weld::GenericDialogController
254 OUString maStr;
255 bool mbCanceled;
256 sal_Int32 mnCur;
257 sal_Int32 mnMax;
259 std::unique_ptr<weld::Label> mxText;
260 std::unique_ptr<weld::ProgressBar> mxProgress;
261 std::unique_ptr<weld::Button> mxButton;
263 DECL_LINK( ClickHdl, weld::Button&, void );
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();
274 #endif // VCL_INC_NEWPRINTDLG_HXX
276 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */