diff options
author | Mathias Bauer <mba@openoffice.org> | 2002-05-22 11:05:15 +0000 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2002-05-22 11:05:15 +0000 |
commit | b3099fad1c84d74da23418839147b776c2fa1233 (patch) | |
tree | f6a774aa19d0e45c7caf50c76a9fa498dc5a81d7 | |
parent | bb9150301a0b1f5f99f79cc64698f28f3c419758 (diff) |
#98405#: Query/PutValue changed
-rw-r--r-- | svx/source/items/algitem.cxx | 13 | ||||
-rw-r--r-- | svx/source/items/frmitems.cxx | 121 | ||||
-rw-r--r-- | svx/source/items/grfitem.cxx | 12 | ||||
-rw-r--r-- | svx/source/items/hlnkitem.cxx | 8 | ||||
-rw-r--r-- | svx/source/items/pageitem.cxx | 6 | ||||
-rw-r--r-- | svx/source/items/paraitem.cxx | 119 | ||||
-rw-r--r-- | svx/source/items/textitem.cxx | 56 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 24 | ||||
-rw-r--r-- | svx/source/xoutdev/xattrbmp.cxx | 8 |
9 files changed, 294 insertions, 73 deletions
diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx index 9a13f332666d..cfaa9547e640 100644 --- a/svx/source/items/algitem.cxx +++ b/svx/source/items/algitem.cxx @@ -2,9 +2,9 @@ * * $RCSfile: algitem.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: nn $ $Date: 2001-05-23 17:24:48 $ + * last change: $Author: mba $ $Date: 2002-05-22 12:03:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -170,6 +170,8 @@ SfxItemPresentation SvxHorJustifyItem::GetPresentation sal_Bool SvxHorJustifyItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) { case MID_HORJUST_HORJUST: @@ -212,6 +214,8 @@ sal_Bool SvxHorJustifyItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const sal_Bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) { case MID_HORJUST_HORJUST: @@ -635,8 +639,9 @@ SvStream& SvxMarginItem::Store( SvStream &rStream, USHORT nItemVersion) const sal_Bool SvxMarginItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { - sal_Bool bConvert = ( ( nMemberId & CONVERT_TWIPS ) != 0 ); - switch ( nMemberId & ~CONVERT_TWIPS ) + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + switch ( nMemberId ) { // jetzt alles signed case MID_MARGIN_L_MARGIN: diff --git a/svx/source/items/frmitems.cxx b/svx/source/items/frmitems.cxx index 43c616927efb..1d0dc08db9bb 100644 --- a/svx/source/items/frmitems.cxx +++ b/svx/source/items/frmitems.cxx @@ -2,9 +2,9 @@ * * $RCSfile: frmitems.cxx,v $ * - * $Revision: 1.22 $ + * $Revision: 1.23 $ * - * last change: $Author: dvo $ $Date: 2002-02-06 14:18:14 $ + * last change: $Author: mba $ $Date: 2002-05-22 12:03:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -338,25 +338,33 @@ SvxSizeItem::SvxSizeItem( const sal_uInt16 nId, const Size& rSize ) : // ----------------------------------------------------------------------- sal_Bool SvxSizeItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + awt::Size aTmp(aSize.Width(), aSize.Height()); - if(nMemberId&CONVERT_TWIPS) + if( bConvert ) { aTmp.Height = TWIP_TO_MM100(aTmp.Height); aTmp.Width = TWIP_TO_MM100(aTmp.Width); } - switch(nMemberId&(~CONVERT_TWIPS)) + + switch( nMemberId ) { case MID_SIZE_SIZE: rVal <<= aTmp; break; case MID_SIZE_WIDTH: rVal <<= aTmp.Width; break; case MID_SIZE_HEIGHT: rVal <<= aTmp.Height; break; + default: DBG_ERROR("Wrong MemberId!"); return sal_False; } + return sal_True; } // ----------------------------------------------------------------------- sal_Bool SvxSizeItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - switch(nMemberId&(~CONVERT_TWIPS)) + nMemberId &= ~CONVERT_TWIPS; + + switch( nMemberId ) { case MID_SIZE_SIZE: { @@ -394,7 +402,7 @@ sal_Bool SvxSizeItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) aSize.Height() = bConvert ? MM100_TO_TWIP(nVal) : nVal; } break; - default: + default: DBG_ERROR("Wrong MemberId!"); return sal_False; } return sal_True; @@ -1245,6 +1253,8 @@ int SvxProtectItem::operator==( const SfxPoolItem& rAttr ) const --------------------------------------------------*/ sal_Bool SvxProtectItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Bool bValue; switch(nMemberId) { @@ -1264,6 +1274,8 @@ sal_Bool SvxProtectItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const --------------------------------------------------*/ sal_Bool SvxProtectItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Bool bVal( Any2Bool(rVal) ); switch(nMemberId) { @@ -1370,6 +1382,9 @@ SvxShadowItem::SvxShadowItem( const USHORT nId, // ----------------------------------------------------------------------- sal_Bool SvxShadowItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + table::ShadowFormat aShadow; table::ShadowLocation eSet = table::ShadowLocation_NONE; switch( eLocation ) @@ -1380,18 +1395,42 @@ sal_Bool SvxShadowItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const case SVX_SHADOW_BOTTOMRIGHT: eSet = table::ShadowLocation_BOTTOM_RIGHT; break; } aShadow.Location = eSet; - aShadow.ShadowWidth = nMemberId&CONVERT_TWIPS ? TWIP_TO_MM100(nWidth) : nWidth; + aShadow.ShadowWidth = bConvert ? TWIP_TO_MM100(nWidth) : nWidth; aShadow.IsTransparent = aShadowColor.GetTransparency() > 0; aShadow.Color = aShadowColor.GetRGBColor(); - rVal <<= aShadow; + + switch ( nMemberId ) + { + case MID_LOCATION: rVal <<= aShadow.Location; break; + case MID_WIDTH: rVal <<= aShadow.ShadowWidth; break; + case MID_TRANSPARENT: rVal <<= aShadow.IsTransparent; break; + case MID_BG_COLOR: rVal <<= aShadow.Color; break; + case 0: rVal <<= aShadow; break; + default: DBG_ERROR("Wrong MemberId!"); return sal_False; + } + return sal_True; } // ----------------------------------------------------------------------- sal_Bool SvxShadowItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + table::ShadowFormat aShadow; + uno::Any aAny; + sal_Bool bRet = QueryValue( aAny, bConvert ? CONVERT_TWIPS : 0 ) && ( aAny >>= aShadow ); + switch ( nMemberId ) + { + case MID_LOCATION: rVal >>= aShadow.Location; break; + case MID_WIDTH: rVal >>= aShadow.ShadowWidth; break; + case MID_TRANSPARENT: rVal >>= aShadow.IsTransparent; break; + case MID_BG_COLOR: rVal >>= aShadow.Color; break; + case 0: rVal >>= aShadow; break; + default: DBG_ERROR("Wrong MemberId!"); return sal_False; + } - if(rVal >>= aShadow) + if ( bRet ) { SvxShadowLocation eSet = SVX_SHADOW_NONE; switch( aShadow.Location ) @@ -1401,13 +1440,14 @@ sal_Bool SvxShadowItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) case table::ShadowLocation_BOTTOM_LEFT : eLocation = SVX_SHADOW_BOTTOMLEFT ; break; case table::ShadowLocation_BOTTOM_RIGHT: eLocation = SVX_SHADOW_BOTTOMRIGHT; break; } - nWidth = nMemberId&CONVERT_TWIPS ? MM100_TO_TWIP(aShadow.ShadowWidth) : aShadow.ShadowWidth; + + nWidth = bConvert ? MM100_TO_TWIP(aShadow.ShadowWidth) : aShadow.ShadowWidth; Color aSet(aShadow.Color); aSet.SetTransparency(aShadow.IsTransparent ? 0xff : 0); aShadowColor = aSet; - return sal_True; } - return sal_False; + + return bRet; } // ----------------------------------------------------------------------- @@ -2865,6 +2905,57 @@ SfxPoolItem* SvxLineItem::Clone( SfxItemPool* ) const return new SvxLineItem( *this ); } +sal_Bool SvxLineItem::QueryValue( uno::Any& rVal, BYTE nMemId ) const +{ + sal_Bool bConvert = 0!=(nMemId&CONVERT_TWIPS); + nMemId &= ~CONVERT_TWIPS; + sal_Int32 nVal = 0; + if( pLine ) + { + switch ( nMemId ) + { + case MID_FG_COLOR: nVal = pLine->GetColor().GetColor(); break; + case MID_OUTER_WIDTH: nVal = pLine->GetOutWidth(); break; + case MID_INNER_WIDTH: nVal = pLine->GetInWidth( ); break; + case MID_DISTANCE: nVal = pLine->GetDistance(); break; + default: + DBG_ERROR( "Wrong MemberId" ); + return sal_False; + } + } + + rVal <<= nVal; + return TRUE; +} + +// ----------------------------------------------------------------------- + +sal_Bool SvxLineItem::PutValue( const uno::Any& rVal, BYTE nMemId ) +{ + sal_Bool bConvert = 0!=(nMemId&CONVERT_TWIPS); + nMemId &= ~CONVERT_TWIPS; + sal_Int32 nVal; + if ( rVal >>= nVal ) + { + if ( !pLine ) + pLine = new SvxBorderLine; + switch ( nMemId ) + { + case MID_FG_COLOR: pLine->SetColor( Color(nVal) ); break; + case MID_OUTER_WIDTH: pLine->SetOutWidth(nVal); break; + case MID_INNER_WIDTH: pLine->SetInWidth( nVal); break; + case MID_DISTANCE: pLine->SetDistance(nVal); break; + default: + DBG_ERROR( "Wrong MemberId" ); + return sal_False; + } + + return sal_True; + } + + return sal_False; +} + //------------------------------------------------------------------------ SfxItemPresentation SvxLineItem::GetPresentation @@ -3270,6 +3361,8 @@ sal_uInt16 SvxBrushItem::GetVersion( sal_uInt16 nFileVersion ) const sal_Bool SvxBrushItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch( nMemberId) { case MID_BACK_COLOR: @@ -3277,7 +3370,7 @@ sal_Bool SvxBrushItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const break; case MID_GRAPHIC_POSITION: - rVal <<= (style::GraphicLocation)(sal_uInt16)eGraphicPos; + rVal <<= (style::GraphicLocation)(sal_Int16)eGraphicPos; break; case MID_GRAPHIC: @@ -3322,6 +3415,8 @@ sal_Bool SvxBrushItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const sal_Bool SvxBrushItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch( nMemberId) { case MID_BACK_COLOR: diff --git a/svx/source/items/grfitem.cxx b/svx/source/items/grfitem.cxx index fee7f8a93e80..5839b8270dea 100644 --- a/svx/source/items/grfitem.cxx +++ b/svx/source/items/grfitem.cxx @@ -2,9 +2,9 @@ * * $RCSfile: grfitem.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: er $ $Date: 2001-05-13 03:29:15 $ + * last change: $Author: mba $ $Date: 2002-05-22 12:03:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -161,13 +161,15 @@ SvStream& SvxGrfCrop::Store( SvStream& rStrm, USHORT nVersion ) const BOOL SvxGrfCrop::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; text::GraphicCrop aRet; aRet.Left = nLeft; aRet.Right = nRight; aRet.Top = nTop; aRet.Bottom = nBottom; - if(nMemberId&CONVERT_TWIPS) + if( bConvert ) { aRet.Right = TWIP_TO_MM100(aRet.Right ); aRet.Top = TWIP_TO_MM100(aRet.Top ); @@ -182,11 +184,13 @@ BOOL SvxGrfCrop::QueryValue( uno::Any& rVal, BYTE nMemberId ) const BOOL SvxGrfCrop::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; text::GraphicCrop aVal; if(!(rVal >>= aVal)) return sal_False; - if(nMemberId&CONVERT_TWIPS) + if( bConvert ) { aVal.Right = MM100_TO_TWIP(aVal.Right ); aVal.Top = MM100_TO_TWIP(aVal.Top ); diff --git a/svx/source/items/hlnkitem.cxx b/svx/source/items/hlnkitem.cxx index d7461f95881a..dd6edf605e99 100644 --- a/svx/source/items/hlnkitem.cxx +++ b/svx/source/items/hlnkitem.cxx @@ -2,9 +2,9 @@ * * $RCSfile: hlnkitem.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mba $ $Date: 2002-04-08 16:53:32 $ + * last change: $Author: mba $ $Date: 2002-05-22 12:03:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -397,6 +397,8 @@ void SvxHyperlinkItem::SetMacroTable( const SvxMacroTableDtor& rTbl ) BOOL SvxHyperlinkItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { case MID_HLINK_NAME : @@ -420,6 +422,8 @@ BOOL SvxHyperlinkItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberI BOOL SvxHyperlinkItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; ::rtl::OUString aStr; sal_Int32 nVal; switch(nMemberId) diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx index 8f5624713d23..004b3fd27075 100644 --- a/svx/source/items/pageitem.cxx +++ b/svx/source/items/pageitem.cxx @@ -2,9 +2,9 @@ * * $RCSfile: pageitem.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: er $ $Date: 2001-05-13 03:29:15 $ + * last change: $Author: mba $ $Date: 2002-05-22 12:03:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -209,6 +209,8 @@ SfxItemPresentation SvxPageItem::GetPresentation //------------------------------------------------------------------------ sal_Bool SvxPageItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { case MID_PAGE_NUMTYPE: diff --git a/svx/source/items/paraitem.cxx b/svx/source/items/paraitem.cxx index bfa88c548b67..36ef162b7517 100644 --- a/svx/source/items/paraitem.cxx +++ b/svx/source/items/paraitem.cxx @@ -2,9 +2,9 @@ * * $RCSfile: paraitem.cxx,v $ * - * $Revision: 1.22 $ + * $Revision: 1.23 $ * - * last change: $Author: hr $ $Date: 2002-05-16 16:09:59 $ + * last change: $Author: mba $ $Date: 2002-05-22 12:03:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -221,6 +221,9 @@ int SvxLineSpacingItem::operator==( const SfxPoolItem& rAttr ) const --------------------------------------------------*/ sal_Bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + style::LineSpacing aLSp; switch( eLineSpace ) { @@ -244,10 +247,17 @@ sal_Bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const case SVX_LINE_SPACE_FIX : case SVX_LINE_SPACE_MIN : aLSp.Mode = eLineSpace == SVX_LINE_SPACE_FIX ? style::LineSpacingMode::FIX : style::LineSpacingMode::MINIMUM; - aLSp.Height = ( ( nMemberId & CONVERT_TWIPS ) == CONVERT_TWIPS ) ? (short)TWIP_TO_MM100(nLineHeight) : nLineHeight; + aLSp.Height = ( bConvert ? (short)TWIP_TO_MM100(nLineHeight) : nLineHeight ); break; } - rVal <<= aLSp; + + switch ( nMemberId ) + { + case 0 : rVal <<= aLSp; break; + case MID_LINESPACE : rVal <<= aLSp.Mode; break; + case MID_HEIGHT : rVal <<= aLSp.Height; break; + default: DBG_ERROR("Wrong MemberId!"); break; + } return sal_True; } @@ -256,41 +266,59 @@ sal_Bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const --------------------------------------------------*/ sal_Bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + + // fill with current data style::LineSpacing aLSp; - if(!(rVal >>= aLSp)) - return sal_False; + uno::Any aAny; + sal_Bool bRet = QueryValue( aAny, bConvert ? CONVERT_TWIPS : 0 ) && ( aAny >>= aLSp ); - switch( aLSp.Mode ) + // get new data + switch ( nMemberId ) { - case style::LineSpacingMode::LEADING: - { - eInterLineSpace = SVX_INTER_LINE_SPACE_FIX; - eLineSpace = SVX_LINE_SPACE_AUTO; - nInterLineSpace = aLSp.Height; - } - break; - case style::LineSpacingMode::PROP: - { - eLineSpace = SVX_LINE_SPACE_AUTO; - nPropLineSpace = (sal_Int8)std::min(aLSp.Height, (short)0xFF); - if(100 == aLSp.Height) - eInterLineSpace = SVX_INTER_LINE_SPACE_OFF; - else - eInterLineSpace = SVX_INTER_LINE_SPACE_PROP; - } - break; - case style::LineSpacingMode::FIX: - case style::LineSpacingMode::MINIMUM: + case 0 : bRet = (rVal >>= aLSp); break; + case MID_LINESPACE : bRet = (rVal >>= aLSp.Mode); break; + case MID_HEIGHT : bRet = (rVal >>= aLSp.Height); break; + default: DBG_ERROR("Wrong MemberId!"); break; + } + + if( bRet ) + { + nLineHeight = aLSp.Height; + switch( aLSp.Mode ) { - eInterLineSpace = SVX_INTER_LINE_SPACE_OFF; - eLineSpace = aLSp.Mode == style::LineSpacingMode::FIX ? SVX_LINE_SPACE_FIX : SVX_LINE_SPACE_MIN; - nLineHeight = aLSp.Height; - if(nMemberId&CONVERT_TWIPS) - nLineHeight = (USHORT)MM100_TO_TWIP(nLineHeight); + case style::LineSpacingMode::LEADING: + { + eInterLineSpace = SVX_INTER_LINE_SPACE_FIX; + eLineSpace = SVX_LINE_SPACE_AUTO; + nInterLineSpace = aLSp.Height; + } + break; + case style::LineSpacingMode::PROP: + { + eLineSpace = SVX_LINE_SPACE_AUTO; + nPropLineSpace = (sal_Int8)std::min(aLSp.Height, (short)0xFF); + if(100 == aLSp.Height) + eInterLineSpace = SVX_INTER_LINE_SPACE_OFF; + else + eInterLineSpace = SVX_INTER_LINE_SPACE_PROP; + } + break; + case style::LineSpacingMode::FIX: + case style::LineSpacingMode::MINIMUM: + { + eInterLineSpace = SVX_INTER_LINE_SPACE_OFF; + eLineSpace = aLSp.Mode == style::LineSpacingMode::FIX ? SVX_LINE_SPACE_FIX : SVX_LINE_SPACE_MIN; + nLineHeight = aLSp.Height; + if(nMemberId&CONVERT_TWIPS) + nLineHeight = (USHORT)MM100_TO_TWIP(nLineHeight); + } + break; } - break; } - return sal_True; + + return bRet; } // ----------------------------------------------------------------------- @@ -430,6 +458,8 @@ int SvxAdjustItem::operator==( const SfxPoolItem& rAttr ) const --------------------------------------------------*/ sal_Bool SvxAdjustItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { case MID_PARA_ADJUST : rVal <<= (sal_Int16)GetAdjust(); break; @@ -449,6 +479,8 @@ sal_Bool SvxAdjustItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const sal_Bool SvxAdjustItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { case MID_PARA_ADJUST : @@ -721,6 +753,8 @@ SvxHyphenZoneItem::SvxHyphenZoneItem( const sal_Bool bHyph, const sal_uInt16 nId // ----------------------------------------------------------------------- sal_Bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { case MID_IS_HYPHEN: @@ -741,6 +775,8 @@ sal_Bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) cons // ----------------------------------------------------------------------- sal_Bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Int16 nNewVal = 0; if( nMemberId != MID_IS_HYPHEN ) @@ -1017,7 +1053,9 @@ typedef sequence ::com::sun::star::style::TabStop> TabSTopSequence; sal_Bool SvxTabStopItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { - switch (nMemberId & ~CONVERT_TWIPS) + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + switch ( nMemberId ) { case MID_TABSTOPS: { @@ -1027,7 +1065,7 @@ sal_Bool SvxTabStopItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const for(sal_uInt16 i = 0; i < nCount; i++) { const SvxTabStop& rTab = *(GetStart() + i); - pArr[i].Position = nMemberId&CONVERT_TWIPS ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos(); + pArr[i].Position = bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos(); switch(rTab.GetAdjustment()) { case SVX_TAB_ADJUST_LEFT : pArr[i].Alignment = style::TabAlign_LEFT; break; @@ -1047,7 +1085,7 @@ sal_Bool SvxTabStopItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const case MID_STD_TAB: { const SvxTabStop &rTab = *(GetStart()); - rVal <<= nMemberId & CONVERT_TWIPS ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos(); + rVal <<= bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos(); break; } } @@ -1059,7 +1097,9 @@ sal_Bool SvxTabStopItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const sal_Bool SvxTabStopItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { - switch ( nMemberId & ~CONVERT_TWIPS) + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + switch ( nMemberId ) { case MID_TABSTOPS: { @@ -1082,8 +1122,7 @@ sal_Bool SvxTabStopItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) } sal_Unicode cFill = pArr[i].FillChar; sal_Unicode cDecimal = pArr[i].DecimalChar; -; - SvxTabStop aTab( nMemberId&CONVERT_TWIPS ? MM100_TO_TWIP(pArr[i].Position) : pArr[i].Position, + SvxTabStop aTab( bConvert ? MM100_TO_TWIP(pArr[i].Position) : pArr[i].Position, eAdjust, cDecimal, cFill ); @@ -1097,7 +1136,7 @@ sal_Bool SvxTabStopItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) if (!(rVal >>= nNewPos) ) return sal_False; const SvxTabStop& rTab = *(GetStart()); - SvxTabStop aNewTab ( nMemberId&CONVERT_TWIPS ? MM100_TO_TWIP ( nNewPos ) : nNewPos, + SvxTabStop aNewTab ( bConvert ? MM100_TO_TWIP ( nNewPos ) : nNewPos, rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() ); Remove ( 0 ); Insert( aNewTab ); diff --git a/svx/source/items/textitem.cxx b/svx/source/items/textitem.cxx index f48556836985..e90790c5624f 100644 --- a/svx/source/items/textitem.cxx +++ b/svx/source/items/textitem.cxx @@ -2,9 +2,9 @@ * * $RCSfile: textitem.cxx,v $ * - * $Revision: 1.44 $ + * $Revision: 1.45 $ * - * last change: $Author: tl $ $Date: 2002-05-13 15:21:51 $ + * last change: $Author: mba $ $Date: 2002-05-22 12:03:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -362,6 +362,8 @@ SvxFontItem::SvxFontItem( const FontFamily eFam, const XubString& aName, sal_Bool SvxFontItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { case MID_FONT_FAMILY_NAME : @@ -379,6 +381,8 @@ sal_Bool SvxFontItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const // ----------------------------------------------------------------------- sal_Bool SvxFontItem::PutValue( const uno::Any& rVal, BYTE nMemberId) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { case MID_FONT_FAMILY_NAME : @@ -625,6 +629,8 @@ XubString SvxPostureItem::GetValueTextByPos( USHORT nPos ) const --------------------------------------------------*/ sal_Bool SvxPostureItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { case MID_ITALIC: @@ -641,6 +647,8 @@ sal_Bool SvxPostureItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const --------------------------------------------------*/ sal_Bool SvxPostureItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { case MID_ITALIC: @@ -780,6 +788,8 @@ XubString SvxWeightItem::GetValueTextByPos( USHORT nPos ) const --------------------------------------------------*/ sal_Bool SvxWeightItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { case MID_BOLD : @@ -798,6 +808,8 @@ sal_Bool SvxWeightItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const --------------------------------------------------*/ sal_Bool SvxWeightItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { case MID_BOLD : @@ -1224,6 +1236,8 @@ int SvxFontWidthItem::operator==( const SfxPoolItem& rItem ) const --------------------------------------------------*/ sal_Bool SvxFontWidthItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { case MID_FONTWIDTH: @@ -1240,6 +1254,8 @@ sal_Bool SvxFontWidthItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const --------------------------------------------------*/ sal_Bool SvxFontWidthItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Int16 nVal; if(!(rVal >>= nVal)) return sal_False; @@ -1391,6 +1407,8 @@ XubString SvxUnderlineItem::GetValueTextByPos( USHORT nPos ) const --------------------------------------------------*/ sal_Bool SvxUnderlineItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { case MID_UNDERLINED: @@ -1414,6 +1432,8 @@ sal_Bool SvxUnderlineItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const --------------------------------------------------*/ sal_Bool SvxUnderlineItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = sal_True; switch(nMemberId) { @@ -1553,6 +1573,8 @@ XubString SvxCrossedOutItem::GetValueTextByPos( USHORT nPos ) const --------------------------------------------------*/ sal_Bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { case MID_CROSSED_OUT: @@ -1569,6 +1591,8 @@ sal_Bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const --------------------------------------------------*/ sal_Bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { case MID_CROSSED_OUT: @@ -2435,6 +2459,8 @@ void SvxEscapementItem::SetEnumValue( USHORT nVal ) --------------------------------------------------*/ sal_Bool SvxEscapementItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { case MID_ESC: @@ -2454,6 +2480,8 @@ sal_Bool SvxEscapementItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const --------------------------------------------------*/ sal_Bool SvxEscapementItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { case MID_ESC: @@ -2566,9 +2594,11 @@ SfxItemPresentation SvxLanguageItem::GetPresentation --------------------------------------------------*/ sal_Bool SvxLanguageItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { - case MID_LANG_INT: + case MID_LANG_INT: // for basic conversions! rVal <<= (sal_Int16)(GetValue()); break; case MID_LANG_LOCALE: @@ -2587,9 +2617,11 @@ sal_Bool SvxLanguageItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const --------------------------------------------------*/ sal_Bool SvxLanguageItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { - case MID_LANG_INT: + case MID_LANG_INT: // for basic conversions! { sal_Int32 nValue; if(!(rVal >>= nValue)) @@ -2893,6 +2925,8 @@ SfxItemPresentation SvxEmphasisMarkItem::GetPresentation sal_Bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { case MID_EMPHASIS: @@ -2918,6 +2952,8 @@ sal_Bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const sal_Bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = sal_True; switch( nMemberId ) { @@ -2994,6 +3030,8 @@ SfxPoolItem* SvxTwoLinesItem::Clone( SfxItemPool* ) const sal_Bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = sal_True; switch( nMemberId ) { @@ -3026,6 +3064,8 @@ sal_Bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal, sal_Bool SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = sal_False; OUString s; switch( nMemberId ) @@ -3176,6 +3216,8 @@ SfxItemPresentation SvxCharRotateItem::GetPresentation( sal_Bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = sal_True; switch( nMemberId ) { @@ -3195,6 +3237,8 @@ sal_Bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal, sal_Bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = sal_True; sal_Int16 nVal; switch( nMemberId ) @@ -3409,6 +3453,8 @@ SfxItemPresentation SvxCharReliefItem::GetPresentation sal_Bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = sal_True; switch( nMemberId ) { @@ -3432,6 +3478,8 @@ sal_Bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal, sal_Bool SvxCharReliefItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = sal_True; switch( nMemberId ) { diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 46914cfa685e..c1402c581dc8 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xattr.cxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: cl $ $Date: 2002-04-08 13:52:31 $ + * last change: $Author: mba $ $Date: 2002-05-22 12:05:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -975,6 +975,8 @@ FASTBOOL XLineDashItem::ScaleMetrics(long nMul, long nDiv) sal_Bool XLineDashItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { rtl::OUString aApiName; @@ -1002,6 +1004,8 @@ sal_Bool XLineDashItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemb sal_Bool XLineDashItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { rtl::OUString aName; @@ -1499,6 +1503,8 @@ SfxItemPresentation XLineStartItem::GetPresentation sal_Bool XLineStartItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { rtl::OUString aApiName; @@ -1517,6 +1523,8 @@ sal_Bool XLineStartItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMem sal_Bool XLineStartItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { return sal_False; @@ -2194,6 +2202,8 @@ SfxItemPresentation XLineEndItem::GetPresentation sal_Bool XLineEndItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const { #ifndef SVX_LIGHT + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { rtl::OUString aApiName; @@ -2212,6 +2222,8 @@ sal_Bool XLineEndItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMembe sal_Bool XLineEndItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { return sal_False; @@ -3271,6 +3283,8 @@ SfxItemPresentation XFillGradientItem::GetPresentation // ----------------------------------------------------------------------- sal_Bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { rtl::OUString aApiName; @@ -3302,6 +3316,8 @@ sal_Bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE n // ----------------------------------------------------------------------- sal_Bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; ::com::sun::star::awt::Gradient aGradient; if(!(rVal >>= aGradient)) return sal_False; @@ -3806,6 +3822,8 @@ FASTBOOL XFillHatchItem::ScaleMetrics(long nMul, long nDiv) // ----------------------------------------------------------------------- sal_Bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { rtl::OUString aApiName; @@ -3829,6 +3847,8 @@ sal_Bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMem // ----------------------------------------------------------------------- sal_Bool XFillHatchItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; ::com::sun::star::drawing::Hatch aUnoHatch; if(!(rVal >>= aUnoHatch)) return sal_False; diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index 9b08e6a3d845..ff81dd4e15f8 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xattrbmp.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: er $ $Date: 2001-05-13 03:30:56 $ + * last change: $Author: mba $ $Date: 2002-05-22 12:05:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -748,6 +748,8 @@ SfxItemPresentation XFillBitmapItem::GetPresentation sal_Bool XFillBitmapItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { rtl::OUString aApiName; @@ -780,6 +782,8 @@ sal_Bool XFillBitmapItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMe sal_Bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) { + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; if( nMemberId == MID_NAME ) { ::rtl::OUString aName; |