sc/inc/cellsuno.hxx                      |    4 ++--
 sc/source/filter/inc/sheetdatabuffer.hxx |    2 +-
 sc/source/filter/oox/sheetdatabuffer.cxx |    9 ++++-----
 3 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 277364ed05e0340ac0affbe7743e209d4d36c0a1
Author:     David Hashe <[email protected]>
AuthorDate: Thu May 8 18:22:38 2025 -0400
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu May 22 18:51:43 2025 +0200

    tdf#48140 Directly use ScCellRangeObj in finalizeArrayFormula
    
    No need to go through UNO.
    
    Test plan:
    
    $ make CppunitTest_sc_filters_test
    
    Additional manual testing:
    
    1. Create a fresh calc document.
    2. Enter in input line for A1: ={"Foo","Bar","Baz"}
    3. C-S-RET to evaluate and spill the array formula.
    4. Save document in .xlsx format.
    5. Reopen and verify that the array formula is correct.
    
    Change-Id: I07a865eece8f2a14820d82fea1fe4af66d20b231
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185073
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 4e65c6d3e790..6b109aa55000 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -514,7 +514,7 @@ public:
 
                             // XArrayFormulaTokens
     virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL 
getArrayTokens() override;
-    virtual void SAL_CALL   setArrayTokens( const css::uno::Sequence<
+    SC_DLLPUBLIC virtual void SAL_CALL   setArrayTokens( const 
css::uno::Sequence<
                                     css::sheet::FormulaToken >& aTokens ) 
override;
 
                             // XCellRangeData
@@ -660,7 +660,7 @@ public:
     static const SfxItemPropertyMap& GetCellPropertyMap();
 
                             ScCellObj(ScDocShell* pDocSh, const ScAddress& rP);
-    virtual                 ~ScCellObj() override;
+    SC_DLLPUBLIC virtual    ~ScCellObj() override;
 
     virtual void            RefChanged() override;
 
diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx 
b/sc/source/filter/inc/sheetdatabuffer.hxx
index cf3dd2eeed7b..23aa9bcad940 100644
--- a/sc/source/filter/inc/sheetdatabuffer.hxx
+++ b/sc/source/filter/inc/sheetdatabuffer.hxx
@@ -139,7 +139,7 @@ private:
     /** Inserts the passed array formula into the sheet. */
     void                finalizeArrayFormula(
                             const ScRange& rRange,
-                            const ApiTokenSequence& rTokens ) const;
+                            const ApiTokenSequence& rTokens );
     /** Inserts the passed table operation into the sheet. */
     void finalizeTableOperation(
         const ScRange& rRange, const DataTableModel& rModel );
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx 
b/sc/source/filter/oox/sheetdatabuffer.cxx
index 5fa7f268e43a..2f6511ca9ddb 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -48,6 +48,7 @@
 #include <formulabuffer.hxx>
 #include <numformat.hxx>
 #include <sax/tools/converter.hxx>
+#include <cellsuno.hxx>
 #include <docuno.hxx>
 
 namespace oox::xls {
@@ -631,12 +632,10 @@ ApiTokenSequence SheetDataBuffer::resolveSharedFormula( 
const ScAddress& rAddr )
     return aTokens;
 }
 
-void SheetDataBuffer::finalizeArrayFormula( const ScRange& rRange, const 
ApiTokenSequence& rTokens ) const
+void SheetDataBuffer::finalizeArrayFormula( const ScRange& rRange, const 
ApiTokenSequence& rTokens )
 {
-    Reference< XArrayFormulaTokens > xTokens( getCellRange( rRange ), 
UNO_QUERY );
-    OSL_ENSURE( xTokens.is(), "SheetDataBuffer::finalizeArrayFormula - missing 
formula token interface" );
-    if( xTokens.is() )
-        xTokens->setArrayTokens( rTokens );
+    rtl::Reference<ScCellRangeObj> rCellRangeObj(new 
ScCellRangeObj(getScDocument().GetDocumentShell(), rRange));
+    rCellRangeObj->setArrayTokens(rTokens);
 }
 
 void SheetDataBuffer::finalizeTableOperation( const ScRange& rRange, const 
DataTableModel& rModel )

Reply via email to