sc/inc/cellform.hxx | 5 - sc/inc/cellvalue.hxx | 11 ++- sc/inc/chgtrack.hxx | 7 + sc/inc/editutil.hxx | 13 ++- sc/inc/global.hxx | 7 + sc/qa/unit/subsequent_filters-test.cxx | 9 ++ sc/source/core/data/cellvalue.cxx | 4 - sc/source/core/data/column2.cxx | 8 +- sc/source/core/data/column3.cxx | 12 +-- sc/source/core/data/conditio.cxx | 9 +- sc/source/core/data/dociter.cxx | 8 +- sc/source/core/data/document.cxx | 2 sc/source/core/data/global.cxx | 16 ++++ sc/source/core/data/table3.cxx | 2 sc/source/core/data/validat.cxx | 2 sc/source/core/tool/cellform.cxx | 10 +- sc/source/core/tool/chgtrack.cxx | 22 +++--- sc/source/core/tool/editutil.cxx | 61 +++++++++++------ sc/source/core/tool/interpr4.cxx | 10 +- sc/source/core/tool/rangeseq.cxx | 2 sc/source/filter/dif/difexp.cxx | 2 sc/source/filter/html/htmlexp.cxx | 2 sc/source/filter/xcl97/XclExpChangeTrack.cxx | 2 sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx | 8 +- sc/source/ui/docshell/docsh.cxx | 4 - sc/source/ui/docshell/docsh3.cxx | 4 - sc/source/ui/docshell/externalrefmgr.cxx | 4 - sc/source/ui/miscdlgs/acredlin.cxx | 4 - sc/source/ui/unoobj/cellsuno.cxx | 4 - sc/source/ui/view/output2.cxx | 3 30 files changed, 167 insertions(+), 90 deletions(-)
New commits: commit 8a42cb382fc1fff6ed0c57b33762080cdc0bd5a4 Author: Eike Rathke <er...@redhat.com> Date: Thu Jul 25 15:33:49 2013 +0200 resolved fdo#67249 use ScFieldEditEngine to resolve field content ScEditUtil::GetString() iterated over the paragraphs of an EditTextObject where GetText() does not resolve field content but returns the embedded field markers. To resolve field content an ScFieldEditEngine is needed. This makes it necessary to pass an ScDocument* to obtain the ScFieldEditEngine from, or for cases where there is no ScDocument in the context use a static ScFieldEditEngine which unfortunately is not capable of resolving document specific fields of course, such as DOCINFO_TITLE and TABLE. Also added unit test. (cherry picked from commit 1ecdc7aaf661e97a33cf521f553481d79cd26de2) Conflicts: sc/qa/unit/subsequent_filters-test.cxx sc/qa/unit/ucalc.cxx sc/source/core/data/column.cxx sc/source/core/data/column2.cxx sc/source/core/data/column3.cxx sc/source/core/data/dociter.cxx sc/source/core/data/table3.cxx sc/source/core/data/table4.cxx Change-Id: Ife3c23b2fec2514b32303239d276c49869786eb5 Reviewed-on: https://gerrit.libreoffice.org/5106 Reviewed-by: Kohei Yoshida <kohei.yosh...@suse.de> Tested-by: Kohei Yoshida <kohei.yosh...@suse.de> diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx index 87181ca..a2369b7 100644 --- a/sc/inc/cellform.hxx +++ b/sc/inc/cellform.hxx @@ -43,7 +43,7 @@ public: static void GetString( ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString, - Color** ppColor, SvNumberFormatter& rFormatter, bool bNullVals = true, + Color** ppColor, SvNumberFormatter& rFormatter, const ScDocument* pDoc, bool bNullVals = true, bool bFormula = false, ScForceTextFmt eForceTextFmt = ftDontForce, bool bUseStarFormat = false ); @@ -53,7 +53,8 @@ public: bool bFormula = false, ScForceTextFmt eForceTextFmt = ftDontForce, bool bUseStarFormat = false ); static void GetInputString( - ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString, SvNumberFormatter& rFormatter ); + ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString, SvNumberFormatter& rFormatter, + const ScDocument* pDoc ); }; diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx index fb7c175..bdb483e 100644 --- a/sc/inc/cellvalue.hxx +++ b/sc/inc/cellvalue.hxx @@ -126,7 +126,16 @@ struct SC_DLLPUBLIC ScRefCellValue double getValue(); - OUString getString(); + /** Retrieve string value. + + @param pDoc + Needed to resolve EditCells' field contents, obtain a + ScFieldEditEngine from that document. May be NULL if there is + no ScDocument in the calling context but then the document + specific fields can not be resolved. See + ScEditUtil::GetString(). + */ + OUString getString( const ScDocument* pDoc ); bool isEmpty() const; diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx index aef13cf..872f268 100644 --- a/sc/inc/chgtrack.hxx +++ b/sc/inc/chgtrack.hxx @@ -702,7 +702,8 @@ class ScChangeActionContent : public ScChangeAction void SetValueString( OUString& rValue, ScCellValue& rCell, const OUString& rStr, ScDocument* pDoc ); - void GetValueString( OUString& rStr, const OUString& rValue, const ScCellValue& rCell ) const; + void GetValueString( OUString& rStr, const OUString& rValue, const ScCellValue& rCell, + const ScDocument* pDoc ) const; void GetFormulaString( OUString& rStr, const ScFormulaCell* pCell ) const; @@ -788,8 +789,8 @@ public: // assigns string / creates forumula cell void SetOldValue( const OUString& rOld, ScDocument* pDoc ); - void GetOldString( OUString& rStr ) const; - void GetNewString( OUString& rStr ) const; + void GetOldString( OUString& rStr, const ScDocument* pDoc ) const; + void GetNewString( OUString& rStr, const ScDocument* pDoc ) const; SC_DLLPUBLIC const ScCellValue& GetOldCell() const; SC_DLLPUBLIC const ScCellValue& GetNewCell() const; virtual void GetDescription( diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx index c033415..f27bbf8 100644 --- a/sc/inc/editutil.hxx +++ b/sc/inc/editutil.hxx @@ -54,12 +54,19 @@ public: static String ModifyDelimiters( const String& rOld ); /// Retrieves string with paragraphs delimited by spaces - static String GetSpaceDelimitedString( const EditEngine& rEngine ); + static OUString GetSpaceDelimitedString( const EditEngine& rEngine ); /// Retrieves string with paragraphs delimited by new lines ('\n'). - static String GetMultilineString( const EditEngine& rEngine ); + static OUString GetMultilineString( const EditEngine& rEngine ); - SC_DLLPUBLIC static OUString GetString( const EditTextObject& rEditText ); + /** Retrieves string with paragraphs delimited by new lines ('\n'). + + @param pDoc + If not NULL, use pDoc->GetEditEngine() to retrieve field content. + If NULL, a static mutex-guarded ScFieldEditEngine is used that + is not capable of resolving document specific fields; avoid. + */ + SC_DLLPUBLIC static OUString GetString( const EditTextObject& rEditText, const ScDocument* pDoc ); static EditTextObject* CreateURLObjectFromURL( ScDocument& rDoc, const OUString& rURL, const OUString& rText ); diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index f823232..476f0ba 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -488,6 +488,7 @@ class CalendarWrapper; class CollatorWrapper; class IntlWrapper; class OutputDevice; +class ScFieldEditEngine; namespace com { namespace sun { namespace star { namespace lang { @@ -537,6 +538,8 @@ class ScGlobal static IntlWrapper* pScIntlWrapper; static ::com::sun::star::lang::Locale* pLocale; + static ScFieldEditEngine* pFieldEditEngine; + public: static SvtSysLocale* pSysLocale; // for faster access a pointer to the single instance provided by SvtSysLocale @@ -696,6 +699,10 @@ SC_DLLPUBLIC static const sal_Unicode* FindUnquoted( const sal_Unicode* pStri /** Obtain the ordinal suffix for a number according to the system locale */ static String GetOrdinalSuffix( sal_Int32 nNumber); + + /** A static instance of ScFieldEditEngine not capable of resolving + document specific fields, to be used only by ScEditUtil::GetString(). */ + static ScFieldEditEngine& GetStaticFieldEditEngine(); }; #endif diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 219b2ca..19147b7 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -40,6 +40,7 @@ #include "docfunc.hxx" #include "markdata.hxx" #include "colorscale.hxx" +#include "editutil.hxx" #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/drawing/XControlShape.hpp> @@ -1610,6 +1611,8 @@ void ScFiltersTest::testRichTextContentODS() aParaText = pEditText->GetText(0); CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.indexOf("Sheet name is ") == 0); CPPUNIT_ASSERT_MESSAGE("Sheet name field item not found.", pEditText->HasField(text::textfield::Type::TABLE)); + CPPUNIT_ASSERT_EQUAL(OUString("Sheet name is Test."), ScEditUtil::GetString(*pEditText, pDoc)); + CPPUNIT_ASSERT_EQUAL(OUString("Sheet name is ?."), ScEditUtil::GetString(*pEditText, NULL)); // Cell with URL field item. aPos.IncRow(); @@ -1620,6 +1623,8 @@ void ScFiltersTest::testRichTextContentODS() aParaText = pEditText->GetText(0); CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.indexOf("URL: ") == 0); CPPUNIT_ASSERT_MESSAGE("URL field item not found.", pEditText->HasField(text::textfield::Type::URL)); + CPPUNIT_ASSERT_EQUAL(OUString("URL: http://libreoffice.org"), ScEditUtil::GetString(*pEditText, pDoc)); + CPPUNIT_ASSERT_EQUAL(OUString("URL: http://libreoffice.org"), ScEditUtil::GetString(*pEditText, NULL)); // Cell with Date field item. aPos.IncRow(); @@ -1630,6 +1635,8 @@ void ScFiltersTest::testRichTextContentODS() aParaText = pEditText->GetText(0); CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.indexOf("Date: ") == 0); CPPUNIT_ASSERT_MESSAGE("Date field item not found.", pEditText->HasField(text::textfield::Type::DATE)); + CPPUNIT_ASSERT_MESSAGE("Date field not resolved with pDoc.", ScEditUtil::GetString(*pEditText, pDoc).indexOf("/20") > 0); + CPPUNIT_ASSERT_MESSAGE("Date field not resolved with NULL.", ScEditUtil::GetString(*pEditText, NULL).indexOf("/20") > 0); // Cell with DocInfo title field item. aPos.IncRow(); @@ -1640,6 +1647,8 @@ void ScFiltersTest::testRichTextContentODS() aParaText = pEditText->GetText(0); CPPUNIT_ASSERT_MESSAGE("Unexpected text.", aParaText.indexOf("Title: ") == 0); CPPUNIT_ASSERT_MESSAGE("DocInfo title field item not found.", pEditText->HasField(text::textfield::Type::DOCINFO_TITLE)); + CPPUNIT_ASSERT_EQUAL(OUString("Title: Test Document"), ScEditUtil::GetString(*pEditText, pDoc)); + CPPUNIT_ASSERT_EQUAL(OUString("Title: ?"), ScEditUtil::GetString(*pEditText, NULL)); // Cell with sentence with both bold and italic sequences. aPos.IncRow(); diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx index 75362ba..78683e6 100644 --- a/sc/source/core/data/cellvalue.cxx +++ b/sc/source/core/data/cellvalue.cxx @@ -476,7 +476,7 @@ double ScRefCellValue::getValue() return 0.0; } -OUString ScRefCellValue::getString() +OUString ScRefCellValue::getString( const ScDocument* pDoc ) { switch (meType) { @@ -484,7 +484,7 @@ OUString ScRefCellValue::getString() return *mpString; case CELLTYPE_EDIT: if (mpEditText) - return ScEditUtil::GetString(*mpEditText); + return ScEditUtil::GetString(*mpEditText, pDoc); break; case CELLTYPE_FORMULA: return mpFormula->GetString(); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index efb3a6a..31605b6 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -248,7 +248,7 @@ long ScColumn::GetNeededSize( Color* pColor; OUString aValStr; ScCellFormat::GetString( - aCell, nFormat, aValStr, &pColor, *pFormatter, true, rOptions.bFormula, ftCheck); + aCell, nFormat, aValStr, &pColor, *pFormatter, pDocument, true, rOptions.bFormula, ftCheck); if (!aValStr.isEmpty()) { @@ -410,7 +410,7 @@ long ScColumn::GetNeededSize( Color* pColor; OUString aString; ScCellFormat::GetString( - aCell, nFormat, aString, &pColor, *pFormatter, true, + aCell, nFormat, aString, &pColor, *pFormatter, pDocument, true, rOptions.bFormula, ftCheck); if (!aString.isEmpty()) @@ -569,7 +569,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth( { ScRefCellValue aCell = GetCellValue(pParam->mnMaxTextRow); ScCellFormat::GetString( - aCell, nFormat, aLongStr, &pColor, *pFormatter, true, false, ftCheck); + aCell, nFormat, aLongStr, &pColor, *pFormatter, pDocument, true, false, ftCheck); } else { @@ -584,7 +584,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth( aCell.assign(*maItems[nIndex].pCell); OUString aValStr; ScCellFormat::GetString( - aCell, nFormat, aValStr, &pColor, *pFormatter, true, false, ftCheck); + aCell, nFormat, aValStr, &pColor, *pFormatter, pDocument, true, false, ftCheck); if (aValStr.getLength() > nLongLen) { diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index f36dbd0..4c688ef 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -306,7 +306,7 @@ void ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow ) OUString aStr; Color* pColor; sal_uLong nFormat = pPattern->GetNumberFormat(pFormatter, pCondSet); - ScCellFormat::GetString(aCell, nFormat, aStr, &pColor, *pFormatter); + ScCellFormat::GetString(aCell, nFormat, aStr, &pColor, *pFormatter, pDocument); // Store the real script type to the array. rAttr.mnScriptType = pDocument->GetStringScriptType(aStr); @@ -1491,7 +1491,7 @@ void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, std::vector<ScTy aCell.assign(*maItems[nIndex].pCell); sal_uLong nFormat = GetNumberFormat( nRow ); - ScCellFormat::GetInputString(aCell, nFormat, aString, *pFormatter); + ScCellFormat::GetInputString(aCell, nFormat, aString, *pFormatter, pDocument); if ( pDocument->HasStringData( nCol, nRow, nTab ) ) { @@ -1711,7 +1711,7 @@ void ScColumn::GetString( SCROW nRow, OUString& rString ) const aCell.mpFormula->MaybeInterpret(); sal_uLong nFormat = GetNumberFormat( nRow ); - ScCellFormat::GetString(aCell, nFormat, rString, &pColor, *(pDocument->GetFormatTable())); + ScCellFormat::GetString(aCell, nFormat, rString, &pColor, *(pDocument->GetFormatTable()), pDocument); } else rString = EMPTY_OUSTRING; @@ -1751,7 +1751,7 @@ void ScColumn::GetInputString( SCROW nRow, OUString& rString ) const ScRefCellValue aCell; aCell.assign(*maItems[nIndex].pCell); sal_uLong nFormat = GetNumberFormat( nRow ); - ScCellFormat::GetInputString(aCell, nFormat, rString, *(pDocument->GetFormatTable())); + ScCellFormat::GetInputString(aCell, nFormat, rString, *(pDocument->GetFormatTable()), pDocument); } else rString = OUString(); @@ -1929,7 +1929,7 @@ sal_Int32 ScColumn::GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, CharSet eCh Color* pColor; sal_uLong nFormat = (sal_uLong) ((SfxUInt32Item*) GetAttr( nRow, ATTR_VALUE_FORMAT ))->GetValue(); - ScCellFormat::GetString(aCell, nFormat, aString, &pColor, *pNumFmt); + ScCellFormat::GetString(aCell, nFormat, aString, &pColor, *pNumFmt, pDocument); sal_Int32 nLen; if (bIsOctetTextEncoding) { @@ -1981,7 +1981,7 @@ xub_StrLen ScColumn::GetMaxNumberStringLen( { sal_uLong nFormat = (sal_uLong) ((SfxUInt32Item*) GetAttr( nRow, ATTR_VALUE_FORMAT ))->GetValue(); - ScCellFormat::GetInputString(aCell, nFormat, aString, *pNumFmt); + ScCellFormat::GetInputString(aCell, nFormat, aString, *pNumFmt, pDocument); xub_StrLen nLen = aString.getLength(); if ( nLen ) { diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 88028cf..ab1adc0 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -734,7 +734,8 @@ void ScConditionEntry::Interpret( const ScAddress& rPos ) bFirstRun = false; } -static bool lcl_GetCellContent( ScRefCellValue& rCell, bool bIsStr1, double& rArg, OUString& rArgStr ) +static bool lcl_GetCellContent( ScRefCellValue& rCell, bool bIsStr1, double& rArg, OUString& rArgStr, + const ScDocument* pDoc ) { if (rCell.isEmpty()) @@ -762,7 +763,7 @@ static bool lcl_GetCellContent( ScRefCellValue& rCell, bool bIsStr1, double& rAr if (rCell.meType == CELLTYPE_STRING) rArgStr = *rCell.mpString; else if (rCell.mpEditText) - rArgStr = ScEditUtil::GetString(*rCell.mpEditText); + rArgStr = ScEditUtil::GetString(*rCell.mpEditText, pDoc); break; default: ; @@ -806,7 +807,7 @@ void ScConditionEntry::FillCache() const double nVal = 0.0; OUString aStr; - if (!lcl_GetCellContent(aCell, false, nVal, aStr)) + if (!lcl_GetCellContent(aCell, false, nVal, aStr, mpDoc)) { std::pair<ScConditionEntryCache::StringCacheType::iterator, bool> aResult = mpCache->maStrings.insert( @@ -1270,7 +1271,7 @@ bool ScConditionEntry::IsCellValid( ScRefCellValue& rCell, const ScAddress& rPos double nArg = 0.0; OUString aArgStr; - bool bVal = lcl_GetCellContent( rCell, bIsStr1, nArg, aArgStr ); + bool bVal = lcl_GetCellContent( rCell, bIsStr1, nArg, aArgStr, mpDoc ); if (bVal) return IsValid( nArg, rPos ); else diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 8f6d1c2..f8ba16f 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1040,7 +1040,7 @@ CellType ScCellIterator::getType() const OUString ScCellIterator::getString() { - return maCurCell.getString(); + return maCurCell.getString(mpDoc); } const EditTextObject* ScCellIterator::getEditText() const @@ -1478,7 +1478,7 @@ ScBaseCell* ScQueryCellIterator::BinarySearch() OUString aCellStr; sal_uLong nFormat = pCol->GetNumberFormat( pCol->maItems[nLo].nRow); aCell.assign(*pCol->maItems[nLo].pCell); - ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter); + ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc); sal_Int32 nTmp = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString); if ((rEntry.eOp == SC_LESS_EQUAL && nTmp > 0) || (rEntry.eOp == SC_GREATER_EQUAL && nTmp < 0) || @@ -1508,7 +1508,7 @@ ScBaseCell* ScQueryCellIterator::BinarySearch() { sal_uLong nFormat = pCol->GetNumberFormat( pCol->maItems[nLastInRange].nRow); OUString aStr; - ScCellFormat::GetInputString(aCell, nFormat, aStr, rFormatter); + ScCellFormat::GetInputString(aCell, nFormat, aStr, rFormatter, pDoc); aLastInRangeString = aStr; } else @@ -1609,7 +1609,7 @@ ScBaseCell* ScQueryCellIterator::BinarySearch() OUString aCellStr; sal_uLong nFormat = pCol->GetNumberFormat( pCol->maItems[i].nRow); aCell.assign(*pCol->maItems[i].pCell); - ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter); + ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc); nRes = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString); if (nRes < 0 && bLessEqual) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index e631307..4933e5d 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3194,7 +3194,7 @@ sal_uInt16 ScDocument::GetStringForFormula( const ScAddress& rPos, OUString& rSt { case CELLTYPE_STRING: case CELLTYPE_EDIT: - aStr = aCell.getString(); + aStr = aCell.getString(this); break; case CELLTYPE_FORMULA: { diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 95084a9..8c05b6a 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -77,6 +77,7 @@ #include "scmod.hxx" #include "appoptio.hxx" #include "random.hxx" +#include "editutil.hxx" // ----------------------------------------------------------------------- @@ -117,6 +118,7 @@ ScFunctionMgr* ScGlobal::pStarCalcFunctionMgr = NULL; ScUnitConverter* ScGlobal::pUnitConverter = NULL; SvNumberFormatter* ScGlobal::pEnglishFormatter = NULL; +ScFieldEditEngine* ScGlobal::pFieldEditEngine = NULL; double ScGlobal::nScreenPPTX = 96.0; double ScGlobal::nScreenPPTY = 96.0; @@ -679,6 +681,7 @@ void ScGlobal::Clear() DELETEZ(pStrClipDocName); DELETEZ(pUnitConverter); + DELETEZ(pFieldEditEngine); ScDocumentPool::DeleteVersionMaps(); @@ -1190,4 +1193,17 @@ IntlWrapper* ScGlobal::GetScIntlWrapper() return pLocale; } +ScFieldEditEngine& ScGlobal::GetStaticFieldEditEngine() +{ + if (!pFieldEditEngine) + { + // Creating a ScFieldEditEngine with pDocument=NULL leads to document + // specific fields not being resolvable! See + // ScFieldEditEngine::CalcFieldValue(). pEnginePool=NULL lets + // EditEngine internally create and delete a default pool. + pFieldEditEngine = new ScFieldEditEngine( NULL, NULL); + } + return *pFieldEditEngine; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index d1ef841f..b61be80 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1364,7 +1364,7 @@ public: sal_uLong nFormat = mrTab.GetNumberFormat( static_cast<SCCOL>(rEntry.nField), nRow ); ScRefCellValue aCell; aCell.assign(*pCell); - ScCellFormat::GetInputString(aCell, nFormat, aCellStr, *mrDoc.GetFormatTable()); + ScCellFormat::GetInputString(aCell, nFormat, aCellStr, *mrDoc.GetFormatTable(), &mrDoc); } } else diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 258e7e0..56902f8 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -492,7 +492,7 @@ bool ScValidationData::IsDataValid( ScRefCellValue& rCell, const ScAddress& rPos break; case CELLTYPE_EDIT: if (rCell.mpEditText) - aString = ScEditUtil::GetString(*rCell.mpEditText); + aString = ScEditUtil::GetString(*rCell.mpEditText, GetDocument()); bIsVal = false; break; case CELLTYPE_FORMULA: diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx index a33405f..bc65f91 100644 --- a/sc/source/core/tool/cellform.cxx +++ b/sc/source/core/tool/cellform.cxx @@ -34,14 +34,14 @@ const ScFormulaCell* pLastFormulaTreeTop = 0; void ScCellFormat::GetString( ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString, - Color** ppColor, SvNumberFormatter& rFormatter, + Color** ppColor, SvNumberFormatter& rFormatter, const ScDocument* pDoc, bool bNullVals, bool bFormula, ScForceTextFmt eForceTextFmt, bool bUseStarFormat ) { *ppColor = NULL; if (&rFormatter==NULL) { - rString = OUString(); + rString = EMPTY_OUSTRING; return; } @@ -51,7 +51,7 @@ void ScCellFormat::GetString( ScRefCellValue& rCell, sal_uLong nFormat, OUString rFormatter.GetOutputString(*rCell.mpString, nFormat, rString, ppColor, bUseStarFormat); break; case CELLTYPE_EDIT: - rFormatter.GetOutputString(rCell.getString(), nFormat, rString, ppColor ); + rFormatter.GetOutputString(rCell.getString(pDoc), nFormat, rString, ppColor ); break; case CELLTYPE_VALUE: { @@ -223,7 +223,7 @@ OUString ScCellFormat::GetString( } void ScCellFormat::GetInputString( - ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString, SvNumberFormatter& rFormatter ) + ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString, SvNumberFormatter& rFormatter, const ScDocument* pDoc ) { if (&rFormatter == NULL) { @@ -236,7 +236,7 @@ void ScCellFormat::GetInputString( { case CELLTYPE_STRING: case CELLTYPE_EDIT: - aString = rCell.getString(); + aString = rCell.getString(pDoc); break; case CELLTYPE_VALUE: rFormatter.GetInputLineString(rCell.mfValue, nFormat, aString ); diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 903d06b..5355df4 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -1501,15 +1501,15 @@ void ScChangeActionContent::SetOldValue( const OUString& rOld, ScDocument* pDoc } -void ScChangeActionContent::GetOldString( OUString& rStr ) const +void ScChangeActionContent::GetOldString( OUString& rStr, const ScDocument* pDoc ) const { - GetValueString(rStr, maOldValue, maOldCell); + GetValueString(rStr, maOldValue, maOldCell, pDoc); } -void ScChangeActionContent::GetNewString( OUString& rStr ) const +void ScChangeActionContent::GetNewString( OUString& rStr, const ScDocument* pDoc ) const { - GetValueString(rStr, maNewValue, maNewCell); + GetValueString(rStr, maNewValue, maNewCell, pDoc); } const ScCellValue& ScChangeActionContent::GetOldCell() const @@ -1540,7 +1540,7 @@ void ScChangeActionContent::GetDescription( nPos += aTmpStr.getLength(); } - GetOldString( aTmpStr ); + GetOldString( aTmpStr, pDoc ); if (aTmpStr.isEmpty()) aTmpStr = ScGlobal::GetRscString( STR_CHANGED_BLANK ); @@ -1551,7 +1551,7 @@ void ScChangeActionContent::GetDescription( nPos += aTmpStr.getLength(); } - GetNewString( aTmpStr ); + GetNewString( aTmpStr, pDoc ); if (aTmpStr.isEmpty()) aTmpStr = ScGlobal::GetRscString( STR_CHANGED_BLANK ); @@ -1715,7 +1715,7 @@ void ScChangeActionContent::GetStringOfCell( break; case CELLTYPE_EDIT: if (rCell.mpEditText) - rStr = ScEditUtil::GetString(*rCell.mpEditText); + rStr = ScEditUtil::GetString(*rCell.mpEditText, pDoc); break; case CELLTYPE_FORMULA: rCell.mpFormula->GetFormula(rStr); @@ -1850,7 +1850,7 @@ void ScChangeActionContent::SetCell( OUString& rStr, ScCellValue& rCell, sal_uLo void ScChangeActionContent::GetValueString( - OUString& rStr, const OUString& rValue, const ScCellValue& rCell ) const + OUString& rStr, const OUString& rValue, const ScCellValue& rCell, const ScDocument* pDoc ) const { if (!rValue.isEmpty()) { @@ -1865,7 +1865,7 @@ void ScChangeActionContent::GetValueString( break; case CELLTYPE_EDIT : if (rCell.mpEditText) - rStr = ScEditUtil::GetString(*rCell.mpEditText); + rStr = ScEditUtil::GetString(*rCell.mpEditText, pDoc); break; case CELLTYPE_VALUE : // ist immer in rValue rStr = rValue; @@ -4578,7 +4578,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const ScCellValue aClonedNewCell; aClonedNewCell.assign(rNewCell, *pDocument); OUString aNewValue; - pContent->GetNewString( aNewValue ); + pContent->GetNewString( aNewValue, pDocument ); pClonedTrack->nGeneratedMin = pGenerated->GetActionNumber() + 1; pClonedTrack->AddLoadedGenerated(aClonedNewCell, pGenerated->GetBigRange(), aNewValue); } @@ -4663,7 +4663,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const ScCellValue aClonedOldCell; aClonedOldCell.assign(rOldCell, *pDocument); OUString aOldValue; - pContent->GetOldString( aOldValue ); + pContent->GetOldString( aOldValue, pDocument ); ScChangeActionContent* pClonedContent = new ScChangeActionContent( pAction->GetActionNumber(), diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index a004d86..dc6f6a1 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -68,40 +68,49 @@ String ScEditUtil::ModifyDelimiters( const String& rOld ) return aRet; } -static String lcl_GetDelimitedString( const EditEngine& rEngine, const sal_Char c ) +static OUString lcl_GetDelimitedString( const EditEngine& rEngine, const sal_Char c ) { - String aRet; sal_Int32 nParCount = rEngine.GetParagraphCount(); + OUStringBuffer aRet( nParCount * 80 ); for (sal_Int32 nPar=0; nPar<nParCount; nPar++) { if (nPar > 0) - aRet += c; - aRet += rEngine.GetText( nPar ); + aRet.append(c); + aRet.append( rEngine.GetText( nPar )); } - return aRet; + return aRet.makeStringAndClear(); } -String ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine ) +OUString ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine ) { return lcl_GetDelimitedString(rEngine, ' '); } -String ScEditUtil::GetMultilineString( const EditEngine& rEngine ) +OUString ScEditUtil::GetMultilineString( const EditEngine& rEngine ) { return lcl_GetDelimitedString(rEngine, '\n'); } -OUString ScEditUtil::GetString( const EditTextObject& rEditText ) +OUString ScEditUtil::GetString( const EditTextObject& rEditText, const ScDocument* pDoc ) { - OUStringBuffer aRet; - sal_Int32 n = rEditText.GetParagraphCount(); - for (sal_Int32 i = 0; i < n; ++i) + // ScFieldEditEngine is needed to resolve field contents. + if (pDoc) { - if (i > 0) - aRet.append('\n'); - aRet.append(rEditText.GetText(i)); + /* TODO: make ScDocument::GetEditEngine() const? Most likely it's only + * not const because of the pointer assignment, make that mutable, and + * then remove the ugly const_cast here. */ + EditEngine& rEE = const_cast<ScDocument*>(pDoc)->GetEditEngine(); + rEE.SetText( rEditText); + return GetMultilineString( rEE); + } + else + { + static osl::Mutex aMutex; + osl::MutexGuard aGuard( aMutex); + EditEngine& rEE = ScGlobal::GetStaticFieldEditEngine(); + rEE.SetText( rEditText); + return GetMultilineString( rEE); } - return aRet.makeStringAndClear(); } EditTextObject* ScEditUtil::CreateURLObjectFromURL( ScDocument& rDoc, const OUString& rURL, const OUString& rText ) @@ -791,6 +800,12 @@ OUString ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField, const SvxExtTimeField* pField = static_cast<const SvxExtTimeField*>(pFieldData); if (mpDoc) aRet = pField->GetFormatted(*mpDoc->GetFormatTable(), ScGlobal::eLnge); + else + { + /* TODO: quite expensive, we could have a global formatter? */ + SvNumberFormatter aFormatter( comphelper::getProcessComponentContext(), ScGlobal::eLnge ); + aRet = pField->GetFormatted( aFormatter, ScGlobal::eLnge); + } } break; case text::textfield::Type::DATE: @@ -801,10 +816,18 @@ OUString ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField, break; case text::textfield::Type::DOCINFO_TITLE: { - SfxObjectShell* pDocShell = mpDoc->GetDocumentShell(); - aRet = pDocShell->getDocProperties()->getTitle(); + if (mpDoc) + { + SfxObjectShell* pDocShell = mpDoc->GetDocumentShell(); + if (pDocShell) + { + aRet = pDocShell->getDocProperties()->getTitle(); + if (aRet.isEmpty()) + aRet = pDocShell->GetTitle(); + } + } if (aRet.isEmpty()) - aRet = pDocShell->GetTitle(); + aRet = "?"; } break; case text::textfield::Type::TABLE: @@ -812,7 +835,7 @@ OUString ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField, const SvxTableField* pField = static_cast<const SvxTableField*>(pFieldData); SCTAB nTab = pField->GetTab(); OUString aName; - if (mpDoc->GetName(nTab, aName)) + if (mpDoc && mpDoc->GetName(nTab, aName)) aRet = aName; else aRet = "?"; diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 5662baf..4c6a8db 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -491,7 +491,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, ScRefCellValue& { // SUM(A1:A2) differs from A1+A2. No good. But people insist on // it ... #i5658# - OUString aStr = rCell.getString(); + OUString aStr = rCell.getString(pDok); fValue = ConvertStringToValue( aStr ); } break; @@ -517,7 +517,7 @@ void ScInterpreter::GetCellString( OUString& rStr, ScRefCellValue& rCell ) { case CELLTYPE_STRING: case CELLTYPE_EDIT: - rStr = rCell.getString(); + rStr = rCell.getString(pDok); break; case CELLTYPE_FORMULA: { @@ -683,7 +683,7 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, { case CELLTYPE_STRING: case CELLTYPE_EDIT: - aStr = aCell.getString(); + aStr = aCell.getString(pDok); break; case CELLTYPE_FORMULA: if (!aCell.mpFormula->IsValue()) @@ -788,7 +788,7 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, { case CELLTYPE_STRING : case CELLTYPE_EDIT : - aStr = aCell.getString(); + aStr = aCell.getString(pDok); nType = 1; break; case CELLTYPE_VALUE : @@ -3459,7 +3459,7 @@ bool ScInterpreter::SetSbxVariable( SbxVariable* pVar, const ScAddress& rPos ) break; case CELLTYPE_STRING : case CELLTYPE_EDIT : - pVar->PutString(aCell.getString()); + pVar->PutString(aCell.getString(pDok)); break; case CELLTYPE_FORMULA : nErr = aCell.mpFormula->GetErrCode(); diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx index a892eb4..2339ff5 100644 --- a/sc/source/core/tool/rangeseq.cxx +++ b/sc/source/core/tool/rangeseq.cxx @@ -282,7 +282,7 @@ sal_Bool ScRangeToSequence::FillMixedArray( uno::Any& rAny, ScDocument* pDoc, co else if (aCell.hasNumeric()) rElement <<= aCell.getValue(); else - rElement <<= aCell.getString(); + rElement <<= aCell.getString(pDoc); } pRowAry[nRow] = aColSeq; } diff --git a/sc/source/filter/dif/difexp.cxx b/sc/source/filter/dif/difexp.cxx index e4b5a77..91d6f9f 100644 --- a/sc/source/filter/dif/difexp.cxx +++ b/sc/source/filter/dif/difexp.cxx @@ -182,7 +182,7 @@ FltError ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc break; case CELLTYPE_EDIT: case CELLTYPE_STRING: - aString = aCell.getString(); + aString = aCell.getString(pDoc); bWriteStringData = true; break; case CELLTYPE_FORMULA: diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 603dfee..5cbf833 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -1141,7 +1141,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab ) break; //! else: fallthru default: - ScCellFormat::GetString(aCell, nFormat, aStrOut, &pColor, *pFormatter); + ScCellFormat::GetString(aCell, nFormat, aStrOut, &pColor, *pFormatter, pDoc); } if ( !bFieldText ) diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index 5e37df0..e6a05fb 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -854,7 +854,7 @@ void XclExpChTrCellContent::GetCellData( XclExpHyperlinkHelper aLinkHelper( rRoot, aPosition ); if (rScCell.mpEditText) { - sCellStr = ScEditUtil::GetString(*rScCell.mpEditText); + sCellStr = ScEditUtil::GetString(*rScCell.mpEditText, &GetDoc()); rpData->mpFormattedString = XclExpStringHelper::CreateCellString( rRoot, *rScCell.mpEditText, NULL, aLinkHelper); } diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx index d6b60eb..551a2b2 100644 --- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx @@ -153,7 +153,7 @@ void ScChangeTrackingExportHelper::WriteGenerated(const ScChangeAction* pGenerat SvXMLElementExport aElemPrev(rExport, XML_NAMESPACE_TABLE, XML_CELL_CONTENT_DELETION, true, true); WriteBigRange(pGeneratedAction->GetBigRange(), XML_CELL_ADDRESS); OUString sValue; - static_cast<const ScChangeActionContent*>(pGeneratedAction)->GetNewString(sValue); + static_cast<const ScChangeActionContent*>(pGeneratedAction)->GetNewString(sValue, rExport.GetDocument()); WriteCell(static_cast<const ScChangeActionContent*>(pGeneratedAction)->GetNewCell(), sValue); } @@ -172,7 +172,7 @@ void ScChangeTrackingExportHelper::WriteDeleted(const ScChangeAction* pDeletedAc if (static_cast<const ScChangeActionContent*>(pDeletedAction)->IsTopContent() && pDeletedAction->IsDeletedIn()) { OUString sValue; - pContentAction->GetNewString(sValue); + pContentAction->GetNewString(sValue, rExport.GetDocument()); WriteCell(pContentAction->GetNewCell(), sValue); } } @@ -307,7 +307,7 @@ void ScChangeTrackingExportHelper::WriteEditCell(const ScCellValue& rCell) OUString sString; if (rCell.mpEditText) - sString = ScEditUtil::GetString(*rCell.mpEditText); + sString = ScEditUtil::GetString(*rCell.mpEditText, rExport.GetDocument()); rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING); SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_CHANGE_TRACK_TABLE_CELL, true, true); @@ -424,7 +424,7 @@ void ScChangeTrackingExportHelper::WriteContentChange(ScChangeAction* pAction) rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ID, GetChangeID(pPrevAction->GetActionNumber())); SvXMLElementExport aElemPrev(rExport, XML_NAMESPACE_TABLE, XML_PREVIOUS, true, true); OUString sValue; - static_cast<ScChangeActionContent*>(pAction)->GetOldString(sValue); + static_cast<ScChangeActionContent*>(pAction)->GetOldString(sValue, rExport.GetDocument()); WriteCell(static_cast<ScChangeActionContent*>(pAction)->GetOldCell(), sValue); } } diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d7003c9..f33c16c 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1944,7 +1944,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt } else { - ScCellFormat::GetInputString(*pCell, nFormat, aString, rFormatter); + ScCellFormat::GetInputString(*pCell, nFormat, aString, rFormatter, &aDocument); bString = false; } } @@ -1994,7 +1994,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt } else { - ScCellFormat::GetInputString(*pCell, nFormat, aString, rFormatter); + ScCellFormat::GetInputString(*pCell, nFormat, aString, rFormatter, &aDocument); bString = false; } } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index afa49ba..c07913f 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -940,7 +940,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck #if OSL_DEBUG_LEVEL > 0 OUString aValue; if ( eSourceType == SC_CAT_CONTENT ) - ((const ScChangeActionContent*)pSourceAction)->GetNewString( aValue ); + ((const ScChangeActionContent*)pSourceAction)->GetNewString( aValue, &aDocument ); OStringBuffer aError(OUStringToOString(aValue, osl_getThreadTextEncoding())); aError.append(RTL_CONSTASCII_STRINGPARAM(" weggelassen")); @@ -1005,7 +1005,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck OSL_ENSURE( aSourceRange.aStart == aSourceRange.aEnd, "huch?" ); ScAddress aPos = aSourceRange.aStart; OUString aValue; - ((const ScChangeActionContent*)pSourceAction)->GetNewString( aValue ); + ((const ScChangeActionContent*)pSourceAction)->GetNewString( aValue, &aDocument ); sal_uInt8 eMatrix = MM_NONE; const ScCellValue& rCell = ((const ScChangeActionContent*)pSourceAction)->GetNewCell(); if (rCell.meType == CELLTYPE_FORMULA) diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index b6f847b..8b5b40d 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -1273,7 +1273,7 @@ static FormulaToken* convertToToken( ScRefCellValue& rCell ) { case CELLTYPE_EDIT: case CELLTYPE_STRING: - return new formula::FormulaStringToken(rCell.getString()); + return new formula::FormulaStringToken(rCell.getString(NULL)); case CELLTYPE_VALUE: return new formula::FormulaDoubleToken(rCell.mfValue); case CELLTYPE_FORMULA: @@ -1363,7 +1363,7 @@ static ScTokenArray* convertToTokenArray( { case CELLTYPE_EDIT: case CELLTYPE_STRING: - xMat->PutString(aCell.getString(), nC, nR); + xMat->PutString(aCell.getString(NULL), nC, nR); break; case CELLTYPE_VALUE: xMat->PutDouble(aCell.mfValue, nC, nR); diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 4580909..7c5f54b 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -663,7 +663,7 @@ SvTreeListEntry* ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionC if(nSpecial==RD_SPECIAL_CONTENT) { OUString aTmp; - pScChangeAction->GetOldString(aTmp); + pScChangeAction->GetOldString(aTmp, pDoc); a2String = aTmp; if(a2String.Len()==0) a2String=aStrEmpty; @@ -677,7 +677,7 @@ SvTreeListEntry* ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionC else { OUString aTmp; - pScChangeAction->GetNewString(aTmp); + pScChangeAction->GetNewString(aTmp, pDoc); a2String = aTmp; if(a2String.Len()==0) { diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index a3f5bdb..a9c700a 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1379,7 +1379,7 @@ static OUString lcl_GetInputString( ScDocument* pDoc, const ScAddress& rPos, sal } } else - ScCellFormat::GetInputString(aCell, nNumFmt, aVal, *pFormatter); + ScCellFormat::GetInputString(aCell, nNumFmt, aVal, *pFormatter, pDoc); // ggf. ein ' davorhaengen wie in ScTabViewShell::UpdateInputHandler if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT ) @@ -2313,7 +2313,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE ScRefCellValue aCell; aCell.assign(*pDoc, aAddr); - OUString aStr = aCell.getString(); + OUString aStr = aCell.getString(pDoc); EditEngine aEngine( pDoc->GetEnginePool() ); aEngine.SetEditTextObjectPool(pDoc->GetEditPool()); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 565f7ec..8c64393 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -501,6 +501,7 @@ bool ScDrawStringsVars::SetText( ScRefCellValue& rCell ) ScCellFormat::GetString( rCell, nFormat, aOUString, &pColor, *pOutput->mpDoc->GetFormatTable(), + pOutput->mpDoc, pOutput->mbShowNullValues, pOutput->mbShowFormulas, ftCheck, true ); @@ -2287,6 +2288,7 @@ bool ScOutputData::DrawEditParam::readCellContent( ScCellFormat::GetString( maCell, nFormat,aString, &pColor, *pDoc->GetFormatTable(), + pDoc, bShowNullValues, bShowFormulas, ftCheck ); @@ -4933,6 +4935,7 @@ void ScOutputData::DrawRotated(sal_Bool bPixelToLogic) ScCellFormat::GetString( aCell, nFormat,aString, &pColor, *mpDoc->GetFormatTable(), + mpDoc, mbShowNullValues, mbShowFormulas, ftCheck ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits