[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sc/inc sc/qa sc/source

2013-07-25 Thread Eike Rathke
 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 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sc/inc sc/qa sc/source

2013-06-28 Thread Markus Mohrhard
 sc/inc/formulacell.hxx |7 ---
 sc/inc/formularesult.hxx   |2 --
 sc/inc/token.hxx   |   14 --
 sc/qa/unit/data/contentCSV/cachedValue.csv |2 +-
 sc/source/core/tool/formularesult.cxx  |   17 -
 sc/source/filter/xml/xmlcelli.cxx  |5 +
 6 files changed, 2 insertions(+), 45 deletions(-)

New commits:
commit 0b6233afdc65030fd7c4a57c5a2155f0d32b18df
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Sun Jun 23 21:47:18 2013 +0200

we don't need this hack without inherited number formats, fdo#66076

Change-Id: If315ce28a4182019002141c7330475e0843f9a40
(cherry picked from commit 3f0b5770790dfcb408d169df1265546d6e8e3ece)
Reviewed-on: https://gerrit.libreoffice.org/4593
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index c6d3aa7..747d67f 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -261,13 +261,6 @@ public:
 const formula::FormulaGrammar::Grammar 
eGrammar )
 { aResult.SetHybridFormula( r); eTempGrammar = 
eGrammar; }
 
-/**
- * For import only: use for formula cells that return a number
- * formatted as some kind of string
- */
-void SetHybridValueString( double nVal, const OUString r )
-{ aResult.SetHybridValueString( nVal, r ); }
-
 void SetResultMatrix( SCCOL nCols, SCROW nRows, const ScConstMatrixRef 
pMat, formula::FormulaToken* pUL )
 {
 aResult.SetMatrix(nCols, nRows, pMat, pUL);
diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx
index b337d2f..a88f82d 100644
--- a/sc/inc/formularesult.hxx
+++ b/sc/inc/formularesult.hxx
@@ -177,8 +177,6 @@ public:
 SetHybridFormula() for formula string to be compiled later. */
 SC_DLLPUBLIC void SetHybridFormula( const String  rFormula );
 
-void SetHybridValueString( double nVal, const OUString rStr );
-
 SC_DLLPUBLIC void SetMatrix( SCCOL nCols, SCROW nRows, const 
ScConstMatrixRef pMat, formula::FormulaToken* pUL );
 
 /** Get the const ScMatrixFormulaCellToken* if token is of that type, else
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index abd3cd5..109980f 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -430,20 +430,6 @@ public:
 virtual FormulaToken* Clone() const { return new ScHybridCellToken(*this); 
}
 };
 
-class SC_DLLPUBLIC ScHybridValueCellToken : public ScToken
-{
-private:
-double mfValue;
-String maString;
-public:
-ScHybridValueCellToken (double f, const OUString rStr ):
-ScToken( formula::svHybridValueCell ),
-mfValue( f ), maString( rStr ) {}
-
-virtual double GetDouble() const { return mfValue; }
-virtual const String  GetString() const { return maString; }
-};
-
 // Simplify argument passing to RefUpdate methods with ScSingleRefToken or
 // ScDoubleRefToken
 class SingleDoubleRefModifier
diff --git a/sc/qa/unit/data/contentCSV/cachedValue.csv 
b/sc/qa/unit/data/contentCSV/cachedValue.csv
index 183391b..7fed884 100644
--- a/sc/qa/unit/data/contentCSV/cachedValue.csv
+++ b/sc/qa/unit/data/contentCSV/cachedValue.csv
@@ -1,2 +1,2 @@
 1.00,200.00%,$3.00,1/3/00,00:00,6.00E+000,7 1/5,TRUE,9,1000%,01-10
-1,200.00%,$3.00,01/03/00,120:00:00,6.00E+000,7 1/5,TRUE,9,1000.00%,01/10/00
+1,200.00%,$3.00,01/03/00,12:00:00 AM,6.00E+000,7 1/5,TRUE,9,1000.00%,01/10/00
diff --git a/sc/source/core/tool/formularesult.cxx 
b/sc/source/core/tool/formularesult.cxx
index e0ca0be..a7c70e6 100644
--- a/sc/source/core/tool/formularesult.cxx
+++ b/sc/source/core/tool/formularesult.cxx
@@ -430,23 +430,6 @@ void ScFormulaResult::SetHybridFormula( const String  
rFormula )
 mbToken = true;
 }
 
-void ScFormulaResult::SetHybridValueString( double nVal, const OUString rStr )
-{
-if(GetType() == formula::svMatrixCell)
-{
-SetDouble(nVal);
-return;
-}
-
-ResetToDefaults();
-if (mbToken  mpToken)
-mpToken-DecRef();
-
-mpToken = new ScHybridValueCellToken( nVal, rStr );
-mpToken-IncRef();
-mbToken = true;
-}
-
 void ScFormulaResult::SetMatrix( SCCOL nCols, SCROW nRows, const 
ScConstMatrixRef pMat, formula::FormulaToken* pUL )
 {
 ResetToDefaults();
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 1e838a0..0fef98f 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -993,10 +993,7 @@ void 
ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
 }
 else if (!rtl::math::isNan(fValue))
 {
-if (mbEditEngineHasText)
-pFCell-SetHybridValueString(fValue, mpEditEngine-GetText(0));
-else
-pFCell-SetHybridDouble(fValue);
+