drawingML import: handle RelativeWidth/Height for drawinglayer shapes
This was already handled in the VML importer previously. Change-Id: Ie04ed0cec632222c5f6481943ad7f4db66a752e5
This commit is contained in:
parent
ea3074e0be
commit
e86a602df7
BIN
sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx
Normal file
BIN
sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx
Normal file
Binary file not shown.
@ -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,16 +952,12 @@ 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));
|
||||
}
|
||||
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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user