From 2a34dd723baac31e9ce0c639ce9244c0ced4ff06 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 24 Jan 2013 18:08:38 +0100 Subject: [PATCH] text::BaseFrameProperties: add FillStyle and FillGradient optional properties Change-Id: I854cc5e4da2ce87ef4a7af6e9c0cf6f208714e4c --- comphelper/inc/comphelper/TypeGeneration.hxx | 2 ++ comphelper/source/property/TypeGeneration.cxx | 4 ++++ editeng/inc/editeng/memberids.hrc | 2 ++ offapi/com/sun/star/text/BaseFrameProperties.idl | 16 ++++++++++++++++ sw/inc/unoprnms.hxx | 4 +++- sw/source/core/unocore/unoframe.cxx | 10 +++++++++- sw/source/core/unocore/unomap.cxx | 4 ++++ sw/source/core/unocore/unoprnms.cxx | 2 ++ 8 files changed, 42 insertions(+), 2 deletions(-) diff --git a/comphelper/inc/comphelper/TypeGeneration.hxx b/comphelper/inc/comphelper/TypeGeneration.hxx index 8c99fcafbda7..0ced57b31714 100644 --- a/comphelper/inc/comphelper/TypeGeneration.hxx +++ b/comphelper/inc/comphelper/TypeGeneration.hxx @@ -109,6 +109,8 @@ namespace comphelper CPPUTYPE_REFXGRAPHIC, //getCppuType( Reference< graphic::XGraphic >*)0) CPPUTYPE_TABLEBORDERDISTANCES, //getCppuType( (table::TableBorderDistances*)0 ) CPPUTPYE_REFEMBEDDEDOBJECT, // XEmbeddedObject::static_type + CPPUTYPE_FILLSTYLE, //getCppuType( (drawing::FillStyle*)0 ) + CPPUTYPE_GRADIENT, //getCppuType( (awt::Gradient*)0 ) CPPUTYPE_END }; diff --git a/comphelper/source/property/TypeGeneration.cxx b/comphelper/source/property/TypeGeneration.cxx index 1dd04e43049b..6925c67848ae 100644 --- a/comphelper/source/property/TypeGeneration.cxx +++ b/comphelper/source/property/TypeGeneration.cxx @@ -120,6 +120,8 @@ #include #include #include +#include +#include using ::rtl::OUString; using namespace ::com::sun::star; @@ -219,6 +221,8 @@ namespace comphelper case CPPUTYPE_TABLEBORDERDISTANCES: pType = &::getCppuType( (table::TableBorderDistances*)0 ); break; case CPPUTPYE_REFEMBEDDEDOBJECT: pType = &embed::XEmbeddedObject::static_type(); break; case CPPUTYPE_LINESTYLE: pType = &::getCppuType( (drawing::LineStyle*)0 ); break; + case CPPUTYPE_FILLSTYLE: pType = &::getCppuType( (drawing::FillStyle*)0 ); break; + case CPPUTYPE_GRADIENT: pType = &::getCppuType( (awt::Gradient*)0 ); break; default: OSL_FAIL( "Unknown CPPU type" ); } diff --git a/editeng/inc/editeng/memberids.hrc b/editeng/inc/editeng/memberids.hrc index 2ce6c22ace2f..376c219a11ee 100644 --- a/editeng/inc/editeng/memberids.hrc +++ b/editeng/inc/editeng/memberids.hrc @@ -170,6 +170,8 @@ #define MID_GRAPHIC_TRANSPARENCY 8 #define MID_BACK_COLOR_R_G_B 9 #define MID_BACK_COLOR_TRANSPARENCY 10 +#define MID_FILL_STYLE 11 +#define MID_FILL_GRADIENT 12 //SvxFmtBreakItem #define MID_BREAK_BEFORE 0 diff --git a/offapi/com/sun/star/text/BaseFrameProperties.idl b/offapi/com/sun/star/text/BaseFrameProperties.idl index e569b08930f9..849871029d1e 100644 --- a/offapi/com/sun/star/text/BaseFrameProperties.idl +++ b/offapi/com/sun/star/text/BaseFrameProperties.idl @@ -27,6 +27,8 @@ #include #include #include +#include +#include module com { module sun { module star { module text { @@ -295,6 +297,20 @@ published service BaseFrameProperties @since OOo 3.2 */ [optional, property] string Description; + /** This enumeration selects the style the area will be filled with. + +

Currently only set for gradients.

+ + @since LibreOffice 4.1 + */ + [optional, property] com::sun::star::drawing::FillStyle FillStyle; + /** If the property FillStyle is set to + FillStyle::GRADIENT, this describes the gradient used. + + @since LibreOffice 4.1 + */ + [optional, property] com::sun::star::awt::Gradient FillGradient; + }; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index b681c11ae3d6..a9834b3346b7 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -816,8 +816,10 @@ enum SwPropNameIds /* 0755 */ UNO_NAME_REPLACEMENT_GRAPHIC_URL, /* 0756 */ UNO_NAME_HIDDEN, +/* 0757 */ UNO_NAME_FILL_STYLE, +/* 0758 */ UNO_NAME_FILL_GRADIENT, -/* 0757 */ SW_PROPNAME_END +/* 0759 */ SW_PROPNAME_END // new items in this array must match SwPropNameTab aPropNameTab }; diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 4e3d78360c0d..b289c7df7ccc 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -173,6 +173,10 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI GetProperty(RES_BACKGROUND, MID_BACK_COLOR_R_G_B, pRGBCol ); const ::uno::Any* pColTrans = 0; GetProperty(RES_BACKGROUND, MID_BACK_COLOR_TRANSPARENCY, pColTrans); + const ::uno::Any* pFillStyle = 0; + GetProperty(RES_BACKGROUND, MID_FILL_STYLE, pFillStyle); + const ::uno::Any* pGradient = 0; + GetProperty(RES_BACKGROUND, MID_FILL_GRADIENT, pGradient); const ::uno::Any* pTrans = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pTrans ); const ::uno::Any* pGrLoc = 0; @@ -185,13 +189,17 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENCY, pGrTranparency ); if(pCol || pTrans || pGrURL || pGrFilter || pGrLoc || - pGrTranparency || pColTrans || pRGBCol) + pGrTranparency || pColTrans || pRGBCol || pFillStyle || pGradient) { SvxBrushItem aBrush ( static_cast < const :: SvxBrushItem & > ( rFromSet.Get ( RES_BACKGROUND ) ) ); if(pCol ) bRet &= ((SfxPoolItem&)aBrush).PutValue(*pCol,MID_BACK_COLOR ); if(pColTrans) bRet &= ((SfxPoolItem&)aBrush).PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY); + if(pFillStyle) + bRet &= ((SfxPoolItem&)aBrush).PutValue(*pFillStyle, MID_FILL_STYLE); + if(pGradient) + bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGradient, MID_FILL_GRADIENT); if(pRGBCol) bRet &= ((SfxPoolItem&)aBrush).PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B); if(pTrans) diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 9c6fe6e28c9c..f4903431884a 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -288,6 +288,8 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider() { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR }, \ { SW_PROP_NMID(UNO_NAME_BACK_COLOR_R_G_B), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR_R_G_B}, \ { SW_PROP_NMID(UNO_NAME_BACK_COLOR_TRANSPARENCY), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE ,MID_BACK_COLOR_TRANSPARENCY}, \ + { SW_PROP_NMID(UNO_NAME_FILL_STYLE), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_FILLSTYLE), PROPERTY_NONE ,MID_FILL_STYLE}, \ + { SW_PROP_NMID(UNO_NAME_FILL_GRADIENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRADIENT), PROPERTY_NONE ,MID_FILL_GRADIENT}, \ { SW_PROP_NMID(UNO_NAME_CONTENT_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_CONTENT }, \ { SW_PROP_NMID(UNO_NAME_FRAME_STYLE_NAME), FN_UNO_FRAME_STYLE_NAME,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL }, \ @@ -664,6 +666,8 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR }, { SW_PROP_NMID(UNO_NAME_BACK_COLOR_R_G_B), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR_R_G_B}, { SW_PROP_NMID(UNO_NAME_BACK_COLOR_TRANSPARENCY), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE ,MID_BACK_COLOR_TRANSPARENCY}, \ + { SW_PROP_NMID(UNO_NAME_FILL_STYLE), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_FILLSTYLE), PROPERTY_NONE ,MID_FILL_STYLE}, + { SW_PROP_NMID(UNO_NAME_FILL_GRADIENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRADIENT), PROPERTY_NONE ,MID_FILL_GRADIENT}, // { SW_PROP_NMID(UNO_NAME_CHAIN_NEXT_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_CHAIN_NEXTNAME}, // { SW_PROP_NMID(UNO_NAME_CHAIN_PREV_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_CHAIN_PREVNAME}, /*not impl*/ { SW_PROP_NMID(UNO_NAME_CLIENT_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_CLIENTMAP }, diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index 88eb7eb013c4..de7171257b3c 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -786,6 +786,8 @@ const SwPropNameTab aPropNameTab = { /* 0754 UNO_NAME_INITIALS */ {MAP_CHAR_LEN("TableBorder2")}, /* 0755 UNO_NAME_REPLACEMENT_GRAPHIC_URL */ {MAP_CHAR_LEN("ReplacementGraphicURL")}, /* 0756 UNO_NAME_HIDDEN */ {MAP_CHAR_LEN("Hidden")}, +/* 0757 UNO_NAME_FILL_STYLE */ {MAP_CHAR_LEN("FillStyle")}, +/* 0758 UNO_NAME_FILL_GRADIENT */ {MAP_CHAR_LEN("FillGradient")}, // new items in this array must match enum SwPropNameIds };