offapi/com/sun/star/sheet/XFunctionAccess.idl |    5 ++++-
 sc/qa/extras/macros-test.cxx                  |   22 ++++++++++++++++++++++
 sc/source/ui/unoobj/funcuno.cxx               |    5 +++++
 3 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit a2fd2ced7f7e47f7ec0c8f6cbbdd5c81ea274731
Author:     Neil Roberts <[email protected]>
AuthorDate: Wed Feb 25 14:59:51 2026 +0100
Commit:     Mike Kaganski <[email protected]>
CommitDate: Wed Feb 25 17:30:14 2026 +0100

    XFunctionAccess: Write VOID in lower case in the documentation
    
    This makes it consistent with the rest of the documentation.
    
    Change-Id: Iebd0485b2dcf91e6648e88471dd010daa3bbacf9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200338
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/offapi/com/sun/star/sheet/XFunctionAccess.idl 
b/offapi/com/sun/star/sheet/XFunctionAccess.idl
index 5e6963acf54e..49781be0cf5b 100644
--- a/offapi/com/sun/star/sheet/XFunctionAccess.idl
+++ b/offapi/com/sun/star/sheet/XFunctionAccess.idl
@@ -72,7 +72,7 @@ published interface XFunctionAccess: 
com::sun::star::uno::XInterface
             Possible types for the result are:
 
             <dl>
-            <dt>`VOID`</dt>
+            <dt>`void`</dt>
             <dd>if no result is available.</dd>
 
             <dt>`double`</dt>
commit 74457edd5dc15761bbcb09dda810e61931f0adf1
Author:     Neil Roberts <[email protected]>
AuthorDate: Wed Feb 25 09:01:22 2026 +0100
Commit:     Mike Kaganski <[email protected]>
CommitDate: Wed Feb 25 17:30:04 2026 +0100

    [API CHANGE] tdf#168267: Allow missing args in FunctionAccess::callFunction
    
    If one of the entries in the arguments array for callFunction is a void
    type it will now be interpreted as a missing argument. This makes it
    possible to call calc functions where a missing argument is meaningful
    such as the “replacement” argument to REGEX().
    
    This is a minor API change because previously passing VOID would throw
    an IllegalArgumentException. It seems unlikely that anyone would have
    been relying on that though so I think the change is pretty harmless.
    
    Change-Id: Iaa4500300e9b4b88a7bdfdc153c67c42cd783525
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200287
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/offapi/com/sun/star/sheet/XFunctionAccess.idl 
b/offapi/com/sun/star/sheet/XFunctionAccess.idl
index 001bf5c0fe82..5e6963acf54e 100644
--- a/offapi/com/sun/star/sheet/XFunctionAccess.idl
+++ b/offapi/com/sun/star/sheet/XFunctionAccess.idl
@@ -45,6 +45,9 @@ published interface XFunctionAccess: 
com::sun::star::uno::XInterface
             <dt>`string`</dt>
             <dd>for a textual value.</dd>
 
+            <dt>`void`</dt>
+            <dd>to skip supplying a value for an optional argument. (since 
LibreOffice 26.8)</dd>
+
             <dt>`long[][]` or `double[][]`</dt>
             <dd>for an array of numeric values.</dd>
 
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 36c949241898..be5a614c7485 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -1126,6 +1126,28 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testVbaOnTime)
     CPPUNIT_ASSERT_EQUAL(42.0, pDoc->GetValue(0, 0, 0));
 }
 
+CPPUNIT_TEST_FIXTURE(ScMacrosTest, testMissingCallFunctionArgument)
+{
+    // tdf#168267: Test that we can pass void as an argument to 
FunctionAccess::callFunction in
+    // order to skip an argument.
+
+    Reference<css::lang::XMultiServiceFactory> xMSF = 
comphelper::getProcessServiceFactory();
+    css::uno::Reference<css::sheet::XFunctionAccess> xFunc(
+        xMSF->createInstance(u"com.sun.star.sheet.FunctionAccess"_ustr), 
UNO_QUERY_THROW);
+
+    css::uno::Any aRet
+        = xFunc->callFunction("REGEX", {
+                                           css::uno::Any(u"abcdeed§ba"_ustr),
+                                           css::uno::Any(u"d."_ustr),
+                                           css::uno::Any(), // void value for 
the replacement
+                                           css::uno::Any(2),
+                                       });
+
+    // The call to REGEX should return the matched string because the 
“replacement” parameter is
+    // missing
+    CPPUNIT_ASSERT_EQUAL(Any(u"d§"_ustr), aRet);
+}
+
 ScMacrosTest::ScMacrosTest()
       : ScModelTestBase(u"/sc/qa/extras/testdocuments"_ustr)
 {
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 52839c51c2f1..96bf71fdd890 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -561,6 +561,11 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const 
OUString& aName,
             rArg >>= aUStr;
             aTokenArr.AddString(rSPool.intern(aUStr));
         }
+        else if ( eClass == uno::TypeClass_VOID )
+        {
+            // Interpret the VOID type as a missing argument
+            aTokenArr.AddOpCode(ocMissing);
+        }
         else if ( aType.equals( cppu::UnoType<uno::Sequence< 
uno::Sequence<sal_Int16> >>::get() ) )
         {
             ArrayOfArrayProc<sal_Int16>::processSequences( pDoc, rArg, 
aTokenArr, nDocRow, bArgErr, bOverflow );

Reply via email to