diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-28 04:12:59 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-28 10:12:39 +0100 |
commit | f5dd208719b6667394b2ab95d4a17296fb898224 (patch) | |
tree | 51fc7e3b45db3d01368b7f94f8092e67850cf230 /sc/source/ui/view/prevwsh.cxx | |
parent | 1132e59172f7beca5a39653cf9ee448f9f4577b1 (diff) |
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I2b2ea62ff4ed3e16cd4fa2a5e588d001d21121cb
Reviewed-on: https://gerrit.libreoffice.org/62465
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc/source/ui/view/prevwsh.cxx')
-rw-r--r-- | sc/source/ui/view/prevwsh.cxx | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 42d6700d0ab5..01ca947a8251 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -908,16 +908,13 @@ void ScPreviewShell::WriteUserDataSequence(uno::Sequence < beans::PropertyValue { rSeq.realloc(3); beans::PropertyValue* pSeq = rSeq.getArray(); - if(pSeq) - { - sal_uInt16 nViewID(GetViewFrame()->GetCurViewId()); - pSeq[0].Name = SC_VIEWID; - pSeq[0].Value <<= SC_VIEW + OUString::number(nViewID); - pSeq[1].Name = SC_ZOOMVALUE; - pSeq[1].Value <<= sal_Int32 (pPreview->GetZoom()); - pSeq[2].Name = "PageNumber"; - pSeq[2].Value <<= pPreview->GetPageNo(); - } + sal_uInt16 nViewID(GetViewFrame()->GetCurViewId()); + pSeq[0].Name = SC_VIEWID; + pSeq[0].Value <<= SC_VIEW + OUString::number(nViewID); + pSeq[1].Name = SC_ZOOMVALUE; + pSeq[1].Value <<= sal_Int32 (pPreview->GetZoom()); + pSeq[2].Name = "PageNumber"; + pSeq[2].Value <<= pPreview->GetPageNo(); // Common SdrModel processing if (ScDrawLayer* pDrawLayer = GetDocument().GetDrawLayer()) @@ -926,31 +923,23 @@ void ScPreviewShell::WriteUserDataSequence(uno::Sequence < beans::PropertyValue void ScPreviewShell::ReadUserDataSequence(const uno::Sequence < beans::PropertyValue >& rSeq) { - sal_Int32 nCount(rSeq.getLength()); - if (nCount) + for (const auto& propval : rSeq) { - const beans::PropertyValue* pSeq = rSeq.getConstArray(); - if(pSeq) + if (propval.Name == SC_ZOOMVALUE) { - for(sal_Int32 i = 0; i < nCount; i++, pSeq++) - { - OUString sName(pSeq->Name); - if(sName == SC_ZOOMVALUE) - { - sal_Int32 nTemp = 0; - if (pSeq->Value >>= nTemp) - pPreview->SetZoom(sal_uInt16(nTemp)); - } - else if (sName == "PageNumber") - { - sal_Int32 nTemp = 0; - if (pSeq->Value >>= nTemp) - pPreview->SetPageNo(nTemp); - } - // Fallback to common SdrModel processing - else pDocShell->MakeDrawLayer()->ReadUserDataSequenceValue(pSeq); - } + sal_Int32 nTemp = 0; + if (propval.Value >>= nTemp) + pPreview->SetZoom(sal_uInt16(nTemp)); } + else if (propval.Name == "PageNumber") + { + sal_Int32 nTemp = 0; + if (propval.Value >>= nTemp) + pPreview->SetPageNo(nTemp); + } + // Fallback to common SdrModel processing + else + pDocShell->MakeDrawLayer()->ReadUserDataSequenceValue(&propval); } } |