Kaydet (Commit) 101a8f0f authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: fdo#65546 sort PACK_END into visual order for tabbing

and then reverse them for layout packing

Change-Id: I417bb3f6667ddc10103623867fea1a9b8061f5eb
üst 593a298d
......@@ -1720,13 +1720,15 @@ bool VclBuilder::sortIntoBestTabTraversalOrder::operator()(const Window *pA, con
if (bPackA > bPackB)
return false;
}
//honour relative box positions with pack group
bPackA = m_pBuilder->get_window_packing_data(pA).m_nPosition;
bPackB = m_pBuilder->get_window_packing_data(pB).m_nPosition;
if (bPackA < bPackB)
return true;
if (bPackA > bPackB)
return false;
//honour relative box positions with pack group, (numerical order is reversed
//for VCL_PACK_END, they are packed from the end back, but here we need
//them in visual layout order so that tabbing works as expected)
sal_Int32 nPackA = m_pBuilder->get_window_packing_data(pA).m_nPosition;
sal_Int32 nPackB = m_pBuilder->get_window_packing_data(pB).m_nPosition;
if (nPackA < nPackB)
return ePackA == VCL_PACK_START ? true : false;
if (nPackA > nPackB)
return ePackA == VCL_PACK_START ? false : true;
//sort labels of Frames before body
if (pA->GetParent() == pB->GetParent())
{
......
......@@ -222,6 +222,22 @@ void VclBox::setAllocation(const Size &rAllocation)
nExtraSpace = (getPrimaryDimension(rAllocation) - getPrimaryDimension(aRequisition)) / nExpandChildren;
}
//Split into those we pack from the start onwards, and those we pack from the end backwards
std::vector<Window*> aWindows[2];
for (Window *pChild = GetWindow(WINDOW_FIRSTCHILD); pChild; pChild = pChild->GetWindow(WINDOW_NEXT))
{
if (!pChild->IsVisible())
continue;
sal_Int32 ePacking = pChild->get_pack_type();
aWindows[ePacking].push_back(pChild);
}
//See VclBuilder::sortIntoBestTabTraversalOrder for why they are in visual
//order under the parent which requires us to reverse them here to
//pack from the end back
std::reverse(aWindows[VCL_PACK_END].begin(),aWindows[VCL_PACK_END].end());
for (sal_Int32 ePackType = VCL_PACK_START; ePackType <= VCL_PACK_END; ++ePackType)
{
Point aPos(0, 0);
......@@ -231,15 +247,9 @@ void VclBox::setAllocation(const Size &rAllocation)
setPrimaryCoordinate(aPos, nPrimaryCoordinate + nAllocPrimaryDimension);
}
for (Window *pChild = GetWindow(WINDOW_FIRSTCHILD); pChild; pChild = pChild->GetWindow(WINDOW_NEXT))
for (std::vector<Window*>::iterator aI = aWindows[ePackType].begin(), aEnd = aWindows[ePackType].end(); aI != aEnd; ++aI)
{
if (!pChild->IsVisible())
continue;
sal_Int32 ePacking = pChild->get_pack_type();
if (ePacking != ePackType)
continue;
Window *pChild = *aI;
long nPadding = pChild->get_padding();
......
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