sw: add ShadowTransparence UNO property for frames

drawinglayer has a separate property for the shadow transparency, too.
One more step towards Writer frames have the same UNO API as
drawinglayer shapes.

Change-Id: I84617502e9beb9e077c783ee8eb771d79c6ee666
This commit is contained in:
Miklos Vajna 2013-08-24 11:11:44 +02:00
parent 4bea362732
commit 2a01c49f76
7 changed files with 40 additions and 1 deletions

View File

@ -1315,6 +1315,8 @@ bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
aShadow.IsTransparent = aShadowColor.GetTransparency() > 0;
aShadow.Color = aShadowColor.GetColor();
sal_Int8 nTransparence = rtl::math::round(float(aShadowColor.GetTransparency() * 100) / 255);
switch ( nMemberId )
{
case MID_LOCATION: rVal <<= aShadow.Location; break;
@ -1322,6 +1324,7 @@ bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
case MID_TRANSPARENT: rVal <<= aShadow.IsTransparent; break;
case MID_BG_COLOR: rVal <<= aShadow.Color; break;
case 0: rVal <<= aShadow; break;
case MID_SHADOW_TRANSPARENCE: rVal <<= nTransparence; break;
default: OSL_FAIL("Wrong MemberId!"); return false;
}
@ -1355,6 +1358,17 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
case MID_TRANSPARENT: rVal >>= aShadow.IsTransparent; break;
case MID_BG_COLOR: rVal >>= aShadow.Color; break;
case 0: rVal >>= aShadow; break;
case MID_SHADOW_TRANSPARENCE:
{
sal_Int32 nTransparence = 0;
if (rVal >>= nTransparence)
{
Color aColor(aShadow.Color);
aColor.SetTransparency(rtl::math::round(float(nTransparence * 255) / 100));
aShadow.Color = aColor.GetColor();
}
break;
}
default: OSL_FAIL("Wrong MemberId!"); return sal_False;
}

View File

@ -181,6 +181,9 @@
#define MID_HORJUST_HORJUST 0
#define MID_HORJUST_ADJUST 1
// SvxShadowItem
#define MID_SHADOW_TRANSPARENCE 1
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -317,6 +317,15 @@ published service BaseFrameProperties
*/
[optional, property] string FillGradientName;
/** This defines the degree of transparence of the shadow in percent.
<p>This is the same as setting the Color member of the
#ShadowFormat property to an ARGB color.</p>
@since LibreOffice 4.2
*/
[optional, property] short ShadowTransparence;
};

View File

@ -836,8 +836,9 @@ enum SwPropNameIds
/* 0770 */ UNO_NAME_CHAR_TOP_BORDER_DISTANCE,
/* 0771 */ UNO_NAME_CHAR_BOTTOM_BORDER_DISTANCE,
/* 0772 */ UNO_NAME_CHAR_SHADOW_FORMAT,
/* 0773 */ UNO_NAME_SHADOW_TRANSPARENCE,
/* 0773 */ SW_PROPNAME_END
SW_PROPNAME_END
// new items in this array must match SwPropNameTab aPropNameTab
};

View File

@ -409,6 +409,13 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SwDoc* pDoc, SfxItemSet& rToSe
bRet &= ((SfxPoolItem&)aSh).PutValue(*pSh, CONVERT_TWIPS);
rToSet.Put(aSh);
}
const ::uno::Any* pShTr;
if(GetProperty(RES_SHADOW, MID_SHADOW_TRANSPARENCE, pShTr) && rToSet.HasItem(RES_SHADOW))
{
SvxShadowItem aSh(static_cast<const SvxShadowItem&>(rToSet.Get(RES_SHADOW)));
bRet &= aSh.PutValue(*pShTr, MID_SHADOW_TRANSPARENCE);
rToSet.Put(aSh);
}
const ::uno::Any* pSur = 0;
GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE, pSur);
const ::uno::Any* pSurAnch = 0;

View File

@ -325,6 +325,7 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
{ SW_PROP_NMID(UNO_NAME_RELATIVE_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_REL_HEIGHT }, \
{ SW_PROP_NMID(UNO_NAME_RELATIVE_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_REL_WIDTH }, \
{ SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS}, \
{ SW_PROP_NMID(UNO_NAME_SHADOW_TRANSPARENCE), RES_SHADOW, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_SHADOW_TRANSPARENCE}, \
{ SW_PROP_NMID(UNO_NAME_IMAGE_MAP), RES_URL, CPPU_E2T(CPPUTYPE_REFIDXCNTNR), PROPERTY_NONE, MID_URL_CLIENTMAP}, \
{ SW_PROP_NMID(UNO_NAME_SERVER_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_SERVERMAP }, \
{ SW_PROP_NMID(UNO_NAME_SIZE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PROPERTY_NONE, MID_FRMSIZE_SIZE|CONVERT_TWIPS}, \
@ -746,6 +747,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ SW_PROP_NMID(UNO_NAME_IS_SYNC_HEIGHT_TO_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH },
// { SW_PROP_NMID(UNO_NAME_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_WIDTH },
{ SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
{ SW_PROP_NMID(UNO_NAME_SHADOW_TRANSPARENCE), RES_SHADOW, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_SHADOW_TRANSPARENCE},
{ SW_PROP_NMID(UNO_NAME_SERVER_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_SERVERMAP },
{ SW_PROP_NMID(UNO_NAME_SIZE_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_SIZE },
//Surround bleibt, weil es mit der 5.1 ausgeliefert wurde, obwohl es mit text::WrapTextMode identisch ist
@ -807,6 +809,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
{ SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
{ SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
{ SW_PROP_NMID(UNO_NAME_SHADOW_TRANSPARENCE), RES_SHADOW, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_SHADOW_TRANSPARENCE},
{ SW_PROP_NMID(UNO_NAME_HEADER_BACK_COLOR), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
// { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC), FN_UNO_HEADER_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC
@ -945,6 +948,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ SW_PROP_NMID(UNO_NAME_REPEAT_HEADLINE), FN_TABLE_HEADLINE_REPEAT,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0xff},
{ SW_PROP_NMID(UNO_NAME_HEADER_ROW_COUNT), FN_TABLE_HEADLINE_COUNT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0xff},
{ SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, 0},
{ SW_PROP_NMID(UNO_NAME_SHADOW_TRANSPARENCE), RES_SHADOW, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_SHADOW_TRANSPARENCE},
{ SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},
{ SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},
{ SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },

View File

@ -802,6 +802,7 @@ const SwPropNameTab aPropNameTab = {
/* 0770 UNO_NAME_CHAR_TOP_BORDER_DISTANCE */ {MAP_CHAR_LEN("CharTopBorderDistance")},
/* 0771 UNO_NAME_CHAR_BOTTOM_BORDER_DISTANCE */ {MAP_CHAR_LEN("CharBottomBorderDistance")},
/* 0771 UNO_NAME_CHAR_SHADOW_FORMAT */ {MAP_CHAR_LEN("CharShadowFormat")},
/* 0772 UNO_NAME_SHADOW_TRANSPARENCE */ {MAP_CHAR_LEN("ShadowTransparence")},
// new items in this array must match enum SwPropNameIds