1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "precompiled_toolkit.hxx"
25 
26 #include "grideventforwarder.hxx"
27 #include "gridcontrol.hxx"
28 
29 /** === begin UNO includes === **/
30 /** === end UNO includes === **/
31 
32 //......................................................................................................................
33 namespace toolkit
34 {
35 //......................................................................................................................
36 
37 	/** === begin UNO using === **/
38 	using ::com::sun::star::uno::Reference;
39 	using ::com::sun::star::uno::XInterface;
40 	using ::com::sun::star::uno::UNO_QUERY;
41 	using ::com::sun::star::uno::UNO_QUERY_THROW;
42 	using ::com::sun::star::uno::UNO_SET_THROW;
43 	using ::com::sun::star::uno::Exception;
44 	using ::com::sun::star::uno::RuntimeException;
45 	using ::com::sun::star::uno::Any;
46 	using ::com::sun::star::uno::makeAny;
47 	using ::com::sun::star::uno::Sequence;
48 	using ::com::sun::star::uno::Type;
49     using ::com::sun::star::awt::grid::GridDataEvent;
50     using ::com::sun::star::container::ContainerEvent;
51     using ::com::sun::star::lang::EventObject;
52 	/** === end UNO using === **/
53 
54 	//==================================================================================================================
55 	//= GridEventForwarder
56 	//==================================================================================================================
57 	//------------------------------------------------------------------------------------------------------------------
GridEventForwarder(UnoGridControl & i_parent)58     GridEventForwarder::GridEventForwarder( UnoGridControl& i_parent )
59         :m_parent( i_parent )
60     {
61     }
62 
63 	//------------------------------------------------------------------------------------------------------------------
~GridEventForwarder()64     GridEventForwarder::~GridEventForwarder()
65     {
66     }
67 
68 	//------------------------------------------------------------------------------------------------------------------
acquire()69     void SAL_CALL GridEventForwarder::acquire() throw()
70     {
71         m_parent.acquire();
72     }
73 
74 	//------------------------------------------------------------------------------------------------------------------
release()75     void SAL_CALL GridEventForwarder::release() throw()
76     {
77         m_parent.release();
78     }
79 
80     //------------------------------------------------------------------------------------------------------------------
rowsInserted(const GridDataEvent & i_event)81     void SAL_CALL GridEventForwarder::rowsInserted( const GridDataEvent& i_event ) throw (RuntimeException)
82     {
83         Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
84         if ( xPeer.is() )
85             xPeer->rowsInserted( i_event );
86     }
87 
88     //------------------------------------------------------------------------------------------------------------------
rowsRemoved(const GridDataEvent & i_event)89     void SAL_CALL GridEventForwarder::rowsRemoved( const GridDataEvent& i_event ) throw (RuntimeException)
90     {
91         Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
92         if ( xPeer.is() )
93             xPeer->rowsRemoved( i_event );
94     }
95 
96     //------------------------------------------------------------------------------------------------------------------
dataChanged(const GridDataEvent & i_event)97     void SAL_CALL GridEventForwarder::dataChanged( const GridDataEvent& i_event ) throw (RuntimeException)
98     {
99         Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
100         if ( xPeer.is() )
101             xPeer->dataChanged( i_event );
102     }
103 
104     //------------------------------------------------------------------------------------------------------------------
rowHeadingChanged(const GridDataEvent & i_event)105     void SAL_CALL GridEventForwarder::rowHeadingChanged( const GridDataEvent& i_event ) throw (RuntimeException)
106     {
107         Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
108         if ( xPeer.is() )
109             xPeer->rowHeadingChanged( i_event );
110     }
111 
112     //------------------------------------------------------------------------------------------------------------------
elementInserted(const ContainerEvent & i_event)113     void SAL_CALL GridEventForwarder::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException)
114     {
115         Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
116         if ( xPeer.is() )
117             xPeer->elementInserted( i_event );
118     }
119 
120     //------------------------------------------------------------------------------------------------------------------
elementRemoved(const ContainerEvent & i_event)121     void SAL_CALL GridEventForwarder::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException)
122     {
123         Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
124         if ( xPeer.is() )
125             xPeer->elementRemoved( i_event );
126     }
127 
128     //------------------------------------------------------------------------------------------------------------------
elementReplaced(const ContainerEvent & i_event)129     void SAL_CALL GridEventForwarder::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException)
130     {
131         Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
132         if ( xPeer.is() )
133             xPeer->elementReplaced( i_event );
134     }
135 
136     //------------------------------------------------------------------------------------------------------------------
disposing(const EventObject & i_event)137     void SAL_CALL GridEventForwarder::disposing( const EventObject& i_event ) throw (RuntimeException)
138     {
139         Reference< XEventListener > xPeer( m_parent.getPeer(), UNO_QUERY );
140         if ( xPeer.is() )
141             xPeer->disposing( i_event );
142     }
143 
144 //......................................................................................................................
145 } // namespace toolkit
146 //......................................................................................................................
147