svx/source/form/fmexpl.cxx | 5 - svx/source/form/fmshimp.cxx | 17 ++--- svx/source/form/navigatortree.cxx | 122 +++++++++++++++++++++----------------- svx/source/inc/fmexpl.hxx | 11 +-- svx/source/inc/fmshimp.hxx | 7 +- 5 files changed, 85 insertions(+), 77 deletions(-)
New commits: commit 59a51999c60127bc3ad6a36679f9ea7234bbfc8e Author: Michael Stahl <mst...@redhat.com> Date: Thu Apr 19 12:58:19 2012 +0200 svx: fix debug warnings from STL conversion diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index f76654a..648c857 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -2304,7 +2304,9 @@ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere) LoopGrids(GA_FORCE_SYNC); // und zum Feld (dazu habe ich vor dem Start des Suchens die XVclComponent-Interfaces eingesammelt) - DBG_ASSERT(pfriWhere->nFieldPos < m_arrSearchedControls.Count(), "FmXFormShell::OnFoundData : ungueltige Daten uebergeben !"); + SAL_WARN_IF(static_cast<size_t>(pfriWhere->nFieldPos) >= + m_arrSearchedControls.size(), + "svx.form", "FmXFormShell::OnFoundData : invalid index!"); SdrObject* pObject = m_arrSearchedControls.at(pfriWhere->nFieldPos); m_pShell->GetFormView()->UnMarkAll(m_pShell->GetFormView()->GetSdrPageView()); diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index c6d716f..bae1e49 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1639,7 +1639,9 @@ namespace svxform return; CollectSelectionData(SDI_ALL); - DBG_ASSERT( m_nFormsSelected + m_nControlsSelected + (m_bRootSelected ? 1 : 0) == m_arrCurrentSelection.size(), + SAL_WARN_IF(static_cast<size_t>(m_nFormsSelected + m_nControlsSelected + + (m_bRootSelected ? 1 : 0)) != m_arrCurrentSelection.size(), + "svx.form", "NavigatorTree::ShowSelectionProperties : selection meta data invalid !"); commit f765f52c39e79b633bbc8f1a16567572b7bf7a1a Author: Noel Grandin <n...@peralex.com> Date: Mon Apr 16 00:16:05 2012 +0200 Convert SV_DECL_PTRARR_DEL to boost::ptr_vector diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index dc33eb0..f76654a 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -4105,8 +4105,6 @@ sal_Bool SearchableControlIterator::ShouldStepInto(const Reference< XInterface>& //============================================================================== //============================================================================== -SV_IMPL_PTRARR(StatusForwarderArray, SfxStatusForwarder*) - SFX_IMPL_MENU_CONTROL(ControlConversionMenuController, SfxBoolItem); //------------------------------------------------------------------------------ @@ -4124,7 +4122,7 @@ ControlConversionMenuController::ControlConversionMenuController( sal_uInt16 _nI { _rBindings.Invalidate(m_pConversionMenu->GetItemId(i)); SfxStatusForwarder* pForwarder = new SfxStatusForwarder(m_pConversionMenu->GetItemId(i), *this); - m_aStatusForwarders.C40_INSERT(SfxStatusForwarder, pForwarder, m_aStatusForwarders.Count()); + m_aStatusForwarders.push_back(pForwarder); } } } diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx index 26eb304..9664b4e 100644 --- a/svx/source/inc/fmshimp.hxx +++ b/svx/source/inc/fmshimp.hxx @@ -74,6 +74,7 @@ #include <queue> #include <set> #include <vector> +#include <boost/ptr_container/ptr_vector.hpp> typedef std::vector<SdrObject*> SdrObjArray; // SV_DECL_OBJARR(FmFormArray, ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>, 32, 16); @@ -584,7 +585,7 @@ public: }; // ======================================================================== -SV_DECL_PTRARR_DEL(StatusForwarderArray, SfxStatusForwarder*, 16) +typedef boost::ptr_vector<SfxStatusForwarder> StatusForwarderArray; class SVX_DLLPUBLIC ControlConversionMenuController : public SfxMenuControl { protected: commit eb13c2c5b127910367ed2dac4fd2166a6d9c8a70 Author: Noel Grandin <n...@peralex.com> Date: Sun Apr 15 22:55:48 2012 +0200 Convert SV_DECL_PTRARR to std::vector diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 29a45c0..dc33eb0 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -2305,8 +2305,7 @@ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere) // und zum Feld (dazu habe ich vor dem Start des Suchens die XVclComponent-Interfaces eingesammelt) DBG_ASSERT(pfriWhere->nFieldPos < m_arrSearchedControls.Count(), "FmXFormShell::OnFoundData : ungueltige Daten uebergeben !"); - SdrObject* pObject = m_arrSearchedControls.GetObject(pfriWhere->nFieldPos); - DBG_ASSERT(pObject != NULL, "FmXFormShell::OnFoundData : unerwartet : ungueltiges VclControl-Interface"); + SdrObject* pObject = m_arrSearchedControls.at(pfriWhere->nFieldPos); m_pShell->GetFormView()->UnMarkAll(m_pShell->GetFormView()->GetSdrPageView()); m_pShell->GetFormView()->MarkObj(pObject, m_pShell->GetFormView()->GetSdrPageView()); @@ -2405,7 +2404,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn // -------------------------------------------------------------------------------------------- // assemble the list of fields to involve (that is, the ControlSources of all fields that have such a property) UniString strFieldList, sFieldDisplayNames; - m_arrSearchedControls.Remove(0, m_arrSearchedControls.Count()); + m_arrSearchedControls.clear(); m_arrRelativeGridColumn.clear(); // small problem: To mark found fields, I need SdrObjects. To determine which controls @@ -2517,7 +2516,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn pfmscContextInfo->arrFields.push_back(xCurrentColumn); // and the SdrOject to the Field - m_arrSearchedControls.C40_INSERT(SdrObject, pCurrent, m_arrSearchedControls.Count()); + m_arrSearchedControls.push_back(pCurrent); // the number of the column m_arrRelativeGridColumn.push_back(nViewPos); } @@ -2546,7 +2545,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn sFieldDisplayNames += ';'; // mark the SdrObject (accelerates the treatment in OnFoundData) - m_arrSearchedControls.C40_INSERT(SdrObject, pCurrent, m_arrSearchedControls.Count()); + m_arrSearchedControls.push_back(pCurrent); // the number of the colum (here a dummy, since it is only interesting for GridControls) m_arrRelativeGridColumn.push_back(-1); diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx index e2313e2..26eb304 100644 --- a/svx/source/inc/fmshimp.hxx +++ b/svx/source/inc/fmshimp.hxx @@ -75,11 +75,11 @@ #include <set> #include <vector> -SV_DECL_PTRARR(SdrObjArray, SdrObject*, 32) +typedef std::vector<SdrObject*> SdrObjArray; // SV_DECL_OBJARR(FmFormArray, ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>, 32, 16); DECLARE_STL_VECTOR( ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > ,FmFormArray); -// catch databse exceptions if occur +// catch database exceptions if they occur #define DO_SAFE(statement) try { statement; } catch( const Exception& ) { OSL_FAIL("unhandled exception (I tried to move a cursor (or something like that).)"); } #define GA_DISABLE_SYNC 1 commit 2de57801ed93ef15d8e4e941ff371d3bf703e273 Author: Noel Grandin <n...@peralex.com> Date: Sun Apr 15 22:34:44 2012 +0200 Convert SV_DECL_PTRARR_SORT to std::set diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx index 3c4dbaf..b55e6a4 100644 --- a/svx/source/form/fmexpl.cxx +++ b/svx/source/form/fmexpl.cxx @@ -84,10 +84,6 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; //======================================================================== - -SV_IMPL_PTRARR_SORT( SvLBoxEntrySortedArray, SvLBoxEntryPtr ) - -//======================================================================== // class FmNavInsertedHint //======================================================================== TYPEINIT1( FmNavInsertedHint, SfxHint ); diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 1bcfbe9..c6d716f 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -245,16 +245,17 @@ namespace svxform // die Informationen fuer das AcceptDrop und ExecuteDrop CollectSelectionData(SDI_ALL); - if (!m_arrCurrentSelection.Count()) + if (m_arrCurrentSelection.empty()) // nothing to do return sal_False; // testen, ob es sich vielleicht ausschliesslich um hidden controls handelt (dann koennte ich pCtrlExch noch ein // zusaetzliches Format geben) sal_Bool bHasNonHidden = sal_False; - for (sal_Int32 i=0; i<m_arrCurrentSelection.Count(); i++) + for ( SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); + it != m_arrCurrentSelection.end(); ++it ) { - FmEntryData* pCurrent = static_cast< FmEntryData* >( m_arrCurrentSelection[(sal_uInt16)i]->GetUserData() ); + FmEntryData* pCurrent = static_cast< FmEntryData* >( (*it)->GetUserData() ); if ( IsHiddenControl( pCurrent ) ) continue; bHasNonHidden = sal_True; @@ -275,7 +276,6 @@ namespace svxform sal_Bool NavigatorTree::implPrepareExchange( sal_Int8 _nAction ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "ocke.jans...@sun.com", "NavigatorTree::implPrepareExchange" ); - sal_Int32 i; EndSelection(); @@ -286,8 +286,9 @@ namespace svxform m_aControlExchange.prepareDrag(); m_aControlExchange->setFocusEntry( GetCurEntry() ); - for ( i = 0; i < m_arrCurrentSelection.Count(); ++i ) - m_aControlExchange->addSelectedEntry(m_arrCurrentSelection[(sal_uInt16)i]); + for ( SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); + it != m_arrCurrentSelection.end(); ++it ) + m_aControlExchange->addSelectedEntry(*it); m_aControlExchange->setFormsRoot( GetNavModel()->GetFormPage()->GetForms() ); m_aControlExchange->buildPathFormat( this, m_pRootEntry ); @@ -295,10 +296,11 @@ namespace svxform if (!bHasNonHidden) { // eine entsprechende Sequenz aufbauen - Sequence< Reference< XInterface > > seqIFaces(m_arrCurrentSelection.Count()); + Sequence< Reference< XInterface > > seqIFaces(m_arrCurrentSelection.size()); Reference< XInterface >* pArray = seqIFaces.getArray(); - for (i=0; i<m_arrCurrentSelection.Count(); ++i, ++pArray) - *pArray = static_cast< FmEntryData* >( m_arrCurrentSelection[(sal_uInt16)i]->GetUserData() )->GetElement(); + for ( SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); + it != m_arrCurrentSelection.end(); ++it, ++pArray ) + *pArray = static_cast< FmEntryData* >( (*it)->GetUserData() )->GetElement(); // und das neue Format m_aControlExchange->addHiddenControlsFormat(seqIFaces); @@ -348,7 +350,7 @@ namespace svxform } else { - if (m_arrCurrentSelection.Count() == 0) // kann nur bei Kontextmenue ueber Tastatur passieren + if (m_arrCurrentSelection.empty()) // kann nur bei Kontextmenue ueber Tastatur passieren break; SvLBoxEntry* pCurrent = GetCurEntry(); @@ -362,15 +364,15 @@ namespace svxform // wenn mindestens ein Nicht-Root-Eintrag selektiert ist und die Root auch, dann nehme ich letztere aus der Selektion // fix wieder raus - if ( (m_arrCurrentSelection.Count() > 1) && m_bRootSelected ) + if ( (m_arrCurrentSelection.size() > 1) && m_bRootSelected ) { Select( m_pRootEntry, sal_False ); - SetCursor( m_arrCurrentSelection.GetObject(0), sal_True); + SetCursor( *m_arrCurrentSelection.begin(), sal_True); } - sal_Bool bSingleSelection = (m_arrCurrentSelection.Count() == 1); + sal_Bool bSingleSelection = (m_arrCurrentSelection.size() == 1); - DBG_ASSERT( (m_arrCurrentSelection.Count() > 0) || m_bRootSelected, "keine Eintraege selektiert" ); + DBG_ASSERT( (m_arrCurrentSelection.size() > 0) || m_bRootSelected, "keine Eintraege selektiert" ); // solte nicht passieren, da ich oben bei der IsSelected-Abfrage auf jeden Fall einen selektiert haette, // wenn das vorher nicht der Fall gewesen waere @@ -432,7 +434,7 @@ namespace svxform { aContextMenu.SetPopupMenu( SID_FM_CHANGECONTROLTYPE, FmXFormShell::GetConversionMenu() ); #if OSL_DEBUG_LEVEL > 0 - FmControlData* pCurrent = (FmControlData*)(m_arrCurrentSelection[0]->GetUserData()); + FmControlData* pCurrent = (FmControlData*)(*m_arrCurrentSelection.begin())->GetUserData(); OSL_ENSURE( pFormShell->GetImpl()->isSolelySelected( pCurrent->GetFormComponent() ), "NavigatorTree::Command: inconsistency between the navigator selection, and the selection as the shell knows it!" ); #endif @@ -462,7 +464,7 @@ namespace svxform pFormModel->BegUndo(aUndoStr); // der Slot war nur verfuegbar, wenn es genau einen selektierten Eintrag gibt und dieser die Root // oder ein Formular ist - NewForm( m_arrCurrentSelection.GetObject(0) ); + NewForm( *m_arrCurrentSelection.begin() ); pFormModel->EndUndo(); } break; @@ -475,7 +477,7 @@ namespace svxform pFormModel->BegUndo(aUndoStr); // dieser Slot war guletig bei (genau) einem selektierten Formular rtl::OUString fControlName = FM_COMPONENT_HIDDEN; - NewControl( fControlName, m_arrCurrentSelection.GetObject(0) ); + NewControl( fControlName, *m_arrCurrentSelection.begin() ); pFormModel->EndUndo(); } break; @@ -500,7 +502,7 @@ namespace svxform case SID_FM_TAB_DIALOG: { // dieser Slot galt bei genau einem selektierten Formular - SvLBoxEntry* pSelectedForm = m_arrCurrentSelection.GetObject(0); + SvLBoxEntry* pSelectedForm = *m_arrCurrentSelection.begin(); DBG_ASSERT( IsFormEntry(pSelectedForm), "NavigatorTree::Command: Dieser Eintrag muss ein FormEntry sein." ); FmFormData* pFormData = (FmFormData*)pSelectedForm->GetUserData(); @@ -521,7 +523,7 @@ namespace svxform case SID_FM_RENAME_OBJECT: { // das war bei genau einem Nicht-Root-Eintrag erlaubt - EditEntry( m_arrCurrentSelection.GetObject(0) ); + EditEntry( *m_arrCurrentSelection.begin() ); } break; case SID_FM_OPEN_READONLY: @@ -539,7 +541,7 @@ namespace svxform default: if (pFormShell->GetImpl()->isControlConversionSlot(nSlotId)) { - FmControlData* pCurrent = (FmControlData*)(m_arrCurrentSelection[0]->GetUserData()); + FmControlData* pCurrent = (FmControlData*)(*m_arrCurrentSelection.begin())->GetUserData(); if ( pFormShell->GetImpl()->executeControlConversionSlot( pCurrent->GetFormComponent(), nSlotId ) ) ShowSelectionProperties(); } @@ -841,7 +843,7 @@ namespace svxform SvLBoxEntry* pLoop = _pTargetEntry; while (pLoop) { - arrDropAnchestors.Insert(pLoop); + arrDropAnchestors.insert(pLoop); pLoop = GetParent(pLoop); } @@ -873,8 +875,7 @@ namespace svxform // test for 3) if ( IsFormEntry(pCurrent) ) { - sal_uInt16 nPosition; - if ( arrDropAnchestors.Seek_Entry(pCurrent, &nPosition) ) + if ( arrDropAnchestors.find(pCurrent) != arrDropAnchestors.end() ) return DND_ACTION_NONE; } else if ( IsFormComponentEntry(pCurrent) ) { @@ -1300,9 +1301,10 @@ namespace svxform m_bKeyboardCut = sal_True; // mark all the entries we just "cut" into the clipboard as "nearly moved" - for ( sal_Int32 i=0; i<m_arrCurrentSelection.Count(); ++i ) + for ( SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); + it != m_arrCurrentSelection.end(); ++it ) { - SvLBoxEntry* pEntry = m_arrCurrentSelection[ (sal_uInt16)i ]; + SvLBoxEntry* pEntry = *it; if ( pEntry ) { m_aCutEntries.insert( pEntry ); @@ -1637,7 +1639,7 @@ namespace svxform return; CollectSelectionData(SDI_ALL); - DBG_ASSERT( m_nFormsSelected + m_nControlsSelected + (m_bRootSelected ? 1 : 0) == m_arrCurrentSelection.Count(), + DBG_ASSERT( m_nFormsSelected + m_nControlsSelected + (m_bRootSelected ? 1 : 0) == m_arrCurrentSelection.size(), "NavigatorTree::ShowSelectionProperties : selection meta data invalid !"); @@ -1652,16 +1654,16 @@ namespace svxform ; // mixed selection -> no properties else { // either only forms, or only controls are selected - if (m_arrCurrentSelection.Count() == 1) + if (m_arrCurrentSelection.size() == 1) { if (m_nFormsSelected > 0) { // es ist genau eine Form selektiert - FmFormData* pFormData = (FmFormData*)m_arrCurrentSelection.GetObject(0)->GetUserData(); + FmFormData* pFormData = (FmFormData*)(*m_arrCurrentSelection.begin())->GetUserData(); aSelection.insert( Reference< XInterface >( pFormData->GetFormIface(), UNO_QUERY ) ); } else { // es ist genau ein Control selektiert (egal ob hidden oder normal) - FmEntryData* pEntryData = (FmEntryData*)m_arrCurrentSelection.GetObject(0)->GetUserData(); + FmEntryData* pEntryData = (FmEntryData*)(*m_arrCurrentSelection.begin())->GetUserData(); aSelection.insert( Reference< XInterface >( pEntryData->GetElement(), UNO_QUERY ) ); } @@ -1671,20 +1673,24 @@ namespace svxform if (m_nFormsSelected > 0) { // ... nur Forms // erstmal die PropertySet-Interfaces der Forms einsammeln + SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); for ( sal_Int32 i = 0; i < m_nFormsSelected; ++i ) { - FmFormData* pFormData = (FmFormData*)m_arrCurrentSelection.GetObject((sal_uInt16)i)->GetUserData(); + FmFormData* pFormData = (FmFormData*)(*it)->GetUserData(); aSelection.insert( pFormData->GetPropertySet().get() ); + ++it; } } else { // ... nur Controls if (m_nHiddenControls == m_nControlsSelected) { // ein MultiSet fuer die Properties der hidden controls + SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); for ( sal_Int32 i = 0; i < m_nHiddenControls; ++i ) { - FmEntryData* pEntryData = (FmEntryData*)m_arrCurrentSelection.GetObject((sal_uInt16)i)->GetUserData(); + FmEntryData* pEntryData = (FmEntryData*)(*it)->GetUserData(); aSelection.insert( pEntryData->GetPropertySet().get() ); + ++it; } } else if (m_nHiddenControls == 0) @@ -1756,10 +1762,10 @@ namespace svxform // then go on to the strucure. This means I have to delete the forms *after* the normal controls, so // that during UNDO, they're restored in the proper order. pFormShell->GetImpl()->EnableTrackProperties(sal_False); - sal_uInt16 i; - for (i = m_arrCurrentSelection.Count(); i>0; --i) + for (SvLBoxEntrySortedArray::reverse_iterator it = m_arrCurrentSelection.rbegin(); + it != m_arrCurrentSelection.rend(); ) { - FmEntryData* pCurrent = (FmEntryData*)(m_arrCurrentSelection.GetObject(i - 1)->GetUserData()); + FmEntryData* pCurrent = (FmEntryData*)((*it)->GetUserData()); // eine Form ? sal_Bool bIsForm = pCurrent->ISA(FmFormData); @@ -1785,12 +1791,16 @@ namespace svxform // hidden layer (#i28502#), or something like this. // In the first case, it will be deleted below, in the second case, we currently don't // delete it, as there's no real (working!) API for this, neither in UNO nor in non-UNO. - m_arrCurrentSelection.Remove( i - 1, 1 ); + m_arrCurrentSelection.erase( --(it.base()) ); } + else + ++it; // In case there is no shape for the current entry, we keep the entry in m_arrCurrentSelection, - // since then we can definately remove it. + // since then we can definitely remove it. // #103597# } + else + ++it; } pFormShell->GetImpl()->EnableTrackProperties(sal_True); @@ -1805,7 +1815,7 @@ namespace svxform // --------------- // initialize UNDO String aUndoStr; - if ( m_arrCurrentSelection.Count() == 1 ) + if ( m_arrCurrentSelection.size() == 1 ) { aUndoStr = SVX_RES(RID_STR_UNDO_CONTAINER_REMOVE); if (m_nFormsSelected) @@ -1817,15 +1827,16 @@ namespace svxform else { aUndoStr = SVX_RES(RID_STR_UNDO_CONTAINER_REMOVE_MULTIPLE); - aUndoStr.SearchAndReplaceAscii( "#", String::CreateFromInt32( m_arrCurrentSelection.Count() ) ); + aUndoStr.SearchAndReplaceAscii( "#", String::CreateFromInt32( m_arrCurrentSelection.size() ) ); } pFormModel->BegUndo(aUndoStr); } // remove remaining structure - for (i=0; i<m_arrCurrentSelection.Count(); ++i) + for (SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); + it != m_arrCurrentSelection.end(); ++it) { - FmEntryData* pCurrent = (FmEntryData*)(m_arrCurrentSelection.GetObject(i)->GetUserData()); + FmEntryData* pCurrent = (FmEntryData*)((*it)->GetUserData()); // if the entry still has children, we skipped deletion of one of those children. // This may for instance be because the shape is in a hidden layer, where we're unable @@ -1854,7 +1865,7 @@ namespace svxform if (sdiHow == m_sdiState) return; - m_arrCurrentSelection.Remove((sal_uInt16)0, m_arrCurrentSelection.Count()); + m_arrCurrentSelection.clear(); m_nFormsSelected = m_nControlsSelected = m_nHiddenControls = 0; m_bRootSelected = sal_False; @@ -1880,7 +1891,7 @@ namespace svxform { // alles, was schon einen selektierten Vorfahr hat, nicht mitnehmen if (pSelectionLoop == m_pRootEntry) - m_arrCurrentSelection.Insert(pSelectionLoop); + m_arrCurrentSelection.insert(pSelectionLoop); else { SvLBoxEntry* pParentLoop = GetParent(pSelectionLoop); @@ -1896,7 +1907,7 @@ namespace svxform if (m_pRootEntry == pParentLoop) { // bis (exclusive) zur Root gab es kein selektiertes Parent -> der Eintrag gehoert in die normalisierte Liste - m_arrCurrentSelection.Insert(pSelectionLoop); + m_arrCurrentSelection.insert(pSelectionLoop); break; } else @@ -1909,10 +1920,10 @@ namespace svxform { SvLBoxEntry* pParent = GetParent(pSelectionLoop); if (!pParent || !IsSelected(pParent) || IsFormEntry(pSelectionLoop)) - m_arrCurrentSelection.Insert(pSelectionLoop); + m_arrCurrentSelection.insert(pSelectionLoop); } else - m_arrCurrentSelection.Insert(pSelectionLoop); + m_arrCurrentSelection.insert(pSelectionLoop); pSelectionLoop = NextSelected(pSelectionLoop); @@ -2014,9 +2025,10 @@ namespace svxform UnmarkAllViewObj(); - for (sal_uInt32 i=0; i<m_arrCurrentSelection.Count(); ++i) + for (SvLBoxEntrySortedArray::const_iterator it = m_arrCurrentSelection.begin(); + it != m_arrCurrentSelection.end(); ++it) { - SvLBoxEntry* pSelectionLoop = m_arrCurrentSelection.GetObject((sal_uInt16)i); + SvLBoxEntry* pSelectionLoop = *it; // Bei Formselektion alle Controls dieser Form markieren if (IsFormEntry(pSelectionLoop) && (pSelectionLoop != m_pRootEntry)) MarkViewObj((FmFormData*)pSelectionLoop->GetUserData(), sal_True, sal_False); @@ -2055,7 +2067,7 @@ namespace svxform // wenn jetzt genau eine Form selektiert ist, sollte die Shell das als CurrentForm mitbekommen // (wenn SelectionHandling nicht locked ist, kuemmert sich die View eigentlich in MarkListHasChanged drum, // aber der Mechanismus greift zum Beispiel nicht, wenn die Form leer ist) - if ((m_arrCurrentSelection.Count() == 1) && (m_nFormsSelected == 1)) + if ((m_arrCurrentSelection.size() == 1) && (m_nFormsSelected == 1)) { FmFormData* pSingleSelectionData = PTR_CAST( FmFormData, static_cast< FmEntryData* >( FirstSelected()->GetUserData() ) ); DBG_ASSERT( pSingleSelectionData, "NavigatorTree::SynchronizeMarkList: invalid selected form!" ); diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx index d4a6ce1..30ead6d 100644 --- a/svx/source/inc/fmexpl.hxx +++ b/svx/source/inc/fmexpl.hxx @@ -419,8 +419,7 @@ namespace svxform }; //======================================================================== - typedef SvLBoxEntry* SvLBoxEntryPtr; - SV_DECL_PTRARR_SORT( SvLBoxEntrySortedArray, SvLBoxEntryPtr, 16 ) + typedef std::set<SvLBoxEntry*> SvLBoxEntrySortedArray; class NavigatorTree : public SvTreeListBox, public SfxListener { commit cbacb45b1c697393fa2934bcab402c2f7172eeb5 Author: Noel Grandin <n...@peralex.com> Date: Sun Apr 15 21:22:53 2012 +0200 Convert SV_DECL_PTRARR_SORT to std::set diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx index 95ae0a8..3c4dbaf 100644 --- a/svx/source/form/fmexpl.cxx +++ b/svx/source/form/fmexpl.cxx @@ -85,7 +85,6 @@ using namespace ::com::sun::star::container; //======================================================================== -SV_IMPL_PTRARR_SORT( FmEntryDataArray, FmEntryDataPtr ) SV_IMPL_PTRARR_SORT( SvLBoxEntrySortedArray, SvLBoxEntryPtr ) //======================================================================== diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 2c66437..1bcfbe9 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1926,7 +1926,7 @@ namespace svxform { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "ocke.jans...@sun.com", "NavigatorTree::SynchronizeSelection" ); LockSelectionHandling(); - if (arredToSelect.Count() == 0) + if (arredToSelect.empty()) { SelectAll(sal_False); } @@ -1939,11 +1939,11 @@ namespace svxform FmEntryData* pCurrent = (FmEntryData*)pSelection->GetUserData(); if (pCurrent != NULL) { - sal_uInt16 nPosition; - if ( arredToSelect.Seek_Entry(pCurrent, &nPosition) ) + FmEntryDataArray::iterator it = arredToSelect.find(pCurrent); + if ( it != arredToSelect.end() ) { // der Entry ist schon selektiert, steht aber auch in der SelectList -> er kann aus letzterer // raus - arredToSelect.Remove(nPosition, 1); + arredToSelect.erase(it); } else { // der Entry ist selektiert, aber steht nicht in der SelectList -> Selektion rausnehmen Select(pSelection, sal_False); @@ -1971,8 +1971,8 @@ namespace svxform while( pLoop ) { FmEntryData* pCurEntryData = (FmEntryData*)pLoop->GetUserData(); - sal_uInt16 nPosition; - if ( arredToSelect.Seek_Entry(pCurEntryData, &nPosition) ) + FmEntryDataArray::iterator it = arredToSelect.find(pCurEntryData); + if ( it != arredToSelect.end() ) { Select(pLoop, sal_True); MakeVisible(pLoop); diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx index 7bbee53..d4a6ce1 100644 --- a/svx/source/inc/fmexpl.hxx +++ b/svx/source/inc/fmexpl.hxx @@ -61,6 +61,7 @@ #include "fmexch.hxx" #include <vector> +#include <set> class SdrObjListIter; class FmFormShell; @@ -228,8 +229,7 @@ public: //======================================================================== // FmNavRequestSelectHint - jemand teilt dem NavigatorTree mit, dass er bestimmte Eintraege selektieren soll -typedef FmEntryData* FmEntryDataPtr; -SV_DECL_PTRARR_SORT( FmEntryDataArray, FmEntryDataPtr, 16 ) +typedef std::set<FmEntryData*> FmEntryDataArray; class FmNavRequestSelectHint : public SfxHint { @@ -242,8 +242,8 @@ public: void SetMixedSelection(sal_Bool bMixedSelection) { m_bMixedSelection = bMixedSelection; } sal_Bool IsMixedSelection() { return m_bMixedSelection; } - void AddItem(FmEntryData* pEntry) { m_arredToSelect.Insert(pEntry); } - void ClearItems() { m_arredToSelect.Remove(sal_uInt16(0), m_arredToSelect.Count()); } + void AddItem(FmEntryData* pEntry) { m_arredToSelect.insert(pEntry); } + void ClearItems() { m_arredToSelect.clear(); } FmEntryDataArray& GetItems() { return m_arredToSelect; } }; _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits