diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-04 11:17:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-04 13:28:52 +0200 |
commit | e278df1a14c5cb5dbb7add5d6ed5dd52da131e92 (patch) | |
tree | 10ca8af6f78a576fb9c11ffbeffd02a30e3fb5c6 /include/editeng/outliner.hxx | |
parent | 891e41fac81fbd8d5cdb277b26639abfd25a7143 (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/editeng/outliner.hxx')
-rw-r--r-- | include/editeng/outliner.hxx | 1 |
1 files changed, 1 insertions, 0 deletions
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 ); |