summaryrefslogtreecommitdiffstats
path: root/desktop/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-04-28 23:29:49 +0300
committerMiklos Vajna <vmiklos@collabora.com>2019-04-29 09:31:11 +0200
commita5c0cf416faff2a4b273ac526a83c9c2575a5d51 (patch)
tree9b9be11f6524ccdc487593396a35f6d9d9e77b53 /desktop/source
parentAvoid -Werror=format/stringop-truncation (diff)
downloadcore-a5c0cf416faff2a4b273ac526a83c9c2575a5d51.tar.gz
core-a5c0cf416faff2a4b273ac526a83c9c2575a5d51.zip
tdf#120703 PVS: dereference before nullptr check
Use a function to consistently check if gImpl is valid before assigning last exception message. V595 The 'gImpl' pointer was utilized before it was verified against nullptr. Check lines: 2673, 2683. Change-Id: I18fc0d632c84f37b05e9d1c3c83689e6eaa6f66c Reviewed-on: https://gerrit.libreoffice.org/71488 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/lib/init.cxx253
1 files changed, 104 insertions, 149 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 937331376024..497c31b34101 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -163,6 +163,12 @@ static LibLibreOffice_Impl *gImpl = nullptr;
static std::weak_ptr< LibreOfficeKitClass > gOfficeClass;
static std::weak_ptr< LibreOfficeKitDocumentClass > gDocumentClass;
+static void SetLastExceptionMsg(const OUString& s = OUString())
+{
+ if (gImpl)
+ gImpl->maLastExceptionMsg = s;
+}
+
struct ExtensionMap
{
const char *extn;
@@ -1872,8 +1878,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
comphelper::ProfileZone aZone("doc_saveAs");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
@@ -1881,7 +1886,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
OUString aURL(getAbsoluteURL(sUrl));
if (aURL.isEmpty())
{
- gImpl->maLastExceptionMsg = "Filename to save to was not provided.";
+ SetLastExceptionMsg("Filename to save to was not provided.");
SAL_INFO("lok", "URL for save is empty");
return false;
}
@@ -1920,7 +1925,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
}
else
{
- gImpl->maLastExceptionMsg = "input filename without a suffix";
+ SetLastExceptionMsg("input filename without a suffix");
return false;
}
}
@@ -1936,7 +1941,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
}
if (aFilterName.isEmpty())
{
- gImpl->maLastExceptionMsg = "no output filter found for provided suffix";
+ SetLastExceptionMsg("no output filter found for provided suffix");
return false;
}
@@ -2016,7 +2021,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
}
catch (const uno::Exception& exception)
{
- gImpl->maLastExceptionMsg = "exception: " + exception.Message;
+ SetLastExceptionMsg("exception: " + exception.Message);
}
return false;
}
@@ -2024,8 +2029,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
static void doc_iniUnoCommands ()
{
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
OUString sUnoCommands[] =
{
@@ -2173,8 +2177,7 @@ static int doc_getDocumentType (LibreOfficeKitDocument* pThis)
comphelper::ProfileZone aZone("doc_getDocumentType");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
@@ -2200,12 +2203,12 @@ static int doc_getDocumentType (LibreOfficeKitDocument* pThis)
}
else
{
- gImpl->maLastExceptionMsg = "unknown document type";
+ SetLastExceptionMsg("unknown document type");
}
}
catch (const uno::Exception& exception)
{
- gImpl->maLastExceptionMsg = "exception: " + exception.Message;
+ SetLastExceptionMsg("exception: " + exception.Message);
}
return LOK_DOCTYPE_OTHER;
}
@@ -2219,7 +2222,7 @@ static int doc_getParts (LibreOfficeKitDocument* pThis)
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return 0;
}
@@ -2231,13 +2234,12 @@ static int doc_getPart (LibreOfficeKitDocument* pThis)
comphelper::ProfileZone aZone("doc_getPart");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return 0;
}
@@ -2249,13 +2251,12 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart)
comphelper::ProfileZone aZone("doc_setPart");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -2270,7 +2271,7 @@ static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart)
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
@@ -2288,13 +2289,12 @@ static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis)
comphelper::ProfileZone aZone("doc_getPartPageRectangles");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
@@ -2312,13 +2312,12 @@ static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart)
comphelper::ProfileZone aZone("doc_getPartName");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
@@ -2336,13 +2335,12 @@ static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart)
comphelper::ProfileZone aZone("doc_getPartHash");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
@@ -2361,13 +2359,12 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis,
comphelper::ProfileZone aZone("doc_setPartMode");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -2411,8 +2408,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
comphelper::ProfileZone aZone("doc_paintTile");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
SAL_INFO( "lok.tiledrendering", "paintTile: painting [" << nTileWidth << "x" << nTileHeight <<
"]@(" << nTilePosX << ", " << nTilePosY << ") to [" <<
@@ -2421,7 +2417,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -2506,8 +2502,7 @@ static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
const int nTileWidth, const int nTileHeight)
{
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
SAL_INFO( "lok.tiledrendering", "paintTileToCGContext: painting [" << nTileWidth << "x" << nTileHeight <<
"]@(" << nTilePosX << ", " << nTilePosY << ") to [" <<
@@ -2516,7 +2511,7 @@ static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -2546,8 +2541,7 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
comphelper::ProfileZone aZone("doc_paintPartTile");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
SAL_INFO( "lok.tiledrendering", "paintPartTile: painting @ " << nPart << " ["
<< nTileWidth << "x" << nTileHeight << "]@("
@@ -2631,8 +2625,7 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
static int doc_getTileMode(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/)
{
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
return LOK_TILEMODE_BGRA;
}
@@ -2643,8 +2636,7 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
comphelper::ProfileZone aZone("doc_getDocumentSize");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (pDoc)
@@ -2655,7 +2647,7 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
}
else
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
}
}
@@ -2665,8 +2657,7 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
comphelper::ProfileZone aZone("doc_initializeForRendering");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (pDoc)
@@ -2682,8 +2673,7 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis,
void* pData)
{
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
@@ -2737,12 +2727,11 @@ 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();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
OUString aComments = pDoc->getPostIts();
@@ -2752,12 +2741,11 @@ 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();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
OUString aComments = pDoc->getPostItsPos();
@@ -2766,12 +2754,11 @@ static char* getPostItsPos(LibreOfficeKitDocument* pThis)
static char* getRulerState(LibreOfficeKitDocument* pThis)
{
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
OUString state = pDoc->getRulerState();
@@ -2783,13 +2770,12 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar
comphelper::ProfileZone aZone("doc_postKeyEvent");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -2807,7 +2793,7 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsig
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
pWindow = pDoc->getDocWindow();
@@ -2819,7 +2805,7 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsig
if (!pWindow)
{
- gImpl->maLastExceptionMsg = "No window found for window id: " + OUString::number(nWindowId);
+ SetLastExceptionMsg("No window found for window id: " + OUString::number(nWindowId));
return;
}
@@ -2843,13 +2829,12 @@ static void doc_postWindowKeyEvent(LibreOfficeKitDocument* /*pThis*/, unsigned n
comphelper::ProfileZone aZone("doc_postWindowKeyEvent");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
if (!pWindow)
{
- gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
+ SetLastExceptionMsg("Document doesn't support dialog rendering, or window not found.");
return;
}
@@ -2874,8 +2859,7 @@ static size_t doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu
comphelper::ProfileZone aZone("doc_renderShapeSelection");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
LokChartHelper aChartHelper(SfxViewShell::Current());
@@ -2925,8 +2909,7 @@ static size_t doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu
catch (const uno::Exception& exception)
{
css::uno::Any exAny( cppu::getCaughtException() );
- if (gImpl)
- gImpl->maLastExceptionMsg = exception.Message;
+ SetLastExceptionMsg(exception.Message);
SAL_WARN("lok", "Failed to render shape selection: " << exceptionToString(exAny));
}
@@ -2980,8 +2963,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
comphelper::ProfileZone aZone("doc_postUnoCommand");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
SfxObjectShell* pDocSh = SfxObjectShell::Current();
OUString aCommand(pCommand, strlen(pCommand), RTL_TEXTENCODING_UTF8);
@@ -3052,7 +3034,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
if (!bResult)
{
- gImpl->maLastExceptionMsg = "Failed to dispatch the .uno: command";
+ SetLastExceptionMsg("Failed to dispatch the .uno: command");
}
}
@@ -3061,13 +3043,12 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX,
comphelper::ProfileZone aZone("doc_postMouseEvent");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -3079,13 +3060,12 @@ static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned
comphelper::ProfileZone aZone("doc_postWindowMouseEvent");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
if (!pWindow)
{
- gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
+ SetLastExceptionMsg("Document doesn't support dialog rendering, or window not found.");
return;
}
@@ -3119,13 +3099,12 @@ static void doc_postWindowGestureEvent(LibreOfficeKitDocument* /*pThis*/, unsign
comphelper::ProfileZone aZone("doc_postWindowGestureEvent");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
if (!pWindow)
{
- gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
+ SetLastExceptionMsg("Document doesn't support dialog rendering, or window not found.");
return;
}
@@ -3158,13 +3137,12 @@ static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int n
comphelper::ProfileZone aZone("doc_setTextSelection");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -3176,13 +3154,12 @@ static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMi
comphelper::ProfileZone aZone("doc_getTextSelection");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
@@ -3209,13 +3186,12 @@ static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, cons
comphelper::ProfileZone aZone("doc_paste");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return false;
}
@@ -3225,8 +3201,7 @@ static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, cons
pDoc->setClipboard(xClipboard);
if (!pDoc->isMimeTypeSupported())
{
- if (gImpl)
- gImpl->maLastExceptionMsg = "Document doesn't support this mime type";
+ SetLastExceptionMsg("Document doesn't support this mime type");
return false;
}
@@ -3236,7 +3211,7 @@ static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, cons
}));
if (!comphelper::dispatchCommand(".uno:Paste", aPropertyValues))
{
- gImpl->maLastExceptionMsg = "Failed to dispatch the .uno: command";
+ SetLastExceptionMsg("Failed to dispatch the .uno: command");
return false;
}
@@ -3248,13 +3223,12 @@ static void doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, in
comphelper::ProfileZone aZone("doc_setGraphicSelection");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -3266,13 +3240,12 @@ static void doc_resetSelection(LibreOfficeKitDocument* pThis)
comphelper::ProfileZone aZone("doc_resetSelection");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -3622,7 +3595,7 @@ static char* getTrackedChanges(LibreOfficeKitDocument* pThis)
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
OUString aTrackedChanges = pDoc->getTrackedChanges();
@@ -3640,7 +3613,7 @@ static char* getTrackedChangeAuthors(LibreOfficeKitDocument* pThis)
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
OUString aAuthors = pDoc->getTrackedChangeAuthors();
@@ -3652,8 +3625,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
comphelper::ProfileZone aZone("doc_getCommandValues");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
OString aCommand(pCommand);
static const OString aViewRowColumnHeaders(".uno:ViewRowColumnHeaders");
@@ -3705,7 +3677,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
@@ -3764,7 +3736,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return nullptr;
}
@@ -3817,7 +3789,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
}
else
{
- gImpl->maLastExceptionMsg = "Unknown command, no values returned";
+ SetLastExceptionMsg("Unknown command, no values returned");
return nullptr;
}
}
@@ -3828,13 +3800,12 @@ static void doc_setClientZoom(LibreOfficeKitDocument* pThis, int nTilePixelWidth
comphelper::ProfileZone aZone("doc_setClientZoom");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -3846,13 +3817,12 @@ static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int
comphelper::ProfileZone aZone("doc_setClientVisibleArea");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -3865,13 +3835,12 @@ static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, int
comphelper::ProfileZone aZone("doc_setOutlineState");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
- gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
return;
}
@@ -3884,8 +3853,7 @@ static int doc_createViewWithOptions(SAL_UNUSED_PARAMETER LibreOfficeKitDocument
comphelper::ProfileZone aZone("doc_createView");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
OUString aOptions = getUString(pOptions);
const OUString aLanguage = extractParameter(aOptions, "Language");
@@ -3909,8 +3877,7 @@ static void doc_destroyView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis
comphelper::ProfileZone aZone("doc_destroyView");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
SfxLokHelper::destroyView(nId);
}
@@ -3920,8 +3887,7 @@ static void doc_setView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/,
comphelper::ProfileZone aZone("doc_setView");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
SfxLokHelper::setView(nId);
}
@@ -3931,8 +3897,7 @@ static int doc_getView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/)
comphelper::ProfileZone aZone("doc_getView");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
return SfxLokHelper::getView();
}
@@ -3942,8 +3907,7 @@ static int doc_getViewsCount(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThi
comphelper::ProfileZone aZone("doc_getViewsCount");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
return SfxLokHelper::getViewsCount();
}
@@ -3953,8 +3917,7 @@ static bool doc_getViewIds(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*
comphelper::ProfileZone aZone("doc_getViewsIds");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
return SfxLokHelper::getViewIds(pArray, nSize);
}
@@ -3964,8 +3927,7 @@ static void doc_setViewLanguage(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*p
comphelper::ProfileZone aZone("doc_setViewLanguage");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
SfxLokHelper::setViewLanguage(nId, OStringToOUString(language, RTL_TEXTENCODING_UTF8));
}
@@ -3979,8 +3941,7 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh
comphelper::ProfileZone aZone("doc_renderFont");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
OString aSearchedFontName(pFontName);
OUString aText(OStringToOUString(pChar, RTL_TEXTENCODING_UTF8));
@@ -4094,13 +4055,12 @@ static void doc_paintWindowDPI(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKW
comphelper::ProfileZone aZone("doc_paintWindowDPI");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
if (!pWindow)
{
- gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
+ SetLastExceptionMsg("Document doesn't support dialog rendering, or window not found.");
return;
}
@@ -4160,13 +4120,12 @@ static void doc_postWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindo
comphelper::ProfileZone aZone("doc_postWindow");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
if (!pWindow)
{
- gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
+ SetLastExceptionMsg("Document doesn't support dialog rendering, or window not found.");
return;
}
@@ -4199,7 +4158,7 @@ static void doc_postWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindo
Application::PostKeyEvent(VclEventId::WindowKeyInput, pWindow, &aEvent);
}
else
- gImpl->maLastExceptionMsg = "Window command 'paste': wrong parameters.";
+ SetLastExceptionMsg("Window command 'paste': wrong parameters.");
}
}
@@ -4381,8 +4340,7 @@ static void lo_freeError(char* pFree)
static char* lo_getFilterTypes(LibreOfficeKit* pThis)
{
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
LibLibreOffice_Impl* pImpl = static_cast<LibLibreOffice_Impl*>(pThis);
@@ -4423,8 +4381,7 @@ static void lo_setOptionalFeatures(LibreOfficeKit* pThis, unsigned long long con
comphelper::ProfileZone aZone("lo_setOptionalFeatures");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
LibLibreOffice_Impl *const pLib = static_cast<LibLibreOffice_Impl*>(pThis);
pLib->mOptionalFeatures = features;
@@ -4444,8 +4401,7 @@ static void lo_setDocumentPassword(LibreOfficeKit* pThis,
comphelper::ProfileZone aZone("lo_setDocumentPassword");
SolarMutexGuard aGuard;
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
assert(pThis);
assert(pURL);
@@ -4456,8 +4412,7 @@ static void lo_setDocumentPassword(LibreOfficeKit* pThis,
static char* lo_getVersionInfo(SAL_UNUSED_PARAMETER LibreOfficeKit* /*pThis*/)
{
- if (gImpl)
- gImpl->maLastExceptionMsg.clear();
+ SetLastExceptionMsg();
const OUString sVersionStrTemplate(
"{ "
"\"ProductName\": \"%PRODUCTNAME\", "
@@ -4509,7 +4464,7 @@ static bool initialize_uno(const OUString& aAppProgramURL)
if (!xContext.is())
{
- gImpl->maLastExceptionMsg = "XComponentContext could not be created";
+ SetLastExceptionMsg("XComponentContext could not be created");
SAL_INFO("lok", "XComponentContext could not be created");
return false;
}
@@ -4517,7 +4472,7 @@ static bool initialize_uno(const OUString& aAppProgramURL)
xFactory = xContext->getServiceManager();
if (!xFactory.is())
{
- gImpl->maLastExceptionMsg = "XMultiComponentFactory could not be created";
+ SetLastExceptionMsg("XMultiComponentFactory could not be created");
SAL_INFO("lok", "XMultiComponentFactory could not be created");
return false;
}