diff options
Diffstat (limited to 'xmloff/source/text/txtexppr.cxx')
-rw-r--r-- | xmloff/source/text/txtexppr.cxx | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 0b453bd3c011..dfb35946fa20 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -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 ), |