diff options
-rw-r--r-- | extensions/source/bibliography/bibload.cxx | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 94e35cfa6d1f..58c1b014cc70 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdbc/XRowSet.hpp> +#include <com/sun/star/sdbc/DriverManager.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/frame/XFrameLoader.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -43,6 +44,7 @@ #include <com/sun/star/form/XLoadListener.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/uno/XAggregation.hpp> +#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp> #include <toolkit/awt/vclxwindow.hxx> #include <vcl/window.hxx> #include <vcl/edit.hxx> @@ -239,9 +241,9 @@ namespace { try { - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - Reference< XAggregation > xAggregate = Reference< XAggregation >( xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY); - return xAggregate.is(); + // if we get com::sun::star::sdbc::DriverManager, libsdbc2 is there + // and the bibliography is assumed to work + return com::sun::star::sdbc::DriverManager::create(comphelper::getProcessComponentContext()).is(); } catch(...) { @@ -256,7 +258,25 @@ void BibliographyLoader::load(const Reference< XFrame > & rFrame, const rtl::OUS // lp#527938, debian#602953, fdo#33266, i#105408 // make sure we actually can instanciate services from base first if(!lcl_isBaseAvailable()) + { + try + { + using namespace org::freedesktop::PackageKit; + Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()), UNO_QUERY); + Sequence< ::rtl::OUString > vPackages(1); + vPackages[0] = "libreoffice-base"; + ::rtl::OUString sInteraction(""); + xSyncDbusSessionHelper->InstallPackageNames(0, vPackages, sInteraction); + // FIXME: notify user to restart here + } + catch (Exception & e) + { + SAL_INFO( + "extensions.bibliography", + "trying to install LibreOffice Base, caught " << e.Message); + } return; + } SolarMutexGuard aGuard; |