Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef TOOLKIT_GRID_CONTROL_HXX
21 : #define TOOLKIT_GRID_CONTROL_HXX
22 :
23 : #include <com/sun/star/awt/grid/XGridControl.hpp>
24 : #include <com/sun/star/awt/grid/XGridRowSelection.hpp>
25 :
26 : #include <toolkit/controls/unocontrolbase.hxx>
27 : #include <toolkit/controls/unocontrolmodel.hxx>
28 : #include <toolkit/helper/servicenames.hxx>
29 : #include <cppuhelper/implbase2.hxx>
30 : #include <comphelper/sequence.hxx>
31 : #include <toolkit/helper/listenermultiplexer.hxx>
32 :
33 : #include <boost/scoped_ptr.hpp>
34 :
35 : namespace toolkit
36 : {
37 :
38 : class GridEventForwarder;
39 :
40 :
41 : // = UnoGridModel
42 :
43 0 : class UnoGridModel : public UnoControlModel
44 : {
45 : protected:
46 : ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const SAL_OVERRIDE;
47 : ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
48 :
49 : public:
50 : UnoGridModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_factory );
51 : UnoGridModel( const UnoGridModel& rModel );
52 :
53 : UnoControlModel* Clone() const SAL_OVERRIDE;
54 :
55 : // ::com::sun::star::lang::XComponent
56 : void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 :
58 : // ::com::sun::star::beans::XMultiPropertySet
59 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
60 :
61 : // ::com::sun::star::io::XPersistObject
62 : OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
63 :
64 : // OPropertySetHelper
65 : void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
66 :
67 : // XServiceInfo
68 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoGridModel, UnoControlModel, "com.sun.star.awt.grid.UnoControlGridModel" )
69 : };
70 :
71 :
72 :
73 : // = UnoGridControl
74 :
75 : typedef ::cppu::ImplInheritanceHelper2 < UnoControlBase
76 : , ::com::sun::star::awt::grid::XGridControl
77 : , ::com::sun::star::awt::grid::XGridRowSelection
78 : > UnoGridControl_Base;
79 : class UnoGridControl : public UnoGridControl_Base
80 : {
81 : public:
82 : UnoGridControl();
83 : OUString GetComponentServiceName() SAL_OVERRIDE;
84 :
85 : // ::com::sun::star::lang::XComponent
86 : void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 :
88 : // ::com::sun::star::awt::XControl
89 : 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, std::exception) SAL_OVERRIDE;
90 : sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 :
92 : // ::com::sun::star::awt::grid::XGridControl
93 : virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 : virtual ::sal_Int32 SAL_CALL getCurrentColumn( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 : virtual ::sal_Int32 SAL_CALL getCurrentRow( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 : 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, std::exception) SAL_OVERRIDE;
98 :
99 : // ::com::sun::star::awt::grid::XGridRowSelection
100 : virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, std::exception ) SAL_OVERRIDE;
101 : virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 : virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, std::exception ) SAL_OVERRIDE;
103 : virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 : virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelectedRows() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 : virtual sal_Bool SAL_CALL hasSelectedRows() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 : virtual sal_Bool SAL_CALL isRowSelected(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 : virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
108 : virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 :
110 : // ::com::sun::star::lang::XServiceInfo
111 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoGridControl, UnoControlBase, "com.sun.star.awt.grid.UnoControlGrid" )
112 :
113 : using UnoControl::getPeer;
114 :
115 : protected:
116 : virtual ~UnoGridControl();
117 :
118 : private:
119 : SelectionListenerMultiplexer m_aSelectionListeners;
120 : ::boost::scoped_ptr< GridEventForwarder > m_pEventForwarder;
121 : };
122 :
123 : } // toolkit
124 :
125 : #endif // _TOOLKIT_TREE_CONTROL_HXX
126 :
127 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|