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
eb33ef93
Kaydet (Commit)
eb33ef93
authored
Eki 14, 2015
tarafından
Lionel Elie Mamane
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
tdf#93390 correctly handle back-and-forth between numeric and text value
Change-Id: I06711afd5d668816608661f0fe433efd93fef99e
üst
96983b2a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
17 deletions
+19
-17
fmtfield.hxx
include/svtools/fmtfield.hxx
+3
-2
fmtfield.cxx
svtools/source/control/fmtfield.cxx
+16
-15
No files found.
include/svtools/fmtfield.hxx
Dosyayı görüntüle @
eb33ef93
...
...
@@ -66,10 +66,11 @@ protected:
bool
m_bStrictFormat
:
1
;
bool
m_bValueDirty
:
1
;
bool
m_bEnableEmptyField
:
1
;
bool
m_bAutoColor
:
1
;
bool
m_bEnableNaN
:
1
;
enum
valueState
{
valueDirty
,
valueString
,
valueDouble
};
valueState
m_ValueState
;
double
m_dCurrentValue
;
double
m_dDefaultValue
;
...
...
@@ -119,7 +120,7 @@ public:
void
EnableEmptyField
(
bool
bEnable
);
// If disabled, the value will be resetted to the last valid value on leave
void
SetDefaultValue
(
double
dDefault
)
{
m_dDefaultValue
=
dDefault
;
m_
bValueDirty
=
true
;
}
void
SetDefaultValue
(
double
dDefault
)
{
m_dDefaultValue
=
dDefault
;
m_
ValueState
=
valueDirty
;
}
// If the current String is invalid, GetValue() returns this value
double
GetDefaultValue
()
const
{
return
m_dDefaultValue
;
}
...
...
svtools/source/control/fmtfield.cxx
Dosyayı görüntüle @
eb33ef93
...
...
@@ -304,10 +304,10 @@ FormattedField::FormattedField(vcl::Window* pParent, WinBits nStyle, SvNumberFor
,
m_bHasMin
(
false
)
,
m_bHasMax
(
false
)
,
m_bStrictFormat
(
true
)
,
m_bValueDirty
(
true
)
,
m_bEnableEmptyField
(
true
)
,
m_bAutoColor
(
false
)
,
m_bEnableNaN
(
false
)
,
m_ValueState
(
valueDirty
)
,
m_dCurrentValue
(
0
)
,
m_dDefaultValue
(
0
)
,
m_nFormatKey
(
0
)
...
...
@@ -333,14 +333,14 @@ void FormattedField::SetText(const OUString& rStr)
{
SpinField
::
SetText
(
rStr
);
m_
bValueDirty
=
true
;
m_
ValueState
=
valueDirty
;
}
void
FormattedField
::
SetText
(
const
OUString
&
rStr
,
const
Selection
&
rNewSelection
)
{
SpinField
::
SetText
(
rStr
,
rNewSelection
);
m_
bValueDirty
=
true
;
m_
ValueState
=
valueDirty
;
}
void
FormattedField
::
SetTextFormatted
(
const
OUString
&
rStr
)
...
...
@@ -402,15 +402,15 @@ void FormattedField::SetTextFormatted(const OUString& rStr)
else
aNewSel
=
aSel
;
// don't use the justified version
SpinField
::
SetText
(
sFormatted
,
aNewSel
);
m_
bValueDirty
=
false
;
m_
ValueState
=
valueString
;
}
OUString
FormattedField
::
GetTextValue
()
const
{
if
(
m_
bValueDirty
)
if
(
m_
ValueState
!=
valueString
)
{
const_cast
<
FormattedField
*>
(
this
)
->
m_sCurrentTextValue
=
GetText
();
const_cast
<
FormattedField
*>
(
this
)
->
m_
bValueDirty
=
false
;
const_cast
<
FormattedField
*>
(
this
)
->
m_
ValueState
=
valueString
;
}
return
m_sCurrentTextValue
;
}
...
...
@@ -444,7 +444,7 @@ void FormattedField::impl_Modify(bool makeValueDirty)
if
(
!
IsStrictFormat
())
{
if
(
makeValueDirty
)
m_
bValueDirty
=
true
;
m_
ValueState
=
valueDirty
;
SpinField
::
Modify
();
return
;
}
...
...
@@ -455,7 +455,7 @@ void FormattedField::impl_Modify(bool makeValueDirty)
m_sLastValidText
=
sCheck
;
m_aLastSelection
=
GetSelection
();
if
(
makeValueDirty
)
m_
bValueDirty
=
true
;
m_
ValueState
=
valueDirty
;
}
else
{
...
...
@@ -518,7 +518,7 @@ void FormattedField::ImplSetTextImpl(const OUString& rNew, Selection* pNewSel)
SpinField
::
SetText
(
rNew
,
aSel
);
}
m_
bValueDirty
=
true
;
// not always necessary, but better re-evaluate for safety reasons
m_
ValueState
=
valueDirty
;
// not always necessary, but better re-evaluate for safety reasons
}
bool
FormattedField
::
PreNotify
(
NotifyEvent
&
rNEvt
)
...
...
@@ -800,6 +800,7 @@ bool FormattedField::Notify(NotifyEvent& rNEvt)
{
ImplSetValue
(
m_dCurrentValue
,
true
);
Modify
();
m_ValueState
=
valueDouble
;
}
else
{
...
...
@@ -808,8 +809,8 @@ bool FormattedField::Notify(NotifyEvent& rNEvt)
SetTextFormatted
(
sNew
);
else
SetTextFormatted
(
m_sDefaultText
);
m_ValueState
=
valueString
;
}
m_bValueDirty
=
false
;
}
}
else
...
...
@@ -869,7 +870,7 @@ void FormattedField::ImplSetValue(double dVal, bool bForce)
DBG_ASSERT
(
ImplGetFormatter
()
!=
NULL
,
"FormattedField::ImplSetValue : can't set a value without a formatter !"
);
m_
bValueDirty
=
fals
e
;
m_
ValueState
=
valueDoubl
e
;
m_dCurrentValue
=
dVal
;
OUString
sNewText
;
...
...
@@ -894,7 +895,7 @@ void FormattedField::ImplSetValue(double dVal, bool bForce)
}
ImplSetTextImpl
(
sNewText
,
NULL
);
m_
bValueDirty
=
fals
e
;
m_
ValueState
=
valueDoubl
e
;
DBG_ASSERT
(
CheckText
(
sNewText
),
"FormattedField::ImplSetValue : formatted string doesn't match the criteria !"
);
}
...
...
@@ -902,7 +903,7 @@ bool FormattedField::ImplGetValue(double& dNewVal)
{
dNewVal
=
m_dCurrentValue
;
if
(
!
m_bValueDirty
)
if
(
m_ValueState
==
valueDouble
)
return
true
;
dNewVal
=
m_dDefaultValue
;
...
...
@@ -948,7 +949,7 @@ bool FormattedField::ImplGetValue(double& dNewVal)
void
FormattedField
::
SetValue
(
double
dVal
)
{
ImplSetValue
(
dVal
,
m_
bValueDirty
);
ImplSetValue
(
dVal
,
m_
ValueState
!=
valueDouble
);
}
double
FormattedField
::
GetValue
()
...
...
@@ -962,7 +963,7 @@ double FormattedField::GetValue()
m_dCurrentValue
=
m_dDefaultValue
;
}
m_
bValueDirty
=
fals
e
;
m_
ValueState
=
valueDoubl
e
;
return
m_dCurrentValue
;
}
...
...
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