Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / toolkit / source / controls / grid / gridcontrol.hxx
blobed8508e25afcc88fb0012d54db98bf26809c4741
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_TOOLKIT_SOURCE_CONTROLS_GRID_GRIDCONTROL_HXX
21 #define INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_GRIDCONTROL_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/implbase.hxx>
30 #include <comphelper/sequence.hxx>
31 #include <toolkit/helper/listenermultiplexer.hxx>
33 #include <memory>
35 namespace toolkit
38 class GridEventForwarder;
41 // = UnoGridModel
43 class UnoGridModel : public UnoControlModel
45 protected:
46 css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
47 ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
49 public:
50 explicit UnoGridModel( const css::uno::Reference< css::uno::XComponentContext >& i_factory );
51 UnoGridModel( const UnoGridModel& rModel );
53 rtl::Reference<UnoControlModel> Clone() const override;
55 // css::lang::XComponent
56 void SAL_CALL dispose( ) override;
58 // css::beans::XMultiPropertySet
59 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
61 // css::io::XPersistObject
62 OUString SAL_CALL getServiceName() override;
64 // OPropertySetHelper
65 void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
67 // XServiceInfo
68 OUString SAL_CALL getImplementationName() override
69 { return OUString("stardiv.Toolkit.GridControlModel"); }
71 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
73 auto s(UnoControlModel::getSupportedServiceNames());
74 s.realloc(s.getLength() + 1);
75 s[s.getLength() - 1] = "com.sun.star.awt.grid.UnoControlGridModel";
76 return s;
81 // = UnoGridControl
83 typedef ::cppu::ImplInheritanceHelper < UnoControlBase
84 , css::awt::grid::XGridControl
85 , css::awt::grid::XGridRowSelection
86 > UnoGridControl_Base;
87 class UnoGridControl : public UnoGridControl_Base
89 public:
90 UnoGridControl();
91 OUString GetComponentServiceName() override;
93 // css::lang::XComponent
94 void SAL_CALL dispose( ) override;
96 // css::awt::XControl
97 void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
98 sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& rxModel ) override;
100 // css::awt::grid::XGridControl
101 virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) override;
102 virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) override;
103 virtual ::sal_Int32 SAL_CALL getCurrentColumn( ) override;
104 virtual ::sal_Int32 SAL_CALL getCurrentRow( ) override;
105 virtual void SAL_CALL goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) override;
107 // css::awt::grid::XGridRowSelection
108 virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) override;
109 virtual void SAL_CALL selectAllRows() override;
110 virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) override;
111 virtual void SAL_CALL deselectAllRows() override;
112 virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getSelectedRows() override;
113 virtual sal_Bool SAL_CALL hasSelectedRows() override;
114 virtual sal_Bool SAL_CALL isRowSelected(::sal_Int32 index) override;
115 virtual void SAL_CALL addSelectionListener(const css::uno::Reference< css::awt::grid::XGridSelectionListener > & listener) override;
116 virtual void SAL_CALL removeSelectionListener(const css::uno::Reference< css::awt::grid::XGridSelectionListener > & listener) override;
118 // css::lang::XServiceInfo
119 OUString SAL_CALL getImplementationName() override
120 { return OUString("stardiv.Toolkit.GridControl"); }
122 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
124 auto s(UnoControlBase::getSupportedServiceNames());
125 s.realloc(s.getLength() + 1);
126 s[s.getLength() - 1] = "com.sun.star.awt.grid.UnoControlGrid";
127 return s;
130 using UnoControl::getPeer;
132 protected:
133 virtual ~UnoGridControl() override;
135 private:
136 SelectionListenerMultiplexer m_aSelectionListeners;
137 std::unique_ptr< GridEventForwarder > m_pEventForwarder;
140 } // toolkit
142 #endif // _TOOLKIT_TREE_CONTROL_HXX
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */