summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-03 13:15:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-03 13:44:15 +0000
commit37a4d67d6885860c279476c2504e35c3190ffc6c (patch)
tree6816c9faf819d7df596dbbd22d469b968b555d6c /framework
parente55096a07a450782c4ab919b7ba60852841004c7 (diff)
flatten DocumentUndoGuard
which is a small object, and doesn't need a pimpl pattern Change-Id: Ib76f6e5ad0347be61fe29b22f57e1211ce3337cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148172 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/fwe/helper/documentundoguard.cxx67
1 files changed, 20 insertions, 47 deletions
diff --git a/framework/source/fwe/helper/documentundoguard.cxx b/framework/source/fwe/helper/documentundoguard.cxx
index 3442cd501131..0a027921817a 100644
--- a/framework/source/fwe/helper/documentundoguard.cxx
+++ b/framework/source/fwe/helper/documentundoguard.cxx
@@ -44,8 +44,6 @@ namespace framework
typedef ::cppu::WeakImplHelper < XUndoManagerListener
> UndoManagerContextListener_Base;
- namespace {
-
class UndoManagerContextListener : public UndoManagerContextListener_Base
{
public:
@@ -100,8 +98,6 @@ namespace framework
bool m_documentDisposed;
};
- }
-
void SAL_CALL UndoManagerContextListener::undoActionAdded( const UndoManagerEvent& )
{
// not interested in
@@ -162,60 +158,37 @@ namespace framework
m_documentDisposed = true;
}
- //= DocumentUndoGuard_Data
-
- struct DocumentUndoGuard_Data
- {
- Reference< XUndoManager > xUndoManager;
- ::rtl::Reference< UndoManagerContextListener > pContextListener;
- };
+ //= DocumentUndoGuard
- namespace
+ DocumentUndoGuard::DocumentUndoGuard( const Reference< XInterface >& i_undoSupplierComponent )
{
-
- void lcl_init( DocumentUndoGuard_Data& i_data, const Reference< XInterface >& i_undoSupplierComponent )
+ try
{
- try
- {
- Reference< XUndoManagerSupplier > xUndoSupplier( i_undoSupplierComponent, UNO_QUERY );
- if ( xUndoSupplier.is() )
- i_data.xUndoManager.set( xUndoSupplier->getUndoManager(), css::uno::UNO_SET_THROW );
+ Reference< XUndoManagerSupplier > xUndoSupplier( i_undoSupplierComponent, UNO_QUERY );
+ if ( xUndoSupplier.is() )
+ mxUndoManager.set( xUndoSupplier->getUndoManager(), css::uno::UNO_SET_THROW );
- if ( i_data.xUndoManager.is() )
- i_data.pContextListener.set( new UndoManagerContextListener( i_data.xUndoManager ) );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("fwk");
- }
+ if ( mxUndoManager.is() )
+ mxContextListener.set( new UndoManagerContextListener( mxUndoManager ) );
}
-
- void lcl_restore( DocumentUndoGuard_Data& i_data )
+ catch( const Exception& )
{
- try
- {
- if ( i_data.pContextListener.is() )
- i_data.pContextListener->finish();
- i_data.pContextListener.clear();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("fwk");
- }
+ DBG_UNHANDLED_EXCEPTION("fwk");
}
}
- //= DocumentUndoGuard
-
- DocumentUndoGuard::DocumentUndoGuard( const Reference< XInterface >& i_undoSupplierComponent )
- :m_xData( new DocumentUndoGuard_Data )
- {
- lcl_init( *m_xData, i_undoSupplierComponent );
- }
-
DocumentUndoGuard::~DocumentUndoGuard()
{
- lcl_restore( *m_xData );
+ try
+ {
+ if ( mxContextListener.is() )
+ mxContextListener->finish();
+ mxContextListener.clear();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("fwk");
+ }
}
} // namespace framework