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

DOCX import: round wp14:pctWidth/Height

sw core supports integers only ATM, so at least let e.g. 9.8 be 10, not
9.

Change-Id: I94842d7190bfa264f0fa0331d7418c411ef191d9
üst bcfa8915
......@@ -1748,6 +1748,12 @@ DECLARE_OOXMLIMPORT_TEST(testPageRelSize, "pagerelsize.docx")
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeWidthRelation"));
}
DECLARE_OOXMLIMPORT_TEST(testRelSizeRound, "rel-size-round.docx")
{
// This was 9: 9.8 was imported as 9 instead of being rounded to 10.
CPPUNIT_ASSERT_EQUAL(sal_Int16(10), getProperty<sal_Int16>(getShape(1), "RelativeHeight"));
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -43,6 +43,7 @@
#include <cppuhelper/implbase1.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
#include <dmapper/DomainMapper.hxx>
#include <ooxml/resourceids.hxx>
......@@ -936,7 +937,7 @@ 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 = m_pImpl->m_rPositivePercentages.front().toInt32() / 1000;
sal_Int16 nPositivePercentage = rtl::math::round(m_pImpl->m_rPositivePercentages.front().toDouble() / 1000);
m_pImpl->m_rPositivePercentages.pop();
uno::Reference<lang::XServiceInfo> xServiceInfo(m_xShape, uno::UNO_QUERY_THROW);
......
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