20#include <config_folders.h>
21#include <config_features.h>
23#include <rtl/bootstrap.hxx>
24#include <rtl/ustring.hxx>
34#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
35#include <com/sun/star/ucb/CommandAbortedException.hpp>
36#include <com/sun/star/ucb/CommandFailedException.hpp>
37#include <com/sun/star/ucb/XCommandEnvironment.hpp>
38#include <com/sun/star/beans/XPropertySet.hpp>
39#include <com/sun/star/beans/NamedValue.hpp>
40#include <com/sun/star/configuration/theDefaultProvider.hpp>
41#include <com/sun/star/deployment/DeploymentException.hpp>
42#include <com/sun/star/deployment/XPackage.hpp>
43#include <com/sun/star/deployment/ExtensionManager.hpp>
44#include <com/sun/star/deployment/LicenseException.hpp>
45#include <com/sun/star/deployment/ui/LicenseDialog.hpp>
46#include <com/sun/star/task/OfficeRestartManager.hpp>
47#include <com/sun/star/task/XInteractionApprove.hpp>
48#include <com/sun/star/task/XInteractionAbort.hpp>
49#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
50#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
51#include <com/sun/star/util/XChangesBatch.hpp>
68 :
public ::cppu::WeakImplHelper< ucb::XCommandEnvironment,
69 task::XInteractionHandler,
70 ucb::XProgressHandler >
81 virtual ~SilentCommandEnv()
override;
85 getInteractionHandler()
override;
87 SAL_CALL getProgressHandler()
override;
90 virtual void SAL_CALL handle(
96 virtual void SAL_CALL pop()
override;
100SilentCommandEnv::SilentCommandEnv(
104 mpDesktop( pDesktop ),
110SilentCommandEnv::~SilentCommandEnv()
113 mpDesktop->SetSplashScreenText(OUString());
132 deployment::LicenseException licExc;
134 uno::Any request( xRequest->getRequest() );
135 bool bApprove =
true;
137 if ( request >>= licExc )
142 licExc.ExtensionName, licExc.Text ) );
143 sal_Int16 res = xDialog->execute();
144 if ( res == ui::dialogs::ExecutableDialogResults::CANCEL )
146 else if ( res == ui::dialogs::ExecutableDialogResults::OK )
157 sal_Int32 len = conts.getLength();
159 for ( sal_Int32 pos = 0;
pos < len; ++
pos )
164 if ( xInteractionApprove.is() )
165 xInteractionApprove->select();
170 if ( xInteractionAbort.is() )
171 xInteractionAbort->select();
178void SilentCommandEnv::push(
uno::Any const & rStatus )
183 if (mpDesktop && rStatus.
hasValue() && (rStatus >>= sText))
186 mpDesktop->SetSplashScreenText( sText );
188 mpDesktop->SetSplashScreenProgress( ++mnProgress );
196 if (mpDesktop && rStatus.
hasValue() && (rStatus >>= sText))
198 mpDesktop->SetSplashScreenText( sText );
203void SilentCommandEnv::pop()
211constexpr OUStringLiteral
aAccessSrvc =
u"com.sun.star.configuration.ConfigurationUpdateAccess";
219 if( !xServiceManager.is() )
220 throw uno::RuntimeException(
223 xService = xServiceManager->createInstanceWithContext(
"com.sun.star.deployment.ui.UpdateRequiredDialog",
xContext );
225 if ( xExecutable.is() )
226 nRet = xExecutable->execute();
239 if ( !xExtensionManager.is() )
241 SAL_WARN(
"desktop.app",
"Could not get the Extension Manager!" );
249 catch (
const deployment::DeploymentException & ) {
return true; }
250 catch (
const ucb::CommandFailedException & ) {
return true; }
251 catch (
const ucb::CommandAbortedException & ) {
return true; }
252 catch (
const lang::IllegalArgumentException & e ) {
254 throw css::lang::WrappedTargetRuntimeException( e.Message,
259 sal_Int32
const nMax = 3;
261 sal_Int32
const nMax = 2;
266 for ( sal_Int32 j = 0; (j<nMax) && (j < xPackageList.getLength()); ++j )
271 bool bRegistered =
false;
277 ::beans::Ambiguous< sal_Bool >
const & reg =
option.Value;
278 if ( reg.IsAmbiguous )
281 bRegistered = reg.Value;
286 catch (
const uno::RuntimeException & ) {
throw; }
287 catch (
const uno::Exception & ) {
293 bool bDependenciesValid =
false;
297 catch (
const deployment::DeploymentException & ) {}
298 if ( ! bDependenciesValid )
316 configuration::theDefaultProvider::get(
319 beans::NamedValue
v(
"nodepath",
320 Any( OUString(
"org.openoffice.Setup/Office") ) );
323 theConfigProvider->createInstanceWithArguments(
aAccessSrvc, theArgs ), UNO_QUERY_THROW );
327 pset->setPropertyValue(
"LastCompatibilityCheckID",
value );
339 bool bNeedsCheck =
false;
340 OUString aLastCheckBuildID;
341 OUString aCurrentBuildID(
"${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER
"/" SAL_CONFIGFILE(
"version")
":buildid}" );
342 rtl::Bootstrap::expandMacros( aCurrentBuildID );
346 configuration::theDefaultProvider::get(
349 beans::NamedValue
v(
"nodepath",
350 Any( OUString(
"org.openoffice.Setup/Office") ) );
353 theConfigProvider->createInstanceWithArguments(
aAccessSrvc, theArgs ), UNO_QUERY_THROW );
355 Any result = pset->getPropertyValue(
"LastCompatibilityCheckID");
357 result >>= aLastCheckBuildID;
358 if ( aLastCheckBuildID != aCurrentBuildID )
361 result <<= aCurrentBuildID;
362 pset->setPropertyValue(
"LastCompatibilityCheckID",
result );
369 catch (
const css::uno::Exception&) {}
377bool Desktop::CheckExtensionDependencies()
391 if ( !bDependenciesValid )
408 new SilentCommandEnv(context, pDesktop));
409 if (bCleanedExtensionCache) {
410 deployment::ExtensionManager::get(context)->reinstallDeployedExtensions(
412#if !HAVE_FEATURE_MACOSX_SANDBOX
414 task::OfficeRestartManager::get(context)->requestRestart(
415 silent->getInteractionHandler());
static bool impl_checkDependencies(const uno::Reference< uno::XComponentContext > &xContext)
constexpr OUStringLiteral aAccessSrvc
static void impl_setNeedsCompatCheck()
static bool impl_needsCompatCheck()
static sal_Int16 impl_showExtensionDialog(uno::Reference< uno::XComponentContext > const &xContext)
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
static void SynchronizeExtensionRepositories(bool bCleanedExtensionCache, Desktop *pDesktop=nullptr)
#define SAL_CONFIGFILE(name)
#define TOOLS_WARN_EXCEPTION(area, stream)
static uno::Reference< css::uno::XComponentContext > xContext
#define SAL_WARN(area, stream)
Reference< XComponentContext > getProcessComponentContext()
Any SAL_CALL getCaughtException()
void syncRepositories(bool force, Reference< ucb::XCommandEnvironment > const &xCmdEnv)
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)