summaryrefslogtreecommitdiff
path: root/extensions/source/propctrlr/commoncontrol.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/source/propctrlr/commoncontrol.hxx')
-rw-r--r--extensions/source/propctrlr/commoncontrol.hxx108
1 files changed, 35 insertions, 73 deletions
diff --git a/extensions/source/propctrlr/commoncontrol.hxx b/extensions/source/propctrlr/commoncontrol.hxx
index 607d54d261ae..f8062adc52e2 100644
--- a/extensions/source/propctrlr/commoncontrol.hxx
+++ b/extensions/source/propctrlr/commoncontrol.hxx
@@ -34,13 +34,13 @@ namespace pcr
{
- class ControlHelper;
+ class CommonBehaviourControlHelper;
template< class TControlWindow >
class ControlWindow : public TControlWindow
{
protected:
- ControlHelper* m_pHelper;
+ CommonBehaviourControlHelper* m_pHelper;
public:
ControlWindow( vcl::Window* _pParent, WinBits _nStyle )
@@ -49,34 +49,20 @@ namespace pcr
{
}
- /// sets a ControlHelper instance which some functionality is delegated to
- virtual void setControlHelper( ControlHelper& _rControlHelper )
+ /// sets a CommonBehaviourControlHelper instance which some functionality is delegated to
+ virtual void setControlHelper( CommonBehaviourControlHelper& _rControlHelper )
{ m_pHelper = &_rControlHelper; }
};
- //= IModifyListener
-
- class SAL_NO_VTABLE IModifyListener
- {
- public:
- virtual void modified() = 0;
-
- protected:
- ~IModifyListener() {}
- };
-
-
- //= ControlHelper
+ //= CommonBehaviourControlHelper
/** A helper class for implementing the <type scope="css::inspection">XPropertyControl</type>
or one of its derived interfaces.
- This class is intended to be held as member of another class which implements the
- <type scope="css::inspection">XPropertyControl</type> interface. The pointer
- to this interface is to be passed to the ctor.
+ This class is used as a base class the CommonBehaviourControl template.
*/
- class ControlHelper
+ class CommonBehaviourControlHelper
{
private:
VclPtr<vcl::Window> m_pControlWindow;
@@ -85,7 +71,6 @@ namespace pcr
m_xContext;
css::inspection::XPropertyControl&
m_rAntiImpl;
- IModifyListener* m_pModifyListener;
bool m_bModified;
public:
@@ -93,36 +78,26 @@ namespace pcr
@param _rControlWindow
the window which is associated with the <type scope="css::inspection">XPropertyControl</type>.
Must not be <NULL/>.<br/>
- Ownership for this window is taken by the ControlHelper - it will be deleted in <member>disposing</member>.
+ Ownership for this window is taken by the CommonBehaviourControlHelper - it will be deleted in <member>disposing</member>.
@param _nControlType
the type of the control - one of the <type scope="css::inspection">PropertyControlType</type>
constants
@param _pAntiImpl
- Reference to the instance as whose "impl-class" we act. This reference is held during lifetime
- of the <type>ControlHelper</type> class, within acquiring it. Thus, the owner of the
- <type>ControlHelper</type> is responsible for assuring the lifetime of the instance
- pointed to by <arg>_pAntiImpl</arg>.
- @param _pModifyListener
- a listener to be modfied when the user modified the control's value. the
- <member>IModifyListener::modified</member> of this listener is called from within our
- ModifiedHdl. A default implementation of <member>IModifyListener::modified</member>
- would just call our <member>setModified</member>.
+ Reference to the instance as whose "impl-class" we act i.e. the CommonBehaviourControl<> template,
+ which is why we hold it without acquiring it/
*/
- ControlHelper(
+ CommonBehaviourControlHelper(
vcl::Window* _pControlWindow,
sal_Int16 _nControlType,
- css::inspection::XPropertyControl& _rAntiImpl,
- IModifyListener* _pModifyListener );
+ css::inspection::XPropertyControl& _rAntiImpl);
- virtual ~ControlHelper();
+ virtual ~CommonBehaviourControlHelper();
- /** sets our "modified" flag to <TRUE/>
- */
- inline void setModified() { m_bModified = true; }
inline vcl::Window* getVclControlWindow() { return m_pControlWindow; }
inline const vcl::Window* getVclControlWindow() const { return m_pControlWindow; }
- public:
+ virtual void modified() { m_bModified = true; }
+
// XPropertyControl
::sal_Int16 SAL_CALL getControlType() throw (css::uno::RuntimeException) { return m_nControlType; }
css::uno::Reference< css::inspection::XPropertyControlContext > SAL_CALL getControlContext() throw (css::uno::RuntimeException) { return m_xContext; }
@@ -136,9 +111,8 @@ namespace pcr
/** (fail-safe) wrapper around calling our context's activateNextControl
*/
- inline void activateNextControl() const { impl_activateNextControl_nothrow(); }
+ void activateNextControl() const;
- public:
/// automatically size the window given in the ctor
void autoSizeWindow();
@@ -146,19 +120,13 @@ namespace pcr
DECL_LINK( ModifiedHdl, vcl::Window* );
DECL_LINK_TYPED( GetFocusHdl, Control&, void );
DECL_LINK_TYPED( LoseFocusHdl, Control&, void );
-
- private:
- /** fail-safe wrapper around calling our context's activateNextControl
- */
- void impl_activateNextControl_nothrow() const;
};
//= CommonBehaviourControl
/** implements a base class for <type scope="css::inspection">XPropertyControl</type>
- implementations, which delegates the generic functionality of this interface to a
- <type>ControlHelper</type> member.
+ implementations
@param TControlInterface
an interface class which is derived from (or identical to) <type scope="css::inspection">XPropertyControl</type>
@@ -168,43 +136,37 @@ namespace pcr
template < class TControlInterface, class TControlWindow >
class CommonBehaviourControl :public ::comphelper::OBaseMutex
,public ::cppu::WeakComponentImplHelper< TControlInterface >
- ,public IModifyListener
+ ,public CommonBehaviourControlHelper
{
protected:
typedef ::comphelper::OBaseMutex MutexBaseClass;
typedef ::cppu::WeakComponentImplHelper< TControlInterface > ComponentBaseClass;
- protected:
- ControlHelper m_aImplControl;
-
- protected:
inline CommonBehaviourControl( sal_Int16 _nControlType, vcl::Window* _pParentWindow, WinBits _nWindowStyle, bool _bDoSetHandlers = true );
// XPropertyControl - delegated to ->m_aImplControl
virtual ::sal_Int16 SAL_CALL getControlType() throw (css::uno::RuntimeException) SAL_OVERRIDE
- { return m_aImplControl.getControlType(); }
+ { return CommonBehaviourControlHelper::getControlType(); }
virtual css::uno::Reference< css::inspection::XPropertyControlContext > SAL_CALL getControlContext() throw (css::uno::RuntimeException) SAL_OVERRIDE
- { return m_aImplControl.getControlContext(); }
+ { return CommonBehaviourControlHelper::getControlContext(); }
virtual void SAL_CALL setControlContext( const css::uno::Reference< css::inspection::XPropertyControlContext >& _controlcontext ) throw (css::uno::RuntimeException) SAL_OVERRIDE
- { m_aImplControl.setControlContext( _controlcontext ); }
+ { CommonBehaviourControlHelper::setControlContext( _controlcontext ); }
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getControlWindow() throw (css::uno::RuntimeException) SAL_OVERRIDE
- { return m_aImplControl.getControlWindow(); }
+ { return CommonBehaviourControlHelper::getControlWindow(); }
virtual sal_Bool SAL_CALL isModified( ) throw (css::uno::RuntimeException) SAL_OVERRIDE
- { return m_aImplControl.isModified(); }
+ { return CommonBehaviourControlHelper::isModified(); }
virtual void SAL_CALL notifyModifiedValue( ) throw (css::uno::RuntimeException) SAL_OVERRIDE
- { m_aImplControl.notifyModifiedValue(); }
+ { CommonBehaviourControlHelper::notifyModifiedValue(); }
// XComponent
virtual void SAL_CALL disposing() SAL_OVERRIDE
- { m_aImplControl.dispose(); }
-
- // IModifyListener
- virtual void modified() SAL_OVERRIDE
- { m_aImplControl.setModified(); }
+ { CommonBehaviourControlHelper::dispose(); }
/// returns a typed pointer to our control window
- TControlWindow* getTypedControlWindow() { return static_cast< TControlWindow* > ( m_aImplControl.getVclControlWindow() ); }
- const TControlWindow* getTypedControlWindow() const { return static_cast< const TControlWindow* >( m_aImplControl.getVclControlWindow() ); }
+ TControlWindow* getTypedControlWindow()
+ { return static_cast< TControlWindow* >( CommonBehaviourControlHelper::getVclControlWindow() ); }
+ const TControlWindow* getTypedControlWindow() const
+ { return static_cast< const TControlWindow* >( CommonBehaviourControlHelper::getVclControlWindow() ); }
protected:
/** checks whether the instance is already disposed
@@ -221,17 +183,17 @@ namespace pcr
template< class TControlInterface, class TControlWindow >
inline CommonBehaviourControl< TControlInterface, TControlWindow >::CommonBehaviourControl ( sal_Int16 _nControlType, vcl::Window* _pParentWindow, WinBits _nWindowStyle, bool _bDoSetHandlers )
:ComponentBaseClass( m_aMutex )
- ,m_aImplControl( new TControlWindow( _pParentWindow, _nWindowStyle ), _nControlType, *this, this )
+ ,CommonBehaviourControlHelper( new TControlWindow( _pParentWindow, _nWindowStyle ), _nControlType, *this )
{
TControlWindow* pControlWindow( getTypedControlWindow() );
- pControlWindow->setControlHelper( m_aImplControl );
+ pControlWindow->setControlHelper( *this );
if ( _bDoSetHandlers )
{
- pControlWindow->SetModifyHdl( LINK( &m_aImplControl, ControlHelper, ModifiedHdl ) );
- pControlWindow->SetGetFocusHdl( LINK( &m_aImplControl, ControlHelper, GetFocusHdl ) );
- pControlWindow->SetLoseFocusHdl( LINK( &m_aImplControl, ControlHelper, LoseFocusHdl ) );
+ pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, ModifiedHdl ) );
+ pControlWindow->SetGetFocusHdl( LINK( this, CommonBehaviourControlHelper, GetFocusHdl ) );
+ pControlWindow->SetLoseFocusHdl( LINK( this, CommonBehaviourControlHelper, LoseFocusHdl ) );
}
- m_aImplControl.autoSizeWindow();
+ autoSizeWindow();
}