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 |* SdOptionsLayout
208 \************************************************************************/
209
SdOptionsLayout(sal_uInt16 nConfigId,sal_Bool bUseConfig)210 SdOptionsLayout::SdOptionsLayout( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
211 SdOptionsGeneric( nConfigId, bUseConfig ?
212 ( ( SDCFG_DRAW == nConfigId ) ?
213 B2U( "Office.Draw/Layout" ) :
214 B2U( "Office.Impress/Layout" ) ) :
215 OUString() ),
216 bRuler( sal_True ),
217 bMoveOutline( sal_True ),
218 bDragStripes( sal_False ),
219 bHandlesBezier( sal_False ),
220 bHelplines( sal_True ),
221 nMetric((sal_uInt16)(isMetricSystem() ? FUNIT_CM : FUNIT_INCH)),
222 nDefTab( 1250 )
223 {
224 EnableModify( sal_True );
225 }
226
227 // -----------------------------------------------------------------------------
228
operator ==(const SdOptionsLayout & rOpt) const229 sal_Bool SdOptionsLayout::operator==( const SdOptionsLayout& rOpt ) const
230 {
231 return( IsRulerVisible() == rOpt.IsRulerVisible() &&
232 IsMoveOutline() == rOpt.IsMoveOutline() &&
233 IsDragStripes() == rOpt.IsDragStripes() &&
234 IsHandlesBezier() == rOpt.IsHandlesBezier() &&
235 IsHelplines() == rOpt.IsHelplines() &&
236 GetMetric() == rOpt.GetMetric() &&
237 GetDefTab() == rOpt.GetDefTab() );
238 }
239
240 // -----------------------------------------------------------------------------
241
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const242 void SdOptionsLayout::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
243 {
244 static const char* aPropNamesMetric[] =
245 {
246 "Display/Ruler",
247 "Display/Bezier",
248 "Display/Contour",
249 "Display/Guide",
250 "Display/Helpline",
251 "Other/MeasureUnit/Metric",
252 "Other/TabStop/Metric"
253 };
254
255 static const char* aPropNamesNonMetric[] =
256 {
257 "Display/Ruler",
258 "Display/Bezier",
259 "Display/Contour",
260 "Display/Guide",
261 "Display/Helpline",
262 "Other/MeasureUnit/NonMetric",
263 "Other/TabStop/NonMetric"
264 };
265
266 rCount = 7;
267
268 if( isMetricSystem() )
269 ppNames = aPropNamesMetric;
270 else
271 ppNames = aPropNamesNonMetric;
272 }
273
274 // -----------------------------------------------------------------------------
275
ReadData(const Any * pValues)276 sal_Bool SdOptionsLayout::ReadData( const Any* pValues )
277 {
278 if( pValues[0].hasValue() ) SetRulerVisible( *(sal_Bool*) pValues[ 0 ].getValue() );
279 if( pValues[1].hasValue() ) SetHandlesBezier( *(sal_Bool*) pValues[ 1 ].getValue() );
280 if( pValues[2].hasValue() ) SetMoveOutline( *(sal_Bool*) pValues[ 2 ].getValue() );
281 if( pValues[3].hasValue() ) SetDragStripes( *(sal_Bool*) pValues[ 3 ].getValue() );
282 if( pValues[4].hasValue() ) SetHelplines( *(sal_Bool*) pValues[ 4 ].getValue() );
283 if( pValues[5].hasValue() ) SetMetric( (sal_uInt16) *(sal_Int32*) pValues[ 5 ].getValue() );
284 if( pValues[6].hasValue() ) SetDefTab( (sal_uInt16) *(sal_Int32*) pValues[ 6 ].getValue() );
285
286 return sal_True;
287 }
288
289 // -----------------------------------------------------------------------------
290
WriteData(Any * pValues) const291 sal_Bool SdOptionsLayout::WriteData( Any* pValues ) const
292 {
293 pValues[ 0 ] <<= IsRulerVisible();
294 pValues[ 1 ] <<= IsHandlesBezier();
295 pValues[ 2 ] <<= IsMoveOutline();
296 pValues[ 3 ] <<= IsDragStripes();
297 pValues[ 4 ] <<= IsHelplines();
298 pValues[ 5 ] <<= (sal_Int32) GetMetric();
299 pValues[ 6 ] <<= (sal_Int32) GetDefTab();
300
301 return sal_True;
302 }
303
304 /*************************************************************************
305 |* SdOptionsLayoutItem
306 \************************************************************************/
307
SdOptionsLayoutItem(sal_uInt16 _nWhich)308 SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich )
309 : SfxPoolItem ( _nWhich )
310 , maOptionsLayout ( 0, sal_False )
311 {
312 }
313
314 // ----------------------------------------------------------------------
315
SdOptionsLayoutItem(sal_uInt16 _nWhich,SdOptions * pOpts,::sd::FrameView * pView)316 SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
317 : SfxPoolItem ( _nWhich )
318 , maOptionsLayout ( 0, sal_False )
319 {
320 if( pOpts )
321 {
322 maOptionsLayout.SetMetric( pOpts->GetMetric() );
323 maOptionsLayout.SetDefTab( pOpts->GetDefTab() );
324 }
325
326 if( pView )
327 {
328 maOptionsLayout.SetRulerVisible( pView->HasRuler() );
329 maOptionsLayout.SetMoveOutline( !pView->IsNoDragXorPolys() );
330 maOptionsLayout.SetDragStripes( pView->IsDragStripes() );
331 maOptionsLayout.SetHandlesBezier( pView->IsPlusHandlesAlwaysVisible() );
332 maOptionsLayout.SetHelplines( pView->IsHlplVisible() );
333 }
334 else if( pOpts )
335 {
336 maOptionsLayout.SetRulerVisible( pOpts->IsRulerVisible() );
337 maOptionsLayout.SetMoveOutline( pOpts->IsMoveOutline() );
338 maOptionsLayout.SetDragStripes( pOpts->IsDragStripes() );
339 maOptionsLayout.SetHandlesBezier( pOpts->IsHandlesBezier() );
340 maOptionsLayout.SetHelplines( pOpts->IsHelplines() );
341 }
342 }
343
344 // ----------------------------------------------------------------------
345
Clone(SfxItemPool *) const346 SfxPoolItem* SdOptionsLayoutItem::Clone( SfxItemPool* ) const
347 {
348 return new SdOptionsLayoutItem( *this );
349 }
350
351
352 // ----------------------------------------------------------------------
353
operator ==(const SfxPoolItem & rAttr) const354 int SdOptionsLayoutItem::operator==( const SfxPoolItem& rAttr ) const
355 {
356 const bool bSameType = SfxPoolItem::operator==( rAttr );
357 DBG_ASSERT( bSameType, "SdOptionsLayoutItem::operator==(), different pool item type!" );
358 return bSameType && ( maOptionsLayout == static_cast< const SdOptionsLayoutItem& >( rAttr ).maOptionsLayout );
359 }
360
361 // -----------------------------------------------------------------------
362
SetOptions(SdOptions * pOpts) const363 void SdOptionsLayoutItem::SetOptions( SdOptions* pOpts ) const
364 {
365 if( pOpts )
366 {
367 pOpts->SetRulerVisible( maOptionsLayout.IsRulerVisible() );
368 pOpts->SetMoveOutline( maOptionsLayout.IsMoveOutline() );
369 pOpts->SetDragStripes( maOptionsLayout.IsDragStripes() );
370 pOpts->SetHandlesBezier( maOptionsLayout.IsHandlesBezier() );
371 pOpts->SetHelplines( maOptionsLayout.IsHelplines() );
372 pOpts->SetMetric( maOptionsLayout.GetMetric() );
373 pOpts->SetDefTab( maOptionsLayout.GetDefTab() );
374 }
375 }
376
377 /*************************************************************************
378 |* SdOptionsContents
379 \************************************************************************/
380
SdOptionsContents(sal_uInt16 nConfigId,sal_Bool bUseConfig)381 SdOptionsContents::SdOptionsContents( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
382 SdOptionsGeneric( nConfigId, bUseConfig ?
383 ( ( SDCFG_DRAW == nConfigId ) ?
384 B2U( "Office.Draw/Content" ) :
385 B2U( "Office.Impress/Content" ) ) :
386 OUString() )
387 {
388 EnableModify( sal_True );
389 }
390
391 // -----------------------------------------------------------------------------
392
operator ==(const SdOptionsContents &) const393 sal_Bool SdOptionsContents::operator==(const SdOptionsContents&) const
394 {
395 return true;
396 }
397
398 // -----------------------------------------------------------------------------
399
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const400 void SdOptionsContents::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
401 {
402 static const char* aPropNames[] =
403 {
404 "Display/PicturePlaceholder",
405 "Display/ContourMode",
406 "Display/LineContour",
407 "Display/TextPlaceholder"
408 };
409
410 rCount = 4;
411 ppNames = aPropNames;
412 }
413
414 // -----------------------------------------------------------------------------
415
ReadData(const Any *)416 sal_Bool SdOptionsContents::ReadData(const Any*)
417 {
418 return sal_True;
419 }
420
421 // -----------------------------------------------------------------------------
422
WriteData(Any * pValues) const423 sal_Bool SdOptionsContents::WriteData( Any* pValues ) const
424 {
425 //#i80528# no draft anymore
426 pValues[ 0 ] <<= (sal_Bool)false;
427 pValues[ 1 ] <<= (sal_Bool)false;
428 pValues[ 2 ] <<= (sal_Bool)false;
429 pValues[ 3 ] <<= (sal_Bool)false;
430
431 return sal_True;
432 }
433
434 /*************************************************************************
435 |* SdOptionsContentsItem
436 \************************************************************************/
437
SdOptionsContentsItem(sal_uInt16 _nWhich,SdOptions *,::sd::FrameView *)438 SdOptionsContentsItem::SdOptionsContentsItem(sal_uInt16 _nWhich, SdOptions*, ::sd::FrameView*)
439 : SfxPoolItem ( _nWhich )
440 , maOptionsContents ( 0, sal_False )
441 {
442 }
443
444 // ----------------------------------------------------------------------
445
Clone(SfxItemPool *) const446 SfxPoolItem* SdOptionsContentsItem::Clone( SfxItemPool* ) const
447 {
448 return new SdOptionsContentsItem( *this );
449 }
450
451 // ----------------------------------------------------------------------
452
operator ==(const SfxPoolItem & rAttr) const453 int SdOptionsContentsItem::operator==( const SfxPoolItem& rAttr ) const
454 {
455 const bool bSameType = SfxPoolItem::operator==(rAttr);
456 DBG_ASSERT( bSameType, "SdOptionsContentsItem::operator==(), different pool item type!" );
457 return bSameType && ( maOptionsContents == static_cast<const SdOptionsContentsItem&>( rAttr ).maOptionsContents );
458 }
459
460 // -----------------------------------------------------------------------
461
SetOptions(SdOptions *) const462 void SdOptionsContentsItem::SetOptions(SdOptions*) const
463 {
464 }
465
466 /*************************************************************************
467 |* SdOptionsMisc
468 \************************************************************************/
469
SdOptionsMisc(sal_uInt16 nConfigId,sal_Bool bUseConfig)470 SdOptionsMisc::SdOptionsMisc( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
471 SdOptionsGeneric( nConfigId, bUseConfig ?
472 ( ( SDCFG_DRAW == nConfigId ) ?
473 B2U( "Office.Draw/Misc" ) :
474 B2U( "Office.Impress/Misc" ) ) :
475 OUString() ),
476 // #97016#
477 nDefaultObjectSizeWidth(8000),
478 nDefaultObjectSizeHeight(5000),
479 bStartWithTemplate( sal_True ),
480 bMarkedHitMovesAlways( sal_True ),
481 bMoveOnlyDragging( sal_False ),
482 bCrookNoContortion( sal_False ),
483 bQuickEdit( GetConfigId() != SDCFG_DRAW ),
484 bMasterPageCache( sal_True ),
485 bDragWithCopy( sal_False ),
486 bPickThrough( sal_True ),
487 bBigHandles( sal_True ), // new default: Use big handles
488 bDoubleClickTextEdit( sal_True ),
489 bClickChangeRotation( sal_False ),
490 bStartWithActualPage( sal_False ),
491 bStartWithPresenterScreen( sal_True ), // default: Enable the Presenter Screen
492 bSolidDragging( sal_True ),
493 bSolidMarkHdl( sal_True ), // default: Use nice handles
494 bSummationOfParagraphs( sal_False ),
495 // #90356#
496 bShowUndoDeleteWarning( sal_True ),
497 bSlideshowRespectZOrder( sal_True ),
498 bShowComments( sal_True ),
499 bPreviewNewEffects( sal_True ),
500 bPreviewChangedEffects( sal_False ),
501 bPreviewTransitions( sal_True ),
502 mnDisplay( 0 ),
503 mnPenColor( 0xff0000 ),
504 mnPenWidth( 150.0 ),
505
506 // The default for 6.1-and-above documents is to use printer-independent
507 // formatting.
508 mnPrinterIndependentLayout (1)
509 {
510 EnableModify( sal_True );
511 }
512
513 // -----------------------------------------------------------------------------
514
operator ==(const SdOptionsMisc & rOpt) const515 sal_Bool SdOptionsMisc::operator==( const SdOptionsMisc& rOpt ) const
516 {
517 return( IsStartWithTemplate() == rOpt.IsStartWithTemplate() &&
518 IsMarkedHitMovesAlways() == rOpt.IsMarkedHitMovesAlways() &&
519 IsMoveOnlyDragging() == rOpt.IsMoveOnlyDragging() &&
520 IsCrookNoContortion() == rOpt.IsCrookNoContortion() &&
521 IsQuickEdit() == rOpt.IsQuickEdit() &&
522 IsMasterPagePaintCaching() == rOpt.IsMasterPagePaintCaching() &&
523 IsDragWithCopy() == rOpt.IsDragWithCopy() &&
524 IsPickThrough() == rOpt.IsPickThrough() &&
525 IsBigHandles() == rOpt.IsBigHandles() &&
526 IsDoubleClickTextEdit() == rOpt.IsDoubleClickTextEdit() &&
527 IsClickChangeRotation() == rOpt.IsClickChangeRotation() &&
528 IsStartWithActualPage() == rOpt.IsStartWithActualPage() &&
529 IsStartWithPresenterScreen() == rOpt.IsStartWithPresenterScreen() &&
530 IsSummationOfParagraphs() == rOpt.IsSummationOfParagraphs() &&
531 IsSolidDragging() == rOpt.IsSolidDragging() &&
532 IsSolidMarkHdl() == rOpt.IsSolidMarkHdl() &&
533 // #90356#
534 IsShowUndoDeleteWarning() == rOpt.IsShowUndoDeleteWarning() &&
535 IsSlideshowRespectZOrder() == rOpt.IsSlideshowRespectZOrder() &&
536 GetPrinterIndependentLayout() == rOpt.GetPrinterIndependentLayout() &&
537 // #97016#
538 GetDefaultObjectSizeWidth() == rOpt.GetDefaultObjectSizeWidth() &&
539 GetDefaultObjectSizeHeight() == rOpt.GetDefaultObjectSizeHeight() &&
540
541 IsPreviewNewEffects() == rOpt.IsPreviewNewEffects() &&
542 IsPreviewChangedEffects() == rOpt.IsPreviewChangedEffects() &&
543 IsPreviewTransitions() == rOpt.IsPreviewTransitions() &&
544 GetDisplay() == rOpt.GetDisplay() &&
545 IsShowComments() == rOpt.IsShowComments() &&
546 GetPresentationPenColor() == rOpt.GetPresentationPenColor() &&
547 GetPresentationPenWidth() == rOpt.GetPresentationPenWidth()
548 );
549 }
550
551 // -----------------------------------------------------------------------------
552
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const553 void SdOptionsMisc::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
554 {
555 static const char* aPropNames[] =
556 {
557 "ObjectMoveable",
558 "NoDistort",
559 "TextObject/QuickEditing",
560 "BackgroundCache",
561 "CopyWhileMoving",
562 "TextObject/Selectable",
563 "BigHandles",
564 "DclickTextedit",
565 "RotateClick",
566 "Preview",
567 "ModifyWithAttributes",
568 "SimpleHandles",
569 // #97016#
570 "DefaultObjectSize/Width",
571 "DefaultObjectSize/Height",
572
573 "Compatibility/PrinterIndependentLayout",
574
575 "ShowComments",
576
577 // just for impress
578 "NewDoc/AutoPilot",
579 "Start/CurrentPage",
580 "Compatibility/AddBetween",
581 // #90356#
582 "ShowUndoDeleteWarning",
583 "SlideshowRespectZOrder",
584
585 "PreviewNewEffects",
586 "PreviewChangedEffects",
587 "PreviewTransitions",
588
589 "Display",
590
591 "PenColor",
592 "PenWidth",
593
594 "Start/PresenterScreen"
595 };
596
597 rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 28 : 16 );
598 ppNames = aPropNames;
599 }
600
601 // -----------------------------------------------------------------------------
602
ReadData(const Any * pValues)603 sal_Bool SdOptionsMisc::ReadData( const Any* pValues )
604 {
605 if( pValues[0].hasValue() ) SetMarkedHitMovesAlways( *(sal_Bool*) pValues[ 0 ].getValue() );
606 if( pValues[1].hasValue() ) SetCrookNoContortion( *(sal_Bool*) pValues[ 1 ].getValue() );
607 if( pValues[2].hasValue() ) SetQuickEdit( *(sal_Bool*)pValues[ 2 ].getValue() );
608 if( pValues[3].hasValue() ) SetMasterPagePaintCaching( *(sal_Bool*) pValues[ 3 ].getValue() );
609 if( pValues[4].hasValue() ) SetDragWithCopy( *(sal_Bool*) pValues[ 4 ].getValue() );
610 if( pValues[5].hasValue() ) SetPickThrough( *(sal_Bool*) pValues[ 5 ].getValue() );
611 if( pValues[6].hasValue() ) SetBigHandles( *(sal_Bool*) pValues[ 6 ].getValue() );
612 if( pValues[7].hasValue() ) SetDoubleClickTextEdit( *(sal_Bool*) pValues[ 7 ].getValue() );
613 if( pValues[8].hasValue() ) SetClickChangeRotation( *(sal_Bool*) pValues[ 8 ].getValue() );
614 // if( pValues[9].hasValue() ) SetPreviewQuality( FRound( *(double*) pValues[ 9 ].getValue() ) );
615 if( pValues[10].hasValue() ) SetSolidDragging( *(sal_Bool*) pValues[ 10 ].getValue() );
616 if( pValues[11].hasValue() ) SetSolidMarkHdl( *(sal_Bool*) pValues[ 11 ].getValue() );
617 // #97016#
618 if( pValues[12].hasValue() ) SetDefaultObjectSizeWidth( *(sal_uInt32*) pValues[ 12 ].getValue() );
619 if( pValues[13].hasValue() ) SetDefaultObjectSizeHeight( *(sal_uInt32*) pValues[ 13 ].getValue() );
620 if( pValues[14].hasValue() ) SetPrinterIndependentLayout( *(sal_uInt16*) pValues[ 14 ].getValue() );
621
622 if( pValues[15].hasValue() )
623 SetShowComments( *(sal_Bool*) pValues[ 15 ].getValue() );
624
625 // just for Impress
626 if( GetConfigId() == SDCFG_IMPRESS )
627 {
628 if( pValues[16].hasValue() )
629 SetStartWithTemplate( *(sal_Bool*) pValues[ 16 ].getValue() );
630 if( pValues[17].hasValue() )
631 SetStartWithActualPage( *(sal_Bool*) pValues[ 17 ].getValue() );
632 if( pValues[18].hasValue() )
633 SetSummationOfParagraphs( *(sal_Bool*) pValues[ 18 ].getValue() );
634 // #90356#
635 if( pValues[19].hasValue() )
636 SetShowUndoDeleteWarning( *(sal_Bool*) pValues[ 19 ].getValue() );
637
638 if( pValues[20].hasValue() )
639 SetSlideshowRespectZOrder(*(sal_Bool*) pValues[ 20 ].getValue());
640
641 if( pValues[21].hasValue() )
642 SetPreviewNewEffects(*(sal_Bool*) pValues[ 21 ].getValue());
643
644 if( pValues[22].hasValue() )
645 SetPreviewChangedEffects(*(sal_Bool*) pValues[ 22 ].getValue());
646
647 if( pValues[23].hasValue() )
648 SetPreviewTransitions(*(sal_Bool*) pValues[ 23 ].getValue());
649
650 if( pValues[24].hasValue() )
651 SetDisplay(*(sal_Int32*) pValues[ 24 ].getValue());
652
653 if( pValues[25].hasValue() )
654 SetPresentationPenColor( getSafeValue< sal_Int32 >( pValues[ 25 ] ) );
655
656 if( pValues[26].hasValue() )
657 SetPresentationPenWidth( getSafeValue< double >( pValues[ 26 ] ) );
658
659 if( pValues[27].hasValue() )
660 SetStartWithPresenterScreen( *(sal_Bool*) pValues[ 27 ].getValue() );
661 }
662
663 return sal_True;
664 }
665
666 // -----------------------------------------------------------------------------
667
WriteData(Any * pValues) const668 sal_Bool SdOptionsMisc::WriteData( Any* pValues ) const
669 {
670 pValues[ 0 ] <<= IsMarkedHitMovesAlways();
671 pValues[ 1 ] <<= IsCrookNoContortion();
672 pValues[ 2 ] <<= IsQuickEdit();
673 pValues[ 3 ] <<= IsMasterPagePaintCaching();
674 pValues[ 4 ] <<= IsDragWithCopy();
675 pValues[ 5 ] <<= IsPickThrough();
676 pValues[ 6 ] <<= IsBigHandles();
677 pValues[ 7 ] <<= IsDoubleClickTextEdit();
678 pValues[ 8 ] <<= IsClickChangeRotation();
679 // The preview is not supported anymore. Use a dummy value.
680 pValues[ 9 ] <<= (double)0;// GetPreviewQuality();
681 pValues[ 10 ] <<= IsSolidDragging();
682 pValues[ 11 ] <<= IsSolidMarkHdl();
683 // #97016#
684 pValues[ 12 ] <<= GetDefaultObjectSizeWidth();
685 pValues[ 13 ] <<= GetDefaultObjectSizeHeight();
686 pValues[ 14 ] <<= GetPrinterIndependentLayout();
687 pValues[ 15 ] <<= (sal_Bool)IsShowComments();
688
689 // just for Impress
690 if( GetConfigId() == SDCFG_IMPRESS )
691 {
692 pValues[ 16 ] <<= IsStartWithTemplate();
693 pValues[ 17 ] <<= IsStartWithActualPage();
694 pValues[ 18 ] <<= IsSummationOfParagraphs();
695 // #90356#
696 pValues[ 19 ] <<= IsShowUndoDeleteWarning();
697 pValues[ 20 ] <<= IsSlideshowRespectZOrder();
698
699 pValues[ 21 ] <<= IsPreviewNewEffects();
700 pValues[ 22 ] <<= IsPreviewChangedEffects();
701 pValues[ 23 ] <<= IsPreviewTransitions();
702
703 pValues[ 24 ] <<= GetDisplay();
704
705 pValues[ 25 ] <<= GetPresentationPenColor();
706 pValues[ 26 ] <<= GetPresentationPenWidth();
707
708 pValues[ 27 ] <<= IsStartWithPresenterScreen();
709 }
710
711 return sal_True;
712 }
713
714 /*************************************************************************
715 |* SdOptionsMiscItem
716 \************************************************************************/
717
SdOptionsMiscItem(sal_uInt16 _nWhich)718 SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich )
719 : SfxPoolItem ( _nWhich )
720 , maOptionsMisc ( 0, sal_False )
721 {
722 }
723
724 // ----------------------------------------------------------------------
725
SdOptionsMiscItem(sal_uInt16 _nWhich,SdOptions * pOpts,::sd::FrameView * pView)726 SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
727 : SfxPoolItem ( _nWhich )
728 , maOptionsMisc ( 0, sal_False )
729 {
730 if( pOpts )
731 {
732 maOptionsMisc.SetStartWithTemplate( pOpts->IsStartWithTemplate() );
733 maOptionsMisc.SetStartWithActualPage( pOpts->IsStartWithActualPage() );
734 maOptionsMisc.SetStartWithPresenterScreen( pOpts->IsStartWithPresenterScreen() );
735 maOptionsMisc.SetSummationOfParagraphs( pOpts->IsSummationOfParagraphs() );
736 // #90356#
737 maOptionsMisc.SetShowUndoDeleteWarning( pOpts->IsShowUndoDeleteWarning() );
738 maOptionsMisc.SetPrinterIndependentLayout( pOpts->GetPrinterIndependentLayout() );
739 // #97016#
740 maOptionsMisc.SetDefaultObjectSizeWidth( pOpts->GetDefaultObjectSizeWidth() );
741 maOptionsMisc.SetDefaultObjectSizeHeight( pOpts->GetDefaultObjectSizeHeight() );
742
743 maOptionsMisc.SetPreviewNewEffects(pOpts->IsPreviewNewEffects());
744 maOptionsMisc.SetPreviewChangedEffects(pOpts->IsPreviewChangedEffects());
745 maOptionsMisc.SetPreviewTransitions(pOpts->IsPreviewTransitions());
746
747 maOptionsMisc.SetDisplay(pOpts->GetDisplay());
748 maOptionsMisc.SetShowComments( pOpts->IsShowComments() );
749
750 maOptionsMisc.SetPresentationPenColor(pOpts->GetPresentationPenColor() );
751 maOptionsMisc.SetPresentationPenWidth(pOpts->GetPresentationPenWidth() );
752 }
753
754 if( pView )
755 {
756 maOptionsMisc.SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
757 maOptionsMisc.SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
758 maOptionsMisc.SetCrookNoContortion( pView->IsCrookNoContortion() );
759 maOptionsMisc.SetQuickEdit( pView->IsQuickEdit() );
760
761 // #i26631#
762 maOptionsMisc.SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
763
764 maOptionsMisc.SetDragWithCopy( pView->IsDragWithCopy() );
765 maOptionsMisc.SetPickThrough( (sal_Bool)pView->GetModel()->IsPickThroughTransparentTextFrames() );
766 maOptionsMisc.SetBigHandles( (sal_Bool)pView->IsBigHandles() );
767 maOptionsMisc.SetDoubleClickTextEdit( pView->IsDoubleClickTextEdit() );
768 maOptionsMisc.SetClickChangeRotation( pView->IsClickChangeRotation() );
769 maOptionsMisc.SetSolidDragging( pView->IsSolidDragging() );
770 maOptionsMisc.SetSolidMarkHdl( pView->IsSolidMarkHdl() );
771 }
772 else if( pOpts )
773 {
774 maOptionsMisc.SetMarkedHitMovesAlways( pOpts->IsMarkedHitMovesAlways() );
775 maOptionsMisc.SetMoveOnlyDragging( pOpts->IsMoveOnlyDragging() );
776 maOptionsMisc.SetCrookNoContortion( pOpts->IsCrookNoContortion() );
777 maOptionsMisc.SetQuickEdit( pOpts->IsQuickEdit() );
778 maOptionsMisc.SetMasterPagePaintCaching( pOpts->IsMasterPagePaintCaching() );
779 maOptionsMisc.SetDragWithCopy( pOpts->IsDragWithCopy() );
780 maOptionsMisc.SetPickThrough( pOpts->IsPickThrough() );
781 maOptionsMisc.SetBigHandles( pOpts->IsBigHandles() );
782 maOptionsMisc.SetDoubleClickTextEdit( pOpts->IsDoubleClickTextEdit() );
783 maOptionsMisc.SetClickChangeRotation( pOpts->IsClickChangeRotation() );
784 maOptionsMisc.SetSolidDragging( pOpts->IsSolidDragging() );
785 maOptionsMisc.SetSolidMarkHdl( pOpts->IsSolidMarkHdl() );
786 }
787 }
788
789 // ----------------------------------------------------------------------
790
Clone(SfxItemPool *) const791 SfxPoolItem* SdOptionsMiscItem::Clone( SfxItemPool* ) const
792 {
793 return new SdOptionsMiscItem( *this );
794 }
795
796
797 // ----------------------------------------------------------------------
798
operator ==(const SfxPoolItem & rAttr) const799 int SdOptionsMiscItem::operator==( const SfxPoolItem& rAttr ) const
800 {
801 const bool bSameType = SfxPoolItem::operator==(rAttr);
802 DBG_ASSERT( bSameType, "SdOptionsMiscItem::operator==(), different pool item type!" );
803 return bSameType && ( maOptionsMisc == static_cast< const SdOptionsMiscItem& >(rAttr).maOptionsMisc );
804 }
805
806 // -----------------------------------------------------------------------
807
SetOptions(SdOptions * pOpts) const808 void SdOptionsMiscItem::SetOptions( SdOptions* pOpts ) const
809 {
810 if( pOpts )
811 {
812 pOpts->SetStartWithTemplate( maOptionsMisc.IsStartWithTemplate() );
813 pOpts->SetMarkedHitMovesAlways( maOptionsMisc.IsMarkedHitMovesAlways() );
814 pOpts->SetMoveOnlyDragging( maOptionsMisc.IsMoveOnlyDragging() );
815 pOpts->SetCrookNoContortion( maOptionsMisc.IsCrookNoContortion() );
816 pOpts->SetQuickEdit( maOptionsMisc.IsQuickEdit() );
817 pOpts->SetMasterPagePaintCaching( maOptionsMisc.IsMasterPagePaintCaching() );
818 pOpts->SetDragWithCopy( maOptionsMisc.IsDragWithCopy() );
819 pOpts->SetPickThrough( maOptionsMisc.IsPickThrough() );
820 pOpts->SetBigHandles( maOptionsMisc.IsBigHandles() );
821 pOpts->SetDoubleClickTextEdit( maOptionsMisc.IsDoubleClickTextEdit() );
822 pOpts->SetClickChangeRotation( maOptionsMisc.IsClickChangeRotation() );
823 pOpts->SetStartWithActualPage( maOptionsMisc.IsStartWithActualPage() );
824 pOpts->SetStartWithPresenterScreen( maOptionsMisc.IsStartWithPresenterScreen() );
825 pOpts->SetSummationOfParagraphs( maOptionsMisc.IsSummationOfParagraphs() );
826 pOpts->SetSolidDragging( maOptionsMisc.IsSolidDragging() );
827 pOpts->SetSolidMarkHdl( maOptionsMisc.IsSolidMarkHdl() );
828 // #90356#
829 pOpts->SetShowUndoDeleteWarning( maOptionsMisc.IsShowUndoDeleteWarning() );
830 pOpts->SetPrinterIndependentLayout( maOptionsMisc.GetPrinterIndependentLayout() );
831 pOpts->SetShowComments( maOptionsMisc.IsShowComments() );
832 // #97016#
833 pOpts->SetDefaultObjectSizeWidth( maOptionsMisc.GetDefaultObjectSizeWidth() );
834 pOpts->SetDefaultObjectSizeHeight( maOptionsMisc.GetDefaultObjectSizeHeight() );
835
836 pOpts->SetPreviewNewEffects( maOptionsMisc.IsPreviewNewEffects() );
837 pOpts->SetPreviewChangedEffects( maOptionsMisc.IsPreviewChangedEffects() );
838 pOpts->SetPreviewTransitions( maOptionsMisc.IsPreviewTransitions() );
839
840 pOpts->SetDisplay( maOptionsMisc.GetDisplay() );
841
842 pOpts->SetPresentationPenColor( maOptionsMisc.GetPresentationPenColor() );
843 pOpts->SetPresentationPenWidth( maOptionsMisc.GetPresentationPenWidth() );
844 }
845 }
846
847 /*************************************************************************
848 |* SdOptionsSnap
849 \************************************************************************/
850
SdOptionsSnap(sal_uInt16 nConfigId,sal_Bool bUseConfig)851 SdOptionsSnap::SdOptionsSnap( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
852 SdOptionsGeneric( nConfigId, bUseConfig ?
853 ( ( SDCFG_DRAW == nConfigId ) ?
854 B2U( "Office.Draw/Snap" ) :
855 B2U( "Office.Impress/Snap" ) ) :
856 OUString() ),
857 bSnapHelplines( sal_True ),
858 bSnapBorder( sal_True ),
859 bSnapFrame( sal_False ),
860 bSnapPoints( sal_False ),
861 bOrtho( sal_False ),
862 bBigOrtho( sal_True ),
863 bRotate( sal_False ),
864 nSnapArea( 5 ),
865 nAngle( 1500 ),
866 nBezAngle( 1500 )
867
868 {
869 EnableModify( sal_True );
870 }
871
872 // -----------------------------------------------------------------------------
873
operator ==(const SdOptionsSnap & rOpt) const874 sal_Bool SdOptionsSnap::operator==( const SdOptionsSnap& rOpt ) const
875 {
876 return( IsSnapHelplines() == rOpt.IsSnapHelplines() &&
877 IsSnapBorder() == rOpt.IsSnapBorder() &&
878 IsSnapFrame() == rOpt.IsSnapFrame() &&
879 IsSnapPoints() == rOpt.IsSnapPoints() &&
880 IsOrtho() == rOpt.IsOrtho() &&
881 IsBigOrtho() == rOpt.IsBigOrtho() &&
882 IsRotate() == rOpt.IsRotate() &&
883 GetSnapArea() == rOpt.GetSnapArea() &&
884 GetAngle() == rOpt.GetAngle() &&
885 GetEliminatePolyPointLimitAngle() == rOpt.GetEliminatePolyPointLimitAngle() );
886 }
887
888 // -----------------------------------------------------------------------------
889
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const890 void SdOptionsSnap::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
891 {
892 static const char* aPropNames[] =
893 {
894 "Object/SnapLine",
895 "Object/PageMargin",
896 "Object/ObjectFrame",
897 "Object/ObjectPoint",
898 "Position/CreatingMoving",
899 "Position/ExtendEdges",
900 "Position/Rotating",
901 "Object/Range",
902 "Position/RotatingValue",
903 "Position/PointReduction"
904 };
905
906 rCount = 10;
907 ppNames = aPropNames;
908 }
909
910 // -----------------------------------------------------------------------------
911
ReadData(const Any * pValues)912 sal_Bool SdOptionsSnap::ReadData( const Any* pValues )
913 {
914 if( pValues[0].hasValue() ) SetSnapHelplines( *(sal_Bool*) pValues[ 0 ].getValue() );
915 if( pValues[1].hasValue() ) SetSnapBorder( *(sal_Bool*)pValues[ 1 ].getValue() );
916 if( pValues[2].hasValue() ) SetSnapFrame( *(sal_Bool*) pValues[ 2 ].getValue() );
917 if( pValues[3].hasValue() ) SetSnapPoints( *(sal_Bool*) pValues[ 3 ].getValue() );
918 if( pValues[4].hasValue() ) SetOrtho( *(sal_Bool*) pValues[ 4 ].getValue() );
919 if( pValues[5].hasValue() ) SetBigOrtho( *(sal_Bool*) pValues[ 5 ].getValue() );
920 if( pValues[6].hasValue() ) SetRotate( *(sal_Bool*) pValues[ 6 ].getValue() );
921 if( pValues[7].hasValue() ) SetSnapArea( (sal_Int16) *(sal_Int32*) pValues[ 7 ].getValue() );
922 if( pValues[8].hasValue() ) SetAngle( (sal_Int16) *(sal_Int32*) pValues[ 8 ].getValue() );
923 if( pValues[9].hasValue() ) SetEliminatePolyPointLimitAngle( (sal_Int16) *(sal_Int32*) pValues[ 9 ].getValue() );
924
925 return sal_True;
926 }
927
928 // -----------------------------------------------------------------------------
929
WriteData(Any * pValues) const930 sal_Bool SdOptionsSnap::WriteData( Any* pValues ) const
931 {
932 pValues[ 0 ] <<= IsSnapHelplines();
933 pValues[ 1 ] <<= IsSnapBorder();
934 pValues[ 2 ] <<= IsSnapFrame();
935 pValues[ 3 ] <<= IsSnapPoints();
936 pValues[ 4 ] <<= IsOrtho();
937 pValues[ 5 ] <<= IsBigOrtho();
938 pValues[ 6 ] <<= IsRotate();
939 pValues[ 7 ] <<= (sal_Int32) GetSnapArea();
940 pValues[ 8 ] <<= (sal_Int32) GetAngle();
941 pValues[ 9 ] <<= (sal_Int32) GetEliminatePolyPointLimitAngle();
942
943 return sal_True;
944 }
945
946 /*************************************************************************
947 |* SdOptionsSnapItem
948 \************************************************************************/
949
SdOptionsSnapItem(sal_uInt16 _nWhich)950 SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich )
951 : SfxPoolItem ( _nWhich )
952 , maOptionsSnap ( 0, sal_False )
953 {
954 }
955
956 // ----------------------------------------------------------------------
957
SdOptionsSnapItem(sal_uInt16 _nWhich,SdOptions * pOpts,::sd::FrameView * pView)958 SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
959 : SfxPoolItem ( _nWhich )
960 , maOptionsSnap ( 0, sal_False )
961 {
962 if( pView )
963 {
964 maOptionsSnap.SetSnapHelplines( pView->IsHlplSnap() );
965 maOptionsSnap.SetSnapBorder( pView->IsBordSnap() );
966 maOptionsSnap.SetSnapFrame( pView->IsOFrmSnap() );
967 maOptionsSnap.SetSnapPoints( pView->IsOPntSnap() );
968 maOptionsSnap.SetOrtho( pView->IsOrtho() );
969 maOptionsSnap.SetBigOrtho( pView->IsBigOrtho() );
970 maOptionsSnap.SetRotate( pView->IsAngleSnapEnabled() );
971 maOptionsSnap.SetSnapArea( pView->GetSnapMagneticPixel() );
972 maOptionsSnap.SetAngle( (sal_Int16) pView->GetSnapAngle() );
973 maOptionsSnap.SetEliminatePolyPointLimitAngle( (sal_Int16) pView->GetEliminatePolyPointLimitAngle() );
974 }
975 else if( pOpts )
976 {
977 maOptionsSnap.SetSnapHelplines( pOpts->IsSnapHelplines() );
978 maOptionsSnap.SetSnapBorder( pOpts->IsSnapBorder() );
979 maOptionsSnap.SetSnapFrame( pOpts->IsSnapFrame() );
980 maOptionsSnap.SetSnapPoints( pOpts->IsSnapPoints() );
981 maOptionsSnap.SetOrtho( pOpts->IsOrtho() );
982 maOptionsSnap.SetBigOrtho( pOpts->IsBigOrtho() );
983 maOptionsSnap.SetRotate( pOpts->IsRotate() );
984 maOptionsSnap.SetSnapArea( pOpts->GetSnapArea() );
985 maOptionsSnap.SetAngle( pOpts->GetAngle() );
986 maOptionsSnap.SetEliminatePolyPointLimitAngle( pOpts->GetEliminatePolyPointLimitAngle() );
987 }
988 }
989
990 // ----------------------------------------------------------------------
991
Clone(SfxItemPool *) const992 SfxPoolItem* SdOptionsSnapItem::Clone( SfxItemPool* ) const
993 {
994 return new SdOptionsSnapItem( *this );
995 }
996
997
998 // ----------------------------------------------------------------------
999
operator ==(const SfxPoolItem & rAttr) const1000 int SdOptionsSnapItem::operator==( const SfxPoolItem& rAttr ) const
1001 {
1002 const bool bSameType = SfxPoolItem::operator==(rAttr);
1003 DBG_ASSERT( bSameType, "SdOptionsSnapItem::operator==(), different pool item type!" );
1004 return bSameType && ( maOptionsSnap == static_cast< const SdOptionsSnapItem& >(rAttr).maOptionsSnap );
1005 }
1006
1007 // -----------------------------------------------------------------------
1008
SetOptions(SdOptions * pOpts) const1009 void SdOptionsSnapItem::SetOptions( SdOptions* pOpts ) const
1010 {
1011 if( pOpts )
1012 {
1013 pOpts->SetSnapHelplines( maOptionsSnap.IsSnapHelplines() );
1014 pOpts->SetSnapBorder( maOptionsSnap.IsSnapBorder() );
1015 pOpts->SetSnapFrame( maOptionsSnap.IsSnapFrame() );
1016 pOpts->SetSnapPoints( maOptionsSnap.IsSnapPoints() );
1017 pOpts->SetOrtho( maOptionsSnap.IsOrtho() );
1018 pOpts->SetBigOrtho( maOptionsSnap.IsBigOrtho() );
1019 pOpts->SetRotate( maOptionsSnap.IsRotate() );
1020 pOpts->SetSnapArea( maOptionsSnap.GetSnapArea() );
1021 pOpts->SetAngle( maOptionsSnap.GetAngle() );
1022 pOpts->SetEliminatePolyPointLimitAngle( maOptionsSnap.GetEliminatePolyPointLimitAngle() );
1023 }
1024 }
1025
1026 /*************************************************************************
1027 |* SdOptionsZoom
1028 \************************************************************************/
1029
SdOptionsZoom(sal_uInt16 nConfigId,sal_Bool bUseConfig)1030 SdOptionsZoom::SdOptionsZoom( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
1031 SdOptionsGeneric( nConfigId, ( bUseConfig && ( SDCFG_DRAW == nConfigId ) ) ?
1032 B2U( "Office.Draw/Zoom" ) :
1033 OUString() ),
1034 nX( 1 ),
1035 nY( 1 )
1036
1037 {
1038 EnableModify( sal_True );
1039 }
1040
1041 // -----------------------------------------------------------------------------
1042
operator ==(const SdOptionsZoom & rOpt) const1043 sal_Bool SdOptionsZoom::operator==( const SdOptionsZoom& rOpt ) const
1044 {
1045 sal_Int32 nX1, nX2, nY1, nY2;
1046
1047 GetScale( nX1, nY1 );
1048 rOpt.GetScale( nX2, nY2 );
1049
1050 return( ( nX1 == nX2 ) &&
1051 ( nY1 == nY2 ) );
1052 }
1053
1054 // -----------------------------------------------------------------------------
1055
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const1056 void SdOptionsZoom::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
1057 {
1058 static const char* aPropNames[] =
1059 {
1060 "ScaleX",
1061 "ScaleY"
1062 };
1063
1064 rCount = ( GetConfigId() == SDCFG_DRAW ) ? 2 : 0;
1065 ppNames = aPropNames;
1066 }
1067
1068 // -----------------------------------------------------------------------------
1069
ReadData(const Any * pValues)1070 sal_Bool SdOptionsZoom::ReadData( const Any* pValues )
1071 {
1072 sal_Int32 x = 1, y = 1;
1073
1074 if( pValues[0].hasValue() ) x = ( *(sal_Int32*) pValues[ 0 ].getValue() );
1075 if( pValues[1].hasValue() ) y = ( *(sal_Int32*) pValues[ 1 ].getValue() );
1076
1077 SetScale( x, y );
1078
1079 return sal_True;
1080 }
1081
1082 // -----------------------------------------------------------------------------
1083
WriteData(Any * pValues) const1084 sal_Bool SdOptionsZoom::WriteData( Any* pValues ) const
1085 {
1086 sal_Int32 x, y;
1087
1088 GetScale( x, y );
1089
1090 pValues[ 0 ] <<= (sal_Int32) x;
1091 pValues[ 1 ] <<= (sal_Int32) y;
1092
1093 return sal_True;
1094 }
1095
1096 /*************************************************************************
1097 |* SdOptionsGrid
1098 \************************************************************************/
1099
SdOptionsGrid(sal_uInt16 nConfigId,sal_Bool bUseConfig)1100 SdOptionsGrid::SdOptionsGrid( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
1101 SdOptionsGeneric( nConfigId, bUseConfig ?
1102 ( ( SDCFG_DRAW == nConfigId ) ?
1103 B2U( "Office.Draw/Grid" ) :
1104 B2U( "Office.Impress/Grid" ) ) :
1105 OUString() )
1106 {
1107 EnableModify( sal_False );
1108 SetDefaults();
1109 EnableModify( sal_True );
1110 }
1111
1112 // -----------------------------------------------------------------------------
1113
~SdOptionsGrid()1114 SdOptionsGrid::~SdOptionsGrid()
1115 {
1116 }
1117
1118 // -----------------------------------------------------------------------------
1119
SetDefaults()1120 void SdOptionsGrid::SetDefaults()
1121 {
1122 const sal_uInt32 nVal = 1000;
1123
1124 SetFldDivisionX( nVal );
1125 SetFldDivisionY( nVal );
1126 SetFldDrawX( nVal );
1127 SetFldDrawY( nVal );
1128 SetFldSnapX( nVal );
1129 SetFldSnapY( nVal );
1130 SetUseGridSnap( sal_False );
1131 SetSynchronize( sal_True );
1132 SetGridVisible( sal_False );
1133 SetEqualGrid( sal_True );
1134 }
1135
1136 // -----------------------------------------------------------------------------
1137
operator ==(const SdOptionsGrid & rOpt) const1138 sal_Bool SdOptionsGrid::operator==( const SdOptionsGrid& rOpt ) const
1139 {
1140 return( GetFldDrawX() == rOpt.GetFldDrawX() &&
1141 GetFldDivisionX() == rOpt.GetFldDivisionX() &&
1142 GetFldDrawY() == rOpt.GetFldDrawY() &&
1143 GetFldDivisionY() == rOpt.GetFldDivisionY() &&
1144 GetFldSnapX() == rOpt.GetFldSnapX() &&
1145 GetFldSnapY() == rOpt.GetFldSnapY() &&
1146 IsUseGridSnap() == rOpt.IsUseGridSnap() &&
1147 IsSynchronize() == rOpt.IsSynchronize() &&
1148 IsGridVisible() == rOpt.IsGridVisible() &&
1149 IsEqualGrid() == rOpt.IsEqualGrid() );
1150 }
1151
1152 // -----------------------------------------------------------------------------
1153
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const1154 void SdOptionsGrid::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
1155 {
1156 static const char* aPropNamesMetric[] =
1157 {
1158 "Resolution/XAxis/Metric",
1159 "Resolution/YAxis/Metric",
1160 "Subdivision/XAxis",
1161 "Subdivision/YAxis",
1162 "SnapGrid/XAxis/Metric",
1163 "SnapGrid/YAxis/Metric",
1164 "Option/SnapToGrid",
1165 "Option/Synchronize",
1166 "Option/VisibleGrid",
1167 "SnapGrid/Size"
1168 };
1169
1170 static const char* aPropNamesNonMetric[] =
1171 {
1172 "Resolution/XAxis/NonMetric",
1173 "Resolution/YAxis/NonMetric",
1174 "Subdivision/XAxis",
1175 "Subdivision/YAxis",
1176 "SnapGrid/XAxis/NonMetric",
1177 "SnapGrid/YAxis/NonMetric",
1178 "Option/SnapToGrid",
1179 "Option/Synchronize",
1180 "Option/VisibleGrid",
1181 "SnapGrid/Size"
1182 };
1183
1184 rCount = 10;
1185
1186 if( isMetricSystem() )
1187 ppNames = aPropNamesMetric;
1188 else
1189 ppNames = aPropNamesNonMetric;
1190 }
1191
1192 // -----------------------------------------------------------------------------
1193
ReadData(const Any * pValues)1194 sal_Bool SdOptionsGrid::ReadData( const Any* pValues )
1195 {
1196 if( pValues[0].hasValue() ) SetFldDrawX( *(sal_Int32*) pValues[ 0 ].getValue() );
1197 if( pValues[1].hasValue() ) SetFldDrawY( *(sal_Int32*) pValues[ 1 ].getValue() );
1198
1199 if( pValues[2].hasValue() )
1200 {
1201 const sal_uInt32 nDivX = FRound( *(double*) pValues[ 2 ].getValue() );
1202 SetFldDivisionX( SvxOptionsGrid::GetFldDrawX() / ( nDivX + 1 ) );
1203 }
1204
1205 if( pValues[3].hasValue() )
1206 {
1207 const sal_uInt32 nDivY = FRound( *(double*) pValues[ 3 ].getValue() );
1208 SetFldDivisionY( SvxOptionsGrid::GetFldDrawY() / ( nDivY + 1 ) );
1209 }
1210
1211 if( pValues[4].hasValue() ) SetFldSnapX( *(sal_Int32*) pValues[ 4 ].getValue() );
1212 if( pValues[5].hasValue() ) SetFldSnapY( *(sal_Int32*) pValues[ 5 ].getValue() );
1213 if( pValues[6].hasValue() ) SetUseGridSnap( *(sal_Bool*) pValues[ 6 ].getValue() );
1214 if( pValues[7].hasValue() ) SetSynchronize( *(sal_Bool*) pValues[ 7 ].getValue() );
1215 if( pValues[8].hasValue() ) SetGridVisible( *(sal_Bool*) pValues[ 8 ].getValue() );
1216 if( pValues[9].hasValue() ) SetEqualGrid( *(sal_Bool*) pValues[ 9 ].getValue() );
1217
1218 return sal_True;
1219 }
1220
1221 // -----------------------------------------------------------------------------
1222
WriteData(Any * pValues) const1223 sal_Bool SdOptionsGrid::WriteData( Any* pValues ) const
1224 {
1225 pValues[ 0 ] <<= (sal_Int32) GetFldDrawX();
1226 pValues[ 1 ] <<= (sal_Int32) GetFldDrawY();
1227 pValues[ 2 ] <<= ( GetFldDivisionX() ? ( (double) GetFldDrawX() / GetFldDivisionX() - 1.0 ) : (double) 0 );
1228 pValues[ 3 ] <<= ( GetFldDivisionY() ? ( (double) GetFldDrawY() / GetFldDivisionY() - 1.0 ) : (double) 0 );
1229 pValues[ 4 ] <<= (sal_Int32) GetFldSnapX();
1230 pValues[ 5 ] <<= (sal_Int32) GetFldSnapY();
1231 pValues[ 6 ] <<= IsUseGridSnap();
1232 pValues[ 7 ] <<= IsSynchronize();
1233 pValues[ 8 ] <<= IsGridVisible();
1234 pValues[ 9 ] <<= IsEqualGrid();
1235
1236 return sal_True;
1237 }
1238
1239 /*************************************************************************
1240 |* SdOptionsGridItem
1241 \************************************************************************/
1242
SdOptionsGridItem(sal_uInt16 _nWhich,SdOptions * pOpts,::sd::FrameView * pView)1243 SdOptionsGridItem::SdOptionsGridItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView ) :
1244 SvxGridItem( _nWhich )
1245 {
1246 SetSynchronize( pOpts->IsSynchronize() );
1247 SetEqualGrid( pOpts->IsEqualGrid() );
1248
1249 if( pView )
1250 {
1251 SetFldDrawX( pView->GetGridCoarse().Width() );
1252 SetFldDrawY( pView->GetGridCoarse().Height() );
1253 SetFldDivisionX( pView->GetGridFine().Width() ? ( GetFldDrawX() / pView->GetGridFine().Width() - 1 ) : 0 );
1254 SetFldDivisionY( pView->GetGridFine().Height() ? ( GetFldDrawY() / pView->GetGridFine().Height() - 1 ) : 0 );
1255 SetFldSnapX( long(pView->GetSnapGridWidthX()) );
1256 SetFldSnapY( long(pView->GetSnapGridWidthY()) );
1257 SetUseGridSnap( pView->IsGridSnap() );
1258 SetGridVisible( pView->IsGridVisible() );
1259 }
1260 else
1261 {
1262 SetFldDrawX( pOpts->GetFldDrawX() );
1263 SetFldDrawY( pOpts->GetFldDrawY() );
1264 SetFldDivisionX( pOpts->GetFldDivisionX() ? ( pOpts->GetFldDrawX() / pOpts->GetFldDivisionX() - 1 ) : 0 );
1265 SetFldDivisionY( pOpts->GetFldDivisionY() ? ( pOpts->GetFldDrawY() / pOpts->GetFldDivisionY() - 1 ) : 0 );
1266 SetFldSnapX( pOpts->GetFldSnapX() );
1267 SetFldSnapY( pOpts->GetFldSnapY() );
1268 SetUseGridSnap( pOpts->IsUseGridSnap() );
1269 SetGridVisible( pOpts->IsGridVisible() );
1270 }
1271 }
1272
1273 // -----------------------------------------------------------------------
1274
SetOptions(SdOptions * pOpts) const1275 void SdOptionsGridItem::SetOptions( SdOptions* pOpts ) const
1276 {
1277 pOpts->SetFldDrawX( GetFldDrawX() );
1278 pOpts->SetFldDivisionX( GetFldDrawX() / ( GetFldDivisionX() + 1 ) );
1279 pOpts->SetFldDrawY( GetFldDrawY() );
1280 pOpts->SetFldDivisionY( GetFldDrawY() / ( GetFldDivisionY() + 1 ) );
1281 pOpts->SetFldSnapX( GetFldSnapX() );
1282 pOpts->SetFldSnapY( GetFldSnapY() );
1283 pOpts->SetUseGridSnap( GetUseGridSnap() );
1284 pOpts->SetSynchronize( GetSynchronize() );
1285 pOpts->SetGridVisible( GetGridVisible() );
1286 pOpts->SetEqualGrid( GetEqualGrid() );
1287 }
1288
1289 /*************************************************************************
1290 |* SdOptionsPrint
1291 \************************************************************************/
1292
SdOptionsPrint(sal_uInt16 nConfigId,sal_Bool bUseConfig)1293 SdOptionsPrint::SdOptionsPrint( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
1294 SdOptionsGeneric( nConfigId, bUseConfig ?
1295 ( ( SDCFG_DRAW == nConfigId ) ?
1296 B2U( "Office.Draw/Print" ) :
1297 B2U( "Office.Impress/Print" ) ) :
1298 OUString() ),
1299 bDraw( sal_True ),
1300 bNotes( sal_False ),
1301 bHandout( sal_False ),
1302 bOutline( sal_False ),
1303 bDate( sal_False ),
1304 bTime( sal_False ),
1305 bPagename( sal_False ),
1306 bHiddenPages( sal_True ),
1307 bPagesize( sal_False ),
1308 bPagetile( sal_False ),
1309 bWarningPrinter( sal_True ),
1310 bWarningSize( sal_False ),
1311 bWarningOrientation( sal_False ),
1312 bBooklet( sal_False ),
1313 bFront( sal_True ),
1314 bBack( sal_True ),
1315 bCutPage( sal_False ),
1316 bPaperbin( sal_False ),
1317 mbHandoutHorizontal( sal_True ),
1318 mnHandoutPages( 6 ),
1319 nQuality( 0 )
1320 {
1321 EnableModify( sal_True );
1322 }
1323
1324 // -----------------------------------------------------------------------------
1325
operator ==(const SdOptionsPrint & rOpt) const1326 sal_Bool SdOptionsPrint::operator==( const SdOptionsPrint& rOpt ) const
1327 {
1328 return( IsDraw() == rOpt.IsDraw() &&
1329 IsNotes() == rOpt.IsNotes() &&
1330 IsHandout() == rOpt.IsHandout() &&
1331 IsOutline() == rOpt.IsOutline() &&
1332 IsDate() == rOpt.IsDate() &&
1333 IsTime() == rOpt.IsTime() &&
1334 IsPagename() == rOpt.IsPagename() &&
1335 IsHiddenPages() == rOpt.IsHiddenPages() &&
1336 IsPagesize() == rOpt.IsPagesize() &&
1337 IsPagetile() == rOpt.IsPagetile() &&
1338 IsWarningPrinter() == rOpt.IsWarningPrinter() &&
1339 IsWarningSize() == rOpt.IsWarningSize() &&
1340 IsWarningOrientation() == rOpt.IsWarningOrientation() &&
1341 IsBooklet() == rOpt.IsBooklet() &&
1342 IsFrontPage() == rOpt.IsFrontPage() &&
1343 IsBackPage() == rOpt.IsBackPage() &&
1344 IsCutPage() == rOpt.IsCutPage() &&
1345 IsPaperbin() == rOpt.IsPaperbin() &&
1346 GetOutputQuality() == rOpt.GetOutputQuality() &&
1347 IsHandoutHorizontal() == rOpt.IsHandoutHorizontal() &&
1348 GetHandoutPages() == rOpt.GetHandoutPages() );
1349 }
1350
1351 // -----------------------------------------------------------------------------
1352
GetPropNameArray(const char ** & ppNames,sal_uLong & rCount) const1353 void SdOptionsPrint::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
1354 {
1355 static const char* aDrawPropNames[] =
1356 {
1357 "Other/Date",
1358 "Other/Time",
1359 "Other/PageName",
1360 "Other/HiddenPage",
1361 "Page/PageSize",
1362 "Page/PageTile",
1363 // bWarningPrinter
1364 // bWarningSize
1365 // bWarningOrientation
1366 "Page/Booklet",
1367 "Page/BookletFront",
1368 "Page/BookletBack",
1369 // bCutPage
1370 "Other/FromPrinterSetup",
1371 "Other/Quality",
1372 "Content/Drawing",
1373 };
1374 static const char* aImpressPropNames[] =
1375 {
1376 "Other/Date",
1377 "Other/Time",
1378 "Other/PageName",
1379 "Other/HiddenPage",
1380 "Page/PageSize",
1381 "Page/PageTile",
1382 // bWarningPrinter
1383 // bWarningSize
1384 // bWarningOrientation
1385 "Page/Booklet",
1386 "Page/BookletFront",
1387 "Page/BookletBack",
1388 // bCutPage
1389 "Other/FromPrinterSetup",
1390 "Other/Quality",
1391 "Content/Presentation",
1392 "Content/Note",
1393 "Content/Handout",
1394 "Content/Outline",
1395 "Other/HandoutHorizontal",
1396 "Other/PagesPerHandout"
1397 };
1398
1399 if( GetConfigId() == SDCFG_IMPRESS )
1400 {
1401 rCount = 17;
1402 ppNames = aImpressPropNames;
1403 }
1404 else
1405 {
1406 rCount = 12;
1407 ppNames = aDrawPropNames;
1408 }
1409 }
1410
1411 // -----------------------------------------------------------------------------
1412
ReadData(const Any * pValues)1413 sal_Bool SdOptionsPrint::ReadData( const Any* pValues )
1414 {
1415 if( pValues[0].hasValue() ) SetDate( *(sal_Bool*) pValues[ 0 ].getValue() );
1416 if( pValues[1].hasValue() ) SetTime( *(sal_Bool*) pValues[ 1 ].getValue() );
1417 if( pValues[2].hasValue() ) SetPagename( *(sal_Bool*) pValues[ 2 ].getValue() );
1418 if( pValues[3].hasValue() ) SetHiddenPages( *(sal_Bool*) pValues[ 3 ].getValue() );
1419 if( pValues[4].hasValue() ) SetPagesize( *(sal_Bool*) pValues[ 4 ].getValue() );
1420 if( pValues[5].hasValue() ) SetPagetile( *(sal_Bool*) pValues[ 5 ].getValue() );
1421 if( pValues[6].hasValue() ) SetBooklet( *(sal_Bool*) pValues[ 6 ].getValue() );
1422 if( pValues[7].hasValue() ) SetFrontPage( *(sal_Bool*) pValues[ 7 ].getValue() );
1423 if( pValues[8].hasValue() ) SetBackPage( *(sal_Bool*) pValues[ 8 ].getValue() );
1424 if( pValues[9].hasValue() ) SetPaperbin( *(sal_Bool*) pValues[ 9 ].getValue() );
1425 if( pValues[10].hasValue() ) SetOutputQuality( (sal_uInt16) *(sal_Int32*) pValues[ 10 ].getValue() );
1426 if( pValues[11].hasValue() ) SetDraw( *(sal_Bool*) pValues[ 11 ].getValue() );
1427
1428 // just for Impress
1429 if( GetConfigId() == SDCFG_IMPRESS )
1430 {
1431 if( pValues[12].hasValue() ) SetNotes( *(sal_Bool*) pValues[ 12 ].getValue() );
1432 if( pValues[13].hasValue() ) SetHandout( *(sal_Bool*) pValues[ 13 ].getValue() );
1433 if( pValues[14].hasValue() ) SetOutline( *(sal_Bool*) pValues[ 14 ].getValue() );
1434 if( pValues[15].hasValue() ) SetHandoutHorizontal( *(sal_Bool*) pValues[15].getValue() );
1435 if( pValues[16].hasValue() ) SetHandoutPages( (sal_uInt16)*(sal_Int32*) pValues[16].getValue() );
1436 }
1437
1438 return sal_True;
1439 }
1440
1441 // -----------------------------------------------------------------------------
1442
WriteData(Any * pValues) const1443 sal_Bool SdOptionsPrint::WriteData( Any* pValues ) const
1444 {
1445 pValues[ 0 ] <<= IsDate();
1446 pValues[ 1 ] <<= IsTime();
1447 pValues[ 2 ] <<= IsPagename();
1448 pValues[ 3 ] <<= IsHiddenPages();
1449 pValues[ 4 ] <<= IsPagesize();
1450 pValues[ 5 ] <<= IsPagetile();
1451 pValues[ 6 ] <<= IsBooklet();
1452 pValues[ 7 ] <<= IsFrontPage();
1453 pValues[ 8 ] <<= IsBackPage();
1454 pValues[ 9 ] <<= IsPaperbin();
1455 pValues[ 10 ] <<= (sal_Int32) GetOutputQuality();
1456 pValues[ 11 ] <<= IsDraw();
1457
1458 // just for Impress
1459 if( GetConfigId() == SDCFG_IMPRESS )
1460 {
1461 pValues[ 12 ] <<= IsNotes();
1462 pValues[ 13 ] <<= IsHandout();
1463 pValues[ 14 ] <<= IsOutline();
1464 pValues[ 15 ] <<= IsHandoutHorizontal();
1465 pValues[ 16 ] <<= GetHandoutPages();
1466 }
1467
1468 return sal_True;
1469 }
1470
1471 /*************************************************************************
1472 |* SdOptionsPrintItem
1473 \************************************************************************/
1474
SdOptionsPrintItem(sal_uInt16 _nWhich)1475 SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich )
1476 : SfxPoolItem ( _nWhich )
1477 , maOptionsPrint ( 0, sal_False )
1478 {
1479 }
1480
1481 // ----------------------------------------------------------------------
1482
SdOptionsPrintItem(sal_uInt16 _nWhich,SdOptions * pOpts,::sd::FrameView *)1483 SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* )
1484 : SfxPoolItem ( _nWhich )
1485 , maOptionsPrint ( 0, sal_False )
1486 {
1487 if( pOpts )
1488 {
1489 maOptionsPrint.SetDraw( pOpts->IsDraw() );
1490 maOptionsPrint.SetNotes( pOpts->IsNotes() );
1491 maOptionsPrint.SetHandout( pOpts->IsHandout() );
1492 maOptionsPrint.SetOutline( pOpts->IsOutline() );
1493 maOptionsPrint.SetDate( pOpts->IsDate() );
1494 maOptionsPrint.SetTime( pOpts->IsTime() );
1495 maOptionsPrint.SetPagename( pOpts->IsPagename() );
1496 maOptionsPrint.SetHiddenPages( pOpts->IsHiddenPages() );
1497 maOptionsPrint.SetPagesize( pOpts->IsPagesize() );
1498 maOptionsPrint.SetPagetile( pOpts->IsPagetile() );
1499 maOptionsPrint.SetWarningPrinter( pOpts->IsWarningPrinter() );
1500 maOptionsPrint.SetWarningSize( pOpts->IsWarningSize() );
1501 maOptionsPrint.SetWarningOrientation( pOpts->IsWarningOrientation() );
1502 maOptionsPrint.SetBooklet( pOpts->IsBooklet() );
1503 maOptionsPrint.SetFrontPage( pOpts->IsFrontPage() );
1504 maOptionsPrint.SetBackPage( pOpts->IsBackPage() );
1505 maOptionsPrint.SetCutPage( pOpts->IsCutPage() );
1506 maOptionsPrint.SetPaperbin( pOpts->IsPaperbin() );
1507 maOptionsPrint.SetOutputQuality( pOpts->GetOutputQuality() );
1508 }
1509 }
1510
1511 // ----------------------------------------------------------------------
1512
Clone(SfxItemPool *) const1513 SfxPoolItem* SdOptionsPrintItem::Clone( SfxItemPool* ) const
1514 {
1515 return new SdOptionsPrintItem( *this );
1516 }
1517
1518 // ----------------------------------------------------------------------
1519
operator ==(const SfxPoolItem & rAttr) const1520 int SdOptionsPrintItem::operator==( const SfxPoolItem& rAttr ) const
1521 {
1522 const bool bSameType = SfxPoolItem::operator==(rAttr);
1523 DBG_ASSERT( bSameType, "SdOptionsPrintItem::operator==(), different pool item type!" );
1524 return bSameType && ( maOptionsPrint == static_cast< const SdOptionsPrintItem& >( rAttr ).maOptionsPrint );
1525 }
1526
1527 // -----------------------------------------------------------------------
1528
SetOptions(SdOptions * pOpts) const1529 void SdOptionsPrintItem::SetOptions( SdOptions* pOpts ) const
1530 {
1531 if( pOpts )
1532 {
1533 pOpts->SetDraw( maOptionsPrint.IsDraw() );
1534 pOpts->SetNotes( maOptionsPrint.IsNotes() );
1535 pOpts->SetHandout( maOptionsPrint.IsHandout() );
1536 pOpts->SetOutline( maOptionsPrint.IsOutline() );
1537 pOpts->SetDate( maOptionsPrint.IsDate() );
1538 pOpts->SetTime( maOptionsPrint.IsTime() );
1539 pOpts->SetPagename( maOptionsPrint.IsPagename() );
1540 pOpts->SetHiddenPages( maOptionsPrint.IsHiddenPages() );
1541 pOpts->SetPagesize( maOptionsPrint.IsPagesize() );
1542 pOpts->SetPagetile( maOptionsPrint.IsPagetile() );
1543 pOpts->SetWarningPrinter( maOptionsPrint.IsWarningPrinter() );
1544 pOpts->SetWarningSize( maOptionsPrint.IsWarningSize() );
1545 pOpts->SetWarningOrientation( maOptionsPrint.IsWarningOrientation() );
1546 pOpts->SetBooklet( maOptionsPrint.IsBooklet() );
1547 pOpts->SetFrontPage( maOptionsPrint.IsFrontPage() );
1548 pOpts->SetBackPage( maOptionsPrint.IsBackPage() );
1549 pOpts->SetCutPage( maOptionsPrint.IsCutPage() );
1550 pOpts->SetPaperbin( maOptionsPrint.IsPaperbin() );
1551 pOpts->SetOutputQuality( maOptionsPrint.GetOutputQuality() );
1552 }
1553 }
1554
1555 /*************************************************************************
1556 |* SdOptions
1557 \************************************************************************/
1558
SdOptions(sal_uInt16 nConfigId)1559 SdOptions::SdOptions( sal_uInt16 nConfigId ) :
1560 SdOptionsLayout( nConfigId, sal_True ),
1561 SdOptionsContents( nConfigId, sal_True ),
1562 SdOptionsMisc( nConfigId, sal_True ),
1563 SdOptionsSnap( nConfigId, sal_True ),
1564 SdOptionsZoom( nConfigId, sal_True ),
1565 SdOptionsGrid( nConfigId, sal_True ),
1566 SdOptionsPrint( nConfigId, sal_True )
1567 {
1568 }
1569
1570 // ----------------------------------------------------------------------
1571
~SdOptions()1572 SdOptions::~SdOptions()
1573 {
1574 }
1575
1576 // ----------------------------------------------------------------------
1577
StoreConfig(sal_uLong nOptionsRange)1578 void SdOptions::StoreConfig( sal_uLong nOptionsRange )
1579 {
1580 if( nOptionsRange & SD_OPTIONS_LAYOUT )
1581 SdOptionsLayout::Store();
1582
1583 if( nOptionsRange & SD_OPTIONS_CONTENTS )
1584 SdOptionsContents::Store();
1585
1586 if( nOptionsRange & SD_OPTIONS_MISC )
1587 SdOptionsMisc::Store();
1588
1589 if( nOptionsRange & SD_OPTIONS_SNAP )
1590 SdOptionsSnap::Store();
1591
1592 if( nOptionsRange & SD_OPTIONS_ZOOM )
1593 SdOptionsZoom::Store();
1594
1595 if( nOptionsRange & SD_OPTIONS_GRID )
1596 SdOptionsGrid::Store();
1597
1598 if( nOptionsRange & SD_OPTIONS_PRINT )
1599 SdOptionsPrint::Store();
1600 }
1601