summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2020-03-15 01:34:00 +0100
committerBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>2020-03-15 11:40:15 +0100
commit7dcda8121bf70bcb95edf82d97e94f44c13255d9 (patch)
tree51a02fa1e767ab8d07f98b5b4d1f4d03c5cdb911 /sw
parent490804ade1103c3fd7569ea093d8d90beab445a3 (diff)
edfldexp.cxx: SwIterator no more ...
Change-Id: I3b7aba9c9020e253116940dbe5cd75a047b2e2e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90508 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/edit/edfldexp.cxx40
1 files changed, 16 insertions, 24 deletions
diff --git a/sw/source/core/edit/edfldexp.cxx b/sw/source/core/edit/edfldexp.cxx
index ff2d0d1cdcc4..c0a8fef2af87 100644
--- a/sw/source/core/edit/edfldexp.cxx
+++ b/sw/source/core/edit/edfldexp.cxx
@@ -34,33 +34,25 @@ bool SwEditShell::IsFieldDataSourceAvailable(OUString& rUsedDataSource) const
const SwFieldTypes * pFieldTypes = GetDoc()->getIDocumentFieldsAccess().GetFieldTypes();
uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
uno::Reference<sdb::XDatabaseContext> xDBContext = sdb::DatabaseContext::create(xContext);
- for(const auto & pFieldType : *pFieldTypes)
+ std::vector<SwFormatField*> vFields;
+ for(const auto& pFieldType : *pFieldTypes)
{
if(IsUsed(*pFieldType) && pFieldType->Which() == SwFieldIds::Database)
- {
- SwIterator<SwFormatField,SwFieldType> aIter( *pFieldType );
- SwFormatField* pFormatField = aIter.First();
- while(pFormatField)
- {
- if(pFormatField->IsFieldInDoc())
- {
- const SwDBData& rData =
- static_cast<SwDBFieldType*>(pFormatField->GetField()->GetTyp())->GetDBData();
- try
- {
- return xDBContext->getByName(rData.sDataSource).hasValue();
- }
- catch(uno::Exception const &)
- {
- rUsedDataSource = rData.sDataSource;
- return false;
- }
- }
- pFormatField = aIter.Next();
- }
- }
+ pFieldType->GatherFields(vFields);
+ }
+ if(!vFields.size())
+ return true;
+
+ const SwDBData& rData = static_cast<SwDBFieldType*>(vFields.front()->GetField()->GetTyp())->GetDBData();
+ try
+ {
+ return xDBContext->getByName(rData.sDataSource).hasValue();
+ }
+ catch(uno::Exception const &)
+ {
+ rUsedDataSource = rData.sDataSource;
+ return false;
}
- return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */