Kaydet (Commit) 3cc52de5 authored tarafından Caolán McNamara's avatar Caolán McNamara

return early on no-op cases, no logic change

Change-Id: I7041ac2268d1df8b37e380ccde926d5aec06510e
üst 876e63e6
...@@ -210,15 +210,18 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr ...@@ -210,15 +210,18 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr
const bool bSecond, const bool bEnabled) const bool bSecond, const bool bEnabled)
{ {
SwPageExample::DrawPage(rRenderContext, rOrg, bSecond, bEnabled); SwPageExample::DrawPage(rRenderContext, rOrg, bSecond, bEnabled);
sal_uInt16 nColumnCount; if (!pColMgr)
if (pColMgr && 0 != (nColumnCount = pColMgr->GetCount())) return;
{ sal_uInt16 nColumnCount = pColMgr->GetCount();
if (!nColumnCount)
return;
long nL = GetLeft(); long nL = GetLeft();
long nR = GetRight(); long nR = GetRight();
if (GetUsage() == SVX_PAGE_MIRROR && !bSecond) if (GetUsage() == SVX_PAGE_MIRROR && !bSecond)
{ {
// rotate for mirrored // swap for mirrored
nL = GetRight(); nL = GetRight();
nR = GetLeft(); nR = GetLeft();
} }
...@@ -254,14 +257,12 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr ...@@ -254,14 +257,12 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr
if (bAutoWidth) if (bAutoWidth)
{ {
sal_Int32 nColumnWidthSum = 0; sal_Int32 nColumnWidthSum = 0;
sal_uInt16 i; for (sal_uInt16 i = 0; i < nColumnCount; ++i)
for (i = 0; i < nColumnCount; ++i)
nColumnWidthSum += pColMgr->GetColWidth( i ); nColumnWidthSum += pColMgr->GetColWidth( i );
nAutoColWidth = nColumnWidthSum / nColumnCount; nAutoColWidth = nColumnWidthSum / nColumnCount;
} }
sal_uInt16 i; for (sal_uInt16 i = 0; i < nColumnCount; ++i)
for (i = 0; i < nColumnCount; i++)
{ {
if (!bAutoWidth) if (!bAutoWidth)
nAutoColWidth = pColMgr->GetColWidth(i); nAutoColWidth = pColMgr->GetColWidth(i);
...@@ -295,7 +296,7 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr ...@@ -295,7 +296,7 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr
} }
} }
for (i = 0; i < nColumnCount - 1; i++) for (sal_uInt16 i = 0; i < nColumnCount - 1; ++i)
{ {
int nGutter = pColMgr->GetGutterWidth(i); int nGutter = pColMgr->GetGutterWidth(i);
int nDist = pColMgr->GetColWidth( i ) + nGutter; int nDist = pColMgr->GetColWidth( i ) + nGutter;
...@@ -305,7 +306,6 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr ...@@ -305,7 +306,6 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr
rRenderContext.DrawLine(aUp, aDown); rRenderContext.DrawLine(aUp, aDown);
} }
} }
}
} }
VCL_BUILDER_FACTORY(SwColExample) VCL_BUILDER_FACTORY(SwColExample)
......
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