summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsushil_shinde <sushil.shinde@synerzip.com>2014-01-02 16:31:26 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-01-06 11:25:09 +0100
commit854d7a1cc77b82ef6b5d72a7889743c1ebe6fe6e (patch)
tree87f945dd4bf58bd4d8642c891bf48e8a373cb041
parent6fd47306eb393d3c99c552ffc851f4edf245f8c8 (diff)
fdo#73217 : Textbox with picture fill are rendered and saved properly.
- Bitmap url was not stored propertly for textframes. - Exported background image fill for text box properly. - Added unit test. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/7259 Change-Id: I1fbab24b2a83b22be04fd6950c80ddf274436738
-rw-r--r--oox/source/drawingml/shape.cxx6
-rw-r--r--oox/source/export/drawingml.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/data/textbox_picturefill.docxbin0 -> 383971 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx7
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx41
5 files changed, 45 insertions, 11 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index b42e27e579c9..b191762efe29 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -633,6 +633,12 @@ Reference< XShape > Shape::createAndInsert(
aShapeProps.setProperty(PROP_BackColorTransparency, aShapeProps[PROP_FillTransparence]);
aShapeProps.erase(PROP_FillTransparence);
}
+ // TextFrames have BackGrahicURL, not FillBitmapURL
+ if (aShapeProps.hasProperty(PROP_FillBitmapURL))
+ {
+ aShapeProps.setProperty(PROP_BackGraphicURL, aShapeProps[PROP_FillBitmapURL]);
+ aShapeProps.erase(PROP_FillBitmapURL);
+ }
// And no LineColor property; individual borders can have colors
if (aShapeProps.hasProperty(PROP_LineColor))
{
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 030beb5fe547..b533d747371b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -608,7 +608,7 @@ void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, OUString sUR
WriteBlip( rXPropSet, aURL );
- if( sURLPropName == "FillBitmapURL" )
+ if( sURLPropName == "FillBitmapURL" || sURLPropName == "BackGraphicURL")
WriteBlipMode( rXPropSet );
else if( GetProperty( rXPropSet, "FillBitmapStretch" ) ) {
bool bStretch = false;
diff --git a/sw/qa/extras/ooxmlexport/data/textbox_picturefill.docx b/sw/qa/extras/ooxmlexport/data/textbox_picturefill.docx
new file mode 100644
index 000000000000..f4fab1b1fec8
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/textbox_picturefill.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 126516fc94a1..dc8726c1f9cd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2253,6 +2253,13 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69649, "fdo69649.docx")
CPPUNIT_ASSERT(contents.match("15"));
}
+DECLARE_OOXMLEXPORT_TEST(testTextBoxPictureFill, "textbox_picturefill.docx")
+{
+ uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, getProperty<drawing::FillStyle>(xFrame, "FillStyle"));
+ CPPUNIT_ASSERT(!(getProperty<OUString>(xFrame,"BackGraphicURL")).isEmpty());
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index d1d617edde0f..0aa7e3601155 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5716,16 +5716,29 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
}
else if (m_bDMLTextFrameSyntax)
{
- m_pSerializer->startElementNS(XML_a, XML_solidFill, FSEND);
- m_pSerializer->startElementNS(XML_a, XML_srgbClr,
- XML_val, sColor,
- FSEND);
- if (oAlpha)
- m_pSerializer->singleElementNS(XML_a, XML_alpha,
- XML_val, OString::number(*oAlpha),
- FSEND);
- m_pSerializer->endElementNS(XML_a, XML_srgbClr);
- m_pSerializer->endElementNS(XML_a, XML_solidFill);
+ bool bImageBackground = false;
+ const SfxPoolItem* pItem = GetExport().HasItem(RES_FILL_STYLE);
+ if (pItem)
+ {
+ const XFillStyleItem* pFillStyle = static_cast<const XFillStyleItem*>(pItem);
+ if(pFillStyle->GetValue() == XFILL_BITMAP)
+ {
+ bImageBackground = true;
+ }
+ }
+ if (!bImageBackground)
+ {
+ m_pSerializer->startElementNS(XML_a, XML_solidFill, FSEND);
+ m_pSerializer->startElementNS(XML_a, XML_srgbClr,
+ XML_val, sColor,
+ FSEND);
+ if (oAlpha)
+ m_pSerializer->singleElementNS(XML_a, XML_alpha,
+ XML_val, OString::number(*oAlpha),
+ FSEND);
+ m_pSerializer->endElementNS(XML_a, XML_srgbClr);
+ m_pSerializer->endElementNS(XML_a, XML_solidFill);
+ }
}
else if ( !m_rExport.bOutPageDescs )
{
@@ -5823,6 +5836,14 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
{
const XFillStyleItem* pFillStyle = static_cast<const XFillStyleItem*>(pItem);
FormatFillStyle(*pFillStyle);
+ if (m_oFillStyle && *m_oFillStyle == XFILL_BITMAP)
+ {
+ const SdrObject* pSdrObj = m_rExport.mpParentFrame->GetFrmFmt().FindRealSdrObject();
+ uno::Reference< drawing::XShape > xShape( ((SdrObject*)pSdrObj)->getUnoShape(), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY );
+ m_rDrawingML.SetFS(m_pSerializer);
+ m_rDrawingML.WriteBlipFill( xPropertySet, "BackGraphicURL" );
+ }
}
pItem = GetExport().HasItem(RES_FILL_GRADIENT);