1 /*************************************************************************
2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3  *
4  * Copyright 2000, 2010 Oracle and/or its affiliates.
5  *
6  * OpenOffice.org - a multi-platform office productivity suite
7  *
8  * This file is part of OpenOffice.org.
9  *
10  * OpenOffice.org is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License version 3
12  * only, as published by the Free Software Foundation.
13  *
14  * OpenOffice.org is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU Lesser General Public License version 3 for more details
18  * (a copy is included in the LICENSE file that accompanied this code).
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with OpenOffice.org.  If not, see
22  * <http://www.openoffice.org/license.html>
23  * for a copy of the LGPLv3 License.
24  *
25  ************************************************************************/
26 
27 #include "precompiled_toolkit.hxx"
28 
29 #include "grideventforwarder.hxx"
30 #include "gridcontrol.hxx"
31 
32 /** === begin UNO includes === **/
33 /** === end UNO includes === **/
34 
35 //......................................................................................................................
36 namespace toolkit
37 {
38 //......................................................................................................................
39 
40 	/** === begin UNO using === **/
41 	using ::com::sun::star::uno::Reference;
42 	using ::com::sun::star::uno::XInterface;
43 	using ::com::sun::star::uno::UNO_QUERY;
44 	using ::com::sun::star::uno::UNO_QUERY_THROW;
45 	using ::com::sun::star::uno::UNO_SET_THROW;
46 	using ::com::sun::star::uno::Exception;
47 	using ::com::sun::star::uno::RuntimeException;
48 	using ::com::sun::star::uno::Any;
49 	using ::com::sun::star::uno::makeAny;
50 	using ::com::sun::star::uno::Sequence;
51 	using ::com::sun::star::uno::Type;
52     using ::com::sun::star::awt::grid::GridDataEvent;
53     using ::com::sun::star::container::ContainerEvent;
54     using ::com::sun::star::lang::EventObject;
55 	/** === end UNO using === **/
56 
57 	//==================================================================================================================
58 	//= GridEventForwarder
59 	//==================================================================================================================
60 	//------------------------------------------------------------------------------------------------------------------
61     GridEventForwarder::GridEventForwarder( UnoGridControl& i_parent )
62         :m_parent( i_parent )
63     {
64     }
65 
66 	//------------------------------------------------------------------------------------------------------------------
67     GridEventForwarder::~GridEventForwarder()
68     {
69     }
70 
71 	//------------------------------------------------------------------------------------------------------------------
72     void SAL_CALL GridEventForwarder::acquire() throw()
73     {
74         m_parent.acquire();
75     }
76 
77 	//------------------------------------------------------------------------------------------------------------------
78     void SAL_CALL GridEventForwarder::release() throw()
79     {
80         m_parent.release();
81     }
82 
83     //------------------------------------------------------------------------------------------------------------------
84     void SAL_CALL GridEventForwarder::rowsInserted( const GridDataEvent& i_event ) throw (RuntimeException)
85     {
86         Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
87         if ( xPeer.is() )
88             xPeer->rowsInserted( i_event );
89     }
90 
91     //------------------------------------------------------------------------------------------------------------------
92     void SAL_CALL GridEventForwarder::rowsRemoved( const GridDataEvent& i_event ) throw (RuntimeException)
93     {
94         Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
95         if ( xPeer.is() )
96             xPeer->rowsRemoved( i_event );
97     }
98 
99     //------------------------------------------------------------------------------------------------------------------
100     void SAL_CALL GridEventForwarder::dataChanged( const GridDataEvent& i_event ) throw (RuntimeException)
101     {
102         Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
103         if ( xPeer.is() )
104             xPeer->dataChanged( i_event );
105     }
106 
107     //------------------------------------------------------------------------------------------------------------------
108     void SAL_CALL GridEventForwarder::rowHeadingChanged( const GridDataEvent& i_event ) throw (RuntimeException)
109     {
110         Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
111         if ( xPeer.is() )
112             xPeer->rowHeadingChanged( i_event );
113     }
114 
115     //------------------------------------------------------------------------------------------------------------------
116     void SAL_CALL GridEventForwarder::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException)
117     {
118         Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
119         if ( xPeer.is() )
120             xPeer->elementInserted( i_event );
121     }
122 
123     //------------------------------------------------------------------------------------------------------------------
124     void SAL_CALL GridEventForwarder::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException)
125     {
126         Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
127         if ( xPeer.is() )
128             xPeer->elementRemoved( i_event );
129     }
130 
131     //------------------------------------------------------------------------------------------------------------------
132     void SAL_CALL GridEventForwarder::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException)
133     {
134         Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
135         if ( xPeer.is() )
136             xPeer->elementReplaced( i_event );
137     }
138 
139     //------------------------------------------------------------------------------------------------------------------
140     void SAL_CALL GridEventForwarder::disposing( const EventObject& i_event ) throw (RuntimeException)
141     {
142         Reference< XEventListener > xPeer( m_parent.getPeer(), UNO_QUERY );
143         if ( xPeer.is() )
144             xPeer->disposing( i_event );
145     }
146 
147 //......................................................................................................................
148 } // namespace toolkit
149 //......................................................................................................................
150