diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-10 14:39:07 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-11 06:54:34 +0000 |
commit | 265068d65b39688b8a4756dfbcd46453dd1f9b70 (patch) | |
tree | 6936185b2f2f46b99646d00e542cdde845ef073d /starmath/source | |
parent | 9e0335d1db22bd3ad3f4bb249b30a00fd55558f4 (diff) |
clang-tidy modernize-loop-convert in scripting to svtools
Change-Id: I98229d14109cf243839d632feabde1391ea9bad5
Reviewed-on: https://gerrit.libreoffice.org/24847
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/ElementsDockingWindow.cxx | 23 | ||||
-rw-r--r-- | starmath/source/cfgitem.cxx | 12 | ||||
-rw-r--r-- | starmath/source/dialog.cxx | 8 | ||||
-rw-r--r-- | starmath/source/document.cxx | 3 | ||||
-rw-r--r-- | starmath/source/ooxmlexport.cxx | 4 | ||||
-rw-r--r-- | starmath/source/rtfexport.cxx | 4 | ||||
-rw-r--r-- | starmath/source/symbol.cxx | 6 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 3 | ||||
-rw-r--r-- | starmath/source/utility.cxx | 10 |
9 files changed, 35 insertions, 38 deletions
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index cd7d2c4a1163..3dcfb70ba6de 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -285,9 +285,9 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext) else boxX = nControlWidth / perLine; - for (size_t i = 0; i < maElementList.size() ; i++) + for (std::unique_ptr<SmElement> & i : maElementList) { - SmElement* element = maElementList[i].get(); + SmElement* element = i.get(); if (element->isSeparator()) { if (mbVerticalMode) @@ -397,9 +397,9 @@ void SmElementsControl::RequestHelp(const HelpEvent& rHEvt) if (!rHEvt.KeyboardActivated()) { Point aHelpEventPos(ScreenToOutputPixel(rHEvt.GetMousePosPixel())); - for (size_t i = 0; i < maElementList.size() ; i++) + for (std::unique_ptr<SmElement> & i : maElementList) { - SmElement* pElement = maElementList[i].get(); + SmElement* pElement = i.get(); Rectangle aRect(pElement->mBoxLocation, pElement->mBoxSize); if (aRect.IsInside(aHelpEventPos)) { @@ -439,9 +439,9 @@ void SmElementsControl::MouseMove( const MouseEvent& rMouseEvent ) mpCurrentElement = nullptr; if (Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel())) { - for (size_t i = 0; i < maElementList.size() ; i++) + for (std::unique_ptr<SmElement> & i : maElementList) { - SmElement* element = maElementList[i].get(); + SmElement* element = i.get(); Rectangle rect(element->mBoxLocation, element->mBoxSize); if (rect.IsInside(rMouseEvent.GetPosPixel())) { @@ -465,9 +465,9 @@ void SmElementsControl::MouseButtonDown(const MouseEvent& rMouseEvent) if (rMouseEvent.IsLeft() && Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel()) && maSelectHdlLink.IsSet()) { - for (size_t i = 0; i < maElementList.size() ; i++) + for (std::unique_ptr<SmElement> & i : maElementList) { - SmElement* element = maElementList[i].get(); + SmElement* element = i.get(); Rectangle rect(element->mBoxLocation, element->mBoxSize); if (rect.IsInside(rMouseEvent.GetPosPixel())) { @@ -709,9 +709,9 @@ SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, Sf mpElementListBox->SetDropDownLineCount( SAL_N_ELEMENTS(aCategories) ); - for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aCategories) ; i++) + for (sal_uInt16 nCategory : aCategories) { - mpElementListBox->InsertEntry(SM_RESSTR(aCategories[i])); + mpElementListBox->InsertEntry(SM_RESSTR(nCategory)); } mpElementListBox->SetSelectHdl(LINK(this, SmElementsDockingWindow, ElementSelectedHandle)); @@ -766,9 +766,8 @@ IMPL_LINK_TYPED(SmElementsDockingWindow, SelectClickHandler, SmElement&, rElemen IMPL_LINK_TYPED( SmElementsDockingWindow, ElementSelectedHandle, ListBox&, rList, void) { - for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aCategories) ; i++) + for (sal_uInt16 aCurrentCategory : aCategories) { - sal_uInt16 aCurrentCategory = aCategories[i]; OUString aCurrentCategoryString = SM_RESSTR(aCurrentCategory); if (aCurrentCategoryString == rList.GetSelectEntry()) { diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 263f2dae8556..5cf881739aa8 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -253,11 +253,11 @@ const SmFontFormat * SmFontFormatList::GetFontFormat( const OUString &rFntFmtId { const SmFontFormat *pRes = nullptr; - for (size_t i = 0; i < aEntries.size(); ++i) + for (const auto & rEntry : aEntries) { - if (aEntries[i].aId == rFntFmtId) + if (rEntry.aId == rFntFmtId) { - pRes = &aEntries[i].aFntFmt; + pRes = &rEntry.aFntFmt; break; } } @@ -279,11 +279,11 @@ const OUString SmFontFormatList::GetFontFormatId( const SmFontFormat &rFntFmt ) { OUString aRes; - for (size_t i = 0; i < aEntries.size(); ++i) + for (const auto & rEntry : aEntries) { - if (aEntries[i].aFntFmt == rFntFmt) + if (rEntry.aFntFmt == rFntFmt) { - aRes = aEntries[i].aId; + aRes = rEntry.aId; break; } } diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index d3dbffd29d11..ccccfeaf8409 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -923,8 +923,8 @@ SmDistanceDialog::~SmDistanceDialog() void SmDistanceDialog::dispose() { - for (int i = 0; i < NOCATEGORIES; i++) - DELETEZ(Categories[i]); + for (SmCategoryDesc* & rpDesc : Categories) + DELETEZ(rpDesc); m_pFrame.clear(); m_pFixedText1.clear(); m_pMetricField1.clear(); @@ -1709,8 +1709,8 @@ void SmSymDefineDialog::FillSymbols(ComboBox &rComboBox, bool bDeleteText) ComboBox &rBox = &rComboBox == pOldSymbols ? *pOldSymbolSets : *pSymbolSets; SymbolPtrVec_t aSymSet( aSymbolMgrCopy.GetSymbolSet( rBox.GetText() ) ); - for (size_t i = 0; i < aSymSet.size(); ++i) - rComboBox.InsertEntry( aSymSet[i]->GetName() ); + for (const SmSym* i : aSymSet) + rComboBox.InsertEntry( i->GetName() ); } diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index ebe552a88fee..8028a02bf803 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -320,9 +320,8 @@ void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool) aTable[1].nLang = aOpt.nDefaultLanguage_CJK; aTable[2].nLang = aOpt.nDefaultLanguage_CTL; - for (int i = 0; i < 3; ++i) + for (FontDta & rFntDta : aTable) { - const FontDta &rFntDta = aTable[i]; LanguageType nLang = (LANGUAGE_NONE == rFntDta.nLang) ? rFntDta.nFallbackLang : rFntDta.nLang; vcl::Font aFont = OutputDevice::GetDefaultFont( diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx index 911ab814c254..1e79e681c742 100644 --- a/starmath/source/ooxmlexport.cxx +++ b/starmath/source/ooxmlexport.cxx @@ -498,10 +498,10 @@ void SmOoxmlExport::HandleBrace( const SmBraceNode* pNode, int nLevel ) FSNS( XML_m, XML_val ), mathSymbolToString( pNode->ClosingBrace()).getStr(), FSEND ); m_pSerializer->endElementNS( XML_m, XML_dPr ); - for( size_t i = 0; i < subnodes.size(); ++i ) + for(const SmNode* subnode : subnodes) { m_pSerializer->startElementNS( XML_m, XML_e, FSEND ); - HandleNode( subnodes[ i ], nLevel + 1 ); + HandleNode( subnode, nLevel + 1 ); m_pSerializer->endElementNS( XML_m, XML_e ); } m_pSerializer->endElementNS( XML_m, XML_d ); diff --git a/starmath/source/rtfexport.cxx b/starmath/source/rtfexport.cxx index 0d508294d413..d8f942820486 100644 --- a/starmath/source/rtfexport.cxx +++ b/starmath/source/rtfexport.cxx @@ -432,10 +432,10 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel) m_pBuffer->append(mathSymbolToString(pNode->ClosingBrace(), m_nEncoding)); m_pBuffer->append("}"); // mendChr m_pBuffer->append("}"); // mdPr - for (std::size_t i = 0; i < subnodes.size(); ++i) + for (const SmNode* subnode : subnodes) { m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " "); - HandleNode(subnodes[ i ], nLevel + 1); + HandleNode(subnode, nLevel + 1); m_pBuffer->append("}"); // me } m_pBuffer->append("}"); // md diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx index 0b3b54e2a6ab..3e6442cdb27d 100644 --- a/starmath/source/symbol.cxx +++ b/starmath/source/symbol.cxx @@ -288,12 +288,12 @@ void SmSymbolManager::Save() SymbolPtrVec_t aTmp( GetSymbols() ); std::vector< SmSym > aSymbols; - for (size_t i = 0; i < aTmp.size(); ++i) + for (const SmSym* i : aTmp) { // skip symbols from iGreek set since those symbols always get added // by computational means in SmSymbolManager::Load - if (aTmp[i]->GetSymbolSetName() != aSymbolSetName) - aSymbols.push_back( *aTmp[i] ); + if (i->GetSymbolSetName() != aSymbolSetName) + aSymbols.push_back( *i ); } rCfg.SetSymbols( aSymbols ); diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index cda93d4b3995..6343bba66663 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -845,9 +845,8 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu vector < const SmSym * > aVector; const SymbolPtrVec_t aSymbols( rManager.GetSymbols() ); - for (size_t i = 0; i < aSymbols.size(); ++i) + for (const SmSym* pSymbol : aSymbols) { - const SmSym * pSymbol = aSymbols[ i ]; if (pSymbol && !pSymbol->IsPredefined() && (!bUsedSymbolsOnly || rUsedSymbols.find( pSymbol->GetName() ) != rUsedSymbols.end())) diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx index 00de175fcbb3..0a1b61ba282e 100644 --- a/starmath/source/utility.cxx +++ b/starmath/source/utility.cxx @@ -55,8 +55,8 @@ SmFontPickList& SmFontPickList::operator = (const SmFontPickList& rList) { Clear(); nMaxItems = rList.nMaxItems; - for (size_t nPos = 0; nPos < rList.aFontVec.size(); nPos++) - aFontVec.push_back( rList.aFontVec[nPos] ); + for (const auto & nPos : rList.aFontVec) + aFontVec.push_back( nPos ); return *this; } @@ -106,10 +106,10 @@ void SmFontPickList::Insert(const vcl::Font &rFont) void SmFontPickList::Update(const vcl::Font &rFont, const vcl::Font &rNewFont) { - for (size_t nPos = 0; nPos < aFontVec.size(); nPos++) - if (CompareItem( aFontVec[nPos], rFont )) + for (vcl::Font & rPos : aFontVec) + if (CompareItem( rPos, rFont )) { - aFontVec[nPos] = rNewFont; + rPos = rNewFont; break; } } |