LibreOffice Module desktop (master) 1
dp_update.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22
23#include <com/sun/star/deployment/XPackage.hpp>
24#include <com/sun/star/deployment/XExtensionManager.hpp>
25#include <com/sun/star/deployment/XUpdateInformationProvider.hpp>
26#include <com/sun/star/uno/XComponentContext.hpp>
27#include <com/sun/star/xml/dom/XNode.hpp>
28
29#include "dp_misc_api.hxx"
30
31#include <map>
32#include <vector>
33
34namespace dp_misc {
35
41
43{
48};
49
50/* determine if an update is available which is installed in the
51 user repository.
52
53 If the return value is UPDATE_SOURCE_NONE, then no update is
54 available, otherwise the return value determine from which the
55 repository the update is used.
56*/
59 bool bReadOnlyShared,
60 OUString const & userVersion,
61 OUString const & sharedVersion,
62 OUString const & bundledVersion,
63 std::u16string_view onlineVersion);
64
65/* determine if an update is available which is installed in the
66 shared repository.
67
68 If the return value is UPDATE_SOURCE_NONE, then no update is
69 available, otherwise the return value determine from which the
70 repository the update is used.
71*/
74 bool bReadOnlyShared,
75 OUString const & sharedVersion,
76 OUString const & bundledVersion,
77 std::u16string_view onlineVersion);
78
79/* determines the extension with the highest identifier and returns it
80
81 */
83css::uno::Reference< css::deployment::XPackage>
85 css::uno::Sequence<
86 css::uno::Reference<
87 css::deployment::XPackage> > const & seqExtensionsWithSameId);
88
89
91{
92 UpdateInfo( css::uno::Reference< css::deployment::XPackage> const & ext);
93
94 css::uno::Reference< css::deployment::XPackage> extension;
95 //version of the update
96 OUString version;
97 css::uno::Reference< css::xml::dom::XNode > info;
98};
99
100typedef std::map< OUString, UpdateInfo > UpdateInfoMap;
101
102/*
103 @param extensionList
104 List of extension for which online update information is to be obtained. If NULL, then
105 for update information is obtained for all installed extension. There may be only one extension
106 with a particular identifier contained in the list. If one extension is installed
107 in several repositories, then the one with the highest version must be used, because it contains
108 the more recent URLs for getting the update information (if at all).
109 @param out_errors
110 the first member of the pair is the extension and the second the exception that was produced
111 when processing the extension.
112
113 @return
114 A map of UpdateInfo instances. If the parameter extensionList was given, then the map contains
115 at only information for those extensions.
116 */
119 css::uno::Reference< css::uno::XComponentContext> const &xContext,
120 css::uno::Reference< css::deployment::XExtensionManager> const & xExtMgr,
121 css::uno::Reference< css::deployment::XUpdateInformationProvider > const & updateInformation,
122 std::vector< css::uno::Reference< css::deployment::XPackage > > const * extensionList,
123 std::vector< std::pair< css::uno::Reference<
124 css::deployment::XPackage>, css::uno::Any> > & out_errors);
125
126/* returns the highest version from the provided arguments.
127*/
129OUString getHighestVersion(
130 OUString const & sharedVersion,
131 OUString const & bundledVersion,
132 OUString const & onlineVersion);
133
134}
135
136/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
Definition: dp_misc_api.hxx:28
static uno::Reference< css::uno::XComponentContext > xContext
Definition: init.cxx:2534
std::map< OUString, UpdateInfo > UpdateInfoMap
Definition: dp_update.hxx:100
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString getExtensionDefaultUpdateURL()
returns the default update URL (for the update information) which is used when an extension does not ...
Definition: dp_update.cxx:222
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString getHighestVersion(OUString const &sharedVersion, OUString const &bundledVersion, OUString const &onlineVersion)
Definition: dp_update.cxx:390
@ UPDATE_SOURCE_SHARED
Definition: dp_update.hxx:45
@ UPDATE_SOURCE_ONLINE
Definition: dp_update.hxx:47
@ UPDATE_SOURCE_NONE
Definition: dp_update.hxx:44
@ UPDATE_SOURCE_BUNDLED
Definition: dp_update.hxx:46
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC UPDATE_SOURCE isUpdateUserExtension(bool bReadOnlyShared, OUString const &userVersion, OUString const &sharedVersion, OUString const &bundledVersion, std::u16string_view onlineVersion)
Definition: dp_update.cxx:234
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC UPDATE_SOURCE isUpdateSharedExtension(bool bReadOnlyShared, OUString const &sharedVersion, OUString const &bundledVersion, std::u16string_view onlineVersion)
Definition: dp_update.cxx:284
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC css::uno::Reference< css::deployment::XPackage > getExtensionWithHighestVersion(css::uno::Sequence< css::uno::Reference< css::deployment::XPackage > > const &seqExtensionsWithSameId)
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC UpdateInfoMap getOnlineUpdateInfos(css::uno::Reference< css::uno::XComponentContext > const &xContext, css::uno::Reference< css::deployment::XExtensionManager > const &xExtMgr, css::uno::Reference< css::deployment::XUpdateInformationProvider > const &updateInformation, std::vector< css::uno::Reference< css::deployment::XPackage > > const *extensionList, std::vector< std::pair< css::uno::Reference< css::deployment::XPackage >, css::uno::Any > > &out_errors)
css::uno::Reference< css::xml::dom::XNode > info
Definition: dp_update.hxx:97
UpdateInfo(css::uno::Reference< css::deployment::XPackage > const &ext)
Definition: dp_update.cxx:334
css::uno::Reference< css::deployment::XPackage > extension
Definition: dp_update.hxx:94