Kaydet (Commit) 854d7a1c authored tarafından sushil_shinde's avatar sushil_shinde Kaydeden (comit) Miklos Vajna

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
üst 6fd47306
......@@ -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))
{
......
......@@ -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;
......
......@@ -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();
......
......@@ -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);
......
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