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
28d5f8c6
Kaydet (Commit)
28d5f8c6
authored
Ock 31, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Extract this code block into its own method.
Change-Id: I43cc4ae350455c104d079e6aaaa28eabbd6c04e7
üst
9b677819
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
181 additions
and
167 deletions
+181
-167
table.hxx
sc/inc/table.hxx
+8
-1
table4.cxx
sc/source/core/data/table4.cxx
+173
-166
No files found.
sc/inc/table.hxx
Dosyayı görüntüle @
28d5f8c6
...
...
@@ -915,10 +915,17 @@ public:
static
void
UpdateSearchItemAddressForReplace
(
const
SvxSearchItem
&
rSearchItem
,
SCCOL
&
rCol
,
SCROW
&
rRow
);
private
:
void
FillSimple
(
void
FillS
eriesS
imple
(
ScCellValue
&
rSrcCell
,
SCCOLROW
&
rInner
,
SCCOLROW
nIMin
,
SCCOLROW
nIMax
,
SCCOLROW
&
rCol
,
SCCOLROW
&
rRow
,
bool
bVertical
,
ScProgress
*
pProgress
,
sal_uLong
&
rProgress
);
void
FillAutoSimple
(
SCCOLROW
nISrcStart
,
SCCOLROW
nISrcEnd
,
SCCOLROW
nIStart
,
SCCOLROW
nIEnd
,
SCCOLROW
&
rInner
,
SCCOLROW
&
rCol
,
SCCOLROW
&
rRow
,
sal_uLong
nActFormCnt
,
sal_uLong
nMaxFormCnt
,
bool
bHasFiltered
,
bool
bVertical
,
bool
bPositive
,
ScProgress
*
pProgress
,
sal_uLong
&
rProgress
);
void
FillSeries
(
SCCOL
nCol1
,
SCROW
nRow1
,
SCCOL
nCol2
,
SCROW
nRow2
,
sal_uLong
nFillCount
,
FillDir
eFillDir
,
FillCmd
eFillCmd
,
FillDateCmd
eFillDateCmd
,
...
...
sc/source/core/data/table4.cxx
Dosyayı görüntüle @
28d5f8c6
...
...
@@ -484,16 +484,16 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
bool
bVertical
=
(
eFillDir
==
FILL_TO_BOTTOM
||
eFillDir
==
FILL_TO_TOP
);
bool
bPositive
=
(
eFillDir
==
FILL_TO_BOTTOM
||
eFillDir
==
FILL_TO_RIGHT
);
sal_uLong
nCol
=
0
;
sal_uLong
nRow
=
0
;
sal_uLong
&
rInner
=
bVertical
?
nRow
:
nCol
;
// loop variables
sal_uLong
&
rOuter
=
bVertical
?
nCol
:
nRow
;
sal_uLong
nOStart
;
sal_uLong
nOEnd
;
sal_uLong
nIStart
;
sal_uLong
nIEnd
;
sal_uLong
nISrcStart
;
sal_uLong
nISrcEnd
;
SCCOLROW
nCol
=
0
;
SCCOLROW
nRow
=
0
;
SCCOLROW
&
rInner
=
bVertical
?
nRow
:
nCol
;
// loop variables
SCCOLROW
&
rOuter
=
bVertical
?
nCol
:
nRow
;
SCCOLROW
nOStart
;
SCCOLROW
nOEnd
;
SCCOLROW
nIStart
;
SCCOLROW
nIEnd
;
SCCOLROW
nISrcStart
;
SCCOLROW
nISrcEnd
;
ScRange
aFillRange
;
if
(
bVertical
)
...
...
@@ -568,7 +568,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
const
ScPatternAttr
*
pSrcPattern
=
NULL
;
const
ScStyleSheet
*
pStyleSheet
=
NULL
;
sal_uLong
nAtSrc
=
nISrcStart
;
SCCOLROW
nAtSrc
=
nISrcStart
;
ScPatternAttr
*
pNewPattern
=
NULL
;
bool
bGetPattern
=
true
;
rInner
=
nIStart
;
...
...
@@ -744,159 +744,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
}
else
if
(
eFillCmd
==
FILL_SIMPLE
)
// fill with pattern/sample
{
sal_uLong
nSource
=
nISrcStart
;
double
nDelta
;
if
(
(
nScFillModeMouseModifier
&
KEY_MOD1
)
)
nDelta
=
0.0
;
else
if
(
bPositive
)
nDelta
=
1.0
;
else
nDelta
=
-
1.0
;
double
nVal
=
0.0
;
sal_uLong
nFormulaCounter
=
nActFormCnt
;
bool
bGetCell
=
true
;
sal_uInt16
nCellDigits
=
0
;
short
nHeadNoneTail
=
0
;
sal_Int32
nStringValue
=
0
;
OUString
aValue
;
ScCellValue
aSrcCell
;
CellType
eCellType
=
CELLTYPE_NONE
;
bool
bIsOrdinalSuffix
=
false
;
rInner
=
nIStart
;
while
(
true
)
// #i53728# with "for (;;)" old solaris/x86 compiler mis-optimizes
{
if
(
!
ColHidden
(
nCol
)
&&
!
RowHidden
(
nRow
))
{
if
(
bGetCell
)
{
if
(
bVertical
)
// rInner&:=nRow, rOuter&:=nCol
aSrcCell
=
aCol
[
nCol
].
GetCellValue
(
static_cast
<
SCROW
>
(
nSource
));
else
// rInner&:=nCol, rOuter&:=nRow
aSrcCell
=
aCol
[
nSource
].
GetCellValue
(
static_cast
<
SCROW
>
(
nRow
));
bGetCell
=
false
;
if
(
!
aSrcCell
.
isEmpty
())
{
eCellType
=
aSrcCell
.
meType
;
switch
(
eCellType
)
{
case
CELLTYPE_VALUE
:
nVal
=
aSrcCell
.
mfValue
;
break
;
case
CELLTYPE_STRING
:
case
CELLTYPE_EDIT
:
if
(
eCellType
==
CELLTYPE_STRING
)
aValue
=
aSrcCell
.
mpString
->
getString
();
else
aValue
=
ScEditUtil
::
GetString
(
*
aSrcCell
.
mpEditText
,
pDocument
);
if
(
!
(
nScFillModeMouseModifier
&
KEY_MOD1
)
&&
!
bHasFiltered
)
{
nCellDigits
=
0
;
// look at each source cell individually
nHeadNoneTail
=
lcl_DecompValueString
(
aValue
,
nStringValue
,
&
nCellDigits
);
bIsOrdinalSuffix
=
aValue
.
equals
(
ScGlobal
::
GetOrdinalSuffix
(
nStringValue
));
}
break
;
default
:
{
// added to avoid warnings
}
}
}
else
eCellType
=
CELLTYPE_NONE
;
}
switch
(
eCellType
)
{
case
CELLTYPE_VALUE
:
aCol
[
nCol
].
SetValue
(
static_cast
<
SCROW
>
(
nRow
),
nVal
+
nDelta
);
break
;
case
CELLTYPE_STRING
:
case
CELLTYPE_EDIT
:
if
(
nHeadNoneTail
)
{
// #i48009# with the "nStringValue+(long)nDelta" expression within the
// lcl_ValueString calls, gcc 3.4.1 makes wrong optimizations (ok in 3.4.3),
// so nNextValue is now calculated ahead.
sal_Int32
nNextValue
=
nStringValue
+
(
sal_Int32
)
nDelta
;
OUString
aStr
;
if
(
nHeadNoneTail
<
0
)
{
setSuffixCell
(
aCol
[
nCol
],
static_cast
<
SCROW
>
(
nRow
),
nNextValue
,
nCellDigits
,
aValue
,
eCellType
,
bIsOrdinalSuffix
);
}
else
{
aStr
=
aValue
+
lcl_ValueString
(
nNextValue
,
nCellDigits
);
aCol
[
nCol
].
SetRawString
(
static_cast
<
SCROW
>
(
nRow
),
aStr
);
}
}
else
aSrcCell
.
commit
(
aCol
[
nCol
],
nRow
);
break
;
case
CELLTYPE_FORMULA
:
FillFormula
(
aSrcCell
.
mpFormula
,
static_cast
<
SCCOL
>
(
nCol
),
static_cast
<
SCROW
>
(
nRow
),
(
rInner
==
nIEnd
)
);
if
(
nFormulaCounter
-
nActFormCnt
>
nMaxFormCnt
)
nMaxFormCnt
=
nFormulaCounter
-
nActFormCnt
;
break
;
default
:
{
// added to avoid warnings
}
}
if
(
nSource
==
nISrcEnd
)
{
if
(
nSource
!=
nISrcStart
)
{
// More than one source cell
nSource
=
nISrcStart
;
bGetCell
=
true
;
}
if
(
!
(
nScFillModeMouseModifier
&
KEY_MOD1
)
)
{
if
(
bPositive
)
nDelta
+=
1.0
;
else
nDelta
-=
1.0
;
}
nFormulaCounter
=
nActFormCnt
;
}
else
if
(
bPositive
)
{
++
nSource
;
bGetCell
=
true
;
}
else
{
--
nSource
;
bGetCell
=
true
;
}
}
if
(
rInner
==
nIEnd
)
break
;
if
(
bPositive
)
++
rInner
;
else
--
rInner
;
// Progress in inner loop only for expensive cells,
// and even then not individually for each one
++
nProgress
;
if
(
pProgress
&&
(
eCellType
==
CELLTYPE_FORMULA
||
eCellType
==
CELLTYPE_EDIT
)
)
pProgress
->
SetStateOnPercent
(
nProgress
);
}
if
(
pProgress
)
pProgress
->
SetStateOnPercent
(
nProgress
);
FillAutoSimple
(
nISrcStart
,
nISrcEnd
,
nIStart
,
nIEnd
,
rInner
,
nCol
,
nRow
,
nActFormCnt
,
nMaxFormCnt
,
bHasFiltered
,
bVertical
,
bPositive
,
pProgress
,
nProgress
);
}
else
{
...
...
@@ -1283,7 +1133,7 @@ bool HiddenRowColumn(ScTable* pTable, SCCOLROW nRowColumn, bool bVertical, SCCOL
}
void
ScTable
::
FillSimple
(
void
ScTable
::
FillS
eriesS
imple
(
ScCellValue
&
rSrcCell
,
SCCOLROW
&
rInner
,
SCCOLROW
nIMin
,
SCCOLROW
nIMax
,
SCCOLROW
&
rCol
,
SCCOLROW
&
rRow
,
bool
bVertical
,
ScProgress
*
pProgress
,
sal_uLong
&
rProgress
)
{
...
...
@@ -1396,6 +1246,163 @@ void ScTable::FillSimple(
}
}
void
ScTable
::
FillAutoSimple
(
SCCOLROW
nISrcStart
,
SCCOLROW
nISrcEnd
,
SCCOLROW
nIStart
,
SCCOLROW
nIEnd
,
SCCOLROW
&
rInner
,
SCCOLROW
&
rCol
,
SCCOLROW
&
rRow
,
sal_uLong
nActFormCnt
,
sal_uLong
nMaxFormCnt
,
bool
bHasFiltered
,
bool
bVertical
,
bool
bPositive
,
ScProgress
*
pProgress
,
sal_uLong
&
rProgress
)
{
SCCOLROW
nSource
=
nISrcStart
;
double
nDelta
;
if
(
(
nScFillModeMouseModifier
&
KEY_MOD1
)
)
nDelta
=
0.0
;
else
if
(
bPositive
)
nDelta
=
1.0
;
else
nDelta
=
-
1.0
;
sal_uLong
nFormulaCounter
=
nActFormCnt
;
bool
bGetCell
=
true
;
sal_uInt16
nCellDigits
=
0
;
short
nHeadNoneTail
=
0
;
sal_Int32
nStringValue
=
0
;
OUString
aValue
;
ScCellValue
aSrcCell
;
CellType
eCellType
=
CELLTYPE_NONE
;
bool
bIsOrdinalSuffix
=
false
;
rInner
=
nIStart
;
while
(
true
)
// #i53728# with "for (;;)" old solaris/x86 compiler mis-optimizes
{
if
(
!
ColHidden
(
rCol
)
&&
!
RowHidden
(
rRow
))
{
if
(
bGetCell
)
{
if
(
bVertical
)
// rInner&:=nRow, rOuter&:=nCol
aSrcCell
=
aCol
[
rCol
].
GetCellValue
(
static_cast
<
SCROW
>
(
nSource
));
else
// rInner&:=nCol, rOuter&:=nRow
aSrcCell
=
aCol
[
nSource
].
GetCellValue
(
static_cast
<
SCROW
>
(
rRow
));
bGetCell
=
false
;
if
(
!
aSrcCell
.
isEmpty
())
{
eCellType
=
aSrcCell
.
meType
;
switch
(
eCellType
)
{
case
CELLTYPE_STRING
:
case
CELLTYPE_EDIT
:
if
(
eCellType
==
CELLTYPE_STRING
)
aValue
=
aSrcCell
.
mpString
->
getString
();
else
aValue
=
ScEditUtil
::
GetString
(
*
aSrcCell
.
mpEditText
,
pDocument
);
if
(
!
(
nScFillModeMouseModifier
&
KEY_MOD1
)
&&
!
bHasFiltered
)
{
nCellDigits
=
0
;
// look at each source cell individually
nHeadNoneTail
=
lcl_DecompValueString
(
aValue
,
nStringValue
,
&
nCellDigits
);
bIsOrdinalSuffix
=
aValue
.
equals
(
ScGlobal
::
GetOrdinalSuffix
(
nStringValue
));
}
break
;
default
:
{
// added to avoid warnings
}
}
}
else
eCellType
=
CELLTYPE_NONE
;
}
switch
(
eCellType
)
{
case
CELLTYPE_VALUE
:
aCol
[
rCol
].
SetValue
(
static_cast
<
SCROW
>
(
rRow
),
aSrcCell
.
mfValue
+
nDelta
);
break
;
case
CELLTYPE_STRING
:
case
CELLTYPE_EDIT
:
if
(
nHeadNoneTail
)
{
// #i48009# with the "nStringValue+(long)nDelta" expression within the
// lcl_ValueString calls, gcc 3.4.1 makes wrong optimizations (ok in 3.4.3),
// so nNextValue is now calculated ahead.
sal_Int32
nNextValue
=
nStringValue
+
(
sal_Int32
)
nDelta
;
OUString
aStr
;
if
(
nHeadNoneTail
<
0
)
{
setSuffixCell
(
aCol
[
rCol
],
static_cast
<
SCROW
>
(
rRow
),
nNextValue
,
nCellDigits
,
aValue
,
eCellType
,
bIsOrdinalSuffix
);
}
else
{
aStr
=
aValue
+
lcl_ValueString
(
nNextValue
,
nCellDigits
);
aCol
[
rCol
].
SetRawString
(
static_cast
<
SCROW
>
(
rRow
),
aStr
);
}
}
else
aSrcCell
.
commit
(
aCol
[
rCol
],
rRow
);
break
;
case
CELLTYPE_FORMULA
:
FillFormula
(
aSrcCell
.
mpFormula
,
static_cast
<
SCCOL
>
(
rCol
),
static_cast
<
SCROW
>
(
rRow
),
(
rInner
==
nIEnd
)
);
if
(
nFormulaCounter
-
nActFormCnt
>
nMaxFormCnt
)
nMaxFormCnt
=
nFormulaCounter
-
nActFormCnt
;
break
;
default
:
{
// added to avoid warnings
}
}
if
(
nSource
==
nISrcEnd
)
{
if
(
nSource
!=
nISrcStart
)
{
// More than one source cell
nSource
=
nISrcStart
;
bGetCell
=
true
;
}
if
(
!
(
nScFillModeMouseModifier
&
KEY_MOD1
)
)
{
if
(
bPositive
)
nDelta
+=
1.0
;
else
nDelta
-=
1.0
;
}
nFormulaCounter
=
nActFormCnt
;
}
else
if
(
bPositive
)
{
++
nSource
;
bGetCell
=
true
;
}
else
{
--
nSource
;
bGetCell
=
true
;
}
}
if
(
rInner
==
nIEnd
)
break
;
if
(
bPositive
)
++
rInner
;
else
--
rInner
;
// Progress in inner loop only for expensive cells,
// and even then not individually for each one
++
rProgress
;
if
(
pProgress
&&
(
eCellType
==
CELLTYPE_FORMULA
||
eCellType
==
CELLTYPE_EDIT
)
)
pProgress
->
SetStateOnPercent
(
rProgress
);
}
if
(
pProgress
)
pProgress
->
SetStateOnPercent
(
rProgress
);
}
void
ScTable
::
FillSeries
(
SCCOL
nCol1
,
SCROW
nRow1
,
SCCOL
nCol2
,
SCROW
nRow2
,
sal_uLong
nFillCount
,
FillDir
eFillDir
,
FillCmd
eFillCmd
,
FillDateCmd
eFillDateCmd
,
double
nStepValue
,
double
nMaxValue
,
sal_uInt16
nArgMinDigits
,
...
...
@@ -1562,7 +1569,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if
(
eFillCmd
==
FILL_SIMPLE
)
// copy
{
FillSimple
(
aSrcCell
,
rInner
,
nIMin
,
nIMax
,
nCol
,
nRow
,
bVertical
,
pProgress
,
nProgress
);
FillS
eriesS
imple
(
aSrcCell
,
rInner
,
nIMin
,
nIMax
,
nCol
,
nRow
,
bVertical
,
pProgress
,
nProgress
);
}
else
if
(
eCellType
==
CELLTYPE_VALUE
||
eCellType
==
CELLTYPE_FORMULA
)
{
...
...
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