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 // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sfx2.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifndef GCC 32*cdf0e10cSrcweir #endif 33*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 34*cdf0e10cSrcweir #include <unotools/printwarningoptions.hxx> 35*cdf0e10cSrcweir #include <svtools/printoptions.hxx> 36*cdf0e10cSrcweir #include <svl/flagitem.hxx> 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include "printopt.hrc" 40*cdf0e10cSrcweir #include "dialog.hrc" 41*cdf0e10cSrcweir #include "sfx2/sfxresid.hxx" 42*cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 43*cdf0e10cSrcweir #include <sfx2/printopt.hxx> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir // ----------- 46*cdf0e10cSrcweir // - statics - 47*cdf0e10cSrcweir // ----------- 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir static sal_uInt16 aDPIArray[] = { 72, 96, 150, 200, 300, 600 }; 50*cdf0e10cSrcweir static sal_Bool bOutputForPrinter = sal_True; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir #define DPI_COUNT (sizeof(aDPIArray)/sizeof(aDPIArray[0 ])) 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir // -------------------------------- 55*cdf0e10cSrcweir // - SfxCommonPrintOptionsTabPage - 56*cdf0e10cSrcweir // -------------------------------- 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) : 59*cdf0e10cSrcweir SfxTabPage( pParent, SfxResId( TP_COMMONPRINTOPTIONS ), rSet ), 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir aReduceGB( this, SfxResId( GB_REDUCE ) ), 62*cdf0e10cSrcweir aOutputTypeFT( this, SfxResId( FT_OUTPUTTYPE ) ), 63*cdf0e10cSrcweir aPrinterOutputRB( this, SfxResId( RB_PRINTEROUTPUT ) ), 64*cdf0e10cSrcweir aPrintFileOutputRB( this, SfxResId( RB_PRINTFILEOUTPUT ) ), 65*cdf0e10cSrcweir aOutputGB( this, SfxResId( GB_OUTPUT ) ), 66*cdf0e10cSrcweir aReduceTransparencyCB( this, SfxResId( CB_REDUCETRANSPARENCY ) ), 67*cdf0e10cSrcweir aReduceTransparencyAutoRB( this, SfxResId( RB_REDUCETRANSPARENCY_AUTO ) ), 68*cdf0e10cSrcweir aReduceTransparencyNoneRB( this, SfxResId( RB_REDUCETRANSPARENCY_NONE ) ), 69*cdf0e10cSrcweir aReduceGradientsCB( this, SfxResId( CB_REDUCEGRADIENTS ) ), 70*cdf0e10cSrcweir aReduceGradientsStripesRB( this, SfxResId( RB_REDUCEGRADIENTS_STRIPES ) ), 71*cdf0e10cSrcweir aReduceGradientsColorRB( this, SfxResId( RB_REDUCEGRADIENTS_COLOR ) ), 72*cdf0e10cSrcweir aReduceGradientsStepCountNF( this, SfxResId( NF_REDUCEGRADIENTS_STEPCOUNT ) ), 73*cdf0e10cSrcweir aReduceBitmapsCB( this, SfxResId( CB_REDUCEBITMAPS ) ), 74*cdf0e10cSrcweir aReduceBitmapsOptimalRB( this, SfxResId( RB_REDUCEBITMAPS_OPTIMAL ) ), 75*cdf0e10cSrcweir aReduceBitmapsNormalRB( this, SfxResId( RB_REDUCEBITMAPS_NORMAL ) ), 76*cdf0e10cSrcweir aReduceBitmapsResolutionRB( this, SfxResId( RB_REDUCEBITMAPS_RESOLUTION ) ), 77*cdf0e10cSrcweir aReduceBitmapsResolutionLB( this, SfxResId( LB_REDUCEBITMAPS_RESOLUTION ) ), 78*cdf0e10cSrcweir aReduceBitmapsTransparencyCB( this, SfxResId( CB_REDUCEBITMAPS_TRANSPARENCY ) ), 79*cdf0e10cSrcweir aConvertToGreyscalesCB( this, SfxResId( CB_CONVERTTOGREYSCALES ) ), 80*cdf0e10cSrcweir aWarnGB( this, SfxResId( GB_PRINT_WARN ) ), 81*cdf0e10cSrcweir aPaperSizeCB( this, SfxResId( CB_PAPERSIZE ) ), 82*cdf0e10cSrcweir aPaperOrientationCB( this, SfxResId( CB_PAPERORIENTATION ) ), 83*cdf0e10cSrcweir aTransparencyCB( this, SfxResId( CB_TRANSPARENCY ) ) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir FreeResource(); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir aOutputGB.SetStyle( aOutputGB.GetStyle() | WB_NOLABEL ); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir if( bOutputForPrinter ) 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir aPrinterOutputRB.Check( sal_True ); 92*cdf0e10cSrcweir aOutputGB.SetText( OutputDevice::GetNonMnemonicString( aPrinterOutputRB.GetText() ) ); 93*cdf0e10cSrcweir } 94*cdf0e10cSrcweir else 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir aPrintFileOutputRB.Check( sal_True ); 97*cdf0e10cSrcweir aOutputGB.SetText( OutputDevice::GetNonMnemonicString( aPrintFileOutputRB.GetText() ) ); 98*cdf0e10cSrcweir } 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir aPrinterOutputRB.SetToggleHdl( LINK( this, SfxCommonPrintOptionsTabPage, ToggleOutputPrinterRBHdl ) ); 101*cdf0e10cSrcweir aPrintFileOutputRB.SetToggleHdl( LINK( this, SfxCommonPrintOptionsTabPage, ToggleOutputPrintFileRBHdl ) ); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir aReduceTransparencyCB.SetClickHdl( LINK( this, SfxCommonPrintOptionsTabPage, ClickReduceTransparencyCBHdl ) ); 104*cdf0e10cSrcweir aReduceGradientsCB.SetClickHdl( LINK( this, SfxCommonPrintOptionsTabPage, ClickReduceGradientsCBHdl ) ); 105*cdf0e10cSrcweir aReduceBitmapsCB.SetClickHdl( LINK( this, SfxCommonPrintOptionsTabPage, ClickReduceBitmapsCBHdl ) ); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir aReduceGradientsStripesRB.SetToggleHdl( LINK( this, SfxCommonPrintOptionsTabPage, ToggleReduceGradientsStripesRBHdl ) ); 108*cdf0e10cSrcweir aReduceBitmapsResolutionRB.SetToggleHdl( LINK( this, SfxCommonPrintOptionsTabPage, ToggleReduceBitmapsResolutionRBHdl ) ); 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir // --> PB 2008-06-09 #i89164# 111*cdf0e10cSrcweir // calculate dynamically the width of radiobutton and listbox 112*cdf0e10cSrcweir const long nOffset = 10; 113*cdf0e10cSrcweir Size aOldSize = aReduceBitmapsResolutionRB.GetSizePixel(); 114*cdf0e10cSrcweir Size aNewSize = aReduceBitmapsResolutionRB.GetOptimalSize( WINDOWSIZE_PREFERRED ); 115*cdf0e10cSrcweir aNewSize.Width() += nOffset; 116*cdf0e10cSrcweir aNewSize.Height() = aOldSize.Height(); 117*cdf0e10cSrcweir long nDelta = aOldSize.Width() - aNewSize.Width(); 118*cdf0e10cSrcweir aReduceBitmapsResolutionRB.SetSizePixel( aNewSize ); 119*cdf0e10cSrcweir Point aPos = aReduceBitmapsResolutionLB.GetPosPixel(); 120*cdf0e10cSrcweir aPos.X() -= nDelta; 121*cdf0e10cSrcweir aOldSize = aReduceBitmapsResolutionLB.GetSizePixel(); 122*cdf0e10cSrcweir aNewSize = aReduceBitmapsResolutionLB.GetOptimalSize( WINDOWSIZE_PREFERRED ); 123*cdf0e10cSrcweir aNewSize.Width() += nOffset; 124*cdf0e10cSrcweir aNewSize.Height() = aOldSize.Height(); 125*cdf0e10cSrcweir aReduceBitmapsResolutionLB.SetPosSizePixel( aPos, aNewSize ); 126*cdf0e10cSrcweir // <-- 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir SfxCommonPrintOptionsTabPage::~SfxCommonPrintOptionsTabPage() 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir SfxTabPage* SfxCommonPrintOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir return( new SfxCommonPrintOptionsTabPage( pParent, rAttrSet ) ); 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir Window* SfxCommonPrintOptionsTabPage::GetParentLabeledBy( const Window* pWindow ) const 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir if ( pWindow == (Window *)&aReduceGradientsStepCountNF ) 147*cdf0e10cSrcweir return (Window *)&aReduceGradientsStripesRB; 148*cdf0e10cSrcweir else if ( pWindow == (Window *)&aReduceBitmapsResolutionLB ) 149*cdf0e10cSrcweir return (Window *)&aReduceBitmapsResolutionRB; 150*cdf0e10cSrcweir else 151*cdf0e10cSrcweir return SfxTabPage::GetParentLabeledBy( pWindow ); 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir Window* SfxCommonPrintOptionsTabPage::GetParentLabelFor( const Window* pWindow ) const 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir if ( pWindow == (Window *)&aReduceGradientsStripesRB ) 157*cdf0e10cSrcweir return (Window *)&aReduceGradientsStepCountNF; 158*cdf0e10cSrcweir else if ( pWindow == (Window *)&aReduceBitmapsResolutionRB ) 159*cdf0e10cSrcweir return (Window *)&aReduceBitmapsResolutionLB; 160*cdf0e10cSrcweir else 161*cdf0e10cSrcweir return SfxTabPage::GetParentLabelFor( pWindow ); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir sal_Bool SfxCommonPrintOptionsTabPage::FillItemSet( SfxItemSet& /*rSet*/ ) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir SvtPrintWarningOptions aWarnOptions; 169*cdf0e10cSrcweir SvtPrinterOptions aPrinterOptions; 170*cdf0e10cSrcweir SvtPrintFileOptions aPrintFileOptions; 171*cdf0e10cSrcweir sal_Bool bModified = sal_False; 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir if( aPaperSizeCB.IsChecked() != aPaperSizeCB.GetSavedValue()) 175*cdf0e10cSrcweir aWarnOptions.SetPaperSize(aPaperSizeCB.IsChecked()); 176*cdf0e10cSrcweir if( aPaperOrientationCB.IsChecked() != aPaperOrientationCB.GetSavedValue() ) 177*cdf0e10cSrcweir aWarnOptions.SetPaperOrientation(aPaperOrientationCB.IsChecked()); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir if( aTransparencyCB.IsChecked() != aTransparencyCB.GetSavedValue() ) 180*cdf0e10cSrcweir aWarnOptions.SetTransparency( aTransparencyCB.IsChecked() ); 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir ImplSaveControls( aPrinterOutputRB.IsChecked() ? &maPrinterOptions : &maPrintFileOptions ); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir aPrinterOptions.SetPrinterOptions( maPrinterOptions ); 185*cdf0e10cSrcweir aPrintFileOptions.SetPrinterOptions( maPrintFileOptions ); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir return bModified; 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir void SfxCommonPrintOptionsTabPage::Reset( const SfxItemSet& /*rSet*/ ) 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir SvtPrintWarningOptions aWarnOptions; 195*cdf0e10cSrcweir SvtPrinterOptions aPrinterOptions; 196*cdf0e10cSrcweir SvtPrintFileOptions aPrintFileOptions; 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir aPaperSizeCB.Check( aWarnOptions.IsPaperSize() ); 199*cdf0e10cSrcweir aPaperOrientationCB.Check( aWarnOptions.IsPaperOrientation() ); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir aTransparencyCB.Check( aWarnOptions.IsTransparency() ); 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir aPaperSizeCB.SaveValue(); 204*cdf0e10cSrcweir aPaperOrientationCB.SaveValue(); 205*cdf0e10cSrcweir aTransparencyCB.SaveValue(); 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir aPrinterOptions.GetPrinterOptions( maPrinterOptions ); 208*cdf0e10cSrcweir aPrintFileOptions.GetPrinterOptions( maPrintFileOptions ); 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir ImplUpdateControls( aPrinterOutputRB.IsChecked() ? &maPrinterOptions : &maPrintFileOptions ); 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir // --> OD 2008-06-25 #i63982# 213*cdf0e10cSrcweir ImplSetAccessibleNames(); 214*cdf0e10cSrcweir // <-- 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir int SfxCommonPrintOptionsTabPage::DeactivatePage( SfxItemSet* pItemSet ) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir if( pItemSet ) 222*cdf0e10cSrcweir FillItemSet( *pItemSet ); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir return LEAVE_PAGE; 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCurrentOptions ) 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir aReduceTransparencyCB.Check( pCurrentOptions->IsReduceTransparency() ); 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir if( pCurrentOptions->GetReducedTransparencyMode() == PRINTER_TRANSPARENCY_AUTO ) 234*cdf0e10cSrcweir aReduceTransparencyAutoRB.Check( sal_True ); 235*cdf0e10cSrcweir else 236*cdf0e10cSrcweir aReduceTransparencyNoneRB.Check( sal_True ); 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir aReduceGradientsCB.Check( pCurrentOptions->IsReduceGradients() ); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir if( pCurrentOptions->GetReducedGradientMode() == PRINTER_GRADIENT_STRIPES ) 241*cdf0e10cSrcweir aReduceGradientsStripesRB.Check( sal_True ); 242*cdf0e10cSrcweir else 243*cdf0e10cSrcweir aReduceGradientsColorRB.Check( sal_True ); 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir aReduceGradientsStepCountNF.SetValue( pCurrentOptions->GetReducedGradientStepCount() ); 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir aReduceBitmapsCB.Check( pCurrentOptions->IsReduceBitmaps() ); 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir if( pCurrentOptions->GetReducedBitmapMode() == PRINTER_BITMAP_OPTIMAL ) 250*cdf0e10cSrcweir aReduceBitmapsOptimalRB.Check( sal_True ); 251*cdf0e10cSrcweir else if( pCurrentOptions->GetReducedBitmapMode() == PRINTER_BITMAP_NORMAL ) 252*cdf0e10cSrcweir aReduceBitmapsNormalRB.Check( sal_True ); 253*cdf0e10cSrcweir else 254*cdf0e10cSrcweir aReduceBitmapsResolutionRB.Check( sal_True ); 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir const sal_uInt16 nDPI = pCurrentOptions->GetReducedBitmapResolution(); 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir if( nDPI < aDPIArray[ 0 ] ) 259*cdf0e10cSrcweir aReduceBitmapsResolutionLB.SelectEntryPos( 0 ); 260*cdf0e10cSrcweir else 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir for( long i = ( DPI_COUNT - 1 ); i >= 0; i-- ) 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir if( nDPI >= aDPIArray[ i ] ) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir aReduceBitmapsResolutionLB.SelectEntryPos( (sal_uInt16) i ); 267*cdf0e10cSrcweir i = -1; 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir aReduceBitmapsResolutionLB.SetText( aReduceBitmapsResolutionLB.GetEntry( aReduceBitmapsResolutionLB.GetSelectEntryPos() ) ); 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir aReduceBitmapsTransparencyCB.Check( pCurrentOptions->IsReducedBitmapIncludesTransparency() ); 275*cdf0e10cSrcweir aConvertToGreyscalesCB.Check( pCurrentOptions->IsConvertToGreyscales() ); 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir ClickReduceTransparencyCBHdl( &aReduceTransparencyCB ); 278*cdf0e10cSrcweir ClickReduceGradientsCBHdl( &aReduceGradientsCB ); 279*cdf0e10cSrcweir ClickReduceBitmapsCBHdl( &aReduceBitmapsCB ); 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir void SfxCommonPrintOptionsTabPage::ImplSetAccessibleNames() 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir static const String cSeparator = String::CreateFromAscii( " - " ); 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir String sReduceText = aReduceGB.GetDisplayText(); 289*cdf0e10cSrcweir sReduceText += cSeparator; 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir String sAccessibleName = sReduceText; 292*cdf0e10cSrcweir sAccessibleName += aPrinterOutputRB.GetDisplayText(); 293*cdf0e10cSrcweir aPrinterOutputRB.SetAccessibleName( sAccessibleName ); 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir sAccessibleName = sReduceText; 296*cdf0e10cSrcweir sAccessibleName += aPrintFileOutputRB.GetDisplayText(); 297*cdf0e10cSrcweir aPrintFileOutputRB.SetAccessibleName( sAccessibleName ); 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir String sOutputText = sReduceText; 300*cdf0e10cSrcweir sOutputText += aOutputGB.GetDisplayText(); 301*cdf0e10cSrcweir sOutputText += cSeparator; 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir sAccessibleName = sOutputText; 304*cdf0e10cSrcweir sAccessibleName += aReduceTransparencyCB.GetDisplayText(); 305*cdf0e10cSrcweir aReduceTransparencyCB.SetAccessibleName( sAccessibleName ); 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir String sTransparencyText = aReduceTransparencyCB.GetAccessibleName(); 308*cdf0e10cSrcweir sTransparencyText += cSeparator; 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir sAccessibleName = sTransparencyText; 311*cdf0e10cSrcweir sAccessibleName += aReduceTransparencyAutoRB.GetDisplayText(); 312*cdf0e10cSrcweir aReduceTransparencyAutoRB.SetAccessibleName( sAccessibleName ); 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir sAccessibleName = sTransparencyText; 315*cdf0e10cSrcweir sAccessibleName += aReduceTransparencyNoneRB.GetDisplayText(); 316*cdf0e10cSrcweir aReduceTransparencyNoneRB.SetAccessibleName( sAccessibleName ); 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir sAccessibleName = sOutputText; 319*cdf0e10cSrcweir sAccessibleName += aReduceGradientsCB.GetDisplayText(); 320*cdf0e10cSrcweir aReduceGradientsCB.SetAccessibleName( sAccessibleName ); 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir String sGradientText = aReduceGradientsCB.GetAccessibleName(); 323*cdf0e10cSrcweir sGradientText += cSeparator; 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir sAccessibleName = sGradientText; 326*cdf0e10cSrcweir sAccessibleName += aReduceGradientsStripesRB.GetDisplayText(); 327*cdf0e10cSrcweir aReduceGradientsStripesRB.SetAccessibleName( sAccessibleName ); 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir sAccessibleName = aReduceGradientsStripesRB.GetAccessibleName(); 330*cdf0e10cSrcweir aReduceGradientsStepCountNF.SetAccessibleName( sAccessibleName ); 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir sAccessibleName = sGradientText; 333*cdf0e10cSrcweir sAccessibleName += aReduceGradientsColorRB.GetDisplayText(); 334*cdf0e10cSrcweir aReduceGradientsColorRB.SetAccessibleName( sAccessibleName ); 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir sAccessibleName = sOutputText; 337*cdf0e10cSrcweir sAccessibleName += aReduceBitmapsCB.GetDisplayText(); 338*cdf0e10cSrcweir aReduceBitmapsCB.SetAccessibleName( sAccessibleName ); 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir String sBitmapText = aReduceBitmapsCB.GetAccessibleName(); 341*cdf0e10cSrcweir sBitmapText += cSeparator; 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir sAccessibleName = sBitmapText; 344*cdf0e10cSrcweir sAccessibleName += aReduceBitmapsOptimalRB.GetDisplayText(); 345*cdf0e10cSrcweir aReduceBitmapsOptimalRB.SetAccessibleName( sAccessibleName ); 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir sAccessibleName = sBitmapText; 348*cdf0e10cSrcweir sAccessibleName += aReduceBitmapsNormalRB.GetDisplayText(); 349*cdf0e10cSrcweir aReduceBitmapsNormalRB.SetAccessibleName( sAccessibleName ); 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir sAccessibleName = sBitmapText; 352*cdf0e10cSrcweir sAccessibleName += aReduceBitmapsResolutionRB.GetDisplayText(); 353*cdf0e10cSrcweir aReduceBitmapsResolutionRB.SetAccessibleName( sAccessibleName ); 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir sAccessibleName = aReduceBitmapsResolutionRB.GetAccessibleName(); 356*cdf0e10cSrcweir aReduceBitmapsResolutionLB.SetAccessibleName( sAccessibleName ); 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir sAccessibleName = sBitmapText; 359*cdf0e10cSrcweir sAccessibleName += aReduceBitmapsTransparencyCB.GetDisplayText(); 360*cdf0e10cSrcweir aReduceBitmapsTransparencyCB.SetAccessibleName( sAccessibleName ); 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir sAccessibleName = sOutputText; 363*cdf0e10cSrcweir sAccessibleName += aConvertToGreyscalesCB.GetDisplayText(); 364*cdf0e10cSrcweir aConvertToGreyscalesCB.SetAccessibleName( sAccessibleName ); 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir String sWarnText = aWarnGB.GetDisplayText(); 367*cdf0e10cSrcweir sWarnText += cSeparator; 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir sAccessibleName = sWarnText; 370*cdf0e10cSrcweir sAccessibleName += aPaperSizeCB.GetDisplayText(); 371*cdf0e10cSrcweir aPaperSizeCB.SetAccessibleName( sAccessibleName ); 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir sAccessibleName = sWarnText; 374*cdf0e10cSrcweir sAccessibleName += aPaperOrientationCB.GetDisplayText(); 375*cdf0e10cSrcweir aPaperOrientationCB.SetAccessibleName( sAccessibleName ); 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir sAccessibleName = sWarnText; 378*cdf0e10cSrcweir sAccessibleName += aTransparencyCB.GetDisplayText(); 379*cdf0e10cSrcweir aTransparencyCB.SetAccessibleName( sAccessibleName ); 380*cdf0e10cSrcweir } 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir void SfxCommonPrintOptionsTabPage::ImplSaveControls( PrinterOptions* pCurrentOptions ) 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir pCurrentOptions->SetReduceTransparency( aReduceTransparencyCB.IsChecked() ); 387*cdf0e10cSrcweir pCurrentOptions->SetReducedTransparencyMode( aReduceTransparencyAutoRB.IsChecked() ? PRINTER_TRANSPARENCY_AUTO : PRINTER_TRANSPARENCY_NONE ); 388*cdf0e10cSrcweir pCurrentOptions->SetReduceGradients( aReduceGradientsCB.IsChecked() ); 389*cdf0e10cSrcweir pCurrentOptions->SetReducedGradientMode( aReduceGradientsStripesRB.IsChecked() ? PRINTER_GRADIENT_STRIPES : PRINTER_GRADIENT_COLOR ); 390*cdf0e10cSrcweir pCurrentOptions->SetReducedGradientStepCount( (sal_uInt16) aReduceGradientsStepCountNF.GetValue() ); 391*cdf0e10cSrcweir pCurrentOptions->SetReduceBitmaps( aReduceBitmapsCB.IsChecked() ); 392*cdf0e10cSrcweir pCurrentOptions->SetReducedBitmapMode( aReduceBitmapsOptimalRB.IsChecked() ? PRINTER_BITMAP_OPTIMAL : 393*cdf0e10cSrcweir ( aReduceBitmapsNormalRB.IsChecked() ? PRINTER_BITMAP_NORMAL : PRINTER_BITMAP_RESOLUTION ) ); 394*cdf0e10cSrcweir pCurrentOptions->SetReducedBitmapResolution( aDPIArray[ Min( (sal_uInt16) aReduceBitmapsResolutionLB.GetSelectEntryPos(), 395*cdf0e10cSrcweir (sal_uInt16)( sizeof( aDPIArray ) / sizeof( aDPIArray[ 0 ] ) - 1 ) ) ] ); 396*cdf0e10cSrcweir pCurrentOptions->SetReducedBitmapIncludesTransparency( aReduceBitmapsTransparencyCB.IsChecked() ); 397*cdf0e10cSrcweir pCurrentOptions->SetConvertToGreyscales( aConvertToGreyscalesCB.IsChecked() ); 398*cdf0e10cSrcweir } 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir IMPL_LINK( SfxCommonPrintOptionsTabPage, ClickReduceTransparencyCBHdl, CheckBox*, pBox ) 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir (void)pBox; //unused 405*cdf0e10cSrcweir const sal_Bool bReduceTransparency = aReduceTransparencyCB.IsChecked(); 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir aReduceTransparencyAutoRB.Enable( bReduceTransparency ); 408*cdf0e10cSrcweir aReduceTransparencyNoneRB.Enable( bReduceTransparency ); 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir aTransparencyCB.Enable( !bReduceTransparency ); 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir return 0; 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir IMPL_LINK( SfxCommonPrintOptionsTabPage, ClickReduceGradientsCBHdl, CheckBox*, pBox ) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir (void)pBox; //unused 420*cdf0e10cSrcweir const sal_Bool bEnable = aReduceGradientsCB.IsChecked(); 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir aReduceGradientsStripesRB.Enable( bEnable ); 423*cdf0e10cSrcweir aReduceGradientsColorRB.Enable( bEnable ); 424*cdf0e10cSrcweir aReduceGradientsStepCountNF.Enable( bEnable ); 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir ToggleReduceGradientsStripesRBHdl( &aReduceGradientsStripesRB ); 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir return 0; 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir IMPL_LINK( SfxCommonPrintOptionsTabPage, ClickReduceBitmapsCBHdl, CheckBox*, pBox ) 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir (void)pBox; //unused 436*cdf0e10cSrcweir const sal_Bool bEnable = aReduceBitmapsCB.IsChecked(); 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir aReduceBitmapsOptimalRB.Enable( bEnable ); 439*cdf0e10cSrcweir aReduceBitmapsNormalRB.Enable( bEnable ); 440*cdf0e10cSrcweir aReduceBitmapsResolutionRB.Enable( bEnable ); 441*cdf0e10cSrcweir aReduceBitmapsTransparencyCB.Enable( bEnable ); 442*cdf0e10cSrcweir aReduceBitmapsResolutionLB.Enable( bEnable ); 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir ToggleReduceBitmapsResolutionRBHdl( &aReduceBitmapsResolutionRB ); 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir return 0; 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleReduceGradientsStripesRBHdl, RadioButton*, pButton ) 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir (void)pButton; //unused 454*cdf0e10cSrcweir const sal_Bool bEnable = aReduceGradientsCB.IsChecked() && aReduceGradientsStripesRB.IsChecked(); 455*cdf0e10cSrcweir 456*cdf0e10cSrcweir aReduceGradientsStepCountNF.Enable( bEnable ); 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir return 0; 459*cdf0e10cSrcweir } 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleReduceBitmapsResolutionRBHdl, RadioButton*, pButton ) 464*cdf0e10cSrcweir { 465*cdf0e10cSrcweir (void)pButton; //unused 466*cdf0e10cSrcweir const sal_Bool bEnable = aReduceBitmapsCB.IsChecked() && aReduceBitmapsResolutionRB.IsChecked(); 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir aReduceBitmapsResolutionLB.Enable( bEnable ); 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir return 0; 471*cdf0e10cSrcweir } 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleOutputPrinterRBHdl, RadioButton*, pButton ) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir if( pButton->IsChecked() ) 478*cdf0e10cSrcweir { 479*cdf0e10cSrcweir aOutputGB.SetText( OutputDevice::GetNonMnemonicString( pButton->GetText() ) ); 480*cdf0e10cSrcweir ImplUpdateControls( &maPrinterOptions ); 481*cdf0e10cSrcweir bOutputForPrinter = sal_True; 482*cdf0e10cSrcweir // --> OD 2008-06-25 #i63982# 483*cdf0e10cSrcweir ImplSetAccessibleNames(); 484*cdf0e10cSrcweir // <-- 485*cdf0e10cSrcweir } 486*cdf0e10cSrcweir else 487*cdf0e10cSrcweir ImplSaveControls( &maPrinterOptions ); 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir return 0; 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleOutputPrintFileRBHdl, RadioButton*, pButton ) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir if( pButton->IsChecked() ) 497*cdf0e10cSrcweir { 498*cdf0e10cSrcweir aOutputGB.SetText( OutputDevice::GetNonMnemonicString( pButton->GetText() ) ); 499*cdf0e10cSrcweir ImplUpdateControls( &maPrintFileOptions ); 500*cdf0e10cSrcweir bOutputForPrinter = sal_False; 501*cdf0e10cSrcweir // --> OD 2008-06-25 #i63982# 502*cdf0e10cSrcweir ImplSetAccessibleNames(); 503*cdf0e10cSrcweir // <-- 504*cdf0e10cSrcweir } 505*cdf0e10cSrcweir else 506*cdf0e10cSrcweir ImplSaveControls( &maPrintFileOptions ); 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir return 0; 509*cdf0e10cSrcweir } 510*cdf0e10cSrcweir 511*cdf0e10cSrcweir // ------------------------------- 512*cdf0e10cSrcweir // - TransparencyPrintWarningBox - 513*cdf0e10cSrcweir // ------------------------------- 514*cdf0e10cSrcweir 515*cdf0e10cSrcweir TransparencyPrintWarningBox::TransparencyPrintWarningBox( Window* pParent ) : 516*cdf0e10cSrcweir ModalDialog( pParent, SfxResId( RID_WARN_PRINTTRANSPARENCY ) ), 517*cdf0e10cSrcweir aWarnFI ( this, SfxResId( FI_PRINTTRANSWARN ) ), 518*cdf0e10cSrcweir aWarnFT ( this, SfxResId( FT_PRINTTRANSWARN ) ), 519*cdf0e10cSrcweir aYesBtn ( this, SfxResId( BTN_PRINTTRANS_YES ) ), 520*cdf0e10cSrcweir aNoBtn ( this, SfxResId( BTN_PRINTTRANS_NO ) ), 521*cdf0e10cSrcweir aCancelBtn ( this, SfxResId( BTN_PRINTTRANS_CANCEL ) ), 522*cdf0e10cSrcweir aNoWarnCB ( this, SfxResId( CBX_NOPRINTTRANSWARN ) ) 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir FreeResource(); 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir aWarnFT.SetStyle( aWarnFT.GetStyle() | WB_INFO ); 527*cdf0e10cSrcweir aWarnFI.SetImage( WarningBox::GetStandardImage() ); 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir aNoBtn.SetClickHdl( LINK( this, TransparencyPrintWarningBox, ClickNoBtn ) ); 530*cdf0e10cSrcweir } 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir TransparencyPrintWarningBox::~TransparencyPrintWarningBox() 535*cdf0e10cSrcweir { 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir IMPL_LINK( TransparencyPrintWarningBox, ClickNoBtn, PushButton*, pButton ) 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir (void)pButton; //unused 543*cdf0e10cSrcweir EndDialog( RET_NO ); 544*cdf0e10cSrcweir return 0; 545*cdf0e10cSrcweir } 546