summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-05-27 10:39:45 +0200
committerMatúš Kukan <matus.kukan@collabora.com>2014-05-27 19:38:23 +0200
commit5792e76cb5beb630c135f57b74f57d74dd2dc2b0 (patch)
treeb5063e00e8d02a642d3a994263d8cf94f0e8037c /svx/source
parentf68eed1518fe689fe8a535bebc8d2b6c9f257b9c (diff)
Related bnc#822625: Cache minimum height for table cells.
Change-Id: I35e295347a046376289f5d4fd5468860d0b8f0ae
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/table/cell.cxx14
-rw-r--r--svx/source/table/cell.hxx1
2 files changed, 10 insertions, 5 deletions
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index d26d70cb1dd6..20d676dd8077 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -359,6 +359,7 @@ Cell::Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) th
, mbMerged( false )
, mnRowSpan( 1 )
, mnColSpan( 1 )
+, mnCachedMinHeight( -1 )
, mxTable( rTableObj.getTable() )
{
if( rTableObj.GetModel() )
@@ -525,6 +526,7 @@ void Cell::setMerged()
void Cell::notifyModified()
{
+ mnCachedMinHeight = -1;
if( mxTable.is() )
mxTable->setModified( sal_True );
}
@@ -681,8 +683,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 );
@@ -693,7 +697,7 @@ sal_Int32 Cell::getMinimumHeight()
if(pEditOutliner)
{
pEditOutliner->SetMaxAutoPaperSize(aSize);
- nMinimumHeight = pEditOutliner->GetTextHeight()+1;
+ mnCachedMinHeight = pEditOutliner->GetTextHeight()+1;
}
else /*if ( hasText() )*/
{
@@ -706,12 +710,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;
}
diff --git a/svx/source/table/cell.hxx b/svx/source/table/cell.hxx
index 82d717d849e8..d5d7eb001875 100644
--- a/svx/source/table/cell.hxx
+++ b/svx/source/table/cell.hxx
@@ -226,6 +226,7 @@ private:
bool mbMerged;
::sal_Int32 mnRowSpan;
::sal_Int32 mnColSpan;
+ ::sal_Int32 mnCachedMinHeight;
Rectangle maCellRect;