summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-09-14 09:10:04 +0200
committerAndras Timar <andras.timar@collabora.com>2015-09-18 10:10:49 +0200
commit6999e63a1dbd2be2b35f7696c0112a8996c6849a (patch)
treed553ab2eec60accb36ce9730447f0297520caf7a /xmloff
parent026195300e75c7639a7a8f3ed5ec083bb7296775 (diff)
tdf#92586 xmloff: fix import of stretched background image
The bug document has: <style:page-layout-properties ... style:repeat="no-repeat"> <style:background-image ... style:repeat="stretch"/> </style:page-layout-properties> When a stretched background image is set on a page style using the Writer UI, then these two style:repeat attributes always match, but not in the bugdoc. The later used to have priority, till commit 7d9bb549d498d6beed2c4050c402d09643febdfa (Related: #i124638# Second step of DrawingLayer FillAttributes..., 2014-06-02). Fix the problem by extending XMLBackgroundImageContext::EndElement(): if we know that the <style:page-layout-properties> sets the FillBitmapMode property, then don't blindly set BackGraphicLocation, but try to overwrite the exiting FillBitmapMode one. Change-Id: I64ab4363b20cc95003d35acd63ea421472b1c071 (cherry picked from commit 6621da38b3cd217314c2d2295fd1e71be7e1875e) Reviewed-on: https://gerrit.libreoffice.org/18582 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/XMLBackgroundImageContext.hxx2
-rw-r--r--xmloff/source/style/PageMasterStyleMap.cxx2
-rw-r--r--xmloff/source/style/PagePropertySetContext.cxx1
-rw-r--r--xmloff/source/style/XMLBackgroundImageContext.cxx38
-rw-r--r--xmloff/source/text/XMLTextPropertySetContext.cxx1
-rw-r--r--xmloff/source/text/XMLTextShapeStyleContext.cxx1
6 files changed, 43 insertions, 2 deletions
diff --git a/xmloff/inc/XMLBackgroundImageContext.hxx b/xmloff/inc/XMLBackgroundImageContext.hxx
index 3fb3ca15f4ce..36f68fe224b1 100644
--- a/xmloff/inc/XMLBackgroundImageContext.hxx
+++ b/xmloff/inc/XMLBackgroundImageContext.hxx
@@ -30,6 +30,7 @@ namespace com { namespace sun { namespace star {
class XMLBackgroundImageContext : public XMLElementPropertyContext
{
XMLPropertyState aPosProp;
+ sal_Int32 m_nBitmapModeIdx;
XMLPropertyState aFilterProp;
XMLPropertyState aTransparencyProp;
@@ -58,6 +59,7 @@ public:
sal_Int32 nPosIdx,
sal_Int32 nFilterIdx,
sal_Int32 nTransparencyIdx,
+ sal_Int32 nBitmapModeIdx,
::std::vector< XMLPropertyState > &rProps );
virtual ~XMLBackgroundImageContext();
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
index 092e694fed64..02c248d5249a 100644
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -140,7 +140,7 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
PLMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
PLMAP( "FillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
PLMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
- PLMAP( "FillBitmapMode", XML_NAMESPACE_STYLE, XML_REPEAT, XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ PLMAP( "FillBitmapMode", XML_NAMESPACE_STYLE, XML_REPEAT, XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, CTF_PM_FILLBITMAPMODE ),
PLMAP( "FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ),
PLMAP( "FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ),
PLMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SW_TYPE_BITMAP_REFPOINT, 0 ),
diff --git a/xmloff/source/style/PagePropertySetContext.cxx b/xmloff/source/style/PagePropertySetContext.cxx
index c8d6e4dec8cf..9fa55fb4c47c 100644
--- a/xmloff/source/style/PagePropertySetContext.cxx
+++ b/xmloff/source/style/PagePropertySetContext.cxx
@@ -96,6 +96,7 @@ SvXMLImportContext *PagePropertySetContext::CreateChildContext(
rProp.mnIndex-2,
rProp.mnIndex-1,
-1,
+ mxMapper->getPropertySetMapper()->FindEntryIndex(CTF_PM_FILLBITMAPMODE),
rProperties );
break;
diff --git a/xmloff/source/style/XMLBackgroundImageContext.cxx b/xmloff/source/style/XMLBackgroundImageContext.cxx
index 5acd95109076..a0ee84b2b7de 100644
--- a/xmloff/source/style/XMLBackgroundImageContext.cxx
+++ b/xmloff/source/style/XMLBackgroundImageContext.cxx
@@ -19,6 +19,7 @@
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
#include <tools/debug.hxx>
@@ -332,9 +333,11 @@ XMLBackgroundImageContext::XMLBackgroundImageContext(
sal_Int32 nPosIdx,
sal_Int32 nFilterIdx,
sal_Int32 nTransparencyIdx,
+ sal_Int32 nBitmapModeIdx,
::std::vector< XMLPropertyState > &rProps ) :
XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps ),
aPosProp( nPosIdx ),
+ m_nBitmapModeIdx(nBitmapModeIdx),
aFilterProp( nFilterIdx ),
aTransparencyProp( nTransparencyIdx ),
nTransparency( 0 )
@@ -399,7 +402,40 @@ void XMLBackgroundImageContext::EndElement()
XMLElementPropertyContext::EndElement();
if( -1 != aPosProp.mnIndex )
- rProperties.push_back( aPosProp );
+ {
+ // See if a FillBitmapMode property is already set, in that case
+ // BackGraphicLocation will be ignored.
+ bool bFound = false;
+ if (m_nBitmapModeIdx != -1)
+ {
+ for (XMLPropertyState& rProperty : rProperties)
+ {
+ if (rProperty.mnIndex == m_nBitmapModeIdx)
+ {
+ bFound = true;
+
+ // Found, so map the old property to the new one.
+ switch (ePos)
+ {
+ case GraphicLocation_TILED:
+ rProperty.maValue <<= drawing::BitmapMode_REPEAT;
+ break;
+ case GraphicLocation_AREA:
+ rProperty.maValue <<= drawing::BitmapMode_STRETCH;
+ break;
+ case GraphicLocation_MIDDLE_MIDDLE:
+ rProperty.maValue <<= drawing::BitmapMode_NO_REPEAT;
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+ }
+ if (!bFound)
+ rProperties.push_back( aPosProp );
+ }
if( -1 != aFilterProp.mnIndex )
rProperties.push_back( aFilterProp );
if( -1 != aTransparencyProp.mnIndex )
diff --git a/xmloff/source/text/XMLTextPropertySetContext.cxx b/xmloff/source/text/XMLTextPropertySetContext.cxx
index 2afbd9635c24..308451e6a6f3 100644
--- a/xmloff/source/text/XMLTextPropertySetContext.cxx
+++ b/xmloff/source/text/XMLTextPropertySetContext.cxx
@@ -114,6 +114,7 @@ SvXMLImportContext *XMLTextPropertySetContext::CreateChildContext(
rProp.mnIndex-2,
rProp.mnIndex-1,
nTranspIndex,
+ -1,
rProperties );
}
break;
diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx b/xmloff/source/text/XMLTextShapeStyleContext.cxx
index 59351c5b8b36..19c38ba5b2c9 100644
--- a/xmloff/source/text/XMLTextShapeStyleContext.cxx
+++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx
@@ -111,6 +111,7 @@ SvXMLImportContext *XMLTextShapePropertySetContext_Impl::CreateChildContext(
rProp.mnIndex-2,
rProp.mnIndex-1,
rProp.mnIndex-3,
+ -1,
rProperties );
break;
}