Kaydet (Commit) 288d694f authored tarafından Marco Cecchetti's avatar Marco Cecchetti Kaydeden (comit) Jan Holesovsky

LOK - Calc: Text is not visible in cell when entering numerical input

Problem
The issue occurs when you double click and enter a numerical input in
a cell which belongs to one of the front colums.

Findings
After a bit of investigation I detected that the problem shows up when
the spreedsheet width is increased by invoking
ScViewData::SetMaxTiledCol.
Indeed the problem occurs whenever the spreadsheet width is larger
than 2^16 twips.

Solution
By changing the type of some variables from sal_uInt16 to long in all
involved contexts, the problem disappeared.

Change-Id: Ia6c6c258b0644f03c897e7b4bcaded967f21537c
Reviewed-on: https://gerrit.libreoffice.org/34597Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst 91242645
...@@ -478,7 +478,7 @@ public: ...@@ -478,7 +478,7 @@ public:
private: private:
CharPosArrayType aPositions; CharPosArrayType aPositions;
long nTxtWidth; long nTxtWidth;
sal_uInt16 nStartPosX; long nStartPosX;
sal_Int32 nStart; // could be replaced by nStartPortion sal_Int32 nStart; // could be replaced by nStartPortion
sal_Int32 nEnd; // could be replaced by nEndPortion sal_Int32 nEnd; // could be replaced by nEndPortion
sal_Int32 nStartPortion; sal_Int32 nStartPortion;
...@@ -532,7 +532,7 @@ public: ...@@ -532,7 +532,7 @@ public:
sal_Int32 GetLen() const { return nEnd - nStart; } sal_Int32 GetLen() const { return nEnd - nStart; }
sal_uInt16 GetStartPosX() const { return nStartPosX; } long GetStartPosX() const { return nStartPosX; }
void SetStartPosX( long start ); void SetStartPosX( long start );
Size CalcTextSize( ParaPortion& rParaPortion ); Size CalcTextSize( ParaPortion& rParaPortion );
...@@ -592,7 +592,7 @@ private: ...@@ -592,7 +592,7 @@ private:
sal_Int32 nInvalidPosStart; sal_Int32 nInvalidPosStart;
sal_Int32 nFirstLineOffset; // For Writer-LineSpacing-Interpretation sal_Int32 nFirstLineOffset; // For Writer-LineSpacing-Interpretation
sal_uInt16 nBulletX; sal_Int32 nBulletX;
sal_Int32 nInvalidDiff; sal_Int32 nInvalidDiff;
bool bInvalid : 1; bool bInvalid : 1;
...@@ -618,8 +618,8 @@ public: ...@@ -618,8 +618,8 @@ public:
bool MustRepaint() const { return bForceRepaint; } bool MustRepaint() const { return bForceRepaint; }
void SetMustRepaint( bool bRP ) { bForceRepaint = bRP; } void SetMustRepaint( bool bRP ) { bForceRepaint = bRP; }
sal_uInt16 GetBulletX() const { return nBulletX; } sal_Int32 GetBulletX() const { return nBulletX; }
void SetBulletX( sal_uInt16 n ) { nBulletX = n; } void SetBulletX( sal_Int32 n ) { nBulletX = n; }
void MarkInvalid( sal_Int32 nStart, sal_Int32 nDiff); void MarkInvalid( sal_Int32 nStart, sal_Int32 nDiff);
void MarkSelectionInvalid( sal_Int32 nStart, sal_Int32 nEnd ); void MarkSelectionInvalid( sal_Int32 nStart, sal_Int32 nEnd );
......
...@@ -732,7 +732,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) ...@@ -732,7 +732,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
{ {
aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) ); aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) );
if ( aBulletArea.Right() > 0 ) if ( aBulletArea.Right() > 0 )
pParaPortion->SetBulletX( (sal_uInt16) GetXValue( aBulletArea.Right() ) ); pParaPortion->SetBulletX( (sal_Int32) GetXValue( aBulletArea.Right() ) );
else else
pParaPortion->SetBulletX( 0 ); // if Bullet is set incorrectly pParaPortion->SetBulletX( 0 ); // if Bullet is set incorrectly
} }
...@@ -1643,23 +1643,23 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn ...@@ -1643,23 +1643,23 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn
sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth( pParaPortion->GetNode(), &nSpaceBefore ); sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth( pParaPortion->GetNode(), &nSpaceBefore );
const SvxLRSpaceItem& rLRItem = GetLRSpaceItem( pParaPortion->GetNode() ); const SvxLRSpaceItem& rLRItem = GetLRSpaceItem( pParaPortion->GetNode() );
const SvxLineSpacingItem& rLSItem = static_cast<const SvxLineSpacingItem&>(pParaPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL )); const SvxLineSpacingItem& rLSItem = static_cast<const SvxLineSpacingItem&>(pParaPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL ));
short nStartX = GetXValue( (short)(rLRItem.GetTextLeft() + rLRItem.GetTextFirstLineOfst() + nSpaceBefore)); long nStartX = GetXValue( rLRItem.GetTextLeft() + rLRItem.GetTextFirstLineOfst() + nSpaceBefore );
Rectangle aBulletArea = Rectangle( Point(), Point() ); Rectangle aBulletArea = Rectangle( Point(), Point() );
if ( bLineBreak ) if ( bLineBreak )
{ {
nStartX = (short)GetXValue( rLRItem.GetTextLeft() + rLRItem.GetTextFirstLineOfst() + nSpaceBeforeAndMinLabelWidth ); nStartX = GetXValue( rLRItem.GetTextLeft() + rLRItem.GetTextFirstLineOfst() + nSpaceBeforeAndMinLabelWidth );
} }
else else
{ {
aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) ); aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) );
if ( aBulletArea.Right() > 0 ) if ( aBulletArea.Right() > 0 )
pParaPortion->SetBulletX( (sal_uInt16) GetXValue( aBulletArea.Right() ) ); pParaPortion->SetBulletX( (sal_Int32) GetXValue( aBulletArea.Right() ) );
else else
pParaPortion->SetBulletX( 0 ); // If Bullet set incorrectly. pParaPortion->SetBulletX( 0 ); // If Bullet set incorrectly.
if ( pParaPortion->GetBulletX() > nStartX ) if ( pParaPortion->GetBulletX() > nStartX )
{ {
nStartX = (short)GetXValue( rLRItem.GetTextLeft() + rLRItem.GetTextFirstLineOfst() + nSpaceBeforeAndMinLabelWidth ); nStartX = GetXValue( rLRItem.GetTextLeft() + rLRItem.GetTextFirstLineOfst() + nSpaceBeforeAndMinLabelWidth );
if ( pParaPortion->GetBulletX() > nStartX ) if ( pParaPortion->GetBulletX() > nStartX )
nStartX = pParaPortion->GetBulletX(); nStartX = pParaPortion->GetBulletX();
} }
...@@ -1692,11 +1692,11 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn ...@@ -1692,11 +1692,11 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn
if ( nMaxLineWidth < 0 ) if ( nMaxLineWidth < 0 )
nMaxLineWidth = 1; nMaxLineWidth = 1;
if ( eJustification == SVX_ADJUST_CENTER ) if ( eJustification == SVX_ADJUST_CENTER )
nStartX = sal::static_int_cast< short >(nMaxLineWidth / 2); nStartX = nMaxLineWidth / 2;
else if ( eJustification == SVX_ADJUST_RIGHT ) else if ( eJustification == SVX_ADJUST_RIGHT )
nStartX = sal::static_int_cast< short >(nMaxLineWidth); nStartX = nMaxLineWidth;
nStartX = sal::static_int_cast< short >(nStartX + nTextXOffset); nStartX = nStartX + nTextXOffset;
} }
pTmpLine->SetStartPosX( nStartX ); pTmpLine->SetStartPosX( nStartX );
......
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