summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2019-06-25 12:36:52 -0400
committerMichael Meeks <michael.meeks@collabora.com>2019-07-20 10:56:51 +0100
commitc4e89a07964f2f9d5286d5df8a7adca82c467742 (patch)
tree83504f50c300d4063078f3f694277801138da260
parentb673ee99cbd720cd6135ed2e51c256678aee1b1f (diff)
LOK: detect Graphics in isComplex for Writer
Change-Id: I814d71a21fa5352a9a1051f5477cb452a0dc5c2f
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx2
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx26
2 files changed, 6 insertions, 22 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index b9e3a81ea1f0..43ec7036c3a9 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2680,7 +2680,7 @@ void DesktopLOKTest::testComplexSelection()
free(pText);
// We expect this to be complex.
- // CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_COMPLEX, pDocument->pClass->getSelectionType(pDocument)); // Fails!
+ CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_COMPLEX, pDocument->pClass->getSelectionType(pDocument));
}
namespace {
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 2bc1404075cb..95b8d8b0e4d0 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -430,6 +430,8 @@ sal_Bool SwTransferable::isComplex()
if (m_pWrtShell->IsFrameSelected() || m_pWrtShell->IsObjSelected())
return true;
+ // 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 = new SwDocFac;
SwDoc* const pTmpDoc = lcl_GetDoc(*m_pClpDocFac);
@@ -437,36 +439,18 @@ sal_Bool SwTransferable::isComplex()
.LockExpFields(); // never update fields - leave text as it is
lclOverWriteDoc(*m_pWrtShell, *pTmpDoc);
- // in CORE a new one was created (OLE-objects copied!)
- m_aDocShellRef = pTmpDoc->GetTmpDocShell();
- if (m_aDocShellRef.Is())
- SwTransferable::InitOle(m_aDocShellRef);
- pTmpDoc->SetTmpDocShell(nullptr);
-
- SwPaM aOrigPam(pTmpDoc->GetNodes().GetEndOfContent());
- aOrigPam.Move(fnMoveBackward, GoInDoc);
- aOrigPam.SetMark();
- aOrigPam.Move(fnMoveForward, GoInDoc);
-
- SwPaM aPam(*aOrigPam.End(), *aOrigPam.Start());
-
bool isComplex = false;
- while (aPam.GetPoint()->nNode.GetIndex() < aPam.GetMark()->nNode.GetIndex()
- || (aPam.GetPoint()->nNode.GetIndex() == aPam.GetMark()->nNode.GetIndex()
- && aPam.GetPoint()->nContent.GetIndex() <= aPam.GetMark()->nContent.GetIndex()))
+ SwNodes& aNodes = pTmpDoc->GetNodes();
+ for( sal_uLong nIndex = 0; nIndex < aNodes.Count(); ++nIndex)
{
- SwNode& rNd = aPam.GetNode();
-
+ SwNode& rNd = *aNodes[nIndex];
if (rNd.IsContentNode() && !rNd.IsTextNode())
{
- //FIXME: this doesn't detect GrfNode, which we need to detect complex selections.
isComplex = true;
break;
}
else if (&rNd == &m_pWrtShell->GetDoc()->GetNodes().GetEndOfContent())
break;
-
- ++aPam.GetPoint()->nNode;
}
return isComplex;