[Libreoffice-commits] .: sc/qa sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Nov 10 12:27:02 PST 2011


 sc/qa/unit/ucalc.cxx             |   12 ++++++------
 sc/source/core/data/document.cxx |   17 ++++++++++++-----
 2 files changed, 18 insertions(+), 11 deletions(-)

New commits:
commit e67181c0f1edf99b595c4589a668150719642811
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Nov 10 15:26:10 2011 -0500

    Re-enabled textural in-exact comparison in unit test for MATCH.
    
    It was the code that checks for the VBA mode that was throwing the
    exception.

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 497dd35..cbc45d0 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -608,9 +608,9 @@ void testFuncMATCH(ScDocument* pDoc)
             { "9.59",     "9" },
             { "10",       "9" },
             { "100",      "9" },
-//          { "Andy",    "10" },
-//          { "Bruce",   "11" },
-//          { "Charlie", "12" }
+            { "Andy",    "10" },
+            { "Bruce",   "11" },
+            { "Charlie", "12" }
         };
 
         runTestMATCH<SAL_N_ELEMENTS(aData),SAL_N_ELEMENTS(aChecks),1>(pDoc, aData, aChecks);
@@ -649,9 +649,9 @@ void testFuncMATCH(ScDocument* pDoc)
             { "0.8",     "12" },
             { "0",       "12" },
             { "-2",      "12" },
-//          { "Andy",    "2" },
-//          { "Bruce",   "1" },
-//          { "Charlie", "#N/A" },
+            { "Andy",    "2" },
+            { "Bruce",   "1" },
+            { "Charlie", "#N/A" },
         };
 
         runTestMATCH<SAL_N_ELEMENTS(aData),SAL_N_ELEMENTS(aChecks),-1>(pDoc, aData, aChecks);
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 117c615..9f44829 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -54,6 +54,7 @@
 #include <com/sun/star/text/WritingMode2.hpp>
 #include <com/sun/star/script/vba/XVBACompatibility.hpp>
 #include <com/sun/star/sheet/TablePageBreakData.hpp>
+#include <com/sun/star/lang/NotInitializedException.hpp>
 
 #include "document.hxx"
 #include "table.hxx"
@@ -5764,13 +5765,19 @@ void ScDocument::EnableUndo( bool bVal )
 
 bool ScDocument::IsInVBAMode() const
 {
-    bool bResult = false;
-    if ( pShell )
+    if (!pShell)
+        return false;
+
+    try
     {
-        com::sun::star::uno::Reference< com::sun::star::script::vba::XVBACompatibility > xVBA( pShell->GetBasicContainer(), com::sun::star::uno::UNO_QUERY );
-        bResult = xVBA.is() && xVBA->getVBACompatibilityMode();
+        uno::Reference<script::vba::XVBACompatibility> xVBA(
+            pShell->GetBasicContainer(), uno::UNO_QUERY);
+
+        return xVBA.is() && xVBA->getVBACompatibilityMode();
     }
-    return bResult;
+    catch (const lang::NotInitializedException&) {}
+
+    return false;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list