[Libreoffice-commits] core.git: 3 commits - framework/inc framework/source include/ucbhelper ucbhelper/source ucb/source

Stephan Bergmann sbergman at redhat.com
Wed Jul 2 05:57:33 PDT 2014


 framework/inc/threadhelp/itransactionmanager.h              |  133 ------------
 framework/inc/threadhelp/transactionguard.hxx               |    8 
 framework/inc/threadhelp/transactionmanager.hxx             |   85 ++++++-
 framework/source/fwi/threadhelp/transactionmanager.cxx      |   73 +++---
 include/ucbhelper/interactionrequest.hxx                    |   54 ----
 include/ucbhelper/simplenameclashresolverequest.hxx         |    9 
 ucb/source/core/ucbcmds.cxx                                 |    1 
 ucbhelper/source/provider/interactionrequest.cxx            |  104 ---------
 ucbhelper/source/provider/simplenameclashresolverequest.cxx |  127 +++++++++++
 9 files changed, 244 insertions(+), 350 deletions(-)

New commits:
commit b807a02850e4b5cc25707e5af8eb36d76c76af61
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jul 2 14:14:12 2014 +0200

    InteractionSupplyName is a detail of SimpleNameClashResolveRequest
    
    Change-Id: Iecc77b1c4749bd14ce79f1a7f3e98f45fa3abbba

diff --git a/include/ucbhelper/interactionrequest.hxx b/include/ucbhelper/interactionrequest.hxx
index 51883c7..a6d0447 100644
--- a/include/ucbhelper/interactionrequest.hxx
+++ b/include/ucbhelper/interactionrequest.hxx
@@ -28,7 +28,6 @@
 #include <com/sun/star/task/XInteractionDisapprove.hpp>
 #include <com/sun/star/ucb/XInteractionReplaceExistingData.hpp>
 #include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp>
-#include <com/sun/star/ucb/XInteractionSupplyName.hpp>
 #include <rtl/ref.hxx>
 #include <cppuhelper/weak.hxx>
 #include <ucbhelper/ucbhelperdllapi.h>
@@ -626,59 +625,6 @@ inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
 
 /**
   * This class implements a standard interaction continuation, namely the
-  * interface XInteractionSupplyName. Instances of this class can be passed
-  * along with an interaction request to indicate the possibility to
-  * supply a new name.
-  */
-class InteractionSupplyName : public InteractionContinuation,
-                              public com::sun::star::lang::XTypeProvider,
-                              public com::sun::star::ucb::XInteractionSupplyName
-{
-    OUString m_aName;
-
-public:
-    InteractionSupplyName( InteractionRequest * pRequest )
-    : InteractionContinuation( pRequest ) {}
-
-    // XInterface
-    virtual com::sun::star::uno::Any SAL_CALL
-    queryInterface( const com::sun::star::uno::Type & rType )
-        throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
-    virtual void SAL_CALL acquire()
-        throw() SAL_OVERRIDE;
-    virtual void SAL_CALL release()
-        throw() SAL_OVERRIDE;
-
-    // XTypeProvider
-    virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
-    getTypes()
-        throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
-    virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
-    getImplementationId()
-        throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
-
-    // XInteractionContinuation
-    virtual void SAL_CALL select()
-        throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
-
-    // XInteractionSupplyName
-    virtual void SAL_CALL setName( const OUString& Name )
-        throw ( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
-
-    // Non-interface methods.
-
-    /**
-      * This method returns the name that was supplied by the interaction
-      * handler.
-      *
-      * @return the name.
-      */
-    const OUString & getName() const { return m_aName; }
-};
-
-
-/**
-  * This class implements a standard interaction continuation, namely the
   * interface XInteractionReplaceExistingData. Instances of this class can be
   * passed along with an interaction request to indicate the possibility to
   * replace existing data.
diff --git a/include/ucbhelper/simplenameclashresolverequest.hxx b/include/ucbhelper/simplenameclashresolverequest.hxx
index 33a58b3..c773097 100644
--- a/include/ucbhelper/simplenameclashresolverequest.hxx
+++ b/include/ucbhelper/simplenameclashresolverequest.hxx
@@ -26,6 +26,8 @@
 
 namespace ucbhelper {
 
+class InteractionSupplyName;
+
 /**
   * This class implements a simple name clash resolve interaction request.
   * Instances can be passed directly to XInteractionHandler::handle(...). Each
@@ -36,12 +38,13 @@ namespace ucbhelper {
   * @see com::sun::star::ucb::NameClashResolveRequest
   * @see InteractionAbort
   * @see InteractioneplaceExistingData
-  * @see InteractionSupplyName
   */
 class UCBHELPER_DLLPUBLIC SimpleNameClashResolveRequest : public ucbhelper::InteractionRequest
 {
     rtl::Reference< InteractionSupplyName > m_xNameSupplier;
 
+    virtual ~SimpleNameClashResolveRequest();
+
 public:
     /**
       * Constructor.
@@ -65,9 +68,7 @@ public:
       *
       * @return the new name, if supplied.
       */
-    const OUString getNewName() const
-    { return m_xNameSupplier->getName(); }
-
+    const OUString getNewName() const;
 };
 
 } // namespace ucbhelper
diff --git a/ucb/source/core/ucbcmds.cxx b/ucb/source/core/ucbcmds.cxx
index c4ed448..22c6960 100644
--- a/ucb/source/core/ucbcmds.cxx
+++ b/ucb/source/core/ucbcmds.cxx
@@ -56,6 +56,7 @@
 #include <com/sun/star/ucb/XContentAccess.hpp>
 #include <com/sun/star/ucb/XContentCreator.hpp>
 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
+#include <com/sun/star/ucb/XInteractionSupplyName.hpp>
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <ucbhelper/cancelcommandexecution.hxx>
diff --git a/ucbhelper/source/provider/interactionrequest.cxx b/ucbhelper/source/provider/interactionrequest.cxx
index c1d4617..18f15e1 100644
--- a/ucbhelper/source/provider/interactionrequest.cxx
+++ b/ucbhelper/source/provider/interactionrequest.cxx
@@ -849,110 +849,6 @@ void SAL_CALL InteractionSupplyAuthentication::setUseSystemCredentials(
 
 
 
-// InteractionSupplyName Implementation.
-
-
-
-
-
-
-// XInterface methods.
-
-
-
-// virtual
-void SAL_CALL InteractionSupplyName::acquire()
-    throw()
-{
-    OWeakObject::acquire();
-}
-
-
-// virtual
-void SAL_CALL InteractionSupplyName::release()
-    throw()
-{
-    OWeakObject::release();
-}
-
-
-// virtual
-uno::Any SAL_CALL
-InteractionSupplyName::queryInterface( const uno::Type & rType )
-    throw ( uno::RuntimeException, std::exception )
-{
-    uno::Any aRet = cppu::queryInterface( rType,
-                static_cast< lang::XTypeProvider * >( this ),
-                static_cast< task::XInteractionContinuation * >( this ),
-                static_cast< ucb::XInteractionSupplyName * >( this ) );
-
-    return aRet.hasValue()
-            ? aRet : InteractionContinuation::queryInterface( rType );
-}
-
-
-
-// XTypeProvider methods.
-
-
-
-// virtual
-uno::Sequence< sal_Int8 > SAL_CALL InteractionSupplyName::getImplementationId()
-    throw( uno::RuntimeException, std::exception )
-{
-    return css::uno::Sequence<sal_Int8>();
-}
-
-
-// virtual
-uno::Sequence< uno::Type > SAL_CALL InteractionSupplyName::getTypes()
-    throw( uno::RuntimeException, std::exception )
-{
-    static cppu::OTypeCollection* pCollection = 0;
-      if ( !pCollection )
-      {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
-                cppu::UnoType<lang::XTypeProvider>::get(),
-                cppu::UnoType<ucb::XInteractionSupplyName>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
-}
-
-
-
-// XInteractionContinuation methods.
-
-
-
-// virtual
-void SAL_CALL InteractionSupplyName::select()
-    throw( uno::RuntimeException, std::exception )
-{
-    recordSelection();
-}
-
-
-
-// XInteractionSupplyName methods.
-
-
-
-// virtual
-void SAL_CALL
-InteractionSupplyName::setName( const OUString& Name )
-    throw( uno::RuntimeException, std::exception )
-{
-    m_aName = Name;
-}
-
-
-
-
 // InteractionReplaceExistingData Implementation.
 
 
diff --git a/ucbhelper/source/provider/simplenameclashresolverequest.cxx b/ucbhelper/source/provider/simplenameclashresolverequest.cxx
index b5d8b85..b1d2a48 100644
--- a/ucbhelper/source/provider/simplenameclashresolverequest.cxx
+++ b/ucbhelper/source/provider/simplenameclashresolverequest.cxx
@@ -18,11 +18,129 @@
  */
 
 #include <com/sun/star/ucb/NameClashResolveRequest.hpp>
+#include <com/sun/star/ucb/XInteractionSupplyName.hpp>
+#include <cppuhelper/typeprovider.hxx>
 #include <ucbhelper/simplenameclashresolverequest.hxx>
 
 using namespace com::sun::star;
-using namespace ucbhelper;
 
+namespace ucbhelper {
+
+/**
+  * This class implements a standard interaction continuation, namely the
+  * interface XInteractionSupplyName. Instances of this class can be passed
+  * along with an interaction request to indicate the possibility to
+  * supply a new name.
+  */
+class InteractionSupplyName : public InteractionContinuation,
+                              public com::sun::star::lang::XTypeProvider,
+                              public com::sun::star::ucb::XInteractionSupplyName
+{
+    OUString m_aName;
+
+public:
+    InteractionSupplyName( InteractionRequest * pRequest )
+    : InteractionContinuation( pRequest ) {}
+
+    // XInterface
+    virtual com::sun::star::uno::Any SAL_CALL
+    queryInterface( const com::sun::star::uno::Type & rType )
+        throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+    virtual void SAL_CALL acquire()
+        throw() SAL_OVERRIDE;
+    virtual void SAL_CALL release()
+        throw() SAL_OVERRIDE;
+
+    // XTypeProvider
+    virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+    getTypes()
+        throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+    virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+    getImplementationId()
+        throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+    // XInteractionContinuation
+    virtual void SAL_CALL select()
+        throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+    // XInteractionSupplyName
+    virtual void SAL_CALL setName( const OUString& Name )
+        throw ( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+    // Non-interface methods.
+
+    /**
+      * This method returns the name that was supplied by the interaction
+      * handler.
+      *
+      * @return the name.
+      */
+    const OUString & getName() const { return m_aName; }
+};
+
+void SAL_CALL InteractionSupplyName::acquire()
+    throw()
+{
+    OWeakObject::acquire();
+}
+
+void SAL_CALL InteractionSupplyName::release()
+    throw()
+{
+    OWeakObject::release();
+}
+
+uno::Any SAL_CALL
+InteractionSupplyName::queryInterface( const uno::Type & rType )
+    throw ( uno::RuntimeException, std::exception )
+{
+    uno::Any aRet = cppu::queryInterface( rType,
+                static_cast< lang::XTypeProvider * >( this ),
+                static_cast< task::XInteractionContinuation * >( this ),
+                static_cast< ucb::XInteractionSupplyName * >( this ) );
+
+    return aRet.hasValue()
+            ? aRet : InteractionContinuation::queryInterface( rType );
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL InteractionSupplyName::getImplementationId()
+    throw( uno::RuntimeException, std::exception )
+{
+    return css::uno::Sequence<sal_Int8>();
+}
+
+uno::Sequence< uno::Type > SAL_CALL InteractionSupplyName::getTypes()
+    throw( uno::RuntimeException, std::exception )
+{
+    static cppu::OTypeCollection* pCollection = 0;
+      if ( !pCollection )
+      {
+        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+        if ( !pCollection )
+        {
+            static cppu::OTypeCollection collection(
+                cppu::UnoType<lang::XTypeProvider>::get(),
+                cppu::UnoType<ucb::XInteractionSupplyName>::get() );
+            pCollection = &collection;
+        }
+    }
+    return (*pCollection).getTypes();
+}
+
+void SAL_CALL InteractionSupplyName::select()
+    throw( uno::RuntimeException, std::exception )
+{
+    recordSelection();
+}
+
+void SAL_CALL
+InteractionSupplyName::setName( const OUString& Name )
+    throw( uno::RuntimeException, std::exception )
+{
+    m_aName = Name;
+}
+
+SimpleNameClashResolveRequest::~SimpleNameClashResolveRequest() {}
 
 SimpleNameClashResolveRequest::SimpleNameClashResolveRequest(
                                     const OUString & rTargetFolderURL,
@@ -55,4 +173,11 @@ SimpleNameClashResolveRequest::SimpleNameClashResolveRequest(
     setContinuations( aContinuations );
 }
 
+const OUString SimpleNameClashResolveRequest::getNewName() const
+{
+    return m_xNameSupplier->getName();
+}
+
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a9fc9f4a9f20fdcc00bf1860fe8445b130b1d736
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jul 2 14:13:03 2014 +0200

    Drop unused E_NOEXCEPTIONS
    
    Change-Id: I558684352cc99002752d4c5d118a0c46572bd6f0

diff --git a/framework/inc/threadhelp/transactionguard.hxx b/framework/inc/threadhelp/transactionguard.hxx
index 4395a58..81930e2 100644
--- a/framework/inc/threadhelp/transactionguard.hxx
+++ b/framework/inc/threadhelp/transactionguard.hxx
@@ -54,7 +54,7 @@ class TransactionGuard : private boost::noncopyable
                         from different threads at the same time ... this class use no refcount mechanism!
             @param      "rManager"  reference to transaction manager for using to register a request
             @param      "eMode"     enable/disable throwing of exceptions for rejected calls
-            @param      "eReason"   returns reason for rejected calls if "eMode=E_NOEXCEPTIONS"!
+            @param      "eReason"   returns reason for rejected calls
         *//*-*****************************************************************************************************/
         inline TransactionGuard( TransactionManager& rManager, EExceptionMode eMode, ERejectReason* eReason = NULL )
             : m_pManager( &rManager )
diff --git a/framework/inc/threadhelp/transactionmanager.hxx b/framework/inc/threadhelp/transactionmanager.hxx
index d89896e..8d87a51 100644
--- a/framework/inc/threadhelp/transactionmanager.hxx
+++ b/framework/inc/threadhelp/transactionmanager.hxx
@@ -68,7 +68,6 @@ enum ERejectReason
                     e.g. We can throw a DisposedException if user try to work and our mode is E_CLOSE!
                     But sometimes he dont need this feature - will handle it by himself.
                     Then we must differ between some exception-modi:
-                        E_NOEXCEPTIONS          We never throw any exceptions! User handle it private and looks for ERejectReason.
                         E_HARDEXCEPTIONS        We throw exceptions for all working modes different from E_WORK!
                         E_SOFTEXCEPTIONS        We throw exceptions for all working modes different from E_WORK AND E_INCLOSE!
                                                 This mode is useful for impl-methods which should be callable from dispose() method!
@@ -96,7 +95,6 @@ enum ERejectReason
 *//*-*************************************************************************************************************/
 enum EExceptionMode
 {
-    E_NOEXCEPTIONS  ,
     E_HARDEXCEPTIONS,
     E_SOFTEXCEPTIONS
 };
diff --git a/framework/source/fwi/threadhelp/transactionmanager.cxx b/framework/source/fwi/threadhelp/transactionmanager.cxx
index 77a4894..e680862 100644
--- a/framework/source/fwi/threadhelp/transactionmanager.cxx
+++ b/framework/source/fwi/threadhelp/transactionmanager.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <cassert>
+
 #include <threadhelp/transactionmanager.hxx>
 
 #include <macros/generic.hxx>
@@ -57,8 +61,8 @@ TransactionManager::~TransactionManager()
 
                     E_BEFORECLOSE :  The object start the closing mechanism ... but sometimes
                                         e.g. the dispose() method need to call some private methods.
-                                        These some special methods should use E_SOFTEXCEPTIONS or ignore
-                                        E_INCLOSE as returned reason for E_NOEXCEPTIONS to detect this special case!
+                                        These some special methods should use E_SOFTEXCEPTIONS
+                                        to detect this special case!
 
                     E_CLOSE       :  Object is already dead! All further requests will be refused.
                                         It's your decision to react in a right way.
@@ -150,7 +154,7 @@ EWorkingMode TransactionManager::getWorkingMode() const
     @seealso    method unregisterTransaction()
 
     @param      "eMode"     ,used to enable/disable throwing exceptions automatically for rejected calls
-    @param      "eReason"   ,reason for rejected calls if eMode=E_NOEXCEPTIONS
+    @param      "eReason"   ,reason for rejected calls
 *//*-*****************************************************************************************************/
 void  TransactionManager::registerTransaction( EExceptionMode eMode, ERejectReason& eReason ) throw( css::uno::RuntimeException, css::lang::DisposedException )
 {
@@ -245,37 +249,35 @@ bool  TransactionManager::isCallRejected( ERejectReason& eReason ) const
 *//*-*****************************************************************************************************/
 void TransactionManager::impl_throwExceptions( EExceptionMode eMode, ERejectReason eReason ) const throw( css::uno::RuntimeException, css::lang::DisposedException )
 {
-    if( eMode != E_NOEXCEPTIONS )
+    switch( eReason )
     {
-        switch( eReason )
-        {
-            case E_UNINITIALIZED   :    if( eMode == E_HARDEXCEPTIONS )
-                                        {
-                                            // Help programmer to find out, why this exception is thrown!
-                                            SAL_WARN( "fwk", "TransactionManager...: Owner instance not correctly initialized yet. Call was rejected! Normally it's an algorithm error ... wrong use of class!" );
-                                            //ATTENTION: temp. disabled - till all bad code positions are detected and changed! */
-                                            // throw css::uno::RuntimeException( "TransactionManager...\nOwner instance not right initialized yet. Call was rejected! Normaly it's an algorithm error ... wrong usin of class!\n", css::uno::Reference< css::uno::XInterface >() );
-                                        }
-                                        break;
-            case E_INCLOSE         :    if( eMode == E_HARDEXCEPTIONS )
-                                        {
-                                            // Help programmer to find out, why this exception is thrown!
-                                            SAL_WARN( "fwk", "TransactionManager...: Owner instance stand in close method. Call was rejected!" );
-                                            throw css::lang::DisposedException( "TransactionManager...\nOwner instance stand in close method. Call was rejected!" );
-                                        }
-                                        break;
-            case E_CLOSED           :   {
-                                            // Help programmer to find out, why this exception is thrown!
-                                            SAL_WARN( "fwk", "TransactionManager...: Owner instance already closed. Call was rejected!" );
-                                            throw css::lang::DisposedException( "TransactionManager...\nOwner instance already closed. Call was rejected!" );
-                                        }
-            case E_NOREASON         :   {
-                                            // Help programmer to find out
-                                            SAL_WARN( "fwk", "TransactionManager...: Impossible case E_NOREASON!" );
-                                        }
-                                        break;
-            default:                    break; // nothing to do
-        }
+        case E_UNINITIALIZED   :    if( eMode == E_HARDEXCEPTIONS )
+                                    {
+                                        // Help programmer to find out, why this exception is thrown!
+                                        SAL_WARN( "fwk", "TransactionManager...: Owner instance not correctly initialized yet. Call was rejected! Normally it's an algorithm error ... wrong use of class!" );
+                                        //ATTENTION: temp. disabled - till all bad code positions are detected and changed! */
+                                        // throw css::uno::RuntimeException( "TransactionManager...\nOwner instance not right initialized yet. Call was rejected! Normaly it's an algorithm error ... wrong usin of class!\n", css::uno::Reference< css::uno::XInterface >() );
+                                    }
+                                    break;
+        case E_INCLOSE         :    if( eMode == E_HARDEXCEPTIONS )
+                                    {
+                                        // Help programmer to find out, why this exception is thrown!
+                                        SAL_WARN( "fwk", "TransactionManager...: Owner instance stand in close method. Call was rejected!" );
+                                        throw css::lang::DisposedException( "TransactionManager...\nOwner instance stand in close method. Call was rejected!" );
+                                    }
+                                    break;
+        case E_CLOSED           :   {
+                                        // Help programmer to find out, why this exception is thrown!
+                                        SAL_WARN( "fwk", "TransactionManager...: Owner instance already closed. Call was rejected!" );
+                                        throw css::lang::DisposedException( "TransactionManager...\nOwner instance already closed. Call was rejected!" );
+                                    }
+        case E_NOREASON         :   {
+                                        // Help programmer to find out
+                                        SAL_WARN( "fwk", "TransactionManager...: Impossible case E_NOREASON!" );
+                                    }
+                                    break;
+        default:
+            assert(false);
     }
 }
 
commit b6df953c8fb19cd00aed47b95b28677e34892f59
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jul 2 14:05:27 2014 +0200

    Drop unnecessary ITransactionManager base class
    
    Change-Id: Iebed1d63ff76fdc9b82ce6ce8860592606500e38

diff --git a/framework/inc/threadhelp/itransactionmanager.h b/framework/inc/threadhelp/itransactionmanager.h
deleted file mode 100644
index baffdb4..0000000
--- a/framework/inc/threadhelp/itransactionmanager.h
+++ /dev/null
@@ -1,133 +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_FRAMEWORK_INC_THREADHELP_ITRANSACTIONMANAGER_H
-#define INCLUDED_FRAMEWORK_INC_THREADHELP_ITRANSACTIONMANAGER_H
-
-#include <general.h>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-
-namespace framework{
-
-/*-************************************************************************************************************
-    @descr          Describe different states of a feature of following implementation.
-                    During lifetime of an object different working states occur:
-                        initialization - working - closing - closed
-                    If you wish to implement thread safe classes you should use this feature to protect
-                    your code against calls at wrong time. e.g. you are not full initialized but somewhere
-                    call an interface method (initialize phase means startup time from creating object till
-                    calling specified first method e.g. XInitialization::initialze()!) then you should refuse
-                    this call. The same for closing/disposing the object!
-*//*-*************************************************************************************************************/
-enum EWorkingMode
-{
-    E_INIT       ,   // We stand in a init method   -> some calls are accepted - some one are rejected
-    E_WORK       ,   // Object is ready for working -> all calls are accepted
-    E_BEFORECLOSE,   // We stand in a close method  -> some calls are accepted - some one are rejected
-    E_CLOSE          // Object is dead!             -> all calls are rejected!
-};
-
-/*-************************************************************************************************************
-    @descr          If a request was refused by a transaction manager (internal state different E_WORK ...)
-                    user can check the reason by using this enum values.
-*//*-*************************************************************************************************************/
-enum ERejectReason
-{
-    E_UNINITIALIZED ,
-    E_NOREASON      ,
-    E_INCLOSE       ,
-    E_CLOSED
-};
-
-/*-************************************************************************************************************
-    @descr          A transaction object should support throwing exceptions if user used it at wrong working mode.
-                    e.g. We can throw a DisposedException if user try to work and our mode is E_CLOSE!
-                    But sometimes he dont need this feature - will handle it by himself.
-                    Then we must differ between some exception-modi:
-                        E_NOEXCEPTIONS          We never throw any exceptions! User handle it private and looks for ERejectReason.
-                        E_HARDEXCEPTIONS        We throw exceptions for all working modes different from E_WORK!
-                        E_SOFTEXCEPTIONS        We throw exceptions for all working modes different from E_WORK AND E_INCLOSE!
-                                                This mode is useful for impl-methods which should be callable from dispose() method!
-
-                                                e.g.    void dispose()
-                                                        {
-                                                            m_aTransactionManager.setWorkingMode( E_BEFORECLOSE );
-                                                            ...
-                                                            impl_setA( 0 );
-                                                            ...
-                                                            m_aTransactionManager.setWorkingMode( E_CLOSE );
-                                                        }
-
-                                                        void impl_setA( int nA )
-                                                        {
-                                                            ERejectReason       EReason;
-                                                            TransactionGuard    aTransactionGuard( m_aTransactionManager, E_SOFTEXCEPTIONS, eReason );
-
-                                                            m_nA = nA;
-                                                        }
-
-                                                Normaly (if E_HARDEXCEPTIONS was used!) creation of guard
-                                                will throw an exception ... but using of E_SOFTEXCEPTIONS suppress it
-                                                and member "A" can be set.
-*//*-*************************************************************************************************************/
-enum EExceptionMode
-{
-    E_NOEXCEPTIONS  ,
-    E_HARDEXCEPTIONS,
-    E_SOFTEXCEPTIONS
-};
-
-/*-************************************************************************************************************
-    @descr          How can you use the transaction manager?
-                    Use it in combination with an TransactionGuard, which register your transaction in ctor
-                    and release in dtor automatically! Follow interface class can be used to make using
-                    of different manager implmentations possible by using same guard.
-*//*-*************************************************************************************************************/
-class ITransactionManager
-{
-
-    //  public methods
-
-    public:
-
-        /*-****************************************************************************************************
-            @descr      These functions must be supported by a derived class!
-                            getWorkingMode()        -return current set working mode
-                            setWorkingMode()        -change working mode
-                                                     (This will block till all current transactions are finished!)
-                            isCallRejected()        -test method to check if a call will be rejected by wrong working mode or not
-                            registerTransaction()   -start new transaction (increase internal transaction count)
-                            unregisterTransaction() -finish transaction    (decrease internal transaction count)
-        *//*-*****************************************************************************************************/
-        virtual EWorkingMode getWorkingMode         (                                                ) const = 0;
-        virtual void         setWorkingMode         ( EWorkingMode   eMode                           )       = 0;
-        virtual bool     isCallRejected         ( ERejectReason& eReason                         ) const = 0;
-        virtual void         registerTransaction    ( EExceptionMode eMode  , ERejectReason& eReason ) throw( css::uno::RuntimeException, css::lang::DisposedException ) = 0;
-        virtual void         unregisterTransaction  (                                                ) throw( css::uno::RuntimeException, css::lang::DisposedException ) = 0;
-
-    protected:
-        ~ITransactionManager() {}
-};      //  class ITransactionManager
-
-}       //  namespace framework
-
-#endif // INCLUDED_FRAMEWORK_INC_THREADHELP_ITRANSACTIONMANAGER_H
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/inc/threadhelp/transactionguard.hxx b/framework/inc/threadhelp/transactionguard.hxx
index 10d9b01..4395a58 100644
--- a/framework/inc/threadhelp/transactionguard.hxx
+++ b/framework/inc/threadhelp/transactionguard.hxx
@@ -21,7 +21,7 @@
 #define INCLUDED_FRAMEWORK_INC_THREADHELP_TRANSACTIONGUARD_HXX
 
 #include <boost/noncopyable.hpp>
-#include <threadhelp/itransactionmanager.h>
+#include <threadhelp/transactionmanager.hxx>
 
 namespace framework{
 
@@ -56,7 +56,7 @@ class TransactionGuard : private boost::noncopyable
             @param      "eMode"     enable/disable throwing of exceptions for rejected calls
             @param      "eReason"   returns reason for rejected calls if "eMode=E_NOEXCEPTIONS"!
         *//*-*****************************************************************************************************/
-        inline TransactionGuard( ITransactionManager& rManager, EExceptionMode eMode, ERejectReason* eReason = NULL )
+        inline TransactionGuard( TransactionManager& rManager, EExceptionMode eMode, ERejectReason* eReason = NULL )
             : m_pManager( &rManager )
         {
             // If exception mode is set to E_HARDEXCETIONS we don't need a buffer to return reason!
@@ -115,7 +115,7 @@ class TransactionGuard : private boost::noncopyable
 
     private:
 
-        ITransactionManager*   m_pManager;   /// pointer to safed transaction manager
+        TransactionManager*   m_pManager;   /// pointer to safed transaction manager
 
 };      //  class TransactionGuard
 
diff --git a/framework/inc/threadhelp/transactionmanager.hxx b/framework/inc/threadhelp/transactionmanager.hxx
index 4387948..d89896e 100644
--- a/framework/inc/threadhelp/transactionmanager.hxx
+++ b/framework/inc/threadhelp/transactionmanager.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_FRAMEWORK_INC_THREADHELP_TRANSACTIONMANAGER_HXX
 
 #include <boost/noncopyable.hpp>
-#include <threadhelp/itransactionmanager.h>
 #include <threadhelp/gate.hxx>
 
 #include <com/sun/star/uno/Reference.hxx>
@@ -35,6 +34,74 @@
 namespace framework{
 
 /*-************************************************************************************************************
+    @descr          Describe different states of a feature of following implementation.
+                    During lifetime of an object different working states occur:
+                        initialization - working - closing - closed
+                    If you wish to implement thread safe classes you should use this feature to protect
+                    your code against calls at wrong time. e.g. you are not full initialized but somewhere
+                    call an interface method (initialize phase means startup time from creating object till
+                    calling specified first method e.g. XInitialization::initialze()!) then you should refuse
+                    this call. The same for closing/disposing the object!
+*//*-*************************************************************************************************************/
+enum EWorkingMode
+{
+    E_INIT       ,   // We stand in a init method   -> some calls are accepted - some one are rejected
+    E_WORK       ,   // Object is ready for working -> all calls are accepted
+    E_BEFORECLOSE,   // We stand in a close method  -> some calls are accepted - some one are rejected
+    E_CLOSE          // Object is dead!             -> all calls are rejected!
+};
+
+/*-************************************************************************************************************
+    @descr          If a request was refused by a transaction manager (internal state different E_WORK ...)
+                    user can check the reason by using this enum values.
+*//*-*************************************************************************************************************/
+enum ERejectReason
+{
+    E_UNINITIALIZED ,
+    E_NOREASON      ,
+    E_INCLOSE       ,
+    E_CLOSED
+};
+
+/*-************************************************************************************************************
+    @descr          A transaction object should support throwing exceptions if user used it at wrong working mode.
+                    e.g. We can throw a DisposedException if user try to work and our mode is E_CLOSE!
+                    But sometimes he dont need this feature - will handle it by himself.
+                    Then we must differ between some exception-modi:
+                        E_NOEXCEPTIONS          We never throw any exceptions! User handle it private and looks for ERejectReason.
+                        E_HARDEXCEPTIONS        We throw exceptions for all working modes different from E_WORK!
+                        E_SOFTEXCEPTIONS        We throw exceptions for all working modes different from E_WORK AND E_INCLOSE!
+                                                This mode is useful for impl-methods which should be callable from dispose() method!
+
+                                                e.g.    void dispose()
+                                                        {
+                                                            m_aTransactionManager.setWorkingMode( E_BEFORECLOSE );
+                                                            ...
+                                                            impl_setA( 0 );
+                                                            ...
+                                                            m_aTransactionManager.setWorkingMode( E_CLOSE );
+                                                        }
+
+                                                        void impl_setA( int nA )
+                                                        {
+                                                            ERejectReason       EReason;
+                                                            TransactionGuard    aTransactionGuard( m_aTransactionManager, E_SOFTEXCEPTIONS, eReason );
+
+                                                            m_nA = nA;
+                                                        }
+
+                                                Normaly (if E_HARDEXCEPTIONS was used!) creation of guard
+                                                will throw an exception ... but using of E_SOFTEXCEPTIONS suppress it
+                                                and member "A" can be set.
+*//*-*************************************************************************************************************/
+enum EExceptionMode
+{
+    E_NOEXCEPTIONS  ,
+    E_HARDEXCEPTIONS,
+    E_SOFTEXCEPTIONS
+};
+
+/*-************************************************************************************************************
     @short          implement a transaction manager to support non breakable interface methods
     @descr          Use it to support non breakable interface methods without using any thread
                     synchronization like e.g. mutex, rw-lock!
@@ -42,13 +109,9 @@ namespace framework{
                     Use combination of EExceptionMode and ERejectReason to detect rejected requests
                     and react for it. You can enable automatically throwing of exceptions too.
 
-    @implements     ITransactionManager
-    @base           ITransactionManager
-
     @devstatus      draft
 *//*-*************************************************************************************************************/
-class FWI_DLLPUBLIC TransactionManager : public  ITransactionManager
-                         , private boost::noncopyable
+class FWI_DLLPUBLIC TransactionManager: private boost::noncopyable
 {
 
     //  public methods
@@ -56,12 +119,12 @@ class FWI_DLLPUBLIC TransactionManager : public  ITransactionManager
     public:
 
                                    TransactionManager           (                                              );
-        virtual                    ~TransactionManager          (                                              );
-        virtual void               setWorkingMode               ( EWorkingMode eMode                           ) SAL_OVERRIDE;
-        virtual EWorkingMode       getWorkingMode               (                                              ) const SAL_OVERRIDE;
-        virtual bool               isCallRejected               ( ERejectReason& eReason                       ) const SAL_OVERRIDE;
-        virtual void               registerTransaction          ( EExceptionMode eMode, ERejectReason& eReason ) throw( css::uno::RuntimeException, css::lang::DisposedException ) SAL_OVERRIDE;
-        virtual void               unregisterTransaction        (                                              ) throw( css::uno::RuntimeException, css::lang::DisposedException ) SAL_OVERRIDE;
+                                   ~TransactionManager          (                                              );
+        void               setWorkingMode               ( EWorkingMode eMode                           );
+        EWorkingMode       getWorkingMode               (                                              ) const;
+        bool               isCallRejected               ( ERejectReason& eReason                       ) const;
+        void               registerTransaction          ( EExceptionMode eMode, ERejectReason& eReason ) throw( css::uno::RuntimeException, css::lang::DisposedException );
+        void               unregisterTransaction        (                                              ) throw( css::uno::RuntimeException, css::lang::DisposedException );
 
     //  private methods
 
diff --git a/framework/source/fwi/threadhelp/transactionmanager.cxx b/framework/source/fwi/threadhelp/transactionmanager.cxx
index 3d001a8..77a4894 100644
--- a/framework/source/fwi/threadhelp/transactionmanager.cxx
+++ b/framework/source/fwi/threadhelp/transactionmanager.cxx
@@ -44,7 +44,6 @@ TransactionManager::~TransactionManager()
 }
 
 /*-****************************************************************************************************
-    @interface  ITransactionManager
     @short      set new working mode
     @descr      These implementation knows for states of working: E_INIT, E_WORK, E_CLOSING, E_CLOSE
                 You can step during this ones only from the left to the right side and start at left side again!
@@ -99,7 +98,6 @@ void  TransactionManager::setWorkingMode( EWorkingMode eMode )
 }
 
 /*-****************************************************************************************************
-    @interface  ITransactionManager
     @short      get current working mode
     @descr      If you stand in your close() or init() method ... but don't know
                 if you called more then ones(!) ... you can use this function to get
@@ -143,7 +141,6 @@ EWorkingMode TransactionManager::getWorkingMode() const
 }
 
 /*-****************************************************************************************************
-    @interface  ITransactionManager
     @short      start new transaction
     @descr      A guard should use this method to start a new transaction. He should looks for rejected
                 calls to by using parameter eMode and eReason.
@@ -182,7 +179,6 @@ void  TransactionManager::registerTransaction( EExceptionMode eMode, ERejectReas
 }
 
 /*-****************************************************************************************************
-    @interface  ITransactionManager
     @short      finish transaction
     @descr      A guard should call this method to release current transaction.
 
@@ -206,7 +202,6 @@ void  TransactionManager::unregisterTransaction() throw( css::uno::RuntimeExcept
 }
 
 /*-****************************************************************************************************
-    @interface  ITransactionManager
     @short      look for rejected calls
     @descr      Sometimes user need a possibility to get information about rejected calls
                 without starting a transaction!


More information about the Libreoffice-commits mailing list