diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-06-10 11:42:13 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-06-11 13:44:56 +0100 |
commit | a533f986f95560aadb16d6edcff77312d9329e3c (patch) | |
tree | 018bd66378644c6f7fc2c395f51df9357bfb0817 /include/LibreOfficeKit | |
parent | cd76b9996c48fed238314e7e7445fb4395542784 (diff) |
Upgrade LibreOfficeKit C++ API.
Change-Id: If263b8fc748f67a1ed423c0f3f7cd465cf533993
Diffstat (limited to 'include/LibreOfficeKit')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index de8224c4e0b6..c3da4973a83b 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -18,18 +18,20 @@ * b) allow ABI stability - C++ vtables are not good for that. * c) avoid C++ types as part of the API. */ +namespace lok +{ -class LODocument +class Document { private: LibreOfficeKitDocument* mpDoc; public: - inline LODocument(LibreOfficeKitDocument* pDoc) : + inline Document(LibreOfficeKitDocument* pDoc) : mpDoc(pDoc) {} - inline ~LODocument() + inline ~Document() { mpDoc->destroy(mpDoc); } @@ -50,17 +52,17 @@ public: } }; -class LibLibreOffice +class Office { private: LibreOfficeKit* mpThis; public: - inline LibLibreOffice(LibreOfficeKit* pThis) : + inline Office(LibreOfficeKit* pThis) : mpThis(pThis) {} - inline ~LibLibreOffice() + inline ~Office() { mpThis->destroy(mpThis); } @@ -70,12 +72,12 @@ public: return mpThis->initialize(mpThis, pInstallPath); } - inline LODocument* documentLoad(const char* pUrl) + inline Document* documentLoad(const char* pUrl) { LibreOfficeKitDocument* pDoc = mpThis->documentLoad(mpThis, pUrl); if (pDoc == NULL) return NULL; - return new LODocument(pDoc); + return new Document(pDoc); } // return the last error as a string, free me. @@ -85,12 +87,14 @@ public: } }; -inline LibLibreOffice* lo_cpp_init(const char* pInstallPath) +} + +inline ::lok::Office* lo_cpp_init(const char* pInstallPath) { LibreOfficeKit* pThis = lok_init(pInstallPath); if (pThis == NULL || pThis->nSize == 0) return NULL; - return new LibLibreOffice(pThis); + return new ::lok::Office(pThis); } #endif |