bump product version to 5.0.4.1
[LibreOffice.git] / forms / source / component / Grid.hxx
bloba2f7d477129942b995380cd54cab85ae6c838a6e
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_FORMS_SOURCE_COMPONENT_GRID_HXX
21 #define INCLUDED_FORMS_SOURCE_COMPONENT_GRID_HXX
23 #include "errorbroadcaster.hxx"
24 #include "FormComponent.hxx"
25 #include "formcontrolfont.hxx"
26 #include "InterfaceContainer.hxx"
28 #include <com/sun/star/form/XGridColumnFactory.hpp>
29 #include <com/sun/star/form/XLoadable.hpp>
30 #include <com/sun/star/sdb/XRowSetSupplier.hpp>
31 #include <com/sun/star/sdb/XRowSetChangeBroadcaster.hpp>
32 #include <com/sun/star/view/XSelectionSupplier.hpp>
34 #include <comphelper/proparrhlp.hxx>
35 #include <cppuhelper/implbase7.hxx>
38 namespace frm
41 class OGridColumn;
43 struct ColumnDescription : public ElementDescription
45 public:
46 OGridColumn* pColumn; // not owned by this instance! only to prevent duplicate XUnoTunnel usage
50 // OGridControlModel
52 typedef ::cppu::ImplHelper7 < ::com::sun::star::awt::XControlModel
53 , ::com::sun::star::form::XGridColumnFactory
54 , ::com::sun::star::form::XReset
55 , ::com::sun::star::view::XSelectionSupplier
56 , ::com::sun::star::sdb::XSQLErrorListener
57 , ::com::sun::star::sdb::XRowSetSupplier
58 , ::com::sun::star::sdb::XRowSetChangeBroadcaster
59 > OGridControlModel_BASE;
61 class OGridControlModel :public OControlModel
62 ,public OInterfaceContainer
63 ,public OErrorBroadcaster
64 ,public FontControlModel
65 ,public OGridControlModel_BASE
67 ::cppu::OInterfaceContainerHelper m_aSelectListeners,
68 m_aResetListeners,
69 m_aRowSetChangeListeners;
71 // [properties]
72 ::com::sun::star::uno::Any m_aRowHeight; // Row height
73 ::com::sun::star::uno::Any m_aTabStop;
74 ::com::sun::star::uno::Any m_aBackgroundColor;
75 ::com::sun::star::uno::Any m_aCursorColor; // transient
76 ::com::sun::star::uno::Any m_aBorderColor;
77 OUString m_aDefaultControl;
78 OUString m_sHelpText;
79 // [properties]
81 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSelection;
83 // [properties]
84 OUString m_sHelpURL; // URL
85 sal_Int16 m_nBorder;
86 sal_Int16 m_nWritingMode;
87 sal_Int16 m_nContextWritingMode;
88 bool m_bEnableVisible : 1;
89 bool m_bEnable : 1;
90 bool m_bNavigation : 1;
91 bool m_bRecordMarker : 1;
92 bool m_bPrintable : 1;
93 bool m_bAlwaysShowCursor : 1; // transient
94 bool m_bDisplaySynchron : 1; // transient
95 // [properties]
97 protected:
98 void _reset();
100 public:
101 DECLARE_DEFAULT_LEAF_XTOR( OGridControlModel );
103 // UNO Binding
104 DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OControlModel)
105 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 // XChild
108 virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 // XServiceInfo
111 OUString SAL_CALL getImplementationName()
112 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
113 { return OUString("com.sun.star.form.OGridControlModel"); }
115 virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
117 // XTypeProvider
118 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 // OComponentHelper
121 virtual void SAL_CALL disposing() SAL_OVERRIDE;
123 // XEventListener
124 virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 // XReset
127 virtual void SAL_CALL reset() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 virtual void SAL_CALL addResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 virtual void SAL_CALL removeResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 // XSelectionSupplier
132 virtual sal_Bool SAL_CALL select(const ::com::sun::star::uno::Any& aElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 virtual ::com::sun::star::uno::Any SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 virtual void SAL_CALL addSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 virtual void SAL_CALL removeSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 // XGridColumnFactory
138 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> SAL_CALL createColumn(const OUString& ColumnType) throw ( :: com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 virtual StringSequence SAL_CALL getColumnTypes() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
141 // XPersistObject
142 virtual OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
143 virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 // XPropertySet
147 virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
148 virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
149 sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
150 throw(::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
151 virtual 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;
153 // XPropertyState
154 virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const SAL_OVERRIDE;
156 // XSQLErrorListener
157 virtual void SAL_CALL errorOccured( const ::com::sun::star::sdb::SQLErrorEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 // XRowSetSupplier
160 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > SAL_CALL getRowSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 virtual void SAL_CALL setRowSet( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xDataSource ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 // XRowSetChangeBroadcaster
164 virtual void SAL_CALL addRowSetChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetChangeListener >& i_Listener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
165 virtual void SAL_CALL removeRowSetChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetChangeListener >& i_Listener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
167 // OControlModel's property handling
168 virtual void describeFixedProperties(
169 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
170 ) const SAL_OVERRIDE;
172 // prevent method hiding
173 using OControlModel::disposing;
174 using OControlModel::getFastPropertyValue;
176 protected:
177 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 protected:
180 virtual void approveNewElement(
181 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject,
182 ElementDescription* _pElement
183 ) SAL_OVERRIDE;
185 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> createColumn(sal_Int32 nTypeId) const;
187 static OGridColumn* getColumnImplementation(const InterfaceRef& _rxIFace);
189 virtual ElementDescription* createElementMetaData( ) SAL_OVERRIDE;
191 protected:
192 virtual void implRemoved(const InterfaceRef& _rxObject) SAL_OVERRIDE;
193 virtual void implInserted( const ElementDescription* _pElement ) SAL_OVERRIDE;
194 virtual void impl_replacedElement(
195 const ::com::sun::star::container::ContainerEvent& _rEvent,
196 ::osl::ClearableMutexGuard& _rInstanceLock
197 ) SAL_OVERRIDE;
199 void gotColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
200 void lostColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
202 void cloneColumns( const OGridControlModel* _pOriginalContainer );
206 } // namespace frm
210 #endif // INCLUDED_FORMS_SOURCE_COMPONENT_GRID_HXX
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */