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