From c0166c165775eb49887abc98257512470c5ed345 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 27 Jun 2001 09:23:35 +0000 Subject: #88867# shutdown optimization when dictionaries were not used yet --- linguistic/source/dlistimp.cxx | 100 ++++++++++++++++++++++++----------------- 1 file changed, 59 insertions(+), 41 deletions(-) (limited to 'linguistic/source/dlistimp.cxx') diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index 09f16226e24a..a84d41bfe079 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dlistimp.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: tl $ $Date: 2001-06-18 11:26:05 $ + * last change: $Author: tl $ $Date: 2001-06-27 10:23:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -356,26 +356,7 @@ INT16 DicEvtListenerHelper::FlushEvents() void DicList::MyAppExitListener::AtExit() { - // save (modified) dictionaries - Sequence< Reference< XDictionary > > aDics( rMyDicList.getDictionaries() ); - Reference< XDictionary > *pDic = aDics.getArray(); - INT32 nCount = aDics.getLength(); - for (INT32 i = 0; i < nCount; i++) - { - // save (modified) dictionaries - Reference< frame::XStorable > xStor( pDic[i] , UNO_QUERY ); - if (xStor.is()) - { - try - { - if (!xStor->isReadonly() && xStor->hasLocation()) - xStor->store(); - } - catch(Exception &) - { - } - } - } + rMyDicList.SaveDics(); } @@ -686,30 +667,34 @@ void SAL_CALL if (pDicEvtLstnrHelper) pDicEvtLstnrHelper->DisposeAndClear( aEvtObj ); - ActDicArray& rDicList = GetDicList(); - INT16 nCount = rDicList.Count(); - for (INT16 i = 0; i < nCount; i++) + //! avoid creation of dictionaries if not already done + if (pDicList) { - Reference< XDictionary > xDic( rDicList.GetObject(i).xDic , UNO_QUERY ); - - // save (modified) dictionaries - Reference< frame::XStorable > xStor( xDic , UNO_QUERY ); - if (xStor.is()) + ActDicArray& rDicList = GetDicList(); + INT16 nCount = rDicList.Count(); + for (INT16 i = 0; i < nCount; i++) { - try - { - if (!xStor->isReadonly() && xStor->hasLocation()) - xStor->store(); - } - catch(Exception &) + Reference< XDictionary > xDic( rDicList.GetObject(i).xDic , UNO_QUERY ); + + // save (modified) dictionaries + Reference< frame::XStorable > xStor( xDic , UNO_QUERY ); + if (xStor.is()) { + try + { + if (!xStor->isReadonly() && xStor->hasLocation()) + xStor->store(); + } + catch(Exception &) + { + } } - } - // release references to (members of) this object hold by - // dictionaries - if (xDic.is()) - xDic->removeDictionaryEventListener( xDicEvtLstnrHelper ); + // release references to (members of) this object hold by + // dictionaries + if (xDic.is()) + xDic->removeDictionaryEventListener( xDicEvtLstnrHelper ); + } } } } @@ -755,6 +740,8 @@ void DicList::_CreateDicList() xIgnAll->setActive( TRUE ); addDictionary( xIgnAll ); } + + // evaluate list of dictionaries to be activated from configuration // //! to suppress overwriting the list of active dictionaries in the @@ -777,6 +764,37 @@ void DicList::_CreateDicList() pDicEvtLstnrHelper->EndCollectEvents(); } + +void DicList::SaveDics() +{ + // save dics only if they have already been used/created. + //! don't create them just for the purpose of saving them ! + if (pDicList) + { + // save (modified) dictionaries + ActDicArray& rDicList = GetDicList(); + INT32 nCount = rDicList.Count();; + for (INT32 i = 0; i < nCount; i++) + { + // save (modified) dictionaries + Reference< frame::XStorable > xStor( rDicList.GetObject(i).xDic, + UNO_QUERY ); + if (xStor.is()) + { + try + { + if (!xStor->isReadonly() && xStor->hasLocation()) + xStor->store(); + } + catch(Exception &) + { + } + } + } + } +} + + /////////////////////////////////////////////////////////////////////////// // Service specific part // -- cgit