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