[Libreoffice-commits] core.git: oox/source sw/qa sw/source
sushil_shinde
sushil.shinde at synerzip.com
Mon Jan 6 02:25:34 PST 2014
oox/source/drawingml/shape.cxx | 6 ++
oox/source/export/drawingml.cxx | 2
sw/qa/extras/ooxmlexport/data/textbox_picturefill.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 7 ++
sw/source/filter/ww8/docxattributeoutput.cxx | 41 ++++++++++++-----
5 files changed, 45 insertions(+), 11 deletions(-)
New commits:
commit 854d7a1cc77b82ef6b5d72a7889743c1ebe6fe6e
Author: sushil_shinde <sushil.shinde at synerzip.com>
Date: Thu Jan 2 16:31:26 2014 +0530
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
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index b42e27e..b191762 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 030beb5..b533d747 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 0000000..f4fab1b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/textbox_picturefill.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 126516f..dc8726c 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 d1d617e..0aa7e36 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);
More information about the Libreoffice-commits
mailing list