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
0331fa6a
Kaydet (Commit)
0331fa6a
authored
Ock 13, 2015
tarafından
Lionel Elie Mamane
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
ListBox with value list: consider first empty value as NULL
Change-Id: I15c040b481b7f03720d0227ba5d2fcd2ccc78386
üst
1cc29a04
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
ListBox.cxx
forms/source/component/ListBox.cxx
+23
-11
ListBox.hxx
forms/source/component/ListBox.hxx
+4
-1
No files found.
forms/source/component/ListBox.cxx
Dosyayı görüntüle @
0331fa6a
...
...
@@ -79,6 +79,8 @@ namespace frm
using
::
connectivity
::
ORowSetValue
;
const
::
connectivity
::
ORowSetValue
OListBoxModel
::
s_aEmptyValue
;
const
::
connectivity
::
ORowSetValue
OListBoxModel
::
s_aEmptyStringValue
=
OUString
();
//= helper
...
...
@@ -1007,12 +1009,12 @@ namespace frm
void
OListBoxModel
::
onDisconnectedDbColumn
()
{
clearBoundValues
();
m_nNULLPos
=
-
1
;
m_nBoundColumnType
=
DataType
::
SQLNULL
;
if
(
m_eListSourceType
!=
ListSourceType_VALUELIST
)
{
clearBoundValues
();
m_nNULLPos
=
-
1
;
m_nBoundColumnType
=
DataType
::
SQLNULL
;
if
(
!
hasExternalListSource
()
)
setFastPropertyValue
(
PROPERTY_ID_STRINGITEMLIST
,
makeAny
(
StringSequence
()
)
);
...
...
@@ -1037,13 +1039,25 @@ namespace frm
void
OListBoxModel
::
convertBoundValues
(
const
sal_Int32
nFieldType
)
const
{
assert
(
s_aEmptyValue
.
isNull
());
m_nNULLPos
=
-
1
;
m_aConvertedBoundValues
.
resize
(
m_aBoundValues
.
size
());
ValueList
::
const_iterator
src
=
m_aBoundValues
.
begin
();
const
ValueList
::
const_iterator
end
=
m_aBoundValues
.
end
();
ValueList
::
iterator
dst
=
m_aConvertedBoundValues
.
begin
();
for
(;
src
!=
end
;
++
src
,
++
dst
)
{
*
dst
=
*
src
;
if
(
m_nNULLPos
==
-
1
&&
!
isRequired
()
&&
(
*
src
==
s_aEmptyStringValue
||
*
src
==
s_aEmptyValue
||
src
->
isNull
())
)
{
m_nNULLPos
=
src
-
m_aBoundValues
.
begin
();
dst
->
setNull
();
}
else
{
*
dst
=
*
src
;
}
dst
->
setTypeKind
(
nFieldType
);
}
m_nConvertedBoundValuesType
=
nFieldType
;
...
...
@@ -1090,21 +1104,19 @@ namespace frm
ORowSetValue
OListBoxModel
::
getFirstSelectedValue
()
const
{
static
const
ORowSetValue
s_aEmptyVaue
;
DBG_ASSERT
(
m_xAggregateFastSet
.
is
(),
"OListBoxModel::getFirstSelectedValue: invalid aggregate!"
);
if
(
!
m_xAggregateFastSet
.
is
()
)
return
s_aEmptyVaue
;
return
s_aEmptyVa
l
ue
;
Sequence
<
sal_Int16
>
aSelectedIndices
;
OSL_VERIFY
(
m_xAggregateFastSet
->
getFastPropertyValue
(
getValuePropertyAggHandle
()
)
>>=
aSelectedIndices
);
if
(
!
aSelectedIndices
.
getLength
()
)
// nothing selected at all
return
s_aEmptyVaue
;
return
s_aEmptyVa
l
ue
;
if
(
(
m_nNULLPos
!=
-
1
)
&&
(
aSelectedIndices
[
0
]
==
m_nNULLPos
)
)
// the dedicated "NULL" entry is selected
return
s_aEmptyVaue
;
return
s_aEmptyVa
l
ue
;
ValueList
aValues
(
impl_getValues
()
);
...
...
@@ -1112,7 +1124,7 @@ namespace frm
if
(
selectedValue
>=
aValues
.
size
()
)
{
SAL_WARN
(
"forms.component"
,
"OListBoxModel::getFirstSelectedValue: inconsistent selection/valuelist!"
);
return
s_aEmptyVaue
;
return
s_aEmptyVa
l
ue
;
}
return
aValues
[
selectedValue
];
...
...
forms/source/component/ListBox.hxx
Dosyayı görüntüle @
0331fa6a
...
...
@@ -114,7 +114,7 @@ class OListBoxModel :public OBoundControlModel
::
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int16
>
m_aDefaultSelectSeq
;
// DefaultSelected
// </properties>
sal_Int16
m_nNULLPos
;
// position of the NULL value in our list
mutable
sal_Int16
m_nNULLPos
;
// position of the NULL value in our list
sal_Int32
m_nBoundColumnType
;
private
:
...
...
@@ -145,6 +145,9 @@ public:
throw
(
::
com
::
sun
::
star
::
lang
::
IllegalArgumentException
)
SAL_OVERRIDE
;
protected
:
static
const
::
connectivity
::
ORowSetValue
s_aEmptyValue
;
static
const
::
connectivity
::
ORowSetValue
s_aEmptyStringValue
;
// XMultiPropertySet
virtual
void
SAL_CALL
setPropertyValues
(
const
::
com
::
sun
::
star
::
uno
::
Sequence
<
OUString
>&
PropertyNames
,
const
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
com
::
sun
::
star
::
uno
::
Any
>&
Values
)
throw
(
::
com
::
sun
::
star
::
beans
::
PropertyVetoException
,
::
com
::
sun
::
star
::
lang
::
IllegalArgumentException
,
::
com
::
sun
::
star
::
lang
::
WrappedTargetException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
,
std
::
exception
)
SAL_OVERRIDE
;
...
...
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