diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-01-24 22:05:17 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-01-25 09:08:27 +0100 |
commit | 027abe22f11a8c7dac38697f02d03156bb91a8a1 (patch) | |
tree | 34f8a3bd9e18e59e3adeb25fb63c7194cde4067b /desktop | |
parent | 82dcf015154c3fb00240c5630ae926c74c7f4213 (diff) |
desktop: always clear LOK error message on success
Change-Id: Idefdbd3d9ae19f7cf5889017b111c12620ab08c2
Reviewed-on: https://gerrit.libreoffice.org/48541
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index b3631ba3ade7..338d11221566 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1332,6 +1332,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, SolarMutexGuard aGuard; LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); + pLib->maLastExceptionMsg.clear(); OUString aURL(getAbsoluteURL(pURL)); if (aURL.isEmpty()) @@ -1435,6 +1436,7 @@ static int lo_runMacro(LibreOfficeKit* pThis, const char *pURL) SolarMutexGuard aGuard; LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); + pLib->maLastExceptionMsg.clear(); OUString sURL( pURL, strlen(pURL), RTL_TEXTENCODING_UTF8 ); if (sURL.isEmpty()) @@ -1525,6 +1527,7 @@ static void lo_registerCallback (LibreOfficeKit* pThis, SolarMutexGuard aGuard; LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); + pLib->maLastExceptionMsg.clear(); pLib->mpCallback = pCallback; pLib->mpCallbackData = pData; @@ -1533,6 +1536,8 @@ static void lo_registerCallback (LibreOfficeKit* pThis, static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const char* pFormat, const char* pFilterOptions) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); @@ -1660,6 +1665,8 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha static void doc_iniUnoCommands () { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); OUString sUnoCommands[] = { @@ -1799,6 +1806,8 @@ static void doc_iniUnoCommands () static int doc_getDocumentType (LibreOfficeKitDocument* pThis) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); @@ -1851,6 +1860,8 @@ static int doc_getParts (LibreOfficeKitDocument* pThis) static int doc_getPart (LibreOfficeKitDocument* pThis) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -1865,6 +1876,8 @@ static int doc_getPart (LibreOfficeKitDocument* pThis) static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -1879,6 +1892,8 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart) static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -1898,6 +1913,8 @@ static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis) static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -1917,6 +1934,8 @@ static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart) static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -1937,6 +1956,8 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -1976,6 +1997,8 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, const int nTileWidth, const int nTileHeight) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); SAL_INFO( "lok.tiledrendering", "paintTile: painting [" << nTileWidth << "x" << nTileHeight << "]@(" << nTilePosX << ", " << nTilePosY << ") to [" << @@ -2028,6 +2051,8 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, const int nTileWidth, const int nTileHeight) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); SAL_INFO( "lok.tiledrendering", "paintPartTile: painting @ " << nPart << " [" << nTileWidth << "x" << nTileHeight << "]@(" @@ -2111,6 +2136,8 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, static int doc_getTileMode(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/) { + if (gImpl) + gImpl->maLastExceptionMsg.clear(); return LOK_TILEMODE_BGRA; } @@ -2119,6 +2146,8 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* pThis, long* pHeight) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (pDoc) @@ -2137,6 +2166,8 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis, const char* pArguments) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (pDoc) @@ -2152,6 +2183,8 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, void* pData) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); @@ -2205,6 +2238,8 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, /// Returns the JSON representation of all the comments in the document static char* getPostIts(LibreOfficeKitDocument* pThis) { + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) { @@ -2218,6 +2253,8 @@ static char* getPostIts(LibreOfficeKitDocument* pThis) /// Returns the JSON representation of the positions of all the comments in the document static char* getPostItsPos(LibreOfficeKitDocument* pThis) { + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) { @@ -2230,6 +2267,8 @@ static char* getPostItsPos(LibreOfficeKitDocument* pThis) static char* getRulerState(LibreOfficeKitDocument* pThis) { + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) { @@ -2243,6 +2282,8 @@ static char* getRulerState(LibreOfficeKitDocument* pThis) static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nCharCode, int nKeyCode) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -2256,6 +2297,8 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar static void doc_postWindowKeyEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nCharCode, int nKeyCode) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); if (!pWindow) @@ -2325,6 +2368,8 @@ public: static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); SfxObjectShell* pDocSh = SfxObjectShell::Current(); OUString aCommand(pCommand, strlen(pCommand), RTL_TEXTENCODING_UTF8); @@ -2402,6 +2447,8 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, int nY, int nCount, int nButtons, int nModifier) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -2435,6 +2482,8 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); if (!pWindow) @@ -2471,6 +2520,8 @@ static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -2485,6 +2536,8 @@ static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int n static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMimeType, char** pUsedMimeType) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -2513,6 +2566,8 @@ static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMi static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, const char* pData, size_t nSize) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -2548,6 +2603,8 @@ static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, cons static void doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -2562,6 +2619,8 @@ static void doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, in static void doc_resetSelection(LibreOfficeKitDocument* pThis) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -2941,6 +3000,8 @@ static char* getTrackedChangeAuthors(LibreOfficeKitDocument* pThis) static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); OString aCommand(pCommand); static const OString aViewRowColumnHeaders(".uno:ViewRowColumnHeaders"); @@ -3108,6 +3169,8 @@ static void doc_setClientZoom(LibreOfficeKitDocument* pThis, int nTilePixelWidth int nTileTwipWidth, int nTileTwipHeight) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -3122,6 +3185,8 @@ static void doc_setClientZoom(LibreOfficeKitDocument* pThis, int nTilePixelWidth static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -3137,6 +3202,8 @@ static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -3151,6 +3218,8 @@ static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, int static int doc_createView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); return SfxLokHelper::createView(); } @@ -3158,6 +3227,8 @@ static int doc_createView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/ static void doc_destroyView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, int nId) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); SfxLokHelper::destroyView(nId); } @@ -3165,6 +3236,8 @@ static void doc_destroyView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis static void doc_setView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, int nId) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); SfxLokHelper::setView(nId); } @@ -3172,6 +3245,8 @@ static void doc_setView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, static int doc_getView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); return SfxLokHelper::getView(); } @@ -3179,6 +3254,8 @@ static int doc_getView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/) static int doc_getViewsCount(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); return SfxLokHelper::getViewsCount(); } @@ -3186,6 +3263,8 @@ static int doc_getViewsCount(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThi static bool doc_getViewIds(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, int* pArray, size_t nSize) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); return SfxLokHelper::getViewIds(pArray, nSize); } @@ -3193,6 +3272,8 @@ static bool doc_getViewIds(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis* static void doc_setViewLanguage(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, int nId, const char* language) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); SfxLokHelper::setViewLanguage(nId, OStringToOUString(language, RTL_TEXTENCODING_UTF8)); } @@ -3204,6 +3285,8 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh int* pFontHeight) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); OString aSearchedFontName(pFontName); OUString aText(OStringToOUString(pChar, RTL_TEXTENCODING_UTF8)); @@ -3306,6 +3389,8 @@ static void doc_paintWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWind const int nWidth, const int nHeight) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); if (!pWindow) @@ -3331,6 +3416,8 @@ static void doc_paintWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWind static void doc_postWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nAction) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); if (!pWindow) @@ -3365,6 +3452,8 @@ static void lo_freeError(char* pFree) static char* lo_getFilterTypes(LibreOfficeKit* pThis) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); LibLibreOffice_Impl* pImpl = static_cast<LibLibreOffice_Impl*>(pThis); @@ -3403,6 +3492,8 @@ static char* lo_getFilterTypes(LibreOfficeKit* pThis) static void lo_setOptionalFeatures(LibreOfficeKit* pThis, unsigned long long const features) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); LibLibreOffice_Impl *const pLib = static_cast<LibLibreOffice_Impl*>(pThis); pLib->mOptionalFeatures = features; @@ -3418,6 +3509,8 @@ static void lo_setDocumentPassword(LibreOfficeKit* pThis, const char* pURL, const char* pPassword) { SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); assert(pThis); assert(pURL); @@ -3428,6 +3521,8 @@ static void lo_setDocumentPassword(LibreOfficeKit* pThis, static char* lo_getVersionInfo(SAL_UNUSED_PARAMETER LibreOfficeKit* /*pThis*/) { + if (gImpl) + gImpl->maLastExceptionMsg.clear(); const OUString sVersionStrTemplate( "{ " "\"ProductName\": \"%PRODUCTNAME\", " |