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
Hide 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
CreateStringFromDoubleRef
(
rBuffer
,
t
);
break
;
case
svMatrix
:
case
svMatrixCell
:
CreateStringFromMatrix
(
rBuffer
,
t
);
break
;
...
...
sc/inc/simpleformulacalc.hxx
Dosyayı görüntüle @
ec974965
...
...
@@ -30,6 +30,10 @@ private:
ScAddress
maAddr
;
ScDocument
*
mpDoc
;
ScFormulaResult
maResult
;
const
OUString
maFormula
;
formula
::
FormulaGrammar
::
Grammar
maGram
;
bool
bIsMatrix
;
OUString
maMatrixFormulaResult
;
public
:
ScSimpleFormulaCalculator
(
ScDocument
*
pDoc
,
const
ScAddress
&
rAddr
,
...
...
sc/qa/unit/ucalc.cxx
Dosyayı görüntüle @
ec974965
...
...
@@ -17,6 +17,7 @@
#include "scdll.hxx"
#include "formulacell.hxx"
#include "simpleformulacalc.hxx"
#include "stringutil.hxx"
#include "scmatrix.hxx"
#include "drwlayer.hxx"
...
...
@@ -6470,6 +6471,21 @@ void Test::testMixData()
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
()
{
m_pDoc
->
InsertTab
(
0
,
"Test"
);
...
...
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
ec974965
...
...
@@ -341,6 +341,7 @@ public:
void
testSharedFormulaUnshareAreaListeners
();
void
testSharedFormulaListenerDeleteArea
();
void
testFormulaPosition
();
void
testFormulaWizardSubformula
();
void
testMixData
();
...
...
@@ -593,6 +594,7 @@ public:
CPPUNIT_TEST
(
testSharedFormulaUnshareAreaListeners
);
CPPUNIT_TEST
(
testSharedFormulaListenerDeleteArea
);
CPPUNIT_TEST
(
testFormulaPosition
);
CPPUNIT_TEST
(
testFormulaWizardSubformula
);
CPPUNIT_TEST
(
testMixData
);
CPPUNIT_TEST
(
testJumpToPrecedentsDependents
);
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
,
mbCalculated
(
false
)
,
maAddr
(
rAddr
)
,
mpDoc
(
pDoc
)
,
maFormula
(
rFormula
)
,
maGram
(
eGram
)
,
bIsMatrix
(
false
)
{
// compile already here
ScCompiler
aComp
(
pDoc
,
r
Addr
);
ScCompiler
aComp
(
mpDoc
,
ma
Addr
);
aComp
.
SetGrammar
(
eGram
);
mpCode
.
reset
(
aComp
.
CompileString
(
rFormula
));
if
(
!
mpCode
->
GetCodeError
()
&&
mpCode
->
GetLen
())
...
...
@@ -40,8 +43,21 @@ void ScSimpleFormulaCalculator::Calculate()
mbCalculated
=
true
;
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
();
mnFormatIndex
=
aInt
.
GetRetFormatIndex
();
maResult
.
SetToken
(
aInt
.
GetResultToken
().
get
());
...
...
@@ -51,6 +67,8 @@ bool ScSimpleFormulaCalculator::IsValue()
{
Calculate
();
if
(
bIsMatrix
)
return
false
;
return
maResult
.
IsValue
();
}
...
...
@@ -79,6 +97,9 @@ svl::SharedString ScSimpleFormulaCalculator::GetString()
{
Calculate
();
if
(
bIsMatrix
)
return
maMatrixFormulaResult
;
if
((
!
mpCode
->
GetCodeError
()
||
mpCode
->
GetCodeError
()
==
errDoubleRef
)
&&
!
maResult
.
GetResultError
())
return
maResult
.
GetString
();
...
...
sc/source/core/inc/interpre.hxx
Dosyayı görüntüle @
ec974965
...
...
@@ -890,6 +890,7 @@ public:
void
SetError
(
sal_uInt16
nError
)
{
if
(
nError
&&
!
nGlobalError
)
nGlobalError
=
nError
;
}
void
AssertFormulaMatrix
();
sal_uInt16
GetError
()
const
{
return
nGlobalError
;
}
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()
return
eType
;
}
void
ScInterpreter
::
AssertFormulaMatrix
()
{
bMatrixFormula
=
true
;
}
svl
::
SharedString
ScInterpreter
::
GetStringResult
()
const
{
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