diff options
Diffstat (limited to 'desktop/source/deployment')
-rw-r--r-- | desktop/source/deployment/deployment.map | 8 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_dialog2.cxx | 3 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 8 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_extlistbox.hxx | 5 | ||||
-rw-r--r-- | desktop/source/deployment/gui/makefile.mk | 2 | ||||
-rw-r--r-- | desktop/source/deployment/inc/dp_descriptioninfoset.hxx | 16 | ||||
-rw-r--r-- | desktop/source/deployment/makefile.mk | 2 | ||||
-rw-r--r-- | desktop/source/deployment/misc/dp_descriptioninfoset.cxx | 44 | ||||
-rw-r--r-- | desktop/source/deployment/registry/package/dp_package.cxx | 68 |
9 files changed, 94 insertions, 62 deletions
diff --git a/desktop/source/deployment/deployment.map b/desktop/source/deployment/deployment.map deleted file mode 100644 index 563b3d86a5..0000000000 --- a/desktop/source/deployment/deployment.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 8f79fc5820..2a0cef61b8 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -90,8 +90,7 @@ using ::rtl::OUString; namespace dp_gui { -#define ICON_OFFSET 50 -#define TOP_OFFSET 3 +#define TOP_OFFSET 5 #define LINE_SIZE 4 #define PROGRESS_WIDTH 60 #define PROGRESS_HEIGHT 14 diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 2852e67e7d..e974d7ab21 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -520,10 +520,10 @@ void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntr else aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon; Size aImageSize = aImage.GetSizePixel(); - if ( ( aImageSize.Width() <= ICON_HEIGHT ) && ( aImageSize.Height() <= ICON_HEIGHT ) ) - DrawImage( Point( aPos.X()+((ICON_HEIGHT-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage ); + if ( ( aImageSize.Width() <= ICON_WIDTH ) && ( aImageSize.Height() <= ICON_HEIGHT ) ) + DrawImage( Point( aPos.X()+((ICON_WIDTH-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage ); else - DrawImage( aPos, Size( ICON_HEIGHT, ICON_HEIGHT ), aImage ); + DrawImage( aPos, Size( ICON_WIDTH, ICON_HEIGHT ), aImage ); // Setup fonts Font aStdFont( GetFont() ); diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 2749db99ce..18f9844349 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -45,9 +45,10 @@ namespace dp_gui { #define SMALL_ICON_SIZE 16 -#define TOP_OFFSET 3 +#define TOP_OFFSET 5 #define ICON_HEIGHT 42 -#define ICON_OFFSET 50 +#define ICON_WIDTH 47 +#define ICON_OFFSET 72 #define RIGHT_ICON_OFFSET 5 #define SPACE_BETWEEN 3 diff --git a/desktop/source/deployment/gui/makefile.mk b/desktop/source/deployment/gui/makefile.mk index b55ad49421..6a9c7b6bbb 100644 --- a/desktop/source/deployment/gui/makefile.mk +++ b/desktop/source/deployment/gui/makefile.mk @@ -60,7 +60,7 @@ SLOFILES = \ $(SLO)$/descedit.obj SHL1TARGET = $(TARGET)$(DLLPOSTFIX).uno -SHL1VERSIONMAP = ..$/deployment.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1STDLIBS = \ $(SALLIB) \ diff --git a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx index cd964761da..80c46df937 100644 --- a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx +++ b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx @@ -53,6 +53,15 @@ namespace rtl { class OUString; } namespace dp_misc { +struct DESKTOP_DEPLOYMENTMISC_DLLPUBLIC SimpleLicenseAttributes +{ + ::rtl::OUString acceptBy; + //Attribute suppress-on-update. Default is false. + bool suppressOnUpdate; + //Attribute suppress-if-required. Default is false. + bool suppressIfRequired; +}; + /** Access to the content of an XML <code>description</code> element. @@ -132,6 +141,13 @@ public: */ ::rtl::OUString getLocalizedLicenseURL() const; + /** returns the attributes of the simple-license element + + As long as there is a simple-license element, the function will return + the structure. If it does not exist, then the optional object is uninitialized. + */ + ::boost::optional<SimpleLicenseAttributes> getSimpleLicenseAttributes() const; + /** returns the localized display name of the extensions. In case there is no localized display-name then an empty string is returned. diff --git a/desktop/source/deployment/makefile.mk b/desktop/source/deployment/makefile.mk index f11f87ad56..7eda0f582e 100644 --- a/desktop/source/deployment/makefile.mk +++ b/desktop/source/deployment/makefile.mk @@ -49,7 +49,7 @@ INCPRE += inc DLLPRE = SHL1TARGET = $(TARGET)$(DLLPOSTFIX).uno -SHL1VERSIONMAP = deployment.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1LIBS = \ $(SLB)$/deployment_manager.lib \ diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx index 1ecb757d07..73df2b0168 100644 --- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx +++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx @@ -370,6 +370,50 @@ css::uno::Sequence< ::rtl::OUString > DescriptionInfoset::getUrls( } +::boost::optional<SimpleLicenseAttributes> +DescriptionInfoset::getSimpleLicenseAttributes() const +{ + //Check if the node exist + css::uno::Reference< css::xml::dom::XNode > n; + if (m_element.is()) { + try { + n = m_xpath->selectSingleNode(m_element, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@accept-by"))); + } catch (css::xml::xpath::XPathException &) { + // ignore + } + if (n.is()) + { + SimpleLicenseAttributes attributes; + attributes.acceptBy = + getNodeValueFromExpression(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@accept-by"))); + + ::boost::optional< ::rtl::OUString > suppressOnUpdate = getOptionalValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@suppress-on-update"))); + if (suppressOnUpdate) + attributes.suppressOnUpdate = (*suppressOnUpdate).trim().equalsIgnoreAsciiCase( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true"))); + else + attributes.suppressOnUpdate = false; + + ::boost::optional< ::rtl::OUString > suppressIfRequired = getOptionalValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@suppress-if-required"))); + if (suppressIfRequired) + attributes.suppressIfRequired = (*suppressIfRequired).trim().equalsIgnoreAsciiCase( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true"))); + else + attributes.suppressIfRequired = false; + + return ::boost::optional<SimpleLicenseAttributes>(attributes); + } + } + return ::boost::optional<SimpleLicenseAttributes>(); +} + ::rtl::OUString DescriptionInfoset::getLocalizedDescriptionURL() const { return getLocalizedHREFAttrFromChild(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index bffe47b5e7..8a61eb026f 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -70,7 +70,7 @@ #include "com/sun/star/xml/dom/XDocumentBuilder.hpp" #include "com/sun/star/xml/xpath/XXPathAPI.hpp" #include "com/sun/star/deployment/XPackageManager.hpp" - +#include "boost/optional.hpp" #include <vector> #include <stdio.h> @@ -583,21 +583,12 @@ bool BackendImpl::PackageImpl::checkDependencies( { try { - css::uno::Reference<css::xml::dom::XNode> xRoot = desc.getRootElement(); - css::uno::Reference<css::xml::xpath::XXPathAPI> xPath = - getDescriptionInfoset().getXpath(); - - css::uno::Reference<css::xml::dom::XNode> nodeSimpleLic; - try { - nodeSimpleLic = xPath->selectSingleNode(xRoot, - OUSTR("/desc:description/desc:registration/desc:simple-license")); - } catch (css::xml::xpath::XPathException &) { - // ignore - } - - if (!nodeSimpleLic.is()) + DescriptionInfoset info = getDescriptionInfoset(); + ::boost::optional<SimpleLicenseAttributes> simplLicAttr + = info.getSimpleLicenseAttributes(); + if (! simplLicAttr) return true; - OUString sLic = getDescriptionInfoset().getLocalizedLicenseURL(); + OUString sLic = info.getLocalizedLicenseURL(); //If we do not get a localized licence then there is an error in the description.xml //This should be handled by using a validating parser. Therefore we assume that no //license is available. @@ -606,23 +597,20 @@ bool BackendImpl::PackageImpl::checkDependencies( OUSTR("Could not obtain path to license. Possible error in description.xml"), 0, Any()); OUString sHref = desc.getExtensionRootUrl() + OUSTR("/") + sLic; OUString sLicense = getTextFromURL(xCmdEnv, sHref); - //determine who has to agree to the license - css::uno::Reference<css::xml::xpath::XXPathObject> nodeAttribWho3 = - xPath->eval(nodeSimpleLic, - OUSTR("@accept-by")); - OUString sAccept = nodeAttribWho3->getString().trim(); + ////determine who has to agree to the license //check correct value for attribute - if ( ! (sAccept.equals(OUSTR("user")) || sAccept.equals(OUSTR("admin")))) + if ( ! (simplLicAttr->acceptBy.equals(OUSTR("user")) || simplLicAttr->acceptBy.equals(OUSTR("admin")))) throw css::deployment::DeploymentException( OUSTR("Could not obtain attribute simple-lincense@accept-by or it has no valid value"), 0, Any()); //If if @accept-by="user" then every user needs to accept the license before it can be installed. - //Therefore we must prevent the installation as shared extension. + //Therefore we must prevent the installation as shared extension unless suppress-if-required="true" OSL_ASSERT(aContextName.getLength()); - if (sAccept.equals(OUSTR("user")) && aContextName.equals(OUSTR("shared"))) + if (simplLicAttr->acceptBy.equals(OUSTR("user")) && aContextName.equals(OUSTR("shared"))) { - css::deployment::LicenseIndividualAgreementException exc = - css::deployment::LicenseIndividualAgreementException(OUString(), 0, m_name); + css::deployment::LicenseIndividualAgreementException + exc = css::deployment::LicenseIndividualAgreementException( + OUString(), 0, m_name, simplLicAttr->suppressIfRequired); bool approve = false; bool abort = false; @@ -632,32 +620,24 @@ bool BackendImpl::PackageImpl::checkDependencies( OUSTR("Could not interact with user."), 0, Any()); if (abort == true) return false; - //We should always prevent installation - OSL_ASSERT(0); - } - - //determine optional attribute simple-license@suppressOnUpdate - css::uno::Reference<css::xml::dom::XElement> elemSimpleLic(nodeSimpleLic, css::uno::UNO_QUERY_THROW); - sal_Bool bSuppress = sal_False; - if (elemSimpleLic->hasAttribute(OUSTR("suppress-on-update"))) - { - if (elemSimpleLic->getAttribute(OUSTR("suppress-on-update")).equals(OUSTR("true"))) - bSuppress = sal_True; + + //If the unopkg --suppress-license was used and simplLicAttr->suppressIfRequired == true, + //then the user implicitely accepts the license } //Only use interaction if there is no version of this extension already installed //and the suppress-on-update flag is not set for the new extension - // bInstalled | bSuppress | show license + // bInstalled | bSuppressOnUpdate | show license //---------------------------------------- - // 0 | 0 | 1 - // 0 | 1 | 1 - // 1 | 0 | 1 - // 1 | 1 | 0 + // 0 | 0 | 1 + // 0 | 1 | 1 + // 1 | 0 | 1 + // 1 | 1 | 0 - if ( !(bInstalled && bSuppress)) + if ( !(bInstalled && simplLicAttr->suppressOnUpdate)) { - css::deployment::LicenseException licExc = - css::deployment::LicenseException(OUString(), 0, m_name, sLicense); + css::deployment::LicenseException licExc( + OUString(), 0, m_name, sLicense, simplLicAttr->suppressIfRequired); bool approve = false; bool abort = false; if (! interactContinuation( |