diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-11-04 12:18:47 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-11-04 22:40:28 -0400 |
commit | a917af4fe40faf5a7538b0bf852796949192787d (patch) | |
tree | 9652d5c32f7b20f50bce257f989d6768fc16070e /sc/source/ui/dbgui | |
parent | 9dd9e4baccc4009be524f6ab3070e7458138d82d (diff) |
More on avoiding direct access to pStr, also fixed several memory leaks.
Diffstat (limited to 'sc/source/ui/dbgui')
-rw-r--r-- | sc/source/ui/dbgui/filtdlg.cxx | 20 | ||||
-rw-r--r-- | sc/source/ui/dbgui/pfiltdlg.cxx | 12 |
2 files changed, 17 insertions, 15 deletions
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 4f949c4d6c94..2b332ff58021 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -311,18 +311,19 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet ) { nCondPos = (sal_uInt16)rEntry.eOp; nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) ); - if ( rEntry.nVal == SC_EMPTYFIELDS && !rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING ) + bool bEmptyString = rEntry.GetQueryString().isEmpty(); + if (rEntry.nVal == SC_EMPTYFIELDS && !rEntry.bQueryByString && bEmptyString) { aValStr = aStrEmpty; aCondLbArr[i]->Disable(); } - else if ( rEntry.nVal == SC_NONEMPTYFIELDS && !rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING ) + else if (rEntry.nVal == SC_NONEMPTYFIELDS && !rEntry.bQueryByString && bEmptyString) { aValStr = aStrNotEmpty; aCondLbArr[i]->Disable(); } else - aValStr = *rEntry.pStr; + aValStr = rEntry.GetQueryString(); } else if ( i == 0 ) { @@ -1145,19 +1146,19 @@ IMPL_LINK( ScFilterDlg, ValModifyHdl, ComboBox*, pEd ) { if ( aStrEmpty.equals(aStrVal) ) { - rEntry.pStr->Erase(); + rEntry.SetQueryString(rtl::OUString()); rEntry.nVal = SC_EMPTYFIELDS; rEntry.bQueryByString = false; } else if ( aStrNotEmpty.equals(aStrVal) ) { - rEntry.pStr->Erase(); + rEntry.SetQueryString(rtl::OUString()); rEntry.nVal = SC_NONEMPTYFIELDS; rEntry.bQueryByString = false; } else { - *rEntry.pStr = aStrVal; + rEntry.SetQueryString(aStrVal); rEntry.nVal = 0; rEntry.bQueryByString = true; } @@ -1217,19 +1218,20 @@ void ScFilterDlg::RefreshEditRow( size_t nOffset ) if(rEntry.bDoQuery) nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) ); - if ( rEntry.nVal == SC_EMPTYFIELDS && !rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING ) + rtl::OUString aQueryStr = rEntry.GetQueryString(); + if ( rEntry.nVal == SC_EMPTYFIELDS && !rEntry.bQueryByString && aQueryStr.isEmpty()) { aValStr = aStrEmpty; aCondLbArr[i]->Disable(); } - else if ( rEntry.nVal == SC_NONEMPTYFIELDS && !rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING ) + else if ( rEntry.nVal == SC_NONEMPTYFIELDS && !rEntry.bQueryByString && aQueryStr.isEmpty()) { aValStr = aStrNotEmpty; aCondLbArr[i]->Disable(); } else { - aValStr = *rEntry.pStr; + aValStr = aQueryStr; aCondLbArr[i]->Enable(); } aFieldLbArr[i]->Enable(); diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx index 171a2b5f5616..c776021d7044 100644 --- a/sc/source/ui/dbgui/pfiltdlg.cxx +++ b/sc/source/ui/dbgui/pfiltdlg.cxx @@ -215,8 +215,8 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) { const ScQueryEntry& rEntry = theQueryData.GetEntry(i); - String aValStr = *rEntry.pStr; - if (!rEntry.bQueryByString && aValStr == EMPTY_STRING) + rtl::OUString aValStr = rEntry.GetQueryString(); + if (!rEntry.bQueryByString && aValStr.isEmpty()) { if (rEntry.nVal == SC_EMPTYFIELDS) aValStr = aStrEmpty; @@ -230,7 +230,7 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) aCondLbArr [i]->SelectEntryPos( nCondPos ); UpdateValueList( static_cast<sal_uInt16>(i+1) ); aValueEdArr[i]->SetText( aValStr ); - if (aValStr == aStrEmpty || aValStr == aStrNotEmpty) + if (aValStr.equals(aStrEmpty) || aValStr.equals(aStrNotEmpty)) aCondLbArr[i]->Disable(); } else @@ -426,19 +426,19 @@ const ScQueryItem& ScPivotFilterDlg::GetOutputItem() */ if ( aStrVal == aStrEmpty ) { - *rEntry.pStr = EMPTY_STRING; + rEntry.SetQueryString(rtl::OUString()); rEntry.nVal = SC_EMPTYFIELDS; rEntry.bQueryByString = false; } else if ( aStrVal == aStrNotEmpty ) { - *rEntry.pStr = EMPTY_STRING; + rEntry.SetQueryString(rtl::OUString()); rEntry.nVal = SC_NONEMPTYFIELDS; rEntry.bQueryByString = false; } else { - *rEntry.pStr = aStrVal; + rEntry.SetQueryString(aStrVal); rEntry.nVal = 0; rEntry.bQueryByString = sal_True; } |