diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2009-12-28 18:09:06 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2009-12-28 18:09:06 -0500 |
commit | 90c372a96486e1a778368b0631f4979057f9ed56 (patch) | |
tree | 55928f10264e4438c37af201b0a70ca2b9b70abb | |
parent | 5d8e4b358b520cdf680d28f79155d4b33ad4cf6e (diff) |
Get xls inport directory via envvar, handle disposed exception on terminate.
-rw-r--r-- | inc/global.hxx | 2 | ||||
-rw-r--r-- | source/global.cxx | 8 | ||||
-rw-r--r-- | source/main.cxx | 19 |
3 files changed, 28 insertions, 1 deletions
diff --git a/inc/global.hxx b/inc/global.hxx index cd421d3..6b38895 100644 --- a/inc/global.hxx +++ b/inc/global.hxx @@ -9,6 +9,8 @@ namespace test { ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > bootstrap(); +void info(const char* msg); + } #endif diff --git a/source/global.cxx b/source/global.cxx index d1d0847..f41c81b 100644 --- a/source/global.cxx +++ b/source/global.cxx @@ -8,6 +8,7 @@ #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <cstring> +#include <iostream> using ::com::sun::star::frame::XDesktop; using ::com::sun::star::sheet::XSpreadsheetDocument; @@ -17,6 +18,8 @@ using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::Reference; using ::rtl::OUString; +using namespace ::std; + namespace test { OUString ascii(const sal_Char* str) @@ -36,4 +39,9 @@ Reference<XDesktop> bootstrap() return xDesktop; } +void info(const char* msg) +{ + cout << "info: " << msg << endl; +} + } diff --git a/source/main.cxx b/source/main.cxx index ddc9900..d400167 100644 --- a/source/main.cxx +++ b/source/main.cxx @@ -1,14 +1,31 @@ #include "global.hxx" #include <iostream> +#include <cstdlib> + +#include <com/sun/star/lang/DisposedException.hpp> using ::com::sun::star::uno::Reference; using ::com::sun::star::frame::XDesktop; +using ::com::sun::star::lang::DisposedException; using namespace std; int main() { cout << "test program begins" << endl; + char* pXlsInDir = getenv("CTRL_XLS_IN_DIR"); + if (!pXlsInDir) + return EXIT_FAILURE; + + cout << "control xls inport directory: " << pXlsInDir << endl; + Reference<XDesktop> xDesktop = ::test::bootstrap(); - xDesktop->terminate(); + try + { + xDesktop->terminate(); + } + catch (const DisposedException&) + { + ::test::info("terminate has been called, but the desktop instance has already been disposed of."); + } } |