Kaydet (Commit) 29b322ea authored tarafından Kohei Yoshida's avatar Kohei Yoshida

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
üst d6f97891
...@@ -132,10 +132,6 @@ const SCSIZE MAXSUBTOTAL = 3; ...@@ -132,10 +132,6 @@ const SCSIZE MAXSUBTOTAL = 3;
/* standard row height: text + margin - STD_ROWHEIGHT_DIFF */ /* standard row height: text + margin - STD_ROWHEIGHT_DIFF */
#define STD_ROWHEIGHT_DIFF 23 #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 namespace sc
{ {
inline long TwipsToHMM( long nTwips ) { return (nTwips * 127 + 36) / 72; } inline long TwipsToHMM( long nTwips ) { return (nTwips * 127 + 36) / 72; }
......
...@@ -725,10 +725,11 @@ sal_uInt16 ScColumn::GetOptimalColWidth( ...@@ -725,10 +725,11 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16 nFontHeightId ) static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16 nFontHeightId )
{ {
sal_uInt16 nHeight = (sal_uInt16) ((const SvxFontHeightItem&) rPattern.GetItem(nFontHeightId)).GetHeight(); const SvxFontHeightItem& rFontHeight =
const SvxMarginItem* pMargin = (const SvxMarginItem*) &rPattern.GetItem(ATTR_MARGIN); static_cast<const SvxFontHeightItem&>(rPattern.GetItem(nFontHeightId));
nHeight += nHeight / 5;
// for 10pt gives 240 sal_uInt16 nHeight = rFontHeight.GetHeight();
nHeight *= 1.18;
if ( ((const SvxEmphasisMarkItem&)rPattern. if ( ((const SvxEmphasisMarkItem&)rPattern.
GetItem(ATTR_FONT_EMPHASISMARK)).GetEmphasisMark() != EMPHASISMARK_NONE ) GetItem(ATTR_FONT_EMPHASISMARK)).GetEmphasisMark() != EMPHASISMARK_NONE )
...@@ -738,19 +739,16 @@ static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16 ...@@ -738,19 +739,16 @@ static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16
nHeight += nHeight / 4; nHeight += nHeight / 4;
} }
if ( nHeight + 240 > ScGlobal::nDefFontHeight ) const SvxMarginItem& rMargin =
{ static_cast<const SvxMarginItem&>(rPattern.GetItem(ATTR_MARGIN));
nHeight = sal::static_int_cast<sal_uInt16>( nHeight + ScGlobal::nDefFontHeight );
nHeight -= 240;
}
// Standard height: TextHeight + margin - 23 nHeight += rMargin.GetTopMargin() + rMargin.GetBottomMargin();
// -> 257 for Windows
if (nHeight > STD_ROWHEIGHT_DIFF) if (nHeight > STD_ROWHEIGHT_DIFF)
nHeight -= STD_ROWHEIGHT_DIFF; nHeight -= STD_ROWHEIGHT_DIFF;
nHeight += pMargin->GetTopMargin() + pMargin->GetBottomMargin(); if (nHeight < ScGlobal::nStdRowHeight)
nHeight = ScGlobal::nStdRowHeight;
return nHeight; return nHeight;
} }
......
...@@ -50,7 +50,7 @@ XclImpColRowSettings::XclImpColRowSettings( const XclImpRoot& rRoot ) : ...@@ -50,7 +50,7 @@ XclImpColRowSettings::XclImpColRowSettings( const XclImpRoot& rRoot ) :
maHiddenRows(0, MAXROWCOUNT, false), maHiddenRows(0, MAXROWCOUNT, false),
mnLastScRow( -1 ), mnLastScRow( -1 ),
mnDefWidth( STD_COL_WIDTH ), mnDefWidth( STD_COL_WIDTH ),
mnDefHeight( static_cast< sal_uInt16 >( STD_ROW_HEIGHT ) ), mnDefHeight( static_cast< sal_uInt16 >( ScGlobal::nStdRowHeight ) ),
mnDefRowFlags( EXC_DEFROW_DEFAULTFLAGS ), mnDefRowFlags( EXC_DEFROW_DEFAULTFLAGS ),
mbHasStdWidthRec( false ), mbHasStdWidthRec( false ),
mbHasDefHeight( false ), mbHasDefHeight( false ),
...@@ -117,7 +117,7 @@ void XclImpColRowSettings::SetDefHeight( sal_uInt16 nDefHeight, sal_uInt16 nFlag ...@@ -117,7 +117,7 @@ void XclImpColRowSettings::SetDefHeight( sal_uInt16 nDefHeight, sal_uInt16 nFlag
mnDefRowFlags = nFlags; mnDefRowFlags = nFlags;
if( mnDefHeight == 0 ) if( mnDefHeight == 0 )
{ {
mnDefHeight = static_cast< sal_uInt16 >( STD_ROW_HEIGHT ); mnDefHeight = static_cast< sal_uInt16 >( ScGlobal::nStdRowHeight );
::set_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN ); ::set_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN );
} }
mbHasDefHeight = true; mbHasDefHeight = true;
......
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