[Libreoffice-commits] core.git: sw/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 12 07:33:08 UTC 2021


 sw/source/core/doc/docfld.cxx |   11 +++++------
 sw/source/core/edit/edfld.cxx |    1 +
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit e6f7a3bf40f5df3a17ba58c4735d647bfdda71cb
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Mar 12 07:28:23 2021 +0100
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Mar 12 08:32:25 2021 +0100

    Use range-based for; mention similar method in comments
    
    Change-Id: I2659faf75e88eecccfdb33368393c140563030e7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112304
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index eecfc42fc1ab..58319816050b 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -351,13 +351,12 @@ const SwDBData& SwDoc::GetDBDesc()
 #if HAVE_FEATURE_DBCONNECTIVITY
     if(maDBData.sDataSource.isEmpty())
     {
-        const SwFieldTypes::size_type nSize = getIDocumentFieldsAccess().GetFieldTypes()->size();
-        for(SwFieldTypes::size_type i = 0; i < nSize && maDBData.sDataSource.isEmpty(); ++i)
+        // Similar to: SwEditShell::IsAnyDatabaseFieldInDoc
+        for (const auto& pFieldType : *getIDocumentFieldsAccess().GetFieldTypes())
         {
-            SwFieldType& rFieldType = *((*getIDocumentFieldsAccess().GetFieldTypes())[i]);
-            SwFieldIds nWhich = rFieldType.Which();
-            if(IsUsed(rFieldType))
+            if (IsUsed(*pFieldType))
             {
+                SwFieldIds nWhich = pFieldType->Which();
                 switch(nWhich)
                 {
                     case SwFieldIds::Database:
@@ -366,7 +365,7 @@ const SwDBData& SwDoc::GetDBDesc()
                     case SwFieldIds::DbSetNumber:
                     {
                         std::vector<SwFormatField*> vFields;
-                        rFieldType.GatherFields(vFields);
+                        pFieldType->GatherFields(vFields);
                         if(vFields.size())
                         {
                             if(SwFieldIds::Database == nWhich)
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index c83f442b7160..2ad8695d46c7 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -385,6 +385,7 @@ void SwEditShell::ChangeAuthorityData(const SwAuthEntry* pNewData)
 
 bool SwEditShell::IsAnyDatabaseFieldInDoc()const
 {
+    // Similar to: SwDoc::GetDBDesc
     const SwFieldTypes * pFieldTypes = GetDoc()->getIDocumentFieldsAccess().GetFieldTypes();
     for(const auto & pFieldType : *pFieldTypes)
     {


More information about the Libreoffice-commits mailing list