[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Feb 10 03:32:59 PST 2014
sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 7 +++++++
sw/source/core/layout/anchoreddrawobject.cxx | 2 +-
writerfilter/source/dmapper/GraphicImport.cxx | 13 +++++--------
4 files changed, 13 insertions(+), 9 deletions(-)
New commits:
commit e86a602df7540d491dbfd6a61571bd128b0d0ca4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Feb 10 11:55:01 2014 +0100
drawingML import: handle RelativeWidth/Height for drawinglayer shapes
This was already handled in the VML importer previously.
Change-Id: Ie04ed0cec632222c5f6481943ad7f4db66a752e5
diff --git a/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx b/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx
new file mode 100644
index 0000000..391d737
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 1de987d..cecb7fa 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -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");
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 3802272..f88690b 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -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();
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 7eec031..9528cd5 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -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:
More information about the Libreoffice-commits
mailing list