diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-06-18 21:39:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-20 21:25:11 +0200 |
commit | cb95276e6e6bf12a1c06d5c252551e55c788fcb2 (patch) | |
tree | 9e54d9ddbd03f02f508af48ce8dce02d5c83a277 /desktop | |
parent | 292d9519bd368db69920cf0f8b94e0e51c3d14a1 (diff) |
use JsonWriter for the rest of ITiledRenderable
and fix bug in buffer reallacotion where mPos pointing
at the beginning of the new buffer instead of at the
correct index inside it.
Change-Id: Ie1ffaa176f6165e2cec85c93adc945312eff38e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96650
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 4 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 32 |
2 files changed, 21 insertions, 15 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8a651ab764da..8e02686f7f57 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -818,11 +818,13 @@ void DesktopLOKTest::testHiddenRowHeaders() boost::property_tree::ptree aTree; char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, aPayload.str().c_str()); + SAL_WARN("desktop", "xxxxxxx " << pJSON); std::stringstream aStream(pJSON); - free(pJSON); + SAL_WARN("desktop", aStream.str()); CPPUNIT_ASSERT(!aStream.str().empty()); boost::property_tree::read_json(aStream, aTree); + free(pJSON); sal_Int32 nPrevious = 0; sal_Int32 nIndex = 0; for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 357111d220af..a9202a0c90b5 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3303,8 +3303,9 @@ static char* getPostIts(LibreOfficeKitDocument* pThis) SetLastExceptionMsg("Document doesn't support tiled rendering"); return nullptr; } - OUString aComments = pDoc->getPostIts(); - return strdup(aComments.toUtf8().getStr()); + tools::JsonWriter aJsonWriter; + pDoc->getPostIts(aJsonWriter); + return aJsonWriter.extractData(); } /// Returns the JSON representation of the positions of all the comments in the document @@ -3317,8 +3318,9 @@ static char* getPostItsPos(LibreOfficeKitDocument* pThis) SetLastExceptionMsg("Document doesn't support tiled rendering"); return nullptr; } - OUString aComments = pDoc->getPostItsPos(); - return strdup(aComments.toUtf8().getStr()); + tools::JsonWriter aJsonWriter; + pDoc->getPostItsPos(aJsonWriter); + return aJsonWriter.extractData(); } static char* getRulerState(LibreOfficeKitDocument* pThis) @@ -3330,8 +3332,9 @@ static char* getRulerState(LibreOfficeKitDocument* pThis) SetLastExceptionMsg("Document doesn't support tiled rendering"); return nullptr; } - OUString state = pDoc->getRulerState(); - return strdup(state.toUtf8().getStr()); + tools::JsonWriter aJsonWriter; + pDoc->getRulerState(aJsonWriter); + return aJsonWriter.extractData(); } static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nCharCode, int nKeyCode) @@ -4781,8 +4784,9 @@ static char* getTrackedChangeAuthors(LibreOfficeKitDocument* pThis) SetLastExceptionMsg("Document doesn't support tiled rendering"); return nullptr; } - OUString aAuthors = pDoc->getTrackedChangeAuthors(); - return strdup(aAuthors.toUtf8().getStr()); + tools::JsonWriter aJsonWriter; + pDoc->getTrackedChangeAuthors(aJsonWriter); + return aJsonWriter.extractData(); } static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand) @@ -4885,11 +4889,9 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo aRectangle = tools::Rectangle(nX, nY, nX + nWidth, nY + nHeight); } - OUString aHeaders = pDoc->getRowColumnHeaders(aRectangle); - if (aHeaders.isEmpty()) - return nullptr; - else - return convertOUString(aHeaders); + tools::JsonWriter aJsonWriter; + pDoc->getRowColumnHeaders(aRectangle, aJsonWriter); + return aJsonWriter.extractData(); } else if (aCommand.startsWith(aCellCursor)) { @@ -4900,7 +4902,9 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo return nullptr; } // Ignore command's deprecated parameters. - return convertOString(pDoc->getCellCursor()); + tools::JsonWriter aJsonWriter; + pDoc->getCellCursor(aJsonWriter); + return aJsonWriter.extractData(); } else if (aCommand.startsWith(aFontSubset)) { |