LCOV - code coverage report
Current view: top level - libreoffice/sfx2/source/dialog - printopt.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 251 0.4 %
Date: 2012-12-27 Functions: 2 28 7.1 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10