summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-04 11:17:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-04 13:28:52 +0200
commite278df1a14c5cb5dbb7add5d6ed5dd52da131e92 (patch)
tree10ca8af6f78a576fb9c11ffbeffd02a30e3fb5c6 /include
parent891e41fac81fbd8d5cdb277b26639abfd25a7143 (diff)
tdf#108608 Draw file unresponsive on large text pasted into textbox
We have O(n^2) algorithm here. The stack trace looks like: ImpEditEngine::CalcTextWidth EditEngine::CalcTextWidth Outliner::CalcTextSize SvxOutlinerForwarder::GetParaBounds SvxAccessibleTextAdapter::GetParaBounds accessibility::AccessibleEditableTextPara::getBounds ... OutlinerView::PasteSpecial where AccessibleEditableTextPara::getBounds iterates over all paragraphs, and so does ImpEditEngine::CalcTextWidth. To solve this, push the logic down from SvxOutlinerForwarder::GetParaBounds, to new logic in EditEngine and ImpEditEngine, where we can optimise the width calculation. Note that this means that the width returned for a specific paragraph is no longer the maximum width of all paragraphs, lets hope that does not cause regressions. Change-Id: I9f879d9a67b16a4aec08915328c99961b7313c2f Reviewed-on: https://gerrit.libreoffice.org/52369 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/editeng/editeng.hxx1
-rw-r--r--include/editeng/outliner.hxx1
2 files changed, 2 insertions, 0 deletions
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 44663abcc28b..ee4eb7baeb31 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -286,6 +286,7 @@ public:
void GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const;
sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const;
sal_uInt32 GetLineHeight( sal_Int32 nParagraph );
+ tools::Rectangle GetParaBounds( sal_Int32 nPara );
ParagraphInfos GetParagraphInfos( sal_Int32 nPara );
sal_Int32 FindParagraph( long nDocPosY );
EPosition FindDocPosition( const Point& rDocPos ) const;
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 5ef2a56ac05c..ee856b9e6b35 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -931,6 +931,7 @@ public:
sal_uLong GetTextHeight() const;
sal_uLong GetTextHeight( sal_Int32 nParagraph ) const;
+ tools::Rectangle GetParaBounds( sal_Int32 nParagraph ) const;
Point GetDocPosTopLeft( sal_Int32 nParagraph );
Point GetDocPos( const Point& rPaperPos ) const;
bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder );