xref: /aoo4110/main/sd/source/ui/app/optsitem.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 #include <svx/svdmodel.hxx>
27 #include <sfx2/app.hxx>
28 #include <sfx2/sfx.hrc>
29 #ifndef _SV_SALBTYPE_HRC //autogen
30 #include <vcl/salbtype.hxx>
31 #endif
32 #include <unotools/syslocale.hxx>
33 
34 #include "app.hxx"
35 #include "optsitem.hxx"
36 #include "cfgids.hxx"
37 #include "FrameView.hxx"
38 
39 using namespace ::rtl;
40 using namespace ::utl;
41 using namespace ::com::sun::star::uno;
42 
43 #define B2U(_def_aStr) (OUString::createFromAscii(_def_aStr))
44 
getSafeValue(const Any & rAny)45 template< class T > T getSafeValue( const Any& rAny )
46 {
47 	T value = T();
48 	bool bOk = (rAny >>= value);
49 
50 	DBG_ASSERT( bOk, "SdOptionsItem, wrong type from configuration!" );
51 	(void)bOk;
52 
53 	return value;
54 }
55 
56 // -----------------
57 // - SdOptionsItem -
58 // -----------------
59 
SdOptionsItem(const SdOptionsGeneric & rParent,const OUString rSubTree)60 SdOptionsItem::SdOptionsItem( const SdOptionsGeneric& rParent, const OUString rSubTree ) :
61 	ConfigItem	( rSubTree ),
62 	mrParent	( rParent )
63 {
64 }
65 
66 // -----------------------------------------------------------------------------
67 
~SdOptionsItem()68 SdOptionsItem::~SdOptionsItem()
69 {
70 }
71 
72 // -----------------------------------------------------------------------------
73 
Commit()74 void SdOptionsItem::Commit()
75 {
76 	if( IsModified() )
77 		mrParent.Commit( *this );
78 };
79 
Notify(const com::sun::star::uno::Sequence<rtl::OUString> &)80 void SdOptionsItem::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& )
81 {}
82 
83 
84 // -----------------------------------------------------------------------------
85 
GetProperties(const Sequence<OUString> & rNames)86 Sequence< Any >	SdOptionsItem::GetProperties( const Sequence< OUString >& rNames )
87 {
88 	return ConfigItem::GetProperties( rNames );
89 }
90 
91 // -----------------------------------------------------------------------------
92 
PutProperties(const Sequence<OUString> & rNames,const Sequence<Any> & rValues)93 sal_Bool SdOptionsItem::PutProperties( const Sequence< OUString >& rNames, const Sequence< Any>& rValues )
94 {
95 	return ConfigItem::PutProperties( rNames, rValues );
96 }
97 
98 // -----------------------------------------------------------------------------
99 
SetModified()100 void SdOptionsItem::SetModified()
101 {
102 	ConfigItem::SetModified();
103 }
104 
105 // --------------------
106 // - SdOptionsGeneric -
107 // --------------------
108 
SdOptionsGeneric(sal_uInt16 nConfigId,const OUString & rSubTree)109 SdOptionsGeneric::SdOptionsGeneric( sal_uInt16 nConfigId, const OUString& rSubTree ) :
110 	maSubTree	( rSubTree ),
111 	mpCfgItem	( NULL ),
112 	mnConfigId	( nConfigId ),
113 	mbInit		( rSubTree.getLength() == 0 )
114 {
115 }
116 
117 // -----------------------------------------------------------------------------
118 
Init() const119 void SdOptionsGeneric::Init() const
120 {
121 	if( !mbInit )
122 	{
123 		SdOptionsGeneric* pThis	= const_cast<SdOptionsGeneric*>(this);
124 
125 		if( !mpCfgItem )
126 			pThis->mpCfgItem = new SdOptionsItem( *this, maSubTree );
127 
128 		const Sequence< OUString >	aNames( GetPropertyNames() );
129 		const Sequence< Any >		aValues = mpCfgItem->GetProperties( aNames );
130 
131 		if( aNames.getLength() && ( aValues.getLength() == aNames.getLength() ) )
132 		{
133 			const Any* pValues = aValues.getConstArray();
134 
135 			pThis->EnableModify( sal_False );
136 			pThis->mbInit = pThis->ReadData( pValues );
137 			pThis->EnableModify( sal_True );
138 		}
139 		else
140 			pThis->mbInit = sal_True;
141 	}
142 }
143 
144 // -----------------------------------------------------------------------------
145 
~SdOptionsGeneric()146 SdOptionsGeneric::~SdOptionsGeneric()
147 {
148 	delete mpCfgItem;
149 	mpCfgItem = NULL;
150 }
151 
152 // -----------------------------------------------------------------------------
153 
Commit(SdOptionsItem & rCfgItem) const154 void SdOptionsGeneric::Commit( SdOptionsItem& rCfgItem ) const
155 {
156 	const Sequence< OUString >	aNames( GetPropertyNames() );
157 	Sequence< Any >				aValues( aNames.getLength() );
158 
159 	if( aNames.getLength() && ( aValues.getLength() == aNames.getLength() ) )
160 	{
161 		if( (const_cast<SdOptionsGeneric*>(this))->WriteData( aValues.getArray() ) )
162 			rCfgItem.PutProperties( aNames, aValues );
163 		else
164 		{
165 			DBG_ERROR( "PutProperties failed" );
166 		}
167 	}
168 }
169 
170 // -----------------------------------------------------------------------------
171 
GetPropertyNames() const172 Sequence< OUString > SdOptionsGeneric::GetPropertyNames() const
173 {
174 	sal_uLong			nCount;
175 	const char**	ppPropNames;
176 
177 	GetPropNameArray( ppPropNames, nCount );
178 
179 	Sequence< OUString > aNames( nCount );
180 	OUString*			 pNames = aNames.getArray();
181 
182 	for( sal_uLong i = 0; i < nCount; i++ )
183 		pNames[ i ] = OUString::createFromAscii( ppPropNames[ i ] );
184 
185 	return aNames;
186 }
187 
188 // -----------------------------------------------------------------------------
189 
Store()190 void SdOptionsGeneric::Store()
191 {
192 	if( mpCfgItem )
193 		mpCfgItem->Commit();
194 }
195 
196 // -----------------------------------------------------------------------------
197 
isMetricSystem()198 bool SdOptionsGeneric::isMetricSystem()
199 {
200 	SvtSysLocale aSysLocale;
201     MeasurementSystem eSys = aSysLocale.GetLocaleDataPtr()->getMeasurementSystemEnum();
202 
203 	return ( eSys == MEASURE_METRIC );
204 }
205 
206 /*************************************************************************
207 |*
208 |* SdOptionsLayout
209 |*
210 \************************************************************************/
211 
SdOptionsLayout(sal_uInt16 nConfigId,sal_Bool bUseConfig)212 SdOptionsLayout::SdOptionsLayout(  sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
213 	SdOptionsGeneric( nConfigId, bUseConfig ?
214 					  ( ( SDCFG_DRAW == nConfigId ) ?
215 						B2U( "Office.Draw/Layout" ) :
216 						B2U( "Office.Impress/Layout" ) ) :
217 					  OUString() ),
218 	bRuler( sal_True ),
219 	bMoveOutline( sal_True ),
220 	bDragStripes( sal_False ),
221 	bHandlesBezier( sal_False ),
222 	bHelplines( sal_True ),
223 	nMetric((sal_uInt16)(isMetricSystem() ? FUNIT_CM : FUNIT_INCH)),
224 	nDefTab( 1250 )
225 {
226 	EnableModify( sal_True );
227 }
228 
229 // -----------------------------------------------------------------------------
230 
operator ==(const SdOptionsLayout & rOpt) const231 sal_Bool SdOptionsLayout::operator==( const SdOptionsLayout& rOpt ) const
232 {
233 	return(	IsRulerVisible() == rOpt.IsRulerVisible() &&
234 			IsMoveOutline() == rOpt.IsMoveOutline() &&
235 			IsDragStripes() == rOpt.IsDragStripes() &&
236 			IsHandlesBezier() == rOpt.IsHandlesBezier() &&
237 			IsHelplines() == rOpt.IsHelplines() &&
238 			GetMetric() == rOpt.GetMetric() &&
239 			GetDefTab() == rOpt.GetDefTab() );
240 }
241 
242 // -----------------------------------------------------------------------------
243 
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const244 void SdOptionsLayout::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
245 {
246 	static const char* aPropNamesMetric[] =
247 	{
248 		"Display/Ruler",
249 		"Display/Bezier",
250 		"Display/Contour",
251 		"Display/Guide",
252 		"Display/Helpline",
253 		"Other/MeasureUnit/Metric",
254 		"Other/TabStop/Metric"
255 	};
256 
257 	static const char* aPropNamesNonMetric[] =
258 	{
259 		"Display/Ruler",
260 		"Display/Bezier",
261 		"Display/Contour",
262 		"Display/Guide",
263 		"Display/Helpline",
264 		"Other/MeasureUnit/NonMetric",
265 		"Other/TabStop/NonMetric"
266 	};
267 
268 	rCount = 7;
269 
270 	if( isMetricSystem() )
271 		ppNames = aPropNamesMetric;
272 	else
273 		ppNames = aPropNamesNonMetric;
274 }
275 
276 // -----------------------------------------------------------------------------
277 
ReadData(const Any * pValues)278 sal_Bool SdOptionsLayout::ReadData( const Any* pValues )
279 {
280 	if( pValues[0].hasValue() ) SetRulerVisible( *(sal_Bool*) pValues[ 0 ].getValue() );
281 	if( pValues[1].hasValue() ) SetHandlesBezier( *(sal_Bool*) pValues[ 1 ].getValue() );
282 	if( pValues[2].hasValue() ) SetMoveOutline( *(sal_Bool*) pValues[ 2 ].getValue() );
283 	if( pValues[3].hasValue() ) SetDragStripes( *(sal_Bool*) pValues[ 3 ].getValue() );
284 	if( pValues[4].hasValue() ) SetHelplines( *(sal_Bool*) pValues[ 4 ].getValue() );
285 	if( pValues[5].hasValue() ) SetMetric( (sal_uInt16) *(sal_Int32*) pValues[ 5 ].getValue() );
286 	if( pValues[6].hasValue() ) SetDefTab( (sal_uInt16) *(sal_Int32*) pValues[ 6 ].getValue() );
287 
288 	return sal_True;
289 }
290 
291 // -----------------------------------------------------------------------------
292 
WriteData(Any * pValues) const293 sal_Bool SdOptionsLayout::WriteData( Any* pValues ) const
294 {
295 	pValues[ 0 ] <<= IsRulerVisible();
296 	pValues[ 1 ] <<= IsHandlesBezier();
297 	pValues[ 2 ] <<= IsMoveOutline();
298 	pValues[ 3 ] <<= IsDragStripes();
299 	pValues[ 4 ] <<= IsHelplines();
300 	pValues[ 5 ] <<= (sal_Int32) GetMetric();
301 	pValues[ 6 ] <<= (sal_Int32) GetDefTab();
302 
303 	return sal_True;
304 }
305 
306 /*************************************************************************
307 |*
308 |* SdOptionsLayoutItem
309 |*
310 \************************************************************************/
311 
SdOptionsLayoutItem(sal_uInt16 _nWhich)312 SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich )
313 :	SfxPoolItem		( _nWhich )
314 ,	maOptionsLayout	( 0, sal_False )
315 {
316 }
317 
318 // ----------------------------------------------------------------------
319 
SdOptionsLayoutItem(sal_uInt16 _nWhich,SdOptions * pOpts,::sd::FrameView * pView)320 SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
321 :	SfxPoolItem		( _nWhich )
322 ,	maOptionsLayout	( 0, sal_False )
323 {
324 	if( pOpts )
325 	{
326 		maOptionsLayout.SetMetric( pOpts->GetMetric() );
327 		maOptionsLayout.SetDefTab( pOpts->GetDefTab() );
328 	}
329 
330 	if( pView )
331 	{
332 		maOptionsLayout.SetRulerVisible( pView->HasRuler() );
333 		maOptionsLayout.SetMoveOutline( !pView->IsNoDragXorPolys() );
334 		maOptionsLayout.SetDragStripes( pView->IsDragStripes() );
335 		maOptionsLayout.SetHandlesBezier( pView->IsPlusHandlesAlwaysVisible() );
336 		maOptionsLayout.SetHelplines( pView->IsHlplVisible() );
337 	}
338 	else if( pOpts )
339 	{
340 		maOptionsLayout.SetRulerVisible( pOpts->IsRulerVisible() );
341 		maOptionsLayout.SetMoveOutline( pOpts->IsMoveOutline() );
342 		maOptionsLayout.SetDragStripes( pOpts->IsDragStripes() );
343 		maOptionsLayout.SetHandlesBezier( pOpts->IsHandlesBezier() );
344 		maOptionsLayout.SetHelplines( pOpts->IsHelplines() );
345 	}
346 }
347 
348 // ----------------------------------------------------------------------
349 
Clone(SfxItemPool *) const350 SfxPoolItem* SdOptionsLayoutItem::Clone( SfxItemPool* ) const
351 {
352 	return new SdOptionsLayoutItem( *this );
353 }
354 
355 
356 // ----------------------------------------------------------------------
357 
operator ==(const SfxPoolItem & rAttr) const358 int SdOptionsLayoutItem::operator==( const SfxPoolItem& rAttr ) const
359 {
360 	const bool bSameType = SfxPoolItem::operator==( rAttr );
361 	DBG_ASSERT( bSameType, "SdOptionsLayoutItem::operator==(), differen pool item type!" );
362 	return bSameType && ( maOptionsLayout == static_cast< const SdOptionsLayoutItem& >( rAttr ).maOptionsLayout );
363 }
364 
365 // -----------------------------------------------------------------------
366 
SetOptions(SdOptions * pOpts) const367 void SdOptionsLayoutItem::SetOptions( SdOptions* pOpts ) const
368 {
369 	if( pOpts )
370 	{
371 		pOpts->SetRulerVisible( maOptionsLayout.IsRulerVisible() );
372 		pOpts->SetMoveOutline( maOptionsLayout.IsMoveOutline() );
373 		pOpts->SetDragStripes( maOptionsLayout.IsDragStripes() );
374 		pOpts->SetHandlesBezier( maOptionsLayout.IsHandlesBezier() );
375 		pOpts->SetHelplines( maOptionsLayout.IsHelplines() );
376 		pOpts->SetMetric( maOptionsLayout.GetMetric() );
377 		pOpts->SetDefTab( maOptionsLayout.GetDefTab() );
378 	}
379 }
380 
381 /*************************************************************************
382 |*
383 |* SdOptionsContents
384 |*
385 \************************************************************************/
386 
SdOptionsContents(sal_uInt16 nConfigId,sal_Bool bUseConfig)387 SdOptionsContents::SdOptionsContents( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
388 	SdOptionsGeneric( nConfigId, bUseConfig ?
389 					  ( ( SDCFG_DRAW == nConfigId ) ?
390 						B2U( "Office.Draw/Content" ) :
391 						B2U( "Office.Impress/Content" ) ) :
392 					  OUString() )
393 {
394 	EnableModify( sal_True );
395 }
396 
397 // -----------------------------------------------------------------------------
398 
operator ==(const SdOptionsContents &) const399 sal_Bool SdOptionsContents::operator==(const SdOptionsContents&) const
400 {
401     return true;
402 }
403 
404 // -----------------------------------------------------------------------------
405 
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const406 void SdOptionsContents::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
407 {
408 	static const char* aPropNames[] =
409 	{
410 		"Display/PicturePlaceholder",
411 		"Display/ContourMode",
412 		"Display/LineContour",
413 		"Display/TextPlaceholder"
414 	};
415 
416 	rCount = 4;
417 	ppNames = aPropNames;
418 }
419 
420 // -----------------------------------------------------------------------------
421 
ReadData(const Any *)422 sal_Bool SdOptionsContents::ReadData(const Any*)
423 {
424 	return sal_True;
425 }
426 
427 // -----------------------------------------------------------------------------
428 
WriteData(Any * pValues) const429 sal_Bool SdOptionsContents::WriteData( Any* pValues ) const
430 {
431 	//#i80528# no draft anymore
432 	pValues[ 0 ] <<= (sal_Bool)false;
433 	pValues[ 1 ] <<= (sal_Bool)false;
434 	pValues[ 2 ] <<= (sal_Bool)false;
435 	pValues[ 3 ] <<= (sal_Bool)false;
436 
437 	return sal_True;
438 }
439 
440 /*************************************************************************
441 |*
442 |* SdOptionsContentsItem
443 |*
444 \************************************************************************/
445 
SdOptionsContentsItem(sal_uInt16 _nWhich,SdOptions *,::sd::FrameView *)446 SdOptionsContentsItem::SdOptionsContentsItem(sal_uInt16 _nWhich, SdOptions*, ::sd::FrameView*)
447 :	SfxPoolItem			( _nWhich )
448 ,	maOptionsContents	( 0, sal_False )
449 {
450 }
451 
452 // ----------------------------------------------------------------------
453 
Clone(SfxItemPool *) const454 SfxPoolItem* SdOptionsContentsItem::Clone( SfxItemPool* ) const
455 {
456 	return new SdOptionsContentsItem( *this );
457 }
458 
459 // ----------------------------------------------------------------------
460 
operator ==(const SfxPoolItem & rAttr) const461 int SdOptionsContentsItem::operator==( const SfxPoolItem& rAttr ) const
462 {
463 	const bool bSameType = SfxPoolItem::operator==(rAttr);
464 	DBG_ASSERT( bSameType, "SdOptionsContentsItem::operator==(), differen pool item type!" );
465 	return bSameType && ( maOptionsContents == static_cast<const SdOptionsContentsItem&>( rAttr ).maOptionsContents );
466 }
467 
468 // -----------------------------------------------------------------------
469 
SetOptions(SdOptions *) const470 void SdOptionsContentsItem::SetOptions(SdOptions*) const
471 {
472 }
473 
474 /*************************************************************************
475 |*
476 |* SdOptionsMisc
477 |*
478 \************************************************************************/
479 
SdOptionsMisc(sal_uInt16 nConfigId,sal_Bool bUseConfig)480 SdOptionsMisc::SdOptionsMisc( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
481 	SdOptionsGeneric( nConfigId, bUseConfig ?
482 					  ( ( SDCFG_DRAW == nConfigId ) ?
483 						B2U( "Office.Draw/Misc" ) :
484 						B2U( "Office.Impress/Misc" ) ) :
485 					  OUString() ),
486 	// #97016#
487 	nDefaultObjectSizeWidth(8000),
488 	nDefaultObjectSizeHeight(5000),
489 	bStartWithTemplate( sal_True ),
490 	bMarkedHitMovesAlways( sal_True ),
491 	bMoveOnlyDragging( sal_False ),
492 	bCrookNoContortion( sal_False ),
493 	bQuickEdit( GetConfigId() != SDCFG_DRAW ),
494 	bMasterPageCache( sal_True ),
495 	bDragWithCopy( sal_False ),
496 	bPickThrough( sal_True ),
497 	bBigHandles( sal_True ),    // new default: Use big handles
498 	bDoubleClickTextEdit( sal_True ),
499 	bClickChangeRotation( sal_False ),
500 	bStartWithActualPage( sal_False ),
501     bStartWithPresenterScreen( sal_True ), // default: Enable the Presenter Screen
502 	bSolidDragging( sal_True ),
503 	bSolidMarkHdl( sal_True ),  // default: Use nice handles
504 	bSummationOfParagraphs( sal_False ),
505 	// #90356#
506 	bShowUndoDeleteWarning( sal_True ),
507     bSlideshowRespectZOrder( sal_True ),
508     bShowComments( sal_True ),
509 	bPreviewNewEffects( sal_True ),
510 	bPreviewChangedEffects( sal_False ),
511 	bPreviewTransitions( sal_True ),
512 	mnDisplay( 0 ),
513 	mnPenColor( 0xff0000 ),
514 	mnPenWidth( 150.0 ),
515 
516 	// The default for 6.1-and-above documents is to use printer-independent
517     // formatting.
518 	mnPrinterIndependentLayout (1)
519 {
520 	EnableModify( sal_True );
521 }
522 
523 // -----------------------------------------------------------------------------
524 
operator ==(const SdOptionsMisc & rOpt) const525 sal_Bool SdOptionsMisc::operator==( const SdOptionsMisc& rOpt ) const
526 {
527 	return(	IsStartWithTemplate() == rOpt.IsStartWithTemplate() &&
528 			IsMarkedHitMovesAlways() == rOpt.IsMarkedHitMovesAlways() &&
529 			IsMoveOnlyDragging() == rOpt.IsMoveOnlyDragging() &&
530 			IsCrookNoContortion() == rOpt.IsCrookNoContortion() &&
531 			IsQuickEdit() == rOpt.IsQuickEdit() &&
532 			IsMasterPagePaintCaching() == rOpt.IsMasterPagePaintCaching() &&
533 			IsDragWithCopy() == rOpt.IsDragWithCopy() &&
534 			IsPickThrough() == rOpt.IsPickThrough() &&
535 			IsBigHandles() == rOpt.IsBigHandles() &&
536 			IsDoubleClickTextEdit() == rOpt.IsDoubleClickTextEdit() &&
537 			IsClickChangeRotation() == rOpt.IsClickChangeRotation() &&
538 			IsStartWithActualPage() == rOpt.IsStartWithActualPage() &&
539             IsStartWithPresenterScreen() == rOpt.IsStartWithPresenterScreen() &&
540 			IsSummationOfParagraphs() == rOpt.IsSummationOfParagraphs() &&
541 			IsSolidDragging() == rOpt.IsSolidDragging() &&
542 			IsSolidMarkHdl() == rOpt.IsSolidMarkHdl() &&
543 			// #90356#
544 			IsShowUndoDeleteWarning() == rOpt.IsShowUndoDeleteWarning() &&
545 			IsSlideshowRespectZOrder() == rOpt.IsSlideshowRespectZOrder() &&
546 			GetPrinterIndependentLayout() == rOpt.GetPrinterIndependentLayout() &&
547 			// #97016#
548 			GetDefaultObjectSizeWidth() == rOpt.GetDefaultObjectSizeWidth() &&
549 			GetDefaultObjectSizeHeight() == rOpt.GetDefaultObjectSizeHeight() &&
550 
551 			IsPreviewNewEffects() == rOpt.IsPreviewNewEffects() &&
552 			IsPreviewChangedEffects() == rOpt.IsPreviewChangedEffects() &&
553 			IsPreviewTransitions() == rOpt.IsPreviewTransitions() &&
554 			GetDisplay() == rOpt.GetDisplay() &&
555 			IsShowComments() == rOpt.IsShowComments() &&
556 			GetPresentationPenColor() == rOpt.GetPresentationPenColor() &&
557 			GetPresentationPenWidth() == rOpt.GetPresentationPenWidth()
558 		);
559 }
560 
561 // -----------------------------------------------------------------------------
562 
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const563 void SdOptionsMisc::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
564 {
565 	static const char* aPropNames[] =
566 	{
567 		"ObjectMoveable",
568 		"NoDistort",
569 		"TextObject/QuickEditing",
570 		"BackgroundCache",
571 		"CopyWhileMoving",
572 		"TextObject/Selectable",
573 		"BigHandles",
574 		"DclickTextedit",
575 		"RotateClick",
576 		"Preview",
577 		"ModifyWithAttributes",
578 		"SimpleHandles",
579 		// #97016#
580 		"DefaultObjectSize/Width",
581 		"DefaultObjectSize/Height",
582 
583         "Compatibility/PrinterIndependentLayout",
584 
585 		"ShowComments",
586 
587 		// just for impress
588 		"NewDoc/AutoPilot",
589 		"Start/CurrentPage",
590 		"Compatibility/AddBetween",
591 		// #90356#
592 		"ShowUndoDeleteWarning",
593         "SlideshowRespectZOrder",
594 
595 		"PreviewNewEffects",
596 		"PreviewChangedEffects",
597 		"PreviewTransitions",
598 
599 		"Display",
600 
601 		"PenColor",
602 		"PenWidth",
603 
604         "Start/PresenterScreen"
605 	};
606 
607 	rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 28 : 16 );
608 	ppNames = aPropNames;
609 }
610 
611 // -----------------------------------------------------------------------------
612 
ReadData(const Any * pValues)613 sal_Bool SdOptionsMisc::ReadData( const Any* pValues )
614 {
615 	if( pValues[0].hasValue() ) SetMarkedHitMovesAlways( *(sal_Bool*) pValues[ 0 ].getValue() );
616 	if( pValues[1].hasValue() ) SetCrookNoContortion( *(sal_Bool*) pValues[ 1 ].getValue() );
617 	if( pValues[2].hasValue() ) SetQuickEdit( *(sal_Bool*)pValues[ 2 ].getValue() );
618 	if( pValues[3].hasValue() ) SetMasterPagePaintCaching( *(sal_Bool*) pValues[ 3 ].getValue() );
619 	if( pValues[4].hasValue() ) SetDragWithCopy( *(sal_Bool*) pValues[ 4 ].getValue() );
620 	if( pValues[5].hasValue() ) SetPickThrough( *(sal_Bool*) pValues[ 5 ].getValue() );
621 	if( pValues[6].hasValue() ) SetBigHandles( *(sal_Bool*) pValues[ 6 ].getValue() );
622 	if( pValues[7].hasValue() ) SetDoubleClickTextEdit( *(sal_Bool*) pValues[ 7 ].getValue() );
623 	if( pValues[8].hasValue() ) SetClickChangeRotation( *(sal_Bool*) pValues[ 8 ].getValue() );
624     //	if( pValues[9].hasValue() ) SetPreviewQuality( FRound( *(double*) pValues[ 9 ].getValue() ) );
625 	if( pValues[10].hasValue() ) SetSolidDragging( *(sal_Bool*) pValues[ 10 ].getValue() );
626 	if( pValues[11].hasValue() ) SetSolidMarkHdl( *(sal_Bool*) pValues[ 11 ].getValue() );
627 	// #97016#
628 	if( pValues[12].hasValue() ) SetDefaultObjectSizeWidth( *(sal_uInt32*) pValues[ 12 ].getValue() );
629 	if( pValues[13].hasValue() ) SetDefaultObjectSizeHeight( *(sal_uInt32*) pValues[ 13 ].getValue() );
630 	if( pValues[14].hasValue() ) SetPrinterIndependentLayout( *(sal_uInt16*) pValues[ 14 ].getValue() );
631 
632     if( pValues[15].hasValue() )
633 		SetShowComments(  *(sal_Bool*) pValues[ 15 ].getValue() );
634 
635 	// just for Impress
636 	if( GetConfigId() == SDCFG_IMPRESS )
637 	{
638 		if( pValues[16].hasValue() )
639 			SetStartWithTemplate( *(sal_Bool*) pValues[ 16 ].getValue() );
640 		if( pValues[17].hasValue() )
641 			SetStartWithActualPage( *(sal_Bool*) pValues[ 17 ].getValue() );
642 		if( pValues[18].hasValue() )
643 			SetSummationOfParagraphs( *(sal_Bool*) pValues[ 18 ].getValue() );
644 		// #90356#
645 		if( pValues[19].hasValue() )
646 			SetShowUndoDeleteWarning( *(sal_Bool*) pValues[ 19 ].getValue() );
647 
648 		if( pValues[20].hasValue() )
649             SetSlideshowRespectZOrder(*(sal_Bool*) pValues[ 20 ].getValue());
650 
651 		if( pValues[21].hasValue() )
652 			SetPreviewNewEffects(*(sal_Bool*) pValues[ 21 ].getValue());
653 
654 		if( pValues[22].hasValue() )
655 			SetPreviewChangedEffects(*(sal_Bool*) pValues[ 22 ].getValue());
656 
657 		if( pValues[23].hasValue() )
658 			SetPreviewTransitions(*(sal_Bool*) pValues[ 23 ].getValue());
659 
660 		if( pValues[24].hasValue() )
661 			SetDisplay(*(sal_Int32*) pValues[ 24 ].getValue());
662 
663 		if( pValues[25].hasValue() )
664 			SetPresentationPenColor( getSafeValue< sal_Int32 >( pValues[ 25 ] ) );
665 
666 		if( pValues[26].hasValue() )
667 			SetPresentationPenWidth( getSafeValue< double >( pValues[ 26 ] ) );
668 
669         if( pValues[27].hasValue() )
670             SetStartWithPresenterScreen( *(sal_Bool*) pValues[ 27 ].getValue() );
671 	}
672 
673 	return sal_True;
674 }
675 
676 // -----------------------------------------------------------------------------
677 
WriteData(Any * pValues) const678 sal_Bool SdOptionsMisc::WriteData( Any* pValues ) const
679 {
680 	pValues[ 0 ] <<= IsMarkedHitMovesAlways();
681 	pValues[ 1 ] <<= IsCrookNoContortion();
682 	pValues[ 2 ] <<= IsQuickEdit();
683 	pValues[ 3 ] <<= IsMasterPagePaintCaching();
684 	pValues[ 4 ] <<= IsDragWithCopy();
685 	pValues[ 5 ] <<= IsPickThrough();
686 	pValues[ 6 ] <<= IsBigHandles();
687 	pValues[ 7 ] <<= IsDoubleClickTextEdit();
688 	pValues[ 8 ] <<= IsClickChangeRotation();
689     // The preview is not supported anymore.  Use a dummy value.
690 	pValues[ 9 ] <<= (double)0;// GetPreviewQuality();
691 	pValues[ 10 ] <<= IsSolidDragging();
692 	pValues[ 11 ] <<= IsSolidMarkHdl();
693 	// #97016#
694 	pValues[ 12 ] <<= GetDefaultObjectSizeWidth();
695 	pValues[ 13 ] <<= GetDefaultObjectSizeHeight();
696 	pValues[ 14 ] <<= GetPrinterIndependentLayout();
697     pValues[ 15 ] <<= (sal_Bool)IsShowComments();
698 
699 	// just for Impress
700 	if( GetConfigId() == SDCFG_IMPRESS )
701 	{
702 		pValues[ 16 ] <<= IsStartWithTemplate();
703 		pValues[ 17 ] <<= IsStartWithActualPage();
704 		pValues[ 18 ] <<= IsSummationOfParagraphs();
705 		// #90356#
706 		pValues[ 19 ] <<= IsShowUndoDeleteWarning();
707 		pValues[ 20 ] <<= IsSlideshowRespectZOrder();
708 
709 		pValues[ 21 ] <<= IsPreviewNewEffects();
710 		pValues[ 22 ] <<= IsPreviewChangedEffects();
711 		pValues[ 23 ] <<= IsPreviewTransitions();
712 
713 		pValues[ 24 ] <<= GetDisplay();
714 
715 		pValues[ 25 ] <<= GetPresentationPenColor();
716 		pValues[ 26 ] <<= GetPresentationPenWidth();
717 
718         pValues[ 27 ] <<= IsStartWithPresenterScreen();
719 	}
720 
721 	return sal_True;
722 }
723 
724 /*************************************************************************
725 |*
726 |* SdOptionsMiscItem
727 |*
728 \************************************************************************/
729 
SdOptionsMiscItem(sal_uInt16 _nWhich)730 SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich )
731 :	SfxPoolItem		( _nWhich )
732 ,	maOptionsMisc	( 0, sal_False )
733 {
734 }
735 
736 // ----------------------------------------------------------------------
737 
SdOptionsMiscItem(sal_uInt16 _nWhich,SdOptions * pOpts,::sd::FrameView * pView)738 SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
739 :	SfxPoolItem		( _nWhich )
740 ,	maOptionsMisc	( 0, sal_False )
741 {
742 	if( pOpts )
743 	{
744 		maOptionsMisc.SetStartWithTemplate( pOpts->IsStartWithTemplate() );
745 		maOptionsMisc.SetStartWithActualPage( pOpts->IsStartWithActualPage() );
746         maOptionsMisc.SetStartWithPresenterScreen( pOpts->IsStartWithPresenterScreen() );
747 		maOptionsMisc.SetSummationOfParagraphs( pOpts->IsSummationOfParagraphs() );
748 		// #90356#
749 		maOptionsMisc.SetShowUndoDeleteWarning( pOpts->IsShowUndoDeleteWarning() );
750 		maOptionsMisc.SetPrinterIndependentLayout( pOpts->GetPrinterIndependentLayout() );
751 		// #97016#
752 		maOptionsMisc.SetDefaultObjectSizeWidth( pOpts->GetDefaultObjectSizeWidth() );
753 		maOptionsMisc.SetDefaultObjectSizeHeight( pOpts->GetDefaultObjectSizeHeight() );
754 
755 		maOptionsMisc.SetPreviewNewEffects(pOpts->IsPreviewNewEffects());
756 		maOptionsMisc.SetPreviewChangedEffects(pOpts->IsPreviewChangedEffects());
757 		maOptionsMisc.SetPreviewTransitions(pOpts->IsPreviewTransitions());
758 
759 		maOptionsMisc.SetDisplay(pOpts->GetDisplay());
760 		maOptionsMisc.SetShowComments( pOpts->IsShowComments() );
761 
762 		maOptionsMisc.SetPresentationPenColor(pOpts->GetPresentationPenColor() );
763 		maOptionsMisc.SetPresentationPenWidth(pOpts->GetPresentationPenWidth() );
764 	}
765 
766 	if( pView )
767 	{
768 		maOptionsMisc.SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
769 		maOptionsMisc.SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
770 		maOptionsMisc.SetCrookNoContortion( pView->IsCrookNoContortion() );
771 		maOptionsMisc.SetQuickEdit( pView->IsQuickEdit() );
772 
773 		// #i26631#
774 		maOptionsMisc.SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
775 
776 		maOptionsMisc.SetDragWithCopy( pView->IsDragWithCopy() );
777 		maOptionsMisc.SetPickThrough( (sal_Bool)pView->GetModel()->IsPickThroughTransparentTextFrames() );
778 		maOptionsMisc.SetBigHandles( (sal_Bool)pView->IsBigHandles() );
779 		maOptionsMisc.SetDoubleClickTextEdit( pView->IsDoubleClickTextEdit() );
780 		maOptionsMisc.SetClickChangeRotation( pView->IsClickChangeRotation() );
781 		maOptionsMisc.SetSolidDragging( pView->IsSolidDragging() );
782 		maOptionsMisc.SetSolidMarkHdl( pView->IsSolidMarkHdl() );
783 	}
784 	else if( pOpts )
785 	{
786 		maOptionsMisc.SetMarkedHitMovesAlways( pOpts->IsMarkedHitMovesAlways() );
787 		maOptionsMisc.SetMoveOnlyDragging( pOpts->IsMoveOnlyDragging() );
788 		maOptionsMisc.SetCrookNoContortion( pOpts->IsCrookNoContortion() );
789 		maOptionsMisc.SetQuickEdit( pOpts->IsQuickEdit() );
790 		maOptionsMisc.SetMasterPagePaintCaching( pOpts->IsMasterPagePaintCaching() );
791 		maOptionsMisc.SetDragWithCopy( pOpts->IsDragWithCopy() );
792 		maOptionsMisc.SetPickThrough( pOpts->IsPickThrough() );
793 		maOptionsMisc.SetBigHandles( pOpts->IsBigHandles() );
794 		maOptionsMisc.SetDoubleClickTextEdit( pOpts->IsDoubleClickTextEdit() );
795 		maOptionsMisc.SetClickChangeRotation( pOpts->IsClickChangeRotation() );
796 		maOptionsMisc.SetSolidDragging( pOpts->IsSolidDragging() );
797 		maOptionsMisc.SetSolidMarkHdl( pOpts->IsSolidMarkHdl() );
798 	}
799 }
800 
801 // ----------------------------------------------------------------------
802 
Clone(SfxItemPool *) const803 SfxPoolItem* SdOptionsMiscItem::Clone( SfxItemPool* ) const
804 {
805 	return new SdOptionsMiscItem( *this );
806 }
807 
808 
809 // ----------------------------------------------------------------------
810 
operator ==(const SfxPoolItem & rAttr) const811 int SdOptionsMiscItem::operator==( const SfxPoolItem& rAttr ) const
812 {
813 	const bool bSameType = SfxPoolItem::operator==(rAttr);
814 	DBG_ASSERT( bSameType, "SdOptionsMiscItem::operator==(), differen pool item type!" );
815 	return bSameType && ( maOptionsMisc == static_cast< const SdOptionsMiscItem& >(rAttr).maOptionsMisc );
816 }
817 
818 // -----------------------------------------------------------------------
819 
SetOptions(SdOptions * pOpts) const820 void SdOptionsMiscItem::SetOptions( SdOptions* pOpts ) const
821 {
822 	if( pOpts )
823 	{
824 		pOpts->SetStartWithTemplate( maOptionsMisc.IsStartWithTemplate() );
825 		pOpts->SetMarkedHitMovesAlways( maOptionsMisc.IsMarkedHitMovesAlways() );
826 		pOpts->SetMoveOnlyDragging( maOptionsMisc.IsMoveOnlyDragging() );
827 		pOpts->SetCrookNoContortion( maOptionsMisc.IsCrookNoContortion() );
828 		pOpts->SetQuickEdit( maOptionsMisc.IsQuickEdit() );
829 		pOpts->SetMasterPagePaintCaching( maOptionsMisc.IsMasterPagePaintCaching() );
830 		pOpts->SetDragWithCopy( maOptionsMisc.IsDragWithCopy() );
831 		pOpts->SetPickThrough( maOptionsMisc.IsPickThrough() );
832 		pOpts->SetBigHandles( maOptionsMisc.IsBigHandles() );
833 		pOpts->SetDoubleClickTextEdit( maOptionsMisc.IsDoubleClickTextEdit() );
834 		pOpts->SetClickChangeRotation( maOptionsMisc.IsClickChangeRotation() );
835 		pOpts->SetStartWithActualPage( maOptionsMisc.IsStartWithActualPage() );
836         pOpts->SetStartWithPresenterScreen( maOptionsMisc.IsStartWithPresenterScreen() );
837 		pOpts->SetSummationOfParagraphs( maOptionsMisc.IsSummationOfParagraphs() );
838 		pOpts->SetSolidDragging( maOptionsMisc.IsSolidDragging() );
839 		pOpts->SetSolidMarkHdl( maOptionsMisc.IsSolidMarkHdl() );
840 		// #90356#
841 		pOpts->SetShowUndoDeleteWarning( maOptionsMisc.IsShowUndoDeleteWarning() );
842 		pOpts->SetPrinterIndependentLayout( maOptionsMisc.GetPrinterIndependentLayout() );
843 		pOpts->SetShowComments( maOptionsMisc.IsShowComments() );
844 		// #97016#
845 		pOpts->SetDefaultObjectSizeWidth( maOptionsMisc.GetDefaultObjectSizeWidth() );
846 		pOpts->SetDefaultObjectSizeHeight( maOptionsMisc.GetDefaultObjectSizeHeight() );
847 
848 		pOpts->SetPreviewNewEffects( maOptionsMisc.IsPreviewNewEffects() );
849 		pOpts->SetPreviewChangedEffects( maOptionsMisc.IsPreviewChangedEffects() );
850 		pOpts->SetPreviewTransitions( maOptionsMisc.IsPreviewTransitions() );
851 
852 		pOpts->SetDisplay( maOptionsMisc.GetDisplay() );
853 
854 		pOpts->SetPresentationPenColor( maOptionsMisc.GetPresentationPenColor() );
855 		pOpts->SetPresentationPenWidth( maOptionsMisc.GetPresentationPenWidth() );
856 	}
857 }
858 
859 /*************************************************************************
860 |*
861 |* SdOptionsSnap
862 |*
863 \************************************************************************/
864 
SdOptionsSnap(sal_uInt16 nConfigId,sal_Bool bUseConfig)865 SdOptionsSnap::SdOptionsSnap( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
866 	SdOptionsGeneric( nConfigId, bUseConfig ?
867 					  ( ( SDCFG_DRAW == nConfigId ) ?
868 						B2U( "Office.Draw/Snap" ) :
869 						B2U( "Office.Impress/Snap" ) ) :
870 					  OUString() ),
871 	bSnapHelplines( sal_True ),
872 	bSnapBorder( sal_True ),
873 	bSnapFrame( sal_False ),
874 	bSnapPoints( sal_False ),
875 	bOrtho( sal_False ),
876 	bBigOrtho( sal_True ),
877 	bRotate( sal_False ),
878 	nSnapArea( 5 ),
879 	nAngle( 1500 ),
880 	nBezAngle( 1500 )
881 
882 {
883 	EnableModify( sal_True );
884 }
885 
886 // -----------------------------------------------------------------------------
887 
operator ==(const SdOptionsSnap & rOpt) const888 sal_Bool SdOptionsSnap::operator==( const SdOptionsSnap& rOpt ) const
889 {
890 	return(	IsSnapHelplines() == rOpt.IsSnapHelplines() &&
891 			IsSnapBorder() == rOpt.IsSnapBorder() &&
892 			IsSnapFrame() == rOpt.IsSnapFrame() &&
893 			IsSnapPoints() == rOpt.IsSnapPoints() &&
894 			IsOrtho() == rOpt.IsOrtho() &&
895 			IsBigOrtho() == rOpt.IsBigOrtho() &&
896 			IsRotate() == rOpt.IsRotate() &&
897 			GetSnapArea() == rOpt.GetSnapArea() &&
898 			GetAngle() == rOpt.GetAngle() &&
899 			GetEliminatePolyPointLimitAngle() == rOpt.GetEliminatePolyPointLimitAngle() );
900 }
901 
902 // -----------------------------------------------------------------------------
903 
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const904 void SdOptionsSnap::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
905 {
906 	static const char* aPropNames[] =
907 	{
908 		"Object/SnapLine",
909 		"Object/PageMargin",
910 		"Object/ObjectFrame",
911 		"Object/ObjectPoint",
912 		"Position/CreatingMoving",
913 		"Position/ExtendEdges",
914 		"Position/Rotating",
915 		"Object/Range",
916 		"Position/RotatingValue",
917 		"Position/PointReduction"
918 	};
919 
920 	rCount = 10;
921 	ppNames = aPropNames;
922 }
923 
924 // -----------------------------------------------------------------------------
925 
ReadData(const Any * pValues)926 sal_Bool SdOptionsSnap::ReadData( const Any* pValues )
927 {
928 	if( pValues[0].hasValue() ) SetSnapHelplines( *(sal_Bool*) pValues[ 0 ].getValue() );
929 	if( pValues[1].hasValue() ) SetSnapBorder( *(sal_Bool*)pValues[ 1 ].getValue() );
930 	if( pValues[2].hasValue() ) SetSnapFrame( *(sal_Bool*) pValues[ 2 ].getValue() );
931 	if( pValues[3].hasValue() ) SetSnapPoints( *(sal_Bool*) pValues[ 3 ].getValue() );
932 	if( pValues[4].hasValue() ) SetOrtho( *(sal_Bool*) pValues[ 4 ].getValue() );
933 	if( pValues[5].hasValue() ) SetBigOrtho( *(sal_Bool*) pValues[ 5 ].getValue() );
934 	if( pValues[6].hasValue() ) SetRotate( *(sal_Bool*) pValues[ 6 ].getValue() );
935 	if( pValues[7].hasValue() ) SetSnapArea( (sal_Int16) *(sal_Int32*) pValues[ 7 ].getValue() );
936 	if( pValues[8].hasValue() ) SetAngle( (sal_Int16) *(sal_Int32*) pValues[ 8 ].getValue() );
937 	if( pValues[9].hasValue() ) SetEliminatePolyPointLimitAngle( (sal_Int16) *(sal_Int32*) pValues[ 9 ].getValue() );
938 
939 	return sal_True;
940 }
941 
942 // -----------------------------------------------------------------------------
943 
WriteData(Any * pValues) const944 sal_Bool SdOptionsSnap::WriteData( Any* pValues ) const
945 {
946 	pValues[ 0 ] <<= IsSnapHelplines();
947 	pValues[ 1 ] <<= IsSnapBorder();
948 	pValues[ 2 ] <<= IsSnapFrame();
949 	pValues[ 3 ] <<= IsSnapPoints();
950 	pValues[ 4 ] <<= IsOrtho();
951 	pValues[ 5 ] <<= IsBigOrtho();
952 	pValues[ 6 ] <<= IsRotate();
953 	pValues[ 7 ] <<= (sal_Int32) GetSnapArea();
954 	pValues[ 8 ] <<= (sal_Int32) GetAngle();
955 	pValues[ 9 ] <<= (sal_Int32) GetEliminatePolyPointLimitAngle();
956 
957 	return sal_True;
958 }
959 
960 /*************************************************************************
961 |*
962 |* SdOptionsSnapItem
963 |*
964 \************************************************************************/
965 
SdOptionsSnapItem(sal_uInt16 _nWhich)966 SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich )
967 :	SfxPoolItem		( _nWhich )
968 ,	maOptionsSnap	( 0, sal_False )
969 {
970 }
971 
972 // ----------------------------------------------------------------------
973 
SdOptionsSnapItem(sal_uInt16 _nWhich,SdOptions * pOpts,::sd::FrameView * pView)974 SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
975 :	SfxPoolItem		( _nWhich )
976 ,	maOptionsSnap	( 0, sal_False )
977 {
978 	if( pView )
979 	{
980 		maOptionsSnap.SetSnapHelplines( pView->IsHlplSnap() );
981 		maOptionsSnap.SetSnapBorder( pView->IsBordSnap() );
982 		maOptionsSnap.SetSnapFrame( pView->IsOFrmSnap() );
983 		maOptionsSnap.SetSnapPoints( pView->IsOPntSnap() );
984 		maOptionsSnap.SetOrtho( pView->IsOrtho() );
985 		maOptionsSnap.SetBigOrtho( pView->IsBigOrtho() );
986 		maOptionsSnap.SetRotate( pView->IsAngleSnapEnabled() );
987 		maOptionsSnap.SetSnapArea( pView->GetSnapMagneticPixel() );
988 		maOptionsSnap.SetAngle( (sal_Int16) pView->GetSnapAngle() );
989 		maOptionsSnap.SetEliminatePolyPointLimitAngle( (sal_Int16) pView->GetEliminatePolyPointLimitAngle() );
990 	}
991 	else if( pOpts )
992 	{
993 		maOptionsSnap.SetSnapHelplines( pOpts->IsSnapHelplines() );
994 		maOptionsSnap.SetSnapBorder( pOpts->IsSnapBorder() );
995 		maOptionsSnap.SetSnapFrame( pOpts->IsSnapFrame() );
996 		maOptionsSnap.SetSnapPoints( pOpts->IsSnapPoints() );
997 		maOptionsSnap.SetOrtho( pOpts->IsOrtho() );
998 		maOptionsSnap.SetBigOrtho( pOpts->IsBigOrtho() );
999 		maOptionsSnap.SetRotate( pOpts->IsRotate() );
1000 		maOptionsSnap.SetSnapArea( pOpts->GetSnapArea() );
1001 		maOptionsSnap.SetAngle( pOpts->GetAngle() );
1002 		maOptionsSnap.SetEliminatePolyPointLimitAngle( pOpts->GetEliminatePolyPointLimitAngle() );
1003 	}
1004 }
1005 
1006 // ----------------------------------------------------------------------
1007 
Clone(SfxItemPool *) const1008 SfxPoolItem* SdOptionsSnapItem::Clone( SfxItemPool* ) const
1009 {
1010 	return new SdOptionsSnapItem( *this );
1011 }
1012 
1013 
1014 // ----------------------------------------------------------------------
1015 
operator ==(const SfxPoolItem & rAttr) const1016 int SdOptionsSnapItem::operator==( const SfxPoolItem& rAttr ) const
1017 {
1018 	const bool bSameType = SfxPoolItem::operator==(rAttr);
1019 	DBG_ASSERT( bSameType, "SdOptionsSnapItem::operator==(), differen pool item type!" );
1020 	return bSameType && ( maOptionsSnap == static_cast< const SdOptionsSnapItem& >(rAttr).maOptionsSnap );
1021 }
1022 
1023 // -----------------------------------------------------------------------
1024 
SetOptions(SdOptions * pOpts) const1025 void SdOptionsSnapItem::SetOptions( SdOptions* pOpts ) const
1026 {
1027 	if( pOpts )
1028 	{
1029 		pOpts->SetSnapHelplines( maOptionsSnap.IsSnapHelplines() );
1030 		pOpts->SetSnapBorder( maOptionsSnap.IsSnapBorder() );
1031 		pOpts->SetSnapFrame( maOptionsSnap.IsSnapFrame() );
1032 		pOpts->SetSnapPoints( maOptionsSnap.IsSnapPoints() );
1033 		pOpts->SetOrtho( maOptionsSnap.IsOrtho() );
1034 		pOpts->SetBigOrtho( maOptionsSnap.IsBigOrtho() );
1035 		pOpts->SetRotate( maOptionsSnap.IsRotate() );
1036 		pOpts->SetSnapArea( maOptionsSnap.GetSnapArea() );
1037 		pOpts->SetAngle( maOptionsSnap.GetAngle() );
1038 		pOpts->SetEliminatePolyPointLimitAngle( maOptionsSnap.GetEliminatePolyPointLimitAngle() );
1039 	}
1040 }
1041 
1042 /*************************************************************************
1043 |*
1044 |* SdOptionsZoom
1045 |*
1046 \************************************************************************/
1047 
SdOptionsZoom(sal_uInt16 nConfigId,sal_Bool bUseConfig)1048 SdOptionsZoom::SdOptionsZoom( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
1049 	SdOptionsGeneric( nConfigId, ( bUseConfig &&  ( SDCFG_DRAW == nConfigId ) ) ?
1050 								 B2U( "Office.Draw/Zoom" ) :
1051 							     OUString() ),
1052 	nX( 1 ),
1053     nY( 1 )
1054 
1055 {
1056 	EnableModify( sal_True );
1057 }
1058 
1059 // -----------------------------------------------------------------------------
1060 
operator ==(const SdOptionsZoom & rOpt) const1061 sal_Bool SdOptionsZoom::operator==( const SdOptionsZoom& rOpt ) const
1062 {
1063 	sal_Int32 nX1, nX2, nY1, nY2;
1064 
1065 	GetScale( nX1, nY1 );
1066 	rOpt.GetScale( nX2, nY2 );
1067 
1068 	return( ( nX1 == nX2 ) &&
1069 			( nY1 == nY2 ) );
1070 }
1071 
1072 // -----------------------------------------------------------------------------
1073 
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const1074 void SdOptionsZoom::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
1075 {
1076 	static const char* aPropNames[] =
1077 	{
1078 		"ScaleX",
1079 		"ScaleY"
1080 	};
1081 
1082 	rCount = ( GetConfigId() == SDCFG_DRAW ) ? 2 : 0;
1083 	ppNames = aPropNames;
1084 }
1085 
1086 // -----------------------------------------------------------------------------
1087 
ReadData(const Any * pValues)1088 sal_Bool SdOptionsZoom::ReadData( const Any* pValues )
1089 {
1090 	sal_Int32 x = 1, y = 1;
1091 
1092 	if( pValues[0].hasValue() ) x = ( *(sal_Int32*) pValues[ 0 ].getValue() );
1093 	if( pValues[1].hasValue() ) y = ( *(sal_Int32*) pValues[ 1 ].getValue() );
1094 
1095 	SetScale( x, y );
1096 
1097 	return sal_True;
1098 }
1099 
1100 // -----------------------------------------------------------------------------
1101 
WriteData(Any * pValues) const1102 sal_Bool SdOptionsZoom::WriteData( Any* pValues ) const
1103 {
1104 	sal_Int32 x, y;
1105 
1106 	GetScale( x, y );
1107 
1108 	pValues[ 0 ] <<= (sal_Int32) x;
1109 	pValues[ 1 ] <<= (sal_Int32) y;
1110 
1111 	return sal_True;
1112 }
1113 
1114 /*************************************************************************
1115 |*
1116 |* SdOptionsGrid
1117 |*
1118 \************************************************************************/
1119 
SdOptionsGrid(sal_uInt16 nConfigId,sal_Bool bUseConfig)1120 SdOptionsGrid::SdOptionsGrid( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
1121 	SdOptionsGeneric( nConfigId, bUseConfig ?
1122 					  ( ( SDCFG_DRAW == nConfigId ) ?
1123 						B2U( "Office.Draw/Grid" ) :
1124 						B2U( "Office.Impress/Grid" ) ) :
1125 					  OUString() )
1126 {
1127 	EnableModify( sal_False );
1128 	SetDefaults();
1129 	EnableModify( sal_True );
1130 }
1131 
1132 // -----------------------------------------------------------------------------
1133 
~SdOptionsGrid()1134 SdOptionsGrid::~SdOptionsGrid()
1135 {
1136 }
1137 
1138 // -----------------------------------------------------------------------------
1139 
SetDefaults()1140 void SdOptionsGrid::SetDefaults()
1141 {
1142 	const sal_uInt32 nVal = 1000;
1143 
1144 	SetFldDivisionX( nVal );
1145 	SetFldDivisionY( nVal );
1146 	SetFldDrawX( nVal );
1147 	SetFldDrawY( nVal );
1148 	SetFldSnapX( nVal );
1149 	SetFldSnapY( nVal );
1150 	SetUseGridSnap( sal_False );
1151 	SetSynchronize( sal_True );
1152 	SetGridVisible( sal_False );
1153 	SetEqualGrid( sal_True );
1154 }
1155 
1156 // -----------------------------------------------------------------------------
1157 
operator ==(const SdOptionsGrid & rOpt) const1158 sal_Bool SdOptionsGrid::operator==( const SdOptionsGrid& rOpt ) const
1159 {
1160 	return(	GetFldDrawX() == rOpt.GetFldDrawX() &&
1161 			GetFldDivisionX() == rOpt.GetFldDivisionX() &&
1162 			GetFldDrawY() == rOpt.GetFldDrawY() &&
1163 			GetFldDivisionY() == rOpt.GetFldDivisionY() &&
1164 			GetFldSnapX() == rOpt.GetFldSnapX() &&
1165 			GetFldSnapY() == rOpt.GetFldSnapY() &&
1166 			IsUseGridSnap() == rOpt.IsUseGridSnap() &&
1167 			IsSynchronize() == rOpt.IsSynchronize() &&
1168 			IsGridVisible() == rOpt.IsGridVisible() &&
1169 			IsEqualGrid() == rOpt.IsEqualGrid() );
1170 }
1171 
1172 // -----------------------------------------------------------------------------
1173 
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const1174 void SdOptionsGrid::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
1175 {
1176 	static const char* aPropNamesMetric[] =
1177 	{
1178 		"Resolution/XAxis/Metric",
1179 		"Resolution/YAxis/Metric",
1180 		"Subdivision/XAxis",
1181 		"Subdivision/YAxis",
1182 		"SnapGrid/XAxis/Metric",
1183 		"SnapGrid/YAxis/Metric",
1184 		"Option/SnapToGrid",
1185 		"Option/Synchronize",
1186 		"Option/VisibleGrid",
1187 		"SnapGrid/Size"
1188 	};
1189 
1190 	static const char* aPropNamesNonMetric[] =
1191 	{
1192 		"Resolution/XAxis/NonMetric",
1193 		"Resolution/YAxis/NonMetric",
1194 		"Subdivision/XAxis",
1195 		"Subdivision/YAxis",
1196 		"SnapGrid/XAxis/NonMetric",
1197 		"SnapGrid/YAxis/NonMetric",
1198 		"Option/SnapToGrid",
1199 		"Option/Synchronize",
1200 		"Option/VisibleGrid",
1201 		"SnapGrid/Size"
1202 	};
1203 
1204 	rCount = 10;
1205 
1206 	if( isMetricSystem() )
1207 		ppNames = aPropNamesMetric;
1208 	else
1209 		ppNames = aPropNamesNonMetric;
1210 }
1211 
1212 // -----------------------------------------------------------------------------
1213 
ReadData(const Any * pValues)1214 sal_Bool SdOptionsGrid::ReadData( const Any* pValues )
1215 {
1216 	if( pValues[0].hasValue() ) SetFldDrawX( *(sal_Int32*) pValues[ 0 ].getValue() );
1217 	if( pValues[1].hasValue() ) SetFldDrawY( *(sal_Int32*) pValues[ 1 ].getValue() );
1218 
1219 	if( pValues[2].hasValue() )
1220 	{
1221 		const sal_uInt32 nDivX = FRound( *(double*) pValues[ 2 ].getValue() );
1222 		SetFldDivisionX( SvxOptionsGrid::GetFldDrawX() / ( nDivX + 1 ) );
1223 	}
1224 
1225 	if( pValues[3].hasValue() )
1226 	{
1227 		const sal_uInt32 nDivY = FRound( *(double*) pValues[ 3 ].getValue() );
1228 		SetFldDivisionY( SvxOptionsGrid::GetFldDrawY() / ( nDivY + 1 ) );
1229 	}
1230 
1231 	if( pValues[4].hasValue() ) SetFldSnapX( *(sal_Int32*) pValues[ 4 ].getValue() );
1232 	if( pValues[5].hasValue() ) SetFldSnapY( *(sal_Int32*) pValues[ 5 ].getValue() );
1233 	if( pValues[6].hasValue() ) SetUseGridSnap( *(sal_Bool*) pValues[ 6 ].getValue() );
1234 	if( pValues[7].hasValue() ) SetSynchronize( *(sal_Bool*) pValues[ 7 ].getValue() );
1235 	if( pValues[8].hasValue() ) SetGridVisible( *(sal_Bool*) pValues[ 8 ].getValue() );
1236 	if( pValues[9].hasValue() ) SetEqualGrid( *(sal_Bool*) pValues[ 9 ].getValue() );
1237 
1238 	return sal_True;
1239 }
1240 
1241 // -----------------------------------------------------------------------------
1242 
WriteData(Any * pValues) const1243 sal_Bool SdOptionsGrid::WriteData( Any* pValues ) const
1244 {
1245 	pValues[ 0 ] <<= (sal_Int32) GetFldDrawX();
1246 	pValues[ 1 ] <<= (sal_Int32) GetFldDrawY();
1247 	pValues[ 2 ] <<= ( GetFldDivisionX() ? ( (double) GetFldDrawX() / GetFldDivisionX() - 1.0 ) : (double) 0 );
1248 	pValues[ 3 ] <<= ( GetFldDivisionY() ? ( (double) GetFldDrawY() / GetFldDivisionY() - 1.0 ) : (double) 0 );
1249 	pValues[ 4 ] <<= (sal_Int32) GetFldSnapX();
1250 	pValues[ 5 ] <<= (sal_Int32) GetFldSnapY();
1251 	pValues[ 6 ] <<= IsUseGridSnap();
1252 	pValues[ 7 ] <<= IsSynchronize();
1253 	pValues[ 8 ] <<= IsGridVisible();
1254 	pValues[ 9 ] <<= IsEqualGrid();
1255 
1256 	return sal_True;
1257 }
1258 
1259 /*************************************************************************
1260 |*
1261 |* SdOptionsGridItem
1262 |*
1263 \************************************************************************/
1264 
SdOptionsGridItem(sal_uInt16 _nWhich,SdOptions * pOpts,::sd::FrameView * pView)1265 SdOptionsGridItem::SdOptionsGridItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView ) :
1266 	SvxGridItem( _nWhich )
1267 {
1268 	SetSynchronize( pOpts->IsSynchronize() );
1269 	SetEqualGrid( pOpts->IsEqualGrid() );
1270 
1271 	if( pView )
1272 	{
1273 		SetFldDrawX( pView->GetGridCoarse().Width() );
1274 		SetFldDrawY( pView->GetGridCoarse().Height() );
1275 		SetFldDivisionX( pView->GetGridFine().Width() ? ( GetFldDrawX() / pView->GetGridFine().Width() - 1 ) : 0 );
1276 		SetFldDivisionY( pView->GetGridFine().Height() ? ( GetFldDrawY() / pView->GetGridFine().Height() - 1 ) : 0 );
1277 		SetFldSnapX( long(pView->GetSnapGridWidthX()) );
1278 		SetFldSnapY( long(pView->GetSnapGridWidthY()) );
1279 		SetUseGridSnap( pView->IsGridSnap() );
1280 		SetGridVisible( pView->IsGridVisible() );
1281 	}
1282 	else
1283 	{
1284 		SetFldDrawX( pOpts->GetFldDrawX() );
1285 		SetFldDrawY( pOpts->GetFldDrawY() );
1286 		SetFldDivisionX( pOpts->GetFldDivisionX() ? ( pOpts->GetFldDrawX() / pOpts->GetFldDivisionX() - 1 ) : 0 );
1287 		SetFldDivisionY( pOpts->GetFldDivisionY() ? ( pOpts->GetFldDrawY() / pOpts->GetFldDivisionY() - 1 ) : 0 );
1288 		SetFldSnapX( pOpts->GetFldSnapX() );
1289 		SetFldSnapY( pOpts->GetFldSnapY() );
1290 		SetUseGridSnap( pOpts->IsUseGridSnap() );
1291 		SetGridVisible( pOpts->IsGridVisible() );
1292 	}
1293 }
1294 
1295 // -----------------------------------------------------------------------
1296 
SetOptions(SdOptions * pOpts) const1297 void SdOptionsGridItem::SetOptions( SdOptions* pOpts ) const
1298 {
1299 	pOpts->SetFldDrawX( GetFldDrawX() );
1300 	pOpts->SetFldDivisionX( GetFldDrawX() / ( GetFldDivisionX() + 1 ) );
1301 	pOpts->SetFldDrawY( GetFldDrawY() );
1302 	pOpts->SetFldDivisionY( GetFldDrawY() / ( GetFldDivisionY() + 1 ) );
1303 	pOpts->SetFldSnapX( GetFldSnapX() );
1304 	pOpts->SetFldSnapY( GetFldSnapY() );
1305 	pOpts->SetUseGridSnap( GetUseGridSnap() );
1306 	pOpts->SetSynchronize( GetSynchronize() );
1307 	pOpts->SetGridVisible( GetGridVisible() );
1308 	pOpts->SetEqualGrid( GetEqualGrid() );
1309 }
1310 
1311 /*************************************************************************
1312 |*
1313 |* SdOptionsPrint
1314 |*
1315 \************************************************************************/
1316 
SdOptionsPrint(sal_uInt16 nConfigId,sal_Bool bUseConfig)1317 SdOptionsPrint::SdOptionsPrint( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
1318 	SdOptionsGeneric( nConfigId, bUseConfig ?
1319 					  ( ( SDCFG_DRAW == nConfigId ) ?
1320 						B2U( "Office.Draw/Print" ) :
1321 						B2U( "Office.Impress/Print" ) ) :
1322 					  OUString() ),
1323 	bDraw( sal_True ),
1324 	bNotes( sal_False ),
1325 	bHandout( sal_False ),
1326 	bOutline( sal_False ),
1327 	bDate( sal_False ),
1328 	bTime( sal_False ),
1329 	bPagename( sal_False ),
1330 	bHiddenPages( sal_True ),
1331 	bPagesize( sal_False ),
1332 	bPagetile( sal_False ),
1333 	bWarningPrinter( sal_True ),
1334 	bWarningSize( sal_False ),
1335 	bWarningOrientation( sal_False ),
1336 	bBooklet( sal_False ),
1337 	bFront( sal_True ),
1338 	bBack( sal_True ),
1339 	bCutPage( sal_False ),
1340 	bPaperbin( sal_False ),
1341 	mbHandoutHorizontal( sal_True ),
1342 	mnHandoutPages( 6 ),
1343 	nQuality( 0 )
1344 {
1345 	EnableModify( sal_True );
1346 }
1347 
1348 // -----------------------------------------------------------------------------
1349 
operator ==(const SdOptionsPrint & rOpt) const1350 sal_Bool SdOptionsPrint::operator==( const SdOptionsPrint& rOpt ) const
1351 {
1352 	return( IsDraw() == rOpt.IsDraw() &&
1353 			IsNotes() == rOpt.IsNotes() &&
1354 			IsHandout() == rOpt.IsHandout() &&
1355 			IsOutline() == rOpt.IsOutline() &&
1356 			IsDate() == rOpt.IsDate() &&
1357 			IsTime() == rOpt.IsTime() &&
1358 			IsPagename() == rOpt.IsPagename() &&
1359 			IsHiddenPages() == rOpt.IsHiddenPages() &&
1360 			IsPagesize() == rOpt.IsPagesize() &&
1361 			IsPagetile() == rOpt.IsPagetile() &&
1362 			IsWarningPrinter() == rOpt.IsWarningPrinter() &&
1363 			IsWarningSize() == rOpt.IsWarningSize() &&
1364 			IsWarningOrientation() == rOpt.IsWarningOrientation() &&
1365 			IsBooklet() == rOpt.IsBooklet() &&
1366 			IsFrontPage() == rOpt.IsFrontPage() &&
1367 			IsBackPage() == rOpt.IsBackPage() &&
1368 			IsCutPage() == rOpt.IsCutPage() &&
1369 			IsPaperbin() == rOpt.IsPaperbin() &&
1370 			GetOutputQuality() == rOpt.GetOutputQuality() &&
1371 			IsHandoutHorizontal() == rOpt.IsHandoutHorizontal() &&
1372 			GetHandoutPages() == rOpt.GetHandoutPages() );
1373 }
1374 
1375 // -----------------------------------------------------------------------------
1376 
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const1377 void SdOptionsPrint::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
1378 {
1379 	static const char* aDrawPropNames[] =
1380 	{
1381 		"Other/Date",
1382 		"Other/Time",
1383 		"Other/PageName",
1384 		"Other/HiddenPage",
1385 		"Page/PageSize",
1386 		"Page/PageTile",
1387 		// bWarningPrinter
1388 		// bWarningSize
1389 		// bWarningOrientation
1390 		"Page/Booklet",
1391 		"Page/BookletFront",
1392 		"Page/BookletBack",
1393 		// bCutPage
1394 		"Other/FromPrinterSetup",
1395 		"Other/Quality",
1396 		"Content/Drawing",
1397 	};
1398 	static const char* aImpressPropNames[] =
1399 	{
1400 		"Other/Date",
1401 		"Other/Time",
1402 		"Other/PageName",
1403 		"Other/HiddenPage",
1404 		"Page/PageSize",
1405 		"Page/PageTile",
1406 		// bWarningPrinter
1407 		// bWarningSize
1408 		// bWarningOrientation
1409 		"Page/Booklet",
1410 		"Page/BookletFront",
1411 		"Page/BookletBack",
1412 		// bCutPage
1413 		"Other/FromPrinterSetup",
1414 		"Other/Quality",
1415 		"Content/Presentation",
1416 		"Content/Note",
1417 		"Content/Handout",
1418 		"Content/Outline",
1419 		"Other/HandoutHorizontal",
1420 		"Other/PagesPerHandout"
1421 	};
1422 
1423 	if( GetConfigId() == SDCFG_IMPRESS )
1424 	{
1425 		rCount = 17;
1426 		ppNames = aImpressPropNames;
1427 	}
1428 	else
1429 	{
1430 		rCount = 12;
1431 		ppNames = aDrawPropNames;
1432 	}
1433 }
1434 
1435 // -----------------------------------------------------------------------------
1436 
ReadData(const Any * pValues)1437 sal_Bool SdOptionsPrint::ReadData( const Any* pValues )
1438 {
1439 	if( pValues[0].hasValue() ) SetDate( *(sal_Bool*) pValues[ 0 ].getValue() );
1440 	if( pValues[1].hasValue() ) SetTime( *(sal_Bool*) pValues[ 1 ].getValue() );
1441 	if( pValues[2].hasValue() ) SetPagename( *(sal_Bool*) pValues[ 2 ].getValue() );
1442 	if( pValues[3].hasValue() ) SetHiddenPages( *(sal_Bool*) pValues[ 3 ].getValue() );
1443 	if( pValues[4].hasValue() ) SetPagesize( *(sal_Bool*) pValues[ 4 ].getValue() );
1444 	if( pValues[5].hasValue() ) SetPagetile( *(sal_Bool*) pValues[ 5 ].getValue() );
1445 	if( pValues[6].hasValue() ) SetBooklet( *(sal_Bool*) pValues[ 6 ].getValue() );
1446 	if( pValues[7].hasValue() ) SetFrontPage( *(sal_Bool*) pValues[ 7 ].getValue() );
1447 	if( pValues[8].hasValue() ) SetBackPage( *(sal_Bool*) pValues[ 8 ].getValue() );
1448 	if( pValues[9].hasValue() ) SetPaperbin( *(sal_Bool*) pValues[ 9 ].getValue() );
1449 	if( pValues[10].hasValue() ) SetOutputQuality( (sal_uInt16) *(sal_Int32*) pValues[ 10 ].getValue() );
1450 	if( pValues[11].hasValue() ) SetDraw( *(sal_Bool*) pValues[ 11 ].getValue() );
1451 
1452 	// just for impress
1453 	if( GetConfigId() == SDCFG_IMPRESS )
1454 	{
1455 		if( pValues[12].hasValue() ) SetNotes( *(sal_Bool*) pValues[ 12 ].getValue() );
1456 		if( pValues[13].hasValue() ) SetHandout( *(sal_Bool*) pValues[ 13 ].getValue() );
1457 		if( pValues[14].hasValue() ) SetOutline( *(sal_Bool*) pValues[ 14 ].getValue() );
1458 		if( pValues[15].hasValue() ) SetHandoutHorizontal( *(sal_Bool*) pValues[15].getValue() );
1459 		if( pValues[16].hasValue() ) SetHandoutPages( (sal_uInt16)*(sal_Int32*) pValues[16].getValue() );
1460 	}
1461 
1462 	return sal_True;
1463 }
1464 
1465 // -----------------------------------------------------------------------------
1466 
WriteData(Any * pValues) const1467 sal_Bool SdOptionsPrint::WriteData( Any* pValues ) const
1468 {
1469 	pValues[ 0 ] <<= IsDate();
1470 	pValues[ 1 ] <<= IsTime();
1471 	pValues[ 2 ] <<= IsPagename();
1472 	pValues[ 3 ] <<= IsHiddenPages();
1473 	pValues[ 4 ] <<= IsPagesize();
1474 	pValues[ 5 ] <<= IsPagetile();
1475 	pValues[ 6 ] <<= IsBooklet();
1476 	pValues[ 7 ] <<= IsFrontPage();
1477 	pValues[ 8 ] <<= IsBackPage();
1478 	pValues[ 9 ] <<= IsPaperbin();
1479 	pValues[ 10 ] <<= (sal_Int32) GetOutputQuality();
1480 	pValues[ 11 ] <<= IsDraw();
1481 
1482 	// just for impress
1483 	if( GetConfigId() == SDCFG_IMPRESS )
1484 	{
1485 		pValues[ 12 ] <<= IsNotes();
1486 		pValues[ 13 ] <<= IsHandout();
1487 		pValues[ 14 ] <<= IsOutline();
1488 		pValues[ 15 ] <<= IsHandoutHorizontal();
1489 		pValues[ 16 ] <<= GetHandoutPages();
1490 	}
1491 
1492 	return sal_True;
1493 }
1494 
1495 /*************************************************************************
1496 |*
1497 |* SdOptionsPrintItem
1498 |*
1499 \************************************************************************/
1500 
SdOptionsPrintItem(sal_uInt16 _nWhich)1501 SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich )
1502 :	SfxPoolItem		( _nWhich )
1503 ,	maOptionsPrint	( 0, sal_False )
1504 {
1505 }
1506 
1507 // ----------------------------------------------------------------------
1508 
SdOptionsPrintItem(sal_uInt16 _nWhich,SdOptions * pOpts,::sd::FrameView *)1509 SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* )
1510 :	SfxPoolItem		( _nWhich )
1511 ,	maOptionsPrint	( 0, sal_False )
1512 {
1513 	if( pOpts )
1514 	{
1515 		maOptionsPrint.SetDraw( pOpts->IsDraw() );
1516 		maOptionsPrint.SetNotes( pOpts->IsNotes() );
1517 		maOptionsPrint.SetHandout( pOpts->IsHandout() );
1518 		maOptionsPrint.SetOutline( pOpts->IsOutline() );
1519 		maOptionsPrint.SetDate( pOpts->IsDate() );
1520 		maOptionsPrint.SetTime( pOpts->IsTime() );
1521 		maOptionsPrint.SetPagename( pOpts->IsPagename() );
1522 		maOptionsPrint.SetHiddenPages( pOpts->IsHiddenPages() );
1523 		maOptionsPrint.SetPagesize( pOpts->IsPagesize() );
1524 		maOptionsPrint.SetPagetile( pOpts->IsPagetile() );
1525 		maOptionsPrint.SetWarningPrinter( pOpts->IsWarningPrinter() );
1526 		maOptionsPrint.SetWarningSize( pOpts->IsWarningSize() );
1527 		maOptionsPrint.SetWarningOrientation( pOpts->IsWarningOrientation() );
1528 		maOptionsPrint.SetBooklet( pOpts->IsBooklet() );
1529 		maOptionsPrint.SetFrontPage( pOpts->IsFrontPage() );
1530 		maOptionsPrint.SetBackPage( pOpts->IsBackPage() );
1531 		maOptionsPrint.SetCutPage( pOpts->IsCutPage() );
1532 		maOptionsPrint.SetPaperbin( pOpts->IsPaperbin() );
1533 		maOptionsPrint.SetOutputQuality( pOpts->GetOutputQuality() );
1534 	}
1535 }
1536 
1537 // ----------------------------------------------------------------------
1538 
Clone(SfxItemPool *) const1539 SfxPoolItem* SdOptionsPrintItem::Clone( SfxItemPool* ) const
1540 {
1541 	return new SdOptionsPrintItem( *this );
1542 }
1543 
1544 // ----------------------------------------------------------------------
1545 
operator ==(const SfxPoolItem & rAttr) const1546 int SdOptionsPrintItem::operator==( const SfxPoolItem& rAttr ) const
1547 {
1548 	const bool bSameType = SfxPoolItem::operator==(rAttr);
1549 	DBG_ASSERT( bSameType, "SdOptionsPrintItem::operator==(), differen pool item type!" );
1550 	return bSameType && ( maOptionsPrint == static_cast< const SdOptionsPrintItem& >( rAttr ).maOptionsPrint );
1551 }
1552 
1553 // -----------------------------------------------------------------------
1554 
SetOptions(SdOptions * pOpts) const1555 void SdOptionsPrintItem::SetOptions( SdOptions* pOpts ) const
1556 {
1557 	if( pOpts )
1558 	{
1559 		pOpts->SetDraw( maOptionsPrint.IsDraw() );
1560 		pOpts->SetNotes( maOptionsPrint.IsNotes() );
1561 		pOpts->SetHandout( maOptionsPrint.IsHandout() );
1562 		pOpts->SetOutline( maOptionsPrint.IsOutline() );
1563 		pOpts->SetDate( maOptionsPrint.IsDate() );
1564 		pOpts->SetTime( maOptionsPrint.IsTime() );
1565 		pOpts->SetPagename( maOptionsPrint.IsPagename() );
1566 		pOpts->SetHiddenPages( maOptionsPrint.IsHiddenPages() );
1567 		pOpts->SetPagesize( maOptionsPrint.IsPagesize() );
1568 		pOpts->SetPagetile( maOptionsPrint.IsPagetile() );
1569 		pOpts->SetWarningPrinter( maOptionsPrint.IsWarningPrinter() );
1570 		pOpts->SetWarningSize( maOptionsPrint.IsWarningSize() );
1571 		pOpts->SetWarningOrientation( maOptionsPrint.IsWarningOrientation() );
1572 		pOpts->SetBooklet( maOptionsPrint.IsBooklet() );
1573 		pOpts->SetFrontPage( maOptionsPrint.IsFrontPage() );
1574 		pOpts->SetBackPage( maOptionsPrint.IsBackPage() );
1575 		pOpts->SetCutPage( maOptionsPrint.IsCutPage() );
1576 		pOpts->SetPaperbin( maOptionsPrint.IsPaperbin() );
1577 		pOpts->SetOutputQuality( maOptionsPrint.GetOutputQuality() );
1578 	}
1579 }
1580 
1581 /*************************************************************************
1582 |*
1583 |* SdOptions
1584 |*
1585 \************************************************************************/
1586 
SdOptions(sal_uInt16 nConfigId)1587 SdOptions::SdOptions( sal_uInt16 nConfigId ) :
1588 	SdOptionsLayout( nConfigId, sal_True ),
1589 	SdOptionsContents( nConfigId, sal_True ),
1590 	SdOptionsMisc( nConfigId, sal_True ),
1591 	SdOptionsSnap( nConfigId, sal_True ),
1592 	SdOptionsZoom( nConfigId, sal_True ),
1593 	SdOptionsGrid( nConfigId, sal_True ),
1594 	SdOptionsPrint( nConfigId, sal_True )
1595 {
1596 }
1597 
1598 // ----------------------------------------------------------------------
1599 
~SdOptions()1600 SdOptions::~SdOptions()
1601 {
1602 }
1603 
1604 // ----------------------------------------------------------------------
1605 
StoreConfig(sal_uLong nOptionsRange)1606 void SdOptions::StoreConfig( sal_uLong nOptionsRange )
1607 {
1608 	if( nOptionsRange & SD_OPTIONS_LAYOUT )
1609 		SdOptionsLayout::Store();
1610 
1611 	if( nOptionsRange & SD_OPTIONS_CONTENTS )
1612 		SdOptionsContents::Store();
1613 
1614 	if( nOptionsRange & SD_OPTIONS_MISC )
1615 		SdOptionsMisc::Store();
1616 
1617 	if( nOptionsRange & SD_OPTIONS_SNAP )
1618 		SdOptionsSnap::Store();
1619 
1620 	if( nOptionsRange & SD_OPTIONS_ZOOM )
1621 		SdOptionsZoom::Store();
1622 
1623 	if( nOptionsRange & SD_OPTIONS_GRID )
1624 		SdOptionsGrid::Store();
1625 
1626 	if( nOptionsRange & SD_OPTIONS_PRINT )
1627 		SdOptionsPrint::Store();
1628 }
1629