summaryrefslogtreecommitdiff
path: root/svx/source/table/cell.cxx
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-05-27 10:39:45 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-05-29 05:01:55 -0500
commit894594c1ff0323f537270d1ca2dec33cdbb9b19c (patch)
tree7b53e4e44d54ae487f0252fb5473cbaae694ab5e /svx/source/table/cell.cxx
parentf799e27baa914c220a7aa86702d1061258016a96 (diff)
Related bnc#822625: Cache minimum height for table cells.
Change-Id: I35e295347a046376289f5d4fd5468860d0b8f0ae (cherry picked from commit 5792e76cb5beb630c135f57b74f57d74dd2dc2b0) Reviewed-on: https://gerrit.libreoffice.org/9519 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/table/cell.cxx')
-rw-r--r--svx/source/table/cell.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index d4f199bf07e6..7e04db74f313 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -358,6 +358,7 @@ Cell::Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) th
, mbMerged( sal_False )
, mnRowSpan( 1 )
, mnColSpan( 1 )
+, mnCachedMinHeight( -1 )
, mxTable( rTableObj.getTable() )
{
if( rTableObj.GetModel() )
@@ -524,6 +525,7 @@ void Cell::setMerged()
void Cell::notifyModified()
{
+ mnCachedMinHeight = -1;
if( mxTable.is() )
mxTable->setModified( sal_True );
}
@@ -680,8 +682,10 @@ sal_Int32 Cell::getMinimumHeight()
if( !mpProperties )
return 0;
+ if( mnCachedMinHeight != -1 )
+ return mnCachedMinHeight;
+
SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
- sal_Int32 nMinimumHeight = 0;
Rectangle aTextRect;
TakeTextAnchorRect( aTextRect );
@@ -692,7 +696,7 @@ sal_Int32 Cell::getMinimumHeight()
if(pEditOutliner)
{
pEditOutliner->SetMaxAutoPaperSize(aSize);
- nMinimumHeight = pEditOutliner->GetTextHeight()+1;
+ mnCachedMinHeight = pEditOutliner->GetTextHeight()+1;
}
else /*if ( hasText() )*/
{
@@ -705,12 +709,12 @@ sal_Int32 Cell::getMinimumHeight()
{
rOutliner.SetText(*GetOutlinerParaObject());
}
- nMinimumHeight=rOutliner.GetTextHeight()+1;
+ mnCachedMinHeight=rOutliner.GetTextHeight()+1;
rOutliner.Clear();
}
- nMinimumHeight += GetTextUpperDistance() + GetTextLowerDistance();
- return nMinimumHeight;
+ mnCachedMinHeight += GetTextUpperDistance() + GetTextLowerDistance();
+ return mnCachedMinHeight;
}
// -----------------------------------------------------------------------------