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 #include <tools/string.hxx> 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <svx/dialogs.hrc> 33*cdf0e10cSrcweir #include "svx/rulritem.hxx" 34*cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/frame/status/LeftRightMargin.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/frame/status/UpperLowerMargin.hpp> 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir //------------------------------------------------------------------------ 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(SvxPagePosSizeItem, SfxPoolItem); 41*cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(SvxLongLRSpaceItem, SfxPoolItem); 42*cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(SvxLongULSpaceItem, SfxPoolItem); 43*cdf0e10cSrcweir TYPEINIT1(SvxColumnItem, SfxPoolItem); 44*cdf0e10cSrcweir TYPEINIT1(SvxObjectItem, SfxPoolItem); 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir //------------------------------------------------------------------------ 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir int SvxLongLRSpaceItem::operator==( const SfxPoolItem& rCmp) const 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir return SfxPoolItem::operator==(rCmp) && 51*cdf0e10cSrcweir lLeft==((const SvxLongLRSpaceItem &)rCmp).lLeft && 52*cdf0e10cSrcweir lRight==((const SvxLongLRSpaceItem &)rCmp).lRight; 53*cdf0e10cSrcweir } 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir //------------------------------------------------------------------------ 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir String SvxLongLRSpaceItem::GetValueText() const 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir return String(); 61*cdf0e10cSrcweir } 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) 64*cdf0e10cSrcweir #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir sal_Bool SvxLongLRSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 69*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir sal_Int32 nVal; 72*cdf0e10cSrcweir switch( nMemberId ) 73*cdf0e10cSrcweir { 74*cdf0e10cSrcweir case 0: 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir ::com::sun::star::frame::status::LeftRightMargin aLeftRightMargin; 77*cdf0e10cSrcweir aLeftRightMargin.Left = bConvert ? TWIP_TO_MM100( lLeft ) : lLeft; 78*cdf0e10cSrcweir aLeftRightMargin.Right = bConvert ? TWIP_TO_MM100( lRight ) : lRight; 79*cdf0e10cSrcweir rVal <<= aLeftRightMargin; 80*cdf0e10cSrcweir return sal_True; 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir case MID_LEFT: nVal = lLeft; break; 84*cdf0e10cSrcweir case MID_RIGHT: nVal = lRight; break; 85*cdf0e10cSrcweir default: DBG_ERROR("Wrong MemberId!"); return sal_False; 86*cdf0e10cSrcweir } 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir if ( bConvert ) 89*cdf0e10cSrcweir nVal = TWIP_TO_MM100( nVal ); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir rVal <<= nVal; 92*cdf0e10cSrcweir return sal_True; 93*cdf0e10cSrcweir } 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir // ----------------------------------------------------------------------- 96*cdf0e10cSrcweir sal_Bool SvxLongLRSpaceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 99*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir sal_Int32 nVal = 0; 102*cdf0e10cSrcweir if ( nMemberId == 0 ) 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir ::com::sun::star::frame::status::LeftRightMargin aLeftRightMargin; 105*cdf0e10cSrcweir if ( rVal >>= aLeftRightMargin ) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir lLeft = bConvert ? MM100_TO_TWIP( aLeftRightMargin.Left ) : aLeftRightMargin.Left; 108*cdf0e10cSrcweir lRight = bConvert ? MM100_TO_TWIP( aLeftRightMargin.Right ) : aLeftRightMargin.Right; 109*cdf0e10cSrcweir return sal_True; 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir else if ( rVal >>= nVal ) 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir if ( bConvert ) 115*cdf0e10cSrcweir nVal = MM100_TO_TWIP( nVal ); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir switch( nMemberId ) 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir case MID_LEFT: lLeft = nVal; break; 120*cdf0e10cSrcweir case MID_RIGHT: lRight = nVal; break; 121*cdf0e10cSrcweir default: DBG_ERROR("Wrong MemberId!"); return sal_False; 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir return sal_True; 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir return sal_False; 128*cdf0e10cSrcweir } 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir //------------------------------------------------------------------------ 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir SfxItemPresentation SvxLongLRSpaceItem::GetPresentation 133*cdf0e10cSrcweir ( 134*cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 135*cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 136*cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 137*cdf0e10cSrcweir String& /*rText*/, const IntlWrapper * 138*cdf0e10cSrcweir ) const 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir //------------------------------------------------------------------------ 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir SfxPoolItem* SvxLongLRSpaceItem::Clone(SfxItemPool *) const 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir return new SvxLongLRSpaceItem(*this); 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir //------------------------------------------------------------------------ 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir SvxLongLRSpaceItem::SvxLongLRSpaceItem(long lL, long lR, sal_uInt16 nId) 154*cdf0e10cSrcweir : SfxPoolItem(nId), 155*cdf0e10cSrcweir lLeft(lL), 156*cdf0e10cSrcweir lRight(lR) 157*cdf0e10cSrcweir {} 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir //------------------------------------------------------------------------ 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir SvxLongLRSpaceItem::SvxLongLRSpaceItem() : 162*cdf0e10cSrcweir SfxPoolItem( 0 ), 163*cdf0e10cSrcweir lLeft( 0 ), 164*cdf0e10cSrcweir lRight( 0 ) 165*cdf0e10cSrcweir {} 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir //------------------------------------------------------------------------ 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir SvxLongLRSpaceItem::SvxLongLRSpaceItem(const SvxLongLRSpaceItem &rCpy) 170*cdf0e10cSrcweir : SfxPoolItem(rCpy), 171*cdf0e10cSrcweir lLeft(rCpy.lLeft), 172*cdf0e10cSrcweir lRight(rCpy.lRight) 173*cdf0e10cSrcweir {} 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir //------------------------------------------------------------------------ 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir int SvxLongULSpaceItem::operator==( const SfxPoolItem& rCmp) const 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir return SfxPoolItem::operator==(rCmp) && 180*cdf0e10cSrcweir lLeft==((const SvxLongULSpaceItem &)rCmp).lLeft && 181*cdf0e10cSrcweir lRight==((const SvxLongULSpaceItem &)rCmp).lRight; 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir //------------------------------------------------------------------------ 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir String SvxLongULSpaceItem::GetValueText() const 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir return String(); 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir sal_Bool SvxLongULSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 195*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir sal_Int32 nVal; 198*cdf0e10cSrcweir switch( nMemberId ) 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir case 0: 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir ::com::sun::star::frame::status::UpperLowerMargin aUpperLowerMargin; 203*cdf0e10cSrcweir aUpperLowerMargin.Upper = bConvert ? TWIP_TO_MM100( lLeft ) : lLeft; 204*cdf0e10cSrcweir aUpperLowerMargin.Lower = bConvert ? TWIP_TO_MM100( lRight ) : lRight; 205*cdf0e10cSrcweir rVal <<= aUpperLowerMargin; 206*cdf0e10cSrcweir return sal_True; 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir case MID_UPPER: nVal = lLeft; break; 210*cdf0e10cSrcweir case MID_LOWER: nVal = lRight; break; 211*cdf0e10cSrcweir default: DBG_ERROR("Wrong MemberId!"); return sal_False; 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir if ( bConvert ) 215*cdf0e10cSrcweir nVal = TWIP_TO_MM100( nVal ); 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir rVal <<= nVal; 218*cdf0e10cSrcweir return sal_True; 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir // ----------------------------------------------------------------------- 222*cdf0e10cSrcweir sal_Bool SvxLongULSpaceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 225*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir sal_Int32 nVal = 0; 228*cdf0e10cSrcweir if ( nMemberId == 0 ) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir ::com::sun::star::frame::status::UpperLowerMargin aUpperLowerMargin; 231*cdf0e10cSrcweir if ( rVal >>= aUpperLowerMargin ) 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir lLeft = bConvert ? MM100_TO_TWIP( aUpperLowerMargin.Upper ) : aUpperLowerMargin.Upper; 234*cdf0e10cSrcweir lRight = bConvert ? MM100_TO_TWIP( aUpperLowerMargin.Lower ) : aUpperLowerMargin.Lower; 235*cdf0e10cSrcweir return sal_True; 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir else if ( rVal >>= nVal ) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir if ( bConvert ) 241*cdf0e10cSrcweir nVal = MM100_TO_TWIP( nVal ); 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir switch( nMemberId ) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir case MID_UPPER: lLeft = nVal; break; 246*cdf0e10cSrcweir case MID_LOWER: lRight = nVal; break; 247*cdf0e10cSrcweir default: DBG_ERROR("Wrong MemberId!"); return sal_False; 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir return sal_True; 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir return sal_False; 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir //------------------------------------------------------------------------ 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir SfxItemPresentation SvxLongULSpaceItem::GetPresentation 259*cdf0e10cSrcweir ( 260*cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 261*cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 262*cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 263*cdf0e10cSrcweir String& /*rText*/, const IntlWrapper * 264*cdf0e10cSrcweir ) const 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir //------------------------------------------------------------------------ 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir SfxPoolItem* SvxLongULSpaceItem::Clone(SfxItemPool *) const 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir return new SvxLongULSpaceItem(*this); 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir //------------------------------------------------------------------------ 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir SvxLongULSpaceItem::SvxLongULSpaceItem(long lL, long lR, sal_uInt16 nId) 279*cdf0e10cSrcweir : SfxPoolItem(nId), 280*cdf0e10cSrcweir lLeft(lL), 281*cdf0e10cSrcweir lRight(lR) 282*cdf0e10cSrcweir {} 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir //------------------------------------------------------------------------ 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir SvxLongULSpaceItem::SvxLongULSpaceItem(const SvxLongULSpaceItem &rCpy) 287*cdf0e10cSrcweir : SfxPoolItem(rCpy), 288*cdf0e10cSrcweir lLeft(rCpy.lLeft), 289*cdf0e10cSrcweir lRight(rCpy.lRight) 290*cdf0e10cSrcweir {} 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir //------------------------------------------------------------------------ 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir SvxLongULSpaceItem::SvxLongULSpaceItem() : 295*cdf0e10cSrcweir SfxPoolItem( 0 ), 296*cdf0e10cSrcweir lLeft( 0 ), 297*cdf0e10cSrcweir lRight( 0 ) 298*cdf0e10cSrcweir {} 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir //------------------------------------------------------------------------ 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir int SvxPagePosSizeItem::operator==( const SfxPoolItem& rCmp) const 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir return SfxPoolItem::operator==(rCmp) && 305*cdf0e10cSrcweir aPos == ((const SvxPagePosSizeItem &)rCmp).aPos && 306*cdf0e10cSrcweir lWidth == ((const SvxPagePosSizeItem &)rCmp).lWidth && 307*cdf0e10cSrcweir lHeight == ((const SvxPagePosSizeItem &)rCmp).lHeight; 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir sal_Bool SvxPagePosSizeItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir sal_Int32 nVal; 315*cdf0e10cSrcweir switch ( nMemberId ) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir case 0 : 318*cdf0e10cSrcweir { 319*cdf0e10cSrcweir com::sun::star::awt::Rectangle aPagePosSize; 320*cdf0e10cSrcweir aPagePosSize.X = aPos.X(); 321*cdf0e10cSrcweir aPagePosSize.Y = aPos.Y(); 322*cdf0e10cSrcweir aPagePosSize.Width = lWidth; 323*cdf0e10cSrcweir aPagePosSize.Height = lHeight; 324*cdf0e10cSrcweir rVal <<= aPagePosSize; 325*cdf0e10cSrcweir return sal_True; 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir case MID_X: nVal = aPos.X(); break; 329*cdf0e10cSrcweir case MID_Y: nVal = aPos.Y(); break; 330*cdf0e10cSrcweir case MID_WIDTH: nVal = lWidth; break; 331*cdf0e10cSrcweir case MID_HEIGHT: nVal = lHeight; break; 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir default: DBG_ERROR("Wrong MemberId!"); return sal_False; 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir rVal <<= nVal; 337*cdf0e10cSrcweir return sal_True; 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir sal_Bool SvxPagePosSizeItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir sal_Int32 nVal = 0; 345*cdf0e10cSrcweir if ( nMemberId == 0 ) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir com::sun::star::awt::Rectangle aPagePosSize; 348*cdf0e10cSrcweir if ( rVal >>= aPagePosSize ) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir aPos.X() = aPagePosSize.X; 351*cdf0e10cSrcweir aPos.Y() = aPagePosSize.Y; 352*cdf0e10cSrcweir lWidth = aPagePosSize.Width; 353*cdf0e10cSrcweir lHeight = aPagePosSize.Height; 354*cdf0e10cSrcweir return sal_True; 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir else 357*cdf0e10cSrcweir return sal_False; 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir else if ( rVal >>= nVal ) 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir switch ( nMemberId ) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir case MID_X: aPos.X() = nVal; break; 364*cdf0e10cSrcweir case MID_Y: aPos.Y() = nVal; break; 365*cdf0e10cSrcweir case MID_WIDTH: lWidth = nVal; break; 366*cdf0e10cSrcweir case MID_HEIGHT: lHeight = nVal; break; 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir default: DBG_ERROR("Wrong MemberId!"); return sal_False; 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir return sal_True; 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir return sal_False; 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir //------------------------------------------------------------------------ 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir String SvxPagePosSizeItem::GetValueText() const 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir return String(); 382*cdf0e10cSrcweir } 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir //------------------------------------------------------------------------ 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir SfxItemPresentation SvxPagePosSizeItem::GetPresentation 387*cdf0e10cSrcweir ( 388*cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 389*cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 390*cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 391*cdf0e10cSrcweir String& /*rText*/, const IntlWrapper * 392*cdf0e10cSrcweir ) const 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir //------------------------------------------------------------------------ 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir SfxPoolItem* SvxPagePosSizeItem::Clone(SfxItemPool *) const 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir return new SvxPagePosSizeItem(*this); 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir //------------------------------------------------------------------------ 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir SvxPagePosSizeItem::SvxPagePosSizeItem(const Point &rP, long lW, long lH) 407*cdf0e10cSrcweir : SfxPoolItem(SID_RULER_PAGE_POS), 408*cdf0e10cSrcweir aPos(rP), 409*cdf0e10cSrcweir lWidth(lW), 410*cdf0e10cSrcweir lHeight(lH) 411*cdf0e10cSrcweir {} 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir //------------------------------------------------------------------------ 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir SvxPagePosSizeItem::SvxPagePosSizeItem(const SvxPagePosSizeItem &rCpy) 416*cdf0e10cSrcweir : SfxPoolItem(rCpy), 417*cdf0e10cSrcweir aPos(rCpy.aPos), 418*cdf0e10cSrcweir lWidth(rCpy.lWidth), 419*cdf0e10cSrcweir lHeight(rCpy.lHeight) 420*cdf0e10cSrcweir {} 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir //------------------------------------------------------------------------ 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir SvxPagePosSizeItem::SvxPagePosSizeItem() 425*cdf0e10cSrcweir : SfxPoolItem( 0 ), 426*cdf0e10cSrcweir aPos( 0, 0 ), 427*cdf0e10cSrcweir lWidth( 0 ), 428*cdf0e10cSrcweir lHeight( 0 ) 429*cdf0e10cSrcweir {} 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir //------------------------------------------------------------------------ 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir void SvxColumnItem::DeleteAndDestroyColumns() 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir for( sal_uInt16 i = aColumns.Count(); i>0; ) 436*cdf0e10cSrcweir { 437*cdf0e10cSrcweir SvxColumnDescription *pTmp = (SvxColumnDescription *)aColumns[--i]; 438*cdf0e10cSrcweir aColumns.Remove( i ); 439*cdf0e10cSrcweir delete pTmp; 440*cdf0e10cSrcweir } 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir //------------------------------------------------------------------------ 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir int SvxColumnItem::operator==(const SfxPoolItem& rCmp) const 446*cdf0e10cSrcweir { 447*cdf0e10cSrcweir if(!SfxPoolItem::operator==(rCmp) || 448*cdf0e10cSrcweir nActColumn != ((const SvxColumnItem&)rCmp).nActColumn || 449*cdf0e10cSrcweir nLeft != ((const SvxColumnItem&)rCmp).nLeft || 450*cdf0e10cSrcweir nRight != ((const SvxColumnItem&)rCmp).nRight || 451*cdf0e10cSrcweir bTable != ((const SvxColumnItem&)rCmp).bTable || 452*cdf0e10cSrcweir Count() != ((const SvxColumnItem&)rCmp).Count()) 453*cdf0e10cSrcweir return sal_False; 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir const sal_uInt16 nCount = ((const SvxColumnItem&)rCmp).Count(); 456*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nCount;++i) { 457*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 458*cdf0e10cSrcweir SvxColumnDescription *p1, *p2; 459*cdf0e10cSrcweir p1 = (SvxColumnDescription *)aColumns[i]; 460*cdf0e10cSrcweir p2 = (SvxColumnDescription *)((const SvxColumnItem&)rCmp).aColumns[i]; 461*cdf0e10cSrcweir #endif 462*cdf0e10cSrcweir if( (*this)[i] != ((const SvxColumnItem&)rCmp)[i] ) 463*cdf0e10cSrcweir return sal_False; 464*cdf0e10cSrcweir } 465*cdf0e10cSrcweir return sal_True; 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir //------------------------------------------------------------------------ 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir String SvxColumnItem::GetValueText() const 471*cdf0e10cSrcweir { 472*cdf0e10cSrcweir return String(); 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir //------------------------------------------------------------------------ 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir SfxItemPresentation SvxColumnItem::GetPresentation 478*cdf0e10cSrcweir ( 479*cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 480*cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 481*cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 482*cdf0e10cSrcweir String& /*rText*/, const IntlWrapper * 483*cdf0e10cSrcweir ) const 484*cdf0e10cSrcweir { 485*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir //------------------------------------------------------------------------ 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir SfxPoolItem* SvxColumnItem::Clone( SfxItemPool * ) const 491*cdf0e10cSrcweir { 492*cdf0e10cSrcweir return new SvxColumnItem(*this); 493*cdf0e10cSrcweir } 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir //------------------------------------------------------------------------ 496*cdf0e10cSrcweir 497*cdf0e10cSrcweir SvxColumnItem::SvxColumnItem( sal_uInt16 nAct ) : 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir SfxPoolItem( SID_RULER_BORDERS ), 500*cdf0e10cSrcweir 501*cdf0e10cSrcweir nLeft ( 0 ), 502*cdf0e10cSrcweir nRight ( 0 ), 503*cdf0e10cSrcweir nActColumn ( nAct ), 504*cdf0e10cSrcweir bTable ( sal_False ), 505*cdf0e10cSrcweir bOrtho (sal_True ) 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir //------------------------------------------------------------------------ 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir SvxColumnItem::SvxColumnItem( sal_uInt16 nActCol, sal_uInt16 left, sal_uInt16 right ) : 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir SfxPoolItem( SID_RULER_BORDERS ), 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir nLeft ( left ), 517*cdf0e10cSrcweir nRight ( right ), 518*cdf0e10cSrcweir nActColumn ( nActCol ), 519*cdf0e10cSrcweir bTable ( sal_True ), 520*cdf0e10cSrcweir bOrtho ( sal_True ) 521*cdf0e10cSrcweir { 522*cdf0e10cSrcweir } 523*cdf0e10cSrcweir 524*cdf0e10cSrcweir //------------------------------------------------------------------------ 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir SvxColumnItem::SvxColumnItem( const SvxColumnItem& rCopy ) : 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir SfxPoolItem( rCopy ), 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir aColumns ( (sal_uInt8)rCopy.Count() ), 531*cdf0e10cSrcweir nLeft ( rCopy.nLeft ), 532*cdf0e10cSrcweir nRight ( rCopy.nRight ), 533*cdf0e10cSrcweir nActColumn( rCopy.nActColumn ), 534*cdf0e10cSrcweir bTable ( rCopy.bTable ), 535*cdf0e10cSrcweir bOrtho ( rCopy.bOrtho ) 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir const sal_uInt16 nCount = rCopy.Count(); 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCount; ++i ) 541*cdf0e10cSrcweir Append( rCopy[i] ); 542*cdf0e10cSrcweir } 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir //------------------------------------------------------------------------ 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir SvxColumnItem::~SvxColumnItem() 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir DeleteAndDestroyColumns(); 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir 551*cdf0e10cSrcweir //------------------------------------------------------------------------ 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir const SvxColumnItem &SvxColumnItem::operator=(const SvxColumnItem &rCopy) 554*cdf0e10cSrcweir { 555*cdf0e10cSrcweir nLeft = rCopy.nLeft; 556*cdf0e10cSrcweir nRight = rCopy.nRight; 557*cdf0e10cSrcweir bTable = rCopy.bTable; 558*cdf0e10cSrcweir nActColumn = rCopy.nActColumn; 559*cdf0e10cSrcweir DeleteAndDestroyColumns(); 560*cdf0e10cSrcweir const sal_uInt16 nCount = rCopy.Count(); 561*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nCount;++i) 562*cdf0e10cSrcweir Insert(rCopy[i], i); 563*cdf0e10cSrcweir return *this; 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir //------------------------------------------------------------------------ 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir sal_Bool SvxColumnItem::CalcOrtho() const 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir const sal_uInt16 nCount = Count(); 571*cdf0e10cSrcweir DBG_ASSERT(nCount >= 2, "keine Spalten"); 572*cdf0e10cSrcweir if(nCount < 2) 573*cdf0e10cSrcweir return sal_False; 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir long nColWidth = (*this)[0].GetWidth(); 576*cdf0e10cSrcweir for(sal_uInt16 i = 1; i < nCount; ++i) { 577*cdf0e10cSrcweir if( (*this)[i].GetWidth() != nColWidth) 578*cdf0e10cSrcweir return sal_False; 579*cdf0e10cSrcweir } 580*cdf0e10cSrcweir //!! Breite Trenner 581*cdf0e10cSrcweir return sal_True; 582*cdf0e10cSrcweir } 583*cdf0e10cSrcweir 584*cdf0e10cSrcweir //------------------------------------------------------------------------ 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir long SvxColumnItem::GetVisibleRight() const 587*cdf0e10cSrcweir { 588*cdf0e10cSrcweir sal_uInt16 nIdx = 0; 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nActColumn; ++i ) 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir if ( (*this)[i].bVisible ) 593*cdf0e10cSrcweir ++nIdx; 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir return (*this)[nIdx].nEnd; 596*cdf0e10cSrcweir } 597*cdf0e10cSrcweir 598*cdf0e10cSrcweir sal_Bool SvxColumnItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 599*cdf0e10cSrcweir { 600*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 601*cdf0e10cSrcweir switch ( nMemberId ) 602*cdf0e10cSrcweir { 603*cdf0e10cSrcweir case MID_COLUMNARRAY: 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir return sal_False; 606*cdf0e10cSrcweir } 607*cdf0e10cSrcweir case MID_RIGHT: rVal <<= nRight; break; 608*cdf0e10cSrcweir case MID_LEFT: rVal <<= nLeft; break; 609*cdf0e10cSrcweir case MID_ORTHO: rVal <<= (sal_Bool) bOrtho; break; 610*cdf0e10cSrcweir case MID_ACTUAL: rVal <<= (sal_Int32) nActColumn; break; 611*cdf0e10cSrcweir case MID_TABLE: rVal <<= (sal_Bool) bTable; break; 612*cdf0e10cSrcweir default: DBG_ERROR("Wrong MemberId!"); return sal_False; 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir return sal_True; 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir sal_Bool SvxColumnItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 619*cdf0e10cSrcweir { 620*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 621*cdf0e10cSrcweir sal_Int32 nVal = 0; 622*cdf0e10cSrcweir switch ( nMemberId ) 623*cdf0e10cSrcweir { 624*cdf0e10cSrcweir case MID_COLUMNARRAY: 625*cdf0e10cSrcweir { 626*cdf0e10cSrcweir return sal_False; 627*cdf0e10cSrcweir } 628*cdf0e10cSrcweir case MID_RIGHT: rVal >>= nRight; break; 629*cdf0e10cSrcweir case MID_LEFT: rVal >>= nLeft; break; 630*cdf0e10cSrcweir case MID_ORTHO: rVal >>= nVal; bOrtho = (sal_Bool) nVal; break; 631*cdf0e10cSrcweir case MID_ACTUAL: rVal >>= nVal; nActColumn = (sal_uInt16) nVal; break; 632*cdf0e10cSrcweir case MID_TABLE: rVal >>= nVal; bTable = (sal_Bool) nVal; break; 633*cdf0e10cSrcweir default: DBG_ERROR("Wrong MemberId!"); return sal_False; 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir return sal_True; 637*cdf0e10cSrcweir } 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir //------------------------------------------------------------------------ 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir int SvxObjectItem::operator==( const SfxPoolItem& rCmp ) const 642*cdf0e10cSrcweir { 643*cdf0e10cSrcweir return SfxPoolItem::operator==(rCmp) && 644*cdf0e10cSrcweir nStartX == ((const SvxObjectItem&)rCmp).nStartX && 645*cdf0e10cSrcweir nEndX == ((const SvxObjectItem&)rCmp).nEndX && 646*cdf0e10cSrcweir nStartY == ((const SvxObjectItem&)rCmp).nStartY && 647*cdf0e10cSrcweir nEndY == ((const SvxObjectItem&)rCmp).nEndY && 648*cdf0e10cSrcweir bLimits == ((const SvxObjectItem&)rCmp).bLimits; 649*cdf0e10cSrcweir } 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir //------------------------------------------------------------------------ 652*cdf0e10cSrcweir 653*cdf0e10cSrcweir String SvxObjectItem::GetValueText() const 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir return String(); 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir 658*cdf0e10cSrcweir //------------------------------------------------------------------------ 659*cdf0e10cSrcweir 660*cdf0e10cSrcweir SfxItemPresentation SvxObjectItem::GetPresentation 661*cdf0e10cSrcweir ( 662*cdf0e10cSrcweir SfxItemPresentation /*ePres*/, 663*cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 664*cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 665*cdf0e10cSrcweir String& /*rText*/, const IntlWrapper * 666*cdf0e10cSrcweir ) const 667*cdf0e10cSrcweir { 668*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir //------------------------------------------------------------------------ 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir SfxPoolItem* SvxObjectItem::Clone(SfxItemPool *) const 674*cdf0e10cSrcweir { 675*cdf0e10cSrcweir return new SvxObjectItem(*this); 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir //------------------------------------------------------------------------ 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir SvxObjectItem::SvxObjectItem( long nSX, long nEX, 681*cdf0e10cSrcweir long nSY, long nEY, sal_Bool limits ) : 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir SfxPoolItem( SID_RULER_OBJECT ), 684*cdf0e10cSrcweir 685*cdf0e10cSrcweir nStartX ( nSX ), 686*cdf0e10cSrcweir nEndX ( nEX ), 687*cdf0e10cSrcweir nStartY ( nSY ), 688*cdf0e10cSrcweir nEndY ( nEY ), 689*cdf0e10cSrcweir bLimits ( limits ) 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir { 692*cdf0e10cSrcweir } 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir //------------------------------------------------------------------------ 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir SvxObjectItem::SvxObjectItem( const SvxObjectItem& rCopy ) : 697*cdf0e10cSrcweir 698*cdf0e10cSrcweir SfxPoolItem( rCopy ), 699*cdf0e10cSrcweir 700*cdf0e10cSrcweir nStartX ( rCopy.nStartX ), 701*cdf0e10cSrcweir nEndX ( rCopy.nEndX ), 702*cdf0e10cSrcweir nStartY ( rCopy.nStartY ), 703*cdf0e10cSrcweir nEndY ( rCopy.nEndY ), 704*cdf0e10cSrcweir bLimits ( rCopy.bLimits ) 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir { 707*cdf0e10cSrcweir } 708*cdf0e10cSrcweir 709*cdf0e10cSrcweir sal_Bool SvxObjectItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 712*cdf0e10cSrcweir switch ( nMemberId ) 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir case MID_START_X : rVal <<= nStartX; break; 715*cdf0e10cSrcweir case MID_START_Y : rVal <<= nStartY; break; 716*cdf0e10cSrcweir case MID_END_X : rVal <<= nEndX; break; 717*cdf0e10cSrcweir case MID_END_Y : rVal <<= nEndY; break; 718*cdf0e10cSrcweir case MID_LIMIT : rVal <<= bLimits; break; 719*cdf0e10cSrcweir default: 720*cdf0e10cSrcweir DBG_ERROR( "Wrong MemberId" ); 721*cdf0e10cSrcweir return sal_False; 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir 724*cdf0e10cSrcweir return sal_True; 725*cdf0e10cSrcweir } 726*cdf0e10cSrcweir 727*cdf0e10cSrcweir sal_Bool SvxObjectItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 728*cdf0e10cSrcweir { 729*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 730*cdf0e10cSrcweir sal_Bool bRet=sal_False; 731*cdf0e10cSrcweir switch ( nMemberId ) 732*cdf0e10cSrcweir { 733*cdf0e10cSrcweir case MID_START_X : bRet = (rVal >>= nStartX); break; 734*cdf0e10cSrcweir case MID_START_Y : bRet = (rVal >>= nStartY); break; 735*cdf0e10cSrcweir case MID_END_X : bRet = (rVal >>= nEndX); break; 736*cdf0e10cSrcweir case MID_END_Y : bRet = (rVal >>= nEndY); break; 737*cdf0e10cSrcweir case MID_LIMIT : bRet = (rVal >>= bLimits); break; 738*cdf0e10cSrcweir default: DBG_ERROR( "Wrong MemberId" ); 739*cdf0e10cSrcweir } 740*cdf0e10cSrcweir 741*cdf0e10cSrcweir return bRet; 742*cdf0e10cSrcweir } 743*cdf0e10cSrcweir 744