Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
ec974965
Kaydet (Commit)
ec974965
authored
Haz 22, 2015
tarafından
Benjamin Ni
Kaydeden (comit)
Markus Mohrhard
Haz 29, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Subformula evaluation in formula wizard tree
Change-Id: If4f6a608f261621e2e1ba40b36d71d39a137a453
üst
55ac455f
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
3 deletions
+53
-3
FormulaCompiler.cxx
formula/source/core/api/FormulaCompiler.cxx
+1
-0
simpleformulacalc.hxx
sc/inc/simpleformulacalc.hxx
+4
-0
ucalc.cxx
sc/qa/unit/ucalc.cxx
+16
-0
ucalc.hxx
sc/qa/unit/ucalc.hxx
+2
-0
simpleformulacalc.cxx
sc/source/core/data/simpleformulacalc.cxx
+24
-3
interpre.hxx
sc/source/core/inc/interpre.hxx
+1
-0
interpr4.cxx
sc/source/core/tool/interpr4.cxx
+5
-0
No files found.
formula/source/core/api/FormulaCompiler.cxx
Dosyayı görüntüle @
ec974965
...
@@ -1862,6 +1862,7 @@ const FormulaToken* FormulaCompiler::CreateStringFromToken( OUStringBuffer& rBuf
...
@@ -1862,6 +1862,7 @@ const FormulaToken* FormulaCompiler::CreateStringFromToken( OUStringBuffer& rBuf
CreateStringFromDoubleRef
(
rBuffer
,
t
);
CreateStringFromDoubleRef
(
rBuffer
,
t
);
break
;
break
;
case
svMatrix
:
case
svMatrix
:
case
svMatrixCell
:
CreateStringFromMatrix
(
rBuffer
,
t
);
CreateStringFromMatrix
(
rBuffer
,
t
);
break
;
break
;
...
...
sc/inc/simpleformulacalc.hxx
Dosyayı görüntüle @
ec974965
...
@@ -30,6 +30,10 @@ private:
...
@@ -30,6 +30,10 @@ private:
ScAddress
maAddr
;
ScAddress
maAddr
;
ScDocument
*
mpDoc
;
ScDocument
*
mpDoc
;
ScFormulaResult
maResult
;
ScFormulaResult
maResult
;
const
OUString
maFormula
;
formula
::
FormulaGrammar
::
Grammar
maGram
;
bool
bIsMatrix
;
OUString
maMatrixFormulaResult
;
public
:
public
:
ScSimpleFormulaCalculator
(
ScDocument
*
pDoc
,
const
ScAddress
&
rAddr
,
ScSimpleFormulaCalculator
(
ScDocument
*
pDoc
,
const
ScAddress
&
rAddr
,
...
...
sc/qa/unit/ucalc.cxx
Dosyayı görüntüle @
ec974965
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "scdll.hxx"
#include "scdll.hxx"
#include "formulacell.hxx"
#include "formulacell.hxx"
#include "simpleformulacalc.hxx"
#include "stringutil.hxx"
#include "stringutil.hxx"
#include "scmatrix.hxx"
#include "scmatrix.hxx"
#include "drwlayer.hxx"
#include "drwlayer.hxx"
...
@@ -6470,6 +6471,21 @@ void Test::testMixData()
...
@@ -6470,6 +6471,21 @@ void Test::testMixData()
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
DeleteTab
(
0
);
}
}
void
Test
::
testFormulaWizardSubformula
()
{
m_pDoc
->
InsertTab
(
0
,
"Test"
);
m_pDoc
->
SetString
(
ScAddress
(
0
,
0
,
0
),
"=B0:B2"
);
m_pDoc
->
SetString
(
ScAddress
(
0
,
1
,
0
),
"=1"
);
// B0
m_pDoc
->
SetString
(
ScAddress
(
1
,
1
,
0
),
"=1/0"
);
// B1
m_pDoc
->
SetString
(
ScAddress
(
2
,
1
,
0
),
"=gibberish"
);
// B2
ScSimpleFormulaCalculator
pFCell
(
m_pDoc
,
ScAddress
(
0
,
0
,
0
),
""
);
if
(
pFCell
.
GetErrCode
()
==
0
)
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"{1, #DIV/0!, #NAME!}"
),
pFCell
.
GetString
().
getString
()
);
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
testSetStringAndNote
()
void
Test
::
testSetStringAndNote
()
{
{
m_pDoc
->
InsertTab
(
0
,
"Test"
);
m_pDoc
->
InsertTab
(
0
,
"Test"
);
...
...
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
ec974965
...
@@ -341,6 +341,7 @@ public:
...
@@ -341,6 +341,7 @@ public:
void
testSharedFormulaUnshareAreaListeners
();
void
testSharedFormulaUnshareAreaListeners
();
void
testSharedFormulaListenerDeleteArea
();
void
testSharedFormulaListenerDeleteArea
();
void
testFormulaPosition
();
void
testFormulaPosition
();
void
testFormulaWizardSubformula
();
void
testMixData
();
void
testMixData
();
...
@@ -593,6 +594,7 @@ public:
...
@@ -593,6 +594,7 @@ public:
CPPUNIT_TEST
(
testSharedFormulaUnshareAreaListeners
);
CPPUNIT_TEST
(
testSharedFormulaUnshareAreaListeners
);
CPPUNIT_TEST
(
testSharedFormulaListenerDeleteArea
);
CPPUNIT_TEST
(
testSharedFormulaListenerDeleteArea
);
CPPUNIT_TEST
(
testFormulaPosition
);
CPPUNIT_TEST
(
testFormulaPosition
);
CPPUNIT_TEST
(
testFormulaWizardSubformula
);
CPPUNIT_TEST
(
testMixData
);
CPPUNIT_TEST
(
testMixData
);
CPPUNIT_TEST
(
testJumpToPrecedentsDependents
);
CPPUNIT_TEST
(
testJumpToPrecedentsDependents
);
CPPUNIT_TEST
(
testSetBackgroundColor
);
CPPUNIT_TEST
(
testSetBackgroundColor
);
...
...
sc/source/core/data/simpleformulacalc.cxx
Dosyayı görüntüle @
ec974965
...
@@ -20,9 +20,12 @@ ScSimpleFormulaCalculator::ScSimpleFormulaCalculator( ScDocument* pDoc, const Sc
...
@@ -20,9 +20,12 @@ ScSimpleFormulaCalculator::ScSimpleFormulaCalculator( ScDocument* pDoc, const Sc
,
mbCalculated
(
false
)
,
mbCalculated
(
false
)
,
maAddr
(
rAddr
)
,
maAddr
(
rAddr
)
,
mpDoc
(
pDoc
)
,
mpDoc
(
pDoc
)
,
maFormula
(
rFormula
)
,
maGram
(
eGram
)
,
bIsMatrix
(
false
)
{
{
// compile already here
// compile already here
ScCompiler
aComp
(
pDoc
,
r
Addr
);
ScCompiler
aComp
(
mpDoc
,
ma
Addr
);
aComp
.
SetGrammar
(
eGram
);
aComp
.
SetGrammar
(
eGram
);
mpCode
.
reset
(
aComp
.
CompileString
(
rFormula
));
mpCode
.
reset
(
aComp
.
CompileString
(
rFormula
));
if
(
!
mpCode
->
GetCodeError
()
&&
mpCode
->
GetLen
())
if
(
!
mpCode
->
GetCodeError
()
&&
mpCode
->
GetLen
())
...
@@ -40,8 +43,21 @@ void ScSimpleFormulaCalculator::Calculate()
...
@@ -40,8 +43,21 @@ void ScSimpleFormulaCalculator::Calculate()
mbCalculated
=
true
;
mbCalculated
=
true
;
ScInterpreter
aInt
(
NULL
,
mpDoc
,
maAddr
,
*
mpCode
.
get
());
ScInterpreter
aInt
(
NULL
,
mpDoc
,
maAddr
,
*
mpCode
.
get
());
aInt
.
Interpret
();
aInt
.
AssertFormulaMatrix
();
formula
::
StackVar
aIntType
=
aInt
.
Interpret
();
if
(
aIntType
==
formula
::
svMatrixCell
)
{
OUStringBuffer
aStr
;
ScCompiler
aComp
(
mpDoc
,
maAddr
);
aComp
.
SetGrammar
(
maGram
);
mpCode
.
reset
(
aComp
.
CompileString
(
maFormula
));
if
(
!
mpCode
->
GetCodeError
()
&&
mpCode
->
GetLen
())
aComp
.
CompileTokenArray
();
aComp
.
CreateStringFromToken
(
aStr
,
aInt
.
GetResultToken
().
get
(),
true
);
bIsMatrix
=
true
;
maMatrixFormulaResult
=
aStr
.
toString
();
}
mnFormatType
=
aInt
.
GetRetFormatType
();
mnFormatType
=
aInt
.
GetRetFormatType
();
mnFormatIndex
=
aInt
.
GetRetFormatIndex
();
mnFormatIndex
=
aInt
.
GetRetFormatIndex
();
maResult
.
SetToken
(
aInt
.
GetResultToken
().
get
());
maResult
.
SetToken
(
aInt
.
GetResultToken
().
get
());
...
@@ -51,6 +67,8 @@ bool ScSimpleFormulaCalculator::IsValue()
...
@@ -51,6 +67,8 @@ bool ScSimpleFormulaCalculator::IsValue()
{
{
Calculate
();
Calculate
();
if
(
bIsMatrix
)
return
false
;
return
maResult
.
IsValue
();
return
maResult
.
IsValue
();
}
}
...
@@ -79,6 +97,9 @@ svl::SharedString ScSimpleFormulaCalculator::GetString()
...
@@ -79,6 +97,9 @@ svl::SharedString ScSimpleFormulaCalculator::GetString()
{
{
Calculate
();
Calculate
();
if
(
bIsMatrix
)
return
maMatrixFormulaResult
;
if
((
!
mpCode
->
GetCodeError
()
||
mpCode
->
GetCodeError
()
==
errDoubleRef
)
&&
if
((
!
mpCode
->
GetCodeError
()
||
mpCode
->
GetCodeError
()
==
errDoubleRef
)
&&
!
maResult
.
GetResultError
())
!
maResult
.
GetResultError
())
return
maResult
.
GetString
();
return
maResult
.
GetString
();
...
...
sc/source/core/inc/interpre.hxx
Dosyayı görüntüle @
ec974965
...
@@ -890,6 +890,7 @@ public:
...
@@ -890,6 +890,7 @@ public:
void
SetError
(
sal_uInt16
nError
)
void
SetError
(
sal_uInt16
nError
)
{
if
(
nError
&&
!
nGlobalError
)
nGlobalError
=
nError
;
}
{
if
(
nError
&&
!
nGlobalError
)
nGlobalError
=
nError
;
}
void
AssertFormulaMatrix
();
sal_uInt16
GetError
()
const
{
return
nGlobalError
;
}
sal_uInt16
GetError
()
const
{
return
nGlobalError
;
}
formula
::
StackVar
GetResultType
()
const
{
return
xResult
->
GetType
();
}
formula
::
StackVar
GetResultType
()
const
{
return
xResult
->
GetType
();
}
...
...
sc/source/core/tool/interpr4.cxx
Dosyayı görüntüle @
ec974965
...
@@ -4540,6 +4540,11 @@ StackVar ScInterpreter::Interpret()
...
@@ -4540,6 +4540,11 @@ StackVar ScInterpreter::Interpret()
return
eType
;
return
eType
;
}
}
void
ScInterpreter
::
AssertFormulaMatrix
()
{
bMatrixFormula
=
true
;
}
svl
::
SharedString
ScInterpreter
::
GetStringResult
()
const
svl
::
SharedString
ScInterpreter
::
GetStringResult
()
const
{
{
return
xResult
->
GetString
();
return
xResult
->
GetString
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment