summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-04-21 14:03:01 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2015-04-22 04:08:16 +0000
commit1636879e50b3fbeba4b2742f9841adb1df48ba88 (patch)
treef1e2d1341371ac87db554ce61ca76d4af55853f6
parent0070b8f540e6b6fbecd5f1793b9d338de4841868 (diff)
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 c3e49660e782816d1203cb936156ef6d6a1ad572) Change-Id: I84b6c09b23a2275161135290f1b0ac9f52546a80 (cherry picked from commit c13b80e202a07b374531babe3af5a8529483f060) Reviewed-on: https://gerrit.libreoffice.org/15465 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit af9db3f55f61d57187be98997fc03167d22fb864) Reviewed-on: https://gerrit.libreoffice.org/15470 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--xmloff/source/text/txtexppr.cxx53
-rw-r--r--xmloff/source/text/txtprmap.cxx3
2 files changed, 30 insertions, 26 deletions
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index 5fc9cc4b397b..46948b252c58 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -70,35 +70,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 ),
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 5b596cd1b82c..02ca01132442 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -366,6 +366,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 ),
@@ -710,6 +711,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 ),
@@ -890,6 +892,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 ),