Kaydet (Commit) e86a602d authored tarafından Miklos Vajna's avatar Miklos Vajna

drawingML import: handle RelativeWidth/Height for drawinglayer shapes

This was already handled in the VML importer previously.

Change-Id: Ie04ed0cec632222c5f6481943ad7f4db66a752e5
üst ea3074e0
......@@ -2808,6 +2808,13 @@ DECLARE_OOXMLEXPORT_TEST(testDMLCustomGeometry, "dml-customgeometry-cubicbezier.
}
}
DECLARE_OOXMLEXPORT_TEST(testDmlRectangleRelsize, "dml-rectangle-relsize.docx")
{
// This was around 19560, as we did not read wp14:pctHeight for
// drawinglayer shapes and the fallback data was invalid.
CPPUNIT_ASSERT(21000 < getShape(1)->getSize().Height);
}
DECLARE_OOXMLEXPORT_TEST(testGradientFillPreservation, "gradient-fill-preservation.docx")
{
xmlDocPtr pXmlDocument = parseExport("word/document.xml");
......
......@@ -642,7 +642,7 @@ const SwRect SwAnchoredDrawObject::GetObjRect() const
const SwRect SwAnchoredDrawObject::GetObjBoundRect() const
{
// Resize objects with relative width or height
if ( GetDrawObj( )->GetRelativeWidth( ) || GetDrawObj()->GetRelativeHeight( ) )
if ( GetPageFrm( ) && ( GetDrawObj( )->GetRelativeWidth( ) || GetDrawObj()->GetRelativeHeight( ) ) )
{
Rectangle aPageRect = GetPageFrm( )->GetBoundRect( ).SVRect();
Rectangle aCurrObjRect = GetDrawObj()->GetCurrentBoundRect();
......
......@@ -44,6 +44,7 @@
#include <cppuhelper/implbase1.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
#include <oox/drawingml/drawingmltypes.hxx>
#include <dmapper/DomainMapper.hxx>
#include <ooxml/resourceids.hxx>
......@@ -951,17 +952,13 @@ void GraphicImport::lcl_sprm(Sprm & rSprm)
case NS_ooxml::LN_CT_SizeRelV_pctHeight:
if (m_xShape.is() && !m_pImpl->m_rPositivePercentages.empty())
{
sal_Int16 nPositivePercentage = rtl::math::round(m_pImpl->m_rPositivePercentages.front().toDouble() / 1000);
sal_Int16 nPositivePercentage = rtl::math::round(m_pImpl->m_rPositivePercentages.front().toDouble() / oox::drawingml::PER_PERCENT);
m_pImpl->m_rPositivePercentages.pop();
uno::Reference<lang::XServiceInfo> xServiceInfo(m_xShape, uno::UNO_QUERY_THROW);
if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
{
uno::Reference<beans::XPropertySet> xPropertySet(m_xShape, uno::UNO_QUERY);
OUString aProperty = nSprmId == NS_ooxml::LN_CT_SizeRelH_pctWidth ? OUString("RelativeWidth") : OUString("RelativeHeight");
xPropertySet->setPropertyValue(aProperty, uno::makeAny(nPositivePercentage));
}
}
break;
case 0x271b:
case 0x271c:
......
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