From 603d5e9c0ed374c5acc477208133dc29f8d97d5c Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 17 Sep 2009 15:48:04 -0400 Subject: #i5560# Applied & adjusted for the latest codebase the patches from go-oo. The original patches were contributed by Daniel Watson. --- .../registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu index 991ea9a64d10..4368520f6371 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu @@ -1246,6 +1246,19 @@ Rename Sheet + + + ~Tab Color... + + + ~Tab Color... + + + + + Tab Color + + ~Move/Copy Sheet... -- cgit From 2db393ea0b24fd230d3437d664a25d1cf7e5fb91 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Wed, 10 Feb 2010 10:27:57 +0100 Subject: jl152 copy changeset 263364:4815fbf0d446 from native0: #161641# XPackageManager.addPackage can install a folder, which is an uncompressed extension. --- desktop/source/deployment/manager/dp_manager.cxx | 18 +++++++--- desktop/source/deployment/registry/dp_registry.cxx | 18 +++++++--- .../deployment/registry/package/dp_package.cxx | 41 +++++++++++++++------- 3 files changed, 55 insertions(+), 22 deletions(-) diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 165efbaeca5a..3f13cb021aae 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -542,11 +542,19 @@ OUString PackageManagerImpl::insertToActivationLayer( { // inflate content: ::rtl::OUStringBuffer buf; - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.zip://") ); - buf.append( ::rtl::Uri::encode( sourceContent.getURL(), - rtl_UriCharClassRegName, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ) ); + if (!sourceContent.isFolder()) + { + buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.zip://") ); + buf.append( ::rtl::Uri::encode( sourceContent.getURL(), + rtl_UriCharClassRegName, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ) ); + } + else + { + //Folder. No need to unzip, just copy + buf.append(sourceContent.getURL()); + } buf.append( static_cast('/') ); sourceContent = ::ucbhelper::Content( buf.makeStringAndClear(), xCmdEnv ); diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index c6572364aac0..c56131a1015c 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -181,6 +181,7 @@ OUString normalizeMediaType( OUString const & mediaType ) } //______________________________________________________________________________ + void PackageRegistryImpl::insertBackend( Reference const & xBackend ) { @@ -201,7 +202,8 @@ void PackageRegistryImpl::insertBackend( ::std::pair mb_insertion( m_mediaType2backend.insert( t_string2registry::value_type( mediaType, xBackend ) ) ); - if (mb_insertion.second) { + if (mb_insertion.second) + { // add parameterless media-type, too: sal_Int32 semi = mediaType.indexOf( ';' ); if (semi >= 0) { @@ -210,9 +212,13 @@ void PackageRegistryImpl::insertBackend( mediaType.copy( 0, semi ), xBackend ) ); } const OUString fileFilter( xPackageType->getFileFilter() ); + //The package backend shall also be called to determine the mediatype + //(XPackageRegistry.bindPackage) when the URL points to a directory. + const bool bExtension = mediaType.equals(OUSTR("application/vnd.sun.star.package-bundle")); if (fileFilter.getLength() == 0 || fileFilter.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("*.*") ) || - fileFilter.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("*") )) + fileFilter.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("*") ) || + bExtension) { m_ambiguousBackends.insert( xBackend ); } @@ -351,7 +357,10 @@ Reference PackageRegistryImpl::create( } } - // insert bundle be: + // Insert bundle back-end. + // Always register as last, because we want to add extensions also as folders + // and as a default we accept every folder, which was not recognized by the other + // backends. that->insertBackend( ::dp_registry::backend::bundle::create( that, context, cachePath, readOnly, xComponentContext ) ); @@ -445,7 +454,8 @@ Reference PackageRegistryImpl::bindPackage( { ::ucbhelper::Content ucbContent; if (create_ucb_content( - &ucbContent, url, xCmdEnv, false /* no throw */ )) + &ucbContent, url, xCmdEnv, false /* no throw */ ) + && !ucbContent.isFolder()) { OUString title( ucbContent.getPropertyValue( StrTitle::get() ).get() ); diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index e45f7fb7ef73..b0b4a918c7a3 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -287,7 +287,7 @@ BackendImpl::BackendImpl( m_xBundleTypeInfo->getShortDescription(), RID_IMG_DEF_PACKAGE_BUNDLE, RID_IMG_DEF_PACKAGE_BUNDLE_HC ) ), - m_typeInfos( 2 ) + m_typeInfos(2) { m_typeInfos[ 0 ] = m_xBundleTypeInfo; m_typeInfos[ 1 ] = m_xLegacyBundleTypeInfo; @@ -342,17 +342,32 @@ Reference BackendImpl::bindPackage_( ::ucbhelper::Content ucbContent; if (create_ucb_content( &ucbContent, url, xCmdEnv )) { - const OUString title( ucbContent.getPropertyValue( - StrTitle::get() ).get() ); - if (title.endsWithIgnoreAsciiCaseAsciiL( - RTL_CONSTASCII_STRINGPARAM(".oxt") ) || - title.endsWithIgnoreAsciiCaseAsciiL( - RTL_CONSTASCII_STRINGPARAM(".uno.pkg") )) - mediaType = OUSTR("application/vnd.sun.star.package-bundle"); - else if (title.endsWithIgnoreAsciiCaseAsciiL( - RTL_CONSTASCII_STRINGPARAM(".zip") )) - mediaType = - OUSTR("application/vnd.sun.star.legacy-package-bundle"); + if (ucbContent.isFolder()) + { + //Every .oxt, uno.pkg file must contain a META-INF folder + ::ucbhelper::Content metaInfContent; + if (create_ucb_content( + &metaInfContent, makeURL( url, OUSTR("META-INF/manifest.xml") ), + xCmdEnv, false /* no throw */ )) + { + mediaType = OUSTR("application/vnd.sun.star.package-bundle"); + } + //No support of legacy bundles, because every folder could be one. + } + else + { + const OUString title( ucbContent.getPropertyValue( + StrTitle::get() ).get() ); + if (title.endsWithIgnoreAsciiCaseAsciiL( + RTL_CONSTASCII_STRINGPARAM(".oxt") ) || + title.endsWithIgnoreAsciiCaseAsciiL( + RTL_CONSTASCII_STRINGPARAM(".uno.pkg") )) + mediaType = OUSTR("application/vnd.sun.star.package-bundle"); + else if (title.endsWithIgnoreAsciiCaseAsciiL( + RTL_CONSTASCII_STRINGPARAM(".zip") )) + mediaType = + OUSTR("application/vnd.sun.star.legacy-package-bundle"); + } } if (mediaType.getLength() == 0) throw lang::IllegalArgumentException( @@ -1303,7 +1318,7 @@ void BackendImpl::PackageImpl::scanBundle( { OSL_ENSURE( 0, "### missing META-INF/manifest.xml file!" ); return; -} + } const lang::Locale officeLocale = getOfficeLocale(); -- cgit From 115be1e754c02ba61dcaaa8be29988d0ccafc5db Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 22 Feb 2010 10:13:55 -0500 Subject: calctabcolor: #i5560# Added new token for storing the tab color with ods, as a table document property. --- xmloff/inc/xmloff/xmltoken.hxx | 1 + xmloff/source/core/xmltoken.cxx | 1 + 2 files changed, 2 insertions(+) diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index 4a96de28b480..224b9e41a19f 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -1708,6 +1708,7 @@ namespace xmloff { namespace token { XML_SYMBOL_IMAGE_NAME, XML_SYMBOL_WIDTH, XML_SYSTEM, + XML_TAB_COLOR, XML_TAB_STOP, XML_TAB_STOP_DISTANCE, XML_TAB_STOPS, diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 3073ead17646..1dfbbacf8790 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -1716,6 +1716,7 @@ namespace xmloff { namespace token { TOKEN( "symbol-image-name", XML_SYMBOL_IMAGE_NAME ), TOKEN( "symbol-width", XML_SYMBOL_WIDTH ), TOKEN( "system", XML_SYSTEM ), + TOKEN( "tab-color", XML_TAB_COLOR ), TOKEN( "tab-stop", XML_TAB_STOP ), TOKEN( "tab-stop-distance", XML_TAB_STOP_DISTANCE ), TOKEN( "tab-stops", XML_TAB_STOPS ), -- cgit From 5f4789aa21fb16982d4e744d6eb1f2198f36154e Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 3 Mar 2010 16:36:43 +0100 Subject: #109634# password to modify dialog --- uui/source/cookiedg.cxx | 0 uui/source/cookiedg.hxx | 0 uui/source/iahndl-authentication.cxx | 46 +++++-- uui/source/ids.hrc | 257 ++++++++++++++++++----------------- uui/source/passworddlg.cxx | 30 ++-- uui/source/passworddlg.hxx | 2 +- uui/source/passworddlg.src | 12 +- uui/source/passworderrs.src | 9 +- 8 files changed, 199 insertions(+), 157 deletions(-) mode change 100644 => 100755 uui/source/cookiedg.cxx mode change 100644 => 100755 uui/source/cookiedg.hxx mode change 100644 => 100755 uui/source/iahndl-authentication.cxx mode change 100644 => 100755 uui/source/ids.hrc mode change 100644 => 100755 uui/source/passworddlg.cxx mode change 100644 => 100755 uui/source/passworddlg.hxx mode change 100644 => 100755 uui/source/passworddlg.src mode change 100644 => 100755 uui/source/passworderrs.src diff --git a/uui/source/cookiedg.cxx b/uui/source/cookiedg.cxx old mode 100644 new mode 100755 diff --git a/uui/source/cookiedg.hxx b/uui/source/cookiedg.hxx old mode 100644 new mode 100755 diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx old mode 100644 new mode 100755 index 9154122187ea..18c8d94b573a --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -29,6 +29,7 @@ ************************************************************************/ #include "com/sun/star/task/DocumentPasswordRequest.hpp" +#include "com/sun/star/task/DocumentPasswordRequest2.hpp" #include "com/sun/star/task/DocumentMSPasswordRequest.hpp" #include "com/sun/star/task/MasterPasswordRequest.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" @@ -37,6 +38,7 @@ #include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp" #include "com/sun/star/ucb/URLAuthenticationRequest.hpp" +#include "osl/diagnose.h" #include "rtl/digest.h" #include "vos/mutex.hxx" #include "tools/errcode.hxx" @@ -561,28 +563,46 @@ UUIInteractionHelper::handlePasswordRequest( uno::Reference< task::XInteractionRequest > const & rRequest) SAL_THROW((uno::RuntimeException)) { + // parameters to be filled for the call to handlePasswordRequest_ + Window * pParent = getParentProperty(); + task::PasswordRequestMode nMode = task::PasswordRequestMode_PASSWORD_ENTER; + uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations = rRequest->getContinuations(); + ::rtl::OUString aDocumentName; + bool bMSCryptoMode = false; + bool bIsPasswordToModify = false; + + bool bDoHandleRequest = false; + uno::Any aAnyRequest(rRequest->getRequest()); task::DocumentPasswordRequest aDocumentPasswordRequest; - if (aAnyRequest >>= aDocumentPasswordRequest) + if (!bDoHandleRequest && (aAnyRequest >>= aDocumentPasswordRequest)) { - handlePasswordRequest_(getParentProperty(), - aDocumentPasswordRequest.Mode, - rRequest->getContinuations(), - aDocumentPasswordRequest.Name, - false /* bool bMSCryptoMode */); - return true; + nMode = aDocumentPasswordRequest.Mode; + aDocumentName = aDocumentPasswordRequest.Name; + OSL_ENSURE( bMSCryptoMode == false, "bMSCryptoMode should be false" ); + OSL_ENSURE( bIsPasswordToModify == false, "bIsPasswordToModify should be false" ); + + bDoHandleRequest = true; } task::DocumentMSPasswordRequest aDocumentMSPasswordRequest; - if (aAnyRequest >>= aDocumentMSPasswordRequest) + if (!bDoHandleRequest && (aAnyRequest >>= aDocumentMSPasswordRequest)) + { + nMode = aDocumentMSPasswordRequest.Mode; + aDocumentName = aDocumentMSPasswordRequest.Name; + bMSCryptoMode = true; + OSL_ENSURE( bIsPasswordToModify == false, "bIsPasswordToModify should be false" ); + + bDoHandleRequest = true; + } + + if (bDoHandleRequest) { - handlePasswordRequest_(getParentProperty(), - aDocumentMSPasswordRequest.Mode, - rRequest->getContinuations(), - aDocumentMSPasswordRequest.Name, - true /* bool bMSCryptoMode */); + handlePasswordRequest_( pParent, nMode, rContinuations, aDocumentName, bMSCryptoMode ); return true; } + return false; } + diff --git a/uui/source/ids.hrc b/uui/source/ids.hrc old mode 100644 new mode 100755 index 28de301fe775..c02d9d6e419f --- a/uui/source/ids.hrc +++ b/uui/source/ids.hrc @@ -38,126 +38,129 @@ #include "tools/errcode.hxx" #endif -#define RID_KEEP_PASSWORD (RID_UUI_START + 0) -#define RID_SAVE_PASSWORD (RID_UUI_START + 1) -#define DLG_UUI_LOGIN (RID_UUI_START + 2) -#define DLG_COOKIES (RID_UUI_START + 3) -#define STR_COOKIES_RECV_START (RID_UUI_START + 4) -#define STR_COOKIES_RECV_COOKIES (RID_UUI_START + 5) -#define STR_COOKIES_RECV_TITLE (RID_UUI_START + 6) -#define STR_COOKIES_SEND_START (RID_UUI_START + 7) -#define STR_COOKIES_SEND_COOKIES (RID_UUI_START + 8) -#define STR_COOKIES_SEND_TITLE (RID_UUI_START + 9) -#define DLG_FILTER_SELECT (RID_UUI_START + 10) +#define RID_KEEP_PASSWORD (RID_UUI_START + 0) +#define RID_SAVE_PASSWORD (RID_UUI_START + 1) +#define DLG_UUI_LOGIN (RID_UUI_START + 2) +#define DLG_COOKIES (RID_UUI_START + 3) +#define STR_COOKIES_RECV_START (RID_UUI_START + 4) +#define STR_COOKIES_RECV_COOKIES (RID_UUI_START + 5) +#define STR_COOKIES_RECV_TITLE (RID_UUI_START + 6) +#define STR_COOKIES_SEND_START (RID_UUI_START + 7) +#define STR_COOKIES_SEND_COOKIES (RID_UUI_START + 8) +#define STR_COOKIES_SEND_TITLE (RID_UUI_START + 9) +#define DLG_FILTER_SELECT (RID_UUI_START + 10) // RID_UUI_START + 11 moved to ERRCODE_UUI_WRONGMEDIUM -#define DLG_UUI_MASTERPASSWORD (RID_UUI_START + 12) -#define STR_ERROR_PASSWORDS_NOT_IDENTICAL (RID_UUI_START + 13) -#define STR_ERROR_MASTERPASSWORD_WRONG (RID_UUI_START + 14) +#define DLG_UUI_MASTERPASSWORD (RID_UUI_START + 12) +#define STR_ERROR_PASSWORDS_NOT_IDENTICAL (RID_UUI_START + 13) +#define STR_ERROR_MASTERPASSWORD_WRONG (RID_UUI_START + 14) // RID_UUI_START + 15, 16, 17 are misused by syncaccess/source/ui/resids.hrc -#define RID_UUI_ERRHDL (RID_UUI_START + 20) -#define DLG_UUI_MASTERPASSWORD_CRT (RID_UUI_START + 21) -#define DLG_UUI_PASSWORD (RID_UUI_START + 22) -#define DLG_UUI_PASSWORD_CRT (RID_UUI_START + 23) -#define STR_ERROR_PASSWORD_WRONG (RID_UUI_START + 24) -#define STR_WARNING_BROKENSIGNATURE_TITLE (RID_UUI_START + 25) -#define DLG_UUI_UNKNOWNAUTH (RID_UUI_START + 26) -#define DLG_UUI_UNKNOWNAUTH_CRT (RID_UUI_START + 27) -#define DLG_UUI_SSLWARN (RID_UUI_START + 28) -#define DLG_UUI_SSLWARN_CRT (RID_UUI_START + 29) -#define RID_XMLSECDLG_MACROWARN (RID_UUI_START + 30) -#define STR_UNKNOWNUSER (RID_UUI_START + 31) -#define STR_OPENLOCKED_TITLE (RID_UUI_START + 32) -#define STR_OPENLOCKED_MSG (RID_UUI_START + 33) -#define STR_OPENLOCKED_OPENREADONLY_BTN (RID_UUI_START + 34) -#define STR_OPENLOCKED_OPENCOPY_BTN (RID_UUI_START + 35) -#define STR_FILECHANGED_TITLE (RID_UUI_START + 36) -#define STR_FILECHANGED_MSG (RID_UUI_START + 37) -#define STR_FILECHANGED_SAVEANYWAY_BTN (RID_UUI_START + 38) -#define STR_ALREADYOPEN_TITLE (RID_UUI_START + 39) -#define STR_ALREADYOPEN_MSG (RID_UUI_START + 40) -#define STR_ALREADYOPEN_READONLY_BTN (RID_UUI_START + 41) -#define STR_ALREADYOPEN_OPEN_BTN (RID_UUI_START + 42) -#define STR_LOCKFAILED_TITLE (RID_UUI_START + 43) -#define STR_LOCKFAILED_MSG (RID_UUI_START + 44) -#define STR_LOCKFAILED_DONTSHOWAGAIN (RID_UUI_START + 45) -#define STR_TRYLATER_TITLE (RID_UUI_START + 46) -#define STR_TRYLATER_MSG (RID_UUI_START + 47) -#define STR_TRYLATER_RETRYSAVING_BTN (RID_UUI_START + 48) -#define STR_TRYLATER_SAVEAS_BTN (RID_UUI_START + 49) -#define STR_ALREADYOPEN_SAVE_MSG (RID_UUI_START + 50) -#define STR_ALREADYOPEN_RETRY_SAVE_BTN (RID_UUI_START + 51) -#define STR_ALREADYOPEN_SAVE_BTN (RID_UUI_START + 52) -#define RID_DLG_NEWER_VERSION_WARNING (RID_UUI_START + 53) -#define STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE (RID_UUI_START + 54) +#define RID_UUI_ERRHDL (RID_UUI_START + 20) +#define DLG_UUI_MASTERPASSWORD_CRT (RID_UUI_START + 21) +#define DLG_UUI_PASSWORD (RID_UUI_START + 22) +#define DLG_UUI_PASSWORD_CRT (RID_UUI_START + 23) +#define STR_ERROR_PASSWORD_TO_OPEN_WRONG (RID_UUI_START + 24) +#define STR_ERROR_PASSWORD_TO_MODIFY_WRONG (RID_UUI_START + 25) +#define DLG_UUI_UNKNOWNAUTH (RID_UUI_START + 26) +#define DLG_UUI_UNKNOWNAUTH_CRT (RID_UUI_START + 27) +#define DLG_UUI_SSLWARN (RID_UUI_START + 28) +#define DLG_UUI_SSLWARN_CRT (RID_UUI_START + 29) +#define RID_XMLSECDLG_MACROWARN (RID_UUI_START + 30) +#define STR_UNKNOWNUSER (RID_UUI_START + 31) +#define STR_OPENLOCKED_TITLE (RID_UUI_START + 32) +#define STR_OPENLOCKED_MSG (RID_UUI_START + 33) +#define STR_OPENLOCKED_OPENREADONLY_BTN (RID_UUI_START + 34) +#define STR_OPENLOCKED_OPENCOPY_BTN (RID_UUI_START + 35) +#define STR_FILECHANGED_TITLE (RID_UUI_START + 36) +#define STR_FILECHANGED_MSG (RID_UUI_START + 37) +#define STR_FILECHANGED_SAVEANYWAY_BTN (RID_UUI_START + 38) +#define STR_ALREADYOPEN_TITLE (RID_UUI_START + 39) +#define STR_ALREADYOPEN_MSG (RID_UUI_START + 40) +#define STR_ALREADYOPEN_READONLY_BTN (RID_UUI_START + 41) +#define STR_ALREADYOPEN_OPEN_BTN (RID_UUI_START + 42) +#define STR_LOCKFAILED_TITLE (RID_UUI_START + 43) +#define STR_LOCKFAILED_MSG (RID_UUI_START + 44) +#define STR_LOCKFAILED_DONTSHOWAGAIN (RID_UUI_START + 45) +#define STR_TRYLATER_TITLE (RID_UUI_START + 46) +#define STR_TRYLATER_MSG (RID_UUI_START + 47) +#define STR_TRYLATER_RETRYSAVING_BTN (RID_UUI_START + 48) +#define STR_TRYLATER_SAVEAS_BTN (RID_UUI_START + 49) +#define STR_ALREADYOPEN_SAVE_MSG (RID_UUI_START + 50) +#define STR_ALREADYOPEN_RETRY_SAVE_BTN (RID_UUI_START + 51) +#define STR_ALREADYOPEN_SAVE_BTN (RID_UUI_START + 52) +#define RID_DLG_NEWER_VERSION_WARNING (RID_UUI_START + 53) +#define STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE (RID_UUI_START + 54) +#define STR_WARNING_BROKENSIGNATURE_TITLE (RID_UUI_START + 55) +#define STR_ENTER_PASSWORD_TO_OPEN (RID_UUI_START + 56) +#define STR_ENTER_PASSWORD_TO_MODIFY (RID_UUI_START + 57) -#define ERRCODE_UUI_IO_ABORT (ERRCODE_AREA_UUI + 0) -#define ERRCODE_UUI_IO_ACCESSDENIED (ERRCODE_AREA_UUI + 1) -#define ERRCODE_UUI_IO_ALREADYEXISTS (ERRCODE_AREA_UUI + 2) -#define ERRCODE_UUI_IO_BADCRC (ERRCODE_AREA_UUI + 3) -#define ERRCODE_UUI_IO_CANTCREATE (ERRCODE_AREA_UUI + 4) -#define ERRCODE_UUI_IO_CANTREAD (ERRCODE_AREA_UUI + 5) -#define ERRCODE_UUI_IO_CANTSEEK (ERRCODE_AREA_UUI + 6) -#define ERRCODE_UUI_IO_CANTTELL (ERRCODE_AREA_UUI + 7) -#define ERRCODE_UUI_IO_CANTWRITE (ERRCODE_AREA_UUI + 8) -#define ERRCODE_UUI_IO_CURRENTDIR (ERRCODE_AREA_UUI + 9) -#define ERRCODE_UUI_IO_NOTREADY (ERRCODE_AREA_UUI + 10) -#define ERRCODE_UUI_IO_NOTSAMEDEVICE (ERRCODE_AREA_UUI + 11) -#define ERRCODE_UUI_IO_GENERAL (ERRCODE_AREA_UUI + 12) -#define ERRCODE_UUI_IO_INVALIDACCESS (ERRCODE_AREA_UUI + 13) -#define ERRCODE_UUI_IO_INVALIDCHAR (ERRCODE_AREA_UUI + 14) -#define ERRCODE_UUI_IO_INVALIDDEVICE (ERRCODE_AREA_UUI + 15) -#define ERRCODE_UUI_IO_INVALIDLENGTH (ERRCODE_AREA_UUI + 16) -#define ERRCODE_UUI_IO_INVALIDPARAMETER (ERRCODE_AREA_UUI + 17) -#define ERRCODE_UUI_IO_ISWILDCARD (ERRCODE_AREA_UUI + 18) -#define ERRCODE_UUI_IO_LOCKVIOLATION (ERRCODE_AREA_UUI + 19) -#define ERRCODE_UUI_IO_MISPLACEDCHAR (ERRCODE_AREA_UUI + 20) -#define ERRCODE_UUI_IO_NAMETOOLONG (ERRCODE_AREA_UUI + 21) -#define ERRCODE_UUI_IO_NOTEXISTS (ERRCODE_AREA_UUI + 22) -#define ERRCODE_UUI_IO_NOTEXISTSPATH (ERRCODE_AREA_UUI + 23) -#define ERRCODE_UUI_IO_NOTSUPPORTED (ERRCODE_AREA_UUI + 24) -#define ERRCODE_UUI_IO_NOTADIRECTORY (ERRCODE_AREA_UUI + 25) -#define ERRCODE_UUI_IO_NOTAFILE (ERRCODE_AREA_UUI + 26) -#define ERRCODE_UUI_IO_OUTOFSPACE (ERRCODE_AREA_UUI + 27) -#define ERRCODE_UUI_IO_TOOMANYOPENFILES (ERRCODE_AREA_UUI + 28) -#define ERRCODE_UUI_IO_OUTOFMEMORY (ERRCODE_AREA_UUI + 29) -#define ERRCODE_UUI_IO_PENDING (ERRCODE_AREA_UUI + 30) -#define ERRCODE_UUI_IO_RECURSIVE (ERRCODE_AREA_UUI + 31) -#define ERRCODE_UUI_IO_UNKNOWN (ERRCODE_AREA_UUI + 32) -#define ERRCODE_UUI_IO_WRITEPROTECTED (ERRCODE_AREA_UUI + 33) -#define ERRCODE_UUI_IO_WRONGFORMAT (ERRCODE_AREA_UUI + 34) -#define ERRCODE_UUI_IO_WRONGVERSION (ERRCODE_AREA_UUI + 35) -#define ERRCODE_UUI_IO_NOTEXISTS_VOLUME (ERRCODE_AREA_UUI + 36) -#define ERRCODE_UUI_IO_NOTEXISTS_FOLDER (ERRCODE_AREA_UUI + 37) -#define ERRCODE_UUI_WRONGJAVA (ERRCODE_AREA_UUI + 38) -#define ERRCODE_UUI_WRONGJAVA_VERSION (ERRCODE_AREA_UUI + 39) -#define ERRCODE_UUI_WRONGJAVA_MIN (ERRCODE_AREA_UUI + 40) -#define ERRCODE_UUI_WRONGJAVA_VERSION_MIN (ERRCODE_AREA_UUI + 41) -#define ERRCODE_UUI_BADPARTNERSHIP (ERRCODE_AREA_UUI + 42) -#define ERRCODE_UUI_BADPARTNERSHIP_NAME (ERRCODE_AREA_UUI + 43) -#define ERRCODE_UUI_IO_NOTREADY_VOLUME (ERRCODE_AREA_UUI + 44) -#define ERRCODE_UUI_IO_NOTREADY_REMOVABLE (ERRCODE_AREA_UUI + 45) -#define ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE (ERRCODE_AREA_UUI + 46) -#define ERRCODE_UUI_WRONGMEDIUM (ERRCODE_AREA_UUI + 47) -#define ERRCODE_UUI_IO_CANTCREATE_NONAME (ERRCODE_AREA_UUI + 48) -#define ERRCODE_UUI_IO_TARGETALREADYEXISTS (ERRCODE_AREA_UUI + 49) -#define ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE (ERRCODE_AREA_UUI + 50) -#define ERRCODE_UUI_IO_BROKENPACKAGE (ERRCODE_AREA_UUI + 51) -#define ERRCODE_UUI_IO_BROKENPACKAGE_CANTREPAIR (ERRCODE_AREA_UUI + 52) -#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE (ERRCODE_AREA_UUI + 53) -#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE (ERRCODE_AREA_UUI + 54) -#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING (ERRCODE_AREA_UUI + 55) -#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING_WITHRECOVER (ERRCODE_AREA_UUI + 56) -#define ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA (ERRCODE_AREA_UUI + 57) -#define ERRCODE_UUI_IO_MODULESIZEEXCEEDED (ERRCODE_AREA_UUI + 58) -#define ERRCODE_UUI_LOCKING_LOCKED (ERRCODE_AREA_UUI + 59) -#define ERRCODE_UUI_LOCKING_LOCKED_SELF (ERRCODE_AREA_UUI + 60) -#define ERRCODE_UUI_LOCKING_NOT_LOCKED (ERRCODE_AREA_UUI + 61) -#define ERRCODE_UUI_LOCKING_LOCK_EXPIRED (ERRCODE_AREA_UUI + 62) +#define ERRCODE_UUI_IO_ABORT (ERRCODE_AREA_UUI + 0) +#define ERRCODE_UUI_IO_ACCESSDENIED (ERRCODE_AREA_UUI + 1) +#define ERRCODE_UUI_IO_ALREADYEXISTS (ERRCODE_AREA_UUI + 2) +#define ERRCODE_UUI_IO_BADCRC (ERRCODE_AREA_UUI + 3) +#define ERRCODE_UUI_IO_CANTCREATE (ERRCODE_AREA_UUI + 4) +#define ERRCODE_UUI_IO_CANTREAD (ERRCODE_AREA_UUI + 5) +#define ERRCODE_UUI_IO_CANTSEEK (ERRCODE_AREA_UUI + 6) +#define ERRCODE_UUI_IO_CANTTELL (ERRCODE_AREA_UUI + 7) +#define ERRCODE_UUI_IO_CANTWRITE (ERRCODE_AREA_UUI + 8) +#define ERRCODE_UUI_IO_CURRENTDIR (ERRCODE_AREA_UUI + 9) +#define ERRCODE_UUI_IO_NOTREADY (ERRCODE_AREA_UUI + 10) +#define ERRCODE_UUI_IO_NOTSAMEDEVICE (ERRCODE_AREA_UUI + 11) +#define ERRCODE_UUI_IO_GENERAL (ERRCODE_AREA_UUI + 12) +#define ERRCODE_UUI_IO_INVALIDACCESS (ERRCODE_AREA_UUI + 13) +#define ERRCODE_UUI_IO_INVALIDCHAR (ERRCODE_AREA_UUI + 14) +#define ERRCODE_UUI_IO_INVALIDDEVICE (ERRCODE_AREA_UUI + 15) +#define ERRCODE_UUI_IO_INVALIDLENGTH (ERRCODE_AREA_UUI + 16) +#define ERRCODE_UUI_IO_INVALIDPARAMETER (ERRCODE_AREA_UUI + 17) +#define ERRCODE_UUI_IO_ISWILDCARD (ERRCODE_AREA_UUI + 18) +#define ERRCODE_UUI_IO_LOCKVIOLATION (ERRCODE_AREA_UUI + 19) +#define ERRCODE_UUI_IO_MISPLACEDCHAR (ERRCODE_AREA_UUI + 20) +#define ERRCODE_UUI_IO_NAMETOOLONG (ERRCODE_AREA_UUI + 21) +#define ERRCODE_UUI_IO_NOTEXISTS (ERRCODE_AREA_UUI + 22) +#define ERRCODE_UUI_IO_NOTEXISTSPATH (ERRCODE_AREA_UUI + 23) +#define ERRCODE_UUI_IO_NOTSUPPORTED (ERRCODE_AREA_UUI + 24) +#define ERRCODE_UUI_IO_NOTADIRECTORY (ERRCODE_AREA_UUI + 25) +#define ERRCODE_UUI_IO_NOTAFILE (ERRCODE_AREA_UUI + 26) +#define ERRCODE_UUI_IO_OUTOFSPACE (ERRCODE_AREA_UUI + 27) +#define ERRCODE_UUI_IO_TOOMANYOPENFILES (ERRCODE_AREA_UUI + 28) +#define ERRCODE_UUI_IO_OUTOFMEMORY (ERRCODE_AREA_UUI + 29) +#define ERRCODE_UUI_IO_PENDING (ERRCODE_AREA_UUI + 30) +#define ERRCODE_UUI_IO_RECURSIVE (ERRCODE_AREA_UUI + 31) +#define ERRCODE_UUI_IO_UNKNOWN (ERRCODE_AREA_UUI + 32) +#define ERRCODE_UUI_IO_WRITEPROTECTED (ERRCODE_AREA_UUI + 33) +#define ERRCODE_UUI_IO_WRONGFORMAT (ERRCODE_AREA_UUI + 34) +#define ERRCODE_UUI_IO_WRONGVERSION (ERRCODE_AREA_UUI + 35) +#define ERRCODE_UUI_IO_NOTEXISTS_VOLUME (ERRCODE_AREA_UUI + 36) +#define ERRCODE_UUI_IO_NOTEXISTS_FOLDER (ERRCODE_AREA_UUI + 37) +#define ERRCODE_UUI_WRONGJAVA (ERRCODE_AREA_UUI + 38) +#define ERRCODE_UUI_WRONGJAVA_VERSION (ERRCODE_AREA_UUI + 39) +#define ERRCODE_UUI_WRONGJAVA_MIN (ERRCODE_AREA_UUI + 40) +#define ERRCODE_UUI_WRONGJAVA_VERSION_MIN (ERRCODE_AREA_UUI + 41) +#define ERRCODE_UUI_BADPARTNERSHIP (ERRCODE_AREA_UUI + 42) +#define ERRCODE_UUI_BADPARTNERSHIP_NAME (ERRCODE_AREA_UUI + 43) +#define ERRCODE_UUI_IO_NOTREADY_VOLUME (ERRCODE_AREA_UUI + 44) +#define ERRCODE_UUI_IO_NOTREADY_REMOVABLE (ERRCODE_AREA_UUI + 45) +#define ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE (ERRCODE_AREA_UUI + 46) +#define ERRCODE_UUI_WRONGMEDIUM (ERRCODE_AREA_UUI + 47) +#define ERRCODE_UUI_IO_CANTCREATE_NONAME (ERRCODE_AREA_UUI + 48) +#define ERRCODE_UUI_IO_TARGETALREADYEXISTS (ERRCODE_AREA_UUI + 49) +#define ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE (ERRCODE_AREA_UUI + 50) +#define ERRCODE_UUI_IO_BROKENPACKAGE (ERRCODE_AREA_UUI + 51) +#define ERRCODE_UUI_IO_BROKENPACKAGE_CANTREPAIR (ERRCODE_AREA_UUI + 52) +#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE (ERRCODE_AREA_UUI + 53) +#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE (ERRCODE_AREA_UUI + 54) +#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING (ERRCODE_AREA_UUI + 55) +#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING_WITHRECOVER (ERRCODE_AREA_UUI + 56) +#define ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA (ERRCODE_AREA_UUI + 57) +#define ERRCODE_UUI_IO_MODULESIZEEXCEEDED (ERRCODE_AREA_UUI + 58) +#define ERRCODE_UUI_LOCKING_LOCKED (ERRCODE_AREA_UUI + 59) +#define ERRCODE_UUI_LOCKING_LOCKED_SELF (ERRCODE_AREA_UUI + 60) +#define ERRCODE_UUI_LOCKING_NOT_LOCKED (ERRCODE_AREA_UUI + 61) +#define ERRCODE_UUI_LOCKING_LOCK_EXPIRED (ERRCODE_AREA_UUI + 62) -#define ERRCODE_AREA_UUI_UNKNOWNAUTH 25000 -#define SSLWARN_TYPE_DOMAINMISMATCH 10 -#define SSLWARN_TYPE_EXPIRED 20 -#define SSLWARN_TYPE_INVALID 30 +#define ERRCODE_AREA_UUI_UNKNOWNAUTH 25000 +#define SSLWARN_TYPE_DOMAINMISMATCH 10 +#define SSLWARN_TYPE_EXPIRED 20 +#define SSLWARN_TYPE_INVALID 30 #define ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED (ERRCODE_AREA_UUI_UNKNOWNAUTH + 1) @@ -170,17 +173,17 @@ #define ERRCODE_UUI_SSLWARN_INVALID_1 (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_INVALID + 1) #define TITLE_UUI_SSLWARN_INVALID (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_INVALID + 3) -#define HID_DLG_LOGIN (HID_UUI_START + 0) -#define HID_DLG_COOKIES (HID_UUI_START + 1) -#define HID_DLG_MASTERPASSWORD_UUI (HID_UUI_START+2) -#define HID_DLG_MASTERPASSWORD_CRT (HID_UUI_START+3) -#define HID_DLG_FILTER_SELECT (HID_UUI_START+4) -#define HID_DLG_PASSWORD_UUI (HID_UUI_START+5) -#define HID_DLG_PASSWORD_CRT (HID_UUI_START+6) -#define HID_DLG_UNKNOWNAUTH_UUI (HID_UUI_START+7) -#define HID_DLG_SSLWARN_UUI (HID_UUI_START+8) -#define HID_XMLSECDLG_MACROWARN (HID_UUI_START+9) -#define HID_DLG_NEWERVERSIONWARNING (HID_UUI_START+10) +#define HID_DLG_LOGIN (HID_UUI_START + 0) +#define HID_DLG_COOKIES (HID_UUI_START + 1) +#define HID_DLG_MASTERPASSWORD_UUI (HID_UUI_START + 2) +#define HID_DLG_MASTERPASSWORD_CRT (HID_UUI_START + 3) +#define HID_DLG_FILTER_SELECT (HID_UUI_START + 4) +#define HID_DLG_PASSWORD_UUI (HID_UUI_START + 5) +#define HID_DLG_PASSWORD_CRT (HID_UUI_START + 6) +#define HID_DLG_UNKNOWNAUTH_UUI (HID_UUI_START + 7) +#define HID_DLG_SSLWARN_UUI (HID_UUI_START + 8) +#define HID_XMLSECDLG_MACROWARN (HID_UUI_START + 9) +#define HID_DLG_NEWERVERSIONWARNING (HID_UUI_START +10) // HID_UUI_END (aka HID_CHAOS_NEW_DATABASE) is reserved in // sfx2/util/hidother.src diff --git a/uui/source/passworddlg.cxx b/uui/source/passworddlg.cxx old mode 100644 new mode 100755 index 4a2c584cf123..eaba330c85ec --- a/uui/source/passworddlg.cxx +++ b/uui/source/passworddlg.cxx @@ -51,30 +51,34 @@ IMPL_LINK( PasswordDialog, OKHdl_Impl, OKButton *, EMPTYARG ) // ----------------------------------------------------------------------- -PasswordDialog::PasswordDialog -( +PasswordDialog::PasswordDialog( Window* _pParent, ::com::sun::star::task::PasswordRequestMode nDlgMode, ResMgr * pResMgr, - rtl::OUString& aDocURL - ) + rtl::OUString& aDocURL, + bool bOpenToModify ) + :ModalDialog( _pParent, ResId( DLG_UUI_PASSWORD, *pResMgr ) ) - ,aFTPassword ( this, ResId( FT_PASSWORD, *pResMgr ) ) - ,aEDPassword ( this, ResId( ED_PASSWORD, *pResMgr ) ) - ,aOKBtn ( this, ResId( BTN_PASSWORD_OK, *pResMgr ) ) - ,aCancelBtn ( this, ResId( BTN_PASSWORD_CANCEL, *pResMgr ) ) - ,aHelpBtn ( this, ResId( BTN_PASSWORD_HELP, *pResMgr ) ) - ,aFixedLine1 ( this, ResId( FL_FIXED_LINE_1, *pResMgr ) ) - ,nDialogMode ( nDlgMode ) - ,pResourceMgr ( pResMgr ) + ,aFTPassword( this, ResId( FT_PASSWORD, *pResMgr )) + ,aEDPassword( this, ResId( ED_PASSWORD, *pResMgr )) + ,aOKBtn ( this, ResId( BTN_PASSWORD_OK, *pResMgr )) + ,aCancelBtn ( this, ResId( BTN_PASSWORD_CANCEL, *pResMgr )) + ,aHelpBtn ( this, ResId( BTN_PASSWORD_HELP, *pResMgr )) + ,aFixedLine1( this, ResId( FL_FIXED_LINE_1, *pResMgr )) + ,nDialogMode( nDlgMode ) + ,pResourceMgr ( pResMgr ) { if( nDialogMode == ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER ) { - String aErrorMsg( ResId( STR_ERROR_PASSWORD_WRONG, *pResourceMgr )); + USHORT nErrStrId = bOpenToModify ? STR_ERROR_PASSWORD_TO_MODIFY_WRONG : STR_ERROR_PASSWORD_TO_OPEN_WRONG; + String aErrorMsg( ResId( nErrStrId, *pResourceMgr )); ErrorBox aErrorBox( _pParent, WB_OK, aErrorMsg ); aErrorBox.Execute(); } + USHORT nStrId = bOpenToModify ? STR_ENTER_PASSWORD_TO_MODIFY : STR_ENTER_PASSWORD_TO_OPEN; + aFTPassword.SetText( String( ResId( nStrId, *pResourceMgr ) ) ); + FreeResource(); aFTPassword.SetText( aFTPassword.GetText() + aDocURL ); diff --git a/uui/source/passworddlg.hxx b/uui/source/passworddlg.hxx old mode 100644 new mode 100755 index 75f65b456ac7..c5cb136022da --- a/uui/source/passworddlg.hxx +++ b/uui/source/passworddlg.hxx @@ -53,7 +53,7 @@ class PasswordDialog : public ModalDialog DECL_LINK( OKHdl_Impl, OKButton * ); public: - PasswordDialog( Window* pParent, ::com::sun::star::task::PasswordRequestMode nDlgMode, ResMgr * pResMgr, ::rtl::OUString& aDocURL ); + PasswordDialog( Window* pParent, ::com::sun::star::task::PasswordRequestMode nDlgMode, ResMgr * pResMgr, ::rtl::OUString& aDocURL, bool bOpenToModify = false ); String GetPassword() const { return aEDPassword.GetText(); } diff --git a/uui/source/passworddlg.src b/uui/source/passworddlg.src old mode 100644 new mode 100755 index c9b8dfe0847e..682d8921cf5b --- a/uui/source/passworddlg.src +++ b/uui/source/passworddlg.src @@ -46,11 +46,11 @@ ModalDialog DLG_UUI_PASSWORD SVLook = TRUE ; Size = MAP_APPFONT( 145, 75 ); Text [ en-US ] = "Enter password"; + FixedText FT_PASSWORD { Pos = MAP_APPFONT( 3, 4 ); Size = MAP_APPFONT( 139, 28 ); - Text [ en-US ] = "Enter password to open file: \n"; WordBreak = TRUE; }; @@ -87,5 +87,15 @@ ModalDialog DLG_UUI_PASSWORD Pos = MAP_APPFONT( 0, 50 ); Size = MAP_APPFONT( 145, 6 ); }; + + String STR_ENTER_PASSWORD_TO_OPEN + { + Text [ en-US ] = "Enter password to open file: \n"; + }; + + String STR_ENTER_PASSWORD_TO_MODIFY + { + Text [ en-US ] = "Enter password to modify file: \n"; + }; }; diff --git a/uui/source/passworderrs.src b/uui/source/passworderrs.src old mode 100644 new mode 100755 index 90aa5688610e..1573cfbc8bb3 --- a/uui/source/passworderrs.src +++ b/uui/source/passworderrs.src @@ -34,9 +34,14 @@ #include #endif -String STR_ERROR_PASSWORD_WRONG +String STR_ERROR_PASSWORD_TO_OPEN_WRONG { - Text [ en-US ] = "The password is incorrect. The document cannot be opened."; + Text [ en-US ] = "The password is incorrect. The file cannot be opened."; +}; + +String STR_ERROR_PASSWORD_TO_MODIFY_WRONG +{ + Text [ en-US ] = "The password is incorrect. The file cannot be modified."; }; String STR_ERROR_MASTERPASSWORD_WRONG -- cgit From 8e594b080d8d542b1cdd9a2b90bd79215fb72ff8 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 4 Mar 2010 13:39:59 +0100 Subject: tl78: #i109779# add SID_MODIFYPASSWORDHASH --- sfx2/inc/sfx2/sfxsids.hrc | 3 ++- sfx2/sdi/sfx.sdi | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index bcbb39c96638..8ec890d3f2c4 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -575,7 +575,8 @@ #define SID_ACTIVATE_STYLE_APPLY (SID_SFX_START + 1715) #define SID_FONT_NAME (SID_SFX_START + 1716) #define SID_DEFAULTFILENAME (SID_SFX_START + 1717) -#define SID_SFX_free_START (SID_SFX_START + 1718) +#define SID_MODIFYPASSWORDHASH (SID_SFX_START + 1718) +#define SID_SFX_free_START (SID_SFX_START + 1719) #define SID_SFX_free_END (SID_SFX_START + 3999) #define SID_OPEN_NEW_VIEW (SID_SFX_START + 520) diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 26f55ccdd178..29797a258ea2 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3993,6 +3993,33 @@ SfxVoidItem MacroOrganizer SID_MACROORGANIZER GroupId = GID_MACRO; ] +//-------------------------------------------------------------------------- +SfxInt32Item ModifyPasswordHash SID_MODIFYPASSWORDHASH + +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = TRUE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = TRUE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = ; +] + //-------------------------------------------------------------------------- SfxVoidItem RunMacro SID_RUNMACRO () -- cgit From 8a44a90d32ee4dd2e9b3813e485ed4c0fe30cb12 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 4 Mar 2010 16:14:56 +0100 Subject: #i109634# password to open/modify dialog --- uui/source/iahndl-authentication.cxx | 92 +++++++++++++++++++++--------------- uui/source/loginerr.hxx | 12 +++++ 2 files changed, 66 insertions(+), 38 deletions(-) mode change 100644 => 100755 uui/source/loginerr.hxx diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index 18c8d94b573a..e910d27d1132 100755 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -31,6 +31,7 @@ #include "com/sun/star/task/DocumentPasswordRequest.hpp" #include "com/sun/star/task/DocumentPasswordRequest2.hpp" #include "com/sun/star/task/DocumentMSPasswordRequest.hpp" +#include "com/sun/star/task/DocumentMSPasswordRequest2.hpp" #include "com/sun/star/task/MasterPasswordRequest.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionPassword.hpp" @@ -43,6 +44,7 @@ #include "vos/mutex.hxx" #include "tools/errcode.hxx" #include "vcl/msgbox.hxx" +#include "vcl/abstdlg.hxx" #include "vcl/svapp.hxx" #include "ids.hrc" @@ -72,10 +74,8 @@ executeLoginDialog( { vos::OGuard aGuard(Application::GetSolarMutex()); - bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT) - != 0; - bool bSavePassword = rInfo.GetIsPersistentPassword() - || rInfo.GetIsSavePassword(); + bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT) != 0; + bool bSavePassword = rInfo.GetIsPersistentPassword() || rInfo.GetIsSavePassword(); bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials(); sal_uInt16 nFlags = 0; @@ -94,15 +94,10 @@ executeLoginDialog( if (!bCanUseSysCreds) nFlags |= LF_NO_USESYSCREDS; - std::auto_ptr< ResMgr > xManager( - ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui))); + std::auto_ptr< ResMgr > xManager( ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui))); UniString aRealm(rRealm); std::auto_ptr< LoginDialog > xDialog( - new LoginDialog(pParent, - nFlags, - rInfo.GetServer(), - &aRealm, - xManager.get())); + new LoginDialog( pParent, nFlags, rInfo.GetServer(), &aRealm, xManager.get())); if (rInfo.GetErrorText().Len() != 0) xDialog->SetErrorText(rInfo.GetErrorText()); xDialog->SetName(rInfo.GetUserName()); @@ -114,17 +109,14 @@ executeLoginDialog( if (bSavePassword) { - xDialog-> - SetSavePasswordText(ResId(rInfo.GetIsPersistentPassword() ? - RID_SAVE_PASSWORD : - RID_KEEP_PASSWORD, - *xManager.get())); + sal_uInt32 nResId = rInfo.GetIsPersistentPassword() ? + RID_SAVE_PASSWORD : RID_KEEP_PASSWORD; + xDialog->SetSavePasswordText( ResId( nResId, *xManager.get()) ); xDialog->SetSavePassword(rInfo.GetIsSavePassword()); } if ( bCanUseSysCreds ) - xDialog->SetUseSystemCredentials( - rInfo.GetIsUseSystemCredentials() ); + xDialog->SetUseSystemCredentials( rInfo.GetIsUseSystemCredentials() ); rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL); @@ -423,7 +415,8 @@ executePasswordDialog( LoginErrorInfo & rInfo, task::PasswordRequestMode nMode, ::rtl::OUString aDocName, - bool bMSCryptoMode) + bool bMSCryptoMode, + bool bIsPasswordToModify ) SAL_THROW((uno::RuntimeException)) { try @@ -434,23 +427,25 @@ executePasswordDialog( ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui))); if( nMode == task::PasswordRequestMode_PASSWORD_CREATE ) { - std::auto_ptr< PasswordCreateDialog > xDialog( - new PasswordCreateDialog(pParent, - xManager.get(), - bMSCryptoMode)); + const sal_uInt16 nMaxPasswdLen = bMSCryptoMode ? 15 : 0; // 0 -> allow any length - rInfo.SetResult(xDialog->Execute() - == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL); - rInfo.SetPassword( xDialog->GetPassword() ); + VclAbstractDialogFactory * pFact = VclAbstractDialogFactory::Create(); + std::auto_ptr< AbstractPasswordToOpenModifyDialog > pDialog( + pFact->CreatePasswordToOpenModifyDialog( pParent, 0, nMaxPasswdLen ) ); + + rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL ); + rInfo.SetPasswordToOpen( pDialog->GetPasswordToOpen() ); + rInfo.SetPasswordToModify( pDialog->GetPasswordToModify() ); + rInfo.SetRecommendToOpenReadonly( pDialog->IsRecommendToOpenReadonly() ); } else { - std::auto_ptr< PasswordDialog > xDialog( - new PasswordDialog(pParent, nMode, xManager.get(), aDocName)); + std::auto_ptr< PasswordDialog > pDialog( + new PasswordDialog( pParent, nMode, xManager.get(), aDocName, bIsPasswordToModify ) ); - rInfo.SetResult(xDialog->Execute() - == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL); - rInfo.SetPassword( xDialog->GetPassword() ); + rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL ); + rInfo.SetPasswordToOpen( bIsPasswordToModify ? String() : pDialog->GetPassword() ); + rInfo.SetPasswordToModify( bIsPasswordToModify ? pDialog->GetPassword() : String() ); } } catch (std::bad_alloc const &) @@ -468,7 +463,8 @@ handlePasswordRequest_( uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations, ::rtl::OUString aDocumentName, - bool bMSCryptoMode ) + bool bMSCryptoMode, + bool bIsPasswordToModify ) SAL_THROW((uno::RuntimeException)) { uno::Reference< task::XInteractionRetry > xRetry; @@ -477,11 +473,8 @@ handlePasswordRequest_( getContinuations(rContinuations, &xRetry, &xAbort, &xPassword); LoginErrorInfo aInfo; - executePasswordDialog(pParent, - aInfo, - nMode, - aDocumentName, - bMSCryptoMode); + executePasswordDialog( pParent, aInfo, nMode, + aDocumentName, bMSCryptoMode, bIsPasswordToModify ); switch (aInfo.GetResult()) { @@ -575,6 +568,17 @@ UUIInteractionHelper::handlePasswordRequest( uno::Any aAnyRequest(rRequest->getRequest()); + task::DocumentPasswordRequest2 aDocumentPasswordRequest2; + if (!bDoHandleRequest && (aAnyRequest >>= aDocumentPasswordRequest2)) + { + nMode = aDocumentPasswordRequest2.Mode; + aDocumentName = aDocumentPasswordRequest2.Name; + OSL_ENSURE( bMSCryptoMode == false, "bMSCryptoMode should be false" ); + bIsPasswordToModify = aDocumentPasswordRequest2.IsRequestPasswordToModify; + + bDoHandleRequest = true; + } + task::DocumentPasswordRequest aDocumentPasswordRequest; if (!bDoHandleRequest && (aAnyRequest >>= aDocumentPasswordRequest)) { @@ -586,6 +590,17 @@ UUIInteractionHelper::handlePasswordRequest( bDoHandleRequest = true; } + task::DocumentMSPasswordRequest2 aDocumentMSPasswordRequest2; + if (!bDoHandleRequest && (aAnyRequest >>= aDocumentMSPasswordRequest2)) + { + nMode = aDocumentMSPasswordRequest2.Mode; + aDocumentName = aDocumentMSPasswordRequest2.Name; + bMSCryptoMode = true; + bIsPasswordToModify = aDocumentPasswordRequest2.IsRequestPasswordToModify; + + bDoHandleRequest = true; + } + task::DocumentMSPasswordRequest aDocumentMSPasswordRequest; if (!bDoHandleRequest && (aAnyRequest >>= aDocumentMSPasswordRequest)) { @@ -599,7 +614,8 @@ UUIInteractionHelper::handlePasswordRequest( if (bDoHandleRequest) { - handlePasswordRequest_( pParent, nMode, rContinuations, aDocumentName, bMSCryptoMode ); + handlePasswordRequest_( pParent, nMode, rContinuations, + aDocumentName, bMSCryptoMode, bIsPasswordToModify ); return true; } diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx old mode 100644 new mode 100755 index 6fc00c3b1eac..c09917ae04fe --- a/uui/source/loginerr.hxx +++ b/uui/source/loginerr.hxx @@ -50,10 +50,13 @@ private: String _aAccount; String _aUserName; String _aPassword; + String _aPasswordToOpen; + String _aPasswordToModify; String _aPath; String _aErrorText; BYTE _nFlags; USHORT _nRet; + bool _bRecommendToOpenReadonly; public: LoginErrorInfo() @@ -67,6 +70,9 @@ public: const String& GetAccount() const { return _aAccount; } const String& GetUserName() const { return _aUserName; } const String& GetPassword() const { return _aPassword; } + const String& GetPasswordToOpen() const { return _aPasswordToOpen; } + const String& GetPasswordToModify() const { return _aPasswordToModify; } + const bool IsRecommendToOpenReadonly() const { return _bRecommendToOpenReadonly; } const String& GetPath() const { return _aPath; } const String& GetErrorText() const { return _aErrorText; } BOOL GetIsPersistentPassword() const @@ -91,6 +97,12 @@ public: { _aUserName = aUserName; } void SetPassword( const String& aPassword ) { _aPassword = aPassword; } + void SetPasswordToOpen( const String& aPassword ) + { _aPasswordToOpen = aPassword; } + void SetPasswordToModify( const String& aPassword ) + { _aPasswordToModify = aPassword; } + void SetRecommendToOpenReadonly( bool bVal ) + { _bRecommendToOpenReadonly = bVal; } void SetPath( const String& aPath ) { _aPath = aPath; } void SetErrorText( const String& aErrorText ) -- cgit From 790814ab03bed7d1a05f36ce560292c5f25896a1 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 11 Mar 2010 15:22:09 +0100 Subject: #i110048# rearranging controls of the password dialog --- uui/source/logindlg.cxx | 153 +++++++++++++++++++--------------------- uui/source/logindlg.hrc | 16 +++-- uui/source/logindlg.hxx | 43 +++++------- uui/source/logindlg.src | 181 +++++++++++++++++++++++------------------------- 4 files changed, 188 insertions(+), 205 deletions(-) mode change 100644 => 100755 uui/source/logindlg.cxx mode change 100644 => 100755 uui/source/logindlg.hrc mode change 100644 => 100755 uui/source/logindlg.hxx mode change 100644 => 100755 uui/source/logindlg.src diff --git a/uui/source/logindlg.cxx b/uui/source/logindlg.cxx old mode 100644 new mode 100755 index 53ea243c9577..941c6c2558c8 --- a/uui/source/logindlg.cxx +++ b/uui/source/logindlg.cxx @@ -47,6 +47,14 @@ //............................................................................ //............................................................................ +static void lcl_Move( Window &rWin, long nOffset ) +{ + Point aTmp( rWin.GetPosPixel() ); + aTmp.Y() -= nOffset; + rWin.SetPosPixel( aTmp ); +} + + void LoginDialog::HideControls_Impl( USHORT nFlags ) { FASTBOOL bPathHide = FALSE; @@ -91,7 +99,8 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) if ( ( nFlags & LF_NO_ERRORTEXT ) == LF_NO_ERRORTEXT ) { aErrorInfo.Hide(); - aErrorGB.Hide(); + aErrorFT.Hide(); + aLogin1FL.Hide(); bErrorHide = TRUE; } @@ -110,53 +119,28 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) if ( bErrorHide ) { - long nOffset = aLoginGB.GetPosPixel().Y() - - aErrorGB.GetPosPixel().Y(); - Point aNewPnt = aRequestInfo.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aRequestInfo.SetPosPixel( aNewPnt ); - aNewPnt = aPathFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathFT.SetPosPixel( aNewPnt ); - aNewPnt = aPathED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathED.SetPosPixel( aNewPnt ); - aNewPnt = aPathInfo.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathInfo.SetPosPixel( aNewPnt ); - aNewPnt = aPathBtn.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathBtn.SetPosPixel( aNewPnt ); - aNewPnt = aNameFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aNameFT.SetPosPixel( aNewPnt ); - aNewPnt = aNameED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aNameED.SetPosPixel( aNewPnt ); - aNewPnt = aNameInfo.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aNameInfo.SetPosPixel( aNewPnt ); - aNewPnt = aPasswordFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPasswordFT.SetPosPixel( aNewPnt ); - aNewPnt = aPasswordED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPasswordED.SetPosPixel( aNewPnt ); - aNewPnt = aAccountFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aAccountFT.SetPosPixel( aNewPnt ); - aNewPnt = aAccountED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aAccountED.SetPosPixel( aNewPnt ); - aNewPnt = aSavePasswdBtn.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aSavePasswdBtn.SetPosPixel( aNewPnt ); - aNewPnt = aUseSysCredsCB.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aUseSysCredsCB.SetPosPixel( aNewPnt ); - aNewPnt = aLoginGB.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aLoginGB.SetPosPixel( aNewPnt ); + long nOffset = aRequestInfo.GetPosPixel().Y() - + aErrorFT.GetPosPixel().Y(); + lcl_Move( aRequestInfo, nOffset ); + lcl_Move( aLogin2FL, nOffset ); + lcl_Move( aPathFT, nOffset ); + lcl_Move( aPathED, nOffset ); + lcl_Move( aPathInfo, nOffset ); + lcl_Move( aPathBtn, nOffset ); + lcl_Move( aNameFT, nOffset ); + lcl_Move( aNameED, nOffset ); + lcl_Move( aNameInfo, nOffset ); + lcl_Move( aPasswordFT, nOffset ); + lcl_Move( aPasswordED, nOffset ); + lcl_Move( aAccountFT, nOffset ); + lcl_Move( aAccountED, nOffset ); + lcl_Move( aSavePasswdBtn, nOffset ); + lcl_Move( aUseSysCredsCB, nOffset ); + lcl_Move( aButtonsFL, nOffset ); + lcl_Move( aOKBtn, nOffset ); + lcl_Move( aCancelBtn, nOffset ); + lcl_Move( aHelpBtn, nOffset ); + Size aNewSiz = GetSizePixel(); aNewSiz.Height() -= nOffset; SetSizePixel( aNewSiz ); @@ -166,24 +150,20 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) { long nOffset = aNameED.GetPosPixel().Y() - aPathED.GetPosPixel().Y(); + lcl_Move( aNameFT, nOffset ); + lcl_Move( aNameED, nOffset ); + lcl_Move( aNameInfo, nOffset ); + lcl_Move( aPasswordFT, nOffset ); + lcl_Move( aPasswordED, nOffset ); + lcl_Move( aAccountFT, nOffset ); + lcl_Move( aAccountED, nOffset ); + lcl_Move( aSavePasswdBtn, nOffset ); + lcl_Move( aUseSysCredsCB, nOffset ); + lcl_Move( aButtonsFL, nOffset ); + lcl_Move( aOKBtn, nOffset ); + lcl_Move( aCancelBtn, nOffset ); + lcl_Move( aHelpBtn, nOffset ); - Point aTmpPnt1 = aNameFT.GetPosPixel(); - Point aTmpPnt2 = aPasswordFT.GetPosPixel(); - aNameFT.SetPosPixel( aPathFT.GetPosPixel() ); - aPasswordFT.SetPosPixel( aTmpPnt1 ); - aAccountFT.SetPosPixel( aTmpPnt2 ); - aTmpPnt1 = aNameED.GetPosPixel(); - aTmpPnt2 = aPasswordED.GetPosPixel(); - aNameED.SetPosPixel( aPathED.GetPosPixel() ); - aPasswordED.SetPosPixel( aTmpPnt1 ); - aAccountED.SetPosPixel( aTmpPnt2 ); - aNameInfo.SetPosPixel( aPathInfo.GetPosPixel() ); - aTmpPnt1 = aSavePasswdBtn.GetPosPixel(); - aTmpPnt1.Y() -= nOffset; - aSavePasswdBtn.SetPosPixel( aTmpPnt1 ); - aTmpPnt1 = aUseSysCredsCB.GetPosPixel(); - aTmpPnt1.Y() -= nOffset; - aUseSysCredsCB.SetPosPixel( aTmpPnt1 ); Size aNewSz = GetSizePixel(); aNewSz.Height() -= nOffset; SetSizePixel( aNewSz ); @@ -191,14 +171,15 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) if ( bAccountHide ) { - long nOffset = aAccountED.GetPosPixel().Y() - aPasswordED.GetPosPixel().Y(); - - Point aTmpPnt = aSavePasswdBtn.GetPosPixel(); - aTmpPnt.Y() -= nOffset; - aSavePasswdBtn.SetPosPixel( aTmpPnt ); - aTmpPnt = aUseSysCredsCB.GetPosPixel(); - aTmpPnt.Y() -= nOffset; - aUseSysCredsCB.SetPosPixel( aTmpPnt ); + long nOffset = aAccountED.GetPosPixel().Y() - + aPasswordED.GetPosPixel().Y(); + lcl_Move( aSavePasswdBtn, nOffset ); + lcl_Move( aUseSysCredsCB, nOffset ); + lcl_Move( aButtonsFL, nOffset ); + lcl_Move( aOKBtn, nOffset ); + lcl_Move( aCancelBtn, nOffset ); + lcl_Move( aHelpBtn, nOffset ); + Size aNewSz = GetSizePixel(); aNewSz.Height() -= nOffset; SetSizePixel( aNewSz ); @@ -208,6 +189,10 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) { long nOffset = aUseSysCredsCB.GetPosPixel().Y() - aSavePasswdBtn.GetPosPixel().Y(); + lcl_Move( aButtonsFL, nOffset ); + lcl_Move( aOKBtn, nOffset ); + lcl_Move( aCancelBtn, nOffset ); + lcl_Move( aHelpBtn, nOffset ); Size aNewSz = GetSizePixel(); aNewSz.Height() -= nOffset; @@ -219,7 +204,7 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) void LoginDialog::EnableUseSysCredsControls_Impl( BOOL bUseSysCredsEnabled ) { aErrorInfo.Enable( !bUseSysCredsEnabled ); - aErrorGB.Enable( !bUseSysCredsEnabled ); + aErrorFT.Enable( !bUseSysCredsEnabled ); aRequestInfo.Enable( !bUseSysCredsEnabled ); aPathFT.Enable( !bUseSysCredsEnabled ); aPathED.Enable( !bUseSysCredsEnabled ); @@ -282,23 +267,25 @@ LoginDialog::LoginDialog ModalDialog( pParent, ResId( DLG_UUI_LOGIN, *pResMgr ) ), - aErrorInfo ( this, ResId( INFO_LOGIN_ERROR, *pResMgr ) ), - aErrorGB ( this, ResId( GB_LOGIN_ERROR, *pResMgr ) ), - aRequestInfo ( this, ResId( INFO_LOGIN_REQUEST, *pResMgr ) ), + aErrorFT ( this, ResId( FT_LOGIN_ERROR, *pResMgr ) ), + aErrorInfo ( this, ResId( FT_INFO_LOGIN_ERROR, *pResMgr ) ), + aLogin1FL ( this, ResId( FL_LOGIN_1, *pResMgr ) ), + aRequestInfo ( this, ResId( FT_INFO_LOGIN_REQUEST, *pResMgr ) ), + aLogin2FL ( this, ResId( FL_LOGIN_2, *pResMgr ) ), aPathFT ( this, ResId( FT_LOGIN_PATH, *pResMgr ) ), aPathED ( this, ResId( ED_LOGIN_PATH, *pResMgr ) ), - aPathInfo ( this, ResId( INFO_LOGIN_PATH, *pResMgr ) ), + aPathInfo ( this, ResId( FT_INFO_LOGIN_PATH, *pResMgr ) ), aPathBtn ( this, ResId( BTN_LOGIN_PATH, *pResMgr ) ), aNameFT ( this, ResId( FT_LOGIN_USERNAME, *pResMgr ) ), aNameED ( this, ResId( ED_LOGIN_USERNAME, *pResMgr ) ), - aNameInfo ( this, ResId( INFO_LOGIN_USERNAME, *pResMgr ) ), + aNameInfo ( this, ResId( FT_INFO_LOGIN_USERNAME, *pResMgr ) ), aPasswordFT ( this, ResId( FT_LOGIN_PASSWORD, *pResMgr ) ), aPasswordED ( this, ResId( ED_LOGIN_PASSWORD, *pResMgr ) ), aAccountFT ( this, ResId( FT_LOGIN_ACCOUNT, *pResMgr ) ), aAccountED ( this, ResId( ED_LOGIN_ACCOUNT, *pResMgr ) ), aSavePasswdBtn ( this, ResId( CB_LOGIN_SAVEPASSWORD, *pResMgr ) ), aUseSysCredsCB ( this, ResId( CB_LOGIN_USESYSCREDS, *pResMgr ) ), - aLoginGB ( this, ResId( GB_LOGIN_LOGIN, *pResMgr ) ), + aButtonsFL ( this, ResId( FL_BUTTONS, *pResMgr ) ), aOKBtn ( this, ResId( BTN_LOGIN_OK, *pResMgr ) ), aCancelBtn ( this, ResId( BTN_LOGIN_CANCEL, *pResMgr ) ), aHelpBtn ( this, ResId( BTN_LOGIN_HELP, *pResMgr ) ) @@ -333,6 +320,12 @@ LoginDialog::LoginDialog // ----------------------------------------------------------------------- +LoginDialog::~LoginDialog() +{ +} + +// ----------------------------------------------------------------------- + void LoginDialog::SetName( const String& rNewName ) { aNameED.SetText( rNewName ); diff --git a/uui/source/logindlg.hrc b/uui/source/logindlg.hrc old mode 100644 new mode 100755 index 68162fb620cd..b6e1f52444fd --- a/uui/source/logindlg.hrc +++ b/uui/source/logindlg.hrc @@ -30,24 +30,26 @@ //============================================================================ -#define INFO_LOGIN_ERROR 10 -#define GB_LOGIN_ERROR 11 +#define FT_INFO_LOGIN_ERROR 10 +#define FT_LOGIN_ERROR 11 -#define INFO_LOGIN_REQUEST 20 +#define FT_INFO_LOGIN_REQUEST 20 #define FT_LOGIN_PATH 21 #define ED_LOGIN_PATH 22 -#define INFO_LOGIN_PATH 23 +#define FT_INFO_LOGIN_PATH 23 #define BTN_LOGIN_PATH 24 #define FT_LOGIN_USERNAME 25 #define ED_LOGIN_USERNAME 26 -#define INFO_LOGIN_USERNAME 27 +#define FT_INFO_LOGIN_USERNAME 27 #define FT_LOGIN_PASSWORD 28 #define ED_LOGIN_PASSWORD 29 #define FT_LOGIN_ACCOUNT 30 #define ED_LOGIN_ACCOUNT 31 #define CB_LOGIN_SAVEPASSWORD 32 -#define GB_LOGIN_LOGIN 33 -#define CB_LOGIN_USESYSCREDS 34 +#define CB_LOGIN_USESYSCREDS 33 +#define FL_LOGIN_1 34 +#define FL_LOGIN_2 35 +#define FL_BUTTONS 36 #define BTN_LOGIN_OK 50 #define BTN_LOGIN_CANCEL 51 diff --git a/uui/source/logindlg.hxx b/uui/source/logindlg.hxx old mode 100644 new mode 100755 index 0a4637d89251..04ea8eb7523d --- a/uui/source/logindlg.hxx +++ b/uui/source/logindlg.hxx @@ -53,9 +53,11 @@ //============================================================================ class LoginDialog : public ModalDialog { + FixedText aErrorFT; FixedInfo aErrorInfo; - FixedLine aErrorGB; + FixedLine aLogin1FL; FixedInfo aRequestInfo; + FixedLine aLogin2FL; FixedText aPathFT; Edit aPathED; FixedInfo aPathInfo; @@ -69,7 +71,7 @@ class LoginDialog : public ModalDialog Edit aAccountED; CheckBox aSavePasswdBtn; CheckBox aUseSysCredsCB; - FixedLine aLoginGB; + FixedLine aButtonsFL; OKButton aOKBtn; CancelButton aCancelBtn; HelpButton aHelpBtn; @@ -85,32 +87,23 @@ public: LoginDialog( Window* pParent, USHORT nFlags, const String& rServer, const String* pRealm, ResMgr * pResMgr ); + virtual ~LoginDialog(); - String GetPath() const { return aPathED.GetText(); } - void SetPath( const String& rNewPath ) - { aPathED.SetText( rNewPath ); - aPathInfo.SetText( rNewPath );} - String GetName() const { return aNameED.GetText(); } + String GetPath() const { return aPathED.GetText(); } + void SetPath( const String& rNewPath ) { aPathED.SetText( rNewPath ); aPathInfo.SetText( rNewPath ); } + String GetName() const { return aNameED.GetText(); } void SetName( const String& rNewName ); - String GetPassword() const { return aPasswordED.GetText(); } - void SetPassword( const String& rNew ) - { aPasswordED.SetText( rNew ); } - String GetAccount() const { return aAccountED.GetText(); } - void SetAccount( const String& rNew ) - { aAccountED.SetText( rNew ); } - BOOL IsSavePassword() const - { return aSavePasswdBtn.IsChecked(); } - void SetSavePassword( BOOL bSave ) - { aSavePasswdBtn.Check( bSave ); } - void SetSavePasswordText( const String& rTxt ) - { aSavePasswdBtn.SetText( rTxt ); } - BOOL IsUseSystemCredentials() const - { return aUseSysCredsCB.IsChecked(); } + String GetPassword() const { return aPasswordED.GetText(); } + void SetPassword( const String& rNew ) { aPasswordED.SetText( rNew ); } + String GetAccount() const { return aAccountED.GetText(); } + void SetAccount( const String& rNew ) { aAccountED.SetText( rNew ); } + BOOL IsSavePassword() const { return aSavePasswdBtn.IsChecked(); } + void SetSavePassword( BOOL bSave ) { aSavePasswdBtn.Check( bSave ); } + void SetSavePasswordText( const String& rTxt ) { aSavePasswdBtn.SetText( rTxt ); } + BOOL IsUseSystemCredentials() const { return aUseSysCredsCB.IsChecked(); } void SetUseSystemCredentials( BOOL bUse ); - void SetErrorText( const String& rTxt ) - { aErrorInfo.SetText( rTxt ); } - void SetLoginRequestText( const String& rTxt ) - { aRequestInfo.SetText( rTxt ); } + void SetErrorText( const String& rTxt ) { aErrorInfo.SetText( rTxt ); } + void SetLoginRequestText( const String& rTxt ) { aRequestInfo.SetText( rTxt ); } void ClearPassword(); void ClearAccount(); }; diff --git a/uui/source/logindlg.src b/uui/source/logindlg.src old mode 100644 new mode 100755 index ce998f4945be..f997fb7b7f34 --- a/uui/source/logindlg.src +++ b/uui/source/logindlg.src @@ -16,7 +16,7 @@ * 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). + *(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 @@ -42,166 +42,161 @@ ModalDialog DLG_UUI_LOGIN Moveable = TRUE ; OutputSize = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 265 , 170 ) ; - FixedText INFO_LOGIN_ERROR + Size = MAP_APPFONT( 177 , 247 ) ; + Text [ en-US ] = "Authentication Required" ; + + FixedText FT_LOGIN_ERROR + { + Pos = MAP_APPFONT( 6 , 6 ) ; + Size = MAP_APPFONT( 165 , 8 ) ; + Text [ en-US ] = "Message from server:" ; + }; + + FixedText FT_INFO_LOGIN_ERROR { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 185 , 18 ) ; + Pos = MAP_APPFONT( 6 , 14 ) ; + Size = MAP_APPFONT( 185 , 3*8 ) ; WordBreak = TRUE ; }; - FixedLine GB_LOGIN_ERROR + + FixedLine FL_LOGIN_1 { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 197 , 8 ) ; - Text [ en-US ] = "Message from server" ; + Pos = MAP_APPFONT( 6 , 41 ) ; + Size = MAP_APPFONT( 165 , 8 ) ; }; - FixedText INFO_LOGIN_REQUEST + + FixedText FT_INFO_LOGIN_REQUEST { - Pos = MAP_APPFONT ( 12 , 55 ) ; - Size = MAP_APPFONT ( 185 , 18 ) ; + Pos = MAP_APPFONT( 6 , 52 ) ; + Size = MAP_APPFONT( 185 , 2*8 ) ; WordBreak = TRUE ; - Text [ en-US ] = "Enter the user name and password for %1 here." ; + Text [ en-US ] = "Enter user name and password for: \n%1" ; + }; + + String STR_LOGIN_REALM + { + Text [ en-US ] = "Enter user name and password for: \n\"%2\" on %1" ; + }; + + FixedLine FL_LOGIN_2 + { + Pos = MAP_APPFONT( 6 , 71 ) ; + Size = MAP_APPFONT( 165 , 8 ) ; }; + FixedText FT_LOGIN_PATH { - Pos = MAP_APPFONT ( 12 , 77 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; + Pos = MAP_APPFONT( 6 , 84 ) ; + Size = MAP_APPFONT( 112 , 8 ) ; Text [ en-US ] = "~Path" ; }; + Edit ED_LOGIN_PATH { Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 76 ) ; - Size = MAP_APPFONT ( 108 , 12 ) ; + Pos = MAP_APPFONT( 6 , 95 ) ; + Size = MAP_APPFONT( 112 , 12 ) ; }; - FixedText INFO_LOGIN_PATH + FixedText FT_INFO_LOGIN_PATH // used instead of ED_LOGIN_PATH when LF_PATH_READONLY is set { Hide = TRUE ; - Pos = MAP_APPFONT ( 72 , 77 ) ; - Size = MAP_APPFONT ( 125 , 10 ) ; + Pos = MAP_APPFONT( 6 , 97 ) ; + Size = MAP_APPFONT( 112 , 8 ) ; }; PushButton BTN_LOGIN_PATH { - Pos = MAP_APPFONT ( 183 , 75 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Text = "~..." ; + Pos = MAP_APPFONT( 121 , 94 ) ; + Size = MAP_APPFONT( 50 , 14 ) ; + Text = "~Browse..." ; }; + FixedText FT_LOGIN_USERNAME { - Pos = MAP_APPFONT ( 12 , 92 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; + Pos = MAP_APPFONT( 6 , 110 ) ; + Size = MAP_APPFONT( 106 , 8 ) ; Text [ en-US ] = "~User name" ; }; + Edit ED_LOGIN_USERNAME { Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 91 ) ; - Size = MAP_APPFONT ( 125 , 12 ) ; + Pos = MAP_APPFONT( 6 , 121 ) ; + Size = MAP_APPFONT( 165 , 12 ) ; }; - FixedText INFO_LOGIN_USERNAME + FixedText FT_INFO_LOGIN_USERNAME // used instead of ED_LOGIN_USERNAME when LF_USERNAME_READONLY is set { Hide = TRUE ; - Pos = MAP_APPFONT ( 72 , 92 ) ; - Size = MAP_APPFONT ( 125 , 10 ) ; + Pos = MAP_APPFONT( 6 , 123 ) ; + Size = MAP_APPFONT( 165 , 8 ) ; }; + FixedText FT_LOGIN_PASSWORD { - Pos = MAP_APPFONT ( 12 , 107 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; + Pos = MAP_APPFONT( 6 , 136 ) ; + Size = MAP_APPFONT( 165 , 8 ) ; Text [ en-US ] = "Pass~word" ; }; + Edit ED_LOGIN_PASSWORD { Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 106 ) ; - Size = MAP_APPFONT ( 125 , 12 ) ; + Pos = MAP_APPFONT( 6 , 147 ) ; + Size = MAP_APPFONT( 165 , 12 ) ; PassWord = TRUE ; }; + FixedText FT_LOGIN_ACCOUNT { - Pos = MAP_APPFONT ( 12 , 122 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; + Pos = MAP_APPFONT( 6 , 162 ) ; + Size = MAP_APPFONT( 165 , 8 ) ; Text [ en-US ] = "A~ccount"; }; + Edit ED_LOGIN_ACCOUNT { Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 121 ) ; - Size = MAP_APPFONT ( 125 , 12 ) ; + Pos = MAP_APPFONT( 6 , 173 ) ; + Size = MAP_APPFONT( 165 , 12 ) ; PassWord = TRUE ; }; + CheckBox CB_LOGIN_SAVEPASSWORD { - Pos = MAP_APPFONT ( 12 , 136 ) ; - Size = MAP_APPFONT ( 185 , 10 ) ; - Text [ en-US ] = "~Save password" ; + Pos = MAP_APPFONT( 6 , 190 ) ; + Size = MAP_APPFONT( 165 , 10 ) ; + Text [ en-US ] = "~Remember password" ; }; + CheckBox CB_LOGIN_USESYSCREDS { - Pos = MAP_APPFONT ( 12 , 148 ) ; - Size = MAP_APPFONT ( 185 , 10 ) ; - Text [ en-US ] = "~Use System Credentials" ; + Pos = MAP_APPFONT( 6 , 203 ) ; + Size = MAP_APPFONT( 165 , 10 ) ; + Text [ en-US ] = "~Use system credentials" ; }; - FixedLine GB_LOGIN_LOGIN + + FixedLine FL_BUTTONS { - Pos = MAP_APPFONT ( 7 , 44 ) ; - Size = MAP_APPFONT ( 197 , 8 ) ; - Text [ en-US ] = "Log in" ; + Pos = MAP_APPFONT( 0 , 216 ) ; + Size = MAP_APPFONT( 177 , 8 ) ; }; + OKButton BTN_LOGIN_OK { - Pos = MAP_APPFONT ( 209 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT( 6 , 227 ) ; + Size = MAP_APPFONT( 50 , 14 ) ; DefButton = TRUE ; }; + CancelButton BTN_LOGIN_CANCEL { - Pos = MAP_APPFONT ( 209 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT( 66 , 227 ) ; + Size = MAP_APPFONT( 50 , 14 ) ; }; + HelpButton BTN_LOGIN_HELP { - Pos = MAP_APPFONT ( 209 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - String STR_LOGIN_REALM - { - Text [ en-US ] = "Please enter user name and password for \"%2\" on %1 here." ; + Pos = MAP_APPFONT( 121 , 227 ) ; + Size = MAP_APPFONT( 50 , 14 ) ; }; - Text [ en-US ] = "User Name and Password Required" ; }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit From 3fa4688994df161df3742fcb75a54cc059276259 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 16 Mar 2010 11:35:19 +0100 Subject: cws tl79: #i110048# further changes to the LoginDialog --- uui/source/logindlg.cxx | 31 +++++++------------------------ uui/source/logindlg.hrc | 26 ++++++++++++-------------- uui/source/logindlg.hxx | 9 +++++---- uui/source/logindlg.src | 18 +++--------------- 4 files changed, 27 insertions(+), 57 deletions(-) diff --git a/uui/source/logindlg.cxx b/uui/source/logindlg.cxx index 941c6c2558c8..d7ded58b5dde 100755 --- a/uui/source/logindlg.cxx +++ b/uui/source/logindlg.cxx @@ -57,10 +57,10 @@ static void lcl_Move( Window &rWin, long nOffset ) void LoginDialog::HideControls_Impl( USHORT nFlags ) { - FASTBOOL bPathHide = FALSE; - FASTBOOL bErrorHide = FALSE; - FASTBOOL bAccountHide = FALSE; - FASTBOOL bUseSysCredsHide = FALSE; + bool bPathHide = FALSE; + bool bErrorHide = FALSE; + bool bAccountHide = FALSE; + bool bUseSysCredsHide = FALSE; if ( ( nFlags & LF_NO_PATH ) == LF_NO_PATH ) { @@ -71,9 +71,8 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) } else if ( ( nFlags & LF_PATH_READONLY ) == LF_PATH_READONLY ) { - aPathED.Hide(); - aPathInfo.Show(); - aPathBtn.Hide(); + aPathED.Enable( FALSE ); + aPathBtn.Enable( FALSE ); } if ( ( nFlags & LF_NO_USERNAME ) == LF_NO_USERNAME ) @@ -83,8 +82,7 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) } else if ( ( nFlags & LF_USERNAME_READONLY ) == LF_USERNAME_READONLY ) { - aNameED.Hide(); - aNameInfo.Show(); + aNameED.Enable( FALSE ); } if ( ( nFlags & LF_NO_PASSWORD ) == LF_NO_PASSWORD ) @@ -125,11 +123,9 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) lcl_Move( aLogin2FL, nOffset ); lcl_Move( aPathFT, nOffset ); lcl_Move( aPathED, nOffset ); - lcl_Move( aPathInfo, nOffset ); lcl_Move( aPathBtn, nOffset ); lcl_Move( aNameFT, nOffset ); lcl_Move( aNameED, nOffset ); - lcl_Move( aNameInfo, nOffset ); lcl_Move( aPasswordFT, nOffset ); lcl_Move( aPasswordED, nOffset ); lcl_Move( aAccountFT, nOffset ); @@ -152,7 +148,6 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) aPathED.GetPosPixel().Y(); lcl_Move( aNameFT, nOffset ); lcl_Move( aNameED, nOffset ); - lcl_Move( aNameInfo, nOffset ); lcl_Move( aPasswordFT, nOffset ); lcl_Move( aPasswordED, nOffset ); lcl_Move( aAccountFT, nOffset ); @@ -208,11 +203,9 @@ void LoginDialog::EnableUseSysCredsControls_Impl( BOOL bUseSysCredsEnabled ) aRequestInfo.Enable( !bUseSysCredsEnabled ); aPathFT.Enable( !bUseSysCredsEnabled ); aPathED.Enable( !bUseSysCredsEnabled ); - aPathInfo.Enable( !bUseSysCredsEnabled ); aPathBtn.Enable( !bUseSysCredsEnabled ); aNameFT.Enable( !bUseSysCredsEnabled ); aNameED.Enable( !bUseSysCredsEnabled ); - aNameInfo.Enable( !bUseSysCredsEnabled ); aPasswordFT.Enable( !bUseSysCredsEnabled ); aPasswordED.Enable( !bUseSysCredsEnabled ); aAccountFT.Enable( !bUseSysCredsEnabled ); @@ -274,11 +267,9 @@ LoginDialog::LoginDialog aLogin2FL ( this, ResId( FL_LOGIN_2, *pResMgr ) ), aPathFT ( this, ResId( FT_LOGIN_PATH, *pResMgr ) ), aPathED ( this, ResId( ED_LOGIN_PATH, *pResMgr ) ), - aPathInfo ( this, ResId( FT_INFO_LOGIN_PATH, *pResMgr ) ), aPathBtn ( this, ResId( BTN_LOGIN_PATH, *pResMgr ) ), aNameFT ( this, ResId( FT_LOGIN_USERNAME, *pResMgr ) ), aNameED ( this, ResId( ED_LOGIN_USERNAME, *pResMgr ) ), - aNameInfo ( this, ResId( FT_INFO_LOGIN_USERNAME, *pResMgr ) ), aPasswordFT ( this, ResId( FT_LOGIN_PASSWORD, *pResMgr ) ), aPasswordED ( this, ResId( ED_LOGIN_PASSWORD, *pResMgr ) ), aAccountFT ( this, ResId( FT_LOGIN_ACCOUNT, *pResMgr ) ), @@ -326,14 +317,6 @@ LoginDialog::~LoginDialog() // ----------------------------------------------------------------------- -void LoginDialog::SetName( const String& rNewName ) -{ - aNameED.SetText( rNewName ); - aNameInfo.SetText( rNewName ); -} - -// ----------------------------------------------------------------------- - void LoginDialog::SetUseSystemCredentials( BOOL bUse ) { if ( aUseSysCredsCB.IsVisible() ) diff --git a/uui/source/logindlg.hrc b/uui/source/logindlg.hrc index b6e1f52444fd..b541740bd768 100755 --- a/uui/source/logindlg.hrc +++ b/uui/source/logindlg.hrc @@ -36,20 +36,18 @@ #define FT_INFO_LOGIN_REQUEST 20 #define FT_LOGIN_PATH 21 #define ED_LOGIN_PATH 22 -#define FT_INFO_LOGIN_PATH 23 -#define BTN_LOGIN_PATH 24 -#define FT_LOGIN_USERNAME 25 -#define ED_LOGIN_USERNAME 26 -#define FT_INFO_LOGIN_USERNAME 27 -#define FT_LOGIN_PASSWORD 28 -#define ED_LOGIN_PASSWORD 29 -#define FT_LOGIN_ACCOUNT 30 -#define ED_LOGIN_ACCOUNT 31 -#define CB_LOGIN_SAVEPASSWORD 32 -#define CB_LOGIN_USESYSCREDS 33 -#define FL_LOGIN_1 34 -#define FL_LOGIN_2 35 -#define FL_BUTTONS 36 +#define BTN_LOGIN_PATH 23 +#define FT_LOGIN_USERNAME 24 +#define ED_LOGIN_USERNAME 25 +#define FT_LOGIN_PASSWORD 26 +#define ED_LOGIN_PASSWORD 27 +#define FT_LOGIN_ACCOUNT 28 +#define ED_LOGIN_ACCOUNT 29 +#define CB_LOGIN_SAVEPASSWORD 30 +#define CB_LOGIN_USESYSCREDS 31 +#define FL_LOGIN_1 32 +#define FL_LOGIN_2 33 +#define FL_BUTTONS 34 #define BTN_LOGIN_OK 50 #define BTN_LOGIN_CANCEL 51 diff --git a/uui/source/logindlg.hxx b/uui/source/logindlg.hxx index 04ea8eb7523d..05ba8e8d55d4 100755 --- a/uui/source/logindlg.hxx +++ b/uui/source/logindlg.hxx @@ -60,11 +60,9 @@ class LoginDialog : public ModalDialog FixedLine aLogin2FL; FixedText aPathFT; Edit aPathED; - FixedInfo aPathInfo; PushButton aPathBtn; FixedText aNameFT; Edit aNameED; - FixedInfo aNameInfo; FixedText aPasswordFT; Edit aPasswordED; FixedText aAccountFT; @@ -90,9 +88,9 @@ public: virtual ~LoginDialog(); String GetPath() const { return aPathED.GetText(); } - void SetPath( const String& rNewPath ) { aPathED.SetText( rNewPath ); aPathInfo.SetText( rNewPath ); } + void SetPath( const String& rNewPath ) { aPathED.SetText( rNewPath ); } String GetName() const { return aNameED.GetText(); } - void SetName( const String& rNewName ); + void SetName( const String& rNewName ) { aNameED.SetText( rNewName ); } String GetPassword() const { return aPasswordED.GetText(); } void SetPassword( const String& rNew ) { aPasswordED.SetText( rNew ); } String GetAccount() const { return aAccountED.GetText(); } @@ -108,6 +106,9 @@ public: void ClearAccount(); }; +// ----------------------------------------------------------------------- + + //............................................................................ //............................................................................ diff --git a/uui/source/logindlg.src b/uui/source/logindlg.src index f997fb7b7f34..c2683ea3d94c 100755 --- a/uui/source/logindlg.src +++ b/uui/source/logindlg.src @@ -55,7 +55,7 @@ ModalDialog DLG_UUI_LOGIN FixedText FT_INFO_LOGIN_ERROR { Pos = MAP_APPFONT( 6 , 14 ) ; - Size = MAP_APPFONT( 185 , 3*8 ) ; + Size = MAP_APPFONT( 165 , 3*8 ) ; WordBreak = TRUE ; }; @@ -68,7 +68,7 @@ ModalDialog DLG_UUI_LOGIN FixedText FT_INFO_LOGIN_REQUEST { Pos = MAP_APPFONT( 6 , 52 ) ; - Size = MAP_APPFONT( 185 , 2*8 ) ; + Size = MAP_APPFONT( 165 , 2*8 ) ; WordBreak = TRUE ; Text [ en-US ] = "Enter user name and password for: \n%1" ; }; @@ -97,12 +97,6 @@ ModalDialog DLG_UUI_LOGIN Pos = MAP_APPFONT( 6 , 95 ) ; Size = MAP_APPFONT( 112 , 12 ) ; }; - FixedText FT_INFO_LOGIN_PATH // used instead of ED_LOGIN_PATH when LF_PATH_READONLY is set - { - Hide = TRUE ; - Pos = MAP_APPFONT( 6 , 97 ) ; - Size = MAP_APPFONT( 112 , 8 ) ; - }; PushButton BTN_LOGIN_PATH { Pos = MAP_APPFONT( 121 , 94 ) ; @@ -113,7 +107,7 @@ ModalDialog DLG_UUI_LOGIN FixedText FT_LOGIN_USERNAME { Pos = MAP_APPFONT( 6 , 110 ) ; - Size = MAP_APPFONT( 106 , 8 ) ; + Size = MAP_APPFONT( 165 , 8 ) ; Text [ en-US ] = "~User name" ; }; @@ -123,12 +117,6 @@ ModalDialog DLG_UUI_LOGIN Pos = MAP_APPFONT( 6 , 121 ) ; Size = MAP_APPFONT( 165 , 12 ) ; }; - FixedText FT_INFO_LOGIN_USERNAME // used instead of ED_LOGIN_USERNAME when LF_USERNAME_READONLY is set - { - Hide = TRUE ; - Pos = MAP_APPFONT( 6 , 123 ) ; - Size = MAP_APPFONT( 165 , 8 ) ; - }; FixedText FT_LOGIN_PASSWORD { -- cgit From a84618d8076b877ca77c217d33aa7457ee95fc1b Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Wed, 17 Mar 2010 08:53:20 +0100 Subject: whitespace cleanup. --- uui/source/loginerr.hxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx index c8cbba96564b..14cce88e0534 100644 --- a/uui/source/loginerr.hxx +++ b/uui/source/loginerr.hxx @@ -32,10 +32,10 @@ //========================================================================= -#define LOGINERROR_FLAG_SET_SAVE_PASSWORD 1 -#define LOGINERROR_FLAG_MODIFY_ACCOUNT 2 -#define LOGINERROR_FLAG_MODIFY_USER_NAME 4 -#define LOGINERROR_FLAG_PERSISTENT_PASSWORD 8 +#define LOGINERROR_FLAG_SET_SAVE_PASSWORD 1 +#define LOGINERROR_FLAG_MODIFY_ACCOUNT 2 +#define LOGINERROR_FLAG_MODIFY_USER_NAME 4 +#define LOGINERROR_FLAG_PERSISTENT_PASSWORD 8 #define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16 #define LOGINERROR_FLAG_IS_USE_SYSCREDS 32 -- cgit From 52a1c736c09537fdf0de42c13100f2616c8305f1 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Thu, 18 Mar 2010 11:11:15 +0100 Subject: #i110213# - credentials handling improvements. --- ucb/source/ucp/webdav/DAVAuthListener.hxx | 3 - ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx | 1 - ucb/source/ucp/webdav/DAVResourceAccess.cxx | 4 +- ucb/source/ucp/webdav/NeonSession.cxx | 21 --- uui/source/iahndl-authentication.cxx | 194 ++++++++++++++++++-------- uui/source/loginerr.hxx | 55 +++++--- uui/source/passwordcontainer.cxx | 13 +- 7 files changed, 186 insertions(+), 105 deletions(-) diff --git a/ucb/source/ucp/webdav/DAVAuthListener.hxx b/ucb/source/ucp/webdav/DAVAuthListener.hxx index c092f9fd311f..71bed1c0a14d 100644 --- a/ucb/source/ucp/webdav/DAVAuthListener.hxx +++ b/ucb/source/ucp/webdav/DAVAuthListener.hxx @@ -30,9 +30,7 @@ #include #include -#ifndef _COM_SUN_STAR_UCB_XREFERENCE_HPP_ #include -#endif #include namespace webdav_ucp @@ -46,7 +44,6 @@ class DAVAuthListener : public salhelper::SimpleReferenceObject const ::rtl::OUString & inHostName, ::rtl::OUString & inoutUserName, ::rtl::OUString & outPassWord, - sal_Bool bAllowPersistentStoring, sal_Bool bCanUseSystemCredentials ) = 0; }; diff --git a/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx b/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx index 3d03cc63952b..c0c9968613af 100644 --- a/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx +++ b/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx @@ -61,7 +61,6 @@ namespace webdav_ucp const ::rtl::OUString & inHostName, ::rtl::OUString & inoutUserName, ::rtl::OUString & outPassWord, - sal_Bool bAllowPersistentStoring, sal_Bool bCanUseSystemCredentials ); private: diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx index ea1c09efaa3f..1f1aa68c29c0 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx @@ -57,7 +57,6 @@ int DAVAuthListener_Impl::authenticate( const ::rtl::OUString & inHostName, ::rtl::OUString & inoutUserName, ::rtl::OUString & outPassWord, - sal_Bool bAllowPersistentStoring, sal_Bool bCanUseSystemCredentials ) { if ( m_xEnv.is() ) @@ -79,7 +78,8 @@ int DAVAuthListener_Impl::authenticate( = new ucbhelper::SimpleAuthenticationRequest( m_aURL, inHostName, inRealm, inoutUserName, outPassWord, ::rtl::OUString(), - bAllowPersistentStoring, bCanUseSystemCredentials ); + true /*bAllowPersistentStoring*/, + bCanUseSystemCredentials ); xIH->handle( xRequest.get() ); rtl::Reference< ucbhelper::InteractionContinuation > xSelection diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx index 0d979ae72ada..1558a8ff6734 100644 --- a/ucb/source/ucp/webdav/NeonSession.cxx +++ b/ucb/source/ucp/webdav/NeonSession.cxx @@ -60,7 +60,6 @@ #include #include #include -#include #include #include @@ -330,31 +329,11 @@ extern "C" int NeonSession_NeonAuth( void * inUserData, ( ne_strcasecmp( inAuthProtocol, "Negotiate" ) == 0 ) ); #endif - // #i97003# (tkr): Ask XMasterPasswordHandling if we should store the - // credentials persistently and give this information to the auth listener - uno::Reference< task::XMasterPasswordHandling > xMasterPasswordHandling; - try - { - xMasterPasswordHandling = - uno::Reference< task::XMasterPasswordHandling >( - theSession->getMSF()->createInstance( - rtl::OUString::createFromAscii( - "com.sun.star.task.PasswordContainer" ) ), - uno::UNO_QUERY ); - } - catch ( uno::Exception const & ) - { - } - int theRetVal = pListener->authenticate( rtl::OUString::createFromAscii( inRealm ), theSession->getHostName(), theUserName, thePassWord, - xMasterPasswordHandling.is() - ? xMasterPasswordHandling-> - isPersistentStoringAllowed() - : sal_False, bCanUseSystemCreds); rtl::OString aUser( diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index f31397f1ef92..81f79c1b75e4 100644 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -67,10 +67,9 @@ executeLoginDialog( { vos::OGuard aGuard(Application::GetSolarMutex()); - bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT) - != 0; - bool bSavePassword = rInfo.GetIsPersistentPassword() - || rInfo.GetIsSavePassword(); + bool bAccount + = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT) != 0; + bool bSavePassword = rInfo.GetCanRememberPassword(); bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials(); sal_uInt16 nFlags = 0; @@ -82,10 +81,8 @@ executeLoginDialog( nFlags |= LF_NO_ACCOUNT; if (!(rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME)) nFlags |= LF_USERNAME_READONLY; - if (!bSavePassword) nFlags |= LF_NO_SAVEPASSWORD; - if (!bCanUseSysCreds) nFlags |= LF_NO_USESYSCREDS; @@ -109,12 +106,13 @@ executeLoginDialog( if (bSavePassword) { - xDialog-> - SetSavePasswordText(ResId(rInfo.GetIsPersistentPassword() ? - RID_SAVE_PASSWORD : - RID_KEEP_PASSWORD, - *xManager.get())); - xDialog->SetSavePassword(rInfo.GetIsSavePassword()); + xDialog->SetSavePasswordText( + ResId(rInfo.GetIsRememberPersistent() + ? RID_SAVE_PASSWORD + : RID_KEEP_PASSWORD, + *xManager.get())); + + xDialog->SetSavePassword(rInfo.GetIsRememberPassword()); } if ( bCanUseSysCreds ) @@ -126,7 +124,7 @@ executeLoginDialog( rInfo.SetUserName(xDialog->GetName()); rInfo.SetPassword(xDialog->GetPassword()); rInfo.SetAccount(xDialog->GetAccount()); - rInfo.SetSavePassword(xDialog->IsSavePassword()); + rInfo.SetIsRememberPassword(xDialog->IsSavePassword()); if ( bCanUseSysCreds ) rInfo.SetIsUseSystemCredentials( xDialog->IsUseSystemCredentials() ); @@ -139,6 +137,61 @@ executeLoginDialog( } } +void +getRememberModes( + uno::Sequence< ucb::RememberAuthentication > const & rRememberModes, + ucb::RememberAuthentication & rPreferredMode, + ucb::RememberAuthentication & rAlternateMode ) +{ + sal_Int32 nCount = rRememberModes.getLength(); + OSL_ENSURE( (nCount > 0) && (nCount < 4), + "ucb::RememberAuthentication sequence size mismatch!" ); + if ( nCount == 1 ) + { + rPreferredMode = rAlternateMode = rRememberModes[ 0 ]; + return; + } + else + { + //bool bHasRememberModeNo = false; + bool bHasRememberModeSession = false; + bool bHasRememberModePersistent = false; + + for (sal_Int32 i = 0; i < nCount; ++i) + { + switch ( rRememberModes[i] ) + { + case ucb::RememberAuthentication_NO: + //bHasRememberModeNo = true; + break; + case ucb::RememberAuthentication_SESSION: + bHasRememberModeSession = true; + break; + case ucb::RememberAuthentication_PERSISTENT: + bHasRememberModePersistent = true; + break; + default: + OSL_TRACE( "Unsupported RememberAuthentication value" ); + break; + } + } + + if (bHasRememberModePersistent) + { + rPreferredMode = ucb::RememberAuthentication_PERSISTENT; + if (bHasRememberModeSession) + rAlternateMode = ucb::RememberAuthentication_SESSION; + else + rAlternateMode = ucb::RememberAuthentication_NO; + } + else + { + rPreferredMode = ucb::RememberAuthentication_SESSION; + rAlternateMode = ucb::RememberAuthentication_NO; + } + } +} + void handleAuthenticationRequest_( Window * pParent, @@ -161,7 +214,7 @@ handleAuthenticationRequest_( xSupplyAuthentication2.set(xSupplyAuthentication, uno::UNO_QUERY); ////////////////////////// - // First, try to obatin credentials from password container service. + // First, try to obtain credentials from password container service. uui::PasswordContainerHelper aPwContainerHelper(xServiceFactory); if (aPwContainerHelper.handleAuthenticationRequest(rRequest, xSupplyAuthentication, @@ -174,26 +227,20 @@ handleAuthenticationRequest_( ////////////////////////// // Second, try to obtain credentials from user via password dialog. - bool bRemember; - bool bRememberPersistent; + ucb::RememberAuthentication eDefaultRememberMode + = ucb::RememberAuthentication_SESSION; + ucb::RememberAuthentication ePreferredRememberMode + = eDefaultRememberMode; + ucb::RememberAuthentication eAlternateRememberMode + = ucb::RememberAuthentication_NO; + if (xSupplyAuthentication.is()) { - ucb::RememberAuthentication eDefault; - uno::Sequence< ucb::RememberAuthentication > - aModes(xSupplyAuthentication->getRememberPasswordModes(eDefault)); - bRemember = eDefault != ucb::RememberAuthentication_NO; - bRememberPersistent = false; - for (sal_Int32 i = 0; i < aModes.getLength(); ++i) - if (aModes[i] == ucb::RememberAuthentication_PERSISTENT) - { - bRememberPersistent = true; - break; - } - } - else - { - bRemember = false; - bRememberPersistent = false; + getRememberModes( + xSupplyAuthentication->getRememberPasswordModes( + eDefaultRememberMode), + ePreferredRememberMode, + eAlternateRememberMode); } sal_Bool bCanUseSystemCredentials; @@ -220,10 +267,16 @@ handleAuthenticationRequest_( if (rRequest.HasPassword) aInfo.SetPassword(rRequest.Password); aInfo.SetErrorText(rRequest.Diagnostic); - aInfo.SetPersistentPassword(bRememberPersistent); - aInfo.SetSavePassword(bRemember); + + aInfo.SetCanRememberPassword( + ePreferredRememberMode != eAlternateRememberMode); + aInfo.SetIsRememberPassword( + eDefaultRememberMode != ucb::RememberAuthentication_NO); + aInfo.SetIsRememberPersistent( + ePreferredRememberMode == ucb::RememberAuthentication_PERSISTENT); + aInfo.SetCanUseSystemCredentials(bCanUseSystemCredentials); - aInfo.SetIsUseSystemCredentials( bDefaultUseSystemCredentials ); + aInfo.SetIsUseSystemCredentials(bDefaultUseSystemCredentials); aInfo.SetModifyAccount(rRequest.HasAccount && xSupplyAuthentication.is() && xSupplyAuthentication->canSetAccount()); @@ -242,13 +295,24 @@ handleAuthenticationRequest_( xSupplyAuthentication->setUserName(aInfo.GetUserName()); if (xSupplyAuthentication->canSetPassword()) xSupplyAuthentication->setPassword(aInfo.GetPassword()); - xSupplyAuthentication-> - setRememberPassword( - aInfo.GetIsSavePassword() ? - bRememberPersistent ? - ucb::RememberAuthentication_PERSISTENT : - ucb::RememberAuthentication_SESSION : - ucb::RememberAuthentication_NO); + + if (ePreferredRememberMode != eAlternateRememberMode) + { + // user had te choice. + if (aInfo.GetIsRememberPassword()) + xSupplyAuthentication->setRememberPassword( + ePreferredRememberMode); + else + xSupplyAuthentication->setRememberPassword( + eAlternateRememberMode); + } + else + { + // user had no choice. + xSupplyAuthentication->setRememberPassword( + ePreferredRememberMode); + } + if (rRequest.HasRealm) { if (xSupplyAuthentication->canSetRealm()) @@ -267,22 +331,31 @@ handleAuthenticationRequest_( ////////////////////////// // Third, store credentials in password container. - if ( aInfo.GetIsUseSystemCredentials() ) + if (aInfo.GetIsUseSystemCredentials()) { - if (aInfo.GetIsSavePassword()) + if (aInfo.GetIsRememberPassword() || + (eAlternateRememberMode == ucb::RememberAuthentication_SESSION)) { - aPwContainerHelper.addRecord( - rURL.getLength() ? rURL : rRequest.ServerName, - rtl::OUString(), // empty u/p -> sys creds - uno::Sequence< rtl::OUString >(), - xIH, - bRememberPersistent); + if (!aPwContainerHelper.addRecord( + rURL.getLength() ? rURL : rRequest.ServerName, + rtl::OUString(), // empty u/p -> sys creds + uno::Sequence< rtl::OUString >(), + xIH, + !aInfo.GetIsRememberPassword() + ? false /* SESSION */ + : ePreferredRememberMode + == ucb::RememberAuthentication_PERSISTENT)) + { + xSupplyAuthentication->setRememberPassword( + ucb::RememberAuthentication_NO); + } } } // Empty user name can not be valid: else if (aInfo.GetUserName().Len() != 0) { - if (aInfo.GetIsSavePassword()) + if (aInfo.GetIsRememberPassword() || + (eAlternateRememberMode == ucb::RememberAuthentication_SESSION)) { uno::Sequence< rtl::OUString > aPassList(aInfo.GetAccount().Len() == 0 ? 1 : 2); @@ -290,12 +363,19 @@ handleAuthenticationRequest_( if (aInfo.GetAccount().Len() != 0) aPassList[1] = aInfo.GetAccount(); - aPwContainerHelper.addRecord( - rURL.getLength() ? rURL : rRequest.ServerName, - aInfo.GetUserName(), - aPassList, - xIH, - bRememberPersistent); + if (!aPwContainerHelper.addRecord( + rURL.getLength() ? rURL : rRequest.ServerName, + aInfo.GetUserName(), + aPassList, + xIH, + !aInfo.GetIsRememberPassword() + ? false /* SESSION */ + : ePreferredRememberMode + == ucb::RememberAuthentication_PERSISTENT)) + { + xSupplyAuthentication->setRememberPassword( + ucb::RememberAuthentication_NO); + } } } break; diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx index 14cce88e0534..d713fbafa053 100644 --- a/uui/source/loginerr.hxx +++ b/uui/source/loginerr.hxx @@ -32,12 +32,13 @@ //========================================================================= -#define LOGINERROR_FLAG_SET_SAVE_PASSWORD 1 -#define LOGINERROR_FLAG_MODIFY_ACCOUNT 2 -#define LOGINERROR_FLAG_MODIFY_USER_NAME 4 -#define LOGINERROR_FLAG_PERSISTENT_PASSWORD 8 -#define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16 -#define LOGINERROR_FLAG_IS_USE_SYSCREDS 32 +#define LOGINERROR_FLAG_MODIFY_ACCOUNT 1 +#define LOGINERROR_FLAG_MODIFY_USER_NAME 2 +#define LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD 4 +#define LOGINERROR_FLAG_IS_REMEMBER_PASSWORD 8 +#define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16 +#define LOGINERROR_FLAG_IS_USE_SYSCREDS 32 +#define LOGINERROR_FLAG_REMEMBER_PERSISTENT 64 class LoginErrorInfo { @@ -56,8 +57,7 @@ public: LoginErrorInfo() : _nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ), _nRet( ERRCODE_BUTTON_CANCEL ) - { - } + {} const String& GetTitle() const { return _aTitle; } const String& GetServer() const { return _aServer; } @@ -66,10 +66,14 @@ public: const String& GetPassword() const { return _aPassword; } const String& GetPath() const { return _aPath; } const String& GetErrorText() const { return _aErrorText; } - BOOL GetIsPersistentPassword() const - { return ( _nFlags & LOGINERROR_FLAG_PERSISTENT_PASSWORD ); } - BOOL GetIsSavePassword() const - { return ( _nFlags & LOGINERROR_FLAG_SET_SAVE_PASSWORD ); } + + BOOL GetCanRememberPassword() const + { return ( _nFlags & LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD ); } + BOOL GetIsRememberPersistent() const + { return ( _nFlags & LOGINERROR_FLAG_REMEMBER_PERSISTENT ); } + BOOL GetIsRememberPassword() const + { return ( _nFlags & LOGINERROR_FLAG_IS_REMEMBER_PASSWORD ); } + BOOL GetCanUseSystemCredentials() const { return ( _nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); } BOOL GetIsUseSystemCredentials() const @@ -94,8 +98,11 @@ public: { _aErrorText = aErrorText; } void SetFlags( BYTE nFlags ) { _nFlags = nFlags; } - inline void SetSavePassword( BOOL bSet ); - inline void SetPersistentPassword( BOOL bSet ); + + inline void SetCanRememberPassword( BOOL bSet ); + inline void SetIsRememberPassword( BOOL bSet ); + inline void SetIsRememberPersistent( BOOL bSet ); + inline void SetCanUseSystemCredentials( BOOL bSet ); inline void SetIsUseSystemCredentials( BOOL bSet ); inline void SetModifyAccount( BOOL bSet ); @@ -104,20 +111,28 @@ public: { _nRet = nRet; } }; -inline void LoginErrorInfo::SetSavePassword( BOOL bSet ) +inline void LoginErrorInfo::SetCanRememberPassword( BOOL bSet ) +{ + if ( bSet ) + _nFlags |= LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD; + else + _nFlags &= ~LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD; +} + +inline void LoginErrorInfo::SetIsRememberPassword( BOOL bSet ) { if ( bSet ) - _nFlags |= LOGINERROR_FLAG_SET_SAVE_PASSWORD; + _nFlags |= LOGINERROR_FLAG_IS_REMEMBER_PASSWORD; else - _nFlags &= ~LOGINERROR_FLAG_SET_SAVE_PASSWORD; + _nFlags &= ~LOGINERROR_FLAG_IS_REMEMBER_PASSWORD; } -inline void LoginErrorInfo::SetPersistentPassword( BOOL bSet ) +inline void LoginErrorInfo::SetIsRememberPersistent( BOOL bSet ) { if ( bSet ) - _nFlags |= LOGINERROR_FLAG_PERSISTENT_PASSWORD; + _nFlags |= LOGINERROR_FLAG_REMEMBER_PERSISTENT; else - _nFlags &= ~LOGINERROR_FLAG_PERSISTENT_PASSWORD; + _nFlags &= ~LOGINERROR_FLAG_REMEMBER_PERSISTENT; } inline void LoginErrorInfo::SetCanUseSystemCredentials( BOOL bSet ) diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx index 26d22b320d8a..0a056289c29d 100644 --- a/uui/source/passwordcontainer.cxx +++ b/uui/source/passwordcontainer.cxx @@ -30,6 +30,7 @@ #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/task/NoMasterException.hpp" #include "com/sun/star/task/XInteractionHandler.hpp" +#include "com/sun/star/task/XMasterPasswordHandling.hpp" #include "com/sun/star/task/XPasswordContainer.hpp" #include "com/sun/star/task/XUrlContainer.hpp" #include "com/sun/star/ucb/AuthenticationRequest.hpp" @@ -271,10 +272,20 @@ bool PasswordContainerHelper::addRecord( return false; if ( bPersist ) + { + uno::Reference< task::XMasterPasswordHandling > xMPH( + m_xPasswordContainer, uno::UNO_QUERY_THROW ); + + // If persistent storing of passwords is not yet + // allowed, enable it. + if ( !xMPH->isPersistentStoringAllowed() ) + xMPH->allowPersistentStoring( sal_True ); + m_xPasswordContainer->addPersistent( rURL, rUsername, rPasswords, xIH ); + } else m_xPasswordContainer->add( rURL, rUsername, @@ -429,7 +440,7 @@ PasswordContainerInteractionHandler::handle( // @@@ FIXME: this not able to // handle master pw request! // master pw request is never - // solvabe without UI! + // solvable without UI! this ) ) { // successfully handled -- cgit From 54499ed54bd760755e4d172417f0cc849fc47d1e Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 19 Mar 2010 11:13:29 +0100 Subject: cws tl79: #i110254# new 'Security' tab page --- sfx2/inc/sfx2/securitypage.hxx | 57 ++++++ sfx2/inc/sfx2/sfx.hrc | 1 + sfx2/source/dialog/dinfdlg.cxx | 4 +- sfx2/source/dialog/dinfdlg.src | 11 +- sfx2/source/dialog/makefile.mk | 6 +- sfx2/source/dialog/securitypage.cxx | 379 ++++++++++++++++++++++++++++++++++++ sfx2/source/dialog/securitypage.hrc | 52 +++++ sfx2/source/dialog/securitypage.src | 156 +++++++++++++++ sfx2/source/inc/helpid.hrc | 1 + svx/inc/svx/svxids.hrc | 1 + 10 files changed, 661 insertions(+), 7 deletions(-) create mode 100755 sfx2/inc/sfx2/securitypage.hxx mode change 100644 => 100755 sfx2/inc/sfx2/sfx.hrc mode change 100644 => 100755 sfx2/source/dialog/dinfdlg.cxx mode change 100644 => 100755 sfx2/source/dialog/dinfdlg.src mode change 100644 => 100755 sfx2/source/dialog/makefile.mk create mode 100755 sfx2/source/dialog/securitypage.cxx create mode 100755 sfx2/source/dialog/securitypage.hrc create mode 100755 sfx2/source/dialog/securitypage.src mode change 100644 => 100755 sfx2/source/inc/helpid.hrc mode change 100644 => 100755 svx/inc/svx/svxids.hrc diff --git a/sfx2/inc/sfx2/securitypage.hxx b/sfx2/inc/sfx2/securitypage.hxx new file mode 100755 index 000000000000..616f11d3b6d1 --- /dev/null +++ b/sfx2/inc/sfx2/securitypage.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SECURITYPAGE_HXX_ +#define _SECURITYPAGE_HXX_ + +#include "sfx2/tabdlg.hxx " + +#include + + +////////////////////////////////////////////////////////////////////// + +struct SfxSecurityPage_Impl; + +class SfxSecurityPage : public SfxTabPage +{ + std::auto_ptr< SfxSecurityPage_Impl > m_pImpl; + +protected: + SfxSecurityPage( Window* pParent, const SfxItemSet& ); + virtual ~SfxSecurityPage(); + + virtual BOOL FillItemSet( SfxItemSet& ); + virtual void Reset( const SfxItemSet& ); + +public: + static SfxTabPage* Create( Window* pParent, const SfxItemSet& ); +}; + +////////////////////////////////////////////////////////////////////// + +#endif // #ifndef _SECURITYPAGE_HXX_ + diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc old mode 100644 new mode 100755 index 83f20874c324..5e64bdf4ca7b --- a/sfx2/inc/sfx2/sfx.hrc +++ b/sfx2/inc/sfx2/sfx.hrc @@ -228,6 +228,7 @@ #define TP_DOCINFOUSER (RID_SFX_START+5) #define TP_DOCINFORELOAD (RID_SFX_START+13) #define TP_CUSTOMPROPERTIES (RID_SFX_START+14) +#define TP_DOCINFOSECURITY (RID_SFX_START+215) #define DLG_DOCINFO_EDT (RID_SFX_START+6) #define TP_MANAGE_STYLES (RID_SFX_START+7) #define DLG_STYLE_DESIGNER (RID_SFX_START+8) diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx old mode 100644 new mode 100755 index 0f778a94f091..e592eae82b08 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -58,7 +58,8 @@ #include #include -#include +#include "sfx2/dinfdlg.hxx" +#include "sfx2/securitypage.hxx" #include "sfxresid.hxx" #include "dinfedt.hxx" #include @@ -1554,6 +1555,7 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent, AddTabPage(TP_DOCINFODOC, SfxDocumentPage::Create, 0); AddTabPage(TP_CUSTOMPROPERTIES, SfxCustomPropertiesPage::Create, 0); AddTabPage(TP_DOCINFORELOAD, SfxInternetPage::Create, 0); + AddTabPage(TP_DOCINFOSECURITY, SfxSecurityPage::Create, 0); } // ----------------------------------------------------------------------- diff --git a/sfx2/source/dialog/dinfdlg.src b/sfx2/source/dialog/dinfdlg.src old mode 100644 new mode 100755 index eaa691fe3eff..f32bc768e846 --- a/sfx2/source/dialog/dinfdlg.src +++ b/sfx2/source/dialog/dinfdlg.src @@ -27,11 +27,11 @@ // include --------------------------------------------------------------- -#include +#include "sfx2/sfx.hrc" #include "helpid.hrc" #include "sfxlocal.hrc" #include "dinfdlg.hrc" -#include +#include "dialog.hrc" // TP_DOCINFODESC -------------------------------------------------------- String STR_SFX_NEWOFFICEDOC @@ -685,8 +685,6 @@ QueryBox SFX_QB_WRONG_TYPE Message [ en-US ] = "The value entered does not match the specified type.\nThe value will be stored as text." ; }; - // SID_DOCINFO ----------------------------------------------------------- - TabDialog SID_DOCINFO { OutputSize = TRUE ; @@ -718,6 +716,11 @@ TabDialog SID_DOCINFO Identifier = TP_DOCINFORELOAD ; Text [ en-US ] = "Internet" ; }; + PageItem + { + Identifier = TP_DOCINFOSECURITY ; + Text [ en-US ] = "Security" ; + }; }; }; }; diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk old mode 100644 new mode 100755 index 87ef0f1a7af1..b344170fd39c --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -68,7 +68,8 @@ SLOFILES =\ $(SLO)$/tabdlg.obj \ $(SLO)$/tplcitem.obj \ $(SLO)$/tplpitem.obj \ - $(SLO)$/versdlg.obj + $(SLO)$/versdlg.obj \ + $(SLO)$/securitypage.obj SRS1NAME=$(TARGET) SRC1FILES =\ @@ -85,7 +86,8 @@ SRC1FILES =\ templdlg.src \ versdlg.src \ printopt.src \ - srchdlg.src + srchdlg.src \ + securitypage.src .IF "$(BUILD_VER_STRING)"!="" .IF "$(GUI)"=="UNX" diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx new file mode 100755 index 000000000000..affebc8615cb --- /dev/null +++ b/sfx2/source/dialog/securitypage.cxx @@ -0,0 +1,379 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include "sfx2/securitypage.hxx" +#include "sfx2/sfx.hrc" +#include "securitypage.hrc" +#include "sfxresid.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +////////////////////////////////////////////////////////////////////// + +namespace +{ + enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC }; + + enum RedlineFunc { RF_ON, RF_PROTECT }; + + const SfxBoolItem* ExecuteRecordChangesFunc( RedliningMode _eMode, RedlineFunc _eFunc, BOOL _bVal, Window* _pParent = NULL ) + { + const SfxBoolItem* pRet = NULL; + + if (_eMode != RL_NONE) + { + USHORT nSlot; + if (_eMode == RL_WRITER) + nSlot = _eFunc == RF_ON ? FN_REDLINE_ON : FN_REDLINE_PROTECT; + else + nSlot = _eFunc == RF_ON ? FID_CHG_RECORD : SID_CHG_PROTECT; + + // execute + SfxViewShell* pViewSh = SfxViewShell::Current(); + if (pViewSh) + { + bool bNeedItem = _eMode == RL_WRITER || _eFunc != RF_ON; + SfxBoolItem* pItem = bNeedItem ? new SfxBoolItem( nSlot, _bVal ) : NULL; + SfxDispatcher* pDisp = pViewSh->GetDispatcher(); + if (_pParent) + { + XWindowItem aParentItem( SID_ATTR_XWINDOW, _pParent ); + pRet = static_cast< const SfxBoolItem* >( + pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, &aParentItem, pItem, 0L ) ); + } + else + pRet = static_cast< const SfxBoolItem* >( + pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, pItem, 0L ) ); + delete pItem; + } + } + + return pRet; + } + + bool QueryState( USHORT _nSlot, bool& _rValue ) + { + bool bRet = false; + + SfxViewShell* pViewSh = SfxViewShell::Current(); + if (pViewSh) + { + const SfxPoolItem* pItem; + SfxDispatcher* pDisp = pViewSh->GetDispatcher(); + bRet = SFX_ITEM_AVAILABLE <= pDisp->QueryState( _nSlot, pItem ); + if (bRet) + _rValue = ( static_cast< const SfxBoolItem* >( pItem ) )->GetValue(); + } + + return bRet; + } + + bool QueryRecordChangesProtectionState( RedliningMode _eMode, bool& _rValue ) + { + bool bRet = false; + + if (_eMode != RL_NONE) + { + USHORT nSlot = _eMode == RL_WRITER ? FN_REDLINE_PROTECT : SID_CHG_PROTECT; + bRet = QueryState( nSlot, _rValue ); + } + + return bRet; + } + + bool QueryRecordChangesState( RedliningMode _eMode, bool& _rValue ) + { + bool bRet = false; + + if (_eMode != RL_NONE) + { + USHORT nSlot = _eMode == RL_WRITER ? FN_REDLINE_ON : FID_CHG_RECORD; + bRet = QueryState( nSlot, _rValue ); + } + + return bRet; + } +} + + +////////////////////////////////////////////////////////////////////// + + +struct SfxSecurityPage_Impl +{ + SfxSecurityPage & m_rDialog; + + FixedLine m_aPasswordToOpenFL; + FixedText m_aPasswordToOpenFT; + Edit m_aPasswordToOpenED; + FixedText m_aConfirmPasswordToOpenFT; + Edit m_aConfirmPasswordToOpenED; + FixedText m_aPasswordInfoFT; + + FixedLine m_aPasswordToModifyFL; + FixedText m_aPasswordToModifyFT; + Edit m_aPasswordToModifyED; + FixedText m_aConfirmPasswordToModifyFT; + Edit m_aConfirmPasswordToModifyED; + + FixedLine m_aOptionsFL; + CheckBox m_aOpenReadonlyCB; + CheckBox m_aRemoveInfoOnSavingCB; + CheckBox m_aRecordChangesCB; // for record changes + PushButton m_aChangeProtectionPB; // for record changes + String m_aProtectSTR; // for record changes + String m_aUnProtectSTR; // for record changes + RedliningMode m_eRedlingMode; // for record changes + + DECL_LINK( RecordChangesCBHdl, void* ); + DECL_LINK( ChangeProtectionPBHdl, void* ); + + SfxSecurityPage_Impl( SfxSecurityPage &rDlg, const SfxItemSet &rItemSet ); + ~SfxSecurityPage_Impl(); + + void CheckRecordChangesState( void ); + + BOOL FillItemSet_Impl( SfxItemSet & ); + void Reset_Impl( const SfxItemSet & ); +}; + + +SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rDlg, const SfxItemSet & ) : + m_rDialog (rDlg), + m_aPasswordToOpenFL (&rDlg, SfxResId( PASSWORD_TO_OPEN_FL ) ), + m_aPasswordToOpenFT (&rDlg, SfxResId( PASSWORD_TO_OPEN_FT ) ), + m_aPasswordToOpenED (&rDlg, SfxResId( PASSWORD_TO_OPEN_ED ) ), + m_aConfirmPasswordToOpenFT (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_OPEN_FT ) ), + m_aConfirmPasswordToOpenED (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_OPEN_ED ) ), + m_aPasswordInfoFT (&rDlg, SfxResId( PASSWORD_INFO_FT ) ), + m_aPasswordToModifyFL (&rDlg, SfxResId( PASSWORD_TO_MODIFY_FL ) ), + m_aPasswordToModifyFT (&rDlg, SfxResId( PASSWORD_TO_MODIFY_FT ) ), + m_aPasswordToModifyED (&rDlg, SfxResId( PASSWORD_TO_MODIFY_ED ) ), + m_aConfirmPasswordToModifyFT (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_FT ) ), + m_aConfirmPasswordToModifyED (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_ED ) ), + m_aOptionsFL (&rDlg, SfxResId( OPTIONS_FL ) ), + m_aOpenReadonlyCB (&rDlg, SfxResId( OPEN_READONLY_CB ) ), + m_aRemoveInfoOnSavingCB (&rDlg, SfxResId( REMOVE_INFO_ON_SAVING_CB ) ), + m_aRecordChangesCB (&rDlg, SfxResId( RECORD_CHANGES_CB ) ), + m_aChangeProtectionPB (&rDlg, SfxResId( CHANGE_PROTECTION_PB ) ), + m_aProtectSTR ( SfxResId( STR_PROTECT ) ), + m_aUnProtectSTR ( SfxResId( STR_UNPROTECT ) ), + m_eRedlingMode ( RL_NONE ) +{ + m_aChangeProtectionPB.SetText( m_aProtectSTR ); + // adjust button width if necessary + long nBtnTextWidth = 0; + long nTemp = m_aChangeProtectionPB.GetCtrlTextWidth( m_aChangeProtectionPB.GetText() ); + if (nTemp > nBtnTextWidth) + nBtnTextWidth = nTemp; + + m_aRecordChangesCB.SetClickHdl( LINK( this, SfxSecurityPage_Impl, RecordChangesCBHdl ) ); + m_aChangeProtectionPB.SetClickHdl( LINK( this, SfxSecurityPage_Impl, ChangeProtectionPBHdl ) ); +} + + +SfxSecurityPage_Impl::~SfxSecurityPage_Impl() +{ +} + + +void SfxSecurityPage_Impl::CheckRecordChangesState( void ) +{ + bool bVal; + if (QueryRecordChangesState( m_eRedlingMode, bVal )) + { + m_aRecordChangesCB.Enable(); + m_aRecordChangesCB.Check( bVal ); + } + else + m_aRecordChangesCB.Disable(); // because now we don't know the state! + + m_aChangeProtectionPB.Enable( QueryRecordChangesProtectionState( m_eRedlingMode, bVal ) ); +} + + +BOOL SfxSecurityPage_Impl::FillItemSet_Impl( SfxItemSet & ) +{ + BOOL bModified = FALSE; + + SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); + if (pCurDocShell) + { + if (pCurDocShell->HasSecurityOptOpenReadOnly()) + pCurDocShell->SetSecurityOptOpenReadOnly( m_aOpenReadonlyCB.IsChecked() ); + } + + return bModified; +} + + +void SfxSecurityPage_Impl::Reset_Impl( const SfxItemSet & ) +{ + SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); + + String sNewText = m_aProtectSTR; + if (!pCurDocShell) + { + // no doc -> hide document settings + m_aOpenReadonlyCB.Disable(); + m_aRecordChangesCB.Disable(); + m_aChangeProtectionPB.Disable(); + } + else + { + bool bIsHTMLDoc = false; + SfxViewShell* pViewSh = SfxViewShell::Current(); + if (pViewSh) + { + const SfxPoolItem* pItem; + SfxDispatcher* pDisp = pViewSh->GetDispatcher(); + if (SFX_ITEM_AVAILABLE <= pDisp->QueryState( SID_HTML_MODE, pItem )) + { + USHORT nMode = static_cast< const SfxUInt16Item* >( pItem )->GetValue(); + bIsHTMLDoc = ( ( nMode & HTMLMODE_ON ) != 0 ); + } + } + + sal_Bool bIsReadonly = pCurDocShell->IsReadOnly(); + if (pCurDocShell->HasSecurityOptOpenReadOnly() && !bIsHTMLDoc) + { + m_aOpenReadonlyCB.Check( pCurDocShell->IsSecurityOptOpenReadOnly() ); + m_aOpenReadonlyCB.Enable( !bIsReadonly ); + } + else + m_aOpenReadonlyCB.Disable(); + + bool bVal; + if (QueryRecordChangesState( RL_WRITER, bVal ) && !bIsHTMLDoc) + m_eRedlingMode = RL_WRITER; + else if (QueryRecordChangesState( RL_CALC, bVal )) + m_eRedlingMode = RL_CALC; + else + m_eRedlingMode = RL_NONE; + + if (m_eRedlingMode != RL_NONE) + { + m_aRecordChangesCB.Check( bVal ); + m_aRecordChangesCB.Enable( !bVal && !bIsReadonly ); + m_aChangeProtectionPB.Enable( + QueryRecordChangesProtectionState( m_eRedlingMode, bVal ) && !bIsReadonly ); + // set the right text + if (bVal) + sNewText = m_aUnProtectSTR; + } + } + + m_aChangeProtectionPB.SetText( sNewText ); +} + + +IMPL_LINK( SfxSecurityPage_Impl, RecordChangesCBHdl, void*, EMPTYARG ) +{ + ExecuteRecordChangesFunc( m_eRedlingMode, RF_ON, m_aRecordChangesCB.IsChecked(), &m_rDialog ); + CheckRecordChangesState(); + return 0; +} + + +IMPL_LINK( SfxSecurityPage_Impl, ChangeProtectionPBHdl, void*, EMPTYARG ) +{ + bool bProt; + QueryRecordChangesProtectionState( m_eRedlingMode, bProt ); + ExecuteRecordChangesFunc( m_eRedlingMode, RF_PROTECT, !bProt, &m_rDialog ); + CheckRecordChangesState(); + + if (QueryRecordChangesProtectionState( m_eRedlingMode, bProt )) + { + // RecordChangesCB is enabled if protection is off + m_aRecordChangesCB.Enable( !bProt ); + // toggle text of button "Protect" <-> "Unprotect" + String sNewText = bProt ? m_aUnProtectSTR : m_aProtectSTR; + m_aChangeProtectionPB.SetText( sNewText ); + } + return 0; +} + + +////////////////////////////////////////////////////////////////////// + + +SfxTabPage* SfxSecurityPage::Create( Window * pParent, const SfxItemSet & rItemSet ) +{ + return new SfxSecurityPage( pParent, rItemSet ); +} + + +SfxSecurityPage::SfxSecurityPage( Window* pParent, const SfxItemSet& rItemSet ) : + SfxTabPage( pParent, SfxResId( TP_DOCINFOSECURITY ), rItemSet ) +{ + m_pImpl = std::auto_ptr< SfxSecurityPage_Impl >(new SfxSecurityPage_Impl( *this, rItemSet )); + + FreeResource(); +} + + +SfxSecurityPage::~SfxSecurityPage() +{ +} + + +BOOL SfxSecurityPage::FillItemSet( SfxItemSet & rItemSet ) +{ + bool bModified = false; + DBG_ASSERT( m_pImpl.get(), "implementation pointer is 0. Still in c-tor?" ); + if (m_pImpl.get() != 0) + bModified = m_pImpl->FillItemSet_Impl( rItemSet ); + return bModified; +} + + +void SfxSecurityPage::Reset( const SfxItemSet & rItemSet ) +{ + DBG_ASSERT( m_pImpl.get(), "implementation pointer is 0. Still in c-tor?" ); + if (m_pImpl.get() != 0) + m_pImpl->Reset_Impl( rItemSet ); +} + + +////////////////////////////////////////////////////////////////////// + diff --git a/sfx2/source/dialog/securitypage.hrc b/sfx2/source/dialog/securitypage.hrc new file mode 100755 index 000000000000..820dab538b9f --- /dev/null +++ b/sfx2/source/dialog/securitypage.hrc @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SECURITYPAGE_HRC_ +#define _SECURITYPAGE_HRC_ + + +#define PASSWORD_TO_OPEN_FL 1 +#define PASSWORD_TO_OPEN_FT 2 +#define PASSWORD_TO_OPEN_ED 3 +#define CONFIRM_PASSWORD_TO_OPEN_FT 4 +#define CONFIRM_PASSWORD_TO_OPEN_ED 5 +#define PASSWORD_INFO_FT 6 +#define PASSWORD_TO_MODIFY_FL 7 +#define PASSWORD_TO_MODIFY_FT 8 +#define PASSWORD_TO_MODIFY_ED 9 +#define CONFIRM_PASSWORD_TO_MODIFY_FT 10 +#define CONFIRM_PASSWORD_TO_MODIFY_ED 11 +#define OPTIONS_FL 12 +#define OPEN_READONLY_CB 13 +#define REMOVE_INFO_ON_SAVING_CB 14 +#define RECORD_CHANGES_CB 15 +#define CHANGE_PROTECTION_PB 16 + +#define STR_PROTECT 101 +#define STR_UNPROTECT 102 + +#endif + diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src new file mode 100755 index 000000000000..32f5fac704a4 --- /dev/null +++ b/sfx2/source/dialog/securitypage.src @@ -0,0 +1,156 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "sfx2/sfx.hrc" +#include "securitypage.hrc" +#include "helpid.hrc" +#include "dialog.hrc" +#include "sfxlocal.hrc" + +#include + + +TabPage TP_DOCINFOSECURITY +{ + HelpId = HID_DOCINFOSECURITY ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + + FixedLine PASSWORD_TO_OPEN_FL + { + Pos = MAP_APPFONT( 6, 6 ); + Size = MAP_APPFONT( 248, RSC_CD_FIXEDLINE_HEIGHT ); + Text [ en-US ] = "File encryption password"; + }; + FixedText PASSWORD_TO_OPEN_FT + { + Pos = MAP_APPFONT( 12, 20 ); + Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "~Enter password to open"; + }; + Edit PASSWORD_TO_OPEN_ED + { + Pos = MAP_APPFONT( 100, 18 ); + Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); + Border = TRUE; + PassWord = TRUE; + }; + FixedText CONFIRM_PASSWORD_TO_OPEN_FT + { + Pos = MAP_APPFONT( 12, 34 ); + Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "~Reenter password to open"; + }; + Edit CONFIRM_PASSWORD_TO_OPEN_ED + { + Pos = MAP_APPFONT( 100, 32 ); + Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); + Border = TRUE; + PassWord = TRUE; + }; + FixedText PASSWORD_INFO_FT + { + Pos = MAP_APPFONT( 12, 48 ); + Size = MAP_APPFONT( 236, 3 * RSC_CD_FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "Note: If you lose or forget the password, it cannot be recovered."\ + "It is advisable to keep passwords in a safe place."\ + "Passwords are case-sensitive."; + WordBreak = TRUE; + }; + FixedLine PASSWORD_TO_MODIFY_FL + { + Pos = MAP_APPFONT( 6, 78 ); + Size = MAP_APPFONT( 248, RSC_CD_FIXEDLINE_HEIGHT ); + Text [ en-US ] = "File sharing password"; + }; + FixedText PASSWORD_TO_MODIFY_FT + { + Pos = MAP_APPFONT( 12, 92 ); + Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "Enter password to modify"; + }; + Edit PASSWORD_TO_MODIFY_ED + { + Pos = MAP_APPFONT( 100, 90 ); + Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); + Border = TRUE; + PassWord = TRUE; + }; + FixedText CONFIRM_PASSWORD_TO_MODIFY_FT + { + Pos = MAP_APPFONT( 12, 106 ); + Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "Reenter password to modify"; + }; + Edit CONFIRM_PASSWORD_TO_MODIFY_ED + { + Pos = MAP_APPFONT( 100, 104 ); + Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); + Border = TRUE; + PassWord = TRUE; + }; + FixedLine OPTIONS_FL + { + Pos = MAP_APPFONT( 6, 120 ); + Size = MAP_APPFONT( 248, RSC_CD_FIXEDLINE_HEIGHT ); + Text [ en-US ] = "File sharing options"; + }; + CheckBox OPEN_READONLY_CB + { + Pos = MAP_APPFONT( 12, 133 ); + Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); + Text [ en-US ] = "~Open file read-only"; + }; + CheckBox REMOVE_INFO_ON_SAVING_CB + { + Pos = MAP_APPFONT( 12, 147 ); + Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); + Text [ en-US ] = "Remove personal ~information on saving"; + }; + CheckBox RECORD_CHANGES_CB + { + Pos = MAP_APPFONT( 12, 162 ); + Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); + Text [ en-US ] = "Record ~changes"; + }; + PushButton CHANGE_PROTECTION_PB + { + Pos = MAP_APPFONT( 194, 160 ); + Size = MAP_APPFONT( 60, RSC_CD_PUSHBUTTON_HEIGHT ); + }; + String STR_PROTECT + { + Text [ en-US ] = "~Protect..."; + }; + String STR_UNPROTECT + { + Text [ en-US ] = "~Unprotect..."; + }; + +}; + + diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc old mode 100644 new mode 100755 index 29ad461d18da..f09ac7e94ecc --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -46,6 +46,7 @@ #define HID_DOCINFODESC (HID_SFX_START + 8) #define HID_DOCINFODOC (HID_SFX_START + 9) #define HID_DOCINFOUSER (HID_SFX_START + 10) +#define HID_DOCINFOSECURITY (HID_SFX_START + 11) #define HID_BOOKMARKPROPS (HID_SFX_START + 14) #define HID_BOOKGROUPPROPS (HID_SFX_START + 15) #define HID_BOOKFILEPROPS (HID_SFX_START + 16) diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc old mode 100644 new mode 100755 index b53b5f6dac26..ee31d4ee3964 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -182,6 +182,7 @@ #define RID_OFA_TP_INTERNATIONAL_IMPR (RID_OFA_START + 254) // 4 impress */ +#define SID_ATTR_XWINDOW (RID_OFA_START + 250) #define SID_ATTR_PARENTWINDOW (RID_OFA_START + 255) // -------------------------------------------------------------------------- -- cgit From dc3c40a13388625726db26c953910d347cf4a9fc Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Tue, 4 May 2010 12:37:01 +0200 Subject: jl152 bundled extensions, import of changeset 263438:8b253e76e957 from native0jl --- desktop/inc/app.hxx | 1 + desktop/source/app/app.cxx | 3 + desktop/source/app/check_ext_deps.cxx | 235 +++- desktop/source/deployment/dp_services.cxx | 13 +- .../deployment/gui/dp_gui_extensioncmdqueue.cxx | 20 +- .../deployment/inc/dp_descriptioninfoset.hxx | 15 + desktop/source/deployment/inc/dp_misc.h | 21 + desktop/source/deployment/inc/dp_version.hxx | 7 - .../deployment/manager/dp_activepackages.cxx | 22 +- .../deployment/manager/dp_activepackages.hxx | 10 + .../deployment/manager/dp_extensionmanager.cxx | 1301 ++++++++++++++++++++ .../deployment/manager/dp_extensionmanager.hxx | 287 +++++ desktop/source/deployment/manager/dp_manager.cxx | 696 +++++++---- desktop/source/deployment/manager/dp_manager.h | 53 +- .../source/deployment/manager/dp_managerfac.cxx | 4 + .../source/deployment/manager/dp_tmprepocmdenv.cxx | 166 +++ .../source/deployment/manager/dp_tmprepocmdenv.hxx | 84 ++ desktop/source/deployment/manager/makefile.mk | 4 +- .../deployment/misc/dp_descriptioninfoset.cxx | 250 +++- desktop/source/deployment/misc/dp_misc.cxx | 31 + desktop/source/deployment/misc/dp_version.cxx | 6 - desktop/source/deployment/misc/makefile.mk | 3 +- .../registry/component/dp_compbackenddb.cxx | 142 +++ .../registry/component/dp_compbackenddb.hxx | 116 ++ .../deployment/registry/component/dp_component.cxx | 171 ++- .../deployment/registry/component/makefile.mk | 3 +- .../registry/configuration/dp_configuration.cxx | 13 +- desktop/source/deployment/registry/dp_backend.cxx | 81 +- .../source/deployment/registry/dp_backenddb.cxx | 332 +++++ desktop/source/deployment/registry/dp_registry.cxx | 27 +- .../registry/executable/dp_executable.cxx | 10 +- .../source/deployment/registry/help/dp_help.cxx | 13 +- .../source/deployment/registry/inc/dp_backend.h | 16 +- .../deployment/registry/inc/dp_backenddb.hxx | 121 ++ desktop/source/deployment/registry/makefile.mk | 3 +- .../deployment/registry/package/dp_description.cxx | 205 --- .../deployment/registry/package/dp_description.hxx | 125 -- .../registry/package/dp_extbackenddb.cxx | 177 +++ .../registry/package/dp_extbackenddb.hxx | 94 ++ .../deployment/registry/package/dp_package.cxx | 282 +++-- .../source/deployment/registry/package/makefile.mk | 2 +- .../deployment/registry/script/dp_script.cxx | 19 +- .../source/deployment/registry/sfwk/dp_sfwk.cxx | 18 +- desktop/source/pkgchk/unopkg/unopkg_app.cxx | 80 +- desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx | 2 +- 45 files changed, 4396 insertions(+), 888 deletions(-) create mode 100644 desktop/source/deployment/manager/dp_extensionmanager.cxx create mode 100644 desktop/source/deployment/manager/dp_extensionmanager.hxx create mode 100644 desktop/source/deployment/manager/dp_tmprepocmdenv.cxx create mode 100644 desktop/source/deployment/manager/dp_tmprepocmdenv.hxx create mode 100644 desktop/source/deployment/registry/component/dp_compbackenddb.cxx create mode 100644 desktop/source/deployment/registry/component/dp_compbackenddb.hxx create mode 100644 desktop/source/deployment/registry/dp_backenddb.cxx create mode 100644 desktop/source/deployment/registry/inc/dp_backenddb.hxx delete mode 100644 desktop/source/deployment/registry/package/dp_description.cxx delete mode 100644 desktop/source/deployment/registry/package/dp_description.hxx create mode 100644 desktop/source/deployment/registry/package/dp_extbackenddb.cxx create mode 100644 desktop/source/deployment/registry/package/dp_extbackenddb.hxx diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 0ae632a6e968..4f5a3b176be3 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -132,6 +132,7 @@ class Desktop : public Application static sal_Bool LicenseNeedsAcceptance(); static sal_Bool IsFirstStartWizardNeeded(); static sal_Bool CheckExtensionDependencies(); + static void SynchronizeExtensionRepositories(); private: // Bootstrap methods diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index efba60ca75b9..b82915871566 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1395,6 +1395,9 @@ void Desktop::Main() bool bAbort = CheckExtensionDependencies(); if ( bAbort ) return; + //Check if bundled or shared extensions were added /removed + //and process those extensions + SynchronizeExtensionRepositories(); // First Start Wizard allowed ? if ( ! pCmdLineArgs->IsNoFirstStartWizard()) diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index 8b73e0c2c525..17dc20e1a129 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -27,21 +27,27 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_desktop.hxx" +#include #include #include +#include +#include "cppuhelper/compbase3.hxx" + #include #include #include #include - +#include #include #include #include "com/sun/star/deployment/XPackage.hpp" #include "com/sun/star/deployment/XPackageManager.hpp" #include "com/sun/star/deployment/thePackageManagerFactory.hpp" +#include "com/sun/star/deployment/ExtensionManager.hpp" #include #include +#include #include #include @@ -53,9 +59,91 @@ using namespace com::sun::star; #define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) +namespace +{ +//For use with XExtensionManager.synchronize +class SilentCommandEnv + : public ::cppu::WeakImplHelper3< ucb::XCommandEnvironment, + task::XInteractionHandler, + ucb::XProgressHandler > +{ +public: + virtual ~SilentCommandEnv(){}; + SilentCommandEnv(){}; + + // XCommandEnvironment + virtual uno::Reference SAL_CALL + getInteractionHandler() throw (uno::RuntimeException); + virtual uno::Reference + SAL_CALL getProgressHandler() throw (uno::RuntimeException); + + // XInteractionHandler + virtual void SAL_CALL handle( + uno::Reference const & xRequest ) + throw (uno::RuntimeException); + + // XProgressHandler + virtual void SAL_CALL push( uno::Any const & Status ) + throw (uno::RuntimeException); + virtual void SAL_CALL update( uno::Any const & Status ) + throw (uno::RuntimeException); + virtual void SAL_CALL pop() throw (uno::RuntimeException); +}; +Reference SilentCommandEnv::getInteractionHandler() +throw (uno::RuntimeException) +{ + return this; +} + +Reference SilentCommandEnv::getProgressHandler() +throw (uno::RuntimeException) +{ + return this; +} + +// XInteractionHandler +void SilentCommandEnv::handle( + Reference< task::XInteractionRequest> const & xRequest ) + throw (uno::RuntimeException) +{ + uno::Any request( xRequest->getRequest() ); + + // We approve everything here + uno::Sequence< Reference< task::XInteractionContinuation > > conts( + xRequest->getContinuations() ); + Reference< task::XInteractionContinuation > const * pConts = + conts.getConstArray(); + sal_Int32 len = conts.getLength(); + for ( sal_Int32 pos = 0; pos < len; ++pos ) + { + + Reference< task::XInteractionApprove > xInteractionApprove( + pConts[ pos ], uno::UNO_QUERY ); + if (xInteractionApprove.is()) { + xInteractionApprove->select(); + } + } +} + +// XProgressHandler +void SilentCommandEnv::push( uno::Any const & /*Status*/ ) +throw (uno::RuntimeException) +{ +} + + +void SilentCommandEnv::update( uno::Any const & /*Status */) +throw (uno::RuntimeException) +{ +} + +void SilentCommandEnv::pop() throw (uno::RuntimeException) +{ +} + +} // end namespace static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ); - //------------------------------------------------------------------------------ static sal_Int16 impl_showExtensionDialog( uno::Reference< uno::XComponentContext > &xContext ) { @@ -254,3 +342,146 @@ sal_Bool Desktop::CheckExtensionDependencies() return bAbort; } +//Returns true if the Folder was more recently modified then +//the lastsynchronized file. That is the repository needs to +//be synchronized. +static bool compareExtensionFolderWithLastSynchronizedFile( + OUString const & folderURL, OUString const & fileURL) +{ + bool bNeedsSync = false; + ::osl::DirectoryItem itemExtFolder; + ::osl::File::RC err1 = + ::osl::DirectoryItem::get(folderURL, itemExtFolder); + //If it does not exist, then there is nothing to be done + if (err1 == ::osl::File::E_NOENT) + { + return false; + } + else if (err1 != ::osl::File::E_None) + { + OSL_ENSURE(0, "Cannot access extension folder"); + return true; //sync just in case + } + + //If last synchronized does not exist, then OOo is started for the first time + ::osl::DirectoryItem itemFile; + ::osl::File::RC err2 = ::osl::DirectoryItem::get(fileURL, itemFile); + if (err2 == ::osl::File::E_NOENT) + { + return true; + + } + else if (err2 != ::osl::File::E_None) + { + OSL_ENSURE(0, "Cannot access file lastsynchronized"); + return true; //sync just in case + } + + //compare the modification time of the extension folder and the last + //modified file + ::osl::FileStatus statFolder(FileStatusMask_ModifyTime); + ::osl::FileStatus statFile(FileStatusMask_ModifyTime); + if (itemExtFolder.getFileStatus(statFolder) == ::osl::File::E_None) + { + if (itemFile.getFileStatus(statFile) == ::osl::File::E_None) + { + TimeValue timeFolder = statFolder.getModifyTime(); + TimeValue timeFile = statFile.getModifyTime(); + + if (timeFile.Seconds < timeFolder.Seconds) + bNeedsSync = true; + } + else + { + OSL_ASSERT(0); + bNeedsSync = true; + } + } + else + { + OSL_ASSERT(0); + bNeedsSync = true; + } + return bNeedsSync; +} + +static bool needToSyncRepostitory(OUString const & name) +{ + OUString folder; + OUString file; + if (name.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("bundled")))) + { + folder = OUString( + RTL_CONSTASCII_USTRINGPARAM("$BUNDLED_EXTENSIONS")); + file = OUString ( + RTL_CONSTASCII_USTRINGPARAM( + "$BUNDLED_EXTENSIONS_USER/lastsynchronized")); + } + else if (name.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("shared")))) + { + folder = OUString( + RTL_CONSTASCII_USTRINGPARAM( + "$UNO_SHARED_PACKAGES_CACHE/uno_packages")); + file = OUString ( + RTL_CONSTASCII_USTRINGPARAM( + "$SHARED_EXTENSIONS_USER/lastsynchronized")); + } + else + { + OSL_ASSERT(0); + return true; + } + ::rtl::Bootstrap::expandMacros(folder); + ::rtl::Bootstrap::expandMacros(file); + return compareExtensionFolderWithLastSynchronizedFile( + folder, file); +} + +void Desktop::SynchronizeExtensionRepositories() +{ + RTL_LOGFILE_CONTEXT(aLog,"desktop (jl97489) ::Desktop::SynchronizeExtensionRepositories"); + OUString sDisable; + ::rtl::Bootstrap::get( + OUString(RTL_CONSTASCII_USTRINGPARAM("DISABLE_SYNC_EXTENSIONS")), + sDisable, + OUString(RTL_CONSTASCII_USTRINGPARAM(""))); + if (sDisable.getLength() > 0) + return; + Reference xExtensionManager; + //synchronize shared before bundled otherewise there are + //more revoke and registration calls. + OUString sShared(RTL_CONSTASCII_USTRINGPARAM("shared")); + if (needToSyncRepostitory(sShared)) + { + xExtensionManager = + deployment::ExtensionManager::get( + comphelper_getProcessComponentContext()); + if (xExtensionManager.is()) + { + Reference cmdEnv( + new SilentCommandEnv()); + xExtensionManager->synchronize( + sShared, Reference(), cmdEnv); + } + + } + + OUString sBundled(RTL_CONSTASCII_USTRINGPARAM("bundled")); + if (needToSyncRepostitory( sBundled)) + { + if (!xExtensionManager.is()) + { + xExtensionManager = + deployment::ExtensionManager::get( + comphelper_getProcessComponentContext()); + } + if (xExtensionManager.is()) + { + Reference cmdEnv( + new SilentCommandEnv()); + xExtensionManager->synchronize( + sBundled, Reference(), cmdEnv); + + } + } +} diff --git a/desktop/source/deployment/dp_services.cxx b/desktop/source/deployment/dp_services.cxx index c83a62bfd17e..05b9a2a1971a 100644 --- a/desktop/source/deployment/dp_services.cxx +++ b/desktop/source/deployment/dp_services.cxx @@ -28,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_desktop.hxx" -#define COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS 11 +#define COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS 12 #include "comphelper/servicedecl.hxx" using namespace com::sun::star; @@ -69,6 +69,8 @@ namespace factory { extern sdecl::ServiceDecl const serviceDecl; bool singleton_entries( uno::Reference const& ); } +extern sdecl::ServiceDecl const serviceDecl; +bool singleton_entries( uno::Reference const& ); } namespace dp_log { @@ -109,9 +111,11 @@ sal_Bool SAL_CALL component_writeInfo( dp_manager::factory::serviceDecl, dp_log::serviceDecl, dp_migration::serviceDecl, - dp_info::serviceDecl ) && + dp_info::serviceDecl, + dp_manager::serviceDecl) && dp_manager::factory::singleton_entries( pRegistryKey ) && - dp_info::singleton_entries( pRegistryKey ); + dp_info::singleton_entries( pRegistryKey ) && + dp_manager::singleton_entries( pRegistryKey); } void * SAL_CALL component_getFactory( @@ -130,7 +134,8 @@ void * SAL_CALL component_getFactory( dp_manager::factory::serviceDecl, dp_log::serviceDecl, dp_migration::serviceDecl, - dp_info::serviceDecl ); + dp_info::serviceDecl, + dp_manager::serviceDecl); } } // extern "C" diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 58a5ab1c19ea..89a5ae1e22c8 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -110,12 +110,15 @@ using ::rtl::OUString; namespace { -OUString getVersion( const uno::Reference< deployment::XPackage > &rPackage ) +OUString getVersion( OUString const & sVersion ) { - OUString sVersion( rPackage->getVersion()); return ( sVersion.getLength() == 0 ) ? OUString( RTL_CONSTASCII_USTRINGPARAM( "0" ) ) : sVersion; } +OUString getVersion( const uno::Reference< deployment::XPackage > &rPackage ) +{ + return getVersion( rPackage->getVersion()); +} } @@ -468,7 +471,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & else if (request >>= verExc) { sal_uInt32 id; - switch (dp_misc::comparePackageVersions( verExc.New, verExc.Deployed )) + switch (dp_misc::compareVersions( + verExc.NewVersion, verExc.Deployed->getVersion() )) { case dp_misc::LESS: id = RID_WARNINGBOX_VERSION_LESS; @@ -480,8 +484,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & id = RID_WARNINGBOX_VERSION_GREATER; break; } - OSL_ASSERT( verExc.New.is() && verExc.Deployed.is() ); - bool bEqualNames = verExc.New->getDisplayName().equals( + OSL_ASSERT( verExc.Deployed.is() ); + bool bEqualNames = verExc.NewDisplayName.equals( verExc.Deployed->getDisplayName()); { vos::OGuard guard(Application::GetSolarMutex()); @@ -506,9 +510,9 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & { s = String(ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, *DeploymentGuiResMgr::get())); } - s.SearchAndReplaceAllAscii( "$NAME", verExc.New->getDisplayName()); + s.SearchAndReplaceAllAscii( "$NAME", verExc.NewDisplayName); s.SearchAndReplaceAllAscii( "$OLDNAME", verExc.Deployed->getDisplayName()); - s.SearchAndReplaceAllAscii( "$NEW", getVersion(verExc.New) ); + s.SearchAndReplaceAllAscii( "$NEW", getVersion(verExc.NewVersion) ); s.SearchAndReplaceAllAscii( "$DEPLOYED", getVersion(verExc.Deployed) ); box.SetMessText(s); approve = box.Execute() == RET_OK; @@ -527,7 +531,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & { vos::OGuard guard(Application::GetSolarMutex()); - approve = m_pDialogHelper->installExtensionWarn( instExc.New->getDisplayName() ); + approve = m_pDialogHelper->installExtensionWarn( instExc.displayName ); } else approve = false; diff --git a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx index 38a1870782ed..3d2d56cad00a 100644 --- a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx +++ b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx @@ -62,6 +62,7 @@ struct DESKTOP_DEPLOYMENTMISC_DLLPUBLIC SimpleLicenseAttributes bool suppressIfRequired; }; + /** Access to the content of an XML description element. @@ -226,6 +227,8 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::xml::xpath::XXPathAPI > getXpath() const; + bool hasDescription() const; + private: SAL_DLLPRIVATE ::boost::optional< ::rtl::OUString > getOptionalValue( ::rtl::OUString const & expression) const; @@ -289,6 +292,18 @@ private: ::com::sun::star::xml::xpath::XXPathAPI > m_xpath; }; +inline bool DescriptionInfoset::hasDescription() const +{ + return m_element.is(); +} + +/** creates a DescriptionInfoset object. + + The argument sExtensionFolderURL is a file URL to extension folder containing + the description.xml. + */ +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +DescriptionInfoset getDescriptionInfoset(::rtl::OUString const & sExtensionFolderURL); } #endif diff --git a/desktop/source/deployment/inc/dp_misc.h b/desktop/source/deployment/inc/dp_misc.h index a717e7797c8a..ee5867a655d3 100644 --- a/desktop/source/deployment/inc/dp_misc.h +++ b/desktop/source/deployment/inc/dp_misc.h @@ -74,9 +74,25 @@ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString expandUnoRcUrl( ::rtl::OUString const & url ); //============================================================================== + +/** appends a relative path to a url. + + The relative path must already be correctly encoded for use in an URL. + If the URL starts with vnd.sun.star.expand then the relative path will + be again encoded for use in an "expand" URL. + */ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString makeURL( ::rtl::OUString const & baseURL, ::rtl::OUString const & relPath ); + +/** appends a relative path to a url. + + This is the same as makeURL, but the relative Path must me a segment + of an system path. + */ +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString makeURLAppendSysPathSegment( + ::rtl::OUString const & baseURL, ::rtl::OUString const & relPath ); + //============================================================================== DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString generateRandomPipeId(); @@ -151,6 +167,11 @@ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC void TRACE(::rtl::OUString const & sText); DESKTOP_DEPLOYMENTMISC_DLLPUBLIC void TRACE(::rtl::OString const & sText); + +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +bool hasExtensionRepositoryChanged(::rtl::OUString const & repository); + + } #endif diff --git a/desktop/source/deployment/inc/dp_version.hxx b/desktop/source/deployment/inc/dp_version.hxx index 9808ebaab388..c459333f97a9 100644 --- a/desktop/source/deployment/inc/dp_version.hxx +++ b/desktop/source/deployment/inc/dp_version.hxx @@ -43,13 +43,6 @@ enum Order { LESS, EQUAL, GREATER }; DESKTOP_DEPLOYMENTMISC_DLLPUBLIC Order compareVersions( ::rtl::OUString const & version1, ::rtl::OUString const & version2); - -DESKTOP_DEPLOYMENTMISC_DLLPUBLIC Order comparePackageVersions( - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > - const & package1, - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > - const & package2); - } #endif diff --git a/desktop/source/deployment/manager/dp_activepackages.cxx b/desktop/source/deployment/manager/dp_activepackages.cxx index 04dc22b77a77..bf9071682b2e 100644 --- a/desktop/source/deployment/manager/dp_activepackages.cxx +++ b/desktop/source/deployment/manager/dp_activepackages.cxx @@ -96,9 +96,23 @@ static char const legacyPrefix[] = "org.openoffice.legacy."; OSL_ASSERT(i2 >= 0); d.fileName = ::rtl::OUString( value.getStr() + i1 + 1, i2 - i1 - 1, RTL_TEXTENCODING_UTF8); - d.mediaType = ::rtl::OUString( - value.getStr() + i2 + 1, value.getLength() - i2 - 1, - RTL_TEXTENCODING_UTF8); + sal_Int32 i3 = value.indexOf(separator, i2 + 1); + + if (i3 < 0) + { + //Before ActivePackages::Data::version was added + d.mediaType = ::rtl::OUString( + value.getStr() + i2 + 1, value.getLength() - i2 - 1, + RTL_TEXTENCODING_UTF8); + } + else + { + d.mediaType = ::rtl::OUString( + value.getStr() + i2 + 1, i3 - i2 -1, RTL_TEXTENCODING_UTF8); + d.version = ::rtl::OUString( + value.getStr() + i3 + 1, value.getLength() - i3 - 1, + RTL_TEXTENCODING_UTF8); + } return d; } @@ -172,6 +186,8 @@ void ActivePackages::put(::rtl::OUString const & id, Data const & data) { b.append(::rtl::OUStringToOString(data.fileName, RTL_TEXTENCODING_UTF8)); b.append(separator); b.append(::rtl::OUStringToOString(data.mediaType, RTL_TEXTENCODING_UTF8)); + b.append(separator); + b.append(::rtl::OUStringToOString(data.version, RTL_TEXTENCODING_UTF8)); m_map.put(newKey(id), b.makeStringAndClear()); } diff --git a/desktop/source/deployment/manager/dp_activepackages.hxx b/desktop/source/deployment/manager/dp_activepackages.hxx index 1c58f76be245..36060d26bd02 100644 --- a/desktop/source/deployment/manager/dp_activepackages.hxx +++ b/desktop/source/deployment/manager/dp_activepackages.hxx @@ -42,9 +42,19 @@ namespace dp_manager { class ActivePackages { public: struct Data { + /* name of the temporary file (shared, user extension) or the name of + the folder of the bundled extension. + It does not contain the trailing '_' of the folder. + UTF-8 encoded + */ ::rtl::OUString temporaryName; + /* The file name (shared, user) or the folder name (bundled) + If the key is the file name, then file name is not encoded. + If the key is the idendifier then the file name is UTF-8 encoded. + */ ::rtl::OUString fileName; ::rtl::OUString mediaType; + ::rtl::OUString version; }; typedef ::std::vector< ::std::pair< ::rtl::OUString, Data > > Entries; diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx new file mode 100644 index 000000000000..469245bef340 --- /dev/null +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -0,0 +1,1301 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include + +#include "comphelper/servicedecl.hxx" +#include "cppuhelper/exc_hlp.hxx" +#include "rtl/bootstrap.hxx" +#include "com/sun/star/deployment/ExtensionManager.hpp" +#include "com/sun/star/deployment/XExtensionManager.hpp" +#include "com/sun/star/deployment/thePackageManagerFactory.hpp" +#include "com/sun/star/deployment/XPackageManager.hpp" +#include "com/sun/star/deployment/XPackageManagerFactory.hpp" +#include "com/sun/star/deployment/XPackage.hpp" +#include "com/sun/star/deployment/InstallException.hpp" +#include "com/sun/star/deployment/VersionException.hpp" +#include "com/sun/star/deployment/LicenseException.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "com/sun/star/beans/Optional.hpp" +#include "com/sun/star/task/XInteractionApprove.hpp" +#include "com/sun/star/beans/Ambiguous.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/io/XInputStream.hpp" +#include "comphelper/sequence.hxx" +#include "xmlscript/xml_helper.hxx" +#include "osl/diagnose.h" +#include "dp_interact.h" +#include "dp_resource.h" +#include "dp_ucb.h" +#include "dp_identifier.hxx" + +#include "dp_extensionmanager.hxx" +#include "dp_tmprepocmdenv.hxx" +#include +#include +#include + +namespace deploy = com::sun::star::deployment; +namespace lang = com::sun::star::lang; +namespace registry = com::sun::star::registry; +namespace task = com::sun::star::task; +namespace ucb = com::sun::star::ucb; +namespace uno = com::sun::star::uno; +namespace beans = com::sun::star::beans; +namespace css = com::sun::star; + +//#define OUSTR(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) + +using ::com::sun::star::uno::Reference; +using ::rtl::OUString; + +namespace { + +struct CompIdentifiers +{ + bool operator() (::std::vector > const & a, + ::std::vector > const & b) + { + + if (getName(a).compareTo(getName(b)) < 0) + return true; + return false; + } + + OUString getName(::std::vector > const & a); +}; + +OUString CompIdentifiers::getName(::std::vector > const & a) +{ + OSL_ASSERT(a.size() == 3); + //get the first non-null reference + Reference extension; + ::std::vector >::const_iterator it = a.begin(); + for (; it != a.end(); it++) + { + if (it->is()) + { + extension = *it; + break; + } + } + OSL_ASSERT(extension.is()); + return extension->getDisplayName(); +} +} //end namespace + +namespace dp_manager { + + + +//------------------------------------------------------------------------------ + +//ToDo: bundled extension +ExtensionManager::ExtensionManager( Reference< uno::XComponentContext > const& xContext) : + m_xContext( xContext ) +{ + Reference xPackageManagerFactory( + deploy::thePackageManagerFactory::get(m_xContext)); + m_userRepository = xPackageManagerFactory->getPackageManager(OUSTR("user")); + m_sharedRepository = xPackageManagerFactory->getPackageManager(OUSTR("shared")); + m_bundledRepository = xPackageManagerFactory->getPackageManager(OUSTR("bundled")); + m_tmpRepository = xPackageManagerFactory->getPackageManager(OUSTR("tmp")); + + m_repositoryNames.push_back(OUSTR("user")); + m_repositoryNames.push_back(OUSTR("shared")); + m_repositoryNames.push_back(OUSTR("bundled")); +} + +//------------------------------------------------------------------------------ + +ExtensionManager::~ExtensionManager() +{ +} + +Reference ExtensionManager::createAbortChannel() + throw (uno::RuntimeException) +{ + return new dp_misc::AbortChannel; +} + +/* + Enters the XPackage objects into a map. They must be all from the + same repository. The value type of the map is a vector, where each vector + represents an extension with a particular identifier. The first member + is represents the user extension, the second the shared extension and the + third the bundled extension. + */ +void ExtensionManager::addExtensionsToMap( + id2extensions & mapExt, + uno::Sequence > const & seqExt, + OUString const & repository) +{ + //Determine the index in the vector where these extensions are to be + //added. + ::std::list::const_iterator citNames = + m_repositoryNames.begin(); + int index = 0; + for (;citNames != m_repositoryNames.end(); citNames++, index++) + { + if (citNames->equals(repository)) + break; + } + + for (int i = 0; i < seqExt.getLength(); i++) + { + Reference const & xExtension = seqExt[i]; + OUString id = dp_misc::getIdentifier(xExtension); + id2extensions::iterator ivec = mapExt.find(id); + if (ivec == mapExt.end()) + { + ::std::vector > vec(3); + vec[index] = xExtension; + mapExt[id] = vec; + } + else + { + ivec->second[index] = xExtension; + } + } +} + +/* + returns a list containing extensions with the same identifier from + all repositories (user, shared, bundled) If one repository does not + have this extension, then the list contains an empty Referenc. The list + is ordered according to the priority of the repostories: + 1. user + 2. shared + 3. bundled + + The number of elements is always three, unless the number of repository + changes. + */ +::std::list > + ExtensionManager::getExtensionsWithSameId( + OUString const & identifier, OUString const & fileName) + +{ + ::std::list > extensionList; + try + { //will throw an exception if the extension does not exist + extensionList.push_back(m_userRepository->getDeployedPackage( + identifier, fileName, Reference())); + } catch(lang::IllegalArgumentException &) + { + extensionList.push_back(Reference()); + } + try + { + extensionList.push_back(m_sharedRepository->getDeployedPackage( + identifier, fileName, Reference())); + } catch (lang::IllegalArgumentException &) + { + extensionList.push_back(Reference()); + } + try + { + extensionList.push_back(m_bundledRepository->getDeployedPackage( + identifier, fileName, Reference())); + } catch (lang::IllegalArgumentException &) + { + extensionList.push_back(Reference()); + } + OSL_ASSERT(extensionList.size() == 3); + return extensionList; +} + + +/* + +*/ +Reference ExtensionManager::getExtensionAndStatus( + ::rtl::OUString const & identifier, + ::rtl::OUString const & fileName, + ::rtl::OUString const & repository, + Reference const & xAbortChannel, + Reference const & xCmdEnv, + bool & out_bWasRegistered) +{ + Reference theExtension; + ::std::list > listExtensions = + getExtensionsWithSameId(identifier, fileName); + OSL_ASSERT(listExtensions.size() == m_repositoryNames.size()); + Reference xActiveExtension; + ::std::list::const_iterator + inames = m_repositoryNames.begin(); + ::std::list >::const_iterator + iext = listExtensions.begin(); + for (; inames != m_repositoryNames.end(); inames++, iext++) + { + if (repository.equals(*inames)) + { + theExtension = *iext; + if (iext->is()) + { + beans::Optional > optRegistered = + (*iext)->isRegistered(xAbortChannel, xCmdEnv); + OSL_ENSURE(! optRegistered.Value.IsAmbiguous, + "Extension is not properly registered"); + //IsAmbiguous = true: only partly registered, but we assume + //that this is the active extension, and something went wrong when registering it + //previously. + if (optRegistered.IsPresent + && (optRegistered.Value.Value || optRegistered.Value.IsAmbiguous)) + out_bWasRegistered = true; + } + break; + } + } + return theExtension; +} + +/* + Determines if the user extension was disabled by the user. Currently a user + cannot disable extensions from other repositories. If an extension does not + contain any items which need to be registered then the extension cannot + actually be disabled (because it cannot be registered). In this case false is + returned. If there is no user extension then also false is returned. + + A user extension is regarded as disabled if there is an extension in a + repository with a lower priority that is registered. + */ +bool ExtensionManager::isUserExtensionDisabled( + OUString const & identifier, OUString const & fileName, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ) + +{ + bool bDisabled = false; + ::std::list > listExtensions = + getExtensionsWithSameId(identifier, fileName); + ::std::list >::const_iterator + iext = listExtensions.begin(); + bool bCheckOptional = false; + Reference xActive; + for (; iext != listExtensions.end(); iext++) + { + if (iext->is()) + { + if (!(*iext)->isRegistered(xAbortChannel, xCmdEnv).IsPresent) + { + // IsPresent must be the same for all extnesions + OSL_ASSERT(!bCheckOptional); + break; + } + else + { + bCheckOptional = true; + if ((*iext)->isRegistered(xAbortChannel, xCmdEnv).Value.Value) + { + xActive = *iext; + break; + } + } + } + Reference const & xUser = listExtensions.front(); + if (xUser.is() + && xActive.is() + && xUser != xActive) + bDisabled = true; + } + return bDisabled; +} +/* + This method determines the active extension (XPackage.registerPackage) with a + particular identifier. + + The parameter bUserDisabled determines if the user extension is disabled. + + When the user repository contains an extension with the given identifier and + it is not disabled by the user, then it is always registered. Otherwise an + extension is only registered when there is no registered extension in one of + the repositories with a higher priority. That is, if the extension is from + the shared repository and an active extension with the same identifer is in + the user repository, then the extension is not registered. Similarly a + bundled extension is not registered if there is an active extension with the + same identifier in the shared or user repository. +*/ +void ExtensionManager::activateExtension( + OUString const & identifier, OUString const & fileName, + bool bUserDisabled, + Reference const & xAbortChannel, + Reference const & xCmdEnv ) +{ + ::std::list > listExtensions = + getExtensionsWithSameId(identifier, fileName); + OSL_ASSERT(listExtensions.size() == 3); + ::std::list >::const_iterator + iext = listExtensions.begin(); + //skip disabled user extension + if (listExtensions.front().is() && bUserDisabled) + iext++; + bool bActive = false; + for (; iext != listExtensions.end(); iext++) + { + if (iext->is()) + { + //get the registration value of the current iteration + beans::Optional > optReg = + (*iext)->isRegistered(xAbortChannel, xCmdEnv); + //If nothing can be registered then break + if (!optReg.IsPresent) + break; + + //If we have already determined an active extension then we must + //make sure to unregister all extensions with the same id in + //repositories with a lower priority + if (bActive) + { + (*iext)->revokePackage(xAbortChannel, xCmdEnv); + } + else + { + //This is the first extension in the ordered list, which becomes + //the active extension + bActive = true; + //Register if not already done. + //reregister if the value is ambiguous, which indicates that + //something went wrong during last registration. + (*iext)->registerPackage(xAbortChannel, xCmdEnv); + } + } + } +} + +Reference ExtensionManager::backupExtension( + OUString const & identifier, OUString const & fileName, + Reference const & xPackageManager, + Reference const & xCmdEnv ) +{ + Reference xBackup; + Reference tmpCmdEnv( + new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler())); + Reference xOldExtension; + xOldExtension = xPackageManager->getDeployedPackage( + identifier, fileName, tmpCmdEnv); + + if (xOldExtension.is()) + { + xBackup = m_tmpRepository->addPackage( + xOldExtension->getURL(), OUString(), + Reference(), tmpCmdEnv); + + OSL_ENSURE(xBackup.is(), "Failed to backup extension"); + } + return xBackup; +} + +uno::Sequence< Reference > +ExtensionManager::getSupportedPackageTypes(OUString const & repository) + throw (uno::RuntimeException) +{ + if (repository.equals(OUSTR("user"))) + return m_userRepository->getSupportedPackageTypes(); + else if (repository.equals(OUSTR("shared"))) + return m_sharedRepository->getSupportedPackageTypes(); + else + return uno::Sequence< Reference >(); +} + +// Only add to shared and user repository +Reference ExtensionManager::addExtension( + OUString const & url, OUString const & repository, + Reference const & xAbortChannel, + Reference const & xCmdEnv ) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + Reference xNewExtension; + //Determine the repository to use + Reference xPackageManager; + if (repository.equals(OUSTR("user"))) + xPackageManager = m_userRepository; + else if (repository.equals(OUSTR("shared"))) + xPackageManager = m_sharedRepository; + else + throw lang::IllegalArgumentException( + OUSTR("No valid repository name provided."), + static_cast(this), 0); + + ::osl::MutexGuard guard(m_mutex); + Reference xTmpExtension = + getTempExtension(url, xAbortChannel, xCmdEnv); + const OUString sIdentifier = dp_misc::getIdentifier(xTmpExtension); + const OUString sFileName = xTmpExtension->getName(); + const OUString sDisplayName = xTmpExtension->getDisplayName(); + const OUString sVersion = xTmpExtension->getVersion(); + + Reference xOldExtension; + bool bUserDisabled = false; + Reference xExtensionBackup; + + uno::Any excOccurred1; + uno::Any excOccurred2; + + try + { + //If we add a user extension and there is already one which was + //disabled by a user, then the newly installed one is enabled. If we + //add to another repository then the user extension remains + //disabled. + if (! repository.equals(OUSTR("user"))) + bUserDisabled = isUserExtensionDisabled( + sIdentifier, sFileName, xAbortChannel, xCmdEnv); + + bool bWasRegistered = false; + xOldExtension = getExtensionAndStatus( + sIdentifier, sFileName, repository, xAbortChannel, + xCmdEnv, bWasRegistered); + bool bCanInstall = false; + try + { + if (xOldExtension.is()) + { + //throws a CommandFailedException if the user cancels + //the action. + checkUpdate(sVersion, sDisplayName,xOldExtension, xCmdEnv); + } + else + { + //throws a CommandFailedException if the user cancels + //the action. + checkInstall(sDisplayName, xCmdEnv); + } + + bCanInstall = xTmpExtension->checkPrerequisites( + xAbortChannel, xCmdEnv, xOldExtension.is(), repository); + } + catch (deploy::DeploymentException& ) { + excOccurred1 = ::cppu::getCaughtException(); + } catch (ucb::CommandFailedException & ) { + excOccurred1 = ::cppu::getCaughtException(); + } catch (ucb::CommandAbortedException & ) { + excOccurred1 = ::cppu::getCaughtException(); + } catch (lang::IllegalArgumentException &) { + excOccurred1 = ::cppu::getCaughtException(); + } catch (uno::RuntimeException &) { + excOccurred1 = ::cppu::getCaughtException(); + } catch (...) { + excOccurred1 = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception during addExtension, url: ") + + url, static_cast(this), excOccurred1); + excOccurred1 <<= exc; + } + + if (bCanInstall) + { + if (xOldExtension.is()) + { + if (bWasRegistered) + xOldExtension->revokePackage(xAbortChannel, xCmdEnv); + //save the old user extension in case the user aborts + //store the extension in the tmp repository, this will overwrite + //xTmpPackage (same identifier). Do not let the user abort or + //interact + Reference tmpCmdEnv( + new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler())); + //importing the old extension in the tmp repository will remove + //the xTmpExtension + xTmpExtension = 0; + xExtensionBackup = m_tmpRepository->importExtension( + xOldExtension, Reference(), + tmpCmdEnv); + } + + xNewExtension = xPackageManager->addPackage( + url, OUString(), xAbortChannel, xCmdEnv); + activateExtension( + dp_misc::getIdentifier(xNewExtension), + xNewExtension->getName(), bUserDisabled, + xAbortChannel, xCmdEnv); + } + } + catch (deploy::DeploymentException& ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (ucb::CommandFailedException & ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (ucb::CommandAbortedException & ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (lang::IllegalArgumentException &) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (uno::RuntimeException &) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (...) { + excOccurred2 = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception during addExtension, url: ") + + url, static_cast(this), excOccurred2); + excOccurred2 <<= exc; + } + + if (excOccurred2.hasValue()) + { + //It does not matter what exception is thrown. We try to + //recover the original status. + //If the user aborted installation then a ucb::CommandAbortedException + //is thrown. + //Use a private AbortChannel so the user cannot interrupt. + try + { + Reference tmpCmdEnv( + new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler())); + if (xExtensionBackup.is()) + { + Reference xRestored = + xPackageManager->importExtension( + xExtensionBackup, Reference(), + tmpCmdEnv); + } + activateExtension( + sIdentifier, sFileName, bUserDisabled, + Reference(), tmpCmdEnv); + if (xTmpExtension.is() || xExtensionBackup.is()) + m_tmpRepository->removePackage( + sIdentifier, OUString(), xAbortChannel, xCmdEnv); + } + catch (...) + { + } + ::cppu::throwException(excOccurred2); + } + if (xTmpExtension.is() || xExtensionBackup.is()) + m_tmpRepository->removePackage( + sIdentifier,OUString(), xAbortChannel, xCmdEnv); + + if (excOccurred1.hasValue()) + ::cppu::throwException(excOccurred1); + + return xNewExtension; +} + +void ExtensionManager::removeExtension( + OUString const & identifier, OUString const & fileName, + OUString const & repository, + Reference const & xAbortChannel, + Reference const & xCmdEnv ) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + uno::Any excOccurred1; + Reference xExtensionBackup; + Reference xPackageManager; + bool bUserDisabled = false; + try + { +//Determine the repository to use + if (repository.equals(OUSTR("user"))) + xPackageManager = m_userRepository; + else if (repository.equals(OUSTR("shared"))) + xPackageManager = m_sharedRepository; + else + throw lang::IllegalArgumentException( + OUSTR("No valid repository name provided."), + static_cast(this), 0); + + ::osl::MutexGuard guard(m_mutex); + //Backup the extension, in case the user cancels the action + + bUserDisabled = isUserExtensionDisabled( + identifier, fileName, xAbortChannel, xCmdEnv); + //Backup the extension, in case the user cancels the action + xExtensionBackup = backupExtension( + identifier, fileName, xPackageManager, xCmdEnv); + + //revoke the extension if it is active + Reference xOldExtension = + xPackageManager->getDeployedPackage( + identifier, fileName, xCmdEnv); + xOldExtension->revokePackage(xAbortChannel, xCmdEnv); + + xPackageManager->removePackage( + identifier, fileName, xAbortChannel, xCmdEnv); + activateExtension(identifier, fileName, bUserDisabled, + xAbortChannel, xCmdEnv); + } + catch (deploy::DeploymentException& ) { + excOccurred1 = ::cppu::getCaughtException(); + } catch (ucb::CommandFailedException & ) { + excOccurred1 = ::cppu::getCaughtException(); + } catch (ucb::CommandAbortedException & ) { + excOccurred1 = ::cppu::getCaughtException(); + } catch (lang::IllegalArgumentException &) { + excOccurred1 = ::cppu::getCaughtException(); + } catch (uno::RuntimeException &) { + excOccurred1 = ::cppu::getCaughtException(); + } catch (...) { + excOccurred1 = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception during removeEtension"), + static_cast(this), excOccurred1); + excOccurred1 <<= exc; + } + + if (excOccurred1.hasValue()) + { + //User aborted installation, restore the previous situation. + //Use a private AbortChannel so the user cannot interrupt. + try + { + Reference tmpCmdEnv( + new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler())); + if (xExtensionBackup.is()) + { + Reference xRestored = + xPackageManager->importExtension( + xExtensionBackup, Reference(), + tmpCmdEnv); + activateExtension( + identifier, fileName, bUserDisabled, Reference(), + tmpCmdEnv); + + m_tmpRepository->removePackage( + dp_misc::getIdentifier(xExtensionBackup), + xExtensionBackup->getName(), xAbortChannel, xCmdEnv); + } + } + catch (...) + { + } + ::cppu::throwException(excOccurred1); + } + + if (xExtensionBackup.is()) + m_tmpRepository->removePackage( + dp_misc::getIdentifier(xExtensionBackup), + xExtensionBackup->getName(), xAbortChannel, xCmdEnv); +} + +// Only enable extensions from shared and user repository +void ExtensionManager::enableExtension( + Reference const & extension, + Reference const & xAbortChannel, + Reference const & xCmdEnv) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + try + { + if (!extension.is()) + return; + + OUString repository = extension->getRepositoryName(); + if (!repository.equals(OUSTR("user"))) + throw lang::IllegalArgumentException( + OUSTR("No valid repository name provided."), + static_cast(this), 0); + ::osl::MutexGuard guard(m_mutex); + + //if it is already registered or if it cannot be registered + //because it does not contain any files which need to be processed + //then there is nothing to do here + beans::Optional > reg = + extension->isRegistered(xAbortChannel, xCmdEnv); + if (!reg.IsPresent + || (!reg.Value.IsAmbiguous && reg.Value.Value)) + return; + } + catch (deploy::DeploymentException& ) { + throw; + } catch (ucb::CommandFailedException & ) { + throw; + } catch (ucb::CommandAbortedException & ) { + throw; + } catch (lang::IllegalArgumentException &) { + throw; + } catch (uno::RuntimeException &) { + throw; + } catch (...) { + uno::Any exc = ::cppu::getCaughtException(); + throw deploy::DeploymentException( + OUSTR("Extension Manager: exception during enableExtension"), + static_cast(this), exc); + } + + uno::Any excOccurred; + try + { + activateExtension(dp_misc::getIdentifier(extension), + extension->getName(), + false, xAbortChannel, xCmdEnv); + } + catch (deploy::DeploymentException& ) { + excOccurred = ::cppu::getCaughtException(); + } catch (ucb::CommandFailedException & ) { + excOccurred = ::cppu::getCaughtException(); + } catch (ucb::CommandAbortedException & ) { + excOccurred = ::cppu::getCaughtException(); + } catch (lang::IllegalArgumentException &) { + excOccurred = ::cppu::getCaughtException(); + } catch (uno::RuntimeException &) { + excOccurred = ::cppu::getCaughtException(); + } catch (...) { + excOccurred = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception during enableExtension"), + static_cast(this), excOccurred); + excOccurred <<= exc; + } + + if (excOccurred.hasValue()) + { + try + { + extension->revokePackage(Reference(), xCmdEnv); + activateExtension(dp_misc::getIdentifier(extension), + extension->getName(), + true, xAbortChannel, xCmdEnv); + } + catch (...) + { + } + ::cppu::throwException(excOccurred); + } +} + +void ExtensionManager::disableExtension( + Reference const & extension, + Reference const & xAbortChannel, + Reference const & xCmdEnv ) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + uno::Any excOccurred; + try + { + if (!extension.is()) + return; + + ::osl::MutexGuard guard(m_mutex); + OUString repository = extension->getRepositoryName(); + if (!repository.equals(OUSTR("user"))) + throw lang::IllegalArgumentException( + OUSTR("No valid repository name provided."), + static_cast(this), 0); + + //if it is already registered or if it cannot be registered + //because it does not contain any files which need to be processed + //then there is nothing to do here + beans::Optional > reg = + extension->isRegistered(xAbortChannel, xCmdEnv); + if (!reg.IsPresent + || (!reg.Value.IsAmbiguous && !reg.Value.Value)) + return; + + extension->revokePackage(xAbortChannel, xCmdEnv); + activateExtension(dp_misc::getIdentifier(extension), + extension->getName(), + true, xAbortChannel, xCmdEnv); + } + catch (deploy::DeploymentException& ) { + excOccurred = ::cppu::getCaughtException(); + } catch (ucb::CommandFailedException & ) { + excOccurred = ::cppu::getCaughtException(); + } catch (ucb::CommandAbortedException & ) { + excOccurred = ::cppu::getCaughtException(); + } catch (lang::IllegalArgumentException &) { + excOccurred = ::cppu::getCaughtException(); + } catch (uno::RuntimeException &) { + excOccurred = ::cppu::getCaughtException(); + } catch (...) { + excOccurred = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception during disableExtension"), + static_cast(this), excOccurred); + excOccurred <<= exc; + } + + if (excOccurred.hasValue()) + { + try + { + activateExtension(dp_misc::getIdentifier(extension), + extension->getName(), + false, xAbortChannel, xCmdEnv); + } + catch (...) + { + } + ::cppu::throwException(excOccurred); + } +} + +uno::Sequence< Reference > + ExtensionManager::getDeployedExtensions( + OUString const & repository, + Reference const &xAbort, + Reference const & xCmdEnv ) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + if (repository.equals(OUSTR("user"))) + { + return m_userRepository->getDeployedPackages( + xAbort, xCmdEnv); + } + else if (repository.equals(OUSTR("shared"))) + { + return m_sharedRepository->getDeployedPackages( + xAbort, xCmdEnv); + } + else if (repository.equals(OUSTR("bundled"))) + { + return m_bundledRepository->getDeployedPackages( + xAbort, xCmdEnv); + } + else + throw lang::IllegalArgumentException( + OUSTR("No valid repository name provided."), + static_cast(this), 0); + +} + +Reference + ExtensionManager::getDeployedExtension( + OUString const & repository, + OUString const & identifier, + OUString const & filename, + Reference const & xCmdEnv ) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + if (repository.equals(OUSTR("user"))) + { + return m_userRepository->getDeployedPackage( + identifier, filename, xCmdEnv); + } + else if (repository.equals(OUSTR("shared"))) + { + return m_sharedRepository->getDeployedPackage( + identifier, filename, xCmdEnv); + } + else if (repository.equals(OUSTR("bundled"))) + { + return m_bundledRepository->getDeployedPackage( + identifier, filename, xCmdEnv); + } + else + throw lang::IllegalArgumentException( + OUSTR("No valid repository name provided."), + static_cast(this), 0); +} + +uno::Sequence< uno::Sequence > > + ExtensionManager::getAllExtensions( + Reference const & xAbort, + Reference const & xCmdEnv ) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + uno::Sequence< uno::Sequence > > seqSeq; + try + { + id2extensions mapExt; + + uno::Sequence > userExt = + m_userRepository->getDeployedPackages(xAbort, xCmdEnv); + addExtensionsToMap(mapExt, userExt, OUSTR("user")); + uno::Sequence > sharedExt = + m_sharedRepository->getDeployedPackages(xAbort, xCmdEnv); + addExtensionsToMap(mapExt, sharedExt, OUSTR("shared")); + uno::Sequence > bundledExt = + m_bundledRepository->getDeployedPackages(xAbort, xCmdEnv); + addExtensionsToMap(mapExt, bundledExt, OUSTR("bundled")); + + //copy the values of the map to a vector for sorting + ::std::vector< ::std::vector > > + vecExtensions; + id2extensions::const_iterator mapIt = mapExt.begin(); + for (;mapIt != mapExt.end(); mapIt++) + vecExtensions.push_back(mapIt->second); + + //sort the element according to the identifier + ::std::sort(vecExtensions.begin(), vecExtensions.end(), CompIdentifiers()); + + ::std::vector< ::std::vector > >::const_iterator + citVecVec = vecExtensions.begin(); + sal_Int32 j = 0; + for (;citVecVec != vecExtensions.end(); citVecVec++, j++) + { + seqSeq[j] = comphelper::containerToSequence(*citVecVec); + } + } catch (deploy::DeploymentException& ) { + throw; + } catch (ucb::CommandFailedException & ) { + throw; + } catch (ucb::CommandAbortedException & ) { + throw; + } catch (lang::IllegalArgumentException &) { + throw; + } catch (uno::RuntimeException &) { + throw; + } catch (...) { + uno::Any exc = ::cppu::getCaughtException(); + throw deploy::DeploymentException( + OUSTR("Extension Manager: exception during enableExtension"), + static_cast(this), exc); + } + + return seqSeq; +} + +void ExtensionManager::reinstallDeployedExtensions( + OUString const & repository, + Reference const & xAbortChannel, + Reference const & xCmdEnv ) + throw (deploy::DeploymentException, + ucb::CommandFailedException, ucb::CommandAbortedException, + lang::IllegalArgumentException, uno::RuntimeException) +{ + try + { + Reference xPackageManager; + if (repository.equals(OUSTR("user"))) + xPackageManager = m_userRepository; + else if (repository.equals(OUSTR("shared"))) + xPackageManager = m_sharedRepository; + else if (repository.equals(OUSTR("bundled"))) + xPackageManager = m_bundledRepository; + else + throw lang::IllegalArgumentException( + OUSTR("No valid repository name provided."), + static_cast(this), 0); + + ::osl::MutexGuard guard(m_mutex); + xPackageManager->reinstallDeployedPackages(xAbortChannel, xCmdEnv); + const uno::Sequence< Reference > extensions( + xPackageManager->getDeployedPackages(xAbortChannel, xCmdEnv)); + + for ( sal_Int32 pos = 0; pos < extensions.getLength(); ++pos ) + { + try + { + const OUString id = dp_misc::getIdentifier(extensions[ pos ]); + const OUString fileName = extensions[ pos ]->getName(); + OSL_ASSERT(id.getLength()); + activateExtension( + id, fileName, + isUserExtensionDisabled(id, fileName, xAbortChannel, xCmdEnv), + xAbortChannel, xCmdEnv ); + } + catch (lang::DisposedException &) + { + } + } + } catch (deploy::DeploymentException& ) { + throw; + } catch (ucb::CommandFailedException & ) { + throw; + } catch (ucb::CommandAbortedException & ) { + throw; + } catch (lang::IllegalArgumentException &) { + throw; + } catch (uno::RuntimeException &) { + throw; + } catch (...) { + uno::Any exc = ::cppu::getCaughtException(); + throw deploy::DeploymentException( + OUSTR("Extension Manager: exception during enableExtension"), + static_cast(this), exc); + } +} + +void ExtensionManager::synchronize( + OUString const & repository, + Reference const & xAbortChannel, + Reference const & xCmdEnv ) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + try + { + Reference xPackageManager; + OUString file; + if (repository.equals(OUSTR("user"))) + { + xPackageManager = m_userRepository; + } + else if (repository.equals(OUSTR("shared"))) + { + xPackageManager = m_sharedRepository; + file = OUString ( + RTL_CONSTASCII_USTRINGPARAM( + "$SHARED_EXTENSIONS_USER/lastsynchronized")); + } + else if (repository.equals(OUSTR("bundled"))) + { + xPackageManager = m_bundledRepository; + file = OUString ( + RTL_CONSTASCII_USTRINGPARAM( + "$BUNDLED_EXTENSIONS_USER/lastsynchronized")); + } + else + throw lang::IllegalArgumentException( + OUSTR("No valid repository name provided."), + static_cast(this), 0); + + ::osl::MutexGuard guard(m_mutex); + uno::Sequence > seqAddedExtensions; + uno::Sequence > seqRemovedExtensions; + xPackageManager->synchronize(seqAddedExtensions, seqRemovedExtensions, + xAbortChannel, xCmdEnv); + + //ToDo: optimize, only call activateExtension once per id. + //Determine which of the extensions was disabled by the user + //iterate of both sequences and add the ids of the user disabled + //to a map + for (sal_Int32 i = 0; i < seqRemovedExtensions.getLength(); i++) + { + try + { + Reference const & xExtension = seqRemovedExtensions[i]; + OSL_ASSERT(xExtension.is()); + const OUString id = dp_misc::getIdentifier(xExtension); + const OUString fileName = xExtension->getName(); + + bool bUserDisabled = isUserExtensionDisabled( + id, xExtension->getName(), xAbortChannel, xCmdEnv); + xExtension->revokePackage(xAbortChannel, xCmdEnv); + xPackageManager->removePackage( + id, fileName, xAbortChannel, xCmdEnv); + activateExtension( + id, fileName, bUserDisabled, xAbortChannel, xCmdEnv); + } + catch (...) + { + OSL_ENSURE(0, "Extensions Manager: synchronize"); + } + } + + for (sal_Int32 i = 0; i < seqAddedExtensions.getLength(); i++) + { + try + { + Reference const & xExtension = seqAddedExtensions[i]; + OSL_ASSERT(xExtension.is()); + const OUString id = dp_misc::getIdentifier(xExtension); + const OUString fileName = xExtension->getName(); + bool bUserDisabled = isUserExtensionDisabled( + id, fileName, xAbortChannel, xCmdEnv); + activateExtension( + id, fileName, bUserDisabled, xAbortChannel, xCmdEnv); + } + catch (...) + { + OSL_ENSURE(0, "Extensions Manager: synchronize"); + } + } + + //Write the lastmodified file + try { + ::rtl::Bootstrap::expandMacros(file); + ::ucbhelper::Content ucbStamp(file, xCmdEnv ); + dp_misc::erase_path( file, xCmdEnv ); + ::rtl::OString stamp("1" ); + Reference xData( + ::xmlscript::createInputStream( + ::rtl::ByteSequence( + reinterpret_cast(stamp.getStr()), + stamp.getLength() ) ) ); + ucbStamp.writeStream( xData, true /* replace existing */ ); + } + catch(...) + { + uno::Any exc(::cppu::getCaughtException()); + throw deploy::DeploymentException( + OUSTR("Failed to update") + file, + static_cast(this), exc); + + } + } catch (deploy::DeploymentException& ) { + throw; + } catch (ucb::CommandFailedException & ) { + throw; + } catch (ucb::CommandAbortedException & ) { + throw; + } catch (lang::IllegalArgumentException &) { + throw; + } catch (uno::RuntimeException &) { + throw; + } catch (...) { + uno::Any exc = ::cppu::getCaughtException(); + throw deploy::DeploymentException( + OUSTR("Extension Manager: exception during enableExtension"), + static_cast(this), exc); + } +} + +// Notify the user when a new extension is to be installed. This is only the +// case when one uses the system integration to install an extension (double +// clicking on .oxt file etc.)). The function must only be called if there is no +// extension with the same identifier already deployed. Then the checkUpdate +// function will inform the user that the extension is about to be installed In +// case the user cancels the installation a CommandFailed exception is +// thrown. +void ExtensionManager::checkInstall( + OUString const & displayName, + Reference const & cmdEnv) +{ + uno::Any request( + deploy::InstallException( + OUSTR("Extension ") + displayName + + OUSTR(" is about to be installed."), + static_cast(this), displayName)); + bool approve = false, abort = false; + if (! dp_misc::interactContinuation( + request, task::XInteractionApprove::static_type(), + cmdEnv, &approve, &abort )) + { + OSL_ASSERT( !approve && !abort ); + throw deploy::DeploymentException( + dp_misc::getResourceString(RID_STR_ERROR_WHILE_ADDING) + displayName, + static_cast(this), request ); + } + if (abort || !approve) + throw ucb::CommandFailedException( + dp_misc::getResourceString(RID_STR_ERROR_WHILE_ADDING) + displayName, + static_cast(this), request ); +} + +/* The function will make the user interaction in case there is an extension +installed with the same id. This function may only be called if there is already +an extension. +*/ +void ExtensionManager::checkUpdate( + OUString const & newVersion, + OUString const & newDisplayName, + Reference const & oldExtension, + Reference const & xCmdEnv ) +{ + // package already deployed, interact --force: + uno::Any request( + (deploy::VersionException( + dp_misc::getResourceString( + RID_STR_PACKAGE_ALREADY_ADDED ) + newDisplayName, + static_cast(this), newVersion, newDisplayName, + oldExtension ) ) ); + bool replace = false, abort = false; + if (! dp_misc::interactContinuation( + request, task::XInteractionApprove::static_type(), + xCmdEnv, &replace, &abort )) { + OSL_ASSERT( !replace && !abort ); + throw deploy::DeploymentException( + dp_misc::getResourceString( + RID_STR_ERROR_WHILE_ADDING) + newDisplayName, + static_cast(this), request ); + } + if (abort || !replace) + throw ucb::CommandFailedException( + dp_misc::getResourceString( + RID_STR_PACKAGE_ALREADY_ADDED) + newDisplayName, + static_cast(this), request ); +} + +Reference ExtensionManager::getTempExtension( + OUString const & url, + Reference const & xAbortChannel, + Reference const & /*xCmdEnv*/) + +{ + Reference tmpCmdEnvA(new TmpRepositoryCommandEnv()); + Reference xTmpPackage = m_tmpRepository->addPackage( + url, OUString(), xAbortChannel, tmpCmdEnvA); + + if (!xTmpPackage.is()) + { + throw deploy::DeploymentException( + OUSTR("Extension Manager: Failed to create temporary XPackage for url: ") + url, + static_cast(this), uno::Any()); + + } + return xTmpPackage; +} +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ + +namespace sdecl = comphelper::service_decl; +sdecl::class_ servicePIP; +extern sdecl::ServiceDecl const serviceDecl( + servicePIP, + // a private one: + "com.sun.star.comp.deployment.ExtensionManager", + "com.sun.star.comp.deployment.ExtensionManager"); + +//------------------------------------------------------------------------------ +bool singleton_entries( + uno::Reference< registry::XRegistryKey > const & xRegistryKey ) +{ + try { + uno::Reference< registry::XRegistryKey > xKey( + xRegistryKey->createKey( + serviceDecl.getImplementationName() + + // xxx todo: use future generated function to get singleton name + OUSTR("/UNO/SINGLETONS/" + "com.sun.star.deployment.ExtensionManager") ) ); + xKey->setStringValue( serviceDecl.getSupportedServiceNames()[0] ); + return true; + } + catch (registry::InvalidRegistryException & exc) { + (void) exc; // avoid warnings + OSL_ENSURE( 0, ::rtl::OUStringToOString( + exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); + return false; + } +} + +} // namespace dp_manager + + diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx new file mode 100644 index 000000000000..386e2a7ceffd --- /dev/null +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -0,0 +1,287 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#if ! defined INCLUDED_DP_EXTENSIONMANAGER_H +#define INCLUDED_DP_EXTENSIONMANAGER_H + +#include "dp_manager.hrc" +#include "dp_misc.h" +#include "dp_interact.h" +#include "dp_activepackages.hxx" +#include "rtl/ref.hxx" +#include "cppuhelper/compbase1.hxx" +//#include "cppuhelper/implbase2.hxx" +#include "ucbhelper/content.hxx" +#include "com/sun/star/deployment/XPackageRegistry.hpp" +#include "com/sun/star/deployment/XPackageManager.hpp" +//#include +#include "osl/mutex.hxx" +#include + + +namespace css = ::com::sun::star; + +namespace dp_manager { + +typedef ::std::hash_map< + ::rtl::OUString, + ::std::vector >, + ::rtl::OUStringHash > id2extensions; + +class ExtensionManager : + public ::cppu::WeakImplHelper1< css::deployment::XExtensionManager > + +{ +private: + ::osl::Mutex m_mutex; + + public: + ExtensionManager( css::uno::Reference< css::uno::XComponentContext >const& xContext); + virtual ~ExtensionManager(); + + static css::uno::Sequence< ::rtl::OUString > getServiceNames(); + static ::rtl::OUString getImplName(); + +// // XInteractionHandler +// virtual void SAL_CALL handle( const uno::Reference< task::XInteractionRequest >& Request ) +// throw( uno::RuntimeException ); +// // XCommandEnvironment +// virtual uno::Reference< task::XInteractionHandler > SAL_CALL getInteractionHandler() +// throw ( uno::RuntimeException ) { return static_cast(this); }; + +// virtual uno::Reference< css_ucb::XProgressHandler > SAL_CALL getProgressHandler() +// throw ( uno::RuntimeException ) { return uno::Reference< css_ucb::XProgressHandler >(); }; +public: + // XComponent + //virtual void SAL_CALL dispose() throw (css::uno::RuntimeException); + //virtual void SAL_CALL addEventListener( + // css::uno::Reference const & xListener ) + // throw (css::uno::RuntimeException); + //virtual void SAL_CALL removeEventListener( + // css::uno::Reference const & xListener ) + // throw (css::uno::RuntimeException); + // + //// XModifyBroadcaster + //virtual void SAL_CALL addModifyListener( + // css::uno::Reference const & xListener ) + // throw (css::uno::RuntimeException); + //virtual void SAL_CALL removeModifyListener( + // css::uno::Reference const & xListener ) + // throw (css::uno::RuntimeException); + + // XPackageManager +// virtual ::rtl::OUString SAL_CALL getContext() +// throw (css::uno::RuntimeException); + virtual css::uno::Sequence< + css::uno::Reference > SAL_CALL + getSupportedPackageTypes(::rtl::OUString const & repository) + throw (css::uno::RuntimeException); + + virtual css::uno::Reference SAL_CALL + createAbortChannel() throw (css::uno::RuntimeException); + + virtual css::uno::Reference SAL_CALL addExtension( + ::rtl::OUString const & url, ::rtl::OUString const & repository, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + virtual void SAL_CALL removeExtension( + ::rtl::OUString const & identifier, + ::rtl::OUString const & filename, + ::rtl::OUString const & repository, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + virtual void SAL_CALL enableExtension( + css::uno::Reference const & extension, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + virtual void SAL_CALL disableExtension( + css::uno::Reference const & extension, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + virtual css::uno::Sequence< css::uno::Reference > + SAL_CALL getDeployedExtensions( + ::rtl::OUString const & repository, + css::uno::Reference const &, + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + virtual css::uno::Reference< css::deployment::XPackage> + SAL_CALL getDeployedExtension( + ::rtl::OUString const & repository, + ::rtl::OUString const & identifier, + ::rtl::OUString const & filename, + css::uno::Reference< css::ucb::XCommandEnvironment> const & xCmdEnv ) + throw ( + css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + virtual css::uno::Sequence< css::uno::Sequence > > + SAL_CALL getAllExtensions( + css::uno::Reference const &, + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + + virtual void SAL_CALL reinstallDeployedExtensions( + ::rtl::OUString const & repository, + css::uno::Reference< css::task::XAbortChannel> const & xAbortChannel, + css::uno::Reference< css::ucb::XCommandEnvironment> const & xCmdEnv ) + throw ( + css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + virtual void SAL_CALL synchronize( + ::rtl::OUString const & repository, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + +private: + + struct ExtensionInfos + { + ::rtl::OUString identifier; + ::rtl::OUString fileName; + ::rtl::OUString displayName; + ::rtl::OUString version; + }; + + css::uno::Reference< css::uno::XComponentContext> m_xContext; + + css::uno::Reference m_userRepository; + css::uno::Reference m_sharedRepository; + css::uno::Reference m_bundledRepository; + css::uno::Reference m_tmpRepository; + + /* contains the names of all repositories (except tmp) in order of there + priority. That is, the first element is "user" follod by "shared" and + then "bundled" + */ + ::std::list< ::rtl::OUString > m_repositoryNames; + + css::uno::Reference getExtensionAndStatus( + ::rtl::OUString const & identifier, + ::rtl::OUString const & fileName, + ::rtl::OUString const & repository, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv, + bool & out_bWasRegistered); + + bool isUserExtensionDisabled( + ::rtl::OUString const & identifier, + ::rtl::OUString const & fileName, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv); + + void activateExtension( + ::rtl::OUString const & identifier, + ::rtl::OUString const & fileName, + bool bUserDisabled, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv); + + + ::std::list > + getExtensionsWithSameId(::rtl::OUString const & identifier, + ::rtl::OUString const & fileName); + + css::uno::Reference backupExtension( + ::rtl::OUString const & identifier, ::rtl::OUString const & fileName, + css::uno::Reference const & xPackageManager, + css::uno::Reference const & xCmdEnv); + + void checkInstall( + ::rtl::OUString const & displayName, + css::uno::Reference const & cmdEnv); + + void checkUpdate( + ::rtl::OUString const & newVersion, + ::rtl::OUString const & newDisplayName, + css::uno::Reference const & oldExtension, + css::uno::Reference const & xCmdEnv); + + css::uno::Reference getTempExtension( + ::rtl::OUString const & url, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv); + + + void addExtensionsToMap( + id2extensions & mapExt, + css::uno::Sequence > const & seqExt, + ::rtl::OUString const & repository); +}; + +} + + + + +#endif + diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 3f13cb021aae..59e9f2049722 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -60,7 +60,12 @@ #include "com/sun/star/task/XInteractionApprove.hpp" #include "com/sun/star/ucb/UnsupportedCommandException.hpp" #include "boost/bind.hpp" +#include "tools/urlobj.hxx" + +#include "osl/file.hxx" #include +#include +#include "dp_descriptioninfoset.hxx" using namespace ::dp_misc; @@ -91,6 +96,58 @@ struct MatchTempDir } }; +struct MatchExtension +{ + const ActivePackages::Data m_data; + MatchExtension(ActivePackages::Data const & data ) : m_data(data) {} + bool operator () ( OUString const & temporaryName ) const; +}; + +bool MatchExtension::operator () (OUString const & temporaryName) const +{ + //case 1: The temporary file and thus the extension folder are already + //removed. + return m_data.temporaryName.equals(temporaryName); +} + +namespace { +OUString getExtensionFolder(OUString const & parentFolder, + Reference const & xCmdEnv) +{ + ::ucbhelper::Content tempFolder( + parentFolder, xCmdEnv ); + Reference xResultSet( + tempFolder.createCursor( + Sequence( &StrTitle::get(), 1 ), + ::ucbhelper::INCLUDE_FOLDERS_ONLY ) ); + + OUString title; + while (xResultSet->next()) + { + title = Reference( + xResultSet, UNO_QUERY_THROW )->getString(1 /* Title */ ) ; + break; + } + return title; +} +/* adds an unencoded segment to the URL. + + Throws an com.sun.star.uno.Exception if this failed. +*/ +OUString appendURLSegement(OUString const & baseURL, OUString const & segment) +{ + OUString url; + INetURLObject inet(baseURL); + if (inet.insertName( + segment, false, INetURLObject::LAST_SEGMENT, true, + INetURLObject::ENCODE_ALL)) + url = inet.GetMainURL(INetURLObject::NO_DECODE); + else + throw Exception( + OUSTR("ExtensionManager: failed to add segment to URL"), 0); + return url; +} +} //______________________________________________________________________________ void PackageManagerImpl::initActivationLayer( Reference const & xCmdEnv ) @@ -151,12 +208,23 @@ void PackageManagerImpl::initActivationLayer( // user|share: OSL_ASSERT( m_activePackages.getLength() > 0 ); m_activePackages_expanded = expandUnoRcUrl( m_activePackages ); - create_folder( 0, m_activePackages_expanded, xCmdEnv, !m_readOnly ); + m_registrationData_expanded = expandUnoRcUrl(m_registrationData); + create_folder( 0, m_activePackages_expanded, xCmdEnv, true); + + OUString dbName; + if (m_context.equals(OUSTR("user"))) + dbName = m_activePackages_expanded + OUSTR(".db"); + else + { + //Create the extension data base in the user installation + create_folder( 0, m_registrationData_expanded, xCmdEnv, true); + dbName = m_registrationData_expanded + OUSTR("/extensions.db"); + } + //The data base can always be written because it it always in the user installation m_activePackagesDB.reset( - new ActivePackages( - m_activePackages_expanded + OUSTR(".db"), m_readOnly ) ); + new ActivePackages( dbName, false ) ); - if (! m_readOnly) + if (! m_readOnly && ! m_context.equals(OUSTR("bundled"))) { // clean up activation layer, scan for zombie temp dirs: ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() ); @@ -169,11 +237,17 @@ void PackageManagerImpl::initActivationLayer( ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) ); // get all temp directories: ::std::vector tempEntries; - while (xResultSet->next()) { + while (xResultSet->next()) + { OUString title( Reference( xResultSet, UNO_QUERY_THROW )->getString( 1 /* Title */ ) ); + const char extensionRemoved[] = ".tmpremoved"; + if (title.endsWithAsciiL( + extensionRemoved, sizeof(extensionRemoved) - 1)) + continue; + tempEntries.push_back( ::rtl::Uri::encode( title, rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, @@ -195,6 +269,9 @@ void PackageManagerImpl::initActivationLayer( false /* no throw: ignore errors */ ); erase_path( url, Reference(), false /* no throw: ignore errors */ ); + //delete the xxx.tmpremoved file + erase_path(url + OUSTR("removed"), + Reference(), false); } } } @@ -206,9 +283,9 @@ void PackageManagerImpl::initRegistryBackends() { if (m_registryCache.getLength() > 0) create_folder( 0, m_registryCache, - Reference(), !m_readOnly ); + Reference(), false); m_xRegistry.set( ::dp_registry::create( - m_context, m_registryCache, m_readOnly, + m_context, m_registryCache, false, m_xComponentContext ) ); } @@ -223,12 +300,14 @@ Reference PackageManagerImpl::create( OUString packages, logFile, stampURL; if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("user") )) { - that->m_activePackages = OUSTR("vnd.sun.star.expand:$UNO_" - "USER_PACKAGES_CACHE/uno_packages"); - that->m_registryCache = OUSTR("vnd.sun.star.expand:$UNO_" - "USER_PACKAGES_CACHE/registry"); - logFile = OUSTR("vnd.sun.star.expand:$UNO_" - "USER_PACKAGES_CACHE/log.txt"); + that->m_activePackages = OUSTR( + "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/uno_packages"); + that->m_registrationData = OUSTR( + "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE"); + that->m_registryCache = OUSTR( + "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/registry"); + logFile = OUSTR( + "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/log.txt"); //We use the extension .sys for the file because on Windows Vista a sys //(as well as exe and dll) file //will not be written in the VirtualStore. For example if the process has no @@ -240,25 +319,42 @@ Reference PackageManagerImpl::create( //using virtualization it appears that he/she can. Then a shared extension can //be installed but is only visible for the user (because the extension is in //the virtual store). - stampURL = OUSTR("vnd.sun.star.expand:$UNO_" - "USER_PACKAGES_CACHE/stamp.sys"); + stampURL = OUSTR( + "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/stamp.sys"); } else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("shared") )) { - that->m_activePackages = OUSTR("vnd.sun.star.expand:$UNO_" - "SHARED_PACKAGES_CACHE/uno_packages"); - that->m_registryCache = OUSTR("vnd.sun.star.expand:$UNO_" - "SHARED_PACKAGES_CACHE/registry"); -// The current logging implementation does not work for shared, because it requires -// write access to the logfile. When two users run OOo at the same time on the same machine -// then the -// second will fail because it does not get write access. One cannot write into the -// user's home, because then people may complain that when installing shared extension -// stuff is written in their home. -// logFile = OUSTR("vnd.sun.star.expand:$UNO_" -// "SHARED_PACKAGES_CACHE/log.txt"); - //See description for stampURL for user packages. - stampURL = OUSTR("vnd.sun.star.expand:$UNO_" - "SHARED_PACKAGES_CACHE/stamp.sys"); + that->m_activePackages = OUSTR( + "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE/uno_packages"); + that->m_registrationData = OUSTR( + "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER"); + that->m_registryCache = OUSTR( + "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER/registry"); + logFile = OUSTR( + "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER/log.txt"); + stampURL = OUSTR( + "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE/stamp.sys"); + } + else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bundled") )) { + that->m_activePackages = OUSTR( + "vnd.sun.star.expand:$BUNDLED_EXTENSIONS"); + that->m_registrationData = OUSTR( + "vnd.sun.star.expand:$BUNDLED_EXTENSIONS_USER"); + that->m_registryCache = OUSTR( + "vnd.sun.star.expand:$BUNDLED_EXTENSIONS_USER/registry"); + logFile = OUSTR( + "vnd.sun.star.expand:$BUNDLED_EXTENSIONS_USER/log.txt"); + //No stamp file. We assume that bundled is always readonly. It must not be + //modified from ExtensionManager but only by the installer + } + else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("tmp") )) { + that->m_activePackages = OUSTR( + "vnd.sun.star.expand:$TMP_EXTENSIONS/extensions"); + that->m_registrationData = OUSTR( + "vnd.sun.star.expand:$TMP_EXTENSIONS"); + that->m_registryCache = OUSTR( + "vnd.sun.star.expand:$TMP_EXTENSIONS/registry"); + stampURL = OUSTR( + "vnd.sun.star.expand:$TMP_EXTENSIONS/stamp.sys"); } else if (! context.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.tdoc:/") )) { @@ -270,29 +366,15 @@ Reference PackageManagerImpl::create( Reference xCmdEnv; try { - bool renewal = false; - + //There is no stampURL for the bundled folder if (stampURL.getLength() > 0) { - // currently no automatic renewal possible, because quickstarter - // already hinders from deleting registry directory... - #define CURRENT_STAMP "1" -// renewal = true; -// { -// ::ucbhelper::Content ucbStamp; -// if (create_ucb_content( -// &ucbStamp, stampURL, xCmdEnv, false /* no throw */ )) -// { -// OUString line; -// renewal = !readLine( &line, OUSTR(CURRENT_STAMP), ucbStamp, -// RTL_TEXTENCODING_ASCII_US ); -// } -// } - try { + //The osl file API does not allow to find out if one can write + //into a folder. Therefore we try to write a file. Then we delete + //it, so that it does not hinder uninstallation of OOo // probe writing: - erase_path( stampURL, xCmdEnv ); ::ucbhelper::Content ucbStamp( stampURL, xCmdEnv ); ::rtl::OString stamp( RTL_CONSTASCII_STRINGPARAM(CURRENT_STAMP) ); @@ -302,8 +384,15 @@ Reference PackageManagerImpl::create( reinterpret_cast(stamp.getStr()), stamp.getLength() ) ) ); ucbStamp.writeStream( xData, true /* replace existing */ ); + that->m_readOnly = false; + erase_path( stampURL, xCmdEnv ); } catch (RuntimeException &) { + try { + erase_path( stampURL, xCmdEnv ); + } catch (...) + { + } throw; } catch (Exception &) { @@ -324,12 +413,6 @@ Reference PackageManagerImpl::create( xCmdEnv.set( new CmdEnvWrapperImpl( xCmdEnv, that->m_xLogFile ) ); } - OSL_ENSURE( !that->m_readOnly || !renewal, - "### ought to reinstall all packages, but cannot write!" ); - if (!that->m_readOnly && renewal) // try to reinstall - that->reinstallDeployedPackages( - Reference(), xCmdEnv ); - that->initRegistryBackends(); that->initActivationLayer( xCmdEnv ); @@ -484,7 +567,7 @@ OUString PackageManagerImpl::detectMediaType( try { Reference xPackage( m_xRegistry->bindPackage( - url, OUString(), ucbContent.getCommandEnvironment() ) ); + url, OUString(), false, ucbContent.getCommandEnvironment() ) ); const Reference xPackageType( xPackage->getPackageType() ); OSL_ASSERT( xPackageType.is() ); @@ -564,10 +647,18 @@ OUString PackageManagerImpl::insertToActivationLayer( title, NameClash::OVERWRITE )) throw RuntimeException( OUSTR("UCB transferContent() failed!"), 0 ); + // write to DB: + //bundled extensions should only be added by the synchronizeAddedExtensions + //functions. Moreover, there is no "temporary folder" for bundled extensions. + OSL_ASSERT(!m_context.equals(OUSTR("bundled"))); + DescriptionInfoset info = + dp_misc::getDescriptionInfoset( + appendURLSegement(destFolderContent.getURL(), title)); dbData->temporaryName = tempEntry; dbData->fileName = title; dbData->mediaType = mediaType; + dbData->version = info.getVersion(); return destFolder; } @@ -582,79 +673,35 @@ void PackageManagerImpl::insertToActivationLayerDB( /* The function returns true if there is an extension with the same id already installed which needs to be uninstalled, before the new extension can be installed. */ -bool PackageManagerImpl::checkUpdate( - Reference const & package, - Reference const & origCmdEnv, - Reference const & wrappedCmdEnv ) +bool PackageManagerImpl::isInstalled( + Reference const & package) { OUString id(dp_misc::getIdentifier(package)); OUString fn(package->getName()); - bool removeExisting = false; + bool bInstalled = false; if (m_activePackagesDB->has( id, fn )) { - // package already deployed, interact --force: - Any request( - (deployment::VersionException( - getResourceString( RID_STR_PACKAGE_ALREADY_ADDED ) + id, - static_cast(this), package, - getDeployedPackage_( id, fn, origCmdEnv ) ) ) ); - bool replace = false, abort = false; - if (! interactContinuation( - request, task::XInteractionApprove::static_type(), - wrappedCmdEnv, &replace, &abort )) { - OSL_ASSERT( !replace && !abort ); - throw deployment::DeploymentException( - getResourceString(RID_STR_ERROR_WHILE_ADDING) + id, - static_cast(this), request ); - } - if (abort || !replace) - throw CommandFailedException( - getResourceString(RID_STR_PACKAGE_ALREADY_ADDED) + id, - static_cast(this), request ); - - // remove clashing package before registering new version: - removeExisting = true; + bInstalled = true; } - return removeExisting; + return bInstalled; } + +// XPackageManager //______________________________________________________________________________ -// Notify the user when a new extension is to be installed. This is only the case -//when unopkg gui extension1 is used (used by system integration (double click on .oxt -// file etc.)). In case there is already this extension then the function returns -//true. -//ToDo: Function always returns true or throws an exception -bool PackageManagerImpl::checkInstall( - Reference const & package, - Reference const & cmdEnv) +Reference PackageManagerImpl::importExtension( + Reference const & extension, + Reference const & xAbortChannel, + Reference const & xCmdEnv_ ) + throw (deployment::DeploymentException, CommandFailedException, + CommandAbortedException, lang::IllegalArgumentException, + RuntimeException) { - OUString id(dp_misc::getIdentifier(package)); - if ( ! m_activePackagesDB->has( id, package->getName() )) - { - Any request( - deployment::InstallException( - OUSTR("Extension ") + id + OUSTR(" is about to be installed."), - static_cast(this), package)); - bool approve = false, abort = false; - if (! interactContinuation( - request, task::XInteractionApprove::static_type(), - cmdEnv, &approve, &abort )) - { - OSL_ASSERT( !approve && !abort ); - throw deployment::DeploymentException( - getResourceString(RID_STR_ERROR_WHILE_ADDING) + id, - static_cast(this), request ); - } - if (abort || !approve) - throw CommandFailedException( - getResourceString(RID_STR_ERROR_WHILE_ADDING) + id, - static_cast(this), request ); - - } - return true; + return addPackage(extension->getURL(), OUString(), xAbortChannel, xCmdEnv_); } -// XPackageManager -//______________________________________________________________________________ +/* The function adds an extension but does not register it!!! + It may not do any user interaction. This is done in XExtensionManager::addExtension +*/ Reference PackageManagerImpl::addPackage( OUString const & url, OUString const & mediaType_, Reference const & xAbortChannel, @@ -733,80 +780,39 @@ Reference PackageManagerImpl::addPackage( // bind activation package: - //Because every extension will be unpacked in a folder, which was created with a unique name - //we will always have two different XPackage objects, even if the second extension is the same. + //Because every shared/user extension will be unpacked in a folder, + //which was created with a unique name we will always have two different + //XPackage objects, even if the second extension is the same. //Therefore bindPackage does not need a guard here. xPackage = m_xRegistry->bindPackage( - makeURL( destFolder, title_enc ), mediaType, xCmdEnv ); + makeURL( destFolder, title_enc ), mediaType, false, xCmdEnv ); OSL_ASSERT( xPackage.is() ); if (xPackage.is()) { bool install = false; - OUString id; - try { - id = dp_misc::getIdentifier( xPackage ); - //checkInstall throws an exception if the user denies the installation - checkInstall(xPackage, xCmdEnv); - //checkUpdate throws an exception if the user cancels the interaction. - //For example, he may be asked if he wants to replace the older version - //with the new version. - //checkUpdates must be called before checkPrerequisites - bool bAlreadyInstalled = checkUpdate( - xPackage, xCmdEnv_, xCmdEnv ); - - if (xPackage->checkPrerequisites(xAbortChannel, xCmdEnv, bAlreadyInstalled, m_context)) + OUString const id = dp_misc::getIdentifier( xPackage ); + //This guard is used to prevent that an extension is + //installed twice. Do not use it in other functions. + //Imagine addPackage is called two times by different + //threads for the same extension quickly after each other. + //The second call would calculate "bAlreadyInstalled = + //false" if the first thread has not yet reached + //insertToActivationLayerDB. + ::osl::MutexGuard g(m_addMutex); + if (isInstalled(xPackage)) { - //This guard is used to prevent that an extension is installed twice. Do not use it in other - //functions. - //Imagine addPackage is called two times by different threads for the same extension quickly - //after each other. - //The second call would calculate "bAlreadyInstalled = false" if the first thread has not yet reached - //insertToActivationLayerDB. - ::osl::MutexGuard g(m_addMutex); - - //Holds the database data of the old extension, in case we need to roll back. - ActivePackages::Data oldDbData; - if (bAlreadyInstalled) - { - // Remove extension which is already installed. It is not removed from disk, only - // the different contents are being unregisterd. We remember the databas information - // in case we need to roll back this operation. - // When the user canceled the operation (CommandAbortedException) than the package is still - // fully functional. - // Do not guard the complete function with the getMutex - removePackage_(id, xPackage->getName(), xAbortChannel, - xCmdEnv, & oldDbData); - } - install = true; - const ::osl::MutexGuard guard( getMutex() ); - try - { - //throws CommandAbortedException if the user cancelled the installation. - xPackage->registerPackage(xAbortChannel, xCmdEnv); - } - catch(CommandAbortedException & ) - { //ToDo: Interaction so that the gui can display an appropriate string. - //See also removePackage_ - //User aborted installation, restore the previous situation. - //Use a private AbortChannel so the user cannot interrupt. - xPackage->revokePackage(new AbortChannel(), xCmdEnv); - if (bAlreadyInstalled) - { - OUString instFolder = makeURL( m_activePackages, oldDbData.temporaryName) - + OUSTR("_"); - Reference xOldPgk = m_xRegistry->bindPackage( - makeURL( instFolder, oldDbData.fileName ), oldDbData.mediaType, xCmdEnv ); - xOldPgk->registerPackage(new AbortChannel(), xCmdEnv); - insertToActivationLayerDB(dp_misc::getIdentifier( xOldPgk ), oldDbData); - } - throw; - } - //access to the database must be guarded. See removePackage_ - insertToActivationLayerDB(id, dbData); + //Do not guard the complete function with the getMutex + removePackage(id, xPackage->getName(), xAbortChannel, + xCmdEnv); } + install = true; + const ::osl::MutexGuard guard( getMutex() ); + //access to the database must be guarded. See removePackage_ + insertToActivationLayerDB(id, dbData); + } catch (...) { @@ -817,6 +823,7 @@ Reference PackageManagerImpl::addPackage( { deletePackageFromCache( xPackage, destFolder ); } + //ToDo: We should notify only if the extension is registered fireModified(); } return xPackage; @@ -860,42 +867,10 @@ void PackageManagerImpl::deletePackageFromCache( false /* no throw: ignore errors */ ); } -//______________________________________________________________________________ -void PackageManagerImpl::removePackage_( - OUString const & id, OUString const & fileName, - Reference const & xAbortChannel, - Reference const & xCmdEnv, - ActivePackages::Data * out_dbData) -{ - Reference xPackage; - { - try { - const ::osl::MutexGuard guard(getMutex()); - xPackage = getDeployedPackage_(id, fileName, xCmdEnv ); - m_activePackagesDB->get(out_dbData, id, fileName); - beans::Optional< beans::Ambiguous > option( - xPackage->isRegistered( Reference(), - xCmdEnv ) ); - if (!option.IsPresent || option.Value.IsAmbiguous || option.Value.Value) - xPackage->revokePackage( xAbortChannel, xCmdEnv ); - m_activePackagesDB->erase( id, fileName ); // to be removed upon next start - } - catch (CommandAbortedException &) - { - //ToDo: interaction, so that gui can show an appropriate string - //reregister the package - //Create our own XAbortChannel, so the user cannot interrupt the registration. - xPackage->registerPackage(new AbortChannel(), xCmdEnv); - throw; - } - } - try_dispose( xPackage ); -} - //______________________________________________________________________________ void PackageManagerImpl::removePackage( OUString const & id, ::rtl::OUString const & fileName, - Reference const & xAbortChannel, + Reference const & /*xAbortChannel*/, Reference const & xCmdEnv_ ) throw (deployment::DeploymentException, CommandFailedException, CommandAbortedException, lang::IllegalArgumentException, @@ -920,7 +895,39 @@ void PackageManagerImpl::removePackage( xCmdEnv.set( xCmdEnv_ ); try { - removePackage_( id, fileName, xAbortChannel, xCmdEnv, NULL); + Reference xPackage; + { + const ::osl::MutexGuard guard(getMutex()); + //Check if this extension exist and throw an IllegalArgumentException + //if it does not + xPackage = getDeployedPackage_(id, fileName, xCmdEnv ); + //Because the extension is only removed the next time the extension + //manager runs after restarting OOo, we need to indicate that a + //shared extension was "deleted". When a user starts OOo, then it + //will check if something changed in the shared repository. Based on + //the flag file it will then recognize, that the extension was + //deleted and can then update the extnesion database of the shared + //extensions in the user installation. + if (m_context.equals(OUSTR("shared"))) + { + ActivePackages::Data val; + m_activePackagesDB->get( & val, id, fileName); + OSL_ASSERT(val.temporaryName.getLength()); + OUString url(makeURL(m_activePackages_expanded, + val.temporaryName + OUSTR("removed"))); + ::ucbhelper::Content contentRemoved(url, xCmdEnv ); + ::rtl::OString stamp("1"); + Reference xData( + ::xmlscript::createInputStream( + ::rtl::ByteSequence( + reinterpret_cast(stamp.getStr()), + stamp.getLength() ) ) ); + contentRemoved.writeStream( xData, true /* replace existing */ ); + } + m_activePackagesDB->erase( id, fileName ); // to be removed upon next start + } + try_dispose( xPackage ); + fireModified(); } catch (RuntimeException &) { @@ -955,10 +962,16 @@ OUString PackageManagerImpl::getDeployPath( ActivePackages::Data const & data ) { ::rtl::OUStringBuffer buf; buf.append( data.temporaryName ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("_/") ); - buf.append( ::rtl::Uri::encode( data.fileName, rtl_UriCharClassPchar, + //The bundled extensions are not contained in an additional folder + //with a unique name. data.temporaryName contains already the + //UTF8 encoded folder name. See PackageManagerImpl::synchronize + if (!m_context.equals(OUSTR("bundled"))) + { + buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("_/") ); + buf.append( ::rtl::Uri::encode( data.fileName, rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ) ); + } return makeURL( m_activePackages, buf.makeStringAndClear() ); } @@ -998,7 +1011,7 @@ Reference PackageManagerImpl::getDeployedPackage_( } } return m_xRegistry->bindPackage( - getDeployPath( data ), data.mediaType, xCmdEnv ); + getDeployPath( data ), data.mediaType, false, xCmdEnv ); } //______________________________________________________________________________ @@ -1124,8 +1137,12 @@ PackageManagerImpl::getDeployedPackages( } //______________________________________________________________________________ + + +//ToDo: the function must not call registerPackage, do this in +//XExtensionManager.reinstallDeployedExtensions void PackageManagerImpl::reinstallDeployedPackages( - Reference const & xAbortChannel, + Reference const & /*xAbortChannel*/, Reference const & xCmdEnv_ ) throw (deployment::DeploymentException, CommandFailedException, CommandAbortedException, @@ -1167,12 +1184,7 @@ void PackageManagerImpl::reinstallDeployedPackages( if (xUpdatable.is()) xUpdatable->update(); - // reregister all: - const ::osl::MutexGuard guard( getMutex() ); - const Sequence< Reference > packages( - getDeployedPackages_( xCmdEnv ) ); - for ( sal_Int32 pos = 0; pos < packages.getLength(); ++pos ) - packages[ pos ]->registerPackage( xAbortChannel, xCmdEnv ); + //registering is done by the ExtensionManager service. } catch (RuntimeException &) { throw; @@ -1205,6 +1217,242 @@ void PackageManagerImpl::reinstallDeployedPackages( { return m_readOnly; } +void PackageManagerImpl::synchronizeRemovedExtensions( + Sequence > & out_removedExtensions, + Reference const & /*xAbortChannel*/, + Reference const & xCmdEnv) +{ + + //find all which are in the extension data base but which + //are removed already. + OSL_ASSERT(!m_context.equals(OUSTR("user"))); + ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() ); + + //Iterate over the contents of the extension folder and gather the + //temp file names (shared) or the folder names of the bundled extension. + ::ucbhelper::ResultSetInclude includeType = ::ucbhelper::INCLUDE_DOCUMENTS_ONLY; + if (m_context.equals(OUSTR("bundled"))) + includeType = ::ucbhelper::INCLUDE_FOLDERS_ONLY; + ::ucbhelper::Content tempFolder( + m_activePackages_expanded, xCmdEnv ); + Reference xResultSet( + tempFolder.createCursor( + Sequence( &StrTitle::get(), 1 ), includeType) ); + // get all temp directories: + ::std::vector tempEntries; + while (xResultSet->next()) { + OUString title( + Reference( + xResultSet, UNO_QUERY_THROW )->getString( + 1 /* Title */ ) ); + //also add the xxx.tmpremoved files for remove shared extensions + //this does not matter + tempEntries.push_back( ::rtl::Uri::encode( + title, rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ) ); + } + + typedef ActivePackages::Entries::const_iterator ITActive; + bool bShared = m_context.equals(OUSTR("shared")); + ::std::vector > removedExtensions; + for (ITActive i = id2temp.begin(); i != id2temp.end(); i++) + { + //Get the URL to the extensions folder, first make the url for the + //shared repository including the temporary name +// OUString url(m_activePackages_expanded + OUSTR("/") +// + i->second.temporaryName); +// if (bShared) +// url = appendURLSegement(m_activePackages_expanded + OUSTR("/") +// + i->second.temporaryName + OUSTR("_"), +// i->second.fileName); + OUString url = makeURL(m_activePackages, i->second.temporaryName); + if (bShared) + url = makeURLAppendSysPathSegment( url + OUSTR("_"), i->second.fileName); + + const MatchExtension match(i->second); + bool bRemoved = false; + if (::std::find_if(tempEntries.begin(), tempEntries.end(), match) == + tempEntries.end()) + { + //The the URL from the data base entry does not exist anymore. That is the + //folder was removed. + bRemoved = true; + } + else + { + //The folder is in the extension database, but it can still be deleted. + //look for the xxx.tmpremoved file + if (bShared) + { + ::ucbhelper::Content contentRemoved; + if (create_ucb_content( + &contentRemoved, + m_activePackages_expanded + OUSTR("/") + + i->second.temporaryName + OUSTR("removed"), + Reference(), false)) + { + bRemoved = true; + } + } + if (!bRemoved) + { + //There may be another extensions at the same place + dp_misc::DescriptionInfoset infoset = + dp_misc::getDescriptionInfoset(url); + OSL_ENSURE(infoset.hasDescription(), + "Extension Manager: bundled and shared extensions " + "must have an identifer and a version"); + if ( ! i->first.equals(*(infoset.getIdentifier())) + || ! i->second.version.equals(infoset.getVersion())) + { + bRemoved = true; + } + } + } + if (bRemoved) + { + Reference xPackage = m_xRegistry->bindPackage( + url, i->second.mediaType, true, xCmdEnv ); + OSL_ASSERT(xPackage.is()); //Even if the files are removed, we must get the object. + removedExtensions.push_back(xPackage); + } + } + out_removedExtensions = ::comphelper::containerToSequence(removedExtensions); +} + +void PackageManagerImpl::synchronizeAddedExtensions( + Sequence > & out_addedExtensions, + Reference const & xAbortChannel, + Reference const & xCmdEnv) +{ + // clean up activation layer, scan for zombie temp dirs: + ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() ); + + ::ucbhelper::Content tempFolder( + m_activePackages_expanded, xCmdEnv ); + Reference xResultSet( + tempFolder.createCursor( + Sequence( &StrTitle::get(), 1 ), + ::ucbhelper::INCLUDE_FOLDERS_ONLY ) ); + + + ::std::vector > addedExtensions; + while (xResultSet->next()) + { + OUString title( + Reference( + xResultSet, UNO_QUERY_THROW )->getString( + 1 /* Title */ ) ); + //The temporary folders of user and shared have an '_' at then end. + //But the name in ActivePackages.temporaryName is saved without. + OUString title2 = title; + bool bNotBundled = !m_context.equals(OUSTR("bundled")); + if (bNotBundled) + { + OSL_ASSERT(title2[title2.getLength() -1] == '_'); + title2 = title2.copy(0, title2.getLength() -1); + } + OUString titleEncoded = ::rtl::Uri::encode( + title2, rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8); + + const MatchTempDir match(titleEncoded); + if (::std::find_if( id2temp.begin(), id2temp.end(), match ) == + id2temp.end()) + { + + // The folder was not found in the data base, so it must be + // an added extension + OUString url(m_activePackages_expanded + OUSTR("/") + titleEncoded); + OUString sExtFolder; + if (bNotBundled) //that is, shared + { + //Check if the extension was not "deleted" already which is indicated + //by a xxx.tmpremoved file + ::ucbhelper::Content contentRemoved; + if (create_ucb_content(&contentRemoved, url + OUSTR("removed"), + Reference(), false)) + continue; + sExtFolder = getExtensionFolder( + m_activePackages_expanded + + OUString(OUSTR("/")) + titleEncoded + OUSTR("_"), xCmdEnv); + url = appendURLSegement(m_activePackages_expanded, title); + url = appendURLSegement(url, sExtFolder); + } + Reference xPackage = m_xRegistry->bindPackage( + url, OUString(), false, xCmdEnv ); + if (xPackage.is()) + { + try + { + //ToDo: We need to prevent that removed shared extensions are + //added again. This can happen if there is still the folder of the + //extension. However, there is the "removed" flag file which indicates + //that the extension was removed. + //Prepare the database entry + ActivePackages::Data dbData; + //There is no temporary folder for bundled extensions. It is therefore + //an empty string. + dbData.temporaryName = titleEncoded; + if (bNotBundled) + dbData.fileName = sExtFolder; + else + dbData.fileName = title; + dbData.mediaType = xPackage->getPackageType()->getMediaType(); + dbData.version = xPackage->getVersion(); + OSL_ENSURE(dbData.version.getLength() > 0, + "Extension Manager: bundled and shared extensions must have " + "an identifier and a version"); + + OUString id = dp_misc::getIdentifier( xPackage ); + sal_Bool bAlreadyInstalled = sal_False; + if (xPackage->checkPrerequisites( + xAbortChannel, xCmdEnv, bAlreadyInstalled, m_context)) + { + const ::osl::MutexGuard guard( getMutex() ); + //access to the database must be guarded. See removePackage_ + insertToActivationLayerDB(id, dbData); + } + else + { + //ToDo: Remember that this failed. For example, the user + //could have declined the license. Then the next time the + //extension folder is investigated we do not want to + //try to install the extension again. + } + addedExtensions.push_back(xPackage); + } + catch (...) + { + } + } + } + } + out_addedExtensions = ::comphelper::containerToSequence(addedExtensions); +} + +void PackageManagerImpl::synchronize( + Sequence > & out_addedExtensions, + Sequence > & out_removedExtensions, + Reference const & xAbortChannel, + Reference const & xCmdEnv) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::uno::RuntimeException) +{ + + check(); + if (m_context.equals(OUSTR("user"))) + return; + synchronizeRemovedExtensions( + out_removedExtensions, xAbortChannel, xCmdEnv); + synchronizeAddedExtensions( + out_addedExtensions, xAbortChannel, xCmdEnv); +} + //############################################################################## diff --git a/desktop/source/deployment/manager/dp_manager.h b/desktop/source/deployment/manager/dp_manager.h index ffa7252d7883..1249fe7e29d4 100644 --- a/desktop/source/deployment/manager/dp_manager.h +++ b/desktop/source/deployment/manager/dp_manager.h @@ -53,6 +53,8 @@ class PackageManagerImpl : private ::dp_misc::MutexHolder, public t_pm_helper { css::uno::Reference m_xComponentContext; ::rtl::OUString m_context; + ::rtl::OUString m_registrationData; + ::rtl::OUString m_registrationData_expanded; ::rtl::OUString m_registryCache; bool m_readOnly; @@ -83,16 +85,20 @@ class PackageManagerImpl : private ::dp_misc::MutexHolder, public t_pm_helper css::uno::Reference const & xPackage, ::rtl::OUString const & destFolder ); - bool checkUpdate( - css::uno::Reference const & package, - css::uno::Reference const & origCmdEnv, - css::uno::Reference const & - wrappedCmdEnv ); + bool isInstalled( + css::uno::Reference const & package); - bool checkInstall( - css::uno::Reference const & package, - css::uno::Reference const & cmdEnv); + void synchronizeRemovedExtensions( + css::uno::Sequence > & + out_removedExtensions, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv); + void synchronizeAddedExtensions( + css::uno::Sequence > & + out_AddedExtensions, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv); class CmdEnvWrapperImpl : public ::cppu::WeakImplHelper2< css::ucb::XCommandEnvironment, @@ -135,7 +141,7 @@ protected: : t_pm_helper( getMutex() ), m_xComponentContext( xComponentContext ), m_context( context ), - m_readOnly( false ) + m_readOnly( true ) {} public: @@ -180,17 +186,15 @@ public: css::lang::IllegalArgumentException, css::uno::RuntimeException); - /* Unregisters the package but does not remove it from disk. - When the operation is canceled by the user, a CommandAbortedException - is thrown. Then the package is still fully functional. - @param out_oldData - can be NULL - */ - void removePackage_( - ::rtl::OUString const & id, ::rtl::OUString const & fileName, + virtual css::uno::Reference SAL_CALL importExtension( + css::uno::Reference const & extension, css::uno::Reference const & xAbortChannel, - css::uno::Reference const & xCmdEnv, - ActivePackages::Data * out_oldData); + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); virtual void SAL_CALL removePackage( ::rtl::OUString const & id, ::rtl::OUString const & fileName, @@ -242,6 +246,17 @@ public: virtual ::sal_Bool SAL_CALL isReadOnly( ) throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL synchronize( + css::uno::Sequence > & out_xAddedExtensions, + css::uno::Sequence > & out_xRemovedExtensions, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::uno::RuntimeException); + }; //______________________________________________________________________________ diff --git a/desktop/source/deployment/manager/dp_managerfac.cxx b/desktop/source/deployment/manager/dp_managerfac.cxx index d4c9df1d57af..f6fde6b07d60 100644 --- a/desktop/source/deployment/manager/dp_managerfac.cxx +++ b/desktop/source/deployment/manager/dp_managerfac.cxx @@ -53,6 +53,7 @@ class PackageManagerFactoryImpl : private MutexHolder, public t_pmfac_helper Reference m_xUserMgr; Reference m_xSharedMgr; + Reference m_xBundledMgr; typedef ::std::hash_map< OUString, WeakReference, ::rtl::OUStringHash > t_string2weakref; @@ -141,6 +142,7 @@ void PackageManagerFactoryImpl::disposing() // the below are already disposed: m_xUserMgr.clear(); m_xSharedMgr.clear(); + m_xBundledMgr.clear(); } // XPackageManagerFactory @@ -172,6 +174,8 @@ PackageManagerFactoryImpl::getPackageManager( OUString const & context ) m_xUserMgr = xRet; else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("shared") )) m_xSharedMgr = xRet; + else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bundled") )) + m_xBundledMgr = xRet; } else { diff --git a/desktop/source/deployment/manager/dp_tmprepocmdenv.cxx b/desktop/source/deployment/manager/dp_tmprepocmdenv.cxx new file mode 100644 index 000000000000..3a4a6f1d2b72 --- /dev/null +++ b/desktop/source/deployment/manager/dp_tmprepocmdenv.cxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "com/sun/star/deployment/VersionException.hpp" +#include "com/sun/star/deployment/LicenseIndividualAgreementException.hpp" +#include "com/sun/star/deployment/LicenseException.hpp" +#include "com/sun/star/deployment/InstallException.hpp" +#include "com/sun/star/task/XInteractionApprove.hpp" +#include "com/sun/star/task/XInteractionAbort.hpp" +#include "com/sun/star/ucb/XCommandEnvironment.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "dp_tmprepocmdenv.hxx" + +namespace deployment = com::sun::star::deployment; +namespace lang = com::sun::star::lang; +namespace task = com::sun::star::task; +namespace ucb = com::sun::star::ucb; +namespace uno = com::sun::star::uno; +namespace css = com::sun::star; + +#define OUSTR(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) + +using ::com::sun::star::uno::Reference; +using ::rtl::OUString; + +namespace dp_manager { + +TmpRepositoryCommandEnv::TmpRepositoryCommandEnv() +{ +} + +TmpRepositoryCommandEnv::TmpRepositoryCommandEnv( + Reference< css::task::XInteractionHandler> const & handler) + : m_forwardHandler(handler) +{ +} + +TmpRepositoryCommandEnv::~TmpRepositoryCommandEnv() +{ +} +// XCommandEnvironment +//______________________________________________________________________________ +Reference TmpRepositoryCommandEnv::getInteractionHandler() +throw (uno::RuntimeException) +{ + return this; +} + +//______________________________________________________________________________ +Reference TmpRepositoryCommandEnv::getProgressHandler() +throw (uno::RuntimeException) +{ + return this; +} + +// XInteractionHandler +void TmpRepositoryCommandEnv::handle( + Reference< task::XInteractionRequest> const & xRequest ) + throw (uno::RuntimeException) +{ + uno::Any request( xRequest->getRequest() ); + OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); + + deployment::VersionException verExc; + deployment::LicenseException licExc; + deployment::InstallException instExc; + deployment::LicenseIndividualAgreementException licAgreementExc; + + + bool approve = false; + bool abort = false; + + if ((request >>= verExc) + || (request >>= licExc) + || (request >>= instExc) + || (request >>= licAgreementExc)) + { + approve = true; + } + + if (approve == false && abort == false) + { + if (m_forwardHandler.is()) + m_forwardHandler->handle(xRequest); + else + approve = true; + } + else + { + // select: + uno::Sequence< Reference< task::XInteractionContinuation > > conts( + xRequest->getContinuations() ); + Reference< task::XInteractionContinuation > const * pConts = + conts.getConstArray(); + sal_Int32 len = conts.getLength(); + for ( sal_Int32 pos = 0; pos < len; ++pos ) + { + if (approve) { + Reference< task::XInteractionApprove > xInteractionApprove( + pConts[ pos ], uno::UNO_QUERY ); + if (xInteractionApprove.is()) { + xInteractionApprove->select(); + // don't query again for ongoing continuations: + approve = false; + } + } + else if (abort) { + Reference< task::XInteractionAbort > xInteractionAbort( + pConts[ pos ], uno::UNO_QUERY ); + if (xInteractionAbort.is()) { + xInteractionAbort->select(); + // don't query again for ongoing continuations: + abort = false; + } + } + } + } +} + +// XProgressHandler +void TmpRepositoryCommandEnv::push( uno::Any const & /*Status*/ ) +throw (uno::RuntimeException) +{ +} + + +void TmpRepositoryCommandEnv::update( uno::Any const & /*Status */) +throw (uno::RuntimeException) +{ +} + +void TmpRepositoryCommandEnv::pop() throw (uno::RuntimeException) +{ +} + + +} // namespace dp_manager + + diff --git a/desktop/source/deployment/manager/dp_tmprepocmdenv.hxx b/desktop/source/deployment/manager/dp_tmprepocmdenv.hxx new file mode 100644 index 000000000000..22111bc1e081 --- /dev/null +++ b/desktop/source/deployment/manager/dp_tmprepocmdenv.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_DP_TMPREPOSITORYCOMMANDENVIRONMENT_HXX +#define INCLUDED_DP_TMPREPOSITORYCOMMANDENVIRONMENT_HXX + + +#include "cppuhelper/compbase3.hxx" +//#include "cppuhelper/implbase2.hxx" +#include "ucbhelper/content.hxx" + + + +namespace css = ::com::sun::star; + +namespace dp_manager { + +/** + This command environment is to be used when an extension is temporarily + stored in the "tmp" repository. It prevents all kind of user interaction. + */ +class TmpRepositoryCommandEnv + : public ::cppu::WeakImplHelper3< css::ucb::XCommandEnvironment, + css::task::XInteractionHandler, + css::ucb::XProgressHandler > +{ + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::task::XInteractionHandler> m_forwardHandler; +public: + virtual ~TmpRepositoryCommandEnv(); + TmpRepositoryCommandEnv(); + TmpRepositoryCommandEnv( + css::uno::Reference< css::task::XInteractionHandler> const & handler); + + // XCommandEnvironment + virtual css::uno::Reference SAL_CALL + getInteractionHandler() throw (css::uno::RuntimeException); + virtual css::uno::Reference + SAL_CALL getProgressHandler() throw (css::uno::RuntimeException); + + // XInteractionHandler + virtual void SAL_CALL handle( + css::uno::Reference const & xRequest ) + throw (css::uno::RuntimeException); + + // XProgressHandler + virtual void SAL_CALL push( css::uno::Any const & Status ) + throw (css::uno::RuntimeException); + virtual void SAL_CALL update( css::uno::Any const & Status ) + throw (css::uno::RuntimeException); + virtual void SAL_CALL pop() throw (css::uno::RuntimeException); +}; + +} + + + + +#endif + diff --git a/desktop/source/deployment/manager/makefile.mk b/desktop/source/deployment/manager/makefile.mk index a9ff47881fc3..cb99325bde52 100644 --- a/desktop/source/deployment/manager/makefile.mk +++ b/desktop/source/deployment/manager/makefile.mk @@ -45,7 +45,9 @@ SLOFILES = \ $(SLO)$/dp_activepackages.obj \ $(SLO)$/dp_manager.obj \ $(SLO)$/dp_managerfac.obj \ - $(SLO)$/dp_informationprovider.obj + $(SLO)$/dp_informationprovider.obj \ + $(SLO)$/dp_extensionmanager.obj \ + $(SLO)$/dp_tmprepocmdenv.obj .INCLUDE : ..$/target.pmk .INCLUDE : target.mk diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx index 28f45918e9e2..d97b400f4609 100644 --- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx +++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx @@ -35,6 +35,7 @@ #include "comphelper/sequence.hxx" #include "comphelper/makesequence.hxx" +#include "comphelper/processfactory.hxx" #include "boost/optional.hpp" #include "com/sun/star/beans/Optional.hpp" #include "com/sun/star/lang/XMultiComponentFactory.hpp" @@ -47,17 +48,23 @@ #include "com/sun/star/xml/dom/DOMException.hpp" #include "com/sun/star/xml/dom/XNode.hpp" #include "com/sun/star/xml/dom/XNodeList.hpp" +#include "com/sun/star/xml/dom/XDocumentBuilder.hpp" #include "com/sun/star/xml/xpath/XXPathAPI.hpp" +#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" #include "cppuhelper/implbase1.hxx" +#include "cppuhelper/implbase2.hxx" #include "cppuhelper/weak.hxx" +#include "cppuhelper/exc_hlp.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" - +#include "ucbhelper/content.hxx" namespace { namespace css = ::com::sun::star; +using css::uno::Reference; +using ::rtl::OUString; class EmptyNodeList: public ::cppu::WeakImplHelper1< css::xml::dom::XNodeList > { @@ -110,10 +117,251 @@ css::uno::Reference< css::xml::dom::XNode > EmptyNodeList::item(::sal_Int32) } } +/**The class uses the UCB to access the description.xml file in an + extension. The UCB must have been initialized already. It also + requires that the extension has already be unzipped to a particular + location. + */ +class ExtensionDescription +{ +public: + /**throws an exception if the description.xml is not + available, cannot be read, does not contain the expected data, + or any other error occured. Therefore it shoult only be used with + new extensions. + + Throws com::sun::star::uno::RuntimeException, + com::sun::star::deployment::DeploymentException, + dp_registry::backend::bundle::NoDescriptionException. + */ + ExtensionDescription( + const css::uno::Reference& xContext, + const ::rtl::OUString& installDir, + const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv); + + ~ExtensionDescription(); + + css::uno::Reference getRootElement() const + { + return m_xRoot; + } + + ::rtl::OUString getExtensionRootUrl() const + { + return m_sExtensionRootUrl; + } + + +private: + css::uno::Reference m_xRoot; + ::rtl::OUString m_sExtensionRootUrl; +}; + +class NoDescriptionException +{ +}; + +class FileDoesNotExistFilter + : public ::cppu::WeakImplHelper2< css::ucb::XCommandEnvironment, + css::task::XInteractionHandler > + +{ + //css::uno::Reference m_xHandler; + bool m_bExist; + css::uno::Reference< css::ucb::XCommandEnvironment > m_xCommandEnv; + +public: + virtual ~FileDoesNotExistFilter(); + FileDoesNotExistFilter( + const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv); + + bool exist(); + // XCommandEnvironment + virtual css::uno::Reference SAL_CALL + getInteractionHandler() throw (css::uno::RuntimeException); + virtual css::uno::Reference + SAL_CALL getProgressHandler() throw (css::uno::RuntimeException); + + // XInteractionHandler + virtual void SAL_CALL handle( + css::uno::Reference const & xRequest ) + throw (css::uno::RuntimeException); +}; + +ExtensionDescription::ExtensionDescription( + const Reference& xContext, + const OUString& installDir, + const Reference< css::ucb::XCommandEnvironment >& xCmdEnv) +{ + try { + m_sExtensionRootUrl = installDir; + //may throw ::com::sun::star::ucb::ContentCreationException + //If there is no description.xml then ucb will start an interaction which + //brings up a dialog.We want to prevent this. Therefore we wrap the xCmdEnv + //and filter the respective exception out. + OUString sDescriptionUri(installDir + OUSTR("/description.xml")); + Reference xFilter = + static_cast( + new FileDoesNotExistFilter(xCmdEnv)); + ::ucbhelper::Content descContent(sDescriptionUri, xFilter); + + //throws an com::sun::star::uno::Exception if the file is not available + Reference xIn; + try + { //throws com.sun.star.ucb.InteractiveAugmentedIOException + xIn = descContent.openStream(); + } + catch (css::uno::Exception& ) + { + if ( ! static_cast(xFilter.get())->exist()) + throw NoDescriptionException(); + throw; + } + if (!xIn.is()) + { + throw css::uno::Exception( + OUSTR("Could not get XInputStream for description.xml of extension ") + + sDescriptionUri, 0); + } + + //get root node of description.xml + Reference xDocBuilder( + xContext->getServiceManager()->createInstanceWithContext( + OUSTR("com.sun.star.xml.dom.DocumentBuilder"), + xContext ), css::uno::UNO_QUERY); + if (!xDocBuilder.is()) + throw css::uno::Exception(OUSTR(" Could not create service com.sun.star.xml.dom.DocumentBuilder"), 0); + + if (xDocBuilder->isNamespaceAware() == sal_False) + { + throw css::uno::Exception( + OUSTR("Service com.sun.star.xml.dom.DocumentBuilder is not namespace aware."), 0); + } + + Reference xDoc = xDocBuilder->parse(xIn); + if (!xDoc.is()) + { + throw css::uno::Exception(sDescriptionUri + OUSTR(" contains data which cannot be parsed. "), 0); + } + + //check for proper root element and namespace + Reference xRoot = xDoc->getDocumentElement(); + if (!xRoot.is()) + { + throw css::uno::Exception( + sDescriptionUri + OUSTR(" contains no root element."), 0); + } + + if ( ! xRoot->getTagName().equals(OUSTR("description"))) + { + throw css::uno::Exception( + sDescriptionUri + OUSTR(" does not contain the root element ."), 0); + } + + m_xRoot = Reference( + xRoot, css::uno::UNO_QUERY_THROW); + OUString nsDescription = xRoot->getNamespaceURI(); + + //check if this namespace is supported + if ( ! nsDescription.equals(OUSTR("http://openoffice.org/extensions/description/2006"))) + { + throw css::uno::Exception(sDescriptionUri + OUSTR(" contains a root element with an unsupported namespace. "), 0); + } + } catch (css::uno::RuntimeException &) { + throw; + } catch (css::deployment::DeploymentException &) { + throw; + } catch (css::uno::Exception & e) { + css::uno::Any a(cppu::getCaughtException()); + throw css::deployment::DeploymentException( + e.Message, Reference< css::uno::XInterface >(), a); + } +} + +ExtensionDescription::~ExtensionDescription() +{ +} + +//====================================================================== +FileDoesNotExistFilter::FileDoesNotExistFilter( + const Reference< css::ucb::XCommandEnvironment >& xCmdEnv): + m_bExist(true), m_xCommandEnv(xCmdEnv) +{} + +FileDoesNotExistFilter::~FileDoesNotExistFilter() +{ +}; + +bool FileDoesNotExistFilter::exist() +{ + return m_bExist; +} + // XCommandEnvironment +Reference + FileDoesNotExistFilter::getInteractionHandler() throw (css::uno::RuntimeException) +{ + return static_cast(this); +} + +Reference + FileDoesNotExistFilter::getProgressHandler() throw (css::uno::RuntimeException) +{ + return m_xCommandEnv.is() + ? m_xCommandEnv->getProgressHandler() + : Reference(); +} + +// XInteractionHandler +//If the interaction was caused by a non-existing file which is specified in the ctor +//of FileDoesNotExistFilter, then we do nothing +void FileDoesNotExistFilter::handle( + Reference const & xRequest ) + throw (css::uno::RuntimeException) +{ + css::uno::Any request( xRequest->getRequest() ); + + css::ucb::InteractiveAugmentedIOException ioexc; + if ((request>>= ioexc) && ioexc.Code == css::ucb::IOErrorCode_NOT_EXISTING ) + { + m_bExist = false; + return; + } + Reference xInteraction; + if (m_xCommandEnv.is()) { + xInteraction = m_xCommandEnv->getInteractionHandler(); + } + if (xInteraction.is()) { + xInteraction->handle(xRequest); + } +} + } namespace dp_misc { +DescriptionInfoset getDescriptionInfoset(OUString const & sExtensionFolderURL) +{ + Reference< css::xml::dom::XNode > root; + Reference context = + comphelper_getProcessComponentContext(); + OSL_ASSERT(context.is()); + try { + root = + ExtensionDescription( + context, sExtensionFolderURL, + Reference< css::ucb::XCommandEnvironment >()). + getRootElement(); + } catch (NoDescriptionException &) { + } catch (css::deployment::DeploymentException & e) { + throw css::uno::RuntimeException( + (OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.deployment.DeploymentException: ")) + + e.Message), 0); + } + return DescriptionInfoset(context, root); +} + DescriptionInfoset::DescriptionInfoset( css::uno::Reference< css::uno::XComponentContext > const & context, css::uno::Reference< css::xml::dom::XNode > const & element): diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 3ed2d554b59f..1f1fde7ca7bf 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -197,6 +197,19 @@ OUString makeURL( OUString const & baseURL, OUString const & relPath_ ) return buf.makeStringAndClear(); } +OUString makeURLAppendSysPathSegment( OUString const & baseURL, OUString const & relPath_ ) +{ + OUString segment = relPath_; + OSL_ASSERT(segment.indexOf(static_cast('/')) == -1); + + ::rtl::Uri::encode( + segment, rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8); + return makeURL(baseURL, segment); +} + + + //============================================================================== OUString expandUnoRcTerm( OUString const & term_ ) { @@ -467,4 +480,22 @@ void TRACE(::rtl::OString const & sText) #endif } +bool hasExtensionRepositoryChanged(::rtl::OUString const & repository) +{ + if (repository.equals(OUSTR("shared"))) + { + //get the extensions folder + OUString folder(RTL_CONSTASCII_USTRINGPARAM("BUNDLED_EXTENSIONS")); + ::rtl::Bootstrap::expandMacros(folder); + } + else if (repository.equals(OUSTR("bundled"))) + { + } + else + throw lang::IllegalArgumentException( + OUSTR("Invalid repository name."), 0, 0); + + return false; +} + } diff --git a/desktop/source/deployment/misc/dp_version.cxx b/desktop/source/deployment/misc/dp_version.cxx index 1668ebe4a0b7..c0da0533b54c 100644 --- a/desktop/source/deployment/misc/dp_version.cxx +++ b/desktop/source/deployment/misc/dp_version.cxx @@ -70,11 +70,5 @@ namespace dp_misc { return ::dp_misc::EQUAL; } -::dp_misc::Order comparePackageVersions( - css::uno::Reference< css::deployment::XPackage > const & package1, - css::uno::Reference< css::deployment::XPackage > const & package2) -{ - return compareVersions(package1->getVersion(), package2->getVersion()); -} } diff --git a/desktop/source/deployment/misc/makefile.mk b/desktop/source/deployment/misc/makefile.mk index e191169202fd..9a7f1d62e001 100644 --- a/desktop/source/deployment/misc/makefile.mk +++ b/desktop/source/deployment/misc/makefile.mk @@ -75,7 +75,8 @@ SHL1STDLIBS = \ $(TOOLSLIB) \ $(UCBHELPERLIB) \ $(UNOTOOLSLIB) \ - $(XMLSCRIPTLIB) + $(XMLSCRIPTLIB) \ + $(COMPHELPERLIB) .IF "$(GUI)"=="OS2" SHL1IMPLIB = ideploymentmisc$(DLLPOSTFIX) LIB1TARGET = $(SLB)$/_deplmisc.lib diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.cxx b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx new file mode 100644 index 000000000000..edaf642a2ab1 --- /dev/null +++ b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "rtl/string.h" +#include "rtl/bootstrap.hxx" +#include "cppuhelper/exc_hlp.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/xml/dom/XDocumentBuilder.hpp" +#include "com/sun/star/xml/xpath/XXPathAPI.hpp" +#include "dp_misc.h" + +#include "dp_compbackenddb.hxx" + + +namespace css = ::com::sun::star; +using namespace ::com::sun::star::uno; +using ::rtl::OUString; + +#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/component-registry/2010" +#define ROOT_ELEMENT_NAME "component-backend-db" + +namespace dp_registry { +namespace backend { +namespace component { + +ComponentBackendDb::ComponentBackendDb( + Reference const & xContext, + ::rtl::OUString const & url):BackendDb(xContext, url) +{ + +} + +OUString ComponentBackendDb::getDbNSName() +{ + return OUSTR(EXTENSION_REG_NS); +} + +OUString ComponentBackendDb::getRootElementName() +{ + return OUSTR(ROOT_ELEMENT_NAME); +} + +void ComponentBackendDb::addEntry(::rtl::OUString const & url, Data const & data) +{ + try{ + + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + +#if OSL_DEBUG_LEVEL > 0 + //There must not be yet an entry with the same url + OUString sExpression( + OUSTR("reg:component[@url = \"") + url + OUSTR("\"]")); + Reference _extensionNode = + getXPathAPI()->selectSingleNode(root, sExpression); + OSL_ASSERT(! _extensionNode.is()); +#endif + Reference componentElement( + doc->createElement(OUSTR("component"))); + + componentElement->setAttribute(OUSTR("url"), url); + + Reference componentNode( + componentElement, UNO_QUERY_THROW); + + root->appendChild(componentNode); + + Reference javaTypeLibNode( + doc->createElement(OUSTR("java-type-library")), UNO_QUERY_THROW); + + componentNode->appendChild(javaTypeLibNode); + + Reference javaTypeLibValueNode( + doc->createTextNode(OUString::valueOf((sal_Bool) data.javaTypeLibrary)), + UNO_QUERY_THROW); + javaTypeLibNode->appendChild(javaTypeLibValueNode); + + writeSimpleList( + data.implementationNames, + OUSTR("implementation-names"), + OUSTR("name"), + componentNode); + + writeVectorOfPair( + data.singletons, + OUSTR("singletons"), + OUSTR("item"), + OUSTR("key"), + OUSTR("value"), + componentNode); + + save(); + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to write data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + +void ComponentBackendDb::removeEntry(::rtl::OUString const & url) +{ + OUString sExpression( + OUSTR("reg:component[@url = \"") + url + OUSTR("\"]")); + removeElement(sExpression); +} + + + +} // namespace bundle +} // namespace backend +} // namespace dp_registry + diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.hxx b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx new file mode 100644 index 000000000000..0dde24beed3f --- /dev/null +++ b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_DP_COMPBACKENDDB_HXX +#define INCLUDED_DP_COMPBACKENDDB_HXX + +#include "rtl/ustring.hxx" +#include "rtl/string.hxx" +#include +#include +#include "dp_backenddb.hxx" + +namespace css = ::com::sun::star; + +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + } + namespace xml { namespace dom { + class XDocument; + class XNode; + }} + namespace xml { namespace xpath { + class XXPathAPI; + }} +}}} + +namespace dp_registry { +namespace backend { +namespace component { + +/* The XML file stores the extensions which are currently registered. + They will be removed when they are revoked. + The format looks like this: + + + + + true + + com.sun.star.comp.extensionoptions.OptionsEventHandler$_OptionsEventHandler + ... + + + + com.sun.star.java.theJavaVirtualMachine + com.sun.star.java.JavaVirtualMachine + + ... + + + + + ... + + */ +class ComponentBackendDb: public dp_registry::backend::BackendDb +{ +public: + struct Data + { + Data(): javaTypeLibrary(false) {}; + + ::std::list< ::rtl::OUString> implementationNames; + /* every singleton has a key and a value + */ + ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString> >singletons; + bool javaTypeLibrary; + }; + +public: + + ComponentBackendDb( css::uno::Reference const & xContext, + ::rtl::OUString const & url); + + void addEntry(::rtl::OUString const & url, Data const & data); + void removeEntry(::rtl::OUString const & url); + + virtual ::rtl::OUString getDbNSName(); + + virtual ::rtl::OUString getRootElementName(); + + +}; + + + +} +} +} +#endif + diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index e6781e2a1746..e4e5efff9e81 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -58,7 +58,7 @@ #include #include #include - +#include "dp_compbackenddb.hxx" using namespace ::dp_misc; using namespace ::com::sun::star; @@ -74,6 +74,9 @@ namespace { typedef ::std::list t_stringlist; typedef ::std::vector< ::std::pair > t_stringpairvec; +#define IMPLEMENTATION_NAME "com.sun.star.comp.deployment.component.PackageRegistryBackend" +inline OUString makeRcTerm( OUString const & url ); + /** return a vector of bootstrap variables which have been provided as command arguments. */ @@ -153,9 +156,9 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, - OUString const & loader ) + OUString const & loader, bool bUseDb ) : Package( myBackend, url, name, name /* display-name */, - xPackageType ), + xPackageType, bUseDb ), m_loader( loader ), m_registered( REG_UNINIT ) {} @@ -187,9 +190,9 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, - bool jarFile ) + bool jarFile, bool bUseDb ) : Package( myBackend, url, name, name /* display-name */, - xPackageType ), + xPackageType, bUseDb), m_jarFile( jarFile ) {} }; @@ -212,6 +215,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, + sal_Bool bNoFileAccess, Reference const & xCmdEnv ); virtual void SAL_CALL disposing(); @@ -230,6 +234,12 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend OUString m_commonRDB_RO; OUString m_nativeRDB_RO; + std::auto_ptr m_backendDb; + + void addDataToDb(OUString const & url, ComponentBackendDb::Data const & data); + void deleteDataFromDb(OUString const & url); + + //These rdbs are for writing new service entries. The rdb files are copies //which are created when services are added or removed. Reference m_xCommonRDB; @@ -371,59 +381,59 @@ void BackendImpl::disposing() } } + void BackendImpl::initServiceRdbFiles() { const Reference xCmdEnv; - if (! m_readOnly) + + ::ucbhelper::Content cacheDir( getCachePath(), xCmdEnv ); + ::ucbhelper::Content oldRDB; + // switch common rdb: + if (m_commonRDB_RO.getLength() > 0) { - ::ucbhelper::Content cacheDir( getCachePath(), xCmdEnv ); - ::ucbhelper::Content oldRDB; - // switch common rdb: - if (m_commonRDB_RO.getLength() > 0) - { - create_ucb_content( - &oldRDB, makeURL( getCachePath(), m_commonRDB_RO), - xCmdEnv, false /* no throw */ ); - } - m_commonRDB = m_commonRDB_RO.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM("common.rdb") ) - ? OUSTR("common_.rdb") : OUSTR("common.rdb"); - if (oldRDB.get().is()) - { - if (! cacheDir.transferContent( + create_ucb_content( + &oldRDB, makeURL( getCachePath(), m_commonRDB_RO), + xCmdEnv, false /* no throw */ ); + } + m_commonRDB = m_commonRDB_RO.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("common.rdb") ) + ? OUSTR("common_.rdb") : OUSTR("common.rdb"); + if (oldRDB.get().is()) + { + if (! cacheDir.transferContent( oldRDB, ::ucbhelper::InsertOperation_COPY, m_commonRDB, NameClash::OVERWRITE )) - { - - throw RuntimeException( - OUSTR("UCB transferContent() failed!"), 0 ); - } - oldRDB = ::ucbhelper::Content(); - } - // switch native rdb: - if (m_nativeRDB_RO.getLength() > 0) { - create_ucb_content( - &oldRDB, makeURL(getCachePath(), m_nativeRDB_RO), - xCmdEnv, false /* no throw */ ); + + throw RuntimeException( + OUSTR("UCB transferContent() failed!"), 0 ); } - const OUString plt_rdb( getPlatformString() + OUSTR(".rdb") ); - const OUString plt_rdb_( getPlatformString() + OUSTR("_.rdb") ); - m_nativeRDB = m_nativeRDB_RO.equals( plt_rdb ) ? plt_rdb_ : plt_rdb; - if (oldRDB.get().is()) - { - if (! cacheDir.transferContent( + oldRDB = ::ucbhelper::Content(); + } + // switch native rdb: + if (m_nativeRDB_RO.getLength() > 0) + { + create_ucb_content( + &oldRDB, makeURL(getCachePath(), m_nativeRDB_RO), + xCmdEnv, false /* no throw */ ); + } + const OUString plt_rdb( getPlatformString() + OUSTR(".rdb") ); + const OUString plt_rdb_( getPlatformString() + OUSTR("_.rdb") ); + m_nativeRDB = m_nativeRDB_RO.equals( plt_rdb ) ? plt_rdb_ : plt_rdb; + if (oldRDB.get().is()) + { + if (! cacheDir.transferContent( oldRDB, ::ucbhelper::InsertOperation_COPY, m_nativeRDB, NameClash::OVERWRITE )) - throw RuntimeException( + throw RuntimeException( OUSTR("UCB transferContent() failed!"), 0 ); - } - - // UNO is bootstrapped, flush for next process start: - m_unorc_modified = true; - unorc_flush( Reference() ); } + // UNO is bootstrapped, flush for next process start: + m_unorc_modified = true; + unorc_flush( Reference() ); + + // common rdb for java, native rdb for shared lib components if (m_commonRDB.getLength() > 0) { m_xCommonRDB.set( @@ -433,7 +443,8 @@ void BackendImpl::initServiceRdbFiles() m_xComponentContext ), UNO_QUERY_THROW ); m_xCommonRDB->open( makeURL( expandUnoRcUrl(getCachePath()), m_commonRDB ), - m_readOnly, !m_readOnly ); +// m_readOnly, !m_readOnly ); + false, true); } if (m_nativeRDB.getLength() > 0) { m_xNativeRDB.set( @@ -443,7 +454,8 @@ void BackendImpl::initServiceRdbFiles() m_xComponentContext ), UNO_QUERY_THROW ); m_xNativeRDB->open( makeURL( expandUnoRcUrl(getCachePath()), m_nativeRDB ), - m_readOnly, !m_readOnly ); +// m_readOnly, !m_readOnly ); + false, true); } } @@ -562,9 +574,25 @@ BackendImpl::BackendImpl( initServiceRdbFiles_RO(); + OUString dbFile = makeURL(getCachePath(), OUSTR("backenddb.xml")); + m_backendDb.reset( + new ComponentBackendDb(getComponentContext(), dbFile)); } } +void BackendImpl::addDataToDb( + OUString const & url, ComponentBackendDb::Data const & data) +{ + if (m_backendDb.get()) + m_backendDb->addEntry(url, data); +} + +void BackendImpl::deleteDataFromDb(OUString const & url) +{ + if (m_backendDb.get()) + m_backendDb->removeEntry(url); +} + // XPackageRegistry //______________________________________________________________________________ Sequence< Reference > @@ -577,6 +605,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) //______________________________________________________________________________ Reference BackendImpl::bindPackage_( OUString const & url, OUString const & mediaType_, + sal_Bool bNoFileAccess, Reference const & xCmdEnv ) { OUString mediaType(mediaType_); @@ -649,17 +678,20 @@ Reference BackendImpl::bindPackage_( if (value.EqualsIgnoreCaseAscii("native")) { return new BackendImpl::ComponentPackageImpl( this, url, name, m_xDynComponentTypeInfo, - OUSTR("com.sun.star.loader.SharedLibrary") ); + OUSTR("com.sun.star.loader.SharedLibrary"), + bNoFileAccess ); } if (value.EqualsIgnoreCaseAscii("Java")) { return new BackendImpl::ComponentPackageImpl( this, url, name, m_xJavaComponentTypeInfo, - OUSTR("com.sun.star.loader.Java2") ); + OUSTR("com.sun.star.loader.Java2"), + bNoFileAccess ); } if (value.EqualsIgnoreCaseAscii("Python")) { return new BackendImpl::ComponentPackageImpl( this, url, name, m_xPythonComponentTypeInfo, - OUSTR("com.sun.star.loader.Python") ); + OUSTR("com.sun.star.loader.Python"), + bNoFileAccess); } } } @@ -675,12 +707,12 @@ Reference BackendImpl::bindPackage_( { return new BackendImpl::TypelibraryPackageImpl( this, url, name, m_xRDBTypelibTypeInfo, - false /* rdb */ ); + false /* rdb */, bNoFileAccess); } if (value.EqualsIgnoreCaseAscii("Java")) { return new BackendImpl::TypelibraryPackageImpl( this, url, name, m_xJavaTypelibTypeInfo, - true /* jar */ ); + true /* jar */, bNoFileAccess); } } } @@ -785,18 +817,11 @@ void BackendImpl::unorc_flush( Reference const & xCmdEnv ) return; ::rtl::OStringBuffer buf; - // UNO_USER_PACKAGES_CACHE, UNO_SHARED_PACKAGES_CACHE have to be resolved - // locally: - if (m_eContext == CONTEXT_USER) { - buf.append( RTL_CONSTASCII_STRINGPARAM( - "UNO_USER_PACKAGES_CACHE=$ORIGIN/../..") ); - } - else if (m_eContext == CONTEXT_SHARED) { - buf.append( RTL_CONSTASCII_STRINGPARAM( - "UNO_SHARED_PACKAGES_CACHE=$ORIGIN/../..") ); - } - else - OSL_ASSERT(0); + + buf.append(RTL_CONSTASCII_STRINGPARAM("ORIGIN=")); + OUString sOrigin = makeRcTerm(m_cachePath); + ::rtl::OString osOrigin = ::rtl::OUStringToOString(sOrigin, RTL_TEXTENCODING_UTF8); + buf.append(osOrigin); buf.append(LF); if (! m_jar_typelibs.empty()) @@ -852,6 +877,9 @@ void BackendImpl::unorc_flush( Reference const & xCmdEnv ) // write native rc: ::rtl::OStringBuffer buf2; + buf2.append(RTL_CONSTASCII_STRINGPARAM("ORIGIN=")); + buf2.append(osOrigin); + buf2.append(LF); buf2.append( RTL_CONSTASCII_STRINGPARAM("UNO_SERVICES=?$ORIGIN/") ); buf2.append( ::rtl::OUStringToOString( sNativeRDB, RTL_TEXTENCODING_ASCII_US ) ); @@ -886,7 +914,7 @@ void BackendImpl::unorc_flush( Reference const & xCmdEnv ) inline OUString makeRcTerm( OUString const & url ) { OSL_ASSERT( url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( - "vnd.sun.star.expand:") ) ); + "vnd.sun.star.expand:") ) ); if (url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:") )) { // cut protocol: OUString rcterm( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) ); @@ -1186,6 +1214,8 @@ void BackendImpl::ComponentPackageImpl::processPackage_( bool isJavaTypelib = java && !jarManifestHeaderPresent( url, OUSTR("UNO-Type-Path"), xCmdEnv ); + ComponentBackendDb::Data data; + data.javaTypeLibrary = isJavaTypelib; if (doRegisterPackage) { if (! m_xRemoteContext.is()) { @@ -1210,12 +1240,17 @@ void BackendImpl::ComponentPackageImpl::processPackage_( //only write to unorc if registration was successful. //It may fail if there is no suitable java. if (isJavaTypelib) + { that->addToUnoRc( java, url, xCmdEnv ); + data.javaTypeLibrary = true; + } t_stringlist implNames; t_stringpairvec singletons; - const Reference xLoader( + const Reference xLoader( getComponentInfo( &implNames, &singletons, m_xRemoteContext ) ); + data.implementationNames = implNames; + data.singletons = singletons; // factories live insertion: const Reference xSet( @@ -1280,6 +1315,7 @@ void BackendImpl::ComponentPackageImpl::processPackage_( } m_registered = REG_REGISTERED; + getMyBackend()->addDataToDb(url, data); } else // revokePackage() { @@ -1364,6 +1400,7 @@ void BackendImpl::ComponentPackageImpl::processPackage_( } m_registered = REG_NOT_REGISTERED; + getMyBackend()->deleteDataFromDb(url); } } @@ -1490,7 +1527,7 @@ namespace sdecl = comphelper::service_decl; sdecl::class_ > serviceBI; extern sdecl::ServiceDecl const serviceDecl( serviceBI, - "com.sun.star.comp.deployment.component.PackageRegistryBackend", + IMPLEMENTATION_NAME, BACKEND_SERVICE_NAME ); } // namespace component diff --git a/desktop/source/deployment/registry/component/makefile.mk b/desktop/source/deployment/registry/component/makefile.mk index 4c4016f9bf6c..b7ee5c203cd5 100644 --- a/desktop/source/deployment/registry/component/makefile.mk +++ b/desktop/source/deployment/registry/component/makefile.mk @@ -40,7 +40,8 @@ SRC1FILES = \ INCPRE += ..$/..$/inc SLOFILES = \ - $(SLO)$/dp_component.obj + $(SLO)$/dp_component.obj \ + $(SLO)$/dp_compbackenddb.obj .INCLUDE : ..$/..$/target.pmk .INCLUDE : target.mk diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 460ba5e9fed0..7118e6d1b2d5 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -94,9 +94,9 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, - bool isSchema ) + bool isSchema, bool bUseDb) : Package( myBackend, url, name, name /* display-name */, - xPackageType ), + xPackageType, bUseDb), m_isSchema( isSchema ) {} }; @@ -113,7 +113,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( - OUString const & url, OUString const & mediaType, + OUString const & url, OUString const & mediaType, sal_Bool bNoFileAccess, Reference const & xCmdEnv ); ::std::auto_ptr m_registeredPackages; @@ -199,7 +199,7 @@ BackendImpl::BackendImpl( m_registeredPackages.reset( new PersistentMap( makeURL( getCachePath(), OUSTR("registered_packages.db") ), - m_readOnly ) ); + false ) ); } } @@ -215,6 +215,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) //______________________________________________________________________________ Reference BackendImpl::bindPackage_( OUString const & url, OUString const & mediaType_, + sal_Bool bNoFileAccess, Reference const & xCmdEnv ) { OUString mediaType( mediaType_ ); @@ -255,14 +256,14 @@ Reference BackendImpl::bindPackage_( return new PackageImpl( this, url, ucbContent.getPropertyValue( StrTitle::get() ).get(), - m_xConfDataTypeInfo, false /* data file */ ); + m_xConfDataTypeInfo, false /* data file */, bNoFileAccess); } else if (subType.EqualsIgnoreCaseAscii( "vnd.sun.star.configuration-schema")) { return new PackageImpl( this, url, ucbContent.getPropertyValue( StrTitle::get() ).get(), - m_xConfSchemaTypeInfo, true /* schema file */ ); + m_xConfSchemaTypeInfo, true /* schema file */, bNoFileAccess); } } } diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index c06b30be1669..31bb30de7315 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -88,6 +88,10 @@ PackageRegistryBackend::PackageRegistryBackend( m_eContext = CONTEXT_USER; else if (m_context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("shared") )) m_eContext = CONTEXT_SHARED; + else if (m_context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bundled") )) + m_eContext = CONTEXT_BUNDLED; + else if (m_context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("tmp") )) + m_eContext = CONTEXT_TMP; else if (m_context.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.tdoc:/") )) m_eContext = CONTEXT_DOCUMENT; @@ -127,24 +131,29 @@ void PackageRegistryBackend::disposing() // XPackageRegistry //______________________________________________________________________________ Reference PackageRegistryBackend::bindPackage( - OUString const & url, OUString const & mediaType, + OUString const & url, OUString const & mediaType, sal_Bool bNoFileAccess , Reference const & xCmdEnv ) throw (deployment::DeploymentException, CommandFailedException, lang::IllegalArgumentException, RuntimeException) { ::osl::ResettableMutexGuard guard( getMutex() ); check(); - t_string2ref::const_iterator const iFind( m_bound.find( url ) ); - if (iFind != m_bound.end()) { - Reference xPackage( iFind->second ); - if (xPackage.is()) - return xPackage; + if (!bNoFileAccess) + { + //We only save those object which were created with bNoFileAccess = false + t_string2ref::const_iterator const iFind( m_bound.find( url ) ); + if (iFind != m_bound.end()) + { + Reference xPackage( iFind->second ); + if (xPackage.is()) + return xPackage; + } } guard.clear(); Reference xNewPackage; try { - xNewPackage = bindPackage_( url, mediaType, xCmdEnv ); + xNewPackage = bindPackage_( url, mediaType, bNoFileAccess, xCmdEnv ); } catch (RuntimeException &) { throw; @@ -166,19 +175,23 @@ Reference PackageRegistryBackend::bindPackage( } guard.reset(); - ::std::pair< t_string2ref::iterator, bool > insertion( - m_bound.insert( t_string2ref::value_type( url, xNewPackage ) ) ); - if (insertion.second) - { // first insertion - OSL_ASSERT( Reference(insertion.first->second) - == xNewPackage ); - } - else - { // found existing entry - Reference xPackage( insertion.first->second ); - if (xPackage.is()) - return xPackage; - insertion.first->second = xNewPackage; + if (!bNoFileAccess) + { + //We only save those object which were created with bNoFileAccess = false + ::std::pair< t_string2ref::iterator, bool > insertion( + m_bound.insert( t_string2ref::value_type( url, xNewPackage ) ) ); + if (insertion.second) + { // first insertion + OSL_ASSERT( Reference(insertion.first->second) + == xNewPackage ); + } + else + { // found existing entry + Reference xPackage( insertion.first->second ); + if (xPackage.is()) + return xPackage; + insertion.first->second = xNewPackage; + } } guard.clear(); xNewPackage->addEventListener( this ); // listen for disposing events @@ -197,13 +210,15 @@ Package::Package( ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, OUString const & displayName, - Reference const & xPackageType ) + Reference const & xPackageType, + bool bUseDb) : t_PackageBase( getMutex() ), m_myBackend( myBackend ), m_url( url ), m_name( name ), m_displayName( displayName ), - m_xPackageType( xPackageType ) + m_xPackageType( xPackageType ), + m_bUseDb(bUseDb) { } @@ -542,7 +557,29 @@ void Package::revokePackage( lang::IllegalArgumentException, RuntimeException) { processPackage_impl( false /* revoke */, xAbortChannel, xCmdEnv ); + +} + +PackageRegistryBackend * Package::getMyBackend() const +{ + PackageRegistryBackend * pBackend = m_myBackend.get(); + if (NULL == pBackend) + { + //May throw a DisposedException + check(); + //We should never get here... + throw RuntimeException( + OUSTR("Failed to get the BackendImpl"), + static_cast(const_cast(this))); + } + return pBackend; } +OUString Package::getRepositoryName() + throw (RuntimeException) +{ + PackageRegistryBackend * backEnd = getMyBackend(); + return backEnd->getContext(); + } //############################################################################## diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx new file mode 100644 index 000000000000..fb0b99c3363c --- /dev/null +++ b/desktop/source/deployment/registry/dp_backenddb.cxx @@ -0,0 +1,332 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "rtl/string.h" +#include "rtl/strbuf.hxx" +#include "rtl/bootstrap.hxx" +#include "cppuhelper/exc_hlp.hxx" +#include "osl/file.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/xml/dom/XDocumentBuilder.hpp" +#include "com/sun/star/xml/xpath/XXPathAPI.hpp" +#include "com/sun/star/io/XActiveDataSource.hpp" +#include "com/sun/star/io/XActiveDataControl.hpp" +#include "dp_ucb.h" +#include "dp_misc.h" +#include "ucbhelper/content.hxx" +#include "xmlscript/xml_helper.hxx" +#include "dp_backenddb.hxx" + + +namespace css = ::com::sun::star; +using namespace ::com::sun::star::uno; +using ::rtl::OUString; + + +namespace dp_registry { +namespace backend { + +BackendDb::BackendDb( + Reference const & xContext, + ::rtl::OUString const & url): + m_xContext(xContext) +{ + m_urlDb = dp_misc::expandUnoRcUrl(url); +} + +void BackendDb::save() +{ + Reference xDataSource(m_doc,css::uno::UNO_QUERY_THROW); + ::rtl::ByteSequence bytes; + xDataSource->setOutputStream(::xmlscript::createOutputStream(&bytes)); + Reference xDataControl(m_doc,css::uno::UNO_QUERY_THROW); + xDataControl->start(); + + Reference xData( + ::xmlscript::createInputStream(bytes)); + ::ucbhelper::Content ucbDb(m_urlDb, 0); + ucbDb.writeStream(xData, true /*replace existing*/); +} + +css::uno::Reference BackendDb::getDocument() +{ + if (!m_doc.is()) + { + Reference xDocBuilder( + m_xContext->getServiceManager()->createInstanceWithContext( + OUSTR("com.sun.star.xml.dom.DocumentBuilder"), + m_xContext ), css::uno::UNO_QUERY); + if (!xDocBuilder.is()) + throw css::uno::RuntimeException( + OUSTR(" Could not create service com.sun.star.xml.dom.DocumentBuilder"), 0); + + ::osl::DirectoryItem item; + ::osl::File::RC err = ::osl::DirectoryItem::get(m_urlDb, item); + if (err == ::osl::File::E_None) + { + m_doc = xDocBuilder->parseURI(m_urlDb); + } + else if (err == ::osl::File::E_NOENT) + { + //Create a new document and insert some basic stuff + m_doc = xDocBuilder->newDocument(); + Reference rootNode = + m_doc->createElement(getRootElementName()); + rootNode->setAttribute( + OUSTR("xmlns"), getDbNSName()); + m_doc->appendChild(Reference( + rootNode, UNO_QUERY_THROW)); + save(); + } + else + throw css::uno::RuntimeException( + OUSTR("Extension manager could not access database file:" ) + + m_urlDb, 0); + + if (!m_doc.is()) + throw css::uno::RuntimeException( + OUSTR("Extension manager could not get root node of data base file: ") + + m_urlDb, 0); + } + + return m_doc; +} + +Reference BackendDb::getXPathAPI() +{ + if (!m_xpathApi.is()) + { + m_xpathApi = Reference< css::xml::xpath::XXPathAPI >( + m_xContext->getServiceManager()->createInstanceWithContext( + OUSTR("com.sun.star.xml.xpath.XPathAPI"), + m_xContext), css::uno::UNO_QUERY); + + if (!m_xpathApi.is()) + throw css::uno::RuntimeException( + OUSTR(" Could not create service com.sun.star.xml.xpath.XPathAPI"), 0); + + m_xpathApi->registerNS( + OUSTR("reg"), getDbNSName()); + } + + return m_xpathApi; +} + +// OUString BackendDb::getDbNSName() +// { +// return OUString(); +// } + + +// OUString BackendDb::getRootElementName() +// { +// return OUString(); +// } + +void BackendDb::removeElement(::rtl::OUString const & sXPathExpression) +{ + try + { + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + Reference xpathApi = getXPathAPI(); + //find the extension element that is to be removed + Reference aNode = + xpathApi->selectSingleNode(root, sXPathExpression); + OSL_ASSERT(aNode.is()); + if (aNode.is()) + { + root->removeChild(aNode); + save(); + } + +#if OSL_DEBUG_LEVEL > 0 + //There must not be any other entry with the same url + Reference nextNode = + xpathApi->selectSingleNode(root, sXPathExpression); + OSL_ASSERT(! nextNode.is()); +#endif + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to write data entry in backend db: ") + + m_urlDb, 0, exc); + } + +} + +void BackendDb::writeVectorOfPair( + ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > const & vecPairs, + OUString const & sVectorTagName, + OUString const & sPairTagName, + OUString const & sFirstTagName, + OUString const & sSecondTagName, + css::uno::Reference const & xParent) +{ + try{ + + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + + Reference vectorNode( + doc->createElement(sVectorTagName)); + + xParent->appendChild( + Reference( + vectorNode, css::uno::UNO_QUERY_THROW)); + typedef ::std::vector< ::std::pair< OUString, OUString > >::const_iterator CIT; + for (CIT i = vecPairs.begin(); i != vecPairs.end(); i++) + { + Reference pairNode( + doc->createElement(sPairTagName)); + + vectorNode->appendChild( + Reference( + pairNode, css::uno::UNO_QUERY_THROW)); + + Reference firstNode( + doc->createElement(sFirstTagName)); + + pairNode->appendChild( + Reference( + firstNode, css::uno::UNO_QUERY_THROW)); + + Reference firstTextNode( + doc->createTextNode( i->first)); + + firstNode->appendChild( + Reference( + firstTextNode, css::uno::UNO_QUERY_THROW)); + + Reference secondNode( + doc->createElement(sSecondTagName)); + + pairNode->appendChild( + Reference( + secondNode, css::uno::UNO_QUERY_THROW)); + + Reference secondTextNode( + doc->createTextNode( i->second)); + + secondNode->appendChild( + Reference( + secondTextNode, css::uno::UNO_QUERY_THROW)); + } + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to write data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + +::std::vector< ::std::pair< OUString, OUString > > +BackendDb::readVectorOfPair( + Reference const & parent, + OUString const & sListTagName, + OUString const & sPairTagName, + OUString const & sFirstTagName, + OUString const & sSecondTagName) +{ + OSL_ASSERT(parent.is()); + Reference xpathApi = getXPathAPI(); + OUString sExprPairs( + sListTagName + OUSTR("/") + sPairTagName); + Reference listPairs = + xpathApi->selectNodeList(parent, sExprPairs); + + ::std::vector< ::std::pair< OUString, OUString > > retVector; + sal_Int32 length = listPairs->getLength(); + for (sal_Int32 i = 0; i < length; i++) + { + Reference aPair = listPairs->item(i); + OUString sExprFirst(sFirstTagName + OUSTR("/text()")); + Reference first = + xpathApi->selectSingleNode(aPair, sExprFirst); + + OUString sExprSecond(sSecondTagName + OUSTR("/text()")); + Reference second = + xpathApi->selectSingleNode(aPair, sExprSecond); + OSL_ASSERT(first.is() && second.is()); + + retVector.push_back(::std::make_pair( + first->getNodeValue(), second->getNodeValue())); + } + return retVector; +} + +void BackendDb::writeSimpleList( + ::std::list< ::rtl::OUString> const & list, + OUString const & sListTagName, + OUString const & sMemberTagName, + Reference const & xParent) +{ + try + { + Reference doc = getDocument(); + + Reference listNode( + doc->createElement(sListTagName)); + + xParent->appendChild( + Reference( + listNode, css::uno::UNO_QUERY_THROW)); + + typedef ::std::list::const_iterator ITC_ITEMS; + for (ITC_ITEMS i = list.begin(); i != list.end(); i++) + { + Reference memberNode( + doc->createElement(sMemberTagName), css::uno::UNO_QUERY_THROW); + + listNode->appendChild(memberNode); + + Reference textNode( + doc->createTextNode( *i), css::uno::UNO_QUERY_THROW); + + memberNode->appendChild(textNode); + } + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to write data entry in backend db: ") + + m_urlDb, 0, exc); + } + +} + +} // namespace backend +} // namespace dp_registry + diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index c56131a1015c..9ea13ad2c91f 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -126,7 +126,7 @@ public: // XPackageRegistry virtual Reference SAL_CALL bindPackage( - OUString const & url, OUString const & mediaType, + OUString const & url, OUString const & mediaType, sal_Bool bNoFileAccess, Reference const & xCmdEnv ) throw (deployment::DeploymentException, CommandFailedException, lang::IllegalArgumentException, RuntimeException); @@ -361,9 +361,24 @@ Reference PackageRegistryImpl::create( // Always register as last, because we want to add extensions also as folders // and as a default we accept every folder, which was not recognized by the other // backends. - that->insertBackend( + Reference extensionBackend = ::dp_registry::backend::bundle::create( - that, context, cachePath, readOnly, xComponentContext ) ); + that, context, cachePath, readOnly, xComponentContext); + that->insertBackend(extensionBackend); + + Reference xServiceInfo( + extensionBackend, UNO_QUERY_THROW ); + + OSL_ASSERT(xServiceInfo.is()); + OUString registryCachePath( + makeURL( cachePath, + ::rtl::Uri::encode( + xServiceInfo->getImplementationName(), + rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ) ) ); + create_folder( 0, registryCachePath, Reference()); + #if OSL_DEBUG_LEVEL > 1 // dump tables: @@ -443,7 +458,7 @@ void PackageRegistryImpl::update() throw (RuntimeException) // XPackageRegistry //______________________________________________________________________________ Reference PackageRegistryImpl::bindPackage( - OUString const & url, OUString const & mediaType_, + OUString const & url, OUString const & mediaType_, sal_Bool bNoFileAccess, Reference const & xCmdEnv ) throw (deployment::DeploymentException, CommandFailedException, lang::IllegalArgumentException, RuntimeException) @@ -482,7 +497,7 @@ Reference PackageRegistryImpl::bindPackage( for ( ; iPos != iEnd; ++iPos ) { try { - return (*iPos)->bindPackage( url, mediaType, xCmdEnv ); + return (*iPos)->bindPackage( url, mediaType, bNoFileAccess, xCmdEnv ); } catch (lang::IllegalArgumentException &) { } @@ -511,7 +526,7 @@ Reference PackageRegistryImpl::bindPackage( getResourceString(RID_STR_UNSUPPORTED_MEDIA_TYPE) + mediaType, static_cast(this), static_cast(-1) ); } - return iFind->second->bindPackage( url, mediaType, xCmdEnv ); + return iFind->second->bindPackage( url, mediaType, bNoFileAccess, xCmdEnv ); } } diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx index 8c95d5874b4c..a5fe1b99746f 100644 --- a/desktop/source/deployment/registry/executable/dp_executable.cxx +++ b/desktop/source/deployment/registry/executable/dp_executable.cxx @@ -72,9 +72,9 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend inline ExecutablePackageImpl( ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, - Reference const & xPackageType) + Reference const & xPackageType, bool bUseDb) : Package( myBackend, url, name, name /* display-name */, - xPackageType ) //, + xPackageType, bUseDb) //, {} }; friend class ExecutablePackageImpl; @@ -84,7 +84,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( - OUString const & url, OUString const & mediaType, + OUString const & url, OUString const & mediaType, sal_Bool bNoFileAccess, Reference const & xCmdEnv ); Reference m_xExecutableTypeInfo; @@ -125,7 +125,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) // PackageRegistryBackend Reference BackendImpl::bindPackage_( - OUString const & url, OUString const & mediaType, + OUString const & url, OUString const & mediaType, sal_Bool bNoFileAccess, Reference const & xCmdEnv ) { if (mediaType.getLength() == 0) @@ -147,7 +147,7 @@ Reference BackendImpl::bindPackage_( if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.executable")) { return new BackendImpl::ExecutablePackageImpl( - this, url, name, m_xExecutableTypeInfo); + this, url, name, m_xExecutableTypeInfo, bNoFileAccess); } } } diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 2b0d91250e4a..05ff8dda0e01 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -78,8 +78,9 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend inline PackageImpl( ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, - Reference const & xPackageType ) - : Package( myBackend, url, name, name, xPackageType ) + Reference const & xPackageType, + bool bUseDb) + : Package( myBackend, url, name, name, xPackageType, bUseDb) {} }; friend class PackageImpl; @@ -87,6 +88,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, + sal_Bool bNoFileAccess, Reference const & xCmdEnv ); void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage ); @@ -138,6 +140,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) //______________________________________________________________________________ Reference BackendImpl::bindPackage_( OUString const & url, OUString const & mediaType_, + sal_Bool bNoFileAccess, Reference const & xCmdEnv ) { // we don't support auto detection: @@ -156,8 +159,10 @@ Reference BackendImpl::bindPackage_( if (subType.EqualsIgnoreCaseAscii( "vnd.sun.star.help")) { - return new PackageImpl( this, url, - ucbContent.getPropertyValue( StrTitle::get() ).get(), m_xHelpTypeInfo ); + return new PackageImpl( + this, url, + ucbContent.getPropertyValue( StrTitle::get() ).get(), + m_xHelpTypeInfo, bNoFileAccess); } } } diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index fe52c8ffc7e3..09b25caedc2b 100644 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -62,6 +62,7 @@ typedef ::cppu::WeakComponentImplHelper1< //============================================================================== class Package : protected ::dp_misc::MutexHolder, public t_PackageBase { + PackageRegistryBackend * getMyBackend() const; void processPackage_impl( bool registerPackage, css::uno::Reference const & xAbortChannel, @@ -73,6 +74,7 @@ protected: ::rtl::OUString m_name; ::rtl::OUString m_displayName; const css::uno::Reference m_xPackageType; + const bool m_bUseDb; void check() const; void fireModified(); @@ -101,7 +103,8 @@ protected: ::rtl::OUString const & name, ::rtl::OUString const & displayName, css::uno::Reference const & - xPackageType ); + xPackageType, + bool bUseDb); public: @@ -233,6 +236,9 @@ public: css::uno::Reference const & xCmdEnv ) throw (css::ucb::CommandFailedException, css::ucb::CommandAbortedException, css::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getRepositoryName() + throw (css::uno::RuntimeException); }; typedef ::cppu::WeakComponentImplHelper2< @@ -243,7 +249,6 @@ typedef ::cppu::WeakComponentImplHelper2< class PackageRegistryBackend : protected ::dp_misc::MutexHolder, public t_BackendBase { - ::rtl::OUString m_cachePath; //The map held originally WeakReferences. The map entries are removed in the disposing //function, which is called when the XPackages are destructed or they are //explicitely disposed. The latter happens, for example, when a extension is @@ -257,13 +262,14 @@ class PackageRegistryBackend t_string2ref m_bound; protected: + ::rtl::OUString m_cachePath; css::uno::Reference m_xComponentContext; ::rtl::OUString m_context; // currently only for library containers: enum context { CONTEXT_UNKNOWN, - CONTEXT_USER, CONTEXT_SHARED, + CONTEXT_USER, CONTEXT_SHARED,CONTEXT_BUNDLED, CONTEXT_TMP, CONTEXT_DOCUMENT } m_eContext; bool m_readOnly; @@ -276,6 +282,7 @@ protected: // @@@ to be implemented by specific backend: virtual css::uno::Reference bindPackage_( ::rtl::OUString const & url, ::rtl::OUString const & mediaType, + sal_Bool bNoFileAccess, css::uno::Reference const & xCmdEnv ) = 0; @@ -299,6 +306,8 @@ public: inline ::rtl::OUString const & getCachePath() const { return m_cachePath; } inline bool transientMode() const { return m_cachePath.getLength() == 0; } + inline ::rtl::OUString getContext() const {return m_context; } + // XEventListener virtual void SAL_CALL disposing( css::lang::EventObject const & evt ) throw (css::uno::RuntimeException); @@ -306,6 +315,7 @@ public: // XPackageRegistry virtual css::uno::Reference SAL_CALL bindPackage( ::rtl::OUString const & url, ::rtl::OUString const & mediaType, + sal_Bool bNoFileAccess, css::uno::Reference const & xCmdEnv ) throw (css::deployment::DeploymentException, css::ucb::CommandFailedException, diff --git a/desktop/source/deployment/registry/inc/dp_backenddb.hxx b/desktop/source/deployment/registry/inc/dp_backenddb.hxx new file mode 100644 index 000000000000..3005ffcafb5b --- /dev/null +++ b/desktop/source/deployment/registry/inc/dp_backenddb.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_DP_BACKENDDB_HXX +#define INCLUDED_DP_BACKENDDB_HXX + +#include "rtl/ustring.hxx" +#include + +namespace css = ::com::sun::star; + +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + } + namespace xml { namespace dom { + class XDocument; + class XNode; + }} + namespace xml { namespace xpath { + class XXPathAPI; + }} +}}} + +namespace dp_registry { +namespace backend { + +class BackendDb +{ +private: + + css::uno::Reference m_doc; + css::uno::Reference m_xpathApi; + + BackendDb(BackendDb const &); + BackendDb & operator = (BackendDb const &); + +protected: + const css::uno::Reference m_xContext; + ::rtl::OUString m_urlDb; + +protected: + + /* caller must make sure that only one thread accesses the function + */ + css::uno::Reference getDocument(); + + /* the namespace prefix is "reg" (without quotes) + */ + css::uno::Reference getXPathAPI(); + void save(); + void removeElement(::rtl::OUString const & sXPathExpression); + + void writeSimpleList( + ::std::list< ::rtl::OUString> const & list, + ::rtl::OUString const & sListTagName, + ::rtl::OUString const & sMemberTagName, + css::uno::Reference const & xParent); + + void writeVectorOfPair( + ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > const & vecPairs, + ::rtl::OUString const & sVectorTagName, + ::rtl::OUString const & sPairTagName, + ::rtl::OUString const & sFirstTagName, + ::rtl::OUString const & sSecondTagName, + css::uno::Reference const & xParent); + + ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > + readVectorOfPair( + css::uno::Reference const & parent, + ::rtl::OUString const & sListTagName, + ::rtl::OUString const & sPairTagName, + ::rtl::OUString const & sFirstTagName, + ::rtl::OUString const & sSecondTagName); + + + + /* returns the namespace which is to be written as xmlns attribute + into the root element. + */ + virtual ::rtl::OUString getDbNSName()=0; + /* returns the name of the root element without any namespace prefix. + */ + virtual ::rtl::OUString getRootElementName()=0; + + +public: + BackendDb(css::uno::Reference const & xContext, + ::rtl::OUString const & url); + virtual ~BackendDb() {}; + +}; + +} +} +#endif + diff --git a/desktop/source/deployment/registry/makefile.mk b/desktop/source/deployment/registry/makefile.mk index de0e943654d9..e45cec272ca7 100644 --- a/desktop/source/deployment/registry/makefile.mk +++ b/desktop/source/deployment/registry/makefile.mk @@ -41,7 +41,8 @@ INCPRE += inc SLOFILES = \ $(SLO)$/dp_backend.obj \ - $(SLO)$/dp_registry.obj + $(SLO)$/dp_registry.obj \ + $(SLO)$/dp_backenddb.obj .INCLUDE : ..$/target.pmk .INCLUDE : target.mk diff --git a/desktop/source/deployment/registry/package/dp_description.cxx b/desktop/source/deployment/registry/package/dp_description.cxx deleted file mode 100644 index 7c05bfd90a5b..000000000000 --- a/desktop/source/deployment/registry/package/dp_description.cxx +++ /dev/null @@ -1,205 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_desktop.hxx" - -#include "dp_description.hxx" - -#include "cppuhelper/exc_hlp.hxx" -#include "ucbhelper/content.hxx" -#include "com/sun/star/deployment/DeploymentException.hpp" -#include "com/sun/star/xml/dom/XDocumentBuilder.hpp" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/ucb/CommandFailedException.hpp" -#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" -#include "com/sun/star/ucb/IOErrorCode.hpp" - -#include "com/sun/star/beans/PropertyValue.hpp" - - -#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) - -namespace css = com::sun::star; -namespace cssu = com::sun::star::uno; - -namespace dp_registry { -namespace backend { -namespace bundle { - -ExtensionDescription::ExtensionDescription( - const cssu::Reference& xContext, - const ::rtl::OUString& installDir, - const cssu::Reference< css::ucb::XCommandEnvironment >& xCmdEnv) -{ - try { - m_sExtensionRootUrl = installDir; - //may throw ::com::sun::star::ucb::ContentCreationException - //If there is no description.xml then ucb will start an interaction which - //brings up a dialog.We want to prevent this. Therefore we wrap the xCmdEnv - //and filter the respective exception out. - ::rtl::OUString sDescriptionUri(installDir + OUSTR("/description.xml")); - cssu::Reference xFilter = - static_cast( - new FileDoesNotExistFilter(xCmdEnv)); - ::ucbhelper::Content descContent(sDescriptionUri, xFilter); - - //throws an com::sun::star::uno::Exception if the file is not available - cssu::Reference xIn; - try - { //throws com.sun.star.ucb.InteractiveAugmentedIOException - xIn = descContent.openStream(); - } - catch (cssu::Exception& ) - { - if ( ! static_cast(xFilter.get())->exist()) - throw NoDescriptionException(); - throw; - } - if (!xIn.is()) - { - throw cssu::Exception( - OUSTR("Could not get XInputStream for description.xml of extension ") + - sDescriptionUri, 0); - } - - //get root node of description.xml - cssu::Reference xDocBuilder( - xContext->getServiceManager()->createInstanceWithContext( - OUSTR("com.sun.star.xml.dom.DocumentBuilder"), - xContext ), cssu::UNO_QUERY); - if (!xDocBuilder.is()) - throw css::uno::Exception(OUSTR(" Could not create service com.sun.star.xml.dom.DocumentBuilder"), 0); - - if (xDocBuilder->isNamespaceAware() == sal_False) - { - throw cssu::Exception( - OUSTR("Service com.sun.star.xml.dom.DocumentBuilder is not namespace aware."), 0); - } - - cssu::Reference xDoc = xDocBuilder->parse(xIn); - if (!xDoc.is()) - { - throw cssu::Exception(sDescriptionUri + OUSTR(" contains data which cannot be parsed. "), 0); - } - - //check for proper root element and namespace - cssu::Reference xRoot = xDoc->getDocumentElement(); - if (!xRoot.is()) - { - throw cssu::Exception( - sDescriptionUri + OUSTR(" contains no root element."), 0); - } - - if ( ! xRoot->getTagName().equals(OUSTR("description"))) - { - throw cssu::Exception( - sDescriptionUri + OUSTR(" does not contain the root element ."), 0); - } - - m_xRoot = cssu::Reference( - xRoot, cssu::UNO_QUERY_THROW); - ::rtl::OUString nsDescription = xRoot->getNamespaceURI(); - - //check if this namespace is supported - if ( ! nsDescription.equals(OUSTR("http://openoffice.org/extensions/description/2006"))) - { - throw cssu::Exception(sDescriptionUri + OUSTR(" contains a root element with an unsupported namespace. "), 0); - } - } catch (css::uno::RuntimeException &) { - throw; - } catch (css::deployment::DeploymentException &) { - throw; - } catch (css::uno::Exception & e) { - css::uno::Any a(cppu::getCaughtException()); - throw css::deployment::DeploymentException( - e.Message, css::uno::Reference< css::uno::XInterface >(), a); - } -} - -ExtensionDescription::~ExtensionDescription() -{ -} - -//====================================================================== -FileDoesNotExistFilter::FileDoesNotExistFilter( - const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv): - m_bExist(true), m_xCommandEnv(xCmdEnv) -{} - -FileDoesNotExistFilter::~FileDoesNotExistFilter() -{ -}; - -bool FileDoesNotExistFilter::exist() -{ - return m_bExist; -} - // XCommandEnvironment -cssu::Reference - FileDoesNotExistFilter::getInteractionHandler() throw (css::uno::RuntimeException) -{ - return static_cast(this); -} - -cssu::Reference - FileDoesNotExistFilter::getProgressHandler() throw (css::uno::RuntimeException) -{ - return m_xCommandEnv.is() - ? m_xCommandEnv->getProgressHandler() - : cssu::Reference(); -} - -// XInteractionHandler -//If the interaction was caused by a non-existing file which is specified in the ctor -//of FileDoesNotExistFilter, then we do nothing -void FileDoesNotExistFilter::handle( - cssu::Reference const & xRequest ) - throw (css::uno::RuntimeException) -{ - cssu::Any request( xRequest->getRequest() ); - - css::ucb::InteractiveAugmentedIOException ioexc; - if ((request>>= ioexc) && ioexc.Code == css::ucb::IOErrorCode_NOT_EXISTING ) - { - m_bExist = false; - return; - } - css::uno::Reference xInteraction; - if (m_xCommandEnv.is()) { - xInteraction = m_xCommandEnv->getInteractionHandler(); - } - if (xInteraction.is()) { - xInteraction->handle(xRequest); - } -} - - -} // namespace bundle -} // namespace backend -} // namespace dp_registry - diff --git a/desktop/source/deployment/registry/package/dp_description.hxx b/desktop/source/deployment/registry/package/dp_description.hxx deleted file mode 100644 index eb74c454af75..000000000000 --- a/desktop/source/deployment/registry/package/dp_description.hxx +++ /dev/null @@ -1,125 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if !defined INCLUDED_DESKTOP_EXTENSION_DESCRIPTION_HXX -#define INCLUDED_DESKTOP_EXTENSION_DESCRIPTION_HXX - - - -#include "com/sun/star/uno/Reference.hxx" - -#include "com/sun/star/ucb/XCommandEnvironment.hpp" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/xml/dom/XNode.hpp" -#include "com/sun/star/task/XInteractionHandler.hpp" -#include "cppuhelper/implbase2.hxx" - - -namespace css = ::com::sun::star; - -namespace dp_registry { -namespace backend { -namespace bundle { - -/**The class uses the UCB to access the description.xml file in an - extension. The UCB must have been initialized already. It also - requires that the extension has already be unzipped to a particular - location. - */ -class ExtensionDescription -{ -public: - /**throws an exception if the description.xml is not - available, cannot be read, does not contain the expected data, - or any other error occured. Therefore it shoult only be used with - new extensions. - - Throws com::sun::star::uno::RuntimeException, - com::sun::star::deployment::DeploymentException, - dp_registry::backend::bundle::NoDescriptionException. - */ - ExtensionDescription( - const css::uno::Reference& xContext, - const ::rtl::OUString& installDir, - const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv); - - ~ExtensionDescription(); - - css::uno::Reference getRootElement() const - { - return m_xRoot; - } - - ::rtl::OUString getExtensionRootUrl() const - { - return m_sExtensionRootUrl; - } - - -private: - css::uno::Reference m_xRoot; - ::rtl::OUString m_sExtensionRootUrl; -}; - -class NoDescriptionException -{ -}; - -class FileDoesNotExistFilter - : public ::cppu::WeakImplHelper2< css::ucb::XCommandEnvironment, - css::task::XInteractionHandler > - -{ - //css::uno::Reference m_xHandler; - bool m_bExist; - css::uno::Reference< css::ucb::XCommandEnvironment > m_xCommandEnv; - -public: - virtual ~FileDoesNotExistFilter(); - FileDoesNotExistFilter( - const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv); - - bool exist(); - // XCommandEnvironment - virtual css::uno::Reference SAL_CALL - getInteractionHandler() throw (css::uno::RuntimeException); - virtual css::uno::Reference - SAL_CALL getProgressHandler() throw (css::uno::RuntimeException); - - // XInteractionHandler - virtual void SAL_CALL handle( - css::uno::Reference const & xRequest ) - throw (css::uno::RuntimeException); -}; - - -} // namespace bundle -} // namespace backend -} // namespace dp_registry - - -#endif // INCLUDED_DESKTOP_LICENSE_INTERACT_HXX diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.cxx b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx new file mode 100644 index 000000000000..97cfc136049c --- /dev/null +++ b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "rtl/string.h" +#include "rtl/bootstrap.hxx" +#include "cppuhelper/exc_hlp.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/xml/dom/XDocumentBuilder.hpp" +#include "com/sun/star/xml/xpath/XXPathAPI.hpp" +#include "dp_misc.h" + +#include "dp_extbackenddb.hxx" + + +namespace css = ::com::sun::star; +using namespace ::com::sun::star::uno; +using ::rtl::OUString; + +#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/extension-registry/2010" +#define ROOT_ELEMENT_NAME "extension-backend-db" + +// /extension-backend-db/extension +#define EXTENSION_ELEMENT "extension" + +// /extension-backend-db/extension/extension-items +#define EXTENSION_ITEMS "extension-items" + +// /extension-backend-db/extension/extension-items/item +#define EXTENSION_ITEMS_ITEM "item" + +// /extension-backend-db/extension/extension-items/item/url +#define ITEM_URL "url" + +// /extension-backend-db/extension/extension-items/item/media-type +#define ITEM_MEDIA_TYP "media-type" + + +namespace dp_registry { +namespace backend { +namespace bundle { + +ExtensionBackendDb::ExtensionBackendDb( + Reference const & xContext, + ::rtl::OUString const & url):BackendDb(xContext, url) +{ + +} + +OUString ExtensionBackendDb::getDbNSName() +{ + return OUSTR(EXTENSION_REG_NS); +} + +OUString ExtensionBackendDb::getRootElementName() +{ + return OUSTR(ROOT_ELEMENT_NAME); +} + +void ExtensionBackendDb::addEntry(::rtl::OUString const & url, Data const & data) +{ + try{ + + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + +#if OSL_DEBUG_LEVEL > 0 + //There must not be yet an entry with the same url + OUString sExpression( + OUSTR("reg:extension[@url = \"") + url + OUSTR("\"]")); + Reference _extensionNode = + getXPathAPI()->selectSingleNode(root, sExpression); + OSL_ASSERT(! _extensionNode.is()); +#endif + // + Reference extensionNode( + doc->createElement(OUSTR("extension"))); + + extensionNode->setAttribute(OUSTR("url"), url); + + Reference extensionNodeNode( + extensionNode, css::uno::UNO_QUERY_THROW); + root->appendChild(extensionNodeNode); + + // ... + Reference identifierNode( + doc->createElement(OUSTR("identifier")), UNO_QUERY_THROW); + extensionNodeNode->appendChild(identifierNode); + + Reference identifierValue( + doc->createTextNode(data.identifier), UNO_QUERY_THROW); + identifierNode->appendChild(identifierValue); + + + writeVectorOfPair( + data.items, + OUSTR("extension-items"), + OUSTR("item"), + OUSTR("url"), + OUSTR("media-type"), + extensionNodeNode); + save(); + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to write data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + +void ExtensionBackendDb::removeEntry(::rtl::OUString const & url) +{ + OUString sExpression( + OUSTR("reg:extension[@url = \"") + url + OUSTR("\"]")); + removeElement(sExpression); +} + +ExtensionBackendDb::Data ExtensionBackendDb::getEntry(::rtl::OUString const & url) +{ + ExtensionBackendDb::Data retData; + const OUString sExpression( + OUSTR("reg:extension[@url = \"") + url + OUSTR("\"]")); + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + + Reference xpathApi = getXPathAPI(); + //find the extension element that is to be removed + Reference aNode = + xpathApi->selectSingleNode(root, sExpression); + OSL_ASSERT(aNode.is()); + + const OUString sExprIdentifier(OUSTR("reg:identifier/text()")); + + Reference idValueNode = + xpathApi->selectSingleNode(aNode, sExprIdentifier); + retData.identifier = idValueNode->getNodeValue(); + + retData.items = + readVectorOfPair( + aNode, + OUSTR("reg:extension-items"), + OUSTR("reg:item"), OUSTR("reg:url"), OUSTR("reg:media-type")); + return retData; +} + +} // namespace bundle +} // namespace backend +} // namespace dp_registry + diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.hxx b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx new file mode 100644 index 000000000000..156e34155040 --- /dev/null +++ b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#if ! defined INCLUDED_DP_EXTBACKENDDB_HXX +#define INCLUDED_DP_EXTBACKENDDB_HXX + +#include "rtl/ustring.hxx" +#include "rtl/string.hxx" +#include +#include "dp_backenddb.hxx" + +namespace css = ::com::sun::star; + +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + } + namespace xml { namespace dom { + class XDocument; + class XNode; + }} + namespace xml { namespace xpath { + class XXPathAPI; + }} +}}} + +namespace dp_registry { +namespace backend { +namespace bundle { + +/* The XML file stores the extensions which are currently registered. + They will be removed when they are revoked. + */ +class ExtensionBackendDb: public dp_registry::backend::BackendDb +{ +public: + struct Data + { + ::rtl::OUString identifier; + /* every element consists of a pair of the url to the item (jar,rdb, etc) + and the media type + */ + ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString> > items; + typedef ::std::vector< + ::std::pair< ::rtl::OUString, ::rtl::OUString> >::const_iterator ITC_ITEMS; + + }; + +public: + + ExtensionBackendDb( css::uno::Reference const & xContext, + ::rtl::OUString const & url); + + void addEntry(::rtl::OUString const & url, Data const & data); + void removeEntry(::rtl::OUString const & url); + Data getEntry(::rtl::OUString const & url); + + virtual ::rtl::OUString getDbNSName(); + + virtual ::rtl::OUString getRootElementName(); +}; + + + +} +} +} +#endif + diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index b0b4a918c7a3..8fe7874f247f 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -34,7 +34,6 @@ #include "dp_interact.h" #include "dp_dependencies.hxx" #include "dp_platform.hxx" -#include "dp_description.hxx" #include "dp_descriptioninfoset.hxx" #include "dp_identifier.hxx" #include "rtl/uri.hxx" @@ -74,7 +73,7 @@ #include #include - +#include "dp_extbackenddb.hxx" using namespace ::dp_misc; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -106,6 +105,8 @@ class BackendImpl : public ImplBaseT Sequence< Reference > m_bundle; Sequence< Reference > * m_pBundle; + ExtensionBackendDb::Data m_data; + Reference bindBundleItem( OUString const & url, OUString const & mediaType, Reference const & xCmdEnv, @@ -122,20 +123,20 @@ class BackendImpl : public ImplBaseT ::rtl::Reference const & abortChannel, Reference const & xCmdEnv, bool skip_registration = false ); - + ::std::vector > getPackagesFromDb(); bool checkPlatform( css::uno::Reference< css::ucb::XCommandEnvironment > const & environment); bool checkDependencies( css::uno::Reference< css::ucb::XCommandEnvironment > const & environment, - ExtensionDescription const & description); + DescriptionInfoset const & description); // throws css::uno::RuntimeException, // css::deployment::DeploymentException ::sal_Bool checkLicense( css::uno::Reference< css::ucb::XCommandEnvironment > const & xCmdEnv, - ExtensionDescription const& description, bool bInstalled, + DescriptionInfoset const & description, bool bInstalled, OUString const & aContextName ) throw (css::deployment::DeploymentException, css::ucb::CommandFailedException, @@ -169,13 +170,8 @@ class BackendImpl : public ImplBaseT OUString const & url, OUString const & name, Reference const & xPackageType, - bool legacyBundle ) - : Package( myBackend, url, name, name /* display-name */, - xPackageType ), - m_url_expanded( expandUnoRcUrl( url ) ), - m_legacyBundle( legacyBundle ), - m_pBundle( 0 ) - {} + bool legacyBundle, + bool useDb); // XPackage virtual sal_Bool SAL_CALL isBundle() throw (RuntimeException); @@ -228,9 +224,16 @@ class BackendImpl : public ImplBaseT const Reference m_xLegacyBundleTypeInfo; Sequence< Reference > m_typeInfos; + std::auto_ptr m_backendDb; + + void addDataToDb(OUString const & url, ExtensionBackendDb::Data const & data); + ExtensionBackendDb::Data readDataFromDb(OUString const & url); + void deleteDataFromDb(OUString const & url); + // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, + sal_Bool bNoFileAccess, Reference const & xCmdEnv ); virtual void SAL_CALL disposing(); @@ -291,6 +294,14 @@ BackendImpl::BackendImpl( { m_typeInfos[ 0 ] = m_xBundleTypeInfo; m_typeInfos[ 1 ] = m_xLegacyBundleTypeInfo; + + if (!transientMode()) + { + OUString dbFile = makeURL(getCachePath(), getImplementationName()); + dbFile = makeURL(dbFile, OUSTR("backenddb.xml")); + m_backendDb.reset( + new ExtensionBackendDb(getComponentContext(), dbFile)); + } } //______________________________________________________________________________ @@ -333,6 +344,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) //______________________________________________________________________________ Reference BackendImpl::bindPackage_( OUString const & url, OUString const & mediaType_, + sal_Bool bNoFileAccess, Reference const & xCmdEnv ) { OUString mediaType( mediaType_ ); @@ -381,19 +393,21 @@ Reference BackendImpl::bindPackage_( { if (type.EqualsIgnoreCaseAscii("application")) { - ::ucbhelper::Content ucbContent( url, xCmdEnv ); + ::ucbhelper::Content ucbContent; + OUString name; + //In case a XPackage is created for a removed extension, we cannot + //obtain the name + if (create_ucb_content(&ucbContent, url, xCmdEnv, false )) + name = ucbContent.getPropertyValue( + StrTitle::get() ).get(); if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.package-bundle")) { return new PackageImpl( - this, url, ucbContent.getPropertyValue( - StrTitle::get() ).get(), - m_xBundleTypeInfo, false ); + this, url, name, m_xBundleTypeInfo, false, bNoFileAccess); } else if (subType.EqualsIgnoreCaseAscii( "vnd.sun.star.legacy-package-bundle")) { return new PackageImpl( - this, url, ucbContent.getPropertyValue( - StrTitle::get() ).get(), - m_xLegacyBundleTypeInfo, true ); + this, url, name, m_xLegacyBundleTypeInfo, true, bNoFileAccess); } } } @@ -403,8 +417,48 @@ Reference BackendImpl::bindPackage_( static_cast(-1) ); } +void BackendImpl::addDataToDb( + OUString const & url, ExtensionBackendDb::Data const & data) +{ + if (m_backendDb.get()) + m_backendDb->addEntry(url, data); +} + +ExtensionBackendDb::Data BackendImpl::readDataFromDb( + OUString const & url) +{ + ExtensionBackendDb::Data data; + if (m_backendDb.get()) + data = m_backendDb->getEntry(url); + return data; +} + +void BackendImpl::deleteDataFromDb(OUString const & url) +{ + if (m_backendDb.get()) + m_backendDb->removeEntry(url); +} + + //############################################################################## +BackendImpl::PackageImpl::PackageImpl( + ::rtl::Reference const & myBackend, + OUString const & url, + OUString const & name, + Reference const & xPackageType, + bool legacyBundle, + bool useDb) + : Package( myBackend, url, name, name /* display-name */, + xPackageType, useDb ), + m_url_expanded( expandUnoRcUrl( url ) ), + m_legacyBundle( legacyBundle ), + m_pBundle( 0 ) +{ + if (useDb) + m_data = getMyBackend()->readDataFromDb(url); +} + BackendImpl * BackendImpl::PackageImpl::getMyBackend() const { BackendImpl * pBackend = static_cast(m_myBackend.get()); @@ -510,23 +564,7 @@ OUString BackendImpl::PackageImpl::getTextFromURL( DescriptionInfoset BackendImpl::PackageImpl::getDescriptionInfoset() { - css::uno::Reference< css::xml::dom::XNode > root; - try { - root = - ExtensionDescription( - getMyBackend()->getComponentContext(), m_url_expanded, - css::uno::Reference< css::ucb::XCommandEnvironment >()). - getRootElement(); - } catch (NoDescriptionException &) { - } catch (css::deployment::DeploymentException & e) { - throw RuntimeException( - (OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.deployment.DeploymentException: ")) + - e.Message), - static_cast< OWeakObject * >(this)); - } - return DescriptionInfoset(getMyBackend()->getComponentContext(), root); + return dp_misc::getDescriptionInfoset(m_url_expanded); } bool BackendImpl::PackageImpl::checkPlatform( @@ -561,14 +599,11 @@ bool BackendImpl::PackageImpl::checkPlatform( bool BackendImpl::PackageImpl::checkDependencies( css::uno::Reference< css::ucb::XCommandEnvironment > const & environment, - ExtensionDescription const & description) + DescriptionInfoset const & description) { css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > - unsatisfied( - dp_misc::Dependencies::check( - DescriptionInfoset( - getMyBackend()->getComponentContext(), - description.getRootElement()))); + unsatisfied(dp_misc::Dependencies::check(description)); + if (unsatisfied.getLength() == 0) { return true; } else { @@ -590,7 +625,7 @@ bool BackendImpl::PackageImpl::checkDependencies( ::sal_Bool BackendImpl::PackageImpl::checkLicense( css::uno::Reference< css::ucb::XCommandEnvironment > const & xCmdEnv, - ExtensionDescription const & desc, bool bInstalled, OUString const & aContextName) + DescriptionInfoset const & info, bool bInstalled, OUString const & aContextName) throw (css::deployment::DeploymentException, css::ucb::CommandFailedException, css::ucb::CommandAbortedException, @@ -598,7 +633,6 @@ bool BackendImpl::PackageImpl::checkDependencies( { try { - DescriptionInfoset info = getDescriptionInfoset(); ::boost::optional simplLicAttr = info.getSimpleLicenseAttributes(); if (! simplLicAttr) @@ -610,7 +644,7 @@ bool BackendImpl::PackageImpl::checkDependencies( if (sLic.getLength() == 0) throw css::deployment::DeploymentException( OUSTR("Could not obtain path to license. Possible error in description.xml"), 0, Any()); - OUString sHref = desc.getExtensionRootUrl() + OUSTR("/") + sLic; + OUString sHref = m_url_expanded + OUSTR("/") + sLic; OUString sLicense = getTextFromURL(xCmdEnv, sHref); ////determine who has to agree to the license //check correct value for attribute @@ -693,19 +727,13 @@ bool BackendImpl::PackageImpl::checkDependencies( css::ucb::CommandAbortedException, css::uno::RuntimeException) { - std::auto_ptr spDescription; - try { - spDescription.reset( - new ExtensionDescription( - getMyBackend()->getComponentContext(), - m_url_expanded, - xCmdEnv)); - } catch (NoDescriptionException& ) { + DescriptionInfoset info = getDescriptionInfoset(); + if (!info.hasDescription()) return sal_True; - } + return checkPlatform(xCmdEnv) - && checkDependencies(xCmdEnv, *spDescription) - && checkLicense(xCmdEnv, *spDescription, bInstalled, aContextName); + && checkDependencies(xCmdEnv, info) + && checkLicense(xCmdEnv, info, bInstalled, aContextName); } ::sal_Bool BackendImpl::PackageImpl::checkDependencies( @@ -714,23 +742,25 @@ bool BackendImpl::PackageImpl::checkDependencies( css::ucb::CommandFailedException, css::uno::RuntimeException) { - std::auto_ptr spDescription; - try { - spDescription.reset( - new ExtensionDescription( getMyBackend()->getComponentContext(), m_url_expanded, xCmdEnv )); - } catch (NoDescriptionException& ) { + DescriptionInfoset info = getDescriptionInfoset(); + if (!info.hasDescription()) return sal_True; - } - return checkDependencies(xCmdEnv, *spDescription); + + return checkDependencies(xCmdEnv, info); } beans::Optional BackendImpl::PackageImpl::getIdentifier() throw (RuntimeException) { + OUString identifier; + if (m_bUseDb) + identifier = m_data.identifier; + else + identifier = dp_misc::generateIdentifier( + getDescriptionInfoset().getIdentifier(), m_name); + return beans::Optional( - true, - dp_misc::generateIdentifier( - getDescriptionInfoset().getIdentifier(), m_name)); + true, identifier); } OUString BackendImpl::PackageImpl::getVersion() throw (RuntimeException) @@ -793,6 +823,7 @@ void BackendImpl::PackageImpl::processPackage_( if (doRegisterPackage) { + ExtensionBackendDb::Data data; const sal_Int32 len = bundle.getLength(); for ( sal_Int32 pos = 0; pos < len; ++pos ) { @@ -870,7 +901,12 @@ void BackendImpl::PackageImpl::processPackage_( ::cppu::throwException(exc); } } + data.items.push_back( + ::std::make_pair(xPackage->getURL(), + xPackage->getPackageType()->getMediaType())); } + data.identifier = getIdentifier().Value; + getMyBackend()->addDataToDb(getURL(), data); } else { @@ -914,6 +950,7 @@ void BackendImpl::PackageImpl::processPackage_( // selected } } + getMyBackend()->deleteDataFromDb(getURL()); } } @@ -1139,58 +1176,66 @@ Sequence< Reference > BackendImpl::PackageImpl::getBundle( if (pBundle == 0) { t_packagevec bundle; - try { - if (m_legacyBundle) - { - // .zip legacy packages allow script.xlb, dialog.xlb in bundle - // root folder: - OUString mediaType; - // probe for script.xlb: - if (create_ucb_content( - 0, makeURL( m_url_expanded, OUSTR("script.xlb") ), - xCmdEnv, false /* no throw */ )) { - mediaType = OUSTR("application/vnd.sun.star.basic-library"); + if (m_bUseDb) + { + bundle = getPackagesFromDb(); + } + else + { + try { + if (m_legacyBundle) + { + // .zip legacy packages allow script.xlb, dialog.xlb in bundle + // root folder: + OUString mediaType; + // probe for script.xlb: + if (create_ucb_content( + 0, makeURL( m_url_expanded, OUSTR("script.xlb") ), + xCmdEnv, false /* no throw */ )) { + mediaType = OUSTR("application/vnd.sun.star.basic-library"); + } + // probe for dialog.xlb: + else if (create_ucb_content( + 0, makeURL( m_url_expanded, OUSTR("dialog.xlb") ), + xCmdEnv, false /* no throw */ )) + mediaType = OUSTR("application/vnd.sun.star." + "dialog-library"); + + if (mediaType.getLength() > 0) { + const Reference xPackage( + bindBundleItem( getURL(), mediaType, xCmdEnv ) ); + if (xPackage.is()) + bundle.push_back( xPackage ); + // continue scanning: + } + scanLegacyBundle( bundle, getURL(), + AbortChannel::get(xAbortChannel), xCmdEnv ); } - // probe for dialog.xlb: - else if (create_ucb_content( - 0, makeURL( m_url_expanded, OUSTR("dialog.xlb") ), - xCmdEnv, false /* no throw */ )) - mediaType = OUSTR("application/vnd.sun.star." - "dialog-library"); - - if (mediaType.getLength() > 0) { - const Reference xPackage( - bindBundleItem( getURL(), mediaType, xCmdEnv ) ); - if (xPackage.is()) - bundle.push_back( xPackage ); - // continue scanning: + else + { + // .oxt: + scanBundle( bundle, AbortChannel::get(xAbortChannel), xCmdEnv ); } - scanLegacyBundle( bundle, getURL(), - AbortChannel::get(xAbortChannel), xCmdEnv ); + } - else - { - // .oxt: - scanBundle( bundle, AbortChannel::get(xAbortChannel), xCmdEnv ); + catch (RuntimeException &) { + throw; + } + catch (CommandFailedException &) { + throw; + } + catch (CommandAbortedException &) { + throw; + } + catch (deployment::DeploymentException &) { + throw; + } + catch (Exception &) { + Any exc( ::cppu::getCaughtException() ); + throw deployment::DeploymentException( + OUSTR("error scanning bundle: ") + getURL(), + static_cast(this), exc ); } - } - catch (RuntimeException &) { - throw; - } - catch (CommandFailedException &) { - throw; - } - catch (CommandAbortedException &) { - throw; - } - catch (deployment::DeploymentException &) { - throw; - } - catch (Exception &) { - Any exc( ::cppu::getCaughtException() ); - throw deployment::DeploymentException( - OUSTR("error scanning bundle: ") + getURL(), - static_cast(this), exc ); } // sort: schema before config data, typelibs before components: @@ -1267,7 +1312,7 @@ Reference BackendImpl::PackageImpl::bindBundleItem( ReferencexPackage; try { xPackage.set( getMyBackend()->m_xRootRegistry->bindPackage( - url, mediaType, xCmdEnv ) ); + url, mediaType, false, xCmdEnv ) ); OSL_ASSERT( xPackage.is() ); } catch (RuntimeException &) { @@ -1523,6 +1568,13 @@ OUString BackendImpl::PackageImpl::getDisplayName() throw (RuntimeException) return sName; } +::std::vector > BackendImpl::PackageImpl::getPackagesFromDb() +{ + //get the data base entry for this extension + + return ::std::vector >(); +} + } // anon namespace //============================================================================== diff --git a/desktop/source/deployment/registry/package/makefile.mk b/desktop/source/deployment/registry/package/makefile.mk index ccadc2070301..203ce176d289 100644 --- a/desktop/source/deployment/registry/package/makefile.mk +++ b/desktop/source/deployment/registry/package/makefile.mk @@ -41,7 +41,7 @@ INCPRE += ..$/..$/inc SLOFILES = \ $(SLO)$/dp_package.obj \ - $(SLO)$/dp_description.obj + $(SLO)$/dp_extbackenddb.obj .INCLUDE : ..$/..$/target.pmk .INCLUDE : target.mk diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index 4af0cbb84130..6d503d33d51d 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -88,13 +88,15 @@ class BackendImpl : public t_helper ::rtl::Reference const & myBackend, OUString const & url, Reference const &xCmdEnv, - OUString const & scriptURL, OUString const & dialogURL ); + OUString const & scriptURL, OUString const & dialogURL, + bool bUseDb); }; friend class PackageImpl; // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, + sal_Bool bNoFileAccess, Reference const & xCmdEnv ); rtl::OUString getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage ); @@ -123,11 +125,11 @@ BackendImpl::PackageImpl::PackageImpl( ::rtl::Reference const & myBackend, OUString const & url, Reference const &xCmdEnv, - OUString const & scriptURL, OUString const & dialogURL ) + OUString const & scriptURL, OUString const & dialogURL, bool bUseDb ) : Package( myBackend.get(), url, OUString(), OUString(), // will be late-initialized scriptURL.getLength() > 0 ? myBackend->m_xBasicLibTypeInfo - : myBackend->m_xDialogLibTypeInfo ), + : myBackend->m_xDialogLibTypeInfo, bUseDb), m_scriptURL( scriptURL ), m_dialogURL( dialogURL ) { @@ -189,6 +191,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) //______________________________________________________________________________ Reference BackendImpl::bindPackage_( OUString const & url, OUString const & mediaType_, + sal_Bool bNoFileAccess, Reference const & xCmdEnv ) { OUString mediaType( mediaType_ ); @@ -231,13 +234,15 @@ Reference BackendImpl::bindPackage_( } return new PackageImpl( this, url, xCmdEnv, makeURL( url, OUSTR("script.xlb") ), - dialogURL ); + dialogURL, bNoFileAccess); } else if (subType.EqualsIgnoreCaseAscii( "vnd.sun.star.dialog-library")) { - return new PackageImpl( this, url, xCmdEnv, - OUString() /* no script lib */, - makeURL( url, OUSTR("dialog.xlb") ) ); + return new PackageImpl( + this, url, xCmdEnv, + OUString() /* no script lib */, + makeURL( url, OUSTR("dialog.xlb") ), + bNoFileAccess); } } } diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx index 52ced6908bd8..47b6430f1a1e 100644 --- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx +++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx @@ -81,8 +81,9 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference const & xCmdEnv ); public: - PackageImpl( ::rtl::Reference const & myBackend, - OUString const & url, OUString const & libType ); + PackageImpl( + ::rtl::Reference const & myBackend, + OUString const & url, OUString const & libType, bool bUseDb); // XPackage virtual OUString SAL_CALL getDescription() throw (RuntimeException); }; @@ -91,6 +92,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, + sal_Bool bNoFileAccess, Reference const & xCmdEnv ); const Reference m_xTypeInfo; @@ -131,9 +133,9 @@ OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException) //______________________________________________________________________________ BackendImpl::PackageImpl::PackageImpl( ::rtl::Reference const & myBackend, - OUString const & url, OUString const & libType ) + OUString const & url, OUString const & libType, bool bUseDb) : Package( myBackend.get(), url, OUString(), OUString(), - myBackend->m_xTypeInfo ), + myBackend->m_xTypeInfo, bUseDb ), m_descr(libType) { initPackageHandler(); @@ -217,7 +219,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) // PackageRegistryBackend //______________________________________________________________________________ Reference BackendImpl::bindPackage_( - OUString const & url, OUString const & mediaType_, + OUString const & url, OUString const & mediaType_, sal_Bool bNoFileAccess, Reference const & xCmdEnv ) { OUString mediaType( mediaType_ ); @@ -294,7 +296,7 @@ Reference BackendImpl::bindPackage_( dp_misc::TRACE(OUSTR(" BackEnd detected lang = ") + lang + OUSTR("\n")); dp_misc::TRACE(OUSTR(" for url ") + sParcelDescURL + OUSTR("\n") ); dp_misc::TRACE("******************************\n"); - return new PackageImpl( this, url, sfwkLibType ); + return new PackageImpl( this, url, sfwkLibType, bNoFileAccess); } } } @@ -322,6 +324,10 @@ void BackendImpl::PackageImpl:: initPackageHandler() { aContext <<= OUSTR("share"); } + else if ( that->m_eContext == CONTEXT_BUNDLED ) + { + aContext <<= OUSTR("bundled"); + } else { OSL_ASSERT( 0 ); diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 2acd4f79a781..807260fe4663 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -41,7 +41,8 @@ #include "cppuhelper/implbase1.hxx" #include "cppuhelper/exc_hlp.hxx" #include "comphelper/anytostring.hxx" -#include "com/sun/star/deployment/thePackageManagerFactory.hpp" +#include "com/sun/star/deployment/ExtensionManager.hpp" + #include "com/sun/star/deployment/ui/PackageManagerDialog.hpp" #include "com/sun/star/ui/dialogs/XExecutableDialog.hpp" #include "com/sun/star/lang/DisposedException.hpp" @@ -149,12 +150,13 @@ void DialogClosedListenerImpl::dialogClosed( // installed with OOo 2.2 or later could not normally be found via its file // name. Reference findPackage( - Reference const & manager, + OUString const & repository, + Reference const & manager, Reference const & environment, OUString const & idOrFileName ) { Sequence< Reference > ps( - manager->getDeployedPackages( + manager->getDeployedExtensions(repository, Reference(), environment ) ); for ( sal_Int32 i = 0; i < ps.getLength(); ++i ) if ( dp_misc::getIdentifier( ps[i] ) == idOrFileName ) @@ -214,7 +216,7 @@ extern "C" int unopkg_main() bool subcmd_add = false; bool subcmd_gui = false; OUString logFile; - OUString deploymentContext; + OUString repository; OUString cmdArg; ::std::vector cmdPackages; @@ -279,7 +281,7 @@ extern "C" int unopkg_main() !readOption( &option_force, info_force, &nPos ) && !readOption( &option_bundled, info_bundled, &nPos ) && !readOption( &option_suppressLicense, info_suppressLicense, &nPos ) && - !readArgument( &deploymentContext, info_context, &nPos ) && + !readArgument( &repository, info_context, &nPos ) && !isBootstrapVariable(&nPos)) { osl_getCommandArg( nPos, &cmdArg.pData ); @@ -313,24 +315,30 @@ extern "C" int unopkg_main() } //make sure the bundled option was provided together with shared - if (option_bundled && !option_shared) - { - dp_misc::writeConsoleError( - "\nERROR: option --bundled can only be used together with --shared!"); - return 1; - } +// if (option_bundled && !option_shared) +// { +// dp_misc::writeConsoleError( +// "\nERROR: option --bundled can only be used together with --shared!"); +// return 1; +// } xComponentContext = getUNO( disposeGuard, option_verbose, option_shared, subcmd_gui, xLocalComponentContext ); - if (deploymentContext.getLength() == 0) { - deploymentContext = option_shared ? OUSTR("shared") : OUSTR("user"); + if (repository.getLength() == 0) + { + if (option_shared) + repository = OUSTR("shared"); + else if (option_bundled) + repository = OUSTR("bundled"); + else + repository = OUSTR("user"); } else { - if (deploymentContext.equalsAsciiL( + if (repository.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("shared") )) { option_shared = true; } @@ -343,10 +351,9 @@ extern "C" int unopkg_main() } } - Reference xPackageManagerFactory( - deployment::thePackageManagerFactory::get( xComponentContext ) ); - Reference xPackageManager( - xPackageManagerFactory->getPackageManager( deploymentContext ) ); + + Reference xExtensionManager( + deployment::ExtensionManager::get( xComponentContext ) ); Reference< ::com::sun::star::ucb::XCommandEnvironment > xCmdEnv( createCmdEnv( xComponentContext, logFile, @@ -362,25 +369,23 @@ extern "C" int unopkg_main() OUString const & cmdPackage = cmdPackages[ pos ]; if (subcmd_add) { - Reference xPackage( - xPackageManager->addPackage( - cmdPackage, OUString() /* to be detected */, - Reference(), xCmdEnv ) ); - OSL_ASSERT( xPackage.is() ); + xExtensionManager->addExtension( + cmdPackage, repository, + Reference(), xCmdEnv); } else { try { - xPackageManager->removePackage( - cmdPackage, cmdPackage, + xExtensionManager->removeExtension( + cmdPackage, cmdPackage, repository, Reference(), xCmdEnv ); } catch (lang::IllegalArgumentException &) { Reference p( - findPackage( - xPackageManager, xCmdEnv, cmdPackage ) ); + findPackage(repository, + xExtensionManager, xCmdEnv, cmdPackage ) ); //Todo. temporary preventing exception in bundled case. //In case of a bundled extension, remove would be called as a result of //uninstalling a rpm. Then we do not want to show an error when the @@ -389,8 +394,9 @@ extern "C" int unopkg_main() if ( !p.is() && !option_bundled) throw; else if (p.is()) - xPackageManager->removePackage( + xExtensionManager->removeExtension( ::dp_misc::getIdentifier(p), p->getName(), + repository, Reference(), xCmdEnv ); } } @@ -399,18 +405,18 @@ extern "C" int unopkg_main() else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("reinstall") )) { - xPackageManager->reinstallDeployedPackages( - Reference(), xCmdEnv ); + xExtensionManager->reinstallDeployedExtensions( + repository, Reference(), xCmdEnv); } else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("list") )) { Sequence< Reference > packages; if (cmdPackages.empty()) { - packages = xPackageManager->getDeployedPackages( - Reference(), xCmdEnv ); + packages = xExtensionManager->getDeployedExtensions( + repository, Reference(), xCmdEnv ); dp_misc::writeConsole( - OUSTR("all deployed ") + deploymentContext + OUSTR(" packages:\n")); + OUSTR("all deployed ") + repository + OUSTR(" packages:\n")); } else { @@ -418,13 +424,13 @@ extern "C" int unopkg_main() for ( ::std::size_t pos = 0; pos < cmdPackages.size(); ++pos ) try { - packages[ pos ] = xPackageManager->getDeployedPackage( - cmdPackages[ pos ], cmdPackages[ pos ], xCmdEnv ); + packages[ pos ] = xExtensionManager->getDeployedExtension( + repository, cmdPackages[ pos ], cmdPackages[ pos ], xCmdEnv ); } catch (lang::IllegalArgumentException &) { - packages[ pos ] = findPackage( - xPackageManager, xCmdEnv, cmdPackages[ pos ] ); + packages[ pos ] = findPackage(repository, + xExtensionManager, xCmdEnv, cmdPackages[ pos ] ); if ( !packages[ pos ].is() ) throw; } diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index e4a503d98732..d23dcbf9577d 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -320,7 +320,7 @@ void CommandEnvironmentImpl::handle( deployment::VersionException nc_exc; if (request >>= nc_exc) { approve = m_option_force_overwrite || - (::dp_misc::comparePackageVersions(nc_exc.New, nc_exc.Deployed) + (::dp_misc::compareVersions(nc_exc.NewVersion, nc_exc.Deployed->getVersion()) == ::dp_misc::GREATER); abort = !approve; } -- cgit From d8411c3281b10eeea679e84697adfcd7c51b1657 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Fri, 19 Mar 2010 15:12:00 +0100 Subject: jl152 import 263439 from native0jl: #i77196# fix for XExtensionManager.getAllExtensions --- desktop/source/deployment/manager/dp_extensionmanager.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 469245bef340..1519e1f40596 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -936,7 +936,6 @@ uno::Sequence< uno::Sequence > > lang::IllegalArgumentException, uno::RuntimeException) { - uno::Sequence< uno::Sequence > > seqSeq; try { id2extensions mapExt; @@ -964,10 +963,13 @@ uno::Sequence< uno::Sequence > > ::std::vector< ::std::vector > >::const_iterator citVecVec = vecExtensions.begin(); sal_Int32 j = 0; + uno::Sequence< uno::Sequence > > seqSeq(vecExtensions.size()); for (;citVecVec != vecExtensions.end(); citVecVec++, j++) { seqSeq[j] = comphelper::containerToSequence(*citVecVec); } + return seqSeq; + } catch (deploy::DeploymentException& ) { throw; } catch (ucb::CommandFailedException & ) { @@ -983,9 +985,7 @@ uno::Sequence< uno::Sequence > > throw deploy::DeploymentException( OUSTR("Extension Manager: exception during enableExtension"), static_cast(this), exc); - } - - return seqSeq; + } } void ExtensionManager::reinstallDeployedExtensions( -- cgit From 67c12270ab84ac474cebe3ec4169688fa3120844 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Mon, 22 Mar 2010 12:35:33 +0100 Subject: jl152 import 263440 from native0jl: #i77196# removing of bundled/shared extension (except python, script) works now --- .../deployment/manager/dp_extensionmanager.cxx | 50 ++-- desktop/source/deployment/manager/dp_manager.cxx | 55 ++--- .../registry/component/dp_compbackenddb.cxx | 58 +++++ .../registry/component/dp_compbackenddb.hxx | 11 +- .../deployment/registry/component/dp_component.cxx | 132 +++++++---- .../registry/configuration/dp_configuration.cxx | 31 ++- desktop/source/deployment/registry/dp_backend.cxx | 149 ++++++++---- .../source/deployment/registry/dp_backenddb.cxx | 90 ++++++-- desktop/source/deployment/registry/dp_registry.cxx | 10 +- .../registry/executable/dp_executable.cxx | 25 +- .../source/deployment/registry/help/dp_help.cxx | 21 +- .../source/deployment/registry/inc/dp_backend.h | 68 ++++-- .../deployment/registry/inc/dp_backenddb.hxx | 6 + .../registry/package/dp_extbackenddb.cxx | 87 ++++--- .../registry/package/dp_extbackenddb.hxx | 11 +- .../deployment/registry/package/dp_package.cxx | 257 +++++++++++++-------- .../deployment/registry/script/dp_script.cxx | 15 +- .../source/deployment/registry/sfwk/dp_sfwk.cxx | 16 +- .../framework/container/UnoPkgContainer.java | 11 +- 19 files changed, 697 insertions(+), 406 deletions(-) diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 1519e1f40596..6e76cfb574bd 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -284,9 +284,6 @@ Reference ExtensionManager::getExtensionAndStatus( contain any items which need to be registered then the extension cannot actually be disabled (because it cannot be registered). In this case false is returned. If there is no user extension then also false is returned. - - A user extension is regarded as disabled if there is an extension in a - repository with a lower priority that is registered. */ bool ExtensionManager::isUserExtensionDisabled( OUString const & identifier, OUString const & fileName, @@ -295,36 +292,19 @@ bool ExtensionManager::isUserExtensionDisabled( { bool bDisabled = false; - ::std::list > listExtensions = - getExtensionsWithSameId(identifier, fileName); - ::std::list >::const_iterator - iext = listExtensions.begin(); - bool bCheckOptional = false; - Reference xActive; - for (; iext != listExtensions.end(); iext++) + Reference xExtension; + try + { //will throw an exception if the extension does not exist + xExtension = m_userRepository->getDeployedPackage( + identifier, fileName, Reference()); + } catch(lang::IllegalArgumentException &) { - if (iext->is()) - { - if (!(*iext)->isRegistered(xAbortChannel, xCmdEnv).IsPresent) - { - // IsPresent must be the same for all extnesions - OSL_ASSERT(!bCheckOptional); - break; - } - else - { - bCheckOptional = true; - if ((*iext)->isRegistered(xAbortChannel, xCmdEnv).Value.Value) - { - xActive = *iext; - break; - } - } - } - Reference const & xUser = listExtensions.front(); - if (xUser.is() - && xActive.is() - && xUser != xActive) + } + if (xExtension.is()) + { + beans::Optional > reg = + xExtension->isRegistered(xAbortChannel, xCmdEnv); + if (reg.IsPresent && ! reg.Value.Value) bDisabled = true; } return bDisabled; @@ -1105,13 +1085,13 @@ void ExtensionManager::synchronize( const OUString id = dp_misc::getIdentifier(xExtension); const OUString fileName = xExtension->getName(); - bool bUserDisabled = isUserExtensionDisabled( - id, xExtension->getName(), xAbortChannel, xCmdEnv); + bool bUserDisabled = isUserExtensionDisabled( + id, xExtension->getName(), xAbortChannel, xCmdEnv); xExtension->revokePackage(xAbortChannel, xCmdEnv); xPackageManager->removePackage( id, fileName, xAbortChannel, xCmdEnv); activateExtension( - id, fileName, bUserDisabled, xAbortChannel, xCmdEnv); + id, fileName, /*bUserDisabled*/ false, xAbortChannel, xCmdEnv); } catch (...) { diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 59e9f2049722..9b4f51ea89dd 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -567,7 +567,7 @@ OUString PackageManagerImpl::detectMediaType( try { Reference xPackage( m_xRegistry->bindPackage( - url, OUString(), false, ucbContent.getCommandEnvironment() ) ); + url, OUString(), false, OUString(), ucbContent.getCommandEnvironment() ) ); const Reference xPackageType( xPackage->getPackageType() ); OSL_ASSERT( xPackageType.is() ); @@ -785,7 +785,7 @@ Reference PackageManagerImpl::addPackage( //XPackage objects, even if the second extension is the same. //Therefore bindPackage does not need a guard here. xPackage = m_xRegistry->bindPackage( - makeURL( destFolder, title_enc ), mediaType, false, xCmdEnv ); + makeURL( destFolder, title_enc ), mediaType, false, OUString(), xCmdEnv ); OSL_ASSERT( xPackage.is() ); if (xPackage.is()) @@ -877,16 +877,6 @@ void PackageManagerImpl::removePackage( RuntimeException) { check(); - if (m_readOnly) - { - OUString message; - if (m_context == OUSTR("shared")) - message = OUSTR("You need write permissions in order to remove a shared extension!"); - else - message = OUSTR("You need write permissions in order to remove this extension!"); - throw deployment::DeploymentException( - message, static_cast(this), Any() ); - } Reference xCmdEnv; if (m_xLogFile.is()) @@ -900,7 +890,12 @@ void PackageManagerImpl::removePackage( const ::osl::MutexGuard guard(getMutex()); //Check if this extension exist and throw an IllegalArgumentException //if it does not + //If the files of the extension are already removed, or there is a + //different extension at the same place, for example after updating the + //extension, then the returned object is that which uses the database data. xPackage = getDeployedPackage_(id, fileName, xCmdEnv ); + + //Because the extension is only removed the next time the extension //manager runs after restarting OOo, we need to indicate that a //shared extension was "deleted". When a user starts OOo, then it @@ -908,7 +903,7 @@ void PackageManagerImpl::removePackage( //the flag file it will then recognize, that the extension was //deleted and can then update the extnesion database of the shared //extensions in the user installation. - if (m_context.equals(OUSTR("shared"))) + if (! m_readOnly && !xPackage->isRemoved() && m_context.equals(OUSTR("shared"))) { ActivePackages::Data val; m_activePackagesDB->get( & val, id, fileName); @@ -1010,8 +1005,17 @@ Reference PackageManagerImpl::getDeployedPackage_( static_cast(-1) ); } } - return m_xRegistry->bindPackage( - getDeployPath( data ), data.mediaType, false, xCmdEnv ); + Reference xExtension; + try + { + xExtension = m_xRegistry->bindPackage( + getDeployPath( data ), data.mediaType, false, OUString(), xCmdEnv ); + } + catch (deployment::InvalidRemovedParameterException& e) + { + xExtension = e.Extension; + } + return xExtension; } //______________________________________________________________________________ @@ -1149,17 +1153,6 @@ void PackageManagerImpl::reinstallDeployedPackages( lang::IllegalArgumentException, RuntimeException) { check(); - if (m_readOnly) - { - OUString message; - if (m_context == OUSTR("shared")) - message = OUSTR("You need write permissions in order to install shared extensions!"); - else - message = OUSTR("You need write permissions in order to install extensions!"); - throw deployment::DeploymentException( - message, static_cast(this), Any() ); - } - if (office_is_running()) throw RuntimeException( OUSTR("You must close any running Office process before " @@ -1303,8 +1296,10 @@ void PackageManagerImpl::synchronizeRemovedExtensions( OSL_ENSURE(infoset.hasDescription(), "Extension Manager: bundled and shared extensions " "must have an identifer and a version"); - if ( ! i->first.equals(*(infoset.getIdentifier())) - || ! i->second.version.equals(infoset.getVersion())) + if (infoset.hasDescription() && + infoset.getIdentifier() && + (! i->first.equals(*(infoset.getIdentifier())) + || ! i->second.version.equals(infoset.getVersion()))) { bRemoved = true; } @@ -1313,7 +1308,7 @@ void PackageManagerImpl::synchronizeRemovedExtensions( if (bRemoved) { Reference xPackage = m_xRegistry->bindPackage( - url, i->second.mediaType, true, xCmdEnv ); + url, i->second.mediaType, true, i->first, xCmdEnv ); OSL_ASSERT(xPackage.is()); //Even if the files are removed, we must get the object. removedExtensions.push_back(xPackage); } @@ -1382,7 +1377,7 @@ void PackageManagerImpl::synchronizeAddedExtensions( url = appendURLSegement(url, sExtFolder); } Reference xPackage = m_xRegistry->bindPackage( - url, OUString(), false, xCmdEnv ); + url, OUString(), false, OUString(), xCmdEnv ); if (xPackage.is()) { try diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.cxx b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx index edaf642a2ab1..a942b81a7e32 100644 --- a/desktop/source/deployment/registry/component/dp_compbackenddb.cxx +++ b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx @@ -92,6 +92,16 @@ void ComponentBackendDb::addEntry(::rtl::OUString const & url, Data const & data root->appendChild(componentNode); +// Reference name( +// doc->createElement(OUSTR("name")), UNO_QUERY_THROW); + +// componentNode->appendChild(name); + +// Reference nameValue( +// doc->createTextNode(data.name), +// UNO_QUERY_THROW); +// name->appendChild(nameValue); + Reference javaTypeLibNode( doc->createElement(OUSTR("java-type-library")), UNO_QUERY_THROW); @@ -134,6 +144,54 @@ void ComponentBackendDb::removeEntry(::rtl::OUString const & url) removeElement(sExpression); } +ComponentBackendDb::Data ComponentBackendDb::getEntry(::rtl::OUString const & url) +{ + try + { + ComponentBackendDb::Data retData; + const OUString sExpression( + OUSTR("reg:component[@url = \"") + url + OUSTR("\"]")); + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + + Reference xpathApi = getXPathAPI(); + //find the extension element that is to be removed + Reference aNode = + xpathApi->selectSingleNode(root, sExpression); + if (aNode.is()) + { +// const OUString sExprName(OUSTR("reg:name/text()")); + +// Reference nameValue = +// xpathApi->selectSingleNode(aNode, sExprName); +// retData.name = nameValue->getNodeValue(); + + const OUString sExprJavaTypeLib(OUSTR("reg:java-type-library/text()")); + + Reference idValueNode = + xpathApi->selectSingleNode(aNode, sExprJavaTypeLib); + retData.javaTypeLibrary = + idValueNode->getNodeValue().equals(OUSTR("true")) ? true : false; + + retData.implementationNames = + readList( + aNode, OUSTR("reg:implementation-names"), OUSTR("reg:name")); + + retData.singletons = + readVectorOfPair( + aNode, OUSTR("reg:singletons"), OUSTR("item"), OUSTR("key"), + OUSTR("value")); + } + return retData; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data entry in backend db: ") + + m_urlDb, 0, exc); + } +} } // namespace bundle diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.hxx b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx index 0dde24beed3f..29ac4e50fe88 100644 --- a/desktop/source/deployment/registry/component/dp_compbackenddb.hxx +++ b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx @@ -60,6 +60,7 @@ namespace component { + FileName true com.sun.star.comp.extensionoptions.OptionsEventHandler$_OptionsEventHandler @@ -80,6 +81,11 @@ namespace component { */ class ComponentBackendDb: public dp_registry::backend::BackendDb { +protected: + virtual ::rtl::OUString getDbNSName(); + + virtual ::rtl::OUString getRootElementName(); + public: struct Data { @@ -99,10 +105,7 @@ public: void addEntry(::rtl::OUString const & url, Data const & data); void removeEntry(::rtl::OUString const & url); - - virtual ::rtl::OUString getDbNSName(); - - virtual ::rtl::OUString getRootElementName(); + Data getEntry(::rtl::OUString const & url); }; diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index e4e5efff9e81..667f1588e247 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -123,6 +123,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend const OUString m_loader; Reference m_xRemoteContext; + ComponentBackendDb::Data m_registeredComponentsDb; enum reg { REG_UNINIT, REG_VOID, REG_REGISTERED, REG_NOT_REGISTERED, REG_MAYBE_REGISTERED @@ -152,16 +153,11 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend const Reference getRDB_RO() const; public: - inline ComponentPackageImpl( + ComponentPackageImpl( ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, - OUString const & loader, bool bUseDb ) - : Package( myBackend, url, name, name /* display-name */, - xPackageType, bUseDb ), - m_loader( loader ), - m_registered( REG_UNINIT ) - {} + OUString const & loader, bool bRemoved, OUString const & identifier); }; friend class ComponentPackageImpl; @@ -186,15 +182,11 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference const & xCmdEnv ); public: - inline TypelibraryPackageImpl( + TypelibraryPackageImpl( ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, - bool jarFile, bool bUseDb ) - : Package( myBackend, url, name, name /* display-name */, - xPackageType, bUseDb), - m_jarFile( jarFile ) - {} + bool jarFile, bool bRemoved, OUString const & identifier); }; friend class TypelibraryPackageImpl; @@ -215,7 +207,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, - sal_Bool bNoFileAccess, + sal_Bool bNoFileAccess, OUString const & identifier, Reference const & xCmdEnv ); virtual void SAL_CALL disposing(); @@ -238,6 +230,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend void addDataToDb(OUString const & url, ComponentBackendDb::Data const & data); void deleteDataFromDb(OUString const & url); + ComponentBackendDb::Data readDataFromDb(OUString const & url); //These rdbs are for writing new service entries. The rdb files are copies @@ -285,6 +278,24 @@ public: }; //______________________________________________________________________________ + +BackendImpl::ComponentPackageImpl::ComponentPackageImpl( + ::rtl::Reference const & myBackend, + OUString const & url, OUString const & name, + Reference const & xPackageType, + OUString const & loader, bool bRemoved, OUString const & identifier) + : Package( myBackend, url, name, name /* display-name */, + xPackageType, bRemoved, identifier), + m_loader( loader ), + m_registered( REG_UNINIT ) +{ + if (bRemoved) + { + m_registeredComponentsDb = getMyBackend()->readDataFromDb(url); + } +} + + const Reference BackendImpl::ComponentPackageImpl::getRDB() const { @@ -593,6 +604,14 @@ void BackendImpl::deleteDataFromDb(OUString const & url) m_backendDb->removeEntry(url); } +ComponentBackendDb::Data BackendImpl::readDataFromDb(OUString const & url) +{ + ComponentBackendDb::Data data; + if (m_backendDb.get()) + data = m_backendDb->getEntry(url); + return data; +} + // XPackageRegistry //______________________________________________________________________________ Sequence< Reference > @@ -605,7 +624,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) //______________________________________________________________________________ Reference BackendImpl::bindPackage_( OUString const & url, OUString const & mediaType_, - sal_Bool bNoFileAccess, + sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ) { OUString mediaType(mediaType_); @@ -661,9 +680,14 @@ Reference BackendImpl::bindPackage_( { if (type.EqualsIgnoreCaseAscii("application")) { - ::ucbhelper::Content ucbContent( url, xCmdEnv ); - const OUString name( ucbContent.getPropertyValue( - StrTitle::get() ).get() ); + OUString name; + if (!bRemoved) + { + ::ucbhelper::Content ucbContent( url, xCmdEnv ); + name = ucbContent.getPropertyValue( + StrTitle::get() ).get(); + } + if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.uno-component")) { // xxx todo: probe and evaluate component xml description @@ -679,19 +703,19 @@ Reference BackendImpl::bindPackage_( return new BackendImpl::ComponentPackageImpl( this, url, name, m_xDynComponentTypeInfo, OUSTR("com.sun.star.loader.SharedLibrary"), - bNoFileAccess ); + bRemoved, identifier); } if (value.EqualsIgnoreCaseAscii("Java")) { return new BackendImpl::ComponentPackageImpl( this, url, name, m_xJavaComponentTypeInfo, OUSTR("com.sun.star.loader.Java2"), - bNoFileAccess ); + bRemoved, identifier); } if (value.EqualsIgnoreCaseAscii("Python")) { return new BackendImpl::ComponentPackageImpl( this, url, name, m_xPythonComponentTypeInfo, OUSTR("com.sun.star.loader.Python"), - bNoFileAccess); + bRemoved, identifier); } } } @@ -707,12 +731,12 @@ Reference BackendImpl::bindPackage_( { return new BackendImpl::TypelibraryPackageImpl( this, url, name, m_xRDBTypelibTypeInfo, - false /* rdb */, bNoFileAccess); + false /* rdb */, bRemoved, identifier); } if (value.EqualsIgnoreCaseAscii("Java")) { return new BackendImpl::TypelibraryPackageImpl( this, url, name, m_xJavaTypelibTypeInfo, - true /* jar */, bNoFileAccess); + true /* jar */, bRemoved, identifier); } } } @@ -749,16 +773,13 @@ void BackendImpl::unorc_verify_init( sal_Int32 index = sizeof ("UNO_JAVA_CLASSPATH=") - 1; do { OUString token( line.getToken( 0, ' ', index ).trim() ); - if (token.getLength() > 0) { - // cleanup, check if existing: - if (create_ucb_content( - 0, expandUnoRcTerm(token), xCmdEnv, - false /* no throw */ )) { - m_jar_typelibs.push_back( token ); - } - else - OSL_ENSURE( - 0, "### invalid UNO_JAVA_CLASSPATH entry!" ); + if (token.getLength() > 0) + { + //The jar file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the unorc + //After running XExtensionManager::synchronize, the unorc is + //cleaned up + m_jar_typelibs.push_back( token ); } } while (index >= 0); @@ -768,17 +789,15 @@ void BackendImpl::unorc_verify_init( sal_Int32 index = sizeof ("UNO_TYPES=") - 1; do { OUString token( line.getToken( 0, ' ', index ).trim() ); - if (token.getLength() > 0) { + if (token.getLength() > 0) + { if (token[ 0 ] == '?') token = token.copy( 1 ); - // cleanup, check if existing: - if (create_ucb_content( - 0, expandUnoRcTerm(token), - xCmdEnv, false /* no throw */ )) { - m_rdb_typelibs.push_back( token ); - } - else - OSL_ENSURE( 0, "### invalid UNO_TYPES entry!" ); + //The RDB file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the unorc. + //After running XExtensionManager::synchronize, the unorc is + //cleaned up + m_rdb_typelibs.push_back( token ); } } while (index >= 0); @@ -1211,8 +1230,12 @@ void BackendImpl::ComponentPackageImpl::processPackage_( const bool java = m_loader.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.loader.Java2") ); const OUString url( getURL() ); - bool isJavaTypelib = java && - !jarManifestHeaderPresent( url, OUSTR("UNO-Type-Path"), xCmdEnv ); + bool isJavaTypelib; + if (m_bRemoved) + isJavaTypelib = m_registeredComponentsDb.javaTypeLibrary; + else + isJavaTypelib = java && + !jarManifestHeaderPresent( url, OUSTR("UNO-Type-Path"), xCmdEnv ); ComponentBackendDb::Data data; data.javaTypeLibrary = isJavaTypelib; @@ -1330,8 +1353,15 @@ void BackendImpl::ComponentPackageImpl::processPackage_( t_stringlist implNames; t_stringpairvec singletons; - getComponentInfo( &implNames, &singletons, xContext ); - + if (m_bRemoved) + { + implNames = m_registeredComponentsDb.implementationNames; + singletons = m_registeredComponentsDb.singletons; + } + else + { + getComponentInfo( &implNames, &singletons, xContext ); + } // factories live removal: const Reference xSet( that->getComponentContext()->getServiceManager(), UNO_QUERY_THROW ); @@ -1405,6 +1435,16 @@ void BackendImpl::ComponentPackageImpl::processPackage_( } //############################################################################## +BackendImpl::TypelibraryPackageImpl::TypelibraryPackageImpl( + ::rtl::Reference const & myBackend, + OUString const & url, OUString const & name, + Reference const & xPackageType, + bool jarFile, bool bRemoved, OUString const & identifier) + : Package( myBackend, url, name, name /* display-name */, + xPackageType, bRemoved, identifier), + m_jarFile( jarFile ) +{ +} // Package BackendImpl * BackendImpl::TypelibraryPackageImpl::getMyBackend() const diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 7118e6d1b2d5..354676fd56ff 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -94,9 +94,9 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, - bool isSchema, bool bUseDb) + bool isSchema, bool bRemoved, OUString const & identifier) : Package( myBackend, url, name, name /* display-name */, - xPackageType, bUseDb), + xPackageType, bRemoved, identifier), m_isSchema( isSchema ) {} }; @@ -113,8 +113,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( - OUString const & url, OUString const & mediaType, sal_Bool bNoFileAccess, - Reference const & xCmdEnv ); + OUString const & url, OUString const & mediaType, sal_Bool bRemoved, + OUString const & identifier, Reference const & xCmdEnv ); ::std::auto_ptr m_registeredPackages; // for backwards compatibility @@ -215,7 +215,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) //______________________________________________________________________________ Reference BackendImpl::bindPackage_( OUString const & url, OUString const & mediaType_, - sal_Bool bNoFileAccess, + sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ) { OUString mediaType( mediaType_ ); @@ -250,20 +250,27 @@ Reference BackendImpl::bindPackage_( { if (type.EqualsIgnoreCaseAscii("application")) { + OUString name; + if (!bRemoved) + { + ::ucbhelper::Content ucbContent( url, xCmdEnv ); + name = ucbContent.getPropertyValue( + StrTitle::get() ).get(); + } + ::ucbhelper::Content ucbContent( url, xCmdEnv ); if (subType.EqualsIgnoreCaseAscii( - "vnd.sun.star.configuration-data")) { + "vnd.sun.star.configuration-data")) + { return new PackageImpl( - this, url, ucbContent.getPropertyValue( - StrTitle::get() ).get(), - m_xConfDataTypeInfo, false /* data file */, bNoFileAccess); + this, url, name, m_xConfDataTypeInfo, false /* data file */, + bRemoved, identifier); } else if (subType.EqualsIgnoreCaseAscii( "vnd.sun.star.configuration-schema")) { return new PackageImpl( - this, url, ucbContent.getPropertyValue( - StrTitle::get() ).get(), - m_xConfSchemaTypeInfo, true /* schema file */, bNoFileAccess); + this, url, name, m_xConfSchemaTypeInfo, true /* schema file */, + bRemoved, identifier); } } } diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 31bb30de7315..7ee49fc46734 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -36,6 +36,7 @@ #include "comphelper/unwrapargs.hxx" #include "ucbhelper/content.hxx" #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" +#include "com/sun/star/deployment/InvalidRemovedParameterException.hpp" #include "com/sun/star/beans/StringPair.hpp" @@ -131,29 +132,40 @@ void PackageRegistryBackend::disposing() // XPackageRegistry //______________________________________________________________________________ Reference PackageRegistryBackend::bindPackage( - OUString const & url, OUString const & mediaType, sal_Bool bNoFileAccess , - Reference const & xCmdEnv ) - throw (deployment::DeploymentException, CommandFailedException, + OUString const & url, OUString const & mediaType, sal_Bool bRemoved, + OUString const & identifier, Reference const & xCmdEnv ) + throw (deployment::DeploymentException, + deployment::InvalidRemovedParameterException, + ucb::CommandFailedException, lang::IllegalArgumentException, RuntimeException) { ::osl::ResettableMutexGuard guard( getMutex() ); check(); - if (!bNoFileAccess) + + t_string2ref::const_iterator const iFind( m_bound.find( url ) ); + if (iFind != m_bound.end()) { - //We only save those object which were created with bNoFileAccess = false - t_string2ref::const_iterator const iFind( m_bound.find( url ) ); - if (iFind != m_bound.end()) + Reference xPackage( iFind->second ); + if (xPackage.is()) { - Reference xPackage( iFind->second ); - if (xPackage.is()) - return xPackage; + if (mediaType.getLength() && + mediaType != xPackage->getPackageType()->getMediaType()) + throw lang::IllegalArgumentException + (OUSTR("XPackageRegistry::bindPackage: media type does not match"), + static_cast(this), 1); + if (xPackage->isRemoved() != bRemoved) + throw deployment::InvalidRemovedParameterException( + OUSTR("XPackageRegistry::bindPackage: bRemoved parameter does not match"), + static_cast(this), xPackage->isRemoved(), xPackage); + return xPackage; } } + guard.clear(); Reference xNewPackage; try { - xNewPackage = bindPackage_( url, mediaType, bNoFileAccess, xCmdEnv ); + xNewPackage = bindPackage_( url, mediaType, bRemoved, identifier, xCmdEnv ); } catch (RuntimeException &) { throw; @@ -175,24 +187,22 @@ Reference PackageRegistryBackend::bindPackage( } guard.reset(); - if (!bNoFileAccess) - { - //We only save those object which were created with bNoFileAccess = false - ::std::pair< t_string2ref::iterator, bool > insertion( - m_bound.insert( t_string2ref::value_type( url, xNewPackage ) ) ); - if (insertion.second) - { // first insertion - OSL_ASSERT( Reference(insertion.first->second) - == xNewPackage ); - } - else - { // found existing entry - Reference xPackage( insertion.first->second ); - if (xPackage.is()) - return xPackage; - insertion.first->second = xNewPackage; - } + + ::std::pair< t_string2ref::iterator, bool > insertion( + m_bound.insert( t_string2ref::value_type( url, xNewPackage ) ) ); + if (insertion.second) + { // first insertion + OSL_ASSERT( Reference(insertion.first->second) + == xNewPackage ); } + else + { // found existing entry + Reference xPackage( insertion.first->second ); + if (xPackage.is()) + return xPackage; + insertion.first->second = xNewPackage; + } + guard.clear(); xNewPackage->addEventListener( this ); // listen for disposing events return xNewPackage; @@ -211,14 +221,16 @@ Package::Package( ::rtl::Reference const & myBackend, OUString const & name, OUString const & displayName, Reference const & xPackageType, - bool bUseDb) + bool bRemoved, + OUString const & identifier) : t_PackageBase( getMutex() ), m_myBackend( myBackend ), m_url( url ), m_name( name ), m_displayName( displayName ), m_xPackageType( xPackageType ), - m_bUseDb(bUseDb) + m_bRemoved(bRemoved), + m_identifier(identifier) { } @@ -314,10 +326,13 @@ sal_Bool Package::isBundle() throw (RuntimeException) const css::uno::Reference< css::ucb::XCommandEnvironment >&, sal_Bool, ::rtl::OUString const &) throw (css::deployment::DeploymentException, - css::ucb::CommandFailedException, - css::ucb::CommandAbortedException, - css::uno::RuntimeException) + css::deployment::ExtensionRemovedException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::uno::RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); return true; } @@ -325,9 +340,12 @@ sal_Bool Package::isBundle() throw (RuntimeException) ::sal_Bool Package::checkDependencies( const css::uno::Reference< css::ucb::XCommandEnvironment >& ) throw (css::deployment::DeploymentException, - css::ucb::CommandFailedException, - css::uno::RuntimeException) + css::deployment::ExtensionRemovedException, + css::ucb::CommandFailedException, + css::uno::RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); return true; } @@ -351,12 +369,19 @@ OUString Package::getName() throw (RuntimeException) beans::Optional Package::getIdentifier() throw (RuntimeException) { + if (m_bRemoved) + return beans::Optional(true, m_identifier); + return beans::Optional(); } //______________________________________________________________________________ -OUString Package::getVersion() throw (RuntimeException) +OUString Package::getVersion() throw ( + deployment::ExtensionRemovedException, + RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); return OUString(); } @@ -367,33 +392,49 @@ OUString Package::getURL() throw (RuntimeException) } //______________________________________________________________________________ -OUString Package::getDisplayName() throw (RuntimeException) +OUString Package::getDisplayName() throw ( + deployment::ExtensionRemovedException, RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); return m_displayName; } //______________________________________________________________________________ -OUString Package::getDescription() throw (RuntimeException) +OUString Package::getDescription() throw ( + deployment::ExtensionRemovedException,RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); return OUString(); } //______________________________________________________________________________ -Sequence Package::getUpdateInformationURLs() throw (RuntimeException) +Sequence Package::getUpdateInformationURLs() throw ( + deployment::ExtensionRemovedException, RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); return Sequence(); } //______________________________________________________________________________ -css::beans::StringPair Package::getPublisherInfo() throw (RuntimeException) +css::beans::StringPair Package::getPublisherInfo() throw ( + deployment::ExtensionRemovedException, RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); css::beans::StringPair aEmptyPair; return aEmptyPair; } //______________________________________________________________________________ -uno::Reference< css::graphic::XGraphic > Package::getIcon( sal_Bool /*bHighContrast*/ ) throw ( RuntimeException ) +uno::Reference< css::graphic::XGraphic > Package::getIcon( sal_Bool /*bHighContrast*/ ) + throw (deployment::ExtensionRemovedException, RuntimeException ) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + uno::Reference< css::graphic::XGraphic > aEmpty; return aEmpty; } @@ -409,8 +450,12 @@ Reference Package::getPackageType() void Package::exportTo( OUString const & destFolderURL, OUString const & newTitle, sal_Int32 nameClashAction, Reference const & xCmdEnv ) - throw (CommandFailedException, CommandAbortedException, RuntimeException) + throw (deployment::ExtensionRemovedException, + CommandFailedException, CommandAbortedException, RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + ::ucbhelper::Content destFolder( destFolderURL, xCmdEnv ); ::ucbhelper::Content sourceContent( getURL(), xCmdEnv ); if (! destFolder.transferContent( @@ -493,7 +538,8 @@ void Package::processPackage_impl( (doRegisterPackage ? !option.Value.Value : option.Value.Value))); if (action) { - OUString displayName( getDisplayName() ); + + OUString displayName = isRemoved() ? getName() : getDisplayName(); ProgressLevel progress( xCmdEnv, (doRegisterPackage @@ -542,9 +588,12 @@ void Package::registerPackage( Reference const & xAbortChannel, Reference const & xCmdEnv ) throw (deployment::DeploymentException, + deployment::ExtensionRemovedException, CommandFailedException, CommandAbortedException, lang::IllegalArgumentException, RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); processPackage_impl( true /* register */, xAbortChannel, xCmdEnv ); } @@ -579,7 +628,13 @@ OUString Package::getRepositoryName() { PackageRegistryBackend * backEnd = getMyBackend(); return backEnd->getContext(); - } +} + +sal_Bool Package::isRemoved() + throw (RuntimeException) +{ + return m_bRemoved; +} //############################################################################## @@ -596,13 +651,15 @@ OUString Package::TypeInfo::getMediaType() throw (RuntimeException) } //______________________________________________________________________________ -OUString Package::TypeInfo::getDescription() throw (RuntimeException) +OUString Package::TypeInfo::getDescription() + throw (deployment::ExtensionRemovedException, RuntimeException) { return getShortDescription(); } //______________________________________________________________________________ -OUString Package::TypeInfo::getShortDescription() throw (RuntimeException) +OUString Package::TypeInfo::getShortDescription() + throw (deployment::ExtensionRemovedException, RuntimeException) { return m_shortDescr; } diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx index fb0b99c3363c..339236126796 100644 --- a/desktop/source/deployment/registry/dp_backenddb.cxx +++ b/desktop/source/deployment/registry/dp_backenddb.cxx @@ -259,31 +259,41 @@ BackendDb::readVectorOfPair( OUString const & sFirstTagName, OUString const & sSecondTagName) { - OSL_ASSERT(parent.is()); - Reference xpathApi = getXPathAPI(); - OUString sExprPairs( - sListTagName + OUSTR("/") + sPairTagName); - Reference listPairs = - xpathApi->selectNodeList(parent, sExprPairs); - - ::std::vector< ::std::pair< OUString, OUString > > retVector; - sal_Int32 length = listPairs->getLength(); - for (sal_Int32 i = 0; i < length; i++) + try { - Reference aPair = listPairs->item(i); - OUString sExprFirst(sFirstTagName + OUSTR("/text()")); - Reference first = - xpathApi->selectSingleNode(aPair, sExprFirst); - - OUString sExprSecond(sSecondTagName + OUSTR("/text()")); - Reference second = - xpathApi->selectSingleNode(aPair, sExprSecond); - OSL_ASSERT(first.is() && second.is()); - - retVector.push_back(::std::make_pair( - first->getNodeValue(), second->getNodeValue())); + OSL_ASSERT(parent.is()); + Reference xpathApi = getXPathAPI(); + OUString sExprPairs( + sListTagName + OUSTR("/") + sPairTagName); + Reference listPairs = + xpathApi->selectNodeList(parent, sExprPairs); + + ::std::vector< ::std::pair< OUString, OUString > > retVector; + sal_Int32 length = listPairs->getLength(); + for (sal_Int32 i = 0; i < length; i++) + { + Reference aPair = listPairs->item(i); + OUString sExprFirst(sFirstTagName + OUSTR("/text()")); + Reference first = + xpathApi->selectSingleNode(aPair, sExprFirst); + + OUString sExprSecond(sSecondTagName + OUSTR("/text()")); + Reference second = + xpathApi->selectSingleNode(aPair, sExprSecond); + OSL_ASSERT(first.is() && second.is()); + + retVector.push_back(::std::make_pair( + first->getNodeValue(), second->getNodeValue())); + } + return retVector; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data entry in backend db: ") + + m_urlDb, 0, exc); } - return retVector; } void BackendDb::writeSimpleList( @@ -327,6 +337,40 @@ void BackendDb::writeSimpleList( } +::std::list< OUString> BackendDb::readList( + Reference const & parent, + OUString const & sListTagName, + OUString const & sMemberTagName) +{ + try + { + OSL_ASSERT(parent.is()); + Reference xpathApi = getXPathAPI(); + OUString sExprList( + sListTagName + OUSTR("/") + sMemberTagName + OUSTR("/text()")); + Reference list = + xpathApi->selectNodeList(parent, sExprList); + + ::std::list retList; + sal_Int32 length = list->getLength(); + for (sal_Int32 i = 0; i < length; i++) + { + Reference member = list->item(i); + retList.push_back(member->getNodeValue()); + } + return retList; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + + + } // namespace backend } // namespace dp_registry diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index 9ea13ad2c91f..0b3b9e80a7d7 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -127,7 +127,7 @@ public: // XPackageRegistry virtual Reference SAL_CALL bindPackage( OUString const & url, OUString const & mediaType, sal_Bool bNoFileAccess, - Reference const & xCmdEnv ) + OUString const & identifier, Reference const & xCmdEnv ) throw (deployment::DeploymentException, CommandFailedException, lang::IllegalArgumentException, RuntimeException); virtual Sequence< Reference > SAL_CALL @@ -458,8 +458,8 @@ void PackageRegistryImpl::update() throw (RuntimeException) // XPackageRegistry //______________________________________________________________________________ Reference PackageRegistryImpl::bindPackage( - OUString const & url, OUString const & mediaType_, sal_Bool bNoFileAccess, - Reference const & xCmdEnv ) + OUString const & url, OUString const & mediaType_, sal_Bool bRemoved, + OUString const & identifier, Reference const & xCmdEnv ) throw (deployment::DeploymentException, CommandFailedException, lang::IllegalArgumentException, RuntimeException) { @@ -497,7 +497,7 @@ Reference PackageRegistryImpl::bindPackage( for ( ; iPos != iEnd; ++iPos ) { try { - return (*iPos)->bindPackage( url, mediaType, bNoFileAccess, xCmdEnv ); + return (*iPos)->bindPackage( url, mediaType, bRemoved, identifier, xCmdEnv ); } catch (lang::IllegalArgumentException &) { } @@ -526,7 +526,7 @@ Reference PackageRegistryImpl::bindPackage( getResourceString(RID_STR_UNSUPPORTED_MEDIA_TYPE) + mediaType, static_cast(this), static_cast(-1) ); } - return iFind->second->bindPackage( url, mediaType, bNoFileAccess, xCmdEnv ); + return iFind->second->bindPackage( url, mediaType, bRemoved, identifier, xCmdEnv ); } } diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx index a5fe1b99746f..39fd3cdc892e 100644 --- a/desktop/source/deployment/registry/executable/dp_executable.cxx +++ b/desktop/source/deployment/registry/executable/dp_executable.cxx @@ -72,9 +72,10 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend inline ExecutablePackageImpl( ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, - Reference const & xPackageType, bool bUseDb) + Reference const & xPackageType, + bool bRemoved, OUString const & identifier) : Package( myBackend, url, name, name /* display-name */, - xPackageType, bUseDb) //, + xPackageType, bRemoved, identifier) {} }; friend class ExecutablePackageImpl; @@ -84,8 +85,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( - OUString const & url, OUString const & mediaType, sal_Bool bNoFileAccess, - Reference const & xCmdEnv ); + OUString const & url, OUString const & mediaType, sal_Bool bRemoved, + OUString const & identifier, Reference const & xCmdEnv ); Reference m_xExecutableTypeInfo; @@ -125,8 +126,8 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) // PackageRegistryBackend Reference BackendImpl::bindPackage_( - OUString const & url, OUString const & mediaType, sal_Bool bNoFileAccess, - Reference const & xCmdEnv ) + OUString const & url, OUString const & mediaType, sal_Bool bRemoved, + OUString const & identifier, Reference const & xCmdEnv ) { if (mediaType.getLength() == 0) { @@ -141,13 +142,17 @@ Reference BackendImpl::bindPackage_( { if (type.EqualsIgnoreCaseAscii("application")) { - ::ucbhelper::Content ucbContent( url, xCmdEnv ); - const OUString name( ucbContent.getPropertyValue( - dp_misc::StrTitle::get() ).get() ); + OUString name; + if (!bRemoved) + { + ::ucbhelper::Content ucbContent( url, xCmdEnv ); + name = ucbContent.getPropertyValue( + dp_misc::StrTitle::get() ).get(); + } if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.executable")) { return new BackendImpl::ExecutablePackageImpl( - this, url, name, m_xExecutableTypeInfo, bNoFileAccess); + this, url, name, m_xExecutableTypeInfo, bRemoved, identifier); } } } diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 05ff8dda0e01..9fd9e7ae79fc 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -79,8 +79,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, - bool bUseDb) - : Package( myBackend, url, name, name, xPackageType, bUseDb) + bool bRemoved, OUString const & identifier) + : Package( myBackend, url, name, name, xPackageType, bRemoved, identifier) {} }; friend class PackageImpl; @@ -88,7 +88,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, - sal_Bool bNoFileAccess, + sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ); void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage ); @@ -140,7 +140,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) //______________________________________________________________________________ Reference BackendImpl::bindPackage_( OUString const & url, OUString const & mediaType_, - sal_Bool bNoFileAccess, + sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ) { // we don't support auto detection: @@ -155,14 +155,19 @@ Reference BackendImpl::bindPackage_( { if (type.EqualsIgnoreCaseAscii("application")) { - ::ucbhelper::Content ucbContent( url, xCmdEnv ); + OUString name; + if (!bRemoved) + { + ::ucbhelper::Content ucbContent( url, xCmdEnv ); + name = ucbContent.getPropertyValue( + StrTitle::get() ).get(); + } + if (subType.EqualsIgnoreCaseAscii( "vnd.sun.star.help")) { return new PackageImpl( - this, url, - ucbContent.getPropertyValue( StrTitle::get() ).get(), - m_xHelpTypeInfo, bNoFileAccess); + this, url, name, m_xHelpTypeInfo, bRemoved, identifier); } } } diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 09b25caedc2b..371faf579caf 100644 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -40,6 +40,7 @@ #include "com/sun/star/lang/XEventListener.hpp" #include "com/sun/star/deployment/XPackageRegistry.hpp" #include "com/sun/star/deployment/XPackageManager.hpp" +#include "com/sun/star/deployment/InvalidRemovedParameterException.hpp" #include #include #include "dp_registry.hrc" @@ -74,7 +75,9 @@ protected: ::rtl::OUString m_name; ::rtl::OUString m_displayName; const css::uno::Reference m_xPackageType; - const bool m_bUseDb; + const bool m_bRemoved; + //Only set if m_bRemoved = true; + const ::rtl::OUString m_identifier; void check() const; void fireModified(); @@ -104,7 +107,8 @@ protected: ::rtl::OUString const & displayName, css::uno::Reference const & xPackageType, - bool bUseDb); + bool bRemoved, + ::rtl::OUString const & identifier); public: @@ -129,9 +133,11 @@ public: virtual ::rtl::OUString SAL_CALL getMediaType() throw (css::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getDescription() - throw (css::uno::RuntimeException); + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getShortDescription() - throw (css::uno::RuntimeException); + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getFileFilter() throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getIcon( sal_Bool highContrast, @@ -173,20 +179,23 @@ public: const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv, sal_Bool bInstalled, ::rtl::OUString const & aContextName) throw (css::deployment::DeploymentException, - css::ucb::CommandFailedException, - css::ucb::CommandAbortedException, - css::uno::RuntimeException); + css::deployment::ExtensionRemovedException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::uno::RuntimeException); virtual ::sal_Bool SAL_CALL checkDependencies( const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv ) throw (css::deployment::DeploymentException, - css::ucb::CommandFailedException, - css::uno::RuntimeException); + css::deployment::ExtensionRemovedException, + css::ucb::CommandFailedException, + css::uno::RuntimeException); virtual void SAL_CALL registerPackage( css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ) throw (css::deployment::DeploymentException, + css::deployment::ExtensionRemovedException, css::ucb::CommandFailedException, css::ucb::CommandAbortedException, css::lang::IllegalArgumentException, css::uno::RuntimeException); @@ -214,19 +223,27 @@ public: virtual css::beans::Optional< ::rtl::OUString > SAL_CALL getIdentifier() throw (css::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getVersion() - throw (css::uno::RuntimeException); + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getURL() throw (css::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getDisplayName() - throw (css::uno::RuntimeException); + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getDescription() - throw (css::uno::RuntimeException); + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL - getUpdateInformationURLs() throw (css::uno::RuntimeException); - - virtual css::beans::StringPair SAL_CALL getPublisherInfo() throw (css::uno::RuntimeException); - virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getIcon( sal_Bool bHighContrast ) throw (css::uno::RuntimeException); - + getUpdateInformationURLs() + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); + virtual css::beans::StringPair SAL_CALL getPublisherInfo() + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); + virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL + getIcon( sal_Bool bHighContrast ) + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); virtual css::uno::Reference SAL_CALL getPackageType() throw (css::uno::RuntimeException); virtual void SAL_CALL exportTo( @@ -234,11 +251,14 @@ public: ::rtl::OUString const & newTitle, sal_Int32 nameClashAction, css::uno::Reference const & xCmdEnv ) - throw (css::ucb::CommandFailedException, + throw (css::deployment::ExtensionRemovedException, + css::ucb::CommandFailedException, css::ucb::CommandAbortedException, css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getRepositoryName() + throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL isRemoved() + throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getRepositoryName() - throw (css::uno::RuntimeException); }; typedef ::cppu::WeakComponentImplHelper2< @@ -282,7 +302,7 @@ protected: // @@@ to be implemented by specific backend: virtual css::uno::Reference bindPackage_( ::rtl::OUString const & url, ::rtl::OUString const & mediaType, - sal_Bool bNoFileAccess, + sal_Bool bRemoved, ::rtl::OUString const & identifier, css::uno::Reference const & xCmdEnv ) = 0; @@ -315,14 +335,12 @@ public: // XPackageRegistry virtual css::uno::Reference SAL_CALL bindPackage( ::rtl::OUString const & url, ::rtl::OUString const & mediaType, - sal_Bool bNoFileAccess, + sal_Bool bRemoved, ::rtl::OUString const & identifier, css::uno::Reference const & xCmdEnv ) throw (css::deployment::DeploymentException, + css::deployment::InvalidRemovedParameterException, css::ucb::CommandFailedException, css::lang::IllegalArgumentException, css::uno::RuntimeException); -// virtual css::uno::Sequence< -// css::uno::Reference > SAL_CALL -// getSupportedPackageTypes() throw (css::uno::RuntimeException); }; } diff --git a/desktop/source/deployment/registry/inc/dp_backenddb.hxx b/desktop/source/deployment/registry/inc/dp_backenddb.hxx index 3005ffcafb5b..dbac54e10c6d 100644 --- a/desktop/source/deployment/registry/inc/dp_backenddb.hxx +++ b/desktop/source/deployment/registry/inc/dp_backenddb.hxx @@ -97,6 +97,12 @@ protected: ::rtl::OUString const & sFirstTagName, ::rtl::OUString const & sSecondTagName); + ::std::list< ::rtl::OUString> readList( + css::uno::Reference const & parent, + ::rtl::OUString const & sListTagName, + ::rtl::OUString const & sMemberTagName); + + /* returns the namespace which is to be written as xmlns attribute diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.cxx b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx index 97cfc136049c..93aa62174e0f 100644 --- a/desktop/source/deployment/registry/package/dp_extbackenddb.cxx +++ b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx @@ -46,22 +46,6 @@ using ::rtl::OUString; #define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/extension-registry/2010" #define ROOT_ELEMENT_NAME "extension-backend-db" -// /extension-backend-db/extension -#define EXTENSION_ELEMENT "extension" - -// /extension-backend-db/extension/extension-items -#define EXTENSION_ITEMS "extension-items" - -// /extension-backend-db/extension/extension-items/item -#define EXTENSION_ITEMS_ITEM "item" - -// /extension-backend-db/extension/extension-items/item/url -#define ITEM_URL "url" - -// /extension-backend-db/extension/extension-items/item/media-type -#define ITEM_MEDIA_TYP "media-type" - - namespace dp_registry { namespace backend { namespace bundle { @@ -109,13 +93,13 @@ void ExtensionBackendDb::addEntry(::rtl::OUString const & url, Data const & data root->appendChild(extensionNodeNode); // ... - Reference identifierNode( - doc->createElement(OUSTR("identifier")), UNO_QUERY_THROW); - extensionNodeNode->appendChild(identifierNode); +// Reference identifierNode( +// doc->createElement(OUSTR("identifier")), UNO_QUERY_THROW); +// extensionNodeNode->appendChild(identifierNode); - Reference identifierValue( - doc->createTextNode(data.identifier), UNO_QUERY_THROW); - identifierNode->appendChild(identifierValue); +// Reference identifierValue( +// doc->createTextNode(data.identifier), UNO_QUERY_THROW); +// identifierNode->appendChild(identifierValue); writeVectorOfPair( @@ -145,30 +129,41 @@ void ExtensionBackendDb::removeEntry(::rtl::OUString const & url) ExtensionBackendDb::Data ExtensionBackendDb::getEntry(::rtl::OUString const & url) { - ExtensionBackendDb::Data retData; - const OUString sExpression( - OUSTR("reg:extension[@url = \"") + url + OUSTR("\"]")); - Reference doc = getDocument(); - Reference root = doc->getFirstChild(); - - Reference xpathApi = getXPathAPI(); - //find the extension element that is to be removed - Reference aNode = - xpathApi->selectSingleNode(root, sExpression); - OSL_ASSERT(aNode.is()); - - const OUString sExprIdentifier(OUSTR("reg:identifier/text()")); - - Reference idValueNode = - xpathApi->selectSingleNode(aNode, sExprIdentifier); - retData.identifier = idValueNode->getNodeValue(); - - retData.items = - readVectorOfPair( - aNode, - OUSTR("reg:extension-items"), - OUSTR("reg:item"), OUSTR("reg:url"), OUSTR("reg:media-type")); - return retData; + try + { + ExtensionBackendDb::Data retData; + const OUString sExpression( + OUSTR("reg:extension[@url = \"") + url + OUSTR("\"]")); + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + + Reference xpathApi = getXPathAPI(); + + Reference aNode = + xpathApi->selectSingleNode(root, sExpression); + if (aNode.is()) + { +// const OUString sExprIdentifier(OUSTR("reg:identifier/text()")); + +// Reference idValueNode = +// xpathApi->selectSingleNode(aNode, sExprIdentifier); +// retData.identifier = idValueNode->getNodeValue(); + + retData.items = + readVectorOfPair( + aNode, + OUSTR("reg:extension-items"), + OUSTR("reg:item"), OUSTR("reg:url"), OUSTR("reg:media-type")); + } + return retData; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data entry in backend db: ") + + m_urlDb, 0, exc); + } } } // namespace bundle diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.hxx b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx index 156e34155040..4afe6f1a5577 100644 --- a/desktop/source/deployment/registry/package/dp_extbackenddb.hxx +++ b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx @@ -58,11 +58,15 @@ namespace bundle { */ class ExtensionBackendDb: public dp_registry::backend::BackendDb { +protected: + virtual ::rtl::OUString getDbNSName(); + + virtual ::rtl::OUString getRootElementName(); + public: struct Data { - ::rtl::OUString identifier; - /* every element consists of a pair of the url to the item (jar,rdb, etc) + /* every element consists of a pair of the url to the item (jar,rdb, etc) and the media type */ ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString> > items; @@ -80,9 +84,6 @@ public: void removeEntry(::rtl::OUString const & url); Data getEntry(::rtl::OUString const & url); - virtual ::rtl::OUString getDbNSName(); - - virtual ::rtl::OUString getRootElementName(); }; diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 8fe7874f247f..467ff5ca89fa 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -77,9 +77,9 @@ using namespace ::dp_misc; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::ucb; + namespace css = ::com::sun::star; -namespace cssu = ::com::sun::star::uno; + using ::rtl::OUString; namespace dp_registry { @@ -105,46 +105,49 @@ class BackendImpl : public ImplBaseT Sequence< Reference > m_bundle; Sequence< Reference > * m_pBundle; - ExtensionBackendDb::Data m_data; + ExtensionBackendDb::Data m_dbData; Reference bindBundleItem( OUString const & url, OUString const & mediaType, - Reference const & xCmdEnv, + sal_Bool bRemoved, //that is, useing data base information + OUString const & identifier, + Reference const & xCmdEnv, bool notifyDetectionError = true ); typedef ::std::vector< Reference > t_packagevec; void scanBundle( t_packagevec & bundle, ::rtl::Reference const & abortChannel, - Reference const & xCmdEnv ); + Reference const & xCmdEnv ); void scanLegacyBundle( t_packagevec & bundle, OUString const & url, ::rtl::Reference const & abortChannel, - Reference const & xCmdEnv, + Reference const & xCmdEnv, bool skip_registration = false ); - ::std::vector > getPackagesFromDb(); + ::std::vector > getPackagesFromDb( + Reference const & xCmdEnv); bool checkPlatform( - css::uno::Reference< css::ucb::XCommandEnvironment > const & environment); + Reference const & environment); bool checkDependencies( - css::uno::Reference< css::ucb::XCommandEnvironment > const & + Reference const & environment, DescriptionInfoset const & description); // throws css::uno::RuntimeException, // css::deployment::DeploymentException ::sal_Bool checkLicense( - css::uno::Reference< css::ucb::XCommandEnvironment > const & xCmdEnv, + Reference< ucb::XCommandEnvironment > const & xCmdEnv, DescriptionInfoset const & description, bool bInstalled, OUString const & aContextName ) - throw (css::deployment::DeploymentException, - css::ucb::CommandFailedException, - css::ucb::CommandAbortedException, - css::uno::RuntimeException); + throw (deployment::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + RuntimeException); // @throws DeploymentException OUString getTextFromURL( - const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv, + const Reference< ucb::XCommandEnvironment >& xCmdEnv, const OUString& licenseUrl); DescriptionInfoset getDescriptionInfoset(); @@ -153,12 +156,12 @@ class BackendImpl : public ImplBaseT virtual beans::Optional< beans::Ambiguous > isRegistered_( ::osl::ResettableMutexGuard & guard, ::rtl::Reference const & abortChannel, - Reference const & xCmdEnv ); + Reference const & xCmdEnv ); virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, ::rtl::Reference const & abortChannel, - Reference const & xCmdEnv ); + Reference const & xCmdEnv ); virtual void SAL_CALL disposing(); @@ -171,51 +174,66 @@ class BackendImpl : public ImplBaseT OUString const & name, Reference const & xPackageType, bool legacyBundle, - bool useDb); + bool bRemoved, + OUString const & identifier); // XPackage virtual sal_Bool SAL_CALL isBundle() throw (RuntimeException); + virtual Sequence< Reference > SAL_CALL getBundle( Reference const & xAbortChannel, - Reference const & xCmdEnv ) + Reference const & xCmdEnv ) throw (deployment::DeploymentException, - CommandFailedException, CommandAbortedException, + ucb::CommandFailedException, + ucb::CommandAbortedException, lang::IllegalArgumentException, RuntimeException); - virtual OUString SAL_CALL getDescription() throw (RuntimeException); + virtual OUString SAL_CALL getDescription() + throw (deployment::ExtensionRemovedException, RuntimeException); + virtual void SAL_CALL exportTo( OUString const & destFolderURL, OUString const & newTitle, sal_Int32 nameClashAction, - Reference const & xCmdEnv ) - throw (CommandFailedException, CommandAbortedException, + Reference const & xCmdEnv ) + throw (deployment::ExtensionRemovedException, + ucb::CommandFailedException, + ucb::CommandAbortedException, RuntimeException); virtual ::sal_Bool SAL_CALL checkPrerequisites( - const css::uno::Reference< css::task::XAbortChannel >& xAbortChannel, - const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv, + const Reference< task::XAbortChannel >& xAbortChannel, + const Reference< ucb::XCommandEnvironment >& xCmdEnv, ::sal_Bool bInstalled, OUString const & aContextName) - throw (css::deployment::DeploymentException, - css::ucb::CommandFailedException, - css::ucb::CommandAbortedException, - css::uno::RuntimeException); + throw (deployment::ExtensionRemovedException, + deployment::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + RuntimeException); virtual ::sal_Bool SAL_CALL checkDependencies( - const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv ) - throw (css::deployment::DeploymentException, - css::ucb::CommandFailedException, - css::uno::RuntimeException); + const Reference< ucb::XCommandEnvironment >& xCmdEnv ) + throw (deployment::DeploymentException, + deployment::ExtensionRemovedException, + ucb::CommandFailedException, + RuntimeException); virtual beans::Optional SAL_CALL getIdentifier() throw (RuntimeException); - virtual OUString SAL_CALL getVersion() throw (RuntimeException); + virtual OUString SAL_CALL getVersion() + throw (deployment::ExtensionRemovedException, RuntimeException); virtual Sequence SAL_CALL getUpdateInformationURLs() - throw (RuntimeException); + throw (deployment::ExtensionRemovedException, RuntimeException); - virtual css::beans::StringPair SAL_CALL getPublisherInfo() throw (css::uno::RuntimeException); + virtual beans::StringPair SAL_CALL getPublisherInfo() + throw (deployment::ExtensionRemovedException, RuntimeException); virtual OUString SAL_CALL getDisplayName() throw (RuntimeException); - virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getIcon( ::sal_Bool bHighContrast ) throw (css::uno::RuntimeException); + + virtual Reference< graphic::XGraphic > SAL_CALL + getIcon( ::sal_Bool bHighContrast ) + throw (deployment::ExtensionRemovedException, + RuntimeException); }; friend class PackageImpl; @@ -233,8 +251,8 @@ class BackendImpl : public ImplBaseT // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, - sal_Bool bNoFileAccess, - Reference const & xCmdEnv ); + sal_Bool bRemoved, OUString const & identifier, + Reference const & xCmdEnv ); virtual void SAL_CALL disposing(); @@ -344,8 +362,8 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) //______________________________________________________________________________ Reference BackendImpl::bindPackage_( OUString const & url, OUString const & mediaType_, - sal_Bool bNoFileAccess, - Reference const & xCmdEnv ) + sal_Bool bRemoved, OUString const & identifier, + Reference const & xCmdEnv ) { OUString mediaType( mediaType_ ); if (mediaType.getLength() == 0) @@ -393,21 +411,24 @@ Reference BackendImpl::bindPackage_( { if (type.EqualsIgnoreCaseAscii("application")) { - ::ucbhelper::Content ucbContent; - OUString name; + //In case a XPackage is created for a removed extension, we cannot //obtain the name - if (create_ucb_content(&ucbContent, url, xCmdEnv, false )) + OUString name; + if (!bRemoved) + { + ::ucbhelper::Content ucbContent( url, xCmdEnv ); name = ucbContent.getPropertyValue( StrTitle::get() ).get(); + } if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.package-bundle")) { return new PackageImpl( - this, url, name, m_xBundleTypeInfo, false, bNoFileAccess); + this, url, name, m_xBundleTypeInfo, false, bRemoved, identifier); } else if (subType.EqualsIgnoreCaseAscii( "vnd.sun.star.legacy-package-bundle")) { return new PackageImpl( - this, url, name, m_xLegacyBundleTypeInfo, true, bNoFileAccess); + this, url, name, m_xLegacyBundleTypeInfo, true, bRemoved, identifier); } } } @@ -447,16 +468,15 @@ BackendImpl::PackageImpl::PackageImpl( OUString const & url, OUString const & name, Reference const & xPackageType, - bool legacyBundle, - bool useDb) + bool legacyBundle, bool bRemoved, OUString const & identifier) : Package( myBackend, url, name, name /* display-name */, - xPackageType, useDb ), + xPackageType, bRemoved, identifier), m_url_expanded( expandUnoRcUrl( url ) ), m_legacyBundle( legacyBundle ), m_pBundle( 0 ) { - if (useDb) - m_data = getMyBackend()->readDataFromDb(url); + if (bRemoved) + m_dbData = getMyBackend()->readDataFromDb(url); } BackendImpl * BackendImpl::PackageImpl::getMyBackend() const @@ -491,10 +511,17 @@ beans::Optional< beans::Ambiguous > BackendImpl::PackageImpl::isRegistered_( ::osl::ResettableMutexGuard &, ::rtl::Reference const & abortChannel, - Reference const & xCmdEnv ) + Reference const & xCmdEnv ) { + //In case the object was created for a removed extension (m_bRemoved = true) + //but the extension is not registered, then bundle will be empty. Then + //the return value will be Optional<...>.IsPresent= false. Althoug this is + //not true, this does not matter. Then registerPackage or revokePackage + //would never be called for the items. But since the extension is removed + //and not registered anyway, this does not matter. const Sequence< Reference > bundle( getBundle( abortChannel.get(), xCmdEnv ) ); + bool reg = false; bool present = false; bool ambig = false; @@ -723,10 +750,13 @@ bool BackendImpl::PackageImpl::checkDependencies( const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv, sal_Bool bInstalled, OUString const & aContextName) throw (css::deployment::DeploymentException, - css::ucb::CommandFailedException, - css::ucb::CommandAbortedException, - css::uno::RuntimeException) + css::deployment::ExtensionRemovedException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::uno::RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); DescriptionInfoset info = getDescriptionInfoset(); if (!info.hasDescription()) return sal_True; @@ -742,6 +772,8 @@ bool BackendImpl::PackageImpl::checkDependencies( css::ucb::CommandFailedException, css::uno::RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); DescriptionInfoset info = getDescriptionInfoset(); if (!info.hasDescription()) return sal_True; @@ -753,8 +785,8 @@ beans::Optional BackendImpl::PackageImpl::getIdentifier() throw (RuntimeException) { OUString identifier; - if (m_bUseDb) - identifier = m_data.identifier; + if (m_bRemoved) + identifier = m_identifier; else identifier = dp_misc::generateIdentifier( getDescriptionInfoset().getIdentifier(), m_name); @@ -765,18 +797,24 @@ beans::Optional BackendImpl::PackageImpl::getIdentifier() OUString BackendImpl::PackageImpl::getVersion() throw (RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); return getDescriptionInfoset().getVersion(); } Sequence BackendImpl::PackageImpl::getUpdateInformationURLs() - throw (RuntimeException) + throw (deployment::ExtensionRemovedException, RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); return getDescriptionInfoset().getUpdateInformationUrls(); } beans::StringPair BackendImpl::PackageImpl::getPublisherInfo() - throw (RuntimeException) + throw (deployment::ExtensionRemovedException, RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); ::std::pair< OUString, OUString > aInfo = getDescriptionInfoset().getLocalizedPublisherNameAndURL(); beans::StringPair aStrPair( aInfo.first, aInfo.second ); return aStrPair; @@ -784,8 +822,11 @@ beans::StringPair BackendImpl::PackageImpl::getPublisherInfo() //______________________________________________________________________________ uno::Reference< graphic::XGraphic > BackendImpl::PackageImpl::getIcon( sal_Bool bHighContrast ) - throw ( RuntimeException ) + throw (deployment::ExtensionRemovedException, RuntimeException ) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + uno::Reference< graphic::XGraphic > xGraphic; OUString aIconURL = getDescriptionInfoset().getIconURL( bHighContrast ); @@ -816,7 +857,7 @@ void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, ::rtl::Reference const & abortChannel, - Reference const & xCmdEnv ) + Reference const & xCmdEnv ) { const Sequence< Reference > bundle( getBundle( abortChannel.get(), xCmdEnv ) ); @@ -838,7 +879,7 @@ void BackendImpl::PackageImpl::processPackage_( catch (RuntimeException &) { throw; } - catch (CommandAbortedException &) { + catch (ucb::CommandAbortedException &) { throw; } catch (Exception &) { @@ -876,7 +917,7 @@ void BackendImpl::PackageImpl::processPackage_( catch (RuntimeException &) { throw; } - catch (CommandAbortedException &) { + catch (ucb::CommandAbortedException &) { throw; } catch (Exception &) { @@ -893,7 +934,7 @@ void BackendImpl::PackageImpl::processPackage_( deployment::DeploymentException dpExc; if (exc >>= dpExc) { - throw CommandFailedException( + throw ucb::CommandFailedException( dpExc.Message, dpExc.Context, dpExc.Cause ); } else { @@ -905,7 +946,6 @@ void BackendImpl::PackageImpl::processPackage_( ::std::make_pair(xPackage->getURL(), xPackage->getPackageType()->getMediaType())); } - data.identifier = getIdentifier().Value; getMyBackend()->addDataToDb(getURL(), data); } else @@ -924,7 +964,7 @@ void BackendImpl::PackageImpl::processPackage_( catch (RuntimeException &) { throw; } - catch (CommandAbortedException &) { + catch (ucb::CommandAbortedException &) { throw; } catch (Exception &) { @@ -957,6 +997,9 @@ void BackendImpl::PackageImpl::processPackage_( //______________________________________________________________________________ OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + const OUString sRelativeURL(getDescriptionInfoset().getLocalizedDescriptionURL()); OUString sDescription; if (sRelativeURL.getLength()) @@ -977,9 +1020,14 @@ OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException) //______________________________________________________________________________ void BackendImpl::PackageImpl::exportTo( OUString const & destFolderURL, OUString const & newTitle, - sal_Int32 nameClashAction, Reference const & xCmdEnv ) - throw (CommandFailedException, CommandAbortedException, RuntimeException) + sal_Int32 nameClashAction, Reference const & xCmdEnv ) + throw (ucb::CommandFailedException, + deployment::ExtensionRemovedException, + ucb::CommandAbortedException, RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + ::ucbhelper::Content sourceContent( m_url_expanded, xCmdEnv ); OUString title(newTitle); if (title.getLength() == 0) @@ -989,25 +1037,25 @@ void BackendImpl::PackageImpl::exportTo( rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ) ) ); - if (nameClashAction == NameClash::ASK) + if (nameClashAction == ucb::NameClash::ASK) { if (create_ucb_content( 0, destURL, xCmdEnv, false /* no throw */ )) { bool replace = false, abort = false; if (! interactContinuation( - Any( NameClashResolveRequest( + Any( ucb::NameClashResolveRequest( OUSTR("file already exists: ") + title, static_cast(this), task::InteractionClassification_QUERY, destFolderURL, title, OUString() ) ), - XInteractionReplaceExistingData::static_type(), xCmdEnv, + ucb::XInteractionReplaceExistingData::static_type(), xCmdEnv, &replace, &abort ) || !replace) { return; } } } - else if (nameClashAction != NameClash::OVERWRITE) { - throw CommandFailedException( + else if (nameClashAction != ucb::NameClash::OVERWRITE) { + throw ucb::CommandFailedException( OUSTR("unsupported nameClashAction!"), static_cast(this), Any() ); } @@ -1033,11 +1081,11 @@ void BackendImpl::PackageImpl::exportTo( while (xResultSet->next()) { ::ucbhelper::Content subContent( - Reference( + Reference( xResultSet, UNO_QUERY_THROW )->queryContent(), xCmdEnv ); if (! destFolderContent.transferContent( subContent, ::ucbhelper::InsertOperation_COPY, - OUString(), NameClash::OVERWRITE )) + OUString(), ucb::NameClash::OVERWRITE )) throw RuntimeException( OUSTR("UCB transferContent() failed!"), static_cast(this) ); progress.update( Any() ); // animating progress bar @@ -1145,7 +1193,7 @@ void BackendImpl::PackageImpl::exportTo( if (! metainfFolderContent.transferContent( manifestContent, ::ucbhelper::InsertOperation_COPY, - OUString(), NameClash::OVERWRITE )) + OUString(), ucb::NameClash::OVERWRITE )) throw RuntimeException( OUSTR("UCB transferContent() failed!"), static_cast(this) ); } @@ -1154,7 +1202,7 @@ void BackendImpl::PackageImpl::exportTo( try { destFolderContent.executeCommand( OUSTR("flush"), Any() ); } - catch (UnsupportedCommandException &) { + catch (ucb::UnsupportedCommandException &) { } } @@ -1167,18 +1215,18 @@ sal_Bool BackendImpl::PackageImpl::isBundle() throw (RuntimeException) //______________________________________________________________________________ Sequence< Reference > BackendImpl::PackageImpl::getBundle( Reference const & xAbortChannel, - Reference const & xCmdEnv ) + Reference const & xCmdEnv ) throw (deployment::DeploymentException, - CommandFailedException, CommandAbortedException, + ucb::CommandFailedException, ucb::CommandAbortedException, lang::IllegalArgumentException, RuntimeException) { Sequence< Reference > * pBundle = m_pBundle; if (pBundle == 0) { t_packagevec bundle; - if (m_bUseDb) + if (m_bRemoved) { - bundle = getPackagesFromDb(); + bundle = getPackagesFromDb(xCmdEnv); } else { @@ -1203,7 +1251,8 @@ Sequence< Reference > BackendImpl::PackageImpl::getBundle( if (mediaType.getLength() > 0) { const Reference xPackage( - bindBundleItem( getURL(), mediaType, xCmdEnv ) ); + bindBundleItem( getURL(), mediaType, false, OUString(), + xCmdEnv ) ); if (xPackage.is()) bundle.push_back( xPackage ); // continue scanning: @@ -1221,10 +1270,10 @@ Sequence< Reference > BackendImpl::PackageImpl::getBundle( catch (RuntimeException &) { throw; } - catch (CommandFailedException &) { + catch (ucb::CommandFailedException &) { throw; } - catch (CommandAbortedException &) { + catch (ucb::CommandAbortedException &) { throw; } catch (deployment::DeploymentException &) { @@ -1302,7 +1351,8 @@ inline bool isBundle_( OUString const & mediaType ) //______________________________________________________________________________ Reference BackendImpl::PackageImpl::bindBundleItem( OUString const & url, OUString const & mediaType, - Reference const & xCmdEnv, + sal_Bool bRemoved, OUString const & identifier, + Reference const & xCmdEnv, bool notifyDetectionError ) { // ignore any nested bundles: @@ -1312,13 +1362,13 @@ Reference BackendImpl::PackageImpl::bindBundleItem( ReferencexPackage; try { xPackage.set( getMyBackend()->m_xRootRegistry->bindPackage( - url, mediaType, false, xCmdEnv ) ); + url, mediaType, bRemoved, identifier, xCmdEnv ) ); OSL_ASSERT( xPackage.is() ); } catch (RuntimeException &) { throw; } - catch (CommandFailedException &) { + catch (ucb::CommandFailedException &) { // ignore already handled error } catch (Exception &) { @@ -1351,7 +1401,7 @@ Reference BackendImpl::PackageImpl::bindBundleItem( void BackendImpl::PackageImpl::scanBundle( t_packagevec & bundle, ::rtl::Reference const & abortChannel, - Reference const & xCmdEnv ) + Reference const & xCmdEnv ) { OSL_ASSERT( !m_legacyBundle ); @@ -1448,7 +1498,7 @@ void BackendImpl::PackageImpl::scanBundle( if (bundle.end() == std::find_if(bundle.begin(), bundle.end(), XPackage_eq(url))) { const Reference xPackage( - bindBundleItem( url, mediaType, xCmdEnv ) ); + bindBundleItem( url, mediaType, false, OUString(), xCmdEnv ) ); if (xPackage.is()) bundle.push_back( xPackage ); } @@ -1487,7 +1537,7 @@ void BackendImpl::PackageImpl::scanLegacyBundle( t_packagevec & bundle, OUString const & url, ::rtl::Reference const & abortChannel, - Reference const & xCmdEnv, + Reference const & xCmdEnv, bool skip_registration ) { ::ucbhelper::Content ucbContent( url, xCmdEnv ); @@ -1523,8 +1573,8 @@ void BackendImpl::PackageImpl::scanLegacyBundle( OUString mediaType; const Reference xPackage( - bindBundleItem( path, OUString() /* detect */, xCmdEnv, - false /* ignore detection errors */ ) ); + bindBundleItem( path, OUString() /* detect */, false, OUString(), + xCmdEnv, false /* ignore detection errors */ ) ); if (xPackage.is()) { const Reference xPackageType( xPackage->getPackageType() ); @@ -1559,8 +1609,12 @@ void BackendImpl::PackageImpl::scanLegacyBundle( } } -OUString BackendImpl::PackageImpl::getDisplayName() throw (RuntimeException) +OUString BackendImpl::PackageImpl::getDisplayName() + throw (deployment::ExtensionRemovedException, RuntimeException) { + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + OUString sName = getDescriptionInfoset().getLocalizedDisplayName(); if (sName.getLength() == 0) return m_displayName; @@ -1568,11 +1622,22 @@ OUString BackendImpl::PackageImpl::getDisplayName() throw (RuntimeException) return sName; } -::std::vector > BackendImpl::PackageImpl::getPackagesFromDb() +::std::vector > +BackendImpl::PackageImpl::getPackagesFromDb( + Reference const & xCmdEnv) { - //get the data base entry for this extension + ::std::vector > retVector; + + typedef ::std::vector< ::std::pair >::const_iterator ITC; + for (ITC i = m_dbData.items.begin(); i != m_dbData.items.end(); i++) + { + Reference xExtension = + bindBundleItem(i->first, i->second, true, m_identifier, xCmdEnv); + OSL_ASSERT(xExtension.is()); + retVector.push_back(xExtension); + } - return ::std::vector >(); + return retVector; } } // anon namespace diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index 6d503d33d51d..b645c9b2af7a 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -89,14 +89,14 @@ class BackendImpl : public t_helper OUString const & url, Reference const &xCmdEnv, OUString const & scriptURL, OUString const & dialogURL, - bool bUseDb); + bool bRemoved, OUString const & identifier); }; friend class PackageImpl; // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, - sal_Bool bNoFileAccess, + sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ); rtl::OUString getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage ); @@ -125,11 +125,12 @@ BackendImpl::PackageImpl::PackageImpl( ::rtl::Reference const & myBackend, OUString const & url, Reference const &xCmdEnv, - OUString const & scriptURL, OUString const & dialogURL, bool bUseDb ) + OUString const & scriptURL, OUString const & dialogURL, bool bRemoved, + OUString const & identifier) : Package( myBackend.get(), url, OUString(), OUString(), // will be late-initialized scriptURL.getLength() > 0 ? myBackend->m_xBasicLibTypeInfo - : myBackend->m_xDialogLibTypeInfo, bUseDb), + : myBackend->m_xDialogLibTypeInfo, bRemoved, identifier), m_scriptURL( scriptURL ), m_dialogURL( dialogURL ) { @@ -191,7 +192,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) //______________________________________________________________________________ Reference BackendImpl::bindPackage_( OUString const & url, OUString const & mediaType_, - sal_Bool bNoFileAccess, + sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ) { OUString mediaType( mediaType_ ); @@ -234,7 +235,7 @@ Reference BackendImpl::bindPackage_( } return new PackageImpl( this, url, xCmdEnv, makeURL( url, OUSTR("script.xlb") ), - dialogURL, bNoFileAccess); + dialogURL, bRemoved, identifier); } else if (subType.EqualsIgnoreCaseAscii( "vnd.sun.star.dialog-library")) { @@ -242,7 +243,7 @@ Reference BackendImpl::bindPackage_( this, url, xCmdEnv, OUString() /* no script lib */, makeURL( url, OUSTR("dialog.xlb") ), - bNoFileAccess); + bRemoved, identifier); } } } diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx index 47b6430f1a1e..704f4f810928 100644 --- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx +++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx @@ -83,7 +83,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend public: PackageImpl( ::rtl::Reference const & myBackend, - OUString const & url, OUString const & libType, bool bUseDb); + OUString const & url, OUString const & libType, bool bRemoved, + OUString const & identifier); // XPackage virtual OUString SAL_CALL getDescription() throw (RuntimeException); }; @@ -92,7 +93,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, - sal_Bool bNoFileAccess, + sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ); const Reference m_xTypeInfo; @@ -133,9 +134,10 @@ OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException) //______________________________________________________________________________ BackendImpl::PackageImpl::PackageImpl( ::rtl::Reference const & myBackend, - OUString const & url, OUString const & libType, bool bUseDb) + OUString const & url, OUString const & libType, bool bRemoved, + OUString const & identifier) : Package( myBackend.get(), url, OUString(), OUString(), - myBackend->m_xTypeInfo, bUseDb ), + myBackend->m_xTypeInfo, bRemoved, identifier), m_descr(libType) { initPackageHandler(); @@ -219,8 +221,8 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException) // PackageRegistryBackend //______________________________________________________________________________ Reference BackendImpl::bindPackage_( - OUString const & url, OUString const & mediaType_, sal_Bool bNoFileAccess, - Reference const & xCmdEnv ) + OUString const & url, OUString const & mediaType_, sal_Bool bRemoved, + OUString const & identifier, Reference const & xCmdEnv ) { OUString mediaType( mediaType_ ); if (mediaType.getLength() == 0) @@ -296,7 +298,7 @@ Reference BackendImpl::bindPackage_( dp_misc::TRACE(OUSTR(" BackEnd detected lang = ") + lang + OUSTR("\n")); dp_misc::TRACE(OUSTR(" for url ") + sParcelDescURL + OUSTR("\n") ); dp_misc::TRACE("******************************\n"); - return new PackageImpl( this, url, sfwkLibType, bNoFileAccess); + return new PackageImpl( this, url, sfwkLibType, bRemoved, identifier); } } } diff --git a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java index 3b9e04a27210..4c6a4f1eda2b 100644 --- a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java +++ b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java @@ -44,6 +44,7 @@ import com.sun.star.io.XOutputStream; import com.sun.star.io.XTruncate; import com.sun.star.deployment.XPackage; +import com.sun.star.deployment.ExtensionRemovedException; public class UnoPkgContainer extends ParcelContainer { @@ -336,7 +337,15 @@ public class UnoPkgContainer extends ParcelContainer LogUtils.DEBUG("** processUnoPackage getURL() -> " + uri ); LogUtils.DEBUG("** processUnoPackage getName() -> " + dPackage.getName() ); LogUtils.DEBUG("** processUnoPackage getMediaType() -> " + dPackage.getPackageType().getMediaType() ); - LogUtils.DEBUG("** processUnoPackage getDisplayName() -> " + dPackage.getDisplayName() ); + try + { + LogUtils.DEBUG("** processUnoPackage getDisplayName() -> " + dPackage.getDisplayName() ); + } + catch (com.sun.star.deployment.ExtensionRemovedException e) + { + throw new com.sun.star.lang.WrappedTargetException(e.toString(), this, e); + } + processUnoPackage( uri, language ); db = getUnoPackagesDB(); -- cgit From a13b1c857a8bc6657a14eb46e7e9663ff2bc9fa4 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 25 Mar 2010 10:32:07 +0100 Subject: jl152 import 263441 from native0jl:#i77196# add and remove in the same process now works, help backend creates a unique folder for every extension --- desktop/source/deployment/manager/dp_manager.cxx | 74 +++- .../registry/component/dp_compbackenddb.cxx | 61 ++- .../registry/component/dp_compbackenddb.hxx | 2 +- desktop/source/deployment/registry/dp_backend.cxx | 86 ++++ .../source/deployment/registry/dp_backenddb.cxx | 36 +- desktop/source/deployment/registry/dp_registry.cxx | 2 +- .../source/deployment/registry/help/dp_help.cxx | 463 ++++++++++++--------- .../deployment/registry/help/dp_helpbackenddb.cxx | 224 ++++++++++ .../deployment/registry/help/dp_helpbackenddb.hxx | 101 +++++ .../source/deployment/registry/help/makefile.mk | 3 +- .../source/deployment/registry/inc/dp_backend.h | 18 + .../deployment/registry/inc/dp_backenddb.hxx | 5 + .../registry/package/dp_extbackenddb.cxx | 48 +-- .../registry/package/dp_extbackenddb.hxx | 2 +- 14 files changed, 836 insertions(+), 289 deletions(-) create mode 100644 desktop/source/deployment/registry/help/dp_helpbackenddb.cxx create mode 100644 desktop/source/deployment/registry/help/dp_helpbackenddb.hxx diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 9b4f51ea89dd..e2580e7b955b 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -39,6 +39,7 @@ #include "rtl/bootstrap.hxx" #include "osl/diagnose.h" #include "osl/file.hxx" +#include "osl/security.hxx" #include "cppuhelper/weakref.hxx" #include "cppuhelper/exc_hlp.hxx" #include "cppuhelper/implbase1.hxx" @@ -237,23 +238,37 @@ void PackageManagerImpl::initActivationLayer( ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) ); // get all temp directories: ::std::vector tempEntries; + ::std::vector removedEntries; while (xResultSet->next()) { OUString title( Reference( xResultSet, UNO_QUERY_THROW )->getString( 1 /* Title */ ) ); - const char extensionRemoved[] = ".tmpremoved"; + + const char extensionRemoved[] = "removed"; if (title.endsWithAsciiL( extensionRemoved, sizeof(extensionRemoved) - 1)) - continue; - - tempEntries.push_back( ::rtl::Uri::encode( - title, rtl_UriCharClassPchar, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ) ); + { + //save the file name withouth the "removed" part + sal_Int32 index = title.lastIndexOfAsciiL( + extensionRemoved, sizeof(extensionRemoved) - 1); + OUString remFile = title.copy(0, index); + removedEntries.push_back(::rtl::Uri::encode( + remFile, rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ) ); + } + else + { + tempEntries.push_back( ::rtl::Uri::encode( + title, rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ) ); + } } + bool bShared = m_context.equals(OUSTR("shared")) ? true : false; for ( ::std::size_t pos = 0; pos < tempEntries.size(); ++pos ) { OUString const & tempEntry = tempEntries[ pos ]; @@ -261,9 +276,44 @@ void PackageManagerImpl::initActivationLayer( if (::std::find_if( id2temp.begin(), id2temp.end(), match ) == id2temp.end()) { + const OUString url( + makeURL(m_activePackages_expanded, tempEntry ) ); + + //In case of shared extensions, new entries are regarded as + //added extensions if there is no xxx.tmpremoved file. + if (bShared) + { + if (::std::find(removedEntries.begin(), removedEntries.end(), tempEntry) == + removedEntries.end()) + { + continue; + } + else + { + //Make sure only the same user removes the extension, who + //previously unregistered it. This is avoid races if multiple instances + //of OOo are running which all have write access to the shared installation. + //For example, user a uses extension a, removes the extension, but keeps OOo + //running. Parts of the extension may still be loaded and used by OOo. + //Therefore the extension is only deleted the next time the extension manager is + //run after restarting OOo. While OOo is still running, another user starts OOo + //which would deleted the extension files. If the same user starts another + //instance of OOo then the lock file will prevent this. + OUString aUserName; + ::osl::Security aSecurity; + aSecurity.getUserName( aUserName ); + ucbhelper::Content remFileContent( + url + OUSTR("removed"), Reference()); + ::rtl::ByteSequence data = dp_misc::readFile(remFileContent); + ::rtl::OString osData(reinterpret_cast(data.getConstArray()), + data.getLength()); + OUString sData = ::rtl::OStringToOUString( + osData, RTL_TEXTENCODING_UTF8); + if (!sData.equals(aUserName)) + continue; + } + } // temp entry not needed anymore: - const OUString url( makeURL( m_activePackages_expanded, - tempEntry ) ); erase_path( url + OUSTR("_"), Reference(), false /* no throw: ignore errors */ ); @@ -911,7 +961,11 @@ void PackageManagerImpl::removePackage( OUString url(makeURL(m_activePackages_expanded, val.temporaryName + OUSTR("removed"))); ::ucbhelper::Content contentRemoved(url, xCmdEnv ); - ::rtl::OString stamp("1"); + OUString aUserName; + ::osl::Security aSecurity; + aSecurity.getUserName( aUserName ); + + ::rtl::OString stamp = ::rtl::OUStringToOString(aUserName, RTL_TEXTENCODING_UTF8); Reference xData( ::xmlscript::createInputStream( ::rtl::ByteSequence( diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.cxx b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx index a942b81a7e32..568ecca08138 100644 --- a/desktop/source/deployment/registry/component/dp_compbackenddb.cxx +++ b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx @@ -44,6 +44,7 @@ using namespace ::com::sun::star::uno; using ::rtl::OUString; #define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/component-registry/2010" +#define NS_PREFIX "comp" #define ROOT_ELEMENT_NAME "component-backend-db" namespace dp_registry { @@ -62,6 +63,11 @@ OUString ComponentBackendDb::getDbNSName() return OUSTR(EXTENSION_REG_NS); } +OUString ComponentBackendDb::getNSPrefix() +{ + return OUSTR(NS_PREFIX); +} + OUString ComponentBackendDb::getRootElementName() { return OUSTR(ROOT_ELEMENT_NAME); @@ -70,20 +76,21 @@ OUString ComponentBackendDb::getRootElementName() void ComponentBackendDb::addEntry(::rtl::OUString const & url, Data const & data) { try{ - + const OUString sNameSpace = getDbNSName(); + const OUString sPrefix = getNSPrefix(); Reference doc = getDocument(); Reference root = doc->getFirstChild(); #if OSL_DEBUG_LEVEL > 0 //There must not be yet an entry with the same url OUString sExpression( - OUSTR("reg:component[@url = \"") + url + OUSTR("\"]")); + sPrefix + OUSTR(":component[@url = \"") + url + OUSTR("\"]")); Reference _extensionNode = getXPathAPI()->selectSingleNode(root, sExpression); OSL_ASSERT(! _extensionNode.is()); #endif Reference componentElement( - doc->createElement(OUSTR("component"))); + doc->createElementNS(sNameSpace, sPrefix + OUSTR(":component"))); componentElement->setAttribute(OUSTR("url"), url); @@ -92,18 +99,8 @@ void ComponentBackendDb::addEntry(::rtl::OUString const & url, Data const & data root->appendChild(componentNode); -// Reference name( -// doc->createElement(OUSTR("name")), UNO_QUERY_THROW); - -// componentNode->appendChild(name); - -// Reference nameValue( -// doc->createTextNode(data.name), -// UNO_QUERY_THROW); -// name->appendChild(nameValue); - Reference javaTypeLibNode( - doc->createElement(OUSTR("java-type-library")), UNO_QUERY_THROW); + doc->createElementNS(sNameSpace, sPrefix + OUSTR(":java-type-library")), UNO_QUERY_THROW); componentNode->appendChild(javaTypeLibNode); @@ -114,16 +111,16 @@ void ComponentBackendDb::addEntry(::rtl::OUString const & url, Data const & data writeSimpleList( data.implementationNames, - OUSTR("implementation-names"), - OUSTR("name"), + sPrefix + OUSTR(":implementation-names"), + sPrefix + OUSTR(":name"), componentNode); writeVectorOfPair( data.singletons, - OUSTR("singletons"), - OUSTR("item"), - OUSTR("key"), - OUSTR("value"), + sPrefix + OUSTR(":singletons"), + sPrefix + OUSTR(":item"), + sPrefix + OUSTR(":key"), + sPrefix + OUSTR(":value"), componentNode); save(); @@ -140,7 +137,7 @@ void ComponentBackendDb::addEntry(::rtl::OUString const & url, Data const & data void ComponentBackendDb::removeEntry(::rtl::OUString const & url) { OUString sExpression( - OUSTR("reg:component[@url = \"") + url + OUSTR("\"]")); + OUSTR(NS_PREFIX) + OUSTR(":component[@url = \"") + url + OUSTR("\"]")); removeElement(sExpression); } @@ -148,9 +145,10 @@ ComponentBackendDb::Data ComponentBackendDb::getEntry(::rtl::OUString const & ur { try { + const OUString sPrefix = getNSPrefix(); ComponentBackendDb::Data retData; const OUString sExpression( - OUSTR("reg:component[@url = \"") + url + OUSTR("\"]")); + sPrefix + OUSTR(":component[@url = \"") + url + OUSTR("\"]")); Reference doc = getDocument(); Reference root = doc->getFirstChild(); @@ -160,13 +158,7 @@ ComponentBackendDb::Data ComponentBackendDb::getEntry(::rtl::OUString const & ur xpathApi->selectSingleNode(root, sExpression); if (aNode.is()) { -// const OUString sExprName(OUSTR("reg:name/text()")); - -// Reference nameValue = -// xpathApi->selectSingleNode(aNode, sExprName); -// retData.name = nameValue->getNodeValue(); - - const OUString sExprJavaTypeLib(OUSTR("reg:java-type-library/text()")); + const OUString sExprJavaTypeLib(sPrefix + OUSTR(":java-type-library/text()")); Reference idValueNode = xpathApi->selectSingleNode(aNode, sExprJavaTypeLib); @@ -175,12 +167,17 @@ ComponentBackendDb::Data ComponentBackendDb::getEntry(::rtl::OUString const & ur retData.implementationNames = readList( - aNode, OUSTR("reg:implementation-names"), OUSTR("reg:name")); + aNode, + sPrefix + OUSTR(":implementation-names"), + sPrefix + OUSTR(":name")); retData.singletons = readVectorOfPair( - aNode, OUSTR("reg:singletons"), OUSTR("item"), OUSTR("key"), - OUSTR("value")); + aNode, + sPrefix + OUSTR(":singletons"), + sPrefix + OUSTR(":item"), + sPrefix + OUSTR(":key"), + sPrefix + OUSTR(":value")); } return retData; } diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.hxx b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx index 29ac4e50fe88..90ff41f2a4b8 100644 --- a/desktop/source/deployment/registry/component/dp_compbackenddb.hxx +++ b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx @@ -83,7 +83,7 @@ class ComponentBackendDb: public dp_registry::backend::BackendDb { protected: virtual ::rtl::OUString getDbNSName(); - + virtual ::rtl::OUString getNSPrefix(); virtual ::rtl::OUString getRootElementName(); public: diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 7ee49fc46734..dcfc2c6b3d2f 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -31,13 +31,18 @@ #include "dp_backend.h" #include "dp_ucb.h" #include "rtl/uri.hxx" +#include "osl/file.hxx" #include "cppuhelper/exc_hlp.hxx" #include "comphelper/servicedecl.hxx" #include "comphelper/unwrapargs.hxx" #include "ucbhelper/content.hxx" #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" #include "com/sun/star/deployment/InvalidRemovedParameterException.hpp" +#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" +#include "com/sun/star/ucb/IOErrorCode.hpp" #include "com/sun/star/beans/StringPair.hpp" +#include "com/sun/star/sdbc/XResultSet.hpp" +#include "com/sun/star/sdbc/XRow.hpp" using namespace ::dp_misc; @@ -208,6 +213,87 @@ Reference PackageRegistryBackend::bindPackage( return xNewPackage; } +OUString PackageRegistryBackend::createFolder( + OUString const & relUrl, + Reference const & xCmdEnv) +{ + OUString sDataFolder = makeURL(getCachePath(), relUrl); + //make sure the folder exist + ucbhelper::Content dataContent; + ::dp_misc::create_folder(&dataContent, sDataFolder, xCmdEnv); + + OUString sDataFolderURL = dp_misc::expandUnoRcUrl(sDataFolder); + + OUString tempEntry; + if (::osl::File::createTempFile( + &sDataFolderURL, 0, &tempEntry ) != ::osl::File::E_None) + throw RuntimeException( + OUSTR("::osl::File::createTempFile() failed!"), 0 ); + tempEntry = tempEntry.copy( tempEntry.lastIndexOf( '/' ) + 1 ); + OUString destFolder= makeURL(sDataFolder, tempEntry) + OUSTR("_"); + ::ucbhelper::Content destFolderContent; + dp_misc::create_folder( &destFolderContent, destFolder, xCmdEnv ); + + return destFolder; +} + +void PackageRegistryBackend::deleteUnusedFolders( + OUString const & relUrl, + ::std::list< OUString> const & usedFolders) +{ + try + { + const OUString sDataFolder = makeURL(getCachePath(), relUrl); + ::ucbhelper::Content tempFolder( + sDataFolder, Reference()); + Reference xResultSet( + tempFolder.createCursor( + Sequence( &StrTitle::get(), 1 ), + ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) ); + // get all temp directories: + ::std::vector tempEntries; + + char tmp[] = ".tmp"; + + while (xResultSet->next()) + { + OUString title( + Reference( + xResultSet, UNO_QUERY_THROW )->getString( + 1 /* Title */ ) ); + + if (title.endsWithAsciiL(tmp, sizeof(tmp) - 1)) + tempEntries.push_back( + makeURLAppendSysPathSegment(sDataFolder, title)); + } + + for ( ::std::size_t pos = 0; pos < tempEntries.size(); ++pos ) + { + //usedFolders contains the urls to the folders which have + //a trailing underscore + const OUString tempFile = tempEntries[ pos ]; + const OUString tempFolder = tempFile + OUSTR("_"); + + if (::std::find( usedFolders.begin(), usedFolders.end(), tempFolder ) == + usedFolders.end()) + { + erase_path( tempFolder, Reference(), + false /* no throw: ignore errors */ ); + erase_path( tempFile, Reference(), + false /* no throw: ignore errors */ ); + } + } + } + catch (ucb::InteractiveAugmentedIOException& e) + { + //In case the folder containing all the data folder does not + //exist yet, we ignore the exception + if (e.Code != ucb::IOErrorCode_NOT_EXISTING) + throw e; + } + +} + //############################################################################## //______________________________________________________________________________ diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx index 339236126796..1c0451c77cd6 100644 --- a/desktop/source/deployment/registry/dp_backenddb.cxx +++ b/desktop/source/deployment/registry/dp_backenddb.cxx @@ -98,9 +98,10 @@ css::uno::Reference BackendDb::getDocument() //Create a new document and insert some basic stuff m_doc = xDocBuilder->newDocument(); Reference rootNode = - m_doc->createElement(getRootElementName()); - rootNode->setAttribute( - OUSTR("xmlns"), getDbNSName()); + m_doc->createElementNS(getDbNSName(), getNSPrefix() + + OUSTR(":") + getRootElementName()); +// rootNode->setAttribute( +// OUSTR("xmlns"), getDbNSName()); m_doc->appendChild(Reference( rootNode, UNO_QUERY_THROW)); save(); @@ -133,23 +134,12 @@ Reference BackendDb::getXPathAPI() OUSTR(" Could not create service com.sun.star.xml.xpath.XPathAPI"), 0); m_xpathApi->registerNS( - OUSTR("reg"), getDbNSName()); + getNSPrefix(), getDbNSName()); } return m_xpathApi; } -// OUString BackendDb::getDbNSName() -// { -// return OUString(); -// } - - -// OUString BackendDb::getRootElementName() -// { -// return OUString(); -// } - void BackendDb::removeElement(::rtl::OUString const & sXPathExpression) { try @@ -193,12 +183,13 @@ void BackendDb::writeVectorOfPair( css::uno::Reference const & xParent) { try{ - + const OUString sNameSpace = getDbNSName(); + OSL_ASSERT(sNameSpace.getLength()); Reference doc = getDocument(); Reference root = doc->getFirstChild(); Reference vectorNode( - doc->createElement(sVectorTagName)); + doc->createElementNS(sNameSpace, sVectorTagName)); xParent->appendChild( Reference( @@ -207,14 +198,14 @@ void BackendDb::writeVectorOfPair( for (CIT i = vecPairs.begin(); i != vecPairs.end(); i++) { Reference pairNode( - doc->createElement(sPairTagName)); + doc->createElementNS(sNameSpace, sPairTagName)); vectorNode->appendChild( Reference( pairNode, css::uno::UNO_QUERY_THROW)); Reference firstNode( - doc->createElement(sFirstTagName)); + doc->createElementNS(sNameSpace, sFirstTagName)); pairNode->appendChild( Reference( @@ -228,7 +219,7 @@ void BackendDb::writeVectorOfPair( firstTextNode, css::uno::UNO_QUERY_THROW)); Reference secondNode( - doc->createElement(sSecondTagName)); + doc->createElementNS(sNameSpace, sSecondTagName)); pairNode->appendChild( Reference( @@ -304,10 +295,11 @@ void BackendDb::writeSimpleList( { try { + const OUString sNameSpace = getDbNSName(); Reference doc = getDocument(); Reference listNode( - doc->createElement(sListTagName)); + doc->createElementNS(sNameSpace, sListTagName)); xParent->appendChild( Reference( @@ -317,7 +309,7 @@ void BackendDb::writeSimpleList( for (ITC_ITEMS i = list.begin(); i != list.end(); i++) { Reference memberNode( - doc->createElement(sMemberTagName), css::uno::UNO_QUERY_THROW); + doc->createElementNS(sNameSpace, sMemberTagName), css::uno::UNO_QUERY_THROW); listNode->appendChild(memberNode); diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index 0b3b9e80a7d7..e35b37bdeb07 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -115,6 +115,7 @@ protected: virtual ~PackageRegistryImpl(); PackageRegistryImpl() : t_helper( getMutex() ) {} + public: static Reference create( OUString const & context, @@ -536,7 +537,6 @@ PackageRegistryImpl::getSupportedPackageTypes() throw (RuntimeException) { return comphelper::containerToSequence(m_typesInfos); } - } // anon namespace //============================================================================== diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 9fd9e7ae79fc..b594f9395ceb 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -30,9 +30,11 @@ #include "dp_help.hrc" #include "dp_backend.h" +#include "dp_helpbackenddb.hxx" #include "dp_ucb.h" #include "rtl/uri.hxx" #include "osl/file.hxx" +#include "rtl/bootstrap.hxx" #include "ucbhelper/content.hxx" #include "comphelper/servicedecl.hxx" #include "svl/inettype.hxx" @@ -45,6 +47,7 @@ #include #include + using namespace ::dp_misc; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -63,6 +66,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend { BackendImpl * getMyBackend() const; + HelpBackendDb::Data m_dbData; + // Package virtual beans::Optional< beans::Ambiguous > isRegistered_( ::osl::ResettableMutexGuard & guard, @@ -79,9 +84,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, - bool bRemoved, OUString const & identifier) - : Package( myBackend, url, name, name, xPackageType, bRemoved, identifier) - {} + bool bRemoved, OUString const & identifier); }; friend class PackageImpl; @@ -91,18 +94,25 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ); - void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage ); + void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, + Reference const & xCmdEnv); void implCollectXhpFiles( const rtl::OUString& aDir, std::vector< rtl::OUString >& o_rXhpFileVector ); rtl::OUString getFlagFileURL( Reference< deployment::XPackage > xPackage, const char* pFlagStr ); rtl::OUString getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage ); rtl::OUString getCompiledFlagFileURL( Reference< deployment::XPackage > xPackage ); rtl::OUString expandURL( const rtl::OUString& aURL ); + + void addDataToDb(OUString const & url, HelpBackendDb::Data const & data); + HelpBackendDb::Data readDataFromDb(OUString const & url); + void deleteDataFromDb(OUString const & url); + Reference< ucb::XSimpleFileAccess > getFileAccess( void ); Reference< ucb::XSimpleFileAccess > m_xSFA; const Reference m_xHelpTypeInfo; Sequence< Reference > m_typeInfos; + std::auto_ptr m_backendDb; public: BackendImpl( Sequence const & args, @@ -126,6 +136,20 @@ BackendImpl::BackendImpl( m_typeInfos( 1 ) { m_typeInfos[ 0 ] = m_xHelpTypeInfo; + if (!transientMode()) + { + OUString dbFile = makeURL(getCachePath(), OUSTR("backenddb.xml")); + m_backendDb.reset( + new HelpBackendDb(getComponentContext(), dbFile)); + + //clean up data folders which are no longer used. + //This must not be done in the same process where the help files + //are still registers. Only after revoking and restarting OOo the folders + //can be removed. This works now, because the extension manager is a singleton + //and the backends are only create once per process. + ::std::list folders = m_backendDb->getAllDataUrls(); + deleteUnusedFolders(OUString(), folders); + } } // XPackageRegistry @@ -177,8 +201,39 @@ Reference BackendImpl::bindPackage_( static_cast(-1) ); } +void BackendImpl::addDataToDb( + OUString const & url, HelpBackendDb::Data const & data) +{ + if (m_backendDb.get()) + m_backendDb->addEntry(url, data); +} + +HelpBackendDb::Data BackendImpl::readDataFromDb( + OUString const & url) +{ + HelpBackendDb::Data data; + if (m_backendDb.get()) + data = m_backendDb->getEntry(url); + return data; +} + +void BackendImpl::deleteDataFromDb(OUString const & url) +{ + if (m_backendDb.get()) + m_backendDb->removeEntry(url); +} //############################################################################## +BackendImpl::PackageImpl::PackageImpl( + ::rtl::Reference const & myBackend, + OUString const & url, OUString const & name, + Reference const & xPackageType, + bool bRemoved, OUString const & identifier) + : Package( myBackend, url, name, name, xPackageType, bRemoved, identifier) +{ + if (bRemoved) + m_dbData = getMyBackend()->readDataFromDb(url); +} // Package BackendImpl * BackendImpl::PackageImpl::getMyBackend() const @@ -226,7 +281,14 @@ void BackendImpl::PackageImpl::processPackage_( BackendImpl* that = getMyBackend(); Reference< deployment::XPackage > xThisPackage( this ); - that->implProcessHelp( xThisPackage, doRegisterPackage ); + that->implProcessHelp( xThisPackage, doRegisterPackage, xCmdEnv); + +// HelpBackendDb::Data data; +// getMyBackend()->addDataToDb(getURL(), data); + +// } +// else +// getMyBackend()->deleteDataFromDb(getURL()); } //############################################################################## @@ -234,235 +296,246 @@ void BackendImpl::PackageImpl::processPackage_( static rtl::OUString aSlash( rtl::OUString::createFromAscii( "/" ) ); static rtl::OUString aHelpStr( rtl::OUString::createFromAscii( "help" ) ); + void BackendImpl::implProcessHelp - ( Reference< deployment::XPackage > xPackage, bool doRegisterPackage ) +( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, + Reference const & xCmdEnv) { - if( !xPackage.is() ) - return; - - Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); - - rtl::OUString aRegisteredFlagFile = getRegisteredFlagFileURL( xPackage ); - if( !doRegisterPackage ) + OSL_ASSERT(xPackage.is()); + if (doRegisterPackage) { - if( xSFA->exists( aRegisteredFlagFile ) ) - xSFA->kill( aRegisteredFlagFile ); - return; - } + HelpBackendDb::Data data; + Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); - bool bCompile = true; - rtl::OUString aCompiledFlagFile = getCompiledFlagFileURL( xPackage ); - if( xSFA->exists( aCompiledFlagFile ) ) - bCompile = false; - - if( bCompile ) - { - rtl::OUString aHelpURL = xPackage->getURL(); - rtl::OUString aExpandedHelpURL = expandURL( aHelpURL ); - rtl::OUString aName = xPackage->getName(); - if( !xSFA->isFolder( aExpandedHelpURL ) ) + rtl::OUString aRegisteredFlagFile = getRegisteredFlagFileURL( xPackage ); + if( !doRegisterPackage ) { - rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR ); - aErrStr += rtl::OUString::createFromAscii( "No help folder" ); - OWeakObject* oWeakThis = static_cast(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + if( xSFA->exists( aRegisteredFlagFile ) ) + xSFA->kill( aRegisteredFlagFile ); + return; } - Reference const & xContext = getComponentContext(); - Reference< script::XInvocation > xInvocation; - if( xContext.is() ) + bool bCompile = true; + rtl::OUString aCompiledFlagFile = getCompiledFlagFileURL( xPackage ); + if( xSFA->exists( aCompiledFlagFile ) ) + bCompile = false; + + if( bCompile ) { - try + OUString sHelpFolder = createFolder(OUString(), xCmdEnv); + data.dataUrl = sHelpFolder; + rtl::OUString aHelpURL = xPackage->getURL(); + rtl::OUString aExpandedHelpURL = expandURL( aHelpURL ); + rtl::OUString aName = xPackage->getName(); + if( !xSFA->isFolder( aExpandedHelpURL ) ) { - xInvocation = Reference< script::XInvocation >( - xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( - "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY ); + rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR ); + aErrStr += rtl::OUString::createFromAscii( "No help folder" ); + OWeakObject* oWeakThis = static_cast(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); } - catch (Exception &) + + Reference const & xContext = getComponentContext(); + Reference< script::XInvocation > xInvocation; + if( xContext.is() ) { - // i98680: Survive missing lucene + try + { + xInvocation = Reference< script::XInvocation >( + xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( + "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY ); + } + catch (Exception &) + { + // i98680: Survive missing lucene + } } - } - // Scan languages - Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true ); - sal_Int32 nLangCount = aLanguageFolderSeq.getLength(); - const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray(); - for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang ) - { - rtl::OUString aLangURL = pSeq[iLang]; - if( xSFA->isFolder( aLangURL ) ) + // Scan languages + Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true ); + sal_Int32 nLangCount = aLanguageFolderSeq.getLength(); + const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray(); + for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang ) { - std::vector< rtl::OUString > aXhpFileVector; - - // Delete (old) files in any case to allow compiler to be started every time - rtl::OUString aLangWithPureNameURL( aLangURL ); - aLangWithPureNameURL += aSlash; - aLangWithPureNameURL += aHelpStr; - rtl::OUString aDbFile( aLangWithPureNameURL ); - aDbFile += rtl::OUString::createFromAscii( ".db" ); - if( xSFA->exists( aDbFile ) ) - xSFA->kill( aDbFile ); - rtl::OUString aHtFile( aLangWithPureNameURL ); - aHtFile += rtl::OUString::createFromAscii( ".ht" ); - if( xSFA->exists( aHtFile ) ) - xSFA->kill( aHtFile ); - rtl::OUString aKeyFile( aLangWithPureNameURL ); - aKeyFile += rtl::OUString::createFromAscii( ".key" ); - if( xSFA->exists( aKeyFile ) ) - xSFA->kill( aKeyFile ); - - // calculate jar file URL - rtl::OUString aJarFile( aLangURL ); - aJarFile += aSlash; - aJarFile += aHelpStr; - aJarFile += rtl::OUString::createFromAscii( ".jar" ); - // remove in any case to clean up - if( xSFA->exists( aJarFile ) ) - xSFA->kill( aJarFile ); - - rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( aJarFile, - rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ); - rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); - aDestBasePath += aEncodedJarFilePath; - aDestBasePath += rtl::OUString::createFromAscii( "/" ); - - sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1; - - Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true ); - sal_Int32 nSubLangCount = aSubLangSeq.getLength(); - const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray(); - for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang ) + rtl::OUString aLangURL = pSeq[iLang]; + if( xSFA->isFolder( aLangURL ) ) { - rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang]; - if( !xSFA->isFolder( aSubFolderURL ) ) - continue; + std::vector< rtl::OUString > aXhpFileVector; + + // Delete (old) files in any case to allow compiler to be started every time + rtl::OUString aLangWithPureNameURL( aLangURL ); + aLangWithPureNameURL += aSlash; + aLangWithPureNameURL += aHelpStr; + rtl::OUString aDbFile( aLangWithPureNameURL ); + aDbFile += rtl::OUString::createFromAscii( ".db" ); + if( xSFA->exists( aDbFile ) ) + xSFA->kill( aDbFile ); + rtl::OUString aHtFile( aLangWithPureNameURL ); + aHtFile += rtl::OUString::createFromAscii( ".ht" ); + if( xSFA->exists( aHtFile ) ) + xSFA->kill( aHtFile ); + rtl::OUString aKeyFile( aLangWithPureNameURL ); + aKeyFile += rtl::OUString::createFromAscii( ".key" ); + if( xSFA->exists( aKeyFile ) ) + xSFA->kill( aKeyFile ); + + // calculate jar file URL + rtl::OUString aJarFile( aLangURL ); + aJarFile += aSlash; + aJarFile += aHelpStr; + aJarFile += rtl::OUString::createFromAscii( ".jar" ); + // remove in any case to clean up + if( xSFA->exists( aJarFile ) ) + xSFA->kill( aJarFile ); + + rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( aJarFile, + rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ); + rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); + aDestBasePath += aEncodedJarFilePath; + aDestBasePath += rtl::OUString::createFromAscii( "/" ); + + sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1; + + Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true ); + sal_Int32 nSubLangCount = aSubLangSeq.getLength(); + const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray(); + for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang ) + { + rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang]; + if( !xSFA->isFolder( aSubFolderURL ) ) + continue; - implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); + implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); - // Copy to package (later: move?) - rtl::OUString aDestPath = aDestBasePath; - rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); - aDestPath += aPureFolderName; - xSFA->copy( aSubFolderURL, aDestPath ); - } + // Copy to package (later: move?) + rtl::OUString aDestPath = aDestBasePath; + rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); + aDestPath += aPureFolderName; + xSFA->copy( aSubFolderURL, aDestPath ); + } - // Call compiler - sal_Int32 nXhpFileCount = aXhpFileVector.size(); - rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount]; - for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) - { - rtl::OUString aXhpFile = aXhpFileVector[iXhp]; - rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL ); - pXhpFiles[iXhp] = aXhpRelFile; - } + // Call compiler + sal_Int32 nXhpFileCount = aXhpFileVector.size(); + rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount]; + for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) + { + rtl::OUString aXhpFile = aXhpFileVector[iXhp]; + rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL ); + pXhpFiles[iXhp] = aXhpRelFile; + } - rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); - rtl::OUString aOfficeHelpPathFileURL; - ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); + rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); + rtl::OUString aOfficeHelpPathFileURL; + ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); - HelpProcessingErrorInfo aErrorInfo; - bool bSuccess = compileExtensionHelp( aOfficeHelpPathFileURL, aHelpStr, aLangURL, - nXhpFileCount, pXhpFiles, aErrorInfo ); + HelpProcessingErrorInfo aErrorInfo; + bool bSuccess = compileExtensionHelp( aOfficeHelpPathFileURL, aHelpStr, aLangURL, + nXhpFileCount, pXhpFiles, aErrorInfo ); - if( bSuccess && xInvocation.is() ) - { - Sequence aParamsSeq( 6 ); - - aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) ); - - rtl::OUString aLang; - sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); - if( nLastSlash != -1 ) - aLang = aLangURL.copy( nLastSlash + 1 ); - else - aLang = rtl::OUString::createFromAscii( "en" ); - aParamsSeq[1] = uno::makeAny( aLang ); - - aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) ); - aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) ); - - aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) ); - rtl::OUString aSystemPath; - osl::FileBase::getSystemPathFromFileURL( aLangURL, aSystemPath ); - aParamsSeq[5] = uno::makeAny( aSystemPath ); - - Sequence< sal_Int16 > aOutParamIndex; - Sequence< uno::Any > aOutParam; - uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ), - aParamsSeq, aOutParamIndex, aOutParam ); - } + if( bSuccess && xInvocation.is() ) + { + Sequence aParamsSeq( 6 ); + + aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) ); + + rtl::OUString aLang; + sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); + if( nLastSlash != -1 ) + aLang = aLangURL.copy( nLastSlash + 1 ); + else + aLang = rtl::OUString::createFromAscii( "en" ); + aParamsSeq[1] = uno::makeAny( aLang ); + + aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) ); + aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) ); + + aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) ); + rtl::OUString aSystemPath; + osl::FileBase::getSystemPathFromFileURL( aLangURL, aSystemPath ); + aParamsSeq[5] = uno::makeAny( aSystemPath ); + + Sequence< sal_Int16 > aOutParamIndex; + Sequence< uno::Any > aOutParam; + uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ), + aParamsSeq, aOutParamIndex, aOutParam ); + } - if( !bSuccess ) - { - USHORT nErrStrId = 0; - switch( aErrorInfo.m_eErrorClass ) + if( !bSuccess ) { + USHORT nErrStrId = 0; + switch( aErrorInfo.m_eErrorClass ) + { case HELPPROCESSING_GENERAL_ERROR: case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break; default: ; - }; + }; - rtl::OUString aErrStr; - if( nErrStrId != 0 ) - { - aErrStr = getResourceString( nErrStrId ); - - // Remoce CR/LF - rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg ); - sal_Unicode nCR = 13, nLF = 10; - sal_Int32 nSearchCR = aErrMsg.indexOf( nCR ); - sal_Int32 nSearchLF = aErrMsg.indexOf( nLF ); - sal_Int32 nCopy; - if( nSearchCR != -1 || nSearchLF != -1 ) + rtl::OUString aErrStr; + if( nErrStrId != 0 ) { - if( nSearchCR == -1 ) - nCopy = nSearchLF; - else if( nSearchLF == -1 ) - nCopy = nSearchCR; - else - nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF; - - aErrMsg = aErrMsg.copy( 0, nCopy ); - } - aErrStr += aErrMsg; - if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() ) - { - aErrStr += rtl::OUString::createFromAscii( " in " ); - - rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile, - rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - aErrStr += aDecodedFile; - if( aErrorInfo.m_nXMLParsingLine != -1 ) + aErrStr = getResourceString( nErrStrId ); + + // Remoce CR/LF + rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg ); + sal_Unicode nCR = 13, nLF = 10; + sal_Int32 nSearchCR = aErrMsg.indexOf( nCR ); + sal_Int32 nSearchLF = aErrMsg.indexOf( nLF ); + sal_Int32 nCopy; + if( nSearchCR != -1 || nSearchLF != -1 ) { - aErrStr += rtl::OUString::createFromAscii( ", line " ); - aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine ); + if( nSearchCR == -1 ) + nCopy = nSearchLF; + else if( nSearchLF == -1 ) + nCopy = nSearchCR; + else + nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF; + + aErrMsg = aErrMsg.copy( 0, nCopy ); + } + aErrStr += aErrMsg; + if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() ) + { + aErrStr += rtl::OUString::createFromAscii( " in " ); + + rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile, + rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + aErrStr += aDecodedFile; + if( aErrorInfo.m_nXMLParsingLine != -1 ) + { + aErrStr += rtl::OUString::createFromAscii( ", line " ); + aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine ); + } } } - } - OWeakObject* oWeakThis = static_cast(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + OWeakObject* oWeakThis = static_cast(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + } } } - } - // Write compiled flag file (this code is only reached in case of success) - Reference< io::XOutputStream > xOutputStream = xSFA->openFileWrite( aCompiledFlagFile ); - if( xOutputStream.is() ) - xOutputStream->closeOutput(); + // Write compiled flag file (this code is only reached in case of success) + Reference< io::XOutputStream > xOutputStream = xSFA->openFileWrite( aCompiledFlagFile ); + if( xOutputStream.is() ) + xOutputStream->closeOutput(); - } // if( bCompile ) + } // if( bCompile ) - // Write registered flag file (this code is only reached in case of success) - if( !xSFA->exists( aRegisteredFlagFile ) ) + // Write registered flag file (this code is only reached in case of success) + if( !xSFA->exists( aRegisteredFlagFile ) ) + { + Reference< io::XOutputStream > xOutputStream = xSFA->openFileWrite( aRegisteredFlagFile ); + if( xOutputStream.is() ) + xOutputStream->closeOutput(); + } + addDataToDb(xPackage->getURL(), data); + } + else { - Reference< io::XOutputStream > xOutputStream = xSFA->openFileWrite( aRegisteredFlagFile ); - if( xOutputStream.is() ) - xOutputStream->closeOutput(); + deleteDataFromDb(xPackage->getURL()); } } diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx new file mode 100644 index 000000000000..6f7e1d2844ac --- /dev/null +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx @@ -0,0 +1,224 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dp_package.cxx,v $ + * $Revision: 1.34.16.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "rtl/string.h" +#include "rtl/bootstrap.hxx" +#include "cppuhelper/exc_hlp.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/xml/dom/XDocumentBuilder.hpp" +#include "com/sun/star/xml/xpath/XXPathAPI.hpp" +#include "dp_misc.h" + +#include "dp_helpbackenddb.hxx" + + +namespace css = ::com::sun::star; +using namespace ::com::sun::star::uno; +using ::rtl::OUString; + +#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/help-registry/2010" +#define NS_PREFIX "help" +#define ROOT_ELEMENT_NAME "help-backend-db" + +namespace dp_registry { +namespace backend { +namespace help { + +HelpBackendDb::HelpBackendDb( + Reference const & xContext, + ::rtl::OUString const & url):BackendDb(xContext, url) +{ + +} + +OUString HelpBackendDb::getDbNSName() +{ + return OUSTR(EXTENSION_REG_NS); +} + +OUString HelpBackendDb::getNSPrefix() +{ + return OUSTR(NS_PREFIX); +} + +OUString HelpBackendDb::getRootElementName() +{ + return OUSTR(ROOT_ELEMENT_NAME); +} + +void HelpBackendDb::addEntry(::rtl::OUString const & url, Data const & data) +{ + try{ + + const OUString sNameSpace = getDbNSName(); + const OUString sPrefix = getNSPrefix(); + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + +#if OSL_DEBUG_LEVEL > 0 + //There must not be yet an entry with the same url + OUString sExpression( + sPrefix + OUSTR(":help[@url = \"") + url + OUSTR("\"]")); + Reference _extensionNode = + getXPathAPI()->selectSingleNode(root, sExpression); + OSL_ASSERT(! _extensionNode.is()); +#endif + Reference helpElement( + doc->createElementNS(sNameSpace, sPrefix + OUSTR(":help"))); + + helpElement->setAttribute(OUSTR("url"), url); + + Reference helpNode( + helpElement, UNO_QUERY_THROW); + root->appendChild(helpNode); + + Reference dataNode( + doc->createElementNS(sNameSpace, sPrefix + OUSTR(":data-url")), + UNO_QUERY_THROW); + helpNode->appendChild(dataNode); + + Reference dataValue( + doc->createTextNode(data.dataUrl), UNO_QUERY_THROW); + dataNode->appendChild(dataValue); + +// writeSimpleList( +// data.implementationNames, +// OUSTR("implementation-names"), +// OUSTR("name"), +// componentNode); + +// writeVectorOfPair( +// data.singletons, +// OUSTR("singletons"), +// OUSTR("item"), +// OUSTR("key"), +// OUSTR("value"), +// componentNode); + + save(); + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to write data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + +void HelpBackendDb::removeEntry(::rtl::OUString const & url) +{ + OUString sExpression( + OUSTR(NS_PREFIX) + OUSTR(":help[@url = \"") + url + OUSTR("\"]")); + removeElement(sExpression); +} + +HelpBackendDb::Data HelpBackendDb::getEntry(::rtl::OUString const & url) +{ + try + { + const OUString sPrefix = getNSPrefix(); + HelpBackendDb::Data retData; + const OUString sExpression( + sPrefix + OUSTR(":help[@url = \"") + url + OUSTR("\"]")); + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + + Reference xpathApi = getXPathAPI(); + //find the extension element that is to be removed + Reference aNode = + xpathApi->selectSingleNode(root, sExpression); + if (aNode.is()) + { + const OUString sExprDataUrl(sPrefix + OUSTR(":data-url/text()")); + + Reference dataUrlVal = + xpathApi->selectSingleNode(aNode, sExprDataUrl); + retData.dataUrl = dataUrlVal->getNodeValue(); + +// retData.implementationNames = +// readList( +// aNode, OUSTR("reg:implementation-names"), OUSTR("reg:name")); + +// retData.singletons = +// readVectorOfPair( +// aNode, OUSTR("reg:singletons"), OUSTR("item"), OUSTR("key"), +// OUSTR("value")); + } + return retData; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + +::std::list HelpBackendDb::getAllDataUrls() +{ + try + { + ::std::list listRet; + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + + Reference xpathApi = getXPathAPI(); + const OUString sPrefix = getNSPrefix(); + OUString sExpression( + sPrefix + OUSTR(":help/") + sPrefix + OUSTR(":data-url/text()")); + Reference nodes = + xpathApi->selectNodeList(root, sExpression); + if (nodes.is()) + { + sal_Int32 length = nodes->getLength(); + for (sal_Int32 i = 0; i < length; i++) + listRet.push_back(nodes->item(i)->getNodeValue()); + } + return listRet; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + + +} // namespace help +} // namespace backend +} // namespace dp_registry + diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx new file mode 100644 index 000000000000..e80a24f85ab1 --- /dev/null +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dp_backend.h,v $ + * $Revision: 1.18 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_DP_HELPBACKENDDB_HXX +#define INCLUDED_DP_HELPBACKENDDB_HXX + +#include "rtl/ustring.hxx" +#include "rtl/string.hxx" +#include +#include +#include "dp_backenddb.hxx" + +namespace css = ::com::sun::star; + +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + } + namespace xml { namespace dom { + class XDocument; + class XNode; + }} + namespace xml { namespace xpath { + class XXPathAPI; + }} +}}} + +namespace dp_registry { +namespace backend { +namespace help { + +/* The XML file stores the extensions which are currently registered. + They will be removed when they are revoked. + The format looks like this: + + + */ +class HelpBackendDb: public dp_registry::backend::BackendDb +{ +protected: + virtual ::rtl::OUString getDbNSName(); + + virtual ::rtl::OUString getNSPrefix(); + + virtual ::rtl::OUString getRootElementName(); + +public: + struct Data + { + /* the URL to the folder containing the compiled help files, etc. + */ + ::rtl::OUString dataUrl; + + }; + +public: + + HelpBackendDb( css::uno::Reference const & xContext, + ::rtl::OUString const & url); + + void addEntry(::rtl::OUString const & url, Data const & data); + void removeEntry(::rtl::OUString const & url); + Data getEntry(::rtl::OUString const & url); + ::std::list< ::rtl::OUString> getAllDataUrls(); + +}; + + + +} +} +} +#endif + diff --git a/desktop/source/deployment/registry/help/makefile.mk b/desktop/source/deployment/registry/help/makefile.mk index ba904bb7f28a..d4934f71a46f 100644 --- a/desktop/source/deployment/registry/help/makefile.mk +++ b/desktop/source/deployment/registry/help/makefile.mk @@ -44,7 +44,8 @@ SRC1FILES = \ dp_help.src SLOFILES = \ - $(SLO)$/dp_help.obj + $(SLO)$/dp_help.obj \ + $(SLO)$/dp_helpbackenddb.obj .INCLUDE : ..$/..$/target.pmk .INCLUDE : target.mk diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 371faf579caf..24c6e4914fe1 100644 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -43,6 +43,7 @@ #include "com/sun/star/deployment/InvalidRemovedParameterException.hpp" #include #include +#include #include "dp_registry.hrc" namespace dp_registry @@ -314,6 +315,23 @@ protected: css::uno::Sequence const & args, css::uno::Reference const & xContext ); + /* creates a folder with a unique name. + If url is empty then it is created in the the backend folder, otherwise + at a location relative to that folder specified by url. + */ + ::rtl::OUString createFolder( + ::rtl::OUString const & relUrl, + css::uno::Reference const & xCmdEnv); + /* deletes folders and files. + + All folder all files which end with ".tmp" or ".tmp_" and which are + not used are deleted. + */ + void deleteUnusedFolders( + ::rtl::OUString const & relUrl, + ::std::list< ::rtl::OUString> const & usedFolders); + + public: struct StrRegisteringPackage : public ::dp_misc::StaticResourceString< StrRegisteringPackage, RID_STR_REGISTERING_PACKAGE> {}; diff --git a/desktop/source/deployment/registry/inc/dp_backenddb.hxx b/desktop/source/deployment/registry/inc/dp_backenddb.hxx index dbac54e10c6d..ca28f28ac390 100644 --- a/desktop/source/deployment/registry/inc/dp_backenddb.hxx +++ b/desktop/source/deployment/registry/inc/dp_backenddb.hxx @@ -109,6 +109,11 @@ protected: into the root element. */ virtual ::rtl::OUString getDbNSName()=0; + /* return the namespace prefix which is to be registered with the XPath API. + + The prefix can then be used in XPath expressions. + */ + virtual ::rtl::OUString getNSPrefix()=0; /* returns the name of the root element without any namespace prefix. */ virtual ::rtl::OUString getRootElementName()=0; diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.cxx b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx index 93aa62174e0f..99aa2178b421 100644 --- a/desktop/source/deployment/registry/package/dp_extbackenddb.cxx +++ b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx @@ -44,6 +44,7 @@ using namespace ::com::sun::star::uno; using ::rtl::OUString; #define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/extension-registry/2010" +#define NS_PREFIX "ext" #define ROOT_ELEMENT_NAME "extension-backend-db" namespace dp_registry { @@ -62,6 +63,11 @@ OUString ExtensionBackendDb::getDbNSName() return OUSTR(EXTENSION_REG_NS); } +OUString ExtensionBackendDb::getNSPrefix() +{ + return OUSTR(NS_PREFIX); +} + OUString ExtensionBackendDb::getRootElementName() { return OUSTR(ROOT_ELEMENT_NAME); @@ -71,20 +77,23 @@ void ExtensionBackendDb::addEntry(::rtl::OUString const & url, Data const & data { try{ + const OUString sNameSpace = getDbNSName(); + const OUString sPrefix = getNSPrefix(); Reference doc = getDocument(); Reference root = doc->getFirstChild(); #if OSL_DEBUG_LEVEL > 0 //There must not be yet an entry with the same url OUString sExpression( - OUSTR("reg:extension[@url = \"") + url + OUSTR("\"]")); + sPrefix + OUSTR(":extension[@url = \"") + url + OUSTR("\"]")); Reference _extensionNode = getXPathAPI()->selectSingleNode(root, sExpression); OSL_ASSERT(! _extensionNode.is()); #endif // Reference extensionNode( - doc->createElement(OUSTR("extension"))); + doc->createElementNS(sNameSpace, + sPrefix + OUSTR(":extension"))); extensionNode->setAttribute(OUSTR("url"), url); @@ -92,22 +101,12 @@ void ExtensionBackendDb::addEntry(::rtl::OUString const & url, Data const & data extensionNode, css::uno::UNO_QUERY_THROW); root->appendChild(extensionNodeNode); - // ... -// Reference identifierNode( -// doc->createElement(OUSTR("identifier")), UNO_QUERY_THROW); -// extensionNodeNode->appendChild(identifierNode); - -// Reference identifierValue( -// doc->createTextNode(data.identifier), UNO_QUERY_THROW); -// identifierNode->appendChild(identifierValue); - - writeVectorOfPair( data.items, - OUSTR("extension-items"), - OUSTR("item"), - OUSTR("url"), - OUSTR("media-type"), + sPrefix + OUSTR(":extension-items"), + sPrefix + OUSTR(":item"), + sPrefix + OUSTR(":url"), + sPrefix + OUSTR(":media-type"), extensionNodeNode); save(); } @@ -123,7 +122,7 @@ void ExtensionBackendDb::addEntry(::rtl::OUString const & url, Data const & data void ExtensionBackendDb::removeEntry(::rtl::OUString const & url) { OUString sExpression( - OUSTR("reg:extension[@url = \"") + url + OUSTR("\"]")); + OUSTR(NS_PREFIX) + OUSTR(":extension[@url = \"") + url + OUSTR("\"]")); removeElement(sExpression); } @@ -131,9 +130,10 @@ ExtensionBackendDb::Data ExtensionBackendDb::getEntry(::rtl::OUString const & ur { try { + const OUString sPrefix = getNSPrefix(); ExtensionBackendDb::Data retData; const OUString sExpression( - OUSTR("reg:extension[@url = \"") + url + OUSTR("\"]")); + sPrefix + OUSTR(":extension[@url = \"") + url + OUSTR("\"]")); Reference doc = getDocument(); Reference root = doc->getFirstChild(); @@ -143,17 +143,13 @@ ExtensionBackendDb::Data ExtensionBackendDb::getEntry(::rtl::OUString const & ur xpathApi->selectSingleNode(root, sExpression); if (aNode.is()) { -// const OUString sExprIdentifier(OUSTR("reg:identifier/text()")); - -// Reference idValueNode = -// xpathApi->selectSingleNode(aNode, sExprIdentifier); -// retData.identifier = idValueNode->getNodeValue(); - retData.items = readVectorOfPair( aNode, - OUSTR("reg:extension-items"), - OUSTR("reg:item"), OUSTR("reg:url"), OUSTR("reg:media-type")); + sPrefix + OUSTR(":extension-items"), + sPrefix + OUSTR(":item"), + sPrefix + OUSTR(":url"), + sPrefix + OUSTR(":media-type")); } return retData; } diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.hxx b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx index 4afe6f1a5577..e46c67b166de 100644 --- a/desktop/source/deployment/registry/package/dp_extbackenddb.hxx +++ b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx @@ -60,7 +60,7 @@ class ExtensionBackendDb: public dp_registry::backend::BackendDb { protected: virtual ::rtl::OUString getDbNSName(); - + virtual ::rtl::OUString getNSPrefix(); virtual ::rtl::OUString getRootElementName(); public: -- cgit From e955e6941dcf5784f44d64ec753041a4dc6cf37e Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Wed, 24 Mar 2010 08:27:52 +0100 Subject: jl152 import 263442 from native0jl:#i77196# new add, remove and update are now supported from extension manager --- .../deployment/gui/dp_gui_extensioncmdqueue.cxx | 17 +++-- .../source/deployment/gui/dp_gui_extlistbox.cxx | 4 +- desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 85 ++++++++++++++++------ desktop/source/deployment/gui/dp_gui_theextmgr.hxx | 4 + 4 files changed, 82 insertions(+), 28 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 89a5ae1e22c8..a617e07758c7 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -946,11 +946,12 @@ void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv try { - uno::Reference< deployment::XPackage > xPackage( xPackageManager->addPackage( - rPackageURL, OUString() /* detect media-type */, - xAbortChannel, rCmdEnv.get() ) ); + OUString sPackageManager = xPackageManager->getContext(); + uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); + uno::Reference< deployment::XPackage > xPackage( xExtMgr->addExtension( rPackageURL, sPackageManager, + xAbortChannel, rCmdEnv.get() ) ); OSL_ASSERT( xPackage.is() ); - } + } catch ( ucb::CommandFailedException & ) { // When the extension is already installed we'll get a dialog asking if we want to overwrite. If we then press @@ -976,8 +977,14 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE OUString id( dp_misc::getIdentifier( xPackage ) ); try { - xPackageManager->removePackage( id, xPackage->getName(), xAbortChannel, rCmdEnv.get() ); + OUString sPackageManager = xPackageManager->getContext(); + uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); + xExtMgr->removeExtension( id, xPackage->getName(), sPackageManager, xAbortChannel, rCmdEnv.get() ); } + catch ( deployment::DeploymentException & ) + {} + catch ( ucb::CommandFailedException & ) + {} catch ( ucb::CommandAbortedException & ) {} diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 2e02a90f59fd..6793b6e1e0ab 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -951,7 +951,7 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & if ( m_vEntries.empty() ) { pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); - pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager ); + pEntry->m_bShared = ( m_pManager->getUserPkgMgr() != xPackageManager ); pEntry->m_bNew = m_bInCheckMode; m_vEntries.push_back( pEntry ); } @@ -960,7 +960,7 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) ) { pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); - pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager ); + pEntry->m_bShared = ( m_pManager->getUserPkgMgr() != xPackageManager ); pEntry->m_bNew = m_bInCheckMode; m_vEntries.insert( m_vEntries.begin()+nPos, pEntry ); } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 796918202a52..7519ab8a1dc8 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -47,6 +47,10 @@ #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) +#define USER_PACKAGE_MANAGER OUSTR("user") +#define SHARED_PACKAGE_MANAGER OUSTR("shared") +#define BUNDLED_PACKAGE_MANAGER OUSTR("bundled") + using namespace ::com::sun::star; using ::rtl::OUString; @@ -67,15 +71,18 @@ TheExtensionManager::TheExtensionManager( Window *pParent, m_pExtMgrDialog( NULL ), m_pUpdReqDialog( NULL ) { - m_sPackageManagers.realloc(2); - m_sPackageManagers[0] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("user") ); - m_sPackageManagers[1] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("shared") );; + m_sPackageManagers.realloc(3); + m_sPackageManagers[0] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( USER_PACKAGE_MANAGER ); + m_sPackageManagers[1] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( SHARED_PACKAGE_MANAGER ); + m_sPackageManagers[2] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( BUNDLED_PACKAGE_MANAGER ); for ( sal_Int32 i = 0; i < m_sPackageManagers.getLength(); ++i ) { m_sPackageManagers[i]->addModifyListener( this ); } + m_xExtensionManager = deployment::ExtensionManager::get( xContext ); + uno::Reference< lang::XMultiServiceFactory > xConfig( xContext->getServiceManager()->createInstanceWithContext( OUSTR("com.sun.star.configuration.ConfigurationProvider"), xContext ), uno::UNO_QUERY_THROW); @@ -206,26 +213,34 @@ bool TheExtensionManager::isVisible() bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bParentVisible*/ ) { std::vector< TUpdateListEntry > vEntries; + uno::Sequence< uno::Sequence< uno::Reference< deployment::XPackage > > > xAllPackages; - for ( sal_Int32 i = 0; i < m_sPackageManagers.getLength(); ++i ) + try { + xAllPackages = m_xExtensionManager->getAllExtensions( uno::Reference< task::XAbortChannel >(), + uno::Reference< ucb::XCommandEnvironment >() ); + } catch ( deployment::DeploymentException & ) { + return false; + } catch ( ucb::CommandFailedException & ) { + return false; + } catch ( ucb::CommandAbortedException & ) { + return false; + } catch ( lang::IllegalArgumentException & e ) { + throw uno::RuntimeException( e.Message, e.Context ); + } + + for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i ) { - uno::Sequence< uno::Reference< deployment::XPackage > > xPackages; - try { - xPackages = m_sPackageManagers[i]->getDeployedPackages( uno::Reference< task::XAbortChannel >(), - uno::Reference< ucb::XCommandEnvironment >() ); - for ( sal_Int32 k = 0; k < xPackages.getLength(); ++k ) + uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i]; + + for ( sal_Int32 j = 0; j < xPackageList.getLength(); ++j ) + { + uno::Reference< deployment::XPackage > xPackage = xPackageList[j]; + if ( xPackage.is() ) { - TUpdateListEntry pEntry( new UpdateListEntry( xPackages[k], m_sPackageManagers[i] ) ); + TUpdateListEntry pEntry( new UpdateListEntry( xPackage, m_sPackageManagers[j] ) ); vEntries.push_back( pEntry ); + break; } - } catch ( deployment::DeploymentException & ) { - continue; - } catch ( ucb::CommandFailedException & ) { - continue; - } catch ( ucb::CommandAbortedException & ) { - return true; - } catch ( lang::IllegalArgumentException & e ) { - throw uno::RuntimeException( e.Message, e.Context ); } } @@ -342,10 +357,38 @@ bool TheExtensionManager::createPackageList( const uno::Reference< deployment::X //------------------------------------------------------------------------------ void TheExtensionManager::createPackageList() { - for ( sal_Int32 i = 0; i < m_sPackageManagers.getLength(); ++i ) + uno::Sequence< uno::Sequence< uno::Reference< deployment::XPackage > > > xAllPackages; + + try { + xAllPackages = m_xExtensionManager->getAllExtensions( uno::Reference< task::XAbortChannel >(), + uno::Reference< ucb::XCommandEnvironment >() ); + } catch ( deployment::DeploymentException & ) { + return; + } catch ( ucb::CommandFailedException & ) { + return; + } catch ( ucb::CommandAbortedException & ) { + return; + } catch ( lang::IllegalArgumentException & e ) { + throw uno::RuntimeException( e.Message, e.Context ); + } + + for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i ) { - if ( ! createPackageList( m_sPackageManagers[i] ) ) - break; + uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i]; + + for ( sal_Int32 j = 0; j < xPackageList.getLength(); ++j ) + { + uno::Reference< deployment::XPackage > xPackage = xPackageList[j]; + if ( xPackage.is() ) + { + PackageState eState = getPackageState( xPackage ); + getDialogHelper()->addPackageToList( xPackage, m_sPackageManagers[j] ); + // When the package is enabled, we can stop here, otherwise we have to look for + // another version of this package + if ( ( eState == REGISTERED ) || ( eState == NOT_AVAILABLE ) ) + break; + } + } } } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index 1cdd1851d59e..f794f8aa432d 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -34,6 +34,8 @@ #include "com/sun/star/container/XNameAccess.hpp" #include "com/sun/star/deployment/XPackageManager.hpp" +#include "com/sun/star/deployment/XExtensionManager.hpp" +#include "com/sun/star/deployment/ExtensionManager.hpp" #include "com/sun/star/frame/XDesktop.hpp" #include "com/sun/star/frame/XTerminateListener.hpp" #include "com/sun/star/uno/XComponentContext.hpp" @@ -57,6 +59,7 @@ class TheExtensionManager : private: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop; + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> > m_sPackageManagers; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNameAccessNodes; @@ -111,6 +114,7 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext; } ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > getUserPkgMgr() const { return m_sPackageManagers[0]; } ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > getSharedPkgMgr() const { return m_sPackageManagers[1]; } + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > getExtensionManager() const { return m_xExtensionManager; } //----------------- static ::rtl::Reference get( -- cgit From 72506215f8419786691277f2936b9298ddadd925 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 25 Mar 2010 10:45:08 +0100 Subject: jl152 import 263443 from native0jl:#i77196# merging --- desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 7519ab8a1dc8..a45affcb2c08 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -34,7 +34,6 @@ #include "vos/mutex.hxx" #include "toolkit/helper/vclunohelper.hxx" - #include "com/sun/star/beans/XPropertySet.hpp" #include "com/sun/star/deployment/XPackageManagerFactory.hpp" #include "com/sun/star/deployment/thePackageManagerFactory.hpp" @@ -51,6 +50,10 @@ #define SHARED_PACKAGE_MANAGER OUSTR("shared") #define BUNDLED_PACKAGE_MANAGER OUSTR("bundled") +#define USER_PACKAGE_MANAGER OUSTR("user") +#define SHARED_PACKAGE_MANAGER OUSTR("shared") +#define BUNDLED_PACKAGE_MANAGER OUSTR("bundled") + using namespace ::com::sun::star; using ::rtl::OUString; @@ -329,16 +332,14 @@ void TheExtensionManager::terminateDialog() //------------------------------------------------------------------------------ bool TheExtensionManager::createPackageList( const uno::Reference< deployment::XPackageManager > &xPackageManager ) { - uno::Sequence< uno::Reference< deployment::XPackage > > packages; + uno::Sequence< uno::Sequence< uno::Reference< deployment::XPackage > > > xAllPackages; try { - packages = xPackageManager->getDeployedPackages( uno::Reference< task::XAbortChannel >(), - uno::Reference< ucb::XCommandEnvironment >() ); + xAllPackages = m_xExtensionManager->getAllExtensions( uno::Reference< task::XAbortChannel >(), + uno::Reference< ucb::XCommandEnvironment >() ); } catch ( deployment::DeploymentException & ) { - //handleGeneralError(e.Cause); return true; } catch ( ucb::CommandFailedException & ) { - //handleGeneralError(e.Reason); return true; } catch ( ucb::CommandAbortedException & ) { return false; @@ -346,9 +347,24 @@ bool TheExtensionManager::createPackageList( const uno::Reference< deployment::X throw uno::RuntimeException( e.Message, e.Context ); } - for ( sal_Int32 j = 0; j < packages.getLength(); ++j ) + for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i ) { - getDialogHelper()->addPackageToList( packages[j], xPackageManager ); + uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i]; + + for ( sal_Int32 j = 0; j < xPackageList.getLength(); ++j ) + { + uno::Reference< deployment::XPackage > xPackage = xPackageList[j]; + if ( xPackage.is() ) + { + PackageState eState = getPackageState( xPackage ); + getDialogHelper()->addPackageToList( xPackage, m_sPackageManagers[j] ); + // When the package is enabled, we can stop here, otherwise we have to look for + // another version of this package + if ( ( eState == REGISTERED ) || ( eState == NOT_AVAILABLE ) ) + break; + } + } + } return true; -- cgit From ada29520025252056fc0b9a156103b17bc770b0f Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Thu, 25 Mar 2010 11:57:04 +0100 Subject: jl152 import 263444 from native0jl:#i77196# disable now supported new from extension manager --- desktop/source/deployment/gui/dp_gui.hrc | 2 + desktop/source/deployment/gui/dp_gui_dialog2.cxx | 25 +++++++---- desktop/source/deployment/gui/dp_gui_dialog2.hxx | 6 +-- desktop/source/deployment/gui/dp_gui_dialog2.src | 12 +++++- .../source/deployment/gui/dp_gui_extlistbox.cxx | 46 +++++++++++++-------- .../source/deployment/gui/dp_gui_extlistbox.hxx | 20 +++++---- desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 48 ++-------------------- desktop/source/deployment/gui/dp_gui_theextmgr.hxx | 1 - 8 files changed, 78 insertions(+), 82 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc index 8da4db5ca74f..1d2f4869cc7f 100644 --- a/desktop/source/deployment/gui/dp_gui.hrc +++ b/desktop/source/deployment/gui/dp_gui.hrc @@ -138,6 +138,8 @@ #define RID_IMG_LOCKED_HC (RID_DEPLOYMENT_GUI_START+59) #define RID_IMG_EXTENSION (RID_DEPLOYMENT_GUI_START+60) #define RID_IMG_EXTENSION_HC (RID_DEPLOYMENT_GUI_START+61) +#define RID_IMG_SHARED (RID_DEPLOYMENT_GUI_START+62) +#define RID_IMG_SHARED_HC (RID_DEPLOYMENT_GUI_START+63) #define RID_STR_ADD_PACKAGES (RID_DEPLOYMENT_GUI_START+70) diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 2d0733dfbae3..5f0cf3d91012 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -291,6 +291,7 @@ void ExtBoxWithBtns_Impl::SetButtonPos( const Rectangle& rRect ) // ----------------------------------------------------------------------- void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry ) { + pEntry->m_bHasButtons = false; if ( ( pEntry->m_eState == REGISTERED ) || ( pEntry->m_eState == NOT_AVAILABLE ) ) { m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); @@ -302,24 +303,32 @@ void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry ) m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_ENABLE ); } - if ( ( pEntry->m_eState == NOT_AVAILABLE ) || pEntry->m_bMissingDeps ) + if ( !pEntry->m_bUser || ( pEntry->m_eState == NOT_AVAILABLE ) || pEntry->m_bMissingDeps ) m_pEnableBtn->Hide(); else { m_pEnableBtn->Enable( !pEntry->m_bLocked ); m_pEnableBtn->Show(); + pEntry->m_bHasButtons = true; } if ( pEntry->m_bHasOptions ) { m_pOptionsBtn->Enable( pEntry->m_bHasOptions ); m_pOptionsBtn->Show(); + pEntry->m_bHasButtons = true; } else m_pOptionsBtn->Hide(); - m_pRemoveBtn->Show(); - m_pRemoveBtn->Enable( !pEntry->m_bLocked ); + if ( pEntry->m_bUser || pEntry->m_bShared ) + { + m_pRemoveBtn->Enable( !pEntry->m_bLocked ); + m_pRemoveBtn->Show(); + pEntry->m_bHasButtons = true; + } + else + m_pRemoveBtn->Hide(); } // ----------------------------------------------------------------------- @@ -778,10 +787,9 @@ long ExtMgrDialog::addPackageToList( const uno::Reference< deployment::XPackage } //------------------------------------------------------------------------------ -void ExtMgrDialog::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageManager ) +void ExtMgrDialog::prepareChecking() { - if ( xPackageManager.is() ) - m_pExtensionBox->prepareChecking( xPackageManager ); + m_pExtensionBox->prepareChecking(); } //------------------------------------------------------------------------------ @@ -1323,10 +1331,9 @@ long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::X } //------------------------------------------------------------------------------ -void UpdateRequiredDialog::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageManager ) +void UpdateRequiredDialog::prepareChecking() { - if ( xPackageManager.is() ) - m_pExtensionBox->prepareChecking( xPackageManager ); + m_pExtensionBox->prepareChecking(); } //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index d5e939ace8a9..cadc127446ea 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -85,7 +85,7 @@ public: virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & ) = 0; - virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ) = 0; + virtual void prepareChecking() = 0; virtual void checkEntries() = 0; static ResId getResId( USHORT nId ); @@ -169,7 +169,7 @@ public: bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); - virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); + virtual void prepareChecking(); virtual void checkEntries(); ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); @@ -242,7 +242,7 @@ public: bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); - virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); + virtual void prepareChecking(); virtual void checkEntries(); ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.src b/desktop/source/deployment/gui/dp_gui_dialog2.src index d55421d50d75..7c47365999a0 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.src +++ b/desktop/source/deployment/gui/dp_gui_dialog2.src @@ -165,10 +165,20 @@ Image RID_IMG_WARNING_HC Image RID_IMG_LOCKED { - ImageBitmap = Bitmap { File = "shared_16.png"; }; + ImageBitmap = Bitmap { File = "lock_16.png"; }; }; Image RID_IMG_LOCKED_HC +{ + ImageBitmap = Bitmap { File = "lock_16_h.png"; }; +}; + +Image RID_IMG_SHARED +{ + ImageBitmap = Bitmap { File = "shared_16.png"; }; +}; + +Image RID_IMG_SHARED_HC { ImageBitmap = Bitmap { File = "shared_16_h.png"; }; }; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 6793b6e1e0ab..7d616b103c21 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -58,9 +58,11 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, m_bLocked( false ), m_bHasOptions( false ), m_bShared( false ), + m_bUser( false ), m_bNew( false ), m_bChecked( false ), m_bMissingDeps( false ), + m_bHasButtons( false ), m_eState( eState ), m_pPublisher( NULL ), m_xPackage( xPackage ), @@ -177,6 +179,8 @@ ExtensionBox_Impl::ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pMan m_nTopIndex( 0 ), m_nActiveHeight( 0 ), m_nExtraHeight( 2 ), + m_aSharedImage( DialogHelper::getResId( RID_IMG_SHARED ) ), + m_aSharedImageHC( DialogHelper::getResId( RID_IMG_SHARED_HC ) ), m_aLockedImage( DialogHelper::getResId( RID_IMG_LOCKED ) ), m_aLockedImageHC( DialogHelper::getResId( RID_IMG_LOCKED_HC ) ), m_aWarningImage( DialogHelper::getResId( RID_IMG_WARNING ) ), @@ -380,7 +384,10 @@ void ExtensionBox_Impl::CalcActiveHeight( const long nPos ) if ( aTextHeight < m_nStdHeight ) aTextHeight = m_nStdHeight; - m_nActiveHeight = aTextHeight + m_nExtraHeight; + if ( m_vEntries[ nPos ]->m_bHasButtons ) + m_nActiveHeight = aTextHeight + m_nExtraHeight; + else + m_nActiveHeight = aTextHeight + 2; } //------------------------------------------------------------------------------ @@ -469,13 +476,15 @@ void ExtensionBox_Impl::selectEntry( const long nPos ) if ( IsReallyVisible() ) { - m_bNeedsRecalc = true; m_bAdjustActive = true; } } if ( IsReallyVisible() ) + { + m_bNeedsRecalc = true; Invalidate(); + } guard.clear(); } @@ -595,7 +604,12 @@ void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntr aPos.Y() += aTextHeight; if ( pEntry->m_bActive ) { - DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nExtraHeight ), + long nExtraHeight = 0; + + if ( pEntry->m_bHasButtons ) + nExtraHeight = m_nExtraHeight; + + DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - nExtraHeight ), sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); } else @@ -615,10 +629,13 @@ void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntr } // Draw status icons - if ( pEntry->m_bShared ) + if ( !pEntry->m_bUser ) { aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET ); - DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage ); + if ( pEntry->m_bLocked ) + DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage ); + else + DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aSharedImageHC : m_aSharedImage ); } if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps ) { @@ -950,18 +967,12 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & ::osl::ClearableMutexGuard guard(m_entriesMutex); if ( m_vEntries.empty() ) { - pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); - pEntry->m_bShared = ( m_pManager->getUserPkgMgr() != xPackageManager ); - pEntry->m_bNew = m_bInCheckMode; m_vEntries.push_back( pEntry ); } else { if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) ) { - pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); - pEntry->m_bShared = ( m_pManager->getUserPkgMgr() != xPackageManager ); - pEntry->m_bNew = m_bInCheckMode; m_vEntries.insert( m_vEntries.begin()+nPos, pEntry ); } else if ( !m_bInCheckMode ) @@ -969,6 +980,12 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" ); } } + + pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); + pEntry->m_bUser = ( m_pManager->getUserPkgMgr() == xPackageManager ); + pEntry->m_bShared = !pEntry->m_bUser && ( m_pManager->getSharedPkgMgr() == xPackageManager ); + pEntry->m_bNew = m_bInCheckMode; + //access to m_nActive must be guarded if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) ) m_nActive += 1; @@ -1084,16 +1101,13 @@ void ExtensionBox_Impl::RemoveUnlocked() } //------------------------------------------------------------------------------ -void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr ) +void ExtensionBox_Impl::prepareChecking() { m_bInCheckMode = true; typedef std::vector< TEntry_Impl >::iterator ITER; for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) { - if ( (*iIndex)->m_xPackageManager == xPackageMgr ) - (*iIndex)->m_bChecked = false; - else - (*iIndex)->m_bChecked = true; + (*iIndex)->m_bChecked = false; (*iIndex)->m_bNew = false; } } diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index ad62bfd1a2d8..1ea3d0d72fcc 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -65,13 +65,15 @@ typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl; struct Entry_Impl { - bool m_bActive; - bool m_bLocked; - bool m_bHasOptions; - bool m_bShared; - bool m_bNew; - bool m_bChecked; - bool m_bMissingDeps; + bool m_bActive :1; + bool m_bLocked :1; + bool m_bHasOptions :1; + bool m_bUser :1; + bool m_bShared :1; + bool m_bNew :1; + bool m_bChecked :1; + bool m_bMissingDeps :1; + bool m_bHasButtons :1; PackageState m_eState; String m_sTitle; String m_sVersion; @@ -135,6 +137,8 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox long m_nActiveHeight; long m_nExtraHeight; Size m_aOutputSize; + Image m_aSharedImage; + Image m_aSharedImageHC; Image m_aLockedImage; Image m_aLockedImageHC; Image m_aWarningImage; @@ -209,7 +213,7 @@ public: void updateEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); void removeEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); - void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageMgr ); + void prepareChecking(); void checkEntries(); TheExtensionManager* getExtensionManager() const { return m_pManager; } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index a45affcb2c08..fef6d36c7165 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -235,7 +235,8 @@ bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bPare { uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i]; - for ( sal_Int32 j = 0; j < xPackageList.getLength(); ++j ) + // we don't want update notifications for bundled packages + for ( sal_Int32 j = 0; ( j < 2 ) && ( j < xPackageList.getLength() ); ++j ) { uno::Reference< deployment::XPackage > xPackage = xPackageList[j]; if ( xPackage.is() ) @@ -329,47 +330,6 @@ void TheExtensionManager::terminateDialog() } } -//------------------------------------------------------------------------------ -bool TheExtensionManager::createPackageList( const uno::Reference< deployment::XPackageManager > &xPackageManager ) -{ - uno::Sequence< uno::Sequence< uno::Reference< deployment::XPackage > > > xAllPackages; - - try { - xAllPackages = m_xExtensionManager->getAllExtensions( uno::Reference< task::XAbortChannel >(), - uno::Reference< ucb::XCommandEnvironment >() ); - } catch ( deployment::DeploymentException & ) { - return true; - } catch ( ucb::CommandFailedException & ) { - return true; - } catch ( ucb::CommandAbortedException & ) { - return false; - } catch ( lang::IllegalArgumentException & e ) { - throw uno::RuntimeException( e.Message, e.Context ); - } - - for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i ) - { - uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i]; - - for ( sal_Int32 j = 0; j < xPackageList.getLength(); ++j ) - { - uno::Reference< deployment::XPackage > xPackage = xPackageList[j]; - if ( xPackage.is() ) - { - PackageState eState = getPackageState( xPackage ); - getDialogHelper()->addPackageToList( xPackage, m_sPackageManagers[j] ); - // When the package is enabled, we can stop here, otherwise we have to look for - // another version of this package - if ( ( eState == REGISTERED ) || ( eState == NOT_AVAILABLE ) ) - break; - } - } - - } - - return true; -} - //------------------------------------------------------------------------------ void TheExtensionManager::createPackageList() { @@ -553,8 +513,8 @@ void TheExtensionManager::modified( ::lang::EventObject const & rEvt ) uno::Reference< deployment::XPackageManager > xPackageManager( rEvt.Source, uno::UNO_QUERY ); if ( xPackageManager.is() ) { - getDialogHelper()->prepareChecking( xPackageManager ); - createPackageList( xPackageManager ); + getDialogHelper()->prepareChecking(); + createPackageList(); getDialogHelper()->checkEntries(); } } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index f794f8aa432d..2b8f86de9955 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -74,7 +74,6 @@ private: // liste der packages ( xpackage?, mit parent manager, ... ) void createPackageList(); - bool createPackageList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); public: static ::rtl::Reference s_ExtMgr; -- cgit From 6b08288aa173d0717b15a1cb970fdb0614a88d6a Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 30 Mar 2010 16:45:08 +0200 Subject: tl78: #i105076# the filter related constants are no more in framework module --- framework/inc/filterflags.h | 172 ------------------------------- framework/inc/queries.h | 1 - framework/source/constant/filter.cxx | 119 --------------------- framework/source/constant/makefile.mk | 3 +- framework/source/inc/constant/filter.hxx | 126 ---------------------- framework/source/loadenv/loadenv.cxx | 3 - framework/util/makefile.mk | 1 - 7 files changed, 1 insertion(+), 424 deletions(-) delete mode 100644 framework/inc/filterflags.h delete mode 100644 framework/source/constant/filter.cxx delete mode 100644 framework/source/inc/constant/filter.hxx diff --git a/framework/inc/filterflags.h b/framework/inc/filterflags.h deleted file mode 100644 index 227834bc41dd..000000000000 --- a/framework/inc/filterflags.h +++ /dev/null @@ -1,172 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __FRAMEWORK_FILTERFLAGS_H_ -#define __FRAMEWORK_FILTERFLAGS_H_ - -namespace framework{ - -/*-************************************************************************************************************//** - @short These values describe our supported filter flags. - @attention Don't change flag values without reason - we must support old functionality and position - in flag combined values! -*//*-*************************************************************************************************************/ - -#define FILTERFLAGNAME_IMPORT DECLARE_ASCII("Import" ) // x -#define FILTERFLAGNAME_EXPORT DECLARE_ASCII("Export" ) // x -#define FILTERFLAGNAME_TEMPLATE DECLARE_ASCII("Template" ) // x -#define FILTERFLAGNAME_INTERNAL DECLARE_ASCII("Internal" ) // x -#define FILTERFLAGNAME_TEMPLATEPATH DECLARE_ASCII("TemplatePath" ) // x -#define FILTERFLAGNAME_OWN DECLARE_ASCII("Own" ) // x -#define FILTERFLAGNAME_ALIEN DECLARE_ASCII("Alien" ) // x -#define FILTERFLAGNAME_USESOPTIONS DECLARE_ASCII("UsesOptions" ) // x -#define FILTERFLAGNAME_DEFAULT DECLARE_ASCII("Default" ) // x -#define FILTERFLAGNAME_EXECUTABLE DECLARE_ASCII("Executable" ) // deprecated -#define FILTERFLAGNAME_SUPPORTSSELECTION DECLARE_ASCII("SupportsSelection") // x -#define FILTERFLAGNAME_MAPTOAPPPLUG DECLARE_ASCII("MapToAppPlug" ) // deprecated -#define FILTERFLAGNAME_NOTINFILEDIALOG DECLARE_ASCII("NotInFileDialog" ) // x -#define FILTERFLAGNAME_NOTINCHOOSER DECLARE_ASCII("NotInChooser" ) // x -#define FILTERFLAGNAME_ASYNCHRON DECLARE_ASCII("Asynchron" ) // x -#define FILTERFLAGNAME_CREATOR DECLARE_ASCII("Creator" ) // deprecated -#define FILTERFLAGNAME_READONLY DECLARE_ASCII("Readonly" ) // x -#define FILTERFLAGNAME_NOTINSTALLED DECLARE_ASCII("NotInstalled" ) // deprecated -#define FILTERFLAGNAME_CONSULTSERVICE DECLARE_ASCII("ConsultService" ) // deprecated -#define FILTERFLAGNAME_3RDPARTYFILTER DECLARE_ASCII("3rdPartyFilter" ) // x -#define FILTERFLAGNAME_PACKED DECLARE_ASCII("Packed" ) // x -#define FILTERFLAGNAME_SILENTEXPORT DECLARE_ASCII("SilentExport" ) // x -#define FILTERFLAGNAME_BROWSERPREFERED DECLARE_ASCII("BrowserPrefered" ) // deprecated -#define FILTERFLAGNAME_PREFERED DECLARE_ASCII("Prefered" ) // x - -#define FILTERFLAG_IMPORT 0x00000001L // 1 -#define FILTERFLAG_EXPORT 0x00000002L // 2 -#define FILTERFLAG_TEMPLATE 0x00000004L // 4 -#define FILTERFLAG_INTERNAL 0x00000008L // 8 -#define FILTERFLAG_TEMPLATEPATH 0x00000010L // 16 -#define FILTERFLAG_OWN 0x00000020L // 32 -#define FILTERFLAG_ALIEN 0x00000040L // 64 -#define FILTERFLAG_USESOPTIONS 0x00000080L // 128 -#define FILTERFLAG_DEFAULT 0x00000100L // 256 -#define FILTERFLAG_EXECUTABLE 0x00000200L // 512 -#define FILTERFLAG_SUPPORTSSELECTION 0x00000400L // 1024 -#define FILTERFLAG_MAPTOAPPPLUG 0x00000800L // 2048 -#define FILTERFLAG_NOTINFILEDIALOG 0x00001000L // 4096 -#define FILTERFLAG_NOTINCHOOSER 0x00002000L // 8192 -#define FILTERFLAG_ASYNCHRON 0x00004000L // 16384 -#define FILTERFLAG_CREATOR 0x00008000L // 32768 -#define FILTERFLAG_READONLY 0x00010000L // 65536 -#define FILTERFLAG_NOTINSTALLED 0x00020000L // 131072 -#define FILTERFLAG_CONSULTSERVICE 0x00040000L // 262144 -#define FILTERFLAG_3RDPARTYFILTER 0x00080000L // 524288 -#define FILTERFLAG_PACKED 0x00100000L // 1048576 -#define FILTERFLAG_SILENTEXPORT 0x00200000L // 2097152 -#define FILTERFLAG_BROWSERPREFERED 0x00400000L // 4194304 -//FREE! ... 0x00800000L -#define FILTERFLAG_PREFERED 0x10000000L // 268435456 - -class FlagCheck -{ - public: - - //___________________________________________ - - /** @short checks if the given flag mask is set. - - @param nFlags the flag field, which should be checked. - @param nMask this mask field is searched inside parameter nFlags. - - @return TRUE if mask match to the given flag field. - */ - static sal_Bool isMaskSet( sal_Int32 nFlags, sal_Int32 nMask ) - { - return((nFlags & nMask) == nMask); - } - - //___________________________________________ - - /** @short checks if the given flag field contains unknown flags. - - @descr Of course it can work only, if not the whole range of an int32 - is used! - - @param nFlags the flag field, which should be checked. - - @return TRUE if only well known flags are set. - */ - static sal_Bool isValid( sal_Int32 nFlags ) - { - sal_Int32 nCheck = nFlags; - nCheck &= ~FILTERFLAG_IMPORT; - nCheck &= ~FILTERFLAG_EXPORT; - nCheck &= ~FILTERFLAG_TEMPLATE; - nCheck &= ~FILTERFLAG_INTERNAL; - nCheck &= ~FILTERFLAG_TEMPLATEPATH; - nCheck &= ~FILTERFLAG_OWN; - nCheck &= ~FILTERFLAG_ALIEN; - nCheck &= ~FILTERFLAG_USESOPTIONS; - nCheck &= ~FILTERFLAG_DEFAULT; - nCheck &= ~FILTERFLAG_EXECUTABLE; - nCheck &= ~FILTERFLAG_SUPPORTSSELECTION; - nCheck &= ~FILTERFLAG_MAPTOAPPPLUG; - nCheck &= ~FILTERFLAG_NOTINFILEDIALOG; - nCheck &= ~FILTERFLAG_NOTINCHOOSER; - nCheck &= ~FILTERFLAG_ASYNCHRON; - nCheck &= ~FILTERFLAG_CREATOR; - nCheck &= ~FILTERFLAG_READONLY; - nCheck &= ~FILTERFLAG_NOTINSTALLED; - nCheck &= ~FILTERFLAG_CONSULTSERVICE; - nCheck &= ~FILTERFLAG_3RDPARTYFILTER; - nCheck &= ~FILTERFLAG_PACKED; - nCheck &= ~FILTERFLAG_SILENTEXPORT; - nCheck &= ~FILTERFLAG_BROWSERPREFERED; - nCheck &= ~FILTERFLAG_PREFERED; - return(nCheck == 0); - } - - //___________________________________________ - - /** @short checks if the given flag field uses deprecated flag values. - - @param nFlags the flag field, which should be checked. - - @return TRUE if one deprecated flag item could be found. - */ - static sal_Bool useDeprecated( sal_Int32 nFlags ) - { - return( - isMaskSet(nFlags, FILTERFLAG_EXECUTABLE ) || - isMaskSet(nFlags, FILTERFLAG_MAPTOAPPPLUG ) || - isMaskSet(nFlags, FILTERFLAG_CREATOR ) || - isMaskSet(nFlags, FILTERFLAG_NOTINSTALLED ) || - isMaskSet(nFlags, FILTERFLAG_CONSULTSERVICE ) || - isMaskSet(nFlags, FILTERFLAG_BROWSERPREFERED ) - ); - } -}; - -} // namespace framework - -#endif // #ifndef __FRAMEWORK_FILTERFLAGS_H_ diff --git a/framework/inc/queries.h b/framework/inc/queries.h index ce190a796dcb..b8d122118abf 100644 --- a/framework/inc/queries.h +++ b/framework/inc/queries.h @@ -32,7 +32,6 @@ // own includes //_________________________________________________________________________________________________________________ -#include #include //_________________________________________________________________________________________________________________ diff --git a/framework/source/constant/filter.cxx b/framework/source/constant/filter.cxx deleted file mode 100644 index 57d94d772e6d..000000000000 --- a/framework/source/constant/filter.cxx +++ /dev/null @@ -1,119 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -#ifndef __FRAMEWORK_CONSTANT_FILTER_HXX_ -#include -#endif - -namespace framework{ - namespace constant{ - -const ::rtl::OUString Filter::PROP_NAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name" )); -const ::rtl::OUString Filter::PROP_TYPE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type" )); -const ::rtl::OUString Filter::PROP_DOCUMENTSERVICE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")); -const ::rtl::OUString Filter::PROP_FILTERSERVICE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterService" )); -const ::rtl::OUString Filter::PROP_UICOMPONENT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIComponent" )); -const ::rtl::OUString Filter::PROP_FLAGS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags" )); -const ::rtl::OUString Filter::PROP_USERDATA = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UserData" )); -const ::rtl::OUString Filter::PROP_TEMPLATENAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TemplateName" )); - -const ::rtl::OUString Filter::QUERY_GET_DEFAULT_FILTER_FOR_TYPE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getDefaultFilterForType")); -const ::rtl::OUString Filter::QUERY_ALL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_all" )); -const ::rtl::OUString Filter::QUERY_WRITER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_writer" )); -const ::rtl::OUString Filter::QUERY_WEB = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_web" )); -const ::rtl::OUString Filter::QUERY_GLOBAL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_global" )); -const ::rtl::OUString Filter::QUERY_CHART = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_chart" )); -const ::rtl::OUString Filter::QUERY_CALC = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_calc" )); -const ::rtl::OUString Filter::QUERY_IMPRESS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_impress" )); -const ::rtl::OUString Filter::QUERY_DRAW = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_draw" )); -const ::rtl::OUString Filter::QUERY_MATH = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_math" )); - -const ::rtl::OUString Filter::QUERYPARAM_IFLAGS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("iflags" )); -const ::rtl::OUString Filter::QUERYPARAM_EFLAGS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("eflags" )); -const ::rtl::OUString Filter::QUERYPARAM_SORT_PROP = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sort_prop" )); -const ::rtl::OUString Filter::QUERYPARAM_DESCENDING = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("descending" )); -const ::rtl::OUString Filter::QUERYPARAM_USE_ORDER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("use_order" )); -const ::rtl::OUString Filter::QUERYPARAM_DEFAULT_FIRST = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default_first" )); -const ::rtl::OUString Filter::QUERYPARAM_CASE_SENSITIVE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("case_sensitive")); -const ::rtl::OUString Filter::QUERYPARAMVALUE_SORT_PROP_NAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name" )); -const ::rtl::OUString Filter::QUERYPARAMVALUE_SORT_PROP_UINAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uiname" )); - -const ::rtl::OUString Filter::FLAGNAME_IMPORT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Import" )); -const ::rtl::OUString Filter::FLAGNAME_EXPORT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Export" )); -const ::rtl::OUString Filter::FLAGNAME_TEMPLATE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Template" )); -const ::rtl::OUString Filter::FLAGNAME_INTERNAL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Internal" )); -const ::rtl::OUString Filter::FLAGNAME_TEMPLATEPATH = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TemplatePath" )); -const ::rtl::OUString Filter::FLAGNAME_OWN = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Own" )); -const ::rtl::OUString Filter::FLAGNAME_ALIEN = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Alien" )); -const ::rtl::OUString Filter::FLAGNAME_USESOPTIONS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UsesOptions" )); -const ::rtl::OUString Filter::FLAGNAME_DEFAULT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default" )); -const ::rtl::OUString Filter::FLAGNAME_EXECUTABLE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Executable" )); -const ::rtl::OUString Filter::FLAGNAME_SUPPORTSSELECTION = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SupportsSelection")); -const ::rtl::OUString Filter::FLAGNAME_MAPTOAPPPLUG = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MapToAppPlug" )); -const ::rtl::OUString Filter::FLAGNAME_NOTINFILEDIALOG = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NotInFileDialog" )); -const ::rtl::OUString Filter::FLAGNAME_NOTINCHOOSER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NotInChooser" )); -const ::rtl::OUString Filter::FLAGNAME_ASYNCHRON = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Asynchron" )); -const ::rtl::OUString Filter::FLAGNAME_CREATOR = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Creator" )); -const ::rtl::OUString Filter::FLAGNAME_READONLY = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Readonly" )); -const ::rtl::OUString Filter::FLAGNAME_NOTINSTALLED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NotInstalled" )); -const ::rtl::OUString Filter::FLAGNAME_CONSULTSERVICE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConsultService" )); -const ::rtl::OUString Filter::FLAGNAME_3RDPARTYFILTER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("3rdPartyFilter" )); -const ::rtl::OUString Filter::FLAGNAME_PACKED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Packed" )); -const ::rtl::OUString Filter::FLAGNAME_SILENTEXPORT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SilentExport" )); -const ::rtl::OUString Filter::FLAGNAME_BROWSERPREFERED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BrowserPrefered" )); -const ::rtl::OUString Filter::FLAGNAME_PREFERED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Prefered" )); - -const sal_Int32 Filter::FLAGVALUE_IMPORT = 0x00000001L; // 1 -const sal_Int32 Filter::FLAGVALUE_EXPORT = 0x00000002L; // 2 -const sal_Int32 Filter::FLAGVALUE_TEMPLATE = 0x00000004L; // 4 -const sal_Int32 Filter::FLAGVALUE_INTERNAL = 0x00000008L; // 8 -const sal_Int32 Filter::FLAGVALUE_TEMPLATEPATH = 0x00000010L; // 16 -const sal_Int32 Filter::FLAGVALUE_OWN = 0x00000020L; // 32 -const sal_Int32 Filter::FLAGVALUE_ALIEN = 0x00000040L; // 64 -const sal_Int32 Filter::FLAGVALUE_USESOPTIONS = 0x00000080L; // 128 -const sal_Int32 Filter::FLAGVALUE_DEFAULT = 0x00000100L; // 256 -const sal_Int32 Filter::FLAGVALUE_EXECUTABLE = 0x00000200L; // 512 -const sal_Int32 Filter::FLAGVALUE_SUPPORTSSELECTION = 0x00000400L; // 1024 -const sal_Int32 Filter::FLAGVALUE_MAPTOAPPPLUG = 0x00000800L; // 2048 -const sal_Int32 Filter::FLAGVALUE_NOTINFILEDIALOG = 0x00001000L; // 4096 -const sal_Int32 Filter::FLAGVALUE_NOTINCHOOSER = 0x00002000L; // 8192 -const sal_Int32 Filter::FLAGVALUE_ASYNCHRON = 0x00004000L; // 16384 -const sal_Int32 Filter::FLAGVALUE_CREATOR = 0x00008000L; // 32768 -const sal_Int32 Filter::FLAGVALUE_READONLY = 0x00010000L; // 65536 -const sal_Int32 Filter::FLAGVALUE_NOTINSTALLED = 0x00020000L; // 131072 -const sal_Int32 Filter::FLAGVALUE_CONSULTSERVICE = 0x00040000L; // 262144 -const sal_Int32 Filter::FLAGVALUE_3RDPARTYFILTER = 0x00080000L; // 524288 -const sal_Int32 Filter::FLAGVALUE_PACKED = 0x00100000L; // 1048576 -const sal_Int32 Filter::FLAGVALUE_SILENTEXPORT = 0x00200000L; // 2097152 -const sal_Int32 Filter::FLAGVALUE_BROWSERPREFERED = 0x00400000L; // 4194304 -const sal_Int32 Filter::FLAGVALUE_PREFERED = 0x10000000L; // 268435456 - - } // namespace constant -} // namespace framework diff --git a/framework/source/constant/makefile.mk b/framework/source/constant/makefile.mk index 1c050db57dca..05fc28870d0a 100644 --- a/framework/source/constant/makefile.mk +++ b/framework/source/constant/makefile.mk @@ -35,8 +35,7 @@ ENABLE_EXCEPTIONS= TRUE # --- Generate ----------------------------------------------------- -SLOFILES= $(SLO)$/filter.obj \ - $(SLO)$/frameloader.obj \ +SLOFILES= $(SLO)$/frameloader.obj \ $(SLO)$/contenthandler.obj \ $(SLO)$/containerquery.obj diff --git a/framework/source/inc/constant/filter.hxx b/framework/source/inc/constant/filter.hxx deleted file mode 100644 index 141440a77716..000000000000 --- a/framework/source/inc/constant/filter.hxx +++ /dev/null @@ -1,126 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __FRAMEWORK_CONSTANT_FILTER_H_ -#define __FRAMEWORK_CONSTANT_FILTER_H_ - -#include - -namespace framework{ - namespace constant{ - -struct Filter -{ - public: - - static const ::rtl::OUString PROP_NAME; // string - static const ::rtl::OUString PROP_TYPE; // string - static const ::rtl::OUString PROP_DOCUMENTSERVICE; // string - static const ::rtl::OUString PROP_FILTERSERVICE; // string - static const ::rtl::OUString PROP_UICOMPONENT; // string - static const ::rtl::OUString PROP_FLAGS; // int32 - static const ::rtl::OUString PROP_USERDATA; // seq< string > - static const ::rtl::OUString PROP_TEMPLATENAME; // string - - static const ::rtl::OUString QUERY_GET_DEFAULT_FILTER_FOR_TYPE; - static const ::rtl::OUString QUERY_ALL; - static const ::rtl::OUString QUERY_WRITER; - static const ::rtl::OUString QUERY_WEB; - static const ::rtl::OUString QUERY_GLOBAL; - static const ::rtl::OUString QUERY_CHART; - static const ::rtl::OUString QUERY_CALC; - static const ::rtl::OUString QUERY_IMPRESS; - static const ::rtl::OUString QUERY_DRAW; - static const ::rtl::OUString QUERY_MATH; - - static const ::rtl::OUString QUERYPARAM_IFLAGS; - static const ::rtl::OUString QUERYPARAM_EFLAGS; - static const ::rtl::OUString QUERYPARAM_SORT_PROP; - static const ::rtl::OUString QUERYPARAM_DESCENDING; - static const ::rtl::OUString QUERYPARAM_USE_ORDER; - static const ::rtl::OUString QUERYPARAM_DEFAULT_FIRST; - static const ::rtl::OUString QUERYPARAM_CASE_SENSITIVE; - static const ::rtl::OUString QUERYPARAMVALUE_SORT_PROP_NAME; - static const ::rtl::OUString QUERYPARAMVALUE_SORT_PROP_UINAME; - - static const ::rtl::OUString FLAGNAME_IMPORT; - static const ::rtl::OUString FLAGNAME_EXPORT; - static const ::rtl::OUString FLAGNAME_TEMPLATE; - static const ::rtl::OUString FLAGNAME_INTERNAL; - static const ::rtl::OUString FLAGNAME_TEMPLATEPATH; - static const ::rtl::OUString FLAGNAME_OWN; - static const ::rtl::OUString FLAGNAME_ALIEN; - static const ::rtl::OUString FLAGNAME_USESOPTIONS; - static const ::rtl::OUString FLAGNAME_DEFAULT; - static const ::rtl::OUString FLAGNAME_EXECUTABLE; - static const ::rtl::OUString FLAGNAME_SUPPORTSSELECTION; - static const ::rtl::OUString FLAGNAME_MAPTOAPPPLUG; - static const ::rtl::OUString FLAGNAME_NOTINFILEDIALOG; - static const ::rtl::OUString FLAGNAME_NOTINCHOOSER; - static const ::rtl::OUString FLAGNAME_ASYNCHRON; - static const ::rtl::OUString FLAGNAME_CREATOR; - static const ::rtl::OUString FLAGNAME_READONLY; - static const ::rtl::OUString FLAGNAME_NOTINSTALLED; - static const ::rtl::OUString FLAGNAME_CONSULTSERVICE; - static const ::rtl::OUString FLAGNAME_3RDPARTYFILTER; - static const ::rtl::OUString FLAGNAME_PACKED; - static const ::rtl::OUString FLAGNAME_SILENTEXPORT; - static const ::rtl::OUString FLAGNAME_BROWSERPREFERED; - static const ::rtl::OUString FLAGNAME_PREFERED; - - static const sal_Int32 FLAGVALUE_IMPORT; - static const sal_Int32 FLAGVALUE_EXPORT; - static const sal_Int32 FLAGVALUE_TEMPLATE; - static const sal_Int32 FLAGVALUE_INTERNAL; - static const sal_Int32 FLAGVALUE_TEMPLATEPATH; - static const sal_Int32 FLAGVALUE_OWN; - static const sal_Int32 FLAGVALUE_ALIEN; - static const sal_Int32 FLAGVALUE_USESOPTIONS; - static const sal_Int32 FLAGVALUE_DEFAULT; - static const sal_Int32 FLAGVALUE_EXECUTABLE; - static const sal_Int32 FLAGVALUE_SUPPORTSSELECTION; - static const sal_Int32 FLAGVALUE_MAPTOAPPPLUG; - static const sal_Int32 FLAGVALUE_NOTINFILEDIALOG; - static const sal_Int32 FLAGVALUE_NOTINCHOOSER; - static const sal_Int32 FLAGVALUE_ASYNCHRON; - static const sal_Int32 FLAGVALUE_CREATOR; - static const sal_Int32 FLAGVALUE_READONLY; - static const sal_Int32 FLAGVALUE_NOTINSTALLED; - static const sal_Int32 FLAGVALUE_CONSULTSERVICE; - static const sal_Int32 FLAGVALUE_3RDPARTYFILTER; - static const sal_Int32 FLAGVALUE_PACKED; - static const sal_Int32 FLAGVALUE_SILENTEXPORT; - static const sal_Int32 FLAGVALUE_BROWSERPREFERED; - //FREE! ... 0x00800000L - static const sal_Int32 FLAGVALUE_PREFERED; - -}; - - } // namespace constant -} // namespace framework - -#endif // #ifndef __FRAMEWORK_CONSTANT_FILTER_H_ diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index c1d76d6f8985..79f42eba8e69 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -36,9 +36,6 @@ #endif #include -#ifndef __FRAMEWORK_CONSTANT_FILTER_HXX_ -#include -#endif #include #ifndef __FRAMEWORK_CONSTANT_FRAMELOADER_HXX_ diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index ed7e2e131550..4a94edae92b0 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -255,7 +255,6 @@ SHL4OBJS= \ $(SLO)$/droptargetlistener.obj \ $(SLO)$/edittoolbarcontroller.obj \ $(SLO)$/factoryconfiguration.obj \ - $(SLO)$/filter.obj \ $(SLO)$/framecontainer.obj \ $(SLO)$/frameloader.obj \ $(SLO)$/frame.obj \ -- cgit From 9ed2bd2cd955daefa3eed53466dc63e8ded60d17 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 26 Mar 2010 09:35:04 +0100 Subject: tl78: #i105076# add ENCRYPTION and PASSWORDTOMODIFY filter flags --- sfx2/source/dialog/filedlghelper.cxx | 46 ++++++++++++++++++++---------------- sfx2/source/doc/docfilt.cxx | 14 ----------- 2 files changed, 26 insertions(+), 34 deletions(-) diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 5270eb5d4207..5e4e7d88258c 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -466,23 +466,14 @@ sal_Bool FileDialogHelper_Impl::isInOpenMode() const namespace { -bool lclCheckODFPasswordCapability( const SfxFilter* pFilter ) +sal_Bool lclCheckPasswordCapability( const SfxFilter* pFilter ) { - return pFilter && pFilter->IsOwnFormat() && pFilter->UsesStorage() && (pFilter->GetVersion() >= SOFFICE_FILEFORMAT_60); + return pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_ENCRYPTION ); } -bool lclCheckMSPasswordCapability( const SfxFilter* pFilter ) +sal_Bool lclCheckPasswordToModifyCapability( const SfxFilter* pFilter ) { - // TODO #i105076# this should be in the filter configuration!!! - return pFilter && CheckMSPasswordCapabilityForExport( pFilter->GetFilterName() ); -} - -bool lclCheckPasswordCapability( const SfxFilter* pFilter ) -{ - return - lclCheckODFPasswordCapability( pFilter ) || - // TODO #i105076# this should be in the filter configuration!!! - lclCheckMSPasswordCapability( pFilter ); + return pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ); } } @@ -546,7 +537,7 @@ void FileDialogHelper_Impl::updateSelectionBox() return; // Does the selection box exist? - bool bSelectionBoxFound = false; + sal_Bool bSelectionBoxFound = sal_False; uno::Reference< XControlInformation > xCtrlInfo( mxFileDlg, UNO_QUERY ); if ( xCtrlInfo.is() ) { @@ -555,7 +546,7 @@ void FileDialogHelper_Impl::updateSelectionBox() for ( sal_uInt32 nCtrl = 0; nCtrl < nCount; ++nCtrl ) if ( aCtrlList[ nCtrl ].equalsAscii("SelectionBox") ) { - bSelectionBoxFound = true; + bSelectionBoxFound = sal_False; break; } } @@ -1550,6 +1541,10 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, { SFX_ITEMSET_ARG( rpSet, pPassItem, SfxStringItem, SID_PASSWORD, FALSE ); mbPwdCheckBoxState = ( pPassItem != NULL ); + + // in case the document has password to modify, the dialog should be shown + SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxStringItem, SID_PASSWORDTOMODIFY, FALSE ); + mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue() ); } SFX_ITEMSET_ARG( rpSet, pSelectItem, SfxBoolItem, SID_SELECTION, FALSE ); @@ -1560,6 +1555,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // the password will be set in case user decide so rpSet->ClearItem( SID_PASSWORD ); + rpSet->ClearItem( SID_RECOMMENDREADONLY ); + rpSet->ClearItem( SID_PASSWORDTOMODIFY ); + } if ( mbHasPassword && !mbPwdCheckBoxState ) @@ -1656,18 +1654,26 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if( xInteractionHandler.is() ) { // TODO: need a save way to distinguish MS filters from other filters - bool bMSType = CheckMSPasswordCapabilityForExport( rFilter ); + sal_Bool bMSType = CheckMSPasswordCapabilityForExport( rFilter ); ::comphelper::DocPasswordRequestType eType = bMSType ? ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD; - ::comphelper::DocPasswordRequest* pPasswordRequest = new ::comphelper::DocPasswordRequest( - eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) ); + ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), lclCheckPasswordToModifyCapability( getCurentSfxFilter() ) ) ); uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest ); xInteractionHandler->handle( rRequest ); - if ( pPasswordRequest->isPassword() ) - rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); + if ( pPasswordRequest->isSelected() ) + { + if ( pPasswordRequest->isPassword() ) + rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); + + if ( pPasswordRequest->isRecommendReadOnly() ) + rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); + + if ( pPasswordRequest->getPasswordToModify().getLength() ) + rpSet->Put( SfxStringItem( SID_PASSWORDTOMODIFY, pPasswordRequest->getPasswordToModify() ) ); + } else return ERRCODE_ABORT; } diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index e955c43af705..1219d30d7b27 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -49,20 +49,6 @@ using namespace ::com::sun::star; -namespace sfx2 { - -// TODO #i105076# this should be in the filter configuration!!! -bool CheckMSPasswordCapabilityForExport( const String& rFilterName ) -{ - return - rFilterName.EqualsAscii( "MS Word 97" ) || - rFilterName.EqualsAscii( "MS Word 97 Vorlage" ) || - rFilterName.EqualsAscii( "MS Excel 97" ) || - rFilterName.EqualsAscii( "MS Excel 97 Vorlage/Template" ); -} - -} // namespace sfx2 - // STATIC DATA ----------------------------------------------------------- DBG_NAME(SfxFilter) -- cgit From a6c29b00be50f9b48c56903d5764518b7b3aced9 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 26 Mar 2010 09:35:40 +0100 Subject: tl78: #i105076# add ENCRYPTION and PASSWORDTOMODIFY filter flags --- sfx2/inc/sfx2/docfilt.hxx | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/sfx2/inc/sfx2/docfilt.hxx b/sfx2/inc/sfx2/docfilt.hxx index b4118272bb88..f024fdb07c06 100644 --- a/sfx2/inc/sfx2/docfilt.hxx +++ b/sfx2/inc/sfx2/docfilt.hxx @@ -37,6 +37,7 @@ #include #include +// TODO/LATER: The flags should be part of the UNO specification #define SFX_FILTER_IMPORT 0x00000001L #define SFX_FILTER_EXPORT 0x00000002L #define SFX_FILTER_TEMPLATE 0x00000004L @@ -45,13 +46,13 @@ #define SFX_FILTER_OWN 0x00000020L #define SFX_FILTER_ALIEN 0x00000040L #define SFX_FILTER_USESOPTIONS 0x00000080L -#define SFX_FILTER_NOTINFILEDLG 0x00001000L -#define SFX_FILTER_NOTINCHOOSER 0x00002000L #define SFX_FILTER_DEFAULT 0x00000100L #define SFX_FILTER_EXECUTABLE 0x00000200L #define SFX_FILTER_SUPPORTSSELECTION 0x00000400L #define SFX_FILTER_MAPTOAPPPLUG 0x00000800L +#define SFX_FILTER_NOTINFILEDLG 0x00001000L +#define SFX_FILTER_NOTINCHOOSER 0x00002000L #define SFX_FILTER_ASYNC 0x00004000L // Legt Objekt nur an, kein Laden #define SFX_FILTER_CREATOR 0x00008000L @@ -64,6 +65,10 @@ #define SFX_FILTER_SILENTEXPORT 0x00200000L #define SFX_FILTER_BROWSERPREFERED 0x00400000L + +#define SFX_FILTER_ENCRYPTION 0x01000000L +#define SFX_FILTER_PASSWORDTOMODIFY 0x02000000L + #define SFX_FILTER_PREFERED 0x10000000L #define SFX_FILTER_VERSION_NONE 0 @@ -71,20 +76,6 @@ #include -//======================================================================== - -namespace sfx2 { - -/** Returns true if the passed string is the name of a Microsoft Office file - format filter supporting export of password protected documents. - - This function is just a hack for #i105076# is fixed and needs to be removed - then. - */ -SFX2_DLLPUBLIC bool CheckMSPasswordCapabilityForExport( const String& rFilterName ); - -} // namespace sfx2 - //======================================================================== class SfxFilterContainer; class SotStorage; -- cgit From d160fd054bc4e8c02152d7ce55f7eddbd611e01f Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 30 Mar 2010 16:47:18 +0200 Subject: tl78: #i110383# support password to modify --- sfx2/inc/sfx2/sfxsids.hrc | 5 +- sfx2/sdi/sfx.sdi | 30 +++++++++- sfx2/source/dialog/filedlghelper.cxx | 51 ++++++++++++++-- sfx2/source/doc/guisaveas.cxx | 109 +++++++++++++++++++++++++++++++++++ sfx2/source/doc/objstor.cxx | 51 +--------------- 5 files changed, 188 insertions(+), 58 deletions(-) diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index a7c73d3e14d8..64bb5692cf09 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -505,8 +505,9 @@ #define SID_ACTIVATE_STYLE_APPLY (SID_SFX_START + 1715) #define SID_FONT_NAME (SID_SFX_START + 1716) #define SID_DEFAULTFILENAME (SID_SFX_START + 1717) -#define SID_MODIFYPASSWORDHASH (SID_SFX_START + 1718) -#define SID_SFX_free_START (SID_SFX_START + 1719) +#define SID_PASSWORDTOMODIFYHASH (SID_SFX_START + 1718) +#define SID_RECOMMENDREADONLY (SID_SFX_START + 1719) +#define SID_SFX_free_START (SID_SFX_START + 1720) #define SID_SFX_free_END (SID_SFX_START + 3999) #define SID_OPEN_NEW_VIEW (SID_SFX_START + 520) diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 1b59c639a17d..9df71c085b25 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3990,7 +3990,7 @@ SfxVoidItem MacroOrganizer SID_MACROORGANIZER ] //-------------------------------------------------------------------------- -SfxInt32Item ModifyPasswordHash SID_MODIFYPASSWORDHASH +SfxUInt16Item PasswordToModifyHash SID_PASSWORDTOMODIFYHASH [ /* flags: */ @@ -4016,6 +4016,34 @@ SfxInt32Item ModifyPasswordHash SID_MODIFYPASSWORDHASH GroupId = ; ] +//-------------------------------------------------------------------------- +SfxBoolItem ReccomendReadonly SID_RECOMMENDREADONLY + +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = TRUE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = TRUE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = ; +] + + //-------------------------------------------------------------------------- SfxVoidItem RunMacro SID_RUNMACRO () diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 5e4e7d88258c..adca8cdb7922 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -80,6 +80,7 @@ #include #include #include +#include #include #include #include @@ -1543,7 +1544,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, mbPwdCheckBoxState = ( pPassItem != NULL ); // in case the document has password to modify, the dialog should be shown - SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxStringItem, SID_PASSWORDTOMODIFY, FALSE ); + SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUInt16Item, SID_PASSWORDTOMODIFYHASH, FALSE ); mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue() ); } @@ -1556,7 +1557,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // the password will be set in case user decide so rpSet->ClearItem( SID_PASSWORD ); rpSet->ClearItem( SID_RECOMMENDREADONLY ); - rpSet->ClearItem( SID_PASSWORDTOMODIFY ); + rpSet->ClearItem( SID_PASSWORDTOMODIFYHASH ); } @@ -1634,8 +1635,10 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // set the filter getRealFilter( rFilter ); + SfxFilter* pCurrentFilter = getCurentSfxFilter(); + // fill the rpURLList - implGetAndCacheFiles(mxFileDlg, rpURLList, getCurentSfxFilter()); + implGetAndCacheFiles( mxFileDlg, rpURLList, pCurrentFilter ); if ( rpURLList == NULL || rpURLList->GetObject(0) == NULL ) return ERRCODE_ABORT; @@ -1654,12 +1657,13 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if( xInteractionHandler.is() ) { // TODO: need a save way to distinguish MS filters from other filters - sal_Bool bMSType = CheckMSPasswordCapabilityForExport( rFilter ); + // for now MS-filters are the only alien filters that support encryption + sal_Bool bMSType = !pCurrentFilter->isOwn(); ::comphelper::DocPasswordRequestType eType = bMSType ? ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD; - ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), lclCheckPasswordToModifyCapability( getCurentSfxFilter() ) ) ); + ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), lclCheckPasswordToModifyCapability( pCurrentFilter ) ) ); uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest ); xInteractionHandler->handle( rRequest ); @@ -1672,7 +1676,42 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); if ( pPasswordRequest->getPasswordToModify().getLength() ) - rpSet->Put( SfxStringItem( SID_PASSWORDTOMODIFY, pPasswordRequest->getPasswordToModify() ) ); + { + rtl_TextEncoding nEncoding = RTL_TEXTENCOFING_UTF8; + if ( bMSType ) + { + // if the MS-filter should be used + // use the inconsistent algorithm to find the encoding specified by MS + nEncoding = rtl_getThreadTextEncoding(); + switch( nEncoding ) + { + case RTL_TEXTENCODING_ISO_8859_15: + case RTL_TEXTENCODING_MS_874: + case RTL_TEXTENCODING_MS_1250: + case RTL_TEXTENCODING_MS_1251: + case RTL_TEXTENCODING_MS_1252: + case RTL_TEXTENCODING_MS_1253: + case RTL_TEXTENCODING_MS_1254: + case RTL_TEXTENCODING_MS_1255: + case RTL_TEXTENCODING_MS_1256: + case RTL_TEXTENCODING_MS_1257: + case RTL_TEXTENCODING_MS_1258: + case RTL_TEXTENCODING_SHIFT_JIS: + case RTL_TEXTENCODING_GB_2312: + case RTL_TEXTENCODING_BIG5: + // in case the system uses an encoding from the list above, it should be used + break; + + default: + // in case other encoding is used, use one of the encodings from the list + nEncoding = RTL_TEXTENCODING_MS_1250; + break; + } + } + + sal_uInt16 nHash = ::comphelper::DocPasswordHelper::GetXLHashAsUINT16( pPasswordRequest->getPasswordToModify(), nEncoding ); + rpSet->Put( SfxUInt16Item( SID_PASSWORDTOMODIFYHASH, nHash ) ); + } } else return ERRCODE_ABORT; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index cbd269b41516..4993e96b40bb 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -62,6 +62,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -80,6 +83,7 @@ #include #include #include +#include #include #include "alienwarn.hxx" @@ -108,6 +112,7 @@ const ::rtl::OUString aFilterFlagsString = ::rtl::OUString::createFromAscii( " using namespace ::com::sun::star; +namespace { //------------------------------------------------------------------------- static sal_uInt16 getSlotIDFromMode( sal_Int8 nStoreMode ) { @@ -167,6 +172,88 @@ static sal_Int32 getDontFlags( sal_Int8 nStoreMode ) | ( ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) ) ? SFX_FILTER_IMPORT : 0 ) ); } +//========================================================================= +// class DocumentSettingsGuard +//========================================================================= + +class DocumentSettingsGuard +{ + uno::Reference< beans::XPropertySet > m_xDocumentSettings; + sal_Bool m_bPreserveReadOnly; + sal_uInt16 m_nPreserveHash; + + sal_Bool m_bReadOnlySupported; + sal_Bool m_bModifyPasswordHashSupported; + + sal_Bool m_bRestoreSettings; +public: + DocumentSettingsGuard( const uno::Reference< frame::XModel >& xModel, sal_Bool bReadOnly, sal_uInt16 nHash, sal_Bool bRestore ) + : m_bPreserveReadOnly( sal_False ) + , m_nPreserveHash( 0 ) + , m_bReadOnlySupported( sal_False ) + , m_bModifyPasswordHashSupported( sal_False ) + , m_bRestoreSettings( bRestore ) + { + try + { + uno::Reference< lang::XMultiServiceFactory > xDocSettingsSupplier( xModel, uno::UNO_QUERY_THROW ); + m_xDocumentSettings.set( + xDocSettingsSupplier->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), + uno::UNO_QUERY_THROW ); + + ::rtl::OUString aLoadReadonlyString( RTL_CONSTASCII_USTRINGPARAM( "LoadReadonly" ) ); + ::rtl::OUString aModifyPasswordHashString( RTL_CONSTASCII_USTRINGPARAM( "ModifyPasswordHash" ) ); + + try + { + m_xDocumentSettings->getPropertyValue( aLoadReadonlyString ) >>= m_bPreserveReadOnly; + m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::makeAny( bReadOnly ) ); + m_bReadOnlySupported = sal_True; + } + catch( uno::Exception& ) + {} + + try + { + m_xDocumentSettings->getPropertyValue( aModifyPasswordHashString ) >>= m_nPreserveHash; + m_xDocumentSettings->setPropertyValue( aModifyPasswordHashString, uno::makeAny( nHash ) ); + m_bModifyPasswordHashSupported = sal_True; + } + catch( uno::Exception& ) + {} + } + catch( uno::Exception& ) + {} + + if ( ( bReadOnly && !m_bReadOnlySupported ) || ( nHash && !m_bModifyPasswordHashSupported ) ) + throw uno::RuntimeException(); // the user could provide the data, so it must be stored + } + + ~DocumentSettingsGuard() + { + if ( m_bRestoreSettings ) + { + ::rtl::OUString aLoadReadonlyString( RTL_CONSTASCII_USTRINGPARAM( "LoadReadonly" ) ); + ::rtl::OUString aModifyPasswordHashString( RTL_CONSTASCII_USTRINGPARAM( "ModifyPasswordHash" ) ); + + try + { + if ( m_bReadOnlySupported ) + m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::makeAny( m_bPreserveReadOnly ) ); + + if ( m_bModifyPasswordHashSupported ) + m_xDocumentSettings->setPropertyValue( aModifyPasswordHashString, uno::makeAny( m_nPreserveHash ) ); + } + catch( uno::Exception& ) + { + OSL_ASSERT( "Unexpected exception!" ); + } + } + } +}; +} // anonymous namespace + //========================================================================= // class ModelData_Impl //========================================================================= @@ -184,6 +271,9 @@ class ModelData_Impl ::comphelper::SequenceAsHashMap m_aMediaDescrHM; + sal_Bool m_bRecommendReadOnly; + sal_uInt16 m_nPasswordToModifyHash; + public: ModelData_Impl( SfxStoringHelper& aOwner, const uno::Reference< frame::XModel >& xModel, @@ -200,6 +290,9 @@ public: ::comphelper::SequenceAsHashMap& GetMediaDescr() { return m_aMediaDescrHM; } + sal_Bool IsRecommendReadOnly() { return m_bRecommendReadOnly; } + sal_uInt16 GetPasswordToModifyHash() { return m_nPasswordToModifyHash; } + const ::comphelper::SequenceAsHashMap& GetDocProps(); ::rtl::OUString GetModuleName(); @@ -252,6 +345,9 @@ ModelData_Impl::ModelData_Impl( SfxStoringHelper& aOwner, , m_pDocumentPropsHM( NULL ) , m_pModulePropsHM( NULL ) , m_aMediaDescrHM( aMediaDescr ) +, m_bRecommendReadOnly( sal_False ) +, m_nPasswordToModifyHash( 0 ) + { CheckInteractionHandler(); } @@ -916,6 +1012,17 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, ::rtl::OUString aFilterName = aStringTypeFN; + // the following two arguments can not be converted in MediaDescriptor, + // so they should be removed from the ItemSet after retrieving + SFX_ITEMSET_ARG( pDialogParams, pRecommendReadOnly, SfxBoolItem, SID_RECOMMENDREADONLY, sal_False ); + m_bRecommendReadOnly = ( pRecommendReadOnly && pRecommendReadOnly->GetValue() ); + pDialogParams->ClearItem( SID_RECOMMENDREADONLY ); + + SFX_ITEMSET_ARG( pDialogParams, pPassToModifyItem, SfxUInt16Item, SID_PASSWORDTOMODIFYHASH, sal_False ); + if ( pPassToModifyItem ) + m_nPasswordToModifyHash = pPassToModifyItem->GetValue(); + pDialogParams->ClearItem( SID_PASSWORDTOMODIFYHASH ); + uno::Sequence< beans::PropertyValue > aPropsFromDialog; TransformItems( nSlotID, *pDialogParams, aPropsFromDialog, NULL ); GetMediaDescr() << aPropsFromDialog; @@ -1500,6 +1607,8 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& // store the document and handle it's docinfo SvtSaveOptions aOptions; + DocumentSettingsGuard aSettingsGuard( aModelData.GetModel(), aModelData.IsRecommendReadOnly(), aModelData.GetPasswordToModifyHash(), nStoreMode & EXPORT_REQUESTED ); + if ( aOptions.IsDocInfoSave() && ( !aModelData.GetStorable()->hasLocation() || INetURLObject( aModelData.GetStorable()->getLocation() ) != aURL ) ) diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 593de3d181f1..b710a4b0fbfe 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1376,7 +1376,6 @@ sal_Bool SfxObjectShell::SaveTo_Impl { if ( pFilt->GetServiceName() != rMedium.GetFilter()->GetServiceName() ) { -//REMOVE rMedium.GetStorage()->SetClass( SvFactory::GetServerName( nFormat ), nFormat, pFilt->GetTypeName() ); datatransfer::DataFlavor aDataFlavor; SotExchange::GetFormatDataFlavor( nFormat, aDataFlavor ); @@ -2093,9 +2092,6 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) } else { -//REMOVE if( pFilter->UsesStorage() ) -//REMOVE pMedium->GetStorage(); -//REMOVE else if( pMedium->GetOpenMode() & STREAM_WRITE ) if( pMedium->GetOpenMode() & STREAM_WRITE ) pMedium->GetInStream(); xStorage = GetStorage(); @@ -2632,9 +2628,6 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) SetError(pMediumTmp->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); -//REMOVE if ( !IsHandsOff() ) -//REMOVE pMediumTmp->Close(); - sal_Bool bOpen( sal_False ); bOpen = DoSaveCompleted( pMediumTmp ); DBG_ASSERT(bOpen,"Fehlerbehandlung fuer DoSaveCompleted nicht implementiert"); @@ -2645,13 +2638,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) SetError( pMediumTmp->GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // reconnect to object storage -//REMOVE if ( IsHandsOff() ) -//REMOVE { -//REMOVE if ( !DoSaveCompleted( pRetrMedium ) ) -//REMOVE DBG_ERROR("Case not handled - no way to get a storage!"); -//REMOVE } -//REMOVE else - DoSaveCompleted( 0 ); + DoSaveCompleted( 0 ); if( pRetrMedium->GetItemSet() ) { @@ -2910,8 +2897,6 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl else pNewFile->SetFilter( GetFactory().GetFilterContainer()->GetAnyFilter( SFX_FILTER_IMPORT | SFX_FILTER_EXPORT ) ); -//REMOVE // saving is alway done using a temporary file -//REMOVE pNewFile->CreateTempFileNoCopy(); if ( pNewFile->GetErrorCode() != ERRCODE_NONE ) { // creating temporary file failed ( f.e. floppy disk not inserted! ) @@ -2948,18 +2933,8 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // notify the document that saving was done successfully -//REMOVE if ( bCopyTo ) -//REMOVE { -//REMOVE if ( IsHandsOff() ) -//REMOVE bOk = DoSaveCompleted( pMedium ); -//REMOVE } -//REMOVE else if ( !bCopyTo ) { - // Muss !!! -//REMOVE if ( bToOwnFormat ) -//REMOVE SetFileName( pNewFile->GetPhysicalName() ); - bOk = DoSaveCompleted( pNewFile ); } else @@ -2991,31 +2966,12 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl // by the storage DELETEZ( pNewFile ); } - - // TODO/LATER: there is no need in the following code in case HandsOff is not used, - // hope we will not have to introduce it back -//REMOVE String aPasswd; -//REMOVE if ( IsOwnStorageFormat_Impl( *GetMedium() ) && GetPasswd_Impl( GetMedium()->GetItemSet(), aPasswd ) ) -//REMOVE { -//REMOVE try -//REMOVE { -//REMOVE // the following code must throw an exception in case of failure -//REMOVE ::comphelper::OStorageHelper::SetCommonStoragePassword( GetMedium->GetStorage(), aPasswd ); -//REMOVE } -//REMOVE catch( uno::Exception& ) -//REMOVE { -//REMOVE // TODO: handle the error -//REMOVE } -//REMOVE } } else { SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); -//REMOVE // reconnect to the old storage -//REMOVE if ( IsHandsOff() ) -//REMOVE DoSaveCompleted( pMedium ); -//REMOVE else + // reconnect to the old storage DoSaveCompleted( 0 ); DELETEZ( pNewFile ); @@ -3196,9 +3152,6 @@ sal_Bool SfxObjectShell::LoadOwnFormat( SfxMedium& rMedium ) uno::Reference< embed::XStorage > xStorage = rMedium.GetStorage(); if ( xStorage.is() ) { -//REMOVE if ( rMedium.GetFileVersion() ) -//REMOVE xStor->SetVersion( rMedium.GetFileVersion() ); - // Password SFX_ITEMSET_ARG( rMedium.GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False ); if ( pPasswdItem || ERRCODE_IO_ABORT != CheckPasswd_Impl( this, SFX_APP()->GetPool(), pMedium ) ) -- cgit From 0e95d8378a6f670993a3d408d3bfe313385379e8 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 30 Mar 2010 16:34:51 +0200 Subject: tl78: #i110383# support password to modify --- sfx2/inc/sfx2/objsh.hxx | 3 +++ sfx2/source/dialog/filedlghelper.cxx | 16 ++++++++-------- sfx2/source/doc/objcont.cxx | 17 +++++++++++++++++ sfx2/source/doc/objxtor.cxx | 1 + sfx2/source/inc/objshimp.hxx | 2 ++ 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index e0142e9ba140..99161cb5b36c 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -444,6 +444,9 @@ public: void SetSaveVersionOnClose( sal_Bool bSet ); void ResetFromTemplate( const String& rTemplateName, const String& rFileName ); + sal_uInt16 GetModifyPasswordHash() const; + sal_Bool SetModifyPasswordHash( sal_uInt16 nHash ); + static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc ); virtual void ViewAssigned(); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index adca8cdb7922..c1b9aaf7838d 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1635,7 +1635,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // set the filter getRealFilter( rFilter ); - SfxFilter* pCurrentFilter = getCurentSfxFilter(); + const SfxFilter* pCurrentFilter = getCurentSfxFilter(); // fill the rpURLList implGetAndCacheFiles( mxFileDlg, rpURLList, pCurrentFilter ); @@ -1658,31 +1658,31 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, { // TODO: need a save way to distinguish MS filters from other filters // for now MS-filters are the only alien filters that support encryption - sal_Bool bMSType = !pCurrentFilter->isOwn(); + sal_Bool bMSType = !pCurrentFilter->IsOwnFormat(); ::comphelper::DocPasswordRequestType eType = bMSType ? ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD; ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), lclCheckPasswordToModifyCapability( pCurrentFilter ) ) ); - uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest ); + uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() ); xInteractionHandler->handle( rRequest ); - if ( pPasswordRequest->isSelected() ) + if ( pPasswordRequest->isPassword() ) { - if ( pPasswordRequest->isPassword() ) + if ( pPasswordRequest->getPassword().getLength() ) rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); - if ( pPasswordRequest->isRecommendReadOnly() ) + if ( pPasswordRequest->getRecommendReadOnly() ) rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); if ( pPasswordRequest->getPasswordToModify().getLength() ) { - rtl_TextEncoding nEncoding = RTL_TEXTENCOFING_UTF8; + rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8; if ( bMSType ) { // if the MS-filter should be used // use the inconsistent algorithm to find the encoding specified by MS - nEncoding = rtl_getThreadTextEncoding(); + nEncoding = osl_getThreadTextEncoding(); switch( nEncoding ) { case RTL_TEXTENCODING_ISO_8859_15: diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 207a5096a89a..b1a5968b2b5a 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1479,3 +1479,20 @@ void SfxObjectShell::SetSaveVersionOnClose( sal_Bool bNew ) pImp->bSaveVersionOnClose = bNew; } +sal_uInt16 SfxObjectShell::GetModifyPasswordHash() const +{ + return pImp->m_nModifyPasswordHash; +} + +sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt16 nHash ) +{ + if ( !IsReadOnly() && !IsReadOnlyUI() ) + { + // the hash can be changed only in editable documents, + pImp->m_nModifyPasswordHash = nHash; + return sal_True; + } + + return sal_False; +} + diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index e3e3a36505a5..0ed230dd9dd9 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -262,6 +262,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_xDocInfoListener() ,m_bIsInit( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) + ,m_nModifyPasswordHash( 0 ) { } diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index e015058ae280..a97018e4b3f6 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -170,6 +170,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool m_bIncomplEncrWarnShown; + sal_uInt16 m_nModifyPasswordHash; + SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); virtual ~SfxObjectShell_Impl(); -- cgit From 9ace57ec709cd618b5401da6f1ebacba5a07c1c0 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 1 Apr 2010 15:31:41 +0200 Subject: tl78: #i110383# allow to change the hash always for now --- sfx2/source/doc/objcont.cxx | 15 +++++++++------ sfx2/source/doc/objxtor.cxx | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index b1a5968b2b5a..5d14007ec169 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1486,13 +1486,16 @@ sal_uInt16 SfxObjectShell::GetModifyPasswordHash() const sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt16 nHash ) { - if ( !IsReadOnly() && !IsReadOnlyUI() ) - { - // the hash can be changed only in editable documents, +// Commented out before the solution for Saving process is found +// if ( ( !IsReadOnly() && !IsReadOnlyUI() ) +// || !(pImp->nFlagsInProgress & SFX_LOADED_MAINDOCUMENT ) ) +// { +// // the hash can be changed only in editable documents, +// // or during loading of document pImp->m_nModifyPasswordHash = nHash; return sal_True; - } - - return sal_False; +// } +// +// return sal_False; } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 0ed230dd9dd9..0b0c356b65ed 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -261,6 +261,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bCreateTempStor( sal_False ) ,m_xDocInfoListener() ,m_bIsInit( sal_False ) + ,m_bUIStoring( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) ,m_nModifyPasswordHash( 0 ) { -- cgit From 62eee956dbb05c25600030ab47310bf39db0c7ee Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 1 Apr 2010 15:37:38 +0200 Subject: tl78: #i110383# fix typo --- sfx2/source/doc/objxtor.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 0b0c356b65ed..0ed230dd9dd9 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -261,7 +261,6 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bCreateTempStor( sal_False ) ,m_xDocInfoListener() ,m_bIsInit( sal_False ) - ,m_bUIStoring( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) ,m_nModifyPasswordHash( 0 ) { -- cgit From fb70a4cd3b77e0ea6bb5820b47bfd7ea39fa3228 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Tue, 6 Apr 2010 17:15:01 +0200 Subject: jl152 import 263445 from native0jl:#i77196# supporting extension help --- desktop/source/deployment/registry/dp_backend.cxx | 9 + .../source/deployment/registry/help/dp_help.cxx | 583 +++++++++++---------- .../deployment/registry/help/dp_helpbackenddb.cxx | 10 +- .../deployment/registry/help/dp_helpbackenddb.hxx | 3 +- .../source/deployment/registry/inc/dp_backend.h | 3 + xmlhelp/source/cxxhelp/provider/databases.cxx | 178 +++++-- xmlhelp/source/cxxhelp/provider/databases.hxx | 19 +- xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 10 +- xmlhelp/source/cxxhelp/provider/urlparameter.hxx | 3 + 9 files changed, 492 insertions(+), 326 deletions(-) diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index dcfc2c6b3d2f..be752bcf0733 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -716,6 +716,15 @@ OUString Package::getRepositoryName() return backEnd->getContext(); } +beans::Optional< OUString > Package::getRegistrationDataURL() + throw (deployment::ExtensionRemovedException, + css::uno::RuntimeException) +{ + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + return beans::Optional(); +} + sal_Bool Package::isRemoved() throw (RuntimeException) { diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index b594f9395ceb..aeeec94981e6 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -46,7 +46,7 @@ #include #include #include - +#include "boost/optional.hpp" using namespace ::dp_misc; using namespace ::com::sun::star; @@ -80,11 +80,15 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference const & xCmdEnv ); public: - inline PackageImpl( + PackageImpl( ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, bool bRemoved, OUString const & identifier); + + //XPackage + virtual css::beans::Optional< ::rtl::OUString > SAL_CALL getRegistrationDataURL() + throw (deployment::ExtensionRemovedException, css::uno::RuntimeException); }; friend class PackageImpl; @@ -98,13 +102,13 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference const & xCmdEnv); void implCollectXhpFiles( const rtl::OUString& aDir, std::vector< rtl::OUString >& o_rXhpFileVector ); - rtl::OUString getFlagFileURL( Reference< deployment::XPackage > xPackage, const char* pFlagStr ); - rtl::OUString getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage ); - rtl::OUString getCompiledFlagFileURL( Reference< deployment::XPackage > xPackage ); - rtl::OUString expandURL( const rtl::OUString& aURL ); +// rtl::OUString getFlagFileURL( Reference< deployment::XPackage > xPackage, const char* pFlagStr ); +// rtl::OUString getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage ); +// rtl::OUString getCompiledFlagFileURL( Reference< deployment::XPackage > xPackage ); +// rtl::OUString expandURL( const rtl::OUString& aURL ); void addDataToDb(OUString const & url, HelpBackendDb::Data const & data); - HelpBackendDb::Data readDataFromDb(OUString const & url); + ::boost::optional readDataFromDb(OUString const & url); void deleteDataFromDb(OUString const & url); Reference< ucb::XSimpleFileAccess > getFileAccess( void ); @@ -208,10 +212,10 @@ void BackendImpl::addDataToDb( m_backendDb->addEntry(url, data); } -HelpBackendDb::Data BackendImpl::readDataFromDb( +::boost::optional BackendImpl::readDataFromDb( OUString const & url) { - HelpBackendDb::Data data; + ::boost::optional data; if (m_backendDb.get()) data = m_backendDb->getEntry(url); return data; @@ -232,7 +236,12 @@ BackendImpl::PackageImpl::PackageImpl( : Package( myBackend, url, name, name, xPackageType, bRemoved, identifier) { if (bRemoved) - m_dbData = getMyBackend()->readDataFromDb(url); + { + ::boost::optional opt = + getMyBackend()->readDataFromDb(url); + if (opt) + m_dbData = *opt; + } } // Package @@ -259,11 +268,10 @@ BackendImpl::PackageImpl::isRegistered_( Reference const & ) { BackendImpl * that = getMyBackend(); - Reference< deployment::XPackage > xThisPackage( this ); - rtl::OUString aRegisteredFlagFile = that->getRegisteredFlagFileURL( xThisPackage ); - Reference< ucb::XSimpleFileAccess > xSFA = that->getFileAccess(); - bool bReg = xSFA->exists( aRegisteredFlagFile ); + bool bReg = false; + if (that->readDataFromDb(getURL())) + bReg = true; return beans::Optional< beans::Ambiguous >( true, beans::Ambiguous( bReg, false ) ); } @@ -291,6 +299,23 @@ void BackendImpl::PackageImpl::processPackage_( // getMyBackend()->deleteDataFromDb(getURL()); } +beans::Optional< OUString > BackendImpl::PackageImpl::getRegistrationDataURL() + throw (deployment::ExtensionRemovedException, + css::uno::RuntimeException) +{ + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + + ::boost::optional data = + getMyBackend()->readDataFromDb(getURL()); + + if (data) + return beans::Optional(true, data->dataUrl); + + return beans::Optional(true, OUString()); +} + + //############################################################################## static rtl::OUString aSlash( rtl::OUString::createFromAscii( "/" ) ); @@ -305,232 +330,230 @@ void BackendImpl::implProcessHelp if (doRegisterPackage) { HelpBackendDb::Data data; - Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); + const OUString sHelpFolder = createFolder(OUString(), xCmdEnv); + data.dataUrl = sHelpFolder; - rtl::OUString aRegisteredFlagFile = getRegisteredFlagFileURL( xPackage ); - if( !doRegisterPackage ) + Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); + rtl::OUString aHelpURL = xPackage->getURL(); + rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL ); + rtl::OUString aName = xPackage->getName(); + if( !xSFA->isFolder( aExpandedHelpURL ) ) { - if( xSFA->exists( aRegisteredFlagFile ) ) - xSFA->kill( aRegisteredFlagFile ); - return; + rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR ); + aErrStr += rtl::OUString::createFromAscii( "No help folder" ); + OWeakObject* oWeakThis = static_cast(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); } - bool bCompile = true; - rtl::OUString aCompiledFlagFile = getCompiledFlagFileURL( xPackage ); - if( xSFA->exists( aCompiledFlagFile ) ) - bCompile = false; - - if( bCompile ) + Reference const & xContext = getComponentContext(); + Reference< script::XInvocation > xInvocation; + if( xContext.is() ) { - OUString sHelpFolder = createFolder(OUString(), xCmdEnv); - data.dataUrl = sHelpFolder; - rtl::OUString aHelpURL = xPackage->getURL(); - rtl::OUString aExpandedHelpURL = expandURL( aHelpURL ); - rtl::OUString aName = xPackage->getName(); - if( !xSFA->isFolder( aExpandedHelpURL ) ) + try { - rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR ); - aErrStr += rtl::OUString::createFromAscii( "No help folder" ); - OWeakObject* oWeakThis = static_cast(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + xInvocation = Reference< script::XInvocation >( + xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( + "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY ); } - - Reference const & xContext = getComponentContext(); - Reference< script::XInvocation > xInvocation; - if( xContext.is() ) + catch (Exception &) { - try - { - xInvocation = Reference< script::XInvocation >( - xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( - "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY ); - } - catch (Exception &) - { - // i98680: Survive missing lucene - } + // i98680: Survive missing lucene } + } - // Scan languages - Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true ); - sal_Int32 nLangCount = aLanguageFolderSeq.getLength(); - const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray(); - for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang ) + // Scan languages + Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true ); + sal_Int32 nLangCount = aLanguageFolderSeq.getLength(); + const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray(); + for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang ) + { + rtl::OUString aLangURL = pSeq[iLang]; + if( xSFA->isFolder( aLangURL ) ) { - rtl::OUString aLangURL = pSeq[iLang]; - if( xSFA->isFolder( aLangURL ) ) + std::vector< rtl::OUString > aXhpFileVector; + + // Delete (old) files in any case to allow compiler to be started every time +// rtl::OUString aLangWithPureNameURL( aLangURL ); +// aLangWithPureNameURL += aSlash; +// aLangWithPureNameURL += aHelpStr; +// rtl::OUString aDbFile( aLangWithPureNameURL ); +// aDbFile += rtl::OUString::createFromAscii( ".db" ); +// if( xSFA->exists( aDbFile ) ) +// xSFA->kill( aDbFile ); +// rtl::OUString aHtFile( aLangWithPureNameURL ); +// aHtFile += rtl::OUString::createFromAscii( ".ht" ); +// if( xSFA->exists( aHtFile ) ) +// xSFA->kill( aHtFile ); +// rtl::OUString aKeyFile( aLangWithPureNameURL ); +// aKeyFile += rtl::OUString::createFromAscii( ".key" ); +// if( xSFA->exists( aKeyFile ) ) +// xSFA->kill( aKeyFile ); + + // calculate jar file URL + sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/'); + // for example "/en" + OUString langFolderURLSegment( + aLangURL.copy( + indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1)); + + //create the folder in the "temporary folder" + ::ucbhelper::Content langFolderContent; + const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment); + const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest); + ::dp_misc::create_folder( + &langFolderContent, + langFolderDest, xCmdEnv); + + rtl::OUString aJarFile( + makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr + + OUSTR(".jar"))); +// aJarFile += aSlash; +// aJarFile += aHelpStr; +// aJarFile += rtl::OUString::createFromAscii( ".jar" ); + // remove in any case to clean up +// if( xSFA->exists( aJarFile ) ) +// xSFA->kill( aJarFile ); + aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile); + + rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( + aJarFile, rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ); + rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); + aDestBasePath += aEncodedJarFilePath; + aDestBasePath += rtl::OUString::createFromAscii( "/" ); + + sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1; + + Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true ); + sal_Int32 nSubLangCount = aSubLangSeq.getLength(); + const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray(); + for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang ) { - std::vector< rtl::OUString > aXhpFileVector; - - // Delete (old) files in any case to allow compiler to be started every time - rtl::OUString aLangWithPureNameURL( aLangURL ); - aLangWithPureNameURL += aSlash; - aLangWithPureNameURL += aHelpStr; - rtl::OUString aDbFile( aLangWithPureNameURL ); - aDbFile += rtl::OUString::createFromAscii( ".db" ); - if( xSFA->exists( aDbFile ) ) - xSFA->kill( aDbFile ); - rtl::OUString aHtFile( aLangWithPureNameURL ); - aHtFile += rtl::OUString::createFromAscii( ".ht" ); - if( xSFA->exists( aHtFile ) ) - xSFA->kill( aHtFile ); - rtl::OUString aKeyFile( aLangWithPureNameURL ); - aKeyFile += rtl::OUString::createFromAscii( ".key" ); - if( xSFA->exists( aKeyFile ) ) - xSFA->kill( aKeyFile ); - - // calculate jar file URL - rtl::OUString aJarFile( aLangURL ); - aJarFile += aSlash; - aJarFile += aHelpStr; - aJarFile += rtl::OUString::createFromAscii( ".jar" ); - // remove in any case to clean up - if( xSFA->exists( aJarFile ) ) - xSFA->kill( aJarFile ); - - rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( aJarFile, - rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ); - rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); - aDestBasePath += aEncodedJarFilePath; - aDestBasePath += rtl::OUString::createFromAscii( "/" ); - - sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1; - - Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true ); - sal_Int32 nSubLangCount = aSubLangSeq.getLength(); - const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray(); - for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang ) - { - rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang]; - if( !xSFA->isFolder( aSubFolderURL ) ) - continue; + rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang]; + if( !xSFA->isFolder( aSubFolderURL ) ) + continue; - implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); + implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); - // Copy to package (later: move?) - rtl::OUString aDestPath = aDestBasePath; - rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); - aDestPath += aPureFolderName; - xSFA->copy( aSubFolderURL, aDestPath ); - } + // Copy to package (later: move?) + rtl::OUString aDestPath = aDestBasePath; + rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); + aDestPath += aPureFolderName; + xSFA->copy( aSubFolderURL, aDestPath ); + } + //Copy help.tree to the temp folder in the help backend folder +// xSFA->copy(aLangURL + OUSTR("/help.tree"), langFolderDestExpanded + OUSTR("/help.tree")); - // Call compiler - sal_Int32 nXhpFileCount = aXhpFileVector.size(); - rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount]; - for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) - { - rtl::OUString aXhpFile = aXhpFileVector[iXhp]; - rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL ); - pXhpFiles[iXhp] = aXhpRelFile; - } + // Call compiler + sal_Int32 nXhpFileCount = aXhpFileVector.size(); + rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount]; + for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) + { + rtl::OUString aXhpFile = aXhpFileVector[iXhp]; + rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL ); + pXhpFiles[iXhp] = aXhpRelFile; + } - rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); - rtl::OUString aOfficeHelpPathFileURL; - ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); + rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); + rtl::OUString aOfficeHelpPathFileURL; + ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); - HelpProcessingErrorInfo aErrorInfo; - bool bSuccess = compileExtensionHelp( aOfficeHelpPathFileURL, aHelpStr, aLangURL, - nXhpFileCount, pXhpFiles, aErrorInfo ); + HelpProcessingErrorInfo aErrorInfo; + bool bSuccess = compileExtensionHelp( + aOfficeHelpPathFileURL, aHelpStr, aLangURL, + nXhpFileCount, pXhpFiles, + langFolderDestExpanded, aErrorInfo ); - if( bSuccess && xInvocation.is() ) - { - Sequence aParamsSeq( 6 ); - - aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) ); - - rtl::OUString aLang; - sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); - if( nLastSlash != -1 ) - aLang = aLangURL.copy( nLastSlash + 1 ); - else - aLang = rtl::OUString::createFromAscii( "en" ); - aParamsSeq[1] = uno::makeAny( aLang ); - - aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) ); - aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) ); - - aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) ); - rtl::OUString aSystemPath; - osl::FileBase::getSystemPathFromFileURL( aLangURL, aSystemPath ); - aParamsSeq[5] = uno::makeAny( aSystemPath ); - - Sequence< sal_Int16 > aOutParamIndex; - Sequence< uno::Any > aOutParam; - uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ), - aParamsSeq, aOutParamIndex, aOutParam ); - } + if( bSuccess && xInvocation.is() ) + { + Sequence aParamsSeq( 6 ); + + aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) ); + + rtl::OUString aLang; + sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); + if( nLastSlash != -1 ) + aLang = aLangURL.copy( nLastSlash + 1 ); + else + aLang = rtl::OUString::createFromAscii( "en" ); + aParamsSeq[1] = uno::makeAny( aLang ); + + aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) ); + aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) ); + + aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) ); + rtl::OUString aSystemPath; +// osl::FileBase::getSystemPathFromFileURL( aLangURL, aSystemPath ); + osl::FileBase::getSystemPathFromFileURL( + langFolderDestExpanded, aSystemPath ); + aParamsSeq[5] = uno::makeAny( aSystemPath ); + + Sequence< sal_Int16 > aOutParamIndex; + Sequence< uno::Any > aOutParam; + uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ), + aParamsSeq, aOutParamIndex, aOutParam ); + } - if( !bSuccess ) + if( !bSuccess ) + { + USHORT nErrStrId = 0; + switch( aErrorInfo.m_eErrorClass ) + { + case HELPPROCESSING_GENERAL_ERROR: + case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; + case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break; + default: ; + }; + + rtl::OUString aErrStr; + if( nErrStrId != 0 ) { - USHORT nErrStrId = 0; - switch( aErrorInfo.m_eErrorClass ) + aErrStr = getResourceString( nErrStrId ); + + // Remoce CR/LF + rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg ); + sal_Unicode nCR = 13, nLF = 10; + sal_Int32 nSearchCR = aErrMsg.indexOf( nCR ); + sal_Int32 nSearchLF = aErrMsg.indexOf( nLF ); + sal_Int32 nCopy; + if( nSearchCR != -1 || nSearchLF != -1 ) { - case HELPPROCESSING_GENERAL_ERROR: - case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; - case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break; - default: ; - }; - - rtl::OUString aErrStr; - if( nErrStrId != 0 ) + if( nSearchCR == -1 ) + nCopy = nSearchLF; + else if( nSearchLF == -1 ) + nCopy = nSearchCR; + else + nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF; + + aErrMsg = aErrMsg.copy( 0, nCopy ); + } + aErrStr += aErrMsg; + if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() ) { - aErrStr = getResourceString( nErrStrId ); - - // Remoce CR/LF - rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg ); - sal_Unicode nCR = 13, nLF = 10; - sal_Int32 nSearchCR = aErrMsg.indexOf( nCR ); - sal_Int32 nSearchLF = aErrMsg.indexOf( nLF ); - sal_Int32 nCopy; - if( nSearchCR != -1 || nSearchLF != -1 ) - { - if( nSearchCR == -1 ) - nCopy = nSearchLF; - else if( nSearchLF == -1 ) - nCopy = nSearchCR; - else - nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF; - - aErrMsg = aErrMsg.copy( 0, nCopy ); - } - aErrStr += aErrMsg; - if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() ) + aErrStr += rtl::OUString::createFromAscii( " in " ); + + rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile, + rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + aErrStr += aDecodedFile; + if( aErrorInfo.m_nXMLParsingLine != -1 ) { - aErrStr += rtl::OUString::createFromAscii( " in " ); - - rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile, - rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - aErrStr += aDecodedFile; - if( aErrorInfo.m_nXMLParsingLine != -1 ) - { - aErrStr += rtl::OUString::createFromAscii( ", line " ); - aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine ); - } + aErrStr += rtl::OUString::createFromAscii( ", line " ); + aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine ); } } - - OWeakObject* oWeakThis = static_cast(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); } + + OWeakObject* oWeakThis = static_cast(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); } } - - // Write compiled flag file (this code is only reached in case of success) - Reference< io::XOutputStream > xOutputStream = xSFA->openFileWrite( aCompiledFlagFile ); - if( xOutputStream.is() ) - xOutputStream->closeOutput(); - - } // if( bCompile ) - - // Write registered flag file (this code is only reached in case of success) - if( !xSFA->exists( aRegisteredFlagFile ) ) - { - Reference< io::XOutputStream > xOutputStream = xSFA->openFileWrite( aRegisteredFlagFile ); - if( xOutputStream.is() ) - xOutputStream->closeOutput(); } + + //Writing the data entry replaces writing the flag file. If we got to this + //point the registration was successful. addDataToDb(xPackage->getURL(), data); } else @@ -539,75 +562,75 @@ void BackendImpl::implProcessHelp } } -rtl::OUString BackendImpl::getFlagFileURL( Reference< deployment::XPackage > xPackage, const char* pFlagStr ) -{ - rtl::OUString aRetURL; - if( !xPackage.is() ) - return aRetURL; - rtl::OUString aHelpURL = xPackage->getURL(); - aRetURL = expandURL( aHelpURL ); - aRetURL += rtl::OUString::createFromAscii( pFlagStr ); - return aRetURL; -} - -rtl::OUString BackendImpl::getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage ) -{ - return getFlagFileURL( xPackage, "/RegisteredFlag" ); -} - -rtl::OUString BackendImpl::getCompiledFlagFileURL( Reference< deployment::XPackage > xPackage ) -{ - return getFlagFileURL( xPackage, "/CompiledFlag" ); -} - -rtl::OUString BackendImpl::expandURL( const rtl::OUString& aURL ) -{ - static Reference< util::XMacroExpander > xMacroExpander; - static Reference< uri::XUriReferenceFactory > xFac; - - if( !xMacroExpander.is() || !xFac.is() ) - { - Reference const & xContext = getComponentContext(); - if( xContext.is() ) - { - xFac = Reference< uri::XUriReferenceFactory >( - xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( - "com.sun.star.uri.UriReferenceFactory"), xContext ) , UNO_QUERY ); - } - if( !xFac.is() ) - { - throw RuntimeException( - ::rtl::OUString::createFromAscii( - "dp_registry::backend::help::BackendImpl::expandURL(), " - "could not instatiate UriReferenceFactory." ), - Reference< XInterface >() ); - } - - xMacroExpander = Reference< util::XMacroExpander >( - xContext->getValueByName( - ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.util.theMacroExpander" ) ), - UNO_QUERY_THROW ); - } - - rtl::OUString aRetURL = aURL; - if( xMacroExpander.is() ) - { - Reference< uri::XUriReference > uriRef; - for (;;) - { - uriRef = Reference< uri::XUriReference >( xFac->parse( aRetURL ), UNO_QUERY ); - if ( uriRef.is() ) - { - Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY ); - if( !sxUri.is() ) - break; - - aRetURL = sxUri->expand( xMacroExpander ); - } - } - } - return aRetURL; -} +// rtl::OUString BackendImpl::getFlagFileURL( Reference< deployment::XPackage > xPackage, const char* pFlagStr ) +// { +// rtl::OUString aRetURL; +// if( !xPackage.is() ) +// return aRetURL; +// rtl::OUString aHelpURL = xPackage->getURL(); +// aRetURL = expandURL( aHelpURL ); +// aRetURL += rtl::OUString::createFromAscii( pFlagStr ); +// return aRetURL; +// } + +// rtl::OUString BackendImpl::getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage ) +// { +// return getFlagFileURL( xPackage, "/RegisteredFlag" ); +// } + +// rtl::OUString BackendImpl::getCompiledFlagFileURL( Reference< deployment::XPackage > xPackage ) +// { +// return getFlagFileURL( xPackage, "/CompiledFlag" ); +// } + +// rtl::OUString BackendImpl::expandURL( const rtl::OUString& aURL ) +// { +// static Reference< util::XMacroExpander > xMacroExpander; +// static Reference< uri::XUriReferenceFactory > xFac; + +// if( !xMacroExpander.is() || !xFac.is() ) +// { +// Reference const & xContext = getComponentContext(); +// if( xContext.is() ) +// { +// xFac = Reference< uri::XUriReferenceFactory >( +// xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( +// "com.sun.star.uri.UriReferenceFactory"), xContext ) , UNO_QUERY ); +// } +// if( !xFac.is() ) +// { +// throw RuntimeException( +// ::rtl::OUString::createFromAscii( +// "dp_registry::backend::help::BackendImpl::expandURL(), " +// "could not instatiate UriReferenceFactory." ), +// Reference< XInterface >() ); +// } + +// xMacroExpander = Reference< util::XMacroExpander >( +// xContext->getValueByName( +// ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.util.theMacroExpander" ) ), +// UNO_QUERY_THROW ); +// } + +// rtl::OUString aRetURL = aURL; +// if( xMacroExpander.is() ) +// { +// Reference< uri::XUriReference > uriRef; +// for (;;) +// { +// uriRef = Reference< uri::XUriReference >( xFac->parse( aRetURL ), UNO_QUERY ); +// if ( uriRef.is() ) +// { +// Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY ); +// if( !sxUri.is() ) +// break; + +// aRetURL = sxUri->expand( xMacroExpander ); +// } +// } +// } +// return aRetURL; +// } void BackendImpl::implCollectXhpFiles( const rtl::OUString& aDir, std::vector< rtl::OUString >& o_rXhpFileVector ) diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx index 6f7e1d2844ac..f36eb6d7b8cb 100644 --- a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx @@ -143,7 +143,8 @@ void HelpBackendDb::removeEntry(::rtl::OUString const & url) removeElement(sExpression); } -HelpBackendDb::Data HelpBackendDb::getEntry(::rtl::OUString const & url) +::boost::optional +HelpBackendDb::getEntry(::rtl::OUString const & url) { try { @@ -174,8 +175,13 @@ HelpBackendDb::Data HelpBackendDb::getEntry(::rtl::OUString const & url) // readVectorOfPair( // aNode, OUSTR("reg:singletons"), OUSTR("item"), OUSTR("key"), // OUSTR("value")); + + } + else + { + return ::boost::optional(); } - return retData; + return ::boost::optional(retData); } catch(css::uno::Exception &) { diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx index e80a24f85ab1..bf812ad96511 100644 --- a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx @@ -35,6 +35,7 @@ #include "rtl/string.hxx" #include #include +#include "boost/optional.hpp" #include "dp_backenddb.hxx" namespace css = ::com::sun::star; @@ -87,7 +88,7 @@ public: void addEntry(::rtl::OUString const & url, Data const & data); void removeEntry(::rtl::OUString const & url); - Data getEntry(::rtl::OUString const & url); + ::boost::optional getEntry(::rtl::OUString const & url); ::std::list< ::rtl::OUString> getAllDataUrls(); }; diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 24c6e4914fe1..179420b16ef6 100644 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -257,6 +257,9 @@ public: css::ucb::CommandAbortedException, css::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getRepositoryName() throw (css::uno::RuntimeException); + virtual css::beans::Optional< ::rtl::OUString > SAL_CALL getRegistrationDataURL() + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); virtual sal_Bool SAL_CALL isRemoved() throw (css::uno::RuntimeException); diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index c5e2582b3905..5c164e08c100 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -1162,7 +1162,8 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( const rtl::OUString& ja Reference< XHierarchicalNameAccess > Databases::findJarFileForPath ( const rtl::OUString& jar, const rtl::OUString& Language, - const rtl::OUString& path, rtl::OUString* o_pExtensionPath ) + const rtl::OUString& path, rtl::OUString* o_pExtensionPath, + rtl::OUString* o_pExtensionRegistryPath ) { Reference< XHierarchicalNameAccess > xNA; if( ! jar.getLength() || @@ -1174,7 +1175,7 @@ Reference< XHierarchicalNameAccess > Databases::findJarFileForPath JarFileIterator aJarFileIt( m_xContext, *this, jar, Language ); Reference< XHierarchicalNameAccess > xTestNA; Reference< deployment::XPackage > xParentPackageBundle; - while( (xTestNA = aJarFileIt.nextJarFile( xParentPackageBundle, o_pExtensionPath )).is() ) + while( (xTestNA = aJarFileIt.nextJarFile( xParentPackageBundle, o_pExtensionPath, o_pExtensionRegistryPath )).is() ) { if( xTestNA.is() && xTestNA->hasByHierarchicalName( path ) ) { @@ -1512,6 +1513,7 @@ void ExtensionIteratorBase::init() m_bSharedPackagesLoaded = false; m_iUserPackage = 0; m_iSharedPackage = 0; + m_iBundledPackage = 0; } Reference< deployment::XPackage > ExtensionIteratorBase::implGetHelpPackageFromPackage @@ -1635,6 +1637,36 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa return xHelpPackage; } +Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextBundledHelpPackage + ( Reference< deployment::XPackage >& o_xParentPackageBundle ) +{ + Reference< deployment::XPackage > xHelpPackage; + + if( !m_bBundledPackagesLoaded ) + { + Reference< XPackageManager > xBundledManager = + thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("bundled") ); + m_aBundledPackagesSeq = xBundledManager->getDeployedPackages + ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + m_bBundledPackagesLoaded = true; + } + + if( m_iBundledPackage == m_aBundledPackagesSeq.getLength() ) + { + m_eState = END_REACHED; + } + else + { + const Reference< deployment::XPackage >* pBundledPackages = + m_aBundledPackagesSeq.getConstArray(); + Reference< deployment::XPackage > xPackage = pBundledPackages[ m_iBundledPackage++ ]; + VOS_ENSURE( xPackage.is(), "ExtensionIteratorBase::implGetNextBundledHelpPackage(): Invalid package" ); + xHelpPackage = implGetHelpPackageFromPackage( xPackage, o_xParentPackageBundle ); + } + + return xHelpPackage; +} + rtl::OUString ExtensionIteratorBase::implGetFileFromPackage( const rtl::OUString& rFileExtension, Reference< deployment::XPackage > xPackage ) { @@ -1646,7 +1678,7 @@ rtl::OUString ExtensionIteratorBase::implGetFileFromPackage( for( sal_Int32 iPass = 0 ; iPass < 2 ; ++iPass ) { rtl::OUStringBuffer aStrBuf; - aStrBuf.append( xPackage->getURL() ); + aStrBuf.append( xPackage->getRegistrationDataURL().Value); aStrBuf.append( aSlash ); aStrBuf.append( aLanguage ); if( !bLangFolderOnly ) @@ -1720,7 +1752,7 @@ void ExtensionIteratorBase::implGetLanguageVectorFromPackage( ::std::vector< ::r //=================================================================== // class DataBaseIterator -Db* DataBaseIterator::nextDb( rtl::OUString* o_pExtensionPath ) +Db* DataBaseIterator::nextDb( rtl::OUString* o_pExtensionPath, rtl::OUString* o_pExtensionRegistryPath ) { Db* pRetDb = NULL; @@ -1743,7 +1775,7 @@ Db* DataBaseIterator::nextDb( rtl::OUString* o_pExtensionPath ) Reference< deployment::XPackage > xHelpPackage = implGetNextUserHelpPackage( xParentPackageBundle ); if( !xHelpPackage.is() ) break; - pRetDb = implGetDbFromPackage( xHelpPackage, o_pExtensionPath ); + pRetDb = implGetDbFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath ); break; } @@ -1754,9 +1786,21 @@ Db* DataBaseIterator::nextDb( rtl::OUString* o_pExtensionPath ) if( !xHelpPackage.is() ) break; - pRetDb = implGetDbFromPackage( xHelpPackage, o_pExtensionPath ); + pRetDb = implGetDbFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath ); break; } + + case BUNDLED_EXTENSIONS: + { + Reference< deployment::XPackage > xParentPackageBundle; + Reference< deployment::XPackage > xHelpPackage = implGetNextBundledHelpPackage( xParentPackageBundle ); + if( !xHelpPackage.is() ) + break; + + pRetDb = implGetDbFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath ); + break; + } + case END_REACHED: VOS_ENSURE( false, "DataBaseIterator::nextDb(): Invalid case END_REACHED" ); break; @@ -1767,38 +1811,55 @@ Db* DataBaseIterator::nextDb( rtl::OUString* o_pExtensionPath ) } Db* DataBaseIterator::implGetDbFromPackage( Reference< deployment::XPackage > xPackage, - rtl::OUString* o_pExtensionPath ) + rtl::OUString* o_pExtensionPath, rtl::OUString* o_pExtensionRegistryPath ) { - rtl::OUString aExtensionPath = xPackage->getURL(); - //if( o_pExtensionPath ) - //*o_pExtensionPath = aExtensionPath; - aExtensionPath += aSlash; - rtl::OUString aUsedLanguage = m_aLanguage; - Db* pRetDb = m_rDatabases.getBerkeley( aHelpFilesBaseName, aUsedLanguage, - m_bHelpText, &aExtensionPath ); + beans::Optional< ::rtl::OUString> optRegData; + try + { + optRegData = xPackage->getRegistrationDataURL(); + } + catch ( deployment::ExtensionRemovedException&) + { + return NULL; + } - // Language fallback - if( !pRetDb ) + Db* pRetDb = NULL; + if (optRegData.IsPresent && optRegData.Value.getLength() > 0) { - ::std::vector< ::rtl::OUString > av; - implGetLanguageVectorFromPackage( av, xPackage ); - ::std::vector< ::rtl::OUString >::const_iterator pFound = av.end(); - try - { - pFound = ::comphelper::Locale::getFallback( av, m_aLanguage ); - } - catch( ::comphelper::Locale::MalFormedLocaleException& ) - {} - if( pFound != av.end() ) + rtl::OUString aRegDataUrl(optRegData.Value); + aRegDataUrl += aSlash; + + rtl::OUString aUsedLanguage = m_aLanguage; + pRetDb = m_rDatabases.getBerkeley( + aHelpFilesBaseName, aUsedLanguage, m_bHelpText, &aRegDataUrl); + + // Language fallback + if( !pRetDb ) { - aUsedLanguage = *pFound; - pRetDb = m_rDatabases.getBerkeley( aHelpFilesBaseName, aUsedLanguage, m_bHelpText, &aExtensionPath ); + ::std::vector< ::rtl::OUString > av; + implGetLanguageVectorFromPackage( av, xPackage ); + ::std::vector< ::rtl::OUString >::const_iterator pFound = av.end(); + try + { + pFound = ::comphelper::Locale::getFallback( av, m_aLanguage ); + } + catch( ::comphelper::Locale::MalFormedLocaleException& ) + {} + if( pFound != av.end() ) + { + aUsedLanguage = *pFound; + pRetDb = m_rDatabases.getBerkeley( + aHelpFilesBaseName, aUsedLanguage, m_bHelpText, &aRegDataUrl); + } } - } - if( o_pExtensionPath ) - *o_pExtensionPath = aExtensionPath + aUsedLanguage; + if( o_pExtensionPath ) + *o_pExtensionPath = aRegDataUrl + aUsedLanguage; + + if( o_pExtensionRegistryPath ) + *o_pExtensionRegistryPath = xPackage->getURL() + aSlash + aUsedLanguage; + } return pRetDb; } @@ -1853,6 +1914,19 @@ rtl::OUString KeyDataBaseFileIterator::nextDbFile( bool& o_rbExtension ) o_rbExtension = true; break; } + + case BUNDLED_EXTENSIONS: + { + Reference< deployment::XPackage > xParentPackageBundle; + Reference< deployment::XPackage > xHelpPackage = implGetNextBundledHelpPackage( xParentPackageBundle ); + if( !xHelpPackage.is() ) + break; + + aRetFile = implGetDbFileFromPackage( xHelpPackage ); + o_rbExtension = true; + break; + } + case END_REACHED: VOS_ENSURE( false, "DataBaseIterator::nextDbFile(): Invalid case END_REACHED" ); break; @@ -1879,7 +1953,8 @@ rtl::OUString KeyDataBaseFileIterator::implGetDbFileFromPackage // class JarFileIterator Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile - ( Reference< deployment::XPackage >& o_xParentPackageBundle, rtl::OUString* o_pExtensionPath ) + ( Reference< deployment::XPackage >& o_xParentPackageBundle, + rtl::OUString* o_pExtensionPath, rtl::OUString* o_pExtensionRegistryPath ) { Reference< XHierarchicalNameAccess > xNA; @@ -1902,7 +1977,7 @@ Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile if( !xHelpPackage.is() ) break; - xNA = implGetJarFromPackage( xHelpPackage, o_pExtensionPath ); + xNA = implGetJarFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath ); break; } @@ -1912,9 +1987,20 @@ Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile if( !xHelpPackage.is() ) break; - xNA = implGetJarFromPackage( xHelpPackage, o_pExtensionPath ); + xNA = implGetJarFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath ); break; } + + case BUNDLED_EXTENSIONS: + { + Reference< deployment::XPackage > xHelpPackage = implGetNextBundledHelpPackage( o_xParentPackageBundle ); + if( !xHelpPackage.is() ) + break; + + xNA = implGetJarFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath ); + break; + } + case END_REACHED: VOS_ENSURE( false, "JarFileIterator::nextJarFile(): Invalid case END_REACHED" ); break; @@ -1925,7 +2011,7 @@ Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile } Reference< XHierarchicalNameAccess > JarFileIterator::implGetJarFromPackage - ( Reference< deployment::XPackage > xPackage, rtl::OUString* o_pExtensionPath ) +( Reference< deployment::XPackage > xPackage, rtl::OUString* o_pExtensionPath, rtl::OUString* o_pExtensionRegistryPath ) { Reference< XHierarchicalNameAccess > xNA; @@ -1970,6 +2056,15 @@ Reference< XHierarchicalNameAccess > JarFileIterator::implGetJarFromPackage sal_Int32 nLastSlash = zipFile.lastIndexOf( '/' ); if( nLastSlash != -1 ) *o_pExtensionPath = zipFile.copy( 0, nLastSlash ); + + if( o_pExtensionRegistryPath != NULL ) + { + rtl::OUString& rPath = *o_pExtensionPath; + sal_Int32 nLastSlashInPath = rPath.lastIndexOf( '/', rPath.getLength() - 1 ); + + *o_pExtensionRegistryPath = xPackage->getURL(); + *o_pExtensionRegistryPath += rPath.copy( nLastSlashInPath); + } } return xNA; @@ -2026,6 +2121,19 @@ rtl::OUString IndexFolderIterator::nextIndexFolder( bool& o_rbExtension, bool& o o_rbExtension = true; break; } + + case BUNDLED_EXTENSIONS: + { + Reference< deployment::XPackage > xParentPackageBundle; + Reference< deployment::XPackage > xHelpPackage = implGetNextBundledHelpPackage( xParentPackageBundle ); + if( !xHelpPackage.is() ) + break; + + aIndexFolder = implGetIndexFolderFromPackage( o_rbTemporary, xHelpPackage ); + o_rbExtension = true; + break; + } + case END_REACHED: VOS_ENSURE( false, "IndexFolderIterator::nextIndexFolder(): Invalid case END_REACHED" ); break; diff --git a/xmlhelp/source/cxxhelp/provider/databases.hxx b/xmlhelp/source/cxxhelp/provider/databases.hxx index 6468c5732c6b..aa80bf27405b 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.hxx +++ b/xmlhelp/source/cxxhelp/provider/databases.hxx @@ -267,7 +267,8 @@ namespace chelp { com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > findJarFileForPath( const rtl::OUString& jar, const rtl::OUString& Language, - const rtl::OUString& path, rtl::OUString* o_pExtensionPath = NULL ); + const rtl::OUString& path, rtl::OUString* o_pExtensionPath = NULL, + rtl::OUString* o_pExtensionRegistryPath = NULL ); /** * Maps a given language-locale combination to language. @@ -398,6 +399,7 @@ namespace chelp { //SHARED_MODULE, // Later, avoids redundancies in help compiling USER_EXTENSIONS, SHARED_EXTENSIONS, + BUNDLED_EXTENSIONS, END_REACHED }; @@ -433,6 +435,8 @@ namespace chelp { ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle ); com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextSharedHelpPackage ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle ); + com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextBundledHelpPackage + ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle ); rtl::OUString implGetFileFromPackage( const rtl::OUString& rFileExtension, com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage ); void implGetLanguageVectorFromPackage( ::std::vector< ::rtl::OUString > &rv, @@ -456,8 +460,13 @@ namespace chelp { < com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq; bool m_bSharedPackagesLoaded; + com::sun::star::uno::Sequence< com::sun::star::uno::Reference + < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq; + bool m_bBundledPackagesLoaded; + int m_iUserPackage; int m_iSharedPackage; + int m_iBundledPackage; }; // end class ExtensionIteratorBase @@ -477,13 +486,13 @@ namespace chelp { , m_bHelpText( bHelpText ) {} - berkeleydbproxy::Db* nextDb( rtl::OUString* o_pExtensionPath = NULL ); + berkeleydbproxy::Db* nextDb( rtl::OUString* o_pExtensionPath = NULL, rtl::OUString* o_pExtensionRegistryPath = NULL ); private: berkeleydbproxy::Db* implGetDbFromPackage( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage, - rtl::OUString* o_pExtensionPath ); + rtl::OUString* o_pExtensionPath, rtl::OUString* o_pExtensionRegistryPath ); bool m_bHelpText; @@ -517,12 +526,12 @@ namespace chelp { com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > nextJarFile( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle, - rtl::OUString* o_pExtensionPath = NULL ); + rtl::OUString* o_pExtensionPath = NULL, rtl::OUString* o_pExtensionRegistryPath = NULL ); private: com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > implGetJarFromPackage(com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage, - rtl::OUString* o_pExtensionPath = NULL ); + rtl::OUString* o_pExtensionPath = NULL, rtl::OUString* o_pExtensionRegistryPath = NULL ); }; // end class JarFileIterator diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 9268ec19cd7f..67735c4e0a6a 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -306,9 +306,10 @@ void URLParameter::readBerkeley() Dbt data; DBData aDBData; rtl::OUString aExtensionPath; + rtl::OUString aExtensionRegistryPath; while( true ) { - Db* db = aDbIt.nextDb( &aExtensionPath ); + Db* db = aDbIt.nextDb( &aExtensionPath, &aExtensionRegistryPath ); if( !db ) break; @@ -355,6 +356,7 @@ void URLParameter::readBerkeley() aExtendedJarStrBuf.append( aQuestionMark ); aExtendedJarStrBuf.append( m_aJar ); m_aJar = aExtendedJarStrBuf.makeStringAndClear(); + m_aExtensionRegistryPath = aExtensionRegistryPath; } m_aTag = converter.getHash(); } @@ -1004,18 +1006,20 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam, rtl::OUString aJar = urlParam->get_jar(); bool bAddExtensionPath = false; + rtl::OUString aExtensionRegistryPath; sal_Int32 nQuestionMark1 = aJar.indexOf( sal_Unicode('?') ); sal_Int32 nQuestionMark2 = aJar.lastIndexOf( sal_Unicode('?') ); if( nQuestionMark1 != -1 && nQuestionMark2 != -1 && nQuestionMark1 != nQuestionMark2 ) { aExtensionPath = aJar.copy( nQuestionMark1 + 1, nQuestionMark2 - nQuestionMark1 - 1 ); + aExtensionRegistryPath = urlParam->get_ExtensionRegistryPath(); bAddExtensionPath = true; } else { // Path not yet specified, search directly Reference< XHierarchicalNameAccess > xNA = pDatabases->findJarFileForPath - ( aJar, urlParam->get_language(), urlParam->get_path(), &aExtensionPath ); + ( aJar, urlParam->get_language(), urlParam->get_path(), &aExtensionPath, &aExtensionRegistryPath ); if( xNA.is() && aExtensionPath.getLength() ) bAddExtensionPath = true; } @@ -1038,7 +1042,7 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam, Reference< XInterface >() ); } - rtl::OUString aOUExpandedExtensionPath = Databases::expandURL( aExtensionPath, xContext ); + rtl::OUString aOUExpandedExtensionPath = Databases::expandURL( aExtensionRegistryPath, xContext ); rtl::OString aExpandedExtensionPath = rtl::OUStringToOString( aOUExpandedExtensionPath, osl_getThreadTextEncoding() ); parString[last++] = "ExtensionPath"; diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx index d1dbf48132a7..5f73c930dcdb 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx @@ -150,6 +150,8 @@ namespace chelp { rtl::OUString get_jar() { return get_the_jar(); } // BerkeleyDb + rtl::OUString get_ExtensionRegistryPath() { return m_aExtensionRegistryPath; } + rtl::OUString get_module() { return m_aModule; } rtl::OUString get_dbpar() { @@ -203,6 +205,7 @@ namespace chelp { rtl::OUString m_aModule; rtl::OUString m_aTitle; rtl::OUString m_aJar; + rtl::OUString m_aExtensionRegistryPath; rtl::OUString m_aEid; rtl::OUString m_aDbPar; -- cgit From 3c289e248a4f7c6940bb7429ee70d17a6196016c Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Mon, 19 Apr 2010 11:33:33 +0200 Subject: jl152 import 263446 from native0jl:#i77196# supporting licenses, suppress license switch, subsequent accepting of licenses for bundled/shared extensions --- desktop/inc/deployment.hrc | 1 - desktop/source/app/check_ext_deps.cxx | 135 +------ desktop/source/app/makefile.mk | 14 + desktop/source/deployment/gui/dp_gui.hrc | 1 - desktop/source/deployment/gui/dp_gui_dialog.src | 10 +- .../deployment/gui/dp_gui_extensioncmdqueue.cxx | 23 +- .../deployment/gui/dp_gui_updateinstalldialog.cxx | 4 +- desktop/source/deployment/gui/license_dialog.cxx | 11 +- desktop/source/deployment/gui/license_dialog.hxx | 1 + desktop/source/deployment/inc/dp_misc.h | 7 +- desktop/source/deployment/inc/dp_ucb.h | 7 + .../deployment/manager/dp_activepackages.cxx | 8 +- .../deployment/manager/dp_activepackages.hxx | 9 + .../deployment/manager/dp_commandenvironments.cxx | 255 ++++++++++++ .../deployment/manager/dp_commandenvironments.hxx | 146 +++++++ .../deployment/manager/dp_extensionmanager.cxx | 333 ++++++++-------- .../deployment/manager/dp_extensionmanager.hxx | 37 +- desktop/source/deployment/manager/dp_manager.cxx | 439 ++++++++++++--------- desktop/source/deployment/manager/dp_manager.h | 28 +- .../source/deployment/manager/dp_properties.cxx | 147 +++++++ .../source/deployment/manager/dp_properties.hxx | 76 ++++ .../source/deployment/manager/dp_tmprepocmdenv.cxx | 166 -------- .../source/deployment/manager/dp_tmprepocmdenv.hxx | 84 ---- desktop/source/deployment/manager/makefile.mk | 3 +- .../source/deployment/migration/dp_migration.cxx | 2 +- desktop/source/deployment/misc/dp_misc.cxx | 142 ++++++- desktop/source/deployment/misc/dp_ucb.cxx | 46 +++ .../deployment/registry/component/dp_component.cxx | 11 +- .../registry/configuration/dp_configuration.cxx | 3 +- desktop/source/deployment/registry/dp_backend.cxx | 20 +- desktop/source/deployment/registry/dp_registry.cxx | 8 +- .../registry/executable/dp_executable.cxx | 3 +- .../source/deployment/registry/help/dp_help.cxx | 112 +----- .../source/deployment/registry/inc/dp_backend.h | 4 +- .../deployment/registry/package/dp_package.cxx | 69 ++-- .../deployment/registry/script/dp_script.cxx | 6 +- desktop/source/deployment/unopkg/unopkg.src | 7 +- .../migration/services/oo3extensionmigration.cxx | 4 +- desktop/source/pkgchk/unopkg/unopkg_app.cxx | 161 ++++++-- desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx | 55 +-- desktop/source/pkgchk/unopkg/unopkg_misc.cxx | 42 +- desktop/source/pkgchk/unopkg/unopkg_shared.h | 10 +- 42 files changed, 1612 insertions(+), 1038 deletions(-) create mode 100644 desktop/source/deployment/manager/dp_commandenvironments.cxx create mode 100644 desktop/source/deployment/manager/dp_commandenvironments.hxx create mode 100644 desktop/source/deployment/manager/dp_properties.cxx create mode 100644 desktop/source/deployment/manager/dp_properties.hxx delete mode 100644 desktop/source/deployment/manager/dp_tmprepocmdenv.cxx delete mode 100644 desktop/source/deployment/manager/dp_tmprepocmdenv.hxx diff --git a/desktop/inc/deployment.hrc b/desktop/inc/deployment.hrc index 7e4c21d3c5a4..370996c710ae 100644 --- a/desktop/inc/deployment.hrc +++ b/desktop/inc/deployment.hrc @@ -63,7 +63,6 @@ #define RID_IMG_JAVA_TYPELIB_HC (RID_DEPLOYMENT_COMPONENT_START+7) #define RID_DEPLOYMENT_UNOPKG_START (RID_DEPLOYMENT_START+4000) -#define RID_STR_UNOPKG_NO_SHARED_ALLOWED RID_DEPLOYMENT_UNOPKG_START #define RID_STR_UNOPKG_ACCEPT_LIC_1 (RID_DEPLOYMENT_UNOPKG_START+1) #define RID_STR_UNOPKG_ACCEPT_LIC_2 (RID_DEPLOYMENT_UNOPKG_START+2) #define RID_STR_UNOPKG_ACCEPT_LIC_3 (RID_DEPLOYMENT_UNOPKG_START+3) diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index 17dc20e1a129..f487e0dfc96f 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -53,6 +53,8 @@ #include "app.hxx" +#include "../deployment/inc/dp_misc.h" + using rtl::OUString; using namespace desktop; using namespace com::sun::star; @@ -342,101 +344,6 @@ sal_Bool Desktop::CheckExtensionDependencies() return bAbort; } -//Returns true if the Folder was more recently modified then -//the lastsynchronized file. That is the repository needs to -//be synchronized. -static bool compareExtensionFolderWithLastSynchronizedFile( - OUString const & folderURL, OUString const & fileURL) -{ - bool bNeedsSync = false; - ::osl::DirectoryItem itemExtFolder; - ::osl::File::RC err1 = - ::osl::DirectoryItem::get(folderURL, itemExtFolder); - //If it does not exist, then there is nothing to be done - if (err1 == ::osl::File::E_NOENT) - { - return false; - } - else if (err1 != ::osl::File::E_None) - { - OSL_ENSURE(0, "Cannot access extension folder"); - return true; //sync just in case - } - - //If last synchronized does not exist, then OOo is started for the first time - ::osl::DirectoryItem itemFile; - ::osl::File::RC err2 = ::osl::DirectoryItem::get(fileURL, itemFile); - if (err2 == ::osl::File::E_NOENT) - { - return true; - - } - else if (err2 != ::osl::File::E_None) - { - OSL_ENSURE(0, "Cannot access file lastsynchronized"); - return true; //sync just in case - } - - //compare the modification time of the extension folder and the last - //modified file - ::osl::FileStatus statFolder(FileStatusMask_ModifyTime); - ::osl::FileStatus statFile(FileStatusMask_ModifyTime); - if (itemExtFolder.getFileStatus(statFolder) == ::osl::File::E_None) - { - if (itemFile.getFileStatus(statFile) == ::osl::File::E_None) - { - TimeValue timeFolder = statFolder.getModifyTime(); - TimeValue timeFile = statFile.getModifyTime(); - - if (timeFile.Seconds < timeFolder.Seconds) - bNeedsSync = true; - } - else - { - OSL_ASSERT(0); - bNeedsSync = true; - } - } - else - { - OSL_ASSERT(0); - bNeedsSync = true; - } - return bNeedsSync; -} - -static bool needToSyncRepostitory(OUString const & name) -{ - OUString folder; - OUString file; - if (name.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("bundled")))) - { - folder = OUString( - RTL_CONSTASCII_USTRINGPARAM("$BUNDLED_EXTENSIONS")); - file = OUString ( - RTL_CONSTASCII_USTRINGPARAM( - "$BUNDLED_EXTENSIONS_USER/lastsynchronized")); - } - else if (name.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("shared")))) - { - folder = OUString( - RTL_CONSTASCII_USTRINGPARAM( - "$UNO_SHARED_PACKAGES_CACHE/uno_packages")); - file = OUString ( - RTL_CONSTASCII_USTRINGPARAM( - "$SHARED_EXTENSIONS_USER/lastsynchronized")); - } - else - { - OSL_ASSERT(0); - return true; - } - ::rtl::Bootstrap::expandMacros(folder); - ::rtl::Bootstrap::expandMacros(file); - return compareExtensionFolderWithLastSynchronizedFile( - folder, file); -} - void Desktop::SynchronizeExtensionRepositories() { RTL_LOGFILE_CONTEXT(aLog,"desktop (jl97489) ::Desktop::SynchronizeExtensionRepositories"); @@ -447,41 +354,5 @@ void Desktop::SynchronizeExtensionRepositories() OUString(RTL_CONSTASCII_USTRINGPARAM(""))); if (sDisable.getLength() > 0) return; - Reference xExtensionManager; - //synchronize shared before bundled otherewise there are - //more revoke and registration calls. - OUString sShared(RTL_CONSTASCII_USTRINGPARAM("shared")); - if (needToSyncRepostitory(sShared)) - { - xExtensionManager = - deployment::ExtensionManager::get( - comphelper_getProcessComponentContext()); - if (xExtensionManager.is()) - { - Reference cmdEnv( - new SilentCommandEnv()); - xExtensionManager->synchronize( - sShared, Reference(), cmdEnv); - } - - } - - OUString sBundled(RTL_CONSTASCII_USTRINGPARAM("bundled")); - if (needToSyncRepostitory( sBundled)) - { - if (!xExtensionManager.is()) - { - xExtensionManager = - deployment::ExtensionManager::get( - comphelper_getProcessComponentContext()); - } - if (xExtensionManager.is()) - { - Reference cmdEnv( - new SilentCommandEnv()); - xExtensionManager->synchronize( - sBundled, Reference(), cmdEnv); - - } - } + dp_misc::syncRepositories(new SilentCommandEnv()); } diff --git a/desktop/source/app/makefile.mk b/desktop/source/app/makefile.mk index d9db7c163481..085d8520e7ad 100644 --- a/desktop/source/app/makefile.mk +++ b/desktop/source/app/makefile.mk @@ -35,11 +35,24 @@ ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk +.INCLUDE : ../deployment/inc/dp_misc.mk .IF "$(ENABLE_GNOMEVFS)"=="TRUE" CFLAGS+=-DGNOME_VFS_ENABLED .ENDIF +# .IF "$(OS)" == "WNT" +# .IF "$(COM)" == "GCC" +# DEPLOYMENTMISCLIB = -ldeploymentmisc$(DLLPOSTFIX) +# .ELSE +# DEPLOYMENTMISCLIB = ideploymentmisc$(DLLPOSTFIX).lib +# .ENDIF +# .ELIF "$(OS)" == "OS2" +# DEPLOYMENTMISCLIB = ideploymentmisc$(DLLPOSTFIX).lib +# .ELSE +# DEPLOYMENTMISCLIB = -ldeploymentmisc$(DLLPOSTFIX) +# .ENDIF + SHL1TARGET = sofficeapp SHL1OBJS = \ $(SLO)$/app.obj \ @@ -67,6 +80,7 @@ SHL1STDLIBS = \ $(COMPHELPERLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ + $(DEPLOYMENTMISCLIB) \ $(I18NISOLANGLIB) \ $(SALLIB) \ $(SFXLIB) \ diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc index 1d2f4869cc7f..022141976f55 100644 --- a/desktop/source/deployment/gui/dp_gui.hrc +++ b/desktop/source/deployment/gui/dp_gui.hrc @@ -172,7 +172,6 @@ #define RID_WARNINGBOX_DISABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+106) #define RID_DLG_LICENSE RID_DEPLOYMENT_LICENSE_START -#define WARNINGBOX_NOSHAREDALLOWED (RID_DEPLOYMENT_LICENSE_START+1) diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src index 79c0c5172030..f9d9c0e011c6 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog.src +++ b/desktop/source/deployment/gui/dp_gui_dialog.src @@ -131,7 +131,7 @@ String RID_STR_ERROR_MISSING_DEPENDENCIES #define ROW1_Y RSC_SP_DLG_INNERBORDER_TOP #define ROW1_HEIGHT 16*RSC_CD_FIXEDTEXT_HEIGHT #define ROW2_Y ROW1_Y+ROW1_HEIGHT+RSC_SP_CTRL_GROUP_Y -#define ROW2_HEIGHT 2*RSC_CD_FIXEDTEXT_HEIGHT +#define ROW2_HEIGHT 3*RSC_CD_FIXEDTEXT_HEIGHT #define ROW3_Y ROW2_Y+ROW2_HEIGHT+RSC_SP_CTRL_GROUP_Y #define ROW3_HEIGHT 3*RSC_CD_FIXEDTEXT_HEIGHT #define ROW4_Y ROW3_Y+ROW3_HEIGHT+RSC_SP_CTRL_GROUP_Y @@ -282,14 +282,6 @@ ModalDialog RID_DLG_LICENSE -WarningBox WARNINGBOX_NOSHAREDALLOWED -{ - Buttons = WB_OK ; - DefButton = WB_DEF_OK; - Message[ en-US ] ="The extension \'%NAME\' cannot be installed under \"%PRODUCTNAME Extensions\", because " - "every user has to agree to the license agreement of the extension. The extension will not be installed."; -}; - WarningBox RID_WARNINGBOX_INSTALL_EXTENSION { Buttons = WB_OK_CANCEL; DefButton = WB_DEF_OK; diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index a617e07758c7..4b55a93d3f84 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -36,10 +36,10 @@ #include #include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/beans/NamedValue.hpp" #include "com/sun/star/deployment/DependencyException.hpp" #include "com/sun/star/deployment/LicenseException.hpp" -#include "com/sun/star/deployment/LicenseIndividualAgreementException.hpp" #include "com/sun/star/deployment/VersionException.hpp" #include "com/sun/star/deployment/InstallException.hpp" #include "com/sun/star/deployment/PlatformException.hpp" @@ -379,7 +379,6 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & lang::WrappedTargetException wtExc; deployment::DependencyException depExc; deployment::LicenseException licExc; - deployment::LicenseIndividualAgreementException licAgreementExc; deployment::VersionException verExc; deployment::InstallException instExc; deployment::PlatformException platExc; @@ -441,23 +440,12 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & || (n == RET_CANCEL && !Application::IsDialogCancelEnabled()); } } - else if (request >>= licAgreementExc) - { - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - ResId warnId(WARNINGBOX_NOSHAREDALLOWED, *DeploymentGuiResMgr::get()); - WarningBox warn( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, warnId); - String msgText = warn.GetMessText(); - msgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); - msgText.SearchAndReplaceAllAscii("%NAME", licAgreementExc.ExtensionName); - warn.SetMessText(msgText); - warn.Execute(); - abort = true; - } else if (request >>= licExc) { uno::Reference< ui::dialogs::XExecutableDialog > xDialog( deployment::ui::LicenseDialog::create( - m_xContext, VCLUnoHelper::GetInterface( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL ), licExc.Text ) ); + m_xContext, VCLUnoHelper::GetInterface( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL ), + licExc.ExtensionName, licExc.Text ) ); sal_Int16 res = xDialog->execute(); if ( res == ui::dialogs::ExecutableDialogResults::CANCEL ) abort = true; @@ -948,8 +936,9 @@ void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv { OUString sPackageManager = xPackageManager->getContext(); uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); - uno::Reference< deployment::XPackage > xPackage( xExtMgr->addExtension( rPackageURL, sPackageManager, - xAbortChannel, rCmdEnv.get() ) ); + uno::Reference< deployment::XPackage > xPackage( + xExtMgr->addExtension(rPackageURL, uno::Sequence(), + sPackageManager, xAbortChannel, rCmdEnv.get() ) ); OSL_ASSERT( xPackage.is() ); } catch ( ucb::CommandFailedException & ) diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index 113e6d2069ac..f607713118f0 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -46,6 +46,7 @@ #include "cppuhelper/implbase3.hxx" #include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/beans/NamedValue.hpp" #include "com/sun/star/xml/dom/XElement.hpp" #include "com/sun/star/xml/dom/XNode.hpp" #include "com/sun/star/xml/dom/XNodeList.hpp" @@ -504,7 +505,8 @@ void UpdateInstallDialog::Thread::installExtensions() m_abort = xAbortChannel; } xPackage = curData.aPackageManager->addPackage( - curData.sLocalURL, OUString(), xAbortChannel, m_updateCmdEnv.get()); + curData.sLocalURL, css::uno::Sequence(), + OUString(), xAbortChannel, m_updateCmdEnv.get()); } catch (css::deployment::DeploymentException & de) { diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx index 50992eb07a97..9698e257b953 100644 --- a/desktop/source/deployment/gui/license_dialog.cxx +++ b/desktop/source/deployment/gui/license_dialog.cxx @@ -116,6 +116,7 @@ struct LicenseDialogImpl : public ModalDialog LicenseDialogImpl( Window * pParent, css::uno::Reference< css::uno::XComponentContext > const & xContext, + const ::rtl::OUString & sExtensionName, const ::rtl::OUString & sLicenseText); virtual void Activate(); @@ -193,6 +194,7 @@ void LicenseView::Notify( SfxBroadcaster&, const SfxHint& rHint ) LicenseDialogImpl::LicenseDialogImpl( Window * pParent, cssu::Reference< cssu::XComponentContext > const & xContext, + const ::rtl::OUString & sExtensionName, const ::rtl::OUString & sLicenseText): ModalDialog(pParent, DpGuiResId(RID_DLG_LICENSE)) ,m_xComponentContext(xContext) @@ -225,6 +227,7 @@ LicenseDialogImpl::LicenseDialogImpl( m_fiArrow1.Show(true); m_fiArrow2.Show(false); m_mlLicense.SetText(sLicenseText); + m_ftHead.SetText(m_ftHead.GetText() + OUString('\n') + sExtensionName); m_mlLicense.SetEndReachedHdl( LINK(this, LicenseDialogImpl, EndReachedHdl) ); m_mlLicense.SetScrolledHdl( LINK(this, LicenseDialogImpl, ScrolledHdl) ); @@ -296,7 +299,7 @@ LicenseDialog::LicenseDialog( Sequence const& args, Reference const& xComponentContext) : m_xComponentContext(xComponentContext) { - comphelper::unwrapArgs( args, m_parent, m_sLicenseText ); + comphelper::unwrapArgs( args, m_parent, m_sExtensionName, m_sLicenseText ); } // XExecutableDialog @@ -315,8 +318,10 @@ sal_Int16 LicenseDialog::execute() throw (RuntimeException) sal_Int16 LicenseDialog::solar_execute() { - std::auto_ptr dlg(new LicenseDialogImpl( - VCLUnoHelper::GetWindow(m_parent), m_xComponentContext, m_sLicenseText)); + std::auto_ptr dlg( + new LicenseDialogImpl( + VCLUnoHelper::GetWindow(m_parent), + m_xComponentContext, m_sExtensionName, m_sLicenseText)); return dlg->Execute(); } diff --git a/desktop/source/deployment/gui/license_dialog.hxx b/desktop/source/deployment/gui/license_dialog.hxx index 4733922dc607..bb4a6b6646c8 100644 --- a/desktop/source/deployment/gui/license_dialog.hxx +++ b/desktop/source/deployment/gui/license_dialog.hxx @@ -48,6 +48,7 @@ class LicenseDialog { Reference const m_xComponentContext; Reference /* const */ m_parent; + OUString m_sExtensionName; OUString /* const */ m_sLicenseText; OUString m_initialTitle; diff --git a/desktop/source/deployment/inc/dp_misc.h b/desktop/source/deployment/inc/dp_misc.h index ee5867a655d3..3283d20718be 100644 --- a/desktop/source/deployment/inc/dp_misc.h +++ b/desktop/source/deployment/inc/dp_misc.h @@ -36,6 +36,7 @@ #include "com/sun/star/lang/XComponent.hpp" #include "com/sun/star/lang/DisposedException.hpp" #include "com/sun/star/deployment/XPackageRegistry.hpp" +#include "com/sun/star/ucb/XCommandEnvironment.hpp" #include "com/sun/star/awt/XWindow.hpp" #include "dp_misc_api.hxx" @@ -168,8 +169,12 @@ void TRACE(::rtl::OUString const & sText); DESKTOP_DEPLOYMENTMISC_DLLPUBLIC void TRACE(::rtl::OString const & sText); +/** registers or revokes shared or bundled extensions which have been + recently added or removed. +*/ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC -bool hasExtensionRepositoryChanged(::rtl::OUString const & repository); +void syncRepositories(::com::sun::star::uno::Reference< + ::com::sun::star::ucb::XCommandEnvironment> const & xCmdEnv); } diff --git a/desktop/source/deployment/inc/dp_ucb.h b/desktop/source/deployment/inc/dp_ucb.h index 6f9127504860..03144388e8a8 100644 --- a/desktop/source/deployment/inc/dp_ucb.h +++ b/desktop/source/deployment/inc/dp_ucb.h @@ -28,6 +28,7 @@ #if ! defined INCLUDED_DP_UCB_H #define INCLUDED_DP_UCB_H +#include #include "rtl/byteseq.hxx" #include "rtl/instance.hxx" #include "com/sun/star/ucb/XCommandEnvironment.hpp" @@ -79,6 +80,12 @@ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC bool readLine( ::rtl::OUString * res, ::rtl::OUString const & startingWith, ::ucbhelper::Content & ucb_content, rtl_TextEncoding textenc ); +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +bool readProperties( ::std::list< ::std::pair< ::rtl::OUString, ::rtl::OUString> > & out_result, + ::ucbhelper::Content & ucb_content); + + + } #endif diff --git a/desktop/source/deployment/manager/dp_activepackages.cxx b/desktop/source/deployment/manager/dp_activepackages.cxx index bf9071682b2e..8f6b6b82c0b7 100644 --- a/desktop/source/deployment/manager/dp_activepackages.cxx +++ b/desktop/source/deployment/manager/dp_activepackages.cxx @@ -107,10 +107,14 @@ static char const legacyPrefix[] = "org.openoffice.legacy."; } else { + sal_Int32 i4 = value.indexOf(separator, i3 + 1); d.mediaType = ::rtl::OUString( value.getStr() + i2 + 1, i3 - i2 -1, RTL_TEXTENCODING_UTF8); d.version = ::rtl::OUString( - value.getStr() + i3 + 1, value.getLength() - i3 - 1, + value.getStr() + i3 + 1, i4 - i3 - 1, + RTL_TEXTENCODING_UTF8); + d.failedPrerequisites = ::rtl::OUString( + value.getStr() + i4 + 1, value.getLength() - i4 - 1, RTL_TEXTENCODING_UTF8); } return d; @@ -188,6 +192,8 @@ void ActivePackages::put(::rtl::OUString const & id, Data const & data) { b.append(::rtl::OUStringToOString(data.mediaType, RTL_TEXTENCODING_UTF8)); b.append(separator); b.append(::rtl::OUStringToOString(data.version, RTL_TEXTENCODING_UTF8)); + b.append(separator); + b.append(::rtl::OUStringToOString(data.failedPrerequisites, RTL_TEXTENCODING_UTF8)); m_map.put(newKey(id), b.makeStringAndClear()); } diff --git a/desktop/source/deployment/manager/dp_activepackages.hxx b/desktop/source/deployment/manager/dp_activepackages.hxx index 36060d26bd02..7d9c7e32cfb4 100644 --- a/desktop/source/deployment/manager/dp_activepackages.hxx +++ b/desktop/source/deployment/manager/dp_activepackages.hxx @@ -42,6 +42,8 @@ namespace dp_manager { class ActivePackages { public: struct Data { + Data(): failedPrerequisites(::rtl::OUString::valueOf((sal_Int32)0)) + {} /* name of the temporary file (shared, user extension) or the name of the folder of the bundled extension. It does not contain the trailing '_' of the folder. @@ -55,6 +57,13 @@ public: ::rtl::OUString fileName; ::rtl::OUString mediaType; ::rtl::OUString version; + /* If this string contains the value according to + com::sun::star::deployment::Prerequisites or "0". That is, if + the value is > 0 then + the call to XPackage::checkPrerequisites failed. + In this case the extension must not be registered. + */ + ::rtl::OUString failedPrerequisites; }; typedef ::std::vector< ::std::pair< ::rtl::OUString, Data > > Entries; diff --git a/desktop/source/deployment/manager/dp_commandenvironments.cxx b/desktop/source/deployment/manager/dp_commandenvironments.cxx new file mode 100644 index 000000000000..814dc818b2a6 --- /dev/null +++ b/desktop/source/deployment/manager/dp_commandenvironments.cxx @@ -0,0 +1,255 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "com/sun/star/deployment/VersionException.hpp" +#include "com/sun/star/deployment/LicenseException.hpp" +#include "com/sun/star/deployment/InstallException.hpp" +#include "com/sun/star/task/XInteractionApprove.hpp" +#include "com/sun/star/task/XInteractionAbort.hpp" +#include "com/sun/star/task/XInteractionHandler.hpp" +#include "com/sun/star/ucb/XCommandEnvironment.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "dp_commandenvironments.hxx" + +namespace deployment = com::sun::star::deployment; +namespace lang = com::sun::star::lang; +namespace task = com::sun::star::task; +namespace ucb = com::sun::star::ucb; +namespace uno = com::sun::star::uno; +namespace css = com::sun::star; + +#define OUSTR(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) + +using ::com::sun::star::uno::Reference; +using ::rtl::OUString; + +namespace dp_manager { + +BaseCommandEnv::BaseCommandEnv() +{ +} + +BaseCommandEnv::BaseCommandEnv( + Reference< task::XInteractionHandler> const & handler) + : m_forwardHandler(handler) +{ +} + +BaseCommandEnv::~BaseCommandEnv() +{ +} +// XCommandEnvironment +//______________________________________________________________________________ +Reference BaseCommandEnv::getInteractionHandler() +throw (uno::RuntimeException) +{ + return this; +} + +//______________________________________________________________________________ +Reference BaseCommandEnv::getProgressHandler() +throw (uno::RuntimeException) +{ + return this; +} + +void BaseCommandEnv::handle( + Reference< task::XInteractionRequest> const & /*xRequest*/ ) + throw (uno::RuntimeException) +{ +} + +void BaseCommandEnv::handle_(bool approve, bool abort, + Reference< task::XInteractionRequest> const & xRequest ) +{ + if (approve == false && abort == false) + { + //not handled so far -> forwarding + if (m_forwardHandler.is()) + m_forwardHandler->handle(xRequest); + else + return; //cannot handle + } + else + { + // select: + uno::Sequence< Reference< task::XInteractionContinuation > > conts( + xRequest->getContinuations() ); + Reference< task::XInteractionContinuation > const * pConts = + conts.getConstArray(); + sal_Int32 len = conts.getLength(); + for ( sal_Int32 pos = 0; pos < len; ++pos ) + { + if (approve) { + Reference< task::XInteractionApprove > xInteractionApprove( + pConts[ pos ], uno::UNO_QUERY ); + if (xInteractionApprove.is()) { + xInteractionApprove->select(); + // don't query again for ongoing continuations: + approve = false; + } + } + else if (abort) { + Reference< task::XInteractionAbort > xInteractionAbort( + pConts[ pos ], uno::UNO_QUERY ); + if (xInteractionAbort.is()) { + xInteractionAbort->select(); + // don't query again for ongoing continuations: + abort = false; + } + } + } + } + +} + +// XProgressHandler +void BaseCommandEnv::push( uno::Any const & /*Status*/ ) +throw (uno::RuntimeException) +{ +} + + +void BaseCommandEnv::update( uno::Any const & /*Status */) +throw (uno::RuntimeException) +{ +} + +void BaseCommandEnv::pop() throw (uno::RuntimeException) +{ +} +//============================================================================== + +TmpRepositoryCommandEnv::TmpRepositoryCommandEnv() +{ +} + +TmpRepositoryCommandEnv::TmpRepositoryCommandEnv( + css::uno::Reference< css::task::XInteractionHandler> const & handler): + BaseCommandEnv(handler) +{ +} +// XInteractionHandler +void TmpRepositoryCommandEnv::handle( + Reference< task::XInteractionRequest> const & xRequest ) + throw (uno::RuntimeException) +{ + uno::Any request( xRequest->getRequest() ); + OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); + + deployment::VersionException verExc; + deployment::LicenseException licExc; + deployment::InstallException instExc; + + bool approve = false; + bool abort = false; + + if ((request >>= verExc) + || (request >>= licExc) + || (request >>= instExc)) + { + approve = true; + } + + handle_(approve, abort, xRequest); +} +//================================================================================ + +LicenseCommandEnv::LicenseCommandEnv( + css::uno::Reference< css::task::XInteractionHandler> const & handler, + bool bSuppressLicense, + OUString const & repository): + BaseCommandEnv(handler), m_repository(repository), + m_bSuppressLicense(bSuppressLicense) +{ +} +// XInteractionHandler +void LicenseCommandEnv::handle( + Reference< task::XInteractionRequest> const & xRequest ) + throw (uno::RuntimeException) +{ + uno::Any request( xRequest->getRequest() ); + OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); + + + deployment::LicenseException licExc; + + bool approve = false; + bool abort = false; + + if (request >>= licExc) + { + if (m_bSuppressLicense + || m_repository.equals(OUSTR("bundled")) + || licExc.AcceptBy.equals(OUSTR("admin"))) + { + //always approve in bundled case, because we do not support + //showing licenses anyway. + //The "admin" already accepted the license when installing the + // shared extension + approve = true; + } + } + + handle_(approve, abort, xRequest); +} + +//================================================================================ +//================================================================================ + +NoLicenseCommandEnv::NoLicenseCommandEnv( + css::uno::Reference< css::task::XInteractionHandler> const & handler): + BaseCommandEnv(handler) +{ +} +// XInteractionHandler +void NoLicenseCommandEnv::handle( + Reference< task::XInteractionRequest> const & xRequest ) + throw (uno::RuntimeException) +{ + uno::Any request( xRequest->getRequest() ); + OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); + + + deployment::LicenseException licExc; + + bool approve = false; + bool abort = false; + + if (request >>= licExc) + { + approve = true; + } + handle_(approve, abort, xRequest); +} + +} // namespace dp_manager + + diff --git a/desktop/source/deployment/manager/dp_commandenvironments.hxx b/desktop/source/deployment/manager/dp_commandenvironments.hxx new file mode 100644 index 000000000000..ad47fd2af549 --- /dev/null +++ b/desktop/source/deployment/manager/dp_commandenvironments.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_DP_COMMANDENVIRONMENTS_HXX +#define INCLUDED_DP_COMMANDENVIRONMENTS_HXX + + +#include "cppuhelper/compbase3.hxx" +//#include "cppuhelper/implbase2.hxx" +#include "ucbhelper/content.hxx" + + + +namespace css = ::com::sun::star; + +namespace dp_manager { + + + +/** + This command environment is to be used when an extension is temporarily + stored in the "tmp" repository. It prevents all kind of user interaction. + */ +class BaseCommandEnv + : public ::cppu::WeakImplHelper3< css::ucb::XCommandEnvironment, + css::task::XInteractionHandler, + css::ucb::XProgressHandler > +{ +protected: + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::task::XInteractionHandler> m_forwardHandler; + + void handle_(bool approve, bool abort, + css::uno::Reference< css::task::XInteractionRequest> const & xRequest ); +public: + virtual ~BaseCommandEnv(); + BaseCommandEnv(); + BaseCommandEnv( + css::uno::Reference< css::task::XInteractionHandler> const & handler); + + // XCommandEnvironment + virtual css::uno::Reference SAL_CALL + getInteractionHandler() throw (css::uno::RuntimeException); + virtual css::uno::Reference + SAL_CALL getProgressHandler() throw (css::uno::RuntimeException); + + // XInteractionHandler + virtual void SAL_CALL handle( + css::uno::Reference const & xRequest ) + throw (css::uno::RuntimeException); + + // XProgressHandler + virtual void SAL_CALL push( css::uno::Any const & Status ) + throw (css::uno::RuntimeException); + virtual void SAL_CALL update( css::uno::Any const & Status ) + throw (css::uno::RuntimeException); + virtual void SAL_CALL pop() throw (css::uno::RuntimeException); +}; + +class TmpRepositoryCommandEnv : public BaseCommandEnv +{ +public: + TmpRepositoryCommandEnv::TmpRepositoryCommandEnv(); + TmpRepositoryCommandEnv::TmpRepositoryCommandEnv( + css::uno::Reference< css::task::XInteractionHandler> const & handler); + +// XInteractionHandler + virtual void SAL_CALL handle( + css::uno::Reference const & xRequest ) + throw (css::uno::RuntimeException); + +}; + +/** this class is for use in XPackageManager::synchronize. + + It handles particular license cases. + */ +class LicenseCommandEnv : public BaseCommandEnv +{ +private: + ::rtl::OUString m_repository; + bool m_bSuppressLicense; +public: + LicenseCommandEnv::LicenseCommandEnv(){}; + LicenseCommandEnv::LicenseCommandEnv( + css::uno::Reference< css::task::XInteractionHandler> const & handler, + bool bSuppressLicense, + ::rtl::OUString const & repository); + +// XInteractionHandler + virtual void SAL_CALL handle( + css::uno::Reference const & xRequest ) + throw (css::uno::RuntimeException); + +}; + +/** this class is for use in XPackageManager::checkPrerequisites + + It always prohibits a license interaction + */ +class NoLicenseCommandEnv : public BaseCommandEnv +{ + +public: + NoLicenseCommandEnv::NoLicenseCommandEnv(){}; + NoLicenseCommandEnv::NoLicenseCommandEnv( + css::uno::Reference< css::task::XInteractionHandler> const & handler); + +// XInteractionHandler + virtual void SAL_CALL handle( + css::uno::Reference const & xRequest ) + throw (css::uno::RuntimeException); + +}; + +} + + + + +#endif + diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 6e76cfb574bd..15bd9a581611 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -56,9 +56,10 @@ #include "dp_resource.h" #include "dp_ucb.h" #include "dp_identifier.hxx" - +#include "dp_descriptioninfoset.hxx" #include "dp_extensionmanager.hxx" -#include "dp_tmprepocmdenv.hxx" +#include "dp_commandenvironments.hxx" +#include "dp_properties.hxx" #include #include #include @@ -146,6 +147,25 @@ Reference ExtensionManager::createAbortChannel() return new dp_misc::AbortChannel; } +css::uno::Reference +ExtensionManager::getPackageManager(::rtl::OUString const & repository) + throw (css::lang::IllegalArgumentException) +{ + Reference xPackageManager; + if (repository.equals(OUSTR("user"))) + xPackageManager = m_userRepository; + else if (repository.equals(OUSTR("shared"))) + xPackageManager = m_sharedRepository; + else if (repository.equals(OUSTR("bundled"))) + xPackageManager = m_bundledRepository; + else + throw lang::IllegalArgumentException( + OUSTR("No valid repository name provided."), + static_cast(this), 0); + return xPackageManager; +} + + /* Enters the XPackage objects into a map. They must be all from the same repository. The value type of the map is a vector, where each vector @@ -278,37 +298,6 @@ Reference ExtensionManager::getExtensionAndStatus( return theExtension; } -/* - Determines if the user extension was disabled by the user. Currently a user - cannot disable extensions from other repositories. If an extension does not - contain any items which need to be registered then the extension cannot - actually be disabled (because it cannot be registered). In this case false is - returned. If there is no user extension then also false is returned. - */ -bool ExtensionManager::isUserExtensionDisabled( - OUString const & identifier, OUString const & fileName, - css::uno::Reference const & xAbortChannel, - css::uno::Reference const & xCmdEnv ) - -{ - bool bDisabled = false; - Reference xExtension; - try - { //will throw an exception if the extension does not exist - xExtension = m_userRepository->getDeployedPackage( - identifier, fileName, Reference()); - } catch(lang::IllegalArgumentException &) - { - } - if (xExtension.is()) - { - beans::Optional > reg = - xExtension->isRegistered(xAbortChannel, xCmdEnv); - if (reg.IsPresent && ! reg.Value.Value) - bDisabled = true; - } - return bDisabled; -} /* This method determines the active extension (XPackage.registerPackage) with a particular identifier. @@ -326,36 +315,50 @@ bool ExtensionManager::isUserExtensionDisabled( */ void ExtensionManager::activateExtension( OUString const & identifier, OUString const & fileName, - bool bUserDisabled, Reference const & xAbortChannel, Reference const & xCmdEnv ) { ::std::list > listExtensions = getExtensionsWithSameId(identifier, fileName); OSL_ASSERT(listExtensions.size() == 3); - ::std::list >::const_iterator - iext = listExtensions.begin(); - //skip disabled user extension - if (listExtensions.front().is() && bUserDisabled) - iext++; + + activateExtension( + ::comphelper::containerToSequence< + Reference, + ::std::list > + > (listExtensions), + xAbortChannel, xCmdEnv); +} + +void ExtensionManager::activateExtension( + uno::Sequence > const & seqExt, + Reference const & xAbortChannel, + Reference const & xCmdEnv ) +{ bool bActive = false; - for (; iext != listExtensions.end(); iext++) + sal_Int32 len = seqExt.getLength(); + for (sal_Int32 i = 0; i < len; i++) { - if (iext->is()) + Reference const & aExt = seqExt[i]; + if (aExt.is()) { //get the registration value of the current iteration beans::Optional > optReg = - (*iext)->isRegistered(xAbortChannel, xCmdEnv); + aExt->isRegistered(xAbortChannel, xCmdEnv); //If nothing can be registered then break if (!optReg.IsPresent) break; + //Check if this is a disabled user extension, if so then skip + if (!optReg.Value.Value && i == 0) //e.g. not registered + continue; + //If we have already determined an active extension then we must //make sure to unregister all extensions with the same id in //repositories with a lower priority if (bActive) { - (*iext)->revokePackage(xAbortChannel, xCmdEnv); + aExt->revokePackage(xAbortChannel, xCmdEnv); } else { @@ -365,7 +368,7 @@ void ExtensionManager::activateExtension( //Register if not already done. //reregister if the value is ambiguous, which indicates that //something went wrong during last registration. - (*iext)->registerPackage(xAbortChannel, xCmdEnv); + aExt->registerPackage(xAbortChannel, xCmdEnv); } } } @@ -386,8 +389,8 @@ Reference ExtensionManager::backupExtension( if (xOldExtension.is()) { xBackup = m_tmpRepository->addPackage( - xOldExtension->getURL(), OUString(), - Reference(), tmpCmdEnv); + xOldExtension->getURL(), uno::Sequence(), + OUString(), Reference(), tmpCmdEnv); OSL_ENSURE(xBackup.is(), "Failed to backup extension"); } @@ -408,7 +411,8 @@ ExtensionManager::getSupportedPackageTypes(OUString const & repository) // Only add to shared and user repository Reference ExtensionManager::addExtension( - OUString const & url, OUString const & repository, + OUString const & url, uno::Sequence const & properties, + OUString const & repository, Reference const & xAbortChannel, Reference const & xCmdEnv ) throw (deploy::DeploymentException, @@ -436,9 +440,11 @@ Reference ExtensionManager::addExtension( const OUString sFileName = xTmpExtension->getName(); const OUString sDisplayName = xTmpExtension->getDisplayName(); const OUString sVersion = xTmpExtension->getVersion(); + dp_misc::DescriptionInfoset info(dp_misc::getDescriptionInfoset(xTmpExtension->getURL())); + const ::boost::optional licenseAttributes = + info.getSimpleLicenseAttributes(); Reference xOldExtension; - bool bUserDisabled = false; Reference xExtensionBackup; uno::Any excOccurred1; @@ -450,10 +456,6 @@ Reference ExtensionManager::addExtension( //disabled by a user, then the newly installed one is enabled. If we //add to another repository then the user extension remains //disabled. - if (! repository.equals(OUSTR("user"))) - bUserDisabled = isUserExtensionDisabled( - sIdentifier, sFileName, xAbortChannel, xCmdEnv); - bool bWasRegistered = false; xOldExtension = getExtensionAndStatus( sIdentifier, sFileName, repository, xAbortChannel, @@ -474,8 +476,15 @@ Reference ExtensionManager::addExtension( checkInstall(sDisplayName, xCmdEnv); } + //Prevent showing the license if requested. + Reference _xCmdEnv(xCmdEnv); + ExtensionProperties props(OUString(), properties, Reference()); + if (licenseAttributes && licenseAttributes->suppressIfRequired + && props.isSuppressedLicense()) + _xCmdEnv = Reference(new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler())); + bCanInstall = xTmpExtension->checkPrerequisites( - xAbortChannel, xCmdEnv, xOldExtension.is(), repository); + xAbortChannel, _xCmdEnv, xOldExtension.is()) == 0 ? true : false; } catch (deploy::DeploymentException& ) { excOccurred1 = ::cppu::getCaughtException(); @@ -516,11 +525,10 @@ Reference ExtensionManager::addExtension( } xNewExtension = xPackageManager->addPackage( - url, OUString(), xAbortChannel, xCmdEnv); + url, properties, OUString(), xAbortChannel, xCmdEnv); activateExtension( dp_misc::getIdentifier(xNewExtension), - xNewExtension->getName(), bUserDisabled, - xAbortChannel, xCmdEnv); + xNewExtension->getName(), xAbortChannel, xCmdEnv); } } catch (deploy::DeploymentException& ) { @@ -560,7 +568,7 @@ Reference ExtensionManager::addExtension( tmpCmdEnv); } activateExtension( - sIdentifier, sFileName, bUserDisabled, + sIdentifier, sFileName, Reference(), tmpCmdEnv); if (xTmpExtension.is() || xExtensionBackup.is()) m_tmpRepository->removePackage( @@ -595,7 +603,7 @@ void ExtensionManager::removeExtension( uno::Any excOccurred1; Reference xExtensionBackup; Reference xPackageManager; - bool bUserDisabled = false; + try { //Determine the repository to use @@ -610,10 +618,6 @@ void ExtensionManager::removeExtension( ::osl::MutexGuard guard(m_mutex); //Backup the extension, in case the user cancels the action - - bUserDisabled = isUserExtensionDisabled( - identifier, fileName, xAbortChannel, xCmdEnv); - //Backup the extension, in case the user cancels the action xExtensionBackup = backupExtension( identifier, fileName, xPackageManager, xCmdEnv); @@ -625,8 +629,7 @@ void ExtensionManager::removeExtension( xPackageManager->removePackage( identifier, fileName, xAbortChannel, xCmdEnv); - activateExtension(identifier, fileName, bUserDisabled, - xAbortChannel, xCmdEnv); + activateExtension(identifier, fileName, xAbortChannel, xCmdEnv); } catch (deploy::DeploymentException& ) { excOccurred1 = ::cppu::getCaughtException(); @@ -661,7 +664,7 @@ void ExtensionManager::removeExtension( xExtensionBackup, Reference(), tmpCmdEnv); activateExtension( - identifier, fileName, bUserDisabled, Reference(), + identifier, fileName, Reference(), tmpCmdEnv); m_tmpRepository->removePackage( @@ -735,7 +738,7 @@ void ExtensionManager::enableExtension( { activateExtension(dp_misc::getIdentifier(extension), extension->getName(), - false, xAbortChannel, xCmdEnv); + xAbortChannel, xCmdEnv); } catch (deploy::DeploymentException& ) { excOccurred = ::cppu::getCaughtException(); @@ -762,7 +765,7 @@ void ExtensionManager::enableExtension( extension->revokePackage(Reference(), xCmdEnv); activateExtension(dp_misc::getIdentifier(extension), extension->getName(), - true, xAbortChannel, xCmdEnv); + xAbortChannel, xCmdEnv); } catch (...) { @@ -771,6 +774,56 @@ void ExtensionManager::enableExtension( } } +/** + */ +long ExtensionManager::checkPrerequisitesAndEnable( + Reference const & extension, + Reference const & xAbortChannel, + Reference const & xCmdEnv) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + try + { + if (!extension.is()) + return 0; + ::osl::MutexGuard guard(m_mutex); + sal_Int32 ret = 0; + Reference mgr = + getPackageManager(extension->getRepositoryName()); + ret = mgr->checkPrerequisites(extension, xAbortChannel, xCmdEnv); + if (ret) + { + //There are some unfulfilled prerequisites, try to revoke + extension->revokePackage(xAbortChannel, xCmdEnv); + } + activateExtension(dp_misc::getIdentifier(extension), + extension->getName(), xAbortChannel, xCmdEnv); + return ret; + } + catch (deploy::DeploymentException& ) { + throw; + } catch (ucb::CommandFailedException & ) { + throw; + } catch (ucb::CommandAbortedException & ) { + throw; + } catch (lang::IllegalArgumentException &) { + throw; + } catch (uno::RuntimeException &) { + throw; + } catch (...) { + uno::Any excOccurred = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception during disableExtension"), + static_cast(this), excOccurred); + throw exc; + } +} + + void ExtensionManager::disableExtension( Reference const & extension, Reference const & xAbortChannel, @@ -806,7 +859,7 @@ void ExtensionManager::disableExtension( extension->revokePackage(xAbortChannel, xCmdEnv); activateExtension(dp_misc::getIdentifier(extension), extension->getName(), - true, xAbortChannel, xCmdEnv); + xAbortChannel, xCmdEnv); } catch (deploy::DeploymentException& ) { excOccurred = ::cppu::getCaughtException(); @@ -832,7 +885,7 @@ void ExtensionManager::disableExtension( { activateExtension(dp_misc::getIdentifier(extension), extension->getName(), - false, xAbortChannel, xCmdEnv); + xAbortChannel, xCmdEnv); } catch (...) { @@ -852,26 +905,8 @@ uno::Sequence< Reference > lang::IllegalArgumentException, uno::RuntimeException) { - if (repository.equals(OUSTR("user"))) - { - return m_userRepository->getDeployedPackages( - xAbort, xCmdEnv); - } - else if (repository.equals(OUSTR("shared"))) - { - return m_sharedRepository->getDeployedPackages( - xAbort, xCmdEnv); - } - else if (repository.equals(OUSTR("bundled"))) - { - return m_bundledRepository->getDeployedPackages( - xAbort, xCmdEnv); - } - else - throw lang::IllegalArgumentException( - OUSTR("No valid repository name provided."), - static_cast(this), 0); - + return getPackageManager(repository)->getDeployedPackages( + xAbort, xCmdEnv); } Reference @@ -885,25 +920,8 @@ Reference lang::IllegalArgumentException, uno::RuntimeException) { - if (repository.equals(OUSTR("user"))) - { - return m_userRepository->getDeployedPackage( - identifier, filename, xCmdEnv); - } - else if (repository.equals(OUSTR("shared"))) - { - return m_sharedRepository->getDeployedPackage( - identifier, filename, xCmdEnv); - } - else if (repository.equals(OUSTR("bundled"))) - { - return m_bundledRepository->getDeployedPackage( - identifier, filename, xCmdEnv); - } - else - throw lang::IllegalArgumentException( - OUSTR("No valid repository name provided."), - static_cast(this), 0); + return getPackageManager(repository)->getDeployedPackage( + identifier, filename, xCmdEnv); } uno::Sequence< uno::Sequence > > @@ -978,17 +996,8 @@ void ExtensionManager::reinstallDeployedExtensions( { try { - Reference xPackageManager; - if (repository.equals(OUSTR("user"))) - xPackageManager = m_userRepository; - else if (repository.equals(OUSTR("shared"))) - xPackageManager = m_sharedRepository; - else if (repository.equals(OUSTR("bundled"))) - xPackageManager = m_bundledRepository; - else - throw lang::IllegalArgumentException( - OUSTR("No valid repository name provided."), - static_cast(this), 0); + Reference + xPackageManager = getPackageManager(repository); ::osl::MutexGuard guard(m_mutex); xPackageManager->reinstallDeployedPackages(xAbortChannel, xCmdEnv); @@ -1002,10 +1011,7 @@ void ExtensionManager::reinstallDeployedExtensions( const OUString id = dp_misc::getIdentifier(extensions[ pos ]); const OUString fileName = extensions[ pos ]->getName(); OSL_ASSERT(id.getLength()); - activateExtension( - id, fileName, - isUserExtensionDisabled(id, fileName, xAbortChannel, xCmdEnv), - xAbortChannel, xCmdEnv ); + activateExtension(id, fileName, xAbortChannel, xCmdEnv ); } catch (lang::DisposedException &) { @@ -1067,57 +1073,34 @@ void ExtensionManager::synchronize( static_cast(this), 0); ::osl::MutexGuard guard(m_mutex); - uno::Sequence > seqAddedExtensions; - uno::Sequence > seqRemovedExtensions; - xPackageManager->synchronize(seqAddedExtensions, seqRemovedExtensions, - xAbortChannel, xCmdEnv); - - //ToDo: optimize, only call activateExtension once per id. - //Determine which of the extensions was disabled by the user - //iterate of both sequences and add the ids of the user disabled - //to a map - for (sal_Int32 i = 0; i < seqRemovedExtensions.getLength(); i++) + + dp_misc::ProgressLevel progress( + xCmdEnv, OUSTR("Synchronizing ") + repository + OUSTR(" repository\n")); + xPackageManager->synchronize(xAbortChannel, xCmdEnv); + + + try { - try - { - Reference const & xExtension = seqRemovedExtensions[i]; - OSL_ASSERT(xExtension.is()); - const OUString id = dp_misc::getIdentifier(xExtension); - const OUString fileName = xExtension->getName(); - - bool bUserDisabled = isUserExtensionDisabled( - id, xExtension->getName(), xAbortChannel, xCmdEnv); - xExtension->revokePackage(xAbortChannel, xCmdEnv); - xPackageManager->removePackage( - id, fileName, xAbortChannel, xCmdEnv); - activateExtension( - id, fileName, /*bUserDisabled*/ false, xAbortChannel, xCmdEnv); - } - catch (...) + const uno::Sequence > > + seqSeqExt = getAllExtensions(xAbortChannel, xCmdEnv); + for (sal_Int32 i = 0; i < seqSeqExt.getLength(); i++) { - OSL_ENSURE(0, "Extensions Manager: synchronize"); + uno::Sequence > const & seqExt = + seqSeqExt[i]; + + activateExtension(seqExt, xAbortChannel, xCmdEnv); } } - - for (sal_Int32 i = 0; i < seqAddedExtensions.getLength(); i++) + catch (...) { - try - { - Reference const & xExtension = seqAddedExtensions[i]; - OSL_ASSERT(xExtension.is()); - const OUString id = dp_misc::getIdentifier(xExtension); - const OUString fileName = xExtension->getName(); - bool bUserDisabled = isUserExtensionDisabled( - id, fileName, xAbortChannel, xCmdEnv); - activateExtension( - id, fileName, bUserDisabled, xAbortChannel, xCmdEnv); - } - catch (...) - { - OSL_ENSURE(0, "Extensions Manager: synchronize"); - } + //We catch the exception, so we can write the lastmodified file + //so we will no repeat this everytime OOo starts. + OSL_ENSURE(0, "Extensions Manager: synchronize"); } + + progress.update(OUSTR("\n\n")); + //Write the lastmodified file try { ::rtl::Bootstrap::expandMacros(file); @@ -1231,7 +1214,7 @@ Reference ExtensionManager::getTempExtension( { Reference tmpCmdEnvA(new TmpRepositoryCommandEnv()); Reference xTmpPackage = m_tmpRepository->addPackage( - url, OUString(), xAbortChannel, tmpCmdEnvA); + url, uno::Sequence(),OUString(), xAbortChannel, tmpCmdEnvA); if (!xTmpPackage.is()) { @@ -1242,6 +1225,20 @@ Reference ExtensionManager::getTempExtension( } return xTmpPackage; } + +uno::Sequence > SAL_CALL +ExtensionManager::getExtensionsWithUnacceptedLicenses( + OUString const & repository, + Reference const & xCmdEnv) + throw (deploy::DeploymentException, + uno::RuntimeException) +{ + Reference + xPackageManager = getPackageManager(repository); + ::osl::MutexGuard guard(m_mutex); + return xPackageManager->getExtensionsWithUnacceptedLicenses(xCmdEnv); +} + //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index 386e2a7ceffd..bafa97c24944 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -106,7 +106,9 @@ public: createAbortChannel() throw (css::uno::RuntimeException); virtual css::uno::Reference SAL_CALL addExtension( - ::rtl::OUString const & url, ::rtl::OUString const & repository, + ::rtl::OUString const & url, + css::uno::Sequence const & properties, + ::rtl::OUString const & repository, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ) throw (css::deployment::DeploymentException, @@ -147,6 +149,18 @@ public: css::lang::IllegalArgumentException, css::uno::RuntimeException); + + virtual long SAL_CALL checkPrerequisitesAndEnable( + css::uno::Reference const & extension, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + virtual css::uno::Sequence< css::uno::Reference > SAL_CALL getDeployedExtensions( ::rtl::OUString const & repository, @@ -202,6 +216,13 @@ public: css::lang::IllegalArgumentException, css::uno::RuntimeException); + virtual css::uno::Sequence > SAL_CALL + getExtensionsWithUnacceptedLicenses( + ::rtl::OUString const & repository, + css::uno::Reference const & xCmdEnv) + throw (css::deployment::DeploymentException, + css::uno::RuntimeException); + private: struct ExtensionInfos @@ -233,18 +254,16 @@ private: css::uno::Reference const & xCmdEnv, bool & out_bWasRegistered); - bool isUserExtensionDisabled( + void activateExtension( ::rtl::OUString const & identifier, ::rtl::OUString const & fileName, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv); void activateExtension( - ::rtl::OUString const & identifier, - ::rtl::OUString const & fileName, - bool bUserDisabled, - css::uno::Reference const & xAbortChannel, - css::uno::Reference const & xCmdEnv); + css::uno::Sequence > const & seqExt, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ); ::std::list > @@ -276,6 +295,10 @@ private: id2extensions & mapExt, css::uno::Sequence > const & seqExt, ::rtl::OUString const & repository); + + css::uno::Reference + getPackageManager(::rtl::OUString const & repository) + throw (css::lang::IllegalArgumentException); }; } diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index e2580e7b955b..0464d0de62d5 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -58,6 +58,7 @@ #include "com/sun/star/ucb/NameClash.hpp" #include "com/sun/star/deployment/VersionException.hpp" #include "com/sun/star/deployment/InstallException.hpp" +#include "com/sun/star/deployment/Prerequisites.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" #include "com/sun/star/ucb/UnsupportedCommandException.hpp" #include "boost/bind.hpp" @@ -67,7 +68,8 @@ #include #include #include "dp_descriptioninfoset.hxx" - +#include "dp_commandenvironments.hxx" +#include "dp_properties.hxx" using namespace ::dp_misc; using namespace ::com::sun::star; @@ -97,19 +99,6 @@ struct MatchTempDir } }; -struct MatchExtension -{ - const ActivePackages::Data m_data; - MatchExtension(ActivePackages::Data const & data ) : m_data(data) {} - bool operator () ( OUString const & temporaryName ) const; -}; - -bool MatchExtension::operator () (OUString const & temporaryName) const -{ - //case 1: The temporary file and thus the extension folder are already - //removed. - return m_data.temporaryName.equals(temporaryName); -} namespace { OUString getExtensionFolder(OUString const & parentFolder, @@ -131,23 +120,6 @@ OUString getExtensionFolder(OUString const & parentFolder, } return title; } -/* adds an unencoded segment to the URL. - - Throws an com.sun.star.uno.Exception if this failed. -*/ -OUString appendURLSegement(OUString const & baseURL, OUString const & segment) -{ - OUString url; - INetURLObject inet(baseURL); - if (inet.insertName( - segment, false, INetURLObject::LAST_SEGMENT, true, - INetURLObject::ENCODE_ALL)) - url = inet.GetMainURL(INetURLObject::NO_DECODE); - else - throw Exception( - OUSTR("ExtensionManager: failed to add segment to URL"), 0); - return url; -} } //______________________________________________________________________________ void PackageManagerImpl::initActivationLayer( @@ -193,7 +165,8 @@ void PackageManagerImpl::initActivationLayer( { ActivePackages::Data dbData; insertToActivationLayer( - mediaType, sourceContent, title, &dbData ); + Sequence(),mediaType, sourceContent, + title, &dbData ); insertToActivationLayerDB( title, dbData ); //TODO #i73136#: insertToActivationLayerDB needs id not @@ -293,7 +266,7 @@ void PackageManagerImpl::initActivationLayer( //Make sure only the same user removes the extension, who //previously unregistered it. This is avoid races if multiple instances //of OOo are running which all have write access to the shared installation. - //For example, user a uses extension a, removes the extension, but keeps OOo + //For example, a user removes the extension, but keeps OOo //running. Parts of the extension may still be loaded and used by OOo. //Therefore the extension is only deleted the next time the extension manager is //run after restarting OOo. While OOo is still running, another user starts OOo @@ -637,6 +610,7 @@ OUString PackageManagerImpl::detectMediaType( //______________________________________________________________________________ OUString PackageManagerImpl::insertToActivationLayer( + Sequence const & properties, OUString const & mediaType, ::ucbhelper::Content const & sourceContent_, OUString const & title, ActivePackages::Data * dbData ) { @@ -702,13 +676,17 @@ OUString PackageManagerImpl::insertToActivationLayer( //bundled extensions should only be added by the synchronizeAddedExtensions //functions. Moreover, there is no "temporary folder" for bundled extensions. OSL_ASSERT(!m_context.equals(OUSTR("bundled"))); + OUString sFolderUrl = makeURLAppendSysPathSegment(destFolderContent.getURL(), title); DescriptionInfoset info = - dp_misc::getDescriptionInfoset( - appendURLSegement(destFolderContent.getURL(), title)); + dp_misc::getDescriptionInfoset(sFolderUrl); dbData->temporaryName = tempEntry; dbData->fileName = title; dbData->mediaType = mediaType; dbData->version = info.getVersion(); + + //No write the properties file next to the extension + ExtensionProperties props(sFolderUrl, properties, xCmdEnv); + props.write(); return destFolder; } @@ -716,6 +694,8 @@ OUString PackageManagerImpl::insertToActivationLayer( void PackageManagerImpl::insertToActivationLayerDB( OUString const & id, ActivePackages::Data const & dbData ) { + //access to the database must be guarded. See removePackage + const ::osl::MutexGuard guard( getMutex() ); m_activePackagesDB->put( id, dbData ); } @@ -746,14 +726,17 @@ Reference PackageManagerImpl::importExtension( CommandAbortedException, lang::IllegalArgumentException, RuntimeException) { - return addPackage(extension->getURL(), OUString(), xAbortChannel, xCmdEnv_); + return addPackage(extension->getURL(), Sequence(), + OUString(), xAbortChannel, xCmdEnv_); } /* The function adds an extension but does not register it!!! It may not do any user interaction. This is done in XExtensionManager::addExtension */ Reference PackageManagerImpl::addPackage( - OUString const & url, OUString const & mediaType_, + OUString const & url, + css::uno::Sequence const & properties, + OUString const & mediaType_, Reference const & xAbortChannel, Reference const & xCmdEnv_ ) throw (deployment::DeploymentException, CommandFailedException, @@ -826,7 +809,7 @@ Reference PackageManagerImpl::addPackage( } ActivePackages::Data dbData; destFolder = insertToActivationLayer( - mediaType, sourceContent, title, &dbData ); + properties, mediaType, sourceContent, title, &dbData ); // bind activation package: @@ -859,10 +842,7 @@ Reference PackageManagerImpl::addPackage( xCmdEnv); } install = true; - const ::osl::MutexGuard guard( getMutex() ); - //access to the database must be guarded. See removePackage_ insertToActivationLayerDB(id, dbData); - } catch (...) { @@ -1062,8 +1042,13 @@ Reference PackageManagerImpl::getDeployedPackage_( Reference xExtension; try { - xExtension = m_xRegistry->bindPackage( - getDeployPath( data ), data.mediaType, false, OUString(), xCmdEnv ); + //Ignore extensions where XPackage::checkPrerequisites failed. + //They must not be usable for this user. + if (data.failedPrerequisites.equals(OUSTR("0"))) + { + xExtension = m_xRegistry->bindPackage( + getDeployPath( data ), data.mediaType, false, OUString(), xCmdEnv ); + } } catch (deployment::InvalidRemovedParameterException& e) { @@ -1083,6 +1068,8 @@ PackageManagerImpl::getDeployedPackages_( ActivePackages::Entries::const_iterator const iEnd( id2temp.end() ); for ( ; iPos != iEnd; ++iPos ) { + if (! iPos->second.failedPrerequisites.equals(OUSTR("0"))) + continue; try { packages.push_back( getDeployedPackage_( @@ -1265,8 +1252,7 @@ void PackageManagerImpl::reinstallDeployedPackages( return m_readOnly; } void PackageManagerImpl::synchronizeRemovedExtensions( - Sequence > & out_removedExtensions, - Reference const & /*xAbortChannel*/, + Reference const & xAbortChannel, Reference const & xCmdEnv) { @@ -1275,64 +1261,38 @@ void PackageManagerImpl::synchronizeRemovedExtensions( OSL_ASSERT(!m_context.equals(OUSTR("user"))); ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() ); - //Iterate over the contents of the extension folder and gather the - //temp file names (shared) or the folder names of the bundled extension. - ::ucbhelper::ResultSetInclude includeType = ::ucbhelper::INCLUDE_DOCUMENTS_ONLY; - if (m_context.equals(OUSTR("bundled"))) - includeType = ::ucbhelper::INCLUDE_FOLDERS_ONLY; - ::ucbhelper::Content tempFolder( - m_activePackages_expanded, xCmdEnv ); - Reference xResultSet( - tempFolder.createCursor( - Sequence( &StrTitle::get(), 1 ), includeType) ); - // get all temp directories: - ::std::vector tempEntries; - while (xResultSet->next()) { - OUString title( - Reference( - xResultSet, UNO_QUERY_THROW )->getString( - 1 /* Title */ ) ); - //also add the xxx.tmpremoved files for remove shared extensions - //this does not matter - tempEntries.push_back( ::rtl::Uri::encode( - title, rtl_UriCharClassPchar, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ) ); - } - typedef ActivePackages::Entries::const_iterator ITActive; bool bShared = m_context.equals(OUSTR("shared")); - ::std::vector > removedExtensions; + for (ITActive i = id2temp.begin(); i != id2temp.end(); i++) { - //Get the URL to the extensions folder, first make the url for the - //shared repository including the temporary name -// OUString url(m_activePackages_expanded + OUSTR("/") -// + i->second.temporaryName); -// if (bShared) -// url = appendURLSegement(m_activePackages_expanded + OUSTR("/") -// + i->second.temporaryName + OUSTR("_"), -// i->second.fileName); - OUString url = makeURL(m_activePackages, i->second.temporaryName); - if (bShared) - url = makeURLAppendSysPathSegment( url + OUSTR("_"), i->second.fileName); - - const MatchExtension match(i->second); - bool bRemoved = false; - if (::std::find_if(tempEntries.begin(), tempEntries.end(), match) == - tempEntries.end()) - { - //The the URL from the data base entry does not exist anymore. That is the - //folder was removed. - bRemoved = true; - } - else + try { + //Get the URL to the extensions folder, first make the url for the + //shared repository including the temporary name + OUString url = makeURL(m_activePackages, i->second.temporaryName); + if (bShared) + url = makeURLAppendSysPathSegment( url + OUSTR("_"), i->second.fileName); + + bool bRemoved = false; + //Check if the URL to the extension is still the same + ::ucbhelper::Content contentExtension; + + if (!create_ucb_content( + &contentExtension, url, + Reference(), false)) + { + bRemoved = true; + } + //The folder is in the extension database, but it can still be deleted. //look for the xxx.tmpremoved file - if (bShared) + //There can also be the case that a different extension was installed + //in a "temp" folder with name that is already used. + if (!bRemoved && bShared) { ::ucbhelper::Content contentRemoved; + if (create_ucb_content( &contentRemoved, m_activePackages_expanded + OUSTR("/") + @@ -1342,6 +1302,7 @@ void PackageManagerImpl::synchronizeRemovedExtensions( bRemoved = true; } } + if (!bRemoved) { //There may be another extensions at the same place @@ -1353,26 +1314,32 @@ void PackageManagerImpl::synchronizeRemovedExtensions( if (infoset.hasDescription() && infoset.getIdentifier() && (! i->first.equals(*(infoset.getIdentifier())) - || ! i->second.version.equals(infoset.getVersion()))) + || ! i->second.version.equals(infoset.getVersion()))) { bRemoved = true; } + + } + if (bRemoved) + { + Reference xPackage = m_xRegistry->bindPackage( + url, i->second.mediaType, true, i->first, xCmdEnv ); + OSL_ASSERT(xPackage.is()); //Even if the files are removed, we must get the object. + xPackage->revokePackage(xAbortChannel, xCmdEnv); + removePackage(xPackage->getIdentifier().Value, xPackage->getName(), + xAbortChannel, xCmdEnv); } } - if (bRemoved) + catch( uno::Exception & ) { - Reference xPackage = m_xRegistry->bindPackage( - url, i->second.mediaType, true, i->first, xCmdEnv ); - OSL_ASSERT(xPackage.is()); //Even if the files are removed, we must get the object. - removedExtensions.push_back(xPackage); + OSL_ASSERT(0); } } - out_removedExtensions = ::comphelper::containerToSequence(removedExtensions); } + void PackageManagerImpl::synchronizeAddedExtensions( - Sequence > & out_addedExtensions, - Reference const & xAbortChannel, + Reference const & xAbortChannel, Reference const & xCmdEnv) { // clean up activation layer, scan for zombie temp dirs: @@ -1385,65 +1352,58 @@ void PackageManagerImpl::synchronizeAddedExtensions( Sequence( &StrTitle::get(), 1 ), ::ucbhelper::INCLUDE_FOLDERS_ONLY ) ); - - ::std::vector > addedExtensions; while (xResultSet->next()) { - OUString title( - Reference( - xResultSet, UNO_QUERY_THROW )->getString( - 1 /* Title */ ) ); - //The temporary folders of user and shared have an '_' at then end. - //But the name in ActivePackages.temporaryName is saved without. - OUString title2 = title; - bool bNotBundled = !m_context.equals(OUSTR("bundled")); - if (bNotBundled) + try { - OSL_ASSERT(title2[title2.getLength() -1] == '_'); - title2 = title2.copy(0, title2.getLength() -1); - } - OUString titleEncoded = ::rtl::Uri::encode( + OUString title( + Reference( + xResultSet, UNO_QUERY_THROW )->getString( + 1 /* Title */ ) ); + //The temporary folders of user and shared have an '_' at then end. + //But the name in ActivePackages.temporaryName is saved without. + OUString title2 = title; + bool bNotBundled = !m_context.equals(OUSTR("bundled")); + if (bNotBundled) + { + OSL_ASSERT(title2[title2.getLength() -1] == '_'); + title2 = title2.copy(0, title2.getLength() -1); + } + OUString titleEncoded = ::rtl::Uri::encode( title2, rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8); - const MatchTempDir match(titleEncoded); - if (::std::find_if( id2temp.begin(), id2temp.end(), match ) == - id2temp.end()) - { - - // The folder was not found in the data base, so it must be - // an added extension - OUString url(m_activePackages_expanded + OUSTR("/") + titleEncoded); - OUString sExtFolder; - if (bNotBundled) //that is, shared + const MatchTempDir match(titleEncoded); + if (::std::find_if( id2temp.begin(), id2temp.end(), match ) == + id2temp.end()) { - //Check if the extension was not "deleted" already which is indicated - //by a xxx.tmpremoved file - ::ucbhelper::Content contentRemoved; - if (create_ucb_content(&contentRemoved, url + OUSTR("removed"), - Reference(), false)) - continue; - sExtFolder = getExtensionFolder( - m_activePackages_expanded + + + // The folder was not found in the data base, so it must be + // an added extension + OUString url(m_activePackages_expanded + OUSTR("/") + titleEncoded); + OUString sExtFolder; + if (bNotBundled) //that is, shared + { + //Check if the extension was not "deleted" already which is indicated + //by a xxx.tmpremoved file + ::ucbhelper::Content contentRemoved; + if (create_ucb_content(&contentRemoved, url + OUSTR("removed"), + Reference(), false)) + continue; + sExtFolder = getExtensionFolder( + m_activePackages_expanded + OUString(OUSTR("/")) + titleEncoded + OUSTR("_"), xCmdEnv); - url = appendURLSegement(m_activePackages_expanded, title); - url = appendURLSegement(url, sExtFolder); - } - Reference xPackage = m_xRegistry->bindPackage( - url, OUString(), false, OUString(), xCmdEnv ); - if (xPackage.is()) - { - try + url = makeURLAppendSysPathSegment(m_activePackages_expanded, title); + url = makeURLAppendSysPathSegment(url, sExtFolder); + } + Reference xPackage = m_xRegistry->bindPackage( + url, OUString(), false, OUString(), xCmdEnv ); + if (xPackage.is()) { - //ToDo: We need to prevent that removed shared extensions are - //added again. This can happen if there is still the folder of the - //extension. However, there is the "removed" flag file which indicates - //that the extension was removed. //Prepare the database entry ActivePackages::Data dbData; - //There is no temporary folder for bundled extensions. It is therefore - //an empty string. + dbData.temporaryName = titleEncoded; if (bNotBundled) dbData.fileName = sExtFolder; @@ -1456,35 +1416,45 @@ void PackageManagerImpl::synchronizeAddedExtensions( "an identifier and a version"); OUString id = dp_misc::getIdentifier( xPackage ); - sal_Bool bAlreadyInstalled = sal_False; - if (xPackage->checkPrerequisites( - xAbortChannel, xCmdEnv, bAlreadyInstalled, m_context)) - { - const ::osl::MutexGuard guard( getMutex() ); - //access to the database must be guarded. See removePackage_ - insertToActivationLayerDB(id, dbData); - } - else - { - //ToDo: Remember that this failed. For example, the user - //could have declined the license. Then the next time the - //extension folder is investigated we do not want to - //try to install the extension again. - } - addedExtensions.push_back(xPackage); - } - catch (...) - { + + //We provide a special command environment that will prevent + //showing a license if simple-licens/@accept-by = "admin" + //It will also prevent showing the license for bundled extensions + //which is not supported. + OSL_ASSERT(!m_context.equals(OUSTR("user"))); + + // shall the license be suppressed? + DescriptionInfoset info = + dp_misc::getDescriptionInfoset(url); + ::boost::optional + attr = info.getSimpleLicenseAttributes(); + ExtensionProperties props(url,xCmdEnv); + bool bNoLicense = false; + if (attr && attr->suppressIfRequired && props.isSuppressedLicense()) + bNoLicense = true; + + Reference licCmdEnv( + new LicenseCommandEnv(xCmdEnv->getInteractionHandler(), + bNoLicense, m_context)); + sal_Int32 failedPrereq = xPackage->checkPrerequisites( + xAbortChannel, licCmdEnv, false); + //Remember that this failed. For example, the user + //could have declined the license. Then the next time the + //extension folder is investigated we do not want to + //try to install the extension again. + dbData.failedPrerequisites = OUString::valueOf(failedPrereq); + insertToActivationLayerDB(id, dbData); } } } + catch (uno::Exception &) + { + OSL_ASSERT(0); + } } - out_addedExtensions = ::comphelper::containerToSequence(addedExtensions); } void PackageManagerImpl::synchronize( - Sequence > & out_addedExtensions, - Sequence > & out_removedExtensions, Reference const & xAbortChannel, Reference const & xCmdEnv) throw (css::deployment::DeploymentException, @@ -1496,12 +1466,129 @@ void PackageManagerImpl::synchronize( check(); if (m_context.equals(OUSTR("user"))) return; - synchronizeRemovedExtensions( - out_removedExtensions, xAbortChannel, xCmdEnv); - synchronizeAddedExtensions( - out_addedExtensions, xAbortChannel, xCmdEnv); + synchronizeRemovedExtensions(xAbortChannel, xCmdEnv); + synchronizeAddedExtensions(xAbortChannel, xCmdEnv); +} + +Sequence< Reference > PackageManagerImpl::getExtensionsWithUnacceptedLicenses( + Reference const & xCmdEnv) + throw (deployment::DeploymentException, RuntimeException) +{ + try + { + const ::osl::MutexGuard guard( getMutex() ); + // clean up activation layer, scan for zombie temp dirs: + ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() ); + + ActivePackages::Entries::const_iterator i = id2temp.begin(); + bool bShared = m_context.equals(OUSTR("shared")); + ::std::vector > vec; + + + for (; i != id2temp.end(); i++ ) + { + //Get the database entry + ActivePackages::Data const & dbData = i->second; + sal_Int32 failedPrereq = dbData.failedPrerequisites.toInt32(); + //If the installation failed for other reason then the license then we + //ignore it. + if (failedPrereq ^= deployment::Prerequisites::LICENSE) + continue; + + //Prepare the URL to the extension + OUString url = makeURL(m_activePackages, i->second.temporaryName); + if (bShared) + url = makeURLAppendSysPathSegment( url + OUSTR("_"), i->second.fileName); + + Reference p = m_xRegistry->bindPackage( + url, OUString(), false, OUString(), xCmdEnv ); + + if (p.is()) + vec.push_back(p); + + } + return ::comphelper::containerToSequence(vec); + } + catch (deployment::DeploymentException &) + { + throw; + } + catch (RuntimeException&) + { + throw; + } + catch (...) + { + Any exc = ::cppu::getCaughtException(); + deployment::DeploymentException de( + OUSTR("PackageManagerImpl::getExtensionsWithUnacceptedLicenses"), + static_cast(this), exc); + exc <<= de; + ::cppu::throwException(exc); + } } +sal_Int32 PackageManagerImpl::checkPrerequisites( + css::uno::Reference const & extension, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException) +{ + try + { + if (!extension.is()) + return 0; + if (!m_context.equals(extension->getRepositoryName())) + throw lang::IllegalArgumentException( + OUSTR("PackageManagerImpl::checkPrerequisites: extension is not" + " from this repository."), 0, 0); + + ActivePackages::Data dbData; + OUString id = dp_misc::getIdentifier(extension); + if (m_activePackagesDB->get( &dbData, id, OUString())) + { + //If the license was already displayed, then do not show it again + Reference _xCmdEnv = xCmdEnv; + sal_Int32 prereq = dbData.failedPrerequisites.toInt32(); + if ( !(prereq & deployment::Prerequisites::LICENSE)) + _xCmdEnv = new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler()); + + sal_Int32 failedPrereq = extension->checkPrerequisites( + xAbortChannel, _xCmdEnv, false); + dbData.failedPrerequisites = OUString::valueOf(failedPrereq); + insertToActivationLayerDB(id, dbData); + } + else + { + throw lang::IllegalArgumentException( + OUSTR("PackageManagerImpl::checkPrerequisites: unknown extension"), + 0, 0); + + } + return 0; + } + catch (deployment::DeploymentException& ) { + throw; + } catch (ucb::CommandFailedException & ) { + throw; + } catch (ucb::CommandAbortedException & ) { + throw; + } catch (lang::IllegalArgumentException &) { + throw; + } catch (uno::RuntimeException &) { + throw; + } catch (...) { + uno::Any excOccurred = ::cppu::getCaughtException(); + deployment::DeploymentException exc( + OUSTR("PackageManagerImpl::checkPrerequisites: exception "), + static_cast(this), excOccurred); + throw exc; + } +} //############################################################################## diff --git a/desktop/source/deployment/manager/dp_manager.h b/desktop/source/deployment/manager/dp_manager.h index 1249fe7e29d4..2e13c56ae968 100644 --- a/desktop/source/deployment/manager/dp_manager.h +++ b/desktop/source/deployment/manager/dp_manager.h @@ -75,6 +75,7 @@ class PackageManagerImpl : private ::dp_misc::MutexHolder, public t_pm_helper ::rtl::OUString detectMediaType( ::ucbhelper::Content const & ucbContent, bool throw_exc = true ); ::rtl::OUString insertToActivationLayer( + css::uno::Sequence const & properties, ::rtl::OUString const & mediaType, ::ucbhelper::Content const & sourceContent, ::rtl::OUString const & title, ActivePackages::Data * dbData ); @@ -89,14 +90,10 @@ class PackageManagerImpl : private ::dp_misc::MutexHolder, public t_pm_helper css::uno::Reference const & package); void synchronizeRemovedExtensions( - css::uno::Sequence > & - out_removedExtensions, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv); void synchronizeAddedExtensions( - css::uno::Sequence > & - out_AddedExtensions, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv); @@ -177,7 +174,9 @@ public: createAbortChannel() throw (css::uno::RuntimeException); virtual css::uno::Reference SAL_CALL addPackage( - ::rtl::OUString const & url, ::rtl::OUString const & mediaType, + ::rtl::OUString const & url, + css::uno::Sequence const & properties, + ::rtl::OUString const & mediaType, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ) throw (css::deployment::DeploymentException, @@ -248,8 +247,6 @@ public: throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL synchronize( - css::uno::Sequence > & out_xAddedExtensions, - css::uno::Sequence > & out_xRemovedExtensions, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ) throw (css::deployment::DeploymentException, @@ -257,7 +254,22 @@ public: css::ucb::CommandAbortedException, css::uno::RuntimeException); -}; + virtual css::uno::Sequence > SAL_CALL + getExtensionsWithUnacceptedLicenses( + css::uno::Reference const & xCmdEnv) + throw (css::deployment::DeploymentException, + css::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL checkPrerequisites( + css::uno::Reference const & extension, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + }; //______________________________________________________________________________ inline void PackageManagerImpl::check() diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx new file mode 100644 index 000000000000..b04e8131ee15 --- /dev/null +++ b/desktop/source/deployment/manager/dp_properties.cxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "com/sun/star/ucb/XCommandEnvironment.hpp" +#include "com/sun/star/lang/IllegalArgumentException.hpp" +#include "xmlscript/xml_helper.hxx" +#include "ucbhelper/content.hxx" +#include + +#include "dp_ucb.h" +#include "rtl/ustrbuf.hxx" +#include "dp_properties.hxx" + +namespace lang = com::sun::star::lang; +namespace task = com::sun::star::task; +namespace ucb = com::sun::star::ucb; +namespace uno = com::sun::star::uno; +namespace css = com::sun::star; + +#define OUSTR(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) + +using ::com::sun::star::uno::Reference; +using ::rtl::OUString; + +#define PROP_SUPPRESS_LICENSE "SUPPRESS_LICENSE" +namespace dp_manager { + +//Reading the file +ExtensionProperties::ExtensionProperties( + OUString const & urlExtension, + Reference const & xCmdEnv) : + m_xCmdEnv(xCmdEnv) +{ + m_propFileUrl = urlExtension + OUSTR("properties"); + + ::std::list< ::std::pair< OUString, OUString> > props; + if (! dp_misc::create_ucb_content(NULL, m_propFileUrl, 0, false)) + return; + + ::ucbhelper::Content contentProps(m_propFileUrl, m_xCmdEnv); + dp_misc::readProperties(props, contentProps); + + typedef ::std::list< ::std::pair< OUString, OUString> >::const_iterator CI; + for (CI i = props.begin(); i != props.end(); i++) + { + if (i->first.equals(OUSTR(PROP_SUPPRESS_LICENSE))) + m_prop_suppress_license = i->second; + } +} + +//Writing the file +ExtensionProperties::ExtensionProperties( + OUString const & urlExtension, + uno::Sequence const & properties, + Reference const & xCmdEnv) : + m_xCmdEnv(xCmdEnv) +{ + m_propFileUrl = urlExtension + OUSTR("properties"); + + for (sal_Int32 i = 0; i < properties.getLength(); i++) + { + css::beans::NamedValue const & v = properties[i]; + if (v.Name.equals(OUSTR(PROP_SUPPRESS_LICENSE))) + { + OUString value; + if (v.Value >>= value) + { + if (value.equals(OUSTR("1"))) + m_prop_suppress_license = OUSTR("1"); + } + else + { + throw lang::IllegalArgumentException( + OUSTR("Extension Manager: wrong property value"), 0, -1); + } + } + else + { + throw lang::IllegalArgumentException( + OUSTR("Extension Manager: unknown property"), 0, -1); + } + } +} + +void ExtensionProperties::write() +{ + ::ucbhelper::Content contentProps(m_propFileUrl, m_xCmdEnv); + ::rtl::OUStringBuffer buf; + + if (m_prop_suppress_license) + { + buf.append(OUSTR(PROP_SUPPRESS_LICENSE)); + buf.append(OUSTR("=")); + buf.append(*m_prop_suppress_license); + } + + ::rtl::OString stamp = ::rtl::OUStringToOString( + buf.makeStringAndClear(), RTL_TEXTENCODING_UTF8); + Reference xData( + ::xmlscript::createInputStream( + ::rtl::ByteSequence( + reinterpret_cast(stamp.getStr()), + stamp.getLength() ) ) ); + contentProps.writeStream( xData, true /* replace existing */ ); +} + +bool ExtensionProperties::isSuppressedLicense() +{ + bool ret = false; + if (m_prop_suppress_license) + { + if (m_prop_suppress_license->equals(OUSTR("1"))) + ret = true; + } + return ret; +} + +} // namespace dp_manager + + diff --git a/desktop/source/deployment/manager/dp_properties.hxx b/desktop/source/deployment/manager/dp_properties.hxx new file mode 100644 index 000000000000..197155653de1 --- /dev/null +++ b/desktop/source/deployment/manager/dp_properties.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dp_manager.h,v $ + * $Revision: 1.17 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_DP_PROPERTIES_HXX +#define INCLUDED_DP_PROPERTIES_HXX + + + +#include "com/sun/star/beans/NamedValue.hpp" +#include "com/sun/star/ucb/XCommandEnvironment.hpp" +#include "boost/optional.hpp" + + +namespace css = ::com::sun::star; + +namespace dp_manager { + + + +/** + + */ +class ExtensionProperties +{ +protected: + ::rtl::OUString m_propFileUrl; + const css::uno::Reference m_xCmdEnv; + ::boost::optional< ::rtl::OUString> m_prop_suppress_license; +public: + + virtual ~ExtensionProperties() {}; + ExtensionProperties(::rtl::OUString const & urlExtension, + css::uno::Reference const & xCmdEnv); + + ExtensionProperties(::rtl::OUString const & urlExtension, + css::uno::Sequence const & properties, + css::uno::Reference const & xCmdEnv); + + void write(); + + bool isSuppressedLicense(); +}; +} + + + + +#endif + diff --git a/desktop/source/deployment/manager/dp_tmprepocmdenv.cxx b/desktop/source/deployment/manager/dp_tmprepocmdenv.cxx deleted file mode 100644 index 3a4a6f1d2b72..000000000000 --- a/desktop/source/deployment/manager/dp_tmprepocmdenv.cxx +++ /dev/null @@ -1,166 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_desktop.hxx" - -#include "com/sun/star/deployment/VersionException.hpp" -#include "com/sun/star/deployment/LicenseIndividualAgreementException.hpp" -#include "com/sun/star/deployment/LicenseException.hpp" -#include "com/sun/star/deployment/InstallException.hpp" -#include "com/sun/star/task/XInteractionApprove.hpp" -#include "com/sun/star/task/XInteractionAbort.hpp" -#include "com/sun/star/ucb/XCommandEnvironment.hpp" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "dp_tmprepocmdenv.hxx" - -namespace deployment = com::sun::star::deployment; -namespace lang = com::sun::star::lang; -namespace task = com::sun::star::task; -namespace ucb = com::sun::star::ucb; -namespace uno = com::sun::star::uno; -namespace css = com::sun::star; - -#define OUSTR(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -using ::com::sun::star::uno::Reference; -using ::rtl::OUString; - -namespace dp_manager { - -TmpRepositoryCommandEnv::TmpRepositoryCommandEnv() -{ -} - -TmpRepositoryCommandEnv::TmpRepositoryCommandEnv( - Reference< css::task::XInteractionHandler> const & handler) - : m_forwardHandler(handler) -{ -} - -TmpRepositoryCommandEnv::~TmpRepositoryCommandEnv() -{ -} -// XCommandEnvironment -//______________________________________________________________________________ -Reference TmpRepositoryCommandEnv::getInteractionHandler() -throw (uno::RuntimeException) -{ - return this; -} - -//______________________________________________________________________________ -Reference TmpRepositoryCommandEnv::getProgressHandler() -throw (uno::RuntimeException) -{ - return this; -} - -// XInteractionHandler -void TmpRepositoryCommandEnv::handle( - Reference< task::XInteractionRequest> const & xRequest ) - throw (uno::RuntimeException) -{ - uno::Any request( xRequest->getRequest() ); - OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); - - deployment::VersionException verExc; - deployment::LicenseException licExc; - deployment::InstallException instExc; - deployment::LicenseIndividualAgreementException licAgreementExc; - - - bool approve = false; - bool abort = false; - - if ((request >>= verExc) - || (request >>= licExc) - || (request >>= instExc) - || (request >>= licAgreementExc)) - { - approve = true; - } - - if (approve == false && abort == false) - { - if (m_forwardHandler.is()) - m_forwardHandler->handle(xRequest); - else - approve = true; - } - else - { - // select: - uno::Sequence< Reference< task::XInteractionContinuation > > conts( - xRequest->getContinuations() ); - Reference< task::XInteractionContinuation > const * pConts = - conts.getConstArray(); - sal_Int32 len = conts.getLength(); - for ( sal_Int32 pos = 0; pos < len; ++pos ) - { - if (approve) { - Reference< task::XInteractionApprove > xInteractionApprove( - pConts[ pos ], uno::UNO_QUERY ); - if (xInteractionApprove.is()) { - xInteractionApprove->select(); - // don't query again for ongoing continuations: - approve = false; - } - } - else if (abort) { - Reference< task::XInteractionAbort > xInteractionAbort( - pConts[ pos ], uno::UNO_QUERY ); - if (xInteractionAbort.is()) { - xInteractionAbort->select(); - // don't query again for ongoing continuations: - abort = false; - } - } - } - } -} - -// XProgressHandler -void TmpRepositoryCommandEnv::push( uno::Any const & /*Status*/ ) -throw (uno::RuntimeException) -{ -} - - -void TmpRepositoryCommandEnv::update( uno::Any const & /*Status */) -throw (uno::RuntimeException) -{ -} - -void TmpRepositoryCommandEnv::pop() throw (uno::RuntimeException) -{ -} - - -} // namespace dp_manager - - diff --git a/desktop/source/deployment/manager/dp_tmprepocmdenv.hxx b/desktop/source/deployment/manager/dp_tmprepocmdenv.hxx deleted file mode 100644 index 22111bc1e081..000000000000 --- a/desktop/source/deployment/manager/dp_tmprepocmdenv.hxx +++ /dev/null @@ -1,84 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if ! defined INCLUDED_DP_TMPREPOSITORYCOMMANDENVIRONMENT_HXX -#define INCLUDED_DP_TMPREPOSITORYCOMMANDENVIRONMENT_HXX - - -#include "cppuhelper/compbase3.hxx" -//#include "cppuhelper/implbase2.hxx" -#include "ucbhelper/content.hxx" - - - -namespace css = ::com::sun::star; - -namespace dp_manager { - -/** - This command environment is to be used when an extension is temporarily - stored in the "tmp" repository. It prevents all kind of user interaction. - */ -class TmpRepositoryCommandEnv - : public ::cppu::WeakImplHelper3< css::ucb::XCommandEnvironment, - css::task::XInteractionHandler, - css::ucb::XProgressHandler > -{ - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::task::XInteractionHandler> m_forwardHandler; -public: - virtual ~TmpRepositoryCommandEnv(); - TmpRepositoryCommandEnv(); - TmpRepositoryCommandEnv( - css::uno::Reference< css::task::XInteractionHandler> const & handler); - - // XCommandEnvironment - virtual css::uno::Reference SAL_CALL - getInteractionHandler() throw (css::uno::RuntimeException); - virtual css::uno::Reference - SAL_CALL getProgressHandler() throw (css::uno::RuntimeException); - - // XInteractionHandler - virtual void SAL_CALL handle( - css::uno::Reference const & xRequest ) - throw (css::uno::RuntimeException); - - // XProgressHandler - virtual void SAL_CALL push( css::uno::Any const & Status ) - throw (css::uno::RuntimeException); - virtual void SAL_CALL update( css::uno::Any const & Status ) - throw (css::uno::RuntimeException); - virtual void SAL_CALL pop() throw (css::uno::RuntimeException); -}; - -} - - - - -#endif - diff --git a/desktop/source/deployment/manager/makefile.mk b/desktop/source/deployment/manager/makefile.mk index cb99325bde52..4dc6405e34bf 100644 --- a/desktop/source/deployment/manager/makefile.mk +++ b/desktop/source/deployment/manager/makefile.mk @@ -47,7 +47,8 @@ SLOFILES = \ $(SLO)$/dp_managerfac.obj \ $(SLO)$/dp_informationprovider.obj \ $(SLO)$/dp_extensionmanager.obj \ - $(SLO)$/dp_tmprepocmdenv.obj + $(SLO)$/dp_commandenvironments.obj \ + $(SLO)$/dp_properties.obj .INCLUDE : ..$/target.pmk .INCLUDE : target.mk diff --git a/desktop/source/deployment/migration/dp_migration.cxx b/desktop/source/deployment/migration/dp_migration.cxx index 49362f7e2f5f..c2d0b0dc6bb8 100644 --- a/desktop/source/deployment/migration/dp_migration.cxx +++ b/desktop/source/deployment/migration/dp_migration.cxx @@ -136,7 +136,7 @@ Any MigrationImpl::execute( Sequence const & ) ->queryContentIdentifierString() ); try { xManager->addPackage( - sourceURL, OUString() /* detect media-type */, + sourceURL, uno::Sequence(),OUString() /* detect media-type */, Reference(), xCmdEnv ); } catch (RuntimeException &) { diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 1f1fde7ca7bf..919f134b3fb9 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -44,8 +44,10 @@ #include "com/sun/star/ucb/CommandAbortedException.hpp" #include "com/sun/star/bridge/UnoUrlResolver.hpp" #include "com/sun/star/bridge/XUnoUrlResolver.hpp" +#include "com/sun/star/deployment/ExtensionManager.hpp" #include "boost/scoped_array.hpp" #include "boost/shared_ptr.hpp" +#include #ifdef WNT //#include "tools/prewin.h" @@ -138,6 +140,103 @@ bool existsOfficePipe() return pipe.is(); } + +//Returns true if the Folder was more recently modified then +//the lastsynchronized file. That is the repository needs to +//be synchronized. +bool compareExtensionFolderWithLastSynchronizedFile( + OUString const & folderURL, OUString const & fileURL) +{ + bool bNeedsSync = false; + ::osl::DirectoryItem itemExtFolder; + ::osl::File::RC err1 = + ::osl::DirectoryItem::get(folderURL, itemExtFolder); + //If it does not exist, then there is nothing to be done + if (err1 == ::osl::File::E_NOENT) + { + return false; + } + else if (err1 != ::osl::File::E_None) + { + OSL_ENSURE(0, "Cannot access extension folder"); + return true; //sync just in case + } + + //If last synchronized does not exist, then OOo is started for the first time + ::osl::DirectoryItem itemFile; + ::osl::File::RC err2 = ::osl::DirectoryItem::get(fileURL, itemFile); + if (err2 == ::osl::File::E_NOENT) + { + return true; + + } + else if (err2 != ::osl::File::E_None) + { + OSL_ENSURE(0, "Cannot access file lastsynchronized"); + return true; //sync just in case + } + + //compare the modification time of the extension folder and the last + //modified file + ::osl::FileStatus statFolder(FileStatusMask_ModifyTime); + ::osl::FileStatus statFile(FileStatusMask_ModifyTime); + if (itemExtFolder.getFileStatus(statFolder) == ::osl::File::E_None) + { + if (itemFile.getFileStatus(statFile) == ::osl::File::E_None) + { + TimeValue timeFolder = statFolder.getModifyTime(); + TimeValue timeFile = statFile.getModifyTime(); + + if (timeFile.Seconds < timeFolder.Seconds) + bNeedsSync = true; + } + else + { + OSL_ASSERT(0); + bNeedsSync = true; + } + } + else + { + OSL_ASSERT(0); + bNeedsSync = true; + } + return bNeedsSync; +} + +bool needToSyncRepostitory(OUString const & name) +{ + OUString folder; + OUString file; + if (name.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("bundled")))) + { + folder = OUString( + RTL_CONSTASCII_USTRINGPARAM("$BUNDLED_EXTENSIONS")); + file = OUString ( + RTL_CONSTASCII_USTRINGPARAM( + "$BUNDLED_EXTENSIONS_USER/lastsynchronized")); + } + else if (name.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("shared")))) + { + folder = OUString( + RTL_CONSTASCII_USTRINGPARAM( + "$UNO_SHARED_PACKAGES_CACHE/uno_packages")); + file = OUString ( + RTL_CONSTASCII_USTRINGPARAM( + "$SHARED_EXTENSIONS_USER/lastsynchronized")); + } + else + { + OSL_ASSERT(0); + return true; + } + ::rtl::Bootstrap::expandMacros(folder); + ::rtl::Bootstrap::expandMacros(file); + return compareExtensionFolderWithLastSynchronizedFile( + folder, file); +} + + } // anon namespace //============================================================================== @@ -480,22 +579,43 @@ void TRACE(::rtl::OString const & sText) #endif } -bool hasExtensionRepositoryChanged(::rtl::OUString const & repository) +void syncRepositories(Reference const & xCmdEnv) { - if (repository.equals(OUSTR("shared"))) + Reference xExtensionManager; + //synchronize shared before bundled otherewise there are + //more revoke and registration calls. + OUString sShared(RTL_CONSTASCII_USTRINGPARAM("shared")); + if (needToSyncRepostitory(sShared)) { - //get the extensions folder - OUString folder(RTL_CONSTASCII_USTRINGPARAM("BUNDLED_EXTENSIONS")); - ::rtl::Bootstrap::expandMacros(folder); + xExtensionManager = + deployment::ExtensionManager::get( + comphelper_getProcessComponentContext()); + + if (xExtensionManager.is()) + { + xExtensionManager->synchronize( + sShared, Reference(), xCmdEnv); + } } - else if (repository.equals(OUSTR("bundled"))) + + OUString sBundled(RTL_CONSTASCII_USTRINGPARAM("bundled")); + if (needToSyncRepostitory( sBundled)) { - } - else - throw lang::IllegalArgumentException( - OUSTR("Invalid repository name."), 0, 0); + if (!xExtensionManager.is()) + { + xExtensionManager = + deployment::ExtensionManager::get( + comphelper_getProcessComponentContext()); + } + if (xExtensionManager.is()) + { + xExtensionManager->synchronize( + sBundled, Reference(), xCmdEnv); - return false; + } + } } + + } diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx index 571aef9c1b95..795a492aa0d5 100644 --- a/desktop/source/deployment/misc/dp_ucb.cxx +++ b/desktop/source/deployment/misc/dp_ucb.cxx @@ -271,4 +271,50 @@ bool readLine( OUString * res, OUString const & startingWith, return false; } +bool readProperties( ::std::list< ::std::pair< ::rtl::OUString, ::rtl::OUString> > & out_result, + ::ucbhelper::Content & ucb_content ) +{ + // read whole file: + ::rtl::ByteSequence bytes( readFile( ucb_content ) ); + OUString file( reinterpret_cast(bytes.getConstArray()), + bytes.getLength(), RTL_TEXTENCODING_UTF8); + sal_Int32 pos = 0; + + for (;;) + { + + ::rtl::OUStringBuffer buf; + sal_Int32 start = pos; + + bool bEOF = false; + pos = file.indexOf( LF, pos ); + if (pos < 0) { // EOF + buf.append( file.copy( start ) ); + bEOF = true; + } + else + { + if (pos > 0 && file[ pos - 1 ] == CR) + // consume extra CR + buf.append( file.copy( start, pos - start - 1 ) ); + else + buf.append( file.copy( start, pos - start ) ); + pos++; + } + OUString aLine = buf.makeStringAndClear(); + + sal_Int32 posEqual = aLine.indexOf('='); + if (posEqual > 0 && (posEqual + 1) < aLine.getLength()) + { + OUString name = aLine.copy(0, posEqual); + OUString value = aLine.copy(posEqual + 1); + out_result.push_back(::std::make_pair(name, value)); + } + + if (bEOF) + break; + } + return false; +} + } diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 667f1588e247..17444eb0828e 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -157,7 +157,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, - OUString const & loader, bool bRemoved, OUString const & identifier); + OUString const & loader, bool bRemoved, + OUString const & identifier); }; friend class ComponentPackageImpl; @@ -186,7 +187,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, - bool jarFile, bool bRemoved, OUString const & identifier); + bool jarFile, bool bRemoved, + OUString const & identifier); }; friend class TypelibraryPackageImpl; @@ -207,7 +209,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, - sal_Bool bNoFileAccess, OUString const & identifier, + sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ); virtual void SAL_CALL disposing(); @@ -283,7 +285,8 @@ BackendImpl::ComponentPackageImpl::ComponentPackageImpl( ::rtl::Reference const & myBackend, OUString const & url, OUString const & name, Reference const & xPackageType, - OUString const & loader, bool bRemoved, OUString const & identifier) + OUString const & loader, bool bRemoved, + OUString const & identifier) : Package( myBackend, url, name, name /* display-name */, xPackageType, bRemoved, identifier), m_loader( loader ), diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 354676fd56ff..fefa6794342a 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -114,7 +114,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend // PackageRegistryBackend virtual Reference bindPackage_( OUString const & url, OUString const & mediaType, sal_Bool bRemoved, - OUString const & identifier, Reference const & xCmdEnv ); + OUString const & identifier, + Reference const & xCmdEnv ); ::std::auto_ptr m_registeredPackages; // for backwards compatibility diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index be752bcf0733..1cebd20c297a 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -31,6 +31,7 @@ #include "dp_backend.h" #include "dp_ucb.h" #include "rtl/uri.hxx" +#include "rtl/bootstrap.hxx" #include "osl/file.hxx" #include "cppuhelper/exc_hlp.hxx" #include "comphelper/servicedecl.hxx" @@ -170,7 +171,8 @@ Reference PackageRegistryBackend::bindPackage( Reference xNewPackage; try { - xNewPackage = bindPackage_( url, mediaType, bRemoved, identifier, xCmdEnv ); + xNewPackage = bindPackage_( url, mediaType, bRemoved, + identifier, xCmdEnv ); } catch (RuntimeException &) { throw; @@ -318,6 +320,16 @@ Package::Package( ::rtl::Reference const & myBackend, m_bRemoved(bRemoved), m_identifier(identifier) { + if (m_bRemoved) + { + //We use the last segment of the URL + OSL_ASSERT(m_name.getLength() == 0); + OUString name = m_url; + rtl::Bootstrap::expandMacros(name); + sal_Int32 index = name.lastIndexOf('/'); + if (index != -1 && index < name.getLength()) + m_name = name.copy(index + 1); + } } //______________________________________________________________________________ @@ -407,10 +419,10 @@ sal_Bool Package::isBundle() throw (RuntimeException) } //______________________________________________________________________________ -::sal_Bool Package::checkPrerequisites( +::sal_Int32 Package::checkPrerequisites( const css::uno::Reference< css::task::XAbortChannel >&, const css::uno::Reference< css::ucb::XCommandEnvironment >&, - sal_Bool, ::rtl::OUString const &) + sal_Bool) throw (css::deployment::DeploymentException, css::deployment::ExtensionRemovedException, css::ucb::CommandFailedException, @@ -419,7 +431,7 @@ sal_Bool Package::isBundle() throw (RuntimeException) { if (m_bRemoved) throw deployment::ExtensionRemovedException(); - return true; + return 0; } //______________________________________________________________________________ diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index e35b37bdeb07..c5e440a2a825 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -127,7 +127,7 @@ public: // XPackageRegistry virtual Reference SAL_CALL bindPackage( - OUString const & url, OUString const & mediaType, sal_Bool bNoFileAccess, + OUString const & url, OUString const & mediaType, sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ) throw (deployment::DeploymentException, CommandFailedException, lang::IllegalArgumentException, RuntimeException); @@ -498,7 +498,8 @@ Reference PackageRegistryImpl::bindPackage( for ( ; iPos != iEnd; ++iPos ) { try { - return (*iPos)->bindPackage( url, mediaType, bRemoved, identifier, xCmdEnv ); + return (*iPos)->bindPackage( url, mediaType, bRemoved, + identifier, xCmdEnv ); } catch (lang::IllegalArgumentException &) { } @@ -527,7 +528,8 @@ Reference PackageRegistryImpl::bindPackage( getResourceString(RID_STR_UNSUPPORTED_MEDIA_TYPE) + mediaType, static_cast(this), static_cast(-1) ); } - return iFind->second->bindPackage( url, mediaType, bRemoved, identifier, xCmdEnv ); + return iFind->second->bindPackage( url, mediaType, bRemoved, + identifier, xCmdEnv ); } } diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx index 39fd3cdc892e..1dc4cdde64ea 100644 --- a/desktop/source/deployment/registry/executable/dp_executable.cxx +++ b/desktop/source/deployment/registry/executable/dp_executable.cxx @@ -152,7 +152,8 @@ Reference BackendImpl::bindPackage_( if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.executable")) { return new BackendImpl::ExecutablePackageImpl( - this, url, name, m_xExecutableTypeInfo, bRemoved, identifier); + this, url, name, m_xExecutableTypeInfo, bRemoved, + identifier); } } } diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index aeeec94981e6..a523a1aa20a5 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -102,10 +102,6 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference const & xCmdEnv); void implCollectXhpFiles( const rtl::OUString& aDir, std::vector< rtl::OUString >& o_rXhpFileVector ); -// rtl::OUString getFlagFileURL( Reference< deployment::XPackage > xPackage, const char* pFlagStr ); -// rtl::OUString getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage ); -// rtl::OUString getCompiledFlagFileURL( Reference< deployment::XPackage > xPackage ); -// rtl::OUString expandURL( const rtl::OUString& aURL ); void addDataToDb(OUString const & url, HelpBackendDb::Data const & data); ::boost::optional readDataFromDb(OUString const & url); @@ -195,7 +191,8 @@ Reference BackendImpl::bindPackage_( "vnd.sun.star.help")) { return new PackageImpl( - this, url, name, m_xHelpTypeInfo, bRemoved, identifier); + this, url, name, m_xHelpTypeInfo, bRemoved, + identifier); } } } @@ -233,7 +230,8 @@ BackendImpl::PackageImpl::PackageImpl( OUString const & url, OUString const & name, Reference const & xPackageType, bool bRemoved, OUString const & identifier) - : Package( myBackend, url, name, name, xPackageType, bRemoved, identifier) + : Package( myBackend, url, name, name, xPackageType, bRemoved, + identifier) { if (bRemoved) { @@ -290,13 +288,6 @@ void BackendImpl::PackageImpl::processPackage_( BackendImpl* that = getMyBackend(); Reference< deployment::XPackage > xThisPackage( this ); that->implProcessHelp( xThisPackage, doRegisterPackage, xCmdEnv); - -// HelpBackendDb::Data data; -// getMyBackend()->addDataToDb(getURL(), data); - -// } -// else -// getMyBackend()->deleteDataFromDb(getURL()); } beans::Optional< OUString > BackendImpl::PackageImpl::getRegistrationDataURL() @@ -373,23 +364,6 @@ void BackendImpl::implProcessHelp { std::vector< rtl::OUString > aXhpFileVector; - // Delete (old) files in any case to allow compiler to be started every time -// rtl::OUString aLangWithPureNameURL( aLangURL ); -// aLangWithPureNameURL += aSlash; -// aLangWithPureNameURL += aHelpStr; -// rtl::OUString aDbFile( aLangWithPureNameURL ); -// aDbFile += rtl::OUString::createFromAscii( ".db" ); -// if( xSFA->exists( aDbFile ) ) -// xSFA->kill( aDbFile ); -// rtl::OUString aHtFile( aLangWithPureNameURL ); -// aHtFile += rtl::OUString::createFromAscii( ".ht" ); -// if( xSFA->exists( aHtFile ) ) -// xSFA->kill( aHtFile ); -// rtl::OUString aKeyFile( aLangWithPureNameURL ); -// aKeyFile += rtl::OUString::createFromAscii( ".key" ); -// if( xSFA->exists( aKeyFile ) ) -// xSFA->kill( aKeyFile ); - // calculate jar file URL sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/'); // for example "/en" @@ -408,12 +382,6 @@ void BackendImpl::implProcessHelp rtl::OUString aJarFile( makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr + OUSTR(".jar"))); -// aJarFile += aSlash; -// aJarFile += aHelpStr; -// aJarFile += rtl::OUString::createFromAscii( ".jar" ); - // remove in any case to clean up -// if( xSFA->exists( aJarFile ) ) -// xSFA->kill( aJarFile ); aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile); rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( @@ -443,8 +411,6 @@ void BackendImpl::implProcessHelp aDestPath += aPureFolderName; xSFA->copy( aSubFolderURL, aDestPath ); } - //Copy help.tree to the temp folder in the help backend folder -// xSFA->copy(aLangURL + OUSTR("/help.tree"), langFolderDestExpanded + OUSTR("/help.tree")); // Call compiler sal_Int32 nXhpFileCount = aXhpFileVector.size(); @@ -485,7 +451,6 @@ void BackendImpl::implProcessHelp aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) ); rtl::OUString aSystemPath; -// osl::FileBase::getSystemPathFromFileURL( aLangURL, aSystemPath ); osl::FileBase::getSystemPathFromFileURL( langFolderDestExpanded, aSystemPath ); aParamsSeq[5] = uno::makeAny( aSystemPath ); @@ -562,75 +527,6 @@ void BackendImpl::implProcessHelp } } -// rtl::OUString BackendImpl::getFlagFileURL( Reference< deployment::XPackage > xPackage, const char* pFlagStr ) -// { -// rtl::OUString aRetURL; -// if( !xPackage.is() ) -// return aRetURL; -// rtl::OUString aHelpURL = xPackage->getURL(); -// aRetURL = expandURL( aHelpURL ); -// aRetURL += rtl::OUString::createFromAscii( pFlagStr ); -// return aRetURL; -// } - -// rtl::OUString BackendImpl::getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage ) -// { -// return getFlagFileURL( xPackage, "/RegisteredFlag" ); -// } - -// rtl::OUString BackendImpl::getCompiledFlagFileURL( Reference< deployment::XPackage > xPackage ) -// { -// return getFlagFileURL( xPackage, "/CompiledFlag" ); -// } - -// rtl::OUString BackendImpl::expandURL( const rtl::OUString& aURL ) -// { -// static Reference< util::XMacroExpander > xMacroExpander; -// static Reference< uri::XUriReferenceFactory > xFac; - -// if( !xMacroExpander.is() || !xFac.is() ) -// { -// Reference const & xContext = getComponentContext(); -// if( xContext.is() ) -// { -// xFac = Reference< uri::XUriReferenceFactory >( -// xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( -// "com.sun.star.uri.UriReferenceFactory"), xContext ) , UNO_QUERY ); -// } -// if( !xFac.is() ) -// { -// throw RuntimeException( -// ::rtl::OUString::createFromAscii( -// "dp_registry::backend::help::BackendImpl::expandURL(), " -// "could not instatiate UriReferenceFactory." ), -// Reference< XInterface >() ); -// } - -// xMacroExpander = Reference< util::XMacroExpander >( -// xContext->getValueByName( -// ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.util.theMacroExpander" ) ), -// UNO_QUERY_THROW ); -// } - -// rtl::OUString aRetURL = aURL; -// if( xMacroExpander.is() ) -// { -// Reference< uri::XUriReference > uriRef; -// for (;;) -// { -// uriRef = Reference< uri::XUriReference >( xFac->parse( aRetURL ), UNO_QUERY ); -// if ( uriRef.is() ) -// { -// Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY ); -// if( !sxUri.is() ) -// break; - -// aRetURL = sxUri->expand( xMacroExpander ); -// } -// } -// } -// return aRetURL; -// } void BackendImpl::implCollectXhpFiles( const rtl::OUString& aDir, std::vector< rtl::OUString >& o_rXhpFileVector ) diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 179420b16ef6..7ad55d29ba2f 100644 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -175,10 +175,10 @@ public: css::ucb::CommandAbortedException, css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL checkPrerequisites( + virtual ::sal_Int32 SAL_CALL checkPrerequisites( const css::uno::Reference< css::task::XAbortChannel >& xAbortChannel, const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv, - sal_Bool bInstalled, ::rtl::OUString const & aContextName) + sal_Bool noLicenseChecking) throw (css::deployment::DeploymentException, css::deployment::ExtensionRemovedException, css::ucb::CommandFailedException, diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 467ff5ca89fa..822e744b8fc2 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -64,8 +64,8 @@ #include "com/sun/star/packages/manifest/XManifestWriter.hpp" #include "com/sun/star/deployment/DependencyException.hpp" #include "com/sun/star/deployment/LicenseException.hpp" -#include "com/sun/star/deployment/LicenseIndividualAgreementException.hpp" #include "com/sun/star/deployment/PlatformException.hpp" +#include "com/sun/star/deployment/Prerequisites.hpp" #include "com/sun/star/xml/dom/XDocumentBuilder.hpp" #include "com/sun/star/xml/xpath/XXPathAPI.hpp" #include "com/sun/star/deployment/XPackageManager.hpp" @@ -139,8 +139,7 @@ class BackendImpl : public ImplBaseT ::sal_Bool checkLicense( Reference< ucb::XCommandEnvironment > const & xCmdEnv, - DescriptionInfoset const & description, bool bInstalled, - OUString const & aContextName ) + DescriptionInfoset const & description, bool bNoLicenseChecking) throw (deployment::DeploymentException, ucb::CommandFailedException, ucb::CommandAbortedException, @@ -199,10 +198,10 @@ class BackendImpl : public ImplBaseT ucb::CommandAbortedException, RuntimeException); - virtual ::sal_Bool SAL_CALL checkPrerequisites( + virtual ::sal_Int32 SAL_CALL checkPrerequisites( const Reference< task::XAbortChannel >& xAbortChannel, const Reference< ucb::XCommandEnvironment >& xCmdEnv, - ::sal_Bool bInstalled, OUString const & aContextName) + ::sal_Bool noLicenseChecking) throw (deployment::ExtensionRemovedException, deployment::DeploymentException, ucb::CommandFailedException, @@ -423,12 +422,14 @@ Reference BackendImpl::bindPackage_( } if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.package-bundle")) { return new PackageImpl( - this, url, name, m_xBundleTypeInfo, false, bRemoved, identifier); + this, url, name, m_xBundleTypeInfo, false, bRemoved, + identifier); } else if (subType.EqualsIgnoreCaseAscii( "vnd.sun.star.legacy-package-bundle")) { return new PackageImpl( - this, url, name, m_xLegacyBundleTypeInfo, true, bRemoved, identifier); + this, url, name, m_xLegacyBundleTypeInfo, true, bRemoved, + identifier); } } } @@ -652,7 +653,7 @@ bool BackendImpl::PackageImpl::checkDependencies( ::sal_Bool BackendImpl::PackageImpl::checkLicense( css::uno::Reference< css::ucb::XCommandEnvironment > const & xCmdEnv, - DescriptionInfoset const & info, bool bInstalled, OUString const & aContextName) + DescriptionInfoset const & info, bool alreadyInstalled) throw (css::deployment::DeploymentException, css::ucb::CommandFailedException, css::ucb::CommandAbortedException, @@ -679,41 +680,21 @@ bool BackendImpl::PackageImpl::checkDependencies( 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 unless suppress-if-required="true" - OSL_ASSERT(aContextName.getLength()); - if (simplLicAttr->acceptBy.equals(OUSTR("user")) && aContextName.equals(OUSTR("shared"))) - { - css::deployment::LicenseIndividualAgreementException - exc = css::deployment::LicenseIndividualAgreementException( - OUString(), 0, m_name, simplLicAttr->suppressIfRequired); - - bool approve = false; - bool abort = false; - if (! interactContinuation( - Any(exc), task::XInteractionApprove::static_type(), xCmdEnv, &approve, &abort )) - throw css::deployment::DeploymentException( - OUSTR("Could not interact with user."), 0, Any()); - if (abort == true) - return false; - - //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 | bSuppressOnUpdate | show license + // alreadyInstalled | bSuppressOnUpdate | show license //---------------------------------------- // 0 | 0 | 1 // 0 | 1 | 1 // 1 | 0 | 1 // 1 | 1 | 0 - if ( !(bInstalled && simplLicAttr->suppressOnUpdate)) + if ( !(alreadyInstalled && simplLicAttr->suppressOnUpdate)) { css::deployment::LicenseException licExc( - OUString(), 0, m_name, sLicense, simplLicAttr->suppressIfRequired); + OUString(), 0, getDisplayName(), sLicense, + simplLicAttr->acceptBy); bool approve = false; bool abort = false; if (! interactContinuation( @@ -745,10 +726,10 @@ bool BackendImpl::PackageImpl::checkDependencies( } } -::sal_Bool BackendImpl::PackageImpl::checkPrerequisites( +::sal_Int32 BackendImpl::PackageImpl::checkPrerequisites( const css::uno::Reference< css::task::XAbortChannel >&, const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv, - sal_Bool bInstalled, OUString const & aContextName) + sal_Bool alreadyInstalled) throw (css::deployment::DeploymentException, css::deployment::ExtensionRemovedException, css::ucb::CommandFailedException, @@ -759,11 +740,21 @@ bool BackendImpl::PackageImpl::checkDependencies( throw deployment::ExtensionRemovedException(); DescriptionInfoset info = getDescriptionInfoset(); if (!info.hasDescription()) - return sal_True; - - return checkPlatform(xCmdEnv) - && checkDependencies(xCmdEnv, info) - && checkLicense(xCmdEnv, info, bInstalled, aContextName); + return 0; + + //always return LICENSE as long as the user did not accept the license + //so that XExtensonManager::checkPrerequisitesAndEnable will again + //check the license + if (!checkPlatform(xCmdEnv)) + return deployment::Prerequisites::PLATFORM | + deployment::Prerequisites::LICENSE; + else if(!checkDependencies(xCmdEnv, info)) + return deployment::Prerequisites::DEPENDENCIES | + deployment::Prerequisites::LICENSE; + else if(!checkLicense(xCmdEnv, info, alreadyInstalled)) + return deployment::Prerequisites::LICENSE; + else + return 0; } ::sal_Bool BackendImpl::PackageImpl::checkDependencies( diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index b645c9b2af7a..5023a501c67e 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -233,9 +233,9 @@ Reference BackendImpl::bindPackage_( 0, dialogURL, xCmdEnv, false /* no throw */ )) { dialogURL = OUString(); } - return new PackageImpl( this, url, xCmdEnv, - makeURL( url, OUSTR("script.xlb") ), - dialogURL, bRemoved, identifier); + return new PackageImpl( + this, url, xCmdEnv, makeURL( url, OUSTR("script.xlb") ), + dialogURL, bRemoved, identifier); } else if (subType.EqualsIgnoreCaseAscii( "vnd.sun.star.dialog-library")) { diff --git a/desktop/source/deployment/unopkg/unopkg.src b/desktop/source/deployment/unopkg/unopkg.src index 79c578628676..dc204e265ec6 100644 --- a/desktop/source/deployment/unopkg/unopkg.src +++ b/desktop/source/deployment/unopkg/unopkg.src @@ -27,15 +27,10 @@ #include "deployment.hrc" -String RID_STR_UNOPKG_NO_SHARED_ALLOWED -{ - Text [ en-US ] = "The option \"--shared\" cannot be used to install the extension \'%NAME\', " - "because every user has to agree to the license agreement of the extension. The extension will not be installed."; -}; String RID_STR_UNOPKG_ACCEPT_LIC_1 { - Text [ en-US ] = "Extension License Agreement:"; + Text [ en-US ] = "Extension Software License Agreement of $NAME:"; }; String RID_STR_UNOPKG_ACCEPT_LIC_2 diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 11bf8129cc04..a077eaddb911 100755 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -52,6 +52,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -363,7 +364,8 @@ bool OO3ExtensionMigration::migrateExtension( const ::rtl::OUString& sSourceDir static_cast< cppu::OWeakObject* >( pCmdEnv ), uno::UNO_QUERY ); uno::Reference< task::XAbortChannel > xAbortChannel; uno::Reference< deployment::XPackage > xPackage = - m_xPackageManager->addPackage( sSourceDir, ::rtl::OUString(), xAbortChannel, xCmdEnv ); + m_xPackageManager->addPackage( + sSourceDir, uno::Sequence(),::rtl::OUString(), xAbortChannel, xCmdEnv ); if ( xPackage.is() ) return true; diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 807260fe4663..ba8cd56085f8 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -41,6 +41,7 @@ #include "cppuhelper/implbase1.hxx" #include "cppuhelper/exc_hlp.hxx" #include "comphelper/anytostring.hxx" +#include "comphelper/sequence.hxx" #include "com/sun/star/deployment/ExtensionManager.hpp" #include "com/sun/star/deployment/ui/PackageManagerDialog.hpp" @@ -60,10 +61,24 @@ using ::rtl::OUString; namespace css = ::com::sun::star; namespace { +struct ExtensionName +{ + OUString m_str; + ExtensionName( OUString const & str ) : m_str( str ) {} + bool operator () ( Reference const & e ) const + { + if (m_str.equals(dp_misc::getIdentifier(e)) + || m_str.equals(e->getName())) + return true; + return false; + } +}; + //------------------------------------------------------------------------------ const char s_usingText [] = "\n" "using: " APP_NAME " add extension-path...\n" +" " APP_NAME " validate extension-identifier...\n" " " APP_NAME " remove extension-identifier...\n" " " APP_NAME " list extension-identifier...\n" " " APP_NAME " reinstall \n" @@ -73,6 +88,8 @@ const char s_usingText [] = "\n" "sub-commands:\n" " add add extension\n" +" validate checks the prerequisites of an installed extension and" +" registers it if possible\n" " remove remove extensions by identifier\n" " reinstall expert feature: reinstall all deployed extensions\n" " list list information about deployed extensions\n" @@ -252,7 +269,7 @@ extern "C" int unopkg_main() return 0; } else if (isOption( info_version, &nPos )) { - dp_misc::writeConsole("\n"APP_NAME" Version 3.0\n"); + dp_misc::writeConsole("\n"APP_NAME" Version 3.3\n"); return 0; } //consume all bootstrap variables which may occur before the subcommannd @@ -314,15 +331,6 @@ extern "C" int unopkg_main() } } - //make sure the bundled option was provided together with shared -// if (option_bundled && !option_shared) -// { -// dp_misc::writeConsoleError( -// "\nERROR: option --bundled can only be used together with --shared!"); -// return 1; -// } - - xComponentContext = getUNO( disposeGuard, option_verbose, option_shared, subcmd_gui, xLocalComponentContext ); @@ -357,8 +365,11 @@ extern "C" int unopkg_main() Reference< ::com::sun::star::ucb::XCommandEnvironment > xCmdEnv( createCmdEnv( xComponentContext, logFile, - option_force, option_verbose, option_bundled, - option_suppressLicense) ); + option_force, option_verbose) ); + + //synchronize bundled/shared extensions + if (!subcmd_gui && ! dp_misc::office_is_running()) + dp_misc::syncRepositories(xCmdEnv); if (subcmd_add || subCommand.equalsAsciiL( @@ -369,9 +380,12 @@ extern "C" int unopkg_main() OUString const & cmdPackage = cmdPackages[ pos ]; if (subcmd_add) { + beans::NamedValue nvSuppress( + OUSTR("SUPPRESS_LICENSE"), option_suppressLicense ? + makeAny(OUSTR("1")):makeAny(OUSTR("0"))); xExtensionManager->addExtension( - cmdPackage, repository, - Reference(), xCmdEnv); + cmdPackage, Sequence(&nvSuppress, 1), + repository, Reference(), xCmdEnv); } else { @@ -410,32 +424,131 @@ extern "C" int unopkg_main() } else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("list") )) { - Sequence< Reference > packages; + ::std::vector > vecExtUnaccepted; + ::comphelper::sequenceToContainer(vecExtUnaccepted, + xExtensionManager->getExtensionsWithUnacceptedLicenses( + repository, xCmdEnv)); + + //This vector tells what XPackage in allExtensions has an + //unaccepted license. + std::vector vecUnaccepted; + std::vector > allExtensions; if (cmdPackages.empty()) { - packages = xExtensionManager->getDeployedExtensions( - repository, Reference(), xCmdEnv ); + Sequence< Reference > + packages = xExtensionManager->getDeployedExtensions( + repository, Reference(), xCmdEnv ); + + ::std::vector > vec_packages; + ::comphelper::sequenceToContainer(vec_packages, packages); + + //First copy the extensions with the unaccepted license + //to vector allExtensions. + allExtensions.resize(vecExtUnaccepted.size() + vec_packages.size()); + + ::std::vector >::iterator i_all_ext = + ::std::copy(vecExtUnaccepted.begin(), vecExtUnaccepted.end(), + allExtensions.begin()); + //Now copy those we got from getDeployedExtensions + ::std::copy(vec_packages.begin(), vec_packages.end(), i_all_ext); + + //Now prepare the vector which tells what extension has an + //unaccepted license + vecUnaccepted.resize(vecExtUnaccepted.size() + vec_packages.size()); + ::std::vector::iterator i_unaccepted = + ::std::fill_n(vecUnaccepted.begin(), + vecExtUnaccepted.size(), true); + ::std::fill_n(i_unaccepted, vec_packages.size(), false); + dp_misc::writeConsole( - OUSTR("all deployed ") + repository + OUSTR(" packages:\n")); + OUSTR("All deployed ") + repository + OUSTR(" extensions:\n\n")); } else { - packages.realloc( cmdPackages.size() ); + //The user provided the names (ids or file names) of the extensions + //which shall be listed for ( ::std::size_t pos = 0; pos < cmdPackages.size(); ++pos ) + { + Reference extension; try { - packages[ pos ] = xExtensionManager->getDeployedExtension( + extension = xExtensionManager->getDeployedExtension( repository, cmdPackages[ pos ], cmdPackages[ pos ], xCmdEnv ); } catch (lang::IllegalArgumentException &) { - packages[ pos ] = findPackage(repository, + extension = findPackage(repository, xExtensionManager, xCmdEnv, cmdPackages[ pos ] ); - if ( !packages[ pos ].is() ) - throw; } + + //Now look if the requested extension has an unaccepted license + bool bUnacceptedLic = false; + if (!extension.is()) + { + ::std::vector >::const_iterator + i = ::std::find_if( + vecExtUnaccepted.begin(), + vecExtUnaccepted.end(), ExtensionName(cmdPackages[pos])); + if (i != vecExtUnaccepted.end()) + { + extension = *i; + bUnacceptedLic = true; + } + } + + if (extension.is()) + { + allExtensions.push_back(extension); + vecUnaccepted.push_back(bUnacceptedLic); + } + + else + throw lang::IllegalArgumentException( + OUSTR("There is no such extension deployed: ") + + cmdPackages[pos],0,-1); + } + + } + + printf_packages(allExtensions, vecUnaccepted, xCmdEnv ); + } + else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("validate") )) + { + ::std::vector > vecExtUnaccepted; + ::comphelper::sequenceToContainer( + vecExtUnaccepted, xExtensionManager->getExtensionsWithUnacceptedLicenses( + repository, xCmdEnv)); + + for ( ::std::size_t pos = 0; pos < cmdPackages.size(); ++pos ) + { + Reference extension; + try + { + extension = xExtensionManager->getDeployedExtension( + repository, cmdPackages[ pos ], cmdPackages[ pos ], xCmdEnv ); + } + catch (lang::IllegalArgumentException &) + { + extension = findPackage( + repository, xExtensionManager, xCmdEnv, cmdPackages[ pos ] ); + } + + if (!extension.is()) + { + ::std::vector >::const_iterator + i = ::std::find_if( + vecExtUnaccepted.begin(), + vecExtUnaccepted.end(), ExtensionName(cmdPackages[pos])); + if (i != vecExtUnaccepted.end()) + { + extension = *i; + } + } + + if (extension.is()) + xExtensionManager->checkPrerequisitesAndEnable( + extension, Reference(), xCmdEnv); } - printf_packages( packages, xCmdEnv ); } else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("gui") )) { diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index d23dcbf9577d..69a973b90a42 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -49,7 +49,7 @@ #include "com/sun/star/deployment/PlatformException.hpp" #include "com/sun/star/i18n/XCollator.hpp" #include "com/sun/star/i18n/CollatorOptions.hpp" -#include "com/sun/star/deployment/LicenseIndividualAgreementException.hpp" + #include #include "deployment.hrc" #include "dp_version.hxx" @@ -85,13 +85,12 @@ class CommandEnvironmentImpl sal_Int32 m_logLevel; bool m_option_force_overwrite; bool m_option_verbose; - bool m_option_bundled; - bool m_option_suppressLicense; Reference< XComponentContext > m_xComponentContext; Reference< XProgressHandler > m_xLogFile; void update_( Any const & Status ) throw (RuntimeException); - void printLicense(const OUString& sLicense, bool & accept, bool & decline); + void printLicense(const OUString & sName,const OUString& sLicense, + bool & accept, bool & decline); public: virtual ~CommandEnvironmentImpl(); @@ -99,9 +98,7 @@ public: Reference const & xComponentContext, OUString const & log_file, bool option_force_overwrite, - bool option_verbose, - bool option_bundled, - bool option_suppressLicense); + bool option_verbose); // XCommandEnvironment virtual Reference< task::XInteractionHandler > SAL_CALL @@ -120,19 +117,16 @@ public: virtual void SAL_CALL pop() throw (RuntimeException); }; + //______________________________________________________________________________ CommandEnvironmentImpl::CommandEnvironmentImpl( Reference const & xComponentContext, OUString const & log_file, bool option_force_overwrite, - bool option_verbose, - bool option_bundled, - bool option_suppressLicense) + bool option_verbose) : m_logLevel(0), m_option_force_overwrite( option_force_overwrite ), m_option_verbose( option_verbose ), - m_option_bundled( option_bundled), - m_option_suppressLicense( option_suppressLicense), m_xComponentContext(xComponentContext) { if (log_file.getLength() > 0) { @@ -162,10 +156,13 @@ CommandEnvironmentImpl::~CommandEnvironmentImpl() } //May throw exceptions -void CommandEnvironmentImpl::printLicense(const OUString& sLicense, bool & accept, bool &decline) +void CommandEnvironmentImpl::printLicense( + const OUString & sName, const OUString& sLicense, bool & accept, bool &decline) { ResMgr * pResMgr = DeploymentResMgr::get(); - OUString s1 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_1, *pResMgr)); + String s1tmp(ResId(RID_STR_UNOPKG_ACCEPT_LIC_1, *pResMgr)); + s1tmp.SearchAndReplaceAllAscii( "$NAME", sName ); + OUString s1(s1tmp); OUString s2 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_2, *pResMgr)); OUString s3 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_3, *pResMgr)); OUString s4 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_4, *pResMgr)); @@ -246,7 +243,6 @@ void CommandEnvironmentImpl::handle( lang::WrappedTargetException wtExc; deployment::LicenseException licExc; deployment::InstallException instExc; - deployment::LicenseIndividualAgreementException licAgreementExc; deployment::PlatformException platExc; deployment::VersionException verExc; @@ -281,27 +277,9 @@ void CommandEnvironmentImpl::handle( update_( wtExc.TargetException ); } } - else if (request >>= licAgreementExc) - { - if (m_option_suppressLicense && licAgreementExc.SuppressIfRequired) - { - approve = true; - } - else - { - String sResMsg( ResId( RID_STR_UNOPKG_NO_SHARED_ALLOWED, *DeploymentResMgr::get() ) ); - sResMsg.SearchAndReplaceAllAscii( "%NAME", licAgreementExc.ExtensionName ); - dp_misc::writeConsole(OUSTR("\n") + sResMsg + OUSTR("\n\n")); - abort = true; - } - } else if (request >>= licExc) { - bLicenseException = true; - if (m_option_suppressLicense && licExc.SuppressIfRequired) - approve = true; - else - printLicense(licExc.Text, approve, abort); + printLicense(licExc.ExtensionName, licExc.Text, approve, abort); } else if (request >>= instExc) { @@ -436,6 +414,7 @@ void CommandEnvironmentImpl::pop() throw (RuntimeException) m_xLogFile->pop(); } + } // anon namespace namespace unopkg { @@ -445,14 +424,10 @@ Reference< XCommandEnvironment > createCmdEnv( Reference< XComponentContext > const & xContext, OUString const & logFile, bool option_force_overwrite, - bool option_verbose, - bool option_bundled, - bool option_suppressLicense) + bool option_verbose) { return new CommandEnvironmentImpl( - xContext, logFile, option_force_overwrite, option_verbose, option_bundled, - option_suppressLicense); + xContext, logFile, option_force_overwrite, option_verbose); } - } // unopkg diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index b25176e1dcee..3272810afee2 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -48,6 +48,7 @@ #include "unotools/configmgr.hxx" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "cppuhelper/bootstrap.hxx" +#include "comphelper/sequence.hxx" #include using ::rtl::OUString; @@ -317,7 +318,10 @@ void printf_package( xPackage->getBundle( Reference(), xCmdEnv ) ); printf_space( level + 1 ); dp_misc::writeConsole("bundled Packages: {\n"); - printf_packages( seq, xCmdEnv, level + 2 ); + ::std::vector >vec_bundle; + ::comphelper::sequenceToContainer(vec_bundle, seq); + printf_packages( vec_bundle, ::std::vector(vec_bundle.size()), + xCmdEnv, level + 2 ); printf_space( level + 1 ); dp_misc::writeConsole("}\n"); } @@ -325,23 +329,45 @@ void printf_package( } // anon namespace +void printf_unaccepted_licenses( + Reference const & ext) +{ + OUString id( + dp_misc::getIdentifier(ext) ); + printf_line( OUSTR("Identifier"), id, 0 ); + printf_space(1); + dp_misc::writeConsole(OUSTR("License not accepted\n\n")); +} + //============================================================================== void printf_packages( - Sequence< Reference > const & seq, + ::std::vector< Reference > const & allExtensions, + ::std::vector const & vecUnaccepted, Reference const & xCmdEnv, sal_Int32 level ) { - sal_Int32 len = seq.getLength(); - Reference< deployment::XPackage > const * p = seq.getConstArray(); - if (len == 0) { + OSL_ASSERT(allExtensions.size() == vecUnaccepted.size()); + + if (allExtensions.size() == 0) + { printf_space( level ); dp_misc::writeConsole("\n"); } - else { - for ( sal_Int32 pos = 0; pos < len; ++pos ) - printf_package( p[ pos ], xCmdEnv, level ); + else + { + typedef ::std::vector< Reference >::const_iterator I_EXT; + int index = 0; + for (I_EXT i = allExtensions.begin(); i != allExtensions.end(); i++, index++) + { + if (vecUnaccepted[index]) + printf_unaccepted_licenses(*i); + else + printf_package( *i, xCmdEnv, level ); + dp_misc::writeConsole(OUSTR("\n")); + } } } + //############################################################################## namespace { diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h index 6e9d30cf0d42..43f77513b10c 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_shared.h +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -162,14 +162,12 @@ css::uno::Reference createCmdEnv( css::uno::Reference const & xContext, ::rtl::OUString const & logFile, bool option_force_overwrite, - bool option_verbose, - bool option_bundled, - bool option_suppressLicense); - + bool option_verbose); //============================================================================== void printf_packages( - css::uno::Sequence< - css::uno::Reference > const & seq, + ::std::vector< + css::uno::Reference > const & allExtensions, + ::std::vector const & vecUnaccepted, css::uno::Reference const & xCmdEnv, sal_Int32 level = 0 ); -- cgit From 85c93f5779b0382769cf9dfb5a6306a018c17edd Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Tue, 20 Apr 2010 07:59:05 +0200 Subject: jl152 import 263447 from native0jl:#i77196# Show progress on startup --- desktop/inc/app.hxx | 6 +- desktop/source/app/app.cxx | 16 +- desktop/source/app/check_ext_deps.cxx | 205 +++++++++++++-------- desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 1 - desktop/source/splash/splash.cxx | 27 +-- desktop/source/splash/splash.hxx | 1 + 6 files changed, 161 insertions(+), 95 deletions(-) diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 4f5a3b176be3..486d280311d9 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -132,7 +132,10 @@ class Desktop : public Application static sal_Bool LicenseNeedsAcceptance(); static sal_Bool IsFirstStartWizardNeeded(); static sal_Bool CheckExtensionDependencies(); - static void SynchronizeExtensionRepositories(); + + void SynchronizeExtensionRepositories(); + void SetSplashScreenText( const ::rtl::OUString& rText ); + void SetSplashScreenProgress( sal_Int32 ); private: // Bootstrap methods @@ -165,7 +168,6 @@ class Desktop : public Application Reference m_rSplashScreen; void OpenSplashScreen(); - void SetSplashScreenProgress(sal_Int32); void CloseSplashScreen(); void EnableOleAutomation(); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index b82915871566..8e610fb0e141 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1392,12 +1392,14 @@ void Desktop::Main() tools::InitTestToolLib(); RTL_LOGFILE_CONTEXT_TRACE( aLog, "} tools::InitTestToolLib" ); + // Check if bundled or shared extensions were added /removed + // and process those extensions (has to be done before checking + // the extension dependencies! + SynchronizeExtensionRepositories(); + bool bAbort = CheckExtensionDependencies(); if ( bAbort ) return; - //Check if bundled or shared extensions were added /removed - //and process those extensions - SynchronizeExtensionRepositories(); // First Start Wizard allowed ? if ( ! pCmdLineArgs->IsNoFirstStartWizard()) @@ -2919,6 +2921,14 @@ void Desktop::SetSplashScreenProgress(sal_Int32 iProgress) } } +void Desktop::SetSplashScreenText( const ::rtl::OUString& rText ) +{ + if( m_rSplashScreen.is() ) + { + m_rSplashScreen->setText( rText ); + } +} + void Desktop::CloseSplashScreen() { if(m_rSplashScreen.is()) diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index f487e0dfc96f..6a9beae58ccd 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -27,12 +27,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_desktop.hxx" -#include +#include "osl/file.hxx" +#include "osl/mutex.hxx" + #include #include #include #include "cppuhelper/compbase3.hxx" +#include "vcl/wrkwin.hxx" +#include "vcl/timer.hxx" + #include #include @@ -59,7 +64,7 @@ using rtl::OUString; using namespace desktop; using namespace com::sun::star; -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) +#define UNISTRING(s) OUString(RTL_CONSTASCII_USTRINGPARAM(s)) namespace { @@ -69,9 +74,13 @@ class SilentCommandEnv task::XInteractionHandler, ucb::XProgressHandler > { + Desktop *mpDesktop; + sal_Int32 mnLevel; + sal_Int32 mnProgress; + public: - virtual ~SilentCommandEnv(){}; - SilentCommandEnv(){}; + SilentCommandEnv( Desktop* pDesktop ); + virtual ~SilentCommandEnv(); // XCommandEnvironment virtual uno::Reference SAL_CALL @@ -91,21 +100,38 @@ public: throw (uno::RuntimeException); virtual void SAL_CALL pop() throw (uno::RuntimeException); }; + +//----------------------------------------------------------------------------- +SilentCommandEnv::SilentCommandEnv( Desktop* pDesktop ) +{ + mpDesktop = pDesktop; + mnLevel = 0; + mnProgress = 25; +} + +//----------------------------------------------------------------------------- +SilentCommandEnv::~SilentCommandEnv() +{ + mpDesktop->SetSplashScreenText( OUString() ); +} + +//----------------------------------------------------------------------------- Reference SilentCommandEnv::getInteractionHandler() -throw (uno::RuntimeException) + throw (uno::RuntimeException) { return this; } +//----------------------------------------------------------------------------- Reference SilentCommandEnv::getProgressHandler() -throw (uno::RuntimeException) + throw (uno::RuntimeException) { return this; } +//----------------------------------------------------------------------------- // XInteractionHandler -void SilentCommandEnv::handle( - Reference< task::XInteractionRequest> const & xRequest ) +void SilentCommandEnv::handle( Reference< task::XInteractionRequest> const & xRequest ) throw (uno::RuntimeException) { uno::Any request( xRequest->getRequest() ); @@ -127,23 +153,45 @@ void SilentCommandEnv::handle( } } +//----------------------------------------------------------------------------- // XProgressHandler -void SilentCommandEnv::push( uno::Any const & /*Status*/ ) -throw (uno::RuntimeException) +void SilentCommandEnv::push( uno::Any const & rStatus ) + throw (uno::RuntimeException) { -} + OUString sText; + mnLevel += 1; + if ( rStatus.hasValue() && ( rStatus >>= sText) ) + { + if ( mnLevel == 1 ) + mpDesktop->SetSplashScreenText( sText ); + else + mpDesktop->SetSplashScreenProgress( ++mnProgress ); + } +} -void SilentCommandEnv::update( uno::Any const & /*Status */) -throw (uno::RuntimeException) +//----------------------------------------------------------------------------- +void SilentCommandEnv::update( uno::Any const & rStatus ) + throw (uno::RuntimeException) { + OUString sText; + if ( rStatus.hasValue() && ( rStatus >>= sText) ) + { + mpDesktop->SetSplashScreenText( sText ); + } } +//----------------------------------------------------------------------------- void SilentCommandEnv::pop() throw (uno::RuntimeException) { + mnLevel -= 1; } } // end namespace + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ); //------------------------------------------------------------------------------ @@ -169,55 +217,75 @@ static sal_Int16 impl_showExtensionDialog( uno::Reference< uno::XComponentContex //------------------------------------------------------------------------------ // Check dependencies of all packages //------------------------------------------------------------------------------ -static bool impl_checkDependencies( const uno::Reference< deployment::XPackageManager > &xPackageManager ) +static bool impl_checkDependencies( const uno::Reference< uno::XComponentContext > &xContext ) { - uno::Sequence< uno::Reference< deployment::XPackage > > packages; + uno::Sequence< uno::Sequence< uno::Reference< deployment::XPackage > > > xAllPackages; + uno::Reference< deployment::XExtensionManager > xExtensionManager = deployment::ExtensionManager::get( xContext ); + + if ( !xExtensionManager.is() ) + { + OSL_ENSURE( 0, "Could not get the Extension Manager!" ); + return true; + } try { - packages = xPackageManager->getDeployedPackages( uno::Reference< task::XAbortChannel >(), - uno::Reference< ucb::XCommandEnvironment >() ); + xAllPackages = xExtensionManager->getAllExtensions( uno::Reference< task::XAbortChannel >(), + uno::Reference< ucb::XCommandEnvironment >() ); } - catch ( deployment::DeploymentException & ) { /* handleGeneralError(e.Cause);*/ } - catch ( ucb::CommandFailedException & ) { /* handleGeneralError(e.Reason);*/ } - catch ( ucb::CommandAbortedException & ) {} + catch ( deployment::DeploymentException & ) { return true; } + catch ( ucb::CommandFailedException & ) { return true; } + catch ( ucb::CommandAbortedException & ) { return true; } catch ( lang::IllegalArgumentException & e ) { throw uno::RuntimeException( e.Message, e.Context ); } - for ( sal_Int32 i = 0; i < packages.getLength(); ++i ) + sal_Int32 nMax = 2; +#ifdef DEBUG + nMax = 3; +#endif + + for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i ) { - bool bRegistered = false; - try { - beans::Optional< beans::Ambiguous< sal_Bool > > option( packages[i]->isRegistered( uno::Reference< task::XAbortChannel >(), - uno::Reference< ucb::XCommandEnvironment >() ) ); - if ( option.IsPresent ) - { - ::beans::Ambiguous< sal_Bool > const & reg = option.Value; - if ( reg.IsAmbiguous ) - bRegistered = false; - else - bRegistered = reg.Value ? true : false; - } - else - bRegistered = false; - } - catch ( uno::RuntimeException & ) { throw; } - catch ( uno::Exception & exc) { - (void) exc; - OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - bRegistered = false; - } + uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i]; - if ( bRegistered ) + for ( sal_Int32 j = 0; (jcheckDependencies( uno::Reference< ucb::XCommandEnvironment >() ); - } - catch ( deployment::DeploymentException & ) {} - if ( ! bDependenciesValid ) + uno::Reference< deployment::XPackage > xPackage = xPackageList[j]; + if ( xPackage.is() ) { - return false; + bool bRegistered = false; + try { + beans::Optional< beans::Ambiguous< sal_Bool > > option( xPackage->isRegistered( uno::Reference< task::XAbortChannel >(), + uno::Reference< ucb::XCommandEnvironment >() ) ); + if ( option.IsPresent ) + { + ::beans::Ambiguous< sal_Bool > const & reg = option.Value; + if ( reg.IsAmbiguous ) + bRegistered = false; + else + bRegistered = reg.Value ? true : false; + } + else + bRegistered = false; + } + catch ( uno::RuntimeException & ) { throw; } + catch ( uno::Exception & exc) { + (void) exc; + OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); + } + + if ( bRegistered ) + { + bool bDependenciesValid = false; + try { + bDependenciesValid = xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() ); + } + catch ( deployment::DeploymentException & ) {} + if ( ! bDependenciesValid ) + { + return false; + } + } } } } @@ -254,31 +322,11 @@ static void impl_setNeedsCompatCheck() static bool impl_check() { uno::Reference< uno::XComponentContext > xContext = comphelper_getProcessComponentContext(); - uno::Reference< deployment::XPackageManager > xManager; - bool bDependenciesValid = true; - try { - xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("user") ); - } - catch ( ucb::CommandFailedException & ){} - catch ( uno::RuntimeException & ) {} - - if ( xManager.is() ) - bDependenciesValid = impl_checkDependencies( xManager ); - - if ( bDependenciesValid ) - { - try { - xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("shared") ); - } - catch ( ucb::CommandFailedException & ){} - catch ( uno::RuntimeException & ) {} - - if ( xManager.is() ) - bDependenciesValid = impl_checkDependencies( xManager ); - } + bool bDependenciesValid = impl_checkDependencies( xContext ); short nRet = 0; + if ( !bDependenciesValid ) nRet = impl_showExtensionDialog( xContext ); @@ -292,7 +340,7 @@ static bool impl_check() } //------------------------------------------------------------------------------ -// to check, if we need checking the dependencies of the extensions again, we compare +// to check if we need checking the dependencies of the extensions again, we compare // the build id of the office with the one of the last check //------------------------------------------------------------------------------ static bool impl_needsCompatCheck() @@ -325,6 +373,9 @@ static bool impl_needsCompatCheck() pset->setPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID"), result ); Reference< util::XChangesBatch >( pset, UNO_QUERY_THROW )->commitChanges(); } +#ifdef DEBUG + bNeedsCheck = true; +#endif } catch (const Exception&) {} @@ -348,11 +399,9 @@ void Desktop::SynchronizeExtensionRepositories() { RTL_LOGFILE_CONTEXT(aLog,"desktop (jl97489) ::Desktop::SynchronizeExtensionRepositories"); OUString sDisable; - ::rtl::Bootstrap::get( - OUString(RTL_CONSTASCII_USTRINGPARAM("DISABLE_SYNC_EXTENSIONS")), - sDisable, - OUString(RTL_CONSTASCII_USTRINGPARAM(""))); + ::rtl::Bootstrap::get( UNISTRING( "DISABLE_SYNC_EXTENSIONS" ), sDisable, OUString() ); if (sDisable.getLength() > 0) return; - dp_misc::syncRepositories(new SilentCommandEnv()); + + dp_misc::syncRepositories( new SilentCommandEnv( this ) ); } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index fef6d36c7165..cd37f07729bb 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -243,7 +243,6 @@ bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bPare { TUpdateListEntry pEntry( new UpdateListEntry( xPackage, m_sPackageManagers[j] ) ); vEntries.push_back( pEntry ); - break; } } } diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 5fee3028b4f6..381a98ce008f 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -135,14 +135,21 @@ void SAL_CALL SplashScreen::reset() } } -void SAL_CALL SplashScreen::setText(const OUString&) +void SAL_CALL SplashScreen::setText(const OUString& rText) throw (RuntimeException) { - if (_bVisible && !_bProgressEnd) { - if ( _eBitmapMode == BM_FULLSCREEN ) - ShowFullScreenMode( TRUE ); - Show(); - Flush(); + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + if ( _sProgressText != rText ) + { + _sProgressText = rText; + + if (_bVisible && !_bProgressEnd) + { + if ( _eBitmapMode == BM_FULLSCREEN ) + ShowFullScreenMode( TRUE ); + Show(); + updateStatus(); + } } } @@ -647,7 +654,7 @@ void SplashScreen::Paint( const Rectangle&) } if( (bNativeOK = DrawNativeControl( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aControlRegion, - CTRL_STATE_ENABLED, aValue, rtl::OUString() )) != FALSE ) + CTRL_STATE_ENABLED, aValue, _sProgressText )) != FALSE ) { return; } @@ -668,10 +675,8 @@ void SplashScreen::Paint( const Rectangle&) _vdev.DrawRect(Rectangle(_tlx, _tly, _tlx+_barwidth, _tly+_barheight)); _vdev.SetFillColor( _cProgressBarColor ); _vdev.SetLineColor(); - Rectangle aRect(_tlx+_barspace, _tly+_barspace, _tlx+_barspace+length, _tly+_barheight-_barspace); - _vdev.DrawRect(Rectangle(_tlx+_barspace, _tly+_barspace, - _tlx+_barspace+length, _tly+_barheight-_barspace)); - + _vdev.DrawRect(Rectangle(_tlx+_barspace, _tly+_barspace, _tlx+_barspace+length, _tly+_barheight-_barspace)); + _vdev.DrawText( Rectangle(_tlx, _tly+_barheight+5, _tlx+_barwidth, _tly+_barheight+5+20), _sProgressText, TEXT_DRAW_CENTER ); } Size aSize = GetOutputSizePixel(); Size bSize = _vdev.GetOutputSizePixel(); diff --git a/desktop/source/splash/splash.hxx b/desktop/source/splash/splash.hxx index 99677aa107f1..8480ed3df9ae 100644 --- a/desktop/source/splash/splash.hxx +++ b/desktop/source/splash/splash.hxx @@ -91,6 +91,7 @@ private: Color _cProgressBarColor; bool _bNativeProgress; OUString _sAppName; + OUString _sProgressText; std::vector< FullScreenProgressRatioValue > _sFullScreenProgressRatioValues; sal_Int32 _iMax; -- cgit From e1703d7ac3e485fb7b94787ecdf04a7910bb20c5 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Tue, 20 Apr 2010 10:04:52 +0200 Subject: jl152 import 263448 from native0jl:#i77196# XExtensionManager supports XModifyBroadcaster --- .../deployment/manager/dp_extensionmanager.cxx | 66 +++++++++++++++++++--- .../deployment/manager/dp_extensionmanager.hxx | 51 +++++------------ desktop/source/deployment/manager/dp_manager.cxx | 8 +-- 3 files changed, 74 insertions(+), 51 deletions(-) diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 15bd9a581611..c4581556749f 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -49,6 +49,7 @@ #include "com/sun/star/beans/Ambiguous.hpp" #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/io/XInputStream.hpp" +#include "com/sun/star/util/XModifyBroadcaster.hpp" #include "comphelper/sequence.hxx" #include "xmlscript/xml_helper.hxx" #include "osl/diagnose.h" @@ -60,6 +61,8 @@ #include "dp_extensionmanager.hxx" #include "dp_commandenvironments.hxx" #include "dp_properties.hxx" +#include "boost/bind.hpp" + #include #include #include @@ -71,8 +74,10 @@ namespace task = com::sun::star::task; namespace ucb = com::sun::star::ucb; namespace uno = com::sun::star::uno; namespace beans = com::sun::star::beans; +namespace util = com::sun::star::util; namespace css = com::sun::star; + //#define OUSTR(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) using ::com::sun::star::uno::Reference; @@ -121,6 +126,7 @@ namespace dp_manager { //ToDo: bundled extension ExtensionManager::ExtensionManager( Reference< uno::XComponentContext > const& xContext) : + ::cppu::WeakComponentImplHelper1< css::deployment::XExtensionManager >(getMutex()), m_xContext( xContext ) { Reference xPackageManagerFactory( @@ -433,7 +439,7 @@ Reference ExtensionManager::addExtension( OUSTR("No valid repository name provided."), static_cast(this), 0); - ::osl::MutexGuard guard(m_mutex); + ::osl::MutexGuard guard(getMutex()); Reference xTmpExtension = getTempExtension(url, xAbortChannel, xCmdEnv); const OUString sIdentifier = dp_misc::getIdentifier(xTmpExtension); @@ -529,6 +535,7 @@ Reference ExtensionManager::addExtension( activateExtension( dp_misc::getIdentifier(xNewExtension), xNewExtension->getName(), xAbortChannel, xCmdEnv); + fireModified(); } } catch (deploy::DeploymentException& ) { @@ -573,6 +580,7 @@ Reference ExtensionManager::addExtension( if (xTmpExtension.is() || xExtensionBackup.is()) m_tmpRepository->removePackage( sIdentifier, OUString(), xAbortChannel, xCmdEnv); + fireModified(); } catch (...) { @@ -616,7 +624,7 @@ void ExtensionManager::removeExtension( OUSTR("No valid repository name provided."), static_cast(this), 0); - ::osl::MutexGuard guard(m_mutex); + ::osl::MutexGuard guard(getMutex()); //Backup the extension, in case the user cancels the action xExtensionBackup = backupExtension( identifier, fileName, xPackageManager, xCmdEnv); @@ -630,6 +638,7 @@ void ExtensionManager::removeExtension( xPackageManager->removePackage( identifier, fileName, xAbortChannel, xCmdEnv); activateExtension(identifier, fileName, xAbortChannel, xCmdEnv); + fireModified(); } catch (deploy::DeploymentException& ) { excOccurred1 = ::cppu::getCaughtException(); @@ -670,6 +679,7 @@ void ExtensionManager::removeExtension( m_tmpRepository->removePackage( dp_misc::getIdentifier(xExtensionBackup), xExtensionBackup->getName(), xAbortChannel, xCmdEnv); + fireModified(); } } catch (...) @@ -705,7 +715,7 @@ void ExtensionManager::enableExtension( throw lang::IllegalArgumentException( OUSTR("No valid repository name provided."), static_cast(this), 0); - ::osl::MutexGuard guard(m_mutex); + ::osl::MutexGuard guard(getMutex()); //if it is already registered or if it cannot be registered //because it does not contain any files which need to be processed @@ -790,7 +800,7 @@ long ExtensionManager::checkPrerequisitesAndEnable( { if (!extension.is()) return 0; - ::osl::MutexGuard guard(m_mutex); + ::osl::MutexGuard guard(getMutex()); sal_Int32 ret = 0; Reference mgr = getPackageManager(extension->getRepositoryName()); @@ -840,7 +850,7 @@ void ExtensionManager::disableExtension( if (!extension.is()) return; - ::osl::MutexGuard guard(m_mutex); + ::osl::MutexGuard guard(getMutex()); OUString repository = extension->getRepositoryName(); if (!repository.equals(OUSTR("user"))) throw lang::IllegalArgumentException( @@ -999,7 +1009,7 @@ void ExtensionManager::reinstallDeployedExtensions( Reference xPackageManager = getPackageManager(repository); - ::osl::MutexGuard guard(m_mutex); + ::osl::MutexGuard guard(getMutex()); xPackageManager->reinstallDeployedPackages(xAbortChannel, xCmdEnv); const uno::Sequence< Reference > extensions( xPackageManager->getDeployedPackages(xAbortChannel, xCmdEnv)); @@ -1072,7 +1082,7 @@ void ExtensionManager::synchronize( OUSTR("No valid repository name provided."), static_cast(this), 0); - ::osl::MutexGuard guard(m_mutex); + ::osl::MutexGuard guard(getMutex()); dp_misc::ProgressLevel progress( xCmdEnv, OUSTR("Synchronizing ") + repository + OUSTR(" repository\n")); @@ -1235,7 +1245,7 @@ ExtensionManager::getExtensionsWithUnacceptedLicenses( { Reference xPackageManager = getPackageManager(repository); - ::osl::MutexGuard guard(m_mutex); + ::osl::MutexGuard guard(getMutex()); return xPackageManager->getExtensionsWithUnacceptedLicenses(xCmdEnv); } @@ -1273,6 +1283,46 @@ bool singleton_entries( } } +// XModifyBroadcaster +//______________________________________________________________________________ +void ExtensionManager::addModifyListener( + Reference const & xListener ) + throw (uno::RuntimeException) +{ + check(); + rBHelper.addListener( ::getCppuType( &xListener ), xListener ); +} + +//______________________________________________________________________________ +void ExtensionManager::removeModifyListener( + Reference const & xListener ) + throw (uno::RuntimeException) +{ + check(); + rBHelper.removeListener( ::getCppuType( &xListener ), xListener ); +} + +void ExtensionManager::check() +{ + ::osl::MutexGuard guard( getMutex() ); + if (rBHelper.bInDispose || rBHelper.bDisposed) { + throw lang::DisposedException( + OUSTR("ExtensionManager instance has already been disposed!"), + static_cast(this) ); + } +} + +void ExtensionManager::fireModified() +{ + ::cppu::OInterfaceContainerHelper * pContainer = rBHelper.getContainer( + util::XModifyListener::static_type() ); + if (pContainer != 0) { + pContainer->forEach( + boost::bind(&util::XModifyListener::modified, _1, + lang::EventObject(static_cast(this))) ); + } +} + } // namespace dp_manager diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index bafa97c24944..b11a2c64f546 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -35,11 +35,9 @@ #include "dp_activepackages.hxx" #include "rtl/ref.hxx" #include "cppuhelper/compbase1.hxx" -//#include "cppuhelper/implbase2.hxx" #include "ucbhelper/content.hxx" #include "com/sun/star/deployment/XPackageRegistry.hpp" #include "com/sun/star/deployment/XPackageManager.hpp" -//#include #include "osl/mutex.hxx" #include @@ -53,50 +51,31 @@ typedef ::std::hash_map< ::std::vector >, ::rtl::OUStringHash > id2extensions; -class ExtensionManager : - public ::cppu::WeakImplHelper1< css::deployment::XExtensionManager > +class ExtensionManager : private ::dp_misc::MutexHolder, + public ::cppu::WeakComponentImplHelper1< css::deployment::XExtensionManager > { -private: - ::osl::Mutex m_mutex; - - public: +public: ExtensionManager( css::uno::Reference< css::uno::XComponentContext >const& xContext); virtual ~ExtensionManager(); static css::uno::Sequence< ::rtl::OUString > getServiceNames(); static ::rtl::OUString getImplName(); -// // XInteractionHandler -// virtual void SAL_CALL handle( const uno::Reference< task::XInteractionRequest >& Request ) -// throw( uno::RuntimeException ); -// // XCommandEnvironment -// virtual uno::Reference< task::XInteractionHandler > SAL_CALL getInteractionHandler() -// throw ( uno::RuntimeException ) { return static_cast(this); }; + void check(); + void fireModified(); -// virtual uno::Reference< css_ucb::XProgressHandler > SAL_CALL getProgressHandler() -// throw ( uno::RuntimeException ) { return uno::Reference< css_ucb::XProgressHandler >(); }; public: - // XComponent - //virtual void SAL_CALL dispose() throw (css::uno::RuntimeException); - //virtual void SAL_CALL addEventListener( - // css::uno::Reference const & xListener ) - // throw (css::uno::RuntimeException); - //virtual void SAL_CALL removeEventListener( - // css::uno::Reference const & xListener ) - // throw (css::uno::RuntimeException); - // - //// XModifyBroadcaster - //virtual void SAL_CALL addModifyListener( - // css::uno::Reference const & xListener ) - // throw (css::uno::RuntimeException); - //virtual void SAL_CALL removeModifyListener( - // css::uno::Reference const & xListener ) - // throw (css::uno::RuntimeException); - - // XPackageManager -// virtual ::rtl::OUString SAL_CALL getContext() -// throw (css::uno::RuntimeException); + +// XModifyBroadcaster + virtual void SAL_CALL addModifyListener( + css::uno::Reference const & xListener ) + throw (css::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( + css::uno::Reference const & xListener ) + throw (css::uno::RuntimeException); + +//XExtensionManager virtual css::uno::Sequence< css::uno::Reference > SAL_CALL getSupportedPackageTypes(::rtl::OUString const & repository) diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 0464d0de62d5..8c55f2508680 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -827,13 +827,7 @@ Reference PackageManagerImpl::addPackage( try { OUString const id = dp_misc::getIdentifier( xPackage ); - //This guard is used to prevent that an extension is - //installed twice. Do not use it in other functions. - //Imagine addPackage is called two times by different - //threads for the same extension quickly after each other. - //The second call would calculate "bAlreadyInstalled = - //false" if the first thread has not yet reached - //insertToActivationLayerDB. + ::osl::MutexGuard g(m_addMutex); if (isInstalled(xPackage)) { -- cgit From c2d9d80b487dd0d7353b22eee44bee3b84fc7838 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Wed, 21 Apr 2010 16:04:34 +0200 Subject: jl152 import 263449 from native0jl:#i77196# no registration of components in uno.exe at startup, fixed extension activation, basic, etc. --- basic/source/inc/namecont.hxx | 11 ++ basic/source/uno/namecont.cxx | 90 ++++++++- .../deployment/gui/dp_gui_extensioncmdqueue.cxx | 2 +- .../deployment/manager/dp_extensionmanager.cxx | 207 +++++++++------------ .../deployment/manager/dp_extensionmanager.hxx | 21 ++- desktop/source/deployment/manager/dp_manager.hrc | 2 +- desktop/source/deployment/manager/dp_manager.src | 4 + .../deployment/registry/component/dp_component.cxx | 39 ++-- .../registry/configuration/dp_configuration.cxx | 2 + desktop/source/deployment/registry/dp_backend.cxx | 7 +- .../registry/executable/dp_executable.cxx | 2 + .../source/deployment/registry/help/dp_help.cxx | 2 + .../source/deployment/registry/inc/dp_backend.h | 3 + .../deployment/registry/package/dp_package.cxx | 4 +- .../deployment/registry/script/dp_script.cxx | 2 + .../source/deployment/registry/sfwk/dp_sfwk.cxx | 2 + .../migration/services/extensionmigration.cxx | 6 +- .../migration/services/oo3extensionmigration.cxx | 2 +- desktop/source/pkgchk/unopkg/unopkg_app.cxx | 7 +- svx/source/smarttags/SmartTagMgr.cxx | 11 +- 20 files changed, 253 insertions(+), 173 deletions(-) diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index 1f7e77170d44..2d24759d9b83 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -689,6 +689,7 @@ enum IteratorState { USER_EXTENSIONS, SHARED_EXTENSIONS, + BUNDLED_EXTENSIONS, END_REACHED }; @@ -708,6 +709,8 @@ protected: implGetNextUserScriptPackage( bool& rbPureDialogLib ); com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextSharedScriptPackage( bool& rbPureDialogLib ); + com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > + implGetNextBundledScriptPackage( bool& rbPureDialogLib ); com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; @@ -721,8 +724,16 @@ protected: < com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq; bool m_bSharedPackagesLoaded; + com::sun::star::uno::Sequence< com::sun::star::uno::Reference + < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq; + bool m_bBundledPackagesLoaded; + + int m_iUserPackage; int m_iSharedPackage; + int m_iBundledPackage; + + ScriptSubPackageIterator* m_pScriptSubPackageIterator; diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 14c84420dad6..7a6a771f85cc 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -65,7 +65,7 @@ #include #include #include -#include "com/sun/star/deployment/thePackageManagerFactory.hpp" +#include "com/sun/star/deployment/ExtensionManager.hpp" #include #ifndef _RTL_USTRING_HXX_ #include @@ -1080,6 +1080,7 @@ sal_Bool SfxLibraryContainer::init_Impl( OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" ); OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" ); + OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" ); OUString aInstSearchStr = OUString::createFromAscii( "$(INST)" ); Sequence< OUString > aNames = pPrevCont->getElementNames(); @@ -1111,6 +1112,7 @@ sal_Bool SfxLibraryContainer::init_Impl( bool bCreateLink = true; if( aStorageURL.indexOf( aUserSearchStr ) != -1 || aStorageURL.indexOf( aSharedSearchStr ) != -1 || + aStorageURL.indexOf( aBundledSearchStr ) != -1 || aStorageURL.indexOf( aInstSearchStr ) != -1 ) { bCreateLink = false; @@ -2182,11 +2184,12 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" ); OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" ); + OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" ); if( StorageURL.indexOf( aUserSearchStr ) != -1 ) { pNewLib->mbExtension = sal_True; } - else if( StorageURL.indexOf( aSharedSearchStr ) != -1 ) + else if( StorageURL.indexOf( aSharedSearchStr ) != -1 || StorageURL.indexOf( aBundledSearchStr ) != -1 ) { pNewLib->mbExtension = sal_True; pNewLib->mbReadOnly = sal_True; @@ -3075,8 +3078,10 @@ ScriptExtensionIterator::ScriptExtensionIterator( void ) : m_eState( USER_EXTENSIONS ) , m_bUserPackagesLoaded( false ) , m_bSharedPackagesLoaded( false ) + , m_bBundledPackagesLoaded( false ) , m_iUserPackage( 0 ) , m_iSharedPackage( 0 ) + , m_iBundledPackage( 0 ) , m_pScriptSubPackageIterator( NULL ) { Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); @@ -3125,6 +3130,16 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia aRetLib = xScriptPackage->getURL(); break; } + case BUNDLED_EXTENSIONS: + { + Reference< deployment::XPackage > xScriptPackage = + implGetNextBundledScriptPackage( rbPureDialogLib ); + if( !xScriptPackage.is() ) + break; + + aRetLib = xScriptPackage->getURL(); + break; + } case END_REACHED: VOS_ENSURE( false, "ScriptExtensionIterator::nextBasicOrDialogLibrary(): Invalid case END_REACHED" ); break; @@ -3295,10 +3310,11 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript { try { - Reference< XPackageManager > xUserManager = - thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("user") ); - m_aUserPackagesSeq = xUserManager->getDeployedPackages - ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + Reference< XExtensionManager > xManager = + ExtensionManager::get( m_xContext ); + m_aUserPackagesSeq = xManager->getDeployedExtensions + (rtl::OUString::createFromAscii("user"), + Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); } catch( com::sun::star::uno::DeploymentException& ) { @@ -3348,10 +3364,11 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri { try { - Reference< XPackageManager > xSharedManager = - thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("shared") ); - m_aSharedPackagesSeq = xSharedManager->getDeployedPackages - ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + Reference< XExtensionManager > xSharedManager = + ExtensionManager::get( m_xContext ); + m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions + (rtl::OUString::createFromAscii("shared"), + Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); } catch( com::sun::star::uno::DeploymentException& ) { @@ -3391,4 +3408,57 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri return xScriptPackage; } +Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScriptPackage + ( bool& rbPureDialogLib ) +{ + Reference< deployment::XPackage > xScriptPackage; + + if( !m_bBundledPackagesLoaded ) + { + try + { + Reference< XExtensionManager > xManager = + ExtensionManager::get( m_xContext ); + m_aBundledPackagesSeq = xManager->getDeployedExtensions + (rtl::OUString::createFromAscii("bundled"), + Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + } + catch( com::sun::star::uno::DeploymentException& ) + { + // Special Office installations may not contain deployment code + return xScriptPackage; + } + + m_bBundledPackagesLoaded = true; + } + + if( m_iBundledPackage == m_aBundledPackagesSeq.getLength() ) + { + m_eState = END_REACHED; + } + else + { + if( m_pScriptSubPackageIterator == NULL ) + { + const Reference< deployment::XPackage >* pBundledPackages = m_aBundledPackagesSeq.getConstArray(); + Reference< deployment::XPackage > xPackage = pBundledPackages[ m_iBundledPackage ]; + VOS_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextBundledScriptPackage(): Invalid package" ); + m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage ); + } + + if( m_pScriptSubPackageIterator != NULL ) + { + xScriptPackage = m_pScriptSubPackageIterator->getNextScriptSubPackage( rbPureDialogLib ); + if( !xScriptPackage.is() ) + { + delete m_pScriptSubPackageIterator; + m_pScriptSubPackageIterator = NULL; + m_iBundledPackage++; + } + } + } + + return xScriptPackage; +} + } // namespace basic diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 4b55a93d3f84..647c46b754c8 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -1048,7 +1048,7 @@ void ExtensionCmdQueue::Thread::_enableExtension( ::rtl::Reference< ProgressCmdE try { - xPackage->registerPackage( xAbortChannel, rCmdEnv.get() ); + xPackage->registerPackage(false, xAbortChannel, rCmdEnv.get() ); if ( m_pDialogHelper ) m_pDialogHelper->updatePackageInfo( xPackage ); } diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index c4581556749f..bbe476e57fba 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -260,48 +260,38 @@ void ExtensionManager::addExtensionsToMap( } -/* -*/ -Reference ExtensionManager::getExtensionAndStatus( - ::rtl::OUString const & identifier, - ::rtl::OUString const & fileName, - ::rtl::OUString const & repository, - Reference const & xAbortChannel, - Reference const & xCmdEnv, - bool & out_bWasRegistered) +bool ExtensionManager::isUserDisabled( + OUString const & identifier, OUString const & fileName) { - Reference theExtension; ::std::list > listExtensions = - getExtensionsWithSameId(identifier, fileName); - OSL_ASSERT(listExtensions.size() == m_repositoryNames.size()); - Reference xActiveExtension; - ::std::list::const_iterator - inames = m_repositoryNames.begin(); - ::std::list >::const_iterator - iext = listExtensions.begin(); - for (; inames != m_repositoryNames.end(); inames++, iext++) + getExtensionsWithSameId(identifier, fileName); + OSL_ASSERT(listExtensions.size() == 3); + + return isUserDisabled( ::comphelper::containerToSequence< + Reference, + ::std::list > + > (listExtensions)); +} + +bool ExtensionManager::isUserDisabled( + uno::Sequence > const & seqExtSameId) +{ + OSL_ASSERT(seqExtSameId.getLength() == 3); + Reference const & userExtension = seqExtSameId[0]; + if (userExtension.is()) { - if (repository.equals(*inames)) - { - theExtension = *iext; - if (iext->is()) - { - beans::Optional > optRegistered = - (*iext)->isRegistered(xAbortChannel, xCmdEnv); - OSL_ENSURE(! optRegistered.Value.IsAmbiguous, - "Extension is not properly registered"); - //IsAmbiguous = true: only partly registered, but we assume - //that this is the active extension, and something went wrong when registering it - //previously. - if (optRegistered.IsPresent - && (optRegistered.Value.Value || optRegistered.Value.IsAmbiguous)) - out_bWasRegistered = true; - } - break; - } + beans::Optional > reg = + userExtension->isRegistered(Reference(), + Reference()); + //If the value is ambiguous is than we assume that the extension + //is enabled, but something went wrong during enabling. We do not + //automatically disable user extensions. + if (reg.IsPresent && + ! reg.Value.IsAmbiguous && ! reg.Value.Value) + return true; } - return theExtension; + return false; } /* @@ -321,6 +311,8 @@ Reference ExtensionManager::getExtensionAndStatus( */ void ExtensionManager::activateExtension( OUString const & identifier, OUString const & fileName, + bool bUserDisabled, + bool bStartup, Reference const & xAbortChannel, Reference const & xCmdEnv ) { @@ -333,11 +325,13 @@ void ExtensionManager::activateExtension( Reference, ::std::list > > (listExtensions), - xAbortChannel, xCmdEnv); + bUserDisabled, bStartup, xAbortChannel, xCmdEnv); } void ExtensionManager::activateExtension( uno::Sequence > const & seqExt, + bool bUserDisabled, + bool bStartup, Reference const & xAbortChannel, Reference const & xCmdEnv ) { @@ -355,9 +349,12 @@ void ExtensionManager::activateExtension( if (!optReg.IsPresent) break; - //Check if this is a disabled user extension, if so then skip - if (!optReg.Value.Value && i == 0) //e.g. not registered - continue; + //Check if this is a disabled user extension, + if (i == 0 && bUserDisabled) + { + aExt->revokePackage(xAbortChannel, xCmdEnv); + continue; + } //If we have already determined an active extension then we must //make sure to unregister all extensions with the same id in @@ -374,7 +371,7 @@ void ExtensionManager::activateExtension( //Register if not already done. //reregister if the value is ambiguous, which indicates that //something went wrong during last registration. - aExt->registerPackage(xAbortChannel, xCmdEnv); + aExt->registerPackage(bStartup, xAbortChannel, xCmdEnv); } } } @@ -455,17 +452,18 @@ Reference ExtensionManager::addExtension( uno::Any excOccurred1; uno::Any excOccurred2; - + bool bUserDisabled = false; try { - //If we add a user extension and there is already one which was - //disabled by a user, then the newly installed one is enabled. If we - //add to another repository then the user extension remains - //disabled. - bool bWasRegistered = false; - xOldExtension = getExtensionAndStatus( - sIdentifier, sFileName, repository, xAbortChannel, - xCmdEnv, bWasRegistered); + bUserDisabled = isUserDisabled(sIdentifier, sFileName); + try + { + xOldExtension = xPackageManager->getDeployedPackage( + sIdentifier, sFileName, xCmdEnv); + } + catch (lang::IllegalArgumentException &) + { + } bool bCanInstall = false; try { @@ -514,8 +512,7 @@ Reference ExtensionManager::addExtension( { if (xOldExtension.is()) { - if (bWasRegistered) - xOldExtension->revokePackage(xAbortChannel, xCmdEnv); + xOldExtension->revokePackage(xAbortChannel, xCmdEnv); //save the old user extension in case the user aborts //store the extension in the tmp repository, this will overwrite //xTmpPackage (same identifier). Do not let the user abort or @@ -532,9 +529,17 @@ Reference ExtensionManager::addExtension( xNewExtension = xPackageManager->addPackage( url, properties, OUString(), xAbortChannel, xCmdEnv); + + //If we add a user extension and there is already one which was + //disabled by a user, then the newly installed one is enabled. If we + //add to another repository then the user extension remains + //disabled. + bool bUserDisabled2 = bUserDisabled; + if (repository.equals(OUSTR("user"))) + bUserDisabled2 = false; activateExtension( dp_misc::getIdentifier(xNewExtension), - xNewExtension->getName(), xAbortChannel, xCmdEnv); + xNewExtension->getName(), bUserDisabled2, false, xAbortChannel, xCmdEnv); fireModified(); } } @@ -575,7 +580,7 @@ Reference ExtensionManager::addExtension( tmpCmdEnv); } activateExtension( - sIdentifier, sFileName, + sIdentifier, sFileName, bUserDisabled, false, Reference(), tmpCmdEnv); if (xTmpExtension.is() || xExtensionBackup.is()) m_tmpRepository->removePackage( @@ -611,7 +616,8 @@ void ExtensionManager::removeExtension( uno::Any excOccurred1; Reference xExtensionBackup; Reference xPackageManager; - + bool bUserDisabled = false; + ::osl::MutexGuard guard(getMutex()); try { //Determine the repository to use @@ -624,7 +630,7 @@ void ExtensionManager::removeExtension( OUSTR("No valid repository name provided."), static_cast(this), 0); - ::osl::MutexGuard guard(getMutex()); + bUserDisabled = isUserDisabled(identifier, fileName); //Backup the extension, in case the user cancels the action xExtensionBackup = backupExtension( identifier, fileName, xPackageManager, xCmdEnv); @@ -637,7 +643,8 @@ void ExtensionManager::removeExtension( xPackageManager->removePackage( identifier, fileName, xAbortChannel, xCmdEnv); - activateExtension(identifier, fileName, xAbortChannel, xCmdEnv); + activateExtension(identifier, fileName, bUserDisabled, false, + xAbortChannel, xCmdEnv); fireModified(); } catch (deploy::DeploymentException& ) { @@ -673,7 +680,8 @@ void ExtensionManager::removeExtension( xExtensionBackup, Reference(), tmpCmdEnv); activateExtension( - identifier, fileName, Reference(), + identifier, fileName, bUserDisabled, false, + Reference(), tmpCmdEnv); m_tmpRepository->removePackage( @@ -705,49 +713,24 @@ void ExtensionManager::enableExtension( lang::IllegalArgumentException, uno::RuntimeException) { + ::osl::MutexGuard guard(getMutex()); + bool bUserDisabled = false; + uno::Any excOccurred; try { if (!extension.is()) return; - OUString repository = extension->getRepositoryName(); if (!repository.equals(OUSTR("user"))) throw lang::IllegalArgumentException( OUSTR("No valid repository name provided."), static_cast(this), 0); - ::osl::MutexGuard guard(getMutex()); - //if it is already registered or if it cannot be registered - //because it does not contain any files which need to be processed - //then there is nothing to do here - beans::Optional > reg = - extension->isRegistered(xAbortChannel, xCmdEnv); - if (!reg.IsPresent - || (!reg.Value.IsAmbiguous && reg.Value.Value)) - return; - } - catch (deploy::DeploymentException& ) { - throw; - } catch (ucb::CommandFailedException & ) { - throw; - } catch (ucb::CommandAbortedException & ) { - throw; - } catch (lang::IllegalArgumentException &) { - throw; - } catch (uno::RuntimeException &) { - throw; - } catch (...) { - uno::Any exc = ::cppu::getCaughtException(); - throw deploy::DeploymentException( - OUSTR("Extension Manager: exception during enableExtension"), - static_cast(this), exc); - } + bUserDisabled = isUserDisabled(dp_misc::getIdentifier(extension), + extension->getName()); - uno::Any excOccurred; - try - { activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), + extension->getName(), false, false, xAbortChannel, xCmdEnv); } catch (deploy::DeploymentException& ) { @@ -772,9 +755,8 @@ void ExtensionManager::enableExtension( { try { - extension->revokePackage(Reference(), xCmdEnv); activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), + extension->getName(), bUserDisabled, false, xAbortChannel, xCmdEnv); } catch (...) @@ -810,8 +792,10 @@ long ExtensionManager::checkPrerequisitesAndEnable( //There are some unfulfilled prerequisites, try to revoke extension->revokePackage(xAbortChannel, xCmdEnv); } - activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), xAbortChannel, xCmdEnv); + const OUString id(dp_misc::getIdentifier(extension)); + activateExtension(id, extension->getName(), + isUserDisabled(id, extension->getName()), false, + xAbortChannel, xCmdEnv); return ret; } catch (deploy::DeploymentException& ) { @@ -844,31 +828,23 @@ void ExtensionManager::disableExtension( lang::IllegalArgumentException, uno::RuntimeException) { + ::osl::MutexGuard guard(getMutex()); uno::Any excOccurred; + bool bUserDisabled = false; try { if (!extension.is()) return; - - ::osl::MutexGuard guard(getMutex()); - OUString repository = extension->getRepositoryName(); + const OUString repository( extension->getRepositoryName()); if (!repository.equals(OUSTR("user"))) throw lang::IllegalArgumentException( OUSTR("No valid repository name provided."), static_cast(this), 0); - //if it is already registered or if it cannot be registered - //because it does not contain any files which need to be processed - //then there is nothing to do here - beans::Optional > reg = - extension->isRegistered(xAbortChannel, xCmdEnv); - if (!reg.IsPresent - || (!reg.Value.IsAmbiguous && !reg.Value.Value)) - return; + const OUString id(dp_misc::getIdentifier(extension)); + bUserDisabled = isUserDisabled(id, extension->getName()); - extension->revokePackage(xAbortChannel, xCmdEnv); - activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), + activateExtension(id, extension->getName(), true, false, xAbortChannel, xCmdEnv); } catch (deploy::DeploymentException& ) { @@ -894,7 +870,7 @@ void ExtensionManager::disableExtension( try { activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), + extension->getName(), bUserDisabled, false, xAbortChannel, xCmdEnv); } catch (...) @@ -1021,7 +997,7 @@ void ExtensionManager::reinstallDeployedExtensions( const OUString id = dp_misc::getIdentifier(extensions[ pos ]); const OUString fileName = extensions[ pos ]->getName(); OSL_ASSERT(id.getLength()); - activateExtension(id, fileName, xAbortChannel, xCmdEnv ); + activateExtension(id, fileName, false, false, xAbortChannel, xCmdEnv ); } catch (lang::DisposedException &) { @@ -1083,12 +1059,11 @@ void ExtensionManager::synchronize( static_cast(this), 0); ::osl::MutexGuard guard(getMutex()); + String sSynchronizing(StrSyncRepository::get()); + sSynchronizing.SearchAndReplaceAllAscii( "%NAME", repository ); + dp_misc::ProgressLevel progress(xCmdEnv, sSynchronizing); - dp_misc::ProgressLevel progress( - xCmdEnv, OUSTR("Synchronizing ") + repository + OUSTR(" repository\n")); xPackageManager->synchronize(xAbortChannel, xCmdEnv); - - try { const uno::Sequence > > @@ -1097,8 +1072,8 @@ void ExtensionManager::synchronize( { uno::Sequence > const & seqExt = seqSeqExt[i]; - - activateExtension(seqExt, xAbortChannel, xCmdEnv); + activateExtension(seqExt, isUserDisabled(seqExt), true, + xAbortChannel, xCmdEnv); } } catch (...) diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index b11a2c64f546..10bf3713c410 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -204,6 +204,9 @@ public: private: + struct StrSyncRepository : public ::dp_misc::StaticResourceString< + StrSyncRepository, RID_STR_SYNCHRONIZING_REPOSITORY> {}; + struct ExtensionInfos { ::rtl::OUString identifier; @@ -225,24 +228,24 @@ private: */ ::std::list< ::rtl::OUString > m_repositoryNames; - css::uno::Reference getExtensionAndStatus( - ::rtl::OUString const & identifier, - ::rtl::OUString const & fileName, - ::rtl::OUString const & repository, - css::uno::Reference const & xAbortChannel, - css::uno::Reference const & xCmdEnv, - bool & out_bWasRegistered); + bool isUserDisabled(::rtl::OUString const & identifier, + ::rtl::OUString const & filename); + + bool ExtensionManager::isUserDisabled( + css::uno::Sequence > const & seqExtSameId); void activateExtension( ::rtl::OUString const & identifier, ::rtl::OUString const & fileName, + bool bUserDisabled, bool bStartup, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv); void activateExtension( css::uno::Sequence > const & seqExt, - css::uno::Reference const & xAbortChannel, - css::uno::Reference const & xCmdEnv ); + bool bUserDisabled, bool bStartup, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ); ::std::list > diff --git a/desktop/source/deployment/manager/dp_manager.hrc b/desktop/source/deployment/manager/dp_manager.hrc index bdbfc079cda6..6131cc381abf 100644 --- a/desktop/source/deployment/manager/dp_manager.hrc +++ b/desktop/source/deployment/manager/dp_manager.hrc @@ -35,5 +35,5 @@ #define RID_STR_PACKAGE_ALREADY_ADDED (RID_DEPLOYMENT_MANAGER_START+2) #define RID_STR_COPYING_PACKAGE (RID_DEPLOYMENT_MANAGER_START+3) #define RID_STR_NO_SUCH_PACKAGE (RID_DEPLOYMENT_MANAGER_START+4) - +#define RID_STR_SYNCHRONIZING_REPOSITORY (RID_DEPLOYMENT_MANAGER_START+5) #endif diff --git a/desktop/source/deployment/manager/dp_manager.src b/desktop/source/deployment/manager/dp_manager.src index 95ede4aa6227..7d38b880c37a 100644 --- a/desktop/source/deployment/manager/dp_manager.src +++ b/desktop/source/deployment/manager/dp_manager.src @@ -53,3 +53,7 @@ String RID_STR_NO_SUCH_PACKAGE Text [ en-US ] = "There is no such extension deployed: "; }; +String RID_STR_SYNCHRONIZING_REPOSITORY +{ + Text [ en-US ] = "Synchronizing repository for %NAME extensions"; +}; diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 17444eb0828e..b3b8a8249994 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -122,7 +122,6 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend BackendImpl * getMyBackend() const; const OUString m_loader; - Reference m_xRemoteContext; ComponentBackendDb::Data m_registeredComponentsDb; enum reg { @@ -143,6 +142,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -179,6 +179,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -356,7 +357,7 @@ BackendImpl * BackendImpl::ComponentPackageImpl::getMyBackend() const //______________________________________________________________________________ void BackendImpl::ComponentPackageImpl::disposing() { - m_xRemoteContext.clear(); +// m_xRemoteContext.clear(); Package::disposing(); } @@ -1224,6 +1225,7 @@ BackendImpl::ComponentPackageImpl::isRegistered_( void BackendImpl::ComponentPackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ) { @@ -1244,11 +1246,14 @@ void BackendImpl::ComponentPackageImpl::processPackage_( data.javaTypeLibrary = isJavaTypelib; if (doRegisterPackage) { - if (! m_xRemoteContext.is()) { - m_xRemoteContext.set( + Reference context(that->getComponentContext()); + if (! startup) + { + context.set( that->getObject( url ), UNO_QUERY ); - if (! m_xRemoteContext.is()) { - m_xRemoteContext.set( + + if (! context.is()) { + context.set( that->insertObject( url, raise_uno_process( that->getComponentContext(), abortChannel ) ), @@ -1258,9 +1263,9 @@ void BackendImpl::ComponentPackageImpl::processPackage_( const Reference xServicesRDB( getRDB() ); const Reference xImplReg( - m_xRemoteContext->getServiceManager()->createInstanceWithContext( + context->getServiceManager()->createInstanceWithContext( OUSTR("com.sun.star.registry.ImplementationRegistration"), - m_xRemoteContext ), UNO_QUERY_THROW ); + context ), UNO_QUERY_THROW ); xImplReg->registerImplementation( m_loader, url, xServicesRDB ); //only write to unorc if registration was successful. @@ -1274,7 +1279,7 @@ void BackendImpl::ComponentPackageImpl::processPackage_( t_stringlist implNames; t_stringpairvec singletons; const Reference xLoader( - getComponentInfo( &implNames, &singletons, m_xRemoteContext ) ); + getComponentInfo( &implNames, &singletons, context ) ); data.implementationNames = implNames; data.singletons = singletons; @@ -1348,11 +1353,14 @@ void BackendImpl::ComponentPackageImpl::processPackage_( // set to VOID during revocation process: m_registered = REG_VOID; - Reference xContext; - if (m_xRemoteContext.is()) // has been activated in this process - xContext = m_xRemoteContext; - else // has been deployed in former times + //get the remote context. If it does not exist then use the local one + Reference xContext( + that->getObject( url ), UNO_QUERY ); + bool bRemoteContext = false; + if (!xContext.is()) xContext = that->getComponentContext(); + else + bRemoteContext = true; t_stringlist implNames; t_stringpairvec singletons; @@ -1427,10 +1435,8 @@ void BackendImpl::ComponentPackageImpl::processPackage_( if (isJavaTypelib) that->removeFromUnoRc( java, url, xCmdEnv ); - if (m_xRemoteContext.is()) { + if (bRemoteContext) that->releaseObject( url ); - m_xRemoteContext.clear(); - } m_registered = REG_NOT_REGISTERED; getMyBackend()->deleteDataFromDb(url); @@ -1483,6 +1489,7 @@ BackendImpl::TypelibraryPackageImpl::isRegistered_( void BackendImpl::TypelibraryPackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool startup, ::rtl::Reference const &, Reference const & xCmdEnv ) { diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index fefa6794342a..941b9a35d7f5 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -86,6 +86,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -644,6 +645,7 @@ OUString replaceOrigin( void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool /*startup*/, ::rtl::Reference const &, Reference const & xCmdEnv ) { diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 1cebd20c297a..e822a66aa85f 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -619,6 +619,7 @@ beans::Optional< beans::Ambiguous > Package::isRegistered( //______________________________________________________________________________ void Package::processPackage_impl( bool doRegisterPackage, + bool startup, Reference const & xAbortChannel, Reference const & xCmdEnv ) { @@ -646,6 +647,7 @@ void Package::processPackage_impl( + displayName ); processPackage_( guard, doRegisterPackage, + startup, AbortChannel::get(xAbortChannel), xCmdEnv ); } @@ -683,6 +685,7 @@ void Package::processPackage_impl( //______________________________________________________________________________ void Package::registerPackage( + sal_Bool startup, Reference const & xAbortChannel, Reference const & xCmdEnv ) throw (deployment::DeploymentException, @@ -692,7 +695,7 @@ void Package::registerPackage( { if (m_bRemoved) throw deployment::ExtensionRemovedException(); - processPackage_impl( true /* register */, xAbortChannel, xCmdEnv ); + processPackage_impl( true /* register */, startup, xAbortChannel, xCmdEnv ); } //______________________________________________________________________________ @@ -703,7 +706,7 @@ void Package::revokePackage( CommandFailedException, CommandAbortedException, lang::IllegalArgumentException, RuntimeException) { - processPackage_impl( false /* revoke */, xAbortChannel, xCmdEnv ); + processPackage_impl( false /* revoke */, false, xAbortChannel, xCmdEnv ); } diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx index 1dc4cdde64ea..ac83302f9fb4 100644 --- a/desktop/source/deployment/registry/executable/dp_executable.cxx +++ b/desktop/source/deployment/registry/executable/dp_executable.cxx @@ -62,6 +62,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -202,6 +203,7 @@ BackendImpl::ExecutablePackageImpl::isRegistered_( void BackendImpl::ExecutablePackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool /*startup*/, ::rtl::Reference const & abortChannel, Reference const & /*xCmdEnv*/ ) { diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index a523a1aa20a5..7e8f128bbf12 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -76,6 +76,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -278,6 +279,7 @@ BackendImpl::PackageImpl::isRegistered_( void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool /* startup */, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ) { diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 7ad55d29ba2f..7b11ae456d5d 100644 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -67,6 +67,7 @@ class Package : protected ::dp_misc::MutexHolder, public t_PackageBase PackageRegistryBackend * getMyBackend() const; void processPackage_impl( bool registerPackage, + bool startup, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ); @@ -97,6 +98,7 @@ protected: virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference< ::dp_misc::AbortChannel > const & abortChannel, css::uno::Reference const & xCmdEnv ) = 0; @@ -193,6 +195,7 @@ public: css::uno::RuntimeException); virtual void SAL_CALL registerPackage( + sal_Bool startup, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ) throw (css::deployment::DeploymentException, diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 822e744b8fc2..a5426bf26b54 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -159,6 +159,7 @@ class BackendImpl : public ImplBaseT virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -847,6 +848,7 @@ uno::Reference< graphic::XGraphic > BackendImpl::PackageImpl::getIcon( sal_Bool void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ) { @@ -865,7 +867,7 @@ void BackendImpl::PackageImpl::processPackage_( xPackage->createAbortChannel() ); AbortChannel::Chain chain( abortChannel, xSubAbortChannel ); try { - xPackage->registerPackage( xSubAbortChannel, xCmdEnv ); + xPackage->registerPackage( startup, xSubAbortChannel, xCmdEnv ); } catch (RuntimeException &) { throw; diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index 5023a501c67e..b2eddfaf74e0 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -80,6 +80,7 @@ class BackendImpl : public t_helper virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -379,6 +380,7 @@ BackendImpl::PackageImpl::isRegistered_( void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool /* startup */, ::rtl::Reference const &, Reference const & xCmdEnv ) { diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx index 704f4f810928..8a4ee1b45fbc 100644 --- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx +++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx @@ -77,6 +77,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -371,6 +372,7 @@ BackendImpl::PackageImpl::isRegistered_( void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool /* startup */, ::rtl::Reference const &, Reference const & ) { diff --git a/desktop/source/migration/services/extensionmigration.cxx b/desktop/source/migration/services/extensionmigration.cxx index a926f17c0c19..66f32744a782 100755 --- a/desktop/source/migration/services/extensionmigration.cxx +++ b/desktop/source/migration/services/extensionmigration.cxx @@ -236,7 +236,7 @@ namespace migration if ( (sMediaType.equals(sBasicType) || sMediaType.equals(sDialogType)) && isBasicPackageEnabled(xPkg)) { - xPkg->registerPackage(uno::Reference< task::XAbortChannel >(), + xPkg->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); } } @@ -288,7 +288,7 @@ namespace migration if ( bRegistered && !sMediaType.equals(sBasicType) && !sMediaType.equals(sDialogType) ) { seqPkg[l]->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - seqPkg[l]->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); + seqPkg[l]->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); } } } @@ -297,7 +297,7 @@ namespace migration registerBasicPackage(aPackage); { aPackage->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - aPackage->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); + aPackage->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); } } } diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index a077eaddb911..2d17a654b29b 100755 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -146,7 +146,7 @@ void OO3ExtensionMigration::registerConfigurationPackage( const uno::Reference< if ( (sMediaType.equals(sConfigurationDataType) || sMediaType.equals(sConfigurationSchemaType) ) ) { xPkg->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - xPkg->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); + xPkg->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); } } diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index ba8cd56085f8..2f4a7f1d7146 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -400,12 +400,7 @@ extern "C" int unopkg_main() Reference p( findPackage(repository, xExtensionManager, xCmdEnv, cmdPackage ) ); - //Todo. temporary preventing exception in bundled case. - //In case of a bundled extension, remove would be called as a result of - //uninstalling a rpm. Then we do not want to show an error when the - //extension does not exist, because the package will be uninstalled anyway - //and the error would only confuse people. - if ( !p.is() && !option_bundled) + if ( !p.is()) throw; else if (p.is()) xExtensionManager->removeExtension( diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx index b3a19ecc65bd..0070646b3330 100644 --- a/svx/source/smarttags/SmartTagMgr.cxx +++ b/svx/source/smarttags/SmartTagMgr.cxx @@ -35,8 +35,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -472,11 +471,9 @@ void SmartTagMgr::RegisterListener() // register as listener at package manager try { - Reference xPackageManagerFactory( - deployment::thePackageManagerFactory::get( mxContext ) ); - Reference xPackageManager( - xPackageManagerFactory->getPackageManager( C2U("user" ) ) ); - Reference< util::XModifyBroadcaster > xMB ( xPackageManager, UNO_QUERY_THROW ); + Reference xExtensionManager( + deployment::ExtensionManager::get( mxContext ) ); + Reference< util::XModifyBroadcaster > xMB ( xExtensionManager, UNO_QUERY_THROW ); Reference< util::XModifyListener > xListener( this ); xMB->addModifyListener( xListener ); -- cgit From e0986b3290e9c73116d86f9ae3b8e35f94aadc2b Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 22 Apr 2010 12:51:04 +0200 Subject: tl78: #i110383# password to modify support --- sfx2/inc/sfx2/docfile.hxx | 2 + sfx2/inc/sfx2/objsh.hxx | 3 + sfx2/source/dialog/filedlghelper.cxx | 63 +------- sfx2/source/doc/docfile.cxx | 50 ++++++ sfx2/source/doc/objcont.cxx | 10 ++ sfx2/source/doc/objmisc.cxx | 29 ++++ sfx2/source/doc/objxtor.cxx | 1 + sfx2/source/inc/objshimp.hxx | 2 +- sfx2/source/view/viewfrm.cxx | 286 +++++++++++++++++++++-------------- uui/source/iahndl-authentication.cxx | 21 ++- uui/source/loginerr.hxx | 142 +++++++++-------- 11 files changed, 361 insertions(+), 248 deletions(-) diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index 03bcfec5818f..01494f751773 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -166,6 +166,7 @@ public: const SfxFilter * GetFilter() const { return pFilter; } const SfxFilter * GetOrigFilter( sal_Bool bNotCurrent = sal_False ) const; const String& GetOrigURL() const; + SfxItemSet * GetItemSet() const; void SetItemSet(SfxItemSet *pSet); void Close(); @@ -342,6 +343,7 @@ public: static sal_Bool CallApproveHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler, ::com::sun::star::uno::Any aRequest, sal_Bool bAllowAbort ); static sal_Bool SetWritableForUserOnly( const ::rtl::OUString& aURL ); + static sal_uInt16 CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd, sal_Bool bMSType ); }; SV_DECL_IMPL_REF( SfxMedium ) diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 99161cb5b36c..e932f0f87477 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -294,6 +294,7 @@ public: sal_Bool HasName() const { return bHasName; } virtual String GetAPIName() const; void SetHasName( sal_Bool bSet = sal_True ) { bHasName = bSet; } + void SetReadOnly(); sal_Bool IsReadOnly() const; sal_Bool IsReadOnlyMedium() const; void SetReadOnlyUI( sal_Bool bReadOnly = sal_True ); @@ -736,6 +737,8 @@ public: SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation( const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos ); SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); + SAL_DLLPRIVATE void SetModifyPasswordEntered(); + SAL_DLLPRIVATE sal_Bool IsModifyPasswordEntered(); SAL_DLLPRIVATE SEQUENCE< OUSTRING > GetEventNames_Impl(); SAL_DLLPRIVATE void InitBasicManager_Impl(); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index c1b9aaf7838d..d7109496d670 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -80,7 +80,6 @@ #include #include #include -#include #include #include #include @@ -465,22 +464,6 @@ sal_Bool FileDialogHelper_Impl::isInOpenMode() const // ------------------------------------------------------------------------ -namespace { - -sal_Bool lclCheckPasswordCapability( const SfxFilter* pFilter ) -{ - return pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_ENCRYPTION ); -} - -sal_Bool lclCheckPasswordToModifyCapability( const SfxFilter* pFilter ) -{ - return pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ); -} - -} - -// ------------------------------------------------------------------------ - void FileDialogHelper_Impl::updateFilterOptionsBox() { if ( !m_bHaveFilterOptions ) @@ -571,9 +554,10 @@ void FileDialogHelper_Impl::enablePasswordBox( sal_Bool bInit ) sal_Bool bWasEnabled = mbIsPwdEnabled; + const SfxFilter* pCurrentFilter = getCurentSfxFilter(); mbIsPwdEnabled = updateExtendedControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, - lclCheckPasswordCapability( getCurentSfxFilter() ) + pCurrentFilter && ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_ENCRYPTION ) ); if( bInit ) @@ -1643,7 +1627,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, return ERRCODE_ABORT; // check, wether or not we have to display a password box - if ( mbHasPassword && mbIsPwdEnabled && xCtrlAccess.is() ) + if ( pCurrentFilter && mbHasPassword && mbIsPwdEnabled && xCtrlAccess.is() ) { try { @@ -1663,7 +1647,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD; - ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), lclCheckPasswordToModifyCapability( pCurrentFilter ) ) ); + ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ) ) ); uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() ); xInteractionHandler->handle( rRequest ); @@ -1675,43 +1659,10 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if ( pPasswordRequest->getRecommendReadOnly() ) rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); - if ( pPasswordRequest->getPasswordToModify().getLength() ) - { - rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8; - if ( bMSType ) - { - // if the MS-filter should be used - // use the inconsistent algorithm to find the encoding specified by MS - nEncoding = osl_getThreadTextEncoding(); - switch( nEncoding ) - { - case RTL_TEXTENCODING_ISO_8859_15: - case RTL_TEXTENCODING_MS_874: - case RTL_TEXTENCODING_MS_1250: - case RTL_TEXTENCODING_MS_1251: - case RTL_TEXTENCODING_MS_1252: - case RTL_TEXTENCODING_MS_1253: - case RTL_TEXTENCODING_MS_1254: - case RTL_TEXTENCODING_MS_1255: - case RTL_TEXTENCODING_MS_1256: - case RTL_TEXTENCODING_MS_1257: - case RTL_TEXTENCODING_MS_1258: - case RTL_TEXTENCODING_SHIFT_JIS: - case RTL_TEXTENCODING_GB_2312: - case RTL_TEXTENCODING_BIG5: - // in case the system uses an encoding from the list above, it should be used - break; - - default: - // in case other encoding is used, use one of the encodings from the list - nEncoding = RTL_TEXTENCODING_MS_1250; - break; - } - } - - sal_uInt16 nHash = ::comphelper::DocPasswordHelper::GetXLHashAsUINT16( pPasswordRequest->getPasswordToModify(), nEncoding ); + // the empty password has 0 as Hash + sal_uInt16 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), bMSType ); + if ( nHash ) rpSet->Put( SfxUInt16Item( SID_PASSWORDTOMODIFYHASH, nHash ) ); - } } else return ERRCODE_ABORT; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 0b535088b0bd..1740d2703ed1 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -115,6 +115,7 @@ using namespace ::com::sun::star::io; #include #include #include +#include #include #include #include @@ -2671,18 +2672,67 @@ void SfxMedium::SetFilter( const SfxFilter* pFilterP, sal_Bool /*bResetOrig*/ ) pFilter = pFilterP; pImp->nFileVersion = 0; } + //---------------------------------------------------------------- const SfxFilter* SfxMedium::GetOrigFilter( sal_Bool bNotCurrent ) const { return ( pImp->pOrigFilter || bNotCurrent ) ? pImp->pOrigFilter : pFilter; } + //---------------------------------------------------------------- void SfxMedium::SetOrigFilter_Impl( const SfxFilter* pOrigFilter ) { pImp->pOrigFilter = pOrigFilter; } + +//------------------------------------------------------------------ + +sal_uInt16 SfxMedium::CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd, sal_Bool bMSType ) +{ + sal_uInt16 nHash = 0; + + if ( aPasswd.getLength() ) + { + rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8; + if ( bMSType ) + { + // if the MS-filter should be used + // use the inconsistent algorithm to find the encoding specified by MS + nEncoding = osl_getThreadTextEncoding(); + switch( nEncoding ) + { + case RTL_TEXTENCODING_ISO_8859_15: + case RTL_TEXTENCODING_MS_874: + case RTL_TEXTENCODING_MS_1250: + case RTL_TEXTENCODING_MS_1251: + case RTL_TEXTENCODING_MS_1252: + case RTL_TEXTENCODING_MS_1253: + case RTL_TEXTENCODING_MS_1254: + case RTL_TEXTENCODING_MS_1255: + case RTL_TEXTENCODING_MS_1256: + case RTL_TEXTENCODING_MS_1257: + case RTL_TEXTENCODING_MS_1258: + case RTL_TEXTENCODING_SHIFT_JIS: + case RTL_TEXTENCODING_GB_2312: + case RTL_TEXTENCODING_BIG5: + // in case the system uses an encoding from the list above, it should be used + break; + + default: + // in case other encoding is used, use one of the encodings from the list + nEncoding = RTL_TEXTENCODING_MS_1250; + break; + } + } + + nHash = ::comphelper::DocPasswordHelper::GetXLHashAsUINT16( aPasswd, nEncoding ); + } + + return nHash; +} + //------------------------------------------------------------------ void SfxMedium::Close() diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 5d14007ec169..0a02a7f8df49 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1499,3 +1499,13 @@ sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt16 nHash ) // return sal_False; } +void SfxObjectShell::SetModifyPasswordEntered() +{ + pImp->m_bModifyPasswordEntered = sal_True; +} + +sal_Bool SfxObjectShell::IsModifyPasswordEntered() +{ + return pImp->m_bModifyPasswordEntered; +} + diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 1cb88e98f59f..a7adf530afc9 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -476,6 +476,32 @@ void SfxObjectShell::SetReadOnlyUI( sal_Bool bReadOnly ) //------------------------------------------------------------------------- +void SfxObjectShell::SetReadOnly() +{ + // Let the document be completely readonly, means that the + // medium open mode is adjusted accordingly, and the write lock + // on the file is removed. + + if ( pMedium && !IsReadOnlyMedium() ) + { + sal_Bool bWasROUI = IsReadOnly(); + + pMedium->UnlockFile( sal_False ); + + // the storage-based mediums are already based on the temporary file + // so UnlockFile has already closed the locking stream + if ( !pMedium->HasStorage_Impl() && IsLoadingFinished() ) + pMedium->CloseInStream(); + + pMedium->SetOpenMode( SFX_STREAM_READONLY, pMedium->IsDirect(), sal_True ); + pMedium->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); + + if ( !bWasROUI ) + Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); + } +} +//------------------------------------------------------------------------- + sal_Bool SfxObjectShell::IsReadOnly() const { return pImp->bReadOnlyUI || IsReadOnlyMedium(); @@ -1370,6 +1396,9 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) if( !IsAbortingImport() ) PositionView_Impl(); + if ( GetModifyPasswordHash() ) + SetReadOnly(); + // Salvage if ( pSalvageItem ) bSetModifiedTRUE = sal_True; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 0ed230dd9dd9..cc983e5eb543 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -263,6 +263,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bIsInit( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) ,m_nModifyPasswordHash( 0 ) + ,m_bModifyPasswordEntered( sal_False ) { } diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index a97018e4b3f6..04df263a3de8 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -171,7 +171,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool m_bIncomplEncrWarnShown; sal_uInt16 m_nModifyPasswordHash; - + sal_Bool m_bModifyPasswordEntered; SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); virtual ~SfxObjectShell_Impl(); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 2291e8079b3a..1d61b09fdd63 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -71,6 +71,7 @@ #include #include #include +#include #include #include @@ -86,6 +87,7 @@ #include #include #include +#include #include #include @@ -113,6 +115,7 @@ namespace css = ::com::sun::star; #include "sfxtypes.hxx" #include #include +#include #include #include "sfxresid.hxx" #include "appbas.hxx" @@ -158,6 +161,48 @@ TYPEINIT1(SfxViewFrameItem, SfxPoolItem); //========================================================================= +static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const ::rtl::OUString& aPath, const SfxFilter* pFilter, sal_uInt16 nPasswordHash ) +{ + sal_Bool bResult = !nPasswordHash; + + OSL_ENSURE( pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ), "PasswordToModify feature is active for a filter that does not support it!" ); + + if ( pFilter && xHandler.is() ) + { + sal_Bool bCancel = sal_False; + sal_Bool bFirstTime = sal_True; + + while ( !bResult && !bCancel ) + { + sal_Bool bMSType = !pFilter->IsOwnFormat(); + ::comphelper::DocPasswordRequestType nType = bMSType ? + ::comphelper::DocPasswordRequestType_MS : + ::comphelper::DocPasswordRequestType_STANDARD; + + ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( + new ::comphelper::DocPasswordRequest( + bMSType ? ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD, + bFirstTime ? ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER : ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER, + aPath, + sal_True ) ); + + uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() ); + xHandler->handle( rRequest ); + + if ( pPasswordRequest->isPassword() ) + bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), bMSType ) == nPasswordHash ); + else + bCancel = sal_True; + + bFirstTime = sal_False; + } + } + + return bResult; +} + +//========================================================================= + struct SfxViewFrame_Impl { SvBorder aBorder; @@ -371,10 +416,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) if( !pSh || !pSh->HasName() || !(pSh->Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT )) break; + SfxMedium* pMed = pSh->GetMedium(); + SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_VIEWONLY, sal_False ); if ( pItem && pItem->GetValue() ) { - SfxMedium* pMed = pSh->GetMedium(); SfxApplication* pApp = SFX_APP(); SfxAllItemSet aSet( pApp->GetPool() ); aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetURLObject().GetMainURL(INetURLObject::NO_DECODE) ) ); @@ -417,6 +463,22 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } else { + if ( pSh->IsReadOnlyMedium() + && pSh->GetModifyPasswordHash() + && !pSh->IsModifyPasswordEntered() ) + { + ::rtl::OUString aDocumentName = INetURLObject( pMed->GetOrigURL() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); + if( !AskPasswordToModify_Impl( pMed->GetInteractionHandler(), aDocumentName, pMed->GetOrigFilter(), pSh->GetModifyPasswordHash() ) ) + { + // this is a read-only document, if it has "Password to modify" + // the user should enter password before he can edit the document + rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_False ) ); + return; + } + + pSh->SetModifyPasswordEntered(); + } + nOpenMode = SFX_STREAM_READWRITE; pSh->SetReadOnlyUI( sal_False ); @@ -436,142 +498,138 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } // doing - if( pSh ) + String aTemp; + utl::LocalFileHelper::ConvertPhysicalNameToURL( pMed->GetPhysicalName(), aTemp ); + INetURLObject aPhysObj( aTemp ); + SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), + pVersionItem, SfxInt16Item, SID_VERSION, sal_False ); + + INetURLObject aMedObj( pMed->GetName() ); + + // the logic below is following, if the document seems not to need to be reloaded and the physical name is different + // to the logical one, then on file system it can be checked that the copy is still newer than the original and no document reload is required + if ( ( !bNeedsReload && ( (aMedObj.GetProtocol() == INET_PROT_FILE && + aMedObj.getFSysPath(INetURLObject::FSYS_DETECT) != aPhysObj.getFSysPath(INetURLObject::FSYS_DETECT) && + !::utl::UCBContentHelper::IsYounger( aMedObj.GetMainURL( INetURLObject::NO_DECODE ), aPhysObj.GetMainURL( INetURLObject::NO_DECODE ) )) + || pMed->IsRemote() ) ) + || pVersionItem ) { - SfxMedium* pMed = pSh->GetMedium(); - String aTemp; - utl::LocalFileHelper::ConvertPhysicalNameToURL( pMed->GetPhysicalName(), aTemp ); - INetURLObject aPhysObj( aTemp ); - SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), - pVersionItem, SfxInt16Item, SID_VERSION, sal_False ); - - INetURLObject aMedObj( pMed->GetName() ); - - // the logic below is following, if the document seems not to need to be reloaded and the physical name is different - // to the logical one, then on file system it can be checked that the copy is still newer than the original and no document reload is required - if ( ( !bNeedsReload && ( (aMedObj.GetProtocol() == INET_PROT_FILE && - aMedObj.getFSysPath(INetURLObject::FSYS_DETECT) != aPhysObj.getFSysPath(INetURLObject::FSYS_DETECT) && - !::utl::UCBContentHelper::IsYounger( aMedObj.GetMainURL( INetURLObject::NO_DECODE ), aPhysObj.GetMainURL( INetURLObject::NO_DECODE ) )) - || pMed->IsRemote() ) ) - || pVersionItem ) + sal_Bool bOK = sal_False; + if ( !pVersionItem ) { - sal_Bool bOK = sal_False; - if ( !pVersionItem ) + sal_Bool bHasStorage = pMed->HasStorage_Impl(); + // switching edit mode could be possible without reload + if ( bHasStorage && pMed->GetStorage() == pSh->GetStorage() ) { - sal_Bool bHasStorage = pMed->HasStorage_Impl(); - // switching edit mode could be possible without reload - if ( bHasStorage && pMed->GetStorage() == pSh->GetStorage() ) - { - // TODO/LATER: faster creation of copy - if ( !pSh->ConnectTmpStorage_Impl( pMed->GetStorage(), pMed ) ) - return; - } + // TODO/LATER: faster creation of copy + if ( !pSh->ConnectTmpStorage_Impl( pMed->GetStorage(), pMed ) ) + return; + } - pMed->CloseAndRelease(); - pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) ); - pMed->SetOpenMode( nOpenMode, pMed->IsDirect() ); + pMed->CloseAndRelease(); + pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) ); + pMed->SetOpenMode( nOpenMode, pMed->IsDirect() ); - pMed->CompleteReOpen(); - if ( nOpenMode & STREAM_WRITE ) - pMed->LockOrigFileOnDemand( sal_False, sal_True ); + pMed->CompleteReOpen(); + if ( nOpenMode & STREAM_WRITE ) + pMed->LockOrigFileOnDemand( sal_False, sal_True ); - // LockOrigFileOnDemand might set the readonly flag itself, it should be set back - pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) ); + // LockOrigFileOnDemand might set the readonly flag itself, it should be set back + pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) ); - if ( !pMed->GetErrorCode() ) - bOK = sal_True; - } + if ( !pMed->GetErrorCode() ) + bOK = sal_True; + } - if( !bOK ) + if( !bOK ) + { + ErrCode nErr = pMed->GetErrorCode(); + if ( pVersionItem ) + nErr = ERRCODE_IO_ACCESSDENIED; + else { - ErrCode nErr = pMed->GetErrorCode(); - if ( pVersionItem ) - nErr = ERRCODE_IO_ACCESSDENIED; - else - { - pMed->ResetError(); - pMed->SetOpenMode( SFX_STREAM_READONLY, pMed->IsDirect() ); - pMed->ReOpen(); - pSh->DoSaveCompleted( pMed ); - } + pMed->ResetError(); + pMed->SetOpenMode( SFX_STREAM_READONLY, pMed->IsDirect() ); + pMed->ReOpen(); + pSh->DoSaveCompleted( pMed ); + } - // r/o-Doc kann nicht in Editmode geschaltet werden? - rReq.Done( sal_False ); + // r/o-Doc kann nicht in Editmode geschaltet werden? + rReq.Done( sal_False ); - SFX_REQUEST_ARG( rReq, pFSetItem, SfxBoolItem, SID_EDIT_FRAMESET, sal_False); - if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() ) + SFX_REQUEST_ARG( rReq, pFSetItem, SfxBoolItem, SID_EDIT_FRAMESET, sal_False); + if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() ) + { + // dem ::com::sun::star::sdbcx::User anbieten, als Vorlage zu oeffnen + QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) ); + if ( !pFSetItem && RET_YES == aBox.Execute() ) { - // dem ::com::sun::star::sdbcx::User anbieten, als Vorlage zu oeffnen - QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) ); - if ( !pFSetItem && RET_YES == aBox.Execute() ) + SfxApplication* pApp = SFX_APP(); + SfxAllItemSet aSet( pApp->GetPool() ); + aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) ); + SFX_ITEMSET_ARG( pMed->GetItemSet(), pReferer, SfxStringItem, SID_REFERER, sal_False ); + if ( pReferer ) + aSet.Put( *pReferer ); + aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); + if ( pVersionItem ) + aSet.Put( *pVersionItem ); + + if( pMed->GetFilter() ) { - SfxApplication* pApp = SFX_APP(); - SfxAllItemSet aSet( pApp->GetPool() ); - aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) ); - SFX_ITEMSET_ARG( pMed->GetItemSet(), pReferer, SfxStringItem, SID_REFERER, sal_False ); - if ( pReferer ) - aSet.Put( *pReferer ); - aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); - if ( pVersionItem ) - aSet.Put( *pVersionItem ); - - if( pMed->GetFilter() ) - { - aSet.Put( SfxStringItem( SID_FILTER_NAME, pMed->GetFilter()->GetFilterName() ) ); - SFX_ITEMSET_ARG( pMed->GetItemSet(), pOptions, - SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False ); - if ( pOptions ) - aSet.Put( *pOptions ); - } - - GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, aSet ); - return; + aSet.Put( SfxStringItem( SID_FILTER_NAME, pMed->GetFilter()->GetFilterName() ) ); + SFX_ITEMSET_ARG( pMed->GetItemSet(), pOptions, + SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False ); + if ( pOptions ) + aSet.Put( *pOptions ); } - else - nErr = 0; - } - ErrorHandler::HandleError( nErr ); - rReq.SetReturnValue( - SfxBoolItem( rReq.GetSlot(), sal_False ) ); - return; - } - else - { - pSh->DoSaveCompleted( pMed ); - pSh->Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); - rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_True ) ); - rReq.Done( sal_True ); - // if( nOpenMode == SFX_STREAM_READONLY ) - // pMed->Close(); - - // ReloadForEdit bei Framesets schaltet auch FramesetEditmode - sal_Bool bIsReadonly = GetObjectShell()->IsReadOnly(); - if ( bIsReadonly != bWasReadonly && !GetFrame()->GetParentFrame() ) - { - SfxBoolItem aItem( SID_EDIT_FRAMESET, !bIsReadonly ); - GetDispatcher()->Execute( SID_EDIT_FRAMESET, - SFX_CALLMODE_RECORD, &aItem, 0L ); - pSh->Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); + GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, aSet ); + return; } - return; + else + nErr = 0; } - } - /* - if ( !bReload ) - { - // Es soll nicht reloaded werden - SfxErrorContext aEc( ERRCODE_SFX_NODOCRELOAD ); - ErrorHandler::HandleError( ERRCODE_SFX_NODOCRELOAD ); + ErrorHandler::HandleError( nErr ); rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_False ) ); return; } - */ - // Ansonsten ( lokal und arbeiten auf Kopie ) muss gereloaded - // werden. + else + { + pSh->DoSaveCompleted( pMed ); + pSh->Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); + rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_True ) ); + rReq.Done( sal_True ); + // if( nOpenMode == SFX_STREAM_READONLY ) + // pMed->Close(); + + // ReloadForEdit bei Framesets schaltet auch FramesetEditmode + sal_Bool bIsReadonly = GetObjectShell()->IsReadOnly(); + if ( bIsReadonly != bWasReadonly && !GetFrame()->GetParentFrame() ) + { + SfxBoolItem aItem( SID_EDIT_FRAMESET, !bIsReadonly ); + GetDispatcher()->Execute( SID_EDIT_FRAMESET, + SFX_CALLMODE_RECORD, &aItem, 0L ); + pSh->Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); + } + return; + } + } + + /* + if ( !bReload ) + { + // Es soll nicht reloaded werden + SfxErrorContext aEc( ERRCODE_SFX_NODOCRELOAD ); + ErrorHandler::HandleError( ERRCODE_SFX_NODOCRELOAD ); + rReq.SetReturnValue( + SfxBoolItem( rReq.GetSlot(), sal_False ) ); + return; } + */ + // Ansonsten ( lokal und arbeiten auf Kopie ) muss gereloaded + // werden. rReq.AppendItem( SfxBoolItem( SID_FORCERELOAD, sal_True) ); rReq.AppendItem( SfxBoolItem( SID_SILENT, sal_True )); diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index 51556e88bb0f..7103fee29510 100755 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -32,6 +32,7 @@ #include "com/sun/star/task/MasterPasswordRequest.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionPassword.hpp" +#include "com/sun/star/task/XInteractionPassword2.hpp" #include "com/sun/star/task/XInteractionRetry.hpp" #include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp" #include "com/sun/star/ucb/URLAuthenticationRequest.hpp" @@ -431,7 +432,7 @@ executePasswordDialog( pFact->CreatePasswordToOpenModifyDialog( pParent, 0, nMaxPasswdLen ) ); rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL ); - rInfo.SetPasswordToOpen( pDialog->GetPasswordToOpen() ); + rInfo.SetPassword( pDialog->GetPasswordToOpen() ); rInfo.SetPasswordToModify( pDialog->GetPasswordToModify() ); rInfo.SetRecommendToOpenReadonly( pDialog->IsRecommendToOpenReadonly() ); } @@ -441,7 +442,7 @@ executePasswordDialog( new PasswordDialog( pParent, nMode, xManager.get(), aDocName, bIsPasswordToModify ) ); rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL ); - rInfo.SetPasswordToOpen( bIsPasswordToModify ? String() : pDialog->GetPassword() ); + rInfo.SetPassword( bIsPasswordToModify ? String() : pDialog->GetPassword() ); rInfo.SetPasswordToModify( bIsPasswordToModify ? pDialog->GetPassword() : String() ); } } @@ -467,7 +468,12 @@ handlePasswordRequest_( uno::Reference< task::XInteractionRetry > xRetry; uno::Reference< task::XInteractionAbort > xAbort; uno::Reference< task::XInteractionPassword > xPassword; - getContinuations(rContinuations, &xRetry, &xAbort, &xPassword); + uno::Reference< task::XInteractionPassword2 > xPassword2; + getContinuations(rContinuations, &xRetry, &xAbort, &xPassword2, &xPassword); + + if ( xPassword2.is() && !xPassword.is() ) + xPassword.set( xPassword2, uno::UNO_QUERY_THROW ); + LoginErrorInfo aInfo; executePasswordDialog( pParent, aInfo, nMode, @@ -476,8 +482,15 @@ handlePasswordRequest_( switch (aInfo.GetResult()) { case ERRCODE_BUTTON_OK: + OSL_ENSURE( !bIsPasswordToModify || xPassword2.is(), "PasswordToModify is requested, but there is no Interaction!" ); if (xPassword.is()) { + if (xPassword2.is()) + { + xPassword2->setPasswordToModify( aInfo.GetPasswordToModify() ); + xPassword2->setRecommendReadOnly( aInfo.IsRecommendToOpenReadonly() ); + } + xPassword->setPassword(aInfo.GetPassword()); xPassword->select(); } @@ -593,7 +606,7 @@ UUIInteractionHelper::handlePasswordRequest( nMode = aDocumentMSPasswordRequest2.Mode; aDocumentName = aDocumentMSPasswordRequest2.Name; bMSCryptoMode = true; - bIsPasswordToModify = aDocumentPasswordRequest2.IsRequestPasswordToModify; + bIsPasswordToModify = aDocumentMSPasswordRequest2.IsRequestPasswordToModify; bDoHandleRequest = true; } diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx index d16e1a541710..2e0009900d86 100755 --- a/uui/source/loginerr.hxx +++ b/uui/source/loginerr.hxx @@ -25,143 +25,139 @@ * ************************************************************************/ -#ifndef _LOGINERR_HXX -#define _LOGINERR_HXX +#ifndef m_LOGINERR_HXX +#define m_LOGINERR_HXX #include //========================================================================= -#define LOGINERROR_FLAG_SET_SAVE_PASSWORD 1 -#define LOGINERROR_FLAG_MODIFY_ACCOUNT 2 +#define LOGINERROR_FLAG_SET_SAVE_PASSWORD 1 +#define LOGINERROR_FLAG_MODIFY_ACCOUNT 2 #define LOGINERROR_FLAG_MODIFY_USER_NAME 4 -#define LOGINERROR_FLAG_PERSISTENT_PASSWORD 8 +#define LOGINERROR_FLAG_PERSISTENT_PASSWORD 8 #define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16 -#define LOGINERROR_FLAG_IS_USE_SYSCREDS 32 +#define LOGINERROR_FLAG_IS_USE_SYSCREDS 32 class LoginErrorInfo { private: - String _aTitle; - String _aServer; - String _aAccount; - String _aUserName; - String _aPassword; - String _aPasswordToOpen; - String _aPasswordToModify; - String _aPath; - String _aErrorText; - BYTE _nFlags; - USHORT _nRet; - bool _bRecommendToOpenReadonly; + String m_aTitle; + String m_aServer; + String m_aAccount; + String m_aUserName; + String m_aPassword; + String m_aPasswordToModify; + String m_aPath; + String m_aErrorText; + BYTE m_nFlags; + USHORT m_nRet; + bool m_bRecommendToOpenReadonly; public: LoginErrorInfo() - : _nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ), - _nRet( ERRCODE_BUTTON_CANCEL ) + : m_nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ), + m_nRet( ERRCODE_BUTTON_CANCEL ) { } - const String& GetTitle() const { return _aTitle; } - const String& GetServer() const { return _aServer; } - const String& GetAccount() const { return _aAccount; } - const String& GetUserName() const { return _aUserName; } - const String& GetPassword() const { return _aPassword; } - const String& GetPasswordToOpen() const { return _aPasswordToOpen; } - const String& GetPasswordToModify() const { return _aPasswordToModify; } - const bool IsRecommendToOpenReadonly() const { return _bRecommendToOpenReadonly; } - const String& GetPath() const { return _aPath; } - const String& GetErrorText() const { return _aErrorText; } - BOOL GetIsPersistentPassword() const - { return ( _nFlags & LOGINERROR_FLAG_PERSISTENT_PASSWORD ); } - BOOL GetIsSavePassword() const - { return ( _nFlags & LOGINERROR_FLAG_SET_SAVE_PASSWORD ); } + const String& GetTitle() const { return m_aTitle; } + const String& GetServer() const { return m_aServer; } + const String& GetAccount() const { return m_aAccount; } + const String& GetUserName() const { return m_aUserName; } + const String& GetPassword() const { return m_aPassword; } + const String& GetPasswordToModify() const { return m_aPasswordToModify; } + const bool IsRecommendToOpenReadonly() const { return m_bRecommendToOpenReadonly; } + const String& GetPath() const { return m_aPath; } + const String& GetErrorText() const { return m_aErrorText; } + BOOL GetIsPersistentPassword() const + { return ( m_nFlags & LOGINERROR_FLAG_PERSISTENT_PASSWORD ); } + BOOL GetIsSavePassword() const + { return ( m_nFlags & LOGINERROR_FLAG_SET_SAVE_PASSWORD ); } BOOL GetCanUseSystemCredentials() const - { return ( _nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); } + { return ( m_nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); } BOOL GetIsUseSystemCredentials() const - { return ( _nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) == + { return ( m_nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) == LOGINERROR_FLAG_IS_USE_SYSCREDS; } - BYTE GetFlags() const { return _nFlags; } - USHORT GetResult() const { return _nRet; } + BYTE GetFlags() const { return m_nFlags; } + USHORT GetResult() const { return m_nRet; } - void SetTitle( const String& aTitle ) - { _aTitle = aTitle; } - void SetServer( const String& aServer ) - { _aServer = aServer; } - void SetAccount( const String& aAccount ) - { _aAccount = aAccount; } - void SetUserName( const String& aUserName ) - { _aUserName = aUserName; } + void SetTitle( const String& aTitle ) + { m_aTitle = aTitle; } + void SetServer( const String& aServer ) + { m_aServer = aServer; } + void SetAccount( const String& aAccount ) + { m_aAccount = aAccount; } + void SetUserName( const String& aUserName ) + { m_aUserName = aUserName; } void SetPassword( const String& aPassword ) - { _aPassword = aPassword; } - void SetPasswordToOpen( const String& aPassword ) - { _aPasswordToOpen = aPassword; } + { m_aPassword = aPassword; } void SetPasswordToModify( const String& aPassword ) - { _aPasswordToModify = aPassword; } + { m_aPasswordToModify = aPassword; } void SetRecommendToOpenReadonly( bool bVal ) - { _bRecommendToOpenReadonly = bVal; } - void SetPath( const String& aPath ) - { _aPath = aPath; } - void SetErrorText( const String& aErrorText ) - { _aErrorText = aErrorText; } + { m_bRecommendToOpenReadonly = bVal; } + void SetPath( const String& aPath ) + { m_aPath = aPath; } + void SetErrorText( const String& aErrorText ) + { m_aErrorText = aErrorText; } void SetFlags( BYTE nFlags ) - { _nFlags = nFlags; } - inline void SetSavePassword( BOOL bSet ); - inline void SetPersistentPassword( BOOL bSet ); + { m_nFlags = nFlags; } + inline void SetSavePassword( BOOL bSet ); + inline void SetPersistentPassword( BOOL bSet ); inline void SetCanUseSystemCredentials( BOOL bSet ); inline void SetIsUseSystemCredentials( BOOL bSet ); - inline void SetModifyAccount( BOOL bSet ); - inline void SetModifyUserName( BOOL bSet ); + inline void SetModifyAccount( BOOL bSet ); + inline void SetModifyUserName( BOOL bSet ); void SetResult( USHORT nRet ) - { _nRet = nRet; } + { m_nRet = nRet; } }; inline void LoginErrorInfo::SetSavePassword( BOOL bSet ) { if ( bSet ) - _nFlags |= LOGINERROR_FLAG_SET_SAVE_PASSWORD; + m_nFlags |= LOGINERROR_FLAG_SET_SAVE_PASSWORD; else - _nFlags &= ~LOGINERROR_FLAG_SET_SAVE_PASSWORD; + m_nFlags &= ~LOGINERROR_FLAG_SET_SAVE_PASSWORD; } inline void LoginErrorInfo::SetPersistentPassword( BOOL bSet ) { if ( bSet ) - _nFlags |= LOGINERROR_FLAG_PERSISTENT_PASSWORD; + m_nFlags |= LOGINERROR_FLAG_PERSISTENT_PASSWORD; else - _nFlags &= ~LOGINERROR_FLAG_PERSISTENT_PASSWORD; + m_nFlags &= ~LOGINERROR_FLAG_PERSISTENT_PASSWORD; } inline void LoginErrorInfo::SetCanUseSystemCredentials( BOOL bSet ) { if ( bSet ) - _nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS; + m_nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS; else - _nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS; + m_nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS; } inline void LoginErrorInfo::SetIsUseSystemCredentials( BOOL bSet ) { if ( bSet ) - _nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS; + m_nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS; else - _nFlags &= ~LOGINERROR_FLAG_IS_USE_SYSCREDS; + m_nFlags &= ~LOGINERROR_FLAG_IS_USE_SYSCREDS; } inline void LoginErrorInfo::SetModifyAccount( BOOL bSet ) { if ( bSet ) - _nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT; + m_nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT; else - _nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT; + m_nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT; } inline void LoginErrorInfo::SetModifyUserName( BOOL bSet ) { if ( bSet ) - _nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME; + m_nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME; else - _nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME; + m_nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME; } #endif -- cgit From 9bfe25036358e6befdb2e9ddcbc1084f6a3d8c7f Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Fri, 23 Apr 2010 11:43:48 +0200 Subject: jl152 import 263450 from native0jl:#i77196# XExtensionManager.isReadOnlyRepositor, fixed removing xcu exceptions, executable backend --- .../deployment/manager/dp_commandenvironments.cxx | 31 ++++ .../deployment/manager/dp_commandenvironments.hxx | 18 ++- .../deployment/manager/dp_extensionmanager.cxx | 4 + .../deployment/manager/dp_extensionmanager.hxx | 2 + desktop/source/deployment/manager/dp_manager.cxx | 3 + .../source/deployment/registry/dp_backenddb.cxx | 8 +- .../registry/executable/dp_executable.cxx | 61 ++++++-- .../registry/executable/dp_executablebackenddb.cxx | 165 +++++++++++++++++++++ .../registry/executable/dp_executablebackenddb.hxx | 91 ++++++++++++ .../deployment/registry/executable/makefile.mk | 3 +- .../deployment/registry/help/dp_helpbackenddb.cxx | 24 --- .../deployment/registry/package/dp_package.cxx | 6 - .../deployment/registry/script/dp_script.cxx | 17 ++- 13 files changed, 382 insertions(+), 51 deletions(-) create mode 100644 desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx create mode 100644 desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx diff --git a/desktop/source/deployment/manager/dp_commandenvironments.cxx b/desktop/source/deployment/manager/dp_commandenvironments.cxx index 814dc818b2a6..c2801ba1d965 100644 --- a/desktop/source/deployment/manager/dp_commandenvironments.cxx +++ b/desktop/source/deployment/manager/dp_commandenvironments.cxx @@ -250,6 +250,37 @@ void NoLicenseCommandEnv::handle( handle_(approve, abort, xRequest); } + +// NoExceptionCommandEnv::NoExceptionCommandEnv( +// css::uno::Reference< css::task::XInteractionHandler> const & handler, +// css::uno::Type const & type): +// BaseCommandEnv(handler), +// m_type(type) +// { +// } +// // XInteractionHandler +// void NoExceptionCommandEnv::handle( +// Reference< task::XInteractionRequest> const & xRequest ) +// throw (uno::RuntimeException) +// { +// uno::Any request( xRequest->getRequest() ); +// OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); + + +// deployment::LicenseException licExc; + +// bool approve = false; +// bool abort = false; + +// if (request.getValueType() == m_type) +// { +// approve = true; +// } +// handle_(approve, abort, xRequest); +// } + + + } // namespace dp_manager diff --git a/desktop/source/deployment/manager/dp_commandenvironments.hxx b/desktop/source/deployment/manager/dp_commandenvironments.hxx index ad47fd2af549..0bdad4fd09cc 100644 --- a/desktop/source/deployment/manager/dp_commandenvironments.hxx +++ b/desktop/source/deployment/manager/dp_commandenvironments.hxx @@ -32,7 +32,7 @@ #include "cppuhelper/compbase3.hxx" //#include "cppuhelper/implbase2.hxx" #include "ucbhelper/content.hxx" - +#include "com/sun/star/uno/Type.hxx" namespace css = ::com::sun::star; @@ -137,6 +137,22 @@ public: }; +// class NoExceptionCommandEnv : public BaseCommandEnv +// { +// css::uno::Type m_type; +// public: +// NoExceptionCommandEnv::NoExceptionCommandEnv(){}; +// NoExceptionCommandEnv::NoExceptionCommandEnv( +// css::uno::Reference< css::task::XInteractionHandler> const & handler, +// css::uno::Type const & type); + +// // XInteractionHandler +// virtual void SAL_CALL handle( +// css::uno::Reference const & xRequest ) +// throw (css::uno::RuntimeException); + +// }; + } diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index bbe476e57fba..44f34991889e 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -1224,6 +1224,10 @@ ExtensionManager::getExtensionsWithUnacceptedLicenses( return xPackageManager->getExtensionsWithUnacceptedLicenses(xCmdEnv); } +sal_Bool ExtensionManager::isReadOnlyRepository(::rtl::OUString const & repository) +{ + return getPackageManager(repository)->isReadOnly(); +} //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index 10bf3713c410..158fd35e2fa0 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -202,6 +202,8 @@ public: throw (css::deployment::DeploymentException, css::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnlyRepository(::rtl::OUString const & repository); + private: struct StrSyncRepository : public ::dp_misc::StaticResourceString< diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 8c55f2508680..83105406f253 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -1368,6 +1368,9 @@ void PackageManagerImpl::synchronizeAddedExtensions( rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8); + //It it sufficient to check for the folder name, because when the administor + //installed the extension it was already checked if there is one with the + //same identifier. const MatchTempDir match(titleEncoded); if (::std::find_if( id2temp.begin(), id2temp.end(), match ) == id2temp.end()) diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx index 1c0451c77cd6..fe8b39b94d44 100644 --- a/desktop/source/deployment/registry/dp_backenddb.cxx +++ b/desktop/source/deployment/registry/dp_backenddb.cxx @@ -150,7 +150,7 @@ void BackendDb::removeElement(::rtl::OUString const & sXPathExpression) //find the extension element that is to be removed Reference aNode = xpathApi->selectSingleNode(root, sXPathExpression); - OSL_ASSERT(aNode.is()); + if (aNode.is()) { root->removeChild(aNode); @@ -174,6 +174,7 @@ void BackendDb::removeElement(::rtl::OUString const & sXPathExpression) } +//Only writes the data if there is at least one entry void BackendDb::writeVectorOfPair( ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > const & vecPairs, OUString const & sVectorTagName, @@ -183,6 +184,8 @@ void BackendDb::writeVectorOfPair( css::uno::Reference const & xParent) { try{ + if (vecPairs.size() == 0) + return; const OUString sNameSpace = getDbNSName(); OSL_ASSERT(sNameSpace.getLength()); Reference doc = getDocument(); @@ -287,6 +290,7 @@ BackendDb::readVectorOfPair( } } +//Only writes the data if there is at least one entry void BackendDb::writeSimpleList( ::std::list< ::rtl::OUString> const & list, OUString const & sListTagName, @@ -295,6 +299,8 @@ void BackendDb::writeSimpleList( { try { + if (list.size() == 0) + return; const OUString sNameSpace = getDbNSName(); Reference doc = getDocument(); diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx index ac83302f9fb4..c72a97d88891 100644 --- a/desktop/source/deployment/registry/executable/dp_executable.cxx +++ b/desktop/source/deployment/registry/executable/dp_executable.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_desktop.hxx" +#include "dp_misc.h" #include "dp_backend.h" #include "dp_ucb.h" #include "dp_interact.h" @@ -37,10 +38,12 @@ #include "comphelper/servicedecl.hxx" #include "svl/inettype.hxx" #include "cppuhelper/implbase1.hxx" +#include "dp_executablebackenddb.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; +using namespace dp_misc; using ::rtl::OUString; namespace dp_registry { @@ -68,7 +71,6 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend bool getFileAttributes(sal_uInt64& out_Attributes); bool isUrlTargetInExtension(); - public: inline ExecutablePackageImpl( ::rtl::Reference const & myBackend, @@ -89,8 +91,12 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend OUString const & url, OUString const & mediaType, sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ); - Reference m_xExecutableTypeInfo; + void addDataToDb(OUString const & url); + bool isRegisteredInDb(OUString const & url); + void deleteDataFromDb(OUString const & url); + Reference m_xExecutableTypeInfo; + std::auto_ptr m_backendDb; public: BackendImpl( Sequence const & args, Reference const & xComponentContext ); @@ -114,7 +120,32 @@ BackendImpl::BackendImpl( RID_IMG_COMPONENT, RID_IMG_COMPONENT_HC ) ) { + if (!transientMode()) + { + OUString dbFile = makeURL(getCachePath(), OUSTR("backenddb.xml")); + m_backendDb.reset( + new ExecutableBackendDb(getComponentContext(), dbFile)); + } +} +void BackendImpl::addDataToDb(OUString const & url) +{ + if (m_backendDb.get()) + m_backendDb->addEntry(url); +} + +bool BackendImpl::isRegisteredInDb(OUString const & url) +{ + bool ret = false; + if (m_backendDb.get()) + ret = m_backendDb->getEntry(url); + return ret; +} + +void BackendImpl::deleteDataFromDb(OUString const & url) +{ + if (m_backendDb.get()) + m_backendDb->removeEntry(url); } // XPackageRegistry @@ -186,18 +217,11 @@ BackendImpl::ExecutablePackageImpl::isRegistered_( ::rtl::Reference const &, Reference const & ) { - //We must return Optional.isPresent = true, otherwise - //processPackage is not called. - //The user shall not be able to enable/disable the executable. This is not needed since - //the executable does not affect the office. The best thing is to show no - //status at all. See also BackendImpl::PackageImpl::isRegistered_ (dp_package.cxx) - //On Windows there is no executable file attribute. One has to use security API for this. - //However, on Windows we do not have the problem, that after unzipping the file cannot be - //executed. + bool registered = getMyBackend()->isRegisteredInDb(getURL()); return beans::Optional< beans::Ambiguous >( sal_True /* IsPresent */, beans::Ambiguous( - sal_True, sal_True /* IsAmbiguous */ ) ); + registered, sal_False /* IsAmbiguous */ ) ); } void BackendImpl::ExecutablePackageImpl::processPackage_( @@ -224,7 +248,9 @@ void BackendImpl::ExecutablePackageImpl::processPackage_( else if (getMyBackend()->m_context.equals(OUSTR("shared"))) attributes |= (osl_File_Attribute_OwnExe | osl_File_Attribute_GrpExe | osl_File_Attribute_OthExe); - else + else if (!getMyBackend()->m_context.equals(OUSTR("bundled"))) + //Bundled extension are required to be in the properly + //installed. That is an executable must have the right flags OSL_ASSERT(0); //This won't have affect on Windows @@ -232,11 +258,18 @@ void BackendImpl::ExecutablePackageImpl::processPackage_( dp_misc::expandUnoRcUrl(m_url), attributes)) OSL_ENSURE(0, "Extension Manager: Could not set executable file attribute."); } + getMyBackend()->addDataToDb(getURL()); + } + else + { + getMyBackend()->deleteDataFromDb(getURL()); } } -//We currently cannot check if this XPackage represents a content of a particular exension +//We currently cannot check if this XPackage represents a content of a particular extension //But we can check if we are within $UNO_USER_PACKAGES_CACHE etc. +//Done for security reasons. For example an extension manifest could contain a path to +//an executable outside the extension. bool BackendImpl::ExecutablePackageImpl::isUrlTargetInExtension() { bool bSuccess = false; @@ -245,6 +278,8 @@ bool BackendImpl::ExecutablePackageImpl::isUrlTargetInExtension() sExtensionDir = dp_misc::expandUnoRcTerm(OUSTR("$UNO_USER_PACKAGES_CACHE")); else if (getMyBackend()->m_context.equals(OUSTR("shared"))) sExtensionDir = dp_misc::expandUnoRcTerm(OUSTR("$UNO_SHARED_PACKAGES_CACHE")); + else if (getMyBackend()->m_context.equals(OUSTR("bundled"))) + sExtensionDir = dp_misc::expandUnoRcTerm(OUSTR("$BUNDLED_EXTENSIONS")); else OSL_ASSERT(0); //remove file ellipses diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx new file mode 100644 index 000000000000..893a58ee8c64 --- /dev/null +++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx @@ -0,0 +1,165 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dp_package.cxx,v $ + * $Revision: 1.34.16.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "rtl/string.h" +#include "rtl/bootstrap.hxx" +#include "cppuhelper/exc_hlp.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/xml/dom/XDocumentBuilder.hpp" +#include "com/sun/star/xml/xpath/XXPathAPI.hpp" +#include "dp_misc.h" + +#include "dp_executablebackenddb.hxx" + + +namespace css = ::com::sun::star; +using namespace ::com::sun::star::uno; +using ::rtl::OUString; + +#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/executable-registry/2010" +#define NS_PREFIX "exe" +#define ROOT_ELEMENT_NAME "executable-backend-db" + +namespace dp_registry { +namespace backend { +namespace executable { + +ExecutableBackendDb::ExecutableBackendDb( + Reference const & xContext, + ::rtl::OUString const & url):BackendDb(xContext, url) +{ + +} + +OUString ExecutableBackendDb::getDbNSName() +{ + return OUSTR(EXTENSION_REG_NS); +} + +OUString ExecutableBackendDb::getNSPrefix() +{ + return OUSTR(NS_PREFIX); +} + +OUString ExecutableBackendDb::getRootElementName() +{ + return OUSTR(ROOT_ELEMENT_NAME); +} + +void ExecutableBackendDb::addEntry(::rtl::OUString const & url) +{ + try{ + + const OUString sNameSpace = getDbNSName(); + const OUString sPrefix = getNSPrefix(); + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + +#if OSL_DEBUG_LEVEL > 0 + //There must not be yet an entry with the same url + OUString sExpression( + sPrefix + OUSTR(":executable[@url = \"") + url + OUSTR("\"]")); + Reference _extensionNode = + getXPathAPI()->selectSingleNode(root, sExpression); + OSL_ASSERT(! _extensionNode.is()); +#endif + Reference helpElement( + doc->createElementNS(sNameSpace, sPrefix + OUSTR(":executable"))); + + helpElement->setAttribute(OUSTR("url"), url); + + Reference helpNode( + helpElement, UNO_QUERY_THROW); + root->appendChild(helpNode); + +// Reference dataNode( +// doc->createElementNS(sNameSpace, sPrefix + OUSTR(":data-url")), +// UNO_QUERY_THROW); +// helpNode->appendChild(dataNode); + +// Reference dataValue( +// doc->createTextNode(data.dataUrl), UNO_QUERY_THROW); +// dataNode->appendChild(dataValue); + + save(); + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to write data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + +void ExecutableBackendDb::removeEntry(::rtl::OUString const & url) +{ + OUString sExpression( + OUSTR(NS_PREFIX) + OUSTR(":executable[@url = \"") + url + OUSTR("\"]")); + removeElement(sExpression); +} + +bool ExecutableBackendDb::getEntry(::rtl::OUString const & url) +{ + try + { + const OUString sPrefix = getNSPrefix(); + const OUString sExpression( + sPrefix + OUSTR(":executable[@url = \"") + url + OUSTR("\"]")); + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + + Reference xpathApi = getXPathAPI(); + //find the extension element that is to be removed + Reference aNode = + xpathApi->selectSingleNode(root, sExpression); + if (!aNode.is()) + { + return false; + } + return true; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + + +} // namespace executable +} // namespace backend +} // namespace dp_registry + diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx new file mode 100644 index 000000000000..2634d1d9d376 --- /dev/null +++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dp_backend.h,v $ + * $Revision: 1.18 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_DP_EXECUTABLEBACKENDDB_HXX +#define INCLUDED_DP_EXECUTABLEBACKENDDB_HXX + +#include "rtl/ustring.hxx" +#include "rtl/string.hxx" +#include +#include +#include "boost/optional.hpp" +#include "dp_backenddb.hxx" + +namespace css = ::com::sun::star; + +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + } + namespace xml { namespace dom { + class XDocument; + class XNode; + }} + namespace xml { namespace xpath { + class XXPathAPI; + }} +}}} + +namespace dp_registry { +namespace backend { +namespace executable { + +/* The XML file stores the extensions which are currently registered. + They will be removed when they are revoked. + The format looks like this: + + + */ +class ExecutableBackendDb: public dp_registry::backend::BackendDb +{ +protected: + virtual ::rtl::OUString getDbNSName(); + + virtual ::rtl::OUString getNSPrefix(); + + virtual ::rtl::OUString getRootElementName(); + +public: + + ExecutableBackendDb( css::uno::Reference const & xContext, + ::rtl::OUString const & url); + + void addEntry(::rtl::OUString const & url); + void removeEntry(::rtl::OUString const & url); + bool getEntry(::rtl::OUString const & url); +}; + + + +} +} +} +#endif + diff --git a/desktop/source/deployment/registry/executable/makefile.mk b/desktop/source/deployment/registry/executable/makefile.mk index 1e57f5ecf3b1..81b2baa44e5d 100644 --- a/desktop/source/deployment/registry/executable/makefile.mk +++ b/desktop/source/deployment/registry/executable/makefile.mk @@ -36,7 +36,8 @@ ENABLE_EXCEPTIONS = TRUE INCPRE += ..$/..$/inc SLOFILES = \ - $(SLO)$/dp_executable.obj + $(SLO)$/dp_executable.obj \ + $(SLO)$/dp_executablebackenddb.obj .INCLUDE : ..$/..$/target.pmk .INCLUDE : target.mk diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx index f36eb6d7b8cb..cad6ddecf751 100644 --- a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx @@ -111,20 +111,6 @@ void HelpBackendDb::addEntry(::rtl::OUString const & url, Data const & data) doc->createTextNode(data.dataUrl), UNO_QUERY_THROW); dataNode->appendChild(dataValue); -// writeSimpleList( -// data.implementationNames, -// OUSTR("implementation-names"), -// OUSTR("name"), -// componentNode); - -// writeVectorOfPair( -// data.singletons, -// OUSTR("singletons"), -// OUSTR("item"), -// OUSTR("key"), -// OUSTR("value"), -// componentNode); - save(); } catch(css::uno::Exception &) @@ -166,16 +152,6 @@ HelpBackendDb::getEntry(::rtl::OUString const & url) Reference dataUrlVal = xpathApi->selectSingleNode(aNode, sExprDataUrl); retData.dataUrl = dataUrlVal->getNodeValue(); - -// retData.implementationNames = -// readList( -// aNode, OUSTR("reg:implementation-names"), OUSTR("reg:name")); - -// retData.singletons = -// readVectorOfPair( -// aNode, OUSTR("reg:singletons"), OUSTR("item"), OUSTR("key"), -// OUSTR("value")); - } else { diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index a5426bf26b54..3d4842f62bfd 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -530,12 +530,6 @@ BackendImpl::PackageImpl::isRegistered_( for ( sal_Int32 pos = bundle.getLength(); pos--; ) { Reference const & xPackage = bundle[ pos ]; - //disregard executable (application/vnd.sun.star.executable) - //it will not be disabled/enabled. - OUString sType = xPackage->getPackageType()->getMediaType(); - if (sType.equals(OUSTR("application/vnd.sun.star.executable"))) - continue; - Reference xSubAbortChannel( xPackage->createAbortChannel() ); AbortChannel::Chain chain( abortChannel, xSubAbortChannel ); diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index b2eddfaf74e0..e808cd0f5e73 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -227,15 +227,22 @@ Reference BackendImpl::bindPackage_( { if (type.EqualsIgnoreCaseAscii("application")) { + OUString dialogURL( makeURL( url, OUSTR("dialog.xlb") ) ); + if (! create_ucb_content( + 0, dialogURL, xCmdEnv, false /* no throw */ )) { + dialogURL = OUString(); + } + if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.basic-library")) { - OUString dialogURL( makeURL( url, OUSTR("dialog.xlb") ) ); + OUString scriptURL( makeURL( url, OUSTR("script.xlb"))); if (! create_ucb_content( - 0, dialogURL, xCmdEnv, false /* no throw */ )) { - dialogURL = OUString(); + 0, scriptURL, xCmdEnv, false /* no throw */ )) { + scriptURL = OUString(); } + return new PackageImpl( - this, url, xCmdEnv, makeURL( url, OUSTR("script.xlb") ), + this, url, xCmdEnv, scriptURL, dialogURL, bRemoved, identifier); } else if (subType.EqualsIgnoreCaseAscii( @@ -243,7 +250,7 @@ Reference BackendImpl::bindPackage_( return new PackageImpl( this, url, xCmdEnv, OUString() /* no script lib */, - makeURL( url, OUSTR("dialog.xlb") ), + dialogURL, bRemoved, identifier); } } -- cgit From 3807193d03962da3247a7b74bd58d2d511786fc2 Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Wed, 28 Apr 2010 11:44:09 +0200 Subject: jl152 import 263451 from native0jl:#i77196# Use ExtensionManager instead of PackageManager --- desktop/source/app/check_ext_deps.cxx | 2 +- desktop/source/deployment/gui/dp_gui.h | 9 +-- desktop/source/deployment/gui/dp_gui_dialog2.cxx | 91 +++++++++------------- desktop/source/deployment/gui/dp_gui_dialog2.hxx | 34 +++----- .../deployment/gui/dp_gui_extensioncmdqueue.cxx | 73 +++++++---------- .../deployment/gui/dp_gui_extensioncmdqueue.hxx | 8 +- .../source/deployment/gui/dp_gui_extlistbox.cxx | 39 +++++----- .../source/deployment/gui/dp_gui_extlistbox.hxx | 8 +- desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 53 ++++++------- desktop/source/deployment/gui/dp_gui_theextmgr.hxx | 8 +- .../source/deployment/gui/dp_gui_updatedata.hxx | 7 +- .../source/deployment/gui/dp_gui_updatedialog.cxx | 53 ++++++------- .../source/deployment/gui/dp_gui_updatedialog.hxx | 5 +- .../deployment/gui/dp_gui_updateinstalldialog.cxx | 11 ++- .../deployment/gui/dp_gui_updateinstalldialog.hxx | 6 ++ .../deployment/registry/component/dp_component.cxx | 2 +- 16 files changed, 172 insertions(+), 237 deletions(-) diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index 6a9beae58ccd..c3eb81dfc3ec 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -163,7 +163,7 @@ void SilentCommandEnv::push( uno::Any const & rStatus ) if ( rStatus.hasValue() && ( rStatus >>= sText) ) { - if ( mnLevel == 1 ) + if ( mnLevel <= 2 ) mpDesktop->SetSplashScreenText( sText ); else mpDesktop->SetSplashScreenProgress( ++mnProgress ); diff --git a/desktop/source/deployment/gui/dp_gui.h b/desktop/source/deployment/gui/dp_gui.h index 85e6eaef3544..092b232ce96d 100644 --- a/desktop/source/deployment/gui/dp_gui.h +++ b/desktop/source/deployment/gui/dp_gui.h @@ -79,21 +79,18 @@ enum PackageState { REGISTERED, NOT_REGISTERED, AMBIGUOUS, NOT_AVAILABLE }; class SelectedPackage: public salhelper::SimpleReferenceObject { public: SelectedPackage() {} - SelectedPackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> &xPackage, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> &xPackageManager ) - : m_xPackage( xPackage ), - m_xPackageManager( xPackageManager ) + SelectedPackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> &xPackage) + : m_xPackage( xPackage ) {} virtual ~SelectedPackage(); ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> getPackage() const { return m_xPackage; } - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> getPackageManager() const { return m_xPackageManager; } + private: SelectedPackage(SelectedPackage &); // not defined void operator =(SelectedPackage &); // not defined ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage; - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager; }; } // namespace dp_gui diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 5f0cf3d91012..164bb833fd6d 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -74,8 +74,6 @@ #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/deployment/thePackageManagerFactory.hpp" - #include #include #include @@ -108,10 +106,8 @@ struct StrAllFiles : public rtl::StaticWithInit< const OUString, StrAllFiles > }; //------------------------------------------------------------------------------ -UpdateListEntry::UpdateListEntry( const uno::Reference< deployment::XPackage > &xPackage, - const uno::Reference< deployment::XPackageManager > &xPackageManager ) : - m_xPackage( xPackage ), - m_xPackageManager( xPackageManager ) +UpdateListEntry::UpdateListEntry( const uno::Reference< deployment::XPackage > &xPackage ) : + m_xPackage( xPackage ) {} //------------------------------------------------------------------------------ @@ -415,17 +411,13 @@ void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt ) switch( ShowPopupMenu( aMousePos, nPos ) ) { case CMD_NONE: break; - case CMD_ENABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackageManager, - GetEntryData( nPos )->m_xPackage, true ); + case CMD_ENABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, true ); break; - case CMD_DISABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackageManager, - GetEntryData( nPos )->m_xPackage, false ); + case CMD_DISABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, false ); break; - case CMD_UPDATE: m_pParent->updatePackage( GetEntryData( nPos )->m_xPackageManager, - GetEntryData( nPos )->m_xPackage ); + case CMD_UPDATE: m_pParent->updatePackage( GetEntryData( nPos )->m_xPackage ); break; - case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackageManager, - GetEntryData( nPos )->m_xPackage ); + case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackage ); break; } } @@ -529,9 +521,7 @@ IMPL_LINK( ExtBoxWithBtns_Impl, HandleEnableBtn, void*, EMPTYARG ) TEntry_Impl pEntry = GetEntryData( nActive ); const bool bEnable( pEntry->m_eState != REGISTERED ); - m_pParent->enablePackage( pEntry->m_xPackageManager, - pEntry->m_xPackage, - bEnable ); + m_pParent->enablePackage( pEntry->m_xPackage, bEnable ); } return 1; @@ -545,8 +535,7 @@ IMPL_LINK( ExtBoxWithBtns_Impl, HandleRemoveBtn, void*, EMPTYARG ) if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) { TEntry_Impl pEntry = GetEntryData( nActive ); - m_pParent->removePackage( pEntry->m_xPackageManager, - pEntry->m_xPackage ); + m_pParent->removePackage( pEntry->m_xPackage ); } return 1; @@ -592,21 +581,21 @@ String DialogHelper::getResourceString( USHORT id ) } //------------------------------------------------------------------------------ -bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackageManager > &xPackageManager ) +bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackage > &xPackage ) { - if ( xPackageManager->getContext().equals( OUSTR("shared") ) ) + if ( xPackage->getRepositoryName().equals( OUSTR("shared") ) ) return true; else return false; } //------------------------------------------------------------------------------ -bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackageManager > &xPackageManager, +bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackage > &xPackage, Window *pParent, const USHORT nResID, bool &bHadWarning ) { - if ( !bHadWarning && IsSharedPkgMgr( xPackageManager ) ) + if ( !bHadWarning && IsSharedPkgMgr( xPackage ) ) { const ::vos::OGuard guard( Application::GetSolarMutex() ); WarningBox aInfoBox( pParent, getResId( nResID ) ); @@ -779,11 +768,10 @@ void ExtMgrDialog::setGetExtensionsURL( const ::rtl::OUString &rURL ) } //------------------------------------------------------------------------------ -long ExtMgrDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage, - const uno::Reference< deployment::XPackageManager > &xPackageManager ) +long ExtMgrDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage ) { m_aUpdateBtn.Enable( true ); - return m_pExtensionBox->addEntry( xPackage, xPackageManager ); + return m_pExtensionBox->addEntry( xPackage ); } //------------------------------------------------------------------------------ @@ -813,21 +801,20 @@ bool ExtMgrDialog::removeExtensionWarn( const OUString &rExtensionName ) const } //------------------------------------------------------------------------------ -bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackageManager > &xPackageManager, - const uno::Reference< deployment::XPackage > &xPackage, +bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackage > &xPackage, bool bEnable ) { - if ( !xPackageManager.is() || !xPackage.is() ) + if ( !xPackage.is() ) return false; if ( bEnable ) { - if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) ) + if ( ! continueOnSharedExtension( xPackage, this, RID_WARNINGBOX_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) ) return false; } else { - if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) ) + if ( ! continueOnSharedExtension( xPackage, this, RID_WARNINGBOX_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) ) return false; } @@ -837,35 +824,33 @@ bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackageMana } //------------------------------------------------------------------------------ -bool ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackageManager > &xPackageManager, - const uno::Reference< deployment::XPackage > &xPackage ) +bool ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackage > &xPackage ) { - if ( !xPackageManager.is() || !xPackage.is() ) + if ( !xPackage.is() ) return false; - if ( !IsSharedPkgMgr( xPackageManager ) || m_bDeleteWarning ) + if ( !IsSharedPkgMgr( xPackage ) || m_bDeleteWarning ) { if ( ! removeExtensionWarn( xPackage->getDisplayName() ) ) return false; } - if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) ) + if ( ! continueOnSharedExtension( xPackage, this, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) ) return false; - m_pManager->removePackage( xPackageManager, xPackage ); + m_pManager->removePackage( xPackage ); return true; } //------------------------------------------------------------------------------ -bool ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackageManager > &xPackageManager, - const uno::Reference< deployment::XPackage > &xPackage ) +bool ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackage > &xPackage ) { - if ( !xPackageManager.is() || !xPackage.is() ) + if ( !xPackage.is() ) return false; std::vector< TUpdateListEntry > vEntries; - TUpdateListEntry pEntry( new UpdateListEntry( xPackage, xPackageManager ) ); + TUpdateListEntry pEntry( new UpdateListEntry( xPackage ) ); vEntries.push_back( pEntry ); m_pManager->updatePackages( vEntries ); @@ -874,7 +859,7 @@ bool ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackageMana } //------------------------------------------------------------------------------ -uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker( const uno::Reference< deployment::XPackageManager > &xPackageManager ) +uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker() { const uno::Any mode( static_cast< sal_Int16 >( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE ) ); const uno::Reference< uno::XComponentContext > xContext( m_pManager->getContext() ); @@ -892,7 +877,7 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker( const uno::Reference< de t_string2string title2filter; OUString sDefaultFilter( StrAllFiles::get() ); - const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes( xPackageManager->getSupportedPackageTypes() ); + const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes( m_pManager->getExtensionManager()->getSupportedPackageTypes( OUSTR("user") ) ); for ( sal_Int32 pos = 0; pos < packageTypes.getLength(); ++pos ) { @@ -1046,8 +1031,7 @@ IMPL_LINK( ExtMgrDialog, HandleAddBtn, void*, EMPTYARG ) { setBusy( true ); - uno::Reference< deployment::XPackageManager > xUserPkgMgr = m_pManager->getUserPkgMgr(); - uno::Sequence< OUString > aFileList = raiseAddPicker( xUserPkgMgr ); + uno::Sequence< OUString > aFileList = raiseAddPicker(); if ( aFileList.getLength() ) { @@ -1317,15 +1301,14 @@ UpdateRequiredDialog::~UpdateRequiredDialog() } //------------------------------------------------------------------------------ -long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage, - const uno::Reference< deployment::XPackageManager > &xPackageManager ) +long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage ) { // We will only add entries to the list with unsatisfied dependencies if ( !checkDependencies( xPackage ) ) { - m_bHasLockedEntries |= (bool) xPackageManager->isReadOnly(); + m_bHasLockedEntries |= m_pManager->isReadOnly( xPackage ); m_aUpdateBtn.Enable( true ); - return m_pExtensionBox->addEntry( xPackage, xPackageManager ); + return m_pExtensionBox->addEntry( xPackage ); } return 0; } @@ -1350,9 +1333,8 @@ void UpdateRequiredDialog::checkEntries() } //------------------------------------------------------------------------------ -bool UpdateRequiredDialog::enablePackage( const uno::Reference< deployment::XPackageManager > &, - const uno::Reference< deployment::XPackage > &xPackage, - bool bEnable ) +bool UpdateRequiredDialog::enablePackage( const uno::Reference< deployment::XPackage > &xPackage, + bool bEnable ) { m_pManager->enablePackage( xPackage, bEnable ); @@ -1476,8 +1458,7 @@ IMPL_LINK( UpdateRequiredDialog, HandleUpdateBtn, void*, EMPTYARG ) for ( sal_Int32 i = 0; i < nCount; ++i ) { TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( i ); - TUpdateListEntry pUpdateEntry( new UpdateListEntry( pEntry->m_xPackage, - pEntry->m_xPackageManager ) ); + TUpdateListEntry pUpdateEntry( new UpdateListEntry( pEntry->m_xPackage ) ); vUpdateEntries.push_back( pUpdateEntry ); } @@ -1738,7 +1719,7 @@ void UpdateRequiredDialog::disableAllEntries() for ( long nIndex = 0; nIndex < nCount; nIndex++ ) { TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex ); - enablePackage( pEntry->m_xPackageManager, pEntry->m_xPackage, false ); + enablePackage( pEntry->m_xPackage, false ); } setBusy( false ); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index cadc127446ea..4c99d64740db 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -46,7 +46,6 @@ #include "com/sun/star/awt/XWindow.hpp" #include "com/sun/star/deployment/XPackage.hpp" -#include "com/sun/star/deployment/XPackageManager.hpp" #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/ui/dialogs/XExecutableDialog.hpp" #include "com/sun/star/util/XModifyListener.hpp" @@ -82,16 +81,15 @@ public: virtual void updateProgress( const long nProgress ) = 0; virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) = 0; - virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & ) = 0; + virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) = 0; virtual void prepareChecking() = 0; virtual void checkEntries() = 0; static ResId getResId( USHORT nId ); static String getResourceString( USHORT id ); - static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &); - static bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &, + static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &); + static bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, Window *pParent, const USHORT nResID, bool &bHadWarning ); @@ -159,20 +157,16 @@ public: virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); void setGetExtensionsURL( const ::rtl::OUString &rURL ); - virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & ); - bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, + virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &); + bool enablePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, bool bEnable ); - bool removePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); - bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + bool removePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + bool updatePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); virtual void prepareChecking(); virtual void checkEntries(); - ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); + ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker(); }; //============================================================================== @@ -234,18 +228,14 @@ public: virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); void selectEntry( long nPos ); - virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & ); - bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, - bool bEnable ); - bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & ); + bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, bool bEnable ); + bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); virtual void prepareChecking(); virtual void checkEntries(); - ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); + ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker(); bool installForAllUsers( bool &bInstallForAll ) const; bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const; diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 647c46b754c8..4c9357e03e9f 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -48,7 +48,6 @@ #include "com/sun/star/deployment/DeploymentException.hpp" #include "com/sun/star/deployment/UpdateInformationProvider.hpp" #include "com/sun/star/deployment/XPackage.hpp" -#include "com/sun/star/deployment/XPackageManager.hpp" #include "com/sun/star/task/XAbortChannel.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" @@ -201,25 +200,18 @@ struct ExtensionCmd E_CMD_TYPE m_eCmdType; bool m_bWarnUser; OUString m_sExtensionURL; - uno::Reference< deployment::XPackageManager > m_xPackageManager; - uno::Reference< deployment::XPackage > m_xPackage; - std::vector< TUpdateListEntry > m_vExtensionList; + OUString m_sRepository; + uno::Reference< deployment::XPackage > m_xPackage; + std::vector< TUpdateListEntry > m_vExtensionList; ExtensionCmd( const E_CMD_TYPE eCommand, - const uno::Reference< deployment::XPackageManager > &rPackageManager, const OUString &rExtensionURL, + const OUString &rRepository, const bool bWarnUser ) : m_eCmdType( eCommand ), m_bWarnUser( bWarnUser ), m_sExtensionURL( rExtensionURL ), - m_xPackageManager( rPackageManager ) {}; - ExtensionCmd( const E_CMD_TYPE eCommand, - const uno::Reference< deployment::XPackageManager > &rPackageManager, - const uno::Reference< deployment::XPackage > &rPackage ) - : m_eCmdType( eCommand ), - m_bWarnUser( false ), - m_xPackageManager( rPackageManager ), - m_xPackage( rPackage ) {}; + m_sRepository( rRepository ) {}; ExtensionCmd( const E_CMD_TYPE eCommand, const uno::Reference< deployment::XPackage > &rPackage ) : m_eCmdType( eCommand ), @@ -242,11 +234,10 @@ public: TheExtensionManager *pManager, const uno::Reference< uno::XComponentContext > & rContext ); - void addExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager, - const OUString &rExtensionURL, + void addExtension( const OUString &rExtensionURL, + const OUString &rRepository, const bool bWarnUser ); - void removeExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager, - const uno::Reference< deployment::XPackage > &rPackage ); + void removeExtension( const uno::Reference< deployment::XPackage > &rPackage ); void enableExtension( const uno::Reference< deployment::XPackage > &rPackage, const bool bEnable ); void checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ); @@ -266,11 +257,10 @@ private: virtual void SAL_CALL onTerminated(); void _addExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv, - const uno::Reference< deployment::XPackageManager > &xPackageManager, const OUString &rPackageURL, + const OUString &rRepository, const bool bWarnUser ); void _removeExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv, - const uno::Reference< deployment::XPackageManager > &xPackageManager, const uno::Reference< deployment::XPackage > &xPackage ); void _enableExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv, const uno::Reference< deployment::XPackage > &xPackage ); @@ -645,8 +635,8 @@ ExtensionCmdQueue::Thread::Thread( DialogHelper *pDialogHelper, } //------------------------------------------------------------------------------ -void ExtensionCmdQueue::Thread::addExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager, - const ::rtl::OUString &rExtensionURL, +void ExtensionCmdQueue::Thread::addExtension( const ::rtl::OUString &rExtensionURL, + const ::rtl::OUString &rRepository, const bool bWarnUser ) { ::osl::MutexGuard aGuard( m_mutex ); @@ -657,7 +647,7 @@ void ExtensionCmdQueue::Thread::addExtension( const uno::Reference< deployment:: if ( rExtensionURL.getLength() ) { - TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::ADD, rPackageManager, rExtensionURL, bWarnUser ) ); + TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::ADD, rExtensionURL, rRepository, bWarnUser ) ); m_queue.push( pEntry ); m_eInput = START; @@ -666,8 +656,7 @@ void ExtensionCmdQueue::Thread::addExtension( const uno::Reference< deployment:: } //------------------------------------------------------------------------------ -void ExtensionCmdQueue::Thread::removeExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager, - const uno::Reference< deployment::XPackage > &rPackage ) +void ExtensionCmdQueue::Thread::removeExtension( const uno::Reference< deployment::XPackage > &rPackage ) { ::osl::MutexGuard aGuard( m_mutex ); @@ -675,9 +664,9 @@ void ExtensionCmdQueue::Thread::removeExtension( const uno::Reference< deploymen if ( m_bStopped ) return; - if ( rPackageManager.is() && rPackage.is() ) + if ( rPackage.is() ) { - TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::REMOVE, rPackageManager, rPackage ) ); + TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::REMOVE, rPackage ) ); m_queue.push( pEntry ); m_eInput = START; @@ -811,10 +800,10 @@ void ExtensionCmdQueue::Thread::execute() switch ( pEntry->m_eCmdType ) { case ExtensionCmd::ADD : - _addExtension( currentCmdEnv, pEntry->m_xPackageManager, pEntry->m_sExtensionURL, pEntry->m_bWarnUser ); + _addExtension( currentCmdEnv, pEntry->m_sExtensionURL, pEntry->m_sRepository, pEntry->m_bWarnUser ); break; case ExtensionCmd::REMOVE : - _removeExtension( currentCmdEnv, pEntry->m_xPackageManager, pEntry->m_xPackage ); + _removeExtension( currentCmdEnv, pEntry->m_xPackage ); break; case ExtensionCmd::ENABLE : _enableExtension( currentCmdEnv, pEntry->m_xPackage ); @@ -904,8 +893,8 @@ void ExtensionCmdQueue::Thread::execute() //------------------------------------------------------------------------------ void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv, - const uno::Reference< deployment::XPackageManager > &xPackageManager, const OUString &rPackageURL, + const OUString &rRepository, const bool bWarnUser ) { //check if we have a string in anyTitle. For example "unopkg gui \" caused anyTitle to be void @@ -928,17 +917,16 @@ void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv } rCmdEnv->setWarnUser( bWarnUser ); - uno::Reference< task::XAbortChannel > xAbortChannel( xPackageManager->createAbortChannel() ); + uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); + uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() ); OUString sTitle = searchAndReplaceAll( m_sAddingPackages, OUSTR("%EXTENSION_NAME"), sName ); rCmdEnv->progressSection( sTitle, xAbortChannel ); try { - OUString sPackageManager = xPackageManager->getContext(); - uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); uno::Reference< deployment::XPackage > xPackage( xExtMgr->addExtension(rPackageURL, uno::Sequence(), - sPackageManager, xAbortChannel, rCmdEnv.get() ) ); + rRepository, xAbortChannel, rCmdEnv.get() ) ); OSL_ASSERT( xPackage.is() ); } catch ( ucb::CommandFailedException & ) @@ -956,19 +944,17 @@ void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv //------------------------------------------------------------------------------ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv, - const uno::Reference< deployment::XPackageManager > &xPackageManager, const uno::Reference< deployment::XPackage > &xPackage ) { - uno::Reference< task::XAbortChannel > xAbortChannel( xPackageManager->createAbortChannel() ); + uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); + uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() ); OUString sTitle = searchAndReplaceAll( m_sRemovingPackages, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName() ); rCmdEnv->progressSection( sTitle, xAbortChannel ); OUString id( dp_misc::getIdentifier( xPackage ) ); try { - OUString sPackageManager = xPackageManager->getContext(); - uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); - xExtMgr->removeExtension( id, xPackage->getName(), sPackageManager, xAbortChannel, rCmdEnv.get() ); + xExtMgr->removeExtension( id, xPackage->getName(), xPackage->getRepositoryName(), xAbortChannel, rCmdEnv.get() ); } catch ( deployment::DeploymentException & ) {} @@ -1120,17 +1106,16 @@ ExtensionCmdQueue::~ExtensionCmdQueue() { stop(); } -void ExtensionCmdQueue::addExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager, - const ::rtl::OUString & extensionURL, +void ExtensionCmdQueue::addExtension( const ::rtl::OUString & extensionURL, + const ::rtl::OUString & repository, const bool bWarnUser ) { - m_thread->addExtension( rPackageManager, extensionURL, bWarnUser ); + m_thread->addExtension( extensionURL, repository, bWarnUser ); } -void ExtensionCmdQueue::removeExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager, - const uno::Reference< deployment::XPackage > &rPackage ) +void ExtensionCmdQueue::removeExtension( const uno::Reference< deployment::XPackage > &rPackage ) { - m_thread->removeExtension( rPackageManager, rPackage ); + m_thread->removeExtension( rPackage ); } void ExtensionCmdQueue::enableExtension( const uno::Reference< deployment::XPackage > &rPackage, diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx index f984c71c6c1c..69ad7da24769 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx @@ -40,7 +40,6 @@ /// @HTML namespace com { namespace sun { namespace star { - namespace deployment { class XPackageManager; } namespace task { class XInteractionRequest; } namespace uno { class XComponentContext; } } } } @@ -78,11 +77,10 @@ public: /** */ - void addExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &rPackageManager, - const ::rtl::OUString &rExtensionURL, + void addExtension( const ::rtl::OUString &rExtensionURL, + const ::rtl::OUString &rRepository, const bool bWarnUser ); - void removeExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &rPackageManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage ); + void removeExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage ); void enableExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage, const bool bEnable ); void checkForUpdates( const std::vector< TUpdateListEntry > &vList ); diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 7d616b103c21..18911ce63ea2 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -44,6 +44,10 @@ #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) +#define USER_PACKAGE_MANAGER OUSTR("user") +#define SHARED_PACKAGE_MANAGER OUSTR("shared") +#define BUNDLED_PACKAGE_MANAGER OUSTR("bundled") + using namespace ::com::sun::star; namespace dp_gui { @@ -52,10 +56,9 @@ namespace dp_gui { // struct Entry_Impl //------------------------------------------------------------------------------ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, - const uno::Reference< deployment::XPackageManager > &xPackageManager, - PackageState eState ) : + const PackageState eState, const bool bReadOnly ) : m_bActive( false ), - m_bLocked( false ), + m_bLocked( bReadOnly ), m_bHasOptions( false ), m_bShared( false ), m_bUser( false ), @@ -65,8 +68,7 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, m_bHasButtons( false ), m_eState( eState ), m_pPublisher( NULL ), - m_xPackage( xPackage ), - m_xPackageManager( xPackageManager ) + m_xPackage( xPackage ) { m_sTitle = xPackage->getDisplayName(); m_sVersion = xPackage->getVersion(); @@ -87,8 +89,6 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, else m_aIconHC = m_aIcon; - m_bLocked = m_xPackageManager->isReadOnly(); - if ( eState == AMBIGUOUS ) m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS ); else if ( eState == NOT_REGISTERED ) @@ -108,14 +108,11 @@ StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEn eCompare = m_sVersion.CompareTo( pEntry->m_sVersion ); if ( eCompare == COMPARE_EQUAL ) { - if ( m_xPackageManager != pEntry->m_xPackageManager ) - { - sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() ); - if ( nCompare < 0 ) - eCompare = COMPARE_LESS; - else if ( nCompare > 0 ) - eCompare = COMPARE_GREATER; - } + sal_Int32 nCompare = m_xPackage->getRepositoryName().compareTo( pEntry->m_xPackage->getRepositoryName() ); + if ( nCompare < 0 ) + eCompare = COMPARE_LESS; + else if ( nCompare > 0 ) + eCompare = COMPARE_GREATER; } } return eCompare; @@ -955,13 +952,13 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStar } //------------------------------------------------------------------------------ -long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage, - const uno::Reference< deployment::XPackageManager > &xPackageManager ) +long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage ) { - long nPos = 0; + long nPos = 0; PackageState eState = m_pManager->getPackageState( xPackage ); + bool bLocked = m_pManager->isReadOnly( xPackage ); - TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) ); + TEntry_Impl pEntry( new Entry_Impl( xPackage, eState, bLocked ) ); xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) ); ::osl::ClearableMutexGuard guard(m_entriesMutex); @@ -982,8 +979,8 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & } pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); - pEntry->m_bUser = ( m_pManager->getUserPkgMgr() == xPackageManager ); - pEntry->m_bShared = !pEntry->m_bUser && ( m_pManager->getSharedPkgMgr() == xPackageManager ); + pEntry->m_bUser = xPackage->getRepositoryName().equals( USER_PACKAGE_MANAGER ); + pEntry->m_bShared = xPackage->getRepositoryName().equals( SHARED_PACKAGE_MANAGER ); pEntry->m_bNew = m_bInCheckMode; //access to m_nActive must be guarded diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 1ea3d0d72fcc..0f56d022492b 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -38,7 +38,6 @@ #include "com/sun/star/lang/Locale.hpp" #include "com/sun/star/lang/XEventListener.hpp" #include "com/sun/star/deployment/XPackage.hpp" -#include "com/sun/star/deployment/XPackageManager.hpp" #include @@ -86,11 +85,9 @@ struct Entry_Impl svt::FixedHyperlink *m_pPublisher; ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage; - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager; Entry_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, - PackageState eState ); + const PackageState eState, const bool bReadOnly ); ~Entry_Impl(); StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const; @@ -208,8 +205,7 @@ public: //----------------- virtual void selectEntry( const long nPos ); - long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); + long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); void updateEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); void removeEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index cd37f07729bb..65a1bf021d29 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -35,8 +35,6 @@ #include "toolkit/helper/vclunohelper.hxx" #include "com/sun/star/beans/XPropertySet.hpp" -#include "com/sun/star/deployment/XPackageManagerFactory.hpp" -#include "com/sun/star/deployment/thePackageManagerFactory.hpp" #include "dp_gui_dialog2.hxx" #include "dp_gui_extensioncmdqueue.hxx" @@ -74,17 +72,8 @@ TheExtensionManager::TheExtensionManager( Window *pParent, m_pExtMgrDialog( NULL ), m_pUpdReqDialog( NULL ) { - m_sPackageManagers.realloc(3); - m_sPackageManagers[0] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( USER_PACKAGE_MANAGER ); - m_sPackageManagers[1] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( SHARED_PACKAGE_MANAGER ); - m_sPackageManagers[2] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( BUNDLED_PACKAGE_MANAGER ); - - for ( sal_Int32 i = 0; i < m_sPackageManagers.getLength(); ++i ) - { - m_sPackageManagers[i]->addModifyListener( this ); - } - m_xExtensionManager = deployment::ExtensionManager::get( xContext ); + m_xExtensionManager->addModifyListener( this ); uno::Reference< lang::XMultiServiceFactory > xConfig( xContext->getServiceManager()->createInstanceWithContext( @@ -241,7 +230,7 @@ bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bPare uno::Reference< deployment::XPackage > xPackage = xPackageList[j]; if ( xPackage.is() ) { - TUpdateListEntry pEntry( new UpdateListEntry( xPackage, m_sPackageManagers[j] ) ); + TUpdateListEntry pEntry( new UpdateListEntry( xPackage ) ); vEntries.push_back( pEntry ); } } @@ -261,10 +250,9 @@ bool TheExtensionManager::enablePackage( const uno::Reference< deployment::XPack } //------------------------------------------------------------------------------ -bool TheExtensionManager::removePackage( const uno::Reference< deployment::XPackageManager > &xPackageManager, - const uno::Reference< deployment::XPackage > &xPackage ) +bool TheExtensionManager::removePackage( const uno::Reference< deployment::XPackage > &xPackage ) { - m_pExecuteCmdQueue->removeExtension( xPackageManager, xPackage ); + m_pExecuteCmdQueue->removeExtension( xPackage ); return true; } @@ -285,22 +273,20 @@ bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWar createDialog( false ); - uno::Reference< deployment::XPackageManager > xUserPkgMgr = getUserPkgMgr(); - uno::Reference< deployment::XPackageManager > xSharedPkgMgr = getSharedPkgMgr(); - bool bInstall = true; bool bInstallForAll = false; - if ( !bWarnUser && ! xSharedPkgMgr->isReadOnly() ) + // DV! missing function is read only repository from extension manager + if ( !bWarnUser && ! m_xExtensionManager->isReadOnlyRepository( SHARED_PACKAGE_MANAGER ) ) bInstall = getDialogHelper()->installForAllUsers( bInstallForAll ); if ( !bInstall ) return false; if ( bInstallForAll ) - m_pExecuteCmdQueue->addExtension( xSharedPkgMgr, rPackageURL, false ); + m_pExecuteCmdQueue->addExtension( rPackageURL, SHARED_PACKAGE_MANAGER, false ); else - m_pExecuteCmdQueue->addExtension( xUserPkgMgr, rPackageURL, bWarnUser ); + m_pExecuteCmdQueue->addExtension( rPackageURL, USER_PACKAGE_MANAGER, bWarnUser ); return true; } @@ -357,7 +343,7 @@ void TheExtensionManager::createPackageList() if ( xPackage.is() ) { PackageState eState = getPackageState( xPackage ); - getDialogHelper()->addPackageToList( xPackage, m_sPackageManagers[j] ); + getDialogHelper()->addPackageToList( xPackage ); // When the package is enabled, we can stop here, otherwise we have to look for // another version of this package if ( ( eState == REGISTERED ) || ( eState == NOT_AVAILABLE ) ) @@ -395,6 +381,17 @@ PackageState TheExtensionManager::getPackageState( const uno::Reference< deploym } } +//------------------------------------------------------------------------------ +bool TheExtensionManager::isReadOnly( const uno::Reference< deployment::XPackage > &xPackage ) const +{ + if ( m_xExtensionManager.is() && xPackage.is() ) + { + return m_xExtensionManager->isReadOnlyRepository( xPackage->getRepositoryName() ); + } + else + return true; +} + //------------------------------------------------------------------------------ // The function investigates if the extension supports options. bool TheExtensionManager::supportsOptions( const uno::Reference< deployment::XPackage > &xPackage ) const @@ -509,13 +506,9 @@ void TheExtensionManager::notifyTermination( ::lang::EventObject const & rEvt ) void TheExtensionManager::modified( ::lang::EventObject const & rEvt ) throw ( uno::RuntimeException ) { - uno::Reference< deployment::XPackageManager > xPackageManager( rEvt.Source, uno::UNO_QUERY ); - if ( xPackageManager.is() ) - { - getDialogHelper()->prepareChecking(); - createPackageList(); - getDialogHelper()->checkEntries(); - } + getDialogHelper()->prepareChecking(); + createPackageList(); + getDialogHelper()->checkEntries(); } //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index 2b8f86de9955..6605b5907dab 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -33,7 +33,6 @@ #include "cppuhelper/implbase2.hxx" #include "com/sun/star/container/XNameAccess.hpp" -#include "com/sun/star/deployment/XPackageManager.hpp" #include "com/sun/star/deployment/XExtensionManager.hpp" #include "com/sun/star/deployment/ExtensionManager.hpp" #include "com/sun/star/frame/XDesktop.hpp" @@ -60,7 +59,6 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop; ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> > m_sPackageManagers; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNameAccessNodes; ::std::auto_ptr< ExtensionCmdQueue > m_pExecuteCmdQueue; @@ -100,8 +98,7 @@ public: bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, bool bEnable ); - bool removePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + bool removePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); bool installPackage( const ::rtl::OUString &rPackageURL, bool bWarnUser = false ); bool queryTermination(); @@ -111,9 +108,8 @@ public: bool supportsOptions( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; PackageState getPackageState( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext; } - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > getUserPkgMgr() const { return m_sPackageManagers[0]; } - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > getSharedPkgMgr() const { return m_sPackageManagers[1]; } ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > getExtensionManager() const { return m_xExtensionManager; } + bool isReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; //----------------- static ::rtl::Reference get( diff --git a/desktop/source/deployment/gui/dp_gui_updatedata.hxx b/desktop/source/deployment/gui/dp_gui_updatedata.hxx index dda6126f70d0..2082b92e923a 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedata.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedata.hxx @@ -35,7 +35,6 @@ namespace com { namespace sun { namespace star { namespace deployment { - class XPackageManager; class XPackage; }}}} namespace com { namespace sun { namespace star { namespace xml { namespace dom { @@ -48,10 +47,8 @@ namespace dp_gui { struct UpdateListEntry { ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage; - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager; - UpdateListEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); + UpdateListEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); ~UpdateListEntry(); }; @@ -61,8 +58,6 @@ typedef ::boost::shared_ptr< UpdateListEntry > TUpdateListEntry; struct UpdateData { ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > aInstalledPackage; - - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > aPackageManager; // The content of the update information ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > aUpdateInfo; //The URL of the locally downloaded extension. It will only be set if there were no errors diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 61479f799e6f..fca7d97c798a 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -54,7 +54,8 @@ #include "com/sun/star/deployment/DeploymentException.hpp" #include "com/sun/star/deployment/UpdateInformationProvider.hpp" #include "com/sun/star/deployment/XPackage.hpp" -#include "com/sun/star/deployment/XPackageManager.hpp" +#include "com/sun/star/deployment/XExtensionManager.hpp" +#include "com/sun/star/deployment/ExtensionManager.hpp" #include "com/sun/star/deployment/XUpdateInformationProvider.hpp" #include "com/sun/star/frame/XDesktop.hpp" #include "com/sun/star/frame/XDispatch.hpp" @@ -240,12 +241,9 @@ private: struct Entry { explicit Entry( css::uno::Reference< css::deployment::XPackage > const & thePackage, - css::uno::Reference< css::deployment::XPackageManager > const & - thePackageManager, rtl::OUString const & theVersion); css::uno::Reference< css::deployment::XPackage > package; - css::uno::Reference< css::deployment::XPackageManager > packageManager; rtl::OUString version; css::uno::Reference< css::xml::dom::XNode > info; }; @@ -271,14 +269,10 @@ private: void handle( css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Reference< css::deployment::XPackageManager > const & - packageManager, Map * map); bool update( css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Reference< css::deployment::XPackageManager > const & - packageManager, css::uno::Reference< css::xml::dom::XNode > const & updateInfo) const; css::uno::Reference< css::uno::XComponentContext > m_context; @@ -333,11 +327,8 @@ void UpdateDialog::Thread::stop() { UpdateDialog::Thread::Entry::Entry( css::uno::Reference< css::deployment::XPackage > const & thePackage, - css::uno::Reference< css::deployment::XPackageManager > const & - thePackageManager, rtl::OUString const & theVersion): package(thePackage), - packageManager(thePackageManager), version(theVersion) {} @@ -356,7 +347,6 @@ void UpdateDialog::Thread::execute() for ( ITER iIndex = m_vExtensionList.begin(); iIndex < m_vExtensionList.end(); ++iIndex ) { css::uno::Reference< css::deployment::XPackage > p = (*iIndex)->m_xPackage; - css::uno::Reference< css::deployment::XPackageManager > m = (*iIndex)->m_xPackageManager; if ( p.is() ) { { @@ -365,7 +355,7 @@ void UpdateDialog::Thread::execute() return; } } - handle( p, m, &map ); + handle( p, &map ); } } @@ -399,9 +389,7 @@ void UpdateDialog::Thread::execute() } for (Map::const_iterator i(map.begin()); i != map.end(); ++i) { if (i->second.info.is() && - !update( - i->second.package, i->second.packageManager, - i->second.info)) + !update( i->second.package, i->second.info )) { break; } @@ -468,8 +456,6 @@ UpdateDialog::Thread::getUpdateInformation( void UpdateDialog::Thread::handle( css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Reference< css::deployment::XPackageManager > const & - packageManager, Map * map) { rtl::OUString id(dp_misc::getIdentifier(package)); @@ -478,7 +464,7 @@ void UpdateDialog::Thread::handle( if (urls.getLength() == 0) { map->insert( Map::value_type( - id, Entry(package, packageManager, package->getVersion()))); + id, Entry(package, package->getVersion()))); } else { css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > infos(getUpdateInformation(package, urls, id)); @@ -504,18 +490,15 @@ void UpdateDialog::Thread::handle( } } if (latestIndex != -1) { - update( - package, packageManager, - css::uno::Reference< css::xml::dom::XNode >( - infos[latestIndex], css::uno::UNO_QUERY_THROW)); + update( package, + css::uno::Reference< css::xml::dom::XNode >( + infos[latestIndex], css::uno::UNO_QUERY_THROW)); } } } bool UpdateDialog::Thread::update( css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Reference< css::deployment::XPackageManager > const & - packageManager, css::uno::Reference< css::xml::dom::XNode > const & updateInfo) const { dp_misc::DescriptionInfoset infoset(m_context, updateInfo); @@ -529,7 +512,7 @@ bool UpdateDialog::Thread::update( for (sal_Int32 i = 0; i < ds.getLength(); ++i) { du.unsatisfiedDependencies[i] = dp_misc::Dependencies::getErrorText(ds[i]); } - du.permission = ! packageManager->isReadOnly(); + du.permission = ! m_dialog.isReadOnly( package ); const ::boost::optional< ::rtl::OUString> updateWebsiteURL(infoset.getLocalizedUpdateWebsiteURL()); rtl::OUStringBuffer b(package->getDisplayName()); b.append(static_cast< sal_Unicode >(' ')); @@ -559,7 +542,6 @@ bool UpdateDialog::Thread::update( { dp_gui::UpdateData data; data.aInstalledPackage = package; - data.aPackageManager = packageManager; data.aUpdateInfo = updateInfo; if (updateWebsiteURL) data.sWebsiteURL = *updateWebsiteURL; @@ -626,6 +608,9 @@ UpdateDialog::UpdateDialog( // m_extensionManagerDialog(extensionManagerDialog) { OSL_ASSERT(updateData != NULL); + + m_xExtensionManager = css::deployment::ExtensionManager::get( context ); + css::uno::Reference< css::awt::XToolkit > toolkit; try { toolkit = css::uno::Reference< css::awt::XToolkit >( @@ -1055,6 +1040,16 @@ bool UpdateDialog::showDescription( const String& rDescription, bool bWithPublis return true; } +bool UpdateDialog::isReadOnly( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const +{ + if ( m_xExtensionManager.is() && xPackage.is() ) + { + return m_xExtensionManager->isReadOnlyRepository( xPackage->getRepositoryName() ); + } + else + return true; +} + IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) { rtl::OUStringBuffer b; @@ -1233,10 +1228,10 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG) typedef ::std::vector::const_iterator CIT; for (CIT i = m_enabledUpdates.begin(); i < m_enabledUpdates.end(); i++) { - OSL_ASSERT(i->aPackageManager.is()); + OSL_ASSERT(i->aInstalledPackage.is()); //If the user has no write access to the shared folder then the update //for a shared extension is disable, that is it cannot be in m_enabledUpdates - OSL_ASSERT(i->aPackageManager->isReadOnly() == sal_False); + OSL_ASSERT(isReadOnly(i->aInstalledPackage) == sal_False); #if 0 // TODO: check! OSL_ASSERT(m_extensionManagerDialog.get()); diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx index 1a8484e2c20f..1e72b22a68c7 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx @@ -60,7 +60,8 @@ class Window; namespace com { namespace sun { namespace star { namespace awt { class XThrobber; } - namespace deployment { class XPackageManager; } + namespace deployment { class XExtensionManager; + class XPackage; } namespace uno { class XComponentContext; } } } } @@ -171,6 +172,7 @@ private: bool showDescription( ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > const & aUpdateInfo); bool showDescription( const String& rDescription, bool bWithPublisher ); + bool isReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; DECL_LINK(selectionHandler, void *); DECL_LINK(allHandler, void *); @@ -214,6 +216,7 @@ private: std::vector< UpdateDialog::SpecificError > m_specificErrors; std::vector< dp_gui::UpdateData > & m_updateData; rtl::Reference< UpdateDialog::Thread > m_thread; + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; Point m_aFirstLinePos; Size m_aFirstLineSize; diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index f607713118f0..f2f8b8b0d6e2 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -54,7 +54,8 @@ #include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" #include "com/sun/star/ucb/XCommandEnvironment.hpp" #include "com/sun/star/ucb/XProgressHandler.hpp" -#include "com/sun/star/deployment/XPackageManager.hpp" +#include "com/sun/star/deployment/XExtensionManager.hpp" +#include "com/sun/star/deployment/ExtensionManager.hpp" #include "com/sun/star/deployment/XUpdateInformationProvider.hpp" #include "com/sun/star/deployment/DependencyException.hpp" #include "com/sun/star/deployment/LicenseException.hpp" @@ -257,6 +258,8 @@ UpdateInstallDialog::UpdateInstallDialog( { FreeResource(); + m_xExtensionManager = css::deployment::ExtensionManager::get( xCtx ); + m_cancel.SetClickHdl(LINK(this, UpdateInstallDialog, cancelHandler)); m_mle_info.EnableCursor(FALSE); if ( ! dp_misc::office_is_running()) @@ -496,7 +499,7 @@ void UpdateInstallDialog::Thread::installExtensions() if (curData.sLocalURL.getLength() == 0) continue; cssu::Reference< css::task::XAbortChannel > xAbortChannel( - curData.aPackageManager->createAbortChannel() ); + curData.aInstalledPackage->createAbortChannel() ); { vos::OGuard g(Application::GetSolarMutex()); if (m_stop) { @@ -504,9 +507,9 @@ void UpdateInstallDialog::Thread::installExtensions() } m_abort = xAbortChannel; } - xPackage = curData.aPackageManager->addPackage( + xPackage = m_dialog.getExtensionManager()->addExtension( curData.sLocalURL, css::uno::Sequence(), - OUString(), xAbortChannel, m_updateCmdEnv.get()); + curData.aInstalledPackage->getRepositoryName(), xAbortChannel, m_updateCmdEnv.get()); } catch (css::deployment::DeploymentException & de) { diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx index c3d01c8ee6d9..c0e64a8028e8 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx @@ -41,6 +41,9 @@ #include "dp_gui_autoscrolledit.hxx" /// @HTML +namespace com { namespace sun { namespace star { namespace deployment { + class XExtensionManager; +}}}} namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; }}}} @@ -102,9 +105,12 @@ private: }; void setError(INSTALL_ERROR err, ::rtl::OUString const & sExtension, ::rtl::OUString const & exceptionMessage); void setError(::rtl::OUString const & exceptionMessage); + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > getExtensionManager() const + { return m_xExtensionManager; } rtl::Reference< Thread > m_thread; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xComponentContext; + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; //Signals that an error occurred during download and installation bool m_bError; bool m_bNoEntry; diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index b3b8a8249994..edb53d134c8b 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -1489,7 +1489,7 @@ BackendImpl::TypelibraryPackageImpl::isRegistered_( void BackendImpl::TypelibraryPackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, - bool startup, + bool /*startup*/, ::rtl::Reference const &, Reference const & xCmdEnv ) { -- cgit From b74d54d62a0162c490c5fe833f937120c8795680 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 28 Apr 2010 16:47:08 +0200 Subject: cws tl79: include fixed --- sfx2/inc/sfx2/securitypage.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/inc/sfx2/securitypage.hxx b/sfx2/inc/sfx2/securitypage.hxx index 616f11d3b6d1..8b2ca43fc945 100755 --- a/sfx2/inc/sfx2/securitypage.hxx +++ b/sfx2/inc/sfx2/securitypage.hxx @@ -27,7 +27,7 @@ #ifndef _SECURITYPAGE_HXX_ #define _SECURITYPAGE_HXX_ -#include "sfx2/tabdlg.hxx " +#include "sfx2/tabdlg.hxx" #include -- cgit From 65cf934efc6f8958d9c024ee965685cfd6cac704 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 29 Apr 2010 13:02:24 +0200 Subject: cws tl79: fixed problems after merging with DEV300_m77 --- sfx2/inc/sfx2/htmlmode.hxx | 68 +++++++++++++++++++++++++++++++++++++ sfx2/inc/sfx2/securitypage.hxx | 1 + sfx2/inc/sfx2/sfxsids.hrc | 26 ++++++++++++++ sfx2/source/dialog/dinfdlg.cxx | 1 + sfx2/source/dialog/securitypage.cxx | 15 ++++---- svx/inc/htmlmode.hxx | 23 +------------ svx/inc/svx/svxids.hrc | 43 ++++++++++++----------- 7 files changed, 129 insertions(+), 48 deletions(-) create mode 100644 sfx2/inc/sfx2/htmlmode.hxx diff --git a/sfx2/inc/sfx2/htmlmode.hxx b/sfx2/inc/sfx2/htmlmode.hxx new file mode 100644 index 000000000000..51f341c5c3c0 --- /dev/null +++ b/sfx2/inc/sfx2/htmlmode.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_HTMLMODE_HXX_ +#define _SFX_HTMLMODE_HXX_ + + +#define HTMLMODE_ON 0x0001 +#define HTMLMODE_PARA_BORDER 0x0002 /* Absatzumrandungen */ +#define HTMLMODE_PARA_DISTANCE 0x0004 /* bestimmte Absatzabstaende */ +#define HTMLMODE_SMALL_CAPS 0x0008 /* Kapitaelchen */ +#define HTMLMODE_FRM_COLUMNS 0x0010 /* spaltige Rahmen */ +#define HTMLMODE_SOME_STYLES 0x0020 /* mind. MS IE */ +#define HTMLMODE_FULL_STYLES 0x0040 /* == SW */ +#define HTMLMODE_BLINK 0x0080 /* blinkende Zeichen*/ +#define HTMLMODE_PARA_BLOCK 0x0100 /* Blocksatz */ +#define HTMLMODE_DROPCAPS 0x0200 /* Initialen*/ +#define HTMLMODE_FIRSTLINE 0x0400 /* Erstzeileneinzug mit Spacer == NS 3.0 */ +#define HTMLMODE_GRAPH_POS 0x0800 /* Grafikpositionen Hintergrund */ +#define HTMLMODE_FULL_ABS_POS 0x1000 /* abs. Rahmenpositionierung */ +#define HTMLMODE_SOME_ABS_POS 0x2000 /* abs. Rahmenpositionierung vollst.*/ +#define HTMLMODE_RESERVED1 0x4000 +#define HTMLMODE_RESERVED0 0x8000 + + +#endif + + + + + + + + + + + + + + + + + + + diff --git a/sfx2/inc/sfx2/securitypage.hxx b/sfx2/inc/sfx2/securitypage.hxx index 8b2ca43fc945..d25f0ee0b967 100755 --- a/sfx2/inc/sfx2/securitypage.hxx +++ b/sfx2/inc/sfx2/securitypage.hxx @@ -28,6 +28,7 @@ #define _SECURITYPAGE_HXX_ #include "sfx2/tabdlg.hxx" +#include "sfx2/htmlmode.hxx" #include diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index bc4c11b53184..74210ba680ef 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -155,6 +155,7 @@ #define SID_RELOAD (SID_SFX_START + 508) #define SID_PRINTDOCDIRECT (SID_SFX_START + 509) #define SID_PICKLIST (SID_SFX_START + 510) +#define SID_ATTR_XWINDOW (SID_SFX_START + 777) #define SID_PLUGIN_MODE (SID_SFX_START + 827) #define SID_EXPORTDOC (SID_SFX_START + 829) #define SID_EXPORTDOCASPDF (SID_SFX_START + 1673) @@ -998,5 +999,30 @@ #endif // #ifndef _SFXSIDS_HRC +//----------------------------------------------------------------------- +// SfxSecurityPage related stuff + +#define FN_EDIT2 (SID_SW_START + 1800) +#define FN_REDLINE_PROTECT (FN_EDIT2 + 23) +#define FN_REDLINE_ON (FN_EDIT2 + 25) + +#define SID_HTML_MODE (SID_SVX_START + 414) + +// Calc-Id's used for SfxSecurityPage +#ifndef SC_FUNCTION_START +#define SC_FUNCTION_START (SID_SC_START + 200) +#endif +#ifndef FILE_MENU_END +#define FILE_MENU_END (SC_FUNCTION_START + 20) +#endif +#ifndef EDIT_MENU_START +#define EDIT_MENU_START (FILE_MENU_END) +#endif +#ifndef SC_VIEW_START +#define SC_VIEW_START (SID_SC_START) +#endif +#define FID_CHG_RECORD (EDIT_MENU_START + 18) +#define SID_CHG_PROTECT (SC_VIEW_START + 84) + // eof ------------------------------------------------------------------------ diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 1495a560965b..f8da760bc12d 100755 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" + #include #include #include diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index affebc8615cb..d6351143c51e 100755 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -29,22 +29,23 @@ #include "precompiled_sfx2.hxx" #include "sfx2/securitypage.hxx" -#include "sfx2/sfx.hrc" + #include "securitypage.hrc" #include "sfxresid.hxx" +#include +#include +#include +#include +#include + #include #include #include #include -#include -#include -#include #include -#include -#include #include -#include +#include diff --git a/svx/inc/htmlmode.hxx b/svx/inc/htmlmode.hxx index a1c5bf0cdf11..dab1b5b1db70 100644 --- a/svx/inc/htmlmode.hxx +++ b/svx/inc/htmlmode.hxx @@ -27,28 +27,7 @@ #ifndef _SVX_HTMLMODE_HXX #define _SVX_HTMLMODE_HXX -// include --------------------------------------------------------------- - -// define ---------------------------------------------------------------- - -#define HTMLMODE_ON 0x0001 -#define HTMLMODE_PARA_BORDER 0x0002 /* Absatzumrandungen */ -#define HTMLMODE_PARA_DISTANCE 0x0004 /* bestimmte Absatzabstaende */ -#define HTMLMODE_SMALL_CAPS 0x0008 /* Kapitaelchen */ -#define HTMLMODE_FRM_COLUMNS 0x0010 /* spaltige Rahmen */ -#define HTMLMODE_SOME_STYLES 0x0020 /* mind. MS IE */ -#define HTMLMODE_FULL_STYLES 0x0040 /* == SW */ -#define HTMLMODE_BLINK 0x0080 /* blinkende Zeichen*/ -#define HTMLMODE_PARA_BLOCK 0x0100 /* Blocksatz */ -#define HTMLMODE_DROPCAPS 0x0200 /* Initialen*/ -#define HTMLMODE_FIRSTLINE 0x0400 /* Erstzeileneinzug mit Spacer == NS 3.0 */ -#define HTMLMODE_GRAPH_POS 0x0800 /* Grafikpositionen Hintergrund */ -#define HTMLMODE_FULL_ABS_POS 0x1000 /* abs. Rahmenpositionierung */ -#define HTMLMODE_SOME_ABS_POS 0x2000 /* abs. Rahmenpositionierung vollst.*/ -#define HTMLMODE_RESERVED1 0x4000 -#define HTMLMODE_RESERVED0 0x8000 - - +#include #endif diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index ee31d4ee3964..780da532ddb0 100755 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -182,7 +182,6 @@ #define RID_OFA_TP_INTERNATIONAL_IMPR (RID_OFA_START + 254) // 4 impress */ -#define SID_ATTR_XWINDOW (RID_OFA_START + 250) #define SID_ATTR_PARENTWINDOW (RID_OFA_START + 255) // -------------------------------------------------------------------------- @@ -343,18 +342,19 @@ // Calc-Id's // -------------------------------------------------------------------------- -#ifndef SC_FUNCTION_START -#define SC_FUNCTION_START (SID_SC_START + 200) -#endif -#ifndef FILE_MENU_END -#define FILE_MENU_END (SC_FUNCTION_START + 20) -#endif -#ifndef EDIT_MENU_START -#define EDIT_MENU_START (FILE_MENU_END) -#endif -#ifndef SC_VIEW_START -#define SC_VIEW_START (SID_SC_START) -#endif +//! moved to sfx2, still in use: +//#ifndef SC_FUNCTION_START +//#define SC_FUNCTION_START (SID_SC_START + 200) +//#endif +//#ifndef FILE_MENU_END +//#define FILE_MENU_END (SC_FUNCTION_START + 20) +//#endif +//#ifndef EDIT_MENU_START +//#define EDIT_MENU_START (FILE_MENU_END) +//#endif +//#ifndef SC_VIEW_START +//#define SC_VIEW_START (SID_SC_START) +//#endif #define SID_OUTLINE_HIDE (SID_SC_START + 329) #define SID_OUTLINE_SHOW (SID_SC_START + 330) @@ -366,8 +366,9 @@ #define SID_ATTR_SECIALCHAR (SID_SC_START + 581) #define SID_ATTR_SPECIALCHAR (SID_SC_START + 581) -#define FID_CHG_RECORD (EDIT_MENU_START + 18) -#define SID_CHG_PROTECT (SC_VIEW_START + 84) +//! moved to sfx2, still in use: +//#define FID_CHG_RECORD (EDIT_MENU_START + 18) +//#define SID_CHG_PROTECT (SC_VIEW_START + 84) // -------------------------------------------------------------------------- // Writer-Id's @@ -402,9 +403,10 @@ #define FN_PGPREVIEW (SID_SW_START + 1250) #define FN_SHOW_MULTIPLE_PAGES (FN_PGPREVIEW + 2) -#define FN_EDIT2 (SID_SW_START + 1800) -#define FN_REDLINE_PROTECT (FN_EDIT2 + 23) -#define FN_REDLINE_ON (FN_EDIT2 + 25) +//! moved to sfx2, still in use: +//#define FN_EDIT2 (SID_SW_START + 1800) +//#define FN_REDLINE_PROTECT (FN_EDIT2 + 23) +//#define FN_REDLINE_ON (FN_EDIT2 + 25) // -------------------------------------------------------------------------- // Svx-Id's @@ -748,7 +750,10 @@ #define SID_ATTR_3D_AMBIENTINTENSITY ( SID_SVX_START + 410 ) /* --> Slots mit --> koennen demnaechst entfallen ( heute 12.03.1998 ) */ #define SID_ATTR_3D_AMBIENTCOLOR ( SID_SVX_START + 411 ) #define SID_IMPORT_GRAPH_LINK ( SID_SVX_START + 412 ) -#define SID_HTML_MODE ( SID_SVX_START + 414 ) + +//! moved to sfx2, still in use: +//#define SID_HTML_MODE ( SID_SVX_START + 414 ) + #define SID_RULER_PROTECT ( SID_SVX_START + 415 ) //#define SID_INET_DLG ( SID_SVX_START + 416 ) -> sfxsids.hrc #define SID_COLOR_CONTROL ( SID_SVX_START + 417 ) -- cgit From 2005bc7b8b04f6eaa3d4636a3a1df1d6ff02f550 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 3 May 2010 09:08:38 +0200 Subject: cws tl78: build issues after merging with DEV300_m77 --- sfx2/source/view/viewfrm.cxx | 4 +--- uui/prj/build.lst | 2 +- uui/source/iahndl-authentication.cxx | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index aedd383b042a..c8cf7bd8c6c8 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -82,6 +82,7 @@ #include #include #include +#include #include #include @@ -183,9 +184,6 @@ static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteracti while ( !bResult && !bCancel ) { sal_Bool bMSType = !pFilter->IsOwnFormat(); - ::comphelper::DocPasswordRequestType nType = bMSType ? - ::comphelper::DocPasswordRequestType_MS : - ::comphelper::DocPasswordRequestType_STANDARD; ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( diff --git a/uui/prj/build.lst b/uui/prj/build.lst index 0ebacfcb814f..dbe31cb1b57e 100644 --- a/uui/prj/build.lst +++ b/uui/prj/build.lst @@ -1,4 +1,4 @@ -uu uui : l10n svtools NULL +uu uui : l10n vcl svtools NULL uu uui usr1 - all uu_mkout NULL uu uui\source nmake - all uu_source NULL uu uui\util nmake - all uu_util uu_source NULL diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index 7103fee29510..a84b1442a4ce 100755 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -428,8 +428,8 @@ executePasswordDialog( const sal_uInt16 nMaxPasswdLen = bMSCryptoMode ? 15 : 0; // 0 -> allow any length VclAbstractDialogFactory * pFact = VclAbstractDialogFactory::Create(); - std::auto_ptr< AbstractPasswordToOpenModifyDialog > pDialog( - pFact->CreatePasswordToOpenModifyDialog( pParent, 0, nMaxPasswdLen ) ); + AbstractPasswordToOpenModifyDialog *pTmp = pFact->CreatePasswordToOpenModifyDialog( pParent, 0, nMaxPasswdLen ); + std::auto_ptr< AbstractPasswordToOpenModifyDialog > pDialog( pTmp ); rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL ); rInfo.SetPassword( pDialog->GetPasswordToOpen() ); -- cgit From 86e2dc0dcb9d79f1267dbd88d68bba6da3de871e Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Mon, 3 May 2010 11:51:05 +0200 Subject: jl152 import 263452 from native0jl:#i77196# fixed bundled extension help tree view, scripts in shared extensions... --- basic/source/inc/namecont.hxx | 14 +- basic/source/uno/namecont.cxx | 16 +- .../registry/component/dp_compbackenddb.cxx | 93 ++----- .../registry/component/dp_compbackenddb.hxx | 3 +- .../source/deployment/registry/dp_backenddb.cxx | 308 ++++++++++++++++++--- .../registry/executable/dp_executablebackenddb.cxx | 89 +----- .../registry/executable/dp_executablebackenddb.hxx | 18 +- .../deployment/registry/help/dp_helpbackenddb.cxx | 76 ++--- .../deployment/registry/help/dp_helpbackenddb.hxx | 7 +- .../deployment/registry/inc/dp_backenddb.hxx | 35 +++ .../registry/package/dp_extbackenddb.cxx | 65 ++--- .../registry/package/dp_extbackenddb.hxx | 3 +- .../deployment/registry/script/dp_script.cxx | 254 ++++++++--------- .../registry/script/dp_scriptbackenddb.cxx | 88 ++++++ .../registry/script/dp_scriptbackenddb.hxx | 76 +++++ .../source/deployment/registry/script/makefile.mk | 3 +- .../framework/container/UnoPkgContainer.java | 20 +- .../script/framework/provider/ScriptProvider.java | 18 +- scripting/source/provider/ActiveMSPList.cxx | 7 + scripting/source/provider/ActiveMSPList.hxx | 1 + xmlhelp/source/cxxhelp/provider/databases.cxx | 3 +- xmlhelp/source/treeview/tvread.cxx | 47 +++- xmlhelp/source/treeview/tvread.hxx | 9 + 23 files changed, 796 insertions(+), 457 deletions(-) create mode 100644 desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx create mode 100644 desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index 2d24759d9b83..7cd2de701634 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -57,7 +58,7 @@ #include #include -#include +#include #include class BasicManager; @@ -65,11 +66,12 @@ class BasicManager; namespace basic { -typedef ::cppu::WeakComponentImplHelper6< +typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::lang::XInitialization, ::com::sun::star::script::XStorageBasedLibraryContainer, ::com::sun::star::script::XLibraryContainerPassword, ::com::sun::star::script::XLibraryContainerExport, + ::com::sun::star::script::XLibraryContainer3, ::com::sun::star::container::XContainer, ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper; @@ -405,6 +407,12 @@ public: virtual ::rtl::OUString SAL_CALL getContainerLocationName() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL storeLibraries( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + //Methods XLibraryContainer3 + virtual ::rtl::OUString SAL_CALL getOriginalLibraryLinkURL( const ::rtl::OUString& Name ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + // Methods XLibraryContainer2 (base of XPersistentLibraryContainer) virtual sal_Bool SAL_CALL isLibraryLink( const ::rtl::OUString& Name ) throw (::com::sun::star::container::NoSuchElementException, @@ -541,6 +549,8 @@ private: ::rtl::OUString maLibInfoFileURL; ::rtl::OUString maStorageURL; ::rtl::OUString maUnexpandedStorageURL; + ::rtl::OUString maOrignialStorageURL; + sal_Bool mbLink; sal_Bool mbReadOnly; sal_Bool mbReadOnlyLink; diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 7a6a771f85cc..e357b0e85f91 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -2169,6 +2169,7 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink SfxLibrary* pNewLib = implCreateLibraryLink( Name, aLibInfoFileURL, aLibDirURL, ReadOnly ); pNewLib->maLibElementFileExtension = maLibElementFileExtension; pNewLib->maUnexpandedStorageURL = aUnexpandedStorageURL; + pNewLib->maOrignialStorageURL = StorageURL; OUString aInitFileName; uno::Reference< embed::XStorage > xDummyStor; @@ -2788,6 +2789,19 @@ OUString SfxLibraryContainer::expand_url( const OUString& url ) } } +//XLibraryContainer3 +OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString& Name ) + throw (IllegalArgumentException, NoSuchElementException, RuntimeException) +{ + LibraryContainerMethodGuard aGuard( *this ); + SfxLibrary* pImplLib = getImplLib( Name ); + sal_Bool bLink = pImplLib->mbLink; + if( !bLink ) + throw IllegalArgumentException(); + OUString aRetStr = pImplLib->maOrignialStorageURL; + return aRetStr; +} + // Methods XServiceInfo ::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) @@ -3381,7 +3395,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri if( m_iSharedPackage == m_aSharedPackagesSeq.getLength() ) { - m_eState = END_REACHED; + m_eState = BUNDLED_EXTENSIONS; } else { diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.cxx b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx index 568ecca08138..898e7c931f6d 100644 --- a/desktop/source/deployment/registry/component/dp_compbackenddb.cxx +++ b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx @@ -46,6 +46,7 @@ using ::rtl::OUString; #define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/component-registry/2010" #define NS_PREFIX "comp" #define ROOT_ELEMENT_NAME "component-backend-db" +#define KEY_ELEMENT_NAME "component" namespace dp_registry { namespace backend { @@ -73,54 +74,31 @@ OUString ComponentBackendDb::getRootElementName() return OUSTR(ROOT_ELEMENT_NAME); } +OUString ComponentBackendDb::getKeyElementName() +{ + return OUSTR(KEY_ELEMENT_NAME); +} + void ComponentBackendDb::addEntry(::rtl::OUString const & url, Data const & data) { try{ - const OUString sNameSpace = getDbNSName(); - const OUString sPrefix = getNSPrefix(); - Reference doc = getDocument(); - Reference root = doc->getFirstChild(); - -#if OSL_DEBUG_LEVEL > 0 - //There must not be yet an entry with the same url - OUString sExpression( - sPrefix + OUSTR(":component[@url = \"") + url + OUSTR("\"]")); - Reference _extensionNode = - getXPathAPI()->selectSingleNode(root, sExpression); - OSL_ASSERT(! _extensionNode.is()); -#endif - Reference componentElement( - doc->createElementNS(sNameSpace, sPrefix + OUSTR(":component"))); - - componentElement->setAttribute(OUSTR("url"), url); - - Reference componentNode( - componentElement, UNO_QUERY_THROW); - - root->appendChild(componentNode); - - Reference javaTypeLibNode( - doc->createElementNS(sNameSpace, sPrefix + OUSTR(":java-type-library")), UNO_QUERY_THROW); - - componentNode->appendChild(javaTypeLibNode); - - Reference javaTypeLibValueNode( - doc->createTextNode(OUString::valueOf((sal_Bool) data.javaTypeLibrary)), - UNO_QUERY_THROW); - javaTypeLibNode->appendChild(javaTypeLibValueNode); + Reference componentNode = writeKeyElement(url); + writeSimpleElement(OUSTR("java-type-library"), + OUString::valueOf((sal_Bool) data.javaTypeLibrary), + componentNode); writeSimpleList( data.implementationNames, - sPrefix + OUSTR(":implementation-names"), - sPrefix + OUSTR(":name"), + OUSTR("implementation-names"), + OUSTR("name"), componentNode); writeVectorOfPair( data.singletons, - sPrefix + OUSTR(":singletons"), - sPrefix + OUSTR(":item"), - sPrefix + OUSTR(":key"), - sPrefix + OUSTR(":value"), + OUSTR("singletons"), + OUSTR("item"), + OUSTR("key"), + OUSTR("value"), componentNode); save(); @@ -134,50 +112,31 @@ void ComponentBackendDb::addEntry(::rtl::OUString const & url, Data const & data } } -void ComponentBackendDb::removeEntry(::rtl::OUString const & url) -{ - OUString sExpression( - OUSTR(NS_PREFIX) + OUSTR(":component[@url = \"") + url + OUSTR("\"]")); - removeElement(sExpression); -} - ComponentBackendDb::Data ComponentBackendDb::getEntry(::rtl::OUString const & url) { try { - const OUString sPrefix = getNSPrefix(); ComponentBackendDb::Data retData; - const OUString sExpression( - sPrefix + OUSTR(":component[@url = \"") + url + OUSTR("\"]")); - Reference doc = getDocument(); - Reference root = doc->getFirstChild(); - - Reference xpathApi = getXPathAPI(); - //find the extension element that is to be removed - Reference aNode = - xpathApi->selectSingleNode(root, sExpression); + Reference aNode = getKeyElement(url); if (aNode.is()) { - const OUString sExprJavaTypeLib(sPrefix + OUSTR(":java-type-library/text()")); - - Reference idValueNode = - xpathApi->selectSingleNode(aNode, sExprJavaTypeLib); - retData.javaTypeLibrary = - idValueNode->getNodeValue().equals(OUSTR("true")) ? true : false; + bool bJava = readSimpleElement(OUSTR("java-type-library"), aNode) + .equals(OUSTR("true")) ? true : false; + retData.javaTypeLibrary = bJava; retData.implementationNames = readList( aNode, - sPrefix + OUSTR(":implementation-names"), - sPrefix + OUSTR(":name")); + OUSTR("implementation-names"), + OUSTR("name")); retData.singletons = readVectorOfPair( aNode, - sPrefix + OUSTR(":singletons"), - sPrefix + OUSTR(":item"), - sPrefix + OUSTR(":key"), - sPrefix + OUSTR(":value")); + OUSTR("singletons"), + OUSTR("item"), + OUSTR("key"), + OUSTR("value")); } return retData; } diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.hxx b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx index 90ff41f2a4b8..b9a5ed737b7c 100644 --- a/desktop/source/deployment/registry/component/dp_compbackenddb.hxx +++ b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx @@ -85,6 +85,7 @@ protected: virtual ::rtl::OUString getDbNSName(); virtual ::rtl::OUString getNSPrefix(); virtual ::rtl::OUString getRootElementName(); + virtual ::rtl::OUString getKeyElementName(); public: struct Data @@ -104,7 +105,7 @@ public: ::rtl::OUString const & url); void addEntry(::rtl::OUString const & url, Data const & data); - void removeEntry(::rtl::OUString const & url); + Data getEntry(::rtl::OUString const & url); diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx index fe8b39b94d44..660c5ad80bf1 100644 --- a/desktop/source/deployment/registry/dp_backenddb.cxx +++ b/desktop/source/deployment/registry/dp_backenddb.cxx @@ -63,13 +63,13 @@ BackendDb::BackendDb( void BackendDb::save() { - Reference xDataSource(m_doc,css::uno::UNO_QUERY_THROW); + const Reference xDataSource(m_doc,css::uno::UNO_QUERY_THROW); ::rtl::ByteSequence bytes; xDataSource->setOutputStream(::xmlscript::createOutputStream(&bytes)); - Reference xDataControl(m_doc,css::uno::UNO_QUERY_THROW); + const Reference xDataControl(m_doc,css::uno::UNO_QUERY_THROW); xDataControl->start(); - Reference xData( + const Reference xData( ::xmlscript::createInputStream(bytes)); ::ucbhelper::Content ucbDb(m_urlDb, 0); ucbDb.writeStream(xData, true /*replace existing*/); @@ -79,7 +79,7 @@ css::uno::Reference BackendDb::getDocument() { if (!m_doc.is()) { - Reference xDocBuilder( + const Reference xDocBuilder( m_xContext->getServiceManager()->createInstanceWithContext( OUSTR("com.sun.star.xml.dom.DocumentBuilder"), m_xContext ), css::uno::UNO_QUERY); @@ -97,11 +97,10 @@ css::uno::Reference BackendDb::getDocument() { //Create a new document and insert some basic stuff m_doc = xDocBuilder->newDocument(); - Reference rootNode = + const Reference rootNode = m_doc->createElementNS(getDbNSName(), getNSPrefix() + OUSTR(":") + getRootElementName()); -// rootNode->setAttribute( -// OUSTR("xmlns"), getDbNSName()); + m_doc->appendChild(Reference( rootNode, UNO_QUERY_THROW)); save(); @@ -144,11 +143,11 @@ void BackendDb::removeElement(::rtl::OUString const & sXPathExpression) { try { - Reference doc = getDocument(); - Reference root = doc->getFirstChild(); - Reference xpathApi = getXPathAPI(); + const Reference doc = getDocument(); + const Reference root = doc->getFirstChild(); + const Reference xpathApi = getXPathAPI(); //find the extension element that is to be removed - Reference aNode = + const Reference aNode = xpathApi->selectSingleNode(root, sXPathExpression); if (aNode.is()) @@ -159,7 +158,7 @@ void BackendDb::removeElement(::rtl::OUString const & sXPathExpression) #if OSL_DEBUG_LEVEL > 0 //There must not be any other entry with the same url - Reference nextNode = + const Reference nextNode = xpathApi->selectSingleNode(root, sXPathExpression); OSL_ASSERT(! nextNode.is()); #endif @@ -171,7 +170,50 @@ void BackendDb::removeElement(::rtl::OUString const & sXPathExpression) OUSTR("Extension Manager: failed to write data entry in backend db: ") + m_urlDb, 0, exc); } +} +void BackendDb::removeEntry(::rtl::OUString const & url) +{ + const OUString sKeyElement = getKeyElementName(); + const OUString sPrefix = getNSPrefix(); + ::rtl::OUStringBuffer sExpression(500); + sExpression.append(sPrefix); + sExpression.appendAscii(":"); + sExpression.append(sKeyElement); + sExpression.append(OUSTR("[@url = \"")); + sExpression.append(url); + sExpression.appendAscii("\"]"); + + removeElement(sExpression.makeStringAndClear()); +} + +Reference BackendDb::getKeyElement( + ::rtl::OUString const & url) +{ + try + { + const OUString sPrefix = getNSPrefix(); + const OUString sKeyElement = getKeyElementName(); + ::rtl::OUStringBuffer sExpression(500); + sExpression.append(sPrefix); + sExpression.appendAscii(":"); + sExpression.append(sKeyElement); + sExpression.append(OUSTR("[@url = \"")); + sExpression.append(url); + sExpression.appendAscii("\"]"); + + const Reference doc = getDocument(); + const Reference root = doc->getFirstChild(); + const Reference xpathApi = getXPathAPI(); + return xpathApi->selectSingleNode(root, sExpression.makeStringAndClear()); + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read key element in backend db: ") + + m_urlDb, 0, exc); + } } //Only writes the data if there is at least one entry @@ -188,11 +230,12 @@ void BackendDb::writeVectorOfPair( return; const OUString sNameSpace = getDbNSName(); OSL_ASSERT(sNameSpace.getLength()); - Reference doc = getDocument(); - Reference root = doc->getFirstChild(); + const OUString sPrefix(getNSPrefix() + OUSTR(":")); + const Reference doc = getDocument(); + const Reference root = doc->getFirstChild(); - Reference vectorNode( - doc->createElementNS(sNameSpace, sVectorTagName)); + const Reference vectorNode( + doc->createElementNS(sNameSpace, sPrefix + sVectorTagName)); xParent->appendChild( Reference( @@ -200,35 +243,35 @@ void BackendDb::writeVectorOfPair( typedef ::std::vector< ::std::pair< OUString, OUString > >::const_iterator CIT; for (CIT i = vecPairs.begin(); i != vecPairs.end(); i++) { - Reference pairNode( - doc->createElementNS(sNameSpace, sPairTagName)); + const Reference pairNode( + doc->createElementNS(sNameSpace, sPrefix + sPairTagName)); vectorNode->appendChild( Reference( pairNode, css::uno::UNO_QUERY_THROW)); - Reference firstNode( - doc->createElementNS(sNameSpace, sFirstTagName)); + const Reference firstNode( + doc->createElementNS(sNameSpace, sPrefix + sFirstTagName)); pairNode->appendChild( Reference( firstNode, css::uno::UNO_QUERY_THROW)); - Reference firstTextNode( + const Reference firstTextNode( doc->createTextNode( i->first)); firstNode->appendChild( Reference( firstTextNode, css::uno::UNO_QUERY_THROW)); - Reference secondNode( - doc->createElementNS(sNameSpace, sSecondTagName)); + const Reference secondNode( + doc->createElementNS(sNameSpace, sPrefix + sSecondTagName)); pairNode->appendChild( Reference( secondNode, css::uno::UNO_QUERY_THROW)); - Reference secondTextNode( + const Reference secondTextNode( doc->createTextNode( i->second)); secondNode->appendChild( @@ -256,23 +299,24 @@ BackendDb::readVectorOfPair( try { OSL_ASSERT(parent.is()); - Reference xpathApi = getXPathAPI(); - OUString sExprPairs( - sListTagName + OUSTR("/") + sPairTagName); - Reference listPairs = + const OUString sPrefix(getNSPrefix() + OUSTR(":")); + const Reference xpathApi = getXPathAPI(); + const OUString sExprPairs( + sPrefix + sListTagName + OUSTR("/") + sPrefix + sPairTagName); + const Reference listPairs = xpathApi->selectNodeList(parent, sExprPairs); ::std::vector< ::std::pair< OUString, OUString > > retVector; sal_Int32 length = listPairs->getLength(); for (sal_Int32 i = 0; i < length; i++) { - Reference aPair = listPairs->item(i); - OUString sExprFirst(sFirstTagName + OUSTR("/text()")); - Reference first = + const Reference aPair = listPairs->item(i); + const OUString sExprFirst(sPrefix + sFirstTagName + OUSTR("/text()")); + const Reference first = xpathApi->selectSingleNode(aPair, sExprFirst); - OUString sExprSecond(sSecondTagName + OUSTR("/text()")); - Reference second = + const OUString sExprSecond(sPrefix + sSecondTagName + OUSTR("/text()")); + const Reference second = xpathApi->selectSingleNode(aPair, sExprSecond); OSL_ASSERT(first.is() && second.is()); @@ -302,10 +346,11 @@ void BackendDb::writeSimpleList( if (list.size() == 0) return; const OUString sNameSpace = getDbNSName(); - Reference doc = getDocument(); + const OUString sPrefix(getNSPrefix() + OUSTR(":")); + const Reference doc = getDocument(); - Reference listNode( - doc->createElementNS(sNameSpace, sListTagName)); + const Reference listNode( + doc->createElementNS(sNameSpace, sPrefix + sListTagName)); xParent->appendChild( Reference( @@ -314,12 +359,12 @@ void BackendDb::writeSimpleList( typedef ::std::list::const_iterator ITC_ITEMS; for (ITC_ITEMS i = list.begin(); i != list.end(); i++) { - Reference memberNode( - doc->createElementNS(sNameSpace, sMemberTagName), css::uno::UNO_QUERY_THROW); + const Reference memberNode( + doc->createElementNS(sNameSpace, sPrefix + sMemberTagName), css::uno::UNO_QUERY_THROW); listNode->appendChild(memberNode); - Reference textNode( + const Reference textNode( doc->createTextNode( *i), css::uno::UNO_QUERY_THROW); memberNode->appendChild(textNode); @@ -332,9 +377,105 @@ void BackendDb::writeSimpleList( OUSTR("Extension Manager: failed to write data entry in backend db: ") + m_urlDb, 0, exc); } +} + +//Writes only the element if is has a value. +//The prefix is automatically added to the element name +void BackendDb::writeSimpleElement( + OUString const & sElementName, OUString const & value, + Reference const & xParent) +{ + try + { + if (value.getLength() == 0) + return; + const OUString sPrefix = getNSPrefix(); + const Reference doc = getDocument(); + const OUString sNameSpace = getDbNSName(); + const Reference dataNode( + doc->createElementNS(sNameSpace, sPrefix + OUSTR(":") + sElementName), + UNO_QUERY_THROW); + xParent->appendChild(dataNode); + + const Reference dataValue( + doc->createTextNode(value), UNO_QUERY_THROW); + dataNode->appendChild(dataValue); + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to write data entry(writeSimpleElement) in backend db: ") + + m_urlDb, 0, exc); + } + +} + +/** The key elements have an url attribute and are always children of the root + element. +*/ +Reference BackendDb::writeKeyElement( + ::rtl::OUString const & url) +{ + try + { + const OUString sNameSpace = getDbNSName(); + const OUString sPrefix = getNSPrefix(); + const OUString sElementName = getKeyElementName(); + const Reference doc = getDocument(); + const Reference root = doc->getFirstChild(); +#if OSL_DEBUG_LEVEL > 0 + //There must not be yet an entry with the same url + const OUString sExpression( + sPrefix + OUSTR(":") + sElementName + OUSTR("[@url = \"") + url + OUSTR("\"]")); + const Reference _extensionNode = + getXPathAPI()->selectSingleNode(root, sExpression); + OSL_ASSERT(! _extensionNode.is()); +#endif + const Reference keyElement( + doc->createElementNS(sNameSpace, sPrefix + OUSTR(":") + sElementName)); + + keyElement->setAttribute(OUSTR("url"), url); + + const Reference keyNode( + keyElement, UNO_QUERY_THROW); + root->appendChild(keyNode); + return keyNode; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to write key element in backend db: ") + + m_urlDb, 0, exc); + } } +OUString BackendDb::readSimpleElement( + OUString const & sElementName, Reference const & xParent) +{ + try + { + const OUString sPrefix = getNSPrefix(); + const OUString sExpr(sPrefix + OUSTR(":") + sElementName + OUSTR("/text()")); + const Reference xpathApi = getXPathAPI(); + const Reference val = + xpathApi->selectSingleNode(xParent, sExpr); + if (val.is()) + return val->getNodeValue(); + return OUString(); + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data (readSimpleElement) in backend db: ") + + m_urlDb, 0, exc); + } +} + + ::std::list< OUString> BackendDb::readList( Reference const & parent, OUString const & sListTagName, @@ -343,17 +484,18 @@ void BackendDb::writeSimpleList( try { OSL_ASSERT(parent.is()); - Reference xpathApi = getXPathAPI(); - OUString sExprList( - sListTagName + OUSTR("/") + sMemberTagName + OUSTR("/text()")); - Reference list = + const OUString sPrefix(getNSPrefix() + OUSTR(":")); + const Reference xpathApi = getXPathAPI(); + const OUString sExprList( + sPrefix + sListTagName + OUSTR("/") + sPrefix + sMemberTagName + OUSTR("/text()")); + const Reference list = xpathApi->selectNodeList(parent, sExprList); ::std::list retList; sal_Int32 length = list->getLength(); for (sal_Int32 i = 0; i < length; i++) { - Reference member = list->item(i); + const Reference member = list->item(i); retList.push_back(member->getNodeValue()); } return retList; @@ -369,6 +511,84 @@ void BackendDb::writeSimpleList( +//================================================================================ +RegisteredDb::RegisteredDb( + Reference const & xContext, + ::rtl::OUString const & url):BackendDb(xContext, url) +{ + +} + +void RegisteredDb::addEntry(::rtl::OUString const & url) +{ + try{ + + const OUString sNameSpace = getDbNSName(); + const OUString sPrefix = getNSPrefix(); + const OUString sEntry = getKeyElementName(); + + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + +#if OSL_DEBUG_LEVEL > 0 + //There must not be yet an entry with the same url + OUString sExpression( + sPrefix + OUSTR(":") + sEntry + OUSTR("[@url = \"") + url + OUSTR("\"]")); + Reference _extensionNode = + getXPathAPI()->selectSingleNode(root, sExpression); + OSL_ASSERT(! _extensionNode.is()); +#endif + Reference helpElement( + doc->createElementNS(sNameSpace, sPrefix + OUSTR(":") + sEntry)); + + helpElement->setAttribute(OUSTR("url"), url); + + Reference helpNode( + helpElement, UNO_QUERY_THROW); + root->appendChild(helpNode); + + save(); + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to write data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + +bool RegisteredDb::getEntry(::rtl::OUString const & url) +{ + try + { + const OUString sPrefix = getNSPrefix(); + const OUString sEntry = getKeyElementName(); + const OUString sExpression( + sPrefix + OUSTR(":") + sEntry + OUSTR("[@url = \"") + url + OUSTR("\"]")); + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + + Reference xpathApi = getXPathAPI(); + //find the extension element that is to be removed + Reference aNode = + xpathApi->selectSingleNode(root, sExpression); + if (!aNode.is()) + { + return false; + } + return true; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + + } // namespace backend } // namespace dp_registry diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx index 893a58ee8c64..976a6281a2bd 100644 --- a/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx +++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx @@ -32,13 +32,8 @@ #include "precompiled_desktop.hxx" #include "rtl/string.h" -#include "rtl/bootstrap.hxx" -#include "cppuhelper/exc_hlp.hxx" #include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/xml/dom/XDocumentBuilder.hpp" -#include "com/sun/star/xml/xpath/XXPathAPI.hpp" #include "dp_misc.h" - #include "dp_executablebackenddb.hxx" @@ -49,6 +44,7 @@ using ::rtl::OUString; #define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/executable-registry/2010" #define NS_PREFIX "exe" #define ROOT_ELEMENT_NAME "executable-backend-db" +#define ENTRY_NAME "executable" namespace dp_registry { namespace backend { @@ -56,7 +52,7 @@ namespace executable { ExecutableBackendDb::ExecutableBackendDb( Reference const & xContext, - ::rtl::OUString const & url):BackendDb(xContext, url) + ::rtl::OUString const & url):RegisteredDb(xContext, url) { } @@ -76,86 +72,9 @@ OUString ExecutableBackendDb::getRootElementName() return OUSTR(ROOT_ELEMENT_NAME); } -void ExecutableBackendDb::addEntry(::rtl::OUString const & url) +OUString ExecutableBackendDb::getKeyElementName() { - try{ - - const OUString sNameSpace = getDbNSName(); - const OUString sPrefix = getNSPrefix(); - Reference doc = getDocument(); - Reference root = doc->getFirstChild(); - -#if OSL_DEBUG_LEVEL > 0 - //There must not be yet an entry with the same url - OUString sExpression( - sPrefix + OUSTR(":executable[@url = \"") + url + OUSTR("\"]")); - Reference _extensionNode = - getXPathAPI()->selectSingleNode(root, sExpression); - OSL_ASSERT(! _extensionNode.is()); -#endif - Reference helpElement( - doc->createElementNS(sNameSpace, sPrefix + OUSTR(":executable"))); - - helpElement->setAttribute(OUSTR("url"), url); - - Reference helpNode( - helpElement, UNO_QUERY_THROW); - root->appendChild(helpNode); - -// Reference dataNode( -// doc->createElementNS(sNameSpace, sPrefix + OUSTR(":data-url")), -// UNO_QUERY_THROW); -// helpNode->appendChild(dataNode); - -// Reference dataValue( -// doc->createTextNode(data.dataUrl), UNO_QUERY_THROW); -// dataNode->appendChild(dataValue); - - save(); - } - catch(css::uno::Exception &) - { - Any exc( ::cppu::getCaughtException() ); - throw css::deployment::DeploymentException( - OUSTR("Extension Manager: failed to write data entry in backend db: ") + - m_urlDb, 0, exc); - } -} - -void ExecutableBackendDb::removeEntry(::rtl::OUString const & url) -{ - OUString sExpression( - OUSTR(NS_PREFIX) + OUSTR(":executable[@url = \"") + url + OUSTR("\"]")); - removeElement(sExpression); -} - -bool ExecutableBackendDb::getEntry(::rtl::OUString const & url) -{ - try - { - const OUString sPrefix = getNSPrefix(); - const OUString sExpression( - sPrefix + OUSTR(":executable[@url = \"") + url + OUSTR("\"]")); - Reference doc = getDocument(); - Reference root = doc->getFirstChild(); - - Reference xpathApi = getXPathAPI(); - //find the extension element that is to be removed - Reference aNode = - xpathApi->selectSingleNode(root, sExpression); - if (!aNode.is()) - { - return false; - } - return true; - } - catch(css::uno::Exception &) - { - Any exc( ::cppu::getCaughtException() ); - throw css::deployment::DeploymentException( - OUSTR("Extension Manager: failed to read data entry in backend db: ") + - m_urlDb, 0, exc); - } + return OUSTR(ENTRY_NAME); } diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx index 2634d1d9d376..4f17eeda24a6 100644 --- a/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx +++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx @@ -32,10 +32,6 @@ #define INCLUDED_DP_EXECUTABLEBACKENDDB_HXX #include "rtl/ustring.hxx" -#include "rtl/string.hxx" -#include -#include -#include "boost/optional.hpp" #include "dp_backenddb.hxx" namespace css = ::com::sun::star; @@ -44,13 +40,6 @@ namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } - namespace xml { namespace dom { - class XDocument; - class XNode; - }} - namespace xml { namespace xpath { - class XXPathAPI; - }} }}} namespace dp_registry { @@ -63,7 +52,7 @@ namespace executable { */ -class ExecutableBackendDb: public dp_registry::backend::BackendDb +class ExecutableBackendDb: public dp_registry::backend::RegisteredDb { protected: virtual ::rtl::OUString getDbNSName(); @@ -72,14 +61,13 @@ protected: virtual ::rtl::OUString getRootElementName(); + virtual ::rtl::OUString getKeyElementName(); + public: ExecutableBackendDb( css::uno::Reference const & xContext, ::rtl::OUString const & url); - void addEntry(::rtl::OUString const & url); - void removeEntry(::rtl::OUString const & url); - bool getEntry(::rtl::OUString const & url); }; diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx index cad6ddecf751..4a8fa71e0618 100644 --- a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx @@ -49,6 +49,7 @@ using ::rtl::OUString; #define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/help-registry/2010" #define NS_PREFIX "help" #define ROOT_ELEMENT_NAME "help-backend-db" +#define KEY_ELEMENT_NAME "help" namespace dp_registry { namespace backend { @@ -76,43 +77,25 @@ OUString HelpBackendDb::getRootElementName() return OUSTR(ROOT_ELEMENT_NAME); } -void HelpBackendDb::addEntry(::rtl::OUString const & url, Data const & data) +OUString HelpBackendDb::getKeyElementName() { - try{ - - const OUString sNameSpace = getDbNSName(); - const OUString sPrefix = getNSPrefix(); - Reference doc = getDocument(); - Reference root = doc->getFirstChild(); - -#if OSL_DEBUG_LEVEL > 0 - //There must not be yet an entry with the same url - OUString sExpression( - sPrefix + OUSTR(":help[@url = \"") + url + OUSTR("\"]")); - Reference _extensionNode = - getXPathAPI()->selectSingleNode(root, sExpression); - OSL_ASSERT(! _extensionNode.is()); -#endif - Reference helpElement( - doc->createElementNS(sNameSpace, sPrefix + OUSTR(":help"))); - - helpElement->setAttribute(OUSTR("url"), url); - - Reference helpNode( - helpElement, UNO_QUERY_THROW); - root->appendChild(helpNode); + return OUSTR(KEY_ELEMENT_NAME); +} - Reference dataNode( - doc->createElementNS(sNameSpace, sPrefix + OUSTR(":data-url")), - UNO_QUERY_THROW); - helpNode->appendChild(dataNode); - Reference dataValue( - doc->createTextNode(data.dataUrl), UNO_QUERY_THROW); - dataNode->appendChild(dataValue); +void HelpBackendDb::addEntry(::rtl::OUString const & url, Data const & data) +{ + try{ + Reference helpNode + = writeKeyElement(url); + writeSimpleElement(OUSTR("data-url"), data.dataUrl, helpNode); save(); } + catch (css::deployment::DeploymentException& ) + { + throw; + } catch(css::uno::Exception &) { Any exc( ::cppu::getCaughtException() ); @@ -122,36 +105,17 @@ void HelpBackendDb::addEntry(::rtl::OUString const & url, Data const & data) } } -void HelpBackendDb::removeEntry(::rtl::OUString const & url) -{ - OUString sExpression( - OUSTR(NS_PREFIX) + OUSTR(":help[@url = \"") + url + OUSTR("\"]")); - removeElement(sExpression); -} ::boost::optional HelpBackendDb::getEntry(::rtl::OUString const & url) { try { - const OUString sPrefix = getNSPrefix(); HelpBackendDb::Data retData; - const OUString sExpression( - sPrefix + OUSTR(":help[@url = \"") + url + OUSTR("\"]")); - Reference doc = getDocument(); - Reference root = doc->getFirstChild(); - - Reference xpathApi = getXPathAPI(); - //find the extension element that is to be removed - Reference aNode = - xpathApi->selectSingleNode(root, sExpression); + Reference aNode = getKeyElement(url); if (aNode.is()) { - const OUString sExprDataUrl(sPrefix + OUSTR(":data-url/text()")); - - Reference dataUrlVal = - xpathApi->selectSingleNode(aNode, sExprDataUrl); - retData.dataUrl = dataUrlVal->getNodeValue(); + retData.dataUrl = readSimpleElement(OUSTR("data-url"), aNode); } else { @@ -159,6 +123,10 @@ HelpBackendDb::getEntry(::rtl::OUString const & url) } return ::boost::optional(retData); } + catch (css::deployment::DeploymentException& ) + { + throw; + } catch(css::uno::Exception &) { Any exc( ::cppu::getCaughtException() ); @@ -190,6 +158,10 @@ HelpBackendDb::getEntry(::rtl::OUString const & url) } return listRet; } + catch (css::deployment::DeploymentException& ) + { + throw; + } catch(css::uno::Exception &) { Any exc( ::cppu::getCaughtException() ); diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx index bf812ad96511..baecf0da48e6 100644 --- a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx @@ -59,9 +59,6 @@ namespace help { /* The XML file stores the extensions which are currently registered. They will be removed when they are revoked. - The format looks like this: - - */ class HelpBackendDb: public dp_registry::backend::BackendDb { @@ -72,6 +69,8 @@ protected: virtual ::rtl::OUString getRootElementName(); + virtual ::rtl::OUString getKeyElementName(); + public: struct Data { @@ -87,7 +86,7 @@ public: ::rtl::OUString const & url); void addEntry(::rtl::OUString const & url, Data const & data); - void removeEntry(::rtl::OUString const & url); + ::boost::optional getEntry(::rtl::OUString const & url); ::std::list< ::rtl::OUString> getAllDataUrls(); diff --git a/desktop/source/deployment/registry/inc/dp_backenddb.hxx b/desktop/source/deployment/registry/inc/dp_backenddb.hxx index ca28f28ac390..b8ba5facd492 100644 --- a/desktop/source/deployment/registry/inc/dp_backenddb.hxx +++ b/desktop/source/deployment/registry/inc/dp_backenddb.hxx @@ -30,6 +30,7 @@ #include "rtl/ustring.hxx" #include +#include namespace css = ::com::sun::star; @@ -75,6 +76,9 @@ protected: void save(); void removeElement(::rtl::OUString const & sXPathExpression); + css::uno::Reference getKeyElement( + ::rtl::OUString const & url); + void writeSimpleList( ::std::list< ::rtl::OUString> const & list, ::rtl::OUString const & sListTagName, @@ -89,6 +93,17 @@ protected: ::rtl::OUString const & sSecondTagName, css::uno::Reference const & xParent); + void writeSimpleElement( + ::rtl::OUString const & sElementName, ::rtl::OUString const & value, + css::uno::Reference const & xParent); + + css::uno::Reference writeKeyElement( + ::rtl::OUString const & url); + + ::rtl::OUString readSimpleElement( + ::rtl::OUString const & sElementName, + css::uno::Reference const & xParent); + ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > readVectorOfPair( css::uno::Reference const & parent, @@ -117,6 +132,10 @@ protected: /* returns the name of the root element without any namespace prefix. */ virtual ::rtl::OUString getRootElementName()=0; + /* returns the name of xml element for each entry + */ + virtual ::rtl::OUString getKeyElementName()=0; + public: @@ -124,8 +143,24 @@ public: ::rtl::OUString const & url); virtual ~BackendDb() {}; + void removeEntry(::rtl::OUString const & url); }; +class RegisteredDb: public BackendDb +{ + +public: + RegisteredDb( css::uno::Reference const & xContext, + ::rtl::OUString const & url); + virtual ~RegisteredDb() {}; + + + virtual void addEntry(::rtl::OUString const & url); + virtual bool getEntry(::rtl::OUString const & url); + +}; + + } } #endif diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.cxx b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx index 99aa2178b421..2e92a907f8fb 100644 --- a/desktop/source/deployment/registry/package/dp_extbackenddb.cxx +++ b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx @@ -46,6 +46,7 @@ using ::rtl::OUString; #define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/extension-registry/2010" #define NS_PREFIX "ext" #define ROOT_ELEMENT_NAME "extension-backend-db" +#define KEY_ELEMENT_NAME "extension" namespace dp_registry { namespace backend { @@ -73,40 +74,21 @@ OUString ExtensionBackendDb::getRootElementName() return OUSTR(ROOT_ELEMENT_NAME); } +OUString ExtensionBackendDb::getKeyElementName() +{ + return OUSTR(KEY_ELEMENT_NAME); +} + void ExtensionBackendDb::addEntry(::rtl::OUString const & url, Data const & data) { try{ - - const OUString sNameSpace = getDbNSName(); - const OUString sPrefix = getNSPrefix(); - Reference doc = getDocument(); - Reference root = doc->getFirstChild(); - -#if OSL_DEBUG_LEVEL > 0 - //There must not be yet an entry with the same url - OUString sExpression( - sPrefix + OUSTR(":extension[@url = \"") + url + OUSTR("\"]")); - Reference _extensionNode = - getXPathAPI()->selectSingleNode(root, sExpression); - OSL_ASSERT(! _extensionNode.is()); -#endif - // - Reference extensionNode( - doc->createElementNS(sNameSpace, - sPrefix + OUSTR(":extension"))); - - extensionNode->setAttribute(OUSTR("url"), url); - - Reference extensionNodeNode( - extensionNode, css::uno::UNO_QUERY_THROW); - root->appendChild(extensionNodeNode); - + Reference extensionNodeNode = writeKeyElement(url); writeVectorOfPair( data.items, - sPrefix + OUSTR(":extension-items"), - sPrefix + OUSTR(":item"), - sPrefix + OUSTR(":url"), - sPrefix + OUSTR(":media-type"), + OUSTR("extension-items"), + OUSTR("item"), + OUSTR("url"), + OUSTR("media-type"), extensionNodeNode); save(); } @@ -119,37 +101,22 @@ void ExtensionBackendDb::addEntry(::rtl::OUString const & url, Data const & data } } -void ExtensionBackendDb::removeEntry(::rtl::OUString const & url) -{ - OUString sExpression( - OUSTR(NS_PREFIX) + OUSTR(":extension[@url = \"") + url + OUSTR("\"]")); - removeElement(sExpression); -} - ExtensionBackendDb::Data ExtensionBackendDb::getEntry(::rtl::OUString const & url) { try { - const OUString sPrefix = getNSPrefix(); ExtensionBackendDb::Data retData; - const OUString sExpression( - sPrefix + OUSTR(":extension[@url = \"") + url + OUSTR("\"]")); - Reference doc = getDocument(); - Reference root = doc->getFirstChild(); - - Reference xpathApi = getXPathAPI(); + Reference aNode = getKeyElement(url); - Reference aNode = - xpathApi->selectSingleNode(root, sExpression); if (aNode.is()) { retData.items = readVectorOfPair( aNode, - sPrefix + OUSTR(":extension-items"), - sPrefix + OUSTR(":item"), - sPrefix + OUSTR(":url"), - sPrefix + OUSTR(":media-type")); + OUSTR("extension-items"), + OUSTR("item"), + OUSTR("url"), + OUSTR("media-type")); } return retData; } diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.hxx b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx index e46c67b166de..d09fd0891a32 100644 --- a/desktop/source/deployment/registry/package/dp_extbackenddb.hxx +++ b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx @@ -62,6 +62,7 @@ protected: virtual ::rtl::OUString getDbNSName(); virtual ::rtl::OUString getNSPrefix(); virtual ::rtl::OUString getRootElementName(); + virtual ::rtl::OUString getKeyElementName(); public: struct Data @@ -81,7 +82,7 @@ public: ::rtl::OUString const & url); void addEntry(::rtl::OUString const & url, Data const & data); - void removeEntry(::rtl::OUString const & url); + Data getEntry(::rtl::OUString const & url); }; diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index e808cd0f5e73..f0c4c9b42c6e 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -39,12 +39,12 @@ #include "comphelper/servicedecl.hxx" #include "svl/inettype.hxx" #include "com/sun/star/util/XUpdatable.hpp" -#include "com/sun/star/script/XLibraryContainer.hpp" +#include "com/sun/star/script/XLibraryContainer3.hpp" #include #include #include -#include #include +#include "dp_scriptbackenddb.hxx" using namespace ::dp_misc; using namespace ::com::sun::star; @@ -100,15 +100,19 @@ class BackendImpl : public t_helper sal_Bool bRemoved, OUString const & identifier, Reference const & xCmdEnv ); - rtl::OUString getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage ); - rtl::OUString expandURL( const rtl::OUString& aURL ); - Reference< ucb::XSimpleFileAccess > getFileAccess( void ); - Reference< ucb::XSimpleFileAccess > m_xSFA; + void addDataToDb(OUString const & url); + void deleteDataFromDb(OUString const & url); + bool isRegisteredInDb(OUString const & url); + + + +// Reference< ucb::XSimpleFileAccess > getFileAccess( void ); +// Reference< ucb::XSimpleFileAccess > m_xSFA; const Reference m_xBasicLibTypeInfo; const Reference m_xDialogLibTypeInfo; Sequence< Reference > m_typeInfos; - + std::auto_ptr m_backendDb; public: BackendImpl( Sequence const & args, Reference const & xComponentContext ); @@ -172,6 +176,33 @@ BackendImpl::BackendImpl( m_typeInfos[ 1 ] = m_xDialogLibTypeInfo; OSL_ASSERT( ! transientMode() ); + + if (!transientMode()) + { + OUString dbFile = makeURL(getCachePath(), OUSTR("backenddb.xml")); + m_backendDb.reset( + new ScriptBackendDb(getComponentContext(), dbFile)); + } + +} +void BackendImpl::addDataToDb(OUString const & url) +{ + if (m_backendDb.get()) + m_backendDb->addEntry(url); +} + +bool BackendImpl::isRegisteredInDb(OUString const & url) +{ + bool registered = false; + if (m_backendDb.get()) + registered = m_backendDb->getEntry(url); + return registered; +} + +void BackendImpl::deleteDataFromDb(OUString const & url) +{ + if (m_backendDb.get()) + m_backendDb->removeEntry(url); } // XUpdatable @@ -261,90 +292,6 @@ Reference BackendImpl::bindPackage_( static_cast(-1) ); } -rtl::OUString BackendImpl::getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage ) -{ - rtl::OUString aRetURL; - if( !xPackage.is() ) - return aRetURL; - rtl::OUString aHelpURL = xPackage->getURL(); - aRetURL = expandURL( aHelpURL ); - aRetURL += rtl::OUString::createFromAscii( "/RegisteredFlag" ); - return aRetURL; -} - -rtl::OUString BackendImpl::expandURL( const rtl::OUString& aURL ) -{ - static Reference< util::XMacroExpander > xMacroExpander; - static Reference< uri::XUriReferenceFactory > xFac; - - if( !xMacroExpander.is() || !xFac.is() ) - { - Reference const & xContext = getComponentContext(); - if( xContext.is() ) - { - xFac = Reference< uri::XUriReferenceFactory >( - xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( - "com.sun.star.uri.UriReferenceFactory"), xContext ) , UNO_QUERY ); - } - if( !xFac.is() ) - { - throw RuntimeException( - ::rtl::OUString::createFromAscii( - "dp_registry::backend::help::BackendImpl::expandURL(), " - "could not instatiate UriReferenceFactory." ), - Reference< XInterface >() ); - } - - xMacroExpander = Reference< util::XMacroExpander >( - xContext->getValueByName( - ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.util.theMacroExpander" ) ), - UNO_QUERY_THROW ); - } - - rtl::OUString aRetURL = aURL; - if( xMacroExpander.is() ) - { - Reference< uri::XUriReference > uriRef; - for (;;) - { - uriRef = Reference< uri::XUriReference >( xFac->parse( aRetURL ), UNO_QUERY ); - if ( uriRef.is() ) - { - Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY ); - if( !sxUri.is() ) - break; - - aRetURL = sxUri->expand( xMacroExpander ); - } - } - } - return aRetURL; -} - -Reference< ucb::XSimpleFileAccess > BackendImpl::getFileAccess( void ) -{ - if( !m_xSFA.is() ) - { - Reference const & xContext = getComponentContext(); - if( xContext.is() ) - { - m_xSFA = Reference< ucb::XSimpleFileAccess >( - xContext->getServiceManager()->createInstanceWithContext( - rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), - xContext ), UNO_QUERY ); - } - if( !m_xSFA.is() ) - { - throw RuntimeException( - ::rtl::OUString::createFromAscii( - "dp_registry::backend::help::BackendImpl::getFileAccess(), " - "could not instatiate SimpleFileAccess." ), - Reference< XInterface >() ); - } - } - return m_xSFA; -} - //############################################################################## // Package @@ -373,14 +320,11 @@ BackendImpl::PackageImpl::isRegistered_( BackendImpl * that = getMyBackend(); Reference< deployment::XPackage > xThisPackage( this ); - rtl::OUString aRegisteredFlagFile = that->getRegisteredFlagFileURL( xThisPackage ); - - Reference< ucb::XSimpleFileAccess > xSFA = that->getFileAccess(); - bool bReg = xSFA->exists( aRegisteredFlagFile ); + bool registered = getMyBackend()->isRegisteredInDb(getURL()); return beans::Optional< beans::Ambiguous >( true /* IsPresent */, - beans::Ambiguous( bReg, false /* IsAmbiguous */ ) ); + beans::Ambiguous( registered, false /* IsAmbiguous */ ) ); } //______________________________________________________________________________ @@ -396,15 +340,13 @@ void BackendImpl::PackageImpl::processPackage_( BackendImpl * that = getMyBackend(); Reference< deployment::XPackage > xThisPackage( this ); - rtl::OUString aRegisteredFlagFile = that->getRegisteredFlagFileURL( xThisPackage ); - Reference< ucb::XSimpleFileAccess > xSFA = that->getFileAccess(); Reference const & xComponentContext = that->getComponentContext(); bool bScript = (m_scriptURL.getLength() > 0); - Reference xScriptLibs; + Reference xScriptLibs; bool bDialog = (m_dialogURL.getLength() > 0); - Reference xDialogLibs; + Reference xDialogLibs; bool bRunning = office_is_running(); if( bRunning ) @@ -425,52 +367,116 @@ void BackendImpl::PackageImpl::processPackage_( xComponentContext ), UNO_QUERY_THROW ); } } - + bool bRegistered = getMyBackend()->isRegisteredInDb(getURL()); if( !doRegisterPackage ) { - if( xSFA->exists( aRegisteredFlagFile ) ) + //We cannot just call removeLibrary(name) because this could remove a + //script which was added by an extension in a different repository. For + //example, extension foo is contained in the bundled repository and then + //the user adds it it to the user repository. The extension manager will + //then register the new script and revoke the script from the bundled + //extension. removeLibrary(name) would now remove the script from the + //user repository. That is, the script of the newly added user extension does + //not work anymore. Therefore we must check if the currently active + //script comes in fact from the currently processed extension. + + if (bRegistered) { - xSFA->kill( aRegisteredFlagFile ); - - if( bScript && xScriptLibs.is() && xScriptLibs->hasByName( m_name ) ) - xScriptLibs->removeLibrary( m_name ); + if (!isRemoved()) + { + if (bScript && xScriptLibs.is() && xScriptLibs->hasByName(m_name)) + { + const OUString sScriptUrl = xScriptLibs->getOriginalLibraryLinkURL(m_name); + if (sScriptUrl.equals(m_scriptURL)) + xScriptLibs->removeLibrary(m_name); + } - if( bDialog && xDialogLibs.is() && xDialogLibs->hasByName( m_dialogName ) ) - xDialogLibs->removeLibrary( m_dialogName ); + if (bDialog && xDialogLibs.is() && xDialogLibs->hasByName(m_dialogName)) + { + const OUString sDialogUrl = xDialogLibs->getOriginalLibraryLinkURL(m_dialogName); + if (sDialogUrl.equals(m_dialogURL)) + xDialogLibs->removeLibrary(m_dialogName); + } + } + getMyBackend()->deleteDataFromDb(getURL()); + return; } - return; } - - if( xSFA->exists( aRegisteredFlagFile ) ) + if (bRegistered) return; // Already registered // Update LibraryContainer bool bScriptSuccess = false; const bool bReadOnly = false; - if( bScript && xScriptLibs.is() && !xScriptLibs->hasByName( m_name ) ) + + //If there is a bundled extension, and the user installes the same extension + //then the script from the bundled extension must be removed. If this does not work + //then live deployment does not work for scripts. + if (bScript && xScriptLibs.is()) { - xScriptLibs->createLibraryLink( m_name, m_scriptURL, bReadOnly ); - bScriptSuccess = xScriptLibs->hasByName( m_name ); + bool bCanAdd = true; + if (xScriptLibs->hasByName(m_name)) + { + const OUString sOriginalUrl = xScriptLibs->getOriginalLibraryLinkURL(m_name); + //We assume here that library names in extensions are unique, which may not be the case + //ToDo: If the script exist in another extension, then both extensions must have the + //same id + if (sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE")) + || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE")) + || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"))) + { + xScriptLibs->removeLibrary(m_name); + bCanAdd = true; + } + else + { + bCanAdd = false; + } + } + + if (bCanAdd) + { + xScriptLibs->createLibraryLink( m_name, m_scriptURL, bReadOnly ); + bScriptSuccess = xScriptLibs->hasByName( m_name ); + } } bool bDialogSuccess = false; - if( bDialog && xDialogLibs.is() && !xDialogLibs->hasByName( m_dialogName ) ) + if (bDialog && xDialogLibs.is()) { - xDialogLibs->createLibraryLink( m_dialogName, m_dialogURL, bReadOnly ); - bDialogSuccess = xDialogLibs->hasByName( m_dialogName ); - } + bool bCanAdd = true; + if (xDialogLibs->hasByName(m_dialogName)) + { + const OUString sOriginalUrl = xDialogLibs->getOriginalLibraryLinkURL(m_dialogName); + //We assume here that library names in extensions are unique, which may not be the case + //ToDo: If the script exist in another extension, then both extensions must have the + //same id + if (sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE")) + || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE")) + || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"))) + { + xDialogLibs->removeLibrary(m_dialogName); + bCanAdd = true; + } + else + { + bCanAdd = false; + } + } + if (bCanAdd) + { + xDialogLibs->createLibraryLink( m_dialogName, m_dialogURL, bReadOnly ); + bDialogSuccess = xDialogLibs->hasByName(m_dialogName); + } + } bool bSuccess = bScript || bDialog; // Something must have happened if( bRunning ) if( (bScript && !bScriptSuccess) || (bDialog && !bDialogSuccess) ) bSuccess = false; - if( bSuccess && !xSFA->exists( aRegisteredFlagFile ) ) - { - Reference< io::XOutputStream > xOutputStream = xSFA->openFileWrite( aRegisteredFlagFile ); - if( xOutputStream.is() ) - xOutputStream->closeOutput(); - } + if (bSuccess) + getMyBackend()->addDataToDb(getURL()); } } // anon namespace diff --git a/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx b/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx new file mode 100644 index 000000000000..ce0d3029084d --- /dev/null +++ b/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dp_package.cxx,v $ + * $Revision: 1.34.16.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "rtl/string.h" +#include "cppuhelper/exc_hlp.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/xml/dom/XDocument.hpp" +#include "com/sun/star/xml/xpath/XXPathAPI.hpp" +#include "dp_misc.h" +#include "dp_scriptbackenddb.hxx" + + +namespace css = ::com::sun::star; +using namespace ::com::sun::star::uno; +using ::rtl::OUString; + +#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/script-registry/2010" +#define NS_PREFIX "script" +#define ROOT_ELEMENT_NAME "script-backend-db" +#define KEY_ELEMENT_NAME "script" + +namespace dp_registry { +namespace backend { +namespace script { + +ScriptBackendDb::ScriptBackendDb( + Reference const & xContext, + ::rtl::OUString const & url):RegisteredDb(xContext, url) +{ + +} + +OUString ScriptBackendDb::getDbNSName() +{ + return OUSTR(EXTENSION_REG_NS); +} + +OUString ScriptBackendDb::getNSPrefix() +{ + return OUSTR(NS_PREFIX); +} + +OUString ScriptBackendDb::getRootElementName() +{ + return OUSTR(ROOT_ELEMENT_NAME); +} + +OUString ScriptBackendDb::getKeyElementName() +{ + return OUSTR(KEY_ELEMENT_NAME); +} + + + +} // namespace executable +} // namespace backend +} // namespace dp_registry + diff --git a/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx b/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx new file mode 100644 index 000000000000..9d227f8b64b8 --- /dev/null +++ b/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dp_backend.h,v $ + * $Revision: 1.18 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_DP_SCRIPTBACKENDDB_HXX +#define INCLUDED_DP_SCRIPTBACKENDDB_HXX + +#include "rtl/ustring.hxx" +#include "dp_backenddb.hxx" +#include "boost/optional.hpp" +namespace css = ::com::sun::star; + +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + } +}}} + +namespace dp_registry { +namespace backend { +namespace script { + +/* The XML file stores the extensions which are currently registered. + They will be removed when they are revoked. + */ +class ScriptBackendDb: public dp_registry::backend::RegisteredDb +{ +protected: + virtual ::rtl::OUString getDbNSName(); + + virtual ::rtl::OUString getNSPrefix(); + + virtual ::rtl::OUString getRootElementName(); + + virtual ::rtl::OUString getKeyElementName(); + + +public: + + ScriptBackendDb( css::uno::Reference const & xContext, + ::rtl::OUString const & url); +}; + + + +} +} +} +#endif + diff --git a/desktop/source/deployment/registry/script/makefile.mk b/desktop/source/deployment/registry/script/makefile.mk index ae159914a548..708def358021 100644 --- a/desktop/source/deployment/registry/script/makefile.mk +++ b/desktop/source/deployment/registry/script/makefile.mk @@ -41,7 +41,8 @@ INCPRE += ..$/..$/inc SLOFILES = \ $(SLO)$/dp_script.obj \ - $(SLO)$/dp_lib_container.obj + $(SLO)$/dp_lib_container.obj \ + $(SLO)$/dp_scriptbackenddb.obj .INCLUDE : ..$/..$/target.pmk .INCLUDE : target.mk diff --git a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java index 4c6a4f1eda2b..edf6a2d806b7 100644 --- a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java +++ b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java @@ -50,10 +50,15 @@ public class UnoPkgContainer extends ParcelContainer { private Map registeredPackages = new HashMap(); + protected String extensionDb; + protected String extensionRepository; - public UnoPkgContainer( XComponentContext xCtx, String locationURL, String language ) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException + public UnoPkgContainer( XComponentContext xCtx, String locationURL, + String _extensionDb, String _extensionRepository, String language ) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException { super( xCtx, locationURL, language, false ); + extensionDb = _extensionDb; + extensionRepository = _extensionRepository; init(); } @@ -218,8 +223,8 @@ public class UnoPkgContainer extends ParcelContainer DeployedUnoPackagesDB dp = null; try { - String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") ); - String packagesUrl = PathUtils.make_url( path, "Scripts/unopkg-desc.xml" ); +// String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") ); + String packagesUrl = PathUtils.make_url( extensionDb, "/Scripts/" + extensionRepository + "-extension-desc.xml" ); LogUtils.DEBUG("getUnoPackagesDB() looking for existing db in " + packagesUrl ); if ( m_xSFA.exists( packagesUrl ) ) { @@ -277,8 +282,8 @@ public class UnoPkgContainer extends ParcelContainer OutputStream os = null; try { - String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") ); - String packagesUrl = PathUtils.make_url( path, "Scripts/unopkg-desc.xml" ); +// String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") ); + String packagesUrl = PathUtils.make_url( extensionDb, "/Scripts/" + extensionRepository + "-extension-desc.xml" ); xos = m_xSFA.openFileWrite( packagesUrl ); XTruncate xTrc = (XTruncate) UnoRuntime.queryInterface( XTruncate.class, xos ); if ( xTrc != null ) @@ -375,7 +380,10 @@ public class UnoPkgContainer extends ParcelContainer String parentUrl = uri; if ( uri.indexOf( "%2Funo_packages%2F" ) > -1 || - uri.indexOf( "/uno_packages/" ) > -1 ) + uri.indexOf( "/uno_packages/" ) > -1 || + uri.indexOf("$UNO_USER_PACKAGES_CACHE/") > -1 || + uri.indexOf("$UNO_SHARED_PACKAGES_CACHE/") > -1 || + uri.indexOf("$BUNDLED_EXTENSIONS/") > -1 ) { //its in a bundle need to determine the uno-package file its in LogUtils.DEBUG("processUnoPackage - is part of a uno bundle"); diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java index c43756072ba3..e83410f3f35c 100755 --- a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java +++ b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java @@ -213,26 +213,40 @@ public abstract class ScriptProvider } else { + String extensionDb = null; + String extensionRepository = null; + if ( originalContextURL.startsWith( "bundled" ) ) + { + contextUrl = "vnd.sun.star.expand:$BUNDLED_EXTENSIONS"; + extensionDb = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user"; + extensionRepository = "bundled"; + } + if ( originalContextURL.startsWith( "share" ) ) { contextUrl = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::BaseInstallation}/share"; + extensionDb = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user"; + extensionRepository = "shared"; } else if ( originalContextURL.startsWith( "user" ) ) { contextUrl = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user"; + extensionDb = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user"; + extensionRepository = "user"; } if ( originalContextURL.endsWith( "uno_packages") ) { isPkgProvider = true; } - if ( originalContextURL.endsWith( "uno_packages") && !originalContextURL.equals( contextUrl ) ) + if ( originalContextURL.endsWith( "uno_packages") && !originalContextURL.equals( contextUrl ) + && !extensionRepository.equals("bundled")) { contextUrl = PathUtils.make_url( contextUrl, "uno_packages" ); } if ( isPkgProvider ) { - m_container = new UnoPkgContainer( m_xContext, contextUrl, language ); + m_container = new UnoPkgContainer( m_xContext, contextUrl, extensionDb, extensionRepository, language ); } else { diff --git a/scripting/source/provider/ActiveMSPList.cxx b/scripting/source/provider/ActiveMSPList.cxx index f8400ed77950..3c6206d8d051 100644 --- a/scripting/source/provider/ActiveMSPList.cxx +++ b/scripting/source/provider/ActiveMSPList.cxx @@ -59,6 +59,7 @@ ActiveMSPList::ActiveMSPList( const Reference< XComponentContext > & xContext ) { userDirString = ::rtl::OUString::createFromAscii("user"); shareDirString = ::rtl::OUString::createFromAscii("share"); + bundledDirString = ::rtl::OUString::createFromAscii("bundled"); } ActiveMSPList::~ActiveMSPList() @@ -307,6 +308,12 @@ ActiveMSPList::createNonDocMSPs() Reference< provider::XScriptProvider > shareMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY ); // should check if provider reference is valid m_hMsps[ shareDirString ] = shareMsp; + + args[ 0 ] <<= bundledDirString; + Reference< provider::XScriptProvider > bundledMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY ); + // should check if provider reference is valid + m_hMsps[ bundledDirString ] = bundledMsp; + created = true; } diff --git a/scripting/source/provider/ActiveMSPList.hxx b/scripting/source/provider/ActiveMSPList.hxx index 5adf2fc5a961..b127f3c41b16 100644 --- a/scripting/source/provider/ActiveMSPList.hxx +++ b/scripting/source/provider/ActiveMSPList.hxx @@ -107,6 +107,7 @@ private: osl::Mutex m_mutex; ::rtl::OUString userDirString; ::rtl::OUString shareDirString; + ::rtl::OUString bundledDirString; css::uno::Reference< css::uno::XComponentContext > m_xContext; }; } // func_provider diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 5c164e08c100..f1113c1e114f 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -1511,6 +1511,7 @@ void ExtensionIteratorBase::init() m_bUserPackagesLoaded = false; m_bSharedPackagesLoaded = false; + m_bBundledPackagesLoaded = false; m_iUserPackage = 0; m_iSharedPackage = 0; m_iBundledPackage = 0; @@ -1624,7 +1625,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa if( m_iSharedPackage == m_aSharedPackagesSeq.getLength() ) { - m_eState = END_REACHED; + m_eState = BUNDLED_EXTENSIONS; } else { diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 478562fca7b7..73c413394763 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -986,8 +986,10 @@ void ExtensionIteratorBase::init() m_bUserPackagesLoaded = false; m_bSharedPackagesLoaded = false; + m_bBundledPackagesLoaded = false; m_iUserPackage = 0; m_iSharedPackage = 0; + m_iBundledPackage = 0; } Reference< deployment::XPackage > ExtensionIteratorBase::implGetHelpPackageFromPackage @@ -1089,7 +1091,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa if( m_iSharedPackage == m_aSharedPackagesSeq.getLength() ) { - m_eState = END_REACHED; + m_eState = BUNDLED_EXTENSIONS; } else { @@ -1102,6 +1104,36 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa return xHelpPackage; } +Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextBundledHelpPackage + ( Reference< deployment::XPackage >& o_xParentPackageBundle ) +{ + Reference< deployment::XPackage > xHelpPackage; + + if( !m_bBundledPackagesLoaded ) + { + Reference< XPackageManager > xBundledManager = + thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("bundled") ); + m_aBundledPackagesSeq = xBundledManager->getDeployedPackages + ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + + m_bBundledPackagesLoaded = true; + } + + if( m_iBundledPackage == m_aBundledPackagesSeq.getLength() ) + { + m_eState = END_REACHED; + } + else + { + const Reference< deployment::XPackage >* pBundledPackages = m_aBundledPackagesSeq.getConstArray(); + Reference< deployment::XPackage > xPackage = pBundledPackages[ m_iBundledPackage++ ]; + VOS_ENSURE( xPackage.is(), "ExtensionIteratorBase::implGetNextBundledHelpPackage(): Invalid package" ); + xHelpPackage = implGetHelpPackageFromPackage( xPackage, o_xParentPackageBundle ); + } + + return xHelpPackage; +} + inline bool isLetter( sal_Unicode c ) { bool bLetter = ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); @@ -1173,7 +1205,18 @@ rtl::OUString TreeFileIterator::nextTreeFile( sal_Int32& rnFileSize ) aRetFile = implGetTreeFileFromPackage( rnFileSize, xHelpPackage ); break; } - case END_REACHED: + case BUNDLED_EXTENSIONS: + { + Reference< deployment::XPackage > xParentPackageBundle; + Reference< deployment::XPackage > xHelpPackage = implGetNextBundledHelpPackage( xParentPackageBundle ); + if( !xHelpPackage.is() ) + break; + + aRetFile = implGetTreeFileFromPackage( rnFileSize, xHelpPackage ); + break; + } + + case END_REACHED: VOS_ENSURE( false, "DataBaseIterator::nextTreeFile(): Invalid case END_REACHED" ); break; } diff --git a/xmlhelp/source/treeview/tvread.hxx b/xmlhelp/source/treeview/tvread.hxx index 907568815568..7cc3887448be 100644 --- a/xmlhelp/source/treeview/tvread.hxx +++ b/xmlhelp/source/treeview/tvread.hxx @@ -328,6 +328,7 @@ namespace treeview { { USER_EXTENSIONS, SHARED_EXTENSIONS, + BUNDLED_EXTENSIONS, END_REACHED }; @@ -347,6 +348,9 @@ namespace treeview { ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle ); com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextSharedHelpPackage ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle ); + com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextBundledHelpPackage + ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle ); + void implGetLanguageVectorFromPackage( ::std::vector< ::rtl::OUString > &rv, com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage ); @@ -365,8 +369,13 @@ namespace treeview { < com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq; bool m_bSharedPackagesLoaded; + com::sun::star::uno::Sequence< com::sun::star::uno::Reference + < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq; + bool m_bBundledPackagesLoaded; + int m_iUserPackage; int m_iSharedPackage; + int m_iBundledPackage; }; // end class ExtensionIteratorBase -- cgit From 6241367966bca60d2ee49a693d23c59acfac3349 Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Mon, 3 May 2010 14:22:23 +0200 Subject: jl152 import 263453 from native0jl:#i77196# Use ExtensionManager instead of PackageManager --- desktop/source/app/check_ext_deps.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index c3eb81dfc3ec..7629a5c5cf83 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -47,8 +47,6 @@ #include #include #include "com/sun/star/deployment/XPackage.hpp" -#include "com/sun/star/deployment/XPackageManager.hpp" -#include "com/sun/star/deployment/thePackageManagerFactory.hpp" #include "com/sun/star/deployment/ExtensionManager.hpp" #include #include -- cgit -- cgit From a9dbaec3087911f20e5781d98586bd1ec9b0937b Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 6 May 2010 17:19:12 +0200 Subject: jl152 i111434 ucb failes when copying folders, which contain files containing percent signs --- ucb/source/ucp/file/shell.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx index 769e58c08819..f324c93b878f 100644 --- a/ucb/source/ucp/file/shell.cxx +++ b/ucb/source/ucp/file/shell.cxx @@ -33,6 +33,7 @@ #endif #include "osl/diagnose.h" +#include #include #include #include @@ -2054,9 +2055,14 @@ shell::copy_recursive( const rtl::OUString& srcUnqPath, rtl::OUString newDstUnqPath = dstUnqPath; rtl::OUString tit; if( aFileStatus.isValid( FileStatusMask_FileName ) ) - tit = aFileStatus.getFileName(); + tit = rtl::Uri::encode( aFileStatus.getFileName(), + rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ); + if( newDstUnqPath.lastIndexOf( sal_Unicode('/') ) != newDstUnqPath.getLength()-1 ) newDstUnqPath += rtl::OUString::createFromAscii( "/" ); + newDstUnqPath += tit; if ( newSrcUnqPath != dstUnqPath ) -- cgit From e8f78faa415a94dda55b8cd3249d3586d36dc119 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 7 May 2010 10:40:12 +0200 Subject: cws tl78: fixing windows specific build problems after merging with DEV300_m77 --- desktop/source/migration/migration.cxx | 1 + sfx2/inc/brokenpackageint.hxx | 18 +++++++++++++-- sfx2/source/appl/appuno.cxx | 40 ++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) mode change 100644 => 100755 desktop/source/migration/migration.cxx mode change 100644 => 100755 sfx2/inc/brokenpackageint.hxx mode change 100644 => 100755 sfx2/source/appl/appuno.cxx diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx old mode 100644 new mode 100755 index 2181daab7454..b9be788ebd4b --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -232,6 +232,7 @@ static void insertSorted(migrations_available& rAvailableMigrations, supported_m { rAvailableMigrations.insert(pIter, aSupportedMigration ); bInserted = true; + break; } ++pIter; } diff --git a/sfx2/inc/brokenpackageint.hxx b/sfx2/inc/brokenpackageint.hxx old mode 100644 new mode 100755 index e39c92c599ae..16f332480cf6 --- a/sfx2/inc/brokenpackageint.hxx +++ b/sfx2/inc/brokenpackageint.hxx @@ -36,7 +36,9 @@ using namespace ::framework; typedef ContinuationBase< ::com::sun::star::task::XInteractionApprove > SfxContinuationApprove; typedef ContinuationBase< ::com::sun::star::task::XInteractionDisapprove > SfxContinuationDisapprove; -class SFX2_DLLPUBLIC RequestPackageReparation : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > +class SFX2_DLLPUBLIC RequestPackageReparation : + public ::com::sun::star::task::XInteractionRequest, + public ::cppu::OWeakObject { ::com::sun::star::uno::Any m_aRequest; @@ -50,6 +52,11 @@ class SFX2_DLLPUBLIC RequestPackageReparation : public ::cppu::WeakImplHelper1< public: RequestPackageReparation( ::rtl::OUString aName ); + // XInterface / OWeakObject + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire( ) throw (); + virtual void SAL_CALL release( ) throw (); + sal_Bool isApproved() { return m_pApprove->isSelected(); } virtual ::com::sun::star::uno::Any SAL_CALL getRequest() @@ -61,7 +68,9 @@ public: throw( ::com::sun::star::uno::RuntimeException ); }; -class SFX2_DLLPUBLIC NotifyBrokenPackage : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > +class SFX2_DLLPUBLIC NotifyBrokenPackage : + public ::com::sun::star::task::XInteractionRequest, + public ::cppu::OWeakObject { ::com::sun::star::uno::Any m_aRequest; @@ -74,6 +83,11 @@ class SFX2_DLLPUBLIC NotifyBrokenPackage : public ::cppu::WeakImplHelper1< ::com public: NotifyBrokenPackage( ::rtl::OUString aName ); + // XInterface / OWeakObject + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire( ) throw (); + virtual void SAL_CALL release( ) throw (); + sal_Bool isAborted() { return m_pAbort->isSelected(); } virtual ::com::sun::star::uno::Any SAL_CALL getRequest() diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx old mode 100644 new mode 100755 index fd33e21ea645..66452f10bbfb --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -2411,6 +2411,26 @@ RequestPackageReparation::RequestPackageReparation( ::rtl::OUString aName ) m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pDisapprove ); } +/*uno::*/Any SAL_CALL RequestPackageReparation::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException) +{ + return ::cppu::queryInterface ( rType, + // OWeakObject interfaces + dynamic_cast< XInterface* > ( (XInteractionRequest *) this ), + static_cast< XWeak* > ( this ), + // my own interfaces + static_cast< XInteractionRequest* > ( this ) ); +} + +void SAL_CALL RequestPackageReparation::acquire( ) throw () +{ + OWeakObject::acquire(); +} + +void SAL_CALL RequestPackageReparation::release( ) throw () +{ + OWeakObject::release(); +} + ::com::sun::star::uno::Any SAL_CALL RequestPackageReparation::getRequest() throw( ::com::sun::star::uno::RuntimeException ) { @@ -2442,6 +2462,26 @@ NotifyBrokenPackage::NotifyBrokenPackage( ::rtl::OUString aName ) m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); } +/*uno::*/Any SAL_CALL NotifyBrokenPackage::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException) +{ + return ::cppu::queryInterface ( rType, + // OWeakObject interfaces + dynamic_cast< XInterface* > ( (XInteractionRequest *) this ), + static_cast< XWeak* > ( this ), + // my own interfaces + static_cast< XInteractionRequest* > ( this ) ); +} + +void SAL_CALL NotifyBrokenPackage::acquire( ) throw () +{ + OWeakObject::acquire(); +} + +void SAL_CALL NotifyBrokenPackage::release( ) throw () +{ + OWeakObject::release(); +} + ::com::sun::star::uno::Any SAL_CALL NotifyBrokenPackage::getRequest() throw( ::com::sun::star::uno::RuntimeException ) { -- cgit From c6f3782d96f7a93889d742520496e9d27775048e Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Mon, 10 May 2010 11:06:01 +0200 Subject: jl152: Fixed compiling errors for gcc --- desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 2 +- desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 2 +- .../source/deployment/manager/dp_commandenvironments.hxx | 14 ++++++-------- .../source/deployment/manager/dp_extensionmanager.cxx | 1 + .../source/deployment/manager/dp_extensionmanager.hxx | 5 +++-- desktop/source/deployment/manager/dp_manager.cxx | 6 ++++-- desktop/source/deployment/registry/dp_backend.cxx | 10 +++++----- .../source/deployment/registry/package/dp_package.cxx | 16 ++++++++++------ desktop/source/deployment/registry/script/dp_script.cxx | 2 +- 9 files changed, 32 insertions(+), 26 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 18911ce63ea2..5fd713239e68 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -60,8 +60,8 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, m_bActive( false ), m_bLocked( bReadOnly ), m_bHasOptions( false ), - m_bShared( false ), m_bUser( false ), + m_bShared( false ), m_bNew( false ), m_bChecked( false ), m_bMissingDeps( false ), diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 65a1bf021d29..20f47139599a 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -503,7 +503,7 @@ void TheExtensionManager::notifyTermination( ::lang::EventObject const & rEvt ) //------------------------------------------------------------------------------ // XModifyListener -void TheExtensionManager::modified( ::lang::EventObject const & rEvt ) +void TheExtensionManager::modified( ::lang::EventObject const & /*rEvt*/ ) throw ( uno::RuntimeException ) { getDialogHelper()->prepareChecking(); diff --git a/desktop/source/deployment/manager/dp_commandenvironments.hxx b/desktop/source/deployment/manager/dp_commandenvironments.hxx index 0bdad4fd09cc..aa21f8281c72 100644 --- a/desktop/source/deployment/manager/dp_commandenvironments.hxx +++ b/desktop/source/deployment/manager/dp_commandenvironments.hxx @@ -84,9 +84,8 @@ public: class TmpRepositoryCommandEnv : public BaseCommandEnv { public: - TmpRepositoryCommandEnv::TmpRepositoryCommandEnv(); - TmpRepositoryCommandEnv::TmpRepositoryCommandEnv( - css::uno::Reference< css::task::XInteractionHandler> const & handler); + TmpRepositoryCommandEnv(); + TmpRepositoryCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler); // XInteractionHandler virtual void SAL_CALL handle( @@ -105,8 +104,8 @@ private: ::rtl::OUString m_repository; bool m_bSuppressLicense; public: - LicenseCommandEnv::LicenseCommandEnv(){}; - LicenseCommandEnv::LicenseCommandEnv( + LicenseCommandEnv(){}; + LicenseCommandEnv( css::uno::Reference< css::task::XInteractionHandler> const & handler, bool bSuppressLicense, ::rtl::OUString const & repository); @@ -126,9 +125,8 @@ class NoLicenseCommandEnv : public BaseCommandEnv { public: - NoLicenseCommandEnv::NoLicenseCommandEnv(){}; - NoLicenseCommandEnv::NoLicenseCommandEnv( - css::uno::Reference< css::task::XInteractionHandler> const & handler); + NoLicenseCommandEnv(){}; + NoLicenseCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler); // XInteractionHandler virtual void SAL_CALL handle( diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 44f34991889e..844417d5ec85 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -1225,6 +1225,7 @@ ExtensionManager::getExtensionsWithUnacceptedLicenses( } sal_Bool ExtensionManager::isReadOnlyRepository(::rtl::OUString const & repository) + throw (uno::RuntimeException) { return getPackageManager(repository)->isReadOnly(); } diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index 158fd35e2fa0..e6c9ca3aa915 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -202,7 +202,8 @@ public: throw (css::deployment::DeploymentException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL isReadOnlyRepository(::rtl::OUString const & repository); + virtual sal_Bool SAL_CALL isReadOnlyRepository(::rtl::OUString const & repository) + throw (css::uno::RuntimeException); private: @@ -233,7 +234,7 @@ private: bool isUserDisabled(::rtl::OUString const & identifier, ::rtl::OUString const & filename); - bool ExtensionManager::isUserDisabled( + bool isUserDisabled( css::uno::Sequence > const & seqExtSameId); void activateExtension( diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 83105406f253..69b2baab8878 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -1471,6 +1471,8 @@ Sequence< Reference > PackageManagerImpl::getExtensionsWit Reference const & xCmdEnv) throw (deployment::DeploymentException, RuntimeException) { + ::std::vector > vec; + try { const ::osl::MutexGuard guard( getMutex() ); @@ -1479,8 +1481,6 @@ Sequence< Reference > PackageManagerImpl::getExtensionsWit ActivePackages::Entries::const_iterator i = id2temp.begin(); bool bShared = m_context.equals(OUSTR("shared")); - ::std::vector > vec; - for (; i != id2temp.end(); i++ ) { @@ -1523,6 +1523,8 @@ Sequence< Reference > PackageManagerImpl::getExtensionsWit exc <<= de; ::cppu::throwException(exc); } + + return ::comphelper::containerToSequence(vec); } sal_Int32 PackageManagerImpl::checkPrerequisites( diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index e822a66aa85f..9a83ca63d36e 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -274,12 +274,12 @@ void PackageRegistryBackend::deleteUnusedFolders( //usedFolders contains the urls to the folders which have //a trailing underscore const OUString tempFile = tempEntries[ pos ]; - const OUString tempFolder = tempFile + OUSTR("_"); + const OUString tempFolderName = tempFile + OUSTR("_"); - if (::std::find( usedFolders.begin(), usedFolders.end(), tempFolder ) == + if (::std::find( usedFolders.begin(), usedFolders.end(), tempFolderName ) == usedFolders.end()) { - erase_path( tempFolder, Reference(), + erase_path( tempFolderName, Reference(), false /* no throw: ignore errors */ ); erase_path( tempFile, Reference(), false /* no throw: ignore errors */ ); @@ -306,7 +306,7 @@ Package::~Package() //______________________________________________________________________________ Package::Package( ::rtl::Reference const & myBackend, OUString const & url, - OUString const & name, + OUString const & rName, OUString const & displayName, Reference const & xPackageType, bool bRemoved, @@ -314,7 +314,7 @@ Package::Package( ::rtl::Reference const & myBackend, : t_PackageBase( getMutex() ), m_myBackend( myBackend ), m_url( url ), - m_name( name ), + m_name( rName ), m_displayName( displayName ), m_xPackageType( xPackageType ), m_bRemoved(bRemoved), diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 3d4842f62bfd..a2c68dd2341f 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -228,7 +228,8 @@ class BackendImpl : public ImplBaseT virtual beans::StringPair SAL_CALL getPublisherInfo() throw (deployment::ExtensionRemovedException, RuntimeException); - virtual OUString SAL_CALL getDisplayName() throw (RuntimeException); + virtual OUString SAL_CALL getDisplayName() + throw (deployment::ExtensionRemovedException, RuntimeException); virtual Reference< graphic::XGraphic > SAL_CALL getIcon( ::sal_Bool bHighContrast ) @@ -754,9 +755,10 @@ bool BackendImpl::PackageImpl::checkDependencies( ::sal_Bool BackendImpl::PackageImpl::checkDependencies( const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv ) - throw (css::deployment::DeploymentException, - css::ucb::CommandFailedException, - css::uno::RuntimeException) + throw (deployment::DeploymentException, + deployment::ExtensionRemovedException, + ucb::CommandFailedException, + RuntimeException) { if (m_bRemoved) throw deployment::ExtensionRemovedException(); @@ -781,7 +783,8 @@ beans::Optional BackendImpl::PackageImpl::getIdentifier() true, identifier); } -OUString BackendImpl::PackageImpl::getVersion() throw (RuntimeException) +OUString BackendImpl::PackageImpl::getVersion() + throw (deployment::ExtensionRemovedException, RuntimeException) { if (m_bRemoved) throw deployment::ExtensionRemovedException(); @@ -982,7 +985,8 @@ void BackendImpl::PackageImpl::processPackage_( } //______________________________________________________________________________ -OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException) +OUString BackendImpl::PackageImpl::getDescription() + throw (deployment::ExtensionRemovedException, RuntimeException) { if (m_bRemoved) throw deployment::ExtensionRemovedException(); diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index f0c4c9b42c6e..414d4c1c61cd 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -321,7 +321,7 @@ BackendImpl::PackageImpl::isRegistered_( BackendImpl * that = getMyBackend(); Reference< deployment::XPackage > xThisPackage( this ); - bool registered = getMyBackend()->isRegisteredInDb(getURL()); + bool registered = that->isRegisteredInDb(getURL()); return beans::Optional< beans::Ambiguous >( true /* IsPresent */, beans::Ambiguous( registered, false /* IsAmbiguous */ ) ); -- cgit From 051f7b163fa4bf1917fb3db98fed2a6a932a827e Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Mon, 10 May 2010 12:00:49 +0200 Subject: jl152#i77196# Use ExtensionManager instead of PackageManager --- .../source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 10 ++++++---- desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 17 +++++++++++++++-- desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 5 +---- desktop/source/deployment/gui/dp_gui_theextmgr.hxx | 2 -- .../source/deployment/manager/dp_extensionmanager.cxx | 2 ++ 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 4c9357e03e9f..8d82d969c4a0 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -1028,13 +1028,14 @@ void ExtensionCmdQueue::Thread::_enableExtension( ::rtl::Reference< ProgressCmdE if ( !xPackage.is() ) return; - uno::Reference< task::XAbortChannel > xAbortChannel( xPackage->createAbortChannel() ); + uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); + uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() ); OUString sTitle = searchAndReplaceAll( m_sEnablingPackages, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName() ); rCmdEnv->progressSection( sTitle, xAbortChannel ); try { - xPackage->registerPackage(false, xAbortChannel, rCmdEnv.get() ); + xExtMgr->enableExtension( xPackage, xAbortChannel, rCmdEnv.get() ); if ( m_pDialogHelper ) m_pDialogHelper->updatePackageInfo( xPackage ); } @@ -1049,13 +1050,14 @@ void ExtensionCmdQueue::Thread::_disableExtension( ::rtl::Reference< ProgressCmd if ( !xPackage.is() ) return; - uno::Reference< task::XAbortChannel > xAbortChannel( xPackage->createAbortChannel() ); + uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); + uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() ); OUString sTitle = searchAndReplaceAll( m_sDisablingPackages, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName() ); rCmdEnv->progressSection( sTitle, xAbortChannel ); try { - xPackage->revokePackage( xAbortChannel, rCmdEnv.get() ); + xExtMgr->disableExtension( xPackage, xAbortChannel, rCmdEnv.get() ); if ( m_pDialogHelper ) m_pDialogHelper->updatePackageInfo( xPackage ); } diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 5fd713239e68..c73d8dfba136 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -1123,17 +1123,30 @@ void ExtensionBox_Impl::checkEntries() { if ( (*iIndex)->m_bChecked == false ) { + (*iIndex)->m_bChecked = true; bNeedsUpdate = true; nPos = iIndex-m_vEntries.begin(); if ( (*iIndex)->m_bNew ) - { + { // add entry to list and correct active pos if ( nNewPos == - 1) nNewPos = nPos; if ( nPos <= m_nActive ) m_nActive += 1; + iIndex++; + } + else + { // remove entry from list + if ( nPos < m_nActive ) + m_nActive -= 1; + else if ( ( nPos == m_nActive ) && ( nPos == m_vEntries.size() - 1 ) ) + m_nActive -= 1; + m_vRemovedEntries.push_back( *iIndex ); + m_vEntries.erase( iIndex ); + iIndex = m_vEntries.begin() + nPos; } } - iIndex++; + else + iIndex++; } guard.clear(); diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 20f47139599a..7c81517bbbfa 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -34,6 +34,7 @@ #include "vos/mutex.hxx" #include "toolkit/helper/vclunohelper.hxx" + #include "com/sun/star/beans/XPropertySet.hpp" #include "dp_gui_dialog2.hxx" @@ -48,10 +49,6 @@ #define SHARED_PACKAGE_MANAGER OUSTR("shared") #define BUNDLED_PACKAGE_MANAGER OUSTR("bundled") -#define USER_PACKAGE_MANAGER OUSTR("user") -#define SHARED_PACKAGE_MANAGER OUSTR("shared") -#define BUNDLED_PACKAGE_MANAGER OUSTR("bundled") - using namespace ::com::sun::star; using ::rtl::OUString; diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index 6605b5907dab..02e3aad56915 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -69,8 +69,6 @@ private: ::rtl::OUString m_sGetExtensionsURL; - // liste der packages ( xpackage?, mit parent manager, ... ) - void createPackageList(); public: diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 844417d5ec85..83e68dff255e 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -326,6 +326,8 @@ void ExtensionManager::activateExtension( ::std::list > > (listExtensions), bUserDisabled, bStartup, xAbortChannel, xCmdEnv); + + fireModified(); } void ExtensionManager::activateExtension( -- cgit From cbe7eeb41f84acf01241189b67d17b8a4bb4954b Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Mon, 10 May 2010 12:18:08 +0200 Subject: jl152: Fixed compiling errors for gcc --- desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index c73d8dfba136..dbb5c93cd853 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -1138,7 +1138,7 @@ void ExtensionBox_Impl::checkEntries() { // remove entry from list if ( nPos < m_nActive ) m_nActive -= 1; - else if ( ( nPos == m_nActive ) && ( nPos == m_vEntries.size() - 1 ) ) + else if ( ( nPos == m_nActive ) && ( nPos == (long) m_vEntries.size() - 1 ) ) m_nActive -= 1; m_vRemovedEntries.push_back( *iIndex ); m_vEntries.erase( iIndex ); -- cgit From dc9d30e6e99da3e63f9255a0c5dd046015437665 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Fri, 7 May 2010 17:02:22 +0200 Subject: jl152 #i77196# adapting configuration backend to changes introduced by SB on DEV300 branch concering different handling of configuration files in extensions, also fixed writing of compiled help files into the user installation --- configmgr/source/components.cxx | 8 +- desktop/source/deployment/inc/dp_misc.h | 3 + desktop/source/deployment/misc/dp_misc.cxx | 16 ++ .../deployment/registry/component/dp_component.cxx | 56 +++-- .../registry/configuration/dp_configuration.cxx | 240 +++++++++++++-------- .../configuration/dp_configurationbackenddb.cxx | 186 ++++++++++++++++ .../configuration/dp_configurationbackenddb.hxx | 96 +++++++++ .../deployment/registry/configuration/makefile.mk | 3 +- desktop/source/deployment/registry/dp_backend.cxx | 24 ++- .../source/deployment/registry/dp_backenddb.cxx | 45 ++++ .../source/deployment/registry/help/dp_help.cxx | 16 +- .../deployment/registry/help/dp_helpbackenddb.cxx | 6 +- .../deployment/registry/help/dp_helpbackenddb.hxx | 9 - .../source/deployment/registry/inc/dp_backend.h | 5 + .../deployment/registry/inc/dp_backenddb.hxx | 5 +- 15 files changed, 568 insertions(+), 150 deletions(-) create mode 100644 desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx create mode 100644 desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 48f90fa8382e..7ef1bd3ee3e7 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -368,22 +368,22 @@ Components::Components( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "$BRAND_BASE_DIR/share/registry/modules")))); - parseXcsXcuLayer( //TODO: migrate + parseXcsXcuIniLayer( 7, expand( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno") - ":UNO_SHARED_PACKAGES_CACHE}/registry/" + ":BUNDLED_EXTENSIONS_USER}/registry/" "com.sun.star.comp.deployment.configuration." - "PackageRegistryBackend/registry")))); + "PackageRegistryBackend/configmgr.ini")))); parseXcsXcuIniLayer( 9, expand( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno") - ":UNO_SHARED_PACKAGES_CACHE}/registry/" + ":SHARED_EXTENSIONS_USER}/registry/" "com.sun.star.comp.deployment.configuration." "PackageRegistryBackend/configmgr.ini")))); parseXcsXcuLayer( //TODO: migrate diff --git a/desktop/source/deployment/inc/dp_misc.h b/desktop/source/deployment/inc/dp_misc.h index 3283d20718be..a0ca7f53be03 100644 --- a/desktop/source/deployment/inc/dp_misc.h +++ b/desktop/source/deployment/inc/dp_misc.h @@ -70,6 +70,9 @@ inline void try_dispose( ::com::sun::star::uno::Reference< ::com::sun::star::uno DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString expandUnoRcTerm( ::rtl::OUString const & term ); +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +::rtl::OUString makeRcTerm( ::rtl::OUString const & url ); + //============================================================================== DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString expandUnoRcUrl( ::rtl::OUString const & url ); diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 919f134b3fb9..799542a4757f 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -317,6 +317,22 @@ OUString expandUnoRcTerm( OUString const & term_ ) return term; } +OUString makeRcTerm( OUString const & url ) +{ + OSL_ASSERT( url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( + "vnd.sun.star.expand:") ) ); + if (url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:") )) { + // cut protocol: + OUString rcterm( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) ); + // decode uric class chars: + rcterm = ::rtl::Uri::decode( + rcterm, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + return rcterm; + } + else + return url; +} + //============================================================================== OUString expandUnoRcUrl( OUString const & url ) { diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index edb53d134c8b..fc9880438bac 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -75,7 +75,6 @@ typedef ::std::list t_stringlist; typedef ::std::vector< ::std::pair > t_stringpairvec; #define IMPLEMENTATION_NAME "com.sun.star.comp.deployment.component.PackageRegistryBackend" -inline OUString makeRcTerm( OUString const & url ); /** return a vector of bootstrap variables which have been provided as command arguments. @@ -779,11 +778,16 @@ void BackendImpl::unorc_verify_init( OUString token( line.getToken( 0, ' ', index ).trim() ); if (token.getLength() > 0) { - //The jar file may not exist anymore if a shared or bundled - //extension was removed, but it can still be in the unorc - //After running XExtensionManager::synchronize, the unorc is - //cleaned up - m_jar_typelibs.push_back( token ); + if (create_ucb_content( + 0, expandUnoRcTerm(token), xCmdEnv, + false /* no throw */ )) + { + //The jar file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the unorc + //After running XExtensionManager::synchronize, the unorc is + //cleaned up + m_jar_typelibs.push_back( token ); + } } } while (index >= 0); @@ -797,11 +801,16 @@ void BackendImpl::unorc_verify_init( { if (token[ 0 ] == '?') token = token.copy( 1 ); - //The RDB file may not exist anymore if a shared or bundled - //extension was removed, but it can still be in the unorc. - //After running XExtensionManager::synchronize, the unorc is - //cleaned up - m_rdb_typelibs.push_back( token ); + if (create_ucb_content( + 0, expandUnoRcTerm(token), xCmdEnv, + false /* no throw */ )) + { + //The RDB file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the unorc. + //After running XExtensionManager::synchronize, the unorc is + //cleaned up + m_rdb_typelibs.push_back( token ); + } } } while (index >= 0); @@ -842,7 +851,7 @@ void BackendImpl::unorc_flush( Reference const & xCmdEnv ) ::rtl::OStringBuffer buf; buf.append(RTL_CONSTASCII_STRINGPARAM("ORIGIN=")); - OUString sOrigin = makeRcTerm(m_cachePath); + OUString sOrigin = dp_misc::makeRcTerm(m_cachePath); ::rtl::OString osOrigin = ::rtl::OUStringToOString(sOrigin, RTL_TEXTENCODING_UTF8); buf.append(osOrigin); buf.append(LF); @@ -933,28 +942,11 @@ void BackendImpl::unorc_flush( Reference const & xCmdEnv ) m_unorc_modified = false; } -//------------------------------------------------------------------------------ -inline OUString makeRcTerm( OUString const & url ) -{ - OSL_ASSERT( url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( - "vnd.sun.star.expand:") ) ); - if (url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:") )) { - // cut protocol: - OUString rcterm( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) ); - // decode uric class chars: - rcterm = ::rtl::Uri::decode( - rcterm, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - return rcterm; - } - else - return url; -} - //______________________________________________________________________________ bool BackendImpl::addToUnoRc( bool jarFile, OUString const & url_, Reference const & xCmdEnv ) { - const OUString rcterm( makeRcTerm(url_) ); + const OUString rcterm( dp_misc::makeRcTerm(url_) ); const ::osl::MutexGuard guard( getMutex() ); unorc_verify_init( xCmdEnv ); t_stringlist & rSet = getTypelibs(jarFile); @@ -974,7 +966,7 @@ bool BackendImpl::removeFromUnoRc( bool jarFile, OUString const & url_, Reference const & xCmdEnv ) { - const OUString rcterm( makeRcTerm(url_) ); + const OUString rcterm( dp_misc::makeRcTerm(url_) ); const ::osl::MutexGuard guard( getMutex() ); unorc_verify_init( xCmdEnv ); getTypelibs(jarFile).remove( rcterm ); @@ -988,7 +980,7 @@ bool BackendImpl::removeFromUnoRc( bool BackendImpl::hasInUnoRc( bool jarFile, OUString const & url_ ) { - const OUString rcterm( makeRcTerm(url_) ); + const OUString rcterm( dp_misc::makeRcTerm(url_) ); const ::osl::MutexGuard guard( getMutex() ); t_stringlist const & rSet = getTypelibs(jarFile); return ::std::find( rSet.begin(), rSet.end(), rcterm ) != rSet.end(); diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index a97736235656..1a6738b0270b 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -55,6 +55,7 @@ #include #include +#include "dp_configurationbackenddb.hxx" using namespace ::dp_misc; using namespace ::com::sun::star; @@ -111,6 +112,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend bool m_configmgrini_inited; bool m_configmgrini_modified; + std::auto_ptr m_backendDb; // PackageRegistryBackend virtual Reference bindPackage_( @@ -135,7 +137,11 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference const & xCmdEnv ); bool removeFromConfigmgrIni( bool isSchema, OUString const & url, Reference const & xCmdEnv ); - bool hasInConfigmgrIni( bool isSchema, OUString const & url ); + + void addDataToDb(OUString const & url, ConfigurationBackendDb::Data const & data); + ::boost::optional readDataFromDb(OUString const & url); + void deleteDataFromDb(OUString const & url); + ::std::list getAllIniEntries(); public: BackendImpl( Sequence const & args, @@ -193,18 +199,64 @@ BackendImpl::BackendImpl( const Reference xCmdEnv; - if (transientMode()) { + if (transientMode()) + { //TODO } - else { + else + { + OUString dbFile = makeURL(getCachePath(), OUSTR("backenddb.xml")); + m_backendDb.reset( + new ConfigurationBackendDb(getComponentContext(), dbFile)); + //clean up data folders which are no longer used. + //This must not be done in the same process where the help files + //are still registers. Only after revoking and restarting OOo the folders + //can be removed. This works now, because the extension manager is a singleton + //and the backends are only create once per process. + ::std::list folders = m_backendDb->getAllDataUrls(); + deleteUnusedFolders(OUString(), folders); + + configmgrini_verify_init( xCmdEnv ); m_registeredPackages.reset( new PersistentMap( makeURL( getCachePath(), OUSTR("registered_packages.db") ), false ) ); - } + } +} + +void BackendImpl::addDataToDb( + OUString const & url, ConfigurationBackendDb::Data const & data) +{ + if (m_backendDb.get()) + m_backendDb->addEntry(url, data); +} + +::boost::optional BackendImpl::readDataFromDb( + OUString const & url) +{ + ::boost::optional data; + if (m_backendDb.get()) + data = m_backendDb->getEntry(url); + return data; } +void BackendImpl::deleteDataFromDb(OUString const & url) +{ + if (m_backendDb.get()) + m_backendDb->removeEntry(url); +} + +::std::list BackendImpl::getAllIniEntries() +{ + if (m_backendDb.get()) + return m_backendDb->getAllIniEntries(); + else + return ::std::list(); +} + + + // XPackageRegistry //______________________________________________________________________________ Sequence< Reference > @@ -312,11 +364,12 @@ void BackendImpl::configmgrini_verify_init( if (create_ucb_content( 0, expandUnoRcTerm(token), xCmdEnv, false /* no throw */ )) { + //The file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the configmgrini. + //After running XExtensionManager::synchronize, the configmgrini is + //cleaned up m_xcs_files.push_back( token ); } - else - OSL_ENSURE( - 0, "### invalid SCHEMA entry!" ); } } while (index >= 0); @@ -333,10 +386,24 @@ void BackendImpl::configmgrini_verify_init( if (create_ucb_content( 0, expandUnoRcTerm(token), xCmdEnv, false /* no throw */ )) { + //The file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the configmgrini. + //After running XExtensionManager::synchronize, the configmgrini is + //cleaned up m_xcu_files.push_back( token ); } else - OSL_ENSURE( 0, "### invalid DATA entry!" ); + { + //Check if it was removed. Only when the file contained %origin, so that + //a new file was writen in the user installation (e.g. $BUNDLED_EXTENSIONS_USER) + //See also ConfigurationBackendDb.iniEntry + ::std::list iniEntries = getAllIniEntries(); + if (::std::find(iniEntries.begin(), iniEntries.end(), token) + != iniEntries.end()) + m_xcu_files.push_back( token ); + else + OSL_ENSURE(0, "Extension manager: Invalid configmgr.ini entry."); + } } } while (index >= 0); @@ -357,20 +424,6 @@ void BackendImpl::configmgrini_flush( return; ::rtl::OStringBuffer buf; - // UNO_USER_PACKAGES_CACHE, UNO_SHARED_PACKAGES_CACHE have to be resolved - // locally: - if (m_eContext == CONTEXT_USER) { - buf.append( RTL_CONSTASCII_STRINGPARAM( - "UNO_USER_PACKAGES_CACHE=$ORIGIN/../..") ); - } - else if (m_eContext == CONTEXT_SHARED) { - buf.append( RTL_CONSTASCII_STRINGPARAM( - "UNO_SHARED_PACKAGES_CACHE=$ORIGIN/../..") ); - } - else - OSL_ASSERT(0); - buf.append(LF); - if (! m_xcs_files.empty()) { t_stringlist::const_iterator iPos( m_xcs_files.begin() ); @@ -417,28 +470,11 @@ void BackendImpl::configmgrini_flush( m_configmgrini_modified = false; } -//------------------------------------------------------------------------------ -inline OUString makeRcTerm( OUString const & url ) -{ - OSL_ASSERT( url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( - "vnd.sun.star.expand:") ) ); - if (url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:") )) { - // cut protocol: - OUString rcterm( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) ); - // decode uric class chars: - rcterm = ::rtl::Uri::decode( - rcterm, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - return rcterm; - } - else - return url; -} - //______________________________________________________________________________ bool BackendImpl::addToConfigmgrIni( bool isSchema, OUString const & url_, Reference const & xCmdEnv ) { - const OUString rcterm( makeRcTerm(url_) ); + const OUString rcterm( dp_misc::makeRcTerm(url_) ); const ::osl::MutexGuard guard( getMutex() ); configmgrini_verify_init( xCmdEnv ); t_stringlist & rSet = getFiles(isSchema); @@ -458,15 +494,18 @@ bool BackendImpl::removeFromConfigmgrIni( bool isSchema, OUString const & url_, Reference const & xCmdEnv ) { - const OUString rcterm( makeRcTerm(url_) ); + const OUString rcterm( dp_misc::makeRcTerm(url_) ); const ::osl::MutexGuard guard( getMutex() ); configmgrini_verify_init( xCmdEnv ); t_stringlist & rSet = getFiles(isSchema); t_stringlist::iterator i(std::find(rSet.begin(), rSet.end(), rcterm)); - if (i == rSet.end() && !isSchema) { //TODO: see replaceOrigin() - i = std::find( - rSet.begin(), rSet.end(), - rcterm + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod"))); + if (i == rSet.end() && !isSchema) + { + //in case the xcu contained %origin% then the configmr.ini contains the + //url to the file in the user installation (e.g. $BUNDLED_EXTENSIONS_USER) + ::boost::optional data = readDataFromDb(url_); + if (data) + i = std::find(rSet.begin(), rSet.end(), data->iniEntry); } if (i == rSet.end()) { return false; @@ -478,21 +517,6 @@ bool BackendImpl::removeFromConfigmgrIni( return true; } -//______________________________________________________________________________ -bool BackendImpl::hasInConfigmgrIni( - bool isSchema, OUString const & url_ ) -{ - const OUString rcterm( makeRcTerm(url_) ); - const ::osl::MutexGuard guard( getMutex() ); - t_stringlist const & rSet = getFiles(isSchema); - return ::std::find( rSet.begin(), rSet.end(), rcterm ) != rSet.end() - || (!isSchema && //TODO: see replaceOrigin() - ::std::find( - rSet.begin(), rSet.end(), - rcterm + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod"))) != - rSet.end()); -} - //############################################################################## // Package @@ -519,14 +543,18 @@ BackendImpl::PackageImpl::isRegistered_( Reference const & ) { BackendImpl * that = getMyBackend(); - rtl::OUString url(getURL()); + const rtl::OUString url(getURL()); + + bool bReg = false; + if (that->readDataFromDb(getURL())) + bReg = true; + if (!bReg) + //fallback for user extension registered in berkeley DB + bReg = that->m_registeredPackages->has( + rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 )); + return beans::Optional< beans::Ambiguous >( - true /* IsPresent */, - beans::Ambiguous( - that->hasInConfigmgrIni( m_isSchema, url ) || - that->m_registeredPackages->has( - rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 ) ), - false /* IsAmbiguous */ ) ); + true, beans::Ambiguous( bReg, false ) ); } //------------------------------------------------------------------------------ @@ -564,7 +592,7 @@ OUString encodeForXml( OUString const & text ) //______________________________________________________________________________ OUString replaceOrigin( - OUString const & url, Reference< XCommandEnvironment > const & xCmdEnv ) + OUString const & url, OUString const & destFolder, Reference< XCommandEnvironment > const & xCmdEnv, bool & out_replaced) { // looking for %origin%: ::ucbhelper::Content ucb_content( url, xCmdEnv ); @@ -634,10 +662,17 @@ OUString replaceOrigin( return url; if (write_pos < filtered.getLength()) filtered.realloc( write_pos ); - rtl::OUString newUrl(url + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod"))); - //TODO: unique name + rtl::OUString newUrl(url); + if (destFolder.getLength()) + { + //get the file name of the xcu and add it to the url of the temporary folder + sal_Int32 i = url.lastIndexOf('/'); + newUrl = destFolder + url.copy(i); + } + ucbhelper::Content(newUrl, xCmdEnv).writeStream( xmlscript::createInputStream(filtered), true); + out_replaced = true; return newUrl; } @@ -654,21 +689,37 @@ void BackendImpl::PackageImpl::processPackage_( if (doRegisterPackage) { - if (m_isSchema) + ConfigurationBackendDb::Data data; + if (!m_isSchema) { - com::sun::star::configuration::Update::get( - that->m_xComponentContext)->insertExtensionXcsFile( - that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url)); + const OUString sModFolder = that->createFolder(OUString(), xCmdEnv); + bool out_replaced = false; + url = replaceOrigin(url, sModFolder, xCmdEnv, out_replaced); + if (out_replaced) + data.dataUrl = sModFolder; + else + deleteTempFolder(sModFolder); } - else + //No need for live-deployment for bundled extension, because OOo + //restarts after installation + if (that->m_eContext != CONTEXT_BUNDLED) { - url = replaceOrigin(url, xCmdEnv); - com::sun::star::configuration::Update::get( - that->m_xComponentContext)->insertExtensionXcuFile( - that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url)); + if (m_isSchema) + { + com::sun::star::configuration::Update::get( + that->m_xComponentContext)->insertExtensionXcsFile( + that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url)); + } + else + { + com::sun::star::configuration::Update::get( + that->m_xComponentContext)->insertExtensionXcuFile( + that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url)); + } } - that->addToConfigmgrIni( m_isSchema, url, xCmdEnv ); + data.iniEntry = dp_misc::makeRcTerm(url); + that->addDataToDb(getURL(), data); } else // revoke { @@ -678,15 +729,31 @@ void BackendImpl::PackageImpl::processPackage_( for (t_string2string_map::iterator i(entries.begin()); i != entries.end(); ++i) { + //If the xcu file was installed before the configmgr was chaned + //to use the configmgr.ini, one needed to rebuild to whole directory + //structur containing the xcu, xcs files from all extensions. Now, + //we just add all other xcu/xcs files to the configmgr.ini instead of + //rebuilding the directory structure. rtl::OUString url2( rtl::OStringToOUString(i->first, RTL_TEXTENCODING_UTF8)); + ConfigurationBackendDb::Data data; if (url2 != url) { - bool schema = i->second.equalsIgnoreAsciiCase( - "vnd.sun.star.configuration-schema"); - if (!schema) { - url2 = replaceOrigin(url2, xCmdEnv); - } - that->addToConfigmgrIni(schema, url2, xCmdEnv); + bool schema = i->second.equalsIgnoreAsciiCase( + "vnd.sun.star.configuration-schema"); + OUString url_replaced(url2); + if (!schema) + { + const OUString sModFolder = that->createFolder(OUString(), xCmdEnv); + bool out_replaced = false; + url_replaced = replaceOrigin( + url2, sModFolder, xCmdEnv, out_replaced); + if (out_replaced) + data.dataUrl = sModFolder; + else + deleteTempFolder(sModFolder); + } + that->addToConfigmgrIni(schema, url_replaced, xCmdEnv); + that->addDataToDb(url2, data); } that->m_registeredPackages->erase(i->first); } @@ -695,6 +762,7 @@ void BackendImpl::PackageImpl::processPackage_( xCmdEnv ).executeCommand( OUSTR("delete"), Any( true /* delete physically */ ) ); } + that->deleteDataFromDb(getURL()); //TODO: revoking at runtime, possible, sensible? } diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx new file mode 100644 index 000000000000..845ba88cb813 --- /dev/null +++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx @@ -0,0 +1,186 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dp_package.cxx,v $ + * $Revision: 1.34.16.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "rtl/string.h" +#include "rtl/bootstrap.hxx" +#include "cppuhelper/exc_hlp.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/xml/dom/XDocumentBuilder.hpp" +#include "com/sun/star/xml/xpath/XXPathAPI.hpp" +#include "dp_misc.h" + +#include "dp_configurationbackenddb.hxx" + + +namespace css = ::com::sun::star; +using namespace ::com::sun::star::uno; +using ::rtl::OUString; + +#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/configuration-registry/2010" +#define NS_PREFIX "conf" +#define ROOT_ELEMENT_NAME "configuration-backend-db" +#define KEY_ELEMENT_NAME "configuration" + +namespace dp_registry { +namespace backend { +namespace configuration { + +ConfigurationBackendDb::ConfigurationBackendDb( + Reference const & xContext, + ::rtl::OUString const & url):BackendDb(xContext, url) +{ + +} + +OUString ConfigurationBackendDb::getDbNSName() +{ + return OUSTR(EXTENSION_REG_NS); +} + +OUString ConfigurationBackendDb::getNSPrefix() +{ + return OUSTR(NS_PREFIX); +} + +OUString ConfigurationBackendDb::getRootElementName() +{ + return OUSTR(ROOT_ELEMENT_NAME); +} + +OUString ConfigurationBackendDb::getKeyElementName() +{ + return OUSTR(KEY_ELEMENT_NAME); +} + + +void ConfigurationBackendDb::addEntry(::rtl::OUString const & url, Data const & data) +{ + try{ + Reference helpNode + = writeKeyElement(url); + + writeSimpleElement(OUSTR("data-url"), data.dataUrl, helpNode); + writeSimpleElement(OUSTR("ini-entry"), data.iniEntry, helpNode); + save(); + } + catch (css::deployment::DeploymentException& ) + { + throw; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to write data entry in configuration backend db: ") + + m_urlDb, 0, exc); + } +} + + +::boost::optional +ConfigurationBackendDb::getEntry(::rtl::OUString const & url) +{ + try + { + ConfigurationBackendDb::Data retData; + Reference aNode = getKeyElement(url); + if (aNode.is()) + { + retData.dataUrl = readSimpleElement(OUSTR("data-url"), aNode); + retData.iniEntry = readSimpleElement(OUSTR("ini-entry"), aNode); + } + else + { + return ::boost::optional(); + } + return ::boost::optional(retData); + } + catch (css::deployment::DeploymentException& ) + { + throw; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data entry in configuration backend db: ") + + m_urlDb, 0, exc); + } +} + +::std::list ConfigurationBackendDb::getAllDataUrls() +{ + try + { + ::std::list listRet; + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + + Reference xpathApi = getXPathAPI(); + const OUString sPrefix = getNSPrefix(); + OUString sExpression( + sPrefix + OUSTR(":configuration/") + sPrefix + OUSTR(":data-url/text()")); + Reference nodes = + xpathApi->selectNodeList(root, sExpression); + if (nodes.is()) + { + sal_Int32 length = nodes->getLength(); + for (sal_Int32 i = 0; i < length; i++) + listRet.push_back(nodes->item(i)->getNodeValue()); + } + return listRet; + } + catch (css::deployment::DeploymentException& ) + { + throw; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data entry in configuration backend db: ") + + m_urlDb, 0, exc); + } +} + +::std::list ConfigurationBackendDb::getAllIniEntries() +{ + return getOneChildFromAllEntries(OUSTR("ini-entry")); +} + + + +} // namespace configuration +} // namespace backend +} // namespace dp_registry + diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx new file mode 100644 index 000000000000..1b6c4f8973a4 --- /dev/null +++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dp_backend.h,v $ + * $Revision: 1.18 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_DP_CONFIGURATIONBACKENDDB_HXX +#define INCLUDED_DP_CONFIGURATIONBACKENDDB_HXX + +#include "rtl/ustring.hxx" +#include "rtl/string.hxx" +#include +#include "boost/optional.hpp" +#include "dp_backenddb.hxx" + +namespace css = ::com::sun::star; + +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + } +}}} + +namespace dp_registry { +namespace backend { +namespace configuration { + +/* The XML file stores the extensions which are currently registered. + They will be removed when they are revoked. + */ +class ConfigurationBackendDb: public dp_registry::backend::BackendDb +{ +protected: + virtual ::rtl::OUString getDbNSName(); + + virtual ::rtl::OUString getNSPrefix(); + + virtual ::rtl::OUString getRootElementName(); + + virtual ::rtl::OUString getKeyElementName(); + +public: + struct Data + { + /* the URL to the folder containing the xcu or xcs files which contained + %origin% + */ + ::rtl::OUString dataUrl; + /* the URL of the xcu or xcs file which is written in to the configmgr.ini + */ + ::rtl::OUString iniEntry; + }; + +public: + + ConfigurationBackendDb( css::uno::Reference const & xContext, + ::rtl::OUString const & url); + + void addEntry(::rtl::OUString const & url, Data const & data); + + ::boost::optional getEntry(::rtl::OUString const & url); + ::std::list< ::rtl::OUString> getAllDataUrls(); + ::std::list< ::rtl::OUString> getAllIniEntries(); +}; + + + +} +} +} +#endif + diff --git a/desktop/source/deployment/registry/configuration/makefile.mk b/desktop/source/deployment/registry/configuration/makefile.mk index f549b0e7b0f8..9bcbd50d4230 100644 --- a/desktop/source/deployment/registry/configuration/makefile.mk +++ b/desktop/source/deployment/registry/configuration/makefile.mk @@ -44,7 +44,8 @@ SRC1FILES = \ dp_configuration.src SLOFILES = \ - $(SLO)$/dp_configuration.obj + $(SLO)$/dp_configuration.obj \ + $(SLO)$/dp_configurationbackenddb.obj .INCLUDE : ..$/..$/target.pmk .INCLUDE : target.mk diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 9a83ca63d36e..ea31f75c6b6b 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -239,6 +239,22 @@ OUString PackageRegistryBackend::createFolder( return destFolder; } +void PackageRegistryBackend::deleteTempFolder( + OUString const & folderUrl) +{ + OSL_ASSERT(folderUrl.getLength() + && folderUrl[folderUrl.getLength() - 1] == '_'); + if (folderUrl.getLength() + && folderUrl[folderUrl.getLength() - 1] == '_') + { + const OUString tempFile = folderUrl.copy(0, folderUrl.getLength() - 1); + erase_path( folderUrl, Reference(), + false /* no throw: ignore errors */ ); + erase_path( tempFile, Reference(), + false /* no throw: ignore errors */ ); + } +} + void PackageRegistryBackend::deleteUnusedFolders( OUString const & relUrl, ::std::list< OUString> const & usedFolders) @@ -273,16 +289,12 @@ void PackageRegistryBackend::deleteUnusedFolders( { //usedFolders contains the urls to the folders which have //a trailing underscore - const OUString tempFile = tempEntries[ pos ]; - const OUString tempFolderName = tempFile + OUSTR("_"); + const OUString tempFolderName = tempEntries[ pos ] + OUSTR("_"); if (::std::find( usedFolders.begin(), usedFolders.end(), tempFolderName ) == usedFolders.end()) { - erase_path( tempFolderName, Reference(), - false /* no throw: ignore errors */ ); - erase_path( tempFile, Reference(), - false /* no throw: ignore errors */ ); + deleteTempFolder(tempFolder); } } } diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx index 660c5ad80bf1..1f4a62e696d7 100644 --- a/desktop/source/deployment/registry/dp_backenddb.cxx +++ b/desktop/source/deployment/registry/dp_backenddb.cxx @@ -509,6 +509,51 @@ OUString BackendDb::readSimpleElement( } } +::std::list BackendDb::getOneChildFromAllEntries( + OUString const & name) +{ + try + { + ::std::list listRet; + Reference doc = getDocument(); + Reference root = doc->getFirstChild(); + + Reference xpathApi = getXPathAPI(); + const OUString sPrefix = getNSPrefix(); + const OUString sKeyElement = getKeyElementName(); + ::rtl::OUStringBuffer buf(512); + buf.append(sPrefix); + buf.appendAscii(":"); + buf.append(sKeyElement); + buf.appendAscii("/"); + buf.append(sPrefix); + buf.appendAscii(":"); + buf.append(name); + buf.append(OUSTR("/text()")); + + Reference nodes = + xpathApi->selectNodeList(root, buf.makeStringAndClear()); + if (nodes.is()) + { + sal_Int32 length = nodes->getLength(); + for (sal_Int32 i = 0; i < length; i++) + listRet.push_back(nodes->item(i)->getNodeValue()); + } + return listRet; + } + catch (css::deployment::DeploymentException& ) + { + throw; + } + catch(css::uno::Exception &) + { + Any exc( ::cppu::getCaughtException() ); + throw css::deployment::DeploymentException( + OUSTR("Extension Manager: failed to read data entry in backend db: ") + + m_urlDb, 0, exc); + } +} + //================================================================================ diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 7e8f128bbf12..bc17a1f7163d 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -66,7 +66,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend { BackendImpl * getMyBackend() const; - HelpBackendDb::Data m_dbData; +// HelpBackendDb::Data m_dbData; // Package virtual beans::Optional< beans::Ambiguous > isRegistered_( @@ -234,13 +234,13 @@ BackendImpl::PackageImpl::PackageImpl( : Package( myBackend, url, name, name, xPackageType, bRemoved, identifier) { - if (bRemoved) - { - ::boost::optional opt = - getMyBackend()->readDataFromDb(url); - if (opt) - m_dbData = *opt; - } +// if (bRemoved) +// { +// ::boost::optional opt = +// getMyBackend()->readDataFromDb(url); +// if (opt) +// m_dbData = *opt; +// } } // Package diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx index 4a8fa71e0618..3bf67e0c050b 100644 --- a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx @@ -100,7 +100,7 @@ void HelpBackendDb::addEntry(::rtl::OUString const & url, Data const & data) { Any exc( ::cppu::getCaughtException() ); throw css::deployment::DeploymentException( - OUSTR("Extension Manager: failed to write data entry in backend db: ") + + OUSTR("Extension Manager: failed to write data entry in help backend db: ") + m_urlDb, 0, exc); } } @@ -131,7 +131,7 @@ HelpBackendDb::getEntry(::rtl::OUString const & url) { Any exc( ::cppu::getCaughtException() ); throw css::deployment::DeploymentException( - OUSTR("Extension Manager: failed to read data entry in backend db: ") + + OUSTR("Extension Manager: failed to read data entry in help backend db: ") + m_urlDb, 0, exc); } } @@ -166,7 +166,7 @@ HelpBackendDb::getEntry(::rtl::OUString const & url) { Any exc( ::cppu::getCaughtException() ); throw css::deployment::DeploymentException( - OUSTR("Extension Manager: failed to read data entry in backend db: ") + + OUSTR("Extension Manager: failed to read data entry in help backend db: ") + m_urlDb, 0, exc); } } diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx index baecf0da48e6..edf7dfdfc284 100644 --- a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx @@ -32,8 +32,6 @@ #define INCLUDED_DP_HELPBACKENDDB_HXX #include "rtl/ustring.hxx" -#include "rtl/string.hxx" -#include #include #include "boost/optional.hpp" #include "dp_backenddb.hxx" @@ -44,13 +42,6 @@ namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } - namespace xml { namespace dom { - class XDocument; - class XNode; - }} - namespace xml { namespace xpath { - class XXPathAPI; - }} }}} namespace dp_registry { diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 7b11ae456d5d..3d3bf7cf912c 100644 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -336,6 +336,11 @@ protected: void deleteUnusedFolders( ::rtl::OUString const & relUrl, ::std::list< ::rtl::OUString> const & usedFolders); + /* deletes one folder with a "temporary" name and the corresponding + tmp file, which was used to derive the folder name. + */ + static void deleteTempFolder( + ::rtl::OUString const & folderUrl); public: diff --git a/desktop/source/deployment/registry/inc/dp_backenddb.hxx b/desktop/source/deployment/registry/inc/dp_backenddb.hxx index b8ba5facd492..cf0bb5129292 100644 --- a/desktop/source/deployment/registry/inc/dp_backenddb.hxx +++ b/desktop/source/deployment/registry/inc/dp_backenddb.hxx @@ -117,7 +117,10 @@ protected: ::rtl::OUString const & sListTagName, ::rtl::OUString const & sMemberTagName); - + /* returns the values of one particulary child element of all key elements. + */ + ::std::list< ::rtl::OUString> BackendDb::getOneChildFromAllEntries( + ::rtl::OUString const & sElementName); /* returns the namespace which is to be written as xmlns attribute -- cgit From 1711ca5365d607f09507b3d1420403b11cd49064 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 10 May 2010 11:20:35 +0100 Subject: cmcfixes75: #i111508# implement a com.sun.star.mail.Mailserver in mailmerge.py --- scripting/source/pyprov/mailmerge.py | 120 ++++++++++++++++++++++++++++++----- 1 file changed, 104 insertions(+), 16 deletions(-) diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py index f9c2f0f70b09..55c204f87dbf 100644 --- a/scripting/source/pyprov/mailmerge.py +++ b/scripting/source/pyprov/mailmerge.py @@ -16,6 +16,8 @@ import uno import re #to implement com::sun::star::mail::XMailServiceProvider +#and +#to implement com.sun.star.mail.XMailMessage from com.sun.star.mail import XMailServiceProvider from com.sun.star.mail import XMailService @@ -37,7 +39,7 @@ from email import Encoders from email.Header import Header from email.MIMEMultipart import MIMEMultipart from email.Utils import formatdate -from email.Utils import formataddr +from email.Utils import parseaddr import sys, smtplib, imaplib, poplib @@ -118,30 +120,46 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): print >> sys.stderr, "PyMailSMPTService sendMailMessage" recipients = xMailMessage.getRecipients() sendermail = xMailMessage.SenderAddress - sendername = xMailMessage.SenderName + sendername = xMailMessage.SenderName subject = xMailMessage.Subject ccrecipients = xMailMessage.getCcRecipients() bccrecipients = xMailMessage.getBccRecipients() if dbg: print >> sys.stderr, "PyMailSMPTService subject", subject - print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8'), sendermail - print >> sys.stderr, "PyMailSMTPService from", formataddr((sendername.encode('utf-8'), sendermail)) + print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8') + print >> sys.stderr, "PyMailSMTPService from", sendermail print >> sys.stderr, "PyMailSMPTService send to", recipients attachments = xMailMessage.getAttachments() + textmsg = Message() + content = xMailMessage.Body flavors = content.getTransferDataFlavors() - flavor = flavors[0] if dbg: - print >> sys.stderr, "PyMailSMPTService mimetype is", flavor.MimeType - textbody = content.getTransferData(flavor) + print >> sys.stderr, "PyMailSMPTService flavors len", len(flavors) - textmsg = Message() - mimeEncoding = re.sub("charset=.*", "charset=UTF-8", flavor.MimeType) - textmsg['Content-Type'] = mimeEncoding - textmsg['MIME-Version'] = '1.0' - textmsg.set_payload(textbody.encode('utf-8')) + #Use first flavor that's sane for an email body + for flavor in flavors: + if flavor.MimeType.find('text/html') != -1 or flavor.MimeType.find('text/plain') != -1: + if dbg: + print >> sys.stderr, "PyMailSMPTService mimetype is", flavor.MimeType + textbody = content.getTransferData(flavor) + try: + textbody = textbody.value + except: + pass + textbody = textbody.encode('utf-8') + + if len(textbody): + mimeEncoding = re.sub("charset=.*", "charset=UTF-8", flavor.MimeType) + if mimeEncoding.find('charset=UTF-8') == -1: + mimeEncoding = mimeEncoding + "; charset=UTF-8" + textmsg['Content-Type'] = mimeEncoding + textmsg['MIME-Version'] = '1.0' + textmsg.set_payload(textbody) + + break if (len(attachments)): msg = MIMEMultipart() @@ -150,15 +168,31 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): else: msg = textmsg - msg['Subject'] = subject - msg['From'] = formataddr((sendername.encode('utf-8'), sendermail)) + hdr = Header(sendername, 'utf-8') + hdr.append('<'+sendermail+'>','us-ascii') + msg['Subject'] = subject + msg['From'] = hdr msg['To'] = COMMASPACE.join(recipients) if len(ccrecipients): msg['Cc'] = COMMASPACE.join(ccrecipients) if xMailMessage.ReplyToAddress != '': msg['Reply-To'] = xMailMessage.ReplyToAddress - msg['X-Mailer'] = "OpenOffice.org 2.0 via Caolan's mailmerge component" + mailerstring = "OpenOffice.org 2.0 via Caolan's mailmerge component" + try: + ctx = uno.getComponentContext() + aConfigProvider = ctx.ServiceManager.createInstance("com.sun.star.configuration.ConfigurationProvider") + prop = uno.createUnoStruct('com.sun.star.beans.PropertyValue') + prop.Name = "nodepath" + prop.Value = "/org.openoffice.Setup/Product" + aSettings = aConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", + (prop,)) + mailerstring = aSettings.getByName("ooName") + " " + \ + aSettings.getByName("ooSetupVersion") + " via Caolan's mailmerge component" + except: + pass + + msg['X-Mailer'] = mailerstring msg['Date'] = formatdate(localtime=True) for attachment in attachments: @@ -344,9 +378,63 @@ class PyMailServiceProvider(unohelper.Base, XMailServiceProvider): else: print >> sys.stderr, "PyMailServiceProvider, unknown TYPE", aType +class PyMailMessage(unohelper.Base, XMailMessage): + def __init__( self, ctx, sTo='', sFrom='', Subject='', Body=None, aMailAttachment=None ): + if dbg: + print >> sys.stderr, "PyMailMessage init" + self.ctx = ctx + + self.recipients = sTo, + self.ccrecipients = () + self.bccrecipients = () + self.aMailAttachments = () + if aMailAttachment != None: + self.aMailAttachments = aMailAttachment, + + self.SenderName, self.SenderAddress = parseaddr(sFrom) + self.ReplyToAddress = sFrom + self.Subject = Subject + self.Body = Body + if dbg: + print >> sys.stderr, "post PyMailMessage init" + def addRecipient( self, recipient ): + if dbg: + print >> sys.stderr, "PyMailMessage.addRecipient", recipient + self.recipients = self.recipients, recipient + def addCcRecipient( self, ccrecipient ): + if dbg: + print >> sys.stderr, "PyMailMessage.addCcRecipient", ccrecipient + self.ccrecipients = self.ccrecipients, ccrecipient + def addBccRecipient( self, bccrecipient ): + if dbg: + print >> sys.stderr, "PyMailMessage.addBccRecipient", bccrecipient + self.bccrecipients = self.bccrecipients, bccrecipient + def getRecipients( self ): + if dbg: + print >> sys.stderr, "PyMailMessage.getRecipients", self.recipients + return self.recipients + def getCcRecipients( self ): + if dbg: + print >> sys.stderr, "PyMailMessage.getCcRecipients", self.ccrecipients + return self.ccrecipients + def getBccRecipients( self ): + if dbg: + print >> sys.stderr, "PyMailMessage.getBccRecipients", self.bccrecipients + return self.bccrecipients + def addAttachment( self, aMailAttachment ): + if dbg: + print >> sys.stderr, "PyMailMessage.addAttachment" + self.aMailAttachments = self.aMailAttachments, aMailAttachment + def getAttachments( self ): + if dbg: + print >> sys.stderr, "PyMailMessage.getAttachments" + return self.aMailAttachments + # pythonloader looks for a static g_ImplementationHelper variable g_ImplementationHelper = unohelper.ImplementationHelper() g_ImplementationHelper.addImplementation( \ PyMailServiceProvider, "org.openoffice.pyuno.MailServiceProvider", ("com.sun.star.mail.MailServiceProvider",),) - +g_ImplementationHelper.addImplementation( \ + PyMailMessage, "org.openoffice.pyuno.MailMessage", + ("com.sun.star.mail.MailMessage",),) -- cgit From 0e1079119202c55866d01479e913a30bf7513ce6 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 10 May 2010 13:58:03 +0200 Subject: CWS mba33issues01: #i109842#: delete global resources in pro version also --- sfx2/source/appl/appquit.cxx | 50 -------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx index 4da32cf9f566..d615d90ff37a 100644 --- a/sfx2/source/appl/appquit.cxx +++ b/sfx2/source/appl/appquit.cxx @@ -74,57 +74,11 @@ using ::basic::BasicManagerRepository; -#ifdef DBG_UTIL -DECLARE_LIST( SfxFrameWindowFactoryArray_Impl, SfxFrameWindowFactory* ) -SV_DECL_PTRARR(SfxInitLinkList, Link*, 2, 2) -#endif - //=================================================================== BOOL SfxApplication::QueryExit_Impl() { BOOL bQuit = TRUE; -/* - BOOL bPrinting = FALSE; - for ( SfxViewShell *pViewSh = SfxViewShell::GetFirst(); - !bPrinting && pViewSh; - pViewSh = SfxViewShell::GetNext(*pViewSh) ) - { - SfxPrinter *pPrinter = pViewSh->GetPrinter(); - bPrinting = pPrinter && pPrinter->IsPrinting(); - } - - if ( bPrinting ) - { - // Benutzer fragen, ob abgebrochen werden soll - if ( RET_OK == QueryBox( 0, SfxResId( MSG_ISPRINTING_QUERYABORT ) ).Execute() ) - { - // alle Jobs canceln - for ( SfxViewShell *pViewSh = SfxViewShell::GetFirst(); - !bPrinting && pViewSh; - pViewSh = SfxViewShell::GetNext(*pViewSh) ) - { - SfxPrinter *pPrinter = pViewSh->GetPrinter(); - if ( pPrinter && pPrinter->IsPrinting() ) - pPrinter->AbortJob(); - } - - // da das Canceln asynchron ist, Quit erstmal wieder verlassen - GetDispatcher_Impl()->Execute( SID_QUITAPP, SFX_CALLMODE_ASYNCHRON ); - DBG_TRACE( "QueryExit => FALSE (printing)" ); - return FALSE; - } - } -*/ -/* - SfxObjectShell *pLastDocSh = SfxObjectShell::GetFirst(); - if ( bQuit ) - { - // Jetzt zur Sicherheit auch hidden Frames abr"aumen - SfxViewFrame::CloseHiddenFrames_Impl(); - pLastDocSh = SfxObjectShell::GetFirst(); - } -*/ // will trotzdem noch jemand, den man nicht abschiessen kann, die App haben? if ( !bQuit ) { @@ -197,22 +151,18 @@ void SfxApplication::Deinitialize() delete pAppData_Impl->pLabelResMgr; -#ifdef DBG_UTIL DELETEX(pAppData_Impl->pSlotPool); DELETEX(pAppData_Impl->pEventConfig); SfxMacroConfig::Release_Impl(); DELETEX(pAppData_Impl->pFactArr); DELETEX(pAppData_Impl->pInitLinkList); -#endif -#ifdef DBG_UTIL DELETEX(pAppData_Impl->pTbxCtrlFac); DELETEX(pAppData_Impl->pStbCtrlFac); DELETEX(pAppData_Impl->pMenuCtrlFac); DELETEX(pAppData_Impl->pViewFrames); DELETEX(pAppData_Impl->pViewShells); DELETEX(pAppData_Impl->pObjShells); -#endif //TODO/CLEANTUP //ReleaseArgs could be used instead! -- cgit From 311a2cbcf6532e47027abfef191b94fb60aaab7c Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 10 May 2010 13:58:53 +0200 Subject: CWS mba33issues01: #i108607#: resolve operator ambiguity --- svx/source/svdraw/svdoole2.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 88d9aba87673..15c2ecb9c564 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1714,8 +1714,8 @@ void SdrOle2Obj::ImpSetVisAreaSize() if ( pClient || bHasOwnClient ) { // TODO/LATER: IMHO we need to do similar things when object is UIActive or OutplaceActive?! (MBA) - if ( (nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) && - svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() ) + if ( ((nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) && + svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() )) || xObjRef->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE ) { -- cgit From b8dc3e6f63c57c92f877d392ef013127f41c5d44 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Mon, 10 May 2010 15:19:49 +0200 Subject: jl152 fixing merge conflict --- desktop/source/deployment/registry/dp_backend.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index ea31f75c6b6b..d781ba9e40ef 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -294,7 +294,7 @@ void PackageRegistryBackend::deleteUnusedFolders( if (::std::find( usedFolders.begin(), usedFolders.end(), tempFolderName ) == usedFolders.end()) { - deleteTempFolder(tempFolder); + deleteTempFolder(tempFolderName); } } } -- cgit From be45f3f14b9f103e12ddc343f483086eff10011e Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 10 May 2010 15:53:56 +0200 Subject: jl152: #i77196# typo --- desktop/source/deployment/registry/inc/dp_backenddb.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/source/deployment/registry/inc/dp_backenddb.hxx b/desktop/source/deployment/registry/inc/dp_backenddb.hxx index cf0bb5129292..a0e477979f8c 100644 --- a/desktop/source/deployment/registry/inc/dp_backenddb.hxx +++ b/desktop/source/deployment/registry/inc/dp_backenddb.hxx @@ -119,7 +119,7 @@ protected: /* returns the values of one particulary child element of all key elements. */ - ::std::list< ::rtl::OUString> BackendDb::getOneChildFromAllEntries( + ::std::list< ::rtl::OUString> getOneChildFromAllEntries( ::rtl::OUString const & sElementName); -- cgit From c288dd322747e11a5c779f155ba39e799a9920c2 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 10 May 2010 17:35:24 +0200 Subject: jl152: #i108704# allow to restart the office --- desktop/scripts/soffice.sh | 9 +++++++-- desktop/source/app/app.cxx | 21 ++++++++++++++++++++- desktop/source/inc/exithelper.hxx | 2 ++ desktop/unx/source/officeloader/officeloader.cxx | 2 +- desktop/win32/source/officeloader/officeloader.cxx | 3 ++- 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh index ebbdeb9eabdb..fae9dbe4d695 100644 --- a/desktop/scripts/soffice.sh +++ b/desktop/scripts/soffice.sh @@ -120,9 +120,14 @@ trap 'kill -9 $!' TERM wait $! sd_ret=$? -while [ $sd_ret -eq 79 ] +while [ $sd_ret -eq 79 -o $sd_ret -eq 81 ] do - "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" & + if [ $sd_ret -eq 79 ]; then + "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" & + elif if [ $sd_ret -eq 81 ]; then + "$sd_prog/$sd_binary" "$@" & + fi + wait $! sd_ret=$? done diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 8e610fb0e141..3b0a1ea0dcf8 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -84,6 +84,7 @@ #include #include #include +#include #ifndef _COM_SUN_STAR_TASK_XJOBEXECUTOR_HPP_ #include #endif @@ -103,6 +104,7 @@ #include #include #include +#include #include #ifndef _UTL__HXX_ #include @@ -140,6 +142,7 @@ #include #include #include +#include #include "vos/process.hxx" @@ -1615,6 +1618,7 @@ void Desktop::Main() // call Application::Execute to process messages in vcl message loop RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" ); + Reference< ::com::sun::star::task::XRestartManager > xRestartManager; try { // The JavaContext contains an interaction handler which is used when @@ -1622,7 +1626,11 @@ void Desktop::Main() com::sun::star::uno::ContextLayer layer2( new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) ); - Execute(); + ::comphelper::ComponentContext aContext( xSMgr ); + xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY ); + + if ( !xRestartManager.is() || !xRestartManager->isRestartRequested( sal_True ) ) + Execute(); } catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg) { @@ -1635,6 +1643,9 @@ void Desktop::Main() FatalError( MakeStartupErrorMessage(exAnyCfg.Message) ); } + // check whether the shutdown is caused by restart + sal_Bool bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) ); + if (xGlobalBroadcaster.is()) { css::document::EventObject aEvent; @@ -1671,6 +1682,14 @@ void Desktop::Main() RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- deinit ucb" ); RTL_LOGFILE_CONTEXT_TRACE( aLog, "FINISHED WITH Destop::Main" ); + if ( bRestartRequested ) + { +#ifdef MACOSX + DoRestart(); +#endif + // wouldn't the solution be more clean if SalMain returns the exit code to the system? + _exit( ExitHelper::E_NORMAL_RESTART ); + } } IMPL_LINK( Desktop, ImplInitFilterHdl, ConvertData*, pData ) diff --git a/desktop/source/inc/exithelper.hxx b/desktop/source/inc/exithelper.hxx index 2e6d7e774d98..e2604ce49b68 100644 --- a/desktop/source/inc/exithelper.hxx +++ b/desktop/source/inc/exithelper.hxx @@ -58,6 +58,8 @@ class ExitHelper E_FATAL_ERROR = 333, // Only the low 8 bits are significant 333 % 256 = 77 /// user force automatic restart after crash E_CRASH_WITH_RESTART = 79, + /// the office restarts itself + E_NORMAL_RESTART = 81 }; }; diff --git a/desktop/unx/source/officeloader/officeloader.cxx b/desktop/unx/source/officeloader/officeloader.cxx index de84985cdea6..87621960c61a 100755 --- a/desktop/unx/source/officeloader/officeloader.cxx +++ b/desktop/unx/source/officeloader/officeloader.cxx @@ -93,7 +93,7 @@ SAL_IMPLEMENT_MAIN() if ( info.Fields & osl_Process_EXITCODE ) { exitcode = info.Code; - bRestart = (ExitHelper::E_CRASH_WITH_RESTART == exitcode); + bRestart = (ExitHelper::E_CRASH_WITH_RESTART == exitcode || ExitHelper::E_NORMAL_RESTART == exitcode); } else break; diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx index f36bfc134ded..2d602a6d6507 100644 --- a/desktop/win32/source/officeloader/officeloader.cxx +++ b/desktop/win32/source/officeloader/officeloader.cxx @@ -416,7 +416,8 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) CloseHandle( aProcessInfo.hProcess ); CloseHandle( aProcessInfo.hThread ); } - } while ( fSuccess && ::desktop::ExitHelper::E_CRASH_WITH_RESTART == dwExitCode ); + } while ( fSuccess + && ( ::desktop::ExitHelper::E_CRASH_WITH_RESTART == dwExitCode || ::desktop::ExitHelper::E_NORMAL_RESTART == dwExitCode ); delete[] lpCommandLine; return fSuccess ? dwExitCode : -1; -- cgit From d3fa4e4b471979d44494079aafa2a1018cc91fa0 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 10 May 2010 17:55:28 +0200 Subject: jl152: #i108704# fix typo --- desktop/scripts/soffice.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh index fae9dbe4d695..0215f88d1ff0 100644 --- a/desktop/scripts/soffice.sh +++ b/desktop/scripts/soffice.sh @@ -124,7 +124,7 @@ while [ $sd_ret -eq 79 -o $sd_ret -eq 81 ] do if [ $sd_ret -eq 79 ]; then "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" & - elif if [ $sd_ret -eq 81 ]; then + elif [ $sd_ret -eq 81 ]; then "$sd_prog/$sd_binary" "$@" & fi -- cgit From ddd3ac4abb2054e30440198bc9ab54ae227d1f82 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 11 May 2010 14:48:15 +0200 Subject: CWS mba33issues01: #i111452#: allow to call getController() at disposed frames without assertion --- framework/source/services/frame.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 18d5a1c31bef..08a7c522831b 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -1551,8 +1551,9 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL Frame::getComponentWindow() th css::uno::Reference< css::frame::XController > SAL_CALL Frame::getController() throw( css::uno::RuntimeException ) { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ + // It seems to be unavoidable that disposed frames allow to ask for a Controller (#111452) // Register transaction and reject wrong calls. - TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); + // TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); -- cgit From cd50d383f645aa1d188331039d334faebfa1add0 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 12 May 2010 08:38:13 +0200 Subject: CWS mba33issues01: #i105239#: safe way to access SfxApplication in IMEStatusWindow --- sfx2/inc/sfx2/app.hxx | 2 +- sfx2/source/appl/appdata.cxx | 5 ++--- sfx2/source/appl/imestatuswindow.cxx | 6 +++--- sfx2/source/appl/imestatuswindow.hxx | 7 +------ sfx2/source/bastyp/progress.cxx | 2 +- sfx2/source/control/unoctitm.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 2 +- 7 files changed, 10 insertions(+), 16 deletions(-) diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx index 17b2dee417cd..e38a2e9dbe7f 100644 --- a/sfx2/inc/sfx2/app.hxx +++ b/sfx2/inc/sfx2/app.hxx @@ -258,7 +258,7 @@ public: void ResetLastDir(); //#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE static SfxApplication* Is_Impl() { return pApp;} + SAL_DLLPRIVATE static SfxApplication* Get() { return pApp;} SAL_DLLPRIVATE SfxDispatcher* GetAppDispatcher_Impl(); SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl(); diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index a07623df46b1..38ea69280c49 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -89,7 +89,7 @@ void SfxBasicManagerCreationListener::onBasicManagerCreated( const Reference< XM m_rAppData.OnApplicationBasicManagerCreated( _rBasicManager ); } -SfxAppData_Impl::SfxAppData_Impl( SfxApplication* pApp ) : +SfxAppData_Impl::SfxAppData_Impl( SfxApplication* ) : pDdeService( 0 ), pDocTopics( 0 ), pTriggerTopic(0), @@ -116,8 +116,7 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* pApp ) : nRescheduleLocks(0), nInReschedule(0), nAsynchronCalls(0), - m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow( - *pApp, comphelper::getProcessServiceFactory())) + m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow(comphelper::getProcessServiceFactory())) , pTbxCtrlFac(0) , pStbCtrlFac(0) , pViewFrames(0) diff --git a/sfx2/source/appl/imestatuswindow.cxx b/sfx2/source/appl/imestatuswindow.cxx index 3cdc3064fb81..07eb47bd92ad 100644 --- a/sfx2/source/appl/imestatuswindow.cxx +++ b/sfx2/source/appl/imestatuswindow.cxx @@ -57,10 +57,8 @@ namespace css = com::sun::star; using sfx2::appl::ImeStatusWindow; ImeStatusWindow::ImeStatusWindow( - SfxApplication & rApplication, css::uno::Reference< css::lang::XMultiServiceFactory > const & rServiceFactory): - m_rApplication(rApplication), m_xServiceFactory(rServiceFactory), m_bDisposed(false) {} @@ -161,7 +159,9 @@ ImeStatusWindow::propertyChange(css::beans::PropertyChangeEvent const & ) throw (css::uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - m_rApplication.Invalidate(SID_SHOW_IME_STATUS_WINDOW); + SfxApplication* pApp = SfxApplication::Get(); + if (pApp) + pApp->Invalidate(SID_SHOW_IME_STATUS_WINDOW); } css::uno::Reference< css::beans::XPropertySet > ImeStatusWindow::getConfig() diff --git a/sfx2/source/appl/imestatuswindow.hxx b/sfx2/source/appl/imestatuswindow.hxx index 71c0b371f796..4edba523ed30 100644 --- a/sfx2/source/appl/imestatuswindow.hxx +++ b/sfx2/source/appl/imestatuswindow.hxx @@ -37,7 +37,6 @@ namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } namespace lang { class XMultiServiceFactory; } } } } -class SfxApplication; namespace sfx2 { namespace appl { @@ -56,10 +55,7 @@ ImeStatusWindow_Impl; class ImeStatusWindow: private ImeStatusWindow_Impl { public: - ImeStatusWindow(SfxApplication & rApplication, - com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory > const & - rServiceFactory); + ImeStatusWindow( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > const& rServiceFactory ); /** Set up VCL according to the configuration. @@ -115,7 +111,6 @@ private: com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > getConfig(); - SfxApplication & m_rApplication; com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index 649ae121c274..3af0ba2b0a6f 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -706,7 +706,7 @@ SfxProgress* SfxProgress::GetActiveProgress */ { - if ( !SfxApplication::Is_Impl() ) + if ( !SfxApplication::Get() ) return 0; SfxProgress *pProgress = 0; diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index d2ad8c645eb7..e53f1766b7b9 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -823,7 +823,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util pItem = pDispatcher->Execute( GetId(), nCall, 0, &aInternalSet, nModifier ); // no bindings, no invalidate ( usually done in SfxDispatcher::Call_Impl()! ) - if ( SfxApplication::Is_Impl() ) + if ( SfxApplication::Get() ) { SfxDispatcher* pAppDispat = SFX_APP()->GetAppDispatcher_Impl(); if ( pAppDispat ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 66af0d7ac8ba..0d3c1f727e5b 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1510,7 +1510,7 @@ void SfxViewFrame::KillDispatcher_Impl() //------------------------------------------------------------------------ SfxViewFrame* SfxViewFrame::Current() { - return SfxApplication::Is_Impl() ? SFX_APP()->Get_Impl()->pViewFrame : NULL; + return SfxApplication::Get() ? SFX_APP()->Get_Impl()->pViewFrame : NULL; } //-------------------------------------------------------------------- -- cgit From defd78c476f1dc496bfa98c1701740a957803270 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 12 May 2010 08:55:24 +0100 Subject: cmcfixes75: #i111551# remove unused getGlobalTransactionManager --- framework/inc/threadhelp/transactionmanager.hxx | 1 - framework/source/threadhelp/transactionmanager.cxx | 36 ---------------------- 2 files changed, 37 deletions(-) diff --git a/framework/inc/threadhelp/transactionmanager.hxx b/framework/inc/threadhelp/transactionmanager.hxx index a3ce7e67ea8a..eca13d63103c 100644 --- a/framework/inc/threadhelp/transactionmanager.hxx +++ b/framework/inc/threadhelp/transactionmanager.hxx @@ -93,7 +93,6 @@ class TransactionManager : public ITransactionManager virtual sal_Bool isCallRejected ( ERejectReason& eReason ) const; virtual void registerTransaction ( EExceptionMode eMode, ERejectReason& eReason ) throw( css::uno::RuntimeException, css::lang::DisposedException ); virtual void unregisterTransaction ( ) throw( css::uno::RuntimeException, css::lang::DisposedException ); - static TransactionManager& getGlobalTransactionManager ( ); //------------------------------------------------------------------------------------------------------------- // private methods diff --git a/framework/source/threadhelp/transactionmanager.cxx b/framework/source/threadhelp/transactionmanager.cxx index 34b4892ccebe..a42c871c176e 100644 --- a/framework/source/threadhelp/transactionmanager.cxx +++ b/framework/source/threadhelp/transactionmanager.cxx @@ -318,42 +318,6 @@ sal_Bool TransactionManager::isCallRejected( ERejectReason& eReason ) const return( eReason!=E_NOREASON ); } -/*-****************************************************************************************************//** - @short return a reference to a static manager - @descr Sometimes we need the global member! (e.g. in our own static methods) - We create our own "class global static" member threadsafe. - It will be created at first call only! - All other requests use these created one then directly. - - @seealso - - - @param - - @return A reference to a static member. - - @onerror No error should occure. -*//*-*****************************************************************************************************/ -TransactionManager& TransactionManager::getGlobalTransactionManager() -{ - // Initialize static member only for one time! - static TransactionManager* pManager = NULL; - // If these method first called (member not already exist!) ... - if( pManager == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - // We must check our pointer again - because ... another instance of ouer class could be faster then these one! - if( pManager == NULL ) - { - // Create the new manager and set it for return on static variable. - static TransactionManager aManager; - pManager = &aManager; - } - } - // Return new created or already existing object. - return *pManager; -} - /*-****************************************************************************************************//** @short throw any exceptions for rejected calls @descr If user whish to use our automaticly exception mode we use this impl-method. -- cgit From 2af4a389327fbf8640fdb5f69eb8d1637f0e86bf Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Wed, 12 May 2010 16:11:41 +0200 Subject: jl152 #i77196# restarting at startup when shared/bundled extensions were changed, fixed typo in win32/source/officeloader/officeloader.cxx --- desktop/source/app/check_ext_deps.cxx | 2 +- desktop/source/deployment/misc/dp_misc.cxx | 23 ++- .../deployment/registry/component/dp_component.cxx | 195 +++++++++++---------- .../registry/configuration/dp_configuration.cxx | 5 +- .../deployment/registry/script/dp_script.cxx | 99 ++++++----- desktop/win32/source/officeloader/officeloader.cxx | 2 +- 6 files changed, 178 insertions(+), 148 deletions(-) diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index 7629a5c5cf83..757135a7e2d3 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -395,7 +395,7 @@ sal_Bool Desktop::CheckExtensionDependencies() void Desktop::SynchronizeExtensionRepositories() { - RTL_LOGFILE_CONTEXT(aLog,"desktop (jl97489) ::Desktop::SynchronizeExtensionRepositories"); + RTL_LOGFILE_CONTEXT(aLog,"desktop (jl) ::Desktop::SynchronizeExtensionRepositories"); OUString sDisable; ::rtl::Bootstrap::get( UNISTRING( "DISABLE_SYNC_EXTENSIONS" ), sDisable, OUString() ); if (sDisable.getLength() > 0) diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 799542a4757f..b68593c7f174 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -42,9 +42,11 @@ #include "osl/thread.hxx" #include "osl/mutex.hxx" #include "com/sun/star/ucb/CommandAbortedException.hpp" +#include "com/sun/star/task/XInteractionHandler.hpp" #include "com/sun/star/bridge/UnoUrlResolver.hpp" #include "com/sun/star/bridge/XUnoUrlResolver.hpp" #include "com/sun/star/deployment/ExtensionManager.hpp" +#include "com/sun/star/task/XRestartManager.hpp" #include "boost/scoped_array.hpp" #include "boost/shared_ptr.hpp" #include @@ -600,7 +602,8 @@ void syncRepositories(Reference const & xCmdEnv) Reference xExtensionManager; //synchronize shared before bundled otherewise there are //more revoke and registration calls. - OUString sShared(RTL_CONSTASCII_USTRINGPARAM("shared")); + bool bSynced = false; + const OUString sShared(RTL_CONSTASCII_USTRINGPARAM("shared")); if (needToSyncRepostitory(sShared)) { xExtensionManager = @@ -611,10 +614,11 @@ void syncRepositories(Reference const & xCmdEnv) { xExtensionManager->synchronize( sShared, Reference(), xCmdEnv); + bSynced = true; } } - OUString sBundled(RTL_CONSTASCII_USTRINGPARAM("bundled")); + const OUString sBundled(RTL_CONSTASCII_USTRINGPARAM("bundled")); if (needToSyncRepostitory( sBundled)) { if (!xExtensionManager.is()) @@ -627,9 +631,22 @@ void syncRepositories(Reference const & xCmdEnv) { xExtensionManager->synchronize( sBundled, Reference(), xCmdEnv); - + bSynced = true; } } + + if (bSynced) + { + Reference restarter( + comphelper_getProcessComponentContext()->getValueByName( + OUSTR( "/singletons/com.sun.star.task.OfficeRestartManager") ), UNO_QUERY ); + if (restarter.is()) + { + fprintf(stdout, "\nrestarting\n"); + restarter->requestRestart(xCmdEnv.is() == sal_True ? xCmdEnv->getInteractionHandler() : + Reference()); + } + } } diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index fc9880438bac..e0844c227669 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -1275,63 +1275,66 @@ void BackendImpl::ComponentPackageImpl::processPackage_( data.implementationNames = implNames; data.singletons = singletons; - // factories live insertion: - const Reference xSet( - that->getComponentContext()->getServiceManager(), UNO_QUERY_THROW ); - for ( t_stringlist::const_iterator iPos( implNames.begin() ); - iPos != implNames.end(); ++iPos ) + if (!startup) { - checkAborted( abortChannel ); - OUString const & implName = *iPos; - // activate factory: - const Reference xFactory( - xLoader->activate( - implName, OUString(), url, - xServicesRDB->getRootKey()->openKey( - OUSTR("/IMPLEMENTATIONS/") + implName ) ) ); - try { - xSet->insert( Any(xFactory) ); - } // ignore if factory has already been inserted: - catch (container::ElementExistException &) { - OSL_ENSURE( 0, "### factory already registered?" ); + // factories live insertion: + const Reference xSet( + that->getComponentContext()->getServiceManager(), UNO_QUERY_THROW ); + for ( t_stringlist::const_iterator iPos( implNames.begin() ); + iPos != implNames.end(); ++iPos ) + { + checkAborted( abortChannel ); + OUString const & implName = *iPos; + // activate factory: + const Reference xFactory( + xLoader->activate( + implName, OUString(), url, + xServicesRDB->getRootKey()->openKey( + OUSTR("/IMPLEMENTATIONS/") + implName ) ) ); + try { + xSet->insert( Any(xFactory) ); + } // ignore if factory has already been inserted: + catch (container::ElementExistException &) { + OSL_ENSURE( 0, "### factory already registered?" ); + } } - } - if (! singletons.empty()) - { - // singletons live insertion: - const Reference xRootContext( - that->getComponentContext()->getValueByName( - OUSTR("_root") ), UNO_QUERY ); - if (xRootContext.is()) + if (! singletons.empty()) { - for ( t_stringpairvec::const_iterator iPos( - singletons.begin() ); - iPos != singletons.end(); ++iPos ) + // singletons live insertion: + const Reference xRootContext( + that->getComponentContext()->getValueByName( + OUSTR("_root") ), UNO_QUERY ); + if (xRootContext.is()) { - ::std::pair const & sp = *iPos; - const OUString name( OUSTR("/singletons/") + sp.first ); - // assure no arguments: - try { - xRootContext->removeByName( name + OUSTR("/arguments")); - } catch (container::NoSuchElementException &) {} - // used service: - try { - xRootContext->insertByName( - name + OUSTR("/service"), Any(sp.second) ); - } catch (container::ElementExistException &) { - xRootContext->replaceByName( - name + OUSTR("/service"), Any(sp.second) ); - } - // singleton entry: - try { - xRootContext->insertByName( name, Any() ); - } catch (container::ElementExistException & exc) { - (void) exc; // avoid warnings - OSL_ENSURE( - 0, OUStringToOString( - exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - xRootContext->replaceByName( name, Any() ); + for ( t_stringpairvec::const_iterator iPos( + singletons.begin() ); + iPos != singletons.end(); ++iPos ) + { + ::std::pair const & sp = *iPos; + const OUString name( OUSTR("/singletons/") + sp.first ); + // assure no arguments: + try { + xRootContext->removeByName( name + OUSTR("/arguments")); + } catch (container::NoSuchElementException &) {} + // used service: + try { + xRootContext->insertByName( + name + OUSTR("/service"), Any(sp.second) ); + } catch (container::ElementExistException &) { + xRootContext->replaceByName( + name + OUSTR("/service"), Any(sp.second) ); + } + // singleton entry: + try { + xRootContext->insertByName( name, Any() ); + } catch (container::ElementExistException & exc) { + (void) exc; // avoid warnings + OSL_ENSURE( + 0, OUStringToOString( + exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); + xRootContext->replaceByName( name, Any() ); + } } } } @@ -1365,53 +1368,57 @@ void BackendImpl::ComponentPackageImpl::processPackage_( { getComponentInfo( &implNames, &singletons, xContext ); } - // factories live removal: - const Reference xSet( - that->getComponentContext()->getServiceManager(), UNO_QUERY_THROW ); - for ( t_stringlist::const_iterator iPos( implNames.begin() ); - iPos != implNames.end(); ++iPos ) + + if (!startup) { - OUString const & implName = *iPos; - try { - xSet->remove( Any(implName) ); - } // ignore if factory has not been live deployed: - catch (container::NoSuchElementException &) { + // factories live removal: + const Reference xSet( + that->getComponentContext()->getServiceManager(), UNO_QUERY_THROW ); + for ( t_stringlist::const_iterator iPos( implNames.begin() ); + iPos != implNames.end(); ++iPos ) + { + OUString const & implName = *iPos; + try { + xSet->remove( Any(implName) ); + } // ignore if factory has not been live deployed: + catch (container::NoSuchElementException &) { + } } - } - if (! singletons.empty()) - { - // singletons live removal: - const Reference xRootContext( - that->getComponentContext()->getValueByName( - OUSTR("_root") ), UNO_QUERY ); - if (xRootContext.is()) + if (! singletons.empty()) { - for ( t_stringpairvec::const_iterator iPos( - singletons.begin() ); - iPos != singletons.end(); ++iPos ) + // singletons live removal: + const Reference xRootContext( + that->getComponentContext()->getValueByName( + OUSTR("_root") ), UNO_QUERY ); + if (xRootContext.is()) { - ::std::pair const & sp = *iPos; - const OUString name( OUSTR("/singletons/") + sp.first ); - // arguments: - try { - xRootContext->removeByName( name + OUSTR("/arguments")); - } - catch (container::NoSuchElementException &) {} - // used service: - try { - xRootContext->removeByName( name + OUSTR("/service") ); - } - catch (container::NoSuchElementException &) {} - // singleton entry: - try { - xRootContext->removeByName( name ); - } - catch (container::NoSuchElementException & exc) { - (void) exc; // avoid warnings - OSL_ENSURE( - 0, OUStringToOString( - exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); + for ( t_stringpairvec::const_iterator iPos( + singletons.begin() ); + iPos != singletons.end(); ++iPos ) + { + ::std::pair const & sp = *iPos; + const OUString name( OUSTR("/singletons/") + sp.first ); + // arguments: + try { + xRootContext->removeByName( name + OUSTR("/arguments")); + } + catch (container::NoSuchElementException &) {} + // used service: + try { + xRootContext->removeByName( name + OUSTR("/service") ); + } + catch (container::NoSuchElementException &) {} + // singleton entry: + try { + xRootContext->removeByName( name ); + } + catch (container::NoSuchElementException & exc) { + (void) exc; // avoid warnings + OSL_ENSURE( + 0, OUStringToOString( + exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); + } } } } diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 1a6738b0270b..f892c21a6a6b 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -680,7 +680,7 @@ OUString replaceOrigin( void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, - bool /*startup*/, + bool startup, ::rtl::Reference const &, Reference const & xCmdEnv ) { @@ -702,7 +702,8 @@ void BackendImpl::PackageImpl::processPackage_( } //No need for live-deployment for bundled extension, because OOo //restarts after installation - if (that->m_eContext != CONTEXT_BUNDLED) + if (that->m_eContext != CONTEXT_BUNDLED + && !startup) { if (m_isSchema) { diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index 414d4c1c61cd..3a43e916e39e 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -331,7 +331,7 @@ BackendImpl::PackageImpl::isRegistered_( void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, - bool /* startup */, + bool startup, ::rtl::Reference const &, Reference const & xCmdEnv ) { @@ -382,7 +382,8 @@ void BackendImpl::PackageImpl::processPackage_( if (bRegistered) { - if (!isRemoved()) + //we also prevent and live deployment at startup + if (!isRemoved() && !startup) { if (bScript && xScriptLibs.is() && xScriptLibs->hasByName(m_name)) { @@ -409,66 +410,70 @@ void BackendImpl::PackageImpl::processPackage_( bool bScriptSuccess = false; const bool bReadOnly = false; - //If there is a bundled extension, and the user installes the same extension - //then the script from the bundled extension must be removed. If this does not work - //then live deployment does not work for scripts. - if (bScript && xScriptLibs.is()) + bool bDialogSuccess = false; + if (!startup) { - bool bCanAdd = true; - if (xScriptLibs->hasByName(m_name)) + //If there is a bundled extension, and the user installes the same extension + //then the script from the bundled extension must be removed. If this does not work + //then live deployment does not work for scripts. + if (bScript && xScriptLibs.is()) { - const OUString sOriginalUrl = xScriptLibs->getOriginalLibraryLinkURL(m_name); - //We assume here that library names in extensions are unique, which may not be the case - //ToDo: If the script exist in another extension, then both extensions must have the - //same id - if (sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE")) - || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE")) - || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"))) + bool bCanAdd = true; + if (xScriptLibs->hasByName(m_name)) { - xScriptLibs->removeLibrary(m_name); - bCanAdd = true; + const OUString sOriginalUrl = xScriptLibs->getOriginalLibraryLinkURL(m_name); + //We assume here that library names in extensions are unique, which may not be the case + //ToDo: If the script exist in another extension, then both extensions must have the + //same id + if (sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE")) + || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE")) + || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"))) + { + xScriptLibs->removeLibrary(m_name); + bCanAdd = true; + } + else + { + bCanAdd = false; + } } - else + + if (bCanAdd) { - bCanAdd = false; + xScriptLibs->createLibraryLink( m_name, m_scriptURL, bReadOnly ); + bScriptSuccess = xScriptLibs->hasByName( m_name ); } } - if (bCanAdd) - { - xScriptLibs->createLibraryLink( m_name, m_scriptURL, bReadOnly ); - bScriptSuccess = xScriptLibs->hasByName( m_name ); - } - } - bool bDialogSuccess = false; - if (bDialog && xDialogLibs.is()) - { - bool bCanAdd = true; - if (xDialogLibs->hasByName(m_dialogName)) + if (bDialog && xDialogLibs.is()) { - const OUString sOriginalUrl = xDialogLibs->getOriginalLibraryLinkURL(m_dialogName); - //We assume here that library names in extensions are unique, which may not be the case - //ToDo: If the script exist in another extension, then both extensions must have the - //same id - if (sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE")) - || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE")) - || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"))) + bool bCanAdd = true; + if (xDialogLibs->hasByName(m_dialogName)) { - xDialogLibs->removeLibrary(m_dialogName); - bCanAdd = true; + const OUString sOriginalUrl = xDialogLibs->getOriginalLibraryLinkURL(m_dialogName); + //We assume here that library names in extensions are unique, which may not be the case + //ToDo: If the script exist in another extension, then both extensions must have the + //same id + if (sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE")) + || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE")) + || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"))) + { + xDialogLibs->removeLibrary(m_dialogName); + bCanAdd = true; + } + else + { + bCanAdd = false; + } } - else + + if (bCanAdd) { - bCanAdd = false; + xDialogLibs->createLibraryLink( m_dialogName, m_dialogURL, bReadOnly ); + bDialogSuccess = xDialogLibs->hasByName(m_dialogName); } } - - if (bCanAdd) - { - xDialogLibs->createLibraryLink( m_dialogName, m_dialogURL, bReadOnly ); - bDialogSuccess = xDialogLibs->hasByName(m_dialogName); - } } bool bSuccess = bScript || bDialog; // Something must have happened if( bRunning ) diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx index 2d602a6d6507..ef980e1e994e 100644 --- a/desktop/win32/source/officeloader/officeloader.cxx +++ b/desktop/win32/source/officeloader/officeloader.cxx @@ -417,7 +417,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) CloseHandle( aProcessInfo.hThread ); } } while ( fSuccess - && ( ::desktop::ExitHelper::E_CRASH_WITH_RESTART == dwExitCode || ::desktop::ExitHelper::E_NORMAL_RESTART == dwExitCode ); + && ( ::desktop::ExitHelper::E_CRASH_WITH_RESTART == dwExitCode || ::desktop::ExitHelper::E_NORMAL_RESTART == dwExitCode )); delete[] lpCommandLine; return fSuccess ? dwExitCode : -1; -- cgit From d0a3afc82beed2c1d2e0035a0cc5d43bb6acf774 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Mon, 17 May 2010 10:40:52 +0200 Subject: jl152 #i77196# only restarting if a extension was added/removed, XextensionManager.getSupportedArguments: removed repository argument --- desktop/source/app/app.cxx | 10 ++------ desktop/source/deployment/gui/dp_gui_dialog2.cxx | 3 ++- .../deployment/manager/dp_extensionmanager.cxx | 30 ++++++++++------------ .../deployment/manager/dp_extensionmanager.hxx | 4 +-- desktop/source/deployment/manager/dp_manager.cxx | 24 +++++++++++------ desktop/source/deployment/manager/dp_manager.h | 6 ++--- desktop/source/deployment/misc/dp_misc.cxx | 15 +++++------ 7 files changed, 45 insertions(+), 47 deletions(-) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 3b0a1ea0dcf8..ebc0ab743125 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1399,11 +1399,9 @@ void Desktop::Main() // and process those extensions (has to be done before checking // the extension dependencies! SynchronizeExtensionRepositories(); - bool bAbort = CheckExtensionDependencies(); if ( bAbort ) return; - // First Start Wizard allowed ? if ( ! pCmdLineArgs->IsNoFirstStartWizard()) { @@ -1447,7 +1445,6 @@ void Desktop::Main() } SetSplashScreenProgress(50); - // Backing Component sal_Bool bCrashed = sal_False; sal_Bool bExistsRecoveryData = sal_False; @@ -1628,7 +1625,6 @@ void Desktop::Main() ::comphelper::ComponentContext aContext( xSMgr ); xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY ); - if ( !xRestartManager.is() || !xRestartManager->isRestartRequested( sal_True ) ) Execute(); } @@ -1654,22 +1650,20 @@ void Desktop::Main() } delete pResMgr; - // Restore old value if ( pCmdLineArgs->IsHeadless() ) SvtMiscOptions().SetUseSystemFileDialog( bUseSystemFileDialog ); // remove temp directory RemoveTemporaryDirectory(); - // The acceptors in the AcceptorMap must be released (in DeregisterServices) // with the solar mutex unlocked, to avoid deadlock: nAcquireCount = Application::ReleaseSolarMutex(); + printf("###1\n"); DeregisterServices(); + printf("###2\n"); Application::AcquireSolarMutex(nAcquireCount); - tools::DeInitTestToolLib(); - // be sure that path/language options gets destroyed before // UCB is deinitialized RTL_LOGFILE_CONTEXT_TRACE( aLog, "-> dispose path/language options" ); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 164bb833fd6d..086e39e5f18c 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -877,7 +877,8 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker() t_string2string title2filter; OUString sDefaultFilter( StrAllFiles::get() ); - const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes( m_pManager->getExtensionManager()->getSupportedPackageTypes( OUSTR("user") ) ); + const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes( + m_pManager->getExtensionManager()->getSupportedPackageTypes() ); for ( sal_Int32 pos = 0; pos < packageTypes.getLength(); ++pos ) { diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 83e68dff255e..edc414dc6f5d 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -402,16 +402,19 @@ Reference ExtensionManager::backupExtension( return xBackup; } +//The supported package types are actually determined by the registry. However +//creating a registry +//(desktop/source/deployment/registry/dp_registry.cxx:PackageRegistryImpl) will +//create all the backends, so that the registry can obtain from them the package +//types. Creating the registry will also set up the registry folder containing +//all the subfolders for the respective backends. +//Because all repositories support the same backends, we can just delegate this +//call to one of the repositories. uno::Sequence< Reference > -ExtensionManager::getSupportedPackageTypes(OUString const & repository) +ExtensionManager::getSupportedPackageTypes() throw (uno::RuntimeException) { - if (repository.equals(OUSTR("user"))) - return m_userRepository->getSupportedPackageTypes(); - else if (repository.equals(OUSTR("shared"))) - return m_sharedRepository->getSupportedPackageTypes(); - else - return uno::Sequence< Reference >(); + return m_userRepository->getSupportedPackageTypes(); } // Only add to shared and user repository @@ -437,7 +440,6 @@ Reference ExtensionManager::addExtension( throw lang::IllegalArgumentException( OUSTR("No valid repository name provided."), static_cast(this), 0); - ::osl::MutexGuard guard(getMutex()); Reference xTmpExtension = getTempExtension(url, xAbortChannel, xCmdEnv); @@ -448,7 +450,6 @@ Reference ExtensionManager::addExtension( dp_misc::DescriptionInfoset info(dp_misc::getDescriptionInfoset(xTmpExtension->getURL())); const ::boost::optional licenseAttributes = info.getSimpleLicenseAttributes(); - Reference xOldExtension; Reference xExtensionBackup; @@ -481,14 +482,12 @@ Reference ExtensionManager::addExtension( //the action. checkInstall(sDisplayName, xCmdEnv); } - //Prevent showing the license if requested. Reference _xCmdEnv(xCmdEnv); ExtensionProperties props(OUString(), properties, Reference()); if (licenseAttributes && licenseAttributes->suppressIfRequired && props.isSuppressedLicense()) _xCmdEnv = Reference(new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler())); - bCanInstall = xTmpExtension->checkPrerequisites( xAbortChannel, _xCmdEnv, xOldExtension.is()) == 0 ? true : false; } @@ -528,10 +527,8 @@ Reference ExtensionManager::addExtension( xOldExtension, Reference(), tmpCmdEnv); } - xNewExtension = xPackageManager->addPackage( url, properties, OUString(), xAbortChannel, xCmdEnv); - //If we add a user extension and there is already one which was //disabled by a user, then the newly installed one is enabled. If we //add to another repository then the user extension remains @@ -1023,7 +1020,7 @@ void ExtensionManager::reinstallDeployedExtensions( } } -void ExtensionManager::synchronize( +sal_Bool ExtensionManager::synchronize( OUString const & repository, Reference const & xAbortChannel, Reference const & xCmdEnv ) @@ -1035,6 +1032,7 @@ void ExtensionManager::synchronize( { try { + sal_Bool bModified = sal_False; Reference xPackageManager; OUString file; if (repository.equals(OUSTR("user"))) @@ -1065,7 +1063,7 @@ void ExtensionManager::synchronize( sSynchronizing.SearchAndReplaceAllAscii( "%NAME", repository ); dp_misc::ProgressLevel progress(xCmdEnv, sSynchronizing); - xPackageManager->synchronize(xAbortChannel, xCmdEnv); + bModified = xPackageManager->synchronize(xAbortChannel, xCmdEnv); try { const uno::Sequence > > @@ -1109,6 +1107,7 @@ void ExtensionManager::synchronize( static_cast(this), exc); } + return bModified; } catch (deploy::DeploymentException& ) { throw; } catch (ucb::CommandFailedException & ) { @@ -1202,7 +1201,6 @@ Reference ExtensionManager::getTempExtension( Reference tmpCmdEnvA(new TmpRepositoryCommandEnv()); Reference xTmpPackage = m_tmpRepository->addPackage( url, uno::Sequence(),OUString(), xAbortChannel, tmpCmdEnvA); - if (!xTmpPackage.is()) { throw deploy::DeploymentException( diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index e6c9ca3aa915..4367770945aa 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -78,7 +78,7 @@ public: //XExtensionManager virtual css::uno::Sequence< css::uno::Reference > SAL_CALL - getSupportedPackageTypes(::rtl::OUString const & repository) + getSupportedPackageTypes() throw (css::uno::RuntimeException); virtual css::uno::Reference SAL_CALL @@ -185,7 +185,7 @@ public: css::lang::IllegalArgumentException, css::uno::RuntimeException); - virtual void SAL_CALL synchronize( + virtual sal_Bool SAL_CALL synchronize( ::rtl::OUString const & repository, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ) diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 69b2baab8878..7844e11b0651 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -1245,7 +1245,7 @@ void PackageManagerImpl::reinstallDeployedPackages( { return m_readOnly; } -void PackageManagerImpl::synchronizeRemovedExtensions( +bool PackageManagerImpl::synchronizeRemovedExtensions( Reference const & xAbortChannel, Reference const & xCmdEnv) { @@ -1253,6 +1253,7 @@ void PackageManagerImpl::synchronizeRemovedExtensions( //find all which are in the extension data base but which //are removed already. OSL_ASSERT(!m_context.equals(OUSTR("user"))); + bool bModified = false; ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() ); typedef ActivePackages::Entries::const_iterator ITActive; @@ -1322,6 +1323,7 @@ void PackageManagerImpl::synchronizeRemovedExtensions( xPackage->revokePackage(xAbortChannel, xCmdEnv); removePackage(xPackage->getIdentifier().Value, xPackage->getName(), xAbortChannel, xCmdEnv); + bModified |= true; } } catch( uno::Exception & ) @@ -1329,14 +1331,15 @@ void PackageManagerImpl::synchronizeRemovedExtensions( OSL_ASSERT(0); } } + return bModified; } -void PackageManagerImpl::synchronizeAddedExtensions( +bool PackageManagerImpl::synchronizeAddedExtensions( Reference const & xAbortChannel, Reference const & xCmdEnv) { - // clean up activation layer, scan for zombie temp dirs: + bool bModified = false; ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() ); ::ucbhelper::Content tempFolder( @@ -1441,6 +1444,7 @@ void PackageManagerImpl::synchronizeAddedExtensions( //try to install the extension again. dbData.failedPrerequisites = OUString::valueOf(failedPrereq); insertToActivationLayerDB(id, dbData); + bModified |= true; } } } @@ -1449,9 +1453,10 @@ void PackageManagerImpl::synchronizeAddedExtensions( OSL_ASSERT(0); } } + return bModified; } -void PackageManagerImpl::synchronize( +sal_Bool PackageManagerImpl::synchronize( Reference const & xAbortChannel, Reference const & xCmdEnv) throw (css::deployment::DeploymentException, @@ -1459,12 +1464,15 @@ void PackageManagerImpl::synchronize( css::ucb::CommandAbortedException, css::uno::RuntimeException) { - check(); + bool bModified = false; if (m_context.equals(OUSTR("user"))) - return; - synchronizeRemovedExtensions(xAbortChannel, xCmdEnv); - synchronizeAddedExtensions(xAbortChannel, xCmdEnv); + return bModified; + bModified |= + synchronizeRemovedExtensions(xAbortChannel, xCmdEnv); + bModified |= synchronizeAddedExtensions(xAbortChannel, xCmdEnv); + + return bModified; } Sequence< Reference > PackageManagerImpl::getExtensionsWithUnacceptedLicenses( diff --git a/desktop/source/deployment/manager/dp_manager.h b/desktop/source/deployment/manager/dp_manager.h index 2e13c56ae968..8fe0f662011b 100644 --- a/desktop/source/deployment/manager/dp_manager.h +++ b/desktop/source/deployment/manager/dp_manager.h @@ -89,11 +89,11 @@ class PackageManagerImpl : private ::dp_misc::MutexHolder, public t_pm_helper bool isInstalled( css::uno::Reference const & package); - void synchronizeRemovedExtensions( + bool synchronizeRemovedExtensions( css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv); - void synchronizeAddedExtensions( + bool synchronizeAddedExtensions( css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv); @@ -246,7 +246,7 @@ public: virtual ::sal_Bool SAL_CALL isReadOnly( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL synchronize( + virtual ::sal_Bool SAL_CALL synchronize( css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ) throw (css::deployment::DeploymentException, diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index b68593c7f174..5ccc3d7225d4 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -602,7 +602,7 @@ void syncRepositories(Reference const & xCmdEnv) Reference xExtensionManager; //synchronize shared before bundled otherewise there are //more revoke and registration calls. - bool bSynced = false; + bool bModified = false; const OUString sShared(RTL_CONSTASCII_USTRINGPARAM("shared")); if (needToSyncRepostitory(sShared)) { @@ -612,9 +612,8 @@ void syncRepositories(Reference const & xCmdEnv) if (xExtensionManager.is()) { - xExtensionManager->synchronize( + bModified = xExtensionManager->synchronize( sShared, Reference(), xCmdEnv); - bSynced = true; } } @@ -629,24 +628,22 @@ void syncRepositories(Reference const & xCmdEnv) } if (xExtensionManager.is()) { - xExtensionManager->synchronize( + bModified |= xExtensionManager->synchronize( sBundled, Reference(), xCmdEnv); - bSynced = true; } } - if (bSynced) + if (bModified) { Reference restarter( comphelper_getProcessComponentContext()->getValueByName( OUSTR( "/singletons/com.sun.star.task.OfficeRestartManager") ), UNO_QUERY ); if (restarter.is()) { - fprintf(stdout, "\nrestarting\n"); restarter->requestRestart(xCmdEnv.is() == sal_True ? xCmdEnv->getInteractionHandler() : Reference()); - } - } + } + } } -- cgit From 885511f9be6f9e437687216affc1fb5c7d99054b Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Mon, 17 May 2010 16:42:05 +0200 Subject: jl152 #i77196# office hangs in smoketest when it is about to restart itself --- desktop/source/deployment/misc/dp_misc.cxx | 2 +- desktop/source/offacc/acceptor.cxx | 6 ++++++ desktop/source/offacc/acceptor.hxx | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 5ccc3d7225d4..3867f741f982 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -602,7 +602,7 @@ void syncRepositories(Reference const & xCmdEnv) Reference xExtensionManager; //synchronize shared before bundled otherewise there are //more revoke and registration calls. - bool bModified = false; + sal_Bool bModified = false; const OUString sShared(RTL_CONSTASCII_USTRINGPARAM("shared")); if (needToSyncRepostitory(sShared)) { diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx index 4eee12f5949a..4e100fd99665 100644 --- a/desktop/source/offacc/acceptor.cxx +++ b/desktop/source/offacc/acceptor.cxx @@ -67,6 +67,7 @@ Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory ) , m_aConnectString() , m_aProtocol() , m_bInit(sal_False) + , m_bDying(false) { m_rSMgr = rFactory; m_rAcceptor = Reference< XAcceptor > (m_rSMgr->createInstance( @@ -88,6 +89,9 @@ Acceptor::~Acceptor() osl::MutexGuard g(m_aMutex); t = m_thread; } + //prevent locking if the thread is still waiting + m_bDying = true; + m_cEnable.set(); osl_joinWithThread(t); { // Make the final state of m_bridges visible to this thread (since @@ -117,6 +121,8 @@ void SAL_CALL Acceptor::run() RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109)"\ "Acceptor::run waiting for office to come up"); m_cEnable.wait(); + if (m_bDying) //see destructor + break; RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109)"\ "Acceptor::run now enabled and continuing"); diff --git a/desktop/source/offacc/acceptor.hxx b/desktop/source/offacc/acceptor.hxx index 1693dd8b75d0..87f50db032dd 100644 --- a/desktop/source/offacc/acceptor.hxx +++ b/desktop/source/offacc/acceptor.hxx @@ -83,6 +83,7 @@ private: OUString m_aProtocol; sal_Bool m_bInit; + bool m_bDying; public: Acceptor( const Reference< XMultiServiceFactory >& aFactory ); -- cgit From eef1fd8ab2966ee3b2934d9050b0a14c4478e1f6 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Tue, 18 May 2010 14:59:37 +0200 Subject: jl152 #i77196# smoketest now uses new extension manager service --- desktop/source/app/app.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index ebc0ab743125..5e0460891c30 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1659,9 +1659,7 @@ void Desktop::Main() // The acceptors in the AcceptorMap must be released (in DeregisterServices) // with the solar mutex unlocked, to avoid deadlock: nAcquireCount = Application::ReleaseSolarMutex(); - printf("###1\n"); DeregisterServices(); - printf("###2\n"); Application::AcquireSolarMutex(nAcquireCount); tools::DeInitTestToolLib(); // be sure that path/language options gets destroyed before -- cgit From e6d9970ba08599dfaf13998b9cc0908554f00176 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Tue, 18 May 2010 15:50:04 +0200 Subject: jl152 #i77196# adapted migration code to use new extension manager, removed old unused migration code, adapted ooo improvement dialog to appear after third start, taking into account the restarting after extension installation --- desktop/prj/build.lst | 3 +- desktop/source/deployment/dp_services.cxx | 6 - desktop/source/deployment/makefile.mk | 1 - .../source/deployment/migration/dp_migration.cxx | 251 ---------- desktop/source/deployment/migration/makefile.mk | 41 -- desktop/source/migration/services/cexports.cxx | 12 +- .../migration/services/extensionmigration.cxx | 540 --------------------- .../migration/services/extensionmigration.hxx | 130 ----- desktop/source/migration/services/makefile.mk | 2 - .../migration/services/oo3extensionmigration.cxx | 33 +- .../migration/services/oo3extensionmigration.hxx | 8 +- .../openoffice/Office/OOoImprovement/Settings.xcs | 2 +- 12 files changed, 28 insertions(+), 1001 deletions(-) delete mode 100644 desktop/source/deployment/migration/dp_migration.cxx delete mode 100644 desktop/source/deployment/migration/makefile.mk delete mode 100755 desktop/source/migration/services/extensionmigration.cxx delete mode 100755 desktop/source/migration/services/extensionmigration.hxx diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst index 6f611926a0df..8029b6ecc9f7 100644 --- a/desktop/prj/build.lst +++ b/desktop/prj/build.lst @@ -21,10 +21,9 @@ dt desktop\os2\source\applauncher nmake - p dt_applauncher dt_inc NULL dt desktop\unx\source\officeloader nmake - u dt_officeloader_unx dt_inc NULL dt desktop\source\pagein nmake - u dt_pagein dt_inc NULL dt desktop\source\pkgchk\unopkg nmake - all dt_unopkg dt_dp_misc dt_app dt_inc dt_guiloader.w NULL -dt desktop\source\deployment nmake - all dt_deployment dt_dp_manager dt_dp_registry dt_dp_registry_package dt_dp_registry_executable dt_dp_registry_help dt_dp_registry_script dt_dp_registry_sfwk dt_dp_registry_component dt_dp_registry_configuration dt_dp_migration dt_dp_unopkg dt_inc dt_dp_misc NULL +dt desktop\source\deployment nmake - all dt_deployment dt_dp_manager dt_dp_registry dt_dp_registry_package dt_dp_registry_executable dt_dp_registry_help dt_dp_registry_script dt_dp_registry_sfwk dt_dp_registry_component dt_dp_registry_configuration dt_dp_unopkg dt_inc dt_dp_misc NULL dt desktop\source\deployment\misc nmake - all dt_dp_misc dt_inc NULL dt desktop\source\deployment\unopkg nmake - all dt_dp_unopkg dt_inc NULL -dt desktop\source\deployment\migration nmake - all dt_dp_migration dt_inc NULL dt desktop\source\deployment\gui nmake - all dt_dp_gui dt_dp_misc dt_inc NULL dt desktop\source\deployment\manager nmake - all dt_dp_manager dt_inc NULL dt desktop\source\deployment\registry nmake - all dt_dp_registry dt_inc NULL diff --git a/desktop/source/deployment/dp_services.cxx b/desktop/source/deployment/dp_services.cxx index 05b9a2a1971a..f7ebf66355ba 100644 --- a/desktop/source/deployment/dp_services.cxx +++ b/desktop/source/deployment/dp_services.cxx @@ -77,10 +77,6 @@ namespace dp_log { extern sdecl::ServiceDecl const serviceDecl; } -namespace dp_migration { -extern sdecl::ServiceDecl const serviceDecl; -} - namespace dp_info { extern sdecl::ServiceDecl const serviceDecl; bool singleton_entries( uno::Reference const& ); @@ -110,7 +106,6 @@ sal_Bool SAL_CALL component_writeInfo( dp_registry::backend::executable::serviceDecl, dp_manager::factory::serviceDecl, dp_log::serviceDecl, - dp_migration::serviceDecl, dp_info::serviceDecl, dp_manager::serviceDecl) && dp_manager::factory::singleton_entries( pRegistryKey ) && @@ -133,7 +128,6 @@ void * SAL_CALL component_getFactory( dp_registry::backend::executable::serviceDecl, dp_manager::factory::serviceDecl, dp_log::serviceDecl, - dp_migration::serviceDecl, dp_info::serviceDecl, dp_manager::serviceDecl); } diff --git a/desktop/source/deployment/makefile.mk b/desktop/source/deployment/makefile.mk index 173ff35bec1d..6d83a5c1004b 100644 --- a/desktop/source/deployment/makefile.mk +++ b/desktop/source/deployment/makefile.mk @@ -53,7 +53,6 @@ SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1LIBS = \ $(SLB)$/deployment_manager.lib \ - $(SLB)$/deployment_migration.lib \ $(SLB)$/deployment_registry.lib \ $(SLB)$/deployment_registry_executable.lib \ $(SLB)$/deployment_registry_component.lib \ diff --git a/desktop/source/deployment/migration/dp_migration.cxx b/desktop/source/deployment/migration/dp_migration.cxx deleted file mode 100644 index c2d0b0dc6bb8..000000000000 --- a/desktop/source/deployment/migration/dp_migration.cxx +++ /dev/null @@ -1,251 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_desktop.hxx" - -#include "dp_misc.h" -#include "dp_ucb.h" -#include "cppuhelper/implbase1.hxx" -#include "cppuhelper/implbase2.hxx" -#include "cppuhelper/exc_hlp.hxx" -#include "ucbhelper/content.hxx" -#include "comphelper/anytostring.hxx" -#include "comphelper/servicedecl.hxx" -#include "com/sun/star/lang/WrappedTargetException.hpp" -#include "com/sun/star/task/XJob.hpp" -#include "com/sun/star/task/XInteractionAbort.hpp" -#include "com/sun/star/task/XInteractionApprove.hpp" -#include "com/sun/star/sdbc/XResultSet.hpp" -#include "com/sun/star/sdbc/XRow.hpp" -#include "com/sun/star/ucb/XContentAccess.hpp" -#include "com/sun/star/deployment/thePackageManagerFactory.hpp" - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::uno; -using namespace ::dp_misc; -using ::rtl::OUString; - -namespace dp_migration { - -class MigrationImpl : public ::cppu::WeakImplHelper1 -{ - struct CommandEnvironmentImpl - : public ::cppu::WeakImplHelper2< XCommandEnvironment, - task::XInteractionHandler > - { - // XCommandEnvironment - virtual Reference SAL_CALL - getInteractionHandler() throw (RuntimeException); - virtual Reference SAL_CALL getProgressHandler() - throw (RuntimeException); - // XInteractionHandler - virtual void SAL_CALL handle( - Reference const & xRequest ) - throw (RuntimeException); - }; - - const Reference m_xContext; - OUString m_userData; - -protected: - virtual ~MigrationImpl(); -public: - MigrationImpl( Sequence const & args, - Reference const & xComponentContext ); - - // XJob - virtual Any SAL_CALL execute( Sequence const & args ) - throw (lang::IllegalArgumentException, Exception, RuntimeException); -}; - -MigrationImpl::~MigrationImpl() -{ -} - -MigrationImpl::MigrationImpl( - Sequence const & args, Reference const & xContext ) - : m_xContext(xContext) -{ - for ( sal_Int32 pos = args.getLength(); pos--; ) - { - const beans::NamedValue nv(args[pos].get()); - if (nv.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("UserData") )) - m_userData = nv.Value.get(); - } - if (m_userData.getLength() == 0) - throw lang::IllegalArgumentException( OUSTR("missing UserData!"), 0, - static_cast(-1) ); -} - -// XJob -Any MigrationImpl::execute( Sequence const & ) - throw (lang::IllegalArgumentException, Exception, RuntimeException) -{ - const Reference xManager( - deployment::thePackageManagerFactory::get( - m_xContext )->getPackageManager( OUSTR("user") ) ); - ::ucbhelper::Content packagesDir; - if (create_ucb_content( &packagesDir, - makeURL( m_userData, OUSTR("user/uno_packages") ), - Reference(), - false /* no throw */ )) - { - const Reference xCmdEnv( - new CommandEnvironmentImpl ); - OUString const & strTitle = StrTitle::get(); - const Reference xResultSet( - packagesDir.createCursor( Sequence( &strTitle, 1 ), - ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) ); - while (xResultSet->next()) - { - Reference xRow( xResultSet, UNO_QUERY_THROW ); - const OUString title( xRow->getString( 1 /* Title */ ) ); - // exclude stampIt, not migratable to OOo 2.0: - if (title.matchIgnoreAsciiCaseAsciiL( - RTL_CONSTASCII_STRINGPARAM("SSICONCT.") )) - continue; - const OUString sourceURL( Reference( - xResultSet, UNO_QUERY_THROW ) - ->queryContentIdentifierString() ); - try { - xManager->addPackage( - sourceURL, uno::Sequence(),OUString() /* detect media-type */, - Reference(), xCmdEnv ); - } - catch (RuntimeException &) { - throw; - } - catch (Exception &) { - OSL_ENSURE( 0, ::rtl::OUStringToOString( - ::comphelper::anyToString( - ::cppu::getCaughtException() ), - RTL_TEXTENCODING_UTF8 ).getStr() ); - } - } - } - return Any(); -} - -// XCommandEnvironment -Reference -MigrationImpl::CommandEnvironmentImpl::getInteractionHandler() - throw (RuntimeException) -{ - return this; -} - -Reference -MigrationImpl::CommandEnvironmentImpl::getProgressHandler() - throw (RuntimeException) -{ - return Reference(); -} - -// XInteractionHandler -void MigrationImpl::CommandEnvironmentImpl::handle( - Reference const & xRequest ) - throw (RuntimeException) -{ - Any request( xRequest->getRequest() ); - OSL_ASSERT( request.getValueTypeClass() == TypeClass_EXCEPTION ); -#if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "[dp_migration.cxx] incoming request:\n%s\n", - ::rtl::OUStringToOString( ::comphelper::anyToString(request), - RTL_TEXTENCODING_UTF8 ).getStr() ); -#endif - - // selections: - bool approve = false; - bool abort = false; - - lang::WrappedTargetException wtExc; - if (request >>= wtExc) { - OSL_ENSURE( 0, ::rtl::OUStringToOString( - ::comphelper::anyToString(wtExc.TargetException), - RTL_TEXTENCODING_UTF8 ).getStr() ); - - // ignore intermediate errors of legacy packages, i.e. - // former pkgchk behaviour: - const Reference xPackage( - wtExc.Context, UNO_QUERY ); - OSL_ASSERT( xPackage.is() ); - if (xPackage.is()) { - const Reference xPackageType( - xPackage->getPackageType() ); - OSL_ASSERT( xPackageType.is() ); - if (xPackageType.is()) { - approve = (xPackage->isBundle() && - xPackageType->getMediaType().matchAsciiL( - RTL_CONSTASCII_STRINGPARAM( - "application/" - "vnd.sun.star.legacy-package-bundle") )); - } - } - abort = !approve; - } - else - return; // unknown request => no selection at all - - // select: - const Sequence< Reference > conts( - xRequest->getContinuations() ); - for ( sal_Int32 pos = 0; pos < conts.getLength(); ++pos ) - { - if (approve) { - const Reference xInteractionApprove( - conts[ pos ], UNO_QUERY ); - if (xInteractionApprove.is()) { - xInteractionApprove->select(); - // don't query again for ongoing continuations: - approve = false; - } - } - else if (abort) { - const Reference xInteractionAbort( - conts[ pos ], UNO_QUERY ); - if (xInteractionAbort.is()) { - xInteractionAbort->select(); - // don't query again for ongoing continuations: - abort = false; - } - } - } -} - -namespace sdecl = comphelper::service_decl; -sdecl::class_ > serviceMI; -extern sdecl::ServiceDecl const serviceDecl( - serviceMI, - // a private one (config entry): - "com.sun.star.comp.deployment.migration.Migration_2_0", - "com.sun.star.comp.deployment.migration.Migration_2_0" ); - -} // namespace dp_migration - diff --git a/desktop/source/deployment/migration/makefile.mk b/desktop/source/deployment/migration/makefile.mk deleted file mode 100644 index a37b7e5bebf8..000000000000 --- a/desktop/source/deployment/migration/makefile.mk +++ /dev/null @@ -1,41 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ = ..$/..$/.. - -PRJNAME = desktop -TARGET = deployment_migration -ENABLE_EXCEPTIONS = TRUE - -.INCLUDE : settings.mk - -SLOFILES = \ - $(SLO)$/dp_migration.obj - -.INCLUDE : ..$/target.pmk -.INCLUDE : target.mk - diff --git a/desktop/source/migration/services/cexports.cxx b/desktop/source/migration/services/cexports.cxx index c1971e9d4d00..cf9a9ab30b0c 100644 --- a/desktop/source/migration/services/cexports.cxx +++ b/desktop/source/migration/services/cexports.cxx @@ -31,7 +31,7 @@ #include "cppuhelper/implementationentry.hxx" #include "basicmigration.hxx" #include "wordbookmigration.hxx" -#include "extensionmigration.hxx" +//#include "extensionmigration.hxx" extern "C" { @@ -48,11 +48,11 @@ extern "C" migration::WordbookMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, 0, 0 }, - { - migration::ExtensionMigration_create, migration::ExtensionMigration_getImplementationName, - migration::ExtensionMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, - 0, 0 - }, +// { +// migration::ExtensionMigration_create, migration::ExtensionMigration_getImplementationName, +// migration::ExtensionMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, +// 0, 0 +// }, { 0, 0, 0, 0, 0, 0 } }; diff --git a/desktop/source/migration/services/extensionmigration.cxx b/desktop/source/migration/services/extensionmigration.cxx deleted file mode 100755 index 66f32744a782..000000000000 --- a/desktop/source/migration/services/extensionmigration.cxx +++ /dev/null @@ -1,540 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_desktop.hxx" -#include "extensionmigration.hxx" -#include -#include -#include -#include -#include -#include -#include -#include "comphelper/processfactory.hxx" -#include "com/sun/star/deployment/XPackageManagerFactory.hpp" -#include "com/sun/star/ucb/XCommandEnvironment.hpp" -#include "com/sun/star/xml/sax/XParser.hpp" -#include "rtl/instance.hxx" -#include "osl/file.hxx" -#include "osl/thread.h" - -#include "xmlscript/xmllib_imexp.hxx" -#include "../../deployment/inc/dp_ucb.h" - -#ifdef SYSTEM_DB -#include -#else -#include -#endif - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -namespace { - - struct LibDescriptor : - public rtl::StaticWithInit { - const ::xmlscript::LibDescriptorArray operator () () { - - - return ::xmlscript::LibDescriptorArray(); - } -}; -} -//......................................................................... -namespace migration -{ -//......................................................................... - - - static ::rtl::OUString sExtensionSubDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/uno_packages/" ) ); - static ::rtl::OUString sSubDirName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cache" ) ); - static ::rtl::OUString sConfigDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data" ) ); - static ::rtl::OUString sOrgDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org" ) ); - static ::rtl::OUString sExcludeDir1 = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org" ) ); - static ::rtl::OUString sExcludeDir2 = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org/openoffice" ) ); - - static ::rtl::OUString sBasicType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.basic-library")); - static ::rtl::OUString sDialogType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.dialog-library")); - - static ::rtl::OUString sConfigurationDataType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.configuration-data")); - static ::rtl::OUString sConfigurationSchemaType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.configuration-schema")); - - // ============================================================================= - // component operations - // ============================================================================= - - ::rtl::OUString ExtensionMigration_getImplementationName() - { - static ::rtl::OUString* pImplName = 0; - if ( !pImplName ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pImplName ) - { - static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.desktop.migration.Extensions" ) ); - pImplName = &aImplName; - } - } - return *pImplName; - } - - // ----------------------------------------------------------------------------- - - Sequence< ::rtl::OUString > ExtensionMigration_getSupportedServiceNames() - { - static Sequence< ::rtl::OUString >* pNames = 0; - if ( !pNames ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pNames ) - { - static Sequence< ::rtl::OUString > aNames(1); - aNames.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.migration.Extensions" ) ); - pNames = &aNames; - } - } - return *pNames; - } - - // ============================================================================= - // ExtensionMigration - // ============================================================================= - - ExtensionMigration::ExtensionMigration(Reference< XComponentContext > const & ctx) : - m_ctx(ctx) - { - } - - // ----------------------------------------------------------------------------- - - ExtensionMigration::~ExtensionMigration() - { - } - - ::osl::FileBase::RC ExtensionMigration::checkAndCreateDirectory( INetURLObject& rDirURL ) - { - ::osl::FileBase::RC aResult = ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - if ( aResult == ::osl::FileBase::E_NOENT ) - { - INetURLObject aBaseURL( rDirURL ); - aBaseURL.removeSegment(); - checkAndCreateDirectory( aBaseURL ); - return ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - } - else - { - return aResult; - } - } - - void ExtensionMigration::prepareBasicLibs() - { - prepareBasicLibs(m_sSourceDir + ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("/user/basic/script.xlc")), m_scriptElements); - prepareBasicLibs(m_sSourceDir + ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("/user/basic/dialog.xlc")), m_dialogElements); - } - - void ExtensionMigration::prepareBasicLibs(const ::rtl::OUString & sURL, - ::xmlscript::LibDescriptorArray & out_elements) - { - - ::ucbhelper::Content ucb_content; - if (dp_misc::create_ucb_content( &ucb_content, sURL, - uno::Reference< ucb::XCommandEnvironment>(), false /* no throw */ )) - { - uno::Reference xParser( - m_ctx->getServiceManager()->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")), - m_ctx ), UNO_QUERY_THROW ); - - xParser->setDocumentHandler( ::xmlscript::importLibraryContainer( &out_elements ) ); - xml::sax::InputSource source; - source.aInputStream = ucb_content.openStream(); - source.sSystemId = ucb_content.getURL(); - xParser->parseStream( source ); - } - //else - //The file need not exists - } - /* Checks if basic package is enabled in StarOffice 8. This is the case when the dialog.xlc or - the script.xlc in the user installation contains an entry for this package. - The passed package MUST be a basic package. - */ - bool ExtensionMigration::isBasicPackageEnabled( const uno::Reference< deployment::XPackage > & xPkg) - { - ::rtl::OUString sScriptURL = xPkg->getURL(); - if ( sScriptURL[ sScriptURL.getLength()-1 ] != '/' ) - sScriptURL += ::rtl::OUString::createFromAscii("/"); - sScriptURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("script.xlb") ); - - bool bEntryFound = false; - for ( sal_Int32 nPos = m_scriptElements.mnLibCount; nPos--; ) - { - ::xmlscript::LibDescriptor const & descr = - m_scriptElements.mpLibs[ nPos ]; - - if (descr.aStorageURL.equals(sScriptURL)) - { - bEntryFound = true; - break; - } - } - - ::rtl::OUString sDialogURL = xPkg->getURL(); - if ( sDialogURL[ sDialogURL.getLength()-1 ] != '/' ) - sDialogURL += ::rtl::OUString::createFromAscii("/"); - sScriptURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("dialog.xlb") ); - - if (!bEntryFound) - { - for ( sal_Int32 nPos = m_dialogElements.mnLibCount; nPos--; ) - { - ::xmlscript::LibDescriptor const & descr = - m_dialogElements.mpLibs[ nPos ]; - - if (descr.aStorageURL.equals(sDialogURL)) - { - bEntryFound = true; - break; - } - } - } - return bEntryFound; - } - /* This function only registers basic and dialog packages. - */ - void ExtensionMigration::registerBasicPackage( const uno::Reference< deployment::XPackage > & xPkg) - { - const ::rtl::OUString sMediaType = xPkg->getPackageType()->getMediaType(); - if ( (sMediaType.equals(sBasicType) || sMediaType.equals(sDialogType)) - && isBasicPackageEnabled(xPkg)) - { - xPkg->registerPackage(false, uno::Reference< task::XAbortChannel >(), - uno::Reference< ucb::XCommandEnvironment> ()); - } - } - - bool ExtensionMigration::processExtensions( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ) - { - if (!copy(sSourceDir, sTargetDir)) - return false; - - // Find all basic and script packages and reregister them - uno::Reference< deployment::XPackageManagerFactory > xPMF; - if (! ( m_ctx->getValueByName( ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.deployment.thePackageManagerFactory"))) - >>= xPMF)) - throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "ExtensionsMigration: could not get thePackageManagerFactory")), 0); - - const uno::Reference< deployment::XPackageManager > xPackageMgr = - xPMF->getPackageManager(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"))); - - if (!xPackageMgr.is()) - throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "ExtensionsMigration: could not get XPackageManager")), 0); - - const uno::Sequence< uno::Reference< deployment::XPackage > > allPackages = - xPackageMgr->getDeployedPackages( - uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - - for (int i = 0; i < allPackages.getLength(); i ++) - { - const uno::Reference< deployment::XPackage > aPackage = allPackages[i]; - if ( aPackage->isBundle() ) - { - const uno::Sequence< uno::Reference < deployment::XPackage > > seqPkg = - aPackage->getBundle( - uno::Reference< task::XAbortChannel >(), - uno::Reference< ucb::XCommandEnvironment> ()); - - for ( int k = 0; k < seqPkg.getLength(); k++ ) - registerBasicPackage(seqPkg[k]); - - for (int l = 0; l < seqPkg.getLength(); l++) - { - const ::rtl::OUString sMediaType = seqPkg[l]->getPackageType()->getMediaType(); - beans::Optional > opt = - seqPkg[l]->isRegistered(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - bool bRegistered = opt.IsPresent && opt.Value.IsAmbiguous == sal_False && opt.Value.Value == sal_True ? true : false; - - if ( bRegistered && !sMediaType.equals(sBasicType) && !sMediaType.equals(sDialogType) ) - { - seqPkg[l]->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - seqPkg[l]->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - } - } - } - else - { - registerBasicPackage(aPackage); - { - aPackage->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - aPackage->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - } - } - } - - - return true; - - } - -bool ExtensionMigration::isCompatibleBerkleyDb(const ::rtl::OUString& sSourceDir) -{ - try - { - ::rtl::OUString sDb(sSourceDir + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "/uno_packages.db"))); - //check if the db exist at all. If not then the call to db_create would create - //the file. - ::osl::File f(sDb); - if (::osl::File::E_None != f.open(OpenFlag_Read)) - { - f.close(); - return false; - } - f.close(); - - //create a system path - ::rtl::OUString sSysPath; - if (::osl::File::getSystemPathFromFileURL(sDb, sSysPath ) != ::osl::File::E_None) - return false; - - ::rtl::OString cstr_sysPath( - ::rtl::OUStringToOString( sSysPath, osl_getThreadTextEncoding() ) ); - char const * pcstr_sysPath = cstr_sysPath.getStr(); - - //Open the db. If it works then we assume that the file was written with a - //compatible version of Berkeley Db - DB* pDB = NULL; - //using DB_RDONLY will return an "Invalid argument" error. - //DB_CREATE: only creates the file if it does not exist. - //An existing db is not modified. - if (0 != db_create(& pDB, 0, DB_CREATE)) - return false; - - if (0 != pDB->open(pDB, 0, pcstr_sysPath , 0, DB_HASH, DB_RDONLY, 0664 /* fs mode */)) - return false; - - pDB->close(pDB, 0); - } - catch (uno::Exception& ) - { - return false; - } - - return true; -} - -bool ExtensionMigration::copy( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ) -{ - bool bRet = false; - if (! isCompatibleBerkleyDb(sSourceDir)) - return false; - - INetURLObject aSourceObj( sSourceDir ); - INetURLObject aDestObj( sTargetDir ); - String aName = aDestObj.getName(); - aDestObj.removeSegment(); - aDestObj.setFinalSlash(); - - try - { - ::ucbhelper::Content aDestPath( aDestObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); - uno::Reference< ucb::XCommandInfo > xInfo = aDestPath.getCommands(); - ::rtl::OUString aTransferName = ::rtl::OUString::createFromAscii( "transfer" ); - if ( xInfo->hasCommandByName( aTransferName ) ) - { - aDestPath.executeCommand( aTransferName, uno::makeAny( - ucb::TransferInfo( sal_False, aSourceObj.GetMainURL( INetURLObject::NO_DECODE ), aName, ucb::NameClash::OVERWRITE ) ) ); - bRet = true; - } - } - catch( uno::Exception& ) - { - } - - return bRet; -} - - - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - - ::rtl::OUString ExtensionMigration::getImplementationName() throw (RuntimeException) - { - return ExtensionMigration_getImplementationName(); - } - - // ----------------------------------------------------------------------------- - - sal_Bool ExtensionMigration::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; - } - - // ----------------------------------------------------------------------------- - - Sequence< ::rtl::OUString > ExtensionMigration::getSupportedServiceNames() throw (RuntimeException) - { - return ExtensionMigration_getSupportedServiceNames(); - } - - // ----------------------------------------------------------------------------- - // XInitialization - // ----------------------------------------------------------------------------- - - void ExtensionMigration::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - const Any* pIter = aArguments.getConstArray(); - const Any* pEnd = pIter + aArguments.getLength(); - for ( ; pIter != pEnd ; ++pIter ) - { - beans::NamedValue aValue; - *pIter >>= aValue; - if ( aValue.Name.equalsAscii( "UserData" ) ) - { - if ( !(aValue.Value >>= m_sSourceDir) ) - { - OSL_ENSURE( false, "ExtensionMigration::initialize: argument UserData has wrong type!" ); - } - break; - } - } - prepareBasicLibs(); - } - - TStringVectorPtr getContent( const ::rtl::OUString& rBaseURL ) - { - TStringVectorPtr aResult( new TStringVector ); - ::osl::Directory aDir( rBaseURL); - if ( aDir.open() == ::osl::FileBase::E_None ) - { - // iterate over directory content - TStringVector aSubDirs; - ::osl::DirectoryItem aItem; - while ( aDir.getNextItem( aItem ) == ::osl::FileBase::E_None ) - { - ::osl::FileStatus aFileStatus( FileStatusMask_Type | FileStatusMask_FileURL ); - if ( aItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None ) - aResult->push_back( aFileStatus.getFileURL() ); - } - } - - return aResult; - } - - // ----------------------------------------------------------------------------- - // XJob - // ----------------------------------------------------------------------------- - -void ExtensionMigration::copyConfig( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ) -{ - ::rtl::OUString sEx1( m_sSourceDir ); - sEx1 += sExcludeDir1; - ::rtl::OUString sEx2( m_sSourceDir ); - sEx2 += sExcludeDir2; - - TStringVectorPtr aList = getContent( sSourceDir ); - TStringVector::const_iterator aI = aList->begin(); - while ( aI != aList->end() ) - { - ::rtl::OUString sSourceLocalName = aI->copy( sSourceDir.getLength() ); - ::rtl::OUString aTemp = aI->copy( m_sSourceDir.getLength() ); - if ( aTemp != sExcludeDir1 && aTemp != sExcludeDir2 ) - { - ::rtl::OUString sTargetName = sTargetDir + sSourceLocalName; - copy( (*aI), sTargetName ); - } - ++aI; - } -} - - Any ExtensionMigration::execute( const Sequence< beans::NamedValue >& ) - throw (lang::IllegalArgumentException, Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - ::utl::Bootstrap::PathStatus aStatus = ::utl::Bootstrap::locateUserInstallation( m_sTargetDir ); - if ( aStatus == ::utl::Bootstrap::PATH_EXISTS ) - { - // copy all extensions - ::rtl::OUString sTargetDir(m_sTargetDir), sSourceDir( m_sSourceDir ); - sTargetDir += sExtensionSubDir; - sSourceDir += sExtensionSubDir; - sSourceDir += sSubDirName; - sTargetDir += sSubDirName; - processExtensions( sSourceDir, sTargetDir ); - - // copy all user config settings in user/registry/data (except user/registry/data/org) - sSourceDir = m_sSourceDir; - sSourceDir += sConfigDir; - sTargetDir = m_sTargetDir; - sTargetDir += sConfigDir; - copyConfig( sSourceDir, sTargetDir ); - - // copy all user config settings in user/registry/data/org (except user/registry/data/org/openoffice) - sSourceDir = m_sSourceDir; - sSourceDir += sOrgDir; - sTargetDir = m_sTargetDir; - sTargetDir += sOrgDir; - copyConfig( sSourceDir, sTargetDir ); - } - - return Any(); - } - - // ============================================================================= - // component operations - // ============================================================================= - - Reference< XInterface > SAL_CALL ExtensionMigration_create( - Reference< XComponentContext > const & ctx ) - SAL_THROW( () ) - { - return static_cast< lang::XTypeProvider * >( new ExtensionMigration( - ctx) ); - } - - // ----------------------------------------------------------------------------- - -//......................................................................... -} // namespace migration -//......................................................................... diff --git a/desktop/source/migration/services/extensionmigration.hxx b/desktop/source/migration/services/extensionmigration.hxx deleted file mode 100755 index 70f6a4c44c9b..000000000000 --- a/desktop/source/migration/services/extensionmigration.hxx +++ /dev/null @@ -1,130 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DESKTOP_EXTENSIONMIGRATION_HXX_ -#define _DESKTOP_EXTENSIONMIGRATION_HXX_ - -#include "misc.hxx" -#include -#include -#include -#include -#include -#include -#include "xmlscript/xmllib_imexp.hxx" - -namespace com { namespace sun { namespace star { - namespace uno { - class XComponentContext; - } - namespace deployment { - class XPackage; - } -}}} - - - -class INetURLObject; - - -//......................................................................... -namespace migration -{ -//......................................................................... - - ::rtl::OUString SAL_CALL ExtensionMigration_getImplementationName(); - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ExtensionMigration_getSupportedServiceNames(); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ExtensionMigration_create( - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext ) - SAL_THROW( (::com::sun::star::uno::Exception) ); - - - // ============================================================================= - // class ExtensionMigration - // ============================================================================= - - typedef ::cppu::WeakImplHelper3< - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::lang::XInitialization, - ::com::sun::star::task::XJob > ExtensionMigration_BASE; - - class ExtensionMigration : public ExtensionMigration_BASE - { - private: - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_ctx; - ::osl::Mutex m_aMutex; - ::rtl::OUString m_sSourceDir; - ::rtl::OUString m_sTargetDir; - - ::xmlscript::LibDescriptorArray m_scriptElements; - ::xmlscript::LibDescriptorArray m_dialogElements; - - ::osl::FileBase::RC checkAndCreateDirectory( INetURLObject& rDirURL ); - void copyConfig( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ); - bool isCompatibleBerkleyDb(const ::rtl::OUString& sSourceDir); - bool copy( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ); - bool processExtensions( const ::rtl::OUString& sSourceDir, - const ::rtl::OUString& sTargetDir ); - /* fills m_scriptElements and m_dialogElements - */ - void prepareBasicLibs(); - void prepareBasicLibs(const ::rtl::OUString & sURL, - ::xmlscript::LibDescriptorArray & out_elements); - bool isBasicPackageEnabled( const ::com::sun::star::uno::Reference< - ::com::sun::star::deployment::XPackage > & xPkg); - void registerBasicPackage( - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg); - - public: - ExtensionMigration(::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > const & ctx); - virtual ~ExtensionMigration(); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw (::com::sun::star::uno::RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - // XJob - virtual ::com::sun::star::uno::Any SAL_CALL execute( - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) - throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, - ::com::sun::star::uno::RuntimeException); - }; - -//......................................................................... -} // namespace migration -//......................................................................... - -#endif // _DESKTOP_AUTOCORRMIGRATION_HXX_ diff --git a/desktop/source/migration/services/makefile.mk b/desktop/source/migration/services/makefile.mk index 55ecff6bc06f..2f3eb9308ebd 100644 --- a/desktop/source/migration/services/makefile.mk +++ b/desktop/source/migration/services/makefile.mk @@ -51,7 +51,6 @@ SLOFILES= \ $(SLO)$/cexports.obj \ $(SLO)$/basicmigration.obj \ $(SLO)$/wordbookmigration.obj \ - $(SLO)$/extensionmigration.obj \ $(SLO)$/autocorrmigration.obj \ $(SLO)$/oo3extensionmigration.obj \ $(SLO)$/cexportsoo3.obj @@ -61,7 +60,6 @@ SHL1OBJS= \ $(SLO)$/cexports.obj \ $(SLO)$/basicmigration.obj \ $(SLO)$/wordbookmigration.obj \ - $(SLO)$/extensionmigration.obj \ $(SLO)$/autocorrmigration.obj SHL1TARGET=$(TARGET) diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 2d17a654b29b..37608a7b1276 100755 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -43,8 +43,6 @@ #include #include -#include -#include #include #include #include @@ -53,6 +51,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -140,15 +139,15 @@ OO3ExtensionMigration::~OO3ExtensionMigration() } } -void OO3ExtensionMigration::registerConfigurationPackage( const uno::Reference< deployment::XPackage > & xPkg) -{ - const ::rtl::OUString sMediaType = xPkg->getPackageType()->getMediaType(); - if ( (sMediaType.equals(sConfigurationDataType) || sMediaType.equals(sConfigurationSchemaType) ) ) - { - xPkg->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - xPkg->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - } -} +//void OO3ExtensionMigration::registerConfigurationPackage( const uno::Reference< deployment::XPackage > & xPkg) +//{ +// const ::rtl::OUString sMediaType = xPkg->getPackageType()->getMediaType(); +// if ( (sMediaType.equals(sConfigurationDataType) || sMediaType.equals(sConfigurationSchemaType) ) ) +// { +// xPkg->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); +// xPkg->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); +// } +//} void OO3ExtensionMigration::scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ) { @@ -343,18 +342,17 @@ bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescript bool OO3ExtensionMigration::migrateExtension( const ::rtl::OUString& sSourceDir ) { - if ( !m_xPackageManager.is() ) + if ( !m_xExtensionManager.is() ) { try { - m_xPackageManager = deployment::thePackageManagerFactory::get( m_ctx )->getPackageManager( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "user" )) ); + m_xExtensionManager = deployment::ExtensionManager::get( m_ctx ); } catch ( ucb::CommandFailedException & ){} catch ( uno::RuntimeException & ) {} } - if ( m_xPackageManager.is() ) + if ( m_xExtensionManager.is() ) { try { @@ -364,8 +362,9 @@ bool OO3ExtensionMigration::migrateExtension( const ::rtl::OUString& sSourceDir static_cast< cppu::OWeakObject* >( pCmdEnv ), uno::UNO_QUERY ); uno::Reference< task::XAbortChannel > xAbortChannel; uno::Reference< deployment::XPackage > xPackage = - m_xPackageManager->addPackage( - sSourceDir, uno::Sequence(),::rtl::OUString(), xAbortChannel, xCmdEnv ); + m_xExtensionManager->addExtension( + sSourceDir, uno::Sequence(), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")), xAbortChannel, xCmdEnv ); if ( xPackage.is() ) return true; diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx index a001f41d92c5..7890eb86a75c 100755 --- a/desktop/source/migration/services/oo3extensionmigration.hxx +++ b/desktop/source/migration/services/oo3extensionmigration.hxx @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include @@ -83,7 +83,7 @@ namespace migration ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_ctx; ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XDocumentBuilder > m_xDocBuilder; ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > m_xSimpleFileAccess; - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > m_xPackageManager; + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; ::osl::Mutex m_aMutex; ::rtl::OUString m_sSourceDir; ::rtl::OUString m_sTargetDir; @@ -105,8 +105,8 @@ namespace migration bool migrateExtension( const ::rtl::OUString& sSourceDir ); /* fills m_scriptElements and m_dialogElements */ - void registerConfigurationPackage( - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg); + //void registerConfigurationPackage( + // const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg); public: OO3ExtensionMigration(::com::sun::star::uno::Reference< diff --git a/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs b/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs index 7ff91464727d..7b0b221f15a9 100755 --- a/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs @@ -15,7 +15,7 @@ OpenOffice.org Improvement Program. If this is zero the user will get asked. - 1 + 2 -- cgit From d310e6479f4db1c86629ca98f6e0f7480a0fa5e4 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 18 May 2010 17:10:29 +0200 Subject: CWS mba33issues01: #i109842#: missing typedef --- sfx2/source/appl/appmain.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/sfx2/source/appl/appmain.cxx b/sfx2/source/appl/appmain.cxx index 020f68d01e8d..cf097b900b52 100644 --- a/sfx2/source/appl/appmain.cxx +++ b/sfx2/source/appl/appmain.cxx @@ -93,9 +93,6 @@ static SfxItemInfo __READONLY_DATA aItemInfos[] = //=================================================================== -typedef Link* LinkPtr; -SV_DECL_PTRARR(SfxInitLinkList, LinkPtr, 4, 4) - TYPEINIT2(SfxApplication,SfxShell,SfxBroadcaster); //-------------------------------------------------------------------- -- cgit From 74efe21718537220ec16adab9964a00fc13cd9fd Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 18 May 2010 17:10:57 +0200 Subject: CWS mba33issues01: #i109842#: missing typedef --- sfx2/source/inc/appdata.hxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index 91305eb95cce..bd12f3db80dc 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -82,6 +82,9 @@ class SfxBasicManagerCreationListener; namespace sfx2 { namespace appl { class ImeStatusWindow; } } +typedef Link* LinkPtr; +SV_DECL_PTRARR(SfxInitLinkList, LinkPtr, 4, 4) + //========================================================================= // SfxAppData_Impl //========================================================================= -- cgit From 9a4d07cc52534a40cf1cd68efdef1464475e694b Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 18 May 2010 17:19:21 +0200 Subject: CWS mba33issues01: #i107576#: make code safe against releasing of external references to client site --- sfx2/source/view/ipclient.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 6d61f4182bbb..328d88d8b2b9 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -131,6 +131,8 @@ public: , m_bResizeNoScale( sal_False ) {} + ~SfxInPlaceClient_Impl(); + void SizeHasChanged(); DECL_LINK (TimerHdl, Timer*); uno::Reference < frame::XFrame > GetFrame() const; @@ -168,6 +170,10 @@ public: virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); }; +SfxInPlaceClient_Impl::~SfxInPlaceClient_Impl() +{ +} + void SAL_CALL SfxInPlaceClient_Impl::changingState( const ::com::sun::star::lang::EventObject& /*aEvent*/, ::sal_Int32 /*nOldState*/, @@ -645,6 +651,7 @@ SfxInPlaceClient::SfxInPlaceClient( SfxViewShell* pViewShell, Window *pDraw, sal m_pViewSh( pViewShell ), m_pEditWin( pDraw ) { + m_pImp->acquire(); m_pImp->m_pClient = this; m_pImp->m_nAspect = nAspect; m_pImp->m_aScaleWidth = m_pImp->m_aScaleHeight = Fraction(1,1); @@ -668,6 +675,7 @@ SfxInPlaceClient::~SfxInPlaceClient() // the next call will destroy m_pImp if no other reference to it exists m_pImp->m_xClient = uno::Reference < embed::XEmbeddedClient >(); + m_pImp->release(); // TODO/LATER: // the class is not intended to be used in multithreaded environment; -- cgit From fc05fb607569bf4eff1b37c7eba1fc4369702744 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 19 May 2010 11:00:36 +0200 Subject: jl152: #i108704# use all the arguments when restarting on Windows --- desktop/win32/source/officeloader/officeloader.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx index ef980e1e994e..7c2dafc79bbb 100644 --- a/desktop/win32/source/officeloader/officeloader.cxx +++ b/desktop/win32/source/officeloader/officeloader.cxx @@ -212,7 +212,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) LPTSTR lpCommandLine = NULL; int argc = 0; LPTSTR * argv = NULL; - bool first = true; + bool bFirst = true; WCHAR cwd[MAX_PATH]; DWORD cwdLen = GetCurrentDirectoryW(MAX_PATH, cwd); if (cwdLen >= MAX_PATH) { @@ -318,7 +318,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) } } - if (first) { + if ( bFirst ) { argv = GetCommandArgs(&argc); std::size_t n = wcslen(argv[0]) + 2; for (int i = 1; i < argc; ++i) { @@ -334,7 +334,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) lpCommandLine, MY_STRING(L"\"")); p = desktop_win32::commandLineAppend(p, argv[0]); for (int i = 1; i < argc; ++i) { - if (first || wcsncmp(argv[i], MY_STRING(L"-env:")) == 0) { + if (bFirst || ::desktop::ExitHelper::E_NORMAL_RESTART == dwExitCode || wcsncmp(argv[i], MY_STRING(L"-env:")) == 0) { p = desktop_win32::commandLineAppend(p, MY_STRING(L"\" \"")); p = desktop_win32::commandLineAppend(p, argv[i]); } @@ -348,7 +348,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) p = desktop_win32::commandLineAppendEncoded(p, cwd); } desktop_win32::commandLineAppend(p, MY_STRING(L"\"")); - first = false; + bFirst = false; TCHAR szParentProcessId[64]; // This is more than large enough for a 128 bit decimal value BOOL bHeadlessMode( FALSE ); -- cgit From 4659d84eb4e0e8038ac21044ddd3c390e2585581 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 19 May 2010 14:28:33 +0200 Subject: cws tl79: #i110254# new security tap page in 'File/Properties' --- desktop/source/migration/migration.cxx | 1 + sfx2/inc/sfx2/objsh.hxx | 7 + sfx2/inc/sfx2/sfx.hrc | 2 + sfx2/sdi/sfx.sdi | 2 +- sfx2/source/dialog/securitypage.cxx | 320 ++++++++++++++++++++++----------- sfx2/source/dialog/securitypage.hrc | 6 +- sfx2/source/dialog/securitypage.src | 19 +- sfx2/source/doc/objxtor.cxx | 24 +++ 8 files changed, 262 insertions(+), 119 deletions(-) mode change 100644 => 100755 desktop/source/migration/migration.cxx mode change 100644 => 100755 sfx2/inc/sfx2/objsh.hxx mode change 100644 => 100755 sfx2/sdi/sfx.sdi mode change 100644 => 100755 sfx2/source/doc/objxtor.cxx diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx old mode 100644 new mode 100755 index 2181daab7454..b9be788ebd4b --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -232,6 +232,7 @@ static void insertSorted(migrations_available& rAvailableMigrations, supported_m { rAvailableMigrations.insert(pIter, aSupportedMigration ); bInserted = true; + break; } ++pIter; } diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx old mode 100644 new mode 100755 index 5fc5a641fd44..7984fae956cb --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -683,6 +683,13 @@ public: sal_Int32 nVersion, sal_Bool bTemplate = sal_False) const = 0; + // change recording and respective passwword protection for Writer and Calc + // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON + // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT + virtual void SetChangeRecording( bool bActivate ); + virtual bool SetProtectionPassword( const String &rPassword ); + virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ); + // ================================= //#if 0 // _SOLAR__PRIVATE diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc index 137218e3c117..3ed7f34ee3b8 100755 --- a/sfx2/inc/sfx2/sfx.hrc +++ b/sfx2/inc/sfx2/sfx.hrc @@ -234,6 +234,8 @@ #define TP_MANAGE_STYLES (RID_SFX_START+7) #define DLG_STYLE_DESIGNER (RID_SFX_START+8) +#define RID_SFX_INCORRECT_PASSWORD (RID_SFX_START+216) + #define STR_STYLE_FILTER_AUTO (RID_SFX_START+9) #define STR_STYLE_FILTER_USED (RID_SFX_START+10) #define STR_STYLE_FILTER_USERDEF (RID_SFX_START+11) diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi old mode 100644 new mode 100755 index 10a920852848..e4ff0dc8d2b5 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -31,7 +31,7 @@ SfxBoolItem _SwitchViewShell0 SID_VIEWSHELL0 [ /* flags: */ AutoUpdate = FALSE, - Cachable = Cachable, + Cachable = Cachable,  FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index d6351143c51e..d4f217671d6e 100755 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -38,64 +38,70 @@ #include #include #include +#include #include #include #include +#include #include #include #include +#include #include +using namespace ::com::sun::star; ////////////////////////////////////////////////////////////////////// -namespace +static short lcl_GetPassword( Window *pParent, bool bShowConfirm, /*out*/String &rPassword ) { - enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC }; + bool bRes = false; + SfxPasswordDialog aPasswdDlg( pParent ); + if (bShowConfirm) + aPasswdDlg.ShowExtras( SHOWEXTRAS_CONFIRM ); + if (RET_OK == aPasswdDlg.Execute() && aPasswdDlg.GetPassword().Len() > 0) + { + rPassword = aPasswdDlg.GetPassword(); + bRes = true; + } + return bRes; +} - enum RedlineFunc { RF_ON, RF_PROTECT }; - const SfxBoolItem* ExecuteRecordChangesFunc( RedliningMode _eMode, RedlineFunc _eFunc, BOOL _bVal, Window* _pParent = NULL ) - { - const SfxBoolItem* pRet = NULL; +static bool lcl_IsPasswordCorrect( const String &rPassword ) +{ + bool bRes = false; - if (_eMode != RL_NONE) - { - USHORT nSlot; - if (_eMode == RL_WRITER) - nSlot = _eFunc == RF_ON ? FN_REDLINE_ON : FN_REDLINE_PROTECT; - else - nSlot = _eFunc == RF_ON ? FID_CHG_RECORD : SID_CHG_PROTECT; + SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); + uno::Sequence< sal_Int8 > aPasswordHash; + bool bHasPassword = pCurDocShell->GetProtectionHash( aPasswordHash ); + + // check if supplied password was correct + uno::Sequence< sal_Int8 > aNewPasswd( aPasswordHash ); + SvPasswordHelper::GetHashPassword( aNewPasswd, rPassword ); + if (SvPasswordHelper::CompareHashPassword( aPasswordHash, rPassword )) + bRes = true; // password was correct + else + InfoBox( NULL, String( SfxResId( RID_SFX_INCORRECT_PASSWORD ) ) ).Execute(); - // execute - SfxViewShell* pViewSh = SfxViewShell::Current(); - if (pViewSh) - { - bool bNeedItem = _eMode == RL_WRITER || _eFunc != RF_ON; - SfxBoolItem* pItem = bNeedItem ? new SfxBoolItem( nSlot, _bVal ) : NULL; - SfxDispatcher* pDisp = pViewSh->GetDispatcher(); - if (_pParent) - { - XWindowItem aParentItem( SID_ATTR_XWINDOW, _pParent ); - pRet = static_cast< const SfxBoolItem* >( - pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, &aParentItem, pItem, 0L ) ); - } - else - pRet = static_cast< const SfxBoolItem* >( - pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, pItem, 0L ) ); - delete pItem; - } - } + return bRes; +} + + +////////////////////////////////////////////////////////////////////// + + +namespace +{ + enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC }; + enum RedlineFunc { RF_ON, RF_PROTECT }; - return pRet; - } bool QueryState( USHORT _nSlot, bool& _rValue ) { bool bRet = false; - SfxViewShell* pViewSh = SfxViewShell::Current(); if (pViewSh) { @@ -105,33 +111,30 @@ namespace if (bRet) _rValue = ( static_cast< const SfxBoolItem* >( pItem ) )->GetValue(); } - return bRet; } + bool QueryRecordChangesProtectionState( RedliningMode _eMode, bool& _rValue ) { bool bRet = false; - if (_eMode != RL_NONE) { USHORT nSlot = _eMode == RL_WRITER ? FN_REDLINE_PROTECT : SID_CHG_PROTECT; bRet = QueryState( nSlot, _rValue ); } - return bRet; } + bool QueryRecordChangesState( RedliningMode _eMode, bool& _rValue ) { bool bRet = false; - if (_eMode != RL_NONE) { USHORT nSlot = _eMode == RL_WRITER ? FN_REDLINE_ON : FID_CHG_RECORD; bRet = QueryState( nSlot, _rValue ); } - return bRet; } } @@ -142,64 +145,71 @@ namespace struct SfxSecurityPage_Impl { - SfxSecurityPage & m_rDialog; + SfxSecurityPage & m_rMyTabPage; - FixedLine m_aPasswordToOpenFL; - FixedText m_aPasswordToOpenFT; - Edit m_aPasswordToOpenED; + FixedLine m_aNewPasswordToOpenFL; + FixedText m_aNewPasswordToOpenFT; + Edit m_aNewPasswordToOpenED; FixedText m_aConfirmPasswordToOpenFT; Edit m_aConfirmPasswordToOpenED; - FixedText m_aPasswordInfoFT; + FixedText m_aNewPasswordInfoFT; - FixedLine m_aPasswordToModifyFL; - FixedText m_aPasswordToModifyFT; - Edit m_aPasswordToModifyED; + FixedLine m_aNewPasswordToModifyFL; + FixedText m_aNewPasswordToModifyFT; + Edit m_aNewPasswordToModifyED; FixedText m_aConfirmPasswordToModifyFT; Edit m_aConfirmPasswordToModifyED; FixedLine m_aOptionsFL; CheckBox m_aOpenReadonlyCB; - CheckBox m_aRemoveInfoOnSavingCB; CheckBox m_aRecordChangesCB; // for record changes PushButton m_aChangeProtectionPB; // for record changes String m_aProtectSTR; // for record changes String m_aUnProtectSTR; // for record changes RedliningMode m_eRedlingMode; // for record changes + bool m_bOrigPasswordIsConfirmed; + bool m_bNewPasswordIsValid; + String m_aNewPassword; + + String m_aEndRedliningWarning; + bool m_bEndRedliningWarningDone; + DECL_LINK( RecordChangesCBHdl, void* ); DECL_LINK( ChangeProtectionPBHdl, void* ); SfxSecurityPage_Impl( SfxSecurityPage &rDlg, const SfxItemSet &rItemSet ); ~SfxSecurityPage_Impl(); - void CheckRecordChangesState( void ); - BOOL FillItemSet_Impl( SfxItemSet & ); void Reset_Impl( const SfxItemSet & ); }; -SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rDlg, const SfxItemSet & ) : - m_rDialog (rDlg), - m_aPasswordToOpenFL (&rDlg, SfxResId( PASSWORD_TO_OPEN_FL ) ), - m_aPasswordToOpenFT (&rDlg, SfxResId( PASSWORD_TO_OPEN_FT ) ), - m_aPasswordToOpenED (&rDlg, SfxResId( PASSWORD_TO_OPEN_ED ) ), - m_aConfirmPasswordToOpenFT (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_OPEN_FT ) ), - m_aConfirmPasswordToOpenED (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_OPEN_ED ) ), - m_aPasswordInfoFT (&rDlg, SfxResId( PASSWORD_INFO_FT ) ), - m_aPasswordToModifyFL (&rDlg, SfxResId( PASSWORD_TO_MODIFY_FL ) ), - m_aPasswordToModifyFT (&rDlg, SfxResId( PASSWORD_TO_MODIFY_FT ) ), - m_aPasswordToModifyED (&rDlg, SfxResId( PASSWORD_TO_MODIFY_ED ) ), - m_aConfirmPasswordToModifyFT (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_FT ) ), - m_aConfirmPasswordToModifyED (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_ED ) ), - m_aOptionsFL (&rDlg, SfxResId( OPTIONS_FL ) ), - m_aOpenReadonlyCB (&rDlg, SfxResId( OPEN_READONLY_CB ) ), - m_aRemoveInfoOnSavingCB (&rDlg, SfxResId( REMOVE_INFO_ON_SAVING_CB ) ), - m_aRecordChangesCB (&rDlg, SfxResId( RECORD_CHANGES_CB ) ), - m_aChangeProtectionPB (&rDlg, SfxResId( CHANGE_PROTECTION_PB ) ), +SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rTabPage, const SfxItemSet & ) : + m_rMyTabPage (rTabPage), + m_aNewPasswordToOpenFL (&rTabPage, SfxResId( PASSWORD_TO_OPEN_FL ) ), + m_aNewPasswordToOpenFT (&rTabPage, SfxResId( PASSWORD_TO_OPEN_FT ) ), + m_aNewPasswordToOpenED (&rTabPage, SfxResId( PASSWORD_TO_OPEN_ED ) ), + m_aConfirmPasswordToOpenFT (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_OPEN_FT ) ), + m_aConfirmPasswordToOpenED (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_OPEN_ED ) ), + m_aNewPasswordInfoFT (&rTabPage, SfxResId( PASSWORD_INFO_FT ) ), + m_aNewPasswordToModifyFL (&rTabPage, SfxResId( PASSWORD_TO_MODIFY_FL ) ), + m_aNewPasswordToModifyFT (&rTabPage, SfxResId( PASSWORD_TO_MODIFY_FT ) ), + m_aNewPasswordToModifyED (&rTabPage, SfxResId( PASSWORD_TO_MODIFY_ED ) ), + m_aConfirmPasswordToModifyFT (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_FT ) ), + m_aConfirmPasswordToModifyED (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_ED ) ), + m_aOptionsFL (&rTabPage, SfxResId( OPTIONS_FL ) ), + m_aOpenReadonlyCB (&rTabPage, SfxResId( OPEN_READONLY_CB ) ), + m_aRecordChangesCB (&rTabPage, SfxResId( RECORD_CHANGES_CB ) ), + m_aChangeProtectionPB (&rTabPage, SfxResId( CHANGE_PROTECTION_PB ) ), m_aProtectSTR ( SfxResId( STR_PROTECT ) ), m_aUnProtectSTR ( SfxResId( STR_UNPROTECT ) ), - m_eRedlingMode ( RL_NONE ) + m_eRedlingMode ( RL_NONE ), + m_bOrigPasswordIsConfirmed ( false ), + m_bNewPasswordIsValid ( false ), + m_aEndRedliningWarning ( SfxResId( STR_END_REDLINING_WARNING ) ), + m_bEndRedliningWarningDone ( false ) { m_aChangeProtectionPB.SetText( m_aProtectSTR ); // adjust button width if necessary @@ -218,30 +228,46 @@ SfxSecurityPage_Impl::~SfxSecurityPage_Impl() } -void SfxSecurityPage_Impl::CheckRecordChangesState( void ) -{ - bool bVal; - if (QueryRecordChangesState( m_eRedlingMode, bVal )) - { - m_aRecordChangesCB.Enable(); - m_aRecordChangesCB.Check( bVal ); - } - else - m_aRecordChangesCB.Disable(); // because now we don't know the state! - - m_aChangeProtectionPB.Enable( QueryRecordChangesProtectionState( m_eRedlingMode, bVal ) ); -} - - BOOL SfxSecurityPage_Impl::FillItemSet_Impl( SfxItemSet & ) { - BOOL bModified = FALSE; + bool bModified = false; SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); if (pCurDocShell) { + if (m_eRedlingMode != RL_NONE && !pCurDocShell->IsReadOnly()) + { + // change recording + const bool bDoRecordChanges = m_aRecordChangesCB.IsChecked(); + pCurDocShell->SetChangeRecording( bDoRecordChanges ); + + // no change recording should imply no password protection + if (!bDoRecordChanges && (!m_bNewPasswordIsValid || m_aNewPassword.Len() != 0)) + { + // actually this should not be possible. Thus just as 'coded comment': + DBG_ASSERT( 0, "unexpected state of UI" ); + m_bNewPasswordIsValid = true; + m_aNewPassword = String(); + } + + // change record protection + if (m_bNewPasswordIsValid) + { + const bool bDoChangeProtection = m_aChangeProtectionPB.GetText() != m_aProtectSTR; + DBG_ASSERT( !bDoChangeProtection || bDoRecordChanges, + "change protection requires record changes to be active!" ); + pCurDocShell->SetProtectionPassword( m_aNewPassword ); + } + + bModified = true; + } + + // open read-only? if (pCurDocShell->HasSecurityOptOpenReadOnly()) + { pCurDocShell->SetSecurityOptOpenReadOnly( m_aOpenReadonlyCB.IsChecked() ); + bModified = true; + } } return bModified; @@ -284,23 +310,37 @@ void SfxSecurityPage_Impl::Reset_Impl( const SfxItemSet & ) else m_aOpenReadonlyCB.Disable(); - bool bVal; - if (QueryRecordChangesState( RL_WRITER, bVal ) && !bIsHTMLDoc) + bool bRecordChanges; + if (QueryRecordChangesState( RL_WRITER, bRecordChanges ) && !bIsHTMLDoc) m_eRedlingMode = RL_WRITER; - else if (QueryRecordChangesState( RL_CALC, bVal )) + else if (QueryRecordChangesState( RL_CALC, bRecordChanges )) m_eRedlingMode = RL_CALC; else m_eRedlingMode = RL_NONE; if (m_eRedlingMode != RL_NONE) { - m_aRecordChangesCB.Check( bVal ); - m_aRecordChangesCB.Enable( !bVal && !bIsReadonly ); - m_aChangeProtectionPB.Enable( - QueryRecordChangesProtectionState( m_eRedlingMode, bVal ) && !bIsReadonly ); + bool bProtection; + QueryRecordChangesProtectionState( m_eRedlingMode, bProtection ); + + m_aChangeProtectionPB.Enable( !bIsReadonly ); // set the right text - if (bVal) + if (bProtection) sNewText = m_aUnProtectSTR; + + m_aRecordChangesCB.Check( bRecordChanges ); + m_aRecordChangesCB.Enable( /*!bProtection && */!bIsReadonly ); + + DBG_ASSERT( pCurDocShell, "doc shell missing" ); + if (pCurDocShell) + { + m_bOrigPasswordIsConfirmed = true; // default case if no password is set + uno::Sequence< sal_Int8 > aPasswordHash; + // check if password is available + if (pCurDocShell->GetProtectionHash( aPasswordHash ) && + aPasswordHash.getLength() > 0) + m_bOrigPasswordIsConfirmed = false; // password found, needs to be confirmed later on + } } } @@ -310,27 +350,94 @@ void SfxSecurityPage_Impl::Reset_Impl( const SfxItemSet & ) IMPL_LINK( SfxSecurityPage_Impl, RecordChangesCBHdl, void*, EMPTYARG ) { - ExecuteRecordChangesFunc( m_eRedlingMode, RF_ON, m_aRecordChangesCB.IsChecked(), &m_rDialog ); - CheckRecordChangesState(); + // when change recording gets disabled protection must be disabled as well + if (!m_aRecordChangesCB.IsChecked()) // the new check state is already present, thus the '!' + { + bool bAlreadyDone = false; + if (!m_bEndRedliningWarningDone) + { + WarningBox aBox( m_rMyTabPage.GetParent(), WinBits(WB_YES_NO | WB_DEF_NO), + m_aEndRedliningWarning ); + if (aBox.Execute() != RET_YES) + bAlreadyDone = true; + else + m_bEndRedliningWarningDone = true; + } + + const bool bNeedPasssword = !m_bOrigPasswordIsConfirmed + && m_aChangeProtectionPB.GetText() != m_aProtectSTR; + if (!bAlreadyDone && bNeedPasssword) + { + String aPasswordText; + + // dialog canceled or no password provided + if (!lcl_GetPassword( m_rMyTabPage.GetParent(), false, aPasswordText )) + bAlreadyDone = true; + + // ask for password and if dialog is canceled or no password provided return + if (lcl_IsPasswordCorrect( aPasswordText )) + m_bOrigPasswordIsConfirmed = true; + else + bAlreadyDone = true; + } + + if (bAlreadyDone) + m_aRecordChangesCB.Check( true ); // restore original state + else + { + // remember required values to change protection and change recording in + // FillItemSet_Impl later on if password was correct. + m_bNewPasswordIsValid = true; + m_aNewPassword = String(); + + m_aChangeProtectionPB.SetText( m_aProtectSTR ); + } + } + return 0; } IMPL_LINK( SfxSecurityPage_Impl, ChangeProtectionPBHdl, void*, EMPTYARG ) { - bool bProt; - QueryRecordChangesProtectionState( m_eRedlingMode, bProt ); - ExecuteRecordChangesFunc( m_eRedlingMode, RF_PROTECT, !bProt, &m_rDialog ); - CheckRecordChangesState(); + if (m_eRedlingMode == RL_NONE) + return 0; + + // the push button text is always the opposite of the current state. Thus: + const bool bCurrentProtection = m_aChangeProtectionPB.GetText() != m_aProtectSTR; - if (QueryRecordChangesProtectionState( m_eRedlingMode, bProt )) + // ask user for password (if still necessary) + String aPasswordText; + bool bNewProtection = !bCurrentProtection; + const bool bNeedPassword = bNewProtection || !m_bOrigPasswordIsConfirmed; + if (bNeedPassword) { - // RecordChangesCB is enabled if protection is off - m_aRecordChangesCB.Enable( !bProt ); - // toggle text of button "Protect" <-> "Unprotect" - String sNewText = bProt ? m_aUnProtectSTR : m_aProtectSTR; - m_aChangeProtectionPB.SetText( sNewText ); + // ask for password and if dialog is canceled or no password provided return + if (!lcl_GetPassword( m_rMyTabPage.GetParent(), bNewProtection, aPasswordText )) + return 0; + + // provided password still needs to be checked? + if (!bNewProtection && !m_bOrigPasswordIsConfirmed) + { + if (lcl_IsPasswordCorrect( aPasswordText )) + m_bOrigPasswordIsConfirmed = true; + else + return 0; + } } + DBG_ASSERT( m_bOrigPasswordIsConfirmed, "ooops... this should not have happened!" ); + + // remember required values to change protection and change recording in + // FillItemSet_Impl later on if password was correct. + m_bNewPasswordIsValid = true; + m_aNewPassword = bNewProtection? aPasswordText : String(); + +// // RecordChangesCB is enabled if protection is off +// m_aRecordChangesCB.Enable( !bNewProtection ); + m_aRecordChangesCB.Check( bNewProtection ); + // toggle text of button "Protect" <-> "Unprotect" + m_aChangeProtectionPB.SetText( bNewProtection ? m_aUnProtectSTR : m_aProtectSTR ); + return 0; } @@ -378,3 +485,4 @@ void SfxSecurityPage::Reset( const SfxItemSet & rItemSet ) ////////////////////////////////////////////////////////////////////// + diff --git a/sfx2/source/dialog/securitypage.hrc b/sfx2/source/dialog/securitypage.hrc index 820dab538b9f..d425131b4772 100755 --- a/sfx2/source/dialog/securitypage.hrc +++ b/sfx2/source/dialog/securitypage.hrc @@ -41,12 +41,12 @@ #define CONFIRM_PASSWORD_TO_MODIFY_ED 11 #define OPTIONS_FL 12 #define OPEN_READONLY_CB 13 -#define REMOVE_INFO_ON_SAVING_CB 14 -#define RECORD_CHANGES_CB 15 -#define CHANGE_PROTECTION_PB 16 +#define RECORD_CHANGES_CB 14 +#define CHANGE_PROTECTION_PB 15 #define STR_PROTECT 101 #define STR_UNPROTECT 102 +#define STR_END_REDLINING_WARNING 103 #endif diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src index 32f5fac704a4..4bf8cdaf58a9 100755 --- a/sfx2/source/dialog/securitypage.src +++ b/sfx2/source/dialog/securitypage.src @@ -125,21 +125,15 @@ TabPage TP_DOCINFOSECURITY Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); Text [ en-US ] = "~Open file read-only"; }; - CheckBox REMOVE_INFO_ON_SAVING_CB - { - Pos = MAP_APPFONT( 12, 147 ); - Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Remove personal ~information on saving"; - }; CheckBox RECORD_CHANGES_CB { - Pos = MAP_APPFONT( 12, 162 ); + Pos = MAP_APPFONT( 12, 147 ); Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); Text [ en-US ] = "Record ~changes"; }; PushButton CHANGE_PROTECTION_PB { - Pos = MAP_APPFONT( 194, 160 ); + Pos = MAP_APPFONT( 194, 145 ); Size = MAP_APPFONT( 60, RSC_CD_PUSHBUTTON_HEIGHT ); }; String STR_PROTECT @@ -150,7 +144,14 @@ TabPage TP_DOCINFOSECURITY { Text [ en-US ] = "~Unprotect..."; }; - + String STR_END_REDLINING_WARNING + { + Text [ en-US ] = "This action will exit the change recording mode.\nAny information about changes will be lost.\n\nExit change recording mode?\n\n" ; + }; }; +String RID_SFX_INCORRECT_PASSWORD +{ + Text [ en-US ] = "Incorrect password" ; +}; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx old mode 100644 new mode 100755 index 6502eeaeb78c..751525910958 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -1074,3 +1074,27 @@ void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew ) SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) ); } } + + +void SfxObjectShell::SetChangeRecording( bool /*bActivate*/ ) +{ + // currently this function needs to be overwritten by Writer and Calc only + DBG_ASSERT( 0, "function not implemented" ); +} + + +bool SfxObjectShell::SetProtectionPassword( const String &rPassword ) +{ + // currently this function needs to be overwritten by Writer and Calc only + DBG_ASSERT( 0, "function not implemented" ); + return false; +} + + +bool SfxObjectShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > & /*rPasswordHash*/ ) +{ + // currently this function needs to be overwritten by Writer and Calc only + DBG_ASSERT( 0, "function not implemented" ); + return false; +} + -- cgit From 1778298eb695174aad2f6a981f560f0e4e2b229a Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 19 May 2010 14:59:46 +0200 Subject: cws tl79 : random typo in sfx.sdi fixed --- sfx2/sdi/sfx.sdi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index e4ff0dc8d2b5..10a920852848 100755 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -31,7 +31,7 @@ SfxBoolItem _SwitchViewShell0 SID_VIEWSHELL0 [ /* flags: */ AutoUpdate = FALSE, - Cachable = Cachable,  + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, -- cgit From 3ff45fd2d5b0bbf8318a5559fa66aba45b5c4040 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 20 May 2010 11:04:13 +0200 Subject: cws tl79: #i111422# pre-notify for 'Toggle' of check box --- sfx2/source/dialog/securitypage.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index d4f217671d6e..f88525107f1c 100755 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -175,7 +175,7 @@ struct SfxSecurityPage_Impl String m_aEndRedliningWarning; bool m_bEndRedliningWarningDone; - DECL_LINK( RecordChangesCBHdl, void* ); + DECL_LINK( RecordChangesCBToggleHdl, void* ); DECL_LINK( ChangeProtectionPBHdl, void* ); SfxSecurityPage_Impl( SfxSecurityPage &rDlg, const SfxItemSet &rItemSet ); @@ -218,7 +218,9 @@ SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rTabPage, const Sfx if (nTemp > nBtnTextWidth) nBtnTextWidth = nTemp; - m_aRecordChangesCB.SetClickHdl( LINK( this, SfxSecurityPage_Impl, RecordChangesCBHdl ) ); + // force toggle hdl called before visual change of checkbox + m_aRecordChangesCB.SetStyle( m_aRecordChangesCB.GetStyle() | WB_EARLYTOGGLE ); + m_aRecordChangesCB.SetToggleHdl( LINK( this, SfxSecurityPage_Impl, RecordChangesCBToggleHdl ) ); m_aChangeProtectionPB.SetClickHdl( LINK( this, SfxSecurityPage_Impl, ChangeProtectionPBHdl ) ); } @@ -348,7 +350,7 @@ void SfxSecurityPage_Impl::Reset_Impl( const SfxItemSet & ) } -IMPL_LINK( SfxSecurityPage_Impl, RecordChangesCBHdl, void*, EMPTYARG ) +IMPL_LINK( SfxSecurityPage_Impl, RecordChangesCBToggleHdl, void*, EMPTYARG ) { // when change recording gets disabled protection must be disabled as well if (!m_aRecordChangesCB.IsChecked()) // the new check state is already present, thus the '!' -- cgit From 7df75b6fe4c992f61c593dc33bb84ba537f05f99 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 20 May 2010 11:27:05 +0200 Subject: jl152 #i77196# registering basic item at startup did not work --- .../deployment/registry/configuration/dp_configuration.cxx | 1 - desktop/source/deployment/registry/script/dp_script.cxx | 2 +- desktop/source/migration/services/oo3extensionmigration.cxx | 12 +----------- desktop/source/migration/services/oo3extensionmigration.hxx | 4 ---- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index f892c21a6a6b..9ea6e8227340 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -35,7 +35,6 @@ #include "dp_backend.h" #include "dp_persmap.h" #include "dp_ucb.h" -#include "dp_xml.h" #include "rtl/string.hxx" #include "rtl/ustrbuf.hxx" #include "rtl/uri.hxx" diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index 3a43e916e39e..edeae256cbaf 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -476,7 +476,7 @@ void BackendImpl::PackageImpl::processPackage_( } } bool bSuccess = bScript || bDialog; // Something must have happened - if( bRunning ) + if( bRunning && !startup) if( (bScript && !bScriptSuccess) || (bDialog && !bDialogSuccess) ) bSuccess = false; diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 37608a7b1276..0b757212eaa6 100755 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -139,17 +139,7 @@ OO3ExtensionMigration::~OO3ExtensionMigration() } } -//void OO3ExtensionMigration::registerConfigurationPackage( const uno::Reference< deployment::XPackage > & xPkg) -//{ -// const ::rtl::OUString sMediaType = xPkg->getPackageType()->getMediaType(); -// if ( (sMediaType.equals(sConfigurationDataType) || sMediaType.equals(sConfigurationSchemaType) ) ) -// { -// xPkg->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); -// xPkg->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); -// } -//} - - void OO3ExtensionMigration::scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ) +void OO3ExtensionMigration::scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ) { osl::Directory aScanRootDir( sSourceDir ); osl::FileStatus fs(FileStatusMask_Type | FileStatusMask_FileURL); diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx index 7890eb86a75c..7962da177217 100755 --- a/desktop/source/migration/services/oo3extensionmigration.hxx +++ b/desktop/source/migration/services/oo3extensionmigration.hxx @@ -103,10 +103,6 @@ namespace migration void scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ); bool scanDescriptionXml( const ::rtl::OUString& sDescriptionXmlFilePath ); bool migrateExtension( const ::rtl::OUString& sSourceDir ); - /* fills m_scriptElements and m_dialogElements - */ - //void registerConfigurationPackage( - // const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg); public: OO3ExtensionMigration(::com::sun::star::uno::Reference< -- cgit From d8b873beb717df820251dc68e869a97ab3998fe2 Mon Sep 17 00:00:00 2001 From: Frank Peters Date: Thu, 20 May 2010 15:23:05 +0200 Subject: #i111721# --- readlicense_oo/docs/readme.xsl | 334 +++++--------- readlicense_oo/docs/readme/readme.xrm | 819 +++++++++++++--------------------- 2 files changed, 419 insertions(+), 734 deletions(-) mode change 100755 => 100644 readlicense_oo/docs/readme.xsl diff --git a/readlicense_oo/docs/readme.xsl b/readlicense_oo/docs/readme.xsl old mode 100755 new mode 100644 index 2c98b011c315..cb13fb08ff83 --- a/readlicense_oo/docs/readme.xsl +++ b/readlicense_oo/docs/readme.xsl @@ -1,232 +1,128 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + - - - - - - ------------------------------------------------------------ - - - ------------------------------------------------------------ - - - - - - - - - - - - - - - - - - - ------------------------------------------------------------ - - - ------------------------------------------------------------ - - - + + + + - - - - - - - - - - -
    - -
-
- -
    - -
-
-
-
- - - - - -
  • -
    -
    - - - - - - - - - - - - - - - -
    - - - - - - - - - + + + + + + + + + + + + + + + + + + + +---------------------------------------------------------------------------------------------------------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + +* + + + + + + + - - - - - - - - - - - - file://localhost/ - - - http:// - - - - - - - - - - - - - - - - - - - - - - - - + + + + + +====================================================================== + +====================================================================== + + + +---------------------------------------------------------------------- + +---------------------------------------------------------------------- + + + + + +---------------------------------------------------------------------- + + + + + + +
    diff --git a/readlicense_oo/docs/readme/readme.xrm b/readlicense_oo/docs/readme/readme.xrm index 2a8a409b4eff..43603ed2159b 100755 --- a/readlicense_oo/docs/readme/readme.xrm +++ b/readlicense_oo/docs/readme/readme.xrm @@ -1,524 +1,313 @@ - - - - -
    - - - Welcome - - - - ${PRODUCTNAME} ${PRODUCTVERSION} ReadMe - - - - For latest updates to this readme file, see - http://www.openoffice.org/welcome/readme.html - - - - Dear User - - - - This file contains important information about this program. Please read this information very carefully before starting work. - - - - The OpenOffice.org Community, responsible for the development of this product, would like to invite you to participate as a community member. As a new user, you can check out the ${PRODUCTNAME} site with helpful user information at - - - - - http://www.openoffice.org/about_us/introduction.html - - - - - Also read the sections below about getting involved in the OpenOffice.org project. - - - - Is ${PRODUCTNAME} really free for any user? - - - - - ${PRODUCTNAME} is free for use by everybody. You may take this copy of ${PRODUCTNAME} and install it on as many computers as you like, and use it for any purpose you like (including commercial, government, public administration and educational use). For further details see the license text delivered together with ${PRODUCTNAME} or - http://www.openoffice.org/license.html - - - - - Why is ${PRODUCTNAME} free for any user? - - - - - - You can use this copy of ${PRODUCTNAME} today free of charge because individual contributors and corporate sponsors have designed, developed, tested, translated, documented, supported, marketed, and helped in many other ways to make ${PRODUCTNAME} what it is today - the world's leading open-source office software. - If you appreciate their efforts, and would like to ensure OpenOffice.org continues into the future, please consider contributing to the project - see - http://contributing.openoffice.org - for details. Everyone has a contribution to make. - - -
    - -
    - - - Notes on Installation - - - - System Requirements: - - - - - MacOSX 10.4 (Tiger) or higher - Intel processor - 512 MB RAM - 500 MB available hard disk space - Chinese, Japanese and Korean versions: 600 MB (multi-language version: 800 MB) available hard disk space) - 1024 x 768 graphic device with 256 colors (higher resolution recommended) - - - - - - Microsoft Windows 2000 (Service Pack 4 or higher), XP, or Vista - Pentium compatible PC (Pentium III or Athlon recommended) - 256 MB RAM (512 MB RAM recommended) - 370 MB available hard disk space - Chinese, Japanese and Korean versions: 650 MB available hard disk space - 1024x768 resolution (higher resolution recommended), at least 256 colors - - - - - - Solaris 10 operating system (SPARC platform) or higher - 256 MB RAM (512 MB RAM recommended) - 480 MB available hard disk space - Chinese, Japanese and Korean versions: 480 MB available hard disk space - X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors - Window Manager - Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools) - - - - - - Solaris 10 operating system (x86 platform) or higher - 256 MB RAM (512 MB RAM recommended) - 480 MB available hard disk space - Chinese, Japanese and Korean versions: 480 MB available hard disk space - X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors - Window Manager - Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools) - - - - - - Linux Kernel version 2.4 or higher - glibc2 version 2.3.2 or higher - gtk version 2.2.0 or higher - Pentium compatible PC (Pentium III or Athlon recommended) - 256 MB RAM (512 MB RAM recommended) - 440 MB available hard disk space - Chinese, Japanese and Korean versions: 440 MB available hard disk space - X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors - Window Manager - Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools) - - - - - There is a wide variety of Linux distributions, and even within the same distribution there may be different installation options (KDE vs Gnome, etc.). Some distributions ship with their own ‘native’ version of ${PRODUCTNAME}, which may have different features from this Community ${PRODUCTNAME}. Sometimes you can install the Community ${PRODUCTNAME} alongside the ‘native’ version. However, it’s usually safer to remove the ‘native’ version before installing this Community version. Consult the documentation for your distribution for details of how to do this. - - - - It is recommended that you always backup your system before you remove or install software. - - - - Registration of ${PRODUCTNAME} as default application for Microsoft Office formats can be forced or suppressed by using the following command line switches with the installer: - - /msoreg=1 will force registration of ${PRODUCTNAME} as default application for Microsoft Office formats. - /msoreg=0 will suppress registration of ${PRODUCTNAME} as default application for Microsoft Office formats. - - - - - If you perform an administrative installation using setup /a, you need to make sure that the file msvc90.dll is installed on the system. This file is required for ${PRODUCTNAME} to start after an administrative installation. You can get the file from - http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF - - + + + + + ${PRODUCTNAME} Readme File + + + +
    -
    - - Extension Database Incompatibility - -
    - - - The Berkeley database engine has been upgraded in this version of ${PRODUCTNAME}. The database engine upgrade introduces an incompatibility with user data for installed extensions for ${PRODUCTNAME} versions prior to 3.2 that may require your action if you downgrade your version of ${PRODUCTNAME}. - - - - This version of ${PRODUCTNAME} will convert your extension database to the new Berkeley database format when extensions are installed or removed. After this conversion, the database can no longer be read by earlier versions of ${PRODUCTNAME}. Downgrading to an earlier version may result in a dysfunctional installation. - - - - If you downgrade to an earlier version of ${PRODUCTNAME}, you must remove the user data directory {user data}/uno_packages, for example ~/.openoffice.org/3/user/uno_packages, and reinstall all extensions. - - - - - Problems During Program Startup - - - - If you experience ${PRODUCTNAME} startup problems (most notably while using Gnome) please 'unset' the SESSION_MANAGER environment variable inside the shell you use to start ${PRODUCTNAME}. This can be done by adding the line "unset SESSION_MANAGER" to the beginning of the soffice shell script found in the "[office folder]/program" directory. - - - - Difficulties starting ${PRODUCTNAME} (e.g. applications hang) as well as problems with the screen display are often caused by the graphics card driver. If these problems occur, please update your graphics card driver or try using the graphics driver delivered with your operating system. Difficulties displaying 3D objects can often be solved by deactivating the option "Use OpenGL" under 'Tools - Options - ${PRODUCTNAME} - View - 3D view'. - - - - Difficulties starting ${PRODUCTNAME} (e.g. applications hang) as well as problems with the screen display are often caused by the graphics card driver. If these problems occur, please update your graphics card driver or try using the graphics driver delivered with your operating system. Difficulties displaying 3D objects can often be solved by deactivating the option "Use OpenGL" under 'Tools - Options - ${PRODUCTNAME} - View - 3D view'. - - - +

    ${PRODUCTNAME} ${PRODUCTVERSION} ReadMe

    +

    For latest updates to this readme file, see http://www.openoffice.org/welcome/readme.html

    +

    This file contains important information about this program. Please read this information very carefully before starting work.

    +

    The OpenOffice.org Community, responsible for the development of this product, would like to invite you to participate as a community member. As a new user, you can check out the ${PRODUCTNAME} site with helpful user information at http://www.openoffice.org/about_us/introduction.html

    +

    Also read the sections below about getting involved in the OpenOffice.org project.

    + +

    Is ${PRODUCTNAME} really free for any user?

    +

    ${PRODUCTNAME} is free for use by everybody. You may take this copy of ${PRODUCTNAME} and install it on as many computers as you like, and use it for any purpose you like (including commercial, government, public administration and educational use). For further details see the license text delivered together with ${PRODUCTNAME} or http://www.openoffice.org/license.html

    + +

    Why is ${PRODUCTNAME} free for any user?

    +

    You can use this copy of ${PRODUCTNAME} today free of charge because individual contributors and corporate sponsors have designed, developed, tested, translated, documented, supported, marketed, and helped in many other ways to make ${PRODUCTNAME} what it is today - the world's leading open-source office software.

    +

    If you appreciate their efforts, and would like to ensure OpenOffice.org continues into the future, please consider contributing to the project - see http://contributing.openoffice.org for details. Everyone has a contribution to make.

    + +
    + +
    - - - - Please note that copy and paste via clipboard between ${PRODUCTNAME} 1.x and ${PRODUCTNAME} ${PRODUCTVERSION} might not work in OpenOffice.org format. If that happens, choose 'Edit - Paste Special' and choose a format other than ${PRODUCTNAME}, or open the document in ${PRODUCTNAME} ${PRODUCTVERSION} directly. - - - - Please make sure you have enough free memory in the temporary directory on your system and that read, write and run access rights have been granted. Close all other programs before starting the installation. - - - - Note: Please be aware that administrator rights are needed for the installation process. - +

    Notes on Installation

    + +

    System Requirements

    +
    +
      +
    • +

      MacOSX 10.4 (Tiger) or higher

      +
    • +
    • +

      Intel processor

      +
    • +
    • +

      512 MB RAM

      +
    • +
    • +

      Up to 1.5 GB available hard disk space

      +
    • +
    • +

      1024 x 768 graphic device with 256 colors (higher resolution recommended)

      +
    • +
    +
    +
    +
      +
    • +

      Microsoft Windows 2000 (Service Pack 4 or higher), XP, Vista, or Windows 7

      +
    • +
    • +

      Pentium compatible PC (Pentium III or Athlon recommended)

      +
    • +
    • +

      256 MB RAM (512 MB RAM recommended)

      +
    • +
    • +

      Up to 1.5 GB available hard disk space

      +
    • +
    • +

      1024x768 resolution (higher resolution recommended), at least 256 colors

      +
    • +
    +

    Please be aware that administrator rights are needed for the installation process.

    + +

    Registration of ${PRODUCTNAME} as default application for Microsoft Office formats can be forced or suppressed by using the following command line switches with the installer:

    +
      +
    • +

      /msoreg=1 will force registration of ${PRODUCTNAME} as default application for Microsoft Office formats.

      +
    • +
    • +

      /msoreg=0 will suppress registration of ${PRODUCTNAME} as default application for Microsoft Office formats.

      +
    • +
    +

    If you perform an administrative installation using setup /a, you need to make sure that the file msvc90.dll is installed on the system. This file is required for ${PRODUCTNAME} to start after an administrative installation. You can get the file from http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF

    +

    Please be aware that administrator rights are needed for the installation process.

    +
    +
    +
      +
    • +

      Solaris 10 operating system (SPARC platform) or higher

      +
    • +
    • +

      256 MB RAM (512 MB RAM recommended)

      +
    • +
    • +

      Up to 1.55 GB available hard disk space

      +
    • +
    • +

      X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors

      +
    • +
    • +

      Window Manager

      +
    • +
    • +

      Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)

      +
    • +
    +
    +
    +
      +
    • +

      Solaris 10 operating system (x86 platform) or higher

      +
    • +
    • +

      256 MB RAM (512 MB RAM recommended)

      +
    • +
    • +

      Up to 1.55 GB available hard disk space

      +
    • +
    • +

      X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors

      +
    • +
    • +

      Window Manager

      +
    • +
    • +

      Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)

      +
    • +
    +
    +
    +
      +
    • +

      Linux Kernel version 2.6.18 or higher

      +
    • +
    • +

      glibc2 version 2.5 or higher

      +
    • +
    • +

      gtk version 2.10.4 or higher

      +
    • +
    • +

      Pentium compatible PC (Pentium III or Athlon recommended)

      +
    • +
    • +

      256 MB RAM (512 MB RAM recommended)

      +
    • +
    • +

      Up to 1.55 GB available hard disk space

      +
    • +
    • +

      X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors

      +
    • +
    • +

      Window Manager

      +
    • +
    • +

      Gnome 2.16 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)

      +
    • +
    +

    There is a wide variety of Linux distributions, and even within the same distribution there may be different installation options (KDE vs Gnome, etc.). Some distributions ship with their own ‘native’ version of ${PRODUCTNAME}, which may have different features from this Community ${PRODUCTNAME}. Sometimes you can install the Community ${PRODUCTNAME} alongside the ‘native’ version. However, it’s usually safer to remove the ‘native’ version before installing this Community version. Consult the documentation for your distribution for details of how to do this.

    +

    It is recommended that you always backup your system before you remove or install software.

    +
    + +

    Please make sure you have enough free memory in the temporary directory on your system and that read, write and run access rights have been granted. Close all other programs before starting the installation.

    +
    -
    - -
    - - - ALPS/Synaptics notebook touchpads in Windows - - - - Due to a Windows driver issue, you cannot scroll through ${PRODUCTNAME} documents when you slide your finger across an ALPS/Synaptics touchpad. - - - - To enable touchpad scrolling, add the following lines to the "C:\Program Files\Synaptics\SynTP\SynTPEnh.ini" configuration file, and restart your computer: - - - - [${PRODUCTNAME}] - FC = "SALFRAME" - SF = 0x10000000 - SF |= 0x00004000 - - - - Note: The location of the configuration file might vary on different versions of Windows. - -
    - -
    - - - Mozilla Address Book Driver - - - - The Mozilla address book driver requires the SUNWzlib package. This package is not part of the minimum Solaris operating system installation. If you require access to the Mozilla address book, then add this package to your Solaris operating system using the command "pkgadd" from the installation CD. - -
    - -
    - - - Shortcut Keys - - - - Only shortcut keys (key combinations) not used by the operating system can be used in ${PRODUCTNAME}. If a key combination in ${PRODUCTNAME} does not work as described in the ${PRODUCTNAME} Help, check if that shortcut is already used by the operating system. To rectify such conflicts, you can change the keys assigned by your operating system. Alternatively, you can change almost any key assignment in ${PRODUCTNAME}. For more information on this topic, refer to the ${PRODUCTNAME} Help or the Help documentation of your operating system. - - - - The application help of ${PRODUCTNAME} may use shortcut combinations for PC keyboards only. - - - - Due to a conflict with input method switching on multiple platforms, the following shortcut keys required to be changed at last minute: - - - - - Cmd-Space is now Cmd-Shift-Space - Cmd-Shift-Space is now Cmd-M - - - - - - Ctrl-Space is now Ctrl-Shift-Space - Ctrl-Shift-Space is now Ctrl-M - - - - - - Ctrl-Space is now Ctrl-Shift-Space - Ctrl-Shift-Space is now Ctrl-M - - +
    +

    Extension Database Incompatibility

    +

    The Berkeley database engine has been upgraded in this version of ${PRODUCTNAME}. The database engine upgrade introduces an incompatibility with user data for installed extensions for ${PRODUCTNAME} versions prior to 3.2 that may require your action if you downgrade your version of ${PRODUCTNAME}.

    +

    This version of ${PRODUCTNAME} will convert your extension database to the new Berkeley database format when extensions are installed or removed. After this conversion, the database can no longer be read by earlier versions of ${PRODUCTNAME}. Downgrading to an earlier version may result in a dysfunctional installation.

    +

    If you downgrade to an earlier version of ${PRODUCTNAME}, you must remove the user data directory {user data}/uno_packages, for example ~/.openoffice.org/3/user/uno_packages, and reinstall all extensions.

    +
    - - - Ctrl-Space is now Ctrl-Shift-Space - Ctrl-Shift-Space is now Ctrl-M - - - -
    - -
    - - - File Locking - - - - In the default setting, file locking is turned on in ${PRODUCTNAME}. To deactivate it, you have to set the appropriate environment variables SAL_ENABLE_FILE_LOCKING=0 and export SAL_ENABLE_FILE_LOCKING. These entries are already in enabled form in the soffice script file. - - - - Warning: The activated file locking feature can cause problems with Solaris 2.5.1 and 2.7 used in conjunction with Linux NFS 2.0. If your system environment has these parameters, we strongly recommend that you avoid using the file locking feature. Otherwise, ${PRODUCTNAME} will hang when you try to open a file from a NFS mounted directory from a Linux computer. - -
    - -
    - - - Problems When Sending Documents as E-mails From ${PRODUCTNAME} - - - - When sending a document via 'File - Send - Document as E-mail' or 'Document as PDF Attachment' problems might occur (program crashes or hangs). This is due to the Windows system file "Mapi" (Messaging Application Programming Interface) which causes problems in some file versions. Unfortunately, the problem cannot be narrowed down to a certain version number. For more information visit http://www.microsoft.com to search the Microsoft Knowledge Base for "mapi dll". - -
    - -
    - - Important Accessibility Notes - - - - For information on the accessibility features in ${PRODUCTNAME}, see - http://www.openoffice.org/access/ - . - +
    +

    Problems During Program Startup

    + +
    +

    If you experience ${PRODUCTNAME} startup problems (most notably while using Gnome) please 'unset' the SESSION_MANAGER environment variable inside the shell you use to start ${PRODUCTNAME}. This can be done by adding the line "unset SESSION_MANAGER" to the beginning of the soffice shell script found in the "[office folder]/program" directory.

    +
    + +

    Difficulties starting ${PRODUCTNAME} (e.g. applications hang) as well as problems with the screen display are often caused by the graphics card driver. If these problems occur, please update your graphics card driver or try using the graphics driver delivered with your operating system. Difficulties displaying 3D objects can often be solved by deactivating the option "Use OpenGL" under 'Tools - Options - ${PRODUCTNAME} - View - 3D view'.

    +
    -
    - -
    - - - Registration - - - - Please take a little time to complete the minimal Product Registration process when you install the software. While registration is optional, we encourage you to register, since the information enables the community to make an even better software suite and address user needs directly. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data. If you missed the registration at installation, you can return and register at any time at by choosing "Help > Registration" from the main menu. - -
    - -
    - - - User Survey - - - - There is also a User Survey located online which we encourage you to fill out. The User Survey results will help ${PRODUCTNAME} move more rapidly in setting new standards for the creation of the next-generation office suite. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data. - -
    - -
    - - - User Support - - - - The main support page - http://support.openoffice.org/ - offers various possibilities for help with ${PRODUCTNAME}. Your question may have already been answered - check the Community Forum. - http://user.services.openoffice.org - or search the archives of the 'users@openoffice.org' mailing list at - http://www.openoffice.org/mail_list.html - . Alternatively, you can send in your questions to - users@openoffice.org - . How to subscribe to the list (to get an email response) is explained on this page: - http://wiki.services.openoffice.org/wiki/Website/Content/help/mailinglists - . - - - - Also check the FAQ section at - http://wiki.services.openoffice.org/wiki/Documentation/FAQ - . - -
    +
    +

    ALPS/Synaptics notebook touchpads in Windows

    +

    Due to a Windows driver issue, you cannot scroll through ${PRODUCTNAME} documents when you slide your finger across an ALPS/Synaptics touchpad.

    +

    To enable touchpad scrolling, add the following lines to the "C:\Program Files\Synaptics\SynTP\SynTPEnh.ini" configuration file, and restart your computer:

    +

    [${PRODUCTNAME}]

    +

    FC = "SALFRAME"

    +

    SF = 0x10000000

    +

    SF |= 0x00004000

    +

    The location of the configuration file might vary on different versions of Windows.

    +
    + +
    +

    Mozilla Address Book Driver

    +

    The Mozilla address book driver requires the SUNWzlib package. This package is not part of the minimum Solaris operating system installation. If you require access to the Mozilla address book, then add this package to your Solaris operating system using the command "pkgadd" from the installation CD.

    +
    + +
    +

    Shortcut Keys

    +

    Only shortcut keys (key combinations) not used by the operating system can be used in ${PRODUCTNAME}. If a key combination in ${PRODUCTNAME} does not work as described in the ${PRODUCTNAME} Help, check if that shortcut is already used by the operating system. To rectify such conflicts, you can change the keys assigned by your operating system. Alternatively, you can change almost any key assignment in ${PRODUCTNAME}. For more information on this topic, refer to the ${PRODUCTNAME} Help or the Help documention of your operating system.

    + +
    +

    The application help of ${PRODUCTNAME} may use shortcut combinations for PC keyboards only.

    +
    + +

    Due to a conflict with input method switching on multiple platforms, the following shortcut keys required to be changed at last minute:

    + +
    +
      +
    • +

      Cmd-Space is now Cmd-Shift-Space

      +
    • +
    • +

      Cmd-Shift-Space is now Cmd-M

      +
    • +
    +
    + +
    +
      +
    • +

      Ctrl-Space is now Ctrl-Shift-Space

      +
    • +
    • +

      Ctrl-Shift-Space is now Ctrl-M

      +
    • +
    +
    +
    + +
    +

    File Locking

    +

    File locking is enabled by default in ${PRODUCTNAME}. On a network that uses the Network File System protocol (NFS), the locking daemon for NFS clients must be active. To disable file locking, edit the soffice script and change the line "export SAL_ENABLE_FILE_LOCKING" to "# export SAL_ENABLE_FILE_LOCKING". If you disable file locking, the write access of a document is not restricted to the user who first opens the document.

    +

    Warning: The activated file locking feature can cause problems with Solaris 2.5.1 and 2.7 used in conjunction with Linux NFS 2.0. If your system environment has these parameters, we strongly recommend that you avoid using the file locking feature. Otherwise, ${PRODUCTNAME} will hang when you try to open a file from a NFS mounted directory from a Linux computer.

    +
    + +
    +

    Problems When Sending Documents as E-mails From ${PRODUCTNAME}

    +

    When sending a document via 'File - Send - Document as E-mail' or 'Document as PDF Attachment' problems might occur (program crashes or hangs). This is due to the Windows system file "Mapi" (Messaging Application Programming Interface) which causes problems in some file versions. Unfortunately, the problem cannot be narrowed down to a certain version number. For more information visit http://www.microsoft.com to search the Microsoft Knowledge Base for "mapi dll".

    +
    + +
    +

    Important Accessibility Notes

    +

    For more information on the accessibility features in ${PRODUCTNAME}, see http://www.openoffice.org/access/

    +
    -
    - - - Report Bugs & Issues - - - - The ${PRODUCTNAME} Web site hosts IssueZilla, our mechanism for reporting, tracking and solving bugs and issues. We encourage all users to feel entitled and welcome to report issues that may arise on your particular platform. Energetic reporting of issues is one of the most important contributions that the user community can make to the ongoing development and improvement of the suite. - -
    - -
    - - - Getting Involved - - - - The ${PRODUCTNAME} Community would very much benefit from your active participation in the development of this important open source project. - - - - As a user, you are already a valuable part of the suite's development process and we would like to encourage you to take an even more active role with a view to being a long-term contributor to the community. Please join and check out the user page at: - http://www.openoffice.org - - - - - - Way to Start - - - - The best way to start contributing is to subscribe to one or more of the mailing lists, lurk for a while, and gradually use the mail archives to familiarize yourself with many of the topics covered since the ${PRODUCTNAME} source code was released back in October 2000. When you're comfortable, all you need to do is send an email self-introduction and jump right in. If you are familiar with Open Source Projects, check out our To-Dos list and see if there is anything you would like to help with at - http://development.openoffice.org/todo.html - . - - +
    +

    Registration

    +

    Please take a little time to complete the minimal Product Registration process when you install the software. While registration is optional, we encourage you to register, since the information enables the community to make an even better software suite and address user needs directly. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data. If you missed the registration at installation, you can return and register at any time at by choosing "Help - Registration" from the main menu.

    +
    + +
    +

    User Survey

    +

    There is also a User Survey located online which we encourage you to fill out. The User Survey results will help ${PRODUCTNAME} move more rapidly in setting new standards for the creation of the next-generation office suite. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data.

    +
    + +
    +

    User Support

    +

    The main support page http://support.openoffice.org/ offers various possibilities for help with ${PRODUCTNAME}. Your question may have already been answered - check the Community Forum at http://user.services.openoffice.org or search the archives of the 'users@openoffice.org' mailing list at http://www.openoffice.org/mail_list.html. Alternatively, you can send in your questions to users@openoffice.org. How to subscribe to the list (to get an email response) is explained on this page: http://wiki.services.openoffice.org/wiki/Website/Content/help/mailinglists.

    +

    Also check the FAQ section at http://wiki.services.openoffice.org/wiki/Documentation/FAQ.

    +
    - - Subscribe - - - - Here are a few of the Project mailing lists to which you can subscribe at - http://www.openoffice.org/mail_list.html - - - - - News: announce@openoffice.org *recommended to all users* (light traffic) - Main user forum: user@openoffice.org *easy way to lurk on discussions* (heavy traffic) - Marketing project: dev@marketing.openoffice.org *beyond development* (getting heavy) - General code contributor list: dev@openoffice.org (moderate/heavy) - - - +
    +

    Reporting Bugs & Issues

    +

    The ${PRODUCTNAME} Web site hosts IssueZilla, our mechanism for reporting, tracking and solving bugs and issues. We encourage all users to feel entitled and welcome to report issues that may arise on your particular platform. Energetic reporting of issues is one of the most important contributions that the user community can make to the ongoing development and improvement of the suite.

    +
    + +
    +

    Getting Involved

    +

    The ${PRODUCTNAME} Community would very much benefit from your active participation in the development of this important open source project.

    +

    As a user, you are already a valuable part of the suite's development process and we would like to encourage you to take an even more active role with a view to being a long-term contributor to the community. Please join and check out the user page at http://www.openoffice.org

    + +

    How to Start

    +

    The best way to start contributing is to subscribe to one or more of the mailing lists, lurk for a while, and gradually use the mail archives to familiarize yourself with many of the topics covered since the ${PRODUCTNAME} source code was released back in October 2000. When you're comfortable, all you need to do is send an email self-introduction and jump right in. If you are familiar with Open Source Projects, check out our To-Dos list and see if there is anything you would like to help with at http://development.openoffice.org/todo.html.

    + +

    Subscribe

    +

    Here are a few of the Project mailing lists to which you can subscribe at http://www.openoffice.org/mail_list.html

    +
      +
    • +

      News: announce@openoffice.org *recommended to all users* (light traffic)

      +
    • +
    • +

      Main user forum: user@openoffice.org *easy way to lurk on discussions* (heavy traffic)

      +
    • +
    • +

      Marketing project: dev@marketing.openoffice.org *beyond development* (getting heavy)

      +
    • +
    • +

      General code contributor list: dev@openoffice.org (moderate/heavy)

      +
    • +
    + +

    Joining one or more Projects

    +

    You can make major contributions to this important open source project even if you have limited software design or coding experience. Yes, you!

    +

    At http://projects.openoffice.org/index.html you will find projects ranging from Localization, Porting and Groupware to some real core coding projects. If you are not a developer, try the Documentation or the Marketing Project. The OpenOffice.org Marketing Project is applying both guerilla and traditional commercial techniques to marketing open source software, and we are doing it across language and cultural barriers, so you can help just by spreading the word and telling a friend about this office suite.

    +

    You can help by joining the Marketing Communications & Information Network on http://marketing.openoffice.org/contacts.html where you can provide point communication contact with press, media, government agencies, consultants, schools, Linux Users Groups and developers in your country and local community.

    +
    - - Join one or more Projects - - - - You can make major contributions to this important open source project even if you have limited software design or coding experience. Yes, you! - - - - At - http://projects.openoffice.org/index.html - you will find projects ranging from Localization, Porting and Groupware to some real core coding projects. If you are not a developer, try the Documentation or the Marketing Project. The OpenOffice.org Marketing Project is applying both guerrilla and traditional commercial techniques to marketing open source software, and we are doing it across language and cultural barriers, so you can help just by spreading the word and telling a friend about this office suite. - - - - You can help by joining the Marketing Communications & Information Network here: - http://marketing.openoffice.org/contacts.html - where you can provide point communication contact with press, media, government agencies, consultants, schools, Linux Users Groups and developers in your country and local community. - -
    +
    +

    We hope you enjoy working with the new ${PRODUCTNAME} ${PRODUCTVERSION} and will join us online.

    +

    The OpenOffice.org Community

    +
    + +
    +

    Used / Modified Source Code

    +

    Portions Copyright 1998, 1999 James Clark. Portions Copyright 1996, 1998 Netscape Communications Corporation.

    +
    - -
    - - - - - We hope you enjoy working with the new ${PRODUCTNAME} ${PRODUCTVERSION} and will join us online. - - - - The OpenOffice.org Community - - - - - - -
    - -
    - - - Used / Modified Source Code - - - - Portions Copyright 1998, 1999 James Clark. Portions Copyright 1996, 1998 Netscape Communications Corporation. - -
    -
    + + -- cgit From 89b704f9db9ebbff43f6a423d2a1f17314de7a5c Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Fri, 21 May 2010 09:42:27 +0200 Subject: jl152 #i77196# XExtensionManager::synchronize now has no repository argument; adapted PackageInformationProvider to use bundled extensions --- .../deployment/manager/dp_extensionmanager.cxx | 90 +++++------ .../deployment/manager/dp_extensionmanager.hxx | 1 - .../deployment/manager/dp_informationprovider.cxx | 174 +++++++++------------ desktop/source/deployment/misc/dp_misc.cxx | 22 +-- 4 files changed, 109 insertions(+), 178 deletions(-) diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index edc414dc6f5d..2781231b8f5e 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -116,6 +116,29 @@ OUString CompIdentifiers::getName(::std::vector > co OSL_ASSERT(extension.is()); return extension->getDisplayName(); } + +void writeLastModified(OUString & url, Reference const & xCmdEnv) +{ + //Write the lastmodified file + try { + ::rtl::Bootstrap::expandMacros(url); + ::ucbhelper::Content ucbStamp(url, xCmdEnv ); + dp_misc::erase_path( url, xCmdEnv ); + ::rtl::OString stamp("1" ); + Reference xData( + ::xmlscript::createInputStream( + ::rtl::ByteSequence( + reinterpret_cast(stamp.getStr()), + stamp.getLength() ) ) ); + ucbStamp.writeStream( xData, true /* replace existing */ ); + } + catch(...) + { + uno::Any exc(::cppu::getCaughtException()); + throw deploy::DeploymentException( + OUSTR("Failed to update") + url, 0, exc); + } +} } //end namespace namespace dp_manager { @@ -1021,7 +1044,6 @@ void ExtensionManager::reinstallDeployedExtensions( } sal_Bool ExtensionManager::synchronize( - OUString const & repository, Reference const & xAbortChannel, Reference const & xCmdEnv ) throw (deploy::DeploymentException, @@ -1033,37 +1055,20 @@ sal_Bool ExtensionManager::synchronize( try { sal_Bool bModified = sal_False; - Reference xPackageManager; - OUString file; - if (repository.equals(OUSTR("user"))) - { - xPackageManager = m_userRepository; - } - else if (repository.equals(OUSTR("shared"))) - { - xPackageManager = m_sharedRepository; - file = OUString ( - RTL_CONSTASCII_USTRINGPARAM( - "$SHARED_EXTENSIONS_USER/lastsynchronized")); - } - else if (repository.equals(OUSTR("bundled"))) - { - xPackageManager = m_bundledRepository; - file = OUString ( - RTL_CONSTASCII_USTRINGPARAM( - "$BUNDLED_EXTENSIONS_USER/lastsynchronized")); - } - else - throw lang::IllegalArgumentException( - OUSTR("No valid repository name provided."), - static_cast(this), 0); ::osl::MutexGuard guard(getMutex()); - String sSynchronizing(StrSyncRepository::get()); - sSynchronizing.SearchAndReplaceAllAscii( "%NAME", repository ); - dp_misc::ProgressLevel progress(xCmdEnv, sSynchronizing); + String sSynchronizingShared(StrSyncRepository::get()); + sSynchronizingShared.SearchAndReplaceAllAscii( "%NAME", OUSTR("shared")); + dp_misc::ProgressLevel progressShared(xCmdEnv, sSynchronizingShared); + bModified = m_sharedRepository->synchronize(xAbortChannel, xCmdEnv); + progressShared.update(OUSTR("\n\n")); + + String sSynchronizingBundled(StrSyncRepository::get()); + sSynchronizingBundled.SearchAndReplaceAllAscii( "%NAME", OUSTR("bundled")); + dp_misc::ProgressLevel progressBundled(xCmdEnv, sSynchronizingBundled); + bModified |= m_bundledRepository->synchronize(xAbortChannel, xCmdEnv); + progressBundled.update(OUSTR("\n\n")); - bModified = xPackageManager->synchronize(xAbortChannel, xCmdEnv); try { const uno::Sequence > > @@ -1082,31 +1087,8 @@ sal_Bool ExtensionManager::synchronize( //so we will no repeat this everytime OOo starts. OSL_ENSURE(0, "Extensions Manager: synchronize"); } - - - progress.update(OUSTR("\n\n")); - - //Write the lastmodified file - try { - ::rtl::Bootstrap::expandMacros(file); - ::ucbhelper::Content ucbStamp(file, xCmdEnv ); - dp_misc::erase_path( file, xCmdEnv ); - ::rtl::OString stamp("1" ); - Reference xData( - ::xmlscript::createInputStream( - ::rtl::ByteSequence( - reinterpret_cast(stamp.getStr()), - stamp.getLength() ) ) ); - ucbStamp.writeStream( xData, true /* replace existing */ ); - } - catch(...) - { - uno::Any exc(::cppu::getCaughtException()); - throw deploy::DeploymentException( - OUSTR("Failed to update") + file, - static_cast(this), exc); - - } + writeLastModified(OUSTR("$BUNDLED_EXTENSIONS_USER/lastsynchronized"), xCmdEnv); + writeLastModified(OUSTR("$SHARED_EXTENSIONS_USER/lastsynchronized"), xCmdEnv); return bModified; } catch (deploy::DeploymentException& ) { throw; diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index 4367770945aa..ad0e7d95df7e 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -186,7 +186,6 @@ public: css::uno::RuntimeException); virtual sal_Bool SAL_CALL synchronize( - ::rtl::OUString const & repository, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ) throw (css::deployment::DeploymentException, diff --git a/desktop/source/deployment/manager/dp_informationprovider.cxx b/desktop/source/deployment/manager/dp_informationprovider.cxx index 9f2e0c9e1177..537b7233ef77 100644 --- a/desktop/source/deployment/manager/dp_informationprovider.cxx +++ b/desktop/source/deployment/manager/dp_informationprovider.cxx @@ -32,11 +32,10 @@ #include "comphelper/servicedecl.hxx" -#include "com/sun/star/deployment/thePackageManagerFactory.hpp" #include "com/sun/star/deployment/UpdateInformationProvider.hpp" #include "com/sun/star/deployment/XPackage.hpp" #include "com/sun/star/deployment/XPackageInformationProvider.hpp" -#include "com/sun/star/deployment/XPackageManager.hpp" +#include "com/sun/star/deployment/ExtensionManager.hpp" #include "com/sun/star/deployment/XUpdateInformationProvider.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/registry/XRegistryKey.hpp" @@ -104,7 +103,7 @@ private: uno::Reference< uno::XComponentContext> mxContext; - rtl::OUString getPackageLocation( const uno::Reference< deployment::XPackageManager > _xManager, + rtl::OUString getPackageLocation( const rtl::OUString& repository, const rtl::OUString& _sExtensionId ); uno::Reference< deployment::XUpdateInformationProvider > mxUpdateInformation; @@ -113,10 +112,9 @@ private: getUpdateInformation( uno::Sequence< rtl::OUString > const & urls, rtl::OUString const & identifier ) const; uno::Sequence< uno::Reference< deployment::XPackage > > - getPackages( const uno::Reference< deployment::XPackageManager > _xManager ); - uno::Sequence< uno::Sequence< rtl::OUString > > isUpdateAvailable( const uno::Reference< deployment::XPackageManager > _xManager, - const rtl::OUString& _sExtensionId ); - uno::Sequence< uno::Sequence< rtl::OUString > > getExtensionList( const uno::Reference< deployment::XPackageManager > _xManager ); + getPackages(rtl::OUString const & repository); + uno::Sequence< uno::Sequence< rtl::OUString > > isUpdateAvailable( + rtl::OUString const & repository, const rtl::OUString& _sExtensionId ); uno::Sequence< uno::Sequence< rtl::OUString > > concatLists( uno::Sequence< uno::Sequence< rtl::OUString > > aFirst, uno::Sequence< uno::Sequence< rtl::OUString > > aSecond ); }; @@ -148,15 +146,18 @@ void SAL_CALL PackageInformationProvider::handle( uno::Reference< task::XInterac //------------------------------------------------------------------------------ rtl::OUString PackageInformationProvider::getPackageLocation( - const uno::Reference< deployment::XPackageManager > _xManager, - const rtl::OUString& _rExtensionId ) + const rtl::OUString & repository, + const rtl::OUString& _rExtensionId ) { rtl::OUString aLocationURL; + uno::Reference xManager = + deployment::ExtensionManager::get(mxContext); - if ( _xManager.is() ) + if ( xManager.is() ) { const uno::Sequence< uno::Reference< deployment::XPackage > > packages( - _xManager->getDeployedPackages( + xManager->getDeployedExtensions( + repository, uno::Reference< task::XAbortChannel >(), static_cast < XCommandEnvironment *> (this) ) ); @@ -187,32 +188,21 @@ rtl::OUString SAL_CALL PackageInformationProvider::getPackageLocation( const rtl::OUString& _sExtensionId ) throw ( uno::RuntimeException ) { - uno::Reference< deployment::XPackageManager > xManager; - try { - xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("user") ); - } - catch ( css_ucb::CommandFailedException & ){} - catch ( uno::RuntimeException & ) {} - - rtl::OUString aLocationURL = getPackageLocation( xManager, _sExtensionId ); + rtl::OUString aLocationURL = getPackageLocation( UNISTRING("user"), _sExtensionId ); if ( aLocationURL.getLength() == 0 ) { - try { - xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("shared") ); - } - catch ( css_ucb::CommandFailedException & ){} - catch ( uno::RuntimeException & ) {} - - aLocationURL = getPackageLocation( xManager, _sExtensionId ); + aLocationURL = getPackageLocation( UNISTRING("shared"), _sExtensionId ); + } + if ( aLocationURL.getLength() == 0 ) + { + aLocationURL = getPackageLocation( UNISTRING("bundled"), _sExtensionId ); } - if ( aLocationURL.getLength() ) { ::ucbhelper::Content aContent( aLocationURL, NULL ); aLocationURL = aContent.getURL(); } - return aLocationURL; } @@ -222,75 +212,76 @@ uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL PackageInformationProvider::isUpdateAvailable( const rtl::OUString& _sExtensionId ) throw ( uno::RuntimeException ) { - uno::Sequence< uno::Sequence< rtl::OUString > > aUpdateListUser; + uno::Sequence< uno::Sequence< rtl::OUString > > + aUpdateListUser = isUpdateAvailable( UNISTRING("user"), _sExtensionId ); - uno::Reference< deployment::XPackageManager > xManager; - try { - xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("user") ); - } - catch ( css_ucb::CommandFailedException & ){} - catch ( uno::RuntimeException & ) {} + uno::Sequence< uno::Sequence< rtl::OUString > > + aUpdateListShared = isUpdateAvailable( UNISTRING("shared"), _sExtensionId ); - aUpdateListUser = isUpdateAvailable( xManager, _sExtensionId ); + uno::Sequence< uno::Sequence< rtl::OUString > > + aUpdateListBundled = isUpdateAvailable( UNISTRING("bundled"), _sExtensionId ); - uno::Sequence< uno::Sequence< rtl::OUString > > aUpdateListShared; - try { - xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("shared") ); - } - catch ( css_ucb::CommandFailedException & ){} - catch ( uno::RuntimeException & ) {} - - aUpdateListShared = isUpdateAvailable( xManager, _sExtensionId ); - - if ( !aUpdateListUser.hasElements() ) - return aUpdateListShared; - else if ( !aUpdateListShared.hasElements() ) - return aUpdateListUser; - else - return concatLists( aUpdateListUser, aUpdateListShared ); + uno::Sequence< uno::Sequence< rtl::OUString > > user_shared = + concatLists( aUpdateListUser, aUpdateListShared ); + return concatLists(user_shared, aUpdateListBundled); } //------------------------------------------------------------------------------ uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL PackageInformationProvider::getExtensionList() throw ( uno::RuntimeException ) { - uno::Sequence< uno::Sequence< rtl::OUString > > aListUser; + const uno::Reference mgr = + deployment::ExtensionManager::get(mxContext); - uno::Reference< deployment::XPackageManager > xManager; - try { - xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("user") ); - } - catch ( css_ucb::CommandFailedException & ){} - catch ( uno::RuntimeException & ) {} + if (!mgr.is()) + return uno::Sequence< uno::Sequence< rtl::OUString > >(); - aListUser = getExtensionList( xManager ); + const uno::Sequence< uno::Sequence< uno::Reference > > + allExt = mgr->getAllExtensions( + uno::Reference< task::XAbortChannel >(), + static_cast < XCommandEnvironment *> (this) ); - uno::Sequence< uno::Sequence< rtl::OUString > > aListShared; - try { - xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("shared") ); - } - catch ( css_ucb::CommandFailedException & ){} - catch ( uno::RuntimeException & ) {} + uno::Sequence< uno::Sequence< rtl::OUString > > retList; - aListShared = getExtensionList( xManager ); + sal_Int32 cAllIds = allExt.getLength(); + retList.realloc(cAllIds); - if ( !aListUser.hasElements() ) - return aListShared; - else if ( !aListShared.hasElements() ) - return aListUser; - else - return concatLists( aListUser, aListShared ); + for (sal_Int32 i = 0; i < cAllIds; i++) + { + //The inner sequence contains extensions with the same identifier from + //all the different repositories, that is user, share, bundled. + const uno::Sequence< uno::Reference< deployment::XPackage > > & + seqExtension = allExt[i]; + sal_Int32 cExt = seqExtension.getLength(); + OSL_ASSERT(cExt == 3); + for (sal_Int32 j = 0; j < cExt; j++) + { + //ToDo according to the old code the first found extenions is used + //even if another one with the same id has a better version. Design flaw? + uno::Reference< deployment::XPackage > const & xExtension( seqExtension[j] ); + if (xExtension.is()) + { + rtl::OUString aNewEntry[2]; + aNewEntry[0] = dp_misc::getIdentifier(xExtension); + aNewEntry[1] = xExtension->getVersion(); + retList[i] = ::uno::Sequence< rtl::OUString >( aNewEntry, 2 ); + break; + } + } + } + return retList; } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ uno::Sequence< uno::Reference< deployment::XPackage > > - PackageInformationProvider::getPackages( const uno::Reference< deployment::XPackageManager > _xMgr ) +PackageInformationProvider::getPackages( const rtl::OUString & repository ) { uno::Sequence< uno::Reference< deployment::XPackage > > packages; try { - packages = _xMgr->getDeployedPackages( uno::Reference< task::XAbortChannel >(), + uno::Reference xMgr = deployment::ExtensionManager::get(mxContext); + packages = xMgr->getDeployedExtensions(repository, uno::Reference< task::XAbortChannel >(), static_cast < XCommandEnvironment *> (this) ); } catch ( deployment::DeploymentException & ) @@ -329,18 +320,19 @@ uno::Sequence< uno::Reference< xml::dom::XElement > > //------------------------------------------------------------------------------ uno::Sequence< uno::Sequence< rtl::OUString > > PackageInformationProvider::isUpdateAvailable( - const uno::Reference< deployment::XPackageManager > _xManager, - const rtl::OUString& _sExtensionId ) + const rtl::OUString& repository, + const rtl::OUString& _sExtensionId ) { uno::Sequence< uno::Sequence< rtl::OUString > > aList; sal_Int32 nCount = 0; bool bPackageFound = false; + uno::Reference xManager = deployment::ExtensionManager::get(mxContext); // If the package manager is readonly then the user cannot modify anything anyway // so we can abort the search here - if ( _xManager.is() && ! _xManager->isReadOnly() ) + if ( xManager.is() && ! xManager->isReadOnlyRepository(repository) ) { - uno::Sequence< uno::Reference< deployment::XPackage > > packages( getPackages( _xManager ) ); + uno::Sequence< uno::Reference< deployment::XPackage > > packages( getPackages( repository ) ); uno::Sequence< uno::Reference< xml::dom::XElement > > defaultInfos; for ( int pos = packages.getLength(); pos-- && !bPackageFound; ) @@ -412,32 +404,6 @@ uno::Sequence< uno::Sequence< rtl::OUString > > return aList; } -//------------------------------------------------------------------------------ -uno::Sequence< uno::Sequence< rtl::OUString > > - PackageInformationProvider::getExtensionList( - const uno::Reference< deployment::XPackageManager > _xManager ) -{ - uno::Sequence< uno::Sequence< rtl::OUString > > aList; - - if ( _xManager.is() ) - { - uno::Sequence< uno::Reference< deployment::XPackage > > packages( getPackages( _xManager ) ); - - aList.realloc( packages.getLength() ); - - for ( int pos = packages.getLength(); pos--; ) - { - uno::Reference< deployment::XPackage > package( packages[ pos ] ); - rtl::OUString aNewEntry[2]; - - aNewEntry[0] = dp_misc::getIdentifier( package ); - aNewEntry[1] = package->getVersion(); - aList[ pos ] = ::uno::Sequence< rtl::OUString >( aNewEntry, 2 ); - } - } - return aList; -} - //------------------------------------------------------------------------------ uno::Sequence< uno::Sequence< rtl::OUString > > PackageInformationProvider::concatLists( uno::Sequence< uno::Sequence< rtl::OUString > > aFirst, diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 3867f741f982..5269e3d8aac5 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -603,8 +603,8 @@ void syncRepositories(Reference const & xCmdEnv) //synchronize shared before bundled otherewise there are //more revoke and registration calls. sal_Bool bModified = false; - const OUString sShared(RTL_CONSTASCII_USTRINGPARAM("shared")); - if (needToSyncRepostitory(sShared)) + if (needToSyncRepostitory(OUString(RTL_CONSTASCII_USTRINGPARAM("shared"))) + || needToSyncRepostitory(OUString(RTL_CONSTASCII_USTRINGPARAM("bundled")))) { xExtensionManager = deployment::ExtensionManager::get( @@ -613,23 +613,7 @@ void syncRepositories(Reference const & xCmdEnv) if (xExtensionManager.is()) { bModified = xExtensionManager->synchronize( - sShared, Reference(), xCmdEnv); - } - } - - const OUString sBundled(RTL_CONSTASCII_USTRINGPARAM("bundled")); - if (needToSyncRepostitory( sBundled)) - { - if (!xExtensionManager.is()) - { - xExtensionManager = - deployment::ExtensionManager::get( - comphelper_getProcessComponentContext()); - } - if (xExtensionManager.is()) - { - bModified |= xExtensionManager->synchronize( - sBundled, Reference(), xCmdEnv); + Reference(), xCmdEnv); } } -- cgit From 7668f1f0a853091d9e24d8dcce104e6081789a55 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Fri, 21 May 2010 15:13:26 +0200 Subject: jl152 #i77196# unopkg reinstall works now --- .../deployment/manager/dp_extensionmanager.cxx | 12 ++++++-- desktop/source/pkgchk/unopkg/unopkg_app.cxx | 34 ++++++++++++++++++---- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 2781231b8f5e..fddefb5ad277 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -994,6 +994,7 @@ uno::Sequence< uno::Sequence > > } } +//only to be called from unopkg!!! void ExtensionManager::reinstallDeployedExtensions( OUString const & repository, Reference const & xAbortChannel, @@ -1009,6 +1010,9 @@ void ExtensionManager::reinstallDeployedExtensions( ::osl::MutexGuard guard(getMutex()); xPackageManager->reinstallDeployedPackages(xAbortChannel, xCmdEnv); + //We must sync here, otherwise we will get exceptions when extensions + //are removed. + dp_misc::syncRepositories(xCmdEnv); const uno::Sequence< Reference > extensions( xPackageManager->getDeployedPackages(xAbortChannel, xCmdEnv)); @@ -1087,8 +1091,12 @@ sal_Bool ExtensionManager::synchronize( //so we will no repeat this everytime OOo starts. OSL_ENSURE(0, "Extensions Manager: synchronize"); } - writeLastModified(OUSTR("$BUNDLED_EXTENSIONS_USER/lastsynchronized"), xCmdEnv); - writeLastModified(OUSTR("$SHARED_EXTENSIONS_USER/lastsynchronized"), xCmdEnv); + OUString lastSyncBundled(RTL_CONSTASCII_USTRINGPARAM( + "$BUNDLED_EXTENSIONS_USER/lastsynchronized")); + writeLastModified(lastSyncBundled, xCmdEnv); + OUString lastSyncShared(RTL_CONSTASCII_USTRINGPARAM( + "$SHARED_EXTENSIONS_USER/lastsynchronized")); + writeLastModified(lastSyncShared, xCmdEnv); return bModified; } catch (deploy::DeploymentException& ) { throw; diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 2f4a7f1d7146..621b8b0bac7c 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -35,6 +35,7 @@ #include "tools/extendapplicationenvironment.hxx" #include "rtl/ustrbuf.hxx" #include "rtl/uri.hxx" +#include "rtl/bootstrap.hxx" #include "osl/thread.h" #include "osl/process.h" #include "osl/conditn.hxx" @@ -331,10 +332,6 @@ extern "C" int unopkg_main() } } - xComponentContext = getUNO( - disposeGuard, option_verbose, option_shared, subcmd_gui, - xLocalComponentContext ); - if (repository.getLength() == 0) { if (option_shared) @@ -359,6 +356,29 @@ extern "C" int unopkg_main() } } + if (subCommand.equals(OUSTR("reinstall"))) + { + //We must prevent that services and types are loaded by UNO, + //otherwise we cannot delete the registry data folder. + OUString extensionUnorc; + if (repository.equals(OUSTR("user"))) + extensionUnorc = OUSTR("$UNO_USER_PACKAGES_CACHE/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc"); + else if (repository.equals(OUSTR("shared"))) + extensionUnorc = OUSTR("$SHARED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc"); + else if (repository.equals(OUSTR("bundled"))) + extensionUnorc = OUSTR("$BUNDLED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc"); + else + OSL_ASSERT(0); + + ::rtl::Bootstrap::expandMacros(extensionUnorc); + oslFileError e = osl_removeFile(extensionUnorc.pData); + if (e != osl_File_E_None && e != osl_File_E_NOENT) + throw Exception(OUSTR("Could not delete ") + extensionUnorc, 0); + } + + xComponentContext = getUNO( + disposeGuard, option_verbose, option_shared, subcmd_gui, + xLocalComponentContext ); Reference xExtensionManager( deployment::ExtensionManager::get( xComponentContext ) ); @@ -368,7 +388,11 @@ extern "C" int unopkg_main() option_force, option_verbose) ); //synchronize bundled/shared extensions - if (!subcmd_gui && ! dp_misc::office_is_running()) + //Do not synchronize when command is "reinstall". This could add types and services to UNO and + //prevent the deletion of the registry data folder + //synching is done in XExtensionManager.reinstall + if (!subcmd_gui && ! subCommand.equals(OUSTR("reinstall")) + && ! dp_misc::office_is_running()) dp_misc::syncRepositories(xCmdEnv); if (subcmd_add || -- cgit From 3d3b46bb623c859265d2b95068845b18a1b64716 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Fri, 21 May 2010 16:17:24 +0200 Subject: jl152 #i77196# dp_misc::sycnRepositories cannot be switched off with bootstrap variable, because it is not necessary fro the perfomance test --- desktop/source/app/check_ext_deps.cxx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index 757135a7e2d3..e9c71bc1ea36 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -396,10 +396,5 @@ sal_Bool Desktop::CheckExtensionDependencies() void Desktop::SynchronizeExtensionRepositories() { RTL_LOGFILE_CONTEXT(aLog,"desktop (jl) ::Desktop::SynchronizeExtensionRepositories"); - OUString sDisable; - ::rtl::Bootstrap::get( UNISTRING( "DISABLE_SYNC_EXTENSIONS" ), sDisable, OUString() ); - if (sDisable.getLength() > 0) - return; - dp_misc::syncRepositories( new SilentCommandEnv( this ) ); } -- cgit From 8d8f9bc029e9dec0bcc74846095661e9090a8789 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Fri, 21 May 2010 16:46:32 +0200 Subject: dr76: #i103453# import visual area for embedded documents --- desktop/source/migration/migration.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 2181daab7454..b9be788ebd4b 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -232,6 +232,7 @@ static void insertSorted(migrations_available& rAvailableMigrations, supported_m { rAvailableMigrations.insert(pIter, aSupportedMigration ); bInserted = true; + break; } ++pIter; } -- cgit From 5186da3ad7783a49efb08064f9cf380754c3f4bd Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 24 May 2010 11:28:33 +0100 Subject: cmcfixes75: #i111796# check ftruncate return value --- shell/source/unix/sysshell/recently_used_file.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/source/unix/sysshell/recently_used_file.cxx b/shell/source/unix/sysshell/recently_used_file.cxx index cc4fbf75adcc..8a9de90c8b16 100644 --- a/shell/source/unix/sysshell/recently_used_file.cxx +++ b/shell/source/unix/sysshell/recently_used_file.cxx @@ -114,7 +114,8 @@ void recently_used_file::reset() const //------------------------------------------------ void recently_used_file::truncate(off_t length) { - ftruncate(fileno(file_), length); + if (ftruncate(fileno(file_), length) == -1) + throw "I/O error: ftruncate failed"; } //------------------------------------------------ -- cgit From de8796345a26ebc4607cfd0fd10b303c20b866e9 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 25 May 2010 11:45:06 +0200 Subject: cws tl79: #i110254# security tab page in 'File/Properties' --- sfx2/inc/sfx2/objsh.hxx | 2 + sfx2/inc/sfx2/sfx.hrc | 4 +- sfx2/source/dialog/securitypage.cxx | 163 ++++++++++++++++++++++-------------- sfx2/source/dialog/securitypage.src | 8 ++ sfx2/source/doc/objxtor.cxx | 16 ++++ 5 files changed, 127 insertions(+), 66 deletions(-) diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 7984fae956cb..3e3448de4753 100755 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -686,6 +686,8 @@ public: // change recording and respective passwword protection for Writer and Calc // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT + virtual bool IsChangeRecording() const; + virtual bool HasChangeRecordProtection() const; virtual void SetChangeRecording( bool bActivate ); virtual bool SetProtectionPassword( const String &rPassword ); virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ); diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc index 3ed7f34ee3b8..a49b003b5b49 100755 --- a/sfx2/inc/sfx2/sfx.hrc +++ b/sfx2/inc/sfx2/sfx.hrc @@ -234,7 +234,9 @@ #define TP_MANAGE_STYLES (RID_SFX_START+7) #define DLG_STYLE_DESIGNER (RID_SFX_START+8) -#define RID_SFX_INCORRECT_PASSWORD (RID_SFX_START+216) +#define RID_SFX_PROTECT_RECORDS (RID_SFX_START+216) +#define RID_SFX_UNPROTECT_RECORDS (RID_SFX_START+217) +#define RID_SFX_INCORRECT_PASSWORD (RID_SFX_START+218) #define STR_STYLE_FILTER_AUTO (RID_SFX_START+9) #define STR_STYLE_FILTER_USED (RID_SFX_START+10) diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index f88525107f1c..0c6688ab1229 100755 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -53,43 +53,6 @@ using namespace ::com::sun::star; -////////////////////////////////////////////////////////////////////// - -static short lcl_GetPassword( Window *pParent, bool bShowConfirm, /*out*/String &rPassword ) -{ - bool bRes = false; - SfxPasswordDialog aPasswdDlg( pParent ); - if (bShowConfirm) - aPasswdDlg.ShowExtras( SHOWEXTRAS_CONFIRM ); - if (RET_OK == aPasswdDlg.Execute() && aPasswdDlg.GetPassword().Len() > 0) - { - rPassword = aPasswdDlg.GetPassword(); - bRes = true; - } - return bRes; -} - - -static bool lcl_IsPasswordCorrect( const String &rPassword ) -{ - bool bRes = false; - - SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); - uno::Sequence< sal_Int8 > aPasswordHash; - bool bHasPassword = pCurDocShell->GetProtectionHash( aPasswordHash ); - - // check if supplied password was correct - uno::Sequence< sal_Int8 > aNewPasswd( aPasswordHash ); - SvPasswordHelper::GetHashPassword( aNewPasswd, rPassword ); - if (SvPasswordHelper::CompareHashPassword( aPasswordHash, rPassword )) - bRes = true; // password was correct - else - InfoBox( NULL, String( SfxResId( RID_SFX_INCORRECT_PASSWORD ) ) ).Execute(); - - return bRes; -} - - ////////////////////////////////////////////////////////////////////// @@ -98,6 +61,21 @@ namespace enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC }; enum RedlineFunc { RF_ON, RF_PROTECT }; +/* + bool QueryIsEnabled( USHORT _nSlot ) + { + bool bRes = false; + SfxViewShell* pViewSh = SfxViewShell::Current(); + if (pViewSh) + { + const SfxPoolItem* pItem; + SfxDispatcher* pDisp = pViewSh->GetDispatcher(); + SfxItemState eState = pDisp->QueryState( _nSlot, pItem ); + bRes = (eState & SFX_ITEM_DISABLED) == 0; + } + return bRes; + } +*/ bool QueryState( USHORT _nSlot, bool& _rValue ) { @@ -107,7 +85,8 @@ namespace { const SfxPoolItem* pItem; SfxDispatcher* pDisp = pViewSh->GetDispatcher(); - bRet = SFX_ITEM_AVAILABLE <= pDisp->QueryState( _nSlot, pItem ); + SfxItemState nState = pDisp->QueryState( _nSlot, pItem ); + bRet = SFX_ITEM_AVAILABLE <= nState; if (bRet) _rValue = ( static_cast< const SfxBoolItem* >( pItem ) )->GetValue(); } @@ -143,6 +122,50 @@ namespace ////////////////////////////////////////////////////////////////////// +static short lcl_GetPassword( + Window *pParent, + bool bProtect, + /*out*/String &rPassword ) +{ + bool bRes = false; + SfxPasswordDialog aPasswdDlg( pParent ); + const String aTitle( SfxResId( bProtect ? RID_SFX_PROTECT_RECORDS : RID_SFX_UNPROTECT_RECORDS ) ); + aPasswdDlg.SetText( aTitle ); + aPasswdDlg.SetMinLen( 1 ); + if (bProtect) + aPasswdDlg.ShowExtras( SHOWEXTRAS_CONFIRM ); + if (RET_OK == aPasswdDlg.Execute() && aPasswdDlg.GetPassword().Len() > 0) + { + rPassword = aPasswdDlg.GetPassword(); + bRes = true; + } + return bRes; +} + + +static bool lcl_IsPasswordCorrect( const String &rPassword ) +{ + bool bRes = false; + + SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); + uno::Sequence< sal_Int8 > aPasswordHash; + bool bHasPassword = pCurDocShell->GetProtectionHash( aPasswordHash ); + + // check if supplied password was correct + uno::Sequence< sal_Int8 > aNewPasswd( aPasswordHash ); + SvPasswordHelper::GetHashPassword( aNewPasswd, rPassword ); + if (SvPasswordHelper::CompareHashPassword( aPasswordHash, rPassword )) + bRes = true; // password was correct + else + InfoBox( NULL, String( SfxResId( RID_SFX_INCORRECT_PASSWORD ) ) ).Execute(); + + return bRes; +} + + +////////////////////////////////////////////////////////////////////// + + struct SfxSecurityPage_Impl { SfxSecurityPage & m_rMyTabPage; @@ -235,39 +258,43 @@ BOOL SfxSecurityPage_Impl::FillItemSet_Impl( SfxItemSet & ) bool bModified = false; SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); - if (pCurDocShell) + if (pCurDocShell&& !pCurDocShell->IsReadOnly()) { - if (m_eRedlingMode != RL_NONE && !pCurDocShell->IsReadOnly()) + if (m_eRedlingMode != RL_NONE ) { - // change recording - const bool bDoRecordChanges = m_aRecordChangesCB.IsChecked(); - pCurDocShell->SetChangeRecording( bDoRecordChanges ); + const bool bDoRecordChanges = m_aRecordChangesCB.IsChecked(); + const bool bDoChangeProtection = m_aChangeProtectionPB.GetText() != m_aProtectSTR; + + // sanity checks + DBG_ASSERT( bDoRecordChanges || !bDoChangeProtection, "no change recording should imply no change protection" ); + DBG_ASSERT( bDoChangeProtection || !bDoRecordChanges, "no change protection should imply no change recording" ); + DBG_ASSERT( !bDoChangeProtection || m_aNewPassword.Len() > 0, "change protection should imply password length is > 0" ); + DBG_ASSERT( bDoChangeProtection || m_aNewPassword.Len() == 0, "no change protection should imply password length is 0" ); - // no change recording should imply no password protection - if (!bDoRecordChanges && (!m_bNewPasswordIsValid || m_aNewPassword.Len() != 0)) + // change recording + if (bDoRecordChanges != pCurDocShell->IsChangeRecording()) { - // actually this should not be possible. Thus just as 'coded comment': - DBG_ASSERT( 0, "unexpected state of UI" ); - m_bNewPasswordIsValid = true; - m_aNewPassword = String(); + pCurDocShell->SetChangeRecording( bDoRecordChanges ); + bModified = true; } // change record protection - if (m_bNewPasswordIsValid) + if (m_bNewPasswordIsValid && + bDoChangeProtection != pCurDocShell->HasChangeRecordProtection()) { - const bool bDoChangeProtection = m_aChangeProtectionPB.GetText() != m_aProtectSTR; DBG_ASSERT( !bDoChangeProtection || bDoRecordChanges, "change protection requires record changes to be active!" ); pCurDocShell->SetProtectionPassword( m_aNewPassword ); + bModified = true; } - - bModified = true; } // open read-only? - if (pCurDocShell->HasSecurityOptOpenReadOnly()) + const sal_Bool bDoOpenReadonly = m_aOpenReadonlyCB.IsChecked(); + if (pCurDocShell->HasSecurityOptOpenReadOnly() && + bDoOpenReadonly != pCurDocShell->IsSecurityOptOpenReadOnly()) { - pCurDocShell->SetSecurityOptOpenReadOnly( m_aOpenReadonlyCB.IsChecked() ); + pCurDocShell->SetSecurityOptOpenReadOnly( bDoOpenReadonly ); bModified = true; } } @@ -333,16 +360,22 @@ void SfxSecurityPage_Impl::Reset_Impl( const SfxItemSet & ) m_aRecordChangesCB.Check( bRecordChanges ); m_aRecordChangesCB.Enable( /*!bProtection && */!bIsReadonly ); - DBG_ASSERT( pCurDocShell, "doc shell missing" ); - if (pCurDocShell) - { - m_bOrigPasswordIsConfirmed = true; // default case if no password is set - uno::Sequence< sal_Int8 > aPasswordHash; - // check if password is available - if (pCurDocShell->GetProtectionHash( aPasswordHash ) && - aPasswordHash.getLength() > 0) - m_bOrigPasswordIsConfirmed = false; // password found, needs to be confirmed later on - } + m_bOrigPasswordIsConfirmed = true; // default case if no password is set + uno::Sequence< sal_Int8 > aPasswordHash; + // check if password is available + if (pCurDocShell->GetProtectionHash( aPasswordHash ) && + aPasswordHash.getLength() > 0) + m_bOrigPasswordIsConfirmed = false; // password found, needs to be confirmed later on + } + else + { + // A Calc document that is shared will have 'm_eRedlingMode == RL_NONE' + // In shared documents change recording and protection must be disabled, + // similar to documents that do not support change recording at all. + m_aRecordChangesCB.Check( FALSE ); + m_aRecordChangesCB.Disable(); + m_aChangeProtectionPB.Check( FALSE ); + m_aChangeProtectionPB.Disable(); } } diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src index 4bf8cdaf58a9..7c0fffd96057 100755 --- a/sfx2/source/dialog/securitypage.src +++ b/sfx2/source/dialog/securitypage.src @@ -150,6 +150,14 @@ TabPage TP_DOCINFOSECURITY }; }; +String RID_SFX_PROTECT_RECORDS +{ + Text [ en-US ] = "Protect Records" ; +}; +String RID_SFX_UNPROTECT_RECORDS +{ + Text [ en-US ] = "Unprotect Records" ; +}; String RID_SFX_INCORRECT_PASSWORD { Text [ en-US ] = "Incorrect password" ; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 751525910958..fdbd2b6a5cf0 100755 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -1076,6 +1076,22 @@ void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew ) } +bool SfxObjectShell::IsChangeRecording() const +{ + // currently this function needs to be overwritten by Writer and Calc only + DBG_ASSERT( 0, "function not implemented" ); + return false; +} + + +bool SfxObjectShell::HasChangeRecordProtection() const +{ + // currently this function needs to be overwritten by Writer and Calc only + DBG_ASSERT( 0, "function not implemented" ); + return false; +} + + void SfxObjectShell::SetChangeRecording( bool /*bActivate*/ ) { // currently this function needs to be overwritten by Writer and Calc only -- cgit From 6b4917460417793350ed406aa0742ec31ef6ca3c Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 26 May 2010 08:13:07 +0200 Subject: cws tl79: warning-free code --- sfx2/source/dialog/securitypage.cxx | 2 +- sfx2/source/doc/objxtor.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index 0c6688ab1229..d32ee843cbf2 100755 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -149,7 +149,7 @@ static bool lcl_IsPasswordCorrect( const String &rPassword ) SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); uno::Sequence< sal_Int8 > aPasswordHash; - bool bHasPassword = pCurDocShell->GetProtectionHash( aPasswordHash ); + pCurDocShell->GetProtectionHash( aPasswordHash ); // check if supplied password was correct uno::Sequence< sal_Int8 > aNewPasswd( aPasswordHash ); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index fdbd2b6a5cf0..217faeca2e55 100755 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -1099,7 +1099,7 @@ void SfxObjectShell::SetChangeRecording( bool /*bActivate*/ ) } -bool SfxObjectShell::SetProtectionPassword( const String &rPassword ) +bool SfxObjectShell::SetProtectionPassword( const String & /*rPassword*/ ) { // currently this function needs to be overwritten by Writer and Calc only DBG_ASSERT( 0, "function not implemented" ); -- cgit From 16d2852d25a1c2c90ac5a2f90f7753564b082afc Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 26 May 2010 10:22:48 +0200 Subject: vcl112: #i111819# resolve aliases --- fpicker/source/aqua/FilterHelper.cxx | 11 +++++++++++ fpicker/source/aqua/NSURL_OOoAdditions.hxx | 13 +++++++++---- fpicker/source/aqua/NSURL_OOoAdditions.mm | 30 ++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/fpicker/source/aqua/FilterHelper.cxx b/fpicker/source/aqua/FilterHelper.cxx index 10e429f201c5..9c644326005e 100644 --- a/fpicker/source/aqua/FilterHelper.cxx +++ b/fpicker/source/aqua/FilterHelper.cxx @@ -35,6 +35,7 @@ // #endif #include "CFStringUtilities.hxx" #include "NSString_OOoAdditions.hxx" +#include "NSURL_OOoAdditions.hxx" #include "FilterHelper.hxx" @@ -428,6 +429,16 @@ sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename) } } + // might be an alias + NSString* pResolved = resolveAlias( sFilename ); + if( pResolved ) + { + sal_Bool bResult = filenameMatchesFilter( pResolved ); + [pResolved autorelease]; + if( bResult ) + return sal_True; + } + DBG_PRINT_EXIT(CLASS_NAME, __func__); return sal_False; diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.hxx b/fpicker/source/aqua/NSURL_OOoAdditions.hxx index 8be2c0362096..31b55385e155 100644 --- a/fpicker/source/aqua/NSURL_OOoAdditions.hxx +++ b/fpicker/source/aqua/NSURL_OOoAdditions.hxx @@ -29,15 +29,20 @@ #define _NSURL_OOOADDITIONS_HXX_ #include -#include +#include #include #include "CFStringUtilities.hxx" #include -// #include - @interface NSURL (OOoAdditions) - (rtl::OUString) OUStringForInfo:(InfoType)info; @end -#endif \ No newline at end of file +/* + returns the resolved string if there was an alias + if there was no alias, nil is returned +*/ + +NSString* resolveAlias( NSString* i_pSystemPath ); + +#endif diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.mm b/fpicker/source/aqua/NSURL_OOoAdditions.mm index 56fc198650c8..ecc38b7e232b 100644 --- a/fpicker/source/aqua/NSURL_OOoAdditions.mm +++ b/fpicker/source/aqua/NSURL_OOoAdditions.mm @@ -80,3 +80,33 @@ return sResult; } @end + +NSString* resolveAlias( NSString* i_pSystemPath ) +{ + NSString* pResolvedPath = nil; + CFURLRef rUrl = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, + (CFStringRef)i_pSystemPath, + kCFURLPOSIXPathStyle, false); + if( rUrl != NULL ) + { + FSRef rFS; + if( CFURLGetFSRef( rUrl, &rFS ) ) + { + MacOSBoolean bIsFolder = false; + MacOSBoolean bAlias = false; + OSErr err = FSResolveAliasFile( &rFS, true, &bIsFolder, &bAlias); + if( (err == noErr) && bAlias ) + { + CFURLRef rResolvedUrl = CFURLCreateFromFSRef( kCFAllocatorDefault, &rFS ); + if( rResolvedUrl != NULL ) + { + pResolvedPath = (NSString*)CFURLCopyFileSystemPath( rResolvedUrl, kCFURLPOSIXPathStyle ); + CFRelease( rResolvedUrl ); + } + } + } + CFRelease( rUrl ); + } + + return pResolvedPath; +} -- cgit From 776d5631f5089f94cbe87b6f869f7887aeff2092 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Fri, 28 May 2010 17:50:38 +0200 Subject: jl152 #i77196# new update behavior for extensions --- desktop/source/deployment/gui/dp_gui_dialog2.cxx | 27 +- .../deployment/gui/dp_gui_extensioncmdqueue.cxx | 22 +- .../deployment/gui/dp_gui_extensioncmdqueue.hxx | 3 +- desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 19 +- desktop/source/deployment/gui/dp_gui_theextmgr.hxx | 3 +- .../source/deployment/gui/dp_gui_updatedata.hxx | 35 ++- .../source/deployment/gui/dp_gui_updatedialog.cxx | 331 ++++++++++++++------- .../source/deployment/gui/dp_gui_updatedialog.hxx | 20 +- .../source/deployment/gui/dp_gui_updatedialog.src | 12 - .../deployment/gui/dp_gui_updateinstalldialog.cxx | 43 ++- desktop/source/deployment/inc/dp_misc.h | 46 +++ .../deployment/manager/dp_extensionmanager.cxx | 77 ++++- .../deployment/manager/dp_extensionmanager.hxx | 15 +- .../source/deployment/manager/dp_properties.cxx | 44 ++- .../source/deployment/manager/dp_properties.hxx | 5 + desktop/source/deployment/misc/dp_misc.cxx | 142 +++++++++ 16 files changed, 635 insertions(+), 209 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 086e39e5f18c..35634d5ef851 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -38,6 +38,7 @@ #include "dp_gui_shared.hxx" #include "dp_gui_theextmgr.hxx" #include "dp_misc.h" +#include "dp_identifier.hxx" #include "vcl/ctrl.hxx" #include "vcl/menu.hxx" @@ -105,15 +106,6 @@ struct StrAllFiles : public rtl::StaticWithInit< const OUString, StrAllFiles > } }; -//------------------------------------------------------------------------------ -UpdateListEntry::UpdateListEntry( const uno::Reference< deployment::XPackage > &xPackage ) : - m_xPackage( xPackage ) -{} - -//------------------------------------------------------------------------------ -UpdateListEntry::~UpdateListEntry() -{} - //------------------------------------------------------------------------------ // ExtBoxWithBtns_Impl //------------------------------------------------------------------------------ @@ -849,9 +841,15 @@ bool ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackage > & if ( !xPackage.is() ) return false; - std::vector< TUpdateListEntry > vEntries; - TUpdateListEntry pEntry( new UpdateListEntry( xPackage ) ); - vEntries.push_back( pEntry ); + // get the extension with highest version + uno::Sequence > seqExtensions = + m_pManager->getExtensionManager()->getExtensionsWithSameIdentifier( + dp_misc::getIdentifier(xPackage), xPackage->getName(), uno::Reference()); + uno::Reference extension = + dp_misc::getExtensionWithHighestVersion(seqExtensions); + OSL_ASSERT(extension.is()); + std::vector< css::uno::Reference< css::deployment::XPackage > > vEntries; + vEntries.push_back(extension); m_pManager->updatePackages( vEntries ); @@ -1453,14 +1451,13 @@ IMPL_LINK( UpdateRequiredDialog, HandleUpdateBtn, void*, EMPTYARG ) { ::osl::ClearableMutexGuard aGuard( m_aMutex ); - std::vector< TUpdateListEntry > vUpdateEntries; + std::vector< uno::Reference< deployment::XPackage > > vUpdateEntries; sal_Int32 nCount = m_pExtensionBox->GetEntryCount(); for ( sal_Int32 i = 0; i < nCount; ++i ) { TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( i ); - TUpdateListEntry pUpdateEntry( new UpdateListEntry( pEntry->m_xPackage ) ); - vUpdateEntries.push_back( pUpdateEntry ); + vUpdateEntries.push_back( pEntry->m_xPackage ); } aGuard.clear(); diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 8d82d969c4a0..954f32f4c9c6 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -202,7 +202,7 @@ struct ExtensionCmd OUString m_sExtensionURL; OUString m_sRepository; uno::Reference< deployment::XPackage > m_xPackage; - std::vector< TUpdateListEntry > m_vExtensionList; + std::vector< uno::Reference< deployment::XPackage > > m_vExtensionList; ExtensionCmd( const E_CMD_TYPE eCommand, const OUString &rExtensionURL, @@ -218,7 +218,7 @@ struct ExtensionCmd m_bWarnUser( false ), m_xPackage( rPackage ) {}; ExtensionCmd( const E_CMD_TYPE eCommand, - const std::vector< TUpdateListEntry > &vExtensionList ) + const std::vector > &vExtensionList ) : m_eCmdType( eCommand ), m_bWarnUser( false ), m_vExtensionList( vExtensionList ) {}; @@ -240,7 +240,7 @@ public: void removeExtension( const uno::Reference< deployment::XPackage > &rPackage ); void enableExtension( const uno::Reference< deployment::XPackage > &rPackage, const bool bEnable ); - void checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ); + void checkForUpdates( const std::vector > &vExtensionList ); void stop(); bool isBusy(); @@ -266,7 +266,7 @@ private: const uno::Reference< deployment::XPackage > &xPackage ); void _disableExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv, const uno::Reference< deployment::XPackage > &xPackage ); - void _checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ); + void _checkForUpdates( const std::vector > &vExtensionList ); enum Input { NONE, START, STOP }; @@ -696,7 +696,8 @@ void ExtensionCmdQueue::Thread::enableExtension( const uno::Reference< deploymen } //------------------------------------------------------------------------------ -void ExtensionCmdQueue::Thread::checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ) +void ExtensionCmdQueue::Thread::checkForUpdates( + const std::vector > &vExtensionList ) { ::osl::MutexGuard aGuard( m_mutex ); @@ -924,10 +925,8 @@ void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv try { - uno::Reference< deployment::XPackage > xPackage( - xExtMgr->addExtension(rPackageURL, uno::Sequence(), - rRepository, xAbortChannel, rCmdEnv.get() ) ); - OSL_ASSERT( xPackage.is() ); + xExtMgr->addExtension(rPackageURL, uno::Sequence(), + rRepository, xAbortChannel, rCmdEnv.get() ); } catch ( ucb::CommandFailedException & ) { @@ -969,7 +968,8 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE } //------------------------------------------------------------------------------ -void ExtensionCmdQueue::Thread::_checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ) +void ExtensionCmdQueue::Thread::_checkForUpdates( + const std::vector > &vExtensionList ) { UpdateDialog* pUpdateDialog; std::vector< UpdateData > vData; @@ -1126,7 +1126,7 @@ void ExtensionCmdQueue::enableExtension( const uno::Reference< deployment::XPack m_thread->enableExtension( rPackage, bEnable ); } -void ExtensionCmdQueue::checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ) +void ExtensionCmdQueue::checkForUpdates( const std::vector > &vExtensionList ) { m_thread->checkForUpdates( vExtensionList ); } diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx index 69ad7da24769..cfadad84cedc 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx @@ -83,7 +83,8 @@ public: void removeExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage ); void enableExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage, const bool bEnable ); - void checkForUpdates( const std::vector< TUpdateListEntry > &vList ); + void checkForUpdates(const std::vector< ::com::sun::star::uno::Reference< + ::com::sun::star::deployment::XPackage > > &vList ); /** This call does not block. It signals the internal thread that it should install the remaining extensions and then terminate. diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 7c81517bbbfa..fdbc1974f61c 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -201,7 +201,7 @@ bool TheExtensionManager::isVisible() //------------------------------------------------------------------------------ bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bParentVisible*/ ) { - std::vector< TUpdateListEntry > vEntries; + std::vector< uno::Reference< deployment::XPackage > > vEntries; uno::Sequence< uno::Sequence< uno::Reference< deployment::XPackage > > > xAllPackages; try { @@ -219,17 +219,11 @@ bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bPare for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i ) { - uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i]; - - // we don't want update notifications for bundled packages - for ( sal_Int32 j = 0; ( j < 2 ) && ( j < xPackageList.getLength() ); ++j ) + uno::Reference< deployment::XPackage > xPackage = dp_misc::getExtensionWithHighestVersion(xAllPackages[i]); + OSL_ASSERT(xPackage.is()); + if ( xPackage.is() ) { - uno::Reference< deployment::XPackage > xPackage = xPackageList[j]; - if ( xPackage.is() ) - { - TUpdateListEntry pEntry( new UpdateListEntry( xPackage ) ); - vEntries.push_back( pEntry ); - } + vEntries.push_back( xPackage ); } } @@ -255,7 +249,8 @@ bool TheExtensionManager::removePackage( const uno::Reference< deployment::XPack } //------------------------------------------------------------------------------ -bool TheExtensionManager::updatePackages( const std::vector< TUpdateListEntry > &vList ) +bool TheExtensionManager::updatePackages( + const std::vector< uno::Reference< deployment::XPackage > > &vList ) { m_pExecuteCmdQueue->checkForUpdates( vList ); diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index 02e3aad56915..da8d3c083f42 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -92,7 +92,8 @@ public: //----------------- bool checkUpdates( bool showUpdateOnly, bool parentVisible ); - bool updatePackages( const std::vector< TUpdateListEntry > &vList ); + bool updatePackages( const std::vector< ::com::sun::star::uno::Reference< + ::com::sun::star::deployment::XPackage > > &vList ); bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, bool bEnable ); diff --git a/desktop/source/deployment/gui/dp_gui_updatedata.hxx b/desktop/source/deployment/gui/dp_gui_updatedata.hxx index 2082b92e923a..7228982da518 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedata.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedata.hxx @@ -44,27 +44,42 @@ namespace com { namespace sun { namespace star { namespace xml { namespace dom { namespace dp_gui { -struct UpdateListEntry +struct UpdateData { - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage; + UpdateData( ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > const & aExt): + aInstalledPackage(aExt), bIsShared(false) {}; - UpdateListEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); - ~UpdateListEntry(); -}; + //When entries added to the listbox then there can be one for the user update and one + //for the shared update. However, both list entries will contain the same UpdateData. + //isShared is used to indicate which one is used for the shared entry. + bool bIsShared; -typedef ::boost::shared_ptr< UpdateListEntry > TUpdateListEntry; + //The currently installed extension which is going to be updated. If the extension exist in + //multiple repositories then it is the one with the highest version. + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > aInstalledPackage; + //The version of the update + ::rtl::OUString updateVersion; -struct UpdateData -{ - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > aInstalledPackage; - // The content of the update information + //For online update + // ====================== + // The content of the update information. + //Only if aUpdateInfo is set then there is an online update available with a better version + //than any of the currently installed extensions with the same identifier. ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > aUpdateInfo; //The URL of the locally downloaded extension. It will only be set if there were no errors //during the download ::rtl::OUString sLocalURL; //The URL of the website wher the download can be obtained. ::rtl::OUString sWebsiteURL; + + //For local update + //===================== + //The locale extension which is used as update for the user or shared repository. + //If set then the data for the online update (aUpdateInfo, sLocalURL, sWebsiteURL) + //are to be ignored. + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > + aUpdateSource; }; } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index fca7d97c798a..d121ad976a06 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -151,7 +151,6 @@ rtl::OUString confineToParagraph(rtl::OUString const & text) { struct UpdateDialog::DisabledUpdate { rtl::OUString name; css::uno::Sequence< rtl::OUString > unsatisfiedDependencies; - bool permission; // We also want to show release notes and publisher for disabled updates ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > aUpdateInfo; }; @@ -230,7 +229,7 @@ public: Thread( css::uno::Reference< css::uno::XComponentContext > const & context, UpdateDialog & dialog, - const std::vector< TUpdateListEntry > &vExtensionList); + const std::vector< css::uno::Reference< css::deployment::XPackage > > & vExtensionList); void stop(); @@ -245,10 +244,16 @@ private: css::uno::Reference< css::deployment::XPackage > package; rtl::OUString version; + //Indicates that the extension provides its own update URLs. + //If this is true, then we must not use the default update + //URL to find the update information. + bool bProvidesOwnUpdate; css::uno::Reference< css::xml::dom::XNode > info; + UpdateDialog::DisabledUpdate disableUpdate; + dp_gui::UpdateData updateData; }; - // A multimap in case an extension is installed in both "user" and "shared": + // A multimap in case an extension is installed in "user", "shared" or "bundled" typedef std::multimap< rtl::OUString, Entry > Map; virtual ~Thread(); @@ -267,17 +272,26 @@ private: css::uno::Sequence< rtl::OUString > const & urls, rtl::OUString const & identifier) const; - void handle( + void getOwnUpdateInformation( css::uno::Reference< css::deployment::XPackage > const & package, Map * map); + ::rtl::OUString getUpdateDisplayString( + dp_gui::UpdateData const & data, ::rtl::OUString const & version = ::rtl::OUString()) const; + + void prepareUpdateData( + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > const & package, + ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > const & updateInfo, + UpdateDialog::DisabledUpdate & out_du, + dp_gui::UpdateData & out_data) const; + bool update( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Reference< css::xml::dom::XNode > const & updateInfo) const; + UpdateDialog::DisabledUpdate const & du, + dp_gui::UpdateData const & data) const; css::uno::Reference< css::uno::XComponentContext > m_context; UpdateDialog & m_dialog; - std::vector< dp_gui::TUpdateListEntry > m_vExtensionList; + std::vector< css::uno::Reference< css::deployment::XPackage > > m_vExtensionList; css::uno::Reference< css::deployment::XUpdateInformationProvider > m_updateInformation; css::uno::Reference< css::task::XInteractionHandler > m_xInteractionHdl; @@ -289,7 +303,7 @@ private: UpdateDialog::Thread::Thread( css::uno::Reference< css::uno::XComponentContext > const & context, UpdateDialog & dialog, - const std::vector< dp_gui::TUpdateListEntry > &vExtensionList): + const std::vector< css::uno::Reference< css::deployment::XPackage > > &vExtensionList): m_context(context), m_dialog(dialog), m_vExtensionList(vExtensionList), @@ -328,9 +342,13 @@ void UpdateDialog::Thread::stop() { UpdateDialog::Thread::Entry::Entry( css::uno::Reference< css::deployment::XPackage > const & thePackage, rtl::OUString const & theVersion): + package(thePackage), - version(theVersion) -{} + version(theVersion), + bProvidesOwnUpdate(false), + updateData(thePackage) +{ +} UpdateDialog::Thread::~Thread() { @@ -343,10 +361,10 @@ void UpdateDialog::Thread::execute() OSL_ASSERT( ! m_vExtensionList.empty() ); Map map; - typedef std::vector< TUpdateListEntry >::const_iterator ITER; + typedef std::vector< css::uno::Reference< css::deployment::XPackage > >::const_iterator ITER; for ( ITER iIndex = m_vExtensionList.begin(); iIndex < m_vExtensionList.end(); ++iIndex ) { - css::uno::Reference< css::deployment::XPackage > p = (*iIndex)->m_xPackage; + css::uno::Reference< css::deployment::XPackage > p = *iIndex; if ( p.is() ) { { @@ -355,47 +373,113 @@ void UpdateDialog::Thread::execute() return; } } - handle( p, &map ); + getOwnUpdateInformation( p, &map ); } } - if (!map.empty()) { - const rtl::OUString sDefaultURL(dp_misc::getExtensionDefaultUpdateURL()); - if (sDefaultURL.getLength()) - { - css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > - infos( - getUpdateInformation( - css::uno::Reference< css::deployment::XPackage >(), - css::uno::Sequence< rtl::OUString >(&sDefaultURL, 1), rtl::OUString())); - for (sal_Int32 i = 0; i < infos.getLength(); ++i) { - css::uno::Reference< css::xml::dom::XNode > node( - infos[i], css::uno::UNO_QUERY_THROW); - dp_misc::DescriptionInfoset infoset(m_context, node); - boost::optional< rtl::OUString > id(infoset.getIdentifier()); - if (!id) { - continue; - } - Map::iterator end(map.upper_bound(*id)); - for (Map::iterator j(map.lower_bound(*id)); j != end; ++j) { - rtl::OUString v(infoset.getVersion()); - if (dp_misc::compareVersions(v, j->second.version) == - dp_misc::GREATER) - { - j->second.version = v; - j->second.info = node; - } - } + const rtl::OUString sDefaultURL(dp_misc::getExtensionDefaultUpdateURL()); + if (sDefaultURL.getLength()) + { + css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > + infos( + getUpdateInformation( + css::uno::Reference< css::deployment::XPackage >(), + css::uno::Sequence< rtl::OUString >(&sDefaultURL, 1), rtl::OUString())); + for (sal_Int32 i = 0; i < infos.getLength(); ++i) { + css::uno::Reference< css::xml::dom::XNode > node( + infos[i], css::uno::UNO_QUERY_THROW); + dp_misc::DescriptionInfoset infoset(m_context, node); + boost::optional< rtl::OUString > id(infoset.getIdentifier()); + if (!id) { + continue; } - for (Map::const_iterator i(map.begin()); i != map.end(); ++i) { - if (i->second.info.is() && - !update( i->second.package, i->second.info )) + Map::iterator end(map.upper_bound(*id)); + for (Map::iterator j(map.lower_bound(*id)); j != end; ++j) { + //skip those extension which provide its own update urls + if (j->second.bProvidesOwnUpdate) + continue; + rtl::OUString v(infoset.getVersion()); + //look for the highest version in the online repository + if (dp_misc::compareVersions(v, j->second.version) == + dp_misc::GREATER) { - break; + j->second.version = v; + j->second.info = node; } } } } + + css::uno::Reference extMgr = + css::deployment::ExtensionManager::get(m_context); + for (Map::iterator i(map.begin()); i != map.end(); ++i) + { + //determine if online updates meet the requirements + prepareUpdateData(i->second.package, i->second.info, + i->second.disableUpdate, i->second.updateData); + + //determine if the update is installed in the user or shared repository + rtl::OUString sOnlineVersion; + if (i->second.updateData.aUpdateInfo.is()) + sOnlineVersion = i->second.version; + + rtl::OUString sVersionUser; + rtl::OUString sVersionShared; + rtl::OUString sVersionBundled; + css::uno::Sequence< css::uno::Reference< css::deployment::XPackage> > extensions; + try { + extensions = extMgr->getExtensionsWithSameIdentifier( + dp_misc::getIdentifier(i->second.package), i->second.package->getName(), + css::uno::Reference()); + } catch (css::lang::IllegalArgumentException& ) { + OSL_ASSERT(0); + } + OSL_ASSERT(extensions.getLength() == 3); + if (extensions[0].is() ) + sVersionUser = extensions[0]->getVersion(); + if (extensions[1].is() ) + sVersionShared = extensions[1]->getVersion(); + if (extensions[2].is() ) + sVersionBundled = extensions[2]->getVersion(); + + bool bSharedReadOnly = extMgr->isReadOnlyRepository(OUSTR("shared")); + + dp_misc::UPDATE_SOURCE sourceUser = dp_misc::isUpdateUserExtension( + bSharedReadOnly, sVersionUser, sVersionShared, sVersionBundled, sOnlineVersion); + dp_misc::UPDATE_SOURCE sourceShared = dp_misc::isUpdateSharedExtension( + bSharedReadOnly, sVersionShared, sVersionBundled, sOnlineVersion); + + css::uno::Reference updateSource; + if (sourceUser != dp_misc::UPDATE_SOURCE_NONE) + { + if (sourceUser == dp_misc::UPDATE_SOURCE_SHARED) + { + i->second.updateData.aUpdateSource = extensions[1]; + i->second.updateData.updateVersion = extensions[1]->getVersion(); + } + else if (sourceUser == dp_misc::UPDATE_SOURCE_BUNDLED) + { + i->second.updateData.aUpdateSource = extensions[2]; + i->second.updateData.updateVersion = extensions[2]->getVersion(); + } + if (!update(i->second.disableUpdate, i->second.updateData)) + return; + } + + if (sourceShared != dp_misc::UPDATE_SOURCE_NONE) + { + if (sourceShared == dp_misc::UPDATE_SOURCE_BUNDLED) + { + i->second.updateData.aUpdateSource = extensions[2]; + i->second.updateData.updateVersion = extensions[2]->getVersion(); + } + i->second.updateData.bIsShared = true; + if (!update(i->second.disableUpdate, i->second.updateData)) + return; + } + } + + vos::OGuard g(Application::GetSolarMutex()); if (!m_stop) { m_dialog.checkingDone(); @@ -454,7 +538,7 @@ UpdateDialog::Thread::getUpdateInformation( css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > >(); } -void UpdateDialog::Thread::handle( +void UpdateDialog::Thread::getOwnUpdateInformation( css::uno::Reference< css::deployment::XPackage > const & package, Map * map) { @@ -464,11 +548,11 @@ void UpdateDialog::Thread::handle( if (urls.getLength() == 0) { map->insert( Map::value_type( - id, Entry(package, package->getVersion()))); + id, Entry(package, OUSTR("")))); } else { css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > infos(getUpdateInformation(package, urls, id)); - rtl::OUString latestVersion(package->getVersion()); + rtl::OUString latestVersion; sal_Int32 latestIndex = -1; for (sal_Int32 i = 0; i < infos.getLength(); ++i) { dp_misc::DescriptionInfoset infoset( @@ -490,80 +574,102 @@ void UpdateDialog::Thread::handle( } } if (latestIndex != -1) { - update( package, - css::uno::Reference< css::xml::dom::XNode >( - infos[latestIndex], css::uno::UNO_QUERY_THROW)); + Entry e(package, latestVersion); + e.info = css::uno::Reference< css::xml::dom::XNode >( + infos[latestIndex], css::uno::UNO_QUERY_THROW); + e.bProvidesOwnUpdate = true; + map->insert(Map::value_type(id, e)); } } } -bool UpdateDialog::Thread::update( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Reference< css::xml::dom::XNode > const & updateInfo) const +::rtl::OUString UpdateDialog::Thread::getUpdateDisplayString( + dp_gui::UpdateData const & data, ::rtl::OUString const & version) const { - dp_misc::DescriptionInfoset infoset(m_context, updateInfo); - OSL_ASSERT(infoset.getVersion().getLength() != 0); - css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > ds( - dp_misc::Dependencies::check(infoset)); - - UpdateDialog::DisabledUpdate du; - du.aUpdateInfo = updateInfo; - du.unsatisfiedDependencies.realloc(ds.getLength()); - for (sal_Int32 i = 0; i < ds.getLength(); ++i) { - du.unsatisfiedDependencies[i] = dp_misc::Dependencies::getErrorText(ds[i]); - } - du.permission = ! m_dialog.isReadOnly( package ); - const ::boost::optional< ::rtl::OUString> updateWebsiteURL(infoset.getLocalizedUpdateWebsiteURL()); - rtl::OUStringBuffer b(package->getDisplayName()); + OSL_ASSERT(data.aInstalledPackage.is()); + rtl::OUStringBuffer b(data.aInstalledPackage->getDisplayName()); b.append(static_cast< sal_Unicode >(' ')); { vos::OGuard g( Application::GetSolarMutex() ); - if ( m_stop ) - return !m_stop; - else - b.append(m_dialog.m_version); + b.append(m_dialog.m_version); } b.append(static_cast< sal_Unicode >(' ')); - b.append(infoset.getVersion()); - if (updateWebsiteURL) + if (version.getLength()) + b.append(version); + else + b.append(data.updateVersion); + + if (data.sWebsiteURL.getLength()) { b.append(static_cast< sal_Unicode >(' ')); { vos::OGuard g( Application::GetSolarMutex() ); - if ( m_stop ) - return !m_stop; - else - b.append(m_dialog.m_browserbased); + b.append(m_dialog.m_browserbased); } } - du.name = b.makeStringAndClear(); + return b.makeStringAndClear(); +} + +/** out_data will only be filled if all dependencies are ok. + */ +void UpdateDialog::Thread::prepareUpdateData( + css::uno::Reference< css::deployment::XPackage > const & package, + css::uno::Reference< css::xml::dom::XNode > const & updateInfo, + UpdateDialog::DisabledUpdate & out_du, + dp_gui::UpdateData & out_data) const +{ + if (!updateInfo.is()) + return; + dp_misc::DescriptionInfoset infoset(m_context, updateInfo); + OSL_ASSERT(infoset.getVersion().getLength() != 0); + css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > ds( + dp_misc::Dependencies::check(infoset)); + + out_du.aUpdateInfo = updateInfo; + out_du.unsatisfiedDependencies.realloc(ds.getLength()); + for (sal_Int32 i = 0; i < ds.getLength(); ++i) { + out_du.unsatisfiedDependencies[i] = dp_misc::Dependencies::getErrorText(ds[i]); + } + + const ::boost::optional< ::rtl::OUString> updateWebsiteURL(infoset.getLocalizedUpdateWebsiteURL()); + + out_du.name = getUpdateDisplayString(out_data, infoset.getVersion()); - if (du.unsatisfiedDependencies.getLength() == 0 && du.permission) + if (out_du.unsatisfiedDependencies.getLength() == 0) { - dp_gui::UpdateData data; - data.aInstalledPackage = package; - data.aUpdateInfo = updateInfo; + out_data.aUpdateInfo = updateInfo; + out_data.updateVersion = infoset.getVersion(); if (updateWebsiteURL) - data.sWebsiteURL = *updateWebsiteURL; + out_data.sWebsiteURL = *updateWebsiteURL; + } +} + +bool UpdateDialog::Thread::update( + UpdateDialog::DisabledUpdate const & du, + dp_gui::UpdateData const & data) const +{ + if (du.unsatisfiedDependencies.getLength() == 0) + { vos::OGuard g(Application::GetSolarMutex()); if (!m_stop) { - m_dialog.addEnabledUpdate(du.name, data); + m_dialog.addEnabledUpdate(getUpdateDisplayString(data), data); } return !m_stop; } else { vos::OGuard g(Application::GetSolarMutex()); if (!m_stop) { - m_dialog.addDisabledUpdate(du); + m_dialog.addDisabledUpdate(du); } return !m_stop; } + return true; } // UpdateDialog ---------------------------------------------------------- UpdateDialog::UpdateDialog( css::uno::Reference< css::uno::XComponentContext > const & context, Window * parent, - const std::vector< dp_gui::TUpdateListEntry > &vExtensionList, + const std::vector > &vExtensionList, std::vector< dp_gui::UpdateData > * updateData): ModalDialog(parent,DpGuiResId(RID_DLG_UPDATE)), m_context(context), @@ -593,8 +699,6 @@ UpdateDialog::UpdateDialog( m_noInstall(String(DpGuiResId(RID_DLG_UPDATE_NOINSTALL))), m_noDependency(String(DpGuiResId(RID_DLG_UPDATE_NODEPENDENCY))), m_noDependencyCurVer(String(DpGuiResId(RID_DLG_UPDATE_NODEPENDENCY_CUR_VER))), - m_noPermission(String(DpGuiResId(RID_DLG_UPDATE_NOPERMISSION))), - m_noPermissionVista(String(DpGuiResId(RID_DLG_UPDATE_NOPERMISSION_VISTA))), m_browserbased(String(DpGuiResId(RID_DLG_UPDATE_BROWSERBASED))), m_version(String(DpGuiResId(RID_DLG_UPDATE_VERSION))), m_updateData(*updateData), @@ -651,9 +755,6 @@ UpdateDialog::UpdateDialog( if ( ! dp_misc::office_is_running()) m_help.Disable(); FreeResource(); - String sTemp(m_noPermissionVista); - sTemp.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); - m_noPermissionVista = sTemp; initDescription(); } @@ -983,12 +1084,25 @@ void UpdateDialog::clearDescription() bool UpdateDialog::showDescription(css::uno::Reference< css::xml::dom::XNode > const & aUpdateInfo) { dp_misc::DescriptionInfoset infoset(m_context, aUpdateInfo); - std::pair< rtl::OUString, rtl::OUString > pairPub = infoset.getLocalizedPublisherNameAndURL(); - rtl::OUString sPub = pairPub.first; - rtl::OUString sURL = pairPub.second; - rtl::OUString sRel = infoset.getLocalizedReleaseNotesURL(); + return showDescription(infoset.getLocalizedPublisherNameAndURL(), + infoset.getLocalizedReleaseNotesURL()); +} + +bool UpdateDialog::showDescription(css::uno::Reference< css::deployment::XPackage > const & aExtension) +{ + OSL_ASSERT(aExtension.is()); + css::beans::StringPair pubInfo = aExtension->getPublisherInfo(); + return showDescription(std::make_pair(pubInfo.First, pubInfo.Second), + OUSTR("")); +} - if ( sPub.getLength() == 0 && sURL.getLength() == 0 && sRel.getLength() == 0 ) +bool UpdateDialog::showDescription(std::pair< rtl::OUString, rtl::OUString > const & pairPublisher, + rtl::OUString const & sReleaseNotes) +{ + rtl::OUString sPub = pairPublisher.first; + rtl::OUString sURL = pairPublisher.second; + + if ( sPub.getLength() == 0 && sURL.getLength() == 0 && sReleaseNotes.getLength() == 0 ) // nothing to show return false; @@ -1002,7 +1116,7 @@ bool UpdateDialog::showDescription(css::uno::Reference< css::xml::dom::XNode > c bPublisher = true; } - if ( sRel.getLength() > 0 ) + if ( sReleaseNotes.getLength() > 0 ) { if ( !bPublisher ) { @@ -1011,7 +1125,7 @@ bool UpdateDialog::showDescription(css::uno::Reference< css::xml::dom::XNode > c } m_ReleaseNotesLabel.Show(); m_ReleaseNotesLink.Show(); - m_ReleaseNotesLink.SetURL( sRel ); + m_ReleaseNotesLink.SetURL( sReleaseNotes ); } return true; } @@ -1069,7 +1183,12 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) const std::vector< UpdateDialog::DisabledUpdate >::size_type sizeDisabled = m_disabledUpdates.size(); if (pos < sizeEnabled) - bInserted = showDescription(m_enabledUpdates[pos].aUpdateInfo); + { + if (m_enabledUpdates[pos].aUpdateSource.is()) + bInserted = showDescription(m_enabledUpdates[pos].aUpdateSource); + else + bInserted = showDescription(m_enabledUpdates[pos].aUpdateInfo); + } else if (pos >= sizeEnabled && pos < (sizeEnabled + sizeDisabled)) bInserted = showDescription(m_disabledUpdates[pos - sizeEnabled].aUpdateInfo); @@ -1115,16 +1234,6 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) b.appendAscii(RTL_CONSTASCII_STRINGPARAM(" ")); b.append(m_noDependencyCurVer); } - if (!data.permission) { - if (b.getLength() == 0) { - b.append(m_noInstall); - } - b.append(LF); - if (isVista()) - b.append(m_noPermissionVista); - else - b.append(m_noPermission); - } break; } case GENERAL_ERROR: @@ -1231,7 +1340,7 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG) OSL_ASSERT(i->aInstalledPackage.is()); //If the user has no write access to the shared folder then the update //for a shared extension is disable, that is it cannot be in m_enabledUpdates - OSL_ASSERT(isReadOnly(i->aInstalledPackage) == sal_False); +// OSL_ASSERT(isReadOnly(i->aInstalledPackage) == sal_False); #if 0 // TODO: check! OSL_ASSERT(m_extensionManagerDialog.get()); @@ -1243,6 +1352,7 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG) #endif } + for (USHORT i = 0; i < m_updates.getItemCount(); ++i) { UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( @@ -1251,6 +1361,7 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG) m_updateData.push_back(m_enabledUpdates[p->index.enabledUpdate]); } } + EndDialog(RET_OK); return 0; } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx index 1e72b22a68c7..32c317cb8735 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx @@ -83,16 +83,17 @@ public: @param parent the parent window, may be null - @param selectedPackages - if non-null, only check for updates for the selected packages - - @param packageManagers - if non-null, check for updates for all managed packages + @param vExtensionList + check for updates for the contained extensions. There must only be one extension with + a particular identifier. If one extension is installed in several repositories, then the + one with the highest version must be used, because it contains the latest known update + information. */ UpdateDialog( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context, Window * parent, - const std::vector< dp_gui::TUpdateListEntry > &vExtensionList, + const std::vector< com::sun::star::uno::Reference< + com::sun::star::deployment::XPackage > > & vExtensionList, std::vector< dp_gui::UpdateData > * updateData); ~UpdateDialog(); @@ -142,6 +143,7 @@ private: UpdateDialog & m_dialog; }; + friend class CheckListBox; void insertItem( @@ -169,6 +171,10 @@ private: void initDescription(); void clearDescription(); + bool showDescription(::com::sun::star::uno::Reference< + ::com::sun::star::deployment::XPackage > const & aExtension); + bool showDescription(std::pair< rtl::OUString, rtl::OUString > const & pairPublisher, + rtl::OUString const & sReleaseNotes); bool showDescription( ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > const & aUpdateInfo); bool showDescription( const String& rDescription, bool bWithPublisher ); @@ -206,8 +212,6 @@ private: rtl::OUString m_noInstall; rtl::OUString m_noDependency; rtl::OUString m_noDependencyCurVer; - rtl::OUString m_noPermission; - rtl::OUString m_noPermissionVista; rtl::OUString m_browserbased; rtl::OUString m_version; std::vector< dp_gui::UpdateData > m_enabledUpdates; diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.src b/desktop/source/deployment/gui/dp_gui_updatedialog.src index b86a8ad66f08..325d98c88d48 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.src +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.src @@ -244,18 +244,6 @@ ModalDialog RID_DLG_UPDATE { String RID_DLG_UPDATE_NODEPENDENCY_CUR_VER { Text[en-US] = "You have OpenOffice.org %VERSION"; }; - String RID_DLG_UPDATE_NOPERMISSION { - Text[en-US] = "No write permission (shared extension)."; - }; - String RID_DLG_UPDATE_NOPERMISSION_VISTA { - Text[en-US] = "No write permission. %PRODUCTNAME needs to run as administrator.\n" - "Please follow these steps to update this shared extension:\n" - "1. Close Extension Manager dialog.\n" - "2. Exit %PRODUCTNAME.\n" - "3. Exit %PRODUCTNAME Quickstarter located in the tray area of Windows.\n" - "4. Run %PRODUCTNAME as administrator. In order to do this call the context menu of the %PRODUCTNAME program icon and choose \'Run as administrator\'.\n" - "5. Call the Extension Manager dialog and update this shared extension.\n"; - }; String RID_DLG_UPDATE_BROWSERBASED { Text[en-US] = "browser based update"; }; diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index f2f8b8b0d6e2..067a703ec413 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -380,13 +380,12 @@ void UpdateInstallDialog::Thread::downloadExtensions() { UpdateData & curData = *i; - OSL_ASSERT(curData.aUpdateInfo.is()); + if (!curData.aUpdateInfo.is() || curData.aUpdateSource.is()) + continue; //We assume that m_aVecUpdateData contains only information about extensions which //can be downloaded directly. OSL_ASSERT(curData.sWebsiteURL.getLength() == 0); - if (!curData.aUpdateInfo.is()) - continue; //update the name of the extension which is to be downloaded { ::vos::OGuard g(Application::GetSolarMutex()); @@ -491,13 +490,11 @@ void UpdateInstallDialog::Thread::installExtensions() // osl::Thread::wait(v); bool bError = false; bool bLicenseDeclined = false; - cssu::Reference xPackage; + cssu::Reference xExtension; UpdateData & curData = *i; cssu::Exception exc; try { - if (curData.sLocalURL.getLength() == 0) - continue; cssu::Reference< css::task::XAbortChannel > xAbortChannel( curData.aInstalledPackage->createAbortChannel() ); { @@ -507,9 +504,35 @@ void UpdateInstallDialog::Thread::installExtensions() } m_abort = xAbortChannel; } - xPackage = m_dialog.getExtensionManager()->addExtension( - curData.sLocalURL, css::uno::Sequence(), - curData.aInstalledPackage->getRepositoryName(), xAbortChannel, m_updateCmdEnv.get()); + if (!curData.aUpdateSource.is() && curData.sLocalURL.getLength()) + { + css::beans::NamedValue prop(OUSTR("EXTENSION_UPDATE"), css::uno::makeAny(OUSTR("1"))); + if (!curData.bIsShared) + xExtension = m_dialog.getExtensionManager()->addExtension( + curData.sLocalURL, css::uno::Sequence(&prop, 1), + OUSTR("user"), xAbortChannel, m_updateCmdEnv.get()); + else + xExtension = m_dialog.getExtensionManager()->addExtension( + curData.sLocalURL, css::uno::Sequence(&prop, 1), + OUSTR("shared"), xAbortChannel, m_updateCmdEnv.get()); + } + else if (curData.aUpdateSource.is()) + { + OSL_ASSERT(curData.aUpdateSource.is()); + //I am not sure if we should obtain the install properties and pass them into + //add extension. Currently it contains only "SUPPRESS_LICENSE". So it it could happen + //that a license is displayed when updating from the shared repository, although the + //shared extension was installed using "SUPPRESS_LICENSE". + css::beans::NamedValue prop(OUSTR("EXTENSION_UPDATE"), css::uno::makeAny(OUSTR("1"))); + if (!curData.bIsShared) + xExtension = m_dialog.getExtensionManager()->addExtension( + curData.aUpdateSource->getURL(), css::uno::Sequence(&prop, 1), + OUSTR("user"), xAbortChannel, m_updateCmdEnv.get()); + else + xExtension = m_dialog.getExtensionManager()->addExtension( + curData.aUpdateSource->getURL(), css::uno::Sequence(&prop, 1), + OUSTR("shared"), xAbortChannel, m_updateCmdEnv.get()); + } } catch (css::deployment::DeploymentException & de) { @@ -538,7 +561,7 @@ void UpdateInstallDialog::Thread::installExtensions() m_dialog.setError(UpdateInstallDialog::ERROR_LICENSE_DECLINED, curData.aInstalledPackage->getDisplayName(), OUString()); } - else if (!xPackage.is() || bError) + else if (!xExtension.is() || bError) { ::vos::OGuard g(Application::GetSolarMutex()); if (m_stop) { diff --git a/desktop/source/deployment/inc/dp_misc.h b/desktop/source/deployment/inc/dp_misc.h index a0ca7f53be03..161b91a6bcde 100644 --- a/desktop/source/deployment/inc/dp_misc.h +++ b/desktop/source/deployment/inc/dp_misc.h @@ -179,6 +179,52 @@ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC void syncRepositories(::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment> const & xCmdEnv); +enum UPDATE_SOURCE +{ + UPDATE_SOURCE_NONE, + UPDATE_SOURCE_SHARED, + UPDATE_SOURCE_BUNDLED, + UPDATE_SOURCE_ONLINE +}; + +/* determine if an update is available which is installed in the + user repository. + + If the return value is UPDATE_SOURCE_NONE, then no update is + available, otherwise the return value determine from which the + repository the update is used. +*/ +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +UPDATE_SOURCE isUpdateUserExtension( + bool bReadOnlyShared, + ::rtl::OUString const & userVersion, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion); + +/* determine if an update is available which is installed in the + shared repository. + + If the return value is UPDATE_SOURCE_NONE, then no update is + available, otherwise the return value determine from which the + repository the update is used. +*/ +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +UPDATE_SOURCE isUpdateSharedExtension( + bool bReadOnlyShared, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion); + +/* determines the extension with the highest identifier and returns it + + */ +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> +getExtensionWithHighestVersion( + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::deployment::XPackage> > const & seqExtensionsWithSameId); } diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index fddefb5ad277..251e70a19ce6 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -250,7 +250,8 @@ void ExtensionManager::addExtensionsToMap( */ ::std::list > ExtensionManager::getExtensionsWithSameId( - OUString const & identifier, OUString const & fileName) + OUString const & identifier, OUString const & fileName, + Reference< ucb::XCommandEnvironment> const & xCmdEnv) { ::std::list > extensionList; @@ -282,13 +283,70 @@ void ExtensionManager::addExtensionsToMap( return extensionList; } +uno::Sequence > +ExtensionManager::getExtensionsWithSameIdentifier( + OUString const & identifier, + OUString const & fileName, + Reference< ucb::XCommandEnvironment> const & xCmdEnv ) + throw ( + deploy::DeploymentException, + ucb::CommandFailedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + try + { + ::std::list > listExtensions = + getExtensionsWithSameId( + identifier, fileName, xCmdEnv); + sal_Bool bHasExtension = false; + + //throw an IllegalArgumentException if there is no extension at all. + typedef ::std::list >::const_iterator CIT; + for (CIT i = listExtensions.begin(); i != listExtensions.end(); i++) + bHasExtension |= i->is(); + if (!bHasExtension) + throw lang::IllegalArgumentException( + OUSTR("Could not find extension: ") + identifier + OUSTR(", ") + fileName, + static_cast(this), -1); + + return comphelper::containerToSequence< + Reference, + ::std::list > + > (listExtensions); + } + catch (deploy::DeploymentException & ) + { + throw; + } + catch ( ucb::CommandFailedException & ) + { + throw; + } + catch (lang::IllegalArgumentException &) + { + throw; + } + catch (...) + { + uno::Any exc = ::cppu::getCaughtException(); + throw deploy::DeploymentException( + OUSTR("Extension Manager: exception during getExtensionsWithSameIdentifier"), + static_cast(this), exc); + } +} + bool ExtensionManager::isUserDisabled( OUString const & identifier, OUString const & fileName) { - ::std::list > listExtensions = - getExtensionsWithSameId(identifier, fileName); + ::std::list > listExtensions; + + try { + listExtensions = getExtensionsWithSameId(identifier, fileName); + } catch (lang::IllegalArgumentException & ) { + } OSL_ASSERT(listExtensions.size() == 3); return isUserDisabled( ::comphelper::containerToSequence< @@ -339,8 +397,11 @@ void ExtensionManager::activateExtension( Reference const & xAbortChannel, Reference const & xCmdEnv ) { - ::std::list > listExtensions = - getExtensionsWithSameId(identifier, fileName); + ::std::list > listExtensions; + try { + listExtensions = getExtensionsWithSameId(identifier, fileName); + } catch (lang::IllegalArgumentException &) { + } OSL_ASSERT(listExtensions.size() == 3); activateExtension( @@ -510,9 +571,11 @@ Reference ExtensionManager::addExtension( ExtensionProperties props(OUString(), properties, Reference()); if (licenseAttributes && licenseAttributes->suppressIfRequired && props.isSuppressedLicense()) - _xCmdEnv = Reference(new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler())); + _xCmdEnv = Reference( + new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler())); + bCanInstall = xTmpExtension->checkPrerequisites( - xAbortChannel, _xCmdEnv, xOldExtension.is()) == 0 ? true : false; + xAbortChannel, _xCmdEnv, xOldExtension.is() || props.isExtensionUpdate()) == 0 ? true : false; } catch (deploy::DeploymentException& ) { excOccurred1 = ::cppu::getCaughtException(); diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index ad0e7d95df7e..54624514adce 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -163,6 +163,17 @@ public: css::lang::IllegalArgumentException, css::uno::RuntimeException); + virtual css::uno::Sequence > + SAL_CALL getExtensionsWithSameIdentifier( + ::rtl::OUString const & identifier, + ::rtl::OUString const & filename, + css::uno::Reference< css::ucb::XCommandEnvironment> const & xCmdEnv ) + throw ( + css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + virtual css::uno::Sequence< css::uno::Sequence > > SAL_CALL getAllExtensions( css::uno::Reference const &, @@ -252,7 +263,9 @@ private: ::std::list > getExtensionsWithSameId(::rtl::OUString const & identifier, - ::rtl::OUString const & fileName); + ::rtl::OUString const & fileName, + css::uno::Reference< css::ucb::XCommandEnvironment> const & xCmdEnv = + css::uno::Reference< css::ucb::XCommandEnvironment>()); css::uno::Reference backupExtension( ::rtl::OUString const & identifier, ::rtl::OUString const & fileName, diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx index b04e8131ee15..df579944c6e4 100644 --- a/desktop/source/deployment/manager/dp_properties.cxx +++ b/desktop/source/deployment/manager/dp_properties.cxx @@ -50,6 +50,8 @@ using ::com::sun::star::uno::Reference; using ::rtl::OUString; #define PROP_SUPPRESS_LICENSE "SUPPRESS_LICENSE" +#define PROP_EXTENSION_UPDATE "EXTENSION_UPDATE" + namespace dp_manager { //Reading the file @@ -89,17 +91,11 @@ ExtensionProperties::ExtensionProperties( css::beans::NamedValue const & v = properties[i]; if (v.Name.equals(OUSTR(PROP_SUPPRESS_LICENSE))) { - OUString value; - if (v.Value >>= value) - { - if (value.equals(OUSTR("1"))) - m_prop_suppress_license = OUSTR("1"); - } - else - { - throw lang::IllegalArgumentException( - OUSTR("Extension Manager: wrong property value"), 0, -1); - } + m_prop_suppress_license = getPropertyValue(v); + } + else if (v.Name.equals(OUSTR(PROP_EXTENSION_UPDATE))) + { + m_prop_extension_update = getPropertyValue(v); } else { @@ -109,6 +105,21 @@ ExtensionProperties::ExtensionProperties( } } +OUString ExtensionProperties::getPropertyValue(css::beans::NamedValue const & v) +{ + OUString value(OUSTR("0")); + if (v.Value >>= value) + { + if (value.equals(OUSTR("1"))) + value = OUSTR("1"); + } + else + { + throw lang::IllegalArgumentException( + OUSTR("Extension Manager: wrong property value"), 0, -1); + } + return value; +} void ExtensionProperties::write() { ::ucbhelper::Content contentProps(m_propFileUrl, m_xCmdEnv); @@ -142,6 +153,17 @@ bool ExtensionProperties::isSuppressedLicense() return ret; } +bool ExtensionProperties::isExtensionUpdate() +{ + bool ret = false; + if (m_prop_extension_update) + { + if (m_prop_extension_update->equals(OUSTR("1"))) + ret = true; + } + return ret; +} + } // namespace dp_manager diff --git a/desktop/source/deployment/manager/dp_properties.hxx b/desktop/source/deployment/manager/dp_properties.hxx index 197155653de1..97fc8b8c5394 100644 --- a/desktop/source/deployment/manager/dp_properties.hxx +++ b/desktop/source/deployment/manager/dp_properties.hxx @@ -53,6 +53,9 @@ protected: ::rtl::OUString m_propFileUrl; const css::uno::Reference m_xCmdEnv; ::boost::optional< ::rtl::OUString> m_prop_suppress_license; + ::boost::optional< ::rtl::OUString> m_prop_extension_update; + + ::rtl::OUString getPropertyValue(css::beans::NamedValue const & v); public: virtual ~ExtensionProperties() {}; @@ -66,6 +69,8 @@ public: void write(); bool isSuppressedLicense(); + + bool isExtensionUpdate(); }; } diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 5269e3d8aac5..53d488095ecd 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -30,6 +30,7 @@ #include "dp_misc.h" +#include "dp_version.hxx" #include "dp_interact.h" #include "rtl/uri.hxx" #include "rtl/digest.h" @@ -630,6 +631,147 @@ void syncRepositories(Reference const & xCmdEnv) } } +/* returns the index of the greatest version, starting with 0 + + */ +int determineHighestVersion( + ::rtl::OUString const & userVersion, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion) +{ + int index = 0; + OUString greatest = userVersion; + if (dp_misc::compareVersions(sharedVersion, greatest) == dp_misc::GREATER) + { + index = 1; + greatest = sharedVersion; + } + if (dp_misc::compareVersions(bundledVersion, greatest) == dp_misc::GREATER) + { + index = 2; + greatest = bundledVersion; + } + if (dp_misc::compareVersions(onlineVersion, greatest) == dp_misc::GREATER) + { + index = 3; + } + return index; +} + +UPDATE_SOURCE isUpdateUserExtension( + bool bReadOnlyShared, + ::rtl::OUString const & userVersion, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion) +{ + UPDATE_SOURCE retVal = UPDATE_SOURCE_NONE; + if (bReadOnlyShared) + { + if (userVersion.getLength()) + { + int index = determineHighestVersion( + userVersion, sharedVersion, bundledVersion, onlineVersion); + if (index == 1) + retVal = UPDATE_SOURCE_SHARED; + else if (index == 2) + retVal = UPDATE_SOURCE_BUNDLED; + else if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + } + else if (sharedVersion.getLength()) + { + int index = determineHighestVersion( + OUString(), sharedVersion, bundledVersion, onlineVersion); + if (index == 2) + retVal = UPDATE_SOURCE_BUNDLED; + else if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + + } + else if (bundledVersion.getLength()) + { + int index = determineHighestVersion( + OUString(), OUString(), bundledVersion, onlineVersion); + if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + } + } + else + { + if (userVersion.getLength()) + { + int index = determineHighestVersion( + userVersion, sharedVersion, bundledVersion, onlineVersion); + if (index == 1) + retVal = UPDATE_SOURCE_SHARED; + else if (index == 2) + retVal = UPDATE_SOURCE_BUNDLED; + else if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + } + } + + return retVal; +} + +UPDATE_SOURCE isUpdateSharedExtension( + bool bReadOnlyShared, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion) +{ + if (bReadOnlyShared) + return UPDATE_SOURCE_NONE; + UPDATE_SOURCE retVal = UPDATE_SOURCE_NONE; + + if (sharedVersion.getLength()) + { + int index = determineHighestVersion( + OUString(), sharedVersion, bundledVersion, onlineVersion); + if (index == 2) + retVal = UPDATE_SOURCE_BUNDLED; + else if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + } + else if (bundledVersion.getLength()) + { + int index = determineHighestVersion( + OUString(), OUString(), bundledVersion, onlineVersion); + if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + } + return retVal; +} + +Reference +getExtensionWithHighestVersion( + Sequence > const & seqExt) +{ + if (seqExt.getLength() == 0) + return Reference(); + + Reference greatest; + sal_Int32 len = seqExt.getLength(); + + for (sal_Int32 i = 0; i < len; i++) + { + if (!greatest.is()) + { + greatest = seqExt[i]; + continue; + } + Reference const & current = seqExt[i]; + //greatest has a value + if (! current.is()) + continue; + + if (dp_misc::compareVersions(current->getVersion(), greatest->getVersion()) == dp_misc::GREATER) + greatest = current; + } + return greatest; +} } -- cgit From 720cb002b90767f097bed1ee63f61337632b731d Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Mon, 31 May 2010 12:59:01 +0200 Subject: fwk143: #i111516# Support language argument and configuration item for dictionary repository URL. --- .../registry/data/org/openoffice/Office/Common.xcu | 5 ++ .../schema/org/openoffice/Office/Common.xcs | 13 +++++ sfx2/source/appl/appserv.cxx | 63 +++++++++++++++++++--- 3 files changed, 73 insertions(+), 8 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 03e37b72f9ad..b7c019f24c28 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -157,6 +157,11 @@ WIN
    + + + ${DICT_REPO_URL} + + true diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index cb19bb01e1ba..02e05a932952 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -974,6 +974,19 @@ false + + + CD + Contains settings related to dictionaries. + + + + CD + Specifies a repository URL where users can download additional dictionaries. + + + + AW diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 14789100bb24..bd9efc9bca1e 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -51,20 +51,15 @@ #include #include -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include -#endif #include +#include "comphelper/configurationhelper.hxx" -#ifndef _SVT_DOC_ADDRESSTEMPLATE_HXX_ #include -#endif #include #include -#ifndef _UNOTOOLS_CONFIGMGR_HXX_ #include -#endif #include #include #include @@ -90,6 +85,7 @@ #include #include #include +#include #include #include @@ -879,6 +875,31 @@ namespace } } +static ::rtl::OUString getConfigurationStringValue( + const ::rtl::OUString& rPackage, + const ::rtl::OUString& rRelPath, + const ::rtl::OUString& rKey, + const ::rtl::OUString& rDefaultValue ) +{ + ::rtl::OUString aDefVal( rDefaultValue ); + + try + { + ::comphelper::ConfigurationHelper::readDirectKey( + comphelper::getProcessServiceFactory(), + rPackage, + rRelPath, + rKey, + ::comphelper::ConfigurationHelper::E_READONLY) >>= aDefVal; + } + catch(const com::sun::star::uno::RuntimeException& exRun) + { throw exRun; } + catch(const com::sun::star::uno::Exception&) + {} + + return aDefVal; +} + void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) { DBG_MEMTEST(); @@ -924,8 +945,34 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) uno::Reference< css::system::XSystemShellExecute > xSystemShell( xSMGR->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute" ) ), uno::UNO_QUERY_THROW ); - if ( xSystemShell.is() ) - xSystemShell->execute( DEFINE_CONST_UNICODE("http://extensions.services.openoffice.org/dictionary?cid=926385"), ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS ); + + // read repository URL from configuration + ::rtl::OUString sTemplRepoURL = + getConfigurationStringValue( + ::rtl::OUString::createFromAscii("org.openoffice.Office.Common"), + ::rtl::OUString::createFromAscii("Dictionaries"), + ::rtl::OUString::createFromAscii("RepositoryURL"), + ::rtl::OUString()); + + if ( xSystemShell.is() && sTemplRepoURL.getLength() > 0 ) + { + ::rtl::OUStringBuffer aURLBuf( sTemplRepoURL ); + aURLBuf.appendAscii( "?" ); + aURLBuf.appendAscii( "lang=" ); + + // read locale from configuration + ::rtl::OUString sLocale = getConfigurationStringValue( + ::rtl::OUString::createFromAscii("org.openoffice.Setup"), + ::rtl::OUString::createFromAscii("L10N"), + ::rtl::OUString::createFromAscii("ooLocale"), + ::rtl::OUString::createFromAscii("en-US")); + + aURLBuf.append( sLocale ); + xSystemShell->execute( + aURLBuf.makeStringAndClear(), + ::rtl::OUString(), + css::system::SystemShellExecuteFlags::DEFAULTS ); + } } catch( const ::com::sun::star::uno::Exception& ) { -- cgit From 08c5dbe4de29dfbdba96ce9a269d203154472bba Mon Sep 17 00:00:00 2001 From: tono Date: Mon, 31 May 2010 21:51:32 +0900 Subject: i#111956: MinGW port fix: dependency to shared library --- desktop/source/pkgchk/unopkg/makefile.mk | 8 ++++++++ framework/util/makefile.mk | 24 ++++++++++++++++++++---- svx/util/makefile.mk | 4 ++++ vbahelper/util/makefile.mk | 4 ++++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/desktop/source/pkgchk/unopkg/makefile.mk b/desktop/source/pkgchk/unopkg/makefile.mk index 8384f1b24372..729548cbadd1 100644 --- a/desktop/source/pkgchk/unopkg/makefile.mk +++ b/desktop/source/pkgchk/unopkg/makefile.mk @@ -49,7 +49,11 @@ CFLAGS+=-DSYSTEM_DB -I$(DB_INCLUDES) APP1TARGET = so$/unopkg APP1OBJS = $(OBJFILES) APP1STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" APP1DEPN = $(SHL1TARGETN) +.ELSE +APP1DEPN = $(SHL1IMPLIBN) +.ENDIF APP1NOSAL = TRUE APP1RPATH = BRAND .IF "$(OS)" == "WNT" @@ -61,7 +65,11 @@ APP1LINKRES = $(MISC)$/$(TARGET)1.res APP2TARGET = unopkg APP2OBJS = $(OBJFILES) APP2STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" APP2DEPN = $(SHL1TARGETN) +.ELSE +APP2DEPN = $(SHL1IMPLIBN) +.ENDIF APP2NOSAL = TRUE APP2RPATH = BRAND .IF "$(OS)" == "WNT" diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index b1b7c691d29f..08218b6267b3 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -158,7 +158,11 @@ SHL2STDLIBS= \ $(SALLIB) SHL2DEF= $(MISC)$/$(SHL2TARGET).def -SHL2DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +SHL2DEPN= $(SHL1TARGETN) +.ELSE +SHL2DEPN= $(SHL1IMPLIBN) +.ENDIF DEF2NAME= $(SHL2TARGET) @@ -214,7 +218,11 @@ SHL3STDLIBS= \ $(SALLIB) SHL3DEF= $(MISC)$/$(SHL3TARGET).def -SHL3DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) $(SHL2TARGETN) +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +SHL3DEPN= $(SHL1TARGETN) $(SHL2TARGETN) +.ELSE +SHL3DEPN= $(SHL1IMPLIBN) $(SHL2IMPLIBN) +.ENDIF DEF3NAME= $(SHL3TARGET) @@ -355,7 +363,11 @@ SHL4STDLIBS= \ $(I18NISOLANGLIB) SHL4DEF= $(MISC)$/$(SHL4TARGET).def -SHL4DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) $(SHL2IMPLIBN) $(SHL2TARGETN) +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +SHL4DEPN= $(SHL1TARGETN) $(SHL2TARGETN) +.ELSE +SHL4DEPN= $(SHL1IMPLIBN) $(SHL2IMPLIBN) +.ENDIF DEF4NAME= $(SHL4TARGET) @@ -386,7 +398,11 @@ SHL5STDLIBS= \ $(SALLIB) SHL5DEF= $(MISC)$/$(SHL5TARGET).def -SHL5DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +SHL5DEPN= $(SHL1TARGETN) +.ELSE +SHL5DEPN= $(SHL1IMPLIBN) +.ENDIF DEF5NAME= $(SHL5TARGET) diff --git a/svx/util/makefile.mk b/svx/util/makefile.mk index 0006fa2ff5fe..5ee482e6ac82 100644 --- a/svx/util/makefile.mk +++ b/svx/util/makefile.mk @@ -104,7 +104,11 @@ DEFLIB1NAME=$(SHL1LIBS:b) SHL2TARGET= svx$(DLLPOSTFIX) SHL2IMPLIB= i$(TARGET) SHL2USE_EXPORTS=name +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL2DEPN=$(SHL1TARGETN) +.ELSE +SHL2DEPN=$(SHL1IMPLIBN) +.ENDIF SHL2LIBS= \ $(SLB)$/svdraw.lib \ diff --git a/vbahelper/util/makefile.mk b/vbahelper/util/makefile.mk index dda4be0cbc81..54a17873cf94 100644 --- a/vbahelper/util/makefile.mk +++ b/vbahelper/util/makefile.mk @@ -96,7 +96,11 @@ SHL2STDLIBS= \ $(TKLIB) \ $(BASICLIB) \ +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL2DEPN=$(SHL1TARGETN) +.ELSE +SHL2DEPN=$(SHL1IMPLIBN) +.ENDIF SHL2LIBS=$(SLB)$/$(TARGET_MSFORMS).lib # --- Targets ----------------------------------------------------------- -- cgit From 3655eab4df54f47e8821db8aed9b90fa7fab33bd Mon Sep 17 00:00:00 2001 From: tono Date: Mon, 31 May 2010 21:53:32 +0900 Subject: i#111958: MinGW port enhancement: runtime-pseude-reloc-v2 --- sfx2/source/bastyp/sfxhtml.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index 6132e958b900..8a4b434f460b 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -62,11 +62,7 @@ sal_Char __FAR_DATA sHTML_MIME_application[] = "application/"; sal_Char __FAR_DATA sHTML_MIME_experimental[] = "x-"; // -#ifdef __MINGW32__ // for runtime pseudo reloc -static HTMLOptionEnum aAreaShapeOptEnums[] = -#else static HTMLOptionEnum __READONLY_DATA aAreaShapeOptEnums[] = -#endif { { OOO_STRING_SVTOOLS_HTML_SH_rect, IMAP_OBJ_RECTANGLE }, { OOO_STRING_SVTOOLS_HTML_SH_rectangle, IMAP_OBJ_RECTANGLE }, -- cgit From ac7fee6151fadda39e02a42486baeff2fb1bc95a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 31 May 2010 14:19:35 +0100 Subject: cmcfixes74: #i111960 use xdg-open when available --- shell/source/unix/misc/gnome-open-url.sh | 4 +-- shell/source/unix/misc/open-url.sh | 54 +++++++++++++++++++------------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/shell/source/unix/misc/gnome-open-url.sh b/shell/source/unix/misc/gnome-open-url.sh index 1a52fc763783..ab730d169a49 100644 --- a/shell/source/unix/misc/gnome-open-url.sh +++ b/shell/source/unix/misc/gnome-open-url.sh @@ -1,6 +1,6 @@ #!/bin/sh -# use gnome-open utility coming with libgnome if available -gnome-open "$1" 2>/dev/null || "$0.bin" $1 +# use xdg-open or gnome-open if available +xdg-open "$1" 2>/dev/null || gnome-open "$1" 2>/dev/null || "$0.bin" $1 exit 0 diff --git a/shell/source/unix/misc/open-url.sh b/shell/source/unix/misc/open-url.sh index 5a70785f89d3..449af5915ce8 100755 --- a/shell/source/unix/misc/open-url.sh +++ b/shell/source/unix/misc/open-url.sh @@ -46,38 +46,48 @@ run_browser() { # special handling for mailto: uris if echo $1 | grep '^mailto:' > /dev/null; then + # check for xdg-email + mailer=`which xdg-email` + if [ ! -z "$mailer" ]; then + $mailer "$1" & + exit 0 + fi # check $MAILER variable if [ ! -z "$MAILER" ]; then $MAILER "$1" & exit 0 - else - # mozilla derivates may need -remote semantics - for i in thunderbird mozilla netscape; do - mailer=`which $i` - if [ ! -z "$mailer" ]; then - run_mozilla "$mailer" "$1" - exit 0 - fi - done - # handle all non mozilla mail clients below - # .. fi + # mozilla derivates may need -remote semantics + for i in thunderbird mozilla netscape; do + mailer=`which $i` + if [ ! -z "$mailer" ]; then + run_mozilla "$mailer" "$1" + exit 0 + fi + done + # handle all non mozilla mail clients below + # .. else + # check for xdg-open + browser=`which xdg-open` + if [ ! -z "$browser" ]; then + $browser "$1" & + exit 0 + fi # check $BROWSER variable if [ ! -z "$BROWSER" ]; then $BROWSER "$1" & exit 0 - else - # mozilla derivates may need -remote semantics - for i in firefox mozilla netscape; do - browser=`which $i` - if [ ! -z "$browser" ]; then - run_mozilla "$browser" "$1" - exit 0 - fi - done - # handle all non mozilla browers below - # .. fi + # mozilla derivates may need -remote semantics + for i in firefox mozilla netscape; do + browser=`which $i` + if [ ! -z "$browser" ]; then + run_mozilla "$browser" "$1" + exit 0 + fi + done + # handle all non mozilla browers below + # .. fi exit 1 -- cgit From f228a0e3a37c155947580f78b433f1ba2da5d16b Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 1 Jun 2010 12:54:48 +0200 Subject: #i100925# added msyahei as default font for CJK locales --- officecfg/registry/data/org/openoffice/VCL.xcu | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index 36fd48ebf753..231d9bc1ccc2 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -547,22 +547,22 @@ - 方正宋体;MSung Light SC;SimSun;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正宋体;MSung Light SC;SimSun;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma 方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced - 方正黑体;方正宋体;宋体;SimSun;黑体;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正黑体;方正宋体;宋体;SimSun;黑体;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 方正宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma 方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced @@ -571,7 +571,7 @@ 方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced - 方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Arial Unicode MS;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif + 方正宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Arial Unicode MS;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif @@ -579,19 +579,19 @@ 方正明體;細明體;MingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced - 方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma 方正黑体;新細明體;PMingLiU;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正明體;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正明體;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma 方正明體;細明體;MingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced @@ -600,7 +600,7 @@ 方正明體;細明體;MingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced - 方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;Arial Unicode MS;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif + 微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;Arial Unicode MS;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif @@ -608,16 +608,16 @@ 方正明體;細明體;MingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced - 方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - FZHeiTi;方正明體;新細明體;PMingLiU;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;FZHeiTi;方正明體;新細明體;PMingLiU;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正明體;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正明體;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma 方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma @@ -629,7 +629,7 @@ 方正明體;細明體;MingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced - 方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;Arial Unicode MS;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif + 微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;Arial Unicode MS;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif @@ -637,19 +637,19 @@ 方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced - 方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正黑体;方正宋体;宋体;SimSun;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正黑体;方正宋体;宋体;SimSun;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma - 方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma + 微软雅黑;方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma 方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced @@ -658,7 +658,7 @@ 方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced - 方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Arial Unicode MS;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif + 方正宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Arial Unicode MS;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif -- cgit From ea38408294e1a781bc31238e8c0b87714f7214d3 Mon Sep 17 00:00:00 2001 From: Frank Peters Date: Tue, 1 Jun 2010 14:35:19 +0200 Subject: #i111721# --- readlicense_oo/util/makefile.pmk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readlicense_oo/util/makefile.pmk b/readlicense_oo/util/makefile.pmk index 8aee1ce3b69a..30e07779457b 100755 --- a/readlicense_oo/util/makefile.pmk +++ b/readlicense_oo/util/makefile.pmk @@ -53,7 +53,7 @@ $(COMMONMISC)$/readme.dtd : ..$/readme.dtd virtual : $(MERGEDXRM) $(COMMONMISC)$/readme.dtd $(PRJ)$/docs/readme.xsl $(MISC)$/readme_text.xsl : virtual - $(SED) 's#method="html".*>#method="text"/>#' < ..$/readme.xsl > $@ + $(SED) '' < ..$/readme.xsl > $@ $(MISC)$/$(GUI)$/$(eq,$(GUI),WNT readme README)_%.html : 'virtual' @@-$(MKDIRHIER) $(@:d) @@ -79,6 +79,7 @@ $(SYSTEXTDOCS) : $(MISC)$/readme_text.xsl --stringparam os1 $(OS) --stringparam gui1 $(GUI) --stringparam com1 $(COM) \ --stringparam cp1 $(CPUNAME) --stringparam type text --stringparam lang1 $(@:b:s/readme_//:s/README_//) \ $< $(MERGEDXRM) + .IF "$(GUI)"=="UNX" chmod g+w $(MISC)$/$(GUI) .ENDIF # "$(GUI)"=="UNX" -- cgit From 7ef48b304fe975501f32f8261ee620ebbedc90e5 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Tue, 1 Jun 2010 16:20:28 +0200 Subject: jl152 #i77196# fix compiler warnings --- desktop/source/deployment/gui/dp_gui_updatedata.hxx | 2 +- desktop/source/deployment/gui/dp_gui_updatedialog.cxx | 11 +++++------ desktop/source/deployment/manager/dp_extensionmanager.cxx | 2 +- desktop/util/makefile.mk | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui_updatedata.hxx b/desktop/source/deployment/gui/dp_gui_updatedata.hxx index 7228982da518..76eb8af31e8e 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedata.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedata.hxx @@ -47,7 +47,7 @@ namespace dp_gui { struct UpdateData { UpdateData( ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > const & aExt): - aInstalledPackage(aExt), bIsShared(false) {}; + bIsShared(false), aInstalledPackage(aExt){}; //When entries added to the listbox then there can be one for the user update and one //for the shared update. However, both list entries will contain the same UpdateData. diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index d121ad976a06..a27f04326b25 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -280,7 +280,6 @@ private: dp_gui::UpdateData const & data, ::rtl::OUString const & version = ::rtl::OUString()) const; void prepareUpdateData( - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > const & package, ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > const & updateInfo, UpdateDialog::DisabledUpdate & out_du, dp_gui::UpdateData & out_data) const; @@ -415,7 +414,7 @@ void UpdateDialog::Thread::execute() for (Map::iterator i(map.begin()); i != map.end(); ++i) { //determine if online updates meet the requirements - prepareUpdateData(i->second.package, i->second.info, + prepareUpdateData(i->second.info, i->second.disableUpdate, i->second.updateData); //determine if the update is installed in the user or shared repository @@ -613,7 +612,6 @@ void UpdateDialog::Thread::getOwnUpdateInformation( /** out_data will only be filled if all dependencies are ok. */ void UpdateDialog::Thread::prepareUpdateData( - css::uno::Reference< css::deployment::XPackage > const & package, css::uno::Reference< css::xml::dom::XNode > const & updateInfo, UpdateDialog::DisabledUpdate & out_du, dp_gui::UpdateData & out_data) const @@ -648,21 +646,22 @@ bool UpdateDialog::Thread::update( UpdateDialog::DisabledUpdate const & du, dp_gui::UpdateData const & data) const { + bool ret = false; if (du.unsatisfiedDependencies.getLength() == 0) { vos::OGuard g(Application::GetSolarMutex()); if (!m_stop) { m_dialog.addEnabledUpdate(getUpdateDisplayString(data), data); } - return !m_stop; + ret = !m_stop; } else { vos::OGuard g(Application::GetSolarMutex()); if (!m_stop) { m_dialog.addDisabledUpdate(du); } - return !m_stop; + ret = !m_stop; } - return true; + return ret; } // UpdateDialog ---------------------------------------------------------- diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 251e70a19ce6..24b5712ebd30 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -251,7 +251,7 @@ void ExtensionManager::addExtensionsToMap( ::std::list > ExtensionManager::getExtensionsWithSameId( OUString const & identifier, OUString const & fileName, - Reference< ucb::XCommandEnvironment> const & xCmdEnv) + Reference< ucb::XCommandEnvironment> const & /*xCmdEnv*/) { ::std::list > extensionList; diff --git a/desktop/util/makefile.mk b/desktop/util/makefile.mk index 47885dfd6b73..8cf03f157254 100644 --- a/desktop/util/makefile.mk +++ b/desktop/util/makefile.mk @@ -108,7 +108,7 @@ APP5RPATH=BRAND APP5OBJS=$(OBJ)$/copyright_ascii_ooo.obj $(OBJ)$/main.obj APP5STDLIBS = $(SALLIB) $(SOFFICELIB) .IF "$(OS)" == "LINUX" -APP5STDLIBS+= -lXext +APP5STDLIBS+= -lXext -lX11 #APP5STDLIBS+= -lXext -lSM -lICE .ENDIF # LINUX -- cgit From ce6749f139440c79b207e26a522a177f4c2594d0 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 1 Jun 2010 17:15:33 +0200 Subject: CWS mba33issues01: #i107576#: create OwnLightClient only if there isn't a client already --- svx/source/svdraw/svdoole2.cxx | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 15c2ecb9c564..483c247c064f 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1832,11 +1832,7 @@ void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract // if the object needs recompose on resize // the client site should be created before the resize will take place // check whether there is no client site and create it if necessary - if ( !SfxInPlaceClient::GetClient( dynamic_cast(pModel->GetPersist()), xObjRef.GetObject() ) - && !( mpImpl->pLightClient && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) ) ) - { - AddOwnLightClient(); - } + AddOwnLightClient(); } } @@ -2197,26 +2193,32 @@ sal_Bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScal sal_Bool SdrOle2Obj::AddOwnLightClient() { // The Own Light Client must be registered in object only using this method! - Connect(); - - if ( xObjRef.is() && mpImpl->pLightClient ) + if ( !SfxInPlaceClient::GetClient( dynamic_cast(pModel->GetPersist()), xObjRef.GetObject() ) + && !( mpImpl->pLightClient && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) ) ) { - Fraction aScaleWidth; - Fraction aScaleHeight; - Size aObjAreaSize; - if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) ) + Connect(); + + if ( xObjRef.is() && mpImpl->pLightClient ) { - mpImpl->pLightClient->SetSizeScale( aScaleWidth, aScaleHeight ); - try { - xObjRef->setClientSite( mpImpl->pLightClient ); - return sal_True; - } catch( uno::Exception& ) - {} + Fraction aScaleWidth; + Fraction aScaleHeight; + Size aObjAreaSize; + if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) ) + { + mpImpl->pLightClient->SetSizeScale( aScaleWidth, aScaleHeight ); + try { + xObjRef->setClientSite( mpImpl->pLightClient ); + return sal_True; + } catch( uno::Exception& ) + {} + } + } + return sal_False; } - return sal_False; + return sal_True; } ////////////////////////////////////////////////////////////////////////////// -- cgit From a340fb93fa310e0eb82c3bd5ac7d5b9a3b22ce70 Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Wed, 2 Jun 2010 08:50:04 +0200 Subject: jl152#i77196# Enable showing license during startup check, better handling of extensions with unaccepted license --- desktop/source/app/check_ext_deps.cxx | 49 +++++++++++++++---- desktop/source/deployment/gui/dp_gui.hrc | 2 + desktop/source/deployment/gui/dp_gui_dialog.src | 10 ++++ desktop/source/deployment/gui/dp_gui_dialog2.cxx | 44 ++++++++++++----- desktop/source/deployment/gui/dp_gui_dialog2.hxx | 10 ++-- .../deployment/gui/dp_gui_extensioncmdqueue.cxx | 56 +++++++++++++++++++++- .../deployment/gui/dp_gui_extensioncmdqueue.hxx | 1 + .../source/deployment/gui/dp_gui_extlistbox.cxx | 15 +++++- .../source/deployment/gui/dp_gui_extlistbox.hxx | 4 +- desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 49 ++++++++----------- desktop/source/deployment/gui/dp_gui_theextmgr.hxx | 10 +--- desktop/source/deployment/manager/dp_manager.cxx | 2 +- 12 files changed, 186 insertions(+), 66 deletions(-) mode change 100644 => 100755 desktop/source/app/check_ext_deps.cxx mode change 100644 => 100755 desktop/source/deployment/gui/dp_gui.hrc mode change 100644 => 100755 desktop/source/deployment/gui/dp_gui_dialog.src mode change 100644 => 100755 desktop/source/deployment/gui/dp_gui_dialog2.cxx mode change 100644 => 100755 desktop/source/deployment/gui/dp_gui_dialog2.hxx mode change 100644 => 100755 desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx mode change 100644 => 100755 desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx mode change 100644 => 100755 desktop/source/deployment/gui/dp_gui_extlistbox.cxx mode change 100644 => 100755 desktop/source/deployment/gui/dp_gui_extlistbox.hxx mode change 100644 => 100755 desktop/source/deployment/gui/dp_gui_theextmgr.cxx mode change 100644 => 100755 desktop/source/deployment/gui/dp_gui_theextmgr.hxx diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx old mode 100644 new mode 100755 index e9c71bc1ea36..ebdc9ccdf51e --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -39,6 +39,7 @@ #include "vcl/timer.hxx" #include +#include "toolkit/helper/vclunohelper.hxx" #include #include @@ -48,10 +49,14 @@ #include #include "com/sun/star/deployment/XPackage.hpp" #include "com/sun/star/deployment/ExtensionManager.hpp" +#include "com/sun/star/deployment/LicenseException.hpp" +#include "com/sun/star/deployment/ui/LicenseDialog.hpp" #include #include #include +#include #include +#include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp" #include #include "app.hxx" @@ -132,21 +137,47 @@ Reference SilentCommandEnv::getProgressHandler() void SilentCommandEnv::handle( Reference< task::XInteractionRequest> const & xRequest ) throw (uno::RuntimeException) { + deployment::LicenseException licExc; + uno::Any request( xRequest->getRequest() ); + bool bApprove = true; + + if ( request >>= licExc ) + { + uno::Reference< uno::XComponentContext > xContext = comphelper_getProcessComponentContext(); + uno::Reference< ui::dialogs::XExecutableDialog > xDialog( + deployment::ui::LicenseDialog::create( + xContext, VCLUnoHelper::GetInterface( NULL ), + licExc.ExtensionName, licExc.Text ) ); + sal_Int16 res = xDialog->execute(); + if ( res == ui::dialogs::ExecutableDialogResults::CANCEL ) + bApprove = false; + else if ( res == ui::dialogs::ExecutableDialogResults::OK ) + bApprove = true; + else + { + OSL_ASSERT(0); + } + } // We approve everything here - uno::Sequence< Reference< task::XInteractionContinuation > > conts( - xRequest->getContinuations() ); - Reference< task::XInteractionContinuation > const * pConts = - conts.getConstArray(); + uno::Sequence< Reference< task::XInteractionContinuation > > conts( xRequest->getContinuations() ); + Reference< task::XInteractionContinuation > const * pConts = conts.getConstArray(); sal_Int32 len = conts.getLength(); + for ( sal_Int32 pos = 0; pos < len; ++pos ) { - - Reference< task::XInteractionApprove > xInteractionApprove( - pConts[ pos ], uno::UNO_QUERY ); - if (xInteractionApprove.is()) { - xInteractionApprove->select(); + if ( bApprove ) + { + uno::Reference< task::XInteractionApprove > xInteractionApprove( pConts[ pos ], uno::UNO_QUERY ); + if ( xInteractionApprove.is() ) + xInteractionApprove->select(); + } + else + { + uno::Reference< task::XInteractionAbort > xInteractionAbort( pConts[ pos ], uno::UNO_QUERY ); + if ( xInteractionAbort.is() ) + xInteractionAbort->select(); } } } diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc old mode 100644 new mode 100755 index 022141976f55..5f52b042edf3 --- a/desktop/source/deployment/gui/dp_gui.hrc +++ b/desktop/source/deployment/gui/dp_gui.hrc @@ -153,6 +153,7 @@ #define RID_STR_REMOVING_PACKAGES (RID_DEPLOYMENT_GUI_START+86) #define RID_STR_ENABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+87) #define RID_STR_DISABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+88) +#define RID_STR_ACCEPT_LICENSE (RID_DEPLOYMENT_GUI_START+89) #define RID_STR_INSTALL_FOR_ALL (RID_DEPLOYMENT_GUI_START+90) #define RID_STR_INSTALL_FOR_ME (RID_DEPLOYMENT_GUI_START+91) @@ -161,6 +162,7 @@ #define RID_STR_EXIT_BTN (RID_DEPLOYMENT_GUI_START+94) #define RID_STR_NO_ADMIN_PRIVILEGE (RID_DEPLOYMENT_GUI_START+95) #define RID_STR_ERROR_MISSING_DEPENDENCIES (RID_DEPLOYMENT_GUI_START+96) +#define RID_STR_ERROR_MISSING_LICENSE (RID_DEPLOYMENT_GUI_START+97) #define WARNINGBOX_CONCURRENTINSTANCE (RID_DEPLOYMENT_GUI_START+100) diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src old mode 100644 new mode 100755 index f9d9c0e011c6..15823288ee20 --- a/desktop/source/deployment/gui/dp_gui_dialog.src +++ b/desktop/source/deployment/gui/dp_gui_dialog.src @@ -72,6 +72,11 @@ String RID_STR_DISABLING_PACKAGES Text [ en-US ] = "Disabling %EXTENSION_NAME"; }; +String RID_STR_ACCEPT_LICENSE +{ + Text [ en-US ] = "Accept license for %EXTENSION_NAME"; +}; + String RID_STR_INSTALL_FOR_ALL { Text [ en-US ] = "~For all users"; @@ -109,6 +114,11 @@ String RID_STR_ERROR_MISSING_DEPENDENCIES Text [ en-US ] = "The extension cannot be enabled as the following system dependencies are not fulfilled:"; }; +String RID_STR_ERROR_MISSING_LICENSE +{ + Text [ en-US ] = "This extension is disabled because you haven't accepted the license yet.\n"; +}; + // Dialog layout // --------------------------------------------------- // row 1 | multi line edit diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx old mode 100644 new mode 100755 index 35634d5ef851..d34001393ba7 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -37,6 +37,7 @@ #include "dp_gui_extlistbox.hxx" #include "dp_gui_shared.hxx" #include "dp_gui_theextmgr.hxx" +#include "dp_gui_extensioncmdqueue.hxx" #include "dp_misc.h" #include "dp_identifier.hxx" @@ -291,7 +292,8 @@ void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry ) m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_ENABLE ); } - if ( !pEntry->m_bUser || ( pEntry->m_eState == NOT_AVAILABLE ) || pEntry->m_bMissingDeps ) + if ( ( !pEntry->m_bUser || ( pEntry->m_eState == NOT_AVAILABLE ) || pEntry->m_bMissingDeps ) + && !pEntry->m_bMissingLic ) m_pEnableBtn->Hide(); else { @@ -511,9 +513,14 @@ IMPL_LINK( ExtBoxWithBtns_Impl, HandleEnableBtn, void*, EMPTYARG ) if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) { TEntry_Impl pEntry = GetEntryData( nActive ); - const bool bEnable( pEntry->m_eState != REGISTERED ); - m_pParent->enablePackage( pEntry->m_xPackage, bEnable ); + if ( pEntry->m_bMissingLic ) + m_pParent->acceptLicense( pEntry->m_xPackage ); + else + { + const bool bEnable( pEntry->m_eState != REGISTERED ); + m_pParent->enablePackage( pEntry->m_xPackage, bEnable ); + } } return 1; @@ -760,10 +767,11 @@ void ExtMgrDialog::setGetExtensionsURL( const ::rtl::OUString &rURL ) } //------------------------------------------------------------------------------ -long ExtMgrDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage ) +long ExtMgrDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage, + bool bLicenseMissing ) { m_aUpdateBtn.Enable( true ); - return m_pExtensionBox->addEntry( xPackage ); + return m_pExtensionBox->addEntry( xPackage, bLicenseMissing ); } //------------------------------------------------------------------------------ @@ -810,7 +818,7 @@ bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackage > & return false; } - m_pManager->enablePackage( xPackage, bEnable ); + m_pManager->getCmdQueue()->enableExtension( xPackage, bEnable ); return true; } @@ -830,7 +838,7 @@ bool ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackage > & if ( ! continueOnSharedExtension( xPackage, this, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) ) return false; - m_pManager->removePackage( xPackage ); + m_pManager->getCmdQueue()->removeExtension( xPackage ); return true; } @@ -851,7 +859,18 @@ bool ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackage > & std::vector< css::uno::Reference< css::deployment::XPackage > > vEntries; vEntries.push_back(extension); - m_pManager->updatePackages( vEntries ); + m_pManager->getCmdQueue()->checkForUpdates( vEntries ); + + return true; +} + +//------------------------------------------------------------------------------ +bool ExtMgrDialog::acceptLicense( const uno::Reference< deployment::XPackage > &xPackage ) +{ + if ( !xPackage.is() ) + return false; + + m_pManager->getCmdQueue()->acceptLicense( xPackage ); return true; } @@ -1300,10 +1319,11 @@ UpdateRequiredDialog::~UpdateRequiredDialog() } //------------------------------------------------------------------------------ -long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage ) +long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage, + bool bLicenseMissing ) { // We will only add entries to the list with unsatisfied dependencies - if ( !checkDependencies( xPackage ) ) + if ( !bLicenseMissing && !checkDependencies( xPackage ) ) { m_bHasLockedEntries |= m_pManager->isReadOnly( xPackage ); m_aUpdateBtn.Enable( true ); @@ -1335,7 +1355,7 @@ void UpdateRequiredDialog::checkEntries() bool UpdateRequiredDialog::enablePackage( const uno::Reference< deployment::XPackage > &xPackage, bool bEnable ) { - m_pManager->enablePackage( xPackage, bEnable ); + m_pManager->getCmdQueue()->enableExtension( xPackage, bEnable ); return true; } @@ -1462,7 +1482,7 @@ IMPL_LINK( UpdateRequiredDialog, HandleUpdateBtn, void*, EMPTYARG ) aGuard.clear(); - m_pManager->updatePackages( vUpdateEntries ); + m_pManager->getCmdQueue()->checkForUpdates( vUpdateEntries ); return 1; } diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx old mode 100644 new mode 100755 index 4c99d64740db..f0a85cce98c0 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -81,7 +81,8 @@ public: virtual void updateProgress( const long nProgress ) = 0; virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) = 0; - virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) = 0; + virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, + bool bLicenseMissing = false ) = 0; virtual void prepareChecking() = 0; virtual void checkEntries() = 0; @@ -157,11 +158,13 @@ public: virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); void setGetExtensionsURL( const ::rtl::OUString &rURL ); - virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &); + virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, + bool bLicenseMissing = false ); bool enablePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, bool bEnable ); bool removePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); bool updatePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + bool acceptLicense(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); virtual void prepareChecking(); virtual void checkEntries(); @@ -228,7 +231,8 @@ public: virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); void selectEntry( long nPos ); - virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & ); + virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, + bool bLicenseMissing = false ); bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, bool bEnable ); bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx old mode 100644 new mode 100755 index 954f32f4c9c6..e3c8b2bfb46b --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -195,7 +195,7 @@ public: //------------------------------------------------------------------------------ struct ExtensionCmd { - enum E_CMD_TYPE { ADD, ENABLE, DISABLE, REMOVE, CHECK_FOR_UPDATES }; + enum E_CMD_TYPE { ADD, ENABLE, DISABLE, REMOVE, CHECK_FOR_UPDATES, ACCEPT_LICENSE }; E_CMD_TYPE m_eCmdType; bool m_bWarnUser; @@ -241,6 +241,7 @@ public: void enableExtension( const uno::Reference< deployment::XPackage > &rPackage, const bool bEnable ); void checkForUpdates( const std::vector > &vExtensionList ); + void acceptLicense( const uno::Reference< deployment::XPackage > &rPackage ); void stop(); bool isBusy(); @@ -267,6 +268,8 @@ private: void _disableExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv, const uno::Reference< deployment::XPackage > &xPackage ); void _checkForUpdates( const std::vector > &vExtensionList ); + void _acceptLicense( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv, + const uno::Reference< deployment::XPackage > &xPackage ); enum Input { NONE, START, STOP }; @@ -281,6 +284,7 @@ private: const OUString m_sAddingPackages; const OUString m_sRemovingPackages; const OUString m_sDefaultCmd; + const OUString m_sAcceptLicense; osl::Condition m_wakeup; osl::Mutex m_mutex; Input m_eInput; @@ -626,6 +630,7 @@ ExtensionCmdQueue::Thread::Thread( DialogHelper *pDialogHelper, m_sAddingPackages( DialogHelper::getResourceString( RID_STR_ADDING_PACKAGES ) ), m_sRemovingPackages( DialogHelper::getResourceString( RID_STR_REMOVING_PACKAGES ) ), m_sDefaultCmd( DialogHelper::getResourceString( RID_STR_ADD_PACKAGES ) ), + m_sAcceptLicense( DialogHelper::getResourceString( RID_STR_ACCEPT_LICENSE ) ), m_eInput( NONE ), m_bTerminated( false ), m_bStopped( false ), @@ -674,6 +679,25 @@ void ExtensionCmdQueue::Thread::removeExtension( const uno::Reference< deploymen } } +//------------------------------------------------------------------------------ +void ExtensionCmdQueue::Thread::acceptLicense( const uno::Reference< deployment::XPackage > &rPackage ) +{ + ::osl::MutexGuard aGuard( m_mutex ); + + //If someone called stop then we do not remove the extension -> game over! + if ( m_bStopped ) + return; + + if ( rPackage.is() ) + { + TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::ACCEPT_LICENSE, rPackage ) ); + + m_queue.push( pEntry ); + m_eInput = START; + m_wakeup.set(); + } +} + //------------------------------------------------------------------------------ void ExtensionCmdQueue::Thread::enableExtension( const uno::Reference< deployment::XPackage > &rPackage, const bool bEnable ) @@ -815,6 +839,9 @@ void ExtensionCmdQueue::Thread::execute() case ExtensionCmd::CHECK_FOR_UPDATES : _checkForUpdates( pEntry->m_vExtensionList ); break; + case ExtensionCmd::ACCEPT_LICENSE : + _acceptLicense( currentCmdEnv, pEntry->m_xPackage ); + break; } } //catch ( deployment::DeploymentException &) @@ -1065,6 +1092,28 @@ void ExtensionCmdQueue::Thread::_disableExtension( ::rtl::Reference< ProgressCmd {} } +//------------------------------------------------------------------------------ +void ExtensionCmdQueue::Thread::_acceptLicense( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv, + const uno::Reference< deployment::XPackage > &xPackage ) +{ + if ( !xPackage.is() ) + return; + + uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); + uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() ); + OUString sTitle = searchAndReplaceAll( m_sAcceptLicense, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName() ); + rCmdEnv->progressSection( sTitle, xAbortChannel ); + + try + { + xExtMgr->checkPrerequisitesAndEnable( xPackage, xAbortChannel, rCmdEnv.get() ); + if ( m_pDialogHelper ) + m_pDialogHelper->updatePackageInfo( xPackage ); + } + catch ( ::ucb::CommandAbortedException & ) + {} +} + //------------------------------------------------------------------------------ void ExtensionCmdQueue::Thread::onTerminated() { @@ -1131,6 +1180,11 @@ void ExtensionCmdQueue::checkForUpdates( const std::vectorcheckForUpdates( vExtensionList ); } +void ExtensionCmdQueue::acceptLicense( const uno::Reference< deployment::XPackage > &rPackage ) +{ + m_thread->acceptLicense( rPackage ); +} + void ExtensionCmdQueue::stop() { m_thread->stop(); diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx old mode 100644 new mode 100755 index cfadad84cedc..29cee4292102 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx @@ -85,6 +85,7 @@ public: const bool bEnable ); void checkForUpdates(const std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > > &vList ); + void acceptLicense( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage ); /** This call does not block. It signals the internal thread that it should install the remaining extensions and then terminate. diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx old mode 100644 new mode 100755 index dbb5c93cd853..d76764fa1e53 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -66,6 +66,7 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, m_bChecked( false ), m_bMissingDeps( false ), m_bHasButtons( false ), + m_bMissingLic( false ), m_eState( eState ), m_pPublisher( NULL ), m_xPackage( xPackage ) @@ -372,6 +373,8 @@ void ExtensionBox_Impl::CalcActiveHeight( const long nPos ) aSize.Height() = 10000; rtl::OUString aText( m_vEntries[ nPos ]->m_sErrorText ); + if ( aText.getLength() ) + aText += OUSTR("\n"); aText += m_vEntries[ nPos ]->m_sDescription; Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ), aText, @@ -634,7 +637,7 @@ void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntr else DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aSharedImageHC : m_aSharedImage ); } - if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps ) + if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps || pEntry->m_bMissingLic ) { aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET ); DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage ); @@ -952,7 +955,8 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStar } //------------------------------------------------------------------------------ -long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage ) +long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage, + bool bLicenseMissing ) { long nPos = 0; PackageState eState = m_pManager->getPackageState( xPackage ); @@ -982,6 +986,10 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & pEntry->m_bUser = xPackage->getRepositoryName().equals( USER_PACKAGE_MANAGER ); pEntry->m_bShared = xPackage->getRepositoryName().equals( SHARED_PACKAGE_MANAGER ); pEntry->m_bNew = m_bInCheckMode; + pEntry->m_bMissingLic = bLicenseMissing; + + if ( bLicenseMissing ) + pEntry->m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_MISSING_LICENSE ); //access to m_nActive must be guarded if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) ) @@ -1017,6 +1025,9 @@ void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage else (*iIndex)->m_sErrorText = String(); + if ( eState == REGISTERED ) + (*iIndex)->m_bMissingLic = false; + if ( IsReallyVisible() ) Invalidate(); break; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx old mode 100644 new mode 100755 index 0f56d022492b..762f50296690 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -73,6 +73,7 @@ struct Entry_Impl bool m_bChecked :1; bool m_bMissingDeps :1; bool m_bHasButtons :1; + bool m_bMissingLic :1; PackageState m_eState; String m_sTitle; String m_sVersion; @@ -205,7 +206,8 @@ public: //----------------- virtual void selectEntry( const long nPos ); - long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, + bool bLicenseMissing = false ); void updateEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); void removeEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx old mode 100644 new mode 100755 index fdbc1974f61c..7bfcc79480b3 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -67,7 +67,8 @@ TheExtensionManager::TheExtensionManager( Window *pParent, m_xContext( xContext ), m_pParent( pParent ), m_pExtMgrDialog( NULL ), - m_pUpdReqDialog( NULL ) + m_pUpdReqDialog( NULL ), + m_pExecuteCmdQueue( NULL ) { m_xExtensionManager = deployment::ExtensionManager::get( xContext ); m_xExtensionManager->addModifyListener( this ); @@ -117,6 +118,8 @@ TheExtensionManager::~TheExtensionManager() delete m_pUpdReqDialog; if ( m_pExtMgrDialog ) delete m_pExtMgrDialog; + if ( m_pExecuteCmdQueue ) + delete m_pExecuteCmdQueue; } //------------------------------------------------------------------------------ @@ -129,14 +132,16 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg ) if ( !m_pUpdReqDialog ) { m_pUpdReqDialog = new UpdateRequiredDialog( NULL, this ); - m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( (DialogHelper*) m_pUpdReqDialog, this, m_xContext ) ); + delete m_pExecuteCmdQueue; + m_pExecuteCmdQueue = new ExtensionCmdQueue( (DialogHelper*) m_pUpdReqDialog, this, m_xContext ); createPackageList(); } } else if ( !m_pExtMgrDialog ) { m_pExtMgrDialog = new ExtMgrDialog( m_pParent, this ); - m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( (DialogHelper*) m_pExtMgrDialog, this, m_xContext ) ); + delete m_pExecuteCmdQueue; + m_pExecuteCmdQueue = new ExtensionCmdQueue( (DialogHelper*) m_pExtMgrDialog, this, m_xContext ); m_pExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL ); createPackageList(); } @@ -231,32 +236,6 @@ bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bPare return true; } -//------------------------------------------------------------------------------ -bool TheExtensionManager::enablePackage( const uno::Reference< deployment::XPackage > &xPackage, - bool bEnable ) -{ - m_pExecuteCmdQueue->enableExtension( xPackage, bEnable ); - - return true; -} - -//------------------------------------------------------------------------------ -bool TheExtensionManager::removePackage( const uno::Reference< deployment::XPackage > &xPackage ) -{ - m_pExecuteCmdQueue->removeExtension( xPackage ); - - return true; -} - -//------------------------------------------------------------------------------ -bool TheExtensionManager::updatePackages( - const std::vector< uno::Reference< deployment::XPackage > > &vList ) -{ - m_pExecuteCmdQueue->checkForUpdates( vList ); - - return true; -} - //------------------------------------------------------------------------------ bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWarnUser ) { @@ -343,6 +322,18 @@ void TheExtensionManager::createPackageList() } } } + + uno::Sequence< uno::Reference< deployment::XPackage > > xNoLicPackages; + xNoLicPackages = m_xExtensionManager->getExtensionsWithUnacceptedLicenses( SHARED_PACKAGE_MANAGER, + uno::Reference< ucb::XCommandEnvironment >() ); + for ( sal_Int32 i = 0; i < xNoLicPackages.getLength(); ++i ) + { + uno::Reference< deployment::XPackage > xPackage = xNoLicPackages[i]; + if ( xPackage.is() ) + { + getDialogHelper()->addPackageToList( xPackage, true ); + } + } } //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx old mode 100644 new mode 100755 index da8d3c083f42..094e25e249b7 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -61,11 +61,10 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNameAccessNodes; - ::std::auto_ptr< ExtensionCmdQueue > m_pExecuteCmdQueue; - Window *m_pParent; ExtMgrDialog *m_pExtMgrDialog; UpdateRequiredDialog *m_pUpdReqDialog; + ExtensionCmdQueue *m_pExecuteCmdQueue; ::rtl::OUString m_sGetExtensionsURL; @@ -83,6 +82,7 @@ public: Dialog* getDialog() { return m_pExtMgrDialog ? (Dialog*) m_pExtMgrDialog : (Dialog*) m_pUpdReqDialog; } DialogHelper* getDialogHelper() { return m_pExtMgrDialog ? (DialogHelper*) m_pExtMgrDialog : (DialogHelper*) m_pUpdReqDialog; } + ExtensionCmdQueue* getCmdQueue() const { return m_pExecuteCmdQueue; } void SetText( const ::rtl::OUString &rTitle ); void Show(); @@ -92,12 +92,6 @@ public: //----------------- bool checkUpdates( bool showUpdateOnly, bool parentVisible ); - bool updatePackages( const std::vector< ::com::sun::star::uno::Reference< - ::com::sun::star::deployment::XPackage > > &vList ); - - bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, - bool bEnable ); - bool removePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); bool installPackage( const ::rtl::OUString &rPackageURL, bool bWarnUser = false ); bool queryTermination(); diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 7844e11b0651..409cf2674184 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -927,7 +927,7 @@ void PackageManagerImpl::removePackage( //the flag file it will then recognize, that the extension was //deleted and can then update the extnesion database of the shared //extensions in the user installation. - if (! m_readOnly && !xPackage->isRemoved() && m_context.equals(OUSTR("shared"))) + if ( xPackage.is() && !m_readOnly && !xPackage->isRemoved() && m_context.equals(OUSTR("shared"))) { ActivePackages::Data val; m_activePackagesDB->get( & val, id, fileName); -- cgit From 057d47a436bab4ba71a101f7d2ad21cabae0cd20 Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Wed, 2 Jun 2010 09:31:52 +0200 Subject: jl152#i77196# better handling of extensions with unaccepted license --- desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index d76764fa1e53..24b47aa223e3 100755 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -1020,14 +1020,14 @@ void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage (*iIndex)->m_sVersion = xPackage->getVersion(); (*iIndex)->m_sDescription = xPackage->getDescription(); + if ( eState == REGISTERED ) + (*iIndex)->m_bMissingLic = false; + if ( eState == AMBIGUOUS ) (*iIndex)->m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS ); - else + else if ( ! (*iIndex)->m_bMissingLic ) (*iIndex)->m_sErrorText = String(); - if ( eState == REGISTERED ) - (*iIndex)->m_bMissingLic = false; - if ( IsReallyVisible() ) Invalidate(); break; -- cgit From d90913a6131cd829292e7f13cc6c9b28120a5e43 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 2 Jun 2010 10:16:03 +0200 Subject: CWS mba33issues01: #i112021#: remove obsolete code --- sfx2/source/dialog/about.cxx | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/sfx2/source/dialog/about.cxx b/sfx2/source/dialog/about.cxx index 66d4146d9e62..02f05c773f73 100644 --- a/sfx2/source/dialog/about.cxx +++ b/sfx2/source/dialog/about.cxx @@ -130,20 +130,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS rtl::OUString sProduct; utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct; - if ( sProduct.equals( rtl::OUString::createFromAscii("StarOffice") ) || - sProduct.equals( rtl::OUString::createFromAscii("StarSuite") ) ) - { - // --> PB 2004-11-18 #118455# new copyright text (only in french version show a french text) - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); - ::rtl::OUString sFrenchLang( DEFINE_CONST_OUSTRING( "fr" ) ); - if ( aLocale.Language.equals( sFrenchLang ) ) - { - String sNewCopyrightText( ResId( ABOUT_STR_FRENCH_COPYRIGHT, *rId.GetResMgr() ) ); - aCopyrightText.SetText( sNewCopyrightText ); - } - // <-- - } - // load image from module path rtl::OUString aAbouts( RTL_CONSTASCII_USTRINGPARAM( ABOUT_BITMAP_STRINGLIST ) ); bool bLoaded = false; @@ -289,22 +275,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS // explizite Help-Id SetHelpId( SID_ABOUT ); - - //#112429# replace occurences of "StarOffice" in the "StarSuite" version - String sCopyright( aCopyrightText.GetText() ); - if(sProduct.equals(rtl::OUString::createFromAscii("StarSuite"))) - { - String sSO(String::CreateFromAscii("StarOffice")); - sCopyright.SearchAndReplaceAll(sSO, sProduct); - } - - String sNewYear( DEFINE_CONST_UNICODE("2005") ); - xub_StrLen nIdx = sCopyright.SearchAndReplace( DEFINE_CONST_UNICODE("2002"), sNewYear ); - if ( STRING_NOTFOUND == nIdx ) - nIdx = sCopyright.SearchAndReplace( DEFINE_CONST_UNICODE("2003"), sNewYear ); - if ( STRING_NOTFOUND == nIdx ) - nIdx = sCopyright.SearchAndReplace( DEFINE_CONST_UNICODE("2004"), sNewYear ); - aCopyrightText.SetText( sCopyright ); } // ----------------------------------------------------------------------- -- cgit From 04615ba86017896e0fb4bf951004ba2e4e22e6c9 Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Thu, 3 Jun 2010 09:35:22 +0200 Subject: jl152#i77196# unopkg gui should sync repositories, too --- desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 6 ++++++ desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx | 1 + desktop/source/deployment/gui/dp_gui_service.cxx | 2 ++ 3 files changed, 9 insertions(+) mode change 100644 => 100755 desktop/source/deployment/gui/dp_gui_service.cxx diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index e3c8b2bfb46b..8bd8a6191201 100755 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -76,6 +76,7 @@ #include "comphelper/anytostring.hxx" #include "vcl/msgbox.hxx" #include "toolkit/helper/vclunohelper.hxx" +#include "comphelper/processfactory.hxx" #include "dp_gui.h" #include "dp_gui_thread.hxx" @@ -1185,6 +1186,11 @@ void ExtensionCmdQueue::acceptLicense( const uno::Reference< deployment::XPackag m_thread->acceptLicense( rPackage ); } +void ExtensionCmdQueue::syncRepositories( const uno::Reference< uno::XComponentContext > &xContext ) +{ + dp_misc::syncRepositories( new ProgressCmdEnv( xContext, NULL, OUSTR("Extension Manager") ) ); +} + void ExtensionCmdQueue::stop() { m_thread->stop(); diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx index 29cee4292102..7ac00e2740d4 100755 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx @@ -86,6 +86,7 @@ public: void checkForUpdates(const std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > > &vList ); void acceptLicense( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage ); + static void syncRepositories( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext ); /** This call does not block. It signals the internal thread that it should install the remaining extensions and then terminate. diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx old mode 100644 new mode 100755 index 061988d5b04d..c4269e6ac137 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -46,6 +46,7 @@ #include "boost/bind.hpp" #include "license_dialog.hxx" #include "dp_gui_dialog2.hxx" +#include "dp_gui_extensioncmdqueue.hxx" using namespace ::dp_misc; using namespace ::com::sun::star; @@ -256,6 +257,7 @@ void ServiceImpl::startExecuteModal( + ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION).get(); app->SetDisplayName(sTitle); + ExtensionCmdQueue::syncRepositories( m_xComponentContext ); } } else -- cgit From a82d6ff3b4aa2453120cd1bcb3fb69c1d3e2aed2 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Wed, 2 Jun 2010 17:05:21 +0200 Subject: jl152 #i77196# bubble update notification now supports the new update behavior --- desktop/source/deployment/gui/dp_gui_dialog2.cxx | 1 + desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 1 + .../source/deployment/gui/dp_gui_updatedialog.cxx | 170 ++------- desktop/source/deployment/inc/dp_misc.h | 52 --- desktop/source/deployment/inc/dp_update.hxx | 147 ++++++++ .../deployment/manager/dp_informationprovider.cxx | 275 +++++--------- desktop/source/deployment/misc/dp_misc.cxx | 152 -------- desktop/source/deployment/misc/dp_update.cxx | 397 +++++++++++++++++++++ desktop/source/deployment/misc/makefile.mk | 3 +- 9 files changed, 679 insertions(+), 519 deletions(-) create mode 100755 desktop/source/deployment/inc/dp_update.hxx create mode 100755 desktop/source/deployment/misc/dp_update.cxx diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index d34001393ba7..4ba747198c09 100755 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -39,6 +39,7 @@ #include "dp_gui_theextmgr.hxx" #include "dp_gui_extensioncmdqueue.hxx" #include "dp_misc.h" +#include "dp_update.hxx" #include "dp_identifier.hxx" #include "vcl/ctrl.hxx" diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 7bfcc79480b3..d0347c7cbf4e 100755 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -42,6 +42,7 @@ #include "dp_gui_theextmgr.hxx" #include "dp_gui_theextmgr.hxx" #include "dp_identifier.hxx" +#include "dp_update.hxx" #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index a27f04326b25..b27cd8da81fe 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -112,6 +112,7 @@ #include "dp_identifier.hxx" #include "dp_version.hxx" #include "dp_misc.h" +#include "dp_update.hxx" #include "dp_gui.h" #include "dp_gui.hrc" @@ -254,7 +255,7 @@ private: }; // A multimap in case an extension is installed in "user", "shared" or "bundled" - typedef std::multimap< rtl::OUString, Entry > Map; + typedef std::map< rtl::OUString, Entry > Map; virtual ~Thread(); @@ -357,78 +358,44 @@ UpdateDialog::Thread::~Thread() void UpdateDialog::Thread::execute() { - OSL_ASSERT( ! m_vExtensionList.empty() ); - Map map; - - typedef std::vector< css::uno::Reference< css::deployment::XPackage > >::const_iterator ITER; - for ( ITER iIndex = m_vExtensionList.begin(); iIndex < m_vExtensionList.end(); ++iIndex ) { - css::uno::Reference< css::deployment::XPackage > p = *iIndex; - if ( p.is() ) - { - { - vos::OGuard g( Application::GetSolarMutex() ); - if ( m_stop ) { - return; - } - } - getOwnUpdateInformation( p, &map ); - } - } - - const rtl::OUString sDefaultURL(dp_misc::getExtensionDefaultUpdateURL()); - if (sDefaultURL.getLength()) - { - css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > - infos( - getUpdateInformation( - css::uno::Reference< css::deployment::XPackage >(), - css::uno::Sequence< rtl::OUString >(&sDefaultURL, 1), rtl::OUString())); - for (sal_Int32 i = 0; i < infos.getLength(); ++i) { - css::uno::Reference< css::xml::dom::XNode > node( - infos[i], css::uno::UNO_QUERY_THROW); - dp_misc::DescriptionInfoset infoset(m_context, node); - boost::optional< rtl::OUString > id(infoset.getIdentifier()); - if (!id) { - continue; - } - Map::iterator end(map.upper_bound(*id)); - for (Map::iterator j(map.lower_bound(*id)); j != end; ++j) { - //skip those extension which provide its own update urls - if (j->second.bProvidesOwnUpdate) - continue; - rtl::OUString v(infoset.getVersion()); - //look for the highest version in the online repository - if (dp_misc::compareVersions(v, j->second.version) == - dp_misc::GREATER) - { - j->second.version = v; - j->second.info = node; - } - } + vos::OGuard g( Application::GetSolarMutex() ); + if ( m_stop ) { + return; } } - css::uno::Reference extMgr = css::deployment::ExtensionManager::get(m_context); - for (Map::iterator i(map.begin()); i != map.end(); ++i) + + std::vector, css::uno::Any > > errors; + + dp_misc::UpdateInfoMap updateInfoMap = dp_misc::getOnlineUpdateInfos( + m_context, extMgr, m_updateInformation, &m_vExtensionList, errors); + + typedef std::vector, + css::uno::Any> >::const_iterator ITERROR; + for (ITERROR ite = errors.begin(); ite != errors.end(); ite ++) + handleSpecificError(ite->first, ite->second); + + for (dp_misc::UpdateInfoMap::iterator i(updateInfoMap.begin()); i != updateInfoMap.end(); i++) { + dp_misc::UpdateInfo const & info = i->second; + UpdateData updateData(info.extension); + DisabledUpdate disableUpdate; //determine if online updates meet the requirements - prepareUpdateData(i->second.info, - i->second.disableUpdate, i->second.updateData); + prepareUpdateData(info.info, disableUpdate, updateData); //determine if the update is installed in the user or shared repository rtl::OUString sOnlineVersion; - if (i->second.updateData.aUpdateInfo.is()) - sOnlineVersion = i->second.version; - + if (info.info.is()) + sOnlineVersion = info.version; rtl::OUString sVersionUser; rtl::OUString sVersionShared; rtl::OUString sVersionBundled; css::uno::Sequence< css::uno::Reference< css::deployment::XPackage> > extensions; try { extensions = extMgr->getExtensionsWithSameIdentifier( - dp_misc::getIdentifier(i->second.package), i->second.package->getName(), + dp_misc::getIdentifier(info.extension), info.extension->getName(), css::uno::Reference()); } catch (css::lang::IllegalArgumentException& ) { OSL_ASSERT(0); @@ -453,15 +420,15 @@ void UpdateDialog::Thread::execute() { if (sourceUser == dp_misc::UPDATE_SOURCE_SHARED) { - i->second.updateData.aUpdateSource = extensions[1]; - i->second.updateData.updateVersion = extensions[1]->getVersion(); + updateData.aUpdateSource = extensions[1]; + updateData.updateVersion = extensions[1]->getVersion(); } else if (sourceUser == dp_misc::UPDATE_SOURCE_BUNDLED) { - i->second.updateData.aUpdateSource = extensions[2]; - i->second.updateData.updateVersion = extensions[2]->getVersion(); + updateData.aUpdateSource = extensions[2]; + updateData.updateVersion = extensions[2]->getVersion(); } - if (!update(i->second.disableUpdate, i->second.updateData)) + if (!update(disableUpdate, updateData)) return; } @@ -469,11 +436,11 @@ void UpdateDialog::Thread::execute() { if (sourceShared == dp_misc::UPDATE_SOURCE_BUNDLED) { - i->second.updateData.aUpdateSource = extensions[2]; - i->second.updateData.updateVersion = extensions[2]->getVersion(); + updateData.aUpdateSource = extensions[2]; + updateData.updateVersion = extensions[2]->getVersion(); } - i->second.updateData.bIsShared = true; - if (!update(i->second.disableUpdate, i->second.updateData)) + updateData.bIsShared = true; + if (!update(disableUpdate, updateData)) return; } } @@ -517,71 +484,6 @@ void UpdateDialog::Thread::handleSpecificError( } } -css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > -UpdateDialog::Thread::getUpdateInformation( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Sequence< rtl::OUString > const & urls, - rtl::OUString const & identifier) const -{ - try { - return m_updateInformation->getUpdateInformation(urls, identifier); - } catch (css::uno::RuntimeException &) { - throw; - } catch (css::ucb::CommandFailedException & e) { - handleSpecificError(package, e.Reason); - } catch (css::ucb::CommandAbortedException &) { - } catch (css::uno::Exception & e) { - handleSpecificError(package, css::uno::makeAny(e)); - } - return - css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > >(); -} - -void UpdateDialog::Thread::getOwnUpdateInformation( - css::uno::Reference< css::deployment::XPackage > const & package, - Map * map) -{ - rtl::OUString id(dp_misc::getIdentifier(package)); - css::uno::Sequence< rtl::OUString > urls( - package->getUpdateInformationURLs()); - if (urls.getLength() == 0) { - map->insert( - Map::value_type( - id, Entry(package, OUSTR("")))); - } else { - css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > - infos(getUpdateInformation(package, urls, id)); - rtl::OUString latestVersion; - sal_Int32 latestIndex = -1; - for (sal_Int32 i = 0; i < infos.getLength(); ++i) { - dp_misc::DescriptionInfoset infoset( - m_context, - css::uno::Reference< css::xml::dom::XNode >( - infos[i], css::uno::UNO_QUERY_THROW)); - boost::optional< rtl::OUString > id2(infoset.getIdentifier()); - if (!id2) { - continue; - } - if (*id2 == id) { - rtl::OUString v(infoset.getVersion()); - if (dp_misc::compareVersions(v, latestVersion) == - dp_misc::GREATER) - { - latestVersion = v; - latestIndex = i; - } - } - } - if (latestIndex != -1) { - Entry e(package, latestVersion); - e.info = css::uno::Reference< css::xml::dom::XNode >( - infos[latestIndex], css::uno::UNO_QUERY_THROW); - e.bProvidesOwnUpdate = true; - map->insert(Map::value_type(id, e)); - } - } -} - ::rtl::OUString UpdateDialog::Thread::getUpdateDisplayString( dp_gui::UpdateData const & data, ::rtl::OUString const & version) const { @@ -590,7 +492,8 @@ void UpdateDialog::Thread::getOwnUpdateInformation( b.append(static_cast< sal_Unicode >(' ')); { vos::OGuard g( Application::GetSolarMutex() ); - b.append(m_dialog.m_version); + if(!m_stop) + b.append(m_dialog.m_version); } b.append(static_cast< sal_Unicode >(' ')); if (version.getLength()) @@ -603,7 +506,8 @@ void UpdateDialog::Thread::getOwnUpdateInformation( b.append(static_cast< sal_Unicode >(' ')); { vos::OGuard g( Application::GetSolarMutex() ); - b.append(m_dialog.m_browserbased); + if(!m_stop) + b.append(m_dialog.m_browserbased); } } return b.makeStringAndClear(); diff --git a/desktop/source/deployment/inc/dp_misc.h b/desktop/source/deployment/inc/dp_misc.h index 161b91a6bcde..61e3fcc45418 100644 --- a/desktop/source/deployment/inc/dp_misc.h +++ b/desktop/source/deployment/inc/dp_misc.h @@ -117,11 +117,6 @@ oslProcess raiseProcess( ::rtl::OUString const & appURL, ::com::sun::star::uno::Sequence< ::rtl::OUString > const & args ); //============================================================================== -/** returns the default update URL (for the update information) which - is used when an extension does not provide its own URL. -*/ -DESKTOP_DEPLOYMENTMISC_DLLPUBLIC -::rtl::OUString getExtensionDefaultUpdateURL(); /** writes the argument string to the console. On Linux/Unix/etc. it converts the UTF16 string to an ANSI string using @@ -179,53 +174,6 @@ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC void syncRepositories(::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment> const & xCmdEnv); -enum UPDATE_SOURCE -{ - UPDATE_SOURCE_NONE, - UPDATE_SOURCE_SHARED, - UPDATE_SOURCE_BUNDLED, - UPDATE_SOURCE_ONLINE -}; - -/* determine if an update is available which is installed in the - user repository. - - If the return value is UPDATE_SOURCE_NONE, then no update is - available, otherwise the return value determine from which the - repository the update is used. -*/ -DESKTOP_DEPLOYMENTMISC_DLLPUBLIC -UPDATE_SOURCE isUpdateUserExtension( - bool bReadOnlyShared, - ::rtl::OUString const & userVersion, - ::rtl::OUString const & sharedVersion, - ::rtl::OUString const & bundledVersion, - ::rtl::OUString const & onlineVersion); - -/* determine if an update is available which is installed in the - shared repository. - - If the return value is UPDATE_SOURCE_NONE, then no update is - available, otherwise the return value determine from which the - repository the update is used. -*/ -DESKTOP_DEPLOYMENTMISC_DLLPUBLIC -UPDATE_SOURCE isUpdateSharedExtension( - bool bReadOnlyShared, - ::rtl::OUString const & sharedVersion, - ::rtl::OUString const & bundledVersion, - ::rtl::OUString const & onlineVersion); - -/* determines the extension with the highest identifier and returns it - - */ -DESKTOP_DEPLOYMENTMISC_DLLPUBLIC -::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> -getExtensionWithHighestVersion( - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::deployment::XPackage> > const & seqExtensionsWithSameId); - } #endif diff --git a/desktop/source/deployment/inc/dp_update.hxx b/desktop/source/deployment/inc/dp_update.hxx new file mode 100755 index 000000000000..01511b1f2d21 --- /dev/null +++ b/desktop/source/deployment/inc/dp_update.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if ! defined INCLUDED_DP_UPDATE_HXX +#define INCLUDED_DP_UPDATE_HXX + + +#include "com/sun/star/deployment/XPackage.hpp" +#include "com/sun/star/deployment/XExtensionManager.hpp" +#include "com/sun/star/deployment/XUpdateInformationProvider.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/xml/dom/XNode.hpp" + +#include "rtl/ustrbuf.hxx" +#include "dp_misc_api.hxx" + +#include +#include + +namespace dp_misc { + +/** returns the default update URL (for the update information) which + is used when an extension does not provide its own URL. +*/ +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +::rtl::OUString getExtensionDefaultUpdateURL(); + +enum UPDATE_SOURCE +{ + UPDATE_SOURCE_NONE, + UPDATE_SOURCE_SHARED, + UPDATE_SOURCE_BUNDLED, + UPDATE_SOURCE_ONLINE +}; + +/* determine if an update is available which is installed in the + user repository. + + If the return value is UPDATE_SOURCE_NONE, then no update is + available, otherwise the return value determine from which the + repository the update is used. +*/ +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +UPDATE_SOURCE isUpdateUserExtension( + bool bReadOnlyShared, + ::rtl::OUString const & userVersion, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion); + +/* determine if an update is available which is installed in the + shared repository. + + If the return value is UPDATE_SOURCE_NONE, then no update is + available, otherwise the return value determine from which the + repository the update is used. +*/ +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +UPDATE_SOURCE isUpdateSharedExtension( + bool bReadOnlyShared, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion); + +/* determines the extension with the highest identifier and returns it + + */ +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> +getExtensionWithHighestVersion( + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::deployment::XPackage> > const & seqExtensionsWithSameId); + + +struct UpdateInfo +{ + UpdateInfo( ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> const & ext); + ::com::sun::star::uno::Reference< + ::com::sun::star::deployment::XPackage> extension; +//version of the update + ::rtl::OUString version; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > info; +}; + +typedef std::map< ::rtl::OUString, UpdateInfo > UpdateInfoMap; + +/* + @param extensionList + List of extension for which online update information are to be obtained. If NULL, then + for update information are obtained for all installed extension. There may be only one extension + with a particular identifier contained in the list. If one extension is installed + in several repositories, then the one with the highest version must be used, because it contains + the more recent URLs for getting the update information (if at all). + @param out_errors + the first member of the pair is the extension and the second the exception that was produced + when processing the extension. + + @return + A map of UpdateInfo instances. If the parameter extensionList was given, then the map contains + at only information for those extensions. + */ +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +UpdateInfoMap getOnlineUpdateInfos( + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const &xContext, + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager> const & xExtMgr, + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XUpdateInformationProvider > const & updateInformation, + std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > > const * extensionList, + ::std::vector< ::std::pair< ::com::sun::star::uno::Reference< + ::com::sun::star::deployment::XPackage>, ::com::sun::star::uno::Any> > & out_errors); + +/* retunrs the highest version from the provided arguments. +*/ +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC +::rtl::OUString getHighestVersion( + ::rtl::OUString const & userVersion, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion); + +} + +#endif diff --git a/desktop/source/deployment/manager/dp_informationprovider.cxx b/desktop/source/deployment/manager/dp_informationprovider.cxx index 537b7233ef77..ca2c7b5438cf 100644 --- a/desktop/source/deployment/manager/dp_informationprovider.cxx +++ b/desktop/source/deployment/manager/dp_informationprovider.cxx @@ -55,6 +55,7 @@ #include "dp_identifier.hxx" #include "dp_version.hxx" #include "dp_misc.h" +#include "dp_update.hxx" namespace beans = com::sun::star::beans ; namespace deployment = com::sun::star::deployment ; @@ -107,16 +108,6 @@ private: const rtl::OUString& _sExtensionId ); uno::Reference< deployment::XUpdateInformationProvider > mxUpdateInformation; - - uno::Sequence< uno::Reference< xml::dom::XElement > > - getUpdateInformation( uno::Sequence< rtl::OUString > const & urls, - rtl::OUString const & identifier ) const; - uno::Sequence< uno::Reference< deployment::XPackage > > - getPackages(rtl::OUString const & repository); - uno::Sequence< uno::Sequence< rtl::OUString > > isUpdateAvailable( - rtl::OUString const & repository, const rtl::OUString& _sExtensionId ); - uno::Sequence< uno::Sequence< rtl::OUString > > concatLists( uno::Sequence< uno::Sequence< rtl::OUString > > aFirst, - uno::Sequence< uno::Sequence< rtl::OUString > > aSecond ); }; //------------------------------------------------------------------------------ @@ -212,18 +203,101 @@ uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL PackageInformationProvider::isUpdateAvailable( const rtl::OUString& _sExtensionId ) throw ( uno::RuntimeException ) { - uno::Sequence< uno::Sequence< rtl::OUString > > - aUpdateListUser = isUpdateAvailable( UNISTRING("user"), _sExtensionId ); + uno::Sequence< uno::Sequence< rtl::OUString > > aList; - uno::Sequence< uno::Sequence< rtl::OUString > > - aUpdateListShared = isUpdateAvailable( UNISTRING("shared"), _sExtensionId ); + uno::Reference extMgr = + deployment::ExtensionManager::get(mxContext); - uno::Sequence< uno::Sequence< rtl::OUString > > - aUpdateListBundled = isUpdateAvailable( UNISTRING("bundled"), _sExtensionId ); + if (!extMgr.is()) + { + OSL_ASSERT(0); + return aList; + } + std::vector, uno::Any > > errors; + dp_misc::UpdateInfoMap updateInfoMap; + if (_sExtensionId.getLength()) + { + std::vector > vecExtensions; + uno::Reference extension; + try + { + extension = dp_misc::getExtensionWithHighestVersion( + extMgr->getExtensionsWithSameIdentifier( + _sExtensionId, _sExtensionId, uno::Reference())); + vecExtensions.push_back(extension); + } + catch (lang::IllegalArgumentException &) + { + OSL_ASSERT(0); + } + updateInfoMap = dp_misc::getOnlineUpdateInfos( + mxContext, extMgr, mxUpdateInformation, &vecExtensions, errors); + } + else + { + updateInfoMap = dp_misc::getOnlineUpdateInfos( + mxContext, extMgr, mxUpdateInformation, NULL, errors); + } + + int nCount = 0; + for (dp_misc::UpdateInfoMap::iterator i(updateInfoMap.begin()); i != updateInfoMap.end(); i++) + { + dp_misc::UpdateInfo const & info = i->second; + + rtl::OUString sOnlineVersion; + if (info.info.is()) + sOnlineVersion = info.version; + + rtl::OUString sVersionUser; + rtl::OUString sVersionShared; + rtl::OUString sVersionBundled; + uno::Sequence< uno::Reference< deployment::XPackage> > extensions; + try { + extensions = extMgr->getExtensionsWithSameIdentifier( + dp_misc::getIdentifier(info.extension), info.extension->getName(), + uno::Reference()); + } catch (lang::IllegalArgumentException& ) { + OSL_ASSERT(0); + } + OSL_ASSERT(extensions.getLength() == 3); + if (extensions[0].is() ) + sVersionUser = extensions[0]->getVersion(); + if (extensions[1].is() ) + sVersionShared = extensions[1]->getVersion(); + if (extensions[2].is() ) + sVersionBundled = extensions[2]->getVersion(); + + bool bSharedReadOnly = extMgr->isReadOnlyRepository(OUSTR("shared")); + + dp_misc::UPDATE_SOURCE sourceUser = dp_misc::isUpdateUserExtension( + bSharedReadOnly, sVersionUser, sVersionShared, sVersionBundled, sOnlineVersion); + dp_misc::UPDATE_SOURCE sourceShared = dp_misc::isUpdateSharedExtension( + bSharedReadOnly, sVersionShared, sVersionBundled, sOnlineVersion); + + rtl::OUString updateVersionUser; + rtl::OUString updateVersionShared; + if (sourceUser != dp_misc::UPDATE_SOURCE_NONE) + updateVersionUser = dp_misc::getHighestVersion( + rtl::OUString(), sVersionShared, sVersionBundled, sOnlineVersion); + if (sourceShared != dp_misc::UPDATE_SOURCE_NONE) + updateVersionShared = dp_misc::getHighestVersion( + rtl::OUString(), rtl::OUString(), sVersionBundled, sOnlineVersion); + rtl::OUString updateVersion; + if (dp_misc::compareVersions(updateVersionUser, updateVersionShared) == dp_misc::GREATER) + updateVersion = updateVersionUser; + else + updateVersion = updateVersionShared; + if (updateVersion.getLength()) + { - uno::Sequence< uno::Sequence< rtl::OUString > > user_shared = - concatLists( aUpdateListUser, aUpdateListShared ); - return concatLists(user_shared, aUpdateListBundled); + rtl::OUString aNewEntry[2]; + aNewEntry[0] = i->first; + aNewEntry[1] = updateVersion; + aList.realloc( ++nCount ); + aList[ nCount-1 ] = ::uno::Sequence< rtl::OUString >( aNewEntry, 2 ); + } + } + return aList; } //------------------------------------------------------------------------------ @@ -257,7 +331,7 @@ uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL PackageInformationProvi for (sal_Int32 j = 0; j < cExt; j++) { //ToDo according to the old code the first found extenions is used - //even if another one with the same id has a better version. Design flaw? + //even if another one with the same id has a better version. uno::Reference< deployment::XPackage > const & xExtension( seqExtension[j] ); if (xExtension.is()) { @@ -272,167 +346,6 @@ uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL PackageInformationProvi return retList; } -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -uno::Sequence< uno::Reference< deployment::XPackage > > -PackageInformationProvider::getPackages( const rtl::OUString & repository ) -{ - uno::Sequence< uno::Reference< deployment::XPackage > > packages; - try { - uno::Reference xMgr = deployment::ExtensionManager::get(mxContext); - packages = xMgr->getDeployedExtensions(repository, uno::Reference< task::XAbortChannel >(), - static_cast < XCommandEnvironment *> (this) ); - } - catch ( deployment::DeploymentException & ) - {} - catch ( css_ucb::CommandFailedException & ) - {} - catch ( css_ucb::CommandAbortedException & ) - {} - catch ( lang::IllegalArgumentException & e ) - { - throw uno::RuntimeException(e.Message, e.Context); - } - - return packages; -} - -//------------------------------------------------------------------------------ -uno::Sequence< uno::Reference< xml::dom::XElement > > - PackageInformationProvider::getUpdateInformation( uno::Sequence< rtl::OUString > const & urls, - rtl::OUString const & identifier ) const -{ - try - { - return mxUpdateInformation->getUpdateInformation( urls, identifier ); - } - catch ( uno::RuntimeException & ) { - throw; - } - catch ( css_ucb::CommandFailedException & ) {} - catch ( css_ucb::CommandAbortedException & ) {} - catch ( uno::Exception & ) {} - - return uno::Sequence< uno::Reference< xml::dom::XElement > >(); -} - -//------------------------------------------------------------------------------ -uno::Sequence< uno::Sequence< rtl::OUString > > - PackageInformationProvider::isUpdateAvailable( - const rtl::OUString& repository, - const rtl::OUString& _sExtensionId ) -{ - uno::Sequence< uno::Sequence< rtl::OUString > > aList; - sal_Int32 nCount = 0; - bool bPackageFound = false; - - uno::Reference xManager = deployment::ExtensionManager::get(mxContext); - // If the package manager is readonly then the user cannot modify anything anyway - // so we can abort the search here - if ( xManager.is() && ! xManager->isReadOnlyRepository(repository) ) - { - uno::Sequence< uno::Reference< deployment::XPackage > > packages( getPackages( repository ) ); - uno::Sequence< uno::Reference< xml::dom::XElement > > defaultInfos; - - for ( int pos = packages.getLength(); pos-- && !bPackageFound; ) - { - uno::Reference< deployment::XPackage > package( packages[ pos ] ); - uno::Sequence< rtl::OUString > urls( package->getUpdateInformationURLs()); - uno::Sequence< uno::Reference< xml::dom::XElement > > infos; - rtl::OUString id( dp_misc::getIdentifier( package ) ); - - if ( _sExtensionId.getLength() ) - { - if ( _sExtensionId == id ) - bPackageFound = true; - else /* we have an ID and the IDs don't match, continue with next package */ - continue; - } - - if ( urls.getLength() != 0) - { - infos = getUpdateInformation( urls, id ); - } - else - { - if ( defaultInfos.getLength() == 0 ) - { - const rtl::OUString defaultURL( dp_misc::getExtensionDefaultUpdateURL() ); - if ( defaultURL.getLength() ) - defaultInfos = getUpdateInformation( uno::Sequence< rtl::OUString >( &defaultURL, 1 ), - rtl::OUString() ); - } - infos = defaultInfos; - } - rtl::OUString latestVersion( package->getVersion() ); - sal_Int32 latestIndex = -1; - for ( sal_Int32 i = 0; i < infos.getLength(); ++i ) - { - dp_misc::DescriptionInfoset infoset( mxContext, - uno::Reference< xml::dom::XNode >( infos[i], uno::UNO_QUERY_THROW)); - boost::optional< rtl::OUString > id2( infoset.getIdentifier() ); - - if (!id2) - continue; - - if (*id2 == id) - { - // check, if there are unsatisfied dependencies and ignore those updates - uno::Sequence< uno::Reference< xml::dom::XElement > > ds( dp_misc::Dependencies::check( infoset ) ); - if ( ds.getLength() ) - continue; - - rtl::OUString v( infoset.getVersion() ); - if ( dp_misc::compareVersions( v, latestVersion ) == dp_misc::GREATER ) - { - latestVersion = v; - latestIndex = i; - } - } - } - if ( latestIndex != -1 ) - { - rtl::OUString aNewEntry[2]; - aNewEntry[0] = id; - aNewEntry[1] = latestVersion; - aList.realloc( ++nCount ); - aList[ nCount-1 ] = ::uno::Sequence< rtl::OUString >( aNewEntry, 2 ); - } - } - } - return aList; -} - -//------------------------------------------------------------------------------ -uno::Sequence< uno::Sequence< rtl::OUString > > PackageInformationProvider::concatLists( - uno::Sequence< uno::Sequence< rtl::OUString > > aFirst, - uno::Sequence< uno::Sequence< rtl::OUString > > aSecond ) -{ - sal_Int32 nFirstCount = aFirst.getLength(); - sal_Int32 nSecondCount = aSecond.getLength(); - sal_Int32 nIndex = nFirstCount; - - for ( sal_Int32 i=0; i < nSecondCount; i++ ) - { - bool bDuplicateEntry = false; - for ( sal_Int32 j=0; j < nFirstCount; j++ ) - { - if ( aFirst[ j ][0] == aSecond[ i ][0] ) - { - bDuplicateEntry = true; - break; - } - } - if ( !bDuplicateEntry ) - { - nIndex += 1; - aFirst.realloc( nIndex ); - aFirst[ nIndex - 1 ] = aSecond[ i ]; - } - } - return aFirst; -} //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 53d488095ecd..fe3490903043 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -477,17 +477,6 @@ Reference resolveUnoURL( } } -OUString getExtensionDefaultUpdateURL() -{ - ::rtl::OUString sUrl( - RTL_CONSTASCII_USTRINGPARAM( - "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") - ":Version:ExtensionUpdateURL}")); - ::rtl::Bootstrap::expandMacros(sUrl); - return sUrl; -} - - #ifdef WNT void writeConsoleWithStream(::rtl::OUString const & sText, HANDLE stream) { @@ -631,147 +620,6 @@ void syncRepositories(Reference const & xCmdEnv) } } -/* returns the index of the greatest version, starting with 0 - - */ -int determineHighestVersion( - ::rtl::OUString const & userVersion, - ::rtl::OUString const & sharedVersion, - ::rtl::OUString const & bundledVersion, - ::rtl::OUString const & onlineVersion) -{ - int index = 0; - OUString greatest = userVersion; - if (dp_misc::compareVersions(sharedVersion, greatest) == dp_misc::GREATER) - { - index = 1; - greatest = sharedVersion; - } - if (dp_misc::compareVersions(bundledVersion, greatest) == dp_misc::GREATER) - { - index = 2; - greatest = bundledVersion; - } - if (dp_misc::compareVersions(onlineVersion, greatest) == dp_misc::GREATER) - { - index = 3; - } - return index; -} - -UPDATE_SOURCE isUpdateUserExtension( - bool bReadOnlyShared, - ::rtl::OUString const & userVersion, - ::rtl::OUString const & sharedVersion, - ::rtl::OUString const & bundledVersion, - ::rtl::OUString const & onlineVersion) -{ - UPDATE_SOURCE retVal = UPDATE_SOURCE_NONE; - if (bReadOnlyShared) - { - if (userVersion.getLength()) - { - int index = determineHighestVersion( - userVersion, sharedVersion, bundledVersion, onlineVersion); - if (index == 1) - retVal = UPDATE_SOURCE_SHARED; - else if (index == 2) - retVal = UPDATE_SOURCE_BUNDLED; - else if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } - else if (sharedVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), sharedVersion, bundledVersion, onlineVersion); - if (index == 2) - retVal = UPDATE_SOURCE_BUNDLED; - else if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - - } - else if (bundledVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), OUString(), bundledVersion, onlineVersion); - if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } - } - else - { - if (userVersion.getLength()) - { - int index = determineHighestVersion( - userVersion, sharedVersion, bundledVersion, onlineVersion); - if (index == 1) - retVal = UPDATE_SOURCE_SHARED; - else if (index == 2) - retVal = UPDATE_SOURCE_BUNDLED; - else if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } - } - - return retVal; -} - -UPDATE_SOURCE isUpdateSharedExtension( - bool bReadOnlyShared, - ::rtl::OUString const & sharedVersion, - ::rtl::OUString const & bundledVersion, - ::rtl::OUString const & onlineVersion) -{ - if (bReadOnlyShared) - return UPDATE_SOURCE_NONE; - UPDATE_SOURCE retVal = UPDATE_SOURCE_NONE; - - if (sharedVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), sharedVersion, bundledVersion, onlineVersion); - if (index == 2) - retVal = UPDATE_SOURCE_BUNDLED; - else if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } - else if (bundledVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), OUString(), bundledVersion, onlineVersion); - if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } - return retVal; -} - -Reference -getExtensionWithHighestVersion( - Sequence > const & seqExt) -{ - if (seqExt.getLength() == 0) - return Reference(); - - Reference greatest; - sal_Int32 len = seqExt.getLength(); - - for (sal_Int32 i = 0; i < len; i++) - { - if (!greatest.is()) - { - greatest = seqExt[i]; - continue; - } - Reference const & current = seqExt[i]; - //greatest has a value - if (! current.is()) - continue; - - if (dp_misc::compareVersions(current->getVersion(), greatest->getVersion()) == dp_misc::GREATER) - greatest = current; - } - return greatest; -} } diff --git a/desktop/source/deployment/misc/dp_update.cxx b/desktop/source/deployment/misc/dp_update.cxx new file mode 100755 index 000000000000..52011f1f0ca0 --- /dev/null +++ b/desktop/source/deployment/misc/dp_update.cxx @@ -0,0 +1,397 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + + +#include "dp_update.hxx" +#include "dp_version.hxx" +#include "dp_identifier.hxx" +#include "dp_descriptioninfoset.hxx" + +#include "rtl/bootstrap.hxx" + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using ::rtl::OUString; +using ::rtl::OString; + + +namespace dp_misc { +namespace { + +int determineHighestVersion( + ::rtl::OUString const & userVersion, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion) +{ + int index = 0; + OUString greatest = userVersion; + if (dp_misc::compareVersions(sharedVersion, greatest) == dp_misc::GREATER) + { + index = 1; + greatest = sharedVersion; + } + if (dp_misc::compareVersions(bundledVersion, greatest) == dp_misc::GREATER) + { + index = 2; + greatest = bundledVersion; + } + if (dp_misc::compareVersions(onlineVersion, greatest) == dp_misc::GREATER) + { + index = 3; + } + return index; +} + +Sequence< Reference< xml::dom::XElement > > +getUpdateInformation( Reference const & updateInformation, + Sequence< OUString > const & urls, + OUString const & identifier, + uno::Any & out_error) +{ + try { + return updateInformation->getUpdateInformation(urls, identifier); + } catch (uno::RuntimeException &) { + throw; + } catch (ucb::CommandFailedException & e) { + out_error = e.Reason; + } catch (ucb::CommandAbortedException &) { + } catch (uno::Exception & e) { + out_error = uno::makeAny(e); + } + return + Sequence >(); +} + +//Put in anonymous namespace + +void getOwnUpdateInfos( + Reference const & xContext, + Reference const & updateInformation, + UpdateInfoMap& inout_map, std::vector, uno::Any> > & out_errors, + bool & out_allFound) +{ + bool allHaveOwnUpdateInformation = true; + for (UpdateInfoMap::iterator i = inout_map.begin(); i != inout_map.end(); i++) + { + OSL_ASSERT(i->second.extension.is()); + Sequence urls(i->second.extension->getUpdateInformationURLs()); + if (urls.getLength()) + { + const OUString id = dp_misc::getIdentifier(i->second.extension); + uno::Any anyError; + //It is unclear from the idl if there can be a null reference returned. + //However all valid information should be the same + Sequence > + infos(getUpdateInformation(updateInformation, urls, id, anyError)); + if (anyError.hasValue()) + out_errors.push_back(std::make_pair(i->second.extension, anyError)); + + for (sal_Int32 j = 0; j < infos.getLength(); ++j) + { + dp_misc::DescriptionInfoset infoset( + xContext, + Reference< xml::dom::XNode >(infos[j], UNO_QUERY_THROW)); + if (!infoset.hasDescription()) + continue; + boost::optional< OUString > id2(infoset.getIdentifier()); + if (!id2) + continue; + OSL_ASSERT(*id2 == id); + if (*id2 == id) + { + i->second.version = infoset.getVersion(); + i->second.info = Reference< xml::dom::XNode >( + infos[j], UNO_QUERY_THROW); + } + break; + } + } + else + { + allHaveOwnUpdateInformation &= false; + } + } + out_allFound = allHaveOwnUpdateInformation; +} + +void getDefaultUpdateInfos( + Reference const & xContext, + Reference const & updateInformation, + UpdateInfoMap& inout_map, + std::vector, uno::Any> > & out_errors) +{ + const rtl::OUString sDefaultURL(dp_misc::getExtensionDefaultUpdateURL()); + OSL_ASSERT(sDefaultURL.getLength()); + + Any anyError; + Sequence< Reference< xml::dom::XElement > > + infos( + getUpdateInformation( + updateInformation, + Sequence< OUString >(&sDefaultURL, 1), OUString(), anyError)); + if (anyError.hasValue()) + out_errors.push_back(std::make_pair(Reference(), anyError)); + for (sal_Int32 i = 0; i < infos.getLength(); ++i) + { + Reference< xml::dom::XNode > node(infos[i], UNO_QUERY_THROW); + dp_misc::DescriptionInfoset infoset(xContext, node); + boost::optional< OUString > id(infoset.getIdentifier()); + if (!id) { + continue; + } + UpdateInfoMap::iterator j = inout_map.find(*id); + if (j != inout_map.end()) + { + //skip those extension which provide its own update urls + if (j->second.extension->getUpdateInformationURLs().getLength()) + continue; + OUString v(infoset.getVersion()); + //look for the highest version in the online repository + if (dp_misc::compareVersions(v, j->second.version) == + dp_misc::GREATER) + { + j->second.version = v; + j->second.info = node; + } + } + } +} + + +} // anon namespace + + +OUString getExtensionDefaultUpdateURL() +{ + ::rtl::OUString sUrl( + RTL_CONSTASCII_USTRINGPARAM( + "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") + ":Version:ExtensionUpdateURL}")); + ::rtl::Bootstrap::expandMacros(sUrl); + return sUrl; +} + +/* returns the index of the greatest version, starting with 0 + + */ +UPDATE_SOURCE isUpdateUserExtension( + bool bReadOnlyShared, + ::rtl::OUString const & userVersion, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion) +{ + UPDATE_SOURCE retVal = UPDATE_SOURCE_NONE; + if (bReadOnlyShared) + { + if (userVersion.getLength()) + { + int index = determineHighestVersion( + userVersion, sharedVersion, bundledVersion, onlineVersion); + if (index == 1) + retVal = UPDATE_SOURCE_SHARED; + else if (index == 2) + retVal = UPDATE_SOURCE_BUNDLED; + else if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + } + else if (sharedVersion.getLength()) + { + int index = determineHighestVersion( + OUString(), sharedVersion, bundledVersion, onlineVersion); + if (index == 2) + retVal = UPDATE_SOURCE_BUNDLED; + else if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + + } + else if (bundledVersion.getLength()) + { + int index = determineHighestVersion( + OUString(), OUString(), bundledVersion, onlineVersion); + if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + } + } + else + { + if (userVersion.getLength()) + { + int index = determineHighestVersion( + userVersion, sharedVersion, bundledVersion, onlineVersion); + if (index == 1) + retVal = UPDATE_SOURCE_SHARED; + else if (index == 2) + retVal = UPDATE_SOURCE_BUNDLED; + else if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + } + } + + return retVal; +} + +UPDATE_SOURCE isUpdateSharedExtension( + bool bReadOnlyShared, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion) +{ + if (bReadOnlyShared) + return UPDATE_SOURCE_NONE; + UPDATE_SOURCE retVal = UPDATE_SOURCE_NONE; + + if (sharedVersion.getLength()) + { + int index = determineHighestVersion( + OUString(), sharedVersion, bundledVersion, onlineVersion); + if (index == 2) + retVal = UPDATE_SOURCE_BUNDLED; + else if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + } + else if (bundledVersion.getLength()) + { + int index = determineHighestVersion( + OUString(), OUString(), bundledVersion, onlineVersion); + if (index == 3) + retVal = UPDATE_SOURCE_ONLINE; + } + return retVal; +} + +Reference +getExtensionWithHighestVersion( + Sequence > const & seqExt) +{ + if (seqExt.getLength() == 0) + return Reference(); + + Reference greatest; + sal_Int32 len = seqExt.getLength(); + + for (sal_Int32 i = 0; i < len; i++) + { + if (!greatest.is()) + { + greatest = seqExt[i]; + continue; + } + Reference const & current = seqExt[i]; + //greatest has a value + if (! current.is()) + continue; + + if (dp_misc::compareVersions(current->getVersion(), greatest->getVersion()) == dp_misc::GREATER) + greatest = current; + } + return greatest; +} + +UpdateInfo::UpdateInfo( Reference< deployment::XPackage> const & ext): +extension(ext) +{ +} + + + +UpdateInfoMap getOnlineUpdateInfos( + Reference const &xContext, + Reference const & xExtMgr, + Reference const & updateInformation, + std::vector > const * extensionList, + std::vector, uno::Any> > & out_errors) +{ + OSL_ASSERT(xExtMgr.is()); + UpdateInfoMap infoMap; + if (!xExtMgr.is()) + return infoMap; + + if (!extensionList) + { + const uno::Sequence< uno::Sequence< Reference > > seqAllExt = xExtMgr->getAllExtensions( + Reference(), Reference()); + + //fill the UpdateInfoMap. key = extension identifier, value = UpdateInfo + for (int pos = seqAllExt.getLength(); pos --; ) + { + uno::Sequence > const & seqExt = seqAllExt[pos]; + + Reference extension = getExtensionWithHighestVersion(seqExt); + OSL_ASSERT(extension.is()); + + std::pair insertRet = infoMap.insert( + UpdateInfoMap::value_type( + dp_misc::getIdentifier(extension), UpdateInfo(extension))); + OSL_ASSERT(insertRet.second == true); + } + } + else + { + typedef std::vector >::const_iterator CIT; + for (CIT i = extensionList->begin(); i != extensionList->end(); i++) + { + OSL_ASSERT(i->is()); + std::pair insertRet = infoMap.insert( + UpdateInfoMap::value_type( + dp_misc::getIdentifier(*i), UpdateInfo(*i))); + OSL_ASSERT(insertRet.second == true); + } + } + + //Now find the update information for the extensions which provide their own + //URLs to update information. + bool allInfosObtained = false; + getOwnUpdateInfos(xContext, updateInformation, infoMap, out_errors, allInfosObtained); + + if (!allInfosObtained) + getDefaultUpdateInfos(xContext, updateInformation, infoMap, out_errors); + return infoMap; +} +OUString getHighestVersion( + ::rtl::OUString const & userVersion, + ::rtl::OUString const & sharedVersion, + ::rtl::OUString const & bundledVersion, + ::rtl::OUString const & onlineVersion) +{ + int index = determineHighestVersion(userVersion, sharedVersion, bundledVersion, onlineVersion); + switch (index) + { + case 0: return userVersion; + case 1: return sharedVersion; + case 2: return bundledVersion; + case 3: return onlineVersion; + default: OSL_ASSERT(0); + } + + return OUString(); +} +} //namespace dp_misc diff --git a/desktop/source/deployment/misc/makefile.mk b/desktop/source/deployment/misc/makefile.mk index 9a7f1d62e001..3e4bd68cb4c0 100644 --- a/desktop/source/deployment/misc/makefile.mk +++ b/desktop/source/deployment/misc/makefile.mk @@ -65,7 +65,8 @@ SHL1OBJS = \ $(SLO)$/dp_version.obj \ $(SLO)$/dp_descriptioninfoset.obj \ $(SLO)$/dp_dependencies.obj \ - $(SLO)$/dp_platform.obj + $(SLO)$/dp_platform.obj \ + $(SLO)$/dp_update.obj SHL1STDLIBS = \ $(BERKELEYLIB) \ -- cgit From b1ec4b2cd5a9e6ece0e2a928cc0a11fef6bbe818 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 3 Jun 2010 00:10:45 +0200 Subject: tl78: #i110383# password to modify support for binary types only --- sfx2/inc/sfx2/docfile.hxx | 2 +- sfx2/inc/sfx2/objsh.hxx | 4 ++-- sfx2/inc/sfx2/sfxsids.hrc | 2 +- sfx2/sdi/sfx.sdi | 4 ++-- sfx2/source/dialog/filedlghelper.cxx | 8 ++++---- sfx2/source/doc/docfile.cxx | 17 +++++++++++------ sfx2/source/doc/guisaveas.cxx | 34 +++------------------------------- sfx2/source/doc/objcont.cxx | 4 ++-- sfx2/source/doc/sfxbasemodel.cxx | 14 ++++++++++++++ sfx2/source/inc/objshimp.hxx | 2 +- sfx2/source/view/viewfrm.cxx | 4 ++-- 11 files changed, 43 insertions(+), 52 deletions(-) diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index 7c702c838629..e4d3ff023b3b 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -328,7 +328,7 @@ public: static sal_Bool CallApproveHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler, ::com::sun::star::uno::Any aRequest, sal_Bool bAllowAbort ); static sal_Bool SetWritableForUserOnly( const ::rtl::OUString& aURL ); - static sal_uInt16 CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd, sal_Bool bMSType ); + static sal_uInt32 CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd, sal_Bool bWriter ); }; SV_DECL_IMPL_REF( SfxMedium ) diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index a769fce4d26e..3b35886bc45d 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -437,8 +437,8 @@ public: void SetSaveVersionOnClose( sal_Bool bSet ); void ResetFromTemplate( const String& rTemplateName, const String& rFileName ); - sal_uInt16 GetModifyPasswordHash() const; - sal_Bool SetModifyPasswordHash( sal_uInt16 nHash ); + sal_uInt32 GetModifyPasswordHash() const; + sal_Bool SetModifyPasswordHash( sal_uInt32 nHash ); static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc ); diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index a24c91e60060..5492c76a7e7e 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -306,7 +306,7 @@ #define SID_ACTIVATE_STYLE_APPLY (SID_SFX_START + 1715) #define SID_FONT_NAME (SID_SFX_START + 1716) #define SID_DEFAULTFILENAME (SID_SFX_START + 1717) -#define SID_PASSWORDTOMODIFYHASH (SID_SFX_START + 1718) +#define SID_MODIFYPASSWORDHASH (SID_SFX_START + 1718) #define SID_RECOMMENDREADONLY (SID_SFX_START + 1719) #define SID_SFX_free_START (SID_SFX_START + 1720) #define SID_SFX_free_END (SID_SFX_START + 3999) diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 98c89663a9ae..1fc2cc16962d 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3594,7 +3594,7 @@ SfxVoidItem MacroOrganizer SID_MACROORGANIZER ] //-------------------------------------------------------------------------- -SfxUInt16Item PasswordToModifyHash SID_PASSWORDTOMODIFYHASH +SfxUInt16Item PasswordToModifyHash SID_MODIFYPASSWORDHASH [ /* flags: */ @@ -5317,7 +5317,7 @@ SfxBoolItem SaveAll SID_SAVEDOCS //-------------------------------------------------------------------------- SfxBoolItem SaveAs SID_SAVEASDOC -(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem Password SID_PASSWORD,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxStringItem VersionAuthor SID_DOCINFO_AUTHOR,SfxBoolItem Overwrite SID_OVERWRITE,SfxBoolItem Unpacked SID_UNPACK,SfxBoolItem SaveTo SID_SAVETO) +(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem Password SID_PASSWORD,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxStringItem VersionAuthor SID_DOCINFO_AUTHOR,SfxBoolItem Overwrite SID_OVERWRITE,SfxBoolItem Unpacked SID_UNPACK,SfxBoolItem SaveTo SID_SAVETO,SfxInt32Item ModifyPasswordHash SID_MODIFYPASSWORDHASH) [ /* flags: */ AutoUpdate = FALSE, diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index d7109496d670..759c47598f9f 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1528,7 +1528,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, mbPwdCheckBoxState = ( pPassItem != NULL ); // in case the document has password to modify, the dialog should be shown - SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUInt16Item, SID_PASSWORDTOMODIFYHASH, FALSE ); + SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUInt32Item, SID_MODIFYPASSWORDHASH, FALSE ); mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue() ); } @@ -1541,7 +1541,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // the password will be set in case user decide so rpSet->ClearItem( SID_PASSWORD ); rpSet->ClearItem( SID_RECOMMENDREADONLY ); - rpSet->ClearItem( SID_PASSWORDTOMODIFYHASH ); + rpSet->ClearItem( SID_MODIFYPASSWORDHASH ); } @@ -1660,9 +1660,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); // the empty password has 0 as Hash - sal_uInt16 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), bMSType ); + sal_uInt16 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) ); if ( nHash ) - rpSet->Put( SfxUInt16Item( SID_PASSWORDTOMODIFYHASH, nHash ) ); + rpSet->Put( SfxInt32Item( SID_MODIFYPASSWORDHASH, (sal_Int32)nHash ) ); } else return ERRCODE_ABORT; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index bb30670162fd..1dea202e0d0e 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2576,15 +2576,20 @@ void SfxMedium::SetOrigFilter_Impl( const SfxFilter* pOrigFilter ) //------------------------------------------------------------------ -sal_uInt16 SfxMedium::CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd, sal_Bool bMSType ) +sal_uInt32 SfxMedium::CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd, sal_Bool bWriter ) { - sal_uInt16 nHash = 0; + sal_uInt32 nHash = 0; if ( aPasswd.getLength() ) { - rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8; - if ( bMSType ) + if ( bWriter ) { + nHash = ::comphelper::DocPasswordHelper::GetWordHashAsUINT32( aPasswd ); + } + else + { + rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8; + // if the MS-filter should be used // use the inconsistent algorithm to find the encoding specified by MS nEncoding = osl_getThreadTextEncoding(); @@ -2612,9 +2617,9 @@ sal_uInt16 SfxMedium::CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd nEncoding = RTL_TEXTENCODING_MS_1250; break; } - } - nHash = ::comphelper::DocPasswordHelper::GetXLHashAsUINT16( aPasswd, nEncoding ); + nHash = ::comphelper::DocPasswordHelper::GetXLHashAsUINT16( aPasswd, nEncoding ); + } } return nHash; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 4993e96b40bb..d68fd9dd2bad 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -180,18 +180,13 @@ class DocumentSettingsGuard { uno::Reference< beans::XPropertySet > m_xDocumentSettings; sal_Bool m_bPreserveReadOnly; - sal_uInt16 m_nPreserveHash; - sal_Bool m_bReadOnlySupported; - sal_Bool m_bModifyPasswordHashSupported; sal_Bool m_bRestoreSettings; public: - DocumentSettingsGuard( const uno::Reference< frame::XModel >& xModel, sal_Bool bReadOnly, sal_uInt16 nHash, sal_Bool bRestore ) + DocumentSettingsGuard( const uno::Reference< frame::XModel >& xModel, sal_Bool bReadOnly, sal_Bool bRestore ) : m_bPreserveReadOnly( sal_False ) - , m_nPreserveHash( 0 ) , m_bReadOnlySupported( sal_False ) - , m_bModifyPasswordHashSupported( sal_False ) , m_bRestoreSettings( bRestore ) { try @@ -203,7 +198,6 @@ public: uno::UNO_QUERY_THROW ); ::rtl::OUString aLoadReadonlyString( RTL_CONSTASCII_USTRINGPARAM( "LoadReadonly" ) ); - ::rtl::OUString aModifyPasswordHashString( RTL_CONSTASCII_USTRINGPARAM( "ModifyPasswordHash" ) ); try { @@ -213,20 +207,11 @@ public: } catch( uno::Exception& ) {} - - try - { - m_xDocumentSettings->getPropertyValue( aModifyPasswordHashString ) >>= m_nPreserveHash; - m_xDocumentSettings->setPropertyValue( aModifyPasswordHashString, uno::makeAny( nHash ) ); - m_bModifyPasswordHashSupported = sal_True; - } - catch( uno::Exception& ) - {} } catch( uno::Exception& ) {} - if ( ( bReadOnly && !m_bReadOnlySupported ) || ( nHash && !m_bModifyPasswordHashSupported ) ) + if ( ( bReadOnly && !m_bReadOnlySupported ) ) throw uno::RuntimeException(); // the user could provide the data, so it must be stored } @@ -235,15 +220,11 @@ public: if ( m_bRestoreSettings ) { ::rtl::OUString aLoadReadonlyString( RTL_CONSTASCII_USTRINGPARAM( "LoadReadonly" ) ); - ::rtl::OUString aModifyPasswordHashString( RTL_CONSTASCII_USTRINGPARAM( "ModifyPasswordHash" ) ); try { if ( m_bReadOnlySupported ) m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::makeAny( m_bPreserveReadOnly ) ); - - if ( m_bModifyPasswordHashSupported ) - m_xDocumentSettings->setPropertyValue( aModifyPasswordHashString, uno::makeAny( m_nPreserveHash ) ); } catch( uno::Exception& ) { @@ -272,7 +253,6 @@ class ModelData_Impl ::comphelper::SequenceAsHashMap m_aMediaDescrHM; sal_Bool m_bRecommendReadOnly; - sal_uInt16 m_nPasswordToModifyHash; public: ModelData_Impl( SfxStoringHelper& aOwner, @@ -291,7 +271,6 @@ public: ::comphelper::SequenceAsHashMap& GetMediaDescr() { return m_aMediaDescrHM; } sal_Bool IsRecommendReadOnly() { return m_bRecommendReadOnly; } - sal_uInt16 GetPasswordToModifyHash() { return m_nPasswordToModifyHash; } const ::comphelper::SequenceAsHashMap& GetDocProps(); @@ -346,8 +325,6 @@ ModelData_Impl::ModelData_Impl( SfxStoringHelper& aOwner, , m_pModulePropsHM( NULL ) , m_aMediaDescrHM( aMediaDescr ) , m_bRecommendReadOnly( sal_False ) -, m_nPasswordToModifyHash( 0 ) - { CheckInteractionHandler(); } @@ -1018,11 +995,6 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, m_bRecommendReadOnly = ( pRecommendReadOnly && pRecommendReadOnly->GetValue() ); pDialogParams->ClearItem( SID_RECOMMENDREADONLY ); - SFX_ITEMSET_ARG( pDialogParams, pPassToModifyItem, SfxUInt16Item, SID_PASSWORDTOMODIFYHASH, sal_False ); - if ( pPassToModifyItem ) - m_nPasswordToModifyHash = pPassToModifyItem->GetValue(); - pDialogParams->ClearItem( SID_PASSWORDTOMODIFYHASH ); - uno::Sequence< beans::PropertyValue > aPropsFromDialog; TransformItems( nSlotID, *pDialogParams, aPropsFromDialog, NULL ); GetMediaDescr() << aPropsFromDialog; @@ -1607,7 +1579,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& // store the document and handle it's docinfo SvtSaveOptions aOptions; - DocumentSettingsGuard aSettingsGuard( aModelData.GetModel(), aModelData.IsRecommendReadOnly(), aModelData.GetPasswordToModifyHash(), nStoreMode & EXPORT_REQUESTED ); + DocumentSettingsGuard aSettingsGuard( aModelData.GetModel(), aModelData.IsRecommendReadOnly(), nStoreMode & EXPORT_REQUESTED ); if ( aOptions.IsDocInfoSave() && ( !aModelData.GetStorable()->hasLocation() diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 4cf5a5e7ad51..dc834debd533 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1242,12 +1242,12 @@ void SfxObjectShell::SetSaveVersionOnClose( sal_Bool bNew ) pImp->bSaveVersionOnClose = bNew; } -sal_uInt16 SfxObjectShell::GetModifyPasswordHash() const +sal_uInt32 SfxObjectShell::GetModifyPasswordHash() const { return pImp->m_nModifyPasswordHash; } -sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt16 nHash ) +sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt32 nHash ) { // Commented out before the solution for Saving process is found // if ( ( !IsReadOnly() && !IsReadOnlyUI() ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index e1b37c119f1a..d3707636d5ea 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -74,6 +74,7 @@ #include #include #include +#include #include #include #include @@ -2731,6 +2732,12 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL uno::Reference< uno::XInterface >() ); } + SFX_ITEMSET_ARG( aParams, pModifyPasswordHashItem, SfxInt32Item, SID_MODIFYPASSWORDHASH, sal_False ); + sal_uInt32 nModifyPasswordHash = pModifyPasswordHashItem ? pModifyPasswordHashItem->GetValue() : 0; + aParams->ClearItem( SID_MODIFYPASSWORDHASH ); + sal_uInt32 nOldModifyPasswordHash = m_pData->m_pObjectShell->GetModifyPasswordHash(); + m_pData->m_pObjectShell->SetModifyPasswordHash( nModifyPasswordHash ); + // since saving a document modifies its DocumentInfo, the current // DocumentInfo must be saved on "SaveTo", so it can be restored // after saving @@ -2809,10 +2816,14 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL if ( !bSaveTo ) { m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl(); + m_pData->m_pObjectShell->SetModifyPasswordEntered(); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVEASDOCDONE), m_pData->m_pObjectShell ) ); } else { + m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVETODOCDONE), m_pData->m_pObjectShell ) ); } } @@ -2822,6 +2833,9 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing failed!" ) ) ); m_pData->m_pObjectShell->StoreLog(); + m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash ); + + SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOCFAILED : STR_EVENT_SAVEASDOCFAILED), m_pData->m_pObjectShell ) ); diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index 5aa0c793e12b..e170a7c27240 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -149,7 +149,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool m_bIncomplEncrWarnShown; - sal_uInt16 m_nModifyPasswordHash; + sal_uInt32 m_nModifyPasswordHash; sal_Bool m_bModifyPasswordEntered; SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index c8cf7bd8c6c8..ca95475cabe6 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -170,7 +170,7 @@ TYPEINIT1(SfxViewFrameItem, SfxPoolItem); //========================================================================= //------------------------------------------------------------------------- -static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const ::rtl::OUString& aPath, const SfxFilter* pFilter, sal_uInt16 nPasswordHash ) +static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const ::rtl::OUString& aPath, const SfxFilter* pFilter, sal_uInt32 nPasswordHash ) { sal_Bool bResult = !nPasswordHash; @@ -196,7 +196,7 @@ static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteracti xHandler->handle( rRequest ); if ( pPasswordRequest->isPassword() ) - bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), bMSType ) == nPasswordHash ); + bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pFilter->GetServiceName() ) ) == nPasswordHash ); else bCancel = sal_True; -- cgit From 928c651b68ccb995482edf00d27e825b880132bd Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 3 Jun 2010 10:47:56 +0200 Subject: cws tl79: missing includes added --- svx/source/dialog/hdft.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index 729d4f748921..551f682abda0 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -37,6 +37,8 @@ #include #include +#include +#include #include #include "hdft.hrc" #include -- cgit From 1ad6bfaa61736ffd37b67c35506a7e68f0c63396 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 3 Jun 2010 15:20:47 +0200 Subject: #i58213# get date styles from automatic styles in impress --- xmloff/source/draw/ximppage.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index becfd05b1963..6c715b5ad77a 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -339,6 +339,9 @@ void SdXMLGenericPageContext::EndElement() else if( aDateTimeFormat.getLength() ) { const SdXMLStylesContext* pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetStylesContext() ); + if( !pStyles ) + pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetAutoStylesContext() ); + if( pStyles ) { const SdXMLNumberFormatImportContext* pSdNumStyle = -- cgit From 227d80375c8c851fe74a035d882ae316922ba6f0 Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Fri, 4 Jun 2010 08:25:27 +0200 Subject: jl152#i77196# Improved progress handling on startup --- desktop/source/app/check_ext_deps.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index ebdc9ccdf51e..664e63c7f6ca 100755 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -192,7 +192,7 @@ void SilentCommandEnv::push( uno::Any const & rStatus ) if ( rStatus.hasValue() && ( rStatus >>= sText) ) { - if ( mnLevel <= 2 ) + if ( mnLevel <= 3 ) mpDesktop->SetSplashScreenText( sText ); else mpDesktop->SetSplashScreenProgress( ++mnProgress ); -- cgit From bd4822e3ac4d89de9d70af10a7afe22f0c7a5ebb Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 4 Jun 2010 13:49:01 +0200 Subject: vcl112: #i109307# add InitialPreference (thanks rene!) --- sysui/desktop/menus/base.desktop | 1 + sysui/desktop/menus/calc.desktop | 1 + sysui/desktop/menus/draw.desktop | 1 + sysui/desktop/menus/impress.desktop | 1 + sysui/desktop/menus/math.desktop | 1 + sysui/desktop/menus/writer.desktop | 1 + 6 files changed, 6 insertions(+) diff --git a/sysui/desktop/menus/base.desktop b/sysui/desktop/menus/base.desktop index 89d0a20adb00..9497666691fe 100644 --- a/sysui/desktop/menus/base.desktop +++ b/sysui/desktop/menus/base.desktop @@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.database;application/vnd.sun.xml.bas Name=%PRODUCTNAME Base GenericName=Database Development Comment=Manage databases, create queries and reports to track and manage your information by using Base. +InitialPreference=5 diff --git a/sysui/desktop/menus/calc.desktop b/sysui/desktop/menus/calc.desktop index e49b114b0954..bc0c9ee8b618 100644 --- a/sysui/desktop/menus/calc.desktop +++ b/sysui/desktop/menus/calc.desktop @@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.op Name=%PRODUCTNAME Calc GenericName=Spreadsheet Comment=Perform calculation, analyze information and manage lists in spreadsheets by using Calc. +InitialPreference=5 diff --git a/sysui/desktop/menus/draw.desktop b/sysui/desktop/menus/draw.desktop index 438d603e06a2..42db7c6f84a0 100644 --- a/sysui/desktop/menus/draw.desktop +++ b/sysui/desktop/menus/draw.desktop @@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.graphics;application/vnd.oasis.opend Name=%PRODUCTNAME Draw GenericName=Drawing Program Comment=Create and edit drawings, flow charts, and logos by using Draw. +InitialPreference=5 diff --git a/sysui/desktop/menus/impress.desktop b/sysui/desktop/menus/impress.desktop index 0aa3cdecdc04..90df11ac54f1 100644 --- a/sysui/desktop/menus/impress.desktop +++ b/sysui/desktop/menus/impress.desktop @@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.presentation;application/vnd.oasis.o Name=%PRODUCTNAME Impress GenericName=Presentation Comment=Create and edit presentations for slideshows, meeting and Web pages by using Impress. +InitialPreference=5 diff --git a/sysui/desktop/menus/math.desktop b/sysui/desktop/menus/math.desktop index 15a6d42efc2c..f97536d6ef04 100644 --- a/sysui/desktop/menus/math.desktop +++ b/sysui/desktop/menus/math.desktop @@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.formula;application/vnd.sun.xml.math Name=%PRODUCTNAME Math GenericName=Formula Editor Comment=Create and edit scientific formulas and equations by using Math. +InitialPreference=5 diff --git a/sysui/desktop/menus/writer.desktop b/sysui/desktop/menus/writer.desktop index 0184d916e2ab..1509de0fb402 100644 --- a/sysui/desktop/menus/writer.desktop +++ b/sysui/desktop/menus/writer.desktop @@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocum Name=%PRODUCTNAME Writer GenericName=Word Processor Comment=Create and edit text and graphics in letters, reports, documents and Web pages by using Writer. +InitialPreference=5 -- cgit From 88581862df4e46ee0f6515267ffeb46a53d1ba53 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Fri, 4 Jun 2010 16:19:25 +0200 Subject: jl152 #i77196# information upate provider now excludes online updates with unfulfilled dependencies --- desktop/source/deployment/manager/dp_informationprovider.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/desktop/source/deployment/manager/dp_informationprovider.cxx b/desktop/source/deployment/manager/dp_informationprovider.cxx index ca2c7b5438cf..4cc43a8386d8 100644 --- a/desktop/source/deployment/manager/dp_informationprovider.cxx +++ b/desktop/source/deployment/manager/dp_informationprovider.cxx @@ -246,7 +246,14 @@ PackageInformationProvider::isUpdateAvailable( const rtl::OUString& _sExtensionI rtl::OUString sOnlineVersion; if (info.info.is()) - sOnlineVersion = info.version; + { + // check, if there are unsatisfied dependencies and ignore this online update + dp_misc::DescriptionInfoset infoset(mxContext, info.info); + uno::Sequence< uno::Reference< xml::dom::XElement > > + ds( dp_misc::Dependencies::check( infoset ) ); + if ( ! ds.getLength() ) + sOnlineVersion = info.version; + } rtl::OUString sVersionUser; rtl::OUString sVersionShared; -- cgit From 11eab80d847a072e49f6e13b022bb0d4a7cadd51 Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Fri, 4 Jun 2010 18:22:13 +0200 Subject: calc55: #i112035# loading some old chart document fails --- xmloff/source/chart/SchXMLPlotAreaContext.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index ec5c4b2130c1..cea7bf40b299 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -1249,18 +1249,23 @@ void SchXMLAxisContext::CreateAxis() case SCH_XML_AXIS_Z: { + bool bSettingZAxisSuccedded = false; try { - xDiaProp->setPropertyValue( - rtl::OUString::createFromAscii( "HasZAxis" ), aTrueBool ); + rtl::OUString sHasZAxis( rtl::OUString::createFromAscii( "HasZAxis" ) ); + xDiaProp->setPropertyValue( sHasZAxis, aTrueBool ); + xDiaProp->getPropertyValue( sHasZAxis ) >>= bSettingZAxisSuccedded; } catch( beans::UnknownPropertyException & ) { DBG_ERROR( "Couldn't turn on z axis" ); } - uno::Reference< chart::XAxisZSupplier > xSuppl( mxDiagram, uno::UNO_QUERY ); - if( xSuppl.is()) - xProp = xSuppl->getZAxis(); + if( bSettingZAxisSuccedded ) + { + uno::Reference< chart::XAxisZSupplier > xSuppl( mxDiagram, uno::UNO_QUERY ); + if( xSuppl.is()) + xProp = xSuppl->getZAxis(); + } } break; case SCH_XML_AXIS_UNDEF: -- cgit From 213132eb58be3236f379d0b3d13b415bf10d4bd1 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 4 Jun 2010 18:53:06 +0200 Subject: vcl112: #i111992# fill recent file list of menu button on demand --- framework/source/services/backingwindow.cxx | 9 ++++++++- framework/source/services/backingwindow.hxx | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index 19afbc29d843..962dbe2686c3 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -460,7 +460,7 @@ void BackingWindow::initBackground() maOpenButton.SetMenuMode( MENUBUTTON_MENUMODE_TIMED ); maOpenButton.SetSelectHdl( LINK( this, BackingWindow, SelectHdl ) ); - prepareRecentFileMenu(); + maOpenButton.SetActivateHdl( LINK( this, BackingWindow, ActivateHdl ) ); } void BackingWindow::initControls() @@ -1056,6 +1056,13 @@ IMPL_LINK( BackingWindow, SelectHdl, Button*, pButton ) return 0; } +IMPL_LINK( BackingWindow, ActivateHdl, Button*, pButton ) +{ + if( pButton == &maOpenButton ) + prepareRecentFileMenu(); + return 0; +} + struct ImplDelayedDispatch { Reference< XDispatch > xDispatch; diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx index eaf5e9ec5a23..958ebfbb243e 100644 --- a/framework/source/services/backingwindow.hxx +++ b/framework/source/services/backingwindow.hxx @@ -159,6 +159,7 @@ namespace framework DECL_LINK( ClickHdl, Button* ); DECL_LINK( SelectHdl, Button* ); + DECL_LINK( ActivateHdl, Button* ); DECL_LINK( ToolboxHdl, void* ); void initControls(); -- cgit From 7b0105f0bfff2dde2398f7e8e910384898d65154 Mon Sep 17 00:00:00 2001 From: Thomas Benisch Date: Fri, 4 Jun 2010 20:08:33 +0200 Subject: calc55: #i112084# All charts in a Calc document are loaded when saving the document --- svx/inc/svx/unoshprp.hxx | 2 +- svx/source/unodraw/unoprov.cxx | 1 + svx/source/unodraw/unoshap4.cxx | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) mode change 100755 => 100644 svx/inc/svx/unoshprp.hxx diff --git a/svx/inc/svx/unoshprp.hxx b/svx/inc/svx/unoshprp.hxx old mode 100755 new mode 100644 index 27196079db07..ec8ecd485280 --- a/svx/inc/svx/unoshprp.hxx +++ b/svx/inc/svx/unoshprp.hxx @@ -160,7 +160,7 @@ #define OWN_ATTR_PAGE_NUMBER (OWN_ATTR_VALUE_START+65) #define OWN_ATTR_THUMBNAIL (OWN_ATTR_VALUE_START+66) #define OWN_ATTR_PERSISTNAME (OWN_ATTR_VALUE_START+67) -//#define OWN_ATTR_HASLEVELS (OWN_ATTR_VALUE_START+68) +#define OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT (OWN_ATTR_VALUE_START+68) #define OWN_ATTR_MEDIA_URL (OWN_ATTR_VALUE_START+69) #define OWN_ATTR_MEDIA_PREFERREDSIZE (OWN_ATTR_VALUE_START+70) #define OWN_ATTR_MEDIA_LOOP (OWN_ATTR_VALUE_START+71) diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 9a9717b34495..ea875d8d9427 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -478,6 +478,7 @@ SfxItemPropertyMapEntry* ImplGetSvxOle2PropertyMap() { MAP_CHAR_LEN("ThumbnailGraphicURL"), OWN_ATTR_THUMBNAIL , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 }, { MAP_CHAR_LEN("Model"), OWN_ATTR_OLEMODEL , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, { MAP_CHAR_LEN("EmbeddedObject"), OWN_ATTR_OLE_EMBEDDED_OBJECT , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN("EmbeddedObjectNoNewClient"),OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, { MAP_CHAR_LEN("OriginalSize"), OWN_ATTR_OLESIZE , &::getCppuType(( const ::com::sun::star::awt::Size*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, { MAP_CHAR_LEN("CLSID"), OWN_ATTR_CLSID , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 }, { MAP_CHAR_LEN("IsInternal"), OWN_ATTR_INTERNAL_OLE , &::getBooleanCppuType() , ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index cf3bdc6621f0..96804103f610 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -355,22 +355,26 @@ bool SvxOle2Shape::getPropertyValueImpl( const ::rtl::OUString& rName, const Sfx case OWN_ATTR_OLEMODEL: case OWN_ATTR_OLE_EMBEDDED_OBJECT: + case OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT: { SdrOle2Obj* pObj = dynamic_cast( mpObj.get() ); if( pObj ) { uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() ); if ( xObj.is() - && ( pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT || svt::EmbeddedObjectRef::TryRunningState( xObj ) ) ) + && ( pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT || pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT || svt::EmbeddedObjectRef::TryRunningState( xObj ) ) ) { // Discussed with CL fue to the before GetPaintingPageView // usage. Removed it, former fallback is used now + if ( pProperty->nWID == OWN_ATTR_OLEMODEL || pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT ) + { #ifdef DBG_UTIL - const sal_Bool bSuccess(pObj->AddOwnLightClient()); - OSL_ENSURE( bSuccess, "An object without client is provided!" ); + const sal_Bool bSuccess(pObj->AddOwnLightClient()); + OSL_ENSURE( bSuccess, "An object without client is provided!" ); #else - pObj->AddOwnLightClient(); + pObj->AddOwnLightClient(); #endif + } if ( pProperty->nWID == OWN_ATTR_OLEMODEL ) rValue <<= pObj->GetObjRef()->getComponent(); -- cgit From cfdbe09c28e21212d4223c13daf43688adca8c5d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 7 Jun 2010 13:31:53 +0200 Subject: vcl112: #b6956353# add ToTop call in case document is already visible --- framework/source/loadenv/loadenv.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index b9f1d2c8a09a..2d6b7ceea668 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -1774,7 +1774,10 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X ::comphelper::ConfigurationHelper::E_READONLY); a >>= bForceFrontAndFocus; - pWindow->Show(sal_True, (bForceFrontAndFocus || bForceToFront) ? SHOW_FOREGROUNDTASK : 0 ); + if( pWindow->IsVisible() && (bForceFrontAndFocus || bForceToFront) ) + pWindow->ToTop(); + else + pWindow->Show(sal_True, (bForceFrontAndFocus || bForceToFront) ? SHOW_FOREGROUNDTASK : 0 ); } /* #i19976# -- cgit From 77d761f74d1147b013325487753255846aa56b96 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Mon, 7 Jun 2010 17:08:48 +0200 Subject: jl152 #i77196# fixing merge conflicts --- basic/source/inc/namecont.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index 4d31483ab513..c475535143d2 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -58,7 +58,7 @@ #include #include -#include +#include #include #include @@ -67,7 +67,7 @@ class BasicManager; namespace basic { -typedef ::cppu::WeakComponentImplHelper7< +typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::lang::XInitialization, ::com::sun::star::script::XStorageBasedLibraryContainer, ::com::sun::star::script::XLibraryContainerPassword, -- cgit From ba8229cc9d9a4c48a9e0a01611354f64ab5fd069 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 8 Jun 2010 12:35:50 +0200 Subject: tl78: #i105076# fix typo --- sfx2/sdi/sfx.sdi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 1fc2cc16962d..a19ea0fb8dfc 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3594,7 +3594,7 @@ SfxVoidItem MacroOrganizer SID_MACROORGANIZER ] //-------------------------------------------------------------------------- -SfxUInt16Item PasswordToModifyHash SID_MODIFYPASSWORDHASH +SfxInt32Item PasswordToModifyHash SID_MODIFYPASSWORDHASH [ /* flags: */ -- cgit From ab46983bad9dfb4f6af22487e55904938638fc21 Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Tue, 8 Jun 2010 13:15:18 +0200 Subject: vcl112:#i111580# startcenter supports opening (installing) of extensions --- sysui/desktop/menus/startcenter.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysui/desktop/menus/startcenter.desktop b/sysui/desktop/menus/startcenter.desktop index b6067494a68c..6302a5b16289 100644 --- a/sysui/desktop/menus/startcenter.desktop +++ b/sysui/desktop/menus/startcenter.desktop @@ -5,7 +5,7 @@ Icon=startcenter Type=Application Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Other; Exec=openoffice %U -MimeType= +MimeType=application/vnd.openofficeorg.extension; Name=%PRODUCTNAME GenericName=Office Comment=The office productivity suite compatible to the open and standardized ODF document format. Supported by Sun Microsystems. -- cgit From d0d67b203b9f306f3ac10fcb5019e82127a18610 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 8 Jun 2010 16:29:32 +0200 Subject: cws tl78: more space for filename added to password dialog --- uui/source/passworddlg.src | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/uui/source/passworddlg.src b/uui/source/passworddlg.src index 5eba2fdb2c5b..33767057e1bd 100755 --- a/uui/source/passworddlg.src +++ b/uui/source/passworddlg.src @@ -41,7 +41,7 @@ ModalDialog DLG_UUI_PASSWORD Moveable = TRUE ; OutputSize = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT( 145, 75 ); + Size = MAP_APPFONT( 145, 91 ); Text [ en-US ] = "Enter password"; FixedText FT_PASSWORD @@ -53,15 +53,21 @@ ModalDialog DLG_UUI_PASSWORD Edit ED_PASSWORD { - Pos = MAP_APPFONT( 3, 35 ); + Pos = MAP_APPFONT( 3, 51 ); Size = MAP_APPFONT( 139, 13 ); Border = TRUE ; PassWord = TRUE ; }; + FixedLine FL_FIXED_LINE_1 + { + Pos = MAP_APPFONT( 0, 66 ); + Size = MAP_APPFONT( 145, 6 ); + }; + OKButton BTN_PASSWORD_OK { - Pos = MAP_APPFONT( 27, 56 ); + Pos = MAP_APPFONT( 27, 72 ); Size = MAP_APPFONT( 37, 15 ); DefButton = TRUE ; DefButton = TRUE; @@ -69,22 +75,16 @@ ModalDialog DLG_UUI_PASSWORD CancelButton BTN_PASSWORD_CANCEL { - Pos = MAP_APPFONT( 66, 56 ); + Pos = MAP_APPFONT( 66, 72 ); Size = MAP_APPFONT( 37, 15 ); }; HelpButton BTN_PASSWORD_HELP { - Pos = MAP_APPFONT( 105, 56 ); + Pos = MAP_APPFONT( 105, 72 ); Size = MAP_APPFONT( 37, 15 ); }; - FixedLine FL_FIXED_LINE_1 - { - Pos = MAP_APPFONT( 0, 50 ); - Size = MAP_APPFONT( 145, 6 ); - }; - String STR_ENTER_PASSWORD_TO_OPEN { Text [ en-US ] = "Enter password to open file: \n"; -- cgit From db2236600ffc64b188d23f43fb88ee0bf13a680a Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 8 Jun 2010 17:01:41 +0200 Subject: tl78: #i110383# fix reload functionality --- sfx2/inc/sfx2/objsh.hxx | 2 +- sfx2/source/dialog/filedlghelper.cxx | 6 +++--- sfx2/source/doc/objcont.cxx | 4 ++-- sfx2/source/doc/objmisc.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 13 ++++++++++--- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index d8a8ea2f678a..95e8f21c8d86 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -717,7 +717,7 @@ public: SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation( const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos ); SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); - SAL_DLLPRIVATE void SetModifyPasswordEntered(); + SAL_DLLPRIVATE void SetModifyPasswordEntered( sal_Bool bEntered = sal_True ); SAL_DLLPRIVATE sal_Bool IsModifyPasswordEntered(); SAL_DLLPRIVATE void InitBasicManager_Impl(); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 759c47598f9f..072729648628 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1528,7 +1528,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, mbPwdCheckBoxState = ( pPassItem != NULL ); // in case the document has password to modify, the dialog should be shown - SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUInt32Item, SID_MODIFYPASSWORDHASH, FALSE ); + SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxInt32Item, SID_MODIFYPASSWORDHASH, FALSE ); mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue() ); } @@ -1660,9 +1660,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); // the empty password has 0 as Hash - sal_uInt16 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) ); + sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) ); if ( nHash ) - rpSet->Put( SfxInt32Item( SID_MODIFYPASSWORDHASH, (sal_Int32)nHash ) ); + rpSet->Put( SfxInt32Item( SID_MODIFYPASSWORDHASH, nHash ) ); } else return ERRCODE_ABORT; diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index dc834debd533..547198f60ace 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1262,9 +1262,9 @@ sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt32 nHash ) // return sal_False; } -void SfxObjectShell::SetModifyPasswordEntered() +void SfxObjectShell::SetModifyPasswordEntered( sal_Bool bEntered ) { - pImp->m_bModifyPasswordEntered = sal_True; + pImp->m_bModifyPasswordEntered = bEntered; } sal_Bool SfxObjectShell::IsModifyPasswordEntered() diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 76aed9d11ed1..afcaa1614f2c 100755 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1389,7 +1389,7 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) if( !IsAbortingImport() ) PositionView_Impl(); - if ( GetModifyPasswordHash() ) + if ( GetModifyPasswordHash() && !IsModifyPasswordEntered() ) SetReadOnly(); // Salvage diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index ca95475cabe6..a80741df13a6 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -714,6 +714,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } xNewObj = SfxObjectShell::CreateObject( pFilter->GetServiceName(), SFX_CREATE_MODE_STANDARD ); + + if ( xOldObj->IsModifyPasswordEntered() ) + xNewObj->SetModifyPasswordEntered(); + uno::Sequence < beans::PropertyValue > aLoadArgs; TransformItems( SID_OPENDOC, *pNewSet, aLoadArgs ); try @@ -769,6 +773,12 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } else { + if ( xNewObj->GetModifyPasswordHash() && xNewObj->GetModifyPasswordHash() != xOldObj->GetModifyPasswordHash() ) + { + xNewObj->SetModifyPasswordEntered( sal_False ); + xNewObj->SetReadOnly(); + } + if ( xNewObj->IsDocShared() ) { // the file is shared but the closing can change the sharing control file @@ -781,10 +791,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) TransformItems( SID_OPENDOC, *xNewObj->GetMedium()->GetItemSet(), aLoadArgs ); UpdateDocument_Impl(); - } - if ( xNewObj.Is() ) - { try { while ( !aViewFrames.empty() ) -- cgit From b5774ca9c4b802578b24120a0f8eb6625d2173ef Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 8 Jun 2010 19:15:36 +0200 Subject: cws tl78: #i109634# additional dialog parameter --- uui/source/iahndl-authentication.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index 027a5cced169..008acadea0ae 100755 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -534,7 +534,7 @@ executePasswordDialog( const sal_uInt16 nMaxPasswdLen = bMSCryptoMode ? 15 : 0; // 0 -> allow any length VclAbstractDialogFactory * pFact = VclAbstractDialogFactory::Create(); - AbstractPasswordToOpenModifyDialog *pTmp = pFact->CreatePasswordToOpenModifyDialog( pParent, 0, nMaxPasswdLen ); + AbstractPasswordToOpenModifyDialog *pTmp = pFact->CreatePasswordToOpenModifyDialog( pParent, 0, nMaxPasswdLen, bIsPasswordToModify ); std::auto_ptr< AbstractPasswordToOpenModifyDialog > pDialog( pTmp ); rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL ); -- cgit From 6fd692c5e9d61acb3613ef0f783fc232ecef67ef Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 8 Jun 2010 18:02:35 +0200 Subject: cws tl79: #i110048# help ids added --- uui/source/ids.hrc | 30 +++++++++++++++++++----------- uui/source/logindlg.src | 7 +++++++ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/uui/source/ids.hrc b/uui/source/ids.hrc index 9bf5856bc270..808033ec9d4c 100644 --- a/uui/source/ids.hrc +++ b/uui/source/ids.hrc @@ -167,17 +167,25 @@ #define ERRCODE_UUI_SSLWARN_INVALID_1 (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_INVALID + 1) #define TITLE_UUI_SSLWARN_INVALID (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_INVALID + 3) -#define HID_DLG_LOGIN (HID_UUI_START + 0) -#define HID_DLG_COOKIES (HID_UUI_START + 1) -#define HID_DLG_MASTERPASSWORD_UUI (HID_UUI_START+2) -#define HID_DLG_MASTERPASSWORD_CRT (HID_UUI_START+3) -#define HID_DLG_FILTER_SELECT (HID_UUI_START+4) -#define HID_DLG_PASSWORD_UUI (HID_UUI_START+5) -#define HID_DLG_PASSWORD_CRT (HID_UUI_START+6) -#define HID_DLG_UNKNOWNAUTH_UUI (HID_UUI_START+7) -#define HID_DLG_SSLWARN_UUI (HID_UUI_START+8) -#define HID_XMLSECDLG_MACROWARN (HID_UUI_START+9) -#define HID_DLG_NEWERVERSIONWARNING (HID_UUI_START+10) +#define HID_DLG_LOGIN (HID_UUI_START + 0) +#define HID_DLG_COOKIES (HID_UUI_START + 1) +#define HID_DLG_MASTERPASSWORD_UUI (HID_UUI_START + 2) +#define HID_DLG_MASTERPASSWORD_CRT (HID_UUI_START + 3) +#define HID_DLG_FILTER_SELECT (HID_UUI_START + 4) +#define HID_DLG_PASSWORD_UUI (HID_UUI_START + 5) +#define HID_DLG_PASSWORD_CRT (HID_UUI_START + 6) +#define HID_DLG_UNKNOWNAUTH_UUI (HID_UUI_START + 7) +#define HID_DLG_SSLWARN_UUI (HID_UUI_START + 8) +#define HID_XMLSECDLG_MACROWARN (HID_UUI_START + 9) +#define HID_DLG_NEWERVERSIONWARNING (HID_UUI_START +10) + +#define HID_LOGIN_DLG_PATH (HID_UUI_START +11) +#define HID_LOGIN_DLG_BROWSE (HID_UUI_START +12) +#define HID_LOGIN_DLG_USER_NAME (HID_UUI_START +13) +#define HID_LOGIN_DLG_PASSWORD (HID_UUI_START +14) +#define HID_LOGIN_DLG_ACCOUNT (HID_UUI_START +15) +#define HID_LOGIN_DLG_REMEMBER_PASSWORD (HID_UUI_START +16) +#define HID_LOGIN_DLG_USE_SYSTEM_CREDENTIALS (HID_UUI_START +17) // HID_UUI_END (aka HID_CHAOS_NEW_DATABASE) is reserved in // sfx2/util/hidother.src diff --git a/uui/source/logindlg.src b/uui/source/logindlg.src index c2683ea3d94c..bf6a97c3b0ff 100755 --- a/uui/source/logindlg.src +++ b/uui/source/logindlg.src @@ -93,12 +93,14 @@ ModalDialog DLG_UUI_LOGIN Edit ED_LOGIN_PATH { + HelpId = HID_LOGIN_DLG_PATH; Border = TRUE ; Pos = MAP_APPFONT( 6 , 95 ) ; Size = MAP_APPFONT( 112 , 12 ) ; }; PushButton BTN_LOGIN_PATH { + HelpId = HID_LOGIN_DLG_BROWSE; Pos = MAP_APPFONT( 121 , 94 ) ; Size = MAP_APPFONT( 50 , 14 ) ; Text = "~Browse..." ; @@ -113,6 +115,7 @@ ModalDialog DLG_UUI_LOGIN Edit ED_LOGIN_USERNAME { + HelpId = HID_LOGIN_DLG_USER_NAME; Border = TRUE ; Pos = MAP_APPFONT( 6 , 121 ) ; Size = MAP_APPFONT( 165 , 12 ) ; @@ -127,6 +130,7 @@ ModalDialog DLG_UUI_LOGIN Edit ED_LOGIN_PASSWORD { + HelpId = HID_LOGIN_DLG_PASSWORD; Border = TRUE ; Pos = MAP_APPFONT( 6 , 147 ) ; Size = MAP_APPFONT( 165 , 12 ) ; @@ -142,6 +146,7 @@ ModalDialog DLG_UUI_LOGIN Edit ED_LOGIN_ACCOUNT { + HelpId = HID_LOGIN_DLG_ACCOUNT; Border = TRUE ; Pos = MAP_APPFONT( 6 , 173 ) ; Size = MAP_APPFONT( 165 , 12 ) ; @@ -150,6 +155,7 @@ ModalDialog DLG_UUI_LOGIN CheckBox CB_LOGIN_SAVEPASSWORD { + HelpId = HID_LOGIN_DLG_REMEMBER_PASSWORD; Pos = MAP_APPFONT( 6 , 190 ) ; Size = MAP_APPFONT( 165 , 10 ) ; Text [ en-US ] = "~Remember password" ; @@ -157,6 +163,7 @@ ModalDialog DLG_UUI_LOGIN CheckBox CB_LOGIN_USESYSCREDS { + HelpId = HID_LOGIN_DLG_USE_SYSTEM_CREDENTIALS; Pos = MAP_APPFONT( 6 , 203 ) ; Size = MAP_APPFONT( 165 , 10 ) ; Text [ en-US ] = "~Use system credentials" ; -- cgit From d148b9b253a4dc439d7572877afd7b43aa943ca8 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 8 Jun 2010 18:04:16 +0200 Subject: cws tl79: #i110254# help ids added --- sfx2/source/dialog/securitypage.src | 15 ++++++++++++--- sfx2/source/inc/helpid.hrc | 10 +++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src index 7c0fffd96057..fee60404d01c 100755 --- a/sfx2/source/dialog/securitypage.src +++ b/sfx2/source/dialog/securitypage.src @@ -54,6 +54,7 @@ TabPage TP_DOCINFOSECURITY }; Edit PASSWORD_TO_OPEN_ED { + HelpId = HID_SECURITYTAB_PASSWORD_TO_OPEN; Pos = MAP_APPFONT( 100, 18 ); Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); Border = TRUE; @@ -67,6 +68,7 @@ TabPage TP_DOCINFOSECURITY }; Edit CONFIRM_PASSWORD_TO_OPEN_ED { + HelpId = HID_SECURITYTAB_CONFIRM_PASSWORD_TO_OPEN; Pos = MAP_APPFONT( 100, 32 ); Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); Border = TRUE; @@ -76,9 +78,11 @@ TabPage TP_DOCINFOSECURITY { Pos = MAP_APPFONT( 12, 48 ); Size = MAP_APPFONT( 236, 3 * RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Note: If you lose or forget the password, it cannot be recovered."\ - "It is advisable to keep passwords in a safe place."\ - "Passwords are case-sensitive."; + Text [ en-US ] = + "Note: After a password has been set, the document will only open "\ + "with the password. Should you lose the password, there will be "\ + "no way to recover the document. Please also note that this password "\ + "is case-sensitive."; WordBreak = TRUE; }; FixedLine PASSWORD_TO_MODIFY_FL @@ -95,6 +99,7 @@ TabPage TP_DOCINFOSECURITY }; Edit PASSWORD_TO_MODIFY_ED { + HelpId = HID_SECURITYTAB_PASSWORD_TO_MODIFY; Pos = MAP_APPFONT( 100, 90 ); Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); Border = TRUE; @@ -108,6 +113,7 @@ TabPage TP_DOCINFOSECURITY }; Edit CONFIRM_PASSWORD_TO_MODIFY_ED { + HelpId = HID_SECURITYTAB_CONFIRM_PASSWORD_TO_MODIFY; Pos = MAP_APPFONT( 100, 104 ); Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); Border = TRUE; @@ -121,18 +127,21 @@ TabPage TP_DOCINFOSECURITY }; CheckBox OPEN_READONLY_CB { + HelpId = HID_SECURITYTAB_OPEN_FILE_READONLY; Pos = MAP_APPFONT( 12, 133 ); Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); Text [ en-US ] = "~Open file read-only"; }; CheckBox RECORD_CHANGES_CB { + HelpId = HID_SECURITYTAB_RECORD_CHANGES; Pos = MAP_APPFONT( 12, 147 ); Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); Text [ en-US ] = "Record ~changes"; }; PushButton CHANGE_PROTECTION_PB { + HelpId = HID_SECURITYTAB_PROTECTION; Pos = MAP_APPFONT( 194, 145 ); Size = MAP_APPFONT( 60, RSC_CD_PUSHBUTTON_HEIGHT ); }; diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc index f09ac7e94ecc..4c9aa3fd7f63 100755 --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -346,7 +346,15 @@ #define HID_CTRL_CUSTOMPROPS_YES_NO (HID_SFX_START + 326) #define HID_DLG_CUSTOMPROPS_DURATION (HID_SFX_START + 327) -#define ACT_SFX_HID_END HID_DLG_CUSTOMPROPS_DURATION +#define HID_SECURITYTAB_PASSWORD_TO_OPEN (HID_SFX_START + 328) +#define HID_SECURITYTAB_CONFIRM_PASSWORD_TO_OPEN (HID_SFX_START + 329) +#define HID_SECURITYTAB_PASSWORD_TO_MODIFY (HID_SFX_START + 330) +#define HID_SECURITYTAB_CONFIRM_PASSWORD_TO_MODIFY (HID_SFX_START + 331) +#define HID_SECURITYTAB_OPEN_FILE_READONLY (HID_SFX_START + 332) +#define HID_SECURITYTAB_RECORD_CHANGES (HID_SFX_START + 333) +#define HID_SECURITYTAB_PROTECTION (HID_SFX_START + 334) + +#define ACT_SFX_HID_END HID_SECURITYTAB_PROTECTION // "Uberlaufpr"ufung -------------------------------------------------------- -- cgit From dad227c459a2329bf6da8eec4847ce8fca228575 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 9 Jun 2010 14:04:54 +0200 Subject: tl78: #i110383# fix condition --- sfx2/source/dialog/filedlghelper.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 072729648628..569c0ddb163e 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1647,7 +1647,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD; - ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ) ) ); + ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ) != 0 ) ); uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() ); xInteractionHandler->handle( rRequest ); -- cgit From 6fa6c701a54c78715c7df2cc771875313c4d71d6 Mon Sep 17 00:00:00 2001 From: Frank Peters Date: Wed, 9 Jun 2010 18:24:55 +0200 Subject: #i111721# --- readlicense_oo/docs/readme.xsl | 149 ++++++++++++------- readlicense_oo/docs/readme/readme.xrm | 270 +++++++++++++++++----------------- 2 files changed, 235 insertions(+), 184 deletions(-) diff --git a/readlicense_oo/docs/readme.xsl b/readlicense_oo/docs/readme.xsl index cb13fb08ff83..4e77fa522c3d 100644 --- a/readlicense_oo/docs/readme.xsl +++ b/readlicense_oo/docs/readme.xsl @@ -5,8 +5,8 @@ - - + + @@ -15,30 +15,40 @@ - - + + + + + + - - + + + + + + + + + - - + - - - + + + - + - - + + @@ -46,83 +56,118 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + - + - + + - - - + + + + + + + + ---------------------------------------------------------------------------------------------------------- - + - - - -* - - - - + + + + + + + + +* + + + + + + + + + + - + + - + + - + + ====================================================================== - + + + ====================================================================== - + + ---------------------------------------------------------------------- - + + + ---------------------------------------------------------------------- - + + - + + + ---------------------------------------------------------------------- - + - + diff --git a/readlicense_oo/docs/readme/readme.xrm b/readlicense_oo/docs/readme/readme.xrm index 43603ed2159b..ac9ba071362e 100755 --- a/readlicense_oo/docs/readme/readme.xrm +++ b/readlicense_oo/docs/readme/readme.xrm @@ -1,8 +1,12 @@ - + + - + + ${PRODUCTNAME} Readme File + +
    -

    ${PRODUCTNAME} ${PRODUCTVERSION} ReadMe

    -

    For latest updates to this readme file, see http://www.openoffice.org/welcome/readme.html

    +

    For latest updates to this readme file, see http://www.openoffice.org/welcome/readme.html +

    This file contains important information about this program. Please read this information very carefully before starting work.

    -

    The OpenOffice.org Community, responsible for the development of this product, would like to invite you to participate as a community member. As a new user, you can check out the ${PRODUCTNAME} site with helpful user information at http://www.openoffice.org/about_us/introduction.html

    +

    The OpenOffice.org Community, responsible for the development of this product, would like to invite you to participate as a community member. As a new user, you can check out the ${PRODUCTNAME} site with helpful user information at http://www.openoffice.org/about_us/introduction.html +

    Also read the sections below about getting involved in the OpenOffice.org project.

    -

    Is ${PRODUCTNAME} really free for any user?

    -

    ${PRODUCTNAME} is free for use by everybody. You may take this copy of ${PRODUCTNAME} and install it on as many computers as you like, and use it for any purpose you like (including commercial, government, public administration and educational use). For further details see the license text delivered together with ${PRODUCTNAME} or http://www.openoffice.org/license.html

    - +

    ${PRODUCTNAME} is free for use by everybody. You may take this copy of ${PRODUCTNAME} and install it on as many computers as you like, and use it for any purpose you like (including commercial, government, public administration and educational use). For further details see the license text delivered together with ${PRODUCTNAME} or http://www.openoffice.org/license.html +

    Why is ${PRODUCTNAME} free for any user?

    You can use this copy of ${PRODUCTNAME} today free of charge because individual contributors and corporate sponsors have designed, developed, tested, translated, documented, supported, marketed, and helped in many other ways to make ${PRODUCTNAME} what it is today - the world's leading open-source office software.

    If you appreciate their efforts, and would like to ensure OpenOffice.org continues into the future, please consider contributing to the project - see http://contributing.openoffice.org for details. Everyone has a contribution to make.

    -
    -

    Notes on Installation

    -

    System Requirements

    -
    +
    • MacOSX 10.4 (Tiger) or higher

    • +
    • Intel processor

    • +
    • 512 MB RAM

    • +
    • Up to 1.5 GB available hard disk space

    • +
    • 1024 x 768 graphic device with 256 colors (higher resolution recommended)

    -
    +
    • Microsoft Windows 2000 (Service Pack 4 or higher), XP, Vista, or Windows 7

    • +
    • Pentium compatible PC (Pentium III or Athlon recommended)

    • +
    • 256 MB RAM (512 MB RAM recommended)

    • +
    • Up to 1.5 GB available hard disk space

    • +
    • 1024x768 resolution (higher resolution recommended), at least 256 colors

    -

    Please be aware that administrator rights are needed for the installation process.

    - +

    Please be aware that administrator rights are needed for the installation process.

    Registration of ${PRODUCTNAME} as default application for Microsoft Office formats can be forced or suppressed by using the following command line switches with the installer:

    • -

      /msoreg=1 will force registration of ${PRODUCTNAME} as default application for Microsoft Office formats.

      +

      + /msoreg=1 will force registration of ${PRODUCTNAME} as default application for Microsoft Office formats.

    • +
    • -

      /msoreg=0 will suppress registration of ${PRODUCTNAME} as default application for Microsoft Office formats.

      +

      + /msoreg=0 will suppress registration of ${PRODUCTNAME} as default application for Microsoft Office formats.

    -

    If you perform an administrative installation using setup /a, you need to make sure that the file msvc90.dll is installed on the system. This file is required for ${PRODUCTNAME} to start after an administrative installation. You can get the file from http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF

    -

    Please be aware that administrator rights are needed for the installation process.

    +

    If you perform an administrative installation using setup /a, you need to make sure that the file msvc90.dll is installed on the system. This file is required for ${PRODUCTNAME} to start after an administrative installation. You can get the file from http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF +

    +

    Please be aware that administrator rights are needed for the installation process.

    -
    +
    • Solaris 10 operating system (SPARC platform) or higher

    • +
    • 256 MB RAM (512 MB RAM recommended)

    • +
    • Up to 1.55 GB available hard disk space

    • +
    • X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors

    • +
    • Window Manager

    • +
    • Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)

    -
    +
    • Solaris 10 operating system (x86 platform) or higher

    • +
    • 256 MB RAM (512 MB RAM recommended)

    • +
    • Up to 1.55 GB available hard disk space

    • +
    • X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors

    • +
    • Window Manager

    • +
    • Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)

    -
    -
    +
    +
    • Linux Kernel version 2.6.18 or higher

    • +
    • glibc2 version 2.5 or higher

    • +
    • gtk version 2.10.4 or higher

    • +
    • Pentium compatible PC (Pentium III or Athlon recommended)

    • +
    • 256 MB RAM (512 MB RAM recommended)

    • +
    • Up to 1.55 GB available hard disk space

    • +
    • X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors

    • +
    • Window Manager

    • +
    • Gnome 2.16 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)

    There is a wide variety of Linux distributions, and even within the same distribution there may be different installation options (KDE vs Gnome, etc.). Some distributions ship with their own ‘native’ version of ${PRODUCTNAME}, which may have different features from this Community ${PRODUCTNAME}. Sometimes you can install the Community ${PRODUCTNAME} alongside the ‘native’ version. However, it’s usually safer to remove the ‘native’ version before installing this Community version. Consult the documentation for your distribution for details of how to do this.

    -

    It is recommended that you always backup your system before you remove or install software.

    -
    - -

    Please make sure you have enough free memory in the temporary directory on your system and that read, write and run access rights have been granted. Close all other programs before starting the installation.

    -
    - -
    -

    Extension Database Incompatibility

    -

    The Berkeley database engine has been upgraded in this version of ${PRODUCTNAME}. The database engine upgrade introduces an incompatibility with user data for installed extensions for ${PRODUCTNAME} versions prior to 3.2 that may require your action if you downgrade your version of ${PRODUCTNAME}.

    -

    This version of ${PRODUCTNAME} will convert your extension database to the new Berkeley database format when extensions are installed or removed. After this conversion, the database can no longer be read by earlier versions of ${PRODUCTNAME}. Downgrading to an earlier version may result in a dysfunctional installation.

    -

    If you downgrade to an earlier version of ${PRODUCTNAME}, you must remove the user data directory {user data}/uno_packages, for example ~/.openoffice.org/3/user/uno_packages, and reinstall all extensions.

    -
    - -
    -

    Problems During Program Startup

    - -
    -

    If you experience ${PRODUCTNAME} startup problems (most notably while using Gnome) please 'unset' the SESSION_MANAGER environment variable inside the shell you use to start ${PRODUCTNAME}. This can be done by adding the line "unset SESSION_MANAGER" to the beginning of the soffice shell script found in the "[office folder]/program" directory.

    -
    - -

    Difficulties starting ${PRODUCTNAME} (e.g. applications hang) as well as problems with the screen display are often caused by the graphics card driver. If these problems occur, please update your graphics card driver or try using the graphics driver delivered with your operating system. Difficulties displaying 3D objects can often be solved by deactivating the option "Use OpenGL" under 'Tools - Options - ${PRODUCTNAME} - View - 3D view'.

    -
    - -
    -

    ALPS/Synaptics notebook touchpads in Windows

    -

    Due to a Windows driver issue, you cannot scroll through ${PRODUCTNAME} documents when you slide your finger across an ALPS/Synaptics touchpad.

    -

    To enable touchpad scrolling, add the following lines to the "C:\Program Files\Synaptics\SynTP\SynTPEnh.ini" configuration file, and restart your computer:

    -

    [${PRODUCTNAME}]

    -

    FC = "SALFRAME"

    -

    SF = 0x10000000

    -

    SF |= 0x00004000

    -

    The location of the configuration file might vary on different versions of Windows.

    +

    It is recommended that you always backup your system before you remove or install software.

    +

    Please make sure you have enough free memory in the temporary directory on your system and that read, write and run access rights have been granted. Close all other programs before starting the installation.

    +
    -
    -

    Mozilla Address Book Driver

    -

    The Mozilla address book driver requires the SUNWzlib package. This package is not part of the minimum Solaris operating system installation. If you require access to the Mozilla address book, then add this package to your Solaris operating system using the command "pkgadd" from the installation CD.

    -
    +
    +

    Extension Database Incompatibility

    +

    The Berkeley database engine has been upgraded in this version of ${PRODUCTNAME}. The database engine upgrade introduces an incompatibility with user data for installed extensions for ${PRODUCTNAME} versions prior to 3.2 that may require your action if you downgrade your version of ${PRODUCTNAME}.

    +

    This version of ${PRODUCTNAME} will convert your extension database to the new Berkeley database format when extensions are installed or removed. After this conversion, the database can no longer be read by earlier versions of ${PRODUCTNAME}. Downgrading to an earlier version may result in a dysfunctional installation.

    +

    If you downgrade to an earlier version of ${PRODUCTNAME}, you must remove the user data directory {user data}/uno_packages, for example ~/.openoffice.org/3/user/uno_packages, and reinstall all extensions.

    +
    -
    -

    Shortcut Keys

    -

    Only shortcut keys (key combinations) not used by the operating system can be used in ${PRODUCTNAME}. If a key combination in ${PRODUCTNAME} does not work as described in the ${PRODUCTNAME} Help, check if that shortcut is already used by the operating system. To rectify such conflicts, you can change the keys assigned by your operating system. Alternatively, you can change almost any key assignment in ${PRODUCTNAME}. For more information on this topic, refer to the ${PRODUCTNAME} Help or the Help documention of your operating system.

    - -
    -

    The application help of ${PRODUCTNAME} may use shortcut combinations for PC keyboards only.

    -
    - -

    Due to a conflict with input method switching on multiple platforms, the following shortcut keys required to be changed at last minute:

    - -
    -
      -
    • -

      Cmd-Space is now Cmd-Shift-Space

      -
    • -
    • -

      Cmd-Shift-Space is now Cmd-M

      -
    • -
    -
    - -
    -
      -
    • -

      Ctrl-Space is now Ctrl-Shift-Space

      -
    • -
    • -

      Ctrl-Shift-Space is now Ctrl-M

      -
    • -
    -
    +
    +

    Problems During Program Startup

    +
    +

    If you experience ${PRODUCTNAME} startup problems (most notably while using Gnome) please 'unset' the SESSION_MANAGER environment variable inside the shell you use to start ${PRODUCTNAME}. This can be done by adding the line "unset SESSION_MANAGER" to the beginning of the soffice shell script found in the "[office folder]/program" directory.

    +

    Difficulties starting ${PRODUCTNAME} (e.g. applications hang) as well as problems with the screen display are often caused by the graphics card driver. If these problems occur, please update your graphics card driver or try using the graphics driver delivered with your operating system. Difficulties displaying 3D objects can often be solved by deactivating the option "Use OpenGL" under 'Tools - Options - ${PRODUCTNAME} - View - 3D view'.

    +
    -
    -

    File Locking

    -

    File locking is enabled by default in ${PRODUCTNAME}. On a network that uses the Network File System protocol (NFS), the locking daemon for NFS clients must be active. To disable file locking, edit the soffice script and change the line "export SAL_ENABLE_FILE_LOCKING" to "# export SAL_ENABLE_FILE_LOCKING". If you disable file locking, the write access of a document is not restricted to the user who first opens the document.

    -

    Warning: The activated file locking feature can cause problems with Solaris 2.5.1 and 2.7 used in conjunction with Linux NFS 2.0. If your system environment has these parameters, we strongly recommend that you avoid using the file locking feature. Otherwise, ${PRODUCTNAME} will hang when you try to open a file from a NFS mounted directory from a Linux computer.

    -
    +
    +

    ALPS/Synaptics notebook touchpads in Windows

    +

    Due to a Windows driver issue, you cannot scroll through ${PRODUCTNAME} documents when you slide your finger across an ALPS/Synaptics touchpad.

    +

    To enable touchpad scrolling, add the following lines to the "C:\Program Files\Synaptics\SynTP\SynTPEnh.ini" configuration file, and restart your computer:

    +

    [${PRODUCTNAME}]

    +

    FC = "SALFRAME"

    +

    SF = 0x10000000

    +

    SF |= 0x00004000

    +

    The location of the configuration file might vary on different versions of Windows.

    +
    -
    -

    Problems When Sending Documents as E-mails From ${PRODUCTNAME}

    -

    When sending a document via 'File - Send - Document as E-mail' or 'Document as PDF Attachment' problems might occur (program crashes or hangs). This is due to the Windows system file "Mapi" (Messaging Application Programming Interface) which causes problems in some file versions. Unfortunately, the problem cannot be narrowed down to a certain version number. For more information visit http://www.microsoft.com to search the Microsoft Knowledge Base for "mapi dll".

    -
    +
    +

    Mozilla Address Book Driver

    +

    The Mozilla address book driver requires the SUNWzlib package. This package is not part of the minimum Solaris operating system installation. If you require access to the Mozilla address book, then add this package to your Solaris operating system using the command "pkgadd" from the installation CD.

    +
    -
    -

    Important Accessibility Notes

    -

    For more information on the accessibility features in ${PRODUCTNAME}, see http://www.openoffice.org/access/

    -
    - -
    -

    Registration

    -

    Please take a little time to complete the minimal Product Registration process when you install the software. While registration is optional, we encourage you to register, since the information enables the community to make an even better software suite and address user needs directly. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data. If you missed the registration at installation, you can return and register at any time at by choosing "Help - Registration" from the main menu.

    +
    +

    Shortcut Keys

    +

    Only shortcut keys (key combinations) not used by the operating system can be used in ${PRODUCTNAME}. If a key combination in ${PRODUCTNAME} does not work as described in the ${PRODUCTNAME} Help, check if that shortcut is already used by the operating system. To rectify such conflicts, you can change the keys assigned by your operating system. Alternatively, you can change almost any key assignment in ${PRODUCTNAME}. For more information on this topic, refer to the ${PRODUCTNAME} Help or the Help documention of your operating system.

    +
    +

    The application help of ${PRODUCTNAME} may use shortcut combinations for PC keyboards only.

    +
    -
    -

    User Survey

    -

    There is also a User Survey located online which we encourage you to fill out. The User Survey results will help ${PRODUCTNAME} move more rapidly in setting new standards for the creation of the next-generation office suite. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data.

    -
    +
    +

    File Locking

    +

    File locking is enabled by default in ${PRODUCTNAME}. On a network that uses the Network File System protocol (NFS), the locking daemon for NFS clients must be active. To disable file locking, edit the soffice script and change the line "export SAL_ENABLE_FILE_LOCKING" to "# export SAL_ENABLE_FILE_LOCKING". If you disable file locking, the write access of a document is not restricted to the user who first opens the document.

    +

    Warning: The activated file locking feature can cause problems with Solaris 2.5.1 and 2.7 used in conjunction with Linux NFS 2.0. If your system environment has these parameters, we strongly recommend that you avoid using the file locking feature. Otherwise, ${PRODUCTNAME} will hang when you try to open a file from a NFS mounted directory from a Linux computer.

    +
    -
    -

    User Support

    -

    The main support page http://support.openoffice.org/ offers various possibilities for help with ${PRODUCTNAME}. Your question may have already been answered - check the Community Forum at http://user.services.openoffice.org or search the archives of the 'users@openoffice.org' mailing list at http://www.openoffice.org/mail_list.html. Alternatively, you can send in your questions to users@openoffice.org. How to subscribe to the list (to get an email response) is explained on this page: http://wiki.services.openoffice.org/wiki/Website/Content/help/mailinglists.

    -

    Also check the FAQ section at http://wiki.services.openoffice.org/wiki/Documentation/FAQ.

    -
    - -
    -

    Reporting Bugs & Issues

    -

    The ${PRODUCTNAME} Web site hosts IssueZilla, our mechanism for reporting, tracking and solving bugs and issues. We encourage all users to feel entitled and welcome to report issues that may arise on your particular platform. Energetic reporting of issues is one of the most important contributions that the user community can make to the ongoing development and improvement of the suite.

    -
    +
    +

    Problems When Sending Documents as E-mails From ${PRODUCTNAME}

    +

    When sending a document via 'File - Send - Document as E-mail' or 'Document as PDF Attachment' problems might occur (program crashes or hangs). This is due to the Windows system file "Mapi" (Messaging Application Programming Interface) which causes problems in some file versions. Unfortunately, the problem cannot be narrowed down to a certain version number. For more information visit http://www.microsoft.com to search the Microsoft Knowledge Base for "mapi dll".

    +
    -
    +
    +

    Important Accessibility Notes

    +

    For more information on the accessibility features in ${PRODUCTNAME}, see http://www.openoffice.org/access/ +

    +
    + +
    +

    Registration

    +

    Please take a little time to complete the minimal Product Registration process when you install the software. While registration is optional, we encourage you to register, since the information enables the community to make an even better software suite and address user needs directly. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data. If you missed the registration at installation, you can return and register at any time at by choosing "Help - Registration" from the main menu.

    +
    + +
    +

    User Survey

    +

    There is also a User Survey located online which we encourage you to fill out. The User Survey results will help ${PRODUCTNAME} move more rapidly in setting new standards for the creation of the next-generation office suite. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data.

    +
    + +
    +

    User Support

    +

    The main support page http://support.openoffice.org/ offers various possibilities for help with ${PRODUCTNAME}. Your question may have already been answered - check the Community Forum at http://user.services.openoffice.org or search the archives of the 'users@openoffice.org' mailing list at http://www.openoffice.org/mail_list.html. Alternatively, you can send in your questions to users@openoffice.org. How to subscribe to the list (to get an email response) is explained on this page: http://wiki.services.openoffice.org/wiki/Website/Content/help/mailinglists.

    +

    Also check the FAQ section at http://wiki.services.openoffice.org/wiki/Documentation/FAQ. +

    +
    + +
    +

    Reporting Bugs & Issues

    +

    The ${PRODUCTNAME} Web site hosts IssueZilla, our mechanism for reporting, tracking and solving bugs and issues. We encourage all users to feel entitled and welcome to report issues that may arise on your particular platform. Energetic reporting of issues is one of the most important contributions that the user community can make to the ongoing development and improvement of the suite.

    +
    + +

    Getting Involved

    The ${PRODUCTNAME} Community would very much benefit from your active participation in the development of this important open source project.

    -

    As a user, you are already a valuable part of the suite's development process and we would like to encourage you to take an even more active role with a view to being a long-term contributor to the community. Please join and check out the user page at http://www.openoffice.org

    - +

    As a user, you are already a valuable part of the suite's development process and we would like to encourage you to take an even more active role with a view to being a long-term contributor to the community. Please join and check out the user page at http://www.openoffice.org +

    How to Start

    -

    The best way to start contributing is to subscribe to one or more of the mailing lists, lurk for a while, and gradually use the mail archives to familiarize yourself with many of the topics covered since the ${PRODUCTNAME} source code was released back in October 2000. When you're comfortable, all you need to do is send an email self-introduction and jump right in. If you are familiar with Open Source Projects, check out our To-Dos list and see if there is anything you would like to help with at http://development.openoffice.org/todo.html.

    - +

    The best way to start contributing is to subscribe to one or more of the mailing lists, lurk for a while, and gradually use the mail archives to familiarize yourself with many of the topics covered since the ${PRODUCTNAME} source code was released back in October 2000. When you're comfortable, all you need to do is send an email self-introduction and jump right in. If you are familiar with Open Source Projects, check out our To-Dos list and see if there is anything you would like to help with at http://development.openoffice.org/todo.html.

    Subscribe

    -

    Here are a few of the Project mailing lists to which you can subscribe at http://www.openoffice.org/mail_list.html

    +

    Here are a few of the Project mailing lists to which you can subscribe at http://www.openoffice.org/mail_list.html +

    • News: announce@openoffice.org *recommended to all users* (light traffic)

    • +
    • Main user forum: user@openoffice.org *easy way to lurk on discussions* (heavy traffic)

    • +
    • Marketing project: dev@marketing.openoffice.org *beyond development* (getting heavy)

    • +
    • General code contributor list: dev@openoffice.org (moderate/heavy)

    -

    Joining one or more Projects

    You can make major contributions to this important open source project even if you have limited software design or coding experience. Yes, you!

    -

    At http://projects.openoffice.org/index.html you will find projects ranging from Localization, Porting and Groupware to some real core coding projects. If you are not a developer, try the Documentation or the Marketing Project. The OpenOffice.org Marketing Project is applying both guerilla and traditional commercial techniques to marketing open source software, and we are doing it across language and cultural barriers, so you can help just by spreading the word and telling a friend about this office suite.

    +

    At http://projects.openoffice.org/index.html you will find projects ranging from Localization, Porting and Groupware to some real core coding projects. If you are not a developer, try the Documentation or the Marketing Project. The OpenOffice.org Marketing Project is applying both guerilla and traditional commercial techniques to marketing open source software, and we are doing it across language and cultural barriers, so you can help just by spreading the word and telling a friend about this office suite.

    You can help by joining the Marketing Communications & Information Network on http://marketing.openoffice.org/contacts.html where you can provide point communication contact with press, media, government agencies, consultants, schools, Linux Users Groups and developers in your country and local community.

    - +

    We hope you enjoy working with the new ${PRODUCTNAME} ${PRODUCTVERSION} and will join us online.

    The OpenOffice.org Community

    @@ -306,8 +313,7 @@

    Used / Modified Source Code

    -

    Portions Copyright 1998, 1999 James Clark. Portions Copyright 1996, 1998 Netscape Communications Corporation.

    +

    Portions Copyright 1998, 1999 James Clark. Portions Copyright 1996, 1998 Netscape Communications Corporation.

    - -- cgit From 421512f0dc8985da05ff9654be8a3344aae0d513 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 10 Jun 2010 14:04:48 +0200 Subject: jl152 #i77196# fixed failed start up for user without write access to share --- desktop/source/deployment/manager/dp_extensionmanager.cxx | 2 +- desktop/source/deployment/manager/dp_manager.cxx | 10 ++++++++-- .../source/deployment/registry/executable/dp_executable.cxx | 5 ++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 24b5712ebd30..13c43e41decf 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -1174,7 +1174,7 @@ sal_Bool ExtensionManager::synchronize( } catch (...) { uno::Any exc = ::cppu::getCaughtException(); throw deploy::DeploymentException( - OUSTR("Extension Manager: exception during enableExtension"), + OUSTR("Extension Manager: exception in synchronize"), static_cast(this), exc); } } diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 409cf2674184..44bc4d469f2f 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -183,7 +183,8 @@ void PackageManagerImpl::initActivationLayer( OSL_ASSERT( m_activePackages.getLength() > 0 ); m_activePackages_expanded = expandUnoRcUrl( m_activePackages ); m_registrationData_expanded = expandUnoRcUrl(m_registrationData); - create_folder( 0, m_activePackages_expanded, xCmdEnv, true); + if (!m_readOnly) + create_folder( 0, m_activePackages_expanded, xCmdEnv, true); OUString dbName; if (m_context.equals(OUSTR("user"))) @@ -1341,9 +1342,14 @@ bool PackageManagerImpl::synchronizeAddedExtensions( { bool bModified = false; ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() ); - + //check if the folder exist at all. The shared extension folder + //may not exist for a normal user. + if (!create_ucb_content( + NULL, m_activePackages_expanded, Reference(), false)) + return bModified; ::ucbhelper::Content tempFolder( m_activePackages_expanded, xCmdEnv ); + Reference xResultSet( tempFolder.createCursor( Sequence( &StrTitle::get(), 1 ), diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx index c72a97d88891..968ee7297b0f 100644 --- a/desktop/source/deployment/registry/executable/dp_executable.cxx +++ b/desktop/source/deployment/registry/executable/dp_executable.cxx @@ -254,9 +254,8 @@ void BackendImpl::ExecutablePackageImpl::processPackage_( OSL_ASSERT(0); //This won't have affect on Windows - if (osl::File::E_None != osl::File::setAttributes( - dp_misc::expandUnoRcUrl(m_url), attributes)) - OSL_ENSURE(0, "Extension Manager: Could not set executable file attribute."); + osl::File::setAttributes( + dp_misc::expandUnoRcUrl(m_url), attributes); } getMyBackend()->addDataToDb(getURL()); } -- cgit From 699df1265794647c54e63c13d2e7dc819728677f Mon Sep 17 00:00:00 2001 From: Frank Peters Date: Thu, 10 Jun 2010 14:23:42 +0200 Subject: consolidatereadme #i111721# --- readlicense_oo/docs/readme/readme.xrm | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/readlicense_oo/docs/readme/readme.xrm b/readlicense_oo/docs/readme/readme.xrm index ac9ba071362e..78716869e822 100755 --- a/readlicense_oo/docs/readme/readme.xrm +++ b/readlicense_oo/docs/readme/readme.xrm @@ -18,15 +18,12 @@

    ${PRODUCTNAME} ${PRODUCTVERSION} ReadMe

    -

    For latest updates to this readme file, see http://www.openoffice.org/welcome/readme.html -

    +

    For latest updates to this readme file, see http://www.openoffice.org/welcome/readme.html

    This file contains important information about this program. Please read this information very carefully before starting work.

    -

    The OpenOffice.org Community, responsible for the development of this product, would like to invite you to participate as a community member. As a new user, you can check out the ${PRODUCTNAME} site with helpful user information at http://www.openoffice.org/about_us/introduction.html -

    +

    The OpenOffice.org Community, responsible for the development of this product, would like to invite you to participate as a community member. As a new user, you can check out the ${PRODUCTNAME} site with helpful user information at http://www.openoffice.org/about_us/introduction.html

    Also read the sections below about getting involved in the OpenOffice.org project.

    Is ${PRODUCTNAME} really free for any user?

    -

    ${PRODUCTNAME} is free for use by everybody. You may take this copy of ${PRODUCTNAME} and install it on as many computers as you like, and use it for any purpose you like (including commercial, government, public administration and educational use). For further details see the license text delivered together with ${PRODUCTNAME} or http://www.openoffice.org/license.html -

    +

    ${PRODUCTNAME} is free for use by everybody. You may take this copy of ${PRODUCTNAME} and install it on as many computers as you like, and use it for any purpose you like (including commercial, government, public administration and educational use). For further details see the license text delivered together with ${PRODUCTNAME} or http://www.openoffice.org/license.html

    Why is ${PRODUCTNAME} free for any user?

    You can use this copy of ${PRODUCTNAME} today free of charge because individual contributors and corporate sponsors have designed, developed, tested, translated, documented, supported, marketed, and helped in many other ways to make ${PRODUCTNAME} what it is today - the world's leading open-source office software.

    If you appreciate their efforts, and would like to ensure OpenOffice.org continues into the future, please consider contributing to the project - see http://contributing.openoffice.org for details. Everyone has a contribution to make.

    @@ -84,17 +81,14 @@

    Registration of ${PRODUCTNAME} as default application for Microsoft Office formats can be forced or suppressed by using the following command line switches with the installer:

    • -

      - /msoreg=1 will force registration of ${PRODUCTNAME} as default application for Microsoft Office formats.

      +

      /msoreg=1 will force registration of ${PRODUCTNAME} as default application for Microsoft Office formats.

    • -

      - /msoreg=0 will suppress registration of ${PRODUCTNAME} as default application for Microsoft Office formats.

      +

      /msoreg=0 will suppress registration of ${PRODUCTNAME} as default application for Microsoft Office formats.

    -

    If you perform an administrative installation using setup /a, you need to make sure that the file msvc90.dll is installed on the system. This file is required for ${PRODUCTNAME} to start after an administrative installation. You can get the file from http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF -

    +

    If you perform an administrative installation using setup /a, you need to make sure that the file msvc90.dll is installed on the system. This file is required for ${PRODUCTNAME} to start after an administrative installation. You can get the file from http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF

    Please be aware that administrator rights are needed for the installation process.

    @@ -247,8 +241,7 @@

    Important Accessibility Notes

    -

    For more information on the accessibility features in ${PRODUCTNAME}, see http://www.openoffice.org/access/ -

    +

    For more information on the accessibility features in ${PRODUCTNAME}, see http://www.openoffice.org/access/

    @@ -264,8 +257,7 @@

    User Support

    The main support page http://support.openoffice.org/ offers various possibilities for help with ${PRODUCTNAME}. Your question may have already been answered - check the Community Forum at http://user.services.openoffice.org or search the archives of the 'users@openoffice.org' mailing list at http://www.openoffice.org/mail_list.html. Alternatively, you can send in your questions to users@openoffice.org. How to subscribe to the list (to get an email response) is explained on this page: http://wiki.services.openoffice.org/wiki/Website/Content/help/mailinglists.

    -

    Also check the FAQ section at http://wiki.services.openoffice.org/wiki/Documentation/FAQ. -

    +

    Also check the FAQ section at http://wiki.services.openoffice.org/wiki/Documentation/FAQ.

    @@ -276,13 +268,11 @@

    Getting Involved

    The ${PRODUCTNAME} Community would very much benefit from your active participation in the development of this important open source project.

    -

    As a user, you are already a valuable part of the suite's development process and we would like to encourage you to take an even more active role with a view to being a long-term contributor to the community. Please join and check out the user page at http://www.openoffice.org -

    +

    As a user, you are already a valuable part of the suite's development process and we would like to encourage you to take an even more active role with a view to being a long-term contributor to the community. Please join and check out the user page at http://www.openoffice.org

    How to Start

    The best way to start contributing is to subscribe to one or more of the mailing lists, lurk for a while, and gradually use the mail archives to familiarize yourself with many of the topics covered since the ${PRODUCTNAME} source code was released back in October 2000. When you're comfortable, all you need to do is send an email self-introduction and jump right in. If you are familiar with Open Source Projects, check out our To-Dos list and see if there is anything you would like to help with at http://development.openoffice.org/todo.html.

    Subscribe

    -

    Here are a few of the Project mailing lists to which you can subscribe at http://www.openoffice.org/mail_list.html -

    +

    Here are a few of the Project mailing lists to which you can subscribe at http://www.openoffice.org/mail_list.html

    • News: announce@openoffice.org *recommended to all users* (light traffic)

      -- cgit From 3bdbb3f6717d8690bc5b08cf241ac6cf44518f71 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 10 Jun 2010 14:41:57 +0200 Subject: jl152 #i77196# unopkg --help prints out infos about --bundled --- desktop/source/pkgchk/unopkg/unopkg_app.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 621b8b0bac7c..a9a0c8271373 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -108,6 +108,8 @@ const char s_usingText [] = " deployment context;\n" " run only when no concurrent Office\n" " process(es) are running!\n" +" --bundled expert feature: operate on bundled extensions. Only\n" +" works with list, validate, reinstall;\n" " --deployment-context expert feature: explicit deployment context\n" " \n" "\n" -- cgit From 2d03198027d5422eb374696b827268033338e73e Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 10 Jun 2010 15:20:30 +0200 Subject: jl152 #i77196# unopkg checkPrerequisitesAndEnable must return sal_Int32 --- desktop/source/deployment/manager/dp_extensionmanager.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index 54624514adce..64cada7da3ac 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -129,7 +129,7 @@ public: css::uno::RuntimeException); - virtual long SAL_CALL checkPrerequisitesAndEnable( + virtual sal_Int32 SAL_CALL checkPrerequisitesAndEnable( css::uno::Reference const & extension, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ) -- cgit From 463d6da2397ff113907eaa710fe711ee444ed3da Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 10 Jun 2010 16:55:56 +0200 Subject: jl152 #i77196# backend db wrote double entries if there was an ambiguous extension, and XExtensionManager::synchronize was run --- desktop/source/deployment/registry/dp_backenddb.cxx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx index 1f4a62e696d7..14b4f2374c5b 100644 --- a/desktop/source/deployment/registry/dp_backenddb.cxx +++ b/desktop/source/deployment/registry/dp_backenddb.cxx @@ -425,14 +425,24 @@ Reference BackendDb::writeKeyElement( const Reference doc = getDocument(); const Reference root = doc->getFirstChild(); -#if OSL_DEBUG_LEVEL > 0 - //There must not be yet an entry with the same url + //Check if there are an entry with the same url. This can be the case if the + //the status of an XPackage is ambiguous. In this case a call to activateExtension + //(dp_extensionmanager.cxx), will register the package again. See also + //Package::processPackage_impl in dp_backend.cxx. + //A package can become + //invalid after its successful registration, for example if a second extension with + //the same service is installed. const OUString sExpression( sPrefix + OUSTR(":") + sElementName + OUSTR("[@url = \"") + url + OUSTR("\"]")); - const Reference _extensionNode = + const Reference existingNode = getXPathAPI()->selectSingleNode(root, sExpression); - OSL_ASSERT(! _extensionNode.is()); -#endif + if (existingNode.is()) + { + OSL_ASSERT(0); + //replace the existing entry. + removeEntry(url); + } + const Reference keyElement( doc->createElementNS(sNameSpace, sPrefix + OUSTR(":") + sElementName)); -- cgit From 88f93ac2d640f99b46767caed96afdcd5d0cb688 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 10 Jun 2010 17:19:42 +0200 Subject: jl152 #i77196# unopkg checkPrerequisitesAndEnable must return sal_Int32 (also in cxx) --- desktop/source/deployment/manager/dp_extensionmanager.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 13c43e41decf..de9d97db2b48 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -853,7 +853,7 @@ void ExtensionManager::enableExtension( /** */ -long ExtensionManager::checkPrerequisitesAndEnable( +sal_Int32 ExtensionManager::checkPrerequisitesAndEnable( Reference const & extension, Reference const & xAbortChannel, Reference const & xCmdEnv) -- cgit From df2bc9a970d890d417c97810d41cc9686c30b975 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Thu, 10 Jun 2010 18:09:39 +0200 Subject: impressaccessibility7: #i111668# Added guards against empty mpEditSource in SvxUnoTextRangeBase. --- editeng/source/uno/unotext.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 45ef23c2be8f..ec7e76b144c0 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -260,12 +260,14 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const Sv DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!"); mpEditSource = pSource->Clone(); - ESelection aSelection; - ::GetSelection( aSelection, mpEditSource->GetTextForwarder() ); - SetSelection( aSelection ); + if (mpEditSource != NULL) + { + ESelection aSelection; + ::GetSelection( aSelection, mpEditSource->GetTextForwarder() ); + SetSelection( aSelection ); - if( mpEditSource ) mpEditSource->addRange( this ); + } #ifdef DEBUG gNumRanges.add(this); #endif @@ -348,7 +350,8 @@ void SvxUnoTextRangeBase::SetSelection( const ESelection& rSelection ) throw() OGuard aGuard( Application::GetSolarMutex() ); maSelection = rSelection; - CheckSelection( maSelection, mpEditSource->GetTextForwarder() ); + if (mpEditSource != NULL) + CheckSelection( maSelection, mpEditSource->GetTextForwarder() ); } // Interface XTextRange ( XText ) -- cgit From 09733434899d23c04e60d4caa18765b4bed87f3a Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 10 Jun 2010 19:17:08 +0200 Subject: tl78: #i110383# fix reload functionality --- sfx2/source/view/viewfrm.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index a80741df13a6..47f0926d00b6 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -382,12 +382,17 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // Speichern und Readonly Reloaden if( pSh->IsModified() ) { - if ( !pSh->PrepareClose() ) + if ( pSh->PrepareClose() ) + { + // the storing could let the medium be changed + pMed = pSh->GetMedium(); + bNeedsReload = sal_True; + } + else { rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_False ) ); return; } - else bNeedsReload = sal_True; } nOpenMode = SFX_STREAM_READONLY; } -- cgit From cd24cd260c8112aa71f657b2de8381cc8f1e8c8e Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Sat, 12 Jun 2010 20:29:06 +0200 Subject: CWS mba33issues01: put code to load libraries on demand into class SvLibrary --- officecfg/registry/data/org/openoffice/Office/Paths.xcu | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/officecfg/registry/data/org/openoffice/Office/Paths.xcu b/officecfg/registry/data/org/openoffice/Office/Paths.xcu index a7ecd0e224e8..91a26137b24d 100644 --- a/officecfg/registry/data/org/openoffice/Office/Paths.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Paths.xcu @@ -98,7 +98,13 @@ - + + + + + + + -- cgit From cac00f06770da2c1217fab5b58c1426833c6a03d Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Mon, 14 Jun 2010 11:53:06 +0200 Subject: jl152 bindPackage for extensions checks only for META-INF in folders and not META-INF/manifest.xml --- desktop/source/deployment/registry/package/dp_package.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index a2c68dd2341f..2ad6478b665c 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -378,7 +378,7 @@ Reference BackendImpl::bindPackage_( //Every .oxt, uno.pkg file must contain a META-INF folder ::ucbhelper::Content metaInfContent; if (create_ucb_content( - &metaInfContent, makeURL( url, OUSTR("META-INF/manifest.xml") ), + &metaInfContent, makeURL( url, OUSTR("META-INF") ), xCmdEnv, false /* no throw */ )) { mediaType = OUSTR("application/vnd.sun.star.package-bundle"); -- cgit From 6d073c4d67c86fcdde53e9e12da3c73e3b6e536a Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Mon, 14 Jun 2010 12:49:53 +0200 Subject: jl152:#i112371# Replaced old startcenter icon --- .../icons/hicolor/128x128/apps/startcenter.png | Bin 11073 -> 15601 bytes .../icons/hicolor/16x16/apps/startcenter.png | Bin 1043 -> 893 bytes .../icons/hicolor/32x32/apps/startcenter.png | Bin 2375 -> 2429 bytes .../icons/hicolor/48x48/apps/startcenter.png | Bin 3615 -> 4184 bytes 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/sysui/desktop/icons/hicolor/128x128/apps/startcenter.png b/sysui/desktop/icons/hicolor/128x128/apps/startcenter.png index b009ee2b9277..1b51a60bddea 100644 Binary files a/sysui/desktop/icons/hicolor/128x128/apps/startcenter.png and b/sysui/desktop/icons/hicolor/128x128/apps/startcenter.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/apps/startcenter.png b/sysui/desktop/icons/hicolor/16x16/apps/startcenter.png index c81fc95d4770..3aa8f08a8c5d 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/apps/startcenter.png and b/sysui/desktop/icons/hicolor/16x16/apps/startcenter.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/apps/startcenter.png b/sysui/desktop/icons/hicolor/32x32/apps/startcenter.png index 22bdd4a7fef9..296c6f4c58b1 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/apps/startcenter.png and b/sysui/desktop/icons/hicolor/32x32/apps/startcenter.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/apps/startcenter.png b/sysui/desktop/icons/hicolor/48x48/apps/startcenter.png index f67dc976750b..86bcf599553f 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/apps/startcenter.png and b/sysui/desktop/icons/hicolor/48x48/apps/startcenter.png differ -- cgit From 59e28862922d58883e74c6a87670a085b4a1df76 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 14 Jun 2010 15:03:53 +0100 Subject: gtkfpicker9: #i112386# make gtk fpicker gdk sections thread safe --- fpicker/source/unx/gnome/SalGtkFilePicker.cxx | 83 ++++++++++++++++--------- fpicker/source/unx/gnome/SalGtkFolderPicker.cxx | 16 +++-- fpicker/source/unx/gnome/SalGtkPicker.cxx | 23 +++++-- fpicker/source/unx/gnome/SalGtkPicker.hxx | 7 +++ fpicker/source/unx/gnome/resourceprovider.cxx | 2 - 5 files changed, 87 insertions(+), 44 deletions(-) diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx index 4fe6f6f11b20..c6b0acd6a33f 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx @@ -96,6 +96,8 @@ namespace static void expandexpanders(GtkContainer *pWidget) { + GdkThreadLock aLock; + GList *pChildren = gtk_container_get_children(pWidget); for( GList *p = pChildren; p; p = p->next ) { @@ -114,6 +116,8 @@ void SalGtkFilePicker::dialog_mapped_cb(GtkWidget *, SalGtkFilePicker *pobjFP) void SalGtkFilePicker::InitialMapping() { + GdkThreadLock aLock; + if (!mbPreviewState ) { gtk_widget_hide( m_pPreview ); @@ -208,6 +212,8 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference& xListener ) throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); m_xListener = xListener; } void SAL_CALL SalGtkFilePicker::removeFilePickerListener( const uno::Reference& ) throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); m_xListener.clear(); } @@ -591,6 +595,8 @@ shrinkFilterName( const rtl::OUString &rFilterName, bool bAllowNoStar = false ) static void dialog_remove_buttons( GtkDialog *pDialog ) { + GdkThreadLock aLock; + g_return_if_fail( GTK_IS_DIALOG( pDialog ) ); GList *pChildren = @@ -700,7 +706,6 @@ void SAL_CALL SalGtkFilePicker::appendFilter( const rtl::OUString& aTitle, const throw( lang::IllegalArgumentException, uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); if( FilterNameExists( aTitle ) ) throw IllegalArgumentException(); @@ -721,7 +726,6 @@ void SAL_CALL SalGtkFilePicker::setCurrentFilter( const rtl::OUString& aTitle ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); OSL_TRACE( "Setting current filter to %s\n", OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -763,6 +767,9 @@ void SalGtkFilePicker::UpdateFilterfromUI() // from the filter of the files glob on which he is currently searching if (!mnHID_FolderChange || !mnHID_SelectionChange) return; + + GdkThreadLock aLock; + GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView)); GtkTreeIter iter; GtkTreeModel *model; @@ -782,7 +789,6 @@ void SalGtkFilePicker::UpdateFilterfromUI() rtl::OUString SAL_CALL SalGtkFilePicker::getCurrentFilter() throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); OSL_TRACE( "GetCURRENTfilter\n" ); @@ -802,7 +808,6 @@ void SAL_CALL SalGtkFilePicker::appendFilterGroup( const rtl::OUString& /*sGroup throw( lang::IllegalArgumentException, uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); // TODO m_pImpl->appendFilterGroup( sGroupTitle, aFilters ); // check the names @@ -832,7 +837,8 @@ void SAL_CALL SalGtkFilePicker::appendFilterGroup( const rtl::OUString& /*sGroup void SAL_CALL SalGtkFilePicker::setMultiSelectionMode( sal_Bool bMode ) throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + GdkThreadLock aLock; gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER(m_pDialog), bMode ); } @@ -841,7 +847,8 @@ void SAL_CALL SalGtkFilePicker::setDefaultName( const rtl::OUString& aName ) throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + GdkThreadLock aLock; OString aStr = OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ); GtkFileChooserAction eAction = gtk_file_chooser_get_action( GTK_FILE_CHOOSER( m_pDialog ) ); @@ -877,7 +884,8 @@ uno::Sequence SAL_CALL SalGtkFilePicker::getFiles() throw( uno::R uno::Sequence SAL_CALL SalGtkFilePicker::getSelectedFiles() throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + GdkThreadLock aLock; GSList* pPathList = gtk_file_chooser_get_uris( GTK_FILE_CHOOSER(m_pDialog) ); @@ -1014,7 +1022,8 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) { OSL_TRACE( "1: HERE WE ARE\n"); OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + GdkThreadLock aLock; sal_Int16 retVal = 0; @@ -1171,6 +1180,8 @@ namespace { void HackWidthToFirst(GtkComboBox *pWidget) { + GdkThreadLock aLock; + GtkRequisition requisition; gtk_widget_size_request(GTK_WIDGET(pWidget), &requisition); gtk_widget_set_size_request(GTK_WIDGET(pWidget), requisition.width, -1); @@ -1179,6 +1190,8 @@ namespace void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction, const uno::Any& rValue) { + GdkThreadLock aLock; + switch (nControlAction) { case ControlActions::ADD_ITEM: @@ -1253,6 +1266,8 @@ void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nContr uno::Any SalGtkFilePicker::HandleGetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction) const { + GdkThreadLock aLock; + uno::Any aAny; switch (nControlAction) { @@ -1312,15 +1327,15 @@ void SAL_CALL SalGtkFilePicker::setValue( sal_Int16 nControlId, sal_Int16 nContr throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); OSL_TRACE( "SETTING VALUE %d\n", nControlAction ); GType tType; GtkWidget *pWidget; + GdkThreadLock aLock; + if( !( pWidget = getWidget( nControlId, &tType ) ) ) OSL_TRACE("enable unknown control %d\n", nControlId); - else if( tType == GTK_TYPE_TOGGLE_BUTTON ) { sal_Bool bChecked = false; @@ -1340,15 +1355,16 @@ uno::Any SAL_CALL SalGtkFilePicker::getValue( sal_Int16 nControlId, sal_Int16 nC throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + uno::Any aRetval; GType tType; GtkWidget *pWidget; + GdkThreadLock aLock; + if( !( pWidget = getWidget( nControlId, &tType ) ) ) OSL_TRACE("enable unknown control %d\n", nControlId); - else if( tType == GTK_TYPE_TOGGLE_BUTTON ) aRetval <<= (sal_Bool) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( pWidget ) ); else if( tType == GTK_TYPE_COMBO_BOX ) @@ -1364,13 +1380,13 @@ void SAL_CALL SalGtkFilePicker::enableControl( sal_Int16 nControlId, sal_Bool bE throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); GtkWidget *pWidget; + GdkThreadLock aLock; + if ( nControlId == ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR ) gtk_expander_set_expanded( GTK_EXPANDER( m_pFilterExpander ), bEnable ); - else if( ( pWidget = getWidget( nControlId ) ) ) { if( bEnable ) @@ -1392,11 +1408,12 @@ void SAL_CALL SalGtkFilePicker::setLabel( sal_Int16 nControlId, const ::rtl::OUS throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); GType tType; GtkWidget *pWidget; + GdkThreadLock aLock; + if( !( pWidget = getWidget( nControlId, &tType ) ) ) { OSL_TRACE("Set label on unknown control %d\n", nControlId); @@ -1428,18 +1445,17 @@ rtl::OUString SAL_CALL SalGtkFilePicker::getLabel( sal_Int16 nControlId ) throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); GType tType; OString aTxt; GtkWidget *pWidget; + GdkThreadLock aLock; + if( !( pWidget = getWidget( nControlId, &tType ) ) ) OSL_TRACE("Get label on unknown control %d\n", nControlId); - else if( tType == GTK_TYPE_TOGGLE_BUTTON || tType == GTK_TYPE_BUTTON || tType == GTK_TYPE_LABEL ) aTxt = gtk_button_get_label( GTK_BUTTON( pWidget ) ); - else OSL_TRACE("Can't get label on list\n"); @@ -1453,7 +1469,6 @@ rtl::OUString SAL_CALL SalGtkFilePicker::getLabel( sal_Int16 nControlId ) uno::Sequence SAL_CALL SalGtkFilePicker::getSupportedImageFormats() throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); // TODO return m_pImpl->getSupportedImageFormats(); return 0; @@ -1462,7 +1477,6 @@ uno::Sequence SAL_CALL SalGtkFilePicker::getSupportedImageFormats() t sal_Int32 SAL_CALL SalGtkFilePicker::getTargetColorDepth() throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); // TODO return m_pImpl->getTargetColorDepth(); return 0; @@ -1471,18 +1485,14 @@ sal_Int32 SAL_CALL SalGtkFilePicker::getTargetColorDepth() throw( uno::RuntimeEx sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableWidth() throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - // TODO return m_pImpl->getAvailableWidth(); return m_PreviewImageWidth; } sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableHeight() throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - // TODO return m_pImpl->getAvailableHeight(); return m_PreviewImageHeight; } @@ -1490,7 +1500,6 @@ void SAL_CALL SalGtkFilePicker::setImage( sal_Int16 /*aImageFormat*/, const uno: throw( lang::IllegalArgumentException, uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); // TODO m_pImpl->setImage( aImageFormat, aImage ); } @@ -1499,6 +1508,9 @@ void SalGtkFilePicker::implChangeType( GtkTreeSelection *selection ) { CResourceProvider aResProvider; OUString aLabel = aResProvider.getResString( FILE_PICKER_FILE_TYPE ); + + GdkThreadLock aLock; + GtkTreeIter iter; GtkTreeModel *model; if (gtk_tree_selection_get_selected (selection, &model, &iter)) @@ -1523,6 +1535,8 @@ void SalGtkFilePicker::type_changed_cb( GtkTreeSelection *selection, SalGtkFileP void SalGtkFilePicker::unselect_type() { + GdkThreadLock aLock; + gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView))); } @@ -1589,11 +1603,12 @@ void SalGtkFilePicker::update_preview_cb( GtkFileChooser *file_chooser, SalGtkFi sal_Bool SAL_CALL SalGtkFilePicker::setShowState( sal_Bool bShowState ) throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); // TODO return m_pImpl->setShowState( bShowState ); if( bShowState != mbPreviewState ) { + GdkThreadLock aLock; + if( bShowState ) { // Show @@ -1622,9 +1637,7 @@ sal_Bool SAL_CALL SalGtkFilePicker::setShowState( sal_Bool bShowState ) throw( u sal_Bool SAL_CALL SalGtkFilePicker::getShowState() throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - // TODO return m_pImpl->getShowState(); return mbPreviewState; } @@ -1740,6 +1753,8 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence& aArgu 1 ); } + GdkThreadLock aLock; + if( GTK_FILE_CHOOSER_ACTION_SAVE == eAction ) { CResourceProvider aResProvider; @@ -1801,7 +1816,6 @@ void SalGtkFilePicker::preview_toggled_cb( GtkObject *cb, SalGtkFilePicker* pobj void SAL_CALL SalGtkFilePicker::cancel() throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); // TODO m_pImpl->cancel(); } @@ -1848,6 +1862,8 @@ uno::Sequence SAL_CALL SalGtkFilePicker::getSupportedServiceNames //------------------------------------------------- void SalGtkFilePicker::SetCurFilter( const OUString& rFilter ) { + GdkThreadLock aLock; + // Get all the filters already added GSList *filters = gtk_file_chooser_list_filters ( GTK_FILE_CHOOSER( m_pDialog ) ); bool bFound = false; @@ -1903,6 +1919,8 @@ case_insensitive_filter (const GtkFileFilterInfo *filter_info, gpointer data) int SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rType ) { + GdkThreadLock aLock; + GtkFileFilter *filter = gtk_file_filter_new(); OUString aShrunkName = shrinkFilterName( rFilter ); @@ -1981,6 +1999,9 @@ int SalGtkFilePicker::implAddFilterGroup( const OUString& /*_rFilter*/, const Se void SalGtkFilePicker::SetFilters() { OSL_TRACE( "start setting filters\n"); + + GdkThreadLock aLock; + int nAdded = 0; if( m_pFilterList && !m_pFilterList->empty() ) { diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx index 6b843d8b79f4..f9c78d76639c 100644 --- a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx @@ -87,6 +87,9 @@ SalGtkFolderPicker::SalGtkFolderPicker( const uno::Referencecancel(); } diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx index 2d2e086ba2ca..8bd28bb22d29 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx @@ -148,6 +148,8 @@ RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit } } + GdkThreadLock aLock; + GdkDisplay *pDisplay = aWindowHandle.DisplayPointer ? gdk_x11_lookup_xdisplay(reinterpret_cast(static_cast(aWindowHandle.DisplayPointer))) : NULL; GdkWindow* pParent = pDisplay ? gdk_window_lookup_for_display(pDisplay, aWindowHandle.WindowHandle) : NULL; if (!pParent && pDisplay) @@ -163,17 +165,22 @@ RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit RunDialog::~RunDialog() { if (mpCreatedParent) + { + GdkThreadLock aLock; gdk_window_destroy (mpCreatedParent); + } } void SAL_CALL RunDialog::windowOpened( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) { - g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); + GdkThreadLock aLock; + gdk_threads_add_timeout_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); } void RunDialog::cancel() { + GdkThreadLock aLock; gtk_dialog_response( GTK_DIALOG( mpDialog ), GTK_RESPONSE_CANCEL ); gtk_widget_hide( mpDialog ); } @@ -183,6 +190,7 @@ gint RunDialog::run() if (mxToolkit.is()) mxToolkit->addTopWindowListener(this); + GdkThreadLock aLock; gint nStatus = gtk_dialog_run( GTK_DIALOG( mpDialog ) ); if (mxToolkit.is()) @@ -197,14 +205,16 @@ gint RunDialog::run() SalGtkPicker::~SalGtkPicker() { if (m_pDialog) + { + GdkThreadLock aLock; gtk_widget_destroy(m_pDialog); + } } void SAL_CALL SalGtkPicker::implsetDisplayDirectory( const rtl::OUString& aDirectory ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); OString aTxt = unicodetouri(aDirectory); @@ -213,14 +223,16 @@ void SAL_CALL SalGtkPicker::implsetDisplayDirectory( const rtl::OUString& aDirec OSL_TRACE( "setting path to %s\n", aTxt.getStr() ); + GdkThreadLock aLock; gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ), - aTxt.getStr() ); + aTxt.getStr() ); } rtl::OUString SAL_CALL SalGtkPicker::implgetDisplayDirectory() throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + GdkThreadLock aLock; gchar* pCurrentFolder = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ) ); @@ -233,8 +245,9 @@ rtl::OUString SAL_CALL SalGtkPicker::implgetDisplayDirectory() throw( uno::Runti void SAL_CALL SalGtkPicker::implsetTitle( const rtl::OUString& aTitle ) throw( uno::RuntimeException ) { OSL_ASSERT( m_pDialog != NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); ::rtl::OString aWindowTitle = OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ); + + GdkThreadLock aLock; gtk_window_set_title( GTK_WINDOW( m_pDialog ), aWindowTitle.getStr() ); } diff --git a/fpicker/source/unx/gnome/SalGtkPicker.hxx b/fpicker/source/unx/gnome/SalGtkPicker.hxx index 5baa5bdb56e8..6349d3ed4988 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.hxx @@ -71,6 +71,13 @@ class SalGtkPicker static rtl::OString unicodetouri(const rtl::OUString &rURL); }; +class GdkThreadLock +{ +public: + GdkThreadLock() { gdk_threads_enter(); } + ~GdkThreadLock() { gdk_threads_leave(); } +}; + //Run the Gtk Dialog. Watch for any "new windows" created while we're //executing and consider that a CANCEL event to avoid e.g. "file cannot be opened" //modal dialogs and this one getting locked if some other API call causes this diff --git a/fpicker/source/unx/gnome/resourceprovider.cxx b/fpicker/source/unx/gnome/resourceprovider.cxx index 393ea7585d5a..8df810060ee5 100644 --- a/fpicker/source/unx/gnome/resourceprovider.cxx +++ b/fpicker/source/unx/gnome/resourceprovider.cxx @@ -168,8 +168,6 @@ public: String aResString; OUString aResOUString; - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); - try { OSL_ASSERT( m_ResMgr && m_OtherResMgr ); -- cgit From 5456f4e6acb5b5a3528cdf18d2e230684ffe3eb9 Mon Sep 17 00:00:00 2001 From: va Date: Mon, 14 Jun 2010 17:59:06 +0200 Subject: #i112366# Replaced sun.dic with oracle.dic --- officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs b/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs index 220d94c89da6..79a509de06f8 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs @@ -227,7 +227,7 @@ Specifies the custom dictionaries to be used. The Ignore list (IgnoreAllList (All)) is administered in the RAM only for the current spellcheck. - IgnoreAllList;soffice.dic;standard.dic;sun.dic + IgnoreAllList;soffice.dic;standard.dic;oracle.dic -- cgit From c44ba0727fecc1a1a70f525e72b0854527ab3e22 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 14 Jun 2010 20:07:33 +0200 Subject: tl78: #i111065# let the model be correctly loaded into a frame --- sfx2/source/view/viewfrm.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 47f0926d00b6..08c4980881f7 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2113,9 +2113,7 @@ SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc else aTransformLoadArgs.remove( "Hidden" ); - ::rtl::OUString sURL( xDocument->getURL() ); - if ( !sURL.getLength() ) - sURL = i_rDoc.GetFactory().GetFactoryURL(); + ::rtl::OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "private:object" ) ); Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW ); xLoader->loadComponentFromURL( sURL, ::rtl::OUString::createFromAscii( "_self" ), 0, -- cgit From 9d31e5d3ca564c719f94810fd93825131a14699c Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 15 Jun 2010 13:02:12 +0200 Subject: cws tl79: #i110254# security tab hid added to hidother.src --- sfx2/util/hidother.src | 1 + 1 file changed, 1 insertion(+) diff --git a/sfx2/util/hidother.src b/sfx2/util/hidother.src index 72b178b2d629..3ef31046bb00 100644 --- a/sfx2/util/hidother.src +++ b/sfx2/util/hidother.src @@ -165,3 +165,4 @@ hidspecial HID_DID_SAVE_PACKED_XML { HelpID = HID_DID_SAVE_PACKED_X hidspecial HID_HELP_ONHELP { HelpID = HID_HELP_ONHELP; }; hidspecial HID_HELP_TEXT_SELECTION_MODE { HelpID = HID_HELP_TEXT_SELECTION_MODE; }; hidspecial HID_DLG_CHECKFORONLINEUPDATE { HelpID = HID_DLG_CHECKFORONLINEUPDATE; }; +hidspecial HID_DOCINFOSECURITY { HelpID = HID_DOCINFOSECURITY; }; -- cgit From e447c6b6ea98f01ee8f048134e700d05cf265392 Mon Sep 17 00:00:00 2001 From: tono Date: Tue, 15 Jun 2010 22:35:25 +0900 Subject: i#111956: MinGW port fix: dependency to shared library: pure porting fix --- desktop/source/pkgchk/unopkg/makefile.mk | 4 ++-- framework/util/makefile.mk | 8 ++++---- svx/util/makefile.mk | 2 +- vbahelper/util/makefile.mk | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/desktop/source/pkgchk/unopkg/makefile.mk b/desktop/source/pkgchk/unopkg/makefile.mk index 729548cbadd1..0cefee98634e 100644 --- a/desktop/source/pkgchk/unopkg/makefile.mk +++ b/desktop/source/pkgchk/unopkg/makefile.mk @@ -49,7 +49,7 @@ CFLAGS+=-DSYSTEM_DB -I$(DB_INCLUDES) APP1TARGET = so$/unopkg APP1OBJS = $(OBJFILES) APP1STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") APP1DEPN = $(SHL1TARGETN) .ELSE APP1DEPN = $(SHL1IMPLIBN) @@ -65,7 +65,7 @@ APP1LINKRES = $(MISC)$/$(TARGET)1.res APP2TARGET = unopkg APP2OBJS = $(OBJFILES) APP2STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") APP2DEPN = $(SHL1TARGETN) .ELSE APP2DEPN = $(SHL1IMPLIBN) diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index 08218b6267b3..ab0513fccece 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -158,7 +158,7 @@ SHL2STDLIBS= \ $(SALLIB) SHL2DEF= $(MISC)$/$(SHL2TARGET).def -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") SHL2DEPN= $(SHL1TARGETN) .ELSE SHL2DEPN= $(SHL1IMPLIBN) @@ -218,7 +218,7 @@ SHL3STDLIBS= \ $(SALLIB) SHL3DEF= $(MISC)$/$(SHL3TARGET).def -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") SHL3DEPN= $(SHL1TARGETN) $(SHL2TARGETN) .ELSE SHL3DEPN= $(SHL1IMPLIBN) $(SHL2IMPLIBN) @@ -363,7 +363,7 @@ SHL4STDLIBS= \ $(I18NISOLANGLIB) SHL4DEF= $(MISC)$/$(SHL4TARGET).def -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") SHL4DEPN= $(SHL1TARGETN) $(SHL2TARGETN) .ELSE SHL4DEPN= $(SHL1IMPLIBN) $(SHL2IMPLIBN) @@ -398,7 +398,7 @@ SHL5STDLIBS= \ $(SALLIB) SHL5DEF= $(MISC)$/$(SHL5TARGET).def -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") SHL5DEPN= $(SHL1TARGETN) .ELSE SHL5DEPN= $(SHL1IMPLIBN) diff --git a/svx/util/makefile.mk b/svx/util/makefile.mk index 5ee482e6ac82..eeb1ee3dbcec 100644 --- a/svx/util/makefile.mk +++ b/svx/util/makefile.mk @@ -104,7 +104,7 @@ DEFLIB1NAME=$(SHL1LIBS:b) SHL2TARGET= svx$(DLLPOSTFIX) SHL2IMPLIB= i$(TARGET) SHL2USE_EXPORTS=name -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") SHL2DEPN=$(SHL1TARGETN) .ELSE SHL2DEPN=$(SHL1IMPLIBN) diff --git a/vbahelper/util/makefile.mk b/vbahelper/util/makefile.mk index 54a17873cf94..5f6bfa4967f9 100644 --- a/vbahelper/util/makefile.mk +++ b/vbahelper/util/makefile.mk @@ -96,7 +96,7 @@ SHL2STDLIBS= \ $(TKLIB) \ $(BASICLIB) \ -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") SHL2DEPN=$(SHL1TARGETN) .ELSE SHL2DEPN=$(SHL1IMPLIBN) -- cgit From 7b4fd03cc280edac58705d047566e30d0b41bae0 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 15 Jun 2010 21:01:57 +0200 Subject: tl78v2: #i112427# Support password to modify in calc and writer ODF documents --- sfx2/inc/sfx2/objsh.hxx | 4 ++++ sfx2/inc/sfx2/sfxsids.hrc | 2 +- sfx2/sdi/sfx.sdi | 29 +---------------------------- sfx2/source/appl/appuno.cxx | 17 +++++++++++++++-- sfx2/source/dialog/filedlghelper.cxx | 25 ++++++++++++++++++------- sfx2/source/doc/objcont.cxx | 36 +++++++++++++++++++++++++++--------- sfx2/source/doc/sfxbasemodel.cxx | 18 +++++++++++++++--- sfx2/source/inc/objshimp.hxx | 2 ++ 8 files changed, 83 insertions(+), 50 deletions(-) diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 95e8f21c8d86..6d2b6611991e 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -439,9 +439,13 @@ public: void SetSaveVersionOnClose( sal_Bool bSet ); void ResetFromTemplate( const String& rTemplateName, const String& rFileName ); + // TODO/LATER: the following two methods should be replaced by Get/SetModifPasswordInfo in future sal_uInt32 GetModifyPasswordHash() const; sal_Bool SetModifyPasswordHash( sal_uInt32 nHash ); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetModifyPasswordInfo() const; + sal_Bool SetModifyPasswordInfo( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo ); + static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc ); virtual void ViewAssigned(); diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 5492c76a7e7e..b7a3ddf8347d 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -306,7 +306,7 @@ #define SID_ACTIVATE_STYLE_APPLY (SID_SFX_START + 1715) #define SID_FONT_NAME (SID_SFX_START + 1716) #define SID_DEFAULTFILENAME (SID_SFX_START + 1717) -#define SID_MODIFYPASSWORDHASH (SID_SFX_START + 1718) +#define SID_MODIFYPASSWORDINFO (SID_SFX_START + 1718) #define SID_RECOMMENDREADONLY (SID_SFX_START + 1719) #define SID_SFX_free_START (SID_SFX_START + 1720) #define SID_SFX_free_END (SID_SFX_START + 3999) diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index a19ea0fb8dfc..241f3900c09b 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3593,33 +3593,6 @@ SfxVoidItem MacroOrganizer SID_MACROORGANIZER GroupId = GID_MACRO; ] -//-------------------------------------------------------------------------- -SfxInt32Item PasswordToModifyHash SID_MODIFYPASSWORDHASH - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = ; -] - //-------------------------------------------------------------------------- SfxBoolItem ReccomendReadonly SID_RECOMMENDREADONLY @@ -5317,7 +5290,7 @@ SfxBoolItem SaveAll SID_SAVEDOCS //-------------------------------------------------------------------------- SfxBoolItem SaveAs SID_SAVEASDOC -(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem Password SID_PASSWORD,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxStringItem VersionAuthor SID_DOCINFO_AUTHOR,SfxBoolItem Overwrite SID_OVERWRITE,SfxBoolItem Unpacked SID_UNPACK,SfxBoolItem SaveTo SID_SAVETO,SfxInt32Item ModifyPasswordHash SID_MODIFYPASSWORDHASH) +(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem Password SID_PASSWORD,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxStringItem VersionAuthor SID_DOCINFO_AUTHOR,SfxBoolItem Overwrite SID_OVERWRITE,SfxBoolItem Unpacked SID_UNPACK,SfxBoolItem SaveTo SID_SAVETO) [ /* flags: */ AutoUpdate = FALSE, diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 66452f10bbfb..6f9d3b258745 100755 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -191,6 +191,7 @@ static char const sFolderName[] = "FolderName"; static char const sUseSystemDialog[] = "UseSystemDialog"; static char const sStandardDir[] = "StandardDir"; static char const sBlackList[] = "BlackList"; +static char const sModifyPasswordInfo[] = "ModifyPasswordInfo"; void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -846,6 +847,10 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) ); } + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModifyPasswordInfo)) ) + { + rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) ); + } #ifdef DBG_UTIL else --nFoundArgs; @@ -1058,6 +1063,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta nAdditional++; if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SFX_ITEM_SET ) nAdditional++; + if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET ) + nAdditional++; // consider additional arguments nProps += nAdditional; @@ -1197,7 +1204,9 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta // used only internally if ( nId == SID_SAVETO ) continue; - } + if ( nId == SID_MODIFYPASSWORDINFO ) + continue; + } ByteString aDbg( "Unknown item detected: "); aDbg += ByteString::CreateFromInt32( nId ); @@ -1555,7 +1564,11 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sNoAutoSave)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } - + if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO, sal_False, &pItem ) == SFX_ITEM_SET ) + { + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModifyPasswordInfo)); + pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); + } } } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 569c0ddb163e..dba0da93208d 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -80,11 +80,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include "openflag.hxx" @@ -1528,8 +1530,8 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, mbPwdCheckBoxState = ( pPassItem != NULL ); // in case the document has password to modify, the dialog should be shown - SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxInt32Item, SID_MODIFYPASSWORDHASH, FALSE ); - mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue() ); + SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUnoAnyItem, SID_MODIFYPASSWORDINFO, FALSE ); + mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue().hasValue() ); } SFX_ITEMSET_ARG( rpSet, pSelectItem, SfxBoolItem, SID_SELECTION, FALSE ); @@ -1541,7 +1543,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // the password will be set in case user decide so rpSet->ClearItem( SID_PASSWORD ); rpSet->ClearItem( SID_RECOMMENDREADONLY ); - rpSet->ClearItem( SID_MODIFYPASSWORDHASH ); + rpSet->ClearItem( SID_MODIFYPASSWORDINFO ); } @@ -1659,10 +1661,19 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if ( pPasswordRequest->getRecommendReadOnly() ) rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); - // the empty password has 0 as Hash - sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) ); - if ( nHash ) - rpSet->Put( SfxInt32Item( SID_MODIFYPASSWORDHASH, nHash ) ); + if ( bMSType ) + { + // the empty password has 0 as Hash + sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) ); + if ( nHash ) + rpSet->Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, uno::makeAny( nHash ) ) ); + } + else + { + uno::Sequence< beans::PropertyValue > aModifyPasswordInfo = ::comphelper::DocPasswordHelper::GenerateNewModifyPasswordInfo( pPasswordRequest->getPasswordToModify() ); + if ( aModifyPasswordInfo.getLength() ) + rpSet->Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, uno::makeAny( aModifyPasswordInfo ) ) ); + } } else return ERRCODE_ABORT; diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 547198f60ace..451e33084c07 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1249,17 +1249,35 @@ sal_uInt32 SfxObjectShell::GetModifyPasswordHash() const sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt32 nHash ) { -// Commented out before the solution for Saving process is found -// if ( ( !IsReadOnly() && !IsReadOnlyUI() ) -// || !(pImp->nFlagsInProgress & SFX_LOADED_MAINDOCUMENT ) ) -// { -// // the hash can be changed only in editable documents, -// // or during loading of document + if ( ( !IsReadOnly() && !IsReadOnlyUI() ) + || !(pImp->nFlagsInProgress & SFX_LOADED_MAINDOCUMENT ) ) + { + // the hash can be changed only in editable documents, + // or during loading of document pImp->m_nModifyPasswordHash = nHash; return sal_True; -// } -// -// return sal_False; + } + + return sal_False; +} + +uno::Sequence< beans::PropertyValue > SfxObjectShell::GetModifyPasswordInfo() const +{ + return pImp->m_aModifyPasswordInfo; +} + +sal_Bool SfxObjectShell::SetModifyPasswordInfo( const uno::Sequence< beans::PropertyValue >& aInfo ) +{ + if ( ( !IsReadOnly() && !IsReadOnlyUI() ) + || !(pImp->nFlagsInProgress & SFX_LOADED_MAINDOCUMENT ) ) + { + // the hash can be changed only in editable documents, + // or during loading of document + pImp->m_aModifyPasswordInfo = aInfo; + return sal_True; + } + + return sal_False; } void SfxObjectShell::SetModifyPasswordEntered( sal_Bool bEntered ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index d3707636d5ea..96f44169bfd0 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2732,11 +2732,21 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL uno::Reference< uno::XInterface >() ); } - SFX_ITEMSET_ARG( aParams, pModifyPasswordHashItem, SfxInt32Item, SID_MODIFYPASSWORDHASH, sal_False ); - sal_uInt32 nModifyPasswordHash = pModifyPasswordHashItem ? pModifyPasswordHashItem->GetValue() : 0; - aParams->ClearItem( SID_MODIFYPASSWORDHASH ); + sal_uInt32 nModifyPasswordHash = 0; + uno::Sequence< beans::PropertyValue > aModifyPasswordInfo; + SFX_ITEMSET_ARG( aParams, pModifyPasswordInfoItem, SfxUnoAnyItem, SID_MODIFYPASSWORDINFO, sal_False ); + if ( pModifyPasswordInfoItem ) + { + // it contains either a simple hash or a set of PropertyValues + // TODO/LATER: the sequence of PropertyValue should replace the hash completely in future + pModifyPasswordInfoItem->GetValue() >>= nModifyPasswordHash; + pModifyPasswordInfoItem->GetValue() >>= aModifyPasswordInfo; + } + aParams->ClearItem( SID_MODIFYPASSWORDINFO ); sal_uInt32 nOldModifyPasswordHash = m_pData->m_pObjectShell->GetModifyPasswordHash(); m_pData->m_pObjectShell->SetModifyPasswordHash( nModifyPasswordHash ); + uno::Sequence< beans::PropertyValue > aOldModifyPasswordInfo = m_pData->m_pObjectShell->GetModifyPasswordInfo(); + m_pData->m_pObjectShell->SetModifyPasswordInfo( aModifyPasswordInfo ); // since saving a document modifies its DocumentInfo, the current // DocumentInfo must be saved on "SaveTo", so it can be restored @@ -2823,6 +2833,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL else { m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash ); + m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo ); SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVETODOCDONE), m_pData->m_pObjectShell ) ); } @@ -2834,6 +2845,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL m_pData->m_pObjectShell->StoreLog(); m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash ); + m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo ); SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOCFAILED : STR_EVENT_SAVEASDOCFAILED), diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index e170a7c27240..b5087fb46294 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -149,7 +149,9 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool m_bIncomplEncrWarnShown; + // TODO/LATER: m_aModifyPasswordInfo should completely replace m_nModifyPasswordHash in future sal_uInt32 m_nModifyPasswordHash; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aModifyPasswordInfo; sal_Bool m_bModifyPasswordEntered; SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); -- cgit From 3d2a51111ac8e45f6eae9d1fd9e52ee8c4cb35d0 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 16 Jun 2010 10:36:38 +0200 Subject: tl78v2: #i112427# Support password to modify in calc and writer ODF documents --- sfx2/source/doc/objmisc.cxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 4 +++- sfx2/source/view/viewfrm.cxx | 22 +++++++++++++++++----- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index afcaa1614f2c..addb648ef2e9 100755 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1389,7 +1389,7 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) if( !IsAbortingImport() ) PositionView_Impl(); - if ( GetModifyPasswordHash() && !IsModifyPasswordEntered() ) + if ( ( GetModifyPasswordHash() || GetModifyPasswordInfo().getLength() ) && !IsModifyPasswordEntered() ) SetReadOnly(); // Salvage diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 96f44169bfd0..b5a9536b12c5 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2739,7 +2739,9 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL { // it contains either a simple hash or a set of PropertyValues // TODO/LATER: the sequence of PropertyValue should replace the hash completely in future - pModifyPasswordInfoItem->GetValue() >>= nModifyPasswordHash; + sal_Int32 nMPHTmp = 0; + pModifyPasswordInfoItem->GetValue() >>= nMPHTmp; + nModifyPasswordHash = (sal_uInt32)nMPHTmp; pModifyPasswordInfoItem->GetValue() >>= aModifyPasswordInfo; } aParams->ClearItem( SID_MODIFYPASSWORDINFO ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 08c4980881f7..1dbd3aed623f 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -83,6 +83,7 @@ #include #include #include +#include #include #include @@ -170,9 +171,10 @@ TYPEINIT1(SfxViewFrameItem, SfxPoolItem); //========================================================================= //------------------------------------------------------------------------- -static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const ::rtl::OUString& aPath, const SfxFilter* pFilter, sal_uInt32 nPasswordHash ) +static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const ::rtl::OUString& aPath, const SfxFilter* pFilter, sal_uInt32 nPasswordHash, const uno::Sequence< beans::PropertyValue > aInfo ) { - sal_Bool bResult = !nPasswordHash; + // TODO/LATER: In future the info should replace the direct hash completely + sal_Bool bResult = ( !nPasswordHash && !aInfo.getLength() ); OSL_ENSURE( pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ), "PasswordToModify feature is active for a filter that does not support it!" ); @@ -196,7 +198,17 @@ static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteracti xHandler->handle( rRequest ); if ( pPasswordRequest->isPassword() ) - bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pFilter->GetServiceName() ) ) == nPasswordHash ); + { + if ( aInfo.getLength() ) + { + bResult = ::comphelper::DocPasswordHelper::IsModifyPasswordCorrect( pPasswordRequest->getPasswordToModify(), aInfo ); + } + else + { + // the binary format + bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pFilter->GetServiceName() ) ) == nPasswordHash ); + } + } else bCancel = sal_True; @@ -399,11 +411,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) else { if ( pSh->IsReadOnlyMedium() - && pSh->GetModifyPasswordHash() + && ( pSh->GetModifyPasswordHash() || pSh->GetModifyPasswordInfo().getLength() ) && !pSh->IsModifyPasswordEntered() ) { ::rtl::OUString aDocumentName = INetURLObject( pMed->GetOrigURL() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); - if( !AskPasswordToModify_Impl( pMed->GetInteractionHandler(), aDocumentName, pMed->GetOrigFilter(), pSh->GetModifyPasswordHash() ) ) + if( !AskPasswordToModify_Impl( pMed->GetInteractionHandler(), aDocumentName, pMed->GetOrigFilter(), pSh->GetModifyPasswordHash(), pSh->GetModifyPasswordInfo() ) ) { // this is a read-only document, if it has "Password to modify" // the user should enter password before he can edit the document -- cgit From 22dedfaadf4a53093a9ccbccbf3a70f78b1dbb06 Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Wed, 16 Jun 2010 14:23:17 +0200 Subject: jl152#i112437# Disabled extensions should not show an options button --- desktop/source/deployment/gui/dp_gui_dialog2.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 4ba747198c09..d57fbdb9f4ed 100755 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -281,6 +281,8 @@ void ExtBoxWithBtns_Impl::SetButtonPos( const Rectangle& rRect ) // ----------------------------------------------------------------------- void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry ) { + bool bShowOptionBtn = true; + pEntry->m_bHasButtons = false; if ( ( pEntry->m_eState == REGISTERED ) || ( pEntry->m_eState == NOT_AVAILABLE ) ) { @@ -291,6 +293,7 @@ void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry ) { m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) ); m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_ENABLE ); + bShowOptionBtn = false; } if ( ( !pEntry->m_bUser || ( pEntry->m_eState == NOT_AVAILABLE ) || pEntry->m_bMissingDeps ) @@ -303,7 +306,7 @@ void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry ) pEntry->m_bHasButtons = true; } - if ( pEntry->m_bHasOptions ) + if ( pEntry->m_bHasOptions && bShowOptionBtn ) { m_pOptionsBtn->Enable( pEntry->m_bHasOptions ); m_pOptionsBtn->Show(); -- cgit From a70f8ac0962410f6c2b5b0775bc1b410452dadad Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 16 Jun 2010 14:30:12 +0200 Subject: jpropenable: #i112445# exclude this file from l10n process --- connectivity/qa/drivers/dbase/test.properties | 1 + officecfg/registry/schema/oo-ldap-attr-map.properties | 1 + officecfg/registry/schema/oo-org-map.properties | 1 + .../org/openoffice/netbeans/modules/office/filesystem/Bundle.properties | 1 + .../java/org/openoffice/netbeans/modules/office/loader/Bundle.properties | 1 + .../org/openoffice/netbeans/modules/office/options/Bundle.properties | 1 + .../org/openoffice/netbeans/modules/office/resources/Bundle.properties | 1 + .../java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties | 1 + 8 files changed, 8 insertions(+) diff --git a/connectivity/qa/drivers/dbase/test.properties b/connectivity/qa/drivers/dbase/test.properties index 6f301f972d40..c26879f480f3 100644 --- a/connectivity/qa/drivers/dbase/test.properties +++ b/connectivity/qa/drivers/dbase/test.properties @@ -1,3 +1,4 @@ +# x-no-translate Driver=org.openoffice.comp.drivers.MySQL.Driver user=testuser password= diff --git a/officecfg/registry/schema/oo-ldap-attr-map.properties b/officecfg/registry/schema/oo-ldap-attr-map.properties index c67cd5262fd4..684dfbdebfa3 100644 --- a/officecfg/registry/schema/oo-ldap-attr-map.properties +++ b/officecfg/registry/schema/oo-ldap-attr-map.properties @@ -1,4 +1,5 @@ # inetOrgPerson.givenName +# x-no-translate org.openoffice.UserProfile/Data/givenname = givenname # person.sn diff --git a/officecfg/registry/schema/oo-org-map.properties b/officecfg/registry/schema/oo-org-map.properties index 1f4b4377677c..dc87a4346ce9 100644 --- a/officecfg/registry/schema/oo-org-map.properties +++ b/officecfg/registry/schema/oo-org-map.properties @@ -1,5 +1,6 @@ # attribute and objectclass identifying a user # multi values are supported, separated by comma +# x-no-translate User/ObjectClass=inetorgperson User/NamingAttribute=uid User/Container=ou=People diff --git a/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties index 3137b89dde94..f776ff9e7933 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties +++ b/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties @@ -1,5 +1,6 @@ # Filesystems API # {0} - root path +# x-no-translate LAB_invalid_file_system=invalid OpenOffice.org document {0} # {0} - root path LAB_valid_file_system={0} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties index a3bf47447607..eab2fa1f3fbc 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties +++ b/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties @@ -3,6 +3,7 @@ #HINT_myProp= #LBL_DataNode_exec_sheet=Execution #HINT_DataNode_exec_sheet=Properties pertaining to compiling, running, and debugging. +# x-no-translate LBL_loaderName= # Datasystems API #PROP_myProp= diff --git a/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties index b823204cb227..6a9112e8c768 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties +++ b/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties @@ -1,4 +1,5 @@ # Options API +# x-no-translate LBL_settings=Office Settings PROP_OfficeDirectory=Path to Office installation HINT_OfficeDirectory=Path to the Office installation diff --git a/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties index 58989c2506b7..22aea6525f3d 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties +++ b/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties @@ -1,3 +1,4 @@ +# x-no-translate Templates/OfficeScripting=Office Scripting Templates/OfficeScripting/parcel.xml=Script Parcel Descriptor Services/MIMEResolver/org-netbeans-modules-office-mime-resolver.xml=Script Parcel Descriptor File diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties index 0e4f2bd100c7..a40b4b373959 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties +++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties @@ -1,4 +1,5 @@ # Window System API +# x-no-translate # TopComponent LBL_component_name= -- cgit From a03b1ebebf434ff1fe71cd83b8ac31a7b699296b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 18 Jun 2010 08:50:11 +0100 Subject: gtkfpicker9: #i112386# gdk_threads_add_timeout_full unavailable on older glibs --- fpicker/source/unx/gnome/SalGtkPicker.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx index 8bd28bb22d29..1a685e0981e6 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx @@ -175,7 +175,7 @@ void SAL_CALL RunDialog::windowOpened( const ::com::sun::star::lang::EventObject throw (::com::sun::star::uno::RuntimeException) { GdkThreadLock aLock; - gdk_threads_add_timeout_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); + g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); } void RunDialog::cancel() -- cgit From da6b240a3fdc74b2811c229a7f8eff8307c6c256 Mon Sep 17 00:00:00 2001 From: tono Date: Fri, 18 Jun 2010 22:43:04 +0900 Subject: Backed out changeset: d80a58fd55d9 --- desktop/source/pkgchk/unopkg/makefile.mk | 4 ++-- framework/util/makefile.mk | 8 ++++---- svx/util/makefile.mk | 2 +- vbahelper/util/makefile.mk | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/desktop/source/pkgchk/unopkg/makefile.mk b/desktop/source/pkgchk/unopkg/makefile.mk index 0cefee98634e..729548cbadd1 100644 --- a/desktop/source/pkgchk/unopkg/makefile.mk +++ b/desktop/source/pkgchk/unopkg/makefile.mk @@ -49,7 +49,7 @@ CFLAGS+=-DSYSTEM_DB -I$(DB_INCLUDES) APP1TARGET = so$/unopkg APP1OBJS = $(OBJFILES) APP1STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" APP1DEPN = $(SHL1TARGETN) .ELSE APP1DEPN = $(SHL1IMPLIBN) @@ -65,7 +65,7 @@ APP1LINKRES = $(MISC)$/$(TARGET)1.res APP2TARGET = unopkg APP2OBJS = $(OBJFILES) APP2STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" APP2DEPN = $(SHL1TARGETN) .ELSE APP2DEPN = $(SHL1IMPLIBN) diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index ab0513fccece..08218b6267b3 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -158,7 +158,7 @@ SHL2STDLIBS= \ $(SALLIB) SHL2DEF= $(MISC)$/$(SHL2TARGET).def -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL2DEPN= $(SHL1TARGETN) .ELSE SHL2DEPN= $(SHL1IMPLIBN) @@ -218,7 +218,7 @@ SHL3STDLIBS= \ $(SALLIB) SHL3DEF= $(MISC)$/$(SHL3TARGET).def -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL3DEPN= $(SHL1TARGETN) $(SHL2TARGETN) .ELSE SHL3DEPN= $(SHL1IMPLIBN) $(SHL2IMPLIBN) @@ -363,7 +363,7 @@ SHL4STDLIBS= \ $(I18NISOLANGLIB) SHL4DEF= $(MISC)$/$(SHL4TARGET).def -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL4DEPN= $(SHL1TARGETN) $(SHL2TARGETN) .ELSE SHL4DEPN= $(SHL1IMPLIBN) $(SHL2IMPLIBN) @@ -398,7 +398,7 @@ SHL5STDLIBS= \ $(SALLIB) SHL5DEF= $(MISC)$/$(SHL5TARGET).def -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL5DEPN= $(SHL1TARGETN) .ELSE SHL5DEPN= $(SHL1IMPLIBN) diff --git a/svx/util/makefile.mk b/svx/util/makefile.mk index eeb1ee3dbcec..5ee482e6ac82 100644 --- a/svx/util/makefile.mk +++ b/svx/util/makefile.mk @@ -104,7 +104,7 @@ DEFLIB1NAME=$(SHL1LIBS:b) SHL2TARGET= svx$(DLLPOSTFIX) SHL2IMPLIB= i$(TARGET) SHL2USE_EXPORTS=name -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL2DEPN=$(SHL1TARGETN) .ELSE SHL2DEPN=$(SHL1IMPLIBN) diff --git a/vbahelper/util/makefile.mk b/vbahelper/util/makefile.mk index 5f6bfa4967f9..54a17873cf94 100644 --- a/vbahelper/util/makefile.mk +++ b/vbahelper/util/makefile.mk @@ -96,7 +96,7 @@ SHL2STDLIBS= \ $(TKLIB) \ $(BASICLIB) \ -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL2DEPN=$(SHL1TARGETN) .ELSE SHL2DEPN=$(SHL1IMPLIBN) -- cgit From 6517b485af245f10d821c6823204bb67b66f5ef9 Mon Sep 17 00:00:00 2001 From: tono Date: Fri, 18 Jun 2010 22:49:15 +0900 Subject: Backed out changeset: f63af3433bcb --- desktop/source/pkgchk/unopkg/makefile.mk | 8 -------- framework/util/makefile.mk | 24 ++++-------------------- svx/util/makefile.mk | 4 ---- vbahelper/util/makefile.mk | 4 ---- 4 files changed, 4 insertions(+), 36 deletions(-) diff --git a/desktop/source/pkgchk/unopkg/makefile.mk b/desktop/source/pkgchk/unopkg/makefile.mk index 729548cbadd1..8384f1b24372 100644 --- a/desktop/source/pkgchk/unopkg/makefile.mk +++ b/desktop/source/pkgchk/unopkg/makefile.mk @@ -49,11 +49,7 @@ CFLAGS+=-DSYSTEM_DB -I$(DB_INCLUDES) APP1TARGET = so$/unopkg APP1OBJS = $(OBJFILES) APP1STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" APP1DEPN = $(SHL1TARGETN) -.ELSE -APP1DEPN = $(SHL1IMPLIBN) -.ENDIF APP1NOSAL = TRUE APP1RPATH = BRAND .IF "$(OS)" == "WNT" @@ -65,11 +61,7 @@ APP1LINKRES = $(MISC)$/$(TARGET)1.res APP2TARGET = unopkg APP2OBJS = $(OBJFILES) APP2STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" APP2DEPN = $(SHL1TARGETN) -.ELSE -APP2DEPN = $(SHL1IMPLIBN) -.ENDIF APP2NOSAL = TRUE APP2RPATH = BRAND .IF "$(OS)" == "WNT" diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index 08218b6267b3..b1b7c691d29f 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -158,11 +158,7 @@ SHL2STDLIBS= \ $(SALLIB) SHL2DEF= $(MISC)$/$(SHL2TARGET).def -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" -SHL2DEPN= $(SHL1TARGETN) -.ELSE -SHL2DEPN= $(SHL1IMPLIBN) -.ENDIF +SHL2DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) DEF2NAME= $(SHL2TARGET) @@ -218,11 +214,7 @@ SHL3STDLIBS= \ $(SALLIB) SHL3DEF= $(MISC)$/$(SHL3TARGET).def -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" -SHL3DEPN= $(SHL1TARGETN) $(SHL2TARGETN) -.ELSE -SHL3DEPN= $(SHL1IMPLIBN) $(SHL2IMPLIBN) -.ENDIF +SHL3DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) $(SHL2TARGETN) DEF3NAME= $(SHL3TARGET) @@ -363,11 +355,7 @@ SHL4STDLIBS= \ $(I18NISOLANGLIB) SHL4DEF= $(MISC)$/$(SHL4TARGET).def -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" -SHL4DEPN= $(SHL1TARGETN) $(SHL2TARGETN) -.ELSE -SHL4DEPN= $(SHL1IMPLIBN) $(SHL2IMPLIBN) -.ENDIF +SHL4DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) $(SHL2IMPLIBN) $(SHL2TARGETN) DEF4NAME= $(SHL4TARGET) @@ -398,11 +386,7 @@ SHL5STDLIBS= \ $(SALLIB) SHL5DEF= $(MISC)$/$(SHL5TARGET).def -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" -SHL5DEPN= $(SHL1TARGETN) -.ELSE -SHL5DEPN= $(SHL1IMPLIBN) -.ENDIF +SHL5DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) DEF5NAME= $(SHL5TARGET) diff --git a/svx/util/makefile.mk b/svx/util/makefile.mk index 5ee482e6ac82..0006fa2ff5fe 100644 --- a/svx/util/makefile.mk +++ b/svx/util/makefile.mk @@ -104,11 +104,7 @@ DEFLIB1NAME=$(SHL1LIBS:b) SHL2TARGET= svx$(DLLPOSTFIX) SHL2IMPLIB= i$(TARGET) SHL2USE_EXPORTS=name -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL2DEPN=$(SHL1TARGETN) -.ELSE -SHL2DEPN=$(SHL1IMPLIBN) -.ENDIF SHL2LIBS= \ $(SLB)$/svdraw.lib \ diff --git a/vbahelper/util/makefile.mk b/vbahelper/util/makefile.mk index 54a17873cf94..dda4be0cbc81 100644 --- a/vbahelper/util/makefile.mk +++ b/vbahelper/util/makefile.mk @@ -96,11 +96,7 @@ SHL2STDLIBS= \ $(TKLIB) \ $(BASICLIB) \ -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL2DEPN=$(SHL1TARGETN) -.ELSE -SHL2DEPN=$(SHL1IMPLIBN) -.ENDIF SHL2LIBS=$(SLB)$/$(TARGET_MSFORMS).lib # --- Targets ----------------------------------------------------------- -- cgit From a2e7c2e0d002d75a6b77a629a4e904ab54bf8375 Mon Sep 17 00:00:00 2001 From: obo Date: Thu, 24 Jun 2010 10:44:42 +0200 Subject: #i10000# add bIsPasswordToModify --- uui/source/iahndl-authentication.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index 91aa3fed73a6..73fa61f31ff4 100755 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -742,7 +742,8 @@ UUIInteractionHelper::handlePasswordRequest( aPasswordRequest.Mode, rRequest->getContinuations(), rtl::OUString(), - false /* bool bMSCryptoMode */); + false /* bool bMSCryptoMode */, + false /* bool bIsPasswordToModify */); return true; } -- cgit