Kaydet (Commit) bc7768a6 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Andras Timar

Resolves: tdf#91950 optional entries may not be present

here we appear to check if the preceding optional entries are of certain
types. Presumably if they are optional then its legal for them not to
exist at all, just that if they are there they should be in the right
order.

Change-Id: Id147b91d7d375d7985d901cda112c7757dc3fb19
Reviewed-on: https://gerrit.libreoffice.org/17353Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 58ee01bd
...@@ -71,35 +71,42 @@ void XMLTextExportPropertySetMapper::handleElementItem( ...@@ -71,35 +71,42 @@ void XMLTextExportPropertySetMapper::handleElementItem(
case CTF_BACKGROUND_URL: case CTF_BACKGROUND_URL:
{ {
assert(pProperties && nIdx >= 3);
const Any *pPos = 0, *pFilter = 0, *pTrans = 0; const Any *pPos = 0, *pFilter = 0, *pTrans = 0;
sal_uInt32 nPropIndex = rProperty.mnIndex; sal_uInt32 nPropIndex = rProperty.mnIndex;
// these are all optional, so have to check them in order // these are all optional, so have to check them in order
// note: this index order dependency is a steaming pile of manure // note: this index order dependency is a steaming pile of manure
sal_uInt32 nIndex(nIdx - 1); if (nIdx)
const XMLPropertyState& rFilter = (*pProperties)[nIndex];
if (CTF_BACKGROUND_FILTER == getPropertySetMapper()
->GetEntryContextId(rFilter.mnIndex))
{ {
pFilter = &rFilter.maValue; const XMLPropertyState& rFilter = (*pProperties)[nIdx - 1];
--nIndex; if (CTF_BACKGROUND_FILTER == getPropertySetMapper()
->GetEntryContextId(rFilter.mnIndex))
{
pFilter = &rFilter.maValue;
--nIdx;
}
} }
const XMLPropertyState& rPos = (*pProperties)[nIndex]; if (nIdx)
if (CTF_BACKGROUND_POS == getPropertySetMapper()
->GetEntryContextId(rPos.mnIndex))
{ {
pPos = &rPos.maValue; const XMLPropertyState& rPos = (*pProperties)[nIdx - 1];
--nIndex; if (CTF_BACKGROUND_POS == getPropertySetMapper()
->GetEntryContextId(rPos.mnIndex))
{
pPos = &rPos.maValue;
--nIdx;
}
} }
const XMLPropertyState& rTrans = (*pProperties)[nIndex]; if (nIdx)
// #99657# transparency may be there, but doesn't have to be. {
// If it's there, it must be in the right position. const XMLPropertyState& rTrans = (*pProperties)[nIdx - 1];
if( CTF_BACKGROUND_TRANSPARENCY == getPropertySetMapper() // #99657# transparency may be there, but doesn't have to be.
->GetEntryContextId( rTrans.mnIndex ) ) // If it's there, it must be in the right position.
pTrans = &rTrans.maValue; if( CTF_BACKGROUND_TRANSPARENCY == getPropertySetMapper()
->GetEntryContextId( rTrans.mnIndex ) )
pTrans = &rTrans.maValue;
}
pThis->maBackgroundImageExport.exportXML( pThis->maBackgroundImageExport.exportXML(
rProperty.maValue, pPos, pFilter, pTrans, rProperty.maValue, pPos, pFilter, pTrans,
......
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