diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-11-15 11:37:59 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-11-15 12:39:54 -0500 |
commit | be8d1d48ed3adbd07e911e2b9b232be95850126a (patch) | |
tree | b2a90cdc3c67d4c7741ca7e79d00ee463e45defb /sc | |
parent | 90f9521ba46786e64a36c17ceb2f4424cf53d16f (diff) |
Reduce scoping level by early bailout.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/dbgui/filtdlg.cxx | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 094cd3a05294..cdbfa8069089 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -594,49 +594,50 @@ void ScFilterDlg::UpdateHdrInValueList( sal_uInt16 nList ) { //! GetText / SetText ?? - if (pDoc && nList > 0 && nList <= QUERY_ENTRY_COUNT) + if (!pDoc) + return; + + if (nList == 0 || nList > QUERY_ENTRY_COUNT) + return; + + sal_uInt16 nFieldSelPos = maFieldLbArr[nList-1]->GetSelectEntryPos(); + if (!nFieldSelPos) + return; + + SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1; + if (!maEntryLists.count(nColumn)) { - sal_uInt16 nFieldSelPos = maFieldLbArr[nList-1]->GetSelectEntryPos(); - if ( nFieldSelPos ) - { - SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1; - if (maEntryLists.count(nColumn)) - { - size_t nPos = maEntryLists[nColumn].mnHeaderPos; - if (nPos != INVALID_HEADER_POS) - { - ComboBox* pValList = maValueEdArr[nList-1]; - size_t nListPos = nPos + 2; // for "empty" and "non-empty" + OSL_FAIL("Spalte noch nicht initialisiert"); + return; + } - TypedStrData* pHdrEntry = maEntryLists[nColumn].maList[nPos]; - if ( pHdrEntry ) - { - String aHdrStr = pHdrEntry->GetString(); - sal_Bool bWasThere = ( pValList->GetEntry(nListPos) == aHdrStr ); - sal_Bool bInclude = !aBtnHeader.IsChecked(); - - if (bInclude) // Include entry - { - if (!bWasThere) - pValList->InsertEntry(aHdrStr, nListPos); - } - else // Omit entry - { - if (bWasThere) - pValList->RemoveEntry(nListPos); - } - } - else - { - OSL_FAIL("Eintag in Liste nicht gefunden"); - } - } - } - else - { - OSL_FAIL("Spalte noch nicht initialisiert"); - } - } + size_t nPos = maEntryLists[nColumn].mnHeaderPos; + if (nPos == INVALID_HEADER_POS) + return; + + ComboBox* pValList = maValueEdArr[nList-1]; + size_t nListPos = nPos + 2; // for "empty" and "non-empty" + + TypedStrData* pHdrEntry = maEntryLists[nColumn].maList[nPos]; + if (!pHdrEntry) + { + OSL_FAIL("Eintag in Liste nicht gefunden"); + return; + } + + String aHdrStr = pHdrEntry->GetString(); + sal_Bool bWasThere = ( pValList->GetEntry(nListPos) == aHdrStr ); + sal_Bool bInclude = !aBtnHeader.IsChecked(); + + if (bInclude) // Include entry + { + if (!bWasThere) + pValList->InsertEntry(aHdrStr, nListPos); + } + else // Omit entry + { + if (bWasThere) + pValList->RemoveEntry(nListPos); } } |