Keep the standard row height situation under control.
With this change, applying cell attributes to default cells will no longer change the row heights inadvertently. Change-Id: I57c3546e1725c5e8b37696242e9642b1617f59c3
This commit is contained in:
@@ -132,10 +132,6 @@ const SCSIZE MAXSUBTOTAL = 3;
|
||||
/* standard row height: text + margin - STD_ROWHEIGHT_DIFF */
|
||||
#define STD_ROWHEIGHT_DIFF 23
|
||||
|
||||
/// use ScGlobal::nStdRowHeight instead of STD_ROW_HEIGHT !
|
||||
|
||||
#define STD_ROW_HEIGHT (12.8 * TWIPS_PER_POINT) /* 256 Twips, 0.45 cm */
|
||||
|
||||
namespace sc
|
||||
{
|
||||
inline long TwipsToHMM( long nTwips ) { return (nTwips * 127 + 36) / 72; }
|
||||
|
@@ -725,10 +725,11 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
|
||||
|
||||
static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16 nFontHeightId )
|
||||
{
|
||||
sal_uInt16 nHeight = (sal_uInt16) ((const SvxFontHeightItem&) rPattern.GetItem(nFontHeightId)).GetHeight();
|
||||
const SvxMarginItem* pMargin = (const SvxMarginItem*) &rPattern.GetItem(ATTR_MARGIN);
|
||||
nHeight += nHeight / 5;
|
||||
// for 10pt gives 240
|
||||
const SvxFontHeightItem& rFontHeight =
|
||||
static_cast<const SvxFontHeightItem&>(rPattern.GetItem(nFontHeightId));
|
||||
|
||||
sal_uInt16 nHeight = rFontHeight.GetHeight();
|
||||
nHeight *= 1.18;
|
||||
|
||||
if ( ((const SvxEmphasisMarkItem&)rPattern.
|
||||
GetItem(ATTR_FONT_EMPHASISMARK)).GetEmphasisMark() != EMPHASISMARK_NONE )
|
||||
@@ -738,19 +739,16 @@ static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16
|
||||
nHeight += nHeight / 4;
|
||||
}
|
||||
|
||||
if ( nHeight + 240 > ScGlobal::nDefFontHeight )
|
||||
{
|
||||
nHeight = sal::static_int_cast<sal_uInt16>( nHeight + ScGlobal::nDefFontHeight );
|
||||
nHeight -= 240;
|
||||
}
|
||||
const SvxMarginItem& rMargin =
|
||||
static_cast<const SvxMarginItem&>(rPattern.GetItem(ATTR_MARGIN));
|
||||
|
||||
// Standard height: TextHeight + margin - 23
|
||||
// -> 257 for Windows
|
||||
nHeight += rMargin.GetTopMargin() + rMargin.GetBottomMargin();
|
||||
|
||||
if (nHeight > STD_ROWHEIGHT_DIFF)
|
||||
nHeight -= STD_ROWHEIGHT_DIFF;
|
||||
|
||||
nHeight += pMargin->GetTopMargin() + pMargin->GetBottomMargin();
|
||||
if (nHeight < ScGlobal::nStdRowHeight)
|
||||
nHeight = ScGlobal::nStdRowHeight;
|
||||
|
||||
return nHeight;
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ XclImpColRowSettings::XclImpColRowSettings( const XclImpRoot& rRoot ) :
|
||||
maHiddenRows(0, MAXROWCOUNT, false),
|
||||
mnLastScRow( -1 ),
|
||||
mnDefWidth( STD_COL_WIDTH ),
|
||||
mnDefHeight( static_cast< sal_uInt16 >( STD_ROW_HEIGHT ) ),
|
||||
mnDefHeight( static_cast< sal_uInt16 >( ScGlobal::nStdRowHeight ) ),
|
||||
mnDefRowFlags( EXC_DEFROW_DEFAULTFLAGS ),
|
||||
mbHasStdWidthRec( false ),
|
||||
mbHasDefHeight( false ),
|
||||
@@ -117,7 +117,7 @@ void XclImpColRowSettings::SetDefHeight( sal_uInt16 nDefHeight, sal_uInt16 nFlag
|
||||
mnDefRowFlags = nFlags;
|
||||
if( mnDefHeight == 0 )
|
||||
{
|
||||
mnDefHeight = static_cast< sal_uInt16 >( STD_ROW_HEIGHT );
|
||||
mnDefHeight = static_cast< sal_uInt16 >( ScGlobal::nStdRowHeight );
|
||||
::set_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN );
|
||||
}
|
||||
mbHasDefHeight = true;
|
||||
|
Reference in New Issue
Block a user