[Libreoffice-commits] core.git: sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Thu May 15 10:05:51 PDT 2014


 sw/qa/extras/ooxmlimport/data/chart-size.docx     |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx          |   10 ++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    4 ++++
 3 files changed, 14 insertions(+)

New commits:
commit 8bfbfc06fefb418269734cfb17c70a5ae5a42d2a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu May 15 18:34:35 2014 +0200

    DOCX import: fix chart size when it's inside a TextFrame
    
    Change-Id: I3edb253238db182054b7688061916a2432b687b5

diff --git a/sw/qa/extras/ooxmlimport/data/chart-size.docx b/sw/qa/extras/ooxmlimport/data/chart-size.docx
new file mode 100644
index 0000000..da5d144
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/chart-size.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 7c4e14b..3ffe132 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -37,6 +37,7 @@
 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
 #include <com/sun/star/text/XTextFrame.hpp>
 #include <com/sun/star/text/XTextFramesSupplier.hpp>
+#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 #include <com/sun/star/style/BreakType.hpp>
 #include <com/sun/star/style/ParagraphAdjust.hpp>
@@ -2108,6 +2109,15 @@ DECLARE_OOXMLIMPORT_TEST(testMsoBrightnessContrast, "msobrightnesscontrast.docx"
     CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6e4]));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testChartSize, "chart-size.docx")
+{
+    // When chart was in a TextFrame, its size was too large.
+    uno::Reference<text::XTextEmbeddedObjectsSupplier> xTextEmbeddedObjectsSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xEmbeddedObjects(xTextEmbeddedObjectsSupplier->getEmbeddedObjects(), uno::UNO_QUERY);
+    // This was 10954.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(6008), getProperty<sal_Int32>(xEmbeddedObjects->getByIndex(0), "Width"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f3eb595..4a5b8a4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4341,6 +4341,10 @@ void  DomainMapper_Impl::ImportGraphic(writerfilter::Reference< Properties >::Po
     if( xTextContent.is())
         appendTextContent( xTextContent, uno::Sequence< beans::PropertyValue >() );
 
+    // Clear the reference, so in case the embedded object is inside a
+    // TextFrame, we won't try to resize it (to match the size of the
+    // TextFrame) here.
+    m_xEmbedded.clear();
     m_pGraphicImport.reset();
 }
 


More information about the Libreoffice-commits mailing list