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

Miklos Vajna vmiklos at suse.cz
Sun Jun 16 03:09:30 PDT 2013


 sw/qa/extras/rtfimport/rtfimport.cxx        |    1 +
 writerfilter/source/rtftok/rtfsdrimport.cxx |   10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit aa0f3ca1cd285e8ffbc10de5510d447a72de980a
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sun Jun 16 11:57:57 2013 +0200

    RTF import of fFitShapeToText shape property
    
    Change-Id: I1d0cd0d34284e6ecabd0b4dc9bf25bc31b7ff4c1

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 19f956e..624b2b7 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1283,6 +1283,7 @@ void Test::testPoshPosv()
     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(xDraws->getByIndex(0), "HoriOrient"));
     CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(xDraws->getByIndex(0), "VertOrient"));
+    CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xDraws->getByIndex(0), "FrameIsAutomaticHeight"));
 }
 
 void Test::testTextframeTable()
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index d0178ff..08516d1 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -120,6 +120,7 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, OUStrin
     uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
     sal_Int16 nHoriOrient = 0;
     sal_Int16 nVertOrient = 0;
+    boost::optional<bool> obFitShapeToText;
     if (aKey == "posh")
     {
         switch (aValue.toInt32())
@@ -160,10 +161,17 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, OUStrin
                 break;
         }
     }
+    else if (aKey == "fFitShapeToText")
+        obFitShapeToText.reset(aValue.toInt32() == 1);
     if (nHoriOrient != 0)
         xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(nHoriOrient));
     if (nVertOrient != 0)
         xPropertySet->setPropertyValue("VertOrient", uno::makeAny(nVertOrient));
+    if (obFitShapeToText)
+    {
+        xPropertySet->setPropertyValue("SizeType", uno::makeAny(*obFitShapeToText ? text::SizeType::MIN : text::SizeType::FIX));
+        xPropertySet->setPropertyValue("FrameIsAutomaticHeight", uno::makeAny(*obFitShapeToText));
+    }
 }
 
 void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
@@ -444,7 +452,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
         else if (i->first == "shadowOffsetX")
             // EMUs to points
             aShadowModel.moOffset.set(OUString::number(i->second.toDouble() / 12700) + "pt");
-        else if (i->first == "posh" || i->first == "posv")
+        else if (i->first == "posh" || i->first == "posv" || i->first == "fFitShapeToText")
             applyProperty(xShape, i->first, i->second);
         else if (i->first == "posrelh")
         {


More information about the Libreoffice-commits mailing list