Keep LibreOfficeKit.hxx compatible with C++03
Change-Id: Ic2f123c9b341dbb421b766c3bba1fc56c1bfb41d
This commit is contained in:
@@ -42,6 +42,8 @@ public:
|
|||||||
bool VisitImplicitCastExpr(CastExpr const * expr);
|
bool VisitImplicitCastExpr(CastExpr const * expr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool isInLokIncludeFile(SourceLocation spellingLocation) const;
|
||||||
|
|
||||||
bool isFromCIncludeFile(SourceLocation spellingLocation) const;
|
bool isFromCIncludeFile(SourceLocation spellingLocation) const;
|
||||||
|
|
||||||
bool isMacroBodyExpansion(SourceLocation location) const;
|
bool isMacroBodyExpansion(SourceLocation location) const;
|
||||||
@@ -134,6 +136,8 @@ bool Nullptr::VisitImplicitCastExpr(CastExpr const * expr) {
|
|||||||
((!compiler.getLangOpts().CPlusPlus
|
((!compiler.getLangOpts().CPlusPlus
|
||||||
|| isInUnoIncludeFile(
|
|| isInUnoIncludeFile(
|
||||||
compiler.getSourceManager().getSpellingLoc(loc))
|
compiler.getSourceManager().getSpellingLoc(loc))
|
||||||
|
|| isInLokIncludeFile(
|
||||||
|
compiler.getSourceManager().getSpellingLoc(loc))
|
||||||
|| isFromCIncludeFile(
|
|| isFromCIncludeFile(
|
||||||
compiler.getSourceManager().getSpellingLoc(loc)))
|
compiler.getSourceManager().getSpellingLoc(loc)))
|
||||||
? "NULL" : "nullptr"));
|
? "NULL" : "nullptr"));
|
||||||
@@ -143,6 +147,11 @@ bool Nullptr::VisitImplicitCastExpr(CastExpr const * expr) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Nullptr::isInLokIncludeFile(SourceLocation spellingLocation) const {
|
||||||
|
return compiler.getSourceManager().getFilename(spellingLocation)
|
||||||
|
.startswith(SRCDIR "/include/LibreOfficeKit/");
|
||||||
|
}
|
||||||
|
|
||||||
bool Nullptr::isFromCIncludeFile(SourceLocation spellingLocation) const {
|
bool Nullptr::isFromCIncludeFile(SourceLocation spellingLocation) const {
|
||||||
return !compat::isInMainFile(compiler.getSourceManager(), spellingLocation)
|
return !compat::isInMainFile(compiler.getSourceManager(), spellingLocation)
|
||||||
&& (StringRef(
|
&& (StringRef(
|
||||||
|
@@ -47,7 +47,7 @@ public:
|
|||||||
* @param pFormat the format to use while exporting, when omitted, then deducted from pURL's extension
|
* @param pFormat the format to use while exporting, when omitted, then deducted from pURL's extension
|
||||||
* @param pFilterOptions options for the export filter, e.g. SkipImages.
|
* @param pFilterOptions options for the export filter, e.g. SkipImages.
|
||||||
*/
|
*/
|
||||||
inline bool saveAs(const char* pUrl, const char* pFormat = nullptr, const char* pFilterOptions = nullptr)
|
inline bool saveAs(const char* pUrl, const char* pFormat = NULL, const char* pFilterOptions = NULL)
|
||||||
{
|
{
|
||||||
return mpDoc->pClass->saveAs(mpDoc, pUrl, pFormat, pFilterOptions) != 0;
|
return mpDoc->pClass->saveAs(mpDoc, pUrl, pFormat, pFilterOptions) != 0;
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ public:
|
|||||||
* @param pCommand uno command to be posted to the document, like ".uno:Bold"
|
* @param pCommand uno command to be posted to the document, like ".uno:Bold"
|
||||||
* @param pArguments arguments of the uno command.
|
* @param pArguments arguments of the uno command.
|
||||||
*/
|
*/
|
||||||
inline void postUnoCommand(const char* pCommand, const char* pArguments = nullptr, bool bNotifyWhenFinished = false)
|
inline void postUnoCommand(const char* pCommand, const char* pArguments = NULL, bool bNotifyWhenFinished = false)
|
||||||
{
|
{
|
||||||
mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments, bNotifyWhenFinished);
|
mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments, bNotifyWhenFinished);
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ public:
|
|||||||
* @param pMimeType suggests the return format, for example text/plain;charset=utf-8.
|
* @param pMimeType suggests the return format, for example text/plain;charset=utf-8.
|
||||||
* @param pUsedMimeType output parameter to inform about the determined format (suggested one or plain text).
|
* @param pUsedMimeType output parameter to inform about the determined format (suggested one or plain text).
|
||||||
*/
|
*/
|
||||||
inline char* getTextSelection(const char* pMimeType, char** pUsedMimeType = nullptr)
|
inline char* getTextSelection(const char* pMimeType, char** pUsedMimeType = NULL)
|
||||||
{
|
{
|
||||||
return mpDoc->pClass->getTextSelection(mpDoc, pMimeType, pUsedMimeType);
|
return mpDoc->pClass->getTextSelection(mpDoc, pMimeType, pUsedMimeType);
|
||||||
}
|
}
|
||||||
@@ -361,17 +361,17 @@ public:
|
|||||||
* @param pUrl the URL of the document to load
|
* @param pUrl the URL of the document to load
|
||||||
* @param pFilterOptions options for the import filter, e.g. SkipImages.
|
* @param pFilterOptions options for the import filter, e.g. SkipImages.
|
||||||
*/
|
*/
|
||||||
inline Document* documentLoad(const char* pUrl, const char* pFilterOptions = nullptr)
|
inline Document* documentLoad(const char* pUrl, const char* pFilterOptions = NULL)
|
||||||
{
|
{
|
||||||
LibreOfficeKitDocument* pDoc = nullptr;
|
LibreOfficeKitDocument* pDoc = NULL;
|
||||||
|
|
||||||
if (LIBREOFFICEKIT_HAS(mpThis, documentLoadWithOptions))
|
if (LIBREOFFICEKIT_HAS(mpThis, documentLoadWithOptions))
|
||||||
pDoc = mpThis->pClass->documentLoadWithOptions(mpThis, pUrl, pFilterOptions);
|
pDoc = mpThis->pClass->documentLoadWithOptions(mpThis, pUrl, pFilterOptions);
|
||||||
else
|
else
|
||||||
pDoc = mpThis->pClass->documentLoad(mpThis, pUrl);
|
pDoc = mpThis->pClass->documentLoad(mpThis, pUrl);
|
||||||
|
|
||||||
if (pDoc == nullptr)
|
if (pDoc == NULL)
|
||||||
return nullptr;
|
return NULL;
|
||||||
|
|
||||||
return new Document(pDoc);
|
return new Document(pDoc);
|
||||||
}
|
}
|
||||||
@@ -405,11 +405,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Factory method to create a lok::Office instance.
|
/// Factory method to create a lok::Office instance.
|
||||||
inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfilePath = nullptr)
|
inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfilePath = NULL)
|
||||||
{
|
{
|
||||||
LibreOfficeKit* pThis = lok_init_2(pInstallPath, pUserProfilePath);
|
LibreOfficeKit* pThis = lok_init_2(pInstallPath, pUserProfilePath);
|
||||||
if (pThis == nullptr || pThis->pClass->nSize == 0)
|
if (pThis == NULL || pThis->pClass->nSize == 0)
|
||||||
return nullptr;
|
return NULL;
|
||||||
return new ::lok::Office(pThis);
|
return new ::lok::Office(pThis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user