sc/inc/document.hxx               |    4 +++-
 sc/source/core/data/document.cxx  |   15 +++++++++++----
 sc/source/filter/rtf/eeimpars.cxx |    8 ++------
 3 files changed, 16 insertions(+), 11 deletions(-)

New commits:
commit e695245b6256161a263722a67c551026a32a62c7
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Fri May 9 14:00:41 2025 +0200
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Fri May 9 15:46:01 2025 +0200

    tdf#117436 - Set text cell to accommodate potential multiline cells
    
    Set text cell to accommodate potential multline cells during the copy
    and paste process of a table from Base to Calc.
    
    Change-Id: I8032627aee8190b0956be80d64144dc4d7fb07e6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185092
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 50e0f09b9e28..da809f291e90 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1212,7 +1212,9 @@ public:
      * Call this if you are not sure whether to put this as an edit text or a
      * simple text.
      */
-    SC_DLLPUBLIC void SetTextCell( const ScAddress& rPos, const OUString& rStr 
);
+    SC_DLLPUBLIC void SetTextCell(const ScAddress& rPos, const OUString& rStr,
+                                  const ScSetStringParam* pParam = nullptr);
+
     void              SetEmptyCell( const ScAddress& rPos );
     SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const 
double& rVal );
     SC_DLLPUBLIC void SetValue( const ScAddress& rPos, double fVal );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 231a42d52a4e..a1d3cb27431f 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3502,7 +3502,9 @@ SCROW ScDocument::GetFirstEditTextRow( const ScRange& 
rRange ) const
     return -1;
 }
 
-void ScDocument::SetTextCell( const ScAddress& rPos, const OUString& rStr )
+
+void ScDocument::SetTextCell(const ScAddress& rPos, const OUString& rStr,
+                             const ScSetStringParam* pParam)
 {
     if (ScTable* pTable = FetchTable(rPos.Tab()))
     {
@@ -3514,9 +3516,14 @@ void ScDocument::SetTextCell( const ScAddress& rPos, 
const OUString& rStr )
         }
         else
         {
-            ScSetStringParam aParam;
-            aParam.setTextInput();
-            pTable->SetString(rPos.Col(), rPos.Row(), rPos.Tab(), rStr, 
&aParam);
+            if (pParam)
+                pTable->SetString(rPos.Col(), rPos.Row(), rPos.Tab(), rStr, 
pParam);
+            else
+            {
+                ScSetStringParam aParam;
+                aParam.setTextInput();
+                pTable->SetString(rPos.Col(), rPos.Row(), rPos.Tab(), rStr, 
&aParam);
+            }
         }
     }
 }
diff --git a/sc/source/filter/rtf/eeimpars.cxx 
b/sc/source/filter/rtf/eeimpars.cxx
index 8b5b5b58dfb9..f7db07b14ff9 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -397,11 +397,6 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, 
double nOutputFactor, SvNu
                         pFormatter->ChangeIntl( LANGUAGE_SYSTEM);
                     }
 
-                    //  #105460#, #i4180# String cells can't contain tabs or 
linebreaks
-                    //  -> replace with spaces
-                    aStr = aStr.replaceAll( "  ", " " );
-                    aStr = aStr.replaceAll( "
", " " );
-
                     if (bTextFormat)
                     {
                         aParam.mbDetectNumberFormat = false;
@@ -414,7 +409,8 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, 
double nOutputFactor, SvNu
                         aParam.mbDetectScientificNumberFormat = 
bConvertScientific;
                     }
 
-                    mpDoc->SetString(nCol, nRow, nTab, aStr, &aParam);
+                    // tdf#117436 - set text cell to accommodate potential 
multiline cells
+                    mpDoc->SetTextCell(ScAddress(nCol, nRow, nTab), aStr, 
&aParam);
                 }
             }
             else if (std::unique_ptr<EditTextObject> pTextObject = 
IsValidSel(*mpEngine, pE->aSel) ? mpEngine->CreateTextObject(pE->aSel) : 
nullptr)

Reply via email to