Kaydet (Commit) e72e79df authored tarafından Miklos Vajna's avatar Miklos Vajna

SwXTextDocument::getTextSelection: fix missing non-string content handling

text/html works with this.

Change-Id: I749e0c987a87dbc6700956f564f6846617c393e8
üst f56289ac
...@@ -233,6 +233,9 @@ void SwTiledRenderingTest::testGetTextSelection() ...@@ -233,6 +233,9 @@ void SwTiledRenderingTest::testGetTextSelection()
// Make sure that we selected text from the body text. // Make sure that we selected text from the body text.
CPPUNIT_ASSERT_EQUAL(OString("Hello"), pXTextDocument->getTextSelection("text/plain;charset=utf-8")); 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. // Now select some shape text and check again.
SdrPage* pPage = pWrtShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrPage* pPage = pWrtShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
SdrObject* pObject = pPage->GetObj(0); SdrObject* pObject = pPage->GetObj(0);
......
...@@ -3310,6 +3310,12 @@ OString SwXTextDocument::getTextSelection(const char* pMimeType) ...@@ -3310,6 +3310,12 @@ OString SwXTextDocument::getTextSelection(const char* pMimeType)
else else
aRet = OString(reinterpret_cast<const sal_Char *>(aString.getStr()), aString.getLength() * sizeof(sal_Unicode)); 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; return aRet;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment