sc/inc/addincol.hxx              |    4 +++-
 sc/source/core/tool/addincol.cxx |    8 +++++---
 sc/source/core/tool/interpr4.cxx |    2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 32da7faefc6568bf07f27eedaae5488fdf68cb65
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Wed Sep 14 00:19:04 2022 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Sep 15 07:04:51 2022 +0200

    Resolves: tdf#150926 Add-In result svl::SharedString needs to be interned
    
    Change-Id: If582e7e1bf818dcf9eaddd5313aa21f5768a578f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139886
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit a56e5434a4ed453b55b8f060ed18404d77a9fb10)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139842
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sc/inc/addincol.hxx b/sc/inc/addincol.hxx
index 9366e31b68ff..05ceea273c91 100644
--- a/sc/inc/addincol.hxx
+++ b/sc/inc/addincol.hxx
@@ -42,6 +42,7 @@ namespace com::sun::star::uno { class XInterface; }
 class SfxObjectShell;
 class ScUnoAddInFuncData;
 class ScFuncDesc;
+class ScDocument;
 
 typedef std::unordered_map< OUString, const ScUnoAddInFuncData* > 
ScAddInHashMap;
 
@@ -188,6 +189,7 @@ private:
     css::uno::Sequence<css::uno::Any>         aArgs;
     css::uno::Sequence<css::uno::Any>         aVarArg;
     css::uno::Reference<css::uno::XInterface> xCaller;
+    ScDocument&                 mrDoc;
     bool                        bValidCount;
     // result:
     FormulaError                nErrCode;
@@ -201,7 +203,7 @@ private:
 
 public:
                     // exact name
-                    ScUnoAddInCall( ScUnoAddInCollection& rColl, const 
OUString& rName,
+                    ScUnoAddInCall( ScDocument& rDoc, ScUnoAddInCollection& 
rColl, const OUString& rName,
                                     tools::Long nParamCount );
                     ~ScUnoAddInCall();
 
diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx
index 126a0f915c7a..b0cadc33c89b 100644
--- a/sc/source/core/tool/addincol.cxx
+++ b/sc/source/core/tool/addincol.cxx
@@ -58,6 +58,7 @@
 #include <funcdesc.hxx>
 #include <svl/sharedstring.hxx>
 #include <formulaopt.hxx>
+#include <document.hxx>
 #include <memory>
 
 using namespace com::sun::star;
@@ -1228,8 +1229,9 @@ bool ScUnoAddInCollection::FillFunctionDescFromData( 
const ScUnoAddInFuncData& r
     return true;
 }
 
-ScUnoAddInCall::ScUnoAddInCall( ScUnoAddInCollection& rColl, const OUString& 
rName,
+ScUnoAddInCall::ScUnoAddInCall( ScDocument& rDoc, ScUnoAddInCollection& rColl, 
const OUString& rName,
                                 tools::Long nParamCount ) :
+    mrDoc( rDoc ),
     bValidCount( false ),
     nErrCode( FormulaError::NoCode ),      // before function was called
     bHasString( true ),
@@ -1582,13 +1584,13 @@ void ScUnoAddInCall::SetResult( const uno::Any& rNewRes 
)
                             for (sal_Int32 nCol=0; nCol<nColCount; nCol++)
                             {
                                 xMatrix->PutString(
-                                    svl::SharedString(pColArr[nCol]),
+                                    
mrDoc.GetSharedStringPool().intern(pColArr[nCol]),
                                     static_cast<SCSIZE>(nCol), 
static_cast<SCSIZE>(nRow));
                             }
                             for (sal_Int32 nCol=nColCount; nCol<nMaxColCount; 
nCol++)
                             {
                                 xMatrix->PutString(
-                                    svl::SharedString(OUString()),
+                                    svl::SharedString::getEmptyString(),
                                     static_cast<SCSIZE>(nCol), 
static_cast<SCSIZE>(nRow));
                             }
                         }
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 1a0eed81302f..f0dee4b21b63 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -2710,7 +2710,7 @@ void ScInterpreter::ScExternal()
         //  bLocalFirst=false in FindFunction, cFunc should be the stored
         //  internal name
 
-        ScUnoAddInCall aCall( *ScGlobal::GetAddInCollection(), aUnoName, 
nParamCount );
+        ScUnoAddInCall aCall( mrDoc, *ScGlobal::GetAddInCollection(), 
aUnoName, nParamCount );
 
         if ( !aCall.ValidParamCount() )
             SetError( FormulaError::IllegalParameter );

Reply via email to