diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-19 15:12:54 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-19 16:42:13 +0200 |
commit | e72e79dfa3342482214b37435550e534cfdfc08e (patch) | |
tree | 23868539e5eaaaf7e8afe846c55b3db3d3088019 | |
parent | f56289ac6d7f3da7fd45dd431ce4c540aadcad56 (diff) |
SwXTextDocument::getTextSelection: fix missing non-string content handling
text/html works with this.
Change-Id: I749e0c987a87dbc6700956f564f6846617c393e8
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 1006ef989fcd..8d9d6ae44443 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 9c9f15fac0eb..e2008accf93c 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; } |