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
51 VirtualDevice maPageVDev
;
52 rtl::OUString maReplacementString
;
53 rtl::OUString maToolTipString
;
59 PrintPreviewWindow( Window
* pParent
);
60 virtual ~PrintPreviewWindow();
62 virtual void Paint( const Rectangle
& rRect
);
63 virtual void Command( const CommandEvent
& );
64 virtual void Resize();
65 virtual void DataChanged( const DataChangedEvent
& );
67 void setPreview( const GDIMetaFile
&, const Size
& i_rPaperSize
,
68 const rtl::OUString
& i_rPaperName
,
69 const rtl::OUString
& i_rNoPageString
,
70 sal_Int32 i_nDPIX
, sal_Int32 i_nDPIY
,
75 class ShowNupOrderWindow
: public Window
80 void ImplInitSettings();
82 ShowNupOrderWindow( Window
* pParent
);
83 virtual ~ShowNupOrderWindow();
85 virtual Size
GetOptimalSize(WindowSizeType eType
) const;
87 virtual void Paint( const Rectangle
& );
89 void setValues( int i_nOrderMode
, int i_nColumns
, int i_nRows
)
91 mnOrderMode
= i_nOrderMode
;
93 mnColumns
= i_nColumns
;
103 RadioButton
* mpPagesBtn
;
104 RadioButton
* mpBrochureBtn
;
105 FixedText
* mpPagesBoxTitleTxt
;
106 ListBox
* mpNupPagesBox
;
108 // controls for "Custom" page mode
109 FixedText
* mpNupNumPagesTxt
;
110 NumericField
* mpNupColEdt
;
111 FixedText
* mpNupTimesTxt
;
112 NumericField
* mpNupRowsEdt
;
113 FixedText
* mpPageMarginTxt1
;
114 MetricField
* mpPageMarginEdt
;
115 FixedText
* mpPageMarginTxt2
;
116 FixedText
* mpSheetMarginTxt1
;
117 MetricField
* mpSheetMarginEdt
;
118 FixedText
* mpSheetMarginTxt2
;
119 FixedText
* mpNupOrientationTxt
;
120 ListBox
* mpNupOrientationBox
;
122 // page order ("left to right, then down")
123 FixedText
* mpNupOrderTxt
;
124 ListBox
* mpNupOrderBox
;
125 ShowNupOrderWindow
* mpNupOrderWin
;
126 // border around each page
127 CheckBox
* mpBorderCB
;
131 NUpTabPage( VclBuilder
* );
133 void readFromSettings();
134 void storeToSettings();
135 void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup
& );
136 void enableNupControls( bool bEnable
);
138 void showAdvancedControls( bool );
145 FixedText
* mpStatusTxt
;
146 FixedText
* mpLocationTxt
;
147 FixedText
* mpCommentTxt
;
149 PushButton
* mpSetupButton
;
151 FixedLine
* mpCopySpacer
;
152 NumericField
* mpCopyCountField
;
153 CheckBox
* mpCollateBox
;
154 FixedImage
* mpCollateImage
;
155 CheckBox
* mpReverseOrderBox
;
158 Image maNoCollateImg
;
160 long mnCollateUIMode
;
162 JobTabPage( VclBuilder
* );
164 void readFromSettings();
165 void storeToSettings();
171 CheckBox
* mpToFileBox
;
172 CheckBox
* mpCollateSingleJobsBox
;
174 OutputOptPage( VclBuilder
* );
176 void readFromSettings();
177 void storeToSettings();
180 VclBuilder
* mpCustomOptionsUIBuilder
;
182 boost::shared_ptr
< PrinterController
> maPController
;
183 TabControl
* mpTabCtrl
;
184 NUpTabPage maNUpPage
;
185 JobTabPage maJobPage
;
186 OutputOptPage maOptionsPage
;
187 PrintPreviewWindow
* mpPreviewWindow
;
188 NumericField
* mpPageEdit
;
190 FixedText
* mpNumPagesText
;
191 PushButton
* mpBackwardBtn
;
192 PushButton
* mpForwardBtn
;
194 OKButton
* mpOKButton
;
195 CancelButton
* mpCancelButton
;
196 HelpButton
* mpHelpButton
;
198 rtl::OUString maPageStr
;
199 rtl::OUString maNoPageStr
;
201 sal_Int32 mnCachedPages
;
203 std::map
< Window
*, rtl::OUString
> maControlToPropertyMap
;
204 std::map
< rtl::OUString
, std::vector
< Window
* > >
205 maPropertyToWindowMap
;
206 std::map
< Window
*, sal_Int32
> maControlToNumValMap
;
207 std::set
< rtl::OUString
> maReverseDependencySet
;
209 Size maNupPortraitSize
;
210 Size maNupLandscapeSize
;
212 // internal, used for automatic Nup-Portrait/landscape
213 Size maFirstPageSize
;
215 rtl::OUString maPrintToFileText
;
216 rtl::OUString maPrintText
;
217 rtl::OUString maDefPrtText
;
219 Size maDetailsCollapsedSize
;
220 Size maDetailsExpandedSize
;
222 sal_Bool mbShowLayoutPage
;
224 Size
getJobPageSize();
226 void updateNupFromPages();
227 void preparePreview( bool i_bPrintChanged
= true, bool i_bMayUseCache
= false );
228 void setPreviewText( sal_Int32
);
229 void updatePrinterText();
230 void checkControlDependencies();
231 void checkOptionalControlDependencies();
232 void makeEnabled( Window
* );
233 void updateWindowFromProperty( const rtl::OUString
& );
234 void setupOptionalUI();
235 void readFromSettings();
236 void storeToSettings();
237 com::sun::star::beans::PropertyValue
* getValueForWindow( Window
* ) const;
239 virtual void Resize();
240 virtual void Command( const CommandEvent
& );
241 virtual void DataChanged( const DataChangedEvent
& );
243 DECL_LINK( SelectHdl
, ListBox
* );
244 DECL_LINK( ClickHdl
, Button
* );
245 DECL_LINK( ModifyHdl
, Edit
* );
246 DECL_LINK( UIOptionsChanged
, void* );
248 DECL_LINK( UIOption_CheckHdl
, CheckBox
* );
249 DECL_LINK( UIOption_RadioHdl
, RadioButton
* );
250 DECL_LINK( UIOption_SelectHdl
, ListBox
* );
251 DECL_LINK( UIOption_ModifyHdl
, Edit
* );
254 PrintDialog( Window
*, const boost::shared_ptr
< PrinterController
>& );
255 virtual ~PrintDialog();
257 bool isPrintToFile();
261 void previewForward();
262 void previewBackward();
265 class PrintProgressDialog
: public ModelessDialog
269 CancelButton maButton
;
274 long mnProgressHeight
;
275 Rectangle maProgressRect
;
276 bool mbNativeProgress
;
278 DECL_LINK( ClickHdl
, Button
* );
280 void implCalcProgressRect();
282 PrintProgressDialog( Window
* i_pParent
, int i_nMax
);
283 ~PrintProgressDialog();
285 bool isCanceled() const { return mbCanceled
; }
286 void setProgress( int i_nCurrent
, int i_nMax
= -1 );
290 virtual void Paint( const Rectangle
& );
295 #endif // _SV_PRNDLG_HXX
297 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */