sw/qa/extras/uiwriter/data/tdf95699.odt |binary sw/qa/extras/uiwriter/uiwriter.cxx | 20 ++++++++++++++++ sw/source/core/doc/DocumentContentOperationsManager.cxx | 6 +++- 3 files changed, 24 insertions(+), 2 deletions(-)
New commits: commit 79e518039504496aa8ce1c6b2b36ede88de0fe1c Author: Mike Kaganski <[email protected]> Date: Fri Nov 18 11:17:40 2016 +0300 tdf#95699: allow copy FORMCHECKBOX and FORMDROPDOWN ... ... when they are selected alone (no adjacent text selected). Unit test included. Change-Id: Ia278ae2ea86a3e6d83e1a628880f770f1eb11cd7 Reviewed-on: https://gerrit.libreoffice.org/30954 Tested-by: Jenkins <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit de524d2051abd700f93da4e0e9f273504b12515a) diff --git a/sw/qa/extras/uiwriter/data/tdf95699.odt b/sw/qa/extras/uiwriter/data/tdf95699.odt new file mode 100644 index 0000000..79cf858 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf95699.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 531d15e..1a37476 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -198,6 +198,7 @@ public: void testRedlineTimestamp(); void testCursorWindows(); void testLandscape(); + void testTdf95699(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -297,6 +298,7 @@ public: CPPUNIT_TEST(testRedlineTimestamp); CPPUNIT_TEST(testCursorWindows); CPPUNIT_TEST(testLandscape); + CPPUNIT_TEST(testTdf95699); CPPUNIT_TEST_SUITE_END(); private: @@ -3464,6 +3466,24 @@ void SwUiWriterTest::testLandscape() CPPUNIT_ASSERT(pWrtShell->GetPageDesc(nPageDesc).GetLandscape()); } +void SwUiWriterTest::testTdf95699() +{ + // Open the document with single FORMCHECKBOX field, select all and copy to clipboard + // then check that clipboard contains the FORMCHECKBOX in text body. + // Previously that failed. + SwDoc* pDoc = createDoc("tdf95699.odt"); + IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); + SwDoc aClipboard; + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + pWrtShell->SelAll(); + pWrtShell->Copy(&aClipboard); + pMarkAccess = aClipboard.getIDocumentMarkAccess(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); + ::sw::mark::IFieldmark* pFieldMark = pMarkAccess->getFieldmarkAfter(SwPosition(pDoc->GetNodes().GetEndOfExtras())); + CPPUNIT_ASSERT_EQUAL(OUString("vnd.oasis.opendocument.field.FORMCHECKBOX"), pFieldMark->GetFieldname()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 7aa3bdf..33533cf 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -233,14 +233,16 @@ namespace const SwPosition& rMarkStart = pMark->GetMarkStart(); const SwPosition& rMarkEnd = pMark->GetMarkEnd(); // only include marks that are in the range and not touching both start and end - // - not for annotation marks. + // - not for annotation or checkbox marks. const bool bIsNotOnBoundary = pMark->IsExpanded() ? (rMarkStart != rStt || rMarkEnd != rEnd) // rMarkStart != rMarkEnd : (rMarkStart != rStt && rMarkEnd != rEnd); // rMarkStart == rMarkEnd + const IDocumentMarkAccess::MarkType aMarkType = IDocumentMarkAccess::GetType(*pMark); if ( rMarkStart >= rStt && rMarkEnd <= rEnd && ( bIsNotOnBoundary - || IDocumentMarkAccess::GetType( *pMark ) == IDocumentMarkAccess::MarkType::ANNOTATIONMARK ) ) + || aMarkType == IDocumentMarkAccess::MarkType::ANNOTATIONMARK + || aMarkType == IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK ) ) { vMarksToCopy.push_back(pMark); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
