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