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_sd.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifdef SD_DLLIMPLEMENTATION 32*cdf0e10cSrcweir #undef SD_DLLIMPLEMENTATION 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include "sdattr.hxx" 37*cdf0e10cSrcweir #include "optsitem.hxx" 38*cdf0e10cSrcweir #include "prntopts.hrc" 39*cdf0e10cSrcweir #include "sdresid.hxx" 40*cdf0e10cSrcweir #include "prntopts.hxx" 41*cdf0e10cSrcweir #include "app.hrc" 42*cdf0e10cSrcweir #include <svl/intitem.hxx> 43*cdf0e10cSrcweir #include <sfx2/request.hxx> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir /************************************************************************* 46*cdf0e10cSrcweir |* 47*cdf0e10cSrcweir |* Dialog zum Aendern der Print-Optionen 48*cdf0e10cSrcweir |* 49*cdf0e10cSrcweir \************************************************************************/ 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir SdPrintOptions::SdPrintOptions( Window* pParent, const SfxItemSet& rInAttrs ) : 52*cdf0e10cSrcweir SfxTabPage ( pParent, SdResId( TP_PRINT_OPTIONS ), rInAttrs ), 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir aGrpPrint ( this, SdResId( GRP_PRINT ) ), 55*cdf0e10cSrcweir aCbxDraw ( this, SdResId( CBX_DRAW ) ), 56*cdf0e10cSrcweir aCbxNotes ( this, SdResId( CBX_NOTES ) ), 57*cdf0e10cSrcweir aCbxHandout ( this, SdResId( CBX_HANDOUTS ) ), 58*cdf0e10cSrcweir aCbxOutline ( this, SdResId( CBX_OUTLINE ) ), 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir aSeparator1FL ( this, SdResId( FL_SEPARATOR1 ) ), 61*cdf0e10cSrcweir aGrpOutput ( this, SdResId( GRP_OUTPUT ) ), 62*cdf0e10cSrcweir aRbtColor ( this, SdResId( RBT_COLOR ) ), 63*cdf0e10cSrcweir aRbtGrayscale ( this, SdResId( RBT_GRAYSCALE ) ), 64*cdf0e10cSrcweir aRbtBlackWhite ( this, SdResId( RBT_BLACKWHITE ) ), 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir aGrpPrintExt ( this, SdResId( GRP_PRINT_EXT ) ), 67*cdf0e10cSrcweir aCbxPagename ( this, SdResId( CBX_PAGENAME ) ), 68*cdf0e10cSrcweir aCbxDate ( this, SdResId( CBX_DATE ) ), 69*cdf0e10cSrcweir aCbxTime ( this, SdResId( CBX_TIME ) ), 70*cdf0e10cSrcweir aCbxHiddenPages ( this, SdResId( CBX_HIDDEN_PAGES ) ), 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir aSeparator2FL ( this, SdResId( FL_SEPARATOR2 ) ), 73*cdf0e10cSrcweir aGrpPageoptions ( this, SdResId( GRP_PAGE ) ), 74*cdf0e10cSrcweir aRbtDefault ( this, SdResId( RBT_DEFAULT ) ), 75*cdf0e10cSrcweir aRbtPagesize ( this, SdResId( RBT_PAGESIZE ) ), 76*cdf0e10cSrcweir aRbtPagetile ( this, SdResId( RBT_PAGETILE ) ), 77*cdf0e10cSrcweir aRbtBooklet ( this, SdResId( RBT_BOOKLET ) ), 78*cdf0e10cSrcweir aCbxFront ( this, SdResId( CBX_FRONT ) ), 79*cdf0e10cSrcweir aCbxBack ( this, SdResId( CBX_BACK ) ), 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir aCbxPaperbin ( this, SdResId( CBX_PAPERBIN ) ), 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir rOutAttrs ( rInAttrs ) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir FreeResource(); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir Link aLink = LINK( this, SdPrintOptions, ClickBookletHdl ); 88*cdf0e10cSrcweir aRbtDefault.SetClickHdl( aLink ); 89*cdf0e10cSrcweir aRbtPagesize.SetClickHdl( aLink ); 90*cdf0e10cSrcweir aRbtPagetile.SetClickHdl( aLink ); 91*cdf0e10cSrcweir aRbtBooklet.SetClickHdl( aLink ); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir aLink = LINK( this, SdPrintOptions, ClickCheckboxHdl ); 94*cdf0e10cSrcweir aCbxDraw.SetClickHdl( aLink ); 95*cdf0e10cSrcweir aCbxNotes.SetClickHdl( aLink ); 96*cdf0e10cSrcweir aCbxHandout.SetClickHdl( aLink ); 97*cdf0e10cSrcweir aCbxOutline.SetClickHdl( aLink ); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir #ifndef QUARTZ 100*cdf0e10cSrcweir SetDrawMode(); 101*cdf0e10cSrcweir #endif 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir aCbxFront.SetAccessibleRelationLabeledBy( &aRbtBooklet ); 104*cdf0e10cSrcweir aCbxBack.SetAccessibleRelationLabeledBy( &aRbtBooklet ); 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir // ----------------------------------------------------------------------- 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir SdPrintOptions::~SdPrintOptions() 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir // ----------------------------------------------------------------------- 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir sal_Bool SdPrintOptions::FillItemSet( SfxItemSet& rAttrs ) 116*cdf0e10cSrcweir { 117*cdf0e10cSrcweir if( aCbxDraw.GetSavedValue() != aCbxDraw.IsChecked() || 118*cdf0e10cSrcweir aCbxNotes.GetSavedValue() != aCbxNotes.IsChecked() || 119*cdf0e10cSrcweir aCbxHandout.GetSavedValue() != aCbxHandout.IsChecked() || 120*cdf0e10cSrcweir aCbxOutline.GetSavedValue() != aCbxOutline.IsChecked() || 121*cdf0e10cSrcweir aCbxDate.GetSavedValue() != aCbxDate.IsChecked() || 122*cdf0e10cSrcweir aCbxTime.GetSavedValue() != aCbxTime.IsChecked() || 123*cdf0e10cSrcweir aCbxPagename.GetSavedValue() != aCbxPagename.IsChecked() || 124*cdf0e10cSrcweir aCbxHiddenPages.GetSavedValue() != aCbxHiddenPages.IsChecked() || 125*cdf0e10cSrcweir aRbtPagesize.GetSavedValue() != aRbtPagesize.IsChecked() || 126*cdf0e10cSrcweir aRbtPagetile.GetSavedValue() != aRbtPagetile.IsChecked() || 127*cdf0e10cSrcweir aRbtBooklet.GetSavedValue() != aRbtBooklet.IsChecked() || 128*cdf0e10cSrcweir aCbxFront.GetSavedValue() != aCbxFront.IsChecked() || 129*cdf0e10cSrcweir aCbxBack.GetSavedValue() != aCbxBack.IsChecked() || 130*cdf0e10cSrcweir aCbxPaperbin.GetSavedValue() != aCbxPaperbin.IsChecked() || 131*cdf0e10cSrcweir aRbtColor.GetSavedValue() != aRbtColor.IsChecked() || 132*cdf0e10cSrcweir aRbtGrayscale.GetSavedValue() != aRbtGrayscale.IsChecked() || 133*cdf0e10cSrcweir aRbtBlackWhite.GetSavedValue() != aRbtBlackWhite.IsChecked() ) 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir SdOptionsPrintItem aOptions( ATTR_OPTIONS_PRINT ); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetDraw( aCbxDraw.IsChecked() ); 138*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetNotes( aCbxNotes.IsChecked() ); 139*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetHandout( aCbxHandout.IsChecked() ); 140*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetOutline( aCbxOutline.IsChecked() ); 141*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetDate( aCbxDate.IsChecked() ); 142*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetTime( aCbxTime.IsChecked() ); 143*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetPagename( aCbxPagename.IsChecked() ); 144*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetHiddenPages( aCbxHiddenPages.IsChecked() ); 145*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetPagesize( aRbtPagesize.IsChecked() ); 146*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetPagetile( aRbtPagetile.IsChecked() ); 147*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetBooklet( aRbtBooklet.IsChecked() ); 148*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetFrontPage( aCbxFront.IsChecked() ); 149*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetBackPage( aCbxBack.IsChecked() ); 150*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetPaperbin( aCbxPaperbin.IsChecked() ); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir sal_uInt16 nQuality = 0; // Standard, also Color 153*cdf0e10cSrcweir if( aRbtGrayscale.IsChecked() ) 154*cdf0e10cSrcweir nQuality = 1; 155*cdf0e10cSrcweir if( aRbtBlackWhite.IsChecked() ) 156*cdf0e10cSrcweir nQuality = 2; 157*cdf0e10cSrcweir aOptions.GetOptionsPrint().SetOutputQuality( nQuality ); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir rAttrs.Put( aOptions ); 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir return( sal_True ); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir return( sal_False ); 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir // ----------------------------------------------------------------------- 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir void SdPrintOptions::Reset( const SfxItemSet& rAttrs ) 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir const SdOptionsPrintItem* pPrintOpts = NULL; 171*cdf0e10cSrcweir if( SFX_ITEM_SET == rAttrs.GetItemState( ATTR_OPTIONS_PRINT, sal_False, 172*cdf0e10cSrcweir (const SfxPoolItem**) &pPrintOpts ) ) 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir aCbxDraw.Check( pPrintOpts->GetOptionsPrint().IsDraw() ); 175*cdf0e10cSrcweir aCbxNotes.Check( pPrintOpts->GetOptionsPrint().IsNotes() ); 176*cdf0e10cSrcweir aCbxHandout.Check( pPrintOpts->GetOptionsPrint().IsHandout() ); 177*cdf0e10cSrcweir aCbxOutline.Check( pPrintOpts->GetOptionsPrint().IsOutline() ); 178*cdf0e10cSrcweir aCbxDate.Check( pPrintOpts->GetOptionsPrint().IsDate() ); 179*cdf0e10cSrcweir aCbxTime.Check( pPrintOpts->GetOptionsPrint().IsTime() ); 180*cdf0e10cSrcweir aCbxPagename.Check( pPrintOpts->GetOptionsPrint().IsPagename() ); 181*cdf0e10cSrcweir aCbxHiddenPages.Check( pPrintOpts->GetOptionsPrint().IsHiddenPages() ); 182*cdf0e10cSrcweir aRbtPagesize.Check( pPrintOpts->GetOptionsPrint().IsPagesize() ); 183*cdf0e10cSrcweir aRbtPagetile.Check( pPrintOpts->GetOptionsPrint().IsPagetile() ); 184*cdf0e10cSrcweir aRbtBooklet.Check( pPrintOpts->GetOptionsPrint().IsBooklet() ); 185*cdf0e10cSrcweir aCbxFront.Check( pPrintOpts->GetOptionsPrint().IsFrontPage() ); 186*cdf0e10cSrcweir aCbxBack.Check( pPrintOpts->GetOptionsPrint().IsBackPage() ); 187*cdf0e10cSrcweir aCbxPaperbin.Check( pPrintOpts->GetOptionsPrint().IsPaperbin() ); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir if( !aRbtPagesize.IsChecked() && 190*cdf0e10cSrcweir !aRbtPagetile.IsChecked() && 191*cdf0e10cSrcweir !aRbtBooklet.IsChecked() ) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir aRbtDefault.Check(); 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir sal_uInt16 nQuality = pPrintOpts->GetOptionsPrint().GetOutputQuality(); 197*cdf0e10cSrcweir if( nQuality == 0 ) 198*cdf0e10cSrcweir aRbtColor.Check(); 199*cdf0e10cSrcweir else if( nQuality == 1 ) 200*cdf0e10cSrcweir aRbtGrayscale.Check(); 201*cdf0e10cSrcweir else 202*cdf0e10cSrcweir aRbtBlackWhite.Check(); 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir aCbxDraw.SaveValue(); 205*cdf0e10cSrcweir aCbxNotes.SaveValue(); 206*cdf0e10cSrcweir aCbxHandout.SaveValue(); 207*cdf0e10cSrcweir aCbxOutline.SaveValue(); 208*cdf0e10cSrcweir aCbxDate.SaveValue(); 209*cdf0e10cSrcweir aCbxTime.SaveValue(); 210*cdf0e10cSrcweir aCbxPagename.SaveValue(); 211*cdf0e10cSrcweir aCbxHiddenPages.SaveValue(); 212*cdf0e10cSrcweir aRbtPagesize.SaveValue(); 213*cdf0e10cSrcweir aRbtPagetile.SaveValue(); 214*cdf0e10cSrcweir aRbtBooklet.SaveValue(); 215*cdf0e10cSrcweir aCbxPaperbin.SaveValue(); 216*cdf0e10cSrcweir aRbtColor.SaveValue(); 217*cdf0e10cSrcweir aRbtGrayscale.SaveValue(); 218*cdf0e10cSrcweir aRbtBlackWhite.SaveValue(); 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir ClickBookletHdl( NULL ); 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir // ----------------------------------------------------------------------- 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir SfxTabPage* SdPrintOptions::Create( Window* pWindow, 226*cdf0e10cSrcweir const SfxItemSet& rOutAttrs ) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir return( new SdPrintOptions( pWindow, rOutAttrs ) ); 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir //----------------------------------------------------------------------- 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir IMPL_LINK( SdPrintOptions, ClickCheckboxHdl, CheckBox *, pCbx ) 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir // there must be at least one of them checked 236*cdf0e10cSrcweir if( !aCbxDraw.IsChecked() && !aCbxNotes.IsChecked() && !aCbxOutline.IsChecked() && !aCbxHandout.IsChecked() ) 237*cdf0e10cSrcweir pCbx->Check(); 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir updateControls(); 240*cdf0e10cSrcweir return 0; 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir //----------------------------------------------------------------------- 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir IMPL_LINK( SdPrintOptions, ClickBookletHdl, CheckBox *, EMPTYARG ) 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir updateControls(); 248*cdf0e10cSrcweir return 0; 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir void SdPrintOptions::updateControls() 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir aCbxFront.Enable(aRbtBooklet.IsChecked()); 254*cdf0e10cSrcweir aCbxBack.Enable(aRbtBooklet.IsChecked()); 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir aCbxDate.Enable( !aRbtBooklet.IsChecked() ); 257*cdf0e10cSrcweir aCbxTime.Enable( !aRbtBooklet.IsChecked() ); 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir aCbxPagename.Enable( !aRbtBooklet.IsChecked() && (aCbxDraw.IsChecked() || aCbxNotes.IsChecked() || aCbxOutline.IsChecked()) ); 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir /* -----------------------------04.05.01 10:53-------------------------------- 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 265*cdf0e10cSrcweir void lcl_MoveRB_Impl(Window& rBtn, long nXDiff) 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir Point aPos(rBtn.GetPosPixel()); 268*cdf0e10cSrcweir aPos.X() -= nXDiff; 269*cdf0e10cSrcweir rBtn.SetPosPixel(aPos); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir void SdPrintOptions::SetDrawMode() 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir if(aCbxNotes.IsVisible()) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir aCbxNotes.Hide(); 277*cdf0e10cSrcweir aCbxHandout.Hide(); 278*cdf0e10cSrcweir aCbxOutline.Hide(); 279*cdf0e10cSrcweir aCbxDraw.Hide(); 280*cdf0e10cSrcweir aGrpPrint.Hide(); 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir aSeparator1FL.Hide(); 283*cdf0e10cSrcweir long nXDiff = aGrpOutput.GetPosPixel().X() - aGrpPrint.GetPosPixel().X(); 284*cdf0e10cSrcweir lcl_MoveRB_Impl(aRbtColor, nXDiff); 285*cdf0e10cSrcweir lcl_MoveRB_Impl(aRbtGrayscale, nXDiff); 286*cdf0e10cSrcweir lcl_MoveRB_Impl(aRbtBlackWhite, nXDiff); 287*cdf0e10cSrcweir lcl_MoveRB_Impl(aGrpOutput, nXDiff); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir long nWidth = aGrpOutput.GetSizePixel().Width() + nXDiff; 290*cdf0e10cSrcweir Size aSize(aGrpOutput.GetSizePixel()); 291*cdf0e10cSrcweir aSize.Width() = nWidth; 292*cdf0e10cSrcweir aGrpOutput.SetSizePixel(aSize); 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir void SdPrintOptions::PageCreated (SfxAllItemSet 297*cdf0e10cSrcweir #ifdef QUARTZ 298*cdf0e10cSrcweir aSet 299*cdf0e10cSrcweir #endif 300*cdf0e10cSrcweir ) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir #ifdef QUARTZ 303*cdf0e10cSrcweir SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_SDMODE_FLAG,sal_False); 304*cdf0e10cSrcweir if (pFlagItem) 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir sal_uInt32 nFlags=pFlagItem->GetValue(); 307*cdf0e10cSrcweir if ( ( nFlags & SD_DRAW_MODE ) == SD_DRAW_MODE ) 308*cdf0e10cSrcweir SetDrawMode(); 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir #else 311*cdf0e10cSrcweir SetDrawMode(); 312*cdf0e10cSrcweir #endif 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir 315