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:
committed by
Miklos Vajna
parent
6fd47306eb
commit
854d7a1cc7
@@ -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;
|
||||
|
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"));
|
||||
}
|
||||
|
||||
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();
|
||||
|
@@ -5715,6 +5715,18 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
|
||||
AddToAttrList( m_pFlyAttrList, XML_fillcolor, sColor.getStr() );
|
||||
}
|
||||
else if (m_bDMLTextFrameSyntax)
|
||||
{
|
||||
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,
|
||||
@@ -5727,6 +5739,7 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
|
||||
m_pSerializer->endElementNS(XML_a, XML_srgbClr);
|
||||
m_pSerializer->endElementNS(XML_a, XML_solidFill);
|
||||
}
|
||||
}
|
||||
else if ( !m_rExport.bOutPageDescs )
|
||||
{
|
||||
if( !m_pBackgroundAttrList )
|
||||
@@ -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);
|
||||
|
Reference in New Issue
Block a user