1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: optsitem.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
33 #include <svx/svdmodel.hxx>
34 #include <sfx2/app.hxx>
35 #include <sfx2/sfx.hrc>
36 #ifndef _SV_SALBTYPE_HRC //autogen
37 #include <vcl/salbtype.hxx>
39 #include <svtools/syslocale.hxx>
42 #include "optsitem.hxx"
44 #include "FrameView.hxx"
46 using namespace ::rtl
;
47 using namespace ::utl
;
48 using namespace ::com::sun::star::uno
;
50 #define B2U(_def_aStr) (OUString::createFromAscii(_def_aStr))
57 SdOptionsItem::SdOptionsItem( const SdOptionsGeneric
& rParent
, const OUString rSubTree
) :
58 ConfigItem ( rSubTree
),
63 // -----------------------------------------------------------------------------
65 SdOptionsItem::~SdOptionsItem()
69 // -----------------------------------------------------------------------------
71 void SdOptionsItem::Commit()
74 mrParent
.Commit( *this );
77 // -----------------------------------------------------------------------------
79 Sequence
< Any
> SdOptionsItem::GetProperties( const Sequence
< OUString
>& rNames
)
81 return ConfigItem::GetProperties( rNames
);
84 // -----------------------------------------------------------------------------
86 sal_Bool
SdOptionsItem::PutProperties( const Sequence
< OUString
>& rNames
, const Sequence
< Any
>& rValues
)
88 return ConfigItem::PutProperties( rNames
, rValues
);
91 // -----------------------------------------------------------------------------
93 void SdOptionsItem::SetModified()
95 ConfigItem::SetModified();
98 // --------------------
99 // - SdOptionsGeneric -
100 // --------------------
102 SdOptionsGeneric::SdOptionsGeneric( USHORT nConfigId
, const OUString
& rSubTree
) :
103 maSubTree ( rSubTree
),
105 mnConfigId ( nConfigId
),
106 mbInit ( rSubTree
.getLength() == 0 )
110 // -----------------------------------------------------------------------------
112 void SdOptionsGeneric::Init() const
116 SdOptionsGeneric
* pThis
= const_cast<SdOptionsGeneric
*>(this);
119 pThis
->mpCfgItem
= new SdOptionsItem( *this, maSubTree
);
121 const Sequence
< OUString
> aNames( GetPropertyNames() );
122 const Sequence
< Any
> aValues
= mpCfgItem
->GetProperties( aNames
);
124 if( aNames
.getLength() && ( aValues
.getLength() == aNames
.getLength() ) )
126 const Any
* pValues
= aValues
.getConstArray();
128 pThis
->EnableModify( FALSE
);
129 pThis
->mbInit
= pThis
->ReadData( pValues
);
130 pThis
->EnableModify( TRUE
);
133 pThis
->mbInit
= TRUE
;
137 // -----------------------------------------------------------------------------
139 SdOptionsGeneric::~SdOptionsGeneric()
145 // -----------------------------------------------------------------------------
147 void SdOptionsGeneric::Commit( SdOptionsItem
& rCfgItem
) const
149 const Sequence
< OUString
> aNames( GetPropertyNames() );
150 Sequence
< Any
> aValues( aNames
.getLength() );
152 if( aNames
.getLength() && ( aValues
.getLength() == aNames
.getLength() ) )
154 if( (const_cast<SdOptionsGeneric
*>(this))->WriteData( aValues
.getArray() ) )
155 rCfgItem
.PutProperties( aNames
, aValues
);
158 DBG_ERROR( "PutProperties failed" );
163 // -----------------------------------------------------------------------------
165 Sequence
< OUString
> SdOptionsGeneric::GetPropertyNames() const
168 const char** ppPropNames
;
170 GetPropNameArray( ppPropNames
, nCount
);
172 Sequence
< OUString
> aNames( nCount
);
173 OUString
* pNames
= aNames
.getArray();
175 for( ULONG i
= 0; i
< nCount
; i
++ )
176 pNames
[ i
] = OUString::createFromAscii( ppPropNames
[ i
] );
181 // -----------------------------------------------------------------------------
183 void SdOptionsGeneric::Store()
189 // -----------------------------------------------------------------------------
191 bool SdOptionsGeneric::isMetricSystem()
193 SvtSysLocale aSysLocale
;
194 MeasurementSystem eSys
= aSysLocale
.GetLocaleDataPtr()->getMeasurementSystemEnum();
196 return ( eSys
== MEASURE_METRIC
);
199 /*************************************************************************
203 \************************************************************************/
205 SdOptionsLayout::SdOptionsLayout( USHORT nConfigId
, BOOL bUseConfig
) :
206 SdOptionsGeneric( nConfigId
, bUseConfig
?
207 ( ( SDCFG_DRAW
== nConfigId
) ?
208 B2U( "Office.Draw/Layout" ) :
209 B2U( "Office.Impress/Layout" ) ) :
212 bMoveOutline( TRUE
),
213 bDragStripes( FALSE
),
214 bHandlesBezier( FALSE
),
216 nMetric((UINT16
)(isMetricSystem() ? FUNIT_CM
: FUNIT_INCH
)),
219 EnableModify( TRUE
);
222 // -----------------------------------------------------------------------------
224 void SdOptionsLayout::SetDefaults()
226 SetRulerVisible( TRUE
);
227 SetHelplines( TRUE
);
228 SetHandlesBezier( FALSE
);
229 SetMoveOutline( TRUE
);
230 SetDragStripes( FALSE
);
231 if ( isMetricSystem() )
232 SetMetric( FUNIT_CM
); // default for countries with metric system
234 SetMetric( FUNIT_INCH
); // default for others
238 // -----------------------------------------------------------------------------
240 BOOL
SdOptionsLayout::operator==( const SdOptionsLayout
& rOpt
) const
242 return( IsRulerVisible() == rOpt
.IsRulerVisible() &&
243 IsMoveOutline() == rOpt
.IsMoveOutline() &&
244 IsDragStripes() == rOpt
.IsDragStripes() &&
245 IsHandlesBezier() == rOpt
.IsHandlesBezier() &&
246 IsHelplines() == rOpt
.IsHelplines() &&
247 GetMetric() == rOpt
.GetMetric() &&
248 GetDefTab() == rOpt
.GetDefTab() );
251 // -----------------------------------------------------------------------------
253 void SdOptionsLayout::GetPropNameArray( const char**& ppNames
, ULONG
& rCount
) const
255 static const char* aPropNamesMetric
[] =
262 "Other/MeasureUnit/Metric",
263 "Other/TabStop/Metric"
266 static const char* aPropNamesNonMetric
[] =
273 "Other/MeasureUnit/NonMetric",
274 "Other/TabStop/NonMetric"
279 if( isMetricSystem() )
280 ppNames
= aPropNamesMetric
;
282 ppNames
= aPropNamesNonMetric
;
285 // -----------------------------------------------------------------------------
287 BOOL
SdOptionsLayout::ReadData( const Any
* pValues
)
289 if( pValues
[0].hasValue() ) SetRulerVisible( *(sal_Bool
*) pValues
[ 0 ].getValue() );
290 if( pValues
[1].hasValue() ) SetHandlesBezier( *(sal_Bool
*) pValues
[ 1 ].getValue() );
291 if( pValues
[2].hasValue() ) SetMoveOutline( *(sal_Bool
*) pValues
[ 2 ].getValue() );
292 if( pValues
[3].hasValue() ) SetDragStripes( *(sal_Bool
*) pValues
[ 3 ].getValue() );
293 if( pValues
[4].hasValue() ) SetHelplines( *(sal_Bool
*) pValues
[ 4 ].getValue() );
294 if( pValues
[5].hasValue() ) SetMetric( (UINT16
) *(sal_Int32
*) pValues
[ 5 ].getValue() );
295 if( pValues
[6].hasValue() ) SetDefTab( (UINT16
) *(sal_Int32
*) pValues
[ 6 ].getValue() );
300 // -----------------------------------------------------------------------------
302 BOOL
SdOptionsLayout::WriteData( Any
* pValues
) const
304 pValues
[ 0 ] <<= IsRulerVisible();
305 pValues
[ 1 ] <<= IsHandlesBezier();
306 pValues
[ 2 ] <<= IsMoveOutline();
307 pValues
[ 3 ] <<= IsDragStripes();
308 pValues
[ 4 ] <<= IsHelplines();
309 pValues
[ 5 ] <<= (sal_Int32
) GetMetric();
310 pValues
[ 6 ] <<= (sal_Int32
) GetDefTab();
315 /*************************************************************************
317 |* SdOptionsLayoutItem
319 \************************************************************************/
321 SdOptionsLayoutItem::SdOptionsLayoutItem( USHORT _nWhich
)
322 : SfxPoolItem ( _nWhich
)
323 , maOptionsLayout ( 0, FALSE
)
327 // ----------------------------------------------------------------------
329 SdOptionsLayoutItem::SdOptionsLayoutItem( USHORT _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
)
330 : SfxPoolItem ( _nWhich
)
331 , maOptionsLayout ( 0, FALSE
)
335 maOptionsLayout
.SetMetric( pOpts
->GetMetric() );
336 maOptionsLayout
.SetDefTab( pOpts
->GetDefTab() );
341 maOptionsLayout
.SetRulerVisible( pView
->HasRuler() );
342 maOptionsLayout
.SetMoveOutline( !pView
->IsNoDragXorPolys() );
343 maOptionsLayout
.SetDragStripes( pView
->IsDragStripes() );
344 maOptionsLayout
.SetHandlesBezier( pView
->IsPlusHandlesAlwaysVisible() );
345 maOptionsLayout
.SetHelplines( pView
->IsHlplVisible() );
349 maOptionsLayout
.SetRulerVisible( pOpts
->IsRulerVisible() );
350 maOptionsLayout
.SetMoveOutline( pOpts
->IsMoveOutline() );
351 maOptionsLayout
.SetDragStripes( pOpts
->IsDragStripes() );
352 maOptionsLayout
.SetHandlesBezier( pOpts
->IsHandlesBezier() );
353 maOptionsLayout
.SetHelplines( pOpts
->IsHelplines() );
357 // ----------------------------------------------------------------------
359 SfxPoolItem
* SdOptionsLayoutItem::Clone( SfxItemPool
* ) const
361 return new SdOptionsLayoutItem( *this );
365 // ----------------------------------------------------------------------
367 int SdOptionsLayoutItem::operator==( const SfxPoolItem
& rAttr
) const
369 const bool bSameType
= SfxPoolItem::operator==( rAttr
);
370 DBG_ASSERT( bSameType
, "SdOptionsLayoutItem::operator==(), differen pool item type!" );
371 return bSameType
&& ( maOptionsLayout
== static_cast< const SdOptionsLayoutItem
& >( rAttr
).maOptionsLayout
);
374 // -----------------------------------------------------------------------
376 void SdOptionsLayoutItem::SetOptions( SdOptions
* pOpts
) const
380 pOpts
->SetRulerVisible( maOptionsLayout
.IsRulerVisible() );
381 pOpts
->SetMoveOutline( maOptionsLayout
.IsMoveOutline() );
382 pOpts
->SetDragStripes( maOptionsLayout
.IsDragStripes() );
383 pOpts
->SetHandlesBezier( maOptionsLayout
.IsHandlesBezier() );
384 pOpts
->SetHelplines( maOptionsLayout
.IsHelplines() );
385 pOpts
->SetMetric( maOptionsLayout
.GetMetric() );
386 pOpts
->SetDefTab( maOptionsLayout
.GetDefTab() );
390 /*************************************************************************
394 \************************************************************************/
396 SdOptionsContents::SdOptionsContents( USHORT nConfigId
, BOOL bUseConfig
) :
397 SdOptionsGeneric( nConfigId
, bUseConfig
?
398 ( ( SDCFG_DRAW
== nConfigId
) ?
399 B2U( "Office.Draw/Content" ) :
400 B2U( "Office.Impress/Content" ) ) :
403 EnableModify( TRUE
);
406 // -----------------------------------------------------------------------------
408 void SdOptionsContents::SetDefaults()
412 // -----------------------------------------------------------------------------
414 BOOL
SdOptionsContents::operator==(const SdOptionsContents
&) const
419 // -----------------------------------------------------------------------------
421 void SdOptionsContents::GetPropNameArray( const char**& ppNames
, ULONG
& rCount
) const
423 static const char* aPropNames
[] =
425 "Display/PicturePlaceholder",
426 "Display/ContourMode",
427 "Display/LineContour",
428 "Display/TextPlaceholder"
432 ppNames
= aPropNames
;
435 // -----------------------------------------------------------------------------
437 BOOL
SdOptionsContents::ReadData(const Any
*)
442 // -----------------------------------------------------------------------------
444 BOOL
SdOptionsContents::WriteData( Any
* pValues
) const
446 //#i80528# no draft anymore
447 pValues
[ 0 ] <<= (BOOL
)false;
448 pValues
[ 1 ] <<= (BOOL
)false;
449 pValues
[ 2 ] <<= (BOOL
)false;
450 pValues
[ 3 ] <<= (BOOL
)false;
455 /*************************************************************************
457 |* SdOptionsContentsItem
459 \************************************************************************/
461 SdOptionsContentsItem::SdOptionsContentsItem( USHORT _nWhich
)
462 : SfxPoolItem ( _nWhich
)
463 , maOptionsContents ( 0, FALSE
)
467 // ----------------------------------------------------------------------
469 SdOptionsContentsItem::SdOptionsContentsItem(USHORT _nWhich
, SdOptions
*, ::sd::FrameView
*)
470 : SfxPoolItem ( _nWhich
)
471 , maOptionsContents ( 0, FALSE
)
475 // ----------------------------------------------------------------------
477 SfxPoolItem
* SdOptionsContentsItem::Clone( SfxItemPool
* ) const
479 return new SdOptionsContentsItem( *this );
482 // ----------------------------------------------------------------------
484 int SdOptionsContentsItem::operator==( const SfxPoolItem
& rAttr
) const
486 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
487 DBG_ASSERT( bSameType
, "SdOptionsContentsItem::operator==(), differen pool item type!" );
488 return bSameType
&& ( maOptionsContents
== static_cast<const SdOptionsContentsItem
&>( rAttr
).maOptionsContents
);
491 // -----------------------------------------------------------------------
493 void SdOptionsContentsItem::SetOptions(SdOptions
*) const
497 /*************************************************************************
501 \************************************************************************/
503 SdOptionsMisc::SdOptionsMisc( USHORT nConfigId
, BOOL bUseConfig
) :
504 SdOptionsGeneric( nConfigId
, bUseConfig
?
505 ( ( SDCFG_DRAW
== nConfigId
) ?
506 B2U( "Office.Draw/Misc" ) :
507 B2U( "Office.Impress/Misc" ) ) :
510 nDefaultObjectSizeWidth(8000),
511 nDefaultObjectSizeHeight(5000),
512 bStartWithTemplate( TRUE
),
513 bMarkedHitMovesAlways( TRUE
),
514 bMoveOnlyDragging( FALSE
),
515 bCrookNoContortion( FALSE
),
516 bQuickEdit( GetConfigId() != SDCFG_DRAW
),
517 bMasterPageCache( TRUE
),
518 bDragWithCopy( FALSE
),
519 bPickThrough( TRUE
),
520 bBigHandles( FALSE
),
521 bDoubleClickTextEdit( TRUE
),
522 bClickChangeRotation( FALSE
),
523 bStartWithActualPage( FALSE
),
524 bSolidDragging( TRUE
),
525 bSolidMarkHdl( TRUE
),
526 bSummationOfParagraphs( FALSE
),
528 bShowUndoDeleteWarning( TRUE
),
529 bSlideshowRespectZOrder( TRUE
),
530 bShowComments( TRUE
),
531 bPreviewNewEffects( TRUE
),
532 bPreviewChangedEffects( FALSE
),
533 bPreviewTransitions( TRUE
),
535 // The default for 6.1-and-above documents is to use printer-independent
537 mnPrinterIndependentLayout (1)
539 EnableModify( TRUE
);
542 // -----------------------------------------------------------------------------
544 void SdOptionsMisc::SetDefaults()
546 SetStartWithTemplate( TRUE
);
547 SetMarkedHitMovesAlways( TRUE
);
548 SetMoveOnlyDragging( FALSE
);
549 SetCrookNoContortion( FALSE
);
550 SetQuickEdit( GetConfigId() != SDCFG_DRAW
);
551 SetMasterPagePaintCaching( TRUE
);
552 SetDragWithCopy( FALSE
);
553 SetPickThrough( TRUE
);
554 SetBigHandles( FALSE
);
555 SetDoubleClickTextEdit( TRUE
);
556 SetClickChangeRotation( FALSE
);
557 SetStartWithActualPage( FALSE
);
558 SetSummationOfParagraphs( FALSE
);
559 SetSolidDragging( TRUE
);
560 SetSolidMarkHdl( TRUE
);
562 SetShowUndoDeleteWarning( TRUE
);
563 // The default for 6.1-and-above documents is to use printer-independent
565 SetPrinterIndependentLayout (1);
567 SetDefaultObjectSizeWidth(8000);
568 SetDefaultObjectSizeHeight(5000);
569 SetPreviewNewEffects(true);
570 SetPreviewChangedEffects(false);
571 SetPreviewTransitions(true);
573 SetShowComments(true);
576 // -----------------------------------------------------------------------------
578 BOOL
SdOptionsMisc::operator==( const SdOptionsMisc
& rOpt
) const
580 return( IsStartWithTemplate() == rOpt
.IsStartWithTemplate() &&
581 IsMarkedHitMovesAlways() == rOpt
.IsMarkedHitMovesAlways() &&
582 IsMoveOnlyDragging() == rOpt
.IsMoveOnlyDragging() &&
583 IsCrookNoContortion() == rOpt
.IsCrookNoContortion() &&
584 IsQuickEdit() == rOpt
.IsQuickEdit() &&
585 IsMasterPagePaintCaching() == rOpt
.IsMasterPagePaintCaching() &&
586 IsDragWithCopy() == rOpt
.IsDragWithCopy() &&
587 IsPickThrough() == rOpt
.IsPickThrough() &&
588 IsBigHandles() == rOpt
.IsBigHandles() &&
589 IsDoubleClickTextEdit() == rOpt
.IsDoubleClickTextEdit() &&
590 IsClickChangeRotation() == rOpt
.IsClickChangeRotation() &&
591 IsStartWithActualPage() == rOpt
.IsStartWithActualPage() &&
592 IsSummationOfParagraphs() == rOpt
.IsSummationOfParagraphs() &&
593 IsSolidDragging() == rOpt
.IsSolidDragging() &&
594 IsSolidMarkHdl() == rOpt
.IsSolidMarkHdl() &&
596 IsShowUndoDeleteWarning() == rOpt
.IsShowUndoDeleteWarning() &&
597 IsSlideshowRespectZOrder() == rOpt
.IsSlideshowRespectZOrder() &&
598 GetPrinterIndependentLayout() == rOpt
.GetPrinterIndependentLayout() &&
600 GetDefaultObjectSizeWidth() == rOpt
.GetDefaultObjectSizeWidth() &&
601 GetDefaultObjectSizeHeight() == rOpt
.GetDefaultObjectSizeHeight() &&
603 IsPreviewNewEffects() == rOpt
.IsPreviewNewEffects() &&
604 IsPreviewChangedEffects() == rOpt
.IsPreviewChangedEffects() &&
605 IsPreviewTransitions() == rOpt
.IsPreviewTransitions() &&
606 GetDisplay() == rOpt
.GetDisplay() &&
607 IsShowComments() == rOpt
.IsShowComments()
611 // -----------------------------------------------------------------------------
613 void SdOptionsMisc::GetPropNameArray( const char**& ppNames
, ULONG
& rCount
) const
615 static const char* aPropNames
[] =
619 "TextObject/QuickEditing",
622 "TextObject/Selectable",
627 "ModifyWithAttributes",
630 "DefaultObjectSize/Width",
631 "DefaultObjectSize/Height",
633 "Compatibility/PrinterIndependentLayout",
640 "Compatibility/AddBetween",
642 "ShowUndoDeleteWarning",
643 "SlideshowRespectZOrder",
646 "PreviewChangedEffects",
647 "PreviewTransitions",
652 rCount
= ( ( GetConfigId() == SDCFG_IMPRESS
) ? 25 : 16 );
653 ppNames
= aPropNames
;
656 // -----------------------------------------------------------------------------
658 BOOL
SdOptionsMisc::ReadData( const Any
* pValues
)
660 if( pValues
[0].hasValue() ) SetMarkedHitMovesAlways( *(sal_Bool
*) pValues
[ 0 ].getValue() );
661 if( pValues
[1].hasValue() ) SetCrookNoContortion( *(sal_Bool
*) pValues
[ 1 ].getValue() );
662 if( pValues
[2].hasValue() ) SetQuickEdit( *(sal_Bool
*)pValues
[ 2 ].getValue() );
663 if( pValues
[3].hasValue() ) SetMasterPagePaintCaching( *(sal_Bool
*) pValues
[ 3 ].getValue() );
664 if( pValues
[4].hasValue() ) SetDragWithCopy( *(sal_Bool
*) pValues
[ 4 ].getValue() );
665 if( pValues
[5].hasValue() ) SetPickThrough( *(sal_Bool
*) pValues
[ 5 ].getValue() );
666 if( pValues
[6].hasValue() ) SetBigHandles( *(sal_Bool
*) pValues
[ 6 ].getValue() );
667 if( pValues
[7].hasValue() ) SetDoubleClickTextEdit( *(sal_Bool
*) pValues
[ 7 ].getValue() );
668 if( pValues
[8].hasValue() ) SetClickChangeRotation( *(sal_Bool
*) pValues
[ 8 ].getValue() );
669 // if( pValues[9].hasValue() ) SetPreviewQuality( FRound( *(double*) pValues[ 9 ].getValue() ) );
670 if( pValues
[10].hasValue() ) SetSolidDragging( *(sal_Bool
*) pValues
[ 10 ].getValue() );
671 if( pValues
[11].hasValue() ) SetSolidMarkHdl( *(sal_Bool
*) pValues
[ 11 ].getValue() );
673 if( pValues
[12].hasValue() ) SetDefaultObjectSizeWidth( *(sal_uInt32
*) pValues
[ 12 ].getValue() );
674 if( pValues
[13].hasValue() ) SetDefaultObjectSizeHeight( *(sal_uInt32
*) pValues
[ 13 ].getValue() );
675 if( pValues
[14].hasValue() ) SetPrinterIndependentLayout( *(sal_uInt16
*) pValues
[ 14 ].getValue() );
677 if( pValues
[15].hasValue() ) SetShowComments( *(sal_Bool
*) pValues
[ 11 ].getValue() );
680 if( GetConfigId() == SDCFG_IMPRESS
)
682 if( pValues
[16].hasValue() )
683 SetStartWithTemplate( *(sal_Bool
*) pValues
[ 16 ].getValue() );
684 if( pValues
[17].hasValue() )
685 SetStartWithActualPage( *(sal_Bool
*) pValues
[ 17 ].getValue() );
686 if( pValues
[18].hasValue() )
687 SetSummationOfParagraphs( *(sal_Bool
*) pValues
[ 18 ].getValue() );
689 if( pValues
[19].hasValue() )
690 SetShowUndoDeleteWarning( *(sal_Bool
*) pValues
[ 19 ].getValue() );
692 if( pValues
[20].hasValue() )
693 SetSlideshowRespectZOrder(*(sal_Bool
*) pValues
[ 20 ].getValue());
695 if( pValues
[21].hasValue() )
696 SetPreviewNewEffects(*(sal_Bool
*) pValues
[ 21 ].getValue());
698 if( pValues
[22].hasValue() )
699 SetPreviewChangedEffects(*(sal_Bool
*) pValues
[ 22 ].getValue());
701 if( pValues
[23].hasValue() )
702 SetPreviewTransitions(*(sal_Bool
*) pValues
[ 23 ].getValue());
704 if( pValues
[24].hasValue() )
705 SetDisplay(*(sal_Int32
*) pValues
[ 24 ].getValue());
711 // -----------------------------------------------------------------------------
713 BOOL
SdOptionsMisc::WriteData( Any
* pValues
) const
715 pValues
[ 0 ] <<= IsMarkedHitMovesAlways();
716 pValues
[ 1 ] <<= IsCrookNoContortion();
717 pValues
[ 2 ] <<= IsQuickEdit();
718 pValues
[ 3 ] <<= IsMasterPagePaintCaching();
719 pValues
[ 4 ] <<= IsDragWithCopy();
720 pValues
[ 5 ] <<= IsPickThrough();
721 pValues
[ 6 ] <<= IsBigHandles();
722 pValues
[ 7 ] <<= IsDoubleClickTextEdit();
723 pValues
[ 8 ] <<= IsClickChangeRotation();
724 // The preview is not supported anymore. Use a dummy value.
725 pValues
[ 9 ] <<= (double)0;// GetPreviewQuality();
726 pValues
[ 10 ] <<= IsSolidDragging();
727 pValues
[ 11 ] <<= IsSolidMarkHdl();
729 pValues
[ 12 ] <<= GetDefaultObjectSizeWidth();
730 pValues
[ 13 ] <<= GetDefaultObjectSizeHeight();
731 pValues
[ 14 ] <<= GetPrinterIndependentLayout();
732 pValues
[ 15 ] <<= (sal_Bool
)IsShowComments();
735 if( GetConfigId() == SDCFG_IMPRESS
)
737 pValues
[ 16 ] <<= IsStartWithTemplate();
738 pValues
[ 17 ] <<= IsStartWithActualPage();
739 pValues
[ 18 ] <<= IsSummationOfParagraphs();
741 pValues
[ 19 ] <<= IsShowUndoDeleteWarning();
742 pValues
[ 20 ] <<= IsSlideshowRespectZOrder();
744 pValues
[ 21 ] <<= IsPreviewNewEffects();
745 pValues
[ 22 ] <<= IsPreviewChangedEffects();
746 pValues
[ 23 ] <<= IsPreviewTransitions();
748 pValues
[ 24 ] <<= GetDisplay();
754 /*************************************************************************
758 \************************************************************************/
760 SdOptionsMiscItem::SdOptionsMiscItem( USHORT _nWhich
)
761 : SfxPoolItem ( _nWhich
)
762 , maOptionsMisc ( 0, FALSE
)
766 // ----------------------------------------------------------------------
768 SdOptionsMiscItem::SdOptionsMiscItem( USHORT _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
)
769 : SfxPoolItem ( _nWhich
)
770 , maOptionsMisc ( 0, FALSE
)
774 maOptionsMisc
.SetStartWithTemplate( pOpts
->IsStartWithTemplate() );
775 maOptionsMisc
.SetStartWithActualPage( pOpts
->IsStartWithActualPage() );
776 maOptionsMisc
.SetSummationOfParagraphs( pOpts
->IsSummationOfParagraphs() );
778 maOptionsMisc
.SetShowUndoDeleteWarning( pOpts
->IsShowUndoDeleteWarning() );
779 maOptionsMisc
.SetPrinterIndependentLayout( pOpts
->GetPrinterIndependentLayout() );
781 maOptionsMisc
.SetDefaultObjectSizeWidth( pOpts
->GetDefaultObjectSizeWidth() );
782 maOptionsMisc
.SetDefaultObjectSizeHeight( pOpts
->GetDefaultObjectSizeHeight() );
784 maOptionsMisc
.SetPreviewNewEffects(pOpts
->IsPreviewNewEffects());
785 maOptionsMisc
.SetPreviewChangedEffects(pOpts
->IsPreviewChangedEffects());
786 maOptionsMisc
.SetPreviewTransitions(pOpts
->IsPreviewTransitions());
788 maOptionsMisc
.SetDisplay(pOpts
->GetDisplay());
793 maOptionsMisc
.SetMarkedHitMovesAlways( pView
->IsMarkedHitMovesAlways() );
794 maOptionsMisc
.SetMoveOnlyDragging( pView
->IsMoveOnlyDragging() );
795 maOptionsMisc
.SetCrookNoContortion( pView
->IsCrookNoContortion() );
796 maOptionsMisc
.SetQuickEdit( pView
->IsQuickEdit() );
799 maOptionsMisc
.SetMasterPagePaintCaching( pView
->IsMasterPagePaintCaching() );
801 maOptionsMisc
.SetDragWithCopy( pView
->IsDragWithCopy() );
802 maOptionsMisc
.SetPickThrough( (BOOL
)pView
->GetModel()->IsPickThroughTransparentTextFrames() );
803 maOptionsMisc
.SetBigHandles( (BOOL
)pView
->IsBigHandles() );
804 maOptionsMisc
.SetDoubleClickTextEdit( pView
->IsDoubleClickTextEdit() );
805 maOptionsMisc
.SetClickChangeRotation( pView
->IsClickChangeRotation() );
806 maOptionsMisc
.SetSolidDragging( pView
->IsSolidDragging() );
807 maOptionsMisc
.SetSolidMarkHdl( pView
->IsSolidMarkHdl() );
811 maOptionsMisc
.SetMarkedHitMovesAlways( pOpts
->IsMarkedHitMovesAlways() );
812 maOptionsMisc
.SetMoveOnlyDragging( pOpts
->IsMoveOnlyDragging() );
813 maOptionsMisc
.SetCrookNoContortion( pOpts
->IsCrookNoContortion() );
814 maOptionsMisc
.SetQuickEdit( pOpts
->IsQuickEdit() );
815 maOptionsMisc
.SetMasterPagePaintCaching( pOpts
->IsMasterPagePaintCaching() );
816 maOptionsMisc
.SetDragWithCopy( pOpts
->IsDragWithCopy() );
817 maOptionsMisc
.SetPickThrough( pOpts
->IsPickThrough() );
818 maOptionsMisc
.SetBigHandles( pOpts
->IsBigHandles() );
819 maOptionsMisc
.SetDoubleClickTextEdit( pOpts
->IsDoubleClickTextEdit() );
820 maOptionsMisc
.SetClickChangeRotation( pOpts
->IsClickChangeRotation() );
821 maOptionsMisc
.SetSolidDragging( pOpts
->IsSolidDragging() );
822 maOptionsMisc
.SetSolidMarkHdl( pOpts
->IsSolidMarkHdl() );
826 // ----------------------------------------------------------------------
828 SfxPoolItem
* SdOptionsMiscItem::Clone( SfxItemPool
* ) const
830 return new SdOptionsMiscItem( *this );
834 // ----------------------------------------------------------------------
836 int SdOptionsMiscItem::operator==( const SfxPoolItem
& rAttr
) const
838 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
839 DBG_ASSERT( bSameType
, "SdOptionsMiscItem::operator==(), differen pool item type!" );
840 return bSameType
&& ( maOptionsMisc
== static_cast< const SdOptionsMiscItem
& >(rAttr
).maOptionsMisc
);
843 // -----------------------------------------------------------------------
845 void SdOptionsMiscItem::SetOptions( SdOptions
* pOpts
) const
849 pOpts
->SetStartWithTemplate( maOptionsMisc
.IsStartWithTemplate() );
850 pOpts
->SetMarkedHitMovesAlways( maOptionsMisc
.IsMarkedHitMovesAlways() );
851 pOpts
->SetMoveOnlyDragging( maOptionsMisc
.IsMoveOnlyDragging() );
852 pOpts
->SetCrookNoContortion( maOptionsMisc
.IsCrookNoContortion() );
853 pOpts
->SetQuickEdit( maOptionsMisc
.IsQuickEdit() );
854 pOpts
->SetMasterPagePaintCaching( maOptionsMisc
.IsMasterPagePaintCaching() );
855 pOpts
->SetDragWithCopy( maOptionsMisc
.IsDragWithCopy() );
856 pOpts
->SetPickThrough( maOptionsMisc
.IsPickThrough() );
857 pOpts
->SetBigHandles( maOptionsMisc
.IsBigHandles() );
858 pOpts
->SetDoubleClickTextEdit( maOptionsMisc
.IsDoubleClickTextEdit() );
859 pOpts
->SetClickChangeRotation( maOptionsMisc
.IsClickChangeRotation() );
860 pOpts
->SetStartWithActualPage( maOptionsMisc
.IsStartWithActualPage() );
861 pOpts
->SetSummationOfParagraphs( maOptionsMisc
.IsSummationOfParagraphs() );
862 pOpts
->SetSolidDragging( maOptionsMisc
.IsSolidDragging() );
863 pOpts
->SetSolidMarkHdl( maOptionsMisc
.IsSolidMarkHdl() );
865 pOpts
->SetShowUndoDeleteWarning( maOptionsMisc
.IsShowUndoDeleteWarning() );
866 pOpts
->SetPrinterIndependentLayout( maOptionsMisc
.GetPrinterIndependentLayout() );
868 pOpts
->SetDefaultObjectSizeWidth( maOptionsMisc
.GetDefaultObjectSizeWidth() );
869 pOpts
->SetDefaultObjectSizeHeight( maOptionsMisc
.GetDefaultObjectSizeHeight() );
871 pOpts
->SetPreviewNewEffects( maOptionsMisc
.IsPreviewNewEffects() );
872 pOpts
->SetPreviewChangedEffects( maOptionsMisc
.IsPreviewChangedEffects() );
873 pOpts
->SetPreviewTransitions( maOptionsMisc
.IsPreviewTransitions() );
875 pOpts
->SetDisplay( maOptionsMisc
.GetDisplay() );
879 /*************************************************************************
883 \************************************************************************/
885 SdOptionsSnap::SdOptionsSnap( USHORT nConfigId
, BOOL bUseConfig
) :
886 SdOptionsGeneric( nConfigId
, bUseConfig
?
887 ( ( SDCFG_DRAW
== nConfigId
) ?
888 B2U( "Office.Draw/Snap" ) :
889 B2U( "Office.Impress/Snap" ) ) :
891 bSnapHelplines( TRUE
),
894 bSnapPoints( FALSE
),
903 EnableModify( TRUE
);
906 // -----------------------------------------------------------------------------
908 void SdOptionsSnap::SetDefaults()
910 SetSnapHelplines( TRUE
);
911 SetSnapBorder( TRUE
);
912 SetSnapFrame( FALSE
);
913 SetSnapPoints( FALSE
);
919 SetEliminatePolyPointLimitAngle( 1500 );
922 // -----------------------------------------------------------------------------
924 BOOL
SdOptionsSnap::operator==( const SdOptionsSnap
& rOpt
) const
926 return( IsSnapHelplines() == rOpt
.IsSnapHelplines() &&
927 IsSnapBorder() == rOpt
.IsSnapBorder() &&
928 IsSnapFrame() == rOpt
.IsSnapFrame() &&
929 IsSnapPoints() == rOpt
.IsSnapPoints() &&
930 IsOrtho() == rOpt
.IsOrtho() &&
931 IsBigOrtho() == rOpt
.IsBigOrtho() &&
932 IsRotate() == rOpt
.IsRotate() &&
933 GetSnapArea() == rOpt
.GetSnapArea() &&
934 GetAngle() == rOpt
.GetAngle() &&
935 GetEliminatePolyPointLimitAngle() == rOpt
.GetEliminatePolyPointLimitAngle() );
938 // -----------------------------------------------------------------------------
940 void SdOptionsSnap::GetPropNameArray( const char**& ppNames
, ULONG
& rCount
) const
942 static const char* aPropNames
[] =
946 "Object/ObjectFrame",
947 "Object/ObjectPoint",
948 "Position/CreatingMoving",
949 "Position/ExtendEdges",
952 "Position/RotatingValue",
953 "Position/PointReduction"
957 ppNames
= aPropNames
;
960 // -----------------------------------------------------------------------------
962 BOOL
SdOptionsSnap::ReadData( const Any
* pValues
)
964 if( pValues
[0].hasValue() ) SetSnapHelplines( *(sal_Bool
*) pValues
[ 0 ].getValue() );
965 if( pValues
[1].hasValue() ) SetSnapBorder( *(sal_Bool
*)pValues
[ 1 ].getValue() );
966 if( pValues
[2].hasValue() ) SetSnapFrame( *(sal_Bool
*) pValues
[ 2 ].getValue() );
967 if( pValues
[3].hasValue() ) SetSnapPoints( *(sal_Bool
*) pValues
[ 3 ].getValue() );
968 if( pValues
[4].hasValue() ) SetOrtho( *(sal_Bool
*) pValues
[ 4 ].getValue() );
969 if( pValues
[5].hasValue() ) SetBigOrtho( *(sal_Bool
*) pValues
[ 5 ].getValue() );
970 if( pValues
[6].hasValue() ) SetRotate( *(sal_Bool
*) pValues
[ 6 ].getValue() );
971 if( pValues
[7].hasValue() ) SetSnapArea( (INT16
) *(sal_Int32
*) pValues
[ 7 ].getValue() );
972 if( pValues
[8].hasValue() ) SetAngle( (INT16
) *(sal_Int32
*) pValues
[ 8 ].getValue() );
973 if( pValues
[9].hasValue() ) SetEliminatePolyPointLimitAngle( (INT16
) *(sal_Int32
*) pValues
[ 9 ].getValue() );
978 // -----------------------------------------------------------------------------
980 BOOL
SdOptionsSnap::WriteData( Any
* pValues
) const
982 pValues
[ 0 ] <<= IsSnapHelplines();
983 pValues
[ 1 ] <<= IsSnapBorder();
984 pValues
[ 2 ] <<= IsSnapFrame();
985 pValues
[ 3 ] <<= IsSnapPoints();
986 pValues
[ 4 ] <<= IsOrtho();
987 pValues
[ 5 ] <<= IsBigOrtho();
988 pValues
[ 6 ] <<= IsRotate();
989 pValues
[ 7 ] <<= (sal_Int32
) GetSnapArea();
990 pValues
[ 8 ] <<= (sal_Int32
) GetAngle();
991 pValues
[ 9 ] <<= (sal_Int32
) GetEliminatePolyPointLimitAngle();
996 /*************************************************************************
1000 \************************************************************************/
1002 SdOptionsSnapItem::SdOptionsSnapItem( USHORT _nWhich
)
1003 : SfxPoolItem ( _nWhich
)
1004 , maOptionsSnap ( 0, FALSE
)
1008 // ----------------------------------------------------------------------
1010 SdOptionsSnapItem::SdOptionsSnapItem( USHORT _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
)
1011 : SfxPoolItem ( _nWhich
)
1012 , maOptionsSnap ( 0, FALSE
)
1016 maOptionsSnap
.SetSnapHelplines( pView
->IsHlplSnap() );
1017 maOptionsSnap
.SetSnapBorder( pView
->IsBordSnap() );
1018 maOptionsSnap
.SetSnapFrame( pView
->IsOFrmSnap() );
1019 maOptionsSnap
.SetSnapPoints( pView
->IsOPntSnap() );
1020 maOptionsSnap
.SetOrtho( pView
->IsOrtho() );
1021 maOptionsSnap
.SetBigOrtho( pView
->IsBigOrtho() );
1022 maOptionsSnap
.SetRotate( pView
->IsAngleSnapEnabled() );
1023 maOptionsSnap
.SetSnapArea( pView
->GetSnapMagneticPixel() );
1024 maOptionsSnap
.SetAngle( (INT16
) pView
->GetSnapAngle() );
1025 maOptionsSnap
.SetEliminatePolyPointLimitAngle( (INT16
) pView
->GetEliminatePolyPointLimitAngle() );
1029 maOptionsSnap
.SetSnapHelplines( pOpts
->IsSnapHelplines() );
1030 maOptionsSnap
.SetSnapBorder( pOpts
->IsSnapBorder() );
1031 maOptionsSnap
.SetSnapFrame( pOpts
->IsSnapFrame() );
1032 maOptionsSnap
.SetSnapPoints( pOpts
->IsSnapPoints() );
1033 maOptionsSnap
.SetOrtho( pOpts
->IsOrtho() );
1034 maOptionsSnap
.SetBigOrtho( pOpts
->IsBigOrtho() );
1035 maOptionsSnap
.SetRotate( pOpts
->IsRotate() );
1036 maOptionsSnap
.SetSnapArea( pOpts
->GetSnapArea() );
1037 maOptionsSnap
.SetAngle( pOpts
->GetAngle() );
1038 maOptionsSnap
.SetEliminatePolyPointLimitAngle( pOpts
->GetEliminatePolyPointLimitAngle() );
1042 // ----------------------------------------------------------------------
1044 SfxPoolItem
* SdOptionsSnapItem::Clone( SfxItemPool
* ) const
1046 return new SdOptionsSnapItem( *this );
1050 // ----------------------------------------------------------------------
1052 int SdOptionsSnapItem::operator==( const SfxPoolItem
& rAttr
) const
1054 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
1055 DBG_ASSERT( bSameType
, "SdOptionsSnapItem::operator==(), differen pool item type!" );
1056 return bSameType
&& ( maOptionsSnap
== static_cast< const SdOptionsSnapItem
& >(rAttr
).maOptionsSnap
);
1059 // -----------------------------------------------------------------------
1061 void SdOptionsSnapItem::SetOptions( SdOptions
* pOpts
) const
1065 pOpts
->SetSnapHelplines( maOptionsSnap
.IsSnapHelplines() );
1066 pOpts
->SetSnapBorder( maOptionsSnap
.IsSnapBorder() );
1067 pOpts
->SetSnapFrame( maOptionsSnap
.IsSnapFrame() );
1068 pOpts
->SetSnapPoints( maOptionsSnap
.IsSnapPoints() );
1069 pOpts
->SetOrtho( maOptionsSnap
.IsOrtho() );
1070 pOpts
->SetBigOrtho( maOptionsSnap
.IsBigOrtho() );
1071 pOpts
->SetRotate( maOptionsSnap
.IsRotate() );
1072 pOpts
->SetSnapArea( maOptionsSnap
.GetSnapArea() );
1073 pOpts
->SetAngle( maOptionsSnap
.GetAngle() );
1074 pOpts
->SetEliminatePolyPointLimitAngle( maOptionsSnap
.GetEliminatePolyPointLimitAngle() );
1078 /*************************************************************************
1082 \************************************************************************/
1084 SdOptionsZoom::SdOptionsZoom( USHORT nConfigId
, BOOL bUseConfig
) :
1085 SdOptionsGeneric( nConfigId
, ( bUseConfig
&& ( SDCFG_DRAW
== nConfigId
) ) ?
1086 B2U( "Office.Draw/Zoom" ) :
1092 EnableModify( TRUE
);
1095 // -----------------------------------------------------------------------------
1097 void SdOptionsZoom::SetDefaults()
1102 // -----------------------------------------------------------------------------
1104 BOOL
SdOptionsZoom::operator==( const SdOptionsZoom
& rOpt
) const
1106 INT32 nX1
, nX2
, nY1
, nY2
;
1108 GetScale( nX1
, nY1
);
1109 rOpt
.GetScale( nX2
, nY2
);
1111 return( ( nX1
== nX2
) &&
1115 // -----------------------------------------------------------------------------
1117 void SdOptionsZoom::GetPropNameArray( const char**& ppNames
, ULONG
& rCount
) const
1119 static const char* aPropNames
[] =
1125 rCount
= ( GetConfigId() == SDCFG_DRAW
) ? 2 : 0;
1126 ppNames
= aPropNames
;
1129 // -----------------------------------------------------------------------------
1131 BOOL
SdOptionsZoom::ReadData( const Any
* pValues
)
1135 if( pValues
[0].hasValue() ) x
= ( *(sal_Int32
*) pValues
[ 0 ].getValue() );
1136 if( pValues
[1].hasValue() ) y
= ( *(sal_Int32
*) pValues
[ 1 ].getValue() );
1143 // -----------------------------------------------------------------------------
1145 BOOL
SdOptionsZoom::WriteData( Any
* pValues
) const
1151 pValues
[ 0 ] <<= (sal_Int32
) x
;
1152 pValues
[ 1 ] <<= (sal_Int32
) y
;
1157 /*************************************************************************
1159 |* SdOptionsZoomItem
1161 \************************************************************************/
1163 SdOptionsZoomItem::SdOptionsZoomItem( USHORT _nWhich
)
1164 : SfxPoolItem ( _nWhich
)
1165 , maOptionsZoom ( 0, FALSE
)
1169 // ----------------------------------------------------------------------
1171 SdOptionsZoomItem::SdOptionsZoomItem( USHORT _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* )
1172 : SfxPoolItem ( _nWhich
)
1173 , maOptionsZoom ( 0, FALSE
)
1179 pOpts
->GetScale( nX
, nY
);
1180 maOptionsZoom
.SetScale( nX
, nY
);
1184 // ----------------------------------------------------------------------
1186 SfxPoolItem
* SdOptionsZoomItem::Clone( SfxItemPool
* ) const
1188 return new SdOptionsZoomItem( *this );
1192 // ----------------------------------------------------------------------
1194 int SdOptionsZoomItem::operator==( const SfxPoolItem
& rAttr
) const
1196 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
1197 DBG_ASSERT( bSameType
, "SdOptionsZoomItem::operator==(), differen pool item type!" );
1198 return bSameType
&& ( maOptionsZoom
== static_cast< const SdOptionsZoomItem
& >(rAttr
).maOptionsZoom
);
1201 // -----------------------------------------------------------------------
1203 void SdOptionsZoomItem::SetOptions( SdOptions
* pOpts
) const
1209 maOptionsZoom
.GetScale( nX
, nY
);
1210 pOpts
->SetScale( nX
, nY
);
1214 /*************************************************************************
1218 \************************************************************************/
1220 SdOptionsGrid::SdOptionsGrid( USHORT nConfigId
, BOOL bUseConfig
) :
1221 SdOptionsGeneric( nConfigId
, bUseConfig
?
1222 ( ( SDCFG_DRAW
== nConfigId
) ?
1223 B2U( "Office.Draw/Grid" ) :
1224 B2U( "Office.Impress/Grid" ) ) :
1227 EnableModify( FALSE
);
1229 EnableModify( TRUE
);
1232 // -----------------------------------------------------------------------------
1234 SdOptionsGrid::~SdOptionsGrid()
1238 // -----------------------------------------------------------------------------
1240 void SdOptionsGrid::SetDefaults()
1242 const UINT32 nVal
= 1000;
1244 SetFldDivisionX( nVal
);
1245 SetFldDivisionY( nVal
);
1246 SetFldDrawX( nVal
);
1247 SetFldDrawY( nVal
);
1248 SetFldSnapX( nVal
);
1249 SetFldSnapY( nVal
);
1250 SetUseGridSnap( FALSE
);
1251 SetSynchronize( TRUE
);
1252 SetGridVisible( FALSE
);
1253 SetEqualGrid( TRUE
);
1256 // -----------------------------------------------------------------------------
1258 BOOL
SdOptionsGrid::operator==( const SdOptionsGrid
& rOpt
) const
1260 return( GetFldDrawX() == rOpt
.GetFldDrawX() &&
1261 GetFldDivisionX() == rOpt
.GetFldDivisionX() &&
1262 GetFldDrawY() == rOpt
.GetFldDrawY() &&
1263 GetFldDivisionY() == rOpt
.GetFldDivisionY() &&
1264 GetFldSnapX() == rOpt
.GetFldSnapX() &&
1265 GetFldSnapY() == rOpt
.GetFldSnapY() &&
1266 IsUseGridSnap() == rOpt
.IsUseGridSnap() &&
1267 IsSynchronize() == rOpt
.IsSynchronize() &&
1268 IsGridVisible() == rOpt
.IsGridVisible() &&
1269 IsEqualGrid() == rOpt
.IsEqualGrid() );
1272 // -----------------------------------------------------------------------------
1274 void SdOptionsGrid::GetPropNameArray( const char**& ppNames
, ULONG
& rCount
) const
1276 static const char* aPropNamesMetric
[] =
1278 "Resolution/XAxis/Metric",
1279 "Resolution/YAxis/Metric",
1280 "Subdivision/XAxis",
1281 "Subdivision/YAxis",
1282 "SnapGrid/XAxis/Metric",
1283 "SnapGrid/YAxis/Metric",
1284 "Option/SnapToGrid",
1285 "Option/Synchronize",
1286 "Option/VisibleGrid",
1290 static const char* aPropNamesNonMetric
[] =
1292 "Resolution/XAxis/NonMetric",
1293 "Resolution/YAxis/NonMetric",
1294 "Subdivision/XAxis",
1295 "Subdivision/YAxis",
1296 "SnapGrid/XAxis/NonMetric",
1297 "SnapGrid/YAxis/NonMetric",
1298 "Option/SnapToGrid",
1299 "Option/Synchronize",
1300 "Option/VisibleGrid",
1306 if( isMetricSystem() )
1307 ppNames
= aPropNamesMetric
;
1309 ppNames
= aPropNamesNonMetric
;
1312 // -----------------------------------------------------------------------------
1314 BOOL
SdOptionsGrid::ReadData( const Any
* pValues
)
1316 if( pValues
[0].hasValue() ) SetFldDrawX( *(sal_Int32
*) pValues
[ 0 ].getValue() );
1317 if( pValues
[1].hasValue() ) SetFldDrawY( *(sal_Int32
*) pValues
[ 1 ].getValue() );
1319 if( pValues
[2].hasValue() )
1321 const UINT32 nDivX
= FRound( *(double*) pValues
[ 2 ].getValue() );
1322 SetFldDivisionX( SvxOptionsGrid::GetFldDrawX() / ( nDivX
+ 1 ) );
1325 if( pValues
[3].hasValue() )
1327 const UINT32 nDivY
= FRound( *(double*) pValues
[ 3 ].getValue() );
1328 SetFldDivisionY( SvxOptionsGrid::GetFldDrawY() / ( nDivY
+ 1 ) );
1331 if( pValues
[4].hasValue() ) SetFldSnapX( *(sal_Int32
*) pValues
[ 4 ].getValue() );
1332 if( pValues
[5].hasValue() ) SetFldSnapY( *(sal_Int32
*) pValues
[ 5 ].getValue() );
1333 if( pValues
[6].hasValue() ) SetUseGridSnap( *(sal_Bool
*) pValues
[ 6 ].getValue() );
1334 if( pValues
[7].hasValue() ) SetSynchronize( *(sal_Bool
*) pValues
[ 7 ].getValue() );
1335 if( pValues
[8].hasValue() ) SetGridVisible( *(sal_Bool
*) pValues
[ 8 ].getValue() );
1336 if( pValues
[9].hasValue() ) SetEqualGrid( *(sal_Bool
*) pValues
[ 9 ].getValue() );
1341 // -----------------------------------------------------------------------------
1343 BOOL
SdOptionsGrid::WriteData( Any
* pValues
) const
1345 pValues
[ 0 ] <<= (sal_Int32
) GetFldDrawX();
1346 pValues
[ 1 ] <<= (sal_Int32
) GetFldDrawY();
1347 pValues
[ 2 ] <<= ( GetFldDivisionX() ? ( (double) GetFldDrawX() / GetFldDivisionX() - 1.0 ) : (double) 0 );
1348 pValues
[ 3 ] <<= ( GetFldDivisionY() ? ( (double) GetFldDrawY() / GetFldDivisionY() - 1.0 ) : (double) 0 );
1349 pValues
[ 4 ] <<= (sal_Int32
) GetFldSnapX();
1350 pValues
[ 5 ] <<= (sal_Int32
) GetFldSnapY();
1351 pValues
[ 6 ] <<= IsUseGridSnap();
1352 pValues
[ 7 ] <<= IsSynchronize();
1353 pValues
[ 8 ] <<= IsGridVisible();
1354 pValues
[ 9 ] <<= IsEqualGrid();
1359 /*************************************************************************
1361 |* SdOptionsGridItem
1363 \************************************************************************/
1365 SdOptionsGridItem::SdOptionsGridItem( USHORT _nWhich
) :
1366 SvxGridItem( _nWhich
)
1370 // -----------------------------------------------------------------------------
1372 SdOptionsGridItem::SdOptionsGridItem( USHORT _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
) :
1373 SvxGridItem( _nWhich
)
1375 SetSynchronize( pOpts
->IsSynchronize() );
1376 SetEqualGrid( pOpts
->IsEqualGrid() );
1380 SetFldDrawX( pView
->GetGridCoarse().Width() );
1381 SetFldDrawY( pView
->GetGridCoarse().Height() );
1382 SetFldDivisionX( pView
->GetGridFine().Width() ? ( GetFldDrawX() / pView
->GetGridFine().Width() - 1 ) : 0 );
1383 SetFldDivisionY( pView
->GetGridFine().Height() ? ( GetFldDrawY() / pView
->GetGridFine().Height() - 1 ) : 0 );
1384 SetFldSnapX( long(pView
->GetSnapGridWidthX()) );
1385 SetFldSnapY( long(pView
->GetSnapGridWidthY()) );
1386 SetUseGridSnap( pView
->IsGridSnap() );
1387 SetGridVisible( pView
->IsGridVisible() );
1391 SetFldDrawX( pOpts
->GetFldDrawX() );
1392 SetFldDrawY( pOpts
->GetFldDrawY() );
1393 SetFldDivisionX( pOpts
->GetFldDivisionX() ? ( pOpts
->GetFldDrawX() / pOpts
->GetFldDivisionX() - 1 ) : 0 );
1394 SetFldDivisionY( pOpts
->GetFldDivisionY() ? ( pOpts
->GetFldDrawY() / pOpts
->GetFldDivisionY() - 1 ) : 0 );
1395 SetFldSnapX( pOpts
->GetFldSnapX() );
1396 SetFldSnapY( pOpts
->GetFldSnapY() );
1397 SetUseGridSnap( pOpts
->IsUseGridSnap() );
1398 SetGridVisible( pOpts
->IsGridVisible() );
1402 // -----------------------------------------------------------------------
1404 void SdOptionsGridItem::SetOptions( SdOptions
* pOpts
) const
1406 pOpts
->SetFldDrawX( GetFldDrawX() );
1407 pOpts
->SetFldDivisionX( GetFldDrawX() / ( GetFldDivisionX() + 1 ) );
1408 pOpts
->SetFldDrawY( GetFldDrawY() );
1409 pOpts
->SetFldDivisionY( GetFldDrawY() / ( GetFldDivisionY() + 1 ) );
1410 pOpts
->SetFldSnapX( GetFldSnapX() );
1411 pOpts
->SetFldSnapY( GetFldSnapY() );
1412 pOpts
->SetUseGridSnap( GetUseGridSnap() );
1413 pOpts
->SetSynchronize( GetSynchronize() );
1414 pOpts
->SetGridVisible( GetGridVisible() );
1415 pOpts
->SetEqualGrid( GetEqualGrid() );
1418 /*************************************************************************
1422 \************************************************************************/
1424 SdOptionsPrint::SdOptionsPrint( USHORT nConfigId
, BOOL bUseConfig
) :
1425 SdOptionsGeneric( nConfigId
, bUseConfig
?
1426 ( ( SDCFG_DRAW
== nConfigId
) ?
1427 B2U( "Office.Draw/Print" ) :
1428 B2U( "Office.Impress/Print" ) ) :
1437 bHiddenPages( TRUE
),
1440 bWarningPrinter( TRUE
),
1441 bWarningSize( FALSE
),
1442 bWarningOrientation( FALSE
),
1448 mbHandoutHorizontal( TRUE
),
1449 mnHandoutPages( 6 ),
1452 EnableModify( TRUE
);
1455 // -----------------------------------------------------------------------------
1457 void SdOptionsPrint::SetDefaults()
1461 SetHandout( FALSE
);
1462 SetOutline( FALSE
);
1465 SetPagename( FALSE
);
1466 SetHiddenPages( TRUE
);
1467 SetPagesize( FALSE
);
1468 SetPagetile( FALSE
);
1469 SetWarningPrinter( TRUE
);
1470 SetWarningSize( FALSE
);
1471 SetWarningOrientation( FALSE
);
1472 SetBooklet( FALSE
);
1473 SetFrontPage( TRUE
);
1474 SetBackPage( TRUE
);
1475 SetCutPage( FALSE
);
1476 SetPaperbin( FALSE
);
1477 SetOutputQuality( 0 );
1478 SetHandoutHorizontal( TRUE
);
1479 SetHandoutPages( 6 );
1482 // -----------------------------------------------------------------------------
1484 BOOL
SdOptionsPrint::operator==( const SdOptionsPrint
& rOpt
) const
1486 return( IsDraw() == rOpt
.IsDraw() &&
1487 IsNotes() == rOpt
.IsNotes() &&
1488 IsHandout() == rOpt
.IsHandout() &&
1489 IsOutline() == rOpt
.IsOutline() &&
1490 IsDate() == rOpt
.IsDate() &&
1491 IsTime() == rOpt
.IsTime() &&
1492 IsPagename() == rOpt
.IsPagename() &&
1493 IsHiddenPages() == rOpt
.IsHiddenPages() &&
1494 IsPagesize() == rOpt
.IsPagesize() &&
1495 IsPagetile() == rOpt
.IsPagetile() &&
1496 IsWarningPrinter() == rOpt
.IsWarningPrinter() &&
1497 IsWarningSize() == rOpt
.IsWarningSize() &&
1498 IsWarningOrientation() == rOpt
.IsWarningOrientation() &&
1499 IsBooklet() == rOpt
.IsBooklet() &&
1500 IsFrontPage() == rOpt
.IsFrontPage() &&
1501 IsBackPage() == rOpt
.IsBackPage() &&
1502 IsCutPage() == rOpt
.IsCutPage() &&
1503 IsPaperbin() == rOpt
.IsPaperbin() &&
1504 GetOutputQuality() == rOpt
.GetOutputQuality() &&
1505 IsHandoutHorizontal() == rOpt
.IsHandoutHorizontal() &&
1506 GetHandoutPages() == rOpt
.GetHandoutPages() );
1509 // -----------------------------------------------------------------------------
1511 void SdOptionsPrint::GetPropNameArray( const char**& ppNames
, ULONG
& rCount
) const
1513 static const char* aDrawPropNames
[] =
1523 // bWarningOrientation
1525 "Page/BookletFront",
1528 "Other/FromPrinterSetup",
1532 static const char* aImpressPropNames
[] =
1542 // bWarningOrientation
1544 "Page/BookletFront",
1547 "Other/FromPrinterSetup",
1549 "Content/Presentation",
1553 "Other/HandoutHorizontal",
1554 "Other/PagesPerHandout"
1557 if( GetConfigId() == SDCFG_IMPRESS
)
1560 ppNames
= aImpressPropNames
;
1565 ppNames
= aDrawPropNames
;
1569 // -----------------------------------------------------------------------------
1571 BOOL
SdOptionsPrint::ReadData( const Any
* pValues
)
1573 if( pValues
[0].hasValue() ) SetDate( *(sal_Bool
*) pValues
[ 0 ].getValue() );
1574 if( pValues
[1].hasValue() ) SetTime( *(sal_Bool
*) pValues
[ 1 ].getValue() );
1575 if( pValues
[2].hasValue() ) SetPagename( *(sal_Bool
*) pValues
[ 2 ].getValue() );
1576 if( pValues
[3].hasValue() ) SetHiddenPages( *(sal_Bool
*) pValues
[ 3 ].getValue() );
1577 if( pValues
[4].hasValue() ) SetPagesize( *(sal_Bool
*) pValues
[ 4 ].getValue() );
1578 if( pValues
[5].hasValue() ) SetPagetile( *(sal_Bool
*) pValues
[ 5 ].getValue() );
1579 if( pValues
[6].hasValue() ) SetBooklet( *(sal_Bool
*) pValues
[ 6 ].getValue() );
1580 if( pValues
[7].hasValue() ) SetFrontPage( *(sal_Bool
*) pValues
[ 7 ].getValue() );
1581 if( pValues
[8].hasValue() ) SetBackPage( *(sal_Bool
*) pValues
[ 8 ].getValue() );
1582 if( pValues
[9].hasValue() ) SetPaperbin( *(sal_Bool
*) pValues
[ 9 ].getValue() );
1583 if( pValues
[10].hasValue() ) SetOutputQuality( (UINT16
) *(sal_Int32
*) pValues
[ 10 ].getValue() );
1584 if( pValues
[11].hasValue() ) SetDraw( *(sal_Bool
*) pValues
[ 11 ].getValue() );
1587 if( GetConfigId() == SDCFG_IMPRESS
)
1589 if( pValues
[12].hasValue() ) SetNotes( *(sal_Bool
*) pValues
[ 12 ].getValue() );
1590 if( pValues
[13].hasValue() ) SetHandout( *(sal_Bool
*) pValues
[ 13 ].getValue() );
1591 if( pValues
[14].hasValue() ) SetOutline( *(sal_Bool
*) pValues
[ 14 ].getValue() );
1592 if( pValues
[15].hasValue() ) SetHandoutHorizontal( *(sal_Bool
*) pValues
[15].getValue() );
1593 if( pValues
[16].hasValue() ) SetHandoutPages( (UINT16
)*(sal_Int32
*) pValues
[16].getValue() );
1599 // -----------------------------------------------------------------------------
1601 BOOL
SdOptionsPrint::WriteData( Any
* pValues
) const
1603 pValues
[ 0 ] <<= IsDate();
1604 pValues
[ 1 ] <<= IsTime();
1605 pValues
[ 2 ] <<= IsPagename();
1606 pValues
[ 3 ] <<= IsHiddenPages();
1607 pValues
[ 4 ] <<= IsPagesize();
1608 pValues
[ 5 ] <<= IsPagetile();
1609 pValues
[ 6 ] <<= IsBooklet();
1610 pValues
[ 7 ] <<= IsFrontPage();
1611 pValues
[ 8 ] <<= IsBackPage();
1612 pValues
[ 9 ] <<= IsPaperbin();
1613 pValues
[ 10 ] <<= (sal_Int32
) GetOutputQuality();
1614 pValues
[ 11 ] <<= IsDraw();
1617 if( GetConfigId() == SDCFG_IMPRESS
)
1619 pValues
[ 12 ] <<= IsNotes();
1620 pValues
[ 13 ] <<= IsHandout();
1621 pValues
[ 14 ] <<= IsOutline();
1622 pValues
[ 15 ] <<= IsHandoutHorizontal();
1623 pValues
[ 16 ] <<= GetHandoutPages();
1629 void SdOptionsPrint::SetPrinterOptions( const SdOptionsPrint
* pOptions
)
1631 bDraw
= pOptions
->bDraw
;
1632 bNotes
= pOptions
->bNotes
;
1633 bHandout
= pOptions
->bHandout
;
1634 bOutline
= pOptions
->bOutline
;
1635 bDate
= pOptions
->bDate
;
1636 bTime
= pOptions
->bTime
;
1637 bPagename
= pOptions
->bPagename
;
1638 bHiddenPages
= pOptions
->bHiddenPages
;
1639 bPagesize
= pOptions
->bPagesize
;
1640 bPagetile
= pOptions
->bPagetile
;
1641 bWarningPrinter
= pOptions
->bWarningPrinter
;
1642 bWarningSize
= pOptions
->bWarningSize
;
1643 bWarningOrientation
= pOptions
->bWarningOrientation
;
1644 bBooklet
= pOptions
->bBooklet
;
1645 bFront
= pOptions
->bFront
;
1646 bBack
= pOptions
->bBack
;
1647 bCutPage
= pOptions
->bCutPage
;
1648 bPaperbin
= pOptions
->bPaperbin
;
1649 nQuality
= pOptions
->nQuality
;
1650 mnHandoutPages
= pOptions
->mnHandoutPages
;
1651 mbHandoutHorizontal
= pOptions
->mbHandoutHorizontal
;
1654 /*************************************************************************
1656 |* SdOptionsPrintItem
1658 \************************************************************************/
1660 SdOptionsPrintItem::SdOptionsPrintItem( USHORT _nWhich
)
1661 : SfxPoolItem ( _nWhich
)
1662 , maOptionsPrint ( 0, FALSE
)
1666 // ----------------------------------------------------------------------
1668 SdOptionsPrintItem::SdOptionsPrintItem( USHORT _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* )
1669 : SfxPoolItem ( _nWhich
)
1670 , maOptionsPrint ( 0, FALSE
)
1674 maOptionsPrint
.SetDraw( pOpts
->IsDraw() );
1675 maOptionsPrint
.SetNotes( pOpts
->IsNotes() );
1676 maOptionsPrint
.SetHandout( pOpts
->IsHandout() );
1677 maOptionsPrint
.SetOutline( pOpts
->IsOutline() );
1678 maOptionsPrint
.SetDate( pOpts
->IsDate() );
1679 maOptionsPrint
.SetTime( pOpts
->IsTime() );
1680 maOptionsPrint
.SetPagename( pOpts
->IsPagename() );
1681 maOptionsPrint
.SetHiddenPages( pOpts
->IsHiddenPages() );
1682 maOptionsPrint
.SetPagesize( pOpts
->IsPagesize() );
1683 maOptionsPrint
.SetPagetile( pOpts
->IsPagetile() );
1684 maOptionsPrint
.SetWarningPrinter( pOpts
->IsWarningPrinter() );
1685 maOptionsPrint
.SetWarningSize( pOpts
->IsWarningSize() );
1686 maOptionsPrint
.SetWarningOrientation( pOpts
->IsWarningOrientation() );
1687 maOptionsPrint
.SetBooklet( pOpts
->IsBooklet() );
1688 maOptionsPrint
.SetFrontPage( pOpts
->IsFrontPage() );
1689 maOptionsPrint
.SetBackPage( pOpts
->IsBackPage() );
1690 maOptionsPrint
.SetCutPage( pOpts
->IsCutPage() );
1691 maOptionsPrint
.SetPaperbin( pOpts
->IsPaperbin() );
1692 maOptionsPrint
.SetOutputQuality( pOpts
->GetOutputQuality() );
1696 // ----------------------------------------------------------------------
1698 SfxPoolItem
* SdOptionsPrintItem::Clone( SfxItemPool
* ) const
1700 return new SdOptionsPrintItem( *this );
1703 // ----------------------------------------------------------------------
1705 int SdOptionsPrintItem::operator==( const SfxPoolItem
& rAttr
) const
1707 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
1708 DBG_ASSERT( bSameType
, "SdOptionsPrintItem::operator==(), differen pool item type!" );
1709 return bSameType
&& ( maOptionsPrint
== static_cast< const SdOptionsPrintItem
& >( rAttr
).maOptionsPrint
);
1712 // -----------------------------------------------------------------------
1714 void SdOptionsPrintItem::SetOptions( SdOptions
* pOpts
) const
1718 pOpts
->SetDraw( maOptionsPrint
.IsDraw() );
1719 pOpts
->SetNotes( maOptionsPrint
.IsNotes() );
1720 pOpts
->SetHandout( maOptionsPrint
.IsHandout() );
1721 pOpts
->SetOutline( maOptionsPrint
.IsOutline() );
1722 pOpts
->SetDate( maOptionsPrint
.IsDate() );
1723 pOpts
->SetTime( maOptionsPrint
.IsTime() );
1724 pOpts
->SetPagename( maOptionsPrint
.IsPagename() );
1725 pOpts
->SetHiddenPages( maOptionsPrint
.IsHiddenPages() );
1726 pOpts
->SetPagesize( maOptionsPrint
.IsPagesize() );
1727 pOpts
->SetPagetile( maOptionsPrint
.IsPagetile() );
1728 pOpts
->SetWarningPrinter( maOptionsPrint
.IsWarningPrinter() );
1729 pOpts
->SetWarningSize( maOptionsPrint
.IsWarningSize() );
1730 pOpts
->SetWarningOrientation( maOptionsPrint
.IsWarningOrientation() );
1731 pOpts
->SetBooklet( maOptionsPrint
.IsBooklet() );
1732 pOpts
->SetFrontPage( maOptionsPrint
.IsFrontPage() );
1733 pOpts
->SetBackPage( maOptionsPrint
.IsBackPage() );
1734 pOpts
->SetCutPage( maOptionsPrint
.IsCutPage() );
1735 pOpts
->SetPaperbin( maOptionsPrint
.IsPaperbin() );
1736 pOpts
->SetOutputQuality( maOptionsPrint
.GetOutputQuality() );
1740 /*************************************************************************
1744 \************************************************************************/
1746 SdOptions::SdOptions( USHORT nConfigId
) :
1747 SdOptionsLayout( nConfigId
, TRUE
),
1748 SdOptionsContents( nConfigId
, TRUE
),
1749 SdOptionsMisc( nConfigId
, TRUE
),
1750 SdOptionsSnap( nConfigId
, TRUE
),
1751 SdOptionsZoom( nConfigId
, TRUE
),
1752 SdOptionsGrid( nConfigId
, TRUE
),
1753 SdOptionsPrint( nConfigId
, TRUE
)
1757 // ----------------------------------------------------------------------
1759 SdOptions::~SdOptions()
1763 // ----------------------------------------------------------------------
1765 void SdOptions::SetRangeDefaults( ULONG nOptionsRange
)
1767 if( nOptionsRange
& SD_OPTIONS_LAYOUT
)
1768 SdOptionsLayout::SetDefaults();
1770 if( nOptionsRange
& SD_OPTIONS_CONTENTS
)
1771 SdOptionsContents::SetDefaults();
1773 if( nOptionsRange
& SD_OPTIONS_MISC
)
1774 SdOptionsMisc::SetDefaults();
1776 if( nOptionsRange
& SD_OPTIONS_SNAP
)
1777 SdOptionsSnap::SetDefaults();
1779 if( nOptionsRange
& SD_OPTIONS_ZOOM
)
1780 SdOptionsZoom::SetDefaults();
1782 if( nOptionsRange
& SD_OPTIONS_GRID
)
1783 SdOptionsGrid::SetDefaults();
1785 if( nOptionsRange
& SD_OPTIONS_PRINT
)
1786 SdOptionsPrint::SetDefaults();
1789 // ----------------------------------------------------------------------
1791 void SdOptions::StoreConfig( ULONG nOptionsRange
)
1793 if( nOptionsRange
& SD_OPTIONS_LAYOUT
)
1794 SdOptionsLayout::Store();
1796 if( nOptionsRange
& SD_OPTIONS_CONTENTS
)
1797 SdOptionsContents::Store();
1799 if( nOptionsRange
& SD_OPTIONS_MISC
)
1800 SdOptionsMisc::Store();
1802 if( nOptionsRange
& SD_OPTIONS_SNAP
)
1803 SdOptionsSnap::Store();
1805 if( nOptionsRange
& SD_OPTIONS_ZOOM
)
1806 SdOptionsZoom::Store();
1808 if( nOptionsRange
& SD_OPTIONS_GRID
)
1809 SdOptionsGrid::Store();
1811 if( nOptionsRange
& SD_OPTIONS_PRINT
)
1812 SdOptionsPrint::Store();