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
1d463600
Kaydet (Commit)
1d463600
authored
Haz 15, 2015
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
prepare ReplaceToken() to replace also in RPN
Change-Id: I98fbcb9849f2c2b1f26109a54ecbf5347cdd8b4e
üst
09c5a9d4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
7 deletions
+45
-7
token.cxx
formula/source/core/api/token.cxx
+22
-4
tokenarray.hxx
include/formula/tokenarray.hxx
+21
-2
compiler.cxx
sc/source/core/tool/compiler.cxx
+2
-1
No files found.
formula/source/core/api/token.cxx
Dosyayı görüntüle @
1d463600
...
@@ -848,15 +848,33 @@ FormulaToken* FormulaTokenArray::MergeArray( )
...
@@ -848,15 +848,33 @@ FormulaToken* FormulaTokenArray::MergeArray( )
return
NULL
;
return
NULL
;
}
}
FormulaToken
*
FormulaTokenArray
::
ReplaceToken
(
sal_uInt16
nOffset
,
FormulaToken
*
t
)
FormulaToken
*
FormulaTokenArray
::
ReplaceToken
(
sal_uInt16
nOffset
,
FormulaToken
*
t
,
FormulaTokenArray
::
ReplaceMode
eMode
)
{
{
if
(
eMode
==
BACKWARD_CODE_ONLY
)
nOffset
=
nLen
-
nOffset
-
1
;
if
(
nOffset
<
nLen
)
if
(
nOffset
<
nLen
)
{
{
CheckToken
(
*
t
);
CheckToken
(
*
t
);
sal_uInt16
nPos
=
nLen
-
nOffset
-
1
;
t
->
IncRef
();
t
->
IncRef
();
pCode
[
nPos
]
->
DecRef
();
FormulaToken
*
p
=
pCode
[
nOffset
];
pCode
[
nPos
]
=
t
;
pCode
[
nOffset
]
=
t
;
if
(
eMode
==
FORWARD_CODE_AND_RPN
&&
p
->
GetRef
()
>
1
)
{
for
(
sal_uInt16
i
=
0
;
i
<
nRPN
;
++
i
)
{
if
(
pRPN
[
i
]
==
p
)
{
t
->
IncRef
();
pRPN
[
i
]
=
t
;
p
->
DecRef
();
if
(
p
->
GetRef
()
==
1
)
break
;
// for
}
}
}
p
->
DecRef
();
// may be dead now
return
t
;
return
t
;
}
}
else
else
...
...
include/formula/tokenarray.hxx
Dosyayı görüntüle @
1d463600
...
@@ -122,10 +122,29 @@ protected:
...
@@ -122,10 +122,29 @@ protected:
/// Also used by the compiler. The token MUST had been allocated with new!
/// Also used by the compiler. The token MUST had been allocated with new!
FormulaToken
*
Add
(
FormulaToken
*
);
FormulaToken
*
Add
(
FormulaToken
*
);
enum
ReplaceMode
{
BACKWARD_CODE_ONLY
,
///< offset goes backward, replacement only in pCode
FORWARD_CODE_AND_RPN
///< offset goes forward, replacement in pCode and RPN
};
/** Also used by the compiler. The token MUST had been allocated with new!
/** Also used by the compiler. The token MUST had been allocated with new!
@param nOffset negative offset of token, 0==last, 1==previous, ...
@param nOffset
If eMode==BACKWARD_CODE_ONLY negative offset of token, 0==last,
1==previous, ...
If eMode==FORWARD_CODE_AND_RPN positive offset of token, 0==first,
1==second, ...
@param eMode
If BACKWARD_CODE_ONLY only the token in pCode at nLen-nOffset-1
is replaced.
If FORWARD_CODE_AND_RPN the token in pCode at nOffset is
replaced; if the original token was also referenced in the RPN
array then that reference is replaced with a reference to the new
token as well.
*/
*/
FormulaToken
*
ReplaceToken
(
sal_uInt16
nOffset
,
FormulaToken
*
);
FormulaToken
*
ReplaceToken
(
sal_uInt16
nOffset
,
FormulaToken
*
,
ReplaceMode
eMode
);
inline
void
SetCombinedBitsRecalcMode
(
ScRecalcMode
nBits
)
inline
void
SetCombinedBitsRecalcMode
(
ScRecalcMode
nBits
)
{
nMode
|=
(
nBits
&
~
RECALCMODE_EMASK
);
}
{
nMode
|=
(
nBits
&
~
RECALCMODE_EMASK
);
}
inline
ScRecalcMode
GetCombinedBitsRecalcMode
()
const
inline
ScRecalcMode
GetCombinedBitsRecalcMode
()
const
...
...
sc/source/core/tool/compiler.cxx
Dosyayı görüntüle @
1d463600
...
@@ -4143,7 +4143,8 @@ ScTokenArray* ScCompiler::CompileString( const OUString& rFormula )
...
@@ -4143,7 +4143,8 @@ ScTokenArray* ScCompiler::CompileString( const OUString& rFormula )
FormulaToken
*
pTableRefToken
=
new
ScTableRefToken
(
pPrev
->
GetIndex
(),
ScTableRefToken
::
TABLE
);
FormulaToken
*
pTableRefToken
=
new
ScTableRefToken
(
pPrev
->
GetIndex
(),
ScTableRefToken
::
TABLE
);
maTableRefs
.
push_back
(
TableRefEntry
(
pTableRefToken
));
maTableRefs
.
push_back
(
TableRefEntry
(
pTableRefToken
));
// pPrev may be dead hereafter.
// pPrev may be dead hereafter.
static_cast
<
ScTokenArray
*>
(
pArr
)
->
ReplaceToken
(
1
,
pTableRefToken
);
static_cast
<
ScTokenArray
*>
(
pArr
)
->
ReplaceToken
(
1
,
pTableRefToken
,
FormulaTokenArray
::
ReplaceMode
::
BACKWARD_CODE_ONLY
);
}
}
}
}
switch
(
eOp
)
switch
(
eOp
)
...
...
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