diff options
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/AllLangResTarget_svt.mk | 1 | ||||
-rw-r--r-- | svtools/source/config/helpopt.cxx | 325 | ||||
-rw-r--r-- | svtools/source/misc/helpagent.src | 32 |
3 files changed, 5 insertions, 353 deletions
diff --git a/svtools/AllLangResTarget_svt.mk b/svtools/AllLangResTarget_svt.mk index 24d4df10e6f7..9a5e41f1bcdb 100644 --- a/svtools/AllLangResTarget_svt.mk +++ b/svtools/AllLangResTarget_svt.mk @@ -49,7 +49,6 @@ $(eval $(call gb_SrsTarget_add_files,svt/res,\ $(if $(filter TRUE,$(SOLAR_JAVA)), \ svtools/source/java/javaerror.src) \ svtools/source/misc/ehdl.src \ - svtools/source/misc/helpagent.src \ svtools/source/misc/imagemgr.src \ svtools/source/misc/langtab.src \ svtools/source/misc/svtools.src \ diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx index 6380e9534a28..a51ed04b7d15 100644 --- a/svtools/source/config/helpopt.cxx +++ b/svtools/source/config/helpopt.cxx @@ -41,20 +41,14 @@ static sal_Int32 nRefCount = 0; #define EXTENDEDHELP 0 #define HELPTIPS 1 -#define AGENT_ENABLED 2 -#define AGENT_TIMEOUT 3 -#define AGENT_RETRYLIMIT 4 -#define LOCALE 5 -#define SYSTEM 6 -#define STYLESHEET 7 +#define LOCALE 2 +#define SYSTEM 3 +#define STYLESHEET 4 class SvtHelpOptions_Impl : public utl::ConfigItem { - sal_Int32 nHelpAgentTimeoutPeriod; - sal_Int32 nHelpAgentRetryLimit; sal_Bool bExtendedHelp; sal_Bool bHelpTips; - sal_Bool bHelpAgentEnabled; sal_Bool bWelcomeScreen; String aLocale; String aSystem; @@ -78,15 +72,6 @@ public: void SetHelpTips( sal_Bool b ) { bHelpTips = b; SetModified(); } sal_Bool IsHelpTips() const { return bHelpTips; } - void SetHelpAgentEnabled( sal_Bool b ) { bHelpAgentEnabled = b; SetModified(); } - sal_Bool IsHelpAgentEnabled() const { return bHelpAgentEnabled; } - void SetHelpAgentTimeoutPeriod( sal_Int32 _nSeconds ) { nHelpAgentTimeoutPeriod = _nSeconds; SetModified(); } - sal_Int32 GetHelpAgentTimeoutPeriod( ) const { return nHelpAgentTimeoutPeriod; } - void SetHelpAgentRetryLimit( sal_Int32 _nTrials ) { nHelpAgentRetryLimit = _nTrials; SetModified(); } - sal_Int32 GetHelpAgentRetryLimit( ) const { return nHelpAgentRetryLimit; } - - void resetAgentIgnoreURLCounter(); - void SetWelcomeScreen( sal_Bool b ) { bWelcomeScreen = b; SetModified(); } sal_Bool IsWelcomeScreen() const { return bWelcomeScreen; } String GetLocale() const { return aLocale; } @@ -96,12 +81,6 @@ public: void SetHelpStyleSheet(const String& rStyleSheet){sHelpStyleSheet = rStyleSheet; SetModified();} static ::osl::Mutex & getInitMutex(); - -protected: - void implLoadURLCounters(); - void implSaveURLCounters(); - // to be called with aIgnoreCounterSafety locked - void implGetURLCounters( Sequence< OUString >& _rNodeNames, Sequence< Any >& _rURLs, Sequence< Any >& _rCounter ); }; Sequence< OUString > SvtHelpOptions_Impl::GetPropertyNames() @@ -110,13 +89,9 @@ Sequence< OUString > SvtHelpOptions_Impl::GetPropertyNames() { "ExtendedTip", "Tip", - "HelpAgent/Enabled", - "HelpAgent/Timeout", - "HelpAgent/RetryLimit", "Locale", "System", - "HelpStyleSheet", -// "HowTo/Show" + "HelpStyleSheet" }; const int nCount = sizeof( aPropNames ) / sizeof( const char* ); @@ -151,13 +126,11 @@ SvtHelpOptions_Impl::SvtHelpOptions_Impl() : ConfigItem( OUString( "Office.Common/Help" ) ) , bExtendedHelp( sal_False ) , bHelpTips( sal_True ) - , bHelpAgentEnabled( sal_False ) , bWelcomeScreen( sal_False ) { Sequence< OUString > aNames = GetPropertyNames(); Load( aNames ); EnableNotification( aNames ); - implLoadURLCounters(); } // ----------------------------------------------------------------------- @@ -200,9 +173,6 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< OUString>& rPropertyNames) case HELPTIPS : bHelpTips = bTmp; break; - case AGENT_ENABLED : - bHelpAgentEnabled = bTmp; - break; default: SAL_WARN( "svtools.config", "Wrong Member!" ); break; @@ -229,20 +199,7 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< OUString>& rPropertyNames) } else if ( pValues[nProp] >>= nTmpInt ) { - switch ( nProp ) - { - case AGENT_TIMEOUT: - nHelpAgentTimeoutPeriod = nTmpInt; - break; - - case AGENT_RETRYLIMIT: - nHelpAgentRetryLimit = nTmpInt; - break; - - default: - SAL_WARN( "svtools.config", "Wrong Member!" ); - break; - } + SAL_WARN( "svtools.config", "Wrong Member!" ); } else { @@ -259,220 +216,6 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< OUString>& rPropertyNames) // ----------------------------------------------------------------------- -void SvtHelpOptions_Impl::implGetURLCounters( Sequence< OUString >& _rNodeNames, Sequence< Any >& _rURLs, Sequence< Any >& _rCounters ) -{ - // the ignore counters for the help agent URLs - const OUString sIgnoreListNodePath( "HelpAgent/IgnoreList" ); - const OUString sPathSeparator( "/" ); - const OUString sURLLocalPath( "/Name" ); - const OUString sCounterLocalPath( "/Counter" ); - - // get the names of all the nodes containing ignore counters - // collect the node names we have to ask - // first get the node names of all children of HelpAgent/IgnoreList - _rNodeNames = GetNodeNames(sIgnoreListNodePath); - const OUString* pIgnoredURLsNodes = _rNodeNames.getConstArray(); - const OUString* pIgnoredURLsNodesEnd = pIgnoredURLsNodes + _rNodeNames.getLength(); - - // then assemble the two lists (of node paths) for the URLs and the counters - Sequence< OUString > aIgnoredURLs(_rNodeNames.getLength()); - Sequence< OUString > aIgnoredURLsCounter(_rNodeNames.getLength()); - OUString* pIgnoredURLs = aIgnoredURLs.getArray(); - OUString* pIgnoredURLsCounter = aIgnoredURLsCounter.getArray(); - for (;pIgnoredURLsNodes != pIgnoredURLsNodesEnd; ++pIgnoredURLsNodes, ++pIgnoredURLs, ++pIgnoredURLsCounter) - { - OUString sLocalURLAccess = sIgnoreListNodePath; - sLocalURLAccess += sPathSeparator; - sLocalURLAccess += *pIgnoredURLsNodes; - - // the path to the URL of this specific entry - *pIgnoredURLs = sLocalURLAccess; - *pIgnoredURLs += sURLLocalPath; - - // the path of the counter for that URL - *pIgnoredURLsCounter = sLocalURLAccess; - *pIgnoredURLsCounter += sCounterLocalPath; - } - - // now collect the values - _rURLs = GetProperties(aIgnoredURLs); - _rCounters = GetProperties(aIgnoredURLsCounter); - - sal_Int32 nURLs = _rURLs.getLength(); - sal_Int32 nCounters = _rCounters.getLength(); - DBG_ASSERT(nURLs == nCounters, "SvtHelpOptions_Impl::implGetURLCounters: inconsistence while retrieving the visited URLs!"); - - // normalize in case something went wrong - sal_Int32 nKnownURLs = nURLs < nCounters ? nURLs : nCounters; - if (nURLs < nCounters) - { - _rCounters.realloc(nKnownURLs); - _rNodeNames.realloc(nKnownURLs); - } - else if (nURLs > nCounters) - { - _rURLs.realloc(nKnownURLs); - _rNodeNames.realloc(nKnownURLs); - } -} - -// ----------------------------------------------------------------------- - -void SvtHelpOptions_Impl::implSaveURLCounters() -{ - ::osl::MutexGuard aGuard(aIgnoreCounterSafety); - - const OUString sIgnoreListNodePath( "HelpAgent/IgnoreList" ); - const OUString sPathSeparator( "/" ); - const OUString sURLLocalPath( "/Name" ); - const OUString sCounterLocalPath( "/Counter" ); - - // get the current URL/counter pairs (as they're persistent at the moment) - Sequence< OUString > aNodeNames; - Sequence< Any > aURLs; - Sequence< Any > aCounters; - - implGetURLCounters(aNodeNames, aURLs, aCounters); - sal_Int32 nKnownURLs = aURLs.getLength(); - - const OUString* pNodeNames = aNodeNames.getConstArray(); - const Any* pURLs = aURLs.getConstArray(); - const Any* pCounters = aCounters.getConstArray(); - - // check which of them must be deleted/modified - Sequence< OUString > aDeleteFromConfig(nKnownURLs); // names of nodes to be deleted - OUString* pDeleteFromConfig = aDeleteFromConfig.getArray(); - ::std::set< OUString > aAlreadyPresent; // URLs currently persistent - - // for modifying already existent nodes - Sequence< OUString > aNewCounterNodePaths(nKnownURLs); - Sequence< Any > aNewCounterValues(nKnownURLs); - OUString* pNewCounterNodePaths = aNewCounterNodePaths.getArray(); - Any* pNewCounterValues = aNewCounterValues.getArray(); - - // temporaries needed inside the loop - OUString sCurrentURL, sCurrentURLNodeName; - - for (sal_Int32 i=0; i<nKnownURLs; ++i, ++pNodeNames, ++pURLs, ++pCounters) - { - if (!((*pURLs) >>= sCurrentURL)) - continue; - - ConstMapString2IntIterator aThisURLNewCounter = aURLIgnoreCounters.find(sCurrentURL); - if (aURLIgnoreCounters.end() == aThisURLNewCounter) - { // we do not know anything about this URL anymore. - // -> have to removed it from the configuration later on - *pDeleteFromConfig = *pNodeNames; - ++pDeleteFromConfig; - } - else - { // we know this URL - sCurrentURLNodeName = sIgnoreListNodePath; - sCurrentURLNodeName += sPathSeparator; - sCurrentURLNodeName += *pNodeNames; - - // -> remember this (so we don't need to add a new node for this URL later on) - aAlreadyPresent.insert(sCurrentURL); - - sal_Int32 nThisURLPersistentCounter = 0; - (*pCounters) >>= nThisURLPersistentCounter; - - if (aThisURLNewCounter->second != nThisURLPersistentCounter) - { // the counter changed - // -> remember the path and the new counter for the adjustment below - *pNewCounterNodePaths = sCurrentURLNodeName; - *pNewCounterNodePaths += sCounterLocalPath; - ++pNewCounterNodePaths; - - (*pNewCounterValues) <<= aThisURLNewCounter->second; - ++pNewCounterValues; - } - } - } - - // delete the nodes which are flagged so ... - aDeleteFromConfig.realloc(pDeleteFromConfig - aDeleteFromConfig.getArray()); - if (0 != aDeleteFromConfig.getLength()) - { - ClearNodeElements(sIgnoreListNodePath, aDeleteFromConfig); - } - - // modify the nodes which need to be - aNewCounterNodePaths.realloc(pNewCounterNodePaths - aNewCounterNodePaths.getArray()); - aNewCounterValues.realloc(pNewCounterValues - aNewCounterValues.getArray()); - if (0 != aNewCounterNodePaths.getLength()) - { - PutProperties(aNewCounterNodePaths, aNewCounterValues); - } - - // and for the new ones ... - OUString sNewNodeName; - Sequence< OUString > aNewCounterDataNodeNames(2); - Sequence< Any > aNewCounterDataValues(2); - const OUString sNodeNameBase( "URL" ); - for ( ConstMapString2IntIterator aCollectNew = aURLIgnoreCounters.begin(); - aCollectNew != aURLIgnoreCounters.end(); - ++aCollectNew - ) - { - if (aAlreadyPresent.end() == aAlreadyPresent.find(aCollectNew->first)) - { // this URL is not persistent, yet - // -> add a new node - sNewNodeName = sNodeNameBase; - if (!getUniqueSetElementName(sIgnoreListNodePath, sNewNodeName)) - { - SAL_WARN( "svtools.config", "SvtHelpOptions_Impl::implSaveURLCounters: could not get a free name!" ); - continue; - } - AddNode(sIgnoreListNodePath, sNewNodeName); - - // and set the URL/counter pair - aNewCounterDataNodeNames[0] = sIgnoreListNodePath; - aNewCounterDataNodeNames[0] += sPathSeparator; - aNewCounterDataNodeNames[0] += sNewNodeName; - aNewCounterDataNodeNames[0] += sURLLocalPath; - aNewCounterDataValues[0] <<= aCollectNew->first; - - aNewCounterDataNodeNames[1] = sIgnoreListNodePath; - aNewCounterDataNodeNames[1] += sPathSeparator; - aNewCounterDataNodeNames[1] += sNewNodeName; - aNewCounterDataNodeNames[1] += sCounterLocalPath; - aNewCounterDataValues[1] <<= aCollectNew->second; - - PutProperties(aNewCounterDataNodeNames, aNewCounterDataValues); - } - } -} - -// ----------------------------------------------------------------------- - -void SvtHelpOptions_Impl::implLoadURLCounters() -{ - ::osl::MutexGuard aGuard(aIgnoreCounterSafety); - - Sequence< OUString > aNodeNames; - Sequence< Any > aURLs; - Sequence< Any > aCounters; - - implGetURLCounters(aNodeNames, aURLs, aCounters); - sal_Int32 nKnownURLs = aURLs.getLength(); - - const Any* pURLs = aURLs.getConstArray(); - const Any* pCounters = aCounters.getConstArray(); - - OUString sCurrentURL; - sal_Int32 nCurrentCounter; - for (sal_Int32 i=0; i<nKnownURLs; ++i, ++pURLs, ++pCounters) - { - (*pURLs) >>= sCurrentURL; - nCurrentCounter = 0; - (*pCounters) >>= nCurrentCounter; - aURLIgnoreCounters[sCurrentURL] = nCurrentCounter; - } -} - -// ----------------------------------------------------------------------- - void SvtHelpOptions_Impl::Commit() { Sequence< OUString > aNames = GetPropertyNames(); @@ -490,18 +233,6 @@ void SvtHelpOptions_Impl::Commit() pValues[nProp] <<= bHelpTips; break; - case AGENT_ENABLED : - pValues[nProp] <<= bHelpAgentEnabled; - break; - - case AGENT_TIMEOUT: - pValues[nProp] <<= nHelpAgentTimeoutPeriod; - break; - - case AGENT_RETRYLIMIT: - pValues[nProp] <<= nHelpAgentRetryLimit; - break; - case LOCALE: pValues[nProp] <<= OUString(aLocale); break; @@ -517,8 +248,6 @@ void SvtHelpOptions_Impl::Commit() } PutProperties( aNames, aValues ); - - implSaveURLCounters(); } // ----------------------------------------------------------------------- @@ -545,15 +274,6 @@ SvtHelpOptions::SvtHelpOptions() // ----------------------------------------------------------------------- -void SvtHelpOptions_Impl::resetAgentIgnoreURLCounter() -{ - ::osl::MutexGuard aGuard(aIgnoreCounterSafety); - aURLIgnoreCounters.clear(); - SetModified(); -} - -// ----------------------------------------------------------------------- - SvtHelpOptions::~SvtHelpOptions() { // Global access, must be guarded (multithreading) @@ -588,41 +308,6 @@ sal_Bool SvtHelpOptions::IsHelpTips() const // ----------------------------------------------------------------------- -void SvtHelpOptions::SetHelpAgentTimeoutPeriod( sal_Int32 _nSeconds ) -{ - pImp->SetHelpAgentTimeoutPeriod( _nSeconds ); -} - -// ----------------------------------------------------------------------- - -sal_Int32 SvtHelpOptions::GetHelpAgentTimeoutPeriod( ) const -{ - return pImp->GetHelpAgentTimeoutPeriod( ); -} - -// ----------------------------------------------------------------------- - -void SvtHelpOptions::SetHelpAgentAutoStartMode( sal_Bool b ) -{ - pImp->SetHelpAgentEnabled( b ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvtHelpOptions::IsHelpAgentAutoStartMode() const -{ - return pImp->IsHelpAgentEnabled(); -} - -// ----------------------------------------------------------------------- - -void SvtHelpOptions::resetAgentIgnoreURLCounter() -{ - pImp->resetAgentIgnoreURLCounter(); -} - -// ----------------------------------------------------------------------- - void SvtHelpOptions::SetWelcomeScreen( sal_Bool b ) { pImp->SetWelcomeScreen( b ); diff --git a/svtools/source/misc/helpagent.src b/svtools/source/misc/helpagent.src deleted file mode 100644 index 697f684a2478..000000000000 --- a/svtools/source/misc/helpagent.src +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <svtools/svtools.hrc> - -Bitmap BMP_HELP_AGENT_IMAGE -{ - File = "helpagent.png"; -}; - -Bitmap BMP_HELP_AGENT_CLOSER -{ - File = "closer.png"; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |