xref: /aoo41x/main/forms/source/component/Grid.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include "errorbroadcaster.hxx"
29*cdf0e10cSrcweir #include "FormComponent.hxx"
30*cdf0e10cSrcweir #include "formcontrolfont.hxx"
31*cdf0e10cSrcweir #include "InterfaceContainer.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir /** === begin UNO includes === **/
34*cdf0e10cSrcweir #include <com/sun/star/form/XGridColumnFactory.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/form/XLoadable.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/sdb/XRowSetSupplier.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/sdb/XRowSetChangeBroadcaster.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/view/XSelectionSupplier.hpp>
39*cdf0e10cSrcweir /** === end UNO includes === **/
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx>
42*cdf0e10cSrcweir #include <cppuhelper/implbase7.hxx>
43*cdf0e10cSrcweir #include <tools/link.hxx>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir //.........................................................................
46*cdf0e10cSrcweir namespace frm
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir //.........................................................................
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir class OGridColumn;
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir //==================================================================
53*cdf0e10cSrcweir // ColumnDescription
54*cdf0e10cSrcweir //==================================================================
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir 	struct ColumnDescription : public ElementDescription
57*cdf0e10cSrcweir 	{
58*cdf0e10cSrcweir 	public:
59*cdf0e10cSrcweir 		OGridColumn*				pColumn;		// not owned by this instance! only to prevent duplicate XUnoTunnel usage
60*cdf0e10cSrcweir 	};
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir //==================================================================
63*cdf0e10cSrcweir // OGridControlModel
64*cdf0e10cSrcweir //==================================================================
65*cdf0e10cSrcweir typedef ::cppu::ImplHelper7 <	::com::sun::star::awt::XControlModel
66*cdf0e10cSrcweir 							,	::com::sun::star::form::XGridColumnFactory
67*cdf0e10cSrcweir 							,	::com::sun::star::form::XReset
68*cdf0e10cSrcweir 							,	::com::sun::star::view::XSelectionSupplier
69*cdf0e10cSrcweir 							,	::com::sun::star::sdb::XSQLErrorListener
70*cdf0e10cSrcweir                             ,   ::com::sun::star::sdb::XRowSetSupplier
71*cdf0e10cSrcweir                             ,   ::com::sun::star::sdb::XRowSetChangeBroadcaster
72*cdf0e10cSrcweir 							>	OGridControlModel_BASE;
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir class OGridControlModel :public OControlModel
75*cdf0e10cSrcweir 						,public OInterfaceContainer
76*cdf0e10cSrcweir 						,public OErrorBroadcaster
77*cdf0e10cSrcweir                         ,public FontControlModel
78*cdf0e10cSrcweir 						,public OGridControlModel_BASE
79*cdf0e10cSrcweir {
80*cdf0e10cSrcweir 	::cppu::OInterfaceContainerHelper		m_aSelectListeners,
81*cdf0e10cSrcweir 											m_aResetListeners,
82*cdf0e10cSrcweir                                             m_aRowSetChangeListeners;
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir // [properties]
85*cdf0e10cSrcweir 	::com::sun::star::uno::Any				m_aRowHeight;			// Zeilenhoehe
86*cdf0e10cSrcweir 	::com::sun::star::uno::Any				m_aTabStop;
87*cdf0e10cSrcweir 	::com::sun::star::uno::Any				m_aBackgroundColor;
88*cdf0e10cSrcweir 	::com::sun::star::uno::Any				m_aCursorColor; 			// transient
89*cdf0e10cSrcweir     ::com::sun::star::uno::Any              m_aBorderColor;
90*cdf0e10cSrcweir 	::rtl::OUString 						m_aDefaultControl;
91*cdf0e10cSrcweir 	::rtl::OUString 						m_sHelpText;
92*cdf0e10cSrcweir // [properties]
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >		m_xSelection;
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir // [properties]
97*cdf0e10cSrcweir 	::rtl::OUString 			m_sHelpURL; 				// URL
98*cdf0e10cSrcweir 	sal_Int16					m_nBorder;
99*cdf0e10cSrcweir     sal_Int16                   m_nWritingMode;
100*cdf0e10cSrcweir     sal_Int16                   m_nContextWritingMode;
101*cdf0e10cSrcweir 	sal_Bool					m_bEnableVisible	: 1;
102*cdf0e10cSrcweir 	sal_Bool					m_bEnable			: 1;
103*cdf0e10cSrcweir 	sal_Bool					m_bNavigation		: 1;
104*cdf0e10cSrcweir 	sal_Bool					m_bRecordMarker 	: 1;
105*cdf0e10cSrcweir 	sal_Bool					m_bPrintable		: 1;
106*cdf0e10cSrcweir 	sal_Bool					m_bAlwaysShowCursor : 1;    // transient
107*cdf0e10cSrcweir 	sal_Bool					m_bDisplaySynchron	: 1;    // transient
108*cdf0e10cSrcweir // [properties]
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir protected:
111*cdf0e10cSrcweir 	void _reset();
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir public:
114*cdf0e10cSrcweir 	DECLARE_DEFAULT_LEAF_XTOR( OGridControlModel );
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir     // UNO Anbindung
117*cdf0e10cSrcweir 	DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OControlModel);
118*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir     // XChild
121*cdf0e10cSrcweir 	virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     // XServiceInfo
124*cdf0e10cSrcweir 	IMPLEMENTATION_NAME(OGridControlModel);
125*cdf0e10cSrcweir 	virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir     // XTypeProvider
128*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir     // OComponentHelper
131*cdf0e10cSrcweir 	virtual void SAL_CALL disposing();
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir     // XEventListener
134*cdf0e10cSrcweir 	virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException);
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir     // XReset
137*cdf0e10cSrcweir 	virtual void SAL_CALL reset() throw ( ::com::sun::star::uno::RuntimeException);
138*cdf0e10cSrcweir 	virtual void SAL_CALL addResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException);
139*cdf0e10cSrcweir 	virtual void SAL_CALL removeResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException);
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir     // XSelectionSupplier
142*cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL select(const ::com::sun::star::uno::Any& aElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
143*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException);
144*cdf0e10cSrcweir 	virtual void SAL_CALL addSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException);
145*cdf0e10cSrcweir 	virtual void SAL_CALL removeSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException);
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     // XGridColumnFactory
148*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> SAL_CALL createColumn(const ::rtl::OUString& ColumnType) throw ( :: com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
149*cdf0e10cSrcweir 	virtual StringSequence SAL_CALL getColumnTypes() throw ( ::com::sun::star::uno::RuntimeException);
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir     // XPersistObject
152*cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException);
153*cdf0e10cSrcweir 	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);
154*cdf0e10cSrcweir 	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);
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir     // XPropertySet
157*cdf0e10cSrcweir 	virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
158*cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
159*cdf0e10cSrcweir 										  sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
160*cdf0e10cSrcweir 										throw(::com::sun::star::lang::IllegalArgumentException);
161*cdf0e10cSrcweir 	virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception);
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir     // XPropertyState
164*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const;
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir     // XSQLErrorListener
167*cdf0e10cSrcweir 	virtual void SAL_CALL errorOccured( const ::com::sun::star::sdb::SQLErrorEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir     // XRowSetSupplier
170*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > SAL_CALL getRowSet(  ) throw (::com::sun::star::uno::RuntimeException);
171*cdf0e10cSrcweir     virtual void SAL_CALL setRowSet( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xDataSource ) throw (::com::sun::star::uno::RuntimeException);
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir     // XRowSetChangeBroadcaster
174*cdf0e10cSrcweir     virtual void SAL_CALL addRowSetChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetChangeListener >& i_Listener ) throw (::com::sun::star::uno::RuntimeException);
175*cdf0e10cSrcweir     virtual void SAL_CALL removeRowSetChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetChangeListener >& i_Listener ) throw (::com::sun::star::uno::RuntimeException);
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir     // OControlModel's property handling
178*cdf0e10cSrcweir 	virtual void describeFixedProperties(
179*cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
180*cdf0e10cSrcweir     ) const;
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir     // prevent method hiding
183*cdf0e10cSrcweir     using OControlModel::disposing;
184*cdf0e10cSrcweir     using OControlModel::getFastPropertyValue;
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir protected:
187*cdf0e10cSrcweir 	DECLARE_XCLONEABLE();
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir protected:
190*cdf0e10cSrcweir 	virtual void approveNewElement(
191*cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject,
192*cdf0e10cSrcweir 			ElementDescription* _pElement
193*cdf0e10cSrcweir 		);
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>  createColumn(sal_Int32 nTypeId) const;
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 	OGridColumn* getColumnImplementation(const InterfaceRef& _rxIFace) const;
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 	virtual ElementDescription* createElementMetaData( );
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir protected:
202*cdf0e10cSrcweir 	virtual void implRemoved(const InterfaceRef& _rxObject);
203*cdf0e10cSrcweir 	virtual void implInserted( const ElementDescription* _pElement );
204*cdf0e10cSrcweir 	virtual void impl_replacedElement(
205*cdf0e10cSrcweir                     const ::com::sun::star::container::ContainerEvent& _rEvent,
206*cdf0e10cSrcweir                     ::osl::ClearableMutexGuard& _rInstanceLock
207*cdf0e10cSrcweir                 );
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 	void gotColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
210*cdf0e10cSrcweir 	void lostColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 	void cloneColumns( const OGridControlModel* _pOriginalContainer );
213*cdf0e10cSrcweir };
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir //.........................................................................
216*cdf0e10cSrcweir }	// namespace frm
217*cdf0e10cSrcweir //.........................................................................
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 
220