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