1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVTOOLS_SOURCE_UNO_SVTXGRIDCONTROL_HXX
21 #define INCLUDED_SVTOOLS_SOURCE_UNO_SVTXGRIDCONTROL_HXX
23 #include <unocontroltablemodel.hxx>
24 #include <svtools/table/tablecontrol.hxx>
25 #include <com/sun/star/awt/grid/XGridControl.hpp>
26 #include <com/sun/star/awt/grid/XGridRowSelection.hpp>
27 #include <com/sun/star/awt/grid/XGridDataListener.hpp>
28 #include <com/sun/star/awt/grid/GridDataEvent.hpp>
29 #include <com/sun/star/awt/grid/GridColumnEvent.hpp>
30 #include <com/sun/star/awt/grid/XGridColumnModel.hpp>
31 #include <com/sun/star/awt/grid/XGridDataModel.hpp>
32 #include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
33 #include <com/sun/star/container/XContainerListener.hpp>
34 #include <toolkit/awt/vclxwindow.hxx>
35 #include <toolkit/awt/vclxwindows.hxx>
36 #include <cppuhelper/typeprovider.hxx>
37 #include <cppuhelper/implbase4.hxx>
38 #include <toolkit/helper/listenermultiplexer.hxx>
41 namespace svt
{ namespace table
{
45 typedef ::cppu::ImplInheritanceHelper4
< VCLXWindow
46 , ::com::sun::star::awt::grid::XGridControl
47 , ::com::sun::star::awt::grid::XGridRowSelection
48 , ::com::sun::star::awt::grid::XGridDataListener
49 , ::com::sun::star::container::XContainerListener
50 > SVTXGridControl_Base
;
51 class SVTXGridControl
: public SVTXGridControl_Base
54 ::boost::shared_ptr
< ::svt::table::UnoControlTableModel
> m_pTableModel
;
55 bool m_bTableModelInitCompleted
;
56 SelectionListenerMultiplexer m_aSelectionListeners
;
59 virtual void ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
);
60 void ImplCallItemListeners();
67 virtual void SAL_CALL
rowsInserted( const ::com::sun::star::awt::grid::GridDataEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
68 virtual void SAL_CALL
rowsRemoved( const ::com::sun::star::awt::grid::GridDataEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
69 virtual void SAL_CALL
dataChanged( const ::com::sun::star::awt::grid::GridDataEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
70 virtual void SAL_CALL
rowHeadingChanged( const ::com::sun::star::awt::grid::GridDataEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
73 virtual void SAL_CALL
elementInserted( const ::com::sun::star::container::ContainerEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
74 virtual void SAL_CALL
elementRemoved( const ::com::sun::star::container::ContainerEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
75 virtual void SAL_CALL
elementReplaced( const ::com::sun::star::container::ContainerEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
78 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
);
81 virtual ::sal_Int32 SAL_CALL
getRowAtPoint(::sal_Int32 x
, ::sal_Int32 y
) throw (::com::sun::star::uno::RuntimeException
);
82 virtual ::sal_Int32 SAL_CALL
getColumnAtPoint(::sal_Int32 x
, ::sal_Int32 y
) throw (::com::sun::star::uno::RuntimeException
);
83 virtual ::sal_Int32 SAL_CALL
getCurrentColumn( ) throw (::com::sun::star::uno::RuntimeException
);
84 virtual ::sal_Int32 SAL_CALL
getCurrentRow( ) throw (::com::sun::star::uno::RuntimeException
);
85 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
);
88 virtual void SAL_CALL
selectRow( ::sal_Int32 i_rowIndex
) throw (::com::sun::star::uno::RuntimeException
, ::com::sun::star::lang::IndexOutOfBoundsException
);
89 virtual void SAL_CALL
selectAllRows() throw (::com::sun::star::uno::RuntimeException
);
90 virtual void SAL_CALL
deselectRow( ::sal_Int32 i_rowIndex
) throw (::com::sun::star::uno::RuntimeException
, ::com::sun::star::lang::IndexOutOfBoundsException
);
91 virtual void SAL_CALL
deselectAllRows() throw (::com::sun::star::uno::RuntimeException
);
92 virtual ::com::sun::star::uno::Sequence
< ::sal_Int32
> SAL_CALL
getSelectedRows() throw (::com::sun::star::uno::RuntimeException
);
93 virtual ::sal_Bool SAL_CALL
hasSelectedRows() throw (::com::sun::star::uno::RuntimeException
);
94 virtual ::sal_Bool SAL_CALL
isRowSelected(::sal_Int32 index
) throw (::com::sun::star::uno::RuntimeException
);
95 virtual void SAL_CALL
addSelectionListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::grid::XGridSelectionListener
> & listener
) throw (::com::sun::star::uno::RuntimeException
);
96 virtual void SAL_CALL
removeSelectionListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::grid::XGridSelectionListener
> & listener
) throw (::com::sun::star::uno::RuntimeException
);
98 void SAL_CALL
setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
);
99 ::com::sun::star::uno::Any SAL_CALL
getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
);
101 // ::com::sun::star::lang::XComponent
102 void SAL_CALL
dispose( ) throw(::com::sun::star::uno::RuntimeException
);
106 virtual void SetWindow( Window
* pWindow
);
109 void impl_updateColumnsFromModel_nothrow();
110 void impl_checkTableModelInit();
112 void impl_checkColumnIndex_throw( ::svt::table::TableControl
const & i_table
, sal_Int32
const i_columnIndex
) const;
113 void impl_checkRowIndex_throw( ::svt::table::TableControl
const & i_table
, sal_Int32
const i_rowIndex
) const;
115 #endif // INCLUDED_SVTOOLS_SOURCE_UNO_SVTXGRIDCONTROL_HXX
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */