Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
07352f07
Kaydet (Commit)
07352f07
authored
Mar 05, 2013
tarafından
Jack Leigh
Kaydeden (comit)
Michael Meeks
Mar 12, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
liblibo: move to C++ interface.
Change-Id: Ie14a9446abd9524604feddf811d5373a26a30cbd
üst
8887de72
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
46 deletions
+74
-46
Library_libreoffice.mk
desktop/Library_libreoffice.mk
+6
-0
liblibreoffice.hxx
desktop/inc/liblibreoffice.hxx
+13
-21
liblibreoffice_impl.hxx
desktop/inc/liblibreoffice_impl.hxx
+30
-0
init.cxx
desktop/source/lib/init.cxx
+13
-19
shim.cxx
desktop/source/lib/shim.cxx
+8
-4
libtest.cxx
smoketest/libtest.cxx
+4
-2
No files found.
desktop/Library_libreoffice.mk
Dosyayı görüntüle @
07352f07
...
...
@@ -14,6 +14,12 @@ $(eval $(call gb_Library_set_include,libreoffice,\
-I$(SRCDIR)/desktop/inc \
))
$(eval $(call gb_Library_add_libs,libreoffice,\
$(if $(filter $(OS),LINUX), \
-ldl \
) \
))
$(eval $(call gb_Library_use_libraries,libreoffice,\
$(gb_UWINAPI) \
))
...
...
desktop/inc/liblibreoffice.h
→
desktop/inc/liblibreoffice.h
xx
Dosyayı görüntüle @
07352f07
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C
++
; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
...
...
@@ -7,32 +7,24 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
* A simple C API to setup and use libreoffice
*/
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
{
int
errno
;
char
*
message
;
}
LOError
;
#ifndef _LIBLIBREOFFICE_HXX
#define _LIBLIBREOFFICE_HXX
typedef
int
loboolean
;
typedef
struct
_LODocument
LODocument
;
loboolean
lo_initialize
(
const
char
*
install_path
);
class
LibLibreOffice
{
public
:
virtual
loboolean
initialize
(
const
char
*
installPath
)
=
0
;
void
lo_error_free
(
LOError
*
error
)
;
LOError
*
lo_error_new
(
int
errno
,
const
char
*
message
)
;
virtual
LODocument
*
documentLoad
(
const
char
*
url
)
=
0
;
virtual
loboolean
documentSave
(
const
char
*
url
)
=
0
;
LODocument
*
lo_document_load
(
const
char
*
url
,
LOError
**
opt_error
)
;
loboolean
lo_document_save
(
const
char
*
url
,
LOError
**
opt_error
)
;
virtual
~
LibLibreOffice
()
{}
;
}
;
#ifdef __cplusplus
}
/* extern "C" */
#endif
LibLibreOffice
*
lo_init
(
const
char
*
install_path
);
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
desktop/inc/liblibreoffice_impl.hxx
0 → 100644
Dosyayı görüntüle @
07352f07
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _LIBLIBREOFFICE_IMPL_HXX
#define _LIBLIBREOFFICE_IMPL_HXX
#include "liblibreoffice.hxx"
typedef
int
loboolean
;
typedef
struct
_LODocument
LODocument
;
class
LibLibreOffice_Impl
:
public
LibLibreOffice
{
public
:
virtual
loboolean
initialize
(
const
char
*
installPath
);
virtual
LODocument
*
documentLoad
(
const
char
*
url
);
virtual
loboolean
documentSave
(
const
char
*
url
);
virtual
~
LibLibreOffice_Impl
();
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
desktop/source/lib/init.cxx
Dosyayı görüntüle @
07352f07
...
...
@@ -7,9 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <liblibreoffice_impl.hxx>
#include <stdio.h>
#include <liblibreoffice.h>
#include <tools/errinf.hxx>
#include <osl/file.hxx>
#include <rtl/strbuf.hxx>
...
...
@@ -35,25 +36,14 @@ static uno::Reference<css::uno::XComponentContext> xContext;
static
uno
::
Reference
<
css
::
lang
::
XMultiServiceFactory
>
xSFactory
;
static
uno
::
Reference
<
css
::
lang
::
XMultiComponentFactory
>
xFactory
;
SAL_DLLPUBLIC_EXPORT
void
lo_error_free
(
LOError
*
)
{
}
SAL_DLLPUBLIC_EXPORT
LOError
*
lo_error_new
(
int
,
const
char
*
)
LODocument
*
LibLibreOffice_Impl
::
documentLoad
(
const
char
*
docUrl
)
{
return
NULL
;
}
SAL_DLLPUBLIC_EXPORT
LODocument
*
lo_document_load
(
const
char
*
,
LOError
**
)
{
return
NULL
;
}
SAL_DLLPUBLIC_EXPORT
loboolean
lo_document_save
(
const
char
*
,
LOError
**
)
loboolean
LibLibreOffice_Impl
::
documentSave
(
const
char
*
)
{
return
1
;
}
...
...
@@ -92,8 +82,8 @@ initialize_uno( const rtl::OUString &aUserProfileURL )
xSFactory
=
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
(
xFactory
,
uno
::
UNO_QUERY_THROW
);
}
SAL_DLLPUBLIC_EXPORT
loboolean
lo_
initialize
(
const
char
*
app_path
)
loboolean
LibLibreOffice_Impl
::
initialize
(
const
char
*
app_path
)
{
static
bool
bInitialized
=
false
;
if
(
bInitialized
)
...
...
@@ -132,7 +122,11 @@ extern "C" {
LibLibreOffice
*
liblibreoffice_hook
(
void
)
{
return
new
LibLibreOffice
();
return
new
LibLibreOffice_Impl
();
}
LibLibreOffice_Impl
::~
LibLibreOffice_Impl
()
{
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...
...
desktop/source/lib/shim.cxx
Dosyayı görüntüle @
07352f07
...
...
@@ -9,8 +9,12 @@
#ifdef LINUX
#include <stdio.h>
#include <string.h>
#include <osl/module.h>
#include <sal/types.h>
#include <liblibreoffice.h>
#include <liblibreoffice.h
xx
>
#include <dlfcn.h>
#ifdef AIX
...
...
@@ -23,11 +27,11 @@ extern "C" {
typedef
LibLibreOffice
*
(
HookFunction
)(
void
);
};
extern
LibLibreOffice
*
lo_init
(
const
char
*
install_path
)
SAL_DLLPUBLIC_EXPORT
LibLibreOffice
*
lo_init
(
const
char
*
install_path
)
{
if
(
!
install_path
)
return
NULL
;
char
*
imp
l_lib
=
malloc
(
strlen
(
install_path
)
+
sizeof
(
TARGET_LIB
)
+
2
);
char
*
imp
_lib
=
(
char
*
)
malloc
(
strlen
(
install_path
)
+
sizeof
(
TARGET_LIB
)
+
2
);
strcpy
(
imp_lib
,
install_path
);
strcat
(
imp_lib
,
"/"
);
strcat
(
imp_lib
,
TARGET_LIB
);
...
...
@@ -39,7 +43,7 @@ extern LibLibreOffice *lo_init( const char *install_path )
}
free
(
imp_lib
);
HookFunction
*
pSym
=
dlsym
(
dlhandle
,
"liblibreoffice_hook"
);
HookFunction
*
pSym
=
(
HookFunction
*
)
dlsym
(
dlhandle
,
"liblibreoffice_hook"
);
if
(
!
pSym
)
{
fprintf
(
stderr
,
"failed to find hook in library '%s'
\n
"
,
imp_lib
);
return
NULL
;
...
...
smoketest/libtest.cxx
Dosyayı görüntüle @
07352f07
...
...
@@ -8,7 +8,9 @@
*/
// yuck / FIXME ...
#include "../desktop/inc/liblibreoffice.h"
#include "../desktop/inc/liblibreoffice.hxx"
#include <assert.h>
#include <sal/types.h>
#include <rtl/ustring.hxx>
...
...
@@ -44,7 +46,7 @@ void Test::test()
rtl
::
Bootstrap
::
get
(
rtl
::
OUString
(
"arg-soffice"
),
aArgSoffice
);
OString
aInstall
=
OUStringToOString
(
aArgSoffice
,
RTL_TEXTENCODING_UTF8
);
fprintf
(
stderr
,
"liblibreoffice test: '%s'
\n
"
,
aInstall
.
getStr
()
);
lo_initialize
(
aInstall
.
getStr
()
);
assert
(
lo_init
(
aInstall
.
getStr
()
)
);
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment