diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-28 18:07:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-29 12:14:02 +0200 |
commit | a612d738a8c909e18ed89675432ca42b376ef624 (patch) | |
tree | 67729979d1f7b14726dce15f3d44faaf54e28bde /sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx | |
parent | 415436ad27b4522102d3fbbb6003935871029fc6 (diff) |
loplugin:stringloop in sd
Change-Id: I5b0cd65b6e69490c79e0ac37c137283d19711787
Reviewed-on: https://gerrit.libreoffice.org/58252
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx')
-rw-r--r-- | sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx index b3f570c1193d..f4cc1a71b0b6 100644 --- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx +++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx @@ -683,7 +683,7 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() ::osl::MutexGuard aGuard (maMutex); uno::Any anyAtrribute; - OUString sValue; + OUStringBuffer sValue; if (nullptr != dynamic_cast<const ::sd::DrawViewShell* > (mpViewShell)) { ::sd::DrawViewShell* pDrViewSh = static_cast< ::sd::DrawViewShell*>(mpViewShell); @@ -699,13 +699,11 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() sDisplay = sDisplay.replaceFirst( ",", "\\," ); sDisplay = sDisplay.replaceFirst( ":", "\\:" ); sValue = sName + sDisplay ; - sName = ";page-number:"; - sValue += sName; - sValue += OUString::number(static_cast<sal_Int16>(static_cast<sal_uInt16>((pDrViewSh->getCurrentPage()->GetPageNum()-1)>>1) + 1)) ; - sName = ";total-pages:"; - sValue += sName; - sValue += OUString::number(pDrViewSh->GetPageTabControl().GetPageCount()) ; - sValue += ";"; + sValue.append(";page-number:"); + sValue.append(OUString::number(static_cast<sal_Int16>(static_cast<sal_uInt16>((pDrViewSh->getCurrentPage()->GetPageNum()-1)>>1) + 1)) ); + sValue.append(";total-pages:"); + sValue.append(OUString::number(pDrViewSh->GetPageTabControl().GetPageCount()) ); + sValue.append(";"); if(pDrViewSh->IsLayerModeActive() && pDrViewSh->GetLayerTabControl()) // #i87182# { sName = "page-name:"; @@ -731,14 +729,12 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() sDisplay = sDisplay.replaceFirst( ";", "\\;" ); sDisplay = sDisplay.replaceFirst( ",", "\\," ); sDisplay = sDisplay.replaceFirst( ":", "\\:" ); - sValue += sDisplay; - sName = ";page-number:"; - sValue += sName; - sValue += OUString::number(pDrViewSh->GetActiveTabLayerIndex()+1) ; - sName = ";total-pages:"; - sValue += sName; - sValue += OUString::number(pDrViewSh->GetLayerTabControl()->GetPageCount()) ; - sValue += ";"; + sValue.append(sDisplay); + sValue.append(";page-number:"); + sValue.append(OUString::number(pDrViewSh->GetActiveTabLayerIndex()+1) ); + sValue.append(";total-pages:"); + sValue.append(OUString::number(pDrViewSh->GetLayerTabControl()->GetPageCount()) ); + sValue.append(";"); } } if (dynamic_cast<const ::sd::PresentationViewShell* >(mpViewShell) != nullptr ) @@ -755,7 +751,7 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() OutlinerParaObject* pPara = pNotesObj->GetOutlinerParaObject(); if (pPara) { - sValue += "note:"; + sValue.append("note:"); const EditTextObject& rEdit = pPara->GetTextObject(); for (sal_Int32 i=0;i<rEdit.GetParagraphCount();i++) { @@ -765,8 +761,8 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() strNote = strNote.replaceFirst( ";", "\\;" ); strNote = strNote.replaceFirst( ",", "\\," ); strNote = strNote.replaceFirst( ":", "\\:" ); - sValue += strNote; - sValue += ";";//to divide each paragraph + sValue.append(strNote); + sValue.append(";");//to divide each paragraph } } } @@ -774,30 +770,26 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() } if (dynamic_cast<const ::sd::OutlineViewShell* >(mpViewShell ) != nullptr ) { - OUString sName; OUString sDisplay; SdPage* pCurrPge = mpViewShell->GetActualPage(); SdDrawDocument* pDoc = mpViewShell->GetDoc(); if(pCurrPge && pDoc) { - sName = "page-name:"; sDisplay = pCurrPge->GetName(); sDisplay = sDisplay.replaceFirst( "=", "\\=" ); sDisplay = sDisplay.replaceFirst( ";", "\\;" ); sDisplay = sDisplay.replaceFirst( ",", "\\," ); sDisplay = sDisplay.replaceFirst( ":", "\\:" ); - sValue = sName + sDisplay ; - sName = ";page-number:"; - sValue += sName; - sValue += OUString::number(static_cast<sal_Int16>(static_cast<sal_uInt16>((pCurrPge->GetPageNum()-1)>>1) + 1)) ; - sName = ";total-pages:"; - sValue += sName; - sValue += OUString::number(pDoc->GetSdPageCount(PageKind::Standard)) ; - sValue += ";"; + sValue = "page-name:" + sDisplay; + sValue.append(";page-number:"); + sValue.append(OUString::number(static_cast<sal_Int16>(static_cast<sal_uInt16>((pCurrPge->GetPageNum()-1)>>1) + 1)) ); + sValue.append(";total-pages:"); + sValue.append(OUString::number(pDoc->GetSdPageCount(PageKind::Standard)) ); + sValue.append(";"); } } if (sValue.getLength()) - anyAtrribute <<= sValue; + anyAtrribute <<= sValue.makeStringAndClear(); return anyAtrribute; } |