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
f96c760b
Kaydet (Commit)
f96c760b
authored
Mar 07, 2012
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More scope reduction.
üst
dcf9b304
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
84 deletions
+85
-84
dpgroup.cxx
sc/source/core/data/dpgroup.cxx
+85
-84
No files found.
sc/source/core/data/dpgroup.cxx
Dosyayı görüntüle @
f96c760b
...
...
@@ -874,107 +874,108 @@ const std::vector<SCROW>& ScDPNumGroupDimension::GetNumEntries(
if
(
!
maMemberEntries
.
empty
())
return
maMemberEntries
;
SvNumberFormatter
*
pFormatter
=
pCache
->
GetDoc
()
->
GetFormatTable
();
if
(
pDateHelper
)
if
(
pDateHelper
)
{
// Grouped by dates.
pDateHelper
->
FillColumnEntries
(
nSourceDim
,
const_cast
<
ScDPCache
*>
(
pCache
),
maMemberEntries
,
rOriginal
);
else
{
// Copy textual entries.
// Also look through the source entries for non-integer numbers, minimum and maximum.
// GetNumEntries (GetColumnEntries) must be called before accessing the groups
// (this in ensured by calling ScDPLevel::GetMembersObject for all column/row/page
// dimensions before iterating over the values).
cDecSeparator
=
ScGlobal
::
pLocaleData
->
getNumDecimalSep
().
GetChar
(
0
);
// non-integer GroupInfo values count, too
bHasNonInteger
=
(
!
aGroupInfo
.
mbAutoStart
&&
!
IsInteger
(
aGroupInfo
.
mfStart
)
)
||
(
!
aGroupInfo
.
mbAutoEnd
&&
!
IsInteger
(
aGroupInfo
.
mfEnd
)
)
||
!
IsInteger
(
aGroupInfo
.
mfStep
);
double
fSourceMin
=
0.0
;
double
fSourceMax
=
0.0
;
bool
bFirst
=
true
;
size_t
nOriginalCount
=
rOriginal
.
size
();
for
(
size_t
nOriginalPos
=
0
;
nOriginalPos
<
nOriginalCount
;
nOriginalPos
++
)
{
const
ScDPItemData
*
pItemData
=
pCache
->
GetItemDataById
(
nSourceDim
,
rOriginal
[
nOriginalPos
]
);
return
maMemberEntries
;
}
// Copy textual entries.
// Also look through the source entries for non-integer numbers, minimum and maximum.
// GetNumEntries (GetColumnEntries) must be called before accessing the groups
// (this in ensured by calling ScDPLevel::GetMembersObject for all column/row/page
// dimensions before iterating over the values).
cDecSeparator
=
ScGlobal
::
pLocaleData
->
getNumDecimalSep
().
GetChar
(
0
);
// non-integer GroupInfo values count, too
bHasNonInteger
=
(
!
aGroupInfo
.
mbAutoStart
&&
!
IsInteger
(
aGroupInfo
.
mfStart
)
)
||
(
!
aGroupInfo
.
mbAutoEnd
&&
!
IsInteger
(
aGroupInfo
.
mfEnd
)
)
||
!
IsInteger
(
aGroupInfo
.
mfStep
);
double
fSourceMin
=
0.0
;
double
fSourceMax
=
0.0
;
bool
bFirst
=
true
;
if
(
pItemData
&&
pItemData
->
HasStringData
()
)
size_t
nOriginalCount
=
rOriginal
.
size
();
for
(
size_t
nOriginalPos
=
0
;
nOriginalPos
<
nOriginalCount
;
nOriginalPos
++
)
{
const
ScDPItemData
*
pItemData
=
pCache
->
GetItemDataById
(
nSourceDim
,
rOriginal
[
nOriginalPos
]
);
if
(
pItemData
&&
pItemData
->
HasStringData
()
)
{
lcl_Insert
(
nSourceDim
,
pCache
,
maMemberEntries
,
rOriginal
[
nOriginalPos
]
);
}
else
{
double
fSourceValue
=
pItemData
->
GetValue
();
if
(
bFirst
)
{
lcl_Insert
(
nSourceDim
,
pCache
,
maMemberEntries
,
rOriginal
[
nOriginalPos
]
);
fSourceMin
=
fSourceMax
=
fSourceValue
;
bFirst
=
false
;
}
else
{
double
fSourceValue
=
pItemData
->
GetValue
();
if
(
bFirst
)
{
fSourceMin
=
fSourceMax
=
fSourceValue
;
bFirst
=
false
;
}
else
{
if
(
fSourceValue
<
fSourceMin
)
fSourceMin
=
fSourceValue
;
if
(
fSourceValue
>
fSourceMax
)
fSourceMax
=
fSourceValue
;
}
if
(
!
bHasNonInteger
&&
!
IsInteger
(
fSourceValue
)
)
{
// if any non-integer numbers are involved, the group labels are
// shown including their upper limit
bHasNonInteger
=
true
;
}
if
(
fSourceValue
<
fSourceMin
)
fSourceMin
=
fSourceValue
;
if
(
fSourceValue
>
fSourceMax
)
fSourceMax
=
fSourceValue
;
}
}
if
(
!
bHasNonInteger
&&
!
IsInteger
(
fSourceValue
)
)
{
// if any non-integer numbers are involved, the group labels are
// shown including their upper limit
bHasNonInteger
=
true
;
}
}
}
if
(
aGroupInfo
.
mbDateValues
)
{
// special handling for dates: always integer, round down limits
bHasNonInteger
=
false
;
fSourceMin
=
rtl
::
math
::
approxFloor
(
fSourceMin
);
fSourceMax
=
rtl
::
math
::
approxFloor
(
fSourceMax
)
+
1
;
}
if
(
aGroupInfo
.
mbDateValues
)
{
// special handling for dates: always integer, round down limits
bHasNonInteger
=
false
;
fSourceMin
=
rtl
::
math
::
approxFloor
(
fSourceMin
);
fSourceMax
=
rtl
::
math
::
approxFloor
(
fSourceMax
)
+
1
;
}
if
(
aGroupInfo
.
mbAutoStart
)
const_cast
<
ScDPNumGroupDimension
*>
(
this
)
->
aGroupInfo
.
mfStart
=
fSourceMin
;
if
(
aGroupInfo
.
mbAutoEnd
)
const_cast
<
ScDPNumGroupDimension
*>
(
this
)
->
aGroupInfo
.
mfEnd
=
fSourceMax
;
if
(
aGroupInfo
.
mbAutoStart
)
const_cast
<
ScDPNumGroupDimension
*>
(
this
)
->
aGroupInfo
.
mfStart
=
fSourceMin
;
if
(
aGroupInfo
.
mbAutoEnd
)
const_cast
<
ScDPNumGroupDimension
*>
(
this
)
->
aGroupInfo
.
mfEnd
=
fSourceMax
;
//! limit number of entries?
//! limit number of entries?
long
nLoopCount
=
0
;
double
fLoop
=
aGroupInfo
.
mfStart
;
long
nLoopCount
=
0
;
double
fLoop
=
aGroupInfo
.
mfStart
;
// Use "less than" instead of "less or equal" for the loop - don't create a group
// that consists only of the end value. Instead, the end value is then included
// in the last group (last group is bigger than the others).
// The first group has to be created nonetheless. GetNumGroupForValue has corresponding logic.
// Use "less than" instead of "less or equal" for the loop - don't create a group
// that consists only of the end value. Instead, the end value is then included
// in the last group (last group is bigger than the others).
// The first group has to be created nonetheless. GetNumGroupForValue has corresponding logic.
bool
bFirstGroup
=
true
;
while
(
bFirstGroup
||
(
fLoop
<
aGroupInfo
.
mfEnd
&&
!
rtl
::
math
::
approxEqual
(
fLoop
,
aGroupInfo
.
mfEnd
)
)
)
{
String
aName
=
lcl_GetNumGroupName
(
fLoop
,
aGroupInfo
,
bHasNonInteger
,
cDecSeparator
,
pFormatter
);
// create a numerical entry to ensure proper sorting
// (in FillMemberResults this needs special handling)
lcl_InsertValue
<
true
>
(
nSourceDim
,
pCache
,
maMemberEntries
,
aName
,
fLoop
);
++
nLoopCount
;
fLoop
=
aGroupInfo
.
mfStart
+
nLoopCount
*
aGroupInfo
.
mfStep
;
bFirstGroup
=
false
;
// ScDPItemData values are compared with approxEqual
}
bool
bFirstGroup
=
true
;
SvNumberFormatter
*
pFormatter
=
pCache
->
GetDoc
()
->
GetFormatTable
();
while
(
bFirstGroup
||
(
fLoop
<
aGroupInfo
.
mfEnd
&&
!
rtl
::
math
::
approxEqual
(
fLoop
,
aGroupInfo
.
mfEnd
)
)
)
{
String
aName
=
lcl_GetNumGroupName
(
fLoop
,
aGroupInfo
,
bHasNonInteger
,
cDecSeparator
,
pFormatter
);
// create a numerical entry to ensure proper sorting
// (in FillMemberResults this needs special handling)
lcl_InsertValue
<
true
>
(
nSourceDim
,
pCache
,
maMemberEntries
,
aName
,
fLoop
);
++
nLoopCount
;
fLoop
=
aGroupInfo
.
mfStart
+
nLoopCount
*
aGroupInfo
.
mfStep
;
bFirstGroup
=
false
;
// ScDPItemData values are compared with approxEqual
}
String
aFirstName
=
lcl_GetSpecialNumGroupName
(
aGroupInfo
.
mfStart
,
true
,
cDecSeparator
,
aGroupInfo
.
mbDateValues
,
pFormatter
);
lcl_InsertValue
<
true
>
(
nSourceDim
,
pCache
,
maMemberEntries
,
aFirstName
,
aGroupInfo
.
mfStart
-
aGroupInfo
.
mfStep
);
String
aFirstName
=
lcl_GetSpecialNumGroupName
(
aGroupInfo
.
mfStart
,
true
,
cDecSeparator
,
aGroupInfo
.
mbDateValues
,
pFormatter
);
lcl_InsertValue
<
true
>
(
nSourceDim
,
pCache
,
maMemberEntries
,
aFirstName
,
aGroupInfo
.
mfStart
-
aGroupInfo
.
mfStep
);
String
aLastName
=
lcl_GetSpecialNumGroupName
(
aGroupInfo
.
mfEnd
,
false
,
cDecSeparator
,
aGroupInfo
.
mbDateValues
,
pFormatter
);
lcl_InsertValue
<
true
>
(
nSourceDim
,
pCache
,
maMemberEntries
,
aLastName
,
aGroupInfo
.
mfEnd
+
aGroupInfo
.
mfStep
);
String
aLastName
=
lcl_GetSpecialNumGroupName
(
aGroupInfo
.
mfEnd
,
false
,
cDecSeparator
,
aGroupInfo
.
mbDateValues
,
pFormatter
);
lcl_InsertValue
<
true
>
(
nSourceDim
,
pCache
,
maMemberEntries
,
aLastName
,
aGroupInfo
.
mfEnd
+
aGroupInfo
.
mfStep
);
fprintf
(
stdout
,
"ScDPNumGroupDimension::GetNumEntries: FIXME
\n
"
);
}
fprintf
(
stdout
,
"ScDPNumGroupDimension::GetNumEntries: FIXME
\n
"
);
return
maMemberEntries
;
}
...
...
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