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 <svx/svxitems.hrc> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <tools/stream.hxx> 35*cdf0e10cSrcweir #include <com/sun/star/table/BorderLine.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/table/CellVertJustify.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/table/ShadowLocation.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/table/TableBorder.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/table/ShadowFormat.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/table/CellRangeAddress.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/table/CellContentType.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/table/TableOrientation.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/table/CellHoriJustify.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/style/ParagraphAdjust.hpp> 45*cdf0e10cSrcweir #include "com/sun/star/style/VerticalAlignment.hpp" 46*cdf0e10cSrcweir #include <com/sun/star/util/SortField.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/util/SortFieldType.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/table/CellOrientation.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/table/CellAddress.hpp> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir #include <svx/algitem.hxx> 52*cdf0e10cSrcweir #include <svx/dialmgr.hxx> 53*cdf0e10cSrcweir #include <editeng/itemtype.hxx> 54*cdf0e10cSrcweir #include <svx/unomid.hxx> 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir using namespace ::rtl; 57*cdf0e10cSrcweir using namespace ::com::sun::star; 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir // Konvertierung fuer UNO 60*cdf0e10cSrcweir #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) 61*cdf0e10cSrcweir #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir // STATIC DATA ----------------------------------------------------------- 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir //TYPEINIT1_AUTOFACTORY( SvxHorJustifyItem, SfxEnumItem ); 66*cdf0e10cSrcweir TYPEINIT1_FACTORY( SvxHorJustifyItem, SfxEnumItem, new SvxHorJustifyItem(SVX_HOR_JUSTIFY_STANDARD, 0)) 67*cdf0e10cSrcweir TYPEINIT1_FACTORY( SvxVerJustifyItem, SfxEnumItem, new SvxVerJustifyItem(SVX_VER_JUSTIFY_STANDARD, 0) ); 68*cdf0e10cSrcweir TYPEINIT1_FACTORY( SvxOrientationItem, SfxEnumItem, new SvxOrientationItem(SVX_ORIENTATION_STANDARD, 0) ); 69*cdf0e10cSrcweir TYPEINIT1_FACTORY( SvxMarginItem, SfxPoolItem, new SvxMarginItem(0) ); 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir // class SvxHorJustifyItem ----------------------------------------------- 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir SvxHorJustifyItem::SvxHorJustifyItem( const sal_uInt16 nId ) : 75*cdf0e10cSrcweir SfxEnumItem( nId, (sal_uInt16)SVX_HOR_JUSTIFY_STANDARD ) 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir } 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir SvxHorJustifyItem::SvxHorJustifyItem( const SvxCellHorJustify eJustify, 80*cdf0e10cSrcweir const sal_uInt16 nId ) : 81*cdf0e10cSrcweir SfxEnumItem( nId, (sal_uInt16)eJustify ) 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir //------------------------------------------------------------------------ 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir SfxItemPresentation SvxHorJustifyItem::GetPresentation 88*cdf0e10cSrcweir ( 89*cdf0e10cSrcweir SfxItemPresentation ePres, 90*cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 91*cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 92*cdf0e10cSrcweir XubString& rText, const IntlWrapper *) const 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir switch ( ePres ) 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 97*cdf0e10cSrcweir rText.Erase(); 98*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 99*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 100*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 101*cdf0e10cSrcweir rText = GetValueText( GetValue() ); 102*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_COMPLETE; 103*cdf0e10cSrcweir default: ; //prevent warning 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir //------------------------------------------------------------------------ 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir sal_Bool SvxHorJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 113*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 114*cdf0e10cSrcweir switch ( nMemberId ) 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir case MID_HORJUST_HORJUST: 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir table::CellHoriJustify eUno = table::CellHoriJustify_STANDARD; 119*cdf0e10cSrcweir switch ( (SvxCellHorJustify)GetValue() ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_STANDARD: eUno = table::CellHoriJustify_STANDARD; break; 122*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_LEFT: eUno = table::CellHoriJustify_LEFT; break; 123*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_CENTER: eUno = table::CellHoriJustify_CENTER; break; 124*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_RIGHT: eUno = table::CellHoriJustify_RIGHT; break; 125*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_BLOCK: eUno = table::CellHoriJustify_BLOCK; break; 126*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_REPEAT: eUno = table::CellHoriJustify_REPEAT; break; 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir rVal <<= eUno; 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir break; 131*cdf0e10cSrcweir case MID_HORJUST_ADJUST: 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir // ParagraphAdjust values, as in SvxAdjustItem 134*cdf0e10cSrcweir // (same value for ParaAdjust and ParaLastLineAdjust) 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir sal_Int16 nAdjust = style::ParagraphAdjust_LEFT; 137*cdf0e10cSrcweir switch ( (SvxCellHorJustify)GetValue() ) 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir // ParagraphAdjust_LEFT is used for STANDARD and REPEAT 140*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_STANDARD: 141*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_REPEAT: 142*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_LEFT: nAdjust = style::ParagraphAdjust_LEFT; break; 143*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_CENTER: nAdjust = style::ParagraphAdjust_CENTER; break; 144*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_RIGHT: nAdjust = style::ParagraphAdjust_RIGHT; break; 145*cdf0e10cSrcweir case SVX_HOR_JUSTIFY_BLOCK: nAdjust = style::ParagraphAdjust_BLOCK; break; 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir rVal <<= nAdjust; // as sal_Int16 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir break; 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir return sal_True; 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir sal_Bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 157*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 158*cdf0e10cSrcweir switch ( nMemberId ) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir case MID_HORJUST_HORJUST: 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir table::CellHoriJustify eUno; 163*cdf0e10cSrcweir if(!(rVal >>= eUno)) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir sal_Int32 nValue = 0; 166*cdf0e10cSrcweir if(!(rVal >>= nValue)) 167*cdf0e10cSrcweir return sal_False; 168*cdf0e10cSrcweir eUno = (table::CellHoriJustify)nValue; 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir SvxCellHorJustify eSvx = SVX_HOR_JUSTIFY_STANDARD; 171*cdf0e10cSrcweir switch (eUno) 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir case table::CellHoriJustify_STANDARD: eSvx = SVX_HOR_JUSTIFY_STANDARD; break; 174*cdf0e10cSrcweir case table::CellHoriJustify_LEFT: eSvx = SVX_HOR_JUSTIFY_LEFT; break; 175*cdf0e10cSrcweir case table::CellHoriJustify_CENTER: eSvx = SVX_HOR_JUSTIFY_CENTER; break; 176*cdf0e10cSrcweir case table::CellHoriJustify_RIGHT: eSvx = SVX_HOR_JUSTIFY_RIGHT; break; 177*cdf0e10cSrcweir case table::CellHoriJustify_BLOCK: eSvx = SVX_HOR_JUSTIFY_BLOCK; break; 178*cdf0e10cSrcweir case table::CellHoriJustify_REPEAT: eSvx = SVX_HOR_JUSTIFY_REPEAT; break; 179*cdf0e10cSrcweir default: ; //prevent warning 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir SetValue( (sal_uInt16)eSvx ); 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir break; 184*cdf0e10cSrcweir case MID_HORJUST_ADJUST: 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir // property contains ParagraphAdjust values as sal_Int16 187*cdf0e10cSrcweir sal_Int16 nVal = sal_Int16(); 188*cdf0e10cSrcweir if(!(rVal >>= nVal)) 189*cdf0e10cSrcweir return sal_False; 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir SvxCellHorJustify eSvx = SVX_HOR_JUSTIFY_STANDARD; 192*cdf0e10cSrcweir switch (nVal) 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir // STRETCH is treated as BLOCK 195*cdf0e10cSrcweir case style::ParagraphAdjust_LEFT: eSvx = SVX_HOR_JUSTIFY_LEFT; break; 196*cdf0e10cSrcweir case style::ParagraphAdjust_RIGHT: eSvx = SVX_HOR_JUSTIFY_RIGHT; break; 197*cdf0e10cSrcweir case style::ParagraphAdjust_STRETCH: 198*cdf0e10cSrcweir case style::ParagraphAdjust_BLOCK: eSvx = SVX_HOR_JUSTIFY_BLOCK; break; 199*cdf0e10cSrcweir case style::ParagraphAdjust_CENTER: eSvx = SVX_HOR_JUSTIFY_CENTER; break; 200*cdf0e10cSrcweir } 201*cdf0e10cSrcweir SetValue( (sal_uInt16)eSvx ); 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir return sal_True; 205*cdf0e10cSrcweir } 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir //------------------------------------------------------------------------ 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir XubString SvxHorJustifyItem::GetValueText( sal_uInt16 nVal ) const 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir DBG_ASSERT( nVal <= SVX_HOR_JUSTIFY_REPEAT, "enum overflow!" ); 212*cdf0e10cSrcweir return SVX_RESSTR(RID_SVXITEMS_HORJUST_STANDARD + nVal); 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir //------------------------------------------------------------------------ 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir SfxPoolItem* SvxHorJustifyItem::Clone( SfxItemPool* ) const 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir return new SvxHorJustifyItem( *this ); 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir //------------------------------------------------------------------------ 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir SfxPoolItem* SvxHorJustifyItem::Create( SvStream& rStream, sal_uInt16 ) const 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir sal_uInt16 nVal; 227*cdf0e10cSrcweir rStream >> nVal; 228*cdf0e10cSrcweir return new SvxHorJustifyItem( (SvxCellHorJustify)nVal, Which() ); 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir //------------------------------------------------------------------------ 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir sal_uInt16 SvxHorJustifyItem::GetValueCount() const 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir return SVX_HOR_JUSTIFY_REPEAT + 1; // letzter Enum-Wert + 1 235*cdf0e10cSrcweir } 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir // class SvxVerJustifyItem ----------------------------------------------- 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir SvxVerJustifyItem::SvxVerJustifyItem( const sal_uInt16 nId ) : 240*cdf0e10cSrcweir SfxEnumItem( nId, (sal_uInt16)SVX_VER_JUSTIFY_STANDARD ) 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir SvxVerJustifyItem::SvxVerJustifyItem( const SvxCellVerJustify eJustify, 245*cdf0e10cSrcweir const sal_uInt16 nId ) : 246*cdf0e10cSrcweir SfxEnumItem( nId, (sal_uInt16)eJustify ) 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir //------------------------------------------------------------------------ 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir SfxItemPresentation SvxVerJustifyItem::GetPresentation 253*cdf0e10cSrcweir ( 254*cdf0e10cSrcweir SfxItemPresentation ePres, 255*cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 256*cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 257*cdf0e10cSrcweir XubString& rText, 258*cdf0e10cSrcweir const IntlWrapper * ) const 259*cdf0e10cSrcweir { 260*cdf0e10cSrcweir switch ( ePres ) 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 263*cdf0e10cSrcweir rText.Erase(); 264*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 265*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 266*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 267*cdf0e10cSrcweir rText = GetValueText( GetValue() ); 268*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_COMPLETE; 269*cdf0e10cSrcweir default: ; //prevent warning 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir //------------------------------------------------------------------------ 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir sal_Bool SvxVerJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 279*cdf0e10cSrcweir switch ( nMemberId ) 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir case MID_HORJUST_ADJUST: 282*cdf0e10cSrcweir { 283*cdf0e10cSrcweir style::VerticalAlignment eUno = style::VerticalAlignment_TOP; 284*cdf0e10cSrcweir switch ( (SvxCellVerJustify)GetValue() ) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir case SVX_VER_JUSTIFY_TOP: eUno = style::VerticalAlignment_TOP; break; 287*cdf0e10cSrcweir case SVX_VER_JUSTIFY_CENTER: eUno = style::VerticalAlignment_MIDDLE; break; 288*cdf0e10cSrcweir case SVX_VER_JUSTIFY_BOTTOM: eUno = style::VerticalAlignment_BOTTOM; break; 289*cdf0e10cSrcweir default: ; //prevent warning 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir rVal <<= eUno; 292*cdf0e10cSrcweir break; 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir default: 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir table::CellVertJustify eUno = table::CellVertJustify_STANDARD; 297*cdf0e10cSrcweir switch ( (SvxCellVerJustify)GetValue() ) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir case SVX_VER_JUSTIFY_STANDARD: eUno = table::CellVertJustify_STANDARD; break; 300*cdf0e10cSrcweir case SVX_VER_JUSTIFY_TOP: eUno = table::CellVertJustify_TOP; break; 301*cdf0e10cSrcweir case SVX_VER_JUSTIFY_CENTER: eUno = table::CellVertJustify_CENTER; break; 302*cdf0e10cSrcweir case SVX_VER_JUSTIFY_BOTTOM: eUno = table::CellVertJustify_BOTTOM; break; 303*cdf0e10cSrcweir default: ; //prevent warning 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir rVal <<= eUno; 306*cdf0e10cSrcweir break; 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir return sal_True; 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir sal_Bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 315*cdf0e10cSrcweir switch ( nMemberId ) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir case MID_HORJUST_ADJUST: 318*cdf0e10cSrcweir { 319*cdf0e10cSrcweir // property contains ParagraphAdjust values as sal_Int16 320*cdf0e10cSrcweir style::VerticalAlignment nVal = style::VerticalAlignment_TOP; 321*cdf0e10cSrcweir if(!(rVal >>= nVal)) 322*cdf0e10cSrcweir return sal_False; 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir SvxCellVerJustify eSvx = SVX_VER_JUSTIFY_STANDARD; 325*cdf0e10cSrcweir switch (nVal) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir case style::VerticalAlignment_TOP: eSvx = SVX_VER_JUSTIFY_TOP; break; 328*cdf0e10cSrcweir case style::VerticalAlignment_MIDDLE: eSvx = SVX_VER_JUSTIFY_CENTER; break; 329*cdf0e10cSrcweir case style::VerticalAlignment_BOTTOM: eSvx = SVX_VER_JUSTIFY_BOTTOM; break; 330*cdf0e10cSrcweir default:; 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir SetValue( (sal_uInt16)eSvx ); 333*cdf0e10cSrcweir break; 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir default: 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir table::CellVertJustify eUno; 338*cdf0e10cSrcweir if(!(rVal >>= eUno)) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir sal_Int32 nValue = 0; 341*cdf0e10cSrcweir if(!(rVal >>= nValue)) 342*cdf0e10cSrcweir return sal_False; 343*cdf0e10cSrcweir eUno = (table::CellVertJustify)nValue; 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir SvxCellVerJustify eSvx = SVX_VER_JUSTIFY_STANDARD; 347*cdf0e10cSrcweir switch (eUno) 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir case table::CellVertJustify_STANDARD: eSvx = SVX_VER_JUSTIFY_STANDARD; break; 350*cdf0e10cSrcweir case table::CellVertJustify_TOP: eSvx = SVX_VER_JUSTIFY_TOP; break; 351*cdf0e10cSrcweir case table::CellVertJustify_CENTER: eSvx = SVX_VER_JUSTIFY_CENTER; break; 352*cdf0e10cSrcweir case table::CellVertJustify_BOTTOM: eSvx = SVX_VER_JUSTIFY_BOTTOM; break; 353*cdf0e10cSrcweir default: ; //prevent warning 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir SetValue( (sal_uInt16)eSvx ); 356*cdf0e10cSrcweir break; 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir return sal_True; 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir //------------------------------------------------------------------------ 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir XubString SvxVerJustifyItem::GetValueText( sal_uInt16 nVal ) const 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir DBG_ASSERT( nVal <= SVX_VER_JUSTIFY_BOTTOM, "enum overflow!" ); 368*cdf0e10cSrcweir return SVX_RESSTR(RID_SVXITEMS_VERJUST_STANDARD + nVal); 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir //------------------------------------------------------------------------ 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir SfxPoolItem* SvxVerJustifyItem::Clone( SfxItemPool* ) const 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir return new SvxVerJustifyItem( *this ); 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir //------------------------------------------------------------------------ 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir SfxPoolItem* SvxVerJustifyItem::Create( SvStream& rStream, sal_uInt16 ) const 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir sal_uInt16 nVal; 383*cdf0e10cSrcweir rStream >> nVal; 384*cdf0e10cSrcweir return new SvxVerJustifyItem( (SvxCellVerJustify)nVal, Which() ); 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir //------------------------------------------------------------------------ 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir sal_uInt16 SvxVerJustifyItem::GetValueCount() const 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir return SVX_VER_JUSTIFY_BOTTOM + 1; // letzter Enum-Wert + 1 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir // class SvxOrientationItem ---------------------------------------------- 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir SvxOrientationItem::SvxOrientationItem( const SvxCellOrientation eOrientation, 397*cdf0e10cSrcweir const sal_uInt16 nId): 398*cdf0e10cSrcweir SfxEnumItem( nId, (sal_uInt16)eOrientation ) 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir SvxOrientationItem::SvxOrientationItem( sal_Int32 nRotation, sal_Bool bStacked, const sal_uInt16 nId ) : 403*cdf0e10cSrcweir SfxEnumItem( nId ) 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir SetFromRotation( nRotation, bStacked ); 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir //------------------------------------------------------------------------ 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir SfxItemPresentation SvxOrientationItem::GetPresentation 411*cdf0e10cSrcweir ( 412*cdf0e10cSrcweir SfxItemPresentation ePres, 413*cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, 414*cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/, 415*cdf0e10cSrcweir XubString& rText, const IntlWrapper * ) const 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir switch ( ePres ) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 420*cdf0e10cSrcweir rText.Erase(); 421*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 422*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 423*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 424*cdf0e10cSrcweir rText = GetValueText( GetValue() ); 425*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_COMPLETE; 426*cdf0e10cSrcweir default: ; //prevent warning 427*cdf0e10cSrcweir } 428*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir //------------------------------------------------------------------------ 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir sal_Bool SvxOrientationItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir table::CellOrientation eUno = table::CellOrientation_STANDARD; 436*cdf0e10cSrcweir switch ( (SvxCellOrientation)GetValue() ) 437*cdf0e10cSrcweir { 438*cdf0e10cSrcweir case SVX_ORIENTATION_STANDARD: eUno = table::CellOrientation_STANDARD; break; 439*cdf0e10cSrcweir case SVX_ORIENTATION_TOPBOTTOM: eUno = table::CellOrientation_TOPBOTTOM; break; 440*cdf0e10cSrcweir case SVX_ORIENTATION_BOTTOMTOP: eUno = table::CellOrientation_BOTTOMTOP; break; 441*cdf0e10cSrcweir case SVX_ORIENTATION_STACKED: eUno = table::CellOrientation_STACKED; break; 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir rVal <<= eUno; 444*cdf0e10cSrcweir return sal_True; 445*cdf0e10cSrcweir } 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir sal_Bool SvxOrientationItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) 448*cdf0e10cSrcweir { 449*cdf0e10cSrcweir table::CellOrientation eOrient; 450*cdf0e10cSrcweir if(!(rVal >>= eOrient)) 451*cdf0e10cSrcweir { 452*cdf0e10cSrcweir sal_Int32 nValue = 0; 453*cdf0e10cSrcweir if(!(rVal >>= nValue)) 454*cdf0e10cSrcweir return sal_False; 455*cdf0e10cSrcweir eOrient = (table::CellOrientation)nValue; 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir SvxCellOrientation eSvx = SVX_ORIENTATION_STANDARD; 458*cdf0e10cSrcweir switch (eOrient) 459*cdf0e10cSrcweir { 460*cdf0e10cSrcweir case table::CellOrientation_STANDARD: eSvx = SVX_ORIENTATION_STANDARD; break; 461*cdf0e10cSrcweir case table::CellOrientation_TOPBOTTOM: eSvx = SVX_ORIENTATION_TOPBOTTOM; break; 462*cdf0e10cSrcweir case table::CellOrientation_BOTTOMTOP: eSvx = SVX_ORIENTATION_BOTTOMTOP; break; 463*cdf0e10cSrcweir case table::CellOrientation_STACKED: eSvx = SVX_ORIENTATION_STACKED; break; 464*cdf0e10cSrcweir default: ; //prevent warning 465*cdf0e10cSrcweir } 466*cdf0e10cSrcweir SetValue( (sal_uInt16)eSvx ); 467*cdf0e10cSrcweir return sal_True; 468*cdf0e10cSrcweir } 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir //------------------------------------------------------------------------ 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir XubString SvxOrientationItem::GetValueText( sal_uInt16 nVal ) const 473*cdf0e10cSrcweir { 474*cdf0e10cSrcweir DBG_ASSERT( nVal <= SVX_ORIENTATION_STACKED, "enum overflow!" ); 475*cdf0e10cSrcweir return SVX_RESSTR(RID_SVXITEMS_ORI_STANDARD + nVal); 476*cdf0e10cSrcweir } 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir //------------------------------------------------------------------------ 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir SfxPoolItem* SvxOrientationItem::Clone( SfxItemPool* ) const 481*cdf0e10cSrcweir { 482*cdf0e10cSrcweir return new SvxOrientationItem( *this ); 483*cdf0e10cSrcweir } 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir //------------------------------------------------------------------------ 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir SfxPoolItem* SvxOrientationItem::Create( SvStream& rStream, sal_uInt16 ) const 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir sal_uInt16 nVal; 490*cdf0e10cSrcweir rStream >> nVal; 491*cdf0e10cSrcweir return new SvxOrientationItem( (SvxCellOrientation)nVal, Which() ); 492*cdf0e10cSrcweir } 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir //------------------------------------------------------------------------ 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir sal_uInt16 SvxOrientationItem::GetValueCount() const 497*cdf0e10cSrcweir { 498*cdf0e10cSrcweir return SVX_ORIENTATION_STACKED + 1; // letzter Enum-Wert + 1 499*cdf0e10cSrcweir } 500*cdf0e10cSrcweir 501*cdf0e10cSrcweir //------------------------------------------------------------------------ 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir sal_Bool SvxOrientationItem::IsStacked() const 504*cdf0e10cSrcweir { 505*cdf0e10cSrcweir return static_cast< SvxCellOrientation >( GetValue() ) == SVX_ORIENTATION_STACKED; 506*cdf0e10cSrcweir } 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir sal_Int32 SvxOrientationItem::GetRotation( sal_Int32 nStdAngle ) const 509*cdf0e10cSrcweir { 510*cdf0e10cSrcweir sal_Int32 nAngle = nStdAngle; 511*cdf0e10cSrcweir switch( static_cast< SvxCellOrientation >( GetValue() ) ) 512*cdf0e10cSrcweir { 513*cdf0e10cSrcweir case SVX_ORIENTATION_BOTTOMTOP: nAngle = 9000; 514*cdf0e10cSrcweir case SVX_ORIENTATION_TOPBOTTOM: nAngle = 27000; 515*cdf0e10cSrcweir default: ; //prevent warning 516*cdf0e10cSrcweir } 517*cdf0e10cSrcweir return nAngle; 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir void SvxOrientationItem::SetFromRotation( sal_Int32 nRotation, sal_Bool bStacked ) 521*cdf0e10cSrcweir { 522*cdf0e10cSrcweir if( bStacked ) 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir SetValue( SVX_ORIENTATION_STACKED ); 525*cdf0e10cSrcweir } 526*cdf0e10cSrcweir else switch( nRotation ) 527*cdf0e10cSrcweir { 528*cdf0e10cSrcweir case 9000: SetValue( SVX_ORIENTATION_BOTTOMTOP ); break; 529*cdf0e10cSrcweir case 27000: SetValue( SVX_ORIENTATION_TOPBOTTOM ); break; 530*cdf0e10cSrcweir default: SetValue( SVX_ORIENTATION_STANDARD ); 531*cdf0e10cSrcweir } 532*cdf0e10cSrcweir } 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir // class SvxMarginItem --------------------------------------------------- 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir SvxMarginItem::SvxMarginItem( const sal_uInt16 nId ) : 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir SfxPoolItem( nId ), 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir nLeftMargin ( 20 ), 541*cdf0e10cSrcweir nTopMargin ( 20 ), 542*cdf0e10cSrcweir nRightMargin ( 20 ), 543*cdf0e10cSrcweir nBottomMargin( 20 ) 544*cdf0e10cSrcweir { 545*cdf0e10cSrcweir } 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir //------------------------------------------------------------------------ 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir SvxMarginItem::SvxMarginItem( sal_Int16 nLeft, 550*cdf0e10cSrcweir sal_Int16 nTop, 551*cdf0e10cSrcweir sal_Int16 nRight, 552*cdf0e10cSrcweir sal_Int16 nBottom, 553*cdf0e10cSrcweir const sal_uInt16 nId ) : 554*cdf0e10cSrcweir SfxPoolItem( nId ), 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir nLeftMargin ( nLeft ), 557*cdf0e10cSrcweir nTopMargin ( nTop ), 558*cdf0e10cSrcweir nRightMargin ( nRight ), 559*cdf0e10cSrcweir nBottomMargin( nBottom ) 560*cdf0e10cSrcweir { 561*cdf0e10cSrcweir } 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir 564*cdf0e10cSrcweir //------------------------------------------------------------------------ 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir SvxMarginItem::SvxMarginItem( const SvxMarginItem& rItem ) : 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir SfxPoolItem( rItem.Which() ) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir nLeftMargin = rItem.nLeftMargin; 571*cdf0e10cSrcweir nTopMargin = rItem.nTopMargin; 572*cdf0e10cSrcweir nRightMargin = rItem.nRightMargin; 573*cdf0e10cSrcweir nBottomMargin = rItem.nBottomMargin; 574*cdf0e10cSrcweir } 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir //------------------------------------------------------------------------ 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir SfxItemPresentation SvxMarginItem::GetPresentation 579*cdf0e10cSrcweir ( 580*cdf0e10cSrcweir SfxItemPresentation ePres, 581*cdf0e10cSrcweir SfxMapUnit eCoreUnit, 582*cdf0e10cSrcweir SfxMapUnit ePresUnit, 583*cdf0e10cSrcweir XubString& rText, const IntlWrapper *pIntl 584*cdf0e10cSrcweir ) const 585*cdf0e10cSrcweir { 586*cdf0e10cSrcweir #ifndef SVX_LIGHT 587*cdf0e10cSrcweir switch ( ePres ) 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE: 590*cdf0e10cSrcweir rText.Erase(); 591*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 592*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS: 593*cdf0e10cSrcweir { 594*cdf0e10cSrcweir rText = GetMetricText( (long)nLeftMargin, eCoreUnit, ePresUnit, pIntl ); 595*cdf0e10cSrcweir rText += cpDelim; 596*cdf0e10cSrcweir rText += GetMetricText( (long)nTopMargin, eCoreUnit, ePresUnit, pIntl ); 597*cdf0e10cSrcweir rText += cpDelim; 598*cdf0e10cSrcweir rText += GetMetricText( (long)nRightMargin, eCoreUnit, ePresUnit, pIntl ); 599*cdf0e10cSrcweir rText += cpDelim; 600*cdf0e10cSrcweir rText += GetMetricText( (long)nBottomMargin, eCoreUnit, ePresUnit, pIntl ); 601*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NAMELESS; 602*cdf0e10cSrcweir } 603*cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE: 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir rText = SVX_RESSTR(RID_SVXITEMS_MARGIN_LEFT); 606*cdf0e10cSrcweir rText += GetMetricText( (long)nLeftMargin, eCoreUnit, ePresUnit, pIntl ); 607*cdf0e10cSrcweir rText += SVX_RESSTR(GetMetricId(ePresUnit)); 608*cdf0e10cSrcweir rText += cpDelim; 609*cdf0e10cSrcweir rText += SVX_RESSTR(RID_SVXITEMS_MARGIN_TOP); 610*cdf0e10cSrcweir rText += GetMetricText( (long)nTopMargin, eCoreUnit, ePresUnit, pIntl ); 611*cdf0e10cSrcweir rText += SVX_RESSTR(GetMetricId(ePresUnit)); 612*cdf0e10cSrcweir rText += cpDelim; 613*cdf0e10cSrcweir rText += SVX_RESSTR(RID_SVXITEMS_MARGIN_RIGHT); 614*cdf0e10cSrcweir rText += GetMetricText( (long)nRightMargin, eCoreUnit, ePresUnit, pIntl ); 615*cdf0e10cSrcweir rText += SVX_RESSTR(GetMetricId(ePresUnit)); 616*cdf0e10cSrcweir rText += cpDelim; 617*cdf0e10cSrcweir rText += SVX_RESSTR(RID_SVXITEMS_MARGIN_BOTTOM); 618*cdf0e10cSrcweir rText += GetMetricText( (long)nBottomMargin, eCoreUnit, ePresUnit, pIntl ); 619*cdf0e10cSrcweir rText += SVX_RESSTR(GetMetricId(ePresUnit)); 620*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_COMPLETE; 621*cdf0e10cSrcweir } 622*cdf0e10cSrcweir default: ; //prevent warning 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir #endif 625*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE; 626*cdf0e10cSrcweir } 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir //------------------------------------------------------------------------ 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir int SvxMarginItem::operator==( const SfxPoolItem& rItem ) const 631*cdf0e10cSrcweir { 632*cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir return ( ( nLeftMargin == ( (SvxMarginItem&)rItem ).nLeftMargin ) && 635*cdf0e10cSrcweir ( nTopMargin == ( (SvxMarginItem&)rItem ).nTopMargin ) && 636*cdf0e10cSrcweir ( nRightMargin == ( (SvxMarginItem&)rItem ).nRightMargin ) && 637*cdf0e10cSrcweir ( nBottomMargin == ( (SvxMarginItem&)rItem ).nBottomMargin ) ); 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir //------------------------------------------------------------------------ 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir SfxPoolItem* SvxMarginItem::Clone( SfxItemPool* ) const 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir return new SvxMarginItem(*this); 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir //------------------------------------------------------------------------ 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir SfxPoolItem* SvxMarginItem::Create( SvStream& rStream, sal_uInt16 ) const 650*cdf0e10cSrcweir { 651*cdf0e10cSrcweir sal_Int16 nLeft; 652*cdf0e10cSrcweir sal_Int16 nTop; 653*cdf0e10cSrcweir sal_Int16 nRight; 654*cdf0e10cSrcweir sal_Int16 nBottom; 655*cdf0e10cSrcweir rStream >> nLeft; 656*cdf0e10cSrcweir rStream >> nTop; 657*cdf0e10cSrcweir rStream >> nRight; 658*cdf0e10cSrcweir rStream >> nBottom; 659*cdf0e10cSrcweir return new SvxMarginItem( nLeft, nTop, nRight, nBottom, Which() ); 660*cdf0e10cSrcweir } 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir //------------------------------------------------------------------------ 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir SvStream& SvxMarginItem::Store( SvStream &rStream, sal_uInt16 /*nItemVersion*/) const 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir rStream << nLeftMargin; 667*cdf0e10cSrcweir rStream << nTopMargin; 668*cdf0e10cSrcweir rStream << nRightMargin; 669*cdf0e10cSrcweir rStream << nBottomMargin; 670*cdf0e10cSrcweir return rStream; 671*cdf0e10cSrcweir } 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir //------------------------------------------------------------------------ 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir sal_Bool SvxMarginItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const 677*cdf0e10cSrcweir { 678*cdf0e10cSrcweir sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 679*cdf0e10cSrcweir nMemberId &= ~CONVERT_TWIPS; 680*cdf0e10cSrcweir switch ( nMemberId ) 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir // jetzt alles signed 683*cdf0e10cSrcweir case MID_MARGIN_L_MARGIN: 684*cdf0e10cSrcweir rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nLeftMargin) : nLeftMargin ); 685*cdf0e10cSrcweir break; 686*cdf0e10cSrcweir case MID_MARGIN_R_MARGIN: 687*cdf0e10cSrcweir rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nRightMargin) : nRightMargin ); 688*cdf0e10cSrcweir break; 689*cdf0e10cSrcweir case MID_MARGIN_UP_MARGIN: 690*cdf0e10cSrcweir rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nTopMargin) : nTopMargin ); 691*cdf0e10cSrcweir break; 692*cdf0e10cSrcweir case MID_MARGIN_LO_MARGIN: 693*cdf0e10cSrcweir rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nBottomMargin) : nBottomMargin ); 694*cdf0e10cSrcweir break; 695*cdf0e10cSrcweir default: 696*cdf0e10cSrcweir DBG_ERROR("unknown MemberId"); 697*cdf0e10cSrcweir return sal_False; 698*cdf0e10cSrcweir } 699*cdf0e10cSrcweir return sal_True; 700*cdf0e10cSrcweir } 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir //------------------------------------------------------------------------ 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir sal_Bool SvxMarginItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) 705*cdf0e10cSrcweir { 706*cdf0e10cSrcweir sal_Bool bConvert = ( ( nMemberId & CONVERT_TWIPS ) != 0 ); 707*cdf0e10cSrcweir long nMaxVal = bConvert ? TWIP_TO_MM100(SHRT_MAX) : SHRT_MAX; // Members sind sal_Int16 708*cdf0e10cSrcweir sal_Int32 nVal = 0; 709*cdf0e10cSrcweir if(!(rVal >>= nVal) || (nVal > nMaxVal)) 710*cdf0e10cSrcweir return sal_False; 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir switch ( nMemberId & ~CONVERT_TWIPS ) 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir case MID_MARGIN_L_MARGIN: 715*cdf0e10cSrcweir nLeftMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal ); 716*cdf0e10cSrcweir break; 717*cdf0e10cSrcweir case MID_MARGIN_R_MARGIN: 718*cdf0e10cSrcweir nRightMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal ); 719*cdf0e10cSrcweir break; 720*cdf0e10cSrcweir case MID_MARGIN_UP_MARGIN: 721*cdf0e10cSrcweir nTopMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal ); 722*cdf0e10cSrcweir break; 723*cdf0e10cSrcweir case MID_MARGIN_LO_MARGIN: 724*cdf0e10cSrcweir nBottomMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal ); 725*cdf0e10cSrcweir break; 726*cdf0e10cSrcweir default: 727*cdf0e10cSrcweir DBG_ERROR("unknown MemberId"); 728*cdf0e10cSrcweir return sal_False; 729*cdf0e10cSrcweir } 730*cdf0e10cSrcweir return sal_True; 731*cdf0e10cSrcweir } 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir //------------------------------------------------------------------------ 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir sal_Bool SvxMarginItem::SetLeftMargin( sal_Int16 nLeft ) 736*cdf0e10cSrcweir { 737*cdf0e10cSrcweir nLeftMargin = nLeft; 738*cdf0e10cSrcweir return sal_True; 739*cdf0e10cSrcweir } 740*cdf0e10cSrcweir 741*cdf0e10cSrcweir //------------------------------------------------------------------------ 742*cdf0e10cSrcweir 743*cdf0e10cSrcweir sal_Bool SvxMarginItem::SetTopMargin( sal_Int16 nTop ) 744*cdf0e10cSrcweir { 745*cdf0e10cSrcweir nTopMargin = nTop; 746*cdf0e10cSrcweir return sal_True; 747*cdf0e10cSrcweir } 748*cdf0e10cSrcweir 749*cdf0e10cSrcweir //------------------------------------------------------------------------ 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir sal_Bool SvxMarginItem::SetRightMargin( sal_Int16 nRight ) 752*cdf0e10cSrcweir { 753*cdf0e10cSrcweir nRightMargin = nRight; 754*cdf0e10cSrcweir return sal_True; 755*cdf0e10cSrcweir } 756*cdf0e10cSrcweir 757*cdf0e10cSrcweir //------------------------------------------------------------------------ 758*cdf0e10cSrcweir 759*cdf0e10cSrcweir sal_Bool SvxMarginItem::SetBottomMargin( sal_Int16 nBottom ) 760*cdf0e10cSrcweir { 761*cdf0e10cSrcweir nBottomMargin = nBottom; 762*cdf0e10cSrcweir return sal_True; 763*cdf0e10cSrcweir } 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir 766