bool OAdminDialogInvokation::invokeAdministration()
{ if (!m_xContext.is()) returnfalse;
try
{ // the service name of the administration dialog staticconst char16_t s_sAdministrationServiceName[] = u"com.sun.star.sdb.DatasourceAdministrationDialog"; static constexpr OUStringLiteral s_sDataSourceTypeChangeDialog = u"com.sun.star.sdb.DataSourceTypeChangeDialog";
// the parameters for the call
Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
{
{"ParentWindow", Any(m_pMessageParent->GetXWindow())},
{"Title", Any(compmodule::ModuleRes(RID_STR_ADMINDIALOGTITLE))},
{"InitialSelection", Any(m_xDataSource)}, // the name of the new data source
}));
// create the dialog
Reference< XExecutableDialog > xDialog;
{ // creating the dialog service is potentially expensive (if all the libraries invoked need to be loaded) // so we display a wait cursor
weld::WaitObject aWaitCursor(m_pMessageParent);
Reference<XInterface> x = m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(s_sDataSourceTypeChangeDialog, aArguments, m_xContext);
xDialog.set( x, UNO_QUERY );
// just for a smoother UI: What the dialog does upon execution, is (amongst other things) creating // the DriverManager service // If this context has never been accessed before, this may be expensive (it includes loading of // at least one library). // As this wizard is intended to run on the first office start, it is very likely that the // context needs to be freshly created // Thus, we access the context here (within the WaitCursor), which means the user sees a waitcursor // while his/her office blocks a few seconds...
DriverManager::create( m_xContext );
}
if (xDialog.is())
{ // execute it if (xDialog->execute()) returntrue;
} else
ShowServiceNotAvailableError(m_pMessageParent, s_sAdministrationServiceName, true);
} catch(const Exception&)
{
TOOLS_WARN_EXCEPTION("extensions.abpilot", "caught an exception while executing the dialog!");
} returnfalse;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.