This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push: new 016e2ef Fixed typos (preferr -> prefer) and some more, removed whitespace 016e2ef is described below commit 016e2efea5858e15bc84724540224c577bc5f699 Author: mseidel <msei...@apache.org> AuthorDate: Thu Dec 3 20:00:47 2020 +0100 Fixed typos (preferr -> prefer) and some more, removed whitespace (cherry picked from commit 1fbfd7a278c32f8d67af627c0787d0b53e44c56c) --- main/filter/source/config/cache/typedetection.cxx | 110 +++++----- .../qa/complex/framework/autosave/Protocol.java | 27 +-- .../source/accelerators/presethandler.cxx | 234 ++++++++++----------- main/framework/source/jobs/job.cxx | 74 +++---- main/framework/source/services/autorecovery.cxx | 114 +++++----- main/sal/osl/w32/module.cxx | 143 +++++++------ 6 files changed, 351 insertions(+), 351 deletions(-) diff --git a/main/filter/source/config/cache/typedetection.cxx b/main/filter/source/config/cache/typedetection.cxx index e593ed1..c1a7053 100644 --- a/main/filter/source/config/cache/typedetection.cxx +++ b/main/filter/source/config/cache/typedetection.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * 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 @@ -7,16 +7,16 @@ * 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 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -53,7 +53,7 @@ namespace css = ::com::sun::star; //_______________________________________________ // definitions -// Use this switch to change the behaviour of preselection DocumentService ... (see using for further informations) +// Use this switch to change the behavior of preselection DocumentService ... (see using for further informations) #define IGNORE_NON_URLMATCHING_TYPES_FOR_PRESELECTION_DOCUMENTSERVICE // enable/disable special handling for CSV/TXT problem @@ -126,7 +126,7 @@ TypeDetection::~TypeDetection() sal_Bool bAllowDeep ) throw (css::uno::RuntimeException) { - // make the descriptor more useable :-) + // make the descriptor more usable :-) ::comphelper::MediaDescriptor stlDescriptor(lDescriptor); // SAFE -> ---------------------------------- @@ -189,7 +189,7 @@ TypeDetection::~TypeDetection() { sType = impl_detectTypeDeepOnly(stlDescriptor, lUsedDetectors); } - + //******************************************* // flat detection failed // pure deep detection failed @@ -229,7 +229,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(::comphelper::MediaDescrip ::rtl::OUString& sType ) { // a) - // Dont overwrite a might preselected filter! + // Don't overwrite a might preselected filter! ::rtl::OUString sFilter = rDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_FILTERNAME(), ::rtl::OUString()); @@ -416,9 +416,9 @@ sal_Bool TypeDetection::impl_getPreselectionForType(const ::rtl::OUString& sPreS FlatDetection& rFlatTypes ) { // Can be used to suppress execution of some parts of this method - // if its already clear that detected type is valid or not. - // Its necessary to use shared code at the end, which update - // all return parameters constistency! + // if it's already clear that detected type is valid or not. + // It's necessary to use shared code at the end, which updates + // all return parameters consistent! sal_Bool bBreakDetection = sal_False; // Further we must know if it matches by pattern @@ -430,8 +430,8 @@ sal_Bool TypeDetection::impl_getPreselectionForType(const ::rtl::OUString& sPreS sal_Bool bMatchByExtension = sal_False; // If we e.g. collect all filters of a factory (be a forced factory preselection) - // we should preferr all filters of this factory, where the type match the given URL. - // All other types (which sorrespond to filters of the same factory - but dont match + // we should prefer all filters of this factory, where the type match the given URL. + // All other types (which correspond to filters of the same factory - but don't match // the URL) should be "used later" for detection and sorted at the end of our return vector // rFlatTypes! // => bPreferredPreselection = (matchByExtension || matchByURLPattern) @@ -508,11 +508,11 @@ sal_Bool TypeDetection::impl_getPreselectionForType(const ::rtl::OUString& sPreS } /* - Comment ... why the following line of code should be comened out .-) + Comment ... why the following line of code should be commented out .-) This type does not seem to fit the requirements - But its an existing and well known type. - At least - [because may be the extension was missing :-( ] + But it's an existing and well known type. + At least - [because maybe the extension was missing :-( ] we should try to detect this type deep ... So we accept it here :-) @@ -521,7 +521,7 @@ sal_Bool TypeDetection::impl_getPreselectionForType(const ::rtl::OUString& sPreS */ } - // if its a valid type - set it on all return values! + // if it's a valid type - set it on all return values! if (sType.getLength()) { FlatDetectionInfo aInfo; @@ -550,9 +550,9 @@ sal_Bool TypeDetection::impl_getPreselectionForFilter(const ::rtl::OUString& sPr FlatDetection& rFlatTypes ) { // Can be used to suppress execution of some parts of this method - // if its already clear that detected filter is valid or not. - // Its necessary to use shared code at the end, which update - // all return parameters constistency! + // if it's already clear that detected filter is valid or not. + // It's necessary to use shared code at the end, which updates + // all return parameters consistent! sal_Bool bBreakDetection = sal_False; // validate filter @@ -697,7 +697,7 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP add it's own preselection too. So we have a combination of preselected values ... - The we should preferr the most important one - set by the user. + Then we should prefer the most important one - set by the user. And the user normally preselects a filter or type. The preselected document service cames from the dialog. @@ -728,7 +728,7 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP OUStringList& rUsedDetectors, ::rtl::OUString& rLastChance ) { - // reset it everytimes, so the outside code can distinguish between + // reset it every time, so the outside code can distinguish between // a set and a not set value. rLastChance = ::rtl::OUString(); rUsedDetectors.clear(); @@ -736,7 +736,7 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP // step over all possible types for this URL. // solutions: // a) no types => no detection - // b) deep detection not allowed => return first valid type of list (because its the preferred or the first valid one) + // b) deep detection not allowed => return first valid type of list (because it's the preferred or the first valid one) // or(!) match by URLPattern => in such case a deep detection will be suppressed! // c) type has no detect service => safe the first occurred type without a detect service // as "last chance"(!). It will be used outside of this method @@ -783,7 +783,7 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP // accept or not accept flat types without deep detection: that's the question :-) // May be there exists some states, where we have to use our LastChance feature instead // of using the flat type directly. - // Here the list of task ID's, which wasrelated to these lines of code: + // Here the list of task ID's, which was related to these lines of code: // #i47159#, #i43404#, #i46494# // a flat detected type without the chance for a deep detection ... but preselected by the user @@ -805,7 +805,7 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP continue; } - // dont forget to add every real asked deep detection service here. + // don't forget to add every real asked deep detection service here. // Such detectors will be ignored if may be "impl_detectTypeDeepOnly()" // must be called later! rUsedDetectors.push_back(sDetectService); @@ -841,7 +841,7 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP // The list of "already used detect services" correspond to the list // of preselected or flat detected types. But these detect services was called // to check these types explicitly and return black/white ... yes/no only. - // Now they are called to return any possible result. But we should preferr + // Now they are called to return any possible result. But we should prefer // these already used detect services against all other ones! for ( pIt = lOutsideUsedDetectors.begin(); pIt != lOutsideUsedDetectors.end() ; @@ -941,7 +941,7 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP ++pIt ) { const ::rtl::OUString& sDetectService = *pIt; - + OUStringList::const_iterator pAlreadyUsed = ::std::find(lInsideUsedDetectors.begin(), lInsideUsedDetectors.end(), sDetectService); if (pAlreadyUsed != lInsideUsedDetectors.end()) continue; @@ -959,7 +959,7 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP -----------------------------------------------*/ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescriptor) { - // try to seek to 0 ... + // try to seek to 0 ... // But because XSeekable is an optional interface ... try it only .-) css::uno::Reference< css::io::XInputStream > xStream = rDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_INPUTSTREAM(), @@ -994,7 +994,7 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript // seek to 0 is an optional feature to be more robust against // "simple implemented detect services" .-) impl_seekStreamToZero(rDescriptor); - + css::uno::Reference< css::document::XExtendedFilterDetection > xDetector; css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR; @@ -1011,19 +1011,19 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript xDetector = css::uno::Reference< css::document::XExtendedFilterDetection >( xSMGR->createInstance(sDetectService), css::uno::UNO_QUERY); - + if ( ! xDetector.is()) return ::rtl::OUString(); - + ::rtl::OUString sDeepType; try { // start deep detection - // Dont forget to convert stl descriptor to its uno representation. - + // Don't forget to convert stl descriptor to its uno representation. + /* Attention! You have to use an explicit instance of this uno sequence ... - Because its used as an in out parameter. And in case of a temp. used object + Because it's used as an in out parameter. And in case of a temp. used object we will run into memory corruptions! */ css::uno::Sequence< css::beans::PropertyValue > lDescriptor; @@ -1039,11 +1039,11 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript // document without a problem .-) sDeepType = ::rtl::OUString(); } - + // seek to 0 is an optional feature to be more robust against // "simple implemented detect services" .-) impl_seekStreamToZero(rDescriptor); - + // analyze the results // a) detect service returns "" => return "" too and remove TYPE/FILTER prop from descriptor // b) returned type is unknown => return "" too and remove TYPE/FILTER prop from descriptor @@ -1054,7 +1054,7 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript sal_Bool bValidType = impl_validateAndSetTypeOnDescriptor(rDescriptor, sDeepType); if (bValidType) return sDeepType; - + return ::rtl::OUString(); } @@ -1069,23 +1069,23 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript aLock.clear(); // <- SAFE - css::uno::Reference< css::task::XInteractionHandler > xInteraction = + css::uno::Reference< css::task::XInteractionHandler > xInteraction = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER(), css::uno::Reference< css::task::XInteractionHandler >()); - + if (!xInteraction.is()) return ::rtl::OUString(); - + ::rtl::OUString sURL = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_URL(), ::rtl::OUString()); - + css::uno::Reference< css::io::XInputStream > xStream = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_INPUTSTREAM(), css::uno::Reference< css::io::XInputStream >()); - // Dont distrub the user for "non existing files - means empty URLs" or - // if we was forced to detect a stream. + // Don't disturb the user for "non existing files - means empty URLs" or + // if we were forced to detect a stream. // Reason behind: We must be sure to ask user for "unknown contents" only ... // and not for "missing files". Especially if detection is done by a stream only // we can't check if the stream points to an "existing content"! @@ -1094,36 +1094,36 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript (!xStream.is() ) || // non existing file ! (sURL.equalsIgnoreAsciiCaseAsciiL("private:stream", 14)) // not a good idea .-) ) - return ::rtl::OUString(); - + return ::rtl::OUString(); + try { - // create a new request to ask user for it's decision about the usable filter + // create a new request to ask user for his decision about the usable filter ::framework::RequestFilterSelect aRequest(sURL); xInteraction->handle(aRequest.GetRequest()); - + // "Cancel" pressed? => return with error if (aRequest.isAbort()) return ::rtl::OUString(); - - // "OK" pressed => verify the selected filter, get it's coressponding + + // "OK" pressed => verify the selected filter, get its corresponding // type and return it. (BTW: We must update the media descriptor here ...) // The user selected explicitly a filter ... but normally we are interested on // a type here only. But we must be sure, that the selected filter is used - // too and no ambigous filter registration disturb us .-) - + // too and no ambiguous filter registration disturb us .-) + ::rtl::OUString sFilter = aRequest.getFilter(); if (!impl_validateAndSetFilterOnDescriptor(rDescriptor, sFilter)) return ::rtl::OUString(); - + ::rtl::OUString sType; rDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME()] >>= sType; return sType; } catch(const css::uno::Exception&) {} - - return ::rtl::OUString(); + + return ::rtl::OUString(); } /*----------------------------------------------- @@ -1137,7 +1137,7 @@ void TypeDetection::impl_openStream(::comphelper::MediaDescriptor& rDescriptor) sal_Bool bRequestedReadOnly = rDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_READONLY(), sal_False ); if ( sURL.getLength() && ::utl::LocalFileHelper::IsLocalFile( INetURLObject( sURL ).GetMainURL( INetURLObject::NO_DECODE ) ) ) { - // OOo uses own file locking mechanics in case of local file + // AOO uses own file locking mechanics in case of local file bSuccess = rDescriptor.addInputStreamOwnLock(); } else diff --git a/main/framework/qa/complex/framework/autosave/Protocol.java b/main/framework/qa/complex/framework/autosave/Protocol.java index e338fb5..7a326ab 100644 --- a/main/framework/qa/complex/framework/autosave/Protocol.java +++ b/main/framework/qa/complex/framework/autosave/Protocol.java @@ -1,5 +1,5 @@ /************************************************************** - * + * * 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 @@ -7,16 +7,16 @@ * 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 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -58,7 +58,7 @@ import java.sql.*; /** * Implements a log mechanism to create a protocol of all steps of e.g. an api test - * It provides the possibility to write the logged meesages to a file and/or + * It provides the possibility to write the logged messages to a file and/or * to stdout/stderr (if necessary at the same time!). * * TODO @@ -379,7 +379,7 @@ public class Protocol extends JComponent bTypeCellFilled = true; } - // if no tyope information was added to the current coloum, we must + // if no type information was added to the current column, we must // write any content into this cell. Otherwise some browser // shows a strange layout! if (! bTypeCellFilled) @@ -475,7 +475,7 @@ public class Protocol extends JComponent // ____________________ /** * ctor - * It creates a new instance of this class and innitialize it in the right mode. + * It creates a new instance of this class and initialize it in the right mode. * * @param nMode * specify how the log should be generated. @@ -507,7 +507,7 @@ public class Protocol extends JComponent */ public synchronized void finish() { - // Preferr HTML ... because we can't write ASCII and HTML contents to the same log file! + // Prefer HTML ... because we can't write ASCII and HTML contents to the same log file! String sContent; if ((m_nMode & MODE_HTML) == MODE_HTML) sContent = impl_generateHTMLFooter(); @@ -635,7 +635,7 @@ public class Protocol extends JComponent ++m_nLine; - // it's necessary to open scopes before creatig the protocol line + // it's necessary to open scopes before creating the protocol line // to guarantee right tab handling for new scope value! if ((nType & TYPE_SCOPE_OPEN) == TYPE_SCOPE_OPEN) ++m_nScope; @@ -645,7 +645,7 @@ public class Protocol extends JComponent String sAsciiLog = aLine.toString(); String sHTMLLog = aLine.toHTML(); - // it's necessary to close scope after creatig the protocol line + // it's necessary to close scope after creating the protocol line // to guarantee right tab handling for old scope value! if ( ( m_nScope > 0 ) && @@ -672,7 +672,7 @@ public class Protocol extends JComponent // no else - it's a bit field of possible reactions! // But these both conditions must be handled together. // Because we can't generate different types of log contents to the same log file. - // We preferr HTML if both types are set. + // We prefer HTML if both types are set. if ( ((m_nMode & MODE_HTML ) == MODE_HTML ) || ((m_nMode & MODE_ASCII) == MODE_ASCII) @@ -757,7 +757,7 @@ public class Protocol extends JComponent * returns a generic html header for generating html log files * * It's used from the method finish() to generate a valid html formatted file. - * For that its necessary to open some special html targets like e.g. <html>. + * For that it's necessary to open some special html targets like e.g. <html>. * * @return A string, which includes the whole header. * @@ -830,7 +830,7 @@ public class Protocol extends JComponent // ____________________ /** - * it trys to convert the given any into a suitable string notation .-) + * it tries to convert the given any into a suitable string notation .-) */ private synchronized void impl_logAny( /*OUT*/ StringBuffer sOut , /*IN */ Object aAny ) @@ -993,3 +993,4 @@ public class Protocol extends JComponent } } } + diff --git a/main/framework/source/accelerators/presethandler.cxx b/main/framework/source/accelerators/presethandler.cxx index 0060ad3..e37ef55 100644 --- a/main/framework/source/accelerators/presethandler.cxx +++ b/main/framework/source/accelerators/presethandler.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * 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 @@ -7,16 +7,16 @@ * 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 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -101,49 +101,49 @@ static const ::sal_Int32 ID_CORRUPT_UICONFIG_GENERAL = 3; namespace framework { -//----------------------------------------------- +//----------------------------------------------- ::rtl::OUString PresetHandler::PRESET_DEFAULT() { static ::rtl::OUString RSTYPE = DECLARE_ASCII("default"); return RSTYPE; } -//----------------------------------------------- +//----------------------------------------------- ::rtl::OUString PresetHandler::TARGET_CURRENT() { static ::rtl::OUString RSTYPE = DECLARE_ASCII("current"); return RSTYPE; } -//----------------------------------------------- +//----------------------------------------------- ::rtl::OUString PresetHandler::RESOURCETYPE_MENUBAR() { static ::rtl::OUString RSTYPE = DECLARE_ASCII("menubar"); return RSTYPE; } -//----------------------------------------------- +//----------------------------------------------- ::rtl::OUString PresetHandler::RESOURCETYPE_TOOLBAR() { static ::rtl::OUString RSTYPE = DECLARE_ASCII("toolbar"); return RSTYPE; } -//----------------------------------------------- +//----------------------------------------------- ::rtl::OUString PresetHandler::RESOURCETYPE_ACCELERATOR() { static ::rtl::OUString RSTYPE = DECLARE_ASCII("accelerator"); return RSTYPE; } -//----------------------------------------------- +//----------------------------------------------- ::rtl::OUString PresetHandler::RESOURCETYPE_STATUSBAR() { static ::rtl::OUString RSTYPE = DECLARE_ASCII("statusbar"); return RSTYPE; } -//----------------------------------------------- +//----------------------------------------------- PresetHandler::PresetHandler(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) : ThreadHelpBase (&Application::GetSolarMutex() ) , m_xSMGR (xSMGR ) @@ -153,7 +153,7 @@ PresetHandler::PresetHandler(const css::uno::Reference< css::lang::XMultiService { } -//----------------------------------------------- +//----------------------------------------------- PresetHandler::PresetHandler(const PresetHandler& rCopy) : ThreadHelpBase (&Application::GetSolarMutex() ) { @@ -174,7 +174,7 @@ PresetHandler::PresetHandler(const PresetHandler& rCopy) m_sRelPathUser = rCopy.m_sRelPathUser; } -//----------------------------------------------- +//----------------------------------------------- PresetHandler::~PresetHandler() { m_xWorkingStorageShare.clear(); @@ -182,12 +182,12 @@ PresetHandler::~PresetHandler() m_xWorkingStorageUser.clear(); /* #i46497# - Dont call forgetCachedStorages() here for shared storages. + Don't call forgetCachedStorages() here for shared storages. Because we opened different sub storages by using openPath(). And every already open path was reused and referenced (means it's ref count was increased!) So now we have to release our ref counts to these shared storages - only ... and not to free all used storages. + only... and not to free all used storages. Otherwise we will disconnect all other open configuration access objects which base on these storages. */ @@ -195,32 +195,32 @@ PresetHandler::~PresetHandler() m_aSharedStorages->m_lStoragesUser.closePath (m_sRelPathUser ); /* On the other side closePath() is not needed for our special handled - document storage. Because it's not shared with others ... so we can + document storage. Because it's not shared with others... so we can free it. */ m_lDocumentStorages.forgetCachedStorages(); } -//----------------------------------------------- +//----------------------------------------------- void PresetHandler::forgetCachedStorages() { // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); - + if (m_eConfigType == E_DOCUMENT) { m_xWorkingStorageShare.clear(); m_xWorkingStorageNoLang.clear(); m_xWorkingStorageUser.clear(); } - + m_lDocumentStorages.forgetCachedStorages(); - + aWriteLock.unlock(); // <- SAFE ---------------------------------- } -//----------------------------------------------- +//----------------------------------------------- ::rtl::OUString lcl_getLocalizedMessage(::sal_Int32 nID) { ::rtl::OUString sMessage = ::rtl::OUString::createFromAscii("Unknown error."); @@ -230,11 +230,11 @@ void PresetHandler::forgetCachedStorages() case ID_CORRUPT_UICONFIG_SHARE : sMessage = ::rtl::OUString( String( FwkResId( STR_CORRUPT_UICFG_SHARE ))); break; - + case ID_CORRUPT_UICONFIG_USER : sMessage = ::rtl::OUString( String( FwkResId( STR_CORRUPT_UICFG_USER ))); break; - + case ID_CORRUPT_UICONFIG_GENERAL : sMessage = ::rtl::OUString( String( FwkResId( STR_CORRUPT_UICFG_GENERAL ))); break; @@ -243,36 +243,36 @@ void PresetHandler::forgetCachedStorages() return sMessage; } -//----------------------------------------------- +//----------------------------------------------- css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorageShare() { - css::uno::Reference< css::embed::XStorage > xRoot = m_aSharedStorages->m_lStoragesShare.getRootStorage(); + css::uno::Reference< css::embed::XStorage > xRoot = m_aSharedStorages->m_lStoragesShare.getRootStorage(); if (xRoot.is()) return xRoot; - + // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; aReadLock.unlock(); // <- SAFE ---------------------------------- - + css::uno::Reference< css::beans::XPropertySet > xPathSettings( - xSMGR->createInstance(SERVICENAME_PATHSETTINGS), + xSMGR->createInstance(SERVICENAME_PATHSETTINGS), css::uno::UNO_QUERY_THROW); - + ::rtl::OUString sShareLayer; xPathSettings->getPropertyValue(BASEPATH_SHARE_LAYER) >>= sShareLayer; - + // "UIConfig" is a "multi path" ... use first part only here! sal_Int32 nPos = sShareLayer.indexOf(';'); if (nPos > 0) sShareLayer = sShareLayer.copy(0, nPos); - - // Note: May be an user uses URLs without a final slash! Check it ... + + // Note: Maybe a user uses URLs without a final slash! Check it ... nPos = sShareLayer.lastIndexOf('/'); if (nPos != sShareLayer.getLength()-1) sShareLayer += ::rtl::OUString::createFromAscii("/"); - + sShareLayer += RELPATH_SHARE_LAYER; // folder /* // TODO remove me! @@ -283,10 +283,10 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag css::uno::Sequence< css::uno::Any > lArgs(2); lArgs[0] <<= sShareLayer; lArgs[1] <<= css::embed::ElementModes::READ | css::embed::ElementModes::NOCREATE; - + css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(xSMGR->createInstance(SERVICENAME_FILESYSTEMSTORAGEFACTORY) , css::uno::UNO_QUERY_THROW); css::uno::Reference< css::embed::XStorage > xStorage; - + try { xStorage = css::uno::Reference< css::embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW); @@ -298,46 +298,46 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag css::uno::Reference< css::uno::XInterface >(), ex.Message); } - + m_aSharedStorages->m_lStoragesShare.setRootStorage(xStorage); - + return xStorage; -} +} -//----------------------------------------------- +//----------------------------------------------- css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorageUser() { - css::uno::Reference< css::embed::XStorage > xRoot = m_aSharedStorages->m_lStoragesUser.getRootStorage(); + css::uno::Reference< css::embed::XStorage > xRoot = m_aSharedStorages->m_lStoragesUser.getRootStorage(); if (xRoot.is()) return xRoot; - + // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; aReadLock.unlock(); // <- SAFE ---------------------------------- - + css::uno::Reference< css::beans::XPropertySet > xPathSettings( - xSMGR->createInstance(SERVICENAME_PATHSETTINGS), + xSMGR->createInstance(SERVICENAME_PATHSETTINGS), css::uno::UNO_QUERY_THROW); - + ::rtl::OUString sUserLayer; xPathSettings->getPropertyValue(BASEPATH_USER_LAYER) >>= sUserLayer ; - - // Note: May be an user uses URLs without a final slash! Check it ... + + // Note: Maybe a user uses URLs without a final slash! Check it ... sal_Int32 nPos = sUserLayer.lastIndexOf('/'); if (nPos != sUserLayer.getLength()-1) sUserLayer += ::rtl::OUString::createFromAscii("/"); - + sUserLayer += RELPATH_USER_LAYER; // storage file - + css::uno::Sequence< css::uno::Any > lArgs(2); lArgs[0] <<= sUserLayer; lArgs[1] <<= css::embed::ElementModes::READWRITE; - + css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(xSMGR->createInstance(SERVICENAME_FILESYSTEMSTORAGEFACTORY) , css::uno::UNO_QUERY_THROW); css::uno::Reference< css::embed::XStorage > xStorage; - + try { xStorage = css::uno::Reference< css::embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW); @@ -351,7 +351,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag } m_aSharedStorages->m_lStoragesUser.setRootStorage(xStorage); - + return xStorage; } @@ -381,7 +381,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageShare css::uno::Reference< css::embed::XStorage > xWorking = m_xWorkingStorageShare; aReadLock.unlock(); // <- SAFE ---------------------------------- - + return m_aSharedStorages->m_lStoragesShare.getParentStorage(xWorking); } @@ -393,7 +393,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageUser( css::uno::Reference< css::embed::XStorage > xWorking = m_xWorkingStorageUser; aReadLock.unlock(); // <- SAFE ---------------------------------- - + return m_aSharedStorages->m_lStoragesUser.getParentStorage(xWorking); } @@ -402,18 +402,18 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType const ::rtl::OUString& sResource , const ::rtl::OUString& sModule , const css::uno::Reference< css::embed::XStorage >& xDocumentRoot, - const ::comphelper::Locale& aLocale ) + const ::comphelper::Locale& aLocale ) { // TODO free all current open storages! - + // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); m_eConfigType = eConfigType ; m_sResourceType = sResource ; m_sModule = sModule ; - m_aLocale = aLocale ; - + m_aLocale = aLocale ; + aWriteLock.unlock(); // <- SAFE ---------------------------------- @@ -435,7 +435,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType } else { - xShare = getOrCreateRootStorageShare(); + xShare = getOrCreateRootStorageShare(); xUser = getOrCreateRootStorageUser(); } @@ -443,11 +443,11 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType try { - // a) inside share layer we should not create any new structures ... We jave to use + // a) inside share layer we should not create any new structures ... We have to use // existing ones only! // b) inside user layer we can (SOFT mode!) but sometimes we shouldn't (HARD mode!) - // create new empty structures. We should preferr using of any existing structure. - sal_Int32 eShareMode = (css::embed::ElementModes::READ | css::embed::ElementModes::NOCREATE); + // create new empty structures. We should prefer using of any existing structure. + sal_Int32 eShareMode = (css::embed::ElementModes::READ | css::embed::ElementModes::NOCREATE); sal_Int32 eUserMode = (css::embed::ElementModes::READWRITE ); ::rtl::OUStringBuffer sRelPathBuf(1024); @@ -461,14 +461,14 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType sRelPathBuf.append(SUBSTORAGE_GLOBAL); sRelPathBuf.append(PATH_SEPERATOR ); sRelPathBuf.append(sResource ); - sRelPathShare = sRelPathBuf.makeStringAndClear(); + sRelPathShare = sRelPathBuf.makeStringAndClear(); sRelPathUser = sRelPathShare; xShare = impl_openPathIgnoringErrors(sRelPathShare, eShareMode, sal_True ); xUser = impl_openPathIgnoringErrors(sRelPathUser , eUserMode , sal_False); } break; - + case E_MODULES : { sRelPathBuf.append(SUBSTORAGE_MODULES); @@ -476,7 +476,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType sRelPathBuf.append(sModule ); sRelPathBuf.append(PATH_SEPERATOR ); sRelPathBuf.append(sResource ); - sRelPathShare = sRelPathBuf.makeStringAndClear(); + sRelPathShare = sRelPathBuf.makeStringAndClear(); sRelPathUser = sRelPathShare; xShare = impl_openPathIgnoringErrors(sRelPathShare, eShareMode, sal_True ); @@ -491,7 +491,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType // So we open the user layer here only and set the share layer equals to it .-) sRelPathBuf.append(sResource); - sRelPathUser = sRelPathBuf.makeStringAndClear(); + sRelPathUser = sRelPathBuf.makeStringAndClear(); sRelPathShare = sRelPathUser; try @@ -520,7 +520,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType // Fallbacks are allowed there. ::comphelper::Locale aShareLocale = aLocale ; ::rtl::OUString sLocalizedSharePath(sRelPathShare); - sal_Bool bAllowFallbacks = sal_True ; + sal_Bool bAllowFallbacks = sal_True ; xShare = impl_openLocalizedPathIgnoringErrors(sLocalizedSharePath, eShareMode, sal_True , aShareLocale, bAllowFallbacks); // The try to locate the right sub dir inside user layer ... without using fallbacks! @@ -528,30 +528,30 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType // Because we allow creation of storages inside user layer by default. ::comphelper::Locale aUserLocale = aLocale ; ::rtl::OUString sLocalizedUserPath(sRelPathUser); - bAllowFallbacks = sal_False ; + bAllowFallbacks = sal_False ; xUser = impl_openLocalizedPathIgnoringErrors(sLocalizedUserPath, eUserMode , sal_False, aUserLocale, bAllowFallbacks); - + sRelPathShare = sLocalizedSharePath; sRelPathUser = sLocalizedUserPath ; } - + // read content of level 3 (presets, targets) css::uno::Reference< css::container::XNameAccess > xAccess ; css::uno::Sequence< ::rtl::OUString > lNames ; const ::rtl::OUString* pNames ; sal_Int32 c ; sal_Int32 i ; - OUStringList lPresets; - OUStringList lTargets; - - // read preset names of share layer + OUStringList lPresets; + OUStringList lTargets; + + // read preset names of share layer xAccess = css::uno::Reference< css::container::XNameAccess >(xShare, css::uno::UNO_QUERY); if (xAccess.is()) { lNames = xAccess->getElementNames(); pNames = lNames.getConstArray(); c = lNames.getLength(); - + for (i=0; i<c; ++i) { ::rtl::OUString sTemp = pNames[i]; @@ -561,15 +561,15 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType lPresets.push_back(sTemp); } } - - // read preset names of user layer + + // read preset names of user layer xAccess = css::uno::Reference< css::container::XNameAccess >(xUser, css::uno::UNO_QUERY); if (xAccess.is()) { lNames = xAccess->getElementNames(); pNames = lNames.getConstArray(); c = lNames.getLength(); - + for (i=0; i<c; ++i) { ::rtl::OUString sTemp = pNames[i]; @@ -579,10 +579,10 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType lTargets.push_back(sTemp); } } - + // SAFE -> ---------------------------------- aWriteLock.lock(); - + m_xWorkingStorageShare = xShare ; m_xWorkingStorageNoLang= xNoLang; m_xWorkingStorageUser = xUser ; @@ -591,7 +591,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType m_sRelPathShare = sRelPathShare; m_sRelPathNoLang = sRelPathNoLang; m_sRelPathUser = sRelPathUser; - + aWriteLock.unlock(); // <- SAFE ---------------------------------- @@ -605,13 +605,13 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType } } -//----------------------------------------------- +//----------------------------------------------- void PresetHandler::copyPresetToTarget(const ::rtl::OUString& sPreset, const ::rtl::OUString& sTarget) { - // dont check our preset list, if element exists - // We try to open it and forward all errors to the user! - + // don't check our preset list, if element exists + // We try to open it and forward all errors to the user! + // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); css::uno::Reference< css::embed::XStorage > xWorkingShare = m_xWorkingStorageShare; @@ -625,13 +625,13 @@ void PresetHandler::copyPresetToTarget(const ::rtl::OUString& sPreset, (!xWorkingShare.is()) || (!xWorkingUser.is() ) ) - { + { return; } - + ::rtl::OUString sPresetFile(sPreset); sPresetFile += FILE_EXTENSION; - + ::rtl::OUString sTargetFile(sTarget); sTargetFile += FILE_EXTENSION; @@ -642,13 +642,13 @@ void PresetHandler::copyPresetToTarget(const ::rtl::OUString& sPreset, xWorkingUser->removeElement(sTargetFile); xWorkingShare->copyElementTo(sPresetFile, xWorkingUser, sTargetFile); - + // If our storages work in transacted mode, we have // to commit all changes from bottom to top! commitUserChanges(); } -//----------------------------------------------- +//----------------------------------------------- css::uno::Reference< css::io::XStream > PresetHandler::openPreset(const ::rtl::OUString& sPreset, sal_Bool bUseNoLangGlobal) { @@ -657,11 +657,11 @@ css::uno::Reference< css::io::XStream > PresetHandler::openPreset(const ::rtl::O css::uno::Reference< css::embed::XStorage > xFolder = bUseNoLangGlobal? m_xWorkingStorageNoLang: m_xWorkingStorageShare; aReadLock.unlock(); // <- SAFE ---------------------------------- - + // e.g. module without any config data ?! if (!xFolder.is()) return css::uno::Reference< css::io::XStream >(); - + ::rtl::OUString sFile(sPreset); sFile += FILE_EXTENSION; @@ -670,7 +670,7 @@ css::uno::Reference< css::io::XStream > PresetHandler::openPreset(const ::rtl::O return xStream; } -//----------------------------------------------- +//----------------------------------------------- css::uno::Reference< css::io::XStream > PresetHandler::openTarget(const ::rtl::OUString& sTarget , sal_Bool bCreateIfMissing) { @@ -679,14 +679,14 @@ css::uno::Reference< css::io::XStream > PresetHandler::openTarget(const ::rtl::O css::uno::Reference< css::embed::XStorage > xFolder = m_xWorkingStorageUser; aReadLock.unlock(); // <- SAFE ---------------------------------- - + // e.g. module without any config data ?! if (!xFolder.is()) return css::uno::Reference< css::io::XStream >(); - + ::rtl::OUString sFile(sTarget); sFile += FILE_EXTENSION; - + sal_Int32 nOpenMode = css::embed::ElementModes::READWRITE; if (!bCreateIfMissing) nOpenMode |= css::embed::ElementModes::NOCREATE; @@ -699,7 +699,7 @@ css::uno::Reference< css::io::XStream > PresetHandler::openTarget(const ::rtl::O return xStream; } catch(const css::uno::RuntimeException&) - { throw; } + { throw; } catch(const css::uno::Exception&) { xStream.clear(); } @@ -707,7 +707,7 @@ css::uno::Reference< css::io::XStream > PresetHandler::openTarget(const ::rtl::O // inform user about errors (use original exceptions!) nOpenMode &= ~css::embed::ElementModes::WRITE; xStream = xFolder->openStreamElement(sFile, nOpenMode); - + return xStream; } @@ -720,15 +720,15 @@ void PresetHandler::commitUserChanges() EConfigType eCfgType = m_eConfigType; aReadLock.unlock(); // <- SAFE ---------------------------------- - + // e.g. module without any config data ?! if (!xWorking.is()) return; - + ::rtl::OUString sPath; - + switch(eCfgType) - { + { case E_GLOBAL : case E_MODULES : { @@ -737,7 +737,7 @@ void PresetHandler::commitUserChanges() m_aSharedStorages->m_lStoragesUser.notifyPath(sPath); } break; - + case E_DOCUMENT : { sPath = m_lDocumentStorages.getPathOfStorage(xWorking); @@ -748,19 +748,19 @@ void PresetHandler::commitUserChanges() } } -//----------------------------------------------- +//----------------------------------------------- void PresetHandler::addStorageListener(IStorageListener* pListener) { // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); - ::rtl::OUString sRelPath = m_sRelPathUser; // use user path ... because we dont work directly on the share layer! + ::rtl::OUString sRelPath = m_sRelPathUser; // use user path ... because we don't work directly on the share layer! EConfigType eCfgType = m_eConfigType; aReadLock.unlock(); // <- SAFE ---------------------------------- if (!sRelPath.getLength()) return; - + switch(eCfgType) { case E_GLOBAL : @@ -769,7 +769,7 @@ void PresetHandler::addStorageListener(IStorageListener* pListener) m_aSharedStorages->m_lStoragesUser.addStorageListener(pListener, sRelPath); } break; - + case E_DOCUMENT : { m_lDocumentStorages.addStorageListener(pListener, sRelPath); @@ -778,19 +778,19 @@ void PresetHandler::addStorageListener(IStorageListener* pListener) } } -//----------------------------------------------- +//----------------------------------------------- void PresetHandler::removeStorageListener(IStorageListener* pListener) { // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); - ::rtl::OUString sRelPath = m_sRelPathUser; // use user path ... because we dont work directly on the share layer! + ::rtl::OUString sRelPath = m_sRelPathUser; // use user path ... because we don't work directly on the share layer! EConfigType eCfgType = m_eConfigType; aReadLock.unlock(); // <- SAFE ---------------------------------- if (!sRelPath.getLength()) return; - + switch(eCfgType) { case E_GLOBAL : @@ -799,7 +799,7 @@ void PresetHandler::removeStorageListener(IStorageListener* pListener) m_aSharedStorages->m_lStoragesUser.removeStorageListener(pListener, sRelPath); } break; - + case E_DOCUMENT : { m_lDocumentStorages.removeStorageListener(pListener, sRelPath); @@ -836,7 +836,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring ::std::vector< ::rtl::OUString >::const_iterator pFound = lLocalizedValues.end(); if (bAllowFallbacks) { - pFound = ::comphelper::Locale::getFallback(lLocalizedValues, aLocale.toISO()); + pFound = ::comphelper::Locale::getFallback(lLocalizedValues, aLocale.toISO()); } else { @@ -857,7 +857,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring const ::rtl::OUString& sISOLocale = *pFound; aLocale.fromISO(sISOLocale); } - + return pFound; } @@ -877,8 +877,8 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPat (pLocaleFolder == lSubFolders.end() ) && ((eMode & css::embed::ElementModes::NOCREATE) == css::embed::ElementModes::NOCREATE) ) - return css::uno::Reference< css::embed::XStorage >(); - + return css::uno::Reference< css::embed::XStorage >(); + // it doesn't matter, if there is a locale fallback or not // If creation of storages is allowed, we do it anyway. // Otherwise we have no acc config at all, which can make other trouble. @@ -896,7 +896,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPat sPath = sLocalizedPath; else sPath = ::rtl::OUString(); - + return xLocalePath; } @@ -912,7 +912,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPat const ::rtl::OUString* pNames = lNames.getConstArray(); sal_Int32 c = lNames.getLength(); sal_Int32 i = 0; - + for (i=0; i<c; ++i) { try @@ -929,5 +929,5 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPat return lSubFolders; } -//----------------------------------------------- +//----------------------------------------------- } // namespace framework diff --git a/main/framework/source/jobs/job.cxx b/main/framework/source/jobs/job.cxx index 8efd585..5600ffc 100644 --- a/main/framework/source/jobs/job.cxx +++ b/main/framework/source/jobs/job.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * 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 @@ -7,16 +7,16 @@ * 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 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -77,8 +77,8 @@ DEFINE_XTYPEPROVIDER_4( Job , //________________________________ /** @short standard ctor - @descr It initialize this new instance. But it set some generic parameters here only. - Specialized informations (e.g. the alias or service name ofthis job) will be set + @descr It initializes this new instance. But it sets some generic parameters here only. + Specialized informations (e.g. the alias or service name of this job) will be set later using the method setJobData(). @param xSMGR @@ -107,8 +107,8 @@ Job::Job( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& x //________________________________ /** @short standard ctor - @descr It initialize this new instance. But it set some generic parameters here only. - Specialized informations (e.g. the alias or service name ofthis job) will be set + @descr It initializes this new instance. But it sets some generic parameters here only. + Specialized informations (e.g. the alias or service name of this job) will be set later using the method setJobData(). @param xSMGR @@ -136,7 +136,7 @@ Job::Job( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& x //________________________________ /** - @short superflous! + @short superfluous! @descr Releasing of memory and reference must be done inside die() call. Otherwise it's a bug. */ @@ -199,7 +199,7 @@ void Job::setJobData( const JobData& aData ) @short runs the job @descr It doesn't matter, if the job is an asynchronous or synchronous one. This method returns only if it was finished - or cancelled. + or canceled. @param lDynamicArgs optional arguments for job execution @@ -234,13 +234,13 @@ void Job::execute( /*IN*/ const css::uno::Sequence< css::beans::NamedValue >& lD { // create the job // We must check for the supported interface on demand! - // But we preferr the synchronous one ... + // But we prefer the synchronous one ... m_xJob = m_xSMGR->createInstance(m_aJobCfg.getService()); xSJob = css::uno::Reference< css::task::XJob >(m_xJob, css::uno::UNO_QUERY); if (!xSJob.is()) xAJob = css::uno::Reference< css::task::XAsyncJob >(m_xJob, css::uno::UNO_QUERY); - // execute it asynchron + // execute it asynchronous if (xAJob.is()) { m_aAsyncWait.reset(); @@ -254,7 +254,7 @@ void Job::execute( /*IN*/ const css::uno::Sequence< css::beans::NamedValue >& lD /* SAFE { */ // Note: Result handling was already done inside the callback! } - // execute it synchron + // execute it synchronous else if (xSJob.is()) { aWriteLock.unlock(); @@ -330,9 +330,9 @@ void Job::execute( /*IN*/ const css::uno::Sequence< css::beans::NamedValue >& lD @short kill this job @descr It doesn't matter if this request is called from inside or from outside. We release our internal structures and stop - avary activity. After doing so - this instance will not be - useable any longer! Of course we try to handle further requests - carefully. May somehwere else hold a reference to us ... + every activity. After doing so - this instance will not be + usable any longer! Of course we try to handle further requests + carefully. Maybe somewhere else hold a reference to us ... */ void Job::die() { @@ -375,8 +375,8 @@ void Job::die() /** @short generates list of arguments for job execute @descr There exist a set of informations, which can be needed by a job. - a) it's static configuration data (Equals for all jobs. ) - b) it's specific configuration data (Different for every job.) + a) its static configuration data (Equals for all jobs. ) + b) its specific configuration data (Different for every job.) c) some environment values (e.g. the frame, for which this job was started) d) any other dynamic data (e.g. parameters of a dispatch() request) We collect all these informations and generate one list which include all others. @@ -398,7 +398,7 @@ css::uno::Sequence< css::beans::NamedValue > Job::impl_generateJobArgs( /*IN*/ c JobData::EMode eMode = m_aJobCfg.getMode(); // Create list of environment variables. This list must be part of the - // returned structure everytimes ... but some of its members are opetional! + // returned structure every time ... but some of its members are optional! css::uno::Sequence< css::beans::NamedValue > lEnvArgs(1); lEnvArgs[0].Name = ::rtl::OUString::createFromAscii(JobData::PROP_ENVTYPE); lEnvArgs[0].Value <<= m_aJobCfg.getEnvironmentDescriptor(); @@ -542,17 +542,17 @@ void Job::impl_reactForJobResult( /*IN*/ const css::uno::Any& aResult ) /** @short starts listening for office shutdown and closing of our given target frame (if its a valid reference) - @descr We will reghister ourself as terminate listener + @descr We will register ourself as terminate listener at the global desktop instance. That will hold us alive and additional we get the information, if the - office whish to shutdown. If then an internal job + office wishes to shutdown. If then an internal job is running we will have the chance to suppress that by throwing a veto exception. If our internal wrapped job finished his work, we can release this listener connection. Further we are listener for closing of the (possible valid) - given frame. We must be sure, that this ressource won't be gone + given frame. We must be sure, that this resource won't be gone if our internal job is still running. */ void Job::impl_startListening() @@ -699,7 +699,7 @@ void Job::impl_stopListening() the job, which was running and inform us now @param aResult - it's results + its results */ void SAL_CALL Job::jobFinished( /*IN*/ const css::uno::Reference< css::task::XAsyncJob >& xJob , /*IN*/ const css::uno::Any& aResult ) throw(css::uno::RuntimeException) @@ -708,7 +708,7 @@ void SAL_CALL Job::jobFinished( /*IN*/ const css::uno::Reference< css::task::XAs WriteGuard aWriteLock(m_aLock); // It's necessary to check this. - // May this job was cancelled by any other reason + // May this job was canceled by any other reason // some milliseconds before. :-) if (m_xJob.is() && m_xJob==xJob) { @@ -721,7 +721,7 @@ void SAL_CALL Job::jobFinished( /*IN*/ const css::uno::Reference< css::task::XAs m_xJob = css::uno::Reference< css::uno::XInterface >(); } - // And let the start method "execute()" finishing it's job. + // And let the start method "execute()" finishing its job. // But do it every time. So any outside blocking code can finish // his work too. m_aAsyncWait.set(); @@ -737,7 +737,7 @@ void SAL_CALL Job::jobFinished( /*IN*/ const css::uno::Reference< css::task::XAs If the internal wrapped job is still in progress, we disagree with that by throwing the right veto exception. If not - we agree. But then we must be aware, that another event notifyTermination() can follow. Then we have no chance to do the same. Then we have to - accept that and stop our work instandly. + accept that and stop our work instantly. @param aEvent describes the broadcaster and must be the desktop instance @@ -751,7 +751,7 @@ void SAL_CALL Job::queryTermination( /*IN*/ const css::lang::EventObject& ) thro /* SAFE { */ ReadGuard aReadLock(m_aLock); - // don't disagree with this request if job was already stopped or finished it's work + // don't disagree with this request if job was already stopped or finished its work // if (m_eRunState != E_RUNNING) // return; @@ -784,10 +784,10 @@ void SAL_CALL Job::queryTermination( /*IN*/ const css::lang::EventObject& ) thro @descr Instead of the method queryTermination(), here is no chance to disagree with that. We have to accept it and cancel all current processes inside. It can occur only if job was not already started if queryTermination() was called here .. - Then we had not throwed a veto exception. But now we must agree with this situation and break + Then we had not thrown a veto exception. But now we must agree with this situation and break all our internal processes. Its not a good idea to mark this instance as non startable any longer - inside queryTermination() if no job was unning too. Because that would disable this job and may - the office does not really shutdownm, because another listener has thrown the suitable exception. + inside queryTermination() if no job was running too. Because that would disable this job and may + the office does not really shutdown, because another listener has thrown the suitable exception. @param aEvent describes the broadcaster and must be the desktop instance @@ -805,13 +805,13 @@ void SAL_CALL Job::notifyTermination( /*IN*/ const css::lang::EventObject& ) thr If the internal wrapped job is still in progress, we disagree with that by throwing the right veto exception. If not - we agree. But then we must be aware, that another event notifyClosing() can follow. Then we have no chance to do the same. Then we have to - accept that and stop our work instandly. + accept that and stop our work instantly. @param aEvent describes the broadcaster and must be the frame instance @param bGetsOwnerShip - If it's set to <sal_True> and we throw the right veto excepion, we have to close this frame later + If it's set to <sal_True> and we throw the right veto exception, we have to close this frame later if our internal processes will be finished. If it's set to <FALSE/> we can ignore it. @throw CloseVetoException @@ -864,7 +864,7 @@ void SAL_CALL Job::queryClosing( const css::lang::EventObject& aEvent , { // analyze event source - to find out, which resource called queryClosing() at this // job wrapper. We must bind a "pending close" request to this resource. - // Closing of the corresponding resource will be done if our internal job finish it's work. + // Closing of the corresponding resource will be done if our internal job finish its work. m_bPendingCloseFrame = (m_xFrame.is() && aEvent.Source == m_xFrame); m_bPendingCloseModel = (m_xModel.is() && aEvent.Source == m_xModel); @@ -876,8 +876,8 @@ void SAL_CALL Job::queryClosing( const css::lang::EventObject& aEvent , // No veto ... // But don't call die() here or free our internal member. // This must be done inside notifyClosing() only. Otherwise the - // might stopped job has no chance to return it's results or - // call us back. We must give him the chance to finish it's work successfully. + // might stopped job has no chance to return its results or + // call us back. We must give him the chance to finish its work successfully. aWriteLock.unlock(); /* } SAFE */ @@ -895,7 +895,7 @@ void SAL_CALL Job::queryClosing( const css::lang::EventObject& aEvent , void SAL_CALL Job::notifyClosing( const css::lang::EventObject& ) throw(css::uno::RuntimeException) { die(); - // Do nothing else here. Our internal ressources was released ... + // Do nothing else here. Our internal resource was released ... } //________________________________ @@ -934,7 +934,7 @@ void SAL_CALL Job::disposing( const css::lang::EventObject& aEvent ) throw(css:: /* } SAFE */ die(); - // Do nothing else here. Our internal ressources was released ... + // Do nothing else here. Our internal resource was released ... } } // namespace framework diff --git a/main/framework/source/services/autorecovery.cxx b/main/framework/source/services/autorecovery.cxx index 249e2ea..1391792 100644 --- a/main/framework/source/services/autorecovery.cxx +++ b/main/framework/source/services/autorecovery.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * 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 @@ -7,16 +7,16 @@ * 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 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -223,7 +223,7 @@ static const sal_Int32 GIVE_UP_RETRY = 1; // in #define MIN_TIME_FOR_USER_IDLE 10000 // 10s user idle -// enable the following defines in case you whish to simulate a full disc for debug purposes .-) +// enable the following defines in case you wish to simulate a full disc for debug purposes .-) // this define throws every time a document is stored or a configuration change // should be flushed an exception ... so the special error handler for this scenario is triggered @@ -350,8 +350,8 @@ class CacheLockGuard { private: - // holds the outside calli alive, so it's shared resources - // are valid everytimes + // holds the outside calli alive, so its shared resources + // are valid every time css::uno::Reference< css::uno::XInterface > m_xOwner; // mutex shared with outside calli ! @@ -554,7 +554,7 @@ DEFINE_INIT_SERVICE( implts_startListening(); // establish callback for our internal used timer. - // Note: Its only active, if the timer will be started ... + // Note: It's only active, if the timer will be started ... m_aTimer.SetTimeoutHdl(LINK(this, AutoRecovery, implts_timerExpired)); /* DbgListener* pListener = new DbgListener(); @@ -635,18 +635,18 @@ void SAL_CALL AutoRecovery::dispatch(const css::util::URL& } // disable/enable AutoSave for this office session only - // independend from the configuration entry. + // independent from the configuration entry. if ((eNewJob & AutoRecovery::E_SET_AUTOSAVE_STATE) == AutoRecovery::E_SET_AUTOSAVE_STATE) { sal_Bool bOn = lArgs.getUnpackedValueOrDefault(PROP_AUTOSAVE_STATE, (sal_Bool)sal_True); if (bOn) { - // dont enable AutoSave hardly ! + // don't enable AutoSave hardly ! // reload configuration to know the current state. implts_readAutoSaveConfig(); implts_updateTimer(); // can it happen that might be the listener was stopped ? .-) - // make sure it runs always ... even if AutoSave itself was disabled temporarly. + // make sure it runs always ... even if AutoSave itself was disabled temporarily. implts_startListening(); } else @@ -685,7 +685,7 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) aWriteLock.unlock(); // <- SAFE ---------------------------------- - // in case a new dispatch overwrites a may ba active AutoSave session + // in case a new dispatch overwrites a maybe active AutoSave session // we must restore this session later. see below ... sal_Bool bWasAutoSaveActive = ((eJob & AutoRecovery::E_AUTO_SAVE) == AutoRecovery::E_AUTO_SAVE); @@ -1018,7 +1018,7 @@ void SAL_CALL AutoRecovery::disposing(const css::lang::EventObject& aEvent) css::uno::Reference< css::frame::XModel > xDocument(aEvent.Source, css::uno::UNO_QUERY); if (xDocument.is()) { - implts_deregisterDocument(xDocument, sal_False); // sal_False => dont call removeEventListener() .. because it's not needed here + implts_deregisterDocument(xDocument, sal_False); // sal_False => don't call removeEventListener() .. because it's not needed here return; } @@ -1038,7 +1038,7 @@ css::uno::Reference< css::container::XNameAccess > AutoRecovery::implts_openConf aWriteLock.unlock(); // <- SAFE ---------------------------------- - // throws a RuntimeException if an error occure! + // throws a RuntimeException if an error occurs! css::uno::Reference< css::container::XNameAccess > xCFG( ::comphelper::ConfigurationHelper::openConfig(xSMGR, CFG_PACKAGE_RECOVERY, ::comphelper::ConfigurationHelper::E_STANDARD), css::uno::UNO_QUERY); @@ -1062,7 +1062,7 @@ css::uno::Reference< css::container::XNameAccess > AutoRecovery::implts_openConf } catch(const css::uno::Exception&) { - // These config keys are not sooooo important, that + // These config keys are not so important, that // we are interested on errors here really .-) nMinSpaceDocSave = MIN_DISCSPACE_DOCSAVE; nMinSpaceConfigSave = MIN_DISCSPACE_CONFIGSAVE; @@ -1373,7 +1373,7 @@ void AutoRecovery::implts_flushConfigItem(const AutoRecovery::TDocumentInfo& rIn if (bRemoveIt) { // Catch NoSuchElementException. - // Its not a good idea inside multithreaded environments to call hasElement - removeElement. + // It's not a good idea inside multithreaded environments to call hasElement - removeElement. // DO IT! try { @@ -1501,8 +1501,8 @@ void AutoRecovery::implts_stopListening() { // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); - // Attention: Dont reset our internal members here too. - // May be we must work with our configuration, but dont wish to be informed + // Attention: Don't reset our internal members here too. + // May be we must work with our configuration, but don't wish to be informed // about changes any longer. Needed e.g. during EMERGENCY_SAVE! css::uno::Reference< css::util::XChangesNotifier > xCFG (m_xRecoveryCFG , css::uno::UNO_QUERY); css::uno::Reference< css::document::XEventBroadcaster > xGlobalEventBroadcaster(m_xNewDocBroadcaster, css::uno::UNO_QUERY); @@ -1567,7 +1567,7 @@ void AutoRecovery::implts_updateTimer() WriteGuard aWriteLock(m_aLock); if ( - (m_eJob == AutoRecovery::E_NO_JOB ) || // TODO may be superflous - E_DONT_START_TIMER should be used only + (m_eJob == AutoRecovery::E_NO_JOB ) || // TODO may be superfluous - E_DONT_START_TIMER should be used only (m_eTimerType == AutoRecovery::E_DONT_START_TIMER) ) return; @@ -1639,7 +1639,7 @@ IMPL_LINK(AutoRecovery, implts_timerExpired, void*, EMPTYARG) aReadLock.unlock(); // <- SAFE ---------------------------------- - // check some "states", where its not allowed (better: not a good idea) to + // check some "states", where it's not allowed (better: not a good idea) to // start an AutoSave. (e.g. if the user makes drag & drop ...) // Then we poll till this "disallowed" state is gone. sal_Bool bAutoSaveNotAllowed = Application::IsUICaptured(); @@ -1744,12 +1744,12 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // Can happen if events came in asynchronous on recovery time. // Then our cache was filled from the configuration ... but now we get some // asynchronous events from the global event broadcaster. We must be sure that - // we dont add the same document more then once. + // we don't add the same document more then once. AutoRecovery::TDocumentList::iterator pIt = AutoRecovery::impl_searchDocument(m_lDocCache, xDocument); if (pIt != m_lDocCache.end()) { // Normally nothing must be done for this "late" notification. - // But maybe the modified state was changed inbetween. + // But maybe the modified state was changed in between. // Check it ... implts_updateModifiedState(xDocument); return; @@ -1760,7 +1760,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame ::comphelper::MediaDescriptor lDescriptor(xDocument->getArgs()); // check if this document must be ignored for recovery ! - // Some use cases dont wish support for AutoSave/Recovery ... as e.g. OLE-Server / ActiveX Control etcpp. + // Some use cases don't wish support for AutoSave/Recovery ... as e.g. OLE-Server / ActiveX Control etcpp. sal_Bool bNoAutoSave = lDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_NOAUTOSAVE(), (sal_Bool)(sal_False)); if (bNoAutoSave) return; @@ -1786,7 +1786,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame AutoRecovery::TDocumentInfo aNew; aNew.Document = xDocument; - // TODO replace getLocation() with getURL() ... its a workaround currently only! + // TODO replace getLocation() with getURL() ... it's a workaround currently only! css::uno::Reference< css::frame::XStorable > xDoc(aNew.Document, css::uno::UNO_QUERY_THROW); aNew.OrgURL = xDoc->getLocation(); @@ -1803,8 +1803,8 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame implts_specifyAppModuleAndFactory(aNew); // Hack! Check for "illegal office documents" ... as e.g. the Basic IDE - // Its not really a full featured office document. It doesn't provide an URL, any filter, a factory URL etcpp. - // TODO file bug to Basci IDE developers. They must remove the office document API from its service. + // It's not really a full featured office document. It doesn't provide an URL, any filter, a factory URL etcpp. + // TODO file bug to Basic IDE developers. They must remove the office document API from its service. if ( (!aNew.OrgURL.getLength() ) && (!aNew.FactoryURL.getLength()) @@ -1868,7 +1868,7 @@ void AutoRecovery::implts_deregisterDocument(const css::uno::Reference< css::fra // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); - // Attention: Dont leave SAFE section, if you work with pIt! + // Attention: Don't leave SAFE section, if you work with pIt! // Because it points directly into the m_lDocCache list ... CacheLockGuard aCacheLock(this, m_aLock, m_nDocCacheLock, LOCK_FOR_CACHE_USE); @@ -1923,7 +1923,7 @@ void AutoRecovery::implts_markDocumentModifiedAgainstLastBackup(const css::uno:: AutoRecovery::TDocumentInfo& rInfo = *pIt; /* Now we know, that this document was modified again and must be saved next time. - But we dont need this information for every e.g. key input of the user. + But we don't need this information for every e.g. key input of the user. So we stop listening here. But if the document was saved as temp. file we start listening for this event again. */ @@ -1999,7 +1999,7 @@ void AutoRecovery::implts_markDocumentAsSaved(const css::uno::Reference< css::fr AutoRecovery::TDocumentInfo& rInfo = *pIt; rInfo.DocumentState = AutoRecovery::E_UNKNOWN; - // TODO replace getLocation() with getURL() ... its a workaround currently only! + // TODO replace getLocation() with getURL() ... it's a workaround currently only! css::uno::Reference< css::frame::XStorable > xDoc(rInfo.Document, css::uno::UNO_QUERY); rInfo.OrgURL = xDoc->getLocation(); @@ -2136,7 +2136,7 @@ void AutoRecovery::implts_prepareSessionShutdown() AutoRecovery::TDocumentInfo& rInfo = *pIt; // WORKAROUND... Since the documents are not closed the lock file must be removed explicitly - // it is not done on documents saving since shutdown can be cancelled + // it is not done on documents saving since shutdown can be canceled lc_removeLockFile( rInfo ); // Prevent us from deregistration of these documents. @@ -2151,7 +2151,7 @@ void AutoRecovery::implts_prepareSessionShutdown() implts_stopModifyListeningOnDoc(rInfo); // if the session save is still running the documents should not be thrown away, - // actually that would be a bad sign, that means that the SessionManager tryes + // actually that would be a bad sign, that means that the SessionManager tries // to kill the session before the saving is ready if ((m_eJob & AutoRecovery::E_SESSION_SAVE) != AutoRecovery::E_SESSION_SAVE) { @@ -2198,8 +2198,8 @@ void AutoRecovery::implts_prepareSessionShutdown() But sometimes XModel->getArgs() does not contained this information if implts_registerDocument() was called. So we have to check a second time, if this property is set .... - Best place doing so is to check it immeditaly before saving - and supressingd saving the document then. + Best place doing so is to check it immediately before saving + and suppressing saving the document then. Of course removing the corresponding cache entry isn't an option. Because it would disturb iteration over the cache ! So we ignore such documents only ... @@ -2247,7 +2247,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAl // We return a suggestion for an active timer only. // It will be ignored if the timer was disabled by the user ... // Further this state can be set to USER_IDLE only later in this method. - // Its not allowed to reset such state then. Because we must know, if + // It's not allowed to reset such state then. Because we must know, if // there exists POSTPONED documents. see below ... AutoRecovery::ETimerType eTimer = AutoRecovery::E_NORMAL_AUTOSAVE_INTERVALL; @@ -2430,7 +2430,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& // for make hyperlinks working lNewArgs[::comphelper::MediaDescriptor::PROP_DOCUMENTBASEURL()] <<= ::rtl::OUString(); - // try to save this document as a new temp file everytimes. + // try to save this document as a new temp file every time. // Mark AutoSave state as "INCOMPLETE" if it failed. // Because the last temp file is to old and does not include all changes. Reference< XDocumentRecovery > xDocRecover(rInfo.Document, css::uno::UNO_QUERY_THROW); @@ -2485,7 +2485,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& if (! bError) { - // safe the state about success + // save the state about success // ... you know the reason: to know it on recovery time if next line crash .-) rInfo.DocumentState &= ~AutoRecovery::E_TRY_SAVE; rInfo.DocumentState |= AutoRecovery::E_HANDLED; @@ -2493,7 +2493,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& } else { - // safe the state about error ... + // save the state about error ... rInfo.NewTempURL = ::rtl::OUString(); rInfo.DocumentState &= ~AutoRecovery::E_TRY_SAVE; rInfo.DocumentState |= AutoRecovery::E_HANDLED; @@ -2537,7 +2537,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa AutoRecovery::TDocumentInfo& rInfo = *pIt; // Such documents are already loaded by the last loop. - // Dont check E_SUCCEDED here! Its may be the final state of an AutoSave + // Don't check E_SUCCEDED here! It may be the final state of an AutoSave // operation before!!! if ((rInfo.DocumentState & AutoRecovery::E_HANDLED) == AutoRecovery::E_HANDLED) continue; @@ -2545,7 +2545,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa // a1,b1,c1,d2,e2,f2) if ((rInfo.DocumentState & AutoRecovery::E_DAMAGED) == AutoRecovery::E_DAMAGED) { - // dont forget to inform listener! May be this document was + // don't forget to inform listener! May be this document was // damaged on last saving time ... // Then our listener need this notification. // If it was damaged during last "try to open" ... @@ -2561,7 +2561,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa ::comphelper::MediaDescriptor lDescriptor; - // its an UI feature - so the "USER" itself must be set as referer + // it's an UI feature - so the "USER" itself must be set as referrer lDescriptor[::comphelper::MediaDescriptor::PROP_REFERRER()] <<= REFERRER_USER; lDescriptor[::comphelper::MediaDescriptor::PROP_SALVAGEDFILE()] <<= ::rtl::OUString(); @@ -2582,7 +2582,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa if (!bOriginalWasTried) { rInfo.DocumentState |= AutoRecovery::E_INCOMPLETE; - // try original URL ... ! dont continue with next item here ... + // try original URL ... ! don't continue with next item here ... } else { @@ -2707,7 +2707,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa implts_startModifyListeningOnDoc(rInfo); // SAFE -> ------------------------------ - // Needed for next loop. Dont unlock it again! + // Needed for next loop. Don't unlock it again! aWriteLock.lock(); } @@ -2854,7 +2854,7 @@ void AutoRecovery::implts_generateNewTempURL(const ::rtl::OUString& // In case we are asked to save unmodified documents too - and one of them // is an empty one (because it was new created using e.g. an URL private:factory/...) // we should not save it really. Then we put the information about such "empty document" - // into the configuration and dont create any recovery file on disk. + // into the configuration and don't create any recovery file on disk. // We use the title of the document to make it unique. ::rtl::OUStringBuffer sUniqueName; if (rInfo.OrgURL.getLength()) @@ -2870,7 +2870,7 @@ void AutoRecovery::implts_generateNewTempURL(const ::rtl::OUString& sUniqueName.appendAscii("untitled"); sUniqueName.appendAscii("_"); - // TODO: Must we strip some illegal signes - if we use the title? + // TODO: Must we strip some illegal signs - if we use the title? String sName (sUniqueName.makeStringAndClear()); String sExtension(rInfo.Extension ); @@ -2914,7 +2914,7 @@ void AutoRecovery::implts_informListener( sal_Int32 eJ sFeature.append(CMD_PROTOCOL); // Attention: Because "eJob" is used as a flag field the order of checking these - // flags is importent. We must preferr job with higher priorities! + // flags is important. We must prefer job with higher priorities! // E.g. EmergencySave has an higher prio then AutoSave ... // On the other side there exist a well defined order between two different jobs. // e.g. PrepareEmergencySave must be done before EmergencySave is started of course. @@ -3063,7 +3063,7 @@ void AutoRecovery::implts_prepareEmergencySave() //----------------------------------------------- void AutoRecovery::implts_doEmergencySave(const DispatchParams& aParams) { - // Write a hint "we chrashed" into the configuration, so + // Write a hint "we crashed" into the configuration, so // the error report tool is started too in case no recovery // documents exists and was saved. ::comphelper::ConfigurationHelper::writeDirectKey( @@ -3144,7 +3144,7 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) // Be sure to know all open documents really .-) implts_verifyCacheAgainstDesktopDocumentList(); - // for all docs, store their current view/names in the configurtion + // for all docs, store their current view/names in the configuration implts_persistAllActiveViewNames(); // The called method for saving documents runs @@ -3188,7 +3188,7 @@ void AutoRecovery::implts_doSessionQuietQuit(const DispatchParams& /*aParams*/) // confusing for the user AutoRecovery::st_impl_removeLockFile(); - // reset all modified documents, so the dont show any UI on closing ... + // reset all modified documents, so the don't show any UI on closing ... // and close all documents, so we can shutdown the OS! implts_prepareSessionShutdown(); @@ -3275,7 +3275,7 @@ void AutoRecovery::implts_backupWorkingEntry(const DispatchParams& aParams) // TODO: Check eResult and react for errors (InteractionHandler!?) // Currently we ignore it ... - // DONT UPDATE THE CACHE OR REMOVE ANY TEMP. FILES FROM DISK. + // DON'T UPDATE THE CACHE OR REMOVE ANY TEMP. FILES FROM DISK. // That has to be forced from outside explicitly. // See implts_cleanUpWorkingEntry() for further details. } @@ -3300,7 +3300,7 @@ void AutoRecovery::implts_cleanUpWorkingEntry(const DispatchParams& aParams) implts_flushConfigItem(rInfo, sal_True); // sal_True => remove it from xml config! m_lDocCache.erase(pIt); - break; /// !!! pIt is not defined any longer ... further this function has finished it's work + break; /// !!! pIt is not defined any longer ... further this function has finished its work } } @@ -3493,7 +3493,7 @@ void AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList() { continue; } // We are interested on visible documents only. - // Note: It's n optional interface .-( + // Note: It's an optional interface .-( css::uno::Reference< css::awt::XWindow2 > xVisibleCheck( xFrame->getContainerWindow(), css::uno::UNO_QUERY); @@ -3518,8 +3518,8 @@ void AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList() // insert model into cache ... // If the model is already well known inside cache - // it's information set will be updated by asking the - // model again for it's new states. + // its information set will be updated by asking the + // model again for its new states. implts_registerDocument(xModel); } } @@ -3610,7 +3610,7 @@ void AutoRecovery::impl_establishProgress(const AutoRecovery::TDocumentInfo& css::uno::Reference< css::task::XStatusIndicator >() ); // Normally a progress is set from outside (e.g. by the CrashSave/Recovery dialog, which uses our dispatch API). - // But for a normal auto save we dont have such "external progress"... because this function is triggered by our own timer then. + // But for a normal auto save we don't have such "external progress"... because this function is triggered by our own timer then. // In such case we must create our own progress ! if ( (! xExternalProgress.is()) && @@ -3624,11 +3624,11 @@ void AutoRecovery::impl_establishProgress(const AutoRecovery::TDocumentInfo& // HACK // An external provided progress (most given by the CrashSave/Recovery dialog) - // must be preferred. But we know that some application filters query it's own progress instance + // must be preferred. But we know that some application filters query its own progress instance // at the frame method Frame::createStatusIndicator(). // So we use a two step mechanism: // 1) we set the progress inside the MediaDescriptor, which will be provided to the filter - // 2) and we set a special Frame property, which overwrites the normal behaviour of Frame::createStatusIndicator .-) + // 2) and we set a special Frame property, which overwrites the normal behavior of Frame::createStatusIndicator .-) // But we suppress 2) in case we uses an internal progress. Because then it doesn't matter // if our applications make it wrong. In such case the internal progress resists at the same frame // and there is no need to forward progress activities to e.g. an outside dialog .-) @@ -3643,7 +3643,7 @@ void AutoRecovery::impl_establishProgress(const AutoRecovery::TDocumentInfo& } // But inside the MediaDescriptor we must set our own create progress ... - // in case there is not already anothe rprogress set. + // in case there is not already another progress set. rArgs.createItemIfMissing(::comphelper::MediaDescriptor::PROP_STATUSINDICATOR(), xInternalProgress); } diff --git a/main/sal/osl/w32/module.cxx b/main/sal/osl/w32/module.cxx index cb01084..7774b2e 100644 --- a/main/sal/osl/w32/module.cxx +++ b/main/sal/osl/w32/module.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * 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 @@ -7,16 +7,16 @@ * 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 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -35,7 +35,7 @@ #include <vector> /* - under WIN32, we use the void* oslModule + under WIN32, we use the void* oslModule as a WIN32 HANDLE (which is also a 32-bit value) */ @@ -44,18 +44,18 @@ /*****************************************************************************/ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMode ) { - HINSTANCE hInstance; + HINSTANCE hInstance; UINT errorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); rtl_uString* Module = NULL; oslModule ret = 0; oslFileError nError; - - RTL_LOGFILE_TRACE1( "{ osl_loadModule start: %S", (LPTSTR)&strModuleName->buffer ); + + RTL_LOGFILE_TRACE1( "{ osl_loadModule start: %S", (LPTSTR)&strModuleName->buffer ); OSL_ASSERT(strModuleName); - nRtldMode = nRtldMode; /* avoid warnings */ - + nRtldMode = nRtldMode; /* avoid warnings */ + nError = osl_getSystemPathFromFileURL(strModuleName, &Module); if ( osl_File_E_None != nError ) @@ -63,19 +63,19 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMod hInstance = LoadLibraryW(reinterpret_cast<LPCWSTR>(Module->buffer)); - if (hInstance == NULL) - hInstance = LoadLibraryExW(reinterpret_cast<LPCWSTR>(Module->buffer), NULL, + if (hInstance == NULL) + hInstance = LoadLibraryExW(reinterpret_cast<LPCWSTR>(Module->buffer), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); //In case of long path names (\\?\c:\...) try to shorten the filename. //LoadLibrary cannot handle file names which exceed 260 letters. - //In case the path is to long, the function will fail. However, the error - //code can be different. For example, it returned ERROR_FILENAME_EXCED_RANGE - //on Windows XP and ERROR_INSUFFICIENT_BUFFER on Windows 7 (64bit) + //In case the path is to long, the function will fail. However, the error + //code can be different. For example, it returned ERROR_FILENAME_EXCED_RANGE + //on Windows XP and ERROR_INSUFFICIENT_BUFFER on Windows 7 (64bit) if (hInstance == NULL && Module->length > 260) { std::vector<WCHAR> vec(Module->length + 1); - DWORD len = GetShortPathNameW(reinterpret_cast<LPCWSTR>(Module->buffer), + DWORD len = GetShortPathNameW(reinterpret_cast<LPCWSTR>(Module->buffer), &vec[0], Module->length + 1); if (len ) { @@ -95,7 +95,7 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMod rtl_uString_release(Module); SetErrorMode(errorMode); - RTL_LOGFILE_TRACE1( "} osl_loadModule end: %S", (LPTSTR)&strModuleName->buffer ); + RTL_LOGFILE_TRACE1( "} osl_loadModule end: %S", (LPTSTR)&strModuleName->buffer ); return ret; } @@ -116,24 +116,24 @@ oslModule SAL_CALL osl_loadAsciiModule( const sal_Char* pModuleName, sal_Int32 n /* osl_getModuleHandle */ /*****************************************************************************/ -sal_Bool SAL_CALL +sal_Bool SAL_CALL osl_getModuleHandle(rtl_uString *pModuleName, oslModule *pResult) { - HINSTANCE hInstance = GetModuleHandleW(reinterpret_cast<LPCWSTR>(pModuleName->buffer)); - if( hInstance ) - { - *pResult = (oslModule) hInstance; - return sal_True; - } - - return sal_False; + HINSTANCE hInstance = GetModuleHandleW(reinterpret_cast<LPCWSTR>(pModuleName->buffer)); + if( hInstance ) + { + *pResult = (oslModule) hInstance; + return sal_True; + } + + return sal_False; } /*****************************************************************************/ /* osl_unloadModule */ /*****************************************************************************/ void SAL_CALL osl_unloadModule(oslModule Module) -{ +{ FreeLibrary((HINSTANCE)Module); } @@ -143,8 +143,8 @@ void SAL_CALL osl_unloadModule(oslModule Module) void* SAL_CALL osl_getSymbol(oslModule Module, rtl_uString *strSymbolName) { /* casting from a function pointer to a data pointer is invalid - be in this case unavoidable because the API has to stay - compitable we need to keep this function which returns a + be in this case unavoidable because the API has to stay + compatible we need to keep this function which returns a void* by definition */ #ifdef _MSC_VER #pragma warning(push) @@ -160,17 +160,17 @@ void* SAL_CALL osl_getSymbol(oslModule Module, rtl_uString *strSymbolName) /* osl_getFunctionSymbol */ /*****************************************************************************/ oslGenericFunction SAL_CALL osl_getFunctionSymbol( oslModule Module, rtl_uString *strSymbolName ) -{ - rtl_String *symbolName = NULL; +{ + rtl_String *symbolName = NULL; oslGenericFunction address; OSL_ASSERT(Module); OSL_ASSERT(strSymbolName); - rtl_uString2String( - &symbolName, - strSymbolName->buffer, - strSymbolName->length, + rtl_uString2String( + &symbolName, + strSymbolName->buffer, + strSymbolName->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS ); @@ -178,21 +178,21 @@ oslGenericFunction SAL_CALL osl_getFunctionSymbol( oslModule Module, rtl_uString address=osl_getAsciiFunctionSymbol(Module, rtl_string_getStr(symbolName)); rtl_string_release(symbolName); - return address; + return address; } /*****************************************************************************/ /* osl_getAsciiFunctionSymbol */ /*****************************************************************************/ -oslGenericFunction SAL_CALL +oslGenericFunction SAL_CALL osl_getAsciiFunctionSymbol( oslModule Module, const sal_Char *pSymbol ) { oslGenericFunction fncAddr = NULL; - - if( pSymbol ) - fncAddr=(oslGenericFunction)GetProcAddress((HINSTANCE) Module, pSymbol); - - return fncAddr; + + if( pSymbol ) + fncAddr=(oslGenericFunction)GetProcAddress((HINSTANCE) Module, pSymbol); + + return fncAddr; } @@ -232,24 +232,24 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_Windows( void *pv, rtl_uString if ( lpfnCreateToolhelp32Snapshot && lpfnModule32First && lpfnModule32Next ) { - HANDLE hModuleSnap = NULL; + HANDLE hModuleSnap = NULL; DWORD dwProcessId = GetCurrentProcessId(); - - // Take a snapshot of all modules in the specified process. - hModuleSnap = lpfnCreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessId ); + // Take a snapshot of all modules in the specified process. + + hModuleSnap = lpfnCreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessId ); if ( INVALID_HANDLE_VALUE != hModuleSnap ) { - MODULEENTRY32 me32 = {0}; + MODULEENTRY32 me32 = {0}; + + // Fill the size of the structure before using it. - // Fill the size of the structure before using it. + me32.dwSize = sizeof(MODULEENTRY32); - me32.dwSize = sizeof(MODULEENTRY32); - - // Walk the module list of the process, and find the module of - // interest. Then copy the information to the buffer pointed - // to by lpMe32 so that it can be returned to the caller. + // Walk the module list of the process, and find the module of + // interest. Then copy the information to the buffer pointed + // to by lpMe32 so that it can be returned to the caller. if ( lpfnModule32First(hModuleSnap, &me32) ) { @@ -260,7 +260,7 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_Windows( void *pv, rtl_uString rtl_uString *ustrSysPath = NULL; rtl_string2UString( &ustrSysPath, me32.szExePath, strlen(me32.szExePath), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS ); - OSL_ASSERT(ustrSysPath != NULL); + OSL_ASSERT(ustrSysPath != NULL); osl_getFileURLFromSystemPath( ustrSysPath, pustrURL ); rtl_uString_release( ustrSysPath ); @@ -271,11 +271,11 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_Windows( void *pv, rtl_uString } - // Do not forget to clean up the snapshot object. + // Do not forget to clean up the snapshot object. - CloseHandle (hModuleSnap); + CloseHandle (hModuleSnap); } - + } } @@ -311,17 +311,17 @@ typedef BOOL (WINAPI *SymGetModuleInfo_PROC)( ); /* Seems that IMAGEHLP.DLL is always available on NT 4. But MSDN from Platform SDK says Win 2K is required. MSDN from VS 6.0a says - it's O.K on NT 4 ???!!! - BTW: We are using ANSI function because not all version of IMAGEHLP.DLL contain Unicode support + it's OK on NT 4 ???!!! + BTW: We are using ANSI function because not all version of IMAGEHLP.DLL contain Unicode support */ static sal_Bool SAL_CALL _osl_addressGetModuleURL_NT4( void *pv, rtl_uString **pustrURL ) { sal_Bool bSuccess = sal_False; /* Assume failure */ - /* IMAGEHELP.DLL has a bug that it recursivly scans subdirectories of - the root when calling SymInitialize(), so we preferr DBGHELP.DLL - which exports the same symbols and is shipped with OOo */ + /* IMAGEHELP.DLL has a bug that it recursively scans subdirectories of + the root when calling SymInitialize(), so we prefer DBGHELP.DLL + which exports the same symbols and is shipped with AOO */ HMODULE hModImageHelp = LoadLibrary( "DBGHELP.DLL" ); @@ -350,10 +350,10 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_NT4( void *pv, rtl_uString **p { char *pLastBkSlash = strrchr( aModuleFileName, '\\' ); - if ( - pLastBkSlash && + if ( + pLastBkSlash && pLastBkSlash > (sal_Char*)aModuleFileName - && *(pLastBkSlash - 1) != ':' + && *(pLastBkSlash - 1) != ':' && *(pLastBkSlash - 1) != '\\' ) { @@ -381,7 +381,7 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_NT4( void *pv, rtl_uString **p rtl_uString *ustrSysPath = NULL; rtl_string2UString( &ustrSysPath, ModuleInfo.LoadedImageName, strlen(ModuleInfo.LoadedImageName), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS ); - OSL_ASSERT(ustrSysPath != NULL); + OSL_ASSERT(ustrSysPath != NULL); osl_getFileURLFromSystemPath( ustrSysPath, pustrURL ); rtl_uString_release( ustrSysPath ); } @@ -405,7 +405,7 @@ typedef struct _MODULEINFO { LPVOID EntryPoint; } MODULEINFO, *LPMODULEINFO; -typedef BOOL (WINAPI *EnumProcessModules_PROC)( +typedef BOOL (WINAPI *EnumProcessModules_PROC)( HANDLE hProcess, // handle to the process HMODULE * lphModule, // array to receive the module handles DWORD cb, // size of the array @@ -427,7 +427,7 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_NT( void *pv, rtl_uString **pu { sal_Bool bSuccess = sal_False; /* Assume failure */ static HMODULE hModPsapi = NULL; - + if ( !hModPsapi ) hModPsapi = LoadLibrary( "PSAPI.DLL" ); @@ -457,7 +457,7 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_NT( void *pv, rtl_uString **pu if ( (BYTE *)pv >= (BYTE *)modinfo.lpBaseOfDll && (BYTE *)pv < (BYTE *)modinfo.lpBaseOfDll + modinfo.SizeOfImage ) { - ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH ); + ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH ); rtl_uString *ustrSysPath = NULL; GetModuleFileNameW( lpModules[iModule], ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), aBuffer.getBufSizeInSymbols() ); @@ -496,16 +496,15 @@ sal_Bool SAL_CALL osl_getModuleURLFromFunctionAddress( oslGenericFunction addr, { /* casting a function pointer to a data pointer (void*) is not allowed according to the C/C++ standards. In this case - it is unavoidable because we have to stay compatible we + it is unavoidable because we have to stay compatible we cannot remove any function. */ #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4054) #endif - return osl_getModuleURLFromAddress((void*)addr, ppLibraryUrl); + return osl_getModuleURLFromAddress((void*)addr, ppLibraryUrl); #ifdef _MSC_VER #pragma warning(pop) #endif } -