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_svx.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir // include --------------------------------------------------------------- 32*cdf0e10cSrcweir #include <tools/shl.hxx> 33*cdf0e10cSrcweir #include <sfx2/app.hxx> 34*cdf0e10cSrcweir #include <sfx2/module.hxx> 35*cdf0e10cSrcweir #include <svl/intitem.hxx> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #define _SVX_OPTGRID_CXX 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include <svx/svxids.hrc> 40*cdf0e10cSrcweir #include <svx/dialmgr.hxx> 41*cdf0e10cSrcweir #include "svx/optgrid.hxx" 42*cdf0e10cSrcweir #include <svx/dialogs.hrc> 43*cdf0e10cSrcweir #include "optgrid.hrc" 44*cdf0e10cSrcweir #include "svx/dlgutil.hxx" 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir /* -----------------18.08.98 17:41------------------- 47*cdf0e10cSrcweir * local functions 48*cdf0e10cSrcweir * --------------------------------------------------*/ 49*cdf0e10cSrcweir void lcl_GetMinMax(MetricField& rField, long& nFirst, long& nLast, long& nMin, long& nMax) 50*cdf0e10cSrcweir { 51*cdf0e10cSrcweir nFirst = static_cast<long>(rField.Denormalize( rField.GetFirst( FUNIT_TWIP ) )); 52*cdf0e10cSrcweir nLast = static_cast<long>(rField.Denormalize( rField.GetLast( FUNIT_TWIP ) )); 53*cdf0e10cSrcweir nMin = static_cast<long>(rField.Denormalize( rField.GetMin( FUNIT_TWIP ) )); 54*cdf0e10cSrcweir nMax = static_cast<long>(rField.Denormalize( rField.GetMax( FUNIT_TWIP ) )); 55*cdf0e10cSrcweir } 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir void lcl_SetMinMax(MetricField& rField, long nFirst, long nLast, long nMin, long nMax) 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir rField.SetFirst( rField.Normalize( nFirst ), FUNIT_TWIP ); 60*cdf0e10cSrcweir rField.SetLast( rField.Normalize( nLast ), FUNIT_TWIP ); 61*cdf0e10cSrcweir rField.SetMin( rField.Normalize( nMin ), FUNIT_TWIP ); 62*cdf0e10cSrcweir rField.SetMax( rField.Normalize( nMax ), FUNIT_TWIP ); 63*cdf0e10cSrcweir } 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir /*-------------------------------------------------------------------- 66*cdf0e10cSrcweir Beschreibung: Rastereinstellungen Ctor 67*cdf0e10cSrcweir --------------------------------------------------------------------*/ 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir SvxOptionsGrid::SvxOptionsGrid() : 70*cdf0e10cSrcweir nFldDrawX ( 100 ), 71*cdf0e10cSrcweir nFldDivisionX ( 0 ), 72*cdf0e10cSrcweir nFldDrawY ( 100 ), 73*cdf0e10cSrcweir nFldDivisionY ( 0 ), 74*cdf0e10cSrcweir nFldSnapX ( 100 ), 75*cdf0e10cSrcweir nFldSnapY ( 100 ), 76*cdf0e10cSrcweir bUseGridsnap ( 0 ), 77*cdf0e10cSrcweir bSynchronize ( 1 ), 78*cdf0e10cSrcweir bGridVisible ( 0 ), 79*cdf0e10cSrcweir bEqualGrid ( 1 ) 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir /*-------------------------------------------------------------------- 84*cdf0e10cSrcweir Beschreibung: Rastereinstellungen Dtor 85*cdf0e10cSrcweir --------------------------------------------------------------------*/ 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir SvxOptionsGrid::~SvxOptionsGrid() 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir } 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir /*-------------------------------------------------------------------- 92*cdf0e10cSrcweir Beschreibung: Item fuer Rastereinstellungen 93*cdf0e10cSrcweir --------------------------------------------------------------------*/ 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir SvxGridItem::SvxGridItem( const SvxGridItem& rItem ) 96*cdf0e10cSrcweir : SvxOptionsGrid() 97*cdf0e10cSrcweir , SfxPoolItem(rItem) 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir bUseGridsnap = rItem.bUseGridsnap ; 100*cdf0e10cSrcweir bSynchronize = rItem.bSynchronize ; 101*cdf0e10cSrcweir bGridVisible = rItem.bGridVisible ; 102*cdf0e10cSrcweir bEqualGrid = rItem.bEqualGrid ; 103*cdf0e10cSrcweir nFldDrawX = rItem.nFldDrawX ; 104*cdf0e10cSrcweir nFldDivisionX= rItem.nFldDivisionX; 105*cdf0e10cSrcweir nFldDrawY = rItem.nFldDrawY ; 106*cdf0e10cSrcweir nFldDivisionY= rItem.nFldDivisionY; 107*cdf0e10cSrcweir nFldSnapX = rItem.nFldSnapX ; 108*cdf0e10cSrcweir nFldSnapY = rItem.nFldSnapY ; 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir }; 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir /*-------------------------------------------------------------------- 113*cdf0e10cSrcweir Beschreibung: 114*cdf0e10cSrcweir --------------------------------------------------------------------*/ 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir SfxPoolItem* SvxGridItem::Clone( SfxItemPool* ) const 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir return new SvxGridItem( *this ); 119*cdf0e10cSrcweir } 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir /*-------------------------------------------------------------------- 122*cdf0e10cSrcweir Beschreibung: 123*cdf0e10cSrcweir --------------------------------------------------------------------*/ 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir int SvxGridItem::operator==( const SfxPoolItem& rAttr ) const 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" ); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir const SvxGridItem& rItem = (const SvxGridItem&) rAttr; 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir return ( bUseGridsnap == rItem.bUseGridsnap && 132*cdf0e10cSrcweir bSynchronize == rItem.bSynchronize && 133*cdf0e10cSrcweir bGridVisible == rItem.bGridVisible && 134*cdf0e10cSrcweir bEqualGrid == rItem.bEqualGrid && 135*cdf0e10cSrcweir nFldDrawX == rItem.nFldDrawX && 136*cdf0e10cSrcweir nFldDivisionX== rItem.nFldDivisionX&& 137*cdf0e10cSrcweir nFldDrawY == rItem.nFldDrawY && 138*cdf0e10cSrcweir nFldDivisionY== rItem.nFldDivisionY&& 139*cdf0e10cSrcweir nFldSnapX == rItem.nFldSnapX && 140*cdf0e10cSrcweir nFldSnapY == rItem.nFldSnapY ); 141*cdf0e10cSrcweir } 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir /*-------------------------------------------------------------------- 144*cdf0e10cSrcweir Beschreibung: 145*cdf0e10cSrcweir --------------------------------------------------------------------*/ 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir SfxItemPresentation SvxGridItem::GetPresentation 148*cdf0e10cSrcweir ( 149*cdf0e10cSrcweir SfxItemPresentation ePres, 150*cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 151*cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 152*cdf0e10cSrcweir String& rText, const IntlWrapper * 153*cdf0e10cSrcweir ) const 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir switch ( ePres ) 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 158*cdf0e10cSrcweir rText.Erase(); 159*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 160*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 161*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 162*cdf0e10cSrcweir rText = String::CreateFromAscii("SvxGridItem"); 163*cdf0e10cSrcweir return ePres; 164*cdf0e10cSrcweir default: 165*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 166*cdf0e10cSrcweir } 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir /*----------------- OS 23.02.95 ----------------------- 171*cdf0e10cSrcweir TabPage Rastereinstellungen 172*cdf0e10cSrcweir -------------------------------------------------------*/ 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir SvxGridTabPage::SvxGridTabPage( Window* pParent, const SfxItemSet& rCoreSet) : 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_GRID ), rCoreSet ), 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir aCbxUseGridsnap ( this, SVX_RES( CBX_USE_GRIDSNAP ) ), 179*cdf0e10cSrcweir aCbxGridVisible ( this, SVX_RES( CBX_GRID_VISIBLE ) ), 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir aFlResolution ( this, SVX_RES( FL_RESOLUTION ) ), 182*cdf0e10cSrcweir aFtDrawX ( this, SVX_RES( FT_DRAW_X ) ), 183*cdf0e10cSrcweir aMtrFldDrawX ( this, SVX_RES( MTR_FLD_DRAW_X ) ), 184*cdf0e10cSrcweir aFtDrawY ( this, SVX_RES( FT_DRAW_Y ) ), 185*cdf0e10cSrcweir aMtrFldDrawY ( this, SVX_RES( MTR_FLD_DRAW_Y ) ), 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir aFlDivision ( this, SVX_RES( FL_DIVISION ) ), 188*cdf0e10cSrcweir aFtDivisionX( this, SVX_RES( FT_DIVISION_X) ), 189*cdf0e10cSrcweir aNumFldDivisionX( this, SVX_RES( NUM_FLD_DIVISION_X ) ), 190*cdf0e10cSrcweir aDivisionPointX( this, SVX_RES( FT_HORZ_POINTS) ), 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir aFtDivisionY( this, SVX_RES( FT_DIVISION_Y) ), 193*cdf0e10cSrcweir aNumFldDivisionY( this, SVX_RES( NUM_FLD_DIVISION_Y ) ), 194*cdf0e10cSrcweir aDivisionPointY( this, SVX_RES( FT_VERT_POINTS) ), 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir aCbxSynchronize ( this, SVX_RES( CBX_SYNCHRONIZE ) ), 197*cdf0e10cSrcweir aGrpDrawGrid ( this, SVX_RES( GRP_DRAWGRID ) ), 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir aGrpSnap ( this, SVX_RES( GRP_SNAP ) ), 200*cdf0e10cSrcweir aCbxSnapHelplines ( this, SVX_RES( CBX_SNAP_HELPLINES ) ), 201*cdf0e10cSrcweir aCbxSnapBorder ( this, SVX_RES( CBX_SNAP_BORDER ) ), 202*cdf0e10cSrcweir aCbxSnapFrame ( this, SVX_RES( CBX_SNAP_FRAME ) ), 203*cdf0e10cSrcweir aCbxSnapPoints ( this, SVX_RES( CBX_SNAP_POINTS ) ), 204*cdf0e10cSrcweir aFtSnapArea ( this, SVX_RES( FT_SNAP_AREA ) ), 205*cdf0e10cSrcweir aMtrFldSnapArea ( this, SVX_RES( MTR_FLD_SNAP_AREA ) ), 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir aSeparatorFL ( this, SVX_RES( FL_SEPARATOR ) ), 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir aGrpOrtho ( this, SVX_RES( GRP_ORTHO ) ), 210*cdf0e10cSrcweir aCbxOrtho ( this, SVX_RES( CBX_ORTHO ) ), 211*cdf0e10cSrcweir aCbxBigOrtho ( this, SVX_RES( CBX_BIGORTHO ) ), 212*cdf0e10cSrcweir aCbxRotate ( this, SVX_RES( CBX_ROTATE ) ), 213*cdf0e10cSrcweir aMtrFldAngle ( this, SVX_RES( MTR_FLD_ANGLE ) ), 214*cdf0e10cSrcweir aFtBezAngle ( this, SVX_RES( FT_BEZ_ANGLE ) ), 215*cdf0e10cSrcweir aMtrFldBezAngle ( this, SVX_RES( MTR_FLD_BEZ_ANGLE ) ), 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir bAttrModified( sal_False ) 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir // diese Page braucht ExchangeSupport 220*cdf0e10cSrcweir SetExchangeSupport(); 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir FreeResource(); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir aDivisionPointY.SetText(aDivisionPointX.GetText()); 225*cdf0e10cSrcweir // Metrik einstellen 226*cdf0e10cSrcweir FieldUnit eFUnit = GetModuleFieldUnit( rCoreSet ); 227*cdf0e10cSrcweir long nFirst, nLast, nMin, nMax; 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir lcl_GetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax); 230*cdf0e10cSrcweir SetFieldUnit( aMtrFldDrawX, eFUnit, sal_True ); 231*cdf0e10cSrcweir lcl_SetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax); 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir lcl_GetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax); 234*cdf0e10cSrcweir SetFieldUnit( aMtrFldDrawY, eFUnit, sal_True ); 235*cdf0e10cSrcweir lcl_SetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax); 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir aCbxRotate.SetClickHdl( LINK( this, SvxGridTabPage, ClickRotateHdl_Impl ) ); 239*cdf0e10cSrcweir Link aLink = LINK( this, SvxGridTabPage, ChangeGridsnapHdl_Impl ); 240*cdf0e10cSrcweir aCbxUseGridsnap.SetClickHdl( aLink ); 241*cdf0e10cSrcweir aCbxSynchronize.SetClickHdl( aLink ); 242*cdf0e10cSrcweir aCbxGridVisible.SetClickHdl( aLink ); 243*cdf0e10cSrcweir aMtrFldDrawX.SetModifyHdl( 244*cdf0e10cSrcweir LINK( this, SvxGridTabPage, ChangeDrawHdl_Impl ) ); 245*cdf0e10cSrcweir aMtrFldDrawY.SetModifyHdl( 246*cdf0e10cSrcweir LINK( this, SvxGridTabPage, ChangeDrawHdl_Impl ) ); 247*cdf0e10cSrcweir aNumFldDivisionX.SetModifyHdl( 248*cdf0e10cSrcweir LINK( this, SvxGridTabPage, ChangeDivisionHdl_Impl ) ); 249*cdf0e10cSrcweir aNumFldDivisionY.SetModifyHdl( 250*cdf0e10cSrcweir LINK( this, SvxGridTabPage, ChangeDivisionHdl_Impl ) ); 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir ::rtl::OUString sFlResolution( aFlResolution.GetDisplayText() ); 253*cdf0e10cSrcweir ::rtl::OUString sFtDrawX(aFtDrawX.GetDisplayText()); 254*cdf0e10cSrcweir ::rtl::OUString sFtDrawY(aFtDrawY.GetDisplayText()); 255*cdf0e10cSrcweir aMtrFldDrawX.SetAccessibleName( sFtDrawX + sFlResolution ); 256*cdf0e10cSrcweir aMtrFldDrawY.SetAccessibleName( sFtDrawY + sFlResolution ); 257*cdf0e10cSrcweir ::rtl::OUString sFlDivision( aFlDivision.GetDisplayText() ); 258*cdf0e10cSrcweir ::rtl::OUString sFtDivisionX(aFtDivisionX.GetDisplayText()); 259*cdf0e10cSrcweir ::rtl::OUString sFtDivisionY(aFtDivisionY.GetDisplayText()); 260*cdf0e10cSrcweir aNumFldDivisionX.SetAccessibleName( sFtDivisionX + sFlDivision ); 261*cdf0e10cSrcweir aNumFldDivisionY.SetAccessibleName( sFtDivisionY + sFlDivision ); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir //------------------------------------------------------------------------ 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir SfxTabPage* SvxGridTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir return ( new SvxGridTabPage( pParent, rAttrSet ) ); 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir //------------------------------------------------------------------------ 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir sal_Bool SvxGridTabPage::FillItemSet( SfxItemSet& rCoreSet ) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir if ( bAttrModified ) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS ); 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir aGridItem.bUseGridsnap = aCbxUseGridsnap.IsChecked(); 280*cdf0e10cSrcweir aGridItem.bSynchronize = aCbxSynchronize.IsChecked(); 281*cdf0e10cSrcweir aGridItem.bGridVisible = aCbxGridVisible.IsChecked(); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir SfxMapUnit eUnit = 284*cdf0e10cSrcweir rCoreSet.GetPool()->GetMetric( GetWhich( SID_ATTR_GRID_OPTIONS ) ); 285*cdf0e10cSrcweir long nX =GetCoreValue( aMtrFldDrawX, eUnit ); 286*cdf0e10cSrcweir long nY = GetCoreValue( aMtrFldDrawY, eUnit ); 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir aGridItem.nFldDrawX = (sal_uInt32) nX; 289*cdf0e10cSrcweir aGridItem.nFldDrawY = (sal_uInt32) nY; 290*cdf0e10cSrcweir aGridItem.nFldDivisionX = static_cast<long>(aNumFldDivisionX.GetValue()-1); 291*cdf0e10cSrcweir aGridItem.nFldDivisionY = static_cast<long>(aNumFldDivisionY.GetValue()-1); 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir rCoreSet.Put( aGridItem ); 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir return bAttrModified; 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir //------------------------------------------------------------------------ 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir void SvxGridTabPage::Reset( const SfxItemSet& rSet ) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir const SfxPoolItem* pAttr = 0; 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS , sal_False, 305*cdf0e10cSrcweir (const SfxPoolItem**)&pAttr )) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir const SvxGridItem* pGridAttr = (SvxGridItem*)pAttr; 308*cdf0e10cSrcweir aCbxUseGridsnap.Check( pGridAttr->bUseGridsnap == 1 ); 309*cdf0e10cSrcweir aCbxSynchronize.Check( pGridAttr->bSynchronize == 1 ); 310*cdf0e10cSrcweir aCbxGridVisible.Check( pGridAttr->bGridVisible == 1 ); 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir SfxMapUnit eUnit = 313*cdf0e10cSrcweir rSet.GetPool()->GetMetric( GetWhich( SID_ATTR_GRID_OPTIONS ) ); 314*cdf0e10cSrcweir SetMetricValue( aMtrFldDrawX , pGridAttr->nFldDrawX, eUnit ); 315*cdf0e10cSrcweir SetMetricValue( aMtrFldDrawY , pGridAttr->nFldDrawY, eUnit ); 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir aNumFldDivisionX.SetValue( pGridAttr->nFldDivisionX+1 ); 318*cdf0e10cSrcweir aNumFldDivisionY.SetValue( pGridAttr->nFldDivisionY+1 ); 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir ChangeGridsnapHdl_Impl( &aCbxUseGridsnap ); 322*cdf0e10cSrcweir bAttrModified = sal_False; 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir // ----------------------------------------------------------------------- 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir void SvxGridTabPage::ActivatePage( const SfxItemSet& rSet ) 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir const SfxPoolItem* pAttr = NULL; 330*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS , sal_False, 331*cdf0e10cSrcweir (const SfxPoolItem**)&pAttr )) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir const SvxGridItem* pGridAttr = (SvxGridItem*) pAttr; 334*cdf0e10cSrcweir aCbxUseGridsnap.Check( pGridAttr->bUseGridsnap == 1 ); 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir ChangeGridsnapHdl_Impl( &aCbxUseGridsnap ); 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir // Metrik ggfs. aendern (da TabPage im Dialog liegt, 340*cdf0e10cSrcweir // wo die Metrik eingestellt werden kann 341*cdf0e10cSrcweir //sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC ); 342*cdf0e10cSrcweir //if( rSet.GetItemState( GetWhich( SID_ATTR_METRIC ) ) >= SFX_ITEM_AVAILABLE ) 343*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_METRIC , sal_False, 344*cdf0e10cSrcweir (const SfxPoolItem**)&pAttr )) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir const SfxUInt16Item* pItem = (SfxUInt16Item*) pAttr; 347*cdf0e10cSrcweir 348*cdf0e10cSrcweir FieldUnit eFUnit = (FieldUnit)(long)pItem->GetValue(); 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir if( eFUnit != aMtrFldDrawX.GetUnit() ) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir // Metriken einstellen 353*cdf0e10cSrcweir long nFirst, nLast, nMin, nMax; 354*cdf0e10cSrcweir long nVal = static_cast<long>(aMtrFldDrawX.Denormalize( aMtrFldDrawX.GetValue( FUNIT_TWIP ) )); 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir lcl_GetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax); 357*cdf0e10cSrcweir SetFieldUnit( aMtrFldDrawX, eFUnit, sal_True ); 358*cdf0e10cSrcweir lcl_SetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax); 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir aMtrFldDrawX.SetValue( aMtrFldDrawX.Normalize( nVal ), FUNIT_TWIP ); 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir nVal = static_cast<long>(aMtrFldDrawY.Denormalize( aMtrFldDrawY.GetValue( FUNIT_TWIP ) )); 363*cdf0e10cSrcweir lcl_GetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax); 364*cdf0e10cSrcweir SetFieldUnit( aMtrFldDrawY, eFUnit, sal_True ); 365*cdf0e10cSrcweir lcl_SetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax); 366*cdf0e10cSrcweir aMtrFldDrawY.SetValue( aMtrFldDrawY.Normalize( nVal ), FUNIT_TWIP ); 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir // ----------------------------------------------------------------------- 373*cdf0e10cSrcweir int SvxGridTabPage::DeactivatePage( SfxItemSet* _pSet ) 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir if ( _pSet ) 376*cdf0e10cSrcweir FillItemSet( *_pSet ); 377*cdf0e10cSrcweir return( LEAVE_PAGE ); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir //------------------------------------------------------------------------ 380*cdf0e10cSrcweir IMPL_LINK( SvxGridTabPage, ChangeDrawHdl_Impl, MetricField *, pField ) 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir bAttrModified = sal_True; 383*cdf0e10cSrcweir if( aCbxSynchronize.IsChecked() ) 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir if(pField == &aMtrFldDrawX) 386*cdf0e10cSrcweir aMtrFldDrawY.SetValue( aMtrFldDrawX.GetValue() ); 387*cdf0e10cSrcweir else 388*cdf0e10cSrcweir aMtrFldDrawX.SetValue( aMtrFldDrawY.GetValue() ); 389*cdf0e10cSrcweir } 390*cdf0e10cSrcweir return 0; 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir //------------------------------------------------------------------------ 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir IMPL_LINK( SvxGridTabPage, ClickRotateHdl_Impl, void *, EMPTYARG ) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir if( aCbxRotate.IsChecked() ) 397*cdf0e10cSrcweir aMtrFldAngle.Enable(); 398*cdf0e10cSrcweir else 399*cdf0e10cSrcweir aMtrFldAngle.Disable(); 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir return( 0L ); 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir //------------------------------------------------------------------------ 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir IMPL_LINK( SvxGridTabPage, ChangeDivisionHdl_Impl, NumericField *, pField ) 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir bAttrModified = sal_True; 409*cdf0e10cSrcweir if( aCbxSynchronize.IsChecked() ) 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir if(&aNumFldDivisionX == pField) 412*cdf0e10cSrcweir aNumFldDivisionY.SetValue( aNumFldDivisionX.GetValue() ); 413*cdf0e10cSrcweir else 414*cdf0e10cSrcweir aNumFldDivisionX.SetValue( aNumFldDivisionY.GetValue() ); 415*cdf0e10cSrcweir } 416*cdf0e10cSrcweir return 0; 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir //------------------------------------------------------------------------ 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir IMPL_LINK( SvxGridTabPage, ChangeGridsnapHdl_Impl, void *, EMPTYARG ) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir bAttrModified = sal_True; 423*cdf0e10cSrcweir return 0; 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir 427