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
b8ca608a
Kaydet (Commit)
b8ca608a
authored
Nis 06, 2015
tarafından
Matteo Casalin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use more proper integer types and range-for loops
Change-Id: Ie32cef06ecb742e8545e4081d7f99181f5289397
üst
721024be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
38 deletions
+29
-38
edfld.cxx
sw/source/core/edit/edfld.cxx
+25
-31
edfldexp.cxx
sw/source/core/edit/edfldexp.cxx
+4
-7
No files found.
sw/source/core/edit/edfld.cxx
Dosyayı görüntüle @
b8ca608a
...
@@ -45,17 +45,16 @@
...
@@ -45,17 +45,16 @@
sal_uInt16
SwEditShell
::
GetFldTypeCount
(
sal_uInt16
nResId
,
bool
bUsed
)
const
sal_uInt16
SwEditShell
::
GetFldTypeCount
(
sal_uInt16
nResId
,
bool
bUsed
)
const
{
{
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
sal_uInt16
nSize
=
pFldTypes
->
size
();
if
(
nResId
==
USHRT_MAX
)
if
(
nResId
==
USHRT_MAX
)
{
{
if
(
!
bUsed
)
if
(
!
bUsed
)
return
nSize
;
return
static_cast
<
sal_uInt16
>
(
pFldTypes
->
size
())
;
sal_uInt16
nUsed
=
0
;
sal_uInt16
nUsed
=
0
;
for
(
sal_uInt16
i
=
0
;
i
<
nSize
;
i
++
)
for
(
const
auto
pFldType
:
*
pFldTypes
)
{
{
if
(
IsUsed
(
*
(
*
pFldTypes
)[
i
]
))
if
(
IsUsed
(
*
pFldType
))
nUsed
++
;
nUsed
++
;
}
}
return
nUsed
;
return
nUsed
;
...
@@ -63,10 +62,10 @@ sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, bool bUsed ) const
...
@@ -63,10 +62,10 @@ sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, bool bUsed ) const
// all types with the same ResId
// all types with the same ResId
sal_uInt16
nIdx
=
0
;
sal_uInt16
nIdx
=
0
;
for
(
sal_uInt16
i
=
0
;
i
<
nSize
;
++
i
)
for
(
const
auto
pFldType
:
*
pFldTypes
)
{
// same ResId -> increment index
{
SwFieldType
&
rFldType
=
*
((
*
pFldTypes
)[
i
]);
// same ResId -> increment index
if
(
rFldType
.
Which
()
==
nResId
)
if
(
pFldType
->
Which
()
==
nResId
)
nIdx
++
;
nIdx
++
;
}
}
return
nIdx
;
return
nIdx
;
...
@@ -76,30 +75,29 @@ sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, bool bUsed ) const
...
@@ -76,30 +75,29 @@ sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, bool bUsed ) const
SwFieldType
*
SwEditShell
::
GetFldType
(
sal_uInt16
nFld
,
sal_uInt16
nResId
,
bool
bUsed
)
const
SwFieldType
*
SwEditShell
::
GetFldType
(
sal_uInt16
nFld
,
sal_uInt16
nResId
,
bool
bUsed
)
const
{
{
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
sal_uInt16
nSize
=
pFldTypes
->
size
();
if
(
nResId
==
USHRT_MAX
&&
nFld
<
nSize
)
if
(
nResId
==
USHRT_MAX
&&
nFld
<
pFldTypes
->
size
()
)
{
{
if
(
!
bUsed
)
if
(
!
bUsed
)
return
(
*
pFldTypes
)[
nFld
];
return
(
*
pFldTypes
)[
nFld
];
sal_uInt16
i
,
nUsed
=
0
;
SwFldTypes
::
size_type
nUsed
=
0
;
for
(
i
=
0
;
i
<
nSize
;
i
++
)
for
(
const
auto
pFldType
:
*
pFldTypes
)
{
{
if
(
IsUsed
(
*
(
*
pFldTypes
)[
i
]
))
if
(
IsUsed
(
*
pFldType
))
{
{
if
(
nUsed
==
nFld
)
if
(
nUsed
==
nFld
)
break
;
return
pFldType
;
nUsed
++
;
nUsed
++
;
}
}
}
}
return
i
<
nSize
?
(
*
pFldTypes
)[
i
]
:
0
;
return
nullptr
;
}
}
sal_uInt16
nIdx
=
0
;
sal_uInt16
nIdx
=
0
;
for
(
sal_uInt16
i
=
0
;
i
<
nSize
;
++
i
)
for
(
const
auto
pFldType
:
*
pFldTypes
)
{
// same ResId -> increment index
{
SwFieldType
*
pFldType
=
(
*
pFldTypes
)[
i
];
// same ResId -> increment index
if
(
pFldType
->
Which
()
==
nResId
)
if
(
pFldType
->
Which
()
==
nResId
)
{
{
if
(
!
bUsed
||
IsUsed
(
*
pFldType
))
if
(
!
bUsed
||
IsUsed
(
*
pFldType
))
...
@@ -129,12 +127,11 @@ void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId)
...
@@ -129,12 +127,11 @@ void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId)
}
}
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
sal_uInt16
nSize
=
pFldTypes
->
size
();
sal_uInt16
nIdx
=
0
;
sal_uInt16
nIdx
=
0
;
for
(
sal_uInt16
i
=
0
;
i
<
nSize
;
++
i
)
const
SwFldTypes
::
size_type
nSize
=
pFldTypes
->
size
();
for
(
SwFldTypes
::
size_type
i
;
i
<
nSize
;
++
i
)
// Gleiche ResId -> Index erhoehen
// Gleiche ResId -> Index erhoehen
if
(
(
*
pFldTypes
)[
i
]
->
Which
()
==
nResId
&&
if
(
(
*
pFldTypes
)[
i
]
->
Which
()
==
nResId
&&
nIdx
++
==
nFld
)
nIdx
++
==
nFld
)
{
{
GetDoc
()
->
getIDocumentFieldsAccess
().
RemoveFldType
(
i
);
GetDoc
()
->
getIDocumentFieldsAccess
().
RemoveFldType
(
i
);
return
;
return
;
...
@@ -145,12 +142,12 @@ void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId)
...
@@ -145,12 +142,12 @@ void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId)
void
SwEditShell
::
RemoveFldType
(
sal_uInt16
nResId
,
const
OUString
&
rStr
)
void
SwEditShell
::
RemoveFldType
(
sal_uInt16
nResId
,
const
OUString
&
rStr
)
{
{
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
sal_uInt16
nSize
=
pFldTypes
->
size
();
const
SwFldTypes
::
size_type
nSize
=
pFldTypes
->
size
();
const
CharClass
&
rCC
=
GetAppCharClass
();
const
CharClass
&
rCC
=
GetAppCharClass
();
OUString
aTmp
(
rCC
.
lowercase
(
rStr
));
OUString
aTmp
(
rCC
.
lowercase
(
rStr
));
for
(
sal_uInt16
i
=
0
;
i
<
nSize
;
++
i
)
for
(
SwFldTypes
::
size_type
i
=
0
;
i
<
nSize
;
++
i
)
{
{
// same ResId -> increment index
// same ResId -> increment index
SwFieldType
*
pFldType
=
(
*
pFldTypes
)[
i
];
SwFieldType
*
pFldType
=
(
*
pFldTypes
)[
i
];
...
@@ -434,21 +431,18 @@ void SwEditShell::ChangeAuthorityData(const SwAuthEntry* pNewData)
...
@@ -434,21 +431,18 @@ void SwEditShell::ChangeAuthorityData(const SwAuthEntry* pNewData)
bool
SwEditShell
::
IsAnyDatabaseFieldInDoc
()
const
bool
SwEditShell
::
IsAnyDatabaseFieldInDoc
()
const
{
{
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
sal_uInt16
nSize
=
pFldTypes
->
size
();
for
(
const
auto
pFldType
:
*
pFldTypes
)
for
(
sal_uInt16
i
=
0
;
i
<
nSize
;
++
i
)
{
{
SwFieldType
&
rFldType
=
*
((
*
pFldTypes
)[
i
]);
if
(
IsUsed
(
*
pFldType
))
sal_uInt16
nWhich
=
rFldType
.
Which
();
if
(
IsUsed
(
rFldType
))
{
{
switch
(
nWhich
)
switch
(
pFldType
->
Which
()
)
{
{
case
RES_DBFLD
:
case
RES_DBFLD
:
case
RES_DBNEXTSETFLD
:
case
RES_DBNEXTSETFLD
:
case
RES_DBNUMSETFLD
:
case
RES_DBNUMSETFLD
:
case
RES_DBSETNUMBERFLD
:
case
RES_DBSETNUMBERFLD
:
{
{
SwIterator
<
SwFmtFld
,
SwFieldType
>
aIter
(
r
FldType
);
SwIterator
<
SwFmtFld
,
SwFieldType
>
aIter
(
*
p
FldType
);
SwFmtFld
*
pFld
=
aIter
.
First
();
SwFmtFld
*
pFld
=
aIter
.
First
();
while
(
pFld
)
while
(
pFld
)
{
{
...
...
sw/source/core/edit/edfldexp.cxx
Dosyayı görüntüle @
b8ca608a
...
@@ -38,20 +38,17 @@ using namespace com::sun::star;
...
@@ -38,20 +38,17 @@ using namespace com::sun::star;
bool
SwEditShell
::
IsFieldDataSourceAvailable
(
OUString
&
rUsedDataSource
)
const
bool
SwEditShell
::
IsFieldDataSourceAvailable
(
OUString
&
rUsedDataSource
)
const
{
{
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
SwFldTypes
*
pFldTypes
=
GetDoc
()
->
getIDocumentFieldsAccess
().
GetFldTypes
();
const
sal_uInt16
nSize
=
pFldTypes
->
size
();
uno
::
Reference
<
uno
::
XComponentContext
>
xContext
(
::
comphelper
::
getProcessComponentContext
()
);
uno
::
Reference
<
uno
::
XComponentContext
>
xContext
(
::
comphelper
::
getProcessComponentContext
()
);
uno
::
Reference
<
sdb
::
XDatabaseContext
>
xDBContext
=
sdb
::
DatabaseContext
::
create
(
xContext
);
uno
::
Reference
<
sdb
::
XDatabaseContext
>
xDBContext
=
sdb
::
DatabaseContext
::
create
(
xContext
);
for
(
sal_uInt16
i
=
0
;
i
<
nSize
;
++
i
)
for
(
const
auto
pFldType
:
*
pFldTypes
)
{
{
SwFieldType
&
rFldType
=
*
((
*
pFldTypes
)[
i
]);
if
(
IsUsed
(
*
pFldType
))
sal_uInt16
nWhich
=
rFldType
.
Which
();
if
(
IsUsed
(
rFldType
))
{
{
switch
(
nWhich
)
switch
(
pFldType
->
Which
()
)
{
{
case
RES_DBFLD
:
case
RES_DBFLD
:
{
{
SwIterator
<
SwFmtFld
,
SwFieldType
>
aIter
(
r
FldType
);
SwIterator
<
SwFmtFld
,
SwFieldType
>
aIter
(
*
p
FldType
);
SwFmtFld
*
pFmtFld
=
aIter
.
First
();
SwFmtFld
*
pFmtFld
=
aIter
.
First
();
while
(
pFmtFld
)
while
(
pFmtFld
)
{
{
...
...
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