LibreOffice Module desktop (master)  1
dp_descriptioninfoset.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 #include <sal/config.h>
23 
24 #include <optional>
25 #include <string_view>
26 
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <com/sun/star/uno/Sequence.hxx>
29 #include <sal/types.h>
30 #include "dp_misc_api.hxx"
31 
33 
34 namespace com::sun::star {
35  namespace uno { class XComponentContext; }
36  namespace xml {
37  namespace dom {
38  class XNode;
39  class XNodeList;
40  }
41  namespace xpath { class XXPathAPI; }
42  }
43 }
44 
45 namespace dp_misc {
46 
48 {
49  OUString acceptBy;
50  //Attribute suppress-on-update. Default is false.
52  //Attribute suppress-if-required. Default is false.
54 };
55 
56 
64 public:
76  css::uno::Reference< css::uno::XComponentContext > const & context,
77  css::uno::Reference< css::xml::dom::XNode > const & element);
78 
80 
87  ::std::optional< OUString > getIdentifier() const;
88 
95  OUString getVersion() const;
96 
112  css::uno::Sequence< OUString > getSupportedPlatforms() const;
113 
119  std::pair< OUString, OUString > getLocalizedPublisherNameAndURL() const;
120 
126  OUString getLocalizedReleaseNotesURL() const;
127 
132  OUString getLocalizedLicenseURL() const;
133 
139  ::std::optional<SimpleLicenseAttributes> getSimpleLicenseAttributes() const;
140 
145  OUString getLocalizedDisplayName() const;
146 
166  ::std::optional< OUString > getLocalizedUpdateWebsiteURL() const;
167 
172  OUString getLocalizedDescriptionURL() const;
179  css::uno::Reference< css::xml::dom::XNodeList >
180  getDependencies() const;
181 
188  css::uno::Sequence< OUString > getUpdateInformationUrls() const;
189 
200  css::uno::Sequence< OUString > getUpdateDownloadUrls() const;
201 
205  OUString getIconURL( bool bHighContrast ) const;
206 
207  bool hasDescription() const;
208 
209 private:
210  SAL_DLLPRIVATE ::std::optional< OUString > getOptionalValue(
211  OUString const & expression) const;
212 
213  SAL_DLLPRIVATE css::uno::Sequence< OUString > getUrls(
214  OUString const & expression) const;
215 
225  SAL_DLLPRIVATE css::uno::Reference< css::xml::dom::XNode >
226  getLocalizedChild( OUString const & sParent) const;
227  SAL_DLLPRIVATE css::uno::Reference< css::xml::dom::XNode>
228  matchLanguageTag(
229  css::uno::Reference< css::xml::dom::XNode > const & xParent,
230  std::u16string_view rTag) const;
231 
239  SAL_DLLPRIVATE css::uno::Reference< css::xml::dom::XNode>
240  getChildWithDefaultLocale(
241  css::uno::Reference< css::xml::dom::XNode > const & xParent) const;
246  SAL_DLLPRIVATE OUString getLocalizedHREFAttrFromChild(
247  OUString const & sXPathParent, bool * out_bParentExists) const;
248 
253  SAL_DLLPRIVATE OUString
254  getNodeValueFromExpression(OUString const & expression) const;
255 
259  SAL_DLLPRIVATE void
260  checkDenylist() const;
261 
264  SAL_DLLPRIVATE static bool
265  checkDenylistVersion(std::u16string_view currentversion,
266  css::uno::Sequence< OUString > const & versions);
267 
268  css::uno::Reference< css::uno::XComponentContext > m_context;
269  css::uno::Reference< css::xml::dom::XNode > m_element;
270  css::uno::Reference< css::xml::xpath::XXPathAPI > m_xpath;
271 };
272 
274 {
275  return m_element.is();
276 }
277 
284 DescriptionInfoset getDescriptionInfoset(std::u16string_view sExtensionFolderURL);
285 }
286 
287 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::xml::xpath::XXPathAPI > m_xpath
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC DescriptionInfoset getDescriptionInfoset(std::u16string_view sExtensionFolderURL)
creates a DescriptionInfoset object.
#define DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
Definition: dp_misc_api.hxx:28
exports com.sun.star.xml. dom
exports com.sun.star.xml. xpath
css::uno::Reference< css::xml::dom::XNode > m_element
css::uno::Reference< css::uno::XComponentContext > m_context
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString getIdentifier(css::uno::Reference< css::deployment::XPackage > const &package)
Gets the identifier of a package.
Access to the content of an XML description element.