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 TOOLKIT_GRID_CONTROL_HXX
21 #define TOOLKIT_GRID_CONTROL_HXX
23 #include <com/sun/star/awt/grid/XGridControl.hpp>
24 #include <com/sun/star/awt/grid/XGridRowSelection.hpp>
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>
33 #include <boost/scoped_ptr.hpp>
38 class GridEventForwarder
;
40 // ===================================================================
42 // ===================================================================
43 class UnoGridModel
: public UnoControlModel
46 ::com::sun::star::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const;
47 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
50 UnoGridModel( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& i_factory
);
51 UnoGridModel( const UnoGridModel
& rModel
);
53 UnoControlModel
* Clone() const;
55 // ::com::sun::star::lang::XComponent
56 void SAL_CALL
dispose( ) throw(::com::sun::star::uno::RuntimeException
);
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
);
61 // ::com::sun::star::io::XPersistObject
62 OUString SAL_CALL
getServiceName() throw(::com::sun::star::uno::RuntimeException
);
65 void SAL_CALL
setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
, const ::com::sun::star::uno::Any
& rValue
) throw (::com::sun::star::uno::Exception
);
68 DECLIMPL_SERVICEINFO_DERIVED( UnoGridModel
, UnoControlModel
, szServiceName_GridControlModel
)
72 // ===================================================================
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
83 OUString
GetComponentServiceName();
85 // ::com::sun::star::lang::XComponent
86 void SAL_CALL
dispose( ) throw(::com::sun::star::uno::RuntimeException
);
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
);
90 sal_Bool SAL_CALL
setModel( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& rxModel
) throw(::com::sun::star::uno::RuntimeException
);
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
);
94 virtual ::sal_Int32 SAL_CALL
getRowAtPoint(::sal_Int32 x
, ::sal_Int32 y
) throw (::com::sun::star::uno::RuntimeException
);
95 virtual ::sal_Int32 SAL_CALL
getCurrentColumn( ) throw (::com::sun::star::uno::RuntimeException
);
96 virtual ::sal_Int32 SAL_CALL
getCurrentRow( ) throw (::com::sun::star::uno::RuntimeException
);
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
);
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
);
101 virtual void SAL_CALL
selectAllRows() throw (::com::sun::star::uno::RuntimeException
);
102 virtual void SAL_CALL
deselectRow( ::sal_Int32 i_rowIndex
) throw (::com::sun::star::uno::RuntimeException
, ::com::sun::star::lang::IndexOutOfBoundsException
);
103 virtual void SAL_CALL
deselectAllRows() throw (::com::sun::star::uno::RuntimeException
);
104 virtual ::com::sun::star::uno::Sequence
< ::sal_Int32
> SAL_CALL
getSelectedRows() throw (::com::sun::star::uno::RuntimeException
);
105 virtual ::sal_Bool SAL_CALL
hasSelectedRows() throw (::com::sun::star::uno::RuntimeException
);
106 virtual ::sal_Bool SAL_CALL
isRowSelected(::sal_Int32 index
) throw (::com::sun::star::uno::RuntimeException
);
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
);
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
);
110 // ::com::sun::star::lang::XServiceInfo
111 DECLIMPL_SERVICEINFO_DERIVED( UnoGridControl
, UnoControlBase
, szServiceName_GridControl
)
113 using UnoControl::getPeer
;
119 SelectionListenerMultiplexer m_aSelectionListeners
;
120 ::boost::scoped_ptr
< GridEventForwarder
> m_pEventForwarder
;
125 #endif // _TOOLKIT_TREE_CONTROL_HXX
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */