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
94e3f3e5
Kaydet (Commit)
94e3f3e5
authored
May 04, 2014
tarafından
Matteo Casalin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Simplify sw_GetCellPosition
Change-Id: If672256b85c1e0a6534055844c3df936c0636c3f
üst
541dcc5b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
29 deletions
+27
-29
unotbl.cxx
sw/source/core/unocore/unotbl.cxx
+27
-29
No files found.
sw/source/core/unocore/unotbl.cxx
Dosyayı görüntüle @
94e3f3e5
...
@@ -352,42 +352,40 @@ void sw_GetCellPosition(const OUString &rCellName,
...
@@ -352,42 +352,40 @@ void sw_GetCellPosition(const OUString &rCellName,
sal_Int32
&
rColumn
,
sal_Int32
&
rRow
)
sal_Int32
&
rColumn
,
sal_Int32
&
rRow
)
{
{
rColumn
=
rRow
=
-
1
;
// default return values indicating failure
rColumn
=
rRow
=
-
1
;
// default return values indicating failure
sal_Int32
nLen
=
rCellName
.
getLength
();
const
sal_Int32
nLen
=
rCellName
.
getLength
();
if
(
nLen
)
if
(
nLen
)
{
{
const
sal_Unicode
*
pBuf
=
rCellName
.
getStr
();
sal_Int32
nRowPos
=
0
;
const
sal_Unicode
*
pEnd
=
pBuf
+
nLen
;
while
(
nRowPos
<
nLen
)
while
(
pBuf
<
pEnd
&&
!
(
'0'
<=
*
pBuf
&&
*
pBuf
<=
'9'
))
++
pBuf
;
// start of number found?
if
(
pBuf
<
pEnd
&&
(
'0'
<=
*
pBuf
&&
*
pBuf
<=
'9'
))
{
{
OUString
aColTxt
(
rCellName
.
getStr
(),
pBuf
-
rCellName
.
getStr
());
if
(
rCellName
[
nRowPos
]
>=
'0'
&&
rCellName
[
nRowPos
]
<=
'9'
)
OUString
aRowTxt
(
pBuf
,
(
rCellName
.
getStr
()
+
nLen
-
pBuf
));
if
(
!
aColTxt
.
isEmpty
()
&&
!
aRowTxt
.
isEmpty
())
{
{
sal_Int32
nColIdx
=
0
;
break
;
sal_Int32
nLength
=
aColTxt
.
getLength
();
}
for
(
sal_Int32
i
=
0
;
i
<
nLength
;
++
i
)
++
nRowPos
;
}
if
(
nRowPos
>
0
&&
nRowPos
<
nLen
)
{
sal_Int32
nColIdx
=
0
;
for
(
sal_Int32
i
=
0
;
i
<
nRowPos
;
++
i
)
{
nColIdx
*=
52
;
if
(
i
<
nRowPos
-
1
)
++
nColIdx
;
const
sal_Unicode
cChar
=
rCellName
[
i
];
if
(
'A'
<=
cChar
&&
cChar
<=
'Z'
)
nColIdx
+=
cChar
-
'A'
;
else
if
(
'a'
<=
cChar
&&
cChar
<=
'z'
)
nColIdx
+=
26
+
cChar
-
'a'
;
else
{
{
nColIdx
=
52
*
nColIdx
;
nColIdx
=
-
1
;
// sth failed
if
(
i
<
nLength
-
1
)
break
;
++
nColIdx
;
sal_Unicode
cChar
=
aColTxt
[
i
];
if
(
'A'
<=
cChar
&&
cChar
<=
'Z'
)
nColIdx
=
nColIdx
+
(
cChar
-
'A'
);
else
if
(
'a'
<=
cChar
&&
cChar
<=
'z'
)
nColIdx
=
nColIdx
+
(
26
+
cChar
-
'a'
);
else
{
nColIdx
=
-
1
;
// sth failed
break
;
}
}
}
rColumn
=
nColIdx
;
rRow
=
aRowTxt
.
toInt32
()
-
1
;
// - 1 because indices ought to be 0 based
}
}
rColumn
=
nColIdx
;
rRow
=
rCellName
.
copy
(
nRowPos
).
toInt32
()
-
1
;
// - 1 because indices ought to be 0 based
}
}
}
}
OSL_ENSURE
(
rColumn
!=
-
1
&&
rRow
!=
-
1
,
"failed to get column or row index"
);
OSL_ENSURE
(
rColumn
!=
-
1
&&
rRow
!=
-
1
,
"failed to get column or row index"
);
...
...
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