diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 831e56b78c..084edf8bf2 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -101,12 +101,12 @@ public function register(IRegistrationContext $context): void { } public function boot(IBootContext $context): void { - $context->injectFn(function (ITemplateManager $templateManager, IL10N $l10n, IConfig $config, CapabilitiesService $capabilitiesService, PermissionManager $permissionManager) { + $context->injectFn(function (ITemplateManager $templateManager, IL10N $l10n, IConfig $config, CapabilitiesService $capabilitiesService, PermissionManager $permissionManager, IAppManager $appManager) { if (!$permissionManager->isEnabledForUser() || empty($capabilitiesService->getCapabilities())) { return; } $ooxml = $config->getAppValue(self::APPNAME, 'doc_format', '') === 'ooxml'; - $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) { + $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) { $odtType = new TemplateFileCreator('richdocuments', $l10n->t('New document'), ($ooxml ? '.docx' : '.odt')); if ($ooxml) { $odtType->addMimetype('application/msword'); @@ -115,11 +115,11 @@ public function boot(IBootContext $context): void { $odtType->addMimetype('application/vnd.oasis.opendocument.text'); $odtType->addMimetype('application/vnd.oasis.opendocument.text-template'); } - $odtType->setIconClass('icon-filetype-document'); + $odtType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-document.svg')); $odtType->setRatio(21 / 29.7); return $odtType; }); - $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) { + $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) { $odsType = new TemplateFileCreator('richdocuments', $l10n->t('New spreadsheet'), ($ooxml ? '.xlsx' : '.ods')); if ($ooxml) { $odsType->addMimetype('application/vnd.ms-excel'); @@ -128,11 +128,11 @@ public function boot(IBootContext $context): void { $odsType->addMimetype('application/vnd.oasis.opendocument.spreadsheet'); $odsType->addMimetype('application/vnd.oasis.opendocument.spreadsheet-template'); } - $odsType->setIconClass('icon-filetype-spreadsheet'); + $odsType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-spreadsheet.svg')); $odsType->setRatio(16 / 9); return $odsType; }); - $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) { + $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) { $odpType = new TemplateFileCreator('richdocuments', $l10n->t('New presentation'), ($ooxml ? '.pptx' : '.odp')); if ($ooxml) { $odpType->addMimetype('application/vnd.ms-powerpoint'); @@ -141,7 +141,7 @@ public function boot(IBootContext $context): void { $odpType->addMimetype('application/vnd.oasis.opendocument.presentation'); $odpType->addMimetype('application/vnd.oasis.opendocument.presentation-template'); } - $odpType->setIconClass('icon-filetype-presentation'); + $odpType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-presentation.svg')); $odpType->setRatio(16 / 9); return $odpType; }); @@ -149,11 +149,11 @@ public function boot(IBootContext $context): void { if (!$capabilitiesService->hasDrawSupport()) { return; } - $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) { + $templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml, $appManager) { $odpType = new TemplateFileCreator('richdocuments', $l10n->t('New diagram'), '.odg'); $odpType->addMimetype('application/vnd.oasis.opendocument.graphics'); $odpType->addMimetype('application/vnd.oasis.opendocument.graphics-template'); - $odpType->setIconClass('icon-filetype-draw'); + $odpType->setIconSvgInline(file_get_contents($appManager->getAppPath('richdocuments') . '/img/x-office-drawing.svg')); $odpType->setRatio(1); return $odpType; });