sd/qa/unit/tiledrendering/tiledrendering.cxx | 3 +++ sd/source/ui/view/viewshel.cxx | 6 ++++++ sw/qa/extras/tiledrendering/tiledrendering.cxx | 3 +++ sw/source/uibase/uno/unotxdoc.cxx | 6 ++++++ 4 files changed, 18 insertions(+)
New commits: commit abd92f37ee5840cc46bf26c4bfabc22ef5457ebe Author: Miklos Vajna <[email protected]> Date: Fri Jun 19 16:14:59 2015 +0200 sd::ViewShell::GetTextSelection: fix text/richtext handling Change-Id: If7d75d48667cd48d9426b02a38d2cf539b248d26 diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 6ec2219..55c4426 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -303,6 +303,9 @@ void SdTiledRenderingTest::testGetTextSelection() rEditView.SetSelection(aWordSelection); // Did we indeed manage to copy the selected text? CPPUNIT_ASSERT_EQUAL(OString("Shape"), pXImpressDocument->getTextSelection("text/plain;charset=utf-8")); + + // Make sure returned RTF is not empty. + CPPUNIT_ASSERT(!OString(pXImpressDocument->getTextSelection("text/richtext")).isEmpty()); } void SdTiledRenderingTest::testSetGraphicSelection() diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index e3b8314..f8c45b5 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -597,6 +597,12 @@ OString ViewShell::GetTextSelection(const OString& _aMimeType) else aRet = OString(reinterpret_cast<const sal_Char *>(aString.getStr()), aString.getLength() * sizeof(sal_Unicode)); } + else + { + uno::Sequence<sal_Int8> aSequence; + aAny >>= aSequence; + aRet = OString(reinterpret_cast<sal_Char*>(aSequence.getArray()), aSequence.getLength()); + } return aRet; } commit e72e79dfa3342482214b37435550e534cfdfc08e Author: Miklos Vajna <[email protected]> Date: Fri Jun 19 15:12:54 2015 +0200 SwXTextDocument::getTextSelection: fix missing non-string content handling text/html works with this. Change-Id: I749e0c987a87dbc6700956f564f6846617c393e8 diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 1006ef9..8d9d6ae 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -233,6 +233,9 @@ void SwTiledRenderingTest::testGetTextSelection() // Make sure that we selected text from the body text. CPPUNIT_ASSERT_EQUAL(OString("Hello"), pXTextDocument->getTextSelection("text/plain;charset=utf-8")); + // Make sure we produce something for HTML. + CPPUNIT_ASSERT(!OString(pXTextDocument->getTextSelection("text/html")).isEmpty()); + // Now select some shape text and check again. SdrPage* pPage = pWrtShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 9c9f15f..e2008ac 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3310,6 +3310,12 @@ OString SwXTextDocument::getTextSelection(const char* pMimeType) else aRet = OString(reinterpret_cast<const sal_Char *>(aString.getStr()), aString.getLength() * sizeof(sal_Unicode)); } + else + { + uno::Sequence<sal_Int8> aSequence; + aAny >>= aSequence; + aRet = OString(reinterpret_cast<sal_Char*>(aSequence.getArray()), aSequence.getLength()); + } return aRet; } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
