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