summaryrefslogtreecommitdiff
path: root/chart2/source/model
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-11-16 08:49:38 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-11-16 08:49:38 +0100
commit4d0ae2eac2ac03475b7496f81e803b9b71b7481f (patch)
treea3dec753cf2a69951829ca75e200648c1b647f88 /chart2/source/model
parent3909360c32b8e018bab468db7aece015c6d1a2b4 (diff)
undoapi: step 2.3 of the migration of css.chart2.XUndoManager to css.document.XUndoManager:
migrate the clients of XDocumentActions to using the new XUndoManager, and completely remove the (X)DocumentActions still some more cleanup needed
Diffstat (limited to 'chart2/source/model')
-rwxr-xr-xchart2/source/model/main/ChartModel.cxx109
-rw-r--r--chart2/source/model/main/ChartModel.hxx44
-rwxr-xr-xchart2/source/model/main/UndoManager.cxx15
-rwxr-xr-xchart2/source/model/main/UndoManager.hxx10
4 files changed, 27 insertions, 151 deletions
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 6ba450d76f5f..481f968f9488 100755
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -155,7 +155,6 @@ ChartModel::ChartModel( const ChartModel & rOther )
, m_aGraphicObjectVector( rOther.m_aGraphicObjectVector )
, m_xDataProvider( rOther.m_xDataProvider )
, m_xInternalDataProvider( rOther.m_xInternalDataProvider )
- , m_xDocumentActions( NULL )
{
OSL_TRACE( "ChartModel: Copy-CTOR called" );
@@ -557,8 +556,6 @@ void SAL_CALL ChartModel::dispose() throw(uno::RuntimeException)
m_pUndoManager.clear();
// that's important, since the UndoManager implementation delegates its ref counting to ourself.
- m_xDocumentActions.clear();
-
m_aControllers.disposeAndClear( lang::EventObject( static_cast< cppu::OWeakObject * >( this )));
m_xCurrentController.clear();
@@ -1366,112 +1363,6 @@ void SAL_CALL ChartModel::setParent( const Reference< uno::XInterface >& Parent
m_xParent.set( Parent, uno::UNO_QUERY );
}
-bool ChartModel::impl_getDocumentActions_lck()
-{
- if ( !m_xDocumentActions.is() )
- m_xDocumentActions.set( createInstance( CHART_DOCUMENT_ACTIONS_SERVICE_NAME ), uno::UNO_QUERY );
- OSL_POSTCOND( m_xDocumentActions.is(), "ChartModel::impl_getDocumentActions_lck: could not create the legacy DocumentActions service!" );
- return m_xDocumentActions.is();
-}
-
-// ____ XDocumentActions ____
-void SAL_CALL ChartModel::preAction( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- m_xDocumentActions->preAction();
-}
-
-void SAL_CALL ChartModel::preActionWithArguments( const Sequence< beans::PropertyValue >& aArguments ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- m_xDocumentActions->preActionWithArguments( aArguments );
-}
-
-void SAL_CALL ChartModel::postAction( const ::rtl::OUString& aUndoText ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- m_xDocumentActions->postAction( aUndoText );
-}
-
-void SAL_CALL ChartModel::cancelAction( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- m_xDocumentActions->cancelAction();
-}
-
-void SAL_CALL ChartModel::cancelActionWithUndo( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- m_xDocumentActions->cancelActionWithUndo();
-}
-
-void SAL_CALL ChartModel::undo( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- m_xDocumentActions->undo();
-}
-
-void SAL_CALL ChartModel::redo( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- m_xDocumentActions->redo();
-}
-
-::sal_Bool SAL_CALL ChartModel::undoPossible( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- return m_xDocumentActions->undoPossible();
- return sal_False;
-}
-
-::sal_Bool SAL_CALL ChartModel::redoPossible( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- return m_xDocumentActions->redoPossible();
- return sal_False;
-}
-
-::rtl::OUString SAL_CALL ChartModel::getCurrentUndoString( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- return m_xDocumentActions->getCurrentUndoString();
- return ::rtl::OUString();
-}
-
-::rtl::OUString SAL_CALL ChartModel::getCurrentRedoString( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- return m_xDocumentActions->getCurrentRedoString();
- return ::rtl::OUString();
-}
-
-Sequence< ::rtl::OUString > SAL_CALL ChartModel::getAllUndoStrings( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- return m_xDocumentActions->getAllUndoStrings();
- return Sequence< ::rtl::OUString >();
-}
-
-Sequence< ::rtl::OUString > SAL_CALL ChartModel::getAllRedoStrings( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aModelMutex );
- if ( impl_getDocumentActions_lck() )
- return m_xDocumentActions->getAllRedoStrings();
- return Sequence< ::rtl::OUString >();
-}
-
// ____ XDataSource ____
uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL ChartModel::getDataSequences()
throw (uno::RuntimeException)
diff --git a/chart2/source/model/main/ChartModel.hxx b/chart2/source/model/main/ChartModel.hxx
index 772640510400..6b59eda1b0f4 100644
--- a/chart2/source/model/main/ChartModel.hxx
+++ b/chart2/source/model/main/ChartModel.hxx
@@ -46,7 +46,6 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/chart2/XDocumentActions.hpp>
#include <com/sun/star/chart2/data/XDataSource.hpp>
#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -63,9 +62,9 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/datatransfer/XTransferable.hpp>
-#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_21)
-#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_21
-#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 21
+#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_20)
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_20
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 20
#include "comphelper/implbase_var.hxx"
#endif
#include <osl/mutex.hxx>
@@ -85,7 +84,7 @@ namespace impl
{
// Note: needed for queryInterface (if it calls the base-class implementation)
-typedef ::comphelper::WeakImplHelper21<
+typedef ::comphelper::WeakImplHelper20<
// ::com::sun::star::frame::XModel //comprehends XComponent (required interface), base of XChartDocument
::com::sun::star::util::XCloseable //comprehends XCloseBroadcaster
,::com::sun::star::frame::XStorable2 //(extension of XStorable)
@@ -108,7 +107,6 @@ typedef ::comphelper::WeakImplHelper21<
,::com::sun::star::container::XChild
,::com::sun::star::util::XModifyListener
,::com::sun::star::datatransfer::XTransferable
- ,::com::sun::star::chart2::XDocumentActions
,::com::sun::star::document::XDocumentPropertiesSupplier
,::com::sun::star::chart2::data::XDataSource
,::com::sun::star::document::XUndoManagerSupplier
@@ -175,8 +173,6 @@ private:
bool m_bIsDisposed;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
m_xPageBackground;
- ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDocumentActions >
- m_xDocumentActions;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xXMLNamespaceMap;
@@ -602,41 +598,9 @@ public:
throw (::com::sun::star::lang::NoSupportException,
::com::sun::star::uno::RuntimeException);
- // ____ XDocumentActions ____
- virtual void SAL_CALL preAction( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL preActionWithArguments(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL postAction( const ::rtl::OUString& aUndoText )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancelAction( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancelActionWithUndo( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL undo( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL redo( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL undoPossible( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL redoPossible( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCurrentUndoString( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCurrentRedoString( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllUndoStrings( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllRedoStrings( )
- throw (::com::sun::star::uno::RuntimeException);
-
// ____ XDataSource ____ allows access to the curently used data and data ranges
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences()
throw (::com::sun::star::uno::RuntimeException);
-
-private:
- bool impl_getDocumentActions_lck();
};
} // namespace chart
diff --git a/chart2/source/model/main/UndoManager.cxx b/chart2/source/model/main/UndoManager.cxx
index 5ae57808b3c2..7260ac15987f 100755
--- a/chart2/source/model/main/UndoManager.cxx
+++ b/chart2/source/model/main/UndoManager.cxx
@@ -62,6 +62,7 @@ namespace chart
using ::com::sun::star::lang::IllegalArgumentException;
using ::com::sun::star::document::XUndoManagerListener;
using ::com::sun::star::util::NotLockedException;
+ using ::com::sun::star::lang::NoSupportException;
/** === end UNO using === **/
namespace impl
@@ -381,6 +382,20 @@ namespace chart
return m_pImpl->getUndoHelper().isLocked();
}
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL UndoManager::getParent( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return *&m_pImpl->getParent();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::setParent( const Reference< XInterface >& i_parent ) throw (NoSupportException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ (void)i_parent;
+ throw NoSupportException( ::rtl::OUString(), m_pImpl->getThis() );
+ }
//......................................................................................................................
} // namespace chart
diff --git a/chart2/source/model/main/UndoManager.hxx b/chart2/source/model/main/UndoManager.hxx
index 4e6c2b0417cf..28f41afd6241 100755
--- a/chart2/source/model/main/UndoManager.hxx
+++ b/chart2/source/model/main/UndoManager.hxx
@@ -29,9 +29,10 @@
/** === begin UNO includes === **/
#include <com/sun/star/document/XUndoManager.hpp>
+#include <com/sun/star/container/XChild.hpp>
/** === end UNO includes === **/
-#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <boost/scoped_ptr.hpp>
@@ -43,7 +44,8 @@ namespace chart
namespace impl
{
class UndoManager_Impl;
- typedef ::cppu::ImplHelper1 < ::com::sun::star::document::XUndoManager
+ typedef ::cppu::ImplHelper2 < ::com::sun::star::document::XUndoManager
+ , ::com::sun::star::container::XChild
> UndoManager_Base;
}
@@ -87,6 +89,10 @@ namespace chart
virtual void SAL_CALL unlock( ) throw (::com::sun::star::util::NotLockedException, ::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isLocked( ) throw (::com::sun::star::uno::RuntimeException);
+ // XChild
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
private:
::boost::scoped_ptr< impl::UndoManager_Impl > m_pImpl;
};