text::BaseFrameProperties: add FillStyle and FillGradient optional properties

Change-Id: I854cc5e4da2ce87ef4a7af6e9c0cf6f208714e4c
This commit is contained in:
Miklos Vajna 2013-01-24 18:08:38 +01:00
parent 2aec78c0d9
commit 2a34dd723b
8 changed files with 42 additions and 2 deletions

View file

@ -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
};

View file

@ -120,6 +120,8 @@
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/awt/Gradient.hpp>
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" );
}

View file

@ -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

View file

@ -27,6 +27,8 @@
#include <com/sun/star/awt/Size.idl>
#include <com/sun/star/util/Color.idl>
#include <com/sun/star/xml/UserDefinedAttributesSupplier.idl>
#include <com/sun/star/drawing/FillStyle.idl>
#include <com/sun/star/awt/Gradient.idl>
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.
<p>Currently only set for gradients.</p>
@since LibreOffice 4.1
*/
[optional, property] com::sun::star::drawing::FillStyle FillStyle;
/** If the property <member>FillStyle</member> is set to <const>
FillStyle::GRADIENT</const>, this describes the gradient used.
@since LibreOffice 4.1
*/
[optional, property] com::sun::star::awt::Gradient FillGradient;
};

View file

@ -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
};

View file

@ -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)

View file

@ -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 },

View file

@ -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
};