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 #ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_INC_DP_UPDATE_HXX
21 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_INC_DP_UPDATE_HXX
22 
23 
24 #include <com/sun/star/deployment/XPackage.hpp>
25 #include <com/sun/star/deployment/XExtensionManager.hpp>
26 #include <com/sun/star/deployment/XUpdateInformationProvider.hpp>
27 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <com/sun/star/xml/dom/XNode.hpp>
29 
30 #include "dp_misc_api.hxx"
31 
32 #include <map>
33 #include <vector>
34 
35 namespace dp_misc {
36 
42 
44 {
49 };
50 
51 /* determine if an update is available which is installed in the
52  user repository.
53 
54  If the return value is UPDATE_SOURCE_NONE, then no update is
55  available, otherwise the return value determine from which the
56  repository the update is used.
57 */
60  bool bReadOnlyShared,
61  OUString const & userVersion,
62  OUString const & sharedVersion,
63  OUString const & bundledVersion,
64  OUString const & onlineVersion);
65 
66 /* determine if an update is available which is installed in the
67  shared repository.
68 
69  If the return value is UPDATE_SOURCE_NONE, then no update is
70  available, otherwise the return value determine from which the
71  repository the update is used.
72 */
75  bool bReadOnlyShared,
76  OUString const & sharedVersion,
77  OUString const & bundledVersion,
78  OUString const & onlineVersion);
79 
80 /* determines the extension with the highest identifier and returns it
81 
82  */
84 css::uno::Reference< css::deployment::XPackage>
86  css::uno::Sequence<
87  css::uno::Reference<
88  css::deployment::XPackage> > const & seqExtensionsWithSameId);
89 
90 
91 struct UpdateInfo
92 {
93  UpdateInfo( css::uno::Reference< css::deployment::XPackage> const & ext);
94 
95  css::uno::Reference< css::deployment::XPackage> extension;
96  //version of the update
97  OUString version;
98  css::uno::Reference< css::xml::dom::XNode > info;
99 };
100 
101 typedef std::map< OUString, UpdateInfo > UpdateInfoMap;
102 
103 /*
104  @param extensionList
105  List of extension for which online update information is to be obtained. If NULL, then
106  for update information is obtained for all installed extension. There may be only one extension
107  with a particular identifier contained in the list. If one extension is installed
108  in several repositories, then the one with the highest version must be used, because it contains
109  the more recent URLs for getting the update information (if at all).
110  @param out_errors
111  the first member of the pair is the extension and the second the exception that was produced
112  when processing the extension.
113 
114  @return
115  A map of UpdateInfo instances. If the parameter extensionList was given, then the map contains
116  at only information for those extensions.
117  */
119 UpdateInfoMap getOnlineUpdateInfos(
120  css::uno::Reference< css::uno::XComponentContext> const &xContext,
121  css::uno::Reference< css::deployment::XExtensionManager> const & xExtMgr,
122  css::uno::Reference< css::deployment::XUpdateInformationProvider > const & updateInformation,
123  std::vector< css::uno::Reference< css::deployment::XPackage > > const * extensionList,
124  std::vector< std::pair< css::uno::Reference<
125  css::deployment::XPackage>, css::uno::Any> > & out_errors);
126 
127 /* returns the highest version from the provided arguments.
128 */
130 OUString getHighestVersion(
131  OUString const & sharedVersion,
132  OUString const & bundledVersion,
133  OUString const & onlineVersion);
134 
135 }
136 
137 #endif
138 
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::map< OUString, UpdateInfo > UpdateInfoMap
Definition: dp_update.hxx:101
UpdateInfo(css::uno::Reference< css::deployment::XPackage > const &ext)
Definition: dp_update.cxx:334
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 UPDATE_SOURCE isUpdateSharedExtension(bool bReadOnlyShared, OUString const &sharedVersion, OUString const &bundledVersion, OUString const &onlineVersion)
Definition: dp_update.cxx:284
#define DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
Definition: dp_misc_api.hxx:29
css::uno::Reference< css::xml::dom::XNode > info
Definition: dp_update.hxx:98
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC UPDATE_SOURCE isUpdateUserExtension(bool bReadOnlyShared, OUString const &userVersion, OUString const &sharedVersion, OUString const &bundledVersion, OUString const &onlineVersion)
Definition: dp_update.cxx:234
static uno::Reference< css::uno::XComponentContext > xContext
Definition: init.cxx:2142
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::deployment::XPackage > extension
Definition: dp_update.hxx:95
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString getHighestVersion(OUString const &sharedVersion, OUString const &bundledVersion, OUString const &onlineVersion)
Definition: dp_update.cxx:390
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC css::uno::Reference< css::deployment::XPackage > getExtensionWithHighestVersion(css::uno::Sequence< css::uno::Reference< css::deployment::XPackage > > const &seqExtensionsWithSameId)