1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svx/svdmodel.hxx>
21 #include <sfx2/app.hxx>
22 #include <sfx2/sfx.hrc>
23 #include <tools/helpers.hxx>
24 #include <unotools/syslocale.hxx>
27 #include "optsitem.hxx"
29 #include "FrameView.hxx"
31 using namespace ::utl
;
32 using namespace ::com::sun::star::uno
;
34 template< class T
> T
getSafeValue( const Any
& rAny
)
37 bool bOk
= (rAny
>>= value
);
39 DBG_ASSERT( bOk
, "SdOptionsItem, wrong type from configuration!" );
47 SdOptionsItem::SdOptionsItem( const SdOptionsGeneric
& rParent
, const OUString
& rSubTree
) :
48 ConfigItem ( rSubTree
),
53 SdOptionsItem::~SdOptionsItem()
57 void SdOptionsItem::ImplCommit()
60 mrParent
.Commit( *this );
63 void SdOptionsItem::Notify( const com::sun::star::uno::Sequence
<OUString
>& )
66 Sequence
< Any
> SdOptionsItem::GetProperties( const Sequence
< OUString
>& rNames
)
68 return ConfigItem::GetProperties( rNames
);
71 bool SdOptionsItem::PutProperties( const Sequence
< OUString
>& rNames
, const Sequence
< Any
>& rValues
)
73 return ConfigItem::PutProperties( rNames
, rValues
);
76 void SdOptionsItem::SetModified()
78 ConfigItem::SetModified();
81 // - SdOptionsGeneric -
82 SdOptionsGeneric::SdOptionsGeneric(sal_uInt16 nConfigId
, const OUString
& rSubTree
)
85 , mnConfigId(nConfigId
)
86 , mbInit(rSubTree
.isEmpty())
87 , mbEnableModify(false)
91 void SdOptionsGeneric::Init() const
95 SdOptionsGeneric
* pThis
= const_cast<SdOptionsGeneric
*>(this);
98 pThis
->mpCfgItem
= new SdOptionsItem( *this, maSubTree
);
100 const Sequence
< OUString
> aNames( GetPropertyNames() );
101 const Sequence
< Any
> aValues
= mpCfgItem
->GetProperties( aNames
);
103 if( aNames
.getLength() && ( aValues
.getLength() == aNames
.getLength() ) )
105 const Any
* pValues
= aValues
.getConstArray();
107 pThis
->EnableModify( false );
108 pThis
->mbInit
= pThis
->ReadData( pValues
);
109 pThis
->EnableModify( true );
112 pThis
->mbInit
= true;
116 SdOptionsGeneric::~SdOptionsGeneric()
122 void SdOptionsGeneric::Commit( SdOptionsItem
& rCfgItem
) const
124 const Sequence
< OUString
> aNames( GetPropertyNames() );
125 Sequence
< Any
> aValues( aNames
.getLength() );
127 if( aNames
.getLength() && ( aValues
.getLength() == aNames
.getLength() ) )
129 if( WriteData( aValues
.getArray() ) )
130 rCfgItem
.PutProperties( aNames
, aValues
);
133 OSL_FAIL( "PutProperties failed" );
138 Sequence
< OUString
> SdOptionsGeneric::GetPropertyNames() const
141 const char** ppPropNames
;
143 GetPropNameArray( ppPropNames
, nCount
);
145 Sequence
< OUString
> aNames( nCount
);
146 OUString
* pNames
= aNames
.getArray();
148 for( sal_uLong i
= 0; i
< nCount
; i
++ )
149 pNames
[ i
] = OUString::createFromAscii( ppPropNames
[ i
] );
154 void SdOptionsGeneric::Store()
160 bool SdOptionsGeneric::isMetricSystem()
162 SvtSysLocale aSysLocale
;
163 MeasurementSystem eSys
= aSysLocale
.GetLocaleDataPtr()->getMeasurementSystemEnum();
165 return ( eSys
== MEASURE_METRIC
);
168 /*************************************************************************
172 \************************************************************************/
174 SdOptionsLayout::SdOptionsLayout( sal_uInt16 nConfigId
, bool bUseConfig
) :
175 SdOptionsGeneric( nConfigId
, bUseConfig
?
176 ( ( SDCFG_DRAW
== nConfigId
) ?
177 OUString( "Office.Draw/Layout" ) :
178 OUString( "Office.Impress/Layout" ) ) :
181 bMoveOutline( true ),
182 bDragStripes( false ),
183 bHandlesBezier( false ),
185 nMetric((sal_uInt16
)(isMetricSystem() ? FUNIT_CM
: FUNIT_INCH
)),
188 EnableModify( true );
191 bool SdOptionsLayout::operator==( const SdOptionsLayout
& rOpt
) const
193 return( IsRulerVisible() == rOpt
.IsRulerVisible() &&
194 IsMoveOutline() == rOpt
.IsMoveOutline() &&
195 IsDragStripes() == rOpt
.IsDragStripes() &&
196 IsHandlesBezier() == rOpt
.IsHandlesBezier() &&
197 IsHelplines() == rOpt
.IsHelplines() &&
198 GetMetric() == rOpt
.GetMetric() &&
199 GetDefTab() == rOpt
.GetDefTab() );
202 void SdOptionsLayout::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
204 if( isMetricSystem() )
206 static const char* aPropNamesMetric
[] =
213 "Other/MeasureUnit/Metric",
214 "Other/TabStop/Metric"
216 ppNames
= aPropNamesMetric
;
217 rCount
= SAL_N_ELEMENTS(aPropNamesMetric
);
221 static const char* aPropNamesNonMetric
[] =
228 "Other/MeasureUnit/NonMetric",
229 "Other/TabStop/NonMetric"
231 ppNames
= aPropNamesNonMetric
;
232 rCount
= SAL_N_ELEMENTS(aPropNamesNonMetric
);
236 bool SdOptionsLayout::ReadData( const Any
* pValues
)
238 if( pValues
[0].hasValue() ) SetRulerVisible( *static_cast<sal_Bool
const *>(pValues
[ 0 ].getValue()) );
239 if( pValues
[1].hasValue() ) SetHandlesBezier( *static_cast<sal_Bool
const *>(pValues
[ 1 ].getValue()) );
240 if( pValues
[2].hasValue() ) SetMoveOutline( *static_cast<sal_Bool
const *>(pValues
[ 2 ].getValue()) );
241 if( pValues
[3].hasValue() ) SetDragStripes( *static_cast<sal_Bool
const *>(pValues
[ 3 ].getValue()) );
242 if( pValues
[4].hasValue() ) SetHelplines( *static_cast<sal_Bool
const *>(pValues
[ 4 ].getValue()) );
243 if( pValues
[5].hasValue() ) SetMetric( (sal_uInt16
) *static_cast<sal_Int32
const *>(pValues
[ 5 ].getValue()) );
244 if( pValues
[6].hasValue() ) SetDefTab( (sal_uInt16
) *static_cast<sal_Int32
const *>(pValues
[ 6 ].getValue()) );
249 bool SdOptionsLayout::WriteData( Any
* pValues
) const
251 pValues
[ 0 ] <<= IsRulerVisible();
252 pValues
[ 1 ] <<= IsHandlesBezier();
253 pValues
[ 2 ] <<= IsMoveOutline();
254 pValues
[ 3 ] <<= IsDragStripes();
255 pValues
[ 4 ] <<= IsHelplines();
256 pValues
[ 5 ] <<= (sal_Int32
) GetMetric();
257 pValues
[ 6 ] <<= (sal_Int32
) GetDefTab();
262 /*************************************************************************
264 |* SdOptionsLayoutItem
266 \************************************************************************/
268 SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich
)
269 : SfxPoolItem ( _nWhich
)
270 , maOptionsLayout ( 0, false )
274 SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
)
275 : SfxPoolItem ( _nWhich
)
276 , maOptionsLayout ( 0, false )
280 maOptionsLayout
.SetMetric( pOpts
->GetMetric() );
281 maOptionsLayout
.SetDefTab( pOpts
->GetDefTab() );
286 maOptionsLayout
.SetRulerVisible( pView
->HasRuler() );
287 maOptionsLayout
.SetMoveOutline( !pView
->IsNoDragXorPolys() );
288 maOptionsLayout
.SetDragStripes( pView
->IsDragStripes() );
289 maOptionsLayout
.SetHandlesBezier( pView
->IsPlusHandlesAlwaysVisible() );
290 maOptionsLayout
.SetHelplines( pView
->IsHlplVisible() );
294 maOptionsLayout
.SetRulerVisible( pOpts
->IsRulerVisible() );
295 maOptionsLayout
.SetMoveOutline( pOpts
->IsMoveOutline() );
296 maOptionsLayout
.SetDragStripes( pOpts
->IsDragStripes() );
297 maOptionsLayout
.SetHandlesBezier( pOpts
->IsHandlesBezier() );
298 maOptionsLayout
.SetHelplines( pOpts
->IsHelplines() );
302 SfxPoolItem
* SdOptionsLayoutItem::Clone( SfxItemPool
* ) const
304 return new SdOptionsLayoutItem( *this );
307 bool SdOptionsLayoutItem::operator==( const SfxPoolItem
& rAttr
) const
309 const bool bSameType
= SfxPoolItem::operator==( rAttr
);
310 DBG_ASSERT( bSameType
, "SdOptionsLayoutItem::operator==(), different pool item type!" );
311 return bSameType
&& ( maOptionsLayout
== static_cast< const SdOptionsLayoutItem
& >( rAttr
).maOptionsLayout
);
314 void SdOptionsLayoutItem::SetOptions( SdOptions
* pOpts
) const
318 pOpts
->SetRulerVisible( maOptionsLayout
.IsRulerVisible() );
319 pOpts
->SetMoveOutline( maOptionsLayout
.IsMoveOutline() );
320 pOpts
->SetDragStripes( maOptionsLayout
.IsDragStripes() );
321 pOpts
->SetHandlesBezier( maOptionsLayout
.IsHandlesBezier() );
322 pOpts
->SetHelplines( maOptionsLayout
.IsHelplines() );
323 pOpts
->SetMetric( maOptionsLayout
.GetMetric() );
324 pOpts
->SetDefTab( maOptionsLayout
.GetDefTab() );
328 /*************************************************************************
332 \************************************************************************/
334 SdOptionsContents::SdOptionsContents( sal_uInt16 nConfigId
, bool bUseConfig
) :
335 SdOptionsGeneric( nConfigId
, bUseConfig
?
336 ( ( SDCFG_DRAW
== nConfigId
) ?
337 OUString( "Office.Draw/Content" ) :
338 OUString( "Office.Impress/Content" ) ) :
341 EnableModify( true );
344 bool SdOptionsContents::operator==(const SdOptionsContents
&) const
349 void SdOptionsContents::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
351 static const char* aPropNames
[] =
353 "Display/PicturePlaceholder",
354 "Display/ContourMode",
355 "Display/LineContour",
356 "Display/TextPlaceholder"
359 rCount
= SAL_N_ELEMENTS(aPropNames
);
360 ppNames
= aPropNames
;
363 bool SdOptionsContents::ReadData(const Any
*)
368 bool SdOptionsContents::WriteData( Any
* pValues
) const
370 //#i80528# no draft anymore
371 pValues
[ 0 ] <<= false;
372 pValues
[ 1 ] <<= false;
373 pValues
[ 2 ] <<= false;
374 pValues
[ 3 ] <<= false;
379 /*************************************************************************
381 |* SdOptionsContentsItem
383 \************************************************************************/
385 SdOptionsContentsItem::SdOptionsContentsItem(sal_uInt16 _nWhich
, SdOptions
*, ::sd::FrameView
*)
386 : SfxPoolItem ( _nWhich
)
387 , maOptionsContents ( 0, false )
391 SfxPoolItem
* SdOptionsContentsItem::Clone( SfxItemPool
* ) const
393 return new SdOptionsContentsItem( *this );
396 bool SdOptionsContentsItem::operator==( const SfxPoolItem
& rAttr
) const
398 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
399 DBG_ASSERT( bSameType
, "SdOptionsContentsItem::operator==(), different pool item type!" );
400 return bSameType
&& ( maOptionsContents
== static_cast<const SdOptionsContentsItem
&>( rAttr
).maOptionsContents
);
403 /*************************************************************************
407 \************************************************************************/
409 SdOptionsMisc::SdOptionsMisc( sal_uInt16 nConfigId
, bool bUseConfig
) :
410 SdOptionsGeneric( nConfigId
, bUseConfig
?
411 ( ( SDCFG_DRAW
== nConfigId
) ?
412 OUString( "Office.Draw/Misc" ) :
413 OUString( "Office.Impress/Misc" ) ) :
415 nDefaultObjectSizeWidth(8000),
416 nDefaultObjectSizeHeight(5000),
417 bStartWithTemplate( false ),
418 bMarkedHitMovesAlways( true ),
419 bMoveOnlyDragging( false ),
420 bCrookNoContortion( false ),
421 bQuickEdit( GetConfigId() != SDCFG_DRAW
),
422 bMasterPageCache( true ),
423 bDragWithCopy( false ),
424 bPickThrough( true ),
425 bDoubleClickTextEdit( true ),
426 bClickChangeRotation( false ),
427 bEnableSdremote( false ),
428 bEnablePresenterScreen( true),
429 bSolidDragging( true ),
430 bSummationOfParagraphs( false ),
431 bShowUndoDeleteWarning( true ),
432 bSlideshowRespectZOrder( true ),
433 bShowComments( true ),
434 bPreviewNewEffects( true ),
435 bPreviewChangedEffects( false ),
436 bPreviewTransitions( true ),
438 mnPenColor( 0xff0000 ),
441 // The default for 6.1-and-above documents is to use printer-independent
443 mnPrinterIndependentLayout (1)
445 EnableModify( true );
448 bool SdOptionsMisc::operator==( const SdOptionsMisc
& rOpt
) const
450 return( IsStartWithTemplate() == rOpt
.IsStartWithTemplate() &&
451 IsMarkedHitMovesAlways() == rOpt
.IsMarkedHitMovesAlways() &&
452 IsMoveOnlyDragging() == rOpt
.IsMoveOnlyDragging() &&
453 IsCrookNoContortion() == rOpt
.IsCrookNoContortion() &&
454 IsQuickEdit() == rOpt
.IsQuickEdit() &&
455 IsMasterPagePaintCaching() == rOpt
.IsMasterPagePaintCaching() &&
456 IsDragWithCopy() == rOpt
.IsDragWithCopy() &&
457 IsPickThrough() == rOpt
.IsPickThrough() &&
458 IsDoubleClickTextEdit() == rOpt
.IsDoubleClickTextEdit() &&
459 IsClickChangeRotation() == rOpt
.IsClickChangeRotation() &&
460 IsEnableSdremote() == rOpt
.IsEnableSdremote() &&
461 IsEnablePresenterScreen() == rOpt
.IsEnablePresenterScreen()&&
462 IsSummationOfParagraphs() == rOpt
.IsSummationOfParagraphs() &&
463 IsSolidDragging() == rOpt
.IsSolidDragging() &&
464 IsShowUndoDeleteWarning() == rOpt
.IsShowUndoDeleteWarning() &&
465 IsSlideshowRespectZOrder() == rOpt
.IsSlideshowRespectZOrder() &&
466 GetPrinterIndependentLayout() == rOpt
.GetPrinterIndependentLayout() &&
467 GetDefaultObjectSizeWidth() == rOpt
.GetDefaultObjectSizeWidth() &&
468 GetDefaultObjectSizeHeight() == rOpt
.GetDefaultObjectSizeHeight() &&
470 IsPreviewNewEffects() == rOpt
.IsPreviewNewEffects() &&
471 IsPreviewChangedEffects() == rOpt
.IsPreviewChangedEffects() &&
472 IsPreviewTransitions() == rOpt
.IsPreviewTransitions() &&
473 GetDisplay() == rOpt
.GetDisplay() &&
474 IsShowComments() == rOpt
.IsShowComments() &&
475 GetPresentationPenColor() == rOpt
.GetPresentationPenColor() &&
476 GetPresentationPenWidth() == rOpt
.GetPresentationPenWidth()
480 void SdOptionsMisc::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
482 static const char* aPropNames
[] =
486 "TextObject/QuickEditing",
489 "TextObject/Selectable",
493 "ModifyWithAttributes",
494 "DefaultObjectSize/Width",
495 "DefaultObjectSize/Height",
497 "Compatibility/PrinterIndependentLayout",
503 "Compatibility/AddBetween",
504 "ShowUndoDeleteWarning",
505 "SlideshowRespectZOrder",
508 "PreviewChangedEffects",
509 "PreviewTransitions",
515 "Start/EnableSdremote",
516 "Start/EnablePresenterScreen"
519 rCount
= ( ( GetConfigId() == SDCFG_IMPRESS
) ? SAL_N_ELEMENTS(aPropNames
) : 14 );
520 ppNames
= aPropNames
;
523 bool SdOptionsMisc::ReadData( const Any
* pValues
)
525 if( pValues
[0].hasValue() ) SetMarkedHitMovesAlways( *static_cast<sal_Bool
const *>(pValues
[ 0 ].getValue()) );
526 if( pValues
[1].hasValue() ) SetCrookNoContortion( *static_cast<sal_Bool
const *>(pValues
[ 1 ].getValue()) );
527 if( pValues
[2].hasValue() ) SetQuickEdit( *static_cast<sal_Bool
const *>(pValues
[ 2 ].getValue()) );
528 if( pValues
[3].hasValue() ) SetMasterPagePaintCaching( *static_cast<sal_Bool
const *>(pValues
[ 3 ].getValue()) );
529 if( pValues
[4].hasValue() ) SetDragWithCopy( *static_cast<sal_Bool
const *>(pValues
[ 4 ].getValue()) );
530 if( pValues
[5].hasValue() ) SetPickThrough( *static_cast<sal_Bool
const *>(pValues
[ 5 ].getValue()) );
531 if( pValues
[6].hasValue() ) SetDoubleClickTextEdit( *static_cast<sal_Bool
const *>(pValues
[ 6 ].getValue()) );
532 if( pValues
[7].hasValue() ) SetClickChangeRotation( *static_cast<sal_Bool
const *>(pValues
[ 7 ].getValue()) );
533 if( pValues
[9].hasValue() ) SetSolidDragging( *static_cast<sal_Bool
const *>(pValues
[ 9 ].getValue()) );
534 if( pValues
[10].hasValue() ) SetDefaultObjectSizeWidth( *static_cast<sal_uInt32
const *>(pValues
[ 10 ].getValue()) );
535 if( pValues
[11].hasValue() ) SetDefaultObjectSizeHeight( *static_cast<sal_uInt32
const *>(pValues
[ 11 ].getValue()) );
536 if( pValues
[12].hasValue() ) SetPrinterIndependentLayout( *static_cast<sal_uInt16
const *>(pValues
[ 12 ].getValue()) );
538 if( pValues
[13].hasValue() )
539 SetShowComments( *static_cast<sal_Bool
const *>(pValues
[ 13 ].getValue()) );
542 if( GetConfigId() == SDCFG_IMPRESS
)
544 if( pValues
[14].hasValue() )
545 SetStartWithTemplate( *static_cast<sal_Bool
const *>(pValues
[ 14 ].getValue()) );
546 if( pValues
[15].hasValue() )
547 SetSummationOfParagraphs( *static_cast<sal_Bool
const *>(pValues
[ 15 ].getValue()) );
548 if( pValues
[16].hasValue() )
549 SetShowUndoDeleteWarning( *static_cast<sal_Bool
const *>(pValues
[ 16 ].getValue()) );
551 if( pValues
[17].hasValue() )
552 SetSlideshowRespectZOrder(*static_cast<sal_Bool
const *>(pValues
[ 17 ].getValue()));
554 if( pValues
[18].hasValue() )
555 SetPreviewNewEffects(*static_cast<sal_Bool
const *>(pValues
[ 18 ].getValue()));
557 if( pValues
[19].hasValue() )
558 SetPreviewChangedEffects(*static_cast<sal_Bool
const *>(pValues
[ 19 ].getValue()));
560 if( pValues
[20].hasValue() )
561 SetPreviewTransitions(*static_cast<sal_Bool
const *>(pValues
[ 20 ].getValue()));
563 if( pValues
[21].hasValue() )
564 SetDisplay(*static_cast<sal_Int32
const *>(pValues
[ 21 ].getValue()));
566 if( pValues
[22].hasValue() )
567 SetPresentationPenColor( getSafeValue
< sal_Int32
>( pValues
[ 22 ] ) );
569 if( pValues
[23].hasValue() )
570 SetPresentationPenWidth( getSafeValue
< double >( pValues
[ 23 ] ) );
572 if( pValues
[24].hasValue() )
573 SetEnableSdremote( *static_cast<sal_Bool
const *>(pValues
[ 24 ].getValue()) );
575 if( pValues
[25].hasValue() )
576 SetEnablePresenterScreen( *static_cast<sal_Bool
const *>(pValues
[ 25 ].getValue()) );
582 bool SdOptionsMisc::WriteData( Any
* pValues
) const
584 pValues
[ 0 ] <<= IsMarkedHitMovesAlways();
585 pValues
[ 1 ] <<= IsCrookNoContortion();
586 pValues
[ 2 ] <<= IsQuickEdit();
587 pValues
[ 3 ] <<= IsMasterPagePaintCaching();
588 pValues
[ 4 ] <<= IsDragWithCopy();
589 pValues
[ 5 ] <<= IsPickThrough();
590 pValues
[ 6 ] <<= IsDoubleClickTextEdit();
591 pValues
[ 7 ] <<= IsClickChangeRotation();
592 // The preview is not supported anymore. Use a dummy value.
593 pValues
[ 8 ] <<= (double)0;// GetPreviewQuality();
594 pValues
[ 9 ] <<= IsSolidDragging();
595 pValues
[ 10 ] <<= GetDefaultObjectSizeWidth();
596 pValues
[ 11 ] <<= GetDefaultObjectSizeHeight();
597 pValues
[ 12 ] <<= GetPrinterIndependentLayout();
598 pValues
[ 13 ] <<= IsShowComments();
601 if( GetConfigId() == SDCFG_IMPRESS
)
603 pValues
[ 14 ] <<= IsStartWithTemplate();
604 pValues
[ 15 ] <<= IsSummationOfParagraphs();
605 pValues
[ 16 ] <<= IsShowUndoDeleteWarning();
606 pValues
[ 17 ] <<= IsSlideshowRespectZOrder();
608 pValues
[ 18 ] <<= IsPreviewNewEffects();
609 pValues
[ 19 ] <<= IsPreviewChangedEffects();
610 pValues
[ 20 ] <<= IsPreviewTransitions();
612 pValues
[ 21 ] <<= GetDisplay();
614 pValues
[ 22 ] <<= GetPresentationPenColor();
615 pValues
[ 23 ] <<= GetPresentationPenWidth();
616 pValues
[ 24 ] <<= IsEnableSdremote();
617 pValues
[ 25 ] <<= IsEnablePresenterScreen();
623 /*************************************************************************
627 \************************************************************************/
629 SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich
)
630 : SfxPoolItem ( _nWhich
)
631 , maOptionsMisc ( 0, false )
635 SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
)
636 : SfxPoolItem ( _nWhich
)
637 , maOptionsMisc ( 0, false )
641 maOptionsMisc
.SetStartWithTemplate( pOpts
->IsStartWithTemplate() );
642 maOptionsMisc
.SetEnableSdremote( pOpts
->IsEnableSdremote() );
643 maOptionsMisc
.SetEnablePresenterScreen( pOpts
->IsEnablePresenterScreen() );
644 maOptionsMisc
.SetSummationOfParagraphs( pOpts
->IsSummationOfParagraphs() );
645 maOptionsMisc
.SetShowUndoDeleteWarning( pOpts
->IsShowUndoDeleteWarning() );
646 maOptionsMisc
.SetPrinterIndependentLayout( pOpts
->GetPrinterIndependentLayout() );
647 maOptionsMisc
.SetDefaultObjectSizeWidth( pOpts
->GetDefaultObjectSizeWidth() );
648 maOptionsMisc
.SetDefaultObjectSizeHeight( pOpts
->GetDefaultObjectSizeHeight() );
650 maOptionsMisc
.SetPreviewNewEffects(pOpts
->IsPreviewNewEffects());
651 maOptionsMisc
.SetPreviewChangedEffects(pOpts
->IsPreviewChangedEffects());
652 maOptionsMisc
.SetPreviewTransitions(pOpts
->IsPreviewTransitions());
654 maOptionsMisc
.SetDisplay(pOpts
->GetDisplay());
655 maOptionsMisc
.SetShowComments( pOpts
->IsShowComments() );
657 maOptionsMisc
.SetPresentationPenColor(pOpts
->GetPresentationPenColor() );
658 maOptionsMisc
.SetPresentationPenWidth(pOpts
->GetPresentationPenWidth() );
663 maOptionsMisc
.SetMarkedHitMovesAlways( pView
->IsMarkedHitMovesAlways() );
664 maOptionsMisc
.SetMoveOnlyDragging( pView
->IsMoveOnlyDragging() );
665 maOptionsMisc
.SetCrookNoContortion( pView
->IsCrookNoContortion() );
666 maOptionsMisc
.SetQuickEdit( pView
->IsQuickEdit() );
669 maOptionsMisc
.SetMasterPagePaintCaching( pView
->IsMasterPagePaintCaching() );
671 maOptionsMisc
.SetDragWithCopy( pView
->IsDragWithCopy() );
672 maOptionsMisc
.SetPickThrough( pView
->GetModel()->IsPickThroughTransparentTextFrames() );
673 maOptionsMisc
.SetDoubleClickTextEdit( pView
->IsDoubleClickTextEdit() );
674 maOptionsMisc
.SetClickChangeRotation( pView
->IsClickChangeRotation() );
675 maOptionsMisc
.SetSolidDragging( pView
->IsSolidDragging() );
679 maOptionsMisc
.SetMarkedHitMovesAlways( pOpts
->IsMarkedHitMovesAlways() );
680 maOptionsMisc
.SetMoveOnlyDragging( pOpts
->IsMoveOnlyDragging() );
681 maOptionsMisc
.SetCrookNoContortion( pOpts
->IsCrookNoContortion() );
682 maOptionsMisc
.SetQuickEdit( pOpts
->IsQuickEdit() );
683 maOptionsMisc
.SetMasterPagePaintCaching( pOpts
->IsMasterPagePaintCaching() );
684 maOptionsMisc
.SetDragWithCopy( pOpts
->IsDragWithCopy() );
685 maOptionsMisc
.SetPickThrough( pOpts
->IsPickThrough() );
686 maOptionsMisc
.SetDoubleClickTextEdit( pOpts
->IsDoubleClickTextEdit() );
687 maOptionsMisc
.SetClickChangeRotation( pOpts
->IsClickChangeRotation() );
688 maOptionsMisc
.SetSolidDragging( pOpts
->IsSolidDragging() );
692 SfxPoolItem
* SdOptionsMiscItem::Clone( SfxItemPool
* ) const
694 return new SdOptionsMiscItem( *this );
697 bool SdOptionsMiscItem::operator==( const SfxPoolItem
& rAttr
) const
699 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
700 DBG_ASSERT( bSameType
, "SdOptionsMiscItem::operator==(), different pool item type!" );
701 return bSameType
&& ( maOptionsMisc
== static_cast< const SdOptionsMiscItem
& >(rAttr
).maOptionsMisc
);
704 void SdOptionsMiscItem::SetOptions( SdOptions
* pOpts
) const
708 pOpts
->SetStartWithTemplate( maOptionsMisc
.IsStartWithTemplate() );
709 pOpts
->SetMarkedHitMovesAlways( maOptionsMisc
.IsMarkedHitMovesAlways() );
710 pOpts
->SetMoveOnlyDragging( maOptionsMisc
.IsMoveOnlyDragging() );
711 pOpts
->SetCrookNoContortion( maOptionsMisc
.IsCrookNoContortion() );
712 pOpts
->SetQuickEdit( maOptionsMisc
.IsQuickEdit() );
713 pOpts
->SetMasterPagePaintCaching( maOptionsMisc
.IsMasterPagePaintCaching() );
714 pOpts
->SetDragWithCopy( maOptionsMisc
.IsDragWithCopy() );
715 pOpts
->SetPickThrough( maOptionsMisc
.IsPickThrough() );
716 pOpts
->SetDoubleClickTextEdit( maOptionsMisc
.IsDoubleClickTextEdit() );
717 pOpts
->SetClickChangeRotation( maOptionsMisc
.IsClickChangeRotation() );
718 pOpts
->SetEnableSdremote( maOptionsMisc
.IsEnableSdremote() );
719 pOpts
->SetEnablePresenterScreen( maOptionsMisc
.IsEnablePresenterScreen() );
720 pOpts
->SetSummationOfParagraphs( maOptionsMisc
.IsSummationOfParagraphs() );
721 pOpts
->SetSolidDragging( maOptionsMisc
.IsSolidDragging() );
722 pOpts
->SetShowUndoDeleteWarning( maOptionsMisc
.IsShowUndoDeleteWarning() );
723 pOpts
->SetPrinterIndependentLayout( maOptionsMisc
.GetPrinterIndependentLayout() );
724 pOpts
->SetShowComments( maOptionsMisc
.IsShowComments() );
725 pOpts
->SetDefaultObjectSizeWidth( maOptionsMisc
.GetDefaultObjectSizeWidth() );
726 pOpts
->SetDefaultObjectSizeHeight( maOptionsMisc
.GetDefaultObjectSizeHeight() );
728 pOpts
->SetPreviewNewEffects( maOptionsMisc
.IsPreviewNewEffects() );
729 pOpts
->SetPreviewChangedEffects( maOptionsMisc
.IsPreviewChangedEffects() );
730 pOpts
->SetPreviewTransitions( maOptionsMisc
.IsPreviewTransitions() );
732 pOpts
->SetDisplay( maOptionsMisc
.GetDisplay() );
734 pOpts
->SetPresentationPenColor( maOptionsMisc
.GetPresentationPenColor() );
735 pOpts
->SetPresentationPenWidth( maOptionsMisc
.GetPresentationPenWidth() );
739 /*************************************************************************
743 \************************************************************************/
745 SdOptionsSnap::SdOptionsSnap( sal_uInt16 nConfigId
, bool bUseConfig
) :
746 SdOptionsGeneric( nConfigId
, bUseConfig
?
747 ( ( SDCFG_DRAW
== nConfigId
) ?
748 OUString( "Office.Draw/Snap" ) :
749 OUString( "Office.Impress/Snap" ) ) :
751 bSnapHelplines( true ),
754 bSnapPoints( false ),
763 EnableModify( true );
766 bool SdOptionsSnap::operator==( const SdOptionsSnap
& rOpt
) const
768 return( IsSnapHelplines() == rOpt
.IsSnapHelplines() &&
769 IsSnapBorder() == rOpt
.IsSnapBorder() &&
770 IsSnapFrame() == rOpt
.IsSnapFrame() &&
771 IsSnapPoints() == rOpt
.IsSnapPoints() &&
772 IsOrtho() == rOpt
.IsOrtho() &&
773 IsBigOrtho() == rOpt
.IsBigOrtho() &&
774 IsRotate() == rOpt
.IsRotate() &&
775 GetSnapArea() == rOpt
.GetSnapArea() &&
776 GetAngle() == rOpt
.GetAngle() &&
777 GetEliminatePolyPointLimitAngle() == rOpt
.GetEliminatePolyPointLimitAngle() );
780 void SdOptionsSnap::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
782 static const char* aPropNames
[] =
786 "Object/ObjectFrame",
787 "Object/ObjectPoint",
788 "Position/CreatingMoving",
789 "Position/ExtendEdges",
792 "Position/RotatingValue",
793 "Position/PointReduction"
796 rCount
= SAL_N_ELEMENTS(aPropNames
);
797 ppNames
= aPropNames
;
800 bool SdOptionsSnap::ReadData( const Any
* pValues
)
802 if( pValues
[0].hasValue() ) SetSnapHelplines( *static_cast<sal_Bool
const *>(pValues
[ 0 ].getValue()) );
803 if( pValues
[1].hasValue() ) SetSnapBorder( *static_cast<sal_Bool
const *>(pValues
[ 1 ].getValue()) );
804 if( pValues
[2].hasValue() ) SetSnapFrame( *static_cast<sal_Bool
const *>(pValues
[ 2 ].getValue()) );
805 if( pValues
[3].hasValue() ) SetSnapPoints( *static_cast<sal_Bool
const *>(pValues
[ 3 ].getValue()) );
806 if( pValues
[4].hasValue() ) SetOrtho( *static_cast<sal_Bool
const *>(pValues
[ 4 ].getValue()) );
807 if( pValues
[5].hasValue() ) SetBigOrtho( *static_cast<sal_Bool
const *>(pValues
[ 5 ].getValue()) );
808 if( pValues
[6].hasValue() ) SetRotate( *static_cast<sal_Bool
const *>(pValues
[ 6 ].getValue()) );
809 if( pValues
[7].hasValue() ) SetSnapArea( (sal_Int16
) *static_cast<sal_Int32
const *>(pValues
[ 7 ].getValue()) );
810 if( pValues
[8].hasValue() ) SetAngle( (sal_Int16
) *static_cast<sal_Int32
const *>(pValues
[ 8 ].getValue()) );
811 if( pValues
[9].hasValue() ) SetEliminatePolyPointLimitAngle( (sal_Int16
) *static_cast<sal_Int32
const *>(pValues
[ 9 ].getValue()) );
816 bool SdOptionsSnap::WriteData( Any
* pValues
) const
818 pValues
[ 0 ] <<= IsSnapHelplines();
819 pValues
[ 1 ] <<= IsSnapBorder();
820 pValues
[ 2 ] <<= IsSnapFrame();
821 pValues
[ 3 ] <<= IsSnapPoints();
822 pValues
[ 4 ] <<= IsOrtho();
823 pValues
[ 5 ] <<= IsBigOrtho();
824 pValues
[ 6 ] <<= IsRotate();
825 pValues
[ 7 ] <<= (sal_Int32
) GetSnapArea();
826 pValues
[ 8 ] <<= (sal_Int32
) GetAngle();
827 pValues
[ 9 ] <<= (sal_Int32
) GetEliminatePolyPointLimitAngle();
832 /*************************************************************************
836 \************************************************************************/
838 SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich
)
839 : SfxPoolItem ( _nWhich
)
840 , maOptionsSnap ( 0, false )
844 SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
)
845 : SfxPoolItem ( _nWhich
)
846 , maOptionsSnap ( 0, false )
850 maOptionsSnap
.SetSnapHelplines( pView
->IsHlplSnap() );
851 maOptionsSnap
.SetSnapBorder( pView
->IsBordSnap() );
852 maOptionsSnap
.SetSnapFrame( pView
->IsOFrmSnap() );
853 maOptionsSnap
.SetSnapPoints( pView
->IsOPntSnap() );
854 maOptionsSnap
.SetOrtho( pView
->IsOrtho() );
855 maOptionsSnap
.SetBigOrtho( pView
->IsBigOrtho() );
856 maOptionsSnap
.SetRotate( pView
->IsAngleSnapEnabled() );
857 maOptionsSnap
.SetSnapArea( pView
->GetSnapMagneticPixel() );
858 maOptionsSnap
.SetAngle( (sal_Int16
) pView
->GetSnapAngle() );
859 maOptionsSnap
.SetEliminatePolyPointLimitAngle( (sal_Int16
) pView
->GetEliminatePolyPointLimitAngle() );
863 maOptionsSnap
.SetSnapHelplines( pOpts
->IsSnapHelplines() );
864 maOptionsSnap
.SetSnapBorder( pOpts
->IsSnapBorder() );
865 maOptionsSnap
.SetSnapFrame( pOpts
->IsSnapFrame() );
866 maOptionsSnap
.SetSnapPoints( pOpts
->IsSnapPoints() );
867 maOptionsSnap
.SetOrtho( pOpts
->IsOrtho() );
868 maOptionsSnap
.SetBigOrtho( pOpts
->IsBigOrtho() );
869 maOptionsSnap
.SetRotate( pOpts
->IsRotate() );
870 maOptionsSnap
.SetSnapArea( pOpts
->GetSnapArea() );
871 maOptionsSnap
.SetAngle( pOpts
->GetAngle() );
872 maOptionsSnap
.SetEliminatePolyPointLimitAngle( pOpts
->GetEliminatePolyPointLimitAngle() );
876 SfxPoolItem
* SdOptionsSnapItem::Clone( SfxItemPool
* ) const
878 return new SdOptionsSnapItem( *this );
881 bool SdOptionsSnapItem::operator==( const SfxPoolItem
& rAttr
) const
883 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
884 DBG_ASSERT( bSameType
, "SdOptionsSnapItem::operator==(), different pool item type!" );
885 return bSameType
&& ( maOptionsSnap
== static_cast< const SdOptionsSnapItem
& >(rAttr
).maOptionsSnap
);
888 void SdOptionsSnapItem::SetOptions( SdOptions
* pOpts
) const
892 pOpts
->SetSnapHelplines( maOptionsSnap
.IsSnapHelplines() );
893 pOpts
->SetSnapBorder( maOptionsSnap
.IsSnapBorder() );
894 pOpts
->SetSnapFrame( maOptionsSnap
.IsSnapFrame() );
895 pOpts
->SetSnapPoints( maOptionsSnap
.IsSnapPoints() );
896 pOpts
->SetOrtho( maOptionsSnap
.IsOrtho() );
897 pOpts
->SetBigOrtho( maOptionsSnap
.IsBigOrtho() );
898 pOpts
->SetRotate( maOptionsSnap
.IsRotate() );
899 pOpts
->SetSnapArea( maOptionsSnap
.GetSnapArea() );
900 pOpts
->SetAngle( maOptionsSnap
.GetAngle() );
901 pOpts
->SetEliminatePolyPointLimitAngle( maOptionsSnap
.GetEliminatePolyPointLimitAngle() );
905 /*************************************************************************
909 \************************************************************************/
911 SdOptionsZoom::SdOptionsZoom( sal_uInt16 nConfigId
, bool bUseConfig
) :
912 SdOptionsGeneric( nConfigId
, ( bUseConfig
&& ( SDCFG_DRAW
== nConfigId
) ) ?
913 OUString( "Office.Draw/Zoom" ) :
919 EnableModify( true );
922 bool SdOptionsZoom::operator==( const SdOptionsZoom
& rOpt
) const
924 sal_Int32 nX1
, nX2
, nY1
, nY2
;
926 GetScale( nX1
, nY1
);
927 rOpt
.GetScale( nX2
, nY2
);
929 return( ( nX1
== nX2
) &&
933 void SdOptionsZoom::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
935 static const char* aPropNames
[] =
941 rCount
= ( GetConfigId() == SDCFG_DRAW
) ? SAL_N_ELEMENTS(aPropNames
) : 0;
942 ppNames
= aPropNames
;
945 bool SdOptionsZoom::ReadData( const Any
* pValues
)
947 sal_Int32 x
= 1, y
= 1;
949 if( pValues
[0].hasValue() ) x
= ( *static_cast<sal_Int32
const *>(pValues
[ 0 ].getValue()) );
950 if( pValues
[1].hasValue() ) y
= ( *static_cast<sal_Int32
const *>(pValues
[ 1 ].getValue()) );
957 bool SdOptionsZoom::WriteData( Any
* pValues
) const
963 pValues
[ 0 ] <<= (sal_Int32
) x
;
964 pValues
[ 1 ] <<= (sal_Int32
) y
;
969 /*************************************************************************
973 \************************************************************************/
975 SdOptionsGrid::SdOptionsGrid( sal_uInt16 nConfigId
, bool bUseConfig
) :
976 SdOptionsGeneric( nConfigId
, bUseConfig
?
977 ( ( SDCFG_DRAW
== nConfigId
) ?
978 OUString( "Office.Draw/Grid" ) :
979 OUString( "Office.Impress/Grid" ) ) :
982 EnableModify( false );
984 EnableModify( true );
987 SdOptionsGrid::~SdOptionsGrid()
991 void SdOptionsGrid::SetDefaults()
993 const sal_uInt32 nVal
= 1000;
995 SetFieldDivisionX( nVal
);
996 SetFieldDivisionY( nVal
);
997 SetFieldDrawX( nVal
);
998 SetFieldDrawY( nVal
);
999 SetFieldSnapX( nVal
);
1000 SetFieldSnapY( nVal
);
1001 SetUseGridSnap( false );
1002 SetSynchronize( true );
1003 SetGridVisible( false );
1004 SetEqualGrid( true );
1007 bool SdOptionsGrid::operator==( const SdOptionsGrid
& rOpt
) const
1009 return( GetFieldDrawX() == rOpt
.GetFieldDrawX() &&
1010 GetFieldDivisionX() == rOpt
.GetFieldDivisionX() &&
1011 GetFieldDrawY() == rOpt
.GetFieldDrawY() &&
1012 GetFieldDivisionY() == rOpt
.GetFieldDivisionY() &&
1013 GetFieldSnapX() == rOpt
.GetFieldSnapX() &&
1014 GetFieldSnapY() == rOpt
.GetFieldSnapY() &&
1015 IsUseGridSnap() == rOpt
.IsUseGridSnap() &&
1016 IsSynchronize() == rOpt
.IsSynchronize() &&
1017 IsGridVisible() == rOpt
.IsGridVisible() &&
1018 IsEqualGrid() == rOpt
.IsEqualGrid() );
1021 void SdOptionsGrid::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
1023 if( isMetricSystem() )
1025 static const char* aPropNamesMetric
[] =
1027 "Resolution/XAxis/Metric",
1028 "Resolution/YAxis/Metric",
1029 "Subdivision/XAxis",
1030 "Subdivision/YAxis",
1031 "SnapGrid/XAxis/Metric",
1032 "SnapGrid/YAxis/Metric",
1033 "Option/SnapToGrid",
1034 "Option/Synchronize",
1035 "Option/VisibleGrid",
1038 ppNames
= aPropNamesMetric
;
1039 rCount
= SAL_N_ELEMENTS(aPropNamesMetric
);
1043 static const char* aPropNamesNonMetric
[] =
1045 "Resolution/XAxis/NonMetric",
1046 "Resolution/YAxis/NonMetric",
1047 "Subdivision/XAxis",
1048 "Subdivision/YAxis",
1049 "SnapGrid/XAxis/NonMetric",
1050 "SnapGrid/YAxis/NonMetric",
1051 "Option/SnapToGrid",
1052 "Option/Synchronize",
1053 "Option/VisibleGrid",
1056 ppNames
= aPropNamesNonMetric
;
1057 rCount
= SAL_N_ELEMENTS(aPropNamesNonMetric
);
1061 bool SdOptionsGrid::ReadData( const Any
* pValues
)
1063 if( pValues
[0].hasValue() ) SetFieldDrawX( *static_cast<sal_Int32
const *>(pValues
[ 0 ].getValue()) );
1064 if( pValues
[1].hasValue() ) SetFieldDrawY( *static_cast<sal_Int32
const *>(pValues
[ 1 ].getValue()) );
1066 if( pValues
[2].hasValue() )
1068 const sal_uInt32 nDivX
= FRound( *static_cast<double const *>(pValues
[ 2 ].getValue()) );
1069 SetFieldDivisionX( SvxOptionsGrid::GetFieldDrawX() / ( nDivX
+ 1 ) );
1072 if( pValues
[3].hasValue() )
1074 const sal_uInt32 nDivY
= FRound( *static_cast<double const *>(pValues
[ 3 ].getValue()) );
1075 SetFieldDivisionY( SvxOptionsGrid::GetFieldDrawY() / ( nDivY
+ 1 ) );
1078 if( pValues
[4].hasValue() ) SetFieldSnapX( *static_cast<sal_Int32
const *>(pValues
[ 4 ].getValue()) );
1079 if( pValues
[5].hasValue() ) SetFieldSnapY( *static_cast<sal_Int32
const *>(pValues
[ 5 ].getValue()) );
1080 if( pValues
[6].hasValue() ) SetUseGridSnap( *static_cast<sal_Bool
const *>(pValues
[ 6 ].getValue()) );
1081 if( pValues
[7].hasValue() ) SetSynchronize( *static_cast<sal_Bool
const *>(pValues
[ 7 ].getValue()) );
1082 if( pValues
[8].hasValue() ) SetGridVisible( *static_cast<sal_Bool
const *>(pValues
[ 8 ].getValue()) );
1083 if( pValues
[9].hasValue() ) SetEqualGrid( *static_cast<sal_Bool
const *>(pValues
[ 9 ].getValue()) );
1088 bool SdOptionsGrid::WriteData( Any
* pValues
) const
1090 pValues
[ 0 ] <<= (sal_Int32
) GetFieldDrawX();
1091 pValues
[ 1 ] <<= (sal_Int32
) GetFieldDrawY();
1092 pValues
[ 2 ] <<= ( GetFieldDivisionX() ? ( (double) GetFieldDrawX() / GetFieldDivisionX() - 1.0 ) : (double) 0 );
1093 pValues
[ 3 ] <<= ( GetFieldDivisionY() ? ( (double) GetFieldDrawY() / GetFieldDivisionY() - 1.0 ) : (double) 0 );
1094 pValues
[ 4 ] <<= (sal_Int32
) GetFieldSnapX();
1095 pValues
[ 5 ] <<= (sal_Int32
) GetFieldSnapY();
1096 pValues
[ 6 ] <<= IsUseGridSnap();
1097 pValues
[ 7 ] <<= IsSynchronize();
1098 pValues
[ 8 ] <<= IsGridVisible();
1099 pValues
[ 9 ] <<= IsEqualGrid();
1104 /*************************************************************************
1106 |* SdOptionsGridItem
1108 \************************************************************************/
1110 SdOptionsGridItem::SdOptionsGridItem( sal_uInt16 _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
) :
1111 SvxGridItem( _nWhich
)
1113 SetSynchronize( pOpts
->IsSynchronize() );
1114 SetEqualGrid( pOpts
->IsEqualGrid() );
1118 SetFieldDrawX( pView
->GetGridCoarse().Width() );
1119 SetFieldDrawY( pView
->GetGridCoarse().Height() );
1120 SetFieldDivisionX( pView
->GetGridFine().Width() ? ( GetFieldDrawX() / pView
->GetGridFine().Width() - 1 ) : 0 );
1121 SetFieldDivisionY( pView
->GetGridFine().Height() ? ( GetFieldDrawY() / pView
->GetGridFine().Height() - 1 ) : 0 );
1122 SetFieldSnapX( long(pView
->GetSnapGridWidthX()) );
1123 SetFieldSnapY( long(pView
->GetSnapGridWidthY()) );
1124 SetUseGridSnap( pView
->IsGridSnap() );
1125 SetGridVisible( pView
->IsGridVisible() );
1129 SetFieldDrawX( pOpts
->GetFieldDrawX() );
1130 SetFieldDrawY( pOpts
->GetFieldDrawY() );
1131 SetFieldDivisionX( pOpts
->GetFieldDivisionX() ? ( pOpts
->GetFieldDrawX() / pOpts
->GetFieldDivisionX() - 1 ) : 0 );
1132 SetFieldDivisionY( pOpts
->GetFieldDivisionY() ? ( pOpts
->GetFieldDrawY() / pOpts
->GetFieldDivisionY() - 1 ) : 0 );
1133 SetFieldSnapX( pOpts
->GetFieldSnapX() );
1134 SetFieldSnapY( pOpts
->GetFieldSnapY() );
1135 SetUseGridSnap( pOpts
->IsUseGridSnap() );
1136 SetGridVisible( pOpts
->IsGridVisible() );
1140 void SdOptionsGridItem::SetOptions( SdOptions
* pOpts
) const
1142 pOpts
->SetFieldDrawX( GetFieldDrawX() );
1143 pOpts
->SetFieldDivisionX( GetFieldDrawX() / ( GetFieldDivisionX() + 1 ) );
1144 pOpts
->SetFieldDrawY( GetFieldDrawY() );
1145 pOpts
->SetFieldDivisionY( GetFieldDrawY() / ( GetFieldDivisionY() + 1 ) );
1146 pOpts
->SetFieldSnapX( GetFieldSnapX() );
1147 pOpts
->SetFieldSnapY( GetFieldSnapY() );
1148 pOpts
->SetUseGridSnap( GetUseGridSnap() );
1149 pOpts
->SetSynchronize( GetSynchronize() );
1150 pOpts
->SetGridVisible( GetGridVisible() );
1151 pOpts
->SetEqualGrid( GetEqualGrid() );
1154 /*************************************************************************
1158 \************************************************************************/
1160 SdOptionsPrint::SdOptionsPrint( sal_uInt16 nConfigId
, bool bUseConfig
) :
1161 SdOptionsGeneric( nConfigId
, bUseConfig
?
1162 ( ( SDCFG_DRAW
== nConfigId
) ?
1163 OUString( "Office.Draw/Print" ) :
1164 OUString( "Office.Impress/Print" ) ) :
1173 bHiddenPages( true ),
1176 bWarningPrinter( true ),
1177 bWarningSize( false ),
1178 bWarningOrientation( false ),
1184 mbHandoutHorizontal( true ),
1185 mnHandoutPages( 6 ),
1188 EnableModify( true );
1191 bool SdOptionsPrint::operator==( const SdOptionsPrint
& rOpt
) const
1193 return( IsDraw() == rOpt
.IsDraw() &&
1194 IsNotes() == rOpt
.IsNotes() &&
1195 IsHandout() == rOpt
.IsHandout() &&
1196 IsOutline() == rOpt
.IsOutline() &&
1197 IsDate() == rOpt
.IsDate() &&
1198 IsTime() == rOpt
.IsTime() &&
1199 IsPagename() == rOpt
.IsPagename() &&
1200 IsHiddenPages() == rOpt
.IsHiddenPages() &&
1201 IsPagesize() == rOpt
.IsPagesize() &&
1202 IsPagetile() == rOpt
.IsPagetile() &&
1203 IsWarningPrinter() == rOpt
.IsWarningPrinter() &&
1204 IsWarningSize() == rOpt
.IsWarningSize() &&
1205 IsWarningOrientation() == rOpt
.IsWarningOrientation() &&
1206 IsBooklet() == rOpt
.IsBooklet() &&
1207 IsFrontPage() == rOpt
.IsFrontPage() &&
1208 IsBackPage() == rOpt
.IsBackPage() &&
1209 IsCutPage() == rOpt
.IsCutPage() &&
1210 IsPaperbin() == rOpt
.IsPaperbin() &&
1211 GetOutputQuality() == rOpt
.GetOutputQuality() &&
1212 IsHandoutHorizontal() == rOpt
.IsHandoutHorizontal() &&
1213 GetHandoutPages() == rOpt
.GetHandoutPages() );
1216 void SdOptionsPrint::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
1218 if( GetConfigId() == SDCFG_IMPRESS
)
1220 static const char* aImpressPropNames
[] =
1230 // bWarningOrientation
1232 "Page/BookletFront",
1235 "Other/FromPrinterSetup",
1237 "Content/Presentation",
1241 "Other/HandoutHorizontal",
1242 "Other/PagesPerHandout"
1244 rCount
= SAL_N_ELEMENTS(aImpressPropNames
);
1245 ppNames
= aImpressPropNames
;
1249 static const char* aDrawPropNames
[] =
1259 // bWarningOrientation
1261 "Page/BookletFront",
1264 "Other/FromPrinterSetup",
1268 rCount
= SAL_N_ELEMENTS(aDrawPropNames
);
1269 ppNames
= aDrawPropNames
;
1273 bool SdOptionsPrint::ReadData( const Any
* pValues
)
1275 if( pValues
[0].hasValue() ) SetDate( *static_cast<sal_Bool
const *>(pValues
[ 0 ].getValue()) );
1276 if( pValues
[1].hasValue() ) SetTime( *static_cast<sal_Bool
const *>(pValues
[ 1 ].getValue()) );
1277 if( pValues
[2].hasValue() ) SetPagename( *static_cast<sal_Bool
const *>(pValues
[ 2 ].getValue()) );
1278 if( pValues
[3].hasValue() ) SetHiddenPages( *static_cast<sal_Bool
const *>(pValues
[ 3 ].getValue()) );
1279 if( pValues
[4].hasValue() ) SetPagesize( *static_cast<sal_Bool
const *>(pValues
[ 4 ].getValue()) );
1280 if( pValues
[5].hasValue() ) SetPagetile( *static_cast<sal_Bool
const *>(pValues
[ 5 ].getValue()) );
1281 if( pValues
[6].hasValue() ) SetBooklet( *static_cast<sal_Bool
const *>(pValues
[ 6 ].getValue()) );
1282 if( pValues
[7].hasValue() ) SetFrontPage( *static_cast<sal_Bool
const *>(pValues
[ 7 ].getValue()) );
1283 if( pValues
[8].hasValue() ) SetBackPage( *static_cast<sal_Bool
const *>(pValues
[ 8 ].getValue()) );
1284 if( pValues
[9].hasValue() ) SetPaperbin( *static_cast<sal_Bool
const *>(pValues
[ 9 ].getValue()) );
1285 if( pValues
[10].hasValue() ) SetOutputQuality( (sal_uInt16
) *static_cast<sal_Int32
const *>(pValues
[ 10 ].getValue()) );
1286 if( pValues
[11].hasValue() ) SetDraw( *static_cast<sal_Bool
const *>(pValues
[ 11 ].getValue()) );
1289 if( GetConfigId() == SDCFG_IMPRESS
)
1291 if( pValues
[12].hasValue() ) SetNotes( *static_cast<sal_Bool
const *>(pValues
[ 12 ].getValue()) );
1292 if( pValues
[13].hasValue() ) SetHandout( *static_cast<sal_Bool
const *>(pValues
[ 13 ].getValue()) );
1293 if( pValues
[14].hasValue() ) SetOutline( *static_cast<sal_Bool
const *>(pValues
[ 14 ].getValue()) );
1294 if( pValues
[15].hasValue() ) SetHandoutHorizontal( *static_cast<sal_Bool
const *>(pValues
[15].getValue()) );
1295 if( pValues
[16].hasValue() ) SetHandoutPages( (sal_uInt16
)*static_cast<sal_Int32
const *>(pValues
[16].getValue()) );
1301 bool SdOptionsPrint::WriteData( Any
* pValues
) const
1303 pValues
[ 0 ] <<= IsDate();
1304 pValues
[ 1 ] <<= IsTime();
1305 pValues
[ 2 ] <<= IsPagename();
1306 pValues
[ 3 ] <<= IsHiddenPages();
1307 pValues
[ 4 ] <<= IsPagesize();
1308 pValues
[ 5 ] <<= IsPagetile();
1309 pValues
[ 6 ] <<= IsBooklet();
1310 pValues
[ 7 ] <<= IsFrontPage();
1311 pValues
[ 8 ] <<= IsBackPage();
1312 pValues
[ 9 ] <<= IsPaperbin();
1313 pValues
[ 10 ] <<= (sal_Int32
) GetOutputQuality();
1314 pValues
[ 11 ] <<= IsDraw();
1317 if( GetConfigId() == SDCFG_IMPRESS
)
1319 pValues
[ 12 ] <<= IsNotes();
1320 pValues
[ 13 ] <<= IsHandout();
1321 pValues
[ 14 ] <<= IsOutline();
1322 pValues
[ 15 ] <<= IsHandoutHorizontal();
1323 pValues
[ 16 ] <<= GetHandoutPages();
1329 /*************************************************************************
1331 |* SdOptionsPrintItem
1333 \************************************************************************/
1335 SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich
)
1336 : SfxPoolItem ( _nWhich
)
1337 , maOptionsPrint ( 0, false )
1341 SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* )
1342 : SfxPoolItem ( _nWhich
)
1343 , maOptionsPrint ( 0, false )
1347 maOptionsPrint
.SetDraw( pOpts
->IsDraw() );
1348 maOptionsPrint
.SetNotes( pOpts
->IsNotes() );
1349 maOptionsPrint
.SetHandout( pOpts
->IsHandout() );
1350 maOptionsPrint
.SetOutline( pOpts
->IsOutline() );
1351 maOptionsPrint
.SetDate( pOpts
->IsDate() );
1352 maOptionsPrint
.SetTime( pOpts
->IsTime() );
1353 maOptionsPrint
.SetPagename( pOpts
->IsPagename() );
1354 maOptionsPrint
.SetHiddenPages( pOpts
->IsHiddenPages() );
1355 maOptionsPrint
.SetPagesize( pOpts
->IsPagesize() );
1356 maOptionsPrint
.SetPagetile( pOpts
->IsPagetile() );
1357 maOptionsPrint
.SetWarningPrinter( pOpts
->IsWarningPrinter() );
1358 maOptionsPrint
.SetWarningSize( pOpts
->IsWarningSize() );
1359 maOptionsPrint
.SetWarningOrientation( pOpts
->IsWarningOrientation() );
1360 maOptionsPrint
.SetBooklet( pOpts
->IsBooklet() );
1361 maOptionsPrint
.SetFrontPage( pOpts
->IsFrontPage() );
1362 maOptionsPrint
.SetBackPage( pOpts
->IsBackPage() );
1363 maOptionsPrint
.SetCutPage( pOpts
->IsCutPage() );
1364 maOptionsPrint
.SetPaperbin( pOpts
->IsPaperbin() );
1365 maOptionsPrint
.SetOutputQuality( pOpts
->GetOutputQuality() );
1369 SfxPoolItem
* SdOptionsPrintItem::Clone( SfxItemPool
* ) const
1371 return new SdOptionsPrintItem( *this );
1374 bool SdOptionsPrintItem::operator==( const SfxPoolItem
& rAttr
) const
1376 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
1377 DBG_ASSERT( bSameType
, "SdOptionsPrintItem::operator==(), different pool item type!" );
1378 return bSameType
&& ( maOptionsPrint
== static_cast< const SdOptionsPrintItem
& >( rAttr
).maOptionsPrint
);
1381 void SdOptionsPrintItem::SetOptions( SdOptions
* pOpts
) const
1385 pOpts
->SetDraw( maOptionsPrint
.IsDraw() );
1386 pOpts
->SetNotes( maOptionsPrint
.IsNotes() );
1387 pOpts
->SetHandout( maOptionsPrint
.IsHandout() );
1388 pOpts
->SetOutline( maOptionsPrint
.IsOutline() );
1389 pOpts
->SetDate( maOptionsPrint
.IsDate() );
1390 pOpts
->SetTime( maOptionsPrint
.IsTime() );
1391 pOpts
->SetPagename( maOptionsPrint
.IsPagename() );
1392 pOpts
->SetHiddenPages( maOptionsPrint
.IsHiddenPages() );
1393 pOpts
->SetPagesize( maOptionsPrint
.IsPagesize() );
1394 pOpts
->SetPagetile( maOptionsPrint
.IsPagetile() );
1395 pOpts
->SetWarningPrinter( maOptionsPrint
.IsWarningPrinter() );
1396 pOpts
->SetWarningSize( maOptionsPrint
.IsWarningSize() );
1397 pOpts
->SetWarningOrientation( maOptionsPrint
.IsWarningOrientation() );
1398 pOpts
->SetBooklet( maOptionsPrint
.IsBooklet() );
1399 pOpts
->SetFrontPage( maOptionsPrint
.IsFrontPage() );
1400 pOpts
->SetBackPage( maOptionsPrint
.IsBackPage() );
1401 pOpts
->SetCutPage( maOptionsPrint
.IsCutPage() );
1402 pOpts
->SetPaperbin( maOptionsPrint
.IsPaperbin() );
1403 pOpts
->SetOutputQuality( maOptionsPrint
.GetOutputQuality() );
1407 /*************************************************************************
1411 \************************************************************************/
1413 SdOptions::SdOptions( sal_uInt16 nConfigId
) :
1414 SdOptionsLayout( nConfigId
, true ),
1415 SdOptionsContents( nConfigId
, true ),
1416 SdOptionsMisc( nConfigId
, true ),
1417 SdOptionsSnap( nConfigId
, true ),
1418 SdOptionsZoom( nConfigId
, true ),
1419 SdOptionsGrid( nConfigId
, true ),
1420 SdOptionsPrint( nConfigId
, true )
1424 SdOptions::~SdOptions()
1428 void SdOptions::StoreConfig( sal_uLong nOptionsRange
)
1430 if( nOptionsRange
& SD_OPTIONS_LAYOUT
)
1431 SdOptionsLayout::Store();
1433 if( nOptionsRange
& SD_OPTIONS_CONTENTS
)
1434 SdOptionsContents::Store();
1436 if( nOptionsRange
& SD_OPTIONS_MISC
)
1437 SdOptionsMisc::Store();
1439 if( nOptionsRange
& SD_OPTIONS_SNAP
)
1440 SdOptionsSnap::Store();
1442 if( nOptionsRange
& SD_OPTIONS_ZOOM
)
1443 SdOptionsZoom::Store();
1445 if( nOptionsRange
& SD_OPTIONS_GRID
)
1446 SdOptionsGrid::Store();
1448 if( nOptionsRange
& SD_OPTIONS_PRINT
)
1449 SdOptionsPrint::Store();
1452 sal_Int32
SdOptionsMisc::GetDisplay() const
1458 void SdOptionsMisc::SetDisplay( sal_Int32 nDisplay
)
1460 if( mnDisplay
!= nDisplay
)
1463 mnDisplay
= nDisplay
;
1467 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */