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
f26bf2ba
Kaydet (Commit)
f26bf2ba
authored
May 10, 2012
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
first part for min/max in color scales
Change-Id: Ib397b93ac0a5a72052fdaa5bf41199e5967ad559
üst
d16c1b92
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
167 additions
and
1 deletion
+167
-1
colorscale.hxx
sc/inc/colorscale.hxx
+17
-1
colorscale.cxx
sc/source/core/data/colorscale.cxx
+150
-0
No files found.
sc/inc/colorscale.hxx
Dosyayı görüntüle @
f26bf2ba
...
...
@@ -39,21 +39,37 @@ class SC_DLLPUBLIC ScColorScaleEntry
private
:
double
mnVal
;
Color
maColor
;
bool
mbMin
;
bool
mbMax
;
bool
mbPercent
;
public
:
ScColorScaleEntry
(
double
nVal
,
const
Color
&
rCol
);
ScColorScaleEntry
(
const
ScColorScaleEntry
&
rEntry
);
const
Color
&
GetColor
()
const
;
double
GetValue
()
const
;
bool
GetMin
()
const
;
bool
GetMax
()
const
;
bool
GetPercent
()
const
;
void
SetMin
(
bool
bMin
);
void
SetMax
(
bool
bMax
);
void
SetPercent
(
bool
bPercent
);
};
class
SC_DLLPUBLIC
ScColorScaleFormat
{
private
:
ScRangeList
maRange
;
ScRangeList
maRange
s
;
ScDocument
*
mpDoc
;
typedef
boost
::
ptr_vector
<
ScColorScaleEntry
>
ColorScaleEntries
;
ColorScaleEntries
maColorScales
;
double
GetMinValue
()
const
;
double
GetMaxValue
()
const
;
void
calcMinMax
(
double
&
nMin
,
double
nMax
)
const
;
public
:
ScColorScaleFormat
(
ScDocument
*
pDoc
);
...
...
sc/source/core/data/colorscale.cxx
Dosyayı görüntüle @
f26bf2ba
...
...
@@ -64,6 +64,152 @@ void ScColorScaleFormat::AddEntry( ScColorScaleEntry* pEntry )
maColorScales
.
push_back
(
pEntry
);
}
bool
ScColorScaleEntry
::
GetMin
()
const
{
return
mbMin
;
}
bool
ScColorScaleEntry
::
GetMax
()
const
{
return
mbMax
;
}
bool
ScColorScaleEntry
::
GetPercent
()
const
{
return
mbPercent
;
}
void
ScColorScaleEntry
::
SetMin
(
bool
bMin
)
{
mbMin
=
bMin
;
}
void
ScColorScaleEntry
::
SetMax
(
bool
bMax
)
{
mbMax
=
bMax
;
}
void
ScColorScaleEntry
::
SetPercent
(
bool
bPercent
)
{
mbPercent
=
bPercent
;
}
namespace
{
double
getMinValue
(
const
ScRange
&
rRange
,
ScDocument
*
pDoc
)
{
double
aMinValue
=
std
::
numeric_limits
<
double
>::
max
();
//iterate through columns
SCTAB
nTab
=
rRange
.
aStart
.
Tab
();
for
(
SCCOL
nCol
=
rRange
.
aStart
.
Col
();
nCol
<=
rRange
.
aEnd
.
Col
();
++
nCol
)
{
for
(
SCROW
nRow
=
rRange
.
aStart
.
Row
();
nRow
<=
rRange
.
aEnd
.
Row
();
++
nRow
)
{
ScAddress
aAddr
(
nCol
,
nRow
,
rRange
.
aStart
.
Tab
());
CellType
eType
=
pDoc
->
GetCellType
(
aAddr
);
if
(
eType
==
CELLTYPE_VALUE
)
{
double
aVal
=
pDoc
->
GetValue
(
nCol
,
nRow
,
nTab
);
if
(
aVal
<
aMinValue
)
aMinValue
=
aVal
;
}
else
if
(
eType
==
CELLTYPE_FORMULA
)
{
if
(
static_cast
<
ScFormulaCell
*>
(
pDoc
->
GetCell
(
aAddr
))
->
IsValue
())
{
double
aVal
=
pDoc
->
GetValue
(
nCol
,
nRow
,
nTab
);
if
(
aVal
<
aMinValue
)
aMinValue
=
aVal
;
}
}
}
}
return
aMinValue
;
}
double
getMaxValue
(
const
ScRange
&
rRange
,
ScDocument
*
pDoc
)
{
double
aMaxValue
=
std
::
numeric_limits
<
double
>::
min
();
//iterate through columns
SCTAB
nTab
=
rRange
.
aStart
.
Tab
();
for
(
SCCOL
nCol
=
rRange
.
aStart
.
Col
();
nCol
<=
rRange
.
aEnd
.
Col
();
++
nCol
)
{
for
(
SCROW
nRow
=
rRange
.
aStart
.
Row
();
nRow
<=
rRange
.
aEnd
.
Row
();
++
nRow
)
{
ScAddress
aAddr
(
nCol
,
nRow
,
rRange
.
aStart
.
Tab
());
CellType
eType
=
pDoc
->
GetCellType
(
aAddr
);
if
(
eType
==
CELLTYPE_VALUE
)
{
double
aVal
=
pDoc
->
GetValue
(
nCol
,
nRow
,
nTab
);
if
(
aVal
>
aMaxValue
)
aMaxValue
=
aVal
;
}
else
if
(
eType
==
CELLTYPE_FORMULA
)
{
if
(
static_cast
<
ScFormulaCell
*>
(
pDoc
->
GetCell
(
aAddr
))
->
IsValue
())
{
double
aVal
=
pDoc
->
GetValue
(
nCol
,
nRow
,
nTab
);
if
(
aVal
>
aMaxValue
)
aMaxValue
=
aVal
;
}
}
}
}
return
aMaxValue
;
}
}
double
ScColorScaleFormat
::
GetMinValue
()
const
{
const_iterator
itr
=
maColorScales
.
begin
();
double
aMinValue
=
std
::
numeric_limits
<
double
>::
max
();
if
(
!
itr
->
GetMin
())
return
itr
->
GetValue
();
else
{
size_t
n
=
maRanges
.
size
();
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
const
ScRange
*
pRange
=
maRanges
[
i
];
double
aVal
=
getMinValue
(
*
pRange
,
mpDoc
);
if
(
aVal
<
aMinValue
)
aMinValue
=
aVal
;
}
}
return
aMinValue
;
}
double
ScColorScaleFormat
::
GetMaxValue
()
const
{
ColorScaleEntries
::
const_reverse_iterator
itr
=
maColorScales
.
rbegin
();
double
aMaxVal
=
std
::
numeric_limits
<
double
>::
min
();
if
(
!
itr
->
GetMax
())
return
itr
->
GetValue
();
else
{
size_t
n
=
maRanges
.
size
();
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
const
ScRange
*
pRange
=
maRanges
[
i
];
double
aVal
=
getMaxValue
(
*
pRange
,
mpDoc
);
if
(
aVal
>
aMaxVal
)
aMaxVal
=
aVal
;
}
}
return
aMaxVal
;;
}
void
ScColorScaleFormat
::
calcMinMax
(
double
&
rMin
,
double
rMax
)
const
{
rMin
=
GetMinValue
();
rMax
=
GetMaxValue
();
}
namespace
{
sal_uInt8
GetColorValue
(
double
nVal
,
double
nVal1
,
sal_uInt8
nColVal1
,
double
nVal2
,
sal_uInt8
nColVal2
)
...
...
@@ -114,6 +260,10 @@ Color* ScColorScaleFormat::GetColor( const ScAddress& rAddr ) const
double
nValMax
=
itr
->
GetValue
();
Color
rColMax
=
itr
->
GetColor
();
double
nMin
;
double
nMax
;
calcMinMax
(
nMin
,
nMax
);
++
itr
;
while
(
itr
!=
end
()
&&
nVal
>
nValMin
)
{
...
...
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