summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2011-11-15 12:42:44 +0100
committerStephan Bergmann <sbergman@redhat.com>2011-11-15 12:44:00 +0100
commit8a993919377f0b602b7db88d1de6696b21a11cbf (patch)
treeeecc58071635673ef4764c60bc1463e7fa1cfc69 /desktop
parentb53d2bc9dd92079c030346af57e9b1a0078a05e7 (diff)
Introduced LibreOffice-minimal-version extension dependency.
Diffstat (limited to 'desktop')
-rw-r--r--desktop/inc/deployment.hrc7
-rw-r--r--desktop/source/deployment/misc/dp_dependencies.cxx115
-rw-r--r--desktop/source/deployment/misc/dp_misc.hrc33
-rw-r--r--desktop/source/deployment/misc/dp_misc.src10
-rw-r--r--desktop/source/deployment/misc/dp_ucb.cxx2
-rw-r--r--desktop/test/deployment/dependencies/loversion35.oxtbin0 -> 1736 bytes
-rw-r--r--desktop/test/deployment/dependencies/loversion36.oxtbin0 -> 1736 bytes
7 files changed, 95 insertions, 72 deletions
diff --git a/desktop/inc/deployment.hrc b/desktop/inc/deployment.hrc
index 1777f69f1896..4bd6dbca30c2 100644
--- a/desktop/inc/deployment.hrc
+++ b/desktop/inc/deployment.hrc
@@ -68,8 +68,11 @@
#define RID_DEPLOYMENT_DEPENDENCIES_START (RID_DEPLOYMENT_START + 4400)
#define RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN RID_DEPLOYMENT_DEPENDENCIES_START
-#define RID_DEPLOYMENT_DEPENDENCIES_MIN (RID_DEPLOYMENT_DEPENDENCIES_START+1)
-#define RID_DEPLOYMENT_DEPENDENCIES_MAX (RID_DEPLOYMENT_DEPENDENCIES_START+2)
+#define RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN \
+ (RID_DEPLOYMENT_DEPENDENCIES_START+1)
+#define RID_DEPLOYMENT_DEPENDENCIES_OOO_MAX \
+ (RID_DEPLOYMENT_DEPENDENCIES_START+2)
+#define RID_DEPLOYMENT_DEPENDENCIES_LO_MIN (RID_DEPLOYMENT_DEPENDENCIES_START+3)
#define RID_DEPLOYMENT_LICENSE_START (RID_DEPLOYMENT_START+4500)
diff --git a/desktop/source/deployment/misc/dp_dependencies.cxx b/desktop/source/deployment/misc/dp_dependencies.cxx
index f2a997fe42b9..b563a52b5378 100644
--- a/desktop/source/deployment/misc/dp_dependencies.cxx
+++ b/desktop/source/deployment/misc/dp_dependencies.cxx
@@ -40,6 +40,7 @@
#include "rtl/ustring.hxx"
#include "sal/types.h"
#include "tools/resid.hxx"
+#include "unotools/configmgr.hxx"
#include "deployment.hrc"
#include "dp_resource.h"
@@ -52,28 +53,43 @@ namespace {
namespace css = com::sun::star;
-static char const xmlNamespace[] =
+static char const namespaceLibreOffice[] =
+ "http://libreoffice.org/extensions/description/2011";
+
+static char const namespaceOpenOfficeOrg[] =
"http://openoffice.org/extensions/description/2006";
-static char const minimalVersion[] = "OpenOffice.org-minimal-version";
+static char const minimalVersionLibreOffice[] = "LibreOffice-minimal-version";
+
+static char const minimalVersionOpenOfficeOrg[] =
+ "OpenOffice.org-minimal-version";
+
+static char const maximalVersionOpenOfficeOrg[] =
+ "OpenOffice.org-maximal-version";
-static char const maximalVersion[] = "OpenOffice.org-maximal-version";
+rtl::OUString getLibreOfficeMajorMinorMicro() {
+ return utl::ConfigManager::getAboutBoxProductVersion();
+}
-bool versionIsNot(dp_misc::Order order, rtl::OUString const & version) {
- rtl::OUString oooVersion(
+rtl::OUString getReferenceOpenOfficeOrgMajorMinor() {
+ rtl::OUString v(
RTL_CONSTASCII_USTRINGPARAM(
"${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version")
":Version:ReferenceOOoMajorMinor}"));
- rtl::Bootstrap::expandMacros(oooVersion); //TODO: check for failure
- return dp_misc::compareVersions(oooVersion, version) != order;
+ rtl::Bootstrap::expandMacros(v); //TODO: check for failure
+ return v;
}
-bool satisfiesMinimalVersion(rtl::OUString const & version) {
- return versionIsNot(dp_misc::LESS, version);
+bool satisfiesMinimalVersion(
+ rtl::OUString const & actual, rtl::OUString const & specified)
+{
+ return dp_misc::compareVersions(actual, specified) != dp_misc::LESS;
}
-bool satisfiesMaximalVersion(rtl::OUString const & version) {
- return versionIsNot(dp_misc::GREATER, version);
+bool satisfiesMaximalVersion(
+ rtl::OUString const & actual, rtl::OUString const & specified)
+{
+ return dp_misc::compareVersions(actual, specified) != dp_misc::GREATER;
}
rtl::OUString produceErrorText(
@@ -106,32 +122,47 @@ check(dp_misc::DescriptionInfoset const & infoset) {
deps->item(i), css::uno::UNO_QUERY_THROW);
bool sat = false;
if (e->getNamespaceURI().equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM(xmlNamespace))
+ RTL_CONSTASCII_STRINGPARAM(namespaceOpenOfficeOrg))
&& e->getTagName().equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM(minimalVersion)))
+ RTL_CONSTASCII_STRINGPARAM(minimalVersionOpenOfficeOrg)))
{
sat = satisfiesMinimalVersion(
+ getReferenceOpenOfficeOrgMajorMinor(),
e->getAttribute(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value"))));
} else if (e->getNamespaceURI().equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM(xmlNamespace))
+ RTL_CONSTASCII_STRINGPARAM(namespaceOpenOfficeOrg))
&& e->getTagName().equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM(maximalVersion)))
+ RTL_CONSTASCII_STRINGPARAM(maximalVersionOpenOfficeOrg)))
{
sat = satisfiesMaximalVersion(
- e->getAttribute(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value"))));
+ getReferenceOpenOfficeOrgMajorMinor(),
+ e->getAttribute(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value"))));
+ } else if (e->getNamespaceURI().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(namespaceLibreOffice))
+ && e->getTagName().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(minimalVersionLibreOffice)))
+ {
+ sat = satisfiesMinimalVersion(
+ getLibreOfficeMajorMinorMicro(),
+ e->getAttribute(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value"))));
} else if (e->hasAttributeNS(
rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(xmlNamespace)),
+ RTL_CONSTASCII_USTRINGPARAM(namespaceOpenOfficeOrg)),
rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(minimalVersion))))
+ RTL_CONSTASCII_USTRINGPARAM(
+ minimalVersionOpenOfficeOrg))))
{
sat = satisfiesMinimalVersion(
+ getReferenceOpenOfficeOrgMajorMinor(),
e->getAttributeNS(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(xmlNamespace)),
rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(minimalVersion))));
+ RTL_CONSTASCII_USTRINGPARAM(namespaceOpenOfficeOrg)),
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ minimalVersionOpenOfficeOrg))));
}
if (!sat) {
unsatisfied[unsat++] = e;
@@ -146,36 +177,54 @@ rtl::OUString getErrorText(
{
OSL_ASSERT(dependency.is());
if (dependency->getNamespaceURI().equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM(xmlNamespace))
+ RTL_CONSTASCII_STRINGPARAM(namespaceOpenOfficeOrg))
&& dependency->getTagName().equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM(minimalVersion)))
+ RTL_CONSTASCII_STRINGPARAM(minimalVersionOpenOfficeOrg)))
{
return produceErrorText(
- ResId::toString(dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_MIN)),
+ ResId::toString(
+ dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN)),
dependency->getAttribute(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value"))));
} else if (dependency->getNamespaceURI().equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM(xmlNamespace))
+ RTL_CONSTASCII_STRINGPARAM(namespaceOpenOfficeOrg))
&& dependency->getTagName().equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM(maximalVersion)))
+ RTL_CONSTASCII_STRINGPARAM(maximalVersionOpenOfficeOrg)))
{
return produceErrorText(
- ResId::toString(dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_MAX)),
+ ResId::toString(
+ dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MAX)),
+ dependency->getAttribute(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value"))));
+ } else if (dependency->getNamespaceURI().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(namespaceLibreOffice))
+ && dependency->getTagName().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(minimalVersionLibreOffice)))
+ {
+ return produceErrorText(
+ ResId::toString(
+ dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_LO_MIN)),
dependency->getAttribute(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value"))));
} else if (dependency->hasAttributeNS(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(xmlNamespace)),
rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(minimalVersion))))
+ RTL_CONSTASCII_USTRINGPARAM(namespaceOpenOfficeOrg)),
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ minimalVersionOpenOfficeOrg))))
{
return produceErrorText(
- ResId::toString(dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_MIN)),
+ ResId::toString(
+ dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN)),
dependency->getAttributeNS(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(xmlNamespace)),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(minimalVersion))));
- } else
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(namespaceOpenOfficeOrg)),
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(minimalVersionOpenOfficeOrg))));
+ } else {
return ResId::toString(
dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN));
+ }
}
}
diff --git a/desktop/source/deployment/misc/dp_misc.hrc b/desktop/source/deployment/misc/dp_misc.hrc
deleted file mode 100644
index 55fabac5c5b5..000000000000
--- a/desktop/source/deployment/misc/dp_misc.hrc
+++ /dev/null
@@ -1,33 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#if ! defined INCLUDED_DP_MISC_HRC
-#define INCLUDED_DP_MISC_HRC
-
-#include "deployment.hrc"
-
-#endif
diff --git a/desktop/source/deployment/misc/dp_misc.src b/desktop/source/deployment/misc/dp_misc.src
index 22a6683218af..dda9edf51598 100644
--- a/desktop/source/deployment/misc/dp_misc.src
+++ b/desktop/source/deployment/misc/dp_misc.src
@@ -25,16 +25,20 @@
*
************************************************************************/
-#include "dp_misc.hrc"
+#include "deployment.hrc"
String RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN {
Text[en-US] = "Unknown";
};
-String RID_DEPLOYMENT_DEPENDENCIES_MIN {
+String RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN {
Text[en-US] = "Extension requires at least OpenOffice.org reference version %VERSION";
};
-String RID_DEPLOYMENT_DEPENDENCIES_MAX {
+String RID_DEPLOYMENT_DEPENDENCIES_OOO_MAX {
Text[en-US] = "Extension does not support OpenOffice.org reference versions greater than %VERSION";
};
+
+String RID_DEPLOYMENT_DEPENDENCIES_LO_MIN {
+ Text[en-US] = "Extension requires at least LibreOffice version %VERSION";
+};
diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx
index fa3896aab8c4..b0cda170a431 100644
--- a/desktop/source/deployment/misc/dp_ucb.cxx
+++ b/desktop/source/deployment/misc/dp_ucb.cxx
@@ -29,7 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_desktop.hxx"
-#include "dp_misc.hrc"
+#include "deployment.hrc"
#include "dp_misc.h"
#include "dp_ucb.h"
#include "rtl/uri.hxx"
diff --git a/desktop/test/deployment/dependencies/loversion35.oxt b/desktop/test/deployment/dependencies/loversion35.oxt
new file mode 100644
index 000000000000..ecd509cd9fef
--- /dev/null
+++ b/desktop/test/deployment/dependencies/loversion35.oxt
Binary files differ
diff --git a/desktop/test/deployment/dependencies/loversion36.oxt b/desktop/test/deployment/dependencies/loversion36.oxt
new file mode 100644
index 000000000000..f38630e0c711
--- /dev/null
+++ b/desktop/test/deployment/dependencies/loversion36.oxt
Binary files differ