[Libreoffice-commits] core.git: sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 30 08:46:07 UTC 2019
sw/source/core/edit/autofmt.cxx | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
New commits:
commit 2d5598d0c33930626fc47cf6387a4add25af84fc
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Aug 29 15:17:58 2019 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Aug 30 10:45:20 2019 +0200
SwAutoFormat::HasObjects() could be faster
Change-Id: I928401382ca986fb75de3689b9ef5e08474e2b85
Reviewed-on: https://gerrit.libreoffice.org/78278
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index c2fbfef86d82..40c4eec825aa 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -139,7 +139,7 @@ class SwAutoFormat
void SetColl( sal_uInt16 nId, bool bHdLineOrText = false );
void GoNextPara();
- bool HasObjects(const SwTextFrame &);
+ static bool HasObjects(const SwTextFrame &);
// TextNode methods
const SwTextFrame * GetNextNode(bool isCheckEnd = true) const;
@@ -349,20 +349,18 @@ bool SwAutoFormat::HasObjects(const SwTextFrame & rFrame)
{
// Is there something bound to the paragraph in the paragraph
// like Frames, DrawObjects, ...
- bool bRet = false;
- const SwFrameFormats& rFormats = *m_pDoc->GetSpzFrameFormats();
- for( auto pFrameFormat : rFormats )
+ SwNodeIndex node(*rFrame.GetTextNodeFirst());
+ do
{
- const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
- if ((RndStdIds::FLY_AT_PAGE != rAnchor.GetAnchorId()) &&
- rAnchor.GetContentAnchor() &&
- sw::FrameContainsNode(rFrame, rAnchor.GetContentAnchor()->nNode.GetIndex()))
+ if (node.GetNode().GetAnchoredFlys() != nullptr)
{
- bRet = true;
- break;
+ assert(!node.GetNode().GetAnchoredFlys()->empty());
+ return true;
}
+ ++node;
}
- return bRet;
+ while (sw::FrameContainsNode(rFrame, node.GetIndex()));
+ return false;
}
const SwTextFrame* SwAutoFormat::GetNextNode(bool const isCheckEnd) const
More information about the Libreoffice-commits
mailing list