diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-03 14:23:19 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-04 00:25:52 -0500 |
commit | bd3919c03dc1e5de2eb986321477bfe4a9b93cf4 (patch) | |
tree | 700951bc0fa27686793be52bfb210b1d965d410f | |
parent | 1e27efd970e2d2ec1bb5b5b99717c58b7653616e (diff) |
No more ScStrCollection in pivot table code.
-rw-r--r-- | sc/inc/dpdimsave.hxx | 3 | ||||
-rw-r--r-- | sc/inc/dpobject.hxx | 3 | ||||
-rw-r--r-- | sc/inc/dpoutput.hxx | 4 | ||||
-rw-r--r-- | sc/inc/dptypes.hxx | 39 | ||||
-rw-r--r-- | sc/source/core/data/dpdimsave.cxx | 10 | ||||
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/dpoutput.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/inc/dbfunc.hxx | 11 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/dbfunc3.cxx | 101 |
10 files changed, 109 insertions, 80 deletions
diff --git a/sc/inc/dpdimsave.hxx b/sc/inc/dpdimsave.hxx index 3c377c04b1e8..38c8cb078e39 100644 --- a/sc/inc/dpdimsave.hxx +++ b/sc/inc/dpdimsave.hxx @@ -34,6 +34,7 @@ #include <tools/string.hxx> #include "dpgroup.hxx" // for ScDPNumGroupInfo #include "scdllapi.h" +#include "dptypes.hxx" class ScDPGroupTableData; class ScDPGroupDimension; @@ -107,7 +108,7 @@ public: void RemoveFromGroups( const String& rItemName ); void RemoveGroup( const String& rGroupName ); bool IsEmpty() const; - bool HasOnlyHidden( const ScStrCollection& rVisible ); + bool HasOnlyHidden(const ScDPUniqueStringSet& rVisible); long GetGroupCount() const; const ScDPSaveGroupItem* GetGroupByIndex( long nIndex ) const; diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index f7126b12e421..251e51583f11 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -34,6 +34,7 @@ #include "address.hxx" #include "collect.hxx" #include "dpoutput.hxx" +#include "dptypes.hxx" #include "pivot.hxx" #include <com/sun/star/sheet/XDimensionsSupplier.hpp> @@ -191,7 +192,7 @@ public: std::vector< ScDPGetPivotDataField >& rFilters, const ::rtl::OUString& rFilterList ); - void GetMemberResultNames( ScStrCollection& rNames, long nDimension ); + void GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension); void FillPageList( TypedScStrCollection& rStrings, long nField ); diff --git a/sc/inc/dpoutput.hxx b/sc/inc/dpoutput.hxx index d1d07e2c42cb..56bc61e281fd 100644 --- a/sc/inc/dpoutput.hxx +++ b/sc/inc/dpoutput.hxx @@ -39,6 +39,8 @@ #include "address.hxx" #include "dpcachetable.hxx" +#include "dptypes.hxx" + #include <vector> namespace com { namespace sun { namespace star { namespace sheet { @@ -160,7 +162,7 @@ public: Rectangle& rPosRect, sal_uInt16& rOrient, long& rDimPos ); sal_Bool IsFilterButton( const ScAddress& rPos ); - void GetMemberResultNames( ScStrCollection& rNames, long nDimension ); + void GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension); void SetHeaderLayout(bool bUseGrid); bool GetHeaderLayout() const; diff --git a/sc/inc/dptypes.hxx b/sc/inc/dptypes.hxx new file mode 100644 index 000000000000..da49c9ac0fb2 --- /dev/null +++ b/sc/inc/dptypes.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Kohei Yoshida <kohei.yoshida@suse.com> + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef __SC_DPTYPES_HXX__ +#define __SC_DPTYPES_HXX__ + +#include "rtl/ustring.hxx" + +#include <boost/unordered_set.hpp> + +typedef boost::unordered_set<rtl::OUString, rtl::OUStringHash> ScDPUniqueStringSet; + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx index 45bff8f95e55..b6e0cf10f46d 100644 --- a/sc/source/core/data/dpdimsave.cxx +++ b/sc/source/core/data/dpdimsave.cxx @@ -247,17 +247,15 @@ bool ScDPSaveGroupDimension::IsEmpty() const return aGroups.empty(); } -bool ScDPSaveGroupDimension::HasOnlyHidden( const ScStrCollection& rVisible ) +bool ScDPSaveGroupDimension::HasOnlyHidden(const ScDPUniqueStringSet& rVisible) { // check if there are only groups that don't appear in the list of visible names bool bAllHidden = true; - for ( ScDPSaveGroupItemVec::const_iterator aIter(aGroups.begin()); aIter != aGroups.end() && bAllHidden; aIter++ ) + for (ScDPSaveGroupItemVec::const_iterator aIter = aGroups.begin(); aIter != aGroups.end() && bAllHidden; ++aIter) { - StrData aSearch( aIter->GetGroupName() ); - sal_uInt16 nCollIndex; - if ( rVisible.Search( &aSearch, nCollIndex ) ) - bAllHidden = false; // found one that is visible + if (rVisible.count(aIter->GetGroupName()) > 0) + bAllHidden = false; } return bAllHidden; } diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index d5ac78805b4b..f8279730b080 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -1121,11 +1121,11 @@ bool ScDPObject::GetHeaderDrag( const ScAddress& rPos, bool bMouseLeft, bool bMo return pOutput->GetHeaderDrag( rPos, bMouseLeft, bMouseTop, nDragDim, rPosRect, rOrient, rDimPos ); } -void ScDPObject::GetMemberResultNames( ScStrCollection& rNames, long nDimension ) +void ScDPObject::GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension) { CreateOutput(); // create xSource and pOutput if not already done - pOutput->GetMemberResultNames( rNames, nDimension ); // used only with table data -> level not needed + pOutput->GetMemberResultNames(rNames, nDimension); // used only with table data -> level not needed } bool lcl_Dequote( const String& rSource, xub_StrLen nStartPos, xub_StrLen& rEndPos, String& rResult ) diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 32179e3807aa..103fab1ee95a 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -1170,7 +1170,7 @@ long ScDPOutput::GetHeaderRows() return nPageFieldCount + ( bDoFilter ? 1 : 0 ); } -void ScDPOutput::GetMemberResultNames( ScStrCollection& rNames, long nDimension ) +void ScDPOutput::GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension) { // Return the list of all member names in a dimension's MemberResults. // Only the dimension has to be compared because this is only used with table data, @@ -1208,11 +1208,7 @@ void ScDPOutput::GetMemberResultNames( ScStrCollection& rNames, long nDimension for (long nItem=0; nItem<nResultCount; nItem++) { if ( pArray[nItem].Flags & sheet::MemberResultFlags::HASMEMBER ) - { - StrData* pNew = new StrData( pArray[nItem].Name ); - if ( !rNames.Insert( pNew ) ) - delete pNew; - } + rNames.insert(pArray[nItem].Name); } } } diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx index 67344c197d0e..7c02000e508c 100644 --- a/sc/source/ui/inc/dbfunc.hxx +++ b/sc/source/ui/inc/dbfunc.hxx @@ -30,6 +30,7 @@ #define SC_DBFUNC_HXX #include "viewfunc.hxx" +#include "dptypes.hxx" namespace com { namespace sun { namespace star { namespace sheet { struct DataPilotFieldFilter; @@ -50,7 +51,7 @@ struct ScSubTotalParam; class ScDBFunc : public ScViewFunc { private: - void GetSelectedMemberList( ScStrCollection& rEntries, long& rDimension ); + void GetSelectedMemberList(ScDPUniqueStringSet& rEntries, long& rDimension); public: ScDBFunc( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ); @@ -89,8 +90,8 @@ public: const ScDPObject& rSource, sal_Bool bApi = false ); void DeletePivotTable(); void RecalcPivotTable(); - sal_Bool HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32& rParts ); - sal_Bool HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo ); + bool HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32& rParts ); + bool HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo ); void GroupDataPilot(); void DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nParts ); void NumGroupDataPilot( const ScDPNumGroupInfo& rInfo ); @@ -100,8 +101,8 @@ public: bool DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16* pUserListId = NULL ); sal_Bool DataPilotMove( const ScRange& rSource, const ScAddress& rDest ); - sal_Bool HasSelectionForDrillDown( sal_uInt16& rOrientation ); - void SetDataPilotDetails( sal_Bool bShow, const String* pNewDimensionName = NULL ); + bool HasSelectionForDrillDown( sal_uInt16& rOrientation ); + void SetDataPilotDetails(bool bShow, const rtl::OUString* pNewDimensionName = NULL); void ShowDataPilotSourceData( ScDPObject& rDPObj, const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::DataPilotFieldFilter >& rFilters ); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index f482caab08a4..e9a574ff950b 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -963,8 +963,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) OSL_ENSURE(pDlg, "Dialog create fail!"); if ( pDlg->Execute() == RET_OK ) { - String aNewDimName( pDlg->GetDimensionName() ); - pTabViewShell->SetDataPilotDetails( sal_True, &aNewDimName ); + rtl::OUString aNewDimName( pDlg->GetDimensionName() ); + pTabViewShell->SetDataPilotDetails( true, &aNewDimName ); } } else if ( !pDPObj->IsServiceData() && @@ -973,7 +973,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) aFilters ) ) pTabViewShell->ShowDataPilotSourceData( *pDPObj, aFilters ); else - pTabViewShell->SetDataPilotDetails( sal_True ); + pTabViewShell->SetDataPilotDetails(true); } else pTabViewShell->ShowMarkedOutlines(); diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 086b4ffba312..a572aa763321 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -729,7 +729,7 @@ void ScDBFunc::RecalcPivotTable() ErrorMessage(STR_PIVOT_NOTFOUND); } -void ScDBFunc::GetSelectedMemberList( ScStrCollection& rEntries, long& rDimension ) +void ScDBFunc::GetSelectedMemberList(ScDPUniqueStringSet& rEntries, long& rDimension) { ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); @@ -781,25 +781,21 @@ void ScDBFunc::GetSelectedMemberList( ScStrCollection& rEntries, long& rDimensio // accept any part of a member description, also subtotals, // but don't stop if empty parts are contained if ( aData.Flags & sheet::MemberResultFlags::HASMEMBER ) - { - StrData* pNew = new StrData( aData.MemberName ); - if ( !rEntries.Insert( pNew ) ) - delete pNew; - } + rEntries.insert(aData.MemberName); } } } rDimension = nStartDimension; // dimension from which the found members came if (!bContinue) - rEntries.FreeAll(); // remove all if not valid + rEntries.clear(); // remove all if not valid } -sal_Bool ScDBFunc::HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32& rParts ) +bool ScDBFunc::HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32& rParts ) { // determine if the date group dialog has to be shown for the current selection - sal_Bool bFound = false; + bool bFound = false; SCCOL nCurX = GetViewData()->GetCurX(); SCROW nCurY = GetViewData()->GetCurY(); @@ -809,11 +805,11 @@ sal_Bool ScDBFunc::HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int ScDPObject* pDPObj = pDoc->GetDPAtCursor( nCurX, nCurY, nTab ); if ( pDPObj ) { - ScStrCollection aEntries; + ScDPUniqueStringSet aEntries; long nSelectDimension = -1; GetSelectedMemberList( aEntries, nSelectDimension ); - if ( aEntries.GetCount() > 0 ) + if (!aEntries.empty()) { bool bIsDataLayout; OUString aDimName = pDPObj->GetDimName( nSelectDimension, bIsDataLayout ); @@ -908,11 +904,11 @@ sal_Bool ScDBFunc::HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int return bFound; } -sal_Bool ScDBFunc::HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo ) +bool ScDBFunc::HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo ) { // determine if the numeric group dialog has to be shown for the current selection - sal_Bool bFound = false; + bool bFound = false; SCCOL nCurX = GetViewData()->GetCurX(); SCROW nCurY = GetViewData()->GetCurY(); @@ -922,11 +918,11 @@ sal_Bool ScDBFunc::HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo ) ScDPObject* pDPObj = pDoc->GetDPAtCursor( nCurX, nCurY, nTab ); if ( pDPObj ) { - ScStrCollection aEntries; + ScDPUniqueStringSet aEntries; long nSelectDimension = -1; GetSelectedMemberList( aEntries, nSelectDimension ); - if ( aEntries.GetCount() > 0 ) + if (!aEntries.empty()) { bool bIsDataLayout; OUString aDimName = pDPObj->GetDimName( nSelectDimension, bIsDataLayout ); @@ -982,11 +978,11 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); if ( pDPObj ) { - ScStrCollection aEntries; + ScDPUniqueStringSet aEntries; long nSelectDimension = -1; GetSelectedMemberList( aEntries, nSelectDimension ); - if ( aEntries.GetCount() > 0 ) + if (!aEntries.empty()) { bool bIsDataLayout; OUString aDimName = pDPObj->GetDimName( nSelectDimension, bIsDataLayout ); @@ -1112,11 +1108,11 @@ void ScDBFunc::NumGroupDataPilot( const ScDPNumGroupInfo& rInfo ) GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); if ( pDPObj ) { - ScStrCollection aEntries; + ScDPUniqueStringSet aEntries; long nSelectDimension = -1; GetSelectedMemberList( aEntries, nSelectDimension ); - if ( aEntries.GetCount() > 0 ) + if (!aEntries.empty()) { bool bIsDataLayout; OUString aDimName = pDPObj->GetDimName( nSelectDimension, bIsDataLayout ); @@ -1156,11 +1152,11 @@ void ScDBFunc::GroupDataPilot() GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); if ( pDPObj ) { - ScStrCollection aEntries; + ScDPUniqueStringSet aEntries; long nSelectDimension = -1; GetSelectedMemberList( aEntries, nSelectDimension ); - if ( aEntries.GetCount() > 0 ) + if (!aEntries.empty()) { bool bIsDataLayout; OUString aDimName = pDPObj->GetDimName( nSelectDimension, bIsDataLayout ); @@ -1183,13 +1179,12 @@ void ScDBFunc::GroupDataPilot() // remove the selected items from their groups // (empty groups are removed, too) - sal_uInt16 nEntryCount = aEntries.GetCount(); - sal_uInt16 nEntry; if ( pGroupDimension ) { - for (nEntry=0; nEntry<nEntryCount; nEntry++) + ScDPUniqueStringSet::const_iterator it = aEntries.begin(), itEnd = aEntries.end(); + for (; it != itEnd; ++it) { - String aEntryName = aEntries[nEntry]->GetString(); + const rtl::OUString& aEntryName = *it; if ( pBaseGroupDim ) { // for each selected (intermediate) group, remove all its items @@ -1228,9 +1223,7 @@ void ScDBFunc::GroupDataPilot() { const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup ); - StrData aStrData( pBaseGroup->GetGroupName() ); - sal_uInt16 nCollIndex; - if ( !aEntries.Search( &aStrData, nCollIndex ) ) //! ignore case? + if (!aEntries.count(pBaseGroup->GetGroupName())) { // add an additional group for each item that is not in the selection ScDPSaveGroupItem aGroup( pBaseGroup->GetGroupName() ); @@ -1245,9 +1238,10 @@ void ScDBFunc::GroupDataPilot() //! localized prefix string String aGroupName = pGroupDimension->CreateGroupName( String::CreateFromAscii("Group") ); ScDPSaveGroupItem aGroup( aGroupName ); - for (nEntry=0; nEntry<nEntryCount; nEntry++) + ScDPUniqueStringSet::const_iterator it = aEntries.begin(), itEnd = aEntries.end(); + for (; it != itEnd; ++it) { - String aEntryName = aEntries[nEntry]->GetString(); + const rtl::OUString& aEntryName = *it; if ( pBaseGroupDim ) { // for each selected (intermediate) group, add all its items @@ -1300,11 +1294,11 @@ void ScDBFunc::UngroupDataPilot() GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); if ( pDPObj ) { - ScStrCollection aEntries; + ScDPUniqueStringSet aEntries; long nSelectDimension = -1; GetSelectedMemberList( aEntries, nSelectDimension ); - if ( aEntries.GetCount() > 0 ) + if (!aEntries.empty()) { bool bIsDataLayout; OUString aDimName = pDPObj->GetDimName( nSelectDimension, bIsDataLayout ); @@ -1329,19 +1323,17 @@ void ScDBFunc::UngroupDataPilot() } else if ( pGroupDim ) { - sal_uInt16 nEntryCount = aEntries.GetCount(); - for (sal_uInt16 nEntry=0; nEntry<nEntryCount; nEntry++) - { - String aEntryName = aEntries[nEntry]->GetString(); - pGroupDim->RemoveGroup( aEntryName ); - } + ScDPUniqueStringSet::const_iterator it = aEntries.begin(), itEnd = aEntries.end(); + for (; it != itEnd; ++it) + pGroupDim->RemoveGroup(*it); + // remove group dimension if empty bool bEmptyDim = pGroupDim->IsEmpty(); if ( !bEmptyDim ) { // If all remaining groups in the dimension aren't shown, remove // the dimension too, as if it was completely empty. - ScStrCollection aVisibleEntries; + ScDPUniqueStringSet aVisibleEntries; pDPObj->GetMemberResultNames( aVisibleEntries, nSelectDimension ); bEmptyDim = pGroupDim->HasOnlyHidden( aVisibleEntries ); } @@ -1962,19 +1954,19 @@ sal_Bool ScDBFunc::DataPilotMove( const ScRange& rSource, const ScAddress& rDest return bRet; } -sal_Bool ScDBFunc::HasSelectionForDrillDown( sal_uInt16& rOrientation ) +bool ScDBFunc::HasSelectionForDrillDown( sal_uInt16& rOrientation ) { - sal_Bool bRet = false; + bool bRet = false; ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); if ( pDPObj ) { - ScStrCollection aEntries; + ScDPUniqueStringSet aEntries; long nSelectDimension = -1; GetSelectedMemberList( aEntries, nSelectDimension ); - if ( aEntries.GetCount() > 0 ) + if (!aEntries.empty()) { bool bIsDataLayout; OUString aDimName = pDPObj->GetDimName( nSelectDimension, bIsDataLayout ); @@ -1989,7 +1981,7 @@ sal_Bool ScDBFunc::HasSelectionForDrillDown( sal_uInt16& rOrientation ) if ( pDim == pInner ) { rOrientation = nDimOrient; - bRet = sal_True; + bRet = true; } } } @@ -1999,17 +1991,17 @@ sal_Bool ScDBFunc::HasSelectionForDrillDown( sal_uInt16& rOrientation ) return bRet; } -void ScDBFunc::SetDataPilotDetails( sal_Bool bShow, const String* pNewDimensionName ) +void ScDBFunc::SetDataPilotDetails(bool bShow, const rtl::OUString* pNewDimensionName) { ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); if ( pDPObj ) { - ScStrCollection aEntries; + ScDPUniqueStringSet aEntries; long nSelectDimension = -1; GetSelectedMemberList( aEntries, nSelectDimension ); - if ( aEntries.GetCount() > 0 ) + if (!aEntries.empty()) { bool bIsDataLayout; OUString aDimName = pDPObj->GetDimName( nSelectDimension, bIsDataLayout ); @@ -2055,23 +2047,22 @@ void ScDBFunc::SetDataPilotDetails( sal_Bool bShow, const String* pNewDimensionN // Hide details for all visible members (selected are changed below). //! Use all members from source level instead (including non-visible)? - ScStrCollection aVisibleEntries; + ScDPUniqueStringSet aVisibleEntries; pDPObj->GetMemberResultNames( aVisibleEntries, nSelectDimension ); - sal_uInt16 nVisCount = aVisibleEntries.GetCount(); - for (sal_uInt16 nVisPos=0; nVisPos<nVisCount; nVisPos++) + ScDPUniqueStringSet::const_iterator it = aVisibleEntries.begin(), itEnd = aVisibleEntries.end(); + for (; it != itEnd; ++it) { - String aVisName = aVisibleEntries[nVisPos]->GetString(); + const rtl::OUString& aVisName = *it; ScDPSaveMember* pMember = pDim->GetMemberByName( aVisName ); pMember->SetShowDetails( false ); } } - sal_uInt16 nEntryCount = aEntries.GetCount(); - for (sal_uInt16 nEntry=0; nEntry<nEntryCount; nEntry++) + ScDPUniqueStringSet::const_iterator it = aEntries.begin(), itEnd = aEntries.end(); + for (; it != itEnd; ++it) { - String aEntryName = aEntries[nEntry]->GetString(); - ScDPSaveMember* pMember = pDim->GetMemberByName( aEntryName ); + ScDPSaveMember* pMember = pDim->GetMemberByName(*it); pMember->SetShowDetails( bShow ); } |