i#124638 support for DrawingLayre FillStyle for GraphicFrames and ...

... EmbeddedObjectFrames in Writer

(cherry picked from commit 8433ee82c9323501545164ddf6e6008db483ab7a)

Conflicts:
	sw/source/core/attr/format.cxx
	sw/source/core/layout/paintfrm.cxx
	sw/source/core/uibase/shells/grfsh.cxx
	sw/source/core/unocore/unomap.cxx
	sw/source/core/unocore/unostyle.cxx
	sw/source/ui/frmdlg/frmpage.src
	xmloff/inc/xmloff/XMLShapeStyleContext.hxx
	xmloff/source/draw/XMLShapeStyleContext.cxx

Change-Id: I441378ec3e9a32764781a8063adcc52051efe17f
This commit is contained in:
Armin Le Grand 2014-04-17 16:44:58 +00:00 committed by Miklos Vajna
parent 474fe287c4
commit 4a0b5e569d
12 changed files with 301 additions and 64 deletions

View File

@ -36,6 +36,8 @@ protected:
OUString m_sControlDataStyleName;
OUString m_sListStyleName;
bool m_bIsNumRuleAlreadyConverted;
//UUUU
bool m_bIsFillStyleAlreadyConverted;
protected:
virtual void SetAttribute( sal_uInt16 nPrefixKey,

View File

@ -320,9 +320,12 @@
Calc, OLE, hidden ;
DrawImpress, 3DObject, visible ;
DrawImpress, Draw, visible ;
DrawImpress, Graphic, hidden ;
DrawImpress, TextObject, hidden ;
DrawImpress, OLE, hidden ;
WriterVariants, Draw, visible ;
Writer, Graphic, hidden ;
Writer, OLE, hidden ;
Writer, Frame, visible ;
</value>
</prop>

View File

@ -21,6 +21,7 @@ interface BaseTextFrame
Automation = FALSE;
]
{
//UUUU
SID_ATTR_FILL_STYLE
[
Export = FALSE;
@ -29,6 +30,7 @@ interface BaseTextFrame
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
//UUUU
SID_ATTR_FILL_COLOR
[
Export = FALSE;
@ -37,6 +39,7 @@ interface BaseTextFrame
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
//UUUU
SID_ATTR_FILL_GRADIENT
[
Export = FALSE;
@ -45,6 +48,7 @@ interface BaseTextFrame
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
//UUUU
SID_ATTR_FILL_HATCH
[
Export = FALSE;
@ -53,6 +57,7 @@ interface BaseTextFrame
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
//UUUU
SID_ATTR_FILL_BITMAP
[
Export = FALSE;
@ -61,6 +66,7 @@ interface BaseTextFrame
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
//UUUU
SID_ATTR_FILL_TRANSPARENCE
[
Export = FALSE;
@ -69,6 +75,7 @@ interface BaseTextFrame
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
//UUUU
SID_ATTR_FILL_FLOATTRANSPARENCE
[
Export = FALSE;
@ -77,26 +84,31 @@ interface BaseTextFrame
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
//UUUU
SID_COLOR_TABLE
[
StateMethod = GetDrawAttrStateTextFrame;
]
//UUUU
SID_GRADIENT_LIST
[
StateMethod = GetDrawAttrStateTextFrame;
]
//UUUU
SID_HATCH_LIST
[
StateMethod = GetDrawAttrStateTextFrame;
]
//UUUU
SID_BITMAP_LIST
[
StateMethod = GetDrawAttrStateTextFrame;
]
//UUUU
SID_ATTRIBUTES_AREA
[
ExecMethod = ExecDrawDlgTextFrame;

View File

@ -538,16 +538,27 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
bool bRet = false;
//UUUU Usel local copy to be able to apply needed changes, e.g. call
// CheckForUniqueItemForLineFillNameOrIndex which is needed for NameOrIndex stuff
SfxItemSet aTempSet(rSet);
//UUUU Need to check for unique item for DrawingLayer items of type NameOrIndex
// and evtl. correct that item to ensure unique names for that type. This call may
// modify/correct entries inside of the given SfxItemSet
if(GetDoc())
{
GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aTempSet);
}
//UUUU
if(RES_FLYFRMFMT == Which())
{
const SfxPoolItem* pSource = 0;
if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND, false, &pSource))
if(SFX_ITEM_SET == aTempSet.GetItemState(RES_BACKGROUND, false, &pSource))
{
//UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
SfxItemSet aTempSet(rSet);
// copy all items to be set anyways to a local ItemSet with is also prepared for the new
// fill attribute ranges [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Add the attributes
@ -591,7 +602,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
( RES_GRFFMTCOLL == nFmtWhich ||
RES_TXTFMTCOLL == nFmtWhich ) ) )
{
if( ( bRet = aSet.Put( rSet )) )
if( ( bRet = aSet.Put( aTempSet )) )
aSet.SetModifyAtAttr( this );
// #i71574#
if ( nFmtWhich == RES_TXTFMTCOLL )
@ -603,7 +614,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
{
SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
aNew( *aSet.GetPool(), aSet.GetRanges() );
bRet = aSet.Put_BC( rSet, &aOld, &aNew );
bRet = aSet.Put_BC( aTempSet, &aOld, &aNew );
if( bRet )
{
// some special treatments for attributes

View File

@ -4121,9 +4121,10 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
//UUUU check for transparency
const FillAttributesPtr aFillAttributes(pSwFrmFmt->getFillAttributes());
if(aFillAttributes.get())
// check if the new fill attributes are used
if(aFillAttributes.get() && aFillAttributes->isUsed())
{
bPaintCompleteBack = aFillAttributes->isTransparent();
bPaintCompleteBack = true;
}
}
else

View File

@ -433,11 +433,9 @@ void SwFrameShell::Execute(SfxRequest &rReq)
SID_HTML_MODE, SID_HTML_MODE, // [10414
FN_GET_PRINT_AREA, FN_GET_PRINT_AREA, // [21032
FN_SURROUND, FN_HORI_ORIENT, // [21303
FN_SET_FRM_NAME, FN_SET_FRM_NAME, // [21306
FN_KEEP_ASPECT_RATIO, FN_KEEP_ASPECT_RATIO, // [21307
FN_SET_FRM_NAME, FN_KEEP_ASPECT_RATIO, // [21306
FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME, // [21318
FN_OLE_IS_MATH, FN_OLE_IS_MATH, // [22314
FN_MATH_BASELINE_ALIGNMENT, FN_MATH_BASELINE_ALIGNMENT, // [22315
FN_OLE_IS_MATH, FN_MATH_BASELINE_ALIGNMENT, // [22314
FN_PARAM_CHAIN_PREVIOUS, FN_PARAM_CHAIN_NEXT, // [22420
0);

View File

@ -68,6 +68,10 @@
#include <svx/graphichelper.hxx>
#include <doc.hxx>
#include <doc.hxx>
#include <docsh.hxx>
#include <svx/drawitem.hxx>
#define SwGrfShell
#include <sfx2/msg.hxx>
@ -204,23 +208,42 @@ void SwGrfShell::Execute(SfxRequest &rReq)
const SwViewOption* pVOpt = rSh.GetViewOptions();
SwViewOption aUsrPref( *pVOpt );
SfxItemSet aSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_GRFATR_MIRRORGRF, RES_GRFATR_CROPGRF,
SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
SID_ATTR_GRAF_KEEP_ZOOM, SID_ATTR_GRAF_KEEP_ZOOM,
SID_ATTR_GRAF_FRMSIZE, SID_ATTR_GRAF_FRMSIZE,
SID_ATTR_GRAF_FRMSIZE_PERCENT, SID_ATTR_GRAF_FRMSIZE_PERCENT,
SID_ATTR_GRAF_GRAPHIC, SID_ATTR_GRAF_GRAPHIC,
FN_PARAM_GRF_CONNECT, FN_PARAM_GRF_CONNECT,
SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
FN_GET_PRINT_AREA, FN_GET_PRINT_AREA,
FN_SET_FRM_NAME, FN_KEEP_ASPECT_RATIO,
FN_PARAM_GRF_DIALOG, FN_PARAM_GRF_DIALOG,
SID_DOCFRAME, SID_DOCFRAME,
SID_HTML_MODE, SID_HTML_MODE,
FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME,
SID_REFERER, SID_REFERER,
0);
SfxItemSet aSet(GetPool(), //UUUU sorted by indices
RES_FRMATR_BEGIN,RES_FRMATR_END - 1, // [ 82
RES_GRFATR_MIRRORGRF,RES_GRFATR_CROPGRF, // [ 123
//UUUU FillAttribute support
XATTR_FILL_FIRST, XATTR_FILL_LAST, // [ 1014
SID_DOCFRAME,SID_DOCFRAME, // [ 5598
SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER, // [10023
SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE, // [10051
SID_ATTR_GRAF_KEEP_ZOOM,SID_ATTR_GRAF_KEEP_ZOOM, // [10882
SID_ATTR_GRAF_FRMSIZE,SID_ATTR_GRAF_GRAPHIC, // [10884, contains SID_ATTR_GRAF_FRMSIZE_PERCENT
//UUUU items to hand over XPropertyList things like
// XColorList, XHatchList, XGradientList and XBitmapList
// to the Area TabPage
SID_COLOR_TABLE, SID_BITMAP_LIST, // [10179
SID_HTML_MODE,SID_HTML_MODE, // [10414
FN_GET_PRINT_AREA,FN_GET_PRINT_AREA, // [21032
FN_PARAM_GRF_CONNECT,FN_PARAM_GRF_CONNECT, // [21153
FN_PARAM_GRF_DIALOG,FN_PARAM_GRF_DIALOG, // [21171
FN_SET_FRM_NAME,FN_KEEP_ASPECT_RATIO, // [21306
FN_SET_FRM_ALT_NAME,FN_SET_FRM_ALT_NAME, // [21318
SID_REFERER, SID_REFERER,
0);
//UUUU create needed items for XPropertyList entries from the DrawModel so that
// the Area TabPage can access them
const SdrModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->GetDrawModel();
aSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE));
aSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST));
aSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST));
aSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST));
sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));

View File

@ -130,6 +130,18 @@ void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxI
OSL_ENSURE(false, "Could not get Graphic from SvxBrushItem (!)");
}
}
else
{
// GPOS_NONE == rBrush.GetGraphicPos() && 0xff == rBrush.GetColor().GetTransparency(),
// still need to rescue the color used. There are sequences used on the UNO API at
// import time (OLE. e.g. chart) which first set RGB color (MID_BACK_COLOR_R_G_B,
// color stays transparent) and then set transparency (MID_BACK_COLOR_TRANSPARENCY)
// to zero later. When not saving the color, it will be lost
const Color aColor(rBrush.GetColor().GetRGBColor());
// rToSet.Put(XFillStyleItem(XFILL_NONE));
rToSet.Put(XFillColorItem(OUString(), aColor));
}
}
//UUUU
@ -172,20 +184,24 @@ SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, sal_Bool bSea
//UUUU
SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents)
{
SvxBrushItem aRetval(RES_BACKGROUND);
const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rSourceSet.GetItem(XATTR_FILLSTYLE, bSearchInParents)));
if(!pXFillStyleItem)
if(!pXFillStyleItem || XFILL_NONE == pXFillStyleItem->GetValue())
{
return aRetval;
// need to rescue the evtl. set RGB color, but use as transparent color (we have XFILL_NONE)
Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue());
aFillColor.SetTransparency(0xff);
return SvxBrushItem(aFillColor, RES_BACKGROUND);
}
SvxBrushItem aRetval(RES_BACKGROUND);
switch(pXFillStyleItem->GetValue())
{
case XFILL_NONE:
{
// done; return default item
// already handled above, can not happen again
break;
}
case XFILL_SOLID:

View File

@ -1770,6 +1770,64 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
bDone = true;
}
switch(nMemberId)
{
case MID_NAME:
{
//UUUU when named items get set, replace these with the NameOrIndex items
// which exist already in the pool
switch(pEntry->nWID)
{
case XATTR_FILLGRADIENT:
case XATTR_FILLHATCH:
case XATTR_FILLBITMAP:
case XATTR_FILLFLOATTRANSPARENCE:
{
OUString aTempName;
if(!(aValue >>= aTempName ))
{
throw lang::IllegalArgumentException();
}
bDone = SvxShape::SetFillAttribute(pEntry->nWID, aTempName, aSet);
break;
}
default:
{
break;
}
}
break;
}
case MID_GRAFURL:
{
//UUUU Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used
switch(pEntry->nWID)
{
case XATTR_FILLBITMAP:
{
const Graphic aNullGraphic;
XFillBitmapItem aXFillBitmapItem(aSet.GetPool(), aNullGraphic);
aXFillBitmapItem.PutValue(aValue, nMemberId);
aSet.Put(aXFillBitmapItem);
bDone = true;
break;
}
default:
{
break;
}
}
break;
}
default:
{
break;
}
}
if(!bDone)
{
m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
@ -1836,7 +1894,9 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
throw lang::IllegalArgumentException();
}
else
{
pFmt->SetFmtAttr(aSet);
}
}
}
else if(IsDescriptor())

View File

@ -337,6 +337,9 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
#define ANCHOR_TYPES_PROPERTY { OUString(UNO_NAME_ANCHOR_TYPES), FN_UNO_ANCHOR_TYPES, cppu::UnoType< cppu::UnoSequenceType<css::text::TextContentAnchorType> >::get(),PropertyAttribute::READONLY, 0xff},
// #i18732# #i28701# #i73249#
//UUUU all users of COMMON_FRAME_PROPERTIES add the new XATTR_FILL_FIRST, XATTR_FILL_LAST FillStyle,
// thus it may be possible to remove the RES_BACKGROUND entries from SvxBrushItem completely (this includes
// all using UNO_NAME_BACK_* slots) in the future
#define COMMON_FRAME_PROPERTIES \
{ OUString(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_ANCHOR_PAGENUM }, \
{ OUString(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, cppu::UnoType<css::text::TextContentAnchorType>::get(), PROPERTY_NONE, MID_ANCHOR_ANCHORTYPE}, \
@ -901,9 +904,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ OUString(UNO_NAME_HIDDEN), FN_UNO_HIDDEN, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
{ OUString(UNO_NAME_TEXT_VERT_ADJUST), RES_TEXT_VERT_ADJUST, cppu::UnoType<css::drawing::TextVerticalAdjust>::get(), PROPERTY_NONE ,0},
//UUUU adf FillProperties for SW, same as FILL_PROPERTIES in svx
//UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx
// but need own defines in Writer due to later association of strings
// and uno types (see loop at end of this metjhod and definition of SW_PROP_NMID)
// and uno types (see loop at end of this method and definition of SW_PROP_NMID)
// This entry is for adding that properties to style import/export
FILL_PROPERTIES_SW
{ OUString(), 0, css::uno::Type(), 0, 0 }
@ -1250,9 +1254,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ OUString(UNO_NAME_WIDTH_TYPE), RES_FRM_SIZE, cppu::UnoType<sal_Int16>::get() , PROPERTY_NONE, MID_FRMSIZE_WIDTH_TYPE },
{ OUString(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 },
//UUUU adf FillProperties for SW, same as FILL_PROPERTIES in svx
//UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx
// but need own defines in Writer due to later association of strings
// and uno types (see loop at end of this metjhod and definition of SW_PROP_NMID)
// and uno types (see loop at end of this method and definition of SW_PROP_NMID)
// This entry is for adding that properties to FlyFrame import/export
FILL_PROPERTIES_SW
{ OUString(), 0, css::uno::Type(), 0, 0 }
@ -1263,7 +1268,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
case PROPERTY_MAP_TEXT_GRAPHIC:
{
static SfxItemPropertyMapEntry const aGraphicPropertyMap_Impl[] =
{
{ //UUUU
// evtl. completely remove SvxBrushItem stuff ()
// add support for XATTR_FILL_FIRST, XATTR_FILL_LAST
// COMMON_FRAME_PROPERTIES currently hosts the RES_BACKGROUND entries from SvxBrushItem
COMMON_FRAME_PROPERTIES
{ OUString(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE, MID_SURROUND_CONTOUR },
{ OUString(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE },
@ -1289,6 +1297,13 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ OUString(UNO_NAME_GRAPHIC_IS_INVERTED), RES_GRFATR_INVERT, cppu::UnoType<bool>::get(), 0, 0},
{ OUString(UNO_NAME_TRANSPARENCY), RES_GRFATR_TRANSPARENCY, cppu::UnoType<sal_Int16>::get(), 0, 0},
{ OUString(UNO_NAME_GRAPHIC_COLOR_MODE), RES_GRFATR_DRAWMODE, cppu::UnoType<css::drawing::ColorMode>::get(), 0, 0},
//UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx
// but need own defines in Writer due to later association of strings
// and uno types (see loop at end of this method and definition of SW_PROP_NMID)
// This entry is for adding that properties to Writer GraphicObject import/export
FILL_PROPERTIES_SW
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
aMapEntriesArr[nPropertyId] = aGraphicPropertyMap_Impl;
@ -1297,7 +1312,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
case PROPERTY_MAP_EMBEDDED_OBJECT:
{
static SfxItemPropertyMapEntry const aEmbeddedPropertyMap_Impl[] =
{
{ //UUUU
// evtl. completely remove SvxBrushItem stuff ()
// add support for XATTR_FILL_FIRST, XATTR_FILL_LAST
// COMMON_FRAME_PROPERTIES currently hosts the RES_BACKGROUND entries from SvxBrushItem
COMMON_FRAME_PROPERTIES
{ OUString(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE, MID_SURROUND_CONTOUR },
{ OUString(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE},
@ -1311,6 +1329,12 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ OUString(UNO_NAME_GRAPHIC), FN_UNO_REPLACEMENT_GRAPHIC, cppu::UnoType<css::graphic::XGraphic>::get(), PropertyAttribute::MAYBEVOID, 0 },
{ OUString(UNO_NAME_COMPONENT),FN_UNO_COMPONENT, cppu::UnoType<css::lang::XComponent>::get(), PropertyAttribute::READONLY, 0},
{ OUString(UNO_NAME_EMBEDDED_OBJECT),FN_EMBEDDED_OBJECT, cppu::UnoType<css::embed::XEmbeddedObject>::get(), PROPERTY_NONE, 0},
//UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx
// but need own defines in Writer due to later association of strings
// and uno types (see loop at end of this method and definition of SW_PROP_NMID)
// This entry is for adding that properties to OLE/EmbeddedObject import/export
FILL_PROPERTIES_SW
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
aMapEntriesArr[nPropertyId] = aEmbeddedPropertyMap_Impl;

View File

@ -1739,22 +1739,26 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
}
case RES_BACKGROUND:
{
if (SFX_STYLE_FAMILY_FRAME == eFamily)
//UUUU No new FillStyle for PageBackground; need to remove again when we want
// to support that, too. Add a break to *not* set bDone to true
if(SFX_STYLE_FAMILY_PAGE == eFamily)
{
//UUUU
SfxItemSet& rStyleSet = rBase.GetItemSet();
const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rStyleSet));
SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
aChangedBrushItem.PutValue(aValue, nMemberId);
if(!(aChangedBrushItem == aOriginalBrushItem))
{
sw::setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
}
bDone = true;
break;
}
//UUUU
SfxItemSet& rStyleSet = rBase.GetItemSet();
const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rStyleSet));
SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
aChangedBrushItem.PutValue(aValue, nMemberId);
if(!(aChangedBrushItem == aOriginalBrushItem))
{
sw::setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
}
bDone = true;
break;
}
case OWN_ATTR_FILLBMP_MODE:
@ -2498,19 +2502,23 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
}
case RES_BACKGROUND:
{
if (SFX_STYLE_FAMILY_FRAME == eFamily)
//UUUU No new FillStyle for PageBackground; need to remove again when we want
// to support that, too. Add a break to *not* set bDone to true
if(SFX_STYLE_FAMILY_PAGE == eFamily)
{
//UUUU
const SfxItemSet& rSet = rBase.GetItemSet();
const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet));
if(!aOriginalBrushItem.QueryValue(aRet, nMemberId))
{
OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
}
bDone = true;
break;
}
//UUUU
const SfxItemSet& rSet = rBase.GetItemSet();
const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet));
if(!aOriginalBrushItem.QueryValue(aRet, nMemberId))
{
OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
}
bDone = true;
break;
}
case OWN_ATTR_FILLBMP_MODE:

View File

@ -24,6 +24,7 @@
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <xmloff/xmlimp.hxx>
#include <xmloff/xmlnumi.hxx>
#include <xmloff/xmlnmspe.hxx>
@ -36,6 +37,7 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::drawing;
using ::xmloff::token::IsXMLToken;
using ::xmloff::token::XML_TEXT_PROPERTIES;
using ::xmloff::token::XML_GRAPHIC_PROPERTIES;
@ -51,7 +53,8 @@ XMLShapeStyleContext::XMLShapeStyleContext(
SvXMLStylesContext& rStyles,
sal_uInt16 nFamily)
: XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ),
m_bIsNumRuleAlreadyConverted( false )
m_bIsNumRuleAlreadyConverted( false ),
m_bIsFillStyleAlreadyConverted( false ) //UUUU
{
}
@ -183,6 +186,82 @@ void XMLShapeStyleContext::FillPropertySet( const Reference< beans::XPropertySet
}
}
if(!m_bIsFillStyleAlreadyConverted && GetProperties().size())
{
const UniReference< XMLPropertySetMapper >&rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
::std::vector< XMLPropertyState >& rProperties = GetProperties();
::std::vector< XMLPropertyState >::iterator a;
FillStyle eFS(FillStyle_NONE);
static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));
// try to find a FillStyle entry and a value from it
for(a = rProperties.begin(); a != rProperties.end(); a++)
{
if(a->mnIndex != -1)
{
const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);
if(rPropName == s_FillStyle)
{
if(a->maValue >>= eFS)
{
// okay, type was good, eFS is set
}
else
{
// also try an int (see XFillStyleItem::PutValue)
sal_Int32 nFS = 0;
if(a->maValue >>= nFS)
{
eFS = (FillStyle)nFS;
}
}
// exit loop, we found out what we needed to know
break;
}
}
}
if(FillStyle_NONE != eFS)
{
//UUUU a FillStyle was found, thus the new [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
// description for the Fill definitions is used. All formally used props based
// on RES_BACKGROUND need to be deleted to get no conflicts between the two
// sets of properties; old files will keep these and adapt accordingly
static ::rtl::OUString s_BackColorRGB(RTL_CONSTASCII_USTRINGPARAM("BackColorRGB"));
static ::rtl::OUString s_BackTransparent(RTL_CONSTASCII_USTRINGPARAM("BackTransparent"));
static ::rtl::OUString s_BackColorTransparency(RTL_CONSTASCII_USTRINGPARAM("BackColorTransparency"));
static ::rtl::OUString s_BackGraphicURL(RTL_CONSTASCII_USTRINGPARAM("BackGraphicURL"));
static ::rtl::OUString s_BackGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("BackGraphicFilter"));
static ::rtl::OUString s_BackGraphicLocation(RTL_CONSTASCII_USTRINGPARAM("BackGraphicLocation"));
static ::rtl::OUString s_BackGraphicTransparency(RTL_CONSTASCII_USTRINGPARAM("BackGraphicTransparency"));
for(a = rProperties.begin(); a != rProperties.end(); a++)
{
if(a->mnIndex != -1)
{
const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);
if(s_BackColorRGB == rPropName
|| s_BackTransparent == rPropName
|| s_BackColorTransparency == rPropName
|| s_BackGraphicURL == rPropName
|| s_BackGraphicFilter == rPropName
|| s_BackGraphicLocation == rPropName
|| s_BackGraphicTransparency== rPropName)
{
// mark entry as inactive
a->mnIndex = -1;
}
}
}
}
m_bIsFillStyleAlreadyConverted = sal_True;
}
struct _ContextID_Index_Pair aContextIDs[] =
{
{ CTF_DASHNAME , -1 },