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
This commit is contained in:
parent
6fd47306eb
commit
854d7a1cc7
@ -633,6 +633,12 @@ Reference< XShape > Shape::createAndInsert(
|
|||||||
aShapeProps.setProperty(PROP_BackColorTransparency, aShapeProps[PROP_FillTransparence]);
|
aShapeProps.setProperty(PROP_BackColorTransparency, aShapeProps[PROP_FillTransparence]);
|
||||||
aShapeProps.erase(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
|
// And no LineColor property; individual borders can have colors
|
||||||
if (aShapeProps.hasProperty(PROP_LineColor))
|
if (aShapeProps.hasProperty(PROP_LineColor))
|
||||||
{
|
{
|
||||||
|
@ -608,7 +608,7 @@ void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, OUString sUR
|
|||||||
|
|
||||||
WriteBlip( rXPropSet, aURL );
|
WriteBlip( rXPropSet, aURL );
|
||||||
|
|
||||||
if( sURLPropName == "FillBitmapURL" )
|
if( sURLPropName == "FillBitmapURL" || sURLPropName == "BackGraphicURL")
|
||||||
WriteBlipMode( rXPropSet );
|
WriteBlipMode( rXPropSet );
|
||||||
else if( GetProperty( rXPropSet, "FillBitmapStretch" ) ) {
|
else if( GetProperty( rXPropSet, "FillBitmapStretch" ) ) {
|
||||||
bool bStretch = false;
|
bool bStretch = false;
|
||||||
|
BIN
sw/qa/extras/ooxmlexport/data/textbox_picturefill.docx
Normal file
BIN
sw/qa/extras/ooxmlexport/data/textbox_picturefill.docx
Normal file
Binary file not shown.
@ -2253,6 +2253,13 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69649, "fdo69649.docx")
|
|||||||
CPPUNIT_ASSERT(contents.match("15"));
|
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
|
#endif
|
||||||
|
|
||||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||||
|
@ -5716,16 +5716,29 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
|
|||||||
}
|
}
|
||||||
else if (m_bDMLTextFrameSyntax)
|
else if (m_bDMLTextFrameSyntax)
|
||||||
{
|
{
|
||||||
m_pSerializer->startElementNS(XML_a, XML_solidFill, FSEND);
|
bool bImageBackground = false;
|
||||||
m_pSerializer->startElementNS(XML_a, XML_srgbClr,
|
const SfxPoolItem* pItem = GetExport().HasItem(RES_FILL_STYLE);
|
||||||
XML_val, sColor,
|
if (pItem)
|
||||||
FSEND);
|
{
|
||||||
if (oAlpha)
|
const XFillStyleItem* pFillStyle = static_cast<const XFillStyleItem*>(pItem);
|
||||||
m_pSerializer->singleElementNS(XML_a, XML_alpha,
|
if(pFillStyle->GetValue() == XFILL_BITMAP)
|
||||||
XML_val, OString::number(*oAlpha),
|
{
|
||||||
FSEND);
|
bImageBackground = true;
|
||||||
m_pSerializer->endElementNS(XML_a, XML_srgbClr);
|
}
|
||||||
m_pSerializer->endElementNS(XML_a, XML_solidFill);
|
}
|
||||||
|
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 )
|
else if ( !m_rExport.bOutPageDescs )
|
||||||
{
|
{
|
||||||
@ -5823,6 +5836,14 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
|
|||||||
{
|
{
|
||||||
const XFillStyleItem* pFillStyle = static_cast<const XFillStyleItem*>(pItem);
|
const XFillStyleItem* pFillStyle = static_cast<const XFillStyleItem*>(pItem);
|
||||||
FormatFillStyle(*pFillStyle);
|
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);
|
pItem = GetExport().HasItem(RES_FILL_GRADIENT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user