diff options
author | Thomas Lange <tl@openoffice.org> | 2001-06-27 09:23:35 +0000 |
---|---|---|
committer | Thomas Lange <tl@openoffice.org> | 2001-06-27 09:23:35 +0000 |
commit | c0166c165775eb49887abc98257512470c5ed345 (patch) | |
tree | 7713479e7c1e4a6d8eeeefb3fd82080c51ae9e23 /linguistic | |
parent | b0646be11a96a2ab4fda8f21a5f0d9b1fab9ee75 (diff) |
#88867# shutdown optimization when dictionaries were not used yet
Diffstat (limited to 'linguistic')
-rw-r--r-- | linguistic/source/dlistimp.cxx | 100 | ||||
-rw-r--r-- | linguistic/source/dlistimp.hxx | 7 |
2 files changed, 64 insertions, 43 deletions
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 // diff --git a/linguistic/source/dlistimp.hxx b/linguistic/source/dlistimp.hxx index 6aeb15fc9939..069132dc37a6 100644 --- a/linguistic/source/dlistimp.hxx +++ b/linguistic/source/dlistimp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dlistimp.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jp $ $Date: 2001-04-05 17:33:02 $ + * last change: $Author: tl $ $Date: 2001-06-27 10:23:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -248,6 +248,9 @@ public: getImplementationName_Static() throw(); static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // non UNO-specific + void SaveDics(); }; inline ::rtl::OUString DicList::getImplementationName_Static() throw() |