[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - oox/source sw/qa

Miklos Vajna vmiklos at suse.cz
Fri Jun 7 04:01:23 PDT 2013


 oox/source/vml/vmltextboxcontext.cxx       |    4 ++++
 sw/qa/extras/ooxmlimport/data/n820788.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |   13 +++++++++++++
 3 files changed, 17 insertions(+)

New commits:
commit 1538e78227b6fb6c8676dbfa951f583d985ba053
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Jun 7 11:49:10 2013 +0200

    bnc#820788 VML import of v:textbox's mso-fit-shape-to-text style property
    
    Change-Id: I74a0ecd50ca61a4f5bf7ebdbf12743dc1fd9368a
    (cherry picked from commit a22ef599bd3fdcf0bd5c3616aa566a5922624ff3)

diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx
index b96bb60..17b0872 100644
--- a/oox/source/vml/vmltextboxcontext.cxx
+++ b/oox/source/vml/vmltextboxcontext.cxx
@@ -188,6 +188,10 @@ TextBoxContext::TextBoxContext( ContextHandler2Helper& rParent, TextBox& rTextBo
         if( ConversionHelper::separatePair( aName, aValue, sStyle.getToken( 0, ';', nIndex ), ':' ) )
         {
             if( aName == "layout-flow" )      rTextBox.maLayoutFlow = aValue;
+            else if (aName == "mso-fit-shape-to-text")
+                rTextBox.mrTypeModel.mbAutoHeight = true;
+            else
+                SAL_WARN("oox", "unhandled style property: " << aName);
         }
     }
 }
diff --git a/sw/qa/extras/ooxmlimport/data/n820788.docx b/sw/qa/extras/ooxmlimport/data/n820788.docx
new file mode 100755
index 0000000..759c408
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n820788.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index bd85ca2..7eb556c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -35,6 +35,7 @@
 #include <com/sun/star/text/HoriOrientation.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
 #include <com/sun/star/text/SetVariableType.hpp>
+#include <com/sun/star/text/SizeType.hpp>
 #include <com/sun/star/text/TableColumnSeparator.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/text/VertOrientation.hpp>
@@ -124,6 +125,7 @@ public:
     void testWatermark();
     void testPageBorderShadow();
     void testN820509();
+    void testN820788();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -198,6 +200,7 @@ void Test::run()
         {"watermark.docx", &Test::testWatermark},
         {"page-border-shadow.docx", &Test::testPageBorderShadow},
         {"n820509.docx", &Test::testN820509},
+        {"n820788.docx", &Test::testN820788},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1246,6 +1249,16 @@ void Test::testN820509()
     CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty<sal_Int16>(xPropertySet, "DateFormat"));
 }
 
+void Test::testN820788()
+{
+    // The problem was that AutoSize was not enabled for the text frame.
+    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+    // This was text::SizeType::FIX.
+    CPPUNIT_ASSERT_EQUAL(text::SizeType::MIN, getProperty<sal_Int16>(xFrame, "SizeType"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list