summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-04-06 12:05:13 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-04-08 13:15:55 +0200
commite50699e6b85781a6dfdede703bb6012466fc4b93 (patch)
tree8bd5751d51e39d23db8cbfee87ff2522082c4d8f /desktop
parent4aec6c9e3c0f51a6c2476295117d10cd5151d7b2 (diff)
liblo: clean-up liblibreoffice.h(xx)
Change-Id: I596fc3afde94e095ecf97c23617158f3d49afcc1
Diffstat (limited to 'desktop')
-rw-r--r--desktop/inc/liblibreoffice.h26
-rw-r--r--desktop/inc/liblibreoffice.hxx57
2 files changed, 52 insertions, 31 deletions
diff --git a/desktop/inc/liblibreoffice.h b/desktop/inc/liblibreoffice.h
index db3b8358a9af..37920ceb8ddc 100644
--- a/desktop/inc/liblibreoffice.h
+++ b/desktop/inc/liblibreoffice.h
@@ -11,32 +11,34 @@
#define INCLUDED_DESKTOP_INC_LIBLIBREOFFICE_H
#ifdef __cplusplus
- extern "C" {
+extern "C"
+{
#endif
typedef struct _LibreOffice LibreOffice;
typedef struct _LibreOfficeDocument LibreOfficeDocument;
-struct _LibreOffice {
+struct _LibreOffice
+{
int nSize;
void (*destroy) (LibreOffice *pThis);
- int (*initialize) (LibreOffice *pThis,
- const char *pInstallPath);
- LibreOfficeDocument *(*documentLoad) (LibreOffice *pThis,
- const char *pURL);
- char * (*getError) (LibreOffice *pThis);
+ int (*initialize) (LibreOffice *pThis, const char *pInstallPath);
+ LibreOfficeDocument* (*documentLoad) (LibreOffice *pThis, const char *pURL);
+ char* (*getError) (LibreOffice *pThis);
};
-struct _LibreOfficeDocument {
+struct _LibreOfficeDocument
+{
int nSize;
- void (*destroy) (LibreOfficeDocument *pThis);
- int (*saveAs) (LibreOfficeDocument *pThis,
- const char *pUrl, const char *pFormat);
+ void (*destroy) (LibreOfficeDocument* pThis);
+ int (*saveAs) (LibreOfficeDocument* pThis,
+ const char *pUrl,
+ const char *pFormat);
};
-LibreOffice *lo_init (const char *install_path);
+LibreOffice* lo_init (const char* pInstallPath);
#ifdef __cplusplus
}
diff --git a/desktop/inc/liblibreoffice.hxx b/desktop/inc/liblibreoffice.hxx
index 9cac41b26bac..9076992da073 100644
--- a/desktop/inc/liblibreoffice.hxx
+++ b/desktop/inc/liblibreoffice.hxx
@@ -21,48 +21,67 @@
class LODocument
{
- LibreOfficeDocument *mpDoc;
+private:
+ LibreOfficeDocument* mpDoc;
+
public:
- inline LODocument( LibreOfficeDocument *pDoc ) : mpDoc( pDoc ) {}
- inline ~LODocument() { mpDoc->destroy( mpDoc ); }
+ inline LODocument(LibreOfficeDocument* pDoc) :
+ mpDoc(pDoc)
+ {}
+
+ inline ~LODocument()
+ {
+ mpDoc->destroy(mpDoc);
+ }
// Save as the given format, if format is NULL sniff from ext'n
- inline bool saveAs( const char *url, const char *format = NULL )
+ inline bool saveAs(const char* pUrl, const char* pFormat = NULL)
{
- return mpDoc->saveAs( mpDoc, url, format );
+ return mpDoc->saveAs(mpDoc, pUrl, pFormat);
}
};
class LibLibreOffice
{
- LibreOffice *mpThis;
+private:
+ LibreOffice* mpThis;
+
public:
- inline LibLibreOffice( LibreOffice *pThis ) : mpThis( pThis ) {}
- inline ~LibLibreOffice() { mpThis->destroy( mpThis ); };
+ inline LibLibreOffice(LibreOffice* pThis) :
+ mpThis(pThis)
+ {}
- inline bool initialize( const char *installPath )
+ inline ~LibLibreOffice()
{
- return mpThis->initialize( mpThis, installPath );
+ mpThis->destroy(mpThis);
}
- inline LODocument *documentLoad( const char *url )
+ inline bool initialize(const char* pInstallPath)
{
- LibreOfficeDocument *pDoc = mpThis->documentLoad( mpThis, url );
- if( !pDoc )
+ return mpThis->initialize(mpThis, pInstallPath);
+ }
+
+ inline LODocument* documentLoad(const char* pUrl)
+ {
+ LibreOfficeDocument* pDoc = mpThis->documentLoad(mpThis, pUrl);
+ if (pDoc == NULL)
return NULL;
- return new LODocument( pDoc );
+ return new LODocument(pDoc);
}
// return the last error as a string, free me.
- inline char *getError() { return mpThis->getError( mpThis ); }
+ inline char* getError()
+ {
+ return mpThis->getError(mpThis);
+ }
};
-inline LibLibreOffice *lo_cpp_init( const char *install_path )
+inline LibLibreOffice* lo_cpp_init(const char* pInstallPath)
{
- LibreOffice *pThis = lo_init( install_path );
- if( !pThis || pThis->nSize == 0 )
+ LibreOffice* pThis = lo_init(pInstallPath);
+ if (pThis == NULL || pThis->nSize == 0)
return NULL;
- return new LibLibreOffice( pThis );
+ return new LibLibreOffice(pThis);
}
#endif