Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_PRNDLG_HXX
30 : : #define _SV_PRNDLG_HXX
31 : :
32 : : #include <vcl/dllapi.h>
33 : :
34 : : #include "print.h"
35 : :
36 : : #include "vcl/print.hxx"
37 : : #include "vcl/dialog.hxx"
38 : : #include "vcl/fixed.hxx"
39 : : #include "vcl/button.hxx"
40 : : #include "vcl/gdimtf.hxx"
41 : : #include "vcl/lstbox.hxx"
42 : : #include "vcl/field.hxx"
43 : : #include "vcl/tabctrl.hxx"
44 : : #include "vcl/tabpage.hxx"
45 : : #include "vcl/arrange.hxx"
46 : : #include "vcl/virdev.hxx"
47 : :
48 : : #include <boost/shared_ptr.hpp>
49 : : #include <map>
50 : :
51 : : namespace vcl
52 : : {
53 : : class PrintDialog : public ModalDialog
54 : : {
55 : : class PrintPreviewWindow : public Window
56 : : {
57 : : GDIMetaFile maMtf;
58 : : Size maOrigSize;
59 : : Size maPreviewSize;
60 : : VirtualDevice maPageVDev;
61 : : rtl::OUString maReplacementString;
62 : : rtl::OUString maToolTipString;
63 : : bool mbGreyscale;
64 : : FixedLine maHorzDim;
65 : : FixedLine maVertDim;
66 : :
67 : : public:
68 : : PrintPreviewWindow( Window* pParent, const ResId& );
69 : : virtual ~PrintPreviewWindow();
70 : :
71 : : virtual void Paint( const Rectangle& rRect );
72 : : virtual void Command( const CommandEvent& );
73 : : virtual void Resize();
74 : : virtual void DataChanged( const DataChangedEvent& );
75 : :
76 : : void setPreview( const GDIMetaFile&, const Size& i_rPaperSize,
77 : : const rtl::OUString& i_rPaperName,
78 : : const rtl::OUString& i_rNoPageString,
79 : : sal_Int32 i_nDPIX, sal_Int32 i_nDPIY,
80 : : bool i_bGreyscale
81 : : );
82 : : };
83 : :
84 : : class ShowNupOrderWindow : public Window
85 : : {
86 : : int mnOrderMode;
87 : : int mnRows;
88 : : int mnColumns;
89 : : void ImplInitSettings();
90 : : public:
91 : : ShowNupOrderWindow( Window* pParent );
92 : : virtual ~ShowNupOrderWindow();
93 : :
94 : : virtual void Paint( const Rectangle& );
95 : :
96 : 0 : void setValues( int i_nOrderMode, int i_nColumns, int i_nRows )
97 : : {
98 : 0 : mnOrderMode = i_nOrderMode;
99 : 0 : mnRows = i_nRows;
100 : 0 : mnColumns = i_nColumns;
101 : 0 : Invalidate();
102 : 0 : }
103 : : };
104 : :
105 : : class NUpTabPage : public TabPage
106 : : {
107 : : public:
108 : : FixedLine maNupLine;
109 : : RadioButton maPagesBtn;
110 : : RadioButton maBrochureBtn;
111 : : FixedText maPagesBoxTitleTxt;
112 : : ListBox maNupPagesBox;
113 : :
114 : : // controls for "Custom" page mode
115 : : FixedText maNupNumPagesTxt;
116 : : NumericField maNupColEdt;
117 : : FixedText maNupTimesTxt;
118 : : NumericField maNupRowsEdt;
119 : : FixedText maPageMarginTxt1;
120 : : MetricField maPageMarginEdt;
121 : : FixedText maPageMarginTxt2;
122 : : FixedText maSheetMarginTxt1;
123 : : MetricField maSheetMarginEdt;
124 : : FixedText maSheetMarginTxt2;
125 : : FixedText maNupOrientationTxt;
126 : : ListBox maNupOrientationBox;
127 : :
128 : : // page order ("left to right, then down")
129 : : FixedText maNupOrderTxt;
130 : : ListBox maNupOrderBox;
131 : : ShowNupOrderWindow maNupOrderWin;
132 : : // border around each page
133 : : CheckBox maBorderCB;
134 : :
135 : : boost::shared_ptr< vcl::RowOrColumn > mxBrochureDep;
136 : : boost::shared_ptr< vcl::LabeledElement >mxPagesBtnLabel;
137 : :
138 : : void setupLayout();
139 : :
140 : : NUpTabPage( Window*, const ResId& );
141 : : virtual ~NUpTabPage();
142 : :
143 : : void readFromSettings();
144 : : void storeToSettings();
145 : : void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& );
146 : : void enableNupControls( bool bEnable );
147 : :
148 : : void showAdvancedControls( bool );
149 : :
150 : : // virtual void Resize();
151 : : };
152 : :
153 : : class JobTabPage : public TabPage
154 : : {
155 : : public:
156 : : FixedLine maPrinterFL;
157 : : ListBox maPrinters;
158 : : DisclosureButton maDetailsBtn;
159 : : FixedText maStatusLabel;
160 : : FixedText maStatusTxt;
161 : : FixedText maLocationLabel;
162 : : FixedText maLocationTxt;
163 : : FixedText maCommentLabel;
164 : : FixedText maCommentTxt;
165 : :
166 : : PushButton maSetupButton;
167 : :
168 : : FixedLine maCopies;
169 : : FixedLine maCopySpacer;
170 : : FixedText maCopyCount;
171 : : NumericField maCopyCountField;
172 : : CheckBox maCollateBox;
173 : : FixedImage maCollateImage;
174 : : CheckBox maReverseOrderBox;
175 : :
176 : : Image maCollateImg;
177 : : Image maNoCollateImg;
178 : :
179 : : long mnCollateUIMode;
180 : :
181 : : boost::shared_ptr<vcl::RowOrColumn> mxPrintRange;
182 : : boost::shared_ptr<vcl::WindowArranger> mxDetails;
183 : :
184 : : JobTabPage( Window*, const ResId& );
185 : : virtual ~JobTabPage();
186 : :
187 : : void readFromSettings();
188 : : void storeToSettings();
189 : :
190 : : // virtual void Resize();
191 : :
192 : : void setupLayout();
193 : : };
194 : :
195 : : class OutputOptPage : public TabPage
196 : : {
197 : : public:
198 : : FixedLine maOptionsLine;
199 : : CheckBox maToFileBox;
200 : : CheckBox maCollateSingleJobsBox;
201 : :
202 : : boost::shared_ptr<vcl::RowOrColumn> mxOptGroup;
203 : :
204 : : OutputOptPage( Window*, const ResId& );
205 : : virtual ~OutputOptPage();
206 : :
207 : : void readFromSettings();
208 : : void storeToSettings();
209 : :
210 : : // virtual void Resize();
211 : :
212 : : void setupLayout();
213 : : };
214 : :
215 : : TabControl maTabCtrl;
216 : : NUpTabPage maNUpPage;
217 : : JobTabPage maJobPage;
218 : : OutputOptPage maOptionsPage;
219 : :
220 : : PrintPreviewWindow maPreviewWindow;
221 : : NumericField maPageEdit;
222 : : FixedText maNumPagesText;
223 : : PushButton maBackwardBtn;
224 : : PushButton maForwardBtn;
225 : :
226 : : FixedLine maButtonLine;
227 : :
228 : : OKButton maOKButton;
229 : : CancelButton maCancelButton;
230 : : HelpButton maHelpButton;
231 : :
232 : : boost::shared_ptr< PrinterController > maPController;
233 : :
234 : : rtl::OUString maPageStr;
235 : : rtl::OUString maNoPageStr;
236 : : sal_Int32 mnCurPage;
237 : : sal_Int32 mnCachedPages;
238 : :
239 : : std::list< Window* > maControls;
240 : : std::map< Window*, rtl::OUString > maControlToPropertyMap;
241 : : std::map< rtl::OUString, std::vector< Window* > >
242 : : maPropertyToWindowMap;
243 : : std::map< Window*, sal_Int32 > maControlToNumValMap;
244 : : std::set< rtl::OUString > maReverseDependencySet;
245 : :
246 : : Size maNupPortraitSize;
247 : : Size maNupLandscapeSize;
248 : :
249 : : // internal, used for automatic Nup-Portrait/landscape
250 : : Size maFirstPageSize;
251 : :
252 : : rtl::OUString maPrintToFileText;
253 : : rtl::OUString maPrintText;
254 : : rtl::OUString maDefPrtText;
255 : :
256 : : boost::shared_ptr<vcl::RowOrColumn> mxPreviewCtrls;
257 : :
258 : : Size maDetailsCollapsedSize;
259 : : Size maDetailsExpandedSize;
260 : :
261 : : sal_Bool mbShowLayoutPage;
262 : :
263 : : Size getJobPageSize();
264 : : void updateNup();
265 : : void updateNupFromPages();
266 : : void preparePreview( bool i_bPrintChanged = true, bool i_bMayUseCache = false );
267 : : void setPreviewText( sal_Int32 );
268 : : void updatePrinterText();
269 : : void checkControlDependencies();
270 : : void checkOptionalControlDependencies();
271 : : void makeEnabled( Window* );
272 : : void updateWindowFromProperty( const rtl::OUString& );
273 : : void setupOptionalUI();
274 : : void readFromSettings();
275 : : void storeToSettings();
276 : : com::sun::star::beans::PropertyValue* getValueForWindow( Window* ) const;
277 : :
278 : : virtual void Resize();
279 : : virtual void Command( const CommandEvent& );
280 : : virtual void DataChanged( const DataChangedEvent& );
281 : :
282 : : DECL_LINK( SelectHdl, ListBox* );
283 : : DECL_LINK( ClickHdl, Button* );
284 : : DECL_LINK( ModifyHdl, Edit* );
285 : : DECL_LINK( UIOptionsChanged, void* );
286 : :
287 : : DECL_LINK( UIOption_CheckHdl, CheckBox* );
288 : : DECL_LINK( UIOption_RadioHdl, RadioButton* );
289 : : DECL_LINK( UIOption_SelectHdl, ListBox* );
290 : : DECL_LINK( UIOption_ModifyHdl, Edit* );
291 : :
292 : : void setupLayout();
293 : : public:
294 : : PrintDialog( Window*, const boost::shared_ptr< PrinterController >& );
295 : : virtual ~PrintDialog();
296 : :
297 : : bool isPrintToFile();
298 : : bool isCollate();
299 : : bool isSingleJobs();
300 : :
301 : : void previewForward();
302 : : void previewBackward();
303 : : };
304 : :
305 : : class PrintProgressDialog : public ModelessDialog
306 : : {
307 : : String maStr;
308 : : FixedText maText;
309 : : CancelButton maButton;
310 : :
311 : : bool mbCanceled;
312 : : sal_Int32 mnCur;
313 : : sal_Int32 mnMax;
314 : : long mnProgressHeight;
315 : : Rectangle maProgressRect;
316 : : bool mbNativeProgress;
317 : :
318 : : DECL_LINK( ClickHdl, Button* );
319 : :
320 : : void implCalcProgressRect();
321 : : public:
322 : : PrintProgressDialog( Window* i_pParent, int i_nMax );
323 : : ~PrintProgressDialog();
324 : :
325 : 0 : bool isCanceled() const { return mbCanceled; }
326 : : void setProgress( int i_nCurrent, int i_nMax = -1 );
327 : : void tick();
328 : : void reset();
329 : :
330 : : virtual void Paint( const Rectangle& );
331 : : };
332 : : }
333 : :
334 : :
335 : : #endif // _SV_PRNDLG_HXX
336 : :
337 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|