summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-11-29 15:21:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-11-30 21:33:48 +0100
commit6b6609fc03d484ce1bfb18162b709704049b5ee9 (patch)
treec18b947e668ea4b123d6e79f7f50801e0a29d6c4 /svx/source
parent9f38f9304e7ef9737a8b73a2ebf7d21e6a4d73fe (diff)
loplugin:mergeclasses FormScriptingEnvironment with IFormScriptingEnvironment
Change-Id: I334ad78681e2b7389388316881fd9f57455e875f Reviewed-on: https://gerrit.libreoffice.org/84109 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/form/fmscriptingenv.cxx54
-rw-r--r--svx/source/form/fmundo.cxx2
-rw-r--r--svx/source/inc/fmscriptingenv.hxx35
-rw-r--r--svx/source/inc/fmundo.hxx2
4 files changed, 24 insertions, 69 deletions
diff --git a/svx/source/form/fmscriptingenv.cxx b/svx/source/form/fmscriptingenv.cxx
index f76f8e86f729..aa480dd3a123 100644
--- a/svx/source/form/fmscriptingenv.cxx
+++ b/svx/source/form/fmscriptingenv.cxx
@@ -71,19 +71,11 @@ namespace svxform
using ::com::sun::star::awt::XControl;
using ::com::sun::star::beans::XPropertySet;
- namespace {
-
- class FormScriptingEnvironment;
-
- }
-
//= FormScriptListener
typedef ::cppu::WeakImplHelper < XScriptListener
> FormScriptListener_Base;
- namespace {
-
/** implements the XScriptListener interface, is used by FormScriptingEnvironment
*/
class FormScriptListener :public FormScriptListener_Base
@@ -145,37 +137,6 @@ namespace svxform
DECL_LINK( OnAsyncScriptEvent, void*, void );
};
- class FormScriptingEnvironment:
- public IFormScriptingEnvironment
- {
- private:
- typedef rtl::Reference<FormScriptListener> ListenerImplementation;
-
- private:
- ::osl::Mutex m_aMutex;
- ListenerImplementation m_pScriptListener;
- FmFormModel& m_rFormModel;
- bool m_bDisposed;
-
- public:
- explicit FormScriptingEnvironment( FmFormModel& _rModel );
- FormScriptingEnvironment(const FormScriptingEnvironment&) = delete;
- FormScriptingEnvironment& operator=(const FormScriptingEnvironment&) = delete;
-
- // callback for FormScriptListener
- void doFireScriptEvent( const ScriptEvent& _rEvent, Any* _pSynchronousResult );
-
- // IFormScriptingEnvironment
- virtual void registerEventAttacherManager( const Reference< XEventAttacherManager >& _rxManager ) override;
- virtual void revokeEventAttacherManager( const Reference< XEventAttacherManager >& _rxManager ) override;
- virtual void dispose() override;
-
- private:
- void impl_registerOrRevoke_throw( const Reference< XEventAttacherManager >& _rxManager, bool _bRegister );
- };
-
- }
-
FormScriptListener::FormScriptListener( FormScriptingEnvironment* pScriptExecutor )
:m_pScriptExecutor( pScriptExecutor )
{
@@ -906,7 +867,7 @@ namespace svxform
:m_rFormModel( _rModel )
,m_bDisposed( false )
{
- m_pScriptListener = ListenerImplementation( new FormScriptListener( this ) );
+ m_pScriptListener = new FormScriptListener( this );
// note that this is a cyclic reference between the FormScriptListener and the FormScriptingEnvironment
// This cycle is broken up when our instance is disposed.
}
@@ -946,12 +907,6 @@ namespace svxform
impl_registerOrRevoke_throw( _rxManager, false );
}
-
- IFormScriptingEnvironment::~IFormScriptingEnvironment()
- {
- }
-
-
namespace
{
class NewStyleUNOScript
@@ -1080,13 +1035,6 @@ namespace svxform
m_pScriptListener.clear();
}
-
- PFormScriptingEnvironment createDefaultFormScriptingEnvironment( FmFormModel& _rModel )
- {
- return new FormScriptingEnvironment( _rModel );
- }
-
-
}
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index 2552161a43f9..d887bbad661f 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -177,7 +177,7 @@ static OUString static_STR_UNDO_PROPERTY;
FmXUndoEnvironment::FmXUndoEnvironment(FmFormModel& _rModel)
:rModel( _rModel )
,m_pPropertySetCache( nullptr )
- ,m_pScriptingEnv( ::svxform::createDefaultFormScriptingEnvironment( _rModel ) )
+ ,m_pScriptingEnv( new svxform::FormScriptingEnvironment( _rModel ) )
,m_Locks( 0 )
,bReadOnly( false )
,m_bDisposed( false )
diff --git a/svx/source/inc/fmscriptingenv.hxx b/svx/source/inc/fmscriptingenv.hxx
index d747f038e844..ef4f29f80418 100644
--- a/svx/source/inc/fmscriptingenv.hxx
+++ b/svx/source/inc/fmscriptingenv.hxx
@@ -28,16 +28,21 @@ class FmFormModel;
namespace svxform
{
-
+ class FormScriptListener;
//= IFormScriptingEnvironment
/** describes the interface implemented by a component which handles scripting requirements
in a form/control environment.
*/
- class SAL_NO_VTABLE IFormScriptingEnvironment : public ::salhelper::SimpleReferenceObject
+ class FormScriptingEnvironment : public ::salhelper::SimpleReferenceObject
{
+ friend class FormScriptListener;
public:
+ explicit FormScriptingEnvironment( FmFormModel& _rModel );
+ FormScriptingEnvironment(const FormScriptingEnvironment&) = delete;
+ FormScriptingEnvironment& operator=(const FormScriptingEnvironment&) = delete;
+
/** registers an XEventAttacherManager whose events should be monitored and handled
@param _rxManager
@@ -50,8 +55,8 @@ namespace svxform
@throws css::uno::RuntimeException
if attaching as script listener to the manager fails with a RuntimeException itself
*/
- virtual void registerEventAttacherManager(
- const css::uno::Reference< css::script::XEventAttacherManager >& _rxManager ) = 0;
+ void registerEventAttacherManager(
+ const css::uno::Reference< css::script::XEventAttacherManager >& _rxManager );
/** registers an XEventAttacherManager whose events should not be monitored and handled anymore
@@ -65,22 +70,24 @@ namespace svxform
@throws css::uno::RuntimeException
if removing as script listener from the manager fails with a RuntimeException itself
*/
- virtual void revokeEventAttacherManager(
- const css::uno::Reference< css::script::XEventAttacherManager >& _rxManager ) = 0;
+ void revokeEventAttacherManager(
+ const css::uno::Reference< css::script::XEventAttacherManager >& _rxManager );
/** disposes the scripting environment instance
*/
- virtual void dispose() = 0;
-
- virtual ~IFormScriptingEnvironment() override;
- };
- typedef ::rtl::Reference< IFormScriptingEnvironment > PFormScriptingEnvironment;
+ void dispose();
+ private:
+ ::osl::Mutex m_aMutex;
+ rtl::Reference<FormScriptListener> m_pScriptListener;
+ FmFormModel& m_rFormModel;
+ bool m_bDisposed;
- /** creates a default component implementing the IFormScriptingEnvironment interface
- */
- PFormScriptingEnvironment createDefaultFormScriptingEnvironment( FmFormModel& _rFormModel );
+ void impl_registerOrRevoke_throw( const css::uno::Reference< css::script::XEventAttacherManager >& _rxManager, bool _bRegister );
+ // callback for FormScriptListener
+ void doFireScriptEvent( const css::script::ScriptEvent& _rEvent, css::uno::Any* _pSynchronousResult );
+ };
}
diff --git a/svx/source/inc/fmundo.hxx b/svx/source/inc/fmundo.hxx
index 3d950ff473fc..a56b2e3fe6ab 100644
--- a/svx/source/inc/fmundo.hxx
+++ b/svx/source/inc/fmundo.hxx
@@ -186,7 +186,7 @@ private:
FmFormModel& rModel;
void* m_pPropertySetCache;
- ::svxform::PFormScriptingEnvironment m_pScriptingEnv;
+ ::rtl::Reference<svxform::FormScriptingEnvironment> m_pScriptingEnv;
oslInterlockedCount m_Locks;
::osl::Mutex m_aMutex;
bool bReadOnly;