1*50e6b072SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*50e6b072SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*50e6b072SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*50e6b072SAndrew Rist * distributed with this work for additional information 6*50e6b072SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*50e6b072SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*50e6b072SAndrew Rist * "License"); you may not use this file except in compliance 9*50e6b072SAndrew Rist * with the License. You may obtain a copy of the License at 10*50e6b072SAndrew Rist * 11*50e6b072SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*50e6b072SAndrew Rist * 13*50e6b072SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*50e6b072SAndrew Rist * software distributed under the License is distributed on an 15*50e6b072SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*50e6b072SAndrew Rist * KIND, either express or implied. See the License for the 17*50e6b072SAndrew Rist * specific language governing permissions and limitations 18*50e6b072SAndrew Rist * under the License. 19*50e6b072SAndrew Rist * 20*50e6b072SAndrew Rist *************************************************************/ 21*50e6b072SAndrew Rist 22*50e6b072SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef TOOLKIT_GRID_CONTROL_HXX 25cdf0e10cSrcweir #define TOOLKIT_GRID_CONTROL_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/awt/grid/XGridControl.hpp> 28cdf0e10cSrcweir #include <com/sun/star/awt/grid/XGridRowSelection.hpp> 29cdf0e10cSrcweir #include <com/sun/star/view/SelectionType.hpp> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <toolkit/controls/unocontrolbase.hxx> 32cdf0e10cSrcweir #include <toolkit/controls/unocontrolmodel.hxx> 33cdf0e10cSrcweir #include <toolkit/helper/servicenames.hxx> 34cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 35cdf0e10cSrcweir #include <comphelper/sequence.hxx> 36cdf0e10cSrcweir #include <toolkit/helper/listenermultiplexer.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <boost/scoped_ptr.hpp> 39cdf0e10cSrcweir 40cdf0e10cSrcweir namespace toolkit 41cdf0e10cSrcweir { 42cdf0e10cSrcweir 43cdf0e10cSrcweir class GridEventForwarder; 44cdf0e10cSrcweir 45cdf0e10cSrcweir // =================================================================== 46cdf0e10cSrcweir // = UnoGridModel 47cdf0e10cSrcweir // =================================================================== 48cdf0e10cSrcweir class UnoGridModel : public UnoControlModel 49cdf0e10cSrcweir { 50cdf0e10cSrcweir protected: 51cdf0e10cSrcweir ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; 52cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 53cdf0e10cSrcweir 54cdf0e10cSrcweir public: 55cdf0e10cSrcweir UnoGridModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); 56cdf0e10cSrcweir UnoGridModel( const UnoGridModel& rModel ); 57cdf0e10cSrcweir 58cdf0e10cSrcweir UnoControlModel* Clone() const; 59cdf0e10cSrcweir 60cdf0e10cSrcweir // ::com::sun::star::lang::XComponent 61cdf0e10cSrcweir void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); 62cdf0e10cSrcweir 63cdf0e10cSrcweir // ::com::sun::star::beans::XMultiPropertySet 64cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 65cdf0e10cSrcweir 66cdf0e10cSrcweir // ::com::sun::star::io::XPersistObject 67cdf0e10cSrcweir ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); 68cdf0e10cSrcweir 69cdf0e10cSrcweir // OPropertySetHelper 70cdf0e10cSrcweir void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); 71cdf0e10cSrcweir 72cdf0e10cSrcweir // XServiceInfo 73cdf0e10cSrcweir DECLIMPL_SERVICEINFO_DERIVED( UnoGridModel, UnoControlModel, szServiceName_GridControlModel ) 74cdf0e10cSrcweir }; 75cdf0e10cSrcweir 76cdf0e10cSrcweir 77cdf0e10cSrcweir // =================================================================== 78cdf0e10cSrcweir // = UnoGridControl 79cdf0e10cSrcweir // =================================================================== 80cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper2 < UnoControlBase 81cdf0e10cSrcweir , ::com::sun::star::awt::grid::XGridControl 82cdf0e10cSrcweir , ::com::sun::star::awt::grid::XGridRowSelection 83cdf0e10cSrcweir > UnoGridControl_Base; 84cdf0e10cSrcweir class UnoGridControl : public UnoGridControl_Base 85cdf0e10cSrcweir { 86cdf0e10cSrcweir public: 87cdf0e10cSrcweir UnoGridControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); 88cdf0e10cSrcweir ::rtl::OUString GetComponentServiceName(); 89cdf0e10cSrcweir 90cdf0e10cSrcweir // ::com::sun::star::lang::XComponent 91cdf0e10cSrcweir void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); 92cdf0e10cSrcweir 93cdf0e10cSrcweir // ::com::sun::star::awt::XControl 94cdf0e10cSrcweir void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); 95cdf0e10cSrcweir sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ) throw(::com::sun::star::uno::RuntimeException); 96cdf0e10cSrcweir 97cdf0e10cSrcweir // ::com::sun::star::awt::grid::XGridControl 98cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); 99cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); 100cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getCurrentColumn( ) throw (::com::sun::star::uno::RuntimeException); 101cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getCurrentRow( ) throw (::com::sun::star::uno::RuntimeException); 102cdf0e10cSrcweir virtual void SAL_CALL goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::util::VetoException); 103cdf0e10cSrcweir 104cdf0e10cSrcweir // ::com::sun::star::awt::grid::XGridRowSelection 105cdf0e10cSrcweir virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException ); 106cdf0e10cSrcweir virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException); 107cdf0e10cSrcweir virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException ); 108cdf0e10cSrcweir virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelectedRows() throw (::com::sun::star::uno::RuntimeException); 110cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasSelectedRows() throw (::com::sun::star::uno::RuntimeException); 111cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isRowSelected(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); 112cdf0e10cSrcweir virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); 113cdf0e10cSrcweir virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); 114cdf0e10cSrcweir 115cdf0e10cSrcweir // ::com::sun::star::lang::XServiceInfo 116cdf0e10cSrcweir DECLIMPL_SERVICEINFO_DERIVED( UnoGridControl, UnoControlBase, szServiceName_GridControl ) 117cdf0e10cSrcweir 118cdf0e10cSrcweir using UnoControl::getPeer; 119cdf0e10cSrcweir 120cdf0e10cSrcweir protected: 121cdf0e10cSrcweir ~UnoGridControl(); 122cdf0e10cSrcweir 123cdf0e10cSrcweir private: 124cdf0e10cSrcweir ::com::sun::star::view::SelectionType mSelectionMode; 125cdf0e10cSrcweir SelectionListenerMultiplexer m_aSelectionListeners; 126cdf0e10cSrcweir ::boost::scoped_ptr< GridEventForwarder > m_pEventForwarder; 127cdf0e10cSrcweir }; 128cdf0e10cSrcweir 129cdf0e10cSrcweir } // toolkit 130cdf0e10cSrcweir 131cdf0e10cSrcweir #endif // _TOOLKIT_TREE_CONTROL_HXX 132