summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx48
1 files changed, 25 insertions, 23 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 1e0e01acbc59..43271806c411 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -119,6 +119,7 @@
#include <iodetect.hxx>
#include <unotextrange.hxx>
#include <unoframe.hxx>
+#include <txatbase.hxx>
#include <vcl/uitest/logger.hxx>
#include <vcl/uitest/eventdescription.hxx>
@@ -426,33 +427,34 @@ namespace
sal_Bool SAL_CALL SwTransferable::isComplex()
{
- // Copy into a new Doc so we don't mess with the existing one.
- //FIXME: We *should* be able to avoid this and improve the performance.
- m_pClpDocFac.reset(new SwDocFac);
- SwDoc& rTmpDoc = lcl_GetDoc(*m_pClpDocFac);
-
- rTmpDoc.getIDocumentFieldsAccess()
- .LockExpFields(); // never update fields - leave text as it is
- lclOverWriteDoc(*m_pWrtShell, rTmpDoc);
-
sal_Int32 nTextLength = 0;
- const SwNode* pEndOfContent = &m_pWrtShell->GetDoc()->GetNodes().GetEndOfContent();
- SwNodes& aNodes = rTmpDoc.GetNodes();
- for( sal_uLong nIndex = 0; nIndex < aNodes.Count(); ++nIndex)
+ SwNodes& aNodes = m_pWrtShell->GetDoc()->GetNodes();
+ for (SwPaM& rPaM : m_pWrtShell->GetCursor()->GetRingContainer())
{
- SwNode& rNd = *aNodes[nIndex];
- if (&rNd == pEndOfContent)
- break;
+ for (sal_uLong nIndex = rPaM.GetMark()->nNode.GetIndex();
+ nIndex <= rPaM.GetPoint()->nNode.GetIndex(); ++nIndex)
+ {
+ SwNode& rNd = *aNodes[nIndex];
- if (rNd.IsOLENode() || rNd.IsGrfNode())
- return true; // Complex
+ SwTextNode* pTextNode = rNd.GetTextNode();
+ if (pTextNode)
+ {
+ if (pTextNode->HasHints())
+ {
+ for (size_t nHint = 0; pTextNode->GetSwpHints().Count(); ++nHint)
+ {
+ SwTextAttr* pHint = pTextNode->GetSwpHints().Get(nHint);
+ if (pHint->Which() == RES_TXTATR_FLYCNT)
+ {
+ return true; // Complex
+ }
+ }
+ }
- SwTextNode* pTextNode = rNd.GetTextNode();
- if (pTextNode)
- {
- nTextLength += pTextNode->GetText().getLength();
- if (nTextLength >= 1024 * 512)
- return true; // Complex
+ nTextLength += pTextNode->GetText().getLength();
+ if (nTextLength >= 1024 * 512)
+ return true; // Complex
+ }
}
}