Kaydet (Commit) 064ae986 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat Kaydeden (comit) Cédric Bosdonnat

n#779627: fixed the collapse empty cell paragraphs compat option

This option didn't work if the paragraph to collapse had an alignment or
spacing defined. This fix was needed to properly import docx/doc files

Change-Id: I6b3522905714fe3def7d87cd82cca84746310793
üst 355d25ea
......@@ -307,6 +307,8 @@ sal_Bool SwTxtFrm::FormatEmpty()
{
OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::FormatEmpty with swapped frame" );
bool bCollapse = EmptyHeight( ) == 1 && this->IsCollapse( );
if ( HasFollow() || GetTxtNode()->GetpSwpHints() ||
0 != GetTxtNode()->GetNumRule() ||
GetTxtNode()->HasHiddenCharAttribute( true ) ||
......@@ -314,14 +316,14 @@ sal_Bool SwTxtFrm::FormatEmpty()
return sal_False;
const SwAttrSet& aSet = GetTxtNode()->GetSwAttrSet();
const SvxAdjust nAdjust = aSet.GetAdjust().GetAdjust();
if( ( ( ! IsRightToLeft() && ( SVX_ADJUST_LEFT != nAdjust ) ) ||
if( !bCollapse && ( ( ( ! IsRightToLeft() && ( SVX_ADJUST_LEFT != nAdjust ) ) ||
( IsRightToLeft() && ( SVX_ADJUST_RIGHT != nAdjust ) ) ) ||
aSet.GetRegister().GetValue() )
aSet.GetRegister().GetValue() ) )
return sal_False;
const SvxLineSpacingItem &rSpacing = aSet.GetLineSpacing();
if( SVX_LINE_SPACE_MIN == rSpacing.GetLineSpaceRule() ||
if( !bCollapse && ( SVX_LINE_SPACE_MIN == rSpacing.GetLineSpaceRule() ||
SVX_LINE_SPACE_FIX == rSpacing.GetLineSpaceRule() ||
aSet.GetLRSpace().IsAutoFirst() )
aSet.GetLRSpace().IsAutoFirst() ) )
return sal_False;
else
{
......
......@@ -2058,7 +2058,7 @@ KSHORT SwTxtFrm::GetParHeight() const
KSHORT nRet = (KSHORT)Prt().SSize().Height();
if( IsUndersized() )
{
if( IsEmpty() )
if( IsEmpty() || GetTxt().Len() == 0 )
nRet = (KSHORT)EmptyHeight();
else
++nRet;
......@@ -2323,13 +2323,10 @@ void SwTxtFrm::_CalcHeightOfLastLine( const bool _bUseFont )
else
{
bool bCalcHeightOfLastLine = true;
if ( !HasPara() )
if ( ( !HasPara() && IsEmpty( ) ) || GetTxt().Len( ) == 0 )
{
if ( IsEmpty() )
{
mnHeightOfLastLine = EmptyHeight();
bCalcHeightOfLastLine = false;
}
mnHeightOfLastLine = EmptyHeight();
bCalcHeightOfLastLine = false;
}
if ( bCalcHeightOfLastLine )
......
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