[Libreoffice-commits] .: 2 commits - svl/inc svl/source tools/inc

Joseph Powers jpowers at kemper.freedesktop.org
Mon Feb 14 08:04:55 PST 2011


 svl/inc/svl/cancel.hxx       |  144 ------------------------------
 svl/inc/svl/cnclhint.hxx     |   51 ----------
 svl/source/notify/cancel.cxx |  203 -------------------------------------------
 tools/inc/tools/ref.hxx      |   27 ++---
 4 files changed, 12 insertions(+), 413 deletions(-)

New commits:
commit 499fbe0376e290aed3ec6d00206a26747329b11d
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Mon Feb 14 08:04:06 2011 -0800

    Remove class SfxCancelManager
    
    This is only used in binfilter; which has its own copy of the class.
    make distclean & make check work on Mac OS X

diff --git a/svl/inc/svl/cancel.hxx b/svl/inc/svl/cancel.hxx
deleted file mode 100644
index 409f4cc..0000000
--- a/svl/inc/svl/cancel.hxx
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SFXCANCEL_HXX
-#define _SFXCANCEL_HXX
-
-#include "svl/svldllapi.h"
-#include <tools/string.hxx>
-#include <tools/ref.hxx>
-#include <svl/brdcst.hxx>
-#include <svl/smplhint.hxx>
-
-class SfxCancellable;
-
-#ifdef _SFX_CANCEL_CXX
-#include <svl/svarray.hxx>
-
-SV_DECL_PTRARR( SfxCancellables_Impl, SfxCancellable*, 0, 4 )
-
-#else
-
-typedef SvPtrarr SfxCancellables_Impl;
-
-#endif
-
-//-------------------------------------------------------------------------
-
-class SVL_DLLPUBLIC SfxCancelManager: public SfxBroadcaster
-, public SvWeakBase
-
-/*	[Beschreibung]
-
-    An Instanzen dieser Klasse k"onnen nebenl"aufige Prozesse angemeldet
-    werden, um vom Benutzer abbrechbar zu sein. Werden abbrechbare
-    Prozesse (Instanzen von <SfxCancellable>) an- oder abgemeldet, wird
-    dies durch einen <SfxSimpleHint> mit dem Flag SFX_HINT_CANCELLABLE
-    gebroadcastet.
-
-    SfxCancelManager k"onnen hierarchisch angeordnet werden, so k"onnen
-    z.B. Dokument-lokale Prozesse getrennt gecancelt werden.
-
-    [Beispiel]
-
-    SfxCancelManager *pMgr = new SfxCancelManager;
-    StartListening( pMgr );
-    pMailSystem->SetCancelManager( pMgr )
-*/
-
-{
-    SfxCancelManager*		_pParent;
-    SfxCancellables_Impl 	_aJobs;
-
-public:
-                            SfxCancelManager( SfxCancelManager *pParent = 0 );
-                            ~SfxCancelManager();
-
-    BOOL                    CanCancel() const;
-    void					Cancel( BOOL bDeep );
-    SfxCancelManager*		GetParent() const { return _pParent; }
-
-    void					InsertCancellable( SfxCancellable *pJob );
-    void					RemoveCancellable( SfxCancellable *pJob );
-    USHORT					GetCancellableCount() const
-                            { return _aJobs.Count(); }
-    SfxCancellable* 		GetCancellable( USHORT nPos ) const
-                            { return (SfxCancellable*) _aJobs[nPos]; }
-};
-
-SV_DECL_WEAK( SfxCancelManager )
-//-------------------------------------------------------------------------
-
-class SVL_DLLPUBLIC SfxCancellable
-
-/*	[Beschreibung]
-
-    Instanzen dieser Klasse werden immer an einem Cancel-Manager angemeldet,
-    der dadurch dem Benutzer signalisieren kann, ob abbrechbare Prozesse
-    vorhanden sind und der die SfxCancellable-Instanzen auf 'abgebrochen'
-    setzen kann.
-
-    Die im Ctor "ubergebene <SfxCancelManger>-Instanz mu\s die Instanz
-    dieser Klasse "uberleben!
-
-    [Beispiel]
-
-    {
-        SfxCancellable aCancel( pCancelMgr );
-        while ( !aCancel && GetData() )
-            Reschedule();
-    }
-
-*/
-
-{
-    SfxCancelManager*		_pMgr;
-    BOOL					_bCancelled;
-    String					_aTitle;
-
-public:
-                            SfxCancellable( SfxCancelManager *pMgr,
-                                            const String &rTitle )
-                            :	_pMgr( pMgr ),
-                                _bCancelled( FALSE ),
-                                _aTitle( rTitle )
-                            { pMgr->InsertCancellable( this ); }
-
-    virtual 				~SfxCancellable();
-
-    void					SetManager( SfxCancelManager *pMgr );
-    SfxCancelManager*       GetManager() const { return _pMgr; }
-
-    virtual void			Cancel();
-    BOOL					IsCancelled() const { return _bCancelled; }
-    operator 				BOOL() const { return _bCancelled; }
-    const String&			GetTitle() const { return _aTitle; }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/inc/svl/cnclhint.hxx b/svl/inc/svl/cnclhint.hxx
deleted file mode 100644
index d287c96..0000000
--- a/svl/inc/svl/cnclhint.hxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SFXCNCLHINT_HXX
-#define _SFXCNCLHINT_HXX
-
-#include <svl/hint.hxx>
-#include <svl/cancel.hxx>
-#include <tools/rtti.hxx>
-
-#define SFXCANCELHINT_REMOVED		1
-
-class SfxCancelHint: public SfxHint
-{
-private:
-    SfxCancellable* pCancellable;
-    USHORT			nAction;
-public:
-    TYPEINFO();
-    SfxCancelHint( SfxCancellable*, USHORT nAction );
-    USHORT GetAction() const { return nAction; }
-    const SfxCancellable& GetCancellable() const { return *pCancellable; }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/notify/cancel.cxx b/svl/source/notify/cancel.cxx
deleted file mode 100644
index 7b4e714..0000000
--- a/svl/source/notify/cancel.cxx
+++ /dev/null
@@ -1,203 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svl.hxx"
-#define _SFX_CANCEL_CXX
-#include <svl/cancel.hxx>
-
-#include <osl/mutex.hxx>
-#include <tools/debug.hxx>
-
-#include <svl/smplhint.hxx>
-#include <svl/cnclhint.hxx>
-#include <rtl/instance.hxx>
-
-namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex >{}; }
-
-//=========================================================================
-
-SfxCancelManager::SfxCancelManager( SfxCancelManager *pParent )
-:	_pParent( pParent )
-{
-}
-
-//-------------------------------------------------------------------------
-
-SfxCancelManager::~SfxCancelManager()
-{
-    DBG_ASSERT( _pParent || !_aJobs.Count(), "deleting SfxCancelManager in use" );
-    for ( USHORT n = _aJobs.Count(); n--; )
-        _aJobs.GetObject(n)->SetManager( _pParent );
-}
-
-//-------------------------------------------------------------------------
-
-BOOL SfxCancelManager::CanCancel() const
-
-/*	[Beschreibung]
-
-    Liefert TRUE wenn an diesem CancelManager oder an einem Parent
-    ein Job l"auft.
-*/
-
-{
-    ::osl::MutexGuard aGuard( lclMutex::get() );
-    return _aJobs.Count() > 0 || ( _pParent && _pParent->CanCancel() );
-}
-
-//-------------------------------------------------------------------------
-
-void SfxCancelManager::Cancel( BOOL bDeep )
-
-/*	[Beschreibung]
-
-    Diese Methode markiert alle angemeldeten <SfxCancellable>-Instanzen
-    als suspendiert.
-*/
-
-{
-    ::osl::MutexGuard aGuard( lclMutex::get() );
-    SfxCancelManagerWeak xWeak( this );
-    for ( USHORT n = _aJobs.Count(); n-- && xWeak.Is(); )
-        if ( n < _aJobs.Count() )
-            _aJobs.GetObject(n)->Cancel();
-    if ( xWeak.Is() && _pParent )
-        _pParent->Cancel( bDeep );
-}
-
-//-------------------------------------------------------------------------
-
-void SfxCancelManager::InsertCancellable( SfxCancellable *pJob )
-
-/*	[Beschreibung]
-
-    Diese interne Methode tr"agt 'pJob' in die Liste der unterbrechbaren
-    Jobs ein und Broadcastet dies. Jeder <SfxCancellable> darf nur
-    maximal einmal angemeldet sein, dies geschiet in seinem Ctor.
-*/
-
-{
-#ifdef GPF_ON_EMPTY_TITLE
-    if ( !pJob->GetTitle() )
-    {
-        DBG_ERROR( "SfxCancellable: empty titles not allowed (Vermummungsverbot)" )
-        *(int*)0 = 0;
-    }
-#endif
-
-    ::osl::ClearableMutexGuard aGuard( lclMutex::get() );
-    _aJobs.C40_INSERT( SfxCancellable, pJob, _aJobs.Count() );
-
-    aGuard.clear();
-    Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) );
-}
-
-//-------------------------------------------------------------------------
-
-
-void SfxCancelManager::RemoveCancellable( SfxCancellable *pJob )
-
-/*	[Beschreibung]
-
-    Diese interne Methode tr"agt 'pJob' aus die Liste der unterbrechbaren
-    Jobs aus und Broadcastet dies. Dieser Aufruf mu\s paarig nach einem
-    <InsertCancellable> erfolgen und wird im Dtor des <SfxCancellable>
-    ausgel"ost.
-*/
-
-{
-    ::osl::ClearableMutexGuard aGuard( lclMutex::get() );
-    const SfxCancellable *pTmp = pJob;
-    USHORT nPos = _aJobs.GetPos( pTmp );
-    if ( nPos != 0xFFFF )
-    {
-        _aJobs.Remove( nPos , 1 );
-        aGuard.clear();
-        Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) );
-        Broadcast( SfxCancelHint( pJob, SFXCANCELHINT_REMOVED ) );
-    }
-}
-
-//-------------------------------------------------------------------------
-
-SfxCancellable::~SfxCancellable()
-{
-    SfxCancelManager* pMgr = _pMgr;
-    if ( pMgr )
-        pMgr->RemoveCancellable( this );
-}
-
-//-------------------------------------------------------------------------
-
-void SfxCancellable::Cancel()
-
-/*	[Description]
-
-    This virtual function is called when the user hits the cancel-button.
-    If you overload it, you can stop your activities. Please always call
-    'SfxCancellable::Cancel()'.
-*/
-
-{
-#ifdef GFP_ON_NO_CANCEL
-    if ( _bCancelled < 5 )
-        ++_bCancelled;
-    else
-    {
-        delete this;
-    }
-#else
-    _bCancelled = TRUE;
-#endif
-}
-
-//-------------------------------------------------------------------------
-
-void SfxCancellable::SetManager( SfxCancelManager *pMgr )
-{
-    SfxCancelManager* pTmp = _pMgr;
-    if ( pTmp )
-        pTmp->RemoveCancellable( this );
-    _pMgr = pMgr;
-    if ( pMgr )
-        pMgr->InsertCancellable( this );
-}
-
-//-------------------------------------------------------------------------
-
-TYPEINIT1(SfxCancelHint, SfxHint);
-
-SfxCancelHint::SfxCancelHint( SfxCancellable* pJob, USHORT _nAction )
-{
-    pCancellable = pJob;
-    nAction = _nAction;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a723f877bc3197bed325603e7ea451140d02486f
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Mon Feb 14 07:53:30 2011 -0800

    Merge PRV_SV_DECL_REF_SIGNATURE into PRV_SV_DECL_REF_LOCK
    
    The 2nd macro is the only location in the code where the 1st was used.
    I think it's easier to read if the 2nd macro has all the code.

diff --git a/tools/inc/tools/ref.hxx b/tools/inc/tools/ref.hxx
index 89e890e..cacf5fe 100644
--- a/tools/inc/tools/ref.hxx
+++ b/tools/inc/tools/ref.hxx
@@ -34,20 +34,6 @@
 
 //=========================================================================
 
-#define PRV_SV_DECL_REF_SIGNATURE( ClassName, Ref )						\
-    inline               ClassName##Ref() { pObj = 0; }					\
-    inline               ClassName##Ref( const ClassName##Ref & rObj );	\
-    inline               ClassName##Ref( ClassName * pObjP );			\
-    inline void          Clear();										\
-    inline               ~ClassName##Ref();								\
-    inline ClassName##Ref & operator = ( const ClassName##Ref & rObj );	\
-    inline ClassName##Ref & operator = ( ClassName * pObj );			\
-    inline BOOL            Is() const { return pObj != NULL; }			\
-    inline ClassName *     operator &  () const { return pObj; }		\
-    inline ClassName *     operator -> () const { return pObj; }		\
-    inline ClassName &     operator *  () const { return *pObj; }		\
-    inline operator ClassName * () const { return pObj; }
-
 #define PRV_SV_IMPL_REF_COUNTERS( ClassName, Ref, AddRef, AddNextRef, ReleaseRef, Init, pRefbase ) \
 inline ClassName##Ref::ClassName##Ref( const ClassName##Ref & rObj )		\
     { pObj = rObj.pObj; if( pObj ) { Init pRefbase->AddNextRef; } }			\
@@ -80,7 +66,18 @@ inline ClassName##Ref & ClassName##Ref::operator = ( ClassName * pObjP )	\
 protected:										\
     ClassName * pObj;							\
 public:											\
-PRV_SV_DECL_REF_SIGNATURE(ClassName, Ref)
+    inline               ClassName##Ref() { pObj = 0; }					\
+    inline               ClassName##Ref( const ClassName##Ref & rObj );	\
+    inline               ClassName##Ref( ClassName * pObjP );			\
+    inline void          Clear();										\
+    inline               ~ClassName##Ref();								\
+    inline ClassName##Ref & operator = ( const ClassName##Ref & rObj );	\
+    inline ClassName##Ref & operator = ( ClassName * pObj );			\
+    inline BOOL            Is() const { return pObj != NULL; }			\
+    inline ClassName *     operator &  () const { return pObj; }		\
+    inline ClassName *     operator -> () const { return pObj; }		\
+    inline ClassName &     operator *  () const { return *pObj; }		\
+    inline operator ClassName * () const { return pObj; }
 
 #define PRV_SV_DECL_REF( ClassName )			\
 PRV_SV_DECL_REF_LOCK( ClassName, Ref )


More information about the Libreoffice-commits mailing list