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
95634322
Kaydet (Commit)
95634322
authored
Kas 15, 2012
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
initial work for date conditional formats
Change-Id: Ifba8a4061e898a031004c20222e78eb825f07e4e
üst
ced69036
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
162 additions
and
1 deletion
+162
-1
conditio.hxx
sc/inc/conditio.hxx
+55
-1
conditio.cxx
sc/source/core/data/conditio.cxx
+107
-0
No files found.
sc/inc/conditio.hxx
Dosyayı görüntüle @
95634322
...
...
@@ -95,7 +95,8 @@ enum ScFormatEntryType
CONDITION
,
COLORSCALE
,
DATABAR
,
ICONSET
ICONSET
,
DATE
};
}
...
...
@@ -324,6 +325,59 @@ protected:
virtual
void
DataChanged
(
const
ScRange
*
pModified
)
const
;
};
namespace
condformat
{
enum
ScCondFormatDateType
{
YESTERDAY
,
TOMORROW
,
TODAY
,
LAST7DAYS
,
LASTWEEK
,
THISWEEK
,
NEXTWEEK
,
LASTMONTH
,
THISMONTH
,
NEXTMONTH
};
}
class
SC_DLLPUBLIC
ScCondDateFormatEntry
:
public
ScFormatEntry
{
public
:
ScCondDateFormatEntry
(
ScDocument
*
pDoc
);
ScCondDateFormatEntry
(
ScDocument
*
pDoc
,
const
ScCondDateFormatEntry
&
rEntry
);
bool
IsValid
(
const
ScAddress
&
rPos
)
const
;
void
SetDateType
(
condformat
::
ScCondFormatDateType
eType
);
condformat
::
ScCondFormatDateType
GetDateType
()
const
;
const
rtl
::
OUString
&
GetStyleName
()
const
;
void
SetStyleName
(
const
rtl
::
OUString
&
rStyleName
);
virtual
condformat
::
ScFormatEntryType
GetType
()
const
{
return
condformat
::
DATE
;
}
virtual
void
UpdateReference
(
UpdateRefMode
,
const
ScRange
&
,
SCsCOL
,
SCsROW
,
SCsTAB
)
{}
virtual
void
UpdateMoveTab
(
SCTAB
,
SCTAB
)
{}
virtual
ScFormatEntry
*
Clone
(
ScDocument
*
pDoc
=
NULL
)
const
;
virtual
void
SetParent
(
ScConditionalFormat
*
)
{}
bool
operator
==
(
const
ScFormatEntry
&
)
const
;
#if DUMP_FORMAT_INFO
virtual
void
dumpInfo
(
rtl
::
OUStringBuffer
&
rBuf
)
const
;
#endif
private
:
condformat
::
ScCondFormatDateType
meType
;
rtl
::
OUString
maStyleName
;
};
//
// complete conditional formatting
//
...
...
sc/source/core/data/conditio.cxx
Dosyayı görüntüle @
95634322
...
...
@@ -1628,6 +1628,101 @@ ScFormatEntry* ScCondFormatEntry::Clone( ScDocument* pDoc ) const
//------------------------------------------------------------------------
ScCondDateFormatEntry
::
ScCondDateFormatEntry
(
ScDocument
*
pDoc
)
:
ScFormatEntry
(
pDoc
)
{
}
ScCondDateFormatEntry
::
ScCondDateFormatEntry
(
ScDocument
*
pDoc
,
const
ScCondDateFormatEntry
&
rFormat
)
:
ScFormatEntry
(
pDoc
),
meType
(
rFormat
.
meType
),
maStyleName
(
rFormat
.
maStyleName
)
{
}
bool
ScCondDateFormatEntry
::
IsValid
(
const
ScAddress
&
rPos
)
const
{
ScBaseCell
*
pBaseCell
=
mpDoc
->
GetCell
(
rPos
);
if
(
!
pBaseCell
)
return
false
;
if
(
pBaseCell
->
GetCellType
()
!=
CELLTYPE_VALUE
&&
pBaseCell
->
GetCellType
()
!=
CELLTYPE_FORMULA
)
return
false
;
double
nVal
=
mpDoc
->
GetValue
(
rPos
);
long
nCellDate
=
static_cast
<
long
>
(
nVal
);
Date
aActDate
(
Date
::
SYSTEM
);
SvNumberFormatter
*
pFormatter
=
mpDoc
->
GetFormatTable
();
long
nCurrentDate
=
aActDate
-
*
(
pFormatter
->
GetNullDate
());
switch
(
meType
)
{
case
condformat
:
:
TODAY
:
if
(
nCurrentDate
==
nCellDate
)
return
true
;
break
;
case
condformat
:
:
TOMORROW
:
if
(
nCurrentDate
==
nCellDate
-
1
)
return
true
;
break
;
case
condformat
:
:
YESTERDAY
:
if
(
nCurrentDate
==
nCellDate
+
1
)
return
true
;
break
;
default
:
return
true
;
break
;
}
return
false
;
}
void
ScCondDateFormatEntry
::
SetDateType
(
condformat
::
ScCondFormatDateType
eType
)
{
meType
=
eType
;
}
condformat
::
ScCondFormatDateType
ScCondDateFormatEntry
::
GetDateType
()
const
{
return
meType
;
}
const
rtl
::
OUString
&
ScCondDateFormatEntry
::
GetStyleName
()
const
{
return
maStyleName
;
}
void
ScCondDateFormatEntry
::
SetStyleName
(
const
rtl
::
OUString
&
rStyleName
)
{
maStyleName
=
rStyleName
;
}
ScFormatEntry
*
ScCondDateFormatEntry
::
Clone
(
ScDocument
*
pDoc
)
const
{
return
new
ScCondDateFormatEntry
(
pDoc
,
*
this
);
}
bool
ScCondDateFormatEntry
::
operator
==
(
const
ScFormatEntry
&
r
)
const
{
if
(
r
.
GetType
()
!=
condformat
::
DATE
)
return
false
;
const
ScCondDateFormatEntry
&
rEntry
=
static_cast
<
const
ScCondDateFormatEntry
&>
(
r
);
if
(
rEntry
.
meType
!=
meType
)
return
false
;
return
rEntry
.
maStyleName
==
maStyleName
;
}
void
ScCondDateFormatEntry
::
dumpInfo
(
rtl
::
OUStringBuffer
&
rBuffer
)
const
{
rBuffer
.
append
(
"Date Format"
);
}
//------------------------------------------------------------------------
ScConditionalFormat
::
ScConditionalFormat
(
sal_uInt32
nNewKey
,
ScDocument
*
pDocument
)
:
pDoc
(
pDocument
),
nKey
(
nNewKey
)
...
...
@@ -1717,6 +1812,12 @@ const rtl::OUString& ScConditionalFormat::GetCellStyle( ScBaseCell* pCell, const
if
(
rEntry
.
IsCellValid
(
pCell
,
rPos
)
)
return
rEntry
.
GetStyle
();
}
else
if
(
itr
->
GetType
()
==
condformat
::
DATE
)
{
const
ScCondDateFormatEntry
&
rEntry
=
static_cast
<
const
ScCondDateFormatEntry
&>
(
*
itr
);
if
(
rEntry
.
IsValid
(
rPos
))
return
rEntry
.
GetStyleName
();
}
}
return
EMPTY_OUSTRING
;
...
...
@@ -1748,6 +1849,12 @@ ScCondFormatData ScConditionalFormat::GetData( ScBaseCell* pCell, const ScAddres
const
ScIconSetFormat
&
rEntry
=
static_cast
<
const
ScIconSetFormat
&>
(
*
itr
);
aData
.
pIconSet
=
rEntry
.
GetIconSetInfo
(
rPos
);
}
else
if
(
itr
->
GetType
()
==
condformat
::
DATE
&&
aData
.
aStyleName
.
isEmpty
())
{
const
ScCondDateFormatEntry
&
rEntry
=
static_cast
<
const
ScCondDateFormatEntry
&>
(
*
itr
);
if
(
rEntry
.
IsValid
(
rPos
)
)
aData
.
aStyleName
=
rEntry
.
GetStyleName
();
}
}
return
aData
;
}
...
...
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