Kaydet (Commit) 1899bd0c authored tarafından Kohei Yoshida's avatar Kohei Yoshida

fdo#77990: Intern strings for hybrid strings during import.

Change-Id: I269497cac645e486ac08bb2b011df1b5b23dc021
üst 639d33af
...@@ -338,7 +338,7 @@ public: ...@@ -338,7 +338,7 @@ public:
If for whatever reason you have to use both, SetHybridDouble() and If for whatever reason you have to use both, SetHybridDouble() and
SetHybridString() or SetHybridFormula(), use SetHybridDouble() first SetHybridString() or SetHybridFormula(), use SetHybridDouble() first
for performance reasons.*/ for performance reasons.*/
void SetHybridString( const OUString& r ); void SetHybridString( const svl::SharedString& r );
/** For import only: set a temporary formula string to be compiled later. /** For import only: set a temporary formula string to be compiled later.
If for whatever reason you have to use both, SetHybridDouble() and If for whatever reason you have to use both, SetHybridDouble() and
SetHybridString() or SetHybridFormula(), use SetHybridDouble() first SetHybridString() or SetHybridFormula(), use SetHybridDouble() first
......
...@@ -195,7 +195,7 @@ public: ...@@ -195,7 +195,7 @@ public:
/** Should only be used by import filters, best in the order /** Should only be used by import filters, best in the order
SetHybridDouble(), SetHybridString()/SetHybridFormula(), or only SetHybridDouble(), SetHybridString()/SetHybridFormula(), or only
SetHybridFormula() for formula string to be compiled later. */ SetHybridFormula() for formula string to be compiled later. */
SC_DLLPUBLIC void SetHybridString( const OUString & rStr ); SC_DLLPUBLIC void SetHybridString( const svl::SharedString & rStr );
/** Should only be used by import filters, best in the order /** Should only be used by import filters, best in the order
SetHybridDouble(), SetHybridString()/SetHybridFormula(), or only SetHybridDouble(), SetHybridString()/SetHybridFormula(), or only
......
...@@ -2084,7 +2084,7 @@ void ScFormulaCell::SetHybridDouble( double n ) ...@@ -2084,7 +2084,7 @@ void ScFormulaCell::SetHybridDouble( double n )
aResult.SetHybridDouble( n); aResult.SetHybridDouble( n);
} }
void ScFormulaCell::SetHybridString( const OUString& r ) void ScFormulaCell::SetHybridString( const svl::SharedString& r )
{ {
aResult.SetHybridString( r); aResult.SetHybridString( r);
} }
......
...@@ -518,7 +518,7 @@ void ScFormulaResult::SetHybridDouble( double f ) ...@@ -518,7 +518,7 @@ void ScFormulaResult::SetHybridDouble( double f )
} }
} }
void ScFormulaResult::SetHybridString( const OUString & rStr ) void ScFormulaResult::SetHybridString( const svl::SharedString& rStr )
{ {
// Obtain values before changing anything. // Obtain values before changing anything.
double f = GetDouble(); double f = GetDouble();
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "formula/token.hxx" #include "formula/token.hxx"
#include "tools/datetime.hxx" #include "tools/datetime.hxx"
#include <svl/sharedstringpool.hxx>
#include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/task/XStatusIndicator.hpp>
...@@ -305,7 +306,7 @@ void ScOrcusSheet::set_formula_result(os::row_t row, os::col_t col, const char* ...@@ -305,7 +306,7 @@ void ScOrcusSheet::set_formula_result(os::row_t row, os::col_t col, const char*
return; return;
} }
OUString aResult( p, n, RTL_TEXTENCODING_UTF8); OUString aResult( p, n, RTL_TEXTENCODING_UTF8);
pCell->SetHybridString(aResult); pCell->SetHybridString(mrDoc.getDoc().GetSharedStringPool().intern(aResult));
} }
void ScOrcusSheet::set_shared_formula( void ScOrcusSheet::set_shared_formula(
......
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
#include "editeng/langitem.hxx" #include "editeng/langitem.hxx"
#include <svx/unoapi.hxx> #include <svx/unoapi.hxx>
#include <svl/languageoptions.hxx> #include <svl/languageoptions.hxx>
#include <svl/sharedstringpool.hxx>
#include <svtools/miscopt.hxx> #include <svtools/miscopt.hxx>
#include <sax/tools/converter.hxx> #include <sax/tools/converter.hxx>
...@@ -1025,7 +1026,8 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const ...@@ -1025,7 +1026,8 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
{ {
if( !IsPossibleErrorString() ) if( !IsPossibleErrorString() )
{ {
pFCell->SetHybridString( *maStringValue ); ScDocument* pDoc = rXMLImport.GetDocument();
pFCell->SetHybridString(pDoc->GetSharedStringPool().intern(*maStringValue));
pFCell->ResetDirty(); pFCell->ResetDirty();
} }
} }
...@@ -1066,7 +1068,8 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos, ...@@ -1066,7 +1068,8 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos,
{ {
if (bDoIncrement && !IsPossibleErrorString()) if (bDoIncrement && !IsPossibleErrorString())
{ {
pFCell->SetHybridString( aCellString ); ScDocument* pDoc = rXMLImport.GetDocument();
pFCell->SetHybridString(pDoc->GetSharedStringPool().intern(aCellString));
pFCell->ResetDirty(); pFCell->ResetDirty();
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment