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 _SV_PRNDLG_HXX
21 #define _SV_PRNDLG_HXX
23 #include <vcl/dllapi.h>
27 #include "vcl/print.hxx"
28 #include "vcl/dialog.hxx"
29 #include "vcl/fixed.hxx"
30 #include "vcl/button.hxx"
31 #include "vcl/gdimtf.hxx"
32 #include "vcl/lstbox.hxx"
33 #include "vcl/field.hxx"
34 #include "vcl/tabctrl.hxx"
35 #include "vcl/tabpage.hxx"
36 #include "vcl/virdev.hxx"
38 #include <boost/shared_ptr.hpp>
43 class PrintDialog
: public ModalDialog
46 class PrintPreviewWindow
: public Window
48 static const sal_Int32 PREVIEW_BITMAP_WIDTH
;
53 VirtualDevice maPageVDev
;
54 Bitmap maPreviewBitmap
;
55 OUString maReplacementString
;
56 OUString maToolTipString
;
61 void preparePreviewBitmap();
64 PrintPreviewWindow( Window
* pParent
);
65 virtual ~PrintPreviewWindow();
67 virtual void Paint( const Rectangle
& rRect
);
68 virtual void Command( const CommandEvent
& );
69 virtual void Resize();
70 virtual void DataChanged( const DataChangedEvent
& );
72 void setPreview( const GDIMetaFile
&, const Size
& i_rPaperSize
,
73 const OUString
& i_rPaperName
,
74 const OUString
& i_rNoPageString
,
75 sal_Int32 i_nDPIX
, sal_Int32 i_nDPIY
,
80 class ShowNupOrderWindow
: public Window
85 void ImplInitSettings();
87 ShowNupOrderWindow( Window
* pParent
);
88 virtual ~ShowNupOrderWindow();
90 virtual Size
GetOptimalSize() const;
92 virtual void Paint( const Rectangle
& );
94 void setValues( int i_nOrderMode
, int i_nColumns
, int i_nRows
)
96 mnOrderMode
= i_nOrderMode
;
98 mnColumns
= i_nColumns
;
108 RadioButton
* mpPagesBtn
;
109 RadioButton
* mpBrochureBtn
;
110 FixedText
* mpPagesBoxTitleTxt
;
111 ListBox
* mpNupPagesBox
;
113 // controls for "Custom" page mode
114 FixedText
* mpNupNumPagesTxt
;
115 NumericField
* mpNupColEdt
;
116 FixedText
* mpNupTimesTxt
;
117 NumericField
* mpNupRowsEdt
;
118 FixedText
* mpPageMarginTxt1
;
119 MetricField
* mpPageMarginEdt
;
120 FixedText
* mpPageMarginTxt2
;
121 FixedText
* mpSheetMarginTxt1
;
122 MetricField
* mpSheetMarginEdt
;
123 FixedText
* mpSheetMarginTxt2
;
124 FixedText
* mpNupOrientationTxt
;
125 ListBox
* mpNupOrientationBox
;
127 // page order ("left to right, then down")
128 FixedText
* mpNupOrderTxt
;
129 ListBox
* mpNupOrderBox
;
130 ShowNupOrderWindow
* mpNupOrderWin
;
131 // border around each page
132 CheckBox
* mpBorderCB
;
136 NUpTabPage( VclBuilder
* );
138 void readFromSettings();
139 void storeToSettings();
140 void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup
& );
141 void enableNupControls( bool bEnable
);
143 void showAdvancedControls( bool );
150 FixedText
* mpStatusTxt
;
151 FixedText
* mpLocationTxt
;
152 FixedText
* mpCommentTxt
;
154 PushButton
* mpSetupButton
;
156 FixedLine
* mpCopySpacer
;
157 NumericField
* mpCopyCountField
;
158 CheckBox
* mpCollateBox
;
159 FixedImage
* mpCollateImage
;
160 CheckBox
* mpReverseOrderBox
;
163 Image maNoCollateImg
;
165 long mnCollateUIMode
;
167 JobTabPage( VclBuilder
* );
169 void readFromSettings();
170 void storeToSettings();
176 CheckBox
* mpToFileBox
;
177 CheckBox
* mpCollateSingleJobsBox
;
178 CheckBox
* mpPapersizeFromSetup
;
180 OutputOptPage( VclBuilder
* );
182 void readFromSettings();
183 void storeToSettings();
186 VclBuilder
* mpCustomOptionsUIBuilder
;
188 boost::shared_ptr
< PrinterController
> maPController
;
189 TabControl
* mpTabCtrl
;
190 NUpTabPage maNUpPage
;
191 JobTabPage maJobPage
;
192 OutputOptPage maOptionsPage
;
193 PrintPreviewWindow
* mpPreviewWindow
;
194 NumericField
* mpPageEdit
;
196 FixedText
* mpNumPagesText
;
197 PushButton
* mpBackwardBtn
;
198 PushButton
* mpForwardBtn
;
200 OKButton
* mpOKButton
;
201 CancelButton
* mpCancelButton
;
202 HelpButton
* mpHelpButton
;
205 OUString maNoPageStr
;
207 sal_Int32 mnCachedPages
;
209 std::map
< Window
*, OUString
> maControlToPropertyMap
;
210 std::map
< OUString
, std::vector
< Window
* > >
211 maPropertyToWindowMap
;
212 std::map
< Window
*, sal_Int32
> maControlToNumValMap
;
213 std::set
< OUString
> maReverseDependencySet
;
215 Size maNupPortraitSize
;
216 Size maNupLandscapeSize
;
218 // internal, used for automatic Nup-Portrait/landscape
219 Size maFirstPageSize
;
221 OUString maPrintToFileText
;
222 OUString maPrintText
;
223 OUString maDefPrtText
;
225 Size maDetailsCollapsedSize
;
226 Size maDetailsExpandedSize
;
228 sal_Bool mbShowLayoutPage
;
230 Size
getJobPageSize();
232 void updateNupFromPages();
233 void preparePreview( bool i_bPrintChanged
= true, bool i_bMayUseCache
= false );
234 void setPreviewText( sal_Int32
);
235 void updatePrinterText();
236 void checkControlDependencies();
237 void checkOptionalControlDependencies();
238 void makeEnabled( Window
* );
239 void updateWindowFromProperty( const OUString
& );
240 void setupOptionalUI();
241 void readFromSettings();
242 void storeToSettings();
243 com::sun::star::beans::PropertyValue
* getValueForWindow( Window
* ) const;
245 virtual void Resize();
246 virtual void Command( const CommandEvent
& );
247 virtual void DataChanged( const DataChangedEvent
& );
249 DECL_LINK( SelectHdl
, ListBox
* );
250 DECL_LINK( ClickHdl
, Button
* );
251 DECL_LINK( ModifyHdl
, Edit
* );
252 DECL_LINK( UIOptionsChanged
, void* );
254 DECL_LINK( UIOption_CheckHdl
, CheckBox
* );
255 DECL_LINK( UIOption_RadioHdl
, RadioButton
* );
256 DECL_LINK( UIOption_SelectHdl
, ListBox
* );
257 DECL_LINK( UIOption_ModifyHdl
, Edit
* );
260 PrintDialog( Window
*, const boost::shared_ptr
< PrinterController
>& );
261 virtual ~PrintDialog();
263 bool isPrintToFile();
267 void previewForward();
268 void previewBackward();
271 class PrintProgressDialog
: public ModelessDialog
275 CancelButton maButton
;
280 long mnProgressHeight
;
281 Rectangle maProgressRect
;
282 bool mbNativeProgress
;
284 DECL_LINK( ClickHdl
, Button
* );
286 void implCalcProgressRect();
288 PrintProgressDialog( Window
* i_pParent
, int i_nMax
);
289 ~PrintProgressDialog();
291 bool isCanceled() const { return mbCanceled
; }
292 void setProgress( int i_nCurrent
, int i_nMax
= -1 );
296 virtual void Paint( const Rectangle
& );
301 #endif // _SV_PRNDLG_HXX
303 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */