[Libreoffice-commits] core.git: 2 commits - readlicense_oo/license sc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 29 18:47:50 UTC 2020


 readlicense_oo/license/CREDITS.fodt                    | 3209 ++++++++---------
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx |  172 
 sc/source/filter/xml/XMLCellRangeSourceContext.cxx     |   80 
 sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx |  140 
 sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx |  324 -
 sc/source/filter/xml/XMLConsolidationContext.cxx       |  110 
 sc/source/filter/xml/XMLConverter.cxx                  |  101 
 sc/source/filter/xml/XMLDDELinksContext.cxx            |  170 
 sc/source/filter/xml/XMLDetectiveContext.cxx           |   44 
 sc/source/filter/xml/XMLExportDDELinks.cxx             |   64 
 sc/source/filter/xml/XMLExportDataPilot.cxx            |  452 +-
 sc/source/filter/xml/XMLExportIterator.cxx             |  128 
 sc/source/filter/xml/XMLStylesExportHelper.cxx         |  310 -
 sc/source/filter/xml/XMLTableMasterPageExport.cxx      |   74 
 sc/source/filter/xml/XMLTableShapeResizer.cxx          |   76 
 sc/source/filter/xml/XMLTableSourceContext.cxx         |  100 
 sc/source/filter/xml/XMLTrackedChangesContext.cxx      |   44 
 sc/source/filter/xml/datastreamimport.cxx              |   50 
 sc/source/filter/xml/xmlbodyi.cxx                      |   46 
 sc/source/filter/xml/xmlcelli.cxx                      |  272 -
 sc/source/filter/xml/xmlcoli.cxx                       |   48 
 sc/source/filter/xml/xmlcondformat.cxx                 |   28 
 sc/source/filter/xml/xmlcvali.cxx                      |  260 -
 sc/source/filter/xml/xmldpimp.cxx                      |  534 +-
 sc/source/filter/xml/xmldrani.cxx                      |  112 
 sc/source/filter/xml/xmlexprt.cxx                      | 1464 +++----
 sc/source/filter/xml/xmlexternaltabi.cxx               |  172 
 sc/source/filter/xml/xmlfilti.cxx                      |  246 -
 sc/source/filter/xml/xmlfonte.cxx                      |   72 
 sc/source/filter/xml/xmlimprt.cxx                      |  460 +-
 sc/source/filter/xml/xmllabri.cxx                      |   28 
 sc/source/filter/xml/xmlrowi.cxx                       |  128 
 sc/source/filter/xml/xmlsceni.cxx                      |  108 
 sc/source/filter/xml/xmlsorti.cxx                      |  130 
 sc/source/filter/xml/xmlstyle.cxx                      |  152 
 sc/source/filter/xml/xmlsubti.cxx                      |  136 
 sc/source/filter/xml/xmltransformationi.cxx            |  168 
 37 files changed, 5126 insertions(+), 5086 deletions(-)

New commits:
commit b6a4ddf4d8c45030dbe3fc68b51f9366109041bd
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 29 16:13:12 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 29 20:47:22 2020 +0200

    loplugin:flatten in sc/filter/xml
    
    Change-Id: I93117f601a8f450ebfcde32c156802137b87da76
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99701
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
index 9917eaaa0ba1..26161c092360 100644
--- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
+++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
@@ -48,43 +48,43 @@ ScXMLCalculationSettingsContext::ScXMLCalculationSettingsContext( ScXMLImport& r
     aNullDate.Day = 30;
     aNullDate.Month = 12;
     aNullDate.Year = 1899;
-    if ( rAttrList.is() )
+    if ( !rAttrList.is() )
+        return;
+
+    for (auto &aIter : *rAttrList)
     {
-        for (auto &aIter : *rAttrList)
+        switch (aIter.getToken())
         {
-            switch (aIter.getToken())
-            {
-            case XML_ELEMENT( TABLE, XML_CASE_SENSITIVE ):
-                if( IsXMLToken( aIter, XML_FALSE ) )
-                    bIgnoreCase = true;
-                break;
-            case XML_ELEMENT( TABLE, XML_PRECISION_AS_SHOWN ):
-                if( IsXMLToken( aIter, XML_TRUE ) )
-                    bCalcAsShown = true;
-                break;
-            case XML_ELEMENT( TABLE, XML_SEARCH_CRITERIA_MUST_APPLY_TO_WHOLE_CELL ):
-                if( IsXMLToken( aIter, XML_FALSE ) )
-                    bMatchWholeCell = false;
-                break;
-            case XML_ELEMENT( TABLE, XML_AUTOMATIC_FIND_LABELS ):
-                if( IsXMLToken( aIter, XML_FALSE ) )
-                    bLookUpLabels = false;
-                break;
-            case XML_ELEMENT( TABLE, XML_NULL_YEAR ):
-                sal_Int32 nTemp;
-                ::sax::Converter::convertNumber( nTemp, aIter.toString() );
-                nYear2000 = static_cast<sal_uInt16>(nTemp);
-                break;
-            case XML_ELEMENT( TABLE, XML_USE_REGULAR_EXPRESSIONS ):
-                // Overwrite only the default (regex true) value, not wildcard.
-                if( eSearchType == utl::SearchParam::SearchType::Regexp && IsXMLToken( aIter, XML_FALSE ) )
-                    eSearchType = utl::SearchParam::SearchType::Normal;
-                break;
-            case XML_ELEMENT( TABLE, XML_USE_WILDCARDS ):
-                if( IsXMLToken( aIter, XML_TRUE ) )
-                    eSearchType = utl::SearchParam::SearchType::Wildcard;
-                break;
-            }
+        case XML_ELEMENT( TABLE, XML_CASE_SENSITIVE ):
+            if( IsXMLToken( aIter, XML_FALSE ) )
+                bIgnoreCase = true;
+            break;
+        case XML_ELEMENT( TABLE, XML_PRECISION_AS_SHOWN ):
+            if( IsXMLToken( aIter, XML_TRUE ) )
+                bCalcAsShown = true;
+            break;
+        case XML_ELEMENT( TABLE, XML_SEARCH_CRITERIA_MUST_APPLY_TO_WHOLE_CELL ):
+            if( IsXMLToken( aIter, XML_FALSE ) )
+                bMatchWholeCell = false;
+            break;
+        case XML_ELEMENT( TABLE, XML_AUTOMATIC_FIND_LABELS ):
+            if( IsXMLToken( aIter, XML_FALSE ) )
+                bLookUpLabels = false;
+            break;
+        case XML_ELEMENT( TABLE, XML_NULL_YEAR ):
+            sal_Int32 nTemp;
+            ::sax::Converter::convertNumber( nTemp, aIter.toString() );
+            nYear2000 = static_cast<sal_uInt16>(nTemp);
+            break;
+        case XML_ELEMENT( TABLE, XML_USE_REGULAR_EXPRESSIONS ):
+            // Overwrite only the default (regex true) value, not wildcard.
+            if( eSearchType == utl::SearchParam::SearchType::Regexp && IsXMLToken( aIter, XML_FALSE ) )
+                eSearchType = utl::SearchParam::SearchType::Normal;
+            break;
+        case XML_ELEMENT( TABLE, XML_USE_WILDCARDS ):
+            if( IsXMLToken( aIter, XML_TRUE ) )
+                eSearchType = utl::SearchParam::SearchType::Wildcard;
+            break;
         }
     }
 }
@@ -110,31 +110,31 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCalculationSetting
 
 void SAL_CALL ScXMLCalculationSettingsContext::endFastElement( sal_Int32 /*nElement*/ )
 {
-    if (GetScImport().GetModel().is())
+    if (!GetScImport().GetModel().is())
+        return;
+
+    uno::Reference <beans::XPropertySet> xPropertySet (GetScImport().GetModel(), uno::UNO_QUERY);
+    if (!xPropertySet.is())
+        return;
+
+    xPropertySet->setPropertyValue( SC_UNO_CALCASSHOWN, uno::makeAny(bCalcAsShown) );
+    xPropertySet->setPropertyValue( SC_UNO_IGNORECASE, uno::makeAny(bIgnoreCase) );
+    xPropertySet->setPropertyValue( SC_UNO_LOOKUPLABELS, uno::makeAny(bLookUpLabels) );
+    xPropertySet->setPropertyValue( SC_UNO_MATCHWHOLE, uno::makeAny(bMatchWholeCell) );
+    bool bWildcards, bRegex;
+    utl::SearchParam::ConvertToBool( eSearchType, bWildcards, bRegex);
+    xPropertySet->setPropertyValue( SC_UNO_REGEXENABLED, uno::makeAny(bRegex) );
+    xPropertySet->setPropertyValue( SC_UNO_WILDCARDSENABLED, uno::makeAny(bWildcards) );
+    xPropertySet->setPropertyValue( SC_UNO_ITERENABLED, uno::makeAny(bIsIterationEnabled) );
+    xPropertySet->setPropertyValue( SC_UNO_ITERCOUNT, uno::makeAny(nIterationCount) );
+    xPropertySet->setPropertyValue( SC_UNO_ITEREPSILON, uno::makeAny(fIterationEpsilon) );
+    xPropertySet->setPropertyValue( SC_UNO_NULLDATE, uno::makeAny(aNullDate) );
+    if (GetScImport().GetDocument())
     {
-        uno::Reference <beans::XPropertySet> xPropertySet (GetScImport().GetModel(), uno::UNO_QUERY);
-        if (xPropertySet.is())
-        {
-            xPropertySet->setPropertyValue( SC_UNO_CALCASSHOWN, uno::makeAny(bCalcAsShown) );
-            xPropertySet->setPropertyValue( SC_UNO_IGNORECASE, uno::makeAny(bIgnoreCase) );
-            xPropertySet->setPropertyValue( SC_UNO_LOOKUPLABELS, uno::makeAny(bLookUpLabels) );
-            xPropertySet->setPropertyValue( SC_UNO_MATCHWHOLE, uno::makeAny(bMatchWholeCell) );
-            bool bWildcards, bRegex;
-            utl::SearchParam::ConvertToBool( eSearchType, bWildcards, bRegex);
-            xPropertySet->setPropertyValue( SC_UNO_REGEXENABLED, uno::makeAny(bRegex) );
-            xPropertySet->setPropertyValue( SC_UNO_WILDCARDSENABLED, uno::makeAny(bWildcards) );
-            xPropertySet->setPropertyValue( SC_UNO_ITERENABLED, uno::makeAny(bIsIterationEnabled) );
-            xPropertySet->setPropertyValue( SC_UNO_ITERCOUNT, uno::makeAny(nIterationCount) );
-            xPropertySet->setPropertyValue( SC_UNO_ITEREPSILON, uno::makeAny(fIterationEpsilon) );
-            xPropertySet->setPropertyValue( SC_UNO_NULLDATE, uno::makeAny(aNullDate) );
-            if (GetScImport().GetDocument())
-            {
-                ScXMLImport::MutexGuard aGuard(GetScImport());
-                ScDocOptions aDocOptions (GetScImport().GetDocument()->GetDocOptions());
-                aDocOptions.SetYear2000(nYear2000);
-                GetScImport().GetDocument()->SetDocOptions(aDocOptions);
-            }
-        }
+        ScXMLImport::MutexGuard aGuard(GetScImport());
+        ScDocOptions aDocOptions (GetScImport().GetDocument()->GetDocOptions());
+        aDocOptions.SetYear2000(nYear2000);
+        GetScImport().GetDocument()->SetDocOptions(aDocOptions);
     }
 }
 
@@ -143,19 +143,19 @@ ScXMLNullDateContext::ScXMLNullDateContext( ScXMLImport& rImport,
                                       ScXMLCalculationSettingsContext* pCalcSet) :
     ScXMLImportContext( rImport )
 {
-    if ( rAttrList.is() )
+    if ( !rAttrList.is() )
+        return;
+
+    auto aIter( rAttrList->find( XML_ELEMENT( TABLE, XML_DATE_VALUE ) ) );
+    if (aIter != rAttrList->end())
     {
-        auto aIter( rAttrList->find( XML_ELEMENT( TABLE, XML_DATE_VALUE ) ) );
-        if (aIter != rAttrList->end())
-        {
-            util::DateTime aDateTime;
-            ::sax::Converter::parseDateTime(aDateTime, aIter.toString());
-            util::Date aDate;
-            aDate.Day = aDateTime.Day;
-            aDate.Month = aDateTime.Month;
-            aDate.Year = aDateTime.Year;
-            pCalcSet->SetNullDate(aDate);
-        }
+        util::DateTime aDateTime;
+        ::sax::Converter::parseDateTime(aDateTime, aIter.toString());
+        util::Date aDate;
+        aDate.Day = aDateTime.Day;
+        aDate.Month = aDateTime.Month;
+        aDate.Year = aDateTime.Year;
+        pCalcSet->SetNullDate(aDate);
     }
 }
 
@@ -168,23 +168,23 @@ ScXMLIterationContext::ScXMLIterationContext( ScXMLImport& rImport,
                                       ScXMLCalculationSettingsContext* pCalcSet) :
     ScXMLImportContext( rImport )
 {
-    if ( rAttrList.is() )
+    if ( !rAttrList.is() )
+        return;
+
+    for (auto &aIter : *rAttrList)
     {
-        for (auto &aIter : *rAttrList)
+        switch (aIter.getToken())
         {
-            switch (aIter.getToken())
-            {
-            case XML_ELEMENT( TABLE, XML_STATUS ):
-                if (IsXMLToken(aIter, XML_ENABLE))
-                    pCalcSet->SetIterationStatus(true);
-                break;
-            case XML_ELEMENT( TABLE, XML_STEPS ):
-                pCalcSet->SetIterationCount(aIter.toInt32());
-                break;
-            case XML_ELEMENT( TABLE, XML_MAXIMUM_DIFFERENCE ):
-                pCalcSet->SetIterationEpsilon( aIter.toDouble() );
-                break;
-            }
+        case XML_ELEMENT( TABLE, XML_STATUS ):
+            if (IsXMLToken(aIter, XML_ENABLE))
+                pCalcSet->SetIterationStatus(true);
+            break;
+        case XML_ELEMENT( TABLE, XML_STEPS ):
+            pCalcSet->SetIterationCount(aIter.toInt32());
+            break;
+        case XML_ELEMENT( TABLE, XML_MAXIMUM_DIFFERENCE ):
+            pCalcSet->SetIterationEpsilon( aIter.toDouble() );
+            break;
         }
     }
 }
diff --git a/sc/source/filter/xml/XMLCellRangeSourceContext.cxx b/sc/source/filter/xml/XMLCellRangeSourceContext.cxx
index 936f565c93a6..70608c430cb9 100644
--- a/sc/source/filter/xml/XMLCellRangeSourceContext.cxx
+++ b/sc/source/filter/xml/XMLCellRangeSourceContext.cxx
@@ -40,50 +40,50 @@ ScXMLCellRangeSourceContext::ScXMLCellRangeSourceContext(
         ScMyImpCellRangeSource* pCellRangeSource ) :
     ScXMLImportContext( rImport )
 {
-    if ( rAttrList.is() )
+    if ( !rAttrList.is() )
+        return;
+
+    for (auto &aIter : *rAttrList)
     {
-        for (auto &aIter : *rAttrList)
+        switch (aIter.getToken())
         {
-            switch (aIter.getToken())
+            case XML_ELEMENT( TABLE, XML_NAME ):
+                pCellRangeSource->sSourceStr = aIter.toString();
+            break;
+            case XML_ELEMENT( TABLE, XML_FILTER_NAME ):
+                pCellRangeSource->sFilterName = aIter.toString();
+            break;
+            case XML_ELEMENT( TABLE, XML_FILTER_OPTIONS ):
+                pCellRangeSource->sFilterOptions = aIter.toString();
+            break;
+            case XML_ELEMENT( XLINK, XML_HREF ):
+                pCellRangeSource->sURL = GetScImport().GetAbsoluteReference(aIter.toString());
+            break;
+            case XML_ELEMENT( TABLE, XML_LAST_COLUMN_SPANNED ):
+            {
+                sal_Int32 nValue;
+                if (::sax::Converter::convertNumber( nValue, aIter.toString(), 1 ))
+                    pCellRangeSource->nColumns = nValue;
+                else
+                    pCellRangeSource->nColumns = 1;
+            }
+            break;
+            case XML_ELEMENT( TABLE, XML_LAST_ROW_SPANNED ):
+            {
+                sal_Int32 nValue;
+                if (::sax::Converter::convertNumber( nValue, aIter.toString(), 1 ))
+                    pCellRangeSource->nRows = nValue;
+                else
+                    pCellRangeSource->nRows = 1;
+            }
+            break;
+            case XML_ELEMENT( TABLE, XML_REFRESH_DELAY ):
             {
-                case XML_ELEMENT( TABLE, XML_NAME ):
-                    pCellRangeSource->sSourceStr = aIter.toString();
-                break;
-                case XML_ELEMENT( TABLE, XML_FILTER_NAME ):
-                    pCellRangeSource->sFilterName = aIter.toString();
-                break;
-                case XML_ELEMENT( TABLE, XML_FILTER_OPTIONS ):
-                    pCellRangeSource->sFilterOptions = aIter.toString();
-                break;
-                case XML_ELEMENT( XLINK, XML_HREF ):
-                    pCellRangeSource->sURL = GetScImport().GetAbsoluteReference(aIter.toString());
-                break;
-                case XML_ELEMENT( TABLE, XML_LAST_COLUMN_SPANNED ):
-                {
-                    sal_Int32 nValue;
-                    if (::sax::Converter::convertNumber( nValue, aIter.toString(), 1 ))
-                        pCellRangeSource->nColumns = nValue;
-                    else
-                        pCellRangeSource->nColumns = 1;
-                }
-                break;
-                case XML_ELEMENT( TABLE, XML_LAST_ROW_SPANNED ):
-                {
-                    sal_Int32 nValue;
-                    if (::sax::Converter::convertNumber( nValue, aIter.toString(), 1 ))
-                        pCellRangeSource->nRows = nValue;
-                    else
-                        pCellRangeSource->nRows = 1;
-                }
-                break;
-                case XML_ELEMENT( TABLE, XML_REFRESH_DELAY ):
-                {
-                    double fTime;
-                    if (::sax::Converter::convertDuration( fTime, aIter.toString() ))
-                        pCellRangeSource->nRefresh = std::max( static_cast<sal_Int32>(fTime * 86400.0), sal_Int32(0) );
-                }
-                break;
+                double fTime;
+                if (::sax::Converter::convertDuration( fTime, aIter.toString() ))
+                    pCellRangeSource->nRefresh = std::max( static_cast<sal_Int32>(fTime * 86400.0), sal_Int32(0) );
             }
+            break;
         }
     }
 }
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index 1efca32d0efe..4a8af8b60dcd 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -503,64 +503,64 @@ void ScChangeTrackingExportHelper::AddDeletionAttributes(const ScChangeActionDel
         break;
     }
     rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_POSITION, OUString::number(nPosition));
-    if (pDelAction->GetType() != SC_CAT_DELETE_TABS)
+    if (pDelAction->GetType() == SC_CAT_DELETE_TABS)
+        return;
+
+    rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_TABLE, OUString::number(nStartSheet));
+    if (!(pDelAction->IsMultiDelete() && !pDelAction->GetDx() && !pDelAction->GetDy()))
+        return;
+
+    const ScChangeAction* p = pDelAction->GetNext();
+    sal_Int32 nSlavesCount (1);
+    while (p)
     {
-        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_TABLE, OUString::number(nStartSheet));
-        if (pDelAction->IsMultiDelete() && !pDelAction->GetDx() && !pDelAction->GetDy())
+        if (p->GetType() != pDelAction->GetType())
+            break;
+        else
         {
-            const ScChangeAction* p = pDelAction->GetNext();
-            sal_Int32 nSlavesCount (1);
-            while (p)
+            const ScChangeActionDel* pDel = static_cast<const ScChangeActionDel*>(p);
+            if ( (pDel->GetDx() > pDelAction->GetDx() || pDel->GetDy() > pDelAction->GetDy()) &&
+                    pDel->GetBigRange() == pDelAction->GetBigRange() )
             {
-                if (p->GetType() != pDelAction->GetType())
-                    break;
-                else
-                {
-                    const ScChangeActionDel* pDel = static_cast<const ScChangeActionDel*>(p);
-                    if ( (pDel->GetDx() > pDelAction->GetDx() || pDel->GetDy() > pDelAction->GetDy()) &&
-                            pDel->GetBigRange() == pDelAction->GetBigRange() )
-                    {
-                        ++nSlavesCount;
-                        p = p->GetNext();
-                    }
-                    else
-                        break;
-                }
+                ++nSlavesCount;
+                p = p->GetNext();
             }
-
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_MULTI_DELETION_SPANNED, OUString::number(nSlavesCount));
+            else
+                break;
         }
     }
+
+    rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_MULTI_DELETION_SPANNED, OUString::number(nSlavesCount));
 }
 
 void ScChangeTrackingExportHelper::WriteCutOffs(const ScChangeActionDel* pAction)
 {
     const ScChangeActionIns* pCutOffIns = pAction->GetCutOffInsert();
     const ScChangeActionDelMoveEntry* pLinkMove = pAction->GetFirstMoveEntry();
-    if (pCutOffIns || pLinkMove)
+    if (!(pCutOffIns || pLinkMove))
+        return;
+
+    SvXMLElementExport aCutOffsElem (rExport, XML_NAMESPACE_TABLE, XML_CUT_OFFS, true, true);
+    if (pCutOffIns)
+    {
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ID, GetChangeID(pCutOffIns->GetActionNumber()));
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_POSITION, OUString::number(pAction->GetCutOffCount()));
+        SvXMLElementExport aInsertCutOffElem (rExport, XML_NAMESPACE_TABLE, XML_INSERTION_CUT_OFF, true, true);
+    }
+    while (pLinkMove)
     {
-        SvXMLElementExport aCutOffsElem (rExport, XML_NAMESPACE_TABLE, XML_CUT_OFFS, true, true);
-        if (pCutOffIns)
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ID, GetChangeID(pLinkMove->GetAction()->GetActionNumber()));
+        if (pLinkMove->GetCutOffFrom() == pLinkMove->GetCutOffTo())
         {
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ID, GetChangeID(pCutOffIns->GetActionNumber()));
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_POSITION, OUString::number(pAction->GetCutOffCount()));
-            SvXMLElementExport aInsertCutOffElem (rExport, XML_NAMESPACE_TABLE, XML_INSERTION_CUT_OFF, true, true);
+            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_POSITION, OUString::number(pLinkMove->GetCutOffFrom()));
         }
-        while (pLinkMove)
+        else
         {
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ID, GetChangeID(pLinkMove->GetAction()->GetActionNumber()));
-            if (pLinkMove->GetCutOffFrom() == pLinkMove->GetCutOffTo())
-            {
-                rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_POSITION, OUString::number(pLinkMove->GetCutOffFrom()));
-            }
-            else
-            {
-                rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_START_POSITION, OUString::number(pLinkMove->GetCutOffFrom()));
-                rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_END_POSITION, OUString::number(pLinkMove->GetCutOffTo()));
-            }
-            SvXMLElementExport aMoveCutOffElem (rExport, XML_NAMESPACE_TABLE, XML_MOVEMENT_CUT_OFF, true, true);
-            pLinkMove = pLinkMove->GetNext();
+            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_START_POSITION, OUString::number(pLinkMove->GetCutOffFrom()));
+            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_END_POSITION, OUString::number(pLinkMove->GetCutOffTo()));
         }
+        SvXMLElementExport aMoveCutOffElem (rExport, XML_NAMESPACE_TABLE, XML_MOVEMENT_CUT_OFF, true, true);
+        pLinkMove = pLinkMove->GetNext();
     }
 }
 
@@ -652,45 +652,45 @@ void ScChangeTrackingExportHelper::WorkWithChangeAction(ScChangeAction* pAction)
 
 void ScChangeTrackingExportHelper::CollectAutoStyles()
 {
-    if (pChangeTrack)
+    if (!pChangeTrack)
+        return;
+
+    sal_uInt32 nCount (pChangeTrack->GetActionMax());
+    if (!nCount)
+        return;
+
+    ScChangeAction* pAction = pChangeTrack->GetFirst();
+    CollectActionAutoStyles(pAction);
+    ScChangeAction* pLastAction = pChangeTrack->GetLast();
+    while (pAction != pLastAction)
     {
-        sal_uInt32 nCount (pChangeTrack->GetActionMax());
-        if (nCount)
-        {
-            ScChangeAction* pAction = pChangeTrack->GetFirst();
-            CollectActionAutoStyles(pAction);
-            ScChangeAction* pLastAction = pChangeTrack->GetLast();
-            while (pAction != pLastAction)
-            {
-                pAction = pAction->GetNext();
-                CollectActionAutoStyles(pAction);
-            }
-            pAction = pChangeTrack->GetFirstGenerated();
-            while (pAction)
-            {
-                CollectActionAutoStyles(pAction);
-                pAction = pAction->GetNext();
-            }
-        }
+        pAction = pAction->GetNext();
+        CollectActionAutoStyles(pAction);
+    }
+    pAction = pChangeTrack->GetFirstGenerated();
+    while (pAction)
+    {
+        CollectActionAutoStyles(pAction);
+        pAction = pAction->GetNext();
     }
 }
 
 void ScChangeTrackingExportHelper::CollectAndWriteChanges()
 {
-    if (pChangeTrack)
+    if (!pChangeTrack)
+        return;
+
+    SvXMLElementExport aCangeListElem(rExport, XML_NAMESPACE_TABLE, XML_TRACKED_CHANGES, true, true);
     {
-        SvXMLElementExport aCangeListElem(rExport, XML_NAMESPACE_TABLE, XML_TRACKED_CHANGES, true, true);
+        ScChangeAction* pAction = pChangeTrack->GetFirst();
+        if (pAction)
         {
-            ScChangeAction* pAction = pChangeTrack->GetFirst();
-            if (pAction)
+            WorkWithChangeAction(pAction);
+            ScChangeAction* pLastAction = pChangeTrack->GetLast();
+            while (pAction != pLastAction)
             {
+                pAction = pAction->GetNext();
                 WorkWithChangeAction(pAction);
-                ScChangeAction* pLastAction = pChangeTrack->GetLast();
-                while (pAction != pLastAction)
-                {
-                    pAction = pAction->GetNext();
-                    WorkWithChangeAction(pAction);
-                }
             }
         }
     }
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index a9a7cb3f126c..dc1a93a7c913 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -531,46 +531,46 @@ void ScXMLChangeTrackingImportHelper::SetDeletionDependencies(ScMyDelAction* pAc
             OSL_FAIL("no cut off insert action");
         }
     }
-    if (!pAction->aMoveCutOffs.empty())
+    if (pAction->aMoveCutOffs.empty())
+        return;
+
+    OSL_ENSURE(((pAction->nActionType == SC_CAT_DELETE_COLS) ||
+        (pAction->nActionType == SC_CAT_DELETE_ROWS) ||
+        (pAction->nActionType == SC_CAT_DELETE_TABS)), "wrong action type");
+    for (auto it = pAction->aMoveCutOffs.crbegin(); it != pAction->aMoveCutOffs.crend(); ++it)
     {
-        OSL_ENSURE(((pAction->nActionType == SC_CAT_DELETE_COLS) ||
-            (pAction->nActionType == SC_CAT_DELETE_ROWS) ||
-            (pAction->nActionType == SC_CAT_DELETE_TABS)), "wrong action type");
-        for (auto it = pAction->aMoveCutOffs.crbegin(); it != pAction->aMoveCutOffs.crend(); ++it)
+        const ScMyMoveCutOff & rCutOff  = *it;
+        ScChangeAction* pChangeAction = pTrack->GetAction(rCutOff.nID);
+        if (pChangeAction && (pChangeAction->GetType() == SC_CAT_MOVE))
         {
-            const ScMyMoveCutOff & rCutOff  = *it;
-            ScChangeAction* pChangeAction = pTrack->GetAction(rCutOff.nID);
-            if (pChangeAction && (pChangeAction->GetType() == SC_CAT_MOVE))
-            {
-                ScChangeActionMove* pMoveAction = static_cast<ScChangeActionMove*>(pChangeAction);
-                if (pDelAct)
-                    pDelAct->AddCutOffMove(pMoveAction, static_cast<sal_Int16>(rCutOff.nStartPosition),
-                                        static_cast<sal_Int16>(rCutOff.nEndPosition));
-            }
-            else
-            {
-                OSL_FAIL("no cut off move action");
-            }
+            ScChangeActionMove* pMoveAction = static_cast<ScChangeActionMove*>(pChangeAction);
+            if (pDelAct)
+                pDelAct->AddCutOffMove(pMoveAction, static_cast<sal_Int16>(rCutOff.nStartPosition),
+                                    static_cast<sal_Int16>(rCutOff.nEndPosition));
+        }
+        else
+        {
+            OSL_FAIL("no cut off move action");
         }
-        pAction->aMoveCutOffs.clear();
     }
+    pAction->aMoveCutOffs.clear();
 }
 
 void ScXMLChangeTrackingImportHelper::SetMovementDependencies(ScMyMoveAction* pAction, ScChangeActionMove* pMoveAct)
 {
-    if (!pAction->aGeneratedList.empty())
+    if (pAction->aGeneratedList.empty())
+        return;
+
+    if (pAction->nActionType == SC_CAT_MOVE)
     {
-        if (pAction->nActionType == SC_CAT_MOVE)
+        if (pMoveAct)
         {
-            if (pMoveAct)
+            for (const ScMyGenerated & rGenerated : pAction->aGeneratedList)
             {
-                for (const ScMyGenerated & rGenerated : pAction->aGeneratedList)
-                {
-                    OSL_ENSURE(rGenerated.nID, "a not inserted generated action");
-                    pMoveAct->SetDeletedInThis(rGenerated.nID, pTrack);
-                }
-                pAction->aGeneratedList.clear();
+                OSL_ENSURE(rGenerated.nID, "a not inserted generated action");
+                pMoveAct->SetDeletedInThis(rGenerated.nID, pTrack);
             }
+            pAction->aGeneratedList.clear();
         }
     }
 }
@@ -648,169 +648,169 @@ void ScXMLChangeTrackingImportHelper::SetDependencies(ScMyBaseAction* pAction)
 void ScXMLChangeTrackingImportHelper::SetNewCell(const ScMyContentAction* pAction)
 {
     ScChangeAction* pChangeAction = pTrack->GetAction(pAction->nActionNumber);
-    if (pChangeAction)
+    if (!pChangeAction)
+        return;
+
+    assert(dynamic_cast<ScChangeActionContent*>(pChangeAction));
+    ScChangeActionContent* pChangeActionContent = static_cast<ScChangeActionContent*>(pChangeAction);
+    if (!(pChangeActionContent->IsTopContent() && !pChangeActionContent->IsDeletedIn()))
+        return;
+
+    sal_Int32 nCol, nRow, nTab, nCol2, nRow2, nTab2;
+    pAction->aBigRange.GetVars(nCol, nRow, nTab, nCol2, nRow2, nTab2);
+    if ((nCol >= 0) && (nCol <= pDoc->MaxCol()) &&
+        (nRow >= 0) && (nRow <= pDoc->MaxRow()) &&
+        (nTab >= 0) && (nTab <= MAXTAB))
     {
-        assert(dynamic_cast<ScChangeActionContent*>(pChangeAction));
-        ScChangeActionContent* pChangeActionContent = static_cast<ScChangeActionContent*>(pChangeAction);
-        if (pChangeActionContent->IsTopContent() && !pChangeActionContent->IsDeletedIn())
+        ScAddress aAddress (static_cast<SCCOL>(nCol),
+                            static_cast<SCROW>(nRow),
+                            static_cast<SCTAB>(nTab));
+        ScCellValue aCell;
+        aCell.assign(*pDoc, aAddress);
+        if (!aCell.isEmpty())
         {
-            sal_Int32 nCol, nRow, nTab, nCol2, nRow2, nTab2;
-            pAction->aBigRange.GetVars(nCol, nRow, nTab, nCol2, nRow2, nTab2);
-            if ((nCol >= 0) && (nCol <= pDoc->MaxCol()) &&
-                (nRow >= 0) && (nRow <= pDoc->MaxRow()) &&
-                (nTab >= 0) && (nTab <= MAXTAB))
+            ScCellValue aNewCell;
+            if (aCell.meType != CELLTYPE_FORMULA)
             {
-                ScAddress aAddress (static_cast<SCCOL>(nCol),
-                                    static_cast<SCROW>(nRow),
-                                    static_cast<SCTAB>(nTab));
-                ScCellValue aCell;
-                aCell.assign(*pDoc, aAddress);
-                if (!aCell.isEmpty())
-                {
-                    ScCellValue aNewCell;
-                    if (aCell.meType != CELLTYPE_FORMULA)
-                    {
-                        aNewCell = aCell;
-                        pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
-                        pChangeActionContent->SetNewValue(aCell, pDoc);
-                    }
-                    else
-                    {
-                        ScMatrixMode nMatrixFlag = aCell.mpFormula->GetMatrixFlag();
-                        OUString sFormula;
-                        // With GRAM_ODFF reference detection is faster on compilation.
-                        /* FIXME: new cell should be created with a clone
-                         * of the token array instead. Any reason why this
-                         * wasn't done? */
-                        aCell.mpFormula->GetFormula(sFormula, formula::FormulaGrammar::GRAM_ODFF);
-
-                        // #i87826# [Collaboration] Rejected move destroys formulas
-                        // FIXME: adjust ScFormulaCell::GetFormula(), so that the right formula string
-                        //        is returned and no further string handling is necessary
-                        OUString sFormula2;
-                        if ( nMatrixFlag != ScMatrixMode::NONE )
-                        {
-                            sFormula2 = sFormula.copy( 2, sFormula.getLength() - 3 );
-                        }
-                        else
-                        {
-                            sFormula2 = sFormula.copy( 1 );
-                        }
-
-                        aNewCell.meType = CELLTYPE_FORMULA;
-                        aNewCell.mpFormula = new ScFormulaCell(pDoc, aAddress, sFormula2,formula::FormulaGrammar::GRAM_ODFF, nMatrixFlag);
-                        if (nMatrixFlag == ScMatrixMode::Formula)
-                        {
-                            SCCOL nCols;
-                            SCROW nRows;
-                            aCell.mpFormula->GetMatColsRows(nCols, nRows);
-                            aNewCell.mpFormula->SetMatColsRows(nCols, nRows);
-                        }
-                        aNewCell.mpFormula->SetInChangeTrack(true);
-                        pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
-                        // #i40704# don't overwrite the formula string via SetNewValue()
-                    }
-                }
+                aNewCell = aCell;
+                pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
+                pChangeActionContent->SetNewValue(aCell, pDoc);
             }
             else
             {
-                OSL_FAIL("wrong cell position");
+                ScMatrixMode nMatrixFlag = aCell.mpFormula->GetMatrixFlag();
+                OUString sFormula;
+                // With GRAM_ODFF reference detection is faster on compilation.
+                /* FIXME: new cell should be created with a clone
+                 * of the token array instead. Any reason why this
+                 * wasn't done? */
+                aCell.mpFormula->GetFormula(sFormula, formula::FormulaGrammar::GRAM_ODFF);
+
+                // #i87826# [Collaboration] Rejected move destroys formulas
+                // FIXME: adjust ScFormulaCell::GetFormula(), so that the right formula string
+                //        is returned and no further string handling is necessary
+                OUString sFormula2;
+                if ( nMatrixFlag != ScMatrixMode::NONE )
+                {
+                    sFormula2 = sFormula.copy( 2, sFormula.getLength() - 3 );
+                }
+                else
+                {
+                    sFormula2 = sFormula.copy( 1 );
+                }
+
+                aNewCell.meType = CELLTYPE_FORMULA;
+                aNewCell.mpFormula = new ScFormulaCell(pDoc, aAddress, sFormula2,formula::FormulaGrammar::GRAM_ODFF, nMatrixFlag);
+                if (nMatrixFlag == ScMatrixMode::Formula)
+                {
+                    SCCOL nCols;
+                    SCROW nRows;
+                    aCell.mpFormula->GetMatColsRows(nCols, nRows);
+                    aNewCell.mpFormula->SetMatColsRows(nCols, nRows);
+                }
+                aNewCell.mpFormula->SetInChangeTrack(true);
+                pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
+                // #i40704# don't overwrite the formula string via SetNewValue()
             }
         }
     }
+    else
+    {
+        OSL_FAIL("wrong cell position");
+    }
 }
 
 void ScXMLChangeTrackingImportHelper::CreateChangeTrack(ScDocument* pTempDoc)
 {
     pDoc = pTempDoc;
-    if (pDoc)
+    if (!pDoc)
+        return;
+
+    pTrack = new ScChangeTrack(pDoc, aUsers);
+    // old files didn't store nanoseconds, disable until encountered
+    pTrack->SetTimeNanoSeconds( false );
+
+    for (const auto & rAction : aActions)
     {
-        pTrack = new ScChangeTrack(pDoc, aUsers);
-        // old files didn't store nanoseconds, disable until encountered
-        pTrack->SetTimeNanoSeconds( false );
+        std::unique_ptr<ScChangeAction> pAction;
 
-        for (const auto & rAction : aActions)
+        switch (rAction->nActionType)
         {
-            std::unique_ptr<ScChangeAction> pAction;
-
-            switch (rAction->nActionType)
+            case SC_CAT_INSERT_COLS:
+            case SC_CAT_INSERT_ROWS:
+            case SC_CAT_INSERT_TABS:
             {
-                case SC_CAT_INSERT_COLS:
-                case SC_CAT_INSERT_ROWS:
-                case SC_CAT_INSERT_TABS:
-                {
-                    pAction = CreateInsertAction(static_cast<ScMyInsAction*>(rAction.get()));
-                }
-                break;
-                case SC_CAT_DELETE_COLS:
-                case SC_CAT_DELETE_ROWS:
-                case SC_CAT_DELETE_TABS:
-                {
-                    ScMyDelAction* pDelAct = static_cast<ScMyDelAction*>(rAction.get());
-                    pAction = CreateDeleteAction(pDelAct);
-                    CreateGeneratedActions(pDelAct->aGeneratedList);
-                }
-                break;
-                case SC_CAT_MOVE:
-                {
-                    ScMyMoveAction* pMovAct = static_cast<ScMyMoveAction*>(rAction.get());
-                    pAction = CreateMoveAction(pMovAct);
-                    CreateGeneratedActions(pMovAct->aGeneratedList);
-                }
-                break;
-                case SC_CAT_CONTENT:
-                {
-                    pAction = CreateContentAction(static_cast<ScMyContentAction*>(rAction.get()));
-                }
-                break;
-                case SC_CAT_REJECT:
-                {
-                    pAction = CreateRejectionAction(static_cast<ScMyRejAction*>(rAction.get()));
-                }
-                break;
-                default:
-                {
-                    // added to avoid warnings
-                }
+                pAction = CreateInsertAction(static_cast<ScMyInsAction*>(rAction.get()));
             }
-
-            if (pAction)
-                pTrack->AppendLoaded(std::move(pAction));
-            else
+            break;
+            case SC_CAT_DELETE_COLS:
+            case SC_CAT_DELETE_ROWS:
+            case SC_CAT_DELETE_TABS:
+            {
+                ScMyDelAction* pDelAct = static_cast<ScMyDelAction*>(rAction.get());
+                pAction = CreateDeleteAction(pDelAct);
+                CreateGeneratedActions(pDelAct->aGeneratedList);
+            }
+            break;
+            case SC_CAT_MOVE:
             {
-                OSL_FAIL("no action");
+                ScMyMoveAction* pMovAct = static_cast<ScMyMoveAction*>(rAction.get());
+                pAction = CreateMoveAction(pMovAct);
+                CreateGeneratedActions(pMovAct->aGeneratedList);
+            }
+            break;
+            case SC_CAT_CONTENT:
+            {
+                pAction = CreateContentAction(static_cast<ScMyContentAction*>(rAction.get()));
+            }
+            break;
+            case SC_CAT_REJECT:
+            {
+                pAction = CreateRejectionAction(static_cast<ScMyRejAction*>(rAction.get()));
+            }
+            break;
+            default:
+            {
+                // added to avoid warnings
             }
         }
-        if (pTrack->GetLast())
-            pTrack->SetActionMax(pTrack->GetLast()->GetActionNumber());
 
-        auto aItr = aActions.begin();
-        while (aItr != aActions.end())
+        if (pAction)
+            pTrack->AppendLoaded(std::move(pAction));
+        else
         {
-            SetDependencies(aItr->get());
-
-            if ((*aItr)->nActionType == SC_CAT_CONTENT)
-                ++aItr;
-            else
-                aItr = aActions.erase(aItr);
+            OSL_FAIL("no action");
         }
+    }
+    if (pTrack->GetLast())
+        pTrack->SetActionMax(pTrack->GetLast()->GetActionNumber());
 
-        for (const auto& rxAction : aActions)
-        {
-            OSL_ENSURE(rxAction->nActionType == SC_CAT_CONTENT, "wrong action type");
-            SetNewCell(static_cast<ScMyContentAction*>(rxAction.get()));
-        }
-        aActions.clear();
-        if (aProtect.hasElements())
-            pTrack->SetProtection(aProtect);
-        else if (pDoc->GetChangeTrack() && pDoc->GetChangeTrack()->IsProtected())
-            pTrack->SetProtection(pDoc->GetChangeTrack()->GetProtection());
+    auto aItr = aActions.begin();
+    while (aItr != aActions.end())
+    {
+        SetDependencies(aItr->get());
 
-        if ( pTrack->GetLast() )
-            pTrack->SetLastSavedActionNumber(pTrack->GetLast()->GetActionNumber());
+        if ((*aItr)->nActionType == SC_CAT_CONTENT)
+            ++aItr;
+        else
+            aItr = aActions.erase(aItr);
+    }
 
-        pDoc->SetChangeTrack(std::unique_ptr<ScChangeTrack>(pTrack));
+    for (const auto& rxAction : aActions)
+    {
+        OSL_ENSURE(rxAction->nActionType == SC_CAT_CONTENT, "wrong action type");
+        SetNewCell(static_cast<ScMyContentAction*>(rxAction.get()));
     }
+    aActions.clear();
+    if (aProtect.hasElements())
+        pTrack->SetProtection(aProtect);
+    else if (pDoc->GetChangeTrack() && pDoc->GetChangeTrack()->IsProtected())
+        pTrack->SetProtection(pDoc->GetChangeTrack()->GetProtection());
+
+    if ( pTrack->GetLast() )
+        pTrack->SetLastSavedActionNumber(pTrack->GetLast()->GetActionNumber());
+
+    pDoc->SetChangeTrack(std::unique_ptr<ScChangeTrack>(pTrack));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/XMLConsolidationContext.cxx b/sc/source/filter/xml/XMLConsolidationContext.cxx
index 71dafb482636..e32db595b494 100644
--- a/sc/source/filter/xml/XMLConsolidationContext.cxx
+++ b/sc/source/filter/xml/XMLConsolidationContext.cxx
@@ -37,32 +37,32 @@ ScXMLConsolidationContext::ScXMLConsolidationContext(
     bTargetAddr(false)
 {
     rImport.LockSolarMutex();
-    if ( rAttrList.is() )
+    if ( !rAttrList.is() )
+        return;
+
+    for (auto &aIter : *rAttrList)
     {
-        for (auto &aIter : *rAttrList)
+        switch (aIter.getToken())
         {
-            switch (aIter.getToken())
-            {
-                case XML_ELEMENT( TABLE, XML_FUNCTION ):
-                    eFunction = ScXMLConverter::GetSubTotalFuncFromString( aIter.toString() );
-                break;
-                case XML_ELEMENT( TABLE, XML_SOURCE_CELL_RANGE_ADDRESSES ):
-                    sSourceList = aIter.toString();
-                break;
-                case XML_ELEMENT( TABLE, XML_TARGET_CELL_ADDRESS ):
-                    {
-                        sal_Int32 nOffset(0);
-                        bTargetAddr = ScRangeStringConverter::GetAddressFromString(
-                            aTargetAddr, aIter.toString(), GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset );
-                    }
-                    break;
-                case XML_ELEMENT( TABLE, XML_USE_LABEL ):
-                    sUseLabel = aIter.toString();
-                break;
-                case XML_ELEMENT( TABLE, XML_LINK_TO_SOURCE_DATA ):
-                    bLinkToSource = IsXMLToken( aIter, XML_TRUE );
+            case XML_ELEMENT( TABLE, XML_FUNCTION ):
+                eFunction = ScXMLConverter::GetSubTotalFuncFromString( aIter.toString() );
+            break;
+            case XML_ELEMENT( TABLE, XML_SOURCE_CELL_RANGE_ADDRESSES ):
+                sSourceList = aIter.toString();
+            break;
+            case XML_ELEMENT( TABLE, XML_TARGET_CELL_ADDRESS ):
+                {
+                    sal_Int32 nOffset(0);
+                    bTargetAddr = ScRangeStringConverter::GetAddressFromString(
+                        aTargetAddr, aIter.toString(), GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset );
+                }
                 break;
-            }
+            case XML_ELEMENT( TABLE, XML_USE_LABEL ):
+                sUseLabel = aIter.toString();
+            break;
+            case XML_ELEMENT( TABLE, XML_LINK_TO_SOURCE_DATA ):
+                bLinkToSource = IsXMLToken( aIter, XML_TRUE );
+            break;
         }
     }
 }
@@ -74,46 +74,46 @@ ScXMLConsolidationContext::~ScXMLConsolidationContext()
 
 void SAL_CALL ScXMLConsolidationContext::endFastElement( sal_Int32 /*nElement*/ )
 {
-    if (bTargetAddr)
-    {
-        std::unique_ptr<ScConsolidateParam> pConsParam(new ScConsolidateParam);
-        pConsParam->nCol = aTargetAddr.Col();
-        pConsParam->nRow = aTargetAddr.Row();
-        pConsParam->nTab = aTargetAddr.Tab();
-        pConsParam->eFunction = eFunction;
+    if (!bTargetAddr)
+        return;
 
-        sal_uInt16 nCount = static_cast<sal_uInt16>(std::min( ScRangeStringConverter::GetTokenCount( sSourceList ), sal_Int32(0xFFFF) ));
-        if( nCount )
+    std::unique_ptr<ScConsolidateParam> pConsParam(new ScConsolidateParam);
+    pConsParam->nCol = aTargetAddr.Col();
+    pConsParam->nRow = aTargetAddr.Row();
+    pConsParam->nTab = aTargetAddr.Tab();
+    pConsParam->eFunction = eFunction;
+
+    sal_uInt16 nCount = static_cast<sal_uInt16>(std::min( ScRangeStringConverter::GetTokenCount( sSourceList ), sal_Int32(0xFFFF) ));
+    if( nCount )
+    {
+        std::unique_ptr<ScArea[]> ppAreas(new ScArea[ nCount ]);
+        sal_Int32 nOffset = 0;
+        sal_uInt16 nIndex;
+        for( nIndex = 0; nIndex < nCount; ++nIndex )
         {
-            std::unique_ptr<ScArea[]> ppAreas(new ScArea[ nCount ]);
-            sal_Int32 nOffset = 0;
-            sal_uInt16 nIndex;
-            for( nIndex = 0; nIndex < nCount; ++nIndex )
+            if ( !ScRangeStringConverter::GetAreaFromString(
+                ppAreas[ nIndex ], sSourceList, GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset ) )
             {
-                if ( !ScRangeStringConverter::GetAreaFromString(
-                    ppAreas[ nIndex ], sSourceList, GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset ) )
-                {
-                    //! handle error
-                }
+                //! handle error
             }
-
-            pConsParam->SetAreas( std::move(ppAreas), nCount );
         }
 
-        pConsParam->bByCol = pConsParam->bByRow = false;
-        if( IsXMLToken(sUseLabel, XML_COLUMN ) )
-            pConsParam->bByCol = true;
-        else if( IsXMLToken( sUseLabel, XML_ROW ) )
-            pConsParam->bByRow = true;
-        else if( IsXMLToken( sUseLabel, XML_BOTH ) )
-            pConsParam->bByCol = pConsParam->bByRow = true;
+        pConsParam->SetAreas( std::move(ppAreas), nCount );
+    }
+
+    pConsParam->bByCol = pConsParam->bByRow = false;
+    if( IsXMLToken(sUseLabel, XML_COLUMN ) )
+        pConsParam->bByCol = true;
+    else if( IsXMLToken( sUseLabel, XML_ROW ) )
+        pConsParam->bByRow = true;
+    else if( IsXMLToken( sUseLabel, XML_BOTH ) )
+        pConsParam->bByCol = pConsParam->bByRow = true;
 
-        pConsParam->bReferenceData = bLinkToSource;
+    pConsParam->bReferenceData = bLinkToSource;
 
-        ScDocument* pDoc = GetScImport().GetDocument();
-        if( pDoc )
-            pDoc->SetConsolidateDlgData( std::move(pConsParam) );
-    }
+    ScDocument* pDoc = GetScImport().GetDocument();
+    if( pDoc )
+        pDoc->SetConsolidateDlgData( std::move(pConsParam) );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/XMLConverter.cxx b/sc/source/filter/xml/XMLConverter.cxx
index 8f288b6b02b9..004479c7a2c6 100644
--- a/sc/source/filter/xml/XMLConverter.cxx
+++ b/sc/source/filter/xml/XMLConverter.cxx
@@ -543,69 +543,70 @@ void ScXMLConditionHelper::parseCondition(
     const sal_Unicode* pcBegin = rAttribute.getStr();
     const sal_Unicode* pcString = pcBegin + nStartIndex;
     const sal_Unicode* pcEnd = pcBegin + rAttribute.getLength();
-    if( const ScXMLConditionInfo* pCondInfo = lclGetConditionInfo( pcString, pcEnd ) )
+    const ScXMLConditionInfo* pCondInfo = lclGetConditionInfo( pcString, pcEnd );
+    if( !pCondInfo )
+        return;
+
+    // insert default values into parse result (may be changed below)
+    rParseResult.meValidation = pCondInfo->meValidation;
+    rParseResult.meOperator = pCondInfo->meOperator;
+    // continue parsing dependent on token type
+    switch( pCondInfo->meType )
     {
-        // insert default values into parse result (may be changed below)
-        rParseResult.meValidation = pCondInfo->meValidation;
-        rParseResult.meOperator = pCondInfo->meOperator;
-        // continue parsing dependent on token type
-        switch( pCondInfo->meType )
-        {
-            case XML_COND_TYPE_KEYWORD:
-                // nothing specific has to follow, success
-                rParseResult.meToken = pCondInfo->meToken;
-            break;
+        case XML_COND_TYPE_KEYWORD:
+            // nothing specific has to follow, success
+            rParseResult.meToken = pCondInfo->meToken;
+        break;
 
-            case XML_COND_TYPE_COMPARISON:
-                // format is <condition>()<operator><expression>
-                if( lclSkipEmptyParentheses( pcString, pcEnd ) )
+        case XML_COND_TYPE_COMPARISON:
+            // format is <condition>()<operator><expression>
+            if( lclSkipEmptyParentheses( pcString, pcEnd ) )
+            {
+                rParseResult.meOperator = lclGetConditionOperator( pcString, pcEnd );
+                if( rParseResult.meOperator != sheet::ConditionOperator_NONE )
                 {
-                    rParseResult.meOperator = lclGetConditionOperator( pcString, pcEnd );
-                    if( rParseResult.meOperator != sheet::ConditionOperator_NONE )
+                    lclSkipWhitespace( pcString, pcEnd );
+                    if( pcString < pcEnd )
                     {
-                        lclSkipWhitespace( pcString, pcEnd );
-                        if( pcString < pcEnd )
-                        {
-                            rParseResult.meToken = pCondInfo->meToken;
-                            // comparison must be at end of attribute, remaining text is the formula
-                            rParseResult.maOperand1 = OUString( pcString, static_cast< sal_Int32 >( pcEnd - pcString ) );
-                        }
+                        rParseResult.meToken = pCondInfo->meToken;
+                        // comparison must be at end of attribute, remaining text is the formula
+                        rParseResult.maOperand1 = OUString( pcString, static_cast< sal_Int32 >( pcEnd - pcString ) );
                     }
                 }
-            break;
+            }
+        break;
+
+        case XML_COND_TYPE_FUNCTION0:
+            // format is <condition>()
+            if( lclSkipEmptyParentheses( pcString, pcEnd ) )
+                rParseResult.meToken = pCondInfo->meToken;
+        break;
 
-            case XML_COND_TYPE_FUNCTION0:
-                // format is <condition>()
-                if( lclSkipEmptyParentheses( pcString, pcEnd ) )
+        case XML_COND_TYPE_FUNCTION1:
+            // format is <condition>(<expression>)
+            if( (pcString < pcEnd) && (*pcString == '(') )
+            {
+                rParseResult.maOperand1 = getExpression( ++pcString, pcEnd, ')' );
+                if( !rParseResult.maOperand1.isEmpty() )
                     rParseResult.meToken = pCondInfo->meToken;
-            break;
+            }
+        break;
 
-            case XML_COND_TYPE_FUNCTION1:
-                // format is <condition>(<expression>)
-                if( (pcString < pcEnd) && (*pcString == '(') )
+        case XML_COND_TYPE_FUNCTION2:
+            // format is <condition>(<expression1>,<expression2>)
+            if( (pcString < pcEnd) && (*pcString == '(') )
+            {
+                rParseResult.maOperand1 = getExpression( ++pcString, pcEnd, ',' );
+                if( !rParseResult.maOperand1.isEmpty() )
                 {
-                    rParseResult.maOperand1 = getExpression( ++pcString, pcEnd, ')' );
-                    if( !rParseResult.maOperand1.isEmpty() )
+                    rParseResult.maOperand2 = getExpression( pcString, pcEnd, ')' );
+                    if( !rParseResult.maOperand2.isEmpty() )
                         rParseResult.meToken = pCondInfo->meToken;
                 }
-            break;
-
-            case XML_COND_TYPE_FUNCTION2:
-                // format is <condition>(<expression1>,<expression2>)
-                if( (pcString < pcEnd) && (*pcString == '(') )
-                {
-                    rParseResult.maOperand1 = getExpression( ++pcString, pcEnd, ',' );
-                    if( !rParseResult.maOperand1.isEmpty() )
-                    {
-                        rParseResult.maOperand2 = getExpression( pcString, pcEnd, ')' );
-                        if( !rParseResult.maOperand2.isEmpty() )
-                            rParseResult.meToken = pCondInfo->meToken;
-                    }
-                }
-            break;
-        }
-        rParseResult.mnEndIndex = static_cast< sal_Int32 >( pcString - pcBegin );
+            }
+        break;
     }
+    rParseResult.mnEndIndex = static_cast< sal_Int32 >( pcString - pcBegin );
 }
 
 OUString ScXMLConditionHelper::getExpression( const sal_Unicode*& rpcString, const sal_Unicode* pcEnd, sal_Unicode cEndChar )
diff --git a/sc/source/filter/xml/XMLDDELinksContext.cxx b/sc/source/filter/xml/XMLDDELinksContext.cxx
index 592197e5d39d..7bbf78d60fe2 100644
--- a/sc/source/filter/xml/XMLDDELinksContext.cxx
+++ b/sc/source/filter/xml/XMLDDELinksContext.cxx
@@ -126,51 +126,51 @@ void ScXMLDDELinkContext::AddRowsToTable(const sal_Int32 nRowsP)
 void SAL_CALL ScXMLDDELinkContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     ScDocument* pDoc = GetScImport().GetDocument();
-    if (nPosition > -1 && nColumns && nRows)
+    if (!(nPosition > -1 && nColumns && nRows))
+        return;
+
+    bool bSizeMatch = (static_cast<size_t>(nColumns * nRows) == aDDELinkTable.size());
+    OSL_ENSURE( bSizeMatch, "ScXMLDDELinkContext::EndElement: matrix dimension doesn't match cells count");
+    // Excel writes bad ODF in that it does not write the
+    // table:number-columns-repeated attribute of the
+    // <table:table-column> element, but apparently uses the number of
+    // <table:table-cell> elements within a <table:table-row> element to
+    // determine the column count instead. Be lenient ...
+    if (!bSizeMatch && nColumns == 1)
     {
-        bool bSizeMatch = (static_cast<size_t>(nColumns * nRows) == aDDELinkTable.size());
-        OSL_ENSURE( bSizeMatch, "ScXMLDDELinkContext::EndElement: matrix dimension doesn't match cells count");
-        // Excel writes bad ODF in that it does not write the
-        // table:number-columns-repeated attribute of the
-        // <table:table-column> element, but apparently uses the number of
-        // <table:table-cell> elements within a <table:table-row> element to
-        // determine the column count instead. Be lenient ...
-        if (!bSizeMatch && nColumns == 1)
-        {
-            nColumns = aDDELinkTable.size() / nRows;
-            OSL_ENSURE( static_cast<size_t>(nColumns * nRows) == aDDELinkTable.size(),
-                    "ScXMLDDELinkContext::EndElement: adapted matrix dimension doesn't match either");
-        }
-        ScMatrixRef pMatrix = new ScMatrix(static_cast<SCSIZE>(nColumns), static_cast<SCSIZE>(nRows), 0.0);
-        sal_Int32 nCol(0);
-        sal_Int32 nRow(-1);
-        sal_Int32 nIndex(0);
+        nColumns = aDDELinkTable.size() / nRows;
+        OSL_ENSURE( static_cast<size_t>(nColumns * nRows) == aDDELinkTable.size(),
+                "ScXMLDDELinkContext::EndElement: adapted matrix dimension doesn't match either");
+    }
+    ScMatrixRef pMatrix = new ScMatrix(static_cast<SCSIZE>(nColumns), static_cast<SCSIZE>(nRows), 0.0);
+    sal_Int32 nCol(0);
+    sal_Int32 nRow(-1);
+    sal_Int32 nIndex(0);
 
-        svl::SharedStringPool& rPool = pDoc->GetSharedStringPool();
-        for (const auto& rDDELinkCell : aDDELinkTable)
+    svl::SharedStringPool& rPool = pDoc->GetSharedStringPool();
+    for (const auto& rDDELinkCell : aDDELinkTable)
+    {
+        if (nIndex % nColumns == 0)
         {
-            if (nIndex % nColumns == 0)
-            {
-                ++nRow;
-                nCol = 0;
-            }
-            else
-                ++nCol;
-
-            SCSIZE nScCol( static_cast< SCSIZE >( nCol ) );
-            SCSIZE nScRow( static_cast< SCSIZE >( nRow ) );
-            if( rDDELinkCell.bEmpty )
-                pMatrix->PutEmpty( nScCol, nScRow );
-            else if( rDDELinkCell.bString )
-                pMatrix->PutString(rPool.intern(rDDELinkCell.sValue), nScCol, nScRow);
-            else
-                pMatrix->PutDouble( rDDELinkCell.fValue, nScCol, nScRow );
-
-            ++nIndex;
+            ++nRow;
+            nCol = 0;
         }
+        else
+            ++nCol;
+
+        SCSIZE nScCol( static_cast< SCSIZE >( nCol ) );
+        SCSIZE nScRow( static_cast< SCSIZE >( nRow ) );
+        if( rDDELinkCell.bEmpty )
+            pMatrix->PutEmpty( nScCol, nScRow );
+        else if( rDDELinkCell.bString )
+            pMatrix->PutString(rPool.intern(rDDELinkCell.sValue), nScCol, nScRow);
+        else
+            pMatrix->PutDouble( rDDELinkCell.fValue, nScCol, nScRow );
 
-        GetScImport().GetDocument()->SetDdeLinkResultMatrix( static_cast< sal_uInt16 >( nPosition ), pMatrix );
+        ++nIndex;
     }
+
+    GetScImport().GetDocument()->SetDdeLinkResultMatrix( static_cast< sal_uInt16 >( nPosition ), pMatrix );
 }
 
 ScXMLDDESourceContext::ScXMLDDESourceContext( ScXMLImport& rImport,
@@ -179,30 +179,30 @@ ScXMLDDESourceContext::ScXMLDDESourceContext( ScXMLImport& rImport,
     ScXMLImportContext( rImport ),
     pDDELink(pTempDDELink)
 {
-    if ( rAttrList.is() )
+    if ( !rAttrList.is() )
+        return;
+
+    for (auto &aIter : *rAttrList)
     {
-        for (auto &aIter : *rAttrList)
+        switch (aIter.getToken())
         {
-            switch (aIter.getToken())
-            {
-                case XML_ELEMENT( OFFICE, XML_DDE_APPLICATION ):
-                    pDDELink->SetApplication(aIter.toString());
-                break;
-                case XML_ELEMENT( OFFICE, XML_DDE_TOPIC ):
-                    pDDELink->SetTopic(aIter.toString());
-                break;
-                case XML_ELEMENT( OFFICE, XML_DDE_ITEM ):
-                    pDDELink->SetItem(aIter.toString());
-                break;
-                case XML_ELEMENT( TABLE, XML_CONVERSION_MODE ):
-                    if (IsXMLToken(aIter, XML_INTO_ENGLISH_NUMBER))
-                        pDDELink->SetMode(SC_DDE_ENGLISH);
-                    else if (IsXMLToken(aIter, XML_KEEP_TEXT))
-                        pDDELink->SetMode(SC_DDE_TEXT);
-                    else
-                        pDDELink->SetMode(SC_DDE_DEFAULT);
-                break;
-            }
+            case XML_ELEMENT( OFFICE, XML_DDE_APPLICATION ):
+                pDDELink->SetApplication(aIter.toString());
+            break;
+            case XML_ELEMENT( OFFICE, XML_DDE_TOPIC ):
+                pDDELink->SetTopic(aIter.toString());
+            break;
+            case XML_ELEMENT( OFFICE, XML_DDE_ITEM ):
+                pDDELink->SetItem(aIter.toString());
+            break;
+            case XML_ELEMENT( TABLE, XML_CONVERSION_MODE ):
+                if (IsXMLToken(aIter, XML_INTO_ENGLISH_NUMBER))
+                    pDDELink->SetMode(SC_DDE_ENGLISH);
+                else if (IsXMLToken(aIter, XML_KEEP_TEXT))
+                    pDDELink->SetMode(SC_DDE_TEXT);
+                else
+                    pDDELink->SetMode(SC_DDE_DEFAULT);
+            break;
         }
     }
 }
@@ -319,32 +319,32 @@ ScXMLDDECellContext::ScXMLDDECellContext( ScXMLImport& rImport,
     bEmpty(true),
     pDDELink(pTempDDELink)
 {
-    if ( rAttrList.is() )
+    if ( !rAttrList.is() )
+        return;
+
+    for (auto &aIter : *rAttrList)
     {
-        for (auto &aIter : *rAttrList)
+        switch (aIter.getToken())
         {
-            switch (aIter.getToken())
-            {
-                case XML_ELEMENT( OFFICE, XML_VALUE_TYPE ):
-                    if (IsXMLToken(aIter, XML_STRING))
-                        bString = true;
-                    else
-                        bString = false;
-                break;
-                case XML_ELEMENT( OFFICE, XML_STRING_VALUE ):
-                    sValue = aIter.toString();
-                    bEmpty = false;
-                    bString2 = true;
-                break;
-                case XML_ELEMENT( OFFICE, XML_VALUE ):
-                    fValue = aIter.toDouble();
-                    bEmpty = false;
-                    bString2 = false;
-                break;
-                case XML_ELEMENT( TABLE, XML_NUMBER_COLUMNS_REPEATED ):
-                    nCells = aIter.toInt32();
-                break;
-            }
+            case XML_ELEMENT( OFFICE, XML_VALUE_TYPE ):
+                if (IsXMLToken(aIter, XML_STRING))
+                    bString = true;
+                else
+                    bString = false;
+            break;
+            case XML_ELEMENT( OFFICE, XML_STRING_VALUE ):
+                sValue = aIter.toString();
+                bEmpty = false;
+                bString2 = true;
+            break;
+            case XML_ELEMENT( OFFICE, XML_VALUE ):
+                fValue = aIter.toDouble();
+                bEmpty = false;
+                bString2 = false;
+            break;
+            case XML_ELEMENT( TABLE, XML_NUMBER_COLUMNS_REPEATED ):
+                nCells = aIter.toInt32();
+            break;
         }
     }
 }
diff --git a/sc/source/filter/xml/XMLDetectiveContext.cxx b/sc/source/filter/xml/XMLDetectiveContext.cxx
index 3d62ce7076c9..90de30f44c77 100644
--- a/sc/source/filter/xml/XMLDetectiveContext.cxx
+++ b/sc/source/filter/xml/XMLDetectiveContext.cxx
@@ -97,32 +97,32 @@ ScXMLDetectiveHighlightedContext::ScXMLDetectiveHighlightedContext(
     aDetectiveObj(),
     bValid( false )
 {
-    if ( rAttrList.is() )
+    if ( !rAttrList.is() )
+        return;
+
+    for (auto &aIter : *rAttrList)
     {
-        for (auto &aIter : *rAttrList)
+        switch (aIter.getToken())
         {
-            switch (aIter.getToken())
+            case XML_ELEMENT( TABLE, XML_CELL_RANGE_ADDRESS ):
             {
-                case XML_ELEMENT( TABLE, XML_CELL_RANGE_ADDRESS ):
-                {
-                    sal_Int32 nOffset(0);
-                    ScXMLImport::MutexGuard aGuard(GetScImport());
-                    bValid = ScRangeStringConverter::GetRangeFromString( aDetectiveObj.aSourceRange, aIter.toString(), GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset );
-                }
-                break;
-                case XML_ELEMENT( TABLE, XML_DIRECTION ):
-                    aDetectiveObj.eObjType = ScXMLConverter::GetDetObjTypeFromString( aIter.toString() );
-                break;
-                case XML_ELEMENT( TABLE, XML_CONTAINS_ERROR ):
-                    aDetectiveObj.bHasError = IsXMLToken(aIter, XML_TRUE);
-                break;
-                case XML_ELEMENT( TABLE, XML_MARKED_INVALID ):
-                {
-                    if (IsXMLToken(aIter, XML_TRUE))
-                        aDetectiveObj.eObjType = SC_DETOBJ_CIRCLE;
-                }
-                break;
+                sal_Int32 nOffset(0);
+                ScXMLImport::MutexGuard aGuard(GetScImport());
+                bValid = ScRangeStringConverter::GetRangeFromString( aDetectiveObj.aSourceRange, aIter.toString(), GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset );
+            }
+            break;
+            case XML_ELEMENT( TABLE, XML_DIRECTION ):
+                aDetectiveObj.eObjType = ScXMLConverter::GetDetObjTypeFromString( aIter.toString() );
+            break;
+            case XML_ELEMENT( TABLE, XML_CONTAINS_ERROR ):
+                aDetectiveObj.bHasError = IsXMLToken(aIter, XML_TRUE);
+            break;
+            case XML_ELEMENT( TABLE, XML_MARKED_INVALID ):
+            {
+                if (IsXMLToken(aIter, XML_TRUE))
+                    aDetectiveObj.eObjType = SC_DETOBJ_CIRCLE;
             }
+            break;
         }
     }
 }
diff --git a/sc/source/filter/xml/XMLExportDDELinks.cxx b/sc/source/filter/xml/XMLExportDDELinks.cxx
index 9d2ef95b64bc..c5999a7e2294 100644
--- a/sc/source/filter/xml/XMLExportDDELinks.cxx
+++ b/sc/source/filter/xml/XMLExportDDELinks.cxx
@@ -116,46 +116,46 @@ void ScXMLExportDDELinks::WriteTable(const sal_Int32 nPos)
 void ScXMLExportDDELinks::WriteDDELinks(const uno::Reference<sheet::XSpreadsheetDocument>& xSpreadDoc)
 {
     uno::Reference <beans::XPropertySet> xPropertySet (xSpreadDoc, uno::UNO_QUERY);
-    if (xPropertySet.is())
+    if (!xPropertySet.is())
+        return;
+
+    uno::Reference<container::XIndexAccess> xIndex(xPropertySet->getPropertyValue(SC_UNO_DDELINKS), uno::UNO_QUERY);
+    if (!xIndex.is())
+        return;
+
+    sal_Int32 nCount = xIndex->getCount();
+    if (!nCount)
+        return;
+
+    SvXMLElementExport aElemDDEs(rExport, XML_NAMESPACE_TABLE, XML_DDE_LINKS, true, true);
+    for (sal_Int32 nDDELink = 0; nDDELink < nCount; ++nDDELink)
     {
-        uno::Reference<container::XIndexAccess> xIndex(xPropertySet->getPropertyValue(SC_UNO_DDELINKS), uno::UNO_QUERY);
-        if (xIndex.is())
+        uno::Reference<sheet::XDDELink> xDDELink(xIndex->getByIndex(nDDELink), uno::UNO_QUERY);
+        if (xDDELink.is())
         {
-            sal_Int32 nCount = xIndex->getCount();
-            if (nCount)
+            SvXMLElementExport aElemDDE(rExport, XML_NAMESPACE_TABLE, XML_DDE_LINK, true, true);
             {
-                SvXMLElementExport aElemDDEs(rExport, XML_NAMESPACE_TABLE, XML_DDE_LINKS, true, true);
-                for (sal_Int32 nDDELink = 0; nDDELink < nCount; ++nDDELink)
+                rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION, xDDELink->getApplication());
+                rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_DDE_TOPIC, xDDELink->getTopic());
+                rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_DDE_ITEM, xDDELink->getItem());
+                rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_AUTOMATIC_UPDATE, XML_TRUE);
+                sal_uInt8 nMode;
+                if (rExport.GetDocument() &&
+                    rExport.GetDocument()->GetDdeLinkMode(nDDELink, nMode))
                 {
-                    uno::Reference<sheet::XDDELink> xDDELink(xIndex->getByIndex(nDDELink), uno::UNO_QUERY);
-                    if (xDDELink.is())
+                    switch (nMode)
                     {
-                        SvXMLElementExport aElemDDE(rExport, XML_NAMESPACE_TABLE, XML_DDE_LINK, true, true);
-                        {
-                            rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION, xDDELink->getApplication());
-                            rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_DDE_TOPIC, xDDELink->getTopic());
-                            rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_DDE_ITEM, xDDELink->getItem());
-                            rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_AUTOMATIC_UPDATE, XML_TRUE);
-                            sal_uInt8 nMode;
-                            if (rExport.GetDocument() &&
-                                rExport.GetDocument()->GetDdeLinkMode(nDDELink, nMode))
-                            {
-                                switch (nMode)
-                                {
-                                    case SC_DDE_ENGLISH :
-                                        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CONVERSION_MODE, XML_INTO_ENGLISH_NUMBER);
-                                    break;
-                                    case SC_DDE_TEXT :
-                                        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CONVERSION_MODE, XML_KEEP_TEXT);
-                                    break;
-                                }
-                            }
-                            SvXMLElementExport(rExport, XML_NAMESPACE_OFFICE, XML_DDE_SOURCE, true, true);
-                        }
-                        WriteTable(nDDELink);
+                        case SC_DDE_ENGLISH :
+                            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CONVERSION_MODE, XML_INTO_ENGLISH_NUMBER);
+                        break;
+                        case SC_DDE_TEXT :
+                            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CONVERSION_MODE, XML_KEEP_TEXT);
+                        break;
                     }
                 }
+                SvXMLElementExport(rExport, XML_NAMESPACE_OFFICE, XML_DDE_SOURCE, true, true);
             }
+            WriteTable(nDDELink);
         }
     }
 }
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx
index 185e43efdaca..8b5e169bd7bf 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -144,125 +144,125 @@ void ScXMLExportDataPilot::WriteDPCondition(const ScQueryEntry& aQueryEntry, boo
 void ScXMLExportDataPilot::WriteDPFilter(const ScQueryParam& aQueryParam)
 {
     SCSIZE nQueryEntryCount = aQueryParam.GetEntryCount();
-    if (nQueryEntryCount > 0)
-    {
-        bool bAnd(false);
-        bool bOr(false);
-        bool bHasEntries(true);
-        SCSIZE nEntries(0);
-        SCSIZE j;
+    if (nQueryEntryCount <= 0)
+        return;
 
-        for ( j = 0; (j < nQueryEntryCount) && bHasEntries; ++j)
+    bool bAnd(false);
+    bool bOr(false);
+    bool bHasEntries(true);
+    SCSIZE nEntries(0);
+    SCSIZE j;
+
+    for ( j = 0; (j < nQueryEntryCount) && bHasEntries; ++j)
+    {
+        ScQueryEntry aEntry = aQueryParam.GetEntry(j);
+        if (aEntry.bDoQuery)
         {
-            ScQueryEntry aEntry = aQueryParam.GetEntry(j);
-            if (aEntry.bDoQuery)
+            if (nEntries > 0)
             {
-                if (nEntries > 0)
-                {
-                    if (aEntry.eConnect == SC_AND)
-                        bAnd = true;
-                    else
-                        bOr = true;
-                }
-                ++nEntries;
+                if (aEntry.eConnect == SC_AND)
+                    bAnd = true;
+                else
+                    bOr = true;
             }
-            else
-                bHasEntries = false;
+            ++nEntries;
         }
-        nQueryEntryCount = nEntries;
-        if (nQueryEntryCount)
+        else
+            bHasEntries = false;
+    }
+    nQueryEntryCount = nEntries;
+    if (!nQueryEntryCount)
+        return;
+
+    if(!((aQueryParam.nCol1 == aQueryParam.nCol2) && (aQueryParam.nRow1 == aQueryParam.nRow2) &&
+                (static_cast<SCCOLROW>(aQueryParam.nCol1) == static_cast<SCCOLROW>(aQueryParam.nRow1)) &&
+                (aQueryParam.nCol1 == 0) && (aQueryParam.nTab == SCTAB_MAX)))
+    {
+        ScRange aConditionRange(aQueryParam.nCol1, aQueryParam.nRow1, aQueryParam.nTab,
+            aQueryParam.nCol2, aQueryParam.nRow2, aQueryParam.nTab);
+        OUString sConditionRange;
+        ScRangeStringConverter::GetStringFromRange( sConditionRange, aConditionRange, pDoc, ::formula::FormulaGrammar::CONV_OOO );
+        if (!sConditionRange.isEmpty())
+            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE_RANGE_ADDRESS, sConditionRange);
+    }
+    if (!aQueryParam.bDuplicate)
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_DUPLICATES, XML_FALSE);
+    SvXMLElementExport aElemDPF(rExport, XML_NAMESPACE_TABLE, XML_FILTER, true, true);
+    rExport.CheckAttrList();
+    if (nQueryEntryCount  == 1)
+    {
+            WriteDPCondition(aQueryParam.GetEntry(0), aQueryParam.bCaseSens, aQueryParam.eSearchType);
+    }
+    else if (bOr && !bAnd)
+    {
+        SvXMLElementExport aElemOr(rExport, XML_NAMESPACE_TABLE, XML_FILTER_OR, true, true);
+        for (j = 0; j < nQueryEntryCount; ++j)
         {
-            if(!((aQueryParam.nCol1 == aQueryParam.nCol2) && (aQueryParam.nRow1 == aQueryParam.nRow2) &&
-                        (static_cast<SCCOLROW>(aQueryParam.nCol1) == static_cast<SCCOLROW>(aQueryParam.nRow1)) &&
-                        (aQueryParam.nCol1 == 0) && (aQueryParam.nTab == SCTAB_MAX)))
-            {
-                ScRange aConditionRange(aQueryParam.nCol1, aQueryParam.nRow1, aQueryParam.nTab,
-                    aQueryParam.nCol2, aQueryParam.nRow2, aQueryParam.nTab);
-                OUString sConditionRange;
-                ScRangeStringConverter::GetStringFromRange( sConditionRange, aConditionRange, pDoc, ::formula::FormulaGrammar::CONV_OOO );
-                if (!sConditionRange.isEmpty())
-                    rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE_RANGE_ADDRESS, sConditionRange);
-            }
-            if (!aQueryParam.bDuplicate)
-                rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_DUPLICATES, XML_FALSE);
-            SvXMLElementExport aElemDPF(rExport, XML_NAMESPACE_TABLE, XML_FILTER, true, true);
-            rExport.CheckAttrList();
-            if (nQueryEntryCount  == 1)
-            {
-                    WriteDPCondition(aQueryParam.GetEntry(0), aQueryParam.bCaseSens, aQueryParam.eSearchType);
-            }
-            else if (bOr && !bAnd)
-            {
-                SvXMLElementExport aElemOr(rExport, XML_NAMESPACE_TABLE, XML_FILTER_OR, true, true);
-                for (j = 0; j < nQueryEntryCount; ++j)
-                {
-                    WriteDPCondition(aQueryParam.GetEntry(j), aQueryParam.bCaseSens, aQueryParam.eSearchType);
-                }
-            }
-            else if (bAnd && !bOr)
-            {
-                SvXMLElementExport aElemAnd(rExport, XML_NAMESPACE_TABLE, XML_FILTER_AND, true, true);
-                for (j = 0; j < nQueryEntryCount; ++j)
-                {
-                    WriteDPCondition(aQueryParam.GetEntry(j), aQueryParam.bCaseSens, aQueryParam.eSearchType);
-                }
-            }
-            else
+            WriteDPCondition(aQueryParam.GetEntry(j), aQueryParam.bCaseSens, aQueryParam.eSearchType);
+        }
+    }
+    else if (bAnd && !bOr)
+    {
+        SvXMLElementExport aElemAnd(rExport, XML_NAMESPACE_TABLE, XML_FILTER_AND, true, true);
+        for (j = 0; j < nQueryEntryCount; ++j)
+        {
+            WriteDPCondition(aQueryParam.GetEntry(j), aQueryParam.bCaseSens, aQueryParam.eSearchType);
+        }
+    }
+    else
+    {
+        SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_FILTER_OR, true, true);
+        ScQueryEntry aPrevFilterField(aQueryParam.GetEntry(0));
+        ScQueryConnect aConnection = aQueryParam.GetEntry(1).eConnect;
+        bool bOpenAndElement;
+        OUString aName(rExport.GetNamespaceMap().GetQNameByKey(XML_NAMESPACE_TABLE, GetXMLToken(XML_FILTER_AND)));
+        if (aConnection == SC_AND)
+        {
+            rExport.StartElement( aName, true );
+            bOpenAndElement = true;
+        }
+        else
+            bOpenAndElement = false;
+        for (j = 1; j < nQueryEntryCount; ++j)
+        {
+            if (aConnection != aQueryParam.GetEntry(j).eConnect)
             {
-                SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_FILTER_OR, true, true);
-                ScQueryEntry aPrevFilterField(aQueryParam.GetEntry(0));
-                ScQueryConnect aConnection = aQueryParam.GetEntry(1).eConnect;
-                bool bOpenAndElement;
-                OUString aName(rExport.GetNamespaceMap().GetQNameByKey(XML_NAMESPACE_TABLE, GetXMLToken(XML_FILTER_AND)));
-                if (aConnection == SC_AND)
+                aConnection = aQueryParam.GetEntry(j).eConnect;
+                if (aQueryParam.GetEntry(j).eConnect == SC_AND)
                 {
                     rExport.StartElement( aName, true );
                     bOpenAndElement = true;
+                    WriteDPCondition(aPrevFilterField, aQueryParam.bCaseSens, aQueryParam.eSearchType);
+                    aPrevFilterField = aQueryParam.GetEntry(j);
+                    if (j == nQueryEntryCount - 1)
+                    {
+                        WriteDPCondition(aPrevFilterField, aQueryParam.bCaseSens, aQueryParam.eSearchType);
+                        rExport.EndElement(aName, true);
+                        bOpenAndElement = false;
+                    }
                 }
                 else
-                    bOpenAndElement = false;
-                for (j = 1; j < nQueryEntryCount; ++j)
                 {
-                    if (aConnection != aQueryParam.GetEntry(j).eConnect)
+                    WriteDPCondition(aPrevFilterField, aQueryParam.bCaseSens, aQueryParam.eSearchType);
+                    aPrevFilterField = aQueryParam.GetEntry(j);
+                    if (bOpenAndElement)
                     {
-                        aConnection = aQueryParam.GetEntry(j).eConnect;
-                        if (aQueryParam.GetEntry(j).eConnect == SC_AND)
-                        {
-                            rExport.StartElement( aName, true );
-                            bOpenAndElement = true;
-                            WriteDPCondition(aPrevFilterField, aQueryParam.bCaseSens, aQueryParam.eSearchType);
-                            aPrevFilterField = aQueryParam.GetEntry(j);
-                            if (j == nQueryEntryCount - 1)
-                            {
-                                WriteDPCondition(aPrevFilterField, aQueryParam.bCaseSens, aQueryParam.eSearchType);
-                                rExport.EndElement(aName, true);
-                                bOpenAndElement = false;
-                            }
-                        }
-                        else
-                        {
-                            WriteDPCondition(aPrevFilterField, aQueryParam.bCaseSens, aQueryParam.eSearchType);
-                            aPrevFilterField = aQueryParam.GetEntry(j);
-                            if (bOpenAndElement)
-                            {
-                                rExport.EndElement(aName, true);
-                                bOpenAndElement = false;
-                            }
-                            if (j == nQueryEntryCount - 1)
-                            {
-                                WriteDPCondition(aPrevFilterField, aQueryParam.bCaseSens, aQueryParam.eSearchType);
-                            }
-                        }
+                        rExport.EndElement(aName, true);
+                        bOpenAndElement = false;
                     }
-                    else
+                    if (j == nQueryEntryCount - 1)
                     {
                         WriteDPCondition(aPrevFilterField, aQueryParam.bCaseSens, aQueryParam.eSearchType);
-                        aPrevFilterField = aQueryParam.GetEntry(j);
-                        if (j == nQueryEntryCount - 1)
-                            WriteDPCondition(aPrevFilterField, aQueryParam.bCaseSens, aQueryParam.eSearchType);
                     }
                 }
             }
+            else
+            {
+                WriteDPCondition(aPrevFilterField, aQueryParam.bCaseSens, aQueryParam.eSearchType);
+                aPrevFilterField = aQueryParam.GetEntry(j);
+                if (j == nQueryEntryCount - 1)
+                    WriteDPCondition(aPrevFilterField, aQueryParam.bCaseSens, aQueryParam.eSearchType);
+            }
         }
     }
 }
@@ -337,95 +337,95 @@ void ScXMLExportDataPilot::WriteFieldReference(const ScDPSaveDimension* pDim)
 void ScXMLExportDataPilot::WriteSortInfo(const ScDPSaveDimension* pDim)
 {
     const sheet::DataPilotFieldSortInfo* pSortInfo = pDim->GetSortInfo();
-    if (pSortInfo)
-    {
-        if (pSortInfo->IsAscending)
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ORDER, XML_ASCENDING);
-        else
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ORDER, XML_DESCENDING);
+    if (!pSortInfo)
+        return;
 
-        OUString sValueStr;
-        switch (pSortInfo->Mode)
-        {
-            case sheet::DataPilotFieldSortMode::NONE:
-            sValueStr = GetXMLToken(XML_NONE);
-            break;
-            case sheet::DataPilotFieldSortMode::MANUAL:
-            sValueStr = GetXMLToken(XML_MANUAL);
-            break;
-            case sheet::DataPilotFieldSortMode::NAME:
-            sValueStr = GetXMLToken(XML_NAME);
-            break;
-            case sheet::DataPilotFieldSortMode::DATA:
-            sValueStr = GetXMLToken(XML_DATA);
-            if (!pSortInfo->Field.isEmpty())
-                rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_FIELD, pSortInfo->Field);
-            break;
-        }
-        if (!sValueStr.isEmpty())
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SORT_MODE, sValueStr);
-        SvXMLElementExport aElemDPLSI(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_SORT_INFO, true, true);
+    if (pSortInfo->IsAscending)
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ORDER, XML_ASCENDING);
+    else
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ORDER, XML_DESCENDING);
+
+    OUString sValueStr;
+    switch (pSortInfo->Mode)
+    {
+        case sheet::DataPilotFieldSortMode::NONE:
+        sValueStr = GetXMLToken(XML_NONE);
+        break;
+        case sheet::DataPilotFieldSortMode::MANUAL:
+        sValueStr = GetXMLToken(XML_MANUAL);
+        break;
+        case sheet::DataPilotFieldSortMode::NAME:
+        sValueStr = GetXMLToken(XML_NAME);
+        break;
+        case sheet::DataPilotFieldSortMode::DATA:
+        sValueStr = GetXMLToken(XML_DATA);
+        if (!pSortInfo->Field.isEmpty())
+            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_FIELD, pSortInfo->Field);
+        break;
     }
+    if (!sValueStr.isEmpty())
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SORT_MODE, sValueStr);
+    SvXMLElementExport aElemDPLSI(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_SORT_INFO, true, true);
 }
 
 void ScXMLExportDataPilot::WriteAutoShowInfo(const ScDPSaveDimension* pDim)
 {
     const sheet::DataPilotFieldAutoShowInfo* pAutoInfo = pDim->GetAutoShowInfo();
-    if (pAutoInfo)
-    {
-        if (pAutoInfo->IsEnabled)
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ENABLED, XML_TRUE);
-        else
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ENABLED, XML_FALSE);
+    if (!pAutoInfo)
+        return;
 
-        OUString sValueStr;
-        switch (pAutoInfo->ShowItemsMode)
-        {
-            case sheet::DataPilotFieldShowItemsMode::FROM_TOP:
-            sValueStr = GetXMLToken(XML_FROM_TOP);
-            break;
-            case sheet::DataPilotFieldShowItemsMode::FROM_BOTTOM:
-            sValueStr = GetXMLToken(XML_FROM_BOTTOM);
-            break;
-        }
-        if (!sValueStr.isEmpty())
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_MEMBER_MODE, sValueStr);
+    if (pAutoInfo->IsEnabled)
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ENABLED, XML_TRUE);
+    else
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ENABLED, XML_FALSE);
 
-        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_MEMBER_COUNT, OUString::number(pAutoInfo->ItemCount));
+    OUString sValueStr;
+    switch (pAutoInfo->ShowItemsMode)
+    {
+        case sheet::DataPilotFieldShowItemsMode::FROM_TOP:
+        sValueStr = GetXMLToken(XML_FROM_TOP);
+        break;
+        case sheet::DataPilotFieldShowItemsMode::FROM_BOTTOM:
+        sValueStr = GetXMLToken(XML_FROM_BOTTOM);
+        break;
+    }
+    if (!sValueStr.isEmpty())
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_MEMBER_MODE, sValueStr);
 
-        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_FIELD, pAutoInfo->DataField);
+    rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_MEMBER_COUNT, OUString::number(pAutoInfo->ItemCount));
 
-        SvXMLElementExport aElemDPLAI(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_DISPLAY_INFO, true, true);
-    }
+    rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_FIELD, pAutoInfo->DataField);
+
+    SvXMLElementExport aElemDPLAI(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_DISPLAY_INFO, true, true);
 }
 
 void ScXMLExportDataPilot::WriteLayoutInfo(const ScDPSaveDimension* pDim)
 {
     const sheet::DataPilotFieldLayoutInfo* pLayoutInfo = pDim->GetLayoutInfo();
-    if (pLayoutInfo)
-    {
-        if (pLayoutInfo->AddEmptyLines)
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ADD_EMPTY_LINES, XML_TRUE);
-        else
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ADD_EMPTY_LINES, XML_FALSE);
+    if (!pLayoutInfo)
+        return;
 
-        OUString sValueStr;
-        switch (pLayoutInfo->LayoutMode)
-        {
-            case sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT:
-            sValueStr = GetXMLToken(XML_TABULAR_LAYOUT);
-            break;
-            case sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP:
-            sValueStr = GetXMLToken(XML_OUTLINE_SUBTOTALS_TOP);
-            break;
-            case sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_BOTTOM:
-            sValueStr = GetXMLToken(XML_OUTLINE_SUBTOTALS_BOTTOM);
-            break;
-        }
-        if (!sValueStr.isEmpty())
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_LAYOUT_MODE, sValueStr);
-        SvXMLElementExport aElemDPLLI(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_LAYOUT_INFO, true, true);
+    if (pLayoutInfo->AddEmptyLines)
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ADD_EMPTY_LINES, XML_TRUE);
+    else
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ADD_EMPTY_LINES, XML_FALSE);
+
+    OUString sValueStr;
+    switch (pLayoutInfo->LayoutMode)
+    {
+        case sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT:
+        sValueStr = GetXMLToken(XML_TABULAR_LAYOUT);
+        break;
+        case sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP:
+        sValueStr = GetXMLToken(XML_OUTLINE_SUBTOTALS_TOP);
+        break;
+        case sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_BOTTOM:
+        sValueStr = GetXMLToken(XML_OUTLINE_SUBTOTALS_BOTTOM);
+        break;
     }
+    if (!sValueStr.isEmpty())
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_LAYOUT_MODE, sValueStr);
+    SvXMLElementExport aElemDPLLI(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_LAYOUT_INFO, true, true);
 }
 
 void ScXMLExportDataPilot::WriteSubTotals(const ScDPSaveDimension* pDim)
@@ -436,50 +436,50 @@ void ScXMLExportDataPilot::WriteSubTotals(const ScDPSaveDimension* pDim)
         // Export display names only for 1.2 extended or later.
         pLayoutName = pDim->GetSubtotalName();
 
-    if (nSubTotalCount > 0)
+    if (nSubTotalCount <= 0)
+        return;
+
+    SvXMLElementExport aElemSTs(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTALS, true, true);
+    rExport.CheckAttrList();
+    for (sal_Int32 nSubTotal = 0; nSubTotal < nSubTotalCount; nSubTotal++)
     {
-        SvXMLElementExport aElemSTs(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTALS, true, true);
-        rExport.CheckAttrList();
-        for (sal_Int32 nSubTotal = 0; nSubTotal < nSubTotalCount; nSubTotal++)
-        {
-            OUString sFunction;
-            sal_Int16 nFunc = static_cast<sal_Int16>(pDim->GetSubTotalFunc(nSubTotal));
-            ScXMLConverter::GetStringFromFunction( sFunction, nFunc);
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FUNCTION, sFunction);
-            if (pLayoutName && nFunc == sheet::GeneralFunction2::AUTO)
-                rExport.AddAttribute(XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, *pLayoutName);
-            SvXMLElementExport aElemST(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTAL, true, true);
-        }
+        OUString sFunction;
+        sal_Int16 nFunc = static_cast<sal_Int16>(pDim->GetSubTotalFunc(nSubTotal));
+        ScXMLConverter::GetStringFromFunction( sFunction, nFunc);
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FUNCTION, sFunction);
+        if (pLayoutName && nFunc == sheet::GeneralFunction2::AUTO)
+            rExport.AddAttribute(XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, *pLayoutName);
+        SvXMLElementExport aElemST(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTAL, true, true);
     }
 }
 
 void ScXMLExportDataPilot::WriteMembers(const ScDPSaveDimension* pDim)
 {
     const ScDPSaveDimension::MemberList &rMembers = pDim->GetMembers();
-    if (!rMembers.empty())
-    {
-        SvXMLElementExport aElemDPMs(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBERS, true, true);
-        rExport.CheckAttrList();
-        for (const auto& rpMember : rMembers)
-        {
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, rpMember->GetName());
+    if (rMembers.empty())
+        return;
 
-            if (rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
-            {
-                // Export display names only for ODF 1.2 extended or later.
-                const std::optional<OUString> & pLayoutName = rpMember->GetLayoutName();
-                if (pLayoutName)
-                    rExport.AddAttribute(XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, *pLayoutName);
-            }
+    SvXMLElementExport aElemDPMs(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBERS, true, true);
+    rExport.CheckAttrList();
+    for (const auto& rpMember : rMembers)
+    {
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, rpMember->GetName());
 
-            OUStringBuffer sBuffer;
-            ::sax::Converter::convertBool(sBuffer, rpMember->GetIsVisible());
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY, sBuffer.makeStringAndClear());
-            ::sax::Converter::convertBool(sBuffer, rpMember->GetShowDetails());
-            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SHOW_DETAILS, sBuffer.makeStringAndClear());
-            SvXMLElementExport aElemDPM(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBER, true, true);
-            rExport.CheckAttrList();
+        if (rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
+        {
+            // Export display names only for ODF 1.2 extended or later.
+            const std::optional<OUString> & pLayoutName = rpMember->GetLayoutName();
+            if (pLayoutName)
+                rExport.AddAttribute(XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, *pLayoutName);
         }
+
+        OUStringBuffer sBuffer;
+        ::sax::Converter::convertBool(sBuffer, rpMember->GetIsVisible());
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY, sBuffer.makeStringAndClear());
+        ::sax::Converter::convertBool(sBuffer, rpMember->GetShowDetails());
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SHOW_DETAILS, sBuffer.makeStringAndClear());
+        SvXMLElementExport aElemDPM(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBER, true, true);
+        rExport.CheckAttrList();
     }
 }
 
@@ -642,30 +642,30 @@ void ScXMLExportDataPilot::WriteGroupDimElements(const ScDPSaveDimension* pDim,
 
         OSL_ENSURE((!pGroupDim || !pNumGroupDim), "there should be no NumGroup and Group at the same field");
     }
-    if (pGroupDim || pNumGroupDim)
+    if (!(pGroupDim || pNumGroupDim))
+        return;
+
+    SvXMLElementExport aElemDPGs(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUPS, true, true);
+    if (!pGroupDim)
+        return;
+
+    if (pGroupDim->GetDatePart())
+        return;
+
+    sal_Int32 nCount = pGroupDim->GetGroupCount();
+    for (sal_Int32 i = 0; i < nCount; ++i)
     {
-        SvXMLElementExport aElemDPGs(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUPS, true, true);
-        if (pGroupDim)
-        {
-            if (!pGroupDim->GetDatePart())
+        const ScDPSaveGroupItem& rGroup = pGroupDim->GetGroupByIndex( i );
+        rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, rGroup.GetGroupName());
+        SvXMLElementExport aElemDPG(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP, true, true);
+        sal_Int32 nElemCount = rGroup.GetElementCount();
+        for(sal_Int32 j = 0; j < nElemCount; ++j)
+        {
+            const OUString* pElem = rGroup.GetElementByIndex(j);
+            if (pElem)
             {
-                sal_Int32 nCount = pGroupDim->GetGroupCount();
-                for (sal_Int32 i = 0; i < nCount; ++i)
-                {
-                    const ScDPSaveGroupItem& rGroup = pGroupDim->GetGroupByIndex( i );
-                    rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, rGroup.GetGroupName());
-                    SvXMLElementExport aElemDPG(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP, true, true);
-                    sal_Int32 nElemCount = rGroup.GetElementCount();
-                    for(sal_Int32 j = 0; j < nElemCount; ++j)
-                    {
-                        const OUString* pElem = rGroup.GetElementByIndex(j);
-                        if (pElem)
-                        {
-                            rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, *pElem);
-                            SvXMLElementExport aElemDPM(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP_MEMBER, true, true);
-                        }
-                    }
-                }
+                rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, *pElem);
+                SvXMLElementExport aElemDPM(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP_MEMBER, true, true);
             }
         }
     }
diff --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx
index ae68f6cbec84..dd924507e77e 100644
--- a/sc/source/filter/xml/XMLExportIterator.cxx
+++ b/sc/source/filter/xml/XMLExportIterator.cxx
@@ -210,24 +210,24 @@ void ScMyMergedRangesContainer::SetCellData( ScMyCell& rMyCell )
 {
     rMyCell.bIsMergedBase = rMyCell.bIsCovered = false;
     ScMyMergedRangeList::iterator aItr(aRangeList.begin());
-    if( aItr != aRangeList.end() )
+    if( aItr == aRangeList.end() )
+        return;
+
+    if( aItr->aCellRange.aStart != rMyCell.aCellAddress )
+        return;
+
+    rMyCell.aMergeRange = aItr->aCellRange;
+    if (aItr->bIsFirst)
+        rMyCell.aMergeRange.aEnd.SetRow( rMyCell.aMergeRange.aStart.Row() + aItr->nRows - 1 );
+    rMyCell.bIsMergedBase = aItr->bIsFirst;
+    rMyCell.bIsCovered = !aItr->bIsFirst;
+    if( aItr->aCellRange.aStart.Col() < aItr->aCellRange.aEnd.Col() )
     {
-        if( aItr->aCellRange.aStart == rMyCell.aCellAddress )
-        {
-            rMyCell.aMergeRange = aItr->aCellRange;
-            if (aItr->bIsFirst)
-                rMyCell.aMergeRange.aEnd.SetRow( rMyCell.aMergeRange.aStart.Row() + aItr->nRows - 1 );
-            rMyCell.bIsMergedBase = aItr->bIsFirst;
-            rMyCell.bIsCovered = !aItr->bIsFirst;
-            if( aItr->aCellRange.aStart.Col() < aItr->aCellRange.aEnd.Col() )
-            {
-                aItr->aCellRange.aStart.IncCol( 1 );
-                aItr->bIsFirst = false;
-            }
-            else
-                aRangeList.erase(aItr);
-        }
+        aItr->aCellRange.aStart.IncCol( 1 );
+        aItr->bIsFirst = false;
     }
+    else
+        aRangeList.erase(aItr);
 }
 
 void ScMyMergedRangesContainer::SkipTable(SCTAB nSkip)
@@ -280,25 +280,25 @@ void ScMyAreaLinksContainer::SetCellData( ScMyCell& rMyCell )
 {
     rMyCell.bHasAreaLink = false;
     ScMyAreaLinkList::iterator aItr(aAreaLinkList.begin());
-    if( aItr != aAreaLinkList.end() )
+    if( aItr == aAreaLinkList.end() )
+        return;
+
+    if( aItr->aDestRange.aStart != rMyCell.aCellAddress )
+        return;
+
+    rMyCell.bHasAreaLink = true;
+    rMyCell.aAreaLink = *aItr;
+    aItr = aAreaLinkList.erase( aItr );
+    bool bFound = true;
+    while (aItr != aAreaLinkList.end() && bFound)
     {
-        if( aItr->aDestRange.aStart == rMyCell.aCellAddress )
+        if ( aItr->aDestRange.aStart == rMyCell.aCellAddress )
         {
-            rMyCell.bHasAreaLink = true;
-            rMyCell.aAreaLink = *aItr;
+            OSL_FAIL("more than one linked range on one cell");
             aItr = aAreaLinkList.erase( aItr );
-            bool bFound = true;
-            while (aItr != aAreaLinkList.end() && bFound)
-            {
-                if ( aItr->aDestRange.aStart == rMyCell.aCellAddress )
-                {
-                    OSL_FAIL("more than one linked range on one cell");
-                    aItr = aAreaLinkList.erase( aItr );
-                }
-                else
-                    bFound = false;
-            }
         }
+        else
+            bFound = false;
     }
 }
 
@@ -395,32 +395,32 @@ void ScMyDetectiveObjContainer::AddObject( ScDetectiveObjType eObjType, const SC
                                             const ScAddress& rPosition, const ScRange& rSourceRange,
                                             bool bHasError )
 {
-    if( (eObjType == SC_DETOBJ_ARROW) ||
+    if( !((eObjType == SC_DETOBJ_ARROW) ||
         (eObjType == SC_DETOBJ_FROMOTHERTAB) ||
         (eObjType == SC_DETOBJ_TOOTHERTAB) ||
-        (eObjType == SC_DETOBJ_CIRCLE) )
+        (eObjType == SC_DETOBJ_CIRCLE)) )
+        return;
+
+    ScMyDetectiveObj aDetObj;
+    aDetObj.eObjType = eObjType;
+    if( eObjType == SC_DETOBJ_TOOTHERTAB )
+        aDetObj.aPosition = rSourceRange.aStart;
+    else
+        aDetObj.aPosition = rPosition;
+    aDetObj.aSourceRange = rSourceRange;
+
+    // #111064#; take the sheet where the object is found and not the sheet given in the ranges, because they are not always true
+    if (eObjType != SC_DETOBJ_FROMOTHERTAB)
     {
-        ScMyDetectiveObj aDetObj;
-        aDetObj.eObjType = eObjType;
-        if( eObjType == SC_DETOBJ_TOOTHERTAB )
-            aDetObj.aPosition = rSourceRange.aStart;
-        else
-            aDetObj.aPosition = rPosition;
-        aDetObj.aSourceRange = rSourceRange;
-
-        // #111064#; take the sheet where the object is found and not the sheet given in the ranges, because they are not always true
-        if (eObjType != SC_DETOBJ_FROMOTHERTAB)
-        {
-            // if the ObjType == SC_DETOBJ_FROMOTHERTAB then the SourceRange is not used and so it has not to be tested and changed
-            OSL_ENSURE(aDetObj.aPosition.Tab() == aDetObj.aSourceRange.aStart.Tab(), "It seems to be possible to have different sheets");
-            aDetObj.aSourceRange.aStart.SetTab( nSheet );
-            aDetObj.aSourceRange.aEnd.SetTab( nSheet );
-        }
-        aDetObj.aPosition.SetTab( nSheet );
-
-        aDetObj.bHasError = bHasError;
-        aDetectiveObjList.push_back( aDetObj );
+        // if the ObjType == SC_DETOBJ_FROMOTHERTAB then the SourceRange is not used and so it has not to be tested and changed
+        OSL_ENSURE(aDetObj.aPosition.Tab() == aDetObj.aSourceRange.aStart.Tab(), "It seems to be possible to have different sheets");
+        aDetObj.aSourceRange.aStart.SetTab( nSheet );
+        aDetObj.aSourceRange.aEnd.SetTab( nSheet );
     }
+    aDetObj.aPosition.SetTab( nSheet );
+
+    aDetObj.bHasError = bHasError;
+    aDetectiveObjList.push_back( aDetObj );
 }
 
 bool ScMyDetectiveObjContainer::GetFirstAddress( ScAddress& rCellAddress )
@@ -643,19 +643,19 @@ void ScMyNotEmptyCellsIterator::SetCurrentTable(const SCTAB nTable,
     aLastAddress.SetRow( 0 );
     aLastAddress.SetCol( 0 );
     aLastAddress.SetTab( nTable );
-    if (nCurrentTable != nTable)
-    {
-        nCurrentTable = nTable;
+    if (nCurrentTable == nTable)
+        return;
 
-        mpCellItr.reset(
-            new ScHorizontalCellIterator(
-                rExport.GetDocument(), nCurrentTable, 0, 0,
-                static_cast<SCCOL>(rExport.GetSharedData()->GetLastColumn(nCurrentTable)),
-                static_cast<SCROW>(rExport.GetSharedData()->GetLastRow(nCurrentTable))));
+    nCurrentTable = nTable;
 
-        xTable.set(rxTable);
-        xCellRange.set(xTable);
-    }
+    mpCellItr.reset(
+        new ScHorizontalCellIterator(
+            rExport.GetDocument(), nCurrentTable, 0, 0,
+            static_cast<SCCOL>(rExport.GetSharedData()->GetLastColumn(nCurrentTable)),
+            static_cast<SCROW>(rExport.GetSharedData()->GetLastRow(nCurrentTable))));
+
+    xTable.set(rxTable);
+    xCellRange.set(xTable);
 }
 
 void ScMyNotEmptyCellsIterator::SkipTable(SCTAB nSkip)
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 4f1b820bf071..b21f2dea976e 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -99,65 +99,65 @@ void ScMyValidationsContainer::AddValidation(const uno::Any& aTempAny,
     sal_Int32& nValidationIndex)
 {
     uno::Reference<beans::XPropertySet> xPropertySet(aTempAny, uno::UNO_QUERY);
-    if (xPropertySet.is())
+    if (!xPropertySet.is())
+        return;
+
+    OUString sErrorMessage;
+    xPropertySet->getPropertyValue(gsERRMESS) >>= sErrorMessage;
+    OUString sErrorTitle;
+    xPropertySet->getPropertyValue(gsERRTITLE) >>= sErrorTitle;
+    OUString sImputMessage;
+    xPropertySet->getPropertyValue(gsINPMESS) >>= sImputMessage;
+    OUString sImputTitle;
+    xPropertySet->getPropertyValue(gsINPTITLE) >>= sImputTitle;
+    bool bShowErrorMessage = ::cppu::any2bool(xPropertySet->getPropertyValue(gsSHOWERR));
+    bool bShowImputMessage = ::cppu::any2bool(xPropertySet->getPropertyValue(gsSHOWINP));
+    sheet::ValidationType aValidationType;
+    xPropertySet->getPropertyValue(gsTYPE) >>= aValidationType;
+    if (!(bShowErrorMessage || bShowImputMessage || aValidationType != sheet::ValidationType_ANY ||
+        !sErrorMessage.isEmpty() || !sErrorTitle.isEmpty() || !sImputMessage.isEmpty() || !sImputTitle.isEmpty()))
+        return;
+
+    ScMyValidation aValidation;
+    aValidation.sErrorMessage = sErrorMessage;
+    aValidation.sErrorTitle = sErrorTitle;
+    aValidation.sImputMessage = sImputMessage;
+    aValidation.sImputTitle = sImputTitle;
+    aValidation.bShowErrorMessage = bShowErrorMessage;
+    aValidation.bShowImputMessage = bShowImputMessage;

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list