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