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
c692b9cd
Kaydet (Commit)
c692b9cd
authored
Nis 28, 2016
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
adjustCopyRangeName: pass rSheet, rIndex; encapsulate nNewSheet
Change-Id: I3de5982b8b8ad179010787ed7be721be54f761af
üst
1d4974ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
18 deletions
+37
-18
formulacell.cxx
sc/source/core/data/formulacell.cxx
+37
-18
No files found.
sc/source/core/data/formulacell.cxx
Dosyayı görüntüle @
c692b9cd
...
...
@@ -636,20 +636,38 @@ ScRangeData* copyRangeNames( SheetIndexMap& rSheetIndexMap, std::vector<ScRangeD
return
pRangeData
;
}
/** Adjust or copy name.
@return TRUE if copied and caller may need to evaluate rpRangeData and rNewSheet.
/** Adjust or copy name from sheet-local to sheet-local, or global to
sheet-local if bGlobalNamesToLocal==true.
@param rSheet
On entry, the original sheet of the named expression/range, <0 global.
On return TRUE, the new sheet. Else unchanged.
@param rIndex
On entry, the original index of the named expression/range.
On return TRUE, the new index, or 0 if a new copied name couldn't be inserted. Else unchanged.
@param rpRangeData
On entry, the pointer to the original named expression/range.
On return TRUE, the pointer to the new copied name, or nullptr if hit shappened.
@return TRUE if copied and caller may need to evaluate rpRangeData and rSheet and rIndex.
FALSE if nothing to be done.
*/
bool
adjustCopyRangeName
(
const
SCTAB
nOldSheet
,
const
sal_uInt16
nOldIndex
,
Sc
RangeData
*&
rpRangeData
,
SCTAB
&
rNewSheet
,
Sc
Document
&
rNewDoc
,
const
ScDocument
*
pOldDoc
,
bool
adjustCopyRangeName
(
SCTAB
&
rSheet
,
sal_uInt16
&
rIndex
,
ScRangeData
*&
rpRangeData
,
ScDocument
&
rNewDoc
,
const
ScDocument
*
pOldDoc
,
const
ScAddress
&
rNewPos
,
const
ScAddress
&
rOldPos
,
const
bool
bGlobalNamesToLocal
)
{
const
bool
bSameDoc
=
(
rNewDoc
.
GetPool
()
==
const_cast
<
ScDocument
*>
(
pOldDoc
)
->
GetPool
());
if
(
bSameDoc
&&
((
nOldSheet
<
0
&&
!
bGlobalNamesToLocal
)
||
(
nOldSheet
>=
0
&&
nOld
Sheet
!=
rOldPos
.
Tab
())))
if
(
bSameDoc
&&
((
rSheet
<
0
&&
!
bGlobalNamesToLocal
)
||
(
rSheet
>=
0
&&
r
Sheet
!=
rOldPos
.
Tab
())))
// Same doc and global name, if not copied to local name, or
// sheet-local name on other sheet stays the same.
return
false
;
// Ensure we don't fiddle with the references until exit.
const
SCTAB
nOldSheet
=
rSheet
;
const
sal_uInt16
nOldIndex
=
rIndex
;
SAL_WARN_IF
(
!
bSameDoc
&&
nOldSheet
>=
0
&&
nOldSheet
!=
rOldPos
.
Tab
(),
"sc.core"
,
"adjustCopyRangeName - sheet-local name was on other sheet in other document"
);
/* TODO: can we do something about that? e.g. loop over sheets? */
...
...
@@ -689,8 +707,8 @@ bool adjustCopyRangeName( const SCTAB nOldSheet, const sal_uInt16 nOldIndex,
// Find corresponding range name in new document.
// First search for local range name then global range names.
r
NewSheet
=
rNewPos
.
Tab
();
ScRangeName
*
pRangeName
=
rNewDoc
.
GetRangeName
(
r
NewSheet
);
SCTAB
n
NewSheet
=
rNewPos
.
Tab
();
ScRangeName
*
pRangeName
=
rNewDoc
.
GetRangeName
(
n
NewSheet
);
// Search local range names.
if
(
pRangeName
)
{
...
...
@@ -699,7 +717,7 @@ bool adjustCopyRangeName( const SCTAB nOldSheet, const sal_uInt16 nOldIndex,
// Search global range names.
if
(
!
rpRangeData
&&
!
bGlobalNamesToLocal
)
{
r
NewSheet
=
-
1
;
n
NewSheet
=
-
1
;
pRangeName
=
rNewDoc
.
GetRangeName
();
if
(
pRangeName
)
rpRangeData
=
pRangeName
->
findByUpperName
(
aRangeName
);
...
...
@@ -730,10 +748,10 @@ bool adjustCopyRangeName( const SCTAB nOldSheet, const sal_uInt16 nOldIndex,
if
(
!
aReferencingNames
.
isEmpty
(
nOldTokenTabReplacement
))
{
const
SCTAB
nTmpOldSheet
=
(
nOldSheet
<
0
?
nOldTab
:
nOldSheet
);
r
NewSheet
=
rNewPos
.
Tab
();
n
NewSheet
=
rNewPos
.
Tab
();
rpRangeData
=
copyRangeNames
(
aSheetIndexMap
,
aRangeDataVec
,
aReferencingNames
,
nOldTab
,
pOldRangeData
,
rNewDoc
,
pOldDoc
,
rNewPos
,
rOldPos
,
bGlobalNamesToLocal
,
nTmpOldSheet
,
r
NewSheet
,
bSameDoc
);
bGlobalNamesToLocal
,
nTmpOldSheet
,
n
NewSheet
,
bSameDoc
);
}
if
((
bGlobalNamesToLocal
||
!
bSameDoc
)
&&
!
aReferencingNames
.
isEmpty
(
-
1
))
{
...
...
@@ -745,7 +763,7 @@ bool adjustCopyRangeName( const SCTAB nOldSheet, const sal_uInt16 nOldIndex,
if
(
!
rpRangeData
)
{
rpRangeData
=
pTmpData
;
r
NewSheet
=
nTmpNewSheet
;
n
NewSheet
=
nTmpNewSheet
;
}
}
...
...
@@ -777,11 +795,13 @@ bool adjustCopyRangeName( const SCTAB nOldSheet, const sal_uInt16 nOldIndex,
}
else
{
r
NewSheet
=
((
nOldSheet
<
0
&&
!
bGlobalNamesToLocal
)
?
-
1
:
rNewPos
.
Tab
());
n
NewSheet
=
((
nOldSheet
<
0
&&
!
bGlobalNamesToLocal
)
?
-
1
:
rNewPos
.
Tab
());
rpRangeData
=
copyRangeName
(
pOldRangeData
,
rNewDoc
,
pOldDoc
,
rNewPos
,
rOldPos
,
bGlobalNamesToLocal
,
nOldSheet
,
r
NewSheet
,
bSameDoc
);
nOldSheet
,
n
NewSheet
,
bSameDoc
);
}
}
rSheet
=
nNewSheet
;
rIndex
=
rpRangeData
?
rpRangeData
->
GetIndex
()
:
0
;
// 0 means not inserted
return
true
;
}
...
...
@@ -789,9 +809,9 @@ void adjustRangeName(formula::FormulaToken* pToken, ScDocument& rNewDoc, const S
const
ScAddress
&
rNewPos
,
const
ScAddress
&
rOldPos
,
bool
bGlobalNamesToLocal
)
{
ScRangeData
*
pRangeData
=
nullptr
;
SCTAB
n
NewSheet
=
rNewPos
.
Tab
();
if
(
!
adjustCopyRangeName
(
pToken
->
GetSheet
(),
pToken
->
GetIndex
(),
pRangeData
,
nNewSheet
,
rNewDoc
,
pOldDoc
,
rNewPos
,
rOldPos
,
bGlobalNamesToLocal
))
SCTAB
n
Sheet
=
pToken
->
GetSheet
();
sal_uInt16
nIndex
=
pToken
->
GetIndex
();
if
(
!
adjustCopyRangeName
(
nSheet
,
nIndex
,
pRangeData
,
rNewDoc
,
pOldDoc
,
rNewPos
,
rOldPos
,
bGlobalNamesToLocal
))
return
;
// nothing to do
if
(
!
pRangeData
)
...
...
@@ -802,9 +822,8 @@ void adjustRangeName(formula::FormulaToken* pToken, ScDocument& rNewDoc, const S
return
;
}
sal_Int32
nIndex
=
pRangeData
->
GetIndex
();
pToken
->
SetIndex
(
nIndex
);
pToken
->
SetSheet
(
n
New
Sheet
);
pToken
->
SetSheet
(
nSheet
);
}
void
adjustDBRange
(
formula
::
FormulaToken
*
pToken
,
ScDocument
&
rNewDoc
,
const
ScDocument
*
pOldDoc
)
...
...
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