summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-12-17 21:14:21 +0000
committerMichael Meeks <michael.meeks@suse.com>2012-12-17 21:24:39 +0000
commit70ba2b40541adcea848ad40b19674d62e9cbbc37 (patch)
tree1dd772ec473361a27da0e55cc989dd228b32a460
parent51ecd2f55d608f853852335808b643f61b9a844e (diff)
fdo#53525 - Revert "writer:crash(i118878) when adding
columns and chang. properties in a frame" This reverts commit de1c42d9f552bc57b28d50f4313bc982c63b84d4.
-rw-r--r--sw/source/core/layout/colfrm.cxx46
1 files changed, 19 insertions, 27 deletions
diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx
index a47258bb61b2..654657a26f62 100644
--- a/sw/source/core/layout/colfrm.cxx
+++ b/sw/source/core/layout/colfrm.cxx
@@ -340,26 +340,20 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, sal_Bool bAdjustAttribut
const sal_Bool bLine = pAttr->GetLineAdj() != COLADJ_NONE;
const sal_uInt16 nMin = bLine ? sal_uInt16( 20 + ( pAttr->GetLineWidth() / 2) ) : 0;
+ const sal_Bool bR2L = IsRightToLeft();
+ SwFrm *pCol = bR2L ? GetLastLower() : Lower();
+
// #i27399#
// bOrtho means we have to adjust the column frames manually. Otherwise
// we may use the values returned by CalcColWidth:
const sal_Bool bOrtho = pAttr->IsOrtho() && pAttr->GetNumCols() > 0;
long nGutter = 0;
- sal_uInt16 real_nb_col = 0;
-
- SwFrm* pColHead = Lower();;
- SwFrm* pColTail;
- for ( pColTail = pColHead; pColTail; pColTail = pColTail->GetNext(), real_nb_col += 1 );
-
- sal_uInt16 i = IsRightToLeft() ? real_nb_col : 0;
- for ( SwFrm* pColCursor = IsRightToLeft() ? pColTail : pColHead;
- pColCursor;
- (pColCursor = IsRightToLeft() ? pColCursor->GetPrev() : pColCursor->GetNext()), (i += IsRightToLeft() ? -1 : +1) )
+ for ( sal_uInt16 i = 0; i < pAttr->GetNumCols(); ++i )
{
if( !bOrtho )
{
- const SwTwips nWidth = (pColCursor == (IsRightToLeft() ? pColTail : pColHead) ) ?
+ const SwTwips nWidth = i == (pAttr->GetNumCols() - 1) ?
nAvail :
pAttr->CalcColWidth( i, sal_uInt16( (Prt().*fnRect->fnGetWidth)() ) );
@@ -367,14 +361,14 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, sal_Bool bAdjustAttribut
Size( Prt().Width(), nWidth ) :
Size( nWidth, Prt().Height() );
- pColCursor->ChgSize( aColSz );
+ pCol->ChgSize( aColSz );
// With this, the ColumnBodyFrms from page columns gets adjusted and
// their bFixHeight flag is set so they won't shrink/grow.
// Don't use the flag with frame columns because BodyFrms in frame
// columns can grow/shrink.
if( IsBodyFrm() )
- ((SwLayoutFrm*)pColCursor)->Lower()->ChgSize( aColSz );
+ ((SwLayoutFrm*)pCol)->Lower()->ChgSize( aColSz );
nAvail -= nWidth;
}
@@ -382,7 +376,7 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, sal_Bool bAdjustAttribut
if ( bOrtho || bAdjustAttributes )
{
const SwColumn *pC = &pAttr->GetColumns()[i];
- const SwAttrSet* pSet = pColCursor->GetAttrSet();
+ const SwAttrSet* pSet = pCol->GetAttrSet();
SvxLRSpaceItem aLR( pSet->GetLRSpace() );
//In order to have enough space for the separation lines, we have to
@@ -418,44 +412,42 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, sal_Bool bAdjustAttribut
aUL.SetUpper( pC->GetUpper());
aUL.SetLower( pC->GetLower());
- ((SwLayoutFrm*)pColCursor)->GetFmt()->SetFmtAttr( aLR );
- ((SwLayoutFrm*)pColCursor)->GetFmt()->SetFmtAttr( aUL );
+ ((SwLayoutFrm*)pCol)->GetFmt()->SetFmtAttr( aLR );
+ ((SwLayoutFrm*)pCol)->GetFmt()->SetFmtAttr( aUL );
}
nGutter += aLR.GetLeft() + aLR.GetRight();
}
+
+ pCol = bR2L ? pCol->GetPrev() : pCol->GetNext();
}
if( bOrtho )
{
long nInnerWidth = ( nAvail - nGutter ) / pAttr->GetNumCols();
- i = 0;
- for (SwFrm* pColCursor = pColHead; pColCursor; pColCursor = pColCursor->GetNext(), i++)
+ pCol = Lower();
+ for( sal_uInt16 i = 0; i < pAttr->GetNumCols(); pCol = pCol->GetNext(), ++i )
{
SwTwips nWidth;
if ( i == pAttr->GetNumCols() - 1 )
- {
nWidth = nAvail;
- }
else
{
- SvxLRSpaceItem aLR( pColCursor->GetAttrSet()->GetLRSpace() );
+ SvxLRSpaceItem aLR( pCol->GetAttrSet()->GetLRSpace() );
nWidth = nInnerWidth + aLR.GetLeft() + aLR.GetRight();
}
if( nWidth < 0 )
- {
nWidth = 0;
- }
+
const Size aColSz = bVert ?
Size( Prt().Width(), nWidth ) :
Size( nWidth, Prt().Height() );
- pColCursor->ChgSize( aColSz );
+ pCol->ChgSize( aColSz );
if( IsBodyFrm() )
- {
- ((SwLayoutFrm*)pColCursor)->Lower()->ChgSize( aColSz );
- }
+ ((SwLayoutFrm*)pCol)->Lower()->ChgSize( aColSz );
+
nAvail -= nWidth;
}
}