Kaydet (Commit) c13b80e2 authored tarafından Michael Stahl's avatar Michael Stahl

tdf#90640: xmloff: ODF export: fix style:background-image attributes

... for Writer frames, which were missing the draw:opacity; turns out
this is because now the the default valued properties are not exported
any more, which causes them to be missing in the property array so the
hard-coded indexes in XMLTextExportPropertySetMapper::handleElementItem()
do not find them.

(regression from c3e49660)

Change-Id: I84b6c09b23a2275161135290f1b0ac9f52546a80
üst 2bf87e1c
......@@ -71,35 +71,36 @@ void XMLTextExportPropertySetMapper::handleElementItem(
case CTF_BACKGROUND_URL:
{
DBG_ASSERT( pProperties && nIdx >= 3,
"property vector missing" );
assert(pProperties && nIdx >= 3);
const Any *pPos = 0, *pFilter = 0, *pTrans = 0;
if( pProperties && nIdx >= 3 )
sal_uInt32 nPropIndex = rProperty.mnIndex;
// these are all optional, so have to check them in order
// note: this index order dependency is a steaming pile of manure
sal_uInt32 nIndex(nIdx - 1);
const XMLPropertyState& rFilter = (*pProperties)[nIndex];
if (CTF_BACKGROUND_FILTER == getPropertySetMapper()
->GetEntryContextId(rFilter.mnIndex))
{
const XMLPropertyState& rTrans = (*pProperties)[nIdx-3];
// #99657# transparency may be there, but doesn't have to be.
// If it's there, it must be in the right position.
if( CTF_BACKGROUND_TRANSPARENCY == getPropertySetMapper()
->GetEntryContextId( rTrans.mnIndex ) )
pTrans = &rTrans.maValue;
const XMLPropertyState& rPos = (*pProperties)[nIdx-2];
DBG_ASSERT( CTF_BACKGROUND_POS == getPropertySetMapper()
->GetEntryContextId( rPos.mnIndex ),
"invalid property map: pos expected" );
if( CTF_BACKGROUND_POS == getPropertySetMapper()
->GetEntryContextId( rPos.mnIndex ) )
pPos = &rPos.maValue;
const XMLPropertyState& rFilter = (*pProperties)[nIdx-1];
DBG_ASSERT( CTF_BACKGROUND_FILTER == getPropertySetMapper()
->GetEntryContextId( rFilter.mnIndex ),
"invalid property map: filter expected" );
if( CTF_BACKGROUND_FILTER == getPropertySetMapper()
->GetEntryContextId( rFilter.mnIndex ) )
pFilter = &rFilter.maValue;
pFilter = &rFilter.maValue;
--nIndex;
}
sal_uInt32 nPropIndex = rProperty.mnIndex;
const XMLPropertyState& rPos = (*pProperties)[nIndex];
if (CTF_BACKGROUND_POS == getPropertySetMapper()
->GetEntryContextId(rPos.mnIndex))
{
pPos = &rPos.maValue;
--nIndex;
}
const XMLPropertyState& rTrans = (*pProperties)[nIndex];
// #99657# transparency may be there, but doesn't have to be.
// If it's there, it must be in the right position.
if( CTF_BACKGROUND_TRANSPARENCY == getPropertySetMapper()
->GetEntryContextId( rTrans.mnIndex ) )
pTrans = &rTrans.maValue;
pThis->maBackgroundImageExport.exportXML(
rProperty.maValue, pPos, pFilter, pTrans,
getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
......
......@@ -382,6 +382,7 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
// RES_ANCHOR
// not required
// RES_BACKGROUND
// DO NOT REORDER these!
MP_E( "ParaBackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
MP_E( "ParaBackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
MP_E( "ParaBackGraphicLocation", STYLE, POSITION, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BUILDIN_CMP_ONLY, CTF_BACKGROUND_POS ),
......@@ -744,6 +745,7 @@ XMLPropertyMapEntry aXMLFramePropMap[] =
// RES_ANCHOR
// see above
// RES_BACKGROUND
// DO NOT REORDER these!
MG_ED( "BackColorRGB", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
MG_ED( "BackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, CTF_BACKGROUND_TRANSPARENT ),
MG_ED( "BackColorTransparency", STYLE, BACKGROUND_TRANSPARENCY, XML_TYPE_PERCENT8, CTF_BACKGROUND_TRANSPARENCY ),
......@@ -924,6 +926,7 @@ XMLPropertyMapEntry aXMLSectionPropMap[] =
MS_E( "TextColumns", STYLE, COLUMNS, MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_COLUMNS, CTF_TEXTCOLUMNS ),
// RES_BACKGROUND
// DO NOT REORDER these!
MS_E( "BackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
MS_E( "BackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
MS_E( "BackGraphicLocation", STYLE, POSITION, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BUILDIN_CMP_ONLY, CTF_BACKGROUND_POS ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment