[Libreoffice-commits] .: 2 commits - oovbaapi/ooo sc/qa sc/source

Noel Power noelp at kemper.freedesktop.org
Fri Oct 28 04:58:44 PDT 2011


 oovbaapi/ooo/vba/excel/XRange.idl   |    2 +-
 sc/qa/unit/data/xls/TestAddress.xls |binary
 sc/qa/unit/macros-test.cxx          |    5 +----
 sc/source/ui/vba/vbarange.cxx       |   23 +++++++++++++++++++++++
 sc/source/ui/vba/vbarange.hxx       |    1 +
 5 files changed, 26 insertions(+), 5 deletions(-)

New commits:
commit 2a91e5bf2bce5ec932ac712e77e18b3efe2509a8
Author: Noel Power <noel.power at novell.com>
Date:   Fri Oct 28 13:00:46 2011 +0100

    re-enable vba.xls, tweak TestAddress.xls (move tests back to normal module)

diff --git a/sc/qa/unit/data/xls/TestAddress.xls b/sc/qa/unit/data/xls/TestAddress.xls
index 7d2ca6e..629645c 100644
Binary files a/sc/qa/unit/data/xls/TestAddress.xls and b/sc/qa/unit/data/xls/TestAddress.xls differ
diff --git a/sc/qa/unit/macros-test.cxx b/sc/qa/unit/macros-test.cxx
index a58c92d..22faa26 100644
--- a/sc/qa/unit/macros-test.cxx
+++ b/sc/qa/unit/macros-test.cxx
@@ -254,15 +254,12 @@ void ScMacrosTest::testVba()
     TestMacroInfo testInfo[] = {
         {
             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TestAddress.")),
-            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.Star.script:VBAProject.Sheet1.test?language=Basic&location=document"))
+            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document"))
         },
-/*
-        vba.xls is still throwing up a basic error :-/
         {
             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vba.")),
             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.Star.script:VBAProject.Modul1.Modul1?language=Basic&location=document")),
         }
-*/
     };
 
     rtl::OUString aFileExtension(aFileFormats[1].pName, strlen(aFileFormats[1].pName), RTL_TEXTENCODING_UTF8 );
commit f323d36f29107ac7487fe748b1daf639d0d1e9b0
Author: August Sodora <augsod at gmail.com>
Date:   Wed Oct 26 15:32:55 2011 -0400

    Add vba support for assigning names to cell ranges

diff --git a/oovbaapi/ooo/vba/excel/XRange.idl b/oovbaapi/ooo/vba/excel/XRange.idl
index 62a0994..015c68c 100644
--- a/oovbaapi/ooo/vba/excel/XRange.idl
+++ b/oovbaapi/ooo/vba/excel/XRange.idl
@@ -64,7 +64,7 @@ interface XRange
     interface ::ooo::vba::excel::XFormat;
     //interface ::ooo::vba::XHelperInterface;
 
-    [attribute, readonly] any Name;
+    [attribute] any Name;
     [attribute] any Value;
     [attribute] any Formula;
     [attribute] any FormulaArray;
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index fe8c9df..659bff8 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -1569,6 +1569,29 @@ uno::Any SAL_CALL ScVbaRange::getName() throw (uno::RuntimeException)
     return uno::makeAny( xName );
 }
 
+void
+ScVbaRange::setName( const uno::Any& aName ) throw (uno::RuntimeException)
+{
+    uno::Reference< excel::XName > xName;
+
+    ScDocShell* pDocShell = getScDocShell();
+    uno::Reference< frame::XModel > xModel = pDocShell ? pDocShell->GetModel() : NULL;
+    if ( !xModel.is() )
+    {
+        throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid document" )), uno::Reference< uno::XInterface >() );
+    }
+    uno::Reference< beans::XPropertySet > xPropertySet( xModel, uno::UNO_QUERY_THROW );
+    uno::Reference< sheet::XNamedRanges > xNamedRanges( xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"))) , uno::UNO_QUERY_THROW );
+
+    uno::Reference< excel::XNames > xNames( new ScVbaNames( uno::Reference< XHelperInterface >(), mxContext , xNamedRanges , xModel ) );
+
+    uno::Any aDummy;
+    //uno::Any aRefersTo;
+    //    aRefersTo <<= uno::Reference< excel::XRange >(this, uno::UNO_QUERY);
+    xNames->Add(aName, getCellRange(), aDummy, aDummy, aDummy, aDummy,
+                aDummy, aDummy, aDummy, aDummy, aDummy);
+}
+
 uno::Any
 ScVbaRange::getValue( ValueGetter& valueGetter) throw (uno::RuntimeException)
 {
diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx
index db4e49d..26f639f 100644
--- a/sc/source/ui/vba/vbarange.hxx
+++ b/sc/source/ui/vba/vbarange.hxx
@@ -167,6 +167,7 @@ public:
 
     // Attributes
     virtual css::uno::Any SAL_CALL getName() throw (css::uno::RuntimeException);
+    virtual void   SAL_CALL setName( const css::uno::Any& aName ) throw (css::uno::RuntimeException);
     virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
     virtual void   SAL_CALL setValue( const css::uno::Any& aValue ) throw ( css::uno::RuntimeException);
     virtual css::uno::Any SAL_CALL getFormula() throw (css::uno::RuntimeException);


More information about the Libreoffice-commits mailing list