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 ::rtl
;
32 using namespace ::utl
;
33 using namespace ::com::sun::star::uno
;
35 #define B2U(_def_aStr) (OUString::createFromAscii(_def_aStr))
37 template< class T
> T
getSafeValue( const Any
& rAny
)
40 bool bOk
= (rAny
>>= value
);
42 DBG_ASSERT( bOk
, "SdOptionsItem, wrong type from configuration!" );
52 SdOptionsItem::SdOptionsItem( const SdOptionsGeneric
& rParent
, const OUString rSubTree
) :
53 ConfigItem ( rSubTree
),
58 // -----------------------------------------------------------------------------
60 SdOptionsItem::~SdOptionsItem()
64 // -----------------------------------------------------------------------------
66 void SdOptionsItem::Commit()
69 mrParent
.Commit( *this );
72 void SdOptionsItem::Notify( const com::sun::star::uno::Sequence
<OUString
>& )
76 // -----------------------------------------------------------------------------
78 Sequence
< Any
> SdOptionsItem::GetProperties( const Sequence
< OUString
>& rNames
)
80 return ConfigItem::GetProperties( rNames
);
83 // -----------------------------------------------------------------------------
85 sal_Bool
SdOptionsItem::PutProperties( const Sequence
< OUString
>& rNames
, const Sequence
< Any
>& rValues
)
87 return ConfigItem::PutProperties( rNames
, rValues
);
90 // -----------------------------------------------------------------------------
92 void SdOptionsItem::SetModified()
94 ConfigItem::SetModified();
97 // --------------------
98 // - SdOptionsGeneric -
99 // --------------------
101 SdOptionsGeneric::SdOptionsGeneric( sal_uInt16 nConfigId
, const OUString
& rSubTree
) :
102 maSubTree ( rSubTree
),
104 mnConfigId ( nConfigId
),
105 mbInit ( rSubTree
.isEmpty() )
109 // -----------------------------------------------------------------------------
111 void SdOptionsGeneric::Init() const
115 SdOptionsGeneric
* pThis
= const_cast<SdOptionsGeneric
*>(this);
118 pThis
->mpCfgItem
= new SdOptionsItem( *this, maSubTree
);
120 const Sequence
< OUString
> aNames( GetPropertyNames() );
121 const Sequence
< Any
> aValues
= mpCfgItem
->GetProperties( aNames
);
123 if( aNames
.getLength() && ( aValues
.getLength() == aNames
.getLength() ) )
125 const Any
* pValues
= aValues
.getConstArray();
127 pThis
->EnableModify( sal_False
);
128 pThis
->mbInit
= pThis
->ReadData( pValues
);
129 pThis
->EnableModify( sal_True
);
132 pThis
->mbInit
= sal_True
;
136 // -----------------------------------------------------------------------------
138 SdOptionsGeneric::~SdOptionsGeneric()
144 // -----------------------------------------------------------------------------
146 void SdOptionsGeneric::Commit( SdOptionsItem
& rCfgItem
) const
148 const Sequence
< OUString
> aNames( GetPropertyNames() );
149 Sequence
< Any
> aValues( aNames
.getLength() );
151 if( aNames
.getLength() && ( aValues
.getLength() == aNames
.getLength() ) )
153 if( (const_cast<SdOptionsGeneric
*>(this))->WriteData( aValues
.getArray() ) )
154 rCfgItem
.PutProperties( aNames
, aValues
);
157 OSL_FAIL( "PutProperties failed" );
162 // -----------------------------------------------------------------------------
164 Sequence
< OUString
> SdOptionsGeneric::GetPropertyNames() const
167 const char** ppPropNames
;
169 GetPropNameArray( ppPropNames
, nCount
);
171 Sequence
< OUString
> aNames( nCount
);
172 OUString
* pNames
= aNames
.getArray();
174 for( sal_uLong i
= 0; i
< nCount
; i
++ )
175 pNames
[ i
] = OUString::createFromAscii( ppPropNames
[ i
] );
180 // -----------------------------------------------------------------------------
182 void SdOptionsGeneric::Store()
188 // -----------------------------------------------------------------------------
190 bool SdOptionsGeneric::isMetricSystem()
192 SvtSysLocale aSysLocale
;
193 MeasurementSystem eSys
= aSysLocale
.GetLocaleDataPtr()->getMeasurementSystemEnum();
195 return ( eSys
== MEASURE_METRIC
);
198 /*************************************************************************
202 \************************************************************************/
204 SdOptionsLayout::SdOptionsLayout( sal_uInt16 nConfigId
, sal_Bool bUseConfig
) :
205 SdOptionsGeneric( nConfigId
, bUseConfig
?
206 ( ( SDCFG_DRAW
== nConfigId
) ?
207 B2U( "Office.Draw/Layout" ) :
208 B2U( "Office.Impress/Layout" ) ) :
211 bMoveOutline( sal_True
),
212 bDragStripes( sal_False
),
213 bHandlesBezier( sal_False
),
214 bHelplines( sal_True
),
215 nMetric((sal_uInt16
)(isMetricSystem() ? FUNIT_CM
: FUNIT_INCH
)),
218 EnableModify( sal_True
);
221 // -----------------------------------------------------------------------------
223 sal_Bool
SdOptionsLayout::operator==( const SdOptionsLayout
& rOpt
) const
225 return( IsRulerVisible() == rOpt
.IsRulerVisible() &&
226 IsMoveOutline() == rOpt
.IsMoveOutline() &&
227 IsDragStripes() == rOpt
.IsDragStripes() &&
228 IsHandlesBezier() == rOpt
.IsHandlesBezier() &&
229 IsHelplines() == rOpt
.IsHelplines() &&
230 GetMetric() == rOpt
.GetMetric() &&
231 GetDefTab() == rOpt
.GetDefTab() );
234 // -----------------------------------------------------------------------------
236 void SdOptionsLayout::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
238 static const char* aPropNamesMetric
[] =
245 "Other/MeasureUnit/Metric",
246 "Other/TabStop/Metric"
249 static const char* aPropNamesNonMetric
[] =
256 "Other/MeasureUnit/NonMetric",
257 "Other/TabStop/NonMetric"
262 if( isMetricSystem() )
263 ppNames
= aPropNamesMetric
;
265 ppNames
= aPropNamesNonMetric
;
268 // -----------------------------------------------------------------------------
270 sal_Bool
SdOptionsLayout::ReadData( const Any
* pValues
)
272 if( pValues
[0].hasValue() ) SetRulerVisible( *(sal_Bool
*) pValues
[ 0 ].getValue() );
273 if( pValues
[1].hasValue() ) SetHandlesBezier( *(sal_Bool
*) pValues
[ 1 ].getValue() );
274 if( pValues
[2].hasValue() ) SetMoveOutline( *(sal_Bool
*) pValues
[ 2 ].getValue() );
275 if( pValues
[3].hasValue() ) SetDragStripes( *(sal_Bool
*) pValues
[ 3 ].getValue() );
276 if( pValues
[4].hasValue() ) SetHelplines( *(sal_Bool
*) pValues
[ 4 ].getValue() );
277 if( pValues
[5].hasValue() ) SetMetric( (sal_uInt16
) *(sal_Int32
*) pValues
[ 5 ].getValue() );
278 if( pValues
[6].hasValue() ) SetDefTab( (sal_uInt16
) *(sal_Int32
*) pValues
[ 6 ].getValue() );
283 // -----------------------------------------------------------------------------
285 sal_Bool
SdOptionsLayout::WriteData( Any
* pValues
) const
287 pValues
[ 0 ] <<= IsRulerVisible();
288 pValues
[ 1 ] <<= IsHandlesBezier();
289 pValues
[ 2 ] <<= IsMoveOutline();
290 pValues
[ 3 ] <<= IsDragStripes();
291 pValues
[ 4 ] <<= IsHelplines();
292 pValues
[ 5 ] <<= (sal_Int32
) GetMetric();
293 pValues
[ 6 ] <<= (sal_Int32
) GetDefTab();
298 /*************************************************************************
300 |* SdOptionsLayoutItem
302 \************************************************************************/
304 SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich
)
305 : SfxPoolItem ( _nWhich
)
306 , maOptionsLayout ( 0, sal_False
)
310 // ----------------------------------------------------------------------
312 SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
)
313 : SfxPoolItem ( _nWhich
)
314 , maOptionsLayout ( 0, sal_False
)
318 maOptionsLayout
.SetMetric( pOpts
->GetMetric() );
319 maOptionsLayout
.SetDefTab( pOpts
->GetDefTab() );
324 maOptionsLayout
.SetRulerVisible( pView
->HasRuler() );
325 maOptionsLayout
.SetMoveOutline( !pView
->IsNoDragXorPolys() );
326 maOptionsLayout
.SetDragStripes( pView
->IsDragStripes() );
327 maOptionsLayout
.SetHandlesBezier( pView
->IsPlusHandlesAlwaysVisible() );
328 maOptionsLayout
.SetHelplines( pView
->IsHlplVisible() );
332 maOptionsLayout
.SetRulerVisible( pOpts
->IsRulerVisible() );
333 maOptionsLayout
.SetMoveOutline( pOpts
->IsMoveOutline() );
334 maOptionsLayout
.SetDragStripes( pOpts
->IsDragStripes() );
335 maOptionsLayout
.SetHandlesBezier( pOpts
->IsHandlesBezier() );
336 maOptionsLayout
.SetHelplines( pOpts
->IsHelplines() );
340 // ----------------------------------------------------------------------
342 SfxPoolItem
* SdOptionsLayoutItem::Clone( SfxItemPool
* ) const
344 return new SdOptionsLayoutItem( *this );
348 // ----------------------------------------------------------------------
350 int SdOptionsLayoutItem::operator==( const SfxPoolItem
& rAttr
) const
352 const bool bSameType
= SfxPoolItem::operator==( rAttr
);
353 DBG_ASSERT( bSameType
, "SdOptionsLayoutItem::operator==(), different pool item type!" );
354 return bSameType
&& ( maOptionsLayout
== static_cast< const SdOptionsLayoutItem
& >( rAttr
).maOptionsLayout
);
357 // -----------------------------------------------------------------------
359 void SdOptionsLayoutItem::SetOptions( SdOptions
* pOpts
) const
363 pOpts
->SetRulerVisible( maOptionsLayout
.IsRulerVisible() );
364 pOpts
->SetMoveOutline( maOptionsLayout
.IsMoveOutline() );
365 pOpts
->SetDragStripes( maOptionsLayout
.IsDragStripes() );
366 pOpts
->SetHandlesBezier( maOptionsLayout
.IsHandlesBezier() );
367 pOpts
->SetHelplines( maOptionsLayout
.IsHelplines() );
368 pOpts
->SetMetric( maOptionsLayout
.GetMetric() );
369 pOpts
->SetDefTab( maOptionsLayout
.GetDefTab() );
373 /*************************************************************************
377 \************************************************************************/
379 SdOptionsContents::SdOptionsContents( sal_uInt16 nConfigId
, sal_Bool bUseConfig
) :
380 SdOptionsGeneric( nConfigId
, bUseConfig
?
381 ( ( SDCFG_DRAW
== nConfigId
) ?
382 B2U( "Office.Draw/Content" ) :
383 B2U( "Office.Impress/Content" ) ) :
386 EnableModify( sal_True
);
389 // -----------------------------------------------------------------------------
391 sal_Bool
SdOptionsContents::operator==(const SdOptionsContents
&) const
396 // -----------------------------------------------------------------------------
398 void SdOptionsContents::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
400 static const char* aPropNames
[] =
402 "Display/PicturePlaceholder",
403 "Display/ContourMode",
404 "Display/LineContour",
405 "Display/TextPlaceholder"
409 ppNames
= aPropNames
;
412 // -----------------------------------------------------------------------------
414 sal_Bool
SdOptionsContents::ReadData(const Any
*)
419 // -----------------------------------------------------------------------------
421 sal_Bool
SdOptionsContents::WriteData( Any
* pValues
) const
423 //#i80528# no draft anymore
424 pValues
[ 0 ] <<= (sal_Bool
)false;
425 pValues
[ 1 ] <<= (sal_Bool
)false;
426 pValues
[ 2 ] <<= (sal_Bool
)false;
427 pValues
[ 3 ] <<= (sal_Bool
)false;
432 /*************************************************************************
434 |* SdOptionsContentsItem
436 \************************************************************************/
438 SdOptionsContentsItem::SdOptionsContentsItem(sal_uInt16 _nWhich
, SdOptions
*, ::sd::FrameView
*)
439 : SfxPoolItem ( _nWhich
)
440 , maOptionsContents ( 0, sal_False
)
444 // ----------------------------------------------------------------------
446 SfxPoolItem
* SdOptionsContentsItem::Clone( SfxItemPool
* ) const
448 return new SdOptionsContentsItem( *this );
451 // ----------------------------------------------------------------------
453 int SdOptionsContentsItem::operator==( const SfxPoolItem
& rAttr
) const
455 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
456 DBG_ASSERT( bSameType
, "SdOptionsContentsItem::operator==(), different pool item type!" );
457 return bSameType
&& ( maOptionsContents
== static_cast<const SdOptionsContentsItem
&>( rAttr
).maOptionsContents
);
460 // -----------------------------------------------------------------------
462 void SdOptionsContentsItem::SetOptions(SdOptions
*) const
466 /*************************************************************************
470 \************************************************************************/
472 SdOptionsMisc::SdOptionsMisc( sal_uInt16 nConfigId
, sal_Bool bUseConfig
) :
473 SdOptionsGeneric( nConfigId
, bUseConfig
?
474 ( ( SDCFG_DRAW
== nConfigId
) ?
475 B2U( "Office.Draw/Misc" ) :
476 B2U( "Office.Impress/Misc" ) ) :
478 nDefaultObjectSizeWidth(8000),
479 nDefaultObjectSizeHeight(5000),
480 bStartWithTemplate( sal_False
),
481 bMarkedHitMovesAlways( sal_True
),
482 bMoveOnlyDragging( sal_False
),
483 bCrookNoContortion( sal_False
),
484 bQuickEdit( GetConfigId() != SDCFG_DRAW
),
485 bMasterPageCache( sal_True
),
486 bDragWithCopy( sal_False
),
487 bPickThrough( sal_True
),
488 bDoubleClickTextEdit( sal_True
),
489 bClickChangeRotation( sal_False
),
490 bStartWithActualPage( sal_False
),
491 bEnableSdremote( sal_False
),
492 bEnablePresenterScreen( sal_True
),
493 bSolidDragging( sal_True
),
494 bSummationOfParagraphs( sal_False
),
495 bShowUndoDeleteWarning( sal_True
),
496 bSlideshowRespectZOrder( sal_True
),
497 bShowComments( sal_True
),
498 bPreviewNewEffects( sal_True
),
499 bPreviewChangedEffects( sal_False
),
500 bPreviewTransitions( sal_True
),
502 mnPenColor( 0xff0000 ),
505 // The default for 6.1-and-above documents is to use printer-independent
507 mnPrinterIndependentLayout (1)
509 EnableModify( sal_True
);
512 // -----------------------------------------------------------------------------
514 sal_Bool
SdOptionsMisc::operator==( const SdOptionsMisc
& rOpt
) const
516 return( IsStartWithTemplate() == rOpt
.IsStartWithTemplate() &&
517 IsMarkedHitMovesAlways() == rOpt
.IsMarkedHitMovesAlways() &&
518 IsMoveOnlyDragging() == rOpt
.IsMoveOnlyDragging() &&
519 IsCrookNoContortion() == rOpt
.IsCrookNoContortion() &&
520 IsQuickEdit() == rOpt
.IsQuickEdit() &&
521 IsMasterPagePaintCaching() == rOpt
.IsMasterPagePaintCaching() &&
522 IsDragWithCopy() == rOpt
.IsDragWithCopy() &&
523 IsPickThrough() == rOpt
.IsPickThrough() &&
524 IsDoubleClickTextEdit() == rOpt
.IsDoubleClickTextEdit() &&
525 IsClickChangeRotation() == rOpt
.IsClickChangeRotation() &&
526 IsStartWithActualPage() == rOpt
.IsStartWithActualPage() &&
527 IsEnableSdremote() == rOpt
.IsEnableSdremote() &&
528 IsEnablePresenterScreen() == rOpt
.IsEnablePresenterScreen()&&
529 IsSummationOfParagraphs() == rOpt
.IsSummationOfParagraphs() &&
530 IsSolidDragging() == rOpt
.IsSolidDragging() &&
531 IsShowUndoDeleteWarning() == rOpt
.IsShowUndoDeleteWarning() &&
532 IsSlideshowRespectZOrder() == rOpt
.IsSlideshowRespectZOrder() &&
533 GetPrinterIndependentLayout() == rOpt
.GetPrinterIndependentLayout() &&
534 GetDefaultObjectSizeWidth() == rOpt
.GetDefaultObjectSizeWidth() &&
535 GetDefaultObjectSizeHeight() == rOpt
.GetDefaultObjectSizeHeight() &&
537 IsPreviewNewEffects() == rOpt
.IsPreviewNewEffects() &&
538 IsPreviewChangedEffects() == rOpt
.IsPreviewChangedEffects() &&
539 IsPreviewTransitions() == rOpt
.IsPreviewTransitions() &&
540 GetDisplay() == rOpt
.GetDisplay() &&
541 IsShowComments() == rOpt
.IsShowComments() &&
542 GetPresentationPenColor() == rOpt
.GetPresentationPenColor() &&
543 GetPresentationPenWidth() == rOpt
.GetPresentationPenWidth()
547 // -----------------------------------------------------------------------------
549 void SdOptionsMisc::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
551 static const char* aPropNames
[] =
555 "TextObject/QuickEditing",
558 "TextObject/Selectable",
562 "ModifyWithAttributes",
563 "DefaultObjectSize/Width",
564 "DefaultObjectSize/Height",
566 "Compatibility/PrinterIndependentLayout",
573 "Compatibility/AddBetween",
574 "ShowUndoDeleteWarning",
575 "SlideshowRespectZOrder",
578 "PreviewChangedEffects",
579 "PreviewTransitions",
585 "Start/EnableSdremote",
586 "Start/EnablePresenterScreen"
589 rCount
= ( ( GetConfigId() == SDCFG_IMPRESS
) ? 27 : 14 );
590 ppNames
= aPropNames
;
593 // -----------------------------------------------------------------------------
595 sal_Bool
SdOptionsMisc::ReadData( const Any
* pValues
)
597 if( pValues
[0].hasValue() ) SetMarkedHitMovesAlways( *(sal_Bool
*) pValues
[ 0 ].getValue() );
598 if( pValues
[1].hasValue() ) SetCrookNoContortion( *(sal_Bool
*) pValues
[ 1 ].getValue() );
599 if( pValues
[2].hasValue() ) SetQuickEdit( *(sal_Bool
*)pValues
[ 2 ].getValue() );
600 if( pValues
[3].hasValue() ) SetMasterPagePaintCaching( *(sal_Bool
*) pValues
[ 3 ].getValue() );
601 if( pValues
[4].hasValue() ) SetDragWithCopy( *(sal_Bool
*) pValues
[ 4 ].getValue() );
602 if( pValues
[5].hasValue() ) SetPickThrough( *(sal_Bool
*) pValues
[ 5 ].getValue() );
603 if( pValues
[6].hasValue() ) SetDoubleClickTextEdit( *(sal_Bool
*) pValues
[ 6 ].getValue() );
604 if( pValues
[7].hasValue() ) SetClickChangeRotation( *(sal_Bool
*) pValues
[ 7 ].getValue() );
605 if( pValues
[9].hasValue() ) SetSolidDragging( *(sal_Bool
*) pValues
[ 9 ].getValue() );
606 if( pValues
[10].hasValue() ) SetDefaultObjectSizeWidth( *(sal_uInt32
*) pValues
[ 10 ].getValue() );
607 if( pValues
[11].hasValue() ) SetDefaultObjectSizeHeight( *(sal_uInt32
*) pValues
[ 11 ].getValue() );
608 if( pValues
[12].hasValue() ) SetPrinterIndependentLayout( *(sal_uInt16
*) pValues
[ 12 ].getValue() );
610 if( pValues
[13].hasValue() )
611 SetShowComments( *(sal_Bool
*) pValues
[ 13 ].getValue() );
614 if( GetConfigId() == SDCFG_IMPRESS
)
616 if( pValues
[14].hasValue() )
617 SetStartWithTemplate( *(sal_Bool
*) pValues
[ 14 ].getValue() );
618 if( pValues
[15].hasValue() )
619 SetStartWithActualPage( *(sal_Bool
*) pValues
[ 15 ].getValue() );
620 if( pValues
[16].hasValue() )
621 SetSummationOfParagraphs( *(sal_Bool
*) pValues
[ 16 ].getValue() );
622 if( pValues
[17].hasValue() )
623 SetShowUndoDeleteWarning( *(sal_Bool
*) pValues
[ 17 ].getValue() );
625 if( pValues
[18].hasValue() )
626 SetSlideshowRespectZOrder(*(sal_Bool
*) pValues
[ 18 ].getValue());
628 if( pValues
[19].hasValue() )
629 SetPreviewNewEffects(*(sal_Bool
*) pValues
[ 19 ].getValue());
631 if( pValues
[20].hasValue() )
632 SetPreviewChangedEffects(*(sal_Bool
*) pValues
[ 20 ].getValue());
634 if( pValues
[21].hasValue() )
635 SetPreviewTransitions(*(sal_Bool
*) pValues
[ 21 ].getValue());
637 if( pValues
[22].hasValue() )
638 SetDisplay(*(sal_Int32
*) pValues
[ 22 ].getValue());
640 if( pValues
[23].hasValue() )
641 SetPresentationPenColor( getSafeValue
< sal_Int32
>( pValues
[ 23 ] ) );
643 if( pValues
[24].hasValue() )
644 SetPresentationPenWidth( getSafeValue
< double >( pValues
[ 24 ] ) );
646 if( pValues
[25].hasValue() )
647 SetEnableSdremote( *(sal_Bool
*) pValues
[ 25 ].getValue() );
649 if( pValues
[26].hasValue() )
650 SetEnablePresenterScreen( *(sal_Bool
*) pValues
[ 26 ].getValue() );
656 // -----------------------------------------------------------------------------
658 sal_Bool
SdOptionsMisc::WriteData( Any
* pValues
) const
660 pValues
[ 0 ] <<= IsMarkedHitMovesAlways();
661 pValues
[ 1 ] <<= IsCrookNoContortion();
662 pValues
[ 2 ] <<= IsQuickEdit();
663 pValues
[ 3 ] <<= IsMasterPagePaintCaching();
664 pValues
[ 4 ] <<= IsDragWithCopy();
665 pValues
[ 5 ] <<= IsPickThrough();
666 pValues
[ 6 ] <<= IsDoubleClickTextEdit();
667 pValues
[ 7 ] <<= IsClickChangeRotation();
668 // The preview is not supported anymore. Use a dummy value.
669 pValues
[ 8 ] <<= (double)0;// GetPreviewQuality();
670 pValues
[ 9 ] <<= IsSolidDragging();
671 pValues
[ 10 ] <<= GetDefaultObjectSizeWidth();
672 pValues
[ 11 ] <<= GetDefaultObjectSizeHeight();
673 pValues
[ 12 ] <<= GetPrinterIndependentLayout();
674 pValues
[ 13 ] <<= (sal_Bool
)IsShowComments();
677 if( GetConfigId() == SDCFG_IMPRESS
)
679 pValues
[ 14 ] <<= IsStartWithTemplate();
680 pValues
[ 15 ] <<= IsStartWithActualPage();
681 pValues
[ 16 ] <<= IsSummationOfParagraphs();
682 pValues
[ 17 ] <<= IsShowUndoDeleteWarning();
683 pValues
[ 18 ] <<= IsSlideshowRespectZOrder();
685 pValues
[ 19 ] <<= IsPreviewNewEffects();
686 pValues
[ 20 ] <<= IsPreviewChangedEffects();
687 pValues
[ 21 ] <<= IsPreviewTransitions();
689 pValues
[ 22 ] <<= GetDisplay();
691 pValues
[ 23 ] <<= GetPresentationPenColor();
692 pValues
[ 24 ] <<= GetPresentationPenWidth();
693 pValues
[ 25 ] <<= IsEnableSdremote();
694 pValues
[ 26 ] <<= IsEnablePresenterScreen();
700 /*************************************************************************
704 \************************************************************************/
706 SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich
)
707 : SfxPoolItem ( _nWhich
)
708 , maOptionsMisc ( 0, sal_False
)
712 // ----------------------------------------------------------------------
714 SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
)
715 : SfxPoolItem ( _nWhich
)
716 , maOptionsMisc ( 0, sal_False
)
720 maOptionsMisc
.SetStartWithTemplate( pOpts
->IsStartWithTemplate() );
721 maOptionsMisc
.SetStartWithActualPage( pOpts
->IsStartWithActualPage() );
722 maOptionsMisc
.SetEnableSdremote( pOpts
->IsEnableSdremote() );
723 maOptionsMisc
.SetEnablePresenterScreen( pOpts
->IsEnablePresenterScreen() );
724 maOptionsMisc
.SetSummationOfParagraphs( pOpts
->IsSummationOfParagraphs() );
725 maOptionsMisc
.SetShowUndoDeleteWarning( pOpts
->IsShowUndoDeleteWarning() );
726 maOptionsMisc
.SetPrinterIndependentLayout( pOpts
->GetPrinterIndependentLayout() );
727 maOptionsMisc
.SetDefaultObjectSizeWidth( pOpts
->GetDefaultObjectSizeWidth() );
728 maOptionsMisc
.SetDefaultObjectSizeHeight( pOpts
->GetDefaultObjectSizeHeight() );
730 maOptionsMisc
.SetPreviewNewEffects(pOpts
->IsPreviewNewEffects());
731 maOptionsMisc
.SetPreviewChangedEffects(pOpts
->IsPreviewChangedEffects());
732 maOptionsMisc
.SetPreviewTransitions(pOpts
->IsPreviewTransitions());
734 maOptionsMisc
.SetDisplay(pOpts
->GetDisplay());
735 maOptionsMisc
.SetShowComments( pOpts
->IsShowComments() );
737 maOptionsMisc
.SetPresentationPenColor(pOpts
->GetPresentationPenColor() );
738 maOptionsMisc
.SetPresentationPenWidth(pOpts
->GetPresentationPenWidth() );
743 maOptionsMisc
.SetMarkedHitMovesAlways( pView
->IsMarkedHitMovesAlways() );
744 maOptionsMisc
.SetMoveOnlyDragging( pView
->IsMoveOnlyDragging() );
745 maOptionsMisc
.SetCrookNoContortion( pView
->IsCrookNoContortion() );
746 maOptionsMisc
.SetQuickEdit( pView
->IsQuickEdit() );
749 maOptionsMisc
.SetMasterPagePaintCaching( pView
->IsMasterPagePaintCaching() );
751 maOptionsMisc
.SetDragWithCopy( pView
->IsDragWithCopy() );
752 maOptionsMisc
.SetPickThrough( (sal_Bool
)pView
->GetModel()->IsPickThroughTransparentTextFrames() );
753 maOptionsMisc
.SetDoubleClickTextEdit( pView
->IsDoubleClickTextEdit() );
754 maOptionsMisc
.SetClickChangeRotation( pView
->IsClickChangeRotation() );
755 maOptionsMisc
.SetSolidDragging( pView
->IsSolidDragging() );
759 maOptionsMisc
.SetMarkedHitMovesAlways( pOpts
->IsMarkedHitMovesAlways() );
760 maOptionsMisc
.SetMoveOnlyDragging( pOpts
->IsMoveOnlyDragging() );
761 maOptionsMisc
.SetCrookNoContortion( pOpts
->IsCrookNoContortion() );
762 maOptionsMisc
.SetQuickEdit( pOpts
->IsQuickEdit() );
763 maOptionsMisc
.SetMasterPagePaintCaching( pOpts
->IsMasterPagePaintCaching() );
764 maOptionsMisc
.SetDragWithCopy( pOpts
->IsDragWithCopy() );
765 maOptionsMisc
.SetPickThrough( pOpts
->IsPickThrough() );
766 maOptionsMisc
.SetDoubleClickTextEdit( pOpts
->IsDoubleClickTextEdit() );
767 maOptionsMisc
.SetClickChangeRotation( pOpts
->IsClickChangeRotation() );
768 maOptionsMisc
.SetSolidDragging( pOpts
->IsSolidDragging() );
772 // ----------------------------------------------------------------------
774 SfxPoolItem
* SdOptionsMiscItem::Clone( SfxItemPool
* ) const
776 return new SdOptionsMiscItem( *this );
780 // ----------------------------------------------------------------------
782 int SdOptionsMiscItem::operator==( const SfxPoolItem
& rAttr
) const
784 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
785 DBG_ASSERT( bSameType
, "SdOptionsMiscItem::operator==(), different pool item type!" );
786 return bSameType
&& ( maOptionsMisc
== static_cast< const SdOptionsMiscItem
& >(rAttr
).maOptionsMisc
);
789 // -----------------------------------------------------------------------
791 void SdOptionsMiscItem::SetOptions( SdOptions
* pOpts
) const
795 pOpts
->SetStartWithTemplate( maOptionsMisc
.IsStartWithTemplate() );
796 pOpts
->SetMarkedHitMovesAlways( maOptionsMisc
.IsMarkedHitMovesAlways() );
797 pOpts
->SetMoveOnlyDragging( maOptionsMisc
.IsMoveOnlyDragging() );
798 pOpts
->SetCrookNoContortion( maOptionsMisc
.IsCrookNoContortion() );
799 pOpts
->SetQuickEdit( maOptionsMisc
.IsQuickEdit() );
800 pOpts
->SetMasterPagePaintCaching( maOptionsMisc
.IsMasterPagePaintCaching() );
801 pOpts
->SetDragWithCopy( maOptionsMisc
.IsDragWithCopy() );
802 pOpts
->SetPickThrough( maOptionsMisc
.IsPickThrough() );
803 pOpts
->SetDoubleClickTextEdit( maOptionsMisc
.IsDoubleClickTextEdit() );
804 pOpts
->SetClickChangeRotation( maOptionsMisc
.IsClickChangeRotation() );
805 pOpts
->SetStartWithActualPage( maOptionsMisc
.IsStartWithActualPage() );
806 pOpts
->SetEnableSdremote( maOptionsMisc
.IsEnableSdremote() );
807 pOpts
->SetEnablePresenterScreen( maOptionsMisc
.IsEnablePresenterScreen() );
808 pOpts
->SetSummationOfParagraphs( maOptionsMisc
.IsSummationOfParagraphs() );
809 pOpts
->SetSolidDragging( maOptionsMisc
.IsSolidDragging() );
810 pOpts
->SetShowUndoDeleteWarning( maOptionsMisc
.IsShowUndoDeleteWarning() );
811 pOpts
->SetPrinterIndependentLayout( maOptionsMisc
.GetPrinterIndependentLayout() );
812 pOpts
->SetShowComments( maOptionsMisc
.IsShowComments() );
813 pOpts
->SetDefaultObjectSizeWidth( maOptionsMisc
.GetDefaultObjectSizeWidth() );
814 pOpts
->SetDefaultObjectSizeHeight( maOptionsMisc
.GetDefaultObjectSizeHeight() );
816 pOpts
->SetPreviewNewEffects( maOptionsMisc
.IsPreviewNewEffects() );
817 pOpts
->SetPreviewChangedEffects( maOptionsMisc
.IsPreviewChangedEffects() );
818 pOpts
->SetPreviewTransitions( maOptionsMisc
.IsPreviewTransitions() );
820 pOpts
->SetDisplay( maOptionsMisc
.GetDisplay() );
822 pOpts
->SetPresentationPenColor( maOptionsMisc
.GetPresentationPenColor() );
823 pOpts
->SetPresentationPenWidth( maOptionsMisc
.GetPresentationPenWidth() );
827 /*************************************************************************
831 \************************************************************************/
833 SdOptionsSnap::SdOptionsSnap( sal_uInt16 nConfigId
, sal_Bool bUseConfig
) :
834 SdOptionsGeneric( nConfigId
, bUseConfig
?
835 ( ( SDCFG_DRAW
== nConfigId
) ?
836 B2U( "Office.Draw/Snap" ) :
837 B2U( "Office.Impress/Snap" ) ) :
839 bSnapHelplines( sal_True
),
840 bSnapBorder( sal_True
),
841 bSnapFrame( sal_False
),
842 bSnapPoints( sal_False
),
844 bBigOrtho( sal_True
),
845 bRotate( sal_False
),
851 EnableModify( sal_True
);
854 // -----------------------------------------------------------------------------
856 sal_Bool
SdOptionsSnap::operator==( const SdOptionsSnap
& rOpt
) const
858 return( IsSnapHelplines() == rOpt
.IsSnapHelplines() &&
859 IsSnapBorder() == rOpt
.IsSnapBorder() &&
860 IsSnapFrame() == rOpt
.IsSnapFrame() &&
861 IsSnapPoints() == rOpt
.IsSnapPoints() &&
862 IsOrtho() == rOpt
.IsOrtho() &&
863 IsBigOrtho() == rOpt
.IsBigOrtho() &&
864 IsRotate() == rOpt
.IsRotate() &&
865 GetSnapArea() == rOpt
.GetSnapArea() &&
866 GetAngle() == rOpt
.GetAngle() &&
867 GetEliminatePolyPointLimitAngle() == rOpt
.GetEliminatePolyPointLimitAngle() );
870 // -----------------------------------------------------------------------------
872 void SdOptionsSnap::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
874 static const char* aPropNames
[] =
878 "Object/ObjectFrame",
879 "Object/ObjectPoint",
880 "Position/CreatingMoving",
881 "Position/ExtendEdges",
884 "Position/RotatingValue",
885 "Position/PointReduction"
889 ppNames
= aPropNames
;
892 // -----------------------------------------------------------------------------
894 sal_Bool
SdOptionsSnap::ReadData( const Any
* pValues
)
896 if( pValues
[0].hasValue() ) SetSnapHelplines( *(sal_Bool
*) pValues
[ 0 ].getValue() );
897 if( pValues
[1].hasValue() ) SetSnapBorder( *(sal_Bool
*)pValues
[ 1 ].getValue() );
898 if( pValues
[2].hasValue() ) SetSnapFrame( *(sal_Bool
*) pValues
[ 2 ].getValue() );
899 if( pValues
[3].hasValue() ) SetSnapPoints( *(sal_Bool
*) pValues
[ 3 ].getValue() );
900 if( pValues
[4].hasValue() ) SetOrtho( *(sal_Bool
*) pValues
[ 4 ].getValue() );
901 if( pValues
[5].hasValue() ) SetBigOrtho( *(sal_Bool
*) pValues
[ 5 ].getValue() );
902 if( pValues
[6].hasValue() ) SetRotate( *(sal_Bool
*) pValues
[ 6 ].getValue() );
903 if( pValues
[7].hasValue() ) SetSnapArea( (sal_Int16
) *(sal_Int32
*) pValues
[ 7 ].getValue() );
904 if( pValues
[8].hasValue() ) SetAngle( (sal_Int16
) *(sal_Int32
*) pValues
[ 8 ].getValue() );
905 if( pValues
[9].hasValue() ) SetEliminatePolyPointLimitAngle( (sal_Int16
) *(sal_Int32
*) pValues
[ 9 ].getValue() );
910 // -----------------------------------------------------------------------------
912 sal_Bool
SdOptionsSnap::WriteData( Any
* pValues
) const
914 pValues
[ 0 ] <<= IsSnapHelplines();
915 pValues
[ 1 ] <<= IsSnapBorder();
916 pValues
[ 2 ] <<= IsSnapFrame();
917 pValues
[ 3 ] <<= IsSnapPoints();
918 pValues
[ 4 ] <<= IsOrtho();
919 pValues
[ 5 ] <<= IsBigOrtho();
920 pValues
[ 6 ] <<= IsRotate();
921 pValues
[ 7 ] <<= (sal_Int32
) GetSnapArea();
922 pValues
[ 8 ] <<= (sal_Int32
) GetAngle();
923 pValues
[ 9 ] <<= (sal_Int32
) GetEliminatePolyPointLimitAngle();
928 /*************************************************************************
932 \************************************************************************/
934 SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich
)
935 : SfxPoolItem ( _nWhich
)
936 , maOptionsSnap ( 0, sal_False
)
940 // ----------------------------------------------------------------------
942 SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
)
943 : SfxPoolItem ( _nWhich
)
944 , maOptionsSnap ( 0, sal_False
)
948 maOptionsSnap
.SetSnapHelplines( pView
->IsHlplSnap() );
949 maOptionsSnap
.SetSnapBorder( pView
->IsBordSnap() );
950 maOptionsSnap
.SetSnapFrame( pView
->IsOFrmSnap() );
951 maOptionsSnap
.SetSnapPoints( pView
->IsOPntSnap() );
952 maOptionsSnap
.SetOrtho( pView
->IsOrtho() );
953 maOptionsSnap
.SetBigOrtho( pView
->IsBigOrtho() );
954 maOptionsSnap
.SetRotate( pView
->IsAngleSnapEnabled() );
955 maOptionsSnap
.SetSnapArea( pView
->GetSnapMagneticPixel() );
956 maOptionsSnap
.SetAngle( (sal_Int16
) pView
->GetSnapAngle() );
957 maOptionsSnap
.SetEliminatePolyPointLimitAngle( (sal_Int16
) pView
->GetEliminatePolyPointLimitAngle() );
961 maOptionsSnap
.SetSnapHelplines( pOpts
->IsSnapHelplines() );
962 maOptionsSnap
.SetSnapBorder( pOpts
->IsSnapBorder() );
963 maOptionsSnap
.SetSnapFrame( pOpts
->IsSnapFrame() );
964 maOptionsSnap
.SetSnapPoints( pOpts
->IsSnapPoints() );
965 maOptionsSnap
.SetOrtho( pOpts
->IsOrtho() );
966 maOptionsSnap
.SetBigOrtho( pOpts
->IsBigOrtho() );
967 maOptionsSnap
.SetRotate( pOpts
->IsRotate() );
968 maOptionsSnap
.SetSnapArea( pOpts
->GetSnapArea() );
969 maOptionsSnap
.SetAngle( pOpts
->GetAngle() );
970 maOptionsSnap
.SetEliminatePolyPointLimitAngle( pOpts
->GetEliminatePolyPointLimitAngle() );
974 // ----------------------------------------------------------------------
976 SfxPoolItem
* SdOptionsSnapItem::Clone( SfxItemPool
* ) const
978 return new SdOptionsSnapItem( *this );
982 // ----------------------------------------------------------------------
984 int SdOptionsSnapItem::operator==( const SfxPoolItem
& rAttr
) const
986 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
987 DBG_ASSERT( bSameType
, "SdOptionsSnapItem::operator==(), different pool item type!" );
988 return bSameType
&& ( maOptionsSnap
== static_cast< const SdOptionsSnapItem
& >(rAttr
).maOptionsSnap
);
991 // -----------------------------------------------------------------------
993 void SdOptionsSnapItem::SetOptions( SdOptions
* pOpts
) const
997 pOpts
->SetSnapHelplines( maOptionsSnap
.IsSnapHelplines() );
998 pOpts
->SetSnapBorder( maOptionsSnap
.IsSnapBorder() );
999 pOpts
->SetSnapFrame( maOptionsSnap
.IsSnapFrame() );
1000 pOpts
->SetSnapPoints( maOptionsSnap
.IsSnapPoints() );
1001 pOpts
->SetOrtho( maOptionsSnap
.IsOrtho() );
1002 pOpts
->SetBigOrtho( maOptionsSnap
.IsBigOrtho() );
1003 pOpts
->SetRotate( maOptionsSnap
.IsRotate() );
1004 pOpts
->SetSnapArea( maOptionsSnap
.GetSnapArea() );
1005 pOpts
->SetAngle( maOptionsSnap
.GetAngle() );
1006 pOpts
->SetEliminatePolyPointLimitAngle( maOptionsSnap
.GetEliminatePolyPointLimitAngle() );
1010 /*************************************************************************
1014 \************************************************************************/
1016 SdOptionsZoom::SdOptionsZoom( sal_uInt16 nConfigId
, sal_Bool bUseConfig
) :
1017 SdOptionsGeneric( nConfigId
, ( bUseConfig
&& ( SDCFG_DRAW
== nConfigId
) ) ?
1018 B2U( "Office.Draw/Zoom" ) :
1024 EnableModify( sal_True
);
1027 // -----------------------------------------------------------------------------
1029 sal_Bool
SdOptionsZoom::operator==( const SdOptionsZoom
& rOpt
) const
1031 sal_Int32 nX1
, nX2
, nY1
, nY2
;
1033 GetScale( nX1
, nY1
);
1034 rOpt
.GetScale( nX2
, nY2
);
1036 return( ( nX1
== nX2
) &&
1040 // -----------------------------------------------------------------------------
1042 void SdOptionsZoom::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
1044 static const char* aPropNames
[] =
1050 rCount
= ( GetConfigId() == SDCFG_DRAW
) ? 2 : 0;
1051 ppNames
= aPropNames
;
1054 // -----------------------------------------------------------------------------
1056 sal_Bool
SdOptionsZoom::ReadData( const Any
* pValues
)
1058 sal_Int32 x
= 1, y
= 1;
1060 if( pValues
[0].hasValue() ) x
= ( *(sal_Int32
*) pValues
[ 0 ].getValue() );
1061 if( pValues
[1].hasValue() ) y
= ( *(sal_Int32
*) pValues
[ 1 ].getValue() );
1068 // -----------------------------------------------------------------------------
1070 sal_Bool
SdOptionsZoom::WriteData( Any
* pValues
) const
1076 pValues
[ 0 ] <<= (sal_Int32
) x
;
1077 pValues
[ 1 ] <<= (sal_Int32
) y
;
1082 /*************************************************************************
1086 \************************************************************************/
1088 SdOptionsGrid::SdOptionsGrid( sal_uInt16 nConfigId
, sal_Bool bUseConfig
) :
1089 SdOptionsGeneric( nConfigId
, bUseConfig
?
1090 ( ( SDCFG_DRAW
== nConfigId
) ?
1091 B2U( "Office.Draw/Grid" ) :
1092 B2U( "Office.Impress/Grid" ) ) :
1095 EnableModify( sal_False
);
1097 EnableModify( sal_True
);
1100 // -----------------------------------------------------------------------------
1102 SdOptionsGrid::~SdOptionsGrid()
1106 // -----------------------------------------------------------------------------
1108 void SdOptionsGrid::SetDefaults()
1110 const sal_uInt32 nVal
= 1000;
1112 SetFldDivisionX( nVal
);
1113 SetFldDivisionY( nVal
);
1114 SetFldDrawX( nVal
);
1115 SetFldDrawY( nVal
);
1116 SetFldSnapX( nVal
);
1117 SetFldSnapY( nVal
);
1118 SetUseGridSnap( sal_False
);
1119 SetSynchronize( sal_True
);
1120 SetGridVisible( sal_False
);
1121 SetEqualGrid( sal_True
);
1124 // -----------------------------------------------------------------------------
1126 sal_Bool
SdOptionsGrid::operator==( const SdOptionsGrid
& rOpt
) const
1128 return( GetFldDrawX() == rOpt
.GetFldDrawX() &&
1129 GetFldDivisionX() == rOpt
.GetFldDivisionX() &&
1130 GetFldDrawY() == rOpt
.GetFldDrawY() &&
1131 GetFldDivisionY() == rOpt
.GetFldDivisionY() &&
1132 GetFldSnapX() == rOpt
.GetFldSnapX() &&
1133 GetFldSnapY() == rOpt
.GetFldSnapY() &&
1134 IsUseGridSnap() == rOpt
.IsUseGridSnap() &&
1135 IsSynchronize() == rOpt
.IsSynchronize() &&
1136 IsGridVisible() == rOpt
.IsGridVisible() &&
1137 IsEqualGrid() == rOpt
.IsEqualGrid() );
1140 // -----------------------------------------------------------------------------
1142 void SdOptionsGrid::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
1144 static const char* aPropNamesMetric
[] =
1146 "Resolution/XAxis/Metric",
1147 "Resolution/YAxis/Metric",
1148 "Subdivision/XAxis",
1149 "Subdivision/YAxis",
1150 "SnapGrid/XAxis/Metric",
1151 "SnapGrid/YAxis/Metric",
1152 "Option/SnapToGrid",
1153 "Option/Synchronize",
1154 "Option/VisibleGrid",
1158 static const char* aPropNamesNonMetric
[] =
1160 "Resolution/XAxis/NonMetric",
1161 "Resolution/YAxis/NonMetric",
1162 "Subdivision/XAxis",
1163 "Subdivision/YAxis",
1164 "SnapGrid/XAxis/NonMetric",
1165 "SnapGrid/YAxis/NonMetric",
1166 "Option/SnapToGrid",
1167 "Option/Synchronize",
1168 "Option/VisibleGrid",
1174 if( isMetricSystem() )
1175 ppNames
= aPropNamesMetric
;
1177 ppNames
= aPropNamesNonMetric
;
1180 // -----------------------------------------------------------------------------
1182 sal_Bool
SdOptionsGrid::ReadData( const Any
* pValues
)
1184 if( pValues
[0].hasValue() ) SetFldDrawX( *(sal_Int32
*) pValues
[ 0 ].getValue() );
1185 if( pValues
[1].hasValue() ) SetFldDrawY( *(sal_Int32
*) pValues
[ 1 ].getValue() );
1187 if( pValues
[2].hasValue() )
1189 const sal_uInt32 nDivX
= FRound( *(double*) pValues
[ 2 ].getValue() );
1190 SetFldDivisionX( SvxOptionsGrid::GetFldDrawX() / ( nDivX
+ 1 ) );
1193 if( pValues
[3].hasValue() )
1195 const sal_uInt32 nDivY
= FRound( *(double*) pValues
[ 3 ].getValue() );
1196 SetFldDivisionY( SvxOptionsGrid::GetFldDrawY() / ( nDivY
+ 1 ) );
1199 if( pValues
[4].hasValue() ) SetFldSnapX( *(sal_Int32
*) pValues
[ 4 ].getValue() );
1200 if( pValues
[5].hasValue() ) SetFldSnapY( *(sal_Int32
*) pValues
[ 5 ].getValue() );
1201 if( pValues
[6].hasValue() ) SetUseGridSnap( *(sal_Bool
*) pValues
[ 6 ].getValue() );
1202 if( pValues
[7].hasValue() ) SetSynchronize( *(sal_Bool
*) pValues
[ 7 ].getValue() );
1203 if( pValues
[8].hasValue() ) SetGridVisible( *(sal_Bool
*) pValues
[ 8 ].getValue() );
1204 if( pValues
[9].hasValue() ) SetEqualGrid( *(sal_Bool
*) pValues
[ 9 ].getValue() );
1209 // -----------------------------------------------------------------------------
1211 sal_Bool
SdOptionsGrid::WriteData( Any
* pValues
) const
1213 pValues
[ 0 ] <<= (sal_Int32
) GetFldDrawX();
1214 pValues
[ 1 ] <<= (sal_Int32
) GetFldDrawY();
1215 pValues
[ 2 ] <<= ( GetFldDivisionX() ? ( (double) GetFldDrawX() / GetFldDivisionX() - 1.0 ) : (double) 0 );
1216 pValues
[ 3 ] <<= ( GetFldDivisionY() ? ( (double) GetFldDrawY() / GetFldDivisionY() - 1.0 ) : (double) 0 );
1217 pValues
[ 4 ] <<= (sal_Int32
) GetFldSnapX();
1218 pValues
[ 5 ] <<= (sal_Int32
) GetFldSnapY();
1219 pValues
[ 6 ] <<= IsUseGridSnap();
1220 pValues
[ 7 ] <<= IsSynchronize();
1221 pValues
[ 8 ] <<= IsGridVisible();
1222 pValues
[ 9 ] <<= IsEqualGrid();
1227 /*************************************************************************
1229 |* SdOptionsGridItem
1231 \************************************************************************/
1233 SdOptionsGridItem::SdOptionsGridItem( sal_uInt16 _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* pView
) :
1234 SvxGridItem( _nWhich
)
1236 SetSynchronize( pOpts
->IsSynchronize() );
1237 SetEqualGrid( pOpts
->IsEqualGrid() );
1241 SetFldDrawX( pView
->GetGridCoarse().Width() );
1242 SetFldDrawY( pView
->GetGridCoarse().Height() );
1243 SetFldDivisionX( pView
->GetGridFine().Width() ? ( GetFldDrawX() / pView
->GetGridFine().Width() - 1 ) : 0 );
1244 SetFldDivisionY( pView
->GetGridFine().Height() ? ( GetFldDrawY() / pView
->GetGridFine().Height() - 1 ) : 0 );
1245 SetFldSnapX( long(pView
->GetSnapGridWidthX()) );
1246 SetFldSnapY( long(pView
->GetSnapGridWidthY()) );
1247 SetUseGridSnap( pView
->IsGridSnap() );
1248 SetGridVisible( pView
->IsGridVisible() );
1252 SetFldDrawX( pOpts
->GetFldDrawX() );
1253 SetFldDrawY( pOpts
->GetFldDrawY() );
1254 SetFldDivisionX( pOpts
->GetFldDivisionX() ? ( pOpts
->GetFldDrawX() / pOpts
->GetFldDivisionX() - 1 ) : 0 );
1255 SetFldDivisionY( pOpts
->GetFldDivisionY() ? ( pOpts
->GetFldDrawY() / pOpts
->GetFldDivisionY() - 1 ) : 0 );
1256 SetFldSnapX( pOpts
->GetFldSnapX() );
1257 SetFldSnapY( pOpts
->GetFldSnapY() );
1258 SetUseGridSnap( pOpts
->IsUseGridSnap() );
1259 SetGridVisible( pOpts
->IsGridVisible() );
1263 // -----------------------------------------------------------------------
1265 void SdOptionsGridItem::SetOptions( SdOptions
* pOpts
) const
1267 pOpts
->SetFldDrawX( GetFldDrawX() );
1268 pOpts
->SetFldDivisionX( GetFldDrawX() / ( GetFldDivisionX() + 1 ) );
1269 pOpts
->SetFldDrawY( GetFldDrawY() );
1270 pOpts
->SetFldDivisionY( GetFldDrawY() / ( GetFldDivisionY() + 1 ) );
1271 pOpts
->SetFldSnapX( GetFldSnapX() );
1272 pOpts
->SetFldSnapY( GetFldSnapY() );
1273 pOpts
->SetUseGridSnap( GetUseGridSnap() );
1274 pOpts
->SetSynchronize( GetSynchronize() );
1275 pOpts
->SetGridVisible( GetGridVisible() );
1276 pOpts
->SetEqualGrid( GetEqualGrid() );
1279 /*************************************************************************
1283 \************************************************************************/
1285 SdOptionsPrint::SdOptionsPrint( sal_uInt16 nConfigId
, sal_Bool bUseConfig
) :
1286 SdOptionsGeneric( nConfigId
, bUseConfig
?
1287 ( ( SDCFG_DRAW
== nConfigId
) ?
1288 B2U( "Office.Draw/Print" ) :
1289 B2U( "Office.Impress/Print" ) ) :
1292 bNotes( sal_False
),
1293 bHandout( sal_False
),
1294 bOutline( sal_False
),
1297 bPagename( sal_False
),
1298 bHiddenPages( sal_True
),
1299 bPagesize( sal_False
),
1300 bPagetile( sal_False
),
1301 bWarningPrinter( sal_True
),
1302 bWarningSize( sal_False
),
1303 bWarningOrientation( sal_False
),
1304 bBooklet( sal_False
),
1307 bCutPage( sal_False
),
1308 bPaperbin( sal_False
),
1309 mbHandoutHorizontal( sal_True
),
1310 mnHandoutPages( 6 ),
1313 EnableModify( sal_True
);
1316 // -----------------------------------------------------------------------------
1318 sal_Bool
SdOptionsPrint::operator==( const SdOptionsPrint
& rOpt
) const
1320 return( IsDraw() == rOpt
.IsDraw() &&
1321 IsNotes() == rOpt
.IsNotes() &&
1322 IsHandout() == rOpt
.IsHandout() &&
1323 IsOutline() == rOpt
.IsOutline() &&
1324 IsDate() == rOpt
.IsDate() &&
1325 IsTime() == rOpt
.IsTime() &&
1326 IsPagename() == rOpt
.IsPagename() &&
1327 IsHiddenPages() == rOpt
.IsHiddenPages() &&
1328 IsPagesize() == rOpt
.IsPagesize() &&
1329 IsPagetile() == rOpt
.IsPagetile() &&
1330 IsWarningPrinter() == rOpt
.IsWarningPrinter() &&
1331 IsWarningSize() == rOpt
.IsWarningSize() &&
1332 IsWarningOrientation() == rOpt
.IsWarningOrientation() &&
1333 IsBooklet() == rOpt
.IsBooklet() &&
1334 IsFrontPage() == rOpt
.IsFrontPage() &&
1335 IsBackPage() == rOpt
.IsBackPage() &&
1336 IsCutPage() == rOpt
.IsCutPage() &&
1337 IsPaperbin() == rOpt
.IsPaperbin() &&
1338 GetOutputQuality() == rOpt
.GetOutputQuality() &&
1339 IsHandoutHorizontal() == rOpt
.IsHandoutHorizontal() &&
1340 GetHandoutPages() == rOpt
.GetHandoutPages() );
1343 // -----------------------------------------------------------------------------
1345 void SdOptionsPrint::GetPropNameArray( const char**& ppNames
, sal_uLong
& rCount
) const
1347 static const char* aDrawPropNames
[] =
1357 // bWarningOrientation
1359 "Page/BookletFront",
1362 "Other/FromPrinterSetup",
1366 static const char* aImpressPropNames
[] =
1376 // bWarningOrientation
1378 "Page/BookletFront",
1381 "Other/FromPrinterSetup",
1383 "Content/Presentation",
1387 "Other/HandoutHorizontal",
1388 "Other/PagesPerHandout"
1391 if( GetConfigId() == SDCFG_IMPRESS
)
1394 ppNames
= aImpressPropNames
;
1399 ppNames
= aDrawPropNames
;
1403 // -----------------------------------------------------------------------------
1405 sal_Bool
SdOptionsPrint::ReadData( const Any
* pValues
)
1407 if( pValues
[0].hasValue() ) SetDate( *(sal_Bool
*) pValues
[ 0 ].getValue() );
1408 if( pValues
[1].hasValue() ) SetTime( *(sal_Bool
*) pValues
[ 1 ].getValue() );
1409 if( pValues
[2].hasValue() ) SetPagename( *(sal_Bool
*) pValues
[ 2 ].getValue() );
1410 if( pValues
[3].hasValue() ) SetHiddenPages( *(sal_Bool
*) pValues
[ 3 ].getValue() );
1411 if( pValues
[4].hasValue() ) SetPagesize( *(sal_Bool
*) pValues
[ 4 ].getValue() );
1412 if( pValues
[5].hasValue() ) SetPagetile( *(sal_Bool
*) pValues
[ 5 ].getValue() );
1413 if( pValues
[6].hasValue() ) SetBooklet( *(sal_Bool
*) pValues
[ 6 ].getValue() );
1414 if( pValues
[7].hasValue() ) SetFrontPage( *(sal_Bool
*) pValues
[ 7 ].getValue() );
1415 if( pValues
[8].hasValue() ) SetBackPage( *(sal_Bool
*) pValues
[ 8 ].getValue() );
1416 if( pValues
[9].hasValue() ) SetPaperbin( *(sal_Bool
*) pValues
[ 9 ].getValue() );
1417 if( pValues
[10].hasValue() ) SetOutputQuality( (sal_uInt16
) *(sal_Int32
*) pValues
[ 10 ].getValue() );
1418 if( pValues
[11].hasValue() ) SetDraw( *(sal_Bool
*) pValues
[ 11 ].getValue() );
1421 if( GetConfigId() == SDCFG_IMPRESS
)
1423 if( pValues
[12].hasValue() ) SetNotes( *(sal_Bool
*) pValues
[ 12 ].getValue() );
1424 if( pValues
[13].hasValue() ) SetHandout( *(sal_Bool
*) pValues
[ 13 ].getValue() );
1425 if( pValues
[14].hasValue() ) SetOutline( *(sal_Bool
*) pValues
[ 14 ].getValue() );
1426 if( pValues
[15].hasValue() ) SetHandoutHorizontal( *(sal_Bool
*) pValues
[15].getValue() );
1427 if( pValues
[16].hasValue() ) SetHandoutPages( (sal_uInt16
)*(sal_Int32
*) pValues
[16].getValue() );
1433 // -----------------------------------------------------------------------------
1435 sal_Bool
SdOptionsPrint::WriteData( Any
* pValues
) const
1437 pValues
[ 0 ] <<= IsDate();
1438 pValues
[ 1 ] <<= IsTime();
1439 pValues
[ 2 ] <<= IsPagename();
1440 pValues
[ 3 ] <<= IsHiddenPages();
1441 pValues
[ 4 ] <<= IsPagesize();
1442 pValues
[ 5 ] <<= IsPagetile();
1443 pValues
[ 6 ] <<= IsBooklet();
1444 pValues
[ 7 ] <<= IsFrontPage();
1445 pValues
[ 8 ] <<= IsBackPage();
1446 pValues
[ 9 ] <<= IsPaperbin();
1447 pValues
[ 10 ] <<= (sal_Int32
) GetOutputQuality();
1448 pValues
[ 11 ] <<= IsDraw();
1451 if( GetConfigId() == SDCFG_IMPRESS
)
1453 pValues
[ 12 ] <<= IsNotes();
1454 pValues
[ 13 ] <<= IsHandout();
1455 pValues
[ 14 ] <<= IsOutline();
1456 pValues
[ 15 ] <<= IsHandoutHorizontal();
1457 pValues
[ 16 ] <<= GetHandoutPages();
1463 /*************************************************************************
1465 |* SdOptionsPrintItem
1467 \************************************************************************/
1469 SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich
)
1470 : SfxPoolItem ( _nWhich
)
1471 , maOptionsPrint ( 0, sal_False
)
1475 // ----------------------------------------------------------------------
1477 SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich
, SdOptions
* pOpts
, ::sd::FrameView
* )
1478 : SfxPoolItem ( _nWhich
)
1479 , maOptionsPrint ( 0, sal_False
)
1483 maOptionsPrint
.SetDraw( pOpts
->IsDraw() );
1484 maOptionsPrint
.SetNotes( pOpts
->IsNotes() );
1485 maOptionsPrint
.SetHandout( pOpts
->IsHandout() );
1486 maOptionsPrint
.SetOutline( pOpts
->IsOutline() );
1487 maOptionsPrint
.SetDate( pOpts
->IsDate() );
1488 maOptionsPrint
.SetTime( pOpts
->IsTime() );
1489 maOptionsPrint
.SetPagename( pOpts
->IsPagename() );
1490 maOptionsPrint
.SetHiddenPages( pOpts
->IsHiddenPages() );
1491 maOptionsPrint
.SetPagesize( pOpts
->IsPagesize() );
1492 maOptionsPrint
.SetPagetile( pOpts
->IsPagetile() );
1493 maOptionsPrint
.SetWarningPrinter( pOpts
->IsWarningPrinter() );
1494 maOptionsPrint
.SetWarningSize( pOpts
->IsWarningSize() );
1495 maOptionsPrint
.SetWarningOrientation( pOpts
->IsWarningOrientation() );
1496 maOptionsPrint
.SetBooklet( pOpts
->IsBooklet() );
1497 maOptionsPrint
.SetFrontPage( pOpts
->IsFrontPage() );
1498 maOptionsPrint
.SetBackPage( pOpts
->IsBackPage() );
1499 maOptionsPrint
.SetCutPage( pOpts
->IsCutPage() );
1500 maOptionsPrint
.SetPaperbin( pOpts
->IsPaperbin() );
1501 maOptionsPrint
.SetOutputQuality( pOpts
->GetOutputQuality() );
1505 // ----------------------------------------------------------------------
1507 SfxPoolItem
* SdOptionsPrintItem::Clone( SfxItemPool
* ) const
1509 return new SdOptionsPrintItem( *this );
1512 // ----------------------------------------------------------------------
1514 int SdOptionsPrintItem::operator==( const SfxPoolItem
& rAttr
) const
1516 const bool bSameType
= SfxPoolItem::operator==(rAttr
);
1517 DBG_ASSERT( bSameType
, "SdOptionsPrintItem::operator==(), different pool item type!" );
1518 return bSameType
&& ( maOptionsPrint
== static_cast< const SdOptionsPrintItem
& >( rAttr
).maOptionsPrint
);
1521 // -----------------------------------------------------------------------
1523 void SdOptionsPrintItem::SetOptions( SdOptions
* pOpts
) const
1527 pOpts
->SetDraw( maOptionsPrint
.IsDraw() );
1528 pOpts
->SetNotes( maOptionsPrint
.IsNotes() );
1529 pOpts
->SetHandout( maOptionsPrint
.IsHandout() );
1530 pOpts
->SetOutline( maOptionsPrint
.IsOutline() );
1531 pOpts
->SetDate( maOptionsPrint
.IsDate() );
1532 pOpts
->SetTime( maOptionsPrint
.IsTime() );
1533 pOpts
->SetPagename( maOptionsPrint
.IsPagename() );
1534 pOpts
->SetHiddenPages( maOptionsPrint
.IsHiddenPages() );
1535 pOpts
->SetPagesize( maOptionsPrint
.IsPagesize() );
1536 pOpts
->SetPagetile( maOptionsPrint
.IsPagetile() );
1537 pOpts
->SetWarningPrinter( maOptionsPrint
.IsWarningPrinter() );
1538 pOpts
->SetWarningSize( maOptionsPrint
.IsWarningSize() );
1539 pOpts
->SetWarningOrientation( maOptionsPrint
.IsWarningOrientation() );
1540 pOpts
->SetBooklet( maOptionsPrint
.IsBooklet() );
1541 pOpts
->SetFrontPage( maOptionsPrint
.IsFrontPage() );
1542 pOpts
->SetBackPage( maOptionsPrint
.IsBackPage() );
1543 pOpts
->SetCutPage( maOptionsPrint
.IsCutPage() );
1544 pOpts
->SetPaperbin( maOptionsPrint
.IsPaperbin() );
1545 pOpts
->SetOutputQuality( maOptionsPrint
.GetOutputQuality() );
1549 /*************************************************************************
1553 \************************************************************************/
1555 SdOptions::SdOptions( sal_uInt16 nConfigId
) :
1556 SdOptionsLayout( nConfigId
, sal_True
),
1557 SdOptionsContents( nConfigId
, sal_True
),
1558 SdOptionsMisc( nConfigId
, sal_True
),
1559 SdOptionsSnap( nConfigId
, sal_True
),
1560 SdOptionsZoom( nConfigId
, sal_True
),
1561 SdOptionsGrid( nConfigId
, sal_True
),
1562 SdOptionsPrint( nConfigId
, sal_True
)
1566 // ----------------------------------------------------------------------
1568 SdOptions::~SdOptions()
1572 // ----------------------------------------------------------------------
1574 void SdOptions::StoreConfig( sal_uLong nOptionsRange
)
1576 if( nOptionsRange
& SD_OPTIONS_LAYOUT
)
1577 SdOptionsLayout::Store();
1579 if( nOptionsRange
& SD_OPTIONS_CONTENTS
)
1580 SdOptionsContents::Store();
1582 if( nOptionsRange
& SD_OPTIONS_MISC
)
1583 SdOptionsMisc::Store();
1585 if( nOptionsRange
& SD_OPTIONS_SNAP
)
1586 SdOptionsSnap::Store();
1588 if( nOptionsRange
& SD_OPTIONS_ZOOM
)
1589 SdOptionsZoom::Store();
1591 if( nOptionsRange
& SD_OPTIONS_GRID
)
1592 SdOptionsGrid::Store();
1594 if( nOptionsRange
& SD_OPTIONS_PRINT
)
1595 SdOptionsPrint::Store();
1598 sal_Int32
SdOptionsMisc::GetDisplay() const
1604 void SdOptionsMisc::SetDisplay( sal_Int32 nDisplay
)
1606 if( mnDisplay
!= nDisplay
)
1609 mnDisplay
= nDisplay
;
1613 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */