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