Kaydet (Commit) 1d371bb5 authored tarafından Julien Nabet's avatar Julien Nabet

Replace macro IterateLayoutItems

+ use const iterator when possible

Change-Id: I6aa0c312394309455df804947565a3b876aa4d19
Reviewed-on: https://gerrit.libreoffice.org/23968Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
Tested-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 429a15cc
...@@ -93,13 +93,6 @@ namespace { ...@@ -93,13 +93,6 @@ namespace {
const Rectangle& rBox); const Rectangle& rBox);
} }
#define IterateLayoutItems(iterator_name,container) \
for(::std::vector<LayoutItem>::iterator \
iterator_name(container.begin()), \
iEnd(container.end()); \
iterator_name!=iEnd; \
++iterator_name)
void DeckLayouter::LayoutDeck ( void DeckLayouter::LayoutDeck (
const Rectangle& rContentArea, const Rectangle& rContentArea,
sal_Int32& rMinimalWidth, sal_Int32& rMinimalWidth,
...@@ -163,7 +156,11 @@ Rectangle LayoutPanels ( ...@@ -163,7 +156,11 @@ Rectangle LayoutPanels (
// and count the different layouts. // and count the different layouts.
sal_Int32 nTotalPreferredHeight (0); sal_Int32 nTotalPreferredHeight (0);
sal_Int32 nTotalMinimumHeight (0); sal_Int32 nTotalMinimumHeight (0);
IterateLayoutItems(iItem,rLayoutItems)
for(::std::vector<LayoutItem>::const_iterator iItem(rLayoutItems.begin()),
iEnd(rLayoutItems.end());
iItem!=iEnd;
++iItem)
{ {
nTotalMinimumHeight += iItem->maLayoutSize.Minimum; nTotalMinimumHeight += iItem->maLayoutSize.Minimum;
nTotalPreferredHeight += iItem->maLayoutSize.Preferred; nTotalPreferredHeight += iItem->maLayoutSize.Preferred;
...@@ -254,7 +251,10 @@ sal_Int32 PlacePanels ( ...@@ -254,7 +251,10 @@ sal_Int32 PlacePanels (
sal_Int32 nY (0); sal_Int32 nY (0);
// Assign heights and places. // Assign heights and places.
IterateLayoutItems(iItem,rLayoutItems) for(::std::vector<LayoutItem>::const_iterator iItem(rLayoutItems.begin()),
iEnd(rLayoutItems.end());
iItem!=iEnd;
++iItem)
{ {
if (!iItem->mpPanel) if (!iItem->mpPanel)
continue; continue;
...@@ -345,7 +345,11 @@ void GetRequestedSizes ( ...@@ -345,7 +345,11 @@ void GetRequestedSizes (
const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight)); const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
IterateLayoutItems(iItem,rLayoutItems) ::std::vector<LayoutItem>::const_iterator iEnd(rLayoutItems.end());
for(::std::vector<LayoutItem>::iterator iItem(rLayoutItems.begin());
iItem!=iEnd;
++iItem)
{ {
ui::LayoutSize aLayoutSize (ui::LayoutSize(0,0,0)); ui::LayoutSize aLayoutSize (ui::LayoutSize(0,0,0));
if (iItem->mpPanel != nullptr) if (iItem->mpPanel != nullptr)
...@@ -402,7 +406,12 @@ void DistributeHeights ( ...@@ -402,7 +406,12 @@ void DistributeHeights (
// (either its minimum or preferred height) and the container height. // (either its minimum or preferred height) and the container height.
sal_Int32 nTotalWeight (0); sal_Int32 nTotalWeight (0);
sal_Int32 nNoMaximumCount (0); sal_Int32 nNoMaximumCount (0);
IterateLayoutItems(iItem,rLayoutItems)
::std::vector<LayoutItem>::const_iterator iEnd(rLayoutItems.end());
for(::std::vector<LayoutItem>::iterator iItem(rLayoutItems.begin());
iItem!=iEnd;
++iItem)
{ {
if (iItem->maLayoutSize.Maximum == 0) if (iItem->maLayoutSize.Maximum == 0)
continue; continue;
...@@ -424,7 +433,9 @@ void DistributeHeights ( ...@@ -424,7 +433,9 @@ void DistributeHeights (
return; return;
// First pass of height distribution. // First pass of height distribution.
IterateLayoutItems(iItem,rLayoutItems) for(::std::vector<LayoutItem>::iterator iItem(rLayoutItems.begin());
iItem!=iEnd;
++iItem)
{ {
const sal_Int32 nBaseHeight ( const sal_Int32 nBaseHeight (
bMinimumHeightIsBase bMinimumHeightIsBase
...@@ -457,7 +468,10 @@ void DistributeHeights ( ...@@ -457,7 +468,10 @@ void DistributeHeights (
// Handle rounding error. // Handle rounding error.
sal_Int32 nAdditionalHeightForFirstPanel (nRemainingHeightToDistribute sal_Int32 nAdditionalHeightForFirstPanel (nRemainingHeightToDistribute
- nNoMaximumCount*nAdditionalHeightPerPanel); - nNoMaximumCount*nAdditionalHeightPerPanel);
IterateLayoutItems(iItem,rLayoutItems)
for(::std::vector<LayoutItem>::iterator iItem(rLayoutItems.begin());
iItem!=iEnd;
++iItem)
{ {
if (iItem->maLayoutSize.Maximum < 0) if (iItem->maLayoutSize.Maximum < 0)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment