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

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 1 05:32:17 UTC 2020


 sc/qa/extras/macros-test.cxx                   |    4 ++++
 sc/qa/extras/testdocuments/NamesSheetLocal.xls |binary
 sc/source/ui/vba/vbaworksheet.cxx              |    5 +----
 3 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 8f44418fa36fa5475fca1dab664a85bd47386297
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Aug 28 09:26:15 2020 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue Sep 1 07:31:37 2020 +0200

    tdf#136233: Use sheet-local named ranges for VBA's Worksheet.Names
    
    Change-Id: Ia08814b843f3f78337301c324290a3d9420f5f38
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101462
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index df2a1583edd4..5e6aa3d263fc 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -303,6 +303,10 @@ void ScMacrosTest::testVba()
             OUString("Names."),
             OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document")
         },
+        {
+            OUString("NamesSheetLocal."),
+            OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document")
+        },
         {
             OUString("vba_endFunction."),
             OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document")
diff --git a/sc/qa/extras/testdocuments/NamesSheetLocal.xls b/sc/qa/extras/testdocuments/NamesSheetLocal.xls
new file mode 100644
index 000000000000..9086d62a1f36
Binary files /dev/null and b/sc/qa/extras/testdocuments/NamesSheetLocal.xls differ
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index 57aca4796e41..91cfcd09a6f8 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -748,10 +748,7 @@ ScVbaWorksheet::Hyperlinks( const uno::Any& aIndex )
 uno::Any SAL_CALL
 ScVbaWorksheet::Names( const css::uno::Any& aIndex )
 {
-    // fake sheet-local names by returning all global names
-    // #163498# initialize Names object with correct parent (this worksheet)
-    // TODO: real sheet-local names...
-    uno::Reference< beans::XPropertySet > xProps( mxModel, uno::UNO_QUERY_THROW );
+    css::uno::Reference<css::beans::XPropertySet> xProps(getSheet(), css::uno::UNO_QUERY_THROW);
     uno::Reference< sheet::XNamedRanges > xNamedRanges(  xProps->getPropertyValue("NamedRanges"), uno::UNO_QUERY_THROW );
     uno::Reference< XCollection > xNames( new ScVbaNames( this, mxContext, xNamedRanges, mxModel ) );
     if ( aIndex.hasValue() )


More information about the Libreoffice-commits mailing list