diff options
author | Mathias Bauer <mba@openoffice.org> | 2002-05-27 13:35:24 +0000 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2002-05-27 13:35:24 +0000 |
commit | 3a268dab99e3918329bf5f463f7e33181a60c461 (patch) | |
tree | ee2231fa5c3e2154466fe5bdf569e0d76e92db81 /svx | |
parent | a7d4500bc6b462a2c0c4c5ec37dd0bd66d95dfde (diff) |
#98405#: Put/QueryValue implemented
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/rulritem.cxx | 86 | ||||
-rw-r--r-- | svx/source/items/frmitems.cxx | 212 | ||||
-rw-r--r-- | svx/source/items/paraitem.cxx | 35 | ||||
-rw-r--r-- | svx/source/items/zoomitem.cxx | 36 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 464 |
5 files changed, 726 insertions, 107 deletions
diff --git a/svx/source/dialog/rulritem.cxx b/svx/source/dialog/rulritem.cxx index 7d6451b6ecfb..616fc08aeb1d 100644 --- a/svx/source/dialog/rulritem.cxx +++ b/svx/source/dialog/rulritem.cxx @@ -2,9 +2,9 @@ * * $RCSfile: rulritem.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mba $ $Date: 2002-05-22 11:45:46 $ + * last change: $Author: mba $ $Date: 2002-05-27 14:26:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -537,6 +537,51 @@ long SvxColumnItem::GetVisibleRight() const return (*this)[nIdx].nEnd; } +sal_Bool SvxColumnItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + switch ( nMemberId ) + { + case MID_COLUMNARRAY: + { + return sal_False; + break; + } + case MID_RIGHT: rVal <<= nRight; break; + case MID_LEFT: rVal <<= nLeft; break; + case MID_ORTHO: rVal <<= (sal_Bool) bOrtho; break; + case MID_ACTUAL: rVal <<= (sal_Int32) nActColumn; break; + case MID_TABLE: rVal <<= (sal_Bool) bTable; break; + default: DBG_ERROR("Wrong MemberId!"); return sal_False; + } + + return sal_True; +} + +sal_Bool SvxColumnItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + sal_Int32 nVal; + switch ( nMemberId ) + { + case MID_COLUMNARRAY: + { + return sal_False; + break; + } + case MID_RIGHT: rVal >>= nRight; break; + case MID_LEFT: rVal >>= nLeft; break; + case MID_ORTHO: rVal >>= nVal; bOrtho = (BOOL) nVal; break; + case MID_ACTUAL: rVal >>= nVal; nActColumn = (USHORT) nVal; break; + case MID_TABLE: rVal >>= nVal; bTable = (BOOL) nVal; break; + default: DBG_ERROR("Wrong MemberId!"); return sal_False; + } + + return sal_True; +} + //------------------------------------------------------------------------ int SvxObjectItem::operator==( const SfxPoolItem& rCmp ) const @@ -607,4 +652,41 @@ SvxObjectItem::SvxObjectItem( const SvxObjectItem& rCopy ) : { } +sal_Bool SvxObjectItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + sal_Int32 nVal = 0; + switch ( nMemberId ) + { + case MID_START_X : rVal <<= nStartX; break; + case MID_START_Y : rVal <<= nStartY; break; + case MID_END_X : rVal <<= nEndX; break; + case MID_END_Y : rVal <<= nEndY; break; + case MID_LIMIT : rVal <<= bLimits; break; + default: + DBG_ERROR( "Wrong MemberId" ); + return sal_False; + } + + return TRUE; +} + +sal_Bool SvxObjectItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + BOOL bRet=FALSE; + switch ( nMemberId ) + { + case MID_START_X : bRet = (rVal >>= nStartX); break; + case MID_START_Y : bRet = (rVal >>= nStartY); break; + case MID_END_X : bRet = (rVal >>= nEndX); break; + case MID_END_Y : bRet = (rVal >>= nEndY); break; + case MID_LIMIT : bRet = (rVal >>= bLimits); break; + default: DBG_ERROR( "Wrong MemberId" ); + } + + return bRet; +} diff --git a/svx/source/items/frmitems.cxx b/svx/source/items/frmitems.cxx index 1d0dc08db9bb..48371cf7c805 100644 --- a/svx/source/items/frmitems.cxx +++ b/svx/source/items/frmitems.cxx @@ -2,9 +2,9 @@ * * $RCSfile: frmitems.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: mba $ $Date: 2002-05-22 12:03:49 $ + * last change: $Author: mba $ $Date: 2002-05-27 14:27:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1871,17 +1871,26 @@ sal_Bool SvxBoxItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const sal_uInt16 nDist; sal_Bool bDistMember = sal_False; nMemberId &= ~CONVERT_TWIPS; + sal_Bool bSerialize = sal_False; switch(nMemberId) { + case MID_LEFT_BORDER: + bSerialize = sal_True; // intentionally no break! case LEFT_BORDER: aRetLine = lcl_SvxLineToLine(GetLeft(), bConvert); break; + case MID_RIGHT_BORDER: + bSerialize = sal_True; // intentionally no break! case RIGHT_BORDER: aRetLine = lcl_SvxLineToLine(GetRight(), bConvert); break; + case MID_BOTTOM_BORDER: + bSerialize = sal_True; // intentionally no break! case BOTTOM_BORDER: aRetLine = lcl_SvxLineToLine(GetBottom(), bConvert); break; + case MID_TOP_BORDER: + bSerialize = sal_True; // intentionally no break! case TOP_BORDER: aRetLine = lcl_SvxLineToLine(GetTop(), bConvert); break; @@ -1910,7 +1919,19 @@ sal_Bool SvxBoxItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const if( bDistMember ) rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nDist) : nDist); else - rVal <<= aRetLine; + { + if ( bSerialize ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any > aSeq(4); + aSeq[0] <<= aRetLine.Color; + aSeq[1] <<= aRetLine.InnerLineWidth; + aSeq[2] <<= aRetLine.OuterLineWidth; + aSeq[3] <<= aRetLine.LineDistance; + rVal <<= aSeq; + } + else + rVal <<= aRetLine; + } return sal_True; } @@ -1939,21 +1960,25 @@ sal_Bool SvxBoxItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) case LEFT_BORDER_DISTANCE: bDistMember = sal_True; case LEFT_BORDER: + case MID_LEFT_BORDER: nLine = BOX_LINE_LEFT; break; case RIGHT_BORDER_DISTANCE: bDistMember = sal_True; case RIGHT_BORDER: + case MID_RIGHT_BORDER: nLine = BOX_LINE_RIGHT; break; case BOTTOM_BORDER_DISTANCE: bDistMember = sal_True; case BOTTOM_BORDER: + case MID_BOTTOM_BORDER: nLine = BOX_LINE_BOTTOM; break; case TOP_BORDER_DISTANCE: bDistMember = sal_True; case TOP_BORDER: + case MID_TOP_BORDER: nLine = BOX_LINE_TOP; break; } @@ -1977,11 +2002,38 @@ sal_Bool SvxBoxItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) else { SvxBorderLine aLine; - if( !rVal.hasValue() || rVal.getValueType() != ::getCppuType((const ::com::sun::star::table::BorderLine*)0) ) + if( !rVal.hasValue() ) + return sal_False; + + table::BorderLine aBorderLine; + if( rVal >>= aBorderLine ) + { + // usual struct + } + else if (rVal.getValueType() != ::getCppuType((const ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any >*)0) ) + { + // serialization for basic macro recording + ::com::sun::star::uno::Sequence < com::sun::star::uno::Any > aSeq; + rVal >>= aSeq; + if ( aSeq.getLength() == 4 ) + { + sal_Int32 nVal; + if ( aSeq[0] >>= nVal ) + aBorderLine.Color = nVal; + if ( aSeq[1] >>= nVal ) + aBorderLine.InnerLineWidth = (sal_Int16) nVal; + if ( aSeq[2] >>= nVal ) + aBorderLine.OuterLineWidth = (sal_Int16) nVal; + if ( aSeq[3] >>= nVal ) + aBorderLine.LineDistance = (sal_Int16) nVal; + } + else + return sal_False; + } + else return sal_False; - table::BorderLine* pLine = (table::BorderLine*)rVal.getValue(); - sal_Bool bSet = lcl_LineToSvxLine(*pLine, aLine, bConvert); + sal_Bool bSet = lcl_LineToSvxLine(aBorderLine, aLine, bConvert); SetLine(bSet ? &aLine : 0, nLine); } @@ -2661,6 +2713,154 @@ void SvxBoxInfoItem::ResetFlags() nValidFlags = 0x7F; // alles g"ultig au/ser Disable } +sal_Bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + table::BorderLine aRetLine; + sal_Int16 nVal=0; + sal_Bool bIntMember = sal_False; + nMemberId &= ~CONVERT_TWIPS; + sal_Bool bSerialize = sal_False; + switch(nMemberId) + { + case MID_HORIZONTAL: + bSerialize = sal_True; + aRetLine = lcl_SvxLineToLine( pHori, bConvert); + break; + case MID_VERTICAL: + bSerialize = sal_True; + aRetLine = lcl_SvxLineToLine( pVert, bConvert); + break; + case MID_FLAGS: + bIntMember = sal_True; + if ( IsTable() ) + nVal |= 0x01; + if ( IsDist() ) + nVal |= 0x02; + if ( IsMinDist() ) + nVal |= 0x04; + rVal <<= nVal; + break; + case MID_VALIDFLAGS: + bIntMember = sal_True; + nVal = nValidFlags; + rVal <<= nVal; + break; + case MID_DISTANCE: + bIntMember = sal_True; + rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(GetDefDist()) : GetDefDist()); + break; + default: DBG_ERROR("Wrong MemberId!"); return sal_False; + } + + if( !bIntMember ) + { + if ( bSerialize ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any > aSeq(4); + aSeq[0] <<= aRetLine.Color; + aSeq[1] <<= aRetLine.InnerLineWidth; + aSeq[2] <<= aRetLine.OuterLineWidth; + aSeq[3] <<= aRetLine.LineDistance; + rVal <<= aSeq; + } + else + rVal <<= aRetLine; + } + + return sal_True; +} + +// ----------------------------------------------------------------------- + +sal_Bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + sal_uInt16 nLine = BOX_LINE_TOP; + sal_Bool bDistMember = sal_False; + nMemberId &= ~CONVERT_TWIPS; + sal_Bool bRet; + switch(nMemberId) + { + case MID_HORIZONTAL: + case MID_VERTICAL: + { + if( !rVal.hasValue() ) + return sal_False; + + table::BorderLine aBorderLine; + if( rVal >>= aBorderLine ) + { + // usual struct + } + else if (rVal.getValueType() != ::getCppuType((const ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any >*)0) ) + { + // serialization for basic macro recording + ::com::sun::star::uno::Sequence < com::sun::star::uno::Any > aSeq; + rVal >>= aSeq; + if ( aSeq.getLength() == 4 ) + { + sal_Int32 nVal; + if ( aSeq[0] >>= nVal ) + aBorderLine.Color = nVal; + if ( aSeq[1] >>= nVal ) + aBorderLine.InnerLineWidth = (sal_Int16) nVal; + if ( aSeq[2] >>= nVal ) + aBorderLine.OuterLineWidth = (sal_Int16) nVal; + if ( aSeq[3] >>= nVal ) + aBorderLine.LineDistance = (sal_Int16) nVal; + } + else + return sal_False; + } + else + return sal_False; + + SvxBorderLine aLine; + sal_Bool bSet = lcl_LineToSvxLine(aBorderLine, aLine, bConvert); + if ( bSet ) + SetLine( &aLine, nMemberId == MID_HORIZONTAL ? BOXINFO_LINE_HORI : BOXINFO_LINE_VERT ); + break; + } + case MID_FLAGS: + { + sal_Int16 nFlags; + bRet = (rVal >>= nFlags); + if ( bRet ) + { + SetTable ( ( nFlags & 0x01 ) != 0 ); + SetDist ( ( nFlags & 0x02 ) != 0 ); + SetMinDist( ( nFlags & 0x04 ) != 0 ); + } + + break; + } + case MID_VALIDFLAGS: + { + sal_Int16 nFlags; + bRet = (rVal >>= nFlags); + if ( bRet ) + nValidFlags = nFlags; + break; + } + case MID_DISTANCE: + { + sal_Int32 nVal; + bRet = (rVal >>= nVal); + if ( bRet && nVal>=0 ) + { + if( bConvert ) + nVal = MM100_TO_TWIP(nVal); + SetDist( nVal ); + } + break; + } + default: DBG_ERROR("Wrong MemberId!"); return sal_False; + } + + return sal_True; +} + // class SvxFmtBreakItem ------------------------------------------------- int SvxFmtBreakItem::operator==( const SfxPoolItem& rAttr ) const diff --git a/svx/source/items/paraitem.cxx b/svx/source/items/paraitem.cxx index 36ef162b7517..216fffbc29e6 100644 --- a/svx/source/items/paraitem.cxx +++ b/svx/source/items/paraitem.cxx @@ -2,9 +2,9 @@ * * $RCSfile: paraitem.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: mba $ $Date: 2002-05-22 12:03:50 $ + * last change: $Author: mba $ $Date: 2002-05-27 14:27:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1373,6 +1373,37 @@ SfxPoolItem* SvxPageModelItem::Clone( SfxItemPool* ) const //------------------------------------------------------------------------ +sal_Bool SvxPageModelItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + + switch ( nMemberId ) + { + case MID_AUTO: rVal <<= (sal_Bool) bAuto; break; + case MID_NAME: rVal <<= ::rtl::OUString( GetValue() ); break; + default: DBG_ERROR("Wrong MemberId!"); return sal_False; + } + + return sal_True; +} + +sal_Bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + sal_Bool bRet; + ::rtl::OUString aStr; + switch ( nMemberId ) + { + case MID_AUTO: bRet = ( rVal >>= bAuto ); break; + case MID_NAME: bRet = ( rVal >>= aStr ); if ( bRet ) SetValue(aStr); break; + default: DBG_ERROR("Wrong MemberId!"); return sal_False; + } + + return bRet; +} + SfxItemPresentation SvxPageModelItem::GetPresentation ( SfxItemPresentation ePres, diff --git a/svx/source/items/zoomitem.cxx b/svx/source/items/zoomitem.cxx index 4c9376cff314..f92d93b3886b 100644 --- a/svx/source/items/zoomitem.cxx +++ b/svx/source/items/zoomitem.cxx @@ -2,9 +2,9 @@ * * $RCSfile: zoomitem.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:01:21 $ + * last change: $Author: mba $ $Date: 2002-05-27 14:27:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -148,4 +148,36 @@ int SvxZoomItem::operator==( const SfxPoolItem& rAttr ) const eType == rItem.GetType() ); } +sal_Bool SvxZoomItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + switch ( nMemberId ) + { + case MID_VALUE: rVal <<= (sal_Int32) GetValue(); break; + case MID_VALUESET: rVal <<= (sal_Int16) nValueSet; break; + case MID_TYPE: rVal <<= (sal_Int16) eType; break; + default: DBG_ERROR("Wrong MemberId!"); return sal_False; + } + + return sal_True; +} +sal_Bool SvxZoomItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + sal_Int32 nVal; + if ( rVal >>= nVal ) + { + switch ( nMemberId ) + { + case MID_VALUE: SetValue( nVal ); break; + case MID_VALUESET: nValueSet = (sal_Int16) nVal; break; + case MID_TYPE: eType = SvxZoomType( (sal_Int16) nVal ); break; + default: DBG_ERROR("Wrong MemberId!"); return sal_False; + } + } + + return sal_True; +} diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index c1402c581dc8..99b5e412322d 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xattr.cxx,v $ * - * $Revision: 1.21 $ + * $Revision: 1.22 $ * - * last change: $Author: mba $ $Date: 2002-05-22 12:05:15 $ + * last change: $Author: mba $ $Date: 2002-05-27 14:28:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -977,26 +977,77 @@ sal_Bool XLineDashItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemb { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - if( nMemberId == MID_NAME ) - { - rtl::OUString aApiName; - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); - rVal <<= aApiName; - } - else + + switch ( nMemberId ) { - const XDash& rXD = GetValue(); + case MID_NAME: + { + rtl::OUString aApiName; + SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + rVal <<= aApiName; + break; + } + + case MID_LINEDASH: + { + const XDash& rXD = GetValue(); + + ::com::sun::star::drawing::LineDash aLineDash; + + aLineDash.Style = (::com::sun::star::drawing::DashStyle)((UINT16)rXD.GetDashStyle()); + aLineDash.Dots = rXD.GetDots(); + aLineDash.DotLen = rXD.GetDotLen(); + aLineDash.Dashes = rXD.GetDashes(); + aLineDash.DashLen = rXD.GetDashLen(); + aLineDash.Distance = rXD.GetDistance(); + + rVal <<= aLineDash; + break; + } + + case MID_LINEDASH_STYLE: + { + const XDash& rXD = GetValue(); + rVal <<= (::com::sun::star::drawing::DashStyle)((sal_Int16)rXD.GetDashStyle()); + break; + } + + case MID_LINEDASH_DOTS: + { + const XDash& rXD = GetValue(); + rVal <<= rXD.GetDots(); + break; + } + + case MID_LINEDASH_DOTLEN: + { + const XDash& rXD = GetValue(); + rVal <<= rXD.GetDotLen(); + break; + } + + case MID_LINEDASH_DASHES: + { + const XDash& rXD = GetValue(); + rVal <<= rXD.GetDashes(); + break; + } - ::com::sun::star::drawing::LineDash aLineDash; + case MID_LINEDASH_DASHLEN: + { + const XDash& rXD = GetValue(); + rVal <<= rXD.GetDashLen(); + break; + } - aLineDash.Style = (::com::sun::star::drawing::DashStyle)((UINT16)rXD.GetDashStyle()); - aLineDash.Dots = rXD.GetDots(); - aLineDash.DotLen = rXD.GetDotLen(); - aLineDash.Dashes = rXD.GetDashes(); - aLineDash.DashLen = rXD.GetDashLen(); - aLineDash.Distance = rXD.GetDistance(); + case MID_LINEDASH_DISTANCE: + { + const XDash& rXD = GetValue(); + rVal <<= rXD.GetDistance(); + break; + } - rVal <<= aLineDash; + default: DBG_ERROR("Wrong MemberId!"); return sal_False; } return sal_True; @@ -1006,31 +1057,99 @@ sal_Bool XLineDashItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE n { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - if( nMemberId == MID_NAME ) - { - rtl::OUString aName; - rVal >>= aName; - SetName( aName ); - } - else + + switch ( nMemberId ) { - ::com::sun::star::drawing::LineDash aLineDash; - if(!(rVal >>= aLineDash)) - return sal_False; + case MID_NAME: + { + rtl::OUString aName; + if (!(rVal >>= aName)) + return sal_False; + SetName( aName ); + break; + } + + case MID_LINEDASH: + { + ::com::sun::star::drawing::LineDash aLineDash; + if(!(rVal >>= aLineDash)) + return sal_False; + + XDash aXDash; + + aXDash.SetDashStyle((XDashStyle)((UINT16)(aLineDash.Style))); + aXDash.SetDots(aLineDash.Dots); + aXDash.SetDotLen(aLineDash.DotLen); + aXDash.SetDashes(aLineDash.Dashes); + aXDash.SetDashLen(aLineDash.DashLen); + aXDash.SetDistance(aLineDash.Distance); + + if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes())) + aXDash.SetDots(1); + + SetValue( aXDash ); + break; + } + + case MID_LINEDASH_STYLE: + { + sal_Int16 nVal; + if(!(rVal >>= nVal)) + return sal_False; + + XDash aXDash = GetValue(); + aXDash.SetDashStyle((XDashStyle)((UINT16)(nVal))); + + if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes())) + aXDash.SetDots(1); - XDash aXDash; + SetValue( aXDash ); - aXDash.SetDashStyle((XDashStyle)((UINT16)(aLineDash.Style))); - aXDash.SetDots(aLineDash.Dots); - aXDash.SetDotLen(aLineDash.DotLen); - aXDash.SetDashes(aLineDash.Dashes); - aXDash.SetDashLen(aLineDash.DashLen); - aXDash.SetDistance(aLineDash.Distance); + break; + } + + case MID_LINEDASH_DOTS: + case MID_LINEDASH_DASHES: + { + sal_Int16 nVal; + if(!(rVal >>= nVal)) + return sal_False; + + XDash aXDash = GetValue(); + if ( nMemberId == MID_LINEDASH_DOTS ) + aXDash.SetDots( nVal ); + else + aXDash.SetDashes( nVal ); + + if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes())) + aXDash.SetDots(1); + + SetValue( aXDash ); + break; + } - if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes())) - aXDash.SetDots(1); + case MID_LINEDASH_DOTLEN: + case MID_LINEDASH_DASHLEN: + case MID_LINEDASH_DISTANCE: + { + sal_Int32 nVal; + if(!(rVal >>= nVal)) + return sal_False; + + XDash aXDash = GetValue(); + if ( nMemberId == MID_LINEDASH_DOTLEN ) + aXDash.SetDotLen( nVal ); + else if ( nMemberId == MID_LINEDASH_DASHLEN ) + aXDash.SetDashLen( nVal ); + else + aXDash.SetDistance( nVal ); + + if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes())) + aXDash.SetDots(1); - SetValue( aXDash ); + SetValue( aXDash ); + break; + } } return sal_True; @@ -3285,29 +3404,47 @@ sal_Bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE n { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - if( nMemberId == MID_NAME ) - { - rtl::OUString aApiName; - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); - rVal <<= aApiName; - } - else + switch ( nMemberId ) { - const XGradient& aXGradient = GetValue(); - ::com::sun::star::awt::Gradient aGradient; - - aGradient.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle(); - aGradient.StartColor = (INT32)aXGradient.GetStartColor().GetColor(); - aGradient.EndColor = (INT32)aXGradient.GetEndColor().GetColor(); - aGradient.Angle = (short)aXGradient.GetAngle(); - aGradient.Border = aXGradient.GetBorder(); - aGradient.XOffset = aXGradient.GetXOffset(); - aGradient.YOffset = aXGradient.GetYOffset(); - aGradient.StartIntensity = aXGradient.GetStartIntens(); - aGradient.EndIntensity = aXGradient.GetEndIntens(); - aGradient.StepCount = aXGradient.GetSteps(); - - rVal <<= aGradient; + case MID_FILLGRADIENT: + { + const XGradient& aXGradient = GetValue(); + ::com::sun::star::awt::Gradient aGradient; + + aGradient.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle(); + aGradient.StartColor = (INT32)aXGradient.GetStartColor().GetColor(); + aGradient.EndColor = (INT32)aXGradient.GetEndColor().GetColor(); + aGradient.Angle = (short)aXGradient.GetAngle(); + aGradient.Border = aXGradient.GetBorder(); + aGradient.XOffset = aXGradient.GetXOffset(); + aGradient.YOffset = aXGradient.GetYOffset(); + aGradient.StartIntensity = aXGradient.GetStartIntens(); + aGradient.EndIntensity = aXGradient.GetEndIntens(); + aGradient.StepCount = aXGradient.GetSteps(); + + rVal <<= aGradient; + } + + case MID_NAME: + { + rtl::OUString aApiName; + SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + rVal <<= aApiName; + break; + } + + case MID_GRADIENT_STYLE: rVal <<= (sal_Int16)GetValue().GetGradientStyle(); break; + case MID_GRADIENT_STARTCOLOR: rVal <<= (sal_Int32)GetValue().GetStartColor().GetColor(); break; + case MID_GRADIENT_ENDCOLOR: rVal <<= (sal_Int32)GetValue().GetEndColor().GetColor(); break; + case MID_GRADIENT_ANGLE: rVal <<= (sal_Int16)GetValue().GetAngle(); break; + case MID_GRADIENT_BORDER: rVal <<= GetValue().GetBorder(); break; + case MID_GRADIENT_XOFFSET: rVal <<= GetValue().GetXOffset(); break; + case MID_GRADIENT_YOFFSET: rVal <<= GetValue().GetYOffset(); break; + case MID_GRADIENT_STARTINTENSITY: rVal <<= GetValue().GetStartIntens(); break; + case MID_GRADIENT_ENDINTENSITY: rVal <<= GetValue().GetEndIntens(); break; + case MID_GRADIENT_STEPCOUNT: rVal <<= GetValue().GetSteps(); break; + + default: DBG_ERROR("Wrong MemberId!"); return sal_False; } return sal_True; @@ -3318,24 +3455,97 @@ sal_Bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, BY { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - ::com::sun::star::awt::Gradient aGradient; - if(!(rVal >>= aGradient)) - return sal_False; - XGradient aXGradient; + switch ( nMemberId ) + { + case MID_NAME: + { + rtl::OUString aName; + if (!(rVal >>= aName )) + return sal_False; + SetName( aName ); + break; + } + + case MID_FILLGRADIENT: + { + ::com::sun::star::awt::Gradient aGradient; + if(!(rVal >>= aGradient)) + return sal_False; + + XGradient aXGradient; + + aXGradient.SetGradientStyle( (XGradientStyle) aGradient.Style ); + aXGradient.SetStartColor( aGradient.StartColor ); + aXGradient.SetEndColor( aGradient.EndColor ); + aXGradient.SetAngle( aGradient.Angle ); + aXGradient.SetBorder( aGradient.Border ); + aXGradient.SetXOffset( aGradient.XOffset ); + aXGradient.SetYOffset( aGradient.YOffset ); + aXGradient.SetStartIntens( aGradient.StartIntensity ); + aXGradient.SetEndIntens( aGradient.EndIntensity ); + aXGradient.SetSteps( aGradient.StepCount ); + + SetValue( aXGradient ); + break; + } + + case MID_GRADIENT_STARTCOLOR: + case MID_GRADIENT_ENDCOLOR: + { + sal_Int32 nVal; + if(!(rVal >>= nVal )) + return sal_False; + + XGradient aXGradient = GetValue(); + + if ( nMemberId == MID_GRADIENT_STARTCOLOR ) + aXGradient.SetStartColor( nVal ); + else + aXGradient.SetEndColor( nVal ); + SetValue( aXGradient ); + break; + } + + case MID_GRADIENT_STYLE: + case MID_GRADIENT_ANGLE: + case MID_GRADIENT_BORDER: + case MID_GRADIENT_STARTINTENSITY: + case MID_GRADIENT_ENDINTENSITY: + case MID_GRADIENT_STEPCOUNT: + case MID_GRADIENT_XOFFSET: + case MID_GRADIENT_YOFFSET: + { + sal_Int16 nVal; + if(!(rVal >>= nVal )) + return sal_False; - aXGradient.SetGradientStyle( (XGradientStyle) aGradient.Style ); - aXGradient.SetStartColor( aGradient.StartColor ); - aXGradient.SetEndColor( aGradient.EndColor ); - aXGradient.SetAngle( aGradient.Angle ); - aXGradient.SetBorder( aGradient.Border ); - aXGradient.SetXOffset( aGradient.XOffset ); - aXGradient.SetYOffset( aGradient.YOffset ); - aXGradient.SetStartIntens( aGradient.StartIntensity ); - aXGradient.SetEndIntens( aGradient.EndIntensity ); - aXGradient.SetSteps( aGradient.StepCount ); + XGradient aXGradient = GetValue(); - SetValue( aXGradient ); + switch ( nMemberId ) + { + case MID_GRADIENT_STYLE: + aXGradient.SetGradientStyle( (XGradientStyle)nVal ); break; + case MID_GRADIENT_ANGLE: + aXGradient.SetAngle( nVal ); break; + case MID_GRADIENT_BORDER: + aXGradient.SetBorder( nVal ); break; + case MID_GRADIENT_STARTINTENSITY: + aXGradient.SetStartIntens( nVal ); break; + case MID_GRADIENT_ENDINTENSITY: + aXGradient.SetEndIntens( nVal ); break; + case MID_GRADIENT_STEPCOUNT: + aXGradient.SetSteps( nVal ); break; + case MID_GRADIENT_XOFFSET: + aXGradient.SetXOffset( nVal ); break; + case MID_GRADIENT_YOFFSET: + aXGradient.SetYOffset( nVal ); break; + } + + SetValue( aXGradient ); + break; + } + } return sal_True; } @@ -3824,21 +4034,39 @@ sal_Bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMem { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - if( nMemberId == MID_NAME ) - { - rtl::OUString aApiName; - SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); - rVal <<= aApiName; - } - else + + switch ( nMemberId ) { - ::com::sun::star::drawing::Hatch aUnoHatch; + case MID_FILLHATCH: + { + ::com::sun::star::drawing::Hatch aUnoHatch; + + aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); + aUnoHatch.Color = aHatch.GetColor().GetColor(); + aUnoHatch.Distance = aHatch.GetDistance(); + aUnoHatch.Angle = aHatch.GetAngle(); + rVal <<= aUnoHatch; + break; + } - aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); - aUnoHatch.Color = aHatch.GetColor().GetColor(); - aUnoHatch.Distance = aHatch.GetDistance(); - aUnoHatch.Angle = aHatch.GetAngle(); - rVal <<= aUnoHatch; + case MID_NAME: + { + rtl::OUString aApiName; + SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); + rVal <<= aApiName; + break; + } + + case MID_HATCH_STYLE: + rVal <<= (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); break; + case MID_HATCH_COLOR: + rVal <<= (sal_Int32)aHatch.GetColor().GetColor(); break; + case MID_HATCH_DISTANCE: + rVal <<= aHatch.GetDistance(); break; + case MID_HATCH_ANGLE: + rVal <<= aHatch.GetAngle(); break; + + default: DBG_ERROR("Wrong MemberId!"); return sal_False; } return sal_True; @@ -3849,14 +4077,60 @@ sal_Bool XFillHatchItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - ::com::sun::star::drawing::Hatch aUnoHatch; - if(!(rVal >>= aUnoHatch)) - return sal_False; - aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style ); - aHatch.SetColor( aUnoHatch.Color ); - aHatch.SetDistance( aUnoHatch.Distance ); - aHatch.SetAngle( aUnoHatch.Angle ); + switch ( nMemberId ) + { + case MID_FILLHATCH: + { + ::com::sun::star::drawing::Hatch aUnoHatch; + if(!(rVal >>= aUnoHatch)) + return sal_False; + + aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style ); + aHatch.SetColor( aUnoHatch.Color ); + aHatch.SetDistance( aUnoHatch.Distance ); + aHatch.SetAngle( aUnoHatch.Angle ); + break; + } + + case MID_NAME: + { + rtl::OUString aName; + if (!(rVal >>= aName )) + return sal_False; + SetName( aName ); + break; + } + + case MID_HATCH_STYLE: + { + sal_Int16 nVal; + if (!(rVal >>= nVal )) + return sal_False; + aHatch.SetHatchStyle( (XHatchStyle)nVal ); + break; + } + + case MID_HATCH_COLOR: + case MID_HATCH_DISTANCE: + case MID_HATCH_ANGLE: + { + sal_Int32 nVal; + if (!(rVal >>= nVal )) + return sal_False; + + if ( nMemberId == MID_HATCH_COLOR ) + aHatch.SetColor( nVal ); + else if ( nMemberId == MID_HATCH_DISTANCE ) + aHatch.SetDistance( nVal ); + else + aHatch.SetAngle( nVal ); + break; + } + + default: DBG_ERROR("Wrong MemberId!"); return sal_False; + } + return sal_True; } |