xref: /AOO41X/main/svtools/source/uno/svtxgridcontrol.hxx (revision d5c88d437df358242cbf60dbf65fc9ccd8c77cba)
101aa44aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
301aa44aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
401aa44aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
501aa44aaSAndrew Rist  * distributed with this work for additional information
601aa44aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
701aa44aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
801aa44aaSAndrew Rist  * "License"); you may not use this file except in compliance
901aa44aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
1101aa44aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
1301aa44aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1401aa44aaSAndrew Rist  * software distributed under the License is distributed on an
1501aa44aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1601aa44aaSAndrew Rist  * KIND, either express or implied.  See the License for the
1701aa44aaSAndrew Rist  * specific language governing permissions and limitations
1801aa44aaSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
2001aa44aaSAndrew Rist  *************************************************************/
2101aa44aaSAndrew Rist 
2201aa44aaSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SVT_GRIDCONTROL_HXX_
25cdf0e10cSrcweir #define _SVT_GRIDCONTROL_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <unocontroltablemodel.hxx>
28cdf0e10cSrcweir #include <svtools/table/tablecontrol.hxx>
29cdf0e10cSrcweir #include <com/sun/star/awt/grid/XGridControl.hpp>
30cdf0e10cSrcweir #include <com/sun/star/awt/grid/XGridRowSelection.hpp>
31cdf0e10cSrcweir #include <com/sun/star/awt/grid/XGridDataListener.hpp>
32cdf0e10cSrcweir #include <com/sun/star/awt/grid/GridDataEvent.hpp>
33cdf0e10cSrcweir #include <com/sun/star/awt/grid/GridColumnEvent.hpp>
34cdf0e10cSrcweir #include <com/sun/star/awt/grid/XGridColumnModel.hpp>
35cdf0e10cSrcweir #include <com/sun/star/awt/grid/XGridDataModel.hpp>
36cdf0e10cSrcweir #include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
37cdf0e10cSrcweir #include <com/sun/star/container/XContainerListener.hpp>
38cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
39cdf0e10cSrcweir #include <toolkit/awt/vclxwindows.hxx>
40cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
41cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx>
42cdf0e10cSrcweir #include <toolkit/helper/listenermultiplexer.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace svt { namespace table {
46cdf0e10cSrcweir     class TableControl;
47cdf0e10cSrcweir } }
48cdf0e10cSrcweir 
49cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper4  <   VCLXWindow
50cdf0e10cSrcweir                                         ,   ::com::sun::star::awt::grid::XGridControl
51cdf0e10cSrcweir                                         ,   ::com::sun::star::awt::grid::XGridRowSelection
52cdf0e10cSrcweir                                         ,   ::com::sun::star::awt::grid::XGridDataListener
53cdf0e10cSrcweir                                         ,   ::com::sun::star::container::XContainerListener
54cdf0e10cSrcweir                                         >   SVTXGridControl_Base;
55cdf0e10cSrcweir class SVTXGridControl : public SVTXGridControl_Base
56cdf0e10cSrcweir {
57cdf0e10cSrcweir private:
58cdf0e10cSrcweir     ::boost::shared_ptr< ::svt::table::UnoControlTableModel >   m_pTableModel;
59cdf0e10cSrcweir     bool                                                        m_bTableModelInitCompleted;
60cdf0e10cSrcweir 	SelectionListenerMultiplexer                                m_aSelectionListeners;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir protected:
63cdf0e10cSrcweir 	virtual void	ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
64cdf0e10cSrcweir 	void            ImplCallItemListeners();
65cdf0e10cSrcweir 
66cdf0e10cSrcweir public:
67cdf0e10cSrcweir     SVTXGridControl();
68cdf0e10cSrcweir 	~SVTXGridControl();
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     // XGridDataListener
71cdf0e10cSrcweir     virtual void SAL_CALL rowsInserted( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
72cdf0e10cSrcweir     virtual void SAL_CALL rowsRemoved( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
73cdf0e10cSrcweir     virtual void SAL_CALL dataChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
74cdf0e10cSrcweir     virtual void SAL_CALL rowHeadingChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     // XContainerListener
77cdf0e10cSrcweir     virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
78cdf0e10cSrcweir     virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
79cdf0e10cSrcweir     virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     // XEventListener
82cdf0e10cSrcweir 	virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     // XGridControl
85cdf0e10cSrcweir 	virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
86cdf0e10cSrcweir 	virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
87cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getCurrentColumn(  ) throw (::com::sun::star::uno::RuntimeException);
88cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getCurrentRow(  ) throw (::com::sun::star::uno::RuntimeException);
89cdf0e10cSrcweir     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);
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	// XGridRowSelection
92cdf0e10cSrcweir 	virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
93cdf0e10cSrcweir 	virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException);
94cdf0e10cSrcweir 	virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
95cdf0e10cSrcweir 	virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException);
96cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelectedRows() throw (::com::sun::star::uno::RuntimeException);
97cdf0e10cSrcweir 	virtual ::sal_Bool SAL_CALL hasSelectedRows() throw (::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir 	virtual ::sal_Bool SAL_CALL isRowSelected(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir 	virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir 	virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
103cdf0e10cSrcweir 	::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
104cdf0e10cSrcweir 	static void     ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	// ::com::sun::star::lang::XComponent
107cdf0e10cSrcweir 	void SAL_CALL dispose(  ) throw(::com::sun::star::uno::RuntimeException);
108*d5c88d43SJürgen Schmidt 
109*d5c88d43SJürgen Schmidt     // XWindow
110*d5c88d43SJürgen Schmidt     void SAL_CALL setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir protected:
113cdf0e10cSrcweir     // VCLXWindow
114cdf0e10cSrcweir 	virtual void	SetWindow( Window* pWindow );
115cdf0e10cSrcweir 
116cdf0e10cSrcweir private:
117cdf0e10cSrcweir     void    impl_updateColumnsFromModel_nothrow();
118cdf0e10cSrcweir     void    impl_checkTableModelInit();
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     void    impl_checkColumnIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_columnIndex ) const;
121cdf0e10cSrcweir     void    impl_checkRowIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_rowIndex ) const;
122cdf0e10cSrcweir };
123cdf0e10cSrcweir #endif // _SVT_GRIDCONTROL_HXX_
124