diff options
author | Jan Holesovsky <kendy@suse.cz> | 2010-10-06 13:36:08 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2010-10-06 13:36:08 +0200 |
commit | 1d2139a8d204a9665042ab0ea8eb76028577d4f9 (patch) | |
tree | 4820368b2a827789d416996d78ee4ef567d8bb71 /desktop/source/deployment | |
parent | a5555aac17439f9f1da6006166ecfcc80628900b (diff) | |
parent | 4ad5d2ff2763a17d0ab7eebe735add9dcf12aa46 (diff) |
Merge commit 'ooo/OOO330_m9'
Diffstat (limited to 'desktop/source/deployment')
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_dialog2.cxx | 32 | ||||
-rw-r--r-- | desktop/source/deployment/misc/dp_update.cxx | 84 | ||||
-rw-r--r-- | desktop/source/deployment/registry/help/dp_help.cxx | 404 |
3 files changed, 316 insertions, 204 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 9f5d400e68..5f1b35932b 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -363,26 +363,28 @@ bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse ) // ----------------------------------------------------------------------- MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos ) { - if ( nPos >= (long) getItemCount() ) - return CMD_NONE; + if ( ( nPos >= 0 ) && ( nPos < (long) getItemCount() ) ) + { + if ( ! GetEntryData( nPos )->m_bLocked ) + { + PopupMenu aPopup; - PopupMenu aPopup; + aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); - aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); + if ( GetEntryData( nPos )->m_bUser ) + { + if ( GetEntryData( nPos )->m_eState == REGISTERED ) + aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); + else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE ) + aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) ); + } - if ( ! GetEntryData( nPos )->m_bLocked ) - { - if ( GetEntryData( nPos )->m_bUser ) - { - if ( GetEntryData( nPos )->m_eState == REGISTERED ) - aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); - else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE ) - aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) ); + aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); + + return (MENU_COMMAND) aPopup.Execute( this, rPos ); } - aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); } - - return (MENU_COMMAND) aPopup.Execute( this, rPos ); + return CMD_NONE; } //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/misc/dp_update.cxx b/desktop/source/deployment/misc/dp_update.cxx index 112eb5917b..43571483bf 100644 --- a/desktop/source/deployment/misc/dp_update.cxx +++ b/desktop/source/deployment/misc/dp_update.cxx @@ -90,8 +90,6 @@ getUpdateInformation( Reference<deployment::XUpdateInformationProvider > const & Sequence<Reference< xml::dom::XElement > >(); } -//Put in anonymous namespace - void getOwnUpdateInfos( Reference<uno::XComponentContext> const & xContext, Reference<deployment::XUpdateInformationProvider > const & updateInformation, @@ -185,6 +183,56 @@ void getDefaultUpdateInfos( } } +bool containsBundledOnly(Sequence<Reference<deployment::XPackage> > const & sameIdExtensions) +{ + OSL_ASSERT(sameIdExtensions.getLength() == 3); + if (!sameIdExtensions[0].is() && !sameIdExtensions[1].is() && sameIdExtensions[2].is()) + return true; + else + return false; +} +/** Returns true if the list of extensions are bundled extensions and there are no + other extensions with the same identifier in the shared or user repository. + If extensionList is NULL, then it is checked if there are only bundled extensions. +*/ +bool onlyBundledExtensions( + Reference<deployment::XExtensionManager> const & xExtMgr, + std::vector< Reference<deployment::XPackage > > const * extensionList) +{ + OSL_ASSERT(xExtMgr.is()); + bool onlyBundled = true; + if (extensionList) + { + typedef std::vector<Reference<deployment::XPackage > >::const_iterator CIT; + for (CIT i = extensionList->begin(); i != extensionList->end(); i++) + { + Sequence<Reference<deployment::XPackage> > seqExt = xExtMgr->getExtensionsWithSameIdentifier( + dp_misc::getIdentifier(*i), (*i)->getName(), Reference<ucb::XCommandEnvironment>()); + + if (!containsBundledOnly(seqExt)) + { + onlyBundled = false; + break; + } + + } + } + else + { + const uno::Sequence< uno::Sequence< Reference<deployment::XPackage > > > seqAllExt = + xExtMgr->getAllExtensions(Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>()); + + for (int pos = seqAllExt.getLength(); pos --; ) + { + if (!containsBundledOnly(seqAllExt[pos])) + { + onlyBundled = false; + break; + } + } + } + return onlyBundled; +} } // anon namespace @@ -233,13 +281,14 @@ UPDATE_SOURCE isUpdateUserExtension( retVal = UPDATE_SOURCE_ONLINE; } - else if (bundledVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), OUString(), bundledVersion, onlineVersion); - if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } + //No update for bundled extensions, they are updated only by the setup + //else if (bundledVersion.getLength()) + //{ + // int index = determineHighestVersion( + // OUString(), OUString(), bundledVersion, onlineVersion); + // if (index == 3) + // retVal = UPDATE_SOURCE_ONLINE; + //} } else { @@ -278,13 +327,14 @@ UPDATE_SOURCE isUpdateSharedExtension( 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; - } + //No update for bundled extensions, they are updated only by the setup + //else if (bundledVersion.getLength()) + //{ + // int index = determineHighestVersion( + // OUString(), OUString(), bundledVersion, onlineVersion); + // if (index == 3) + // retVal = UPDATE_SOURCE_ONLINE; + //} return retVal; } @@ -332,7 +382,7 @@ UpdateInfoMap getOnlineUpdateInfos( { OSL_ASSERT(xExtMgr.is()); UpdateInfoMap infoMap; - if (!xExtMgr.is()) + if (!xExtMgr.is() || onlyBundledExtensions(xExtMgr, extensionList)) return infoMap; if (!extensionList) diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 60dd5c414e..b267c34bb8 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -80,6 +80,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference<AbortChannel> const & abortChannel, Reference<XCommandEnvironment> const & xCmdEnv ); + bool extensionContainsCompiledHelp(); public: PackageImpl( ::rtl::Reference<PackageRegistryBackend> const & myBackend, @@ -100,7 +101,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference<XCommandEnvironment> const & xCmdEnv ); void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, - Reference<ucb::XCommandEnvironment> const & xCmdEnv); + bool compiledHelp, Reference<ucb::XCommandEnvironment> const & xCmdEnv); void implCollectXhpFiles( const rtl::OUString& aDir, std::vector< rtl::OUString >& o_rXhpFileVector ); @@ -259,6 +260,57 @@ BackendImpl * BackendImpl::PackageImpl::getMyBackend() const return pBackend; } + +bool BackendImpl::PackageImpl::extensionContainsCompiledHelp() +{ + bool bCompiled = true; + rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl(getURL()); + + ::osl::Directory helpFolder(aExpandedHelpURL); + if ( helpFolder.open() == ::osl::File::E_None) + { + //iterate over the contents of the help folder + //We assume that all folders withing the help folder contain language specific + //help files. If just one of them does not contain compiled help then this + //function returns false. + ::osl::DirectoryItem item; + ::osl::File::RC errorNext = ::osl::File::E_None; + while ((errorNext = helpFolder.getNextItem(item)) == ::osl::File::E_None) + { + //No find the language folders + ::osl::FileStatus stat(FileStatusMask_Type | FileStatusMask_FileName |FileStatusMask_FileURL); + if (item.getFileStatus(stat) == ::osl::File::E_None) + { + if (stat.getFileType() != ::osl::FileStatus::Directory) + continue; + + //look if there is the folder help.idxl in the language folder + OUString compUrl(stat.getFileURL() + OUSTR("/help.idxl")); + ::osl::Directory compiledFolder(compUrl); + if (compiledFolder.open() != ::osl::File::E_None) + { + bCompiled = false; + break; + } + } + else + { + //Error + OSL_ASSERT(0); + bCompiled = false; + break; + } + } + if (errorNext != ::osl::File::E_NOENT + && errorNext != ::osl::File::E_None) + { + //Error + OSL_ASSERT(0); + bCompiled = false; + } + } + return bCompiled; +} //______________________________________________________________________________ beans::Optional< beans::Ambiguous<sal_Bool> > BackendImpl::PackageImpl::isRegistered_( @@ -289,7 +341,8 @@ void BackendImpl::PackageImpl::processPackage_( BackendImpl* that = getMyBackend(); Reference< deployment::XPackage > xThisPackage( this ); - that->implProcessHelp( xThisPackage, doRegisterPackage, xCmdEnv); + that->implProcessHelp( xThisPackage, doRegisterPackage, + extensionContainsCompiledHelp(), xCmdEnv); } beans::Optional< OUString > BackendImpl::PackageImpl::getRegistrationDataURL() @@ -316,213 +369,220 @@ static rtl::OUString aHelpStr( rtl::OUString::createFromAscii( "help" ) ); void BackendImpl::implProcessHelp -( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, +( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, bool compiledHelp, Reference<ucb::XCommandEnvironment> const & xCmdEnv) { OSL_ASSERT(xPackage.is()); if (doRegisterPackage) { HelpBackendDb::Data data; - const OUString sHelpFolder = createFolder(OUString(), xCmdEnv); - data.dataUrl = sHelpFolder; - - 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 (compiledHelp) { - rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR ); - aErrStr += rtl::OUString::createFromAscii( "No help folder" ); - OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + data.dataUrl = xPackage->getURL(); } - - Reference<XComponentContext> const & xContext = getComponentContext(); - Reference< script::XInvocation > xInvocation; - if( xContext.is() ) + else { - try + const OUString sHelpFolder = createFolder(OUString(), xCmdEnv); + data.dataUrl = sHelpFolder; + + 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 ) ) { - 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<OWeakObject *>(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); } - catch (Exception &) + + Reference<XComponentContext> 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; - - // 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 aLangURL = pSeq[iLang]; + if( xSFA->isFolder( aLangURL ) ) + { + std::vector< rtl::OUString > aXhpFileVector; + + // 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 = ::dp_misc::expandUnoRcUrl(aJarFile); + rtl::OUString aJarFile( + makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr + + OUSTR(".jar"))); + 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 ) - { - rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang]; - if( !xSFA->isFolder( aSubFolderURL ) ) - continue; + 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 ); - } - - // 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; - } + // Copy to package (later: move?) + rtl::OUString aDestPath = aDestBasePath; + rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); + aDestPath += aPureFolderName; + xSFA->copy( aSubFolderURL, aDestPath ); + } - rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); - rtl::OUString aOfficeHelpPathFileURL; - ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); + // 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; + } - HelpProcessingErrorInfo aErrorInfo; - bool bSuccess = compileExtensionHelp( - aOfficeHelpPathFileURL, aHelpStr, aLangURL, - nXhpFileCount, pXhpFiles, - langFolderDestExpanded, aErrorInfo ); + rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); + rtl::OUString aOfficeHelpPathFileURL; + ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); - if( bSuccess && xInvocation.is() ) - { - Sequence<uno::Any> 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( - 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 ); - } + HelpProcessingErrorInfo aErrorInfo; + bool bSuccess = compileExtensionHelp( + aOfficeHelpPathFileURL, aHelpStr, aLangURL, + nXhpFileCount, pXhpFiles, + langFolderDestExpanded, aErrorInfo ); - if( !bSuccess ) - { - USHORT nErrStrId = 0; - switch( aErrorInfo.m_eErrorClass ) + if( bSuccess && xInvocation.is() ) { - 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 ) + Sequence<uno::Any> 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( + 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 ) { - 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 ) + USHORT nErrStrId = 0; + switch( aErrorInfo.m_eErrorClass ) { - 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() ) + 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 += 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<OWeakObject *>(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + } } } } - //Writing the data entry replaces writing the flag file. If we got to this //point the registration was successful. addDataToDb(xPackage->getURL(), data); - } + } //if (doRegisterPackage) else { deleteDataFromDb(xPackage->getURL()); |