From 59288cdab6dc4b5a3fcaf94480d6ee19baa1e07d Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 24 Jan 2015 14:08:48 +0100 Subject: Typo: ..syncronous..=>synchronous (dbaccess)(new) Change-Id: I6d0b6293850a8dd887e34fbf0a425f7024dd84a5 --- dbaccess/Library_dbu.mk | 2 +- dbaccess/source/ui/app/AppController.hxx | 2 +- dbaccess/source/ui/browser/AsynchronousLink.cxx | 87 +++++++++++++++++++++++++ dbaccess/source/ui/browser/AsyncronousLink.cxx | 87 ------------------------- dbaccess/source/ui/dlg/dbwizsetup.cxx | 4 +- dbaccess/source/ui/inc/brwctrlr.hxx | 6 +- include/dbaccess/AsynchronousLink.hxx | 66 +++++++++++++++++++ include/dbaccess/AsyncronousLink.hxx | 66 ------------------- include/dbaccess/genericcontroller.hxx | 6 +- 9 files changed, 163 insertions(+), 163 deletions(-) create mode 100644 dbaccess/source/ui/browser/AsynchronousLink.cxx delete mode 100644 dbaccess/source/ui/browser/AsyncronousLink.cxx create mode 100644 include/dbaccess/AsynchronousLink.hxx delete mode 100644 include/dbaccess/AsyncronousLink.hxx diff --git a/dbaccess/Library_dbu.mk b/dbaccess/Library_dbu.mk index c9b4f409b818..293040337bf7 100644 --- a/dbaccess/Library_dbu.mk +++ b/dbaccess/Library_dbu.mk @@ -88,7 +88,7 @@ $(eval $(call gb_Library_add_exception_objects,dbu,\ dbaccess/source/ui/app/AppTitleWindow \ dbaccess/source/ui/app/AppView \ dbaccess/source/ui/app/subcomponentmanager \ - dbaccess/source/ui/browser/AsyncronousLink \ + dbaccess/source/ui/browser/AsynchronousLink \ dbaccess/source/ui/browser/brwctrlr \ dbaccess/source/ui/browser/brwview \ dbaccess/source/ui/browser/dataview \ diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index 95a14572a611..3a36987643bd 100644 --- a/dbaccess/source/ui/app/AppController.hxx +++ b/dbaccess/source/ui/app/AppController.hxx @@ -117,7 +117,7 @@ namespace dbaui TransferableClipboardListener* m_pClipbordNotifier; // notifier for changes in the clipboard ImplSVEvent * m_nAsyncDrop; - OAsyncronousLink m_aSelectContainerEvent; + OAsynchronousLink m_aSelectContainerEvent; PreviewMode m_ePreviewMode; // the mode of the preview ElementType m_eCurrentType; bool m_bNeedToReconnect; // true when the settings of the data source were modified and the connection is no longer up to date diff --git a/dbaccess/source/ui/browser/AsynchronousLink.cxx b/dbaccess/source/ui/browser/AsynchronousLink.cxx new file mode 100644 index 000000000000..ac940d445283 --- /dev/null +++ b/dbaccess/source/ui/browser/AsynchronousLink.cxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include +#include +#include + +// OAsyncronousLink +using namespace dbaui; +OAsyncronousLink::OAsyncronousLink( const Link& _rHandler ) + :m_aHandler(_rHandler) + ,m_aEventSafety() + ,m_aDestructionSafety() + ,m_nEventId(0) +{ +} + +OAsyncronousLink::~OAsyncronousLink() +{ + { + ::osl::MutexGuard aEventGuard( m_aEventSafety ); + if ( m_nEventId ) + Application::RemoveUserEvent(m_nEventId); + m_nEventId = 0; + } + + { + ::osl::MutexGuard aDestructionGuard( m_aDestructionSafety ); + // this is just for the case we're deleted while another thread just handled the event : + // if this other thread called our link while we were deleting the event here, the + // link handler blocked. With leaving the above block it continued, but now we are prevented + // to leave this destructor 'til the link handler recognizes that nEvent == 0 and leaves. + } +} + +void OAsyncronousLink::Call( void* _pArgument ) +{ + ::osl::MutexGuard aEventGuard( m_aEventSafety ); + if (m_nEventId) + Application::RemoveUserEvent(m_nEventId); + m_nEventId = Application::PostUserEvent( LINK( this, OAsyncronousLink, OnAsyncCall ), _pArgument ); +} + +void OAsyncronousLink::CancelCall() +{ + ::osl::MutexGuard aEventGuard( m_aEventSafety ); + if ( m_nEventId ) + Application::RemoveUserEvent( m_nEventId ); + m_nEventId = 0; +} + +IMPL_LINK(OAsyncronousLink, OnAsyncCall, void*, _pArg) +{ + { + ::osl::MutexGuard aDestructionGuard( m_aDestructionSafety ); + { + ::osl::MutexGuard aEventGuard( m_aEventSafety ); + if (!m_nEventId) + // our destructor deleted the event just while we are waiting for m_aEventSafety + // -> get outta here + return 0; + m_nEventId = 0; + } + } + if (m_aHandler.IsSet()) + return m_aHandler.Call(_pArg); + + return 0L; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/browser/AsyncronousLink.cxx b/dbaccess/source/ui/browser/AsyncronousLink.cxx deleted file mode 100644 index ac940d445283..000000000000 --- a/dbaccess/source/ui/browser/AsyncronousLink.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include -#include - -// OAsyncronousLink -using namespace dbaui; -OAsyncronousLink::OAsyncronousLink( const Link& _rHandler ) - :m_aHandler(_rHandler) - ,m_aEventSafety() - ,m_aDestructionSafety() - ,m_nEventId(0) -{ -} - -OAsyncronousLink::~OAsyncronousLink() -{ - { - ::osl::MutexGuard aEventGuard( m_aEventSafety ); - if ( m_nEventId ) - Application::RemoveUserEvent(m_nEventId); - m_nEventId = 0; - } - - { - ::osl::MutexGuard aDestructionGuard( m_aDestructionSafety ); - // this is just for the case we're deleted while another thread just handled the event : - // if this other thread called our link while we were deleting the event here, the - // link handler blocked. With leaving the above block it continued, but now we are prevented - // to leave this destructor 'til the link handler recognizes that nEvent == 0 and leaves. - } -} - -void OAsyncronousLink::Call( void* _pArgument ) -{ - ::osl::MutexGuard aEventGuard( m_aEventSafety ); - if (m_nEventId) - Application::RemoveUserEvent(m_nEventId); - m_nEventId = Application::PostUserEvent( LINK( this, OAsyncronousLink, OnAsyncCall ), _pArgument ); -} - -void OAsyncronousLink::CancelCall() -{ - ::osl::MutexGuard aEventGuard( m_aEventSafety ); - if ( m_nEventId ) - Application::RemoveUserEvent( m_nEventId ); - m_nEventId = 0; -} - -IMPL_LINK(OAsyncronousLink, OnAsyncCall, void*, _pArg) -{ - { - ::osl::MutexGuard aDestructionGuard( m_aDestructionSafety ); - { - ::osl::MutexGuard aEventGuard( m_aEventSafety ); - if (!m_nEventId) - // our destructor deleted the event just while we are waiting for m_aEventSafety - // -> get outta here - return 0; - m_nEventId = 0; - } - } - if (m_aHandler.IsSet()) - return m_aHandler.Call(_pArg); - - return 0L; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 292292276d6a..7111764d0f3a 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -42,7 +42,7 @@ #include "dbaccess_helpid.hrc" #include "ConnectionPageSetup.hxx" #include "UITools.hxx" -#include +#include #include #include @@ -880,7 +880,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument() Reference< XDesktop2 > m_xDesktop; Reference< XInteractionHandler2 > m_xInteractionHandler; OUString m_sURL; - OAsyncronousLink m_aAsyncCaller; + OAsynchronousLink m_aAsyncCaller; public: AsyncLoader( const Reference< XComponentContext >& _rxORB, const OUString& _rURL ); diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx index 63e536a0f6c9..16d1c335f735 100644 --- a/dbaccess/source/ui/inc/brwctrlr.hxx +++ b/dbaccess/source/ui/inc/brwctrlr.hxx @@ -96,8 +96,8 @@ namespace dbaui TransferableClipboardListener* m_pClipbordNotifier; // notifier for changes in the clipboard - OAsyncronousLink m_aAsyncGetCellFocus; - OAsyncronousLink m_aAsyncDisplayError; + OAsynchronousLink m_aAsyncGetCellFocus; + OAsynchronousLink m_aAsyncDisplayError; ::dbtools::SQLExceptionInfo m_aCurrentError; OUString m_sStateSaveRecord; @@ -273,7 +273,7 @@ namespace dbaui // load the form // the default implementation does an direct load or starts a load thread, depending on the multithread capabilities // of the data source. - // the default implementation also calls LoadFinished after a syncronous load, so be sure to do the same if you override + // the default implementation also calls LoadFinished after a synchronous load, so be sure to do the same if you override // this metod and don't call the base class' method virtual void LoadFinished(bool bWasSynch); diff --git a/include/dbaccess/AsynchronousLink.hxx b/include/dbaccess/AsynchronousLink.hxx new file mode 100644 index 000000000000..155630db7e06 --- /dev/null +++ b/include/dbaccess/AsynchronousLink.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DBACCESS_ASYNCRONOUSLINK_HXX +#define INCLUDED_DBACCESS_ASYNCRONOUSLINK_HXX + +#include +#include + +struct ImplSVEvent; + +namespace dbaui +{ + + // a helper for multi-threaded handling of async events + + /** handles asynchronous links which may be called in multi-threaded environments + If you use an instance of this class as member of your own class, it will handle + several crucial points for you (for instance the case that somebody posts the + event while another thread tries to delete this event in the _destructor_ of the + class). + */ + class OAsynchronousLink + { + Link m_aHandler; + + protected: + ::osl::Mutex m_aEventSafety; + ::osl::Mutex m_aDestructionSafety; + ImplSVEvent * m_nEventId; + + public: + /** constructs the object + @param _rHandler The link to be called asynchronously + */ + OAsynchronousLink( const Link& _rHandler ); + virtual ~OAsynchronousLink(); + + bool IsRunning() const { return m_nEventId != 0; } + + void Call( void* _pArgument = NULL ); + void CancelCall(); + + protected: + DECL_LINK(OnAsyncCall, void*); + }; +} +#endif // INCLUDED_DBACCESS_ASYNCRONOUSLINK_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/dbaccess/AsyncronousLink.hxx b/include/dbaccess/AsyncronousLink.hxx deleted file mode 100644 index b0ba02d854be..000000000000 --- a/include/dbaccess/AsyncronousLink.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_DBACCESS_ASYNCRONOUSLINK_HXX -#define INCLUDED_DBACCESS_ASYNCRONOUSLINK_HXX - -#include -#include - -struct ImplSVEvent; - -namespace dbaui -{ - - // a helper for multi-threaded handling of async events - - /** handles asynchronous links which may be called in multi-threaded environments - If you use an instance of this class as member of your own class, it will handle - several crucial points for you (for instance the case that somebody posts the - event while another thread tries to delete this event in the _destructor_ of the - class). - */ - class OAsyncronousLink - { - Link m_aHandler; - - protected: - ::osl::Mutex m_aEventSafety; - ::osl::Mutex m_aDestructionSafety; - ImplSVEvent * m_nEventId; - - public: - /** constructs the object - @param _rHandler The link to be called asyncronously - */ - OAsyncronousLink( const Link& _rHandler ); - virtual ~OAsyncronousLink(); - - bool IsRunning() const { return m_nEventId != 0; } - - void Call( void* _pArgument = NULL ); - void CancelCall(); - - protected: - DECL_LINK(OnAsyncCall, void*); - }; -} -#endif // INCLUDED_DBACCESS_ASYNCRONOUSLINK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/dbaccess/genericcontroller.hxx b/include/dbaccess/genericcontroller.hxx index 79169c3ff9ba..c8dbb0b2660c 100644 --- a/include/dbaccess/genericcontroller.hxx +++ b/include/dbaccess/genericcontroller.hxx @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include @@ -238,8 +238,8 @@ namespace dbaui ::osl::Mutex m_aFeatureMutex; // locked when features are append to or remove from deque StateCache m_aStateCache; // save the current status of feature state Dispatch m_arrStatusListener; // all our listeners where we dispatch status changes - OAsyncronousLink m_aAsyncInvalidateAll; - OAsyncronousLink m_aAsyncCloseTask; // called when a task should be closed + OAsynchronousLink m_aAsyncInvalidateAll; + OAsynchronousLink m_aAsyncCloseTask; // called when a task should be closed ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xUrlTransformer; // needed sometimes ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; -- cgit