diff options
Diffstat (limited to 'toolkit/source/controls/grid/gridcolumn.hxx')
-rw-r--r-- | toolkit/source/controls/grid/gridcolumn.hxx | 114 |
1 files changed, 71 insertions, 43 deletions
diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx index 38d43d55a07b..b1be836a3862 100644 --- a/toolkit/source/controls/grid/gridcolumn.hxx +++ b/toolkit/source/controls/grid/gridcolumn.hxx @@ -25,83 +25,111 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_toolkit.hxx" + #include <com/sun/star/awt/grid/XGridColumn.hpp> -#include <com/sun/star/awt/grid/XGridColumnListener.hpp> -#include <com/sun/star/awt/grid/GridColumnEvent.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> -#include <cppuhelper/implbase2.hxx> -#include <cppuhelper/implbase3.hxx> +#include <com/sun/star/style/HorizontalAlignment.hpp> + +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase3.hxx> +#include <comphelper/componentguard.hxx> #include <rtl/ref.hxx> -#include <vector> #include <toolkit/helper/mutexandbroadcasthelper.hxx> -#include <com/sun/star/style/HorizontalAlignment.hpp> -using ::rtl::OUString; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::awt::grid; -using namespace ::com::sun::star::lang; +#include <vector> namespace toolkit { -enum broadcast_column_type { column_attribute_changed}; -class GridColumn : public ::cppu::WeakImplHelper2< XGridColumn, XServiceInfo >, - public MutexAndBroadcastHelper +typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::awt::grid::XGridColumn + , ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::lang::XUnoTunnel + > GridColumn_Base; +class GridColumn :public ::cppu::BaseMutex + ,public GridColumn_Base { public: GridColumn(); + GridColumn( GridColumn const & i_copySource ); virtual ~GridColumn(); - // XGridColumn + // ::com::sun::star::awt::grid::XGridColumn virtual ::com::sun::star::uno::Any SAL_CALL getIdentifier() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getPreferredWidth() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPreferredWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setResizeable(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getFlexibility() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFlexibility( ::sal_Int32 _flexibility ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getHelpText() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHelpText(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getIndex() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getDataColumnIndex() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateColumn( const ::rtl::OUString& name, ::sal_Int32 width ) throw (::com::sun::star::uno::RuntimeException); - // XComponent - virtual void SAL_CALL dispose( ) throw (RuntimeException); - virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); - virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException); + virtual void SAL_CALL addGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // XCloneable (base of XGridColumn) + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException); // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + + // XUnoTunnel and friends + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& i_identifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelId() throw(); + static GridColumn* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_component ); + + // attribute access + void setIndex( sal_Int32 const i_index ); - virtual void SAL_CALL setIndex(sal_Int32 _nIndex)throw (::com::sun::star::uno::RuntimeException); private: - void broadcast( broadcast_column_type eType, const GridColumnEvent& aEvent ); - void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue); - - Any identifier; - sal_Int32 index; - sal_Int32 columnWidth; - sal_Int32 preferredWidth; - sal_Int32 maxWidth; - sal_Int32 minWidth; - sal_Bool bResizeable; - ::rtl::OUString title; - ::com::sun::star::style::HorizontalAlignment horizontalAlign; + void broadcast_changed( + sal_Char const * const i_asciiAttributeName, + ::com::sun::star::uno::Any i_oldValue, + ::com::sun::star::uno::Any i_newValue, + ::comphelper::ComponentGuard& i_Guard + ); + + template< class TYPE > + void impl_set( TYPE & io_attribute, TYPE const & i_newValue, sal_Char const * i_attributeName ) + { + ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + if ( io_attribute == i_newValue ) + return; + + TYPE const aOldValue( io_attribute ); + io_attribute = i_newValue; + broadcast_changed( i_attributeName, ::com::sun::star::uno::makeAny( aOldValue ), ::com::sun::star::uno::makeAny( io_attribute ), aGuard ); + } + + ::com::sun::star::uno::Any m_aIdentifier; + sal_Int32 m_nIndex; + sal_Int32 m_nDataColumnIndex; + sal_Int32 m_nColumnWidth; + sal_Int32 m_nMaxWidth; + sal_Int32 m_nMinWidth; + sal_Int32 m_nFlexibility; + sal_Bool m_bResizeable; + ::rtl::OUString m_sTitle; + ::rtl::OUString m_sHelpText; + ::com::sun::star::style::HorizontalAlignment m_eHorizontalAlign; }; } |