Kaydet (Commit) b8f7ea5d authored tarafından Matúš Kukan's avatar Matúš Kukan

Related bnc#822625: Minimum height was not invalidated when rectangle changes.

5792e76c was too optimistic and did not
invalidate mnCachedMinHeight often enough.
This was resulting in a grey area below table frame when resizing it.

So, revert 5792e76c
"Related bnc#822625: Cache minimum height for table cells."
and istead just use getMinimumWidth() in TableLayouter if that's all we need.
getMinimumHeight() is expensive.

Change-Id: I34c49dda75d6ccccaa5b4d3746114352621a40dd
üst a824b27a
...@@ -359,7 +359,6 @@ Cell::Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) th ...@@ -359,7 +359,6 @@ Cell::Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) th
, mbMerged( false ) , mbMerged( false )
, mnRowSpan( 1 ) , mnRowSpan( 1 )
, mnColSpan( 1 ) , mnColSpan( 1 )
, mnCachedMinHeight( -1 )
, mxTable( rTableObj.getTable() ) , mxTable( rTableObj.getTable() )
{ {
if( rTableObj.GetModel() ) if( rTableObj.GetModel() )
...@@ -526,7 +525,6 @@ void Cell::setMerged() ...@@ -526,7 +525,6 @@ void Cell::setMerged()
void Cell::notifyModified() void Cell::notifyModified()
{ {
mnCachedMinHeight = -1;
if( mxTable.is() ) if( mxTable.is() )
mxTable->setModified( sal_True ); mxTable->setModified( sal_True );
} }
...@@ -683,10 +681,8 @@ sal_Int32 Cell::getMinimumHeight() ...@@ -683,10 +681,8 @@ sal_Int32 Cell::getMinimumHeight()
if( !mpProperties ) if( !mpProperties )
return 0; return 0;
if( mnCachedMinHeight != -1 )
return mnCachedMinHeight;
SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() ); SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
sal_Int32 nMinimumHeight = 0;
Rectangle aTextRect; Rectangle aTextRect;
TakeTextAnchorRect( aTextRect ); TakeTextAnchorRect( aTextRect );
...@@ -697,7 +693,7 @@ sal_Int32 Cell::getMinimumHeight() ...@@ -697,7 +693,7 @@ sal_Int32 Cell::getMinimumHeight()
if(pEditOutliner) if(pEditOutliner)
{ {
pEditOutliner->SetMaxAutoPaperSize(aSize); pEditOutliner->SetMaxAutoPaperSize(aSize);
mnCachedMinHeight = pEditOutliner->GetTextHeight()+1; nMinimumHeight = pEditOutliner->GetTextHeight()+1;
} }
else /*if ( hasText() )*/ else /*if ( hasText() )*/
{ {
...@@ -710,12 +706,12 @@ sal_Int32 Cell::getMinimumHeight() ...@@ -710,12 +706,12 @@ sal_Int32 Cell::getMinimumHeight()
{ {
rOutliner.SetText(*GetOutlinerParaObject()); rOutliner.SetText(*GetOutlinerParaObject());
} }
mnCachedMinHeight=rOutliner.GetTextHeight()+1; nMinimumHeight=rOutliner.GetTextHeight()+1;
rOutliner.Clear(); rOutliner.Clear();
} }
mnCachedMinHeight += GetTextUpperDistance() + GetTextLowerDistance(); nMinimumHeight += GetTextUpperDistance() + GetTextLowerDistance();
return mnCachedMinHeight; return nMinimumHeight;
} }
......
...@@ -226,7 +226,6 @@ private: ...@@ -226,7 +226,6 @@ private:
bool mbMerged; bool mbMerged;
::sal_Int32 mnRowSpan; ::sal_Int32 mnRowSpan;
::sal_Int32 mnColSpan; ::sal_Int32 mnColSpan;
::sal_Int32 mnCachedMinHeight;
Rectangle maCellRect; Rectangle maCellRect;
......
...@@ -554,7 +554,7 @@ void TableLayouter::LayoutTableWidth( Rectangle& rArea, bool bFit ) ...@@ -554,7 +554,7 @@ void TableLayouter::LayoutTableWidth( Rectangle& rArea, bool bFit )
} }
else else
{ {
nMinWidth = std::max( nMinWidth, xCell->getMinimumSize().Width ); nMinWidth = std::max( nMinWidth, xCell->getMinimumWidth() );
} }
} }
} }
...@@ -620,7 +620,7 @@ void TableLayouter::LayoutTableWidth( Rectangle& rArea, bool bFit ) ...@@ -620,7 +620,7 @@ void TableLayouter::LayoutTableWidth( Rectangle& rArea, bool bFit )
while( iter != aMergedCells[nCol].end() ) while( iter != aMergedCells[nCol].end() )
{ {
CellRef xCell( (*iter++) ); CellRef xCell( (*iter++) );
sal_Int32 nMinWidth = xCell->getMinimumSize().Width; sal_Int32 nMinWidth = xCell->getMinimumWidth();
for( sal_Int32 nMCol = nCol - xCell->getColumnSpan() + 1; (nMCol > 0) && (nMCol < nCol); ++nMCol ) for( sal_Int32 nMCol = nCol - xCell->getColumnSpan() + 1; (nMCol > 0) && (nMCol < nCol); ++nMCol )
nMinWidth -= maColumns[nMCol].mnSize; nMinWidth -= maColumns[nMCol].mnSize;
...@@ -704,7 +704,7 @@ void TableLayouter::LayoutTableHeight( Rectangle& rArea, bool bFit ) ...@@ -704,7 +704,7 @@ void TableLayouter::LayoutTableHeight( Rectangle& rArea, bool bFit )
} }
else else
{ {
nMinHeight = std::max( nMinHeight, xCell->getMinimumSize().Height ); nMinHeight = std::max( nMinHeight, xCell->getMinimumHeight() );
} }
} }
} }
...@@ -771,7 +771,7 @@ void TableLayouter::LayoutTableHeight( Rectangle& rArea, bool bFit ) ...@@ -771,7 +771,7 @@ void TableLayouter::LayoutTableHeight( Rectangle& rArea, bool bFit )
while( iter != aMergedCells[nRow].end() ) while( iter != aMergedCells[nRow].end() )
{ {
CellRef xCell( (*iter++) ); CellRef xCell( (*iter++) );
sal_Int32 nMinHeight = xCell->getMinimumSize().Height; sal_Int32 nMinHeight = xCell->getMinimumHeight();
for( sal_Int32 nMRow = nRow - xCell->getRowSpan() + 1; (nMRow > 0) && (nMRow < nRow); ++nMRow ) for( sal_Int32 nMRow = nRow - xCell->getRowSpan() + 1; (nMRow > 0) && (nMRow < nRow); ++nMRow )
nMinHeight -= maRows[nMRow].mnSize; nMinHeight -= maRows[nMRow].mnSize;
......
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