LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/app - optsitem.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 232 726 32.0 %
Date: 2013-07-09 Functions: 38 90 42.2 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10