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

Caolán McNamara caolanm at redhat.com
Tue Apr 14 06:29:55 PDT 2015


 sw/source/filter/ww8/wrtw8esh.cxx |   47 +++++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 21 deletions(-)

New commits:
commit 1c67b7f39971e6b7291e93b36f77c8593fd586c8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 14 14:28:59 2015 +0100

    fix crash on export of novell606043-1.odt to doc
    
    Change-Id: I91478cf0a9b128f96dab5be67d018af46d75bd4f

diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 880c3e3..97131c0 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -367,30 +367,35 @@ bool WW8Export::MiserableFormFieldExportHack(const SwFrmFmt& rFrmFmt)
     OSL_ENSURE(bWrtWW8, "Not allowed");
     if (!bWrtWW8)
         return false;
-    bool bHack = false;
     const SdrObject *pObject = rFrmFmt.FindRealSdrObject();
-    if (pObject && pObject->GetObjInventor() == FmFormInventor)
+    if (!pObject || pObject->GetObjInventor() != FmFormInventor)
+        return false;
+
+    const SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObject);
+    if (!pFormObj)
+        return false;
+
+    uno::Reference< awt::XControlModel > xControlModel =
+        pFormObj->GetUnoControlModel();
+    uno::Reference< lang::XServiceInfo > xInfo(xControlModel,
+        uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xPropSet(xControlModel, uno::UNO_QUERY);
+    if (!xInfo.is())
+        return false;
+
+    if (xInfo->supportsService("com.sun.star.form.component.ComboBox"))
     {
-        if (const SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObject))
-        {
-            uno::Reference< awt::XControlModel > xControlModel =
-                pFormObj->GetUnoControlModel();
-            uno::Reference< lang::XServiceInfo > xInfo(xControlModel,
-                uno::UNO_QUERY);
-            uno::Reference<beans::XPropertySet> xPropSet(xControlModel, uno::UNO_QUERY);
-            if (xInfo->supportsService("com.sun.star.form.component.ComboBox"))
-            {
-                DoComboBox(xPropSet);
-                bHack = true;
-            }
-            else if (xInfo->supportsService("com.sun.star.form.component.CheckBox"))
-            {
-                DoCheckBox(xPropSet);
-                bHack = true;
-            }
-        }
+        DoComboBox(xPropSet);
+        return true;
     }
-    return bHack;
+
+    if (xInfo->supportsService("com.sun.star.form.component.CheckBox"))
+    {
+        DoCheckBox(xPropSet);
+        return true;
+    }
+
+    return false;
 }
 
 void WW8Export::DoComboBox(uno::Reference<beans::XPropertySet> xPropSet)


More information about the Libreoffice-commits mailing list