diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-01 10:09:07 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-02 06:32:25 +0000 |
commit | 84d15d6e5418bd5024bb21b6c8fdc2700667ac04 (patch) | |
tree | 1d9af624bc2a13c2b57a317354a9b64c77f90a71 /svtools | |
parent | 8e8a88ec1ad02c153ae3c7653edc81716dc91b7a (diff) |
loplugin:unuseddefaultparams
Change-Id: I0fe173534dc2e70c3d507eae757a91e48a26acfc
Reviewed-on: https://gerrit.libreoffice.org/25757
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/contnr/imivctl.hxx | 4 | ||||
-rw-r--r-- | svtools/source/contnr/imivctl1.cxx | 14 | ||||
-rw-r--r-- | svtools/source/contnr/imivctl2.cxx | 49 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 191 |
4 files changed, 110 insertions, 148 deletions
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index 22d54708d193..0e0f09e0db6b 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -273,7 +273,7 @@ class SvxIconChoiceCtrl_Impl Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const; void ClipAtVirtOutRect( Rectangle& rRect ) const; - void AdjustAtGrid( const SvxIconChoiceCtrlEntryPtrVec& rRow, SvxIconChoiceCtrlEntry* pStart=nullptr ); + void AdjustAtGrid( const SvxIconChoiceCtrlEntryPtrVec& rRow ); Point AdjustAtGrid( const Rectangle& rCenterRect, // balance point of object (typically Bmp-Rect) const Rectangle& rBoundRect @@ -547,7 +547,7 @@ public: // Creates a list of entries for every row (height = nGridDY) sorted by // BoundRect.Left(). A list may be empty. The lists become the property of // the caller and have to be deleted with DestroyGridAdjustData. - void CreateGridAjustData( IconChoiceMap& pLists, SvxIconChoiceCtrlEntry* pRow=nullptr); + void CreateGridAjustData( IconChoiceMap& pLists ); static void DestroyGridAdjustData( IconChoiceMap& rLists ); }; diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 75c79f3a5b90..64b2d3d8bd5a 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -2724,29 +2724,19 @@ void SvxIconChoiceCtrl_Impl::AdjustEntryAtGrid() } // align a row, might expand width, doesn't break the line -void SvxIconChoiceCtrl_Impl::AdjustAtGrid( const SvxIconChoiceCtrlEntryPtrVec& rRow, SvxIconChoiceCtrlEntry* pStart ) +void SvxIconChoiceCtrl_Impl::AdjustAtGrid( const SvxIconChoiceCtrlEntryPtrVec& rRow ) { if( rRow.empty() ) return; - bool bGo; - if( !pStart ) - bGo = true; - else - bGo = false; - long nCurRight = 0; for(SvxIconChoiceCtrlEntry* pCur : rRow) { - if( !bGo && pCur == pStart ) - bGo = true; - - // SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pCur); // Decisive (for our eye) is the bitmap, else, the entry might jump too // much within long texts. const Rectangle& rBoundRect = GetEntryBoundRect( pCur ); Rectangle aCenterRect( CalcBmpRect( pCur )); - if( bGo && !pCur->IsPosLocked() ) + if( !pCur->IsPosLocked() ) { long nWidth = aCenterRect.GetSize().Width(); Point aNewPos( AdjustAtGrid( aCenterRect, rBoundRect ) ); diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx index f785b0e162ac..e9a914da71f5 100644 --- a/svtools/source/contnr/imivctl2.cxx +++ b/svtools/source/contnr/imivctl2.cxx @@ -479,46 +479,21 @@ void IcnCursor_Impl::SetDeltas() } } -void IcnCursor_Impl::CreateGridAjustData( IconChoiceMap& rLists, SvxIconChoiceCtrlEntry* pRefEntry) +void IcnCursor_Impl::CreateGridAjustData( IconChoiceMap& rLists ) { - if( !pRefEntry ) - { - sal_uInt16 nGridRows = (sal_uInt16)(pView->aVirtOutputSize.Height() / pView->nGridDY); - nGridRows++; // because we round down later! + sal_uInt16 nGridRows = (sal_uInt16)(pView->aVirtOutputSize.Height() / pView->nGridDY); + nGridRows++; // because we round down later! - if( !nGridRows ) - return; - const size_t nCount = pView->aEntries.size(); - for( size_t nCur = 0; nCur < nCount; nCur++ ) - { - SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ]; - const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); - short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); - sal_uInt16 nIns = GetSortListPos( rLists[nY], rRect.Left(), false ); - rLists[ nY ].insert( rLists[ nY ].begin() + nIns, pEntry ); - } - } - else + if( !nGridRows ) + return; + const size_t nCount = pView->aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - // build a horizontal "tube" in the RefEntry line - // STOP AND THINK: maybe use bounding rectangle because of overlaps? - Rectangle rRefRect( pView->CalcBmpRect( pRefEntry ) ); - //const Rectangle& rRefRect = pView->GetEntryBoundRect( pRefEntry ); - short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY ); - SvxIconChoiceCtrlEntryPtrVec& rRow = rLists[0]; - size_t nCount = pView->aEntries.size(); - for( size_t nCur = 0; nCur < nCount; nCur++ ) - { - SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ]; - Rectangle rRect( pView->CalcBmpRect(pEntry) ); - //const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); - short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); - if( nY == nRefRow ) - { - sal_uInt16 nIns = GetSortListPos( rRow, rRect.Left(), false ); - rRow.insert( rRow.begin() + nIns, pEntry ); - } - } + SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ]; + const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); + short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); + sal_uInt16 nIns = GetSortListPos( rLists[nY], rRect.Left(), false ); + rLists[ nY ].insert( rLists[ nY ].begin() + nIns, pEntry ); } } diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 7a931b840b7c..da643635b20f 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -2763,8 +2763,7 @@ void SvTreeListBox::InvalidateEntry(SvTreeListEntry* pEntry) } } -void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, long nLine, vcl::RenderContext& rRenderContext, - SvLBoxTabFlags nTabFlags) +void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, long nLine, vcl::RenderContext& rRenderContext) { Rectangle aRect; // multi purpose @@ -2842,122 +2841,120 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, long nLine, vcl::Render else nX = nTabPos + pTab->CalcOffset(aSize.Width(), nNextTabPos - nTabPos); - if (nFlags & nTabFlags) - { - aEntryPos.X() = nX; - aEntryPos.Y() = nLine; + aEntryPos.X() = nX; + aEntryPos.Y() = nLine; - // set background pattern/color + // set background pattern/color - Wallpaper aWallpaper = rRenderContext.GetBackground(); + Wallpaper aWallpaper = rRenderContext.GetBackground(); - bool bSelTab = bool(nFlags & SvLBoxTabFlags::SHOW_SELECTION); - sal_uInt16 nItemType = pItem->GetType(); + bool bSelTab = bool(nFlags & SvLBoxTabFlags::SHOW_SELECTION); + sal_uInt16 nItemType = pItem->GetType(); - if (pViewDataEntry->IsHighlighted() && bSelTab && !pViewDataEntry->IsCursored()) - { - Color aNewWallColor = rSettings.GetHighlightColor(); - if (!bInUse || nItemType != SV_ITEM_ID_LBOXCONTEXTBMP) - { - // if the face color is bright then the deactive color is also bright - // -> so you can't see any deactive selection - if (bHideSelection && !rSettings.GetFaceColor().IsBright() - && aWallpaper.GetColor().IsBright() != rSettings.GetDeactiveColor().IsBright()) - { - aNewWallColor = rSettings.GetDeactiveColor(); - } - // set font color to highlight - if (!bCurFontIsSel) - { - rRenderContext.SetTextColor(aHighlightTextColor); - rRenderContext.SetFont(aHighlightFont); - bCurFontIsSel = true; - } - } - aWallpaper.SetColor(aNewWallColor); - } - else // no selection + if (pViewDataEntry->IsHighlighted() && bSelTab && !pViewDataEntry->IsCursored()) + { + Color aNewWallColor = rSettings.GetHighlightColor(); + if (!bInUse || nItemType != SV_ITEM_ID_LBOXCONTEXTBMP) { - if (bInUse && nItemType == SV_ITEM_ID_LBOXCONTEXTBMP) + // if the face color is bright then the deactive color is also bright + // -> so you can't see any deactive selection + if (bHideSelection && !rSettings.GetFaceColor().IsBright() + && aWallpaper.GetColor().IsBright() != rSettings.GetDeactiveColor().IsBright()) { - aWallpaper.SetColor(rSettings.GetFieldColor()); + aNewWallColor = rSettings.GetDeactiveColor(); } - else if (bCurFontIsSel) + // set font color to highlight + if (!bCurFontIsSel) { - bCurFontIsSel = false; - rRenderContext.SetTextColor(aBackupTextColor); - rRenderContext.SetFont(aBackupFont); - } - else - { - aWallpaper.SetColor(rEntry.GetBackColor()); + rRenderContext.SetTextColor(aHighlightTextColor); + rRenderContext.SetFont(aHighlightFont); + bCurFontIsSel = true; } } - - // draw background - if (!(nTreeFlags & SvTreeFlags::USESEL)) + aWallpaper.SetColor(aNewWallColor); + } + else // no selection + { + if (bInUse && nItemType == SV_ITEM_ID_LBOXCONTEXTBMP) { - // only draw the area that is used by the item - aRectSize.Width() = aSize.Width(); - aRect.SetPos(aEntryPos); - aRect.SetSize(aRectSize); + aWallpaper.SetColor(rSettings.GetFieldColor()); } - else + else if (bCurFontIsSel) { - // draw from the current to the next tab - if (nCurTab != 0) - aRect.Left() = nTabPos; - else - // if we're in the 0th tab, always draw from column 0 -- - // else we get problems with centered tabs - aRect.Left() = 0; - aRect.Top() = nLine; - aRect.Bottom() = nLine + nTempEntryHeight - 1; - if (pNextTab) - { - long nRight; - nRight = GetTabPos(&rEntry, pNextTab) - 1; - if (nRight > nMaxRight) - nRight = nMaxRight; - aRect.Right() = nRight; - } - else - { - aRect.Right() = nMaxRight; - } + bCurFontIsSel = false; + rRenderContext.SetTextColor(aBackupTextColor); + rRenderContext.SetFont(aBackupFont); } - // A custom selection that starts at a tab position > 0, do not fill - // the background of the 0th item, else e.g. we might not be able to - // realize tab listboxes with lines. - if (!(nCurTab == 0 && (nTreeFlags & SvTreeFlags::USESEL) && nFirstSelTab)) + else { - Color aBackgroundColor = aWallpaper.GetColor(); - if (aBackgroundColor != Color(COL_TRANSPARENT)) - { - rRenderContext.SetFillColor(aBackgroundColor); - // this case may occur for smaller horizontal resizes - if (aRect.Left() < aRect.Right()) - rRenderContext.DrawRect(aRect); - } + aWallpaper.SetColor(rEntry.GetBackColor()); } - // draw item - // center vertically - aEntryPos.Y() += (nTempEntryHeight - aSize.Height()) / 2; - pViewDataEntry->SetPaintRectangle(aRect); - - pItem->Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, rEntry); + } - // division line between tabs - if (pNextTab && pItem->GetType() == SV_ITEM_ID_LBOXSTRING && - // not at the right edge of the window! - aRect.Right() < nMaxRight) + // draw background + if (!(nTreeFlags & SvTreeFlags::USESEL)) + { + // only draw the area that is used by the item + aRectSize.Width() = aSize.Width(); + aRect.SetPos(aEntryPos); + aRect.SetSize(aRectSize); + } + else + { + // draw from the current to the next tab + if (nCurTab != 0) + aRect.Left() = nTabPos; + else + // if we're in the 0th tab, always draw from column 0 -- + // else we get problems with centered tabs + aRect.Left() = 0; + aRect.Top() = nLine; + aRect.Bottom() = nLine + nTempEntryHeight - 1; + if (pNextTab) { - aRect.Left() = aRect.Right() - SV_TAB_BORDER; - rRenderContext.DrawRect(aRect); + long nRight; + nRight = GetTabPos(&rEntry, pNextTab) - 1; + if (nRight > nMaxRight) + nRight = nMaxRight; + aRect.Right() = nRight; } + else + { + aRect.Right() = nMaxRight; + } + } + // A custom selection that starts at a tab position > 0, do not fill + // the background of the 0th item, else e.g. we might not be able to + // realize tab listboxes with lines. + if (!(nCurTab == 0 && (nTreeFlags & SvTreeFlags::USESEL) && nFirstSelTab)) + { + Color aBackgroundColor = aWallpaper.GetColor(); + if (aBackgroundColor != Color(COL_TRANSPARENT)) + { + rRenderContext.SetFillColor(aBackgroundColor); + // this case may occur for smaller horizontal resizes + if (aRect.Left() < aRect.Right()) + rRenderContext.DrawRect(aRect); + } + } + // draw item + // center vertically + aEntryPos.Y() += (nTempEntryHeight - aSize.Height()) / 2; + pViewDataEntry->SetPaintRectangle(aRect); - rRenderContext.SetFillColor(aBackupColor); + pItem->Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, rEntry); + + // division line between tabs + if (pNextTab && pItem->GetType() == SV_ITEM_ID_LBOXSTRING && + // not at the right edge of the window! + aRect.Right() < nMaxRight) + { + aRect.Left() = aRect.Right() - SV_TAB_BORDER; + rRenderContext.DrawRect(aRect); } + + rRenderContext.SetFillColor(aBackupColor); + nCurItem++; nCurTab++; } |